@ouro.bot/cli 0.1.0-alpha.1311 → 0.1.0-alpha.1313

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.1313",
6
+ "changes": [
7
+ "The Teams, Graph and Azure DevOps tools now carry Ouro AX cards, and their refusals end with a code the card names."
8
+ ]
9
+ },
10
+ {
11
+ "version": "0.1.0-alpha.1312",
12
+ "changes": [
13
+ "The weather, travel advisory, place search, vault setup and RSVP 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.1311",
6
18
  "changes": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "runtimeVersion": "0.1.0-alpha.1311",
2
+ "runtimeVersion": "0.1.0-alpha.1313",
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.1311</Repository>
4
+ <Repository>ghcr.io/ourostack/ouroboros-butler:0.1.0-alpha.1313</Repository>
5
5
  <Registry>https://github.com/ourostack/ouroboros/pkgs/container/ouroboros-butler</Registry>
6
6
  <Network>host</Network>
7
7
  <Shell>sh</Shell>
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.adoSemanticToolDefinitions = void 0;
6
6
  const runtime_1 = require("../nerves/runtime");
7
7
  const auth_required_1 = require("./auth-required");
8
+ const tools_base_1 = require("./tools-base");
8
9
  const ado_client_1 = require("./ado-client");
9
10
  const ado_context_1 = require("./ado-context");
10
11
  const ado_templates_1 = require("./ado-templates");
@@ -86,7 +87,7 @@ function buildReparentPatch(newParentId) {
86
87
  }
87
88
  async function checkAuth(ctx) {
88
89
  if (!ctx?.adoToken) {
89
- return (0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps.");
90
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps."), "auth-required");
90
91
  }
91
92
  return null;
92
93
  }
@@ -237,9 +238,15 @@ exports.adoSemanticToolDefinitions = [
237
238
  },
238
239
  },
239
240
  },
241
+ ax: { id: "tool:ado_backlog_list", group: "turn-ado", when: "Pick this to see a project's whole backlog as a tree, with types, parents and owners, filtered by area, state or person.", effect: "read", errors: [
242
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
243
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
244
+ { code: "ado-request-failed", means: "Azure DevOps answered with an error instead of work items; the text is its reply.", fix: "Check the organization and project names, then retry once." },
245
+ ] },
246
+ riskProfile: { mutates: "none", risk: "low" },
240
247
  handler: async (args, ctx) => {
241
248
  if (!ctx?.adoToken) {
242
- return (0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps.");
249
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps."), "auth-required");
243
250
  }
244
251
  (0, runtime_1.emitNervesEvent)({
245
252
  component: "repertoire",
@@ -261,7 +268,7 @@ exports.adoSemanticToolDefinitions = [
261
268
  wiqlData = JSON.parse(wiqlResult);
262
269
  }
263
270
  catch {
264
- return wiqlResult; // Pass through error message
271
+ return (0, tools_base_1.withCode)(wiqlResult, "ado-request-failed"); // Pass through error message
265
272
  }
266
273
  if (!wiqlData.workItems || wiqlData.workItems.length === 0) {
267
274
  return "No work items found matching the query.";
@@ -274,7 +281,7 @@ exports.adoSemanticToolDefinitions = [
274
281
  batchData = JSON.parse(batchResult);
275
282
  }
276
283
  catch {
277
- return batchResult;
284
+ return (0, tools_base_1.withCode)(batchResult, "ado-request-failed");
278
285
  }
279
286
  const items = formatWorkItems(batchData.value ?? []);
280
287
  return formatForChannel(items, ctx, organization, project);
@@ -303,6 +310,10 @@ exports.adoSemanticToolDefinitions = [
303
310
  },
304
311
  },
305
312
  },
313
+ ax: { id: "tool:ado_create_epic", group: "turn-ado", when: "Pick this when someone wants a new large piece of work tracked in Azure DevOps; for a single task under one, use ado_create_issue.", effect: "write", errors: [
314
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
315
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
316
+ ] },
306
317
  handler: async (args, ctx) => {
307
318
  const authErr = await checkAuth(ctx);
308
319
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -312,7 +323,7 @@ exports.adoSemanticToolDefinitions = [
312
323
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
313
324
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
314
325
  if (!adoCtx.ok)
315
- return adoCtx.error;
326
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
316
327
  const ops = buildCreatePatch(args);
317
328
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
318
329
  const result = await (0, ado_client_1.adoRequest)(ctx.adoToken, "POST", adoCtx.organization, `/${adoCtx.project}/_apis/wit/workitems/$Epic`, JSON.stringify(ops));
@@ -344,6 +355,11 @@ exports.adoSemanticToolDefinitions = [
344
355
  },
345
356
  },
346
357
  },
358
+ ax: { id: "tool:ado_create_issue", group: "turn-ado", when: "Pick this when someone wants a new task, bug or issue filed in Azure DevOps, optionally placed under an existing epic.", effect: "write", errors: [
359
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
360
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
361
+ { code: "ado-request-failed", means: "Azure DevOps refused the new item; the text is its reply.", fix: "Check the type and parent exist in that project, then retry once." },
362
+ ] },
347
363
  handler: async (args, ctx) => {
348
364
  const authErr = await checkAuth(ctx);
349
365
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -353,7 +369,7 @@ exports.adoSemanticToolDefinitions = [
353
369
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
354
370
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
355
371
  if (!adoCtx.ok)
356
- return adoCtx.error;
372
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
357
373
  const wiType = args.workItemType || "Issue";
358
374
  const ops = buildCreatePatch(args);
359
375
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
@@ -383,6 +399,11 @@ exports.adoSemanticToolDefinitions = [
383
399
  },
384
400
  },
385
401
  },
402
+ ax: { id: "tool:ado_move_items", group: "turn-ado", when: "Pick this to put one or more existing work items under a different parent, such as moving bugs into a new epic.", effect: "write", errors: [
403
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
404
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
405
+ { code: "move-failed", means: "Some items couldn't be moved; each one in errors carries Azure DevOps's reply.", fix: "Fix the items listed in errors and move only those again." },
406
+ ] },
386
407
  handler: async (args, ctx) => {
387
408
  const authErr = await checkAuth(ctx);
388
409
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -392,7 +413,7 @@ exports.adoSemanticToolDefinitions = [
392
413
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
393
414
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
394
415
  if (!adoCtx.ok)
395
- return adoCtx.error;
416
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
396
417
  const ids = args.workItemIds.split(",").map(s => s.trim()).filter(Boolean);
397
418
  const ops = buildReparentPatch(args.newParentId);
398
419
  const moved = [];
@@ -406,11 +427,11 @@ exports.adoSemanticToolDefinitions = [
406
427
  moved.push(parsed.id);
407
428
  }
408
429
  else {
409
- errors.push({ id, error: result });
430
+ errors.push({ id, error: result, code: "move-failed" });
410
431
  }
411
432
  }
412
433
  catch {
413
- errors.push({ id, error: result });
434
+ errors.push({ id, error: result, code: "move-failed" });
414
435
  }
415
436
  }
416
437
  return JSON.stringify({ moved, errors, organization: adoCtx.organization, project: adoCtx.project });
@@ -437,6 +458,12 @@ exports.adoSemanticToolDefinitions = [
437
458
  },
438
459
  },
439
460
  },
461
+ ax: { id: "tool:ado_restructure_backlog", group: "turn-ado", when: "Pick this to reshuffle many parent links in one pass after someone agrees a new backlog shape; check it first with ado_preview_changes.", effect: "write", errors: [
462
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
463
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
464
+ { code: "invalid-operations", means: "operations wasn't a valid JSON array.", fix: "Pass operations as a JSON array of objects, like the example in the description." },
465
+ { code: "update-failed", means: "Some items failed while others went through; each failed result has success false and Azure DevOps's reply.", fix: "Fix the failed items named in results and send only those again." },
466
+ ] },
440
467
  handler: async (args, ctx) => {
441
468
  const authErr = await checkAuth(ctx);
442
469
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -446,13 +473,13 @@ exports.adoSemanticToolDefinitions = [
446
473
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
447
474
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
448
475
  if (!adoCtx.ok)
449
- return adoCtx.error;
476
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
450
477
  let operations;
451
478
  try {
452
479
  operations = JSON.parse(args.operations);
453
480
  }
454
481
  catch {
455
- return "error: operations must be a valid JSON array";
482
+ return (0, tools_base_1.withCode)("error: operations must be a valid JSON array", "invalid-operations");
456
483
  }
457
484
  const results = [];
458
485
  for (const op of operations) {
@@ -465,11 +492,11 @@ exports.adoSemanticToolDefinitions = [
465
492
  results.push({ workItemId: op.workItemId, success: true });
466
493
  }
467
494
  else {
468
- results.push({ workItemId: op.workItemId, success: false, error: result });
495
+ results.push({ workItemId: op.workItemId, success: false, error: result, code: "update-failed" });
469
496
  }
470
497
  }
471
498
  catch {
472
- results.push({ workItemId: op.workItemId, success: false, error: result });
499
+ results.push({ workItemId: op.workItemId, success: false, error: result, code: "update-failed" });
473
500
  }
474
501
  }
475
502
  return JSON.stringify({ results, organization: adoCtx.organization, project: adoCtx.project });
@@ -497,6 +524,13 @@ exports.adoSemanticToolDefinitions = [
497
524
  },
498
525
  },
499
526
  },
527
+ ax: { id: "tool:ado_validate_structure", group: "turn-ado", when: "Pick this before moving an item, to check the new parent exists and that the parent and child types may be linked.", effect: "read", errors: [
528
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
529
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
530
+ { code: "ado-request-failed", means: "Azure DevOps answered with an error instead of work items; the text is its reply.", fix: "Check the organization and project names, then retry once." },
531
+ { code: "parent-not-found", means: "No work item has that parent id.", fix: "Check the id with ado_backlog_list, then validate again." },
532
+ ] },
533
+ riskProfile: { mutates: "none", risk: "low" },
500
534
  handler: async (args, ctx) => {
501
535
  const authErr = await checkAuth(ctx);
502
536
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -506,7 +540,7 @@ exports.adoSemanticToolDefinitions = [
506
540
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
507
541
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
508
542
  if (!adoCtx.ok)
509
- return adoCtx.error;
543
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
510
544
  // Fetch parent work item to get its type
511
545
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
512
546
  const parentResult = await (0, ado_client_1.adoRequest)(ctx.adoToken, "GET", adoCtx.organization, `/${adoCtx.project}/_apis/wit/workitems?ids=${args.parentId}&fields=System.WorkItemType`);
@@ -515,10 +549,10 @@ exports.adoSemanticToolDefinitions = [
515
549
  parentData = JSON.parse(parentResult);
516
550
  }
517
551
  catch {
518
- return parentResult;
552
+ return (0, tools_base_1.withCode)(parentResult, "ado-request-failed");
519
553
  }
520
554
  if (!parentData.value || parentData.value.length === 0) {
521
- return `error: parent work item ${args.parentId} not found`;
555
+ return (0, tools_base_1.withCode)(`error: parent work item ${args.parentId} not found`, "parent-not-found");
522
556
  }
523
557
  const parentType = parentData.value[0].fields["System.WorkItemType"];
524
558
  const allowedChildren = VALID_PARENT_CHILD[parentType] || [];
@@ -559,6 +593,12 @@ exports.adoSemanticToolDefinitions = [
559
593
  },
560
594
  },
561
595
  },
596
+ ax: { id: "tool:ado_preview_changes", group: "turn-ado", when: "Pick this to show someone exactly what a create or move would change, before doing it, so they can agree first.", effect: "read", errors: [
597
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
598
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
599
+ { code: "unknown-operation", means: "operation wasn't create_epic, create_issue or move_items.", fix: "Call again with one of those three." },
600
+ ] },
601
+ riskProfile: { mutates: "none", risk: "low" },
562
602
  handler: async (args, ctx) => {
563
603
  const authErr = await checkAuth(ctx);
564
604
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -568,10 +608,10 @@ exports.adoSemanticToolDefinitions = [
568
608
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
569
609
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
570
610
  if (!adoCtx.ok)
571
- return adoCtx.error;
611
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
572
612
  const operations = buildPreviewOps(args.operation, args);
573
613
  if (operations === null) {
574
- return `Unknown operation: ${args.operation}. Supported: create_epic, create_issue, move_items`;
614
+ return (0, tools_base_1.withCode)(`Unknown operation: ${args.operation}. Supported: create_epic, create_issue, move_items`, "unknown-operation");
575
615
  }
576
616
  return JSON.stringify({
577
617
  preview: true,
@@ -604,6 +644,13 @@ exports.adoSemanticToolDefinitions = [
604
644
  },
605
645
  },
606
646
  },
647
+ ax: { id: "tool:ado_batch_update", group: "turn-ado", when: "Pick this to apply a mixed list of creates, moves and edits in one call, once someone has agreed the whole list.", effect: "write", errors: [
648
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
649
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
650
+ { code: "invalid-operations", means: "operations wasn't a valid JSON array.", fix: "Pass operations as a JSON array of objects, like the example in the description." },
651
+ { code: "unknown-operation", means: "One entry's type isn't supported; its result has success false.", fix: "Fix that entry's type and send only it again." },
652
+ { code: "update-failed", means: "Some items failed while others went through; each failed result has success false and Azure DevOps's reply.", fix: "Fix the failed items named in results and send only those again." },
653
+ ] },
607
654
  handler: async (args, ctx) => {
608
655
  const authErr = await checkAuth(ctx);
609
656
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -613,13 +660,13 @@ exports.adoSemanticToolDefinitions = [
613
660
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
614
661
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
615
662
  if (!adoCtx.ok)
616
- return adoCtx.error;
663
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
617
664
  let operations;
618
665
  try {
619
666
  operations = JSON.parse(args.operations);
620
667
  }
621
668
  catch {
622
- return "error: operations must be a valid JSON array";
669
+ return (0, tools_base_1.withCode)("error: operations must be a valid JSON array", "invalid-operations");
623
670
  }
624
671
  const results = [];
625
672
  for (let i = 0; i < operations.length; i++) {
@@ -654,7 +701,7 @@ exports.adoSemanticToolDefinitions = [
654
701
  apiResult = await (0, ado_client_1.adoRequest)(ctx.adoToken, "PATCH", adoCtx.organization, `/${adoCtx.project}/_apis/wit/workitems/${op.workItemId}`, JSON.stringify(patchOps));
655
702
  }
656
703
  else {
657
- results.push({ index: i, type: op.type, success: false, error: `Unknown operation type: ${op.type}` });
704
+ results.push({ index: i, type: op.type, success: false, error: `Unknown operation type: ${op.type}`, code: "unknown-operation" });
658
705
  continue;
659
706
  }
660
707
  try {
@@ -663,15 +710,15 @@ exports.adoSemanticToolDefinitions = [
663
710
  results.push({ index: i, type: op.type, success: true, id: parsed.id });
664
711
  }
665
712
  else {
666
- results.push({ index: i, type: op.type, success: false, error: apiResult });
713
+ results.push({ index: i, type: op.type, success: false, error: apiResult, code: "update-failed" });
667
714
  }
668
715
  }
669
716
  catch {
670
- results.push({ index: i, type: op.type, success: false, error: apiResult });
717
+ results.push({ index: i, type: op.type, success: false, error: apiResult, code: "update-failed" });
671
718
  }
672
719
  }
673
720
  catch (err) {
674
- results.push({ index: i, type: op.type, success: false, error: err instanceof Error ? err.message : String(err) });
721
+ results.push({ index: i, type: op.type, success: false, error: err instanceof Error ? err.message : String(err), code: "update-failed" });
675
722
  }
676
723
  }
677
724
  return JSON.stringify({ results, organization: adoCtx.organization, project: adoCtx.project });
@@ -696,6 +743,12 @@ exports.adoSemanticToolDefinitions = [
696
743
  },
697
744
  },
698
745
  },
746
+ ax: { id: "tool:ado_detect_orphans", group: "turn-ado", when: "Pick this when someone asks for backlog cleanup, to list work items that should sit under a parent but have none.", effect: "read", errors: [
747
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
748
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
749
+ { code: "ado-request-failed", means: "Azure DevOps answered with an error instead of work items; the text is its reply.", fix: "Check the organization and project names, then retry once." },
750
+ ] },
751
+ riskProfile: { mutates: "none", risk: "low" },
699
752
  handler: async (args, ctx) => {
700
753
  const authErr = await checkAuth(ctx);
701
754
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -705,11 +758,11 @@ exports.adoSemanticToolDefinitions = [
705
758
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
706
759
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
707
760
  if (!adoCtx.ok)
708
- return adoCtx.error;
761
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
709
762
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
710
763
  const fetched = await fetchAllItems(ctx.adoToken, adoCtx.organization, adoCtx.project);
711
764
  if ("error" in fetched)
712
- return fetched.error;
765
+ return (0, tools_base_1.withCode)(fetched.error, "ado-request-failed");
713
766
  const orphans = fetched.items
714
767
  .filter(wi => {
715
768
  const parent = wi.fields["System.Parent"];
@@ -746,6 +799,12 @@ exports.adoSemanticToolDefinitions = [
746
799
  },
747
800
  },
748
801
  },
802
+ ax: { id: "tool:ado_detect_cycles", group: "turn-ado", when: "Pick this when a backlog tree looks wrong or loops, to find items that end up as their own ancestor.", effect: "read", errors: [
803
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
804
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
805
+ { code: "ado-request-failed", means: "Azure DevOps answered with an error instead of work items; the text is its reply.", fix: "Check the organization and project names, then retry once." },
806
+ ] },
807
+ riskProfile: { mutates: "none", risk: "low" },
749
808
  handler: async (args, ctx) => {
750
809
  const authErr = await checkAuth(ctx);
751
810
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -755,11 +814,11 @@ exports.adoSemanticToolDefinitions = [
755
814
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
756
815
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
757
816
  if (!adoCtx.ok)
758
- return adoCtx.error;
817
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
759
818
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
760
819
  const fetched = await fetchAllItems(ctx.adoToken, adoCtx.organization, adoCtx.project);
761
820
  if ("error" in fetched)
762
- return fetched.error;
821
+ return (0, tools_base_1.withCode)(fetched.error, "ado-request-failed");
763
822
  const cycles = detectCycles(fetched.items);
764
823
  return JSON.stringify({ cycles, organization: adoCtx.organization, project: adoCtx.project });
765
824
  },
@@ -781,6 +840,13 @@ exports.adoSemanticToolDefinitions = [
781
840
  },
782
841
  },
783
842
  },
843
+ ax: { id: "tool:ado_validate_parent_type_rules", group: "turn-ado", when: "Pick this to audit a backlog for links the process forbids, like a task sitting directly over an epic.", effect: "read", errors: [
844
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
845
+ { code: "no-ado-project", means: "The Azure DevOps organization or project couldn't be worked out: none found, several to pick from, or not in this channel; the text lists them.", fix: "Call again with organization and project set to one of those listed." },
846
+ { code: "ado-request-failed", means: "Azure DevOps answered with an error instead of work items; the text is its reply.", fix: "Check the organization and project names, then retry once." },
847
+ { code: "no-process-template", means: "The project's process template couldn't be fetched, so no type rules were checked.", fix: "Say the type check was skipped; try again later." },
848
+ ] },
849
+ riskProfile: { mutates: "none", risk: "low" },
784
850
  handler: async (args, ctx) => {
785
851
  const authErr = await checkAuth(ctx);
786
852
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
@@ -790,11 +856,11 @@ exports.adoSemanticToolDefinitions = [
790
856
  const adoCtx = await (0, ado_context_1.resolveAdoContext)(ctx.adoToken, ctx.context, { organization: args.organization, project: args.project });
791
857
  /* v8 ignore next -- error return tested via ado_backlog_list @preserve */
792
858
  if (!adoCtx.ok)
793
- return adoCtx.error;
859
+ return (0, tools_base_1.withCode)(adoCtx.error, "no-ado-project");
794
860
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
795
861
  const fetched = await fetchAllItems(ctx.adoToken, adoCtx.organization, adoCtx.project);
796
862
  if ("error" in fetched)
797
- return fetched.error;
863
+ return (0, tools_base_1.withCode)(fetched.error, "ado-request-failed");
798
864
  // Fetch process template to derive hierarchy rules
799
865
  /* v8 ignore next -- non-null assertion guarded by checkAuth above @preserve */
800
866
  const template = await (0, ado_templates_1.fetchProcessTemplate)(ctx.adoToken, adoCtx.organization, adoCtx.project);
@@ -802,6 +868,7 @@ exports.adoSemanticToolDefinitions = [
802
868
  return JSON.stringify({
803
869
  violations: [],
804
870
  message: "Could not fetch process template -- type rule validation skipped.",
871
+ code: "no-process-template",
805
872
  organization: adoCtx.organization,
806
873
  project: adoCtx.project,
807
874
  });
@@ -38,23 +38,24 @@ const fs = __importStar(require("node:fs"));
38
38
  const runtime_1 = require("../nerves/runtime");
39
39
  const query_1 = require("../rsvp/query");
40
40
  const snapshot_1 = require("../rsvp/snapshot");
41
+ const tools_base_1 = require("./tools-base");
41
42
  function readSnapshot(snapshotPath) {
42
43
  if (!snapshotPath || snapshotPath.trim().length === 0) {
43
- return { ok: false, reason: "missing", message: "RSVP snapshot not found." };
44
+ return { ok: false, reason: "missing", message: (0, tools_base_1.withCode)("RSVP snapshot not found.", "snapshot-not-found") };
44
45
  }
45
46
  try {
46
47
  const raw = fs.readFileSync(snapshotPath, "utf-8");
47
48
  const parsed = (0, snapshot_1.parseRsvpSnapshot)(JSON.parse(raw));
48
49
  if (!parsed.ok) {
49
- return { ok: false, reason: "invalid", message: "RSVP snapshot could not be read or failed integrity validation." };
50
+ return { ok: false, reason: "invalid", message: (0, tools_base_1.withCode)("RSVP snapshot could not be read or failed integrity validation.", "snapshot-invalid") };
50
51
  }
51
52
  return { ok: true, snapshot: parsed.snapshot };
52
53
  }
53
54
  catch (error) {
54
55
  if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
55
- return { ok: false, reason: "missing", message: "RSVP snapshot not found." };
56
+ return { ok: false, reason: "missing", message: (0, tools_base_1.withCode)("RSVP snapshot not found.", "snapshot-not-found") };
56
57
  }
57
- return { ok: false, reason: "invalid", message: "RSVP snapshot could not be read or failed integrity validation." };
58
+ return { ok: false, reason: "invalid", message: (0, tools_base_1.withCode)("RSVP snapshot could not be read or failed integrity validation.", "snapshot-invalid") };
58
59
  }
59
60
  }
60
61
  function emitToolRead(toolName, result) {
@@ -107,6 +108,10 @@ exports.rsvpToolDefinitions = [
107
108
  },
108
109
  summaryKeys: ["snapshot_path", "query", "status"],
109
110
  riskProfile: { mutates: "none", risk: "low", reason: "reads a local native RSVP snapshot" },
111
+ ax: { id: "tool:rsvp_query", group: "turn-rsvp", when: "Pick this to list which guests are pending, declined or coming, or to look one guest up; rsvp_summary gives only totals.", effect: "read", idempotent: true, errors: [
112
+ { code: "snapshot-not-found", means: "snapshot_path is empty or no file is there.", fix: "Pass the absolute path of the agent's native RSVP snapshot JSON, then query again." },
113
+ { code: "snapshot-invalid", means: "The file can't be read, isn't JSON, or fails the snapshot's integrity check, so no answer is given from it.", fix: "Don't answer from this file; tell the person, and suggest ouro rsvp doctor to check the snapshots." },
114
+ ] },
110
115
  },
111
116
  {
112
117
  tool: {
@@ -135,5 +140,9 @@ exports.rsvpToolDefinitions = [
135
140
  },
136
141
  summaryKeys: ["snapshot_path"],
137
142
  riskProfile: { mutates: "none", risk: "low", reason: "reads a local native RSVP snapshot" },
143
+ ax: { id: "tool:rsvp_summary", group: "turn-rsvp", when: "Pick this for headcounts by reply and when the guest list was fetched, before reporting numbers; rsvp_query names guests.", effect: "read", idempotent: true, errors: [
144
+ { code: "snapshot-not-found", means: "snapshot_path is empty or no file is there.", fix: "Pass the absolute path of the agent's native RSVP snapshot JSON, then summarize again." },
145
+ { code: "snapshot-invalid", means: "The file can't be read, isn't JSON, or fails the snapshot's integrity check, so its counts can't be trusted.", fix: "Don't report counts from this file; tell the person, and suggest ouro rsvp doctor to check the snapshots." },
146
+ ] },
138
147
  },
139
148
  ];
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.teamsToolDefinitions = void 0;
7
+ const tools_base_1 = require("./tools-base");
7
8
  const auth_required_1 = require("./auth-required");
8
9
  const graph_client_1 = require("./graph-client");
9
10
  const ado_client_1 = require("./ado-client");
@@ -29,9 +30,13 @@ exports.teamsToolDefinitions = [
29
30
  },
30
31
  },
31
32
  },
33
+ ax: { id: "tool:graph_query", group: "turn-microsoft", when: "Pick this to look up something in your owner's Microsoft 365, like mail, calendar or files, once graph_docs has given you the path.", effect: "read", errors: [
34
+ { code: "auth-required", means: "I have no Microsoft Graph token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
35
+ ] },
36
+ riskProfile: { mutates: "none", risk: "low" },
32
37
  handler: async (args, ctx) => {
33
38
  if (!ctx?.graphToken) {
34
- return (0, auth_required_1.authRequired)(ctx, "graph", "I need access to Microsoft Graph.");
39
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "graph", "I need access to Microsoft Graph."), "auth-required");
35
40
  }
36
41
  return (0, graph_client_1.graphRequest)(ctx.graphToken, "GET", args.path);
37
42
  },
@@ -55,12 +60,16 @@ exports.teamsToolDefinitions = [
55
60
  },
56
61
  },
57
62
  },
63
+ ax: { id: "tool:graph_mutate", group: "turn-microsoft", when: "Pick this to create, change or delete something in your owner's Microsoft 365 that they asked for, such as a calendar event.", effect: "write", errors: [
64
+ { code: "auth-required", means: "I have no Microsoft Graph token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
65
+ { code: "invalid-method", means: "method wasn't POST, PATCH or DELETE.", fix: "Use POST, PATCH or DELETE; for a GET, use the matching query tool." },
66
+ ] },
58
67
  handler: async (args, ctx) => {
59
68
  if (!ctx?.graphToken) {
60
- return (0, auth_required_1.authRequired)(ctx, "graph", "I need access to Microsoft Graph.");
69
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "graph", "I need access to Microsoft Graph."), "auth-required");
61
70
  }
62
71
  if (!MUTATE_METHODS.includes(args.method)) {
63
- return `Invalid method "${args.method}". Must be one of: ${MUTATE_METHODS.join(", ")}`;
72
+ return (0, tools_base_1.withCode)(`Invalid method "${args.method}". Must be one of: ${MUTATE_METHODS.join(", ")}`, "invalid-method");
64
73
  }
65
74
  return (0, graph_client_1.graphRequest)(ctx.graphToken, args.method, args.path, args.body);
66
75
  },
@@ -88,9 +97,12 @@ exports.teamsToolDefinitions = [
88
97
  },
89
98
  },
90
99
  },
100
+ ax: { id: "tool:ado_query", group: "turn-microsoft", when: "Pick this for an Azure DevOps lookup no dedicated ado_ tool covers, after ado_docs gives the path; it can POST, so keep it to reads.", effect: "write", errors: [
101
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
102
+ ] },
91
103
  handler: async (args, ctx) => {
92
104
  if (!ctx?.adoToken) {
93
- return (0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps.");
105
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps."), "auth-required");
94
106
  }
95
107
  const method = args.method || "GET";
96
108
  return (0, ado_client_1.adoRequest)(ctx.adoToken, method, args.organization, args.path, args.body, args.host);
@@ -117,12 +129,16 @@ exports.teamsToolDefinitions = [
117
129
  },
118
130
  },
119
131
  },
132
+ ax: { id: "tool:ado_mutate", group: "turn-microsoft", when: "Pick this for an Azure DevOps change no dedicated ado_ tool covers, after ado_docs gives the path and the person asked for it.", effect: "write", errors: [
133
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
134
+ { code: "invalid-method", means: "method wasn't POST, PATCH or DELETE.", fix: "Use POST, PATCH or DELETE; for a GET, use the matching query tool." },
135
+ ] },
120
136
  handler: async (args, ctx) => {
121
137
  if (!ctx?.adoToken) {
122
- return (0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps.");
138
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "ado", "I need access to Azure DevOps."), "auth-required");
123
139
  }
124
140
  if (!MUTATE_METHODS.includes(args.method)) {
125
- return `Invalid method "${args.method}". Must be one of: ${MUTATE_METHODS.join(", ")}`;
141
+ return (0, tools_base_1.withCode)(`Invalid method "${args.method}". Must be one of: ${MUTATE_METHODS.join(", ")}`, "invalid-method");
126
142
  }
127
143
  return (0, ado_client_1.adoRequest)(ctx.adoToken, args.method, args.organization, args.path, args.body, args.host);
128
144
  },
@@ -140,9 +156,13 @@ exports.teamsToolDefinitions = [
140
156
  parameters: { type: "object", properties: {} },
141
157
  },
142
158
  },
159
+ ax: { id: "tool:graph_profile", group: "turn-microsoft", when: "Pick this when you need your owner's own Microsoft 365 details, like their job title or work email, rather than someone else's.", effect: "read", errors: [
160
+ { code: "auth-required", means: "I have no Microsoft Graph token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
161
+ ] },
162
+ riskProfile: { mutates: "none", risk: "low" },
143
163
  handler: async (_args, ctx) => {
144
164
  if (!ctx?.graphToken) {
145
- return (0, auth_required_1.authRequired)(ctx, "graph", "I need access to your Microsoft 365 profile.");
165
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "graph", "I need access to your Microsoft 365 profile."), "auth-required");
146
166
  }
147
167
  return (0, graph_client_1.getProfile)(ctx.graphToken);
148
168
  },
@@ -164,9 +184,16 @@ exports.teamsToolDefinitions = [
164
184
  },
165
185
  },
166
186
  },
187
+ ax: { id: "tool:ado_work_items", group: "turn-microsoft", when: "Pick this when someone asks what is on their Azure DevOps plate, such as their open bugs and tasks; for whole backlogs use ado_backlog_list.", effect: "read", errors: [
188
+ { code: "auth-required", means: "I have no Azure DevOps token yet; the text says whether a sign-in prompt is coming or why it can't start here.", fix: "Ask the person to sign in when Teams prompts, then retry; if sign-in can't start here, ask them from Teams." },
189
+ { code: "no-ado-org", means: "Their account can't see any Azure DevOps organization.", fix: "Tell them their account needs adding to an organization first." },
190
+ { code: "ado-org-ambiguous", means: "Their account can see several organizations; the text lists them.", fix: "Ask which one they mean, then call again with organization set." },
191
+ { code: "org-discovery-failed", means: "Listing their organizations failed; the text gives the reason.", fix: "Retry once with organization set, if they told you one." },
192
+ ] },
193
+ riskProfile: { mutates: "none", risk: "low" },
167
194
  handler: async (args, ctx) => {
168
195
  if (!ctx?.adoToken) {
169
- return (0, auth_required_1.authRequired)(ctx, "ado", "I need access to your Azure DevOps account.");
196
+ return (0, tools_base_1.withCode)((0, auth_required_1.authRequired)(ctx, "ado", "I need access to your Azure DevOps account."), "auth-required");
170
197
  }
171
198
  let org = args.organization;
172
199
  if (!org) {
@@ -174,17 +201,17 @@ exports.teamsToolDefinitions = [
174
201
  try {
175
202
  const orgs = await (0, ado_client_1.discoverOrganizations)(ctx.adoToken);
176
203
  if (orgs.length === 0) {
177
- return "No ADO organizations found for your account. Ensure your Azure DevOps account has access to at least one organization.";
204
+ return (0, tools_base_1.withCode)("No ADO organizations found for your account. Ensure your Azure DevOps account has access to at least one organization.", "no-ado-org");
178
205
  }
179
206
  if (orgs.length === 1) {
180
207
  org = orgs[0];
181
208
  }
182
209
  else {
183
- return `Multiple ADO organizations found. Please specify which organization to use:\n${orgs.map((o) => `- ${o}`).join("\n")}`;
210
+ return (0, tools_base_1.withCode)(`Multiple ADO organizations found. Please specify which organization to use:\n${orgs.map((o) => `- ${o}`).join("\n")}`, "ado-org-ambiguous");
184
211
  }
185
212
  }
186
213
  catch (e) {
187
- return `error discovering ADO organizations: ${e instanceof Error ? e.message : String(e)}`;
214
+ return (0, tools_base_1.withCode)(`error discovering ADO organizations: ${e instanceof Error ? e.message : String(e)}`, "org-discovery-failed");
188
215
  }
189
216
  }
190
217
  const query = args.query || DEFAULT_ADO_QUERY;
@@ -213,9 +240,13 @@ exports.teamsToolDefinitions = [
213
240
  },
214
241
  },
215
242
  /* v8 ignore start -- proactive messaging requires live Teams SDK conversation client @preserve */
243
+ ax: { id: "tool:teams_send_message", group: "turn-microsoft", when: "Pick this to start a new Teams chat with a person on your own, such as a reminder they asked for; in the chat you are in, just reply.", effect: "write", errors: [
244
+ { code: "not-in-teams", means: "This turn isn't running in Teams, so there is no bot to send from.", fix: "Do it from a Teams conversation, or tell the person you can't reach them in Teams from here." },
245
+ { code: "send-failed", means: "Teams refused or failed to deliver the message; the text gives the reason.", fix: "Check the user_id is right; if it is, tell the person the message didn't go." },
246
+ ] },
216
247
  handler: async (args, ctx) => {
217
248
  if (!ctx?.botApi) {
218
- return "proactive messaging is not available -- no bot API context (this tool only works in the Teams channel)";
249
+ return (0, tools_base_1.withCode)("proactive messaging is not available -- no bot API context (this tool only works in the Teams channel)", "not-in-teams");
219
250
  }
220
251
  try {
221
252
  const tenantId = args.tenant_id || ctx.tenantId;
@@ -234,7 +265,7 @@ exports.teamsToolDefinitions = [
234
265
  return `message sent to ${args.user_name || args.user_id}`;
235
266
  }
236
267
  catch (e) {
237
- return `failed to send proactive message: ${e instanceof Error ? e.message : String(e)}`;
268
+ return (0, tools_base_1.withCode)(`failed to send proactive message: ${e instanceof Error ? e.message : String(e)}`, "send-failed");
238
269
  }
239
270
  },
240
271
  /* v8 ignore stop */
@@ -257,6 +288,10 @@ exports.teamsToolDefinitions = [
257
288
  },
258
289
  },
259
290
  },
291
+ ax: { id: "tool:graph_docs", group: "turn-microsoft", when: "Pick this first, before graph_query or graph_mutate, to find the right Microsoft 365 path and the permission it needs.", effect: "read", idempotent: true, errors: [
292
+ { code: "no-matching-endpoints", means: "No documented endpoint matched the search words.", fix: "Search again with a broader word, such as the resource name." },
293
+ ] },
294
+ riskProfile: { mutates: "none", risk: "low" },
260
295
  handler: (args) => {
261
296
  return searchEndpoints(graph_endpoints_json_1.default, args.query || "");
262
297
  },
@@ -278,6 +313,10 @@ exports.teamsToolDefinitions = [
278
313
  },
279
314
  },
280
315
  },
316
+ ax: { id: "tool:ado_docs", group: "turn-microsoft", when: "Pick this first, before ado_query or ado_mutate, to find the right Azure DevOps path, host and permission for a job.", effect: "read", idempotent: true, errors: [
317
+ { code: "no-matching-endpoints", means: "No documented endpoint matched the search words.", fix: "Search again with a broader word, such as the resource name." },
318
+ ] },
319
+ riskProfile: { mutates: "none", risk: "low" },
281
320
  handler: (args) => {
282
321
  return searchEndpoints(ado_endpoints_json_1.default, args.query || "");
283
322
  },
@@ -298,7 +337,7 @@ function searchEndpoints(entries, query) {
298
337
  return haystack.includes(q);
299
338
  });
300
339
  if (matches.length === 0) {
301
- return `No matching endpoints found for "${query}". Try a broader search term.`;
340
+ return (0, tools_base_1.withCode)(`No matching endpoints found for "${query}". Try a broader search term.`, "no-matching-endpoints");
302
341
  }
303
342
  return matches.slice(0, 5).map((e) => {
304
343
  const lines = [
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.travelToolDefinitions = void 0;
4
+ const tools_base_1 = require("./tools-base");
4
5
  const travel_api_client_1 = require("./travel-api-client");
5
6
  const runtime_1 = require("../nerves/runtime");
6
7
  exports.travelToolDefinitions = [
@@ -36,14 +37,20 @@ exports.travelToolDefinitions = [
36
37
  const data = await (0, travel_api_client_1.getWeather)(parseFloat(args.lat), parseFloat(args.lon));
37
38
  return JSON.stringify(data, null, 2);
38
39
  }
39
- return "Please provide either a city name or lat/lon coordinates.";
40
+ return (0, tools_base_1.withCode)("Please provide either a city name or lat/lon coordinates.", "missing-location");
40
41
  }
41
42
  catch (err) {
42
43
  /* v8 ignore next -- defensive: callers throw Error instances @preserve */
43
- return `Weather lookup error: ${err instanceof Error ? err.message : String(err)}`;
44
+ return (0, tools_base_1.withCode)(`Weather lookup error: ${err instanceof Error ? err.message : String(err)}`, "weather-lookup-failed");
44
45
  }
45
46
  },
46
47
  summaryKeys: ["city", "lat", "lon"],
48
+ riskProfile: { mutates: "none", risk: "low", reason: "reads public weather data" },
49
+ ax: { id: "tool:weather_lookup", group: "turn-travel", when: "Pick this for conditions at one place right now and today's high and low, such as what to wear; it has no later forecast.", effect: "read", errors: [
50
+ { code: "guardrail-blocked", means: "The person asking isn't a trusted friend, so the weather lookup didn't run.", fix: "Tell them a trusted friend of the agent has to ask; don't call it again in this conversation." },
51
+ { code: "missing-location", means: "Neither city nor both lat and lon were given, so nothing was looked up.", fix: "Call again with city, or with lat and lon together (geocode_search finds them)." },
52
+ { code: "weather-lookup-failed", means: "The weather service failed or found no such city; the text before the code says which.", fix: "Check the city's spelling or pass lat and lon from geocode_search, then call again." },
53
+ ] },
47
54
  },
48
55
  {
49
56
  tool: {
@@ -76,10 +83,15 @@ exports.travelToolDefinitions = [
76
83
  }
77
84
  catch (err) {
78
85
  /* v8 ignore next -- defensive: callers throw Error instances @preserve */
79
- return `Travel advisory error: ${err instanceof Error ? err.message : String(err)}`;
86
+ return (0, tools_base_1.withCode)(`Travel advisory error: ${err instanceof Error ? err.message : String(err)}`, "advisory-lookup-failed");
80
87
  }
81
88
  },
82
89
  summaryKeys: ["country_code"],
90
+ riskProfile: { mutates: "none", risk: "low", reason: "reads a public travel advisory" },
91
+ ax: { id: "tool:travel_advisory", group: "turn-travel", when: "Pick this to check how risky a country is to visit before suggesting or booking a trip there.", effect: "read", errors: [
92
+ { code: "advisory-lookup-failed", means: "The advisory service failed, or has no advisory for that code; the text before the code says which.", fix: "If no advisory was found, pass a two-letter ISO code such as FR or JP, not a name; if the service failed, say it's unavailable." },
93
+ { code: "guardrail-blocked", means: "The person asking isn't a trusted friend, so no advisory was looked up.", fix: "Tell them a trusted friend of the agent has to ask; don't retry the advisory in this conversation." },
94
+ ] },
83
95
  },
84
96
  {
85
97
  tool: {
@@ -117,9 +129,14 @@ exports.travelToolDefinitions = [
117
129
  }
118
130
  catch (err) {
119
131
  /* v8 ignore next -- defensive: callers throw Error instances @preserve */
120
- return `Geocode error: ${err instanceof Error ? err.message : String(err)}`;
132
+ return (0, tools_base_1.withCode)(`Geocode error: ${err instanceof Error ? err.message : String(err)}`, "geocode-failed");
121
133
  }
122
134
  },
123
135
  summaryKeys: ["query"],
136
+ riskProfile: { mutates: "none", risk: "low", reason: "reads public map data" },
137
+ ax: { id: "tool:geocode_search", group: "turn-travel", when: "Pick this to turn a place or address into coordinates, or to find places near a point, before weather_lookup or advice on getting around.", effect: "read", errors: [
138
+ { code: "geocode-failed", means: "The map service failed to answer; the text before the code says how.", fix: "Wait a moment and call again, or shorten the query to a place name and city." },
139
+ { code: "guardrail-blocked", means: "The person asking isn't a trusted friend, so no place was searched.", fix: "Tell them a trusted friend of the agent has to ask; don't search again in this conversation." },
140
+ ] },
124
141
  },
125
142
  ];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.vaultToolDefinitions = void 0;
4
+ const tools_base_1 = require("./tools-base");
4
5
  const identity_1 = require("../heart/identity");
5
6
  const runtime_1 = require("../nerves/runtime");
6
7
  exports.vaultToolDefinitions = [
@@ -9,7 +10,7 @@ exports.vaultToolDefinitions = [
9
10
  type: "function",
10
11
  function: {
11
12
  name: "vault_setup",
12
- description: "Set up the agent's credential vault. Creates a Bitwarden account on the configured Vaultwarden server. One-time operation — idempotent if vault already exists.",
13
+ description: "Explain how a person sets up or unlocks this agent's credential vault. Returns the terminal commands to run; changes nothing.",
13
14
  parameters: {
14
15
  type: "object",
15
16
  properties: {},
@@ -24,7 +25,7 @@ exports.vaultToolDefinitions = [
24
25
  message: "vault_setup invoked",
25
26
  meta: { tool: "vault_setup", agentName },
26
27
  });
27
- return [
28
+ return (0, tools_base_1.withCode)([
28
29
  "Vault setup is human-required.",
29
30
  "",
30
31
  "Why I cannot do it here:",
@@ -33,8 +34,12 @@ exports.vaultToolDefinitions = [
33
34
  "Do this in a terminal:",
34
35
  ` ouro vault create --agent ${agentName}`,
35
36
  ` ouro vault unlock --agent ${agentName}`,
36
- ].join("\n");
37
+ ].join("\n"), "human-required");
37
38
  },
38
39
  summaryKeys: [],
40
+ ax: { id: "tool:vault_setup", group: "turn-vault", when: "Pick this when someone asks you to create or unlock your own vault; the reply gives them the terminal steps.", effect: "person-only", idempotent: true, errors: [
41
+ { code: "human-required", means: "Creating or unlocking a vault needs a secret typed by a person, so this tool never does it itself.", fix: "Ask the person to run ouro vault create only if the agent has no vault yet, else ouro vault unlock; never ask for the secret." },
42
+ { code: "guardrail-blocked", means: "Only the agent's family may set up its vault, and the person asking isn't family.", fix: "Don't pass on the vault commands; tell them a family member has to ask." },
43
+ ] },
39
44
  },
40
45
  ];
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.1311",
3
+ "version": "0.1.0-alpha.1313",
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.1311",
9
+ "version": "0.1.0-alpha.1313",
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.1311",
3
+ "version": "0.1.0-alpha.1313",
4
4
  "engines": {
5
5
  "node": ">=22"
6
6
  },