@myagentroam/node 0.11.35 → 0.11.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application/execution-lifecycle.js +54 -0
- package/dist/application/node-lifecycle.js +104 -0
- package/dist/application/node-operation-admission.js +51 -0
- package/dist/application/node-operation-contracts.js +1 -0
- package/dist/application/runner-composition.js +22 -0
- package/dist/application/session-projection-composition.js +26 -0
- package/dist/application/workspace-application.js +61 -0
- package/dist/application/workspace-composition.js +21 -0
- package/dist/capabilities.js +2 -2
- package/dist/codex-app-server.js +1 -471
- package/dist/connection/authorization.js +26 -0
- package/dist/{service → connection}/direct-transfer-service.js +1 -1
- package/dist/connection/endpoints.js +32 -0
- package/dist/connector.js +144 -252
- package/dist/database.js +34 -14
- package/dist/git-askpass.js +1 -1
- package/dist/git-execution-helper.js +1 -1
- package/dist/hosting/hosted-conversation-file-identity.js +27 -0
- package/dist/hosting/hosted-conversation-file-operations.js +44 -0
- package/dist/hosting/hosted-conversation-node-service.js +974 -0
- package/dist/hosting/hosted-conversation-runs.js +599 -0
- package/dist/hosting/hosted-conversation-templates.js +280 -0
- package/dist/hosting/hosted-conversation-uploads.js +344 -0
- package/dist/hosting/hosted-conversation-watch.js +194 -0
- package/dist/hosting/runtime-contracts.js +1 -0
- package/dist/marctl-guidance.js +1 -1
- package/dist/runner/abstract-runner.js +4 -13
- package/dist/{claude-agent-sdk.js → runner/claude/claude-agent-sdk.js} +2 -2
- package/dist/runner/claude/conversation-parser.js +2 -1
- package/dist/runner/claude/managed-run-controller.js +6 -7
- package/dist/runner/claude/message-parsers.js +2 -1
- package/dist/runner/claude/native-transcript.js +2 -1
- package/dist/runner/claude/tool-normalizer.js +1 -1
- package/dist/runner/claude-code-runner.js +2 -2
- package/dist/runner/codex/codex-app-server.js +471 -0
- package/dist/runner/codex/conversation-parser.js +4 -2
- package/dist/runner/codex/managed-run-controller.js +7 -9
- package/dist/runner/codex/native-transcript.js +1 -1
- package/dist/runner/codex/tool-normalizer.js +1 -1
- package/dist/runner/codex-runner.js +9 -27
- package/dist/runner/contracts.js +1 -0
- package/dist/runner/mar-agent/conversation-normalizer.js +2 -2
- package/dist/runner/mar-agent/history-projection.js +1 -1
- package/dist/runner/mar-agent/hosted-conversation-runtime.js +6 -10
- package/dist/runner/mar-agent/managed-run-controller.js +85 -61
- package/dist/runner/mar-agent-runner.js +1 -1
- package/dist/runner/normalization.js +42 -0
- package/dist/runner/opencode/conversation-parser.js +1 -1
- package/dist/runner/opencode/managed-run-controller.js +6 -7
- package/dist/{opencode-server.js → runner/opencode/opencode-server.js} +2 -2
- package/dist/runner/opencode/tool-normalizer.js +1 -1
- package/dist/runner/opencode-runner.js +4 -5
- package/dist/runner/runner-registry.js +4 -1
- package/dist/runtime-state.js +48 -372
- package/dist/service/computer-use-enablement-service.js +1 -1
- package/dist/service/continuous-run-coordinator.js +52 -7
- package/dist/service/conversation-history-service.js +4 -4
- package/dist/service/conversation-hosting-capability-service.js +1 -1
- package/dist/service/conversation-hosting-enablement-service.js +1 -1
- package/dist/service/conversation-hosting-lifecycle-service.js +3 -3
- package/dist/service/conversation-hosting-maintenance-service.js +1 -1
- package/dist/service/conversation-observation.js +1 -1
- package/dist/service/conversation-segment-service.js +1 -1
- package/dist/service/external-session-resume-service.js +47 -27
- package/dist/service/fake-managed-run-service.js +3 -7
- package/dist/service/git-operation-service.js +1 -1
- package/dist/service/goal-continuation-coordinator.js +14 -7
- package/dist/service/mar-agent-model-transport-test-service.js +1 -1
- package/dist/service/native-session-watch-service.js +1 -1
- package/dist/service/node-control-channel.js +1 -5
- package/dist/service/node-request-service.js +1 -1
- package/dist/service/node-terminal-channel.js +2 -1
- package/dist/service/node-workspace-coordinator.js +3 -2
- package/dist/service/notification-mcp-bridge.js +6 -2
- package/dist/service/recent-run-projection-service.js +1 -1
- package/dist/service/restart-session-restorer.js +1 -1
- package/dist/service/run-event-service.js +49 -42
- package/dist/service/run-workbench-service.js +3 -3
- package/dist/service/runner-interaction-service.js +6 -5
- package/dist/service/runner-service.js +1 -1
- package/dist/service/session-recent-activity.js +2 -1
- package/dist/service/skill-directory-service.js +1 -1
- package/dist/service/skill-install-service.js +2 -2
- package/dist/service/terminal-service.js +1 -1
- package/dist/service/workbench-event-projection.js +3 -2
- package/dist/service/workbench-event-service.js +1 -1
- package/dist/service/workspace-service.js +3 -2
- package/dist/session/attachments.js +110 -0
- package/dist/session/contracts.js +1 -0
- package/dist/{util → session}/conversation-identity.js +1 -1
- package/dist/session/input-validation.js +15 -0
- package/dist/{service → session}/native-session-projection-service.js +40 -11
- package/dist/session/pagination.js +77 -0
- package/dist/{util → session}/runner-native-session-parsers.js +2 -1
- package/dist/session/runtime/approvals.js +90 -0
- package/dist/session/runtime/conversation-projection.js +310 -0
- package/dist/session/runtime/type-guards.js +19 -0
- package/dist/{service → session}/session-catalog-service.js +5 -4
- package/dist/{service → session}/session-command-service.js +3 -3
- package/dist/{service → session}/session-identity-service.js +1 -1
- package/dist/{service → session}/session-lifecycle-service.js +18 -7
- package/dist/{service → session}/session-message-service.js +6 -5
- package/dist/{service → session}/session-presentation-service.js +1 -1
- package/dist/{service → session}/session-query-service.js +2 -2
- package/dist/{service → session}/session-schedule-service.js +2 -2
- package/dist/util/records.js +3 -0
- package/dist/workspace/contracts.js +1 -0
- package/dist/workspace/file-index.js +534 -0
- package/dist/workspace/files.js +466 -0
- package/dist/workspace/git.js +991 -0
- package/dist/workspace/path-access.js +184 -0
- package/dist/workspace/utf8.js +12 -0
- package/dist/{service → workspace}/workspace-change-service.js +45 -21
- package/dist/{service → workspace}/workspace-code-navigation-service.js +6 -6
- package/dist/{service → workspace}/workspace-file-manager-service.js +1 -1
- package/dist/{service → workspace}/workspace-file-service.js +16 -16
- package/dist/{service → workspace}/workspace-git-exclude-service.js +1 -1
- package/dist/{service → workspace}/workspace-queue-workbench-service.js +3 -2
- package/dist/{service → workspace}/workspace-session-service.js +45 -40
- package/dist/{service → workspace}/workspace-upload-service.js +28 -28
- package/dist/{service → workspace}/workspace-watch-service.js +29 -28
- package/dist/{service → workspace}/workspace-workbench-service.js +4 -3
- package/package.json +4 -4
- package/dist/service/hosted-conversation-node-service.js +0 -2252
- package/dist/service/run-domain-state.js +0 -4
- package/dist/service/session-domain-state.js +0 -9
- package/dist/service/workspace-domain-state.js +0 -41
- package/dist/util/node-operation-parsers.js +0 -320
- package/dist/workspace.js +0 -2168
- /package/dist/{connector → application}/node-connector-options.js +0 -0
- /package/dist/{util → connection}/node-operation-data.js +0 -0
- /package/dist/{connector → connection}/node-operation-router.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-sandbox-profile.js +0 -0
- /package/dist/{service → hosting}/hosted-conversation-store.js +0 -0
- /package/dist/{util → mcp}/secret-environment.js +0 -0
- /package/dist/{claude-channel.js → runner/claude/claude-channel.js} +0 -0
- /package/dist/{util → runner}/personal-instructions.js +0 -0
- /package/dist/{util → runner}/runner-error.js +0 -0
- /package/dist/{service/conversation-work-process.js → session/runtime/work-process.js} +0 -0
- /package/dist/{service → session}/session-context-service.js +0 -0
- /package/dist/{util → workspace}/git-credential-client.js +0 -0
- /package/dist/{service → workspace}/workspace-content-search-service.js +0 -0
- /package/dist/{service → workspace}/workspace-watch-snapshot-service.js +0 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { createHash, randomUUID } from 'node:crypto';
|
|
2
2
|
import { link, lstat, mkdir, open, readFile, rename, rm } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join, posix, resolve } from 'node:path';
|
|
4
|
-
import { parseComposerAttachmentUpload, validComposerAttachmentName } from '../
|
|
5
|
-
import { preflightWorkspaceUpload, workspaceUploadTemporaryName } from '
|
|
4
|
+
import { parseComposerAttachmentUpload, validComposerAttachmentName } from '../session/attachments.js';
|
|
5
|
+
import { preflightWorkspaceUpload, workspaceUploadTemporaryName } from './files.js';
|
|
6
6
|
const CHUNK_BYTES = 512 * 1024;
|
|
7
7
|
const TTL_MS = 60 * 60_000;
|
|
8
8
|
const MAX_ATTACHMENT_BYTES = 5 * 1024 * 1024;
|
|
9
9
|
export class WorkspaceUploadService {
|
|
10
|
-
state;
|
|
11
10
|
onCompleted;
|
|
12
11
|
temporaryRoot;
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
uploads = new Map();
|
|
13
|
+
composerAttachments = new Map();
|
|
14
|
+
constructor(onCompleted, temporaryRoot) {
|
|
15
15
|
this.onCompleted = onCompleted;
|
|
16
16
|
this.temporaryRoot = temporaryRoot;
|
|
17
17
|
}
|
|
@@ -45,8 +45,8 @@ export class WorkspaceUploadService {
|
|
|
45
45
|
if (attachment !== undefined &&
|
|
46
46
|
(!validComposerAttachmentName(input.name) ||
|
|
47
47
|
input.size > MAX_ATTACHMENT_BYTES ||
|
|
48
|
-
this.
|
|
49
|
-
[...this.
|
|
48
|
+
this.composerAttachments.has(attachment.id) ||
|
|
49
|
+
[...this.uploads.values()].some((upload) => upload.composerAttachment?.id === attachment.id)))
|
|
50
50
|
throw new Error('COMPOSER_ATTACHMENT_INVALID');
|
|
51
51
|
const target = attachment === undefined
|
|
52
52
|
? await preflightWorkspaceUpload(workspace.path, typeof input.directory === 'string' ? input.directory : '.', input.name)
|
|
@@ -57,13 +57,13 @@ export class WorkspaceUploadService {
|
|
|
57
57
|
throw new Error('UPLOAD_TARGET_DIRECTORY');
|
|
58
58
|
if (target.status === 'EXISTS_FILE' && !input.overwrite)
|
|
59
59
|
throw new Error('UPLOAD_TARGET_EXISTS');
|
|
60
|
-
if ([...this.
|
|
60
|
+
if ([...this.uploads.values()].some((upload) => upload.workspaceId === workspace.id && upload.targetPath === target.absolutePath))
|
|
61
61
|
throw new Error('UPLOAD_TARGET_BUSY');
|
|
62
62
|
const id = randomUUID();
|
|
63
63
|
const temporaryPath = resolve(dirname(target.absolutePath), workspaceUploadTemporaryName(id));
|
|
64
64
|
const handle = await open(temporaryPath, 'wx+');
|
|
65
65
|
const timer = setTimeout(() => {
|
|
66
|
-
const upload = this.
|
|
66
|
+
const upload = this.uploads.get(id);
|
|
67
67
|
if (upload !== undefined)
|
|
68
68
|
void this.remove(upload).catch(() => undefined);
|
|
69
69
|
}, TTL_MS);
|
|
@@ -82,7 +82,7 @@ export class WorkspaceUploadService {
|
|
|
82
82
|
receivedBytes: 0,
|
|
83
83
|
timer
|
|
84
84
|
};
|
|
85
|
-
this.
|
|
85
|
+
this.uploads.set(id, upload);
|
|
86
86
|
return this.status(id);
|
|
87
87
|
}
|
|
88
88
|
async write(input) {
|
|
@@ -115,7 +115,7 @@ export class WorkspaceUploadService {
|
|
|
115
115
|
}
|
|
116
116
|
async createDirect(workspace, input) {
|
|
117
117
|
const normalized = input.path.replaceAll('\\', '/');
|
|
118
|
-
const existing = [...this.
|
|
118
|
+
const existing = [...this.uploads.values()].find((upload) => input.composerAttachment === undefined &&
|
|
119
119
|
upload.composerAttachment === undefined &&
|
|
120
120
|
upload.workspaceId === workspace.id &&
|
|
121
121
|
upload.path === normalized &&
|
|
@@ -203,7 +203,7 @@ export class WorkspaceUploadService {
|
|
|
203
203
|
await rm(upload.temporaryPath);
|
|
204
204
|
}
|
|
205
205
|
clearTimeout(upload.timer);
|
|
206
|
-
this.
|
|
206
|
+
this.uploads.delete(upload.id);
|
|
207
207
|
this.onCompleted(upload.workspaceId);
|
|
208
208
|
if (upload.composerAttachment !== undefined) {
|
|
209
209
|
const attachment = {
|
|
@@ -218,7 +218,7 @@ export class WorkspaceUploadService {
|
|
|
218
218
|
reserved: false,
|
|
219
219
|
timer: undefined
|
|
220
220
|
};
|
|
221
|
-
this.
|
|
221
|
+
this.composerAttachments.set(attachment.id, attachment);
|
|
222
222
|
this.scheduleAttachmentExpiry(attachment);
|
|
223
223
|
}
|
|
224
224
|
return {
|
|
@@ -231,10 +231,10 @@ export class WorkspaceUploadService {
|
|
|
231
231
|
async cancel(uploadId) {
|
|
232
232
|
if (typeof uploadId !== 'string')
|
|
233
233
|
throw new Error('UPLOAD_NOT_FOUND');
|
|
234
|
-
const active = this.
|
|
234
|
+
const active = this.uploads.get(uploadId);
|
|
235
235
|
if (active !== undefined)
|
|
236
236
|
return this.remove(active);
|
|
237
|
-
const attachment = this.
|
|
237
|
+
const attachment = this.composerAttachments.get(uploadId);
|
|
238
238
|
if (attachment === undefined)
|
|
239
239
|
throw new Error('UPLOAD_NOT_FOUND');
|
|
240
240
|
if (attachment.reserved)
|
|
@@ -245,7 +245,7 @@ export class WorkspaceUploadService {
|
|
|
245
245
|
if (new Set(ids).size !== ids.length)
|
|
246
246
|
throw new Error('COMPOSER_ATTACHMENT_UNAVAILABLE');
|
|
247
247
|
const storedAttachments = ids.map((id) => {
|
|
248
|
-
const stored = this.
|
|
248
|
+
const stored = this.composerAttachments.get(id);
|
|
249
249
|
if (stored === undefined || stored.workspaceId !== workspaceId || stored.reserved)
|
|
250
250
|
throw new Error('COMPOSER_ATTACHMENT_UNAVAILABLE');
|
|
251
251
|
return stored;
|
|
@@ -258,7 +258,7 @@ export class WorkspaceUploadService {
|
|
|
258
258
|
let active = true;
|
|
259
259
|
const assertReserved = () => {
|
|
260
260
|
if (!active ||
|
|
261
|
-
storedAttachments.some((stored) => this.
|
|
261
|
+
storedAttachments.some((stored) => this.composerAttachments.get(stored.id) !== stored))
|
|
262
262
|
throw new Error('COMPOSER_ATTACHMENT_UNAVAILABLE');
|
|
263
263
|
};
|
|
264
264
|
const release = () => {
|
|
@@ -266,7 +266,7 @@ export class WorkspaceUploadService {
|
|
|
266
266
|
return;
|
|
267
267
|
active = false;
|
|
268
268
|
for (const stored of storedAttachments) {
|
|
269
|
-
if (this.
|
|
269
|
+
if (this.composerAttachments.get(stored.id) !== stored)
|
|
270
270
|
continue;
|
|
271
271
|
stored.reserved = false;
|
|
272
272
|
this.scheduleAttachmentExpiry(stored);
|
|
@@ -298,7 +298,7 @@ export class WorkspaceUploadService {
|
|
|
298
298
|
assertReserved();
|
|
299
299
|
retain(storedAttachments.map((stored) => dirname(stored.targetPath)));
|
|
300
300
|
for (const stored of storedAttachments)
|
|
301
|
-
this.
|
|
301
|
+
this.composerAttachments.delete(stored.id);
|
|
302
302
|
active = false;
|
|
303
303
|
},
|
|
304
304
|
release
|
|
@@ -310,13 +310,13 @@ export class WorkspaceUploadService {
|
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
async shutdown() {
|
|
313
|
-
await Promise.allSettled([...this.
|
|
314
|
-
for (const attachment of this.
|
|
313
|
+
await Promise.allSettled([...this.uploads.values()].map((upload) => this.remove(upload)));
|
|
314
|
+
for (const attachment of this.composerAttachments.values())
|
|
315
315
|
await this.removeCompleted(attachment);
|
|
316
|
-
this.
|
|
316
|
+
this.composerAttachments.clear();
|
|
317
317
|
}
|
|
318
318
|
fileResource(workspaceId, resourcePath) {
|
|
319
|
-
for (const attachment of this.
|
|
319
|
+
for (const attachment of this.composerAttachments.values())
|
|
320
320
|
if (attachment.workspaceId === workspaceId && attachment.path === resourcePath)
|
|
321
321
|
return attachment.targetPath;
|
|
322
322
|
return undefined;
|
|
@@ -324,13 +324,13 @@ export class WorkspaceUploadService {
|
|
|
324
324
|
require(id) {
|
|
325
325
|
if (typeof id !== 'string')
|
|
326
326
|
throw new Error('UPLOAD_NOT_FOUND');
|
|
327
|
-
const upload = this.
|
|
327
|
+
const upload = this.uploads.get(id);
|
|
328
328
|
if (upload === undefined || upload.cancelled)
|
|
329
329
|
throw new Error('UPLOAD_NOT_FOUND');
|
|
330
330
|
return upload;
|
|
331
331
|
}
|
|
332
332
|
assertActive(upload, signal) {
|
|
333
|
-
if (this.
|
|
333
|
+
if (this.uploads.get(upload.id) !== upload || upload.cancelled || signal?.aborted)
|
|
334
334
|
throw new Error('UPLOAD_CANCELLED');
|
|
335
335
|
}
|
|
336
336
|
async validateCommit(upload) {
|
|
@@ -381,12 +381,12 @@ export class WorkspaceUploadService {
|
|
|
381
381
|
await rm(upload.temporaryPath, { force: true });
|
|
382
382
|
if (upload.composerAttachment !== undefined)
|
|
383
383
|
await rm(dirname(upload.targetPath), { recursive: true, force: true });
|
|
384
|
-
this.
|
|
384
|
+
this.uploads.delete(upload.id);
|
|
385
385
|
}
|
|
386
386
|
async removeCompleted(attachment) {
|
|
387
|
-
if (this.
|
|
387
|
+
if (this.composerAttachments.get(attachment.id) !== attachment)
|
|
388
388
|
return;
|
|
389
|
-
this.
|
|
389
|
+
this.composerAttachments.delete(attachment.id);
|
|
390
390
|
clearTimeout(attachment.timer);
|
|
391
391
|
await rm(dirname(attachment.targetPath), { recursive: true, force: true }).catch(() => undefined);
|
|
392
392
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { posix } from 'node:path';
|
|
2
2
|
const WATCH_TTL_MS = 45_000;
|
|
3
3
|
export class WorkspaceWatchService {
|
|
4
|
-
state;
|
|
5
4
|
onSessionWatchRequired;
|
|
6
5
|
onSessionWatchUnused;
|
|
7
6
|
onWorkspaceWatchUnused;
|
|
8
7
|
onWatchRemoved;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
watches = new Map();
|
|
9
|
+
watchRevisions = new Map();
|
|
10
|
+
watchSnapshotSequence = 0;
|
|
11
|
+
constructor(onSessionWatchRequired, onSessionWatchUnused, onWorkspaceWatchUnused, onWatchRemoved = () => undefined) {
|
|
11
12
|
this.onSessionWatchRequired = onSessionWatchRequired;
|
|
12
13
|
this.onSessionWatchUnused = onSessionWatchUnused;
|
|
13
14
|
this.onWorkspaceWatchUnused = onWorkspaceWatchUnused;
|
|
@@ -58,10 +59,10 @@ export class WorkspaceWatchService {
|
|
|
58
59
|
}
|
|
59
60
|
create(workspaceId, watchId, sessionHash, workbenchConnectionId, nodeGeneration, topics, prepareFiles = false) {
|
|
60
61
|
const key = `${sessionHash}:${workbenchConnectionId}`;
|
|
61
|
-
for (const [activeWorkspaceId, watches] of this.
|
|
62
|
+
for (const [activeWorkspaceId, watches] of this.watches)
|
|
62
63
|
if (activeWorkspaceId !== workspaceId && watches.has(key))
|
|
63
64
|
this.remove(activeWorkspaceId, key);
|
|
64
|
-
const previous = this.
|
|
65
|
+
const previous = this.watches.get(workspaceId)?.get(key);
|
|
65
66
|
const watch = {
|
|
66
67
|
workspaceId,
|
|
67
68
|
watchId,
|
|
@@ -74,9 +75,9 @@ export class WorkspaceWatchService {
|
|
|
74
75
|
timer: undefined
|
|
75
76
|
};
|
|
76
77
|
watch.timer = this.expiryTimer(workspaceId, key);
|
|
77
|
-
const watches = this.
|
|
78
|
+
const watches = this.watches.get(workspaceId) ?? new Map();
|
|
78
79
|
watches.set(key, watch);
|
|
79
|
-
this.
|
|
80
|
+
this.watches.set(workspaceId, watches);
|
|
80
81
|
if (previous !== undefined) {
|
|
81
82
|
clearTimeout(previous.timer);
|
|
82
83
|
this.onWatchRemoved(previous);
|
|
@@ -88,7 +89,7 @@ export class WorkspaceWatchService {
|
|
|
88
89
|
return watch;
|
|
89
90
|
}
|
|
90
91
|
renew(workspaceId, key, watchId) {
|
|
91
|
-
const watch = this.
|
|
92
|
+
const watch = this.watches.get(workspaceId)?.get(key);
|
|
92
93
|
if (watch === undefined || watch.watchId !== watchId)
|
|
93
94
|
return undefined;
|
|
94
95
|
if (watch.expiresAt <= Date.now()) {
|
|
@@ -101,26 +102,26 @@ export class WorkspaceWatchService {
|
|
|
101
102
|
return watch;
|
|
102
103
|
}
|
|
103
104
|
matches(workspaceId, key, watchId) {
|
|
104
|
-
const watch = this.
|
|
105
|
+
const watch = this.watches.get(workspaceId)?.get(key);
|
|
105
106
|
return watch !== undefined && watch.watchId === watchId && watch.expiresAt > Date.now();
|
|
106
107
|
}
|
|
107
108
|
observes(workspaceId, sessionHash, connectionId) {
|
|
108
|
-
const watch = this.
|
|
109
|
+
const watch = this.watches.get(workspaceId)?.get(`${sessionHash}:${connectionId}`);
|
|
109
110
|
return watch !== undefined && watch.expiresAt > Date.now();
|
|
110
111
|
}
|
|
111
112
|
existing(workspaceId, key) {
|
|
112
|
-
const watch = this.
|
|
113
|
+
const watch = this.watches.get(workspaceId)?.get(key);
|
|
113
114
|
return watch !== undefined && watch.expiresAt > Date.now() ? watch : undefined;
|
|
114
115
|
}
|
|
115
116
|
remove(workspaceId, key) {
|
|
116
|
-
const watches = this.
|
|
117
|
+
const watches = this.watches.get(workspaceId);
|
|
117
118
|
const watch = watches?.get(key);
|
|
118
119
|
if (watch === undefined)
|
|
119
120
|
return;
|
|
120
121
|
clearTimeout(watch.timer);
|
|
121
122
|
watches?.delete(key);
|
|
122
123
|
if (watches?.size === 0)
|
|
123
|
-
this.
|
|
124
|
+
this.watches.delete(workspaceId);
|
|
124
125
|
this.onWatchRemoved(watch);
|
|
125
126
|
if (watches?.size === 0) {
|
|
126
127
|
this.clearRevisions(workspaceId);
|
|
@@ -130,8 +131,8 @@ export class WorkspaceWatchService {
|
|
|
130
131
|
this.onSessionWatchUnused(workspaceId);
|
|
131
132
|
}
|
|
132
133
|
clear(workspaceId) {
|
|
133
|
-
const watches = this.
|
|
134
|
-
this.
|
|
134
|
+
const watches = this.watches.get(workspaceId);
|
|
135
|
+
this.watches.delete(workspaceId);
|
|
135
136
|
if (watches !== undefined)
|
|
136
137
|
for (const watch of watches.values()) {
|
|
137
138
|
clearTimeout(watch.timer);
|
|
@@ -142,37 +143,37 @@ export class WorkspaceWatchService {
|
|
|
142
143
|
this.onWorkspaceWatchUnused(workspaceId);
|
|
143
144
|
}
|
|
144
145
|
clearAll() {
|
|
145
|
-
const workspaceIds = [...this.
|
|
146
|
-
const watchesByWorkspace = [...this.
|
|
147
|
-
this.
|
|
146
|
+
const workspaceIds = [...this.watches.keys()];
|
|
147
|
+
const watchesByWorkspace = [...this.watches.values()];
|
|
148
|
+
this.watches.clear();
|
|
148
149
|
for (const watches of watchesByWorkspace)
|
|
149
150
|
for (const watch of watches.values()) {
|
|
150
151
|
clearTimeout(watch.timer);
|
|
151
152
|
this.onWatchRemoved(watch);
|
|
152
153
|
}
|
|
153
|
-
this.
|
|
154
|
+
this.watchRevisions.clear();
|
|
154
155
|
for (const workspaceId of workspaceIds) {
|
|
155
156
|
this.onSessionWatchUnused(workspaceId);
|
|
156
157
|
this.onWorkspaceWatchUnused(workspaceId);
|
|
157
158
|
}
|
|
158
159
|
}
|
|
159
160
|
nextRevision(viewKey) {
|
|
160
|
-
const revision = (this.
|
|
161
|
-
this.
|
|
161
|
+
const revision = (this.watchRevisions.get(viewKey) ?? 0) + 1;
|
|
162
|
+
this.watchRevisions.set(viewKey, revision);
|
|
162
163
|
return revision;
|
|
163
164
|
}
|
|
164
165
|
nextSnapshotSequence() {
|
|
165
|
-
this.
|
|
166
|
-
return this.
|
|
166
|
+
this.watchSnapshotSequence += 1;
|
|
167
|
+
return this.watchSnapshotSequence;
|
|
167
168
|
}
|
|
168
169
|
topicActive(workspaceId, topic) {
|
|
169
|
-
return [...(this.
|
|
170
|
+
return [...(this.watches.get(workspaceId)?.values() ?? [])].some((watch) => topic === 'files' ? watch.topics.files !== undefined : watch.topics[topic]);
|
|
170
171
|
}
|
|
171
172
|
activeWatches(workspaceId) {
|
|
172
|
-
return [...(this.
|
|
173
|
+
return [...(this.watches.get(workspaceId)?.values() ?? [])].filter((watch) => watch.expiresAt > Date.now());
|
|
173
174
|
}
|
|
174
175
|
activeWorkspaceIds(topic) {
|
|
175
|
-
return [...this.
|
|
176
|
+
return [...this.watches.keys()].filter((workspaceId) => this.topicActive(workspaceId, topic));
|
|
176
177
|
}
|
|
177
178
|
expiryTimer(workspaceId, key) {
|
|
178
179
|
const timer = setTimeout(() => this.remove(workspaceId, key), WATCH_TTL_MS);
|
|
@@ -180,9 +181,9 @@ export class WorkspaceWatchService {
|
|
|
180
181
|
return timer;
|
|
181
182
|
}
|
|
182
183
|
clearRevisions(workspaceId) {
|
|
183
|
-
for (const key of [...this.
|
|
184
|
+
for (const key of [...this.watchRevisions.keys()])
|
|
184
185
|
if (key.startsWith(`${workspaceId}:`))
|
|
185
|
-
this.
|
|
186
|
+
this.watchRevisions.delete(key);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
189
|
function normalizeViewPath(value) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
2
|
import { isAbsolute, win32 } from 'node:path';
|
|
3
|
-
import { listGitHistoryRefs,
|
|
3
|
+
import { listGitHistoryRefs, openGitHistoryFileContent, readGitHistory, readGitHistoryFileDiff, readGitHistoryFileContentRange, readGitHistoryFiles, readCurrentChangeDiff, readRestrictedDiff, resolveGitRepository, resolveGitRepositoryTarget, resolveWorkspaceGitRoot, restoreCurrentChange } from './git.js';
|
|
4
|
+
import { normalizeFilePreviewPath } from './files.js';
|
|
4
5
|
import { WorkspaceCodeNavigationService } from './workspace-code-navigation-service.js';
|
|
5
6
|
import { WorkspaceContentSearchService } from './workspace-content-search-service.js';
|
|
6
|
-
import { WorkspaceWatchController } from '
|
|
7
|
+
import { WorkspaceWatchController } from '../service/workspace-watch-controller.js';
|
|
7
8
|
import { WorkspaceWatchSnapshotService } from './workspace-watch-snapshot-service.js';
|
|
8
9
|
export class WorkspaceWorkbenchService {
|
|
9
10
|
options;
|
|
@@ -104,7 +105,7 @@ export class WorkspaceWorkbenchService {
|
|
|
104
105
|
async readPredictionFile(workspaceId, path, worktreePath) {
|
|
105
106
|
const workspace = this.options.requireWorkspace(workspaceId);
|
|
106
107
|
const repository = await this.fileRepository(workspace, worktreePath ? { worktreePath, path } : {});
|
|
107
|
-
const { readWorkspaceTextFile } = await import('
|
|
108
|
+
const { readWorkspaceTextFile } = await import('./files.js');
|
|
108
109
|
return readWorkspaceTextFile(repository, path, 0, 64 * 1024);
|
|
109
110
|
}
|
|
110
111
|
async readFile(input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@myagentroam/node",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.37",
|
|
4
4
|
"description": "MyAgentRoam Node runtime CLI.",
|
|
5
5
|
"license": "Apache-2.0 AND GPL-2.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"sharp": "0.35.5",
|
|
39
39
|
"ws": "^8.21.3",
|
|
40
40
|
"zod": "4.4.3",
|
|
41
|
-
"@myagentroam/agent": "0.11.
|
|
41
|
+
"@myagentroam/agent": "0.11.37",
|
|
42
|
+
"@myagentroam/protocol": "0.11.37",
|
|
42
43
|
"@myagentroam/code-navigation": "0.11.0",
|
|
43
|
-
"@myagentroam/marctl": "0.11.
|
|
44
|
-
"@myagentroam/protocol": "0.11.35"
|
|
44
|
+
"@myagentroam/marctl": "0.11.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/ws": "^8.18.1"
|