@agent-vm/worker-gateway 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/index.d.ts +166 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Shravan Sunder
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
//#region ../gateway-interface/dist/index.d.ts
|
|
2
|
+
//#region src/gateway-runtime-contract.d.ts
|
|
3
|
+
declare const gatewayTypeValues: readonly ["openclaw", "worker"];
|
|
4
|
+
type GatewayType = (typeof gatewayTypeValues)[number];
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region ../gondolin-adapter/dist/index.d.ts
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/types.d.ts
|
|
10
|
+
interface SecretSpec {
|
|
11
|
+
readonly hosts: readonly string[];
|
|
12
|
+
readonly value: string;
|
|
13
|
+
}
|
|
14
|
+
type SecretRef = {
|
|
15
|
+
readonly source: '1password';
|
|
16
|
+
readonly ref: string;
|
|
17
|
+
} | {
|
|
18
|
+
readonly source: 'environment';
|
|
19
|
+
readonly ref: string;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/secret-resolver.d.ts
|
|
23
|
+
|
|
24
|
+
interface SecretResolver {
|
|
25
|
+
resolve(ref: SecretRef): Promise<string>;
|
|
26
|
+
resolveAll(refs: Record<string, SecretRef>): Promise<Record<string, string>>;
|
|
27
|
+
}
|
|
28
|
+
interface VfsMountSpec {
|
|
29
|
+
readonly kind: 'realfs' | 'realfs-readonly' | 'memory' | 'shadow';
|
|
30
|
+
readonly hostPath?: string;
|
|
31
|
+
readonly shadowConfig?: {
|
|
32
|
+
readonly deny: readonly string[];
|
|
33
|
+
readonly tmpfs: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/gateway-process-spec.d.ts
|
|
38
|
+
type GatewayHealthCheck = {
|
|
39
|
+
readonly type: 'http';
|
|
40
|
+
readonly port: number;
|
|
41
|
+
readonly path: string;
|
|
42
|
+
} | {
|
|
43
|
+
readonly type: 'command';
|
|
44
|
+
readonly command: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Everything about the process running inside the VM.
|
|
48
|
+
* Retained by the running gateway handle for logs, health, restart.
|
|
49
|
+
*/
|
|
50
|
+
interface GatewayProcessSpec {
|
|
51
|
+
readonly bootstrapCommand: string;
|
|
52
|
+
readonly startCommand: string;
|
|
53
|
+
readonly healthCheck: GatewayHealthCheck;
|
|
54
|
+
readonly guestListenPort: number;
|
|
55
|
+
readonly logPath: string;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/gateway-vm-spec.d.ts
|
|
59
|
+
/**
|
|
60
|
+
* Everything the controller needs to create the Gondolin VM.
|
|
61
|
+
* Lifecycle implementations own the full Gondolin-facing contract.
|
|
62
|
+
*/
|
|
63
|
+
interface GatewayVmSpec {
|
|
64
|
+
readonly environment: Record<string, string>;
|
|
65
|
+
readonly vfsMounts: Record<string, VfsMountSpec>;
|
|
66
|
+
readonly mediatedSecrets: Record<string, SecretSpec>;
|
|
67
|
+
readonly tcpHosts: Record<string, string>;
|
|
68
|
+
readonly allowedHosts: readonly string[];
|
|
69
|
+
readonly rootfsMode: 'readonly' | 'memory' | 'cow';
|
|
70
|
+
readonly sessionLabel: string;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/gateway-lifecycle.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Describes how to run interactive auth for a gateway type.
|
|
76
|
+
* Static property — available without a running VM.
|
|
77
|
+
*/
|
|
78
|
+
interface GatewayAuthConfig {
|
|
79
|
+
/**
|
|
80
|
+
* Shell command to list available auth providers inside the VM.
|
|
81
|
+
* Should output one provider name per line to stdout.
|
|
82
|
+
*/
|
|
83
|
+
readonly listProvidersCommand: string;
|
|
84
|
+
/**
|
|
85
|
+
* Build the shell command for interactive auth login.
|
|
86
|
+
* The CLI passes this as the SSH remote command with -t (TTY).
|
|
87
|
+
*/
|
|
88
|
+
readonly buildLoginCommand: (provider: string) => string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Zone config as the lifecycle sees it.
|
|
92
|
+
* Decoupled from SystemConfig — the controller maps into this shape.
|
|
93
|
+
*/
|
|
94
|
+
interface GatewayZoneConfig {
|
|
95
|
+
readonly id: string;
|
|
96
|
+
readonly gateway: {
|
|
97
|
+
readonly type: GatewayType;
|
|
98
|
+
readonly memory: string;
|
|
99
|
+
readonly cpus: number;
|
|
100
|
+
readonly port: number;
|
|
101
|
+
readonly config: string;
|
|
102
|
+
readonly stateDir: string;
|
|
103
|
+
readonly workspaceDir: string;
|
|
104
|
+
readonly authProfilesRef?: {
|
|
105
|
+
readonly source: '1password';
|
|
106
|
+
readonly ref: string;
|
|
107
|
+
} | {
|
|
108
|
+
readonly source: 'environment';
|
|
109
|
+
readonly envVar: string;
|
|
110
|
+
} | undefined;
|
|
111
|
+
};
|
|
112
|
+
readonly secrets: Record<string, {
|
|
113
|
+
readonly source: '1password';
|
|
114
|
+
readonly ref: string;
|
|
115
|
+
readonly injection: 'env' | 'http-mediation';
|
|
116
|
+
readonly hosts?: readonly string[] | undefined;
|
|
117
|
+
} | {
|
|
118
|
+
readonly source: 'environment';
|
|
119
|
+
readonly envVar: string;
|
|
120
|
+
readonly injection: 'env' | 'http-mediation';
|
|
121
|
+
readonly hosts?: readonly string[] | undefined;
|
|
122
|
+
}>;
|
|
123
|
+
readonly allowedHosts: readonly string[];
|
|
124
|
+
readonly websocketBypass: readonly string[];
|
|
125
|
+
readonly toolProfile?: string;
|
|
126
|
+
}
|
|
127
|
+
interface BuildGatewayVmSpecOptions {
|
|
128
|
+
readonly controllerPort: number;
|
|
129
|
+
readonly projectNamespace: string;
|
|
130
|
+
readonly resolvedSecrets: Record<string, string>;
|
|
131
|
+
readonly tcpPool: {
|
|
132
|
+
readonly basePort: number;
|
|
133
|
+
readonly size: number;
|
|
134
|
+
};
|
|
135
|
+
readonly zone: GatewayZoneConfig;
|
|
136
|
+
}
|
|
137
|
+
interface GatewayLifecycle {
|
|
138
|
+
/**
|
|
139
|
+
* How to run interactive auth for this gateway type.
|
|
140
|
+
* Absent means the gateway type does not support interactive auth.
|
|
141
|
+
*/
|
|
142
|
+
readonly authConfig?: GatewayAuthConfig | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* Build the full VM spec — everything Gondolin needs to create the VM.
|
|
145
|
+
* Pure data assembly — no side effects.
|
|
146
|
+
*/
|
|
147
|
+
buildVmSpec(options: BuildGatewayVmSpecOptions): GatewayVmSpec;
|
|
148
|
+
/**
|
|
149
|
+
* Build the process spec — everything about startup, health, and logging.
|
|
150
|
+
* Pure data assembly — no side effects.
|
|
151
|
+
*/
|
|
152
|
+
buildProcessSpec(zone: GatewayZoneConfig, resolvedSecrets: Record<string, string>): GatewayProcessSpec;
|
|
153
|
+
/**
|
|
154
|
+
* Optional hook to prepare host-side state before the VM boots.
|
|
155
|
+
* Example: writing auth-profiles.json from 1Password.
|
|
156
|
+
*/
|
|
157
|
+
prepareHostState?(zone: GatewayZoneConfig, secretResolver: SecretResolver): Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
//#region src/split-resolved-gateway-secrets.d.ts
|
|
161
|
+
//#endregion
|
|
162
|
+
//#region src/worker-lifecycle.d.ts
|
|
163
|
+
declare const workerLifecycle: GatewayLifecycle;
|
|
164
|
+
//#endregion
|
|
165
|
+
export { workerLifecycle };
|
|
166
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["gatewayTypeValues","GatewayType","buildGatewaySessionLabel","buildToolSessionLabel","SecretSpec","SecretRef","SecretResolver","Promise","Record","VfsMountSpec","GatewayHealthCheck","GatewayProcessSpec","GatewayVmSpec","GatewayAuthConfig","GatewayZoneConfig","BuildGatewayVmSpecOptions","GatewayLifecycle","SplitResolvedGatewaySecretsResult","splitResolvedGatewaySecrets"],"sources":["../../gateway-interface/dist/index.d.ts","../src/worker-lifecycle.ts"],"sourcesContent":["//#region src/gateway-runtime-contract.d.ts\ndeclare const gatewayTypeValues: readonly [\"openclaw\", \"worker\"];\ntype GatewayType = (typeof gatewayTypeValues)[number];\ndeclare function buildGatewaySessionLabel(projectNamespace: string, zoneId: string): string;\ndeclare function buildToolSessionLabel(projectNamespace: string, zoneId: string, tcpSlot: number): string;\n//#endregion\n//#region ../gondolin-adapter/dist/index.d.ts\n\n//#endregion\n//#region src/types.d.ts\ninterface SecretSpec {\n readonly hosts: readonly string[];\n readonly value: string;\n}\ntype SecretRef = {\n readonly source: '1password';\n readonly ref: string;\n} | {\n readonly source: 'environment';\n readonly ref: string;\n};\n//#endregion\n//#region src/secret-resolver.d.ts\n\ninterface SecretResolver {\n resolve(ref: SecretRef): Promise<string>;\n resolveAll(refs: Record<string, SecretRef>): Promise<Record<string, string>>;\n}\ninterface VfsMountSpec {\n readonly kind: 'realfs' | 'realfs-readonly' | 'memory' | 'shadow';\n readonly hostPath?: string;\n readonly shadowConfig?: {\n readonly deny: readonly string[];\n readonly tmpfs: readonly string[];\n };\n}\n//#endregion\n//#region src/gateway-process-spec.d.ts\ntype GatewayHealthCheck = {\n readonly type: 'http';\n readonly port: number;\n readonly path: string;\n} | {\n readonly type: 'command';\n readonly command: string;\n};\n/**\n * Everything about the process running inside the VM.\n * Retained by the running gateway handle for logs, health, restart.\n */\ninterface GatewayProcessSpec {\n readonly bootstrapCommand: string;\n readonly startCommand: string;\n readonly healthCheck: GatewayHealthCheck;\n readonly guestListenPort: number;\n readonly logPath: string;\n}\n//#endregion\n//#region src/gateway-vm-spec.d.ts\n/**\n * Everything the controller needs to create the Gondolin VM.\n * Lifecycle implementations own the full Gondolin-facing contract.\n */\ninterface GatewayVmSpec {\n readonly environment: Record<string, string>;\n readonly vfsMounts: Record<string, VfsMountSpec>;\n readonly mediatedSecrets: Record<string, SecretSpec>;\n readonly tcpHosts: Record<string, string>;\n readonly allowedHosts: readonly string[];\n readonly rootfsMode: 'readonly' | 'memory' | 'cow';\n readonly sessionLabel: string;\n}\n//#endregion\n//#region src/gateway-lifecycle.d.ts\n/**\n * Describes how to run interactive auth for a gateway type.\n * Static property — available without a running VM.\n */\ninterface GatewayAuthConfig {\n /**\n * Shell command to list available auth providers inside the VM.\n * Should output one provider name per line to stdout.\n */\n readonly listProvidersCommand: string;\n /**\n * Build the shell command for interactive auth login.\n * The CLI passes this as the SSH remote command with -t (TTY).\n */\n readonly buildLoginCommand: (provider: string) => string;\n}\n/**\n * Zone config as the lifecycle sees it.\n * Decoupled from SystemConfig — the controller maps into this shape.\n */\ninterface GatewayZoneConfig {\n readonly id: string;\n readonly gateway: {\n readonly type: GatewayType;\n readonly memory: string;\n readonly cpus: number;\n readonly port: number;\n readonly config: string;\n readonly stateDir: string;\n readonly workspaceDir: string;\n readonly authProfilesRef?: {\n readonly source: '1password';\n readonly ref: string;\n } | {\n readonly source: 'environment';\n readonly envVar: string;\n } | undefined;\n };\n readonly secrets: Record<string, {\n readonly source: '1password';\n readonly ref: string;\n readonly injection: 'env' | 'http-mediation';\n readonly hosts?: readonly string[] | undefined;\n } | {\n readonly source: 'environment';\n readonly envVar: string;\n readonly injection: 'env' | 'http-mediation';\n readonly hosts?: readonly string[] | undefined;\n }>;\n readonly allowedHosts: readonly string[];\n readonly websocketBypass: readonly string[];\n readonly toolProfile?: string;\n}\ninterface BuildGatewayVmSpecOptions {\n readonly controllerPort: number;\n readonly projectNamespace: string;\n readonly resolvedSecrets: Record<string, string>;\n readonly tcpPool: {\n readonly basePort: number;\n readonly size: number;\n };\n readonly zone: GatewayZoneConfig;\n}\ninterface GatewayLifecycle {\n /**\n * How to run interactive auth for this gateway type.\n * Absent means the gateway type does not support interactive auth.\n */\n readonly authConfig?: GatewayAuthConfig | undefined;\n /**\n * Build the full VM spec — everything Gondolin needs to create the VM.\n * Pure data assembly — no side effects.\n */\n buildVmSpec(options: BuildGatewayVmSpecOptions): GatewayVmSpec;\n /**\n * Build the process spec — everything about startup, health, and logging.\n * Pure data assembly — no side effects.\n */\n buildProcessSpec(zone: GatewayZoneConfig, resolvedSecrets: Record<string, string>): GatewayProcessSpec;\n /**\n * Optional hook to prepare host-side state before the VM boots.\n * Example: writing auth-profiles.json from 1Password.\n */\n prepareHostState?(zone: GatewayZoneConfig, secretResolver: SecretResolver): Promise<void>;\n}\n//#endregion\n//#region src/split-resolved-gateway-secrets.d.ts\ninterface SplitResolvedGatewaySecretsResult {\n readonly environmentSecrets: Record<string, string>;\n readonly mediatedSecrets: Record<string, SecretSpec>;\n}\ndeclare function splitResolvedGatewaySecrets(zone: GatewayZoneConfig, resolvedSecrets: Record<string, string>): SplitResolvedGatewaySecretsResult;\n//#endregion\nexport { type BuildGatewayVmSpecOptions, type GatewayAuthConfig, type GatewayHealthCheck, type GatewayLifecycle, type GatewayProcessSpec, type GatewayType, type GatewayVmSpec, type GatewayZoneConfig, type SplitResolvedGatewaySecretsResult, buildGatewaySessionLabel, buildToolSessionLabel, gatewayTypeValues, splitResolvedGatewaySecrets };\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;cACcA,iBAAkD,EAAA,SAAA,CAAA,UAAA,EAAA,QAAA,CAAA;AAAA,KAC3DC,WAAAA,GAAW,CAAA,OAAWD,iBAAAA,CAAAA,CAAAA,MAAiB,CAAA;AAY9B;;;;;UAJJI,UAAAA,CAgB6CI;EAARD,SAAAA,KAAAA,EAAAA,SAAAA,MAAAA,EAAAA;EAAO,SAAA,KAAA,EAAA,MAAA;AAAA;AAEhC,KAdjBF,SAAAA,GAwBAK;EAAkB,SAYbC,MAAAA,EAAAA,WAAkB;EAGc,SAUhCC,GAAAA,EAAAA,MAAa;CACCJ,GAAAA;EACaC,SAAAA,MAAAA,EAAAA,aAAAA;EAAfD,SAAAA,GAAAA,EAAAA,MAAAA;CACqBJ;;;;AAChB,UA3CjBE,cAAAA,CAsDiB;EAAA,OAgBjBQ,CAAAA,GAAAA,EArEKT,SAqEY,CAAA,EArEAE,OAqEA,CAAA,MAGRN,CAAAA;EAeO,UAehBc,CAAAA,IAAAA,EArGSP,MAqGTO,CAAAA,MAAyB,EArGDV,SAqGC,CAGPG,CAAAA,EAxGmBD,OA6G9BO,CA7GsCN,MA6GtCM,CAAAA,MAAAA,EAAiB,MAAA,CAAA,CAAA;AAAA;UA3GxBL,YAAAA,CAkHcI;EAKDE,SAAAA,IAAAA,EAAAA,QAAAA,GAAAA,iBAAAA,GAAAA,QAAAA,GAAAA,QAAAA;EAA4BH,SAAAA,QAAAA,CAAAA,EAAAA,MAAAA;EAK1BE,SAAAA,YAAAA,CAAAA,EAAAA;IAAoCN,SAAAA,IAAAA,EAAAA,SAAAA,MAAAA,EAAAA;IAAyBG,SAAAA,KAAAA,EAAAA,SAAAA,MAAAA,EAAAA;EAK5DG,CAAAA;;;;KAvHrBJ,kBAAAA;;;EC9BL,SAAa,IAAA,EAAA,MAsDZ;;;;;;;;;UDZSC,kBAAAA;;;wBAGcD;;;;;;;;;;UAUdE,aAAAA;wBACcJ;sBACFA,eAAeC;4BACTD,eAAeJ;qBACtBI;;;;;;;;;;;UAWXK,iBAAAA;;;;;;;;;;;;;;;;UAgBAC,iBAAAA;;;mBAGSb;;;;;;;;;;;;;;;oBAeCO;;;;;;;;;;;;;;;UAeVO,yBAAAA;;;4BAGkBP;;;;;iBAKXM;;UAEPE,gBAAAA;;;;;wBAKcH;;;;;uBAKDE,4BAA4BH;;;;;yBAK1BE,oCAAoCN,yBAAyBG;;;;;0BAK5DG,mCAAmCR,iBAAiBC;;;;;;AA5JhEP,cCOD,eDPmD,ECOlC,gBDPkC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { buildGatewaySessionLabel, splitResolvedGatewaySecrets } from "@agent-vm/gateway-interface";
|
|
2
|
+
|
|
3
|
+
//#region src/worker-lifecycle.ts
|
|
4
|
+
const workerLifecycle = {
|
|
5
|
+
buildVmSpec({ controllerPort, projectNamespace, resolvedSecrets, zone }) {
|
|
6
|
+
const { environmentSecrets, mediatedSecrets } = splitResolvedGatewaySecrets(zone, resolvedSecrets);
|
|
7
|
+
return {
|
|
8
|
+
allowedHosts: [...zone.allowedHosts],
|
|
9
|
+
environment: {
|
|
10
|
+
HOME: "/home/coder",
|
|
11
|
+
CONTROLLER_BASE_URL: "http://controller.vm.host:18800",
|
|
12
|
+
NODE_EXTRA_CA_CERTS: "/run/gondolin/ca-certificates.crt",
|
|
13
|
+
AGENT_VM_ZONE_ID: zone.id,
|
|
14
|
+
STATE_DIR: "/state",
|
|
15
|
+
WORKER_CONFIG_PATH: "/state/effective-worker.json",
|
|
16
|
+
WORKSPACE_DIR: "/workspace",
|
|
17
|
+
...environmentSecrets
|
|
18
|
+
},
|
|
19
|
+
mediatedSecrets,
|
|
20
|
+
rootfsMode: "cow",
|
|
21
|
+
sessionLabel: buildGatewaySessionLabel(projectNamespace, zone.id),
|
|
22
|
+
tcpHosts: { "controller.vm.host:18800": `127.0.0.1:${controllerPort}` },
|
|
23
|
+
vfsMounts: {
|
|
24
|
+
"/state": {
|
|
25
|
+
hostPath: zone.gateway.stateDir,
|
|
26
|
+
kind: "realfs"
|
|
27
|
+
},
|
|
28
|
+
"/workspace": {
|
|
29
|
+
hostPath: zone.gateway.workspaceDir,
|
|
30
|
+
kind: "realfs"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
buildProcessSpec() {
|
|
36
|
+
return {
|
|
37
|
+
bootstrapCommand: "if [ -f /state/agent-vm-worker.tgz ]; then npm install -g --force @openai/codex /state/agent-vm-worker.tgz; fi",
|
|
38
|
+
startCommand: "cd /workspace && nohup agent-vm-worker serve --port 18789 --config /state/effective-worker.json --state-dir /state > /tmp/agent-vm-worker.log 2>&1 &",
|
|
39
|
+
healthCheck: {
|
|
40
|
+
type: "http",
|
|
41
|
+
port: 18789,
|
|
42
|
+
path: "/health"
|
|
43
|
+
},
|
|
44
|
+
guestListenPort: 18789,
|
|
45
|
+
logPath: "/tmp/agent-vm-worker.log"
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
//#endregion
|
|
51
|
+
export { workerLifecycle };
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["workerLifecycle: GatewayLifecycle"],"sources":["../src/worker-lifecycle.ts"],"sourcesContent":["import type {\n\tBuildGatewayVmSpecOptions,\n\tGatewayLifecycle,\n\tGatewayProcessSpec,\n\tGatewayVmSpec,\n} from '@agent-vm/gateway-interface';\nimport { buildGatewaySessionLabel, splitResolvedGatewaySecrets } from '@agent-vm/gateway-interface';\n\nexport const workerLifecycle: GatewayLifecycle = {\n\tbuildVmSpec({\n\t\tcontrollerPort,\n\t\tprojectNamespace,\n\t\tresolvedSecrets,\n\t\tzone,\n\t}: BuildGatewayVmSpecOptions): GatewayVmSpec {\n\t\tconst { environmentSecrets, mediatedSecrets } = splitResolvedGatewaySecrets(\n\t\t\tzone,\n\t\t\tresolvedSecrets,\n\t\t);\n\n\t\treturn {\n\t\t\tallowedHosts: [...zone.allowedHosts],\n\t\t\tenvironment: {\n\t\t\t\tHOME: '/home/coder',\n\t\t\t\tCONTROLLER_BASE_URL: 'http://controller.vm.host:18800',\n\t\t\t\tNODE_EXTRA_CA_CERTS: '/run/gondolin/ca-certificates.crt',\n\t\t\t\tAGENT_VM_ZONE_ID: zone.id,\n\t\t\t\tSTATE_DIR: '/state',\n\t\t\t\tWORKER_CONFIG_PATH: '/state/effective-worker.json',\n\t\t\t\tWORKSPACE_DIR: '/workspace',\n\t\t\t\t...environmentSecrets,\n\t\t\t},\n\t\t\tmediatedSecrets,\n\t\t\trootfsMode: 'cow',\n\t\t\tsessionLabel: buildGatewaySessionLabel(projectNamespace, zone.id),\n\t\t\ttcpHosts: {\n\t\t\t\t'controller.vm.host:18800': `127.0.0.1:${controllerPort}`,\n\t\t\t},\n\t\t\tvfsMounts: {\n\t\t\t\t'/state': {\n\t\t\t\t\thostPath: zone.gateway.stateDir,\n\t\t\t\t\tkind: 'realfs',\n\t\t\t\t},\n\t\t\t\t'/workspace': {\n\t\t\t\t\thostPath: zone.gateway.workspaceDir,\n\t\t\t\t\tkind: 'realfs',\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t},\n\n\tbuildProcessSpec(): GatewayProcessSpec {\n\t\treturn {\n\t\t\tbootstrapCommand:\n\t\t\t\t'if [ -f /state/agent-vm-worker.tgz ]; then npm install -g --force @openai/codex /state/agent-vm-worker.tgz; fi',\n\t\t\tstartCommand:\n\t\t\t\t'cd /workspace && nohup agent-vm-worker serve --port 18789 --config /state/effective-worker.json --state-dir /state > /tmp/agent-vm-worker.log 2>&1 &',\n\t\t\thealthCheck: { type: 'http', port: 18789, path: '/health' },\n\t\t\tguestListenPort: 18789,\n\t\t\tlogPath: '/tmp/agent-vm-worker.log',\n\t\t};\n\t},\n};\n"],"mappings":";;;AAQA,MAAaA,kBAAoC;CAChD,YAAY,EACX,gBACA,kBACA,iBACA,QAC4C;EAC5C,MAAM,EAAE,oBAAoB,oBAAoB,4BAC/C,MACA,gBACA;AAED,SAAO;GACN,cAAc,CAAC,GAAG,KAAK,aAAa;GACpC,aAAa;IACZ,MAAM;IACN,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB,KAAK;IACvB,WAAW;IACX,oBAAoB;IACpB,eAAe;IACf,GAAG;IACH;GACD;GACA,YAAY;GACZ,cAAc,yBAAyB,kBAAkB,KAAK,GAAG;GACjE,UAAU,EACT,4BAA4B,aAAa,kBACzC;GACD,WAAW;IACV,UAAU;KACT,UAAU,KAAK,QAAQ;KACvB,MAAM;KACN;IACD,cAAc;KACb,UAAU,KAAK,QAAQ;KACvB,MAAM;KACN;IACD;GACD;;CAGF,mBAAuC;AACtC,SAAO;GACN,kBACC;GACD,cACC;GACD,aAAa;IAAE,MAAM;IAAQ,MAAM;IAAO,MAAM;IAAW;GAC3D,iBAAiB;GACjB,SAAS;GACT;;CAEF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-vm/worker-gateway",
|
|
3
|
+
"version": "0.0.20",
|
|
4
|
+
"description": "Worker gateway lifecycle: boots a Gondolin VM and drives @agent-vm/agent-vm-worker for autonomous coding tasks.",
|
|
5
|
+
"homepage": "https://github.com/ShravanSunder/agent-vm#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/ShravanSunder/agent-vm/issues"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Shravan Sunder <ShravanSunder@users.noreply.github.com>",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/ShravanSunder/agent-vm.git",
|
|
14
|
+
"directory": "packages/worker-gateway"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@agent-vm/gateway-interface": "0.0.20",
|
|
33
|
+
"@agent-vm/gondolin-adapter": "0.0.20"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
38
|
+
}
|
|
39
|
+
}
|