@cavelon/cli 0.1.11 → 0.1.12

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/dist/mcp.js CHANGED
@@ -3,6 +3,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
3
3
  import { accessFor, allOf, credentialWords, operationAccess, whoInstead } from "./access.js";
4
4
  import { formerlyWarning, ownsTenant, propertyName } from "./command.js";
5
5
  import { MCP_MAX_WAIT_MS } from "./commands/async.js";
6
+ import { PERSON_WAIT_MS } from "./confirm-token.js";
6
7
  import { createContext, withWarnings } from "./context.js";
7
8
  import { asCavelonError, CavelonError, ExitCode, usageError } from "./errors.js";
8
9
  import { closest } from "./package-references.js";
@@ -19,13 +20,19 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
19
20
  "and api for an operation that is not read-only, " +
20
21
  "return what they would do and a confirm_token, and change nothing until called again with the same arguments and " +
21
22
  "confirm set to that token: show the person the preview first. The token confirms exactly the change the preview showed; " +
22
- "a different change needs a new preview, and confirm: true is refused. The default route " +
23
- "(harness_default, activate's make_default) decides which solution the tenant's chat and widget answer with: live traffic, " +
24
- "so ask the person, and confirm only with their yes; the same goes for deactivate, which takes a solution out of live traffic " +
25
- "(its status becomes inactive), and for apply with include_tenant_wide, which imports the tenant-wide sections (tenant_settings, " +
26
- "model_registry, …) for every solution of the tenant. A new tenant, a replaced variable (every solution of the tenant reads it) and " +
27
- "the activation of a solution a channel or trigger reaches are the person's to confirm too; confirm a loop_start on your own " +
28
- "only for a trigger of a draft solution in a test environment (a run acts as the person and spends budget). " +
23
+ "a different change needs a new preview, and confirm: true is refused. A change that reaches live traffic or the whole tenant, " +
24
+ "or that cannot be taken back, is the person's to confirm, and the token alone does not make it: its preview says " +
25
+ "needs_person. With needs_person \"client\", call again with the token and the client asks the person to approve exactly that " +
26
+ "change; their no, or no answer, changes nothing (confirm_declined). Only after their yes does cavelon ask the instance for " +
27
+ "the confirmation it checks itself; confirmation_required or confirmation_invalid changed nothing: preview again, never retry " +
28
+ "on your own. With needs_person \"terminal\" this client cannot ask " +
29
+ "them: give the person the preview's confirm command, which they run in their own terminal, never in yours. These are " +
30
+ "harness_default and activate (the default route and a solution something reaches: live traffic), deactivate, tenant_create, " +
31
+ "variables_set replacing a value (every solution of the tenant reads it), limits_set, models_set_limit, trigger_identity, " +
32
+ "api for an operation that is not read-only, loop_start unless the trigger's solution is a draft (a run acts as the person " +
33
+ "and spends budget), and apply where its preview says show_to_person (tenant-wide sections, an active solution, deletions, " +
34
+ "env/prod). A draft's apply, a draft's loop_start, loop_cancel, sandbox_seed and kb_upload's replace you confirm with the " +
35
+ "token once the person saw the preview. " +
29
36
  "chat sends one message to a solution and returns its answer: the way to try one that is not the default route. " +
30
37
  "kb_upload names files that match an active document of the knowledge base; with replace it replaces them, and where the " +
31
38
  "instance's upload cannot, it returns what it would deactivate and uploads nothing without its confirm_token. " +
@@ -51,8 +58,9 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
51
58
  "variables_list/variables_get/variables_set handle plain-text {{var:…}} values; setting one needs a role that may manage " +
52
59
  "the tenant's settings, as a secret does (a Builder's may not): where whoami says the credential may not, tell the person " +
53
60
  "who sets it instead of calling variables_set. secrets_list shows which {{secret:…}} " +
54
- "values are set, never a value: a person sets a secret, so tell them the exact `cavelon secrets set <name>` command " +
55
- "to run in their terminal, and never ask for, read or pass a secret value. Never approve or decide an approval; " +
61
+ "values are set, never a value: a person sets a secret, so tell them how, as the answers name it: the exact " +
62
+ "`cavelon secrets set <name>` command to run in their terminal, or, where the instance lets no token set one, the Admin " +
63
+ "under Settings › Secrets. Never ask for, read or pass a secret value. Never approve or decide an approval; " +
56
64
  "that stays with a person. Use docs_search before guessing, " +
57
65
  "and api_list/api_describe/api for anything without its own tool. " +
58
66
  "use_tenant chooses the tenant for this MCP session only and never changes the tenant stored for the person; every preview " +
@@ -199,6 +207,24 @@ function missingRequired(spec, args) {
199
207
  .filter((p) => p.required && (args[p.name] === undefined || args[p.name] === ""))
200
208
  .map((p) => p.name);
201
209
  }
210
+ const APPROVAL_SCHEMA = {
211
+ type: "object",
212
+ properties: { approve: { type: "boolean", title: "Make this change", description: "Yes makes exactly the change shown; no changes nothing." } },
213
+ required: ["approve"],
214
+ };
215
+ function clientAsks(server) {
216
+ const elicitation = server.getClientCapabilities()?.elicitation;
217
+ return Boolean(elicitation && (elicitation.form || Object.keys(elicitation).length === 0));
218
+ }
219
+ async function askThroughClient(server, message, relatedRequestId) {
220
+ try {
221
+ const result = await server.elicitInput({ mode: "form", message, requestedSchema: APPROVAL_SCHEMA }, { timeout: PERSON_WAIT_MS, relatedRequestId });
222
+ return result.action === "accept" && result.content?.approve === true ? "approved" : "declined";
223
+ }
224
+ catch {
225
+ return "unanswered";
226
+ }
227
+ }
202
228
  function mcpIo(io) {
203
229
  return { ...io, stdout: { write: () => true, isTTY: false } };
204
230
  }
@@ -232,7 +258,7 @@ export function createMcpServer(io, commands, updates = {}) {
232
258
  const access = await credentialAccess();
233
259
  return { tools: tools.map((t) => toolFor(t, commands, access)) };
234
260
  });
235
- async function call(name, given) {
261
+ async function call(name, given, requestId) {
236
262
  const spec = byName.get(name);
237
263
  const fail = (error) => ({ isError: true, body: { error: asCavelonError(error).toJSON() } });
238
264
  if (!spec)
@@ -252,6 +278,8 @@ export function createMcpServer(io, commands, updates = {}) {
252
278
  const tenant = !ownsTenant(spec) && typeof args.tenant === "string" ? args.tenant : undefined;
253
279
  const solutionEnv = spec.options?.env && typeof args.env === "string" ? args.env : undefined;
254
280
  const ctx = createContext(mcpIo(io), { json: true, tenant, solutionEnv, sessionTenants }, "mcp");
281
+ if (clientAsks(server))
282
+ ctx.askPerson = (message) => askThroughClient(server, message, requestId);
255
283
  for (const message of renamed)
256
284
  ctx.warn(message);
257
285
  try {
@@ -277,9 +305,9 @@ export function createMcpServer(io, commands, updates = {}) {
277
305
  return fail(error);
278
306
  }
279
307
  }
280
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
308
+ server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
281
309
  const warning = notice.forCall(() => server.getClientVersion()?.name);
282
- const { body, isError } = await call(request.params.name, (request.params.arguments ?? {}));
310
+ const { body, isError } = await call(request.params.name, (request.params.arguments ?? {}), extra.requestId);
283
311
  if (!isError && TENANT_CHOOSERS.has(request.params.name))
284
312
  void server.sendToolListChanged().catch(() => undefined);
285
313
  let out = body;
package/dist/openapi.js CHANGED
@@ -40,6 +40,7 @@ export function operations(doc) {
40
40
  responses: raw.responses ?? {},
41
41
  readOnly: method === "get" || method === "head" || method === "options",
42
42
  personOnly: personOnlyOf(raw),
43
+ ...confirmationOf(raw),
43
44
  });
44
45
  }
45
46
  }
@@ -55,6 +56,12 @@ function personOnlyOf(raw) {
55
56
  ...(typeof reason === "string" && reason.trim() ? { reason: reason.trim() } : {}),
56
57
  };
57
58
  }
59
+ function confirmationOf(raw) {
60
+ if (raw["x-cavelon-confirmation"] !== "required")
61
+ return {};
62
+ const when = raw["x-cavelon-confirmation-when"];
63
+ return { confirmation: true, ...(typeof when === "string" && when.trim() ? { confirmationWhen: when.trim() } : {}) };
64
+ }
58
65
  export function deref(doc, value) {
59
66
  let current = value;
60
67
  for (let i = 0; i < 10 && current && typeof current === "object" && typeof current.$ref === "string"; i++) {
package/dist/printed.js CHANGED
@@ -34,6 +34,11 @@ export function printedCommand(words, override = {}) {
34
34
  }
35
35
  return commandLine(words);
36
36
  }
37
+ export function personCommand(...words) {
38
+ const target = current.getStore();
39
+ const spec = target ? commandOf(target.commands, words) : undefined;
40
+ return commandLine(target && spec ? withTarget(spec, words, target) : words);
41
+ }
37
42
  function withTokenPlaceholder(words) {
38
43
  const at = words.indexOf("--confirm");
39
44
  if (at < 0)
@@ -1,11 +1,20 @@
1
+ import { pathMatches } from "./access.js";
1
2
  import { CavelonError, ExitCode } from "./errors.js";
2
3
  import { cavelonCommand, fill } from "./printed.js";
3
4
  export const SECRETS_PERMISSIONS = ["settings.secrets.manage", "settings.manage"];
4
5
  export const SECRET_SETTER = "A tenant Owner (or another role allowed to manage secrets) sets it, in the Admin under Settings › Secrets or with their own token";
6
+ export const SECRET_SETTER_IN_ADMIN = "A tenant Owner (or another role allowed to manage secrets) sets it, signed in to the Admin under Settings › Secrets";
7
+ export const SECRETS_IN_ADMIN = "in the Admin under Settings › Secrets";
8
+ const SECRET_ROUTE = "/api/v1/secrets/{name}";
9
+ export function secretsInAdminOnly(principal, method = "PUT") {
10
+ if (!principal || !Array.isArray(principal.needs_a_person))
11
+ return null;
12
+ return principal.needs_a_person.some((o) => o.method === method && pathMatches(o.path, SECRET_ROUTE));
13
+ }
5
14
  export function maySetSecrets(principal) {
6
15
  if (!principal)
7
16
  return null;
8
- if (principal.kind === "api_key")
17
+ if (principal.kind === "api_key" || secretsInAdminOnly(principal))
9
18
  return false;
10
19
  if (!principal.permissions || principal.mode !== "tenant")
11
20
  return null;
@@ -27,16 +36,16 @@ export function variablesPermissionMissing(verb, name, permissions, value) {
27
36
  details: { name, permissions, sent: true },
28
37
  });
29
38
  }
30
- export function secretSetterHint(name) {
31
- return `${SECRET_SETTER}: \`${cavelonCommand("secrets", "set", name)}\`.`;
39
+ export function secretSetterHint(name, inAdmin = false) {
40
+ return inAdmin ? `${SECRET_SETTER_IN_ADMIN}.` : `${SECRET_SETTER}: \`${cavelonCommand("secrets", "set", name)}\`.`;
32
41
  }
33
- export function secretsPermissionMissing(verb, name, permissions) {
42
+ export function secretsPermissionMissing(verb, name, permissions, inAdmin = false) {
34
43
  const needs = permissions.length ? permissions.join(" or ") : "a permission to manage secrets";
35
44
  return new CavelonError(ExitCode.unauthorized, {
36
45
  code: "permission_missing",
37
46
  status: 403,
38
47
  message: `This token's role may not ${verb} secrets: the instance refused it, as that needs ${needs}. Secret ${name} is unchanged.`,
39
- hint: secretSetterHint(name),
48
+ hint: secretSetterHint(name, inAdmin),
40
49
  details: { name, permissions, sent: true },
41
50
  });
42
51
  }
@@ -51,11 +51,12 @@ for a public widget), **propose the change; the person decides.**
51
51
  without `confirm`). It changes nothing and shows the old and the new value,
52
52
  the operation it would send and the permissions it needs. Show that to the
53
53
  person with your reason (what fails or waits now), and wait for their answer.
54
- - Only after they agreed, run the confirm command it printed (the `confirm`
55
- field in `--json`) as it stands: it keeps the `--env` and `--tenant` of the
56
- preview, so it changes the limit the preview showed. Over MCP, call
57
- `limits_set` again with the same arguments and `confirm` set to the
58
- preview's `confirm_token`. Never raise a limit on
54
+ - The confirm is the person's. Over MCP, call `limits_set` again with the
55
+ same arguments and `confirm` set to the preview's `confirm_token`: the
56
+ client then asks the person, and nothing changes without their yes. From
57
+ your shell, the preview's `confirm` is the command the person runs in their
58
+ own terminal: give it to them as it stands (it keeps the `--env` and
59
+ `--tenant` of the preview). Never raise a limit on
59
60
  your own, never pick a value higher than the need you named, and never change
60
61
  one without telling them.
61
62
  - The same goes for the tenant's monthly inference budget
@@ -109,8 +110,9 @@ endpoint.
109
110
  - On rows that already exist, `cavelon models list` shows each row's endpoint
110
111
  and `max_concurrent_requests` (never a key). `cavelon models set-limit
111
112
  <model_id> <n|none>` shows the old and the new value and changes nothing;
112
- the confirm command it prints changes the row (from your shell it carries the
113
- preview's token, `--confirm <token>`). It refuses a row without a `base_url`.
113
+ the confirm changes the row, with the person's yes (over MCP the client asks
114
+ them; from your shell they run the confirm command in their own terminal).
115
+ It refuses a row without a `base_url`.
114
116
  Where this instance's package format does not carry the field, `validate`
115
117
  warns that the import ignores it; set it this way instead.
116
118
  - `model_registry` is tenant-wide: in a solution's folder, `cavelon apply`
@@ -303,8 +305,9 @@ schema has them: `cavelon validate` reports an unknown section):
303
305
  token. `cavelon variables list` shows them. A variable
304
306
  is tenant-wide: replacing a value previews the old and the new one and
305
307
  changes nothing without `--confirm` (the `confirm_token` over MCP); every
306
- solution of the tenant reads it, active ones too, so show the person that
307
- preview and confirm only with their yes. A new variable is set at once.
308
+ solution of the tenant reads it, active ones too, so the confirm needs the
309
+ person's yes: over MCP the client asks them, and from your shell they run
310
+ the confirm command in their own terminal. A new variable is set at once.
308
311
  - **Secrets are set by a person, never by you.** Tell the person the exact
309
312
  command `apply` printed, `cavelon secrets set <name>` (with the `--env` and
310
313
  `--tenant` it printed), to run in their own terminal; it asks for the value
@@ -316,7 +319,10 @@ schema has them: `cavelon validate` reports an unknown section):
316
319
  says "may set secrets: no", and `secrets set`, `activate` and `status` then
317
320
  name who does instead. Tell the person that a tenant Owner sets it, in the
318
321
  Admin under Settings › Secrets or with their own token; do not suggest the
319
- command to someone whose role cannot run it.
322
+ command to someone whose role cannot run it. Where the instance lets no
323
+ token set a secret (`secret_needs_a_person`; the preview names the Admin
324
+ instead of the command), the person sets it signed in to the Admin under
325
+ Settings › Secrets.
320
326
 
321
327
  ## Database query tools
322
328
 
@@ -334,7 +340,7 @@ says who does what on the instance.
334
340
  tool_type: database_query
335
341
  scope: tenant_local
336
342
  database_query:
337
- connection: { name: shop-db, dialect: postgresql } # by name only: never a host, user or password
343
+ connection: { name: shop-db, dialect: postgresql } # by name only: never a host, user or password; postgresql, mysql or mssql
338
344
  sql_text: SELECT number, status, shipped_at FROM orders WHERE number = :order_no AND email = :email LIMIT 5
339
345
  parameters:
340
346
  - name: order_no
@@ -58,7 +58,7 @@ Do not work around it; use the other column.
58
58
 
59
59
  ```bash
60
60
  cavelon loop start <trigger> --input @request.json # previews: the trigger, its solution, the payload
61
- cavelon loop start <trigger> --input @request.json --confirm <token> # starts it: the run id and an operation id
61
+ cavelon loop start <trigger> --input @request.json --confirm <token> # a draft's trigger: starts it, the run id and an operation id
62
62
  cavelon loop watch <run> --timeout 5m # each iteration's verdict, then the loop's outcome
63
63
  cavelon loop iterations <run> # state, budget, iterations (a page at a time)
64
64
  cavelon wait <operation-id> --timeout 90s # exit 0 done, 1 failed, 5 needs a person, 6 still running
@@ -66,11 +66,12 @@ cavelon wait <operation-id> --timeout 90s # exit 0 done, 1 failed, 5
66
66
 
67
67
  A loop started from `cavelon` runs **as the person whose token it is**, checked
68
68
  again on every iteration, and spends the tenant's budget. So `loop start`
69
- previews first and starts nothing without `--confirm`: run the confirm command
70
- it prints (from your shell it carries the preview's token; over MCP call
71
- `loop_start` again with `confirm` set to its `confirm_token`). Confirm on your
72
- own only for a trigger of a draft solution in a test environment; show the
73
- person the preview of any other. If `loop start` exits 8 (a timeout, a cut
69
+ previews first and starts nothing without `--confirm`. For a trigger of a
70
+ draft solution, run the confirm command it prints (from your shell it carries
71
+ the preview's token; over MCP call `loop_start` again with `confirm` set to its
72
+ `confirm_token`). Any other run needs the person's yes (`needs_person` in the
73
+ preview): over MCP the client asks them when you confirm with the token; from
74
+ your shell the preview names the command they run in their own terminal. If `loop start` exits 8 (a timeout, a cut
74
75
  connection), the run may have started: retry only with the
75
76
  `--idempotency-key <key>` its error names, never without it, or a second run
76
77
  starts and spends the budget again. `cavelon trace <operation-id>` reads the
@@ -130,8 +131,9 @@ Two reasons end work for capacity; each has its code in `cavelon explain`:
130
131
  `model_endpoint_slot_wait_seconds`. Retry later, or, if the endpoint can serve
131
132
  more, propose raising the Model Registry row's `max_concurrent_requests`
132
133
  (`cavelon models list` shows it). The person decides; only then run
133
- `cavelon models set-limit <model_id> <n>` and the confirm command it prints
134
- (`--confirm <token>` from your shell).
134
+ `cavelon models set-limit <model_id> <n>`: over MCP the client asks the person
135
+ when you confirm with the token; from your shell the person runs the confirm
136
+ command it prints in their own terminal.
135
137
 
136
138
  `cavelon limits` shows the caps, their source and origin, the slot waits, and
137
139
  branch concurrency (how many items of a Map loop run at once, and whether they
@@ -166,12 +168,14 @@ its trigger. `apply` never binds one; it lists unbound triggers in the preview.
166
168
 
167
169
  ```bash
168
170
  cavelon trigger identity <trigger> # who it runs as, what the key must reach
169
- cavelon trigger identity <trigger> <key-name> # shows the change and its confirm token
170
- cavelon trigger identity <trigger> <key-name> --confirm <token> # from your shell; a person's terminal takes a bare --confirm
171
+ cavelon trigger identity <trigger> <key-name> # shows the change
172
+ cavelon trigger identity <trigger> <key-name> --confirm # the person, in their own terminal
171
173
  ```
172
174
 
173
- Binding gives the trigger standing authority over its Sandboxes: show the person
174
- first and confirm only after they agree. Name the key by its name or id, never
175
+ Binding gives the trigger standing authority over its Sandboxes, so the person
176
+ confirms it: over MCP the client asks them when you call `trigger_identity`
177
+ with the preview's token; from your shell they run the confirm command in their
178
+ own terminal. Name the key by its name or id, never
175
179
  its value. A personal access token is never an execution identity. Creating keys
176
180
  and adding a key to a Sandbox's Access stay in the Admin; the output says when
177
181
  that is still missing.
@@ -35,7 +35,9 @@ use it when you parse the result.
35
35
  - **Secrets are set by a person.** When a preview or `cavelon secrets list`
36
36
  names a secret that is not set, tell the person the exact command to run in
37
37
  their terminal, `cavelon secrets set <name>` (as `apply` prints it, with its
38
- `--env` and `--tenant`). Never ask for the value, never pipe or pass one yourself; there is
38
+ `--env` and `--tenant`). Where the instance lets no token set a secret,
39
+ `apply`, `activate`, `status` and `secrets list` name the Admin page
40
+ (Settings › Secrets) instead: tell the person that, not the command. Never ask for the value, never pipe or pass one yourself; there is
39
41
  no MCP tool for it. Plain-text variables you may set with `cavelon variables
40
42
  set <name> <value>` when the value is not a credential and your role may
41
43
  manage the tenant's settings, as for a secret: a Builder's may not, and
@@ -97,10 +99,17 @@ use it when you parse the result.
97
99
  (`cavelon db test <connection>`); you never handle its host, user or
98
100
  password. Use the same connection name in every tenant and environment
99
101
  (`env/test.yaml`, `env/prod.yaml`), each pointing at that environment's
100
- database, so one package serves them all. `cavelon db connections` shows
101
- which exist and whether their last test passed. A pull writes each query's
102
- SQL into `package/tools.yaml`, so the repository holds it: review it like
103
- code.
102
+ database, so one package serves them all. `cavelon db instance` says which
103
+ dialects this instance runs and the addresses it connects from, which the
104
+ customer allows through their database's firewall; tell the person both
105
+ before they set up a connection. The dialects are `postgresql`, `mysql` and
106
+ `mssql` (SQL Server). A SQL Server login that can write keeps the
107
+ connection's queries from running (`write_privileges_unacknowledged`) until
108
+ it may only read or a superadmin acknowledges it in the Admin, so ask for a
109
+ read-only login. `cavelon db connections` shows which exist, whether their
110
+ last test passed, when their CA certificates expire and why a connection's
111
+ queries cannot be enabled. A pull writes each query's SQL into
112
+ `package/tools.yaml`, so the repository holds it: review it like code.
104
113
 
105
114
  ## The loop
106
115
 
@@ -219,9 +228,10 @@ says when the solution it activated is not the default.
219
228
  - **Ask the person** whether the new solution should become the default. It
220
229
  changes live traffic; never decide it yourself.
221
230
  - With their yes: `cavelon activate --make-default` (or `cavelon harness
222
- default <solution>`) shows the change, naming the current default; show it,
223
- then run the confirm command it printed (from your shell it carries the
224
- change's token: `--confirm <token>`). `harness default` refuses a draft
231
+ default <solution>`) shows the change, naming the current default; show it.
232
+ You cannot confirm it yourself: over MCP the client asks the person when you
233
+ call the tool with the preview's token; from your shell the person runs the
234
+ confirm command it printed in their own terminal. `harness default` refuses a draft
225
235
  (`solution_not_active`, exit 4): only an active solution can be the
226
236
  default, so use `cavelon activate --make-default`.
227
237
  - `is_default` in `harnesses.yaml` is not applied by `apply`; the preview
@@ -241,8 +251,12 @@ says when the solution it activated is not the default.
241
251
 
242
252
  ## Show the person before confirming
243
253
 
244
- Confirm on your own only for a draft solution in a test environment. Stop and
245
- show the preview to the person, and confirm only after they agree, when:
254
+ Show every preview to the person. Confirm on your own only a preview that
255
+ needs no person: `apply` to a draft solution in a test environment (the
256
+ preview says nothing about showing it to a person), `loop start` of a trigger
257
+ of a draft solution, `loop cancel` and `sandbox seed` of a test run or Sandbox
258
+ you started, and `kb upload --replace`. Stop, show the preview, and wait for
259
+ the person when:
246
260
 
247
261
  - the preview lists an active solution under "reaches active", or the target
248
262
  solution is active;
@@ -253,24 +267,40 @@ show the preview to the person, and confirm only after they agree, when:
253
267
  `--include-tenant-wide` or on an instance that imports them anyway): every
254
268
  solution of the tenant sees the change;
255
269
  - the preview lists target needs (secrets, grants, identities): only a person
256
- can provide them, with `cavelon secrets set <name>` or in the Admin.
257
-
258
- The same holds for the other commands that take `--confirm`: without it they
259
- only show what would happen. Show it to the person before `cavelon trigger
260
- identity <trigger> <key> --confirm` (it gives a trigger standing authority),
261
- before `cavelon harness default … --confirm`, `cavelon activate
262
- --make-default --confirm` or `cavelon deactivate --confirm` (they move live
263
- traffic), before `cavelon activate --confirm` of a solution its preview says a
264
- channel or trigger reaches (it goes live for them at once), before
265
- `cavelon tenant create … --confirm` (a new tenant on the platform) and
266
- `cavelon variables set … --confirm` that replaces a value (every solution of
267
- the tenant reads it, active ones too), and
268
- before `cavelon sandbox seed … --confirm` or `cavelon loop cancel … --confirm` on
269
- anything but a test Sandbox or a run you started yourself. `cavelon loop start
270
- <trigger>` previews too, because a run acts as the person and spends budget:
271
- confirm it on your own only for a trigger of a draft solution in a test
272
- environment, and show the person every other one. A new variable, and a draft
273
- solution no channel or trigger reaches, need no confirm.
270
+ can provide them, with `cavelon secrets set <name>` or in the Admin, as the
271
+ preview names it.
272
+
273
+ **The person's yes is theirs to give.** For these, and for `tenant create` (a
274
+ new tenant on the platform), `variables set` that replaces a value (every
275
+ solution of the tenant reads it) and `variables delete`, `loop start` of a
276
+ trigger whose solution is not a draft (a run acts as the person and spends
277
+ budget), `limits set`, `models set-limit`, `trigger identity` (standing
278
+ authority for a trigger), `harness default`, `activate --make-default`,
279
+ `activate` of a solution its preview says a channel or trigger reaches,
280
+ `deactivate` (they move live traffic), and `api` for any operation that is
281
+ not read-only, `cavelon` does not take your confirm as theirs. Their preview
282
+ says how in `needs_person`:
283
+
284
+ - `"client"` (over MCP, where your client can ask the person): show the
285
+ preview, then call the tool again with the same arguments and `confirm` set
286
+ to its token (for `apply`, the preview id). The client then asks the person
287
+ to approve exactly that change, and nothing changes without their yes. A no,
288
+ or no answer within 10 minutes, returns `confirm_declined` (exit code 5):
289
+ ask the person what they want instead of trying again.
290
+ - `"terminal"` (your shell, or a client that cannot ask): the preview's
291
+ `confirm` is the command the person runs in their own terminal, not with `!`
292
+ in your session. Give them that command and wait; never run it yourself. A
293
+ token is refused (`confirm_needs_person`, exit code 5).
294
+
295
+ A new variable, and a draft solution no channel or trigger reaches, need no
296
+ confirm.
297
+
298
+ An instance that publishes `confirmations.enforced` checks the person's yes
299
+ too: after it, `cavelon` asks the instance for a confirmation id for exactly
300
+ that request and sends it along; you never handle it. `confirmation_required`
301
+ or `confirmation_invalid` (exit code 5) means the instance changed nothing:
302
+ show the person the preview again and let them confirm it (in the client's
303
+ dialog or their own terminal), never retry on your own.
274
304
 
275
305
  **Over MCP, confirm with the preview's token.** `api`, `tenant_create`,
276
306
  `variables_set` where it replaces a value, `loop_start`, `limits_set`,
@@ -280,7 +310,8 @@ trigger reaches or with `make_default`, and
280
310
  `kb_upload` where it would deactivate documents return a `confirm_token` with
281
311
  their preview. Show
282
312
  the preview, then call the tool again with the same arguments and `confirm`
283
- set to that token; it makes exactly the change shown. `confirm: true` is
313
+ set to that token; it makes exactly the change shown, after the person's yes
314
+ where the preview says `needs_person`. `confirm: true` is
284
315
  refused (`confirm_token_required`), and a token of another change returns the
285
316
  new preview with `token_mismatch` (exit code 4): show that one instead. Tool
286
317
  arguments are spelled in snake_case (`make_default`, `keep_both`, `dry_run`);
@@ -290,14 +321,12 @@ closest one named. Over MCP the next steps a tool returns (hints, `next`,
290
321
  make the call as written, filling a value in angle brackets (a
291
322
  `confirm_token` comes from that tool's preview).
292
323
 
293
- **From your shell, `--confirm` takes the same token.** Run by a coding agent,
294
- `tenant create`, `variables set` (replacing a value), `loop start`,
295
- `limits set`, `models set-limit`, `loop cancel`, `sandbox seed`,
296
- `trigger identity`, `harness default`, `activate` (of a solution a channel or
297
- trigger reaches, or with `--make-default`),
298
- `deactivate`, `kb upload --replace` and `variables delete`
299
- print their preview with a confirm token and the command that confirms it
300
- (`… --confirm <token>`). Show the preview, then run exactly that command. A
324
+ **From your shell, `--confirm` takes the same token, where you may confirm.**
325
+ Run by a coding agent, `loop start` of a draft's trigger, `loop cancel`,
326
+ `sandbox seed` and `kb upload --replace` print their preview with a confirm
327
+ token and the command that confirms it (`… --confirm <token>`). Show the
328
+ preview, then run exactly that command. The changes that need the person's yes
329
+ print no token and name the command the person runs in their own terminal. A
301
330
  bare `--confirm`, as the docs show it for a person's terminal, changes nothing
302
331
  from your shell and exits 5; a token of another change exits 4 with the new
303
332
  preview. A line printed before its preview exists ends in
@@ -307,10 +336,11 @@ preview. A line printed before its preview exists ends in
307
336
  **`cavelon api` from your shell has the guards of the MCP `api` tool**, since
308
337
  `cavelon` sees that a coding agent runs it:
309
338
 
310
- - For an operation that is not read-only, it prints the request and a confirm
311
- token and sends nothing. Show the request to the person when the rules above
312
- say so, then run the same command again with `--confirm <token>`; it sends
313
- exactly that request. A changed body or parameter needs a new preview (exit 4).
339
+ - For an operation that is not read-only, it prints the request and the
340
+ command the person runs in their own terminal to send it, and sends nothing.
341
+ Show both to the person; you cannot send it yourself, with or without a
342
+ token (`confirm_needs_person`). Over MCP the `api` tool sends it after the
343
+ person's yes in the client.
314
344
  - It refuses an operation the instance keeps for a person
315
345
  (`operation_for_a_person`) and a body that sets a field the instance marks as
316
346
  a secret value (`secret_field_for_a_person`), with or without `--confirm`,
@@ -249,10 +249,12 @@ which the tenant's chat and widget never answer with; a draft answers only a
249
249
  person's token, as a Playground run. `cavelon api chat` with `harness_id` in
250
250
  the body does the same, but needs the id and a confirm. `cavelon deactivate
251
251
  --harness <solution>` takes an active solution out of live traffic again; it
252
- previews first and is the person's decision, so show the preview and confirm
253
- only with their yes. When every suite passes,
252
+ previews first and is the person's decision: show the preview; over MCP the
253
+ client asks them when you confirm with its token, and from your shell they run
254
+ the confirm command in their own terminal. When every suite passes,
254
255
  `cavelon activate --harness <name or slug>` goes through the readiness gate; if the
255
256
  token may not activate, a person activates in the Admin. A solution that a
256
257
  channel or an active trigger reaches goes live for them at once, so its
257
- activation previews first and needs the confirm it prints: show it to the
258
- person and confirm only with their yes.
258
+ activation previews first and needs the person's yes: show it; over MCP the
259
+ client asks them when you confirm with its token, and from your shell they run
260
+ the confirm command in their own terminal.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "The cavelon binary: CLI and local MCP server for building Cavelon solutions with a coding agent.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/goodguys-gmbh/cavelon-dev-kit",