feat(import): add stable per-resource source keys to the importer contract (#614)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Gregory Schier
2026-09-01 08:11:54 -07:00
committed by GitHub
co-authored by Claude Opus 5
parent e63a87718c
commit 81a2a5d955
28 changed files with 785 additions and 49 deletions
+12 -1
View File
@@ -474,7 +474,18 @@ export type ImportRequest = { content: string, };
export type ImportResources = { workspaces: Array<Workspace>, environments: Array<Environment>, folders: Array<Folder>, httpRequests: Array<HttpRequest>, grpcRequests: Array<GrpcRequest>, websocketRequests: Array<WebsocketRequest>, };
export type ImportResponse = { importer: string, resources: ImportResources, };
export type ImportResponse = {
/**
* Display name of the importer that recognized the input.
*/
importer: string, resources: ImportResources,
/**
* Identifies the same source element across re-parses, keyed by the IDs in `resources`.
*
* Must come from the document, never from anything the user can rename in Yaak. Only set
* for formats that carry their own identifiers; the host derives the rest.
*/
sourceKeys?: { [key in string]?: string }, };
export type InternalEvent = { id: string, pluginRefId: string, pluginName: string, replyId: string | null, context: PluginContext, payload: InternalEventPayload, };
@@ -1,4 +1,4 @@
import type { ImportResources } from "../bindings/gen_events";
import type { ImportResources, ImportResponse } from "../bindings/gen_events";
import type { AtLeast, MaybePromise } from "../helpers";
import type { Context } from "./Context";
@@ -14,9 +14,12 @@ export type PartialImportResources = {
websocketRequests: Array<AtLeast<ImportResources["websocketRequests"][0], CommonFields>>;
};
export type ImportPluginResponse = null | {
resources: PartialImportResources;
};
/** `importer` is omitted because the host fills it in from the plugin's own name. */
export type ImportPluginResponse =
| null
| (Omit<ImportResponse, "importer" | "resources"> & {
resources: PartialImportResources;
});
export type ImporterPlugin = {
name: string;