@cognipeer/agent-sdk 0.7.3 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/index.cjs +884 -138
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +352 -28
- package/dist/index.d.ts +352 -28
- package/dist/index.mjs +869 -139
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,136 @@ declare function withTools(model: SmartModel, tools: any[], options?: {
|
|
|
107
107
|
}): BaseChatModel;
|
|
108
108
|
declare function fromLangchainModel(lcModel: any): BaseChatModel;
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Sub-agent primitive — dynamic problem-solving by delegating self-contained
|
|
112
|
+
* subtasks to focused child agents.
|
|
113
|
+
*
|
|
114
|
+
* Two complementary disclosure modes (hybrid by default):
|
|
115
|
+
* - **Registry** — predefined, named sub-agents (`delegate_to(name, input)`).
|
|
116
|
+
* - **Ad-hoc** — the orchestrator writes a role + prompt + tool subset at
|
|
117
|
+
* runtime (`spawn_subagent({ role, prompt, input, tools })`).
|
|
118
|
+
* - **Parallel** — fan out independent subtasks concurrently
|
|
119
|
+
* (`spawn_subagents_parallel({ tasks })`).
|
|
120
|
+
*
|
|
121
|
+
* The primitive reuses the existing delegation guards (depth / child-call
|
|
122
|
+
* budget / context policy) and forwards events, streaming, cancellation and
|
|
123
|
+
* tracing from the parent run into each child. Model-agnostic: a child uses its
|
|
124
|
+
* own `model` override when given, otherwise the parent's model.
|
|
125
|
+
*/
|
|
126
|
+
/** A predefined sub-agent the orchestrator can invoke by name. */
|
|
127
|
+
type SubagentDef = {
|
|
128
|
+
/** Stable id used by `delegate_to`. */
|
|
129
|
+
name: string;
|
|
130
|
+
/** Human-friendly title (defaults to `name`). */
|
|
131
|
+
title?: string;
|
|
132
|
+
/** One-line "what + when to use" shown in the `<available_subagents>` catalog. */
|
|
133
|
+
header: string;
|
|
134
|
+
/**
|
|
135
|
+
* Role / system prompt for the child agent. This is fully under your control
|
|
136
|
+
* — it is the per-sub-agent prompt-override surface.
|
|
137
|
+
*/
|
|
138
|
+
systemPrompt?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Tool surface for the child:
|
|
141
|
+
* - `ToolInterface[]` — explicit tools.
|
|
142
|
+
* - `string[]` — names resolved against the PARENT's live tool set.
|
|
143
|
+
* - function — built lazily at spawn time.
|
|
144
|
+
* When omitted the child runs tool-free (pure reasoning).
|
|
145
|
+
*/
|
|
146
|
+
tools?: ToolInterface[] | string[] | (() => ToolInterface[] | Promise<ToolInterface[]>);
|
|
147
|
+
/** Optional model override. Defaults to the parent agent's model (model-agnostic). */
|
|
148
|
+
model?: any;
|
|
149
|
+
/** Optional JSON output contract for the child. */
|
|
150
|
+
outputSchema?: ZodSchema<any>;
|
|
151
|
+
/** Optional per-child limits override. */
|
|
152
|
+
limits?: AgentLimits;
|
|
153
|
+
/** Override the parent policy's context-seeding behaviour for this sub-agent. */
|
|
154
|
+
childContextPolicy?: ChildContextPolicy;
|
|
155
|
+
/** Gate: hide this sub-agent from the catalog when it returns false. */
|
|
156
|
+
isAvailable?: () => boolean | Promise<boolean>;
|
|
157
|
+
/** Free-form metadata surfaced on `subagent` events. */
|
|
158
|
+
metadata?: Record<string, any>;
|
|
159
|
+
};
|
|
160
|
+
type SubagentMode = "off" | "registry_only" | "registry_and_adhoc";
|
|
161
|
+
type SubagentPolicy = {
|
|
162
|
+
/** `registry_and_adhoc` (default) enables both named + ad-hoc spawning. */
|
|
163
|
+
mode: SubagentMode;
|
|
164
|
+
/** Max nesting depth. Shares the delegation depth counter. */
|
|
165
|
+
maxDepth: number;
|
|
166
|
+
/** Total spawn budget per run (across delegate_to + spawn + parallel). */
|
|
167
|
+
maxChildCalls: number;
|
|
168
|
+
/** Fan-out width for `spawn_subagents_parallel`. */
|
|
169
|
+
maxParallel: number;
|
|
170
|
+
/** Default context seeding for children. Overridable per-`SubagentDef`. */
|
|
171
|
+
childContextPolicy: ChildContextPolicy;
|
|
172
|
+
/** Whether ad-hoc spawns may reference the parent's tools by name. */
|
|
173
|
+
allowAdhocTools: boolean;
|
|
174
|
+
};
|
|
175
|
+
declare const DEFAULT_SUBAGENT_POLICY: SubagentPolicy;
|
|
176
|
+
/** Result of a single sub-agent run (returned to the model as the tool result). */
|
|
177
|
+
type SubagentResult = {
|
|
178
|
+
/** Sub-agent name (registry) or role (ad-hoc). */
|
|
179
|
+
name: string;
|
|
180
|
+
mode: "registry" | "adhoc";
|
|
181
|
+
/** The input the sub-agent was tasked with. */
|
|
182
|
+
input: string;
|
|
183
|
+
/** Final assistant content from the child. */
|
|
184
|
+
content?: string;
|
|
185
|
+
/** Parsed structured output, when the child had an `outputSchema`. */
|
|
186
|
+
output?: any;
|
|
187
|
+
/** Latest child summary, when summarization fired. */
|
|
188
|
+
summary?: string;
|
|
189
|
+
/** Populated when the child failed or was refused by a guard. */
|
|
190
|
+
error?: string;
|
|
191
|
+
durationMs?: number;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* Mutable per-invoke registry. Records spawn budget usage and completed
|
|
195
|
+
* results. Mirrors the SkillRegistryRef pattern. The durable child-pause state
|
|
196
|
+
* (for HITL resume) lives in `state.ctx.__subagentPending`, NOT here, so it
|
|
197
|
+
* survives the parent invoke boundary.
|
|
198
|
+
*/
|
|
199
|
+
type SubagentRegistryRef = {
|
|
200
|
+
/** Cumulative spawns this run (delegate + adhoc + each parallel child). */
|
|
201
|
+
spawnedCount: number;
|
|
202
|
+
/** Completed results, in completion order. */
|
|
203
|
+
results: SubagentResult[];
|
|
204
|
+
};
|
|
205
|
+
declare function createSubagentRegistryRef(): SubagentRegistryRef;
|
|
206
|
+
/**
|
|
207
|
+
* Durable per-tool-call pause record, stored in `state.ctx.__subagentPending`
|
|
208
|
+
* so a child that paused for human input (approval / ask-user) can be resumed
|
|
209
|
+
* after the host answers at the parent level. Only data — no functions — so it
|
|
210
|
+
* survives snapshot serialization for the in-memory resume path.
|
|
211
|
+
*/
|
|
212
|
+
type SubagentPendingRecord = {
|
|
213
|
+
/** Parent tool_call id that owns this paused child. */
|
|
214
|
+
parentToolCallId: string;
|
|
215
|
+
/** Sub-agent name / role. */
|
|
216
|
+
name: string;
|
|
217
|
+
mode: "registry" | "adhoc";
|
|
218
|
+
/** Ad-hoc spec (role/prompt/tools/input) to rebuild the child agent. */
|
|
219
|
+
adhoc?: {
|
|
220
|
+
role: string;
|
|
221
|
+
prompt?: string;
|
|
222
|
+
toolNames?: string[];
|
|
223
|
+
outputContract?: string;
|
|
224
|
+
};
|
|
225
|
+
/** The task input the child was running. */
|
|
226
|
+
input: string;
|
|
227
|
+
/** Serializable child SmartState (agent omitted) to restore + resume. */
|
|
228
|
+
childState: any;
|
|
229
|
+
/** Maps the child's pending approval/question id -> parent-surfaced id. */
|
|
230
|
+
pendingKind: "approval" | "user_question";
|
|
231
|
+
pendingId: string;
|
|
232
|
+
};
|
|
233
|
+
type SubagentToolNames = {
|
|
234
|
+
delegate: string;
|
|
235
|
+
spawn: string;
|
|
236
|
+
parallel: string;
|
|
237
|
+
};
|
|
238
|
+
declare const DEFAULT_SUBAGENT_TOOL_NAMES: SubagentToolNames;
|
|
239
|
+
|
|
110
240
|
/**
|
|
111
241
|
* Skill primitive — progressive capability disclosure for the smart agent.
|
|
112
242
|
*
|
|
@@ -651,6 +781,48 @@ type SmartAgentOptions = {
|
|
|
651
781
|
skills?: Skill[];
|
|
652
782
|
/** Caps/tiering for skill disclosure. Defaults to DEFAULT_SKILL_POLICY. */
|
|
653
783
|
skillPolicy?: SkillPolicy;
|
|
784
|
+
/**
|
|
785
|
+
* Sub-agents for dynamic problem decomposition. When provided (or when
|
|
786
|
+
* `subagentPolicy.mode` enables ad-hoc spawning), the agent exposes
|
|
787
|
+
* `delegate_to` / `spawn_subagent` / `spawn_subagents_parallel` tools and a
|
|
788
|
+
* `<available_subagents>` catalog in its system prompt. Children inherit the
|
|
789
|
+
* parent model (unless a `SubagentDef.model` override is given), and the
|
|
790
|
+
* parent's event/streaming/cancellation/trace wiring.
|
|
791
|
+
*/
|
|
792
|
+
subagents?: SubagentDef[];
|
|
793
|
+
/** Caps/modes for sub-agent spawning. Defaults to DEFAULT_SUBAGENT_POLICY. */
|
|
794
|
+
subagentPolicy?: SubagentPolicy;
|
|
795
|
+
/**
|
|
796
|
+
* Hooks to intercept/override the SDK's otherwise-static prompt surfaces:
|
|
797
|
+
* the composed system prompt, built-in tool descriptions, and the sub-agent
|
|
798
|
+
* catalog block. See {@link PromptHooks}.
|
|
799
|
+
*/
|
|
800
|
+
promptHooks?: PromptHooks;
|
|
801
|
+
};
|
|
802
|
+
/**
|
|
803
|
+
* Override points for the SDK's built-in (otherwise static) prompt surfaces.
|
|
804
|
+
* Every hook is optional and additive — when omitted the defaults are used.
|
|
805
|
+
*/
|
|
806
|
+
type PromptHooks = {
|
|
807
|
+
/**
|
|
808
|
+
* Transform the fully-composed system prompt right before it is sent. Receives
|
|
809
|
+
* the default prompt and returns the prompt to use.
|
|
810
|
+
*/
|
|
811
|
+
transformSystemPrompt?: (prompt: string, ctx: {
|
|
812
|
+
agentName: string;
|
|
813
|
+
}) => string;
|
|
814
|
+
/**
|
|
815
|
+
* Override built-in tool descriptions by tool name (e.g. `delegate_to`,
|
|
816
|
+
* `spawn_subagent`, `spawn_subagents_parallel`, `open_skill`,
|
|
817
|
+
* `ask_user_question`). A string replaces the description; a function receives
|
|
818
|
+
* the default and returns the replacement.
|
|
819
|
+
*/
|
|
820
|
+
toolDescriptions?: Record<string, string | ((defaultDescription: string) => string)>;
|
|
821
|
+
/**
|
|
822
|
+
* Override the `<available_subagents>` catalog block. Receives the default
|
|
823
|
+
* block and the active sub-agent definitions.
|
|
824
|
+
*/
|
|
825
|
+
subagentCatalog?: (defaultBlock: string, subagents: SubagentDef[]) => string;
|
|
654
826
|
};
|
|
655
827
|
type AgentRuntimeConfig = {
|
|
656
828
|
name?: string;
|
|
@@ -1285,7 +1457,43 @@ type GuardrailEvent = {
|
|
|
1285
1457
|
reason?: string;
|
|
1286
1458
|
details?: Record<string, any>;
|
|
1287
1459
|
};
|
|
1288
|
-
type
|
|
1460
|
+
type SubagentEvent = {
|
|
1461
|
+
type: "subagent";
|
|
1462
|
+
/** Lifecycle phase of a delegated sub-agent run. */
|
|
1463
|
+
phase: "start" | "result" | "error" | "paused";
|
|
1464
|
+
/** Sub-agent name (registry) or role (ad-hoc). */
|
|
1465
|
+
name: string;
|
|
1466
|
+
/** Unique per-spawn id. */
|
|
1467
|
+
id: string;
|
|
1468
|
+
mode: "registry" | "adhoc";
|
|
1469
|
+
/** Parent tool_call id that owns this sub-agent. */
|
|
1470
|
+
parentToolCallId?: string;
|
|
1471
|
+
/** True when spawned inside `spawn_subagents_parallel`. */
|
|
1472
|
+
parallel?: boolean;
|
|
1473
|
+
/** Task input (on `start`). */
|
|
1474
|
+
input?: string;
|
|
1475
|
+
/** Final content (on `result`). */
|
|
1476
|
+
content?: string;
|
|
1477
|
+
error?: {
|
|
1478
|
+
message: string;
|
|
1479
|
+
};
|
|
1480
|
+
durationMs?: number;
|
|
1481
|
+
};
|
|
1482
|
+
/**
|
|
1483
|
+
* Origin-stamp fields the runtime attaches to any event that was forwarded from
|
|
1484
|
+
* a delegated child. Sub-agent children stamp `subagentId` / `subagentName`;
|
|
1485
|
+
* `asTool` delegated children stamp `delegatedTo`. All optional and absent on a
|
|
1486
|
+
* top-level agent's own events.
|
|
1487
|
+
*/
|
|
1488
|
+
type DelegationEventStamp = {
|
|
1489
|
+
/** Per-spawn id of the sub-agent that produced this forwarded event. */
|
|
1490
|
+
subagentId?: string;
|
|
1491
|
+
/** Sub-agent name / role that produced this forwarded event. */
|
|
1492
|
+
subagentName?: string;
|
|
1493
|
+
/** Name of the `asTool` child agent this forwarded event came from. */
|
|
1494
|
+
delegatedTo?: string;
|
|
1495
|
+
};
|
|
1496
|
+
type SmartAgentEvent = (ToolCallEvent | ToolApprovalEvent | UserQuestionEvent | PlanEvent | SummarizationEvent | FinalAnswerEvent | MetadataEvent | HandoffEvent | GuardrailEvent | ProgressEvent | StreamEvent | CancelledEvent | SubagentEvent | ReflectionEvent) & DelegationEventStamp;
|
|
1289
1497
|
type ReflectionEvent = {
|
|
1290
1498
|
type: "reflection";
|
|
1291
1499
|
id: string;
|
|
@@ -1575,6 +1783,148 @@ declare function createBindSkillToolsTool(deps: SkillToolDeps): ToolInterface;
|
|
|
1575
1783
|
/** Both skill tools for an invoke, sharing one registry ref. */
|
|
1576
1784
|
declare function createSkillTools(deps: SkillToolDeps): ToolInterface[];
|
|
1577
1785
|
|
|
1786
|
+
/**
|
|
1787
|
+
* Native SKILL.md loader — Anthropic-style filesystem skills for the smart agent.
|
|
1788
|
+
*
|
|
1789
|
+
* Discovers `<root>/<name>/SKILL.md` documents, parses their frontmatter, and
|
|
1790
|
+
* adapts each into a {@link Skill} with progressive disclosure:
|
|
1791
|
+
* - level 1: `header` (frontmatter description) — always in the catalog;
|
|
1792
|
+
* - level 2: `prompt` (the markdown body) — returned on `open_skill`;
|
|
1793
|
+
* - level 3: bundled `scripts/` — exposed as tools that execute out-of-context
|
|
1794
|
+
* via an injected {@link SkillExecutionContext} (e.g. a sandbox), so script
|
|
1795
|
+
* source never enters the model context.
|
|
1796
|
+
*
|
|
1797
|
+
* The filesystem is injected (`SkillFs`) so skills can live on local disk or on
|
|
1798
|
+
* a remote sandbox filesystem. This module is additive: it produces standard
|
|
1799
|
+
* `Skill` objects consumable by `createSmartAgent({ skills })`.
|
|
1800
|
+
*/
|
|
1801
|
+
/** Minimal filesystem the loader needs; satisfiable by node fs or a sandbox fs. */
|
|
1802
|
+
interface SkillFs {
|
|
1803
|
+
/** Entry names directly under `dir`. Reject if `dir` does not exist. */
|
|
1804
|
+
listDir(dir: string): Promise<string[]>;
|
|
1805
|
+
/** Read a UTF-8 file. Reject if the file does not exist. */
|
|
1806
|
+
readFile(path: string): Promise<string>;
|
|
1807
|
+
}
|
|
1808
|
+
/** Executes a skill's bundled script out of context and returns its output. */
|
|
1809
|
+
interface SkillExecutionContext {
|
|
1810
|
+
/**
|
|
1811
|
+
* Run a bundled script (path relative to the skill directory) with the given
|
|
1812
|
+
* arguments. Implementations typically shell out inside a sandbox and return
|
|
1813
|
+
* stdout / a parsed result.
|
|
1814
|
+
*/
|
|
1815
|
+
executeScript(scriptPath: string, args: Record<string, unknown>): Promise<unknown>;
|
|
1816
|
+
}
|
|
1817
|
+
interface LoadSkillsOptions {
|
|
1818
|
+
fs: SkillFs;
|
|
1819
|
+
/** Directories to scan for `<name>/SKILL.md`. */
|
|
1820
|
+
roots: string[];
|
|
1821
|
+
/** When provided, bundled scripts become executable tools. */
|
|
1822
|
+
execution?: SkillExecutionContext;
|
|
1823
|
+
/** Default model-tier gate applied to discovered skills. */
|
|
1824
|
+
minModelTier?: "small" | "large";
|
|
1825
|
+
}
|
|
1826
|
+
interface SkillFrontmatter {
|
|
1827
|
+
metadata: Record<string, string | string[]>;
|
|
1828
|
+
body: string;
|
|
1829
|
+
}
|
|
1830
|
+
/** Parse SKILL.md frontmatter + body. No YAML dependency. */
|
|
1831
|
+
declare function parseSkillFrontmatter(md: string): SkillFrontmatter;
|
|
1832
|
+
/**
|
|
1833
|
+
* Discover and load all SKILL.md skills under the configured roots. Returns
|
|
1834
|
+
* standard `Skill` objects ready to pass to `createSmartAgent({ skills })`.
|
|
1835
|
+
*/
|
|
1836
|
+
declare function loadSkillsFromDisk(opts: LoadSkillsOptions): Promise<Skill[]>;
|
|
1837
|
+
|
|
1838
|
+
/**
|
|
1839
|
+
* Pure registry helpers for the sub-agent primitive. No I/O, no agent loop —
|
|
1840
|
+
* the deterministic core, fully unit-testable on its own.
|
|
1841
|
+
*/
|
|
1842
|
+
/** Look up a registry sub-agent by name. */
|
|
1843
|
+
declare function findSubagent(subagents: SubagentDef[], name: string): SubagentDef | undefined;
|
|
1844
|
+
/** Filter the catalog to sub-agents usable now (availability gate). */
|
|
1845
|
+
declare function resolveAvailableSubagents(subagents: SubagentDef[]): Promise<SubagentDef[]>;
|
|
1846
|
+
/**
|
|
1847
|
+
* Spawn guard: may the run spawn `count` more children? Enforces the per-run
|
|
1848
|
+
* child-call budget. Depth is checked separately against the live ctx because
|
|
1849
|
+
* it depends on the parent's `__delegationDepth`.
|
|
1850
|
+
*/
|
|
1851
|
+
declare function canSpawn(ref: SubagentRegistryRef, policy: SubagentPolicy, count?: number): {
|
|
1852
|
+
ok: true;
|
|
1853
|
+
} | {
|
|
1854
|
+
ok: false;
|
|
1855
|
+
reason: string;
|
|
1856
|
+
};
|
|
1857
|
+
/** Depth guard, evaluated against the current delegation depth from ctx. */
|
|
1858
|
+
declare function withinDepth(currentDepth: number, policy: SubagentPolicy): {
|
|
1859
|
+
ok: true;
|
|
1860
|
+
} | {
|
|
1861
|
+
ok: false;
|
|
1862
|
+
reason: string;
|
|
1863
|
+
};
|
|
1864
|
+
/**
|
|
1865
|
+
* Seed the child's initial messages from the parent transcript according to the
|
|
1866
|
+
* context policy. Extracted so both `asTool` delegation and the sub-agent tools
|
|
1867
|
+
* share ONE implementation.
|
|
1868
|
+
*
|
|
1869
|
+
* - `full` — entire parent transcript (minus its system prompt) + the input.
|
|
1870
|
+
* - `scoped` — last user turn + the task input.
|
|
1871
|
+
* - `minimal` — only the task input (default).
|
|
1872
|
+
*
|
|
1873
|
+
* The parent's system message is intentionally NOT carried over: the child agent
|
|
1874
|
+
* composes its own system prompt from its `SubagentDef.systemPrompt` (or role),
|
|
1875
|
+
* and leaking the parent's system message would suppress it.
|
|
1876
|
+
*/
|
|
1877
|
+
declare function seedChildMessages(policy: ChildContextPolicy, parentMessages: Message[], input: string): Message[];
|
|
1878
|
+
/**
|
|
1879
|
+
* Resolve a sub-agent's declared tool surface to concrete tools. `string[]`
|
|
1880
|
+
* entries are matched (by name) against the parent's live tool set so an ad-hoc
|
|
1881
|
+
* or registry sub-agent can borrow a subset of the parent's capabilities.
|
|
1882
|
+
*/
|
|
1883
|
+
declare function resolveSubagentTools(declared: SubagentDef["tools"] | string[] | undefined, parentTools: ToolInterface[]): Promise<ToolInterface[]>;
|
|
1884
|
+
/** The cheap catalog block the model always sees in its system prompt. */
|
|
1885
|
+
declare function buildSubagentCatalogBlock(subagents: SubagentDef[], policy: SubagentPolicy, toolNames: {
|
|
1886
|
+
delegate: string;
|
|
1887
|
+
spawn: string;
|
|
1888
|
+
parallel: string;
|
|
1889
|
+
}): string;
|
|
1890
|
+
|
|
1891
|
+
/**
|
|
1892
|
+
* Per-invoke sub-agent tools (`delegate_to`, `spawn_subagent`,
|
|
1893
|
+
* `spawn_subagents_parallel`). They read the parent runtime/context from the
|
|
1894
|
+
* tool `_stateRef` (injected by the tools node), build child agents via the
|
|
1895
|
+
* injected `buildChild` factory (dependency injection avoids a circular import
|
|
1896
|
+
* with createSmartAgent), and forward events/streaming/cancellation into each
|
|
1897
|
+
* child. Human-in-the-loop pauses inside a sequential child are surfaced to the
|
|
1898
|
+
* parent and resumed via `state.ctx.__subagentPending`.
|
|
1899
|
+
*/
|
|
1900
|
+
/** Config a child agent is built from. The factory lives in createSmartAgent. */
|
|
1901
|
+
type BuildChildConfig = {
|
|
1902
|
+
name: string;
|
|
1903
|
+
model: any;
|
|
1904
|
+
systemPrompt?: string;
|
|
1905
|
+
tools: ToolInterface[];
|
|
1906
|
+
outputSchema?: any;
|
|
1907
|
+
limits?: any;
|
|
1908
|
+
};
|
|
1909
|
+
type SubagentToolDeps = {
|
|
1910
|
+
registryRef: SubagentRegistryRef;
|
|
1911
|
+
subagents: SubagentDef[];
|
|
1912
|
+
policy: SubagentPolicy;
|
|
1913
|
+
/** DI: build a child SmartAgent instance (createSmartAgent closure). */
|
|
1914
|
+
buildChild: (cfg: BuildChildConfig) => SmartAgentInstance;
|
|
1915
|
+
/** Optional prompt-override descriptions for the three tools. */
|
|
1916
|
+
descriptions?: {
|
|
1917
|
+
delegate?: string;
|
|
1918
|
+
spawn?: string;
|
|
1919
|
+
parallel?: string;
|
|
1920
|
+
};
|
|
1921
|
+
};
|
|
1922
|
+
declare function createDelegateTool(deps: SubagentToolDeps): ToolInterface;
|
|
1923
|
+
declare function createSpawnTool(deps: SubagentToolDeps): ToolInterface;
|
|
1924
|
+
declare function createParallelTool(deps: SubagentToolDeps): ToolInterface;
|
|
1925
|
+
/** Build the sub-agent tool set for an invoke, all sharing one registry ref. */
|
|
1926
|
+
declare function createSubagentTools(deps: SubagentToolDeps): ToolInterface[];
|
|
1927
|
+
|
|
1578
1928
|
type EvalHarnessParams = {
|
|
1579
1929
|
profiles: EvalProfileTarget[];
|
|
1580
1930
|
cases: EvalCase[];
|
|
@@ -2239,18 +2589,6 @@ declare class AnthropicProvider extends BaseProvider {
|
|
|
2239
2589
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
2240
2590
|
private buildRequestBody;
|
|
2241
2591
|
private splitSystemMessages;
|
|
2242
|
-
/**
|
|
2243
|
-
* Converts unified messages to Anthropic format, coalescing consecutive
|
|
2244
|
-
* tool-result messages into a single `user` turn.
|
|
2245
|
-
*
|
|
2246
|
-
* The unified message list carries one `role: "tool"` entry per tool call
|
|
2247
|
-
* (mirroring OpenAI's shape). Anthropic's Messages API expects every
|
|
2248
|
-
* `tool_result` block answering a single assistant turn's `tool_use`
|
|
2249
|
-
* block(s) to be batched into ONE `user` message rather than sent as
|
|
2250
|
-
* separate consecutive `user` messages.
|
|
2251
|
-
*/
|
|
2252
|
-
private toAnthropicMessages;
|
|
2253
|
-
private toAnthropicToolResult;
|
|
2254
2592
|
private toAnthropicMessage;
|
|
2255
2593
|
private toAnthropicTool;
|
|
2256
2594
|
private doFetch;
|
|
@@ -2288,19 +2626,6 @@ declare class BedrockProvider extends BaseProvider {
|
|
|
2288
2626
|
completeStream(request: ChatCompletionRequest): AsyncGenerator<ChatCompletionChunk, void, unknown>;
|
|
2289
2627
|
private buildConverseBody;
|
|
2290
2628
|
private splitSystemMessages;
|
|
2291
|
-
/**
|
|
2292
|
-
* Converts unified messages to Bedrock Converse format, coalescing
|
|
2293
|
-
* consecutive tool-result messages into a single `user` turn.
|
|
2294
|
-
*
|
|
2295
|
-
* The unified message list carries one `role: "tool"` entry per tool call
|
|
2296
|
-
* (mirroring OpenAI's shape). Bedrock's Converse API requires every
|
|
2297
|
-
* `toolResult` block answering a single assistant turn's `toolUse`
|
|
2298
|
-
* block(s) to be batched into ONE `user` message — sending them as
|
|
2299
|
-
* separate consecutive `user` messages triggers: "Expected toolResult
|
|
2300
|
-
* blocks at messages.N.content for the following Ids: ...".
|
|
2301
|
-
*/
|
|
2302
|
-
private toBedrockMessages;
|
|
2303
|
-
private toBedrockToolResult;
|
|
2304
2629
|
private toBedrockMessage;
|
|
2305
2630
|
private toBedrockTool;
|
|
2306
2631
|
private doFetch;
|
|
@@ -2322,7 +2647,6 @@ declare class VertexProvider extends BaseProvider {
|
|
|
2322
2647
|
private buildUrl;
|
|
2323
2648
|
private buildGeminiBody;
|
|
2324
2649
|
private buildContents;
|
|
2325
|
-
private toGeminiFunctionResponsePart;
|
|
2326
2650
|
private toGeminiContent;
|
|
2327
2651
|
private toGeminiTool;
|
|
2328
2652
|
private getAccessToken;
|
|
@@ -2380,4 +2704,4 @@ declare function fromNativeProvider(provider: BaseProvider, options?: NativeMode
|
|
|
2380
2704
|
*/
|
|
2381
2705
|
declare function createProvider(config: ProviderConfig): BaseProvider;
|
|
2382
2706
|
|
|
2383
|
-
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, 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, InMemoryMemoryStore, type InvokeConfig, type JsonGuardrailOptions, type JsonSchemaRuleOptions, 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 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 ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, 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 SummarizationEvent, type SummarizationMode, type SummaryFactItem, type SummaryIntegrityCheck, 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, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSystemPrompt, canOpenSkill, captureSnapshot, codePresenceRule, cognipeerSink, composeToolSets, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextSummarizeNode, createContextTools, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createProvider, createRegexGuardrail, createResolverNode, createSkillRegistryRef, createSkillTools, createSmartAgent, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, emptyUsage, evaluateGuardrails, fileSink, formatZodError, fromLangchainModel, fromLangchainTools, fromNativeProvider, generateSpanId, generateTraceId, getModelCapabilities, getNestedValue, getResolvedSmartConfig, getTokenCounter, hasToolResponseRecoveryReference, httpSink, isSmartModel, jsonSchemaRule, normalizeSmartAgentOptions, otlpSink, readMemoryFacts, regexRule, resolveAvailableSkills, resolveMemoryStore, resolveReasoning, resolveStrategy, resolveToolApprovalState, resolveUserQuestionState, restoreSnapshot, runSmartAgentEvalHarness, setTokenCounter, startStreamingSession, traceSessionToOtlp, validateReasoningConfig, withTools, writeSummaryFactsToMemory };
|
|
2707
|
+
export { type AIMessage, type AgentInstance, type AgentInvokeResult, type AgentLimits, type AgentOptions, type AgentRuleOptions, type AgentRuntimeConfig, type AgentSnapshot, type AgentSnapshotMetadata, type AgentState, AnthropicProvider, type AnthropicProviderConfig, AzureProvider, type AzureProviderConfig, type BaseChatMessage, type BaseChatMessagePart, type BaseChatModel, type BaseMessage, BaseProvider, BedrockProvider, type BedrockProviderConfig, type BuildChildConfig, type BuiltInRuntimeProfile, type CancellationTokenLike, type CancelledEvent, type ChatCompletionChunk, type ChatCompletionRequest, type ChatCompletionResponse, type ChildContextPolicy, type CodeDetectionRuleOptions, type CodeGuardrailOptions, type ContextPolicy, type ContextToolsStateRef, type ConversationGuardrail, type CustomRuleCallback, type CustomRuleOptions, DEFAULT_PROFILE_CONFIGS, DEFAULT_SKILL_POLICY, DEFAULT_SUBAGENT_POLICY, DEFAULT_SUBAGENT_TOOL_NAMES, type DelegationEventStamp, type DelegationMode, type EvalCase, type EvalCaseResult, type EvalFamily, type EvalHarnessMetrics, type EvalHarnessParams, type EvalHarnessResult, type EvalProfileDescriptor, type EvalProfileTarget, 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, 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 ResolvedSmartAgentConfig, type ResolvedTraceConfig, type ResolvedTraceSink, type RestoreSnapshotOptions, type RuntimeProfile, SMALL_TIER_SKILL_POLICY, type SerializableSmartState, type Skill, 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 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, agentVerdictRule, appendBoundTools, buildSkillHeaderBlock, buildSubagentCatalogBlock, buildSystemPrompt, canOpenSkill, canSpawn, captureSnapshot, codePresenceRule, cognipeerSink, composeToolSets, countApproxTokens, countMessagesTokens, createAgent, createAgentNode, createAskUserQuestionTool, createBindSkillToolsTool, createCodeGuardrail, createContextSummarizeNode, createContextTools, createDelegateTool, createGetToolResponseTool, createGuardrail, createJsonGuardrail, createManageTodoTool, createOpenSkillTool, createParallelTool, createProvider, createRegexGuardrail, createResolverNode, createSkillRegistryRef, createSkillTools, createSmartAgent, createSpawnTool, createSubagentRegistryRef, createSubagentTools, createTool, createToolLimitFinalizeNode, createToolsNode, customCallbackRule, customSink, dedupeToolsByName, defaultTokenCounter, emptyUsage, evaluateGuardrails, 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, seedChildMessages, setTokenCounter, startStreamingSession, traceSessionToOtlp, validateReasoningConfig, withTools, withinDepth, writeSummaryFactsToMemory };
|