@myagentroam/node 0.9.9 → 0.9.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/dist/capabilities.js +2 -92
  2. package/dist/claude-agent-sdk.js +2 -330
  3. package/dist/claude-channel.js +2 -44
  4. package/dist/codex-app-server.js +2 -503
  5. package/dist/config.js +2 -56
  6. package/dist/connector/node-connector-options.js +2 -1
  7. package/dist/connector/node-operation-router.js +2 -22
  8. package/dist/connector.js +2 -845
  9. package/dist/control-outbound-scheduler.js +2 -154
  10. package/dist/database.js +2 -1418
  11. package/dist/event-buffer.js +2 -19
  12. package/dist/fake-runner.js +2 -129
  13. package/dist/health.js +2 -3
  14. package/dist/main.js +2 -54
  15. package/dist/migrations/v001.js +3 -144
  16. package/dist/migrations/v002.js +2 -143
  17. package/dist/migrations/v003.js +2 -44
  18. package/dist/migrations/v004.js +34 -30
  19. package/dist/native-jsonl-reader.js +2 -186
  20. package/dist/native-session-history.js +2 -1119
  21. package/dist/opencode-runtime.js +2 -80
  22. package/dist/opencode-server.js +2 -263
  23. package/dist/operational.js +2 -122
  24. package/dist/process-tree.js +2 -18
  25. package/dist/rotating-log.js +2 -67
  26. package/dist/runner/abstract-runner.js +2 -232
  27. package/dist/runner/claude/managed-run-controller.js +2 -345
  28. package/dist/runner/claude-code-runner.js +2 -303
  29. package/dist/runner/codex/composer-image-markers.js +2 -0
  30. package/dist/runner/codex/conversation-parser.js +2 -861
  31. package/dist/runner/codex/managed-run-controller.js +2 -460
  32. package/dist/runner/codex-runner.js +2 -628
  33. package/dist/runner/fake-test-runner.js +2 -47
  34. package/dist/runner/opencode/conversation-parser.js +2 -221
  35. package/dist/runner/opencode/managed-run-controller.js +2 -537
  36. package/dist/runner/opencode-runner.js +2 -448
  37. package/dist/runner/runner-registry.js +2 -90
  38. package/dist/runner-command-engine.js +2 -70
  39. package/dist/runner-profiles.js +2 -215
  40. package/dist/runner-usage.js +2 -190
  41. package/dist/runtime-command-detector.js +2 -73
  42. package/dist/runtime-state.js +2 -982
  43. package/dist/service/attachment-domain-state.js +2 -7
  44. package/dist/service/conversation-history-service.js +2 -457
  45. package/dist/service/conversation-segment-service.js +2 -162
  46. package/dist/service/external-session-resume-service.js +2 -118
  47. package/dist/service/fake-managed-run-service.js +2 -60
  48. package/dist/service/managed-runner-session-service.js +2 -35
  49. package/dist/service/mcp-installation-verifier.js +2 -87
  50. package/dist/service/mcp-node-operation-service.js +2 -90
  51. package/dist/service/mcp-package-installer.js +2 -136
  52. package/dist/service/native-session-projection-service.js +2 -280
  53. package/dist/service/native-session-watch-service.js +2 -383
  54. package/dist/service/node-connection-lifecycle-service.js +2 -84
  55. package/dist/service/node-control-channel.js +2 -85
  56. package/dist/service/node-control-message-service.js +2 -107
  57. package/dist/service/node-request-service.js +2 -52
  58. package/dist/service/node-run-event-bridge.js +2 -83
  59. package/dist/service/node-terminal-channel.js +2 -182
  60. package/dist/service/node-upgrade-coordinator.js +2 -137
  61. package/dist/service/node-workspace-coordinator.js +2 -70
  62. package/dist/service/recent-run-projection-service.js +2 -78
  63. package/dist/service/run-attachment-service.js +2 -194
  64. package/dist/service/run-domain-state.js +2 -4
  65. package/dist/service/run-event-service.js +2 -193
  66. package/dist/service/run-workbench-service.js +2 -104
  67. package/dist/service/runner-channel-message-service.js +2 -20
  68. package/dist/service/runner-interaction-service.js +2 -243
  69. package/dist/service/runner-service.js +2 -71
  70. package/dist/service/session-catalog-service.js +2 -224
  71. package/dist/service/session-command-service.js +2 -76
  72. package/dist/service/session-context-service.js +2 -101
  73. package/dist/service/session-domain-state.js +2 -9
  74. package/dist/service/session-identity-service.js +2 -86
  75. package/dist/service/session-lifecycle-service.js +2 -240
  76. package/dist/service/session-message-service.js +2 -173
  77. package/dist/service/session-presentation-service.js +2 -43
  78. package/dist/service/session-query-service.js +2 -82
  79. package/dist/service/skill-directory-service.js +2 -238
  80. package/dist/service/skill-install-service.js +2 -434
  81. package/dist/service/skill-node-operation-service.js +2 -206
  82. package/dist/service/terminal-relay-state.js +2 -3
  83. package/dist/service/terminal-service.js +2 -52
  84. package/dist/service/workbench-event-service.js +2 -19
  85. package/dist/service/workbench-manifest-service.js +2 -69
  86. package/dist/service/workspace-change-service.js +2 -86
  87. package/dist/service/workspace-content-search-service.js +2 -477
  88. package/dist/service/workspace-domain-state.js +2 -41
  89. package/dist/service/workspace-file-service.js +2 -122
  90. package/dist/service/workspace-git-exclude-service.js +2 -119
  91. package/dist/service/workspace-queue-workbench-service.js +2 -304
  92. package/dist/service/workspace-service.js +2 -69
  93. package/dist/service/workspace-session-service.js +2 -139
  94. package/dist/service/workspace-upload-service.js +2 -262
  95. package/dist/service/workspace-watch-service.js +2 -146
  96. package/dist/service/workspace-workbench-service.js +2 -405
  97. package/dist/service.js +2 -38
  98. package/dist/storage.js +2 -32
  99. package/dist/supervisor.js +2 -136
  100. package/dist/terminal.js +2 -416
  101. package/dist/util/node-operation-parsers.js +2 -382
  102. package/dist/util/personal-instructions.js +2 -31
  103. package/dist/util/runner-error.js +2 -52
  104. package/dist/util/runner-native-session-parsers.js +2 -490
  105. package/dist/util/safe-error.js +2 -5
  106. package/dist/util/secret-environment.js +2 -25
  107. package/dist/workspace.js +2 -1519
  108. package/package.json +3 -3
  109. package/dist/capabilities.d.ts +0 -12
  110. package/dist/claude-agent-sdk.d.ts +0 -92
  111. package/dist/claude-channel.d.ts +0 -28
  112. package/dist/codex-app-server.d.ts +0 -133
  113. package/dist/config.d.ts +0 -18
  114. package/dist/connector/node-connector-options.d.ts +0 -27
  115. package/dist/connector/node-operation-router.d.ts +0 -9
  116. package/dist/connector.d.ts +0 -94
  117. package/dist/control-outbound-scheduler.d.ts +0 -29
  118. package/dist/database.d.ts +0 -305
  119. package/dist/event-buffer.d.ts +0 -9
  120. package/dist/fake-runner.d.ts +0 -42
  121. package/dist/health.d.ts +0 -4
  122. package/dist/main.d.ts +0 -2
  123. package/dist/migrations/v001.d.ts +0 -3
  124. package/dist/migrations/v002.d.ts +0 -4
  125. package/dist/migrations/v003.d.ts +0 -4
  126. package/dist/migrations/v004.d.ts +0 -4
  127. package/dist/native-jsonl-reader.d.ts +0 -35
  128. package/dist/native-session-history.d.ts +0 -126
  129. package/dist/opencode-runtime.d.ts +0 -33
  130. package/dist/opencode-server.d.ts +0 -49
  131. package/dist/operational.d.ts +0 -39
  132. package/dist/process-tree.d.ts +0 -9
  133. package/dist/rotating-log.d.ts +0 -17
  134. package/dist/runner/abstract-runner.d.ts +0 -172
  135. package/dist/runner/claude/managed-run-controller.d.ts +0 -51
  136. package/dist/runner/claude-code-runner.d.ts +0 -72
  137. package/dist/runner/codex/conversation-parser.d.ts +0 -59
  138. package/dist/runner/codex/managed-run-controller.d.ts +0 -90
  139. package/dist/runner/codex-runner.d.ts +0 -103
  140. package/dist/runner/fake-test-runner.d.ts +0 -26
  141. package/dist/runner/opencode/conversation-parser.d.ts +0 -31
  142. package/dist/runner/opencode/managed-run-controller.d.ts +0 -82
  143. package/dist/runner/opencode-runner.d.ts +0 -71
  144. package/dist/runner/runner-registry.d.ts +0 -19
  145. package/dist/runner-command-engine.d.ts +0 -28
  146. package/dist/runner-profiles.d.ts +0 -15
  147. package/dist/runner-usage.d.ts +0 -33
  148. package/dist/runtime-command-detector.d.ts +0 -3
  149. package/dist/runtime-state.d.ts +0 -171
  150. package/dist/service/attachment-domain-state.d.ts +0 -7
  151. package/dist/service/conversation-history-service.d.ts +0 -43
  152. package/dist/service/conversation-segment-service.d.ts +0 -20
  153. package/dist/service/external-session-resume-service.d.ts +0 -34
  154. package/dist/service/fake-managed-run-service.d.ts +0 -28
  155. package/dist/service/managed-runner-session-service.d.ts +0 -12
  156. package/dist/service/mcp-installation-verifier.d.ts +0 -9
  157. package/dist/service/mcp-node-operation-service.d.ts +0 -11
  158. package/dist/service/mcp-package-installer.d.ts +0 -8
  159. package/dist/service/native-session-projection-service.d.ts +0 -52
  160. package/dist/service/native-session-watch-service.d.ts +0 -62
  161. package/dist/service/node-connection-lifecycle-service.d.ts +0 -36
  162. package/dist/service/node-control-channel.d.ts +0 -32
  163. package/dist/service/node-control-message-service.d.ts +0 -27
  164. package/dist/service/node-request-service.d.ts +0 -14
  165. package/dist/service/node-run-event-bridge.d.ts +0 -40
  166. package/dist/service/node-terminal-channel.d.ts +0 -29
  167. package/dist/service/node-upgrade-coordinator.d.ts +0 -29
  168. package/dist/service/node-workspace-coordinator.d.ts +0 -29
  169. package/dist/service/recent-run-projection-service.d.ts +0 -14
  170. package/dist/service/run-attachment-service.d.ts +0 -38
  171. package/dist/service/run-domain-state.d.ts +0 -4
  172. package/dist/service/run-event-service.d.ts +0 -33
  173. package/dist/service/run-workbench-service.d.ts +0 -25
  174. package/dist/service/runner-channel-message-service.d.ts +0 -13
  175. package/dist/service/runner-interaction-service.d.ts +0 -39
  176. package/dist/service/runner-service.d.ts +0 -46
  177. package/dist/service/session-catalog-service.d.ts +0 -45
  178. package/dist/service/session-command-service.d.ts +0 -24
  179. package/dist/service/session-context-service.d.ts +0 -35
  180. package/dist/service/session-domain-state.d.ts +0 -9
  181. package/dist/service/session-identity-service.d.ts +0 -24
  182. package/dist/service/session-lifecycle-service.d.ts +0 -31
  183. package/dist/service/session-message-service.d.ts +0 -33
  184. package/dist/service/session-presentation-service.d.ts +0 -34
  185. package/dist/service/session-query-service.d.ts +0 -35
  186. package/dist/service/skill-directory-service.d.ts +0 -20
  187. package/dist/service/skill-install-service.d.ts +0 -21
  188. package/dist/service/skill-node-operation-service.d.ts +0 -44
  189. package/dist/service/terminal-relay-state.d.ts +0 -6
  190. package/dist/service/terminal-service.d.ts +0 -12
  191. package/dist/service/workbench-event-service.d.ts +0 -9
  192. package/dist/service/workbench-manifest-service.d.ts +0 -90
  193. package/dist/service/workspace-change-service.d.ts +0 -9
  194. package/dist/service/workspace-content-search-service.d.ts +0 -14
  195. package/dist/service/workspace-domain-state.d.ts +0 -79
  196. package/dist/service/workspace-file-service.d.ts +0 -18
  197. package/dist/service/workspace-git-exclude-service.d.ts +0 -4
  198. package/dist/service/workspace-queue-workbench-service.d.ts +0 -86
  199. package/dist/service/workspace-service.d.ts +0 -15
  200. package/dist/service/workspace-session-service.d.ts +0 -23
  201. package/dist/service/workspace-upload-service.d.ts +0 -39
  202. package/dist/service/workspace-watch-service.d.ts +0 -23
  203. package/dist/service/workspace-workbench-service.d.ts +0 -58
  204. package/dist/service.d.ts +0 -4
  205. package/dist/storage.d.ts +0 -2
  206. package/dist/supervisor.d.ts +0 -1
  207. package/dist/terminal.d.ts +0 -133
  208. package/dist/util/node-operation-parsers.d.ts +0 -92
  209. package/dist/util/personal-instructions.d.ts +0 -2
  210. package/dist/util/runner-error.d.ts +0 -6
  211. package/dist/util/runner-native-session-parsers.d.ts +0 -74
  212. package/dist/util/safe-error.d.ts +0 -2
  213. package/dist/util/secret-environment.d.ts +0 -1
  214. package/dist/workspace.d.ts +0 -217
@@ -1,82 +0,0 @@
1
- import type { NodeEnvelope, RunnerCommandDescriptor, RunnerCommandState } from '@myagentroam/protocol';
2
- import type { NodeAgentSession } from '../../database.js';
3
- import type { FakeRunnerStatus } from '../../fake-runner.js';
4
- import type { RunnerImageAttachment } from '../../service/run-attachment-service.js';
5
- import { OpenCodeRunner } from '../opencode-runner.js';
6
- interface OpenCodeManagedRunHost {
7
- intercepted(): boolean;
8
- readonly active: Set<string>;
9
- parseAttachments(value: unknown): readonly RunnerImageAttachment[];
10
- persistAttachments(cwd: string, runId: string, attachments: readonly RunnerImageAttachment[]): Promise<readonly string[]>;
11
- emit(runId: string, eventType: string, payload: unknown, status?: FakeRunnerStatus): void;
12
- emitItem(runId: string, item: OpenCodePublicItem): void;
13
- adopt(input: {
14
- runId: string;
15
- sessionId: string;
16
- runner: 'opencode';
17
- cwd: string;
18
- externalSessionId?: string;
19
- }): void;
20
- run(runId: string): {
21
- readonly id: string;
22
- };
23
- hasActiveSessionLease(sessionId: string): boolean;
24
- promote(sessionId: string, nativeSessionId: string): void;
25
- rememberNative(nativeSessionId: string, sessionId: string): void;
26
- send(type: string, payload: unknown): void;
27
- createApproval(input: {
28
- readonly runId: string;
29
- readonly approvalId: string;
30
- readonly payload: unknown;
31
- readonly expiresAt: number;
32
- }): void;
33
- publishApproval(input: {
34
- readonly runId: string;
35
- readonly approvalId: string;
36
- readonly payload: unknown;
37
- readonly expiresAt: number;
38
- }): void;
39
- expireApproval(approvalId: string): void;
40
- commandState(sessionId: string, commandId: string): RunnerCommandState | undefined;
41
- setCommandState(sessionId: string, state: RunnerCommandState): void;
42
- clearCommandState(sessionId: string, commandId: string): void;
43
- commandStates(sessionId: string): readonly RunnerCommandState[];
44
- }
45
- type OpenCodePublicItem = {
46
- readonly itemId: string;
47
- readonly kind: 'assistant_message' | 'plan' | 'reasoning_summary' | 'tool_call' | 'user_input_request' | 'context_compaction' | 'error' | 'unknown';
48
- readonly status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
49
- readonly payload: Record<string, unknown>;
50
- readonly merge?: boolean;
51
- };
52
- export declare class OpenCodeManagedRunController {
53
- private readonly runner;
54
- private readonly host;
55
- private readonly interactionTimeoutMs;
56
- private readonly permissions;
57
- private readonly questions;
58
- private readonly startingCwds;
59
- private readonly promptAdmitted;
60
- private readonly pendingIdle;
61
- private readonly startingClients;
62
- constructor(runner: OpenCodeRunner, host: OpenCodeManagedRunHost, interactionTimeoutMs?: number);
63
- executeCommand(session: NodeAgentSession, command: RunnerCommandDescriptor, context: {
64
- readonly secretEnvironment: Readonly<Record<string, string>>;
65
- }): Promise<unknown>;
66
- private compact;
67
- private runCompact;
68
- start(envelope: NodeEnvelope): void;
69
- cancel(runId: string, intent: 'CANCEL' | 'INTERRUPT'): boolean;
70
- decideApproval(input: {
71
- readonly runId: string;
72
- readonly approvalId: string;
73
- readonly decision: 'APPROVED' | 'REJECTED';
74
- }): boolean;
75
- respondUserInput(runId: string, requestId: string, answers: Record<string, unknown>): boolean;
76
- private run;
77
- private event;
78
- private requestPermission;
79
- private requestQuestion;
80
- private finish;
81
- }
82
- export {};
@@ -1,71 +0,0 @@
1
- import type { NodeCapabilities, RunnerDefaultConfiguration, RunnerProfile } from '@myagentroam/protocol';
2
- import type { NodeAgentSession, NodeDatabase, NodeWorkspace } from '../database.js';
3
- import { OpenCodeServerClient } from '../opencode-server.js';
4
- import { AbstractRunner, type ExternalResumeContext, type ExternalResumeResult, type RunnerDiscoveryContext, type RunnerConversationHistoryPage, type RunnerConversationHistoryReaders, type RunnerSessionPresentation, type RunnerSessionPresentationContext } from './abstract-runner.js';
5
- export interface OpenCodeManagedExecution {
6
- readonly runId: string;
7
- readonly sessionId: string;
8
- readonly nativeSessionId: string;
9
- readonly cwd: string;
10
- readonly client: OpenCodeServerClient;
11
- readonly abort: AbortController;
12
- readonly access: string;
13
- readonly agent: 'plan' | 'build';
14
- }
15
- export declare class OpenCodeRunner extends AbstractRunner<'opencode'> {
16
- private readonly client;
17
- private readonly clientFactory;
18
- readonly name: "opencode";
19
- readonly discoveryScope: "WORKSPACE_REQUIRED";
20
- private readonly modelsByWorkspace;
21
- private readonly contextLimitsByWorkspace;
22
- private readonly profileTimersByWorkspace;
23
- private readonly profileCache;
24
- private readonly profileRefreshes;
25
- readonly execution: Map<string, OpenCodeManagedExecution>;
26
- readonly managedTurns: Map<string, string>;
27
- private readonly environmentClients;
28
- private readonly stoppingClients;
29
- constructor(client?: OpenCodeServerClient, clientFactory?: () => OpenCodeServerClient);
30
- profile(capabilities: NodeCapabilities): RunnerProfile;
31
- refreshProfile(capabilities: NodeCapabilities, workspace?: NodeWorkspace, environment?: Readonly<Record<string, string>>): Promise<RunnerProfile>;
32
- private fetchProfile;
33
- private profileCacheKey;
34
- private environmentFingerprint;
35
- available(capabilities: NodeCapabilities): boolean;
36
- protected profileForValidation(): RunnerProfile;
37
- supportsConfiguration(configuration: RunnerDefaultConfiguration, workspace?: NodeWorkspace, environment?: Readonly<Record<string, string>>): boolean;
38
- defaultConfiguration(workspace?: NodeWorkspace, environment?: Readonly<Record<string, string>>): RunnerDefaultConfiguration;
39
- private cachedModels;
40
- mcpConfiguration(raw: unknown, secrets: Readonly<Record<string, string>>): unknown;
41
- discoverSessions(context: RunnerDiscoveryContext, workspace?: NodeWorkspace): Promise<readonly NodeAgentSession[]>;
42
- resumeExternal(external: NodeAgentSession, context: ExternalResumeContext): Promise<ExternalResumeResult>;
43
- readExternalActivity(session: NodeAgentSession): Promise<"UNAVAILABLE" | "EXTERNAL_ACTIVE" | "IDLE">;
44
- readOfficialConversation(session: NodeAgentSession, input: {
45
- readonly cursor?: string;
46
- readonly limit?: number;
47
- }, managedTurn: (nativeTurnId: string) => import('../database.js').NodeConversationTurn | undefined): Promise<{
48
- readonly turns: readonly import("../database.js").NodeConversationTurn[];
49
- readonly nextCursor: string | null;
50
- } | undefined>;
51
- readConversationHistory(readers: RunnerConversationHistoryReaders): Promise<RunnerConversationHistoryPage | undefined>;
52
- managedRunForNativeTurn(nativeTurnId: string): string | undefined;
53
- presentSession(session: NodeAgentSession, capabilities: NodeCapabilities, context: RunnerSessionPresentationContext): RunnerSessionPresentation;
54
- renameNative(session: NodeAgentSession, input: {
55
- readonly title?: string | null;
56
- readonly pinned?: boolean;
57
- }, database: NodeDatabase): Promise<void>;
58
- removeNative(session: NodeAgentSession, nativeSessionId: string): Promise<boolean>;
59
- forkNative(session: NodeAgentSession, boundary: string | null, title: string): Promise<string>;
60
- executeCompact(session: NodeAgentSession, environment: Readonly<Record<string, string>>): Promise<unknown>;
61
- readContextUsage(session: NodeAgentSession): Promise<{
62
- model: string | null;
63
- usedTokens: number;
64
- maxTokens: number;
65
- } | undefined>;
66
- stop(): Promise<void>;
67
- private scheduleProfileExpiry;
68
- private clearProfileTimer;
69
- managedClient(environment: Readonly<Record<string, string>>, isolationKey?: string): OpenCodeServerClient;
70
- releaseManagedClient(client: OpenCodeServerClient): void;
71
- }
@@ -1,19 +0,0 @@
1
- import { AbstractRunner, type RegisteredRunnerName, type RunnerApprovalDecision, type RunnerCancellationIntent } from './abstract-runner.js';
2
- import type { NodeCapabilities, RunnerDefaultConfiguration, NodeEnvelope, RunnerName, RunnerProfile } from '@myagentroam/protocol';
3
- export declare class RunnerRegistry {
4
- private readonly runners;
5
- constructor(runners?: readonly AbstractRunner[]);
6
- register<T extends AbstractRunner>(runner: T): T;
7
- optional<T extends AbstractRunner>(name: RegisteredRunnerName): T | undefined;
8
- require<T extends AbstractRunner>(name: RegisteredRunnerName): T;
9
- advertised(): readonly AbstractRunner[];
10
- product(name: unknown): AbstractRunner<RunnerName> | undefined;
11
- profiles(capabilities: NodeCapabilities): readonly RunnerProfile[];
12
- refreshProfiles(capabilities: NodeCapabilities, workspace?: import('../database.js').NodeWorkspace, environment?: Readonly<Record<string, string>>): Promise<readonly RunnerProfile[]>;
13
- supportsConfiguration(configuration: RunnerDefaultConfiguration, workspace?: import('../database.js').NodeWorkspace, environment?: Readonly<Record<string, string>>): boolean;
14
- startManagedRun(envelope: NodeEnvelope): boolean;
15
- cancelManagedRun(runId: string, intent: RunnerCancellationIntent): boolean;
16
- decideApproval(input: RunnerApprovalDecision): boolean;
17
- respondUserInput(runId: string, requestId: string, answers: Record<string, unknown>): boolean;
18
- stop(): Promise<void>;
19
- }
@@ -1,28 +0,0 @@
1
- import type { RunnerCommandDescriptor, RunnerCommandState } from '@myagentroam/protocol';
2
- /**
3
- * Claude Agent SDK has no mid-session collaboration mode switch. Plan Mode is
4
- * therefore declared as a fixed Node-owned instruction tag prepended to each
5
- * Runner-bound input while the command state is active. The tag never appears
6
- * in the user bubble; native history strips it again on read.
7
- */
8
- export declare function withClaudePlanTag(input: string): string;
9
- /** Removes one leading plan instruction tag from a native transcript user text. */
10
- export declare function stripClaudePlanTag(text: string): string;
11
- /** A deliberately small, Node-only command interaction boundary. */
12
- export interface CommandDefinition {
13
- readonly descriptor: RunnerCommandDescriptor;
14
- }
15
- export interface CommandInvocation {
16
- readonly input: string;
17
- readonly argument: string;
18
- }
19
- export declare function parseCommandInvocation(definition: CommandDefinition, input: string): CommandInvocation;
20
- export declare class CommandStateStore {
21
- private readonly states;
22
- list(sessionId: string): readonly RunnerCommandState[];
23
- set(sessionId: string, state: RunnerCommandState): readonly RunnerCommandState[];
24
- clear(sessionId: string, commandId: string): readonly RunnerCommandState[];
25
- removeSession(sessionId: string): void;
26
- promoteSessionIdentity(sessionId: string, nativeSessionId: string): void;
27
- get(sessionId: string, commandId: string): RunnerCommandState | undefined;
28
- }
@@ -1,15 +0,0 @@
1
- import type { RunnerName, RunnerProfile } from '@myagentroam/protocol';
2
- export declare function declaredRunnerProfiles(input: {
3
- readonly codexAvailable: boolean;
4
- readonly claudeCodeAvailable: boolean;
5
- readonly environment?: NodeJS.ProcessEnv;
6
- readonly openCodeAvailable?: boolean;
7
- }): readonly RunnerProfile[];
8
- export declare function supportsRunnerConfiguration(input: {
9
- readonly runner: RunnerName;
10
- readonly model: string;
11
- readonly effort: string;
12
- readonly access: string;
13
- readonly environment?: NodeJS.ProcessEnv;
14
- }): boolean;
15
- export declare function claudeDefaultModel(environment?: NodeJS.ProcessEnv): string;
@@ -1,33 +0,0 @@
1
- import type { RunnerName } from '@myagentroam/protocol';
2
- export declare const USAGE_OAUTH_REQUIRED = "OFFICIAL_OAUTH_REQUIRED";
3
- interface RunnerUsageStatus {
4
- readonly runner: RunnerName;
5
- readonly available: boolean;
6
- readonly reasonCode: string | null;
7
- }
8
- interface RunnerUsageWindow {
9
- readonly id: string;
10
- readonly label: string;
11
- readonly usedPercentage: number;
12
- readonly resetsAt: number | null;
13
- }
14
- interface RunnerUsage {
15
- readonly runner: RunnerName;
16
- readonly windows: readonly RunnerUsageWindow[];
17
- readonly fetchedAt: number;
18
- readonly cached: boolean;
19
- }
20
- type FetchLike = (input: string, init: RequestInit) => Promise<Response>;
21
- export declare class RunnerUsageReader {
22
- private readonly fetcher;
23
- private readonly homePath;
24
- private readonly now;
25
- private readonly cache;
26
- constructor(fetcher?: FetchLike, homePath?: string, now?: () => number);
27
- status(runner: RunnerName): Promise<RunnerUsageStatus>;
28
- read(runner: RunnerName): Promise<RunnerUsage>;
29
- private credentials;
30
- private readCodex;
31
- private readClaude;
32
- }
33
- export {};
@@ -1,3 +0,0 @@
1
- import type { RuntimeCommand } from '@myagentroam/protocol';
2
- export declare function detectRuntimeCommands(): Promise<RuntimeCommand[]>;
3
- export declare function normalizeVersion(id: RuntimeCommand['id'], value: string): string | undefined;
@@ -1,171 +0,0 @@
1
- import type { AgentRunStatus, RunnerName } from '@myagentroam/protocol';
2
- import type { ConversationItemPage, ConversationPage, NativeSessionControl, NodeAgentRun, NodeAgentSession, NodeApproval, NodeConversationTurn, NodeMessageAttachmentInput, NodeRunEvent, NodeWorkspace } from './database.js';
3
- /**
4
- * Deliberately process-local runtime domain. No method in this class writes
5
- * into Node SQLite: a Node restart loses active runs, approvals, leases and
6
- * managed-session aliases by design. Durable conversation history belongs to
7
- * the Runner/native transcript, never to MAR.
8
- */
9
- export declare class NodeRuntimeState {
10
- private readonly nodeId;
11
- private readonly getWorkspace;
12
- private readonly now;
13
- private readonly onRunChanged?;
14
- private static readonly MAX_RUN_EVENTS_PER_RUN;
15
- private static readonly MAX_COMPLETED_TURNS_PER_SESSION;
16
- private readonly sessions;
17
- private readonly runs;
18
- private readonly messageRuns;
19
- private readonly events;
20
- private readonly turns;
21
- private readonly approvals;
22
- /** A Session owns at most one running turn; Workspace sessions may run concurrently. */
23
- private readonly leases;
24
- /** Session FIFO metadata is deliberately process-local with the rest of run state. */
25
- private readonly queuedRuns;
26
- private readonly queueVersions;
27
- private readonly pausedQueues;
28
- /** Bounded tombstones reject stale internal start envelopes after terminal cleanup. */
29
- private readonly terminalRunIds;
30
- private nextEventId;
31
- constructor(nodeId: () => string, getWorkspace: (id: string) => NodeWorkspace | undefined, now?: () => number, onRunChanged?: ((run: NodeAgentRun, session: NodeAgentSession) => void) | undefined);
32
- activeWorkspaceLeaseCount(): number;
33
- activeSessionRun(sessionId: string): NodeAgentRun | undefined;
34
- hasActiveSessionLease(sessionId: string): boolean;
35
- createAgentSession(input: {
36
- readonly workspaceId: string;
37
- readonly runner: RunnerName;
38
- readonly externalSessionId?: string;
39
- readonly nativeControl?: NativeSessionControl;
40
- readonly cwd: string;
41
- readonly title?: string;
42
- readonly model?: string;
43
- readonly effort?: string;
44
- readonly access?: string;
45
- }): NodeAgentSession;
46
- /** Internal envelope compatibility for a Run already accepted in this process. */
47
- adoptRun(input: {
48
- readonly runId: string;
49
- readonly sessionId: string;
50
- readonly workspaceId?: string;
51
- readonly runner: RunnerName;
52
- readonly cwd: string;
53
- readonly clientMessageId?: string;
54
- readonly externalSessionId?: string;
55
- }): NodeAgentRun;
56
- getAgentSession(id: string): NodeAgentSession | undefined;
57
- listAgentSessions(): readonly NodeAgentSession[];
58
- findAgentSessionByExternalSession(runner: RunnerName, externalSessionId: string): NodeAgentSession | undefined;
59
- updateAgentSessionConfiguration(input: {
60
- readonly sessionId: string;
61
- readonly model: string;
62
- readonly effort: string;
63
- readonly access: string;
64
- }): NodeAgentSession;
65
- setNativeControl(id: string, nativeControl: NativeSessionControl): void;
66
- setExternalSessionId(id: string, externalSessionId: string): void;
67
- /**
68
- * Atomically replaces the bootstrap Session key with the Runner-native ID.
69
- * No caller may migrate the individual runtime maps independently.
70
- */
71
- promoteSessionIdentity(id: string, nativeSessionId: string): NodeAgentSession;
72
- setChannelToken(id: string, channelToken: string): void;
73
- updateSessionMetadata(input: {
74
- readonly sessionId: string;
75
- readonly customTitle?: string | null;
76
- readonly pinned?: boolean;
77
- }): NodeAgentSession;
78
- /**
79
- * Give a just-created managed Session a readable local title before the
80
- * Runner has written its own transcript title. This intentionally never
81
- * replaces a user rename or a Runner-provided title.
82
- */
83
- setTemporaryTitleIfMissing(id: string, title: string): NodeAgentSession;
84
- /**
85
- * Runner/native discovery is authoritative for its own title. Keep it on
86
- * the managed Session so later `session.get` polls cannot regress to an
87
- * empty fallback after a discovery response has already shown the title.
88
- */
89
- setRunnerTitleFromNative(id: string, title: string): NodeAgentSession;
90
- createMessageRun(input: {
91
- readonly runId?: string;
92
- readonly sessionId: string;
93
- readonly clientMessageId: string;
94
- readonly content: string;
95
- readonly initiatedByUserId?: number;
96
- readonly attachments?: readonly NodeMessageAttachmentInput[];
97
- }): {
98
- readonly run: NodeAgentRun;
99
- readonly created: boolean;
100
- };
101
- sessionQueue(sessionId: string): {
102
- readonly version: number;
103
- readonly paused: boolean;
104
- readonly runIds: readonly string[];
105
- };
106
- isQueuedRun(runId: string): boolean;
107
- claimNextQueuedRun(sessionId: string): NodeAgentRun | undefined;
108
- pauseSessionQueue(sessionId: string): void;
109
- resumeSessionQueue(sessionId: string): void;
110
- reorderSessionQueue(sessionId: string, expectedVersion: number, runIds: readonly string[]): void;
111
- prioritizeQueuedRun(runId: string): NodeAgentRun;
112
- updateQueuedMessage(runId: string, content: string): NodeAgentRun;
113
- deleteQueuedRun(runId: string): void;
114
- queuedMessageText(runId: string): string;
115
- getRun(id: string): NodeAgentRun | undefined;
116
- findMessageRun(sessionId: string, clientMessageId: string): NodeAgentRun | undefined;
117
- listRunsForSession(sessionId: string): readonly NodeAgentRun[];
118
- transitionRun(id: string, next: AgentRunStatus): NodeAgentRun;
119
- appendRunEvent(input: {
120
- readonly runId: string;
121
- readonly sequence: number;
122
- readonly eventType: string;
123
- readonly payload: unknown;
124
- readonly status?: AgentRunStatus;
125
- }): NodeRunEvent | undefined;
126
- listRunEvents(id: string, after?: number): readonly NodeRunEvent[];
127
- listConversationTurns(input: {
128
- readonly sessionId: string;
129
- readonly cursor?: string;
130
- readonly limit?: number;
131
- }): ConversationPage;
132
- conversationTurnForRun(runId: string): NodeConversationTurn | undefined;
133
- listConversationItems(input: {
134
- readonly sessionId: string;
135
- readonly cursor?: string;
136
- readonly limit?: number;
137
- }): ConversationItemPage;
138
- recordCommandExecution(input: {
139
- readonly sessionId: string;
140
- readonly command: string;
141
- readonly cwd: string;
142
- readonly outputPreview: string;
143
- readonly failed?: boolean;
144
- }): NodeConversationTurn;
145
- createApproval(input: {
146
- readonly runId: string;
147
- readonly approvalId: string;
148
- readonly payload: unknown;
149
- readonly expiresAt: number;
150
- }): NodeApproval;
151
- getApproval(id: string): NodeApproval | undefined;
152
- listApprovals(runId: string): readonly NodeApproval[];
153
- expireApproval(id: string): NodeApproval;
154
- decideApproval(id: string, decision: 'APPROVED' | 'REJECTED'): NodeApproval;
155
- expireDueApprovals(): readonly NodeApproval[];
156
- listNonterminalRuns(): readonly NodeAgentRun[];
157
- lastRunSequence(id: string): number;
158
- removeTerminalRun(runId: string): void;
159
- hasActiveWorkspaceLease(workspaceId: string): boolean;
160
- /** Removes a terminal Session's process-local projection after its native history is deleted. */
161
- removeAgentSession(sessionId: string): void;
162
- removeWorkspace(workspaceId: string): void;
163
- reconcileRun(id: string, active: boolean): void;
164
- private replaceSession;
165
- private bumpQueueVersion;
166
- private requireSession;
167
- private requireRun;
168
- private requireApproval;
169
- private updateTurnForRun;
170
- private projectEvent;
171
- }
@@ -1,7 +0,0 @@
1
- export declare class AttachmentDomainState<TCachedRunImages, TNativeImageSource> {
2
- readonly runDirectories: Map<string, string>;
3
- readonly runFileDirectories: Map<string, string>;
4
- readonly runImages: Map<string, TCachedRunImages>;
5
- readonly nativeHistoryImages: Map<string, TNativeImageSource[]>;
6
- readonly nativeHistoryImageTimers: Map<string, NodeJS.Timeout>;
7
- }
@@ -1,43 +0,0 @@
1
- import type { NodeCapabilities, SessionActivityState } from '@myagentroam/protocol';
2
- import type { NodeAgentSession } from '../database.js';
3
- import type { NodeRuntimeState } from '../runtime-state.js';
4
- import type { RunnerRegistry } from '../runner/runner-registry.js';
5
- import { type ConversationHistoryPage } from '../util/runner-native-session-parsers.js';
6
- import type { RunAttachmentService } from './run-attachment-service.js';
7
- export declare function hasManagedActiveRun(runtime: NodeRuntimeState, session: NodeAgentSession): boolean;
8
- export declare function convergeConversationWatchPage(previous: ConversationHistoryPage | undefined, previousObserved: ConversationHistoryPage | undefined, next: ConversationHistoryPage, previousAuthority: unknown): {
9
- readonly page: ConversationHistoryPage;
10
- readonly authority: ConversationHistoryPage['source'];
11
- };
12
- interface ConversationHistoryServiceOptions {
13
- readonly runtime: NodeRuntimeState;
14
- readonly runners: RunnerRegistry;
15
- readonly capabilities: () => NodeCapabilities;
16
- readonly attachments: RunAttachmentService;
17
- readonly snapshotSequence: () => number;
18
- readonly hasManagedActiveRun: (session: NodeAgentSession) => boolean;
19
- readonly setExternalActivity: (sessionId: string, activity: SessionActivityState) => void;
20
- }
21
- export declare class ConversationHistoryService {
22
- private readonly options;
23
- private readonly activeHistoryReads;
24
- constructor(options: ConversationHistoryServiceOptions);
25
- read(session: NodeAgentSession, input: {
26
- readonly cursor?: string;
27
- readonly limit?: number;
28
- }): Promise<ConversationHistoryPage>;
29
- private readRunnerHistory;
30
- private readManagedActive;
31
- private prefetchActiveHistory;
32
- private takeActiveHistoryRead;
33
- refreshExternalActivity(session: NodeAgentSession): Promise<void>;
34
- readNative(session: NodeAgentSession, cursor?: string, limit?: number): Promise<import("../native-session-history.js").NativeSessionHistory | undefined>;
35
- private attachNativeImages;
36
- readOfficial(session: NodeAgentSession, input: {
37
- readonly cursor?: string;
38
- readonly limit?: number;
39
- }): Promise<import("../runner/abstract-runner.js").RunnerConversationPage | undefined>;
40
- private managedRunnerTurn;
41
- private page;
42
- }
43
- export {};
@@ -1,20 +0,0 @@
1
- import type { ConversationSegment, ConversationSegmentPage } from '@myagentroam/protocol';
2
- import type { NodeAgentSession, NodeConversationTurn } from '../database.js';
3
- import type { ConversationHistoryPage } from '../util/runner-native-session-parsers.js';
4
- export declare function conversationSegments(turn: NodeConversationTurn): ConversationSegment[];
5
- export declare function conversationSegmentIdentityForItem(turn: NodeConversationTurn, itemId: string, itemKind?: string): {
6
- readonly id: string;
7
- readonly index: number;
8
- };
9
- export declare class ConversationSegmentService {
10
- private readonly readTurns;
11
- constructor(readTurns: (session: NodeAgentSession, input: {
12
- readonly cursor?: string;
13
- readonly limit?: number;
14
- }) => Promise<ConversationHistoryPage>);
15
- projectInitial(session: NodeAgentSession, page: ConversationHistoryPage, limit: number): ConversationSegmentPage;
16
- read(session: NodeAgentSession, input: {
17
- readonly cursor?: string;
18
- readonly limit?: number;
19
- }): Promise<ConversationSegmentPage>;
20
- }
@@ -1,34 +0,0 @@
1
- import type { RunnerDefaultConfiguration } from '@myagentroam/protocol';
2
- import type { NodeAgentSession } from '../database.js';
3
- import type { NodeRuntimeState } from '../runtime-state.js';
4
- import type { RunnerRegistry } from '../runner/runner-registry.js';
5
- import type { SessionDomainState } from './session-domain-state.js';
6
- interface ExternalSessionResumeServiceOptions {
7
- readonly runtime: NodeRuntimeState;
8
- readonly runners: RunnerRegistry;
9
- readonly state: SessionDomainState<NodeAgentSession, unknown>;
10
- readonly available: (runner: NodeAgentSession['runner']) => boolean;
11
- readonly projectionFor: (session: NodeAgentSession) => NodeAgentSession | undefined;
12
- readonly managedAliasFor: (session: NodeAgentSession) => NodeAgentSession | undefined;
13
- readonly ensureConfiguration: (session: NodeAgentSession) => NodeAgentSession;
14
- readonly configuration: (session: NodeAgentSession) => RunnerDefaultConfiguration;
15
- readonly workspacePath: (workspaceId: string) => string | undefined;
16
- readonly rememberNative: (nativeSessionId: string, sessionId: string) => void;
17
- readonly resolve: (sessionId: string) => Promise<NodeAgentSession | undefined>;
18
- }
19
- export declare class ExternalSessionResumeService {
20
- private readonly options;
21
- private readonly transitions;
22
- constructor(options: ExternalSessionResumeServiceOptions);
23
- transitioning(sessionId: string): boolean;
24
- resume(external: NodeAgentSession, force?: boolean): Promise<NodeAgentSession | undefined>;
25
- failure(sessionId: string): {
26
- readonly code: string;
27
- readonly detail?: string;
28
- };
29
- resolveForMessage(sessionId: string): Promise<NodeAgentSession>;
30
- delivery(session: NodeAgentSession): 'RESUMABLE' | 'REJECTED';
31
- private clearFailure;
32
- private setFailure;
33
- }
34
- export {};
@@ -1,28 +0,0 @@
1
- import type { NodeEnvelope } from '@myagentroam/protocol';
2
- import type { FakeRunnerStatus, FakeRunnerStep } from '../fake-runner.js';
3
- import type { NodeRuntimeState } from '../runtime-state.js';
4
- import type { FakeTestRunner } from '../runner/fake-test-runner.js';
5
- import type { RunnerRegistry } from '../runner/runner-registry.js';
6
- import type { RunDomainState } from './run-domain-state.js';
7
- interface FakeManagedRunServiceOptions {
8
- readonly runner: FakeTestRunner;
9
- readonly script: (input: unknown, runId: string) => readonly FakeRunnerStep[];
10
- readonly runners: RunnerRegistry;
11
- readonly runtime: NodeRuntimeState;
12
- readonly state: RunDomainState;
13
- readonly emitRun: (runId: string, type: string, payload: unknown, status?: FakeRunnerStatus) => void;
14
- readonly publishApproval: (input: {
15
- readonly runId: string;
16
- readonly approvalId: string;
17
- readonly payload: unknown;
18
- readonly expiresAt: number;
19
- }) => void;
20
- readonly disconnect: () => void;
21
- }
22
- /** Test-only managed Run adapter; production Runner paths never depend on it. */
23
- export declare class FakeManagedRunService {
24
- private readonly options;
25
- constructor(options: FakeManagedRunServiceOptions);
26
- start(envelope: NodeEnvelope): void;
27
- }
28
- export {};
@@ -1,12 +0,0 @@
1
- import type { NodeRuntimeState } from '../runtime-state.js';
2
- import type { RunnerRegistry } from '../runner/runner-registry.js';
3
- import type { NodeAgentSession } from '../database.js';
4
- /** Owns managed native-session identity and best-effort native title refresh. */
5
- export declare class ManagedRunnerSessionService {
6
- private readonly runtime;
7
- private readonly runners;
8
- private readonly emitSession;
9
- constructor(runtime: NodeRuntimeState, runners: RunnerRegistry, emitSession: (session: NodeAgentSession) => void);
10
- remember(nativeSessionId: string, sessionId: string): void;
11
- refreshTitle(sessionId: string, externalSessionId: string, cwd: string): Promise<void>;
12
- }
@@ -1,9 +0,0 @@
1
- import type { McpCatalogEntry, McpInstallationConfiguration } from '@myagentroam/protocol';
2
- export declare class McpInstallationVerifier {
3
- verify(input: {
4
- readonly entry: McpCatalogEntry;
5
- readonly configuration: McpInstallationConfiguration;
6
- readonly secrets: Readonly<Record<string, string>>;
7
- readonly cwd: string;
8
- }): Promise<void>;
9
- }
@@ -1,11 +0,0 @@
1
- import type { NodeDatabase } from '../database.js';
2
- import { McpInstallationVerifier } from './mcp-installation-verifier.js';
3
- export declare class McpNodeOperationService {
4
- private readonly requireDatabase;
5
- private readonly verifier;
6
- constructor(requireDatabase: () => NodeDatabase, verifier?: McpInstallationVerifier);
7
- operations(): Readonly<Record<string, (data: unknown) => unknown>>;
8
- private inspect;
9
- private install;
10
- private remove;
11
- }
@@ -1,8 +0,0 @@
1
- import type { McpCatalogEntry } from '@myagentroam/protocol';
2
- export declare class McpPackageInstaller {
3
- private readonly dataDirectory;
4
- constructor(dataDirectory: string | (() => string));
5
- prepare(entry: McpCatalogEntry): Promise<McpCatalogEntry>;
6
- private install;
7
- private prepareRuntimeEnvironment;
8
- }