@ouro.bot/cli 0.1.0-alpha.1321 → 0.1.0-alpha.1323

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/changelog.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.1323",
6
+ "changes": [
7
+ "The evolution tools carry Ouro AX cards, and their argument, case and close errors carry a code the card explains."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1322",
12
+ "changes": [
13
+ "The credential and user profile tools carry Ouro AX cards, and their errors end with a code the card explains."
14
+ ]
15
+ },
4
16
  {
5
17
  "version": "0.1.0-alpha.1321",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1321",
2
+ "runtimeVersion": "0.1.0-alpha.1323",
3
3
  "bundleSchemaVersion": 3,
4
4
  "lastUpdated": "2026-09-03T00:00:00.000Z"
5
5
  }
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0"?>
2
2
  <Container version="2">
3
3
  <Name>ouro-butler</Name>
4
- <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1321</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1323</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.credentialToolDefinitions = void 0;
37
37
  const crypto = __importStar(require("node:crypto"));
38
+ const tools_base_1 = require("./tools-base");
38
39
  const credential_access_1 = require("./credential-access");
39
40
  const bitwarden_store_1 = require("./bitwarden-store");
40
41
  const runtime_1 = require("../nerves/runtime");
@@ -126,6 +127,8 @@ function generatePassword(length, symbols) {
126
127
  secureShuffle(chars);
127
128
  return chars.join("");
128
129
  }
130
+ const GUARDRAIL_ERROR = { code: "guardrail-blocked", means: "The trust guardrail stopped the call before it ran, because this person may not touch the vault this way.", fix: "Don't retry here; tell the person this needs someone with more trust, or another conversation." };
131
+ const CREDENTIAL_NOT_FOUND_ERROR = { code: "credential-not-found", means: "The vault has no item under that exact name or path.", fix: "Call credential_list with part of the name to find the item's exact path, then use that." };
129
132
  exports.credentialToolDefinitions = [
130
133
  {
131
134
  tool: {
@@ -161,16 +164,21 @@ exports.credentialToolDefinitions = [
161
164
  const store = (0, credential_access_1.getCredentialStore)();
162
165
  const meta = await store.get(itemName);
163
166
  if (!meta) {
164
- return `No credential found for "${itemName}".`;
167
+ return (0, tools_base_1.withCode)(`No credential found for "${itemName}".`, "credential-not-found");
165
168
  }
166
169
  return JSON.stringify(meta, null, 2);
167
170
  }
168
171
  catch (err) {
169
172
  /* v8 ignore next -- defensive: store.get wraps errors @preserve */
170
- return `Credential error: ${err instanceof Error ? err.message : String(err)}`;
173
+ return (0, tools_base_1.withCode)(`Credential error: ${err instanceof Error ? err.message : String(err)}`, "credential-read-failed");
171
174
  }
172
175
  },
173
176
  summaryKeys: ["domain"],
177
+ riskProfile: { mutates: "none", risk: "low", reason: "reads credential metadata; the password is never returned" },
178
+ ax: { id: "tool:credential_get", group: "turn-vault", when: "Pick this to check which username a saved login uses, by its vault path; the password stays hidden.", effect: "read", idempotent: true, errors: [
179
+ GUARDRAIL_ERROR, CREDENTIAL_NOT_FOUND_ERROR,
180
+ { code: "credential-read-failed", means: "The vault couldn't be read; the text gives the reason, often that it is locked.", fix: "If it says locked, tell the person to unlock it with vault_setup's commands; otherwise retry once." },
181
+ ] },
174
182
  },
175
183
  {
176
184
  tool: {
@@ -220,10 +228,15 @@ exports.credentialToolDefinitions = [
220
228
  }, null, 2);
221
229
  }
222
230
  catch (err) {
223
- return `Credential password generation error: ${sanitizeCredentialToolError(err)}`;
231
+ return (0, tools_base_1.withCode)(`Credential password generation error: ${sanitizeCredentialToolError(err)}`, "password-generation-failed");
224
232
  }
225
233
  },
226
234
  summaryKeys: ["domain", "length", "symbols"],
235
+ riskProfile: { mutates: "none", risk: "low", reason: "generates a password in memory; nothing is saved" },
236
+ ax: { id: "tool:credential_generate_password", group: "turn-vault", when: "Pick this when signing up somewhere new needs a strong password; save the one the site accepted with credential_store.", effect: "read", errors: [
237
+ GUARDRAIL_ERROR,
238
+ { code: "password-generation-failed", means: "domain is blank, length isn't a whole number from 12 to 128, or symbols isn't true or false.", fix: "Fix the argument the text names; leave length and symbols out to get the defaults." },
239
+ ] },
227
240
  },
228
241
  {
229
242
  tool: {
@@ -286,11 +299,15 @@ exports.credentialToolDefinitions = [
286
299
  }
287
300
  catch (err) {
288
301
  /* v8 ignore next -- defensive: store.store wraps errors @preserve */
289
- return `Credential store error: ${sanitizeCredentialToolError(err, [password, username, notes])}`;
302
+ return (0, tools_base_1.withCode)(`Credential store error: ${sanitizeCredentialToolError(err, [password, username, notes])}`, "credential-store-failed");
290
303
  }
291
304
  },
292
305
  summaryKeys: ["domain"],
293
306
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "stores credential vault item" },
307
+ ax: { id: "tool:credential_store", group: "turn-vault", when: "Pick this right after an account is created or its password changes, to save the exact login the site accepted.", effect: "write", idempotent: true, errors: [
308
+ GUARDRAIL_ERROR,
309
+ { code: "credential-store-failed", means: "An argument is blank or the vault refused the save; the text names which, with secrets redacted.", fix: "Fill in the item, username or password the text names; if the vault refused, check it is unlocked, then save again." },
310
+ ] },
294
311
  },
295
312
  {
296
313
  tool: {
@@ -329,10 +346,15 @@ exports.credentialToolDefinitions = [
329
346
  }
330
347
  catch (err) {
331
348
  /* v8 ignore next -- defensive: store.list wraps errors @preserve */
332
- return `Credential list error: ${err instanceof Error ? err.message : String(err)}`;
349
+ return (0, tools_base_1.withCode)(`Credential list error: ${err instanceof Error ? err.message : String(err)}`, "credential-list-failed");
333
350
  }
334
351
  },
335
352
  summaryKeys: ["search"],
353
+ riskProfile: { mutates: "none", risk: "low", reason: "lists credential item names and usernames" },
354
+ ax: { id: "tool:credential_list", group: "turn-vault", when: "Pick this to find the exact vault path of a saved login, by part of its name or username, before credential_get.", effect: "read", idempotent: true, errors: [
355
+ GUARDRAIL_ERROR,
356
+ { code: "credential-list-failed", means: "The vault couldn't be listed; the text gives the reason, often that it is locked.", fix: "If it says locked, tell the person to unlock it with vault_setup's commands; otherwise retry once." },
357
+ ] },
336
358
  },
337
359
  {
338
360
  tool: {
@@ -370,14 +392,19 @@ exports.credentialToolDefinitions = [
370
392
  if (deleted) {
371
393
  return `Credentials for "${itemName}" deleted.`;
372
394
  }
373
- return `No credential found for "${itemName}".`;
395
+ return (0, tools_base_1.withCode)(`No credential found for "${itemName}".`, "credential-not-found");
374
396
  }
375
397
  catch (err) {
376
398
  /* v8 ignore next -- defensive: store.delete wraps errors @preserve */
377
- return `Credential delete error: ${err instanceof Error ? err.message : String(err)}`;
399
+ return (0, tools_base_1.withCode)(`Credential delete error: ${err instanceof Error ? err.message : String(err)}`, "credential-delete-failed");
378
400
  }
379
401
  },
380
402
  summaryKeys: ["domain"],
381
403
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "deletes credential vault item" },
404
+ ax: { id: "tool:credential_delete", group: "turn-vault", when: "Pick this only when the person asks to forget a saved login, such as a closed account; it can't be undone.", effect: "write", destructive: true, idempotent: true, errors: [
405
+ GUARDRAIL_ERROR,
406
+ { ...CREDENTIAL_NOT_FOUND_ERROR, fix: "Call credential_list to find the exact path; if nothing matches, it is already gone." },
407
+ { code: "credential-delete-failed", means: "The vault refused the delete; the text gives the reason.", fix: "Check the vault is unlocked, then confirm with credential_list whether the item is still there before retrying." },
408
+ ] },
382
409
  },
383
410
  ];
@@ -181,9 +181,10 @@ function buildEvidence(args) {
181
181
  function caseOrError(agentRoot, caseId) {
182
182
  const item = (0, evolution_1.readEvolutionCase)(agentRoot, caseId);
183
183
  if (!item)
184
- return { ok: false, error: `Evolution case not found: ${caseId}` };
184
+ return { ok: false, error: `Evolution case not found: ${caseId}`, code: "case-not-found" };
185
185
  return { ok: true, case: item };
186
186
  }
187
+ const ORIENTATION_HOLD_ERROR = { code: "orientation-hold", means: "This turn is on a correction hold, so evolution records wait until you know what the person meant.", fix: "Call orientation_get, settle the correction, then record it if it is still right." };
187
188
  const rawEvolutionToolDefinitions = [
188
189
  {
189
190
  /* v8 ignore next -- static OpenAI tool schema is validated by the registry contract */
@@ -203,6 +204,9 @@ const rawEvolutionToolDefinitions = [
203
204
  return json({ ok: true, count: openCases.length, openCases });
204
205
  },
205
206
  riskProfile: { mutates: "none", risk: "low", reason: "reads evolution case summaries" },
207
+ ax: { id: "tool:evolution_status", group: "turn-evolution", when: "Pick this to see every open case and what each one needs next, before opening one with evolution_case.", effect: "read", idempotent: true, errors: [
208
+ { code: "tool-changed", means: "evolution_status is no longer in this turn's tool selection.", fix: "Use the tools this turn offers now; open cases also appear in the active work summary." },
209
+ ] },
206
210
  },
207
211
  {
208
212
  tool: {
@@ -222,7 +226,7 @@ const rawEvolutionToolDefinitions = [
222
226
  handler: (args) => {
223
227
  const caseId = required(args, "caseId");
224
228
  if (!caseId)
225
- return json({ ok: false, error: "caseId is required" });
229
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
226
230
  const agentRoot = (0, identity_1.getAgentRoot)();
227
231
  const result = caseOrError(agentRoot, caseId);
228
232
  if (!result.ok)
@@ -230,6 +234,10 @@ const rawEvolutionToolDefinitions = [
230
234
  return json({ ok: true, case: result.case, trace: (0, evolution_1.readEvolutionTrace)(agentRoot, caseId) });
231
235
  },
232
236
  riskProfile: { mutates: "none", risk: "low", reason: "reads a local evolution case and trace" },
237
+ ax: { id: "tool:evolution_case", group: "turn-evolution", when: "Pick this to read one case in full, with every trace event, before deciding, verifying or closing it.", effect: "read", idempotent: true, errors: [
238
+ { code: "bad-argument", means: "caseId is missing.", fix: "Call again with a caseId from evolution_status, such as evo-..." },
239
+ { code: "case-not-found", means: "No evolution case has that id on this agent.", fix: "Call evolution_status for the open case ids, and use one of those." },
240
+ ] },
233
241
  },
234
242
  {
235
243
  tool: {
@@ -268,27 +276,27 @@ const rawEvolutionToolDefinitions = [
268
276
  const originLabel = required(args, "originLabel");
269
277
  const originLocator = required(args, "originLocator");
270
278
  if (!title)
271
- return json({ ok: false, error: "title is required" });
279
+ return json({ ok: false, error: "title is required", code: "bad-argument" });
272
280
  if (!problemStatement)
273
- return json({ ok: false, error: "problemStatement is required" });
281
+ return json({ ok: false, error: "problemStatement is required", code: "bad-argument" });
274
282
  if (!desiredBehavior)
275
- return json({ ok: false, error: "desiredBehavior is required" });
283
+ return json({ ok: false, error: "desiredBehavior is required", code: "bad-argument" });
276
284
  if (!originKindRaw)
277
- return json({ ok: false, error: "originKind is required" });
285
+ return json({ ok: false, error: "originKind is required", code: "bad-argument" });
278
286
  if (!originLabel)
279
- return json({ ok: false, error: "originLabel is required" });
287
+ return json({ ok: false, error: "originLabel is required", code: "bad-argument" });
280
288
  if (!originLocator)
281
- return json({ ok: false, error: "originLocator is required" });
289
+ return json({ ok: false, error: "originLocator is required", code: "bad-argument" });
282
290
  const originKind = parseEnum(originKindRaw, ORIGIN_KINDS, "originKind");
283
291
  if (typeof originKind === "string" && !ORIGIN_KINDS.has(originKind))
284
- return json({ ok: false, error: originKind });
292
+ return json({ ok: false, error: originKind, code: "bad-argument" });
285
293
  const budgetProfileRaw = optional(args, "budgetProfile") ?? "conservative";
286
294
  const budgetProfile = parseEnum(budgetProfileRaw, BUDGET_PROFILES, "budgetProfile");
287
295
  if (typeof budgetProfile === "string" && !BUDGET_PROFILES.has(budgetProfile))
288
- return json({ ok: false, error: budgetProfile });
296
+ return json({ ok: false, error: budgetProfile, code: "bad-argument" });
289
297
  const evidence = buildEvidence(args);
290
298
  if (typeof evidence === "string")
291
- return json({ ok: false, error: evidence });
299
+ return json({ ok: false, error: evidence, code: "bad-argument" });
292
300
  const frictionSignature = optional(args, "frictionSignature");
293
301
  const packetId = optional(args, "packetId");
294
302
  const obligationId = optional(args, "obligationId");
@@ -306,6 +314,10 @@ const rawEvolutionToolDefinitions = [
306
314
  return json({ ok: true, case: item, nextAction: (0, evolution_1.nextEvolutionActionForStatus)(item.status) });
307
315
  },
308
316
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "creates durable evolution case and trace state" },
317
+ ax: { id: "tool:evolution_capture", group: "turn-evolution", when: "Pick this when friction or a wished-for behavior in the harness should become a tracked case rather than a passing remark.", effect: "write", errors: [
318
+ { code: "bad-argument", means: "A required field is empty, or originKind, budgetProfile or an evidence field isn't an allowed value; error names it.", fix: "Fill in or correct the field error names; evidence needs all three of evidenceKind, evidenceLocator and evidenceReason." },
319
+ ORIENTATION_HOLD_ERROR,
320
+ ] },
309
321
  },
310
322
  {
311
323
  tool: {
@@ -331,18 +343,18 @@ const rawEvolutionToolDefinitions = [
331
343
  const actionRaw = required(args, "action");
332
344
  const reason = required(args, "reason");
333
345
  if (!caseId)
334
- return json({ ok: false, error: "caseId is required" });
346
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
335
347
  if (!decisionRaw)
336
- return json({ ok: false, error: "decision is required" });
348
+ return json({ ok: false, error: "decision is required", code: "bad-argument" });
337
349
  if (!DECISIONS.has(decisionRaw))
338
- return json({ ok: false, error: `invalid decision: ${decisionRaw}` });
350
+ return json({ ok: false, error: `invalid decision: ${decisionRaw}`, code: "bad-argument" });
339
351
  if (!actionRaw)
340
- return json({ ok: false, error: "action is required" });
352
+ return json({ ok: false, error: "action is required", code: "bad-argument" });
341
353
  const action = parseEnum(actionRaw, EVOLUTION_ACTIONS, "action");
342
354
  if (typeof action === "string" && !EVOLUTION_ACTIONS.has(action))
343
- return json({ ok: false, error: action });
355
+ return json({ ok: false, error: action, code: "bad-argument" });
344
356
  if (!reason)
345
- return json({ ok: false, error: "reason is required" });
357
+ return json({ ok: false, error: "reason is required", code: "bad-argument" });
346
358
  const agentRoot = (0, identity_1.getAgentRoot)();
347
359
  const gate = (0, evolution_1.evaluateEvolutionAction)(agentRoot, caseId, action);
348
360
  if (!gate.allowed) {
@@ -356,6 +368,10 @@ const rawEvolutionToolDefinitions = [
356
368
  return json({ ok: true, action, case: item });
357
369
  },
358
370
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution decision state" },
371
+ ax: { id: "tool:evolution_decide", group: "turn-evolution", when: "Pick this to choose what to do about a case, such as act, defer or ask, once its authority and budget allow it.", effect: "write", errors: [
372
+ { code: "bad-argument", means: "caseId, decision, action or reason is empty, or decision or action isn't an allowed value; error names it.", fix: "Fill in or correct the field error names; a reply with blocked: true instead carries the gate's own code and reason." },
373
+ ORIENTATION_HOLD_ERROR,
374
+ ] },
359
375
  },
360
376
  {
361
377
  tool: {
@@ -384,22 +400,22 @@ const rawEvolutionToolDefinitions = [
384
400
  const statusRaw = required(args, "status");
385
401
  const objective = required(args, "objective");
386
402
  if (!caseId)
387
- return json({ ok: false, error: "caseId is required" });
403
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
388
404
  if (!statusRaw)
389
- return json({ ok: false, error: "status is required" });
405
+ return json({ ok: false, error: "status is required", code: "bad-argument" });
390
406
  if (!VERIFICATION_STATUSES.has(statusRaw))
391
- return json({ ok: false, error: `invalid status: ${statusRaw}` });
407
+ return json({ ok: false, error: `invalid status: ${statusRaw}`, code: "bad-argument" });
392
408
  if (!objective)
393
- return json({ ok: false, error: "objective is required" });
409
+ return json({ ok: false, error: "objective is required", code: "bad-argument" });
394
410
  const commands = parseStringArray(optional(args, "commands"), "commands");
395
411
  if (typeof commands === "string")
396
- return json({ ok: false, error: commands });
412
+ return json({ ok: false, error: commands, code: "bad-argument" });
397
413
  const evidenceRefs = parseStringArray(optional(args, "evidenceRefs"), "evidenceRefs");
398
414
  if (typeof evidenceRefs === "string")
399
- return json({ ok: false, error: evidenceRefs });
415
+ return json({ ok: false, error: evidenceRefs, code: "bad-argument" });
400
416
  const missingChecks = parseStringArray(optional(args, "missingChecks"), "missingChecks");
401
417
  if (typeof missingChecks === "string")
402
- return json({ ok: false, error: missingChecks });
418
+ return json({ ok: false, error: missingChecks, code: "bad-argument" });
403
419
  const item = (0, evolution_1.recordEvolutionVerification)((0, identity_1.getAgentRoot)(), caseId, {
404
420
  status: statusRaw,
405
421
  checkedAt: optional(args, "checkedAt") ?? nowIso(),
@@ -412,6 +428,10 @@ const rawEvolutionToolDefinitions = [
412
428
  return json({ ok: true, case: item });
413
429
  },
414
430
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution verification state" },
431
+ ax: { id: "tool:evolution_verify", group: "turn-evolution", when: "Pick this after a change is made, to record whether the checks for the case's objective passed and which are still missing.", effect: "write", errors: [
432
+ { code: "bad-argument", means: "caseId, status or objective is empty, status isn't allowed, or a list isn't a JSON array, newline list or comma list.", fix: "Fill in or correct the field error names; send commands and evidenceRefs as a JSON array of strings." },
433
+ ORIENTATION_HOLD_ERROR,
434
+ ] },
415
435
  },
416
436
  {
417
437
  tool: {
@@ -432,14 +452,18 @@ const rawEvolutionToolDefinitions = [
432
452
  handler: (args) => {
433
453
  const caseId = required(args, "caseId");
434
454
  if (!caseId)
435
- return json({ ok: false, error: "caseId is required" });
455
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
436
456
  const delivery = parseDelivery(optional(args, "delivery"));
437
457
  if (typeof delivery === "string")
438
- return json({ ok: false, error: delivery });
458
+ return json({ ok: false, error: delivery, code: "bad-argument" });
439
459
  const item = (0, evolution_1.recordEvolutionDelivery)((0, identity_1.getAgentRoot)(), caseId, delivery);
440
460
  return json({ ok: true, case: item });
441
461
  },
442
462
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution delivery state" },
463
+ ax: { id: "tool:evolution_deliver", group: "turn-evolution", when: "Pick this as a fix ships, to record its branch, commits, pull request, merge, release or install for the case.", effect: "write", errors: [
464
+ { code: "bad-argument", means: "caseId is empty, or delivery is missing, isn't valid JSON or isn't a JSON object.", fix: "Send delivery as a JSON object string keyed by stage, such as pullRequest with its url and openedAt." },
465
+ ORIENTATION_HOLD_ERROR,
466
+ ] },
443
467
  },
444
468
  {
445
469
  tool: {
@@ -463,14 +487,18 @@ const rawEvolutionToolDefinitions = [
463
487
  handler: (args) => {
464
488
  const caseId = required(args, "caseId");
465
489
  if (!caseId)
466
- return json({ ok: false, error: "caseId is required" });
490
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
467
491
  const ratification = buildRatification(args);
468
492
  if (typeof ratification === "string")
469
- return json({ ok: false, error: ratification });
493
+ return json({ ok: false, error: ratification, code: "bad-argument" });
470
494
  const item = (0, evolution_1.recordEvolutionRatification)((0, identity_1.getAgentRoot)(), caseId, ratification);
471
495
  return json({ ok: true, case: item });
472
496
  },
473
497
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "records durable evolution ratification state" },
498
+ ax: { id: "tool:evolution_ratify", group: "turn-evolution", when: "Pick this once a verified case has taught something, to record where the lesson landed, or none_needed if nowhere.", effect: "write", errors: [
499
+ { code: "bad-argument", means: "caseId, destination, locator or reason is empty, or destination isn't an allowed place.", fix: "Fill in the field error names; use destination none_needed when no lasting lesson should be written." },
500
+ ORIENTATION_HOLD_ERROR,
501
+ ] },
474
502
  },
475
503
  {
476
504
  tool: {
@@ -495,21 +523,26 @@ const rawEvolutionToolDefinitions = [
495
523
  const caseId = required(args, "caseId");
496
524
  const reason = required(args, "reason");
497
525
  if (!caseId)
498
- return json({ ok: false, error: "caseId is required" });
526
+ return json({ ok: false, error: "caseId is required", code: "bad-argument" });
499
527
  if (!reason)
500
- return json({ ok: false, error: "reason is required" });
528
+ return json({ ok: false, error: "reason is required", code: "bad-argument" });
501
529
  const ratification = optional(args, "destination") ? buildRatification(args) : undefined;
502
530
  if (typeof ratification === "string")
503
- return json({ ok: false, error: ratification });
531
+ return json({ ok: false, error: ratification, code: "bad-argument" });
504
532
  try {
505
533
  const item = (0, evolution_1.closeEvolutionCase)((0, identity_1.getAgentRoot)(), caseId, { reason, ...(ratification ? { ratification } : {}) });
506
534
  return json({ ok: true, case: item });
507
535
  }
508
536
  catch (error) {
509
- return json({ ok: false, error: error.message });
537
+ return json({ ok: false, error: error.message, code: "close-failed" });
510
538
  }
511
539
  },
512
540
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "closes durable evolution case state" },
541
+ ax: { id: "tool:evolution_close", group: "turn-evolution", when: "Pick this to finish a case whose lesson is ratified; pass destination here to ratify and close in one call.", effect: "write", errors: [
542
+ { code: "bad-argument", means: "caseId or reason is empty, or the inline ratification fields are incomplete.", fix: "Fill in the field error names, then close again." },
543
+ ORIENTATION_HOLD_ERROR,
544
+ { code: "close-failed", means: "The case can't close yet, usually because no ratification is recorded; error says why.", fix: "Call again with destination and locator, or destination none_needed, so it ratifies as it closes." },
545
+ ] },
513
546
  },
514
547
  ];
515
548
  exports.evolutionToolDefinitions = rawEvolutionToolDefinitions.map((definition) => ({
@@ -1,18 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.userProfileToolDefinitions = void 0;
4
+ const tools_base_1 = require("./tools-base");
4
5
  const user_profile_1 = require("./user-profile");
5
6
  const credential_access_1 = require("./credential-access");
6
7
  const runtime_1 = require("../nerves/runtime");
7
8
  function requireFamilyContext(ctx) {
8
9
  if (!ctx?.context?.friend?.id) {
9
- return "no friend context — cannot access user profile.";
10
+ return (0, tools_base_1.withCode)("no friend context — cannot access user profile.", "no-friend-context");
10
11
  }
11
12
  if (ctx.context.friend.trustLevel !== "family") {
12
- return "user profile access requires family trust level.";
13
+ return (0, tools_base_1.withCode)("user profile access requires family trust level.", "family-required");
13
14
  }
14
15
  return { friendId: ctx.context.friend.id };
15
16
  }
17
+ const NO_FRIEND_ERROR = { code: "no-friend-context", means: "This call came from outside any conversation with a known person, so there is no profile to use.", fix: "Use this only inside a conversation with the person whose profile it is." };
18
+ const FAMILY_REQUIRED_ERROR = { code: "family-required", means: "The person in this conversation isn't family, and profiles hold passport-level details.", fix: "Don't retry; tell the person only a family member can see or change these details." };
19
+ const GUARDRAIL_ERROR = { code: "guardrail-blocked", means: "The trust guardrail stopped the call before it ran, because only family may touch profile details.", fix: "Don't retry; tell the person only a family member can see or change these details." };
16
20
  exports.userProfileToolDefinitions = [
17
21
  {
18
22
  tool: {
@@ -47,7 +51,7 @@ exports.userProfileToolDefinitions = [
47
51
  fields = JSON.parse(args.fields);
48
52
  }
49
53
  catch {
50
- return "invalid JSON in fields parameter.";
54
+ return (0, tools_base_1.withCode)("invalid JSON in fields parameter.", "profile-fields-invalid");
51
55
  }
52
56
  try {
53
57
  const store = (0, credential_access_1.getCredentialStore)();
@@ -56,11 +60,16 @@ exports.userProfileToolDefinitions = [
56
60
  }
57
61
  catch (err) {
58
62
  /* v8 ignore next -- defensive: updateUserProfileFields errors are always Error instances @preserve */
59
- return `failed to store profile: ${err instanceof Error ? err.message : String(err)}`;
63
+ return (0, tools_base_1.withCode)(`failed to store profile: ${err instanceof Error ? err.message : String(err)}`, "profile-store-failed");
60
64
  }
61
65
  },
62
66
  summaryKeys: ["fields"],
63
67
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "stores user profile vault fields" },
68
+ ax: { id: "tool:user_profile_store", group: "turn-vault", when: "Pick this when the person gives details a booking needs, such as their legal name or passport, to keep them for next time.", effect: "write", idempotent: true, errors: [
69
+ NO_FRIEND_ERROR, FAMILY_REQUIRED_ERROR, GUARDRAIL_ERROR,
70
+ { code: "profile-fields-invalid", means: "fields isn't valid JSON.", fix: "Send fields as a JSON object string, such as {\"email\":\"a@b.com\"}." },
71
+ { code: "profile-store-failed", means: "The vault refused the save; the text gives the reason.", fix: "Check the vault is unlocked with vault_setup's commands, then save again." },
72
+ ] },
64
73
  },
65
74
  {
66
75
  tool: {
@@ -94,17 +103,23 @@ exports.userProfileToolDefinitions = [
94
103
  const store = (0, credential_access_1.getCredentialStore)();
95
104
  const value = await (0, user_profile_1.getUserProfileField)(guard.friendId, args.field, store);
96
105
  if (value === undefined) {
97
- return `field "${args.field}" is not set on the profile.`;
106
+ return (0, tools_base_1.withCode)(`field "${args.field}" is not set on the profile.`, "profile-field-not-set");
98
107
  }
99
108
  /* v8 ignore next -- platform-dependent v8 branch counting on ternary @preserve */
100
109
  return typeof value === "string" ? value : JSON.stringify(value, null, 2);
101
110
  }
102
111
  catch (err) {
103
112
  /* v8 ignore next -- defensive: getUserProfileField errors are always Error instances @preserve */
104
- return `failed to get profile field: ${err instanceof Error ? err.message : String(err)}`;
113
+ return (0, tools_base_1.withCode)(`failed to get profile field: ${err instanceof Error ? err.message : String(err)}`, "profile-read-failed");
105
114
  }
106
115
  },
107
116
  summaryKeys: ["field"],
117
+ riskProfile: { mutates: "none", risk: "low", reason: "reads one profile field from the vault" },
118
+ ax: { id: "tool:user_profile_get", group: "turn-vault", when: "Pick this to fill one form field from the person's saved details, such as their date of birth, without exposing the rest.", effect: "read", idempotent: true, errors: [
119
+ NO_FRIEND_ERROR, FAMILY_REQUIRED_ERROR, GUARDRAIL_ERROR,
120
+ { code: "profile-field-not-set", means: "The profile exists but has nothing saved in that field.", fix: "Ask the person for it, then save it with user_profile_store." },
121
+ { code: "profile-read-failed", means: "The vault couldn't be read; the text gives the reason.", fix: "Check the vault is unlocked with vault_setup's commands, then read again." },
122
+ ] },
108
123
  },
109
124
  {
110
125
  tool: {
@@ -133,14 +148,19 @@ exports.userProfileToolDefinitions = [
133
148
  const deleted = await (0, user_profile_1.deleteUserProfile)(guard.friendId, store);
134
149
  return deleted
135
150
  ? `profile deleted for ${guard.friendId}.`
136
- : `no profile found for ${guard.friendId}.`;
151
+ : (0, tools_base_1.withCode)(`no profile found for ${guard.friendId}.`, "profile-not-found");
137
152
  }
138
153
  catch (err) {
139
154
  /* v8 ignore next -- defensive: deleteUserProfile errors are always Error instances @preserve */
140
- return `failed to delete profile: ${err instanceof Error ? err.message : String(err)}`;
155
+ return (0, tools_base_1.withCode)(`failed to delete profile: ${err instanceof Error ? err.message : String(err)}`, "profile-delete-failed");
141
156
  }
142
157
  },
143
158
  summaryKeys: [],
144
159
  riskProfile: { mutates: "durable_state_write", risk: "high", reason: "deletes user profile vault item" },
160
+ ax: { id: "tool:user_profile_delete", group: "turn-vault", when: "Pick this only when the person asks to erase everything saved about them; every field goes and it can't be undone.", effect: "write", destructive: true, idempotent: true, errors: [
161
+ NO_FRIEND_ERROR, FAMILY_REQUIRED_ERROR, GUARDRAIL_ERROR,
162
+ { code: "profile-not-found", means: "Nothing is saved for this person, so there was nothing to delete.", fix: "Tell the person no details were saved; there's nothing more to do." },
163
+ { code: "profile-delete-failed", means: "The vault refused the delete; the text gives the reason.", fix: "Check the vault is unlocked, then read a field with user_profile_get to see whether the profile is still there." },
164
+ ] },
145
165
  },
146
166
  ];
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1321",
3
+ "version": "0.1.0-alpha.1323",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@ouro.bot/cli",
9
- "version": "0.1.0-alpha.1321",
9
+ "version": "0.1.0-alpha.1323",
10
10
  "bundleDependencies": [
11
11
  "@ouro.bot/friends"
12
12
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1321",
3
+ "version": "0.1.0-alpha.1323",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },