@0perator/operator 0.1.57 → 0.1.58

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,14 @@ 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.58 — 2026-09-22
8
+ - **`/login` runs the device-grant flow inline.** Typing `/login` (no arg) now requests a device code,
9
+ opens the browser to the AuthGate approval page with the 6-char code, polls until you approve, then
10
+ stores the token, sets it for immediate remote-engine use, and shows "✓ Authenticated as <you>" — no
11
+ dropping to the shell. `/login <token>` still pastes a PAT for headless sign-in. (Approval-page domain
12
+ is AuthGate-configured — OPERATOR_AUTH_VERIFICATION_URI.)
13
+ - Tests: 365/365.
14
+
7
15
  ## 0.1.57 — 2026-09-22
8
16
  - **ReportLab PDF tools ship STANDARD.** report-mcp (build_pdf_report, build_pdf_from_markdown) is now
9
17
  always injected — Operator can generate PDFs out of the box without opting into the full MCP fleet
@@ -30,7 +30,7 @@ async function ask(question) {
30
30
  // window actually appeared — the printed URL is always the real fallback). Crucially, a child-process
31
31
  // spawn failure (e.g. ENOENT for a missing opener) surfaces ASYNCHRONOUSLY as an 'error' event, not as a
32
32
  // throw — left unhandled it can crash the process, so we attach a no-op handler.
33
- function openBrowser(url) {
33
+ export function openBrowser(url) {
34
34
  const os = platform();
35
35
  const cmd = os === "darwin" ? "open" : os === "win32" ? "cmd" : "xdg-open";
36
36
  const args = os === "win32" ? ["/c", "start", "", url] : [url];
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.57";
27
+ const VERSION = "0.1.58";
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).
@@ -792,10 +792,33 @@ function Root() {
792
792
  break;
793
793
  }
794
794
  case "login": {
795
- // Device-grant needs the terminal for the browser handoff — do it from the shell. A PAT can be
796
- // pasted inline here (`/login <token>`) for a quick headless sign-in.
795
+ // No arg → run the device-grant flow inline (RFC 8628): request a code, open the browser to the
796
+ // approval page, poll until the human approves, then store the token + verify. A PAT can still be
797
+ // pasted (`/login <token>`) for a quick headless sign-in (handled below).
797
798
  if (!arg) {
798
- sys("run `operator auth login` in your shell (browser sign-in), or `/login <token>` to paste a token");
799
+ const { requestDeviceCode, awaitApproval } = await import("./auth/client.js");
800
+ const { openBrowser } = await import("./auth/commands.js");
801
+ const { saveCredentials } = await import("./auth/store.js");
802
+ const { setOperatorToken } = await import("./engine/aurora.js");
803
+ try {
804
+ const dc = await requestDeviceCode();
805
+ const url = dc.verification_uri_complete ?? dc.verification_uri;
806
+ const opened = openBrowser(url);
807
+ sys(`◔ sign-in: ${opened ? "opened" : "open"} ${dc.verification_uri} and approve with code \x1b[1m${dc.user_code}\x1b[0m — waiting…`);
808
+ const r = await awaitApproval(dc);
809
+ if (r.state === "approved") {
810
+ await saveCredentials({ token: r.token, user: r.account.external_id, issuedAt: Date.now() });
811
+ setOperatorToken(r.token); // so a remote engine call carries the fresh bearer immediately
812
+ setAuthUser(r.account.email ?? r.account.external_id);
813
+ sys(`✓ Authenticated as ${r.account.email ?? r.account.external_id}`);
814
+ }
815
+ else {
816
+ sys(`sign-in ${r.state} — /login to retry`);
817
+ }
818
+ }
819
+ catch (e) {
820
+ sys(`sign-in failed: ${e instanceof Error ? e.message : String(e)} — /login to retry`);
821
+ }
799
822
  break;
800
823
  }
801
824
  const { verifyToken } = await import("./auth/client.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0perator/operator",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
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": {