@agent-vm/agent-vm 0.0.78 → 0.0.80

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 (80) hide show
  1. package/dist/cli/commands/controller-definition.d.ts.map +1 -1
  2. package/dist/cli/commands/controller-definition.js +7 -3
  3. package/dist/cli/commands/controller-definition.js.map +1 -1
  4. package/dist/cli/manual-templates.d.ts.map +1 -1
  5. package/dist/cli/manual-templates.js +8 -4
  6. package/dist/cli/manual-templates.js.map +1 -1
  7. package/dist/controller/controller-runtime-types.d.ts +4 -0
  8. package/dist/controller/controller-runtime-types.d.ts.map +1 -1
  9. package/dist/controller/controller-runtime.d.ts.map +1 -1
  10. package/dist/controller/controller-runtime.js +28 -3
  11. package/dist/controller/controller-runtime.js.map +1 -1
  12. package/dist/controller/http/controller-http-route-support.d.ts +12 -0
  13. package/dist/controller/http/controller-http-route-support.d.ts.map +1 -1
  14. package/dist/controller/http/controller-http-route-support.js +12 -0
  15. package/dist/controller/http/controller-http-route-support.js.map +1 -1
  16. package/dist/controller/http/controller-http-routes.d.ts +4 -1
  17. package/dist/controller/http/controller-http-routes.d.ts.map +1 -1
  18. package/dist/controller/http/controller-http-routes.js +75 -24
  19. package/dist/controller/http/controller-http-routes.js.map +1 -1
  20. package/dist/controller/http/controller-lease-response-types.d.ts +1 -0
  21. package/dist/controller/http/controller-lease-response-types.d.ts.map +1 -1
  22. package/dist/controller/http/controller-lease-response-types.js +1 -0
  23. package/dist/controller/http/controller-lease-response-types.js.map +1 -1
  24. package/dist/controller/http/controller-request-schemas.d.ts +1 -0
  25. package/dist/controller/http/controller-request-schemas.d.ts.map +1 -1
  26. package/dist/controller/http/controller-request-schemas.js +15 -1
  27. package/dist/controller/http/controller-request-schemas.js.map +1 -1
  28. package/dist/controller/http/controller-zone-operation-routes.d.ts +4 -2
  29. package/dist/controller/http/controller-zone-operation-routes.d.ts.map +1 -1
  30. package/dist/controller/http/controller-zone-operation-routes.js +50 -1
  31. package/dist/controller/http/controller-zone-operation-routes.js.map +1 -1
  32. package/dist/controller/leases/lease-manager.d.ts +17 -1
  33. package/dist/controller/leases/lease-manager.d.ts.map +1 -1
  34. package/dist/controller/leases/lease-manager.js +133 -34
  35. package/dist/controller/leases/lease-manager.js.map +1 -1
  36. package/dist/controller/leases/tcp-pool.d.ts +3 -0
  37. package/dist/controller/leases/tcp-pool.d.ts.map +1 -1
  38. package/dist/controller/leases/tcp-pool.js +12 -1
  39. package/dist/controller/leases/tcp-pool.js.map +1 -1
  40. package/dist/controller/leases/tool-vm-recovery.d.ts +31 -0
  41. package/dist/controller/leases/tool-vm-recovery.d.ts.map +1 -0
  42. package/dist/controller/leases/tool-vm-recovery.js +178 -0
  43. package/dist/controller/leases/tool-vm-recovery.js.map +1 -0
  44. package/dist/controller/leases/tool-vm-runtime-record.d.ts +59 -0
  45. package/dist/controller/leases/tool-vm-runtime-record.d.ts.map +1 -0
  46. package/dist/controller/leases/tool-vm-runtime-record.js +159 -0
  47. package/dist/controller/leases/tool-vm-runtime-record.js.map +1 -0
  48. package/dist/gateway/gateway-recovery.d.ts +8 -5
  49. package/dist/gateway/gateway-recovery.d.ts.map +1 -1
  50. package/dist/gateway/gateway-recovery.js +63 -123
  51. package/dist/gateway/gateway-recovery.js.map +1 -1
  52. package/dist/gateway/gateway-runtime-record.d.ts +24 -16
  53. package/dist/gateway/gateway-runtime-record.d.ts.map +1 -1
  54. package/dist/gateway/gateway-runtime-record.js +53 -68
  55. package/dist/gateway/gateway-runtime-record.js.map +1 -1
  56. package/dist/gateway/gateway-zone-orchestrator.d.ts +6 -0
  57. package/dist/gateway/gateway-zone-orchestrator.d.ts.map +1 -1
  58. package/dist/gateway/gateway-zone-orchestrator.js +157 -40
  59. package/dist/gateway/gateway-zone-orchestrator.js.map +1 -1
  60. package/dist/integration-tests/smoke-harness.js +4 -4
  61. package/dist/integration-tests/smoke-harness.js.map +1 -1
  62. package/dist/operations/controller-offline-cleanup.d.ts +3 -0
  63. package/dist/operations/controller-offline-cleanup.d.ts.map +1 -1
  64. package/dist/operations/controller-offline-cleanup.js +16 -6
  65. package/dist/operations/controller-offline-cleanup.js.map +1 -1
  66. package/dist/operations/destroy-zone.d.ts.map +1 -1
  67. package/dist/operations/destroy-zone.js +5 -0
  68. package/dist/operations/destroy-zone.js.map +1 -1
  69. package/dist/operations/mcp-portal-live-validation.d.ts.map +1 -1
  70. package/dist/operations/mcp-portal-live-validation.js +11 -0
  71. package/dist/operations/mcp-portal-live-validation.js.map +1 -1
  72. package/dist/shared/managed-vm-process.d.ts +33 -0
  73. package/dist/shared/managed-vm-process.d.ts.map +1 -0
  74. package/dist/shared/managed-vm-process.js +248 -0
  75. package/dist/shared/managed-vm-process.js.map +1 -0
  76. package/dist/shared/port-owner.d.ts +18 -0
  77. package/dist/shared/port-owner.d.ts.map +1 -0
  78. package/dist/shared/port-owner.js +60 -0
  79. package/dist/shared/port-owner.js.map +1 -0
  80. package/package.json +11 -11
@@ -0,0 +1,31 @@
1
+ import { readProcessIdentity } from '../../shared/managed-vm-process.js';
2
+ import { type PortOwner } from '../../shared/port-owner.js';
3
+ import { deleteToolVmRuntimeRecord, loadAllToolVmRuntimeRecords } from './tool-vm-runtime-record.js';
4
+ export interface ToolVmRecoveryDependencies {
5
+ readonly deleteToolVmRuntimeRecord?: typeof deleteToolVmRuntimeRecord;
6
+ readonly isProcessAlive?: (pid: number) => boolean;
7
+ readonly killProcess?: (pid: number, signal: NodeJS.Signals) => void;
8
+ readonly loadAllToolVmRuntimeRecords?: typeof loadAllToolVmRuntimeRecords;
9
+ readonly log?: (message: string) => void;
10
+ readonly portForSlot?: (slot: number) => number;
11
+ readonly readProcessCommand?: (pid: number) => Promise<string | null>;
12
+ readonly readProcessIdentity?: typeof readProcessIdentity;
13
+ readonly readTcpListenPortOwner?: (port: number) => Promise<PortOwner | null>;
14
+ readonly sleep?: (delayMs: number) => Promise<void>;
15
+ }
16
+ export interface ToolVmCleanupResult {
17
+ readonly cleanedCount: number;
18
+ readonly killedPids: readonly number[];
19
+ readonly quarantinedCount: number;
20
+ readonly warnings: readonly string[];
21
+ }
22
+ export declare function cleanupOrphanedToolVmsIfPresent(options: {
23
+ readonly expectedConfigPath: string;
24
+ readonly expectedControllerPort: number;
25
+ readonly mode?: 'in-process-recovery' | 'offline-cleanup';
26
+ readonly projectNamespace: string;
27
+ readonly stateDir: string;
28
+ readonly tcpBasePort?: number;
29
+ readonly zoneId: string;
30
+ }, dependencies?: ToolVmRecoveryDependencies): Promise<ToolVmCleanupResult>;
31
+ //# sourceMappingURL=tool-vm-recovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-vm-recovery.d.ts","sourceRoot":"","sources":["../../../src/controller/leases/tool-vm-recovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAMN,mBAAmB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAEN,KAAK,SAAS,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,MAAM,6BAA6B,CAAC;AA+GrC,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,yBAAyB,CAAC,EAAE,OAAO,yBAAyB,CAAC;IACtE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;IACrE,QAAQ,CAAC,2BAA2B,CAAC,EAAE,OAAO,2BAA2B,CAAC;IAC1E,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IAChD,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,mBAAmB,CAAC;IAC1D,QAAQ,CAAC,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAC9E,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,wBAAsB,+BAA+B,CACpD,OAAO,EAAE;IACR,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,qBAAqB,GAAG,iBAAiB,CAAC;IAC1D,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,EACD,YAAY,GAAE,0BAA+B,GAC3C,OAAO,CAAC,mBAAmB,CAAC,CA+H9B"}
@@ -0,0 +1,178 @@
1
+ import { buildToolSessionLabel } from '@agent-vm/gateway-interface';
2
+ import { isProcessAlive, isManagedVmProcess, killOrphanedManagedVmProcess, killProcess, readProcessCommand, readProcessIdentity, sleep, } from '../../shared/managed-vm-process.js';
3
+ import { readTcpListenPortOwner as defaultReadTcpListenPortOwner, } from '../../shared/port-owner.js';
4
+ import { deleteToolVmRuntimeRecord, loadAllToolVmRuntimeRecords, } from './tool-vm-runtime-record.js';
5
+ function writeRecoveryLog(message) {
6
+ process.stderr.write(`[agent-vm] ${message}\n`);
7
+ }
8
+ // All five fences are required — there is no legacy/fallback path for tool
9
+ // VMs because this format ships in the same release as the cleanup. Any
10
+ // caller (Phase A or offline) must supply expectedConfigPath +
11
+ // expectedControllerPort alongside the in-deployment projectNamespace /
12
+ // zoneId. The fifth fence (sessionLabel) is recomputed from per-record
13
+ // projectNamespace + zoneId + tcpSlot and must match what the record stored.
14
+ function validateToolVmRecordCleanupScope(options) {
15
+ if (options.runtimeRecord.configPath !== options.expectedConfigPath) {
16
+ return `Tool VM runtime record for lease '${options.runtimeRecord.leaseId}' at '${options.stateDir}' belongs to configPath '${options.runtimeRecord.configPath}', not '${options.expectedConfigPath}'. Refusing scoped cleanup.`;
17
+ }
18
+ if (options.runtimeRecord.controllerPort !== options.expectedControllerPort) {
19
+ return `Tool VM runtime record for lease '${options.runtimeRecord.leaseId}' at '${options.stateDir}' belongs to controllerPort '${options.runtimeRecord.controllerPort}', not '${options.expectedControllerPort}'. Refusing scoped cleanup.`;
20
+ }
21
+ if (options.runtimeRecord.projectNamespace !== options.projectNamespace) {
22
+ return `Tool VM runtime record for lease '${options.runtimeRecord.leaseId}' at '${options.stateDir}' belongs to projectNamespace '${options.runtimeRecord.projectNamespace}', not '${options.projectNamespace}'. Refusing scoped cleanup.`;
23
+ }
24
+ if (options.runtimeRecord.zoneId !== options.zoneId) {
25
+ return `Tool VM runtime record for lease '${options.runtimeRecord.leaseId}' at '${options.stateDir}' belongs to zone '${options.runtimeRecord.zoneId}', not requested zone '${options.zoneId}'. Refusing scoped cleanup.`;
26
+ }
27
+ const expectedSessionLabel = buildToolSessionLabel(options.projectNamespace, options.zoneId, options.runtimeRecord.tcpSlot);
28
+ if (options.runtimeRecord.sessionLabel !== expectedSessionLabel) {
29
+ return `Tool VM runtime record for lease '${options.runtimeRecord.leaseId}' at '${options.stateDir}' session label '${options.runtimeRecord.sessionLabel}' does not match expected '${expectedSessionLabel}'. Refusing scoped cleanup.`;
30
+ }
31
+ return null;
32
+ }
33
+ async function killOrphanedToolVmProcess(runtimeRecord, dependencies) {
34
+ return await killOrphanedManagedVmProcess({
35
+ contextLabel: `Tool VM runtime record for lease '${runtimeRecord.leaseId}' (zone '${runtimeRecord.zoneId}', slot ${runtimeRecord.tcpSlot})`,
36
+ dependencies,
37
+ pid: runtimeRecord.qemuPid,
38
+ recordedIdentity: runtimeRecord.processIdentity,
39
+ });
40
+ }
41
+ async function verifyToolVmPortOwnership(options) {
42
+ if (!options.portForSlot && !options.readTcpListenPortOwner) {
43
+ return { kind: 'owned' };
44
+ }
45
+ if (!options.portForSlot) {
46
+ return {
47
+ kind: 'unproven',
48
+ warning: `Tool VM runtime record '${options.runtimeRecord.recordId}' cannot verify port ownership because no portForSlot dependency was provided.`,
49
+ };
50
+ }
51
+ const readTcpListenPortOwner = options.readTcpListenPortOwner ?? defaultReadTcpListenPortOwner;
52
+ const expectedPort = options.portForSlot(options.runtimeRecord.tcpSlot);
53
+ const portOwner = await readTcpListenPortOwner(expectedPort);
54
+ if (portOwner === null) {
55
+ return { kind: 'record-stale' };
56
+ }
57
+ if (portOwner.pid !== options.runtimeRecord.qemuPid) {
58
+ return {
59
+ kind: 'unproven',
60
+ warning: `Tool VM runtime record '${options.runtimeRecord.recordId}' port ${String(expectedPort)} is held by pid ${String(portOwner.pid)}, expected pid ${String(options.runtimeRecord.qemuPid)}.`,
61
+ };
62
+ }
63
+ if (!isManagedVmProcess(portOwner.command)) {
64
+ return {
65
+ kind: 'unproven',
66
+ warning: `Tool VM runtime record '${options.runtimeRecord.recordId}' port ${String(expectedPort)} is held by pid ${String(portOwner.pid)} but command is not a managed VM process: ${portOwner.command}.`,
67
+ };
68
+ }
69
+ return { kind: 'owned' };
70
+ }
71
+ export async function cleanupOrphanedToolVmsIfPresent(options, dependencies = {}) {
72
+ const log = dependencies.log ?? writeRecoveryLog;
73
+ const runtimeRecordResults = await (dependencies.loadAllToolVmRuntimeRecords ?? loadAllToolVmRuntimeRecords)(options.stateDir);
74
+ if (runtimeRecordResults.length === 0) {
75
+ return { cleanedCount: 0, killedPids: [], quarantinedCount: 0, warnings: [] };
76
+ }
77
+ const killedPids = [];
78
+ const warnings = [];
79
+ let cleanedCount = 0;
80
+ const killDependencies = {
81
+ isProcessAlive: dependencies.isProcessAlive ?? isProcessAlive,
82
+ killProcess: dependencies.killProcess ?? killProcess,
83
+ readProcessCommand: dependencies.readProcessCommand ?? readProcessCommand,
84
+ readProcessIdentity: dependencies.readProcessIdentity ?? readProcessIdentity,
85
+ sleep: dependencies.sleep ?? sleep,
86
+ };
87
+ const deleteRecord = dependencies.deleteToolVmRuntimeRecord ?? deleteToolVmRuntimeRecord;
88
+ const portForSlot = dependencies.portForSlot ??
89
+ (options.tcpBasePort === undefined
90
+ ? undefined
91
+ : ((tcpBasePort) => (slot) => tcpBasePort + slot)(options.tcpBasePort));
92
+ const validRuntimeRecords = [];
93
+ for (const runtimeRecordResult of runtimeRecordResults) {
94
+ if (runtimeRecordResult.kind === 'parse-error') {
95
+ const warning = `Tool VM runtime record at '${runtimeRecordResult.path}' failed to parse: ${runtimeRecordResult.error.message}. Skipping during in-process recovery without mutating the file.`;
96
+ if (options.mode !== 'in-process-recovery') {
97
+ throw new Error(warning);
98
+ }
99
+ log(warning);
100
+ warnings.push(warning);
101
+ continue;
102
+ }
103
+ const runtimeRecord = runtimeRecordResult.record;
104
+ const scopeMismatch = validateToolVmRecordCleanupScope({
105
+ expectedConfigPath: options.expectedConfigPath,
106
+ expectedControllerPort: options.expectedControllerPort,
107
+ projectNamespace: options.projectNamespace,
108
+ runtimeRecord,
109
+ stateDir: options.stateDir,
110
+ zoneId: options.zoneId,
111
+ });
112
+ if (scopeMismatch !== null) {
113
+ if (options.mode !== 'in-process-recovery') {
114
+ throw new Error(scopeMismatch);
115
+ }
116
+ const warning = `${scopeMismatch} Skipping the stale runtime record without signaling its recorded process during in-process recovery.`;
117
+ log(warning);
118
+ warnings.push(warning);
119
+ continue;
120
+ }
121
+ log(`Found persisted tool VM runtime for lease '${runtimeRecord.leaseId}' (zone '${runtimeRecord.zoneId}', slot ${runtimeRecord.tcpSlot}, pid ${runtimeRecord.qemuPid}, vm ${runtimeRecord.vmId}).`);
122
+ validRuntimeRecords.push(runtimeRecord);
123
+ }
124
+ const provenRuntimeRecords = await Promise.all(validRuntimeRecords.map(async (runtimeRecord) => ({
125
+ portOwnershipProof: await verifyToolVmPortOwnership({
126
+ ...(portForSlot ? { portForSlot } : {}),
127
+ ...(dependencies.readTcpListenPortOwner
128
+ ? { readTcpListenPortOwner: dependencies.readTcpListenPortOwner }
129
+ : {}),
130
+ runtimeRecord,
131
+ }),
132
+ runtimeRecord,
133
+ })));
134
+ const cleanupReadyRuntimeRecords = [];
135
+ for (const provenRuntimeRecord of provenRuntimeRecords) {
136
+ const { portOwnershipProof } = provenRuntimeRecord;
137
+ if (portOwnershipProof.kind === 'unproven') {
138
+ if (options.mode !== 'in-process-recovery') {
139
+ throw new Error(portOwnershipProof.warning);
140
+ }
141
+ const warning = `Skipping ${portOwnershipProof.warning}`;
142
+ log(warning);
143
+ warnings.push(warning);
144
+ continue;
145
+ }
146
+ cleanupReadyRuntimeRecords.push(provenRuntimeRecord);
147
+ }
148
+ const cleanupOutcomes = await Promise.all(cleanupReadyRuntimeRecords.map(async ({ runtimeRecord }) => {
149
+ const killedPid = await killOrphanedToolVmProcess(runtimeRecord, killDependencies);
150
+ try {
151
+ await deleteRecord(options.stateDir, runtimeRecord.recordId);
152
+ }
153
+ catch (error) {
154
+ const warning = `Failed to remove stale tool VM runtime record for lease '${runtimeRecord.leaseId}' at '${options.stateDir}': ${error instanceof Error ? error.message : JSON.stringify(error)}`;
155
+ log(warning);
156
+ return {
157
+ cleanedCount: 0,
158
+ killedPids: killedPid === null ? [] : [killedPid],
159
+ warnings: [warning],
160
+ };
161
+ }
162
+ log(killedPid === null
163
+ ? `Removed stale tool VM runtime record for lease '${runtimeRecord.leaseId}' after confirming the orphaned process was already gone.`
164
+ : `Removed stale tool VM runtime record for lease '${runtimeRecord.leaseId}' after terminating orphaned tool VM pid ${killedPid}.`);
165
+ return {
166
+ cleanedCount: 1,
167
+ killedPids: killedPid === null ? [] : [killedPid],
168
+ warnings: [],
169
+ };
170
+ }));
171
+ for (const cleanupOutcome of cleanupOutcomes) {
172
+ cleanedCount += cleanupOutcome.cleanedCount;
173
+ killedPids.push(...cleanupOutcome.killedPids);
174
+ warnings.push(...cleanupOutcome.warnings);
175
+ }
176
+ return { cleanedCount, killedPids, quarantinedCount: 0, warnings };
177
+ }
178
+ //# sourceMappingURL=tool-vm-recovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-vm-recovery.js","sourceRoot":"","sources":["../../../src/controller/leases/tool-vm-recovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,GACL,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,sBAAsB,IAAI,6BAA6B,GAEvD,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACN,yBAAyB,EACzB,2BAA2B,GAC3B,MAAM,6BAA6B,CAAC;AAErC,SAAS,gBAAgB,CAAC,OAAe;IACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,OAAO,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,2EAA2E;AAC3E,wEAAwE;AACxE,+DAA+D;AAC/D,wEAAwE;AACxE,uEAAuE;AACvE,6EAA6E;AAC7E,SAAS,gCAAgC,CAAC,OAOzC;IACA,IAAI,OAAO,CAAC,aAAa,CAAC,UAAU,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC;QACrE,OAAO,qCA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AA4C,SAAS,GAAG,CACnI,CAAC;QACF,OAAO;YACN,YAAY,EAAE,CAAC;YACf,UAAU,EAAE,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACjD,QAAQ,EAAE,EAAE;SACyB,CAAC;IACxC,CAAC,CAAC,CACF,CAAC;IACF,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC9C,YAAY,IAAI,cAAc,CAAC,YAAY,CAAC;QAC5C,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QAC9C,QAAQ,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { type ManagedVm } from '@agent-vm/gondolin-adapter';
2
+ import { z } from 'zod';
3
+ import { readProcessIdentity as defaultReadProcessIdentity } from '../../shared/managed-vm-process.js';
4
+ export declare const toolVmRuntimeRecordSchema: z.ZodObject<{
5
+ schemaVersion: z.ZodLiteral<1>;
6
+ recordId: z.ZodUUID;
7
+ agentId: z.ZodString;
8
+ leaseId: z.ZodString;
9
+ vmId: z.ZodString;
10
+ qemuPid: z.ZodNumber;
11
+ processIdentity: z.ZodObject<{
12
+ command: z.ZodString;
13
+ lstart: z.ZodString;
14
+ }, z.core.$strict>;
15
+ configPath: z.ZodString;
16
+ controllerPort: z.ZodNumber;
17
+ projectNamespace: z.ZodString;
18
+ zoneId: z.ZodString;
19
+ gateway: z.ZodObject<{
20
+ sessionLabel: z.ZodString;
21
+ vmId: z.ZodOptional<z.ZodString>;
22
+ }, z.core.$strict>;
23
+ tcpSlot: z.ZodNumber;
24
+ sessionLabel: z.ZodString;
25
+ createdAt: z.ZodISODateTime;
26
+ }, z.core.$strict>;
27
+ export type ToolVmRuntimeRecord = z.infer<typeof toolVmRuntimeRecordSchema>;
28
+ export type ToolVmRuntimeLog = (message: string) => void;
29
+ export type ToolVmRuntimeRecordLoadResult = {
30
+ readonly kind: 'loaded';
31
+ readonly path: string;
32
+ readonly record: ToolVmRuntimeRecord;
33
+ } | {
34
+ readonly error: Error;
35
+ readonly kind: 'parse-error';
36
+ readonly path: string;
37
+ };
38
+ export declare function toolVmRuntimeRecordFilename(record: ToolVmRuntimeRecord): string;
39
+ export declare function loadToolVmRuntimeRecord(stateDirectory: string, recordId: string): Promise<ToolVmRuntimeRecord | null>;
40
+ export declare function loadAllToolVmRuntimeRecords(stateDirectory: string): Promise<ToolVmRuntimeRecordLoadResult[]>;
41
+ export declare function writeToolVmRuntimeRecord(stateDirectory: string, record: ToolVmRuntimeRecord): Promise<void>;
42
+ export declare function deleteToolVmRuntimeRecord(stateDirectory: string, recordId: string): Promise<void>;
43
+ export declare function buildToolVmRuntimeRecord(options: {
44
+ readonly agentId: string;
45
+ readonly controllerPort: number;
46
+ readonly gateway?: {
47
+ readonly sessionLabel: string;
48
+ readonly vmId?: string;
49
+ };
50
+ readonly leaseId: string;
51
+ readonly managedVm: ManagedVm;
52
+ readonly projectNamespace: string;
53
+ readonly readProcessIdentity?: typeof defaultReadProcessIdentity;
54
+ readonly recordId: string;
55
+ readonly systemConfigPath: string;
56
+ readonly tcpSlot: number;
57
+ readonly zoneId: string;
58
+ }): Promise<ToolVmRuntimeRecord>;
59
+ //# sourceMappingURL=tool-vm-runtime-record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-vm-runtime-record.d.ts","sourceRoot":"","sources":["../../../src/controller/leases/tool-vm-runtime-record.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAuB,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAY,CAAC,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,EAAE,mBAAmB,IAAI,0BAA0B,EAAE,MAAM,oC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B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;QAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,0BAA0B,CAAC;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA4B/B"}
@@ -0,0 +1,159 @@
1
+ import fs from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { buildGatewaySessionLabel, buildToolSessionLabel } from '@agent-vm/gateway-interface';
4
+ import { writeFileAtomically } from '@agent-vm/gondolin-adapter';
5
+ import { ZodError, z } from 'zod';
6
+ import { readProcessIdentity as defaultReadProcessIdentity } from '../../shared/managed-vm-process.js';
7
+ export const toolVmRuntimeRecordSchema = z.strictObject({
8
+ schemaVersion: z.literal(1),
9
+ recordId: z.uuid(),
10
+ agentId: z.string().min(1),
11
+ leaseId: z.string().min(1),
12
+ vmId: z.string().min(1),
13
+ qemuPid: z.number().int().positive(),
14
+ processIdentity: z.strictObject({
15
+ command: z.string().min(1),
16
+ lstart: z.string().min(1),
17
+ }),
18
+ configPath: z.string().min(1),
19
+ controllerPort: z.number().int().positive(),
20
+ projectNamespace: z.string().min(1),
21
+ zoneId: z.string().min(1),
22
+ gateway: z.strictObject({
23
+ sessionLabel: z.string().min(1),
24
+ vmId: z.string().min(1).optional(),
25
+ }),
26
+ tcpSlot: z.number().int().nonnegative(),
27
+ sessionLabel: z.string().min(1),
28
+ createdAt: z.iso.datetime(),
29
+ });
30
+ const toolLeasesDirectoryName = 'tool-leases';
31
+ function resolveToolLeasesDirectory(stateDirectory) {
32
+ return path.join(stateDirectory, toolLeasesDirectoryName);
33
+ }
34
+ function resolveToolVmRuntimeRecordPath(stateDirectory, recordId) {
35
+ return path.join(resolveToolLeasesDirectory(stateDirectory), `${recordId}.json`);
36
+ }
37
+ export function toolVmRuntimeRecordFilename(record) {
38
+ return `${record.recordId}.json`;
39
+ }
40
+ function parseToolVmRuntimeRecord(rawRuntimeRecord) {
41
+ const parsedRuntimeRecord = JSON.parse(rawRuntimeRecord);
42
+ return toolVmRuntimeRecordSchema.parse(parsedRuntimeRecord);
43
+ }
44
+ function runtimeRecordParseError(error) {
45
+ return error instanceof Error ? error : new Error(String(error));
46
+ }
47
+ export async function loadToolVmRuntimeRecord(stateDirectory, recordId) {
48
+ const runtimeRecordPath = resolveToolVmRuntimeRecordPath(stateDirectory, recordId);
49
+ let rawRuntimeRecord;
50
+ try {
51
+ rawRuntimeRecord = await fs.readFile(runtimeRecordPath, 'utf8');
52
+ }
53
+ catch (error) {
54
+ if (typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT') {
55
+ return null;
56
+ }
57
+ throw error;
58
+ }
59
+ return parseToolVmRuntimeRecord(rawRuntimeRecord);
60
+ }
61
+ async function loadToolVmRuntimeRecordResult(runtimeRecordPath) {
62
+ try {
63
+ return {
64
+ kind: 'loaded',
65
+ path: runtimeRecordPath,
66
+ record: parseToolVmRuntimeRecord(await fs.readFile(runtimeRecordPath, 'utf8')),
67
+ };
68
+ }
69
+ catch (error) {
70
+ if (!(error instanceof SyntaxError) && !(error instanceof ZodError)) {
71
+ throw error;
72
+ }
73
+ return {
74
+ error: runtimeRecordParseError(error),
75
+ kind: 'parse-error',
76
+ path: runtimeRecordPath,
77
+ };
78
+ }
79
+ }
80
+ export async function loadAllToolVmRuntimeRecords(stateDirectory) {
81
+ const leasesDirectory = resolveToolLeasesDirectory(stateDirectory);
82
+ let entries;
83
+ try {
84
+ entries = await fs.readdir(leasesDirectory);
85
+ }
86
+ catch (error) {
87
+ if (typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT') {
88
+ return [];
89
+ }
90
+ throw error;
91
+ }
92
+ const results = [];
93
+ for (const entry of entries) {
94
+ if (!entry.endsWith('.json')) {
95
+ continue;
96
+ }
97
+ const runtimeRecordPath = path.join(leasesDirectory, entry);
98
+ // oxlint-disable-next-line no-await-in-loop -- per-entry parse errors need their own path.
99
+ results.push(await loadToolVmRuntimeRecordResult(runtimeRecordPath));
100
+ }
101
+ results.sort((left, right) => {
102
+ const leftCreatedAt = left.kind === 'loaded' ? left.record.createdAt : '';
103
+ const rightCreatedAt = right.kind === 'loaded' ? right.record.createdAt : '';
104
+ return leftCreatedAt.localeCompare(rightCreatedAt) || left.path.localeCompare(right.path);
105
+ });
106
+ return results;
107
+ }
108
+ export async function writeToolVmRuntimeRecord(stateDirectory, record) {
109
+ const parsedRecord = toolVmRuntimeRecordSchema.parse(record);
110
+ const runtimeRecordPath = resolveToolVmRuntimeRecordPath(stateDirectory, parsedRecord.recordId);
111
+ await fs.mkdir(resolveToolLeasesDirectory(stateDirectory), { recursive: true, mode: 0o700 });
112
+ await writeFileAtomically(runtimeRecordPath, `${JSON.stringify(parsedRecord, null, 2)}\n`, {
113
+ mode: 0o600,
114
+ });
115
+ }
116
+ export async function deleteToolVmRuntimeRecord(stateDirectory, recordId) {
117
+ await fs.rm(resolveToolVmRuntimeRecordPath(stateDirectory, recordId), { force: true });
118
+ }
119
+ function resolveManagedVmQemuPid(managedVm) {
120
+ if (typeof managedVm.getHostPid !== 'function') {
121
+ throw new Error('Managed VM wrapper is missing getHostPid(); update the Gondolin adapter.');
122
+ }
123
+ const qemuPid = managedVm.getHostPid();
124
+ if (qemuPid === null) {
125
+ throw new Error('Gondolin VM runtime does not expose an active host pid; upgrade @earendil-works/gondolin to a version with VM.getHostPid().');
126
+ }
127
+ if (!Number.isInteger(qemuPid) || qemuPid <= 0) {
128
+ throw new Error(`Gondolin VM runtime exposed an invalid host pid: ${qemuPid}.`);
129
+ }
130
+ return qemuPid;
131
+ }
132
+ export async function buildToolVmRuntimeRecord(options) {
133
+ const qemuPid = resolveManagedVmQemuPid(options.managedVm);
134
+ const processIdentityReader = options.readProcessIdentity ?? defaultReadProcessIdentity;
135
+ const processIdentity = await processIdentityReader(qemuPid);
136
+ if (processIdentity === null) {
137
+ throw new Error(`Failed to capture process identity for Tool VM '${options.managedVm.id}' pid ${String(qemuPid)}.`);
138
+ }
139
+ return toolVmRuntimeRecordSchema.parse({
140
+ agentId: options.agentId,
141
+ configPath: options.systemConfigPath,
142
+ controllerPort: options.controllerPort,
143
+ createdAt: new Date().toISOString(),
144
+ gateway: options.gateway ?? {
145
+ sessionLabel: buildGatewaySessionLabel(options.projectNamespace, options.zoneId),
146
+ },
147
+ leaseId: options.leaseId,
148
+ processIdentity,
149
+ projectNamespace: options.projectNamespace,
150
+ qemuPid,
151
+ recordId: options.recordId,
152
+ schemaVersion: 1,
153
+ sessionLabel: buildToolSessionLabel(options.projectNamespace, options.zoneId, options.tcpSlot),
154
+ tcpSlot: options.tcpSlot,
155
+ vmId: options.managedVm.id,
156
+ zoneId: options.zoneId,
157
+ });
158
+ }
159
+ //# sourceMappingURL=tool-vm-runtime-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-vm-runtime-record.js","sourceRoot":"","sources":["../../../src/controller/leases/tool-vm-runtime-record.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EAAkB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,EAAE,mBAAmB,IAAI,0BAA0B,EAAE,M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AAe,KAAK,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CACd,mDAAmD,OAAO,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,CAAC,OAAO,CAAC,GAAG,CAClG,CAAC;IACH,CAAC;IACD,OAAO,yBAAyB,CAAC,KAAK,CAAC;QACtC,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,UAAU,EAAE,OAAO,CAAC,gBAAgB;QACpC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI;YAC3B,YAAY,EAAE,wBAAwB,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,MAAM,CAAC;SAChF;QACD,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,eAAe;QACf,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,OAAO;QACP,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,qBAAqB,CAAC,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC;QAC9F,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,EAAE;QAC1B,MAAM,EAAE,OAAO,CAAC,MAAM;KACtB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,17 +1,20 @@
1
- import type { GatewayRuntimeRecordLegacyDefaults } from './gateway-runtime-record.js';
2
- import { deleteGatewayRuntimeRecord, loadGatewayRuntimeRecord, quarantineGatewayRuntimeRecord } from './gateway-runtime-record.js';
1
+ import { readProcessIdentity } from '../shared/managed-vm-process.js';
2
+ import { type PortOwner } from '../shared/port-owner.js';
3
+ import { deleteGatewayRuntimeRecord, loadGatewayRuntimeRecordResult } from './gateway-runtime-record.js';
3
4
  export interface GatewayRecoveryDependencies {
4
5
  readonly deleteGatewayRuntimeRecord?: typeof deleteGatewayRuntimeRecord;
5
6
  readonly isProcessAlive?: (pid: number) => boolean;
6
7
  readonly killProcess?: (pid: number, signal: NodeJS.Signals) => void;
7
- readonly loadGatewayRuntimeRecord?: typeof loadGatewayRuntimeRecord;
8
+ readonly loadGatewayRuntimeRecordResult?: typeof loadGatewayRuntimeRecordResult;
8
9
  readonly log?: (message: string) => void;
9
10
  readonly readProcessCommand?: (pid: number) => Promise<string | null>;
10
- readonly quarantineGatewayRuntimeRecord?: typeof quarantineGatewayRuntimeRecord;
11
+ readonly readProcessIdentity?: typeof readProcessIdentity;
12
+ readonly readTcpListenPortOwner?: (port: number) => Promise<PortOwner | null>;
11
13
  readonly sleep?: (delayMs: number) => Promise<void>;
12
14
  }
13
15
  export declare function cleanupOrphanedGatewayIfPresent(options: {
14
- readonly legacyRecordDefaults?: GatewayRuntimeRecordLegacyDefaults;
16
+ readonly expectedConfigPath: string;
17
+ readonly expectedControllerPort: number;
15
18
  readonly mode?: 'in-process-recovery' | 'offline-cleanup';
16
19
  readonly projectNamespace: string;
17
20
  readonly stateDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"gateway-recovery.d.ts","sourceRoot":"","sources":["../../src/gateway/gateway-recovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEX,kCAAkC,EAClC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACN,0BAA0B,EAC1B,wBAAwB,EACxB,8BAA8B,EAC9B,MAAM,6BAA6B,CAAC;AAwLrC,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,0BAA0B,CAAC,EAAE,OAAO,0BAA0B,CAAC;IACxE,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC;IACrE,Q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