@oalo-ai/cli 0.5.1 → 0.7.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.
package/src/help.js CHANGED
@@ -19,7 +19,7 @@ export const TOKENS = [
19
19
  kind: "cli",
20
20
  where: "`oalo login`, or dashboard -> Account -> CLI & agents",
21
21
  plane: "control (the build surface)",
22
- usedBy: ["whoami", "tail", "call", "run", "emit", "data", "tokens", "docs", "apps", "deploy", "env", "logs", "secrets", "loops", "flows", "pull", "status", "lint", "push", "qa", "rehearse", "bots", "sources", "machines", "mcp"],
22
+ usedBy: ["whoami", "tail", "call", "run", "emit", "data", "db", "metrics", "dashboards", "usage", "inbox", "crm", "products", "channels", "incidents", "tokens", "docs", "apps", "setup", "build", "migrate", "dockerfile", "deploy", "env", "logs", "secrets", "loops", "flows", "pull", "status", "lint", "push", "qa", "rehearse", "bots", "sources", "machines", "mcp"],
23
23
  warning: "Acts as you, with exactly your permissions. No read-only mode. Treat it like a password.",
24
24
  },
25
25
  ];
@@ -71,7 +71,7 @@ export const COMMANDS = [
71
71
  flags: [
72
72
  { flag: "--server <url>", desc: "Workspace URL, e.g. https://acme.oalo.ai" },
73
73
  { flag: "--token <token>", desc: "Sync token (data plane). Not needed after oalo login, which saved one." },
74
- { flag: "--cli-token <token>", desc: "CLI token (control plane), for tail and mcp. Optional." },
74
+ { flag: "--cli-token <token>", desc: "CLI token (control plane) for management commands, tail, and mcp. Can be used alone without --token." },
75
75
  { flag: "--app <slug>", desc: "The app that deploy, env, logs, secrets and dockerfile use when you don't pass --app (`oalo apps` lists them). `oalo deploy --new` sets it." },
76
76
  { flag: "--env dev|prod", desc: "The project's default env for the commands that read it. Default dev." },
77
77
  { flag: "--status", desc: "Show the current link and re-check reachability." },
@@ -243,6 +243,29 @@ export const COMMANDS = [
243
243
  ],
244
244
  exits: { 0: "done", 1: "failed, or some rows were rejected", 2: "bad arguments or no token" },
245
245
  },
246
+ {
247
+ name: "heal",
248
+ summary: "Inspect runtime errors, run/suggest integration tests, and run or approve self-healing patches (Base or --local).",
249
+ usage: [
250
+ "oalo heal list --app <slug> [--json]",
251
+ "oalo heal inspect <error_id> [--json]",
252
+ "oalo heal run <error_id> [--local] [--mode branch_and_pr|diagnose_only|auto_deploy]",
253
+ "oalo heal approve|reject <heal_id>",
254
+ "oalo heal tests --app <slug> [--env dev|prod]",
255
+ "oalo heal suggest-tests --app <slug> [--auto]",
256
+ ],
257
+ flags: [
258
+ { flag: "--app <slug>", desc: "The app. Default: the one saved with `oalo link --app`." },
259
+ { flag: "--local", desc: "Download the error bundle and switch to a local fix branch instead of running on the Base." },
260
+ { flag: "--auto", desc: "Apply suggested tests immediately into .oalo/tests/smoke.json." },
261
+ { flag: "--json", desc: "Raw JSON output." },
262
+ ],
263
+ notes: [
264
+ "Runs on the Base by default (opening a Forgejo PR in branch_and_pr mode), or pass --local to download the error bundle and patch on your own machine.",
265
+ "High-risk diffs (auth, migrations, billing, >5 files, >200 lines) always require explicit `oalo heal approve` or Dashboard 1-click approval.",
266
+ ],
267
+ exits: { 0: "done", 1: "failed or failing tests", 2: "bad arguments or no token" },
268
+ },
246
269
  {
247
270
  name: "incidents",
248
271
  summary: "A live app's outages and restart bursts, as Oalo's uptime check saw them, newest first.",
@@ -282,8 +305,8 @@ export const COMMANDS = [
282
305
  { flag: "--yes", desc: "restore: go ahead with prod without asking. Needed for prod when there's no terminal to ask at." },
283
306
  ],
284
307
  notes: [
285
- "query reads only: one statement (SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW), run as your app's database login in a read-only transaction that is rolled back, with a 10 second limit. It sees what your app sees at DATABASE_URL: the env's tables, not the platform's. `oalo data` is for Oalo models; this is for any table, your app's own included.",
286
- "Workspace admins only: it holds every member's data. Restore it into any Postgres with psql -f.",
308
+ "query reads only: one statement (SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW), run as your app's database login in a read-only transaction that is rolled back, with a 10 second limit. It sees what your app sees at DATABASE_URL: the env's tables, not the platform's. `oalo data` is for Oalo models; this is for any table, your app's own included. Available to workspace admins and members with Developer access.",
309
+ "dump is workspace admins only: it holds every member's data. Restore it into any Postgres with psql -f.",
287
310
  "Your code is in git (oalo deploy --pull); this is the data. Together they are everything you need to run your apps elsewhere.",
288
311
  "restore loads a dump file made by pg_dump (like Heroku's latest.dump), up to 10 GB, or copies from a database URL. Admins only, and one restore at a time per Base.",
289
312
  "The tables land in the env's schema, owned by the app's database login, so its Procfile `release:` migrations can alter them. Your app reads them at DATABASE_URL.",
@@ -627,12 +650,12 @@ export const COMMANDS = [
627
650
  "Start with `oalo machines add <name>`, which saves this computer's key (step by step: `oalo docs answer-from-your-own-data`). Handlers live in that machine's config, ~/.oalo/serve/<name>.json, never in a project. OALO_HOME moves it.",
628
651
  "oalo serve connects out to your workspace and declares the handlers; nothing listens on this computer and no port is opened. Each handler becomes a workspace tool with the handler's name: give it to a bot with `oalo bots tools <bot> --add <handler>`. A name another tool already has is skipped, and oalo serve says so. A handler name is lowercase letters, digits and underscores, up to 48, starting with a letter.",
629
652
  "It prints one line per request: the time, the handler, how long it took, ok or the error, and the sizes in and out. Never what was asked or answered, which can be customer data. If the connection drops it reconnects, waiting 1 s, then 2, 4, up to 30.",
630
- "folder: keyword search over the folder's .md, .markdown, .txt, .csv, .tsv, .json, .html and .htm files. Hidden files and folders, node_modules, files over 2 MB and links that lead outside the folder are skipped; nothing outside it is read. Markdown is split by heading and paragraph, a CSV or TSV one row at a time with its header line. Accents don't matter: devolucion finds devolución. The bot sends {\"query\", \"limit\"} (limit 1 to 10, default 5) and gets back {\"results\": [{\"file\", \"snippet\", \"score\"}]}. Edits are picked up on the next request.",
653
+ "folder: keyword search over 29 supported text and code extensions (.md, .markdown, .txt, .csv, .tsv, .json, .jsonl, .html, .htm, .xml, .yaml, .yml, .toml, .ini, .sql, .js, .ts, .py, .ex, .go, .rs, .rb, .sh, .css, and more). Hidden files and folders, node_modules, files over 2 MB and links that lead outside the folder are skipped; nothing outside it is read. Markdown is split by heading and paragraph, a CSV or TSV one row at a time with its header line. Accents don't matter: devolucion finds devolución. The bot sends {\"query\", \"limit\"} (limit 1 to 10, default 5) and gets back {\"results\": [{\"file\", \"snippet\", \"score\"}]}. Edits are picked up on the next request.",
631
654
  "command: the program gets {\"input\": {...}, \"context\": {...}} on stdin and prints one JSON object on stdout, which is the answer. context has surface (chat, flow or loop), bot, conversation and member: the verified id of the person chatting, so a script can return only their own orders. A flow step adds the flow's name, a loop step the loop's name and the run's contact. Use it, never a name or id the person typed. A non-zero exit or output that isn't a JSON object is an error the bot sees, with the last line the program wrote to stderr. Its environment is yours minus every OALO_ variable.",
632
- "An answer is at most 64 KB; a bigger one is refused as \"output too large\". The answer goes into the bot's reply, so it passes through Oalo and the bot's model for that message. The folder or the program's data stays here.",
655
+ "An answer is at most 1 MB; a bigger one is refused as \"output too large\". The answer goes into the bot's reply, so it passes through Oalo and the bot's model for that message. The folder or the program's data stays here.",
633
656
  "test runs a handler here, with no connection, and prints exactly what the bot would get. Try every handler with it before a bot uses it.",
634
657
  "install writes a launchd agent (macOS, ~/Library/LaunchAgents/ai.oalo.serve.<name>.plist) or a systemd user unit (Linux, ~/.config/systemd/user/oalo-serve-<name>.service) that runs oalo serve --machine <name> at login and restarts it if it stops, then prints the one command that starts it. It never runs launchctl or systemctl itself.",
635
- "model: runs your bots on a model server on this computer or your network (Ollama, vLLM, LM Studio, anything OpenAI-compatible). It isn't a tool: the workspace sends a model id and a chat request, never an address, and this computer forwards it to the --base-url in its own config and streams the reply back. add reads the server's models (and, for Ollama, each model's window and whether it sees images); run it again with the same name to update them. Ollama serves a smaller window than a model's maximum unless OLLAMA_CONTEXT_LENGTH or num_ctx is raised, so add says so, and the workspace's model check finds the real one. test sends one message the way the workspace would, thinking off, and prints the reply, the time to the first token and tokens per second: oalo serve test <name> '{\"model\": \"qwen3:14b\", \"message\": \"Say hi in five words\"}'. Each model call is one line: the time, the handler, the model, how long, the first token, tokens in and out. Never the conversation. Before a bot can use a model, the workspace checks it through the same path a member's message takes: it must call a made-up lookup tool and answer from it (6 of 6), pick the right one of three tools, refuse to run commands or read files, never reply with nothing, find facts far back in a long conversation, and return a form's fields as JSON. A model that can't call tools fails, and so does one whose server really reads fewer than 8,192 tokens (raise OLLAMA_CONTEXT_LENGTH or num_ctx, then add the model again with --context so it's checked again). The check starts by itself when oalo serve first declares a model and takes a few minutes per model; `oalo machines` shows the result. Then set the bot to the model: oalo bots settings <bot> set provider=opencode model=<the id oalo machines shows>. If this computer is off when a bot needs the model, the member gets a short apology and the workspace an incident. The whole walkthrough: `oalo docs run-your-bot-on-your-own-model`.",
658
+ "model: runs your bots on a model server on this computer or your network (Ollama, vLLM, LM Studio, anything OpenAI-compatible). It isn't a tool: the workspace sends a model id and a chat request, never an address, and this computer forwards it to the --base-url in its own config and streams the reply back. add reads the server's models (and, for Ollama, each model's window and whether it sees images); run it again with the same name to update them. Ollama serves a smaller window than a model's maximum unless OLLAMA_CONTEXT_LENGTH or num_ctx is raised, so add says so, and the workspace's model check finds the real one. test sends one message the way the workspace would, thinking off, and prints the reply, the time to the first token and tokens per second: oalo serve test <name> '{\"model\": \"qwen3:14b\", \"message\": \"Say hi in five words\"}'. Each model call is one line: the time, the handler, the model, how long, the first token, tokens in and out. Never the conversation. Before a bot can use a model, the workspace checks it through the same path a member's message takes: it must call a made-up lookup tool and answer from it (6 of 6), pick the right one of three tools, refuse to run commands or read files, never reply with nothing, find facts far back in a long conversation, and return a form's fields as JSON. A model that can't call tools fails by default, and so does one whose server really reads fewer than 8,192 tokens (raise OLLAMA_CONTEXT_LENGTH or num_ctx, then add the model again with --context so it's checked again); workspace admins can explicitly override the gate with `oalo machines allow <byo-id>` (or `--off` to re-lock). The check starts by itself when oalo serve first declares a model and takes a few minutes per model; `oalo machines` shows the result. Then set the bot to the model: oalo bots settings <bot> set provider=opencode model=<the id oalo machines shows>. If this computer is off when a bot needs the model, the member gets a short apology and the workspace an incident. The whole walkthrough: `oalo docs run-your-bot-on-your-own-model`.",
636
659
  "After add or remove, restart oalo serve so the workspace sees the change.",
637
660
  "Flows and loops can call a handler too, with a remote_step (\"On your machine\" in the editor). The step waits for the answer without holding anything open, and a step that started while this computer was off is sent when oalo serve connects. The handler's own --timeout still limits each run.",
638
661
  ],
@@ -739,10 +762,11 @@ export const COMMANDS = [
739
762
  { flag: "--json", desc: "The plan as JSON: names only, never a value." },
740
763
  ],
741
764
  notes: [
742
- "Run it in the app's repo. It reads fly.toml, railway.json or railway.toml, render.yaml, app.json and the Procfile, and asks the platform's CLI for variables (heroku, railway), secret names (fly) and dyno sizes (heroku) when it's installed and signed in.",
765
+ "Run it in the app's repo. Your existing host keeps serving traffic with zero downtime until you point DNS at Oalo.",
766
+ "It reads fly.toml, railway.json or railway.toml, render.yaml, app.json and the Procfile, and asks the platform's CLI for variables (heroku, railway), secret names (fly) and dyno sizes (heroku) when it's installed and signed in.",
743
767
  "Variables: PORT and each platform's own (HEROKU_*, RAILWAY_*, RENDER_*, FLY_*) are left out, and DATABASE_URL becomes EXTERNAL_DATABASE_URL, since DATABASE_URL on Oalo is the Base's own Postgres. Values are never printed or written to a file; --apply sends them to prod without restarting the app.",
744
- "It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large.",
745
- "The order: oalo migrate <platform> (read the plan), --apply, commit, oalo deploy --new, oalo migrate <platform> --apply again (now the app exists, it sets the variables), then the data (oalo db restore) and oalo deploy --env prod. `oalo docs migrating-from-<platform>` walks through it.",
768
+ "It says what doesn't carry over: cron jobs, volumes and disks, private addresses (*.railway.internal, *.flycast), extra replicas, build commands, an Aptfile, a VM bigger than large (2 CPUs, 4 GB).",
769
+ "Exact execution order: (1) Ensure Node apps have a committed lockfile (package-lock.json, yarn.lock or pnpm-lock.yaml) and a Procfile `web:` line listening on $PORT (or package.json start). (2) Run `oalo migrate <platform> [--from-app <name>]` to inspect the plan and warnings. (3) Run `oalo migrate <platform> [--from-app <name>] --apply` to write Procfile / .oalo/app.json with mapped sizes. (4) Commit those files (`git add Procfile .oalo/app.json && git commit`). (5) Run `oalo deploy --new <slug>` to create the app and dev preview (if deploy updates .gitignore, commit .gitignore). (6) Run `oalo migrate <platform> [--from-app <name>] --apply` a second time to push prod variables now that the app exists. (7) Optionally move Postgres with `oalo db restore --from-env SOURCE_DATABASE_URL --env prod --check` then without `--check`, unset EXTERNAL_DATABASE_URL, and run `oalo deploy --app <slug> --env prod`. See `oalo docs migrating-from-<platform>`.",
746
770
  ],
747
771
  exits: { 0: "the plan was shown, or applied", 1: "a config file couldn't be read, or the variables couldn't be set", 2: "bad arguments, an unknown platform, or no CLI token" },
748
772
  },
@@ -840,23 +864,74 @@ export const COMMANDS = [
840
864
  "oalo loops delete <name>",
841
865
  "oalo loops runs [<name>] [--limit N] [--json]",
842
866
  "oalo loops runs --id <run> [--json]",
867
+ "oalo loops replay <run-id> --from <node-id> [--input <json|@file.json>] [--json]",
843
868
  ],
844
869
  flags: [
845
870
  { flag: "--sample latest|example", desc: "Test with the loop's most recent real event, or one built from its trigger's fields." },
846
- { flag: "--input <json|@file>", desc: "Test with this input instead: an event envelope {type, contact_id, payload}; for a loop an app calls (an api trigger), {\"type\": \"api\", \"payload\": {<its input fields>}}; or what a scheduled loop's first step reads." },
871
+ { flag: "--input <json|@file>", desc: "Test or replay with this input instead: an event envelope {type, contact_id, payload}; for replay, overrides the input handed to the --from step." },
872
+ { flag: "--from <node-id>", desc: "replay: the step id to start replaying from, restoring all prior steps' outputs from that run." },
847
873
  { flag: "--app <slug>", desc: "Only for a loop pinned to one app: that app's slug (`oalo apps`) or id. Works with test, runs, on, off and delete." },
848
874
  { flag: "--id <run>", desc: "runs: one run step by step, with each step's output." },
849
875
  { flag: "--limit N", desc: "runs: at most this many (default 20)." },
850
- { flag: "--json", desc: "Print the test result as JSON." },
876
+ { flag: "--json", desc: "Print the result as JSON." },
851
877
  ],
852
878
  notes: [
853
879
  "A test runs every step. Steps that send messages or change records are simulated, and their output says what they would have done. Custom tools and AI steps run for real. It works on a loop that is off.",
880
+ "replay restores every prior step's output from the original run and re-executes from `--from <node-id>` onward as a new run (`trigger_kind: replay`). Pass `--input` to edit the input handed to that step.",
854
881
  "A message step (email, WhatsApp, SMS, team chat) shows its rendered text whole: subject, body, text. Other outputs show up to 2,000 characters on one line; --json has everything.",
855
882
  "A loop that is on runs for real whenever its triggers fire. Starting a run now, for real: `oalo run loop <name>`.",
856
883
  "Deleting can't be undone; turning a loop off keeps it.",
857
884
  ],
858
885
  exits: { 0: "done (a test passed)", 1: "refused, failed, or the test run failed", 2: "bad arguments or no CLI token" },
859
886
  },
887
+ {
888
+ name: "usage",
889
+ summary: "Show month-to-date AI spend breakdown by bot, workflow loop, and top-spending conversations.",
890
+ usage: ["oalo usage [--json]"],
891
+ flags: [{ flag: "--json", desc: "Print the raw usage ledger payload (mtd, by_bot, by_loop, top_conversations, daily) as JSON." }],
892
+ notes: [
893
+ "Reads the workspace's cost ledger (`usage:ledger`), showing per-bot, per-workflow, and top conversation AI spend.",
894
+ ],
895
+ exits: { 0: "printed", 1: "refused or failed", 2: "no CLI token" },
896
+ },
897
+ {
898
+ name: "inbox",
899
+ summary: "Work in the live team Inbox: list threads, add internal whisper notes, draft AI Copilot replies, and manage `/` saved replies.",
900
+ usage: [
901
+ "oalo inbox list [--limit N] [--json]",
902
+ 'oalo inbox note <conversation-id> "<text>" [--json]',
903
+ 'oalo inbox draft <conversation-id> [--hint "<guidance>"] [--json]',
904
+ "oalo inbox replies [list] [--json]",
905
+ 'oalo inbox replies set <shortcut> "<body...>" [--title "..."] [--json]',
906
+ "oalo inbox replies delete <id> [--json]",
907
+ ],
908
+ flags: [
909
+ { flag: "--limit N", desc: "list: max conversations to fetch (default 20)." },
910
+ { flag: "--hint <text>", desc: "draft: optional steering guidance for the AI Copilot draft." },
911
+ { flag: "--title <text>", desc: "replies set: optional display title for the `/` saved reply." },
912
+ { flag: "--json", desc: "Print raw JSON." },
913
+ ],
914
+ notes: [
915
+ "Internal notes (`oalo inbox note`) are team-only whisper notes: never sent to the customer and never shown to the bot LLM.",
916
+ "Drafts (`oalo inbox draft`) generate a suggested reply from the transcript, bot persona, and knowledge base without sending anything.",
917
+ "Saved replies (`oalo inbox replies`) are org-wide `/` quick replies available to every teammate with Inbox access.",
918
+ ],
919
+ exits: { 0: "done", 1: "refused or failed", 2: "bad arguments or no CLI token" },
920
+ },
921
+ {
922
+ name: "crm",
923
+ summary: "Bulk-import CRM contacts from a CSV file with email/phone deduplication and optional tags.",
924
+ usage: ["oalo crm import <file.csv> [--tags a,b] [--dry-run] [--json]"],
925
+ flags: [
926
+ { flag: "--tags <a,b>", desc: "Comma-separated tags to apply to every imported contact." },
927
+ { flag: "--dry-run", desc: "Parse the CSV locally and preview the first 5 rows without writing." },
928
+ { flag: "--json", desc: "Print JSON output." },
929
+ ],
930
+ notes: [
931
+ "Reads standard CSV headers (`email`, `phone`, `name`, `first_name`, `last_name`, `tags`, `company`, etc.) and upserts via `crm:import_contacts`, deduplicating by email/phone/external_ref.",
932
+ ],
933
+ exits: { 0: "done", 1: "refused or failed", 2: "bad arguments, unreadable file, or no CLI token" },
934
+ },
860
935
  {
861
936
  name: "flows",
862
937
  summary: "Turn a chat flow on or off, or delete it, by bot and flow name, without pulling and pushing it.",
@@ -1013,7 +1088,7 @@ export const COMMANDS = [
1013
1088
  notes: [
1014
1089
  "Add it to Claude Code from the linked project folder: `claude mcp add oalo -- oalo mcp` (or put {\"mcpServers\": {\"oalo\": {\"command\": \"oalo\", \"args\": [\"mcp\"]}}} in .mcp.json). Cursor: the same command and args in its MCP settings.",
1015
1090
  "stdout is the MCP protocol stream. Diagnostics go to stderr.",
1016
- "Exposes a curated tool set plus an oalo_call passthrough; the build surface has ~442 events and mapping them all would wreck tool selection.",
1091
+ "Exposes a curated tool set plus an oalo_call passthrough; the build surface has ~500 events and mapping them all would wreck tool selection.",
1017
1092
  "oalo_describe is a short summary (apps, bots and loops by name, the tool groups, how dev and prod work, the docs index); its section argument pages through the full records. A reply longer than about 60,000 characters has its longest list cut, with a `_cut` note saying how to get the rest (oalo_call takes match and offset; oalo_node_catalog takes node_type).",
1018
1093
  "Reads OALO_URL and OALO_CLI_TOKEN, or falls back to what `oalo link --cli-token` saved.",
1019
1094
  "Needs a CLI token.",
@@ -1025,9 +1100,11 @@ export const COMMANDS = [
1025
1100
  summary: "Several agents on one codebase: a shared task board, a worktree per task, a merge queue. First run: `oalo coord install`.",
1026
1101
  usage: [
1027
1102
  "oalo coord install [--force] [--json]",
1028
- "oalo coord init [--main <branch>] [--test-cmd <cmd>] [--merge auto|manual] [--signal-review]",
1103
+ "oalo coord init [--main <branch>] [--test-cmd <cmd>] [--reviewer <spec>] [--merge auto|manual] [--signal-review]",
1029
1104
  "oalo coord hooks install [--claude] [--opencode]",
1030
1105
  "oalo coord mcp",
1106
+ "oalo coord up [--workers <n>] [--harness <spec>] [--budget <usd>] [--stall-timeout <s>] [--no-auto-merge] [--once] [--json]",
1107
+ "oalo coord import-plan <file.json> [--json]",
1031
1108
  "oalo coord board [--json]",
1032
1109
  "oalo coord events [--follow] [--since <id>] [--json]",
1033
1110
  "oalo coord files [--json] [--main <branch>]",
@@ -1042,11 +1119,18 @@ export const COMMANDS = [
1042
1119
  { flag: "--force", desc: "install: download again even if this version is installed." },
1043
1120
  { flag: "--main <branch>", desc: "init: branch the merge queue integrates into. Default: current branch." },
1044
1121
  { flag: "--test-cmd <cmd>", desc: "init: merge-gate test command. Default: detected (mix test, npm test, ...)." },
1122
+ { flag: "--reviewer <spec>", desc: "init: independent critic harness run before merge lands (e.g. claude:sonnet)." },
1045
1123
  { flag: "--merge auto|manual", desc: "init: manual holds each merge for `approve merge`." },
1046
1124
  { flag: "--signal-review", desc: "init: milestones unblock dependents only after `approve signal`." },
1125
+ { flag: "--workers <n>", desc: "up: max concurrent ephemeral workers (default 2)." },
1126
+ { flag: "--harness <spec>", desc: "up: worker harness spec (claude[:model], opencode[:model], codex[:model], cmd:<shell>)." },
1127
+ { flag: "--budget <usd>", desc: "up: total USD budget ceiling across worker runs." },
1128
+ { flag: "--stall-timeout <s>", desc: "up: kill and recycle a silent worker after this many seconds (default 600)." },
1129
+ { flag: "--no-auto-merge", desc: "up: disable automatic merge queue draining." },
1130
+ { flag: "--once", desc: "up: run one wave of ready tasks then exit." },
1047
1131
  { flag: "--yes", desc: "approve plan: skip the confirmation after the plan is shown." },
1048
1132
  { flag: "--note <text>", desc: "approve/reject proposal: a note the worker sees with the decision." },
1049
- { flag: "--json", desc: "install/board/events/files: machine-readable output." },
1133
+ { flag: "--json", desc: "install/up/import-plan/board/events/files: machine-readable output." },
1050
1134
  { flag: "--follow", desc: "events: keep streaming." },
1051
1135
  { flag: "--all", desc: "merge: keep merging until the queue is idle or blocked." },
1052
1136
  ],
@@ -1073,6 +1157,131 @@ export const COMMANDS = [
1073
1157
  4: "coord isn't installed on this machine; run `oalo coord install`",
1074
1158
  },
1075
1159
  },
1160
+ {
1161
+ name: "ralph",
1162
+ summary: "Fresh-context iterative agent loop against a disk ledger and a machine verifier (`npm test`, `oalo qa`, etc.).",
1163
+ usage: [
1164
+ "oalo ralph --goal <text> --verify <cmd> [--plan <file>] [--harness <spec>] [--max-iters <n>] [--max-cost <usd>] [--commit] [--worktree] [--json]",
1165
+ ],
1166
+ flags: [
1167
+ { flag: "--goal <text>", desc: "Goal for the loop (or pass as positional text)." },
1168
+ { flag: "--verify <cmd>", desc: "Deterministic verifier command that must exit 0." },
1169
+ { flag: "--plan <file>", desc: "Optional markdown checklist; loop continues until no `- [ ]` items remain." },
1170
+ { flag: "--harness <spec>", desc: "Agent harness: claude[:model], opencode[:model], codex[:model], or cmd:<shell>." },
1171
+ { flag: "--max-iters <n>", desc: "Max fresh-context iterations (default 10)." },
1172
+ { flag: "--max-cost <usd>", desc: "Max total USD spend across iterations (default 5.00)." },
1173
+ { flag: "--timeout <s>", desc: "Per-iteration timeout in seconds (default 600)." },
1174
+ { flag: "--commit", desc: "Auto-commit changes when the verifier passes." },
1175
+ { flag: "--worktree", desc: "Run inside an isolated git worktree instead of the current checkout." },
1176
+ { flag: "--json", desc: "Print structured JSON summary." },
1177
+ ],
1178
+ notes: [
1179
+ "Starts a brand-new agent process each iteration so context never drifts. State lives on disk under .oalo/ralph/<run-id>/.",
1180
+ "Pairs directly with `oalo qa <bot> --script suite.json` for autonomous bot and flow iteration.",
1181
+ ],
1182
+ exits: { 0: "verifier passed and plan complete", 1: "iteration or budget limit reached before passing", 2: "bad arguments" },
1183
+ },
1184
+ {
1185
+ name: "race",
1186
+ summary: "Best-of-N competitive racing across isolated git worktrees: compare models on the same task and merge the winner.",
1187
+ usage: [
1188
+ "oalo race <goal> --models <spec1,spec2,...> [--verify <cmd>] [--judge <spec>] [--budget <usd>] [--timeout <s>] [--base <ref>] [--json]",
1189
+ "oalo race status [<run-id>] [--json]",
1190
+ "oalo race pick <run-id> <slot> [--keep] [--json]",
1191
+ "oalo race clean [<run-id>] [--json]",
1192
+ ],
1193
+ flags: [
1194
+ { flag: "--models <list>", desc: "Comma-separated harness specs (use `||` if a `cmd:` spec contains commas)." },
1195
+ { flag: "--verify <cmd>", desc: "Command run in every racer worktree to grade pass/fail." },
1196
+ { flag: "--judge <spec>", desc: "Optional blind read-only LLM judge run when 2+ slots pass, comparing anonymized diffs." },
1197
+ { flag: "--budget <usd>", desc: "Total USD budget split evenly across racers." },
1198
+ { flag: "--base <ref>", desc: "Starting git ref for all racer worktrees (default HEAD)." },
1199
+ { flag: "--keep", desc: "pick: keep losing worktrees and branches after merging the winner." },
1200
+ { flag: "--json", desc: "Machine-readable scoreboard or result." },
1201
+ ],
1202
+ notes: [
1203
+ "Each racer runs in an isolated git worktree under ~/.oalo/worktrees/ so racers never collide.",
1204
+ "Without --judge, the recommended slot is chosen deterministically (passing verify, lowest cost, fewest files changed). With --judge, a read-only judge compares anonymized diffs (Candidate A, B, ...) whenever 2+ slots pass.",
1205
+ "Use `oalo race pick <run-id> <slot>` to merge the winning branch and auto-clean the rest.",
1206
+ ],
1207
+ exits: { 0: "ok", 1: "no passing racer or merge conflict", 2: "bad arguments" },
1208
+ },
1209
+ {
1210
+ name: "review",
1211
+ summary: "Independent adversarial or cross-model diff critic (read-only) with structured JSON verdicts.",
1212
+ usage: [
1213
+ "oalo review [--against <ref>] [--models <spec1,spec2>] [--criteria <text|file>] [--working] [--strict] [--json]",
1214
+ ],
1215
+ flags: [
1216
+ { flag: "--against <ref>", desc: "Base git ref to diff HEAD against (default main or HEAD~1)." },
1217
+ { flag: "--working", desc: "Review uncommitted working-tree changes against HEAD." },
1218
+ { flag: "--models <list>", desc: "One or more critic harness specs run in parallel." },
1219
+ { flag: "--criteria <text|file>", desc: "Acceptance criteria string or newline-delimited file." },
1220
+ { flag: "--strict", desc: "Treat unparseable or failed critic output as request_changes." },
1221
+ { flag: "--json", desc: "Print structured JSON verdict and findings." },
1222
+ ],
1223
+ notes: [
1224
+ "Critics see only the diff and acceptance criteria, never the author's chat history, and run in read-only mode.",
1225
+ "Also plugs into `oalo coord init --reviewer <spec>` to gate merges automatically.",
1226
+ ],
1227
+ exits: { 0: "consensus approve", 1: "request_changes or blocker finding", 2: "bad arguments" },
1228
+ },
1229
+ {
1230
+ name: "swarm",
1231
+ summary: "Lightweight multi-role blackboard swarm for parallel discovery, audits, and design before planning a DAG.",
1232
+ usage: [
1233
+ "oalo swarm <goal> [--team <preset>] [--roles r1[@harness],r2,...] [--rounds <n>] [--harness <spec>] [--budget <usd>] [--json]",
1234
+ "oalo swarm status [<run-id>] [--json]",
1235
+ "oalo swarm promote [<run-id>] [--json]",
1236
+ "oalo swarm roles list [--json]",
1237
+ "oalo swarm roles show <name> [--json]",
1238
+ "oalo swarm roles add <name> --focus <text> [--checklist <a,b,c>] [--harness <spec>] [--global] [--json]",
1239
+ "oalo swarm roles rm <name> [--global] [--json]",
1240
+ ],
1241
+ flags: [
1242
+ { flag: "--team <preset>", desc: "Curated role team: engineering, audit, research, feature, oalo-bot." },
1243
+ { flag: "--roles <list>", desc: "Comma-separated roles, with optional per-role `@harness` override (e.g. architect@claude:opus,skeptic)." },
1244
+ { flag: "--rounds <n>", desc: "Number of blackboard discussion rounds (default 2)." },
1245
+ { flag: "--harness <spec>", desc: "Default agent harness for specialist and synthesizer turns." },
1246
+ { flag: "--readonly", desc: "Keep specialist roles read-only (default true)." },
1247
+ { flag: "--budget <usd>", desc: "Total USD budget cap across rounds." },
1248
+ { flag: "--focus <text>", desc: "roles add: specialist lens and focus instructions." },
1249
+ { flag: "--checklist <list>", desc: "roles add: comma-separated inspection checklist items." },
1250
+ { flag: "--category <name>", desc: "roles add: optional category label (default custom)." },
1251
+ { flag: "--global", desc: "roles add/rm: store in ~/.oalo/roles/ instead of repo .oalo/roles/." },
1252
+ { flag: "--json", desc: "Print structured JSON board, roles, or plan summary." },
1253
+ ],
1254
+ notes: [
1255
+ "Ships with 16 built-in preset roles (architect, backend, frontend, db, security, reliability, performance, testing, devops, ux, simplifier, skeptic, ml-systems, eval-engineer, data-pipeline, prompt-engineer) and 5 team bundles.",
1256
+ "Custom roles live in .oalo/roles/<name>.json (shared with the repo) or ~/.oalo/roles/<name>.json (--global) and can pin their own default harness.",
1257
+ "`oalo swarm promote` imports plan.json directly into `oalo coord` as draft tasks awaiting `oalo coord approve plan`.",
1258
+ ],
1259
+ exits: { 0: "ok", 1: "swarm or promote failed", 2: "bad arguments" },
1260
+ },
1261
+ {
1262
+ name: "auto",
1263
+ summary: "Composable coordination presets (qa-grind, bugfix, audit, feature) and custom .oalo/workflows/*.json packs.",
1264
+ usage: [
1265
+ "oalo auto list [--json]",
1266
+ "oalo auto <preset> <goal> [options]",
1267
+ ],
1268
+ flags: [
1269
+ { flag: "--verify <cmd>", desc: "Machine verifier passed to ralph/race stages." },
1270
+ { flag: "--harness <spec>", desc: "Default harness for agent stages." },
1271
+ { flag: "--models <list>", desc: "Model list for race/review stages." },
1272
+ { flag: "--judge <spec>", desc: "bugfix: optional blind LLM judge when 2+ racers pass." },
1273
+ { flag: "--team <preset>", desc: "Curated role team for swarm stages." },
1274
+ { flag: "--roles <list>", desc: "Specialist roles for swarm stages." },
1275
+ { flag: "--auto-pick", desc: "bugfix: automatically merge the recommended passing racer." },
1276
+ { flag: "--auto-approve", desc: "feature: approve the promoted coord plan (human terminal only)." },
1277
+ { flag: "--json", desc: "Print structured JSON stage results." },
1278
+ ],
1279
+ notes: [
1280
+ "Built-in presets: qa-grind (ralph), bugfix (race), audit (read-only swarm), feature (swarm -> promote -> coord up).",
1281
+ "Add project-specific packs as JSON files in .oalo/workflows/<name>.json.",
1282
+ ],
1283
+ exits: { 0: "all stages passed", 1: "a stage failed or stopped for human action", 2: "bad arguments" },
1284
+ },
1076
1285
  ];
1077
1286
 
1078
1287
  /**
@@ -1096,6 +1305,7 @@ export const ENV_VARS = [
1096
1305
  { name: "OALO_SYNC_TOKEN", desc: "Sync token; overrides the stored one." },
1097
1306
  { name: "OALO_CLI_TOKEN", desc: "CLI token; overrides the stored one." },
1098
1307
  { name: "OALO_HOME", desc: "Relocate the credential store (CI, containers, tests)." },
1308
+ { name: "OALO_AGENT_HARNESS", desc: "Default headless agent harness for coord up, ralph, race, review, swarm, auto." },
1099
1309
  { name: "OALO_DEBUG", desc: "Log channel transport activity to stderr." },
1100
1310
  { name: "NO_COLOR", desc: "Disable colour in tail output." },
1101
1311
  ];
package/src/index.js CHANGED
@@ -29,6 +29,7 @@ import { sources } from "./commands/sources.js";
29
29
  import { setup } from "./commands/setup.js";
30
30
  import { build } from "./commands/build.js";
31
31
  import { incidents } from "./commands/incidents.js";
32
+ import { heal } from "./commands/heal.js";
32
33
  import { channels } from "./commands/channels.js";
33
34
  import { products } from "./commands/products.js";
34
35
  import { metrics, dashboards } from "./commands/metrics.js";
@@ -37,6 +38,14 @@ import { migrate } from "./commands/migrate.js";
37
38
  import { coordInstall, coordRun } from "./commands/coord-bin.js";
38
39
  import { machines } from "./commands/machines.js";
39
40
  import { serve } from "./commands/serve.js";
41
+ import { usage } from "./commands/usage.js";
42
+ import { inbox } from "./commands/inbox.js";
43
+ import { crm } from "./commands/crm.js";
44
+ import { ralph } from "./commands/ralph.js";
45
+ import { race } from "./commands/race.js";
46
+ import { review } from "./commands/review.js";
47
+ import { swarm } from "./commands/swarm.js";
48
+ import { auto } from "./commands/auto.js";
40
49
  import { existsSync } from "node:fs";
41
50
  import { overview, commandHelp, helpJson, COMMANDS } from "./help.js";
42
51
  import { parse } from "./args.js";
@@ -175,6 +184,9 @@ async function dispatch(cmd) {
175
184
  case "incidents":
176
185
  await incidents(flags, rest);
177
186
  break;
187
+ case "heal":
188
+ await heal(flags, rest);
189
+ break;
178
190
  case "channels":
179
191
  await channels(flags, rest);
180
192
  break;
@@ -187,6 +199,30 @@ async function dispatch(cmd) {
187
199
  case "dashboards":
188
200
  await dashboards(flags, rest);
189
201
  break;
202
+ case "usage":
203
+ await usage(flags, rest);
204
+ break;
205
+ case "inbox":
206
+ await inbox(flags, rest);
207
+ break;
208
+ case "crm":
209
+ await crm(flags, rest);
210
+ break;
211
+ case "ralph":
212
+ await ralph(flags, rest);
213
+ break;
214
+ case "race":
215
+ await race(flags, rest);
216
+ break;
217
+ case "review":
218
+ await review(flags, rest);
219
+ break;
220
+ case "swarm":
221
+ await swarm(flags, rest);
222
+ break;
223
+ case "auto":
224
+ await auto(flags, rest);
225
+ break;
190
226
  case "db":
191
227
  await db(flags, rest);
192
228
  break;
@@ -17,11 +17,12 @@ export const TOOL_GROUPS = {
17
17
  "look around": ["oalo_describe", "oalo_list_apps", "oalo_list_bots", "oalo_get_bot", "oalo_list_loops", "oalo_docs", "oalo_jobs"],
18
18
  "chat flows": ["oalo_node_catalog", "oalo_list_flows", "oalo_get_flow", "oalo_lint_flow", "oalo_save_flow", "oalo_set_flow_enabled", "oalo_delete_flow", "oalo_test_conversation", "oalo_flow_runs", "oalo_get_conversation"],
19
19
  "loops (workflows)": ["oalo_get_loop", "oalo_lint_loop", "oalo_save_loop", "oalo_loop_triggers", "oalo_test_loop", "oalo_loop_runs", "oalo_set_loop_enabled", "oalo_run_loop_now", "oalo_delete_loop", "oalo_emit", "oalo_loop_docs"],
20
- "data": ["oalo_list_models", "oalo_create_model", "oalo_read_rows", "oalo_write_rows", "oalo_promote_model", "oalo_db_query", "oalo_query_metrics", "oalo_sync_routes", "oalo_list_dashboards", "oalo_save_dashboard_widget"],
20
+ "data": ["oalo_list_models", "oalo_create_model", "oalo_read_rows", "oalo_write_rows", "oalo_promote_model", "oalo_db_query", "oalo_query_metrics", "oalo_sync_routes", "oalo_list_dashboards", "oalo_save_dashboard_widget", "oalo_sources"],
21
21
  "code tools": ["oalo_list_functions", "oalo_generate_tool", "oalo_get_tool_source", "oalo_save_tool_source", "oalo_tool_templates", "oalo_bot_tools"],
22
- "apps": ["oalo_app_logs", "oalo_releases"],
22
+ "apps": ["oalo_app_logs", "oalo_releases", "oalo_incidents", "oalo_secrets"],
23
23
  "channels and sales": ["oalo_widgets", "oalo_wa_templates", "oalo_rehearse_inbound", "oalo_pipelines"],
24
24
  "knowledge graph": ["oalo_knowledge_search", "oalo_knowledge_graph", "oalo_knowledge_edit"],
25
+ "own models": ["oalo_model_endpoints"],
25
26
  "anything else": ["oalo_call"],
26
27
  };
27
28
 
package/src/mcp/tools.js CHANGED
@@ -627,7 +627,7 @@ export const TOOLS = [
627
627
  {
628
628
  name: "oalo_knowledge_edit",
629
629
  description:
630
- "Create, update, or delete curated nodes and edges in a bot's knowledge graph. Actions: create_node, update_node, delete_node, create_edge, delete_edge.",
630
+ "Create, update, or delete nodes and edges in a bot's knowledge graph. Actions: create_node, update_node (curated, imported, and kb_section nodes), delete_node (curated and imported nodes), create_edge, delete_edge (any edge).",
631
631
  inputSchema: S(
632
632
  {
633
633
  action: {
@@ -748,7 +748,7 @@ export const TOOLS = [
748
748
  {
749
749
  name: "oalo_db_query",
750
750
  description:
751
- "One read-only SQL statement against an env's tables, as the app's own database login sees them (the server apps' own tables and the Oalo models; not the platform's). Use it to check rows an app wrote to its own table, which oalo_read_rows can't see (it reads Oalo models only). SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW; run in a read-only transaction that is rolled back, 10 second limit. List the tables with: select relname from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = current_schema() and relkind = 'r'. Workspace admins only. Rows can hold customers' details: never repeat those. Read-only.",
751
+ "One read-only SQL statement against an env's tables, as the app's own database login sees them (the server apps' own tables and the Oalo models; not the platform's). Use it to check rows an app wrote to its own table, which oalo_read_rows can't see (it reads Oalo models only). SELECT, WITH, TABLE, VALUES, EXPLAIN or SHOW; run in a read-only transaction that is rolled back, 10 second limit. List the tables with: select relname from pg_class c join pg_namespace n on n.oid = c.relnamespace where n.nspname = current_schema() and relkind = 'r'. Workspace admins and members with Developer access. Rows can hold customers' details: never repeat those. Read-only.",
752
752
  inputSchema: S(
753
753
  {
754
754
  sql: { type: "string", description: "One statement" },
@@ -863,6 +863,88 @@ export const TOOLS = [
863
863
  inputSchema: S({}),
864
864
  run: async (_oalo, _args, ctx) => routes(readSide(ctx)),
865
865
  },
866
+ {
867
+ name: "oalo_sources",
868
+ description:
869
+ "Manage workspace data sources (webhook feeds, scheduled HTTP/Postgres pulls, or bot knowledge feeds). Actions: list, get, create, set_fields, set_retention, set_fetch, fetch_now, rotate, delete, remove_document.",
870
+ inputSchema: S(
871
+ {
872
+ action: {
873
+ type: "string",
874
+ enum: ["list", "get", "create", "set_fields", "set_retention", "set_fetch", "fetch_now", "rotate", "delete", "remove_document"],
875
+ },
876
+ name: { type: "string", description: "Source name (required for all actions except list)" },
877
+ params: { type: "object", description: "Additional parameters for create / set_fetch / set_fields / set_retention / delete / remove_document" },
878
+ },
879
+ ["action"],
880
+ ),
881
+ run: async (oalo, { action, name, params = {} }) => {
882
+ if (action === "list") return oalo.call("sources:list", {});
883
+ if (!name) throw new Error(`name is required for action=${action}`);
884
+ const payload = { ...params, name };
885
+ if (action === "fetch_now") return oalo.call("sources:fetch_now", payload, 120_000);
886
+ return oalo.call(`sources:${action}`, payload);
887
+ },
888
+ mutates: true,
889
+ },
890
+ {
891
+ name: "oalo_incidents",
892
+ description: "List uptime outages and restart bursts recorded for a live app (`app` slug or id).",
893
+ inputSchema: S({ app: { type: "string", description: "App slug or id" } }, ["app"]),
894
+ event: "incidents:list",
895
+ },
896
+ {
897
+ name: "oalo_secrets",
898
+ description:
899
+ "List leaked secrets detected in an app's git history (action=list) or dismiss a false positive by fingerprint (action=dismiss).",
900
+ inputSchema: S(
901
+ {
902
+ action: { type: "string", enum: ["list", "dismiss"] },
903
+ app: { type: "string", description: "App slug or id" },
904
+ all: { type: "boolean", description: "Include already-dismissed findings (action=list)" },
905
+ fingerprint: { type: "string", description: "Finding fingerprint to dismiss (action=dismiss)" },
906
+ },
907
+ ["action", "app"],
908
+ ),
909
+ run: async (oalo, { action, app, all, fingerprint }) => {
910
+ if (action === "dismiss") {
911
+ if (!fingerprint) throw new Error("fingerprint is required for action=dismiss");
912
+ return oalo.call("secrets:dismiss", { app, fingerprint });
913
+ }
914
+ return oalo.call("secrets:list", { app, all: all === true });
915
+ },
916
+ mutates: true,
917
+ },
918
+ {
919
+ name: "oalo_model_endpoints",
920
+ description:
921
+ "Manage workspace own-model endpoints (`oalo serve` machines and custom HTTPS OpenAI-compatible endpoints) and ModelCheck verification. Actions: list, get, create_https, switch, set_fallback, set_model, remove, check_start, check_status.",
922
+ inputSchema: S(
923
+ {
924
+ action: {
925
+ type: "string",
926
+ enum: ["list", "get", "create_https", "switch", "set_fallback", "set_model", "remove", "check_start", "check_status"],
927
+ },
928
+ id: { type: "string", description: "Endpoint id (mep_...) for get, switch, set_fallback, set_model, remove, check_start, check_status" },
929
+ model_id: { type: "string", description: "Model id on the endpoint for set_model, check_start, check_status" },
930
+ params: { type: "object", description: "Additional fields (e.g. name, base_url, server, key, models for create_https; status/force for switch; fallback for set_fallback; context/output/vision/thinking/allow_unverified for set_model; mode for check_start)" },
931
+ },
932
+ ["action"],
933
+ ),
934
+ run: async (oalo, { action, id, model_id, params = {} }) => {
935
+ if (action === "list") return oalo.call("model_endpoints:list", {});
936
+ if (action === "create_https") return oalo.call("model_endpoints:create_https", params);
937
+ if (!id) throw new Error(`id is required for action=${action}`);
938
+ if (action === "check_start" || action === "check_status") {
939
+ if (!model_id) throw new Error(`model_id is required for action=${action}`);
940
+ const ev = action === "check_start" ? "model_check:start" : "model_check:status";
941
+ return oalo.call(ev, { ...params, endpoint_id: id, model_id });
942
+ }
943
+ const payload = { ...params, id, ...(model_id ? { model_id } : {}) };
944
+ return oalo.call(`model_endpoints:${action}`, payload);
945
+ },
946
+ mutates: true,
947
+ },
866
948
  {
867
949
  name: "oalo_call",
868
950
  description: