@cavelon/cli 0.2.1 → 0.2.2

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.
@@ -0,0 +1,43 @@
1
+ function object(value) {
2
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3
+ }
4
+ function fields(body, allowed) {
5
+ return object(body) && Object.keys(body).every(key => allowed.includes(key));
6
+ }
7
+ function optionalText(body, keys) {
8
+ return keys.every(key => body[key] === undefined || body[key] === null || typeof body[key] === "string");
9
+ }
10
+ export function apiApproval(op, args) {
11
+ if (op.confirmation || op.personOnly?.marked)
12
+ return "person";
13
+ if (op.readOnly)
14
+ return "read";
15
+ if (op.method !== "POST" || args.files?.length || args.bytes || Object.keys(args.headers ?? {}).length)
16
+ return "person";
17
+ const params = Object.keys(args.params ?? {});
18
+ const onlyParams = (...names) => params.every(key => names.includes(key));
19
+ const uuidParam = (name) => {
20
+ const values = args.params?.[name];
21
+ return values?.length === 1 && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(values[0]);
22
+ };
23
+ const body = args.body;
24
+ if (op.path === "/api/v1/harnesses" && onlyParams("Idempotency-Key") &&
25
+ fields(body, ["slug", "name", "description"]) && typeof body.slug === "string" && typeof body.name === "string" &&
26
+ optionalText(body, ["description"]))
27
+ return "routine";
28
+ if (op.path === "/api/v1/harnesses/{harness_id}/clone" && onlyParams("harness_id", "Idempotency-Key") && uuidParam("harness_id") &&
29
+ fields(body, ["slug", "name", "description", "element_slug_suffix", "include_tests", "include_triggers"]) &&
30
+ optionalText(body, ["slug", "name", "description", "element_slug_suffix"]) &&
31
+ ["include_tests", "include_triggers"].every(key => body[key] === undefined || typeof body[key] === "boolean"))
32
+ return "routine";
33
+ if (op.path === "/api/v1/agent-graph/import/preview" && onlyParams() &&
34
+ fields(body, ["package", "mode", "harness_id", "runtime_bindings", "include_tenant_wide"]) && object(body.package) &&
35
+ (body.mode === undefined || body.mode === "overwrite" || body.mode === "replace") && optionalText(body, ["harness_id"]) &&
36
+ (body.runtime_bindings === undefined || object(body.runtime_bindings) && Object.values(body.runtime_bindings).every(value => typeof value === "string")) &&
37
+ (body.include_tenant_wide === undefined || typeof body.include_tenant_wide === "boolean"))
38
+ return "read";
39
+ if (op.path === "/api/v1/database-connectors/connections/{connection_id}/schema" && onlyParams("connection_id") && uuidParam("connection_id") &&
40
+ (body === undefined || body === null || fields(body, ["schema"]) && optionalText(body, ["schema"])))
41
+ return "read";
42
+ return "person";
43
+ }
@@ -0,0 +1,45 @@
1
+ import { createHash } from "node:crypto";
2
+ import { realpath } from "node:fs/promises";
3
+ import { actingTarget } from "./acting.js";
4
+ import { canonical } from "./package-files.js";
5
+ import { lookupHarness } from "./harness-ref.js";
6
+ export async function yoloScope(ctx) {
7
+ const session = await ctx.session();
8
+ const target = await actingTarget(ctx);
9
+ if (!session.token || target.mode !== "tenant" || !target.tenant?.id)
10
+ return undefined;
11
+ const selected = session.envFile?.harness ?? session.project?.harness;
12
+ const harness = selected ? (await lookupHarness(ctx, selected)).harness : undefined;
13
+ if (selected && !harness)
14
+ return undefined;
15
+ return canonical({
16
+ instance: target.instance,
17
+ tenant: target.tenant.id,
18
+ credential: createHash("sha256").update(session.token).digest("hex"),
19
+ root: await realpath(session.project?.root ?? ctx.io.cwd),
20
+ harness: selected ?? null,
21
+ harness_id: harness?.id ?? null,
22
+ environment: ctx.globals.solutionEnv ?? null,
23
+ bindings: session.envFile?.runtimeBindings ?? {},
24
+ mode: session.envFile?.mode ?? null,
25
+ });
26
+ }
27
+ export async function yoloAllows(ctx, harness) {
28
+ if (!ctx.globals.yolo)
29
+ return false;
30
+ const original = await ctx.globals.yoloScope;
31
+ const current = await yoloScope(ctx);
32
+ if (!original || current !== original) {
33
+ ctx.warn("YOLO does not cover this target, credential or solution folder; using the standard confirmation policy. Restart with the intended target to enable it there.");
34
+ return false;
35
+ }
36
+ if (harness) {
37
+ const session = await ctx.session();
38
+ const selected = session.envFile?.harness ?? session.project?.harness;
39
+ if (!selected || (await lookupHarness(ctx, selected)).harness?.id !== harness.id) {
40
+ ctx.warn("YOLO covers only the solution selected at startup; using the standard confirmation policy for this solution.");
41
+ return false;
42
+ }
43
+ }
44
+ return true;
45
+ }
package/dist/command.js CHANGED
@@ -37,6 +37,7 @@ export function ownsTenant(spec) {
37
37
  }
38
38
  export const GLOBAL_OPTIONS = {
39
39
  json: { type: "boolean", description: "Print one JSON document instead of text." },
40
+ yolo: { type: "boolean", cliOnly: true, description: "Automatically apply eligible routine changes in this process's selected target; critical changes still need a person." },
40
41
  instance: { type: "string", value: "<url>", description: "The instance URL (overrides CAVELON_URL and cavelon.yaml)." },
41
42
  tenant: { type: "string", value: "<tenant>", description: "Tenant slug, name or id (overrides CAVELON_TENANT and cavelon.yaml)." },
42
43
  help: { type: "boolean", short: "h", description: "Show help for the command." },
@@ -13,6 +13,8 @@ import { CONFIRM_TOKEN, confirmInTerminal, confirmThroughClient, confirmToken, c
13
13
  import { actingTarget, targetLine } from "../acting.js";
14
14
  import { accessFor, operationAccess } from "../access.js";
15
15
  import { cavelonCommand, fill, personCommand } from "../printed.js";
16
+ import { apiApproval } from "../api-approval-policy.js";
17
+ import { yoloAllows } from "../automation-policy.js";
16
18
  export const JSON_BODY_DEPRECATED = "`--json <body>` as the request body is deprecated and will be removed in a later release; pass the body with --body. " +
17
19
  "--json alone prints JSON, as on every command.";
18
20
  export function splitJsonBody(args, warn) {
@@ -202,9 +204,10 @@ export const api = {
202
204
  "As an MCP tool, or run by a coding agent (" +
203
205
  AGENT_VARIABLES.filter((v) => v.variable !== "CAVELON_AGENT").map((v) => (v.value ? `${v.variable}=${v.value}` : v.variable)).join(", ") +
204
206
  "\nor CAVELON_AGENT=1 is set), an operation that changes something returns what it would send and a confirm token,\n" +
205
- "and sends it only with that token and the person's yes: as an MCP tool, confirm: \"<token>\", after which the client\n" +
206
- "asks the person; from an agent's shell, the person sends it from their own terminal. A changed request needs a new\n" +
207
- "preview; confirm: true is refused.\n" +
207
+ "and sends it with that token. Known draft creation and cloning need no personal approval; explicit --yolo also\n" +
208
+ "skips their token round trip within its bound scope. Known import previews and database catalog reads send at once.\n" +
209
+ "Other changes still need the person's yes: the MCP client asks them, or they send it from their own terminal.\n" +
210
+ "A changed request needs a new preview; confirm: true is refused. Instance confirmation requirements always win.\n" +
208
211
  "Run by an agent, one the instance marks for a person only (x-cavelon-person-only) is refused, as is a body that\n" +
209
212
  "sets a field the instance marks as a secret value (x-cavelon-secret) and a file outside the solution folder. On an\n" +
210
213
  "instance that marks no operation, one that changes a secret, creates or revokes a credential or decides an\n" +
@@ -227,8 +230,8 @@ export const api = {
227
230
  type: "string",
228
231
  value: "<token>",
229
232
  mcpToken: true,
230
- description: "Send an operation that changes something: run by a coding agent or as an MCP tool, the token its preview returned. " +
231
- "Without it, nothing is sent. A person's terminal sends at once.",
233
+ description: "Send a previewed operation: run by a coding agent or as an MCP tool, the token its preview returned. " +
234
+ "Known routine changes need no person; other changes require personal approval. A person's terminal sends at once.",
232
235
  },
233
236
  limit: { type: "string", value: "<n>", description: "Show at most n items of a list response (default 50, 0 for all)." },
234
237
  },
@@ -283,7 +286,7 @@ export const api = {
283
286
  ...(rawBody !== undefined ? ["--body", rawBody] : []),
284
287
  ...listOption(input, "file").flatMap((f) => ["--file", f]),
285
288
  ];
286
- const preview = await previewUnlessConfirmed(ctx, input, doc, op, args, driven, personCommand(...words));
289
+ const preview = await previewUnlessConfirmed(ctx, input, doc, op, args, driven, words);
287
290
  if (preview)
288
291
  return preview;
289
292
  }
@@ -308,29 +311,40 @@ export const api = {
308
311
  return { data, text };
309
312
  },
310
313
  };
311
- async function previewUnlessConfirmed(ctx, input, doc, op, args, driven, command) {
314
+ async function previewUnlessConfirmed(ctx, input, doc, op, args, driven, words) {
312
315
  const given = input.options.confirm;
313
316
  if (given === true)
314
317
  throw confirmTokenRequired("api");
315
318
  const request = previewRequest(doc, op, args);
319
+ const policy = apiApproval(op, args);
320
+ const needsPerson = policy === "person";
321
+ const harness = op.path === "/api/v1/harnesses/{harness_id}/clone" ? { id: args.params?.harness_id?.at(-1) ?? "" } : undefined;
322
+ if ((given === undefined || given === false) &&
323
+ (policy === "read" || policy === "routine" && await yoloAllows(ctx, harness)))
324
+ return undefined;
316
325
  const files = (args.files ?? []).map((f) => ({ field: f.field, file: path.relative(ctx.io.cwd, f.path) || f.path }));
317
326
  const session = await ctx.session();
318
327
  const token = confirmToken({ url: session.url, tenant: session.tenant }, "api", { request, files });
319
328
  const route = personRoute(ctx, driven);
329
+ const command = personCommand(...words);
320
330
  if (typeof given === "string" && given === token) {
321
- await personApproves(ctx, driven, { tool: "api", what: `Send ${request.method} ${request.path} (${op.alias}).`, command });
331
+ if (needsPerson)
332
+ await personApproves(ctx, driven, { tool: "api", what: `Send ${request.method} ${request.path} (${op.alias}).`, command });
322
333
  return undefined;
323
334
  }
324
335
  const stale = typeof given === "string" && given !== "";
325
336
  const bare = given === "" && driven.by === "agent";
326
- const confirm = route === "client" ? confirmThroughClient("api", token) : confirmInTerminal(command);
337
+ const confirm = needsPerson
338
+ ? route === "client" ? confirmThroughClient("api", token) : confirmInTerminal(command)
339
+ : driven.by === "mcp" ? `Call api again with the same arguments and confirm: "${token}". No personal approval is needed for this routine operation.`
340
+ : personCommand(...words, "--confirm", token);
327
341
  const target = await actingTarget(ctx);
328
342
  const shown = { operation: op.alias, ...request, ...(files.length ? { files } : {}), target, sent: false };
329
343
  const lines = [`Would send ${request.method} ${request.path}. Nothing was sent.`, targetLine(target)];
330
344
  if (stale)
331
345
  lines.push("The confirm token is not this request's: the request changed since its preview, or the token is another one's.");
332
- if (bare && driven.by === "agent")
333
- lines.push("A coding agent cannot send it: the person sends it from their own terminal.");
346
+ if (bare)
347
+ lines.push(needsPerson ? "A coding agent cannot send it: the person sends it from their own terminal." : "Pass this request's confirm token; a bare --confirm sends nothing.");
334
348
  if (op.confirmation) {
335
349
  lines.push(`The instance requires a confirmation bound to this request (x-cavelon-confirmation)${op.confirmationWhen ? `: ${op.confirmationWhen}` : ""}`, "cavelon asks the person; the instance does not verify their answer.");
336
350
  }
@@ -346,9 +360,9 @@ async function previewUnlessConfirmed(ctx, input, doc, op, args, driven, command
346
360
  return {
347
361
  data: {
348
362
  ...shown,
349
- ...(route === "client" ? { confirm_token: token } : {}),
363
+ ...(!needsPerson || route === "client" ? { confirm_token: token } : {}),
350
364
  confirm,
351
- needs_person: route,
365
+ ...(needsPerson ? { needs_person: route } : {}),
352
366
  ...(op.confirmation ? { instance_confirmation: op.confirmationWhen ?? true } : {}),
353
367
  ...(stale ? { token_mismatch: true } : {}),
354
368
  ...(bare ? { token_required: true } : {}),
@@ -44,10 +44,13 @@ const mcp = {
44
44
  description: "Started by the agent's plugin (`cavelon mcp`); it does not return until the agent disconnects.",
45
45
  readOnly: false,
46
46
  mcpTool: false,
47
+ options: { env: { type: "string", value: "<name>", description: "Start with env/<name>.yaml's tenant, solution and runtime bindings; --yolo stays bound to this environment." } },
47
48
  async run(ctx) {
49
+ if (ctx.globals.solutionEnv)
50
+ await ctx.session();
48
51
  const { createMcpServer } = await import("../mcp.js");
49
52
  const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
50
- const server = createMcpServer(ctx.io, COMMANDS);
53
+ const server = createMcpServer(ctx.io, COMMANDS, {}, ctx.globals);
51
54
  const transport = new StdioServerTransport();
52
55
  const closed = new Promise((resolve) => {
53
56
  server.onclose = () => resolve();
@@ -1,4 +1,5 @@
1
1
  import { noteLines, runCapacityNote } from "../capacity.js";
2
+ import { yoloAllows } from "../automation-policy.js";
2
3
  import { boolOption, CURSOR_OPTION, intOption, LIMIT_OPTION, positional, stringOption, } from "../command.js";
3
4
  import { CavelonError, ExitCode, usageError } from "../errors.js";
4
5
  import { confirmation, confirmTokenRequired, PERSON_CONFIRMS_HELP } from "../confirm-token.js";
@@ -180,8 +181,8 @@ export const loopStart = {
180
181
  name: "loop start",
181
182
  summary: "Start a loop through its trigger, as you; previews first, --confirm starts it and returns the run and operation ids.",
182
183
  description: "Calls the trigger's run-now route. The run (and its loop) acts as the caller: with a personal access token, the person.\n" +
183
- "It runs on its own and spends the tenant's model budget, so without --confirm nothing starts: the preview names the\n" +
184
- "trigger, its solution and the payload. Show it to a person and confirm only with their yes. For a trigger of a draft\n" +
184
+ "It runs on its own and spends the tenant's model budget. The preview names the trigger, its solution and the payload.\n" +
185
+ "--yolo starts a draft's run at once only for the solution selected at startup; existing budget limits still apply. For a trigger of a draft\n" +
185
186
  "solution an agent confirms with the preview's token (--confirm <token>, or confirm over MCP); for any other,\n" +
186
187
  "a coding agent cannot confirm it: over MCP the client asks the person, and from an agent's shell the person runs the\n" +
187
188
  "confirm in their own terminal. Follow the run with `loop watch <run>`, or `wait <operation>`; `loop cancel <run>` stops it.",
@@ -194,7 +195,7 @@ export const loopStart = {
194
195
  wait: WAIT_OPTION,
195
196
  timeout: TIMEOUT_OPTION,
196
197
  "idempotency-key": UUID_KEY_OPTION,
197
- confirm: { type: "boolean", mcpToken: true, description: "Start the run (after a person saw the preview)." },
198
+ confirm: { type: "boolean", mcpToken: true, description: "Start the previewed run; a non-draft run also needs the person's approval." },
198
199
  },
199
200
  examples: [
200
201
  "cavelon loop start counter",
@@ -214,9 +215,10 @@ export const loopStart = {
214
215
  const solution = await triggerSolution(ctx, trigger);
215
216
  const given = stringOption(input, "idempotency-key");
216
217
  const words = ["loop", "start", trigger.slug, ...(raw !== undefined ? ["--input", raw] : []), ...(given ? ["--idempotency-key", given] : [])];
218
+ const automatic = input.options.confirm === undefined && solution?.status === "draft" && await yoloAllows(ctx, solution);
217
219
  const gate = await confirmation(ctx, input, "loop_start", { trigger: trigger.id, payload }, {
218
220
  ...(solution?.status === "draft"
219
- ? {}
221
+ ? { automatic }
220
222
  : { person: { what: `Start a run of the trigger ${trigger.slug}, which acts as the person and spends the tenant's model budget.`, words: [...words, "--confirm"] } }),
221
223
  });
222
224
  if (!gate.confirmed) {
@@ -241,7 +243,7 @@ export const loopStart = {
241
243
  : `Solution: ${solution.id} (not readable).`,
242
244
  `Payload: ${payloadText}`,
243
245
  gate.where, ...(gate.mismatch ? [gate.mismatch] : []),
244
- `Nothing was started. Show this to a person; with their yes: ${confirm}`,
246
+ solution?.status === "draft" ? `Nothing was started. Confirm the requested draft run with: ${confirm}` : `Nothing was started. The person approves this run with: ${confirm}`,
245
247
  ].join("\n"),
246
248
  ...(gate.exitCode ? { exitCode: gate.exitCode } : {}),
247
249
  };
@@ -256,7 +258,8 @@ export const loopStart = {
256
258
  });
257
259
  if (!trigger.is_active)
258
260
  ctx.warn(`Trigger "${trigger.slug}" is not active: its schedule and webhook start no runs, though this manual start did.`);
259
- const started = { trigger: { id: trigger.id, slug: trigger.slug }, ...runSummary(run), idempotency_key: key };
261
+ const started = { trigger: { id: trigger.id, slug: trigger.slug }, ...runSummary(run), idempotency_key: key,
262
+ ...(automatic ? { approval: { source: "yolo", reason: "selected draft run" } } : {}) };
260
263
  if (boolOption(input, "wait") && ctx.mode === "cli" && run.operation_id) {
261
264
  const waited = await waitAndReport(ctx, [run.operation_id], timeoutMs(ctx, stringOption(input, "timeout")));
262
265
  const text = `Started run ${run.id} of ${trigger.slug}.\n${waited.text}`;
@@ -18,6 +18,7 @@ import { ceilingHint, LIMIT_ABOVE_CEILING, parseLimits, readLimits } from "../li
18
18
  import { digest, fileDigest, fileDigests, listPreviews, loadPreview, previewExpiry, readItemFiles, readPulledFiles, rememberAppliedFiles, retiredPreview, retirePreviews, savePreview, writePulledFiles, writeState, } from "../local-state.js";
19
19
  import { catalogEntry, checkPackage, KIT_CODES, packageVersionOf } from "../package-check.js";
20
20
  import { applyQueryNotes, connectorOffer, importWritesQueries, NEEDS_SUPERADMIN_CODE, queryBlockedHint, queryChanges, queryTools, readQueryBaseline, rememberQueries, schemaKnowsWrites } from "../database-queries.js";
21
+ import { yoloAllows } from "../automation-policy.js";
21
22
  import { cliFix, similarCodes } from "../code-hints.js";
22
23
  import { KIT_ERROR_CODES } from "../kit-codes.js";
23
24
  import { confirmationPointer } from "../change-confirmation.js";
@@ -726,7 +727,7 @@ function importNeedsAPerson(access) {
726
727
  details: { credential: access?.kind ?? null, needs_a_person: true, reason: person },
727
728
  });
728
729
  }
729
- async function confirmPreview(ctx, project, previewId, allowStale) {
730
+ async function confirmPreview(ctx, project, previewId, allowStale, automatic = false) {
730
731
  const stored = await loadPreview(project.root, previewId);
731
732
  const session = await ctx.session();
732
733
  if (!stored) {
@@ -770,13 +771,6 @@ async function confirmPreview(ctx, project, previewId, allowStale) {
770
771
  const driven = drivenByAgent(ctx);
771
772
  const queries = importWritesQueries(stored.preview);
772
773
  const guarded = queries || stored.request[INCLUDE_TENANT_WIDE] === true || stored.request.package.manifest?.scope === "full_config";
773
- if (driven && (queries || stored.person_reason !== null)) {
774
- const into = stored.harness ? `solution ${stored.harness.slug}` : "the tenant";
775
- const reason = stored.person_reason ?? (queries ? QUERY_IMPORT_REASON : "was stored by an older cavelon, which did not record whether it needs a person");
776
- await personApproves(ctx, driven, { tool: "apply", what: `Import preview ${stored.preview_id} into ${into}: it ${reason}.`, command: personApplyCommand(stored), guarded });
777
- }
778
- else if (!driven)
779
- ctx.approved = { guarded };
780
774
  const acting = await actingTarget(ctx);
781
775
  const disk = await readPackage(project.root, project.layout);
782
776
  const changed = await filesChangedSince(project, stored, disk);
@@ -793,6 +787,13 @@ async function confirmPreview(ctx, project, previewId, allowStale) {
793
787
  ctx.warn(`The package files changed since this preview${changed.length ? ` (${list(changed, 5)})` : ""}; importing what the preview showed (--allow-stale). ` +
794
788
  `The files keep their changes, which the instance does not hold; run \`${cavelonCommand("apply")}\` to preview them.`);
795
789
  }
790
+ if (driven && (queries || stored.person_reason !== null)) {
791
+ const into = stored.harness ? `solution ${stored.harness.slug}` : "the tenant";
792
+ const reason = stored.person_reason ?? (queries ? QUERY_IMPORT_REASON : "was stored by an older cavelon, which did not record whether it needs a person");
793
+ await personApproves(ctx, driven, { tool: "apply", what: `Import preview ${stored.preview_id} into ${into}: it ${reason}.`, command: personApplyCommand(stored), guarded });
794
+ }
795
+ else if (!driven && !automatic)
796
+ ctx.approved = { guarded };
796
797
  try {
797
798
  const result = await callStable(ctx, "POST", "/api/v1/agent-graph/import", "importing packages", {
798
799
  body: { ...stored.request, preview_id: stored.preview_id },
@@ -951,7 +952,8 @@ function personReason(preview, harness, mode, env, shared = [], sharedReaches =
951
952
  export const apply = {
952
953
  name: "apply",
953
954
  summary: "Preview the package files against the instance and print a preview id; --confirm <id> imports exactly that preview.",
954
- description: "Without --confirm nothing is imported: the preview shows what changes, which active solutions it reaches, what the target\n" +
955
+ description: "Without --confirm, shows a preview. With --yolo, an eligible routine draft is previewed and imported in one call.\n" +
956
+ "The preview shows what changes, which active solutions it reaches, what the target\n" +
955
957
  "still needs (secrets and variables with the command that sets each, grants, runtime bindings, trigger identities), loop\n" +
956
958
  "budgets and ignored sections, and is stored in .cavelon/. A preview never creates the solution: one the env file names\n" +
957
959
  "that is not on the instance yet gets the `cavelon harness new` command that creates it as a draft. A person sets the\n" +
@@ -1179,6 +1181,18 @@ export const apply = {
1179
1181
  const expired = (await listPreviews(project.root, ctx.io.now())).filter((old) => old.expired);
1180
1182
  await retirePreviews(project.root, expired.map((old) => ({ preview_id: old.preview_id, reason: "expired", at })));
1181
1183
  }
1184
+ const queryEffectsKnown = !queryTools(disk.package).length ||
1185
+ Array.isArray(preview.database_queries?.would_write);
1186
+ if (preview.preview_id && !reason && !refusal && harness?.status === "draft" &&
1187
+ scope === "agent_graph" && queryEffectsKnown && preview.summary && Array.isArray(preview.impact?.active_harnesses) &&
1188
+ await yoloAllows(ctx, harness)) {
1189
+ const applied = await confirmPreview(ctx, project, preview.preview_id, false, true);
1190
+ return {
1191
+ ...applied,
1192
+ data: { ...applied.data, approval: { source: "yolo", reason: "routine draft import" } },
1193
+ text: `YOLO: validated and previewed the routine draft change.\n${applied.text}`,
1194
+ };
1195
+ }
1182
1196
  data.show_to_person = Boolean(reason || refusal);
1183
1197
  const driven = drivenByAgent(ctx);
1184
1198
  const route = !refusal && driven && reason && preview.preview_id ? personRoute(ctx, driven) : undefined;
@@ -39,6 +39,9 @@ async function gateOf(ctx, input, tool, change, options) {
39
39
  const given = input.options.confirm;
40
40
  const driven = drivenByAgent(ctx);
41
41
  const tokenGiven = typeof given === "string" && given !== "";
42
+ if (options.automatic && !options.person && given === undefined) {
43
+ return { confirmed: true, fields: {}, confirm: (command) => command };
44
+ }
42
45
  const approve = () => {
43
46
  if (!driven)
44
47
  ctx.approved = { guarded: Boolean(options.person) };
@@ -86,7 +89,7 @@ async function gateOf(ctx, input, tool, change, options) {
86
89
  confirmed: false,
87
90
  fields: { confirm_token: token, token_required: true },
88
91
  confirm,
89
- mismatch: `--confirm alone does not confirm when a coding agent runs cavelon. Nothing was changed: show the person this preview, and with their yes run the command below, which carries this change's token.`,
92
+ mismatch: `--confirm alone does not confirm when a coding agent runs cavelon. Nothing was changed: review this preview against the requested work, then run the command below, which carries this change's token.`,
90
93
  exitCode: ExitCode.needsAction,
91
94
  };
92
95
  }
@@ -134,7 +137,7 @@ export function needsPerson(command) {
134
137
  });
135
138
  }
136
139
  export function confirmThroughClient(tool, token) {
137
- return `Show the person this, then call ${tool} again with the same arguments and confirm: "${token}": the client then asks the person to approve exactly this change, and nothing changes without their yes.`;
140
+ return `Call ${tool} again with the same arguments and confirm: "${token}": the client asks the person to approve exactly this change. Do not ask for an additional chat confirmation; nothing changes without the dialog's yes.`;
138
141
  }
139
142
  export function confirmInTerminal(command) {
140
143
  return `${command} (the person runs it in their own terminal: a coding agent cannot confirm this change)`;
@@ -143,16 +146,16 @@ export function shellTokenRequired(command) {
143
146
  return new CavelonError(ExitCode.needsAction, {
144
147
  code: "confirm_token_required",
145
148
  message: "--confirm alone does not confirm when a coding agent runs cavelon; nothing was changed.",
146
- hint: `Run \`${command}\` without --confirm, show the person the preview, and with their yes run the command it prints, which carries the change's token.`,
149
+ hint: `Run \`${command}\` without --confirm and review the preview. Follow needs_person when present; otherwise confirm the requested work with the token it prints.`,
147
150
  });
148
151
  }
149
152
  export function confirmTokenRequired(tool) {
150
153
  return new CavelonError(ExitCode.usage, {
151
154
  code: "confirm_token_required",
152
155
  message: `${tool} confirms only with the confirm_token its preview returned, not with true; nothing was changed.`,
153
- hint: `Call ${tool} without confirm, show the person what it would do, then call it again with the same arguments and confirm set to its confirm_token.`,
156
+ hint: `Call ${tool} without confirm and review the preview. Follow needs_person when present; otherwise call it again for the requested work with confirm set to its confirm_token.`,
154
157
  });
155
158
  }
156
159
  export function confirmWith(tool, token) {
157
- return `Show the person this, then call ${tool} again with the same arguments and confirm: "${token}" to make exactly this change.`;
160
+ return `Review this preview against the requested work, then call ${tool} again with the same arguments and confirm: "${token}" to make exactly this change. No additional person approval is required.`;
158
161
  }
package/dist/context.js CHANGED
@@ -10,6 +10,7 @@ import { promises as fs } from "node:fs";
10
10
  import { checkPrivatePaths, solutionPaths } from "./file-boundary.js";
11
11
  import { privateDirs as kitPrivateDirs } from "./paths.js";
12
12
  import path from "node:path";
13
+ import { yoloScope } from "./automation-policy.js";
13
14
  export function createContext(io, globals, mode = "cli") {
14
15
  const warnings = [];
15
16
  useShell(detectShell(io.env));
@@ -76,6 +77,8 @@ export function createContext(io, globals, mode = "cli") {
76
77
  return contractsPromise;
77
78
  },
78
79
  };
80
+ if (globals.yolo && !globals.yoloScope)
81
+ globals.yoloScope = yoloScope(ctx).catch(() => undefined);
79
82
  return ctx;
80
83
  }
81
84
  export function withWarnings(data, warnings) {
package/dist/main.js CHANGED
@@ -47,6 +47,7 @@ export async function run(argv, io, commands = COMMANDS, updates = {}) {
47
47
  }
48
48
  ctx = createContext(io, {
49
49
  json: parsed.options.json === true,
50
+ yolo: parsed.options.yolo === true,
50
51
  instance: typeof parsed.options.instance === "string" ? parsed.options.instance : undefined,
51
52
  tenant: typeof parsed.options.tenant === "string" ? parsed.options.tenant : undefined,
52
53
  solutionEnv: spec.options?.env && typeof parsed.options.env === "string" ? parsed.options.env : undefined,
package/dist/mcp.js CHANGED
@@ -15,27 +15,19 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
15
15
  "(or CAVELON_TOKEN). You never see or pass the token. Tools that start work (kb_upload, test_run, " +
16
16
  "loop_start, sandbox_seed, artifacts_export) return operation ids at once; read them with operation_status, which returns " +
17
17
  `the state at once, or waits up to its timeout (at most ${MCP_MAX_WAIT_MS / 1000} s) when given one, and reports waited_ms, ` +
18
- "and follow a loop with loop_iterations. What needs confirmation: apply imports only with confirm set to a preview's id; " +
19
- "tenant_create, variables_set where it replaces another value, variables_delete, loop_start, limits_set, models_set_limit, loop_cancel, sandbox_seed, " +
20
- "trigger_identity, harness_default, activate of a solution a channel or trigger reaches or with make_default, deactivate, " +
21
- "and api for an operation that is not read-only, " +
22
- "return what they would do and a confirm_token, and change nothing until called again with the same arguments and " +
23
- "confirm set to that token: show the person the preview first. The token confirms exactly the change the preview showed; " +
24
- "a different change needs a new preview, and confirm: true is refused. A change that reaches live traffic or the whole tenant, " +
25
- "or that cannot be taken back, is the person's to confirm, and the token alone does not make it: its preview says " +
26
- "needs_person. With needs_person \"client\", call again with the token and the client asks the person to approve exactly that " +
27
- "change; their no, or no answer, changes nothing (confirm_declined). Only after their yes does cavelon ask the instance for " +
28
- "confirmation bound to the token, tenant and exact request. The instance does not verify the person's answer: asking them " +
29
- "is the kit's responsibility alone. Ask before every guarded change; never answer on the person's behalf or reuse an earlier yes for another change. " +
30
- "confirmation_required or confirmation_invalid changed nothing: preview again, never retry " +
31
- "on your own. With needs_person \"terminal\" this client cannot ask " +
32
- "them: give the person the preview's confirm command, which they run in their own terminal, never in yours. These are " +
33
- "harness_default and activate (the default route and a solution something reaches: live traffic), deactivate, tenant_create, " +
34
- "variables_set replacing a value (every solution of the tenant reads it), variables_delete, limits_set, models_set_limit, trigger_identity, " +
35
- "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 " +
36
- "and spends budget), and apply where its preview says show_to_person (tenant-wide sections, an active solution, deletions, " +
37
- "env/prod, or database_queries.would_write). A draft's apply with no query writes or other person requirement, a draft's loop_start, loop_cancel, sandbox_seed and kb_upload's replace you confirm with the " +
38
- "token once the person saw the preview. " +
18
+ "and follow a loop with loop_iterations. Routine work within the user's request needs no additional chat approval. " +
19
+ "In standard mode, review previews and confirm the exact token or apply preview id when no needs_person is present. " +
20
+ "A token binds one change, not a person's answer; confirm: true is refused, and changed input needs a new preview. " +
21
+ "If this server was explicitly launched with --yolo, eligible routine draft imports, selected draft loop starts and known " +
22
+ "routine API operations can execute in one call within the original instance, tenant, credential and solution scope. " +
23
+ "No tool argument or repository setting can enable this mode. A different target falls back to standard confirmation. " +
24
+ "Critical, shared, live and unknown changes retain needs_person in either mode. With needs_person \"client\", " +
25
+ "call again with the preview token: the client asks the person once. Do not ask for a separate chat yes before that dialog. " +
26
+ "Declined or unanswered dialogs change nothing; never supply the person's answer or reuse an earlier yes for another critical change. " +
27
+ "With needs_person \"terminal\", give the person the exact command to run in their own terminal, never the agent's shell. " +
28
+ "Instance confirmation ids remain bound to the exact request and are requested only after person approval; routine automation " +
29
+ "does not manufacture that approval. confirmation_required or confirmation_invalid changed nothing: return to a preview " +
30
+ "and the required person approval. YOLO never overrides person-only access or customer database-write consent. " +
39
31
  "chat sends one message to a solution and returns its answer: the way to try one that is not the default route. " +
40
32
  "kb_upload names files that match an active document of the knowledge base; with replace it replaces them, and where the " +
41
33
  "instance's upload cannot, it returns what it would deactivate and uploads nothing without its confirm_token. " +
@@ -48,8 +40,7 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
48
40
  "A tool whose description starts with \"Not for this credential\" is one the instance says this token or key may not use " +
49
41
  "in this tenant (whoami lists its permissions, an API key's scopes and the operations a person runs): do not call it to " +
50
42
  "find out; tell the person who does it. api_list marks such operations (may_send false) and leaves them out with usable. " +
51
- "Run from your shell, cavelon's api command applies the same guards, and sends a changing operation only with --confirm and the token " +
52
- "its preview printed. Tools read and write files only " +
43
+ "Run from your shell, cavelon's api command applies the same policy. Tools read and write files only " +
53
44
  "inside the solution folder (the folder of cavelon.yaml, or the one the server started in), never in cavelon's own " +
54
45
  "directories. In a repository with several solutions, pass solution_dir to select a folder inside the server's startup workspace. " +
55
46
  "Use the same solution_dir for preview, confirmation and follow-up tools; harness selects an instance solution, not its local folder. Never infer a folder from a harness name. " +
@@ -73,7 +64,7 @@ const INSTRUCTIONS = "Tools for one Cavelon instance, acting with the token a pe
73
64
  "that stays with a person. Use docs_search before guessing, " +
74
65
  "and api_list/api_describe/api for anything without its own tool. " +
75
66
  "use_tenant chooses the tenant for this MCP session only and never changes the tenant stored for the person; every preview " +
76
- "names the instance, the tenant and the mode it acts on (its target): show that to the person with the change. " +
67
+ "names the instance, tenant and mode it acts on (its target); check these against the requested work. " +
77
68
  "The first result of a session may carry a warning that cavelon, the Cavelon plugin or this folder's skills are behind " +
78
69
  "the latest release, with the commands that update them: pass it on to the person, who runs them; do not run them yourself.";
79
70
  export function mcpInstructions(commands) {
@@ -246,15 +237,16 @@ async function askThroughClient(server, message, relatedRequestId) {
246
237
  function mcpIo(io) {
247
238
  return { ...io, stdout: { write: () => true, isTTY: false } };
248
239
  }
249
- export function createMcpServer(io, commands, updates = {}) {
240
+ export function createMcpServer(io, commands, updates = {}, startup = {}) {
250
241
  const tools = commands.filter((c) => c.mcpTool);
251
242
  const byName = new Map(tools.map((c) => [toolName(c), c]));
252
243
  const server = new Server({ name: "cavelon", version: KIT_VERSION }, { capabilities: { tools: { listChanged: true } }, instructions: mcpInstructions(commands) });
253
244
  const notice = startSessionUpdateCheck(io, updates);
254
245
  const sessionTenants = new Map();
246
+ const launch = createContext(mcpIo(io), { ...startup, json: true }, "mcp").globals;
255
247
  async function credentialAccess() {
256
248
  const read = (async () => {
257
- const ctx = createContext(mcpIo(io), { json: true, sessionTenants }, "mcp");
249
+ const ctx = createContext(mcpIo(io), { ...launch, json: true, sessionTenants }, "mcp");
258
250
  const session = await ctx.session();
259
251
  if (!session.url || !session.token)
260
252
  return undefined;
@@ -294,7 +286,7 @@ export function createMcpServer(io, commands, updates = {}) {
294
286
  return fail(usageError(`Missing ${missing.join(", ")}.`));
295
287
  }
296
288
  const tenant = !ownsTenant(spec) && typeof args.tenant === "string" ? args.tenant : undefined;
297
- const solutionEnv = spec.options?.env && typeof args.env === "string" ? args.env : undefined;
289
+ const solutionEnv = spec.options?.env && typeof args.env === "string" ? args.env : launch.solutionEnv;
298
290
  let folder;
299
291
  try {
300
292
  folder = await solutionDirectory(io, args.solution_dir);
@@ -302,14 +294,14 @@ export function createMcpServer(io, commands, updates = {}) {
302
294
  catch (error) {
303
295
  return fail(error);
304
296
  }
305
- const ctx = createContext(mcpIo(folder.io), { json: true, tenant, solutionEnv, sessionTenants }, "mcp");
297
+ const ctx = createContext(mcpIo(folder.io), { ...launch, json: true, tenant: tenant ?? launch.tenant, solutionEnv: solutionEnv ?? launch.solutionEnv, sessionTenants }, "mcp");
306
298
  if (clientAsks(server))
307
299
  ctx.askPerson = (message) => askThroughClient(server, message, requestId);
308
300
  for (const message of renamed)
309
301
  ctx.warn(message);
310
302
  try {
311
- const chosen = tenant ?? (await ctx.session().then((s) => (s.tenantSource === "session" ? s.tenant : undefined), () => undefined));
312
- const { result, warnings } = await printingFor({ mode: "mcp", commands, solutionDir: folder.selected, personCwd: folder.directory, ...(spec.storesTarget ? {} : { tenant: chosen, env: solutionEnv }) }, async () => {
303
+ const chosen = tenant ?? launch.tenant ?? (await ctx.session().then((s) => (s.tenantSource === "session" || s.tenantSource?.startsWith("env/") ? s.tenant : undefined), () => undefined));
304
+ const { result, warnings } = await printingFor({ mode: "mcp", commands, solutionDir: folder.selected, personCwd: folder.directory, ...(spec.storesTarget ? {} : { instance: launch.instance, tenant: chosen, env: solutionEnv }) }, async () => {
313
305
  try {
314
306
  const done = await spec.run(ctx, inputFrom(spec, args));
315
307
  return { result: { ...done, data: spokenHints(done.data) }, warnings: ctx.warnings.map(spoken) };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "format": 1,
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "entries": {
5
5
  "omp": [
6
6
  "omp-extension.mjs"
@@ -50,7 +50,8 @@ for a public widget), **propose the change; the person decides.**
50
50
  - Run `cavelon limits set <key> <value>` without `--confirm` (MCP: `limits_set`
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
- person with your reason (what fails or waits now), and wait for their answer.
53
+ person with your reason (what fails or waits now). Over MCP, use the native
54
+ approval described next without asking for a separate chat yes.
54
55
  - The confirm is the person's. Over MCP, call `limits_set` again with the
55
56
  same arguments and `confirm` set to the preview's `confirm_token`: the
56
57
  client then asks the person, and nothing changes without their yes. From
@@ -121,9 +122,10 @@ endpoint.
121
122
  file). For one row's limit, prefer `cavelon models set-limit`.
122
123
 
123
124
  **Propose a limit; the person decides.** Say which value you would set and
124
- why (what the endpoint serves, which rows share it, what waits or fails now),
125
- then wait for the person's answer. Run the confirm command of `models set-limit` only after
126
- they agreed, and never raise or lower a limit without telling them. A limit
125
+ why (what the endpoint serves, which rows share it, what waits or fails now).
126
+ Over MCP, use one native approval without a preliminary chat yes. From your
127
+ shell, give the person the printed `models set-limit` confirmation command to
128
+ run in their own terminal; never run it on their behalf. A limit
127
129
  `cavelon limits` names as the operator's (the run caps, the slot waits, the
128
130
  licence) is not yours or the tenant's to change: tell the person who changes
129
131
  it and where, as the output says.
@@ -66,12 +66,19 @@ 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`. For a trigger of a
69
+ previews first and normally starts nothing without `--confirm`. For a trigger of a
70
70
  draft solution, run the confirm command it prints (from your shell it carries
71
71
  the preview's token; over MCP call `loop_start` again with `confirm` set to its
72
72
  `confirm_token`). Any other run needs the person's yes (`needs_person` in the
73
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
+ your shell the preview names the command they run in their own terminal.
75
+ Do not ask for a separate chat approval before the native dialog. Reading and
76
+ confirming a routine draft preview within the requested work needs no extra
77
+ question. Explicit `--yolo` can combine preview and start for a trigger of the
78
+ selected draft solution within the process's original scope. It follows the
79
+ cavelon-loop skill's critical-change rules and grants no extra budget or
80
+ standing authority.
81
+ If `loop start` exits 8 (a timeout, a cut
75
82
  connection), the run may have started: retry only with the
76
83
  `--idempotency-key <key>` its error names, never without it, or a second run
77
84
  starts and spends the budget again. `cavelon trace <operation-id>` reads the
@@ -130,8 +137,8 @@ Two reasons end work for capacity; each has its code in `cavelon explain`:
130
137
  `max_concurrent_requests` and no slot freed within
131
138
  `model_endpoint_slot_wait_seconds`. Retry later, or, if the endpoint can serve
132
139
  more, propose raising the Model Registry row's `max_concurrent_requests`
133
- (`cavelon models list` shows it). The person decides; only then run
134
- `cavelon models set-limit <model_id> <n>`: over MCP the client asks the person
140
+ (`cavelon models list` shows it). Preview `cavelon models set-limit
141
+ <model_id> <n>` for the person's decision: over MCP the client asks the person
135
142
  when you confirm with the token; from your shell the person runs the confirm
136
143
  command it prints in their own terminal.
137
144
 
@@ -86,7 +86,8 @@ use it when you parse the result.
86
86
  chose, which may be another one. The commands `cavelon` prints carry the
87
87
  `--tenant` (and `--env`) you gave, confirm lines included; run them as printed.
88
88
  Every preview names where it acts (`acts on:`, `target` in `--json`): the
89
- instance, the tenant and the mode; show it to the person with the change.
89
+ instance, the tenant and the mode; check it against the requested work.
90
+ Include it whenever a change needs personal approval.
90
91
  Over MCP, `use_tenant` chooses the tenant for this session only and never
91
92
  changes the person's stored tenant. A tenant API key in `CAVELON_TOKEN` acts
92
93
  only in its own tenant: a command that names another is refused with
@@ -275,11 +276,12 @@ successful activation's `took_default_route` and corresponding from/name
275
276
  fields report the actual effect, which may differ. `status` shows the
276
277
  preview too.
277
278
 
278
- - **Ask the person** whether the new solution should become the default. It
279
- changes live traffic; never decide it yourself.
280
- - With their yes: `cavelon activate --make-default` (or `cavelon harness
281
- default <solution>`) shows the change, naming the current default; show it.
282
- You cannot confirm it yourself: over MCP the client asks the person when you
279
+ - Make the solution the default only when the user's request calls for it.
280
+ If the intended routing is unclear, ask; it changes live traffic.
281
+ - `cavelon activate --make-default` (or `cavelon harness default <solution>`)
282
+ previews the change, naming the current default. For a requested route
283
+ change, proceed directly to its approval step without another chat yes.
284
+ You cannot approve it yourself: over MCP the client asks the person when you
283
285
  call the tool with the preview's token; from your shell the person runs the
284
286
  confirm command it printed in their own terminal. `harness default` refuses a draft
285
287
  (`solution_not_active`, exit 4): only an active solution can be the
@@ -299,14 +301,18 @@ preview too.
299
301
  route; the default route itself is refused until another solution is the
300
302
  default.
301
303
 
302
- ## Show the person before confirming
304
+ ## Confirm routine work; ask once for critical changes
303
305
 
304
- Show every preview to the person. Confirm on your own only a preview that
305
- needs no person: `apply` to a draft solution in a test environment (no query
306
+ A technical preview is not a request for a chat approval. Within the user's
307
+ requested work, read and confirm a preview that needs no person without
308
+ asking them again or showing every intermediate preview. For `apply`, check
309
+ `show_to_person: false` and no `needs_person` requirement. This includes
310
+ `apply` to a draft solution in a test environment (no query
306
311
  writes or other reason to show it to a person), `loop start` of a trigger
307
312
  of a draft solution, `loop cancel` and `sandbox seed` of a test run or Sandbox
308
- you started, and `kb upload --replace`. Stop, show the preview, and wait for
309
- the person when:
313
+ you started, `kb upload --replace`, and known routine `api` operations.
314
+ Summarize the outcome with the work. A preview needs the person's decision
315
+ when:
310
316
 
311
317
  - the preview lists an active solution under "reaches active", or the target
312
318
  solution is active;
@@ -331,14 +337,15 @@ budget), `limits set`, `models set-limit`, `trigger identity` (standing
331
337
  authority for a trigger), `harness default`, `activate --make-default`,
332
338
  `activate` of a solution its preview says a channel or trigger reaches,
333
339
  whose activation takes the default route, or whose reach or route effect is unknown,
334
- `deactivate` (they move live traffic), and `api` for any operation that is
335
- not read-only, `cavelon` does not take your confirm as theirs. Their preview
340
+ `deactivate` (they move live traffic), and `api` outside its known routine
341
+ operations, `cavelon` does not take your confirm as theirs. Their preview
336
342
  says how in `needs_person`:
337
343
 
338
- - `"client"` (over MCP, where your client can ask the person): show the
339
- preview, then call the tool again with the same arguments and `confirm` set
340
- to its token (for `apply`, the preview id). The client then asks the person
341
- to approve exactly that change, and nothing changes without their yes. A no,
344
+ - `"client"` (over MCP, where your client can ask the person): call the tool
345
+ again with the same arguments and `confirm` set
346
+ to its token (for `apply`, the preview id). The client presents the preview
347
+ and asks the person to approve exactly that change. Do not first ask for a
348
+ separate chat yes. Nothing changes without their answer. A no,
342
349
  or no answer within 10 minutes, returns `confirm_declined` (exit code 5):
343
350
  ask the person what they want instead of trying again.
344
351
  - `"terminal"` (your shell, or a client that cannot ask): the preview's
@@ -352,9 +359,9 @@ or active trigger reaches it and readiness explicitly publishes
352
359
  null, the kit reads the matching list row; an unreadable list, missing row
353
360
  or missing count keeps reach unknown and needs the person.
354
361
 
355
- Asking the person is the kit's responsibility alone. Keep asking before every
356
- guarded change; never answer on their behalf or reuse a previous yes for a
357
- different change. This includes creating, changing or deleting a database
362
+ Asking the person is the kit's responsibility alone. Use one personal approval
363
+ for each critical change; never answer on their behalf or reuse a previous
364
+ yes for a different change. This includes creating, changing or deleting a database
358
365
  query and imports that create or change one, even on a draft.
359
366
 
360
367
  Where the instance publishes `confirmations.enforced`, after the person's
@@ -369,6 +376,23 @@ or `confirmation_invalid` (exit code 5) means the instance changed nothing:
369
376
  show the person the preview again and let them confirm it (in the client's
370
377
  dialog or their own terminal), never retry on your own.
371
378
 
379
+ **YOLO is explicitly enabled by the person.** A CLI invocation may start with
380
+ `cavelon --yolo …`, or an MCP process with `cavelon mcp --yolo`. Eligible
381
+ routine work then previews and executes internally; do not add a question
382
+ of your own. It is not a tool argument or repository setting, and you must
383
+ not enable it to work around a refusal. Its allowance is bound to the
384
+ process's original instance, resolved tenant, credential, local solution
385
+ folder, selected solution, environment and bindings. A different MCP target
386
+ uses normal policy; returning to the original scope may use its allowance
387
+ again. Eligible work includes ordinary draft imports, known routine API
388
+ operations and starting a trigger of the selected draft solution. Existing
389
+ tenant budgets still apply. Critical changes still ask once. Saved database queries, live or shared changes,
390
+ production and deleting imports stay critical. YOLO does not automatically
391
+ confirm Sandbox replacement, document replacement, run cancellation or
392
+ connection deletion. Permissions, secret handling, person-only operations,
393
+ server request binding and end-user database write consent remain unchanged.
394
+ Your host's own shell/tool approvals are separate.
395
+
372
396
  **Over MCP, confirm with the preview's token.** `api`, `tenant_create`,
373
397
  `variables_set` where it replaces a value, `loop_start`, `limits_set`,
374
398
  `models_set_limit`, `loop_cancel`, `sandbox_seed`, `trigger_identity`,
@@ -376,12 +400,12 @@ dialog or their own terminal), never retry on your own.
376
400
  trigger reaches, whose activation takes the default route or whose reach or
377
401
  route effect is unknown, or with `make_default`, and
378
402
  `kb_upload` where it would deactivate documents return a `confirm_token` with
379
- their preview. Show
403
+ their preview. Read
380
404
  the preview, then call the tool again with the same arguments and `confirm`
381
405
  set to that token; it makes exactly the change shown, after the person's yes
382
406
  where the preview says `needs_person`. `confirm: true` is
383
407
  refused (`confirm_token_required`), and a token of another change returns the
384
- new preview with `token_mismatch` (exit code 4): show that one instead. Tool
408
+ new preview with `token_mismatch` (exit code 4): review that one instead. Tool
385
409
  arguments are spelled in snake_case (`make_default`, `keep_both`, `dry_run`);
386
410
  an argument a tool does not list is refused (`unknown_argument`) with the
387
411
  closest one named. Over MCP the next steps a tool returns (hints, `next`,
@@ -392,8 +416,9 @@ make the call as written, filling a value in angle brackets (a
392
416
  **From your shell, `--confirm` takes the same token, where you may confirm.**
393
417
  Run by a coding agent, `loop start` of a draft's trigger, `loop cancel`,
394
418
  `sandbox seed` and `kb upload --replace` print their preview with a confirm
395
- token and the command that confirms it (`… --confirm <token>`). Show the
396
- preview, then run exactly that command. The changes that need the person's yes
419
+ token and the command that confirms it (`… --confirm <token>`). Read the
420
+ preview, then run exactly that command within the authorized work. Changes
421
+ that need the person's yes
397
422
  print no token and name the command the person runs in their own terminal. A
398
423
  bare `--confirm`, as the docs show it for a person's terminal, changes nothing
399
424
  from your shell and exits 5; a token of another change exits 4 with the new
@@ -404,11 +429,11 @@ preview. A line printed before its preview exists ends in
404
429
  **`cavelon api` from your shell has the guards of the MCP `api` tool**, since
405
430
  `cavelon` sees that a coding agent runs it:
406
431
 
407
- - For an operation that is not read-only, it prints the request and the
408
- command the person runs in their own terminal to send it, and sends nothing.
409
- Show both to the person; you cannot send it yourself, with or without a
410
- token (`confirm_needs_person`). Over MCP the `api` tool sends it after the
411
- person's yes in the client.
432
+ - Known routine mutations print a preview and token you may confirm within
433
+ the requested work without a separate chat approval. Critical or unknown
434
+ mutations instead name the person's own-terminal command; you cannot send
435
+ those yourself with a token (`confirm_needs_person`). Over MCP they require
436
+ the person's answer in the native dialog.
412
437
  - It refuses an operation the instance keeps for a person
413
438
  (`operation_for_a_person`) and a body that sets a field the instance marks as
414
439
  a secret value (`secret_field_for_a_person`), with or without `--confirm`,
@@ -312,7 +312,9 @@ the body does the same, but needs the id and a confirm. `cavelon deactivate
312
312
  --harness <solution>` takes an active solution out of live traffic again; it
313
313
  previews first and is the person's decision: show the preview; over MCP the
314
314
  client asks them when you confirm with its token, and from your shell they run
315
- the confirm command in their own terminal. When every suite passes,
315
+ the confirm command in their own terminal. Do not add a separate chat approval
316
+ before that native dialog; an explicitly enabled YOLO mode still asks for this
317
+ critical change. When every suite passes,
316
318
  `cavelon activate --harness <name or slug>` goes through the readiness gate; if the
317
319
  token may not activate, a person activates in the Admin. A solution that a
318
320
  channel or an active trigger reaches goes live for them at once, so its
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cavelon/cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
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",