@myagentroam/agent 0.9.161 → 0.9.163

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.
@@ -1,2 +1,2 @@
1
- export declare const subagentPrompt = "# Subagents\nUse your own direct tools by default. Delegate only when a bounded task can proceed independently and parallelism has real value; do not delegate ordinary local search, a known-file read, a single verification command, a small edit, or sequential debugging. Give each child a self-contained objective, relevant paths and constraints, expected evidence, and a clear read/write boundary. Subagents cannot recurse and share the real filesystem; do not assign conflicting writes or assume isolation. Track background agent IDs, wait or cancel them, inspect their actual workspace effects, and verify every claim before incorporating it. Continue meaningful non-overlapping work after starting a background child. Wait for completion only when the next critical-path action is blocked on the final result, and then prefer one long wait measured in minutes rather than repeated short waits. Wait for a public message only when a fresh progress update would change the next decision; do not use message waits as heartbeat checks or request progress merely to confirm that a child is still running. The parent retains responsibility for the final result.";
1
+ export declare const subagentPrompt = "# Subagents\nCall agent_start, agent_wait, agent_message and agent_cancel directly, never inside code_exec; they are absent from the cell tools namespace. Use your own direct tools by default. Delegate only when a bounded task can proceed independently and parallelism has real value; do not delegate ordinary local search, a known-file read, a single verification command, a small edit, or sequential debugging. Give each child a self-contained objective, relevant paths and constraints, expected evidence, and a clear read/write boundary. Subagents cannot recurse and share the real filesystem; do not assign conflicting writes or assume isolation. Track background agent IDs, wait or cancel them, inspect their actual workspace effects, and verify every claim before incorporating it. Continue meaningful non-overlapping work after starting a background child. Wait for completion only when the next critical-path action is blocked on the final result, and then prefer one long wait measured in minutes rather than repeated short waits. Wait for a public message only when a fresh progress update would change the next decision; do not use message waits as heartbeat checks or request progress merely to confirm that a child is still running. The parent retains responsibility for the final result.";
2
2
  export declare const childSubagentInstruction = "You are a non-recursive subagent. Work only on the delegated objective and within its stated read/write scope. Do not broaden the parent task, ask the user, start another subagent, commit, or claim parent-level completion. Inspect relevant evidence, make only authorized changes, run proportional verification, and return a concise factual handoff containing findings, exact files changed, commands/tests actually run, failures or uncertainty, and anything the parent must verify.";
@@ -1,2 +1,2 @@
1
- export const subagentPrompt = '# Subagents\nUse your own direct tools by default. Delegate only when a bounded task can proceed independently and parallelism has real value; do not delegate ordinary local search, a known-file read, a single verification command, a small edit, or sequential debugging. Give each child a self-contained objective, relevant paths and constraints, expected evidence, and a clear read/write boundary. Subagents cannot recurse and share the real filesystem; do not assign conflicting writes or assume isolation. Track background agent IDs, wait or cancel them, inspect their actual workspace effects, and verify every claim before incorporating it. Continue meaningful non-overlapping work after starting a background child. Wait for completion only when the next critical-path action is blocked on the final result, and then prefer one long wait measured in minutes rather than repeated short waits. Wait for a public message only when a fresh progress update would change the next decision; do not use message waits as heartbeat checks or request progress merely to confirm that a child is still running. The parent retains responsibility for the final result.';
1
+ export const subagentPrompt = '# Subagents\nCall agent_start, agent_wait, agent_message and agent_cancel directly, never inside code_exec; they are absent from the cell tools namespace. Use your own direct tools by default. Delegate only when a bounded task can proceed independently and parallelism has real value; do not delegate ordinary local search, a known-file read, a single verification command, a small edit, or sequential debugging. Give each child a self-contained objective, relevant paths and constraints, expected evidence, and a clear read/write boundary. Subagents cannot recurse and share the real filesystem; do not assign conflicting writes or assume isolation. Track background agent IDs, wait or cancel them, inspect their actual workspace effects, and verify every claim before incorporating it. Continue meaningful non-overlapping work after starting a background child. Wait for completion only when the next critical-path action is blocked on the final result, and then prefer one long wait measured in minutes rather than repeated short waits. Wait for a public message only when a fresh progress update would change the next decision; do not use message waits as heartbeat checks or request progress merely to confirm that a child is still running. The parent retains responsibility for the final result.';
2
2
  export const childSubagentInstruction = 'You are a non-recursive subagent. Work only on the delegated objective and within its stated read/write scope. Do not broaden the parent task, ask the user, start another subagent, commit, or claim parent-level completion. Inspect relevant evidence, make only authorized changes, run proportional verification, and return a concise factual handoff containing findings, exact files changed, commands/tests actually run, failures or uncertainty, and anything the parent must verify.';
@@ -50,7 +50,7 @@ export class RolloutBudget {
50
50
  }
51
51
  assertAvailable() {
52
52
  if (this.stage === 'exhausted')
53
- throw new MarAgentError('MAR_AGENT_ROLLOUT_BUDGET_EXCEEDED', 'The shared execution token budget has been exhausted.');
53
+ throw new MarAgentError('MAR_AGENT_ROLLOUT_BUDGET_EXCEEDED', 'The execution token budget has been exhausted.');
54
54
  }
55
55
  }
56
56
  export function resolveRolloutBudgetOptions(options) {
@@ -9,7 +9,7 @@ import type { CoreAgentsBackend } from '../extensions/agents.js';
9
9
  import type { HostDescription, MarAgentHost } from '../host/contracts.js';
10
10
  import { type MarAgentReasoningEffort } from '../model/configuration.js';
11
11
  import type { ModelAdapter, ModelMessage } from '../model/contracts.js';
12
- import { RolloutBudget, resolveRolloutBudgetOptions } from '../runtime/rollout-budget.js';
12
+ import { resolveRolloutBudgetOptions } from '../runtime/rollout-budget.js';
13
13
  import { JsonlSessionStore } from '../session/jsonl-store.js';
14
14
  import { SubagentSessionController, type SubagentMailboxMessage, type SubagentMessageDelivery, type SubagentTurnHandle } from '../subagent/session-controller.js';
15
15
  import { createSessionToolScheduler } from '../tools/scheduler.js';
@@ -50,7 +50,6 @@ interface InternalMarAgentSession extends MarAgentSession {
50
50
  readonly initialMailbox: readonly SubagentMailboxMessage[];
51
51
  readonly turnId: string;
52
52
  readonly delivery?: SubagentMessageDelivery;
53
- readonly sharedRolloutBudget?: RolloutBudget;
54
53
  readonly mcpExecutionScopeId?: string;
55
54
  readonly origin?: CoreOperationContext;
56
55
  }): SubagentTurnHandle;
@@ -328,9 +328,9 @@ export function createSessionOpener(services) {
328
328
  let finalAnswer = '';
329
329
  let executionLoop;
330
330
  let manualCompaction;
331
- const rolloutBudget = internal.sharedRolloutBudget ??
332
- (rolloutBudgetOptions ? new RolloutBudget(rolloutBudgetOptions) : undefined);
333
- const ownsRolloutBudget = rolloutBudget !== undefined && internal.sharedRolloutBudget === undefined;
331
+ const rolloutBudget = sessionSource.type === 'user' && rolloutBudgetOptions
332
+ ? new RolloutBudget(rolloutBudgetOptions)
333
+ : undefined;
334
334
  let releaseSession;
335
335
  let executionToolSources;
336
336
  let selectedTurn;
@@ -583,8 +583,7 @@ export function createSessionOpener(services) {
583
583
  turnId: turn.turnId,
584
584
  ...(turn.origin === undefined ? {} : { origin: turn.origin }),
585
585
  mcpExecutionScopeId: executionId,
586
- ...(turn.delivery ? { delivery: turn.delivery } : {}),
587
- ...(rolloutBudget === undefined ? {} : { sharedRolloutBudget: rolloutBudget })
586
+ ...(turn.delivery ? { delivery: turn.delivery } : {})
588
587
  });
589
588
  }
590
589
  });
@@ -1466,8 +1465,7 @@ export function createSessionOpener(services) {
1466
1465
  if (sessionRuntime.toolSources === executionToolSources)
1467
1466
  delete sessionRuntime.toolSources;
1468
1467
  internal.signal?.removeEventListener('abort', abortSource);
1469
- if (ownsRolloutBudget)
1470
- rolloutBudget.discard();
1468
+ rolloutBudget?.discard();
1471
1469
  await manualCompaction?.dispose();
1472
1470
  await selectedTurn?.close().catch(() => undefined);
1473
1471
  try {
@@ -1778,10 +1776,7 @@ export function createSessionOpener(services) {
1778
1776
  ...(turn.mcpExecutionScopeId === undefined
1779
1777
  ? {}
1780
1778
  : { mcpExecutionScopeId: turn.mcpExecutionScopeId }),
1781
- ...(turn.delivery ? { delivery: turn.delivery } : {}),
1782
- ...(turn.sharedRolloutBudget === undefined
1783
- ? {}
1784
- : { sharedRolloutBudget: turn.sharedRolloutBudget })
1779
+ ...(turn.delivery ? { delivery: turn.delivery } : {})
1785
1780
  })
1786
1781
  };
1787
1782
  };
@@ -1,9 +1,9 @@
1
1
  import { MarAgentError } from '../../error.js';
2
2
  export const agentCancelToolDefinition = {
3
3
  name: 'agent_cancel',
4
- allowedCallers: ['direct', 'programmatic'],
4
+ allowedCallers: ['direct'],
5
5
  parallelSafety: 'serial',
6
- description: 'Idempotently cancel a child agent using the agentId returned by agent_start. For an exec processId, use exec with action:"cancel" instead. Waits for a running task to reach cancelled and returns its agentId and description.',
6
+ description: 'Idempotently cancel a child agent using the agentId returned by agent_start. For an exec processId, use exec_wait with action:"cancel" instead (tools.exec_wait in Code Mode). Waits for a running task to reach cancelled and returns its agentId and description.',
7
7
  inputSchema: {
8
8
  type: 'object',
9
9
  properties: { agentId: { type: 'string' } },
@@ -2,7 +2,7 @@ import { MarAgentError } from '../../error.js';
2
2
  import { TOOL_EXECUTION_LIMITS } from '../execution-limits.js';
3
3
  export const agentMessageToolDefinition = {
4
4
  name: 'agent_message',
5
- allowedCallers: ['direct', 'programmatic'],
5
+ allowedCallers: ['direct'],
6
6
  parallelSafety: 'serial',
7
7
  description: 'Send a real user message to an existing child agent. Default delivery=append inserts guidance into a running child turn at the next safe boundary after the current model response or complete tool batch. Explicit delivery=replace immediately requests cancellation, waits for the old turn to close, then starts a new turn in the same Session. When idle, either mode starts a new turn using persisted history. Returns messageId, turnId, deliveryStatus, current status, and model metadata without repeating the child’s previous latestMessage, latestActivity, summary, or verification evidence. accepted means queued in memory; applied means persisted in model context, not that the guidance has been executed. Use agent_wait for subsequent progress or completion. Does not wait for the new task to complete or roll back existing side effects.',
8
8
  inputSchema: {
@@ -3,7 +3,7 @@ import { marAgentReasoningEffortSchema } from '../../model/configuration.js';
3
3
  import { TOOL_EXECUTION_LIMITS } from '../execution-limits.js';
4
4
  export const agentStartToolDefinition = {
5
5
  name: 'agent_start',
6
- allowedCallers: ['direct', 'programmatic'],
6
+ allowedCallers: ['direct'],
7
7
  parallelSafety: 'serial',
8
8
  description: 'Start one bounded, non-recursive child agent with self-contained context. Use when an independent investigation would consume substantial main-context space or when safe parallel work has real value; keep small or tightly coupled work in the main context. All agents share the filesystem, so avoid conflicting writes. The optional reasoningEffort overrides the parent effort and must be supported by the selected model; omit it to inherit. Returns agentId for agent_wait, agent_message, or agent_cancel, description, queued/running/completed/failed/cancelled status, bounded summary, changedFiles, verification, and read evidence; background returns immediately while foreground waits for a terminal result.',
9
9
  inputSchema: {
@@ -2,7 +2,7 @@ import { MarAgentError } from '../../error.js';
2
2
  import { TOOL_EXECUTION_LIMITS } from '../execution-limits.js';
3
3
  export const agentWaitToolDefinition = {
4
4
  name: 'agent_wait',
5
- allowedCallers: ['direct', 'programmatic'],
5
+ allowedCallers: ['direct'],
6
6
  parallelSafety: 'serial',
7
7
  description: 'Read or wait a bounded time for a child agent result. waitFor defaults to "completion"; use "message" only when a fresh public commentary/final message would change the next decision. Omit agentId to wait for whichever live child returns first, matching Codex-style untargeted waiting and avoiding UUID transcription; provide the exact agentId returned by agent_start only when observing a specific child. If no child is live, untargeted waiting reads the most recently created child. For an exec processId, use exec_wait instead (tools.exec_wait in Code Mode). Omitting waitMs waits up to 30 seconds by default; waitMs=0 returns the current snapshot immediately. Positive waits range up to 5 minutes, and positive values below 10 seconds are raised to 10 seconds. When blocked on a live child result, prefer one 300000 ms completion wait rather than repeated short waits. Every result includes waitOutcome as snapshot, message, completion, or timeout plus the real agentId and description. A message, timeout with unread progress, or first terminal completion result includes the newly observed latest public commentary/final message; snapshots and repeated observations omit previously observed message text. latestActivity can still identify a public message or bounded tool started/completed/failed status. A queued or running result is not completion. A message wait consumes only the latest unread public message in the current Session runtime; tool activity does not wake it, and parent cancellation preserves unread progress for a later Execution. Do not use message waits as heartbeat checks or request progress merely to confirm that a child is still running. First terminal results include bounded summary, changedFiles, verification, and read evidence with path/line ranges; use that evidence to avoid repeating the full exploration, while independently checking consequential edits and claims.',
8
8
  inputSchema: {
@@ -13,7 +13,17 @@ export function toolCallers(tool) {
13
13
  export function allowsToolCaller(tool, caller) {
14
14
  // Control tools cannot be widened by a Host override or historical definition.
15
15
  if (caller === 'programmatic' &&
16
- ['code_exec', 'code_exec_wait', 'tool_search', 'question', 'skill'].includes(tool.name))
16
+ [
17
+ 'code_exec',
18
+ 'code_exec_wait',
19
+ 'tool_search',
20
+ 'question',
21
+ 'skill',
22
+ 'agent_start',
23
+ 'agent_wait',
24
+ 'agent_message',
25
+ 'agent_cancel'
26
+ ].includes(tool.name))
17
27
  return false;
18
28
  return toolCallers(tool).includes(caller);
19
29
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/agent",
3
- "version": "0.9.161",
3
+ "version": "0.9.163",
4
4
  "description": "Embeddable MAR coding agent SDK and CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",