@myagentroam/node 0.11.35 → 0.11.37
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/application/execution-lifecycle.js +54 -0
- package/dist/application/node-lifecycle.js +104 -0
- package/dist/application/node-operation-admission.js +51 -0
- package/dist/application/node-operation-contracts.js +1 -0
- package/dist/application/runner-composition.js +22 -0
- package/dist/application/session-projection-composition.js +26 -0
- package/dist/application/workspace-application.js +61 -0
- package/dist/application/workspace-composition.js +21 -0
- package/dist/capabilities.js +2 -2
- package/dist/codex-app-server.js +1 -471
- package/dist/connection/authorization.js +26 -0
- package/dist/{service → connection}/direct-transfer-service.js +1 -1
- package/dist/connection/endpoints.js +32 -0
- package/dist/connector.js +144 -252
- package/dist/database.js +34 -14
- package/dist/git-askpass.js +1 -1
- package/dist/git-execution-helper.js +1 -1
- package/dist/hosting/hosted-conversation-file-identity.js +27 -0
- package/dist/hosting/hosted-conversation-file-operations.js +44 -0
- package/dist/hosting/hosted-conversation-node-service.js +974 -0
- package/dist/hosting/hosted-conversation-runs.js +599 -0
- package/dist/hosting/hosted-conversation-templates.js +280 -0
- package/dist/hosting/hosted-conversation-uploads.js +344 -0
- package/dist/hosting/hosted-conversation-watch.js +194 -0
- package/dist/hosting/runtime-contracts.js +1 -0
- package/dist/marctl-guidance.js +1 -1
- package/dist/runner/abstract-runner.js +4 -13
- package/dist/{claude-agent-sdk.js → runner/claude/claude-agent-sdk.js} +2 -2
- package/dist/runner/claude/conversation-parser.js +2 -1
- package/dist/runner/claude/managed-run-controller.js +6 -7
- package/dist/runner/claude/message-parsers.js +2 -1
- package/dist/runner/claude/native-transcript.js +2 -1
- package/dist/runner/claude/tool-normalizer.js +1 -1
- package/dist/runner/claude-code-runner.js +2 -2
- package/dist/runner/codex/codex-app-server.js +471 -0
- package/dist/runner/codex/conversation-parser.js +4 -2
- package/dist/runner/codex/managed-run-controller.js +7 -9
- package/dist/runner/codex/native-transcript.js +1 -1
- package/dist/runner/codex/tool-normalizer.js +1 -1
- package/dist/runner/codex-runner.js +9 -27
- package/dist/runner/contracts.js +1 -0
- package/dist/runner/mar-agent/conversation-normalizer.js +2 -2
- package/dist/runner/mar-agent/history-projection.js +1 -1
- package/dist/runner/mar-agent/hosted-conversation-runtime.js +6 -10
- package/dist/runner/mar-agent/managed-run-controller.js +85 -61
- package/dist/runner/mar-agent-runner.js +1 -1
- package/dist/runner/normalization.js +42 -0
- package/dist/runner/opencode/conversation-parser.js +1 -1
- package/dist/runner/opencode/managed-run-controller.js +6 -7
- package/dist/{opencode-server.js → runner/opencode/opencode-server.js} +2 -2
- package/dist/runner/opencode/tool-normalizer.js +1 -1
- package/dist/runner/opencode-runner.js +4 -5
- package/dist/runner/runner-registry.js +4 -1
- package/dist/runtime-state.js +48 -372
- package/dist/service/computer-use-enablement-service.js +1 -1
- package/dist/service/continuous-run-coordinator.js +52 -7
- package/dist/service/conversation-history-service.js +4 -4
- package/dist/service/conversation-hosting-capability-service.js +1 -1
- package/dist/service/conversation-hosting-enablement-service.js +1 -1
- package/dist/service/conversation-hosting-lifecycle-service.js +3 -3
- package/dist/service/conversation-hosting-maintenance-service.js +1 -1
- package/dist/service/conversation-observation.js +1 -1
- package/dist/service/conversation-segment-service.js +1 -1
- package/dist/service/external-session-resume-service.js +47 -27
- package/dist/service/fake-managed-run-service.js +3 -7
- package/dist/service/git-operation-service.js +1 -1
- package/dist/service/goal-continuation-coordinator.js +14 -7
- package/dist/service/mar-agent-model-transport-test-service.js +1 -1
- package/dist/service/native-session-watch-service.js +1 -1
- package/dist/service/node-control-channel.js +1 -5
- package/dist/service/node-request-service.js +1 -1
- package/dist/service/node-terminal-channel.js +2 -1
- package/dist/service/node-workspace-coordinator.js +3 -2
- package/dist/service/notification-mcp-bridge.js +6 -2
- package/dist/service/recent-run-projection-service.js +1 -1
- package/dist/service/restart-session-restorer.js +1 -1
- package/dist/service/run-event-service.js +49 -42
- package/dist/service/run-workbench-service.js +3 -3
- package/dist/service/runner-interaction-service.js +6 -5
- package/dist/service/runner-service.js +1 -1
- package/dist/service/session-recent-activity.js +2 -1
- package/dist/service/skill-directory-service.js +1 -1
- package/dist/service/skill-install-service.js +2 -2
- package/dist/service/terminal-service.js +1 -1
- package/dist/service/workbench-event-projection.js +3 -2
- package/dist/service/workbench-event-service.js +1 -1
- package/dist/service/workspace-service.js +3 -2
- package/dist/session/attachments.js +110 -0
- package/dist/session/contracts.js +1 -0
- package/dist/{util → session}/conversation-identity.js +1 -1
- package/dist/session/input-validation.js +15 -0
- package/dist/{service → session}/native-session-projection-service.js +40 -11
- package/dist/session/pagination.js +77 -0
- package/dist/{util → session}/runner-native-session-parsers.js +2 -1
- package/dist/session/runtime/approvals.js +90 -0
- package/dist/session/runtime/conversation-projection.js +310 -0
- package/dist/session/runtime/type-guards.js +19 -0
- package/dist/{service → session}/session-catalog-service.js +5 -4
- package/dist/{service → session}/session-command-service.js +3 -3
- package/dist/{service → session}/session-identity-service.js +1 -1
- package/dist/{service → session}/session-lifecycle-service.js +18 -7
- package/dist/{service → session}/session-message-service.js +6 -5
- package/dist/{service → session}/session-presentation-service.js +1 -1
- package/dist/{service → session}/session-query-service.js +2 -2
- package/dist/{service → session}/session-schedule-service.js +2 -2
- package/dist/util/records.js +3 -0
- package/dist/workspace/contracts.js +1 -0
- package/dist/workspace/file-index.js +534 -0
- package/dist/workspace/files.js +466 -0
- package/dist/workspace/git.js +991 -0
- package/dist/workspace/path-access.js +184 -0
- package/dist/workspace/utf8.js +12 -0
- package/dist/{service → workspace}/workspace-change-service.js +45 -21
- package/dist/{service → workspace}/workspace-code-navigation-service.js +6 -6
- package/dist/{service → workspace}/workspace-file-manager-service.js +1 -1
- package/dist/{service → workspace}/workspace-file-service.js +16 -16
- package/dist/{service → workspace}/workspace-git-exclude-service.js +1 -1
- package/dist/{service → workspace}/workspace-queue-workbench-service.js +3 -2
- package/dist/{service → workspace}/workspace-session-service.js +45 -40
- package/dist/{service → workspace}/workspace-upload-service.js +28 -28
- package/dist/{service → workspace}/workspace-watch-service.js +29 -28
- package/dist/{service → workspace}/workspace-workbench-service.js +4 -3
- package/package.json +4 -4
- package/dist/service/hosted-conversation-node-service.js +0 -2252
- package/dist/service/run-domain-state.js +0 -4
- package/dist/service/session-domain-state.js +0 -9
- package/dist/service/workspace-domain-state.js +0 -41
- package/dist/util/node-operation-parsers.js +0 -320
- package/dist/workspace.js +0 -2168
- /package/dist/{connector → application}/node-connector-options.js +0 -0
- /package/dist/{util → connection}/node-operation-data.js +0 -0
- /package/dist/{connector → connection}/node-operation-router.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-sandbox-profile.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-store.js +0 -0
- /package/dist/{util → mcp}/secret-environment.js +0 -0
- /package/dist/{claude-channel.js → runner/claude/claude-channel.js} +0 -0
- /package/dist/{util → runner}/personal-instructions.js +0 -0
- /package/dist/{util → runner}/runner-error.js +0 -0
- /package/dist/{service/conversation-work-process.js → session/runtime/work-process.js} +0 -0
- /package/dist/{service → session}/session-context-service.js +0 -0
- /package/dist/{util → workspace}/git-credential-client.js +0 -0
- /package/dist/{service → workspace}/workspace-content-search-service.js +0 -0
- /package/dist/{service → workspace}/workspace-watch-snapshot-service.js +0 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { safeErrorCode } from '../util/safe-error.js';
|
|
2
|
+
const WATCH_TTL_MS = 45_000;
|
|
3
|
+
/** Owns hosted Watch leases, initialization ordering and pending realtime events. */
|
|
4
|
+
export class HostedConversationWatch {
|
|
5
|
+
options;
|
|
6
|
+
leases = new Map();
|
|
7
|
+
snapshotSequence = 0;
|
|
8
|
+
constructor(options) {
|
|
9
|
+
this.options = options;
|
|
10
|
+
}
|
|
11
|
+
watch(input, sessionHash, userId, templateId, models) {
|
|
12
|
+
const ownerKey = `${sessionHash}:${input.workbenchConnectionId}`;
|
|
13
|
+
const existing = this.leases.get(ownerKey);
|
|
14
|
+
if (input.mode === 'renew') {
|
|
15
|
+
if (!existing ||
|
|
16
|
+
!this.options.slots.owns(ownerKey, existing.slotToken) ||
|
|
17
|
+
existing.watchId !== input.watchId ||
|
|
18
|
+
existing.conversationId !== input.conversationId ||
|
|
19
|
+
existing.userId !== userId)
|
|
20
|
+
throw new Error('SESSION_WATCH_NOT_FOUND');
|
|
21
|
+
if (existing.expiresAt <= Date.now()) {
|
|
22
|
+
this.remove(ownerKey);
|
|
23
|
+
throw new Error('SESSION_WATCH_NOT_FOUND');
|
|
24
|
+
}
|
|
25
|
+
return this.renew(existing);
|
|
26
|
+
}
|
|
27
|
+
const resolvedModels = models();
|
|
28
|
+
if (existing &&
|
|
29
|
+
this.options.slots.owns(ownerKey, existing.slotToken) &&
|
|
30
|
+
existing.watchId === input.watchId &&
|
|
31
|
+
existing.conversationId === input.conversationId &&
|
|
32
|
+
existing.userId === userId &&
|
|
33
|
+
existing.expiresAt > Date.now())
|
|
34
|
+
return this.renew(existing);
|
|
35
|
+
this.remove(ownerKey);
|
|
36
|
+
const slotToken = this.options.slots.replace(ownerKey, 'hosted-conversation', () => this.remove(ownerKey));
|
|
37
|
+
const lease = {
|
|
38
|
+
ownerKey,
|
|
39
|
+
slotToken,
|
|
40
|
+
sessionHash,
|
|
41
|
+
workbenchConnectionId: input.workbenchConnectionId,
|
|
42
|
+
watchId: input.watchId,
|
|
43
|
+
conversationId: input.conversationId,
|
|
44
|
+
templateId,
|
|
45
|
+
userId,
|
|
46
|
+
models: resolvedModels,
|
|
47
|
+
nodeGeneration: this.options.nodeGeneration?.() ?? 'local-test-generation',
|
|
48
|
+
pendingEvents: [],
|
|
49
|
+
expiresAt: Date.now() + WATCH_TTL_MS,
|
|
50
|
+
ready: false,
|
|
51
|
+
timer: undefined
|
|
52
|
+
};
|
|
53
|
+
lease.timer = this.timer(ownerKey);
|
|
54
|
+
this.leases.set(ownerKey, lease);
|
|
55
|
+
void this.initialize(lease);
|
|
56
|
+
return this.accepted(lease);
|
|
57
|
+
}
|
|
58
|
+
unwatch(input, sessionHash, userId) {
|
|
59
|
+
const key = `${sessionHash}:${input.workbenchConnectionId}`;
|
|
60
|
+
const lease = this.leases.get(key);
|
|
61
|
+
if (lease?.watchId === input.watchId &&
|
|
62
|
+
lease.conversationId === input.conversationId &&
|
|
63
|
+
lease.userId === userId)
|
|
64
|
+
this.remove(key);
|
|
65
|
+
return { unwatched: true };
|
|
66
|
+
}
|
|
67
|
+
hasConversation(id) {
|
|
68
|
+
return [...this.leases.values()].some((lease) => lease.conversationId === id);
|
|
69
|
+
}
|
|
70
|
+
removeConversation(id) {
|
|
71
|
+
for (const lease of [...this.leases.values()])
|
|
72
|
+
if (lease.conversationId === id)
|
|
73
|
+
this.remove(lease.ownerKey);
|
|
74
|
+
}
|
|
75
|
+
close() {
|
|
76
|
+
for (const key of [...this.leases.keys()])
|
|
77
|
+
this.remove(key);
|
|
78
|
+
}
|
|
79
|
+
publishEvent(conversationId, payload) {
|
|
80
|
+
const leases = [...this.leases.values()].filter((lease) => lease.conversationId === conversationId);
|
|
81
|
+
if (leases.length === 0)
|
|
82
|
+
return false;
|
|
83
|
+
const event = this.options.nextEvent(payload);
|
|
84
|
+
if (event === undefined)
|
|
85
|
+
return false;
|
|
86
|
+
for (const lease of leases) {
|
|
87
|
+
if (!lease.ready)
|
|
88
|
+
lease.pendingEvents.push(event);
|
|
89
|
+
else
|
|
90
|
+
this.emitEvent(lease, event);
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
publishSnapshot(conversationId, snapshot) {
|
|
95
|
+
for (const lease of this.leases.values())
|
|
96
|
+
if (lease.conversationId === conversationId && lease.ready)
|
|
97
|
+
this.emitSnapshot(lease, snapshot);
|
|
98
|
+
}
|
|
99
|
+
async refreshReadySnapshots(conversationId, completedRunId) {
|
|
100
|
+
const leases = [...this.leases.values()].filter((lease) => lease.conversationId === conversationId && lease.ready);
|
|
101
|
+
await Promise.allSettled(leases.map(async (lease) => {
|
|
102
|
+
const snapshot = await this.options.snapshot(lease.userId, conversationId, lease.models);
|
|
103
|
+
if (this.leases.get(lease.ownerKey) !== lease ||
|
|
104
|
+
!lease.ready ||
|
|
105
|
+
!this.options.mayRefresh(conversationId, completedRunId))
|
|
106
|
+
return;
|
|
107
|
+
this.emitSnapshot(lease, { ...snapshot, run: null });
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
async initialize(lease) {
|
|
111
|
+
try {
|
|
112
|
+
const snapshot = await this.options.initial(lease);
|
|
113
|
+
if (this.leases.get(lease.ownerKey) !== lease)
|
|
114
|
+
return;
|
|
115
|
+
this.emitSnapshot(lease, snapshot);
|
|
116
|
+
lease.ready = true;
|
|
117
|
+
for (const event of lease.pendingEvents)
|
|
118
|
+
this.emitEvent(lease, event);
|
|
119
|
+
lease.pendingEvents.length = 0;
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (this.leases.get(lease.ownerKey) !== lease)
|
|
123
|
+
return;
|
|
124
|
+
this.options.emit?.({
|
|
125
|
+
type: 'watch.failed',
|
|
126
|
+
workbenchConnectionId: lease.workbenchConnectionId,
|
|
127
|
+
watchType: 'hosted-conversation',
|
|
128
|
+
watchId: lease.watchId,
|
|
129
|
+
nodeGeneration: lease.nodeGeneration,
|
|
130
|
+
nodeId: this.options.nodeId(),
|
|
131
|
+
templateId: lease.templateId,
|
|
132
|
+
conversationId: lease.conversationId,
|
|
133
|
+
code: safeErrorCode(error, 'HOSTED_CONVERSATION_WATCH_FAILED'),
|
|
134
|
+
message: 'Hosted conversation watch snapshot failed.'
|
|
135
|
+
});
|
|
136
|
+
this.remove(lease.ownerKey);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
emitSnapshot(lease, payload) {
|
|
140
|
+
this.options.emit?.({
|
|
141
|
+
type: 'watch.hosted-conversation.snapshot',
|
|
142
|
+
workbenchConnectionId: lease.workbenchConnectionId,
|
|
143
|
+
watchId: lease.watchId,
|
|
144
|
+
nodeGeneration: lease.nodeGeneration,
|
|
145
|
+
nodeId: this.options.nodeId(),
|
|
146
|
+
templateId: lease.templateId,
|
|
147
|
+
conversationId: lease.conversationId,
|
|
148
|
+
revision: 1,
|
|
149
|
+
snapshotSequence: ++this.snapshotSequence,
|
|
150
|
+
expiresAt: lease.expiresAt,
|
|
151
|
+
payload
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
emitEvent(lease, event) {
|
|
155
|
+
this.options.emit?.({
|
|
156
|
+
type: 'watch.hosted-conversation.event',
|
|
157
|
+
workbenchConnectionId: lease.workbenchConnectionId,
|
|
158
|
+
watchId: lease.watchId,
|
|
159
|
+
nodeGeneration: lease.nodeGeneration,
|
|
160
|
+
nodeId: this.options.nodeId(),
|
|
161
|
+
templateId: lease.templateId,
|
|
162
|
+
conversationId: lease.conversationId,
|
|
163
|
+
expiresAt: lease.expiresAt,
|
|
164
|
+
event
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
accepted(lease) {
|
|
168
|
+
return {
|
|
169
|
+
accepted: true,
|
|
170
|
+
watchId: lease.watchId,
|
|
171
|
+
nodeGeneration: lease.nodeGeneration,
|
|
172
|
+
expiresAt: lease.expiresAt
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
renew(lease) {
|
|
176
|
+
lease.expiresAt = Date.now() + WATCH_TTL_MS;
|
|
177
|
+
clearTimeout(lease.timer);
|
|
178
|
+
lease.timer = this.timer(lease.ownerKey);
|
|
179
|
+
return this.accepted(lease);
|
|
180
|
+
}
|
|
181
|
+
remove(key) {
|
|
182
|
+
const lease = this.leases.get(key);
|
|
183
|
+
if (!lease)
|
|
184
|
+
return;
|
|
185
|
+
clearTimeout(lease.timer);
|
|
186
|
+
this.leases.delete(key);
|
|
187
|
+
this.options.slots.release(key, lease.slotToken);
|
|
188
|
+
}
|
|
189
|
+
timer(key) {
|
|
190
|
+
const timer = setTimeout(() => this.remove(key), WATCH_TTL_MS);
|
|
191
|
+
timer.unref();
|
|
192
|
+
return timer;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/marctl-guidance.js
CHANGED
|
@@ -22,7 +22,7 @@ export const marctlInstructions = [
|
|
|
22
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
|
|
25
|
+
'Use sessions send <session-id> --steer -m "Additional context: focus on the resume path." --json as the preferred delivery for timely cross-Session coordination: blockers, decision requests, corrections, and results the recipient is waiting for. Do not queue a result merely because it is a report; omit routine progress chatter. Steer prioritizes the update, using native delivery when available, and may otherwise 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 only for deliberately deferred follow-up work that should run after the current execution, without interrupting it; during normal active work it waits for the current execution and earlier queued work, and can be delayed by an active Goal. Do not use it when the recipient needs the information during current work. 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
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.',
|
|
28
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.',
|
|
@@ -65,16 +65,8 @@ export class AbstractRunner {
|
|
|
65
65
|
usesRunnerTitleForRename() {
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
|
-
async renameNative(session, input
|
|
69
|
-
|
|
70
|
-
return;
|
|
71
|
-
database.saveNativeSessionMetadata({
|
|
72
|
-
runner: session.runner,
|
|
73
|
-
externalSessionId: session.externalSessionId,
|
|
74
|
-
workspaceId: session.workspaceId,
|
|
75
|
-
...(input.title === undefined ? {} : { customTitle: input.title }),
|
|
76
|
-
...(input.pinned === undefined ? {} : { pinned: input.pinned })
|
|
77
|
-
});
|
|
68
|
+
async renameNative(session, input) {
|
|
69
|
+
void [session, input];
|
|
78
70
|
}
|
|
79
71
|
async removeNative(session, nativeSessionId) {
|
|
80
72
|
void [session, nativeSessionId];
|
|
@@ -96,9 +88,8 @@ export class AbstractRunner {
|
|
|
96
88
|
void session;
|
|
97
89
|
throw new RunnerCapabilityError(this.name, 'session.clear');
|
|
98
90
|
}
|
|
99
|
-
projectedRunnerTitle(metadata, input
|
|
100
|
-
|
|
101
|
-
return input.title ?? metadata?.runnerTitle ?? null;
|
|
91
|
+
projectedRunnerTitle(metadata, input) {
|
|
92
|
+
return { title: input.title ?? metadata?.runnerTitle ?? null, clearPending: false };
|
|
102
93
|
}
|
|
103
94
|
managedAliasId(nativeSessionId) {
|
|
104
95
|
void nativeSessionId;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { NODE_MCP, NODE_MCP_VERSION } from '
|
|
1
|
+
import { NODE_MCP, NODE_MCP_VERSION } from '../../mcp/naming.js';
|
|
2
2
|
import { spawnSync } from 'node:child_process';
|
|
3
3
|
import { createSdkMcpServer, forkSession, getSessionInfo, getSessionMessages, listSessions, query } from '@anthropic-ai/claude-agent-sdk';
|
|
4
4
|
import { tool } from '@anthropic-ai/claude-agent-sdk';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
import { minimalRunnerEnvironment, platformCliInvocation, runRunnerProbe } from '
|
|
6
|
+
import { minimalRunnerEnvironment, platformCliInvocation, runRunnerProbe } from '../../operational.js';
|
|
7
7
|
const nativeBindings = {
|
|
8
8
|
query,
|
|
9
9
|
listSessions,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { boundedConversationItemId,
|
|
1
|
+
import { boundedConversationItemId, compactRunnerText } from '../normalization.js';
|
|
2
|
+
import { isPlainRecord } from '../../util/records.js';
|
|
2
3
|
import { claudeContentBlocks } from './message-parsers.js';
|
|
3
4
|
export function extractClaudeThinkingText(record) {
|
|
4
5
|
return claudeContentBlocks(record).flatMap((block) => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { claudeAssistantBlocks, extractClaudeThinkingText } from './conversation-parser.js';
|
|
2
2
|
import { ClaudeUsageNormalizer } from './tool-normalizer.js';
|
|
3
3
|
import { createEnvelope } from '@myagentroam/protocol';
|
|
4
|
-
import { ClaudeChannelGate } from '
|
|
4
|
+
import { ClaudeChannelGate } from './claude-channel.js';
|
|
5
5
|
import { nodeExecutionEnvironment } from '../../node-execution-environment.js';
|
|
6
|
-
import { boundedConversationItemId, compactRunnerText } from '
|
|
6
|
+
import { boundedConversationItemId, compactRunnerText } from '../normalization.js';
|
|
7
7
|
import { extractClaudeText, extractClaudeToolUses } from './message-parsers.js';
|
|
8
8
|
import { claudePlanText } from './conversation-parser.js';
|
|
9
9
|
import { normalizeClaudeTool, extractClaudeToolResults } from './tool-normalizer.js';
|
|
10
10
|
import { claudeContentBlocks } from './message-parsers.js';
|
|
11
|
-
import { parseSecretEnvironment } from '../../
|
|
11
|
+
import { parseSecretEnvironment } from '../../mcp/secret-environment.js';
|
|
12
12
|
import { safeErrorCode } from '../../util/safe-error.js';
|
|
13
|
-
import { runnerErrorProjection } from '
|
|
13
|
+
import { runnerErrorProjection } from '../runner-error.js';
|
|
14
14
|
import { ResponseLatencyTracker } from '../../service/response-latency-tracker.js';
|
|
15
15
|
import { GenerationTimingTracker } from '../../service/generation-timing-tracker.js';
|
|
16
16
|
export class ClaudeManagedRunController {
|
|
@@ -81,7 +81,7 @@ export class ClaudeManagedRunController {
|
|
|
81
81
|
typeof payload.input !== 'string' ||
|
|
82
82
|
typeof payload.cwd !== 'string' ||
|
|
83
83
|
this.host.intercepted() ||
|
|
84
|
-
this.host.
|
|
84
|
+
this.host.isExecutionActive(payload.runId))
|
|
85
85
|
return;
|
|
86
86
|
const runId = payload.runId;
|
|
87
87
|
const sessionId = payload.sessionId;
|
|
@@ -123,7 +123,7 @@ export class ClaudeManagedRunController {
|
|
|
123
123
|
this.host.emit(runId, 'run.rejected', { code: 'SESSION_ACTIVATION_REQUIRED' }, 'FAILED');
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
this.host.
|
|
126
|
+
this.host.executionAccepted(runId);
|
|
127
127
|
this.host.emit(runId, 'run.started', {}, 'STARTING');
|
|
128
128
|
if (contextCompactionItemId !== undefined)
|
|
129
129
|
this.host.emitItem(runId, {
|
|
@@ -166,7 +166,6 @@ export class ClaudeManagedRunController {
|
|
|
166
166
|
this.host.emit(runId, eventType, projected ?? eventPayload, status);
|
|
167
167
|
this.runner.execution.runs.delete(runId);
|
|
168
168
|
handle?.cancel();
|
|
169
|
-
this.host.active.delete(runId);
|
|
170
169
|
};
|
|
171
170
|
try {
|
|
172
171
|
const gate = new ClaudeChannelGate(sessionId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { compactRunnerText, compactRunnerValue
|
|
1
|
+
import { compactRunnerText, compactRunnerValue } from '../normalization.js';
|
|
2
|
+
import { isPlainRecord } from '../../util/records.js';
|
|
2
3
|
export function extractClaudeText(message) {
|
|
3
4
|
return claudeContentBlocks(message)
|
|
4
5
|
.flatMap((block) => block.type === 'text' && typeof block.text === 'string' ? [block.text] : [])
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { homedir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { forEachJsonlRecord } from '../../native-jsonl-reader.js';
|
|
4
|
-
import { compactRunnerValue as compactValue
|
|
4
|
+
import { compactRunnerValue as compactValue } from '../normalization.js';
|
|
5
|
+
import { isPlainRecord } from '../../util/records.js';
|
|
5
6
|
import { stripGoalStartPrompt, publicGoalHistoryText } from '../../service/goal-runtime.js';
|
|
6
7
|
import { readdir } from 'node:fs/promises';
|
|
7
8
|
import { stripClaudePlanTag } from '../../runner-command-engine.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { claudeContentBlocks } from './message-parsers.js';
|
|
2
|
-
import { compactRunnerText, compactRunnerValue } from '
|
|
2
|
+
import { compactRunnerText, compactRunnerValue } from '../normalization.js';
|
|
3
3
|
import { RunnerUsageTracker, usageToken, usageTokenSum } from '../../service/runner-usage-tracker.js';
|
|
4
4
|
export class ClaudeUsageNormalizer {
|
|
5
5
|
tracker;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { withMarctlGuide } from '../mcp/marctl-guide.js';
|
|
2
|
-
import { ClaudeAgentSdkAdapter } from '
|
|
2
|
+
import { ClaudeAgentSdkAdapter } from './claude/claude-agent-sdk.js';
|
|
3
3
|
import { AbstractRunner } from './abstract-runner.js';
|
|
4
4
|
import { claudeDefaultModel, declaredRunnerProfiles } from '../runner-profiles.js';
|
|
5
5
|
import { withClaudePlanTag } from '../runner-command-engine.js';
|
|
6
6
|
import { discoverNativeSessions, readNativeSession } from '../native-session-history.js';
|
|
7
7
|
import { readClaudeNativeContextUsage } from './claude/native-context-usage.js';
|
|
8
8
|
import { claudeDiscoveredSession } from './claude/conversation-parser.js';
|
|
9
|
-
import { deduplicateDirectSessions, isNativeHistory, isWithinWorkspace, latestNativeActivity } from '../
|
|
9
|
+
import { deduplicateDirectSessions, isNativeHistory, isWithinWorkspace, latestNativeActivity } from '../session/runner-native-session-parsers.js';
|
|
10
10
|
export class ClaudeCodeRunner extends AbstractRunner {
|
|
11
11
|
client;
|
|
12
12
|
environment;
|