@cognipeer/agent-sdk 0.8.5 → 0.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +377 -153
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +190 -2
- package/dist/index.d.ts +190 -2
- package/dist/index.mjs +367 -154
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -454,6 +454,14 @@ interface ToolInterface<TInput = any, TOutput = any, TCallOptions = any> {
|
|
|
454
454
|
approvalPrompt?: string;
|
|
455
455
|
approvalDefaults?: any;
|
|
456
456
|
maxExecutionsPerRun?: number | null;
|
|
457
|
+
/**
|
|
458
|
+
* Context-retention hint declared by the tool author: what the summarizer may do
|
|
459
|
+
* to this tool's arguments and response under context pressure. The tool author
|
|
460
|
+
* knows whether the arguments are the payload (a file write) or just identity (a
|
|
461
|
+
* lookup); a global policy cannot. A caller-supplied
|
|
462
|
+
* `toolResponses.retentionByTool[name]` still overrides this per axis.
|
|
463
|
+
*/
|
|
464
|
+
retention?: ToolRetentionSpec;
|
|
457
465
|
[key: string]: any;
|
|
458
466
|
}
|
|
459
467
|
type RunnableConfig = {
|
|
@@ -729,6 +737,37 @@ type RuntimeProfile = BuiltInRuntimeProfile | "custom";
|
|
|
729
737
|
type SummarizationMode = "incremental" | "full_rewrite";
|
|
730
738
|
type ContextPolicy = "raw" | "summary_only" | "hybrid";
|
|
731
739
|
type ToolResponseRetentionPolicy = "keep_full" | "keep_structured" | "summarize_archive" | "drop";
|
|
740
|
+
/**
|
|
741
|
+
* Retention policy for a tool call's ARGUMENTS (the `tool_use` input), applied by
|
|
742
|
+
* the summarizer when it compacts an old exchange.
|
|
743
|
+
*
|
|
744
|
+
* - `keep` — arguments are never modified. The safe default, and correct for the
|
|
745
|
+
* overwhelming majority of tools whose arguments are identity/query
|
|
746
|
+
* data (ids, paths, queries, flags).
|
|
747
|
+
* - `digest` — oversized *string fields only* are replaced with a compact
|
|
748
|
+
* `{__digest:{chars,sha256,head,executionId}}` descriptor. Every small
|
|
749
|
+
* scalar (path, id, mode, index) survives verbatim, so the model can
|
|
750
|
+
* still say what it did — it just cannot re-read the payload. The
|
|
751
|
+
* original arguments stay in `toolHistory` and are retrievable with
|
|
752
|
+
* `get_tool_response({executionId, part:"input"})`.
|
|
753
|
+
*
|
|
754
|
+
* Reach for `digest` on content-authoring tools whose arguments carry the payload
|
|
755
|
+
* (file writes, document chunks, generated code/HTML). Those are the calls where
|
|
756
|
+
* archiving the *response* frees nothing, because the bulk was in the request.
|
|
757
|
+
*/
|
|
758
|
+
type ToolInputRetentionPolicy = "keep" | "digest";
|
|
759
|
+
/**
|
|
760
|
+
* Two-axis context retention for a single tool. Input and output are independent
|
|
761
|
+
* because value density is per-tool: a file-write tool carries its payload in the
|
|
762
|
+
* arguments and returns `{ok:true}`, while a search tool carries a short query and
|
|
763
|
+
* returns the bulk. One axis cannot serve both.
|
|
764
|
+
*/
|
|
765
|
+
type ToolRetentionSpec = {
|
|
766
|
+
/** Argument retention. Defaults to `toolResponses.defaultInputPolicy` ("keep"). */
|
|
767
|
+
input?: ToolInputRetentionPolicy;
|
|
768
|
+
/** Response retention. Defaults to `toolResponses.defaultPolicy`. */
|
|
769
|
+
output?: ToolResponseRetentionPolicy;
|
|
770
|
+
};
|
|
732
771
|
type ToolResponseClassification = "critical" | "informative" | "verbose";
|
|
733
772
|
type PlanningMode = "off" | "todo" | "planner_executor" | "reasoning_then_tools";
|
|
734
773
|
type ReplanPolicy = "never" | "on_failure" | "on_conflict" | "every_n_steps";
|
|
@@ -851,10 +890,43 @@ type SmartAgentToolResponseConfig = {
|
|
|
851
890
|
/**
|
|
852
891
|
* Per-tool override of the summarizer retention policy. Wins over `defaultPolicy`.
|
|
853
892
|
* Critical tools cannot be reduced regardless of override.
|
|
893
|
+
*
|
|
894
|
+
* @deprecated Prefer `retentionByTool`, which also covers argument retention.
|
|
895
|
+
* Still fully honored: it is consulted for the output axis after `retentionByTool`.
|
|
854
896
|
*/
|
|
855
897
|
toolResponseRetentionByTool?: Record<string, ToolResponseRetentionPolicy>;
|
|
898
|
+
/**
|
|
899
|
+
* Retention policy applied to a tool call's ARGUMENTS when no per-tool policy is
|
|
900
|
+
* set. Defaults to `"keep"` — argument digesting is strictly opt-in, so enabling
|
|
901
|
+
* it is always a deliberate per-tool (or per-agent) decision.
|
|
902
|
+
*/
|
|
903
|
+
defaultInputPolicy?: ToolInputRetentionPolicy;
|
|
904
|
+
/**
|
|
905
|
+
* Two-axis per-tool retention override, keyed by tool name. Wins over the tool
|
|
906
|
+
* definition's own `retention` and over the axis defaults. Either axis may be
|
|
907
|
+
* omitted to fall through to the next source.
|
|
908
|
+
*
|
|
909
|
+
* ```ts
|
|
910
|
+
* retentionByTool: {
|
|
911
|
+
* create_text_file: { input: "digest", output: "summarize_archive" },
|
|
912
|
+
* read_skills: { output: "keep_full" },
|
|
913
|
+
* }
|
|
914
|
+
* ```
|
|
915
|
+
*/
|
|
916
|
+
retentionByTool?: Record<string, ToolRetentionSpec>;
|
|
856
917
|
/** Tool names whose responses are never reduced by the summarizer or hard cap. */
|
|
857
918
|
criticalTools?: string[];
|
|
919
|
+
/**
|
|
920
|
+
* Per-field character threshold for argument digesting. A string argument field
|
|
921
|
+
* longer than this is replaced by a digest descriptor; shorter fields, and every
|
|
922
|
+
* non-string scalar, are preserved verbatim. Defaults to 2000.
|
|
923
|
+
*/
|
|
924
|
+
maxToolInputFieldChars?: number;
|
|
925
|
+
/**
|
|
926
|
+
* How many leading characters of a digested field to keep as a human/model
|
|
927
|
+
* readable preview. Defaults to 200.
|
|
928
|
+
*/
|
|
929
|
+
maxToolInputDigestHeadChars?: number;
|
|
858
930
|
/** Controls whether Zod-backed tool schemas fail fast or warn on invalid args. */
|
|
859
931
|
schemaValidation?: "strict" | "warn";
|
|
860
932
|
};
|
|
@@ -1787,7 +1859,7 @@ type ToolRetryPolicy = {
|
|
|
1787
1859
|
*/
|
|
1788
1860
|
circuitBreakerThreshold?: number;
|
|
1789
1861
|
};
|
|
1790
|
-
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, }: {
|
|
1862
|
+
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, retention, }: {
|
|
1791
1863
|
name: string;
|
|
1792
1864
|
description?: string;
|
|
1793
1865
|
schema: ZodSchema;
|
|
@@ -1800,6 +1872,13 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1800
1872
|
cache?: boolean | ToolCachePolicy;
|
|
1801
1873
|
/** Per-tool retry + circuit-breaker policy. */
|
|
1802
1874
|
retry?: ToolRetryPolicy;
|
|
1875
|
+
/**
|
|
1876
|
+
* Two-axis context-retention hint: what the summarizer may do to this tool's
|
|
1877
|
+
* arguments and response under context pressure. Declare `input: "digest"` on
|
|
1878
|
+
* tools whose arguments carry a bulk payload (document/file content, generated
|
|
1879
|
+
* code) so compaction can reclaim it; leave it unset for identity/query tools.
|
|
1880
|
+
*/
|
|
1881
|
+
retention?: ToolRetentionSpec;
|
|
1803
1882
|
}): ToolInterface;
|
|
1804
1883
|
|
|
1805
1884
|
declare function buildSystemPrompt(extra?: string, planning?: boolean | PlanningMode, name?: string, todoListPrompt?: string): string;
|
|
@@ -1882,6 +1961,7 @@ type ContextToolsStateRef = {
|
|
|
1882
1961
|
declare function hasToolResponseRecoveryReference(messages: Array<{
|
|
1883
1962
|
role?: string;
|
|
1884
1963
|
content?: unknown;
|
|
1964
|
+
tool_calls?: unknown;
|
|
1885
1965
|
}> | undefined, executionId?: string): boolean;
|
|
1886
1966
|
declare function createManageTodoTool(stateRef: ContextToolsStateRef): ToolInterface<any, any, any>;
|
|
1887
1967
|
declare function createGetToolResponseTool(stateRef: ContextToolsStateRef): ToolInterface<any, any, any>;
|
|
@@ -2571,6 +2651,114 @@ type ResolvedReasoning = {
|
|
|
2571
2651
|
declare function validateReasoningConfig(input: ReasoningConfig | undefined): void;
|
|
2572
2652
|
declare function resolveReasoning(input: ReasoningConfig | undefined): ResolvedReasoning | undefined;
|
|
2573
2653
|
|
|
2654
|
+
/**
|
|
2655
|
+
* Tools the agent loop uses to steer ITSELF. Their arguments are never digested —
|
|
2656
|
+
* digesting them is never a win (the arguments are small) and always a risk:
|
|
2657
|
+
* - `response` carries the run's final structured output,
|
|
2658
|
+
* - `manage_todo_list` carries the living plan,
|
|
2659
|
+
* - `ask_user_question` carries the question the user's answer replies to,
|
|
2660
|
+
* - `open_skill` / `bind_skill_tools` / `search_skills` name the capability being
|
|
2661
|
+
* loaded, which the rest of the run reasons about,
|
|
2662
|
+
* - `get_tool_response` is the recovery path itself.
|
|
2663
|
+
* They also default to `keep_full` on the output axis (overridable per tool).
|
|
2664
|
+
*/
|
|
2665
|
+
declare const CONTROL_PLANE_TOOL_NAMES: readonly string[];
|
|
2666
|
+
/**
|
|
2667
|
+
* Delegation tools: the arguments ARE the brief handed to the child agent — the
|
|
2668
|
+
* parent must be able to say what it delegated. Never digested. The child's report
|
|
2669
|
+
* (the output) may still be archived and paged back in.
|
|
2670
|
+
*/
|
|
2671
|
+
declare const DELEGATION_TOOL_NAMES: readonly string[];
|
|
2672
|
+
declare const DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS = 2000;
|
|
2673
|
+
declare const DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS = 200;
|
|
2674
|
+
/** Key marking a digested argument field. Recognized as a recovery reference. */
|
|
2675
|
+
declare const TOOL_INPUT_DIGEST_KEY = "__digest";
|
|
2676
|
+
/**
|
|
2677
|
+
* Compact textual preview of a value for archive/structured retention. Used by
|
|
2678
|
+
* the summarizer when an old tool response is reduced to a placeholder. Not
|
|
2679
|
+
* used at tool execution time.
|
|
2680
|
+
*/
|
|
2681
|
+
declare function summarizeObject(value: any): string;
|
|
2682
|
+
/**
|
|
2683
|
+
* Tool-definition-declared retention specs, keyed by tool name. Built from the
|
|
2684
|
+
* runtime's live tool list so a skill-bound tool contributes its own declaration.
|
|
2685
|
+
*/
|
|
2686
|
+
type ToolRetentionDeclarations = Map<string, ToolRetentionSpec>;
|
|
2687
|
+
declare function collectToolRetentionDeclarations(tools: Array<ToolInterface<any, any, any>> | undefined): ToolRetentionDeclarations;
|
|
2688
|
+
/**
|
|
2689
|
+
* Resolves the retention policy applied by the summarizer when context limits
|
|
2690
|
+
* are reached. Critical tools are never reduced.
|
|
2691
|
+
*
|
|
2692
|
+
* Precedence (first match wins):
|
|
2693
|
+
* 1. `criticalTools` — absolute, never reduced (documented contract).
|
|
2694
|
+
* 2. `toolResponses.retentionByTool[name].output` — caller's two-axis override.
|
|
2695
|
+
* 3. `toolResponses.toolResponseRetentionByTool[name]` — legacy single-axis map.
|
|
2696
|
+
* 4. the tool definition's own `retention.output`.
|
|
2697
|
+
* 5. built-in control-plane default (`keep_full`).
|
|
2698
|
+
* 6. `toolResponses.defaultPolicy`.
|
|
2699
|
+
*/
|
|
2700
|
+
declare function resolveSummarizationRetention(toolName: string, config: ResolvedSmartAgentConfig, declarations?: ToolRetentionDeclarations): ToolResponseRetentionPolicy;
|
|
2701
|
+
/**
|
|
2702
|
+
* Resolves the retention policy applied to a tool call's ARGUMENTS.
|
|
2703
|
+
*
|
|
2704
|
+
* Precedence (first match wins):
|
|
2705
|
+
* 1. control-plane + delegation tools — always `keep` (hard invariant).
|
|
2706
|
+
* 2. `criticalTools` — a tool whose response may never be reduced does not get
|
|
2707
|
+
* its request reduced either.
|
|
2708
|
+
* 3. `toolResponses.retentionByTool[name].input`.
|
|
2709
|
+
* 4. the tool definition's own `retention.input`.
|
|
2710
|
+
* 5. `toolResponses.defaultInputPolicy` (defaults to `keep`).
|
|
2711
|
+
*
|
|
2712
|
+
* The default is `keep`, so argument digesting never happens unless a tool or a
|
|
2713
|
+
* caller explicitly asks for it.
|
|
2714
|
+
*/
|
|
2715
|
+
declare function resolveInputRetention(toolName: string, config: ResolvedSmartAgentConfig, declarations?: ToolRetentionDeclarations): ToolInputRetentionPolicy;
|
|
2716
|
+
type ToolInputDigestOptions = {
|
|
2717
|
+
/** Per-field character threshold. Strings at or below this are preserved verbatim. */
|
|
2718
|
+
maxFieldChars?: number;
|
|
2719
|
+
/** Leading characters of a digested field kept as a preview. */
|
|
2720
|
+
headChars?: number;
|
|
2721
|
+
/** Execution id embedded in each marker so the model can page the original back in. */
|
|
2722
|
+
executionId?: string;
|
|
2723
|
+
};
|
|
2724
|
+
type ToolInputDigestResult = {
|
|
2725
|
+
/** The rewritten value. Identical reference when nothing was digested. */
|
|
2726
|
+
value: unknown;
|
|
2727
|
+
/** Dotted paths of the fields that were replaced by a digest marker. */
|
|
2728
|
+
digestedPaths: string[];
|
|
2729
|
+
/** Characters reclaimed from the serialized arguments. */
|
|
2730
|
+
reclaimedChars: number;
|
|
2731
|
+
};
|
|
2732
|
+
/**
|
|
2733
|
+
* Field-level argument digest.
|
|
2734
|
+
*
|
|
2735
|
+
* Walks the argument structure and replaces ONLY string leaves longer than
|
|
2736
|
+
* `maxFieldChars` with a compact descriptor. Every other field — paths, ids,
|
|
2737
|
+
* modes, indexes, booleans, short strings — is preserved verbatim, so a call like
|
|
2738
|
+
*
|
|
2739
|
+
* { filePath: "/reports/q3.md", mode: "append", section: 3, content: "<60k>" }
|
|
2740
|
+
*
|
|
2741
|
+
* compacts to
|
|
2742
|
+
*
|
|
2743
|
+
* { filePath: "/reports/q3.md", mode: "append", section: 3,
|
|
2744
|
+
* content: { __digest: { chars: 61840, sha256: "…", head: "# Q3 …", recover: "…" } } }
|
|
2745
|
+
*
|
|
2746
|
+
* The model can still state exactly what it did; only the payload it no longer
|
|
2747
|
+
* needs to re-read is gone. Idempotent: an existing digest marker is left alone.
|
|
2748
|
+
*/
|
|
2749
|
+
declare function digestToolInputValue(value: unknown, options?: ToolInputDigestOptions): ToolInputDigestResult;
|
|
2750
|
+
/**
|
|
2751
|
+
* Digest a serialized `tool_call.function.arguments` JSON string in place.
|
|
2752
|
+
* Returns the input string unchanged when nothing needed digesting, when the
|
|
2753
|
+
* string is not parseable JSON (never guess at a non-JSON payload), or when the
|
|
2754
|
+
* result would not actually be smaller.
|
|
2755
|
+
*/
|
|
2756
|
+
declare function digestToolInputArguments(argumentsJson: string, options?: ToolInputDigestOptions): {
|
|
2757
|
+
arguments: string;
|
|
2758
|
+
digestedPaths: string[];
|
|
2759
|
+
reclaimedChars: number;
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2574
2762
|
declare function fileSink(path?: string): TraceSinkConfig;
|
|
2575
2763
|
type CustomSinkArg = ((event: TraceEventRecord) => void | Promise<void>) | {
|
|
2576
2764
|
onEvent?: (event: TraceEventRecord) => void | Promise<void>;
|
|
@@ -3070,4 +3258,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3070
3258
|
*/
|
|
3071
3259
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3072
3260
|
|
|
3073
|
-
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, 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_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_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, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, 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, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, 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 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, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, cognipeerSink, 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, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, tokenize, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3261
|
+
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, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, 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 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, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, 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, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -454,6 +454,14 @@ interface ToolInterface<TInput = any, TOutput = any, TCallOptions = any> {
|
|
|
454
454
|
approvalPrompt?: string;
|
|
455
455
|
approvalDefaults?: any;
|
|
456
456
|
maxExecutionsPerRun?: number | null;
|
|
457
|
+
/**
|
|
458
|
+
* Context-retention hint declared by the tool author: what the summarizer may do
|
|
459
|
+
* to this tool's arguments and response under context pressure. The tool author
|
|
460
|
+
* knows whether the arguments are the payload (a file write) or just identity (a
|
|
461
|
+
* lookup); a global policy cannot. A caller-supplied
|
|
462
|
+
* `toolResponses.retentionByTool[name]` still overrides this per axis.
|
|
463
|
+
*/
|
|
464
|
+
retention?: ToolRetentionSpec;
|
|
457
465
|
[key: string]: any;
|
|
458
466
|
}
|
|
459
467
|
type RunnableConfig = {
|
|
@@ -729,6 +737,37 @@ type RuntimeProfile = BuiltInRuntimeProfile | "custom";
|
|
|
729
737
|
type SummarizationMode = "incremental" | "full_rewrite";
|
|
730
738
|
type ContextPolicy = "raw" | "summary_only" | "hybrid";
|
|
731
739
|
type ToolResponseRetentionPolicy = "keep_full" | "keep_structured" | "summarize_archive" | "drop";
|
|
740
|
+
/**
|
|
741
|
+
* Retention policy for a tool call's ARGUMENTS (the `tool_use` input), applied by
|
|
742
|
+
* the summarizer when it compacts an old exchange.
|
|
743
|
+
*
|
|
744
|
+
* - `keep` — arguments are never modified. The safe default, and correct for the
|
|
745
|
+
* overwhelming majority of tools whose arguments are identity/query
|
|
746
|
+
* data (ids, paths, queries, flags).
|
|
747
|
+
* - `digest` — oversized *string fields only* are replaced with a compact
|
|
748
|
+
* `{__digest:{chars,sha256,head,executionId}}` descriptor. Every small
|
|
749
|
+
* scalar (path, id, mode, index) survives verbatim, so the model can
|
|
750
|
+
* still say what it did — it just cannot re-read the payload. The
|
|
751
|
+
* original arguments stay in `toolHistory` and are retrievable with
|
|
752
|
+
* `get_tool_response({executionId, part:"input"})`.
|
|
753
|
+
*
|
|
754
|
+
* Reach for `digest` on content-authoring tools whose arguments carry the payload
|
|
755
|
+
* (file writes, document chunks, generated code/HTML). Those are the calls where
|
|
756
|
+
* archiving the *response* frees nothing, because the bulk was in the request.
|
|
757
|
+
*/
|
|
758
|
+
type ToolInputRetentionPolicy = "keep" | "digest";
|
|
759
|
+
/**
|
|
760
|
+
* Two-axis context retention for a single tool. Input and output are independent
|
|
761
|
+
* because value density is per-tool: a file-write tool carries its payload in the
|
|
762
|
+
* arguments and returns `{ok:true}`, while a search tool carries a short query and
|
|
763
|
+
* returns the bulk. One axis cannot serve both.
|
|
764
|
+
*/
|
|
765
|
+
type ToolRetentionSpec = {
|
|
766
|
+
/** Argument retention. Defaults to `toolResponses.defaultInputPolicy` ("keep"). */
|
|
767
|
+
input?: ToolInputRetentionPolicy;
|
|
768
|
+
/** Response retention. Defaults to `toolResponses.defaultPolicy`. */
|
|
769
|
+
output?: ToolResponseRetentionPolicy;
|
|
770
|
+
};
|
|
732
771
|
type ToolResponseClassification = "critical" | "informative" | "verbose";
|
|
733
772
|
type PlanningMode = "off" | "todo" | "planner_executor" | "reasoning_then_tools";
|
|
734
773
|
type ReplanPolicy = "never" | "on_failure" | "on_conflict" | "every_n_steps";
|
|
@@ -851,10 +890,43 @@ type SmartAgentToolResponseConfig = {
|
|
|
851
890
|
/**
|
|
852
891
|
* Per-tool override of the summarizer retention policy. Wins over `defaultPolicy`.
|
|
853
892
|
* Critical tools cannot be reduced regardless of override.
|
|
893
|
+
*
|
|
894
|
+
* @deprecated Prefer `retentionByTool`, which also covers argument retention.
|
|
895
|
+
* Still fully honored: it is consulted for the output axis after `retentionByTool`.
|
|
854
896
|
*/
|
|
855
897
|
toolResponseRetentionByTool?: Record<string, ToolResponseRetentionPolicy>;
|
|
898
|
+
/**
|
|
899
|
+
* Retention policy applied to a tool call's ARGUMENTS when no per-tool policy is
|
|
900
|
+
* set. Defaults to `"keep"` — argument digesting is strictly opt-in, so enabling
|
|
901
|
+
* it is always a deliberate per-tool (or per-agent) decision.
|
|
902
|
+
*/
|
|
903
|
+
defaultInputPolicy?: ToolInputRetentionPolicy;
|
|
904
|
+
/**
|
|
905
|
+
* Two-axis per-tool retention override, keyed by tool name. Wins over the tool
|
|
906
|
+
* definition's own `retention` and over the axis defaults. Either axis may be
|
|
907
|
+
* omitted to fall through to the next source.
|
|
908
|
+
*
|
|
909
|
+
* ```ts
|
|
910
|
+
* retentionByTool: {
|
|
911
|
+
* create_text_file: { input: "digest", output: "summarize_archive" },
|
|
912
|
+
* read_skills: { output: "keep_full" },
|
|
913
|
+
* }
|
|
914
|
+
* ```
|
|
915
|
+
*/
|
|
916
|
+
retentionByTool?: Record<string, ToolRetentionSpec>;
|
|
856
917
|
/** Tool names whose responses are never reduced by the summarizer or hard cap. */
|
|
857
918
|
criticalTools?: string[];
|
|
919
|
+
/**
|
|
920
|
+
* Per-field character threshold for argument digesting. A string argument field
|
|
921
|
+
* longer than this is replaced by a digest descriptor; shorter fields, and every
|
|
922
|
+
* non-string scalar, are preserved verbatim. Defaults to 2000.
|
|
923
|
+
*/
|
|
924
|
+
maxToolInputFieldChars?: number;
|
|
925
|
+
/**
|
|
926
|
+
* How many leading characters of a digested field to keep as a human/model
|
|
927
|
+
* readable preview. Defaults to 200.
|
|
928
|
+
*/
|
|
929
|
+
maxToolInputDigestHeadChars?: number;
|
|
858
930
|
/** Controls whether Zod-backed tool schemas fail fast or warn on invalid args. */
|
|
859
931
|
schemaValidation?: "strict" | "warn";
|
|
860
932
|
};
|
|
@@ -1787,7 +1859,7 @@ type ToolRetryPolicy = {
|
|
|
1787
1859
|
*/
|
|
1788
1860
|
circuitBreakerThreshold?: number;
|
|
1789
1861
|
};
|
|
1790
|
-
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, }: {
|
|
1862
|
+
declare function createTool({ name, description, schema, func, needsApproval, approvalPrompt, approvalDefaults, maxExecutionsPerRun, cache, retry, retention, }: {
|
|
1791
1863
|
name: string;
|
|
1792
1864
|
description?: string;
|
|
1793
1865
|
schema: ZodSchema;
|
|
@@ -1800,6 +1872,13 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1800
1872
|
cache?: boolean | ToolCachePolicy;
|
|
1801
1873
|
/** Per-tool retry + circuit-breaker policy. */
|
|
1802
1874
|
retry?: ToolRetryPolicy;
|
|
1875
|
+
/**
|
|
1876
|
+
* Two-axis context-retention hint: what the summarizer may do to this tool's
|
|
1877
|
+
* arguments and response under context pressure. Declare `input: "digest"` on
|
|
1878
|
+
* tools whose arguments carry a bulk payload (document/file content, generated
|
|
1879
|
+
* code) so compaction can reclaim it; leave it unset for identity/query tools.
|
|
1880
|
+
*/
|
|
1881
|
+
retention?: ToolRetentionSpec;
|
|
1803
1882
|
}): ToolInterface;
|
|
1804
1883
|
|
|
1805
1884
|
declare function buildSystemPrompt(extra?: string, planning?: boolean | PlanningMode, name?: string, todoListPrompt?: string): string;
|
|
@@ -1882,6 +1961,7 @@ type ContextToolsStateRef = {
|
|
|
1882
1961
|
declare function hasToolResponseRecoveryReference(messages: Array<{
|
|
1883
1962
|
role?: string;
|
|
1884
1963
|
content?: unknown;
|
|
1964
|
+
tool_calls?: unknown;
|
|
1885
1965
|
}> | undefined, executionId?: string): boolean;
|
|
1886
1966
|
declare function createManageTodoTool(stateRef: ContextToolsStateRef): ToolInterface<any, any, any>;
|
|
1887
1967
|
declare function createGetToolResponseTool(stateRef: ContextToolsStateRef): ToolInterface<any, any, any>;
|
|
@@ -2571,6 +2651,114 @@ type ResolvedReasoning = {
|
|
|
2571
2651
|
declare function validateReasoningConfig(input: ReasoningConfig | undefined): void;
|
|
2572
2652
|
declare function resolveReasoning(input: ReasoningConfig | undefined): ResolvedReasoning | undefined;
|
|
2573
2653
|
|
|
2654
|
+
/**
|
|
2655
|
+
* Tools the agent loop uses to steer ITSELF. Their arguments are never digested —
|
|
2656
|
+
* digesting them is never a win (the arguments are small) and always a risk:
|
|
2657
|
+
* - `response` carries the run's final structured output,
|
|
2658
|
+
* - `manage_todo_list` carries the living plan,
|
|
2659
|
+
* - `ask_user_question` carries the question the user's answer replies to,
|
|
2660
|
+
* - `open_skill` / `bind_skill_tools` / `search_skills` name the capability being
|
|
2661
|
+
* loaded, which the rest of the run reasons about,
|
|
2662
|
+
* - `get_tool_response` is the recovery path itself.
|
|
2663
|
+
* They also default to `keep_full` on the output axis (overridable per tool).
|
|
2664
|
+
*/
|
|
2665
|
+
declare const CONTROL_PLANE_TOOL_NAMES: readonly string[];
|
|
2666
|
+
/**
|
|
2667
|
+
* Delegation tools: the arguments ARE the brief handed to the child agent — the
|
|
2668
|
+
* parent must be able to say what it delegated. Never digested. The child's report
|
|
2669
|
+
* (the output) may still be archived and paged back in.
|
|
2670
|
+
*/
|
|
2671
|
+
declare const DELEGATION_TOOL_NAMES: readonly string[];
|
|
2672
|
+
declare const DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS = 2000;
|
|
2673
|
+
declare const DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS = 200;
|
|
2674
|
+
/** Key marking a digested argument field. Recognized as a recovery reference. */
|
|
2675
|
+
declare const TOOL_INPUT_DIGEST_KEY = "__digest";
|
|
2676
|
+
/**
|
|
2677
|
+
* Compact textual preview of a value for archive/structured retention. Used by
|
|
2678
|
+
* the summarizer when an old tool response is reduced to a placeholder. Not
|
|
2679
|
+
* used at tool execution time.
|
|
2680
|
+
*/
|
|
2681
|
+
declare function summarizeObject(value: any): string;
|
|
2682
|
+
/**
|
|
2683
|
+
* Tool-definition-declared retention specs, keyed by tool name. Built from the
|
|
2684
|
+
* runtime's live tool list so a skill-bound tool contributes its own declaration.
|
|
2685
|
+
*/
|
|
2686
|
+
type ToolRetentionDeclarations = Map<string, ToolRetentionSpec>;
|
|
2687
|
+
declare function collectToolRetentionDeclarations(tools: Array<ToolInterface<any, any, any>> | undefined): ToolRetentionDeclarations;
|
|
2688
|
+
/**
|
|
2689
|
+
* Resolves the retention policy applied by the summarizer when context limits
|
|
2690
|
+
* are reached. Critical tools are never reduced.
|
|
2691
|
+
*
|
|
2692
|
+
* Precedence (first match wins):
|
|
2693
|
+
* 1. `criticalTools` — absolute, never reduced (documented contract).
|
|
2694
|
+
* 2. `toolResponses.retentionByTool[name].output` — caller's two-axis override.
|
|
2695
|
+
* 3. `toolResponses.toolResponseRetentionByTool[name]` — legacy single-axis map.
|
|
2696
|
+
* 4. the tool definition's own `retention.output`.
|
|
2697
|
+
* 5. built-in control-plane default (`keep_full`).
|
|
2698
|
+
* 6. `toolResponses.defaultPolicy`.
|
|
2699
|
+
*/
|
|
2700
|
+
declare function resolveSummarizationRetention(toolName: string, config: ResolvedSmartAgentConfig, declarations?: ToolRetentionDeclarations): ToolResponseRetentionPolicy;
|
|
2701
|
+
/**
|
|
2702
|
+
* Resolves the retention policy applied to a tool call's ARGUMENTS.
|
|
2703
|
+
*
|
|
2704
|
+
* Precedence (first match wins):
|
|
2705
|
+
* 1. control-plane + delegation tools — always `keep` (hard invariant).
|
|
2706
|
+
* 2. `criticalTools` — a tool whose response may never be reduced does not get
|
|
2707
|
+
* its request reduced either.
|
|
2708
|
+
* 3. `toolResponses.retentionByTool[name].input`.
|
|
2709
|
+
* 4. the tool definition's own `retention.input`.
|
|
2710
|
+
* 5. `toolResponses.defaultInputPolicy` (defaults to `keep`).
|
|
2711
|
+
*
|
|
2712
|
+
* The default is `keep`, so argument digesting never happens unless a tool or a
|
|
2713
|
+
* caller explicitly asks for it.
|
|
2714
|
+
*/
|
|
2715
|
+
declare function resolveInputRetention(toolName: string, config: ResolvedSmartAgentConfig, declarations?: ToolRetentionDeclarations): ToolInputRetentionPolicy;
|
|
2716
|
+
type ToolInputDigestOptions = {
|
|
2717
|
+
/** Per-field character threshold. Strings at or below this are preserved verbatim. */
|
|
2718
|
+
maxFieldChars?: number;
|
|
2719
|
+
/** Leading characters of a digested field kept as a preview. */
|
|
2720
|
+
headChars?: number;
|
|
2721
|
+
/** Execution id embedded in each marker so the model can page the original back in. */
|
|
2722
|
+
executionId?: string;
|
|
2723
|
+
};
|
|
2724
|
+
type ToolInputDigestResult = {
|
|
2725
|
+
/** The rewritten value. Identical reference when nothing was digested. */
|
|
2726
|
+
value: unknown;
|
|
2727
|
+
/** Dotted paths of the fields that were replaced by a digest marker. */
|
|
2728
|
+
digestedPaths: string[];
|
|
2729
|
+
/** Characters reclaimed from the serialized arguments. */
|
|
2730
|
+
reclaimedChars: number;
|
|
2731
|
+
};
|
|
2732
|
+
/**
|
|
2733
|
+
* Field-level argument digest.
|
|
2734
|
+
*
|
|
2735
|
+
* Walks the argument structure and replaces ONLY string leaves longer than
|
|
2736
|
+
* `maxFieldChars` with a compact descriptor. Every other field — paths, ids,
|
|
2737
|
+
* modes, indexes, booleans, short strings — is preserved verbatim, so a call like
|
|
2738
|
+
*
|
|
2739
|
+
* { filePath: "/reports/q3.md", mode: "append", section: 3, content: "<60k>" }
|
|
2740
|
+
*
|
|
2741
|
+
* compacts to
|
|
2742
|
+
*
|
|
2743
|
+
* { filePath: "/reports/q3.md", mode: "append", section: 3,
|
|
2744
|
+
* content: { __digest: { chars: 61840, sha256: "…", head: "# Q3 …", recover: "…" } } }
|
|
2745
|
+
*
|
|
2746
|
+
* The model can still state exactly what it did; only the payload it no longer
|
|
2747
|
+
* needs to re-read is gone. Idempotent: an existing digest marker is left alone.
|
|
2748
|
+
*/
|
|
2749
|
+
declare function digestToolInputValue(value: unknown, options?: ToolInputDigestOptions): ToolInputDigestResult;
|
|
2750
|
+
/**
|
|
2751
|
+
* Digest a serialized `tool_call.function.arguments` JSON string in place.
|
|
2752
|
+
* Returns the input string unchanged when nothing needed digesting, when the
|
|
2753
|
+
* string is not parseable JSON (never guess at a non-JSON payload), or when the
|
|
2754
|
+
* result would not actually be smaller.
|
|
2755
|
+
*/
|
|
2756
|
+
declare function digestToolInputArguments(argumentsJson: string, options?: ToolInputDigestOptions): {
|
|
2757
|
+
arguments: string;
|
|
2758
|
+
digestedPaths: string[];
|
|
2759
|
+
reclaimedChars: number;
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2574
2762
|
declare function fileSink(path?: string): TraceSinkConfig;
|
|
2575
2763
|
type CustomSinkArg = ((event: TraceEventRecord) => void | Promise<void>) | {
|
|
2576
2764
|
onEvent?: (event: TraceEventRecord) => void | Promise<void>;
|
|
@@ -3070,4 +3258,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3070
3258
|
*/
|
|
3071
3259
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3072
3260
|
|
|
3073
|
-
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, 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_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_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, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, 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, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, 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 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, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, cognipeerSink, 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, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, tokenize, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3261
|
+
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, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, 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 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, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, 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, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|