@ouro.bot/cli 0.1.0-alpha.13 → 0.1.0-alpha.130

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.
Files changed (126) hide show
  1. package/AdoptionSpecialist.ouro/psyche/SOUL.md +2 -2
  2. package/AdoptionSpecialist.ouro/psyche/identities/monty.md +2 -2
  3. package/README.md +147 -205
  4. package/changelog.json +808 -0
  5. package/dist/heart/active-work.js +622 -0
  6. package/dist/heart/bridges/manager.js +358 -0
  7. package/dist/heart/bridges/state-machine.js +135 -0
  8. package/dist/heart/bridges/store.js +123 -0
  9. package/dist/heart/commitments.js +105 -0
  10. package/dist/heart/config.js +66 -21
  11. package/dist/heart/core.js +518 -100
  12. package/dist/heart/cross-chat-delivery.js +146 -0
  13. package/dist/heart/daemon/agent-discovery.js +81 -0
  14. package/dist/heart/daemon/auth-flow.js +432 -0
  15. package/dist/heart/daemon/daemon-cli.js +1516 -195
  16. package/dist/heart/daemon/daemon-entry.js +43 -2
  17. package/dist/heart/daemon/daemon-runtime-sync.js +212 -0
  18. package/dist/heart/daemon/daemon.js +261 -1
  19. package/dist/heart/daemon/hatch-animation.js +10 -3
  20. package/dist/heart/daemon/hatch-flow.js +7 -72
  21. package/dist/heart/daemon/hooks/bundle-meta.js +92 -0
  22. package/dist/heart/daemon/launchd.js +159 -0
  23. package/dist/heart/daemon/log-tailer.js +4 -3
  24. package/dist/heart/daemon/message-router.js +17 -8
  25. package/dist/heart/daemon/ouro-bot-global-installer.js +128 -0
  26. package/dist/heart/daemon/ouro-path-installer.js +57 -29
  27. package/dist/heart/daemon/ouro-version-manager.js +171 -0
  28. package/dist/heart/daemon/process-manager.js +13 -0
  29. package/dist/heart/daemon/run-hooks.js +37 -0
  30. package/dist/heart/daemon/runtime-logging.js +58 -15
  31. package/dist/heart/daemon/runtime-metadata.js +219 -0
  32. package/dist/heart/daemon/runtime-mode.js +67 -0
  33. package/dist/heart/daemon/sense-manager.js +50 -2
  34. package/dist/heart/daemon/skill-management-installer.js +94 -0
  35. package/dist/heart/daemon/socket-client.js +202 -0
  36. package/dist/heart/daemon/specialist-orchestrator.js +2 -2
  37. package/dist/heart/daemon/specialist-prompt.js +7 -4
  38. package/dist/heart/daemon/specialist-tools.js +52 -3
  39. package/dist/heart/daemon/staged-restart.js +114 -0
  40. package/dist/heart/daemon/thoughts.js +507 -0
  41. package/dist/heart/daemon/update-checker.js +111 -0
  42. package/dist/heart/daemon/update-hooks.js +138 -0
  43. package/dist/heart/daemon/wrapper-publish-guard.js +86 -0
  44. package/dist/heart/delegation.js +62 -0
  45. package/dist/heart/identity.js +64 -21
  46. package/dist/heart/kicks.js +1 -19
  47. package/dist/heart/model-capabilities.js +48 -0
  48. package/dist/heart/obligations.js +197 -0
  49. package/dist/heart/progress-story.js +42 -0
  50. package/dist/heart/provider-failover.js +88 -0
  51. package/dist/heart/provider-ping.js +159 -0
  52. package/dist/heart/providers/anthropic-token.js +163 -0
  53. package/dist/heart/providers/anthropic.js +195 -34
  54. package/dist/heart/providers/azure.js +115 -9
  55. package/dist/heart/providers/github-copilot.js +157 -0
  56. package/dist/heart/providers/minimax.js +33 -3
  57. package/dist/heart/providers/openai-codex.js +49 -14
  58. package/dist/heart/safe-workspace.js +381 -0
  59. package/dist/heart/session-activity.js +173 -0
  60. package/dist/heart/session-recall.js +216 -0
  61. package/dist/heart/streaming.js +108 -24
  62. package/dist/heart/target-resolution.js +123 -0
  63. package/dist/heart/tool-loop.js +194 -0
  64. package/dist/heart/turn-coordinator.js +28 -0
  65. package/dist/mind/associative-recall.js +14 -2
  66. package/dist/mind/bundle-manifest.js +12 -0
  67. package/dist/mind/context.js +60 -14
  68. package/dist/mind/first-impressions.js +16 -2
  69. package/dist/mind/friends/channel.js +35 -0
  70. package/dist/mind/friends/group-context.js +144 -0
  71. package/dist/mind/friends/store-file.js +19 -0
  72. package/dist/mind/friends/trust-explanation.js +74 -0
  73. package/dist/mind/friends/types.js +8 -0
  74. package/dist/mind/memory.js +27 -26
  75. package/dist/mind/obligation-steering.js +221 -0
  76. package/dist/mind/pending.js +76 -9
  77. package/dist/mind/phrases.js +1 -0
  78. package/dist/mind/prompt.js +456 -77
  79. package/dist/mind/token-estimate.js +8 -12
  80. package/dist/nerves/cli-logging.js +15 -2
  81. package/dist/nerves/coverage/run-artifacts.js +1 -1
  82. package/dist/nerves/index.js +12 -0
  83. package/dist/nerves/runtime.js +5 -1
  84. package/dist/repertoire/ado-client.js +4 -2
  85. package/dist/repertoire/coding/context-pack.js +254 -0
  86. package/dist/repertoire/coding/feedback.js +301 -0
  87. package/dist/repertoire/coding/index.js +4 -1
  88. package/dist/repertoire/coding/manager.js +210 -4
  89. package/dist/repertoire/coding/spawner.js +39 -9
  90. package/dist/repertoire/coding/tools.js +171 -4
  91. package/dist/repertoire/data/ado-endpoints.json +188 -0
  92. package/dist/repertoire/guardrails.js +290 -0
  93. package/dist/repertoire/mcp-client.js +254 -0
  94. package/dist/repertoire/mcp-manager.js +198 -0
  95. package/dist/repertoire/skills.js +3 -26
  96. package/dist/repertoire/tasks/board.js +12 -0
  97. package/dist/repertoire/tasks/index.js +23 -9
  98. package/dist/repertoire/tasks/transitions.js +1 -2
  99. package/dist/repertoire/tools-base.js +925 -250
  100. package/dist/repertoire/tools-bluebubbles.js +93 -0
  101. package/dist/repertoire/tools-teams.js +58 -25
  102. package/dist/repertoire/tools.js +106 -53
  103. package/dist/senses/bluebubbles-client.js +210 -5
  104. package/dist/senses/bluebubbles-entry.js +2 -0
  105. package/dist/senses/bluebubbles-inbound-log.js +109 -0
  106. package/dist/senses/bluebubbles-media.js +339 -0
  107. package/dist/senses/bluebubbles-model.js +12 -4
  108. package/dist/senses/bluebubbles-mutation-log.js +45 -5
  109. package/dist/senses/bluebubbles-runtime-state.js +109 -0
  110. package/dist/senses/bluebubbles-session-cleanup.js +72 -0
  111. package/dist/senses/bluebubbles.js +915 -45
  112. package/dist/senses/cli-layout.js +187 -0
  113. package/dist/senses/cli.js +374 -131
  114. package/dist/senses/continuity.js +94 -0
  115. package/dist/senses/debug-activity.js +154 -0
  116. package/dist/senses/inner-dialog-worker.js +47 -18
  117. package/dist/senses/inner-dialog.js +388 -83
  118. package/dist/senses/pipeline.js +444 -0
  119. package/dist/senses/teams.js +607 -129
  120. package/dist/senses/trust-gate.js +112 -2
  121. package/package.json +9 -3
  122. package/subagents/README.md +4 -70
  123. package/dist/heart/daemon/subagent-installer.js +0 -134
  124. package/subagents/work-doer.md +0 -233
  125. package/subagents/work-merger.md +0 -624
  126. package/subagents/work-planner.md +0 -373
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatCodingTail = formatCodingTail;
4
+ exports.attachCodingSessionFeedback = attachCodingSessionFeedback;
5
+ const identity_1 = require("../../heart/identity");
6
+ const socket_client_1 = require("../../heart/daemon/socket-client");
7
+ const obligations_1 = require("../../heart/obligations");
8
+ const runtime_1 = require("../../nerves/runtime");
9
+ const TERMINAL_UPDATE_KINDS = new Set(["completed", "failed", "killed"]);
10
+ const OBLIGATION_WAKE_UPDATE_KINDS = new Set([
11
+ "waiting_input",
12
+ "stalled",
13
+ "completed",
14
+ "failed",
15
+ "killed",
16
+ ]);
17
+ const PULL_REQUEST_NUMBER_PATTERN = /\bPR\s*#(\d+)\b/i;
18
+ const PULL_REQUEST_URL_PATTERN = /\/pull\/(\d+)(?:\b|\/)?/i;
19
+ function clip(text, maxLength = 280) {
20
+ const trimmed = text.trim();
21
+ if (trimmed.length <= maxLength)
22
+ return trimmed;
23
+ return `${trimmed.slice(0, maxLength - 3)}...`;
24
+ }
25
+ function isNoiseLine(line) {
26
+ return (/^-+$/.test(line)
27
+ || /^Reading prompt from stdin/i.test(line)
28
+ || /^OpenAI Codex v/i.test(line)
29
+ || /^workdir:/i.test(line)
30
+ || /^model:/i.test(line)
31
+ || /^provider:/i.test(line)
32
+ || /^approval:/i.test(line)
33
+ || /^sandbox:/i.test(line)
34
+ || /^reasoning effort:/i.test(line)
35
+ || /^reasoning summaries:/i.test(line)
36
+ || /^session id:/i.test(line)
37
+ || /^mcp startup:/i.test(line)
38
+ || /^tokens used$/i.test(line)
39
+ || /^\d{1,3}(,\d{3})*$/.test(line)
40
+ || /^\d{4}-\d{2}-\d{2}T.*\bWARN\b/.test(line)
41
+ || line === "user"
42
+ || line === "codex");
43
+ }
44
+ function lastMeaningfulLine(text) {
45
+ if (!text)
46
+ return null;
47
+ const lines = text
48
+ .split(/\r?\n/)
49
+ .map((line) => line.trim())
50
+ .filter(Boolean)
51
+ .filter((line) => !isNoiseLine(line));
52
+ if (lines.length === 0)
53
+ return null;
54
+ return clip(lines.at(-1));
55
+ }
56
+ function formatSessionLabel(session) {
57
+ const origin = session.originSession
58
+ ? ` for ${session.originSession.channel}/${session.originSession.key}`
59
+ : "";
60
+ return `${session.runner} ${session.id}${origin}`;
61
+ }
62
+ function extractPullRequestLabel(snippet) {
63
+ if (!snippet)
64
+ return null;
65
+ const numberMatch = snippet.match(PULL_REQUEST_NUMBER_PATTERN);
66
+ if (numberMatch)
67
+ return `PR #${numberMatch[1]}`;
68
+ const urlMatch = snippet.match(PULL_REQUEST_URL_PATTERN);
69
+ if (urlMatch)
70
+ return `PR #${urlMatch[1]}`;
71
+ return null;
72
+ }
73
+ function isMergedPullRequestSnippet(snippet) {
74
+ return /\bmerged\b/i.test(snippet) || /\blanded\b/i.test(snippet);
75
+ }
76
+ function deriveObligationMilestone(update) {
77
+ const snippet = pickUpdateSnippet(update);
78
+ const pullRequest = extractPullRequestLabel(snippet);
79
+ if (update.kind === "completed" && snippet && pullRequest && isMergedPullRequestSnippet(snippet)) {
80
+ return {
81
+ status: "updating_runtime",
82
+ currentSurface: { kind: "runtime", label: "ouro up" },
83
+ currentArtifact: pullRequest,
84
+ nextAction: "update runtime, verify version/changelog, then re-observe",
85
+ };
86
+ }
87
+ if (update.kind === "completed" && pullRequest) {
88
+ return {
89
+ status: "waiting_for_merge",
90
+ currentSurface: { kind: "merge", label: pullRequest },
91
+ currentArtifact: pullRequest,
92
+ nextAction: `wait for checks, merge ${pullRequest}, then update runtime`,
93
+ };
94
+ }
95
+ if (update.kind === "waiting_input") {
96
+ return {
97
+ status: "investigating",
98
+ currentSurface: { kind: "coding", label: `${update.session.runner} ${update.session.id}` },
99
+ nextAction: `answer ${update.session.runner} ${update.session.id} and continue`,
100
+ };
101
+ }
102
+ if (update.kind === "stalled") {
103
+ return {
104
+ status: "investigating",
105
+ currentSurface: { kind: "coding", label: `${update.session.runner} ${update.session.id}` },
106
+ nextAction: `unstick ${update.session.runner} ${update.session.id} and continue`,
107
+ };
108
+ }
109
+ if (update.kind === "progress" || update.kind === "spawned" || update.kind === "failed" || update.kind === "killed" || update.kind === "completed") {
110
+ return {
111
+ status: "investigating",
112
+ currentSurface: { kind: "coding", label: `${update.session.runner} ${update.session.id}` },
113
+ };
114
+ }
115
+ return null;
116
+ }
117
+ function isSafeProgressSnippet(snippet) {
118
+ const normalized = snippet.trim();
119
+ const wordCount = snippet.split(/\s+/).filter(Boolean).length;
120
+ return (normalized.length <= 80
121
+ && wordCount >= 2
122
+ && wordCount <= 8
123
+ && /[A-Za-z]{3,}/.test(normalized)
124
+ && !normalized.includes(":")
125
+ && !/[{}\[\]();]/.test(normalized)
126
+ && !normalized.startsWith("**")
127
+ && !/^Respond with\b/i.test(normalized)
128
+ && !/^Coding session metadata\b/i.test(normalized)
129
+ && !/^sessionId\b/i.test(normalized)
130
+ && !/^taskRef\b/i.test(normalized)
131
+ && !/^parentAgent\b/i.test(normalized));
132
+ }
133
+ function pickUpdateSnippet(update) {
134
+ const checkpoint = update.session.checkpoint?.trim() || null;
135
+ return (checkpoint
136
+ ?? lastMeaningfulLine(update.text)
137
+ ?? lastMeaningfulLine(update.session.stderrTail)
138
+ ?? lastMeaningfulLine(update.session.stdoutTail));
139
+ }
140
+ function renderValue(text) {
141
+ const trimmed = text?.trim();
142
+ return trimmed && trimmed.length > 0 ? trimmed : "(empty)";
143
+ }
144
+ function renderPath(text) {
145
+ return text && text.trim().length > 0 ? text : "(none)";
146
+ }
147
+ function formatCodingTail(session) {
148
+ const stdout = renderValue(session.stdoutTail);
149
+ const stderr = renderValue(session.stderrTail);
150
+ return [
151
+ `sessionId: ${session.id}`,
152
+ `runner: ${session.runner}`,
153
+ `status: ${session.status}`,
154
+ `checkpoint: ${renderValue(session.checkpoint ?? undefined)}`,
155
+ `artifactPath: ${renderPath(session.artifactPath)}`,
156
+ `workdir: ${session.workdir}`,
157
+ "",
158
+ "[stdout]",
159
+ stdout,
160
+ "",
161
+ "[stderr]",
162
+ stderr,
163
+ ].join("\n");
164
+ }
165
+ function formatUpdateMessage(update) {
166
+ const label = formatSessionLabel(update.session);
167
+ const snippet = pickUpdateSnippet(update);
168
+ switch (update.kind) {
169
+ case "progress":
170
+ return snippet && isSafeProgressSnippet(snippet) ? `${label}: ${snippet}` : null;
171
+ case "waiting_input":
172
+ return snippet ? `${label} waiting: ${snippet}` : `${label} waiting`;
173
+ case "stalled":
174
+ return snippet ? `${label} stalled: ${snippet}` : `${label} stalled`;
175
+ case "completed":
176
+ return snippet ? `${label} completed: ${snippet}` : `${label} completed`;
177
+ case "failed":
178
+ return snippet ? `${label} failed: ${snippet}` : `${label} failed`;
179
+ case "killed":
180
+ return `${label} killed`;
181
+ case "spawned":
182
+ return `${label} started`;
183
+ }
184
+ }
185
+ function formatReportBackMessage(update, baseMessage) {
186
+ if (!baseMessage)
187
+ return null;
188
+ if (!update.session.obligationId || !update.session.originSession) {
189
+ return baseMessage;
190
+ }
191
+ const milestone = deriveObligationMilestone(update);
192
+ const extraLines = [];
193
+ if (milestone?.currentArtifact) {
194
+ extraLines.push(`current artifact: ${milestone.currentArtifact}`);
195
+ }
196
+ if (milestone?.nextAction) {
197
+ extraLines.push(`next: ${milestone.nextAction}`);
198
+ }
199
+ return extraLines.length > 0 ? `${baseMessage}\n${extraLines.join("\n")}` : baseMessage;
200
+ }
201
+ function obligationNoteFromUpdate(update) {
202
+ const snippet = pickUpdateSnippet(update);
203
+ switch (update.kind) {
204
+ case "spawned":
205
+ return update.session.originSession
206
+ ? `coding session started for ${update.session.originSession.channel}/${update.session.originSession.key}`
207
+ : "coding session started";
208
+ case "progress":
209
+ return snippet ? `coding session progress: ${snippet}` : null;
210
+ case "waiting_input":
211
+ return snippet ? `coding session waiting: ${snippet}` : "coding session waiting for input";
212
+ case "stalled":
213
+ return snippet ? `coding session stalled: ${snippet}` : "coding session stalled";
214
+ case "completed":
215
+ return snippet
216
+ ? `coding session completed: ${snippet}; merge/update still pending`
217
+ : "coding session completed; merge/update still pending";
218
+ case "failed":
219
+ return snippet ? `coding session failed: ${snippet}` : "coding session failed";
220
+ case "killed":
221
+ return "coding session killed";
222
+ }
223
+ }
224
+ function syncObligationFromUpdate(update) {
225
+ const obligationId = update.session.obligationId;
226
+ if (!obligationId)
227
+ return;
228
+ const milestone = deriveObligationMilestone(update);
229
+ try {
230
+ (0, obligations_1.advanceObligation)((0, identity_1.getAgentRoot)(), obligationId, {
231
+ status: milestone?.status ?? "investigating",
232
+ currentSurface: milestone?.currentSurface ?? { kind: "coding", label: `${update.session.runner} ${update.session.id}` },
233
+ currentArtifact: milestone?.currentArtifact,
234
+ nextAction: milestone?.nextAction,
235
+ latestNote: obligationNoteFromUpdate(update) ?? undefined,
236
+ });
237
+ }
238
+ catch {
239
+ // Detached feedback should still reach the human even if obligation sync is unavailable.
240
+ }
241
+ }
242
+ async function wakeInnerDialogForObligation(update) {
243
+ if (!update.session.obligationId || !OBLIGATION_WAKE_UPDATE_KINDS.has(update.kind)) {
244
+ return;
245
+ }
246
+ try {
247
+ await (0, socket_client_1.requestInnerWake)((0, identity_1.getAgentName)());
248
+ }
249
+ catch (error) {
250
+ (0, runtime_1.emitNervesEvent)({
251
+ level: "warn",
252
+ component: "repertoire",
253
+ event: "repertoire.coding_feedback_wake_error",
254
+ message: "coding feedback wake request failed",
255
+ meta: {
256
+ sessionId: update.session.id,
257
+ kind: update.kind,
258
+ reason: error instanceof Error ? error.message : String(error),
259
+ },
260
+ });
261
+ }
262
+ }
263
+ function attachCodingSessionFeedback(manager, session, target) {
264
+ let lastMessage = "";
265
+ let closed = false;
266
+ let unsubscribe = null;
267
+ const sendMessage = (message) => {
268
+ if (closed || !message || message === lastMessage) {
269
+ return;
270
+ }
271
+ lastMessage = message;
272
+ void Promise.resolve(target.send(message)).catch((error) => {
273
+ (0, runtime_1.emitNervesEvent)({
274
+ level: "warn",
275
+ component: "repertoire",
276
+ event: "repertoire.coding_feedback_error",
277
+ message: "coding feedback transport failed",
278
+ meta: {
279
+ sessionId: session.id,
280
+ reason: error instanceof Error ? error.message : String(error),
281
+ },
282
+ });
283
+ });
284
+ };
285
+ const spawnedUpdate = { kind: "spawned", session };
286
+ syncObligationFromUpdate(spawnedUpdate);
287
+ sendMessage(formatReportBackMessage(spawnedUpdate, formatUpdateMessage(spawnedUpdate)));
288
+ unsubscribe = manager.subscribe(session.id, async (update) => {
289
+ syncObligationFromUpdate(update);
290
+ sendMessage(formatReportBackMessage(update, formatUpdateMessage(update)));
291
+ await wakeInnerDialogForObligation(update);
292
+ if (TERMINAL_UPDATE_KINDS.has(update.kind)) {
293
+ closed = true;
294
+ unsubscribe?.();
295
+ }
296
+ });
297
+ return () => {
298
+ closed = true;
299
+ unsubscribe?.();
300
+ };
301
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatCodingMonitorReport = exports.CodingSessionMonitor = exports.CodingSessionManager = void 0;
3
+ exports.formatCodingTail = exports.attachCodingSessionFeedback = exports.formatCodingMonitorReport = exports.CodingSessionMonitor = exports.CodingSessionManager = void 0;
4
4
  exports.getCodingSessionManager = getCodingSessionManager;
5
5
  exports.resetCodingSessionManager = resetCodingSessionManager;
6
6
  const runtime_1 = require("../../nerves/runtime");
@@ -34,3 +34,6 @@ var monitor_1 = require("./monitor");
34
34
  Object.defineProperty(exports, "CodingSessionMonitor", { enumerable: true, get: function () { return monitor_1.CodingSessionMonitor; } });
35
35
  var reporter_1 = require("./reporter");
36
36
  Object.defineProperty(exports, "formatCodingMonitorReport", { enumerable: true, get: function () { return reporter_1.formatCodingMonitorReport; } });
37
+ var feedback_1 = require("./feedback");
38
+ Object.defineProperty(exports, "attachCodingSessionFeedback", { enumerable: true, get: function () { return feedback_1.attachCodingSessionFeedback; } });
39
+ Object.defineProperty(exports, "formatCodingTail", { enumerable: true, get: function () { return feedback_1.formatCodingTail; } });