@ouro.bot/cli 0.1.0-alpha.48 → 0.1.0-alpha.480

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