@task-handoff/node-agent 0.0.46 → 0.0.47

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.
@@ -5,6 +5,7 @@ set -euo pipefail
5
5
  # the image and selected through the atomic `current` symlink.
6
6
  readonly runtime_root="${TASK_HANDOFF_INSTANCE_RUNTIME_ROOT:-/opt/task-handoff/instance-runtime}"
7
7
  readonly current="${runtime_root}/current"
8
+ readonly script_dir="$(CDPATH= cd -- "$(dirname "$0")" && pwd)"
8
9
 
9
10
  bootstrap_wait() {
10
11
  echo "No controlled-instance runtime is active; waiting for node-agent bootstrap."
@@ -28,22 +29,4 @@ fi
28
29
  # release. Keep this process and every child on a directory that survives release cleanup.
29
30
  cd -- "${runtime_root}"
30
31
 
31
- exec node --input-type=module - "${current}" <<'NODE'
32
- import fs from "node:fs";
33
- import path from "node:path";
34
- import { pathToFileURL } from "node:url";
35
-
36
- const current = process.argv[2];
37
- const releaseRoot = fs.realpathSync(current);
38
- const manifestPath = path.join(releaseRoot, "runtime-manifest.json");
39
- const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
40
- if (manifest.packageName !== "@task-handoff/controlled-instance" || typeof manifest.entrypoint !== "string") {
41
- throw new Error("Active controlled-instance runtime manifest is invalid.");
42
- }
43
- const entrypoint = path.resolve(releaseRoot, manifest.entrypoint);
44
- if (!entrypoint.startsWith(`${releaseRoot}${path.sep}`) || !fs.statSync(entrypoint).isFile()) {
45
- throw new Error("Active controlled-instance runtime entrypoint is invalid.");
46
- }
47
- process.argv = [process.execPath, entrypoint, "web", "--host", process.env.TASK_HANDOFF_WEB_HOST || "0.0.0.0", "--port", process.env.TASK_HANDOFF_WEB_PORT || "8080"];
48
- await import(pathToFileURL(entrypoint).href);
49
- NODE
32
+ exec "${script_dir}/js-runtime.sh" "${script_dir}/instance-launcher.mjs" "${current}"
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+ set -eu
3
+
4
+ # Select the JavaScript runtime used by TaskHandoff helper scripts. The helper
5
+ # runs in its own environment, so it detects an available runtime unless the
6
+ # caller explicitly overrides one.
7
+ runtime="${TASK_HANDOFF_JS_RUNTIME:-auto}"
8
+ if [ -n "${TASK_HANDOFF_JS_RUNTIME_BIN:-}" ]; then
9
+ exec "${TASK_HANDOFF_JS_RUNTIME_BIN}" "$@"
10
+ fi
11
+
12
+ case "${runtime}" in
13
+ auto)
14
+ if command -v node >/dev/null 2>&1; then
15
+ exec node "$@"
16
+ fi
17
+ if command -v bun >/dev/null 2>&1; then
18
+ exec bun "$@"
19
+ fi
20
+ ;;
21
+ node)
22
+ if command -v node >/dev/null 2>&1; then
23
+ exec node "$@"
24
+ fi
25
+ ;;
26
+ bun)
27
+ if command -v bun >/dev/null 2>&1; then
28
+ exec bun "$@"
29
+ fi
30
+ ;;
31
+ *)
32
+ echo "TASK_HANDOFF_JS_RUNTIME must be auto, node, or bun." >&2
33
+ exit 64
34
+ ;;
35
+ esac
36
+
37
+ echo "JavaScript runtime '${runtime}' is not available (set TASK_HANDOFF_JS_RUNTIME_BIN to override)." >&2
38
+ exit 69
@@ -0,0 +1,18 @@
1
+ import fs from "node:fs";
2
+
3
+ const value = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
4
+ if (value.version !== 1 || typeof value.instanceId !== "string" || !value.instanceId || typeof value.instanceCredential !== "string" || !value.instanceCredential) process.exit(78);
5
+ const configured = value.environment === undefined ? {} : value.environment;
6
+ if (!configured || typeof configured !== "object" || Array.isArray(configured)) process.exit(78);
7
+ const environment = {
8
+ ...configured,
9
+ TASK_HANDOFF_REGISTRATION_TOKEN: value.instanceCredential,
10
+ TASK_HANDOFF_PRIVATE_CONFIG_LOADED: "1",
11
+ TASK_HANDOFF_INSTANCE_PRIVATE_CONFIG_PATH: process.argv[2],
12
+ };
13
+ if (value.modelCatalog !== undefined) environment.TASK_HANDOFF_PRIVATE_MODEL_CATALOG_JSON = JSON.stringify(value.modelCatalog);
14
+ if (value.codexSettings !== undefined) environment.TASK_HANDOFF_PRIVATE_CODEX_SETTINGS_JSON = JSON.stringify(value.codexSettings);
15
+ for (const [key, item] of Object.entries(environment)) {
16
+ if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key) || typeof item !== "string") process.exit(78);
17
+ process.stdout.write(`${key}\t${Buffer.from(item).toString("base64")}\n`);
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@task-handoff/node-agent",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "description": "Prebuilt TaskHandoff node agent runtime.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,8 @@
33
33
  "NOTICE"
34
34
  ],
35
35
  "engines": {
36
- "node": ">=24.15.0 <25"
36
+ "node": ">=24.15.0",
37
+ "bun": ">=1.4.4"
37
38
  },
38
39
  "dependencies": {
39
40
  "@fastify/cookie": "11.1.1",
@@ -51,9 +52,9 @@
51
52
  "tar": "7.5.20",
52
53
  "telegramify-markdown": "1.3.3",
53
54
  "tweetnacl": "1.0.3",
54
- "write-file-atomic": "8.0.0",
55
+ "write-file-atomic": "7.0.1",
55
56
  "ws": "8.21.0",
56
- "zod": "4.4.3"
57
+ "zod": "4.6.7"
57
58
  },
58
59
  "bundledDependencies": [
59
60
  "node-pty"
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "packageName": "@task-handoff/controlled-instance",
3
- "version": "0.0.46",
3
+ "version": "0.0.47",
4
4
  "platform": "linux",
5
5
  "arch": "universal",
6
6
  "formatVersion": 1,
7
7
  "launcherAbi": 1,
8
8
  "entrypoint": "dist/controlled-instance-cli.js",
9
- "sha256": "793c97ab971156665818c1421f564ceabd2db5a29909c77ff994c98c765d44ca"
9
+ "sha256": "32670b4607f9a761a3f027e87f35bfb029d9f1da64e29b63a7f614adcb194dc6"
10
10
  }
@@ -0,0 +1 @@
1
+ da5da5404ed91003c4abd8ba9f7dbba48e31f1dbaf6163410dc27d7bc1de414a controlled-instance-runtime-0.0.47-linux-universal.tar.gz
@@ -1 +0,0 @@
1
- a076ab7f961c9b773e1e8bbdc4c24495e56218d334dc8b82ac409be7a92afd62 controlled-instance-runtime-0.0.46-linux-universal.tar.gz