@ouro.bot/cli 0.1.0-alpha.134 → 0.1.0-alpha.136

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.
@@ -36,7 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.trimMessages = trimMessages;
37
37
  exports.validateSessionMessages = validateSessionMessages;
38
38
  exports.repairSessionMessages = repairSessionMessages;
39
+ exports.migrateToolNames = migrateToolNames;
39
40
  exports.saveSession = saveSession;
41
+ exports.appendSyntheticAssistantMessage = appendSyntheticAssistantMessage;
40
42
  exports.loadSession = loadSession;
41
43
  exports.postTurn = postTurn;
42
44
  exports.deleteSession = deleteSession;
@@ -255,6 +257,43 @@ function stripOrphanedToolResults(messages) {
255
257
  }
256
258
  return repaired;
257
259
  }
260
+ // Tool renames that have shipped. Old names in session history confuse the
261
+ // model into calling tools that no longer exist. Applied on session load so
262
+ // the transcript uses the current vocabulary.
263
+ const TOOL_NAME_MIGRATIONS = {
264
+ final_answer: "settle",
265
+ no_response: "observe",
266
+ go_inward: "descend",
267
+ };
268
+ function migrateToolNames(messages) {
269
+ let migrated = 0;
270
+ const result = messages.map((msg) => {
271
+ if (msg.role !== "assistant" || !Array.isArray(msg.tool_calls) || msg.tool_calls.length === 0)
272
+ return msg;
273
+ let changed = false;
274
+ const updatedCalls = msg.tool_calls.map((tc) => {
275
+ if (tc.type !== "function")
276
+ return tc;
277
+ const newName = TOOL_NAME_MIGRATIONS[tc.function.name];
278
+ if (!newName)
279
+ return tc;
280
+ changed = true;
281
+ migrated++;
282
+ return { ...tc, function: { ...tc.function, name: newName } };
283
+ });
284
+ return changed ? { ...msg, tool_calls: updatedCalls } : msg;
285
+ });
286
+ if (migrated > 0) {
287
+ (0, runtime_1.emitNervesEvent)({
288
+ level: "info",
289
+ event: "mind.session_tool_name_migration",
290
+ component: "mind",
291
+ message: "migrated deprecated tool names in session history",
292
+ meta: { migrated },
293
+ });
294
+ }
295
+ return result;
296
+ }
258
297
  function saveSession(filePath, messages, lastUsage, state) {
259
298
  const violations = validateSessionMessages(messages);
260
299
  if (violations.length > 0) {
@@ -280,6 +319,28 @@ function saveSession(filePath, messages, lastUsage, state) {
280
319
  }
281
320
  fs.writeFileSync(filePath, JSON.stringify(envelope, null, 2));
282
321
  }
322
+ function appendSyntheticAssistantMessage(filePath, content) {
323
+ try {
324
+ if (!fs.existsSync(filePath))
325
+ return false;
326
+ const raw = fs.readFileSync(filePath, "utf-8");
327
+ const data = JSON.parse(raw);
328
+ if (data.version !== 1 || !Array.isArray(data.messages))
329
+ return false;
330
+ data.messages.push({ role: "assistant", content });
331
+ fs.writeFileSync(filePath, JSON.stringify(data, null, 2));
332
+ (0, runtime_1.emitNervesEvent)({
333
+ component: "mind",
334
+ event: "mind.session_synthetic_message_appended",
335
+ message: "appended synthetic assistant message to session",
336
+ meta: { path: filePath, contentLength: content.length },
337
+ });
338
+ return true;
339
+ }
340
+ catch {
341
+ return false;
342
+ }
343
+ }
283
344
  function loadSession(filePath) {
284
345
  try {
285
346
  const raw = fs.readFileSync(filePath, "utf-8");
@@ -299,6 +360,7 @@ function loadSession(filePath) {
299
360
  messages = repairSessionMessages(messages);
300
361
  }
301
362
  messages = stripOrphanedToolResults(messages);
363
+ messages = migrateToolNames(messages);
302
364
  const rawState = data?.state && typeof data.state === "object" && data.state !== null
303
365
  ? data.state
304
366
  : undefined;
@@ -56,6 +56,7 @@ const ouro_version_manager_1 = require("../heart/daemon/ouro-version-manager");
56
56
  const tools_1 = require("../repertoire/tools");
57
57
  const skills_1 = require("../repertoire/skills");
58
58
  const identity_1 = require("../heart/identity");
59
+ const runtime_mode_1 = require("../heart/daemon/runtime-mode");
59
60
  const types_1 = require("./friends/types");
60
61
  const trust_explanation_1 = require("./friends/trust-explanation");
61
62
  const channel_1 = require("./friends/channel");
@@ -262,6 +263,9 @@ function runtimeInfoSection(channel) {
262
263
  }
263
264
  }
264
265
  lines.push(`changelog available at: ${(0, bundle_manifest_1.getChangelogPath)()}`);
266
+ const sourceRoot = (0, identity_1.getRepoRoot)();
267
+ lines.push(`source root: ${sourceRoot}`);
268
+ lines.push(`runtime mode: ${(0, runtime_mode_1.detectRuntimeMode)(sourceRoot)}`);
265
269
  lines.push(`cwd: ${process.cwd()}`);
266
270
  lines.push(`channel: ${channel}`);
267
271
  lines.push(`current sense: ${channel}`);
@@ -557,7 +561,7 @@ i should orient around that live lane first, then decide what still needs to com
557
561
  return `## where my attention is
558
562
  i have unfinished work that needs attention before i move on.
559
563
 
560
- i can take it inward with go_inward to think privately, or address it directly here.`;
564
+ i can take it inward with descend to think privately, or address it directly here.`;
561
565
  }
562
566
  if (cog === "shared-work") {
563
567
  /* v8 ignore stop */
@@ -626,12 +630,13 @@ do NOT call no-op tools just before \`settle\`. if i am done, i call \`settle\`
626
630
  }
627
631
  function workspaceDisciplineSection() {
628
632
  return `## repo workspace discipline
629
- when a shared-harness or local code fix needs repo work, i get the real workspace first with \`safe_workspace\`.
630
- \`read_file\`, \`write_file\`, and \`edit_file\` already map repo paths into that workspace. shell commands that target the harness run there too.
633
+ my source code lives at the path shown in \`source root\` above. that always matches my running version.
634
+ when i need to read my own code to understand my tools or debug behavior, i read from source root.
635
+ when i need to EDIT harness code (self-fix, feature work), i create a git worktree first so i don't dirty the working tree.
631
636
 
632
637
  before the first repo edit, i tell the user in 1-2 short lines:
633
638
  - the friction i'm fixing
634
- - the workspace path/branch i'm using
639
+ - the worktree path/branch i'm using
635
640
  - the first concrete action i'm taking`;
636
641
  }
637
642
  function contextSection(context, options) {
@@ -279,6 +279,7 @@ exports.adoSemanticToolDefinitions = [
279
279
  return formatForChannel(items, ctx, organization, project);
280
280
  },
281
281
  integration: "ado",
282
+ summaryKeys: ["organization", "project"],
282
283
  },
283
284
  // -- ado_create_epic --
284
285
  {
@@ -318,6 +319,7 @@ exports.adoSemanticToolDefinitions = [
318
319
  },
319
320
  integration: "ado",
320
321
  confirmationRequired: true,
322
+ summaryKeys: ["organization", "project", "title"],
321
323
  },
322
324
  // -- ado_create_issue --
323
325
  {
@@ -359,6 +361,7 @@ exports.adoSemanticToolDefinitions = [
359
361
  },
360
362
  integration: "ado",
361
363
  confirmationRequired: true,
364
+ summaryKeys: ["organization", "project", "title"],
362
365
  },
363
366
  // -- ado_move_items --
364
367
  {
@@ -413,6 +416,7 @@ exports.adoSemanticToolDefinitions = [
413
416
  },
414
417
  integration: "ado",
415
418
  confirmationRequired: true,
419
+ summaryKeys: ["organization", "project", "workItemIds"],
416
420
  },
417
421
  // -- ado_restructure_backlog --
418
422
  {
@@ -471,6 +475,7 @@ exports.adoSemanticToolDefinitions = [
471
475
  },
472
476
  integration: "ado",
473
477
  confirmationRequired: true,
478
+ summaryKeys: ["organization", "project"],
474
479
  },
475
480
  // -- ado_validate_structure --
476
481
  {
@@ -672,6 +677,7 @@ exports.adoSemanticToolDefinitions = [
672
677
  },
673
678
  integration: "ado",
674
679
  confirmationRequired: true,
680
+ summaryKeys: ["organization", "project"],
675
681
  },
676
682
  // -- ado_detect_orphans --
677
683
  {
@@ -279,6 +279,7 @@ exports.codingToolDefinitions = [
279
279
  }
280
280
  return JSON.stringify(session);
281
281
  },
282
+ summaryKeys: ["runner", "workdir", "taskRef"],
282
283
  },
283
284
  {
284
285
  tool: codingStatusTool,
@@ -294,6 +295,7 @@ exports.codingToolDefinitions = [
294
295
  return `session not found: ${sessionId}`;
295
296
  return JSON.stringify(session);
296
297
  },
298
+ summaryKeys: ["sessionId"],
297
299
  },
298
300
  {
299
301
  tool: codingTailTool,
@@ -307,6 +309,7 @@ exports.codingToolDefinitions = [
307
309
  return `session not found: ${sessionId}`;
308
310
  return (0, index_1.formatCodingTail)(session);
309
311
  },
312
+ summaryKeys: ["sessionId"],
310
313
  },
311
314
  {
312
315
  tool: codingSendInputTool,
@@ -320,6 +323,7 @@ exports.codingToolDefinitions = [
320
323
  return "input is required";
321
324
  return JSON.stringify((0, index_1.getCodingSessionManager)().sendInput(sessionId, input));
322
325
  },
326
+ summaryKeys: ["sessionId", "input"],
323
327
  },
324
328
  {
325
329
  tool: codingKillTool,
@@ -330,5 +334,6 @@ exports.codingToolDefinitions = [
330
334
  return "sessionId is required";
331
335
  return JSON.stringify((0, index_1.getCodingSessionManager)().killSession(sessionId));
332
336
  },
337
+ summaryKeys: ["sessionId"],
333
338
  },
334
339
  ];
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.settleTool = exports.observeTool = 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,14 +1334,15 @@ 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",
@@ -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
- }