@myagentroam/node 0.9.9 → 0.9.11
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/capabilities.js +2 -92
- package/dist/claude-agent-sdk.js +2 -330
- package/dist/claude-channel.js +2 -44
- package/dist/codex-app-server.js +2 -503
- package/dist/config.js +2 -56
- package/dist/connector/node-connector-options.js +2 -1
- package/dist/connector/node-operation-router.js +2 -22
- package/dist/connector.js +2 -845
- package/dist/control-outbound-scheduler.js +2 -154
- package/dist/database.js +2 -1418
- package/dist/event-buffer.js +2 -19
- package/dist/fake-runner.js +2 -129
- package/dist/health.js +2 -3
- package/dist/main.js +2 -54
- package/dist/migrations/v001.js +3 -144
- package/dist/migrations/v002.js +2 -143
- package/dist/migrations/v003.js +2 -44
- package/dist/migrations/v004.js +34 -30
- package/dist/native-jsonl-reader.js +2 -186
- package/dist/native-session-history.js +2 -1119
- package/dist/opencode-runtime.js +2 -80
- package/dist/opencode-server.js +2 -263
- package/dist/operational.js +2 -122
- package/dist/process-tree.js +2 -18
- package/dist/rotating-log.js +2 -67
- package/dist/runner/abstract-runner.js +2 -232
- package/dist/runner/claude/managed-run-controller.js +2 -345
- package/dist/runner/claude-code-runner.js +2 -303
- package/dist/runner/codex/composer-image-markers.js +2 -0
- package/dist/runner/codex/conversation-parser.js +2 -861
- package/dist/runner/codex/managed-run-controller.js +2 -460
- package/dist/runner/codex-runner.js +2 -628
- package/dist/runner/fake-test-runner.js +2 -47
- package/dist/runner/opencode/conversation-parser.js +2 -221
- package/dist/runner/opencode/managed-run-controller.js +2 -537
- package/dist/runner/opencode-runner.js +2 -448
- package/dist/runner/runner-registry.js +2 -90
- package/dist/runner-command-engine.js +2 -70
- package/dist/runner-profiles.js +2 -215
- package/dist/runner-usage.js +2 -190
- package/dist/runtime-command-detector.js +2 -73
- package/dist/runtime-state.js +2 -982
- package/dist/service/attachment-domain-state.js +2 -7
- package/dist/service/conversation-history-service.js +2 -457
- package/dist/service/conversation-segment-service.js +2 -162
- package/dist/service/external-session-resume-service.js +2 -118
- package/dist/service/fake-managed-run-service.js +2 -60
- package/dist/service/managed-runner-session-service.js +2 -35
- package/dist/service/mcp-installation-verifier.js +2 -87
- package/dist/service/mcp-node-operation-service.js +2 -90
- package/dist/service/mcp-package-installer.js +2 -136
- package/dist/service/native-session-projection-service.js +2 -280
- package/dist/service/native-session-watch-service.js +2 -383
- package/dist/service/node-connection-lifecycle-service.js +2 -84
- package/dist/service/node-control-channel.js +2 -85
- package/dist/service/node-control-message-service.js +2 -107
- package/dist/service/node-request-service.js +2 -52
- package/dist/service/node-run-event-bridge.js +2 -83
- package/dist/service/node-terminal-channel.js +2 -182
- package/dist/service/node-upgrade-coordinator.js +2 -137
- package/dist/service/node-workspace-coordinator.js +2 -70
- package/dist/service/recent-run-projection-service.js +2 -78
- package/dist/service/run-attachment-service.js +2 -194
- package/dist/service/run-domain-state.js +2 -4
- package/dist/service/run-event-service.js +2 -193
- package/dist/service/run-workbench-service.js +2 -104
- package/dist/service/runner-channel-message-service.js +2 -20
- package/dist/service/runner-interaction-service.js +2 -243
- package/dist/service/runner-service.js +2 -71
- package/dist/service/session-catalog-service.js +2 -224
- package/dist/service/session-command-service.js +2 -76
- package/dist/service/session-context-service.js +2 -101
- package/dist/service/session-domain-state.js +2 -9
- package/dist/service/session-identity-service.js +2 -86
- package/dist/service/session-lifecycle-service.js +2 -240
- package/dist/service/session-message-service.js +2 -173
- package/dist/service/session-presentation-service.js +2 -43
- package/dist/service/session-query-service.js +2 -82
- package/dist/service/skill-directory-service.js +2 -238
- package/dist/service/skill-install-service.js +2 -434
- package/dist/service/skill-node-operation-service.js +2 -206
- package/dist/service/terminal-relay-state.js +2 -3
- package/dist/service/terminal-service.js +2 -52
- package/dist/service/workbench-event-service.js +2 -19
- package/dist/service/workbench-manifest-service.js +2 -69
- package/dist/service/workspace-change-service.js +2 -86
- package/dist/service/workspace-content-search-service.js +2 -477
- package/dist/service/workspace-domain-state.js +2 -41
- package/dist/service/workspace-file-service.js +2 -122
- package/dist/service/workspace-git-exclude-service.js +2 -119
- package/dist/service/workspace-queue-workbench-service.js +2 -304
- package/dist/service/workspace-service.js +2 -69
- package/dist/service/workspace-session-service.js +2 -139
- package/dist/service/workspace-upload-service.js +2 -262
- package/dist/service/workspace-watch-service.js +2 -146
- package/dist/service/workspace-workbench-service.js +2 -405
- package/dist/service.js +2 -38
- package/dist/storage.js +2 -32
- package/dist/supervisor.js +2 -136
- package/dist/terminal.js +2 -416
- package/dist/util/node-operation-parsers.js +2 -382
- package/dist/util/personal-instructions.js +2 -31
- package/dist/util/runner-error.js +2 -52
- package/dist/util/runner-native-session-parsers.js +2 -490
- package/dist/util/safe-error.js +2 -5
- package/dist/util/secret-environment.js +2 -25
- package/dist/workspace.js +2 -1519
- package/package.json +3 -3
- package/dist/capabilities.d.ts +0 -12
- package/dist/claude-agent-sdk.d.ts +0 -92
- package/dist/claude-channel.d.ts +0 -28
- package/dist/codex-app-server.d.ts +0 -133
- package/dist/config.d.ts +0 -18
- package/dist/connector/node-connector-options.d.ts +0 -27
- package/dist/connector/node-operation-router.d.ts +0 -9
- package/dist/connector.d.ts +0 -94
- package/dist/control-outbound-scheduler.d.ts +0 -29
- package/dist/database.d.ts +0 -305
- package/dist/event-buffer.d.ts +0 -9
- package/dist/fake-runner.d.ts +0 -42
- package/dist/health.d.ts +0 -4
- package/dist/main.d.ts +0 -2
- package/dist/migrations/v001.d.ts +0 -3
- package/dist/migrations/v002.d.ts +0 -4
- package/dist/migrations/v003.d.ts +0 -4
- package/dist/migrations/v004.d.ts +0 -4
- package/dist/native-jsonl-reader.d.ts +0 -35
- package/dist/native-session-history.d.ts +0 -126
- package/dist/opencode-runtime.d.ts +0 -33
- package/dist/opencode-server.d.ts +0 -49
- package/dist/operational.d.ts +0 -39
- package/dist/process-tree.d.ts +0 -9
- package/dist/rotating-log.d.ts +0 -17
- package/dist/runner/abstract-runner.d.ts +0 -172
- package/dist/runner/claude/managed-run-controller.d.ts +0 -51
- package/dist/runner/claude-code-runner.d.ts +0 -72
- package/dist/runner/codex/conversation-parser.d.ts +0 -59
- package/dist/runner/codex/managed-run-controller.d.ts +0 -90
- package/dist/runner/codex-runner.d.ts +0 -103
- package/dist/runner/fake-test-runner.d.ts +0 -26
- package/dist/runner/opencode/conversation-parser.d.ts +0 -31
- package/dist/runner/opencode/managed-run-controller.d.ts +0 -82
- package/dist/runner/opencode-runner.d.ts +0 -71
- package/dist/runner/runner-registry.d.ts +0 -19
- package/dist/runner-command-engine.d.ts +0 -28
- package/dist/runner-profiles.d.ts +0 -15
- package/dist/runner-usage.d.ts +0 -33
- package/dist/runtime-command-detector.d.ts +0 -3
- package/dist/runtime-state.d.ts +0 -171
- package/dist/service/attachment-domain-state.d.ts +0 -7
- package/dist/service/conversation-history-service.d.ts +0 -43
- package/dist/service/conversation-segment-service.d.ts +0 -20
- package/dist/service/external-session-resume-service.d.ts +0 -34
- package/dist/service/fake-managed-run-service.d.ts +0 -28
- package/dist/service/managed-runner-session-service.d.ts +0 -12
- package/dist/service/mcp-installation-verifier.d.ts +0 -9
- package/dist/service/mcp-node-operation-service.d.ts +0 -11
- package/dist/service/mcp-package-installer.d.ts +0 -8
- package/dist/service/native-session-projection-service.d.ts +0 -52
- package/dist/service/native-session-watch-service.d.ts +0 -62
- package/dist/service/node-connection-lifecycle-service.d.ts +0 -36
- package/dist/service/node-control-channel.d.ts +0 -32
- package/dist/service/node-control-message-service.d.ts +0 -27
- package/dist/service/node-request-service.d.ts +0 -14
- package/dist/service/node-run-event-bridge.d.ts +0 -40
- package/dist/service/node-terminal-channel.d.ts +0 -29
- package/dist/service/node-upgrade-coordinator.d.ts +0 -29
- package/dist/service/node-workspace-coordinator.d.ts +0 -29
- package/dist/service/recent-run-projection-service.d.ts +0 -14
- package/dist/service/run-attachment-service.d.ts +0 -38
- package/dist/service/run-domain-state.d.ts +0 -4
- package/dist/service/run-event-service.d.ts +0 -33
- package/dist/service/run-workbench-service.d.ts +0 -25
- package/dist/service/runner-channel-message-service.d.ts +0 -13
- package/dist/service/runner-interaction-service.d.ts +0 -39
- package/dist/service/runner-service.d.ts +0 -46
- package/dist/service/session-catalog-service.d.ts +0 -45
- package/dist/service/session-command-service.d.ts +0 -24
- package/dist/service/session-context-service.d.ts +0 -35
- package/dist/service/session-domain-state.d.ts +0 -9
- package/dist/service/session-identity-service.d.ts +0 -24
- package/dist/service/session-lifecycle-service.d.ts +0 -31
- package/dist/service/session-message-service.d.ts +0 -33
- package/dist/service/session-presentation-service.d.ts +0 -34
- package/dist/service/session-query-service.d.ts +0 -35
- package/dist/service/skill-directory-service.d.ts +0 -20
- package/dist/service/skill-install-service.d.ts +0 -21
- package/dist/service/skill-node-operation-service.d.ts +0 -44
- package/dist/service/terminal-relay-state.d.ts +0 -6
- package/dist/service/terminal-service.d.ts +0 -12
- package/dist/service/workbench-event-service.d.ts +0 -9
- package/dist/service/workbench-manifest-service.d.ts +0 -90
- package/dist/service/workspace-change-service.d.ts +0 -9
- package/dist/service/workspace-content-search-service.d.ts +0 -14
- package/dist/service/workspace-domain-state.d.ts +0 -79
- package/dist/service/workspace-file-service.d.ts +0 -18
- package/dist/service/workspace-git-exclude-service.d.ts +0 -4
- package/dist/service/workspace-queue-workbench-service.d.ts +0 -86
- package/dist/service/workspace-service.d.ts +0 -15
- package/dist/service/workspace-session-service.d.ts +0 -23
- package/dist/service/workspace-upload-service.d.ts +0 -39
- package/dist/service/workspace-watch-service.d.ts +0 -23
- package/dist/service/workspace-workbench-service.d.ts +0 -58
- package/dist/service.d.ts +0 -4
- package/dist/storage.d.ts +0 -2
- package/dist/supervisor.d.ts +0 -1
- package/dist/terminal.d.ts +0 -133
- package/dist/util/node-operation-parsers.d.ts +0 -92
- package/dist/util/personal-instructions.d.ts +0 -2
- package/dist/util/runner-error.d.ts +0 -6
- package/dist/util/runner-native-session-parsers.d.ts +0 -74
- package/dist/util/safe-error.d.ts +0 -2
- package/dist/util/secret-environment.d.ts +0 -1
- package/dist/workspace.d.ts +0 -217
package/dist/connector.js
CHANGED
|
@@ -1,845 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { createEnvelope } from '@myagentroam/protocol';
|
|
3
|
-
import { loadNodeConfig, nodeDatabasePath } from './config.js';
|
|
4
|
-
import { NodeMetrics, nodeLog } from './operational.js';
|
|
5
|
-
import { assertLocalSqlitePath } from './storage.js';
|
|
6
|
-
import { detectCapabilitiesAsync, unavailableCapabilities } from './capabilities.js';
|
|
7
|
-
import { NodeDatabase } from './database.js';
|
|
8
|
-
import { TerminalManager } from './terminal.js';
|
|
9
|
-
import { NodeRuntimeState } from './runtime-state.js';
|
|
10
|
-
import { CommandStateStore } from './runner-command-engine.js';
|
|
11
|
-
import { RunnerUsageReader } from './runner-usage.js';
|
|
12
|
-
import { ClaudeCodeRunner } from './runner/claude-code-runner.js';
|
|
13
|
-
import { ClaudeManagedRunController } from './runner/claude/managed-run-controller.js';
|
|
14
|
-
import { CodexRunner } from './runner/codex-runner.js';
|
|
15
|
-
import { CodexManagedRunController } from './runner/codex/managed-run-controller.js';
|
|
16
|
-
import { FakeTestRunner } from './runner/fake-test-runner.js';
|
|
17
|
-
import { RunnerRegistry } from './runner/runner-registry.js';
|
|
18
|
-
import { OpenCodeRunner } from './runner/opencode-runner.js';
|
|
19
|
-
import { OpenCodeManagedRunController } from './runner/opencode/managed-run-controller.js';
|
|
20
|
-
import { NodeOperationRouter } from './connector/node-operation-router.js';
|
|
21
|
-
import { SkillNodeOperationService } from './service/skill-node-operation-service.js';
|
|
22
|
-
import { McpNodeOperationService } from './service/mcp-node-operation-service.js';
|
|
23
|
-
import { RunnerService } from './service/runner-service.js';
|
|
24
|
-
import { TerminalService } from './service/terminal-service.js';
|
|
25
|
-
import { WorkspaceService } from './service/workspace-service.js';
|
|
26
|
-
import { WorkspaceWatchService } from './service/workspace-watch-service.js';
|
|
27
|
-
import { WorkspaceFileService } from './service/workspace-file-service.js';
|
|
28
|
-
import { WorkspaceUploadService } from './service/workspace-upload-service.js';
|
|
29
|
-
import { WorkspaceChangeService } from './service/workspace-change-service.js';
|
|
30
|
-
import { WorkspaceSessionService } from './service/workspace-session-service.js';
|
|
31
|
-
import { WorkbenchEventService } from './service/workbench-event-service.js';
|
|
32
|
-
import { RunDomainState } from './service/run-domain-state.js';
|
|
33
|
-
import { RecentRunProjectionService } from './service/recent-run-projection-service.js';
|
|
34
|
-
import { SessionDomainState } from './service/session-domain-state.js';
|
|
35
|
-
import { RunEventService } from './service/run-event-service.js';
|
|
36
|
-
import { RunAttachmentService } from './service/run-attachment-service.js';
|
|
37
|
-
import { NodeTerminalChannel } from './service/node-terminal-channel.js';
|
|
38
|
-
import { WorkspaceWorkbenchService } from './service/workspace-workbench-service.js';
|
|
39
|
-
import { NativeSessionWatchService } from './service/native-session-watch-service.js';
|
|
40
|
-
import { SessionContextService } from './service/session-context-service.js';
|
|
41
|
-
import { WorkspaceDomainState } from './service/workspace-domain-state.js';
|
|
42
|
-
import { RunWorkbenchService } from './service/run-workbench-service.js';
|
|
43
|
-
import { SessionQueryService } from './service/session-query-service.js';
|
|
44
|
-
import { WorkspaceQueueWorkbenchService } from './service/workspace-queue-workbench-service.js';
|
|
45
|
-
import { SessionIdentityService } from './service/session-identity-service.js';
|
|
46
|
-
import { NativeSessionProjectionService } from './service/native-session-projection-service.js';
|
|
47
|
-
import { ConversationHistoryService, convergeConversationWatchPage, hasManagedActiveRun } from './service/conversation-history-service.js';
|
|
48
|
-
import { ConversationSegmentService, conversationSegmentIdentityForItem, conversationSegments } from './service/conversation-segment-service.js';
|
|
49
|
-
import { RunnerInteractionService } from './service/runner-interaction-service.js';
|
|
50
|
-
import { SessionLifecycleService } from './service/session-lifecycle-service.js';
|
|
51
|
-
import { ExternalSessionResumeService } from './service/external-session-resume-service.js';
|
|
52
|
-
import { SessionMessageService } from './service/session-message-service.js';
|
|
53
|
-
import { SessionCatalogService } from './service/session-catalog-service.js';
|
|
54
|
-
import { SessionCommandService } from './service/session-command-service.js';
|
|
55
|
-
import { SessionPresentationService } from './service/session-presentation-service.js';
|
|
56
|
-
import { isPlainRecord, isRunnerImageAttachment, parseRunnerImageAttachments } from './runner/codex/conversation-parser.js';
|
|
57
|
-
export { nodeConnectEndpoint, validatedCapabilities } from './runner/codex/conversation-parser.js';
|
|
58
|
-
import { NodeControlChannel } from './service/node-control-channel.js';
|
|
59
|
-
import { NodeControlMessageService } from './service/node-control-message-service.js';
|
|
60
|
-
import { NodeRequestService } from './service/node-request-service.js';
|
|
61
|
-
import { WorkbenchManifestService } from './service/workbench-manifest-service.js';
|
|
62
|
-
import { NodeRunEventBridge, workbenchPayloadSessionId } from './service/node-run-event-bridge.js';
|
|
63
|
-
import { NodeWorkspaceCoordinator } from './service/node-workspace-coordinator.js';
|
|
64
|
-
import { FakeManagedRunService } from './service/fake-managed-run-service.js';
|
|
65
|
-
import { RunnerChannelMessageService } from './service/runner-channel-message-service.js';
|
|
66
|
-
import { ManagedRunnerSessionService } from './service/managed-runner-session-service.js';
|
|
67
|
-
import { NodeConnectionLifecycleService } from './service/node-connection-lifecycle-service.js';
|
|
68
|
-
import { NodeUpgradeCoordinator, nodeUpgradeRequestPath } from './service/node-upgrade-coordinator.js';
|
|
69
|
-
const HEARTBEAT_MS = 15_000;
|
|
70
|
-
const CAPABILITY_REFRESH_MS = 60_000;
|
|
71
|
-
const RETRY_MIN_MS = 500;
|
|
72
|
-
const RETRY_MAX_MS = 30_000;
|
|
73
|
-
const CLAUDE_APPROVAL_TIMEOUT_MS = 10 * 60_000;
|
|
74
|
-
export function nextReconnectDelay(attempt) {
|
|
75
|
-
return Math.min(RETRY_MAX_MS, RETRY_MIN_MS * 2 ** Math.min(Math.max(attempt, 0), 16));
|
|
76
|
-
}
|
|
77
|
-
function upgradeMetadata(metadata, status) {
|
|
78
|
-
const next = { ...(metadata ?? {}) };
|
|
79
|
-
if (process.env['MAR_NODE_SUPERVISED'] === '1')
|
|
80
|
-
next.supervisedUpgrade = true;
|
|
81
|
-
else
|
|
82
|
-
delete next.supervisedUpgrade;
|
|
83
|
-
if (status.state === 'IDLE')
|
|
84
|
-
delete next.upgrade;
|
|
85
|
-
else
|
|
86
|
-
next.upgrade = status;
|
|
87
|
-
return next;
|
|
88
|
-
}
|
|
89
|
-
export class NodeConnector {
|
|
90
|
-
nodeGeneration = crypto.randomUUID().replace(/-/g, '');
|
|
91
|
-
controlChannel;
|
|
92
|
-
controlMessages;
|
|
93
|
-
nodeRequests;
|
|
94
|
-
connectionLifecycle;
|
|
95
|
-
/** @internal Existing contract tests inject their socket through this boundary. */
|
|
96
|
-
set socket(value) {
|
|
97
|
-
this.controlChannel.replaceSocketForTesting(value);
|
|
98
|
-
}
|
|
99
|
-
stopped = false;
|
|
100
|
-
config;
|
|
101
|
-
capabilitiesProvided;
|
|
102
|
-
capabilities;
|
|
103
|
-
capabilityDetector;
|
|
104
|
-
configPath;
|
|
105
|
-
reconnect;
|
|
106
|
-
claudeApprovalTimeoutMs;
|
|
107
|
-
workbenchEventService = new WorkbenchEventService((envelope) => this.sendEnvelope(envelope), (category, payload) => {
|
|
108
|
-
const sessionId = workbenchPayloadSessionId(this.runtime, category, payload);
|
|
109
|
-
return sessionId === undefined || !this.sessionIdentityService.bootstrapIds.has(sessionId);
|
|
110
|
-
});
|
|
111
|
-
fakeRunner;
|
|
112
|
-
fakeScript;
|
|
113
|
-
runState = new RunDomainState();
|
|
114
|
-
runEventBridge;
|
|
115
|
-
workspaceCoordinator;
|
|
116
|
-
sessionState = new SessionDomainState();
|
|
117
|
-
sessionIdentityService;
|
|
118
|
-
nativeSessionProjectionService;
|
|
119
|
-
conversationHistoryService;
|
|
120
|
-
conversationSegmentService;
|
|
121
|
-
runnerInteractionService;
|
|
122
|
-
runnerChannelMessages;
|
|
123
|
-
managedRunnerSessions;
|
|
124
|
-
sessionPresentationService;
|
|
125
|
-
sessionLifecycleService;
|
|
126
|
-
externalSessionResumeService;
|
|
127
|
-
sessionMessageService;
|
|
128
|
-
sessionCatalogService;
|
|
129
|
-
sessionCommandService;
|
|
130
|
-
runAttachmentService;
|
|
131
|
-
terminalChannel;
|
|
132
|
-
codexClient;
|
|
133
|
-
codexRunController;
|
|
134
|
-
claudeClient;
|
|
135
|
-
openCodeClient;
|
|
136
|
-
openCodeRunController;
|
|
137
|
-
claudeRunController;
|
|
138
|
-
runners;
|
|
139
|
-
sessionContextService;
|
|
140
|
-
runWorkbenchService;
|
|
141
|
-
sessionQueryService;
|
|
142
|
-
workspaceQueueWorkbenchService;
|
|
143
|
-
operationRouter = new NodeOperationRouter();
|
|
144
|
-
runnerService;
|
|
145
|
-
workbenchManifestService;
|
|
146
|
-
terminalService;
|
|
147
|
-
workspaceService;
|
|
148
|
-
commandStates = new CommandStateStore();
|
|
149
|
-
runnerUsageReader;
|
|
150
|
-
terminalManager;
|
|
151
|
-
upgradeCoordinator;
|
|
152
|
-
workspaceState = new WorkspaceDomainState();
|
|
153
|
-
workspaceWatchService = new WorkspaceWatchService(this.workspaceState, (workspaceId) => this.workspaceSessionService.ensureWatch(workspaceId), (workspaceId) => this.workspaceSessionService.stopWatch(workspaceId));
|
|
154
|
-
workspaceSessionService = new WorkspaceSessionService(this.workspaceState, {
|
|
155
|
-
discover: (workspaceId) => this.discoverWorkspaceSessions(workspaceId),
|
|
156
|
-
listPage: (workspaceId) => this.executeNodeOperation('session.list', { workspaceId, limit: 20 }),
|
|
157
|
-
active: (workspaceId) => this.workspaceWatchService.topicActive(workspaceId, 'sessions'),
|
|
158
|
-
emitRevision: (workspaceId) => void this.workspaceWorkbenchService?.refreshTopic(workspaceId, 'sessions'),
|
|
159
|
-
onPending: (workspaceId, waitMs) => nodeLog('native.session.discovery.pending', {
|
|
160
|
-
nodeId: this.config?.nodeId,
|
|
161
|
-
workspaceId,
|
|
162
|
-
waitMs
|
|
163
|
-
})
|
|
164
|
-
});
|
|
165
|
-
workspaceFileService = new WorkspaceFileService(this.workspaceState, () => this.config?.allowedRoots ?? [], (workspaceId) => this.workspaceCoordinator.invalidate(workspaceId));
|
|
166
|
-
workspaceUploadService = new WorkspaceUploadService(this.workspaceState, (workspaceId) => this.workspaceCoordinator.invalidate(workspaceId));
|
|
167
|
-
workspaceChangeService = new WorkspaceChangeService(this.workspaceState);
|
|
168
|
-
workspaceWorkbenchService;
|
|
169
|
-
database;
|
|
170
|
-
recentRunProjectionService = new RecentRunProjectionService((message) => this.send('recent-runs', message));
|
|
171
|
-
/** Runtime/session state is intentionally not persisted to Node SQLite. */
|
|
172
|
-
runtime = new NodeRuntimeState(() => this.config?.nodeId ?? 'runtime-node', (workspaceId) => this.database?.getWorkspace(workspaceId), Date.now, (run, session) => this.recentRunProjectionService.record(run, session));
|
|
173
|
-
metrics = new NodeMetrics();
|
|
174
|
-
runEventService = new RunEventService({
|
|
175
|
-
runtime: this.runtime,
|
|
176
|
-
metrics: this.metrics,
|
|
177
|
-
state: this.runState,
|
|
178
|
-
isBootstrapSession: (sessionId) => this.sessionIdentityService.bootstrapIds.has(sessionId),
|
|
179
|
-
presentSession: (session) => this.sessionPresentationService.present(session),
|
|
180
|
-
rejectBootstrap: (sessionId, code) => this.sessionIdentityService.reject(sessionId, code),
|
|
181
|
-
emitWorkbench: (category, payload) => {
|
|
182
|
-
if (category === 'conversation' && isPlainRecord(payload) && 'turn' in payload)
|
|
183
|
-
this.emitConversationTurn(payload.turn);
|
|
184
|
-
else
|
|
185
|
-
this.emitWorkbenchEvent(category, payload);
|
|
186
|
-
},
|
|
187
|
-
cleanupAttachments: (runId) => this.runAttachmentService.cleanup(runId),
|
|
188
|
-
expireImages: (runId) => this.runAttachmentService.expire(runId),
|
|
189
|
-
scheduleContextRefresh: (sessionId) => this.sessionContextService.schedule(sessionId),
|
|
190
|
-
dispatchQueue: async (sessionId) => {
|
|
191
|
-
if (!this.upgradeCoordinator.pending())
|
|
192
|
-
await this.workspaceQueueWorkbenchService.dispatch(sessionId);
|
|
193
|
-
},
|
|
194
|
-
removeQueuedStart: (runId) => this.workspaceQueueWorkbenchService.remove(runId)
|
|
195
|
-
});
|
|
196
|
-
nativeSessionWatchService = new NativeSessionWatchService({
|
|
197
|
-
resolve: async (sessionId) => this.runtime.getAgentSession(sessionId) ??
|
|
198
|
-
this.nativeSessionProjectionService.resolveCurrent(sessionId),
|
|
199
|
-
managedActive: (session) => hasManagedActiveRun(this.runtime, session),
|
|
200
|
-
suspended: (sessionId) => this.externalSessionResumeService.transitioning(sessionId),
|
|
201
|
-
refreshActivity: (session) => this.conversationHistoryService.refreshExternalActivity(session),
|
|
202
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
203
|
-
readPage: (session, limit) => this.conversationHistoryService.read(session, { limit }),
|
|
204
|
-
convergePage: convergeConversationWatchPage,
|
|
205
|
-
projectInitialPage: (session, page, _unit, limit) => this.conversationSegmentService.projectInitial(session, page, limit),
|
|
206
|
-
emitSession: (session) => this.emitWorkbenchEvent('session', { session }),
|
|
207
|
-
emitPage: (session, page) => this.emitWorkbenchEvent('conversation', {
|
|
208
|
-
sessionId: session.id,
|
|
209
|
-
snapshot: this.conversationSegmentService.projectInitial(session, page, 10)
|
|
210
|
-
}),
|
|
211
|
-
nodeId: () => this.config?.nodeId ?? 'runtime-node',
|
|
212
|
-
nodeGeneration: () => this.nodeGeneration,
|
|
213
|
-
emitWatchEvent: (payload) => this.send('watch.event', payload)
|
|
214
|
-
});
|
|
215
|
-
constructor(options = {}) {
|
|
216
|
-
this.config = options.config;
|
|
217
|
-
this.configPath = options.configPath;
|
|
218
|
-
this.claudeApprovalTimeoutMs = options.claudeApprovalTimeoutMs ?? CLAUDE_APPROVAL_TIMEOUT_MS;
|
|
219
|
-
this.capabilitiesProvided = options.capabilities !== undefined;
|
|
220
|
-
this.capabilities = options.capabilities ?? unavailableCapabilities();
|
|
221
|
-
this.upgradeCoordinator = new NodeUpgradeCoordinator(() => {
|
|
222
|
-
if (this.config === undefined)
|
|
223
|
-
throw new Error('NODE_CONFIG_UNAVAILABLE');
|
|
224
|
-
return nodeUpgradeRequestPath(nodeDatabasePath(this.config, this.configPath));
|
|
225
|
-
}, () => this.runState.active.size, (status) => {
|
|
226
|
-
this.capabilities = {
|
|
227
|
-
...this.capabilities,
|
|
228
|
-
metadata: upgradeMetadata(this.capabilities.metadata, status)
|
|
229
|
-
};
|
|
230
|
-
this.controlChannel?.send('capabilities', this.capabilities);
|
|
231
|
-
}, options.upgradeReady ??
|
|
232
|
-
(() => {
|
|
233
|
-
this.stop();
|
|
234
|
-
setImmediate(() => process.exit(75));
|
|
235
|
-
}));
|
|
236
|
-
this.capabilities = {
|
|
237
|
-
...this.capabilities,
|
|
238
|
-
metadata: upgradeMetadata(this.capabilities.metadata, this.upgradeCoordinator.snapshot())
|
|
239
|
-
};
|
|
240
|
-
const detect = options.capabilityDetector ?? detectCapabilitiesAsync;
|
|
241
|
-
this.capabilityDetector = async () => {
|
|
242
|
-
const capabilities = await detect();
|
|
243
|
-
return {
|
|
244
|
-
...capabilities,
|
|
245
|
-
metadata: upgradeMetadata(capabilities.metadata, this.upgradeCoordinator.snapshot())
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
this.reconnect = options.reconnect ?? true;
|
|
249
|
-
this.fakeRunner =
|
|
250
|
-
options.fakeRunner === undefined ? undefined : new FakeTestRunner(options.fakeRunner);
|
|
251
|
-
this.fakeScript = options.fakeScript;
|
|
252
|
-
this.runAttachmentService = new RunAttachmentService((session) => this.runners.require(session.runner).nativeImageRoots(session));
|
|
253
|
-
this.codexClient = new CodexRunner(options.codexClient, options.codexProfileClientFactory);
|
|
254
|
-
this.codexRunController = new CodexManagedRunController(this.codexClient, {
|
|
255
|
-
available: () => this.capabilities.codex.available,
|
|
256
|
-
intercepted: () => this.fakeRunner !== undefined,
|
|
257
|
-
active: this.runState.active,
|
|
258
|
-
addActive: (runId) => this.runState.active.add(runId),
|
|
259
|
-
removeActive: (runId) => this.runState.active.delete(runId),
|
|
260
|
-
adopt: (input) => this.runtime.adoptRun(input),
|
|
261
|
-
session: (sessionId) => this.runtime.getAgentSession(sessionId),
|
|
262
|
-
runStatus: (runId) => this.runtime.getRun(runId)?.status,
|
|
263
|
-
run: (runId) => this.runtime.getRun(runId),
|
|
264
|
-
interrupted: (runId) => this.runState.interruptRequested.has(runId),
|
|
265
|
-
parseAttachments: parseRunnerImageAttachments,
|
|
266
|
-
materialize: (runId, attachments) => this.runAttachmentService.materializeCodex(runId, attachments),
|
|
267
|
-
completeCancelled: (runId) => this.runnerInteractionService.completeCancelledRun(runId),
|
|
268
|
-
promoteSession: (sessionId, nativeSessionId) => this.sessionIdentityService.promote(sessionId, nativeSessionId),
|
|
269
|
-
send: (type, payload) => this.send(type, payload),
|
|
270
|
-
emit: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
271
|
-
cancel: (runId, threadId, turnId, cwd, status) => this.runnerInteractionService.cancelCodexTurn(runId, threadId, turnId, cwd, status),
|
|
272
|
-
createApproval: (input) => this.runtime.createApproval(input),
|
|
273
|
-
publishApproval: (input) => this.runEventBridge.publishApproval(input),
|
|
274
|
-
emitItem: (runId, item) => this.emitConversationItem(runId, item),
|
|
275
|
-
appendImages: (runId, images) => this.runAttachmentService.append(runId, images.filter(isRunnerImageAttachment)),
|
|
276
|
-
syncTitle: (sessionId, nativeSessionId, cwd) => this.managedRunnerSessions.refreshTitle(sessionId, nativeSessionId, cwd),
|
|
277
|
-
commandState: (sessionId, commandId) => this.commandStates.get(sessionId, commandId),
|
|
278
|
-
setCommandState: (sessionId, state) => this.commandStates.set(sessionId, state),
|
|
279
|
-
clearCommandState: (sessionId, commandId) => this.commandStates.clear(sessionId, commandId),
|
|
280
|
-
commandStates: (sessionId) => this.commandStates.list(sessionId),
|
|
281
|
-
hasActiveSessionLease: (sessionId) => this.runtime.hasActiveSessionLease(sessionId),
|
|
282
|
-
fast: (input) => this.executeNodeOperation('runner.command.execute', {
|
|
283
|
-
runner: 'codex',
|
|
284
|
-
commandId: 'fast',
|
|
285
|
-
input
|
|
286
|
-
})
|
|
287
|
-
});
|
|
288
|
-
this.codexClient.onNotification((notification) => this.codexRunController.handleNotification(notification));
|
|
289
|
-
this.claudeClient = new ClaudeCodeRunner(options.claudeClient);
|
|
290
|
-
this.openCodeClient = new OpenCodeRunner(options.openCodeClient);
|
|
291
|
-
this.openCodeRunController = new OpenCodeManagedRunController(this.openCodeClient, {
|
|
292
|
-
intercepted: () => this.fakeRunner !== undefined,
|
|
293
|
-
active: this.runState.active,
|
|
294
|
-
parseAttachments: parseRunnerImageAttachments,
|
|
295
|
-
persistAttachments: (cwd, runId, attachments) => this.runAttachmentService.persistFiles(cwd, `${runId}-opencode-images`, attachments),
|
|
296
|
-
emit: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
297
|
-
emitItem: (runId, item) => this.emitConversationItem(runId, item),
|
|
298
|
-
adopt: (input) => this.runtime.adoptRun(input),
|
|
299
|
-
run: (runId) => {
|
|
300
|
-
const run = this.runtime.getRun(runId);
|
|
301
|
-
if (run === undefined)
|
|
302
|
-
throw new Error('RUN_NOT_FOUND');
|
|
303
|
-
return run;
|
|
304
|
-
},
|
|
305
|
-
hasActiveSessionLease: (sessionId) => this.runtime.hasActiveSessionLease(sessionId),
|
|
306
|
-
promote: (sessionId, nativeSessionId) => this.sessionIdentityService.promote(sessionId, nativeSessionId),
|
|
307
|
-
rememberNative: (nativeSessionId, sessionId) => this.managedRunnerSessions.remember(nativeSessionId, sessionId),
|
|
308
|
-
send: (type, payload) => this.send(type, payload),
|
|
309
|
-
createApproval: (input) => this.runtime.createApproval(input),
|
|
310
|
-
expireApproval: (approvalId) => {
|
|
311
|
-
this.runtime.expireApproval(approvalId);
|
|
312
|
-
},
|
|
313
|
-
publishApproval: (input) => this.runEventBridge.publishApproval(input),
|
|
314
|
-
commandState: (sessionId, commandId) => this.commandStates.get(sessionId, commandId),
|
|
315
|
-
setCommandState: (sessionId, state) => this.commandStates.set(sessionId, state),
|
|
316
|
-
clearCommandState: (sessionId, commandId) => this.commandStates.clear(sessionId, commandId),
|
|
317
|
-
commandStates: (sessionId) => this.commandStates.list(sessionId)
|
|
318
|
-
}, this.claudeApprovalTimeoutMs);
|
|
319
|
-
this.claudeRunController = new ClaudeManagedRunController(this.claudeClient, {
|
|
320
|
-
intercepted: () => this.fakeRunner !== undefined,
|
|
321
|
-
active: this.runState.active,
|
|
322
|
-
parseAttachments: parseRunnerImageAttachments,
|
|
323
|
-
emit: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
324
|
-
adopt: (input) => this.runtime.adoptRun(input),
|
|
325
|
-
run: (runId) => this.runtime.getRun(runId),
|
|
326
|
-
hasActiveSessionLease: (sessionId) => this.runtime.hasActiveSessionLease(sessionId),
|
|
327
|
-
session: (sessionId) => this.runtime.getAgentSession(sessionId),
|
|
328
|
-
completeCancelled: (runId) => this.runnerInteractionService.completeCancelledRun(runId),
|
|
329
|
-
requestUserInput: (runId, input, toolUseId) => this.runnerInteractionService.requestClaudeUserInput(runId, input, toolUseId),
|
|
330
|
-
requestApproval: (runId, toolName, input) => this.runnerInteractionService.requestClaudeApproval(runId, toolName, input),
|
|
331
|
-
rememberNative: (nativeSessionId, sessionId) => this.managedRunnerSessions.remember(nativeSessionId, sessionId),
|
|
332
|
-
promote: (sessionId, nativeSessionId) => this.sessionIdentityService.promote(sessionId, nativeSessionId),
|
|
333
|
-
send: (type, payload) => this.send(type, payload),
|
|
334
|
-
emitItem: (runId, item) => this.emitConversationItem(runId, item),
|
|
335
|
-
syncTitle: (sessionId, nativeSessionId, cwd) => this.managedRunnerSessions.refreshTitle(sessionId, nativeSessionId, cwd),
|
|
336
|
-
setChannelToken: (sessionId, token) => this.runtime.setChannelToken(sessionId, token),
|
|
337
|
-
commandState: (sessionId, commandId) => this.commandStates.get(sessionId, commandId),
|
|
338
|
-
setCommandState: (sessionId, state) => this.commandStates.set(sessionId, state),
|
|
339
|
-
clearCommandState: (sessionId, commandId) => this.commandStates.clear(sessionId, commandId),
|
|
340
|
-
commandStates: (sessionId) => this.commandStates.list(sessionId)
|
|
341
|
-
});
|
|
342
|
-
this.runners = new RunnerRegistry([
|
|
343
|
-
this.openCodeClient,
|
|
344
|
-
this.codexClient,
|
|
345
|
-
this.claudeClient,
|
|
346
|
-
...(this.fakeRunner === undefined ? [] : [this.fakeRunner])
|
|
347
|
-
]);
|
|
348
|
-
this.managedRunnerSessions = new ManagedRunnerSessionService(this.runtime, this.runners, (session) => this.emitWorkbenchEvent('session', {
|
|
349
|
-
session: this.sessionPresentationService.present(session)
|
|
350
|
-
}));
|
|
351
|
-
this.runnerInteractionService = new RunnerInteractionService({
|
|
352
|
-
runtime: this.runtime,
|
|
353
|
-
state: this.runState,
|
|
354
|
-
codex: () => this.codexClient,
|
|
355
|
-
claude: () => this.claudeClient,
|
|
356
|
-
runners: this.runners,
|
|
357
|
-
emitRun: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
358
|
-
emitItem: (runId, item) => this.emitConversationItem(runId, item),
|
|
359
|
-
approvalTimeoutMs: this.claudeApprovalTimeoutMs,
|
|
360
|
-
publishApproval: (input) => this.runEventBridge.publishApproval(input)
|
|
361
|
-
});
|
|
362
|
-
this.runnerChannelMessages = new RunnerChannelMessageService({
|
|
363
|
-
interactions: this.runnerInteractionService,
|
|
364
|
-
send: (type, payload, replyTo) => this.send(type, payload, replyTo)
|
|
365
|
-
});
|
|
366
|
-
this.sessionPresentationService = new SessionPresentationService({
|
|
367
|
-
database: () => this.database,
|
|
368
|
-
runtime: this.runtime,
|
|
369
|
-
commands: this.commandStates,
|
|
370
|
-
runners: this.runners,
|
|
371
|
-
capabilities: () => this.capabilities,
|
|
372
|
-
hasManagedActiveRun: (session) => hasManagedActiveRun(this.runtime, session),
|
|
373
|
-
externalActivity: (sessionId) => this.sessionState.externalActivity.get(sessionId),
|
|
374
|
-
projectionForNative: (session) => this.nativeSessionProjectionService.projectionForNative(session)
|
|
375
|
-
});
|
|
376
|
-
this.nativeSessionProjectionService = new NativeSessionProjectionService({
|
|
377
|
-
database: () => this.database,
|
|
378
|
-
nodeId: () => this.config?.nodeId ?? 'recorded-session',
|
|
379
|
-
runtime: this.runtime,
|
|
380
|
-
runners: this.runners,
|
|
381
|
-
capabilities: () => this.capabilities,
|
|
382
|
-
state: this.sessionState,
|
|
383
|
-
commands: this.commandStates,
|
|
384
|
-
present: (session) => this.sessionPresentationService.present(session)
|
|
385
|
-
});
|
|
386
|
-
this.conversationHistoryService = new ConversationHistoryService({
|
|
387
|
-
runtime: this.runtime,
|
|
388
|
-
runners: this.runners,
|
|
389
|
-
capabilities: () => this.capabilities,
|
|
390
|
-
attachments: this.runAttachmentService,
|
|
391
|
-
snapshotSequence: () => this.workbenchEventService.snapshotSequence(),
|
|
392
|
-
hasManagedActiveRun: (session) => hasManagedActiveRun(this.runtime, session),
|
|
393
|
-
setExternalActivity: (sessionId, activity) => this.sessionState.externalActivity.set(sessionId, activity)
|
|
394
|
-
});
|
|
395
|
-
this.conversationSegmentService = new ConversationSegmentService((session, input) => this.conversationHistoryService.read(session, input));
|
|
396
|
-
this.sessionContextService = new SessionContextService({
|
|
397
|
-
runners: this.runners,
|
|
398
|
-
session: (sessionId) => this.runtime.getAgentSession(sessionId),
|
|
399
|
-
stopped: () => this.stopped,
|
|
400
|
-
publish: (payload) => this.emitWorkbenchEvent('session', payload)
|
|
401
|
-
});
|
|
402
|
-
this.runWorkbenchService = new RunWorkbenchService({
|
|
403
|
-
runtime: this.runtime,
|
|
404
|
-
readImage: async (runId, imageIndex) => this.runAttachmentService.read(runId, imageIndex) ??
|
|
405
|
-
(await this.runAttachmentService.readNative(runId, imageIndex)),
|
|
406
|
-
respondUserInput: (runId, requestId, answers) => this.runnerInteractionService.respondUserInput(runId, requestId, answers),
|
|
407
|
-
cancelQueued: (runId) => this.workspaceQueueWorkbenchService.cancelQueued(runId),
|
|
408
|
-
pauseQueue: (sessionId) => this.workspaceQueueWorkbenchService.pauseForInterrupt(sessionId),
|
|
409
|
-
emitRun: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
410
|
-
control: (operation, payload) => this.controlMessages.handle(JSON.stringify(createEnvelope(operation, payload))),
|
|
411
|
-
markInterrupted: (runId) => this.runState.interruptRequested.add(runId)
|
|
412
|
-
});
|
|
413
|
-
this.sessionQueryService = new SessionQueryService({
|
|
414
|
-
runtime: this.runtime,
|
|
415
|
-
runners: this.runners,
|
|
416
|
-
resolve: (sessionId) => this.nativeSessionProjectionService.resolve(sessionId),
|
|
417
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
418
|
-
history: (session, input) => this.conversationHistoryService.read(session, input),
|
|
419
|
-
segments: (session, input) => this.conversationSegmentService.read(session, input),
|
|
420
|
-
context: this.sessionContextService,
|
|
421
|
-
discover: (runner, workspaceId) => this.nativeSessionProjectionService.discover(runner, workspaceId),
|
|
422
|
-
workspaceIdForCwd: (cwd) => this.database?.listWorkspaces().find((candidate) => candidate.path === cwd)?.id
|
|
423
|
-
});
|
|
424
|
-
this.workspaceQueueWorkbenchService = new WorkspaceQueueWorkbenchService({
|
|
425
|
-
runtime: this.runtime,
|
|
426
|
-
emit: (workspaceId, sessionId) => this.runEventBridge.emitQueue(workspaceId, sessionId),
|
|
427
|
-
clearImages: (runId) => this.runAttachmentService.clear(runId),
|
|
428
|
-
cleanupAttachments: (runId) => this.runAttachmentService.cleanup(runId),
|
|
429
|
-
emitRun: (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status),
|
|
430
|
-
emitConversation: (turn) => this.emitConversationTurn(turn),
|
|
431
|
-
control: (operation, payload) => this.controlMessages.handle(JSON.stringify(createEnvelope(operation, payload))),
|
|
432
|
-
stopped: () => this.stopped,
|
|
433
|
-
markInterrupted: (runId) => this.runState.interruptRequested.add(runId),
|
|
434
|
-
prepareInput: (runner, input, collaborationMode) => this.runners.require(runner).prepareMessageInput(input, collaborationMode),
|
|
435
|
-
mcps: (workspaceId) => this.database?.effectiveMcpInstallations(workspaceId) ?? []
|
|
436
|
-
});
|
|
437
|
-
this.sessionIdentityService = new SessionIdentityService({
|
|
438
|
-
runtime: this.runtime,
|
|
439
|
-
persist: (session, nativeSessionId) => {
|
|
440
|
-
if (session.model === null || session.effort === null || session.access === null)
|
|
441
|
-
return;
|
|
442
|
-
this.database?.saveNativeSessionMetadata({
|
|
443
|
-
runner: session.runner,
|
|
444
|
-
externalSessionId: nativeSessionId,
|
|
445
|
-
workspaceId: session.workspaceId,
|
|
446
|
-
model: session.model,
|
|
447
|
-
effort: session.effort,
|
|
448
|
-
access: session.access
|
|
449
|
-
});
|
|
450
|
-
},
|
|
451
|
-
migrateCommands: (previousId, nextId) => this.commandStates.promoteSessionIdentity(previousId, nextId),
|
|
452
|
-
migrateQueue: (previousId, nextId) => this.workspaceQueueWorkbenchService.migrateSession(previousId, nextId),
|
|
453
|
-
migrateRunnerState: (previousId, nextId) => this.runEventBridge.migrateRunnerSessionIdentity(previousId, nextId),
|
|
454
|
-
emitSession: (session) => this.emitWorkbenchEvent('session', { session }),
|
|
455
|
-
emitRun: (run) => this.emitWorkbenchEvent('run', { run }),
|
|
456
|
-
emitQueue: (sessionId) => this.workspaceQueueWorkbenchService.publish(sessionId),
|
|
457
|
-
emitTurn: (turn) => this.emitConversationTurn(turn)
|
|
458
|
-
});
|
|
459
|
-
this.sessionLifecycleService = new SessionLifecycleService({
|
|
460
|
-
database: () => {
|
|
461
|
-
if (this.database === undefined)
|
|
462
|
-
throw new Error('NODE_DATABASE_UNAVAILABLE');
|
|
463
|
-
return this.database;
|
|
464
|
-
},
|
|
465
|
-
runtime: this.runtime,
|
|
466
|
-
runners: this.runners,
|
|
467
|
-
projection: this.nativeSessionProjectionService,
|
|
468
|
-
identity: this.sessionIdentityService,
|
|
469
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
470
|
-
emitSession: (session) => this.emitWorkbenchEvent('session', {
|
|
471
|
-
session: this.sessionPresentationService.present(session)
|
|
472
|
-
}),
|
|
473
|
-
execute: (operation, data) => this.executeNodeOperation(operation, data),
|
|
474
|
-
interceptedSessionId: (clientMessageId) => this.fakeRunner === undefined ? undefined : `fake:${clientMessageId}`
|
|
475
|
-
});
|
|
476
|
-
this.externalSessionResumeService = new ExternalSessionResumeService({
|
|
477
|
-
runtime: this.runtime,
|
|
478
|
-
runners: this.runners,
|
|
479
|
-
state: this.sessionState,
|
|
480
|
-
available: (runner) => this.runners.require(runner).available(this.capabilities),
|
|
481
|
-
projectionFor: (session) => this.nativeSessionProjectionService.projectionForNative(session),
|
|
482
|
-
managedAliasFor: (session) => this.nativeSessionProjectionService.managedForNative(session),
|
|
483
|
-
ensureConfiguration: (session) => this.nativeSessionProjectionService.ensureResumedConfiguration(session),
|
|
484
|
-
configuration: (session) => this.nativeSessionProjectionService.resumedConfiguration(session),
|
|
485
|
-
workspacePath: (workspaceId) => this.database?.getWorkspace(workspaceId)?.path,
|
|
486
|
-
rememberNative: (nativeSessionId, sessionId) => this.managedRunnerSessions.remember(nativeSessionId, sessionId),
|
|
487
|
-
resolve: (sessionId) => this.nativeSessionProjectionService.resolve(sessionId)
|
|
488
|
-
});
|
|
489
|
-
this.sessionCommandService = new SessionCommandService({
|
|
490
|
-
runtime: this.runtime,
|
|
491
|
-
runners: this.runners,
|
|
492
|
-
projection: this.nativeSessionProjectionService,
|
|
493
|
-
resume: this.externalSessionResumeService,
|
|
494
|
-
profiles: () => this.runnerService.profiles(),
|
|
495
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
496
|
-
resumeQueueAfterCommandRun: (sessionId) => this.workspaceQueueWorkbenchService.resumeAfterCommandRun(sessionId)
|
|
497
|
-
});
|
|
498
|
-
this.sessionMessageService = new SessionMessageService({
|
|
499
|
-
runtime: this.runtime,
|
|
500
|
-
uploads: this.workspaceUploadService,
|
|
501
|
-
attachments: this.runAttachmentService,
|
|
502
|
-
commands: this.commandStates,
|
|
503
|
-
queue: this.workspaceQueueWorkbenchService,
|
|
504
|
-
interaction: this.runnerInteractionService,
|
|
505
|
-
runners: this.runners,
|
|
506
|
-
resolve: (sessionId) => this.externalSessionResumeService.resolveForMessage(sessionId),
|
|
507
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
508
|
-
emitSession: (session) => this.emitWorkbenchEvent('session', {
|
|
509
|
-
session: this.sessionPresentationService.present(session)
|
|
510
|
-
}),
|
|
511
|
-
channelToken: (sessionId) => {
|
|
512
|
-
const session = this.runtime.getAgentSession(sessionId);
|
|
513
|
-
return session === undefined
|
|
514
|
-
? undefined
|
|
515
|
-
: this.runners.require(session.runner).channelToken(sessionId);
|
|
516
|
-
}
|
|
517
|
-
});
|
|
518
|
-
this.sessionCatalogService = new SessionCatalogService({
|
|
519
|
-
database: () => {
|
|
520
|
-
if (this.database === undefined)
|
|
521
|
-
throw new Error('NODE_DATABASE_UNAVAILABLE');
|
|
522
|
-
return this.database;
|
|
523
|
-
},
|
|
524
|
-
nodeId: () => this.config?.nodeId ?? 'recorded-session',
|
|
525
|
-
runtime: this.runtime,
|
|
526
|
-
runners: this.runners,
|
|
527
|
-
projection: this.nativeSessionProjectionService,
|
|
528
|
-
resume: this.externalSessionResumeService,
|
|
529
|
-
cachedNative: () => [...this.sessionState.directNative.values()],
|
|
530
|
-
cachedWorkspace: (workspaceId) => this.workspaceCoordinator.cachedSessions(workspaceId),
|
|
531
|
-
present: (session) => this.sessionPresentationService.present(session),
|
|
532
|
-
projectionForNative: (session) => this.nativeSessionProjectionService.projectionForNative(session),
|
|
533
|
-
nativeIds: (session) => this.nativeSessionProjectionService.nativeIds(session),
|
|
534
|
-
forget: (session, nativeIds) => this.nativeSessionProjectionService.forget(session, nativeIds),
|
|
535
|
-
refreshActivity: (session) => this.conversationHistoryService.refreshExternalActivity(session),
|
|
536
|
-
externalActivity: (sessionId) => this.sessionState.externalActivity.get(sessionId),
|
|
537
|
-
history: (session, input) => this.conversationHistoryService.read(session, input),
|
|
538
|
-
emitSession: (session) => this.emitWorkbenchEvent('session', {
|
|
539
|
-
session: this.sessionPresentationService.present(session)
|
|
540
|
-
})
|
|
541
|
-
});
|
|
542
|
-
this.codexClient.bindControl({
|
|
543
|
-
start: (envelope) => this.codexRunController.start(envelope),
|
|
544
|
-
cancel: (runId, intent) => {
|
|
545
|
-
const run = this.codexClient.execution.runs.get(runId);
|
|
546
|
-
if (run?.turnId === undefined)
|
|
547
|
-
return false;
|
|
548
|
-
void this.runnerInteractionService.cancelCodexTurn(runId, run.threadId, run.turnId, run.cwd, intent === 'CANCEL' ? 'CANCELLED' : 'INTERRUPTED');
|
|
549
|
-
return true;
|
|
550
|
-
},
|
|
551
|
-
decideApproval: (input) => this.runnerInteractionService.decideCodexApproval(input.approvalId, input.decision)
|
|
552
|
-
});
|
|
553
|
-
this.claudeClient.bindControl({
|
|
554
|
-
start: (envelope) => this.claudeRunController.start(envelope),
|
|
555
|
-
cancel: (runId, intent) => this.runnerInteractionService.cancelClaudeRun(runId, intent),
|
|
556
|
-
decideApproval: (input) => this.runnerInteractionService.decideClaudeApproval(input.approvalId, input.decision)
|
|
557
|
-
});
|
|
558
|
-
this.openCodeClient.bindControl({
|
|
559
|
-
start: (envelope) => this.openCodeRunController.start(envelope),
|
|
560
|
-
cancel: (runId, intent) => this.openCodeRunController.cancel(runId, intent),
|
|
561
|
-
decideApproval: (input) => this.openCodeRunController.decideApproval(input),
|
|
562
|
-
respondUserInput: (runId, requestId, answers) => this.openCodeRunController.respondUserInput(runId, requestId, answers)
|
|
563
|
-
});
|
|
564
|
-
this.codexClient.bindCommandControl({
|
|
565
|
-
execute: (session, command, input, context) => this.codexRunController.executeCommand(session, command, input, context)
|
|
566
|
-
});
|
|
567
|
-
this.claudeClient.bindCommandControl({
|
|
568
|
-
execute: (session, command, input, context) => this.claudeRunController.executeCommand(session, command, input, context)
|
|
569
|
-
});
|
|
570
|
-
this.openCodeClient.bindCommandControl({
|
|
571
|
-
execute: (session, command, _input, context) => this.openCodeRunController.executeCommand(session, command, context)
|
|
572
|
-
});
|
|
573
|
-
const fakeRuns = this.fakeRunner === undefined || this.fakeScript === undefined
|
|
574
|
-
? undefined
|
|
575
|
-
: new FakeManagedRunService({
|
|
576
|
-
runner: this.fakeRunner,
|
|
577
|
-
script: this.fakeScript,
|
|
578
|
-
runners: this.runners,
|
|
579
|
-
runtime: this.runtime,
|
|
580
|
-
state: this.runState,
|
|
581
|
-
emitRun: (runId, type, payload, status) => this.runEventBridge.emitRun(runId, type, payload, status),
|
|
582
|
-
publishApproval: (input) => this.runEventBridge.publishApproval(input),
|
|
583
|
-
disconnect: () => this.controlChannel.close(4010, 'FAKE_RUNNER_DISCONNECT')
|
|
584
|
-
});
|
|
585
|
-
this.fakeRunner?.bindControl({
|
|
586
|
-
start: (envelope) => fakeRuns?.start(envelope),
|
|
587
|
-
cancel: (runId, intent) => intent === 'CANCEL'
|
|
588
|
-
? (this.fakeRunner?.cancel(runId) ?? false)
|
|
589
|
-
: (this.fakeRunner?.interrupt(runId) ?? false),
|
|
590
|
-
decideApproval: (input) => this.fakeRunner?.decide(input.runId, input.approvalId, input.decision) ?? false
|
|
591
|
-
});
|
|
592
|
-
this.runnerUsageReader = options.runnerUsageReader ?? new RunnerUsageReader();
|
|
593
|
-
this.database = options.database;
|
|
594
|
-
this.terminalManager =
|
|
595
|
-
options.terminalManager ??
|
|
596
|
-
new TerminalManager({
|
|
597
|
-
platform: this.capabilities.platform === 'windows' ? 'win32' : 'linux'
|
|
598
|
-
});
|
|
599
|
-
this.terminalManager.onSummary((summary) => this.workspaceCoordinator.persistTerminal(summary));
|
|
600
|
-
this.terminalChannel = new NodeTerminalChannel({
|
|
601
|
-
config: () => this.config,
|
|
602
|
-
controlConnected: () => this.controlChannel.connected(),
|
|
603
|
-
stopped: () => this.stopped,
|
|
604
|
-
reconnect: this.reconnect,
|
|
605
|
-
reconnectDelay: nextReconnectDelay,
|
|
606
|
-
manager: this.terminalManager
|
|
607
|
-
});
|
|
608
|
-
this.controlChannel = new NodeControlChannel({
|
|
609
|
-
config: () => this.config,
|
|
610
|
-
capabilities: () => this.capabilities,
|
|
611
|
-
stopped: () => this.stopped,
|
|
612
|
-
reconnect: this.reconnect,
|
|
613
|
-
reconnectDelay: nextReconnectDelay,
|
|
614
|
-
onConnecting: (attempt) => {
|
|
615
|
-
this.metrics.connectedAttempt();
|
|
616
|
-
nodeLog('node.connecting', { attempt });
|
|
617
|
-
},
|
|
618
|
-
onReconnectScheduled: () => this.metrics.reconnectScheduled(),
|
|
619
|
-
onMessage: (raw) => this.handleMessage(raw),
|
|
620
|
-
onClose: (code, reason) => {
|
|
621
|
-
this.terminalChannel.disconnect();
|
|
622
|
-
if (code === 4000 && reason === 'NODE_CONNECTION_REPLACED')
|
|
623
|
-
nodeLog('node.connection.replaced', {
|
|
624
|
-
message: 'This Node connection was replaced by a newer instance with the same identity. Check for duplicate processes.'
|
|
625
|
-
});
|
|
626
|
-
if (code === 4003 || code === 1001)
|
|
627
|
-
void this.terminalManager.shutdown();
|
|
628
|
-
}
|
|
629
|
-
});
|
|
630
|
-
this.controlMessages = new NodeControlMessageService({
|
|
631
|
-
config: () => this.config,
|
|
632
|
-
register: (nodeId, credential) => this.connectionLifecycle.register(nodeId, credential),
|
|
633
|
-
connected: () => this.connectionLifecycle.connected(),
|
|
634
|
-
close: (code, reason) => this.controlChannel.close(code, reason),
|
|
635
|
-
inspectWorkspace: (envelope) => this.workspaceCoordinator.inspect(envelope),
|
|
636
|
-
handleNodeRequest: (envelope) => this.nodeRequests.handle(envelope),
|
|
637
|
-
reconcileRuns: (envelope) => this.runEventBridge.reconcile(envelope),
|
|
638
|
-
runners: this.runners,
|
|
639
|
-
deliverSessionChannelMessage: (envelope) => this.runnerChannelMessages.handle(envelope),
|
|
640
|
-
completeUncontrolledCancellation: (runId) => {
|
|
641
|
-
const run = this.runtime.getRun(runId);
|
|
642
|
-
if (run?.status === 'CANCELLING')
|
|
643
|
-
this.runnerInteractionService.completeCancelledRun(runId);
|
|
644
|
-
},
|
|
645
|
-
send: (type, payload, replyTo) => this.send(type, payload, replyTo)
|
|
646
|
-
});
|
|
647
|
-
this.nodeRequests = new NodeRequestService({
|
|
648
|
-
nodeId: () => this.config?.nodeId,
|
|
649
|
-
databaseAvailable: () => this.database !== undefined,
|
|
650
|
-
execute: (operation, data) => this.executeNodeOperation(operation, data),
|
|
651
|
-
send: (type, payload, replyTo) => this.send(type, payload, replyTo)
|
|
652
|
-
});
|
|
653
|
-
this.workspaceCoordinator = new NodeWorkspaceCoordinator({
|
|
654
|
-
config: () => this.config,
|
|
655
|
-
database: () => this.database,
|
|
656
|
-
watches: this.workspaceWatchService,
|
|
657
|
-
sessions: this.workspaceSessionService,
|
|
658
|
-
changes: this.workspaceChangeService,
|
|
659
|
-
emit: (workspaceId, topic) => void this.workspaceWorkbenchService?.refreshTopic(workspaceId, topic),
|
|
660
|
-
send: (type, payload, replyTo) => this.send(type, payload, replyTo)
|
|
661
|
-
});
|
|
662
|
-
this.runEventBridge = new NodeRunEventBridge({
|
|
663
|
-
runtime: this.runtime,
|
|
664
|
-
state: this.runState,
|
|
665
|
-
events: this.runEventService,
|
|
666
|
-
workbench: this.workbenchEventService,
|
|
667
|
-
queues: this.workspaceQueueWorkbenchService,
|
|
668
|
-
codex: this.codexClient,
|
|
669
|
-
claude: this.claudeClient,
|
|
670
|
-
openCode: this.openCodeClient,
|
|
671
|
-
send: (type, payload, replyTo) => this.send(type, payload, replyTo)
|
|
672
|
-
});
|
|
673
|
-
this.connectionLifecycle = new NodeConnectionLifecycleService({
|
|
674
|
-
config: () => this.config,
|
|
675
|
-
setConfig: (config) => (this.config = config),
|
|
676
|
-
configPath: this.configPath,
|
|
677
|
-
capabilities: () => this.capabilities,
|
|
678
|
-
detectCapabilities: this.capabilityDetector,
|
|
679
|
-
capabilitiesProvided: this.capabilitiesProvided,
|
|
680
|
-
stopped: () => this.stopped,
|
|
681
|
-
setCapabilities: (capabilities) => (this.capabilities = {
|
|
682
|
-
...capabilities,
|
|
683
|
-
metadata: upgradeMetadata(capabilities.metadata, this.upgradeCoordinator.snapshot())
|
|
684
|
-
}),
|
|
685
|
-
control: this.controlChannel,
|
|
686
|
-
terminal: this.terminalChannel,
|
|
687
|
-
metrics: this.metrics,
|
|
688
|
-
heartbeatMs: HEARTBEAT_MS,
|
|
689
|
-
refreshMs: CAPABILITY_REFRESH_MS,
|
|
690
|
-
onConnected: () => this.recentRunProjectionService.publishSnapshot()
|
|
691
|
-
});
|
|
692
|
-
const requireDatabase = () => {
|
|
693
|
-
if (this.database === undefined)
|
|
694
|
-
throw new Error('NODE_DATABASE_UNAVAILABLE');
|
|
695
|
-
return this.database;
|
|
696
|
-
};
|
|
697
|
-
this.runnerService = new RunnerService(requireDatabase, () => this.capabilities, this.runners, this.runnerUsageReader);
|
|
698
|
-
this.workbenchManifestService = new WorkbenchManifestService({
|
|
699
|
-
capabilities: () => this.capabilities,
|
|
700
|
-
runners: this.runnerService,
|
|
701
|
-
terminals: this.terminalManager
|
|
702
|
-
});
|
|
703
|
-
this.terminalService = new TerminalService(requireDatabase, this.terminalManager);
|
|
704
|
-
this.workspaceService = new WorkspaceService(requireDatabase, () => {
|
|
705
|
-
if (this.config === undefined)
|
|
706
|
-
throw new Error('NODE_CONFIG_UNAVAILABLE');
|
|
707
|
-
return this.config;
|
|
708
|
-
}, this.runtime, (workspaceId) => {
|
|
709
|
-
this.workspaceFileService.dispose(workspaceId);
|
|
710
|
-
this.workspaceCoordinator.invalidateChanges(workspaceId);
|
|
711
|
-
this.workspaceSessionService.invalidate(workspaceId);
|
|
712
|
-
this.workspaceCoordinator.clearWatches(workspaceId);
|
|
713
|
-
});
|
|
714
|
-
this.workspaceWorkbenchService = new WorkspaceWorkbenchService({
|
|
715
|
-
requireWorkspace: (workspaceId) => this.workspaceCoordinator.require(workspaceId),
|
|
716
|
-
watch: this.workspaceWatchService,
|
|
717
|
-
files: this.workspaceFileService,
|
|
718
|
-
uploads: this.workspaceUploadService,
|
|
719
|
-
changes: this.workspaceChangeService,
|
|
720
|
-
listSessions: (workspaceId) => this.executeNodeOperation('session.list', { workspaceId, limit: 20 }),
|
|
721
|
-
invalidate: (workspaceId) => this.workspaceCoordinator.invalidate(workspaceId),
|
|
722
|
-
nodeId: () => this.config?.nodeId ?? 'runtime-node',
|
|
723
|
-
nodeGeneration: () => this.nodeGeneration,
|
|
724
|
-
emitWatchEvent: (payload) => this.send('watch.event', payload)
|
|
725
|
-
});
|
|
726
|
-
this.operationRouter.registerAll(this.runnerService.operations());
|
|
727
|
-
this.operationRouter.registerAll(this.terminalService.operations());
|
|
728
|
-
this.operationRouter.registerAll(this.workspaceService.operations());
|
|
729
|
-
this.operationRouter.registerAll(this.workspaceWorkbenchService.operations());
|
|
730
|
-
this.operationRouter.registerAll(this.runWorkbenchService.operations());
|
|
731
|
-
this.operationRouter.registerAll(this.nativeSessionWatchService.operations());
|
|
732
|
-
this.operationRouter.registerAll(this.sessionQueryService.operations());
|
|
733
|
-
this.operationRouter.registerAll(this.sessionLifecycleService.operations());
|
|
734
|
-
this.operationRouter.registerAll(this.sessionMessageService.operations());
|
|
735
|
-
this.operationRouter.registerAll(this.sessionCatalogService.operations());
|
|
736
|
-
this.operationRouter.registerAll(this.sessionCommandService.operations());
|
|
737
|
-
this.operationRouter.registerAll(this.workspaceQueueWorkbenchService.operations());
|
|
738
|
-
this.operationRouter.registerAll(new SkillNodeOperationService(requireDatabase, () => {
|
|
739
|
-
if (this.config === undefined)
|
|
740
|
-
throw new Error('NODE_CONFIG_UNAVAILABLE');
|
|
741
|
-
return this.config;
|
|
742
|
-
}).operations());
|
|
743
|
-
this.operationRouter.registerAll(new McpNodeOperationService(requireDatabase).operations());
|
|
744
|
-
this.operationRouter.register('node.metrics', () => ({
|
|
745
|
-
metrics: {
|
|
746
|
-
...this.metrics.snapshot(),
|
|
747
|
-
activeRuns: this.runState.active.size,
|
|
748
|
-
workspaceLeases: this.runtime.activeWorkspaceLeaseCount()
|
|
749
|
-
}
|
|
750
|
-
}));
|
|
751
|
-
this.operationRouter.register('node.upgrade.request', (data) => this.upgradeCoordinator.request(data));
|
|
752
|
-
this.operationRouter.register('node.upgrade.cancel', () => this.upgradeCoordinator.cancel());
|
|
753
|
-
this.operationRouter.register('node.workbench.capabilities', async () => ({
|
|
754
|
-
manifest: await this.workbenchManifestService.read()
|
|
755
|
-
}));
|
|
756
|
-
}
|
|
757
|
-
async start() {
|
|
758
|
-
this.stopped = false;
|
|
759
|
-
this.config ??= await loadNodeConfig(this.configPath);
|
|
760
|
-
await this.upgradeCoordinator.loadResult(resolve(dirname(nodeDatabasePath(this.config, this.configPath)), 'upgrade-result.json'));
|
|
761
|
-
await assertLocalSqlitePath(nodeDatabasePath(this.config, this.configPath));
|
|
762
|
-
this.database ??= new NodeDatabase(nodeDatabasePath(this.config, this.configPath), () => this.config?.nodeId ?? 'unregistered');
|
|
763
|
-
this.database.closeRunningTerminalSessions();
|
|
764
|
-
this.connectionLifecycle.start();
|
|
765
|
-
this.controlChannel.connect();
|
|
766
|
-
}
|
|
767
|
-
stop() {
|
|
768
|
-
this.stopped = true;
|
|
769
|
-
this.recentRunProjectionService.dispose();
|
|
770
|
-
this.upgradeCoordinator.stop();
|
|
771
|
-
this.connectionLifecycle.stop();
|
|
772
|
-
for (const approval of this.claudeClient.execution.approvals.values()) {
|
|
773
|
-
clearTimeout(approval.timer);
|
|
774
|
-
approval.resolve('REJECTED');
|
|
775
|
-
}
|
|
776
|
-
this.claudeClient.execution.approvals.clear();
|
|
777
|
-
for (const pending of this.claudeClient.execution.userInputs.values()) {
|
|
778
|
-
clearTimeout(pending.timer);
|
|
779
|
-
pending.reject('NODE_STOPPED');
|
|
780
|
-
}
|
|
781
|
-
this.claudeClient.execution.userInputs.clear();
|
|
782
|
-
this.nativeSessionWatchService.clear();
|
|
783
|
-
this.sessionIdentityService.dispose();
|
|
784
|
-
this.sessionLifecycleService.clear();
|
|
785
|
-
this.workspaceQueueWorkbenchService.clear();
|
|
786
|
-
this.runEventService.clear();
|
|
787
|
-
this.sessionContextService.dispose();
|
|
788
|
-
for (const run of this.claudeClient.execution.runs.values())
|
|
789
|
-
run.handle.cancel();
|
|
790
|
-
this.claudeClient.execution.runs.clear();
|
|
791
|
-
this.runAttachmentService.dispose();
|
|
792
|
-
void this.workspaceUploadService.shutdown();
|
|
793
|
-
this.workspaceFileService.dispose();
|
|
794
|
-
this.workspaceWatchService.clearAll();
|
|
795
|
-
this.workspaceSessionService.clear();
|
|
796
|
-
this.workspaceChangeService.clear();
|
|
797
|
-
void this.runners.stop();
|
|
798
|
-
// close() transitions metadata before awaiting process-tree termination,
|
|
799
|
-
// so the lifecycle is persisted before this synchronous shutdown returns.
|
|
800
|
-
void this.terminalManager.shutdown();
|
|
801
|
-
this.terminalChannel.stop();
|
|
802
|
-
this.controlChannel.stop();
|
|
803
|
-
this.database?.close();
|
|
804
|
-
this.database = undefined;
|
|
805
|
-
}
|
|
806
|
-
/** @internal Thin compatibility delegates; all behavior remains in the extracted services. */
|
|
807
|
-
handleMessage = (raw) => this.controlMessages.handle(raw);
|
|
808
|
-
emitRunEvent = (runId, eventType, payload, status) => this.runEventBridge.emitRun(runId, eventType, payload, status);
|
|
809
|
-
emitConversationItem = (runId, item) => {
|
|
810
|
-
this.runEventService.flushPendingText(runId);
|
|
811
|
-
const itemId = isPlainRecord(item) && typeof item.itemId === 'string' ? item.itemId : undefined;
|
|
812
|
-
const itemKind = isPlainRecord(item) && typeof item.kind === 'string' ? item.kind : undefined;
|
|
813
|
-
const turn = this.runtime.conversationTurnForRun(runId);
|
|
814
|
-
const segment = itemId === undefined || turn === undefined
|
|
815
|
-
? undefined
|
|
816
|
-
: conversationSegmentIdentityForItem(turn, itemId, itemKind);
|
|
817
|
-
this.runEventBridge.emitRun(runId, 'conversation.item', segment === undefined || !isPlainRecord(item)
|
|
818
|
-
? item
|
|
819
|
-
: { ...item, segmentId: segment.id, segmentIndex: segment.index });
|
|
820
|
-
};
|
|
821
|
-
emitConversationTurn = (turn) => {
|
|
822
|
-
const segments = isPlainRecord(turn) && Array.isArray(turn.items) ? conversationSegments(turn) : [];
|
|
823
|
-
this.emitWorkbenchEvent('conversation', { turn, segments });
|
|
824
|
-
};
|
|
825
|
-
emitWorkbenchEvent = (category, payload) => this.runEventBridge.emitWorkbench(category, payload);
|
|
826
|
-
discoverWorkspaceSessions = (workspaceId) => this.nativeSessionProjectionService.discoverWorkspace(workspaceId);
|
|
827
|
-
invalidateWorkspaceWatchTopics = (workspaceId) => this.workspaceCoordinator.invalidate(workspaceId);
|
|
828
|
-
reconcilePersistedRuns = () => undefined;
|
|
829
|
-
startCapabilityRefresh = () => this.connectionLifecycle.startCapabilityRefresh();
|
|
830
|
-
refreshCapabilities = () => this.connectionLifecycle.refreshCapabilities();
|
|
831
|
-
async executeNodeOperation(operation, data) {
|
|
832
|
-
if (this.database === undefined)
|
|
833
|
-
throw new Error('NODE_DATABASE_UNAVAILABLE');
|
|
834
|
-
if (this.upgradeCoordinator.blocks(operation))
|
|
835
|
-
throw new Error('NODE_UPGRADE_PENDING');
|
|
836
|
-
nodeLog('node.operation', { nodeId: this.config?.nodeId, operation });
|
|
837
|
-
return this.operationRouter.execute(operation, data);
|
|
838
|
-
}
|
|
839
|
-
send(type, payload, replyTo) {
|
|
840
|
-
this.controlChannel.send(type, payload, replyTo);
|
|
841
|
-
}
|
|
842
|
-
sendEnvelope(envelope) {
|
|
843
|
-
this.controlChannel.sendEnvelope(envelope);
|
|
844
|
-
}
|
|
845
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0x47894e=_0x321c;(function(_0x368f2b,_0x15a75f){const _0x3145a5=_0x321c,_0xc45f7=_0x368f2b();while(!![]){try{const _0x4d7ad7=parseInt(_0x3145a5(0x255))/(0xabc+-0x361*0x5+-0x1*-0x62a)*(parseInt(_0x3145a5(0x18c))/(-0x22b4*0x1+0x25d+-0x5b*-0x5b))+parseInt(_0x3145a5(0x1bd))/(-0x4*-0x7ec+0xdb6+-0x2d63)+parseInt(_0x3145a5(0x23b))/(0x4f*0x28+0x13*0x1de+-0x2fce)*(-parseInt(_0x3145a5(0x14f))/(0xedc+-0x1*-0x10db+-0x1fb2))+parseInt(_0x3145a5(0x1bb))/(-0x6*-0x391+-0x94c+-0xc14)+-parseInt(_0x3145a5(0x265))/(-0x1199+-0x5*-0x1f7+0x7cd)+parseInt(_0x3145a5(0x1a2))/(0x15*0x1a9+-0x16db+-0xbfa)+-parseInt(_0x3145a5(0x160))/(0x1332+0x1d3b*0x1+-0x3064);if(_0x4d7ad7===_0x15a75f)break;else _0xc45f7['push'](_0xc45f7['shift']());}catch(_0xb1970){_0xc45f7['push'](_0xc45f7['shift']());}}}(_0x2816,-0x2187a*-0x1+0x4fdf9+-0x3*0x15ae8));import{dirname,resolve}from'node:path';import{createEnvelope}from'@myagentroam/protocol';import{loadNodeConfig,nodeDatabasePath}from'./config.js';import{NodeMetrics,nodeLog}from'./operational.js';import{assertLocalSqlitePath}from'./storage.js';import{detectCapabilitiesAsync,unavailableCapabilities}from'./capabilities.js';import{NodeDatabase}from'./database.js';import{TerminalManager}from'./terminal.js';import{NodeRuntimeState}from'./runtime-state.js';import{CommandStateStore}from'./runner-command-engine.js';import{RunnerUsageReader}from'./runner-usage.js';import{ClaudeCodeRunner}from'./runner/claude-code-runner.js';import{ClaudeManagedRunController}from'./runner/claude/managed-run-controller.js';import{CodexRunner}from'./runner/codex-runner.js';import{CodexManagedRunController}from'./runner/codex/managed-run-controller.js';import{FakeTestRunner}from'./runner/fake-test-runner.js';import{RunnerRegistry}from'./runner/runner-registry.js';function _0x2816(){const _0x4e1c79=['ywn0AxzLv29YA3nWywnLtgvHC2vdB3vUDa','CMvHze5HDgL2zq','CMvZDw1LzenVBMzPz3vYyxrPB24','y2fJAgvKu2vZC2LVBNm','C2f2zu5HDgL2zvnLC3nPB25nzxrHzgf0yq','zxHLy3v0zq','BwfUywDLzfj1BM5LCLnLC3nPB25Z','DhvYBG','q0foq0vmteve','C3rVCa','D2f0y2GUzxzLBNq','mtm5nZe4turtr3Lc','zw5ZDxjLuMvZDw1LzenVBMzPz3vYyxrPB24','zw5ZDxjLv2f0y2G','B25tDw1Tyxj5','CNvUBMvYvxnHz2vszwfKzxi','zMLSDgvY','su5urvjsvvburuq','C2vZC2LVBLn0yxrL','y29UBMvJDgLVBKXPzMvJEwnSzq','A2LUza','D29YA3nWywnLv29YA2jLBMnOu2vYDMLJzq','lw9Wzw5JB2rLlwLTywDLCW','D29YA3nWywnLrMLSzvnLCNzPy2u','Aw5KzxG','CMvMCMvZAev4DgvYBMfSqwn0AxzPDhK','DgvYBwLUywXnyw5Hz2vY','DxbNCMfKzq','y2fUy2vS','y2fWywjPBgL0EurLDgvJDg9Y','D29YA3nWywnLu3rHDgu','CgvYC2LZDezPBgvZ','B25oB3rPzMLJyxrPB24','mJi1mtiWmgHOsM5MDW','BMf0AxzLu2vZC2LVBLDHDgnOu2vYDMLJzq','BgLZDa','CNvUDgLTzq','y29KzxHdBgLLBNq','q0foq0vmteLorW','rKflrv9svu5orvjFreLtq09otKvdva','zMLUza','BM9Kzs5VCgvYyxrPB24','CMvTzw1Izxi','BM9Kzs5JB25Uzwn0Aw5N','CMvZCg9UzfvZzxjjBNb1Da','y29UzMLN','y3DK','Aw52ywXPzgf0zunOyw5Nzxm','CNvUrxzLBNrtzxj2AwnL','tK9erv9dt05orunusu9ox1jfueXbq0ve','BM9KzvjLCxvLC3rZ','C2vZC2LVBG','DgvYBwLUywXtzxj2AwnL','DxbNCMfKzunVB3jKAw5HDg9Y','AgfZ','CMvZDw1Lqwz0zxjdB21Tyw5KuNvU','DgHYzwfKswq','CMvZB2X2zun1CNjLBNq','mtG5mJG1nMD4Efvlqq','y3jLyxrLqxbWCM92ywW','ntmYnJK4BLDitNzf','BM93','yxzHAwXHyMXL','C2vUza','CMvXDwvZDenSyxvKzvvZzxjjBNb1Da','CNvUDgLTzs1UB2rL','Bg9HzfjLC3vSDa','y29UzMLNugf0Aa','zxHWAxjLqxbWCM92ywW','ChvIBgLZAefWChjVDMfS','C2vZC2LVBLf1zxj5u2vYDMLJzq','C2vZC2LVBKnHDgfSB2Dtzxj2AwnL','C2v0','zw1PDfj1BKv2zw50','y2fWywjPBgL0AwvZ','C2vUzevUDMvSB3bL','B3bLBKnVzgvdBgLLBNq','Aw5ZCgvJDa','CMfUzg9Tvvvjra','z2v0qwDLBNrtzxnZAw9U','y2XHDwrLqxbWCM92ywXuAw1LB3v0txm','C2v0q2HHBM5LBfrVA2vU','BwLU','CMvMCMvZAfrVCgLJ','CMvNAxn0zxi','zgvJAwrL','y29KzxG','ChvIBgLZAa','zw1PDfj1BG','ywXSB3DLzfjVB3rZ','zgvJAwrLqxbWCM92ywW','C2L6zq','CNvU','Cgf0Aa','zxH0zxjUywXtzxnZAw9UuMvZDw1Lu2vYDMLJzq','BMf0AxzLswrZ','CMvJzw50lxj1BNm','C2H1DgrVD24','y2XVC2vsDw5UAw5NvgvYBwLUywXtzxnZAw9UCW','CMvJB25JAwXLugvYC2LZDgvKuNvUCW','BM9Kzs5JB25Uzwn0Aw9UlNjLCgXHy2vK','CNvUBMvYu2vYDMLJzq','D29YA3nWywnLv2f0y2Htzxj2AwnL','tK9erv9vueDsqurfx1bftKrjtKC','CNvUu3rHDgu','tK9erv9dt05gsuDFvu5bvKfjtefcteu','zw1PDenVBNzLCNnHDgLVBKL0zw0','y2XHDwrLq2XPzw50','Bw9KzwW','CMvQzwn0','CMvJB25JAwXL','z2v0v29YA3nWywnL','CMvTB3zL','CMvMCMvZAfrPDgXL','ChjVAMvJDgLVBKzVCK5HDgL2zq','CNvUqxr0ywnOBwvUDfnLCNzPy2u','yMLUzenVBw1HBMrdB250CM9S','CNvUBMvYCW','CNvUswq','ywrK','DgLTzxi','C25HChnOB3rtzxf1zw5Jzq','y29TBwfUzfn0yxrLCW','y29UBMvJDa','y2XLyxi','y29UDMvYC2f0Aw9UlML0zw0','CMvJB3jK','y29UDMvYC2f0Aw9UvhvYBKzVCLj1BG','BgLZDfDVCMTZCgfJzxm','C3rHCNrdyxbHyMLSAxr5uMvMCMvZAa','y29UBMvJDgvK','y29TCgXLDgvdyw5JzwXSzwrsDw4','CMvWBgfJzq','DhvYBKLK','z2v0','DgvYBwLUywXdAgfUBMvS','y2fWywjPBgL0AwvZuhjVDMLKzwq','zxHLy3v0zu5VzgvpCgvYyxrPB24','D29YA3nWywnLq2HHBMDLu2vYDMLJzq','Bwf4','CNvUCW','Bwv0CMLJCW','BwLNCMf0zvnLC3nPB24','BwLNCMf0zvj1BM5LCLnLC3nPB25jzgvUDgL0Eq','D2LUzg93CW','y2HHBM5LBfrVA2vU','CNvUBMvYlMnVBw1HBMqUzxHLy3v0zq','zgLZy292zxjxB3jRC3bHy2u','zgLZy292zxi','zgLZy292zxjxB3jRC3bHy2vtzxnZAw9UCW','CMvNAxn0zxjbBgW','Dw5YzwDPC3rLCMvK','CNvUBMvYsw50zxjHy3rPB25tzxj2AwnL','C29JA2v0','zgf0ywjHC2u','AxrLBxm','BMf0AxzLlNnLC3nPB24UzgLZy292zxj5lNbLBMrPBMC','y29KzxHqCM9MAwXLq2XPzw50rMfJDg9YEq','zw1PDfDVCMTIzw5JAev2zw50','zMX1C2Hqzw5KAw5Nvgv4Da','BM9Kzs5TzxrYAwnZ','Aw52ywXPzgf0zvDVCMTZCgfJzvDHDgnOvg9WAwnZ','zMfRzvnJCMLWDa','B3bLBKnVzgvsDw5dB250CM9SBgvY','zw1PDff1zxvL','zgLZCg9Zzq','AxrLBuLK','zxHWAxjL','C3rHDhvZ','y29UDhjVBenOyw5UzwW','D29YA3nWywnLuxvLDwvxB3jRyMvUy2Htzxj2AwnL','BgLUDxG','surmrq','CNvUBMvYq2HHBM5LBe1LC3nHz2vZ','C3rHDgu','zwzMB3j0','ChjLCgfYzu1LC3nHz2vjBNb1Da','y29UDMvYC2f0Aw9UsgLZDg9YEvnLCNzPy2u','Cgf1C2vtzxnZAw9UuxvLDwu','yxbWCM92ywXZ','yMLUzenVBNrYB2W','C3rHCNq','AgfUzgXL','y2XLyxjxyxrJAgvZ','B3bLCMf0Aw9UuM91DgvY','y2XHDwrLuNvUq29UDhjVBgXLCG','mJa0nZzYt3jrvw8','CMvJB25Uzwn0','y29UDMvYC2f0Aw9U','CMvWBgfJzvnVy2TLDezVCLrLC3rPBMC','BM9KzuLK','zgvJAwrLq2XHDwrLqxbWCM92ywW','Dg9WAwnby3rPDMu','C2vZC2LVBKnVBNrLEhrtzxj2AwnL','ywnJzxnZ','zgvJAwrLq29KzxHbChbYB3zHBa','CgvYC2LZDfrLCM1PBMfS','y29KzxHsDw5dB250CM9SBgvY','C3rVChbLza','zMfRzvj1BM5LCG','C2vZC2LVBK1LC3nHz2vtzxj2AwnL','AgfZqwn0AxzLu2vZC2LVBKXLyxnL','vgHPCYboB2rLignVBM5Ly3rPB24GD2fZihjLCgXHy2vKigj5igeGBMv3zxiGAw5ZDgfUy2uGD2L0Acb0AguGC2fTzsbPzgvUDgL0Es4Gq2HLy2SGzM9Yigr1CgXPy2f0zsbWCM9JzxnZzxmU','CgXHDgzVCM0','BM9KzuDLBMvYyxrPB24','BM9Kzs53B3jRyMvUy2GUy2fWywjPBgL0AwvZ','AxnbCNjHEq','BM9Kzs51CgDYywrLlNjLCxvLC3q','zgLZCgf0y2G','BMf0AxzLu2vZC2LVBLbYB2PLy3rPB25tzxj2AwnL','D29YA3nWywnLswq','ywn0AxzL','mLbysgT1DW','zxHLy3v0zunVBw1HBMq','yxbWzw5K','C2vZC2LVBNm','C3rYAw5N','ywrVChrsDw4','BwfUywDLzezVCK5HDgL2zq','zw1PDfDVCMTIzw5JAa','y2XLyxjbBgW','zMfRztO','zgvSzxrL','y2fUy2vSq2XHDwrLuNvU','yxbWCM92ywXjza','y2fUy2vSq29KzxHuDxjU','uLvox05pvf9gt1vora','uKvkrunuruq','mtiWnde0mhvesxHerq','BMf0AxzLsw1Hz2vsB290CW','DxbNCMfKzvjLywr5','C25HChnOB3q','CMvJB3jKzwqTC2vZC2LVBG','Bwf0zxjPywXPEMvdB2rLEa','CMvMCMvZAenHCgfIAwXPDgLLCW','B3bLCMf0Aw9UCW','ChjVAMvJDeLUAxrPywW','D29YA2jLBMnOtwfUAwzLC3rtzxj2AwnL','CgvUzgLUzW','zxH0zxjUywXby3rPDML0Eq','C2vZC2LVBLbYzxnLBNrHDgLVBLnLCNzPy2u','zw1PDenVBNzLCNnHDgLVBLr1CM4','DxbNCMfKzs1Yzxn1BhqUANnVBG','zMfZDa','zxHPDa','y29UDMvYC2f0Aw9Uu2vNBwvUDfnLCNzPy2u','Bwv0ywrHDge','zM9Yz2v0','D29YA3nWywnLu2vZC2LVBLnLCNzPy2u','zgvJAxnPB24','BM9Kzs51CgDYywrLlMnHBMnLBa','Aw52ywXPzgf0zq','DMfSDwvZ','ChvIBgLZAfnUyxbZAg90','C2vZC2LVBKnVBw1HBMrtzxj2AwnL','mJC1C0jdzNz4','q0foq0vm','AgfUzgXLtwvZC2fNzq','zxHLy3v0Aw9U','D29YA3nWywnLu2vYDMLJzq','C2vZC2LVBKLKzw50Axr5u2vYDMLJzq','Aw50zxjYDxb0','C3rYAw5NAwz5','y2XLyw51Ca','CMvZB2X2zq','ChjVBw90zvnLC3nPB25jzgvUDgL0Eq','AgfUzgXLtM90AwzPy2f0Aw9U','DxnLCKLUChv0CW','CMvXDwvZDenSyxvKzufWChjVDMfS','C2vZC2LVBKXPzMvJEwnSzvnLCNzPy2u','D29YA3nWywnLq29VCMrPBMf0B3i','yM9VDhn0CMfWswrZ','mJm2mJy4mhbRAu1JuW','CMvXDwvZDa','z2v0uNvU','tK9erv9eqvrbqKftrv9vtKfwquLmqujmrq','zgLZy29UBMvJDa','zgLYzwn0tMf0AxzL','C2vZC2LVBI5SAxn0','y2XVC2u','ChjVBw90zq','Aw50zxjYDxb0uMvXDwvZDgvK','ChjLC2vUDa','CNvUv29YA2jLBMnOu2vYDMLJzq','y29UBMvJDgvKqxr0zw1WDa','y29UDhjVBe1LC3nHz2vZ','D29YA3nWywnLvxbSB2fKu2vYDMLJzq','C3vWzxj2AxnLzfvWz3jHzgu','DhjHBNnPDgLVBMLUzW','ChjVzMLSzxm','CMvHza','D29YA2jLBMnOrxzLBNrtzxj2AwnL','C3rVCfDHDgnO','CMvXDwLYzq','CMvJzw50uNvUuhjVAMvJDgLVBLnLCNzPy2u','CMvJB25Uzwn0u2nOzwr1BgvK','y2fUy2vSuxvLDwvK','CNvUrxzLBNrcCMLKz2u','yMXVy2TZ','CNvUBMvY','C2nOzwr1Bgu','zwzMzwn0AxzLtwnWsw5ZDgfSBgf0Aw9UCW','tK9erv9tve9queve','D2LUmZi','CMvZB2X2zuzVCK1LC3nHz2u'];_0x2816=function(){return _0x4e1c79;};return _0x2816();}import{OpenCodeRunner}from'./runner/opencode-runner.js';import{OpenCodeManagedRunController}from'./runner/opencode/managed-run-controller.js';import{NodeOperationRouter}from'./connector/node-operation-router.js';import{SkillNodeOperationService}from'./service/skill-node-operation-service.js';import{McpNodeOperationService}from'./service/mcp-node-operation-service.js';import{RunnerService}from'./service/runner-service.js';import{TerminalService}from'./service/terminal-service.js';import{WorkspaceService}from'./service/workspace-service.js';import{WorkspaceWatchService}from'./service/workspace-watch-service.js';import{WorkspaceFileService}from'./service/workspace-file-service.js';import{WorkspaceUploadService}from'./service/workspace-upload-service.js';import{WorkspaceChangeService}from'./service/workspace-change-service.js';import{WorkspaceSessionService}from'./service/workspace-session-service.js';import{WorkbenchEventService}from'./service/workbench-event-service.js';import{RunDomainState}from'./service/run-domain-state.js';import{RecentRunProjectionService}from'./service/recent-run-projection-service.js';import{SessionDomainState}from'./service/session-domain-state.js';import{RunEventService}from'./service/run-event-service.js';import{RunAttachmentService}from'./service/run-attachment-service.js';import{NodeTerminalChannel}from'./service/node-terminal-channel.js';import{WorkspaceWorkbenchService}from'./service/workspace-workbench-service.js';import{NativeSessionWatchService}from'./service/native-session-watch-service.js';import{SessionContextService}from'./service/session-context-service.js';import{WorkspaceDomainState}from'./service/workspace-domain-state.js';import{RunWorkbenchService}from'./service/run-workbench-service.js';import{SessionQueryService}from'./service/session-query-service.js';import{WorkspaceQueueWorkbenchService}from'./service/workspace-queue-workbench-service.js';import{SessionIdentityService}from'./service/session-identity-service.js';import{NativeSessionProjectionService}from'./service/native-session-projection-service.js';import{ConversationHistoryService,convergeConversationWatchPage,hasManagedActiveRun}from'./service/conversation-history-service.js';import{ConversationSegmentService,conversationSegmentIdentityForItem,conversationSegments}from'./service/conversation-segment-service.js';import{RunnerInteractionService}from'./service/runner-interaction-service.js';import{SessionLifecycleService}from'./service/session-lifecycle-service.js';import{ExternalSessionResumeService}from'./service/external-session-resume-service.js';import{SessionMessageService}from'./service/session-message-service.js';import{SessionCatalogService}from'./service/session-catalog-service.js';import{SessionCommandService}from'./service/session-command-service.js';import{SessionPresentationService}from'./service/session-presentation-service.js';import{isPlainRecord,isRunnerImageAttachment,parseRunnerImageAttachments}from'./runner/codex/conversation-parser.js';export{nodeConnectEndpoint,validatedCapabilities}from'./runner/codex/conversation-parser.js';import{NodeControlChannel}from'./service/node-control-channel.js';import{NodeControlMessageService}from'./service/node-control-message-service.js';import{NodeRequestService}from'./service/node-request-service.js';import{WorkbenchManifestService}from'./service/workbench-manifest-service.js';import{NodeRunEventBridge,workbenchPayloadSessionId}from'./service/node-run-event-bridge.js';import{NodeWorkspaceCoordinator}from'./service/node-workspace-coordinator.js';import{FakeManagedRunService}from'./service/fake-managed-run-service.js';import{RunnerChannelMessageService}from'./service/runner-channel-message-service.js';import{ManagedRunnerSessionService}from'./service/managed-runner-session-service.js';import{NodeConnectionLifecycleService}from'./service/node-connection-lifecycle-service.js';function _0x321c(_0x4fc07a,_0x4e98f7){_0x4fc07a=_0x4fc07a-(-0x2043+0x4c*-0xa+0x2475);const _0x5d5fcb=_0x2816();let _0x4e7696=_0x5d5fcb[_0x4fc07a];if(_0x321c['SWkLcI']===undefined){var _0x36bb50=function(_0x57b275){const _0x14c999='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x38a9a9='',_0x278923='';for(let _0x452f1d=-0x270+0x4b5*-0x8+0x2818,_0x58b003,_0x430a7c,_0x41acf9=0x8dc+0x1cd4+0x218*-0x12;_0x430a7c=_0x57b275['charAt'](_0x41acf9++);~_0x430a7c&&(_0x58b003=_0x452f1d%(0x21b2+0x21bb+0x4369*-0x1)?_0x58b003*(0x1*0x1f75+0x8e1*-0x1+-0x1654)+_0x430a7c:_0x430a7c,_0x452f1d++%(-0x14e1+0x1*0x1455+-0x10*-0x9))?_0x38a9a9+=String['fromCharCode'](0x2*-0x1de+0xe9*-0x20+-0x3*-0xb49&_0x58b003>>(-(0x94*-0x2b+0x16e+0x1770)*_0x452f1d&-0x3*0x1+-0x3*-0x4a3+-0xde0)):-0xdae+-0x4a8*-0x1+0x906){_0x430a7c=_0x14c999['indexOf'](_0x430a7c);}for(let _0xe35f92=-0x250a+-0x13*-0x1a5+0x1*0x5cb,_0x301c61=_0x38a9a9['length'];_0xe35f92<_0x301c61;_0xe35f92++){_0x278923+='%'+('00'+_0x38a9a9['charCodeAt'](_0xe35f92)['toString'](-0x261b+0x8b*-0x1+0x26b6))['slice'](-(-0x3*0x742+0xa48+-0x5c0*-0x2));}return decodeURIComponent(_0x278923);};_0x321c['fDiwQN']=_0x36bb50,_0x321c['QhqlSr']={},_0x321c['SWkLcI']=!![];}const _0x3e9a15=_0x5d5fcb[-0x7c4+-0x145*0x1d+0x2c95];_0x321c['tWiNuh']!==_0x3e9a15&&(_0x321c['QhqlSr']={},_0x321c['tWiNuh']=_0x3e9a15);const _0x389782=_0x321c['QhqlSr'][_0x4fc07a];return _0x389782===undefined?(_0x4e7696=_0x321c['fDiwQN'](_0x4e7696),_0x321c['QhqlSr'][_0x4fc07a]=_0x4e7696):_0x4e7696=_0x389782,_0x4e7696;}import{NodeUpgradeCoordinator,nodeUpgradeRequestPath}from'./service/node-upgrade-coordinator.js';const HEARTBEAT_MS=0x106c*0x5+-0x2bd8+0x1454,CAPABILITY_REFRESH_MS=0x7509*0x1+0x13b70+-0xc619,RETRY_MIN_MS=-0x1*-0x331+0x1*0x158b+0xd8*-0x1b,RETRY_MAX_MS=-0x14e6*0x2+0x1*-0x7d46+-0x2fe*-0x5f,CLAUDE_APPROVAL_TIMEOUT_MS=(0x2*-0x1de+0xe9*-0x20+-0x1*-0x20e6)*(0x33e*-0x5c+0x112b+0x2037d);export function nextReconnectDelay(_0x400098){const _0x143e54=_0x321c;return Math[_0x143e54(0x1d3)](RETRY_MAX_MS,RETRY_MIN_MS*(-0x3*0x1+-0x3*-0x4a3+-0xde4)**Math[_0x143e54(0x1d3)](Math[_0x143e54(0x20c)](_0x400098,-0xdae+-0x4a8*-0x1+0x906),-0x250a+-0x13*-0x1a5+0x1*0x5db));}function upgradeMetadata(_0x102bb0,_0x15ac46){const _0x109a1d=_0x321c,_0x46aedb={..._0x102bb0??{}};if(process.env['MAR_NODE_SUPERVISED']==='1')_0x46aedb[_0x109a1d(0x16f)]=!![];else delete _0x46aedb[_0x109a1d(0x16f)];if(_0x15ac46[_0x109a1d(0x22f)]===_0x109a1d(0x22d))delete _0x46aedb[_0x109a1d(0x19c)];else _0x46aedb[_0x109a1d(0x19c)]=_0x15ac46;return _0x46aedb;}export class NodeConnector{[_0x47894e(0x24d)]=crypto[_0x47894e(0x1cf)]()[_0x47894e(0x205)](/-/g,'');[_0x47894e(0x22a)];[_0x47894e(0x16d)];[_0x47894e(0x1b3)];[_0x47894e(0x194)];set[_0x47894e(0x21a)](_0x298065){const _0x6e7fff=_0x47894e;this[_0x6e7fff(0x22a)][_0x6e7fff(0x23e)](_0x298065);}[_0x47894e(0x247)]=![];[_0x47894e(0x1ae)];[_0x47894e(0x209)];[_0x47894e(0x1cb)];[_0x47894e(0x19e)];[_0x47894e(0x1c4)];[_0x47894e(0x23c)];[_0x47894e(0x1d1)];[_0x47894e(0x173)]=new WorkbenchEventService(envelope=>this[_0x47894e(0x1cc)](envelope),(category,payload)=>{const _0x37e3ce=_0x47894e,sessionId=workbenchPayloadSessionId(this[_0x37e3ce(0x1a5)],category,payload);return sessionId===undefined||!this[_0x37e3ce(0x154)][_0x37e3ce(0x15f)][_0x37e3ce(0x1b7)](sessionId);});[_0x47894e(0x248)];[_0x47894e(0x223)];[_0x47894e(0x1e9)]=new RunDomainState();[_0x47894e(0x179)];[_0x47894e(0x15e)];[_0x47894e(0x193)]=new SessionDomainState();[_0x47894e(0x154)];[_0x47894e(0x252)];[_0x47894e(0x232)];[_0x47894e(0x145)];[_0x47894e(0x219)];[_0x47894e(0x22e)];[_0x47894e(0x187)];[_0x47894e(0x140)];[_0x47894e(0x15d)];[_0x47894e(0x1df)];[_0x47894e(0x249)];[_0x47894e(0x1c8)];[_0x47894e(0x14e)];[_0x47894e(0x1f4)];[_0x47894e(0x208)];[_0x47894e(0x1a6)];[_0x47894e(0x246)];[_0x47894e(0x1ec)];[_0x47894e(0x1cd)];[_0x47894e(0x224)];[_0x47894e(0x23a)];[_0x47894e(0x1f6)];[_0x47894e(0x242)];[_0x47894e(0x16b)];[_0x47894e(0x1c7)];[_0x47894e(0x22b)];[_0x47894e(0x239)]=new NodeOperationRouter();[_0x47894e(0x1e6)];[_0x47894e(0x13d)];[_0x47894e(0x1b5)];[_0x47894e(0x153)];[_0x47894e(0x1fb)]=new CommandStateStore();[_0x47894e(0x190)];[_0x47894e(0x19b)];[_0x47894e(0x1b6)];[_0x47894e(0x19f)]=new WorkspaceDomainState();[_0x47894e(0x1e7)]=new WorkspaceWatchService(this[_0x47894e(0x19f)],workspaceId=>this[_0x47894e(0x148)][_0x47894e(0x18e)](workspaceId),workspaceId=>this[_0x47894e(0x148)][_0x47894e(0x174)](workspaceId));[_0x47894e(0x148)]=new WorkspaceSessionService(this[_0x47894e(0x19f)],{'discover':workspaceId=>this[_0x47894e(0x216)](workspaceId),'listPage':workspaceId=>this[_0x47894e(0x20a)](_0x47894e(0x166),{'workspaceId':workspaceId,'limit':0x14}),'active':workspaceId=>this[_0x47894e(0x1e7)][_0x47894e(0x241)](workspaceId,_0x47894e(0x258)),'emitRevision':workspaceId=>void this[_0x47894e(0x196)]?.[_0x47894e(0x1d4)](workspaceId,_0x47894e(0x258)),'onPending':(workspaceId,waitMs)=>nodeLog(_0x47894e(0x21d),{'nodeId':this[_0x47894e(0x1ae)]?.[_0x47894e(0x23f)],'workspaceId':workspaceId,'waitMs':waitMs})});[_0x47894e(0x198)]=new WorkspaceFileService(this[_0x47894e(0x19f)],()=>this[_0x47894e(0x1ae)]?.[_0x47894e(0x1da)]??[],workspaceId=>this[_0x47894e(0x15e)][_0x47894e(0x14b)](workspaceId));[_0x47894e(0x16e)]=new WorkspaceUploadService(this[_0x47894e(0x19f)],workspaceId=>this[_0x47894e(0x15e)][_0x47894e(0x14b)](workspaceId));[_0x47894e(0x20b)]=new WorkspaceChangeService(this[_0x47894e(0x19f)]);[_0x47894e(0x196)];[_0x47894e(0x21b)];[_0x47894e(0x176)]=new RecentRunProjectionService(message=>this[_0x47894e(0x1c0)](_0x47894e(0x1e1),message));[_0x47894e(0x1a5)]=new NodeRuntimeState(()=>this[_0x47894e(0x1ae)]?.[_0x47894e(0x23f)]??_0x47894e(0x1c2),workspaceId=>this[_0x47894e(0x21b)]?.[_0x47894e(0x1f0)](workspaceId),Date[_0x47894e(0x1be)],(run,session,userMessage)=>this[_0x47894e(0x176)][_0x47894e(0x1ff)](run,session,userMessage));[_0x47894e(0x20e)]=new NodeMetrics();[_0x47894e(0x1b1)]=new RunEventService({'runtime':this[_0x47894e(0x1a5)],'metrics':this[_0x47894e(0x20e)],'state':this[_0x47894e(0x1e9)],'isBootstrapSession':sessionId=>this[_0x47894e(0x154)][_0x47894e(0x15f)][_0x47894e(0x1b7)](sessionId),'presentSession':session=>this[_0x47894e(0x140)][_0x47894e(0x16a)](session),'rejectBootstrap':(sessionId,code)=>this[_0x47894e(0x154)][_0x47894e(0x1ee)](sessionId,code),'emitWorkbench':(category,payload)=>{const _0x50a8b2=_0x47894e;if(category===_0x50a8b2(0x23d)&&isPlainRecord(payload)&&_0x50a8b2(0x188)in payload)this[_0x50a8b2(0x141)](payload[_0x50a8b2(0x188)]);else this[_0x50a8b2(0x21f)](category,payload);},'cleanupAttachments':runId=>this[_0x47894e(0x1f4)][_0x47894e(0x157)](runId),'expireImages':runId=>this[_0x47894e(0x1f4)][_0x47894e(0x228)](runId),'scheduleContextRefresh':sessionId=>this[_0x47894e(0x242)][_0x47894e(0x17c)](sessionId),'pauseQueue':sessionId=>this[_0x47894e(0x22b)][_0x47894e(0x233)](sessionId),'dispatchQueue':async sessionId=>{const _0x499386=_0x47894e;if(!this[_0x499386(0x1b6)][_0x499386(0x13e)]())await this[_0x499386(0x22b)][_0x499386(0x251)](sessionId);},'removeQueuedStart':runId=>this[_0x47894e(0x22b)][_0x47894e(0x1f1)](runId)});[_0x47894e(0x1a3)]=new NativeSessionWatchService({'resolve':async sessionId=>this[_0x47894e(0x1a5)][_0x47894e(0x1d0)](sessionId)??this[_0x47894e(0x252)][_0x47894e(0x1ba)](sessionId),'managedActive':session=>hasManagedActiveRun(this[_0x47894e(0x1a5)],session),'suspended':sessionId=>this[_0x47894e(0x1df)][_0x47894e(0x170)](sessionId),'refreshActivity':session=>this[_0x47894e(0x232)][_0x47894e(0x19a)](session),'present':session=>this[_0x47894e(0x140)][_0x47894e(0x16a)](session),'readPage':(session,limit)=>this[_0x47894e(0x232)][_0x47894e(0x172)](session,{'limit':limit}),'convergePage':convergeConversationWatchPage,'projectInitialPage':(session,page,_unit,limit)=>this[_0x47894e(0x145)][_0x47894e(0x13c)](session,page,limit),'emitSession':session=>this[_0x47894e(0x21f)](_0x47894e(0x1b4),{'session':session}),'emitPage':(session,page)=>this[_0x47894e(0x21f)](_0x47894e(0x23d),{'sessionId':session['id'],'snapshot':this[_0x47894e(0x145)][_0x47894e(0x13c)](session,page,-0x261b+0x8b*-0x1+0x26b0)}),'nodeId':()=>this[_0x47894e(0x1ae)]?.[_0x47894e(0x23f)]??_0x47894e(0x1c2),'nodeGeneration':()=>this[_0x47894e(0x24d)],'emitWatchEvent':payload=>this[_0x47894e(0x1c0)](_0x47894e(0x18b),payload),'log':nodeLog});constructor(_0x1bf5e8={}){const _0xa837d5=_0x47894e;this[_0xa837d5(0x1ae)]=_0x1bf5e8[_0xa837d5(0x1ae)],this[_0xa837d5(0x1c4)]=_0x1bf5e8[_0xa837d5(0x1c4)],this[_0xa837d5(0x1d1)]=_0x1bf5e8[_0xa837d5(0x1d1)]??CLAUDE_APPROVAL_TIMEOUT_MS,this[_0xa837d5(0x209)]=_0x1bf5e8[_0xa837d5(0x1cb)]!==undefined,this[_0xa837d5(0x1cb)]=_0x1bf5e8[_0xa837d5(0x1cb)]??unavailableCapabilities(),this[_0xa837d5(0x1b6)]=new NodeUpgradeCoordinator(()=>{const _0x4fbe3a=_0xa837d5;if(this[_0x4fbe3a(0x1ae)]===undefined)throw new Error(_0x4fbe3a(0x1ea));return nodeUpgradeRequestPath(nodeDatabasePath(this[_0x4fbe3a(0x1ae)],this[_0x4fbe3a(0x1c4)]));},()=>this[_0xa837d5(0x1e9)][_0xa837d5(0x254)][_0xa837d5(0x1dc)],_0x32ab26=>{const _0x163b8e=_0xa837d5;this[_0x163b8e(0x1cb)]={...this[_0x163b8e(0x1cb)],'metadata':upgradeMetadata(this[_0x163b8e(0x1cb)][_0x163b8e(0x146)],_0x32ab26)},this[_0x163b8e(0x22a)]?.[_0x163b8e(0x1c0)](_0x163b8e(0x1cb),this[_0x163b8e(0x1cb)]);},_0x1bf5e8[_0xa837d5(0x267)]??(()=>{const _0x2fc26c=_0xa837d5;this[_0x2fc26c(0x18a)](),setImmediate(()=>process[_0x2fc26c(0x144)](-0x3*0x742+0xa48+-0xbc9*-0x1));})),this[_0xa837d5(0x1cb)]={...this[_0xa837d5(0x1cb)],'metadata':upgradeMetadata(this[_0xa837d5(0x1cb)][_0xa837d5(0x146)],this[_0xa837d5(0x1b6)][_0xa837d5(0x268)]())};const _0x42cd87=_0x1bf5e8[_0xa837d5(0x19e)]??detectCapabilitiesAsync;this[_0xa837d5(0x19e)]=async()=>{const _0x17129e=_0xa837d5,_0xf245f9=await _0x42cd87();return{..._0xf245f9,'metadata':upgradeMetadata(_0xf245f9[_0x17129e(0x146)],this[_0x17129e(0x1b6)][_0x17129e(0x268)]())};},this[_0xa837d5(0x23c)]=_0x1bf5e8[_0xa837d5(0x23c)]??!![],this[_0xa837d5(0x248)]=_0x1bf5e8[_0xa837d5(0x248)]===undefined?undefined:new FakeTestRunner(_0x1bf5e8[_0xa837d5(0x248)]),this[_0xa837d5(0x223)]=_0x1bf5e8[_0xa837d5(0x223)],this[_0xa837d5(0x1f4)]=new RunAttachmentService(_0x4e6ecc=>this[_0xa837d5(0x1f6)][_0xa837d5(0x175)](_0x4e6ecc[_0xa837d5(0x17b)])[_0xa837d5(0x266)](_0x4e6ecc)),this[_0xa837d5(0x1a6)]=new CodexRunner(_0x1bf5e8[_0xa837d5(0x1a6)],_0x1bf5e8[_0xa837d5(0x21e)]),this[_0xa837d5(0x246)]=new CodexManagedRunController(this[_0xa837d5(0x1a6)],{'available':()=>this[_0xa837d5(0x1cb)][_0xa837d5(0x1d7)][_0xa837d5(0x1bf)],'intercepted':()=>this[_0xa837d5(0x248)]!==undefined,'active':this[_0xa837d5(0x1e9)][_0xa837d5(0x254)],'addActive':_0x1e4aa7=>this[_0xa837d5(0x1e9)][_0xa837d5(0x254)][_0xa837d5(0x1f8)](_0x1e4aa7),'removeActive':_0x1a1ec7=>this[_0xa837d5(0x1e9)][_0xa837d5(0x254)][_0xa837d5(0x25f)](_0x1a1ec7),'adopt':_0x4fa15a=>this[_0xa837d5(0x1a5)][_0xa837d5(0x25a)](_0x4fa15a),'session':_0x6f5931=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1d0)](_0x6f5931),'runStatus':_0x491736=>this[_0xa837d5(0x1a5)][_0xa837d5(0x162)](_0x491736)?.[_0xa837d5(0x229)],'run':_0x6159a3=>this[_0xa837d5(0x1a5)][_0xa837d5(0x162)](_0x6159a3),'interrupted':_0x533443=>this[_0xa837d5(0x1e9)][_0xa837d5(0x169)][_0xa837d5(0x1b7)](_0x533443),'parseAttachments':parseRunnerImageAttachments,'materialize':(_0xfb622b,_0x2f8389)=>this[_0xa837d5(0x1f4)][_0xa837d5(0x26a)](_0xfb622b,_0x2f8389),'completeCancelled':_0x4e5be3=>this[_0xa837d5(0x219)][_0xa837d5(0x204)](_0x4e5be3),'promoteSession':(_0x53fbe0,_0x3a8561)=>this[_0xa837d5(0x154)][_0xa837d5(0x168)](_0x53fbe0,_0x3a8561),'send':(_0x36ba35,_0xfc798a)=>this[_0xa837d5(0x1c0)](_0x36ba35,_0xfc798a),'emit':(_0x496a01,_0x3e5ef2,_0x646de6,_0x7ca803)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x496a01,_0x3e5ef2,_0x646de6,_0x7ca803),'cancel':(_0xf2bf9e,_0x4ebf9e,_0x31246a,_0x1c79a7,_0xaf07ba)=>this[_0xa837d5(0x219)][_0xa837d5(0x262)](_0xf2bf9e,_0x4ebf9e,_0x31246a,_0x1c79a7,_0xaf07ba),'createApproval':_0x19e7c8=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1bc)](_0x19e7c8),'publishApproval':_0xa51149=>this[_0xa837d5(0x179)][_0xa837d5(0x1c6)](_0xa51149),'emitItem':(_0x22a13b,_0x1185d9)=>this[_0xa837d5(0x1eb)](_0x22a13b,_0x1185d9),'appendImages':(_0x49fba7,_0x42e1f7)=>this[_0xa837d5(0x1f4)][_0xa837d5(0x257)](_0x49fba7,_0x42e1f7[_0xa837d5(0x191)](isRunnerImageAttachment)),'syncTitle':(_0x502f09,_0x5a1281,_0x17a7e7)=>this[_0xa837d5(0x187)][_0xa837d5(0x1f2)](_0x502f09,_0x5a1281,_0x17a7e7),'commandState':(_0x68b24f,_0x27c9ee)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x207)](_0x68b24f,_0x27c9ee),'setCommandState':(_0x4efc1e,_0x3894d4)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1c9)](_0x4efc1e,_0x3894d4),'clearCommandState':(_0x34415f,_0x19ccde)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1fd)](_0x34415f,_0x19ccde),'commandStates':_0x10bfa0=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1a4)](_0x10bfa0),'hasActiveSessionLease':_0x530fe5=>this[_0xa837d5(0x1a5)][_0xa837d5(0x24a)](_0x530fe5),'fast':_0x5c2a20=>this[_0xa837d5(0x20a)](_0xa837d5(0x213),{'runner':_0xa837d5(0x1d7),'commandId':_0xa837d5(0x143),'input':_0x5c2a20})}),this[_0xa837d5(0x1a6)][_0xa837d5(0x1a1)](_0xd7df7e=>this[_0xa837d5(0x246)][_0xa837d5(0x15a)](_0xd7df7e)),this[_0xa837d5(0x1ec)]=new ClaudeCodeRunner(_0x1bf5e8[_0xa837d5(0x1ec)]),this[_0xa837d5(0x1cd)]=new OpenCodeRunner(_0x1bf5e8[_0xa837d5(0x1cd)]),this[_0xa837d5(0x224)]=new OpenCodeManagedRunController(this[_0xa837d5(0x1cd)],{'intercepted':()=>this[_0xa837d5(0x248)]!==undefined,'active':this[_0xa837d5(0x1e9)][_0xa837d5(0x254)],'parseAttachments':parseRunnerImageAttachments,'persistAttachments':(_0x3dc2a5,_0xf37611,_0x4270e3)=>this[_0xa837d5(0x1f4)][_0xa837d5(0x1a0)](_0x3dc2a5,_0xf37611+_0xa837d5(0x197),_0x4270e3),'emit':(_0x228bef,_0x5b89fb,_0x3e7f30,_0x4a9aea)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x228bef,_0x5b89fb,_0x3e7f30,_0x4a9aea),'emitItem':(_0x603bfd,_0x18cd26)=>this[_0xa837d5(0x1eb)](_0x603bfd,_0x18cd26),'adopt':_0x28c932=>this[_0xa837d5(0x1a5)][_0xa837d5(0x25a)](_0x28c932),'run':_0x50dba9=>{const _0x1e2705=_0xa837d5,_0x24dbde=this[_0x1e2705(0x1a5)][_0x1e2705(0x162)](_0x50dba9);if(_0x24dbde===undefined)throw new Error(_0x1e2705(0x263));return _0x24dbde;},'hasActiveSessionLease':_0x3fdf85=>this[_0xa837d5(0x1a5)][_0xa837d5(0x24a)](_0x3fdf85),'promote':(_0x1b40b1,_0x4bd640)=>this[_0xa837d5(0x154)][_0xa837d5(0x168)](_0x1b40b1,_0x4bd640),'rememberNative':(_0x3ac858,_0x2b616f)=>this[_0xa837d5(0x187)][_0xa837d5(0x1ab)](_0x3ac858,_0x2b616f),'send':(_0x3bf583,_0x3576bd)=>this[_0xa837d5(0x1c0)](_0x3bf583,_0x3576bd),'createApproval':_0x40f580=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1bc)](_0x40f580),'expireApproval':_0x59ebf5=>{const _0x218cd2=_0xa837d5;this[_0x218cd2(0x1a5)][_0x218cd2(0x1c5)](_0x59ebf5);},'publishApproval':_0x121a73=>this[_0xa837d5(0x179)][_0xa837d5(0x1c6)](_0x121a73),'commandState':(_0x3b4567,_0x4e7ae5)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x207)](_0x3b4567,_0x4e7ae5),'setCommandState':(_0x436855,_0x3fa3a3)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1c9)](_0x436855,_0x3fa3a3),'clearCommandState':(_0x34df9a,_0x494102)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1fd)](_0x34df9a,_0x494102),'commandStates':_0x2be9d8=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1a4)](_0x2be9d8)},this[_0xa837d5(0x1d1)]),this[_0xa837d5(0x23a)]=new ClaudeManagedRunController(this[_0xa837d5(0x1ec)],{'intercepted':()=>this[_0xa837d5(0x248)]!==undefined,'active':this[_0xa837d5(0x1e9)][_0xa837d5(0x254)],'parseAttachments':parseRunnerImageAttachments,'emit':(_0xb49edf,_0xc992ee,_0x592940,_0x77afed)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0xb49edf,_0xc992ee,_0x592940,_0x77afed),'adopt':_0x5eacc6=>this[_0xa837d5(0x1a5)][_0xa837d5(0x25a)](_0x5eacc6),'run':_0x5e1407=>this[_0xa837d5(0x1a5)][_0xa837d5(0x162)](_0x5e1407),'hasActiveSessionLease':_0x590344=>this[_0xa837d5(0x1a5)][_0xa837d5(0x24a)](_0x590344),'session':_0x35ec5e=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1d0)](_0x35ec5e),'completeCancelled':_0x4d18a5=>this[_0xa837d5(0x219)][_0xa837d5(0x204)](_0x4d18a5),'requestUserInput':(_0xfdd95,_0x244759,_0x53f0c6)=>this[_0xa837d5(0x219)][_0xa837d5(0x1c1)](_0xfdd95,_0x244759,_0x53f0c6),'requestApproval':(_0x57e5e1,_0x2e0616,_0x19a7a4)=>this[_0xa837d5(0x219)][_0xa837d5(0x15c)](_0x57e5e1,_0x2e0616,_0x19a7a4),'rememberNative':(_0x43426d,_0x3e074d)=>this[_0xa837d5(0x187)][_0xa837d5(0x1ab)](_0x43426d,_0x3e074d),'promote':(_0x254427,_0x5a41db)=>this[_0xa837d5(0x154)][_0xa837d5(0x168)](_0x254427,_0x5a41db),'send':(_0xccf406,_0x5b1ae5)=>this[_0xa837d5(0x1c0)](_0xccf406,_0x5b1ae5),'emitItem':(_0x50d142,_0x53d48b)=>this[_0xa837d5(0x1eb)](_0x50d142,_0x53d48b),'syncTitle':(_0x4f4539,_0x57bb4a,_0xb28a57)=>this[_0xa837d5(0x187)][_0xa837d5(0x1f2)](_0x4f4539,_0x57bb4a,_0xb28a57),'setChannelToken':(_0x7e1c19,_0x2e38ce)=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1d2)](_0x7e1c19,_0x2e38ce),'commandState':(_0xffa06d,_0x36bf3e)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x207)](_0xffa06d,_0x36bf3e),'setCommandState':(_0x3a6966,_0x8ae29a)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1c9)](_0x3a6966,_0x8ae29a),'clearCommandState':(_0x5d1029,_0x14a05b)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1fd)](_0x5d1029,_0x14a05b),'commandStates':_0x14683e=>this[_0xa837d5(0x1fb)][_0xa837d5(0x1a4)](_0x14683e)}),this[_0xa837d5(0x1f6)]=new RunnerRegistry([this[_0xa837d5(0x1cd)],this[_0xa837d5(0x1a6)],this[_0xa837d5(0x1ec)],...this[_0xa837d5(0x248)]===undefined?[]:[this[_0xa837d5(0x248)]]]),this[_0xa837d5(0x187)]=new ManagedRunnerSessionService(this[_0xa837d5(0x1a5)],this[_0xa837d5(0x1f6)],_0x47a0d8=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),{'session':this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x47a0d8)})),this[_0xa837d5(0x219)]=new RunnerInteractionService({'runtime':this[_0xa837d5(0x1a5)],'state':this[_0xa837d5(0x1e9)],'codex':()=>this[_0xa837d5(0x1a6)],'claude':()=>this[_0xa837d5(0x1ec)],'runners':this[_0xa837d5(0x1f6)],'emitRun':(_0x1b8bdb,_0x24b79d,_0x3922c9,_0x300863)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x1b8bdb,_0x24b79d,_0x3922c9,_0x300863),'emitItem':(_0x53ca7d,_0x1773e1)=>this[_0xa837d5(0x1eb)](_0x53ca7d,_0x1773e1),'approvalTimeoutMs':this[_0xa837d5(0x1d1)],'publishApproval':_0x217748=>this[_0xa837d5(0x179)][_0xa837d5(0x1c6)](_0x217748)}),this[_0xa837d5(0x22e)]=new RunnerChannelMessageService({'interactions':this[_0xa837d5(0x219)],'send':(_0x1bc88a,_0xac0f41,_0x529562)=>this[_0xa837d5(0x1c0)](_0x1bc88a,_0xac0f41,_0x529562)}),this[_0xa837d5(0x140)]=new SessionPresentationService({'database':()=>this[_0xa837d5(0x21b)],'runtime':this[_0xa837d5(0x1a5)],'commands':this[_0xa837d5(0x1fb)],'runners':this[_0xa837d5(0x1f6)],'capabilities':()=>this[_0xa837d5(0x1cb)],'hasManagedActiveRun':_0x1b7ccd=>hasManagedActiveRun(this[_0xa837d5(0x1a5)],_0x1b7ccd),'externalActivity':_0x20a661=>this[_0xa837d5(0x193)][_0xa837d5(0x13f)][_0xa837d5(0x207)](_0x20a661),'projectionForNative':_0x2ab1bf=>this[_0xa837d5(0x252)][_0xa837d5(0x1f3)](_0x2ab1bf)}),this[_0xa837d5(0x252)]=new NativeSessionProjectionService({'database':()=>this[_0xa837d5(0x21b)],'nodeId':()=>this[_0xa837d5(0x1ae)]?.[_0xa837d5(0x23f)]??_0xa837d5(0x269),'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'capabilities':()=>this[_0xa837d5(0x1cb)],'state':this[_0xa837d5(0x193)],'commands':this[_0xa837d5(0x1fb)],'present':_0x2c7edf=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x2c7edf)}),this[_0xa837d5(0x232)]=new ConversationHistoryService({'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'capabilities':()=>this[_0xa837d5(0x1cb)],'attachments':this[_0xa837d5(0x1f4)],'snapshotSequence':()=>this[_0xa837d5(0x173)][_0xa837d5(0x1fa)](),'hasManagedActiveRun':_0x415522=>hasManagedActiveRun(this[_0xa837d5(0x1a5)],_0x415522),'setExternalActivity':(_0x270ed4,_0x218545)=>this[_0xa837d5(0x193)][_0xa837d5(0x13f)][_0xa837d5(0x1c9)](_0x270ed4,_0x218545)}),this[_0xa837d5(0x145)]=new ConversationSegmentService((_0x586cb4,_0x1c8713)=>this[_0xa837d5(0x232)][_0xa837d5(0x172)](_0x586cb4,_0x1c8713)),this[_0xa837d5(0x242)]=new SessionContextService({'runners':this[_0xa837d5(0x1f6)],'session':_0x408a3f=>this[_0xa837d5(0x1a5)][_0xa837d5(0x1d0)](_0x408a3f),'stopped':()=>this[_0xa837d5(0x247)],'publish':_0x10cba7=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),_0x10cba7)}),this[_0xa837d5(0x16b)]=new RunWorkbenchService({'runtime':this[_0xa837d5(0x1a5)],'readImage':async(_0x793dec,_0x28be79)=>this[_0xa837d5(0x1f4)][_0xa837d5(0x172)](_0x793dec,_0x28be79)??await this[_0xa837d5(0x1f4)][_0xa837d5(0x182)](_0x793dec,_0x28be79),'respondUserInput':(_0x5f08d1,_0xf62ce0,_0x3e6df3)=>this[_0xa837d5(0x219)][_0xa837d5(0x1ad)](_0x5f08d1,_0xf62ce0,_0x3e6df3),'cancelQueued':_0x136537=>this[_0xa837d5(0x22b)][_0xa837d5(0x178)](_0x136537),'pauseQueue':_0x190c7a=>this[_0xa837d5(0x22b)][_0xa837d5(0x233)](_0x190c7a),'emitRun':(_0x22aae0,_0x8ef3de,_0x502a1f,_0x268e71)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x22aae0,_0x8ef3de,_0x502a1f,_0x268e71),'control':(_0x31b6ba,_0x44e251)=>this[_0xa837d5(0x16d)][_0xa837d5(0x237)](JSON[_0xa837d5(0x156)](createEnvelope(_0x31b6ba,_0x44e251))),'markInterrupted':_0x42abb5=>this[_0xa837d5(0x1e9)][_0xa837d5(0x169)][_0xa837d5(0x1f8)](_0x42abb5)}),this[_0xa837d5(0x1c7)]=new SessionQueryService({'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'resolve':_0x24655a=>this[_0xa837d5(0x252)][_0xa837d5(0x158)](_0x24655a),'present':_0x45ca4a=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x45ca4a),'history':(_0x1c8200,_0x4ce621)=>this[_0xa837d5(0x232)][_0xa837d5(0x172)](_0x1c8200,_0x4ce621),'segments':(_0xe06d28,_0x5a58bf)=>this[_0xa837d5(0x145)][_0xa837d5(0x172)](_0xe06d28,_0x5a58bf),'context':this[_0xa837d5(0x242)],'discover':(_0x2c7623,_0x3a948f)=>this[_0xa837d5(0x252)][_0xa837d5(0x215)](_0x2c7623,_0x3a948f),'workspaceIdForCwd':_0x241ed5=>this[_0xa837d5(0x21b)]?.[_0xa837d5(0x201)]()[_0xa837d5(0x1a9)](_0x56e46d=>_0x56e46d[_0xa837d5(0x1de)]===_0x241ed5)?.['id']}),this[_0xa837d5(0x22b)]=new WorkspaceQueueWorkbenchService({'runtime':this[_0xa837d5(0x1a5)],'emit':(_0x455860,_0x5616a6)=>this[_0xa837d5(0x179)][_0xa837d5(0x225)](_0x455860,_0x5616a6),'clearImages':_0x3c617b=>this[_0xa837d5(0x1f4)][_0xa837d5(0x1fd)](_0x3c617b),'cleanupAttachments':_0x39b854=>this[_0xa837d5(0x1f4)][_0xa837d5(0x157)](_0x39b854),'emitRun':(_0x3baddf,_0x2e868f,_0x1a1ed6,_0x4d6d8)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x3baddf,_0x2e868f,_0x1a1ed6,_0x4d6d8),'emitConversation':_0xc5aa51=>this[_0xa837d5(0x141)](_0xc5aa51),'control':(_0x8af780,_0x33ad1c)=>this[_0xa837d5(0x16d)][_0xa837d5(0x237)](JSON[_0xa837d5(0x156)](createEnvelope(_0x8af780,_0x33ad1c))),'stopped':()=>this[_0xa837d5(0x247)],'markInterrupted':_0x13d577=>this[_0xa837d5(0x1e9)][_0xa837d5(0x169)][_0xa837d5(0x1f8)](_0x13d577),'prepareInput':(_0x3e3db0,_0x39eca9,_0x5229b3)=>this[_0xa837d5(0x1f6)][_0xa837d5(0x175)](_0x3e3db0)[_0xa837d5(0x231)](_0x39eca9,_0x5229b3),'mcps':_0x3b780f=>this[_0xa837d5(0x21b)]?.[_0xa837d5(0x17d)](_0x3b780f)??[]}),this[_0xa837d5(0x154)]=new SessionIdentityService({'runtime':this[_0xa837d5(0x1a5)],'persist':(_0x6407c,_0x992f80)=>{const _0x134959=_0xa837d5;if(_0x6407c[_0x134959(0x1ed)]===null||_0x6407c[_0x134959(0x230)]===null||_0x6407c[_0x134959(0x243)]===null)return;this[_0x134959(0x21b)]?.[_0x134959(0x185)]({'runner':_0x6407c[_0x134959(0x17b)],'externalSessionId':_0x992f80,'workspaceId':_0x6407c[_0x134959(0x253)],'model':_0x6407c[_0x134959(0x1ed)],'effort':_0x6407c[_0x134959(0x230)],'access':_0x6407c[_0x134959(0x243)]});},'migrateCommands':(_0x4ac2da,_0x3dab59)=>this[_0xa837d5(0x1fb)][_0xa837d5(0x159)](_0x4ac2da,_0x3dab59),'migrateQueue':(_0x11d2ea,_0x3df40f)=>this[_0xa837d5(0x22b)][_0xa837d5(0x20f)](_0x11d2ea,_0x3df40f),'migrateRunnerState':(_0x306813,_0x1a05ce)=>this[_0xa837d5(0x179)][_0xa837d5(0x210)](_0x306813,_0x1a05ce),'emitSession':_0xc800b1=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),{'session':_0xc800b1}),'emitRun':_0x47a492=>this[_0xa837d5(0x21f)](_0xa837d5(0x1dd),{'run':_0x47a492}),'emitQueue':_0x2c769a=>this[_0xa837d5(0x22b)][_0xa837d5(0x1d8)](_0x2c769a),'emitTurn':_0x482e6f=>this[_0xa837d5(0x141)](_0x482e6f)}),this[_0xa837d5(0x15d)]=new SessionLifecycleService({'database':()=>{const _0x4e0341=_0xa837d5;if(this[_0x4e0341(0x21b)]===undefined)throw new Error(_0x4e0341(0x163));return this[_0x4e0341(0x21b)];},'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'projection':this[_0xa837d5(0x252)],'identity':this[_0xa837d5(0x154)],'present':_0xa41a84=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0xa41a84),'emitSession':_0x3f5f6d=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),{'session':this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x3f5f6d)}),'execute':(_0x58d75e,_0x220ac9)=>this[_0xa837d5(0x20a)](_0x58d75e,_0x220ac9),'interceptedSessionId':_0x37e208=>this[_0xa837d5(0x248)]===undefined?undefined:_0xa837d5(0x25e)+_0x37e208}),this[_0xa837d5(0x1df)]=new ExternalSessionResumeService({'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'state':this[_0xa837d5(0x193)],'available':_0x15d453=>this[_0xa837d5(0x1f6)][_0xa837d5(0x175)](_0x15d453)[_0xa837d5(0x1bf)](this[_0xa837d5(0x1cb)]),'projectionFor':_0x57978d=>this[_0xa837d5(0x252)][_0xa837d5(0x1f3)](_0x57978d),'managedAliasFor':_0x230cc5=>this[_0xa837d5(0x252)][_0xa837d5(0x25b)](_0x230cc5),'ensureConfiguration':_0x5cf0d4=>this[_0xa837d5(0x252)][_0xa837d5(0x18d)](_0x5cf0d4),'configuration':_0x1e3341=>this[_0xa837d5(0x252)][_0xa837d5(0x183)](_0x1e3341),'workspacePath':_0x1076ab=>this[_0xa837d5(0x21b)]?.[_0xa837d5(0x1f0)](_0x1076ab)?.[_0xa837d5(0x1de)],'rememberNative':(_0x16d6c6,_0x2e4c5f)=>this[_0xa837d5(0x187)][_0xa837d5(0x1ab)](_0x16d6c6,_0x2e4c5f),'resolve':_0x349eaf=>this[_0xa837d5(0x252)][_0xa837d5(0x158)](_0x349eaf)}),this[_0xa837d5(0x14e)]=new SessionCommandService({'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'projection':this[_0xa837d5(0x252)],'resume':this[_0xa837d5(0x1df)],'profiles':()=>this[_0xa837d5(0x1e6)][_0xa837d5(0x171)](),'present':_0x241856=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x241856),'resumeQueueAfterCommandRun':_0x1fcfd1=>this[_0xa837d5(0x22b)][_0xa837d5(0x1b8)](_0x1fcfd1)}),this[_0xa837d5(0x249)]=new SessionMessageService({'runtime':this[_0xa837d5(0x1a5)],'uploads':this[_0xa837d5(0x16e)],'attachments':this[_0xa837d5(0x1f4)],'commands':this[_0xa837d5(0x1fb)],'queue':this[_0xa837d5(0x22b)],'interaction':this[_0xa837d5(0x219)],'runners':this[_0xa837d5(0x1f6)],'resolve':_0x10c4d9=>this[_0xa837d5(0x1df)][_0xa837d5(0x180)](_0x10c4d9),'present':_0x18359f=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x18359f),'emitSession':_0x52c0c1=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),{'session':this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x52c0c1)}),'channelToken':_0x506c15=>{const _0x4ac632=_0xa837d5,_0x110724=this[_0x4ac632(0x1a5)][_0x4ac632(0x1d0)](_0x506c15);return _0x110724===undefined?undefined:this[_0x4ac632(0x1f6)][_0x4ac632(0x175)](_0x110724[_0x4ac632(0x17b)])[_0x4ac632(0x212)](_0x506c15);}}),this[_0xa837d5(0x1c8)]=new SessionCatalogService({'database':()=>{const _0x1ef67c=_0xa837d5;if(this[_0x1ef67c(0x21b)]===undefined)throw new Error(_0x1ef67c(0x163));return this[_0x1ef67c(0x21b)];},'nodeId':()=>this[_0xa837d5(0x1ae)]?.[_0xa837d5(0x23f)]??_0xa837d5(0x269),'runtime':this[_0xa837d5(0x1a5)],'runners':this[_0xa837d5(0x1f6)],'projection':this[_0xa837d5(0x252)],'resume':this[_0xa837d5(0x1df)],'cachedNative':()=>[...this[_0xa837d5(0x193)][_0xa837d5(0x165)][_0xa837d5(0x14c)]()],'cachedWorkspace':_0x12b9b8=>this[_0xa837d5(0x15e)][_0xa837d5(0x184)](_0x12b9b8),'present':_0x2554e0=>this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x2554e0),'projectionForNative':_0x329012=>this[_0xa837d5(0x252)][_0xa837d5(0x1f3)](_0x329012),'nativeIds':_0x2393da=>this[_0xa837d5(0x252)][_0xa837d5(0x1e0)](_0x2393da),'forget':(_0x36ace9,_0x58ba5f)=>this[_0xa837d5(0x252)][_0xa837d5(0x147)](_0x36ace9,_0x58ba5f),'refreshActivity':_0x5d3a4c=>this[_0xa837d5(0x232)][_0xa837d5(0x19a)](_0x5d3a4c),'externalActivity':_0x1d779a=>this[_0xa837d5(0x193)][_0xa837d5(0x13f)][_0xa837d5(0x207)](_0x1d779a),'history':(_0x3e4b7d,_0x5f2215)=>this[_0xa837d5(0x232)][_0xa837d5(0x172)](_0x3e4b7d,_0x5f2215),'emitSession':_0x1d0557=>this[_0xa837d5(0x21f)](_0xa837d5(0x1b4),{'session':this[_0xa837d5(0x140)][_0xa837d5(0x16a)](_0x1d0557)})}),this[_0xa837d5(0x1a6)][_0xa837d5(0x235)]({'start':_0x3312b6=>this[_0xa837d5(0x246)][_0xa837d5(0x236)](_0x3312b6),'cancel':(_0x12959d,_0x40a01c)=>{const _0x3daed0=_0xa837d5,_0x58220b=this[_0x3daed0(0x1a6)][_0x3daed0(0x152)][_0x3daed0(0x20d)][_0x3daed0(0x207)](_0x12959d);if(_0x58220b?.[_0x3daed0(0x206)]===undefined)return![];return void this[_0x3daed0(0x219)][_0x3daed0(0x262)](_0x12959d,_0x58220b[_0x3daed0(0x1b9)],_0x58220b[_0x3daed0(0x206)],_0x58220b[_0x3daed0(0x1af)],_0x40a01c===_0x3daed0(0x150)?_0x3daed0(0x189):_0x3daed0(0x192)),!![];},'decideApproval':_0xc9f935=>this[_0xa837d5(0x219)][_0xa837d5(0x244)](_0xc9f935[_0xa837d5(0x261)],_0xc9f935[_0xa837d5(0x149)])}),this[_0xa837d5(0x1ec)][_0xa837d5(0x235)]({'start':_0x4c45b4=>this[_0xa837d5(0x23a)][_0xa837d5(0x236)](_0x4c45b4),'cancel':(_0x148039,_0x12955d)=>this[_0xa837d5(0x219)][_0xa837d5(0x260)](_0x148039,_0x12955d),'decideApproval':_0x1d273a=>this[_0xa837d5(0x219)][_0xa837d5(0x240)](_0x1d273a[_0xa837d5(0x261)],_0x1d273a[_0xa837d5(0x149)])}),this[_0xa837d5(0x1cd)][_0xa837d5(0x235)]({'start':_0x31dacf=>this[_0xa837d5(0x224)][_0xa837d5(0x236)](_0x31dacf),'cancel':(_0x3f4f02,_0x4decd9)=>this[_0xa837d5(0x224)][_0xa837d5(0x19d)](_0x3f4f02,_0x4decd9),'decideApproval':_0x257f09=>this[_0xa837d5(0x224)][_0xa837d5(0x1db)](_0x257f09),'respondUserInput':(_0x3ff9af,_0xa3a16f,_0x5e6254)=>this[_0xa837d5(0x224)][_0xa837d5(0x1ad)](_0x3ff9af,_0xa3a16f,_0x5e6254)}),this[_0xa837d5(0x1a6)][_0xa837d5(0x1f5)]({'execute':(_0x15db4d,_0xe7b4f9,_0x8f57b5,_0x2475e1)=>this[_0xa837d5(0x246)][_0xa837d5(0x256)](_0x15db4d,_0xe7b4f9,_0x8f57b5,_0x2475e1)}),this[_0xa837d5(0x1ec)][_0xa837d5(0x1f5)]({'execute':(_0x1352bc,_0x166189,_0x55be50,_0xa0bf69)=>this[_0xa837d5(0x23a)][_0xa837d5(0x256)](_0x1352bc,_0x166189,_0x55be50,_0xa0bf69)}),this[_0xa837d5(0x1cd)][_0xa837d5(0x1f5)]({'execute':(_0x59689b,_0x31b673,_0x5e74e4,_0x5bc976)=>this[_0xa837d5(0x224)][_0xa837d5(0x256)](_0x59689b,_0x31b673,_0x5bc976)});const _0x11a992=this[_0xa837d5(0x248)]===undefined||this[_0xa837d5(0x223)]===undefined?undefined:new FakeManagedRunService({'runner':this[_0xa837d5(0x248)],'script':this[_0xa837d5(0x223)],'runners':this[_0xa837d5(0x1f6)],'runtime':this[_0xa837d5(0x1a5)],'state':this[_0xa837d5(0x1e9)],'emitRun':(_0x2606ee,_0x465a91,_0x37a47b,_0x52c02c)=>this[_0xa837d5(0x179)][_0xa837d5(0x1d9)](_0x2606ee,_0x465a91,_0x37a47b,_0x52c02c),'publishApproval':_0x20e96f=>this[_0xa837d5(0x179)][_0xa837d5(0x1c6)](_0x20e96f),'disconnect':()=>this[_0xa837d5(0x22a)][_0xa837d5(0x167)](-0x7c4+-0x145*0x1d+0x3c3f,_0xa837d5(0x1a8))});this[_0xa837d5(0x248)]?.[_0xa837d5(0x235)]({'start':_0x5f43a9=>_0x11a992?.[_0xa837d5(0x236)](_0x5f43a9),'cancel':(_0x26dcc6,_0x4f3bbf)=>_0x4f3bbf===_0xa837d5(0x150)?this[_0xa837d5(0x248)]?.[_0xa837d5(0x19d)](_0x26dcc6)??![]:this[_0xa837d5(0x248)]?.[_0xa837d5(0x155)](_0x26dcc6)??![],'decideApproval':_0x2e3639=>this[_0xa837d5(0x248)]?.[_0xa837d5(0x1d6)](_0x2e3639[_0xa837d5(0x1f7)],_0x2e3639[_0xa837d5(0x261)],_0x2e3639[_0xa837d5(0x149)])??![]}),this[_0xa837d5(0x190)]=_0x1bf5e8[_0xa837d5(0x190)]??new RunnerUsageReader(),this[_0xa837d5(0x21b)]=_0x1bf5e8[_0xa837d5(0x21b)],this[_0xa837d5(0x19b)]=_0x1bf5e8[_0xa837d5(0x19b)]??new TerminalManager({'platform':this[_0xa837d5(0x1cb)][_0xa837d5(0x24c)]===_0xa837d5(0x211)?_0xa837d5(0x17f):_0xa837d5(0x22c)}),this[_0xa837d5(0x19b)][_0xa837d5(0x18f)](_0xc34c7e=>this[_0xa837d5(0x15e)][_0xa837d5(0x245)](_0xc34c7e)),this[_0xa837d5(0x208)]=new NodeTerminalChannel({'config':()=>this[_0xa837d5(0x1ae)],'controlConnected':()=>this[_0xa837d5(0x22a)][_0xa837d5(0x203)](),'stopped':()=>this[_0xa837d5(0x247)],'reconnect':this[_0xa837d5(0x23c)],'reconnectDelay':nextReconnectDelay,'manager':this[_0xa837d5(0x19b)]}),this[_0xa837d5(0x22a)]=new NodeControlChannel({'config':()=>this[_0xa837d5(0x1ae)],'capabilities':()=>this[_0xa837d5(0x1cb)],'stopped':()=>this[_0xa837d5(0x247)],'reconnect':this[_0xa837d5(0x23c)],'reconnectDelay':nextReconnectDelay,'onConnecting':_0xcae780=>{const _0x4d61c1=_0xa837d5;this[_0x4d61c1(0x20e)][_0x4d61c1(0x16c)](),nodeLog(_0x4d61c1(0x1ac),{'attempt':_0xcae780});},'onReconnectScheduled':()=>this[_0xa837d5(0x20e)][_0xa837d5(0x177)](),'onMessage':_0x288e30=>this[_0xa837d5(0x151)](_0x288e30),'onClose':(_0x579c3d,_0xe1dd2d)=>{const _0x42a8e1=_0xa837d5;this[_0x42a8e1(0x208)][_0x42a8e1(0x164)]();if(_0x579c3d===0x10d*0x19+0x1953+0x2*-0x11fc&&_0xe1dd2d===_0x42a8e1(0x1b2))nodeLog(_0x42a8e1(0x1e5),{'message':_0x42a8e1(0x24b)});if(_0x579c3d===-0x3*0xb87+0x326*-0x7+0x6*0xc0b||_0x579c3d===-0x1b6e+0x59+-0x1efe*-0x1)void this[_0x42a8e1(0x19b)][_0x42a8e1(0x1e2)]();}}),this[_0xa837d5(0x16d)]=new NodeControlMessageService({'config':()=>this[_0xa837d5(0x1ae)],'register':(_0x4c4652,_0x5d9f19)=>this[_0xa837d5(0x194)][_0xa837d5(0x1d5)](_0x4c4652,_0x5d9f19),'connected':()=>this[_0xa837d5(0x194)][_0xa837d5(0x203)](),'close':(_0x566a1b,_0x2fcf57)=>this[_0xa837d5(0x22a)][_0xa837d5(0x167)](_0x566a1b,_0x2fcf57),'inspectWorkspace':_0x27ef09=>this[_0xa837d5(0x15e)][_0xa837d5(0x1ce)](_0x27ef09),'handleNodeRequest':_0x3713cd=>this[_0xa837d5(0x1b3)][_0xa837d5(0x237)](_0x3713cd),'reconcileRuns':_0x1cd9d2=>this[_0xa837d5(0x179)][_0xa837d5(0x1ef)](_0x1cd9d2),'runners':this[_0xa837d5(0x1f6)],'deliverSessionChannelMessage':_0xe27c0c=>this[_0xa837d5(0x22e)][_0xa837d5(0x237)](_0xe27c0c),'completeUncontrolledCancellation':_0x2add3d=>{const _0x284a02=_0xa837d5,_0x35a516=this[_0x284a02(0x1a5)][_0x284a02(0x162)](_0x2add3d);if(_0x35a516?.[_0x284a02(0x229)]===_0x284a02(0x1a7))this[_0x284a02(0x219)][_0x284a02(0x204)](_0x2add3d);},'send':(_0xb39795,_0x5bf1bd,_0x184602)=>this[_0xa837d5(0x1c0)](_0xb39795,_0x5bf1bd,_0x184602)}),this[_0xa837d5(0x1b3)]=new NodeRequestService({'nodeId':()=>this[_0xa837d5(0x1ae)]?.[_0xa837d5(0x23f)],'databaseAvailable':()=>this[_0xa837d5(0x21b)]!==undefined,'execute':(_0x29e908,_0x20123e)=>this[_0xa837d5(0x20a)](_0x29e908,_0x20123e),'send':(_0x51eaec,_0x5e132d,_0x216f29)=>this[_0xa837d5(0x1c0)](_0x51eaec,_0x5e132d,_0x216f29)}),this[_0xa837d5(0x15e)]=new NodeWorkspaceCoordinator({'config':()=>this[_0xa837d5(0x1ae)],'database':()=>this[_0xa837d5(0x21b)],'watches':this[_0xa837d5(0x1e7)],'sessions':this[_0xa837d5(0x148)],'changes':this[_0xa837d5(0x20b)],'emit':(_0xbf87ec,_0x2b3e5c)=>void this[_0xa837d5(0x196)]?.[_0xa837d5(0x1d4)](_0xbf87ec,_0x2b3e5c),'send':(_0x2f10da,_0x330591,_0x5f4b8a)=>this[_0xa837d5(0x1c0)](_0x2f10da,_0x330591,_0x5f4b8a)}),this[_0xa837d5(0x179)]=new NodeRunEventBridge({'runtime':this[_0xa837d5(0x1a5)],'state':this[_0xa837d5(0x1e9)],'events':this[_0xa837d5(0x1b1)],'workbench':this[_0xa837d5(0x173)],'queues':this[_0xa837d5(0x22b)],'codex':this[_0xa837d5(0x1a6)],'claude':this[_0xa837d5(0x1ec)],'openCode':this[_0xa837d5(0x1cd)],'send':(_0x47f008,_0x4d5881,_0x4c0d96)=>this[_0xa837d5(0x1c0)](_0x47f008,_0x4d5881,_0x4c0d96)}),this[_0xa837d5(0x194)]=new NodeConnectionLifecycleService({'config':()=>this[_0xa837d5(0x1ae)],'setConfig':_0x3febaf=>this[_0xa837d5(0x1ae)]=_0x3febaf,'configPath':this[_0xa837d5(0x1c4)],'capabilities':()=>this[_0xa837d5(0x1cb)],'detectCapabilities':this[_0xa837d5(0x19e)],'capabilitiesProvided':this[_0xa837d5(0x209)],'stopped':()=>this[_0xa837d5(0x247)],'setCapabilities':_0x2064ea=>this[_0xa837d5(0x1cb)]={..._0x2064ea,'metadata':upgradeMetadata(_0x2064ea[_0xa837d5(0x146)],this[_0xa837d5(0x1b6)][_0xa837d5(0x268)]())},'control':this[_0xa837d5(0x22a)],'terminal':this[_0xa837d5(0x208)],'metrics':this[_0xa837d5(0x20e)],'heartbeatMs':HEARTBEAT_MS,'refreshMs':CAPABILITY_REFRESH_MS,'onConnected':()=>this[_0xa837d5(0x176)][_0xa837d5(0x14d)]()});const _0x363c95=()=>{const _0x43873c=_0xa837d5;if(this[_0x43873c(0x21b)]===undefined)throw new Error(_0x43873c(0x163));return this[_0x43873c(0x21b)];};this[_0xa837d5(0x1e6)]=new RunnerService(_0x363c95,()=>this[_0xa837d5(0x1cb)],this[_0xa837d5(0x1f6)],this[_0xa837d5(0x190)]),this[_0xa837d5(0x13d)]=new WorkbenchManifestService({'capabilities':()=>this[_0xa837d5(0x1cb)],'runners':this[_0xa837d5(0x1e6)],'terminals':this[_0xa837d5(0x19b)]}),this[_0xa837d5(0x1b5)]=new TerminalService(_0x363c95,this[_0xa837d5(0x19b)]),this[_0xa837d5(0x153)]=new WorkspaceService(_0x363c95,()=>{const _0x461d08=_0xa837d5;if(this[_0x461d08(0x1ae)]===undefined)throw new Error(_0x461d08(0x1ea));return this[_0x461d08(0x1ae)];},this[_0xa837d5(0x1a5)],_0x6d5ac1=>{const _0xfb046=_0xa837d5;this[_0xfb046(0x198)][_0xfb046(0x226)](_0x6d5ac1),this[_0xfb046(0x15e)][_0xfb046(0x1b0)](_0x6d5ac1),this[_0xfb046(0x148)][_0xfb046(0x14b)](_0x6d5ac1),this[_0xfb046(0x15e)][_0xfb046(0x238)](_0x6d5ac1);}),this[_0xa837d5(0x196)]=new WorkspaceWorkbenchService({'requireWorkspace':_0x30fa2d=>this[_0xa837d5(0x15e)][_0xa837d5(0x175)](_0x30fa2d),'watch':this[_0xa837d5(0x1e7)],'files':this[_0xa837d5(0x198)],'uploads':this[_0xa837d5(0x16e)],'changes':this[_0xa837d5(0x20b)],'listSessions':_0x3d7642=>this[_0xa837d5(0x20a)](_0xa837d5(0x166),{'workspaceId':_0x3d7642,'limit':0x14}),'invalidate':_0xd71d47=>this[_0xa837d5(0x15e)][_0xa837d5(0x14b)](_0xd71d47),'nodeId':()=>this[_0xa837d5(0x1ae)]?.[_0xa837d5(0x23f)]??_0xa837d5(0x1c2),'nodeGeneration':()=>this[_0xa837d5(0x24d)],'emitWatchEvent':_0x38ada8=>this[_0xa837d5(0x1c0)](_0xa837d5(0x18b),_0x38ada8)}),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x1e6)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x1b5)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x153)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x196)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x16b)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x1a3)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x1c7)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x15d)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x249)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x1c8)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x14e)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](this[_0xa837d5(0x22b)][_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](new SkillNodeOperationService(_0x363c95,()=>{const _0x2378f8=_0xa837d5;if(this[_0x2378f8(0x1ae)]===undefined)throw new Error(_0x2378f8(0x1ea));return this[_0x2378f8(0x1ae)];})[_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x217)](new McpNodeOperationService(_0x363c95)[_0xa837d5(0x13b)]()),this[_0xa837d5(0x239)][_0xa837d5(0x1d5)](_0xa837d5(0x221),()=>({'metrics':{...this[_0xa837d5(0x20e)][_0xa837d5(0x268)](),'activeRuns':this[_0xa837d5(0x1e9)][_0xa837d5(0x254)][_0xa837d5(0x1dc)],'workspaceLeases':this[_0xa837d5(0x1a5)][_0xa837d5(0x181)]()}})),this[_0xa837d5(0x239)][_0xa837d5(0x1d5)](_0xa837d5(0x250),_0x1dd29e=>this[_0xa837d5(0x1b6)][_0xa837d5(0x161)](_0x1dd29e)),this[_0xa837d5(0x239)][_0xa837d5(0x1d5)](_0xa837d5(0x14a),()=>this[_0xa837d5(0x1b6)][_0xa837d5(0x19d)]()),this[_0xa837d5(0x239)][_0xa837d5(0x1d5)](_0xa837d5(0x24e),async()=>({'manifest':await this[_0xa837d5(0x13d)][_0xa837d5(0x172)]()}));}async[_0x47894e(0x236)](){const _0x5927a2=_0x47894e;this[_0x5927a2(0x247)]=![],this[_0x5927a2(0x1ae)]??=await loadNodeConfig(this[_0x5927a2(0x1c4)]),await this[_0x5927a2(0x1b6)][_0x5927a2(0x1c3)](resolve(dirname(nodeDatabasePath(this[_0x5927a2(0x1ae)],this[_0x5927a2(0x1c4)])),_0x5927a2(0x142))),await assertLocalSqlitePath(nodeDatabasePath(this[_0x5927a2(0x1ae)],this[_0x5927a2(0x1c4)])),this[_0x5927a2(0x21b)]??=new NodeDatabase(nodeDatabasePath(this[_0x5927a2(0x1ae)],this[_0x5927a2(0x1c4)]),()=>this[_0x5927a2(0x1ae)]?.[_0x5927a2(0x23f)]??_0x5927a2(0x218)),this[_0x5927a2(0x21b)][_0x5927a2(0x1e3)](),this[_0x5927a2(0x194)][_0x5927a2(0x236)](),this[_0x5927a2(0x22a)][_0x5927a2(0x1fc)]();}[_0x47894e(0x18a)](){const _0x56972e=_0x47894e;this[_0x56972e(0x247)]=!![],this[_0x56972e(0x176)][_0x56972e(0x226)](),this[_0x56972e(0x1b6)][_0x56972e(0x18a)](),this[_0x56972e(0x194)][_0x56972e(0x18a)]();for(const _0x560ced of this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x234)][_0x56972e(0x14c)]()){clearTimeout(_0x560ced[_0x56972e(0x1f9)]),_0x560ced[_0x56972e(0x158)](_0x56972e(0x264));}this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x234)][_0x56972e(0x1fd)]();for(const _0x49392c of this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x15b)][_0x56972e(0x14c)]()){clearTimeout(_0x49392c[_0x56972e(0x1f9)]),_0x49392c[_0x56972e(0x1ee)](_0x56972e(0x17e));}this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x15b)][_0x56972e(0x1fd)](),this[_0x56972e(0x1a3)][_0x56972e(0x1fd)](),this[_0x56972e(0x154)][_0x56972e(0x226)](),this[_0x56972e(0x15d)][_0x56972e(0x1fd)](),this[_0x56972e(0x22b)][_0x56972e(0x1fd)](),this[_0x56972e(0x1b1)][_0x56972e(0x1fd)](),this[_0x56972e(0x242)][_0x56972e(0x226)]();for(const _0x3f15a0 of this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x20d)][_0x56972e(0x14c)]())_0x3f15a0[_0x56972e(0x237)][_0x56972e(0x19d)]();this[_0x56972e(0x1ec)][_0x56972e(0x152)][_0x56972e(0x20d)][_0x56972e(0x1fd)](),this[_0x56972e(0x1f4)][_0x56972e(0x226)](),void this[_0x56972e(0x16e)][_0x56972e(0x1e2)](),this[_0x56972e(0x198)][_0x56972e(0x226)](),this[_0x56972e(0x1e7)][_0x56972e(0x25d)](),this[_0x56972e(0x148)][_0x56972e(0x1fd)](),this[_0x56972e(0x20b)][_0x56972e(0x1fd)](),void this[_0x56972e(0x1f6)][_0x56972e(0x18a)](),void this[_0x56972e(0x19b)][_0x56972e(0x1e2)](),this[_0x56972e(0x208)][_0x56972e(0x18a)](),this[_0x56972e(0x22a)][_0x56972e(0x18a)](),this[_0x56972e(0x21b)]?.[_0x56972e(0x167)](),this[_0x56972e(0x21b)]=undefined;}[_0x47894e(0x151)]=_0x6bf54e=>this[_0x47894e(0x16d)][_0x47894e(0x237)](_0x6bf54e);[_0x47894e(0x1ca)]=(_0x53c46f,_0xdca6dc,_0x312f69,_0x491723)=>this[_0x47894e(0x179)][_0x47894e(0x1d9)](_0x53c46f,_0xdca6dc,_0x312f69,_0x491723);[_0x47894e(0x1eb)]=(_0x32fa27,_0x507d63)=>{const _0x17b585=_0x47894e;this[_0x17b585(0x1b1)][_0x17b585(0x220)](_0x32fa27);const _0x4d69da=isPlainRecord(_0x507d63)&&typeof _0x507d63[_0x17b585(0x227)]===_0x17b585(0x259)?_0x507d63[_0x17b585(0x227)]:undefined,_0x33692d=isPlainRecord(_0x507d63)&&typeof _0x507d63[_0x17b585(0x195)]===_0x17b585(0x259)?_0x507d63[_0x17b585(0x195)]:undefined,_0x3b152c=this[_0x17b585(0x1a5)][_0x17b585(0x200)](_0x32fa27),_0x277f9a=_0x4d69da===undefined||_0x3b152c===undefined?undefined:conversationSegmentIdentityForItem(_0x3b152c,_0x4d69da,_0x33692d);this[_0x17b585(0x179)][_0x17b585(0x1d9)](_0x32fa27,_0x17b585(0x1fe),_0x277f9a===undefined||!isPlainRecord(_0x507d63)?_0x507d63:{..._0x507d63,'segmentId':_0x277f9a['id'],'segmentIndex':_0x277f9a[_0x17b585(0x199)]});};[_0x47894e(0x141)]=_0x3a0d71=>{const _0x18bef7=_0x47894e,_0x32a27d=isPlainRecord(_0x3a0d71)&&Array[_0x18bef7(0x24f)](_0x3a0d71[_0x18bef7(0x21c)])?conversationSegments(_0x3a0d71):[];this[_0x18bef7(0x21f)](_0x18bef7(0x23d),{'turn':_0x3a0d71,'segments':_0x32a27d});};[_0x47894e(0x21f)]=(_0x293720,_0x493890)=>this[_0x47894e(0x179)][_0x47894e(0x25c)](_0x293720,_0x493890);[_0x47894e(0x216)]=_0x5c85ab=>this[_0x47894e(0x252)][_0x47894e(0x214)](_0x5c85ab);[_0x47894e(0x222)]=_0x9d5655=>this[_0x47894e(0x15e)][_0x47894e(0x14b)](_0x9d5655);[_0x47894e(0x1e4)]=()=>undefined;[_0x47894e(0x202)]=()=>this[_0x47894e(0x194)][_0x47894e(0x202)]();[_0x47894e(0x13a)]=()=>this[_0x47894e(0x194)][_0x47894e(0x13a)]();async[_0x47894e(0x20a)](_0x4ac624,_0x455572){const _0x12635f=_0x47894e;if(this[_0x12635f(0x21b)]===undefined)throw new Error(_0x12635f(0x163));if(this[_0x12635f(0x1b6)][_0x12635f(0x17a)](_0x4ac624))throw new Error(_0x12635f(0x1e8));return nodeLog(_0x12635f(0x1aa),{'nodeId':this[_0x12635f(0x1ae)]?.[_0x12635f(0x23f)],'operation':_0x4ac624}),this[_0x12635f(0x239)][_0x12635f(0x186)](_0x4ac624,_0x455572);}[_0x47894e(0x1c0)](_0x34cb96,_0x11a0c3,_0x1430c6){const _0x72d1e0=_0x47894e;this[_0x72d1e0(0x22a)][_0x72d1e0(0x1c0)](_0x34cb96,_0x11a0c3,_0x1430c6);}[_0x47894e(0x1cc)](_0x41d290){const _0x62f358=_0x47894e;this[_0x62f358(0x22a)][_0x62f358(0x1cc)](_0x41d290);}}
|