zidane 1.6.5 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{agent-BDZbObgy.d.ts → agent-CXMcPke1.d.ts} +62 -56
- package/dist/{chunk-NNMWWSBY.js → chunk-5LOHDFK3.js} +13 -5
- package/dist/{chunk-R7PIZ4MU.js → chunk-GCALAOLD.js} +23 -24
- package/dist/{chunk-UUITMJ7G.js → chunk-QCJKUQTQ.js} +2 -2
- package/dist/{chunk-TWRNLI6I.js → chunk-Z2NZSEBZ.js} +1 -1
- package/dist/harnesses.d.ts +1 -1
- package/dist/harnesses.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +6 -3
- package/dist/session.d.ts +1 -1
- package/dist/session.js +1 -1
- package/dist/{spawn-CQieNB1Y.d.ts → spawn-BUUQxLIp.d.ts} +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +1 -1
|
@@ -64,6 +64,7 @@ type SessionContentBlock = {
|
|
|
64
64
|
} | {
|
|
65
65
|
type: 'thinking';
|
|
66
66
|
text: string;
|
|
67
|
+
signature?: string;
|
|
67
68
|
};
|
|
68
69
|
interface SessionMessage {
|
|
69
70
|
role: 'user' | 'assistant';
|
|
@@ -126,6 +127,35 @@ interface ChildRunStats {
|
|
|
126
127
|
task: string;
|
|
127
128
|
stats: AgentStats;
|
|
128
129
|
}
|
|
130
|
+
/** Base context for tool execution hooks */
|
|
131
|
+
interface ToolHookContext {
|
|
132
|
+
turnId: string;
|
|
133
|
+
callId: string;
|
|
134
|
+
name: string;
|
|
135
|
+
input: Record<string, unknown>;
|
|
136
|
+
}
|
|
137
|
+
/** Base context for MCP tool hooks */
|
|
138
|
+
interface McpToolHookContext {
|
|
139
|
+
turnId: string;
|
|
140
|
+
callId: string;
|
|
141
|
+
server: string;
|
|
142
|
+
tool: string;
|
|
143
|
+
input: Record<string, unknown>;
|
|
144
|
+
}
|
|
145
|
+
/** Base context for session hooks */
|
|
146
|
+
interface SessionHookContext {
|
|
147
|
+
sessionId: string;
|
|
148
|
+
}
|
|
149
|
+
/** Base context for spawn hooks */
|
|
150
|
+
interface SpawnHookContext {
|
|
151
|
+
id: string;
|
|
152
|
+
task: string;
|
|
153
|
+
}
|
|
154
|
+
/** Context for stream hooks */
|
|
155
|
+
interface StreamHookContext {
|
|
156
|
+
turnId: string;
|
|
157
|
+
}
|
|
158
|
+
type SessionEndStatus = 'completed' | 'aborted' | 'error';
|
|
129
159
|
|
|
130
160
|
interface AnthropicParams {
|
|
131
161
|
apiKey?: string;
|
|
@@ -238,6 +268,10 @@ interface ToolContext {
|
|
|
238
268
|
hooks: Hookable<AgentHooks>;
|
|
239
269
|
/** The harness config for this agent (tools available to the agent) */
|
|
240
270
|
harness: HarnessConfig;
|
|
271
|
+
/** Turn ID that requested this tool call */
|
|
272
|
+
turnId: string;
|
|
273
|
+
/** Tool call ID from the model */
|
|
274
|
+
callId: string;
|
|
241
275
|
}
|
|
242
276
|
interface ToolDef {
|
|
243
277
|
spec: ToolSpec;
|
|
@@ -505,43 +539,29 @@ interface AgentHooks {
|
|
|
505
539
|
usage: TurnUsage;
|
|
506
540
|
message: SessionTurn;
|
|
507
541
|
}) => void;
|
|
508
|
-
'stream:text': (ctx: {
|
|
542
|
+
'stream:text': (ctx: StreamHookContext & {
|
|
509
543
|
delta: string;
|
|
510
544
|
text: string;
|
|
511
|
-
turnId: string;
|
|
512
545
|
}) => void;
|
|
513
|
-
'stream:end': (ctx: {
|
|
546
|
+
'stream:end': (ctx: StreamHookContext & {
|
|
514
547
|
text: string;
|
|
515
|
-
turnId: string;
|
|
516
548
|
}) => void;
|
|
517
|
-
'stream:thinking': (ctx: {
|
|
549
|
+
'stream:thinking': (ctx: StreamHookContext & {
|
|
518
550
|
delta: string;
|
|
519
551
|
thinking: string;
|
|
520
|
-
turnId: string;
|
|
521
552
|
}) => void;
|
|
522
|
-
'tool:
|
|
523
|
-
|
|
524
|
-
|
|
553
|
+
'tool:gate': (ctx: ToolHookContext & {
|
|
554
|
+
block: boolean;
|
|
555
|
+
reason: string;
|
|
525
556
|
}) => void;
|
|
526
|
-
'tool:
|
|
527
|
-
|
|
528
|
-
input: Record<string, unknown>;
|
|
557
|
+
'tool:before': (ctx: ToolHookContext) => void;
|
|
558
|
+
'tool:after': (ctx: ToolHookContext & {
|
|
529
559
|
result: string;
|
|
530
560
|
}) => void;
|
|
531
|
-
'tool:error': (ctx: {
|
|
532
|
-
name: string;
|
|
533
|
-
input: Record<string, unknown>;
|
|
561
|
+
'tool:error': (ctx: ToolHookContext & {
|
|
534
562
|
error: Error;
|
|
535
563
|
}) => void;
|
|
536
|
-
'tool:
|
|
537
|
-
name: string;
|
|
538
|
-
input: Record<string, unknown>;
|
|
539
|
-
block: boolean;
|
|
540
|
-
reason: string;
|
|
541
|
-
}) => void;
|
|
542
|
-
'tool:transform': (ctx: {
|
|
543
|
-
name: string;
|
|
544
|
-
input: Record<string, unknown>;
|
|
564
|
+
'tool:transform': (ctx: ToolHookContext & {
|
|
545
565
|
result: string;
|
|
546
566
|
isError: boolean;
|
|
547
567
|
}) => void;
|
|
@@ -551,14 +571,9 @@ interface AgentHooks {
|
|
|
551
571
|
'steer:inject': (ctx: {
|
|
552
572
|
message: string;
|
|
553
573
|
}) => void;
|
|
574
|
+
'spawn:before': (ctx: SpawnHookContext) => void;
|
|
554
575
|
'spawn:complete': (ctx: ChildRunStats) => void;
|
|
555
|
-
'spawn:
|
|
556
|
-
id: string;
|
|
557
|
-
task: string;
|
|
558
|
-
}) => void;
|
|
559
|
-
'spawn:error': (ctx: {
|
|
560
|
-
id: string;
|
|
561
|
-
task: string;
|
|
576
|
+
'spawn:error': (ctx: SpawnHookContext & {
|
|
562
577
|
error: Error;
|
|
563
578
|
}) => void;
|
|
564
579
|
'mcp:connect': (ctx: {
|
|
@@ -573,21 +588,18 @@ interface AgentHooks {
|
|
|
573
588
|
'mcp:close': (ctx: {
|
|
574
589
|
name: string;
|
|
575
590
|
}) => void;
|
|
576
|
-
'mcp:tool:
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
591
|
+
'mcp:tool:gate': (ctx: McpToolHookContext & {
|
|
592
|
+
block: boolean;
|
|
593
|
+
reason: string;
|
|
594
|
+
}) => void;
|
|
595
|
+
'mcp:tool:before': (ctx: McpToolHookContext) => void;
|
|
596
|
+
'mcp:tool:after': (ctx: McpToolHookContext & {
|
|
597
|
+
result: string;
|
|
580
598
|
}) => void;
|
|
581
|
-
'mcp:tool:
|
|
582
|
-
server: string;
|
|
583
|
-
tool: string;
|
|
584
|
-
input: Record<string, unknown>;
|
|
599
|
+
'mcp:tool:transform': (ctx: McpToolHookContext & {
|
|
585
600
|
result: string;
|
|
586
601
|
}) => void;
|
|
587
|
-
'mcp:tool:error': (ctx: {
|
|
588
|
-
server: string;
|
|
589
|
-
tool: string;
|
|
590
|
-
input: Record<string, unknown>;
|
|
602
|
+
'mcp:tool:error': (ctx: McpToolHookContext & {
|
|
591
603
|
error: Error;
|
|
592
604
|
}) => void;
|
|
593
605
|
'skills:resolve': (ctx: {
|
|
@@ -613,29 +625,23 @@ interface AgentHooks {
|
|
|
613
625
|
}) => void;
|
|
614
626
|
'agent:abort': (ctx: object) => void;
|
|
615
627
|
'agent:done': (ctx: AgentStats) => void;
|
|
616
|
-
'session:start': (ctx: {
|
|
617
|
-
sessionId: string;
|
|
628
|
+
'session:start': (ctx: SessionHookContext & {
|
|
618
629
|
runId: string;
|
|
619
630
|
prompt: string;
|
|
620
631
|
}) => void;
|
|
621
|
-
'session:end': (ctx: {
|
|
622
|
-
sessionId: string;
|
|
632
|
+
'session:end': (ctx: SessionHookContext & {
|
|
623
633
|
runId: string;
|
|
624
|
-
status:
|
|
634
|
+
status: SessionEndStatus;
|
|
625
635
|
turnRange: [number, number];
|
|
626
636
|
}) => void;
|
|
627
|
-
'session:turns': (ctx: {
|
|
628
|
-
sessionId: string;
|
|
637
|
+
'session:turns': (ctx: SessionHookContext & {
|
|
629
638
|
count: number;
|
|
630
639
|
}) => void;
|
|
631
|
-
'session:meta': (ctx: {
|
|
632
|
-
sessionId: string;
|
|
640
|
+
'session:meta': (ctx: SessionHookContext & {
|
|
633
641
|
key: string;
|
|
634
642
|
value: unknown;
|
|
635
643
|
}) => void;
|
|
636
|
-
'session:save': (ctx:
|
|
637
|
-
sessionId: string;
|
|
638
|
-
}) => void;
|
|
644
|
+
'session:save': (ctx: SessionHookContext) => void;
|
|
639
645
|
}
|
|
640
646
|
interface AgentOptions {
|
|
641
647
|
/** Harness (tools + system prompt). Defaults to a no-tools harness if omitted. */
|
|
@@ -673,4 +679,4 @@ interface Agent {
|
|
|
673
679
|
}
|
|
674
680
|
declare function createAgent({ harness: harnessOption, provider, behavior: agentBehavior, execution, mcpServers, session, skills: agentSkills, _mcpConnector }: AgentOptions): Agent;
|
|
675
681
|
|
|
676
|
-
export {
|
|
682
|
+
export { fromOpenAI as $, type Agent as A, type ToolDef as B, type CerebrasParams as C, type ToolExecutionMode as D, type ToolHookContext as E, type ToolMap as F, type ToolResult as G, type Harness as H, type ImageContent as I, type ToolSpec as J, type TurnResult as K, type TurnUsage as L, type McpConnection as M, autoDetectAndConvert as N, type OpenRouterParams as O, type Provider as P, connectMcpServers as Q, type RemoteStoreOptions as R, type Session as S, type ThinkingLevel as T, createAgent as U, createMemoryStore as V, createRemoteStore as W, createSession as X, createSqliteStore as Y, defineHarness as Z, fromAnthropic as _, type AgentBehavior as a, loadSession as a0, noTools as a1, toAnthropic as a2, toOpenAI as a3, anthropic as a4, cerebras as a5, openrouter as a6, _default as a7, basicTools as a8, resultToString as a9, type AgentHooks as b, type AgentOptions as c, type AgentRunOptions as d, type AgentStats as e, type AnthropicParams as f, type ChildRunStats as g, type CreateSessionOptions as h, type HarnessConfig as i, type McpServerConfig as j, type McpToolHookContext as k, type SessionContentBlock as l, type SessionData as m, type SessionEndStatus as n, type SessionHookContext as o, type SessionMessage as p, type SessionRun as q, type SessionStore as r, type SessionTurn as s, type SpawnHookContext as t, type SqliteStoreOptions as u, type StreamCallbacks as v, type StreamHookContext as w, type StreamOptions as x, type ToolCall as y, type ToolContext as z };
|
|
@@ -53,15 +53,23 @@ async function connectMcpServers(configs, _clientFactory, hooks) {
|
|
|
53
53
|
description: tool.description || "",
|
|
54
54
|
inputSchema: tool.inputSchema ?? { type: "object", properties: {} }
|
|
55
55
|
},
|
|
56
|
-
execute: async (input,
|
|
57
|
-
|
|
56
|
+
execute: async (input, ctx) => {
|
|
57
|
+
const { turnId, callId } = ctx;
|
|
58
|
+
const gateCtx = { turnId, callId, server: config.name, tool: tool.name, input, block: false, reason: "MCP tool execution was blocked" };
|
|
59
|
+
await hooks?.callHook("mcp:tool:gate", gateCtx);
|
|
60
|
+
if (gateCtx.block)
|
|
61
|
+
return `Blocked: ${gateCtx.reason}`;
|
|
62
|
+
await hooks?.callHook("mcp:tool:before", { turnId, callId, server: config.name, tool: tool.name, input });
|
|
58
63
|
try {
|
|
59
64
|
const result = await client.callTool({ name: tool.name, arguments: input });
|
|
60
|
-
|
|
61
|
-
|
|
65
|
+
let output = resultToString(result.content);
|
|
66
|
+
const transformCtx = { turnId, callId, server: config.name, tool: tool.name, input, result: output };
|
|
67
|
+
await hooks?.callHook("mcp:tool:transform", transformCtx);
|
|
68
|
+
output = transformCtx.result;
|
|
69
|
+
await hooks?.callHook("mcp:tool:after", { turnId, callId, server: config.name, tool: tool.name, input, result: output });
|
|
62
70
|
return output;
|
|
63
71
|
} catch (err) {
|
|
64
|
-
await hooks?.callHook("mcp:tool:error", { server: config.name, tool: tool.name, input, error: err });
|
|
72
|
+
await hooks?.callHook("mcp:tool:error", { turnId, callId, server: config.name, tool: tool.name, input, error: err });
|
|
65
73
|
throw err;
|
|
66
74
|
}
|
|
67
75
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
connectMcpServers
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5LOHDFK3.js";
|
|
4
4
|
import {
|
|
5
5
|
buildCatalog,
|
|
6
6
|
interpolateShellCommands,
|
|
@@ -395,14 +395,10 @@ async function runLoop(ctx) {
|
|
|
395
395
|
});
|
|
396
396
|
continue;
|
|
397
397
|
}
|
|
398
|
-
|
|
399
|
-
await ctx.hooks.callHook("agent:done", stats2);
|
|
400
|
-
return stats2;
|
|
398
|
+
return { totalIn, totalOut, turns: turn + 1, elapsed: Date.now() - startTime, turnUsage: turnUsages, output: result.output };
|
|
401
399
|
}
|
|
402
400
|
}
|
|
403
|
-
|
|
404
|
-
await ctx.hooks.callHook("agent:done", stats);
|
|
405
|
-
return stats;
|
|
401
|
+
return { totalIn, totalOut, turns: maxTurns, elapsed: Date.now() - startTime, turnUsage: turnUsages };
|
|
406
402
|
}
|
|
407
403
|
async function executeTurn(ctx, turn) {
|
|
408
404
|
const turnId = await ctx.generateTurnId();
|
|
@@ -508,7 +504,7 @@ async function executeTurn(ctx, turn) {
|
|
|
508
504
|
}
|
|
509
505
|
return { ended: true, turnId, usage: result.usage };
|
|
510
506
|
}
|
|
511
|
-
const toolResults = ctx.toolExecution === "parallel" ? await executeToolsParallel(ctx, result.toolCalls) : await executeToolsSequential(ctx, result.toolCalls);
|
|
507
|
+
const toolResults = ctx.toolExecution === "parallel" ? await executeToolsParallel(ctx, result.toolCalls, turnId) : await executeToolsSequential(ctx, result.toolCalls, turnId);
|
|
512
508
|
const toolResultMsg = ctx.provider.toolResultsMessage(toolResults);
|
|
513
509
|
ctx.turns.push({
|
|
514
510
|
id: await ctx.generateTurnId(),
|
|
@@ -519,23 +515,24 @@ async function executeTurn(ctx, turn) {
|
|
|
519
515
|
});
|
|
520
516
|
return { ended: false, turnId, usage: result.usage };
|
|
521
517
|
}
|
|
522
|
-
async function executeSingleTool(ctx, call) {
|
|
518
|
+
async function executeSingleTool(ctx, call, turnId) {
|
|
523
519
|
const toolDef = ctx.tools[call.name];
|
|
524
|
-
const
|
|
520
|
+
const callId = call.id;
|
|
521
|
+
const gateCtx = { turnId, callId, name: call.name, input: call.input, block: false, reason: "Tool execution was blocked" };
|
|
525
522
|
await ctx.hooks.callHook("tool:gate", gateCtx);
|
|
526
523
|
if (gateCtx.block) {
|
|
527
|
-
return { result: { id:
|
|
524
|
+
return { result: { id: callId, content: `Blocked: ${gateCtx.reason}` } };
|
|
528
525
|
}
|
|
529
526
|
if (!toolDef) {
|
|
530
527
|
const err = new Error(`Unknown tool: ${call.name}`);
|
|
531
|
-
await ctx.hooks.callHook("tool:error", { name: call.name, input: call.input, error: err });
|
|
532
|
-
return { result: { id:
|
|
528
|
+
await ctx.hooks.callHook("tool:error", { turnId, callId, name: call.name, input: call.input, error: err });
|
|
529
|
+
return { result: { id: callId, content: `Tool error: ${err.message}` } };
|
|
533
530
|
}
|
|
534
531
|
const validation = validateToolArgs(call.input, toolDef.spec.inputSchema);
|
|
535
532
|
if (!validation.valid) {
|
|
536
|
-
return { result: { id:
|
|
533
|
+
return { result: { id: callId, content: `Validation error: ${validation.error}` } };
|
|
537
534
|
}
|
|
538
|
-
await ctx.hooks.callHook("tool:before", { name: call.name, input: call.input });
|
|
535
|
+
await ctx.hooks.callHook("tool:before", { turnId, callId, name: call.name, input: call.input });
|
|
539
536
|
let output;
|
|
540
537
|
let isError = false;
|
|
541
538
|
try {
|
|
@@ -545,22 +542,24 @@ async function executeSingleTool(ctx, call) {
|
|
|
545
542
|
execution: ctx.execution,
|
|
546
543
|
handle: ctx.handle,
|
|
547
544
|
hooks: ctx.hooks,
|
|
548
|
-
harness: ctx.harness
|
|
545
|
+
harness: ctx.harness,
|
|
546
|
+
turnId,
|
|
547
|
+
callId
|
|
549
548
|
};
|
|
550
549
|
output = await toolDef.execute(call.input, toolCtx);
|
|
551
550
|
} catch (err) {
|
|
552
|
-
await ctx.hooks.callHook("tool:error", { name: call.name, input: call.input, error: err });
|
|
551
|
+
await ctx.hooks.callHook("tool:error", { turnId, callId, name: call.name, input: call.input, error: err });
|
|
553
552
|
output = `Tool error: ${err.message}`;
|
|
554
553
|
isError = true;
|
|
555
554
|
}
|
|
556
|
-
const transformCtx = { name: call.name, input: call.input, result: output, isError };
|
|
555
|
+
const transformCtx = { turnId, callId, name: call.name, input: call.input, result: output, isError };
|
|
557
556
|
await ctx.hooks.callHook("tool:transform", transformCtx);
|
|
558
557
|
output = transformCtx.result;
|
|
559
558
|
isError = transformCtx.isError;
|
|
560
|
-
await ctx.hooks.callHook("tool:after", { name: call.name, input: call.input, result: output });
|
|
561
|
-
return { result: { id:
|
|
559
|
+
await ctx.hooks.callHook("tool:after", { turnId, callId, name: call.name, input: call.input, result: output });
|
|
560
|
+
return { result: { id: callId, content: output } };
|
|
562
561
|
}
|
|
563
|
-
async function executeToolsSequential(ctx, toolCalls) {
|
|
562
|
+
async function executeToolsSequential(ctx, toolCalls, turnId) {
|
|
564
563
|
const results = [];
|
|
565
564
|
for (const call of toolCalls) {
|
|
566
565
|
if (ctx.signal.aborted)
|
|
@@ -589,13 +588,13 @@ async function executeToolsSequential(ctx, toolCalls) {
|
|
|
589
588
|
});
|
|
590
589
|
return [];
|
|
591
590
|
}
|
|
592
|
-
const { result } = await executeSingleTool(ctx, call);
|
|
591
|
+
const { result } = await executeSingleTool(ctx, call, turnId);
|
|
593
592
|
results.push(result);
|
|
594
593
|
}
|
|
595
594
|
return results;
|
|
596
595
|
}
|
|
597
|
-
async function executeToolsParallel(ctx, toolCalls) {
|
|
598
|
-
const executions = toolCalls.map((call) => executeSingleTool(ctx, call));
|
|
596
|
+
async function executeToolsParallel(ctx, toolCalls, turnId) {
|
|
597
|
+
const executions = toolCalls.map((call) => executeSingleTool(ctx, call, turnId));
|
|
599
598
|
const settled = await Promise.all(executions);
|
|
600
599
|
return settled.map((s) => s.result);
|
|
601
600
|
}
|
|
@@ -200,7 +200,7 @@ function fromAnthropic(msg) {
|
|
|
200
200
|
const output = typeof b.content === "string" ? b.content : JSON.stringify(b.content);
|
|
201
201
|
content.push({ type: "tool_result", callId: b.tool_use_id, output });
|
|
202
202
|
} else if (b.type === "thinking") {
|
|
203
|
-
content.push({ type: "thinking", text: b.thinking });
|
|
203
|
+
content.push({ type: "thinking", text: b.thinking, signature: b.signature });
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
}
|
|
@@ -269,7 +269,7 @@ function toAnthropic(msg) {
|
|
|
269
269
|
case "tool_result":
|
|
270
270
|
return { type: "tool_result", tool_use_id: block.callId, content: block.output };
|
|
271
271
|
case "thinking":
|
|
272
|
-
return { type: "thinking", thinking: block.text };
|
|
272
|
+
return { type: "thinking", thinking: block.text, signature: block.signature };
|
|
273
273
|
default:
|
|
274
274
|
return { type: "text", text: "" };
|
|
275
275
|
}
|
package/dist/harnesses.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'hookable';
|
|
2
|
-
export { H as Harness, i as HarnessConfig,
|
|
2
|
+
export { H as Harness, i as HarnessConfig, z as ToolContext, B as ToolDef, F as ToolMap, a7 as basic, a8 as basicTools, Z as defineHarness, a1 as noTools } from './agent-CXMcPke1.js';
|
|
3
3
|
import './types-CKXAp41h.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/harnesses.js
CHANGED
|
@@ -3,9 +3,9 @@ import {
|
|
|
3
3
|
basic_default,
|
|
4
4
|
defineHarness,
|
|
5
5
|
noTools
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-Z2NZSEBZ.js";
|
|
7
|
+
import "./chunk-GCALAOLD.js";
|
|
8
|
+
import "./chunk-5LOHDFK3.js";
|
|
9
9
|
import "./chunk-4C6Y56CC.js";
|
|
10
10
|
export {
|
|
11
11
|
basic_default as basic,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, R as RemoteStoreOptions, S as Session,
|
|
1
|
+
export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, k as McpToolHookContext, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, n as SessionEndStatus, o as SessionHookContext, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, t as SpawnHookContext, u as SqliteStoreOptions, w as StreamHookContext, T as ThinkingLevel, z as ToolContext, B as ToolDef, D as ToolExecutionMode, E as ToolHookContext, F as ToolMap, L as TurnUsage, N as autoDetectAndConvert, Q as connectMcpServers, U as createAgent, V as createMemoryStore, W as createRemoteStore, X as createSession, Y as createSqliteStore, Z as defineHarness, _ as fromAnthropic, $ as fromOpenAI, a0 as loadSession, a1 as noTools, a2 as toAnthropic, a3 as toOpenAI } from './agent-CXMcPke1.js';
|
|
2
2
|
import { f as SpawnConfig, b as ExecutionContext } from './types-CKXAp41h.js';
|
|
3
3
|
export { C as ContextCapabilities, a as ContextType, E as ExecResult, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig } from './types-CKXAp41h.js';
|
|
4
4
|
export { S as SandboxProvider, c as createSandboxContext } from './sandbox-DZn3ybp_.js';
|
|
5
5
|
export { buildCatalog, defineSkill, discoverSkills, interpolateShellCommands, mergeSkillsConfig, parseSkillFile, resolveSkills, validateSkillName, writeSkillToDisk, writeSkillsToDisk } from './skills.js';
|
|
6
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-
|
|
6
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-BUUQxLIp.js';
|
|
7
7
|
import 'hookable';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
9
9
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineHarness,
|
|
3
3
|
noTools
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Z2NZSEBZ.js";
|
|
5
5
|
import {
|
|
6
6
|
createAgent,
|
|
7
7
|
createDockerContext,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
createSandboxContext,
|
|
11
11
|
createSpawnTool,
|
|
12
12
|
spawn
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GCALAOLD.js";
|
|
14
14
|
import {
|
|
15
15
|
connectMcpServers
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-5LOHDFK3.js";
|
|
17
17
|
import {
|
|
18
18
|
createMemoryStore,
|
|
19
19
|
createRemoteStore,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
fromOpenAI,
|
|
28
28
|
toAnthropic,
|
|
29
29
|
toOpenAI
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QCJKUQTQ.js";
|
|
31
31
|
import {
|
|
32
32
|
defineSkill
|
|
33
33
|
} from "./chunk-CFLC2I7D.js";
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import 'hookable';
|
|
2
|
-
export { M as McpConnection, j as McpServerConfig,
|
|
2
|
+
export { M as McpConnection, j as McpServerConfig, Q as connectMcpServers, a9 as resultToString } from './agent-CXMcPke1.js';
|
|
3
3
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
4
4
|
import './types-CKXAp41h.js';
|
package/dist/mcp.js
CHANGED
package/dist/providers.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AnthropicParams, C as CerebrasParams, O as OpenRouterParams, P as Provider,
|
|
1
|
+
export { f as AnthropicParams, C as CerebrasParams, O as OpenRouterParams, P as Provider, v as StreamCallbacks, x as StreamOptions, y as ToolCall, G as ToolResult, J as ToolSpec, K as TurnResult, a4 as anthropic, a5 as cerebras, a6 as openrouter } from './agent-CXMcPke1.js';
|
|
2
2
|
import 'hookable';
|
|
3
3
|
import './types-CKXAp41h.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/providers.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
toOAIMessages,
|
|
9
9
|
toolResultsMessage,
|
|
10
10
|
userMessage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QCJKUQTQ.js";
|
|
12
12
|
|
|
13
13
|
// src/providers/anthropic.ts
|
|
14
14
|
import { existsSync, readFileSync } from "fs";
|
|
@@ -109,6 +109,7 @@ function anthropic(anthropicParams) {
|
|
|
109
109
|
type: "enabled",
|
|
110
110
|
budget_tokens: budgetTokens
|
|
111
111
|
};
|
|
112
|
+
params.max_tokens = budgetTokens + params.max_tokens;
|
|
112
113
|
params.temperature = 1;
|
|
113
114
|
}
|
|
114
115
|
if (options.toolChoice) {
|
|
@@ -172,10 +173,11 @@ function cerebras(params) {
|
|
|
172
173
|
async stream(options, callbacks) {
|
|
173
174
|
const modelId = options.model || defaultModel;
|
|
174
175
|
const messages = toOAIMessages(options.system, options.messages);
|
|
176
|
+
const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
|
|
175
177
|
const body = {
|
|
176
178
|
model: modelId,
|
|
177
179
|
messages,
|
|
178
|
-
max_tokens:
|
|
180
|
+
max_tokens: maxTokens,
|
|
179
181
|
stream: true
|
|
180
182
|
};
|
|
181
183
|
if (options.tools && options.tools.length > 0)
|
|
@@ -238,10 +240,11 @@ function openrouter(params) {
|
|
|
238
240
|
if (thinking !== "off" && !modelId.includes(":thinking"))
|
|
239
241
|
modelId = `${modelId}:thinking`;
|
|
240
242
|
const messages = toOAIMessages(options.system, options.messages);
|
|
243
|
+
const maxTokens = options.thinkingBudget ? options.thinkingBudget + options.maxTokens : options.maxTokens;
|
|
241
244
|
const body = {
|
|
242
245
|
model: modelId,
|
|
243
246
|
messages,
|
|
244
|
-
max_tokens:
|
|
247
|
+
max_tokens: maxTokens,
|
|
245
248
|
stream: true
|
|
246
249
|
};
|
|
247
250
|
if (options.tools && options.tools.length > 0)
|
package/dist/session.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { h as CreateSessionOptions, R as RemoteStoreOptions, S as Session,
|
|
1
|
+
export { h as CreateSessionOptions, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, u as SqliteStoreOptions, N as autoDetectAndConvert, V as createMemoryStore, W as createRemoteStore, X as createSession, Y as createSqliteStore, _ as fromAnthropic, $ as fromOpenAI, a0 as loadSession, a2 as toAnthropic, a3 as toOpenAI } from './agent-CXMcPke1.js';
|
|
2
2
|
import 'hookable';
|
|
3
3
|
import './types-CKXAp41h.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/client/index.js';
|
package/dist/session.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as ToolDef, i as HarnessConfig, e as AgentStats } from './agent-CXMcPke1.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Interaction tool — lets the agent request structured input from the outside world.
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-
|
|
2
|
-
import {
|
|
1
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState, c as createInteractionTool, b as createSpawnTool, s as spawn } from './spawn-BUUQxLIp.js';
|
|
2
|
+
import { B as ToolDef } from './agent-CXMcPke1.js';
|
|
3
3
|
export { V as ValidationResult, v as validateToolArgs } from './validation-DOY_k7lW.js';
|
|
4
4
|
import 'hookable';
|
|
5
5
|
import './types-CKXAp41h.js';
|
package/dist/tools.js
CHANGED
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, f as AnthropicParams, C as CerebrasParams, g as ChildRunStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, O as OpenRouterParams, P as Provider, R as RemoteStoreOptions, S as Session,
|
|
1
|
+
export { A as Agent, a as AgentBehavior, b as AgentHooks, c as AgentOptions, d as AgentRunOptions, e as AgentStats, f as AnthropicParams, C as CerebrasParams, g as ChildRunStats, h as CreateSessionOptions, H as Harness, i as HarnessConfig, I as ImageContent, M as McpConnection, j as McpServerConfig, k as McpToolHookContext, O as OpenRouterParams, P as Provider, R as RemoteStoreOptions, S as Session, l as SessionContentBlock, m as SessionData, n as SessionEndStatus, o as SessionHookContext, p as SessionMessage, q as SessionRun, r as SessionStore, s as SessionTurn, t as SpawnHookContext, u as SqliteStoreOptions, v as StreamCallbacks, w as StreamHookContext, x as StreamOptions, T as ThinkingLevel, y as ToolCall, z as ToolContext, B as ToolDef, D as ToolExecutionMode, E as ToolHookContext, F as ToolMap, G as ToolResult, J as ToolSpec, K as TurnResult, L as TurnUsage } from './agent-CXMcPke1.js';
|
|
2
2
|
export { C as ContextCapabilities, a as ContextType, E as ExecResult, b as ExecutionContext, c as ExecutionHandle, S as SkillConfig, d as SkillResource, e as SkillsConfig, f as SpawnConfig } from './types-CKXAp41h.js';
|
|
3
3
|
export { S as SandboxProvider } from './sandbox-DZn3ybp_.js';
|
|
4
|
-
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-
|
|
4
|
+
export { C as ChildAgent, I as InteractionToolOptions, S as SpawnToolOptions, a as SpawnToolState } from './spawn-BUUQxLIp.js';
|
|
5
5
|
export { V as ValidationResult } from './validation-DOY_k7lW.js';
|
|
6
6
|
import 'hookable';
|
|
7
7
|
import '@modelcontextprotocol/sdk/client/index.js';
|