@ouro.bot/cli 0.1.0-alpha.32 → 0.1.0-alpha.321

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 (308) hide show
  1. package/README.md +188 -190
  2. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +3 -2
  3. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +1 -1
  4. package/changelog.json +1924 -0
  5. package/dist/arc/attention-types.js +8 -0
  6. package/dist/arc/cares.js +140 -0
  7. package/dist/arc/episodes.js +117 -0
  8. package/dist/arc/intentions.js +133 -0
  9. package/dist/arc/json-store.js +117 -0
  10. package/dist/arc/obligations.js +237 -0
  11. package/dist/arc/packets.js +193 -0
  12. package/dist/arc/presence.js +185 -0
  13. package/dist/arc/task-lifecycle.js +65 -0
  14. package/dist/heart/active-work.js +832 -0
  15. package/dist/heart/agent-entry.js +37 -2
  16. package/dist/heart/attachments/image-normalize.js +194 -0
  17. package/dist/heart/attachments/materialize.js +97 -0
  18. package/dist/heart/attachments/originals.js +88 -0
  19. package/dist/heart/attachments/render.js +29 -0
  20. package/dist/heart/attachments/sources/adapter.js +2 -0
  21. package/dist/heart/attachments/sources/bluebubbles.js +156 -0
  22. package/dist/heart/attachments/sources/cli-local-file.js +78 -0
  23. package/dist/heart/attachments/sources/index.js +16 -0
  24. package/dist/heart/attachments/store.js +103 -0
  25. package/dist/heart/attachments/types.js +93 -0
  26. package/dist/heart/auth/auth-flow.js +456 -0
  27. package/dist/heart/bridges/manager.js +358 -0
  28. package/dist/heart/bridges/state-machine.js +135 -0
  29. package/dist/heart/bridges/store.js +123 -0
  30. package/dist/heart/bundle-state.js +168 -0
  31. package/dist/heart/commitments.js +111 -0
  32. package/dist/heart/config-registry.js +304 -0
  33. package/dist/heart/config.js +63 -30
  34. package/dist/heart/core.js +669 -195
  35. package/dist/heart/cross-chat-delivery.js +131 -0
  36. package/dist/heart/daemon/agent-config-check.js +149 -0
  37. package/dist/heart/daemon/agent-discovery.js +79 -3
  38. package/dist/heart/daemon/agent-service.js +360 -0
  39. package/dist/heart/daemon/agentic-repair.js +170 -0
  40. package/dist/heart/daemon/cadence.js +70 -0
  41. package/dist/heart/daemon/cli-defaults.js +596 -0
  42. package/dist/heart/daemon/cli-exec.js +2238 -0
  43. package/dist/heart/daemon/cli-help.js +306 -0
  44. package/dist/heart/daemon/cli-parse.js +824 -0
  45. package/dist/heart/daemon/cli-render-doctor.js +57 -0
  46. package/dist/heart/daemon/cli-render.js +506 -0
  47. package/dist/heart/daemon/cli-types.js +8 -0
  48. package/dist/heart/daemon/daemon-cli.js +29 -1171
  49. package/dist/heart/daemon/daemon-entry.js +333 -3
  50. package/dist/heart/daemon/daemon-health.js +137 -0
  51. package/dist/heart/daemon/daemon-runtime-sync.js +153 -12
  52. package/dist/heart/daemon/daemon-tombstone.js +236 -0
  53. package/dist/heart/daemon/daemon.js +751 -58
  54. package/dist/heart/daemon/doctor-types.js +8 -0
  55. package/dist/heart/daemon/doctor.js +322 -0
  56. package/dist/heart/daemon/health-monitor.js +66 -0
  57. package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
  58. package/dist/heart/daemon/hooks/bundle-meta.js +115 -1
  59. package/dist/heart/daemon/http-health-probe.js +80 -0
  60. package/dist/heart/daemon/inner-status.js +89 -0
  61. package/dist/heart/daemon/interactive-repair.js +69 -0
  62. package/dist/heart/daemon/launchd.js +46 -9
  63. package/dist/heart/daemon/log-tailer.js +82 -12
  64. package/dist/heart/daemon/logs-prune.js +105 -0
  65. package/dist/heart/daemon/message-router.js +17 -8
  66. package/dist/heart/daemon/os-cron-deps.js +134 -0
  67. package/dist/heart/daemon/ouro-bot-entry.js +1 -1
  68. package/dist/heart/daemon/process-manager.js +201 -0
  69. package/dist/heart/daemon/provider-discovery.js +105 -0
  70. package/dist/heart/daemon/pulse.js +463 -0
  71. package/dist/heart/daemon/run-hooks.js +2 -0
  72. package/dist/heart/daemon/runtime-logging.js +67 -16
  73. package/dist/heart/daemon/runtime-metadata.js +101 -0
  74. package/dist/heart/daemon/runtime-mode.js +67 -0
  75. package/dist/heart/daemon/safe-mode.js +161 -0
  76. package/dist/heart/daemon/sense-manager.js +72 -3
  77. package/dist/heart/daemon/session-id-resolver.js +131 -0
  78. package/dist/heart/daemon/skill-management-installer.js +94 -0
  79. package/dist/heart/daemon/socket-client.js +307 -0
  80. package/dist/heart/daemon/stale-bundle-prune.js +96 -0
  81. package/dist/heart/daemon/startup-tui.js +227 -0
  82. package/dist/heart/daemon/task-scheduler.js +3 -25
  83. package/dist/heart/daemon/thoughts.js +510 -0
  84. package/dist/heart/daemon/up-progress.js +135 -0
  85. package/dist/heart/delegation.js +62 -0
  86. package/dist/heart/habits/habit-migration.js +181 -0
  87. package/dist/heart/habits/habit-parser.js +140 -0
  88. package/dist/heart/habits/habit-scheduler.js +371 -0
  89. package/dist/heart/{daemon → hatch}/hatch-flow.js +30 -120
  90. package/dist/heart/{daemon → hatch}/hatch-specialist.js +3 -3
  91. package/dist/heart/{daemon → hatch}/specialist-prompt.js +10 -7
  92. package/dist/heart/{daemon → hatch}/specialist-tools.js +49 -3
  93. package/dist/heart/identity.js +163 -60
  94. package/dist/heart/kicks.js +2 -20
  95. package/dist/heart/mcp/mcp-server.js +653 -0
  96. package/dist/heart/migrate-config.js +127 -0
  97. package/dist/heart/model-capabilities.js +59 -0
  98. package/dist/heart/outlook/outlook-http.js +439 -0
  99. package/dist/heart/outlook/outlook-read.js +28 -0
  100. package/dist/heart/outlook/outlook-render.js +1032 -0
  101. package/dist/heart/outlook/outlook-types.js +27 -0
  102. package/dist/heart/outlook/outlook-view.js +194 -0
  103. package/dist/heart/outlook/readers/agent-machine.js +355 -0
  104. package/dist/heart/outlook/readers/continuity-readers.js +332 -0
  105. package/dist/heart/outlook/readers/runtime-readers.js +660 -0
  106. package/dist/heart/outlook/readers/sessions.js +231 -0
  107. package/dist/heart/outlook/readers/shared.js +111 -0
  108. package/dist/heart/progress-story.js +42 -0
  109. package/dist/heart/provider-failover.js +88 -0
  110. package/dist/heart/provider-ping.js +162 -0
  111. package/dist/heart/providers/anthropic-token.js +163 -0
  112. package/dist/heart/providers/anthropic.js +169 -46
  113. package/dist/heart/providers/azure.js +98 -11
  114. package/dist/heart/providers/error-classification.js +63 -0
  115. package/dist/heart/providers/github-copilot.js +136 -0
  116. package/dist/heart/providers/minimax-vlm.js +189 -0
  117. package/dist/heart/providers/minimax.js +23 -5
  118. package/dist/heart/providers/openai-codex.js +33 -22
  119. package/dist/heart/session-activity.js +190 -0
  120. package/dist/heart/session-events.js +726 -0
  121. package/dist/heart/session-recall.js +162 -0
  122. package/dist/heart/start-of-turn-packet.js +341 -0
  123. package/dist/heart/streaming.js +36 -27
  124. package/dist/heart/sync.js +332 -0
  125. package/dist/heart/target-resolution.js +127 -0
  126. package/dist/heart/tempo.js +93 -0
  127. package/dist/heart/temporal-view.js +41 -0
  128. package/dist/heart/tool-activity-callbacks.js +36 -0
  129. package/dist/heart/tool-description.js +135 -0
  130. package/dist/heart/tool-friction.js +55 -0
  131. package/dist/heart/tool-loop.js +200 -0
  132. package/dist/heart/turn-context.js +358 -0
  133. package/dist/heart/turn-coordinator.js +28 -0
  134. package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +1 -1
  135. package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +1 -1
  136. package/dist/heart/{daemon → versioning}/ouro-path-installer.js +78 -35
  137. package/dist/heart/versioning/ouro-version-manager.js +295 -0
  138. package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
  139. package/dist/heart/{daemon → versioning}/update-checker.js +12 -2
  140. package/dist/heart/{daemon → versioning}/update-hooks.js +63 -59
  141. package/dist/mind/associative-recall.js +137 -66
  142. package/dist/mind/bundle-manifest.js +8 -1
  143. package/dist/mind/context.js +89 -93
  144. package/dist/mind/diary-integrity.js +60 -0
  145. package/dist/mind/{memory.js → diary.js} +84 -96
  146. package/dist/mind/embedding-provider.js +60 -0
  147. package/dist/mind/file-state.js +179 -0
  148. package/dist/mind/first-impressions.js +14 -1
  149. package/dist/mind/friends/channel.js +56 -0
  150. package/dist/mind/friends/group-context.js +144 -0
  151. package/dist/mind/friends/resolver.js +37 -0
  152. package/dist/mind/friends/store-file.js +58 -3
  153. package/dist/mind/friends/trust-explanation.js +74 -0
  154. package/dist/mind/friends/types.js +8 -0
  155. package/dist/mind/journal-index.js +161 -0
  156. package/dist/mind/obligation-steering.js +221 -0
  157. package/dist/mind/pending.js +76 -9
  158. package/dist/mind/prompt.js +950 -113
  159. package/dist/mind/provenance-trust.js +26 -0
  160. package/dist/mind/scrutiny.js +173 -0
  161. package/dist/mind/token-estimate.js +8 -12
  162. package/dist/nerves/cli-logging.js +7 -1
  163. package/dist/nerves/coverage/audit.js +1 -1
  164. package/dist/nerves/coverage/file-completeness.js +76 -5
  165. package/dist/nerves/coverage/run-artifacts.js +1 -1
  166. package/dist/nerves/event-buffer.js +111 -0
  167. package/dist/nerves/index.js +224 -4
  168. package/dist/nerves/observation.js +20 -0
  169. package/dist/nerves/redact.js +79 -0
  170. package/dist/nerves/runtime.js +5 -1
  171. package/dist/outlook-ui/assets/index-IuR4F6y6.js +61 -0
  172. package/dist/outlook-ui/assets/index-LwChZTgL.css +1 -0
  173. package/dist/outlook-ui/index.html +15 -0
  174. package/dist/repertoire/ado-client.js +15 -56
  175. package/dist/repertoire/ado-semantic.js +11 -10
  176. package/dist/repertoire/api-client.js +97 -0
  177. package/dist/repertoire/bitwarden-store.js +319 -0
  178. package/dist/repertoire/bundle-templates.js +72 -0
  179. package/dist/repertoire/bw-installer.js +79 -0
  180. package/dist/repertoire/coding/codex-jsonl.js +64 -0
  181. package/dist/repertoire/coding/context-pack.js +330 -0
  182. package/dist/repertoire/coding/feedback.js +197 -30
  183. package/dist/repertoire/coding/manager.js +159 -11
  184. package/dist/repertoire/coding/spawner.js +55 -9
  185. package/dist/repertoire/coding/tools.js +170 -7
  186. package/dist/repertoire/commerce-errors.js +109 -0
  187. package/dist/repertoire/commerce-self-test.js +156 -0
  188. package/dist/repertoire/credential-access.js +527 -0
  189. package/dist/repertoire/duffel-client.js +185 -0
  190. package/dist/repertoire/github-client.js +14 -55
  191. package/dist/repertoire/graph-client.js +11 -52
  192. package/dist/repertoire/guardrails.js +375 -0
  193. package/dist/repertoire/mcp-client.js +255 -0
  194. package/dist/repertoire/mcp-manager.js +305 -0
  195. package/dist/repertoire/mcp-tools.js +63 -0
  196. package/dist/repertoire/shell-sessions.js +133 -0
  197. package/dist/repertoire/skills.js +14 -23
  198. package/dist/repertoire/stripe-client.js +131 -0
  199. package/dist/repertoire/tasks/board.js +43 -5
  200. package/dist/repertoire/tasks/fix.js +182 -0
  201. package/dist/repertoire/tasks/index.js +28 -10
  202. package/dist/repertoire/tasks/lifecycle.js +2 -2
  203. package/dist/repertoire/tasks/parser.js +3 -2
  204. package/dist/repertoire/tasks/scanner.js +194 -37
  205. package/dist/repertoire/tasks/transitions.js +16 -79
  206. package/dist/repertoire/tool-results.js +29 -0
  207. package/dist/repertoire/tools-attachments.js +316 -0
  208. package/dist/repertoire/tools-base.js +45 -771
  209. package/dist/repertoire/tools-bluebubbles.js +1 -0
  210. package/dist/repertoire/tools-bridge.js +141 -0
  211. package/dist/repertoire/tools-bundle.js +984 -0
  212. package/dist/repertoire/tools-config.js +185 -0
  213. package/dist/repertoire/tools-continuity.js +248 -0
  214. package/dist/repertoire/tools-credential.js +182 -0
  215. package/dist/repertoire/tools-files.js +342 -0
  216. package/dist/repertoire/tools-flight.js +224 -0
  217. package/dist/repertoire/tools-flow.js +105 -0
  218. package/dist/repertoire/tools-github.js +1 -7
  219. package/dist/repertoire/tools-memory.js +376 -0
  220. package/dist/repertoire/tools-session.js +739 -0
  221. package/dist/repertoire/tools-shell.js +120 -0
  222. package/dist/repertoire/tools-stripe.js +180 -0
  223. package/dist/repertoire/tools-surface.js +243 -0
  224. package/dist/repertoire/tools-teams.js +12 -62
  225. package/dist/repertoire/tools-travel.js +125 -0
  226. package/dist/repertoire/tools-user-profile.js +144 -0
  227. package/dist/repertoire/tools-vault.js +110 -0
  228. package/dist/repertoire/tools.js +144 -138
  229. package/dist/repertoire/travel-api-client.js +360 -0
  230. package/dist/repertoire/user-profile.js +118 -0
  231. package/dist/repertoire/vault-setup.js +241 -0
  232. package/dist/scripts/claude-code-hook.js +41 -0
  233. package/dist/scripts/claude-code-stop-hook.js +47 -0
  234. package/dist/senses/attention-queue.js +116 -0
  235. package/dist/senses/bluebubbles/attachment-cache.js +53 -0
  236. package/dist/senses/bluebubbles/attachment-download.js +137 -0
  237. package/dist/senses/{bluebubbles-client.js → bluebubbles/client.js} +143 -9
  238. package/dist/senses/bluebubbles/entry.js +13 -0
  239. package/dist/senses/bluebubbles/inbound-log.js +113 -0
  240. package/dist/senses/bluebubbles/index.js +1436 -0
  241. package/dist/senses/{bluebubbles-media.js → bluebubbles/media.js} +121 -70
  242. package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +43 -12
  243. package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +46 -6
  244. package/dist/senses/bluebubbles/replay.js +129 -0
  245. package/dist/senses/bluebubbles/runtime-state.js +109 -0
  246. package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
  247. package/dist/senses/cli/bracketed-paste.js +82 -0
  248. package/dist/senses/cli/image-paste.js +287 -0
  249. package/dist/senses/cli/image-ref-navigation.js +75 -0
  250. package/dist/senses/cli/ink-app.js +156 -0
  251. package/dist/senses/cli/inline-diff.js +64 -0
  252. package/dist/senses/cli/input-keys.js +174 -0
  253. package/dist/senses/cli/kill-ring.js +86 -0
  254. package/dist/senses/cli/message-list.js +51 -0
  255. package/dist/senses/cli/ouro-tui.js +605 -0
  256. package/dist/senses/cli/spinner-imperative.js +135 -0
  257. package/dist/senses/cli/spinner.js +101 -0
  258. package/dist/senses/cli/status-line.js +60 -0
  259. package/dist/senses/cli/streaming-markdown.js +526 -0
  260. package/dist/senses/cli/tool-display.js +83 -0
  261. package/dist/senses/cli/tool-render.js +85 -0
  262. package/dist/senses/cli/tui-store.js +240 -0
  263. package/dist/senses/cli/virtual-list.js +35 -0
  264. package/dist/senses/cli-entry.js +1 -1
  265. package/dist/senses/cli-layout.js +187 -0
  266. package/dist/senses/cli.js +595 -246
  267. package/dist/senses/commands.js +65 -1
  268. package/dist/senses/continuity.js +94 -0
  269. package/dist/senses/habit-turn-message.js +108 -0
  270. package/dist/senses/inner-dialog-worker.js +112 -19
  271. package/dist/senses/inner-dialog.js +633 -86
  272. package/dist/senses/pipeline.js +565 -0
  273. package/dist/senses/shared-turn.js +199 -0
  274. package/dist/senses/surface-tool.js +68 -0
  275. package/dist/senses/teams.js +666 -166
  276. package/dist/senses/trust-gate.js +112 -2
  277. package/package.json +27 -7
  278. package/skills/agent-commerce.md +106 -0
  279. package/skills/browser-navigation.md +110 -0
  280. package/skills/commerce-setup-guide.md +116 -0
  281. package/skills/commerce-setup.md +84 -0
  282. package/skills/configure-dev-tools.md +81 -0
  283. package/skills/travel-planning.md +138 -0
  284. package/dist/heart/daemon/subagent-installer.js +0 -134
  285. package/dist/senses/bluebubbles-entry.js +0 -11
  286. package/dist/senses/bluebubbles.js +0 -544
  287. package/dist/senses/debug-activity.js +0 -108
  288. package/subagents/README.md +0 -73
  289. package/subagents/work-doer.md +0 -235
  290. package/subagents/work-merger.md +0 -618
  291. package/subagents/work-planner.md +0 -382
  292. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
  293. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
  294. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
  295. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
  296. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
  297. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
  298. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
  299. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
  300. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
  301. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
  302. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
  303. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +0 -0
  304. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
  305. /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
  306. /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
  307. /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
  308. /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OUTLOOK_DEFAULT_PORT = exports.OUTLOOK_DEFAULT_INNER_VISIBILITY = exports.OUTLOOK_RELEASE_INTERACTION_MODEL = exports.OUTLOOK_PRODUCT_NAME = void 0;
4
+ exports.getOutlookTranscriptMessageText = getOutlookTranscriptMessageText;
5
+ exports.getOutlookTranscriptTimestamp = getOutlookTranscriptTimestamp;
6
+ exports.OUTLOOK_PRODUCT_NAME = "Ouro Outlook";
7
+ exports.OUTLOOK_RELEASE_INTERACTION_MODEL = "read-only";
8
+ exports.OUTLOOK_DEFAULT_INNER_VISIBILITY = "summary";
9
+ exports.OUTLOOK_DEFAULT_PORT = 6876;
10
+ function transcriptContentText(content) {
11
+ if (typeof content === "string")
12
+ return content;
13
+ if (!Array.isArray(content))
14
+ return "";
15
+ return content
16
+ .map((part) => (part.type === "text" && typeof part.text === "string"
17
+ ? part.text
18
+ : ""))
19
+ .filter((text) => text.length > 0)
20
+ .join("");
21
+ }
22
+ function getOutlookTranscriptMessageText(message) {
23
+ return transcriptContentText(message.content);
24
+ }
25
+ function getOutlookTranscriptTimestamp(message) {
26
+ return message.time.authoredAt ?? message.time.observedAt ?? message.time.recordedAt;
27
+ }
@@ -0,0 +1,194 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildOutlookMachineView = buildOutlookMachineView;
4
+ exports.buildOutlookAgentView = buildOutlookAgentView;
5
+ const runtime_1 = require("../../nerves/runtime");
6
+ const outlook_types_1 = require("./outlook-types");
7
+ function deriveAttention(agent) {
8
+ if (agent.degraded.status === "degraded") {
9
+ return { level: "degraded", label: "Degraded" };
10
+ }
11
+ if (agent.freshness.status === "stale") {
12
+ return { level: "stale", label: "Stale" };
13
+ }
14
+ if (agent.tasks.blockedCount > 0 || agent.coding.blockedCount > 0) {
15
+ return { level: "blocked", label: "Blocked" };
16
+ }
17
+ if (agent.tasks.liveCount > 0 || agent.coding.activeCount > 0 || agent.obligations.openCount > 0) {
18
+ return { level: "active", label: "Active" };
19
+ }
20
+ return { level: "idle", label: "Idle" };
21
+ }
22
+ function deriveAgentAttention(agent) {
23
+ return deriveAttention({
24
+ agentName: agent.agentName,
25
+ enabled: agent.enabled,
26
+ freshness: agent.freshness,
27
+ degraded: agent.degraded,
28
+ tasks: {
29
+ liveCount: agent.tasks.liveCount,
30
+ blockedCount: agent.tasks.blockedCount,
31
+ },
32
+ obligations: {
33
+ openCount: agent.obligations.openCount,
34
+ },
35
+ coding: {
36
+ activeCount: agent.coding.activeCount,
37
+ blockedCount: agent.coding.blockedCount,
38
+ },
39
+ });
40
+ }
41
+ function buildTotals(machine) {
42
+ return machine.agents.reduce((totals, agent) => ({
43
+ agents: totals.agents + 1,
44
+ enabledAgents: totals.enabledAgents + (agent.enabled ? 1 : 0),
45
+ degradedAgents: totals.degradedAgents + (agent.degraded.status === "degraded" ? 1 : 0),
46
+ staleAgents: totals.staleAgents + (agent.freshness.status === "stale" ? 1 : 0),
47
+ liveTasks: totals.liveTasks + agent.tasks.liveCount,
48
+ blockedTasks: totals.blockedTasks + agent.tasks.blockedCount,
49
+ openObligations: totals.openObligations + agent.obligations.openCount,
50
+ activeCodingAgents: totals.activeCodingAgents + (agent.coding.activeCount > 0 ? 1 : 0),
51
+ blockedCodingAgents: totals.blockedCodingAgents + (agent.coding.blockedCount > 0 ? 1 : 0),
52
+ }), {
53
+ agents: 0,
54
+ enabledAgents: 0,
55
+ degradedAgents: 0,
56
+ staleAgents: 0,
57
+ liveTasks: 0,
58
+ blockedTasks: 0,
59
+ openObligations: 0,
60
+ activeCodingAgents: 0,
61
+ blockedCodingAgents: 0,
62
+ });
63
+ }
64
+ function deriveMood(machine, daemon) {
65
+ if (machine.degraded.status === "degraded" || daemon.health === "warn") {
66
+ return "strained";
67
+ }
68
+ if (machine.freshness.status === "stale") {
69
+ return "watchful";
70
+ }
71
+ return "calm";
72
+ }
73
+ function buildOutlookMachineView(input) {
74
+ const totals = buildTotals(input.machine);
75
+ const agents = input.machine.agents
76
+ .map((agent) => ({
77
+ ...agent,
78
+ attention: deriveAttention(agent),
79
+ }))
80
+ .sort((left, right) => {
81
+ const leftAt = left.freshness.latestActivityAt ?? "";
82
+ const rightAt = right.freshness.latestActivityAt ?? "";
83
+ return rightAt.localeCompare(leftAt);
84
+ });
85
+ return {
86
+ overview: {
87
+ productName: outlook_types_1.OUTLOOK_PRODUCT_NAME,
88
+ observedAt: input.machine.observedAt,
89
+ primaryEntryPoint: input.daemon.outlookUrl,
90
+ daemon: input.daemon,
91
+ runtime: input.machine.runtime,
92
+ freshness: input.machine.freshness,
93
+ degraded: input.machine.degraded,
94
+ totals,
95
+ mood: deriveMood(input.machine, input.daemon),
96
+ entrypoints: [
97
+ { kind: "web", label: "Open Outlook", target: input.daemon.outlookUrl },
98
+ { kind: "cli", label: "CLI JSON", target: "ouro outlook --json" },
99
+ ],
100
+ },
101
+ agents,
102
+ };
103
+ }
104
+ function normalizeViewer(viewer) {
105
+ return {
106
+ kind: viewer?.kind ?? "human",
107
+ agentName: viewer?.agentName,
108
+ innerDetail: viewer?.innerDetail ?? "summary",
109
+ };
110
+ }
111
+ function buildInnerView(inner, viewer) {
112
+ if (viewer.innerDetail === "deep") {
113
+ return {
114
+ mode: "deep",
115
+ status: inner.status,
116
+ summary: inner.surfacedSummary,
117
+ hasPending: inner.hasPending,
118
+ origin: inner.origin,
119
+ obligationStatus: inner.obligationStatus,
120
+ };
121
+ }
122
+ return {
123
+ mode: "summary",
124
+ status: inner.status,
125
+ summary: inner.surfacedSummary,
126
+ hasPending: inner.hasPending,
127
+ };
128
+ }
129
+ function buildRecentActivity(agent) {
130
+ const items = [
131
+ ...agent.coding.items.map((item) => ({
132
+ kind: "coding",
133
+ at: item.lastActivityAt,
134
+ label: item.checkpoint ?? `${item.runner} ${item.status}`,
135
+ detail: item.workdir,
136
+ })),
137
+ ...agent.sessions.items.map((item) => ({
138
+ kind: "session",
139
+ at: item.lastActivityAt,
140
+ label: `${item.friendName} via ${item.channel}`,
141
+ detail: item.key,
142
+ })),
143
+ ...agent.obligations.items.map((item) => ({
144
+ kind: "obligation",
145
+ at: item.updatedAt,
146
+ label: item.content,
147
+ detail: item.nextAction ?? item.status,
148
+ })),
149
+ ];
150
+ if (agent.inner.latestActivityAt) {
151
+ items.push({
152
+ kind: "inner",
153
+ at: agent.inner.latestActivityAt,
154
+ label: agent.inner.surfacedSummary ?? agent.inner.status,
155
+ detail: agent.inner.hasPending ? "pending inner work" : agent.inner.obligationStatus ?? "no linked obligation",
156
+ });
157
+ }
158
+ return items
159
+ .filter((item) => Number.isFinite(Date.parse(item.at)))
160
+ .sort((left, right) => right.at.localeCompare(left.at))
161
+ .slice(0, 4);
162
+ }
163
+ function buildOutlookAgentView(input) {
164
+ /* v8 ignore next */
165
+ (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.outlook_view_agent", message: `building outlook view for ${input.agent.agentName}`, meta: { agent: input.agent.agentName } });
166
+ const viewer = normalizeViewer(input.viewer);
167
+ return {
168
+ productName: outlook_types_1.OUTLOOK_PRODUCT_NAME,
169
+ interactionModel: outlook_types_1.OUTLOOK_RELEASE_INTERACTION_MODEL,
170
+ viewer,
171
+ agent: {
172
+ agentName: input.agent.agentName,
173
+ agentRoot: input.agent.agentRoot,
174
+ enabled: input.agent.enabled,
175
+ provider: input.agent.provider,
176
+ senses: input.agent.senses,
177
+ freshness: input.agent.freshness,
178
+ degraded: input.agent.degraded,
179
+ attention: deriveAgentAttention(input.agent),
180
+ },
181
+ work: {
182
+ tasks: input.agent.tasks,
183
+ obligations: input.agent.obligations,
184
+ sessions: input.agent.sessions,
185
+ coding: input.agent.coding,
186
+ bridges: input.agent.tasks.activeBridges,
187
+ },
188
+ inner: buildInnerView(input.agent.inner, viewer),
189
+ activity: {
190
+ freshness: input.agent.freshness,
191
+ recent: buildRecentActivity(input.agent),
192
+ },
193
+ };
194
+ }
@@ -0,0 +1,355 @@
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
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.readObligationSummary = readObligationSummary;
37
+ exports.readOutlookAgentState = readOutlookAgentState;
38
+ exports.readOutlookMachineState = readOutlookMachineState;
39
+ const fs = __importStar(require("fs"));
40
+ const path = __importStar(require("path"));
41
+ const runtime_1 = require("../../../nerves/runtime");
42
+ const obligations_1 = require("../../../arc/obligations");
43
+ const board_1 = require("../../../repertoire/tasks/board");
44
+ const scanner_1 = require("../../../repertoire/tasks/scanner");
45
+ const session_activity_1 = require("../../session-activity");
46
+ const identity_1 = require("../../identity");
47
+ const agent_discovery_1 = require("../../daemon/agent-discovery");
48
+ const runtime_metadata_1 = require("../../daemon/runtime-metadata");
49
+ const thoughts_1 = require("../../daemon/thoughts");
50
+ const outlook_types_1 = require("../outlook-types");
51
+ const shared_1 = require("./shared");
52
+ const LIVE_TASK_STATUSES = ["processing", "validating", "collaborating", "blocked"];
53
+ function emptyByStatus() {
54
+ return {
55
+ drafting: 0,
56
+ processing: 0,
57
+ validating: 0,
58
+ collaborating: 0,
59
+ paused: 0,
60
+ blocked: 0,
61
+ cancelled: 0,
62
+ done: 0,
63
+ };
64
+ }
65
+ function readAgentConfig(agentRoot) {
66
+ const configPath = path.join(agentRoot, "agent.json");
67
+ try {
68
+ const raw = fs.readFileSync(configPath, "utf-8");
69
+ const parsed = JSON.parse(raw);
70
+ const senses = Object.entries(parsed.senses ?? {})
71
+ .filter(([, value]) => value && typeof value.enabled === "boolean" && value.enabled)
72
+ .map(([name]) => name)
73
+ .sort((left, right) => left.localeCompare(right));
74
+ return {
75
+ summary: {
76
+ enabled: typeof parsed.enabled === "boolean" ? parsed.enabled : true,
77
+ provider: typeof parsed.provider === "string" ? parsed.provider : null,
78
+ senses,
79
+ },
80
+ issues: [],
81
+ };
82
+ }
83
+ catch (error) {
84
+ return {
85
+ summary: {
86
+ enabled: false,
87
+ provider: null,
88
+ senses: [],
89
+ },
90
+ issues: [(0, shared_1.issue)("agent-config-unreadable", `${configPath}: ${error instanceof Error ? error.message : String(error)}`)],
91
+ };
92
+ }
93
+ }
94
+ function readTaskSummary(agentRoot) {
95
+ const taskRoot = path.join(agentRoot, "tasks");
96
+ const index = (0, scanner_1.scanTasks)(taskRoot);
97
+ const board = (0, board_1.buildTaskBoard)(index);
98
+ const byStatus = emptyByStatus();
99
+ for (const status of Object.keys(byStatus)) {
100
+ byStatus[status] = board.byStatus[status].length;
101
+ }
102
+ const liveTaskNames = LIVE_TASK_STATUSES.flatMap((status) => board.byStatus[status]);
103
+ const issues = index.issues.map((taskIssue) => (0, shared_1.issue)(taskIssue.code, `${taskIssue.target}: ${taskIssue.description}`));
104
+ return {
105
+ summary: {
106
+ totalCount: index.tasks.length,
107
+ liveCount: liveTaskNames.length,
108
+ blockedCount: board.byStatus.blocked.length,
109
+ byStatus,
110
+ liveTaskNames,
111
+ actionRequired: [...board.actionRequired],
112
+ activeBridges: [...board.activeBridges],
113
+ },
114
+ issues,
115
+ };
116
+ }
117
+ function readObligationSummary(agentRoot) {
118
+ const items = (0, obligations_1.readPendingObligations)(agentRoot)
119
+ .map((obligation) => ({
120
+ id: obligation.id,
121
+ status: obligation.status,
122
+ content: obligation.content,
123
+ updatedAt: obligation.updatedAt ?? obligation.createdAt,
124
+ nextAction: obligation.nextAction ?? null,
125
+ /* v8 ignore start */
126
+ origin: obligation.origin ?? null,
127
+ currentSurface: obligation.currentSurface ?? null,
128
+ /* v8 ignore stop */
129
+ }))
130
+ .sort((left, right) => right.updatedAt.localeCompare(left.updatedAt));
131
+ return { items };
132
+ }
133
+ function readSessionSummary(agentName, agentRoot, now) {
134
+ const items = (0, session_activity_1.listSessionActivity)({
135
+ sessionsDir: path.join(agentRoot, "state", "sessions"),
136
+ friendsDir: path.join(agentRoot, "friends"),
137
+ agentName,
138
+ nowMs: now.getTime(),
139
+ })
140
+ .filter((session) => !(session.friendId === "self" && session.channel === "inner"))
141
+ .map((session) => ({
142
+ friendId: session.friendId,
143
+ friendName: session.friendName,
144
+ channel: session.channel,
145
+ key: session.key,
146
+ sessionPath: session.sessionPath,
147
+ lastActivityAt: session.lastActivityAt,
148
+ activitySource: session.activitySource,
149
+ }));
150
+ return { items };
151
+ }
152
+ function readInnerSummary(agentRoot) {
153
+ const sessionPath = (0, thoughts_1.getInnerDialogSessionPath)(agentRoot);
154
+ const pendingDir = path.join(agentRoot, "state", "pending", "self", "inner", "dialog");
155
+ const { pendingMessages, turns, runtimeState } = (0, thoughts_1.readInnerDialogRawData)(sessionPath, pendingDir);
156
+ const job = (0, thoughts_1.deriveInnerJob)(pendingMessages, turns, runtimeState);
157
+ const surfacedSummary = job.surfacedResult ? (0, thoughts_1.formatSurfacedValue)(job.surfacedResult) : null;
158
+ const latestPendingTimestamp = pendingMessages.length > 0
159
+ ? new Date(Math.max(...pendingMessages.map((message) => message.timestamp))).toISOString()
160
+ : null;
161
+ const latestActivityAt = latestPendingTimestamp
162
+ ?? runtimeState?.startedAt
163
+ ?? runtimeState?.lastCompletedAt
164
+ ?? null;
165
+ return {
166
+ summary: {
167
+ visibility: outlook_types_1.OUTLOOK_DEFAULT_INNER_VISIBILITY,
168
+ status: job.status,
169
+ hasPending: pendingMessages.length > 0,
170
+ surfacedSummary,
171
+ origin: job.origin,
172
+ obligationStatus: job.obligationStatus,
173
+ latestActivityAt,
174
+ },
175
+ issues: [],
176
+ latestActivityAt,
177
+ };
178
+ }
179
+ function readCodingSummary(agentRoot) {
180
+ const stateFilePath = path.join(agentRoot, "state", "coding", "sessions.json");
181
+ const issues = [];
182
+ if (!fs.existsSync(stateFilePath)) {
183
+ return { items: [], issues };
184
+ }
185
+ let parsed;
186
+ try {
187
+ parsed = JSON.parse(fs.readFileSync(stateFilePath, "utf-8"));
188
+ }
189
+ catch (error) {
190
+ issues.push((0, shared_1.issue)("coding-state-unreadable", `${stateFilePath}: ${error instanceof Error ? error.message : String(error)}`));
191
+ return { items: [], issues };
192
+ }
193
+ const items = Array.isArray(parsed.records)
194
+ ? parsed.records.flatMap((record) => {
195
+ const session = record?.session;
196
+ if (!session || typeof session.id !== "string" || typeof session.runner !== "string" || typeof session.status !== "string" || typeof session.workdir !== "string" || typeof session.lastActivityAt !== "string") {
197
+ return [];
198
+ }
199
+ const checkpoint = typeof session.checkpoint === "string"
200
+ ? session.checkpoint
201
+ : typeof session.stderrTail === "string" && session.stderrTail.trim().length > 0
202
+ ? session.stderrTail.trim()
203
+ : typeof session.stdoutTail === "string" && session.stdoutTail.trim().length > 0
204
+ ? session.stdoutTail.trim()
205
+ : null;
206
+ const originSession = session.originSession;
207
+ const normalizedOrigin = originSession
208
+ && typeof originSession.friendId === "string"
209
+ && typeof originSession.channel === "string"
210
+ && typeof originSession.key === "string"
211
+ ? {
212
+ friendId: originSession.friendId,
213
+ channel: originSession.channel,
214
+ key: originSession.key,
215
+ }
216
+ : null;
217
+ return [{
218
+ id: session.id,
219
+ runner: session.runner,
220
+ status: session.status,
221
+ checkpoint,
222
+ taskRef: typeof session.taskRef === "string" ? session.taskRef : null,
223
+ workdir: session.workdir,
224
+ originSession: normalizedOrigin,
225
+ lastActivityAt: session.lastActivityAt,
226
+ }];
227
+ })
228
+ : [];
229
+ return { items, issues };
230
+ }
231
+ function collectLatestActivityTimestamps(input) {
232
+ const timestamps = [];
233
+ for (const item of input.obligations)
234
+ timestamps.push(item.updatedAt);
235
+ for (const item of input.sessions)
236
+ timestamps.push(item.lastActivityAt);
237
+ for (const item of input.coding)
238
+ timestamps.push(item.lastActivityAt);
239
+ if (input.innerLatestActivityAt)
240
+ timestamps.push(input.innerLatestActivityAt);
241
+ return timestamps
242
+ .filter((value) => Number.isFinite(Date.parse(value)));
243
+ }
244
+ function summarizeFreshness(latestActivityAt, now) {
245
+ if (!latestActivityAt) {
246
+ return {
247
+ status: "unknown",
248
+ latestActivityAt: null,
249
+ ageMs: null,
250
+ };
251
+ }
252
+ const ageMs = now.getTime() - Date.parse(latestActivityAt);
253
+ return {
254
+ status: ageMs > shared_1.STALE_THRESHOLD_MS ? "stale" : "fresh",
255
+ latestActivityAt,
256
+ ageMs,
257
+ };
258
+ }
259
+ function summarizeDegraded(issues) {
260
+ return {
261
+ status: issues.length > 0 ? "degraded" : "ok",
262
+ issues,
263
+ };
264
+ }
265
+ function summarizeAgent(state) {
266
+ return {
267
+ agentName: state.agentName,
268
+ enabled: state.enabled,
269
+ freshness: state.freshness,
270
+ degraded: state.degraded,
271
+ tasks: {
272
+ liveCount: state.tasks.liveCount,
273
+ blockedCount: state.tasks.blockedCount,
274
+ },
275
+ obligations: {
276
+ openCount: state.obligations.openCount,
277
+ },
278
+ coding: {
279
+ activeCount: state.coding.activeCount,
280
+ blockedCount: state.coding.blockedCount,
281
+ },
282
+ };
283
+ }
284
+ function readOutlookAgentState(agentName, options = {}) {
285
+ const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
286
+ const now = options.now?.() ?? new Date();
287
+ const agentRoot = path.join(bundlesRoot, `${agentName}.ouro`);
288
+ const issues = [];
289
+ const config = readAgentConfig(agentRoot);
290
+ issues.push(...config.issues);
291
+ const tasks = readTaskSummary(agentRoot);
292
+ issues.push(...tasks.issues);
293
+ const obligations = readObligationSummary(agentRoot);
294
+ const sessions = readSessionSummary(agentName, agentRoot, now);
295
+ const inner = readInnerSummary(agentRoot);
296
+ issues.push(...inner.issues);
297
+ const coding = readCodingSummary(agentRoot);
298
+ issues.push(...coding.issues);
299
+ const latestActivityAt = collectLatestActivityTimestamps({
300
+ obligations: obligations.items,
301
+ sessions: sessions.items,
302
+ innerLatestActivityAt: inner.latestActivityAt,
303
+ coding: coding.items,
304
+ }).sort((left, right) => right.localeCompare(left))[0] ?? null;
305
+ return {
306
+ productName: outlook_types_1.OUTLOOK_PRODUCT_NAME,
307
+ agentName,
308
+ agentRoot,
309
+ enabled: config.summary.enabled,
310
+ provider: config.summary.provider,
311
+ senses: config.summary.senses,
312
+ freshness: summarizeFreshness(latestActivityAt, now),
313
+ degraded: summarizeDegraded(issues),
314
+ tasks: tasks.summary,
315
+ obligations: {
316
+ openCount: obligations.items.length,
317
+ items: obligations.items,
318
+ },
319
+ sessions: {
320
+ liveCount: sessions.items.length,
321
+ items: sessions.items,
322
+ },
323
+ inner: inner.summary,
324
+ coding: {
325
+ totalCount: coding.items.length,
326
+ activeCount: coding.items.filter((item) => shared_1.ACTIVE_CODING_STATUSES.has(item.status)).length,
327
+ blockedCount: coding.items.filter((item) => shared_1.BLOCKED_CODING_STATUSES.has(item.status)).length,
328
+ items: coding.items,
329
+ },
330
+ };
331
+ }
332
+ function readOutlookMachineState(options = {}) {
333
+ /* v8 ignore next */
334
+ (0, runtime_1.emitNervesEvent)({ component: "daemon", event: "daemon.outlook_read", message: "reading outlook machine state", meta: {} });
335
+ const bundlesRoot = options.bundlesRoot ?? (0, identity_1.getAgentBundlesRoot)();
336
+ const now = options.now?.() ?? new Date();
337
+ const runtime = options.runtimeMetadata ?? (0, runtime_metadata_1.getRuntimeMetadata)({ bundlesRoot });
338
+ const agentNames = options.agentNames ?? (0, agent_discovery_1.listEnabledBundleAgents)({ bundlesRoot });
339
+ const agentStates = agentNames.map((agentName) => readOutlookAgentState(agentName, { ...options, bundlesRoot, now: () => now }));
340
+ const degradedIssues = agentStates
341
+ .flatMap((state) => state.degraded.issues.map((problem) => (0, shared_1.issue)("agent-degraded", `${state.agentName}: ${problem.detail}`)));
342
+ const freshest = agentStates
343
+ .map((state) => state.freshness.latestActivityAt)
344
+ .filter((value) => typeof value === "string")
345
+ .sort((left, right) => right.localeCompare(left))[0] ?? null;
346
+ return {
347
+ productName: outlook_types_1.OUTLOOK_PRODUCT_NAME,
348
+ observedAt: now.toISOString(),
349
+ runtime,
350
+ agentCount: agentStates.length,
351
+ freshness: summarizeFreshness(freshest, now),
352
+ degraded: summarizeDegraded(degradedIssues),
353
+ agents: agentStates.map(summarizeAgent),
354
+ };
355
+ }