@agent-vm/worker-gateway 0.0.102 → 0.0.104
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.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/worker-lifecycle.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/worker-lifecycle.ts"],"mappings":";;;cAgBa,eAAA,EAAiB,gBAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildGatewaySessionLabel, composeNodeOptions, controllerVmHost, gatewayVmAllowedHosts, splitResolvedGatewaySecrets } from "@agent-vm/gateway-interface";
|
|
2
2
|
//#region src/worker-lifecycle.ts
|
|
3
|
+
const workerGatewayGuestPath = "/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
|
|
3
4
|
const workerLifecycle = {
|
|
4
5
|
buildVmSpec({ controllerPort, projectNamespace, resolvedSecrets, zone }) {
|
|
5
6
|
if (zone.gateway.type !== "worker") throw new Error(`Worker lifecycle cannot build gateway type '${zone.gateway.type}'.`);
|
|
@@ -11,6 +12,8 @@ const workerLifecycle = {
|
|
|
11
12
|
CONTROLLER_BASE_URL: "http://controller.vm.host:18800",
|
|
12
13
|
NODE_EXTRA_CA_CERTS: "/run/gondolin/ca-certificates.crt",
|
|
13
14
|
AGENT_VM_ZONE_ID: zone.id,
|
|
15
|
+
PATH: workerGatewayGuestPath,
|
|
16
|
+
PNPM_HOME: "/pnpm",
|
|
14
17
|
STATE_DIR: "/state",
|
|
15
18
|
WORKER_CONFIG_PATH: "/state/effective-worker.json",
|
|
16
19
|
WORK_DIR: "/work",
|
|
@@ -38,8 +41,8 @@ const workerLifecycle = {
|
|
|
38
41
|
},
|
|
39
42
|
buildProcessSpec() {
|
|
40
43
|
return {
|
|
41
|
-
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
|
|
42
|
-
startCommand: `{ printf 'worker-boot: NODE_OPTIONS=%s\\n' "$NODE_OPTIONS" > /tmp/agent-vm-worker.log; } && cd /work && nohup agent-vm-worker serve --port 18789 --config /state/effective-worker.json --state-dir /state >> /tmp/agent-vm-worker.log 2>&1 &`,
|
|
44
|
+
bootstrapCommand: "export PNPM_HOME=/pnpm PATH=/pnpm:$PATH && 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 pnpm add -g --ignore-scripts /state/agent-vm-worker.tgz && worker_package_root=\"$(pnpm root -g --silent)\" && worker_bin_target=\"$worker_package_root/@agent-vm/agent-vm-worker/dist/main.js\" && test -f \"$worker_bin_target\" && chmod 755 \"$worker_bin_target\" && ln -sfn \"$worker_bin_target\" /pnpm/agent-vm-worker; fi",
|
|
45
|
+
startCommand: `export PNPM_HOME=/pnpm PATH=/pnpm:$PATH && { printf 'worker-boot: NODE_OPTIONS=%s\\n' "$NODE_OPTIONS" > /tmp/agent-vm-worker.log; } && cd /work && nohup agent-vm-worker serve --port 18789 --config /state/effective-worker.json --state-dir /state >> /tmp/agent-vm-worker.log 2>&1 &`,
|
|
43
46
|
healthCheck: {
|
|
44
47
|
type: "http",
|
|
45
48
|
port: 18789,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/worker-lifecycle.ts"],"sourcesContent":["import type {\n\tBuildGatewayVmSpecOptions,\n\tGatewayLifecycle,\n\tGatewayProcessSpec,\n\tGatewayVmSpec,\n} from '@agent-vm/gateway-interface';\nimport {\n\tbuildGatewaySessionLabel,\n\tcomposeNodeOptions,\n\tcontrollerVmHost,\n\tgatewayVmAllowedHosts,\n\tsplitResolvedGatewaySecrets,\n} 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: gatewayVmAllowedHosts(zone.egressHosts),\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\t// NODE_OPTIONS goes AFTER the spread so a user-supplied\n\t\t\t\t// NODE_OPTIONS in environmentSecrets cannot drop the\n\t\t\t\t// forced IPv4-preference flags. composeNodeOptions\n\t\t\t\t// preserves the user value as additional flags.\n\t\t\t\tNODE_OPTIONS: composeNodeOptions(environmentSecrets.NODE_OPTIONS),\n\t\t\t},\n\t\t\tmediatedSecrets,\n\t\t\trootfsMode: 'cow',\n\t\t\t...(zone.gateway.runtimeRootfsSize\n\t\t\t\t? { runtimeRootfsSize: zone.gateway.runtimeRootfsSize }\n\t\t\t\t: {}),\n\t\t\tsessionLabel: buildGatewaySessionLabel(projectNamespace, zone.id),\n\t\t\ttcpHosts: {\n\t\t\t\t[`${controllerVmHost}: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
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/worker-lifecycle.ts"],"sourcesContent":["import type {\n\tBuildGatewayVmSpecOptions,\n\tGatewayLifecycle,\n\tGatewayProcessSpec,\n\tGatewayVmSpec,\n} from '@agent-vm/gateway-interface';\nimport {\n\tbuildGatewaySessionLabel,\n\tcomposeNodeOptions,\n\tcontrollerVmHost,\n\tgatewayVmAllowedHosts,\n\tsplitResolvedGatewaySecrets,\n} from '@agent-vm/gateway-interface';\n\nconst workerGatewayGuestPath = '/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin';\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: gatewayVmAllowedHosts(zone.egressHosts),\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\tPATH: workerGatewayGuestPath,\n\t\t\t\tPNPM_HOME: '/pnpm',\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\t// NODE_OPTIONS goes AFTER the spread so a user-supplied\n\t\t\t\t// NODE_OPTIONS in environmentSecrets cannot drop the\n\t\t\t\t// forced IPv4-preference flags. composeNodeOptions\n\t\t\t\t// preserves the user value as additional flags.\n\t\t\t\tNODE_OPTIONS: composeNodeOptions(environmentSecrets.NODE_OPTIONS),\n\t\t\t},\n\t\t\tmediatedSecrets,\n\t\t\trootfsMode: 'cow',\n\t\t\t...(zone.gateway.runtimeRootfsSize\n\t\t\t\t? { runtimeRootfsSize: zone.gateway.runtimeRootfsSize }\n\t\t\t\t: {}),\n\t\t\tsessionLabel: buildGatewaySessionLabel(projectNamespace, zone.id),\n\t\t\ttcpHosts: {\n\t\t\t\t[`${controllerVmHost}: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'export PNPM_HOME=/pnpm PATH=/pnpm:$PATH && 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 pnpm add -g --ignore-scripts /state/agent-vm-worker.tgz && worker_package_root=\"$(pnpm root -g --silent)\" && worker_bin_target=\"$worker_package_root/@agent-vm/agent-vm-worker/dist/main.js\" && test -f \"$worker_bin_target\" && chmod 755 \"$worker_bin_target\" && ln -sfn \"$worker_bin_target\" /pnpm/agent-vm-worker; fi',\n\t\t\t// printf NODE_OPTIONS into the boot log so an env-loss regression\n\t\t\t// is visible in the log stream without SSHing into the VM.\n\t\t\t// See FORCE_IPV4_EGRESS_NODE_OPTIONS in @agent-vm/gateway-interface.\n\t\t\tstartCommand: `export PNPM_HOME=/pnpm PATH=/pnpm:$PATH && { printf 'worker-boot: NODE_OPTIONS=%s\\\\n' \"$NODE_OPTIONS\" > /tmp/agent-vm-worker.log; } && 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\tserviceHealthCheck: { 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":";;AAcA,MAAM,yBAAyB;AAE/B,MAAa,kBAAoC;CAChD,YAAY,EACX,gBACA,kBACA,iBACA,QAC4C;EAC5C,IAAI,KAAK,QAAQ,SAAS,UACzB,MAAM,IAAI,MAAM,+CAA+C,KAAK,QAAQ,KAAK,IAAI;EAEtF,MAAM,EAAE,oBAAoB,oBAAoB,4BAC/C,MACA,gBACA;EAED,OAAO;GACN,cAAc,sBAAsB,KAAK,YAAY;GACrD,aAAa;IACZ,MAAM;IACN,qBAAqB;IACrB,qBAAqB;IACrB,kBAAkB,KAAK;IACvB,MAAM;IACN,WAAW;IACX,WAAW;IACX,oBAAoB;IACpB,UAAU;IACV,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,kBAAkB;IAClB,uBAAuB;IACvB,eAAe;IACf,cAAc;IACd,GAAG;IAKH,cAAc,mBAAmB,mBAAmB,aAAa;IACjE;GACD;GACA,YAAY;GACZ,GAAI,KAAK,QAAQ,oBACd,EAAE,mBAAmB,KAAK,QAAQ,mBAAmB,GACrD,EAAE;GACL,cAAc,yBAAyB,kBAAkB,KAAK,GAAG;GACjE,UAAU,GACR,GAAG,iBAAiB,UAAU,aAAa,kBAC5C;GACD,WAAW,EACV,UAAU;IACT,UAAU,KAAK,QAAQ;IACvB,MAAM;IACN,EACD;GACD;;CAGF,mBAAuC;EACtC,OAAO;GACN,kBACC;GAID,cAAc;GACd,aAAa;IAAE,MAAM;IAAQ,MAAM;IAAO,MAAM;IAAW;GAC3D,oBAAoB;IAAE,MAAM;IAAQ,MAAM;IAAO,MAAM;IAAW;GAClE,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.104",
|
|
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.104",
|
|
33
|
+
"@agent-vm/gondolin-adapter": "0.0.104"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsdown",
|