@jabezpauls/agentbox 0.1.6 → 0.1.9

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 (2) hide show
  1. package/dist/agentbox.mjs +29 -4
  2. package/package.json +3 -1
package/dist/agentbox.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // agentbox-cli v0.1.6
2
+ // agentbox-cli v0.1.9
3
3
  import { createRequire as __agentboxCreateRequire } from "node:module";
4
4
  const require = __agentboxCreateRequire(import.meta.url);
5
5
  var __create = Object.create;
@@ -3868,7 +3868,8 @@ function parseSize(raw) {
3868
3868
  }
3869
3869
 
3870
3870
  // src/version.ts
3871
- var VERSION = true ? "v0.1.6" : "0.0.0-dev";
3871
+ var VERSION = true ? "v0.1.9" : "0.0.0-dev";
3872
+ var STANDALONE = typeof __AGENTBOX_STANDALONE__ === "boolean" && __AGENTBOX_STANDALONE__;
3872
3873
  var MIN_NODE_MAJOR = 20;
3873
3874
  function nodeMajor(version = process.versions.node) {
3874
3875
  return Number(version.split(".")[0]);
@@ -7974,6 +7975,7 @@ var TERMINAL_COMMANDS = [attach, shell];
7974
7975
  import { spawnSync as spawnSync2 } from "node:child_process";
7975
7976
  import { randomBytes as randomBytes4 } from "node:crypto";
7976
7977
  import fs10 from "node:fs";
7978
+ import os9 from "node:os";
7977
7979
  import path11 from "node:path";
7978
7980
  var MAX_BUNDLE = 16 * 1024 * 1024;
7979
7981
  function bundleVersion(bundle) {
@@ -8008,6 +8010,27 @@ function npmVersionFor(boxVersion) {
8008
8010
  const m = /^v?(\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?)$/.exec(boxVersion ?? "");
8009
8011
  return m ? m[1] : "latest";
8010
8012
  }
8013
+ function nodeCredentials(env, platform = process.platform) {
8014
+ const candidates = [];
8015
+ if (platform === "win32") {
8016
+ if (env.LOCALAPPDATA && path11.win32.isAbsolute(env.LOCALAPPDATA)) candidates.push(path11.join(env.LOCALAPPDATA, "agentbox", "node", "credentials.json"));
8017
+ } else {
8018
+ const xdg = env.XDG_DATA_HOME;
8019
+ if (xdg && path11.isAbsolute(xdg)) candidates.push(path11.join(xdg, "agentbox", "node", "credentials.json"));
8020
+ candidates.push(path11.join(env.HOME || os9.homedir(), ".local", "share", "agentbox", "node", "credentials.json"));
8021
+ }
8022
+ return candidates.find((f) => fs10.existsSync(f)) ?? null;
8023
+ }
8024
+ function signedUpdatesOnly(env, platform = process.platform, standalone = STANDALONE) {
8025
+ const creds = nodeCredentials(env, platform);
8026
+ if (creds) {
8027
+ return `this machine is joined to a box as a node (${creds}), so agentbox here updates only from signed releases, never from a box: the node checks for them itself (\`updates\` in its policy.json), or see https://github.com/jabezpauls/agentbox/releases`;
8028
+ }
8029
+ if (standalone) {
8030
+ return "this is the standalone agentbox, which updates only from signed releases, never from a box; download the latest from https://github.com/jabezpauls/agentbox/releases";
8031
+ }
8032
+ return null;
8033
+ }
8011
8034
  var update = command({
8012
8035
  path: ["update"],
8013
8036
  summary: "replace this CLI with the box's own build",
@@ -8018,6 +8041,8 @@ var update = command({
8018
8041
  ],
8019
8042
  details: "Downloads /cli/agentbox.mjs from the box (the current one, or --box), checks it runs, and swaps it in\nin one step.",
8020
8043
  async run(ctx, p) {
8044
+ const signedOnly = signedUpdatesOnly(ctx.env, ctx.platform);
8045
+ if (signedOnly) throw new CliError(signedOnly);
8021
8046
  const { name, box } = ctx.selected();
8022
8047
  const self = selfInstall(process.argv[1]);
8023
8048
  if (!self) throw new CliError("cannot tell which file this CLI runs from");
@@ -8166,7 +8191,7 @@ function groupHelp(prefix) {
8166
8191
  }
8167
8192
 
8168
8193
  // src/context.ts
8169
- import os9 from "node:os";
8194
+ import os10 from "node:os";
8170
8195
  var VERSION_CHECK_MS = 24 * 60 * 6e4;
8171
8196
  var Context = class {
8172
8197
  constructor(io, env, config, globals, platform = process.platform, now = Date.now) {
@@ -8224,7 +8249,7 @@ var Context = class {
8224
8249
  }
8225
8250
  /** Where temporary files go: `$TMPDIR` (or Windows' `%TEMP%`), else the system's. */
8226
8251
  tempRoot() {
8227
- return this.env.TMPDIR || this.env.TEMP || this.env.TMP || os9.tmpdir();
8252
+ return this.env.TMPDIR || this.env.TEMP || this.env.TMP || os10.tmpdir();
8228
8253
  }
8229
8254
  printJson(value) {
8230
8255
  this.out(`${JSON.stringify(value, null, 2)}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jabezpauls/agentbox",
3
3
  "type": "module",
4
- "version": "0.1.6",
4
+ "version": "0.1.9",
5
5
  "description": "agentbox from your own machine: sign in, attach, move files, mount the workspace.",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/jabezpauls/agentbox/blob/main/docs/cli.md",
@@ -35,6 +35,7 @@
35
35
  },
36
36
  "scripts": {
37
37
  "build": "node scripts/build.mjs",
38
+ "build:sea": "node scripts/build-sea.mjs",
38
39
  "e2e": "node e2e/run.mjs",
39
40
  "prepack": "node scripts/build.mjs",
40
41
  "test": "vitest run",
@@ -46,6 +47,7 @@
46
47
  "@types/ws": "^8",
47
48
  "esbuild": "^0.28",
48
49
  "eslint": "^9",
50
+ "postject": "1.0.0-alpha.6",
49
51
  "typescript": "^5.6",
50
52
  "typescript-eslint": "^8",
51
53
  "vitest": "^2",