@cuylabs/agent-core 0.7.0 → 0.9.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-BgZ_j4Vs.d.ts} +3 -2
- package/dist/chunk-4QFNWPIF.js +202 -0
- package/dist/chunk-5ARZJWD2.js +259 -0
- package/dist/chunk-DXFBQMXP.js +53 -0
- package/dist/chunk-EKR6PKXU.js +180 -0
- package/dist/{chunk-IVUJDISU.js → chunk-GFTW23FV.js} +5 -14
- package/dist/{chunk-IEFIQENH.js → chunk-H3FUYU52.js} +15 -7
- package/dist/chunk-I6PKJ7XQ.js +292 -0
- package/dist/chunk-IYWQOJMQ.js +102 -0
- package/dist/{chunk-3HNO5SVI.js → chunk-J4QDGZIA.js} +20 -4
- package/dist/{chunk-7MUFEN4K.js → chunk-JLXG2SH7.js} +349 -3
- package/dist/{chunk-CDTV2UYU.js → chunk-MAZ5DY5B.js} +64 -276
- package/dist/{chunk-P6YF7USR.js → chunk-MHKK374K.js} +12 -11
- package/dist/{chunk-VBWWUHWI.js → chunk-OFDKHNCX.js} +4 -1
- package/dist/{chunk-YUUJK53A.js → chunk-RKEW5WXI.js} +1 -1
- package/dist/{chunk-LRHOS4ZN.js → chunk-SPILYYDF.js} +3 -2
- package/dist/{chunk-QGOGIP7T.js → chunk-UDCZ673N.js} +385 -233
- package/dist/{chunk-BDBZ3SLK.js → chunk-UHCJEM2E.js} +39 -2
- package/dist/chunk-WGZAPU6N.js +929 -0
- package/dist/{chunk-5K7AQVOU.js → chunk-WKHDSSXG.js} +130 -209
- package/dist/{chunk-BNSHUWCV.js → chunk-WWYYNWEW.js} +1 -1
- package/dist/context/index.js +1 -1
- package/dist/events-CE72w8W4.d.ts +149 -0
- package/dist/index-BCqEGzBj.d.ts +251 -0
- package/dist/{index-C33hlD6H.d.ts → index-DQuTZ8xL.d.ts} +319 -56
- package/dist/index.d.ts +42 -121
- package/dist/index.js +951 -848
- package/dist/inference/errors/index.d.ts +11 -0
- package/dist/inference/errors/index.js +16 -0
- package/dist/inference/index.d.ts +12 -8
- package/dist/inference/index.js +35 -7
- package/dist/llm-error-D93FNNLY.d.ts +32 -0
- package/dist/middleware/index.d.ts +246 -7
- package/dist/middleware/index.js +3 -1
- package/dist/models/index.d.ts +132 -9
- package/dist/models/index.js +48 -8
- package/dist/models/reasoning/index.d.ts +4 -0
- package/dist/{reasoning → models/reasoning}/index.js +2 -7
- package/dist/plugin/index.d.ts +414 -0
- package/dist/plugin/index.js +32 -0
- package/dist/presets/index.d.ts +53 -0
- package/dist/presets/index.js +30 -0
- package/dist/prompt/index.d.ts +11 -8
- package/dist/prompt/index.js +3 -2
- package/dist/{registry-BDLIHOQB.d.ts → registry-DwYqsQkX.d.ts} +1 -1
- package/dist/runner-CI-XeR16.d.ts +91 -0
- package/dist/runtime/index.d.ts +12 -8
- package/dist/runtime/index.js +8 -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/{session-manager-B_CWGTsl.d.ts → session-manager-KbYt2WUh.d.ts} +8 -0
- 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/skill/index.js +3 -3
- package/dist/storage/index.d.ts +2 -2
- package/dist/storage/index.js +1 -1
- package/dist/sub-agent/index.d.ts +16 -10
- package/dist/sub-agent/index.js +21 -4
- package/dist/tool/index.d.ts +22 -6
- package/dist/tool/index.js +3 -3
- package/dist/tool-CZWN3KbO.d.ts +141 -0
- package/dist/{tool-HUtkiVBx.d.ts → tool-DkhSCV2Y.d.ts} +2 -2
- package/dist/tracking/index.d.ts +2 -2
- package/dist/tracking/index.js +1 -1
- package/dist/{tool-Db1Ue-1U.d.ts → types-BfNpU8NS.d.ts} +1 -150
- package/dist/{types-FRpzzg_9.d.ts → types-BlOKk-Bb.d.ts} +10 -35
- package/dist/types-BlZwmnuW.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/{runner-DSKaEz3z.d.ts → types-DTSkxakL.d.ts} +7 -235
- package/dist/{types-CqDZTh4d.d.ts → types-DmDwi2zI.d.ts} +8 -4
- package/dist/types-YuWV4ag7.d.ts +72 -0
- package/package.json +67 -6
- package/dist/capability-resolver-CgRGsWVX.d.ts +0 -254
- package/dist/chunk-ZPMACVZK.js +0 -305
- package/dist/index-CfBGYrpd.d.ts +0 -317
- package/dist/reasoning/index.d.ts +0 -117
package/dist/prompt/index.js
CHANGED
|
@@ -19,8 +19,9 @@ import {
|
|
|
19
19
|
getTemplate,
|
|
20
20
|
loadGlobalInstructions,
|
|
21
21
|
summarizeEnvironment
|
|
22
|
-
} from "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-GFTW23FV.js";
|
|
23
|
+
import "../chunk-SPILYYDF.js";
|
|
24
|
+
import "../chunk-I6PKJ7XQ.js";
|
|
24
25
|
export {
|
|
25
26
|
DEFAULT_INSTRUCTION_PATTERNS,
|
|
26
27
|
DEFAULT_MAX_DEPTH,
|
|
@@ -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
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { A as AgentMiddleware, M as ModelCallInput, a as ModelCallContext, B as BlockedModelCall, S as StreamChunk, b as ModelCallOutput, T as ToolCallDecision, P as PromptBuildContext, c as PromptSection } from './types-DTSkxakL.js';
|
|
2
|
+
import { A as AgentEvent } from './events-CE72w8W4.js';
|
|
3
|
+
import { T as TokenUsage } from './messages-BYWGn8TY.js';
|
|
4
|
+
import { T as ToolContext } from './tool-DkhSCV2Y.js';
|
|
5
|
+
import { T as Tool } from './tool-CZWN3KbO.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Middleware Runner
|
|
9
|
+
*
|
|
10
|
+
* Executes middleware hooks in the correct order with proper
|
|
11
|
+
* error handling and short-circuit semantics.
|
|
12
|
+
*
|
|
13
|
+
* This is the internal engine — consumers never see it.
|
|
14
|
+
* They interact with middleware through AgentConfig.middleware.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Middleware runner — holds an ordered list of middleware and
|
|
19
|
+
* exposes methods to run each hook type with correct semantics.
|
|
20
|
+
*
|
|
21
|
+
* Immutable after construction. Fork creates a new runner
|
|
22
|
+
* (with inherited + additional middleware).
|
|
23
|
+
*/
|
|
24
|
+
declare class MiddlewareRunner {
|
|
25
|
+
private readonly stack;
|
|
26
|
+
constructor(middleware?: AgentMiddleware[]);
|
|
27
|
+
/** Number of registered middleware */
|
|
28
|
+
get count(): number;
|
|
29
|
+
/** Whether any middleware is registered */
|
|
30
|
+
get hasMiddleware(): boolean;
|
|
31
|
+
/** Get the middleware list (for fork inheritance) */
|
|
32
|
+
getMiddleware(): readonly AgentMiddleware[];
|
|
33
|
+
runModelInput(input: ModelCallInput, ctx: ModelCallContext): Promise<ModelCallInput | BlockedModelCall>;
|
|
34
|
+
runModelChunk(chunk: StreamChunk, ctx: ModelCallContext): Promise<StreamChunk | undefined>;
|
|
35
|
+
runModelOutput(output: ModelCallOutput, ctx: ModelCallContext): Promise<ModelCallOutput>;
|
|
36
|
+
/**
|
|
37
|
+
* Run all `beforeToolCall` hooks in order.
|
|
38
|
+
*
|
|
39
|
+
* Returns `{ action: "allow" }` if all middleware allow (or have no hook).
|
|
40
|
+
* Returns `{ action: "deny", reason }` on first denial — remaining
|
|
41
|
+
* middleware are skipped.
|
|
42
|
+
*/
|
|
43
|
+
runBeforeToolCall(tool: string, args: unknown, ctx: ToolContext): Promise<ToolCallDecision>;
|
|
44
|
+
/**
|
|
45
|
+
* Run all `afterToolCall` hooks in reverse order.
|
|
46
|
+
*
|
|
47
|
+
* Each hook receives the result from the previous hook (or the
|
|
48
|
+
* original tool result for the first hook). Errors are caught
|
|
49
|
+
* and logged — the original result passes through.
|
|
50
|
+
*/
|
|
51
|
+
runAfterToolCall(tool: string, args: unknown, result: Tool.ExecuteResult, ctx: ToolContext): Promise<Tool.ExecuteResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Collect prompt sections from all middleware.
|
|
54
|
+
*
|
|
55
|
+
* Returns a flat array of sections. Each middleware can return a single
|
|
56
|
+
* section, an array of sections, or undefined/empty.
|
|
57
|
+
*/
|
|
58
|
+
collectPromptSections(ctx: PromptBuildContext): PromptSection[];
|
|
59
|
+
/**
|
|
60
|
+
* Broadcast an event to all middleware observers.
|
|
61
|
+
*
|
|
62
|
+
* Non-blocking — errors are caught and logged. This never
|
|
63
|
+
* slows down the streaming pipeline.
|
|
64
|
+
*/
|
|
65
|
+
emitEvent(event: AgentEvent): void;
|
|
66
|
+
/**
|
|
67
|
+
* Get the OTel context for a session from the telemetry middleware.
|
|
68
|
+
* Returns undefined if no telemetry middleware is registered.
|
|
69
|
+
*/
|
|
70
|
+
getOtelContext(sessionId: string): unknown | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Run all `onChatStart` hooks in order.
|
|
73
|
+
*
|
|
74
|
+
* Errors are caught and logged — a broken logger should not
|
|
75
|
+
* prevent the chat from starting.
|
|
76
|
+
*/
|
|
77
|
+
runChatStart(sessionId: string, message: string): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Run all `onChatEnd` hooks in order.
|
|
80
|
+
*
|
|
81
|
+
* Always called, even when the stream errored. Errors in handlers
|
|
82
|
+
* are caught and logged.
|
|
83
|
+
*/
|
|
84
|
+
runChatEnd(sessionId: string, result: {
|
|
85
|
+
usage?: TokenUsage;
|
|
86
|
+
error?: Error;
|
|
87
|
+
output?: string;
|
|
88
|
+
}): Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { MiddlewareRunner as M };
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
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-DmDwi2zI.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-DmDwi2zI.js';
|
|
6
|
+
import { A as AnyInferenceResult } from '../types-BlOKk-Bb.js';
|
|
7
7
|
import { ModelMessage } from 'ai';
|
|
8
|
-
import '
|
|
9
|
-
import '../tool-Db1Ue-1U.js';
|
|
8
|
+
import '../tool-CZWN3KbO.js';
|
|
10
9
|
import 'zod';
|
|
11
|
-
import '../tool-
|
|
10
|
+
import '../tool-DkhSCV2Y.js';
|
|
12
11
|
import '../types-CHiPh8U2.js';
|
|
12
|
+
import '../runner-CI-XeR16.js';
|
|
13
|
+
import '../types-DTSkxakL.js';
|
|
14
|
+
import '@ai-sdk/provider-utils';
|
|
15
|
+
import '../types-BfNpU8NS.js';
|
|
13
16
|
import '../types-CQaXbRsS.js';
|
|
17
|
+
import '../llm-error-D93FNNLY.js';
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* Doom loop error thrown when repeated tool calls are detected.
|
package/dist/runtime/index.js
CHANGED
|
@@ -30,14 +30,15 @@ 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-J4QDGZIA.js";
|
|
34
|
+
import "../chunk-WWYYNWEW.js";
|
|
35
|
+
import "../chunk-WKHDSSXG.js";
|
|
36
|
+
import "../chunk-H3FUYU52.js";
|
|
39
37
|
import "../chunk-VEKUXUVF.js";
|
|
40
|
-
import "../chunk-
|
|
38
|
+
import "../chunk-4QFNWPIF.js";
|
|
39
|
+
import "../chunk-N7P4PN3O.js";
|
|
40
|
+
import "../chunk-UDCZ673N.js";
|
|
41
|
+
import "../chunk-I6PKJ7XQ.js";
|
|
41
42
|
export {
|
|
42
43
|
AgentTurnEngine,
|
|
43
44
|
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;
|
|
@@ -256,6 +256,14 @@ declare class SessionManager {
|
|
|
256
256
|
readFiles?: string[];
|
|
257
257
|
modifiedFiles?: string[];
|
|
258
258
|
}): Promise<string>;
|
|
259
|
+
replaceWithCompaction(options: {
|
|
260
|
+
summary: string;
|
|
261
|
+
messages: Message[];
|
|
262
|
+
tokensBefore: number;
|
|
263
|
+
tokensAfter: number;
|
|
264
|
+
readFiles?: string[];
|
|
265
|
+
modifiedFiles?: string[];
|
|
266
|
+
}): Promise<string>;
|
|
259
267
|
branch(fromEntryId: string, summary?: string): Promise<string>;
|
|
260
268
|
switchToLeaf(leafId: string): void;
|
|
261
269
|
updateMetadata(updates: {
|
|
@@ -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-CZWN3KbO.js';
|
|
5
6
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
7
|
+
import '../tool-DkhSCV2Y.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;
|
package/dist/skill/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import {
|
|
|
2
2
|
createSkillResourceTool,
|
|
3
3
|
createSkillTool,
|
|
4
4
|
createSkillTools
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-RKEW5WXI.js";
|
|
6
|
+
import "../chunk-MHKK374K.js";
|
|
7
7
|
import {
|
|
8
8
|
DEFAULT_EXTERNAL_DIRS,
|
|
9
9
|
DEFAULT_MAX_SCAN_DEPTH,
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
loadSkillContent,
|
|
19
19
|
loadSkillMetadata,
|
|
20
20
|
parseFrontmatter
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-SPILYYDF.js";
|
|
22
22
|
export {
|
|
23
23
|
DEFAULT_EXTERNAL_DIRS,
|
|
24
24
|
DEFAULT_MAX_SCAN_DEPTH,
|
package/dist/storage/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FileEntry, g as SessionEntry, M as MessageEntry, c as MetadataEntry, e as SerializedMessage, i as SessionInfo, j as SessionStorage, h as SessionHeader, S as SessionManager } from '../session-manager-
|
|
2
|
-
export { B as BranchEntry, C as CompactionEntry, a as ConfigChangeEntry, b as CreateSessionOptions, E as EntryBase, d as STORAGE_VERSION, f as SessionContext } from '../session-manager-
|
|
1
|
+
import { F as FileEntry, g as SessionEntry, M as MessageEntry, c as MetadataEntry, e as SerializedMessage, i as SessionInfo, j as SessionStorage, h as SessionHeader, S as SessionManager } from '../session-manager-KbYt2WUh.js';
|
|
2
|
+
export { B as BranchEntry, C as CompactionEntry, a as ConfigChangeEntry, b as CreateSessionOptions, E as EntryBase, d as STORAGE_VERSION, f as SessionContext } from '../session-manager-KbYt2WUh.js';
|
|
3
3
|
import { M as Message } from '../messages-BYWGn8TY.js';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/storage/index.js
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
export { c as AgentProfile, D as DEFAULT_MAX_CONCURRENT,
|
|
1
|
+
export { b as AgentDiscoveryOptions, c as AgentDiscoveryResult, d as AgentProfile, e as AgentSource, D as DEFAULT_MAX_CONCURRENT, f as DEFAULT_MAX_SPAWN_DEPTH, g as DEFAULT_SESSION_TITLE_PREFIX, h as DiscoveredProfile, M as MarkdownAgentFrontmatter, i as MarkdownAgentProfile, j as ParsedMarkdownAgent, k as ParsedToolSpec, l as ProfileResolvers, S as SubAgentCompletedResult, m as SubAgentHandle, n as SubAgentStatus, o as SubAgentToolConfig, p as SubAgentTracker, q as SubAgentUsage, T as ToolModifier, t as createSubAgentTools, u as discoverAgentProfiles, v as getProjectAgentsDir, w as getUserAgentsDir, x as isMarkdownProfile, y as parseAgentFrontmatter, z as parseMarkdownAgent, B as parseToolSpec, E as toAgentProfile } from '../index-DQuTZ8xL.js';
|
|
2
2
|
import 'ai';
|
|
3
|
+
import '../types-BlZwmnuW.js';
|
|
3
4
|
import '../types-CQaXbRsS.js';
|
|
4
|
-
import '../tool-
|
|
5
|
+
import '../tool-CZWN3KbO.js';
|
|
5
6
|
import 'zod';
|
|
6
|
-
import '../tool-
|
|
7
|
+
import '../tool-DkhSCV2Y.js';
|
|
7
8
|
import '../types-CHiPh8U2.js';
|
|
8
|
-
import '../types-
|
|
9
|
-
import '../
|
|
9
|
+
import '../types-CQL-SvTn.js';
|
|
10
|
+
import '../types-DTSkxakL.js';
|
|
10
11
|
import '@ai-sdk/provider-utils';
|
|
12
|
+
import '../events-CE72w8W4.js';
|
|
11
13
|
import '../messages-BYWGn8TY.js';
|
|
12
|
-
import '../
|
|
14
|
+
import '../types-BfNpU8NS.js';
|
|
15
|
+
import '../session-manager-KbYt2WUh.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 '../
|
|
18
|
-
import '../types-
|
|
19
|
+
import '../builder-BgZ_j4Vs.js';
|
|
20
|
+
import '../registry-DwYqsQkX.js';
|
|
21
|
+
import '../runner-CI-XeR16.js';
|
|
22
|
+
import '../types-BlOKk-Bb.js';
|
|
23
|
+
import '../llm-error-D93FNNLY.js';
|
|
24
|
+
import '../types-DmDwi2zI.js';
|
package/dist/sub-agent/index.js
CHANGED
|
@@ -3,13 +3,30 @@ import {
|
|
|
3
3
|
DEFAULT_MAX_SPAWN_DEPTH,
|
|
4
4
|
DEFAULT_SESSION_TITLE_PREFIX,
|
|
5
5
|
SubAgentTracker,
|
|
6
|
-
createSubAgentTools
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
createSubAgentTools,
|
|
7
|
+
discoverAgentProfiles,
|
|
8
|
+
getProjectAgentsDir,
|
|
9
|
+
getUserAgentsDir,
|
|
10
|
+
isMarkdownProfile,
|
|
11
|
+
parseAgentFrontmatter,
|
|
12
|
+
parseMarkdownAgent,
|
|
13
|
+
parseToolSpec,
|
|
14
|
+
toAgentProfile
|
|
15
|
+
} from "../chunk-JLXG2SH7.js";
|
|
16
|
+
import "../chunk-EKR6PKXU.js";
|
|
17
|
+
import "../chunk-MHKK374K.js";
|
|
9
18
|
export {
|
|
10
19
|
DEFAULT_MAX_CONCURRENT,
|
|
11
20
|
DEFAULT_MAX_SPAWN_DEPTH,
|
|
12
21
|
DEFAULT_SESSION_TITLE_PREFIX,
|
|
13
22
|
SubAgentTracker,
|
|
14
|
-
createSubAgentTools
|
|
23
|
+
createSubAgentTools,
|
|
24
|
+
discoverAgentProfiles,
|
|
25
|
+
getProjectAgentsDir,
|
|
26
|
+
getUserAgentsDir,
|
|
27
|
+
isMarkdownProfile,
|
|
28
|
+
parseAgentFrontmatter,
|
|
29
|
+
parseMarkdownAgent,
|
|
30
|
+
parseToolSpec,
|
|
31
|
+
toAgentProfile
|
|
15
32
|
};
|
package/dist/tool/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { T as Tool } from '../tool-
|
|
2
|
-
export { C as CompatibleSchema, I as InferSchemaOutput,
|
|
3
|
-
import {
|
|
1
|
+
import { T as Tool } from '../tool-CZWN3KbO.js';
|
|
2
|
+
export { C as CompatibleSchema, I as InferSchemaOutput, d as defineTool } from '../tool-CZWN3KbO.js';
|
|
3
|
+
import { b as ToolReplayPolicy, F as FileOperationMeta, N as NormalizedToolReplayPolicy, d as TurnTrackerContext, a as ToolMetadata } from '../tool-DkhSCV2Y.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-CI-XeR16.js';
|
|
6
6
|
import 'zod';
|
|
7
|
-
import '../types-
|
|
7
|
+
import '../types-CQL-SvTn.js';
|
|
8
|
+
import '../types-DTSkxakL.js';
|
|
8
9
|
import 'ai';
|
|
9
10
|
import '@ai-sdk/provider-utils';
|
|
11
|
+
import '../events-CE72w8W4.js';
|
|
10
12
|
import '../messages-BYWGn8TY.js';
|
|
13
|
+
import '../types-BfNpU8NS.js';
|
|
11
14
|
import '../types-CQaXbRsS.js';
|
|
12
15
|
|
|
13
16
|
/**
|
|
@@ -139,7 +142,10 @@ interface TruncateResult {
|
|
|
139
142
|
outputPath?: string;
|
|
140
143
|
}
|
|
141
144
|
/**
|
|
142
|
-
* Truncate output if it exceeds limits
|
|
145
|
+
* Truncate output if it exceeds limits.
|
|
146
|
+
*
|
|
147
|
+
* When truncation occurs the full output is written to a temp file
|
|
148
|
+
* **synchronously** so the path is valid immediately.
|
|
143
149
|
*/
|
|
144
150
|
declare function truncateOutput(output: string, options?: {
|
|
145
151
|
maxLines?: number;
|
|
@@ -162,9 +168,19 @@ interface ExecuteAgentToolCallOptions {
|
|
|
162
168
|
host?: ToolHost;
|
|
163
169
|
turnTracker?: TurnTrackerContext;
|
|
164
170
|
middleware?: MiddlewareRunner;
|
|
171
|
+
/**
|
|
172
|
+
* Pre-initialized tool result. When provided the executor skips
|
|
173
|
+
* `tool.init()` and uses this directly, avoiding double-init when
|
|
174
|
+
* the caller (e.g. `buildToolSet`) has already initialized the tool.
|
|
175
|
+
*/
|
|
176
|
+
initialized?: Awaited<ReturnType<Tool.Info["init"]>>;
|
|
165
177
|
}
|
|
166
178
|
interface ExecuteAgentToolCallResult {
|
|
167
179
|
output: string;
|
|
180
|
+
/** Short title for display (populated when middleware preserves it). */
|
|
181
|
+
title?: string;
|
|
182
|
+
/** Tool metadata (populated when middleware preserves it). */
|
|
183
|
+
metadata?: ToolMetadata;
|
|
168
184
|
}
|
|
169
185
|
/**
|
|
170
186
|
* Execute one initialized framework tool with the same semantics used by the
|
package/dist/tool/index.js
CHANGED
|
@@ -12,12 +12,12 @@ import {
|
|
|
12
12
|
formatSize,
|
|
13
13
|
normalizeToolReplayPolicy,
|
|
14
14
|
truncateOutput
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-MHKK374K.js";
|
|
16
16
|
import {
|
|
17
17
|
executeAgentToolCall
|
|
18
|
-
} from "../chunk-
|
|
19
|
-
import "../chunk-N7P4PN3O.js";
|
|
18
|
+
} from "../chunk-H3FUYU52.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,141 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { a as ToolMetadata, b as ToolReplayPolicy, T as ToolContext, F as FileOperationMeta, c as ToolResult } from './tool-DkhSCV2Y.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
|
+
/**
|
|
130
|
+
* Legacy helper - wraps to Tool.Info format
|
|
131
|
+
*
|
|
132
|
+
* @deprecated Use Tool.define instead
|
|
133
|
+
*/
|
|
134
|
+
declare function defineTool<TParams extends CompatibleSchema>(definition: {
|
|
135
|
+
id: string;
|
|
136
|
+
description: string;
|
|
137
|
+
parameters: TParams;
|
|
138
|
+
execute: (params: InferSchemaOutput<TParams>, ctx: ToolContext) => Promise<ToolResult>;
|
|
139
|
+
}): Tool.Info<TParams>;
|
|
140
|
+
|
|
141
|
+
export { type CompatibleSchema as C, type InferSchemaOutput as I, Tool as T, defineTool as d };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as ToolHost } from './types-CHiPh8U2.js';
|
|
2
|
-
import {
|
|
2
|
+
import { S as ScopeSnapshot } from './types-CQL-SvTn.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Tool-related types for @cuylabs/agent-core
|
|
@@ -142,4 +142,4 @@ interface ToolMetadata {
|
|
|
142
142
|
[key: string]: unknown;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
export type { FileOperationMeta as F, NormalizedToolReplayPolicy as N,
|
|
145
|
+
export type { FileOperationMeta as F, NormalizedToolReplayPolicy as N, ToolContext as T, ToolMetadata as a, ToolReplayPolicy as b, ToolResult as c, TurnTrackerContext as d, ToolReplayMode as e, ToolSideEffectLevel as f };
|
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-DkhSCV2Y.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.
|