@cognipeer/agent-sdk 0.13.0 → 0.15.0

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.d.cts CHANGED
@@ -525,6 +525,25 @@ interface HookMap {
525
525
  tokensAfter: number;
526
526
  /** Name of the strategy that produced it — `"builtin"` when no slot is filled. */
527
527
  strategy: string;
528
+ /**
529
+ * The summarizer's own model call — absent when it produced no call (a
530
+ * local fallback, or a strategy that reports none). It is a real, billed
531
+ * model call that never passes `pre/postModelCall`, so this is the only
532
+ * place an observer sees it.
533
+ */
534
+ call?: {
535
+ model?: string;
536
+ durationMs?: number;
537
+ usage?: {
538
+ inputTokens?: number;
539
+ outputTokens?: number;
540
+ cachedInputTokens?: number;
541
+ totalTokens?: number;
542
+ };
543
+ messagesCompressed?: number;
544
+ /** True when the model call failed and the summary was built locally. */
545
+ fallback?: boolean;
546
+ };
528
547
  };
529
548
  output: void;
530
549
  };
@@ -1563,6 +1582,13 @@ type StructuredSummary = {
1563
1582
  * the user explicitly revoked it (listed in `discarded_obsolete`).
1564
1583
  */
1565
1584
  user_directives?: string[];
1585
+ /**
1586
+ * Directive → the user's own words it came from, quoted verbatim from a user
1587
+ * message. A directive is only kept when it can be traced to something the
1588
+ * user said (see `summarization.groundDirectives`); the quote is what a later
1589
+ * pass checks again, and what an operator reads to see where it came from.
1590
+ */
1591
+ user_directive_sources?: Record<string, string>;
1566
1592
  stable_facts: SummaryFactItem[];
1567
1593
  active_goals: string[];
1568
1594
  open_questions: string[];
@@ -1595,6 +1621,14 @@ type SmartAgentSummarizationConfig = {
1595
1621
  promptTemplate?: string;
1596
1622
  toolFreeCall?: boolean;
1597
1623
  integrityCheck?: boolean;
1624
+ /**
1625
+ * Keep a `user_directives` entry only when it traces back to a USER message
1626
+ * (its quoted source is found there, or — for a summary that gave no quote —
1627
+ * most of its words are). Default true. A directive the summarizer made up,
1628
+ * or lifted from a tool output or from its own prompt, would otherwise be
1629
+ * rendered to every later turn as "still in force — follow them".
1630
+ */
1631
+ groundDirectives?: boolean;
1598
1632
  };
1599
1633
  type SmartAgentBudgetConfig = {
1600
1634
  systemReserveTokens?: number;
@@ -2016,7 +2050,12 @@ type TraceEventRecord = {
2016
2050
  role?: string;
2017
2051
  version?: string;
2018
2052
  };
2019
- status: "success" | "error" | "skipped" | "retry";
2053
+ /**
2054
+ * `pending`: a step that is waiting on someone outside the run — a tool
2055
+ * approval or a question to the user that was asked when the run paused.
2056
+ * The answer is recorded as a separate event when the run resumes.
2057
+ */
2058
+ status: "success" | "error" | "skipped" | "retry" | "pending";
2020
2059
  durationMs?: number;
2021
2060
  inputTokens?: number;
2022
2061
  outputTokens?: number;
@@ -2069,7 +2108,36 @@ type TraceSessionSummary = {
2069
2108
  totalBytesOut: number;
2070
2109
  eventCounts: Record<string, number>;
2071
2110
  };
2072
- type TraceSessionStatus = "in_progress" | "success" | "error" | "partial";
2111
+ /**
2112
+ * `paused`: the run stopped to wait for a tool approval or an answer from the
2113
+ * user. Its trace continues — same session id, the next sequence numbers — in
2114
+ * the invoke that resumes it (see `TraceContinuation`).
2115
+ * `in_progress` on a finalized session: an internal leg of a longer turn
2116
+ * (the smart agent's summarization bounce) whose next leg continues it.
2117
+ */
2118
+ type TraceSessionStatus = "in_progress" | "success" | "error" | "partial" | "paused";
2119
+ /**
2120
+ * Where a paused (or mid-turn) trace session left off, carried on the
2121
+ * returned state as `ctx.__traceContinuation` so the invoke that resumes the
2122
+ * run records into the SAME session instead of opening a new one. Plain JSON:
2123
+ * it survives snapshots and a caller's own persistence of the paused state.
2124
+ */
2125
+ type TraceContinuation = {
2126
+ v: 1;
2127
+ sessionId: string;
2128
+ traceId?: string;
2129
+ rootSpanId?: string;
2130
+ threadId?: string;
2131
+ /** Epoch ms of the session's first part. */
2132
+ startedAt: number;
2133
+ /** Sequence number the next event takes. */
2134
+ nextSequence: number;
2135
+ /** 1-based number of the part that just ended. */
2136
+ part: number;
2137
+ /** Totals so far — a continued session reports cumulative totals. */
2138
+ summary: TraceSessionSummary;
2139
+ errors: TraceErrorRecord[];
2140
+ };
2073
2141
  type TraceSinkSnapshot = {
2074
2142
  type: "file";
2075
2143
  path: string;
@@ -2111,6 +2179,17 @@ type TraceSessionFile = {
2111
2179
  events: TraceEventRecord[];
2112
2180
  status: TraceSessionStatus;
2113
2181
  errors: TraceErrorRecord[];
2182
+ /**
2183
+ * Present when this payload continues a session an earlier invoke started
2184
+ * (a run resumed after a pause): `events` holds only this part's events,
2185
+ * numbered from `firstSequence`, while `summary`, `startedAt` and `errors`
2186
+ * cover the whole session. A sink should APPEND these events to the ones it
2187
+ * already has for `sessionId`, not replace them.
2188
+ */
2189
+ continuation?: {
2190
+ part: number;
2191
+ firstSequence: number;
2192
+ };
2114
2193
  };
2115
2194
  type ResolvedTraceSink = {
2116
2195
  type: "file";
@@ -2161,6 +2240,16 @@ type TraceSessionRuntime = {
2161
2240
  summary: TraceSessionSummary;
2162
2241
  status: TraceSessionStatus;
2163
2242
  errors: TraceErrorRecord[];
2243
+ /** Events recorded by earlier parts of this session (see `TraceContinuation`). */
2244
+ sequenceOffset?: number;
2245
+ /** 1-based part number; 1 for a session that starts with this invoke. */
2246
+ part?: number;
2247
+ /**
2248
+ * Set once the session has been handed to its sink. A closed session takes no
2249
+ * more events: they would never be delivered (and, on a session continued by
2250
+ * the next invoke, would collide with its sequence numbers).
2251
+ */
2252
+ closed?: boolean;
2164
2253
  fileBaseDir?: string;
2165
2254
  fileSessionDir?: string;
2166
2255
  };
@@ -2327,6 +2416,17 @@ type SummarizationEvent = {
2327
2416
  archivedCount?: number;
2328
2417
  structuredSummary?: StructuredSummary;
2329
2418
  integrity?: SummaryIntegrityCheck;
2419
+ /** Model that produced the summary. */
2420
+ model?: string;
2421
+ /** Directives the summarizer returned that were dropped, and why. */
2422
+ droppedDirectives?: DroppedDirective[];
2423
+ };
2424
+ /** A `user_directives` entry the grounding check refused. */
2425
+ type DroppedDirective = {
2426
+ directive: string;
2427
+ reason: "not_found_in_user_messages" | "source_quote_not_found";
2428
+ /** The quote the summarizer claimed, when it gave one. */
2429
+ sourceQuote?: string;
2330
2430
  };
2331
2431
  type EvalFamily = "recall" | "state_continuity" | "summarization_fidelity" | "context_rollover" | "query_focused_summary";
2332
2432
  type EvalCase = {
@@ -2802,6 +2902,8 @@ declare function createResolverNode(): (state: SmartState) => Promise<SmartState
2802
2902
 
2803
2903
  declare function createToolLimitFinalizeNode(_opts: SmartAgentOptions): (state: SmartState) => Promise<Partial<SmartState>>;
2804
2904
 
2905
+ /** ctx key: the last pass's model call, read (and removed) by the smart driver for `postCompact`. */
2906
+ declare const LAST_SUMMARIZATION_CALL_KEY = "__lastSummarizationCall";
2805
2907
  /**
2806
2908
  * Creates the summarization node.
2807
2909
  *
@@ -5364,11 +5466,101 @@ declare function buildToolDefinitionsSection(toolDefinitions: Array<{
5364
5466
  * Exported for provider/node code that assembles sections itself.
5365
5467
  */
5366
5468
  declare function buildResponseFormatSection(responseFormat: Record<string, any> | undefined, strategy?: "native" | "tool_based"): TraceResponseFormatSection | undefined;
5469
+ /**
5470
+ * The message sections `recordTraceEvent` builds from a `messageList`, for a
5471
+ * caller that needs them next to sections of its own (an event takes either
5472
+ * `sections` or `messageList`, not both).
5473
+ */
5474
+ declare function traceSectionsFromMessages(messageList?: any[]): TraceDataSection[];
5475
+ /**
5476
+ * Reads a `ctx.__traceContinuation` value back, or undefined when it is not
5477
+ * one. It arrives from caller-persisted state, so every field is checked.
5478
+ */
5479
+ declare function readTraceContinuation(value: unknown): TraceContinuation | undefined;
5480
+ /** Where `session` leaves off, for the invoke that will continue it. */
5481
+ declare function traceContinuationOf(session: TraceSessionRuntime): TraceContinuation;
5367
5482
  /**
5368
5483
  * Start a streaming trace session. Should be called before recording events in streaming mode.
5369
5484
  * This sends the session start to the remote endpoint immediately.
5370
5485
  */
5371
5486
  declare function startStreamingSession(session: TraceSessionRuntime | undefined, agentRuntime?: AgentRuntimeConfig): Promise<void>;
5487
+ declare function recordTraceEvent(session: TraceSessionRuntime | undefined, event: {
5488
+ type: string;
5489
+ label?: string;
5490
+ timestamp?: string;
5491
+ actor?: TraceEventRecord["actor"];
5492
+ status?: TraceEventRecord["status"];
5493
+ /** Explicit parent span ID. Falls back to session.currentIterationSpanId when omitted. */
5494
+ parentSpanId?: string;
5495
+ durationMs?: number;
5496
+ inputTokens?: number;
5497
+ outputTokens?: number;
5498
+ totalTokens?: number;
5499
+ cachedInputTokens?: number;
5500
+ /** Subset of `outputTokens` spent on reasoning (see TraceEventRecord). */
5501
+ reasoningTokens?: number;
5502
+ /** Why the model stopped — `length` explains most truncated JSON. */
5503
+ finishReason?: string;
5504
+ requestBytes?: number;
5505
+ responseBytes?: number;
5506
+ model?: string;
5507
+ provider?: string;
5508
+ toolDetails?: TraceEventRecord["toolDetails"];
5509
+ toolExecutionId?: string;
5510
+ retryOf?: string;
5511
+ error?: {
5512
+ message: string;
5513
+ stack?: string;
5514
+ } | null;
5515
+ messageList?: any[];
5516
+ /** Pre-built sections to use instead of auto-converting messageList */
5517
+ sections?: TraceDataSection[];
5518
+ /**
5519
+ * Tool MENU bound to this model call (`ai_call` events). Appended as a
5520
+ * `tool_definitions` section AFTER messageList/sections resolution, so it
5521
+ * composes with the auto-converted message sections instead of replacing
5522
+ * them. Size-capped; suppressed when logData is off.
5523
+ */
5524
+ toolDefinitions?: Array<{
5525
+ name: string;
5526
+ description?: string;
5527
+ parameters?: Record<string, any>;
5528
+ }>;
5529
+ /**
5530
+ * Structured-output CONTRACT bound to this model call (`ai_call` events),
5531
+ * appended as a `response_format` section next to the tool menu. Accepts
5532
+ * the `{ response_format: … }` invoke-options envelope or a bare
5533
+ * response_format object. Size-capped; suppressed when logData is off.
5534
+ */
5535
+ responseFormat?: Record<string, any>;
5536
+ /** Which structured-output strategy produced `responseFormat`. */
5537
+ responseFormatStrategy?: "native" | "tool_based";
5538
+ debug?: Record<string, any>;
5539
+ }): TraceEventRecord | undefined;
5540
+ /** An event held for the next trace session: the same input `recordTraceEvent` takes. */
5541
+ type DeferredTraceEvent = Parameters<typeof recordTraceEvent>[1];
5542
+ /**
5543
+ * True when `session` still accepts events. The smart agent runs a turn as
5544
+ * several invokes ("legs") and does its own work — context summarization — in
5545
+ * between them; at that point the previous leg has already handed its session
5546
+ * to the sink, and the next leg has not opened one yet.
5547
+ */
5548
+ declare function isTraceSessionOpen(session: TraceSessionRuntime | undefined): session is TraceSessionRuntime;
5549
+ /**
5550
+ * Records `event` into the open session on `ctx`, or — when there is none —
5551
+ * returns a copy of `ctx` holding it for the next invoke to record. Returns
5552
+ * undefined when nothing on ctx changed (recorded, or tracing is off).
5553
+ */
5554
+ declare function recordOrDeferTraceEvent(ctx: Record<string, any> | undefined, event: DeferredTraceEvent, options: {
5555
+ tracingEnabled: boolean;
5556
+ }): Record<string, any> | undefined;
5557
+ /**
5558
+ * Records events another invoke held for this one (see `recordOrDeferTraceEvent`),
5559
+ * in the order they happened. They keep their own timestamps; they get this
5560
+ * session's next sequence numbers, which is where they belong — after what the
5561
+ * previous leg recorded, before anything this one does.
5562
+ */
5563
+ declare function replayDeferredTraceEvents(session: TraceSessionRuntime | undefined, deferred: unknown): void;
5372
5564
 
5373
5565
  /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
5374
5566
  declare function supportsAdaptiveThinking(model: unknown): boolean;
@@ -5689,4 +5881,4 @@ declare class ModelRequestError extends ProviderError {
5689
5881
  constructor(init: ModelRequestErrorInit);
5690
5882
  }
5691
5883
 
5692
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, 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 ConversationPluginConfig, type ConversationStore, type CostEstimator, 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, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, 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 StrictRestorers, type StrictTransform, 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 SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, 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, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, redactText, regexGuardrail, regexRule, replaceTextContent, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
5884
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, 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 ConversationPluginConfig, type ConversationStore, type CostEstimator, 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 DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, 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 StrictRestorers, type StrictTransform, 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 SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, 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, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
package/dist/index.d.ts CHANGED
@@ -525,6 +525,25 @@ interface HookMap {
525
525
  tokensAfter: number;
526
526
  /** Name of the strategy that produced it — `"builtin"` when no slot is filled. */
527
527
  strategy: string;
528
+ /**
529
+ * The summarizer's own model call — absent when it produced no call (a
530
+ * local fallback, or a strategy that reports none). It is a real, billed
531
+ * model call that never passes `pre/postModelCall`, so this is the only
532
+ * place an observer sees it.
533
+ */
534
+ call?: {
535
+ model?: string;
536
+ durationMs?: number;
537
+ usage?: {
538
+ inputTokens?: number;
539
+ outputTokens?: number;
540
+ cachedInputTokens?: number;
541
+ totalTokens?: number;
542
+ };
543
+ messagesCompressed?: number;
544
+ /** True when the model call failed and the summary was built locally. */
545
+ fallback?: boolean;
546
+ };
528
547
  };
529
548
  output: void;
530
549
  };
@@ -1563,6 +1582,13 @@ type StructuredSummary = {
1563
1582
  * the user explicitly revoked it (listed in `discarded_obsolete`).
1564
1583
  */
1565
1584
  user_directives?: string[];
1585
+ /**
1586
+ * Directive → the user's own words it came from, quoted verbatim from a user
1587
+ * message. A directive is only kept when it can be traced to something the
1588
+ * user said (see `summarization.groundDirectives`); the quote is what a later
1589
+ * pass checks again, and what an operator reads to see where it came from.
1590
+ */
1591
+ user_directive_sources?: Record<string, string>;
1566
1592
  stable_facts: SummaryFactItem[];
1567
1593
  active_goals: string[];
1568
1594
  open_questions: string[];
@@ -1595,6 +1621,14 @@ type SmartAgentSummarizationConfig = {
1595
1621
  promptTemplate?: string;
1596
1622
  toolFreeCall?: boolean;
1597
1623
  integrityCheck?: boolean;
1624
+ /**
1625
+ * Keep a `user_directives` entry only when it traces back to a USER message
1626
+ * (its quoted source is found there, or — for a summary that gave no quote —
1627
+ * most of its words are). Default true. A directive the summarizer made up,
1628
+ * or lifted from a tool output or from its own prompt, would otherwise be
1629
+ * rendered to every later turn as "still in force — follow them".
1630
+ */
1631
+ groundDirectives?: boolean;
1598
1632
  };
1599
1633
  type SmartAgentBudgetConfig = {
1600
1634
  systemReserveTokens?: number;
@@ -2016,7 +2050,12 @@ type TraceEventRecord = {
2016
2050
  role?: string;
2017
2051
  version?: string;
2018
2052
  };
2019
- status: "success" | "error" | "skipped" | "retry";
2053
+ /**
2054
+ * `pending`: a step that is waiting on someone outside the run — a tool
2055
+ * approval or a question to the user that was asked when the run paused.
2056
+ * The answer is recorded as a separate event when the run resumes.
2057
+ */
2058
+ status: "success" | "error" | "skipped" | "retry" | "pending";
2020
2059
  durationMs?: number;
2021
2060
  inputTokens?: number;
2022
2061
  outputTokens?: number;
@@ -2069,7 +2108,36 @@ type TraceSessionSummary = {
2069
2108
  totalBytesOut: number;
2070
2109
  eventCounts: Record<string, number>;
2071
2110
  };
2072
- type TraceSessionStatus = "in_progress" | "success" | "error" | "partial";
2111
+ /**
2112
+ * `paused`: the run stopped to wait for a tool approval or an answer from the
2113
+ * user. Its trace continues — same session id, the next sequence numbers — in
2114
+ * the invoke that resumes it (see `TraceContinuation`).
2115
+ * `in_progress` on a finalized session: an internal leg of a longer turn
2116
+ * (the smart agent's summarization bounce) whose next leg continues it.
2117
+ */
2118
+ type TraceSessionStatus = "in_progress" | "success" | "error" | "partial" | "paused";
2119
+ /**
2120
+ * Where a paused (or mid-turn) trace session left off, carried on the
2121
+ * returned state as `ctx.__traceContinuation` so the invoke that resumes the
2122
+ * run records into the SAME session instead of opening a new one. Plain JSON:
2123
+ * it survives snapshots and a caller's own persistence of the paused state.
2124
+ */
2125
+ type TraceContinuation = {
2126
+ v: 1;
2127
+ sessionId: string;
2128
+ traceId?: string;
2129
+ rootSpanId?: string;
2130
+ threadId?: string;
2131
+ /** Epoch ms of the session's first part. */
2132
+ startedAt: number;
2133
+ /** Sequence number the next event takes. */
2134
+ nextSequence: number;
2135
+ /** 1-based number of the part that just ended. */
2136
+ part: number;
2137
+ /** Totals so far — a continued session reports cumulative totals. */
2138
+ summary: TraceSessionSummary;
2139
+ errors: TraceErrorRecord[];
2140
+ };
2073
2141
  type TraceSinkSnapshot = {
2074
2142
  type: "file";
2075
2143
  path: string;
@@ -2111,6 +2179,17 @@ type TraceSessionFile = {
2111
2179
  events: TraceEventRecord[];
2112
2180
  status: TraceSessionStatus;
2113
2181
  errors: TraceErrorRecord[];
2182
+ /**
2183
+ * Present when this payload continues a session an earlier invoke started
2184
+ * (a run resumed after a pause): `events` holds only this part's events,
2185
+ * numbered from `firstSequence`, while `summary`, `startedAt` and `errors`
2186
+ * cover the whole session. A sink should APPEND these events to the ones it
2187
+ * already has for `sessionId`, not replace them.
2188
+ */
2189
+ continuation?: {
2190
+ part: number;
2191
+ firstSequence: number;
2192
+ };
2114
2193
  };
2115
2194
  type ResolvedTraceSink = {
2116
2195
  type: "file";
@@ -2161,6 +2240,16 @@ type TraceSessionRuntime = {
2161
2240
  summary: TraceSessionSummary;
2162
2241
  status: TraceSessionStatus;
2163
2242
  errors: TraceErrorRecord[];
2243
+ /** Events recorded by earlier parts of this session (see `TraceContinuation`). */
2244
+ sequenceOffset?: number;
2245
+ /** 1-based part number; 1 for a session that starts with this invoke. */
2246
+ part?: number;
2247
+ /**
2248
+ * Set once the session has been handed to its sink. A closed session takes no
2249
+ * more events: they would never be delivered (and, on a session continued by
2250
+ * the next invoke, would collide with its sequence numbers).
2251
+ */
2252
+ closed?: boolean;
2164
2253
  fileBaseDir?: string;
2165
2254
  fileSessionDir?: string;
2166
2255
  };
@@ -2327,6 +2416,17 @@ type SummarizationEvent = {
2327
2416
  archivedCount?: number;
2328
2417
  structuredSummary?: StructuredSummary;
2329
2418
  integrity?: SummaryIntegrityCheck;
2419
+ /** Model that produced the summary. */
2420
+ model?: string;
2421
+ /** Directives the summarizer returned that were dropped, and why. */
2422
+ droppedDirectives?: DroppedDirective[];
2423
+ };
2424
+ /** A `user_directives` entry the grounding check refused. */
2425
+ type DroppedDirective = {
2426
+ directive: string;
2427
+ reason: "not_found_in_user_messages" | "source_quote_not_found";
2428
+ /** The quote the summarizer claimed, when it gave one. */
2429
+ sourceQuote?: string;
2330
2430
  };
2331
2431
  type EvalFamily = "recall" | "state_continuity" | "summarization_fidelity" | "context_rollover" | "query_focused_summary";
2332
2432
  type EvalCase = {
@@ -2802,6 +2902,8 @@ declare function createResolverNode(): (state: SmartState) => Promise<SmartState
2802
2902
 
2803
2903
  declare function createToolLimitFinalizeNode(_opts: SmartAgentOptions): (state: SmartState) => Promise<Partial<SmartState>>;
2804
2904
 
2905
+ /** ctx key: the last pass's model call, read (and removed) by the smart driver for `postCompact`. */
2906
+ declare const LAST_SUMMARIZATION_CALL_KEY = "__lastSummarizationCall";
2805
2907
  /**
2806
2908
  * Creates the summarization node.
2807
2909
  *
@@ -5364,11 +5466,101 @@ declare function buildToolDefinitionsSection(toolDefinitions: Array<{
5364
5466
  * Exported for provider/node code that assembles sections itself.
5365
5467
  */
5366
5468
  declare function buildResponseFormatSection(responseFormat: Record<string, any> | undefined, strategy?: "native" | "tool_based"): TraceResponseFormatSection | undefined;
5469
+ /**
5470
+ * The message sections `recordTraceEvent` builds from a `messageList`, for a
5471
+ * caller that needs them next to sections of its own (an event takes either
5472
+ * `sections` or `messageList`, not both).
5473
+ */
5474
+ declare function traceSectionsFromMessages(messageList?: any[]): TraceDataSection[];
5475
+ /**
5476
+ * Reads a `ctx.__traceContinuation` value back, or undefined when it is not
5477
+ * one. It arrives from caller-persisted state, so every field is checked.
5478
+ */
5479
+ declare function readTraceContinuation(value: unknown): TraceContinuation | undefined;
5480
+ /** Where `session` leaves off, for the invoke that will continue it. */
5481
+ declare function traceContinuationOf(session: TraceSessionRuntime): TraceContinuation;
5367
5482
  /**
5368
5483
  * Start a streaming trace session. Should be called before recording events in streaming mode.
5369
5484
  * This sends the session start to the remote endpoint immediately.
5370
5485
  */
5371
5486
  declare function startStreamingSession(session: TraceSessionRuntime | undefined, agentRuntime?: AgentRuntimeConfig): Promise<void>;
5487
+ declare function recordTraceEvent(session: TraceSessionRuntime | undefined, event: {
5488
+ type: string;
5489
+ label?: string;
5490
+ timestamp?: string;
5491
+ actor?: TraceEventRecord["actor"];
5492
+ status?: TraceEventRecord["status"];
5493
+ /** Explicit parent span ID. Falls back to session.currentIterationSpanId when omitted. */
5494
+ parentSpanId?: string;
5495
+ durationMs?: number;
5496
+ inputTokens?: number;
5497
+ outputTokens?: number;
5498
+ totalTokens?: number;
5499
+ cachedInputTokens?: number;
5500
+ /** Subset of `outputTokens` spent on reasoning (see TraceEventRecord). */
5501
+ reasoningTokens?: number;
5502
+ /** Why the model stopped — `length` explains most truncated JSON. */
5503
+ finishReason?: string;
5504
+ requestBytes?: number;
5505
+ responseBytes?: number;
5506
+ model?: string;
5507
+ provider?: string;
5508
+ toolDetails?: TraceEventRecord["toolDetails"];
5509
+ toolExecutionId?: string;
5510
+ retryOf?: string;
5511
+ error?: {
5512
+ message: string;
5513
+ stack?: string;
5514
+ } | null;
5515
+ messageList?: any[];
5516
+ /** Pre-built sections to use instead of auto-converting messageList */
5517
+ sections?: TraceDataSection[];
5518
+ /**
5519
+ * Tool MENU bound to this model call (`ai_call` events). Appended as a
5520
+ * `tool_definitions` section AFTER messageList/sections resolution, so it
5521
+ * composes with the auto-converted message sections instead of replacing
5522
+ * them. Size-capped; suppressed when logData is off.
5523
+ */
5524
+ toolDefinitions?: Array<{
5525
+ name: string;
5526
+ description?: string;
5527
+ parameters?: Record<string, any>;
5528
+ }>;
5529
+ /**
5530
+ * Structured-output CONTRACT bound to this model call (`ai_call` events),
5531
+ * appended as a `response_format` section next to the tool menu. Accepts
5532
+ * the `{ response_format: … }` invoke-options envelope or a bare
5533
+ * response_format object. Size-capped; suppressed when logData is off.
5534
+ */
5535
+ responseFormat?: Record<string, any>;
5536
+ /** Which structured-output strategy produced `responseFormat`. */
5537
+ responseFormatStrategy?: "native" | "tool_based";
5538
+ debug?: Record<string, any>;
5539
+ }): TraceEventRecord | undefined;
5540
+ /** An event held for the next trace session: the same input `recordTraceEvent` takes. */
5541
+ type DeferredTraceEvent = Parameters<typeof recordTraceEvent>[1];
5542
+ /**
5543
+ * True when `session` still accepts events. The smart agent runs a turn as
5544
+ * several invokes ("legs") and does its own work — context summarization — in
5545
+ * between them; at that point the previous leg has already handed its session
5546
+ * to the sink, and the next leg has not opened one yet.
5547
+ */
5548
+ declare function isTraceSessionOpen(session: TraceSessionRuntime | undefined): session is TraceSessionRuntime;
5549
+ /**
5550
+ * Records `event` into the open session on `ctx`, or — when there is none —
5551
+ * returns a copy of `ctx` holding it for the next invoke to record. Returns
5552
+ * undefined when nothing on ctx changed (recorded, or tracing is off).
5553
+ */
5554
+ declare function recordOrDeferTraceEvent(ctx: Record<string, any> | undefined, event: DeferredTraceEvent, options: {
5555
+ tracingEnabled: boolean;
5556
+ }): Record<string, any> | undefined;
5557
+ /**
5558
+ * Records events another invoke held for this one (see `recordOrDeferTraceEvent`),
5559
+ * in the order they happened. They keep their own timestamps; they get this
5560
+ * session's next sequence numbers, which is where they belong — after what the
5561
+ * previous leg recorded, before anything this one does.
5562
+ */
5563
+ declare function replayDeferredTraceEvents(session: TraceSessionRuntime | undefined, deferred: unknown): void;
5372
5564
 
5373
5565
  /** True when the model's rule uses `thinking:{type:"adaptive"}` + `output_config.effort` (Claude 4.6+ / 5.x). */
5374
5566
  declare function supportsAdaptiveThinking(model: unknown): boolean;
@@ -5689,4 +5881,4 @@ declare class ModelRequestError extends ProviderError {
5689
5881
  constructor(init: ModelRequestErrorInit);
5690
5882
  }
5691
5883
 
5692
- export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, 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 ConversationPluginConfig, type ConversationStore, type CostEstimator, 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, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, 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 StrictRestorers, type StrictTransform, 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 SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, 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, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, redactText, regexGuardrail, regexRule, replaceTextContent, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };
5884
+ export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentPlugin, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, AnthropicProviderConfig, type ApprovalTransport, type AuditEntry, type AuditLogConfig, type AzureContentSafetyConfig, AzureProvider, AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, type BedrockGuardrailConfig, BedrockProvider, BedrockProviderConfig, type BudgetGuardConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONSOLE_HOOK_MAP, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type CapabilityStatus, ChatCompletionChunk, ChatCompletionRequest, ChatCompletionResponse, type CheckpointPluginConfig, type CheckpointStore, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CognipeerGuardrailConfig, type CompressToolOutputParams, type ContextBuilder, 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 ConversationPluginConfig, type ConversationStore, type CostEstimator, 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 DeferredTraceEvent, type DelegationEventStamp, type DelegationMode, type DroppedDirective, EmbeddingRequest, EmbeddingResponse, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FinalAnswerEvent, type GateResult, type GuardrailCallContext, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailJudgeEngine, type GuardrailOutcome, GuardrailPhase, type GuardrailPhaseName, type GuardrailPluginOptions, type GuardrailRequest, type GuardrailRule, type GuardrailRuleResult, type GuardrailTransport, type GuardrailVerdict, type GuardrailViolation, HOOK_CONTRACT_VERSION, HOOK_NAMES, type HandoffDescriptor, type HandoffEvent, type HookContext, type HookDecision, type HookHandler, type HookMap, type HookName, type HookRegistrations, HookTimeoutError, type HttpGuardrailOptions, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, InMemoryMemoryStore, type InjectionScan, type InvokeConfig, type JevClientLike, type JevEngineOptions, type JevNoulAnswer, JevProvider, JevProviderConfig, type JevQuestion, type JevSystemOneRequest, type JevSystemOneResult, type JsonGuardrailOptions, type JsonSchemaRuleOptions, LAST_SUMMARIZATION_CALL_KEY, type LangfuseBuildContext, type LangfuseEvent, type LangfuseEventKind, type LangfuseTracingConfig, type LanguageGuardConfig, type LoadSkillsOptions, type MaybePromise, type McpConfig, type McpConnection, type MediaAttachment, type MediaKind$1 as MediaKind, type MediaPolicyConfig, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MessageUsage, type MetadataEvent, type ModelCapabilities, ModelRequestError, type ModelRequestErrorCode, type ModelRequestErrorInit, ModelRuleLearnedEvent, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, OpenAICompatibleProviderConfig, type OpenAIModerationConfig, OpenAIProvider, OpenAIProviderConfig, type OtelTracingConfig, type OutputGuardConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PiiDetector, type PiiEntity, type PiiRedactionConfig, type PlanEvent, type PlanStepRecord, type PlanningMode, type PluginContributions, type PluginEvent, type PluginFailureMode, type PluginHost, type PluginHostOptions, type PluginLogger, type PluginProvides, type PluginRunHost, type PluginSetupContext, type PortkeyGatewayConfig, type PortkeyGuardrailConfig, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type PromptInjectionFamily, type PromptInjectionGuardConfig, type PromptSource, ProviderConfig, ProviderError, ToolDefinition as ProviderToolDefinition, ProviderType, type RateLimitConfig, type ReasoningConfig, type ReasoningLevel, type RedactionResult, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailConfig, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type ResponseCacheConfig, type RestoreSnapshotOptions, RulePatch, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SdkCapabilities, type SerializableSmartState, type SessionMetrics, type SessionMetricsConfig, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillSource, type SkillToolDeps, type SkillToolHeader, type SlotName, 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 StrictRestorers, type StrictTransform, 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 SummarizerInput, type SummarizerResult, type SummarizerStrategy, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TokenCounter, TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolPolicyConfig, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type ToolRule, type TraceContinuation, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessagePart, 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, UnifiedMessage, type UserQuestionAnswer, type UserQuestionAnswerSet, type UserQuestionEvent, type UserQuestionItem, type UserQuestionOption, type UserQuestionResolution, type UserQuestionStatus, VertexProvider, VertexProviderConfig, type VolatileContentFinding, type VolatileContentPattern, type WebhookApprovalConfig, agentVerdictRule, appendBoundTools, auditLog, azureContentSafety, bedrockGuardrail, budgetGuard, buildHandoffTools, buildResponseFormatSection, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, buildToolDefinitionsSection, canOpenSkill, canSpawn, captureSnapshot, checkpointing, codePresenceRule, coerceToolArgs, cognipeerGuardrail, cognipeerSink, collectAttachments, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, contentPartToText, contentToString, conversationHistory, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createGuardrailPlugin, createJsonGuardrail, createManageTodoListAliasTool, createManageTodoTool, createOpenSkillTool, createParallelTool, createPluginHost, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customGuardrail, customSink, dedupeToolsByName, defaultTokenCounter, defineHook, definePlugin, describeContentPart, detectLanguage, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, evaluateGuardrails, extractLatestUserQuery, extractMessageText, fileCheckpointStore, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasMediaPart, hasToolResponseRecoveryReference, httpGuardrail, httpSink, inMemoryCheckpointStore, inMemoryConversationStore, isHookImplemented, isOpenAIHostedEndpoint, isSmartModel, isTraceSessionOpen, isValidIban, isValidLuhn, isValidTckn, jsonSchemaRule, defaultBuildPayload as langfuseDefaultPayload, langfuseTracing, languageGuard, loadSkillsFromDisk, mapConsoleHookVerdict, mapTextParts, mcp, mediaKindOf, mediaPolicy, normalizeSmartAgentOptions, normalizeVerdicts, openAIModeration, otelTracing, otlpSink, outputGuard, parseApprovalDecision, parseSkillFrontmatter, pathSandbox, piiRedaction, pluginCapabilities, portkeyGateway, portkeyGuardrail, preopenSkills, preopenToolCallId, prepareStrictToolMenu, promptInjectionGuard, rateLimit, readMemoryFacts, readTraceContinuation, recordOrDeferTraceEvent, redactText, regexGuardrail, regexRule, replaceTextContent, replayDeferredTraceEvents, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, responseCache, restoreSnapshot, restoreToolCalls, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, sessionMetrics, setTokenCounter, startStreamingSession, summarizeObject, supportsAdaptiveThinking, textFromContent, toMessageUsage, toStrictCompatible, toStrictToolSchema, tokenize, toolPolicy, traceContinuationOf, traceSectionsFromMessages, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, webhookApproval, withTools, withinDepth, writeSummaryFactsToMemory };