@cuylabs/agent-core 0.7.0 → 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/dist/{builder-BRvqCcIk.d.ts → builder-UpOWQMW3.d.ts} +2 -2
- package/dist/{chunk-3HNO5SVI.js → chunk-4BDA7DQY.js} +3 -3
- package/dist/chunk-BFM2YHNM.js +222 -0
- package/dist/chunk-CAA7FHIH.js +280 -0
- package/dist/chunk-DWYX7ASF.js +26 -0
- package/dist/chunk-KUVSERLJ.js +50 -0
- package/dist/{chunk-5K7AQVOU.js → chunk-N6HWIEEA.js} +8 -204
- package/dist/{chunk-QGOGIP7T.js → chunk-RFEKJKTO.js} +131 -25
- package/dist/chunk-RZITT45F.js +202 -0
- package/dist/{chunk-ZPMACVZK.js → chunk-SQU2AJHO.js} +1 -1
- package/dist/{chunk-BNSHUWCV.js → chunk-WWYYNWEW.js} +1 -1
- package/dist/{chunk-CDTV2UYU.js → chunk-YSLSEQ6B.js} +52 -252
- package/dist/context/index.js +1 -1
- package/dist/errors/index.d.ts +11 -0
- package/dist/errors/index.js +16 -0
- package/dist/events-CE72w8W4.d.ts +149 -0
- package/dist/{index-C33hlD6H.d.ts → index-CWSchSql.d.ts} +36 -50
- package/dist/index.d.ts +36 -109
- package/dist/index.js +213 -396
- package/dist/inference/index.d.ts +10 -7
- package/dist/inference/index.js +7 -5
- package/dist/llm-error-D93FNNLY.d.ts +32 -0
- package/dist/middleware/index.d.ts +245 -7
- package/dist/middleware/index.js +3 -1
- package/dist/models/index.d.ts +125 -4
- package/dist/models/index.js +7 -3
- package/dist/presets/index.d.ts +53 -0
- package/dist/presets/index.js +28 -0
- package/dist/prompt/index.d.ts +10 -8
- package/dist/reasoning/index.d.ts +1 -2
- package/dist/reasoning/index.js +3 -7
- package/dist/{registry-BDLIHOQB.d.ts → registry-DwYqsQkX.d.ts} +1 -1
- package/dist/{runner-DSKaEz3z.d.ts → runner-e2YRcUoX.d.ts} +58 -151
- package/dist/runtime/index.d.ts +11 -8
- package/dist/runtime/index.js +9 -7
- package/dist/safety/index.d.ts +38 -0
- package/dist/safety/index.js +12 -0
- package/dist/scope/index.d.ts +2 -2
- package/dist/signal/index.d.ts +28 -0
- package/dist/signal/index.js +6 -0
- package/dist/skill/index.d.ts +7 -6
- package/dist/sub-agent/index.d.ts +14 -9
- package/dist/tool/index.d.ts +7 -5
- package/dist/tool/index.js +2 -2
- package/dist/tool-BHbyUAy3.d.ts +150 -0
- package/dist/{tool-HUtkiVBx.d.ts → tool-DLXAR9Ce.d.ts} +1 -1
- package/dist/tracking/index.d.ts +2 -2
- package/dist/{tool-Db1Ue-1U.d.ts → types-BfNpU8NS.d.ts} +1 -150
- package/dist/types-BnpEOYV-.d.ts +50 -0
- package/dist/{types-9jGQUjqW.d.ts → types-CQL-SvTn.d.ts} +1 -1
- package/dist/types-CWm-7rvB.d.ts +55 -0
- package/dist/{types-FRpzzg_9.d.ts → types-KKDrdU9Y.d.ts} +5 -35
- package/dist/{capability-resolver-CgRGsWVX.d.ts → types-QA4WhEfz.d.ts} +1 -117
- package/dist/{types-CqDZTh4d.d.ts → types-QKHHQLLq.d.ts} +5 -4
- package/dist/types-YuWV4ag7.d.ts +72 -0
- package/package.json +58 -3
- package/dist/index-CfBGYrpd.d.ts +0 -317
- package/dist/{chunk-IEFIQENH.js → chunk-7VKQ4WPB.js} +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SkillDiscoveryResult, a as SkillMetadata, b as SkillContent, c as SkillResource, d as SkillConfig } from './
|
|
1
|
+
import { S as SkillDiscoveryResult, a as SkillMetadata, b as SkillContent, c as SkillResource, d as SkillConfig } from './types-BfNpU8NS.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Skill Registry — in-memory store for discovered skills
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import * as ai from 'ai';
|
|
2
1
|
import { LanguageModel, ModelMessage, TelemetrySettings, SystemModelMessage } from 'ai';
|
|
3
2
|
import { ProviderOptions } from '@ai-sdk/provider-utils';
|
|
4
|
-
import {
|
|
5
|
-
import { d as SkillConfig
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { A as AgentEvent } from './events-CE72w8W4.js';
|
|
4
|
+
import { d as SkillConfig } from './types-BfNpU8NS.js';
|
|
5
|
+
import { T as TokenUsage } from './messages-BYWGn8TY.js';
|
|
6
|
+
import { S as ScopeSnapshot } from './types-CQL-SvTn.js';
|
|
7
|
+
import { b as ToolContext } from './tool-DLXAR9Ce.js';
|
|
8
|
+
import { T as Tool } from './tool-BHbyUAy3.js';
|
|
8
9
|
import { R as ReasoningLevel } from './types-CQaXbRsS.js';
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -173,151 +174,6 @@ interface EnhancedTools extends Array<unknown> {
|
|
|
173
174
|
__customStreamModels?: string[];
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
/** Agent status for UI display */
|
|
177
|
-
type AgentStatus = "idle" | "processing" | "thinking" | "reasoning" | "calling-tool" | "waiting-approval" | "error";
|
|
178
|
-
/** Approval request for UI */
|
|
179
|
-
interface ApprovalEvent {
|
|
180
|
-
id: string;
|
|
181
|
-
tool: string;
|
|
182
|
-
args: unknown;
|
|
183
|
-
description: string;
|
|
184
|
-
risk: "safe" | "moderate" | "dangerous";
|
|
185
|
-
}
|
|
186
|
-
/** Neutral turn-commit boundaries for runtime/durability integrations */
|
|
187
|
-
type AgentTurnBoundaryKind = "input-commit-start" | "input-commit-finish" | "intervention-commit-start" | "intervention-commit-finish" | "step-commit-start" | "step-commit-finish" | "output-commit-start" | "output-commit-finish";
|
|
188
|
-
/**
|
|
189
|
-
* Events emitted during agent execution
|
|
190
|
-
*
|
|
191
|
-
* These events are designed for UI consumption:
|
|
192
|
-
* - status: Overall agent state for status indicators
|
|
193
|
-
* - approval-request: User confirmation needed
|
|
194
|
-
* - progress: Step counts for progress bars
|
|
195
|
-
*/
|
|
196
|
-
type AgentEvent = {
|
|
197
|
-
type: "status";
|
|
198
|
-
status: AgentStatus;
|
|
199
|
-
} | {
|
|
200
|
-
type: "approval-request";
|
|
201
|
-
request: ApprovalEvent;
|
|
202
|
-
} | {
|
|
203
|
-
type: "approval-resolved";
|
|
204
|
-
id: string;
|
|
205
|
-
action: "allow" | "deny" | "remember";
|
|
206
|
-
} | {
|
|
207
|
-
type: "step-start";
|
|
208
|
-
step: number;
|
|
209
|
-
maxSteps: number;
|
|
210
|
-
} | {
|
|
211
|
-
type: "step-finish";
|
|
212
|
-
step: number;
|
|
213
|
-
usage?: TokenUsage;
|
|
214
|
-
finishReason?: string;
|
|
215
|
-
} | {
|
|
216
|
-
type: "turn-boundary";
|
|
217
|
-
boundary: AgentTurnBoundaryKind;
|
|
218
|
-
step?: number;
|
|
219
|
-
messageRole?: Message["role"];
|
|
220
|
-
pendingToolCallCount?: number;
|
|
221
|
-
} | {
|
|
222
|
-
type: "message";
|
|
223
|
-
message: Message;
|
|
224
|
-
} | {
|
|
225
|
-
type: "text-start";
|
|
226
|
-
} | {
|
|
227
|
-
type: "text-delta";
|
|
228
|
-
text: string;
|
|
229
|
-
} | {
|
|
230
|
-
type: "text-end";
|
|
231
|
-
} | {
|
|
232
|
-
type: "reasoning-start";
|
|
233
|
-
id: string;
|
|
234
|
-
} | {
|
|
235
|
-
type: "reasoning-delta";
|
|
236
|
-
id: string;
|
|
237
|
-
text: string;
|
|
238
|
-
} | {
|
|
239
|
-
type: "reasoning-end";
|
|
240
|
-
id: string;
|
|
241
|
-
} | {
|
|
242
|
-
type: "tool-start";
|
|
243
|
-
toolName: string;
|
|
244
|
-
toolCallId: string;
|
|
245
|
-
input: unknown;
|
|
246
|
-
} | {
|
|
247
|
-
type: "tool-result";
|
|
248
|
-
toolName: string;
|
|
249
|
-
toolCallId: string;
|
|
250
|
-
result: unknown;
|
|
251
|
-
} | {
|
|
252
|
-
type: "tool-error";
|
|
253
|
-
toolName: string;
|
|
254
|
-
toolCallId: string;
|
|
255
|
-
error: string;
|
|
256
|
-
} | {
|
|
257
|
-
type: "computer-call";
|
|
258
|
-
callId: string;
|
|
259
|
-
action: unknown;
|
|
260
|
-
pendingSafetyChecks?: unknown[];
|
|
261
|
-
} | {
|
|
262
|
-
type: "computer-result";
|
|
263
|
-
callId: string;
|
|
264
|
-
result: unknown;
|
|
265
|
-
} | {
|
|
266
|
-
type: "intervention-applied";
|
|
267
|
-
id: string;
|
|
268
|
-
message: string;
|
|
269
|
-
} | {
|
|
270
|
-
type: "doom-loop";
|
|
271
|
-
toolName: string;
|
|
272
|
-
repeatCount: number;
|
|
273
|
-
} | {
|
|
274
|
-
type: "context-overflow";
|
|
275
|
-
inputTokens: number;
|
|
276
|
-
limit: number;
|
|
277
|
-
} | {
|
|
278
|
-
type: "turn-summary";
|
|
279
|
-
turnId: string;
|
|
280
|
-
files: Array<{
|
|
281
|
-
path: string;
|
|
282
|
-
type: "created" | "modified" | "deleted" | "unchanged";
|
|
283
|
-
additions: number;
|
|
284
|
-
deletions: number;
|
|
285
|
-
}>;
|
|
286
|
-
additions: number;
|
|
287
|
-
deletions: number;
|
|
288
|
-
} | {
|
|
289
|
-
type: "retry";
|
|
290
|
-
attempt: number;
|
|
291
|
-
delayMs: number;
|
|
292
|
-
error: Error;
|
|
293
|
-
} | {
|
|
294
|
-
type: "error";
|
|
295
|
-
error: Error;
|
|
296
|
-
} | {
|
|
297
|
-
type: "complete";
|
|
298
|
-
usage?: TokenUsage;
|
|
299
|
-
output?: string;
|
|
300
|
-
};
|
|
301
|
-
/**
|
|
302
|
-
* Step-processing result - what happens after reducing one streamed step
|
|
303
|
-
*/
|
|
304
|
-
type StepProcessingResult = "continue" | "stop" | "compact";
|
|
305
|
-
/**
|
|
306
|
-
* @deprecated Use `StepProcessingResult`.
|
|
307
|
-
*/
|
|
308
|
-
type ProcessorResult = StepProcessingResult;
|
|
309
|
-
/**
|
|
310
|
-
* Stream input for model inference
|
|
311
|
-
*/
|
|
312
|
-
interface StreamInput {
|
|
313
|
-
sessionID: string;
|
|
314
|
-
model: ai.LanguageModel;
|
|
315
|
-
system: string[];
|
|
316
|
-
messages: ai.ModelMessage[];
|
|
317
|
-
abort: AbortSignal;
|
|
318
|
-
tools: Record<string, unknown>;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
177
|
/**
|
|
322
178
|
* Prompt Pipeline Types
|
|
323
179
|
*
|
|
@@ -791,6 +647,57 @@ interface AgentMiddleware {
|
|
|
791
647
|
*/
|
|
792
648
|
getOtelContext?(sessionId: string): unknown;
|
|
793
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* A user-facing command a plugin can register.
|
|
652
|
+
*
|
|
653
|
+
* How commands surface depends on the host:
|
|
654
|
+
* - CLI/TUI → slash commands (e.g. `/deploy`)
|
|
655
|
+
* - HTTP → could be API routes
|
|
656
|
+
* - Chatbot → chat commands
|
|
657
|
+
*
|
|
658
|
+
* Hosts that don't support commands can silently ignore them.
|
|
659
|
+
*/
|
|
660
|
+
interface PluginCommand {
|
|
661
|
+
/** Command name (without leading slash) */
|
|
662
|
+
name: string;
|
|
663
|
+
/** Optional aliases */
|
|
664
|
+
alias?: string[];
|
|
665
|
+
/** One-line description shown in help */
|
|
666
|
+
summary: string;
|
|
667
|
+
/** Execute the command. Return the text to display, or null for silent. */
|
|
668
|
+
execute: (args: string) => Promise<string | null>;
|
|
669
|
+
}
|
|
670
|
+
/**
|
|
671
|
+
* The context object passed to a plugin's default export.
|
|
672
|
+
*
|
|
673
|
+
* Through the context, plugins contribute tools, middleware, and
|
|
674
|
+
* (optionally) host-specific commands.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* ```ts
|
|
678
|
+
* import { Tool, z, type PluginContext } from "@cuylabs/agent-code";
|
|
679
|
+
*
|
|
680
|
+
* export default function (ctx: PluginContext) {
|
|
681
|
+
* ctx.addTool(Tool.define("ping", {
|
|
682
|
+
* description: "Pong!",
|
|
683
|
+
* parameters: z.object({}),
|
|
684
|
+
* execute: async () => ({ title: "pong", output: "pong", metadata: {} }),
|
|
685
|
+
* }));
|
|
686
|
+
* }
|
|
687
|
+
* ```
|
|
688
|
+
*/
|
|
689
|
+
interface PluginContext {
|
|
690
|
+
/** Working directory of the agent (project root) */
|
|
691
|
+
cwd: string;
|
|
692
|
+
/** Register a tool the LLM can call */
|
|
693
|
+
addTool(tool: Tool.AnyInfo): void;
|
|
694
|
+
/** Register middleware (model hooks, tool guards, prompt sections) */
|
|
695
|
+
addMiddleware(mw: AgentMiddleware): void;
|
|
696
|
+
/** Register a user-facing command (host-dependent) */
|
|
697
|
+
addCommand(cmd: PluginCommand): void;
|
|
698
|
+
}
|
|
699
|
+
/** The function shape a plugin file must default-export. */
|
|
700
|
+
type PluginInit = (ctx: PluginContext) => void | Promise<void>;
|
|
794
701
|
|
|
795
702
|
/**
|
|
796
703
|
* Middleware Runner
|
|
@@ -876,4 +783,4 @@ declare class MiddlewareRunner {
|
|
|
876
783
|
}): Promise<void>;
|
|
877
784
|
}
|
|
878
785
|
|
|
879
|
-
export { type
|
|
786
|
+
export { type AgentMiddleware as A, type BlockedModelCall as B, type EnhancedTools as E, type InstructionFile as I, MiddlewareRunner as M, type PromptConfig as P, type StreamChunk as S, type ToolCallDecision as T, type PromptBuildContext as a, type PromptSection as b, type ModelFamily as c, type StreamProvider as d, type ModelCallInput as e, type AgentModelHooks as f, type EnvironmentInfo as g, type ModelCallContext as h, type ModelCallOutput as i, type PluginCommand as j, type PluginContext as k, type PluginInit as l, type StreamProviderConfig as m, type StreamProviderFactory as n, type StreamProviderInput as o, type StreamProviderResult as p };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { A as AgentEvent } from '../
|
|
1
|
+
import { A as AgentEvent } from '../events-CE72w8W4.js';
|
|
2
2
|
import { T as TokenUsage, M as Message } from '../messages-BYWGn8TY.js';
|
|
3
|
-
import {
|
|
4
|
-
import { S as StepProcessingOptions, z as StepProcessingOutput, l as AgentTurnStepCommitSnapshot, r as CreateAgentTurnStepCommitBatchOptions, d as AgentTurnCommitBatch, P as PrepareModelStepOptions, u as PreparedAgentModelStep, R as RunModelStepOptions, x as RunToolBatchOptions, y as RunToolBatchResult, C as CommitOutputOptions, p as CommitStepOptions, j as AgentTurnState, n as AgentTurnStepCommitToolResult, m as AgentTurnStepCommitToolCall } from '../types-
|
|
5
|
-
export { A as AgentTurnActiveToolCall, a as AgentTurnBoundaryMetadata, b as AgentTurnBoundarySnapshot, c as AgentTurnCommitApplier, e as AgentTurnCommitOptions, f as AgentTurnEngine, g as AgentTurnEngineOptions, h as AgentTurnPhase, i as AgentTurnResolvedToolCall, k as AgentTurnStateAdvanceOptions, o as AgentTurnStepRuntimeConfig, q as CreateAgentTurnStateOptions, v as ProcessorOptions, w as ProcessorOutput, B as advanceAgentTurnState, E as createAgentTurnEngine, F as createAgentTurnState, G as failAgentTurnState } from '../types-
|
|
6
|
-
import { A as AnyInferenceResult } from '../types-
|
|
3
|
+
import { S as ScopeSnapshot } from '../types-CQL-SvTn.js';
|
|
4
|
+
import { S as StepProcessingOptions, z as StepProcessingOutput, l as AgentTurnStepCommitSnapshot, r as CreateAgentTurnStepCommitBatchOptions, d as AgentTurnCommitBatch, P as PrepareModelStepOptions, u as PreparedAgentModelStep, R as RunModelStepOptions, x as RunToolBatchOptions, y as RunToolBatchResult, C as CommitOutputOptions, p as CommitStepOptions, j as AgentTurnState, n as AgentTurnStepCommitToolResult, m as AgentTurnStepCommitToolCall } from '../types-QKHHQLLq.js';
|
|
5
|
+
export { A as AgentTurnActiveToolCall, a as AgentTurnBoundaryMetadata, b as AgentTurnBoundarySnapshot, c as AgentTurnCommitApplier, e as AgentTurnCommitOptions, f as AgentTurnEngine, g as AgentTurnEngineOptions, h as AgentTurnPhase, i as AgentTurnResolvedToolCall, k as AgentTurnStateAdvanceOptions, o as AgentTurnStepRuntimeConfig, q as CreateAgentTurnStateOptions, v as ProcessorOptions, w as ProcessorOutput, B as advanceAgentTurnState, E as createAgentTurnEngine, F as createAgentTurnState, G as failAgentTurnState } from '../types-QKHHQLLq.js';
|
|
6
|
+
import { A as AnyInferenceResult } from '../types-KKDrdU9Y.js';
|
|
7
7
|
import { ModelMessage } from 'ai';
|
|
8
|
-
import '
|
|
9
|
-
import '../tool-Db1Ue-1U.js';
|
|
8
|
+
import '../tool-BHbyUAy3.js';
|
|
10
9
|
import 'zod';
|
|
11
|
-
import '../tool-
|
|
10
|
+
import '../tool-DLXAR9Ce.js';
|
|
12
11
|
import '../types-CHiPh8U2.js';
|
|
12
|
+
import '../runner-e2YRcUoX.js';
|
|
13
|
+
import '@ai-sdk/provider-utils';
|
|
14
|
+
import '../types-BfNpU8NS.js';
|
|
13
15
|
import '../types-CQaXbRsS.js';
|
|
16
|
+
import '../llm-error-D93FNNLY.js';
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Doom loop error thrown when repeated tool calls are detected.
|
package/dist/runtime/index.js
CHANGED
|
@@ -30,14 +30,16 @@ import {
|
|
|
30
30
|
runToolBatch,
|
|
31
31
|
snapshotAgentWorkflowMessage,
|
|
32
32
|
snapshotAgentWorkflowMessages
|
|
33
|
-
} from "../chunk-
|
|
34
|
-
import "../chunk-
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-
|
|
37
|
-
import "../chunk-IEFIQENH.js";
|
|
38
|
-
import "../chunk-N7P4PN3O.js";
|
|
33
|
+
} from "../chunk-4BDA7DQY.js";
|
|
34
|
+
import "../chunk-WWYYNWEW.js";
|
|
35
|
+
import "../chunk-N6HWIEEA.js";
|
|
36
|
+
import "../chunk-7VKQ4WPB.js";
|
|
39
37
|
import "../chunk-VEKUXUVF.js";
|
|
40
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-SQU2AJHO.js";
|
|
39
|
+
import "../chunk-N7P4PN3O.js";
|
|
40
|
+
import "../chunk-RZITT45F.js";
|
|
41
|
+
import "../chunk-RFEKJKTO.js";
|
|
42
|
+
import "../chunk-DWYX7ASF.js";
|
|
41
43
|
export {
|
|
42
44
|
AgentTurnEngine,
|
|
43
45
|
ContextOverflowError,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { R as RiskLevel, a as ApprovalConfig, c as ApprovalRule } from '../types-CWm-7rvB.js';
|
|
2
|
+
export { A as ApprovalAction, b as ApprovalRequest } from '../types-CWm-7rvB.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the risk level for a tool.
|
|
6
|
+
*/
|
|
7
|
+
declare function getToolRisk(tool: string, customRisks?: Record<string, RiskLevel>): RiskLevel;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Thrown when a user or rule denies an operation.
|
|
11
|
+
*/
|
|
12
|
+
declare class ApprovalDeniedError extends Error {
|
|
13
|
+
readonly tool: string;
|
|
14
|
+
readonly args: unknown;
|
|
15
|
+
constructor(tool: string, args: unknown, message?: string);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Thrown when an approval request times out.
|
|
19
|
+
*/
|
|
20
|
+
declare class ApprovalTimeoutError extends Error {
|
|
21
|
+
readonly tool: string;
|
|
22
|
+
readonly timeoutMs: number;
|
|
23
|
+
constructor(tool: string, timeoutMs: number);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates an approval handler for managing tool execution permissions.
|
|
28
|
+
*/
|
|
29
|
+
declare function createApprovalHandler(config?: ApprovalConfig): {
|
|
30
|
+
request: (sessionId: string, tool: string, args: unknown, customRisks?: Record<string, RiskLevel>) => Promise<void>;
|
|
31
|
+
cancelAll: (reason?: string) => void;
|
|
32
|
+
addRule: (rule: ApprovalRule) => void;
|
|
33
|
+
getRules: () => readonly ApprovalRule[];
|
|
34
|
+
clearSessionRules: () => void;
|
|
35
|
+
};
|
|
36
|
+
type ApprovalHandler = ReturnType<typeof createApprovalHandler>;
|
|
37
|
+
|
|
38
|
+
export { ApprovalConfig, ApprovalDeniedError, type ApprovalHandler, ApprovalRule, ApprovalTimeoutError, RiskLevel, createApprovalHandler, getToolRisk };
|
package/dist/scope/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { e as ScopeOptions, a as Scope, S as ScopeSnapshot } from '../types-CQL-SvTn.js';
|
|
2
|
+
export { b as ScopeAttributeValue, c as ScopeAttributes, d as ScopeKind } from '../types-CQL-SvTn.js';
|
|
3
3
|
|
|
4
4
|
declare function currentScope(): Scope | undefined;
|
|
5
5
|
declare function snapshotScope(scope?: Scope | undefined): ScopeSnapshot | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { A as AgentSignal, T as TypedHandler, U as Unsubscribe, W as WildcardHandler } from '../types-YuWV4ag7.js';
|
|
2
|
+
export { E as EventOf } from '../types-YuWV4ag7.js';
|
|
3
|
+
import { A as AgentEvent } from '../events-CE72w8W4.js';
|
|
4
|
+
import 'ai';
|
|
5
|
+
import '../messages-BYWGn8TY.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* LocalSignal — in-process event dispatch.
|
|
9
|
+
*
|
|
10
|
+
* Dispatches events synchronously via direct function calls.
|
|
11
|
+
* Zero dependencies, zero serialization, zero network.
|
|
12
|
+
*
|
|
13
|
+
* Handler errors are caught silently — a broken listener must never
|
|
14
|
+
* interrupt the agent's streaming pipeline.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
declare class LocalSignal implements AgentSignal {
|
|
18
|
+
/** type → Set<handler> for typed subscriptions */
|
|
19
|
+
private readonly typed;
|
|
20
|
+
/** handlers that receive every event */
|
|
21
|
+
private readonly wildcard;
|
|
22
|
+
on<T extends AgentEvent["type"]>(type: T, handler: TypedHandler<T>): Unsubscribe;
|
|
23
|
+
onAny(handler: WildcardHandler): Unsubscribe;
|
|
24
|
+
emit(event: AgentEvent): void;
|
|
25
|
+
clear(): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { AgentSignal, LocalSignal, TypedHandler, Unsubscribe, WildcardHandler };
|
package/dist/skill/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult
|
|
2
|
-
export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../
|
|
3
|
-
import { S as SkillRegistry } from '../registry-
|
|
4
|
-
export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-
|
|
1
|
+
import { h as SkillScope, i as SkillSource, a as SkillMetadata, g as SkillResourceType, c as SkillResource, b as SkillContent, d as SkillConfig, S as SkillDiscoveryResult } from '../types-BfNpU8NS.js';
|
|
2
|
+
export { R as RemoteSkillEntry, e as RemoteSkillIndex, f as SkillDiscoveryError, j as SkillSourceType } from '../types-BfNpU8NS.js';
|
|
3
|
+
import { S as SkillRegistry } from '../registry-DwYqsQkX.js';
|
|
4
|
+
export { c as createSkillRegistry, e as emptySkillRegistry } from '../registry-DwYqsQkX.js';
|
|
5
|
+
import { T as Tool } from '../tool-BHbyUAy3.js';
|
|
5
6
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
7
|
+
import '../tool-DLXAR9Ce.js';
|
|
7
8
|
import '../types-CHiPh8U2.js';
|
|
8
|
-
import '../types-
|
|
9
|
+
import '../types-CQL-SvTn.js';
|
|
9
10
|
|
|
10
11
|
declare const SKILL_FILENAME = "SKILL.md";
|
|
11
12
|
declare const DEFAULT_SKILL_MAX_SIZE = 102400;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as AgentProfile, D as DEFAULT_MAX_CONCURRENT, c as DEFAULT_MAX_SPAWN_DEPTH, d as DEFAULT_SESSION_TITLE_PREFIX, S as SubAgentCompletedResult, e as SubAgentHandle, f as SubAgentStatus, g as SubAgentToolConfig, h as SubAgentTracker, i as SubAgentUsage, k as createSubAgentTools } from '../index-CWSchSql.js';
|
|
2
2
|
import 'ai';
|
|
3
|
+
import '../types-BnpEOYV-.js';
|
|
3
4
|
import '../types-CQaXbRsS.js';
|
|
4
|
-
import '../tool-
|
|
5
|
+
import '../tool-BHbyUAy3.js';
|
|
5
6
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
7
|
+
import '../tool-DLXAR9Ce.js';
|
|
7
8
|
import '../types-CHiPh8U2.js';
|
|
8
|
-
import '../types-
|
|
9
|
-
import '../runner-
|
|
9
|
+
import '../types-CQL-SvTn.js';
|
|
10
|
+
import '../runner-e2YRcUoX.js';
|
|
10
11
|
import '@ai-sdk/provider-utils';
|
|
12
|
+
import '../events-CE72w8W4.js';
|
|
11
13
|
import '../messages-BYWGn8TY.js';
|
|
14
|
+
import '../types-BfNpU8NS.js';
|
|
12
15
|
import '../session-manager-B_CWGTsl.js';
|
|
13
16
|
import '../types-VQgymC1N.js';
|
|
17
|
+
import '../types-YuWV4ag7.js';
|
|
14
18
|
import '../tracker-DClqYqTj.js';
|
|
15
|
-
import '../builder-
|
|
16
|
-
import '../registry-
|
|
17
|
-
import '../types-
|
|
18
|
-
import '../
|
|
19
|
+
import '../builder-UpOWQMW3.js';
|
|
20
|
+
import '../registry-DwYqsQkX.js';
|
|
21
|
+
import '../types-KKDrdU9Y.js';
|
|
22
|
+
import '../llm-error-D93FNNLY.js';
|
|
23
|
+
import '../types-QKHHQLLq.js';
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { T as Tool } from '../tool-
|
|
2
|
-
export { C as CompatibleSchema, I as InferSchemaOutput,
|
|
3
|
-
import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from '../tool-
|
|
1
|
+
import { T as Tool } from '../tool-BHbyUAy3.js';
|
|
2
|
+
export { C as CompatibleSchema, I as InferSchemaOutput, d as defineTool } from '../tool-BHbyUAy3.js';
|
|
3
|
+
import { a as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext } from '../tool-DLXAR9Ce.js';
|
|
4
4
|
import { T as ToolHost } from '../types-CHiPh8U2.js';
|
|
5
|
-
import { M as MiddlewareRunner } from '../runner-
|
|
5
|
+
import { M as MiddlewareRunner } from '../runner-e2YRcUoX.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../types-
|
|
7
|
+
import '../types-CQL-SvTn.js';
|
|
8
8
|
import 'ai';
|
|
9
9
|
import '@ai-sdk/provider-utils';
|
|
10
|
+
import '../events-CE72w8W4.js';
|
|
10
11
|
import '../messages-BYWGn8TY.js';
|
|
12
|
+
import '../types-BfNpU8NS.js';
|
|
11
13
|
import '../types-CQaXbRsS.js';
|
|
12
14
|
|
|
13
15
|
/**
|
package/dist/tool/index.js
CHANGED
|
@@ -15,9 +15,9 @@ import {
|
|
|
15
15
|
} from "../chunk-P6YF7USR.js";
|
|
16
16
|
import {
|
|
17
17
|
executeAgentToolCall
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-N7P4PN3O.js";
|
|
18
|
+
} from "../chunk-7VKQ4WPB.js";
|
|
20
19
|
import "../chunk-VEKUXUVF.js";
|
|
20
|
+
import "../chunk-N7P4PN3O.js";
|
|
21
21
|
export {
|
|
22
22
|
MAX_BYTES,
|
|
23
23
|
MAX_LINES,
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { T as ToolMetadata, a as ToolReplayPolicy, b as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-DLXAR9Ce.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Tool definition namespace for @cuylabs/agent-core
|
|
6
|
+
*
|
|
7
|
+
* Provides consistent tool creation via Tool.define.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A schema type compatible with both Zod 3 and Zod 4.
|
|
12
|
+
*
|
|
13
|
+
* Uses structural typing so that schemas from either Zod version satisfy
|
|
14
|
+
* the constraint. This avoids the problem where Zod 3's `ZodType` class
|
|
15
|
+
* and Zod 4's `ZodType` class have incompatible internal shapes, causing
|
|
16
|
+
* type errors when a library compiled against one version is consumed with
|
|
17
|
+
* the other.
|
|
18
|
+
*
|
|
19
|
+
* Both Zod 3 and Zod 4 (classic API) schemas have `parse()` and `_output`.
|
|
20
|
+
*/
|
|
21
|
+
interface CompatibleSchema<T = any> {
|
|
22
|
+
/** Parse and validate input data. Present in both Zod 3 and Zod 4. */
|
|
23
|
+
parse(data: unknown): T;
|
|
24
|
+
/**
|
|
25
|
+
* Type-level output marker used by both Zod versions:
|
|
26
|
+
* - Zod 3: `readonly _output!: T` (definite assignment assertion)
|
|
27
|
+
* - Zod 4 classic: `get _output(): T` (getter)
|
|
28
|
+
*/
|
|
29
|
+
readonly _output: T;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Infer the output type from a compatible schema.
|
|
33
|
+
* Equivalent to `z.infer<T>` but works with both Zod 3 and Zod 4 schemas.
|
|
34
|
+
*/
|
|
35
|
+
type InferSchemaOutput<T extends CompatibleSchema> = T["_output"];
|
|
36
|
+
/**
|
|
37
|
+
* Tool namespace - tool definition utilities
|
|
38
|
+
*/
|
|
39
|
+
declare namespace Tool {
|
|
40
|
+
/**
|
|
41
|
+
* Tool info interface - the shape of a defined tool
|
|
42
|
+
*/
|
|
43
|
+
interface Info<TParams extends CompatibleSchema = any, TMeta extends ToolMetadata = ToolMetadata> {
|
|
44
|
+
/** Unique tool identifier */
|
|
45
|
+
id: string;
|
|
46
|
+
/** Recovery semantics for resume-capable runtimes. */
|
|
47
|
+
replayPolicy?: ToolReplayPolicy;
|
|
48
|
+
/** Initialize the tool (can be async for dynamic descriptions) */
|
|
49
|
+
init: (ctx?: InitContext) => Promise<InitResult<TParams, TMeta>> | InitResult<TParams, TMeta>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Any tool info - for use in arrays and collections where generic types vary
|
|
53
|
+
*/
|
|
54
|
+
type AnyInfo = Info<any, any>;
|
|
55
|
+
/**
|
|
56
|
+
* Context passed during tool initialization
|
|
57
|
+
*/
|
|
58
|
+
interface InitContext {
|
|
59
|
+
/** Working directory */
|
|
60
|
+
cwd?: string;
|
|
61
|
+
/** Agent name (if known) */
|
|
62
|
+
agent?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Result of tool initialization
|
|
66
|
+
*/
|
|
67
|
+
interface InitResult<TParams extends CompatibleSchema = any, TMeta extends ToolMetadata = ToolMetadata> {
|
|
68
|
+
/** Tool description for the LLM */
|
|
69
|
+
description: string;
|
|
70
|
+
/** Zod schema for parameters */
|
|
71
|
+
parameters: TParams;
|
|
72
|
+
/** Execute the tool */
|
|
73
|
+
execute: (params: InferSchemaOutput<TParams>, ctx: ToolContext) => Promise<ExecuteResult<TMeta>>;
|
|
74
|
+
/** Optional custom validation error formatter */
|
|
75
|
+
formatValidationError?: (error: z.ZodError) => string;
|
|
76
|
+
/**
|
|
77
|
+
* File operation metadata for automatic turn tracking.
|
|
78
|
+
* When set, the agent will automatically capture file baselines
|
|
79
|
+
* before tool execution for undo/diff capabilities.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* // For a write tool
|
|
84
|
+
* fileOps: {
|
|
85
|
+
* pathArgs: ['path'],
|
|
86
|
+
* operationType: 'write'
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
fileOps?: FileOperationMeta;
|
|
91
|
+
/** Optional replay metadata for resume-capable runtimes. */
|
|
92
|
+
replayPolicy?: ToolReplayPolicy;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Result of tool execution
|
|
96
|
+
*/
|
|
97
|
+
interface ExecuteResult<TMeta extends ToolMetadata = ToolMetadata> {
|
|
98
|
+
/** Short title for display */
|
|
99
|
+
title: string;
|
|
100
|
+
/** Main output text */
|
|
101
|
+
output: string;
|
|
102
|
+
/** Metadata */
|
|
103
|
+
metadata: TMeta;
|
|
104
|
+
}
|
|
105
|
+
interface DefineOptions {
|
|
106
|
+
/** Static replay metadata exposed to higher-level runtimes. */
|
|
107
|
+
replayPolicy?: ToolReplayPolicy;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Define a tool with standard patterns
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```typescript
|
|
114
|
+
* const myTool = Tool.define("my_tool", {
|
|
115
|
+
* description: "Does something useful",
|
|
116
|
+
* parameters: z.object({
|
|
117
|
+
* input: z.string().describe("The input to process"),
|
|
118
|
+
* }),
|
|
119
|
+
* execute: async (params, ctx) => ({
|
|
120
|
+
* title: "Processed",
|
|
121
|
+
* output: `Result: ${params.input}`,
|
|
122
|
+
* metadata: {},
|
|
123
|
+
* }),
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
function define<TParams extends CompatibleSchema, TMeta extends ToolMetadata = ToolMetadata>(id: string, init: Info<TParams, TMeta>["init"] | Awaited<ReturnType<Info<TParams, TMeta>["init"]>>, options?: DefineOptions): Info<TParams, TMeta>;
|
|
128
|
+
/**
|
|
129
|
+
* Simple define for static tools (no async init)
|
|
130
|
+
*/
|
|
131
|
+
function defineSimple<TParams extends CompatibleSchema, TMeta extends ToolMetadata = ToolMetadata>(id: string, config: {
|
|
132
|
+
description: string;
|
|
133
|
+
parameters: TParams;
|
|
134
|
+
execute: (params: InferSchemaOutput<TParams>, ctx: ToolContext) => Promise<ExecuteResult<TMeta>>;
|
|
135
|
+
replayPolicy?: ToolReplayPolicy;
|
|
136
|
+
}): Info<TParams, TMeta>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Legacy helper - wraps to Tool.Info format
|
|
140
|
+
*
|
|
141
|
+
* @deprecated Use Tool.define instead
|
|
142
|
+
*/
|
|
143
|
+
declare function defineTool<TParams extends CompatibleSchema>(definition: {
|
|
144
|
+
id: string;
|
|
145
|
+
description: string;
|
|
146
|
+
parameters: TParams;
|
|
147
|
+
execute: (params: InferSchemaOutput<TParams>, ctx: ToolContext) => Promise<ToolResult>;
|
|
148
|
+
}): Tool.Info<TParams>;
|
|
149
|
+
|
|
150
|
+
export { type CompatibleSchema as C, type InferSchemaOutput as I, Tool as T, defineTool as d };
|
package/dist/tracking/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { T as TurnChangeTracker } from '../tracker-DClqYqTj.js';
|
|
2
2
|
export { F as FileBaseline, a as TurnFileChange, b as TurnSummary, c as TurnTrackerConfig, U as UndoResult, d as createTurnTracker } from '../tracker-DClqYqTj.js';
|
|
3
|
-
import { F as FileOperationMeta } from '../tool-
|
|
3
|
+
import { F as FileOperationMeta } from '../tool-DLXAR9Ce.js';
|
|
4
4
|
import '../types-CHiPh8U2.js';
|
|
5
|
-
import '../types-
|
|
5
|
+
import '../types-CQL-SvTn.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Checkpoint system contracts for @cuylabs/agent-core.
|