@0perator/operator 0.1.53 → 0.1.54

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/CHANGELOG.md CHANGED
@@ -4,6 +4,21 @@ Operator is AXE's terminal coding agent (npm `@0perator/operator`), running on t
4
4
  Newest first. Every release bumps `src/cli.tsx` VERSION + `package.json`, adds an entry here, and ships to
5
5
  npm + both git remotes (memjar/kode, axetechnologies/kode). Test counts are the full suite at that release.
6
6
 
7
+ ## 0.1.54 — 2026-09-22
8
+ - **Fixed the mobile/JSCore purity gate (CI was red on main).** The persistent-shell bash tool imported
9
+ `node:child_process` via a string-literal `import("node:...")`, which esbuild `--platform=neutral`
10
+ statically resolves — so the Node builtin leaked into `index.browser.ts`'s graph and the on-device
11
+ mobile engine bundle failed to build. Routed it (and the `./shell-session.js` import in registry.ts)
12
+ through the codebase's `nodeImport` variable-specifier idiom, which esbuild cannot statically resolve,
13
+ keeping the Node-only shell tool out of the neutral bundle. Gate now exits 0.
14
+ - **Fixed the stderr merge race in the bash tool.** stdout and stderr were separate OS pipes merged in
15
+ JS, so a command's stderr chunk could land after the sentinel that followed it on stdout and get
16
+ sliced off (the flaky "stderr is merged" test; real output loss on `cmd 1>&2`). Now merged at the
17
+ shell with `exec 2>&1` at session start — one ordered pipe, deterministic, genuinely terminal-like.
18
+ - Tests: 365/365, neutral purity gate green.
19
+ - (Companion branch `feat/purity-curl` applies the identical nodeImport gating to the curl tool's
20
+ node:dns/node:net for when it lands.)
21
+
7
22
  ## 0.1.53 — 2026-09-22
8
23
  - **Parallel tool calls, made visible.** System-prompt guidance now tells the model to BATCH independent
9
24
  tool calls in one round (the engine already ran batches in parallel via executeParallel — the model just
package/dist/cli.js CHANGED
@@ -24,7 +24,7 @@ import { homedir, hostname } from "node:os";
24
24
  import { createHash } from "node:crypto";
25
25
  // RELEASE CHECKLIST (every bump): update this + package.json "version", ADD A CHANGELOG.md ENTRY
26
26
  // (improvements / fixes / tests), run the suite, then publish to npm + push both remotes.
27
- const VERSION = "0.1.53";
27
+ const VERSION = "0.1.54";
28
28
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
29
29
  const settings = loadSettings();
30
30
  // Propagate the resolved sandbox mode to the tool layer (registry reads KODE_SANDBOX at exec time).
@@ -20,7 +20,11 @@ function str(v, fallback = "") {
20
20
  let _shellSession = null;
21
21
  async function getShellSession() {
22
22
  if (!_shellSession) {
23
- const { ShellSession } = await import("./shell-session.js");
23
+ // Variable specifier (nodeImport), not a string literal: keeps shell-session.ts — which loads
24
+ // node:child_process — OUT of the platform:neutral (mobile/JSCore) bundle's static graph. The
25
+ // `as typeof import(...)` is a TYPE-ONLY annotation (erased at build), so it restores the real
26
+ // types without reintroducing a static specifier esbuild would follow.
27
+ const { ShellSession } = (await nodeImport("./shell-session.js"));
24
28
  _shellSession = new ShellSession();
25
29
  }
26
30
  return _shellSession;
@@ -12,6 +12,13 @@
12
12
  //
13
13
  // node-only; imported lazily from the tool layer so the neutral (mobile) bundle never pulls it.
14
14
  import { wrapInteractiveShell } from "./sandbox.js";
15
+ // Variable-specifier dynamic import: esbuild --platform=neutral (the mobile/JSCore purity gate)
16
+ // STATICALLY resolves a string-literal `import("node:...")` and errors on it, but cannot resolve a
17
+ // variable specifier, so the Node builtin stays out of the neutral bundle. Same idiom as
18
+ // tools/registry.ts + tools/sandbox.ts. This module is node-only and is itself pulled in via a
19
+ // variable specifier from the registry, so it never enters the neutral graph — but keep this here
20
+ // too as defense-in-depth in case another edge reaches it.
21
+ const nodeImport = (m) => import(m);
15
22
  const SENTINEL = "__KODE_SH_DONE__";
16
23
  const OUTPUT_CAP = 8 * 1024 * 1024; // 8MB per command; beyond this we truncate and say so
17
24
  export class ShellSession {
@@ -28,7 +35,7 @@ export class ShellSession {
28
35
  if (this.starting)
29
36
  return this.starting;
30
37
  this.starting = (async () => {
31
- const { spawn } = await import("node:child_process");
38
+ const { spawn } = await nodeImport("node:child_process");
32
39
  const { file, args } = await wrapInteractiveShell();
33
40
  const p = spawn(file, args, {
34
41
  cwd: this.cwd,
@@ -58,8 +65,13 @@ export class ShellSession {
58
65
  p.stdin?.unref?.();
59
66
  }
60
67
  catch { /* */ }
68
+ // Merge stderr into stdout AT THE SHELL (fd2→fd1) so both stream through ONE ordered pipe —
69
+ // "merged like a terminal" for real. Merging two separate OS pipes in JS (stdout + stderr
70
+ // handlers) is racy: the two pipes flush independently, so a command's stderr chunk can land
71
+ // in the buffer AFTER the sentinel that follows it on stdout, and get sliced off (the
72
+ // "stderr is merged" test flaking on `echo err 1>&2`). `exec 2>&1` removes the race entirely.
61
73
  // Quiet the shell and disable history expansion so commands frame cleanly.
62
- p.stdin.write("export PS1='' PROMPT_COMMAND=''; set +o history 2>/dev/null; true\n");
74
+ p.stdin.write("exec 2>&1; export PS1='' PROMPT_COMMAND=''; set +o history 2>/dev/null; true\n");
63
75
  await new Promise((r) => setTimeout(r, 30));
64
76
  this.buf = "";
65
77
  })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.53",
3
+ "version": "0.1.54",
4
4
  "description": "Operator (KODE) — TypeScript + Ink terminal coding agent. Full-frame render, single-engine core shared across CLI/web/mobile; runs against a local Aurora model.",
5
5
  "type": "module",
6
6
  "bin": {