@jabezpauls/agentbox 0.1.0 → 0.1.1

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 +35 -6
  2. package/package.json +47 -11
package/dist/agentbox.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // agentbox-cli 0.1.0
2
+ // agentbox-cli v0.1.1
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,7 @@ function parseSize(raw) {
3868
3868
  }
3869
3869
 
3870
3870
  // src/version.ts
3871
- var VERSION = true ? "0.1.0" : "0.0.0-dev";
3871
+ var VERSION = true ? "v0.1.1" : "0.0.0-dev";
3872
3872
  var MIN_NODE_MAJOR = 20;
3873
3873
  function nodeMajor(version = process.versions.node) {
3874
3874
  return Number(version.split(".")[0]);
@@ -6570,7 +6570,7 @@ function splitCommand(s) {
6570
6570
  }
6571
6571
  var CMD_SAFE = /^[A-Za-z0-9 _.:\\()~-]+$/;
6572
6572
  function editorCommand(editor, file, platform, env = process.env) {
6573
- if (platform !== "win32") return { command: "/bin/sh", args: ["-c", `${editor} "$@"`, "sh", file], shell: false };
6573
+ if (platform !== "win32") return { command: "/bin/sh", args: ["-c", `trap : INT QUIT; ${editor} "$@"`, "sh", file], shell: false };
6574
6574
  const [first = "notepad", ...rest] = splitCommand(editor);
6575
6575
  const resolved = /[\\/]/.test(first) ? first : findOnPath(first, env, "win32") ?? first;
6576
6576
  if (!/\.(cmd|bat)$/i.test(resolved)) return { command: resolved, args: [...rest, file], shell: false };
@@ -7758,9 +7758,14 @@ function runTerminal(opts) {
7758
7758
  (signal, code2) => finish({ reason: "error", message: `interrupted (${signal})` }, code2),
7759
7759
  opts.onCrash ?? defaultCrash(stderr)
7760
7760
  );
7761
+ const held = [];
7762
+ const send = (data) => {
7763
+ if (started) session.input(data);
7764
+ else held.push(data);
7765
+ };
7761
7766
  const onInput = (chunk) => {
7762
7767
  const { forward: forward2, detach } = filter.push(typeof chunk === "string" ? Buffer.from(chunk) : chunk);
7763
- if (forward2.length) session.input(forward2);
7768
+ if (forward2.length) send(forward2);
7764
7769
  if (detach) session.detach();
7765
7770
  };
7766
7771
  const onResize = () => {
@@ -7776,6 +7781,7 @@ function runTerminal(opts) {
7776
7781
  function finish(ended, code2 = exitCodeFor(ended)) {
7777
7782
  if (done) return;
7778
7783
  done = true;
7784
+ if (fallback) clearTimeout(fallback);
7779
7785
  session.dispose();
7780
7786
  stdin.off?.("data", onInput);
7781
7787
  stdout.off?.("resize", onResize);
@@ -7789,14 +7795,37 @@ agentbox: ${message}\r
7789
7795
  `);
7790
7796
  resolve(code2);
7791
7797
  }
7798
+ let opened = false;
7799
+ let prompted = !opts.initialInput;
7800
+ let started = false;
7801
+ let fallback;
7802
+ const startInput = () => {
7803
+ if (started || done || !opened || !prompted) return;
7804
+ started = true;
7805
+ if (fallback) clearTimeout(fallback);
7806
+ if (opts.initialInput) session.input(Buffer.from(opts.initialInput, "utf8"));
7807
+ for (const data of held.splice(0)) session.input(data);
7808
+ };
7792
7809
  session.on("open", () => {
7793
- guard.enter();
7794
7810
  stdin.on("data", onInput);
7811
+ guard.enter();
7795
7812
  stdout.on?.("resize", onResize);
7796
7813
  stdout.on?.("drain", onDrain);
7797
- if (opts.initialInput) session.input(Buffer.from(opts.initialInput, "utf8"));
7814
+ opened = true;
7815
+ if (!prompted) {
7816
+ fallback = setTimeout(() => {
7817
+ prompted = true;
7818
+ startInput();
7819
+ }, 3e3);
7820
+ fallback.unref?.();
7821
+ }
7822
+ startInput();
7798
7823
  });
7799
7824
  session.on("output", (data) => {
7825
+ if (!prompted) {
7826
+ prompted = true;
7827
+ queueMicrotask(startInput);
7828
+ }
7800
7829
  guard.observe(data);
7801
7830
  if (!stdout.write(data) && !paused) {
7802
7831
  paused = true;
package/package.json CHANGED
@@ -1,18 +1,54 @@
1
1
  {
2
- "name": "@jabezpauls/agentbox", "type": "module", "version": "0.1.0",
2
+ "name": "@jabezpauls/agentbox",
3
+ "type": "module",
4
+ "version": "0.1.1",
3
5
  "description": "agentbox from your own machine: sign in, attach, move files, mount the workspace.",
4
6
  "license": "MIT",
5
7
  "homepage": "https://github.com/jabezpauls/agentbox/blob/main/docs/cli.md",
6
- "repository": { "type": "git", "url": "git+https://github.com/jabezpauls/agentbox.git", "directory": "web/cli" },
7
- "bugs": { "url": "https://github.com/jabezpauls/agentbox/issues" },
8
- "keywords": ["agentbox", "coding-agents", "claude-code", "codex", "remote-development", "cli"],
9
- "engines": { "node": ">=20" },
10
- "bin": { "agentbox": "dist/agentbox.mjs" },
11
- "files": ["dist/agentbox.mjs"],
12
- "publishConfig": { "access": "public" },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/jabezpauls/agentbox.git",
11
+ "directory": "web/cli"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/jabezpauls/agentbox/issues"
15
+ },
16
+ "keywords": [
17
+ "agentbox",
18
+ "coding-agents",
19
+ "claude-code",
20
+ "codex",
21
+ "remote-development",
22
+ "cli"
23
+ ],
24
+ "engines": {
25
+ "node": ">=20"
26
+ },
27
+ "bin": {
28
+ "agentbox": "dist/agentbox.mjs"
29
+ },
30
+ "files": [
31
+ "dist/agentbox.mjs"
32
+ ],
33
+ "publishConfig": {
34
+ "access": "public"
35
+ },
13
36
  "scripts": {
14
- "build": "node scripts/build.mjs", "e2e": "node e2e/run.mjs", "prepack": "node scripts/build.mjs",
15
- "test": "vitest run", "typecheck": "tsc -p tsconfig.json", "lint": "eslint src test e2e scripts"
37
+ "build": "node scripts/build.mjs",
38
+ "e2e": "node e2e/run.mjs",
39
+ "prepack": "node scripts/build.mjs",
40
+ "test": "vitest run",
41
+ "typecheck": "tsc -p tsconfig.json",
42
+ "lint": "eslint src test e2e scripts"
16
43
  },
17
- "devDependencies": { "esbuild": "^0.28", "ws": "^8", "@types/ws": "^8", "typescript": "^5.6", "vitest": "^2", "@types/node": "^22", "eslint": "^9", "typescript-eslint": "^8" }
44
+ "devDependencies": {
45
+ "@types/node": "^22",
46
+ "@types/ws": "^8",
47
+ "esbuild": "^0.28",
48
+ "eslint": "^9",
49
+ "typescript": "^5.6",
50
+ "typescript-eslint": "^8",
51
+ "vitest": "^2",
52
+ "ws": "^8"
53
+ }
18
54
  }