@oalo-ai/cli 0.4.3 → 0.4.5

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/man/oalo.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH OALO 1 "" "oalo 0.4.3" "OALO CLI"
1
+ .TH OALO 1 "" "oalo 0.4.5" "OALO CLI"
2
2
  .SH NAME
3
3
  oalo \- wire a local app into your Oalo workspace
4
4
  .SH SYNOPSIS
@@ -108,6 +108,8 @@ Every token is verified against the thing it is for BEFORE anything is saved, so
108
108
  .IP \(bu 2
109
109
  Writes .oalo/config.json (safe to commit) and ~/.oalo/credentials.json (mode 0600, never in the project). OALO_HOME relocates the credential store.
110
110
  .IP \(bu 2
111
+ Commands in a subfolder use the nearest .oalo/config.json above them, up to the git repository's root (as git finds its own folder). A link outside the repository (a parent folder, or the repository holding a nested one) is never used, since it may be another workspace's; the "which workspace" error names it, and \fBoalo link\fR in the subfolder or \-\-server settles it. \fBoalo link \-\-status\fR says which file is used.
112
+ .IP \(bu 2
111
113
  Also installs the Oalo skill for coding agents (.claude/skills/oalo/SKILL.md), or refreshes it, from this CLI version; an AGENTS.md section from \fBoalo skill \-\-agents\fR is refreshed too.
112
114
  .PP
113
115
  Exit codes: 0 linked; 1 verification failed; 2 missing or invalid arguments.
@@ -215,11 +217,17 @@ Fire a loop, or send a bot a test message, and watch what happens.
215
217
  .PP
216
218
  \fBEnv:\fR loop: \-\-env dev|prod, else the project's env, else dev (a loop fired by its real trigger or schedule runs on prod). bot: no \-\-env; the bot uses its own env, dev while it's a draft, prod once published.
217
219
  .PP
218
- \fBoalo run loop <name> [\-\-env dev|prod] [\-\-watch]\fR
220
+ \fBoalo run loop <name> [\-\-env dev|prod] [\-\-payload '{"email": "..."}' | \-\-input '{...}'] [\-\-watch]\fR
219
221
  .br
220
222
  \fBoalo run bot <id> "<message>"\fR
221
223
  .br
222
224
  .TP
225
+ \fB\-\-payload <json>\fR
226
+ loop: the run starts as if its event came with this payload, read as {{trigger.payload.<field>}}.
227
+ .TP
228
+ \fB\-\-input <json>\fR
229
+ loop: the trigger's whole output, as is (for a loop that reads {{trigger.<field>}} directly).
230
+ .TP
223
231
  \fB\-\-watch\fR
224
232
  Stream events after firing. Default on for bots.
225
233
  .TP
@@ -232,6 +240,8 @@ loop: which env's data it runs on. Default: the project's, else dev.
232
240
  \fB\-\-app <slug>\fR
233
241
  Only for a loop pinned to one app: that app's slug (\fBoalo apps\fR) or id. Loops are org\-wide by default.
234
242
  .IP \(bu 2
243
+ A loop that's off doesn't run for real: \fBoalo loops test <name>\fR tries it while it's off, with sends and record changes simulated.
244
+ .IP \(bu 2
235
245
  IMPORTANT: \fBrun loop\fR fires the loop DIRECTLY and does NOT exercise its trigger binding. Triggers come from the event bus (a real form submission, a real inbound message). So this proves the loop body works; to test that its trigger is wired, use \fBoalo emit\fR.
236
246
  .IP \(bu 2
237
247
  bot ids accept an integer, a numeric string, or a public bot_ id.
@@ -256,7 +266,7 @@ The event's payload, a JSON object. \fBoalo emit \-\-list\fR shows each event's
256
266
  An existing contact the event is about. Never creates one.
257
267
  .TP
258
268
  \fB\-\-dry\-run\fR
259
- List the loops it would fire, and emit nothing.
269
+ Emit nothing. Lists the loops it would fire, the ones that would match but are off (the loop or its trigger), and the ones listening for the type whose filter doesn't match this payload, with the filter. So it checks a filter on a loop that is kept off, too. A bot_id in a filter matches the bot's public id (bot_...) or its number.
260
270
  .TP
261
271
  \fB\-\-list\fR
262
272
  Every event a trigger can listen for, with its payload fields and the loops listening now.
@@ -744,11 +754,11 @@ Feeds that send Oalo rows from outside (another system, a webhook, an export), k
744
754
  .PP
745
755
  \fBoalo sources [list] [\-\-json]\fR
746
756
  .br
747
- \fBoalo sources create <name> \-\-from <sample.csv|.json|.jsonl> [\-\-table <new model>] [\-\-id\-field <field>] [\-\-mode upsert|snapshot] [\-\-auth bearer|hmac|url] [\-\-env dev|prod]\fR
757
+ \fBoalo sources create <name> \-\-from <sample.csv|.json|.jsonl> [\-\-table <new model>] [\-\-id\-field <field>] [\-\-records\-at <path>] [\-\-mode upsert|snapshot] [\-\-auth bearer|hmac|url] [\-\-env dev|prod]\fR
748
758
  .br
749
759
  \fBoalo sources create <name> \-\-table <existing model or table> [\-\-fields a,b] [\-\-id\-field <field>] [\-\-auth bearer|hmac|url]\fR
750
760
  .br
751
- \fB (either form) [\-\-keep\-from\-ai a,b] [\-\-retention <days>]\fR
761
+ \fB (either form) [\-\-keep\-from\-ai a,b] [\-\-retention <days>] [\-\-hmac\-header <name>] [\-\-hmac\-format sha256=hex|hex|base64]\fR
752
762
  .br
753
763
  \fBoalo sources show <name> [\-\-json]\fR
754
764
  .br
@@ -758,7 +768,7 @@ Feeds that send Oalo rows from outside (another system, a webhook, an export), k
758
768
  .br
759
769
  \fBoalo sources push <name> <file.csv|.json|.jsonl> [\-\-json]\fR
760
770
  .br
761
- \fBoalo sources push <name> <doc.pdf|.docx|.md|.html|.txt> [more...] [\-\-json]\fR
771
+ \fBoalo sources push <name> <doc.pdf|.docx|.md|.html|.txt> [more...] [\-\-prune] [\-\-json]\fR
762
772
  .br
763
773
  \fBoalo sources remove <name> <document>\fR
764
774
  .br
@@ -817,7 +827,13 @@ fetch: how often Oalo fetches the address, 5 to 10080 minutes. Default 60.
817
827
  fetch: a request header, "Name: value" (an API key, say: \-\-header "Authorization: Bearer $KEY"). Repeat it for more, up to 10. Sealed on the server; show prints only the names. Left out, the ones set before stay; \-\-header "" clears them.
818
828
  .TP
819
829
  \fB\-\-records\-at <path>\fR
820
- fetch, a table's source: the records are the list at this key of the JSON answer (data.items).
830
+ create: where each record sits in what a sender posts, for a webhook that wraps it ({"event": ..., "delivery": {...}} is \-\-records\-at delivery; an object there is one record, a list is several). The \-\-from sample is read the same way, and \-\-id\-field and \-\-fields name fields inside it. fetch, a table's source: the records are the list at this key of the JSON answer (data.items).
831
+ .TP
832
+ \fB\-\-hmac\-header <name>\fR
833
+ create, \-\-auth hmac: the header that carries the signature. Default x\-signature.
834
+ .TP
835
+ \fB\-\-hmac\-format <f>\fR
836
+ create, \-\-auth hmac: how the signature is written: sha256=hex (default, as GitHub and Shopify\-style senders do), hex (the bare hex digest) or base64. A signature in another format is refused as not a sender of this source.
821
837
  .TP
822
838
  \fB\-\-document <name>\fR
823
839
  fetch, a knowledge source: the document's name (default the address's last part).
@@ -840,11 +856,16 @@ fetch: stop fetching.
840
856
  \fB\-\-wipe\fR
841
857
  delete: also delete the rows, when the source made the model.
842
858
  .TP
859
+ \fB\-\-prune\fR
860
+ push, a knowledge source: the files sent are the whole set, so each document the source has and they don't is removed. Nothing is removed when a file fails. \fBoalo sources push help docs/*.md \-\-prune\fR keeps the bot in step with a folder.
861
+ .TP
843
862
  \fB\-\-json\fR
844
863
  The reply as JSON.
845
864
  .IP \(bu 2
846
865
  A sender posts JSON (an object or an array), NDJSON or CSV to the source's address. Keys and CSV headers are snake\-cased as the CSV import does it, so "Order ID" and order_id are one field.
847
866
  .IP \(bu 2
867
+ Only top\-level fields are fields. A field that holds an object or a list is stored whole, everything inside it included, and \-\-fields can't pick inside it, so a webhook that wraps its record ("delivery": {...}) needs \-\-records\-at, or a sensitive field inside the wrapper is stored. create warns when a sample has such a field.
868
+ .IP \(bu 2
848
869
  The secret is shown when the source is made, and by rotate; it only writes. Each upload answers what it stored, rejected and dropped, is listed in show, and fires source.<name>.received for workflows.
849
870
  .IP \(bu 2
850
871
  Rows sync to your apps at once and fire the model's row events, as Sync API writes do. Up to 10,000 records a request, 120 requests a minute per source, 200,000 rows a day per workspace.
@@ -879,6 +900,10 @@ The workspace's bots: the tables each can search, and every setting (knowledge,
879
900
  .br
880
901
  \fBoalo bots settings \-\-explain [<key> | <group>] [\-\-json]\fR
881
902
  .br
903
+ \fBoalo bots graph <bot> [\-\-build] [\-\-json]\fR
904
+ .br
905
+ \fBoalo bots graph <bot> \-\-reset \-\-yes [\-\-json]\fR
906
+ .br
882
907
  .TP
883
908
  \fBtools \-\-add <tool>\fR
884
909
  Let the bot call one of the workspace's tools, by name. Your server apps' own endpoints are listed once a deploy reads their .oalo/app.json (see \fBoalo docs app\-tools\fR). \-\-remove takes it away.
@@ -893,7 +918,13 @@ Detach one. The table stays searchable for other bots.
893
918
  settings: change one or more. A value starting with @ is read from that file (for the frame). none, default or an empty value clears a setting where its help says so.
894
919
  .TP
895
920
  \fB\-\-yes\fR
896
- settings set: apply to a published bot. Without it a published bot's change is shown and not saved.
921
+ settings set: apply to a published bot. Without it a published bot's change is shown and not saved. graph \-\-reset: go ahead.
922
+ .TP
923
+ \fB\-\-build\fR
924
+ graph: build the bot's knowledge graph from its documents, in the background (a minute or two). After that, each new document keeps it current. Run it again to rebuild it whole.
925
+ .TP
926
+ \fB\-\-reset\fR
927
+ graph: delete the whole graph, links added by hand or imported included. Needs \-\-yes.
897
928
  .TP
898
929
  \fB\-\-dry\-run\fR
899
930
  settings set: show what would change; save nothing.
@@ -913,6 +944,8 @@ The same as ticking a table in the bot's Knowledge pane in the dashboard, with t
913
944
  settings go through the dashboard's own actions, with the same checks and access. A change sets only the settings it names: the model without the provider keeps the provider, one limit keeps the others, one context.* key keeps the rest of the context config.
914
945
  .IP \(bu 2
915
946
  Every setting is described in \fBman oalo\fR (BOT SETTINGS) and by \fBoalo bots settings \-\-explain\fR.
947
+ .IP \(bu 2
948
+ The knowledge graph links a bot's passages: each document's sections, and the sections like each other, so a match can bring in related ones and the topics above it. A bot has none until \fBoalo bots graph <bot> \-\-build\fR. graph shows its size and whether links are labeled; how answers use it is in settings (graph_retrieval, ancestor_preload_depth, graph_classify_edges). Markdown front matter's related: list links pages by name.
916
949
  .PP
917
950
  Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
918
951
  .SS tokens
@@ -931,7 +964,7 @@ List, create and revoke the workspace's sync tokens, for an app's own server.
931
964
  What the token is for, shown in the dashboard.
932
965
  .TP
933
966
  \fB\-\-scope <scope>\fR
934
- read, write, read_manifest, read:<table>, write:<table>, events (send events to POST /api/events/v1), workflows (call workflows, POST /api/workflows/v1/<name>/run), chat (sign the chat widget in as your app's user, POST /api/chat/v1/sessions), or env:dev / env:prod (lock it to one env's data: env:dev makes events and workflow calls safe test runs, for running your app on your machine). Repeat it. Prefer the narrowest. An unknown scope is refused.
967
+ read, write, read_manifest, read:<table>, write:<table>, events (send events to POST /api/events/v1), workflows (call workflows, POST /api/workflows/v1/<name>/run), chat (sign the chat widget in as your app's user, POST /api/chat/v1/sessions), or env:dev / env:prod (lock it to one env's data: env:dev makes events and workflow calls safe test runs, for running your app on your machine). Repeat it. Prefer the narrowest. An unknown scope is refused. A <table> is an Oalo data model, one \fBoalo data models\fR lists: a plain Postgres table (made by \fBoalo db restore\fR or by the app) can't be served by the Sync API, and create warns when a table scope names no model.
935
968
  .TP
936
969
  \fB\-\-days N\fR
937
970
  Expiry in days (default 90; 0 for none).
@@ -939,6 +972,8 @@ Expiry in days (default 90; 0 for none).
939
972
  A sync token reads or writes every row of its tables, for every member. It belongs in a server's secrets, never in a mobile or web app.
940
973
  .IP \(bu 2
941
974
  The token is printed once. Copy it into the app server's secrets right away.
975
+ .IP \(bu 2
976
+ Table scopes (read:<table>, write:<table>) are for Oalo data models, what \fBoalo data models\fR lists. They don't reach a plain table: an app's server reads its own tables over DATABASE_URL.
942
977
  .PP
943
978
  Exit codes: 0 done; 1 refused or failed; 2 bad arguments or no CLI token.
944
979
  .SS docs
@@ -1006,7 +1041,7 @@ The app (\fBoalo apps\fR lists them). Default: the app saved with \fBoalo link \
1006
1041
  dev updates the preview; prod builds and swaps the live release. prod must be on the command line.
1007
1042
  .TP
1008
1043
  \fB\-\-new [<name>]\fR
1009
- Make a new app from this repo: its type found from the files at the repo's root (no Dockerfile needed), its commits kept as the app's history, its preview set up. The name (default: the repo's folder) becomes its slug, and this project is linked to it. When nothing at the root says what the app is (a monorepo, say), it is made as code only and the deploy says what to add: see \fBoalo docs bring\-your\-repo\fR.
1044
+ Make a new app from this repo: its type found from the files at the repo's root (no Dockerfile needed), its commits kept as the app's history, its preview set up. The name (default: the repo's folder) becomes its slug: lowercase letters, digits and dashes, so \fBmy_app\fR becomes \fBmy\-app\fR, and the deploy says so when it changed what you typed. This project is linked to it. When nothing at the root says what the app is (a monorepo, say), it is made as code only and the deploy says what to add: see \fBoalo docs bring\-your\-repo\fR.
1010
1045
  .TP
1011
1046
  \fB\-\-name <display name>\fR
1012
1047
  With \-\-new: the app's display name. Default: its slug.
@@ -1261,6 +1296,8 @@ Print the test result as JSON.
1261
1296
  .IP \(bu 2
1262
1297
  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.
1263
1298
  .IP \(bu 2
1299
+ 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.
1300
+ .IP \(bu 2
1264
1301
  A loop that is on runs for real whenever its triggers fire. Starting a run now, for real: \fBoalo run loop <name>\fR.
1265
1302
  .IP \(bu 2
1266
1303
  Deleting can't be undone; turning a loop off keeps it.
@@ -1414,7 +1451,7 @@ How long one turn may take to settle. Default 90, at most 300.
1414
1451
  Tag stored on the test conversation.
1415
1452
  .TP
1416
1453
  \fB\-\-json\fR
1417
- Print the whole run as JSON: turns (replies, flow state, ms, settled), flow_path, cost_usd.
1454
+ Print the whole run as JSON: turns (replies, the tools called, flow state, ms, settled), flow_path, cost_usd.
1418
1455
  .IP \(bu 2
1419
1456
  The conversation is a preview with no phone number or external id: the inbox leaves it out and nothing is sent to WhatsApp, Instagram or SMS.
1420
1457
  .IP \(bu 2
@@ -1445,10 +1482,10 @@ Rehearse inbound WhatsApp conversations end to end: routing, triage and the bot'
1445
1482
  The WhatsApp number (phone_number_id) the customer writes to. Default: the workspace's default number.
1446
1483
  .TP
1447
1484
  \fB\-\-responder <bot_...>\fR
1448
- The bot that should end up answering, by its public id (\fBoalo bots\fR lists them). Default: the bot an enabled triage loop hands threads to, else the number's bot.
1485
+ The bot the checks expect to end up answering, by its public id (\fBoalo bots\fR lists them). It's a check, not routing: messages still go where the number and its triage send them. To rehearse a bot that isn't on the number, give a \-\-script scenario with an open_thread on that bot. Default: the bot an enabled triage loop hands threads to, else the number's bot.
1449
1486
  .TP
1450
1487
  \fB\-\-script <file>\fR
1451
- A JSON file: {"scenarios": [{"name", "messages", "known_contact", "opted_out", "open_thread": {"bot_id", "number", "hours_ago", "tags", "assigned", "deal"}, "expect": {"reply", "bot_id", "assigned"}}]}.
1488
+ A JSON file: {"scenarios": [{"name", "messages", "known_contact", "opted_out", "open_thread": {"bot_id", "number", "hours_ago", "tags", "assigned", "deal", "messages"}, "expect": {"reply", "bot_id", "assigned"}}]}. open_thread.bot_id is a public id (bot_...) or number. An open thread starts with one earlier exchange: open_thread.messages [customer, reply] when given, else a Spanish greeting ("Hola" / "¡Hola! ¿En qué te puedo ayudar?"), which can set the language the bot answers in.
1452
1489
  .TP
1453
1490
  \fB\-\-timeout <s>\fR
1454
1491
  How long one message may take to settle. Default 120, at most 300.
@@ -1500,6 +1537,8 @@ stdout is the MCP protocol stream. Diagnostics go to stderr.
1500
1537
  .IP \(bu 2
1501
1538
  Exposes a curated tool set plus an oalo_call passthrough; the build surface has ~442 events and mapping them all would wreck tool selection.
1502
1539
  .IP \(bu 2
1540
+ 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 \fB_cut\fR note saying how to get the rest (oalo_call takes match and offset; oalo_node_catalog takes node_type).
1541
+ .IP \(bu 2
1503
1542
  Reads OALO_URL and OALO_CLI_TOKEN, or falls back to what \fBoalo link \-\-cli\-token\fR saved.
1504
1543
  .IP \(bu 2
1505
1544
  Needs a CLI token.
@@ -1616,6 +1655,11 @@ How many levels of parent topics come with a match when graph_retrieval brings t
1616
1655
  .br
1617
1656
  Values: a number from 1 to 32. Default: 3.
1618
1657
  .TP
1658
+ \fBgraph_classify_edges\fR
1659
+ After each graph rebuild, a small AI model labels the links between similar passages (one depends on another, defines it, or is related), so a match can bring in what it depends on. Off: links are by similarity only. Needs a built graph (\fBoalo bots graph <bot> \-\-build\fR).
1660
+ .br
1661
+ Values: true or false. Default: false. Changing it uses AI credit at each graph rebuild, for the links whose pages changed.
1662
+ .TP
1619
1663
  \fBcontext.strategy\fR
1620
1664
  How each turn's context is put together. retrieval: the frame, the persona and what search finds. graph_resolver: everything the member's tier unlocks in the knowledge graph, whole (high recall, more tokens). graph_focused: the same unlocking, but only the unlocked topics' own text, plus a search over the graph for this turn (token\-bounded). The context.* settings below are read by the graph strategies.
1621
1665
  .br
@@ -1636,6 +1680,21 @@ How much of each resident topic loads: full (it and everything under it) or shal
1636
1680
  .br
1637
1681
  Values: full | shallow, or default. Default: default.
1638
1682
  .TP
1683
+ \fBcontext.budget.policy\fR
1684
+ How much a turn packs. fixed: a set number of retrieved passages, and the whole conversation. fit: a budget from the model's window. What loads every turn goes first (frame, persona, resident topics, tools), then recent history (at most half of what's left), then retrieved knowledge fills the rest. The Context Inspector shows the split.
1685
+ .br
1686
+ Values: fixed | fit. Default: fixed.
1687
+ .TP
1688
+ \fBcontext.budget.share\fR
1689
+ With context.budget.policy=fit: the percent of the model's window a turn may fill (after room for the answer). Higher packs more retrieved knowledge and history, at more cost a turn.
1690
+ .br
1691
+ Values: a number from 10 to 100. Default: 50.
1692
+ .TP
1693
+ \fBcontext.budget.cap\fR
1694
+ With context.budget.policy=fit: the most tokens a turn may fill, whatever the window. Keeps a model with a huge window from packing it.
1695
+ .br
1696
+ Values: a number from 10000 to 2000000. Default: 400000.
1697
+ .TP
1639
1698
  \fBcontext.tier_field\fR
1640
1699
  The member field that holds their tier, which decides what the graph strategies unlock.
1641
1700
  .br
@@ -1734,6 +1793,11 @@ On WhatsApp and Instagram, which can't show a form: text asks for the answers in
1734
1793
  .br
1735
1794
  Values: text | link. Default: text.
1736
1795
  .TP
1796
+ \fBguarded_reply\fR
1797
+ With guardrails on, the reply is checked before it's sent. last keeps the text after the bot's last tool call (drops lead\-ins like "let me check"); all keeps every step's text, for a bot that answers, shows cards, then asks.
1798
+ .br
1799
+ Values: last | all. Default: last.
1800
+ .TP
1737
1801
  \fBoffchannel_handoff\fR
1738
1802
  On WhatsApp and Instagram: off answers there, link moves the customer to the web chat on the first reply (it costs nothing per message).
1739
1803
  .br
@@ -1780,6 +1844,11 @@ Messages a day per end user. none: no cap.
1780
1844
  .br
1781
1845
  Values: a number from 1 to 100000, or none. Default: none.
1782
1846
  .TP
1847
+ \fBweb_ip_messages_per_hour\fR
1848
+ The public web chat's messages an hour from one IP address, across all its conversations. Lower it for a site where each visitor has their own connection; raise it where many share one (a gym's or a shop's wifi). none: 300.
1849
+ .br
1850
+ Values: a number from 10 to 10000, or none. Default: none.
1851
+ .TP
1783
1852
  \fBsoft_daily_cap_cents\fR
1784
1853
  AI spend a day, in cents, past which the workspace is warned. none: no warning.
1785
1854
  .br
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oalo-ai/cli",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Wire a local app into your OALO workspace: link a token, generate typed bindings, and serve the build surface over MCP.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -64,6 +64,16 @@
64
64
  32
65
65
  ]
66
66
  },
67
+ {
68
+ "clear_word": null,
69
+ "default": false,
70
+ "doc": "After each graph rebuild, a small AI model labels the links between similar passages (one depends on another, defines it, or is related), so a match can bring in what it depends on. Off: links are by similarity only. Needs a built graph (`oalo bots graph <bot> --build`).",
71
+ "effect": "uses AI credit at each graph rebuild, for the links whose pages changed",
72
+ "group": "knowledge",
73
+ "key": "graph_classify_edges",
74
+ "type": "true or false",
75
+ "values": null
76
+ },
67
77
  {
68
78
  "clear_word": null,
69
79
  "default": "retrieval",
@@ -116,6 +126,45 @@
116
126
  "shallow"
117
127
  ]
118
128
  },
129
+ {
130
+ "clear_word": null,
131
+ "default": "fixed",
132
+ "doc": "How much a turn packs. fixed: a set number of retrieved passages, and the whole conversation. fit: a budget from the model's window. What loads every turn goes first (frame, persona, resident topics, tools), then recent history (at most half of what's left), then retrieved knowledge fills the rest. The Context Inspector shows the split.",
133
+ "effect": null,
134
+ "group": "knowledge",
135
+ "key": "context.budget.policy",
136
+ "type": "one of",
137
+ "values": [
138
+ "fixed",
139
+ "fit"
140
+ ]
141
+ },
142
+ {
143
+ "clear_word": null,
144
+ "default": 50,
145
+ "doc": "With context.budget.policy=fit: the percent of the model's window a turn may fill (after room for the answer). Higher packs more retrieved knowledge and history, at more cost a turn.",
146
+ "effect": null,
147
+ "group": "knowledge",
148
+ "key": "context.budget.share",
149
+ "type": "number",
150
+ "values": [
151
+ 10,
152
+ 100
153
+ ]
154
+ },
155
+ {
156
+ "clear_word": null,
157
+ "default": 400000,
158
+ "doc": "With context.budget.policy=fit: the most tokens a turn may fill, whatever the window. Keeps a model with a huge window from packing it.",
159
+ "effect": null,
160
+ "group": "knowledge",
161
+ "key": "context.budget.cap",
162
+ "type": "number",
163
+ "values": [
164
+ 10000,
165
+ 2000000
166
+ ]
167
+ },
119
168
  {
120
169
  "clear_word": null,
121
170
  "default": "band",
@@ -326,6 +375,19 @@
326
375
  "link"
327
376
  ]
328
377
  },
378
+ {
379
+ "clear_word": null,
380
+ "default": "last",
381
+ "doc": "With guardrails on, the reply is checked before it's sent. last keeps the text after the bot's last tool call (drops lead-ins like \"let me check\"); all keeps every step's text, for a bot that answers, shows cards, then asks.",
382
+ "effect": null,
383
+ "group": "replies",
384
+ "key": "guarded_reply",
385
+ "type": "one of",
386
+ "values": [
387
+ "last",
388
+ "all"
389
+ ]
390
+ },
329
391
  {
330
392
  "clear_word": null,
331
393
  "default": "off",
@@ -441,6 +503,19 @@
441
503
  100000
442
504
  ]
443
505
  },
506
+ {
507
+ "clear_word": "none",
508
+ "default": null,
509
+ "doc": "The public web chat's messages an hour from one IP address, across all its conversations. Lower it for a site where each visitor has their own connection; raise it where many share one (a gym's or a shop's wifi). none: 300.",
510
+ "effect": null,
511
+ "group": "limits",
512
+ "key": "web_ip_messages_per_hour",
513
+ "type": "number",
514
+ "values": [
515
+ 10,
516
+ 10000
517
+ ]
518
+ },
444
519
  {
445
520
  "clear_word": "none",
446
521
  "default": null,
@@ -14,6 +14,7 @@ import { dim } from "../events.js";
14
14
  * oalo bots settings <bot> every setting and its value
15
15
  * oalo bots settings <bot> set key=value ... [--yes] [--dry-run]
16
16
  * oalo bots settings --explain [key] what each setting does
17
+ * oalo bots graph <bot> [--build] [--reset --yes] its knowledge graph
17
18
  *
18
19
  * A source is a table made searchable with `oalo data vectorize`: its handle
19
20
  * (`model:products`, `table:prod.faq`) or just its name when that's unique.
@@ -27,8 +28,8 @@ export async function bots(flags, rest, opts = {}) {
27
28
  if (!url || !token) return fail(`oalo bots needs a CLI token.\n\n${HOW_TO_CONNECT}`, 2);
28
29
 
29
30
  const sub = rest[1];
30
- if (sub && !["knowledge", "settings", "tools"].includes(sub)) return fail(`unknown bots command: ${sub}\n\n${USAGE}`, 2);
31
- if ((sub === "knowledge" || sub === "tools") && !rest[2]) return fail(USAGE, 2);
31
+ if (sub && !["knowledge", "settings", "tools", "graph"].includes(sub)) return fail(`unknown bots command: ${sub}\n\n${USAGE}`, 2);
32
+ if ((sub === "knowledge" || sub === "tools" || sub === "graph") && !rest[2]) return fail(USAGE, 2);
32
33
  if (sub === "settings" && !rest[2] && !flags.explain) return fail(USAGE, 2);
33
34
 
34
35
  if (!opts.channel) {
@@ -45,6 +46,7 @@ export async function bots(flags, rest, opts = {}) {
45
46
  if (sub === "knowledge") return await knowledge(ch, rest[2], flags);
46
47
  if (sub === "settings") return await settings(ch, rest.slice(2), flags);
47
48
  if (sub === "tools") return await tools(ch, rest[2], flags);
49
+ if (sub === "graph") return await graph(ch, rest[2], flags);
48
50
  return await list(ch, flags, url);
49
51
  } catch (e) {
50
52
  return fail(e.message, 1);
@@ -60,6 +62,7 @@ const USAGE = [
60
62
  " oalo bots settings <bot> [--json]",
61
63
  " oalo bots settings <bot> set key=value [key=value ...] [--yes] [--dry-run]",
62
64
  " oalo bots settings --explain [key]",
65
+ " oalo bots graph <bot> [--build] [--reset --yes] [--json]",
63
66
  ].join("\n");
64
67
 
65
68
  async function list(ch, flags, url) {
@@ -125,6 +128,38 @@ async function knowledge(ch, botId, flags) {
125
128
  }
126
129
  }
127
130
 
131
+ // ── graph ────────────────────────────────────────────────────────────────
132
+
133
+ // The graph links the bot's passages, so a match can bring in related ones.
134
+ // It's opt in: --build makes it from the documents, and after that each new
135
+ // document keeps it current. How answers use it is in `oalo bots settings`.
136
+ async function graph(ch, botId, flags) {
137
+ if (!/^bot_[A-Za-z0-9_-]+$/.test(botId)) return fail(`name the bot by its public id (bot_...), as \`oalo bots\` prints it (got ${botId})`, 2);
138
+ if (flags.build && flags.reset) return fail("--build or --reset, not both", 2);
139
+
140
+ if (flags.reset) {
141
+ if (!flags.yes) return fail(`--reset deletes ${botId}'s whole graph, links added by hand or imported included. Add --yes to go ahead.`, 2);
142
+ const r = await ch.call("kg:reset", { bot_id: botId });
143
+ if (flags.json) return void console.log(JSON.stringify({ bot: botId, reset: true, nodes_deleted: r.nodes_deleted }, null, 2));
144
+ return void console.log(`${botId}: graph deleted (${r.nodes_deleted} topics). The bot answers from its documents alone until you --build again.`);
145
+ }
146
+
147
+ if (flags.build) await ch.call("kg:rebuild", { bot_id: botId });
148
+ const [cfg, counts] = await Promise.all([ch.call("kg:config", { bot_id: botId }), ch.call("kg:counts", { bot_id: botId })]);
149
+ if (flags.json) {
150
+ return void console.log(JSON.stringify({ bot: botId, built: cfg.built, building: !!flags.build, classify_edges: cfg.classify_edges, nodes: counts.nodes, edges: counts.edges, est_tokens: counts.est_tokens }, null, 2));
151
+ }
152
+
153
+ if (flags.build) console.log(`${botId}: building the graph in the background, usually within a minute or two. Run \`oalo bots graph ${botId}\` again to see it.`);
154
+ if (!cfg.built) {
155
+ if (!flags.build) console.log(`${botId} has no knowledge graph. --build makes one from its documents; after that, each new document keeps it current.`);
156
+ } else {
157
+ console.log(`${botId}: ${counts.nodes} topics, ${counts.edges} links, about ${counts.est_tokens} tokens of text`);
158
+ console.log(` labeled links ${cfg.classify_edges ? "on" : "off"} ${dim("(graph_classify_edges)")}`);
159
+ }
160
+ console.log(dim(`\nHow answers use it: oalo bots settings ${botId} (graph_retrieval, ancestor_preload_depth, graph_classify_edges). --reset --yes deletes it.`));
161
+ }
162
+
128
163
  // ── tools ────────────────────────────────────────────────────────────────
129
164
 
130
165
  const TRANSPORTS = { app: "your app", http_webhook: "webhook", builtin: "built in", wasm: "code", container_mcp: "action" };
@@ -46,8 +46,11 @@ export async function deploy(flags) {
46
46
  } catch {
47
47
  return fail("not inside a git repo. oalo deploy --new makes an app from this repo's commits.", 2);
48
48
  }
49
- app = slugify(typeof flags.new === "string" ? flags.new : top.split("/").pop());
49
+ const typed = typeof flags.new === "string" ? flags.new : top.split("/").pop();
50
+ app = slugify(typed);
50
51
  if (!app) return fail("give the new app a name: oalo deploy --new <name>", 2);
52
+ const note = slugNote(typed, app, typeof flags.new === "string" ? "the name" : "this repo's folder name");
53
+ if (note) console.error(note);
51
54
  }
52
55
  if (!app) return fail("which app? Pass --app <slug> (`oalo apps` lists them), save it with `oalo link --app <slug>`, or make one from this repo with `oalo deploy --new`.", 2);
53
56
 
@@ -206,8 +209,11 @@ async function fromGit(url, token, flags, opts = {}) {
206
209
  if (!gitToken) return fail(`${name} is empty or not set. Put the access token in it, then run this again.`, 2);
207
210
  }
208
211
 
209
- const app = slugify(typeof flags.new === "string" ? flags.new : repoName(from));
212
+ const typed = typeof flags.new === "string" ? flags.new : repoName(from);
213
+ const app = slugify(typed);
210
214
  if (!app) return fail("give the new app a name: oalo deploy --new <name> --from <url>", 2);
215
+ const note = slugNote(typed, app, typeof flags.new === "string" ? "the name" : "the repository's name");
216
+ if (note) console.error(note);
211
217
 
212
218
  try {
213
219
  await requireFeature(url, "deploy_from_git", "oalo deploy --from");
@@ -446,6 +452,23 @@ export const _releases = releases;
446
452
  // new release has a minute to answer. Wait longer than that.
447
453
  export const ROLLBACK_WAIT_MS = 35 * 60_000;
448
454
 
455
+ /**
456
+ * One line saying which slug a new app gets, when it isn't what was typed
457
+ * (`tc3_routedesk_relay` becomes `tc3-routedesk-relay`), so the next command
458
+ * uses the slug. Null when the name was already a slug.
459
+ */
460
+ export function slugNote(typed, slug, from = "the name") {
461
+ const name = String(typed || "");
462
+ if (!slug || name === slug) return null;
463
+ const inner = name.replace(/^[^A-Za-z0-9]+|[^A-Za-z0-9]+$/g, "");
464
+ const why = [];
465
+ if (/[A-Z]/.test(name)) why.push("capitals are lowered");
466
+ if (/[^A-Za-z0-9-]|--/.test(inner)) why.push("anything else becomes a dash");
467
+ if (inner !== name) why.push("dashes at either end are dropped");
468
+ if (inner.replace(/[^A-Za-z0-9]+/g, "-").length > 40) why.push("it is cut to 40 characters");
469
+ return `the new app's slug is ${slug}, made from ${from} ${JSON.stringify(name)}: a slug (the app's address, and what --app takes) has only lowercase letters, digits and single dashes, so ${why.join(", ") || "it was changed"}. Use --app ${slug} from now on.`;
470
+ }
471
+
449
472
  /** An app slug from a name: lowercase letters, digits and dashes. */
450
473
  export function slugify(name) {
451
474
  return String(name || "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40);
@@ -18,7 +18,9 @@ import { dim } from "../events.js";
18
18
  export async function docs(flags, rest) {
19
19
  // `oalo docs list` (and `ls`) is what people and agents type for the list:
20
20
  // there is no page by either name.
21
- const slug = ["list", "ls"].includes(rest[1]) ? undefined : rest[1];
21
+ // `oalo docs search <words>` is what people type for --search.
22
+ if (rest[1] === "search" && rest.length > 2 && typeof flags.search !== "string") flags.search = rest.slice(2).join(" ");
23
+ const slug = ["list", "ls"].includes(rest[1]) || typeof flags.search === "string" ? undefined : rest[1];
22
24
  const cfg = resolveConfig(flags);
23
25
  const { url, token } = controlPlane(cfg);
24
26
  if (!url || !token) {
@@ -73,13 +73,9 @@ export async function emit(flags, rest) {
73
73
 
74
74
  if (flags.json) return void console.log(JSON.stringify(r, null, 2));
75
75
 
76
- const names = r.loops.map((l) => l.name);
76
+ const names = (r.loops || []).map((l) => l.name);
77
77
  if (r.dry_run) {
78
- console.log(
79
- names.length
80
- ? `${type} would fire ${names.length} loop${names.length > 1 ? "s" : ""}: ${names.join(", ")}`
81
- : `no enabled loop listens for ${type}${Object.keys(payload).length ? " with this payload" : ""}. Nothing would fire.`,
82
- );
78
+ for (const line of dryRunLines(type, payload, r)) console.log(line);
83
79
  console.log(dim("dry run: nothing was emitted"));
84
80
  } else {
85
81
  console.log(`emitted ${type} (event ${r.event_id}), tagged as a test from the CLI`);
@@ -98,6 +94,29 @@ export async function emit(flags, rest) {
98
94
  }
99
95
  }
100
96
 
97
+ /**
98
+ * What a dry run found: the loops that would fire, the ones that would match
99
+ * but are off (the loop or its trigger), and the ones listening for the type
100
+ * whose filter doesn't match this payload. Newer Bases send `off` and
101
+ * `filtered_out`; an older one only `loops`.
102
+ */
103
+ export function dryRunLines(type, payload, r) {
104
+ const fire = (r.loops || []).map((l) => l.name);
105
+ const off = r.off || [];
106
+ const filtered = r.filtered_out || [];
107
+ const lines = [];
108
+ if (fire.length) lines.push(`${type} would fire ${fire.length} loop${fire.length > 1 ? "s" : ""}: ${fire.join(", ")}`);
109
+ for (const l of off) lines.push(`would match but is off: ${l.name} (the loop or its trigger is off; oalo loops on ${l.name} turns the loop on)`);
110
+ for (const l of filtered) lines.push(`filter doesn't match: ${l.name} (filter ${JSON.stringify(l.filter ?? {})})`);
111
+ if (!fire.length) {
112
+ // An older Base sends neither list, and its `loops` holds enabled ones only.
113
+ const older = r.off === undefined && r.filtered_out === undefined;
114
+ const why = off.length || filtered.length ? "" : `no ${older ? "enabled " : ""}loop listens for ${type}${Object.keys(payload || {}).length ? " with this payload" : ""}. `;
115
+ lines.push(`${why}Nothing would fire.`);
116
+ }
117
+ return lines;
118
+ }
119
+
101
120
  function printList(events) {
102
121
  const byCat = new Map();
103
122
  for (const e of events) {
@@ -98,6 +98,11 @@ async function list(ch, app, env, flags) {
98
98
  }
99
99
  }
100
100
  if (!vars.length) console.log(dim(` none yet: oalo env set NAME=value --app ${r.app}${env === "prod" ? " --env prod" : ""}`));
101
+ // Secret is the default for any name without a public prefix, so say how to
102
+ // keep a value that is safe to show as plain (found by the CLI trial).
103
+ if (vars.some((v) => v.secret)) {
104
+ console.log(dim(` secret values are never shown. A variable is secret unless its name has a public prefix (VITE_, EXPO_PUBLIC_, ...). To store one as plain, set it again with --public: oalo env set NAME=value --public${env === "prod" ? " --env prod" : ""}`));
105
+ }
101
106
  }
102
107
 
103
108
  async function set(ch, app, env, vars, flags) {
@@ -17,9 +17,13 @@ export async function incidents(flags, rest, opts = {}) {
17
17
 
18
18
  const ch = (opts.channel || ((o) => new OaloChannel(o)))({ url, token });
19
19
  let r;
20
+ let live = null;
20
21
  try {
21
22
  await ch.connect();
22
23
  r = await ch.call("incidents:list", { app });
24
+ // Only a live launch is checked. With nothing on record, find out whether
25
+ // there is one, so "no incidents" doesn't claim checks that never ran.
26
+ if (!flags.json && !(r.incidents || []).length) live = await liveRelease(ch, app);
23
27
  } catch (e) {
24
28
  return fail(e.message, 1);
25
29
  } finally {
@@ -28,7 +32,7 @@ export async function incidents(flags, rest, opts = {}) {
28
32
  if (flags.json) return void console.log(JSON.stringify(r, null, 2));
29
33
 
30
34
  const list = r.incidents || [];
31
- if (!list.length) return void console.log(`${r.app}: no incidents. The live app is checked every minute.`);
35
+ if (!list.length) return void console.log(noIncidents(r.app || app, live));
32
36
  const when = (iso) => String(iso).slice(0, 16).replace("T", " ");
33
37
  for (const i of list) {
34
38
  const state = i.resolved_at ? `${when(i.opened_at)} to ${when(i.resolved_at)}` : `open since ${when(i.opened_at)}`;
@@ -38,6 +42,25 @@ export async function incidents(flags, rest, opts = {}) {
38
42
  if (list.some((i) => !i.resolved_at)) process.exitCode = 1;
39
43
  }
40
44
 
45
+ /** true when the app has a live release, false when it has none, null when that can't be told. */
46
+ async function liveRelease(ch, slug) {
47
+ try {
48
+ const { apps = [] } = await ch.call("list_apps", {});
49
+ const a = apps.find((x) => x.slug === slug || x.id === slug);
50
+ if (!a) return null;
51
+ const rel = await ch.call("get_release", { app_id: a.id });
52
+ return Boolean(rel?.release?.commit_hash);
53
+ } catch {
54
+ return null;
55
+ }
56
+ }
57
+
58
+ export function noIncidents(app, live) {
59
+ if (live === false) return `${app}: no live launch yet, so there is nothing to check. Oalo's uptime check watches the live app (every minute) once \`oalo deploy --app ${app} --env prod\` has launched it; the preview isn't checked (\`oalo logs --app ${app}\` shows it).`;
60
+ if (live === true) return `${app}: no incidents. The live app is checked every minute.`;
61
+ return `${app}: no incidents on record. Only a live launch is checked (every minute), never the preview.`;
62
+ }
63
+
41
64
  function fail(message, code) {
42
65
  console.error(message);
43
66
  process.exitCode = code;
@@ -124,6 +124,8 @@ async function status(flags) {
124
124
  }
125
125
 
126
126
  console.log(`workspace ${cfg.serverUrl}`);
127
+ // A link found in a parent folder of this repository (see findConfig).
128
+ if (cfg.configDir && cfg.configDir !== process.cwd()) console.log(`linked by ${cfg.configDir}/.oalo/config.json`);
127
129
  console.log(`env ${cfg.env}`);
128
130
  console.log(`app ${cfg.appId || "(none)"}`);
129
131
  console.log(`sync token ${cfg.token ? "present" : "MISSING"} (${credentialsPath()})`);
@@ -1,6 +1,6 @@
1
1
  import { hostname } from "node:os";
2
2
  import { spawn } from "node:child_process";
3
- import { readConfig, writeToken, readEntry, forgetWorkspace, credentialsPath } from "../config.js";
3
+ import { findConfig, writeToken, readEntry, forgetWorkspace, credentialsPath } from "../config.js";
4
4
  import { OaloChannel } from "../channel.js";
5
5
  import { dim } from "../events.js";
6
6
 
@@ -22,7 +22,7 @@ import { dim } from "../events.js";
22
22
  // A bare name is the workspace's own address: `oalo login acme` is
23
23
  // https://acme.oalo.ai, what the signup's last screen shows.
24
24
  function serverFrom(flags, rest = []) {
25
- const cfg = readConfig() || {};
25
+ const cfg = findConfig()?.config || {};
26
26
  const arg = rest[1];
27
27
  const fromArg = !arg ? "" : /^[a-z0-9][a-z0-9-]{0,62}$/i.test(arg) ? `https://${arg.toLowerCase()}.oalo.ai` : /^https?:\/\//.test(arg) ? arg : "";
28
28
  return (flags.server || fromArg || process.env.OALO_URL || cfg.serverUrl || "").replace(/\/$/, "");