@cognipeer/agent-sdk 0.8.12 → 0.9.1
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 +174 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -5
- package/dist/index.d.ts +99 -5
- package/dist/index.mjs +172 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -444,14 +444,38 @@ type ContentPart$1 = {
|
|
|
444
444
|
type: string;
|
|
445
445
|
[key: string]: any;
|
|
446
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* Decides, per call, whether this invocation needs human approval.
|
|
449
|
+
*
|
|
450
|
+
* Return `true` to pause. Returning a non-boolean is treated as `false` except
|
|
451
|
+
* for a thrown error, which is treated as `true` — see `needsApproval`.
|
|
452
|
+
*/
|
|
453
|
+
type ToolApprovalPredicate = (args: any) => boolean;
|
|
447
454
|
interface ToolInterface<TInput = any, TOutput = any, TCallOptions = any> {
|
|
448
455
|
name: string;
|
|
449
456
|
description?: string;
|
|
450
457
|
invoke?: (input: TInput, config?: TCallOptions) => Promise<TOutput> | TOutput;
|
|
451
458
|
call?: (input: TInput, config?: TCallOptions) => Promise<TOutput> | TOutput;
|
|
452
459
|
schema?: any;
|
|
453
|
-
|
|
454
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Whether a call must pause for a human before it runs.
|
|
462
|
+
*
|
|
463
|
+
* A boolean decides for the tool as a whole. A PREDICATE decides per call, with
|
|
464
|
+
* the parsed arguments in hand — which is the only way to express "ask before
|
|
465
|
+
* `rm`, but not before `ls`", because the interesting half of a dangerous tool
|
|
466
|
+
* is usually its arguments, not its name.
|
|
467
|
+
*
|
|
468
|
+
* The predicate runs inside the tools node, immediately before the call would
|
|
469
|
+
* execute, and it must not throw: a predicate that throws is treated as
|
|
470
|
+
* `true`, because a policy that cannot decide has not granted permission.
|
|
471
|
+
*/
|
|
472
|
+
needsApproval?: boolean | ToolApprovalPredicate;
|
|
473
|
+
/**
|
|
474
|
+
* The text shown to whoever is asked. A function receives the same arguments
|
|
475
|
+
* the predicate saw, so the prompt can quote what is actually about to happen
|
|
476
|
+
* ("Delete 3 files under /src?") instead of describing the tool in general.
|
|
477
|
+
*/
|
|
478
|
+
approvalPrompt?: string | ((args: any) => string | undefined);
|
|
455
479
|
approvalDefaults?: any;
|
|
456
480
|
maxExecutionsPerRun?: number | null;
|
|
457
481
|
/**
|
|
@@ -1094,7 +1118,13 @@ type TraceToolDetails = {
|
|
|
1094
1118
|
description?: string;
|
|
1095
1119
|
inputSchema?: any;
|
|
1096
1120
|
approval?: {
|
|
1121
|
+
/** Set only when the tool answers statically. Absent when `conditional`. */
|
|
1097
1122
|
required?: boolean;
|
|
1123
|
+
/**
|
|
1124
|
+
* The tool decides per call from its arguments, so no single answer can be
|
|
1125
|
+
* recorded here. The actual verdict for each call is on its approval entry.
|
|
1126
|
+
*/
|
|
1127
|
+
conditional?: boolean;
|
|
1098
1128
|
prompt?: string;
|
|
1099
1129
|
defaults?: any;
|
|
1100
1130
|
};
|
|
@@ -1775,6 +1805,15 @@ type InvokeConfig = RunnableConfig & {
|
|
|
1775
1805
|
limits?: Partial<AgentLimits>;
|
|
1776
1806
|
onStateChange?: (state: SmartState) => boolean;
|
|
1777
1807
|
checkpointReason?: string;
|
|
1808
|
+
/**
|
|
1809
|
+
* Keys of `skills` to open deterministically at the start of this invoke,
|
|
1810
|
+
* before the first model call. Each one is opened through the real
|
|
1811
|
+
* `open_skill` tool and written into the transcript as an assistant tool call
|
|
1812
|
+
* plus its tool result, so the model starts the run with the skill's guidance
|
|
1813
|
+
* and tools already bound instead of having to discover them. Unknown or
|
|
1814
|
+
* unavailable keys are skipped. Ignored when the agent has no `skills`.
|
|
1815
|
+
*/
|
|
1816
|
+
preopenedSkills?: string[];
|
|
1778
1817
|
};
|
|
1779
1818
|
type SnapshotRuntimeHint = {
|
|
1780
1819
|
name?: string;
|
|
@@ -1865,8 +1904,13 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1865
1904
|
description?: string;
|
|
1866
1905
|
schema: ZodSchema;
|
|
1867
1906
|
func: SmartToolFn;
|
|
1868
|
-
|
|
1869
|
-
|
|
1907
|
+
/**
|
|
1908
|
+
* `true` gates every call; a predicate gates the calls whose ARGUMENTS
|
|
1909
|
+
* warrant it. See ToolApprovalPredicate.
|
|
1910
|
+
*/
|
|
1911
|
+
needsApproval?: boolean | ToolApprovalPredicate;
|
|
1912
|
+
/** A function form receives the call's arguments, so the prompt can quote them. */
|
|
1913
|
+
approvalPrompt?: string | ((args: any) => string | undefined);
|
|
1870
1914
|
approvalDefaults?: any;
|
|
1871
1915
|
maxExecutionsPerRun?: number | null;
|
|
1872
1916
|
/** When set, identical args within the same invoke short-circuit to the cached result. */
|
|
@@ -2108,6 +2152,56 @@ declare function parseSkillFrontmatter(md: string): SkillFrontmatter;
|
|
|
2108
2152
|
*/
|
|
2109
2153
|
declare function loadSkillsFromDisk(opts: LoadSkillsOptions): Promise<Skill[]>;
|
|
2110
2154
|
|
|
2155
|
+
/**
|
|
2156
|
+
* Deterministic pre-opening of skills at the start of an invoke.
|
|
2157
|
+
*
|
|
2158
|
+
* Some skills must not depend on the model choosing to discover them — an
|
|
2159
|
+
* organization policy, or the integration a scheduled run is about. Those keys
|
|
2160
|
+
* are passed per-invoke (`InvokeConfig.preopenedSkills`) and opened here BEFORE
|
|
2161
|
+
* the first model call, by invoking the very same `open_skill` tool the model
|
|
2162
|
+
* would have called. The run then continues normally: the skill's tools are
|
|
2163
|
+
* bound in the registry and `bind_skill_tools` can still widen the surface.
|
|
2164
|
+
*
|
|
2165
|
+
* The opening is written into the transcript as a real tool exchange (one
|
|
2166
|
+
* assistant message carrying the tool calls, then one tool message per call),
|
|
2167
|
+
* because that is the shape the model is trained on and the shape the rest of
|
|
2168
|
+
* the runtime — summarization, retention, `get_tool_response` — already
|
|
2169
|
+
* understands. Tool call ids are derived from the skill key rather than random,
|
|
2170
|
+
* so the same preopen set produces a byte-identical prefix on every run and the
|
|
2171
|
+
* provider-side prompt cache keeps hitting.
|
|
2172
|
+
*/
|
|
2173
|
+
declare const PREOPEN_TOOL_CALL_PREFIX = "preopen_skill_";
|
|
2174
|
+
type PreopenSkillsResult = {
|
|
2175
|
+
/** Synthetic transcript entries to append after the user message. */
|
|
2176
|
+
messages: BaseMessage[];
|
|
2177
|
+
/** Tool-history rows mirroring the synthetic calls. */
|
|
2178
|
+
toolHistory: NonNullable<AgentState["toolHistory"]>;
|
|
2179
|
+
/** Skill keys actually opened (available, resolved, not already open). */
|
|
2180
|
+
openedKeys: string[];
|
|
2181
|
+
/** Keys that were requested but could not be opened, with the reason. */
|
|
2182
|
+
skipped: Array<{
|
|
2183
|
+
skillKey: string;
|
|
2184
|
+
reason: string;
|
|
2185
|
+
}>;
|
|
2186
|
+
};
|
|
2187
|
+
/** Tool call ids must survive provider id charset rules; skill keys contain ':'. */
|
|
2188
|
+
declare function preopenToolCallId(skillKey: string): string;
|
|
2189
|
+
/**
|
|
2190
|
+
* Open the requested skills through the real `open_skill` tool and return the
|
|
2191
|
+
* transcript + tool-history entries that describe the exchange. Binding side
|
|
2192
|
+
* effects (registry mutation + `__onToolsChanged`) happen inside the tool, so
|
|
2193
|
+
* the caller only has to merge the returned messages/history into its state.
|
|
2194
|
+
*/
|
|
2195
|
+
declare function preopenSkills(input: {
|
|
2196
|
+
skillKeys: string[];
|
|
2197
|
+
tools: ToolInterface[];
|
|
2198
|
+
/** Keys already open on the registry — a resumed run must not re-open them. */
|
|
2199
|
+
alreadyOpenedKeys?: string[];
|
|
2200
|
+
/** Existing transcript, used to keep the injection idempotent across resumes. */
|
|
2201
|
+
existingMessages?: BaseMessage[];
|
|
2202
|
+
onEvent?: (event: SmartAgentEvent) => void;
|
|
2203
|
+
}): Promise<PreopenSkillsResult>;
|
|
2204
|
+
|
|
2111
2205
|
/**
|
|
2112
2206
|
* Pure registry helpers for the sub-agent primitive. No I/O, no agent loop —
|
|
2113
2207
|
* the deterministic core, fully unit-testable on its own.
|
|
@@ -3335,4 +3429,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3335
3429
|
*/
|
|
3336
3430
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3337
3431
|
|
|
3338
|
-
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, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3432
|
+
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type 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, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
package/dist/index.d.ts
CHANGED
|
@@ -444,14 +444,38 @@ type ContentPart$1 = {
|
|
|
444
444
|
type: string;
|
|
445
445
|
[key: string]: any;
|
|
446
446
|
};
|
|
447
|
+
/**
|
|
448
|
+
* Decides, per call, whether this invocation needs human approval.
|
|
449
|
+
*
|
|
450
|
+
* Return `true` to pause. Returning a non-boolean is treated as `false` except
|
|
451
|
+
* for a thrown error, which is treated as `true` — see `needsApproval`.
|
|
452
|
+
*/
|
|
453
|
+
type ToolApprovalPredicate = (args: any) => boolean;
|
|
447
454
|
interface ToolInterface<TInput = any, TOutput = any, TCallOptions = any> {
|
|
448
455
|
name: string;
|
|
449
456
|
description?: string;
|
|
450
457
|
invoke?: (input: TInput, config?: TCallOptions) => Promise<TOutput> | TOutput;
|
|
451
458
|
call?: (input: TInput, config?: TCallOptions) => Promise<TOutput> | TOutput;
|
|
452
459
|
schema?: any;
|
|
453
|
-
|
|
454
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Whether a call must pause for a human before it runs.
|
|
462
|
+
*
|
|
463
|
+
* A boolean decides for the tool as a whole. A PREDICATE decides per call, with
|
|
464
|
+
* the parsed arguments in hand — which is the only way to express "ask before
|
|
465
|
+
* `rm`, but not before `ls`", because the interesting half of a dangerous tool
|
|
466
|
+
* is usually its arguments, not its name.
|
|
467
|
+
*
|
|
468
|
+
* The predicate runs inside the tools node, immediately before the call would
|
|
469
|
+
* execute, and it must not throw: a predicate that throws is treated as
|
|
470
|
+
* `true`, because a policy that cannot decide has not granted permission.
|
|
471
|
+
*/
|
|
472
|
+
needsApproval?: boolean | ToolApprovalPredicate;
|
|
473
|
+
/**
|
|
474
|
+
* The text shown to whoever is asked. A function receives the same arguments
|
|
475
|
+
* the predicate saw, so the prompt can quote what is actually about to happen
|
|
476
|
+
* ("Delete 3 files under /src?") instead of describing the tool in general.
|
|
477
|
+
*/
|
|
478
|
+
approvalPrompt?: string | ((args: any) => string | undefined);
|
|
455
479
|
approvalDefaults?: any;
|
|
456
480
|
maxExecutionsPerRun?: number | null;
|
|
457
481
|
/**
|
|
@@ -1094,7 +1118,13 @@ type TraceToolDetails = {
|
|
|
1094
1118
|
description?: string;
|
|
1095
1119
|
inputSchema?: any;
|
|
1096
1120
|
approval?: {
|
|
1121
|
+
/** Set only when the tool answers statically. Absent when `conditional`. */
|
|
1097
1122
|
required?: boolean;
|
|
1123
|
+
/**
|
|
1124
|
+
* The tool decides per call from its arguments, so no single answer can be
|
|
1125
|
+
* recorded here. The actual verdict for each call is on its approval entry.
|
|
1126
|
+
*/
|
|
1127
|
+
conditional?: boolean;
|
|
1098
1128
|
prompt?: string;
|
|
1099
1129
|
defaults?: any;
|
|
1100
1130
|
};
|
|
@@ -1775,6 +1805,15 @@ type InvokeConfig = RunnableConfig & {
|
|
|
1775
1805
|
limits?: Partial<AgentLimits>;
|
|
1776
1806
|
onStateChange?: (state: SmartState) => boolean;
|
|
1777
1807
|
checkpointReason?: string;
|
|
1808
|
+
/**
|
|
1809
|
+
* Keys of `skills` to open deterministically at the start of this invoke,
|
|
1810
|
+
* before the first model call. Each one is opened through the real
|
|
1811
|
+
* `open_skill` tool and written into the transcript as an assistant tool call
|
|
1812
|
+
* plus its tool result, so the model starts the run with the skill's guidance
|
|
1813
|
+
* and tools already bound instead of having to discover them. Unknown or
|
|
1814
|
+
* unavailable keys are skipped. Ignored when the agent has no `skills`.
|
|
1815
|
+
*/
|
|
1816
|
+
preopenedSkills?: string[];
|
|
1778
1817
|
};
|
|
1779
1818
|
type SnapshotRuntimeHint = {
|
|
1780
1819
|
name?: string;
|
|
@@ -1865,8 +1904,13 @@ declare function createTool({ name, description, schema, func, needsApproval, ap
|
|
|
1865
1904
|
description?: string;
|
|
1866
1905
|
schema: ZodSchema;
|
|
1867
1906
|
func: SmartToolFn;
|
|
1868
|
-
|
|
1869
|
-
|
|
1907
|
+
/**
|
|
1908
|
+
* `true` gates every call; a predicate gates the calls whose ARGUMENTS
|
|
1909
|
+
* warrant it. See ToolApprovalPredicate.
|
|
1910
|
+
*/
|
|
1911
|
+
needsApproval?: boolean | ToolApprovalPredicate;
|
|
1912
|
+
/** A function form receives the call's arguments, so the prompt can quote them. */
|
|
1913
|
+
approvalPrompt?: string | ((args: any) => string | undefined);
|
|
1870
1914
|
approvalDefaults?: any;
|
|
1871
1915
|
maxExecutionsPerRun?: number | null;
|
|
1872
1916
|
/** When set, identical args within the same invoke short-circuit to the cached result. */
|
|
@@ -2108,6 +2152,56 @@ declare function parseSkillFrontmatter(md: string): SkillFrontmatter;
|
|
|
2108
2152
|
*/
|
|
2109
2153
|
declare function loadSkillsFromDisk(opts: LoadSkillsOptions): Promise<Skill[]>;
|
|
2110
2154
|
|
|
2155
|
+
/**
|
|
2156
|
+
* Deterministic pre-opening of skills at the start of an invoke.
|
|
2157
|
+
*
|
|
2158
|
+
* Some skills must not depend on the model choosing to discover them — an
|
|
2159
|
+
* organization policy, or the integration a scheduled run is about. Those keys
|
|
2160
|
+
* are passed per-invoke (`InvokeConfig.preopenedSkills`) and opened here BEFORE
|
|
2161
|
+
* the first model call, by invoking the very same `open_skill` tool the model
|
|
2162
|
+
* would have called. The run then continues normally: the skill's tools are
|
|
2163
|
+
* bound in the registry and `bind_skill_tools` can still widen the surface.
|
|
2164
|
+
*
|
|
2165
|
+
* The opening is written into the transcript as a real tool exchange (one
|
|
2166
|
+
* assistant message carrying the tool calls, then one tool message per call),
|
|
2167
|
+
* because that is the shape the model is trained on and the shape the rest of
|
|
2168
|
+
* the runtime — summarization, retention, `get_tool_response` — already
|
|
2169
|
+
* understands. Tool call ids are derived from the skill key rather than random,
|
|
2170
|
+
* so the same preopen set produces a byte-identical prefix on every run and the
|
|
2171
|
+
* provider-side prompt cache keeps hitting.
|
|
2172
|
+
*/
|
|
2173
|
+
declare const PREOPEN_TOOL_CALL_PREFIX = "preopen_skill_";
|
|
2174
|
+
type PreopenSkillsResult = {
|
|
2175
|
+
/** Synthetic transcript entries to append after the user message. */
|
|
2176
|
+
messages: BaseMessage[];
|
|
2177
|
+
/** Tool-history rows mirroring the synthetic calls. */
|
|
2178
|
+
toolHistory: NonNullable<AgentState["toolHistory"]>;
|
|
2179
|
+
/** Skill keys actually opened (available, resolved, not already open). */
|
|
2180
|
+
openedKeys: string[];
|
|
2181
|
+
/** Keys that were requested but could not be opened, with the reason. */
|
|
2182
|
+
skipped: Array<{
|
|
2183
|
+
skillKey: string;
|
|
2184
|
+
reason: string;
|
|
2185
|
+
}>;
|
|
2186
|
+
};
|
|
2187
|
+
/** Tool call ids must survive provider id charset rules; skill keys contain ':'. */
|
|
2188
|
+
declare function preopenToolCallId(skillKey: string): string;
|
|
2189
|
+
/**
|
|
2190
|
+
* Open the requested skills through the real `open_skill` tool and return the
|
|
2191
|
+
* transcript + tool-history entries that describe the exchange. Binding side
|
|
2192
|
+
* effects (registry mutation + `__onToolsChanged`) happen inside the tool, so
|
|
2193
|
+
* the caller only has to merge the returned messages/history into its state.
|
|
2194
|
+
*/
|
|
2195
|
+
declare function preopenSkills(input: {
|
|
2196
|
+
skillKeys: string[];
|
|
2197
|
+
tools: ToolInterface[];
|
|
2198
|
+
/** Keys already open on the registry — a resumed run must not re-open them. */
|
|
2199
|
+
alreadyOpenedKeys?: string[];
|
|
2200
|
+
/** Existing transcript, used to keep the injection idempotent across resumes. */
|
|
2201
|
+
existingMessages?: BaseMessage[];
|
|
2202
|
+
onEvent?: (event: SmartAgentEvent) => void;
|
|
2203
|
+
}): Promise<PreopenSkillsResult>;
|
|
2204
|
+
|
|
2111
2205
|
/**
|
|
2112
2206
|
* Pure registry helpers for the sub-agent primitive. No I/O, no agent loop —
|
|
2113
2207
|
* the deterministic core, fully unit-testable on its own.
|
|
@@ -3335,4 +3429,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
3335
3429
|
*/
|
|
3336
3430
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
3337
3431
|
|
|
3338
|
-
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, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
3432
|
+
export { type AIMessage, ASK_USER_TOOL_NAME, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, type AudioContent, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type CompressToolOutputParams, type ContextPilotCCRConfig, type ContextPilotCacheAlignmentConfig, type ContextPilotCompressionConfig, type ContextPilotCompressionStats, type ContextPilotCompressorKind, type ContextPilotConfig, type ContextPilotDedupConfig, type ContextPilotDiffCompressionConfig, type ContextPilotJsonCompressionConfig, type ContextPilotLogCompressionConfig, type ContextPilotResult, type ContextPilotRuntime, type ContextPilotSearchCompressionConfig, type ContextPilotTextCompressionConfig, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, type FileContent, type FinalAnswerEvent, type FinishReason, type GuardrailContext, type GuardrailDisposition, type GuardrailEvent, type GuardrailIncident, type GuardrailOutcome, GuardrailPhase, type GuardrailRule, type HandoffDescriptor, type HandoffEvent, type HumanInTheLoopAskUserConfig, type HumanInTheLoopOptions, type HumanInTheLoopRuntimeConfig, type ImageContent, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, type LoadSkillsOptions, type MemoryFact, type MemoryProviderKind, type MemoryReadPolicy, type MemoryScope, type MemoryStore, type MemoryWritePolicy, type Message, type MetadataEvent, type ModelCapabilities, NativeJsonSchemaStrategy, type NativeModelOptions, type NativeReasoningConfig, OpenAICompatibleProvider, type OpenAICompatibleProviderConfig, OpenAIProvider, type OpenAIProviderConfig, PREOPEN_TOOL_CALL_PREFIX, type PendingToolApproval, type PendingUserQuestion, type PlanEvent, type PlanStepRecord, type PlanningMode, type PreopenSkillsResult, type ProfileConfig, type ProgressEvent, type ProgressUpdate, type PromptHooks, type ProviderConfig, ProviderError, type ToolCall as ProviderToolCall, type ToolDefinition as ProviderToolDefinition, type ProviderType, type ReasoningConfig, type ReasoningLevel, type ReflectionCadence, type ReflectionConfig, type ReflectionEvent, type ReflectionHookContext, type ReflectionRecord, type RegexGuardrailOptions, type RegexRuleOptions, type ReplanPolicy, type ResolvedContextPilotConfig, type ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, type SkillDisclosure, type SkillExecutionContext, type SkillFrontmatter, type SkillFs, type SkillModelTier, type SkillPolicy, type SkillRegistryRef, type SkillToolDeps, type SkillToolHeader, type SmartAgentBudgetConfig, type SmartAgentContextConfig, type SmartAgentCustomProfileConfig, type SmartAgentDelegationConfig, type SmartAgentEvent, type SmartAgentInstance, type SmartAgentLimits, type SmartAgentMemoryConfig, type SmartAgentOptions, type SmartAgentPlanningConfig, type SmartAgentSummarizationConfig, type SmartAgentToolResponseConfig, type SmartAgentTracingConfig, type SmartModel, type SmartState, type SmartToolFn, type SnapshotOptions, type SnapshotRuntimeHint, type StreamChunk, type StreamEvent, type StructuredOutputError, type StructuredOutputFieldError, StructuredOutputManager, type StructuredOutputManagerConfig, type StructuredOutputResult, type StructuredOutputStrategy, type StructuredSummary, type SubagentDef, type SubagentEvent, type SubagentMode, type SubagentPendingRecord, type SubagentPolicy, type SubagentRegistryRef, type SubagentResult, type SubagentToolDeps, type SubagentToolNames, type SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, TOOL_INPUT_DIGEST_KEY, type TextContent, type TokenCounter, type TokenUsage, type ToolApprovalEvent, type ToolApprovalResolution, type ToolApprovalStatus, ToolBasedStrategy, type ToolCachePolicy, type ToolCallEvent, type ToolInputDigestOptions, type ToolInputDigestResult, type ToolInputRetentionPolicy, type ToolInterface, type ToolResponseClassification, type ToolResponseRetentionPolicy, type ToolRetentionDeclarations, type ToolRetentionSpec, type ToolRetryPolicy, type TraceDataSection, type TraceErrorRecord, type TraceEventRecord, type TraceMessageSection, type TraceMetadataSection, type TraceSessionConfigSnapshot, type TraceSessionFile, type TraceSessionStatus, type TraceSessionSummary, type TraceSinkCognipeerConfig, type TraceSinkConfig, type TraceSinkCustomConfig, type TraceSinkFileConfig, type TraceSinkHttpConfig, type TraceSinkOtlpConfig, type TraceSinkSnapshot, type TraceSummarySection, type TraceToolCallSection, type 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, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
package/dist/index.mjs
CHANGED
|
@@ -424,7 +424,7 @@ function createTool({
|
|
|
424
424
|
run: execute,
|
|
425
425
|
func: execute
|
|
426
426
|
};
|
|
427
|
-
if (typeof needsApproval === "boolean") {
|
|
427
|
+
if (typeof needsApproval === "function" || typeof needsApproval === "boolean") {
|
|
428
428
|
toolRecord.needsApproval = needsApproval;
|
|
429
429
|
}
|
|
430
430
|
if (approvalPrompt !== void 0) {
|
|
@@ -3473,6 +3473,29 @@ function selectPendingToolCalls(messages) {
|
|
|
3473
3473
|
}
|
|
3474
3474
|
|
|
3475
3475
|
// src/nodes/tools.ts
|
|
3476
|
+
function resolveNeedsApproval(tool, args) {
|
|
3477
|
+
const spec = tool?.needsApproval;
|
|
3478
|
+
if (typeof spec === "function") {
|
|
3479
|
+
try {
|
|
3480
|
+
return Boolean(spec(args));
|
|
3481
|
+
} catch {
|
|
3482
|
+
return true;
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
return Boolean(spec);
|
|
3486
|
+
}
|
|
3487
|
+
function resolveApprovalPrompt(tool, args) {
|
|
3488
|
+
const prompt = tool?.approvalPrompt;
|
|
3489
|
+
if (typeof prompt === "function") {
|
|
3490
|
+
try {
|
|
3491
|
+
const resolved = prompt(args);
|
|
3492
|
+
return typeof resolved === "string" && resolved.length > 0 ? resolved : void 0;
|
|
3493
|
+
} catch {
|
|
3494
|
+
return void 0;
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
return typeof prompt === "string" ? prompt : void 0;
|
|
3498
|
+
}
|
|
3476
3499
|
function normalizeMaxExecutionsPerRun(value) {
|
|
3477
3500
|
if (value === null || value === void 0 || value === "") return null;
|
|
3478
3501
|
const parsed = Number(value);
|
|
@@ -3519,10 +3542,13 @@ function buildToolDetails(tool, toolName) {
|
|
|
3519
3542
|
}
|
|
3520
3543
|
const inputSchema = normalizeToolSchema(tool, toolName);
|
|
3521
3544
|
if (inputSchema !== void 0) details.inputSchema = inputSchema;
|
|
3522
|
-
const
|
|
3523
|
-
|
|
3545
|
+
const approvalSpec = tool.needsApproval;
|
|
3546
|
+
const needsApproval = typeof approvalSpec === "boolean" ? approvalSpec : void 0;
|
|
3547
|
+
const conditionalApproval = typeof approvalSpec === "function" ? true : void 0;
|
|
3548
|
+
if (needsApproval !== void 0 || conditionalApproval !== void 0 || tool.approvalPrompt !== void 0 || tool.approvalDefaults !== void 0) {
|
|
3524
3549
|
details.approval = {
|
|
3525
3550
|
required: needsApproval,
|
|
3551
|
+
conditional: conditionalApproval,
|
|
3526
3552
|
prompt: typeof tool.approvalPrompt === "string" ? tool.approvalPrompt : void 0,
|
|
3527
3553
|
defaults: tool.approvalDefaults !== void 0 ? sanitizeTracePayload(tool.approvalDefaults) : void 0
|
|
3528
3554
|
};
|
|
@@ -3747,7 +3773,7 @@ function createToolsNode(initialTools, opts) {
|
|
|
3747
3773
|
}
|
|
3748
3774
|
}
|
|
3749
3775
|
let approvalEntry = pendingByCallId.get(toolCallId);
|
|
3750
|
-
const needsApproval =
|
|
3776
|
+
const needsApproval = resolveNeedsApproval(tool, args);
|
|
3751
3777
|
if (needsApproval) {
|
|
3752
3778
|
if (!approvalEntry) {
|
|
3753
3779
|
approvalEntry = {
|
|
@@ -3757,7 +3783,7 @@ function createToolsNode(initialTools, opts) {
|
|
|
3757
3783
|
args,
|
|
3758
3784
|
status: "pending",
|
|
3759
3785
|
requestedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3760
|
-
metadata: tool
|
|
3786
|
+
metadata: resolveApprovalPrompt(tool, args) !== void 0 || tool.approvalDefaults !== void 0 ? { prompt: resolveApprovalPrompt(tool, args), defaults: tool.approvalDefaults } : void 0
|
|
3761
3787
|
};
|
|
3762
3788
|
pendingApprovals.push(approvalEntry);
|
|
3763
3789
|
pendingByCallId.set(toolCallId, approvalEntry);
|
|
@@ -7546,6 +7572,127 @@ function createSkillTools(deps) {
|
|
|
7546
7572
|
if (isSearchDisclosure(deps.policy)) tools.unshift(createSearchSkillsTool(deps));
|
|
7547
7573
|
return tools;
|
|
7548
7574
|
}
|
|
7575
|
+
var PREOPEN_TOOL_CALL_PREFIX = "preopen_skill_";
|
|
7576
|
+
var OPEN_SKILL_TOOL_NAME = "open_skill";
|
|
7577
|
+
function preopenToolCallId(skillKey) {
|
|
7578
|
+
return `${PREOPEN_TOOL_CALL_PREFIX}${skillKey.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
7579
|
+
}
|
|
7580
|
+
function messagesContainCallId(messages, callId) {
|
|
7581
|
+
if (!Array.isArray(messages)) return false;
|
|
7582
|
+
return messages.some((message) => {
|
|
7583
|
+
const calls = message?.tool_calls;
|
|
7584
|
+
return Array.isArray(calls) && calls.some((call) => call?.id === callId);
|
|
7585
|
+
});
|
|
7586
|
+
}
|
|
7587
|
+
function serializeToolContent(result) {
|
|
7588
|
+
if (typeof result === "string") return result;
|
|
7589
|
+
try {
|
|
7590
|
+
return JSON.stringify(result);
|
|
7591
|
+
} catch {
|
|
7592
|
+
return String(result);
|
|
7593
|
+
}
|
|
7594
|
+
}
|
|
7595
|
+
async function preopenSkills(input) {
|
|
7596
|
+
const empty = { messages: [], toolHistory: [], openedKeys: [], skipped: [] };
|
|
7597
|
+
const requested = [...new Set(
|
|
7598
|
+
(input.skillKeys ?? []).map((key) => String(key ?? "").trim()).filter(Boolean)
|
|
7599
|
+
)];
|
|
7600
|
+
if (requested.length === 0) return empty;
|
|
7601
|
+
const openSkillTool = input.tools.find((tool) => tool?.name === OPEN_SKILL_TOOL_NAME);
|
|
7602
|
+
if (!openSkillTool) {
|
|
7603
|
+
return { ...empty, skipped: requested.map((skillKey) => ({ skillKey, reason: "open_skill tool is not wired" })) };
|
|
7604
|
+
}
|
|
7605
|
+
const alreadyOpen = new Set(input.alreadyOpenedKeys ?? []);
|
|
7606
|
+
const toolCalls = [];
|
|
7607
|
+
const toolMessages = [];
|
|
7608
|
+
const toolHistory = [];
|
|
7609
|
+
const openedKeys = [];
|
|
7610
|
+
const skipped = [];
|
|
7611
|
+
for (const skillKey of requested) {
|
|
7612
|
+
const toolCallId = preopenToolCallId(skillKey);
|
|
7613
|
+
if (alreadyOpen.has(skillKey) || messagesContainCallId(input.existingMessages, toolCallId)) {
|
|
7614
|
+
skipped.push({ skillKey, reason: "already open" });
|
|
7615
|
+
continue;
|
|
7616
|
+
}
|
|
7617
|
+
const args = { skillKey };
|
|
7618
|
+
input.onEvent?.({ type: "tool_call", phase: "start", name: OPEN_SKILL_TOOL_NAME, id: toolCallId, args });
|
|
7619
|
+
const start = Date.now();
|
|
7620
|
+
let result;
|
|
7621
|
+
try {
|
|
7622
|
+
result = await openSkillTool.invoke(args);
|
|
7623
|
+
} catch (error) {
|
|
7624
|
+
const message = error instanceof Error ? error.message : "open_skill failed";
|
|
7625
|
+
input.onEvent?.({
|
|
7626
|
+
type: "tool_call",
|
|
7627
|
+
phase: "error",
|
|
7628
|
+
name: OPEN_SKILL_TOOL_NAME,
|
|
7629
|
+
id: toolCallId,
|
|
7630
|
+
args,
|
|
7631
|
+
error: { message },
|
|
7632
|
+
durationMs: Date.now() - start
|
|
7633
|
+
});
|
|
7634
|
+
skipped.push({ skillKey, reason: message });
|
|
7635
|
+
continue;
|
|
7636
|
+
}
|
|
7637
|
+
const durationMs = Date.now() - start;
|
|
7638
|
+
if (result && typeof result === "object" && typeof result.error === "string") {
|
|
7639
|
+
input.onEvent?.({
|
|
7640
|
+
type: "tool_call",
|
|
7641
|
+
phase: "skipped",
|
|
7642
|
+
name: OPEN_SKILL_TOOL_NAME,
|
|
7643
|
+
id: toolCallId,
|
|
7644
|
+
args,
|
|
7645
|
+
error: { message: result.error },
|
|
7646
|
+
durationMs
|
|
7647
|
+
});
|
|
7648
|
+
skipped.push({ skillKey, reason: result.error });
|
|
7649
|
+
continue;
|
|
7650
|
+
}
|
|
7651
|
+
if (result && typeof result === "object") delete result.__runtimeToolsDelta;
|
|
7652
|
+
toolCalls.push({
|
|
7653
|
+
id: toolCallId,
|
|
7654
|
+
type: "function",
|
|
7655
|
+
function: { name: OPEN_SKILL_TOOL_NAME, arguments: JSON.stringify(args) }
|
|
7656
|
+
});
|
|
7657
|
+
toolMessages.push({
|
|
7658
|
+
role: "tool",
|
|
7659
|
+
name: OPEN_SKILL_TOOL_NAME,
|
|
7660
|
+
tool_call_id: toolCallId,
|
|
7661
|
+
content: serializeToolContent(result)
|
|
7662
|
+
});
|
|
7663
|
+
toolHistory.push({
|
|
7664
|
+
executionId: nanoid(),
|
|
7665
|
+
toolName: OPEN_SKILL_TOOL_NAME,
|
|
7666
|
+
args,
|
|
7667
|
+
output: result,
|
|
7668
|
+
rawOutput: result,
|
|
7669
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7670
|
+
tool_call_id: toolCallId,
|
|
7671
|
+
summarized: false,
|
|
7672
|
+
retentionPolicy: "keep_full",
|
|
7673
|
+
status: "success"
|
|
7674
|
+
});
|
|
7675
|
+
openedKeys.push(skillKey);
|
|
7676
|
+
input.onEvent?.({
|
|
7677
|
+
type: "tool_call",
|
|
7678
|
+
phase: "success",
|
|
7679
|
+
name: OPEN_SKILL_TOOL_NAME,
|
|
7680
|
+
id: toolCallId,
|
|
7681
|
+
args,
|
|
7682
|
+
result,
|
|
7683
|
+
durationMs
|
|
7684
|
+
});
|
|
7685
|
+
}
|
|
7686
|
+
if (toolCalls.length === 0) {
|
|
7687
|
+
return { ...empty, skipped };
|
|
7688
|
+
}
|
|
7689
|
+
const assistantMessage = {
|
|
7690
|
+
role: "assistant",
|
|
7691
|
+
content: `Opening the ${openedKeys.join(", ")} skill${openedKeys.length > 1 ? "s" : ""} required for this task.`,
|
|
7692
|
+
tool_calls: toolCalls
|
|
7693
|
+
};
|
|
7694
|
+
return { messages: [assistantMessage, ...toolMessages], toolHistory, openedKeys, skipped };
|
|
7695
|
+
}
|
|
7549
7696
|
|
|
7550
7697
|
// src/smart/subagents/types.ts
|
|
7551
7698
|
var DEFAULT_SUBAGENT_POLICY = {
|
|
@@ -8252,7 +8399,25 @@ function createSmartAgent(opts) {
|
|
|
8252
8399
|
const disclosureBlock = [skillBlock, subagentBlock].filter(Boolean).join("\n\n") || void 0;
|
|
8253
8400
|
const alreadyHasSystem = Array.isArray(input.messages) && input.messages[0]?.role === "system";
|
|
8254
8401
|
const seedMessages = alreadyHasSystem ? [...input.messages || []] : [systemMessage2(disclosureBlock), ...input.messages || []];
|
|
8255
|
-
let
|
|
8402
|
+
let seedToolHistory = input.toolHistory;
|
|
8403
|
+
if (skillsEnabled && toolSet.skillRegistryRef) {
|
|
8404
|
+
const preopenKeys = config?.preopenedSkills ?? [];
|
|
8405
|
+
if (preopenKeys.length > 0) {
|
|
8406
|
+
const preopened = await preopenSkills({
|
|
8407
|
+
skillKeys: preopenKeys,
|
|
8408
|
+
tools: toolSet.toolsWithoutRecovery,
|
|
8409
|
+
alreadyOpenedKeys: toolSet.skillRegistryRef.openedSkillKeys,
|
|
8410
|
+
existingMessages: seedMessages,
|
|
8411
|
+
onEvent: config?.onEvent ?? opts.onEvent
|
|
8412
|
+
});
|
|
8413
|
+
if (preopened.messages.length > 0) {
|
|
8414
|
+
seedMessages.push(...preopened.messages);
|
|
8415
|
+
seedToolHistory = [...seedToolHistory ?? [], ...preopened.toolHistory];
|
|
8416
|
+
stateRef.toolHistory = seedToolHistory;
|
|
8417
|
+
}
|
|
8418
|
+
}
|
|
8419
|
+
}
|
|
8420
|
+
let state = syncRuntimeTools(await syncMemory({ ...input, messages: seedMessages, toolHistory: seedToolHistory }), seedMessages, toolSet);
|
|
8256
8421
|
let lastResult = null;
|
|
8257
8422
|
let rawMessages = [...seedMessages];
|
|
8258
8423
|
const effectiveMaxToolCalls = config?.limits?.maxToolCalls ?? resolved.limits.maxToolCalls ?? 10;
|
|
@@ -11513,6 +11678,6 @@ function createProvider(config) {
|
|
|
11513
11678
|
}
|
|
11514
11679
|
}
|
|
11515
11680
|
|
|
11516
|
-
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11681
|
+
export { ASK_USER_TOOL_NAME, AnthropicProvider, AzureProvider, BaseProvider, BedrockProvider, CCRStore, CONTEXT_PILOT_JSON_MARKER_KEY, CONTROL_PLANE_TOOL_NAMES, DEFAULT_MAX_TOOL_INPUT_FIELD_CHARS, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, DEFAULT_TOOL_INPUT_DIGEST_HEAD_CHARS, DELEGATION_TOOL_NAMES, DedupTracker, GuardrailPhase, InMemoryMemoryStore, NativeJsonSchemaStrategy, OpenAICompatibleProvider, OpenAIProvider, PREOPEN_TOOL_CALL_PREFIX, ProviderError, SMALL_TIER_SKILL_POLICY, StructuredOutputManager, TOOL_INPUT_DIGEST_KEY, ToolBasedStrategy, VertexProvider, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, coerceToolArgs, cognipeerSink, collectToolRetentionDeclarations, composeToolSets, compressDiffOutput, compressJsonOutput, compressLogOutput, compressSearchOutput, compressTextOutput, compressToolOutput, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextPilotRuntime, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSearchSkillsTool, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, detectTextFormat, detectVolatileContent, digestToolInputArguments, digestToolInputValue, emptyUsage, evaluateGuardrails, extractLatestUserQuery, fileSink, findSubagent, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, loadSkillsFromDisk, normalizeSmartAgentOptions, otlpSink, parseSkillFrontmatter, preopenSkills, preopenToolCallId, readMemoryFacts, regexRule, resolveAvailableSkills, resolveAvailableSubagents, resolveInputRetention, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveSubagentTools, resolveSummarizationRetention, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, scoreItemsByRelevance, searchSkills, seedChildMessages, selectTopIndicesInOrder, setTokenCounter, startStreamingSession, summarizeObject, tokenize, traceSessionToOtlp, validateReasoningConfig, validateToolArgs, withTools, withinDepth, writeSummaryFactsToMemory };
|
|
11517
11682
|
//# sourceMappingURL=index.mjs.map
|
|
11518
11683
|
//# sourceMappingURL=index.mjs.map
|