@ouro.bot/cli 0.1.0-alpha.50 → 0.1.0-alpha.500

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 (366) hide show
  1. package/README.md +133 -19
  2. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/agent.json +3 -2
  3. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/SOUL.md +2 -2
  4. package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-serpent.md +1 -1
  5. package/changelog.json +3176 -0
  6. package/dist/arc/attention-types.js +8 -0
  7. package/dist/arc/cares.js +140 -0
  8. package/dist/arc/episodes.js +117 -0
  9. package/dist/arc/intentions.js +133 -0
  10. package/dist/arc/json-store.js +117 -0
  11. package/dist/arc/obligations.js +237 -0
  12. package/dist/arc/packets.js +193 -0
  13. package/dist/arc/presence.js +185 -0
  14. package/dist/arc/task-lifecycle.js +65 -0
  15. package/dist/heart/active-work.js +867 -35
  16. package/dist/heart/agent-entry.js +58 -3
  17. package/dist/heart/attachments/image-normalize.js +194 -0
  18. package/dist/heart/attachments/materialize.js +97 -0
  19. package/dist/heart/attachments/originals.js +88 -0
  20. package/dist/heart/attachments/render.js +29 -0
  21. package/dist/heart/attachments/sources/adapter.js +2 -0
  22. package/dist/heart/attachments/sources/bluebubbles.js +156 -0
  23. package/dist/heart/attachments/sources/cli-local-file.js +78 -0
  24. package/dist/heart/attachments/sources/index.js +16 -0
  25. package/dist/heart/attachments/store.js +103 -0
  26. package/dist/heart/attachments/types.js +93 -0
  27. package/dist/heart/auth/auth-flow.js +426 -0
  28. package/dist/heart/background-operations.js +281 -0
  29. package/dist/heart/bundle-state.js +168 -0
  30. package/dist/heart/commitments.js +111 -0
  31. package/dist/heart/config-registry.js +304 -0
  32. package/dist/heart/config.js +119 -129
  33. package/dist/heart/core.js +898 -244
  34. package/dist/heart/cross-chat-delivery.js +131 -0
  35. package/dist/heart/daemon/agent-config-check.js +490 -0
  36. package/dist/heart/daemon/agent-discovery.js +79 -3
  37. package/dist/heart/daemon/agent-service.js +360 -0
  38. package/dist/heart/daemon/agentic-repair.js +216 -0
  39. package/dist/heart/daemon/bluebubbles-health-diagnostics.js +122 -0
  40. package/dist/heart/daemon/cadence.js +70 -0
  41. package/dist/heart/daemon/cli-defaults.js +640 -0
  42. package/dist/heart/daemon/cli-exec.js +7239 -0
  43. package/dist/heart/daemon/cli-help.js +493 -0
  44. package/dist/heart/daemon/cli-parse.js +1533 -0
  45. package/dist/heart/daemon/cli-render-doctor.js +57 -0
  46. package/dist/heart/daemon/cli-render.js +561 -0
  47. package/dist/heart/daemon/cli-types.js +8 -0
  48. package/dist/heart/daemon/connect-bay.js +323 -0
  49. package/dist/heart/daemon/daemon-cli.js +29 -1631
  50. package/dist/heart/daemon/daemon-entry.js +345 -3
  51. package/dist/heart/daemon/daemon-health.js +141 -0
  52. package/dist/heart/daemon/daemon-runtime-sync.js +190 -12
  53. package/dist/heart/daemon/daemon-tombstone.js +236 -0
  54. package/dist/heart/daemon/daemon.js +677 -58
  55. package/dist/heart/daemon/dns-workflow.js +394 -0
  56. package/dist/heart/daemon/doctor-types.js +8 -0
  57. package/dist/heart/daemon/doctor.js +615 -0
  58. package/dist/heart/daemon/health-monitor.js +92 -1
  59. package/dist/heart/daemon/hooks/agent-config-v2.js +33 -0
  60. package/dist/heart/daemon/hooks/bundle-meta.js +115 -1
  61. package/dist/heart/daemon/http-health-probe.js +80 -0
  62. package/dist/heart/daemon/human-command-screens.js +234 -0
  63. package/dist/heart/daemon/human-readiness.js +114 -0
  64. package/dist/heart/daemon/inner-status.js +89 -0
  65. package/dist/heart/daemon/interactive-repair.js +394 -0
  66. package/dist/heart/daemon/launchd.js +25 -5
  67. package/dist/heart/daemon/log-tailer.js +82 -12
  68. package/dist/heart/daemon/logs-prune.js +110 -0
  69. package/dist/heart/daemon/message-router.js +2 -2
  70. package/dist/heart/daemon/os-cron-deps.js +134 -0
  71. package/dist/heart/daemon/ouro-bot-entry.js +4 -2
  72. package/dist/heart/daemon/ouro-entry.js +3 -1
  73. package/dist/heart/daemon/process-manager.js +214 -0
  74. package/dist/heart/daemon/provider-discovery.js +137 -0
  75. package/dist/heart/daemon/provider-ping-progress.js +83 -0
  76. package/dist/heart/daemon/pulse.js +475 -0
  77. package/dist/heart/daemon/readiness-repair.js +365 -0
  78. package/dist/heart/daemon/run-hooks.js +2 -0
  79. package/dist/heart/daemon/runtime-logging.js +67 -16
  80. package/dist/heart/daemon/runtime-metadata.js +73 -0
  81. package/dist/heart/daemon/runtime-mode.js +67 -0
  82. package/dist/heart/daemon/safe-mode.js +161 -0
  83. package/dist/heart/daemon/sense-manager.js +178 -37
  84. package/dist/heart/daemon/session-id-resolver.js +131 -0
  85. package/dist/heart/daemon/skill-management-installer.js +94 -0
  86. package/dist/heart/daemon/socket-client.js +109 -4
  87. package/dist/heart/daemon/stale-bundle-prune.js +96 -0
  88. package/dist/heart/daemon/startup-tui.js +264 -0
  89. package/dist/heart/daemon/task-scheduler.js +3 -25
  90. package/dist/heart/daemon/terminal-ui.js +499 -0
  91. package/dist/heart/daemon/thoughts.js +162 -17
  92. package/dist/heart/daemon/up-progress.js +366 -0
  93. package/dist/heart/daemon/vault-items.js +56 -0
  94. package/dist/heart/delegation.js +1 -1
  95. package/dist/heart/habits/habit-migration.js +189 -0
  96. package/dist/heart/habits/habit-parser.js +140 -0
  97. package/dist/heart/habits/habit-runtime-state.js +100 -0
  98. package/dist/heart/habits/habit-scheduler.js +372 -0
  99. package/dist/heart/{daemon → hatch}/hatch-flow.js +52 -117
  100. package/dist/heart/{daemon → hatch}/hatch-specialist.js +3 -3
  101. package/dist/heart/{daemon → hatch}/specialist-prompt.js +12 -9
  102. package/dist/heart/{daemon → hatch}/specialist-tools.js +35 -12
  103. package/dist/heart/identity.js +201 -66
  104. package/dist/heart/kept-notes.js +357 -0
  105. package/dist/heart/kicks.js +1 -1
  106. package/dist/heart/machine-identity.js +161 -0
  107. package/dist/heart/mail-import-discovery.js +353 -0
  108. package/dist/heart/mcp/mcp-server.js +653 -0
  109. package/dist/heart/migrate-config.js +100 -0
  110. package/dist/heart/model-capabilities.js +59 -0
  111. package/dist/heart/outlook/outlook-http-hooks.js +66 -0
  112. package/dist/heart/outlook/outlook-http-response.js +7 -0
  113. package/dist/heart/outlook/outlook-http-routes.js +244 -0
  114. package/dist/heart/outlook/outlook-http-static.js +103 -0
  115. package/dist/heart/outlook/outlook-http-transport.js +116 -0
  116. package/dist/heart/outlook/outlook-http.js +99 -0
  117. package/dist/heart/outlook/outlook-read.js +31 -0
  118. package/dist/heart/outlook/outlook-types.js +27 -0
  119. package/dist/heart/outlook/outlook-view.js +195 -0
  120. package/dist/heart/outlook/readers/agent-machine.js +382 -0
  121. package/dist/heart/outlook/readers/continuity-readers.js +336 -0
  122. package/dist/heart/outlook/readers/mail.js +362 -0
  123. package/dist/heart/outlook/readers/runtime-readers.js +644 -0
  124. package/dist/heart/outlook/readers/sessions.js +232 -0
  125. package/dist/heart/outlook/readers/shared.js +111 -0
  126. package/dist/heart/platform.js +81 -0
  127. package/dist/heart/provider-attempt.js +134 -0
  128. package/dist/heart/provider-binding-resolver.js +255 -0
  129. package/dist/heart/provider-credentials.js +424 -0
  130. package/dist/heart/provider-failover.js +301 -0
  131. package/dist/heart/provider-models.js +81 -0
  132. package/dist/heart/provider-ping.js +262 -0
  133. package/dist/heart/provider-state.js +216 -0
  134. package/dist/heart/provider-visibility.js +188 -0
  135. package/dist/heart/providers/anthropic-token.js +131 -0
  136. package/dist/heart/providers/anthropic.js +193 -55
  137. package/dist/heart/providers/azure.js +104 -13
  138. package/dist/heart/providers/error-classification.js +63 -0
  139. package/dist/heart/providers/github-copilot.js +145 -0
  140. package/dist/heart/providers/minimax-vlm.js +189 -0
  141. package/dist/heart/providers/minimax.js +29 -7
  142. package/dist/heart/providers/openai-codex.js +63 -39
  143. package/dist/heart/runtime-capability-check.js +170 -0
  144. package/dist/heart/runtime-credentials.js +260 -0
  145. package/dist/heart/sense-truth.js +11 -4
  146. package/dist/heart/session-activity.js +43 -22
  147. package/dist/heart/session-events.js +1089 -0
  148. package/dist/heart/session-playback-cli-main.js +5 -0
  149. package/dist/heart/session-playback-cli.js +36 -0
  150. package/dist/heart/session-playback.js +231 -0
  151. package/dist/heart/session-transcript.js +167 -0
  152. package/dist/heart/start-of-turn-packet.js +345 -0
  153. package/dist/heart/streaming.js +48 -28
  154. package/dist/heart/sync.js +332 -0
  155. package/dist/heart/target-resolution.js +127 -0
  156. package/dist/heart/tempo.js +93 -0
  157. package/dist/heart/temporal-view.js +41 -0
  158. package/dist/heart/tool-activity-callbacks.js +36 -0
  159. package/dist/heart/tool-description.js +135 -0
  160. package/dist/heart/tool-friction.js +55 -0
  161. package/dist/heart/tool-loop.js +200 -0
  162. package/dist/heart/turn-context.js +372 -0
  163. package/dist/heart/{daemon → versioning}/ouro-bot-global-installer.js +1 -1
  164. package/dist/heart/{daemon → versioning}/ouro-bot-wrapper.js +1 -1
  165. package/dist/heart/versioning/ouro-path-installer.js +425 -0
  166. package/dist/heart/versioning/ouro-version-manager.js +295 -0
  167. package/dist/heart/{daemon → versioning}/staged-restart.js +40 -8
  168. package/dist/heart/{daemon → versioning}/update-checker.js +5 -1
  169. package/dist/heart/{daemon → versioning}/update-hooks.js +63 -59
  170. package/dist/mailroom/attention.js +167 -0
  171. package/dist/mailroom/autonomy.js +209 -0
  172. package/dist/mailroom/blob-store.js +606 -0
  173. package/dist/mailroom/core.js +672 -0
  174. package/dist/mailroom/entry.js +160 -0
  175. package/dist/mailroom/file-store.js +426 -0
  176. package/dist/mailroom/mbox-import.js +382 -0
  177. package/dist/mailroom/outbound.js +380 -0
  178. package/dist/mailroom/policy.js +263 -0
  179. package/dist/mailroom/reader.js +219 -0
  180. package/dist/mailroom/search-cache.js +182 -0
  181. package/dist/mailroom/search-relevance.js +319 -0
  182. package/dist/mailroom/smtp-ingress.js +176 -0
  183. package/dist/mailroom/source-state.js +176 -0
  184. package/dist/mailroom/thread.js +109 -0
  185. package/dist/mailroom/travel-extract.js +89 -0
  186. package/dist/mind/bundle-manifest.js +7 -1
  187. package/dist/mind/context.js +164 -101
  188. package/dist/mind/diary-integrity.js +60 -0
  189. package/dist/mind/{memory.js → diary.js} +74 -93
  190. package/dist/mind/embedding-provider.js +60 -0
  191. package/dist/mind/file-state.js +179 -0
  192. package/dist/mind/friends/channel.js +30 -0
  193. package/dist/mind/friends/group-context.js +144 -0
  194. package/dist/mind/friends/resolver.js +54 -2
  195. package/dist/mind/friends/store-file.js +39 -3
  196. package/dist/mind/friends/trust-explanation.js +74 -0
  197. package/dist/mind/friends/types.js +2 -2
  198. package/dist/mind/journal-index.js +161 -0
  199. package/dist/mind/note-search.js +268 -0
  200. package/dist/mind/obligation-steering.js +221 -0
  201. package/dist/mind/pending.js +4 -0
  202. package/dist/mind/prompt-refresh.js +3 -2
  203. package/dist/mind/prompt.js +948 -110
  204. package/dist/mind/provenance-trust.js +26 -0
  205. package/dist/mind/scrutiny.js +173 -0
  206. package/dist/nerves/cli-logging.js +7 -1
  207. package/dist/nerves/coverage/audit-rules.js +15 -6
  208. package/dist/nerves/coverage/audit.js +28 -2
  209. package/dist/nerves/coverage/cli.js +1 -1
  210. package/dist/nerves/coverage/contract.js +5 -5
  211. package/dist/nerves/coverage/file-completeness.js +101 -5
  212. package/dist/nerves/coverage/run-artifacts.js +1 -1
  213. package/dist/nerves/event-buffer.js +111 -0
  214. package/dist/nerves/index.js +224 -4
  215. package/dist/nerves/observation.js +20 -0
  216. package/dist/nerves/redact.js +79 -0
  217. package/dist/nerves/runtime.js +5 -1
  218. package/dist/outlook-ui/assets/index-BPr5vNuM.css +1 -0
  219. package/dist/outlook-ui/assets/index-Cm51CY9W.js +61 -0
  220. package/dist/outlook-ui/index.html +15 -0
  221. package/dist/repertoire/ado-client.js +15 -56
  222. package/dist/repertoire/ado-semantic.js +11 -10
  223. package/dist/repertoire/api-client.js +97 -0
  224. package/dist/repertoire/bitwarden-store.js +774 -0
  225. package/dist/repertoire/bundle-templates.js +72 -0
  226. package/dist/repertoire/bw-installer.js +180 -0
  227. package/dist/repertoire/coding/codex-jsonl.js +64 -0
  228. package/dist/repertoire/coding/context-pack.js +330 -0
  229. package/dist/repertoire/coding/feedback.js +197 -30
  230. package/dist/repertoire/coding/manager.js +158 -9
  231. package/dist/repertoire/coding/spawner.js +55 -9
  232. package/dist/repertoire/coding/tools.js +170 -7
  233. package/dist/repertoire/commerce-errors.js +109 -0
  234. package/dist/repertoire/commerce-self-test.js +156 -0
  235. package/dist/repertoire/credential-access.js +111 -0
  236. package/dist/repertoire/duffel-client.js +185 -0
  237. package/dist/repertoire/github-client.js +14 -55
  238. package/dist/repertoire/graph-client.js +11 -52
  239. package/dist/repertoire/guardrails.js +396 -0
  240. package/dist/repertoire/mcp-client.js +255 -0
  241. package/dist/repertoire/mcp-manager.js +305 -0
  242. package/dist/repertoire/mcp-tools.js +63 -0
  243. package/dist/repertoire/shell-sessions.js +133 -0
  244. package/dist/repertoire/skills.js +15 -24
  245. package/dist/repertoire/stripe-client.js +131 -0
  246. package/dist/repertoire/tasks/board.js +31 -5
  247. package/dist/repertoire/tasks/fix.js +182 -0
  248. package/dist/repertoire/tasks/index.js +16 -4
  249. package/dist/repertoire/tasks/lifecycle.js +2 -2
  250. package/dist/repertoire/tasks/parser.js +3 -2
  251. package/dist/repertoire/tasks/scanner.js +194 -37
  252. package/dist/repertoire/tasks/transitions.js +16 -78
  253. package/dist/repertoire/tool-results.js +29 -0
  254. package/dist/repertoire/tools-attachments.js +317 -0
  255. package/dist/repertoire/tools-base.js +46 -921
  256. package/dist/repertoire/tools-bluebubbles.js +1 -0
  257. package/dist/repertoire/tools-bridge.js +141 -0
  258. package/dist/repertoire/tools-bundle.js +984 -0
  259. package/dist/repertoire/tools-config.js +185 -0
  260. package/dist/repertoire/tools-continuity.js +248 -0
  261. package/dist/repertoire/tools-credential.js +381 -0
  262. package/dist/repertoire/tools-files.js +342 -0
  263. package/dist/repertoire/tools-flight.js +224 -0
  264. package/dist/repertoire/tools-flow.js +105 -0
  265. package/dist/repertoire/tools-github.js +1 -7
  266. package/dist/repertoire/tools-mail.js +1377 -0
  267. package/dist/repertoire/tools-notes.js +376 -0
  268. package/dist/repertoire/tools-session.js +749 -0
  269. package/dist/repertoire/tools-shell.js +120 -0
  270. package/dist/repertoire/tools-stripe.js +180 -0
  271. package/dist/repertoire/tools-surface.js +243 -0
  272. package/dist/repertoire/tools-teams.js +9 -39
  273. package/dist/repertoire/tools-travel.js +125 -0
  274. package/dist/repertoire/tools-trip.js +356 -0
  275. package/dist/repertoire/tools-user-profile.js +144 -0
  276. package/dist/repertoire/tools-vault.js +40 -0
  277. package/dist/repertoire/tools.js +144 -115
  278. package/dist/repertoire/travel-api-client.js +360 -0
  279. package/dist/repertoire/user-profile.js +131 -0
  280. package/dist/repertoire/vault-setup.js +246 -0
  281. package/dist/repertoire/vault-unlock.js +561 -0
  282. package/dist/scripts/claude-code-hook.js +41 -0
  283. package/dist/scripts/claude-code-stop-hook.js +47 -0
  284. package/dist/senses/attention-queue.js +116 -0
  285. package/dist/senses/bluebubbles/attachment-cache.js +53 -0
  286. package/dist/senses/bluebubbles/attachment-download.js +137 -0
  287. package/dist/senses/{bluebubbles-client.js → bluebubbles/client.js} +219 -18
  288. package/dist/senses/bluebubbles/entry.js +73 -0
  289. package/dist/senses/{bluebubbles-inbound-log.js → bluebubbles/inbound-log.js} +20 -3
  290. package/dist/senses/bluebubbles/index.js +1881 -0
  291. package/dist/senses/{bluebubbles-media.js → bluebubbles/media.js} +121 -70
  292. package/dist/senses/{bluebubbles-model.js → bluebubbles/model.js} +33 -12
  293. package/dist/senses/{bluebubbles-mutation-log.js → bluebubbles/mutation-log.js} +3 -3
  294. package/dist/senses/bluebubbles/processed-log.js +111 -0
  295. package/dist/senses/bluebubbles/replay.js +129 -0
  296. package/dist/senses/{bluebubbles-runtime-state.js → bluebubbles/runtime-state.js} +2 -2
  297. package/dist/senses/{bluebubbles-session-cleanup.js → bluebubbles/session-cleanup.js} +1 -1
  298. package/dist/senses/cli/bracketed-paste.js +82 -0
  299. package/dist/senses/cli/image-paste.js +287 -0
  300. package/dist/senses/cli/image-ref-navigation.js +75 -0
  301. package/dist/senses/cli/ink-app.js +156 -0
  302. package/dist/senses/cli/inline-diff.js +64 -0
  303. package/dist/senses/cli/input-keys.js +174 -0
  304. package/dist/senses/cli/kill-ring.js +86 -0
  305. package/dist/senses/cli/message-list.js +51 -0
  306. package/dist/senses/cli/ouro-tui.js +605 -0
  307. package/dist/senses/cli/spinner-imperative.js +135 -0
  308. package/dist/senses/cli/spinner.js +101 -0
  309. package/dist/senses/cli/status-line.js +60 -0
  310. package/dist/senses/cli/streaming-markdown.js +526 -0
  311. package/dist/senses/cli/tool-display.js +83 -0
  312. package/dist/senses/cli/tool-render.js +85 -0
  313. package/dist/senses/cli/tui-store.js +240 -0
  314. package/dist/senses/cli/virtual-list.js +35 -0
  315. package/dist/senses/cli-entry.js +60 -8
  316. package/dist/senses/cli-layout.js +187 -0
  317. package/dist/senses/cli.js +511 -209
  318. package/dist/senses/commands.js +66 -3
  319. package/dist/senses/habit-turn-message.js +108 -0
  320. package/dist/senses/inner-dialog-worker.js +175 -21
  321. package/dist/senses/inner-dialog.js +330 -27
  322. package/dist/senses/mail-entry.js +66 -0
  323. package/dist/senses/mail.js +379 -0
  324. package/dist/senses/pipeline.js +573 -164
  325. package/dist/senses/proactive-content-guard.js +51 -0
  326. package/dist/senses/shared-turn.js +248 -0
  327. package/dist/senses/surface-tool.js +68 -0
  328. package/dist/senses/teams-entry.js +60 -8
  329. package/dist/senses/teams.js +405 -170
  330. package/dist/senses/trust-gate.js +100 -5
  331. package/dist/trips/core.js +138 -0
  332. package/dist/trips/store.js +146 -0
  333. package/package.json +37 -7
  334. package/skills/agent-commerce.md +106 -0
  335. package/skills/browser-navigation.md +117 -0
  336. package/skills/commerce-setup-guide.md +116 -0
  337. package/skills/commerce-setup.md +84 -0
  338. package/skills/configure-dev-tools.md +101 -0
  339. package/skills/travel-planning.md +138 -0
  340. package/dist/heart/daemon/ouro-path-installer.js +0 -178
  341. package/dist/heart/daemon/subagent-installer.js +0 -166
  342. package/dist/heart/session-recall.js +0 -116
  343. package/dist/mind/associative-recall.js +0 -209
  344. package/dist/senses/bluebubbles-entry.js +0 -13
  345. package/dist/senses/bluebubbles.js +0 -1142
  346. package/dist/senses/debug-activity.js +0 -148
  347. package/subagents/README.md +0 -86
  348. package/subagents/work-doer.md +0 -237
  349. package/subagents/work-merger.md +0 -618
  350. package/subagents/work-planner.md +0 -390
  351. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/basilisk.md +0 -0
  352. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jafar.md +0 -0
  353. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/jormungandr.md +0 -0
  354. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/kaa.md +0 -0
  355. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/medusa.md +0 -0
  356. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/monty.md +0 -0
  357. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/nagini.md +0 -0
  358. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/ouroboros.md +0 -0
  359. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/python.md +0 -0
  360. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/quetzalcoatl.md +0 -0
  361. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/sir-hiss.md +0 -0
  362. /package/{AdoptionSpecialist.ouro → SerpentGuide.ouro}/psyche/identities/the-snake.md +0 -0
  363. /package/dist/heart/{daemon → hatch}/hatch-animation.js +0 -0
  364. /package/dist/heart/{daemon → hatch}/specialist-orchestrator.js +0 -0
  365. /package/dist/heart/{daemon → versioning}/ouro-uti.js +0 -0
  366. /package/dist/heart/{daemon → versioning}/wrapper-publish-guard.js +0 -0
@@ -1,931 +1,56 @@
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
- })();
35
2
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.finalAnswerTool = exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = void 0;
37
- const fs = __importStar(require("fs"));
38
- const fg = __importStar(require("fast-glob"));
39
- const child_process_1 = require("child_process");
40
- const path = __importStar(require("path"));
41
- const skills_1 = require("./skills");
42
- const config_1 = require("../heart/config");
43
- const runtime_1 = require("../nerves/runtime");
44
- const identity_1 = require("../heart/identity");
45
- const socket_client_1 = require("../heart/daemon/socket-client");
46
- const thoughts_1 = require("../heart/daemon/thoughts");
47
- const manager_1 = require("../heart/bridges/manager");
48
- const session_recall_1 = require("../heart/session-recall");
3
+ exports.tools = exports.baseToolDefinitions = exports.editFileReadTracker = exports.renderInnerProgressStatus = exports.restTool = exports.settleTool = exports.observeTool = exports.ponderTool = void 0;
4
+ const tools_files_1 = require("./tools-files");
5
+ const tools_shell_1 = require("./tools-shell");
6
+ const tools_notes_1 = require("./tools-notes");
7
+ const tools_bridge_1 = require("./tools-bridge");
8
+ const tools_session_1 = require("./tools-session");
9
+ const tools_continuity_1 = require("./tools-continuity");
10
+ const tools_config_1 = require("./tools-config");
49
11
  const tools_1 = require("./coding/tools");
50
- const memory_1 = require("../mind/memory");
51
- const pending_1 = require("../mind/pending");
52
- const progress_story_1 = require("../heart/progress-story");
12
+ const tools_credential_1 = require("./tools-credential");
13
+ const tools_vault_1 = require("./tools-vault");
14
+ const tools_travel_1 = require("./tools-travel");
15
+ const tools_user_profile_1 = require("./tools-user-profile");
16
+ const tools_stripe_1 = require("./tools-stripe");
17
+ const tools_flight_1 = require("./tools-flight");
18
+ const tools_attachments_1 = require("./tools-attachments");
19
+ const tools_mail_1 = require("./tools-mail");
20
+ const tools_trip_1 = require("./tools-trip");
21
+ // Re-export flow tools for consumers that import them from tools-base
22
+ var tools_flow_1 = require("./tools-flow");
23
+ Object.defineProperty(exports, "ponderTool", { enumerable: true, get: function () { return tools_flow_1.ponderTool; } });
24
+ Object.defineProperty(exports, "observeTool", { enumerable: true, get: function () { return tools_flow_1.observeTool; } });
25
+ Object.defineProperty(exports, "settleTool", { enumerable: true, get: function () { return tools_flow_1.settleTool; } });
26
+ Object.defineProperty(exports, "restTool", { enumerable: true, get: function () { return tools_flow_1.restTool; } });
27
+ // Re-export renderInnerProgressStatus for consumers
28
+ var tools_session_2 = require("./tools-session");
29
+ Object.defineProperty(exports, "renderInnerProgressStatus", { enumerable: true, get: function () { return tools_session_2.renderInnerProgressStatus; } });
53
30
  // Tracks which file paths have been read via read_file in this session.
54
31
  // edit_file requires a file to be read first (must-read-first guard).
55
32
  exports.editFileReadTracker = new Set();
56
- function buildContextDiff(lines, changeStart, changeEnd, contextSize = 3) {
57
- const start = Math.max(0, changeStart - contextSize);
58
- const end = Math.min(lines.length, changeEnd + contextSize);
59
- const result = [];
60
- for (let i = start; i < end; i++) {
61
- const lineNum = i + 1;
62
- const prefix = (i >= changeStart && i < changeEnd) ? ">" : " ";
63
- result.push(`${prefix} ${lineNum} | ${lines[i]}`);
64
- }
65
- return result.join("\n");
66
- }
67
- const NO_SESSION_FOUND_MESSAGE = "no session found for that friend/channel/key combination.";
68
- const EMPTY_SESSION_MESSAGE = "session exists but has no non-system messages.";
69
- function findDelegatingBridgeId(ctx) {
70
- const currentSession = ctx?.currentSession;
71
- if (!currentSession)
72
- return undefined;
73
- return ctx?.activeBridges?.find((bridge) => bridge.lifecycle === "active"
74
- && bridge.attachedSessions.some((session) => session.friendId === currentSession.friendId
75
- && session.channel === currentSession.channel
76
- && session.key === currentSession.key))?.id;
77
- }
78
- async function recallSessionSafely(options) {
79
- try {
80
- return await (0, session_recall_1.recallSession)(options);
81
- }
82
- catch (error) {
83
- if (options.summarize) {
84
- (0, runtime_1.emitNervesEvent)({
85
- component: "daemon",
86
- event: "daemon.session_recall_summary_fallback",
87
- message: "session recall summarization failed; using raw transcript",
88
- meta: {
89
- friendId: options.friendId,
90
- channel: options.channel,
91
- key: options.key,
92
- error: error instanceof Error ? error.message : String(error),
93
- },
94
- });
95
- try {
96
- return await (0, session_recall_1.recallSession)({
97
- ...options,
98
- summarize: undefined,
99
- });
100
- }
101
- catch {
102
- return { kind: "missing" };
103
- }
104
- }
105
- return { kind: "missing" };
106
- }
107
- }
108
- function normalizeProgressOutcome(text) {
109
- const trimmed = text.trim();
110
- if (!trimmed || trimmed === "nothing yet" || trimmed === "nothing recent") {
111
- return null;
112
- }
113
- if (trimmed.startsWith("\"") && trimmed.endsWith("\"") && trimmed.length >= 2) {
114
- return trimmed.slice(1, -1);
115
- }
116
- return trimmed;
117
- }
118
- function renderInnerProgressStatus(status) {
119
- if (status.processing === "pending") {
120
- return (0, progress_story_1.renderProgressStory)((0, progress_story_1.buildProgressStory)({
121
- scope: "inner-delegation",
122
- phase: "queued",
123
- objective: status.queue,
124
- outcomeText: `wake: ${status.wake}`,
125
- }));
126
- }
127
- if (status.processing === "started") {
128
- return (0, progress_story_1.renderProgressStory)((0, progress_story_1.buildProgressStory)({
129
- scope: "inner-delegation",
130
- phase: "processing",
131
- outcomeText: `wake: ${status.wake}`,
132
- }));
133
- }
134
- const completedOutcome = normalizeProgressOutcome(status.surfaced) ?? status.surfaced;
135
- return (0, progress_story_1.renderProgressStory)((0, progress_story_1.buildProgressStory)({
136
- scope: "inner-delegation",
137
- phase: "completed",
138
- objective: null,
139
- outcomeText: completedOutcome,
140
- }));
141
- }
33
+ // Combined base tool definitions assembled from category modules.
34
+ // Order preserved: files, shell, notes, bridge, session, continuity, config, coding.
142
35
  exports.baseToolDefinitions = [
143
- {
144
- tool: {
145
- type: "function",
146
- function: {
147
- name: "read_file",
148
- description: "read file contents",
149
- parameters: {
150
- type: "object",
151
- properties: {
152
- path: { type: "string" },
153
- offset: { type: "number", description: "1-based line number to start reading from" },
154
- limit: { type: "number", description: "maximum number of lines to return" },
155
- },
156
- required: ["path"],
157
- },
158
- },
159
- },
160
- handler: (a) => {
161
- const content = fs.readFileSync(a.path, "utf-8");
162
- exports.editFileReadTracker.add(a.path);
163
- const offset = a.offset ? parseInt(a.offset, 10) : undefined;
164
- const limit = a.limit ? parseInt(a.limit, 10) : undefined;
165
- if (offset === undefined && limit === undefined)
166
- return content;
167
- const lines = content.split("\n");
168
- const start = offset ? offset - 1 : 0;
169
- const end = limit !== undefined ? start + limit : lines.length;
170
- return lines.slice(start, end).join("\n");
171
- },
172
- },
173
- {
174
- tool: {
175
- type: "function",
176
- function: {
177
- name: "write_file",
178
- description: "write content to file",
179
- parameters: {
180
- type: "object",
181
- properties: { path: { type: "string" }, content: { type: "string" } },
182
- required: ["path", "content"],
183
- },
184
- },
185
- },
186
- handler: (a) => {
187
- fs.mkdirSync(path.dirname(a.path), { recursive: true });
188
- fs.writeFileSync(a.path, a.content, "utf-8");
189
- return "ok";
190
- },
191
- },
192
- {
193
- tool: {
194
- type: "function",
195
- function: {
196
- name: "edit_file",
197
- description: "surgically edit a file by replacing an exact string. the file must have been read via read_file first. old_string must match exactly one location in the file.",
198
- parameters: {
199
- type: "object",
200
- properties: {
201
- path: { type: "string" },
202
- old_string: { type: "string" },
203
- new_string: { type: "string" },
204
- },
205
- required: ["path", "old_string", "new_string"],
206
- },
207
- },
208
- },
209
- handler: (a) => {
210
- if (!exports.editFileReadTracker.has(a.path)) {
211
- return `error: you must read the file with read_file before editing it. call read_file on ${a.path} first.`;
212
- }
213
- let content;
214
- try {
215
- content = fs.readFileSync(a.path, "utf-8");
216
- }
217
- catch (e) {
218
- return `error: could not read file: ${e instanceof Error ? e.message : /* v8 ignore next -- defensive: non-Error catch branch @preserve */ String(e)}`;
219
- }
220
- // Count occurrences
221
- const occurrences = [];
222
- let searchFrom = 0;
223
- while (true) {
224
- const idx = content.indexOf(a.old_string, searchFrom);
225
- if (idx === -1)
226
- break;
227
- occurrences.push(idx);
228
- searchFrom = idx + 1;
229
- }
230
- if (occurrences.length === 0) {
231
- return `error: old_string not found in ${a.path}`;
232
- }
233
- if (occurrences.length > 1) {
234
- return `error: old_string is ambiguous -- found ${occurrences.length} matches in ${a.path}. provide more context to make the match unique.`;
235
- }
236
- // Single unique match -- replace
237
- const idx = occurrences[0];
238
- const updated = content.slice(0, idx) + a.new_string + content.slice(idx + a.old_string.length);
239
- fs.writeFileSync(a.path, updated, "utf-8");
240
- // Build contextual diff
241
- const lines = updated.split("\n");
242
- const prefixLines = content.slice(0, idx).split("\n");
243
- const changeStartLine = prefixLines.length - 1;
244
- const newStringLines = a.new_string.split("\n");
245
- const changeEndLine = changeStartLine + newStringLines.length;
246
- return buildContextDiff(lines, changeStartLine, changeEndLine);
247
- },
248
- },
249
- {
250
- tool: {
251
- type: "function",
252
- function: {
253
- name: "glob",
254
- description: "find files matching a glob pattern. returns matching paths sorted alphabetically, one per line.",
255
- parameters: {
256
- type: "object",
257
- properties: {
258
- pattern: { type: "string", description: "glob pattern (e.g. **/*.ts)" },
259
- cwd: { type: "string", description: "directory to search from (defaults to process.cwd())" },
260
- },
261
- required: ["pattern"],
262
- },
263
- },
264
- },
265
- handler: (a) => {
266
- const cwd = a.cwd || process.cwd();
267
- const matches = fg.globSync(a.pattern, { cwd, dot: true });
268
- return matches.sort().join("\n");
269
- },
270
- },
271
- {
272
- tool: {
273
- type: "function",
274
- function: {
275
- name: "grep",
276
- description: "search file contents for lines matching a regex pattern. searches recursively when given a directory. returns matching lines with file path and line numbers.",
277
- parameters: {
278
- type: "object",
279
- properties: {
280
- pattern: { type: "string", description: "regex pattern to search for" },
281
- path: { type: "string", description: "file or directory to search" },
282
- context_lines: { type: "number", description: "number of surrounding context lines (default 0)" },
283
- include: { type: "string", description: "glob filter to limit searched files (e.g. *.ts)" },
284
- },
285
- required: ["pattern", "path"],
286
- },
287
- },
288
- },
289
- handler: (a) => {
290
- const targetPath = a.path;
291
- const regex = new RegExp(a.pattern);
292
- const contextLines = parseInt(a.context_lines || "0", 10);
293
- const includeGlob = a.include || undefined;
294
- function searchFile(filePath) {
295
- let content;
296
- try {
297
- content = fs.readFileSync(filePath, "utf-8");
298
- }
299
- catch {
300
- return [];
301
- }
302
- const lines = content.split("\n");
303
- const matchIndices = new Set();
304
- for (let i = 0; i < lines.length; i++) {
305
- if (regex.test(lines[i])) {
306
- matchIndices.add(i);
307
- }
308
- }
309
- if (matchIndices.size === 0)
310
- return [];
311
- const outputIndices = new Set();
312
- for (const idx of matchIndices) {
313
- const start = Math.max(0, idx - contextLines);
314
- const end = Math.min(lines.length - 1, idx + contextLines);
315
- for (let i = start; i <= end; i++) {
316
- outputIndices.add(i);
317
- }
318
- }
319
- const sortedIndices = [...outputIndices].sort((a, b) => a - b);
320
- const results = [];
321
- for (const idx of sortedIndices) {
322
- const lineNum = idx + 1;
323
- if (matchIndices.has(idx)) {
324
- results.push(`${filePath}:${lineNum}: ${lines[idx]}`);
325
- }
326
- else {
327
- results.push(`-${filePath}:${lineNum}: ${lines[idx]}`);
328
- }
329
- }
330
- return results;
331
- }
332
- function collectFiles(dirPath) {
333
- const files = [];
334
- function walk(dir) {
335
- let entries;
336
- try {
337
- entries = fs.readdirSync(dir, { withFileTypes: true });
338
- }
339
- catch {
340
- return;
341
- }
342
- for (const entry of entries) {
343
- const fullPath = path.join(dir, entry.name);
344
- if (entry.isDirectory()) {
345
- walk(fullPath);
346
- }
347
- else if (entry.isFile()) {
348
- files.push(fullPath);
349
- }
350
- }
351
- }
352
- walk(dirPath);
353
- return files.sort();
354
- }
355
- function matchesGlob(filePath, glob) {
356
- const escaped = glob
357
- .replace(/[.+^${}()|[\]\\]/g, "\\$&")
358
- .replace(/\*/g, ".*")
359
- .replace(/\?/g, ".");
360
- return new RegExp(`(^|/)${escaped}$`).test(filePath);
361
- }
362
- const stat = fs.statSync(targetPath, { throwIfNoEntry: false });
363
- if (!stat)
364
- return "";
365
- if (stat.isFile()) {
366
- return searchFile(targetPath).join("\n");
367
- }
368
- let files = collectFiles(targetPath);
369
- if (includeGlob) {
370
- files = files.filter((f) => matchesGlob(f, includeGlob));
371
- }
372
- const allResults = [];
373
- for (const file of files) {
374
- allResults.push(...searchFile(file));
375
- }
376
- return allResults.join("\n");
377
- },
378
- },
379
- {
380
- tool: {
381
- type: "function",
382
- function: {
383
- name: "shell",
384
- description: "run shell command",
385
- parameters: {
386
- type: "object",
387
- properties: { command: { type: "string" } },
388
- required: ["command"],
389
- },
390
- },
391
- },
392
- handler: (a) => (0, child_process_1.execSync)(a.command, { encoding: "utf-8", timeout: 30000 }),
393
- },
394
- {
395
- tool: {
396
- type: "function",
397
- function: {
398
- name: "list_skills",
399
- description: "list all available skills",
400
- parameters: { type: "object", properties: {} },
401
- },
402
- },
403
- handler: () => JSON.stringify((0, skills_1.listSkills)()),
404
- },
405
- {
406
- tool: {
407
- type: "function",
408
- function: {
409
- name: "load_skill",
410
- description: "load a skill by name, returns its content",
411
- parameters: {
412
- type: "object",
413
- properties: { name: { type: "string" } },
414
- required: ["name"],
415
- },
416
- },
417
- },
418
- handler: (a) => {
419
- try {
420
- return (0, skills_1.loadSkill)(a.name);
421
- }
422
- catch (e) {
423
- return `error: ${e}`;
424
- }
425
- },
426
- },
427
- {
428
- tool: {
429
- type: "function",
430
- function: {
431
- name: "claude",
432
- description: "use claude code to query this codebase or get an outside perspective. useful for code review, second opinions, and asking questions about your own source.",
433
- parameters: {
434
- type: "object",
435
- properties: { prompt: { type: "string" } },
436
- required: ["prompt"],
437
- },
438
- },
439
- },
440
- handler: (a) => {
441
- try {
442
- const result = (0, child_process_1.spawnSync)("claude", ["-p", "--no-session-persistence", "--dangerously-skip-permissions", "--add-dir", "."], {
443
- input: a.prompt,
444
- encoding: "utf-8",
445
- timeout: 60000,
446
- });
447
- if (result.error)
448
- return `error: ${result.error}`;
449
- if (result.status !== 0)
450
- return `claude exited with code ${result.status}: ${result.stderr}`;
451
- return result.stdout || "(no output)";
452
- }
453
- catch (e) {
454
- return `error: ${e}`;
455
- }
456
- },
457
- },
458
- {
459
- tool: {
460
- type: "function",
461
- function: {
462
- name: "web_search",
463
- description: "search the web using perplexity. returns ranked results with titles, urls, and snippets",
464
- parameters: {
465
- type: "object",
466
- properties: { query: { type: "string" } },
467
- required: ["query"],
468
- },
469
- },
470
- },
471
- handler: async (a) => {
472
- try {
473
- const key = (0, config_1.getIntegrationsConfig)().perplexityApiKey;
474
- if (!key)
475
- return "error: perplexityApiKey not configured in secrets.json";
476
- const res = await fetch("https://api.perplexity.ai/search", {
477
- method: "POST",
478
- headers: {
479
- Authorization: `Bearer ${key}`,
480
- "Content-Type": "application/json",
481
- },
482
- body: JSON.stringify({ query: a.query, max_results: 5 }),
483
- });
484
- if (!res.ok)
485
- return `error: ${res.status} ${res.statusText}`;
486
- const data = (await res.json());
487
- if (!data.results?.length)
488
- return "no results found";
489
- return data.results
490
- .map((r) => `${r.title}\n${r.url}\n${r.snippet}`)
491
- .join("\n\n");
492
- }
493
- catch (e) {
494
- return `error: ${e}`;
495
- }
496
- },
497
- },
498
- {
499
- tool: {
500
- type: "function",
501
- function: {
502
- name: "memory_search",
503
- description: "search remembered facts stored in psyche memory and return relevant matches for a query",
504
- parameters: {
505
- type: "object",
506
- properties: { query: { type: "string" } },
507
- required: ["query"],
508
- },
509
- },
510
- },
511
- handler: async (a) => {
512
- try {
513
- const query = (a.query || "").trim();
514
- if (!query)
515
- return "query is required";
516
- const memoryRoot = path.join((0, identity_1.getAgentRoot)(), "psyche", "memory");
517
- const hits = await (0, memory_1.searchMemoryFacts)(query, (0, memory_1.readMemoryFacts)(memoryRoot));
518
- return hits
519
- .map((fact) => `- ${fact.text} (source=${fact.source}, createdAt=${fact.createdAt})`)
520
- .join("\n");
521
- }
522
- catch (e) {
523
- return `error: ${e instanceof Error ? e.message : String(e)}`;
524
- }
525
- },
526
- },
527
- {
528
- tool: {
529
- type: "function",
530
- function: {
531
- name: "memory_save",
532
- description: "save a general memory fact i want to recall later. optional 'about' can tag the fact to a person/topic/context",
533
- parameters: {
534
- type: "object",
535
- properties: {
536
- text: { type: "string" },
537
- about: { type: "string" },
538
- },
539
- required: ["text"],
540
- },
541
- },
542
- },
543
- handler: async (a) => {
544
- const text = (a.text || "").trim();
545
- if (!text)
546
- return "text is required";
547
- const result = await (0, memory_1.saveMemoryFact)({
548
- text,
549
- source: "tool:memory_save",
550
- about: typeof a.about === "string" ? a.about : undefined,
551
- });
552
- return `saved memory fact (added=${result.added}, skipped=${result.skipped})`;
553
- },
554
- },
555
- {
556
- tool: {
557
- type: "function",
558
- function: {
559
- name: "get_friend_note",
560
- description: "read a specific friend record by friend id. use this when i need notes/context about someone not currently active",
561
- parameters: {
562
- type: "object",
563
- properties: {
564
- friendId: { type: "string" },
565
- },
566
- required: ["friendId"],
567
- },
568
- },
569
- },
570
- handler: async (a, ctx) => {
571
- const friendId = (a.friendId || "").trim();
572
- if (!friendId)
573
- return "friendId is required";
574
- if (!ctx?.friendStore)
575
- return "i can't read friend notes -- friend store not available";
576
- const friend = await ctx.friendStore.get(friendId);
577
- if (!friend)
578
- return `friend not found: ${friendId}`;
579
- return JSON.stringify(friend, null, 2);
580
- },
581
- },
582
- {
583
- tool: {
584
- type: "function",
585
- function: {
586
- name: "save_friend_note",
587
- description: "save something i learned about my friend. use type 'name' to update their display name, 'tool_preference' for how they like a specific tool to behave (key = tool category like 'ado', 'graph'), or 'note' for general knowledge (key = topic). when updating an existing value, set override to true if i'm replacing/correcting it. omit override (or set false) if i'm unsure and want to check what's already saved.",
588
- parameters: {
589
- type: "object",
590
- properties: {
591
- type: { type: "string", enum: ["name", "tool_preference", "note"], description: "what kind of information to save" },
592
- key: { type: "string", description: "category key (required for tool_preference and note, e.g. 'ado', 'role')" },
593
- content: { type: "string", description: "the value to save" },
594
- override: { type: "string", enum: ["true", "false"], description: "set to 'true' to overwrite an existing value" },
595
- },
596
- required: ["type", "content"],
597
- },
598
- },
599
- },
600
- handler: async (a, ctx) => {
601
- (0, runtime_1.emitNervesEvent)({
602
- component: "repertoire",
603
- event: "repertoire.save_friend_note",
604
- message: "save friend note invoked",
605
- meta: { type: a.type },
606
- });
607
- if (!ctx?.context) {
608
- return "i can't save notes -- no friend context available";
609
- }
610
- if (!ctx.friendStore) {
611
- return "i can't save notes -- friend store not available";
612
- }
613
- const friendId = ctx.context.friend?.id;
614
- if (!friendId)
615
- return "i can't save notes -- no friend identity available";
616
- // Validate parameters
617
- if (!a.content)
618
- return "i need a content value to save";
619
- const validTypes = ["name", "tool_preference", "note"];
620
- if (!validTypes.includes(a.type))
621
- return `i don't recognize type '${a.type}' -- use name, tool_preference, or note`;
622
- if ((a.type === "tool_preference" || a.type === "note") && !a.key)
623
- return "i need a key for tool_preference or note type";
624
- try {
625
- // Read fresh record from disk
626
- const record = await ctx.friendStore.get(friendId);
627
- if (!record)
628
- return "i can't find the friend record on disk";
629
- const isOverride = a.override === "true";
630
- if (a.type === "name") {
631
- const updated = { ...record, name: a.content, updatedAt: new Date().toISOString() };
632
- await ctx.friendStore.put(friendId, updated);
633
- return `saved: name = ${a.content}`;
634
- }
635
- if (a.type === "tool_preference") {
636
- const existing = record.toolPreferences[a.key];
637
- if (existing && !isOverride) {
638
- return `i already have a preference for '${a.key}': "${existing}". if you want to replace it, call again with override: true. or merge both values into content and override.`;
639
- }
640
- const updated = { ...record, toolPreferences: { ...record.toolPreferences, [a.key]: a.content }, updatedAt: new Date().toISOString() };
641
- await ctx.friendStore.put(friendId, updated);
642
- return `saved: toolPreference ${a.key} = ${a.content}`;
643
- }
644
- // type === "note"
645
- // Redirect "name" key to name field
646
- if (a.key === "name") {
647
- const updated = { ...record, name: a.content, updatedAt: new Date().toISOString() };
648
- await ctx.friendStore.put(friendId, updated);
649
- return `updated friend's name to '${a.content}' (stored as name, not a note)`;
650
- }
651
- const existing = record.notes[a.key];
652
- if (existing && !isOverride) {
653
- return `i already have a note for '${a.key}': "${existing.value}". if you want to replace it, call again with override: true. or merge both values into content and override.`;
654
- }
655
- const updated = { ...record, notes: { ...record.notes, [a.key]: { value: a.content, savedAt: new Date().toISOString() } }, updatedAt: new Date().toISOString() };
656
- await ctx.friendStore.put(friendId, updated);
657
- return `saved: note ${a.key} = ${a.content}`;
658
- }
659
- catch (err) {
660
- /* v8 ignore next -- defensive: non-Error branch for String(err) @preserve */
661
- return `error saving note: ${err instanceof Error ? err.message : String(err)}`;
662
- }
663
- },
664
- },
665
- // -- cross-session awareness --
666
- {
667
- tool: {
668
- type: "function",
669
- function: {
670
- name: "bridge_manage",
671
- description: "create and manage shared live-work bridges across already-active sessions.",
672
- parameters: {
673
- type: "object",
674
- properties: {
675
- action: {
676
- type: "string",
677
- enum: ["begin", "attach", "status", "promote_task", "complete", "cancel"],
678
- },
679
- bridgeId: { type: "string", description: "bridge id for all actions except begin" },
680
- objective: { type: "string", description: "objective for begin" },
681
- summary: { type: "string", description: "optional concise shared-work summary" },
682
- friendId: { type: "string", description: "target friend id for attach" },
683
- channel: { type: "string", description: "target channel for attach" },
684
- key: { type: "string", description: "target session key for attach (defaults to 'session')" },
685
- title: { type: "string", description: "task title override for promote_task" },
686
- category: { type: "string", description: "task category override for promote_task" },
687
- body: { type: "string", description: "task body override for promote_task" },
688
- },
689
- required: ["action"],
690
- },
691
- },
692
- },
693
- handler: async (args, ctx) => {
694
- const manager = (0, manager_1.createBridgeManager)();
695
- const action = (args.action || "").trim();
696
- if (action === "begin") {
697
- if (!ctx?.currentSession) {
698
- return "bridge_manage begin requires an active session context.";
699
- }
700
- const objective = (args.objective || "").trim();
701
- if (!objective)
702
- return "objective is required for bridge begin.";
703
- return (0, manager_1.formatBridgeStatus)(manager.beginBridge({
704
- objective,
705
- summary: (args.summary || objective).trim(),
706
- session: ctx.currentSession,
707
- }));
708
- }
709
- const bridgeId = (args.bridgeId || "").trim();
710
- if (!bridgeId) {
711
- return "bridgeId is required for this bridge action.";
712
- }
713
- if (action === "attach") {
714
- const friendId = (args.friendId || "").trim();
715
- const channel = (args.channel || "").trim();
716
- const key = (args.key || "session").trim();
717
- if (!friendId || !channel) {
718
- return "friendId and channel are required for bridge attach.";
719
- }
720
- const sessionPath = (0, config_1.resolveSessionPath)(friendId, channel, key);
721
- const recall = await recallSessionSafely({
722
- sessionPath,
723
- friendId,
724
- channel,
725
- key,
726
- messageCount: 20,
727
- trustLevel: ctx?.context?.friend?.trustLevel,
728
- summarize: ctx?.summarize,
729
- });
730
- if (recall.kind === "missing") {
731
- return NO_SESSION_FOUND_MESSAGE;
732
- }
733
- return (0, manager_1.formatBridgeStatus)(manager.attachSession(bridgeId, {
734
- friendId,
735
- channel,
736
- key,
737
- sessionPath,
738
- snapshot: recall.kind === "ok" ? recall.snapshot : EMPTY_SESSION_MESSAGE,
739
- }));
740
- }
741
- if (action === "status") {
742
- const bridge = manager.getBridge(bridgeId);
743
- if (!bridge)
744
- return `bridge not found: ${bridgeId}`;
745
- return (0, manager_1.formatBridgeStatus)(bridge);
746
- }
747
- if (action === "promote_task") {
748
- return (0, manager_1.formatBridgeStatus)(manager.promoteBridgeToTask(bridgeId, {
749
- title: args.title,
750
- category: args.category,
751
- body: args.body,
752
- }));
753
- }
754
- if (action === "complete") {
755
- return (0, manager_1.formatBridgeStatus)(manager.completeBridge(bridgeId));
756
- }
757
- if (action === "cancel") {
758
- return (0, manager_1.formatBridgeStatus)(manager.cancelBridge(bridgeId));
759
- }
760
- return `unknown bridge action: ${action}`;
761
- },
762
- },
763
- {
764
- tool: {
765
- type: "function",
766
- function: {
767
- name: "query_session",
768
- description: "read the last messages from another session. use this to check on a conversation with a friend or review your own inner dialog.",
769
- parameters: {
770
- type: "object",
771
- properties: {
772
- friendId: { type: "string", description: "the friend UUID (or 'self')" },
773
- channel: { type: "string", description: "the channel: cli, teams, or inner" },
774
- key: { type: "string", description: "session key (defaults to 'session')" },
775
- messageCount: { type: "string", description: "how many recent messages to return (default 20)" },
776
- mode: { type: "string", enum: ["transcript", "status"], description: "transcript (default) or lightweight status for self/inner checks" },
777
- },
778
- required: ["friendId", "channel"],
779
- },
780
- },
781
- },
782
- handler: async (args, ctx) => {
783
- const friendId = args.friendId;
784
- const channel = args.channel;
785
- const key = args.key || "session";
786
- const count = parseInt(args.messageCount || "20", 10);
787
- const mode = args.mode || "transcript";
788
- if (mode === "status") {
789
- if (friendId !== "self" || channel !== "inner") {
790
- return "status mode is only available for self/inner dialog.";
791
- }
792
- const sessionPath = (0, thoughts_1.getInnerDialogSessionPath)((0, identity_1.getAgentRoot)());
793
- const pendingDir = (0, pending_1.getInnerDialogPendingDir)((0, identity_1.getAgentName)());
794
- return renderInnerProgressStatus((0, thoughts_1.readInnerDialogStatus)(sessionPath, pendingDir));
795
- }
796
- const sessFile = (0, config_1.resolveSessionPath)(friendId, channel, key);
797
- const recall = await recallSessionSafely({
798
- sessionPath: sessFile,
799
- friendId,
800
- channel,
801
- key,
802
- messageCount: count,
803
- trustLevel: ctx?.context?.friend?.trustLevel,
804
- summarize: ctx?.summarize,
805
- });
806
- if (recall.kind === "missing") {
807
- return NO_SESSION_FOUND_MESSAGE;
808
- }
809
- if (recall.kind === "empty") {
810
- return EMPTY_SESSION_MESSAGE;
811
- }
812
- return recall.summary;
813
- },
814
- },
815
- {
816
- tool: {
817
- type: "function",
818
- function: {
819
- name: "send_message",
820
- description: "send a message to a friend's session. the message is queued as a pending file and delivered when the target session drains its queue.",
821
- parameters: {
822
- type: "object",
823
- properties: {
824
- friendId: { type: "string", description: "the friend UUID (or 'self')" },
825
- channel: { type: "string", description: "the channel: cli, teams, or inner" },
826
- key: { type: "string", description: "session key (defaults to 'session')" },
827
- content: { type: "string", description: "the message content to send" },
828
- },
829
- required: ["friendId", "channel", "content"],
830
- },
831
- },
832
- },
833
- handler: async (args, ctx) => {
834
- const friendId = args.friendId;
835
- const channel = args.channel;
836
- const key = args.key || "session";
837
- const content = args.content;
838
- const now = Date.now();
839
- const agentName = (0, identity_1.getAgentName)();
840
- // Self-routing: messages to "self" always go to inner dialog pending dir,
841
- // regardless of the channel or key the agent specified.
842
- const isSelf = friendId === "self";
843
- const pendingDir = isSelf
844
- ? (0, pending_1.getInnerDialogPendingDir)(agentName)
845
- : (0, pending_1.getPendingDir)(agentName, friendId, channel, key);
846
- fs.mkdirSync(pendingDir, { recursive: true });
847
- const fileName = `${now}-${Math.random().toString(36).slice(2, 10)}.json`;
848
- const filePath = path.join(pendingDir, fileName);
849
- const delegatingBridgeId = findDelegatingBridgeId(ctx);
850
- const delegatedFrom = isSelf
851
- && ctx?.currentSession
852
- && !(ctx.currentSession.friendId === "self" && ctx.currentSession.channel === "inner")
853
- ? {
854
- friendId: ctx.currentSession.friendId,
855
- channel: ctx.currentSession.channel,
856
- key: ctx.currentSession.key,
857
- ...(delegatingBridgeId ? { bridgeId: delegatingBridgeId } : {}),
858
- }
859
- : undefined;
860
- const envelope = {
861
- from: agentName,
862
- friendId,
863
- channel,
864
- key,
865
- content,
866
- timestamp: now,
867
- ...(delegatedFrom ? { delegatedFrom } : {}),
868
- };
869
- fs.writeFileSync(filePath, JSON.stringify(envelope, null, 2));
870
- if (isSelf) {
871
- let wakeResponse = null;
872
- try {
873
- wakeResponse = await (0, socket_client_1.requestInnerWake)(agentName);
874
- }
875
- catch {
876
- wakeResponse = null;
877
- }
878
- if (!wakeResponse?.ok) {
879
- const { runInnerDialogTurn } = await Promise.resolve().then(() => __importStar(require("../senses/inner-dialog")));
880
- if (ctx?.context?.channel.channel === "inner") {
881
- queueMicrotask(() => {
882
- void runInnerDialogTurn({ reason: "instinct" });
883
- });
884
- return renderInnerProgressStatus({
885
- queue: "queued to inner/dialog",
886
- wake: "inline scheduled",
887
- processing: "pending",
888
- surfaced: "nothing yet",
889
- });
890
- }
891
- else {
892
- const turnResult = await runInnerDialogTurn({ reason: "instinct" });
893
- const surfacedPreview = normalizeProgressOutcome((0, thoughts_1.formatSurfacedValue)((0, thoughts_1.extractThoughtResponseFromMessages)(turnResult?.messages ?? [])));
894
- return (0, progress_story_1.renderProgressStory)((0, progress_story_1.buildProgressStory)({
895
- scope: "inner-delegation",
896
- phase: "completed",
897
- objective: "queued to inner/dialog",
898
- outcomeText: `wake: inline fallback\n${surfacedPreview}`,
899
- }));
900
- }
901
- }
902
- return renderInnerProgressStatus({
903
- queue: "queued to inner/dialog",
904
- wake: "daemon requested",
905
- processing: "pending",
906
- surfaced: "nothing yet",
907
- });
908
- }
909
- const preview = content.length > 80 ? content.slice(0, 80) + "…" : content;
910
- const target = `${channel}/${key}`;
911
- return `message queued for delivery to ${friendId} on ${target}. preview: "${preview}". it will be delivered when their session is next active.`;
912
- },
913
- },
36
+ ...tools_files_1.fileToolDefinitions,
37
+ ...tools_shell_1.shellToolDefinitions,
38
+ ...tools_notes_1.notesToolDefinitions,
39
+ ...tools_bridge_1.bridgeToolDefinitions,
40
+ ...tools_session_1.sessionToolDefinitions,
41
+ ...tools_continuity_1.continuityToolDefinitions,
42
+ ...tools_config_1.configToolDefinitions,
914
43
  ...tools_1.codingToolDefinitions,
44
+ ...tools_credential_1.credentialToolDefinitions,
45
+ ...tools_vault_1.vaultToolDefinitions,
46
+ ...tools_travel_1.travelToolDefinitions,
47
+ ...tools_user_profile_1.userProfileToolDefinitions,
48
+ ...tools_stripe_1.stripeToolDefinitions,
49
+ ...tools_flight_1.flightToolDefinitions,
50
+ ...tools_attachments_1.attachmentToolDefinitions,
51
+ ...tools_mail_1.mailToolDefinitions,
52
+ ...tools_trip_1.tripToolDefinitions,
915
53
  ];
54
+ // Convenience array of just the tool schemas (no handler/integration metadata).
55
+ // Used by consumers that need the OpenAI function-tool format.
916
56
  exports.tools = exports.baseToolDefinitions.map((d) => d.tool);
917
- exports.finalAnswerTool = {
918
- type: "function",
919
- function: {
920
- name: "final_answer",
921
- description: "respond to the user with your message. call this tool when you are ready to deliver your response.",
922
- parameters: {
923
- type: "object",
924
- properties: {
925
- answer: { type: "string" },
926
- intent: { type: "string", enum: ["complete", "blocked", "direct_reply"] },
927
- },
928
- required: ["answer"],
929
- },
930
- },
931
- };