@0perator/operator 0.1.360-next.2 → 0.2.0

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 (49) hide show
  1. package/README.md +1 -1
  2. package/dist/autonomy/delegate-mode.js +159 -0
  3. package/dist/autonomy/delegate.js +1 -1
  4. package/dist/autonomy/session-factory.js +2 -0
  5. package/dist/background/index.js +26 -2
  6. package/dist/background/resume.js +125 -0
  7. package/dist/browser/engine.js +163 -0
  8. package/dist/browser/session.js +130 -140
  9. package/dist/cli.js +174 -12
  10. package/dist/config/settings.js +1 -1
  11. package/dist/engine/agent.js +1 -1
  12. package/dist/engine/aurora.js +4 -4
  13. package/dist/engine/compaction.js +1 -1
  14. package/dist/engine/moa.js +2 -1
  15. package/dist/engine/selfheal.js +1 -1
  16. package/dist/engine/toolcalls.js +6 -6
  17. package/dist/index.js +3 -0
  18. package/dist/mcp/phone-server.js +30 -0
  19. package/dist/permissions/index.js +33 -17
  20. package/dist/permissions/signature.js +5 -0
  21. package/dist/phone-cli.js +65 -0
  22. package/dist/remote/host.js +31 -2
  23. package/dist/router/models.js +5 -15
  24. package/dist/selfimprove/index.js +1 -1
  25. package/dist/session.js +48 -7
  26. package/dist/tools/deferred.js +1 -0
  27. package/dist/tools/device/android.js +227 -0
  28. package/dist/tools/device/classify.js +127 -0
  29. package/dist/tools/device/deps.js +69 -0
  30. package/dist/tools/device/desktop.js +82 -0
  31. package/dist/tools/device/harness.js +262 -0
  32. package/dist/tools/device/iphone.js +206 -0
  33. package/dist/tools/device/mirroring-jxa.js +146 -0
  34. package/dist/tools/device/setup.js +90 -0
  35. package/dist/tools/device/tools.js +70 -0
  36. package/dist/tools/device/types.js +19 -0
  37. package/dist/tools/registry.js +12 -3
  38. package/dist/ui/App.js +4 -3
  39. package/dist/ui/ApprovalPrompt.js +10 -4
  40. package/dist/ui/BgPanel.js +2 -2
  41. package/dist/ui/UpdatePrompt.js +40 -0
  42. package/dist/ui/modelPicker.js +1 -1
  43. package/dist/ui/slashCommands.js +1 -0
  44. package/dist/update-check.js +134 -0
  45. package/dist/update.js +59 -15
  46. package/dist/util/slash.js +2 -2
  47. package/package.json +4 -2
  48. package/src/tools/device/NOTICE +37 -0
  49. package/dist/browser/cdp.js +0 -271
package/dist/cli.js CHANGED
@@ -14,7 +14,7 @@ import { mastheadLines } from "./ui/Masthead.js";
14
14
  import { shouldPromptPlanExit, resolvePlanExit, PLAN_EXIT_OPTIONS } from "./ui/planExit.js";
15
15
  import { initialMode, modePolicy, nextMode, parseMode, planToggleTarget } from "./permissions/modes.js";
16
16
  import { FREE_ROW_PRESETS, connectedAccounts, isMainModel, looksLikeSecret, contextLine, contextPickerView, keyStoredLine, mainPickerView, markModelRows, modelLine, modelPickerView, onceEach, pickerAnswer, providerPickerView, rereadConfirmView, wantsContextStep, wantsRereadConfirm } from "./ui/modelPicker.js";
17
- import { RemoteHost } from "./remote/host.js";
17
+ import { RemoteHost, toRemoteAgents } from "./remote/host.js";
18
18
  import { REMOTE_SAFE_COMMANDS, REMOTE_SAFE_COMMAND_NAMES } from "./remote/safe-commands.js";
19
19
  import { newCode, pairURL } from "./remote/pairing.js";
20
20
  import { qrToTerminal } from "./ui/qr.js";
@@ -39,6 +39,7 @@ import { cacheBustNotice, anyReachable, setSpeculation, speculationEnabled } fro
39
39
  import { seedCalibration } from "./engine/calibration-seed.js";
40
40
  import { AuroraRouter } from "./router/router.js";
41
41
  import { BackgroundAgents } from "./background/index.js";
42
+ import { clearResumable, pickUpSaved, quitSummary, resumeOnReopen, saveResumable, startSaved } from "./background/resume.js";
42
43
  import { loadSettings, saveSettings, compactionThreshold, compactionCeilingTokens, compactionMinDecodeTps, rcAutostart, eagerAuthAtBoot, applySeat, setActiveSeat, buildEndpointChain, parseContextArg, nextContextPin } from "./config/settings.js";
43
44
  import { resolveSeat } from "./auth/identity.js";
44
45
  import { PermissionPolicy } from "./permissions/index.js";
@@ -81,6 +82,7 @@ import { isFeatureEnabled } from "./config/features.js";
81
82
  import { classifyActVsAsk, actAskGateDirective } from "./engine/classifier.js";
82
83
  import { resolveMode } from "./classifier/modes.js";
83
84
  import { subagentModelFor, servingModelFor } from "./autonomy/subagent-model.js";
85
+ import { parseDelegate, delegateStatusLines, delegateGuardOn, setDelegateSettings } from "./autonomy/delegate-mode.js";
84
86
  import { classifierConfig } from "./classifier/config.js";
85
87
  import { throttle } from "./util/throttle.js";
86
88
  import { isSlashCommand } from "./util/slash.js";
@@ -156,6 +158,7 @@ if (process.argv[2] === "selfimprove") {
156
158
  }
157
159
  // operator/settings.json (override path via KODE_TSI_SETTINGS), env vars still win — see config/settings.ts.
158
160
  const settings = loadSettings();
161
+ setDelegateSettings(settings.delegate); // delegate mode's guard, read per tool call by every session in this process
159
162
  // Enterprise first-run: make the operator home's contract explicit BEFORE any module writes into it (0700
160
163
  // root, ignore-everything .gitignore, README, settings.example.json, home.json). Idempotent, never throws.
161
164
  const HOME_SCAFFOLD = ensureOperatorHome({ version: VERSION });
@@ -262,7 +265,7 @@ if (firstRunEligible) {
262
265
  // Seat resolution (enterprise SSO/RBAC readiness): with a managed auth policy deployed, the verified identity
263
266
  // decides the widest tier this process may hold (it can only NARROW, never widen). With no managed policy this
264
267
  // is a no-op and touches no network. `operator auth …` / --version / --help skip it (they must work signed-out).
265
- const SKIP_SEAT = process.argv[2] === "auth" || process.argv[2] === "audit" || process.argv[2] === "gateway" || process.argv[2] === "toolchain" || process.argv.includes("--version") || process.argv.includes("-V") || process.argv.includes("--help");
268
+ const SKIP_SEAT = process.argv[2] === "auth" || process.argv[2] === "audit" || process.argv[2] === "gateway" || process.argv[2] === "toolchain" || process.argv[2] === "phone" || process.argv.includes("--version") || process.argv.includes("-V") || process.argv.includes("--help");
266
269
  const SEAT = SKIP_SEAT
267
270
  ? { seat: { tier: settings.permissions.tier ?? "admin", source: "local-owner", reasons: ["seat resolution skipped for this command"] }, events: [], dropToken: false }
268
271
  : await resolveSeat(settings, { creds: bootCreds });
@@ -304,10 +307,15 @@ if (settings.computer.enabled) {
304
307
  // Foreground: computer_* and chauffeur ACTIONS prompt ("ask"); chauffeur READS (list_windows,
305
308
  // get_window_state, …) are intentionally NOT gated, so the model reads the screen freely and completes
306
309
  // a task end-to-end without walking the owner through each step. Only real input/mutation asks.
307
- const askNames = [...COMPUTER_TOOL_NAMES, ...(chauffeurServer ? CHAUFFEUR_ACTION_NAMES : [])];
310
+ // The device tools (phone_*: iPhone via iPhone Mirroring, Android via adb, the desktop) are the same class: their
311
+ // actions ask like computer_*, their reads run unprompted like chauffeur's, and a background agent gets none of them.
312
+ const { PHONE_TOOLS, PHONE_TOOL_NAMES, PHONE_ACTION_NAMES } = await import("./tools/device/tools.js");
313
+ for (const t of PHONE_TOOLS)
314
+ registry.set(t.name, t);
315
+ const askNames = [...COMPUTER_TOOL_NAMES, ...PHONE_ACTION_NAMES, ...(chauffeurServer ? CHAUFFEUR_ACTION_NAMES : [])];
308
316
  computerAskRules = Object.fromEntries(askNames.map((n) => [n, "ask"]));
309
317
  // Background sub-agents have no approver, so DENY every embodiment tool, reads included.
310
- const denyNames = [...COMPUTER_TOOL_NAMES, "desktop_screenshot", "desktop_read", ...(chauffeurServer ? CHAUFFEUR_TOOL_NAMES : [])];
318
+ const denyNames = [...COMPUTER_TOOL_NAMES, ...PHONE_TOOL_NAMES, "desktop_screenshot", "desktop_read", ...(chauffeurServer ? CHAUFFEUR_TOOL_NAMES : [])];
311
319
  computerDenyRules = Object.fromEntries(denyNames.map((n) => [n, "deny"]));
312
320
  }
313
321
  // STANDARD MCP: report-mcp (PDF tools) ships with Operator — always injected, even without the full-fleet
@@ -468,6 +476,11 @@ installProcessTeardown(teardown, {
468
476
  });
469
477
  // Children a previous Operator left behind (it crashed, or was killed -9; detached shells/jobs and Chrome outlive their parent).
470
478
  let REAPED = { owners: 0, killed: [], skipped: 0 };
479
+ // The update-available check (update-check.ts): started just before the TUI mounts, never awaited by the boot. "Update now"
480
+ // parks the offer in UPDATE_NOW and closes the TUI; the update runs after the teardown, in the plain terminal.
481
+ let UPDATE_CHECK = Promise.resolve(null);
482
+ let UPDATE_ASKED_AT = 0;
483
+ let UPDATE_NOW = null;
471
484
  // Build the endpoint router. ONE model now: Aurora at its native 1M context on :8097 — both `operator`
472
485
  // and `operator+` serve the same single tier (the air/1m/saddle roster collapsed once Aurora ran true
473
486
  // 1,048,576-token context at full speed). No size-based routing decision remains.
@@ -586,6 +599,7 @@ const HELP = [
586
599
  " /remember <note> store a note to recall in future sessions",
587
600
  " /memory [query] show remembered notes (all, or matching query)",
588
601
  " /allow <tool:args> auto-allow a tool+args glob pattern in gated mode (e.g. bash:npm test*)",
602
+ " /delegate any /model id as the MoA planner or the sub-agents, plus a guard (no push, deploys or writes outside this repo)",
589
603
  " /skill <name|off> activate a skill as a system-prompt directive (/skill off to deactivate)",
590
604
  " /<skill> [message] any installed skill is its own command; the rest of the line is your first message",
591
605
  " /mcp [list|on|off] MCP servers and their tools (pick a server to browse its tools) · on/off (saved) · /mcp reload (from disk) · /mcp add powertools <root>",
@@ -739,6 +753,7 @@ function Root() {
739
753
  const [planExitPicker, setPlanExitPicker] = useState(null);
740
754
  const [artifactsPicker, setArtifactsPicker] = useState(null);
741
755
  const [sessionsPicker, setSessionsPicker] = useState(null);
756
+ const [updatePrompt, setUpdatePrompt] = useState(null);
742
757
  const [finder, setFinder] = useState(null); // ctrl+g — the skills and tools finder
743
758
  const alwaysAllowRef = useRef(new Set());
744
759
  // Remembers the email a `/login <email>` sent a 6-digit code to, so the follow-up `/login <code>`
@@ -757,18 +772,18 @@ function Root() {
757
772
  pendingApprovals.current.delete(id);
758
773
  resolve(allow);
759
774
  setApproval((cur) => {
760
- if (cur && cur.id === id && allow && always)
775
+ if (cur && cur.id === id && allow && always && !cur.ctx?.once)
761
776
  alwaysAllowRef.current.add(cur.name);
762
777
  return cur && cur.id === id ? null : cur;
763
778
  });
764
779
  }, []);
765
- const approveFn = useCallback((name, args) => {
766
- if (alwaysAllowRef.current.has(name))
767
- return Promise.resolve(true);
780
+ const approveFn = useCallback((name, args, ctx) => {
781
+ if (!ctx?.once && alwaysAllowRef.current.has(name))
782
+ return Promise.resolve(true); // a phone signature line asks every time
768
783
  const id = "ap_" + Date.now().toString(36) + Math.random().toString(36).slice(2, 6);
769
784
  return new Promise((resolve) => {
770
785
  pendingApprovals.current.set(id, resolve);
771
- setApproval({ id, name, args, resolve: (b) => settleApproval(id, b) });
786
+ setApproval({ id, name, args, ...(ctx ? { ctx } : {}), resolve: (b) => settleApproval(id, b) });
772
787
  remoteRef.current?.approvalRequest(id, name, args); // mirror to followers (owner-scoped)
773
788
  });
774
789
  }, [settleApproval]);
@@ -1994,12 +2009,61 @@ function Root() {
1994
2009
  teardown.add("caffeinate", () => { setCaffeine(false); }, { order: 25 });
1995
2010
  return () => { setCaffeine(false); };
1996
2011
  }, [boot, setCaffeine]);
2012
+ // Agents still working when Operator closes are saved on the way out and picked back up by the next session in this folder
2013
+ // (background/resume.ts; settings.agents.resumeOnReopen). With the setting off they wait in /agents as paused.
2014
+ const pausedRef = useRef([]);
2015
+ const spawnSaved = (a) => !!bgRef.current?.spawn(a.task, a.role, a.name, a);
2016
+ useEffect(() => {
2017
+ if (boot !== "ready")
2018
+ return;
2019
+ const cwd = process.cwd();
2020
+ teardown.add("agents-resume", () => {
2021
+ const live = bgRef.current?.resumable(cwd, getAgentTasks()) ?? [];
2022
+ if (!live.length && !pausedRef.current.length)
2023
+ return;
2024
+ saveResumable(cwd, [...pausedRef.current, ...live]);
2025
+ if (live.length)
2026
+ process.stdout.write(`${quitSummary(live, resumeOnReopen(settings)).line}\n`);
2027
+ }, { order: 25 }); // before "background-agents" (30) interrupts them
2028
+ const picked = pickUpSaved(cwd, settings, spawnSaved, (m) => sys(`⚠ ${m}`));
2029
+ pausedRef.current = picked.paused;
2030
+ if (picked.line)
2031
+ sys(picked.line);
2032
+ }, [boot]);
2033
+ useEffect(() => { remoteRef.current?.setAgents(toRemoteAgents(bgAgents)); }, [bgAgents, rcActive]);
1997
2034
  // Say so when this launch cleaned up after a previous one — silently killing processes would be worse than the orphans.
1998
2035
  useEffect(() => {
1999
2036
  const n = REAPED.killed.length;
2000
2037
  if (n)
2001
2038
  sys(`cleaned up ${n} leftover process${n === 1 ? "" : "es"} from a previous session that did not exit cleanly (${[...new Set(REAPED.killed.map((k) => k.label))].join(", ")}).`);
2002
2039
  }, []);
2040
+ // A newer build (update-check.ts): the prompt before the first turn; once the owner has typed or a turn runs, one line.
2041
+ useEffect(() => {
2042
+ void UPDATE_CHECK.then((offer) => {
2043
+ if (!offer)
2044
+ return;
2045
+ if (idleLastActiveAt() > UPDATE_ASKED_AT || statusRef.current !== "idle") {
2046
+ sys(`Update available · ${offer.current} → ${offer.version} · run \`${offer.command}\` (release notes: ${offer.notes})`);
2047
+ return;
2048
+ }
2049
+ setUpdatePrompt({
2050
+ current: offer.current, version: offer.version, notes: offer.notes, command: offer.command,
2051
+ resolve: (choice) => {
2052
+ setUpdatePrompt(null);
2053
+ if (choice === "update") {
2054
+ UPDATE_NOW = offer;
2055
+ void teardown.run("quit");
2056
+ exit();
2057
+ return;
2058
+ }
2059
+ if (choice === "skip-version") {
2060
+ void import("./update-check.js").then(({ skipVersion }) => skipVersion(offer.version));
2061
+ sys(`Skipped ${offer.version} · Operator asks again when a newer version is out`);
2062
+ }
2063
+ },
2064
+ });
2065
+ });
2066
+ }, []);
2003
2067
  // The actual mode switch — policy, plan flag, status badge, and follower-facing capabilities, all in
2004
2068
  // lockstep. Factored out of applyMode so the plan-exit picker below can perform it from a resolve
2005
2069
  // callback without re-entering (and re-gating) applyMode itself.
@@ -2783,6 +2847,64 @@ function Root() {
2783
2847
  void sendTurn(`Use the deep_research tool to research this thoroughly and give me a cited, multi-source brief: ${arg}`);
2784
2848
  break;
2785
2849
  }
2850
+ case "delegate": {
2851
+ // Writes only existing settings (moa.plannerModel + moa.specialist, autonomy.subagentModel, delegate.*), in memory
2852
+ // and on disk: sub-agents resolve their model per spawn, delegate_task re-reads settings, the guard reads per call.
2853
+ const a = parseDelegate(arg);
2854
+ const setGuard = (patch) => {
2855
+ settings.delegate = { ...settings.delegate, ...patch };
2856
+ setDelegateSettings(settings.delegate);
2857
+ saveSettings({ delegate: patch });
2858
+ };
2859
+ const status = () => {
2860
+ const team = s.moaTeam();
2861
+ const d = settings.delegate ?? {};
2862
+ return delegateStatusLines({ activeModel: s.currentModel(), plannerModel: settings.moa?.plannerModel?.trim() ? team?.planner.id : undefined, specialist: team?.specialist, subagentModel: subagentModel(), guard: delegateGuardOn(process.env, d), allowPush: !!d.allowPush, repos: d.repos ?? [] }).join("\n");
2863
+ };
2864
+ if (a.kind === "error") {
2865
+ sys(a.message);
2866
+ break;
2867
+ }
2868
+ if (a.kind === "planner") {
2869
+ const executor = a.executor ?? (settings.moa?.specialist?.id ? undefined : subagentModelFor({ autonomy: settings.autonomy }));
2870
+ const r = s.setMoaPlanner(a.model, executor);
2871
+ if (!r.ok) {
2872
+ sys(`delegate planner: ${r.error}`);
2873
+ break;
2874
+ }
2875
+ const patch = { plannerModel: a.model, ...(executor ? { specialist: { id: executor } } : {}) };
2876
+ settings.moa = { ...settings.moa, ...patch };
2877
+ saveSettings({ moa: patch });
2878
+ const onMoa = s.currentModel() === "moa";
2879
+ sys(`delegate · planner ${a.model} → executor ${s.moaTeam()?.specialist}${onMoa ? (turnRunning() ? " · from the next turn" : "") : " · switching to /model moa"}`);
2880
+ if (!onMoa)
2881
+ submitRef.current("/model moa");
2882
+ break;
2883
+ }
2884
+ if (a.kind === "subagents") {
2885
+ const { profile, error } = selectModel(s.modelRegistry(), a.model, hasByoToken);
2886
+ if (!profile) {
2887
+ sys(`delegate subagents: ${error}`);
2888
+ break;
2889
+ }
2890
+ settings.autonomy = { ...settings.autonomy, subagentModel: a.model };
2891
+ saveSettings({ autonomy: { subagentModel: a.model } });
2892
+ sys(`delegate · sub-agents (spawn_agent, delegate_task default) run on ${a.model}${s.currentModel() === "moa" ? ` — under /model moa the executor ${s.moaTeam()?.specialist} takes them` : ""}`);
2893
+ break;
2894
+ }
2895
+ if (a.kind === "guard")
2896
+ setGuard({ guard: a.on });
2897
+ else if (a.kind === "push")
2898
+ setGuard({ allowPush: a.on });
2899
+ else if (a.kind === "off") {
2900
+ s.setMoaPlanner("");
2901
+ settings.moa = { ...settings.moa, plannerModel: "" };
2902
+ saveSettings({ moa: { plannerModel: "" } });
2903
+ setGuard({ guard: false, allowPush: false });
2904
+ }
2905
+ sys(status());
2906
+ break;
2907
+ }
2786
2908
  case "allow": {
2787
2909
  if (!arg) {
2788
2910
  sys("usage: /allow <tool:args> e.g. /allow bash:npm test*");
@@ -2980,9 +3102,32 @@ function Root() {
2980
3102
  }
2981
3103
  case "agents": {
2982
3104
  const l = bg.list();
3105
+ const paused = pausedRef.current;
3106
+ const pausedLines = paused.length
3107
+ ? `\npaused — resume? (still working when Operator closed; /agents resume [name] · /agents discard):\n` + paused.map((a) => ` ⏸ ${a.name} · ${a.label} · round ${a.rounds}`).join("\n")
3108
+ : "";
3109
+ if (arg === "resume" || arg.startsWith("resume ")) {
3110
+ const want = arg.slice(6).trim().toLowerCase();
3111
+ const pick = want && want !== "all" ? paused.filter((a) => a.name.toLowerCase() === want || a.id === want) : paused;
3112
+ if (!pick.length) {
3113
+ sys(paused.length ? `no paused agent named ${want} — paused: ${paused.map((a) => a.name).join(", ")}` : "no paused agents");
3114
+ break;
3115
+ }
3116
+ const r = startSaved(pick, spawnSaved);
3117
+ pausedRef.current = [...paused.filter((a) => !pick.includes(a)), ...r.left];
3118
+ clearResumable(process.cwd()); // what is still paused is saved again on quit
3119
+ sys(r.line);
3120
+ break;
3121
+ }
3122
+ if (arg === "discard") {
3123
+ sys(paused.length ? `dropped ${paused.length} paused agent${paused.length === 1 ? "" : "s"}: ${paused.map((a) => a.name).join(", ")}` : "no paused agents");
3124
+ pausedRef.current = [];
3125
+ clearResumable(process.cwd());
3126
+ break;
3127
+ }
2983
3128
  if (!arg) {
2984
3129
  if (!l.length) {
2985
- sys("no sub-agents spawned this session");
3130
+ sys(`no sub-agents spawned this session${pausedLines}`);
2986
3131
  break;
2987
3132
  }
2988
3133
  const running = l.filter((a) => a.status === "working").length;
@@ -2990,7 +3135,7 @@ function Root() {
2990
3135
  const done = l.filter((a) => a.status === "idle").length;
2991
3136
  const errored = l.filter((a) => a.status === "stopped").length;
2992
3137
  const counts = [running ? `${running} running` : "", queued ? `${queued} queued` : "", done ? `${done} done` : "", errored ? `${errored} errored` : ""].filter(Boolean).join(" · ");
2993
- sys(`sub-agents (${counts}):\n` + l.map((a) => ` ${formatAgentDetail(a)}`).join("\n"));
3138
+ sys(`sub-agents (${counts}):\n` + l.map((a) => ` ${formatAgentDetail(a)}${a.resumed ? " · resumed" : ""}`).join("\n") + pausedLines);
2994
3139
  break;
2995
3140
  }
2996
3141
  const parts = parseAgentCommand(arg, [...l, ...bg.retiredList()]);
@@ -3710,7 +3855,7 @@ function Root() {
3710
3855
  decode: shownPhase === "thinking" || shownPhase === "writing" || shownPhase === "drafting" ? decodeView() : undefined,
3711
3856
  }
3712
3857
  : null;
3713
- return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, phase: phaseView, fold: liveFold, delegate: delegate, thinkingVerb: stepVerb ?? triage ?? phaseVerb(shownPhase ?? undefined, phaseView?.read), liveTools: liveTools, route: route, ctxPct: ctxPct, ctxWindow: session.currentModel() === "moa" ? (ctxPin ? fmtCtx(ctxPin) : undefined) : fmtCtx(ctxPin ? Math.min(ctxPin, session.servedContext()) : session.servedContext()), version: VERSION, fullscreen: FULLSCREEN, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, shellJobs: shellJobs, mainLane: mainLane, mainServing: servingModelFor(settings, session.currentModel()), maxRunning: bg.limits().running, onBackground: onBackground, tasks: tasks, planNow: planLive ? Date.now() : lastTurnEndRef.current, onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, pending: pending, nextSteps: nextSteps ?? undefined, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: bgAgents, onAgentMessage: onAgentMessage, conversations: convs, switcher: { focused: switcher.focused, sel: Math.max(0, convs.findIndex((c) => c.id === switcher.sel)), open: openConv }, onSwitcher: onSwitcher, onFocusSwitcher: onFocusSwitcher, conversationPane: conversationPane, onSendTo: onSendTo, actOffer: active ? actNowOffer(actRef.current, Date.now(), { thinking: thinkMode !== "off" }) : null, onActNow: onActNow, finder: finder, onOpenFinder: onOpenFinder, onEditQueued: popQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onExpand: onExpand, onCycleMode: onCycleMode, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, onApprovalDecide: (allow, always) => {
3858
+ return (_jsx(App, { messages: entries, live: live, status: status, stepLabel: stepLabel, phase: phaseView, fold: liveFold, delegate: delegate, thinkingVerb: stepVerb ?? triage ?? phaseVerb(shownPhase ?? undefined, phaseView?.read), liveTools: liveTools, route: route, ctxPct: ctxPct, ctxWindow: session.currentModel() === "moa" ? (ctxPin ? fmtCtx(ctxPin) : undefined) : fmtCtx(ctxPin ? Math.min(ctxPin, session.servedContext()) : session.servedContext()), version: VERSION, fullscreen: FULLSCREEN, metrics: liveMetrics, sessionTokens: session.sessionTokens() + liveTok, authUser: authUser, tier: EVENT_ACTOR.tier, planMode: planMode, thinkMode: thinkMode, verbs: settings.verbs, bgAgents: bgAgents, shellJobs: shellJobs, mainLane: mainLane, mainServing: servingModelFor(settings, session.currentModel()), maxRunning: bg.limits().running, onBackground: onBackground, tasks: tasks, planNow: planLive ? Date.now() : lastTurnEndRef.current, onSubmit: onSubmit, onQueue: onQueue, onSteer: onSteer, pending: pending, nextSteps: nextSteps ?? undefined, onPickNext: onPickNext, onDismissNext: onDismissNext, agents: bgAgents, onAgentMessage: onAgentMessage, conversations: convs, switcher: { focused: switcher.focused, sel: Math.max(0, convs.findIndex((c) => c.id === switcher.sel)), open: openConv }, onSwitcher: onSwitcher, onFocusSwitcher: onFocusSwitcher, conversationPane: conversationPane, onSendTo: onSendTo, actOffer: active ? actNowOffer(actRef.current, Date.now(), { thinking: thinkMode !== "off" }) : null, onActNow: onActNow, finder: finder, onOpenFinder: onOpenFinder, onEditQueued: popQueued, onDropQueued: onDropQueued, onInterrupt: onInterrupt, onExpand: onExpand, onCycleMode: onCycleMode, onCycleContext: onCycleContext, opMode: opMode, rcConnected: rcConnected, rcActive: rcActive, caffeinated: caffeinated, approval: approval, question: question, modelPicker: modelPicker, secretPrompt: secretPrompt, planExitPicker: planExitPicker, artifactsPicker: artifactsPicker, sessionsPicker: sessionsPicker, update: updatePrompt, onApprovalDecide: (allow, always) => {
3714
3859
  const cur = approval;
3715
3860
  if (cur)
3716
3861
  settleApproval(cur.id, allow, always); // first-wins with any remote follower answer
@@ -3740,6 +3885,11 @@ if (process.argv[2] === "gateway") {
3740
3885
  const { runGateway } = await import("./gateway-cli.js");
3741
3886
  process.exit(await runGateway(process.argv.slice(3)));
3742
3887
  }
3888
+ // `operator phone setup|mcp` — the device harness's setup checklist and its MCP server (tools/device/).
3889
+ if (process.argv[2] === "phone") {
3890
+ const { runPhone } = await import("./phone-cli.js");
3891
+ process.exit(await runPhone(process.argv.slice(3)));
3892
+ }
3743
3893
  // `operator toolchain …` — the toolchain CLI (toolchain/ in the repo, dist/toolchain/ in the package).
3744
3894
  if (process.argv[2] === "toolchain") {
3745
3895
  const { runToolchain } = await import("./toolchain-cli.js");
@@ -3809,6 +3959,14 @@ else {
3809
3959
  catch { /* best-effort; a write failure just re-shows next boot */ }
3810
3960
  }
3811
3961
  }
3962
+ {
3963
+ const { checkEnabled, checkForUpdate } = await import("./update-check.js");
3964
+ const { isSourceCheckout } = await import("./update.js");
3965
+ if (checkEnabled({ argv: process.argv, env: process.env, tty: !!process.stdin.isTTY && !!process.stdout.isTTY, settings, sourceCheckout: isSourceCheckout() })) {
3966
+ UPDATE_ASKED_AT = Date.now();
3967
+ UPDATE_CHECK = checkForUpdate(VERSION);
3968
+ }
3969
+ }
3812
3970
  // Ink would exit on the first ctrl+c itself; the composer owns that key (interrupt mid-turn, twice to quit at rest).
3813
3971
  const inkInstance = render(_jsx(Root, {}), { exitOnCtrlC: false });
3814
3972
  if (FULLSCREEN)
@@ -3819,6 +3977,10 @@ if (FULLSCREEN)
3819
3977
  // something still holds the event loop open.
3820
3978
  void inkInstance.waitUntilExit().then(() => "quit", () => "error").then(async (reason) => {
3821
3979
  await teardown.run(reason);
3980
+ if (UPDATE_NOW) {
3981
+ const { runOfferedUpdate } = await import("./update-check.js");
3982
+ process.exitCode = await runOfferedUpdate(UPDATE_NOW);
3983
+ }
3822
3984
  setTimeout(() => process.exit(process.exitCode ?? 0), 1500).unref();
3823
3985
  });
3824
3986
  // Ink erases the previous frame by line COUNT, computed from the terminal width at draw time. When the
@@ -73,7 +73,7 @@ const DEFAULTS = {
73
73
  vision: { autostart: false, launchdLabel: "co.0perator.vision", plistPath: "~/Library/LaunchAgents/co.0perator.vision.plist", legacyLabels: ["axe.vision-bot"], url: "http://127.0.0.1:7788" },
74
74
  stopOnExit: { searxng: true }, // aurora/autopilot are shared + never stopped; only the SearXNG container is
75
75
  },
76
- // MOA (2026-10-31, James): a planner/specialist team, Manus-style — Cortana plans, delegates each step to a
76
+ // MOA (2026-10-31, James): a planner/specialist team — Cortana plans, delegates each step to a
77
77
  // gpt-oss-20b sub-agent, checks the result and writes the answer (and reads images). Both on JL1 through the gateway.
78
78
  // Was parallel drafts (gpt-oss-20b + Cortana) merged by Cortana (10/30). settings.moa replaces it wholesale.
79
79
  moa: {
@@ -1383,7 +1383,7 @@ export async function runTurn(userInput, conversation, opts) {
1383
1383
  await sleep(opts.loadingBackoffMs ?? DEFAULT_LOADING_BACKOFF_MS, opts.signal, () => new TurnAbortedError());
1384
1384
  continue;
1385
1385
  }
1386
- // The vendor's 400 stated its OUTPUT ceiling (max_tokens over what it accepts — QwenCloud's "Range of
1386
+ // The vendor's 400 stated its OUTPUT ceiling (max_tokens over what it accepts — one vendor's "Range of
1387
1387
  // max_tokens should be [1, 131072]"): learn it for this endpoint, so every later clamp honours it, and
1388
1388
  // retry this round ONCE. Not a context problem (compaction/failover can't help) and no self-heal
1389
1389
  // budget spent. A ceiling no lower than what we sent, or a second hit this round, is surfaced as-is.
@@ -79,7 +79,7 @@ export function isRemoteBase(base) {
79
79
  return !/^https?:\/\/(127\.0\.0\.1|localhost|\[::1\])(:\d+)?(\/|$)/.test(base);
80
80
  }
81
81
  // Owner-trusted fallback scope for the OPERATOR bearer: AXE's own hosts (api.axe.onl gateway) and
82
- // private/LAN fleet nodes. A third-party BYO host (qwencloudapi.com, …) must NEVER receive the operator
82
+ // private/LAN fleet nodes. A third-party BYO host (api.openai.com, …) must NEVER receive the operator
83
83
  // token — a BYO profile carries its own vendor key via Endpoint.token (AuroraOpts.token), and an
84
84
  // endpoint with no explicit token gets NO auth on a public third-party host. This scope rule is the
85
85
  // credential-leak guard for the BYO era.
@@ -295,7 +295,7 @@ export function requestBody(messages, o, stream) {
295
295
  // Transport dialect: llama.cpp-only fields ship to Aurora/fleet (default "llama") AND to our OWN
296
296
  // vendor gateway (*.axe.onl — LiteLLM terminating at our llama.cpp, so the wire is OpenAI but the
297
297
  // BACKEND understands the knobs; measured live 2026-10-11: extras pass api.axe.onl with no 400 and
298
- // no fallback trip). A genuine third-party "openai" BYO (qwencloudapi.com, …) still gets standard
298
+ // no fallback trip). A genuine third-party "openai" BYO (api.openai.com, …) still gets standard
299
299
  // fields only — third-party gateways can 400 on unknown keys, and silence on extras is not a
300
300
  // contract we should bank on.
301
301
  const llama = o.transport !== "openai";
@@ -324,7 +324,7 @@ export function requestBody(messages, o, stream) {
324
324
  // fed through a long cold prefill instead of looking wedged. A server that ignores the field is harmless.
325
325
  ...(stream && llama ? { return_progress: true } : {}),
326
326
  // GW-26 (2026-11-25): no per-request speculative field by default, tool rounds included — the server's
327
- // --spec-type decides. ngram-mod drafts are verified by the target model, so the output is exact (Qwen3.8-27B,
327
+ // --spec-type decides. ngram-mod drafts are verified by the target model, so the output is exact (the 27B dense model,
328
328
  // 6 prompts: identical sha256 with and without it; a code edit 11.1 → 52-56 tok/s). The old tool-round
329
329
  // disable (sent on the belief that drafts fight the tool-call grammar) starved every agent round of that
330
330
  // speed-up. Opt out with settings.speculation:false / KODE_SPECULATION=0 (setSpeculation), or per call with
@@ -351,7 +351,7 @@ export function chatUrl(base, chatPath) {
351
351
  return `${base}${chatPath ?? "/v1/chat/completions"}`;
352
352
  }
353
353
  /** Who answered an HTTP error, for the owner: the profile id + provider box when the turn loop passed them
354
- * ("qwen3.8-flash (QwenCloud)"), else the legacy "aurora /v1" — every OpenAI-dialect call used to read as Aurora. */
354
+ * ("gemini-flash (Google)"), else the legacy "aurora /v1" — every OpenAI-dialect call used to read as Aurora. */
355
355
  export function httpErrorLabel(o) {
356
356
  if (!o.label)
357
357
  return "aurora /v1";
@@ -218,7 +218,7 @@ function shedToolOutputs(out, opts, targetTokens, protectTail) {
218
218
  return out;
219
219
  const limit = out.length - protectTail;
220
220
  // Tool messages, largest content first — shed the worst offenders until it fits. GW-10-COMPLETE:
221
- // error-ish results go LAST (Manus doctrine — a failed tool trace in context suppresses repeat
221
+ // error-ish results go LAST (context-engineering practice — a failed tool trace in context suppresses repeat
222
222
  // mistakes; a success's bytes are re-fetchable from the spill file, the failure's lesson is not).
223
223
  const byLargest = out
224
224
  .map((m, i) => ({ i, len: m.role === "tool" && i < limit && !isShedStub(m.content) ? m.content.length : 0, err: /^(error[:\s]|\(no output; exit)/i.test(m.content) }))
@@ -1,7 +1,8 @@
1
1
  /** The team from settings.moa, new shape or the pre-10/31 one (aggregator → planner, first other proposer →
2
2
  * specialist). Undefined when no planner is configured. A missing specialist falls back to the planner itself. */
3
3
  export function moaTeam(cfg) {
4
- const planner = cfg?.planner ?? cfg?.aggregator;
4
+ const byId = cfg?.plannerModel?.trim();
5
+ const planner = byId ? { id: byId } : cfg?.planner ?? cfg?.aggregator;
5
6
  if (!planner)
6
7
  return undefined;
7
8
  const specialist = cfg?.specialist?.id?.trim()
@@ -37,7 +37,7 @@ export function servedContextLimit(err) {
37
37
  return Number.isFinite(n) && n > 0 ? n : undefined;
38
38
  }
39
39
  // A 400 whose body states the endpoint's OUTPUT ceiling: the request's max_tokens is larger than the vendor
40
- // accepts (JL2 2026-10-28, QwenCloud qwen3.8-flash: "Range of max_tokens should be [1, 131072]" while we sent
40
+ // accepts (JL2 2026-10-28, a BYO cloud provider: "Range of max_tokens should be [1, 131072]" while we sent
41
41
  // ~220K). Not a context problem — compacting or failing over can't help — so it gets its own class: retry the
42
42
  // round ONCE at the stated ceiling and remember it for the endpoint. Each pattern captures the ceiling; they
43
43
  // all name max_tokens or output/completion tokens, so a context-length 400 ("maximum context length is N
@@ -33,8 +33,8 @@ function toArgumentsString(v) {
33
33
  return "{}";
34
34
  return typeof raw === "string" ? raw : JSON.stringify(raw);
35
35
  }
36
- /** Parse Qwen XML: <function=NAME><parameter=P>V</parameter>...</function> from inside a <tool_call> body. */
37
- function parseQwenXmlFunction(body) {
36
+ /** Parse the XML function-call format: <function=NAME><parameter=P>V</parameter>...</function> from inside a <tool_call> body. */
37
+ function parseXmlFunctionCall(body) {
38
38
  const fnMatch = /<function=([^>]+)>([\s\S]*?)<\/function>/.exec(body);
39
39
  if (!fnMatch)
40
40
  return null;
@@ -128,7 +128,7 @@ export function recoverToolCalls(content) {
128
128
  const calls = [];
129
129
  let remaining = "";
130
130
  let cursor = 0;
131
- // Pass 1: <tool_call>...</tool_call> — try JSON first, then Qwen XML.
131
+ // Pass 1: <tool_call>...</tool_call> — try JSON first, then the XML function-call format.
132
132
  const tagRe = /<tool_call>([\s\S]*?)<\/tool_call>/g;
133
133
  let m;
134
134
  while ((m = tagRe.exec(content))) {
@@ -144,7 +144,7 @@ export function recoverToolCalls(content) {
144
144
  }
145
145
  }
146
146
  catch {
147
- const xml = parseQwenXmlFunction(body);
147
+ const xml = parseXmlFunctionCall(body);
148
148
  if (xml) {
149
149
  calls.push(buildToolCall(xml.name, xml.args));
150
150
  recognized = true;
@@ -154,13 +154,13 @@ export function recoverToolCalls(content) {
154
154
  remaining += m[0]; // unrecognized — leave it visible rather than silently eating it
155
155
  }
156
156
  remaining += content.slice(cursor);
157
- // Pass 1b: a Qwen XML <function=NAME>...</function> whose <tool_call> opener went missing (the opener can land in
157
+ // Pass 1b: an XML <function=NAME>...</function> whose <tool_call> opener went missing (the opener can land in
158
158
  // the reasoning channel while the rest streams as content).
159
159
  const bareFn = /<function=([^>]+)>([\s\S]*?)<\/function>/g;
160
160
  let bare = "";
161
161
  let bareCursor = 0;
162
162
  while ((m = bareFn.exec(remaining))) {
163
- const xml = parseQwenXmlFunction(m[0]);
163
+ const xml = parseXmlFunctionCall(m[0]);
164
164
  if (!xml)
165
165
  continue;
166
166
  bare += remaining.slice(bareCursor, m.index);
package/dist/index.js CHANGED
@@ -26,5 +26,8 @@ export { registry, toSchemas } from "./tools/registry.js";
26
26
  export { McpHub, withMcp } from "./mcp/index.js";
27
27
  export { loadMcpConfig, upsertMcpServer, mcpWritePath } from "./mcp/config.js";
28
28
  export { McpHttpClient } from "./mcp/client.js";
29
+ // Agents still working at quit (background/resume.ts): the saved records and the quit summary every surface shows.
30
+ export { listResumable, quitSummary, resumeOnReopen, saveResumable, clearResumable } from "./background/resume.js";
31
+ export { toRemoteAgents } from "./remote/host.js";
29
32
  // UI (kode-web can reuse these Ink components' patterns; kode-web renders its own React DOM tree)
30
33
  export { App } from "./ui/index.js";
@@ -0,0 +1,30 @@
1
+ import { PHONE_ACTION_NAMES, PHONE_TOOLS } from "../tools/device/tools.js";
2
+ const PROTOCOL_VERSION = "2025-06-18";
3
+ export function phoneMcpTools(o = {}) {
4
+ return PHONE_TOOLS.filter((t) => o.allowActions || !PHONE_ACTION_NAMES.includes(t.name));
5
+ }
6
+ export async function handlePhoneMcp(req, o = {}) {
7
+ const id = req.id ?? null;
8
+ const ok = (result) => ({ jsonrpc: "2.0", id, result });
9
+ const err = (code, message) => ({ jsonrpc: "2.0", id, error: { code, message } });
10
+ if (req.id === undefined && req.method.startsWith("notifications/"))
11
+ return null;
12
+ switch (req.method) {
13
+ case "initialize":
14
+ return ok({ protocolVersion: PROTOCOL_VERSION, capabilities: { tools: {} }, serverInfo: { name: "operator-phone", version: "0.1.0" } });
15
+ case "ping":
16
+ return ok({});
17
+ case "tools/list":
18
+ return ok({ tools: phoneMcpTools(o).map((t) => ({ name: t.name, description: t.description, inputSchema: t.parameters })) });
19
+ case "tools/call": {
20
+ const name = String(req.params?.name ?? "");
21
+ const tool = phoneMcpTools(o).find((t) => t.name === name);
22
+ if (!tool)
23
+ return err(-32602, PHONE_ACTION_NAMES.includes(name) ? `${name} is an action; start the server with --allow-actions to offer it` : `unknown tool ${name}`);
24
+ const text = await tool.run((req.params?.arguments ?? {}));
25
+ return ok({ content: [{ type: "text", text }], ...(/^(error|Permission denied)/.test(text) ? { isError: true } : {}) });
26
+ }
27
+ default:
28
+ return err(-32601, `method not found: ${req.method}`);
29
+ }
30
+ }
@@ -4,6 +4,8 @@ import { centralRecording } from "../telemetry/ingest.js";
4
4
  import { runBatch, defaultClassify, defaultKeys, cancelledResult } from "../engine/batch-scheduler.js";
5
5
  import { registrySafeTools } from "./tier.js";
6
6
  import { heldForPlanReview } from "./plan-review.js";
7
+ import { isPhoneLine } from "./signature.js";
8
+ import { grantPhone, phonePreview } from "../tools/device/classify.js";
7
9
  export { PermissionPolicy } from "./policy.js";
8
10
  const NO_RETRY = "Do not retry this call or an equivalent; choose another approach or ask the user.";
9
11
  const DENIED = (name, why) => `Permission denied: "${name}" was denied ` +
@@ -62,27 +64,41 @@ export function withPermissions(inner, policy, opts = {}) {
62
64
  // A human-signature line (money/prod/destructive) surfaces as its own control event so a dashboard/
63
65
  // mobile flags WHY a human was pulled in — and a background sub-agent (no approver) is denied below.
64
66
  const line = policy.signatureLineFor(name, args);
65
- const plan = line ? policy.planAnswer(line) : null;
66
- if (line && plan === "hold") {
67
- // Autonomous: the plan the owner approved does not list this class. Held, never prompted, and not remembered as
68
- // a denial — the same call runs once a plan that lists it is approved.
69
- sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name} (held for plan review)` } });
70
- tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
71
- return heldForPlanReview(name, line, policy.approvedPlanClasses());
72
- }
73
- if (plan === "run") {
74
- approved = true; // the owner approved this class with the plan
75
- // still a signature-line call: the dashboard's critical feed shows it ran, and on whose say-so
76
- sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name} (run under approved plan)` } });
77
- }
78
- else {
79
- if (line)
80
- sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name}` } });
81
- approved = opts.approve ? await opts.approve(name, args) : false; // no approver ⇒ fail-safe deny
67
+ if (isPhoneLine(line)) {
68
+ // A phone line: the owner, every time, in every mode — no plan answers it — shown the screen it will act on. The
69
+ // approval becomes a one-shot grant the tool itself checks (tools/device/classify.ts).
70
+ sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name}` } });
71
+ const pv = opts.approve ? await phonePreview(name, args) : {};
72
+ approved = opts.approve ? await opts.approve(name, args, { line, once: true, ...(pv.screenshot ? { preview: pv.screenshot } : {}), ...(pv.target ? { target: pv.target } : {}) }) : false;
82
73
  if (!approved) {
83
74
  tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
84
75
  return refuse(DENIED(name, opts.approve ? "user" : "no-approver"));
85
76
  }
77
+ grantPhone(name, args);
78
+ }
79
+ else {
80
+ const plan = line ? policy.planAnswer(line) : null;
81
+ if (line && plan === "hold") {
82
+ // Autonomous: the plan the owner approved does not list this class. Held, never prompted, and not remembered as
83
+ // a denial — the same call runs once a plan that lists it is approved.
84
+ sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name} (held for plan review)` } });
85
+ tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
86
+ return heldForPlanReview(name, line, policy.approvedPlanClasses());
87
+ }
88
+ if (plan === "run") {
89
+ approved = true; // the owner approved this class with the plan
90
+ // still a signature-line call: the dashboard's critical feed shows it ran, and on whose say-so
91
+ sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name} (run under approved plan)` } });
92
+ }
93
+ else {
94
+ if (line)
95
+ sinkNow()?.emit({ kind: "control", session, actor, control: { event: "signature_required", detail: `${line}: ${name}` } });
96
+ approved = opts.approve ? await opts.approve(name, args) : false; // no approver ⇒ fail-safe deny
97
+ if (!approved) {
98
+ tool({ name, args: digest, decision, outcome: "denied", approved: false, ...batch }, argHash);
99
+ return refuse(DENIED(name, opts.approve ? "user" : "no-approver"));
100
+ }
101
+ }
86
102
  }
87
103
  }
88
104
  // An esc during the (human) approval wait: the approval may land AFTER the interrupt, and an approved edit
@@ -8,6 +8,8 @@
8
8
  // Precedence: a signature line beats a per-tool "allow" rule and the mode — it can only ever be relaxed by
9
9
  // the policy being fully inert (the local owner in bypass+admin+no-rules, where the wrapper is skipped
10
10
  // entirely). The moment any enforcement is on (a tier, audit/gated mode, or a rule), the lines are live.
11
+ import { phoneLine, PHONE_LINES } from "../tools/device/classify.js";
12
+ export const isPhoneLine = (l) => !!l && PHONE_LINES.includes(l);
11
13
  // Tool-NAME patterns: money-moving integrations (mostly MCP tools) — pay/charge/refund/payout/transfer/
12
14
  // wire/invoice/billing/subscription changes. Conservative: a false positive just adds one approval.
13
15
  const MONEY_NAME = /(pay(ment|out|ee)?|charge|refund|transfer|wire|invoice|billing|subscription|checkout|stripe|disburse)/i;
@@ -61,6 +63,9 @@ function blob(name, args) {
61
63
  /** Which signature line a call crosses, or null. Checked on every gated call: null lets the normal
62
64
  * policy decide; a non-null value forces approval (and, absent an approver, a deny). */
63
65
  export function signatureLine(name, args) {
66
+ const phone = phoneLine(name, args);
67
+ if (phone)
68
+ return phone;
64
69
  if (MONEY_NAME.test(name))
65
70
  return "money";
66
71
  const b = blob(name, args);