@myagentroam/marctl 0.10.11 → 0.10.12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myagentroam/marctl",
3
- "version": "0.10.11",
3
+ "version": "0.10.12",
4
4
  "description": "MyAgentRoam command-line interface for authorized Node access.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/cli.mjs CHANGED
@@ -110,6 +110,7 @@ export async function main(
110
110
  ...(error.runId === undefined ? {} : { runId: error.runId }),
111
111
  ...(error.stage === undefined ? {} : { stage: error.stage }),
112
112
  ...(error.upstreamCode === undefined ? {} : { upstreamCode: error.upstreamCode }),
113
+ ...(error.progress === undefined ? {} : { progress: error.progress }),
113
114
  ...(error.clientMessageId === undefined ? {} : { clientMessageId: error.clientMessageId })
114
115
  };
115
116
  if (args?.json === true || (args === undefined && argv.includes('--json')))
@@ -117,6 +118,8 @@ export async function main(
117
118
  else {
118
119
  writeLine(stderr, program + ': ' + failure.message + ' [' + failure.code + ']');
119
120
  if (failure.details !== undefined) writeLine(stderr, failure.details);
121
+ if (failure.progress !== undefined)
122
+ writeLine(stderr, JSON.stringify({ progress: failure.progress }, null, 2));
120
123
  }
121
124
  return sessionExitCode(error);
122
125
  }
@@ -102,9 +102,11 @@ Titles and scheduled tasks:
102
102
  Read the current revision before updating; a version conflict is not retried.
103
103
 
104
104
  Reading JSON:
105
- show: session.activity, session.model, session.effort,
106
- session.customTitle / session.runnerTitle, runs[] (id/status),
107
- queue.items[], goal.status (goal may be null).
105
+ list: id/title/runner/status/runId and one latestActivity per Session.
106
+ show: session.status, session.title, session.runId,
107
+ session.model, session.effort, session.queuedCount,
108
+ session.latestMessage, session.recentTools (up to three summaries).
109
+ Status is RUNNING/IDLE/SLEEPING; tools keep their original states.
108
110
  history: segments[].items[]; select kind === "assistant_message",
109
111
  read payload.text.
110
112
 
@@ -122,6 +124,7 @@ Delivery and waiting:
122
124
  A queued runId may identify another
123
125
  active input: correlate queueItemId/clientMessageId with visible history.
124
126
  Wait observes the specified Run through Watch. Timeout does not stop it;
127
+ timeout errors may include progress, the last observed bounded snapshot.
125
128
  Run success is not proof of task success.
126
129
  Completion never wakes a Coordinator.
127
130
  On an unknown delivery outcome, inspect state/history; do not blindly resend.
@@ -99,9 +99,11 @@ ${configurationHelp}
99
99
  更新前读取当前 revision;版本冲突不会自动重试。
100
100
 
101
101
  读取 JSON:
102
- show:session.activity、session.model、session.effort、
103
- session.customTitle / session.runnerTitle、runs[](id/status)、
104
- queue.items[]、goal.status(goal 可为空)。
102
+ list:id/title/runner/status/runId,以及一条 latestActivity。
103
+ show:session.status、session.title、session.runId,
104
+ session.model、session.effort、session.queuedCount,
105
+ session.latestMessage、session.recentTools(最多三条摘要)。
106
+ 状态为 RUNNING/IDLE/SLEEPING;工具保留原有生命周期。
105
107
  history:segments[].items[] 中按 kind === "assistant_message"
106
108
  筛选,读取 payload.text。
107
109
 
@@ -117,6 +119,7 @@ ${configurationHelp}
117
119
  排队回执的 runId 可能属于其他活动输入,
118
120
  需按 queueItemId/clientMessageId 与可见历史核对。
119
121
  wait 通过 Watch 等待指定 Run;超时不会停止任务,
122
+ 超时错误可附 progress,表示最后观察到的有界快照。
120
123
  Run 成功不等于业务完成。Worker 完成不自动唤醒 Coordinator。
121
124
  投递结果未知时先查状态/历史,不盲目重发。
122
125
 
package/src/sessions.mjs CHANGED
@@ -349,6 +349,7 @@ export async function waitForSessionRun({
349
349
  let renewal;
350
350
  let settled = false;
351
351
  let subscribed = false;
352
+ let progress;
352
353
  let accept;
353
354
  let rejectResult;
354
355
  const result = new Promise((resolve, fail) => {
@@ -364,6 +365,7 @@ export async function waitForSessionRun({
364
365
  const fail = (code, key, { stage, upstreamCode, ...options } = {}) => {
365
366
  const error = new MarctlError(translate(key), { ...options, code });
366
367
  if (upstreamCode !== undefined) error.upstreamCode = upstreamCode;
368
+ if (stage === 'timeout' && progress !== undefined) error.progress = progress;
367
369
  reject(error, stage);
368
370
  };
369
371
  const unknown = (stage, detail, source) =>
@@ -458,8 +460,18 @@ export async function waitForSessionRun({
458
460
  unknown('snapshot', 'The requested Run was absent from the Watch snapshot.');
459
461
  return;
460
462
  }
463
+ if (message.payload?.session?.id === sessionId && message.payload?.progress?.runId === runId)
464
+ progress = message.payload.progress;
461
465
  check(run);
462
- } else if (message.type === 'watch.session.event') check(message.event?.payload?.run);
466
+ } else if (message.type === 'watch.session.event') {
467
+ const payload = message.event?.payload;
468
+ if (
469
+ (payload?.sessionId ?? payload?.run?.sessionId) === sessionId &&
470
+ payload?.progress?.runId === runId
471
+ )
472
+ progress = payload.progress;
473
+ check(payload?.run);
474
+ }
463
475
  if (!settled && message.expiresAt !== undefined) scheduleRenewal(message.expiresAt);
464
476
  };
465
477
  const onClose = (code, reason) => {