@myagentroam/agent 0.11.39 → 0.11.41
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/cli/catalog-file.d.ts +2 -0
- package/dist/cli/main.js +11 -4
- package/dist/cli/subagent/control.d.ts +56 -0
- package/dist/cli/subagent/control.js +219 -0
- package/dist/cli/subagent/history.d.ts +17 -0
- package/dist/cli/subagent/history.js +85 -0
- package/dist/cli/subagent/index.d.ts +10 -0
- package/dist/cli/subagent/index.js +94 -0
- package/dist/cli/subagent/native.d.ts +91 -0
- package/dist/cli/subagent/native.js +359 -0
- package/dist/cli/subagent/observations.d.ts +57 -0
- package/dist/cli/subagent/observations.js +351 -0
- package/dist/cli/subagent/query.d.ts +4 -0
- package/dist/cli/subagent/query.js +114 -0
- package/dist/cli/subagent/resources.d.ts +3 -0
- package/dist/cli/subagent/resources.js +112 -0
- package/dist/cli/subagent/snapshot.d.ts +77 -0
- package/dist/cli/subagent/snapshot.js +127 -0
- package/dist/cli/subagent/start.d.ts +24 -0
- package/dist/cli/subagent/start.js +201 -0
- package/dist/cli/subagent/wait-output.d.ts +19 -0
- package/dist/cli/subagent/wait-output.js +56 -0
- package/dist/cli/subagent/wait.d.ts +175 -0
- package/dist/cli/subagent/wait.js +453 -0
- package/dist/extensions/contracts.d.ts +2 -5
- package/dist/extensions/manager.d.ts +0 -2
- package/dist/extensions/manager.js +1 -2
- package/dist/extensions/models.d.ts +3 -0
- package/dist/extensions/operation.d.ts +8 -0
- package/dist/extensions/operation.js +3 -0
- package/dist/extensions/services.d.ts +9 -1
- package/dist/extensions/services.js +26 -3
- package/dist/extensions/session-context.d.ts +18 -0
- package/dist/extensions/session-context.js +4 -0
- package/dist/extensions/session-input.d.ts +2 -2
- package/dist/extensions/session-input.js +3 -4
- package/dist/extensions/session-messages.d.ts +1 -1
- package/dist/extensions/session-tools.js +20 -3
- package/dist/extensions/session.d.ts +1 -4
- package/dist/extensions/session.js +2 -16
- package/dist/extensions/tools.js +21 -3
- package/dist/extensions.d.ts +5 -2
- package/dist/extensions.js +2 -1
- package/dist/host/local-agent-host.d.ts +2 -2
- package/dist/host/local-exec-tool.d.ts +1 -1
- package/dist/host/local-exec-tool.js +28 -3
- package/dist/host/local-tool-registry.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/model/configuration.d.ts +3 -1
- package/dist/model/configuration.js +1 -0
- package/dist/model/openai-responses.js +5 -0
- package/dist/model/responses-request.js +9 -0
- package/dist/prompts/index.js +1 -3
- package/dist/prompts/permissions.d.ts +1 -1
- package/dist/prompts/permissions.js +1 -0
- package/dist/prompts/resources.d.ts +1 -5
- package/dist/prompts/resources.js +3 -12
- package/dist/prompts/subagent.d.ts +1 -1
- package/dist/prompts/subagent.js +1 -1
- package/dist/runtime/context/gc-candidates-web.d.ts +6 -0
- package/dist/runtime/context/gc-candidates-web.js +53 -1
- package/dist/runtime/context/gc-candidates.js +1 -9
- package/dist/runtime/context/gc.js +19 -11
- package/dist/runtime/context/projection.js +1 -0
- package/dist/runtime/events.d.ts +4 -3
- package/dist/runtime/execution-handle.d.ts +2 -0
- package/dist/runtime/wait.js +12 -2
- package/dist/sdk/agent.js +94 -5
- package/dist/sdk/execution-context-coordinator.d.ts +2 -3
- package/dist/sdk/execution-context-coordinator.js +3 -3
- package/dist/sdk/execution-input.d.ts +3 -4
- package/dist/sdk/execution-input.js +31 -25
- package/dist/sdk/execution-round-preparation.d.ts +1 -1
- package/dist/sdk/execution-round-preparation.js +4 -4
- package/dist/sdk/execution-tool-catalog.js +2 -10
- package/dist/sdk/execution-tool-scope.d.ts +1 -3
- package/dist/sdk/execution-tool-scope.js +10 -12
- package/dist/sdk/extension-models.js +3 -0
- package/dist/sdk/extension-session-launch.d.ts +3 -2
- package/dist/sdk/extension-session-launch.js +2 -3
- package/dist/sdk/extension-tools.js +0 -2
- package/dist/sdk/native-steer.d.ts +2 -2
- package/dist/sdk/native-steer.js +2 -2
- package/dist/sdk/session-composition.d.ts +2 -17
- package/dist/sdk/session-execution-factory.d.ts +2 -3
- package/dist/sdk/session-execution-factory.js +20 -114
- package/dist/sdk/session-execution.d.ts +13 -7
- package/dist/sdk/session-execution.js +11 -3
- package/dist/sdk/session-extension-messages.d.ts +1 -3
- package/dist/sdk/session-extension-messages.js +14 -9
- package/dist/sdk/session-extension-prompt.js +1 -3
- package/dist/sdk/session-maintenance.d.ts +1 -0
- package/dist/sdk/session-maintenance.js +16 -7
- package/dist/sdk/session-open.d.ts +2 -3
- package/dist/sdk/session-open.js +5 -24
- package/dist/sdk/session-runtime.d.ts +19 -8
- package/dist/sdk/session-runtime.js +36 -30
- package/dist/sdk/session.d.ts +3 -2
- package/dist/sdk/session.js +22 -89
- package/dist/sdk/types.d.ts +36 -0
- package/dist/session/catalog.d.ts +22 -1
- package/dist/session/catalog.js +102 -0
- package/dist/session/context-gc-checkpoint.js +30 -1
- package/dist/session/context-gc-contract.d.ts +7 -0
- package/dist/session/context-gc-replacements.d.ts +3 -0
- package/dist/session/context-gc-replacements.js +26 -0
- package/dist/session/store/contracts.d.ts +2 -2
- package/dist/session/store/jsonl/directory-index.d.ts +1 -1
- package/dist/session/store/jsonl/directory-index.js +18 -17
- package/dist/session/store/jsonl/history.js +1 -1
- package/dist/session/store/jsonl/index-transaction.js +2 -8
- package/dist/session/store/jsonl/jsonl-store.d.ts +1 -1
- package/dist/session/store/jsonl/jsonl-store.js +24 -9
- package/dist/session/store/jsonl/resources.js +5 -1
- package/dist/session/types.d.ts +1 -0
- package/dist/tools/agent/sleep.js +1 -1
- package/dist/tools/callers.js +1 -12
- package/dist/tools/code-mode/dispatch.js +5 -2
- package/dist/tools/code-mode/index.d.ts +1 -1
- package/dist/tools/code-mode/index.js +4 -2
- package/dist/tools/contracts.d.ts +20 -0
- package/dist/tools/execution-limits.d.ts +5 -20
- package/dist/tools/execution-limits.js +0 -2
- package/dist/tools/execution.js +16 -4
- package/dist/tools/local/exec.js +8 -2
- package/dist/tools/output-projection.d.ts +5 -2
- package/dist/tools/output-projection.js +133 -92
- package/dist/tools/permissions.d.ts +0 -1
- package/dist/tools/permissions.js +1 -9
- package/dist/tools/registry.js +1 -13
- package/dist/tools/runtime-context.d.ts +1 -21
- package/package.json +2 -2
- package/dist/extensions/agents.d.ts +0 -100
- package/dist/extensions/agents.js +0 -121
- package/dist/runtime/context/gc-candidates-subagent.d.ts +0 -6
- package/dist/runtime/context/gc-candidates-subagent.js +0 -100
- package/dist/sdk/extension-agent-controller.d.ts +0 -3
- package/dist/sdk/extension-agent-controller.js +0 -69
- package/dist/sdk/extension-agents.d.ts +0 -9
- package/dist/sdk/extension-agents.js +0 -58
- package/dist/sdk/subagent-backend.d.ts +0 -3
- package/dist/sdk/subagent-backend.js +0 -49
- package/dist/subagent/contracts.d.ts +0 -107
- package/dist/subagent/contracts.js +0 -1
- package/dist/subagent/limits.d.ts +0 -17
- package/dist/subagent/limits.js +0 -17
- package/dist/subagent/model-update.d.ts +0 -2
- package/dist/subagent/model-update.js +0 -81
- package/dist/subagent/session-controller.d.ts +0 -87
- package/dist/subagent/session-controller.js +0 -1343
- package/dist/subagent/task.d.ts +0 -134
- package/dist/subagent/task.js +0 -436
- package/dist/subagent/turn-contracts.d.ts +0 -64
- package/dist/subagent/turn-contracts.js +0 -1
- package/dist/subagent/wait-targets.d.ts +0 -10
- package/dist/subagent/wait-targets.js +0 -26
- package/dist/subagent/wait.d.ts +0 -26
- package/dist/subagent/wait.js +0 -73
- package/dist/tools/agent/agent-cancel.d.ts +0 -7
- package/dist/tools/agent/agent-cancel.js +0 -29
- package/dist/tools/agent/agent-message.d.ts +0 -7
- package/dist/tools/agent/agent-message.js +0 -57
- package/dist/tools/agent/agent-start.d.ts +0 -12
- package/dist/tools/agent/agent-start.js +0 -106
- package/dist/tools/agent/agent-wait.d.ts +0 -7
- package/dist/tools/agent/agent-wait.js +0 -91
|
@@ -115,7 +115,7 @@ export declare class JsonlSessionStore implements SessionStore {
|
|
|
115
115
|
/** A warm cell retains physical writer ownership between Executions of the same Agent. */
|
|
116
116
|
acquireSessionLease(sessionId: string, owner?: object): Promise<() => Promise<void>>;
|
|
117
117
|
hasRetainedSessionLease(sessionId: string, owner: object): boolean;
|
|
118
|
-
acquireSessionMaintenance(sessionId: string, kind: 'clear' | 'delete', owner?: object): Promise<SessionStoreMaintenance>;
|
|
118
|
+
acquireSessionMaintenance(sessionId: string, kind: 'clear' | 'delete', owner?: object, members?: readonly string[]): Promise<SessionStoreMaintenance>;
|
|
119
119
|
/** Native writes join their Agent's sole writer, without admitting another Execution. */
|
|
120
120
|
acquireSessionWriteLease(sessionId: string, owner: object): Promise<() => Promise<void>>;
|
|
121
121
|
retainSessionLease(sessionId: string, owner: object): Promise<() => Promise<void>>;
|
|
@@ -219,20 +219,21 @@ export class JsonlSessionStore {
|
|
|
219
219
|
async createSession(input) {
|
|
220
220
|
this.#assertOpen();
|
|
221
221
|
const source = normalizeSessionSource(input.source);
|
|
222
|
-
if (source.
|
|
222
|
+
if (source.parentSessionId === undefined)
|
|
223
223
|
return this.#createSession(input, source);
|
|
224
|
+
const parentSessionId = source.parentSessionId;
|
|
224
225
|
// Publish under the parent's existing serial domain so tree admission cannot miss a child.
|
|
225
|
-
return this.#serializeRecordOperation(
|
|
226
|
+
return this.#serializeRecordOperation(parentSessionId, async () => {
|
|
226
227
|
this.#assertOpen();
|
|
227
|
-
if (this.#shared.writerLeases.get(
|
|
228
|
+
if (this.#shared.writerLeases.get(parentSessionId)?.maintenance)
|
|
228
229
|
throw new AgentError('MAR_AGENT_SESSION_LOCKED', 'Session is under maintenance.');
|
|
229
|
-
const release = await this.#acquirePublicationGate(
|
|
230
|
+
const release = await this.#acquirePublicationGate(parentSessionId, 5000);
|
|
230
231
|
let failure;
|
|
231
232
|
try {
|
|
232
|
-
await this.#recoverPendingTreeDelete(
|
|
233
|
-
if (this.#shared.writerLeases.get(
|
|
233
|
+
await this.#recoverPendingTreeDelete(parentSessionId);
|
|
234
|
+
if (this.#shared.writerLeases.get(parentSessionId)?.maintenance)
|
|
234
235
|
throw new AgentError('MAR_AGENT_SESSION_LOCKED', 'Session is under maintenance.');
|
|
235
|
-
await this.getSession(
|
|
236
|
+
await this.getSession(parentSessionId);
|
|
236
237
|
return await this.#createSession(input, source);
|
|
237
238
|
}
|
|
238
239
|
catch (error) {
|
|
@@ -1408,13 +1409,27 @@ export class JsonlSessionStore {
|
|
|
1408
1409
|
const lease = this.#shared.writerLeases.get(sessionId);
|
|
1409
1410
|
return lease?.owner === owner && lease.retained > 0;
|
|
1410
1411
|
}
|
|
1411
|
-
async acquireSessionMaintenance(sessionId, kind, owner) {
|
|
1412
|
+
async acquireSessionMaintenance(sessionId, kind, owner, members) {
|
|
1412
1413
|
this.#assertOpen();
|
|
1414
|
+
const ids = members === undefined ? [sessionId] : [...members];
|
|
1415
|
+
if (ids.length === 0 ||
|
|
1416
|
+
!ids.includes(sessionId) ||
|
|
1417
|
+
new Set(ids).size !== ids.length ||
|
|
1418
|
+
(kind === 'clear' && (ids.length !== 1 || ids[0] !== sessionId)))
|
|
1419
|
+
throw new AgentError('MAR_AGENT_SESSION_INVALID', 'Invalid Session maintenance members.');
|
|
1420
|
+
ids.sort();
|
|
1421
|
+
for (const id of ids)
|
|
1422
|
+
this.#sessionRoot(id);
|
|
1413
1423
|
await this.#recoverPendingTreeDelete(sessionId);
|
|
1414
1424
|
return acquireTreeMaintenance({
|
|
1415
1425
|
sessionId,
|
|
1416
1426
|
kind,
|
|
1417
|
-
tree: () =>
|
|
1427
|
+
tree: async () => {
|
|
1428
|
+
await this.#refreshIndex();
|
|
1429
|
+
if (ids.some((id) => !this.#shared.index.sessions.some((session) => session.id === id)))
|
|
1430
|
+
throw new AgentError('MAR_AGENT_SESSION_NOT_FOUND', 'Session was not found.');
|
|
1431
|
+
return ids;
|
|
1432
|
+
},
|
|
1418
1433
|
acquire: (id, holding, registerGate) => this.#serializeRecordOperation(id, async () => {
|
|
1419
1434
|
this.#assertOpen();
|
|
1420
1435
|
registerGate(await this.#acquirePublicationGate(id));
|
|
@@ -53,7 +53,11 @@ export async function persistResource(directory, image) {
|
|
|
53
53
|
const data = Buffer.from(image.dataBase64 ?? '', 'base64');
|
|
54
54
|
if (data.toString('base64') !== image.dataBase64)
|
|
55
55
|
throw new AgentError('MAR_AGENT_SESSION_INPUT_INVALID', 'Image resource data is not canonical base64.');
|
|
56
|
-
if (!mimeTypes.has(image.mimeType)
|
|
56
|
+
if (!mimeTypes.has(image.mimeType))
|
|
57
|
+
throw new AgentError('MAR_AGENT_SESSION_INPUT_INVALID', 'Unsupported image resource format. Use PNG, JPEG, GIF, or WebP.');
|
|
58
|
+
if (data.length === 0)
|
|
59
|
+
throw new AgentError('MAR_AGENT_SESSION_INPUT_INVALID', 'Image resource data must not be empty.');
|
|
60
|
+
if (data.length > 20 * 1024 * 1024)
|
|
57
61
|
throw new AgentError('MAR_AGENT_HOST_LIMIT_EXCEEDED', 'Image resource exceeds supported limits.');
|
|
58
62
|
const sha256 = createHash('sha256').update(data).digest('hex');
|
|
59
63
|
const resourceId = resourceIdentity(image.mimeType, sha256);
|
package/dist/session/types.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export async function executeSleep(arguments_, context, callId) {
|
|
|
36
36
|
durationMs,
|
|
37
37
|
startedAt: new Date().toISOString()
|
|
38
38
|
});
|
|
39
|
-
const messages = context.
|
|
39
|
+
const messages = context.contextUpdates;
|
|
40
40
|
const outcome = await waitForToolCondition({
|
|
41
41
|
ready: () => messages?.pending() ?? false,
|
|
42
42
|
subscribe: (notify) => messages?.subscribe(notify) ?? (() => { }),
|
package/dist/tools/callers.js
CHANGED
|
@@ -15,18 +15,7 @@ export function toolCallers(tool) {
|
|
|
15
15
|
export function allowsToolCaller(tool, caller) {
|
|
16
16
|
// Control tools cannot be widened by a Host override or historical definition.
|
|
17
17
|
if (caller === 'programmatic' &&
|
|
18
|
-
[
|
|
19
|
-
'code_exec',
|
|
20
|
-
'code_exec_wait',
|
|
21
|
-
'tool_search',
|
|
22
|
-
'question',
|
|
23
|
-
'skill',
|
|
24
|
-
'sleep',
|
|
25
|
-
'agent_start',
|
|
26
|
-
'agent_wait',
|
|
27
|
-
'agent_message',
|
|
28
|
-
'agent_cancel'
|
|
29
|
-
].includes(tool.name))
|
|
18
|
+
['code_exec', 'code_exec_wait', 'tool_search', 'question', 'skill', 'sleep'].includes(tool.name))
|
|
30
19
|
return false;
|
|
31
20
|
return toolCallers(tool).includes(caller);
|
|
32
21
|
}
|
|
@@ -32,7 +32,9 @@ export function createCodeToolDispatch(input) {
|
|
|
32
32
|
...(expected ? { expectedMcpTool: expected } : {})
|
|
33
33
|
}, 'programmatic');
|
|
34
34
|
const bounded = boundedModelToolOutput(call.name, result.content, result.data);
|
|
35
|
-
const data = structuredToolEventData(call.name,
|
|
35
|
+
const data = structuredToolEventData(call.name, call.name === 'exec' || call.name === 'exec_wait'
|
|
36
|
+
? (result.eventData ?? result.data)
|
|
37
|
+
: result.data);
|
|
36
38
|
const preview = toolEventSummary(result.content);
|
|
37
39
|
input.assertLive();
|
|
38
40
|
await input.emit({
|
|
@@ -44,8 +46,9 @@ export function createCodeToolDispatch(input) {
|
|
|
44
46
|
truncated: result.truncated === true || bounded.truncated || preview.truncated,
|
|
45
47
|
...(result.artifacts ? { artifacts: result.artifacts } : {})
|
|
46
48
|
});
|
|
49
|
+
const { eventData: _eventData, ...guestResult } = result;
|
|
47
50
|
return {
|
|
48
|
-
...
|
|
51
|
+
...guestResult,
|
|
49
52
|
content: bounded.content,
|
|
50
53
|
truncated: result.truncated === true || bounded.truncated
|
|
51
54
|
};
|
|
@@ -22,7 +22,7 @@ export declare class CodeModeTool {
|
|
|
22
22
|
wait(value: unknown, context: ToolExecutionContext): Promise<ToolExecutionResult>;
|
|
23
23
|
listSessionResources(sessionId: string): {
|
|
24
24
|
cellId: string;
|
|
25
|
-
status: "
|
|
25
|
+
status: "running" | "failed" | "cancelled" | "completed";
|
|
26
26
|
executionId: string;
|
|
27
27
|
}[];
|
|
28
28
|
constructor(paths: WorkspacePathResolver, environment: NodeJS.ProcessEnv | undefined, executor: LocalProcessExecutor, signalProcessTree: (child: import('node:child_process').ChildProcessWithoutNullStreams, signal: NodeJS.Signals) => Promise<void>, engineFactory?: CodeModeEngineFactory);
|
|
@@ -110,7 +110,7 @@ export const codeExecWaitToolDefinition = {
|
|
|
110
110
|
function projectProgrammaticTool(tool) {
|
|
111
111
|
return {
|
|
112
112
|
name: tool.name,
|
|
113
|
-
description: `${allowsDirectTool(tool, true) ? `Call directly or as tools.${tool.name} inside code_exec.` : `Call only as tools.${tool.name} inside code_exec, never as a direct model tool.`}\
|
|
113
|
+
description: `${allowsDirectTool(tool, true) ? `Call directly or as tools.${tool.name} inside code_exec.` : `Call only as tools.${tool.name} inside code_exec, never as a direct model tool.`}\n${tool.description}`,
|
|
114
114
|
inputSchema: stableToolSchema(tool.inputSchema)
|
|
115
115
|
};
|
|
116
116
|
}
|
|
@@ -127,7 +127,7 @@ export function projectCodeModeTools(tools, residentTools = tools) {
|
|
|
127
127
|
callableNames: programmatic.map((tool) => tool.name),
|
|
128
128
|
tools: programmatic.map(projectProgrammaticTool)
|
|
129
129
|
});
|
|
130
|
-
if (Buffer.byteLength(directory) >
|
|
130
|
+
if (Buffer.byteLength(directory) > 48 * 1024)
|
|
131
131
|
throw new AgentError('MAR_AGENT_TOOL_EXPOSURE_LIMIT', 'Programmatic tool directory is too large.');
|
|
132
132
|
return direct.map((tool) => tool.name === 'code_exec'
|
|
133
133
|
? {
|
|
@@ -399,6 +399,8 @@ export class CodeModeTool {
|
|
|
399
399
|
};
|
|
400
400
|
const indices = original.result.images?.map(addImage);
|
|
401
401
|
const data = [
|
|
402
|
+
'exec',
|
|
403
|
+
'exec_wait',
|
|
402
404
|
'apply_patch',
|
|
403
405
|
'todo_read',
|
|
404
406
|
'todo_write',
|
|
@@ -9,6 +9,8 @@ export interface ClientToolDefinition extends ModelToolDefinition {
|
|
|
9
9
|
outputSchema?: Record<string, unknown>;
|
|
10
10
|
/** Runtime-only policy. MCP defaults to both callers; other tools default to direct only. */
|
|
11
11
|
allowedCallers?: readonly ToolCaller[];
|
|
12
|
+
/** Runtime-only allowlist of scalar fields in the public tool.started input. */
|
|
13
|
+
eventInputFields?: readonly string[];
|
|
12
14
|
/** Runtime-only exposure override; retains both permitted entry points with Code Mode enabled. */
|
|
13
15
|
codeModeExposure?: 'both';
|
|
14
16
|
parallelSafety?: 'safe' | 'serial';
|
|
@@ -95,12 +97,24 @@ export interface ExecOutputSnapshot {
|
|
|
95
97
|
stdout: string;
|
|
96
98
|
stderr: string;
|
|
97
99
|
truncated: boolean;
|
|
100
|
+
displayOutput?: ExecDisplayOutput;
|
|
101
|
+
}
|
|
102
|
+
/** Bounded, non-consuming tail for public presentation, not model output. */
|
|
103
|
+
export interface ExecDisplayOutput {
|
|
104
|
+
stdout: string;
|
|
105
|
+
stderr: string;
|
|
106
|
+
stdoutDroppedBytes: number;
|
|
107
|
+
stderrDroppedBytes: number;
|
|
98
108
|
}
|
|
99
109
|
export interface ToolExecutionResult {
|
|
100
110
|
calls?: readonly import('../session/code-observation-contract.js').CodeToolCallRecord[];
|
|
101
111
|
content: string;
|
|
102
112
|
observations?: readonly import('../session/code-observation-contract.js').CodeObservation[];
|
|
113
|
+
/** Explicit, bounded public structured projection; never inferred from data. */
|
|
114
|
+
eventData?: Readonly<Record<string, unknown>>;
|
|
103
115
|
data?: unknown;
|
|
116
|
+
/** Explicit public event summary, separate from model-visible content. */
|
|
117
|
+
eventSummary?: string;
|
|
104
118
|
/** Runtime-only definitions used to encode a Tool Search output. */
|
|
105
119
|
toolSearchTools?: readonly ClientToolDefinition[];
|
|
106
120
|
truncated?: boolean;
|
|
@@ -117,7 +131,12 @@ export interface CodeCellEventData {
|
|
|
117
131
|
waitOutcome?: import('./wait.js').ToolWaitOutcome;
|
|
118
132
|
reason?: 'steer';
|
|
119
133
|
cached?: boolean;
|
|
134
|
+
truncated?: boolean;
|
|
120
135
|
observations?: readonly import('../session/code-observation-contract.js').CodeObservation[];
|
|
136
|
+
error?: {
|
|
137
|
+
code: string;
|
|
138
|
+
message: string;
|
|
139
|
+
};
|
|
121
140
|
}
|
|
122
141
|
export interface ExecResult {
|
|
123
142
|
status: 'running' | 'completed' | 'cancelled';
|
|
@@ -134,6 +153,7 @@ export interface ExecResult {
|
|
|
134
153
|
stderrDroppedBytes: number;
|
|
135
154
|
/** A terminal snapshot replay rather than new process output. */
|
|
136
155
|
cached?: boolean;
|
|
156
|
+
displayOutput?: ExecDisplayOutput;
|
|
137
157
|
}
|
|
138
158
|
export interface ApplyPatchFileResult {
|
|
139
159
|
path: string;
|
|
@@ -1,24 +1,4 @@
|
|
|
1
1
|
export declare const TOOL_EXECUTION_LIMITS: Readonly<{
|
|
2
|
-
sleepMaxDurationMs: 1800000;
|
|
3
|
-
questionMaxTextCharacters: 1000;
|
|
4
|
-
questionMaxOptionCharacters: 500;
|
|
5
|
-
todoMaxItems: 100;
|
|
6
|
-
todoMaxTextCharacters: 1000;
|
|
7
|
-
agentWaitMinWaitMs: 0;
|
|
8
|
-
agentWaitWaitFloorMs: 10000;
|
|
9
|
-
agentWaitDefaultWaitMs: 30000;
|
|
10
|
-
agentWaitMaxWaitMs: 300000;
|
|
11
|
-
agentWaitMaxAgents: 8;
|
|
12
|
-
subagentDescriptionMaxCharacters: 80;
|
|
13
|
-
subagentPromptMaxBytes: 131072;
|
|
14
|
-
subagentMessageMaxBytes: 131072;
|
|
15
|
-
subagentReasoningEffortMaxCharacters: 64;
|
|
16
|
-
subagentSummaryMaxBytes: 16384;
|
|
17
|
-
subagentUpdateMaxBytes: 32768;
|
|
18
|
-
subagentRunningLatestMessageMaxCharacters: 2000;
|
|
19
|
-
subagentEvidenceMaxItems: 64;
|
|
20
|
-
subagentVerificationMaxItems: 16;
|
|
21
|
-
subagentChangedFilesMaxItems: 200;
|
|
22
2
|
readDefaultLines: 200;
|
|
23
3
|
readMaxLines: 2000;
|
|
24
4
|
readMaxBytes: 1048576;
|
|
@@ -66,4 +46,9 @@ export declare const TOOL_EXECUTION_LIMITS: Readonly<{
|
|
|
66
46
|
patchMaxFiles: 100;
|
|
67
47
|
patchMaxFileBytes: 8388608;
|
|
68
48
|
patchMaxTotalBytes: 33554432;
|
|
49
|
+
sleepMaxDurationMs: 1800000;
|
|
50
|
+
questionMaxTextCharacters: 1000;
|
|
51
|
+
questionMaxOptionCharacters: 500;
|
|
52
|
+
todoMaxItems: 100;
|
|
53
|
+
todoMaxTextCharacters: 1000;
|
|
69
54
|
}>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CODE_STATE_LIMITS } from '../session/code-state.js';
|
|
2
2
|
import { HISTORY_INPUT_LIMITS } from '../session/history-input-limits.js';
|
|
3
|
-
import { SUBAGENT_LIMITS } from '../subagent/limits.js';
|
|
4
3
|
export const TOOL_EXECUTION_LIMITS = Object.freeze({
|
|
5
4
|
readDefaultLines: 200,
|
|
6
5
|
readMaxLines: 2_000,
|
|
@@ -49,7 +48,6 @@ export const TOOL_EXECUTION_LIMITS = Object.freeze({
|
|
|
49
48
|
patchMaxFiles: 100,
|
|
50
49
|
patchMaxFileBytes: 8_388_608,
|
|
51
50
|
patchMaxTotalBytes: 33_554_432,
|
|
52
|
-
...SUBAGENT_LIMITS,
|
|
53
51
|
sleepMaxDurationMs: 1_800_000,
|
|
54
52
|
questionMaxTextCharacters: 1_000,
|
|
55
53
|
questionMaxOptionCharacters: 500,
|
package/dist/tools/execution.js
CHANGED
|
@@ -3,7 +3,7 @@ import { toolEventSummary } from '../runtime/event-projection.js';
|
|
|
3
3
|
import { allowsToolCaller } from './callers.js';
|
|
4
4
|
import { CodeCellExecutionError } from './code-mode/cells.js';
|
|
5
5
|
import { createCodeToolDispatch } from './code-mode/dispatch.js';
|
|
6
|
-
import { boundedModelToolOutput, structuredToolArtifacts, structuredToolEventData, structuredToolFailureData } from './output-projection.js';
|
|
6
|
+
import { boundedModelToolOutput, publicToolEventInput, structuredToolArtifacts, publicExtensionToolEventData, structuredToolEventData, structuredToolFailureData } from './output-projection.js';
|
|
7
7
|
import { publishModelResources } from '../runtime/resource-publication.js';
|
|
8
8
|
import { executeRegisteredTool } from './runtime.js';
|
|
9
9
|
import { failedToolResultExtensions } from './result-extensions.js';
|
|
@@ -78,12 +78,16 @@ export async function createRoundToolRuntimeContext(scope, call, signal) {
|
|
|
78
78
|
/** Complete every call in model order even if individual execution fails. */
|
|
79
79
|
export async function executeRoundTools(calls, scope) {
|
|
80
80
|
const executeCall = async (call, signal = scope.context.signal, caller = 'direct', parentCallId) => {
|
|
81
|
+
const inputFields = scope.tools.find((tool) => tool.name === call.name)?.eventInputFields;
|
|
82
|
+
const publicInput = inputFields === undefined
|
|
83
|
+
? call.arguments
|
|
84
|
+
: publicToolEventInput(call.arguments, inputFields);
|
|
81
85
|
await scope.emit({
|
|
82
86
|
type: 'tool.started',
|
|
83
87
|
toolName: call.name,
|
|
84
88
|
callId: call.callId,
|
|
85
89
|
...(parentCallId === undefined ? {} : { parentCallId }),
|
|
86
|
-
input:
|
|
90
|
+
input: publicInput
|
|
87
91
|
});
|
|
88
92
|
try {
|
|
89
93
|
if (call.argumentError)
|
|
@@ -109,8 +113,16 @@ export async function executeRoundTools(calls, scope) {
|
|
|
109
113
|
...(publishedImages === undefined ? {} : { images: publishedImages })
|
|
110
114
|
};
|
|
111
115
|
const modelOutput = boundedModelToolOutput(call.name, output.content, output.data);
|
|
112
|
-
const eventSummary = toolEventSummary(output.
|
|
113
|
-
|
|
116
|
+
const eventSummary = toolEventSummary(output.eventSummary === undefined
|
|
117
|
+
? output.content
|
|
118
|
+
: typeof output.eventSummary === 'string'
|
|
119
|
+
? output.eventSummary
|
|
120
|
+
: '');
|
|
121
|
+
const structuredData = call.name === 'exec' || call.name === 'exec_wait'
|
|
122
|
+
? structuredToolEventData(call.name, output.eventData ?? output.data)
|
|
123
|
+
: output.eventData === undefined
|
|
124
|
+
? structuredToolEventData(call.name, output.data)
|
|
125
|
+
: publicExtensionToolEventData(output.eventData);
|
|
114
126
|
const artifacts = structuredToolArtifacts(output.artifacts);
|
|
115
127
|
await scope.emit({
|
|
116
128
|
type: 'tool.completed',
|
package/dist/tools/local/exec.js
CHANGED
|
@@ -2,7 +2,8 @@ import { AgentError } from '../../error.js';
|
|
|
2
2
|
import { TOOL_EXECUTION_LIMITS } from '../execution-limits.js';
|
|
3
3
|
/** Share the model-facing body across direct calls and original Code Mode observations. */
|
|
4
4
|
export function formatExecResult(result) {
|
|
5
|
-
const
|
|
5
|
+
const { displayOutput, ...modelResult } = result;
|
|
6
|
+
const visible = { ...modelResult };
|
|
6
7
|
if (result.stderr === '')
|
|
7
8
|
delete visible.stderr;
|
|
8
9
|
if (!result.truncated) {
|
|
@@ -19,7 +20,12 @@ export function formatExecResult(result) {
|
|
|
19
20
|
delete visible.stderrDroppedBytes;
|
|
20
21
|
if (result.cached === false)
|
|
21
22
|
delete visible.cached;
|
|
22
|
-
return {
|
|
23
|
+
return {
|
|
24
|
+
content: JSON.stringify(visible),
|
|
25
|
+
data: displayOutput === undefined ? result : modelResult,
|
|
26
|
+
...(displayOutput === undefined ? {} : { eventData: { ...modelResult, displayOutput } }),
|
|
27
|
+
truncated: result.truncated
|
|
28
|
+
};
|
|
23
29
|
}
|
|
24
30
|
export const execToolDefinition = {
|
|
25
31
|
name: 'exec',
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import type { SubagentTaskSnapshot, SubagentManyOutput } from '../subagent/contracts.js';
|
|
2
1
|
import type { ApplyPatchResult, ApplyPatchPartialResult, CodeCellEventData, ExecResult, AgentToolArtifact, ToolExecutionResult, ReadEventData, ViewImageResult } from './contracts.js';
|
|
3
2
|
import type { ToolRuntimeImage } from './runtime-context.js';
|
|
4
3
|
import type { SleepResult } from './agent/sleep.js';
|
|
5
4
|
import { type PublicToolMetadata } from '../runtime/public-tool-metadata.js';
|
|
6
5
|
import type { ModelImage } from '../model/image.js';
|
|
6
|
+
/** Copy an explicitly public JSON object without exposing the full tool result. */
|
|
7
|
+
export declare function publicExtensionToolEventData(value: unknown): Readonly<Record<string, unknown>> | undefined;
|
|
7
8
|
export declare function currentExecutionImages(modelInputImages: readonly ModelImage[] | undefined, toolImages: readonly ToolRuntimeImage[]): ToolRuntimeImage[];
|
|
8
9
|
export declare function boundedModelToolOutput(toolName: string, value: string, data: unknown): {
|
|
9
10
|
content: string;
|
|
10
11
|
truncated: boolean;
|
|
11
12
|
};
|
|
13
|
+
/** The opted-in allowlist fails closed and never mutates the invocation arguments. */
|
|
14
|
+
export declare function publicToolEventInput(value: unknown, fields: readonly string[]): Readonly<Record<string, unknown>>;
|
|
12
15
|
/** Project only known, validated tool result shapes into public structured events. */
|
|
13
|
-
export declare function structuredToolEventData(toolName: string, value: unknown): CodeCellEventData | ExecResult | ApplyPatchResult | ReadEventData | ViewImageResult |
|
|
16
|
+
export declare function structuredToolEventData(toolName: string, value: unknown): CodeCellEventData | ExecResult | ApplyPatchResult | ReadEventData | ViewImageResult | SleepResult | PublicToolMetadata | undefined;
|
|
14
17
|
/** Partial patch facts are allowlisted; arbitrary error details never become public event data. */
|
|
15
18
|
export declare function structuredToolFailureData(toolName: string, error: unknown): ApplyPatchPartialResult | undefined;
|
|
16
19
|
export declare function structuredToolArtifacts(value: readonly AgentToolArtifact[] | undefined): readonly AgentToolArtifact[] | undefined;
|