@myagentroam/node 0.9.9 → 0.9.10
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 _0x2c17e8=_0x3ada;(function(_0x32f092,_0x4e9335){const _0x27872b=_0x3ada,_0x1e4698=_0x32f092();while(!![]){try{const _0xc58e27=-parseInt(_0x27872b(0x161))/(-0xfa2+0x1f52+0xfaf*-0x1)+-parseInt(_0x27872b(0x12b))/(-0x23e2+0x6f0+0x1*0x1cf4)*(-parseInt(_0x27872b(0x147))/(0x37*-0x32+-0x3*-0xb11+-0x22*0xa9))+-parseInt(_0x27872b(0x162))/(-0xdd8*-0x1+0x15f1+0x1*-0x23c5)+-parseInt(_0x27872b(0x163))/(0x1b94+0x62a*-0x3+-0x911)*(-parseInt(_0x27872b(0xf6))/(-0x2431+0x2331+0x106))+parseInt(_0x27872b(0x17e))/(-0xfe5*-0x2+0xaa4+-0xd*0x343)+parseInt(_0x27872b(0xd7))/(-0x237d+0xfb5+0x4f4*0x4)*(-parseInt(_0x27872b(0x1ba))/(0x1e8c+-0x20f2+0x26f))+parseInt(_0x27872b(0x15f))/(0xebe+0x1daa+-0x162f*0x2)*(parseInt(_0x27872b(0x1d6))/(0xc5b*-0x3+-0x227f+-0x17*-0x31d));if(_0xc58e27===_0x4e9335)break;else _0x1e4698['push'](_0x1e4698['shift']());}catch(_0x424095){_0x1e4698['push'](_0x1e4698['shift']());}}}(_0x1ff5,-0x126120+-0x10beef+0x2e27c1));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';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';import{NodeUpgradeCoordinator,nodeUpgradeRequestPath}from'./service/node-upgrade-coordinator.js';function _0x3ada(_0x2481c8,_0x2115de){_0x2481c8=_0x2481c8-(0x24f4+0x1*0x211+-0x1319*0x2);const _0x168267=_0x1ff5();let _0xa5cdc3=_0x168267[_0x2481c8];if(_0x3ada['vrQwes']===undefined){var _0x2d3d04=function(_0x2508c6){const _0x3658a9='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x44060c='',_0x53ff9e='';for(let _0x21d579=-0x7c7*0x3+0x49*-0x77+0xb74*0x5,_0x1e1535,_0x36de62,_0x5ec4a4=-0x6*0x409+0x13f9*0x1+0x43d;_0x36de62=_0x2508c6['charAt'](_0x5ec4a4++);~_0x36de62&&(_0x1e1535=_0x21d579%(-0x35f*0xb+-0x78e*0x4+0x4351)?_0x1e1535*(-0x6d*0x1e+0x1*-0xa94+0x179a)+_0x36de62:_0x36de62,_0x21d579++%(0x2428+-0x1*0x737+-0x1ced))?_0x44060c+=String['fromCharCode'](0x1*-0x1c42+-0x6aa+-0x5*-0x72f&_0x1e1535>>(-(-0x2*0xe6e+-0x26eb+0x43c9)*_0x21d579&-0x1e59+-0x99*-0x1+0x1dc6)):0x43f*-0x8+0x185+-0x2073*-0x1){_0x36de62=_0x3658a9['indexOf'](_0x36de62);}for(let _0x353978=0x14ac+0x938+-0x1*0x1de4,_0x1c71f5=_0x44060c['length'];_0x353978<_0x1c71f5;_0x353978++){_0x53ff9e+='%'+('00'+_0x44060c['charCodeAt'](_0x353978)['toString'](0x1454*0x1+-0x125f+0x61*-0x5))['slice'](-(-0x8*0x456+0x47f*-0x3+-0x302f*-0x1));}return decodeURIComponent(_0x53ff9e);};_0x3ada['cIoePM']=_0x2d3d04,_0x3ada['IecLcb']={},_0x3ada['vrQwes']=!![];}const _0x217229=_0x168267[0x743*0x3+0x250b+-0x3ad4];_0x3ada['gBYHFC']!==_0x217229&&(_0x3ada['IecLcb']={},_0x3ada['gBYHFC']=_0x217229);const _0x119ca8=_0x3ada['IecLcb'][_0x2481c8];return _0x119ca8===undefined?(_0xa5cdc3=_0x3ada['cIoePM'](_0xa5cdc3),_0x3ada['IecLcb'][_0x2481c8]=_0xa5cdc3):_0xa5cdc3=_0x119ca8,_0xa5cdc3;}const HEARTBEAT_MS=0x2fa5*-0x2+-0x43*-0x27+0x1*0x8fad,CAPABILITY_REFRESH_MS=-0xa*0x1214+0x15237+0x4cf1,RETRY_MIN_MS=-0xd9*-0xb+-0x18a7+0x1148,RETRY_MAX_MS=-0x3f74+0x1*0x2639+0x8e6b,CLAUDE_APPROVAL_TIMEOUT_MS=(0x2428+-0x1*0x737+-0x1ce7)*(0x1*-0x15313+-0x4ff2+-0x1*-0x28d65);export function nextReconnectDelay(_0x1e1535){const _0x216f12=_0x3ada;return Math[_0x216f12(0x125)](RETRY_MAX_MS,RETRY_MIN_MS*(-0x2*0xe6e+-0x26eb+0x43c9)**Math[_0x216f12(0x125)](Math[_0x216f12(0x156)](_0x1e1535,-0x1e59+-0x99*-0x1+0x1dc0),0x43f*-0x8+0x185+-0x2083*-0x1));}function upgradeMetadata(_0x36de62,_0x5ec4a4){const _0x423a91=_0x3ada,_0x353978={..._0x36de62??{}};if(process.env['MAR_NODE_SUPERVISED']==='1')_0x353978[_0x423a91(0xf8)]=!![];else delete _0x353978[_0x423a91(0xf8)];if(_0x5ec4a4[_0x423a91(0x1df)]===_0x423a91(0x192))delete _0x353978[_0x423a91(0xf9)];else _0x353978[_0x423a91(0xf9)]=_0x5ec4a4;return _0x353978;}function _0x1ff5(){const _0x57da5b=['B3bLCMf0Aw9UCW','CgvUzgLUzW','ChjVAMvJDeLUAxrPywW','y2fWywjPBgL0EurLDgvJDg9Y','y29UBMvJDgLVBKXPzMvJEwnSzq','y29UzMLNugf0Aa','mtb2yLv4q3O','ChjLCgfYzu1LC3nHz2vjBNb1Da','mtyYnZDdEevpEfi','nty3odq1mKHPr2HAAq','nJm5odi4nwDyB25ODq','y29TCgXLDgvdyw5JzwXSzwrsDw4','AgfUzgXL','zMfRzvnJCMLWDa','C29JA2v0','B25oB3rPzMLJyxrPB24','DgvYBwLUywXtzxj2AwnL','C3rVCa','C3rYAw5NAwz5','Aw5ZCgvJDa','ywrK','CMvNAxn0zxi','DxbNCMfKzunVB3jKAw5HDg9Y','CNvUBMvYlMnVBw1HBMqUzxHLy3v0zq','y2XHDwrLq2XPzw50','zw5ZDxjLuMvZDw1LzenVBMzPz3vYyxrPB24','ywn0AxzL','D29YA3nWywnLrMLSzvnLCNzPy2u','Aw5KzxG','C2vZC2LVBLn0yxrL','BM9KzvjLCxvLC3rZ','y29UDMvYC2f0Aw9UlML0zw0','y2XLyxjbBgW','CNvUBMvYu2vYDMLJzq','zgvJAwrLqxbWCM92ywW','BM9KzuDLBMvYyxrPB24','D29YA3nWywnLq2HHBMDLu2vYDMLJzq','ndG3odKZt3DXCgnt','C3rHCNq','D29YA3nWywnLv29YA2jLBMnOu2vYDMLJzq','y2fUy2vSq2XHDwrLuNvU','zxH0zxjUywXby3rPDML0Eq','yMLUzenVBNrYB2W','yMLUzenVBw1HBMrdB250CM9S','ChjLC2vUDa','Dw5YzwDPC3rLCMvK','CMvMCMvZAenHCgfIAwXPDgLLCW','tK9erv9eqvrbqKftrv9vtKfwquLmqujmrq','C25HChnOB3rtzxf1zw5Jzq','CNvUrxzLBNrcCMLKz2u','D29YA3nWywnLu2vYDMLJzq','CgXHDgzVCM0','BwfUywDLzfj1BM5LCLnLC3nPB25Z','Aw50zxjYDxb0uMvXDwvZDgvK','BM9Kzs5JB25Uzwn0Aw9UlNjLCgXHy2vK','D29YA3nWywnLvxbSB2fKu2vYDMLJzq','Bwv0CMLJCW','surmrq','y29UDhjVBenOyw5UzwW','y29KzxG','CNvUswq','zM9Yz2v0','yMXVy2TZ','Bg9HzfjLC3vSDa','y29KzxHqCM9MAwXLq2XPzw50rMfJDg9YEq','zw1PDff1zxvL','ywrVChrsDw4','zgLZy292zxjxB3jRC3bHy2vtzxnZAw9UCW','tK9erv9vueDsqurfx1bftKrjtKC','AgfUzgXLtM90AwzPy2f0Aw9U','B3bLCMf0Aw9UuM91DgvY','DgvYBwLUywXnyw5Hz2vY','BM9KzuLK','CNvUBMvYq2HHBM5LBe1LC3nHz2vZ','yxbWCM92ywXjza','zgvJAwrLq29KzxHbChbYB3zHBa','y2XHDwrLqxbWCM92ywXuAw1LB3v0txm','C2nOzwr1Bgu','CMvJB3jKzwqTC2vZC2LVBG','C3rVCfDHDgnO','BM9Kzs51CgDYywrLlNjLCxvLC3q','zxHWAxjL','y29UDhjVBe1LC3nHz2vZ','CMvMCMvZAev4DgvYBMfSqwn0AxzPDhK','BMf0AxzLlNnLC3nPB24UzgLZy292zxj5lNbLBMrPBMC','zgvJAwrLq2XHDwrLqxbWCM92ywW','zw1PDenVBNzLCNnHDgLVBLr1CM4','y2XLyw51Ca','zxHLy3v0zq','CNvUDgLTzq','ChjVzMLSzxm','DgHYzwfKswq','zgf0ywjHC2u','Cgf0Aa','DhjHBNnPDgLVBMLUzW','BgLZDa','C3rHDhvZ','ndvjq3r4AhG','CMvJB25JAwXLugvYC2LZDgvKuNvUCW','z2v0qwDLBNrtzxnZAw9U','tK9erv9dt05gsuDFvu5bvKfjtefcteu','zw1PDfDVCMTIzw5JAa','C2v0q2HHBM5LBfrVA2vU','CMvWBgfJzq','C2vZC2LVBI5SAxn0','DhvYBG','uLvox05pvf9gt1vora','C2vZC2LVBKXPzMvJEwnSzvnLCNzPy2u','CNvUBMvYCW','ChvIBgLZAefWChjVDMfS','zMLUza','C2H1DgrVD24','C2v0','y2fUy2vSuxvLDwvK','D29YA3nWywnLu2vZC2LVBLnLCNzPy2u','zgLZy292zxi','D2f0y2GUzxzLBNq','BM93','zxHLy3v0zu5VzgvpCgvYyxrPB24','C2f2zu5HDgL2zvnLC3nPB25nzxrHzgf0yq','DxnLCKLUChv0CW','y29KzxHsDw5dB250CM9SBgvY','DgLTzxi','BMf0AxzLu2vZC2LVBLDHDgnOu2vYDMLJzq','yxbWzw5K','nZe3oteXn21AsLbLAW','zgLZy29UBMvJDa','lw9Wzw5JB2rLlwLTywDLCW','CMvJB25Uzwn0u2nOzwr1BgvK','C2vUzevUDMvSB3bL','BgLUDxG','zMfRzvj1BM5LCG','D29YA2jLBMnOrxzLBNrtzxj2AwnL','AgfUzgXLtwvZC2fNzq','C3rHDgu','ywn0AxzLv29YA3nWywnLtgvHC2vdB3vUDa','zwzMzwn0AxzLtwnWsw5ZDgfSBgf0Aw9UCW','C2vZC2LVBKnVBw1HBMrtzxj2AwnL','CMvXDwvZDenSyxvKzvvZzxjjBNb1Da','CNvUu3rHDgu','CMvTB3zL','uKvkrunuruq','z2v0uNvU','zMfZDa','C2vZC2LVBKnVBNrLEhrtzxj2AwnL','DhvYBKLK','CMvJB3jK','zgvSzxrL','ywnJzxnZ','CNvU','y2XVC2vsDw5UAw5NvgvYBwLUywXtzxnZAw9UCW','DxbNCMfKzs1Yzxn1BhqUANnVBG','BwLNCMf0zvj1BM5LCLnLC3nPB25jzgvUDgL0Eq','CNvUBMvYsw50zxjHy3rPB25tzxj2AwnL','C2vZC2LVBLbYzxnLBNrHDgLVBLnLCNzPy2u','AgfZqwn0AxzLu2vZC2LVBKXLyxnL','C2vUza','CMvJB25JAwXL','D29YA3nWywnLuxvLDwvxB3jRyMvUy2Htzxj2AwnL','y29UDMvYC2f0Aw9UsgLZDg9YEvnLCNzPy2u','rKflrv9svu5orvjFreLtq09otKvdva','Aw52ywXPzgf0zunOyw5Nzxm','yM9VDhn0CMfWswrZ','ChvIBgLZAa','zw1PDenVBNzLCNnHDgLVBKL0zw0','B3bLBKnVzgvdBgLLBNq','CgvYC2LZDezPBgvZ','C2vZC2LVBLf1zxj5u2vYDMLJzq','C3rHCNrdyxbHyMLSAxr5uMvMCMvZAa','Bwf0zxjPywXPEMvdB2rLEa','C3rVChbLza','Aw52ywXPzgf0zq','y29TBwfUzfn0yxrLCW','zwzMB3j0','A2LUza','Dg9WAwnby3rPDMu','CNvUDgLTzs1UB2rL','ode1mJCYseTxz3PN','CMvXDwvZDenSyxvKzufWChjVDMfS','DxbNCMfKzvjLywr5','D29YA3nWywnLu3rHDgu','y2XLyxi','CMvZDw1LzenVBMzPz3vYyxrPB24','AxrLBuLK','CMfUzg9Tvvvjra','y29UDMvYC2f0Aw9UvhvYBKzVCLj1BG','y2XVC2u','CMvWBgfJzvnVy2TLDezVCLrLC3rPBMC','vgHPCYboB2rLignVBM5Ly3rPB24GD2fZihjLCgXHy2vKigj5igeGBMv3zxiGAw5ZDgfUy2uGD2L0Acb0AguGC2fTzsbPzgvUDgL0Es4Gq2HLy2SGzM9Yigr1CgXPy2f0zsbWCM9JzxnZzxmU','CNvUBMvYvxnHz2vszwfKzxi','CgvYC2LZDfrLCM1PBMfS','y29UBMvJDa','zMX1C2Hqzw5KAw5Nvgv4Da','zgLZy292zxjxB3jRC3bHy2u','zgLZCg9Zzq','ChjVBw90zq','y2fWywjPBgL0AwvZuhjVDMLKzwq','zxH0zxjUywXtzxnZAw9UuMvZDw1Lu2vYDMLJzq','CMvNAxn0zxjbBgW','zgLYzwn0tMf0AxzL','z2v0v29YA3nWywnL','Bwv0ywrHDge','y29UBMvJDgvK','C2vZC2LVBKLKzw50Axr5u2vYDMLJzq','zw1PDfj1BG','AxrLBxm','CMvQzwn0','q0foq0vmteLorW','nNDXCerjBa','y29UDMvYC2f0Aw9U','C3vWzxj2AxnLzfvWz3jHzgu','DxbNCMfKzq','CMvMCMvZAfrVCgLJ','y3DK','BwfUywDLzezVCK5HDgL2zq','CMvTzw1Izxi','C2vZC2LVBG','CNvUBMvY','zxHLy3v0zunVBw1HBMq','BMf0AxzLu2vZC2LVBLbYB2PLy3rPB25tzxj2AwnL','y29KzxHdBgLLBNq','AgfZ','zgvJAwrL','BM9Kzs53B3jRyMvUy2GUy2fWywjPBgL0AwvZ','ChjVAMvJDgLVBKzVCK5HDgL2zq','CNvUqxr0ywnOBwvUDfnLCNzPy2u','q0foq0vm','C2L6zq','C2vZC2LVBNm','BwLNCMf0zvnLC3nPB24','CMvZCg9UzfvZzxjjBNb1Da','q0foq0vmteve','D29YA3nWywnLswq','DgvYBwLUywXdAgfUBMvS','y2fUy2vS','y3jLyxrLqxbWCM92ywW','CNvUrxzLBNrtzxj2AwnL','C2vZC2LVBKnHDgfSB2Dtzxj2AwnL','zw1PDfj1BKv2zw50','BM9Kzs5VCgvYyxrPB24','C25HChnOB3q','CMvJzw50lxj1BNm','CNvUv29YA2jLBMnOu2vYDMLJzq','su5urvjsvvburuq','D2LUzg93CW','CMvHze5HDgL2zq','CMvHza','y29UDMvYC2f0Aw9Uu2vNBwvUDfnLCNzPy2u','tK9erv9dt05orunusu9ox1jfueXbq0ve','DMfSDwvZ','CMvMCMvZAfrPDgXL','B3bLBKnVzgvsDw5dB250CM9SBgvY','Aw50zxjYDxb0','zMfRztO','BM9Kzs5JB25Uzwn0Aw5N','BwLU','CMvXDwvZDa','BM9Kzs51CgDYywrLlMnHBMnLBa','yxzHAwXHyMXL','zxHWAxjLqxbWCM92ywW','D2LUmZi','mtmZmJu5nM1Uzg9KCW','Bw9KzwW','zgLZCgf0y2G','zgvJAxnPB24','yxbWCM92ywXZ','y29UBMvJDgvKqxr0zw1WDa','CMvZB2X2zuzVCK1LC3nHz2u','y2XHDwrLuNvUq29UDhjVBgXLCG','tK9erv9tve9queve','D29YA3nWywnLq29VCMrPBMf0B3i','CMvZB2X2zq','D29YA2jLBMnOtwfUAwzLC3rtzxj2AwnL','y2fUy2vSq29KzxHuDxjU','D29YA3nWywnLv2f0y2Htzxj2AwnL','CMvZDw1Lqwz0zxjdB21Tyw5KuNvU','ChjVBw90zvnLC3nPB25jzgvUDgL0Eq','Aw52ywXPzgf0zvDVCMTZCgfJzvDHDgnOvg9WAwnZ','CMvJzw50uNvUuhjVAMvJDgLVBLnLCNzPy2u','ywXSB3DLzfjVB3rZ','CMvJB25Uzwn0','BgLZDfDVCMTZCgfJzxm','Cgf1C2vtzxnZAw9UuxvLDwu','y2fJAgvKu2vZC2LVBNm','zxHPDa','zMLSDgvY','BM9Kzs5TzxrYAwnZ','z2v0','CMvXDwLYzq','m3bfA0Pjwa','AxnbCNjHEq','zxHLy3v0Aw9U','CNvUCW','y29UzMLN','CMvZB2X2zun1CNjLBNq','ChvIBgLZAfnUyxbZAg90','zw1PDfDVCMTIzw5JAev2zw50','C2vZC2LVBK1LC3nHz2vtzxj2AwnL','BMf0AxzLsw1Hz2vsB290CW','BMf0AxzLswrZ','y2XLyxjxyxrJAgvZ','zw5ZDxjLv2f0y2G','y2fWywjPBgL0AwvZ','B25tDw1Tyxj5','Bwf4','C3rYAw5N','y2HHBM5LBfrVA2vU'];_0x1ff5=function(){return _0x57da5b;};return _0x1ff5();}export class NodeConnector{[_0x2c17e8(0x17c)]=crypto[_0x2c17e8(0xde)]()[_0x2c17e8(0x1c0)](/-/g,'');[_0x2c17e8(0x193)];[_0x2c17e8(0x1ab)];[_0x2c17e8(0x177)];[_0x2c17e8(0x15d)];set[_0x2c17e8(0x167)](_0x1c71f5){const _0x49b36c=_0x2c17e8;this[_0x49b36c(0x193)][_0x49b36c(0xe1)](_0x1c71f5);}[_0x2c17e8(0x203)]=![];[_0x2c17e8(0x14b)];[_0x2c17e8(0xea)];[_0x2c17e8(0x154)];[_0x2c17e8(0x15c)];[_0x2c17e8(0x15e)];[_0x2c17e8(0x13e)];[_0x2c17e8(0x1a5)];[_0x2c17e8(0x1dd)]=new WorkbenchEventService(envelope=>this[_0x2c17e8(0x1da)](envelope),(category,payload)=>{const _0x1ba4b3=_0x2c17e8,sessionId=workbenchPayloadSessionId(this[_0x1ba4b3(0x1b2)],category,payload);return sessionId===undefined||!this[_0x1ba4b3(0xf1)][_0x1ba4b3(0x1fb)][_0x1ba4b3(0x103)](sessionId);});[_0x2c17e8(0x1dc)];[_0x2c17e8(0x166)];[_0x2c17e8(0x1e4)]=new RunDomainState();[_0x2c17e8(0x18a)];[_0x2c17e8(0x134)];[_0x2c17e8(0x176)]=new SessionDomainState();[_0x2c17e8(0xf1)];[_0x2c17e8(0x101)];[_0x2c17e8(0x1f8)];[_0x2c17e8(0x11d)];[_0x2c17e8(0x1f2)];[_0x2c17e8(0x1a2)];[_0x2c17e8(0x18d)];[_0x2c17e8(0x1f3)];[_0x2c17e8(0x1c4)];[_0x2c17e8(0xeb)];[_0x2c17e8(0x14f)];[_0x2c17e8(0x113)];[_0x2c17e8(0x1e2)];[_0x2c17e8(0x107)];[_0x2c17e8(0x10f)];[_0x2c17e8(0x102)];[_0x2c17e8(0x1d2)];[_0x2c17e8(0x171)];[_0x2c17e8(0x1fe)];[_0x2c17e8(0x121)];[_0x2c17e8(0x132)];[_0x2c17e8(0x1c5)];[_0x2c17e8(0x1e9)];[_0x2c17e8(0x118)];[_0x2c17e8(0x200)];[_0x2c17e8(0x1f7)];[_0x2c17e8(0x19f)]=new NodeOperationRouter();[_0x2c17e8(0x17a)];[_0x2c17e8(0x136)];[_0x2c17e8(0x169)];[_0x2c17e8(0x18b)];[_0x2c17e8(0x205)]=new CommandStateStore();[_0x2c17e8(0xe3)];[_0x2c17e8(0x1a0)];[_0x2c17e8(0x16f)];[_0x2c17e8(0xda)]=new WorkspaceDomainState();[_0x2c17e8(0x138)]=new WorkspaceWatchService(this[_0x2c17e8(0xda)],workspaceId=>this[_0x2c17e8(0x1cb)][_0x2c17e8(0x153)](workspaceId),workspaceId=>this[_0x2c17e8(0x1cb)][_0x2c17e8(0x1a8)](workspaceId));[_0x2c17e8(0x1cb)]=new WorkspaceSessionService(this[_0x2c17e8(0xda)],{'discover':workspaceId=>this[_0x2c17e8(0x19c)](workspaceId),'listPage':workspaceId=>this[_0x2c17e8(0x1cf)](_0x2c17e8(0x1c1),{'workspaceId':workspaceId,'limit':0x14}),'active':workspaceId=>this[_0x2c17e8(0x138)][_0x2c17e8(0xd5)](workspaceId,_0x2c17e8(0x10a)),'emitRevision':workspaceId=>void this[_0x2c17e8(0x180)]?.[_0x2c17e8(0xfa)](workspaceId,_0x2c17e8(0x10a)),'onPending':(workspaceId,waitMs)=>nodeLog(_0x2c17e8(0x1ad),{'nodeId':this[_0x2c17e8(0x14b)]?.[_0x2c17e8(0x1a1)],'workspaceId':workspaceId,'waitMs':waitMs})});[_0x2c17e8(0x174)]=new WorkspaceFileService(this[_0x2c17e8(0xda)],()=>this[_0x2c17e8(0x14b)]?.[_0x2c17e8(0x13d)]??[],workspaceId=>this[_0x2c17e8(0x134)][_0x2c17e8(0x204)](workspaceId));[_0x2c17e8(0x190)]=new WorkspaceUploadService(this[_0x2c17e8(0xda)],workspaceId=>this[_0x2c17e8(0x134)][_0x2c17e8(0x204)](workspaceId));[_0x2c17e8(0x17d)]=new WorkspaceChangeService(this[_0x2c17e8(0xda)]);[_0x2c17e8(0x180)];[_0x2c17e8(0x1b5)];[_0x2c17e8(0x13c)]=new RecentRunProjectionService(message=>this[_0x2c17e8(0x1f5)](_0x2c17e8(0x117),message));[_0x2c17e8(0x1b2)]=new NodeRuntimeState(()=>this[_0x2c17e8(0x14b)]?.[_0x2c17e8(0x1a1)]??_0x2c17e8(0xd6),workspaceId=>this[_0x2c17e8(0x1b5)]?.[_0x2c17e8(0xee)](workspaceId),Date[_0x2c17e8(0x1ce)],(run,session,userMessage)=>this[_0x2c17e8(0x13c)][_0x2c17e8(0x1eb)](run,session,userMessage));[_0x2c17e8(0x191)]=new NodeMetrics();[_0x2c17e8(0x112)]=new RunEventService({'runtime':this[_0x2c17e8(0x1b2)],'metrics':this[_0x2c17e8(0x191)],'state':this[_0x2c17e8(0x1e4)],'isBootstrapSession':sessionId=>this[_0x2c17e8(0xf1)][_0x2c17e8(0x1fb)][_0x2c17e8(0x103)](sessionId),'presentSession':session=>this[_0x2c17e8(0x1f3)][_0x2c17e8(0x185)](session),'rejectBootstrap':(sessionId,code)=>this[_0x2c17e8(0xf1)][_0x2c17e8(0xf4)](sessionId,code),'emitWorkbench':(category,payload)=>{const _0x1ac094=_0x2c17e8;if(category===_0x1ac094(0xf7)&&isPlainRecord(payload)&&_0x1ac094(0x1c2)in payload)this[_0x1ac094(0x1af)](payload[_0x1ac094(0x1c2)]);else this[_0x1ac094(0x14e)](category,payload);},'cleanupAttachments':runId=>this[_0x2c17e8(0x107)][_0x2c17e8(0x1b0)](runId),'expireImages':runId=>this[_0x2c17e8(0x107)][_0x2c17e8(0x1aa)](runId),'scheduleContextRefresh':sessionId=>this[_0x2c17e8(0x1e9)][_0x2c17e8(0x1a6)](sessionId),'pauseQueue':sessionId=>this[_0x2c17e8(0x1f7)][_0x2c17e8(0x140)](sessionId),'dispatchQueue':async sessionId=>{const _0x299571=_0x2c17e8;if(!this[_0x299571(0x16f)][_0x299571(0x15a)]())await this[_0x299571(0x1f7)][_0x299571(0x12d)](sessionId);},'removeQueuedStart':runId=>this[_0x2c17e8(0x1f7)][_0x2c17e8(0x1e5)](runId)});[_0x2c17e8(0x1d4)]=new NativeSessionWatchService({'resolve':async sessionId=>this[_0x2c17e8(0x1b2)][_0x2c17e8(0x1bc)](sessionId)??this[_0x2c17e8(0x101)][_0x2c17e8(0x14c)](sessionId),'managedActive':session=>hasManagedActiveRun(this[_0x2c17e8(0x1b2)],session),'suspended':sessionId=>this[_0x2c17e8(0xeb)][_0x2c17e8(0x1b7)](sessionId),'refreshActivity':session=>this[_0x2c17e8(0x1f8)][_0x2c17e8(0x1ac)](session),'present':session=>this[_0x2c17e8(0x1f3)][_0x2c17e8(0x185)](session),'readPage':(session,limit)=>this[_0x2c17e8(0x1f8)][_0x2c17e8(0x11c)](session,{'limit':limit}),'convergePage':convergeConversationWatchPage,'projectInitialPage':(session,page,_unit,limit)=>this[_0x2c17e8(0x11d)][_0x2c17e8(0x15b)](session,page,limit),'emitSession':session=>this[_0x2c17e8(0x14e)](_0x2c17e8(0xfe),{'session':session}),'emitPage':(session,page)=>this[_0x2c17e8(0x14e)](_0x2c17e8(0xf7),{'sessionId':session['id'],'snapshot':this[_0x2c17e8(0x11d)][_0x2c17e8(0x15b)](session,page,0x14ac+0x938+-0x1*0x1dda)}),'nodeId':()=>this[_0x2c17e8(0x14b)]?.[_0x2c17e8(0x1a1)]??_0x2c17e8(0xd6),'nodeGeneration':()=>this[_0x2c17e8(0x17c)],'emitWatchEvent':payload=>this[_0x2c17e8(0x1f5)](_0x2c17e8(0x1cd),payload)});constructor(_0x3073fb={}){const _0x36bc79=_0x2c17e8;this[_0x36bc79(0x14b)]=_0x3073fb[_0x36bc79(0x14b)],this[_0x36bc79(0x15e)]=_0x3073fb[_0x36bc79(0x15e)],this[_0x36bc79(0x1a5)]=_0x3073fb[_0x36bc79(0x1a5)]??CLAUDE_APPROVAL_TIMEOUT_MS,this[_0x36bc79(0xea)]=_0x3073fb[_0x36bc79(0x154)]!==undefined,this[_0x36bc79(0x154)]=_0x3073fb[_0x36bc79(0x154)]??unavailableCapabilities(),this[_0x36bc79(0x16f)]=new NodeUpgradeCoordinator(()=>{const _0xe8c4dd=_0x36bc79;if(this[_0xe8c4dd(0x14b)]===undefined)throw new Error(_0xe8c4dd(0x1bd));return nodeUpgradeRequestPath(nodeDatabasePath(this[_0xe8c4dd(0x14b)],this[_0xe8c4dd(0x15e)]));},()=>this[_0x36bc79(0x1e4)][_0x36bc79(0x173)][_0x36bc79(0x109)],_0x56777a=>{const _0xf06326=_0x36bc79;this[_0xf06326(0x154)]={...this[_0xf06326(0x154)],'metadata':upgradeMetadata(this[_0xf06326(0x154)][_0xf06326(0xef)],_0x56777a)},this[_0xf06326(0x193)]?.[_0xf06326(0x1f5)](_0xf06326(0x154),this[_0xf06326(0x154)]);},_0x3073fb[_0x36bc79(0xd9)]??(()=>{const _0x3ba80d=_0x36bc79;this[_0x3ba80d(0x16a)](),setImmediate(()=>process[_0x3ba80d(0x142)](0x1454*0x1+-0x125f+0x47*-0x6));})),this[_0x36bc79(0x154)]={...this[_0x36bc79(0x154)],'metadata':upgradeMetadata(this[_0x36bc79(0x154)][_0x36bc79(0xef)],this[_0x36bc79(0x16f)][_0x36bc79(0x116)]())};const _0x2abdc9=_0x3073fb[_0x36bc79(0x15c)]??detectCapabilitiesAsync;this[_0x36bc79(0x15c)]=async()=>{const _0x41cdc7=_0x36bc79,_0x3f6dc4=await _0x2abdc9();return{..._0x3f6dc4,'metadata':upgradeMetadata(_0x3f6dc4[_0x41cdc7(0xef)],this[_0x41cdc7(0x16f)][_0x41cdc7(0x116)]())};},this[_0x36bc79(0x13e)]=_0x3073fb[_0x36bc79(0x13e)]??!![],this[_0x36bc79(0x1dc)]=_0x3073fb[_0x36bc79(0x1dc)]===undefined?undefined:new FakeTestRunner(_0x3073fb[_0x36bc79(0x1dc)]),this[_0x36bc79(0x166)]=_0x3073fb[_0x36bc79(0x166)],this[_0x36bc79(0x107)]=new RunAttachmentService(_0x4dfd3e=>this[_0x36bc79(0x1c5)][_0x36bc79(0x146)](_0x4dfd3e[_0x36bc79(0xff)])[_0x36bc79(0x150)](_0x4dfd3e)),this[_0x36bc79(0x102)]=new CodexRunner(_0x3073fb[_0x36bc79(0x102)],_0x3073fb[_0x36bc79(0x199)]),this[_0x36bc79(0x1d2)]=new CodexManagedRunController(this[_0x36bc79(0x102)],{'available':()=>this[_0x36bc79(0x154)][_0x36bc79(0x194)][_0x36bc79(0x128)],'intercepted':()=>this[_0x36bc79(0x1dc)]!==undefined,'active':this[_0x36bc79(0x1e4)][_0x36bc79(0x173)],'addActive':_0x198736=>this[_0x36bc79(0x1e4)][_0x36bc79(0x173)][_0x36bc79(0x16d)](_0x198736),'removeActive':_0x484b6b=>this[_0x36bc79(0x1e4)][_0x36bc79(0x173)][_0x36bc79(0x1ec)](_0x484b6b),'adopt':_0x432296=>this[_0x36bc79(0x1b2)][_0x36bc79(0x19b)](_0x432296),'session':_0x740c03=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1bc)](_0x740c03),'runStatus':_0x501df0=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1e7)](_0x501df0)?.[_0x36bc79(0x1b9)],'run':_0x1d33b5=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1e7)](_0x1d33b5),'interrupted':_0x417536=>this[_0x36bc79(0x1e4)][_0x36bc79(0x18e)][_0x36bc79(0x103)](_0x417536),'parseAttachments':parseRunnerImageAttachments,'materialize':(_0x374889,_0x559275)=>this[_0x36bc79(0x107)][_0x36bc79(0x202)](_0x374889,_0x559275),'completeCancelled':_0x9ebd4d=>this[_0x36bc79(0x1f2)][_0x36bc79(0x164)](_0x9ebd4d),'promoteSession':(_0x3dbd33,_0x1d0e4d)=>this[_0x36bc79(0xf1)][_0x36bc79(0xe9)](_0x3dbd33,_0x1d0e4d),'send':(_0x3d1db0,_0x224c37)=>this[_0x36bc79(0x1f5)](_0x3d1db0,_0x224c37),'emit':(_0x5d5cf0,_0x1b2142,_0x4574c2,_0x44254b)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x5d5cf0,_0x1b2142,_0x4574c2,_0x44254b),'cancel':(_0x23b2ed,_0xe366db,_0x108948,_0x78b79,_0x5b84b8)=>this[_0x36bc79(0x1f2)][_0x36bc79(0x137)](_0x23b2ed,_0xe366db,_0x108948,_0x78b79,_0x5b84b8),'createApproval':_0x2346ee=>this[_0x36bc79(0x1b2)][_0x36bc79(0x111)](_0x2346ee),'publishApproval':_0x56539a=>this[_0x36bc79(0x18a)][_0x36bc79(0x1c6)](_0x56539a),'emitItem':(_0x5b4848,_0xbccfeb)=>this[_0x36bc79(0x1fd)](_0x5b4848,_0xbccfeb),'appendImages':(_0x114b5b,_0x215e7b)=>this[_0x36bc79(0x107)][_0x36bc79(0x1d5)](_0x114b5b,_0x215e7b[_0x36bc79(0x143)](isRunnerImageAttachment)),'syncTitle':(_0xa055dd,_0x3b8026,_0x2555cd)=>this[_0x36bc79(0x18d)][_0x36bc79(0x120)](_0xa055dd,_0x3b8026,_0x2555cd),'commandState':(_0x20fb40,_0x463c63)=>this[_0x36bc79(0x205)][_0x36bc79(0x145)](_0x20fb40,_0x463c63),'setCommandState':(_0x403961,_0x1ad2ef)=>this[_0x36bc79(0x205)][_0x36bc79(0x1c9)](_0x403961,_0x1ad2ef),'clearCommandState':(_0x363a69,_0x51875d)=>this[_0x36bc79(0x205)][_0x36bc79(0xdb)](_0x363a69,_0x51875d),'commandStates':_0x35e869=>this[_0x36bc79(0x205)][_0x36bc79(0x1b8)](_0x35e869),'hasActiveSessionLease':_0x1b21b2=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1f4)](_0x1b21b2),'fast':_0x20ff4d=>this[_0x36bc79(0x1cf)](_0x36bc79(0x170),{'runner':_0x36bc79(0x194),'commandId':_0x36bc79(0x1e8),'input':_0x20ff4d})}),this[_0x36bc79(0x102)][_0x36bc79(0x168)](_0x3c9498=>this[_0x36bc79(0x1d2)][_0x36bc79(0x19e)](_0x3c9498)),this[_0x36bc79(0x171)]=new ClaudeCodeRunner(_0x3073fb[_0x36bc79(0x171)]),this[_0x36bc79(0x1fe)]=new OpenCodeRunner(_0x3073fb[_0x36bc79(0x1fe)]),this[_0x36bc79(0x121)]=new OpenCodeManagedRunController(this[_0x36bc79(0x1fe)],{'intercepted':()=>this[_0x36bc79(0x1dc)]!==undefined,'active':this[_0x36bc79(0x1e4)][_0x36bc79(0x173)],'parseAttachments':parseRunnerImageAttachments,'persistAttachments':(_0x24d494,_0xa88bc4,_0x47750c)=>this[_0x36bc79(0x107)][_0x36bc79(0x1ff)](_0x24d494,_0xa88bc4+_0x36bc79(0x1d8),_0x47750c),'emit':(_0x31af69,_0x232fc5,_0x5d4822,_0x425e76)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x31af69,_0x232fc5,_0x5d4822,_0x425e76),'emitItem':(_0x166c0d,_0xee6d70)=>this[_0x36bc79(0x1fd)](_0x166c0d,_0xee6d70),'adopt':_0x431c01=>this[_0x36bc79(0x1b2)][_0x36bc79(0x19b)](_0x431c01),'run':_0x520d1f=>{const _0x2243c7=_0x36bc79,_0x26d0c5=this[_0x2243c7(0x1b2)][_0x2243c7(0x1e7)](_0x520d1f);if(_0x26d0c5===undefined)throw new Error(_0x2243c7(0x1c3));return _0x26d0c5;},'hasActiveSessionLease':_0x9eaa14=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1f4)](_0x9eaa14),'promote':(_0x2faab8,_0xea0f66)=>this[_0x36bc79(0xf1)][_0x36bc79(0xe9)](_0x2faab8,_0xea0f66),'rememberNative':(_0x4b7947,_0x4c6189)=>this[_0x36bc79(0x18d)][_0x36bc79(0xfd)](_0x4b7947,_0x4c6189),'send':(_0x2fad50,_0x992543)=>this[_0x36bc79(0x1f5)](_0x2fad50,_0x992543),'createApproval':_0x4786cd=>this[_0x36bc79(0x1b2)][_0x36bc79(0x111)](_0x4786cd),'expireApproval':_0x24d5aa=>{const _0xd7fa29=_0x36bc79;this[_0xd7fa29(0x1b2)][_0xd7fa29(0x129)](_0x24d5aa);},'publishApproval':_0x540989=>this[_0x36bc79(0x18a)][_0x36bc79(0x1c6)](_0x540989),'commandState':(_0x3f888a,_0x274b54)=>this[_0x36bc79(0x205)][_0x36bc79(0x145)](_0x3f888a,_0x274b54),'setCommandState':(_0x243561,_0x12c359)=>this[_0x36bc79(0x205)][_0x36bc79(0x1c9)](_0x243561,_0x12c359),'clearCommandState':(_0x565163,_0x137737)=>this[_0x36bc79(0x205)][_0x36bc79(0xdb)](_0x565163,_0x137737),'commandStates':_0x11674a=>this[_0x36bc79(0x205)][_0x36bc79(0x1b8)](_0x11674a)},this[_0x36bc79(0x1a5)]),this[_0x36bc79(0x132)]=new ClaudeManagedRunController(this[_0x36bc79(0x171)],{'intercepted':()=>this[_0x36bc79(0x1dc)]!==undefined,'active':this[_0x36bc79(0x1e4)][_0x36bc79(0x173)],'parseAttachments':parseRunnerImageAttachments,'emit':(_0x321c66,_0x2e4dac,_0x23fd3e,_0x3f05e3)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x321c66,_0x2e4dac,_0x23fd3e,_0x3f05e3),'adopt':_0x517a8c=>this[_0x36bc79(0x1b2)][_0x36bc79(0x19b)](_0x517a8c),'run':_0x17d449=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1e7)](_0x17d449),'hasActiveSessionLease':_0x4f2264=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1f4)](_0x4f2264),'session':_0x409132=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1bc)](_0x409132),'completeCancelled':_0x27b6c3=>this[_0x36bc79(0x1f2)][_0x36bc79(0x164)](_0x27b6c3),'requestUserInput':(_0x615b06,_0x51c990,_0x147641)=>this[_0x36bc79(0x1f2)][_0x36bc79(0x1e3)](_0x615b06,_0x51c990,_0x147641),'requestApproval':(_0x1636e0,_0x4b3d91,_0x3123d8)=>this[_0x36bc79(0x1f2)][_0x36bc79(0xd8)](_0x1636e0,_0x4b3d91,_0x3123d8),'rememberNative':(_0x52642a,_0x43a7ad)=>this[_0x36bc79(0x18d)][_0x36bc79(0xfd)](_0x52642a,_0x43a7ad),'promote':(_0x187b24,_0x22d85e)=>this[_0x36bc79(0xf1)][_0x36bc79(0xe9)](_0x187b24,_0x22d85e),'send':(_0x1e73ed,_0x1a1b7e)=>this[_0x36bc79(0x1f5)](_0x1e73ed,_0x1a1b7e),'emitItem':(_0x28abbf,_0x29c659)=>this[_0x36bc79(0x1fd)](_0x28abbf,_0x29c659),'syncTitle':(_0x19bd3e,_0x1a65ba,_0x2ab51c)=>this[_0x36bc79(0x18d)][_0x36bc79(0x120)](_0x19bd3e,_0x1a65ba,_0x2ab51c),'setChannelToken':(_0x1ab46f,_0x30b550)=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1bf)](_0x1ab46f,_0x30b550),'commandState':(_0x473f8c,_0x59cb69)=>this[_0x36bc79(0x205)][_0x36bc79(0x145)](_0x473f8c,_0x59cb69),'setCommandState':(_0x50424c,_0x4e193b)=>this[_0x36bc79(0x205)][_0x36bc79(0x1c9)](_0x50424c,_0x4e193b),'clearCommandState':(_0x9dabd5,_0x28e458)=>this[_0x36bc79(0x205)][_0x36bc79(0xdb)](_0x9dabd5,_0x28e458),'commandStates':_0x1231ae=>this[_0x36bc79(0x205)][_0x36bc79(0x1b8)](_0x1231ae)}),this[_0x36bc79(0x1c5)]=new RunnerRegistry([this[_0x36bc79(0x1fe)],this[_0x36bc79(0x102)],this[_0x36bc79(0x171)],...this[_0x36bc79(0x1dc)]===undefined?[]:[this[_0x36bc79(0x1dc)]]]),this[_0x36bc79(0x18d)]=new ManagedRunnerSessionService(this[_0x36bc79(0x1b2)],this[_0x36bc79(0x1c5)],_0x4f30ea=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),{'session':this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x4f30ea)})),this[_0x36bc79(0x1f2)]=new RunnerInteractionService({'runtime':this[_0x36bc79(0x1b2)],'state':this[_0x36bc79(0x1e4)],'codex':()=>this[_0x36bc79(0x102)],'claude':()=>this[_0x36bc79(0x171)],'runners':this[_0x36bc79(0x1c5)],'emitRun':(_0x28dcc0,_0x2d2494,_0x1a952f,_0x40affd)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x28dcc0,_0x2d2494,_0x1a952f,_0x40affd),'emitItem':(_0x1e7c44,_0xf2744a)=>this[_0x36bc79(0x1fd)](_0x1e7c44,_0xf2744a),'approvalTimeoutMs':this[_0x36bc79(0x1a5)],'publishApproval':_0x45bfd2=>this[_0x36bc79(0x18a)][_0x36bc79(0x1c6)](_0x45bfd2)}),this[_0x36bc79(0x1a2)]=new RunnerChannelMessageService({'interactions':this[_0x36bc79(0x1f2)],'send':(_0x226d99,_0x3d7f53,_0x5d90db)=>this[_0x36bc79(0x1f5)](_0x226d99,_0x3d7f53,_0x5d90db)}),this[_0x36bc79(0x1f3)]=new SessionPresentationService({'database':()=>this[_0x36bc79(0x1b5)],'runtime':this[_0x36bc79(0x1b2)],'commands':this[_0x36bc79(0x205)],'runners':this[_0x36bc79(0x1c5)],'capabilities':()=>this[_0x36bc79(0x154)],'hasManagedActiveRun':_0x501514=>hasManagedActiveRun(this[_0x36bc79(0x1b2)],_0x501514),'externalActivity':_0x338cff=>this[_0x36bc79(0x176)][_0x36bc79(0x182)][_0x36bc79(0x145)](_0x338cff),'projectionForNative':_0x251743=>this[_0x36bc79(0x101)][_0x36bc79(0x106)](_0x251743)}),this[_0x36bc79(0x101)]=new NativeSessionProjectionService({'database':()=>this[_0x36bc79(0x1b5)],'nodeId':()=>this[_0x36bc79(0x14b)]?.[_0x36bc79(0x1a1)]??_0x36bc79(0x1a7),'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'capabilities':()=>this[_0x36bc79(0x154)],'state':this[_0x36bc79(0x176)],'commands':this[_0x36bc79(0x205)],'present':_0x43761f=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x43761f)}),this[_0x36bc79(0x1f8)]=new ConversationHistoryService({'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'capabilities':()=>this[_0x36bc79(0x154)],'attachments':this[_0x36bc79(0x107)],'snapshotSequence':()=>this[_0x36bc79(0x1dd)][_0x36bc79(0x189)](),'hasManagedActiveRun':_0x41d6e4=>hasManagedActiveRun(this[_0x36bc79(0x1b2)],_0x41d6e4),'setExternalActivity':(_0x3b1025,_0x3a9c8e)=>this[_0x36bc79(0x176)][_0x36bc79(0x182)][_0x36bc79(0x1c9)](_0x3b1025,_0x3a9c8e)}),this[_0x36bc79(0x11d)]=new ConversationSegmentService((_0x5dd716,_0x447bbc)=>this[_0x36bc79(0x1f8)][_0x36bc79(0x11c)](_0x5dd716,_0x447bbc)),this[_0x36bc79(0x1e9)]=new SessionContextService({'runners':this[_0x36bc79(0x1c5)],'session':_0x4f0746=>this[_0x36bc79(0x1b2)][_0x36bc79(0x1bc)](_0x4f0746),'stopped':()=>this[_0x36bc79(0x203)],'publish':_0x4033c1=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),_0x4033c1)}),this[_0x36bc79(0x118)]=new RunWorkbenchService({'runtime':this[_0x36bc79(0x1b2)],'readImage':async(_0x37b7aa,_0x1456d5)=>this[_0x36bc79(0x107)][_0x36bc79(0x11c)](_0x37b7aa,_0x1456d5)??await this[_0x36bc79(0x107)][_0x36bc79(0x11b)](_0x37b7aa,_0x1456d5),'respondUserInput':(_0x45631e,_0x3357bf,_0x1d3720)=>this[_0x36bc79(0x1f2)][_0x36bc79(0x10c)](_0x45631e,_0x3357bf,_0x1d3720),'cancelQueued':_0x543439=>this[_0x36bc79(0x1f7)][_0x36bc79(0x1ca)](_0x543439),'pauseQueue':_0x5c6c6e=>this[_0x36bc79(0x1f7)][_0x36bc79(0x140)](_0x5c6c6e),'emitRun':(_0x1ae3fc,_0x1d685d,_0x1d0d90,_0x273777)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x1ae3fc,_0x1d685d,_0x1d0d90,_0x273777),'control':(_0x310078,_0x3d1e3e)=>this[_0x36bc79(0x1ab)][_0x36bc79(0x165)](JSON[_0x36bc79(0x16b)](createEnvelope(_0x310078,_0x3d1e3e))),'markInterrupted':_0x9d1c03=>this[_0x36bc79(0x1e4)][_0x36bc79(0x18e)][_0x36bc79(0x16d)](_0x9d1c03)}),this[_0x36bc79(0x200)]=new SessionQueryService({'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'resolve':_0x309ea1=>this[_0x36bc79(0x101)][_0x36bc79(0x135)](_0x309ea1),'present':_0x1ad681=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x1ad681),'history':(_0x58f76e,_0x4865db)=>this[_0x36bc79(0x1f8)][_0x36bc79(0x11c)](_0x58f76e,_0x4865db),'segments':(_0x3aa544,_0x5a01a4)=>this[_0x36bc79(0x11d)][_0x36bc79(0x11c)](_0x3aa544,_0x5a01a4),'context':this[_0x36bc79(0x1e9)],'discover':(_0x27e102,_0x3b1ff0)=>this[_0x36bc79(0x101)][_0x36bc79(0x1cc)](_0x27e102,_0x3b1ff0),'workspaceIdForCwd':_0x5bdf53=>this[_0x36bc79(0x1b5)]?.[_0x36bc79(0x13f)]()[_0x36bc79(0x1c7)](_0x45b7dc=>_0x45b7dc[_0x36bc79(0x1b6)]===_0x5bdf53)?.['id']}),this[_0x36bc79(0x1f7)]=new WorkspaceQueueWorkbenchService({'runtime':this[_0x36bc79(0x1b2)],'emit':(_0x4648fc,_0x175522)=>this[_0x36bc79(0x18a)][_0x36bc79(0x19a)](_0x4648fc,_0x175522),'clearImages':_0x11e5c7=>this[_0x36bc79(0x107)][_0x36bc79(0xdb)](_0x11e5c7),'cleanupAttachments':_0x2e5cf7=>this[_0x36bc79(0x107)][_0x36bc79(0x1b0)](_0x2e5cf7),'emitRun':(_0x8707cf,_0x3c3328,_0x244994,_0x479ab9)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x8707cf,_0x3c3328,_0x244994,_0x479ab9),'emitConversation':_0x36229e=>this[_0x36bc79(0x1af)](_0x36229e),'control':(_0x41487a,_0x56e712)=>this[_0x36bc79(0x1ab)][_0x36bc79(0x165)](JSON[_0x36bc79(0x16b)](createEnvelope(_0x41487a,_0x56e712))),'stopped':()=>this[_0x36bc79(0x203)],'markInterrupted':_0x3c7e2e=>this[_0x36bc79(0x1e4)][_0x36bc79(0x18e)][_0x36bc79(0x16d)](_0x3c7e2e),'prepareInput':(_0x50245c,_0x504a25,_0x5a7281)=>this[_0x36bc79(0x1c5)][_0x36bc79(0x146)](_0x50245c)[_0x36bc79(0x160)](_0x504a25,_0x5a7281),'mcps':_0x1e7dae=>this[_0x36bc79(0x1b5)]?.[_0x36bc79(0x1e1)](_0x1e7dae)??[]}),this[_0x36bc79(0xf1)]=new SessionIdentityService({'runtime':this[_0x36bc79(0x1b2)],'persist':(_0x2b2eeb,_0x29206f)=>{const _0x1db45e=_0x36bc79;if(_0x2b2eeb[_0x1db45e(0x12c)]===null||_0x2b2eeb[_0x1db45e(0xd3)]===null||_0x2b2eeb[_0x1db45e(0x1ed)]===null)return;this[_0x1db45e(0x1b5)]?.[_0x1db45e(0x1d0)]({'runner':_0x2b2eeb[_0x1db45e(0xff)],'externalSessionId':_0x29206f,'workspaceId':_0x2b2eeb[_0x1db45e(0x10e)],'model':_0x2b2eeb[_0x1db45e(0x12c)],'effort':_0x2b2eeb[_0x1db45e(0xd3)],'access':_0x2b2eeb[_0x1db45e(0x1ed)]});},'migrateCommands':(_0xd14037,_0x3975af)=>this[_0x36bc79(0x205)][_0x36bc79(0x13a)](_0xd14037,_0x3975af),'migrateQueue':(_0x8df882,_0x1860c2)=>this[_0x36bc79(0x1f7)][_0x36bc79(0x10b)](_0x8df882,_0x1860c2),'migrateRunnerState':(_0x5a9627,_0x35d911)=>this[_0x36bc79(0x18a)][_0x36bc79(0x1f1)](_0x5a9627,_0x35d911),'emitSession':_0xcd09db=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),{'session':_0xcd09db}),'emitRun':_0x118a4d=>this[_0x36bc79(0x14e)](_0x36bc79(0x1ee),{'run':_0x118a4d}),'emitQueue':_0x1f6fda=>this[_0x36bc79(0x1f7)][_0x36bc79(0x1fc)](_0x1f6fda),'emitTurn':_0x4d84e5=>this[_0x36bc79(0x1af)](_0x4d84e5)}),this[_0x36bc79(0x1c4)]=new SessionLifecycleService({'database':()=>{const _0x11f487=_0x36bc79;if(this[_0x11f487(0x1b5)]===undefined)throw new Error(_0x11f487(0x188));return this[_0x11f487(0x1b5)];},'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'projection':this[_0x36bc79(0x101)],'identity':this[_0x36bc79(0xf1)],'present':_0xa59abe=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0xa59abe),'emitSession':_0x23ae0f=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),{'session':this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x23ae0f)}),'execute':(_0x4914cf,_0x36e569)=>this[_0x36bc79(0x1cf)](_0x4914cf,_0x36e569),'interceptedSessionId':_0x5bc9ca=>this[_0x36bc79(0x1dc)]===undefined?undefined:_0x36bc79(0x123)+_0x5bc9ca}),this[_0x36bc79(0xeb)]=new ExternalSessionResumeService({'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'state':this[_0x36bc79(0x176)],'available':_0x2902f7=>this[_0x36bc79(0x1c5)][_0x36bc79(0x146)](_0x2902f7)[_0x36bc79(0x128)](this[_0x36bc79(0x154)]),'projectionFor':_0x2aed19=>this[_0x36bc79(0x101)][_0x36bc79(0x106)](_0x2aed19),'managedAliasFor':_0x2196af=>this[_0x36bc79(0x101)][_0x36bc79(0xfc)](_0x2196af),'ensureConfiguration':_0x4d3963=>this[_0x36bc79(0x101)][_0x36bc79(0x172)](_0x4d3963),'configuration':_0x8a1bfe=>this[_0x36bc79(0x101)][_0x36bc79(0xdc)](_0x8a1bfe),'workspacePath':_0x2b5e7a=>this[_0x36bc79(0x1b5)]?.[_0x36bc79(0xee)](_0x2b5e7a)?.[_0x36bc79(0x1b6)],'rememberNative':(_0x592b5f,_0x9e4dcf)=>this[_0x36bc79(0x18d)][_0x36bc79(0xfd)](_0x592b5f,_0x9e4dcf),'resolve':_0x64ce72=>this[_0x36bc79(0x101)][_0x36bc79(0x135)](_0x64ce72)}),this[_0x36bc79(0x1e2)]=new SessionCommandService({'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'projection':this[_0x36bc79(0x101)],'resume':this[_0x36bc79(0xeb)],'profiles':()=>this[_0x36bc79(0x17a)][_0x36bc79(0x1b3)](),'present':_0x55b549=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x55b549),'resumeQueueAfterCommandRun':_0x222ce6=>this[_0x36bc79(0x1f7)][_0x36bc79(0x139)](_0x222ce6)}),this[_0x36bc79(0x14f)]=new SessionMessageService({'runtime':this[_0x36bc79(0x1b2)],'uploads':this[_0x36bc79(0x190)],'attachments':this[_0x36bc79(0x107)],'commands':this[_0x36bc79(0x205)],'queue':this[_0x36bc79(0x1f7)],'interaction':this[_0x36bc79(0x1f2)],'runners':this[_0x36bc79(0x1c5)],'resolve':_0x4c6fa7=>this[_0x36bc79(0xeb)][_0x36bc79(0x131)](_0x4c6fa7),'present':_0x3ad605=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x3ad605),'emitSession':_0x1b6323=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),{'session':this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x1b6323)}),'channelToken':_0xc5b2da=>{const _0x576e99=_0x36bc79,_0x138f35=this[_0x576e99(0x1b2)][_0x576e99(0x1bc)](_0xc5b2da);return _0x138f35===undefined?undefined:this[_0x576e99(0x1c5)][_0x576e99(0x146)](_0x138f35[_0x576e99(0xff)])[_0x576e99(0x158)](_0xc5b2da);}}),this[_0x36bc79(0x113)]=new SessionCatalogService({'database':()=>{const _0x22ef20=_0x36bc79;if(this[_0x22ef20(0x1b5)]===undefined)throw new Error(_0x22ef20(0x188));return this[_0x22ef20(0x1b5)];},'nodeId':()=>this[_0x36bc79(0x14b)]?.[_0x36bc79(0x1a1)]??_0x36bc79(0x1a7),'runtime':this[_0x36bc79(0x1b2)],'runners':this[_0x36bc79(0x1c5)],'projection':this[_0x36bc79(0x101)],'resume':this[_0x36bc79(0xeb)],'cachedNative':()=>[...this[_0x36bc79(0x176)][_0x36bc79(0xed)][_0x36bc79(0x11f)]()],'cachedWorkspace':_0x3c2302=>this[_0x36bc79(0x134)][_0x36bc79(0x141)](_0x3c2302),'present':_0x58acf3=>this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x58acf3),'projectionForNative':_0x2e6079=>this[_0x36bc79(0x101)][_0x36bc79(0x106)](_0x2e6079),'nativeIds':_0xe25e40=>this[_0x36bc79(0x101)][_0x36bc79(0x151)](_0xe25e40),'forget':(_0x3d1409,_0xbceed8)=>this[_0x36bc79(0x101)][_0x36bc79(0x196)](_0x3d1409,_0xbceed8),'refreshActivity':_0xd9dcd0=>this[_0x36bc79(0x1f8)][_0x36bc79(0x1ac)](_0xd9dcd0),'externalActivity':_0x4160fd=>this[_0x36bc79(0x176)][_0x36bc79(0x182)][_0x36bc79(0x145)](_0x4160fd),'history':(_0x163efa,_0x46f6e2)=>this[_0x36bc79(0x1f8)][_0x36bc79(0x11c)](_0x163efa,_0x46f6e2),'emitSession':_0x1ea607=>this[_0x36bc79(0x14e)](_0x36bc79(0xfe),{'session':this[_0x36bc79(0x1f3)][_0x36bc79(0x185)](_0x1ea607)})}),this[_0x36bc79(0x102)][_0x36bc79(0x183)]({'start':_0x11bdee=>this[_0x36bc79(0x1d2)][_0x36bc79(0x17f)](_0x11bdee),'cancel':(_0x5ad198,_0x404de9)=>{const _0x4821a0=_0x36bc79,_0x307c15=this[_0x4821a0(0x102)][_0x4821a0(0x149)][_0x4821a0(0x14a)][_0x4821a0(0x145)](_0x5ad198);if(_0x307c15?.[_0x4821a0(0x1ea)]===undefined)return![];return void this[_0x4821a0(0x1f2)][_0x4821a0(0x137)](_0x5ad198,_0x307c15[_0x4821a0(0x1b4)],_0x307c15[_0x4821a0(0x1ea)],_0x307c15[_0x4821a0(0xfb)],_0x404de9===_0x4821a0(0x108)?_0x4821a0(0x10d):_0x4821a0(0x119)),!![];},'decideApproval':_0x498ba5=>this[_0x36bc79(0x1f2)][_0x36bc79(0x1a4)](_0x498ba5[_0x36bc79(0x1a3)],_0x498ba5[_0x36bc79(0x12e)])}),this[_0x36bc79(0x171)][_0x36bc79(0x183)]({'start':_0x1705aa=>this[_0x36bc79(0x132)][_0x36bc79(0x17f)](_0x1705aa),'cancel':(_0x4369e8,_0x33f6b8)=>this[_0x36bc79(0x1f2)][_0x36bc79(0x181)](_0x4369e8,_0x33f6b8),'decideApproval':_0x56046e=>this[_0x36bc79(0x1f2)][_0x36bc79(0x1ae)](_0x56046e[_0x36bc79(0x1a3)],_0x56046e[_0x36bc79(0x12e)])}),this[_0x36bc79(0x1fe)][_0x36bc79(0x183)]({'start':_0x5a018e=>this[_0x36bc79(0x121)][_0x36bc79(0x17f)](_0x5a018e),'cancel':(_0x26afff,_0x237f76)=>this[_0x36bc79(0x121)][_0x36bc79(0x110)](_0x26afff,_0x237f76),'decideApproval':_0x432d03=>this[_0x36bc79(0x121)][_0x36bc79(0x17b)](_0x432d03),'respondUserInput':(_0x9146df,_0x55be6f,_0x3fc456)=>this[_0x36bc79(0x121)][_0x36bc79(0x10c)](_0x9146df,_0x55be6f,_0x3fc456)}),this[_0x36bc79(0x102)][_0x36bc79(0x184)]({'execute':(_0x469a64,_0x12a4fa,_0x5c33b3,_0xeedbbf)=>this[_0x36bc79(0x1d2)][_0x36bc79(0x100)](_0x469a64,_0x12a4fa,_0x5c33b3,_0xeedbbf)}),this[_0x36bc79(0x171)][_0x36bc79(0x184)]({'execute':(_0x16e60c,_0x315122,_0x530426,_0x263909)=>this[_0x36bc79(0x132)][_0x36bc79(0x100)](_0x16e60c,_0x315122,_0x530426,_0x263909)}),this[_0x36bc79(0x1fe)][_0x36bc79(0x184)]({'execute':(_0xdafd69,_0xcb8bd5,_0x3431fc,_0x148b59)=>this[_0x36bc79(0x121)][_0x36bc79(0x100)](_0xdafd69,_0xcb8bd5,_0x148b59)});const _0x585933=this[_0x36bc79(0x1dc)]===undefined||this[_0x36bc79(0x166)]===undefined?undefined:new FakeManagedRunService({'runner':this[_0x36bc79(0x1dc)],'script':this[_0x36bc79(0x166)],'runners':this[_0x36bc79(0x1c5)],'runtime':this[_0x36bc79(0x1b2)],'state':this[_0x36bc79(0x1e4)],'emitRun':(_0x556c54,_0x62e2b8,_0x542fc1,_0x63d5d6)=>this[_0x36bc79(0x18a)][_0x36bc79(0xf2)](_0x556c54,_0x62e2b8,_0x542fc1,_0x63d5d6),'publishApproval':_0x48551c=>this[_0x36bc79(0x18a)][_0x36bc79(0x1c6)](_0x48551c),'disconnect':()=>this[_0x36bc79(0x193)][_0x36bc79(0xe0)](-0x8*0x456+0x47f*-0x3+-0x3fd7*-0x1,_0x36bc79(0x1f9))});this[_0x36bc79(0x1dc)]?.[_0x36bc79(0x183)]({'start':_0x93ba6f=>_0x585933?.[_0x36bc79(0x17f)](_0x93ba6f),'cancel':(_0x480b92,_0x311076)=>_0x311076===_0x36bc79(0x108)?this[_0x36bc79(0x1dc)]?.[_0x36bc79(0x110)](_0x480b92)??![]:this[_0x36bc79(0x1dc)]?.[_0x36bc79(0x122)](_0x480b92)??![],'decideApproval':_0x1fd836=>this[_0x36bc79(0x1dc)]?.[_0x36bc79(0x104)](_0x1fd836[_0x36bc79(0x195)],_0x1fd836[_0x36bc79(0x1a3)],_0x1fd836[_0x36bc79(0x12e)])??![]}),this[_0x36bc79(0xe3)]=_0x3073fb[_0x36bc79(0xe3)]??new RunnerUsageReader(),this[_0x36bc79(0x1b5)]=_0x3073fb[_0x36bc79(0x1b5)],this[_0x36bc79(0x1a0)]=_0x3073fb[_0x36bc79(0x1a0)]??new TerminalManager({'platform':this[_0x36bc79(0x154)][_0x36bc79(0x18c)]===_0x36bc79(0x11a)?_0x36bc79(0x12a):_0x36bc79(0x1db)}),this[_0x36bc79(0x1a0)][_0x36bc79(0x155)](_0x2b4951=>this[_0x36bc79(0x134)][_0x36bc79(0xe4)](_0x2b4951)),this[_0x36bc79(0x10f)]=new NodeTerminalChannel({'config':()=>this[_0x36bc79(0x14b)],'controlConnected':()=>this[_0x36bc79(0x193)][_0x36bc79(0xf0)](),'stopped':()=>this[_0x36bc79(0x203)],'reconnect':this[_0x36bc79(0x13e)],'reconnectDelay':nextReconnectDelay,'manager':this[_0x36bc79(0x1a0)]}),this[_0x36bc79(0x193)]=new NodeControlChannel({'config':()=>this[_0x36bc79(0x14b)],'capabilities':()=>this[_0x36bc79(0x154)],'stopped':()=>this[_0x36bc79(0x203)],'reconnect':this[_0x36bc79(0x13e)],'reconnectDelay':nextReconnectDelay,'onConnecting':_0x3d0edf=>{const _0xcebb58=_0x36bc79;this[_0xcebb58(0x191)][_0xcebb58(0x130)](),nodeLog(_0xcebb58(0x124),{'attempt':_0x3d0edf});},'onReconnectScheduled':()=>this[_0x36bc79(0x191)][_0x36bc79(0x1d9)](),'onMessage':_0x173473=>this[_0x36bc79(0x1de)](_0x173473),'onClose':(_0x489847,_0x42fef9)=>{const _0x1269b2=_0x36bc79;this[_0x1269b2(0x10f)][_0x1269b2(0x1d7)]();if(_0x489847===0x743*0x3+0x250b+-0x2b34&&_0x42fef9===_0x1269b2(0x11e))nodeLog(_0x1269b2(0x18f),{'message':_0x1269b2(0xe2)});if(_0x489847===-0x929+-0xbf7+0x24c3||_0x489847===-0xbab+0x4c*-0x53+-0x1a*-0x18c)void this[_0x1269b2(0x1a0)][_0x1269b2(0x1c8)]();}}),this[_0x36bc79(0x1ab)]=new NodeControlMessageService({'config':()=>this[_0x36bc79(0x14b)],'register':(_0x36d80a,_0x316f90)=>this[_0x36bc79(0x15d)][_0x36bc79(0x16e)](_0x36d80a,_0x316f90),'connected':()=>this[_0x36bc79(0x15d)][_0x36bc79(0xf0)](),'close':(_0x20992b,_0x41ec24)=>this[_0x36bc79(0x193)][_0x36bc79(0xe0)](_0x20992b,_0x41ec24),'inspectWorkspace':_0x4b0d18=>this[_0x36bc79(0x134)][_0x36bc79(0x16c)](_0x4b0d18),'handleNodeRequest':_0xd0c972=>this[_0x36bc79(0x177)][_0x36bc79(0x165)](_0xd0c972),'reconcileRuns':_0x50dd09=>this[_0x36bc79(0x18a)][_0x36bc79(0x1f6)](_0x50dd09),'runners':this[_0x36bc79(0x1c5)],'deliverSessionChannelMessage':_0xfae985=>this[_0x36bc79(0x1a2)][_0x36bc79(0x165)](_0xfae985),'completeUncontrolledCancellation':_0x22d360=>{const _0x2237f9=_0x36bc79,_0x2db7d8=this[_0x2237f9(0x1b2)][_0x2237f9(0x1e7)](_0x22d360);if(_0x2db7d8?.[_0x2237f9(0x1b9)]===_0x2237f9(0xf5))this[_0x2237f9(0x1f2)][_0x2237f9(0x164)](_0x22d360);},'send':(_0x5cf1ab,_0x5eda4b,_0x3f24af)=>this[_0x36bc79(0x1f5)](_0x5cf1ab,_0x5eda4b,_0x3f24af)}),this[_0x36bc79(0x177)]=new NodeRequestService({'nodeId':()=>this[_0x36bc79(0x14b)]?.[_0x36bc79(0x1a1)],'databaseAvailable':()=>this[_0x36bc79(0x1b5)]!==undefined,'execute':(_0x2cbd0f,_0x318161)=>this[_0x36bc79(0x1cf)](_0x2cbd0f,_0x318161),'send':(_0x5be609,_0x443a29,_0x1a8521)=>this[_0x36bc79(0x1f5)](_0x5be609,_0x443a29,_0x1a8521)}),this[_0x36bc79(0x134)]=new NodeWorkspaceCoordinator({'config':()=>this[_0x36bc79(0x14b)],'database':()=>this[_0x36bc79(0x1b5)],'watches':this[_0x36bc79(0x138)],'sessions':this[_0x36bc79(0x1cb)],'changes':this[_0x36bc79(0x17d)],'emit':(_0x4701e1,_0x429e35)=>void this[_0x36bc79(0x180)]?.[_0x36bc79(0xfa)](_0x4701e1,_0x429e35),'send':(_0x1823e6,_0x4f5f56,_0x404c61)=>this[_0x36bc79(0x1f5)](_0x1823e6,_0x4f5f56,_0x404c61)}),this[_0x36bc79(0x18a)]=new NodeRunEventBridge({'runtime':this[_0x36bc79(0x1b2)],'state':this[_0x36bc79(0x1e4)],'events':this[_0x36bc79(0x112)],'workbench':this[_0x36bc79(0x1dd)],'queues':this[_0x36bc79(0x1f7)],'codex':this[_0x36bc79(0x102)],'claude':this[_0x36bc79(0x171)],'openCode':this[_0x36bc79(0x1fe)],'send':(_0x571256,_0xd183a,_0x1a2d68)=>this[_0x36bc79(0x1f5)](_0x571256,_0xd183a,_0x1a2d68)}),this[_0x36bc79(0x15d)]=new NodeConnectionLifecycleService({'config':()=>this[_0x36bc79(0x14b)],'setConfig':_0x37497e=>this[_0x36bc79(0x14b)]=_0x37497e,'configPath':this[_0x36bc79(0x15e)],'capabilities':()=>this[_0x36bc79(0x154)],'detectCapabilities':this[_0x36bc79(0x15c)],'capabilitiesProvided':this[_0x36bc79(0xea)],'stopped':()=>this[_0x36bc79(0x203)],'setCapabilities':_0x5c763b=>this[_0x36bc79(0x154)]={..._0x5c763b,'metadata':upgradeMetadata(_0x5c763b[_0x36bc79(0xef)],this[_0x36bc79(0x16f)][_0x36bc79(0x116)]())},'control':this[_0x36bc79(0x193)],'terminal':this[_0x36bc79(0x10f)],'metrics':this[_0x36bc79(0x191)],'heartbeatMs':HEARTBEAT_MS,'refreshMs':CAPABILITY_REFRESH_MS,'onConnected':()=>this[_0x36bc79(0x13c)][_0x36bc79(0x14d)]()});const _0x18f5d5=()=>{const _0x45c42b=_0x36bc79;if(this[_0x45c42b(0x1b5)]===undefined)throw new Error(_0x45c42b(0x188));return this[_0x45c42b(0x1b5)];};this[_0x36bc79(0x17a)]=new RunnerService(_0x18f5d5,()=>this[_0x36bc79(0x154)],this[_0x36bc79(0x1c5)],this[_0x36bc79(0xe3)]),this[_0x36bc79(0x136)]=new WorkbenchManifestService({'capabilities':()=>this[_0x36bc79(0x154)],'runners':this[_0x36bc79(0x17a)],'terminals':this[_0x36bc79(0x1a0)]}),this[_0x36bc79(0x169)]=new TerminalService(_0x18f5d5,this[_0x36bc79(0x1a0)]),this[_0x36bc79(0x18b)]=new WorkspaceService(_0x18f5d5,()=>{const _0x2ce9af=_0x36bc79;if(this[_0x2ce9af(0x14b)]===undefined)throw new Error(_0x2ce9af(0x1bd));return this[_0x2ce9af(0x14b)];},this[_0x36bc79(0x1b2)],_0x1312b4=>{const _0x17c4fa=_0x36bc79;this[_0x17c4fa(0x174)][_0x17c4fa(0xe8)](_0x1312b4),this[_0x17c4fa(0x134)][_0x17c4fa(0x1fa)](_0x1312b4),this[_0x17c4fa(0x1cb)][_0x17c4fa(0x204)](_0x1312b4),this[_0x17c4fa(0x134)][_0x17c4fa(0x152)](_0x1312b4);}),this[_0x36bc79(0x180)]=new WorkspaceWorkbenchService({'requireWorkspace':_0x390086=>this[_0x36bc79(0x134)][_0x36bc79(0x146)](_0x390086),'watch':this[_0x36bc79(0x138)],'files':this[_0x36bc79(0x174)],'uploads':this[_0x36bc79(0x190)],'changes':this[_0x36bc79(0x17d)],'listSessions':_0x51632a=>this[_0x36bc79(0x1cf)](_0x36bc79(0x1c1),{'workspaceId':_0x51632a,'limit':0x14}),'invalidate':_0x571053=>this[_0x36bc79(0x134)][_0x36bc79(0x204)](_0x571053),'nodeId':()=>this[_0x36bc79(0x14b)]?.[_0x36bc79(0x1a1)]??_0x36bc79(0xd6),'nodeGeneration':()=>this[_0x36bc79(0x17c)],'emitWatchEvent':_0x755592=>this[_0x36bc79(0x1f5)](_0x36bc79(0x1cd),_0x755592)}),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x17a)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x169)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x18b)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x180)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x118)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x1d4)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x200)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x1c4)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x14f)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x113)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x1e2)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](this[_0x36bc79(0x1f7)][_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](new SkillNodeOperationService(_0x18f5d5,()=>{const _0x23cefa=_0x36bc79;if(this[_0x23cefa(0x14b)]===undefined)throw new Error(_0x23cefa(0x1bd));return this[_0x23cefa(0x14b)];})[_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0xec)](new McpNodeOperationService(_0x18f5d5)[_0x36bc79(0x159)]()),this[_0x36bc79(0x19f)][_0x36bc79(0x16e)](_0x36bc79(0x144),()=>({'metrics':{...this[_0x36bc79(0x191)][_0x36bc79(0x116)](),'activeRuns':this[_0x36bc79(0x1e4)][_0x36bc79(0x173)][_0x36bc79(0x109)],'workspaceLeases':this[_0x36bc79(0x1b2)][_0x36bc79(0x1e0)]()}})),this[_0x36bc79(0x19f)][_0x36bc79(0x16e)](_0x36bc79(0x1a9),_0x502dec=>this[_0x36bc79(0x16f)][_0x36bc79(0x126)](_0x502dec)),this[_0x36bc79(0x19f)][_0x36bc79(0x16e)](_0x36bc79(0x127),()=>this[_0x36bc79(0x16f)][_0x36bc79(0x110)]()),this[_0x36bc79(0x19f)][_0x36bc79(0x16e)](_0x36bc79(0x105),async()=>({'manifest':await this[_0x36bc79(0x136)][_0x36bc79(0x11c)]()}));}async[_0x2c17e8(0x17f)](){const _0x3f4463=_0x2c17e8;this[_0x3f4463(0x203)]=![],this[_0x3f4463(0x14b)]??=await loadNodeConfig(this[_0x3f4463(0x15e)]),await this[_0x3f4463(0x16f)][_0x3f4463(0x198)](resolve(dirname(nodeDatabasePath(this[_0x3f4463(0x14b)],this[_0x3f4463(0x15e)])),_0x3f4463(0x1f0))),await assertLocalSqlitePath(nodeDatabasePath(this[_0x3f4463(0x14b)],this[_0x3f4463(0x15e)])),this[_0x3f4463(0x1b5)]??=new NodeDatabase(nodeDatabasePath(this[_0x3f4463(0x14b)],this[_0x3f4463(0x15e)]),()=>this[_0x3f4463(0x14b)]?.[_0x3f4463(0x1a1)]??_0x3f4463(0x186)),this[_0x3f4463(0x1b5)][_0x3f4463(0x1ef)](),this[_0x3f4463(0x15d)][_0x3f4463(0x17f)](),this[_0x3f4463(0x193)][_0x3f4463(0xe5)]();}[_0x2c17e8(0x16a)](){const _0x41d80a=_0x2c17e8;this[_0x41d80a(0x203)]=!![],this[_0x41d80a(0x13c)][_0x41d80a(0xe8)](),this[_0x41d80a(0x16f)][_0x41d80a(0x16a)](),this[_0x41d80a(0x15d)][_0x41d80a(0x16a)]();for(const _0x1b56e3 of this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x12f)][_0x41d80a(0x11f)]()){clearTimeout(_0x1b56e3[_0x41d80a(0x1d3)]),_0x1b56e3[_0x41d80a(0x135)](_0x41d80a(0x1e6));}this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x12f)][_0x41d80a(0xdb)]();for(const _0x5a3a2b of this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x1d1)][_0x41d80a(0x11f)]()){clearTimeout(_0x5a3a2b[_0x41d80a(0x1d3)]),_0x5a3a2b[_0x41d80a(0xf4)](_0x41d80a(0x133));}this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x1d1)][_0x41d80a(0xdb)](),this[_0x41d80a(0x1d4)][_0x41d80a(0xdb)](),this[_0x41d80a(0xf1)][_0x41d80a(0xe8)](),this[_0x41d80a(0x1c4)][_0x41d80a(0xdb)](),this[_0x41d80a(0x1f7)][_0x41d80a(0xdb)](),this[_0x41d80a(0x112)][_0x41d80a(0xdb)](),this[_0x41d80a(0x1e9)][_0x41d80a(0xe8)]();for(const _0x46b9d6 of this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x14a)][_0x41d80a(0x11f)]())_0x46b9d6[_0x41d80a(0x165)][_0x41d80a(0x110)]();this[_0x41d80a(0x171)][_0x41d80a(0x149)][_0x41d80a(0x14a)][_0x41d80a(0xdb)](),this[_0x41d80a(0x107)][_0x41d80a(0xe8)](),void this[_0x41d80a(0x190)][_0x41d80a(0x1c8)](),this[_0x41d80a(0x174)][_0x41d80a(0xe8)](),this[_0x41d80a(0x138)][_0x41d80a(0x179)](),this[_0x41d80a(0x1cb)][_0x41d80a(0xdb)](),this[_0x41d80a(0x17d)][_0x41d80a(0xdb)](),void this[_0x41d80a(0x1c5)][_0x41d80a(0x16a)](),void this[_0x41d80a(0x1a0)][_0x41d80a(0x1c8)](),this[_0x41d80a(0x10f)][_0x41d80a(0x16a)](),this[_0x41d80a(0x193)][_0x41d80a(0x16a)](),this[_0x41d80a(0x1b5)]?.[_0x41d80a(0xe0)](),this[_0x41d80a(0x1b5)]=undefined;}[_0x2c17e8(0x1de)]=_0x9f5809=>this[_0x2c17e8(0x1ab)][_0x2c17e8(0x165)](_0x9f5809);[_0x2c17e8(0x114)]=(_0x19d3d0,_0x2a2be0,_0x731777,_0x519d63)=>this[_0x2c17e8(0x18a)][_0x2c17e8(0xf2)](_0x19d3d0,_0x2a2be0,_0x731777,_0x519d63);[_0x2c17e8(0x1fd)]=(_0x103a09,_0x5c58f3)=>{const _0x1c45f7=_0x2c17e8;this[_0x1c45f7(0x112)][_0x1c45f7(0xe6)](_0x103a09);const _0x2e71c8=isPlainRecord(_0x5c58f3)&&typeof _0x5c58f3[_0x1c45f7(0xdd)]===_0x1c45f7(0x157)?_0x5c58f3[_0x1c45f7(0xdd)]:undefined,_0x4f606d=isPlainRecord(_0x5c58f3)&&typeof _0x5c58f3[_0x1c45f7(0xd4)]===_0x1c45f7(0x157)?_0x5c58f3[_0x1c45f7(0xd4)]:undefined,_0xa7de25=this[_0x1c45f7(0x1b2)][_0x1c45f7(0xdf)](_0x103a09),_0x23742e=_0x2e71c8===undefined||_0xa7de25===undefined?undefined:conversationSegmentIdentityForItem(_0xa7de25,_0x2e71c8,_0x4f606d);this[_0x1c45f7(0x18a)][_0x1c45f7(0xf2)](_0x103a09,_0x1c45f7(0x178),_0x23742e===undefined||!isPlainRecord(_0x5c58f3)?_0x5c58f3:{..._0x5c58f3,'segmentId':_0x23742e['id'],'segmentIndex':_0x23742e[_0x1c45f7(0x175)]});};[_0x2c17e8(0x1af)]=_0x2f73d6=>{const _0x1fe324=_0x2c17e8,_0x1292d5=isPlainRecord(_0x2f73d6)&&Array[_0x1fe324(0x148)](_0x2f73d6[_0x1fe324(0xf3)])?conversationSegments(_0x2f73d6):[];this[_0x1fe324(0x14e)](_0x1fe324(0xf7),{'turn':_0x2f73d6,'segments':_0x1292d5});};[_0x2c17e8(0x14e)]=(_0x3f1bfc,_0x268e8d)=>this[_0x2c17e8(0x18a)][_0x2c17e8(0x1be)](_0x3f1bfc,_0x268e8d);[_0x2c17e8(0x19c)]=_0x574350=>this[_0x2c17e8(0x101)][_0x2c17e8(0xe7)](_0x574350);[_0x2c17e8(0x13b)]=_0x4da18e=>this[_0x2c17e8(0x134)][_0x2c17e8(0x204)](_0x4da18e);[_0x2c17e8(0x1bb)]=()=>undefined;[_0x2c17e8(0x201)]=()=>this[_0x2c17e8(0x15d)][_0x2c17e8(0x201)]();[_0x2c17e8(0x187)]=()=>this[_0x2c17e8(0x15d)][_0x2c17e8(0x187)]();async[_0x2c17e8(0x1cf)](_0xe3e72c,_0x417edf){const _0x24fc3c=_0x2c17e8;if(this[_0x24fc3c(0x1b5)]===undefined)throw new Error(_0x24fc3c(0x188));if(this[_0x24fc3c(0x16f)][_0x24fc3c(0x197)](_0xe3e72c))throw new Error(_0x24fc3c(0x19d));return nodeLog(_0x24fc3c(0x115),{'nodeId':this[_0x24fc3c(0x14b)]?.[_0x24fc3c(0x1a1)],'operation':_0xe3e72c}),this[_0x24fc3c(0x19f)][_0x24fc3c(0x1b1)](_0xe3e72c,_0x417edf);}[_0x2c17e8(0x1f5)](_0x368b74,_0x4dde3c,_0x59f3a3){const _0x4113cc=_0x2c17e8;this[_0x4113cc(0x193)][_0x4113cc(0x1f5)](_0x368b74,_0x4dde3c,_0x59f3a3);}[_0x2c17e8(0x1da)](_0x17caf0){const _0x3628ef=_0x2c17e8;this[_0x3628ef(0x193)][_0x3628ef(0x1da)](_0x17caf0);}}
|