@myagentroam/node 0.11.36 → 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.
Files changed (142) hide show
  1. package/dist/application/execution-lifecycle.js +54 -0
  2. package/dist/application/node-lifecycle.js +104 -0
  3. package/dist/application/node-operation-admission.js +51 -0
  4. package/dist/application/node-operation-contracts.js +1 -0
  5. package/dist/application/runner-composition.js +22 -0
  6. package/dist/application/session-projection-composition.js +26 -0
  7. package/dist/application/workspace-application.js +61 -0
  8. package/dist/application/workspace-composition.js +21 -0
  9. package/dist/capabilities.js +2 -2
  10. package/dist/codex-app-server.js +1 -471
  11. package/dist/connection/authorization.js +26 -0
  12. package/dist/{service → connection}/direct-transfer-service.js +1 -1
  13. package/dist/connection/endpoints.js +32 -0
  14. package/dist/connector.js +144 -252
  15. package/dist/database.js +34 -14
  16. package/dist/git-askpass.js +1 -1
  17. package/dist/git-execution-helper.js +1 -1
  18. package/dist/hosting/hosted-conversation-file-identity.js +27 -0
  19. package/dist/hosting/hosted-conversation-file-operations.js +44 -0
  20. package/dist/hosting/hosted-conversation-node-service.js +974 -0
  21. package/dist/hosting/hosted-conversation-runs.js +599 -0
  22. package/dist/hosting/hosted-conversation-templates.js +280 -0
  23. package/dist/hosting/hosted-conversation-uploads.js +344 -0
  24. package/dist/hosting/hosted-conversation-watch.js +194 -0
  25. package/dist/hosting/runtime-contracts.js +1 -0
  26. package/dist/runner/abstract-runner.js +4 -13
  27. package/dist/{claude-agent-sdk.js → runner/claude/claude-agent-sdk.js} +2 -2
  28. package/dist/runner/claude/conversation-parser.js +2 -1
  29. package/dist/runner/claude/managed-run-controller.js +6 -7
  30. package/dist/runner/claude/message-parsers.js +2 -1
  31. package/dist/runner/claude/native-transcript.js +2 -1
  32. package/dist/runner/claude/tool-normalizer.js +1 -1
  33. package/dist/runner/claude-code-runner.js +2 -2
  34. package/dist/runner/codex/codex-app-server.js +471 -0
  35. package/dist/runner/codex/conversation-parser.js +4 -2
  36. package/dist/runner/codex/managed-run-controller.js +7 -9
  37. package/dist/runner/codex/native-transcript.js +1 -1
  38. package/dist/runner/codex/tool-normalizer.js +1 -1
  39. package/dist/runner/codex-runner.js +9 -27
  40. package/dist/runner/contracts.js +1 -0
  41. package/dist/runner/mar-agent/conversation-normalizer.js +2 -2
  42. package/dist/runner/mar-agent/history-projection.js +1 -1
  43. package/dist/runner/mar-agent/hosted-conversation-runtime.js +6 -10
  44. package/dist/runner/mar-agent/managed-run-controller.js +85 -61
  45. package/dist/runner/mar-agent-runner.js +1 -1
  46. package/dist/runner/normalization.js +42 -0
  47. package/dist/runner/opencode/conversation-parser.js +1 -1
  48. package/dist/runner/opencode/managed-run-controller.js +6 -7
  49. package/dist/{opencode-server.js → runner/opencode/opencode-server.js} +2 -2
  50. package/dist/runner/opencode/tool-normalizer.js +1 -1
  51. package/dist/runner/opencode-runner.js +4 -5
  52. package/dist/runner/runner-registry.js +4 -1
  53. package/dist/runtime-state.js +48 -372
  54. package/dist/service/computer-use-enablement-service.js +1 -1
  55. package/dist/service/continuous-run-coordinator.js +52 -7
  56. package/dist/service/conversation-history-service.js +4 -4
  57. package/dist/service/conversation-hosting-capability-service.js +1 -1
  58. package/dist/service/conversation-hosting-enablement-service.js +1 -1
  59. package/dist/service/conversation-hosting-lifecycle-service.js +3 -3
  60. package/dist/service/conversation-hosting-maintenance-service.js +1 -1
  61. package/dist/service/conversation-observation.js +1 -1
  62. package/dist/service/conversation-segment-service.js +1 -1
  63. package/dist/service/external-session-resume-service.js +47 -27
  64. package/dist/service/fake-managed-run-service.js +3 -7
  65. package/dist/service/git-operation-service.js +1 -1
  66. package/dist/service/goal-continuation-coordinator.js +14 -7
  67. package/dist/service/mar-agent-model-transport-test-service.js +1 -1
  68. package/dist/service/native-session-watch-service.js +1 -1
  69. package/dist/service/node-control-channel.js +1 -5
  70. package/dist/service/node-request-service.js +1 -1
  71. package/dist/service/node-terminal-channel.js +2 -1
  72. package/dist/service/node-workspace-coordinator.js +3 -2
  73. package/dist/service/notification-mcp-bridge.js +6 -2
  74. package/dist/service/recent-run-projection-service.js +1 -1
  75. package/dist/service/restart-session-restorer.js +1 -1
  76. package/dist/service/run-event-service.js +49 -42
  77. package/dist/service/run-workbench-service.js +3 -3
  78. package/dist/service/runner-interaction-service.js +6 -5
  79. package/dist/service/runner-service.js +1 -1
  80. package/dist/service/session-recent-activity.js +2 -1
  81. package/dist/service/skill-directory-service.js +1 -1
  82. package/dist/service/skill-install-service.js +2 -2
  83. package/dist/service/terminal-service.js +1 -1
  84. package/dist/service/workbench-event-projection.js +3 -2
  85. package/dist/service/workbench-event-service.js +1 -1
  86. package/dist/service/workspace-service.js +3 -2
  87. package/dist/session/attachments.js +110 -0
  88. package/dist/session/contracts.js +1 -0
  89. package/dist/{util → session}/conversation-identity.js +1 -1
  90. package/dist/session/input-validation.js +15 -0
  91. package/dist/{service → session}/native-session-projection-service.js +40 -11
  92. package/dist/session/pagination.js +77 -0
  93. package/dist/{util → session}/runner-native-session-parsers.js +2 -1
  94. package/dist/session/runtime/approvals.js +90 -0
  95. package/dist/session/runtime/conversation-projection.js +310 -0
  96. package/dist/session/runtime/type-guards.js +19 -0
  97. package/dist/{service → session}/session-catalog-service.js +5 -4
  98. package/dist/{service → session}/session-command-service.js +3 -3
  99. package/dist/{service → session}/session-identity-service.js +1 -1
  100. package/dist/{service → session}/session-lifecycle-service.js +18 -7
  101. package/dist/{service → session}/session-message-service.js +6 -5
  102. package/dist/{service → session}/session-presentation-service.js +1 -1
  103. package/dist/{service → session}/session-query-service.js +2 -2
  104. package/dist/{service → session}/session-schedule-service.js +2 -2
  105. package/dist/util/records.js +3 -0
  106. package/dist/workspace/contracts.js +1 -0
  107. package/dist/workspace/file-index.js +534 -0
  108. package/dist/workspace/files.js +466 -0
  109. package/dist/workspace/git.js +991 -0
  110. package/dist/workspace/path-access.js +184 -0
  111. package/dist/workspace/utf8.js +12 -0
  112. package/dist/{service → workspace}/workspace-change-service.js +45 -21
  113. package/dist/{service → workspace}/workspace-code-navigation-service.js +6 -6
  114. package/dist/{service → workspace}/workspace-file-manager-service.js +1 -1
  115. package/dist/{service → workspace}/workspace-file-service.js +16 -16
  116. package/dist/{service → workspace}/workspace-git-exclude-service.js +1 -1
  117. package/dist/{service → workspace}/workspace-queue-workbench-service.js +3 -2
  118. package/dist/{service → workspace}/workspace-session-service.js +45 -40
  119. package/dist/{service → workspace}/workspace-upload-service.js +28 -28
  120. package/dist/{service → workspace}/workspace-watch-service.js +29 -28
  121. package/dist/{service → workspace}/workspace-workbench-service.js +4 -3
  122. package/package.json +5 -5
  123. package/dist/service/hosted-conversation-node-service.js +0 -2252
  124. package/dist/service/run-domain-state.js +0 -4
  125. package/dist/service/session-domain-state.js +0 -9
  126. package/dist/service/workspace-domain-state.js +0 -41
  127. package/dist/util/node-operation-parsers.js +0 -320
  128. package/dist/workspace.js +0 -2168
  129. /package/dist/{connector → application}/node-connector-options.js +0 -0
  130. /package/dist/{util → connection}/node-operation-data.js +0 -0
  131. /package/dist/{connector → connection}/node-operation-router.js +0 -0
  132. /package/dist/{service → hosting}/hosted-conversation-sandbox-profile.js +0 -0
  133. /package/dist/{service → hosting}/hosted-conversation-store.js +0 -0
  134. /package/dist/{util → mcp}/secret-environment.js +0 -0
  135. /package/dist/{claude-channel.js → runner/claude/claude-channel.js} +0 -0
  136. /package/dist/{util → runner}/personal-instructions.js +0 -0
  137. /package/dist/{util → runner}/runner-error.js +0 -0
  138. /package/dist/{service/conversation-work-process.js → session/runtime/work-process.js} +0 -0
  139. /package/dist/{service → session}/session-context-service.js +0 -0
  140. /package/dist/{util → workspace}/git-credential-client.js +0 -0
  141. /package/dist/{service → workspace}/workspace-content-search-service.js +0 -0
  142. /package/dist/{service → workspace}/workspace-watch-snapshot-service.js +0 -0
package/dist/database.js CHANGED
@@ -3,7 +3,7 @@ import { NODE_SCHEMA_MIGRATION_V18 } from './migrations/v018.js';
3
3
  import { NODE_SCHEMA_MIGRATION_V19 } from './migrations/v019.js';
4
4
  import { NODE_SCHEMA_MIGRATION_V20 } from './migrations/v020.js';
5
5
  import { NODE_SCHEMA_MIGRATION_V21 } from './migrations/v021.js';
6
- import { normalizeSessionPrompt } from './util/personal-instructions.js';
6
+ import { normalizeSessionPrompt } from './runner/personal-instructions.js';
7
7
  import { randomUUID } from 'node:crypto';
8
8
  import { closeSync, existsSync, mkdirSync, openSync, rmSync } from 'node:fs';
9
9
  import { dirname } from 'node:path';
@@ -381,7 +381,7 @@ export class NodeDatabase {
381
381
  .get(sessionId);
382
382
  return row === undefined ? undefined : sessionRecord(row);
383
383
  }
384
- movePinnedSession(sessionId, direction) {
384
+ movePinnedSession(sessionId, direction, target) {
385
385
  const current = this.raw
386
386
  .prepare('SELECT workspace_id, pin_order FROM agent_sessions WHERE id = ?')
387
387
  .get(sessionId);
@@ -389,21 +389,41 @@ export class NodeDatabase {
389
389
  throw new Error('SESSION_NOT_PINNED');
390
390
  const order = numberValue(current, 'pin_order');
391
391
  const workspaceId = stringValue(current, 'workspace_id');
392
- const adjacent = this.raw
393
- .prepare(direction === 'up'
394
- ? 'SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND pin_order < ? ORDER BY pin_order DESC LIMIT 1'
395
- : 'SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND pin_order > ? ORDER BY pin_order ASC LIMIT 1')
396
- .get(workspaceId, order);
397
- if (adjacent === undefined)
392
+ const destination = target === undefined
393
+ ? this.raw
394
+ .prepare(direction === 'up'
395
+ ? 'SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND pin_order < ? ORDER BY pin_order DESC LIMIT 1'
396
+ : 'SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND pin_order > ? ORDER BY pin_order ASC LIMIT 1')
397
+ .get(workspaceId, order)
398
+ : this.raw
399
+ .prepare('SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND id = ? AND pin_order IS NOT NULL')
400
+ .get(workspaceId, target.sessionId);
401
+ if (target !== undefined && destination === undefined)
402
+ throw new Error('SESSION_PIN_MOVE_INVALID');
403
+ if (destination === undefined)
404
+ return workspaceId;
405
+ const targetOrder = numberValue(destination, 'pin_order');
406
+ if (targetOrder === order)
407
+ return workspaceId;
408
+ const excludedTargetId = target !== undefined &&
409
+ ((targetOrder > order && target.position === 'before') ||
410
+ (targetOrder < order && target.position === 'after'))
411
+ ? target.sessionId
412
+ : null;
413
+ const displaced = this.raw
414
+ .prepare(`SELECT id, pin_order FROM agent_sessions WHERE workspace_id = ? AND pin_order BETWEEN ? AND ? AND id != ? AND (? IS NULL OR id != ?) ORDER BY pin_order ${targetOrder < order ? 'DESC' : 'ASC'}`)
415
+ .all(workspaceId, Math.min(order, targetOrder), Math.max(order, targetOrder), sessionId, excludedTargetId, excludedTargetId);
416
+ if (displaced.length === 0)
398
417
  return workspaceId;
399
418
  this.raw.exec('BEGIN IMMEDIATE');
400
419
  try {
401
- this.raw
402
- .prepare('UPDATE agent_sessions SET pin_order = ? WHERE id = ?')
403
- .run(order, stringValue(adjacent, 'id'));
404
- this.raw
405
- .prepare('UPDATE agent_sessions SET pin_order = ? WHERE id = ?')
406
- .run(numberValue(adjacent, 'pin_order'), sessionId);
420
+ const update = this.raw.prepare('UPDATE agent_sessions SET pin_order = ? WHERE id = ?');
421
+ let nextOrder = order;
422
+ for (const row of displaced) {
423
+ update.run(nextOrder, stringValue(row, 'id'));
424
+ nextOrder = numberValue(row, 'pin_order');
425
+ }
426
+ update.run(nextOrder, sessionId);
407
427
  this.raw.exec('COMMIT');
408
428
  }
409
429
  catch (error) {
@@ -1,4 +1,4 @@
1
- import { gitCredentialRequest } from './util/git-credential-client.js';
1
+ import { gitCredentialRequest } from './workspace/git-credential-client.js';
2
2
  // SSH_ASKPASS points to node itself; NODE_OPTIONS imports this before its prompt argument.
3
3
  try {
4
4
  const result = await gitCredentialRequest('/passphrase', { id: process.env.MAR_GIT_KEY_ID });
@@ -1,7 +1,7 @@
1
1
  import { spawn, execFileSync } from 'node:child_process';
2
2
  import { existsSync } from 'node:fs';
3
3
  import { resolve } from 'node:path';
4
- import { gitCredentialRequest, originalGitEnvironment } from './util/git-credential-client.js';
4
+ import { gitCredentialRequest, originalGitEnvironment } from './workspace/git-credential-client.js';
5
5
  async function run(command, args, options = {}) {
6
6
  return new Promise((resolve, reject) => {
7
7
  const child = spawn(command, args, {
@@ -0,0 +1,27 @@
1
+ import { constants } from 'node:fs';
2
+ import { lstat, open } from 'node:fs/promises';
3
+ export async function assertRegularFile(path, expectedSize) {
4
+ const metadata = await regularFileMetadata(path);
5
+ if (metadata.size !== expectedSize)
6
+ throw new Error('HOSTED_CONVERSATION_FILE_INVALID');
7
+ }
8
+ export async function openRegularFile(path) {
9
+ return open(path, constants.O_RDONLY | constants.O_NOFOLLOW).catch(() => {
10
+ throw new Error('HOSTED_CONVERSATION_FILE_INVALID');
11
+ });
12
+ }
13
+ export async function regularFileMetadata(path) {
14
+ const metadata = await lstat(path).catch(() => {
15
+ throw new Error('HOSTED_CONVERSATION_FILE_INVALID');
16
+ });
17
+ assertRegularFileMetadata(metadata);
18
+ return metadata;
19
+ }
20
+ export function assertRegularFileMetadata(metadata) {
21
+ if (!metadata.isFile() ||
22
+ metadata.isSymbolicLink() ||
23
+ metadata.nlink !== 1 ||
24
+ !Number.isSafeInteger(metadata.size) ||
25
+ metadata.size < 0)
26
+ throw new Error('HOSTED_CONVERSATION_FILE_INVALID');
27
+ }
@@ -0,0 +1,44 @@
1
+ /** Owns file mutation admission and deletion conflict lifetimes. */
2
+ export class HostedConversationFileOperations {
3
+ writes = new Map();
4
+ deletes = new Set();
5
+ busy(conversationId) {
6
+ return this.writes.has(conversationId);
7
+ }
8
+ async write(conversationId, uploadId, operation) {
9
+ const writes = this.writes.get(conversationId) ?? new Set();
10
+ if (uploadId !== undefined && [...writes].some((write) => write.uploadId === uploadId))
11
+ throw new Error('HOSTED_CONVERSATION_FILE_CONFLICT');
12
+ // Admission precedes the operation's first asynchronous preparation.
13
+ const write = {
14
+ ...(uploadId === undefined ? {} : { uploadId }),
15
+ completion: Promise.resolve().then(operation)
16
+ };
17
+ writes.add(write);
18
+ this.writes.set(conversationId, writes);
19
+ try {
20
+ return await write.completion;
21
+ }
22
+ finally {
23
+ writes.delete(write);
24
+ if (writes.size === 0)
25
+ this.writes.delete(conversationId);
26
+ }
27
+ }
28
+ beginDelete(key) {
29
+ if (this.deletes.has(key))
30
+ throw new Error('HOSTED_CONVERSATION_FILE_CONFLICT');
31
+ this.deletes.add(key);
32
+ }
33
+ endDelete(key) {
34
+ this.deletes.delete(key);
35
+ }
36
+ async wait(conversationId) {
37
+ const writes = this.writes.get(conversationId);
38
+ if (writes)
39
+ await Promise.allSettled([...writes].map((write) => write.completion));
40
+ }
41
+ async close() {
42
+ await Promise.all([...this.writes.keys()].map((id) => this.wait(id)));
43
+ }
44
+ }