@myagentroam/agent 0.9.158 → 0.9.160
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-core/extensions/agents.d.ts +69 -0
- package/dist/agent-core/extensions/agents.js +160 -0
- package/dist/agent-core/extensions/contracts.d.ts +260 -0
- package/dist/agent-core/extensions/contracts.js +1 -0
- package/dist/agent-core/extensions/data.d.ts +84 -0
- package/dist/agent-core/extensions/data.js +83 -0
- package/dist/agent-core/extensions/environment.d.ts +27 -0
- package/dist/agent-core/extensions/environment.js +52 -0
- package/dist/agent-core/extensions/files.d.ts +64 -0
- package/dist/agent-core/extensions/files.js +26 -0
- package/dist/agent-core/extensions/hooks.d.ts +32 -0
- package/dist/agent-core/extensions/hooks.js +135 -0
- package/dist/agent-core/extensions/manager.d.ts +39 -0
- package/dist/agent-core/extensions/manager.js +458 -0
- package/dist/agent-core/extensions/mcp.d.ts +99 -0
- package/dist/agent-core/extensions/mcp.js +433 -0
- package/dist/agent-core/extensions/model-request.d.ts +60 -0
- package/dist/agent-core/extensions/model-request.js +167 -0
- package/dist/agent-core/extensions/model-stream.d.ts +9 -0
- package/dist/agent-core/extensions/model-stream.js +101 -0
- package/dist/agent-core/extensions/models.d.ts +43 -0
- package/dist/agent-core/extensions/models.js +1 -0
- package/dist/agent-core/extensions/network.d.ts +32 -0
- package/dist/agent-core/extensions/network.js +97 -0
- package/dist/agent-core/extensions/operation.d.ts +29 -0
- package/dist/agent-core/extensions/operation.js +98 -0
- package/dist/agent-core/extensions/processes.d.ts +52 -0
- package/dist/agent-core/extensions/processes.js +283 -0
- package/dist/agent-core/extensions/prompt-composition.d.ts +24 -0
- package/dist/agent-core/extensions/prompt-composition.js +106 -0
- package/dist/agent-core/extensions/prompt-input.d.ts +23 -0
- package/dist/agent-core/extensions/prompt-input.js +46 -0
- package/dist/agent-core/extensions/resources.d.ts +27 -0
- package/dist/agent-core/extensions/resources.js +221 -0
- package/dist/agent-core/extensions/services.d.ts +31 -0
- package/dist/agent-core/extensions/services.js +61 -0
- package/dist/agent-core/extensions/session-input.d.ts +151 -0
- package/dist/agent-core/extensions/session-input.js +351 -0
- package/dist/agent-core/extensions/session-messages.d.ts +41 -0
- package/dist/agent-core/extensions/session-messages.js +76 -0
- package/dist/agent-core/extensions/session.d.ts +68 -0
- package/dist/agent-core/extensions/session.js +593 -0
- package/dist/agent-core/extensions/settings.d.ts +59 -0
- package/dist/agent-core/extensions/settings.js +115 -0
- package/dist/agent-core/extensions/store.d.ts +10 -0
- package/dist/agent-core/extensions/store.js +131 -0
- package/dist/agent-core/extensions/tools.d.ts +61 -0
- package/dist/agent-core/extensions/tools.js +266 -0
- package/dist/agent-core/host/contracts.d.ts +25 -0
- package/dist/agent-core/host/local-agent-host.d.ts +10 -1
- package/dist/agent-core/host/local-agent-host.js +132 -20
- package/dist/agent-core/host/local-file-access.d.ts +30 -0
- package/dist/agent-core/host/local-file-access.js +107 -0
- package/dist/agent-core/host/local-network-access.d.ts +6 -0
- package/dist/agent-core/host/local-network-access.js +97 -0
- package/dist/agent-core/host/local-process-executor.d.ts +5 -1
- package/dist/agent-core/host/local-session-environment.d.ts +18 -0
- package/dist/agent-core/host/local-session-environment.js +102 -0
- package/dist/agent-core/model/anthropic-messages.js +73 -23
- package/dist/agent-core/model/contracts.d.ts +21 -0
- package/dist/agent-core/model/openai-responses.d.ts +3 -1
- package/dist/agent-core/model/openai-responses.js +248 -97
- package/dist/agent-core/model/text-blocks.d.ts +7 -0
- package/dist/agent-core/model/text-blocks.js +40 -0
- package/dist/agent-core/prompts/index.d.ts +6 -2
- package/dist/agent-core/prompts/index.js +38 -24
- package/dist/agent-core/runtime/context/gc-tokens.js +6 -1
- package/dist/agent-core/runtime/context/normalize.js +21 -1
- package/dist/agent-core/runtime/context/projection.js +35 -1
- package/dist/agent-core/runtime/context/request-budget.js +5 -2
- package/dist/agent-core/runtime/context/restore.d.ts +5 -0
- package/dist/agent-core/runtime/context/restore.js +47 -4
- package/dist/agent-core/runtime/context/usage.js +2 -3
- package/dist/agent-core/runtime/contracts.d.ts +2 -0
- package/dist/agent-core/runtime/execution.js +5 -2
- package/dist/agent-core/sdk/agent.js +177 -40
- package/dist/agent-core/sdk/extension-agents.d.ts +9 -0
- package/dist/agent-core/sdk/extension-agents.js +51 -0
- package/dist/agent-core/sdk/extension-models.d.ts +13 -0
- package/dist/agent-core/sdk/extension-models.js +128 -0
- package/dist/agent-core/sdk/extension-session.d.ts +30 -0
- package/dist/agent-core/sdk/extension-session.js +103 -0
- package/dist/agent-core/sdk/extension-tools.d.ts +16 -0
- package/dist/agent-core/sdk/extension-tools.js +126 -0
- package/dist/agent-core/sdk/session.d.ts +26 -2
- package/dist/agent-core/sdk/session.js +1215 -506
- package/dist/agent-core/sdk/types.d.ts +3 -0
- package/dist/agent-core/session/context-gc-checkpoint.js +1 -1
- package/dist/agent-core/session/jsonl-store.d.ts +28 -8
- package/dist/agent-core/session/jsonl-store.js +124 -84
- package/dist/agent-core/session/types.d.ts +4 -1
- package/dist/agent-core/storage/file-lock.d.ts +4 -0
- package/dist/agent-core/storage/file-lock.js +83 -0
- package/dist/agent-core/subagent/contracts.d.ts +11 -1
- package/dist/agent-core/subagent/scheduler.d.ts +8 -0
- package/dist/agent-core/subagent/session-controller.d.ts +22 -1
- package/dist/agent-core/subagent/session-controller.js +355 -98
- package/dist/agent-core/tools/agent/agent-start.d.ts +1 -1
- package/dist/agent-core/tools/code-mode/cells.js +5 -15
- package/dist/agent-core/tools/code-mode/dispatch.d.ts +1 -0
- package/dist/agent-core/tools/code-mode/dispatch.js +13 -1
- package/dist/agent-core/tools/code-mode/index.js +1 -2
- package/dist/agent-core/tools/code-mode/observations.d.ts +5 -0
- package/dist/agent-core/tools/code-mode/observations.js +16 -5
- package/dist/agent-core/tools/code-mode/quickjs-engine.js +10 -5
- package/dist/agent-core/tools/execution.d.ts +11 -2
- package/dist/agent-core/tools/execution.js +58 -21
- package/dist/agent-core/tools/input.d.ts +2 -0
- package/dist/agent-core/tools/input.js +36 -0
- package/dist/agent-core/tools/local/apply-patch.js +21 -17
- package/dist/agent-core/tools/local/exec.d.ts +4 -4
- package/dist/agent-core/tools/local/exec.js +234 -62
- package/dist/agent-core/tools/local/registry.d.ts +6 -0
- package/dist/agent-core/tools/local/registry.js +60 -9
- package/dist/agent-core/tools/local/view-image.js +108 -2
- package/dist/agent-core/tools/mcp/catalog.d.ts +6 -2
- package/dist/agent-core/tools/mcp/catalog.js +4 -4
- package/dist/agent-core/tools/mcp/history.js +2 -2
- package/dist/agent-core/tools/mcp/tool-search.d.ts +3 -1
- package/dist/agent-core/tools/mcp/tool-search.js +2 -2
- package/dist/agent-core/tools/output-projection.d.ts +3 -1
- package/dist/agent-core/tools/output-projection.js +11 -2
- package/dist/agent-core/tools/runtime-context.d.ts +1 -0
- package/dist/agent-core/tools/runtime.d.ts +3 -1
- package/dist/agent-core/tools/runtime.js +22 -7
- package/dist/agent-core/tools/scheduler.d.ts +2 -0
- package/dist/agent-core/tools/scheduler.js +43 -6
- package/dist/index.d.ts +21 -0
- package/dist/sandbox/linux/bubblewrap-sandbox-executor.js +5 -2
- package/package.json +1 -1
|
@@ -136,10 +136,10 @@ function assertSchema(schema) {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
/** Shared Host and Node publication boundary, not a provider-specific conversion. */
|
|
139
|
-
export function assertMcpToolDefinition(value) {
|
|
139
|
+
export function assertMcpToolDefinition(value, options = {}) {
|
|
140
140
|
if (!record(value) ||
|
|
141
141
|
!text(value.name, 256) ||
|
|
142
|
-
!/^mcp__[A-Za-z0-9_-]+__[A-Za-z0-9_-]+$/u.test(value.name) ||
|
|
142
|
+
(!options.nativeToolNames && !/^mcp__[A-Za-z0-9_-]+__[A-Za-z0-9_-]+$/u.test(value.name)) ||
|
|
143
143
|
typeof value.description !== 'string' ||
|
|
144
144
|
value.description.length > 65536 ||
|
|
145
145
|
(value.parallelSafety !== undefined &&
|
|
@@ -159,7 +159,7 @@ export function assertMcpToolDefinition(value) {
|
|
|
159
159
|
if (Buffer.byteLength(JSON.stringify(value)) > MCP_DEFINITION_LIMITS.definitionBytes)
|
|
160
160
|
invalid();
|
|
161
161
|
}
|
|
162
|
-
export function assertMcpToolCatalog(value) {
|
|
162
|
+
export function assertMcpToolCatalog(value, options = {}) {
|
|
163
163
|
if (!record(value) ||
|
|
164
164
|
typeof value.revision !== 'string' ||
|
|
165
165
|
value.revision.length > 512 ||
|
|
@@ -204,7 +204,7 @@ export function assertMcpToolCatalog(value) {
|
|
|
204
204
|
!['session', 'execution'].includes(String(tool.lifetime)) ||
|
|
205
205
|
!['direct', 'deferred'].includes(String(tool.exposure)))
|
|
206
206
|
invalid();
|
|
207
|
-
assertMcpToolDefinition(tool.definition);
|
|
207
|
+
assertMcpToolDefinition(tool.definition, options);
|
|
208
208
|
if (tool.annotations !== undefined) {
|
|
209
209
|
if (!record(tool.annotations))
|
|
210
210
|
invalid();
|
|
@@ -4,8 +4,8 @@ export function discoveredMcpToolNames(messages) {
|
|
|
4
4
|
const names = new Set();
|
|
5
5
|
for (const message of messages)
|
|
6
6
|
for (const tool of calls.has(message.callId ?? '') ? (message.toolSearchTools ?? []) : [])
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
// Paired discovery receipts provide candidates; the current captured MCP catalog is authority.
|
|
8
|
+
names.add(tool.name);
|
|
9
9
|
return [...names];
|
|
10
10
|
}
|
|
11
11
|
export function rebindMcpToolSearchOutputs(messages, registry) {
|
|
@@ -20,7 +20,9 @@ export declare class DeferredMcpRegistry {
|
|
|
20
20
|
#private;
|
|
21
21
|
constructor(discoveredNames: readonly string[]);
|
|
22
22
|
restore(discoveredNames: readonly string[]): void;
|
|
23
|
-
update(catalog: McpToolCatalog, eligible: (tool: McpCatalogTool) => boolean
|
|
23
|
+
update(catalog: McpToolCatalog, eligible: (tool: McpCatalogTool) => boolean, options?: {
|
|
24
|
+
nativeToolNames?: boolean;
|
|
25
|
+
}): void;
|
|
24
26
|
get hasDeferred(): boolean;
|
|
25
27
|
snapshot(): readonly string[];
|
|
26
28
|
expectedTool(name: string): {
|
|
@@ -63,8 +63,8 @@ export class DeferredMcpRegistry {
|
|
|
63
63
|
// GC may remove evidence, but cannot grant a capability from another Execution.
|
|
64
64
|
this.#executionSelected = new Set([...this.#executionSelected].filter((name) => surviving.has(name)));
|
|
65
65
|
}
|
|
66
|
-
update(catalog, eligible) {
|
|
67
|
-
assertMcpToolCatalog(catalog);
|
|
66
|
+
update(catalog, eligible, options = {}) {
|
|
67
|
+
assertMcpToolCatalog(catalog, options);
|
|
68
68
|
this.#catalog = { ...catalog, tools: catalog.tools.filter(eligible) };
|
|
69
69
|
const validSession = new Set(this.#catalog.tools
|
|
70
70
|
.filter((tool) => tool.lifetime === 'session' && tool.exposure === 'deferred')
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SubagentTaskSnapshot } from '../subagent/contracts.js';
|
|
2
|
-
import type { ApplyPatchResult, CodeCellEventData, ExecResult, MarAgentToolArtifact, ReadEventData, ViewImageResult } from './contracts.js';
|
|
2
|
+
import type { ApplyPatchResult, CodeCellEventData, ExecResult, MarAgentToolArtifact, ToolExecutionResult, ReadEventData, ViewImageResult } from './contracts.js';
|
|
3
3
|
import type { ToolRuntimeImage } from './runtime-context.js';
|
|
4
4
|
export declare function currentExecutionImages(modelInputImages: readonly {
|
|
5
5
|
readonly mimeType: string;
|
|
@@ -12,3 +12,5 @@ export declare function boundedModelToolOutput(toolName: string, value: string,
|
|
|
12
12
|
/** Project only known, validated tool result shapes into public structured events. */
|
|
13
13
|
export declare function structuredToolEventData(toolName: string, value: unknown): CodeCellEventData | ExecResult | ApplyPatchResult | ReadEventData | ViewImageResult | SubagentTaskSnapshot | undefined;
|
|
14
14
|
export declare function structuredToolArtifacts(value: readonly MarAgentToolArtifact[] | undefined): readonly MarAgentToolArtifact[] | undefined;
|
|
15
|
+
/** Shared result contract for model, programmatic, and native API callers. */
|
|
16
|
+
export declare function validateToolResult(value: ToolExecutionResult): ToolExecutionResult;
|
|
@@ -149,8 +149,10 @@ export function structuredToolEventData(toolName, value) {
|
|
|
149
149
|
export function structuredToolArtifacts(value) {
|
|
150
150
|
if (value === undefined)
|
|
151
151
|
return undefined;
|
|
152
|
-
if (value
|
|
153
|
-
value.
|
|
152
|
+
if (!Array.isArray(value) ||
|
|
153
|
+
value.length !== 1 ||
|
|
154
|
+
value.some((artifact) => !artifact ||
|
|
155
|
+
artifact.kind !== 'image' ||
|
|
154
156
|
artifact.mimeType !== 'image/png' ||
|
|
155
157
|
typeof artifact.name !== 'string' ||
|
|
156
158
|
artifact.name.length === 0 ||
|
|
@@ -162,6 +164,13 @@ export function structuredToolArtifacts(value) {
|
|
|
162
164
|
throw new MarAgentError('MAR_AGENT_TOOL_OUTPUT_INVALID', 'Tool image artifact is invalid.');
|
|
163
165
|
return value.map((artifact) => ({ ...artifact }));
|
|
164
166
|
}
|
|
167
|
+
/** Shared result contract for model, programmatic, and native API callers. */
|
|
168
|
+
export function validateToolResult(value) {
|
|
169
|
+
if (!value || typeof value.content !== 'string')
|
|
170
|
+
throw new MarAgentError('MAR_AGENT_TOOL_OUTPUT_INVALID', 'Tool result must contain string content.');
|
|
171
|
+
const artifacts = structuredToolArtifacts(value.artifacts);
|
|
172
|
+
return artifacts === undefined ? value : { ...value, artifacts };
|
|
173
|
+
}
|
|
165
174
|
function isRecord(value) {
|
|
166
175
|
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
167
176
|
}
|
|
@@ -51,5 +51,6 @@ export interface ToolRuntimeContext {
|
|
|
51
51
|
recentImages?: readonly ToolRuntimeImage[];
|
|
52
52
|
searchMcpTools?: (input: unknown, signal: AbortSignal) => Promise<import('./contracts.js').ToolExecutionResult>;
|
|
53
53
|
expectedMcpTool?: import('./contracts.js').McpToolCallContext['expectedTool'];
|
|
54
|
+
invokeTool?: (call: import('./contracts.js').ToolCall, context: ToolRuntimeContext, caller: import('./contracts.js').ToolCaller) => Promise<import('./contracts.js').ToolExecutionResult>;
|
|
54
55
|
emit(event: ToolRuntimeEvent): Promise<void>;
|
|
55
56
|
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
import type { ToolRuntimeContext } from './runtime-context.js';
|
|
2
|
-
export declare function executeRegisteredTool(name: string, arguments_: unknown, callId: string, context: ToolRuntimeContext): Promise<import("./contracts.js").ToolExecutionResult>;
|
|
2
|
+
export declare function executeRegisteredTool(name: string, arguments_: unknown, callId: string, context: ToolRuntimeContext, caller?: import('./contracts.js').ToolCaller): Promise<import("./contracts.js").ToolExecutionResult>;
|
|
3
|
+
/** Invoke an already captured source; names never reselect a different backend. */
|
|
4
|
+
export declare function executeCapturedTool(kind: 'builtin' | 'host' | 'mcp', call: import('./contracts.js').ToolCall, context: ToolRuntimeContext): Promise<import('./contracts.js').ToolExecutionResult>;
|
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import { MarAgentError } from '../error.js';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { AGENT_TOOL_HANDLERS, BUILTIN_TOOL_DEFINITIONS } from './registry.js';
|
|
4
|
+
import { normalizeToolInput } from './input.js';
|
|
5
|
+
import { validateToolResult } from './output-projection.js';
|
|
6
|
+
export async function executeRegisteredTool(name, arguments_, callId, context, caller = 'direct') {
|
|
7
|
+
if (context.invokeTool)
|
|
8
|
+
return validateToolResult(await context.invokeTool({ name, arguments: arguments_, callId }, context, caller));
|
|
9
|
+
return validateToolResult(await executeCapturedTool(AGENT_TOOL_HANDLERS.has(name) ? 'builtin' : name.startsWith('mcp__') ? 'mcp' : 'host', { name, arguments: arguments_, callId }, context));
|
|
10
|
+
}
|
|
11
|
+
/** Invoke an already captured source; names never reselect a different backend. */
|
|
12
|
+
export async function executeCapturedTool(kind, call, context) {
|
|
13
|
+
const definition = kind === 'builtin'
|
|
14
|
+
? BUILTIN_TOOL_DEFINITIONS.find((tool) => tool.name === call.name)
|
|
15
|
+
: undefined;
|
|
16
|
+
if (definition)
|
|
17
|
+
call = { ...call, arguments: normalizeToolInput(call.arguments, definition.inputSchema) };
|
|
18
|
+
if (kind === 'builtin') {
|
|
19
|
+
const handler = AGENT_TOOL_HANDLERS.get(call.name);
|
|
20
|
+
if (handler)
|
|
21
|
+
return handler(call.arguments, context, call.callId ?? randomUUID());
|
|
22
|
+
}
|
|
23
|
+
if (kind === 'mcp') {
|
|
9
24
|
if (!context.host.callMcpTool)
|
|
10
25
|
throw new MarAgentError('MAR_AGENT_MCP_FAILED', 'MCP execution is unavailable.');
|
|
11
26
|
return context.host.callMcpTool(call, context.signal, {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ClientToolDefinition } from '../model/contracts.js';
|
|
2
|
+
/** A managed independent callback must not borrow its still-active creator's tool barrier. */
|
|
3
|
+
export declare function withIndependentSessionTools<Value>(run: () => Value): Value;
|
|
2
4
|
/** One barrier domain for foreground tools and all retained cells in a Session. */
|
|
3
5
|
export declare function createSessionToolScheduler(): <T>(definition: ClientToolDefinition | undefined, run: () => Promise<T>) => Promise<T>;
|
|
4
6
|
/** Schedules an incremental stream while preserving the same safe/serial barriers as batches. */
|
|
@@ -1,13 +1,50 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
const sessionToolIngress = new AsyncLocalStorage();
|
|
3
|
+
/** A managed independent callback must not borrow its still-active creator's tool barrier. */
|
|
4
|
+
export function withIndependentSessionTools(run) {
|
|
5
|
+
return sessionToolIngress.run(Symbol(), run);
|
|
6
|
+
}
|
|
1
7
|
/** One barrier domain for foreground tools and all retained cells in a Session. */
|
|
2
8
|
export function createSessionToolScheduler() {
|
|
3
|
-
const
|
|
9
|
+
const leases = new AsyncLocalStorage();
|
|
10
|
+
const definitions = [
|
|
4
11
|
{ name: 'safe', parallelSafety: 'safe' },
|
|
5
12
|
{ name: 'serial', parallelSafety: 'serial' }
|
|
6
|
-
]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
];
|
|
14
|
+
const execute = async (job) => {
|
|
15
|
+
const lease = {
|
|
16
|
+
active: true,
|
|
17
|
+
ingress: sessionToolIngress.getStore(),
|
|
18
|
+
schedule: createToolCallScheduler(definitions, execute),
|
|
19
|
+
children: new Set()
|
|
20
|
+
};
|
|
21
|
+
return leases.run(lease, async () => {
|
|
22
|
+
try {
|
|
23
|
+
return await job.run();
|
|
24
|
+
}
|
|
25
|
+
finally {
|
|
26
|
+
// The parent keeps its barrier until every accepted descendant has settled.
|
|
27
|
+
while (lease.children.size)
|
|
28
|
+
await Promise.all([...lease.children]);
|
|
29
|
+
lease.active = false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const root = createToolCallScheduler(definitions, execute);
|
|
34
|
+
return (definition, run) => {
|
|
35
|
+
const inherited = leases.getStore();
|
|
36
|
+
const parent = inherited?.ingress === sessionToolIngress.getStore() ? inherited : undefined;
|
|
37
|
+
const result = (parent?.active ? parent.schedule : root)({
|
|
38
|
+
name: definition?.parallelSafety === 'safe' ? 'safe' : 'serial',
|
|
39
|
+
run
|
|
40
|
+
});
|
|
41
|
+
if (parent?.active) {
|
|
42
|
+
const settled = result.then(() => undefined, () => undefined);
|
|
43
|
+
parent.children.add(settled);
|
|
44
|
+
void settled.then(() => parent.children.delete(settled));
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
11
48
|
}
|
|
12
49
|
/** Schedules an incremental stream while preserving the same safe/serial barriers as batches. */
|
|
13
50
|
export function createToolCallScheduler(definitions, execute) {
|
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,28 @@ export { testMarAgentModelTransport } from './agent-core/model/transport-test.js
|
|
|
8
8
|
export type { AccessMode, ExecutionMode, ExecutionResult, MarAgentImageMetadata, RolloutBudgetOptions, RunInput, RunInputImage } from './agent-core/runtime/contracts.js';
|
|
9
9
|
export type { MarAgentEvent } from './agent-core/runtime/events.js';
|
|
10
10
|
export { createMarAgent } from './agent-core/sdk/agent.js';
|
|
11
|
+
export type { CoreAgentExtensionContext, CoreSessionExtensionContext, CoreRuntimeExtension, CoreExtensionSnapshot, CoreExtensionSource, CoreExtensionDiagnostic, CoreDomainOperations, CoreDomainFacts, CoreHookRegistrar, CoreCapabilitySnapshot, CoreCommandSpec, CorePromptSection, CoreServiceDeclaration, CoreServiceDependency } from './agent-core/extensions/contracts.js';
|
|
12
|
+
export type { CoreDisposer, CoreResourceRegistration, CoreResourceScope } from './agent-core/extensions/resources.js';
|
|
13
|
+
export type { CoreHookOptions, CoreInterceptor } from './agent-core/extensions/hooks.js';
|
|
14
|
+
export type { CoreOperationContext } from './agent-core/extensions/operation.js';
|
|
15
|
+
export type { CoreServiceKey, CoreServiceRegistry } from './agent-core/extensions/services.js';
|
|
16
|
+
export type { CoreToolSpec, CoreToolRef, CoreToolInvocation, CoreToolCheck, CoreToolAttempt, CoreToolCompletion, CoreToolFailure } from './agent-core/extensions/tools.js';
|
|
17
|
+
export type { CoreModelMessage, CoreModelRequest, CoreRequestSnapshot } from './agent-core/extensions/model-request.js';
|
|
18
|
+
export type { CoreModelEvent } from './agent-core/extensions/model-stream.js';
|
|
19
|
+
export type { CorePromptPart, CorePromptFacts, CorePromptComposition, CorePromptSectionInput } from './agent-core/extensions/prompt-composition.js';
|
|
20
|
+
export type { CoreFilesApi, CoreFilesBackend, CoreFilePath, CoreFileWrite, CoreFileRemove, CoreFileTransfer, CoreFileType, CoreFileInfo, CoreFileEntry, CoreFileCompletion } from './agent-core/extensions/files.js';
|
|
21
|
+
export type { CoreHostExtensionPorts, CoreHostToolSource, CoreHostToolsBackend } from './agent-core/host/contracts.js';
|
|
22
|
+
export type { CoreEnvironmentApi, CoreEnvironmentBackend, CoreEnvironmentKey, CoreEnvironmentSet, CoreEnvironmentChange, CoreEnvironmentCompletion } from './agent-core/extensions/environment.js';
|
|
23
|
+
export type { CoreMcpApi, CoreMcpBackend, CoreMcpConnectionBackend, CoreMcpToolCall, CoreMcpServerDefinition, CoreMcpServerRef, CoreMcpServerRegistration, CoreMcpConnectionRef, CoreMcpConnectInput, CoreMcpConnectionInput, CoreMcpCallInput, CoreMcpCatalog, CoreMcpCompletion } from './agent-core/extensions/mcp.js';
|
|
24
|
+
export type { CoreAgentsApi, CoreAgentsBackend, CoreAgentSpawnInput, CoreAgentTarget, CoreAgentWaitInput, CoreAgentMessageInput, CoreAgentSnapshot, CoreAgentHandledResult, CoreAgentSpawnResult, CoreAgentCompletion } from './agent-core/extensions/agents.js';
|
|
25
|
+
export type { CoreSettingsApi, CoreSettingsBackend, CoreSettingsReadInput, CoreSettingsUpdate, CoreSettingsDescription, CoreSettingDefinition, CoreSettingsSnapshot, CoreSettingsResult, CoreSettingsCompletion } from './agent-core/extensions/settings.js';
|
|
26
|
+
export type { CoreNetworkApi, CoreNetworkBackend, CoreHttpRequest, CoreHttpResponse, CoreHttpCompletion } from './agent-core/extensions/network.js';
|
|
27
|
+
export type { CoreSessionApi, CoreSessionReceipt, CoreSessionInspection, CoreSessionDescription, CoreSessionMessages, CoreSessionMessagesInput, CoreSessionMessage, CoreSessionOperationStatus, CoreAppendInput, CoreSubmitInput, CoreInputSource, CoreCompactInput, CoreSessionActionResult } from './agent-core/extensions/session-input.js';
|
|
28
|
+
export type { CorePromptInput, CorePromptResult } from './agent-core/extensions/prompt-input.js';
|
|
29
|
+
export type { CoreModelsApi, CoreModelDescription, CoreModelTextBlock, CoreGenerateInput, CoreGenerateResult } from './agent-core/extensions/models.js';
|
|
30
|
+
export type { CoreDataApi, CoreJsonValue, CoreCheckpoint, CoreCheckpointApi, CoreStateApi, CoreStateChange, CoreStoreApi, CoreStoreCommit } from './agent-core/extensions/data.js';
|
|
11
31
|
export { generateSessionTitle, type GenerateSessionTitleInput } from './shared/auto-title.js';
|
|
32
|
+
export type { CoreProcessesApi, CoreProcessesBackend, CoreProcessInput, CoreProcessRunInput, CoreProcessHandle, CoreProcessExit, CoreProcessResult, CoreProcessCompletion } from './agent-core/extensions/processes.js';
|
|
12
33
|
export type { CreateMarAgentOptions, CreateSessionInput, ExecutionHandle, MarAgent, MarAgentSession, SessionTitleUpdateInput } from './agent-core/sdk/types.js';
|
|
13
34
|
export { openMarAgentSessionCatalog, type MarAgentContextUsage, type MarAgentHistoryEntry, type MarAgentHistoryPage, type MarAgentSessionCatalog, type MarAgentSessionDeleteResult, type MarAgentSessionImage, type MarAgentSessionPage, type MarAgentSessionSummary } from './agent-core/session/catalog.js';
|
|
14
35
|
export type { SessionListInput, SessionSource } from './agent-core/session/types.js';
|
|
@@ -98,6 +98,7 @@ export class BubblewrapSandboxExecutor {
|
|
|
98
98
|
return child;
|
|
99
99
|
}
|
|
100
100
|
catch (error) {
|
|
101
|
+
request.signal?.throwIfAborted();
|
|
101
102
|
throw unavailable(error);
|
|
102
103
|
}
|
|
103
104
|
}
|
|
@@ -202,9 +203,11 @@ export class BubblewrapSandboxExecutor {
|
|
|
202
203
|
args.push(mount.access === 'READ_WRITE' ? '--bind' : '--ro-bind', mount.source, mount.destination);
|
|
203
204
|
if (request.owner !== undefined) {
|
|
204
205
|
if (!CURSOR_SAFE_ID.test(request.owner.sessionId) ||
|
|
205
|
-
!CURSOR_SAFE_ID.test(request.owner.executionId))
|
|
206
|
+
(request.owner.executionId !== undefined && !CURSOR_SAFE_ID.test(request.owner.executionId)))
|
|
206
207
|
throw policyInvalid();
|
|
207
|
-
args.push('--setenv', 'MAR_AGENT_SESSION_ID', request.owner.sessionId
|
|
208
|
+
args.push('--setenv', 'MAR_AGENT_SESSION_ID', request.owner.sessionId);
|
|
209
|
+
if (request.owner.executionId !== undefined)
|
|
210
|
+
args.push('--setenv', 'MAR_AGENT_EXECUTION_ID', request.owner.executionId);
|
|
208
211
|
}
|
|
209
212
|
for (const [name, value] of explicitEnvironment(request))
|
|
210
213
|
args.push('--setenv', name, value);
|