@agent-vm/worker-gateway 0.0.30 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +40 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -13
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,15 @@ type GatewayType = (typeof gatewayTypeValues)[number];
|
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region ../gondolin-adapter/dist/index.d.ts
|
|
7
7
|
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/pinned-realfs.d.ts
|
|
10
|
+
interface PinnedRealFsRoot {
|
|
11
|
+
readonly hostPath: string;
|
|
12
|
+
readonly realPath: string;
|
|
13
|
+
readonly fd: number;
|
|
14
|
+
readonly device: number;
|
|
15
|
+
readonly inode: number;
|
|
16
|
+
}
|
|
8
17
|
//#endregion
|
|
9
18
|
//#region src/types.d.ts
|
|
10
19
|
interface SecretSpec {
|
|
@@ -28,6 +37,7 @@ interface SecretResolver {
|
|
|
28
37
|
interface VfsMountSpec {
|
|
29
38
|
readonly kind: 'realfs' | 'realfs-readonly' | 'memory' | 'shadow';
|
|
30
39
|
readonly hostPath?: string;
|
|
40
|
+
readonly pinnedHostRoot?: PinnedRealFsRoot;
|
|
31
41
|
readonly shadowConfig?: {
|
|
32
42
|
readonly deny: readonly string[];
|
|
33
43
|
readonly tmpfs: readonly string[];
|
|
@@ -90,28 +100,41 @@ interface GatewayAuthConfig {
|
|
|
90
100
|
readonly setDefault?: boolean;
|
|
91
101
|
}) => string;
|
|
92
102
|
}
|
|
103
|
+
interface GatewayAuthProfilesRef {
|
|
104
|
+
readonly source: '1password' | 'environment';
|
|
105
|
+
}
|
|
106
|
+
interface OnePasswordGatewayAuthProfilesRef extends GatewayAuthProfilesRef {
|
|
107
|
+
readonly source: '1password';
|
|
108
|
+
readonly ref: string;
|
|
109
|
+
}
|
|
110
|
+
interface EnvironmentGatewayAuthProfilesRef extends GatewayAuthProfilesRef {
|
|
111
|
+
readonly source: 'environment';
|
|
112
|
+
readonly envVar: string;
|
|
113
|
+
}
|
|
114
|
+
interface GatewayZoneBaseGatewayConfig {
|
|
115
|
+
readonly type: GatewayType;
|
|
116
|
+
readonly memory: string;
|
|
117
|
+
readonly cpus: number;
|
|
118
|
+
readonly port: number;
|
|
119
|
+
readonly config: string;
|
|
120
|
+
readonly stateDir: string;
|
|
121
|
+
readonly authProfilesRef?: OnePasswordGatewayAuthProfilesRef | EnvironmentGatewayAuthProfilesRef | undefined;
|
|
122
|
+
}
|
|
123
|
+
interface OpenClawGatewayZoneGatewayConfig extends GatewayZoneBaseGatewayConfig {
|
|
124
|
+
readonly type: 'openclaw';
|
|
125
|
+
readonly zoneFilesDir: string;
|
|
126
|
+
}
|
|
127
|
+
interface WorkerGatewayZoneGatewayConfig extends GatewayZoneBaseGatewayConfig {
|
|
128
|
+
readonly type: 'worker';
|
|
129
|
+
}
|
|
130
|
+
type GatewayZoneGatewayConfig = OpenClawGatewayZoneGatewayConfig | WorkerGatewayZoneGatewayConfig;
|
|
93
131
|
/**
|
|
94
132
|
* Zone config as the lifecycle sees it.
|
|
95
133
|
* Decoupled from SystemConfig — the controller maps into this shape.
|
|
96
134
|
*/
|
|
97
135
|
interface GatewayZoneConfig {
|
|
98
136
|
readonly id: string;
|
|
99
|
-
readonly gateway:
|
|
100
|
-
readonly type: GatewayType;
|
|
101
|
-
readonly memory: string;
|
|
102
|
-
readonly cpus: number;
|
|
103
|
-
readonly port: number;
|
|
104
|
-
readonly config: string;
|
|
105
|
-
readonly stateDir: string;
|
|
106
|
-
readonly workspaceDir: string;
|
|
107
|
-
readonly authProfilesRef?: {
|
|
108
|
-
readonly source: '1password';
|
|
109
|
-
readonly ref: string;
|
|
110
|
-
} | {
|
|
111
|
-
readonly source: 'environment';
|
|
112
|
-
readonly envVar: string;
|
|
113
|
-
} | undefined;
|
|
114
|
-
};
|
|
137
|
+
readonly gateway: GatewayZoneGatewayConfig;
|
|
115
138
|
readonly secrets: Record<string, {
|
|
116
139
|
readonly source: '1password';
|
|
117
140
|
readonly ref: string;
|
|
@@ -129,6 +152,7 @@ interface GatewayZoneConfig {
|
|
|
129
152
|
}
|
|
130
153
|
interface BuildGatewayVmSpecOptions {
|
|
131
154
|
readonly controllerPort: number;
|
|
155
|
+
readonly gatewayCacheDir: string;
|
|
132
156
|
readonly projectNamespace: string;
|
|
133
157
|
readonly resolvedSecrets: Record<string, string>;
|
|
134
158
|
readonly tcpPool: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +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, options?: {\n readonly deviceCode?: boolean;\n readonly setDefault?: boolean;\n }) => string;\n}\
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["gatewayTypeValues","GatewayType","buildGatewaySessionLabel","buildToolSessionLabel","PinnedRealFsRoot","SecretSpec","SecretRef","SecretResolver","Promise","Record","VfsMountSpec","GatewayHealthCheck","GatewayProcessSpec","GatewayVmSpec","GatewayAuthConfig","GatewayAuthProfilesRef","OnePasswordGatewayAuthProfilesRef","EnvironmentGatewayAuthProfilesRef","GatewayZoneBaseGatewayConfig","OpenClawGatewayZoneGatewayConfig","WorkerGatewayZoneGatewayConfig","GatewayZoneGatewayConfig","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/pinned-realfs.d.ts\ninterface PinnedRealFsRoot {\n readonly hostPath: string;\n readonly realPath: string;\n readonly fd: number;\n readonly device: number;\n readonly inode: number;\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 pinnedHostRoot?: PinnedRealFsRoot;\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, options?: {\n readonly deviceCode?: boolean;\n readonly setDefault?: boolean;\n }) => string;\n}\ninterface GatewayAuthProfilesRef {\n readonly source: '1password' | 'environment';\n}\ninterface OnePasswordGatewayAuthProfilesRef extends GatewayAuthProfilesRef {\n readonly source: '1password';\n readonly ref: string;\n}\ninterface EnvironmentGatewayAuthProfilesRef extends GatewayAuthProfilesRef {\n readonly source: 'environment';\n readonly envVar: string;\n}\ninterface GatewayZoneBaseGatewayConfig {\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 authProfilesRef?: OnePasswordGatewayAuthProfilesRef | EnvironmentGatewayAuthProfilesRef | undefined;\n}\ninterface OpenClawGatewayZoneGatewayConfig extends GatewayZoneBaseGatewayConfig {\n readonly type: 'openclaw';\n readonly zoneFilesDir: string;\n}\ninterface WorkerGatewayZoneGatewayConfig extends GatewayZoneBaseGatewayConfig {\n readonly type: 'worker';\n}\ntype GatewayZoneGatewayConfig = OpenClawGatewayZoneGatewayConfig | WorkerGatewayZoneGatewayConfig;\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: GatewayZoneGatewayConfig;\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 gatewayCacheDir: string;\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;AAiBxB;AAIN;;;;UAbJI,gBAAAA,CAyBSK;EAAoCA,SAAAA,QAAAA,EAAAA,MAAAA;EAARD,SAAAA,QAAAA,EAAAA,MAAAA;EAAO,SAAA,EAAA,EAAA,MAAA;EAAA,SAE5CE,MAAAA,EAAY,MAAA;EAGsB,SAQvCC,KAAAA,EAAAA,MAAAA;AAAkB;AAemB;;UA5ChCN,UAAAA,CAwD2BK;EAAfD,SAAAA,KAAAA,EAAAA,SAAAA,MAAAA,EAAAA;EACqBJ,SAAAA,KAAAA,EAAAA,MAAAA;;KArDtCC,SAAAA,GAsDgBG;EAAM,SAAA,MAAA,EAAA,WAAA;EAAA,SAWjBK,GAAAA,EAAAA,MAAAA;AAAiB,CAAA,GAejBC;EAAsB,SAGtBC,MAAAA,EAAAA,aAAAA;EAAgE,SAIhEC,GAAAA,EAAAA,MAAAA;AAAgE,CAAA;;;;UA7EhEV,cAAAA,CAwFwF;EAAA,OAExFY,CAAAA,GAAAA,EAzFKb,SAyFLa,CAAAA,EAzFiBX,OAyFjBW,CAAAA,MAAgC,CAAA;EAAqC,UAIrEC,CAAAA,IAAAA,EA5FSX,MA4FTW,CAAAA,MAAAA,EA5FwBd,SA4FM,CAAA,CAAA,EA5FOE,OA4FEU,CA5FMT,MA4FNS,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA,CAA4B;AAAA;AAGoB,UA7FvFR,YAAAA,CAkGAY;EAGgB,SAehBC,IAAAA,EAAAA,QAAAA,GAAAA,iBAIkBd,GAAAA,QAKXa,GAAAA,QAAAA;EAAiB,SAExBE,QAAAA,CAAAA,EAAAA,MAAgB;EAKFV,SAAAA,cAAAA,CAAAA,EAjIIV,gBAiIJU;EAKDS,SAAAA,YAAAA,CAAAA,EAAAA;IAA4BV,SAAAA,IAAAA,EAAAA,SAAAA,MAAAA,EAAAA;IAK1BS,SAAAA,KAAAA,EAAAA,SAAAA,MAAAA,EAAAA;EAAoCb,CAAAA;;;;KAnIxDE,kBAAAA,GAwIyEH;EAAO,SAAA,IAAA,EAAA,MAAA;;;;EChLrF,SAAa,IAAA,EAAA,SA6DZ;;;;;;;UDTSI,kBAAAA;;;wBAGcD;;;;;;;;;;UAUdE,aAAAA;wBACcJ;sBACFA,eAAeC;4BACTD,eAAeJ;qBACtBI;;;;;;;;;;;UAWXK,iBAAAA;;;;;;;;;;;;;;;UAeAC,sBAAAA;;;UAGAC,iCAAAA,SAA0CD;;;;UAI1CE,iCAAAA,SAA0CF;;;;UAI1CG,4BAAAA;iBACOjB;;;;;;6BAMYe,oCAAoCC;;UAEvDE,gCAAAA,SAAyCD;;;;UAIzCE,8BAAAA,SAAuCF;;;KAG5CG,wBAAAA,GAA2BF,mCAAmCC;;;;;UAKzDE,iBAAAA;;oBAEUD;oBACAZ;;;;;;;;;;;;;;;UAeVc,yBAAAA;;;;4BAIkBd;;;;;iBAKXa;;UAEPE,gBAAAA;;;;;wBAKcV;;;;;uBAKDS,4BAA4BV;;;;;yBAK1BS,oCAAoCb,yBAAyBG;;;;;0BAK5DU,mCAAmCf,iBAAiBC;;;;;;AAvLhER,cCOD,eDPmD,ECOlC,gBDPkC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { buildGatewaySessionLabel, splitResolvedGatewaySecrets } from "@agent-vm
|
|
|
3
3
|
//#region src/worker-lifecycle.ts
|
|
4
4
|
const workerLifecycle = {
|
|
5
5
|
buildVmSpec({ controllerPort, projectNamespace, resolvedSecrets, zone }) {
|
|
6
|
+
if (zone.gateway.type !== "worker") throw new Error(`Worker lifecycle cannot build gateway type '${zone.gateway.type}'.`);
|
|
6
7
|
const { environmentSecrets, mediatedSecrets } = splitResolvedGatewaySecrets(zone, resolvedSecrets);
|
|
7
8
|
return {
|
|
8
9
|
allowedHosts: [...zone.allowedHosts],
|
|
@@ -13,29 +14,31 @@ const workerLifecycle = {
|
|
|
13
14
|
AGENT_VM_ZONE_ID: zone.id,
|
|
14
15
|
STATE_DIR: "/state",
|
|
15
16
|
WORKER_CONFIG_PATH: "/state/effective-worker.json",
|
|
16
|
-
|
|
17
|
+
WORK_DIR: "/work",
|
|
18
|
+
REPOS_DIR: "/work/repos",
|
|
19
|
+
TMPDIR: "/work/tmp",
|
|
20
|
+
TMP: "/work/tmp",
|
|
21
|
+
TEMP: "/work/tmp",
|
|
22
|
+
npm_config_cache: "/work/cache/npm",
|
|
23
|
+
pnpm_config_store_dir: "/work/cache/pnpm/store",
|
|
24
|
+
PIP_CACHE_DIR: "/work/cache/pip",
|
|
25
|
+
UV_CACHE_DIR: "/work/cache/uv",
|
|
17
26
|
...environmentSecrets
|
|
18
27
|
},
|
|
19
28
|
mediatedSecrets,
|
|
20
29
|
rootfsMode: "cow",
|
|
21
30
|
sessionLabel: buildGatewaySessionLabel(projectNamespace, zone.id),
|
|
22
31
|
tcpHosts: { "controller.vm.host:18800": `127.0.0.1:${controllerPort}` },
|
|
23
|
-
vfsMounts: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
},
|
|
28
|
-
"/workspace": {
|
|
29
|
-
hostPath: zone.gateway.workspaceDir,
|
|
30
|
-
kind: "realfs"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
32
|
+
vfsMounts: { "/state": {
|
|
33
|
+
hostPath: zone.gateway.stateDir,
|
|
34
|
+
kind: "realfs"
|
|
35
|
+
} }
|
|
33
36
|
};
|
|
34
37
|
},
|
|
35
38
|
buildProcessSpec() {
|
|
36
39
|
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 /
|
|
40
|
+
bootstrapCommand: "mkdir -p /work/repos /work/tmp /work/cache/npm /work/cache/pnpm/store /work/cache/pip /work/cache/uv && if [ -f /state/agent-vm-worker.tgz ]; then npm install -g --force @openai/codex /state/agent-vm-worker.tgz; fi",
|
|
41
|
+
startCommand: "cd /work && nohup agent-vm-worker serve --port 18789 --config /state/effective-worker.json --state-dir /state > /tmp/agent-vm-worker.log 2>&1 &",
|
|
39
42
|
healthCheck: {
|
|
40
43
|
type: "http",
|
|
41
44
|
port: 18789,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +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\
|
|
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\tif (zone.gateway.type !== 'worker') {\n\t\t\tthrow new Error(`Worker lifecycle cannot build gateway type '${zone.gateway.type}'.`);\n\t\t}\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\tWORK_DIR: '/work',\n\t\t\t\tREPOS_DIR: '/work/repos',\n\t\t\t\tTMPDIR: '/work/tmp',\n\t\t\t\tTMP: '/work/tmp',\n\t\t\t\tTEMP: '/work/tmp',\n\t\t\t\tnpm_config_cache: '/work/cache/npm',\n\t\t\t\tpnpm_config_store_dir: '/work/cache/pnpm/store',\n\t\t\t\tPIP_CACHE_DIR: '/work/cache/pip',\n\t\t\t\tUV_CACHE_DIR: '/work/cache/uv',\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},\n\t\t};\n\t},\n\n\tbuildProcessSpec(): GatewayProcessSpec {\n\t\treturn {\n\t\t\tbootstrapCommand:\n\t\t\t\t'mkdir -p /work/repos /work/tmp /work/cache/npm /work/cache/pnpm/store /work/cache/pip /work/cache/uv && 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 /work && 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;AAC5C,MAAI,KAAK,QAAQ,SAAS,SACzB,OAAM,IAAI,MAAM,+CAA+C,KAAK,QAAQ,KAAK,IAAI;EAEtF,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,UAAU;IACV,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,cAAc;IACd,GAAG;IACH;GACD;GACA,YAAY;GACZ,cAAc,yBAAyB,kBAAkB,KAAK,GAAG;GACjE,UAAU,EACT,4BAA4B,aAAa,kBACzC;GACD,WAAW,EACV,UAAU;IACT,UAAU,KAAK,QAAQ;IACvB,MAAM;IACN,EACD;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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-vm/worker-gateway",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "Worker gateway lifecycle: boots a Gondolin VM and drives @agent-vm/agent-vm-worker for autonomous coding tasks.",
|
|
5
5
|
"homepage": "https://github.com/ShravanSunder/agent-vm#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@agent-vm/gateway-interface": "0.0.
|
|
33
|
-
"@agent-vm/gondolin-adapter": "0.0.
|
|
32
|
+
"@agent-vm/gateway-interface": "0.0.32",
|
|
33
|
+
"@agent-vm/gondolin-adapter": "0.0.32"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|