Function: resolveArtifactById()
ts
function resolveArtifactById(
ctx: {
turnRetrievables: Iterable<{
content: unknown;
id: string;
inline: boolean;
}>;
turnToolCalls: Iterable<{
fromArtifactTool?: boolean;
id: string;
results: unknown;
}>;
},
id: string,
requires: SpooledArtifactConstructor,
):
| {
artifact: SpooledArtifact;
source: "toolCall" | "retrievable";
}
| undefined;Defined in: src/lib/classes/spooled_artifact.ts:113
Resolve an artifact by ID from the current turn's tool calls or retrievables, with type narrowing.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | { turnRetrievables: Iterable<{ content: unknown; id: string; inline: boolean; }>; turnToolCalls: Iterable<{ fromArtifactTool?: boolean; id: string; results: unknown; }>; } | The dispatch context containing tool calls and retrievables. |
ctx.turnRetrievables | Iterable<{ content: unknown; id: string; inline: boolean; }> | - |
ctx.turnToolCalls | Iterable<{ fromArtifactTool?: boolean; id: string; results: unknown; }> | - |
id | string | The artifact ID to resolve. |
requires | SpooledArtifactConstructor | The artifact class constructor to narrow by; only artifacts of this type are returned. |
Returns
| { artifact: SpooledArtifact; source: "toolCall" | "retrievable"; } | undefined
The resolved artifact and its source (tool call or retrievable), or undefined if not found.