@agent-inspect/ai-sdk 6.31.37 → 6.31.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +642 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +122 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.mjs +640 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/usage.ts","../src/index.ts"],"names":["createAdapterPreviewCapture","fileWriter","bindTelemetryIntegration"],"mappings":";;;;;;;;;AAiBA,SAAS,kBAAkB,KAAA,EAAoC;AAC7D,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,MAAA,CAAO,SAAS,KAAK,CAAA,IAAK,KAAA,IAAS,CAAA,GACnE,KAAA,GACA,MAAA;AACN;AAEA,SAAS,cAAc,KAAA,EAAkD;AACvE,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAGO,SAAS,oBACd,KAAA,EACiC;AACjC,EAAA,IAAI,CAAC,OAAO,OAAO,MAAA;AAEnB,EAAA,IAAI,QAAQ,iBAAA,CAAkB,KAAA,CAAM,WAAW,CAAA,IAAK,iBAAA,CAAkB,MAAM,KAAK,CAAA;AACjF,EAAA,IAAI,SACF,iBAAA,CAAkB,KAAA,CAAM,YAAY,CAAA,IAAK,iBAAA,CAAkB,MAAM,MAAM,CAAA;AACzE,EAAA,IAAI,QAAQ,iBAAA,CAAkB,KAAA,CAAM,WAAW,CAAA,IAAK,iBAAA,CAAkB,MAAM,KAAK,CAAA;AACjF,EAAA,IAAI,SACF,iBAAA,CAAkB,KAAA,CAAM,iBAAiB,CAAA,IAAK,iBAAA,CAAkB,MAAM,MAAM,CAAA;AAC9E,EAAA,IAAI,UAAA,GAAa,iBAAA,CAAkB,KAAA,CAAM,UAAU,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KAAA,CAAM,KAAK,CAAA;AAAA,IAC/B,SAAS,KAAA,EAAO;AACd,MAAA,IAAA,CAAK,YAAY,aAAA,IAAiB,CAAA;AAClC,MAAA,IAAA,CAAK,WAAA,CAAY,SAAA,GAAY,cAAA,CAAe,KAAK,CAAA;AAAA,IACnD;AAAA,EACF;AACF,CAAA;AAUO,SAAS,YAAA,CACd,OAAA,GAAoC,EAAC,EACP;AAC9B,EAAA,MAAM,WAAA,GAAc,IAAI,qCAAA,CAAsC,OAAO,CAAA;AACrE,EAAA,OAAO;AAAA,IACL,GAAGC,4BAAyB,WAAW,CAAA;AAAA,IACvC,cAAA,EAAgB,MAAM,WAAA,CAAY,cAAA,EAAe;AAAA,IACjD,cAAA,EAAgB,MAAM,WAAA,CAAY,cAAA,EAAe;AAAA,IACjD,KAAA,EAAO,MAAM,WAAA,CAAY,KAAA,EAAM;AAAA,IAC/B,KAAA,EAAO,MAAM,WAAA,CAAY,KAAA;AAAM,GACjC;AACF","file":"index.cjs","sourcesContent":["import type { PersistedTokenUsage } from \"agent-inspect/persisted\";\n\nexport type AiSdkUsage = {\n inputTokens?: number | Record<string, unknown>;\n outputTokens?: number | Record<string, unknown>;\n totalTokens?: number;\n cachedInputTokens?: number;\n inputTokenDetails?: Record<string, unknown>;\n outputTokenDetails?: Record<string, unknown>;\n input?: number;\n output?: number;\n total?: number;\n cached?: number;\n cacheWrite?: number;\n reasoning?: number;\n};\n\nfunction nonNegativeFinite(value: unknown): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value) && value >= 0\n ? value\n : undefined;\n}\n\nfunction isUsageRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** Map AI SDK flat or nested V3 usage into persisted token vocabulary (no pricing). */\nexport function summarizeAiSdkUsage(\n usage: AiSdkUsage | undefined,\n): PersistedTokenUsage | undefined {\n if (!usage) return undefined;\n\n let input = nonNegativeFinite(usage.inputTokens) ?? nonNegativeFinite(usage.input);\n let output =\n nonNegativeFinite(usage.outputTokens) ?? nonNegativeFinite(usage.output);\n let total = nonNegativeFinite(usage.totalTokens) ?? nonNegativeFinite(usage.total);\n let cached =\n nonNegativeFinite(usage.cachedInputTokens) ?? nonNegativeFinite(usage.cached);\n let cacheWrite = nonNegativeFinite(usage.cacheWrite);\n let reasoning = nonNegativeFinite(usage.reasoning);\n\n if (isUsageRecord(usage.inputTokens)) {\n input = nonNegativeFinite(usage.inputTokens.total) ?? input;\n cached =\n nonNegativeFinite(usage.inputTokens.cacheRead) ??\n nonNegativeFinite(usage.inputTokens.cache_read) ??\n cached;\n cacheWrite =\n nonNegativeFinite(usage.inputTokens.cacheWrite) ??\n nonNegativeFinite(usage.inputTokens.cache_write) ??\n nonNegativeFinite(usage.inputTokens.cacheCreation) ??\n cacheWrite;\n }\n\n if (isUsageRecord(usage.outputTokens)) {\n output = nonNegativeFinite(usage.outputTokens.total) ?? output;\n reasoning =\n nonNegativeFinite(usage.outputTokens.reasoning) ??\n nonNegativeFinite(usage.outputTokens.reasoningTokens) ??\n reasoning;\n }\n\n if (isUsageRecord(usage.inputTokenDetails)) {\n cached =\n nonNegativeFinite(usage.inputTokenDetails.cacheReadTokens) ??\n nonNegativeFinite(usage.inputTokenDetails.cacheRead) ??\n cached;\n cacheWrite =\n nonNegativeFinite(usage.inputTokenDetails.cacheWriteTokens) ??\n nonNegativeFinite(usage.inputTokenDetails.cacheWrite) ??\n cacheWrite;\n }\n\n if (isUsageRecord(usage.outputTokenDetails)) {\n reasoning =\n nonNegativeFinite(usage.outputTokenDetails.reasoningTokens) ??\n nonNegativeFinite(usage.outputTokenDetails.reasoning) ??\n reasoning;\n }\n\n const tokenUsage: PersistedTokenUsage = {};\n if (input !== undefined) tokenUsage.input = input;\n if (output !== undefined) tokenUsage.output = output;\n if (total !== undefined) tokenUsage.total = total;\n if (cached !== undefined) tokenUsage.cached = cached;\n if (cacheWrite !== undefined) tokenUsage.cacheWrite = cacheWrite;\n if (reasoning !== undefined) tokenUsage.reasoning = reasoning;\n\n return Object.keys(tokenUsage).length > 0 ? tokenUsage : undefined;\n}\n","import { bindTelemetryIntegration } from \"ai\";\nimport type {\n OnFinishEvent,\n OnStartEvent,\n OnStepFinishEvent,\n OnStepStartEvent,\n OnToolCallFinishEvent,\n OnToolCallStartEvent,\n TelemetryIntegration,\n} from \"ai\";\nimport { createAdapterPreviewCapture } from \"agent-inspect/advanced\";\nimport type {\n AdapterCaptureDiagnostics,\n AdapterDiagnosticListener,\n AdapterPreviewCapture,\n RedactionProfile,\n} from \"agent-inspect/advanced\";\nimport type {\n PersistedInspectEvent,\n PersistedInspectError,\n} from \"agent-inspect/persisted\";\nimport { fileWriter } from \"agent-inspect/writers\";\nimport type { TraceWriter, TraceWriterStats } from \"agent-inspect/writers\";\n\nimport { summarizeAiSdkUsage } from \"./usage.js\";\n\n/**\n * Experimental capture mode for the AI SDK adapter.\n *\n * `metadata-only` is the default. `preview` persists bounded, redacted preview\n * attributes through the shared adapter capture helper.\n *\n * @experimental This package is part of the framework adapter train.\n */\nexport type AgentInspectAiSdkCaptureMode = \"metadata-only\" | \"preview\";\n\n/**\n * Options for the experimental AI SDK telemetry integration.\n *\n * @experimental Callers must keep AI SDK telemetry configured with\n * `recordInputs: false` and `recordOutputs: false`.\n */\nexport interface AgentInspectAiSdkOptions {\n /**\n * Explicit local writer for runtime integration.\n */\n writer?: TraceWriter;\n\n /**\n * Convenience local trace directory for writer-owned persistence.\n */\n traceDir?: string;\n\n /**\n * Optional run name used by lifecycle mapping.\n */\n runName?: string;\n\n /**\n * Capture policy. Defaults to metadata-only.\n *\n * @experimental `preview` persists bounded, redacted prompt/message/output\n * previews. It never persists full content.\n */\n capture?: AgentInspectAiSdkCaptureMode;\n\n /**\n * Redaction profile applied to preview attributes before persistence.\n * `share` and `strict` also cap `maxPreviewChars`.\n *\n * @experimental Effective only when `capture: \"preview\"`.\n */\n redactionProfile?: RedactionProfile;\n\n /**\n * Upper bound for each serialized preview attribute. Defaults to 200.\n *\n * @experimental Effective only when `capture: \"preview\"`.\n */\n maxPreviewChars?: number;\n\n /**\n * Receives bounded capture diagnostics such as\n * `AI_CAPTURE_FIELD_UNAVAILABLE`. Listener failures are isolated.\n *\n * @experimental\n */\n onDiagnostic?: AdapterDiagnosticListener;\n}\n\nexport interface AgentInspectAiSdkDiagnostics {\n writeFailures: number;\n lifecycleWarnings: number;\n flushFailures: number;\n closeFailures: number;\n lastError?: string;\n lastWarning?: string;\n /** Shared preview-capture counters (`@experimental`). */\n capture: AdapterCaptureDiagnostics;\n}\n\nexport interface AgentInspectAiSdkIntegration extends TelemetryIntegration {\n getDiagnostics(): AgentInspectAiSdkDiagnostics;\n getWriterStats(): TraceWriterStats | undefined;\n flush(): Promise<void>;\n close(): Promise<void>;\n}\n\ntype AiSdkModelInfo = {\n provider?: string;\n modelId?: string;\n};\n\ninterface ActiveStep {\n eventId: string;\n parentId: string;\n startedAt: string;\n}\n\ninterface ActiveTool {\n eventId: string;\n parentId: string;\n startedAt: string;\n toolName: string;\n}\n\ninterface ActiveRun {\n runId: string;\n eventId: string;\n name: string;\n startedAt: string;\n model?: AiSdkModelInfo;\n steps: Map<number, ActiveStep>;\n tools: Map<string, ActiveTool>;\n}\n\nconst AI_SDK_SOURCE = {\n type: \"ai-sdk\",\n name: \"@agent-inspect/ai-sdk\",\n version: \"experimental\",\n} as const;\n\nfunction nowIso(): string {\n return new Date().toISOString();\n}\n\nfunction createId(prefix: string): string {\n if (typeof crypto !== \"undefined\" && \"randomUUID\" in crypto) {\n return `${prefix}_${crypto.randomUUID()}`;\n }\n return `${prefix}_${Date.now()}_${Math.random().toString(16).slice(2)}`;\n}\n\nfunction normalizeError(error: unknown): string {\n if (error instanceof Error && error.message.trim() !== \"\") {\n return error.message;\n }\n if (typeof error === \"string\" && error.trim() !== \"\") {\n return error;\n }\n return \"Unknown AI SDK integration error\";\n}\n\nfunction durationMs(startedAt: string, endedAt: string): number | undefined {\n const started = Date.parse(startedAt);\n const ended = Date.parse(endedAt);\n if (!Number.isFinite(started) || !Number.isFinite(ended)) return undefined;\n return Math.max(0, ended - started);\n}\n\nfunction countRecordKeys(value: unknown): number | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n return Object.keys(value).length;\n}\n\nfunction normalizeMaxPreviewChars(value: unknown): number | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value) || value < 0) {\n return undefined;\n }\n return Math.floor(value);\n}\n\nfunction summarizeUnknown(value: unknown): Record<string, unknown> {\n if (value === null) return { type: \"null\" };\n if (Array.isArray(value)) return { type: \"array\", itemCount: value.length };\n\n if (typeof value === \"object\") {\n return { type: \"object\", keyCount: countRecordKeys(value) ?? 0 };\n }\n if (typeof value === \"string\") {\n return { type: \"string\", length: value.length };\n }\n const valueType = typeof value;\n if (valueType === \"number\" || valueType === \"boolean\" || valueType === \"bigint\") {\n return { type: valueType };\n }\n if (valueType === \"undefined\") return { type: \"undefined\" };\n return { type: \"unknown\" };\n}\n\nfunction summarizeError(error: unknown): PersistedInspectError {\n if (error instanceof Error) {\n return {\n name: error.name || \"Error\",\n message: error.message,\n };\n }\n if (typeof error === \"string\") {\n return {\n message: error,\n };\n }\n return {\n message: \"Unknown AI SDK tool error\",\n };\n}\n\nfunction summarizeModel(model: AiSdkModelInfo | undefined): Record<string, unknown> {\n return {\n provider: model?.provider,\n modelId: model?.modelId,\n };\n}\n\nfunction summarizeFinishReason(\n finishReason: unknown,\n): { finishReason?: string; rawFinishReason?: string } {\n if (typeof finishReason === \"string\") {\n return { finishReason };\n }\n if (typeof finishReason !== \"object\" || finishReason === null) {\n return {};\n }\n\n const value = finishReason as { unified?: unknown; raw?: unknown };\n return {\n finishReason: typeof value.unified === \"string\" ? value.unified : undefined,\n rawFinishReason: typeof value.raw === \"string\" ? value.raw : undefined,\n };\n}\n\nclass AgentInspectAiSdkTelemetryIntegration {\n private readonly writer: TraceWriter | undefined;\n private readonly requestedCapture: AgentInspectAiSdkCaptureMode;\n private readonly preview: AdapterPreviewCapture;\n private readonly effectiveCapture: AgentInspectAiSdkCaptureMode;\n private readonly diagnostics: Omit<AgentInspectAiSdkDiagnostics, \"capture\"> = {\n writeFailures: 0,\n lifecycleWarnings: 0,\n flushFailures: 0,\n closeFailures: 0,\n };\n private activeRun: ActiveRun | undefined;\n private suspendedReason: string | undefined;\n\n constructor(private readonly options: AgentInspectAiSdkOptions) {\n this.requestedCapture = options.capture ?? \"metadata-only\";\n this.preview = createAdapterPreviewCapture({\n capture: this.requestedCapture,\n redactionProfile: options.redactionProfile,\n maxPreviewChars: options.maxPreviewChars,\n onDiagnostic: options.onDiagnostic,\n });\n this.effectiveCapture = this.preview.capture;\n this.writer = options.writer ?? (options.traceDir ? fileWriter({ dir: options.traceDir }) : undefined);\n this.recordCaptureOptionWarnings();\n }\n\n getDiagnostics(): AgentInspectAiSdkDiagnostics {\n return { ...this.diagnostics, capture: this.preview.getDiagnostics() };\n }\n\n /** Bounded preview attributes for one lifecycle event (empty unless enabled). */\n private previewAttributes(\n fields: Record<string, unknown>,\n ): Record<string, unknown> {\n return this.preview.applyPreviewFields({}, fields);\n }\n\n /**\n * AI SDK 6 audit (6.29.3): callbacks do not expose a stable run/step UUID on\n * all lifecycle hooks (only `toolCallId` is stable). Overlapping generations\n * therefore cannot be multiplexed safely — abandon and terminalize instead.\n */\n private async terminalizeActiveRun(\n reason: \"abandoned-overlap\" | \"abandoned-close\",\n ): Promise<void> {\n const run = this.activeRun;\n if (!run) return;\n const endedAt = nowIso();\n const status = reason === \"abandoned-overlap\" ? \"error\" : \"unknown\";\n\n for (const tool of run.tools.values()) {\n await this.write({\n schemaVersion: \"0.2\",\n eventId: tool.eventId,\n runId: run.runId,\n parentId: tool.parentId,\n kind: \"TOOL\",\n name: tool.toolName,\n status,\n timestamp: endedAt,\n startedAt: tool.startedAt,\n endedAt,\n durationMs: durationMs(tool.startedAt, endedAt),\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_completed\",\n lifecycle: reason,\n toolName: tool.toolName,\n },\n });\n }\n\n for (const [stepNumber, step] of run.steps.entries()) {\n await this.write({\n schemaVersion: \"0.2\",\n eventId: step.eventId,\n runId: run.runId,\n parentId: step.parentId,\n kind: \"LLM\",\n name: `ai-sdk-step-${stepNumber}`,\n status,\n timestamp: endedAt,\n startedAt: step.startedAt,\n endedAt,\n durationMs: durationMs(step.startedAt, endedAt),\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_completed\",\n lifecycle: reason,\n stepNumber,\n },\n });\n }\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId: run.eventId,\n runId: run.runId,\n kind: \"RUN\",\n name: run.name,\n status,\n timestamp: endedAt,\n startedAt: run.startedAt,\n endedAt,\n durationMs: durationMs(run.startedAt, endedAt),\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"run_completed\",\n lifecycle: reason,\n ...summarizeModel(run.model),\n },\n });\n\n run.steps.clear();\n run.tools.clear();\n this.activeRun = undefined;\n }\n\n async onStart(event: OnStartEvent): Promise<void> {\n await this.handleLifecycle(\"onStart\", async () => {\n if (this.activeRun || this.suspendedReason) {\n if (this.activeRun) {\n await this.terminalizeActiveRun(\"abandoned-overlap\");\n }\n this.suspendedReason =\n \"Overlapping AI SDK generation ignored; create one agentInspect() integration per concurrent generation.\";\n this.recordLifecycleWarning(this.suspendedReason);\n return;\n }\n\n const startedAt = nowIso();\n const runId = createId(\"ai_sdk_run\");\n const eventId = createId(\"event\");\n const name =\n this.options.runName ??\n event.functionId ??\n event.model.modelId ??\n \"ai-sdk-generation\";\n\n this.activeRun = {\n runId,\n eventId,\n name,\n startedAt,\n model: event.model,\n steps: new Map(),\n tools: new Map(),\n };\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId,\n runId,\n kind: \"RUN\",\n name,\n status: \"running\",\n timestamp: startedAt,\n startedAt,\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"run_started\",\n ...summarizeModel(event.model),\n functionId: event.functionId,\n capture: this.effectiveCapture,\n requestedCapture:\n this.requestedCapture === this.effectiveCapture\n ? undefined\n : this.requestedCapture,\n previewCaptureSupported: true,\n // Preview rows report the effective bound/profile, which the\n // `share` and `strict` profiles can lower below the request.\n redactionProfile: this.preview.previewEnabled\n ? this.preview.redactionProfile\n : this.options.redactionProfile,\n maxPreviewChars: this.preview.previewEnabled\n ? this.preview.maxPreviewChars\n : normalizeMaxPreviewChars(this.options.maxPreviewChars),\n recordInputsRequired: false,\n recordOutputsRequired: false,\n toolCount: countRecordKeys(event.tools),\n hasPrompt: event.prompt !== undefined,\n hasMessages: event.messages !== undefined,\n metadataKeyCount: countRecordKeys(event.metadata),\n ...this.previewAttributes({\n input: event.prompt ?? event.messages,\n }),\n },\n });\n });\n }\n\n async onStepStart(event: OnStepStartEvent): Promise<void> {\n await this.handleLifecycle(\"onStepStart\", async () => {\n const run = this.getActiveRun(\"onStepStart\");\n if (!run) return;\n const startedAt = nowIso();\n const stepEventId = createId(\"event\");\n run.steps.set(event.stepNumber, {\n eventId: stepEventId,\n parentId: run.eventId,\n startedAt,\n });\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId: stepEventId,\n runId: run.runId,\n parentId: run.eventId,\n kind: \"LLM\",\n name: `ai-sdk-step-${event.stepNumber}`,\n status: \"running\",\n timestamp: startedAt,\n startedAt,\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_started\",\n stepId: stepEventId,\n ...summarizeModel(event.model),\n functionId: event.functionId,\n stepNumber: event.stepNumber,\n priorStepCount: event.steps.length,\n activeToolCount: event.activeTools?.length,\n toolCount: countRecordKeys(event.tools),\n messageCount: event.messages.length,\n metadataKeyCount: countRecordKeys(event.metadata),\n ...this.previewAttributes({ input: event.messages }),\n },\n });\n });\n }\n\n async onStepFinish(event: OnStepFinishEvent): Promise<void> {\n await this.handleLifecycle(\"onStepFinish\", async () => {\n const run = this.getActiveRun(\"onStepFinish\");\n if (!run) return;\n const endedAt = nowIso();\n const activeStep = run.steps.get(event.stepNumber);\n if (!activeStep) {\n this.recordLifecycleWarning(\n `onStepFinish ignored because step ${event.stepNumber} has no matching start callback.`,\n );\n return;\n }\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId: activeStep.eventId,\n runId: run.runId,\n parentId: activeStep.parentId,\n kind: \"LLM\",\n name: `ai-sdk-step-${event.stepNumber}`,\n status: \"ok\",\n timestamp: endedAt,\n startedAt: activeStep.startedAt,\n endedAt,\n durationMs: durationMs(activeStep.startedAt, endedAt),\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_completed\",\n stepId: activeStep.eventId,\n ...summarizeModel(event.model),\n functionId: event.functionId,\n stepNumber: event.stepNumber,\n ...summarizeFinishReason(event.finishReason),\n warningCount: event.warnings?.length ?? 0,\n contentPartCount: event.content.length,\n toolCallCount: event.toolCalls.length,\n toolResultCount: event.toolResults.length,\n responseId: event.response.id,\n responseModelId: event.response.modelId,\n responseTimestamp: event.response.timestamp?.toISOString(),\n metadataKeyCount: countRecordKeys(event.metadata),\n ...this.previewAttributes({ output: event.text }),\n },\n tokenUsage: summarizeAiSdkUsage(event.usage),\n outputSummary: {\n contentPartCount: event.content.length,\n textLength: event.text.length,\n reasoningPartCount: event.reasoning.length,\n fileCount: event.files.length,\n sourceCount: event.sources.length,\n },\n });\n // Drop finished steps so overlap/close terminalization only touches open rows.\n run.steps.delete(event.stepNumber);\n });\n }\n\n async onToolCallStart(event: OnToolCallStartEvent): Promise<void> {\n await this.handleLifecycle(\"onToolCallStart\", async () => {\n const run = this.getActiveRun(\"onToolCallStart\");\n if (!run) return;\n const startedAt = nowIso();\n const eventId = createId(\"event\");\n const toolCall = event.toolCall;\n const step = event.stepNumber === undefined ? undefined : run.steps.get(event.stepNumber);\n const parentId = step?.eventId ?? run.eventId;\n if (event.stepNumber === undefined || !step) {\n this.recordLifecycleWarning(\n \"onToolCallStart attached tool to run because the AI SDK callback did not expose a matching active step.\",\n );\n }\n run.tools.set(toolCall.toolCallId, {\n eventId,\n parentId,\n startedAt,\n toolName: toolCall.toolName,\n });\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId,\n runId: run.runId,\n parentId,\n kind: \"TOOL\",\n name: toolCall.toolName,\n status: \"running\",\n timestamp: startedAt,\n startedAt,\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_started\",\n stepId: eventId,\n ...summarizeModel(event.model),\n functionId: event.functionId,\n stepNumber: event.stepNumber,\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n dynamic: toolCall.dynamic === true,\n invalid: toolCall.invalid === true,\n providerExecuted: toolCall.providerExecuted === true,\n messageCount: event.messages.length,\n metadataKeyCount: countRecordKeys(event.metadata),\n providerMetadataKeyCount: countRecordKeys(toolCall.providerMetadata),\n toolMetadataKeyCount: countRecordKeys(toolCall.toolMetadata),\n ...this.previewAttributes({ input: toolCall.input }),\n },\n inputSummary: summarizeUnknown(toolCall.input),\n error: toolCall.invalid ? summarizeError(toolCall.error) : undefined,\n });\n });\n }\n\n async onToolCallFinish(event: OnToolCallFinishEvent): Promise<void> {\n await this.handleLifecycle(\"onToolCallFinish\", async () => {\n const run = this.getActiveRun(\"onToolCallFinish\");\n if (!run) return;\n const endedAt = nowIso();\n const toolCall = event.toolCall;\n const activeTool = run.tools.get(toolCall.toolCallId);\n if (!activeTool) {\n this.recordLifecycleWarning(\n `onToolCallFinish ignored because tool call ${toolCall.toolCallId} has no matching start callback.`,\n );\n return;\n }\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId: activeTool.eventId,\n runId: run.runId,\n parentId: activeTool.parentId,\n kind: \"TOOL\",\n name: activeTool.toolName,\n status: event.success ? \"ok\" : \"error\",\n timestamp: endedAt,\n startedAt: activeTool.startedAt,\n endedAt,\n durationMs: event.durationMs,\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"step_completed\",\n stepId: activeTool.eventId,\n ...summarizeModel(event.model),\n functionId: event.functionId,\n stepNumber: event.stepNumber,\n toolCallId: toolCall.toolCallId,\n toolName: toolCall.toolName,\n dynamic: toolCall.dynamic === true,\n invalid: toolCall.invalid === true,\n providerExecuted: toolCall.providerExecuted === true,\n messageCount: event.messages.length,\n metadataKeyCount: countRecordKeys(event.metadata),\n providerMetadataKeyCount: countRecordKeys(toolCall.providerMetadata),\n toolMetadataKeyCount: countRecordKeys(toolCall.toolMetadata),\n ...this.previewAttributes({\n input: toolCall.input,\n ...(event.success ? { output: event.output } : {}),\n }),\n },\n outputSummary: event.success ? summarizeUnknown(event.output) : undefined,\n error: event.success ? undefined : summarizeError(event.error),\n });\n // Drop finished tools so overlap/close terminalization only touches open rows.\n run.tools.delete(toolCall.toolCallId);\n });\n }\n\n async onFinish(event: OnFinishEvent): Promise<void> {\n await this.handleLifecycle(\"onFinish\", async () => {\n if (this.suspendedReason) {\n this.suspendedReason = undefined;\n return;\n }\n const run = this.getActiveRun(\"onFinish\");\n if (!run) return;\n const endedAt = nowIso();\n\n await this.write({\n schemaVersion: \"0.2\",\n eventId: run.eventId,\n runId: run.runId,\n kind: \"RUN\",\n name: run.name,\n status: \"ok\",\n timestamp: endedAt,\n startedAt: run.startedAt,\n endedAt,\n durationMs: durationMs(run.startedAt, endedAt),\n confidence: \"explicit\",\n source: AI_SDK_SOURCE,\n attributes: {\n legacyEvent: \"run_completed\",\n ...summarizeModel(event.model ?? run.model),\n functionId: event.functionId,\n ...summarizeFinishReason(event.finishReason),\n stepCount: event.steps.length,\n warningCount: event.warnings?.length ?? 0,\n toolCallCount: event.toolCalls.length,\n toolResultCount: event.toolResults.length,\n metadataKeyCount: countRecordKeys(event.metadata),\n ...this.previewAttributes({ output: event.text }),\n },\n tokenUsage: summarizeAiSdkUsage(event.totalUsage),\n outputSummary: {\n contentPartCount: event.content.length,\n textLength: event.text.length,\n reasoningPartCount: event.reasoning.length,\n fileCount: event.files.length,\n sourceCount: event.sources.length,\n },\n });\n\n this.activeRun = undefined;\n });\n }\n\n getWriterStats(): TraceWriterStats | undefined {\n return this.writer?.getStats?.();\n }\n\n async flush(): Promise<void> {\n try {\n await this.writer?.flush?.();\n } catch (error) {\n this.diagnostics.flushFailures += 1;\n this.diagnostics.lastError = normalizeError(error);\n }\n }\n\n async close(): Promise<void> {\n try {\n if (this.activeRun) {\n await this.terminalizeActiveRun(\"abandoned-close\");\n }\n await this.writer?.close?.();\n } catch (error) {\n this.diagnostics.closeFailures += 1;\n this.diagnostics.lastError = normalizeError(error);\n } finally {\n this.activeRun = undefined;\n this.suspendedReason = undefined;\n }\n }\n\n private getActiveRun(callbackName: string): ActiveRun | undefined {\n if (this.suspendedReason) {\n this.recordLifecycleWarning(\n `${callbackName} ignored while integration is suspended: ${this.suspendedReason}`,\n );\n return undefined;\n }\n if (this.activeRun) return this.activeRun;\n\n this.recordLifecycleWarning(\n `${callbackName} ignored because no active AI SDK generation was started.`,\n );\n return undefined;\n }\n\n private async handleLifecycle(\n callbackName: string,\n run: () => Promise<void>,\n ): Promise<void> {\n try {\n await run();\n } catch (error) {\n this.recordLifecycleWarning(`${callbackName}: ${normalizeError(error)}`);\n }\n }\n\n private recordLifecycleWarning(message: string): void {\n this.diagnostics.lifecycleWarnings += 1;\n this.diagnostics.lastWarning = message;\n }\n\n private recordCaptureOptionWarnings(): void {\n if (this.effectiveCapture === \"preview\") return;\n\n const previewOnlyOptions: string[] = [];\n if (this.options.redactionProfile !== undefined) previewOnlyOptions.push(\"redactionProfile\");\n if (this.options.maxPreviewChars !== undefined) previewOnlyOptions.push(\"maxPreviewChars\");\n\n if (previewOnlyOptions.length > 0) {\n this.recordLifecycleWarning(\n `AI SDK preview-only options have no effect in metadata-only capture: ${previewOnlyOptions.join(\", \")}.`,\n );\n }\n }\n\n private async write(event: PersistedInspectEvent): Promise<void> {\n if (!this.writer) return;\n\n try {\n await this.writer.write(event);\n } catch (error) {\n this.diagnostics.writeFailures += 1;\n this.diagnostics.lastError = normalizeError(error);\n }\n }\n}\n\n/**\n * Create an AgentInspect telemetry integration for the Vercel AI SDK.\n *\n * @experimental The adapter maps generation, LLM step, and tool lifecycle\n * events. Capture is metadata-only by default; `capture: \"preview\"` adds\n * bounded, redacted preview attributes. Keep AI SDK telemetry configured with\n * `recordInputs: false` and `recordOutputs: false`.\n */\nexport function agentInspect(\n options: AgentInspectAiSdkOptions = {},\n): AgentInspectAiSdkIntegration {\n const integration = new AgentInspectAiSdkTelemetryIntegration(options);\n return {\n ...bindTelemetryIntegration(integration),\n getDiagnostics: () => integration.getDiagnostics(),\n getWriterStats: () => integration.getWriterStats(),\n flush: () => integration.flush(),\n close: () => integration.close(),\n };\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { TelemetryIntegration } from 'ai';
|
|
2
|
+
import { TraceWriterStats, TraceWriter } from 'agent-inspect/writers';
|
|
3
|
+
|
|
4
|
+
/** Named redaction presets for trace writing and share-safe exports (v1.3.0+). */
|
|
5
|
+
type RedactionProfile = "local" | "share" | "strict";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Capture policy shared by the official adapters.
|
|
9
|
+
*
|
|
10
|
+
* `metadata-only` is the default everywhere and never persists framework
|
|
11
|
+
* payload content. `preview` opts into bounded, redacted previews.
|
|
12
|
+
*/
|
|
13
|
+
type AdapterCaptureMode = "metadata-only" | "preview";
|
|
14
|
+
/** Stable diagnostic codes emitted by shared preview capture. */
|
|
15
|
+
declare const ADAPTER_CAPTURE_DIAGNOSTIC_CODES: readonly ["AI_CAPTURE_FIELD_UNAVAILABLE", "AI_CAPTURE_PREVIEW_TRUNCATED", "AI_CAPTURE_PREVIEW_REDACTED"];
|
|
16
|
+
type AdapterCaptureDiagnosticCode = (typeof ADAPTER_CAPTURE_DIAGNOSTIC_CODES)[number];
|
|
17
|
+
/** One bounded diagnostic. Never contains preview content or filesystem paths. */
|
|
18
|
+
interface AdapterCaptureDiagnostic {
|
|
19
|
+
readonly code: AdapterCaptureDiagnosticCode;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
/** Persisted attribute name the diagnostic refers to (e.g. `inputPreview`). */
|
|
22
|
+
readonly field: string;
|
|
23
|
+
readonly capture: AdapterCaptureMode;
|
|
24
|
+
}
|
|
25
|
+
/** Optional consumer hook for adapter capture diagnostics. */
|
|
26
|
+
type AdapterDiagnosticListener = (diagnostic: AdapterCaptureDiagnostic) => void;
|
|
27
|
+
/** Bounded capture counters for adapter `getDiagnostics()` surfaces. */
|
|
28
|
+
interface AdapterCaptureDiagnostics {
|
|
29
|
+
readonly capture: AdapterCaptureMode;
|
|
30
|
+
readonly redactionProfile: RedactionProfile;
|
|
31
|
+
readonly maxPreviewChars: number;
|
|
32
|
+
readonly previewFieldsCaptured: number;
|
|
33
|
+
readonly previewFieldsUnavailable: number;
|
|
34
|
+
readonly previewFieldsTruncated: number;
|
|
35
|
+
readonly previewFieldsRedacted: number;
|
|
36
|
+
readonly lastDiagnosticCode?: AdapterCaptureDiagnosticCode;
|
|
37
|
+
readonly lastDiagnosticMessage?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Experimental capture mode for the AI SDK adapter.
|
|
42
|
+
*
|
|
43
|
+
* `metadata-only` is the default. `preview` persists bounded, redacted preview
|
|
44
|
+
* attributes through the shared adapter capture helper.
|
|
45
|
+
*
|
|
46
|
+
* @experimental This package is part of the framework adapter train.
|
|
47
|
+
*/
|
|
48
|
+
type AgentInspectAiSdkCaptureMode = "metadata-only" | "preview";
|
|
49
|
+
/**
|
|
50
|
+
* Options for the experimental AI SDK telemetry integration.
|
|
51
|
+
*
|
|
52
|
+
* @experimental Callers must keep AI SDK telemetry configured with
|
|
53
|
+
* `recordInputs: false` and `recordOutputs: false`.
|
|
54
|
+
*/
|
|
55
|
+
interface AgentInspectAiSdkOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Explicit local writer for runtime integration.
|
|
58
|
+
*/
|
|
59
|
+
writer?: TraceWriter;
|
|
60
|
+
/**
|
|
61
|
+
* Convenience local trace directory for writer-owned persistence.
|
|
62
|
+
*/
|
|
63
|
+
traceDir?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional run name used by lifecycle mapping.
|
|
66
|
+
*/
|
|
67
|
+
runName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Capture policy. Defaults to metadata-only.
|
|
70
|
+
*
|
|
71
|
+
* @experimental `preview` persists bounded, redacted prompt/message/output
|
|
72
|
+
* previews. It never persists full content.
|
|
73
|
+
*/
|
|
74
|
+
capture?: AgentInspectAiSdkCaptureMode;
|
|
75
|
+
/**
|
|
76
|
+
* Redaction profile applied to preview attributes before persistence.
|
|
77
|
+
* `share` and `strict` also cap `maxPreviewChars`.
|
|
78
|
+
*
|
|
79
|
+
* @experimental Effective only when `capture: "preview"`.
|
|
80
|
+
*/
|
|
81
|
+
redactionProfile?: RedactionProfile;
|
|
82
|
+
/**
|
|
83
|
+
* Upper bound for each serialized preview attribute. Defaults to 200.
|
|
84
|
+
*
|
|
85
|
+
* @experimental Effective only when `capture: "preview"`.
|
|
86
|
+
*/
|
|
87
|
+
maxPreviewChars?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Receives bounded capture diagnostics such as
|
|
90
|
+
* `AI_CAPTURE_FIELD_UNAVAILABLE`. Listener failures are isolated.
|
|
91
|
+
*
|
|
92
|
+
* @experimental
|
|
93
|
+
*/
|
|
94
|
+
onDiagnostic?: AdapterDiagnosticListener;
|
|
95
|
+
}
|
|
96
|
+
interface AgentInspectAiSdkDiagnostics {
|
|
97
|
+
writeFailures: number;
|
|
98
|
+
lifecycleWarnings: number;
|
|
99
|
+
flushFailures: number;
|
|
100
|
+
closeFailures: number;
|
|
101
|
+
lastError?: string;
|
|
102
|
+
lastWarning?: string;
|
|
103
|
+
/** Shared preview-capture counters (`@experimental`). */
|
|
104
|
+
capture: AdapterCaptureDiagnostics;
|
|
105
|
+
}
|
|
106
|
+
interface AgentInspectAiSdkIntegration extends TelemetryIntegration {
|
|
107
|
+
getDiagnostics(): AgentInspectAiSdkDiagnostics;
|
|
108
|
+
getWriterStats(): TraceWriterStats | undefined;
|
|
109
|
+
flush(): Promise<void>;
|
|
110
|
+
close(): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create an AgentInspect telemetry integration for the Vercel AI SDK.
|
|
114
|
+
*
|
|
115
|
+
* @experimental The adapter maps generation, LLM step, and tool lifecycle
|
|
116
|
+
* events. Capture is metadata-only by default; `capture: "preview"` adds
|
|
117
|
+
* bounded, redacted preview attributes. Keep AI SDK telemetry configured with
|
|
118
|
+
* `recordInputs: false` and `recordOutputs: false`.
|
|
119
|
+
*/
|
|
120
|
+
declare function agentInspect(options?: AgentInspectAiSdkOptions): AgentInspectAiSdkIntegration;
|
|
121
|
+
|
|
122
|
+
export { type AgentInspectAiSdkCaptureMode, type AgentInspectAiSdkDiagnostics, type AgentInspectAiSdkIntegration, type AgentInspectAiSdkOptions, agentInspect };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { TelemetryIntegration } from 'ai';
|
|
2
|
+
import { TraceWriterStats, TraceWriter } from 'agent-inspect/writers';
|
|
3
|
+
|
|
4
|
+
/** Named redaction presets for trace writing and share-safe exports (v1.3.0+). */
|
|
5
|
+
type RedactionProfile = "local" | "share" | "strict";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Capture policy shared by the official adapters.
|
|
9
|
+
*
|
|
10
|
+
* `metadata-only` is the default everywhere and never persists framework
|
|
11
|
+
* payload content. `preview` opts into bounded, redacted previews.
|
|
12
|
+
*/
|
|
13
|
+
type AdapterCaptureMode = "metadata-only" | "preview";
|
|
14
|
+
/** Stable diagnostic codes emitted by shared preview capture. */
|
|
15
|
+
declare const ADAPTER_CAPTURE_DIAGNOSTIC_CODES: readonly ["AI_CAPTURE_FIELD_UNAVAILABLE", "AI_CAPTURE_PREVIEW_TRUNCATED", "AI_CAPTURE_PREVIEW_REDACTED"];
|
|
16
|
+
type AdapterCaptureDiagnosticCode = (typeof ADAPTER_CAPTURE_DIAGNOSTIC_CODES)[number];
|
|
17
|
+
/** One bounded diagnostic. Never contains preview content or filesystem paths. */
|
|
18
|
+
interface AdapterCaptureDiagnostic {
|
|
19
|
+
readonly code: AdapterCaptureDiagnosticCode;
|
|
20
|
+
readonly message: string;
|
|
21
|
+
/** Persisted attribute name the diagnostic refers to (e.g. `inputPreview`). */
|
|
22
|
+
readonly field: string;
|
|
23
|
+
readonly capture: AdapterCaptureMode;
|
|
24
|
+
}
|
|
25
|
+
/** Optional consumer hook for adapter capture diagnostics. */
|
|
26
|
+
type AdapterDiagnosticListener = (diagnostic: AdapterCaptureDiagnostic) => void;
|
|
27
|
+
/** Bounded capture counters for adapter `getDiagnostics()` surfaces. */
|
|
28
|
+
interface AdapterCaptureDiagnostics {
|
|
29
|
+
readonly capture: AdapterCaptureMode;
|
|
30
|
+
readonly redactionProfile: RedactionProfile;
|
|
31
|
+
readonly maxPreviewChars: number;
|
|
32
|
+
readonly previewFieldsCaptured: number;
|
|
33
|
+
readonly previewFieldsUnavailable: number;
|
|
34
|
+
readonly previewFieldsTruncated: number;
|
|
35
|
+
readonly previewFieldsRedacted: number;
|
|
36
|
+
readonly lastDiagnosticCode?: AdapterCaptureDiagnosticCode;
|
|
37
|
+
readonly lastDiagnosticMessage?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Experimental capture mode for the AI SDK adapter.
|
|
42
|
+
*
|
|
43
|
+
* `metadata-only` is the default. `preview` persists bounded, redacted preview
|
|
44
|
+
* attributes through the shared adapter capture helper.
|
|
45
|
+
*
|
|
46
|
+
* @experimental This package is part of the framework adapter train.
|
|
47
|
+
*/
|
|
48
|
+
type AgentInspectAiSdkCaptureMode = "metadata-only" | "preview";
|
|
49
|
+
/**
|
|
50
|
+
* Options for the experimental AI SDK telemetry integration.
|
|
51
|
+
*
|
|
52
|
+
* @experimental Callers must keep AI SDK telemetry configured with
|
|
53
|
+
* `recordInputs: false` and `recordOutputs: false`.
|
|
54
|
+
*/
|
|
55
|
+
interface AgentInspectAiSdkOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Explicit local writer for runtime integration.
|
|
58
|
+
*/
|
|
59
|
+
writer?: TraceWriter;
|
|
60
|
+
/**
|
|
61
|
+
* Convenience local trace directory for writer-owned persistence.
|
|
62
|
+
*/
|
|
63
|
+
traceDir?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional run name used by lifecycle mapping.
|
|
66
|
+
*/
|
|
67
|
+
runName?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Capture policy. Defaults to metadata-only.
|
|
70
|
+
*
|
|
71
|
+
* @experimental `preview` persists bounded, redacted prompt/message/output
|
|
72
|
+
* previews. It never persists full content.
|
|
73
|
+
*/
|
|
74
|
+
capture?: AgentInspectAiSdkCaptureMode;
|
|
75
|
+
/**
|
|
76
|
+
* Redaction profile applied to preview attributes before persistence.
|
|
77
|
+
* `share` and `strict` also cap `maxPreviewChars`.
|
|
78
|
+
*
|
|
79
|
+
* @experimental Effective only when `capture: "preview"`.
|
|
80
|
+
*/
|
|
81
|
+
redactionProfile?: RedactionProfile;
|
|
82
|
+
/**
|
|
83
|
+
* Upper bound for each serialized preview attribute. Defaults to 200.
|
|
84
|
+
*
|
|
85
|
+
* @experimental Effective only when `capture: "preview"`.
|
|
86
|
+
*/
|
|
87
|
+
maxPreviewChars?: number;
|
|
88
|
+
/**
|
|
89
|
+
* Receives bounded capture diagnostics such as
|
|
90
|
+
* `AI_CAPTURE_FIELD_UNAVAILABLE`. Listener failures are isolated.
|
|
91
|
+
*
|
|
92
|
+
* @experimental
|
|
93
|
+
*/
|
|
94
|
+
onDiagnostic?: AdapterDiagnosticListener;
|
|
95
|
+
}
|
|
96
|
+
interface AgentInspectAiSdkDiagnostics {
|
|
97
|
+
writeFailures: number;
|
|
98
|
+
lifecycleWarnings: number;
|
|
99
|
+
flushFailures: number;
|
|
100
|
+
closeFailures: number;
|
|
101
|
+
lastError?: string;
|
|
102
|
+
lastWarning?: string;
|
|
103
|
+
/** Shared preview-capture counters (`@experimental`). */
|
|
104
|
+
capture: AdapterCaptureDiagnostics;
|
|
105
|
+
}
|
|
106
|
+
interface AgentInspectAiSdkIntegration extends TelemetryIntegration {
|
|
107
|
+
getDiagnostics(): AgentInspectAiSdkDiagnostics;
|
|
108
|
+
getWriterStats(): TraceWriterStats | undefined;
|
|
109
|
+
flush(): Promise<void>;
|
|
110
|
+
close(): Promise<void>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Create an AgentInspect telemetry integration for the Vercel AI SDK.
|
|
114
|
+
*
|
|
115
|
+
* @experimental The adapter maps generation, LLM step, and tool lifecycle
|
|
116
|
+
* events. Capture is metadata-only by default; `capture: "preview"` adds
|
|
117
|
+
* bounded, redacted preview attributes. Keep AI SDK telemetry configured with
|
|
118
|
+
* `recordInputs: false` and `recordOutputs: false`.
|
|
119
|
+
*/
|
|
120
|
+
declare function agentInspect(options?: AgentInspectAiSdkOptions): AgentInspectAiSdkIntegration;
|
|
121
|
+
|
|
122
|
+
export { type AgentInspectAiSdkCaptureMode, type AgentInspectAiSdkDiagnostics, type AgentInspectAiSdkIntegration, type AgentInspectAiSdkOptions, agentInspect };
|