Skip to content
1 min read · 145 words

Function: collectArtifactCompatibleIds()

ts
function collectArtifactCompatibleIds(
  ctx: {
    turnRetrievables: Iterable<{
      content: unknown;
      id: string;
      inline: boolean;
    }>;
    turnToolCalls: Iterable<{
      fromArtifactTool?: boolean;
      id: string;
      results: unknown;
    }>;
  },
  requires: SpooledArtifactConstructor,
): string[];

Defined in: src/lib/classes/spooled_artifact.ts:79

Collect artifact IDs from the current turn's tool calls and retrievables that are instances of a specific artifact class.

Parameters

ParameterTypeDescription
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.turnRetrievablesIterable<{ content: unknown; id: string; inline: boolean; }>-
ctx.turnToolCallsIterable<{ fromArtifactTool?: boolean; id: string; results: unknown; }>-
requiresSpooledArtifactConstructorThe artifact class constructor to filter by.

Returns

string[]

An array of unique artifact IDs matching the specified class, with collision detection.

Throws

@nhtio/adk!E_ARTIFACT_ID_COLLISION when the same ID appears in both tool calls and retrievables.