@ouro.bot/cli 0.1.0-alpha.133 → 0.1.0-alpha.135

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.
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.finalAnswerTool = exports.noResponseTool = exports.goInwardTool = exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = void 0;
36
+ exports.settleTool = exports.observeTool = exports.descendTool = exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = void 0;
37
37
  exports.renderInnerProgressStatus = renderInnerProgressStatus;
38
38
  const fs = __importStar(require("fs"));
39
39
  const fg = __importStar(require("fast-glob"));
@@ -43,7 +43,7 @@ const skills_1 = require("./skills");
43
43
  const config_1 = require("../heart/config");
44
44
  const runtime_1 = require("../nerves/runtime");
45
45
  const identity_1 = require("../heart/identity");
46
- const safe_workspace_1 = require("../heart/safe-workspace");
46
+ const identity_2 = require("../heart/identity");
47
47
  const socket_client_1 = require("../heart/daemon/socket-client");
48
48
  const thoughts_1 = require("../heart/daemon/thoughts");
49
49
  const manager_1 = require("../heart/bridges/manager");
@@ -74,7 +74,10 @@ function buildContextDiff(lines, changeStart, changeEnd, contextSize = 3) {
74
74
  return result.join("\n");
75
75
  }
76
76
  function resolveLocalToolPath(targetPath) {
77
- return (0, safe_workspace_1.resolveSafeRepoPath)({ requestedPath: targetPath }).resolvedPath;
77
+ if (!path.isAbsolute(targetPath)) {
78
+ return path.resolve((0, identity_2.getRepoRoot)(), targetPath);
79
+ }
80
+ return targetPath;
78
81
  }
79
82
  const NO_SESSION_FOUND_MESSAGE = "no session found for that friend/channel/key combination.";
80
83
  const EMPTY_SESSION_MESSAGE = "session exists but has no non-system messages.";
@@ -357,6 +360,7 @@ exports.baseToolDefinitions = [
357
360
  const end = limit !== undefined ? start + limit : lines.length;
358
361
  return lines.slice(start, end).join("\n");
359
362
  },
363
+ summaryKeys: ["path"],
360
364
  },
361
365
  {
362
366
  tool: {
@@ -377,6 +381,7 @@ exports.baseToolDefinitions = [
377
381
  fs.writeFileSync(resolvedPath, a.content, "utf-8");
378
382
  return "ok";
379
383
  },
384
+ summaryKeys: ["path"],
380
385
  },
381
386
  {
382
387
  tool: {
@@ -435,6 +440,7 @@ exports.baseToolDefinitions = [
435
440
  const changeEndLine = changeStartLine + newStringLines.length;
436
441
  return buildContextDiff(lines, changeStartLine, changeEndLine);
437
442
  },
443
+ summaryKeys: ["path"],
438
444
  },
439
445
  {
440
446
  tool: {
@@ -457,6 +463,7 @@ exports.baseToolDefinitions = [
457
463
  const matches = fg.globSync(a.pattern, { cwd, dot: true });
458
464
  return matches.sort().join("\n");
459
465
  },
466
+ summaryKeys: ["pattern", "cwd"],
460
467
  },
461
468
  {
462
469
  tool: {
@@ -565,29 +572,7 @@ exports.baseToolDefinitions = [
565
572
  }
566
573
  return allResults.join("\n");
567
574
  },
568
- },
569
- {
570
- tool: {
571
- type: "function",
572
- function: {
573
- name: "safe_workspace",
574
- description: "acquire or inspect the safe harness repo workspace for local edits. returns the real workspace path, branch, and why it was chosen.",
575
- parameters: {
576
- type: "object",
577
- properties: {},
578
- },
579
- },
580
- },
581
- handler: () => {
582
- const selection = (0, safe_workspace_1.ensureSafeRepoWorkspace)();
583
- return [
584
- `workspace: ${selection.workspaceRoot}`,
585
- `branch: ${selection.workspaceBranch}`,
586
- `runtime: ${selection.runtimeKind}`,
587
- `cleanup_after_merge: ${selection.cleanupAfterMerge ? "yes" : "no"}`,
588
- `note: ${selection.note}`,
589
- ].join("\n");
590
- },
575
+ summaryKeys: ["pattern", "path", "include"],
591
576
  },
592
577
  {
593
578
  tool: {
@@ -603,13 +588,12 @@ exports.baseToolDefinitions = [
603
588
  },
604
589
  },
605
590
  handler: (a) => {
606
- const prepared = (0, safe_workspace_1.resolveSafeShellExecution)(a.command);
607
- return (0, child_process_1.execSync)(prepared.command, {
591
+ return (0, child_process_1.execSync)(a.command, {
608
592
  encoding: "utf-8",
609
593
  timeout: 30000,
610
- ...(prepared.cwd ? { cwd: prepared.cwd } : {}),
611
594
  });
612
595
  },
596
+ summaryKeys: ["command"],
613
597
  },
614
598
  {
615
599
  tool: {
@@ -643,6 +627,7 @@ exports.baseToolDefinitions = [
643
627
  return `error: ${e}`;
644
628
  }
645
629
  },
630
+ summaryKeys: ["name"],
646
631
  },
647
632
  {
648
633
  tool: {
@@ -674,6 +659,7 @@ exports.baseToolDefinitions = [
674
659
  return `error: ${e}`;
675
660
  }
676
661
  },
662
+ summaryKeys: ["prompt"],
677
663
  },
678
664
  {
679
665
  tool: {
@@ -714,6 +700,7 @@ exports.baseToolDefinitions = [
714
700
  return `error: ${e}`;
715
701
  }
716
702
  },
703
+ summaryKeys: ["query"],
717
704
  },
718
705
  {
719
706
  tool: {
@@ -743,6 +730,7 @@ exports.baseToolDefinitions = [
743
730
  return `error: ${e instanceof Error ? e.message : String(e)}`;
744
731
  }
745
732
  },
733
+ summaryKeys: ["query"],
746
734
  },
747
735
  {
748
736
  tool: {
@@ -771,6 +759,7 @@ exports.baseToolDefinitions = [
771
759
  });
772
760
  return `saved memory fact (added=${result.added}, skipped=${result.skipped})`;
773
761
  },
762
+ summaryKeys: ["text", "about"],
774
763
  },
775
764
  {
776
765
  tool: {
@@ -798,6 +787,7 @@ exports.baseToolDefinitions = [
798
787
  return `friend not found: ${friendId}`;
799
788
  return JSON.stringify(friend, null, 2);
800
789
  },
790
+ summaryKeys: ["friendId"],
801
791
  },
802
792
  {
803
793
  tool: {
@@ -881,6 +871,7 @@ exports.baseToolDefinitions = [
881
871
  return `error saving note: ${err instanceof Error ? err.message : String(err)}`;
882
872
  }
883
873
  },
874
+ summaryKeys: ["type", "key", "content"],
884
875
  },
885
876
  // -- cross-session awareness --
886
877
  {
@@ -979,6 +970,7 @@ exports.baseToolDefinitions = [
979
970
  }
980
971
  return `unknown bridge action: ${action}`;
981
972
  },
973
+ summaryKeys: ["action", "bridgeId", "objective", "friendId", "channel", "key"],
982
974
  },
983
975
  {
984
976
  tool: {
@@ -1342,21 +1334,22 @@ exports.baseToolDefinitions = [
1342
1334
  return `reasoning effort set to "${level}".`;
1343
1335
  },
1344
1336
  requiredCapability: "reasoning-effort",
1337
+ summaryKeys: ["level"],
1345
1338
  },
1346
1339
  ...tools_1.codingToolDefinitions,
1347
1340
  ];
1348
1341
  exports.tools = exports.baseToolDefinitions.map((d) => d.tool);
1349
- exports.goInwardTool = {
1342
+ exports.descendTool = {
1350
1343
  type: "function",
1351
1344
  function: {
1352
- name: "go_inward",
1345
+ name: "descend",
1353
1346
  description: "i need to think about this privately. this takes the current thread inward -- i'll sit with it, work through it, or carry it to where it needs to go. must be the only tool call in the turn.",
1354
1347
  parameters: {
1355
1348
  type: "object",
1356
1349
  properties: {
1357
- content: {
1350
+ topic: {
1358
1351
  type: "string",
1359
- description: "what i need to think about -- the question, the thread, the thing that needs private attention",
1352
+ description: "the question or topic that needs private thought brief framing, not your analysis. your inner dialog will do the actual thinking.",
1360
1353
  },
1361
1354
  answer: {
1362
1355
  type: "string",
@@ -1368,14 +1361,14 @@ exports.goInwardTool = {
1368
1361
  description: "reflect: something to sit with. plan: something to work through. relay: something to carry across.",
1369
1362
  },
1370
1363
  },
1371
- required: ["content"],
1364
+ required: ["topic"],
1372
1365
  },
1373
1366
  },
1374
1367
  };
1375
- exports.noResponseTool = {
1368
+ exports.observeTool = {
1376
1369
  type: "function",
1377
1370
  function: {
1378
- name: "no_response",
1371
+ name: "observe",
1379
1372
  description: "stay silent in this group chat — the moment doesn't call for a response. must be the only tool call in the turn.",
1380
1373
  parameters: {
1381
1374
  type: "object",
@@ -1385,10 +1378,10 @@ exports.noResponseTool = {
1385
1378
  },
1386
1379
  },
1387
1380
  };
1388
- exports.finalAnswerTool = {
1381
+ exports.settleTool = {
1389
1382
  type: "function",
1390
1383
  function: {
1391
- name: "final_answer",
1384
+ name: "settle",
1392
1385
  description: "respond to the user with your message. call this tool when you are ready to deliver your response.",
1393
1386
  parameters: {
1394
1387
  type: "object",
@@ -89,5 +89,6 @@ exports.bluebubblesToolDefinitions = [
89
89
  });
90
90
  return "target must be one of: current_lane, top_level, thread.";
91
91
  },
92
+ summaryKeys: ["target", "threadOriginatorGuid"],
92
93
  },
93
94
  ];
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.githubToolDefinitions = void 0;
4
- exports.summarizeGithubArgs = summarizeGithubArgs;
5
4
  const github_client_1 = require("./github-client");
6
5
  const runtime_1 = require("../nerves/runtime");
7
6
  exports.githubToolDefinitions = [
@@ -44,10 +43,6 @@ exports.githubToolDefinitions = [
44
43
  },
45
44
  integration: "github",
46
45
  confirmationRequired: true,
46
+ summaryKeys: ["title"],
47
47
  },
48
48
  ];
49
- function summarizeGithubArgs(name, args) {
50
- if (name === "file_ouroboros_bug")
51
- return args.title || "";
52
- return undefined;
53
- }
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.teamsToolDefinitions = void 0;
7
- exports.summarizeTeamsArgs = summarizeTeamsArgs;
8
7
  const graph_client_1 = require("./graph-client");
9
8
  const ado_client_1 = require("./ado-client");
10
9
  const graph_endpoints_json_1 = __importDefault(require("./data/graph-endpoints.json"));
@@ -36,6 +35,7 @@ exports.teamsToolDefinitions = [
36
35
  return (0, graph_client_1.graphRequest)(ctx.graphToken, "GET", args.path);
37
36
  },
38
37
  integration: "graph",
38
+ summaryKeys: ["path"],
39
39
  },
40
40
  {
41
41
  tool: {
@@ -65,6 +65,7 @@ exports.teamsToolDefinitions = [
65
65
  },
66
66
  integration: "graph",
67
67
  confirmationRequired: true,
68
+ summaryKeys: ["method", "path"],
68
69
  },
69
70
  // -- Generic ADO tools --
70
71
  {
@@ -94,6 +95,7 @@ exports.teamsToolDefinitions = [
94
95
  return (0, ado_client_1.adoRequest)(ctx.adoToken, method, args.organization, args.path, args.body, args.host);
95
96
  },
96
97
  integration: "ado",
98
+ summaryKeys: ["method", "organization", "path"],
97
99
  },
98
100
  {
99
101
  tool: {
@@ -125,6 +127,7 @@ exports.teamsToolDefinitions = [
125
127
  },
126
128
  integration: "ado",
127
129
  confirmationRequired: true,
130
+ summaryKeys: ["method", "organization", "path"],
128
131
  },
129
132
  // -- Convenience aliases (backward compat) --
130
133
  {
@@ -143,6 +146,7 @@ exports.teamsToolDefinitions = [
143
146
  return (0, graph_client_1.getProfile)(ctx.graphToken);
144
147
  },
145
148
  integration: "graph",
149
+ summaryKeys: [],
146
150
  },
147
151
  {
148
152
  tool: {
@@ -186,6 +190,7 @@ exports.teamsToolDefinitions = [
186
190
  return (0, ado_client_1.queryWorkItems)(ctx.adoToken, org, query);
187
191
  },
188
192
  integration: "ado",
193
+ summaryKeys: ["organization", "query"],
189
194
  },
190
195
  // -- Proactive messaging --
191
196
  {
@@ -233,6 +238,7 @@ exports.teamsToolDefinitions = [
233
238
  },
234
239
  /* v8 ignore stop */
235
240
  confirmationRequired: true,
241
+ summaryKeys: ["user_name", "user_id"],
236
242
  },
237
243
  // -- Documentation tools --
238
244
  {
@@ -254,6 +260,7 @@ exports.teamsToolDefinitions = [
254
260
  return searchEndpoints(graph_endpoints_json_1.default, args.query || "");
255
261
  },
256
262
  integration: "graph",
263
+ summaryKeys: ["query"],
257
264
  },
258
265
  {
259
266
  tool: {
@@ -274,6 +281,7 @@ exports.teamsToolDefinitions = [
274
281
  return searchEndpoints(ado_endpoints_json_1.default, args.query || "");
275
282
  },
276
283
  integration: "ado",
284
+ summaryKeys: ["query"],
277
285
  },
278
286
  ];
279
287
  function searchEndpoints(entries, query) {
@@ -304,38 +312,3 @@ function searchEndpoints(entries, query) {
304
312
  return lines.join("\n");
305
313
  }).join("\n\n");
306
314
  }
307
- function summarizeTeamsArgs(name, args) {
308
- function summarizeKeyValues(keys) {
309
- const parts = [];
310
- for (const key of keys) {
311
- const raw = args[key];
312
- if (raw === undefined || raw === null)
313
- continue;
314
- const compact = String(raw).replace(/\s+/g, " ").trim();
315
- if (!compact)
316
- continue;
317
- const clipped = compact.length > 60 ? compact.slice(0, 60) + "..." : compact;
318
- parts.push(`${key}=${clipped}`);
319
- }
320
- return parts.join(" ");
321
- }
322
- if (name === "graph_profile")
323
- return "";
324
- if (name === "ado_work_items")
325
- return summarizeKeyValues(["organization", "query"]);
326
- if (name === "graph_query")
327
- return summarizeKeyValues(["path"]);
328
- if (name === "graph_mutate")
329
- return summarizeKeyValues(["method", "path"]);
330
- if (name === "ado_query")
331
- return summarizeKeyValues(["method", "organization", "path"]);
332
- if (name === "ado_mutate")
333
- return summarizeKeyValues(["method", "organization", "path"]);
334
- if (name === "graph_docs")
335
- return summarizeKeyValues(["query"]);
336
- if (name === "ado_docs")
337
- return summarizeKeyValues(["query"]);
338
- if (name === "teams_send_message")
339
- return summarizeKeyValues(["user_name", "user_id"]);
340
- return undefined;
341
- }
@@ -1,6 +1,39 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.goInwardTool = exports.noResponseTool = exports.finalAnswerTool = exports.tools = void 0;
36
+ exports.descendTool = exports.observeTool = exports.settleTool = exports.tools = void 0;
4
37
  exports.getToolsForChannel = getToolsForChannel;
5
38
  exports.isConfirmationRequired = isConfirmationRequired;
6
39
  exports.execTool = execTool;
@@ -13,7 +46,10 @@ const tools_github_1 = require("./tools-github");
13
46
  const runtime_1 = require("../nerves/runtime");
14
47
  const guardrails_1 = require("./guardrails");
15
48
  const identity_1 = require("../heart/identity");
16
- const safe_workspace_1 = require("../heart/safe-workspace");
49
+ const surface_tool_1 = require("../senses/surface-tool");
50
+ const obligations_1 = require("../mind/obligations");
51
+ const session_activity_1 = require("../heart/session-activity");
52
+ const path = __importStar(require("path"));
17
53
  function safeGetAgentRoot() {
18
54
  try {
19
55
  return (0, identity_1.getAgentRoot)();
@@ -25,11 +61,158 @@ function safeGetAgentRoot() {
25
61
  // Re-export types and constants used by the rest of the codebase
26
62
  var tools_base_2 = require("./tools-base");
27
63
  Object.defineProperty(exports, "tools", { enumerable: true, get: function () { return tools_base_2.tools; } });
28
- Object.defineProperty(exports, "finalAnswerTool", { enumerable: true, get: function () { return tools_base_2.finalAnswerTool; } });
29
- Object.defineProperty(exports, "noResponseTool", { enumerable: true, get: function () { return tools_base_2.noResponseTool; } });
30
- Object.defineProperty(exports, "goInwardTool", { enumerable: true, get: function () { return tools_base_2.goInwardTool; } });
64
+ Object.defineProperty(exports, "settleTool", { enumerable: true, get: function () { return tools_base_2.settleTool; } });
65
+ Object.defineProperty(exports, "observeTool", { enumerable: true, get: function () { return tools_base_2.observeTool; } });
66
+ Object.defineProperty(exports, "descendTool", { enumerable: true, get: function () { return tools_base_2.descendTool; } });
67
+ // Surface tool handler: routes content to friend's freshest session
68
+ /* v8 ignore start -- surface handler wiring: core logic tested via surface-tool.test.ts; this wires identity/routing deps @preserve */
69
+ const surfaceToolDefinition = {
70
+ tool: surface_tool_1.surfaceToolDef,
71
+ handler: async (args, ctx) => {
72
+ const queue = ctx?.delegatedOrigins ?? [];
73
+ const agentName = (() => { try {
74
+ return (0, identity_1.getAgentName)();
75
+ }
76
+ catch {
77
+ return "unknown";
78
+ } })();
79
+ const routeToFriend = async (friendId, content, queueItem) => {
80
+ /* v8 ignore start -- routing: integration path tested via inner-dialog routing tests @preserve */
81
+ try {
82
+ const agentRoot = (0, identity_1.getAgentRoot)();
83
+ const sessionsDir = path.join(agentRoot, "state", "sessions");
84
+ const friendsDir = path.join(agentRoot, "friends");
85
+ // Priority 1: Bridge-preferred session (if queue item has a bridgeId)
86
+ if (queueItem?.bridgeId) {
87
+ const { createBridgeManager } = await Promise.resolve().then(() => __importStar(require("../heart/bridges/manager")));
88
+ const bridge = createBridgeManager().getBridge(queueItem.bridgeId);
89
+ if (bridge && bridge.lifecycle !== "completed" && bridge.lifecycle !== "cancelled") {
90
+ const allSessions = (0, session_activity_1.listSessionActivity)({ sessionsDir, friendsDir, agentName });
91
+ const bridgeTarget = allSessions.find((activity) => activity.friendId === friendId
92
+ && activity.channel !== "inner"
93
+ && bridge.attachedSessions.some((s) => s.friendId === activity.friendId && s.channel === activity.channel && s.key === activity.key));
94
+ if (bridgeTarget) {
95
+ // Attempt proactive BB delivery for bridge target
96
+ if (bridgeTarget.channel === "bluebubbles") {
97
+ const { sendProactiveBlueBubblesMessageToSession } = await Promise.resolve().then(() => __importStar(require("../senses/bluebubbles")));
98
+ const proactiveResult = await sendProactiveBlueBubblesMessageToSession({
99
+ friendId: bridgeTarget.friendId,
100
+ sessionKey: bridgeTarget.key,
101
+ text: content,
102
+ });
103
+ if (proactiveResult.delivered) {
104
+ // Inject surfaced content into the target session so it knows what was delivered
105
+ const { appendSyntheticAssistantMessage } = await Promise.resolve().then(() => __importStar(require("../mind/context")));
106
+ const sessionFilePath = path.join(sessionsDir, bridgeTarget.friendId, bridgeTarget.channel, `${bridgeTarget.key}.json`);
107
+ appendSyntheticAssistantMessage(sessionFilePath, `[surfaced from inner dialog] ${content}`);
108
+ return { status: "delivered", detail: "via iMessage" };
109
+ }
110
+ }
111
+ // Fall back to pending queue for bridge target
112
+ const { queuePendingMessage, getPendingDir } = await Promise.resolve().then(() => __importStar(require("../mind/pending")));
113
+ const pendingDir = getPendingDir(agentName, bridgeTarget.friendId, bridgeTarget.channel, bridgeTarget.key);
114
+ queuePendingMessage(pendingDir, {
115
+ from: agentName,
116
+ friendId: bridgeTarget.friendId,
117
+ channel: bridgeTarget.channel,
118
+ key: bridgeTarget.key,
119
+ content,
120
+ timestamp: Date.now(),
121
+ });
122
+ return { status: "queued", detail: `for next interaction via ${bridgeTarget.channel}` };
123
+ }
124
+ }
125
+ }
126
+ // Priority 2: Freshest active friend session
127
+ const freshest = (0, session_activity_1.findFreshestFriendSession)({
128
+ sessionsDir,
129
+ friendsDir,
130
+ agentName,
131
+ friendId,
132
+ activeOnly: true,
133
+ });
134
+ if (freshest && freshest.channel !== "inner") {
135
+ // Attempt proactive BB delivery
136
+ if (freshest.channel === "bluebubbles") {
137
+ const { sendProactiveBlueBubblesMessageToSession } = await Promise.resolve().then(() => __importStar(require("../senses/bluebubbles")));
138
+ const proactiveResult = await sendProactiveBlueBubblesMessageToSession({
139
+ friendId: freshest.friendId,
140
+ sessionKey: freshest.key,
141
+ text: content,
142
+ });
143
+ if (proactiveResult.delivered) {
144
+ // Inject surfaced content into the target session so it knows what was delivered
145
+ const { appendSyntheticAssistantMessage } = await Promise.resolve().then(() => __importStar(require("../mind/context")));
146
+ const sessionFilePath = path.join(sessionsDir, freshest.friendId, freshest.channel, `${freshest.key}.json`);
147
+ appendSyntheticAssistantMessage(sessionFilePath, `[surfaced from inner dialog] ${content}`);
148
+ return { status: "delivered", detail: "via iMessage" };
149
+ }
150
+ }
151
+ // Queue as pending for next interaction
152
+ const { queuePendingMessage, getPendingDir } = await Promise.resolve().then(() => __importStar(require("../mind/pending")));
153
+ const pendingDir = getPendingDir(agentName, freshest.friendId, freshest.channel, freshest.key);
154
+ queuePendingMessage(pendingDir, {
155
+ from: agentName,
156
+ friendId: freshest.friendId,
157
+ channel: freshest.channel,
158
+ key: freshest.key,
159
+ content,
160
+ timestamp: Date.now(),
161
+ });
162
+ return { status: "queued", detail: `for next interaction via ${freshest.channel}` };
163
+ }
164
+ // Priority 3: Deferred — no active session found
165
+ const { getDeferredReturnDir } = await Promise.resolve().then(() => __importStar(require("../mind/pending")));
166
+ const { queuePendingMessage: queueDeferred } = await Promise.resolve().then(() => __importStar(require("../mind/pending")));
167
+ const deferredDir = getDeferredReturnDir(agentName, friendId);
168
+ queueDeferred(deferredDir, {
169
+ from: agentName,
170
+ friendId,
171
+ channel: "deferred",
172
+ key: "return",
173
+ content,
174
+ timestamp: Date.now(),
175
+ });
176
+ return { status: "deferred", detail: "they'll see it next time" };
177
+ }
178
+ catch {
179
+ return { status: "failed" };
180
+ }
181
+ /* v8 ignore stop */
182
+ };
183
+ return (0, surface_tool_1.handleSurface)({
184
+ content: args.content ?? "",
185
+ delegationId: args.delegationId,
186
+ friendId: args.friendId,
187
+ queue,
188
+ routeToFriend,
189
+ advanceObligation: (obligationId, update) => {
190
+ /* v8 ignore start -- obligation advance: tested via attention-queue tests @preserve */
191
+ try {
192
+ const name = (() => { try {
193
+ return (0, identity_1.getAgentName)();
194
+ }
195
+ catch {
196
+ return "unknown";
197
+ } })();
198
+ (0, obligations_1.advanceObligation)(name, obligationId, {
199
+ status: update.status,
200
+ ...(update.returnedAt !== undefined ? { returnedAt: update.returnedAt } : {}),
201
+ ...(update.returnTarget !== undefined ? { returnTarget: update.returnTarget } : {}),
202
+ });
203
+ }
204
+ catch {
205
+ // swallowed — obligation advance must never break surface delivery
206
+ }
207
+ /* v8 ignore stop */
208
+ },
209
+ });
210
+ },
211
+ summaryKeys: ["content", "delegationId"],
212
+ };
213
+ /* v8 ignore stop */
31
214
  // All tool definitions in a single registry
32
- const allDefinitions = [...tools_base_1.baseToolDefinitions, ...tools_bluebubbles_1.bluebubblesToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions];
215
+ const allDefinitions = [...tools_base_1.baseToolDefinitions, ...tools_bluebubbles_1.bluebubblesToolDefinitions, ...tools_teams_1.teamsToolDefinitions, ...ado_semantic_1.adoSemanticToolDefinitions, ...tools_github_1.githubToolDefinitions, surfaceToolDefinition];
33
216
  function baseToolsForCapabilities() {
34
217
  // Use baseToolDefinitions at call time so dynamically-added tools are included
35
218
  return tools_base_1.baseToolDefinitions.map((d) => d.tool);
@@ -100,13 +283,7 @@ function isConfirmationRequired(toolName) {
100
283
  const def = allDefinitions.find((d) => d.tool.function.name === toolName);
101
284
  return def?.confirmationRequired === true;
102
285
  }
103
- function normalizeGuardArgs(name, args) {
104
- if ((name === "read_file" || name === "write_file" || name === "edit_file") && args.path) {
105
- return {
106
- ...args,
107
- path: (0, safe_workspace_1.resolveSafeRepoPath)({ requestedPath: args.path }).resolvedPath,
108
- };
109
- }
286
+ function normalizeGuardArgs(_name, args) {
110
287
  return args;
111
288
  }
112
289
  async function execTool(name, args, ctx) {
@@ -188,65 +365,9 @@ function summarizeUnknownArgs(args) {
188
365
  return summarizeKeyValues(args, keys);
189
366
  }
190
367
  function summarizeArgs(name, args) {
191
- // Check teams tools first
192
- const teamsSummary = (0, tools_teams_1.summarizeTeamsArgs)(name, args);
193
- if (teamsSummary !== undefined)
194
- return teamsSummary;
195
- // Check github tools
196
- const githubSummary = (0, tools_github_1.summarizeGithubArgs)(name, args);
197
- if (githubSummary !== undefined)
198
- return githubSummary;
199
- // Base tools
200
- if (name === "read_file" || name === "write_file")
201
- return summarizeKeyValues(args, ["path"]);
202
- if (name === "edit_file")
203
- return summarizeKeyValues(args, ["path"]);
204
- if (name === "glob")
205
- return summarizeKeyValues(args, ["pattern", "cwd"]);
206
- if (name === "grep")
207
- return summarizeKeyValues(args, ["pattern", "path", "include"]);
208
- if (name === "shell")
209
- return summarizeKeyValues(args, ["command"]);
210
- if (name === "load_skill")
211
- return summarizeKeyValues(args, ["name"]);
212
- if (name === "coding_spawn")
213
- return summarizeKeyValues(args, ["runner", "workdir", "taskRef"]);
214
- if (name === "coding_status")
215
- return summarizeKeyValues(args, ["sessionId"]);
216
- if (name === "coding_tail")
217
- return summarizeKeyValues(args, ["sessionId"]);
218
- if (name === "coding_send_input")
219
- return summarizeKeyValues(args, ["sessionId", "input"]);
220
- if (name === "coding_kill")
221
- return summarizeKeyValues(args, ["sessionId"]);
222
- if (name === "bluebubbles_set_reply_target")
223
- return summarizeKeyValues(args, ["target", "threadOriginatorGuid"]);
224
- if (name === "set_reasoning_effort")
225
- return summarizeKeyValues(args, ["level"]);
226
- if (name === "claude")
227
- return summarizeKeyValues(args, ["prompt"]);
228
- if (name === "web_search")
229
- return summarizeKeyValues(args, ["query"]);
230
- if (name === "memory_search")
231
- return summarizeKeyValues(args, ["query"]);
232
- if (name === "memory_save")
233
- return summarizeKeyValues(args, ["text", "about"]);
234
- if (name === "get_friend_note")
235
- return summarizeKeyValues(args, ["friendId"]);
236
- if (name === "save_friend_note") {
237
- return summarizeKeyValues(args, ["type", "key", "content"]);
368
+ const def = allDefinitions.find((d) => d.tool.function.name === name);
369
+ if (def && def.summaryKeys !== undefined) {
370
+ return summarizeKeyValues(args, def.summaryKeys);
238
371
  }
239
- if (name === "bridge_manage")
240
- return summarizeKeyValues(args, ["action", "bridgeId", "objective", "friendId", "channel", "key"]);
241
- if (name === "ado_backlog_list")
242
- return summarizeKeyValues(args, ["organization", "project"]);
243
- if (name === "ado_batch_update")
244
- return summarizeKeyValues(args, ["organization", "project"]);
245
- if (name === "ado_create_epic" || name === "ado_create_issue")
246
- return summarizeKeyValues(args, ["organization", "project", "title"]);
247
- if (name === "ado_move_items")
248
- return summarizeKeyValues(args, ["organization", "project", "workItemIds"]);
249
- if (name === "ado_restructure_backlog")
250
- return summarizeKeyValues(args, ["organization", "project"]);
251
372
  return summarizeUnknownArgs(args);
252
373
  }