@0perator/operator 0.1.53 → 0.1.55
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 +25 -0
- package/dist/cli.js +13 -1
- package/dist/engine/aurora.js +16 -1
- package/dist/tools/registry.js +5 -1
- package/dist/tools/shell-session.js +14 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,31 @@ 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.55 — 2026-09-22
|
|
8
|
+
- **Remote-engine auth — Operator now runs against a REMOTE engine.** The model call sent no
|
|
9
|
+
Authorization header, so it only worked against a local `:8097`; a thin client pointed at the
|
|
10
|
+
authed `api.axe.onl` gateway got 401. `aurora.ts` now injects the operator bearer for a non-loopback
|
|
11
|
+
base (never for local `:8097`), loaded once at boot from the keychain. Verified E2E: `chat()` →
|
|
12
|
+
`https://api.axe.onl` with the operator token returned a real completion. This is what lets a 4 GB
|
|
13
|
+
MacBook run Operator against JL1's Aurora (`KODE_AURORA=https://api.axe.onl` + `operator auth login`).
|
|
14
|
+
- Relay: `ownerSub` now read from the AuthGate's `account.external_id` for real per-owner session scoping.
|
|
15
|
+
- Tests: 365/365.
|
|
16
|
+
|
|
17
|
+
## 0.1.54 — 2026-09-22
|
|
18
|
+
- **Fixed the mobile/JSCore purity gate (CI was red on main).** The persistent-shell bash tool imported
|
|
19
|
+
`node:child_process` via a string-literal `import("node:...")`, which esbuild `--platform=neutral`
|
|
20
|
+
statically resolves — so the Node builtin leaked into `index.browser.ts`'s graph and the on-device
|
|
21
|
+
mobile engine bundle failed to build. Routed it (and the `./shell-session.js` import in registry.ts)
|
|
22
|
+
through the codebase's `nodeImport` variable-specifier idiom, which esbuild cannot statically resolve,
|
|
23
|
+
keeping the Node-only shell tool out of the neutral bundle. Gate now exits 0.
|
|
24
|
+
- **Fixed the stderr merge race in the bash tool.** stdout and stderr were separate OS pipes merged in
|
|
25
|
+
JS, so a command's stderr chunk could land after the sentinel that followed it on stdout and get
|
|
26
|
+
sliced off (the flaky "stderr is merged" test; real output loss on `cmd 1>&2`). Now merged at the
|
|
27
|
+
shell with `exec 2>&1` at session start — one ordered pipe, deterministic, genuinely terminal-like.
|
|
28
|
+
- Tests: 365/365, neutral purity gate green.
|
|
29
|
+
- (Companion branch `feat/purity-curl` applies the identical nodeImport gating to the curl tool's
|
|
30
|
+
node:dns/node:net for when it lands.)
|
|
31
|
+
|
|
7
32
|
## 0.1.53 — 2026-09-22
|
|
8
33
|
- **Parallel tool calls, made visible.** System-prompt guidance now tells the model to BATCH independent
|
|
9
34
|
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.
|
|
27
|
+
const VERSION = "0.1.55";
|
|
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).
|
|
@@ -52,6 +52,18 @@ if (sd) {
|
|
|
52
52
|
// The searxng module reads this env flag in its own sync exit hook; project the setting so it applies.
|
|
53
53
|
if (settings.services?.stopOnExit?.searxng === false)
|
|
54
54
|
process.env.KODE_STOP_SEARXNG_ON_EXIT = "0";
|
|
55
|
+
// Remote-engine auth. When this Operator points at a REMOTE engine (KODE_AURORA=https://api.axe.onl),
|
|
56
|
+
// the gateway fronts the model with operator-token auth, so the model call must carry the bearer. Load
|
|
57
|
+
// it once at boot from the keychain (or KODE_OPERATOR_TOKEN) and hand it to the engine; a local :8097
|
|
58
|
+
// never receives it (aurora.ts only sends to a non-loopback base), so this is safe on JL1 and costs
|
|
59
|
+
// nothing there. This is what lets a thin client (a 4 GB MacBook) run Operator against JL1's Aurora.
|
|
60
|
+
try {
|
|
61
|
+
const { loadCredentials } = await import("./auth/store.js");
|
|
62
|
+
const { setOperatorToken } = await import("./engine/aurora.js");
|
|
63
|
+
const creds = await loadCredentials().catch(() => null);
|
|
64
|
+
setOperatorToken(process.env.KODE_OPERATOR_TOKEN || creds?.token || undefined);
|
|
65
|
+
}
|
|
66
|
+
catch { /* auth is optional — a local engine needs none */ }
|
|
55
67
|
// Computer control (opt-in, macOS embodiment). When enabled: register the control tools into the shared
|
|
56
68
|
// registry and compute permission rules. The FOREGROUND forces each computer_* tool to "ask" so every
|
|
57
69
|
// action prompts the owner via the approve() bridge in <Root>; BACKGROUND sub-agents get them DENIED —
|
package/dist/engine/aurora.js
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// A remote engine (api.axe.onl) fronts the model with gateway auth; a local :8097 does not. Only a
|
|
2
|
+
// non-loopback base needs (and should ever receive) the operator bearer, so a token is never sent to
|
|
3
|
+
// a local llama-server and the header is omitted entirely when there is nothing to send.
|
|
4
|
+
function isRemoteBase(base) {
|
|
5
|
+
return !/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/.test(base);
|
|
6
|
+
}
|
|
7
|
+
// One operator identity per process. The node CLI sets this at boot from the keychain
|
|
8
|
+
// (setOperatorToken); browser/JSCore hosts inject per-call via AuroraOpts.token or not at all.
|
|
9
|
+
// A local :8097 never receives it (isRemoteBase gate), so it is safe to set unconditionally.
|
|
10
|
+
let _operatorToken;
|
|
11
|
+
export function setOperatorToken(token) { _operatorToken = token || undefined; }
|
|
12
|
+
function authHeaders(o) {
|
|
13
|
+
const token = o.token ?? _operatorToken;
|
|
14
|
+
return token && isRemoteBase(o.base) ? { Authorization: `Bearer ${token}` } : {};
|
|
15
|
+
}
|
|
1
16
|
// ---------------------------------------------------------------------------
|
|
2
17
|
// Decode-time degeneration guard (SPEC §1). This is NOT a sampling penalty — it changes no
|
|
3
18
|
// logits and touches no request knob, so a healthy model is completely unaffected. It only
|
|
@@ -71,7 +86,7 @@ function requestBody(messages, o, stream) {
|
|
|
71
86
|
async function* streamDeltas(messages, o) {
|
|
72
87
|
const res = await fetch(`${o.base}/v1/chat/completions`, {
|
|
73
88
|
method: "POST",
|
|
74
|
-
headers: { "Content-Type": "application/json" },
|
|
89
|
+
headers: { "Content-Type": "application/json", ...authHeaders(o) },
|
|
75
90
|
body: requestBody(messages, o, true),
|
|
76
91
|
signal: o.signal, // SPEC §9 interrupt parity: tears down the in-flight stream on abort, not at the next loop boundary
|
|
77
92
|
});
|
package/dist/tools/registry.js
CHANGED
|
@@ -20,7 +20,11 @@ function str(v, fallback = "") {
|
|
|
20
20
|
let _shellSession = null;
|
|
21
21
|
async function getShellSession() {
|
|
22
22
|
if (!_shellSession) {
|
|
23
|
-
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.1.55",
|
|
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": {
|