@cognipeer/agent-sdk 0.9.2 → 0.9.4
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/README.md +2 -0
- package/dist/index.cjs +90 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -3
- package/dist/index.d.ts +64 -3
- package/dist/index.mjs +90 -58
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -622,6 +622,11 @@ type TracingConfig = {
|
|
|
622
622
|
* when the same agent implementation runs under several logical names.
|
|
623
623
|
*/
|
|
624
624
|
agentName?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Arbitrary key-value tags forwarded to every tracing payload for downstream
|
|
627
|
+
* attribution/reporting; not interpreted by the SDK itself.
|
|
628
|
+
*/
|
|
629
|
+
metadata?: Record<string, string>;
|
|
625
630
|
};
|
|
626
631
|
type SmartAgentTracingConfig = TracingConfig;
|
|
627
632
|
type AgentOptions = {
|
|
@@ -1217,7 +1222,35 @@ type TraceToolDefinitionsSection = {
|
|
|
1217
1222
|
/** Set when the tool list itself was truncated to fit the size budget. */
|
|
1218
1223
|
truncated?: boolean;
|
|
1219
1224
|
};
|
|
1220
|
-
|
|
1225
|
+
/**
|
|
1226
|
+
* The structured-output contract bound to one model call — the other half of
|
|
1227
|
+
* the request that decides the SHAPE of the answer (the tool menu being the
|
|
1228
|
+
* first half). Without it a trace cannot distinguish "the model chose to write
|
|
1229
|
+
* prose" from "nothing ever asked it for JSON", and any replay of the call
|
|
1230
|
+
* (evaluation, prompt optimization) silently runs under a looser contract than
|
|
1231
|
+
* production did.
|
|
1232
|
+
*
|
|
1233
|
+
* Rides on the `ai_call` event, never per session: a run can enforce a schema
|
|
1234
|
+
* on its final turn only, and each call records the contract it actually sent.
|
|
1235
|
+
*/
|
|
1236
|
+
type TraceResponseFormatSection = {
|
|
1237
|
+
id?: string;
|
|
1238
|
+
kind: "response_format";
|
|
1239
|
+
label: string;
|
|
1240
|
+
/** `json_schema` | `json_object` | `text` — the wire `response_format.type`. */
|
|
1241
|
+
type: string;
|
|
1242
|
+
/** Which strategy produced it: native `response_format` or the `response` tool. */
|
|
1243
|
+
strategy?: "native" | "tool_based";
|
|
1244
|
+
/** `json_schema.name` when the provider takes a named schema. */
|
|
1245
|
+
schemaName?: string;
|
|
1246
|
+
/** `json_schema.strict` — whether the provider enforces the schema. */
|
|
1247
|
+
strict?: boolean;
|
|
1248
|
+
/** The JSON Schema as sent. Dropped (with `truncated`) when over budget. */
|
|
1249
|
+
schema?: Record<string, any>;
|
|
1250
|
+
/** Set when `schema` was dropped to fit the section size budget. */
|
|
1251
|
+
truncated?: boolean;
|
|
1252
|
+
};
|
|
1253
|
+
type TraceDataSection = TraceMessageSection | TraceToolCallSection | TraceToolResultSection | TraceToolResponseSection | TraceSummarySection | TraceMetadataSection | TraceToolDefinitionsSection | TraceResponseFormatSection;
|
|
1221
1254
|
type TraceEventRecord = {
|
|
1222
1255
|
sessionId: string;
|
|
1223
1256
|
id: string;
|
|
@@ -1240,6 +1273,21 @@ type TraceEventRecord = {
|
|
|
1240
1273
|
outputTokens?: number;
|
|
1241
1274
|
totalTokens?: number;
|
|
1242
1275
|
cachedInputTokens?: number;
|
|
1276
|
+
/**
|
|
1277
|
+
* Reasoning tokens billed inside `outputTokens` (a SUBSET of it, matching
|
|
1278
|
+
* OpenAI's `completion_tokens_details.reasoning_tokens`). Recorded because
|
|
1279
|
+
* on a reasoning model they are routinely most of the output bill while
|
|
1280
|
+
* being invisible in the response text — a spend investigation that only
|
|
1281
|
+
* sees `outputTokens` cannot explain where the money went.
|
|
1282
|
+
*/
|
|
1283
|
+
reasoningTokens?: number;
|
|
1284
|
+
/**
|
|
1285
|
+
* Why the model stopped: `stop` | `tool_calls` | `length` | `content_filter`
|
|
1286
|
+
* | `error`. `length` is the single most common explanation for a truncated
|
|
1287
|
+
* or unparseable structured response, and without it that failure is
|
|
1288
|
+
* indistinguishable from a model that simply answered badly.
|
|
1289
|
+
*/
|
|
1290
|
+
finishReason?: string;
|
|
1243
1291
|
requestBytes?: number;
|
|
1244
1292
|
responseBytes?: number;
|
|
1245
1293
|
model?: string;
|
|
@@ -1307,6 +1355,8 @@ type TraceSessionFile = {
|
|
|
1307
1355
|
model?: string;
|
|
1308
1356
|
provider?: string;
|
|
1309
1357
|
};
|
|
1358
|
+
/** Arbitrary key-value tags from `TracingConfig.metadata`, forwarded as-is for downstream attribution/reporting. */
|
|
1359
|
+
metadata?: Record<string, string>;
|
|
1310
1360
|
config: TraceSessionConfigSnapshot;
|
|
1311
1361
|
summary: TraceSessionSummary;
|
|
1312
1362
|
events: TraceEventRecord[];
|
|
@@ -1355,6 +1405,8 @@ type TraceSessionRuntime = {
|
|
|
1355
1405
|
};
|
|
1356
1406
|
/** Caller-supplied agent name override (from TracingConfig.agentName). */
|
|
1357
1407
|
configAgentName?: string;
|
|
1408
|
+
/** Caller-supplied attribution tags (from TracingConfig.metadata). */
|
|
1409
|
+
configMetadata?: Record<string, string>;
|
|
1358
1410
|
resolvedConfig: ResolvedTraceConfig;
|
|
1359
1411
|
events: TraceEventRecord[];
|
|
1360
1412
|
summary: TraceSessionSummary;
|
|
@@ -2672,7 +2724,6 @@ declare class NativeJsonSchemaStrategy implements StructuredOutputStrategy {
|
|
|
2672
2724
|
readonly kind: "native";
|
|
2673
2725
|
private resolveJsonPointer;
|
|
2674
2726
|
private unwrapRootObjectSchema;
|
|
2675
|
-
private normalizeOpenAIStrictSchema;
|
|
2676
2727
|
/**
|
|
2677
2728
|
* Convert a Zod schema to the JSON Schema object used in response_format.
|
|
2678
2729
|
*/
|
|
@@ -2947,6 +2998,16 @@ declare function buildToolDefinitionsSection(toolDefinitions: Array<{
|
|
|
2947
2998
|
description?: string;
|
|
2948
2999
|
parameters?: Record<string, any>;
|
|
2949
3000
|
}>): TraceToolDefinitionsSection | undefined;
|
|
3001
|
+
/**
|
|
3002
|
+
* Build the `response_format` section for one model call, or undefined when
|
|
3003
|
+
* nothing usable was supplied.
|
|
3004
|
+
*
|
|
3005
|
+
* Accepts either the invoke-options wrapper produced by
|
|
3006
|
+
* `NativeJsonSchemaStrategy.buildResponseFormat()` (`{ response_format: {…} }`)
|
|
3007
|
+
* or a bare `response_format` object, so callers can pass whatever they hold.
|
|
3008
|
+
* Exported for provider/node code that assembles sections itself.
|
|
3009
|
+
*/
|
|
3010
|
+
declare function buildResponseFormatSection(responseFormat: Record<string, any> | undefined, strategy?: "native" | "tool_based"): TraceResponseFormatSection | undefined;
|
|
2950
3011
|
/**
|
|
2951
3012
|
* Start a streaming trace session. Should be called before recording events in streaming mode.
|
|
2952
3013
|
* This sends the session start to the remote endpoint immediately.
|
|
@@ -3462,4 +3523,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3462
3523
|
*/
|
|
3463
3524
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3464
3525
|
|
|
3465
|
-
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, type VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3526
|
+
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, type VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, agentVerdictRule, appendBoundTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -622,6 +622,11 @@ type TracingConfig = {
|
|
|
622
622
|
* when the same agent implementation runs under several logical names.
|
|
623
623
|
*/
|
|
624
624
|
agentName?: string;
|
|
625
|
+
/**
|
|
626
|
+
* Arbitrary key-value tags forwarded to every tracing payload for downstream
|
|
627
|
+
* attribution/reporting; not interpreted by the SDK itself.
|
|
628
|
+
*/
|
|
629
|
+
metadata?: Record<string, string>;
|
|
625
630
|
};
|
|
626
631
|
type SmartAgentTracingConfig = TracingConfig;
|
|
627
632
|
type AgentOptions = {
|
|
@@ -1217,7 +1222,35 @@ type TraceToolDefinitionsSection = {
|
|
|
1217
1222
|
/** Set when the tool list itself was truncated to fit the size budget. */
|
|
1218
1223
|
truncated?: boolean;
|
|
1219
1224
|
};
|
|
1220
|
-
|
|
1225
|
+
/**
|
|
1226
|
+
* The structured-output contract bound to one model call — the other half of
|
|
1227
|
+
* the request that decides the SHAPE of the answer (the tool menu being the
|
|
1228
|
+
* first half). Without it a trace cannot distinguish "the model chose to write
|
|
1229
|
+
* prose" from "nothing ever asked it for JSON", and any replay of the call
|
|
1230
|
+
* (evaluation, prompt optimization) silently runs under a looser contract than
|
|
1231
|
+
* production did.
|
|
1232
|
+
*
|
|
1233
|
+
* Rides on the `ai_call` event, never per session: a run can enforce a schema
|
|
1234
|
+
* on its final turn only, and each call records the contract it actually sent.
|
|
1235
|
+
*/
|
|
1236
|
+
type TraceResponseFormatSection = {
|
|
1237
|
+
id?: string;
|
|
1238
|
+
kind: "response_format";
|
|
1239
|
+
label: string;
|
|
1240
|
+
/** `json_schema` | `json_object` | `text` — the wire `response_format.type`. */
|
|
1241
|
+
type: string;
|
|
1242
|
+
/** Which strategy produced it: native `response_format` or the `response` tool. */
|
|
1243
|
+
strategy?: "native" | "tool_based";
|
|
1244
|
+
/** `json_schema.name` when the provider takes a named schema. */
|
|
1245
|
+
schemaName?: string;
|
|
1246
|
+
/** `json_schema.strict` — whether the provider enforces the schema. */
|
|
1247
|
+
strict?: boolean;
|
|
1248
|
+
/** The JSON Schema as sent. Dropped (with `truncated`) when over budget. */
|
|
1249
|
+
schema?: Record<string, any>;
|
|
1250
|
+
/** Set when `schema` was dropped to fit the section size budget. */
|
|
1251
|
+
truncated?: boolean;
|
|
1252
|
+
};
|
|
1253
|
+
type TraceDataSection = TraceMessageSection | TraceToolCallSection | TraceToolResultSection | TraceToolResponseSection | TraceSummarySection | TraceMetadataSection | TraceToolDefinitionsSection | TraceResponseFormatSection;
|
|
1221
1254
|
type TraceEventRecord = {
|
|
1222
1255
|
sessionId: string;
|
|
1223
1256
|
id: string;
|
|
@@ -1240,6 +1273,21 @@ type TraceEventRecord = {
|
|
|
1240
1273
|
outputTokens?: number;
|
|
1241
1274
|
totalTokens?: number;
|
|
1242
1275
|
cachedInputTokens?: number;
|
|
1276
|
+
/**
|
|
1277
|
+
* Reasoning tokens billed inside `outputTokens` (a SUBSET of it, matching
|
|
1278
|
+
* OpenAI's `completion_tokens_details.reasoning_tokens`). Recorded because
|
|
1279
|
+
* on a reasoning model they are routinely most of the output bill while
|
|
1280
|
+
* being invisible in the response text — a spend investigation that only
|
|
1281
|
+
* sees `outputTokens` cannot explain where the money went.
|
|
1282
|
+
*/
|
|
1283
|
+
reasoningTokens?: number;
|
|
1284
|
+
/**
|
|
1285
|
+
* Why the model stopped: `stop` | `tool_calls` | `length` | `content_filter`
|
|
1286
|
+
* | `error`. `length` is the single most common explanation for a truncated
|
|
1287
|
+
* or unparseable structured response, and without it that failure is
|
|
1288
|
+
* indistinguishable from a model that simply answered badly.
|
|
1289
|
+
*/
|
|
1290
|
+
finishReason?: string;
|
|
1243
1291
|
requestBytes?: number;
|
|
1244
1292
|
responseBytes?: number;
|
|
1245
1293
|
model?: string;
|
|
@@ -1307,6 +1355,8 @@ type TraceSessionFile = {
|
|
|
1307
1355
|
model?: string;
|
|
1308
1356
|
provider?: string;
|
|
1309
1357
|
};
|
|
1358
|
+
/** Arbitrary key-value tags from `TracingConfig.metadata`, forwarded as-is for downstream attribution/reporting. */
|
|
1359
|
+
metadata?: Record<string, string>;
|
|
1310
1360
|
config: TraceSessionConfigSnapshot;
|
|
1311
1361
|
summary: TraceSessionSummary;
|
|
1312
1362
|
events: TraceEventRecord[];
|
|
@@ -1355,6 +1405,8 @@ type TraceSessionRuntime = {
|
|
|
1355
1405
|
};
|
|
1356
1406
|
/** Caller-supplied agent name override (from TracingConfig.agentName). */
|
|
1357
1407
|
configAgentName?: string;
|
|
1408
|
+
/** Caller-supplied attribution tags (from TracingConfig.metadata). */
|
|
1409
|
+
configMetadata?: Record<string, string>;
|
|
1358
1410
|
resolvedConfig: ResolvedTraceConfig;
|
|
1359
1411
|
events: TraceEventRecord[];
|
|
1360
1412
|
summary: TraceSessionSummary;
|
|
@@ -2672,7 +2724,6 @@ declare class NativeJsonSchemaStrategy implements StructuredOutputStrategy {
|
|
|
2672
2724
|
readonly kind: "native";
|
|
2673
2725
|
private resolveJsonPointer;
|
|
2674
2726
|
private unwrapRootObjectSchema;
|
|
2675
|
-
private normalizeOpenAIStrictSchema;
|
|
2676
2727
|
/**
|
|
2677
2728
|
* Convert a Zod schema to the JSON Schema object used in response_format.
|
|
2678
2729
|
*/
|
|
@@ -2947,6 +2998,16 @@ declare function buildToolDefinitionsSection(toolDefinitions: Array<{
|
|
|
2947
2998
|
description?: string;
|
|
2948
2999
|
parameters?: Record<string, any>;
|
|
2949
3000
|
}>): TraceToolDefinitionsSection | undefined;
|
|
3001
|
+
/**
|
|
3002
|
+
* Build the `response_format` section for one model call, or undefined when
|
|
3003
|
+
* nothing usable was supplied.
|
|
3004
|
+
*
|
|
3005
|
+
* Accepts either the invoke-options wrapper produced by
|
|
3006
|
+
* `NativeJsonSchemaStrategy.buildResponseFormat()` (`{ response_format: {…} }`)
|
|
3007
|
+
* or a bare `response_format` object, so callers can pass whatever they hold.
|
|
3008
|
+
* Exported for provider/node code that assembles sections itself.
|
|
3009
|
+
*/
|
|
3010
|
+
declare function buildResponseFormatSection(responseFormat: Record<string, any> | undefined, strategy?: "native" | "tool_based"): TraceResponseFormatSection | undefined;
|
|
2950
3011
|
/**
|
|
2951
3012
|
* Start a streaming trace session. Should be called before recording events in streaming mode.
|
|
2952
3013
|
* This sends the session start to the remote endpoint immediately.
|
|
@@ -3462,4 +3523,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3462
3523
|
*/
|
|
3463
3524
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3464
3525
|
|
|
3465
|
-
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, type VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3526
|
+
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type TraceToolDefinition, type TraceToolDefinitionsSection, type TraceToolDetails, type TraceToolResponseSection, type TraceToolResultSection, type TracingConfig, type TracingMode, type UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, type VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, agentVerdictRule, appendBoundTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
package/dist/index.mjs
CHANGED
|
@@ -284,63 +284,16 @@ var NativeJsonSchemaStrategy = class {
|
|
|
284
284
|
}
|
|
285
285
|
return resolvedSchema;
|
|
286
286
|
}
|
|
287
|
-
normalizeOpenAIStrictSchema(schema) {
|
|
288
|
-
const visit = (node) => {
|
|
289
|
-
if (!node || typeof node !== "object") return node;
|
|
290
|
-
if (Array.isArray(node)) {
|
|
291
|
-
return node.map(visit);
|
|
292
|
-
}
|
|
293
|
-
const clone2 = { ...node };
|
|
294
|
-
if (clone2.properties && typeof clone2.properties === "object") {
|
|
295
|
-
const normalizedProperties = {};
|
|
296
|
-
for (const [key, value] of Object.entries(clone2.properties)) {
|
|
297
|
-
normalizedProperties[key] = visit(value);
|
|
298
|
-
}
|
|
299
|
-
clone2.properties = normalizedProperties;
|
|
300
|
-
clone2.required = Object.keys(normalizedProperties);
|
|
301
|
-
if (clone2.additionalProperties === void 0) {
|
|
302
|
-
clone2.additionalProperties = false;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
if (clone2.items) {
|
|
306
|
-
clone2.items = visit(clone2.items);
|
|
307
|
-
}
|
|
308
|
-
if (clone2.definitions && typeof clone2.definitions === "object") {
|
|
309
|
-
const normalizedDefinitions = {};
|
|
310
|
-
for (const [key, value] of Object.entries(clone2.definitions)) {
|
|
311
|
-
normalizedDefinitions[key] = visit(value);
|
|
312
|
-
}
|
|
313
|
-
clone2.definitions = normalizedDefinitions;
|
|
314
|
-
}
|
|
315
|
-
if (clone2.$defs && typeof clone2.$defs === "object") {
|
|
316
|
-
const normalizedDefs = {};
|
|
317
|
-
for (const [key, value] of Object.entries(clone2.$defs)) {
|
|
318
|
-
normalizedDefs[key] = visit(value);
|
|
319
|
-
}
|
|
320
|
-
clone2.$defs = normalizedDefs;
|
|
321
|
-
}
|
|
322
|
-
for (const compositeKey of ["anyOf", "oneOf", "allOf"]) {
|
|
323
|
-
if (Array.isArray(clone2[compositeKey])) {
|
|
324
|
-
clone2[compositeKey] = clone2[compositeKey].map(visit);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return clone2;
|
|
328
|
-
};
|
|
329
|
-
return visit(schema);
|
|
330
|
-
}
|
|
331
287
|
/**
|
|
332
288
|
* Convert a Zod schema to the JSON Schema object used in response_format.
|
|
333
289
|
*/
|
|
334
290
|
toJsonSchema(schema, name = "structured_response") {
|
|
335
291
|
const result = zodToJsonSchema(schema, {
|
|
336
292
|
name,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
$refStrategy: "extract-to-root",
|
|
340
|
-
nullableStrategy: "property"
|
|
293
|
+
target: "openAi",
|
|
294
|
+
$refStrategy: "root"
|
|
341
295
|
});
|
|
342
|
-
|
|
343
|
-
return this.unwrapRootObjectSchema(normalized);
|
|
296
|
+
return this.unwrapRootObjectSchema(result);
|
|
344
297
|
}
|
|
345
298
|
/**
|
|
346
299
|
* Build response_format configuration for the model call.
|
|
@@ -1199,9 +1152,9 @@ async function postStreamingSessionStart(baseUrl, headers, payload) {
|
|
|
1199
1152
|
const url = `${baseUrl.replace(/\/$/, "")}/stream/${payload.sessionId}/start`;
|
|
1200
1153
|
await postJsonReliable(url, headers, payload, { retry: true });
|
|
1201
1154
|
}
|
|
1202
|
-
async function postStreamingEvent(baseUrl, headers, sessionId, event) {
|
|
1155
|
+
async function postStreamingEvent(baseUrl, headers, sessionId, event, metadata) {
|
|
1203
1156
|
const url = `${baseUrl.replace(/\/$/, "")}/stream/${sessionId}/events`;
|
|
1204
|
-
await postJsonReliable(url, headers, { event }, { retry: false });
|
|
1157
|
+
await postJsonReliable(url, headers, { event, metadata }, { retry: false });
|
|
1205
1158
|
}
|
|
1206
1159
|
async function postStreamingSessionEnd(baseUrl, headers, payload) {
|
|
1207
1160
|
const url = `${baseUrl.replace(/\/$/, "")}/stream/${payload.sessionId}/end`;
|
|
@@ -1251,6 +1204,8 @@ function eventToOtlpSpan(event) {
|
|
|
1251
1204
|
stringAttr("cognipeer.actor.name", event.actor?.name),
|
|
1252
1205
|
stringAttr("cognipeer.actor.role", event.actor?.role),
|
|
1253
1206
|
stringAttr("cognipeer.model", event.model),
|
|
1207
|
+
intAttr("cognipeer.tokens.reasoning", event.reasoningTokens),
|
|
1208
|
+
stringAttr("cognipeer.finish_reason", event.finishReason),
|
|
1254
1209
|
stringAttr("cognipeer.provider", event.provider),
|
|
1255
1210
|
stringAttr("cognipeer.tool.details", event.toolDetails ? JSON.stringify(event.toolDetails) : void 0),
|
|
1256
1211
|
intAttr("cognipeer.tokens.input", event.inputTokens),
|
|
@@ -1306,7 +1261,8 @@ function traceSessionToOtlp(session) {
|
|
|
1306
1261
|
stringAttr("cognipeer.session.id", session.sessionId),
|
|
1307
1262
|
stringAttr("cognipeer.thread.id", session.threadId),
|
|
1308
1263
|
stringAttr("cognipeer.agent.model", session.agent?.model),
|
|
1309
|
-
stringAttr("cognipeer.agent.provider", session.agent?.provider)
|
|
1264
|
+
stringAttr("cognipeer.agent.provider", session.agent?.provider),
|
|
1265
|
+
...Object.entries(session.metadata || {}).map(([key, value]) => stringAttr(`cognipeer.metadata.${key}`, value))
|
|
1310
1266
|
].filter(Boolean);
|
|
1311
1267
|
const rootAttrs = [
|
|
1312
1268
|
stringAttr("cognipeer.session.status", session.status),
|
|
@@ -1478,6 +1434,8 @@ function defaultSectionLabel(kind) {
|
|
|
1478
1434
|
return "Details";
|
|
1479
1435
|
case "tool_definitions":
|
|
1480
1436
|
return "Tool Definitions";
|
|
1437
|
+
case "response_format":
|
|
1438
|
+
return "Response Format";
|
|
1481
1439
|
default:
|
|
1482
1440
|
return "Section";
|
|
1483
1441
|
}
|
|
@@ -1535,6 +1493,42 @@ function buildToolDefinitionsSection(toolDefinitions) {
|
|
|
1535
1493
|
}
|
|
1536
1494
|
return section;
|
|
1537
1495
|
}
|
|
1496
|
+
var RESPONSE_FORMAT_MAX_SECTION_BYTES = 64 * 1024;
|
|
1497
|
+
var RESPONSE_FORMAT_MAX_NAME_CHARS = 200;
|
|
1498
|
+
function buildResponseFormatSection(responseFormat, strategy) {
|
|
1499
|
+
if (!responseFormat || typeof responseFormat !== "object" || Array.isArray(responseFormat)) return void 0;
|
|
1500
|
+
const raw = responseFormat.response_format ?? responseFormat.responseFormat ?? responseFormat;
|
|
1501
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) return void 0;
|
|
1502
|
+
const type = typeof raw.type === "string" && raw.type.trim().length > 0 ? raw.type.trim() : void 0;
|
|
1503
|
+
const jsonSchema = raw.json_schema ?? raw.jsonSchema;
|
|
1504
|
+
const schemaSource = jsonSchema && typeof jsonSchema === "object" ? jsonSchema : raw;
|
|
1505
|
+
const schema = schemaSource.schema && typeof schemaSource.schema === "object" && !Array.isArray(schemaSource.schema) ? schemaSource.schema : void 0;
|
|
1506
|
+
if (!type && !schema) return void 0;
|
|
1507
|
+
const section = {
|
|
1508
|
+
kind: "response_format",
|
|
1509
|
+
label: "Response Format",
|
|
1510
|
+
type: type ?? (schema ? "json_schema" : "unknown"),
|
|
1511
|
+
...strategy ? { strategy } : {},
|
|
1512
|
+
...typeof schemaSource.name === "string" && schemaSource.name.length > 0 ? { schemaName: schemaSource.name.slice(0, RESPONSE_FORMAT_MAX_NAME_CHARS) } : {},
|
|
1513
|
+
...typeof schemaSource.strict === "boolean" ? { strict: schemaSource.strict } : {}
|
|
1514
|
+
};
|
|
1515
|
+
if (schema) {
|
|
1516
|
+
try {
|
|
1517
|
+
section.schema = JSON.parse(JSON.stringify(schema));
|
|
1518
|
+
} catch {
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
try {
|
|
1522
|
+
if (section.schema && Buffer$1.byteLength(JSON.stringify(section), "utf8") > RESPONSE_FORMAT_MAX_SECTION_BYTES) {
|
|
1523
|
+
delete section.schema;
|
|
1524
|
+
section.truncated = true;
|
|
1525
|
+
}
|
|
1526
|
+
} catch {
|
|
1527
|
+
delete section.schema;
|
|
1528
|
+
section.truncated = true;
|
|
1529
|
+
}
|
|
1530
|
+
return section;
|
|
1531
|
+
}
|
|
1538
1532
|
function buildMessageLabel(role, index) {
|
|
1539
1533
|
const normalized = role?.trim().length ? role.trim() : "message";
|
|
1540
1534
|
const base = `${normalized.charAt(0).toUpperCase()}${normalized.slice(1)} Message`;
|
|
@@ -1643,6 +1637,7 @@ function createTraceSession(opts) {
|
|
|
1643
1637
|
rootSpanId,
|
|
1644
1638
|
threadId: opts.tracing?.threadId,
|
|
1645
1639
|
configAgentName: opts.tracing?.agentName?.trim() || void 0,
|
|
1640
|
+
configMetadata: opts.tracing?.metadata && Object.keys(opts.tracing.metadata).length > 0 ? opts.tracing.metadata : void 0,
|
|
1646
1641
|
startedAt: Date.now(),
|
|
1647
1642
|
resolvedConfig: cfg,
|
|
1648
1643
|
events: [],
|
|
@@ -1681,6 +1676,7 @@ async function startStreamingSession(session, agentRuntime) {
|
|
|
1681
1676
|
threadId: session.threadId,
|
|
1682
1677
|
startedAt: startedAtIso,
|
|
1683
1678
|
agent: agentInfo,
|
|
1679
|
+
metadata: session.configMetadata,
|
|
1684
1680
|
config: configSnapshot
|
|
1685
1681
|
};
|
|
1686
1682
|
if (sink.type === "cognipeer" || sink.type === "http") {
|
|
@@ -1730,6 +1726,7 @@ function recordTraceEvent(session, event) {
|
|
|
1730
1726
|
if (!Number.isNaN(cachedInputTokens ?? NaN) && cachedInputTokens !== void 0) {
|
|
1731
1727
|
session.summary.totalCachedInputTokens += cachedInputTokens;
|
|
1732
1728
|
}
|
|
1729
|
+
const reasoningTokens = event.reasoningTokens !== void 0 ? Number(event.reasoningTokens) : void 0;
|
|
1733
1730
|
const totalTokens = event.totalTokens !== void 0 ? Number(event.totalTokens) : void 0;
|
|
1734
1731
|
const requestBytes = event.requestBytes !== void 0 ? Number(event.requestBytes) : void 0;
|
|
1735
1732
|
if (!Number.isNaN(requestBytes ?? NaN) && requestBytes !== void 0) {
|
|
@@ -1755,6 +1752,13 @@ function recordTraceEvent(session, event) {
|
|
|
1755
1752
|
if (menuSection) sections = ensureUniqueSections(id, [...sections ?? [], menuSection]);
|
|
1756
1753
|
}
|
|
1757
1754
|
}
|
|
1755
|
+
if (event.responseFormat) {
|
|
1756
|
+
const existing = (sections ?? []).some((section) => section.kind === "response_format");
|
|
1757
|
+
if (!existing) {
|
|
1758
|
+
const formatSection = buildResponseFormatSection(event.responseFormat, event.responseFormatStrategy);
|
|
1759
|
+
if (formatSection) sections = ensureUniqueSections(id, [...sections ?? [], formatSection]);
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1758
1762
|
}
|
|
1759
1763
|
const resolvedModel = event.model ?? inferModelFromMessages(event.messageList);
|
|
1760
1764
|
const resolvedProvider = event.provider ?? inferProviderFromMessages(event.messageList);
|
|
@@ -1785,6 +1789,11 @@ function recordTraceEvent(session, event) {
|
|
|
1785
1789
|
...totalTokens !== void 0 && { totalTokens },
|
|
1786
1790
|
...cachedInputTokens !== void 0 && { cachedInputTokens }
|
|
1787
1791
|
},
|
|
1792
|
+
// Absent, never zeroed for ai_call the way the four above are: a model
|
|
1793
|
+
// that does no reasoning and one whose provider reports nothing are
|
|
1794
|
+
// different facts, and a zero would erase the difference.
|
|
1795
|
+
...reasoningTokens !== void 0 && !Number.isNaN(reasoningTokens) ? { reasoningTokens } : {},
|
|
1796
|
+
...event.finishReason ? { finishReason: event.finishReason } : {},
|
|
1788
1797
|
requestBytes,
|
|
1789
1798
|
responseBytes,
|
|
1790
1799
|
model: resolvedModel,
|
|
@@ -1828,7 +1837,7 @@ function recordTraceEvent(session, event) {
|
|
|
1828
1837
|
if (session.resolvedConfig.mode === "streaming" && session.sessionStarted) {
|
|
1829
1838
|
if (sink.type === "cognipeer" || sink.type === "http") {
|
|
1830
1839
|
const headers = sink.type === "cognipeer" ? { Authorization: `Bearer ${sink.apiKey}` } : sink.headers;
|
|
1831
|
-
postStreamingEvent(sink.url, headers, session.sessionId, record).catch((err) => {
|
|
1840
|
+
postStreamingEvent(sink.url, headers, session.sessionId, record, session.configMetadata).catch((err) => {
|
|
1832
1841
|
const errMsg = err instanceof Error ? err.message : String(err);
|
|
1833
1842
|
if (typeof console !== "undefined" && typeof console.warn === "function") {
|
|
1834
1843
|
console.warn("[Tracing] Failed to send streaming event:", errMsg);
|
|
@@ -1880,6 +1889,7 @@ async function finalizeTraceSession(session, params = {}) {
|
|
|
1880
1889
|
endedAt: endedAtIso,
|
|
1881
1890
|
durationMs,
|
|
1882
1891
|
agent: agentInfo || session.agentInfo,
|
|
1892
|
+
metadata: session.configMetadata,
|
|
1883
1893
|
config: configSnapshot,
|
|
1884
1894
|
summary: session.summary,
|
|
1885
1895
|
events: session.events,
|
|
@@ -1914,7 +1924,8 @@ async function finalizeTraceSession(session, params = {}) {
|
|
|
1914
1924
|
durationMs,
|
|
1915
1925
|
status: initialStatus,
|
|
1916
1926
|
summary: session.summary,
|
|
1917
|
-
errors: session.errors
|
|
1927
|
+
errors: session.errors,
|
|
1928
|
+
metadata: session.configMetadata
|
|
1918
1929
|
});
|
|
1919
1930
|
} else {
|
|
1920
1931
|
await postTraceSession(sink.url, headers, payloadForSink);
|
|
@@ -3882,6 +3893,18 @@ function createAgentCoreNode(opts) {
|
|
|
3882
3893
|
}
|
|
3883
3894
|
}
|
|
3884
3895
|
const responseFormat = runtime.responseFormat;
|
|
3896
|
+
let traceResponseFormat = responseFormat;
|
|
3897
|
+
let traceResponseFormatStrategy = responseFormat ? "native" : void 0;
|
|
3898
|
+
if (!traceResponseFormat && runtime.outputSchema) {
|
|
3899
|
+
const responseTool = traceToolDefinitions?.find((tool) => tool.name === "response");
|
|
3900
|
+
if (responseTool?.parameters) {
|
|
3901
|
+
traceResponseFormat = {
|
|
3902
|
+
type: "json_schema",
|
|
3903
|
+
json_schema: { name: "response", strict: false, schema: responseTool.parameters }
|
|
3904
|
+
};
|
|
3905
|
+
traceResponseFormatStrategy = "tool_based";
|
|
3906
|
+
}
|
|
3907
|
+
}
|
|
3885
3908
|
const reasoningForCall = state.ctx?.__reasoning;
|
|
3886
3909
|
const reasoningInvokeOpts = reasoningForCall ? { reasoning: reasoningForCall } : void 0;
|
|
3887
3910
|
const extractText2 = (chunk) => {
|
|
@@ -3941,7 +3964,9 @@ function createAgentCoreNode(opts) {
|
|
|
3941
3964
|
provider: getProviderName(runtime.model || opts.model),
|
|
3942
3965
|
error: { message: err?.message || String(err), stack: err?.stack },
|
|
3943
3966
|
messageList: state.messages,
|
|
3944
|
-
toolDefinitions: traceToolDefinitions
|
|
3967
|
+
toolDefinitions: traceToolDefinitions,
|
|
3968
|
+
responseFormat: traceResponseFormat,
|
|
3969
|
+
responseFormatStrategy: traceResponseFormatStrategy
|
|
3945
3970
|
});
|
|
3946
3971
|
throw err;
|
|
3947
3972
|
}
|
|
@@ -3956,6 +3981,7 @@ function createAgentCoreNode(opts) {
|
|
|
3956
3981
|
const shouldLogResponse = !!traceSession && traceSession.resolvedConfig.logData;
|
|
3957
3982
|
const responsePayload = shouldLogResponse ? sanitizeTracePayload(response) : void 0;
|
|
3958
3983
|
const responseBytes = responsePayload !== void 0 ? estimatePayloadBytes(responsePayload) : void 0;
|
|
3984
|
+
const finishReason = response?.response_metadata?.finish_reason ?? response?.response_metadata?.finishReason ?? response?.finishReason;
|
|
3959
3985
|
recordTraceEvent(traceSession, {
|
|
3960
3986
|
type: "ai_call",
|
|
3961
3987
|
label: "Assistant Response",
|
|
@@ -3965,12 +3991,18 @@ function createAgentCoreNode(opts) {
|
|
|
3965
3991
|
outputTokens: normalized?.completion_tokens,
|
|
3966
3992
|
totalTokens: normalized?.total_tokens,
|
|
3967
3993
|
cachedInputTokens: normalized?.prompt_tokens_details?.cached_tokens,
|
|
3994
|
+
// A subset of completion_tokens, and on a reasoning model routinely most
|
|
3995
|
+
// of the output bill while being invisible in the response text.
|
|
3996
|
+
reasoningTokens: normalized?.completion_tokens_details?.reasoning_tokens,
|
|
3997
|
+
finishReason: typeof finishReason === "string" ? finishReason : void 0,
|
|
3968
3998
|
requestBytes: promptBytes,
|
|
3969
3999
|
responseBytes,
|
|
3970
4000
|
model: modelName,
|
|
3971
4001
|
provider: getProviderName(runtime.model || opts.model),
|
|
3972
4002
|
messageList: messagesWithResponse,
|
|
3973
|
-
toolDefinitions: traceToolDefinitions
|
|
4003
|
+
toolDefinitions: traceToolDefinitions,
|
|
4004
|
+
responseFormat: traceResponseFormat,
|
|
4005
|
+
responseFormatStrategy: traceResponseFormatStrategy
|
|
3974
4006
|
});
|
|
3975
4007
|
if (normalized) {
|
|
3976
4008
|
recordUsage(state, modelName, normalized);
|
|
@@ -11753,6 +11785,6 @@ function createProvider(config) {
|
|
|
11753
11785
|
}
|
|
11754
11786
|
}
|
|
11755
11787
|
|
|
11756
|
-
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, PREOPEN_TOOL_CALL_PREFIX, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11788
|
+
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, PREOPEN_TOOL_CALL_PREFIX, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11757
11789
|
//# sourceMappingURL=index.mjs.map
|
|
11758
11790
|
//# sourceMappingURL=index.mjs.map
|