@datarails-ai/dr-cli 1.6.180 → 1.6.182

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "cliVersion": "1.6.180",
3
+ "cliVersion": "1.6.182",
4
4
  "_contract": "Resolve a command path through `aliases` (canonical prefix + alias segment -> canonical path) before any lookup. A path listed in `pendingCommands`, or whose first segment is a key of `pending`, is UNDECIDED, not unrestricted: fail closed or skip it, and never read a path's absence from `commands` as 'no requirement'. An entry carrying `denied` is UNAVAILABLE to any AGENT-SCOPED credential — one whose `scopes` claim carries at least one `resource:action` entry; a claim that is absent, empty, capability-only or wholly unparseable is UNRESTRICTED, and this mark does not apply to it — whatever else that entry says: it is not a ceiling and it is not always-available, its `denied.reason` says why and `denied.until` names the ticket that lifts it, and the absence of `requires` on it must NEVER be read as 'no requirement'. Only an entry in `commands` with an empty `requires` means always-available.",
5
5
  "commands": {
6
6
  "login": {
@@ -4089,6 +4089,38 @@
4089
4089
  }
4090
4090
  ]
4091
4091
  },
4092
+ "calcmodels agent ask": {
4093
+ "requires": [
4094
+ {
4095
+ "resource": "tables",
4096
+ "action": "write"
4097
+ }
4098
+ ]
4099
+ },
4100
+ "calcmodels agent preview": {
4101
+ "requires": [
4102
+ {
4103
+ "resource": "tables",
4104
+ "action": "read"
4105
+ }
4106
+ ]
4107
+ },
4108
+ "calcmodels agent save": {
4109
+ "requires": [
4110
+ {
4111
+ "resource": "tables",
4112
+ "action": "write"
4113
+ }
4114
+ ]
4115
+ },
4116
+ "calcmodels agent approve": {
4117
+ "requires": [
4118
+ {
4119
+ "resource": "tables",
4120
+ "action": "destructive"
4121
+ }
4122
+ ]
4123
+ },
4092
4124
  "calc-vals list": {
4093
4125
  "requires": [
4094
4126
  {
@@ -233,6 +233,7 @@ area's gotchas.
233
233
 
234
234
  **Calc models** → [reference/calcmodels.md](reference/calcmodels.md)
235
235
  - `calcmodels list|get|create|update|set-flow|recalculate|delete` (alias `calc-models`)
236
+ - `calcmodels agent ask|preview|save|approve` — build an AGENT (allocation) model with the builder agent; `approve` is Tier A
236
237
 
237
238
  **Calculated values (per-table)** → [reference/calc-vals.md](reference/calc-vals.md)
238
239
  - `calc-vals list|get|create|update|delete` (alias `calcvals`) — `--table <id>` required on every subcommand
@@ -69,6 +69,60 @@ names to integer IDs against the tenant — never ask the operator for IDs:
69
69
  For `update`: `dr calcmodels get <id> --server <S> --json` → splice the requested
70
70
  change → write to a tmpfile → `dr calcmodels update <id> --file <tmpfile> --server <S>`.
71
71
 
72
+ ## AGENT models (builder)
73
+
74
+ An AGENT model is an allocation model that the calc model builder's agent writes
75
+ from plain English. `dr calcmodels agent` uses the web builder's endpoints. The
76
+ server allows it only for a Super Admin, on an org with the
77
+ `calc_model_agent_builder` flag, inside a per-org cap on running turns. The CLI
78
+ does not check these; it prints the server's 403 or 429. `create`/`update` above
79
+ are for the three older types only.
80
+
81
+ Flow:
82
+
83
+ 1. `dr calcmodels agent ask "<what to build>" --server <S>` — one turn. It
84
+ prints the operation id at once, then waits (3 s polls, default 900 s,
85
+ `--timeout <s>`). Ctrl-C or the timeout stop the wait only; read the turn
86
+ later with `dr calcmodels agent preview <operation_id> --server <S>`.
87
+ 2. Read the outcome by `status`:
88
+ - `NO_PROPOSAL` — the agent asks a question. Ask the operator. Do not answer
89
+ it yourself. Then `dr calcmodels agent ask "<reply>" --conversation <id> --server <S>`,
90
+ with the conversation id the answer printed.
91
+ - `SUCCEEDED` — a proposal and its preview: rows, coverage (allocated of
92
+ pool), balance groups, warnings. Show these to the operator. To change it,
93
+ reply in the same conversation. "preview: none ran" means it cannot be saved.
94
+ - `FAILED` — exits non-zero with the gate code, phase and suggestion.
95
+ 3. `dr calcmodels agent save <operation_id> [--name <n>] --server <S>` — saves a
96
+ DRAFT. The name defaults to the agent's proposed name. The new version
97
+ does not run until it is approved. `--model <id>` adds the turn as a new
98
+ version of that AGENT model; an active model keeps running its current
99
+ version until then.
100
+ 4. `dr calcmodels agent approve <id> --server <S>` — two-step. The plan prints
101
+ the version and its impact (rows the first run writes, allocated total,
102
+ pool total, coverage). Show it to the operator and stop. Run the printed
103
+ command (`--version-id <n> --confirm-token <t>`) only after the operator
104
+ gives a clear in-chat "yes" to that version and impact, on every server.
105
+ Approving activates the version and starts its first production run at once.
106
+
107
+ Gotchas:
108
+
109
+ - `approve` is Tier A (see safety.md). On a production server the token run
110
+ also opens a dialog or terminal prompt where the person types a word; with
111
+ no interactive channel the binary refuses. On a non-production server the
112
+ token alone activates, so the operator's in-chat "yes" is the only check.
113
+ - `save` never activates, and `ask`/`save` write no rows to the destination
114
+ table. Only `approve` starts a run that does.
115
+ - A newer version saved after the plan stops the token run before anything is
116
+ activated ("a newer version … was saved"). Re-run `approve` without the
117
+ token and show the new impact.
118
+ - `CALC_PREVIEW_ALREADY_SAVED`: that turn is already model N. The error
119
+ prints the `save … --model N` command for a new version.
120
+ - `CALC_TURN_RATE_LIMITED` (429): the org has too many running turns. Wait.
121
+ A 409 means a turn already runs on this conversation.
122
+ - Only the user who started a turn can read or continue it (404 otherwise).
123
+ - Out of scope: opening a saved model's definition for edit (no server read
124
+ endpoint), archiving AGENT models.
125
+
72
126
  ## Customer-facing docs (KB)
73
127
 
74
128
  Help Center → **"Getting Data into Datarails"** → Data Management. Find current articles with `dr kb search "calc model beginning balance"` (or
@@ -21,6 +21,7 @@ Gated commands include: `dashboards delete`, `datamappers delete`,
21
21
  `dynamic-ranges delete`, `extables delete`, `functions delete`, `lut delete`,
22
22
  `reports delete`, `storyboards delete`, `metrics delete`, `metrics categories
23
23
  delete`, `metrics dimensions delete`, `calcmodels delete|set-flow|recalculate`,
24
+ `calcmodels agent approve`,
24
25
  `reconciliation filebox delete`, `integrations delete`, `integrations it
25
26
  delete`, `devices command-delete`, `validate onboarding session delete`,
26
27
  `widgets delete`, `cash rules delete|delete-all|reorder|update`,
@@ -67,6 +68,9 @@ organization at once);
67
68
  `agents pin` / `unpin` (decide which agent version customers get on a server; one
68
69
  run with `--production` covers every production server, so relay the plan's
69
70
  per-server lines — they are also the undo);
71
+ `calcmodels agent approve` (activates an AGENT calc model and starts its first
72
+ production run, which writes new rows; the token is bound to the version whose
73
+ impact the plan printed);
70
74
  `error-enrichments import` (replaces every rule on the server, zeroes all
71
75
  hits/feedback counters, and reassigns every rule id); and
72
76
  `dashboards push --override` / `filebox push --override`. `import` is **not** an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-cli",
3
- "version": "1.6.180",
3
+ "version": "1.6.182",
4
4
  "description": "Datarails CLI",
5
5
  "type": "module",
6
6
  "engines": {
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@datarails-ai/dr-appspace-cli": "0.12.57",
20
+ "@datarails-ai/dr-appspace-cli": "0.12.58",
21
21
  "@modelcontextprotocol/sdk": "^1.29.0",
22
22
  "@napi-rs/keyring": "^1.3.0",
23
23
  "commander": "^12.1.0",