@myagentroam/node 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities.js +2 -92
- package/dist/claude-agent-sdk.js +2 -330
- package/dist/claude-channel.js +2 -44
- package/dist/codex-app-server.js +2 -503
- package/dist/config.js +2 -56
- package/dist/connector/node-connector-options.js +2 -1
- package/dist/connector/node-operation-router.js +2 -22
- package/dist/connector.js +2 -845
- package/dist/control-outbound-scheduler.js +2 -154
- package/dist/database.js +2 -1418
- package/dist/event-buffer.js +2 -19
- package/dist/fake-runner.js +2 -129
- package/dist/health.js +2 -3
- package/dist/main.js +2 -54
- package/dist/migrations/v001.js +3 -144
- package/dist/migrations/v002.js +2 -143
- package/dist/migrations/v003.js +2 -44
- package/dist/migrations/v004.js +34 -30
- package/dist/native-jsonl-reader.js +2 -186
- package/dist/native-session-history.js +2 -1119
- package/dist/opencode-runtime.js +2 -80
- package/dist/opencode-server.js +2 -263
- package/dist/operational.js +2 -122
- package/dist/process-tree.js +2 -18
- package/dist/rotating-log.js +2 -67
- package/dist/runner/abstract-runner.js +2 -232
- package/dist/runner/claude/managed-run-controller.js +2 -345
- package/dist/runner/claude-code-runner.js +2 -303
- package/dist/runner/codex/composer-image-markers.js +2 -0
- package/dist/runner/codex/conversation-parser.js +2 -861
- package/dist/runner/codex/managed-run-controller.js +2 -460
- package/dist/runner/codex-runner.js +2 -628
- package/dist/runner/fake-test-runner.js +2 -47
- package/dist/runner/opencode/conversation-parser.js +2 -221
- package/dist/runner/opencode/managed-run-controller.js +2 -537
- package/dist/runner/opencode-runner.js +2 -448
- package/dist/runner/runner-registry.js +2 -90
- package/dist/runner-command-engine.js +2 -70
- package/dist/runner-profiles.js +2 -215
- package/dist/runner-usage.js +2 -190
- package/dist/runtime-command-detector.js +2 -73
- package/dist/runtime-state.js +2 -982
- package/dist/service/attachment-domain-state.js +2 -7
- package/dist/service/conversation-history-service.js +2 -457
- package/dist/service/conversation-segment-service.js +2 -162
- package/dist/service/external-session-resume-service.js +2 -118
- package/dist/service/fake-managed-run-service.js +2 -60
- package/dist/service/managed-runner-session-service.js +2 -35
- package/dist/service/mcp-installation-verifier.js +2 -87
- package/dist/service/mcp-node-operation-service.js +2 -90
- package/dist/service/mcp-package-installer.js +2 -136
- package/dist/service/native-session-projection-service.js +2 -280
- package/dist/service/native-session-watch-service.js +2 -383
- package/dist/service/node-connection-lifecycle-service.js +2 -84
- package/dist/service/node-control-channel.js +2 -85
- package/dist/service/node-control-message-service.js +2 -107
- package/dist/service/node-request-service.js +2 -52
- package/dist/service/node-run-event-bridge.js +2 -83
- package/dist/service/node-terminal-channel.js +2 -182
- package/dist/service/node-upgrade-coordinator.js +2 -137
- package/dist/service/node-workspace-coordinator.js +2 -70
- package/dist/service/recent-run-projection-service.js +2 -78
- package/dist/service/run-attachment-service.js +2 -194
- package/dist/service/run-domain-state.js +2 -4
- package/dist/service/run-event-service.js +2 -193
- package/dist/service/run-workbench-service.js +2 -104
- package/dist/service/runner-channel-message-service.js +2 -20
- package/dist/service/runner-interaction-service.js +2 -243
- package/dist/service/runner-service.js +2 -71
- package/dist/service/session-catalog-service.js +2 -224
- package/dist/service/session-command-service.js +2 -76
- package/dist/service/session-context-service.js +2 -101
- package/dist/service/session-domain-state.js +2 -9
- package/dist/service/session-identity-service.js +2 -86
- package/dist/service/session-lifecycle-service.js +2 -240
- package/dist/service/session-message-service.js +2 -173
- package/dist/service/session-presentation-service.js +2 -43
- package/dist/service/session-query-service.js +2 -82
- package/dist/service/skill-directory-service.js +2 -238
- package/dist/service/skill-install-service.js +2 -434
- package/dist/service/skill-node-operation-service.js +2 -206
- package/dist/service/terminal-relay-state.js +2 -3
- package/dist/service/terminal-service.js +2 -52
- package/dist/service/workbench-event-service.js +2 -19
- package/dist/service/workbench-manifest-service.js +2 -69
- package/dist/service/workspace-change-service.js +2 -86
- package/dist/service/workspace-content-search-service.js +2 -477
- package/dist/service/workspace-domain-state.js +2 -41
- package/dist/service/workspace-file-service.js +2 -122
- package/dist/service/workspace-git-exclude-service.js +2 -119
- package/dist/service/workspace-queue-workbench-service.js +2 -304
- package/dist/service/workspace-service.js +2 -69
- package/dist/service/workspace-session-service.js +2 -139
- package/dist/service/workspace-upload-service.js +2 -262
- package/dist/service/workspace-watch-service.js +2 -146
- package/dist/service/workspace-workbench-service.js +2 -405
- package/dist/service.js +2 -38
- package/dist/storage.js +2 -32
- package/dist/supervisor.js +2 -136
- package/dist/terminal.js +2 -416
- package/dist/util/node-operation-parsers.js +2 -382
- package/dist/util/personal-instructions.js +2 -31
- package/dist/util/runner-error.js +2 -52
- package/dist/util/runner-native-session-parsers.js +2 -490
- package/dist/util/safe-error.js +2 -5
- package/dist/util/secret-environment.js +2 -25
- package/dist/workspace.js +2 -1519
- package/package.json +3 -3
- package/dist/capabilities.d.ts +0 -12
- package/dist/claude-agent-sdk.d.ts +0 -92
- package/dist/claude-channel.d.ts +0 -28
- package/dist/codex-app-server.d.ts +0 -133
- package/dist/config.d.ts +0 -18
- package/dist/connector/node-connector-options.d.ts +0 -27
- package/dist/connector/node-operation-router.d.ts +0 -9
- package/dist/connector.d.ts +0 -94
- package/dist/control-outbound-scheduler.d.ts +0 -29
- package/dist/database.d.ts +0 -305
- package/dist/event-buffer.d.ts +0 -9
- package/dist/fake-runner.d.ts +0 -42
- package/dist/health.d.ts +0 -4
- package/dist/main.d.ts +0 -2
- package/dist/migrations/v001.d.ts +0 -3
- package/dist/migrations/v002.d.ts +0 -4
- package/dist/migrations/v003.d.ts +0 -4
- package/dist/migrations/v004.d.ts +0 -4
- package/dist/native-jsonl-reader.d.ts +0 -35
- package/dist/native-session-history.d.ts +0 -126
- package/dist/opencode-runtime.d.ts +0 -33
- package/dist/opencode-server.d.ts +0 -49
- package/dist/operational.d.ts +0 -39
- package/dist/process-tree.d.ts +0 -9
- package/dist/rotating-log.d.ts +0 -17
- package/dist/runner/abstract-runner.d.ts +0 -172
- package/dist/runner/claude/managed-run-controller.d.ts +0 -51
- package/dist/runner/claude-code-runner.d.ts +0 -72
- package/dist/runner/codex/conversation-parser.d.ts +0 -59
- package/dist/runner/codex/managed-run-controller.d.ts +0 -90
- package/dist/runner/codex-runner.d.ts +0 -103
- package/dist/runner/fake-test-runner.d.ts +0 -26
- package/dist/runner/opencode/conversation-parser.d.ts +0 -31
- package/dist/runner/opencode/managed-run-controller.d.ts +0 -82
- package/dist/runner/opencode-runner.d.ts +0 -71
- package/dist/runner/runner-registry.d.ts +0 -19
- package/dist/runner-command-engine.d.ts +0 -28
- package/dist/runner-profiles.d.ts +0 -15
- package/dist/runner-usage.d.ts +0 -33
- package/dist/runtime-command-detector.d.ts +0 -3
- package/dist/runtime-state.d.ts +0 -171
- package/dist/service/attachment-domain-state.d.ts +0 -7
- package/dist/service/conversation-history-service.d.ts +0 -43
- package/dist/service/conversation-segment-service.d.ts +0 -20
- package/dist/service/external-session-resume-service.d.ts +0 -34
- package/dist/service/fake-managed-run-service.d.ts +0 -28
- package/dist/service/managed-runner-session-service.d.ts +0 -12
- package/dist/service/mcp-installation-verifier.d.ts +0 -9
- package/dist/service/mcp-node-operation-service.d.ts +0 -11
- package/dist/service/mcp-package-installer.d.ts +0 -8
- package/dist/service/native-session-projection-service.d.ts +0 -52
- package/dist/service/native-session-watch-service.d.ts +0 -62
- package/dist/service/node-connection-lifecycle-service.d.ts +0 -36
- package/dist/service/node-control-channel.d.ts +0 -32
- package/dist/service/node-control-message-service.d.ts +0 -27
- package/dist/service/node-request-service.d.ts +0 -14
- package/dist/service/node-run-event-bridge.d.ts +0 -40
- package/dist/service/node-terminal-channel.d.ts +0 -29
- package/dist/service/node-upgrade-coordinator.d.ts +0 -29
- package/dist/service/node-workspace-coordinator.d.ts +0 -29
- package/dist/service/recent-run-projection-service.d.ts +0 -14
- package/dist/service/run-attachment-service.d.ts +0 -38
- package/dist/service/run-domain-state.d.ts +0 -4
- package/dist/service/run-event-service.d.ts +0 -33
- package/dist/service/run-workbench-service.d.ts +0 -25
- package/dist/service/runner-channel-message-service.d.ts +0 -13
- package/dist/service/runner-interaction-service.d.ts +0 -39
- package/dist/service/runner-service.d.ts +0 -46
- package/dist/service/session-catalog-service.d.ts +0 -45
- package/dist/service/session-command-service.d.ts +0 -24
- package/dist/service/session-context-service.d.ts +0 -35
- package/dist/service/session-domain-state.d.ts +0 -9
- package/dist/service/session-identity-service.d.ts +0 -24
- package/dist/service/session-lifecycle-service.d.ts +0 -31
- package/dist/service/session-message-service.d.ts +0 -33
- package/dist/service/session-presentation-service.d.ts +0 -34
- package/dist/service/session-query-service.d.ts +0 -35
- package/dist/service/skill-directory-service.d.ts +0 -20
- package/dist/service/skill-install-service.d.ts +0 -21
- package/dist/service/skill-node-operation-service.d.ts +0 -44
- package/dist/service/terminal-relay-state.d.ts +0 -6
- package/dist/service/terminal-service.d.ts +0 -12
- package/dist/service/workbench-event-service.d.ts +0 -9
- package/dist/service/workbench-manifest-service.d.ts +0 -90
- package/dist/service/workspace-change-service.d.ts +0 -9
- package/dist/service/workspace-content-search-service.d.ts +0 -14
- package/dist/service/workspace-domain-state.d.ts +0 -79
- package/dist/service/workspace-file-service.d.ts +0 -18
- package/dist/service/workspace-git-exclude-service.d.ts +0 -4
- package/dist/service/workspace-queue-workbench-service.d.ts +0 -86
- package/dist/service/workspace-service.d.ts +0 -15
- package/dist/service/workspace-session-service.d.ts +0 -23
- package/dist/service/workspace-upload-service.d.ts +0 -39
- package/dist/service/workspace-watch-service.d.ts +0 -23
- package/dist/service/workspace-workbench-service.d.ts +0 -58
- package/dist/service.d.ts +0 -4
- package/dist/storage.d.ts +0 -2
- package/dist/supervisor.d.ts +0 -1
- package/dist/terminal.d.ts +0 -133
- package/dist/util/node-operation-parsers.d.ts +0 -92
- package/dist/util/personal-instructions.d.ts +0 -2
- package/dist/util/runner-error.d.ts +0 -6
- package/dist/util/runner-native-session-parsers.d.ts +0 -74
- package/dist/util/safe-error.d.ts +0 -2
- package/dist/util/secret-environment.d.ts +0 -1
- package/dist/workspace.d.ts +0 -217
|
@@ -1,383 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
const INTERVAL_MS = 2_000;
|
|
3
|
-
const TTL_MS = 45_000;
|
|
4
|
-
const MAX_FAILURES = 3;
|
|
5
|
-
const INITIAL_TURN_LIMIT = 30;
|
|
6
|
-
const EMITTED_TURN_LIMIT = 10;
|
|
7
|
-
export class NativeSessionWatchService {
|
|
8
|
-
options;
|
|
9
|
-
watches = new Map();
|
|
10
|
-
leases = new Map();
|
|
11
|
-
snapshotSequence = 0;
|
|
12
|
-
constructor(options) {
|
|
13
|
-
this.options = options;
|
|
14
|
-
}
|
|
15
|
-
operations() {
|
|
16
|
-
return {
|
|
17
|
-
'session.watch': (data) => this.executeWatch(isPlainRecord(data) ? data : {}),
|
|
18
|
-
'session.unwatch': (data) => this.executeUnwatch(isPlainRecord(data) ? data : {})
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
async executeWatch(input) {
|
|
22
|
-
const projectInitialPage = this.options.projectInitialPage;
|
|
23
|
-
if (input.unit === 'SEGMENT' && projectInitialPage === undefined)
|
|
24
|
-
throw new Error('SESSION_INVALID');
|
|
25
|
-
if (typeof input.sessionId !== 'string' ||
|
|
26
|
-
(input.workspaceId !== undefined && typeof input.workspaceId !== 'string') ||
|
|
27
|
-
typeof input.watchId !== 'string' ||
|
|
28
|
-
typeof input.workbenchConnectionId !== 'string' ||
|
|
29
|
-
(input.mode !== 'initial' && input.mode !== 'renew') ||
|
|
30
|
-
(input.unit !== undefined && input.unit !== 'SEGMENT'))
|
|
31
|
-
throw new Error('SESSION_INVALID');
|
|
32
|
-
const ownerKey = this.ownerKey(input);
|
|
33
|
-
if (input.mode === 'renew') {
|
|
34
|
-
const lease = this.leases.get(ownerKey);
|
|
35
|
-
if (lease === undefined ||
|
|
36
|
-
lease.watchId !== input.watchId ||
|
|
37
|
-
lease.sessionId !== input.sessionId ||
|
|
38
|
-
(input.workspaceId !== undefined && lease.workspaceId !== input.workspaceId))
|
|
39
|
-
throw new Error('SESSION_WATCH_NOT_FOUND');
|
|
40
|
-
if (lease.expiresAt <= Date.now()) {
|
|
41
|
-
this.removeLease(ownerKey);
|
|
42
|
-
throw new Error('SESSION_WATCH_NOT_FOUND');
|
|
43
|
-
}
|
|
44
|
-
lease.expiresAt = Date.now() + TTL_MS;
|
|
45
|
-
const observer = this.watches.get(lease.sessionId);
|
|
46
|
-
if (observer !== undefined)
|
|
47
|
-
observer.expiresAt = this.latestLeaseExpiry(lease.sessionId);
|
|
48
|
-
clearTimeout(lease.timer);
|
|
49
|
-
lease.timer = this.leaseTimer(ownerKey);
|
|
50
|
-
return this.accepted(lease);
|
|
51
|
-
}
|
|
52
|
-
const existing = this.leases.get(ownerKey);
|
|
53
|
-
const unit = input.unit === 'SEGMENT' ? 'SEGMENT' : 'TURN';
|
|
54
|
-
if (existing?.watchId === input.watchId &&
|
|
55
|
-
existing.sessionId === input.sessionId &&
|
|
56
|
-
(input.workspaceId === undefined || existing.workspaceId === input.workspaceId) &&
|
|
57
|
-
existing.unit === unit &&
|
|
58
|
-
existing.expiresAt > Date.now()) {
|
|
59
|
-
existing.expiresAt = Date.now() + TTL_MS;
|
|
60
|
-
clearTimeout(existing.timer);
|
|
61
|
-
existing.timer = this.leaseTimer(ownerKey);
|
|
62
|
-
return this.accepted(existing);
|
|
63
|
-
}
|
|
64
|
-
this.removeLease(ownerKey);
|
|
65
|
-
const lease = {
|
|
66
|
-
ownerKey,
|
|
67
|
-
sessionHash: this.sessionHash(input),
|
|
68
|
-
workbenchConnectionId: input.workbenchConnectionId,
|
|
69
|
-
watchId: input.watchId,
|
|
70
|
-
sessionId: input.sessionId,
|
|
71
|
-
unit,
|
|
72
|
-
nodeGeneration: this.options.nodeGeneration?.() ?? 'local-test-generation',
|
|
73
|
-
...(typeof input.workspaceId === 'string' ? { workspaceId: input.workspaceId } : {}),
|
|
74
|
-
expiresAt: Date.now() + TTL_MS,
|
|
75
|
-
timer: undefined
|
|
76
|
-
};
|
|
77
|
-
lease.timer = this.leaseTimer(ownerKey);
|
|
78
|
-
this.leases.set(ownerKey, lease);
|
|
79
|
-
const observer = this.watches.get(lease.sessionId);
|
|
80
|
-
if (observer !== undefined)
|
|
81
|
-
observer.expiresAt = this.latestLeaseExpiry(lease.sessionId);
|
|
82
|
-
void this.initializeLease(lease, projectInitialPage);
|
|
83
|
-
return this.accepted(lease);
|
|
84
|
-
}
|
|
85
|
-
executeUnwatch(input) {
|
|
86
|
-
if (typeof input.sessionId !== 'string' ||
|
|
87
|
-
typeof input.watchId !== 'string' ||
|
|
88
|
-
typeof input.workbenchConnectionId !== 'string')
|
|
89
|
-
throw new Error('SESSION_INVALID');
|
|
90
|
-
const ownerKey = this.ownerKey(input);
|
|
91
|
-
const lease = this.leases.get(ownerKey);
|
|
92
|
-
if (lease?.watchId === input.watchId && lease.sessionId === input.sessionId)
|
|
93
|
-
this.removeLease(ownerKey);
|
|
94
|
-
return { stopped: true };
|
|
95
|
-
}
|
|
96
|
-
watch(session) {
|
|
97
|
-
if (this.options.managedActive(session)) {
|
|
98
|
-
this.stop(session.id);
|
|
99
|
-
return undefined;
|
|
100
|
-
}
|
|
101
|
-
const existing = this.watches.get(session.id);
|
|
102
|
-
if (existing !== undefined) {
|
|
103
|
-
existing.expiresAt = Date.now() + TTL_MS;
|
|
104
|
-
return { expiresAt: existing.expiresAt };
|
|
105
|
-
}
|
|
106
|
-
const watch = {
|
|
107
|
-
expiresAt: Date.now() + TTL_MS,
|
|
108
|
-
refresh: undefined,
|
|
109
|
-
sessionSignature: undefined,
|
|
110
|
-
signature: undefined,
|
|
111
|
-
page: undefined,
|
|
112
|
-
observedPage: undefined,
|
|
113
|
-
authority: undefined,
|
|
114
|
-
failures: 0,
|
|
115
|
-
timer: undefined
|
|
116
|
-
};
|
|
117
|
-
watch.timer = this.refreshTimer(session.id);
|
|
118
|
-
this.watches.set(session.id, watch);
|
|
119
|
-
return { expiresAt: watch.expiresAt };
|
|
120
|
-
}
|
|
121
|
-
renew(session) {
|
|
122
|
-
if (this.options.managedActive(session)) {
|
|
123
|
-
this.stop(session.id);
|
|
124
|
-
return undefined;
|
|
125
|
-
}
|
|
126
|
-
const watch = this.watches.get(session.id);
|
|
127
|
-
if (watch === undefined || watch.expiresAt <= Date.now()) {
|
|
128
|
-
this.stop(session.id);
|
|
129
|
-
return undefined;
|
|
130
|
-
}
|
|
131
|
-
watch.expiresAt = Date.now() + TTL_MS;
|
|
132
|
-
return { expiresAt: watch.expiresAt };
|
|
133
|
-
}
|
|
134
|
-
stop(sessionId) {
|
|
135
|
-
const watch = this.watches.get(sessionId);
|
|
136
|
-
if (watch === undefined)
|
|
137
|
-
return;
|
|
138
|
-
clearTimeout(watch.timer);
|
|
139
|
-
this.watches.delete(sessionId);
|
|
140
|
-
}
|
|
141
|
-
clear() {
|
|
142
|
-
for (const watch of this.watches.values())
|
|
143
|
-
clearTimeout(watch.timer);
|
|
144
|
-
this.watches.clear();
|
|
145
|
-
for (const lease of this.leases.values())
|
|
146
|
-
clearTimeout(lease.timer);
|
|
147
|
-
this.leases.clear();
|
|
148
|
-
}
|
|
149
|
-
has(sessionId) {
|
|
150
|
-
return this.watches.has(sessionId);
|
|
151
|
-
}
|
|
152
|
-
entry(sessionId) {
|
|
153
|
-
return this.watches.get(sessionId);
|
|
154
|
-
}
|
|
155
|
-
get size() {
|
|
156
|
-
return this.watches.size;
|
|
157
|
-
}
|
|
158
|
-
async refresh(sessionId, limit = 10, emit = true) {
|
|
159
|
-
const watch = this.watches.get(sessionId);
|
|
160
|
-
if (watch === undefined)
|
|
161
|
-
return undefined;
|
|
162
|
-
if (watch.refresh !== undefined)
|
|
163
|
-
return watch.refresh;
|
|
164
|
-
if (watch.expiresAt <= Date.now()) {
|
|
165
|
-
this.stop(sessionId);
|
|
166
|
-
return undefined;
|
|
167
|
-
}
|
|
168
|
-
const refresh = this.performRefresh(sessionId, watch, limit, emit);
|
|
169
|
-
watch.refresh = refresh;
|
|
170
|
-
try {
|
|
171
|
-
return await refresh;
|
|
172
|
-
}
|
|
173
|
-
finally {
|
|
174
|
-
if (this.watches.get(sessionId) === watch) {
|
|
175
|
-
watch.refresh = undefined;
|
|
176
|
-
clearTimeout(watch.timer);
|
|
177
|
-
watch.timer = this.refreshTimer(sessionId);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
async performRefresh(sessionId, watch, limit, emit) {
|
|
182
|
-
try {
|
|
183
|
-
if (this.options.suspended?.(sessionId) === true)
|
|
184
|
-
return watch.page;
|
|
185
|
-
const session = await this.options.resolve(sessionId);
|
|
186
|
-
if (session === undefined ||
|
|
187
|
-
session.externalSessionId === null ||
|
|
188
|
-
this.options.managedActive(session)) {
|
|
189
|
-
this.releaseSessionLeases(sessionId);
|
|
190
|
-
return undefined;
|
|
191
|
-
}
|
|
192
|
-
await this.options.refreshActivity(session);
|
|
193
|
-
if (this.options.suspended?.(sessionId) === true)
|
|
194
|
-
return watch.page;
|
|
195
|
-
const presented = this.options.present(session);
|
|
196
|
-
const sessionSignature = JSON.stringify(presented);
|
|
197
|
-
if (sessionSignature !== watch.sessionSignature) {
|
|
198
|
-
watch.sessionSignature = sessionSignature;
|
|
199
|
-
this.options.emitSession(presented);
|
|
200
|
-
}
|
|
201
|
-
const page = await this.options.readPage(session, limit);
|
|
202
|
-
watch.failures = 0;
|
|
203
|
-
const turns = page.turns.length <= EMITTED_TURN_LIMIT
|
|
204
|
-
? page.turns
|
|
205
|
-
: page.turns.slice(-EMITTED_TURN_LIMIT);
|
|
206
|
-
const observed = { ...page, turns };
|
|
207
|
-
const convergence = this.options.convergePage(watch.page, watch.observedPage, observed, watch.authority);
|
|
208
|
-
const converged = convergence.page;
|
|
209
|
-
const accepted = converged.turns.length <= EMITTED_TURN_LIMIT + 1
|
|
210
|
-
? converged
|
|
211
|
-
: {
|
|
212
|
-
...converged,
|
|
213
|
-
turns: converged.turns.slice(-(EMITTED_TURN_LIMIT + 1))
|
|
214
|
-
};
|
|
215
|
-
watch.observedPage = observed;
|
|
216
|
-
watch.authority = convergence.authority;
|
|
217
|
-
const signature = JSON.stringify({ source: accepted.source, turns: accepted.turns });
|
|
218
|
-
if (signature === watch.signature)
|
|
219
|
-
return accepted;
|
|
220
|
-
watch.signature = signature;
|
|
221
|
-
watch.page = accepted;
|
|
222
|
-
if (emit)
|
|
223
|
-
this.emitObservedPage(session, accepted);
|
|
224
|
-
return emit ? accepted : page;
|
|
225
|
-
}
|
|
226
|
-
catch {
|
|
227
|
-
watch.failures += 1;
|
|
228
|
-
if (watch.failures >= MAX_FAILURES)
|
|
229
|
-
this.failSession(sessionId);
|
|
230
|
-
return undefined;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
sessionHash(input) {
|
|
234
|
-
return typeof input.__workspaceWatchSessionHash === 'string'
|
|
235
|
-
? input.__workspaceWatchSessionHash
|
|
236
|
-
: 'local-test';
|
|
237
|
-
}
|
|
238
|
-
ownerKey(input) {
|
|
239
|
-
return `${this.sessionHash(input)}:${input.workbenchConnectionId}`;
|
|
240
|
-
}
|
|
241
|
-
accepted(lease) {
|
|
242
|
-
return {
|
|
243
|
-
accepted: true,
|
|
244
|
-
watchId: lease.watchId,
|
|
245
|
-
nodeGeneration: lease.nodeGeneration,
|
|
246
|
-
expiresAt: lease.expiresAt
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
async initializeLease(lease, projectInitialPage) {
|
|
250
|
-
try {
|
|
251
|
-
const session = await this.options.resolve(lease.sessionId);
|
|
252
|
-
if (session === undefined || session.externalSessionId === null)
|
|
253
|
-
throw new Error('SESSION_NOT_FOUND');
|
|
254
|
-
if (lease.workspaceId !== undefined && session.workspaceId !== lease.workspaceId)
|
|
255
|
-
throw new Error('SESSION_WORKSPACE_MISMATCH');
|
|
256
|
-
if (this.leases.get(lease.ownerKey) !== lease)
|
|
257
|
-
return;
|
|
258
|
-
lease.workspaceId = session.workspaceId;
|
|
259
|
-
const watch = this.watch(session);
|
|
260
|
-
const page = watch === undefined ? undefined : await this.refresh(session.id, INITIAL_TURN_LIMIT, false);
|
|
261
|
-
if (page === undefined)
|
|
262
|
-
throw new Error('NATIVE_TRANSCRIPT_UNAVAILABLE');
|
|
263
|
-
const payload = lease.unit === 'SEGMENT' ? projectInitialPage(session, page, 'SEGMENT', 10) : page;
|
|
264
|
-
if (this.leases.get(lease.ownerKey) !== lease)
|
|
265
|
-
return;
|
|
266
|
-
this.options.emitWatchEvent?.({
|
|
267
|
-
type: 'watch.session.snapshot',
|
|
268
|
-
workbenchConnectionId: lease.workbenchConnectionId,
|
|
269
|
-
watchId: lease.watchId,
|
|
270
|
-
nodeGeneration: lease.nodeGeneration,
|
|
271
|
-
nodeId: this.options.nodeId?.() ?? 'local-test-node',
|
|
272
|
-
workspaceId: session.workspaceId,
|
|
273
|
-
sessionId: session.id,
|
|
274
|
-
revision: 1,
|
|
275
|
-
snapshotSequence: ++this.snapshotSequence,
|
|
276
|
-
expiresAt: lease.expiresAt,
|
|
277
|
-
payload
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
catch (error) {
|
|
281
|
-
if (this.leases.get(lease.ownerKey) !== lease)
|
|
282
|
-
return;
|
|
283
|
-
this.options.emitWatchEvent?.({
|
|
284
|
-
type: 'watch.failed',
|
|
285
|
-
workbenchConnectionId: lease.workbenchConnectionId,
|
|
286
|
-
watchType: 'session',
|
|
287
|
-
watchId: lease.watchId,
|
|
288
|
-
nodeGeneration: lease.nodeGeneration,
|
|
289
|
-
nodeId: this.options.nodeId?.() ?? 'local-test-node',
|
|
290
|
-
workspaceId: lease.workspaceId ?? 'unknown',
|
|
291
|
-
sessionId: lease.sessionId,
|
|
292
|
-
code: error instanceof Error && /^[A-Z][A-Z0-9_]+$/.test(error.message)
|
|
293
|
-
? error.message
|
|
294
|
-
: 'SESSION_WATCH_SNAPSHOT_FAILED',
|
|
295
|
-
message: 'Session watch snapshot failed.'
|
|
296
|
-
});
|
|
297
|
-
this.removeLease(lease.ownerKey);
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
removeLease(ownerKey) {
|
|
301
|
-
const lease = this.leases.get(ownerKey);
|
|
302
|
-
if (lease === undefined)
|
|
303
|
-
return;
|
|
304
|
-
clearTimeout(lease.timer);
|
|
305
|
-
this.leases.delete(ownerKey);
|
|
306
|
-
const observer = this.watches.get(lease.sessionId);
|
|
307
|
-
const nextExpiry = this.latestLeaseExpiry(lease.sessionId);
|
|
308
|
-
if (nextExpiry === 0)
|
|
309
|
-
this.stop(lease.sessionId);
|
|
310
|
-
else if (observer !== undefined)
|
|
311
|
-
observer.expiresAt = nextExpiry;
|
|
312
|
-
}
|
|
313
|
-
emitObservedPage(session, page) {
|
|
314
|
-
const leases = [...this.leases.values()].filter((lease) => lease.sessionId === session.id);
|
|
315
|
-
if (leases.length === 0) {
|
|
316
|
-
this.options.emitPage(session, page);
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
for (const lease of leases) {
|
|
320
|
-
const payload = lease.unit === 'SEGMENT'
|
|
321
|
-
? this.options.projectInitialPage?.(session, page, 'SEGMENT', 10)
|
|
322
|
-
: page;
|
|
323
|
-
if (payload === undefined)
|
|
324
|
-
continue;
|
|
325
|
-
this.options.emitWatchEvent?.({
|
|
326
|
-
type: 'watch.session.snapshot',
|
|
327
|
-
workbenchConnectionId: lease.workbenchConnectionId,
|
|
328
|
-
watchId: lease.watchId,
|
|
329
|
-
nodeGeneration: lease.nodeGeneration,
|
|
330
|
-
nodeId: this.options.nodeId?.() ?? 'local-test-node',
|
|
331
|
-
workspaceId: session.workspaceId,
|
|
332
|
-
sessionId: session.id,
|
|
333
|
-
revision: 1,
|
|
334
|
-
snapshotSequence: ++this.snapshotSequence,
|
|
335
|
-
expiresAt: lease.expiresAt,
|
|
336
|
-
payload
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
failSession(sessionId) {
|
|
341
|
-
for (const lease of [...this.leases.values()]) {
|
|
342
|
-
if (lease.sessionId !== sessionId)
|
|
343
|
-
continue;
|
|
344
|
-
this.options.emitWatchEvent?.({
|
|
345
|
-
type: 'watch.failed',
|
|
346
|
-
workbenchConnectionId: lease.workbenchConnectionId,
|
|
347
|
-
watchType: 'session',
|
|
348
|
-
watchId: lease.watchId,
|
|
349
|
-
nodeGeneration: lease.nodeGeneration,
|
|
350
|
-
nodeId: this.options.nodeId?.() ?? 'local-test-node',
|
|
351
|
-
workspaceId: lease.workspaceId ?? 'unknown',
|
|
352
|
-
sessionId,
|
|
353
|
-
code: 'NATIVE_TRANSCRIPT_UNAVAILABLE',
|
|
354
|
-
message: 'Session watch snapshot failed.'
|
|
355
|
-
});
|
|
356
|
-
this.removeLease(lease.ownerKey);
|
|
357
|
-
}
|
|
358
|
-
this.stop(sessionId);
|
|
359
|
-
}
|
|
360
|
-
releaseSessionLeases(sessionId) {
|
|
361
|
-
for (const lease of [...this.leases.values()])
|
|
362
|
-
if (lease.sessionId === sessionId)
|
|
363
|
-
this.removeLease(lease.ownerKey);
|
|
364
|
-
this.stop(sessionId);
|
|
365
|
-
}
|
|
366
|
-
leaseTimer(ownerKey) {
|
|
367
|
-
const timer = setTimeout(() => this.removeLease(ownerKey), TTL_MS);
|
|
368
|
-
timer.unref();
|
|
369
|
-
return timer;
|
|
370
|
-
}
|
|
371
|
-
latestLeaseExpiry(sessionId) {
|
|
372
|
-
let latest = 0;
|
|
373
|
-
for (const lease of this.leases.values())
|
|
374
|
-
if (lease.sessionId === sessionId)
|
|
375
|
-
latest = Math.max(latest, lease.expiresAt);
|
|
376
|
-
return latest;
|
|
377
|
-
}
|
|
378
|
-
refreshTimer(sessionId) {
|
|
379
|
-
const timer = setTimeout(() => void this.refresh(sessionId), INTERVAL_MS);
|
|
380
|
-
timer.unref();
|
|
381
|
-
return timer;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
function _0x401b(){const _0x2a0187=['z2v0','u0vtu0LptL9xqvrdsf9ot1rFrK9vtKq','C2vZC2LVBKLK','B3bLCMf0Aw9UCW','B3b0Aw9UCW','CMvMCMvZAefJDgL2Axr5','Bg9JywWTDgvZDc1Nzw5LCMf0Aw9U','zw1PDf9WywDL','BM93','zMLSDgvY','Aw5PDgLHBa','DgvZDa','D2f0y2Hjza','ndi5odKYwKj5tunq','zgvSzxrL','zw50CNK','zw1PDfbHz2u','zMfPBfnLC3nPB24','C291CMnL','zw1PDfnLC3nPB24','BgvHC2vZ','D2f0y2G','B2jQzwn0','C2vZC2LVBI53yxrJAc5YzwzYzxnOlMzHAwXLza','nZiWnNboDufIza','C2L6zq','tKfusvzfx1rsqu5tq1jjufrFvu5bvKfjtefcteu','C2XPy2u','D2f0y2GUzMfPBgvK','Bg9JywWTDgvZDa','mta3ode3nxnTqKTKsG','u0vtu0LptL9xqvrdsf9sruzsrvnix0zbsuXfra','mZu2nZmWnfztt3LtsG','BM9KzuLK','y29UDMvYz2vqywDL','zw1PDe9IC2vYDMvKugfNzq','u0vtu0LptL9jtLzbteLe','C3rVCa','Dw5Yzwy','vfvstG','zxHLy3v0zvvUD2f0y2G','mJa5oti4mZbRzfbVDve','u0vtu0LptL9xqvrdsf9ttKfqu0Hpvf9gquLmruq','x193B3jRC3bHy2vxyxrJAfnLC3nPB25iyxnO','BgvHC2vuAw1LCG','Bwf4','CMvTB3zLtgvHC2u','y2XLyxi','u0vtu0LptL9ot1rFrK9vtKq','C2vZC2LVBLnPz25HDhvYzq','ndCWntDTwLHUuei','C2vZC2LVBG','mtfeC2PZt20','CMvZB2X2zq','zMfPBhvYzxm','ywnJzxb0zwq','AgfZ','Aw5PDgLHBf9YzwzYzxnO','D29YA2jLBMnOq29UBMvJDgLVBKLK','C3rYAw5N','BwfUywDLzefJDgL2zq','DgLTzxi','ChjVAMvJDeLUAxrPywXqywDL','CMvHzfbHz2u','D2f0y2GUC2vZC2LVBI5ZBMfWC2HVDa','m2z1BMzpzq','D29YA3nWywnLswq','ChjLC2vUDf9ZzxnZAw9U','mZeXmhjSAw9kvW','CMvHzf9WywDL','zw1PDfDHDgnOrxzLBNq','Dw5PDa','zxHLy3v0zvDHDgnO','CgfNzq','C2vZC2LVBKHHC2G','C3vZCgvUzgvK','BgvUz3rO','Dw5RBM93BG','C3rYAw5NAwz5','y29UDMvYz2vFCgfNzq','ChjLC2vUDa','zxHWAxjLC0f0','D2f0y2HLCW','u2vZC2LVBIb3yxrJAcbZBMfWC2HVDcbMywLSzwqU','CMvMCMvZAfrPBwvY','C2vZC2LVBI53yxrJAc5PBML0AwfSlMzHAwXLza','u0vhtuvova','CMvSzwfZzvnLC3nPB25mzwfZzxm','B2jZzxj2zwrqywDL','CgvYzM9YBvjLzNjLC2G','CMvMCMvZAf9Hy3rPDML0Eq','zxH0zxjUywXtzxnZAw9Uswq','B3DUzxjlzxK','Bgf0zxn0tgvHC2vfEhbPCNK','CNvUBMvY','ChjVAMvJDf9ZBMfWC2HVDa','Aw5PDgLHBgL6zuXLyxnL','mty0otq1ngLpt0T2BG','Bw9Kzq','DhvYBNm','C25HChnOB3rtzxf1zw5Jzq','Bg9N','Bg9JywWTDgvZDc1UB2rL','CMvMCMvZAa','C2v0','yxv0Ag9YAxr5','y29Kzq','CMvUzxC','BM9KzuDLBMvYyxrPB24','mtHTDezprwK','DMfSDwvZ','u0vtu0LptL9xt1jlu1bbq0vFtuLttufuq0G','C2LNBMf0DxjL'];_0x401b=function(){return _0x2a0187;};return _0x401b();}const _0x205735=_0x4719;(function(_0x388f09,_0x9ed34c){const _0x145362=_0x4719,_0x5c5a2d=_0x388f09();while(!![]){try{const _0x30c063=parseInt(_0x145362(0x182))/(0x1*0x13e7+0x1ff8+-0x33de)+parseInt(_0x145362(0x140))/(0x13*0x199+-0x137*0x15+-0x4d6)+-parseInt(_0x145362(0x191))/(0x3b5*0x6+0x109d*-0x2+-0x1*-0xaff)*(parseInt(_0x145362(0x15d))/(-0x2f6*-0xd+-0xf3*-0x18+-0x3d42))+parseInt(_0x145362(0x194))/(-0x1a17*0x1+0x2*-0x533+0x2482)*(parseInt(_0x145362(0x168))/(-0x1247+0x1979+0x1cb*-0x4))+parseInt(_0x145362(0x16e))/(-0x1083+0xb53+0x537)+-parseInt(_0x145362(0x170))/(-0x1*0x14b6+0x26e+0x1250)*(-parseInt(_0x145362(0x14c))/(-0x2255+0x47*-0x23+-0x2c13*-0x1))+parseInt(_0x145362(0x179))/(0x2453*0x1+-0x77b*0x3+-0xdd8)*(-parseInt(_0x145362(0x184))/(-0x135a+-0x153e+0x65*0x67));if(_0x30c063===_0x9ed34c)break;else _0x5c5a2d['push'](_0x5c5a2d['shift']());}catch(_0x340c1b){_0x5c5a2d['push'](_0x5c5a2d['shift']());}}}(_0x401b,-0xad662+0x4*0x15df4+0xc5b3f));function _0x4719(_0x29b202,_0x558233){_0x29b202=_0x29b202-(0x2a*-0x47+0xb33+0x199);const _0x3d01e0=_0x401b();let _0x3a270d=_0x3d01e0[_0x29b202];if(_0x4719['goqUnD']===undefined){var _0x1cd392=function(_0x479871){const _0x4be4f3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4f225c='',_0x50f0ce='';for(let _0x5702b7=0xe80+-0xe47+-0x39,_0x52b6b5,_0x2949c6,_0xcecd8d=-0x1*0x1df+-0x1*-0x200c+-0x19*0x135;_0x2949c6=_0x479871['charAt'](_0xcecd8d++);~_0x2949c6&&(_0x52b6b5=_0x5702b7%(0x1cd+-0x10e5+0xf1c)?_0x52b6b5*(-0x1*-0x9d+-0x129a+0x123d)+_0x2949c6:_0x2949c6,_0x5702b7++%(-0x238c+0x28e+0x2102))?_0x4f225c+=String['fromCharCode'](-0x1f96+0x207*0xf+0x22c&_0x52b6b5>>(-(0x1*0x100+-0xfa5+0xea7)*_0x5702b7&0x1c1a+-0xbfa+-0x101a)):0x27*-0xa1+-0x632+0x1eb9){_0x2949c6=_0x4be4f3['indexOf'](_0x2949c6);}for(let _0x12f115=-0x11c*0x11+0x18e5+-0x609,_0x5d3b75=_0x4f225c['length'];_0x12f115<_0x5d3b75;_0x12f115++){_0x50f0ce+='%'+('00'+_0x4f225c['charCodeAt'](_0x12f115)['toString'](-0x1*0xb7b+0x20f1+-0x1566))['slice'](-(-0x43*0x7f+-0xda9+0x2ee8));}return decodeURIComponent(_0x50f0ce);};_0x4719['FvqrzI']=_0x1cd392,_0x4719['PzoLbL']={},_0x4719['goqUnD']=!![];}const _0x3a207f=_0x3d01e0[0x1cca+-0x5*0x165+-0x15d1];_0x4719['barcfe']!==_0x3a207f&&(_0x4719['PzoLbL']={},_0x4719['barcfe']=_0x3a207f);const _0x2de2fb=_0x4719['PzoLbL'][_0x29b202];return _0x2de2fb===undefined?(_0x3a270d=_0x4719['FvqrzI'](_0x3a270d),_0x4719['PzoLbL'][_0x29b202]=_0x3a270d):_0x3a270d=_0x2de2fb,_0x3a270d;}import{isPlainRecord}from'../runner/codex/conversation-parser.js';import{safeErrorCode}from'../util/safe-error.js';const INTERVAL_MS=0x1*-0x3e9+-0x1df+-0x2*-0x6cc,TTL_MS=-0x1*-0xff85+-0x7b05+0x2b48,MAX_FAILURES=-0x603+-0x1*-0x9d+0x569,INITIAL_TURN_LIMIT=-0x1a*0x62+-0x238c+0x2d9e,EMITTED_TURN_LIMIT=-0x1f96+0x207*0xf+0x137;export class NativeSessionWatchService{[_0x205735(0x154)];[_0x205735(0x131)]=new Map();[_0x205735(0x164)]=new Map();[_0x205735(0x143)]=0x1*0x100+-0xfa5+0xea5;constructor(_0x173a2a){const _0x14ec99=_0x205735;this[_0x14ec99(0x154)]=_0x173a2a;}[_0x205735(0x153)](){const _0x12be8e=_0x205735;return{'session.watch':_0x301be2=>this[_0x12be8e(0x127)](isPlainRecord(_0x301be2)?_0x301be2:{}),'session.unwatch':_0x50fbc8=>this[_0x12be8e(0x178)](isPlainRecord(_0x50fbc8)?_0x50fbc8:{})};}async[_0x205735(0x127)](_0x7e2790){const _0xe1e6cc=_0x205735,_0x485148=this[_0xe1e6cc(0x154)][_0xe1e6cc(0x18e)];if(_0x7e2790[_0xe1e6cc(0x126)]===_0xe1e6cc(0x135)&&_0x485148===undefined)throw new Error(_0xe1e6cc(0x174));if(typeof _0x7e2790[_0xe1e6cc(0x152)]!==_0xe1e6cc(0x18b)||_0x7e2790[_0xe1e6cc(0x192)]!==undefined&&typeof _0x7e2790[_0xe1e6cc(0x192)]!==_0xe1e6cc(0x18b)||typeof _0x7e2790[_0xe1e6cc(0x15c)]!==_0xe1e6cc(0x18b)||typeof _0x7e2790[_0xe1e6cc(0x18a)]!==_0xe1e6cc(0x18b)||_0x7e2790[_0xe1e6cc(0x141)]!==_0xe1e6cc(0x15a)&&_0x7e2790[_0xe1e6cc(0x141)]!==_0xe1e6cc(0x14a)||_0x7e2790[_0xe1e6cc(0x126)]!==undefined&&_0x7e2790[_0xe1e6cc(0x126)]!==_0xe1e6cc(0x135))throw new Error(_0xe1e6cc(0x174));const _0x9cde9b=this[_0xe1e6cc(0x13b)](_0x7e2790);if(_0x7e2790[_0xe1e6cc(0x141)]===_0xe1e6cc(0x14a)){const _0x27c5c6=this[_0xe1e6cc(0x164)][_0xe1e6cc(0x150)](_0x9cde9b);if(_0x27c5c6===undefined||_0x27c5c6[_0xe1e6cc(0x15c)]!==_0x7e2790[_0xe1e6cc(0x15c)]||_0x27c5c6[_0xe1e6cc(0x152)]!==_0x7e2790[_0xe1e6cc(0x152)]||_0x7e2790[_0xe1e6cc(0x192)]!==undefined&&_0x27c5c6[_0xe1e6cc(0x192)]!==_0x7e2790[_0xe1e6cc(0x192)])throw new Error(_0xe1e6cc(0x151));if(_0x27c5c6[_0xe1e6cc(0x130)]<=Date[_0xe1e6cc(0x158)]()){this[_0xe1e6cc(0x17e)](_0x9cde9b);throw new Error(_0xe1e6cc(0x151));}_0x27c5c6[_0xe1e6cc(0x130)]=Date[_0xe1e6cc(0x158)]()+TTL_MS;const _0x24a454=this[_0xe1e6cc(0x131)][_0xe1e6cc(0x150)](_0x27c5c6[_0xe1e6cc(0x152)]);if(_0x24a454!==undefined)_0x24a454[_0xe1e6cc(0x130)]=this[_0xe1e6cc(0x13c)](_0x27c5c6[_0xe1e6cc(0x152)]);return clearTimeout(_0x27c5c6[_0xe1e6cc(0x18d)]),_0x27c5c6[_0xe1e6cc(0x18d)]=this[_0xe1e6cc(0x17c)](_0x9cde9b),this[_0xe1e6cc(0x187)](_0x27c5c6);}const _0x4861a8=this[_0xe1e6cc(0x164)][_0xe1e6cc(0x150)](_0x9cde9b),_0x5b9b7a=_0x7e2790[_0xe1e6cc(0x126)]===_0xe1e6cc(0x135)?_0xe1e6cc(0x135):_0xe1e6cc(0x177);if(_0x4861a8?.[_0xe1e6cc(0x15c)]===_0x7e2790[_0xe1e6cc(0x15c)]&&_0x4861a8[_0xe1e6cc(0x152)]===_0x7e2790[_0xe1e6cc(0x152)]&&(_0x7e2790[_0xe1e6cc(0x192)]===undefined||_0x4861a8[_0xe1e6cc(0x192)]===_0x7e2790[_0xe1e6cc(0x192)])&&_0x4861a8[_0xe1e6cc(0x126)]===_0x5b9b7a&&_0x4861a8[_0xe1e6cc(0x130)]>Date[_0xe1e6cc(0x158)]())return _0x4861a8[_0xe1e6cc(0x130)]=Date[_0xe1e6cc(0x158)]()+TTL_MS,clearTimeout(_0x4861a8[_0xe1e6cc(0x18d)]),_0x4861a8[_0xe1e6cc(0x18d)]=this[_0xe1e6cc(0x17c)](_0x9cde9b),this[_0xe1e6cc(0x187)](_0x4861a8);this[_0xe1e6cc(0x17e)](_0x9cde9b);const _0x14531e={'ownerKey':_0x9cde9b,'sessionHash':this[_0xe1e6cc(0x129)](_0x7e2790),'workbenchConnectionId':_0x7e2790[_0xe1e6cc(0x18a)],'watchId':_0x7e2790[_0xe1e6cc(0x15c)],'sessionId':_0x7e2790[_0xe1e6cc(0x152)],'unit':_0x5b9b7a,'nodeGeneration':this[_0xe1e6cc(0x154)][_0xe1e6cc(0x14b)]?.()??_0xe1e6cc(0x156),...typeof _0x7e2790[_0xe1e6cc(0x192)]===_0xe1e6cc(0x18b)?{'workspaceId':_0x7e2790[_0xe1e6cc(0x192)]}:{},'expiresAt':Date[_0xe1e6cc(0x158)]()+TTL_MS,'timer':undefined};_0x14531e[_0xe1e6cc(0x18d)]=this[_0xe1e6cc(0x17c)](_0x9cde9b),this[_0xe1e6cc(0x164)][_0xe1e6cc(0x147)](_0x9cde9b,_0x14531e);const _0x44ac06=this[_0xe1e6cc(0x131)][_0xe1e6cc(0x150)](_0x14531e[_0xe1e6cc(0x152)]);if(_0x44ac06!==undefined)_0x44ac06[_0xe1e6cc(0x130)]=this[_0xe1e6cc(0x13c)](_0x14531e[_0xe1e6cc(0x152)]);return void this[_0xe1e6cc(0x13f)](_0x14531e,_0x485148),this[_0xe1e6cc(0x187)](_0x14531e);}[_0x205735(0x178)](_0x40f82f){const _0x7b36f4=_0x205735;if(typeof _0x40f82f[_0x7b36f4(0x152)]!==_0x7b36f4(0x18b)||typeof _0x40f82f[_0x7b36f4(0x15c)]!==_0x7b36f4(0x18b)||typeof _0x40f82f[_0x7b36f4(0x18a)]!==_0x7b36f4(0x18b))throw new Error(_0x7b36f4(0x174));const _0x23218f=this[_0x7b36f4(0x13b)](_0x40f82f),_0x54b9ae=this[_0x7b36f4(0x164)][_0x7b36f4(0x150)](_0x23218f);if(_0x54b9ae?.[_0x7b36f4(0x15c)]===_0x40f82f[_0x7b36f4(0x15c)]&&_0x54b9ae[_0x7b36f4(0x152)]===_0x40f82f[_0x7b36f4(0x152)])this[_0x7b36f4(0x17e)](_0x23218f);return{'stopped':!![]};}[_0x205735(0x165)](_0x4e1d09){const _0x2bd023=_0x205735;if(this[_0x2bd023(0x154)][_0x2bd023(0x18c)](_0x4e1d09))return this[_0x2bd023(0x175)](_0x4e1d09['id']),undefined;const _0x2f52d1=this[_0x2bd023(0x131)][_0x2bd023(0x150)](_0x4e1d09['id']);if(_0x2f52d1!==undefined)return _0x2f52d1[_0x2bd023(0x130)]=Date[_0x2bd023(0x158)]()+TTL_MS,{'expiresAt':_0x2f52d1[_0x2bd023(0x130)]};const _0xa85df0={'expiresAt':Date[_0x2bd023(0x158)]()+TTL_MS,'refresh':undefined,'sessionSignature':undefined,'signature':undefined,'page':undefined,'observedPage':undefined,'authority':undefined,'failures':0x0,'timer':undefined};return _0xa85df0[_0x2bd023(0x18d)]=this[_0x2bd023(0x133)](_0x4e1d09['id']),this[_0x2bd023(0x131)][_0x2bd023(0x147)](_0x4e1d09['id'],_0xa85df0),{'expiresAt':_0xa85df0[_0x2bd023(0x130)]};}[_0x205735(0x14a)](_0x50614e){const _0x3899bb=_0x205735;if(this[_0x3899bb(0x154)][_0x3899bb(0x18c)](_0x50614e))return this[_0x3899bb(0x175)](_0x50614e['id']),undefined;const _0x2f2658=this[_0x3899bb(0x131)][_0x3899bb(0x150)](_0x50614e['id']);if(_0x2f2658===undefined||_0x2f2658[_0x3899bb(0x130)]<=Date[_0x3899bb(0x158)]())return this[_0x3899bb(0x175)](_0x50614e['id']),undefined;return _0x2f2658[_0x3899bb(0x130)]=Date[_0x3899bb(0x158)]()+TTL_MS,{'expiresAt':_0x2f2658[_0x3899bb(0x130)]};}[_0x205735(0x175)](_0x3bfef0){const _0x24b014=_0x205735,_0x1657de=this[_0x24b014(0x131)][_0x24b014(0x150)](_0x3bfef0);if(_0x1657de===undefined)return;clearTimeout(_0x1657de[_0x24b014(0x18d)]),this[_0x24b014(0x131)][_0x24b014(0x15e)](_0x3bfef0);}[_0x205735(0x17f)](){const _0x4ad9e1=_0x205735;for(const _0x359d24 of this[_0x4ad9e1(0x131)][_0x4ad9e1(0x14d)]())clearTimeout(_0x359d24[_0x4ad9e1(0x18d)]);this[_0x4ad9e1(0x131)][_0x4ad9e1(0x17f)]();for(const _0x596bb0 of this[_0x4ad9e1(0x164)][_0x4ad9e1(0x14d)]())clearTimeout(_0x596bb0[_0x4ad9e1(0x18d)]);this[_0x4ad9e1(0x164)][_0x4ad9e1(0x17f)]();}[_0x205735(0x188)](_0x71c6d6){const _0x561976=_0x205735;return this[_0x561976(0x131)][_0x561976(0x188)](_0x71c6d6);}[_0x205735(0x15f)](_0x180c43){const _0x336409=_0x205735;return this[_0x336409(0x131)][_0x336409(0x150)](_0x180c43);}get[_0x205735(0x169)](){const _0xd09a15=_0x205735;return this[_0xd09a15(0x131)][_0xd09a15(0x169)];}async[_0x205735(0x146)](_0x4e142d,_0x14fff8=0x1c1a+-0xbfa+-0x1016,_0x40161f=!![]){const _0xe450e1=_0x205735,_0x2bfc68=this[_0xe450e1(0x131)][_0xe450e1(0x150)](_0x4e142d);if(_0x2bfc68===undefined)return undefined;if(_0x2bfc68[_0xe450e1(0x146)]!==undefined)return _0x2bfc68[_0xe450e1(0x146)];if(_0x2bfc68[_0xe450e1(0x130)]<=Date[_0xe450e1(0x158)]())return this[_0xe450e1(0x175)](_0x4e142d),undefined;const _0x17c0aa=this[_0xe450e1(0x138)](_0x4e142d,_0x2bfc68,_0x14fff8,_0x40161f);_0x2bfc68[_0xe450e1(0x146)]=_0x17c0aa;try{return await _0x17c0aa;}finally{this[_0xe450e1(0x131)][_0xe450e1(0x150)](_0x4e142d)===_0x2bfc68&&(_0x2bfc68[_0xe450e1(0x146)]=undefined,clearTimeout(_0x2bfc68[_0xe450e1(0x18d)]),_0x2bfc68[_0xe450e1(0x18d)]=this[_0xe450e1(0x133)](_0x4e142d));}}async[_0x205735(0x138)](_0x4d5895,_0x3c1104,_0x319c19,_0x1a93a3){const _0xe413f3=_0x205735;let _0xa70b33=_0xe413f3(0x185),_0x12bd28;try{if(this[_0xe413f3(0x154)][_0xe413f3(0x12a)]?.(_0x4d5895)===!![])return _0x3c1104[_0xe413f3(0x128)];_0x12bd28=await this[_0xe413f3(0x154)][_0xe413f3(0x185)](_0x4d5895);if(_0x12bd28===undefined||_0x12bd28[_0xe413f3(0x13a)]===null||this[_0xe413f3(0x154)][_0xe413f3(0x18c)](_0x12bd28))return this[_0xe413f3(0x136)](_0x4d5895),undefined;_0xa70b33=_0xe413f3(0x139),await this[_0xe413f3(0x154)][_0xe413f3(0x155)](_0x12bd28);if(this[_0xe413f3(0x154)][_0xe413f3(0x12a)]?.(_0x4d5895)===!![])return _0x3c1104[_0xe413f3(0x128)];_0xa70b33=_0xe413f3(0x193);const _0xf4855c=this[_0xe413f3(0x154)][_0xe413f3(0x12f)](_0x12bd28),_0x3df3b2=JSON[_0xe413f3(0x12d)](_0xf4855c);_0x3df3b2!==_0x3c1104[_0xe413f3(0x181)]&&(_0x3c1104[_0xe413f3(0x181)]=_0x3df3b2,this[_0xe413f3(0x154)][_0xe413f3(0x163)](_0xf4855c));_0xa70b33=_0xe413f3(0x195);const _0x151c51=await this[_0xe413f3(0x154)][_0xe413f3(0x18f)](_0x12bd28,_0x319c19);_0x3c1104[_0xe413f3(0x186)]=0x27*-0xa1+-0x632+0x1eb9;const _0xb372e3=_0x151c51[_0xe413f3(0x142)][_0xe413f3(0x12b)]<=EMITTED_TURN_LIMIT?_0x151c51[_0xe413f3(0x142)]:_0x151c51[_0xe413f3(0x142)][_0xe413f3(0x16b)](-EMITTED_TURN_LIMIT),_0x1d6426={..._0x151c51,'turns':_0xb372e3};_0xa70b33=_0xe413f3(0x12e);const _0x4d8f2a=this[_0xe413f3(0x154)][_0xe413f3(0x172)](_0x3c1104[_0xe413f3(0x128)],_0x3c1104[_0xe413f3(0x137)],_0x1d6426,_0x3c1104[_0xe413f3(0x148)]),_0x247d32=_0x4d8f2a[_0xe413f3(0x128)],_0x46f824=_0x247d32[_0xe413f3(0x142)][_0xe413f3(0x12b)]<=EMITTED_TURN_LIMIT+(-0x11c*0x11+0x18e5+-0x608)?_0x247d32:{..._0x247d32,'turns':_0x247d32[_0xe413f3(0x142)][_0xe413f3(0x16b)](-(EMITTED_TURN_LIMIT+(-0x1*0xb7b+0x20f1+-0x1575)))};_0x3c1104[_0xe413f3(0x137)]=_0x1d6426,_0x3c1104[_0xe413f3(0x148)]=_0x4d8f2a[_0xe413f3(0x148)];const _0x338520=JSON[_0xe413f3(0x12d)]({'source':_0x46f824[_0xe413f3(0x162)],'turns':_0x46f824[_0xe413f3(0x142)]});if(_0x338520===_0x3c1104[_0xe413f3(0x14f)])return _0x46f824;_0x3c1104[_0xe413f3(0x14f)]=_0x338520,_0x3c1104[_0xe413f3(0x128)]=_0x46f824,_0xa70b33=_0xe413f3(0x157);if(_0x1a93a3)this[_0xe413f3(0x173)](_0x12bd28,_0x46f824);return _0x1a93a3?_0x46f824:_0x151c51;}catch(_0x12c18c){_0x3c1104[_0xe413f3(0x186)]+=-0x43*0x7f+-0xda9+0x2ee7,this[_0xe413f3(0x154)][_0xe413f3(0x144)]?.(_0xe413f3(0x167),{'nodeId':this[_0xe413f3(0x154)][_0xe413f3(0x171)]?.()??_0xe413f3(0x145),'sessionId':_0x4d5895,..._0x12bd28===undefined?{}:{'runner':_0x12bd28[_0xe413f3(0x13d)]},'stage':_0xa70b33,'errorCode':diagnosticErrorCode(_0x12c18c,_0xe413f3(0x16f)),'failureCount':_0x3c1104[_0xe413f3(0x186)],'terminal':_0x3c1104[_0xe413f3(0x186)]>=MAX_FAILURES});if(_0x3c1104[_0xe413f3(0x186)]>=MAX_FAILURES)this[_0xe413f3(0x161)](_0x4d5895);return undefined;}}[_0x205735(0x129)](_0x6dc629){const _0x24e8ae=_0x205735;return typeof _0x6dc629[_0x24e8ae(0x17b)]===_0x24e8ae(0x18b)?_0x6dc629[_0x24e8ae(0x17b)]:_0x24e8ae(0x16d);}[_0x205735(0x13b)](_0x5ada96){const _0x5b889f=_0x205735;return this[_0x5b889f(0x129)](_0x5ada96)+':'+_0x5ada96[_0x5b889f(0x18a)];}[_0x205735(0x187)](_0x21d6d6){const _0x2e4d69=_0x205735;return{'accepted':!![],'watchId':_0x21d6d6[_0x2e4d69(0x15c)],'nodeGeneration':_0x21d6d6[_0x2e4d69(0x14b)],'expiresAt':_0x21d6d6[_0x2e4d69(0x130)]};}async[_0x205735(0x13f)](_0x499cb2,_0x57d76c){const _0x52b511=_0x205735;let _0x2bf092=_0x52b511(0x185);try{const _0x306527=await this[_0x52b511(0x154)][_0x52b511(0x185)](_0x499cb2[_0x52b511(0x152)]);if(_0x306527===undefined||_0x306527[_0x52b511(0x13a)]===null)throw new Error(_0x52b511(0x180));if(_0x499cb2[_0x52b511(0x192)]!==undefined&&_0x306527[_0x52b511(0x192)]!==_0x499cb2[_0x52b511(0x192)])throw new Error(_0x52b511(0x14e));if(this[_0x52b511(0x164)][_0x52b511(0x150)](_0x499cb2[_0x52b511(0x13b)])!==_0x499cb2)return;_0x499cb2[_0x52b511(0x192)]=_0x306527[_0x52b511(0x192)],_0x2bf092=_0x52b511(0x189);const _0x520d6c=this[_0x52b511(0x165)](_0x306527),_0xb62b2=_0x520d6c===undefined?undefined:await this[_0x52b511(0x146)](_0x306527['id'],INITIAL_TURN_LIMIT,![]);if(_0xb62b2===undefined)throw new Error(_0x52b511(0x16a));_0x2bf092=_0x52b511(0x13e);const _0x2a44a4=_0x499cb2[_0x52b511(0x126)]===_0x52b511(0x135)?_0x57d76c(_0x306527,_0xb62b2,_0x52b511(0x135),0x1cca+-0x5*0x165+-0x15c7):_0xb62b2;if(this[_0x52b511(0x164)][_0x52b511(0x150)](_0x499cb2[_0x52b511(0x13b)])!==_0x499cb2)return;this[_0x52b511(0x154)][_0x52b511(0x196)]?.({'type':_0x52b511(0x190),'workbenchConnectionId':_0x499cb2[_0x52b511(0x18a)],'watchId':_0x499cb2[_0x52b511(0x15c)],'nodeGeneration':_0x499cb2[_0x52b511(0x14b)],'nodeId':this[_0x52b511(0x154)][_0x52b511(0x171)]?.()??_0x52b511(0x145),'workspaceId':_0x306527[_0x52b511(0x192)],'sessionId':_0x306527['id'],'revision':0x1,'snapshotSequence':++this[_0x52b511(0x143)],'expiresAt':_0x499cb2[_0x52b511(0x130)],'payload':_0x2a44a4});}catch(_0x184688){if(this[_0x52b511(0x164)][_0x52b511(0x150)](_0x499cb2[_0x52b511(0x13b)])!==_0x499cb2)return;const _0x1e9c56=diagnosticErrorCode(_0x184688,_0x52b511(0x17a));this[_0x52b511(0x154)][_0x52b511(0x144)]?.(_0x52b511(0x134),{'nodeId':this[_0x52b511(0x154)][_0x52b511(0x171)]?.()??_0x52b511(0x145),'sessionId':_0x499cb2[_0x52b511(0x152)],'workspaceId':_0x499cb2[_0x52b511(0x192)]??_0x52b511(0x12c),'workbenchConnectionId':_0x499cb2[_0x52b511(0x18a)],'watchId':_0x499cb2[_0x52b511(0x15c)],'stage':_0x2bf092,'errorCode':_0x1e9c56}),this[_0x52b511(0x154)][_0x52b511(0x196)]?.({'type':_0x52b511(0x16c),'workbenchConnectionId':_0x499cb2[_0x52b511(0x18a)],'watchType':_0x52b511(0x183),'watchId':_0x499cb2[_0x52b511(0x15c)],'nodeGeneration':_0x499cb2[_0x52b511(0x14b)],'nodeId':this[_0x52b511(0x154)][_0x52b511(0x171)]?.()??_0x52b511(0x145),'workspaceId':_0x499cb2[_0x52b511(0x192)]??_0x52b511(0x12c),'sessionId':_0x499cb2[_0x52b511(0x152)],'code':_0x1e9c56,'message':_0x52b511(0x132)}),this[_0x52b511(0x17e)](_0x499cb2[_0x52b511(0x13b)]);}}[_0x205735(0x17e)](_0x3849c7){const _0x26eb29=_0x205735,_0x5596b8=this[_0x26eb29(0x164)][_0x26eb29(0x150)](_0x3849c7);if(_0x5596b8===undefined)return;clearTimeout(_0x5596b8[_0x26eb29(0x18d)]),this[_0x26eb29(0x164)][_0x26eb29(0x15e)](_0x3849c7);const _0x261447=this[_0x26eb29(0x131)][_0x26eb29(0x150)](_0x5596b8[_0x26eb29(0x152)]),_0x74f10f=this[_0x26eb29(0x13c)](_0x5596b8[_0x26eb29(0x152)]);if(_0x74f10f===0x1*-0x4e9+0x1efd+-0x1*0x1a14)this[_0x26eb29(0x175)](_0x5596b8[_0x26eb29(0x152)]);else{if(_0x261447!==undefined)_0x261447[_0x26eb29(0x130)]=_0x74f10f;}}[_0x205735(0x173)](_0x484589,_0xc0729){const _0x1f228e=_0x205735,_0x376328=[...this[_0x1f228e(0x164)][_0x1f228e(0x14d)]()][_0x1f228e(0x159)](_0x2e05ae=>_0x2e05ae[_0x1f228e(0x152)]===_0x484589['id']);if(_0x376328[_0x1f228e(0x12b)]===-0x1396*-0x1+0x15c*0x11+-0x2ab2){this[_0x1f228e(0x154)][_0x1f228e(0x160)](_0x484589,_0xc0729);return;}for(const _0x563676 of _0x376328){const _0x52efb8=_0x563676[_0x1f228e(0x126)]===_0x1f228e(0x135)?this[_0x1f228e(0x154)][_0x1f228e(0x18e)]?.(_0x484589,_0xc0729,_0x1f228e(0x135),0x17*-0x13d+0x5a*-0x43+0x1*0x3413):_0xc0729;if(_0x52efb8===undefined)continue;this[_0x1f228e(0x154)][_0x1f228e(0x196)]?.({'type':_0x1f228e(0x190),'workbenchConnectionId':_0x563676[_0x1f228e(0x18a)],'watchId':_0x563676[_0x1f228e(0x15c)],'nodeGeneration':_0x563676[_0x1f228e(0x14b)],'nodeId':this[_0x1f228e(0x154)][_0x1f228e(0x171)]?.()??_0x1f228e(0x145),'workspaceId':_0x484589[_0x1f228e(0x192)],'sessionId':_0x484589['id'],'revision':0x1,'snapshotSequence':++this[_0x1f228e(0x143)],'expiresAt':_0x563676[_0x1f228e(0x130)],'payload':_0x52efb8});}}[_0x205735(0x161)](_0x36968d){const _0x5c50b5=_0x205735;for(const _0x52e049 of[...this[_0x5c50b5(0x164)][_0x5c50b5(0x14d)]()]){if(_0x52e049[_0x5c50b5(0x152)]!==_0x36968d)continue;this[_0x5c50b5(0x154)][_0x5c50b5(0x196)]?.({'type':_0x5c50b5(0x16c),'workbenchConnectionId':_0x52e049[_0x5c50b5(0x18a)],'watchType':_0x5c50b5(0x183),'watchId':_0x52e049[_0x5c50b5(0x15c)],'nodeGeneration':_0x52e049[_0x5c50b5(0x14b)],'nodeId':this[_0x5c50b5(0x154)][_0x5c50b5(0x171)]?.()??_0x5c50b5(0x145),'workspaceId':_0x52e049[_0x5c50b5(0x192)]??_0x5c50b5(0x12c),'sessionId':_0x36968d,'code':_0x5c50b5(0x16a),'message':_0x5c50b5(0x132)}),this[_0x5c50b5(0x17e)](_0x52e049[_0x5c50b5(0x13b)]);}this[_0x5c50b5(0x175)](_0x36968d);}[_0x205735(0x136)](_0x3c0368){const _0x2dd0d3=_0x205735;for(const _0x163153 of[...this[_0x2dd0d3(0x164)][_0x2dd0d3(0x14d)]()])if(_0x163153[_0x2dd0d3(0x152)]===_0x3c0368)this[_0x2dd0d3(0x17e)](_0x163153[_0x2dd0d3(0x13b)]);this[_0x2dd0d3(0x175)](_0x3c0368);}[_0x205735(0x17c)](_0x2d2154){const _0x8a1a5a=_0x205735,_0xe61202=setTimeout(()=>this[_0x8a1a5a(0x17e)](_0x2d2154),TTL_MS);return _0xe61202[_0x8a1a5a(0x176)](),_0xe61202;}[_0x205735(0x13c)](_0x3570bc){const _0x3fad64=_0x205735;let _0x5ea948=0x1d*0x69+0x31c+-0xf01;for(const _0xedd370 of this[_0x3fad64(0x164)][_0x3fad64(0x14d)]())if(_0xedd370[_0x3fad64(0x152)]===_0x3570bc)_0x5ea948=Math[_0x3fad64(0x17d)](_0x5ea948,_0xedd370[_0x3fad64(0x130)]);return _0x5ea948;}[_0x205735(0x133)](_0x3e6a7e){const _0x3aac4a=_0x205735,_0x357c54=setTimeout(()=>void this[_0x3aac4a(0x146)](_0x3e6a7e),INTERVAL_MS);return _0x357c54[_0x3aac4a(0x176)](),_0x357c54;}}function diagnosticErrorCode(_0xe2e7fd,_0x194127){const _0xe2ef0=_0x205735,_0x56e88f=safeErrorCode(_0xe2e7fd,'');if(_0x56e88f[_0xe2ef0(0x12b)]>0x1985+0x1*0x2496+-0x3e1b)return _0x56e88f;if(_0xe2e7fd!==null&&typeof _0xe2e7fd===_0xe2ef0(0x166)&&_0xe2ef0(0x149)in _0xe2e7fd&&typeof _0xe2e7fd[_0xe2ef0(0x149)]===_0xe2ef0(0x18b)&&/^[A-Z][A-Z0-9_]{0,127}$/[_0xe2ef0(0x15b)](_0xe2e7fd[_0xe2ef0(0x149)]))return _0xe2e7fd[_0xe2ef0(0x149)];return _0x194127;}
|
|
@@ -1,84 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export class NodeConnectionLifecycleService {
|
|
4
|
-
options;
|
|
5
|
-
heartbeat;
|
|
6
|
-
refreshTimer;
|
|
7
|
-
refreshing = false;
|
|
8
|
-
constructor(options) {
|
|
9
|
-
this.options = options;
|
|
10
|
-
}
|
|
11
|
-
start() {
|
|
12
|
-
this.startCapabilityRefresh();
|
|
13
|
-
}
|
|
14
|
-
startCapabilityRefresh() {
|
|
15
|
-
if (this.refreshTimer !== undefined)
|
|
16
|
-
clearInterval(this.refreshTimer);
|
|
17
|
-
if (!this.options.capabilitiesProvided)
|
|
18
|
-
void this.refreshCapabilities();
|
|
19
|
-
this.refreshTimer = setInterval(() => void this.refreshCapabilities(), this.options.refreshMs);
|
|
20
|
-
}
|
|
21
|
-
stop() {
|
|
22
|
-
if (this.heartbeat !== undefined)
|
|
23
|
-
clearInterval(this.heartbeat);
|
|
24
|
-
if (this.refreshTimer !== undefined)
|
|
25
|
-
clearInterval(this.refreshTimer);
|
|
26
|
-
this.heartbeat = undefined;
|
|
27
|
-
this.refreshTimer = undefined;
|
|
28
|
-
}
|
|
29
|
-
async register(nodeId, credential) {
|
|
30
|
-
const config = this.options.config();
|
|
31
|
-
if (config === undefined)
|
|
32
|
-
return;
|
|
33
|
-
const registered = {
|
|
34
|
-
serverUrl: config.serverUrl,
|
|
35
|
-
allowedRoots: config.allowedRoots,
|
|
36
|
-
...(config.dataDirectory === undefined ? {} : { dataDirectory: config.dataDirectory }),
|
|
37
|
-
nodeId,
|
|
38
|
-
credential
|
|
39
|
-
};
|
|
40
|
-
this.options.setConfig(registered);
|
|
41
|
-
await saveNodeConfig(registered, this.options.configPath);
|
|
42
|
-
this.connected();
|
|
43
|
-
}
|
|
44
|
-
connected() {
|
|
45
|
-
if (this.heartbeat !== undefined)
|
|
46
|
-
clearInterval(this.heartbeat);
|
|
47
|
-
this.options.control.send('capabilities', this.options.capabilities());
|
|
48
|
-
this.options.terminal.connect();
|
|
49
|
-
this.options.control.send('heartbeat', {});
|
|
50
|
-
this.options.onConnected?.();
|
|
51
|
-
this.options.metrics.heartbeatSent();
|
|
52
|
-
this.heartbeat = setInterval(() => {
|
|
53
|
-
this.options.metrics.heartbeatSent();
|
|
54
|
-
this.options.control.send('heartbeat', {});
|
|
55
|
-
}, this.options.heartbeatMs);
|
|
56
|
-
}
|
|
57
|
-
async refreshCapabilities() {
|
|
58
|
-
if (this.options.stopped() || this.refreshing)
|
|
59
|
-
return;
|
|
60
|
-
this.refreshing = true;
|
|
61
|
-
try {
|
|
62
|
-
let next;
|
|
63
|
-
try {
|
|
64
|
-
next = await this.options.detectCapabilities();
|
|
65
|
-
}
|
|
66
|
-
catch {
|
|
67
|
-
next = {
|
|
68
|
-
...this.options.capabilities(),
|
|
69
|
-
codex: { available: false },
|
|
70
|
-
claudeCode: { available: false },
|
|
71
|
-
openCode: { available: false }
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
if (this.options.stopped() ||
|
|
75
|
-
JSON.stringify(next) === JSON.stringify(this.options.capabilities()))
|
|
76
|
-
return;
|
|
77
|
-
this.options.setCapabilities(next);
|
|
78
|
-
this.options.control.send('capabilities', next);
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
this.refreshing = false;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0x2a1e7e=_0xe731;function _0x5113(){const _0x48c952=['zgf0yurPCMvJDg9YEq','C3rYAw5NAwz5','mtG5mtu4mevYCwTXBa','C3rVCa','C2v0q2fWywjPBgL0AwvZ','y2fWywjPBgL0AwvZuhjVDMLKzwq','B25dB25Uzwn0zwq','mtK1ndq0qwrLDMLr','nZK4ote2wvDSzhL6','AgvHCNrIzwf0','y29UzMLNugf0Aa','mtK4ntCZmhbUzMDtva','mJK0mJu1nLLTrhzPCq','y2fWywjPBgL0AwvZ','C2vYDMvYvxjS','C3rHCNrdyxbHyMLSAxr5uMvMCMvZAa','CMvMCMvZAfrPBwvY','odHduMzRBLO','y29UBMvJDa','C3rVChbLza','CMvMCMvZAgLUzW','y29UDhjVBa','mJH1Bxnnq2q','CMvMCMvZAenHCgfIAwXPDgLLCW','AgvHCNrIzwf0txm','C2vUza','mLvrq1r2ta','zgv0zwn0q2fWywjPBgL0AwvZ','ywXSB3DLzfjVB3rZ','DgvYBwLUywW','ndCYmtqZq0PhsNLx','y29UBMvJDgvK','y29UzMLN','C3rHCNq','ote5mdK2BMLLwKff','CMvNAxn0zxi','Bwv0CMLJCW','C2v0q29UzMLN','nNLMC1DSBG','CMvMCMvZAe1Z','AgvHCNrIzwf0u2vUDa','B3b0Aw9UCW'];_0x5113=function(){return _0x48c952;};return _0x5113();}function _0xe731(_0x1e4dd1,_0x127836){_0x1e4dd1=_0x1e4dd1-(-0x16e1*-0x1+0x8*-0x12f+-0xa*0x139);const _0x1e21ff=_0x5113();let _0x158216=_0x1e21ff[_0x1e4dd1];if(_0xe731['itfsbb']===undefined){var _0x35267e=function(_0x126791){const _0x17ef19='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5db0f1='',_0x347a4f='';for(let _0x5686ff=0xb3e+0x38*0x7+-0x6d*0x1e,_0x50d316,_0x1cca46,_0x10761d=-0x1ac8+-0x15f4+0x30bc;_0x1cca46=_0x126791['charAt'](_0x10761d++);~_0x1cca46&&(_0x50d316=_0x5686ff%(0x203e*0x1+0x3*-0xa12+-0xc*0x2b)?_0x50d316*(-0x1c33+0x21de+-0x56b*0x1)+_0x1cca46:_0x1cca46,_0x5686ff++%(0x3*0x10f+0xe77+0x2f0*-0x6))?_0x5db0f1+=String['fromCharCode'](-0x1*-0x196d+-0x1*-0x3e5+-0x1c53&_0x50d316>>(-(-0xb80+0x2201+0x167f*-0x1)*_0x5686ff&-0x153b+-0x211d+0x365e)):-0x12f1+0x7e2*-0x4+-0xb1*-0x49){_0x1cca46=_0x17ef19['indexOf'](_0x1cca46);}for(let _0x26b2ef=0x4d8+-0x63b+0x163,_0x17fe2b=_0x5db0f1['length'];_0x26b2ef<_0x17fe2b;_0x26b2ef++){_0x347a4f+='%'+('00'+_0x5db0f1['charCodeAt'](_0x26b2ef)['toString'](0x2*-0xa5a+-0xb1f+0x1fe3))['slice'](-(0x1*-0x1a19+0x1*-0x20b3+0x3ace));}return decodeURIComponent(_0x347a4f);};_0xe731['avIfdT']=_0x35267e,_0xe731['nDroQN']={},_0xe731['itfsbb']=!![];}const _0x508596=_0x1e21ff[-0x1ffa+0x3*-0x235+0x2699];_0xe731['nawOca']!==_0x508596&&(_0xe731['nDroQN']={},_0xe731['nawOca']=_0x508596);const _0x973ccc=_0xe731['nDroQN'][_0x1e4dd1];return _0x973ccc===undefined?(_0x158216=_0xe731['avIfdT'](_0x158216),_0xe731['nDroQN'][_0x1e4dd1]=_0x158216):_0x158216=_0x973ccc,_0x158216;}(function(_0x21e439,_0xd3b45a){const _0x3afd8b=_0xe731,_0x599c44=_0x21e439();while(!![]){try{const _0x23c9a1=parseInt(_0x3afd8b(0x13b))/(-0x2d*0xcf+-0x22a4+0x4708)*(-parseInt(_0x3afd8b(0x137))/(-0x136a+-0x3*0x662+-0x1349*-0x2))+parseInt(_0x3afd8b(0x143))/(0x65*0x20+0x58e+-0x122b)*(-parseInt(_0x3afd8b(0x14f))/(-0x406+-0x12*-0x105+-0x4*0x394))+-parseInt(_0x3afd8b(0x152))/(-0xd0f*0x1+0x3*-0x9ef+0x3*0xe4b)+parseInt(_0x3afd8b(0x153))/(0xf*-0x23a+0x30f*-0xa+-0xaab*-0x6)+-parseInt(_0x3afd8b(0x133))/(-0x2e2*-0x6+-0x29d+-0xea8)*(parseInt(_0x3afd8b(0x13f))/(-0x411*-0x7+0x1cea+0x3959*-0x1))+parseInt(_0x3afd8b(0x14e))/(-0x19de+0x1125+-0x2*-0x461)+-parseInt(_0x3afd8b(0x149))/(0x101*-0xb+0x7dc+-0x113*-0x3)*(-parseInt(_0x3afd8b(0x158))/(-0x6*-0x3e7+-0x1c0c+-0x18f*-0x3));if(_0x23c9a1===_0xd3b45a)break;else _0x599c44['push'](_0x599c44['shift']());}catch(_0x13dd75){_0x599c44['push'](_0x599c44['shift']());}}}(_0x5113,-0x963e*-0x4+0x4*-0x24207+0x1*0xb37bb));import{saveNodeConfig}from'../config.js';export class NodeConnectionLifecycleService{[_0x2a1e7e(0x146)];[_0x2a1e7e(0x150)];[_0x2a1e7e(0x157)];[_0x2a1e7e(0x131)]=![];constructor(_0x1459ed){const _0x5cd0b3=_0x2a1e7e;this[_0x5cd0b3(0x146)]=_0x1459ed;}[_0x2a1e7e(0x13e)](){const _0x479f18=_0x2a1e7e;this[_0x479f18(0x156)]();}[_0x2a1e7e(0x156)](){const _0x5895e1=_0x2a1e7e;if(this[_0x5895e1(0x157)]!==undefined)clearInterval(this[_0x5895e1(0x157)]);if(!this[_0x5895e1(0x146)][_0x5895e1(0x14c)])void this[_0x5895e1(0x134)]();this[_0x5895e1(0x157)]=setInterval(()=>void this[_0x5895e1(0x134)](),this[_0x5895e1(0x146)][_0x5895e1(0x144)]);}[_0x2a1e7e(0x14a)](){const _0x3e5a92=_0x2a1e7e;if(this[_0x3e5a92(0x150)]!==undefined)clearInterval(this[_0x3e5a92(0x150)]);if(this[_0x3e5a92(0x157)]!==undefined)clearInterval(this[_0x3e5a92(0x157)]);this[_0x3e5a92(0x150)]=undefined,this[_0x3e5a92(0x157)]=undefined;}async[_0x2a1e7e(0x140)](_0x33a51f,_0x523587){const _0xf09858=_0x2a1e7e,_0x340f96=this[_0xf09858(0x146)][_0xf09858(0x13d)]();if(_0x340f96===undefined)return;const _0x174512={'serverUrl':_0x340f96[_0xf09858(0x155)],'allowedRoots':_0x340f96[_0xf09858(0x139)],..._0x340f96[_0xf09858(0x147)]===undefined?{}:{'dataDirectory':_0x340f96[_0xf09858(0x147)]},'nodeId':_0x33a51f,'credential':_0x523587};this[_0xf09858(0x146)][_0xf09858(0x142)](_0x174512),await saveNodeConfig(_0x174512,this[_0xf09858(0x146)][_0xf09858(0x151)]),this[_0xf09858(0x13c)]();}[_0x2a1e7e(0x13c)](){const _0x29cba4=_0x2a1e7e;if(this[_0x29cba4(0x150)]!==undefined)clearInterval(this[_0x29cba4(0x150)]);this[_0x29cba4(0x146)][_0x29cba4(0x132)][_0x29cba4(0x136)](_0x29cba4(0x154),this[_0x29cba4(0x146)][_0x29cba4(0x154)]()),this[_0x29cba4(0x146)][_0x29cba4(0x13a)][_0x29cba4(0x12f)](),this[_0x29cba4(0x146)][_0x29cba4(0x132)][_0x29cba4(0x136)](_0x29cba4(0x150),{}),this[_0x29cba4(0x146)][_0x29cba4(0x14d)]?.(),this[_0x29cba4(0x146)][_0x29cba4(0x141)][_0x29cba4(0x145)](),this[_0x29cba4(0x150)]=setInterval(()=>{const _0x597c5c=_0x29cba4;this[_0x597c5c(0x146)][_0x597c5c(0x141)][_0x597c5c(0x145)](),this[_0x597c5c(0x146)][_0x597c5c(0x132)][_0x597c5c(0x136)](_0x597c5c(0x150),{});},this[_0x29cba4(0x146)][_0x29cba4(0x135)]);}async[_0x2a1e7e(0x134)](){const _0x913ca7=_0x2a1e7e;if(this[_0x913ca7(0x146)][_0x913ca7(0x130)]()||this[_0x913ca7(0x131)])return;this[_0x913ca7(0x131)]=!![];try{let _0xf001d5;try{_0xf001d5=await this[_0x913ca7(0x146)][_0x913ca7(0x138)]();}catch{_0xf001d5={...this[_0x913ca7(0x146)][_0x913ca7(0x154)](),'codex':{'available':![]},'claudeCode':{'available':![]},'openCode':{'available':![]}};}if(this[_0x913ca7(0x146)][_0x913ca7(0x130)]()||JSON[_0x913ca7(0x148)](_0xf001d5)===JSON[_0x913ca7(0x148)](this[_0x913ca7(0x146)][_0x913ca7(0x154)]()))return;this[_0x913ca7(0x146)][_0x913ca7(0x14b)](_0xf001d5),this[_0x913ca7(0x146)][_0x913ca7(0x132)][_0x913ca7(0x136)](_0x913ca7(0x154),_0xf001d5);}finally{this[_0x913ca7(0x131)]=![];}}}
|
|
@@ -1,85 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ControlOutboundScheduler } from '../control-outbound-scheduler.js';
|
|
4
|
-
import { nodeConnectEndpoint } from '../runner/codex/conversation-parser.js';
|
|
5
|
-
export class NodeControlChannel {
|
|
6
|
-
options;
|
|
7
|
-
socket;
|
|
8
|
-
outbound = new ControlOutboundScheduler(() => this.socket, () => this.socket?.close(1013, 'NODE_CONTROL_BACKPRESSURE_TIMEOUT'));
|
|
9
|
-
reconnectTimer;
|
|
10
|
-
attempts = 0;
|
|
11
|
-
constructor(options) {
|
|
12
|
-
this.options = options;
|
|
13
|
-
}
|
|
14
|
-
connect() {
|
|
15
|
-
const config = this.options.config();
|
|
16
|
-
if (config === undefined ||
|
|
17
|
-
this.options.stopped() ||
|
|
18
|
-
(this.socket !== undefined &&
|
|
19
|
-
(this.socket.readyState === WebSocket.OPEN ||
|
|
20
|
-
this.socket.readyState === WebSocket.CONNECTING)))
|
|
21
|
-
return;
|
|
22
|
-
this.options.onConnecting(this.attempts);
|
|
23
|
-
const socket = new WebSocket(nodeConnectEndpoint(config.serverUrl));
|
|
24
|
-
this.socket = socket;
|
|
25
|
-
socket.once('open', () => {
|
|
26
|
-
this.attempts = 0;
|
|
27
|
-
if (config.nodeId !== undefined && config.credential !== undefined)
|
|
28
|
-
this.send('authenticate', { nodeId: config.nodeId, credential: config.credential });
|
|
29
|
-
else if (config.registrationToken !== undefined)
|
|
30
|
-
this.send('register', {
|
|
31
|
-
registrationToken: config.registrationToken,
|
|
32
|
-
capabilities: this.options.capabilities()
|
|
33
|
-
});
|
|
34
|
-
else
|
|
35
|
-
socket.close(4000, 'NODE_CREDENTIAL_MISSING');
|
|
36
|
-
});
|
|
37
|
-
socket.on('message', (raw) => this.options.onMessage(raw.toString()));
|
|
38
|
-
socket.once('close', (code, reason) => {
|
|
39
|
-
if (this.socket !== socket)
|
|
40
|
-
return;
|
|
41
|
-
this.socket = undefined;
|
|
42
|
-
this.outbound.reset();
|
|
43
|
-
const reasonText = reason.toString();
|
|
44
|
-
this.options.onClose(code, reasonText);
|
|
45
|
-
if (!(code === 4000 && reasonText === 'NODE_CONNECTION_REPLACED'))
|
|
46
|
-
this.scheduleReconnect();
|
|
47
|
-
});
|
|
48
|
-
socket.once('error', () => undefined);
|
|
49
|
-
}
|
|
50
|
-
connected() {
|
|
51
|
-
return this.socket?.readyState === WebSocket.OPEN;
|
|
52
|
-
}
|
|
53
|
-
/** Keeps transport injection at the transport boundary for contract tests. */
|
|
54
|
-
replaceSocketForTesting(socket) {
|
|
55
|
-
this.socket = socket;
|
|
56
|
-
}
|
|
57
|
-
close(code, reason) {
|
|
58
|
-
this.socket?.close(code, reason);
|
|
59
|
-
}
|
|
60
|
-
stop() {
|
|
61
|
-
if (this.reconnectTimer !== undefined)
|
|
62
|
-
clearTimeout(this.reconnectTimer);
|
|
63
|
-
this.reconnectTimer = undefined;
|
|
64
|
-
this.outbound.reset();
|
|
65
|
-
this.socket?.close();
|
|
66
|
-
this.socket = undefined;
|
|
67
|
-
}
|
|
68
|
-
send(type, payload, replyTo) {
|
|
69
|
-
this.sendEnvelope(createEnvelope(type, payload, { ...(replyTo === undefined ? {} : { replyTo }) }));
|
|
70
|
-
}
|
|
71
|
-
sendEnvelope(envelope) {
|
|
72
|
-
if (!this.connected())
|
|
73
|
-
return;
|
|
74
|
-
this.outbound.enqueue(envelope, envelope.type === 'workbench.event' ? 'normal' : 'high');
|
|
75
|
-
}
|
|
76
|
-
scheduleReconnect() {
|
|
77
|
-
if (this.options.stopped() || !this.options.reconnect || this.reconnectTimer !== undefined)
|
|
78
|
-
return;
|
|
79
|
-
this.options.onReconnectScheduled();
|
|
80
|
-
this.reconnectTimer = setTimeout(() => {
|
|
81
|
-
this.reconnectTimer = undefined;
|
|
82
|
-
this.connect();
|
|
83
|
-
}, this.options.reconnectDelay(this.attempts++));
|
|
84
|
-
}
|
|
85
|
-
}
|
|
1
|
+
/* mar-release-protected */
|
|
2
|
+
const _0x1c6995=_0x4dd4;(function(_0x3ea499,_0x261d9e){const _0x19afdf=_0x4dd4,_0x47244a=_0x3ea499();while(!![]){try{const _0x2b1042=parseInt(_0x19afdf(0x1b7))/(-0x155c+0x37b+0x11e2)*(-parseInt(_0x19afdf(0x1d2))/(0x67*-0x17+0xe29+-0x273*0x2))+parseInt(_0x19afdf(0x1b0))/(-0x1*0x1fa+0x2329*0x1+-0x212c)*(parseInt(_0x19afdf(0x1a2))/(-0x1f3*-0x1+-0x23ea+-0x21fb*-0x1))+-parseInt(_0x19afdf(0x1d1))/(-0x1*0x2327+0x1*-0xac9+0x2df5)+parseInt(_0x19afdf(0x1ca))/(-0x1aa0+-0x9d1*-0x3+0x1*-0x2cd)*(-parseInt(_0x19afdf(0x1c3))/(-0xd*0x3b+-0x1fc9+0x22cf))+-parseInt(_0x19afdf(0x19f))/(-0x2662+0x2*0xdaf+0xb0c)+parseInt(_0x19afdf(0x1a9))/(-0x7d9*0x1+0x1d89+0x1*-0x15a7)*(parseInt(_0x19afdf(0x1c2))/(-0x81d+-0x102f*-0x1+-0x808))+parseInt(_0x19afdf(0x1a6))/(-0x2*-0x8ef+0x1988+0x3f1*-0xb);if(_0x2b1042===_0x261d9e)break;else _0x47244a['push'](_0x47244a['shift']());}catch(_0x36854a){_0x47244a['push'](_0x47244a['shift']());}}}(_0x8067,0x124db*-0xe+0x16773a+0x5e588));import _0x37d292 from'ws';function _0x4dd4(_0x2b61a4,_0x23fe52){_0x2b61a4=_0x2b61a4-(0x82c+0x4*-0x39d+0x7e5);const _0x309d46=_0x8067();let _0x187b2b=_0x309d46[_0x2b61a4];if(_0x4dd4['IMTXNn']===undefined){var _0x563bbc=function(_0x41f824){const _0xe84db='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4032d9='',_0x31da09='';for(let _0x3537a5=0xfe*-0x2+0x1ce6+-0x1aea,_0x3b6f0f,_0x18a92e,_0x107b43=-0xece+-0xba6+0x1a74;_0x18a92e=_0x41f824['charAt'](_0x107b43++);~_0x18a92e&&(_0x3b6f0f=_0x3537a5%(-0x14c*0x10+0x9ee+-0x26*-0x49)?_0x3b6f0f*(-0x819+-0x4e6+0xd3f)+_0x18a92e:_0x18a92e,_0x3537a5++%(0x125*0x17+-0x260c+0xbbd))?_0x4032d9+=String['fromCharCode'](-0x520+-0xc81*-0x3+0xa4*-0x31&_0x3b6f0f>>(-(0x3*-0x5b3+-0x2292+0x33ad)*_0x3537a5&0x1399+-0x4a2*-0x8+-0x38a3)):0xffe+-0x167f*-0x1+-0x267d){_0x18a92e=_0xe84db['indexOf'](_0x18a92e);}for(let _0x22673a=0xf*-0xb5+0x3*0x2ff+0x19e,_0xa7edf7=_0x4032d9['length'];_0x22673a<_0xa7edf7;_0x22673a++){_0x31da09+='%'+('00'+_0x4032d9['charCodeAt'](_0x22673a)['toString'](0x673+0x2*0xeb7+-0x23d1))['slice'](-(0x9c1+-0x611*0x2+0xd*0x2f));}return decodeURIComponent(_0x31da09);};_0x4dd4['DgsyRi']=_0x563bbc,_0x4dd4['pKdvYI']={},_0x4dd4['IMTXNn']=!![];}const _0x4c27b4=_0x309d46[-0x1*0x1407+-0x44*0x29+0x1*0x1eeb];_0x4dd4['sHSsTI']!==_0x4c27b4&&(_0x4dd4['pKdvYI']={},_0x4dd4['sHSsTI']=_0x4c27b4);const _0xf894b5=_0x4dd4['pKdvYI'][_0x2b61a4];return _0xf894b5===undefined?(_0x187b2b=_0x4dd4['DgsyRi'](_0x187b2b),_0x4dd4['pKdvYI'][_0x2b61a4]=_0x187b2b):_0x187b2b=_0xf894b5,_0x187b2b;}import{createEnvelope}from'@myagentroam/protocol';import{ControlOutboundScheduler}from'../control-outbound-scheduler.js';import{nodeConnectEndpoint}from'../runner/codex/conversation-parser.js';function _0x8067(){const _0x544002=['tK9erv9dt05orunusu9ox1jfueXbq0ve','yxv0AgvUDgLJyxrL','y29UBMvJDa','C29JA2v0','y29UzMLN','nJiWnJuYmePcreDUAq','ndy3odq2sg1ZuNHp','C2vUzevUDMvSB3bL','CMvWBgfJzvnVy2TLDezVCLrLC3rPBMC','y3jLzgvUDgLHBa','q09otKvdveLorW','mZuXndy4oeHnDwvmBW','C2vYDMvYvxjS','CMvNAxn0CMf0Aw9Uvg9Rzw4','nteYng5wugLkyq','B25nzxnZywDL','B3bLBG','BwvZC2fNzq','ndaWodq1otrvrKv4r3u','t1bftG','B3b0Aw9UCW','mJDhz1vIAgK','DhLWzq','zxjYB3i','C2nOzwr1BgvszwnVBM5Ly3q','B25dBg9Zzq','zw5XDwv1zq','CMvJB25Uzwn0','ntrTwef4Dee','BM9KzuLK','CMvZzxq','tK9erv9duKveru5usufmx01ju1njtKC','y2fWywjPBgL0AwvZ','AgLNAa','tK9erv9dt05uuK9mx0jbq0TquKvtu1vsrv9usu1ft1vu','nuDYCfvQsW','CMvJB25Uzwn0vgLTzxi','y2XVC2u','B25dB25Uzwn0Aw5N','yxr0zw1WDhm','B25szwnVBM5Ly3rty2HLzhvSzwq','y29UBMvJDgvK','CMvJB25Uzwn0rgvSyxK','C3rVCa','CMvNAxn0zxi','BM9YBwfS','mti0mte0mgf5r0jSvW','n2zUq09IzG','D29YA2jLBMnOlMv2zw50','C3rVChbLza','CMvHzhLtDgf0zq','C2vUza','Dg9tDhjPBMC','B3v0yM91BMq','mJi4mdiZnhnMD2roCq','B25Jzq'];_0x8067=function(){return _0x544002;};return _0x8067();}export class NodeControlChannel{[_0x1c6995(0x1a8)];[_0x1c6995(0x1cf)];[_0x1c6995(0x1c9)]=new ControlOutboundScheduler(()=>this[_0x1c6995(0x1cf)],()=>this[_0x1c6995(0x1cf)]?.[_0x1c6995(0x1b9)](-0xbf2+-0x2604+0x35eb,_0x1c6995(0x1b6)));[_0x1c6995(0x1b8)];[_0x1c6995(0x1bb)]=-0x1b3+0x1*-0x1b8b+0x1d3e;constructor(_0x4babed){const _0x54d880=_0x1c6995;this[_0x54d880(0x1a8)]=_0x4babed;}[_0x1c6995(0x1ce)](){const _0x464e84=_0x1c6995,_0x1ad1b7=this[_0x464e84(0x1a8)][_0x464e84(0x1d0)]();if(_0x1ad1b7===undefined||this[_0x464e84(0x1a8)][_0x464e84(0x1c5)]()||this[_0x464e84(0x1cf)]!==undefined&&(this[_0x464e84(0x1cf)][_0x464e84(0x1c6)]===_0x37d292[_0x464e84(0x1a7)]||this[_0x464e84(0x1cf)][_0x464e84(0x1c6)]===_0x37d292[_0x464e84(0x19e)]))return;this[_0x464e84(0x1a8)][_0x464e84(0x1ba)](this[_0x464e84(0x1bb)]);const _0x57ec06=new _0x37d292(nodeConnectEndpoint(_0x1ad1b7[_0x464e84(0x1a0)]));this[_0x464e84(0x1cf)]=_0x57ec06,_0x57ec06[_0x464e84(0x1cb)](_0x464e84(0x1a4),()=>{const _0x57cac6=_0x464e84;this[_0x57cac6(0x1bb)]=-0x2ac+0x2108+-0x1e5c;if(_0x1ad1b7[_0x57cac6(0x1b1)]!==undefined&&_0x1ad1b7[_0x57cac6(0x19d)]!==undefined)this[_0x57cac6(0x1c7)](_0x57cac6(0x1cd),{'nodeId':_0x1ad1b7[_0x57cac6(0x1b1)],'credential':_0x1ad1b7[_0x57cac6(0x19d)]});else{if(_0x1ad1b7[_0x57cac6(0x1a1)]!==undefined)this[_0x57cac6(0x1c7)](_0x57cac6(0x1c0),{'registrationToken':_0x1ad1b7[_0x57cac6(0x1a1)],'capabilities':this[_0x57cac6(0x1a8)][_0x57cac6(0x1b4)]()});else _0x57ec06[_0x57cac6(0x1b9)](-0x245d+-0xc2*0x1+0x283*0x15,_0x57cac6(0x1b3));}}),_0x57ec06['on'](_0x464e84(0x1a5),_0x5a864a=>this[_0x464e84(0x1a8)][_0x464e84(0x1a3)](_0x5a864a[_0x464e84(0x1c8)]())),_0x57ec06[_0x464e84(0x1cb)](_0x464e84(0x1b9),(_0x458669,_0x26c7c0)=>{const _0x20413e=_0x464e84;if(this[_0x20413e(0x1cf)]!==_0x57ec06)return;this[_0x20413e(0x1cf)]=undefined,this[_0x20413e(0x1c9)][_0x20413e(0x1b2)]();const _0x2d0f8c=_0x26c7c0[_0x20413e(0x1c8)]();this[_0x20413e(0x1a8)][_0x20413e(0x1ad)](_0x458669,_0x2d0f8c);if(!(_0x458669===-0x22d7+-0x5a*0x29+-0x40e1*-0x1&&_0x2d0f8c===_0x20413e(0x1cc)))this[_0x20413e(0x1ac)]();}),_0x57ec06[_0x464e84(0x1cb)](_0x464e84(0x1ab),()=>undefined);}[_0x1c6995(0x1bd)](){const _0x291812=_0x1c6995;return this[_0x291812(0x1cf)]?.[_0x291812(0x1c6)]===_0x37d292[_0x291812(0x1a7)];}[_0x1c6995(0x1d4)](_0x479c11){const _0x5a3f10=_0x1c6995;this[_0x5a3f10(0x1cf)]=_0x479c11;}[_0x1c6995(0x1b9)](_0x5cebf6,_0x297977){const _0x10403c=_0x1c6995;this[_0x10403c(0x1cf)]?.[_0x10403c(0x1b9)](_0x5cebf6,_0x297977);}[_0x1c6995(0x1bf)](){const _0x43b233=_0x1c6995;if(this[_0x43b233(0x1b8)]!==undefined)clearTimeout(this[_0x43b233(0x1b8)]);this[_0x43b233(0x1b8)]=undefined,this[_0x43b233(0x1c9)][_0x43b233(0x1b2)](),this[_0x43b233(0x1cf)]?.[_0x43b233(0x1b9)](),this[_0x43b233(0x1cf)]=undefined;}[_0x1c6995(0x1c7)](_0x33438b,_0x12ff99,_0x246458){const _0x5e2608=_0x1c6995;this[_0x5e2608(0x1d3)](createEnvelope(_0x33438b,_0x12ff99,{..._0x246458===undefined?{}:{'replyTo':_0x246458}}));}[_0x1c6995(0x1d3)](_0x4334c8){const _0x54c762=_0x1c6995;if(!this[_0x54c762(0x1bd)]())return;this[_0x54c762(0x1c9)][_0x54c762(0x1ae)](_0x4334c8,_0x4334c8[_0x54c762(0x1aa)]===_0x54c762(0x1c4)?_0x54c762(0x1c1):_0x54c762(0x1b5));}[_0x1c6995(0x1ac)](){const _0x192488=_0x1c6995;if(this[_0x192488(0x1a8)][_0x192488(0x1c5)]()||!this[_0x192488(0x1a8)][_0x192488(0x1af)]||this[_0x192488(0x1b8)]!==undefined)return;this[_0x192488(0x1a8)][_0x192488(0x1bc)](),this[_0x192488(0x1b8)]=setTimeout(()=>{const _0x5111ca=_0x192488;this[_0x5111ca(0x1b8)]=undefined,this[_0x5111ca(0x1ce)]();},this[_0x192488(0x1a8)][_0x192488(0x1be)](this[_0x192488(0x1bb)]++));}}
|