@myagentroam/node 0.11.23 → 0.11.24
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/connector.js +2 -1
- package/dist/marctl-guidance.js +6 -5
- package/dist/runner/codex/managed-run-controller.js +8 -2
- package/dist/runner/codex/tool-normalizer.js +5 -0
- package/dist/runner/codex-runner.js +9 -0
- package/dist/service/continuous-run-coordinator.js +41 -2
- package/dist/service/run-event-service.js +2 -1
- package/dist/service/run-workbench-service.js +5 -0
- package/dist/service/runner-interaction-service.js +29 -0
- package/dist/service/session-message-service.js +3 -0
- package/dist/service/session-recent-activity.js +29 -2
- package/dist/service/workbench-event-projection.js +7 -1
- package/package.json +4 -4
package/dist/connector.js
CHANGED
|
@@ -372,6 +372,7 @@ export class NodeConnector {
|
|
|
372
372
|
onTerminalRun: (run, status) => {
|
|
373
373
|
if (this.database !== undefined)
|
|
374
374
|
this.scheduledSessions.executionTerminated(run, status);
|
|
375
|
+
this.continuousRunCoordinator.runTerminated(run.sessionId);
|
|
375
376
|
},
|
|
376
377
|
dispatchQueue: async (sessionId, delayMs = 0) => {
|
|
377
378
|
if (this.upgradeCoordinator.pending())
|
|
@@ -543,7 +544,7 @@ export class NodeConnector {
|
|
|
543
544
|
emit: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
544
545
|
nativeGoalUpdated: (runId, goal) => this.goalCoordinator.handleNativeGoalUpdate(runId, goal),
|
|
545
546
|
cancel: (runId, threadId, turnId, cwd, status) => this.runnerInteractionService.cancelCodexTurn(runId, threadId, turnId, cwd, status),
|
|
546
|
-
createApproval: (input) => this.
|
|
547
|
+
createApproval: (input) => this.runnerInteractionService.createCodexApproval(input),
|
|
547
548
|
publishApproval: (input) => this.runnerInteractionService.publishApproval(input),
|
|
548
549
|
emitItem: (runId, item) => this.emitConversationItem(runId, item),
|
|
549
550
|
appendImages: (runId, images) => this.runAttachmentService.append(runId, images.filter(isRunnerImageAttachment)),
|
package/dist/marctl-guidance.js
CHANGED
|
@@ -5,7 +5,7 @@ export function hasMarctlContext(environment) {
|
|
|
5
5
|
!!environment['MAR_CTL_NODE_ID'] &&
|
|
6
6
|
!!environment['MAR_CTL_WORKSPACE_ID']);
|
|
7
7
|
}
|
|
8
|
-
export const marctlDescription = 'You are in a MAR-managed Workspace with marctl on PATH. Load this guide to create, coordinate, message or stop independent Sessions; inspect
|
|
8
|
+
export const marctlDescription = 'You are in a MAR-managed Workspace with marctl on PATH. Load this guide to create, coordinate, message or stop independent Sessions; inspect status/history/results; change titles, prompts or models; observe and decide approvals; manage Goals or scheduled tasks; or run commands/transfer files on other authorized MAR Nodes, even when marctl is not named. Ordinary local shell work and built-in subagents alone do not require it.';
|
|
9
9
|
export const marctlInstructions = [
|
|
10
10
|
'## MAR Workspace CLI',
|
|
11
11
|
'Use your native shell tool to run marctl. Reuse loaded guidance while it remains in context. Consult local marctl help sessions for unclear options (shared by all Session subcommands) and marctl --version when version matters; neither needs a network request. Capabilities and permissions still apply.',
|
|
@@ -15,15 +15,16 @@ export const marctlInstructions = [
|
|
|
15
15
|
'Change an existing Session with sessions config <session-id> --model <id> --effort high --json; either option can be set alone. Use show for current settings; active execution is not restarted.',
|
|
16
16
|
'Prefer -m / --message for short text; use --message-file for longer UTF-8 text or an existing file (- reads stdin). These options are mutually exclusive. Example: marctl sessions start --runner codex --title "fixer#42 Handle empty totals" -m "Implement issue #42 and report test evidence" --json. Other Runner names are mar-agent, claude-code and opencode. An omitted model uses the target Runner configuration, not the Coordinator model.',
|
|
17
17
|
'For start/send, repeat --image <local-path> to attach PNG, JPEG, GIF or WebP images, with or without text. Images are read on this CLI host, not by remote path. Limits: 5 images, 5 MiB each, 10 MiB total. Actual Runner/model image capabilities apply; goal set accepts text only.',
|
|
18
|
-
'Create workers only as tasks need them, named fixer#<task-id> <description> or reviewer#<task-or-change-id> <description>. These are conventions, not product roles or a fixed pool. Put role, scope, acceptance criteria and delivery requirements in the first message. Follow the repository workflow for development and review.
|
|
18
|
+
'Create workers only as tasks need them, named fixer#<task-id> <description> or reviewer#<task-or-change-id> <description>. These are conventions, not product roles or a fixed pool. Put role, scope, acceptance criteria and delivery requirements in the first message. Follow the repository workflow for development and review. Use sessions prompt get/set/clear [session-id] to read, set or clear persistent instructions; set uses -m or --message-file. Changes apply to future executions, including queued work, without interrupting current execution.',
|
|
19
19
|
'Reuse recorded Session/Run IDs and receipts. Refresh execution state with show only when the next action depends on it; use goal get or schedule get for those details. Select needed JSON fields instead of dumping full Session lists or tool transcripts. Hidden reasoning, credentials and raw model requests are not collaboration artifacts.',
|
|
20
|
-
'list returns id/title/runner/status/runId and one latestActivity per Session. show --json fields: session.id, session.title, session.runner, session.status, session.runId, session.model, session.effort, session.queuedCount, session.latestMessage, session.recentTools (at most three). Status is RUNNING/IDLE/SLEEPING; tools keep their original states. Activity is bounded public evidence, not proof of task completion; use history for full results.',
|
|
20
|
+
'list returns id/title/runner/status/runId and one latestActivity per Session. show --json fields: session.id, session.title, session.runner, session.status, session.runId, session.model, session.effort, session.queuedCount, session.latestMessage, session.recentTools (at most three), session.pendingApprovals and pendingApprovalsTruncated. Approvals use public Run IDs, without raw tool input. Status is RUNNING/IDLE/SLEEPING; tools keep their original states. Activity is bounded public evidence, not proof of task completion; use history for full results.',
|
|
21
21
|
'Rename any authorized Workspace Session with sessions rename <session-id> --title <name> --json; parent relationships do not restrict renaming.',
|
|
22
|
-
'show/config/history/graph/rename and schedule get/create/update may omit the Session ID to use the current Session. Without a current Session, specify an ID. send/goal/stop/wait always require explicit target IDs.',
|
|
22
|
+
'show/config/history/graph/rename, prompt and schedule get/create/update may omit the Session ID to use the current Session. Without a current Session, specify an ID. send/goal/stop/wait/approval always require explicit target IDs.',
|
|
23
23
|
'Use sessions schedule list/get/create/update for the same tasks as the built-in schedule MCP, which remains available in other Runners and is hidden in MAR Agent while its marctl skill is available. list is Workspace-scoped. create requires --cron and text (-m/--message-file, up to 20,000 characters). update requires --expected-revision from get and at least cron or text. get returns task (null if absent), with id, revision, objective, cron, timezone and enabled; applied updates also return task. Reuse that task instead of probing its shape or refetching unchanged state. Schedule text is trimmed at both ends; compare after the same trimming; a conclusive update response needs no extra get. Other-owner edits return a PENDING proposal, not an applied change. Scheduled execution uses normal user permissions. Follow existing approval rules and do not retry conflicts or uncertain writes blindly.',
|
|
24
24
|
'Read results with sessions history <session-id> --limit 10 --json (default: latest 10 SEGMENTs, not messages; --limit 1..100). In segments[].items[], select kind === "assistant_message" and read payload.text; keep segment runId and user_message.payload.clientMessageId for queued-input correlation. Reuse the returned page; follow --cursor <nextCursor> only for missing evidence.',
|
|
25
|
-
'Use sessions send <session-id> --steer -m "Additional context: focus on the resume path." --json for decision-changing updates rather than routine reports: it may switch the current execution. Node decides delivery from actual state; an idle Session receives ordinary input. Choose exactly one of --steer or --queue, even when idle; missing, conflicting, repeated, or obsolete options are rejected locally before input is read or a request is sent. Use --queue to place input in a subsequent turn; with an active Goal, ordinary queued input waits until the Goal exits. start/send return clientMessageId and the accepted/queued result. A queued result may refer to the currently active Run: associate queueItemId/clientMessageId with history before deciding that input finished. There are no queue-item edit/delete/reorder commands; show returns only queuedCount.',
|
|
25
|
+
'Use sessions send <session-id> --steer -m "Additional context: focus on the resume path." --json for decision-changing updates rather than routine reports: it may switch the current execution. Node decides delivery from actual state; an idle Session receives ordinary input. Choose exactly one of --steer or --queue, even when idle; missing, conflicting, repeated, or obsolete options are rejected locally before input is read or a request is sent. Use --queue to place input in a subsequent turn without interrupting active execution. New input resumes a paused queue using ordinary send admission after cancellation settles; later explicit stops still apply; with an active Goal, ordinary queued input waits until the Goal exits. start/send return clientMessageId and the accepted/queued result. A queued result may refer to the currently active Run: associate queueItemId/clientMessageId with history before deciding that input finished. There are no queue-item edit/delete/reorder commands; show returns only queuedCount.',
|
|
26
26
|
'Wait with sessions wait <session-id> --run <run-id> --timeout 5m --json through the existing Watch. Prefer --timeout 5m when blocked on task completion; use 30s for a short deadline. Continue useful independent work before waiting. If your shell tool returns a running process or cell, reuse its process/cell handle rather than starting another wait or polling show/list. A timeout may include progress, the last observed snapshot, not a fresh query. Timeout or cancelled waiting does not stop the task. Use sessions stop <session-id> --run <run-id> --json only to stop that active Run; ownership rules still apply.',
|
|
27
|
+
'Use wait --until approval to return early when a Run needs a decision. Inspect show/history, then use sessions approval decide <session-id> --run <public-run-id> --approval <approval-id> --decision approve|reject --json for one explicitly authorized request. This does not grant authority or auto-approve tools. Acknowledgment is not completion; observe status/history and wait again as needed.',
|
|
27
28
|
'Goal get/set/clear use the existing Session Goal semantics; see marctl help sessions. A Coordinator can work from ordinary messages or its existing schedule without a Goal. Worker completion never automatically wakes it. Actively wait/read results, or finish and reconcile on the next user message or scheduled input.',
|
|
28
29
|
'## Verify, recover and respect authorization',
|
|
29
30
|
'An accepted message or SUCCEEDED Run is not proof of business completion. Inspect artifacts and test evidence.',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NODE_MCP } from '../../mcp/naming.js';
|
|
2
2
|
import { nodeExecutionEnvironment } from '../../node-execution-environment.js';
|
|
3
3
|
import { extractId } from './conversation-parser.js';
|
|
4
|
+
import { normalizeCodexApproval } from './tool-normalizer.js';
|
|
4
5
|
import { parseSecretEnvironment } from '../../util/secret-environment.js';
|
|
5
6
|
import { safeErrorCode } from '../../util/safe-error.js';
|
|
6
7
|
import { runnerErrorProjection } from '../../util/runner-error.js';
|
|
@@ -499,6 +500,11 @@ export class CodexManagedRunController {
|
|
|
499
500
|
requestApproval(runId, notification) {
|
|
500
501
|
const approvalId = `codex:${runId}:${notification.requestId}`;
|
|
501
502
|
const expiresAt = Date.now() + 10 * 60_000;
|
|
503
|
+
const payload = {
|
|
504
|
+
method: notification.method,
|
|
505
|
+
params: notification.params,
|
|
506
|
+
...normalizeCodexApproval(notification.method)
|
|
507
|
+
};
|
|
502
508
|
this.runner.execution.approvals.set(approvalId, {
|
|
503
509
|
runId,
|
|
504
510
|
requestId: notification.requestId
|
|
@@ -507,7 +513,7 @@ export class CodexManagedRunController {
|
|
|
507
513
|
this.host.createApproval({
|
|
508
514
|
runId,
|
|
509
515
|
approvalId,
|
|
510
|
-
payload
|
|
516
|
+
payload,
|
|
511
517
|
expiresAt
|
|
512
518
|
});
|
|
513
519
|
}
|
|
@@ -518,7 +524,7 @@ export class CodexManagedRunController {
|
|
|
518
524
|
this.host.publishApproval({
|
|
519
525
|
runId,
|
|
520
526
|
approvalId,
|
|
521
|
-
payload
|
|
527
|
+
payload,
|
|
522
528
|
expiresAt
|
|
523
529
|
});
|
|
524
530
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { compactRunnerText } from '../../util/node-operation-parsers.js';
|
|
2
|
+
export function normalizeCodexApproval(method) {
|
|
3
|
+
return method === 'item/commandExecution/requestApproval'
|
|
4
|
+
? { toolName: 'command_execution', reason: 'Command execution requires approval.' }
|
|
5
|
+
: { toolName: 'file_change', reason: 'File changes require approval.' };
|
|
6
|
+
}
|
|
2
7
|
export function normalizeCodexTool(input) {
|
|
3
8
|
const name = compactRunnerText(input.name, 128) || 'tool';
|
|
4
9
|
const rawInput = input.rawInput;
|
|
@@ -564,6 +564,12 @@ export class CodexRunner extends AbstractRunner {
|
|
|
564
564
|
this.runClients.set(runId, client);
|
|
565
565
|
}
|
|
566
566
|
releaseEnvironment(runId) {
|
|
567
|
+
for (const [id, approval] of this.execution.approvals) {
|
|
568
|
+
if (approval.runId !== runId)
|
|
569
|
+
continue;
|
|
570
|
+
clearTimeout(approval.timer);
|
|
571
|
+
this.execution.approvals.delete(id);
|
|
572
|
+
}
|
|
567
573
|
const client = this.runClients.get(runId);
|
|
568
574
|
if (client === undefined)
|
|
569
575
|
return;
|
|
@@ -575,6 +581,9 @@ export class CodexRunner extends AbstractRunner {
|
|
|
575
581
|
}
|
|
576
582
|
}
|
|
577
583
|
stop() {
|
|
584
|
+
for (const approval of this.execution.approvals.values())
|
|
585
|
+
clearTimeout(approval.timer);
|
|
586
|
+
this.execution.approvals.clear();
|
|
578
587
|
this.profileGeneration += 1;
|
|
579
588
|
for (const profileClient of this.profileClients)
|
|
580
589
|
profileClient.stop();
|
|
@@ -13,6 +13,7 @@ export class ContinuousRunCoordinator {
|
|
|
13
13
|
immediateQueueItems = new Set();
|
|
14
14
|
queueExecutionAdmissions = new Map();
|
|
15
15
|
steerInFlight = new Map();
|
|
16
|
+
deferredQueueResumes = new Map();
|
|
16
17
|
suspended = false;
|
|
17
18
|
constructor(options) {
|
|
18
19
|
this.options = options;
|
|
@@ -164,9 +165,22 @@ export class ContinuousRunCoordinator {
|
|
|
164
165
|
this.canSteer(active) &&
|
|
165
166
|
(input.steerTarget.executionId === undefined ||
|
|
166
167
|
this.options.runtime.currentExecutionId(active.id) === input.steerTarget.executionId);
|
|
167
|
-
const
|
|
168
|
-
|
|
168
|
+
const pauseVersion = this.options.runtime.sessionQueuePauseVersion(sessionId);
|
|
169
|
+
// An explicit pause after this input's admission takes precedence over automatic recovery.
|
|
170
|
+
if (input.externalInput &&
|
|
171
|
+
pauseVersion !== undefined &&
|
|
172
|
+
pauseVersion !== input.queuePauseVersion)
|
|
169
173
|
return 'QUEUED';
|
|
174
|
+
const intent = input.steerTarget !== undefined && !steering
|
|
175
|
+
? 'SEND'
|
|
176
|
+
: input.externalInput && input.queueBefore.paused && input.intent === 'QUEUE'
|
|
177
|
+
? 'SEND'
|
|
178
|
+
: input.intent;
|
|
179
|
+
if (active?.status === 'CANCELLING' && intent !== 'REPLACE_CURRENT') {
|
|
180
|
+
if (input.externalInput && item && pauseVersion !== undefined)
|
|
181
|
+
this.deferredQueueResumes.set(item.id, pauseVersion);
|
|
182
|
+
return 'QUEUED';
|
|
183
|
+
}
|
|
170
184
|
if (steering)
|
|
171
185
|
this.prepareSteering(input.submissionId);
|
|
172
186
|
const executionEnded = active !== undefined &&
|
|
@@ -517,6 +531,9 @@ export class ContinuousRunCoordinator {
|
|
|
517
531
|
if ([...this.steerInFlight.values()].some((entry) => entry.sessionId === sessionId))
|
|
518
532
|
return;
|
|
519
533
|
const active = this.options.runtime.activeSessionRun(sessionId);
|
|
534
|
+
if (active?.status === 'CANCELLING')
|
|
535
|
+
return;
|
|
536
|
+
this.resumeDeferredQueue(sessionId);
|
|
520
537
|
if (active === undefined) {
|
|
521
538
|
await this.startIdleQueue(sessionId);
|
|
522
539
|
return;
|
|
@@ -694,6 +711,7 @@ export class ContinuousRunCoordinator {
|
|
|
694
711
|
}
|
|
695
712
|
}
|
|
696
713
|
remove(id) {
|
|
714
|
+
this.deferredQueueResumes.delete(id);
|
|
697
715
|
this.immediateQueueItems.delete(id);
|
|
698
716
|
this.environmentLeases.get(id)?.();
|
|
699
717
|
this.environmentLeases.delete(id);
|
|
@@ -739,10 +757,31 @@ export class ContinuousRunCoordinator {
|
|
|
739
757
|
this.startedExecutions.clear();
|
|
740
758
|
this.immediateQueueItems.clear();
|
|
741
759
|
this.queueExecutionAdmissions.clear();
|
|
760
|
+
this.deferredQueueResumes.clear();
|
|
742
761
|
for (const timer of this.scheduledSessions.values())
|
|
743
762
|
clearTimeout(timer);
|
|
744
763
|
this.scheduledSessions.clear();
|
|
745
764
|
}
|
|
765
|
+
runTerminated(sessionId) {
|
|
766
|
+
const queue = this.options.runtime.sessionQueue(sessionId);
|
|
767
|
+
if ((!queue.paused && queue.itemIds.length > 0) ||
|
|
768
|
+
[...this.deferredQueueResumes.keys()].some((id) => this.options.runtime.getQueueItem(id)?.sessionId === sessionId))
|
|
769
|
+
this.schedule(sessionId);
|
|
770
|
+
}
|
|
771
|
+
resumeDeferredQueue(sessionId) {
|
|
772
|
+
for (const [id, pauseVersion] of this.deferredQueueResumes) {
|
|
773
|
+
const item = this.options.runtime.getQueueItem(id);
|
|
774
|
+
if (item?.sessionId !== sessionId)
|
|
775
|
+
continue;
|
|
776
|
+
this.deferredQueueResumes.delete(id);
|
|
777
|
+
if (this.options.runtime.sessionQueuePauseVersion(sessionId) !== pauseVersion)
|
|
778
|
+
continue;
|
|
779
|
+
this.options.runtime.resumeSessionQueue(sessionId);
|
|
780
|
+
if (!this.options.goalActive?.(sessionId))
|
|
781
|
+
this.options.runtime.prioritizeQueueItem(id);
|
|
782
|
+
this.publish(sessionId);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
746
785
|
async startIdleQueue(sessionId, throwOnError = false) {
|
|
747
786
|
if (this.options.runtime.activeSessionRun(sessionId) !== undefined) {
|
|
748
787
|
this.schedule(sessionId);
|
|
@@ -134,7 +134,8 @@ export class RunEventService {
|
|
|
134
134
|
const interrupted = this.options.state.interruptRequested.delete(executionId);
|
|
135
135
|
manuallyInterrupted = interrupted;
|
|
136
136
|
const queue = this.options.runtime.sessionQueue(run.sessionId);
|
|
137
|
-
const continues =
|
|
137
|
+
const continues = run.status !== 'CANCELLING' &&
|
|
138
|
+
permissionStop === undefined &&
|
|
138
139
|
((!queue.paused && queue.itemIds.length > 0) ||
|
|
139
140
|
this.options.keepRunActive?.(run.sessionId) === true);
|
|
140
141
|
if (!continues) {
|
|
@@ -109,6 +109,11 @@ export class RunWorkbenchService {
|
|
|
109
109
|
const current = this.options.runtime.getApproval(input.approvalId);
|
|
110
110
|
if (current === undefined || this.options.runtime.canonicalRunId(current.runId) !== input.runId)
|
|
111
111
|
throw new Error('APPROVAL_NOT_FOUND');
|
|
112
|
+
const run = this.options.runtime.activeSessionRun(this.requireRun(input.runId).sessionId);
|
|
113
|
+
if (run?.id !== input.runId ||
|
|
114
|
+
(current.runId !== run.id &&
|
|
115
|
+
current.runId !== this.options.runtime.currentExecutionId(run.id)))
|
|
116
|
+
throw new Error('APPROVAL_NOT_FOUND');
|
|
112
117
|
this.assertRunOwner(current.runId, input.__requestUserId);
|
|
113
118
|
const approval = this.options.runtime.decideApproval(input.approvalId, input.decision);
|
|
114
119
|
this.options.emitRun(approval.runId, 'approval.decided', {
|
|
@@ -130,11 +130,40 @@ export class RunnerInteractionService {
|
|
|
130
130
|
delivery
|
|
131
131
|
}));
|
|
132
132
|
}
|
|
133
|
+
createCodexApproval(input) {
|
|
134
|
+
this.options.runtime.createApproval(input);
|
|
135
|
+
const approvals = this.options.codex().execution.approvals;
|
|
136
|
+
const pending = approvals.get(input.approvalId);
|
|
137
|
+
const expire = () => {
|
|
138
|
+
const current = approvals.get(input.approvalId);
|
|
139
|
+
if (current === undefined)
|
|
140
|
+
return;
|
|
141
|
+
try {
|
|
142
|
+
this.options.runtime.expireApproval(input.approvalId);
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (error instanceof Error && error.message === 'APPROVAL_NOT_EXPIRED') {
|
|
146
|
+
const timer = setTimeout(expire, Math.max(1, input.expiresAt - Date.now()));
|
|
147
|
+
timer.unref();
|
|
148
|
+
approvals.set(input.approvalId, { ...current, timer });
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
approvals.delete(input.approvalId);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.options.emitRun(input.runId, 'approval.expired', { approvalId: input.approvalId });
|
|
155
|
+
this.decideCodexApproval(input.approvalId, 'REJECTED');
|
|
156
|
+
};
|
|
157
|
+
const timer = setTimeout(expire, Math.max(1, input.expiresAt - Date.now()));
|
|
158
|
+
timer.unref();
|
|
159
|
+
approvals.set(input.approvalId, { ...pending, timer });
|
|
160
|
+
}
|
|
133
161
|
decideCodexApproval(approvalId, decision) {
|
|
134
162
|
const codex = this.options.codex();
|
|
135
163
|
const approval = codex.execution.approvals.get(approvalId);
|
|
136
164
|
if (approval === undefined)
|
|
137
165
|
return false;
|
|
166
|
+
clearTimeout(approval.timer);
|
|
138
167
|
try {
|
|
139
168
|
codex.respond(approval.requestId, { decision: decision === 'APPROVED' ? 'accept' : 'decline' }, approval.runId);
|
|
140
169
|
}
|
|
@@ -158,6 +158,7 @@ export class SessionMessageService {
|
|
|
158
158
|
? input.__queueItemId
|
|
159
159
|
: randomUUID();
|
|
160
160
|
const queueBeforeCreate = this.options.runtime.sessionQueue(session.id);
|
|
161
|
+
const queuePauseVersion = this.options.runtime.sessionQueuePauseVersion(session.id);
|
|
161
162
|
const active = this.options.runtime.activeSessionRun(session.id);
|
|
162
163
|
if (internalSchedule && (active !== undefined || queueBeforeCreate.itemIds.length > 0))
|
|
163
164
|
throw new Error('SCHEDULE_SESSION_BUSY');
|
|
@@ -309,6 +310,8 @@ export class SessionMessageService {
|
|
|
309
310
|
},
|
|
310
311
|
submissionId,
|
|
311
312
|
intent,
|
|
313
|
+
externalInput: userMessage,
|
|
314
|
+
...(queuePauseVersion === undefined ? {} : { queuePauseVersion }),
|
|
312
315
|
queueBefore: queueBeforeCreate,
|
|
313
316
|
...(steerTarget === undefined ? {} : { steerTarget }),
|
|
314
317
|
...(replaceCurrentRun === undefined ? {} : { activeRunId: replaceCurrentRun.id })
|
|
@@ -78,7 +78,33 @@ function activity(runtime, sessionId) {
|
|
|
78
78
|
}
|
|
79
79
|
export function marctlSessionProgress(runtime, sessionId) {
|
|
80
80
|
const { latestActivity: _latest, ...progress } = activity(runtime, sessionId);
|
|
81
|
-
return progress;
|
|
81
|
+
return { ...progress, ...pendingApprovals(runtime, sessionId) };
|
|
82
|
+
}
|
|
83
|
+
/** Summarizes current approval facts without exposing tool input or native payloads. */
|
|
84
|
+
function pendingApprovals(runtime, sessionId) {
|
|
85
|
+
const run = runtime.activeSessionRun(sessionId);
|
|
86
|
+
const executionId = run && runtime.currentExecutionId(run.id);
|
|
87
|
+
const approvals = run && !isTerminalRunStatus(run.status)
|
|
88
|
+
? runtime
|
|
89
|
+
.listApprovals(run.id)
|
|
90
|
+
.filter((approval) => approval.status === 'PENDING' &&
|
|
91
|
+
(approval.runId === run.id || approval.runId === executionId))
|
|
92
|
+
: [];
|
|
93
|
+
return {
|
|
94
|
+
pendingApprovals: approvals.slice(0, 20).map((approval) => {
|
|
95
|
+
const payload = isPlainRecord(approval.payload) ? approval.payload : {};
|
|
96
|
+
const name = clip(typeof payload.toolName === 'string' ? payload.toolName : 'Approval', 128);
|
|
97
|
+
const summary = clip(typeof payload.reason === 'string' ? payload.reason : 'Approval required', 100);
|
|
98
|
+
return {
|
|
99
|
+
runId: run.id,
|
|
100
|
+
approvalId: approval.id,
|
|
101
|
+
name: name.text,
|
|
102
|
+
summary: summary.text,
|
|
103
|
+
truncated: name.truncated || summary.truncated
|
|
104
|
+
};
|
|
105
|
+
}),
|
|
106
|
+
pendingApprovalsTruncated: approvals.length > 20
|
|
107
|
+
};
|
|
82
108
|
}
|
|
83
109
|
function identity(session) {
|
|
84
110
|
return {
|
|
@@ -104,7 +130,8 @@ export function marctlSessionDetail(runtime, session, queuedCount) {
|
|
|
104
130
|
effort: session.effort,
|
|
105
131
|
queuedCount,
|
|
106
132
|
latestMessage,
|
|
107
|
-
recentTools
|
|
133
|
+
recentTools,
|
|
134
|
+
...pendingApprovals(runtime, session.id)
|
|
108
135
|
};
|
|
109
136
|
}
|
|
110
137
|
function time(item) {
|
|
@@ -78,7 +78,13 @@ export function projectWorkbenchPayload(queries, category, payload) {
|
|
|
78
78
|
payload = {
|
|
79
79
|
sessionId: turn.sessionId,
|
|
80
80
|
runId: turn.runId,
|
|
81
|
-
...([
|
|
81
|
+
...([
|
|
82
|
+
'assistant_message',
|
|
83
|
+
'tool_call',
|
|
84
|
+
'command_execution',
|
|
85
|
+
'file_change',
|
|
86
|
+
'approval_request'
|
|
87
|
+
].includes(item.kind) &&
|
|
82
88
|
(rawPayload?.append === undefined || item.status !== 'IN_PROGRESS')
|
|
83
89
|
? { progress: queries.progress(turn.sessionId) }
|
|
84
90
|
: {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.24",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"playwright": "1.62.1",
|
|
38
38
|
"ws": "^8.21.3",
|
|
39
39
|
"zod": "4.4.3",
|
|
40
|
-
"@myagentroam/agent": "0.11.
|
|
40
|
+
"@myagentroam/agent": "0.11.24",
|
|
41
41
|
"@myagentroam/code-navigation": "0.11.0",
|
|
42
|
-
"@myagentroam/protocol": "0.11.
|
|
43
|
-
"@myagentroam/marctl": "0.11.
|
|
42
|
+
"@myagentroam/protocol": "0.11.24",
|
|
43
|
+
"@myagentroam/marctl": "0.11.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/ws": "^8.18.1"
|