@oyasmi/pipiclaw 0.9.4 → 0.9.5-beta.2

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 (405) hide show
  1. package/README.en.md +28 -22
  2. package/README.md +27 -21
  3. package/dist/agent/builtin-commands.d.ts +7 -2
  4. package/dist/agent/builtin-commands.js +19 -23
  5. package/dist/agent/channel-runner.d.ts +13 -13
  6. package/dist/agent/channel-runner.js +93 -76
  7. package/dist/agent/maintenance-context.d.ts +6 -5
  8. package/dist/agent/maintenance-context.js +15 -15
  9. package/dist/agent/prompt/manifest.js +1 -1
  10. package/dist/agent/prompt/resources.d.ts +1 -1
  11. package/dist/agent/prompt/resources.js +1 -1
  12. package/dist/agent/prompt/sections.js +4 -4
  13. package/dist/agent/runner-factory.d.ts +6 -6
  14. package/dist/agent/runner-factory.js +6 -7
  15. package/dist/agent/session/compaction-input.d.ts +6 -0
  16. package/dist/agent/session/compaction-input.js +75 -0
  17. package/dist/agent/session/compaction-snapshot.d.ts +30 -0
  18. package/dist/agent/session/compaction-snapshot.js +154 -0
  19. package/dist/agent/session/compaction-summary.d.ts +39 -0
  20. package/dist/agent/session/compaction-summary.js +158 -0
  21. package/dist/agent/session/compaction.d.ts +35 -0
  22. package/dist/agent/session/compaction.js +294 -0
  23. package/dist/agent/session/context-input.d.ts +15 -0
  24. package/dist/agent/session/context-input.js +82 -0
  25. package/dist/agent/session/context-snapshot.d.ts +11 -0
  26. package/dist/agent/session/context-snapshot.js +72 -0
  27. package/dist/agent/session/event-guards.d.ts +2 -0
  28. package/dist/agent/session/event-guards.js +4 -0
  29. package/dist/agent/session/request-tools.d.ts +3 -0
  30. package/dist/agent/session/request-tools.js +20 -0
  31. package/dist/agent/session/session-adapter.d.ts +2 -1
  32. package/dist/agent/session/session-adapter.js +6 -3
  33. package/dist/agent/session/session-events.d.ts +5 -4
  34. package/dist/agent/session/session-events.js +46 -59
  35. package/dist/agent/session/session-host.d.ts +29 -41
  36. package/dist/agent/session/session-host.js +86 -69
  37. package/dist/agent/session/settings-diagnostics.d.ts +5 -0
  38. package/dist/agent/session/settings-diagnostics.js +21 -0
  39. package/dist/agent/status-render.js +5 -2
  40. package/dist/{runtime → agent}/stop-watchdog.d.ts +3 -1
  41. package/dist/{runtime → agent}/stop-watchdog.js +7 -3
  42. package/dist/agent/turn/progress-formatter.d.ts +1 -3
  43. package/dist/agent/turn/progress-formatter.js +3 -22
  44. package/dist/agent/turn/task-digest.d.ts +4 -2
  45. package/dist/agent/turn/task-digest.js +7 -4
  46. package/dist/agent/turn/turn-context.d.ts +11 -7
  47. package/dist/agent/turn/turn-context.js +26 -18
  48. package/dist/agent/turn/turn-finish.d.ts +17 -5
  49. package/dist/agent/turn/turn-finish.js +51 -77
  50. package/dist/agent/turn/turn-input.d.ts +2 -2
  51. package/dist/agent/turn/turn-input.js +4 -3
  52. package/dist/agent/turn/turn-output.d.ts +19 -0
  53. package/dist/agent/turn/turn-output.js +41 -0
  54. package/dist/agent/turn/turn-pipeline.d.ts +11 -8
  55. package/dist/agent/turn/turn-pipeline.js +54 -55
  56. package/dist/agent/turn/turn-prompt.d.ts +1 -1
  57. package/dist/agent/turn/turn-recovery.d.ts +11 -10
  58. package/dist/agent/turn/turn-recovery.js +14 -29
  59. package/dist/agent/types.d.ts +31 -12
  60. package/dist/agent/types.js +2 -1
  61. package/dist/app/auth-command.js +1 -1
  62. package/dist/app/home.js +31 -15
  63. package/dist/channel/active-session-store.d.ts +14 -12
  64. package/dist/channel/active-session-store.js +29 -25
  65. package/dist/channel/attachments.d.ts +25 -0
  66. package/dist/channel/attachments.js +56 -0
  67. package/dist/channel/channel-context.d.ts +87 -96
  68. package/dist/channel/channel-context.js +1 -66
  69. package/dist/channel/channel-event.d.ts +51 -41
  70. package/dist/channel/channel-event.js +6 -11
  71. package/dist/channel/channel-id.d.ts +22 -0
  72. package/dist/channel/channel-id.js +13 -0
  73. package/dist/channel/channel-index.d.ts +17 -34
  74. package/dist/channel/channel-index.js +41 -80
  75. package/dist/channel/config.d.ts +10 -0
  76. package/dist/channel/config.js +55 -0
  77. package/dist/channel/ingress.d.ts +101 -0
  78. package/dist/channel/ingress.js +5 -0
  79. package/dist/channel/store.d.ts +13 -15
  80. package/dist/channel/store.js +21 -25
  81. package/dist/channel/transport.d.ts +99 -0
  82. package/dist/channel/turn-context.d.ts +23 -0
  83. package/dist/channel/turn-context.js +1 -0
  84. package/dist/commands/catalog.d.ts +4 -7
  85. package/dist/commands/catalog.js +24 -31
  86. package/dist/commands/router.d.ts +23 -12
  87. package/dist/commands/router.js +22 -24
  88. package/dist/config/settings.d.ts +5 -4
  89. package/dist/desk/bindings.d.ts +6 -0
  90. package/dist/desk/bindings.js +105 -0
  91. package/dist/desk/commands.d.ts +81 -0
  92. package/dist/desk/commands.js +145 -0
  93. package/dist/desk/default.d.ts +4 -0
  94. package/dist/desk/default.js +11 -0
  95. package/dist/desk/paths.d.ts +41 -0
  96. package/dist/desk/paths.js +81 -0
  97. package/dist/desk/registry.d.ts +17 -0
  98. package/dist/desk/registry.js +191 -0
  99. package/dist/desk/startup-error.d.ts +4 -0
  100. package/dist/desk/startup-error.js +7 -0
  101. package/dist/desk/types.d.ts +72 -0
  102. package/dist/desk/types.js +7 -0
  103. package/dist/dingtalk/bot.d.ts +18 -35
  104. package/dist/dingtalk/bot.js +21 -204
  105. package/dist/dingtalk/channel-ids.d.ts +15 -0
  106. package/dist/dingtalk/channel-ids.js +39 -0
  107. package/dist/dingtalk/config.d.ts +6 -3
  108. package/dist/dingtalk/config.js +13 -25
  109. package/dist/dingtalk/connection.d.ts +1 -0
  110. package/dist/dingtalk/connection.js +5 -4
  111. package/dist/dingtalk/conversation-meta.d.ts +10 -5
  112. package/dist/dingtalk/conversation-meta.js +72 -50
  113. package/dist/dingtalk/delivery.d.ts +30 -14
  114. package/dist/dingtalk/delivery.js +189 -62
  115. package/dist/dingtalk/inbound-media.d.ts +2 -18
  116. package/dist/dingtalk/inbound-media.js +0 -53
  117. package/dist/dingtalk/inbound.d.ts +10 -11
  118. package/dist/dingtalk/inbound.js +12 -19
  119. package/dist/dingtalk/media.d.ts +9 -11
  120. package/dist/dingtalk/media.js +18 -31
  121. package/dist/dingtalk/progress.d.ts +8 -0
  122. package/dist/dingtalk/progress.js +20 -0
  123. package/dist/dingtalk/response-mode.d.ts +13 -0
  124. package/dist/dingtalk/response-mode.js +31 -0
  125. package/dist/dingtalk/transport.d.ts +47 -0
  126. package/dist/dingtalk/transport.js +71 -0
  127. package/dist/events/commands.d.ts +7 -2
  128. package/dist/events/commands.js +40 -22
  129. package/dist/events/pre-action-error.d.ts +10 -0
  130. package/dist/events/pre-action-error.js +10 -0
  131. package/dist/events/types.d.ts +20 -2
  132. package/dist/events/watcher.d.ts +14 -7
  133. package/dist/events/watcher.js +49 -26
  134. package/dist/index.d.ts +4 -2
  135. package/dist/jobs/completion-wake.d.ts +14 -0
  136. package/dist/jobs/completion-wake.js +36 -0
  137. package/dist/jobs/manager.d.ts +27 -22
  138. package/dist/jobs/manager.js +58 -91
  139. package/dist/jobs/record.d.ts +2 -0
  140. package/dist/jobs/record.js +2 -0
  141. package/dist/log.d.ts +0 -1
  142. package/dist/log.js +1 -1
  143. package/dist/main.js +10 -3
  144. package/dist/memory/boundary-work.d.ts +17 -0
  145. package/dist/memory/boundary-work.js +162 -0
  146. package/dist/memory/commands.d.ts +4 -3
  147. package/dist/memory/commands.js +16 -16
  148. package/dist/memory/desk-memory-queue.d.ts +18 -0
  149. package/dist/memory/desk-memory-queue.js +33 -0
  150. package/dist/memory/index-budget.d.ts +3 -3
  151. package/dist/memory/index-budget.js +3 -3
  152. package/dist/memory/journal.d.ts +6 -6
  153. package/dist/memory/journal.js +14 -14
  154. package/dist/memory/lifecycle.d.ts +14 -21
  155. package/dist/memory/lifecycle.js +73 -103
  156. package/dist/memory/maintenance-state.d.ts +14 -15
  157. package/dist/memory/maintenance-state.js +43 -42
  158. package/dist/memory/reflect-job.d.ts +5 -4
  159. package/dist/memory/reflect-job.js +21 -15
  160. package/dist/memory/reflect.d.ts +2 -1
  161. package/dist/memory/reflect.js +13 -12
  162. package/dist/memory/render.d.ts +1 -1
  163. package/dist/memory/render.js +2 -2
  164. package/dist/memory/review-log.d.ts +4 -4
  165. package/dist/memory/review-log.js +5 -5
  166. package/dist/memory/scheduler.d.ts +12 -19
  167. package/dist/memory/scheduler.js +28 -64
  168. package/dist/memory/session-corpus.d.ts +4 -1
  169. package/dist/memory/session-corpus.js +70 -29
  170. package/dist/memory/session-search.d.ts +11 -3
  171. package/dist/memory/session-search.js +14 -11
  172. package/dist/memory/sidecar-worker.d.ts +1 -0
  173. package/dist/memory/sidecar-worker.js +57 -76
  174. package/dist/memory/source-window.d.ts +0 -6
  175. package/dist/memory/source-window.js +0 -20
  176. package/dist/memory/store.d.ts +12 -12
  177. package/dist/memory/store.js +44 -44
  178. package/dist/paths.d.ts +2 -0
  179. package/dist/paths.js +2 -0
  180. package/dist/playbooks/agent-delegation.md +16 -16
  181. package/dist/playbooks/background-jobs.md +5 -3
  182. package/dist/playbooks/event-scheduling.md +7 -5
  183. package/dist/playbooks/memory-and-learning.md +16 -12
  184. package/dist/playbooks/outbound-media.md +1 -1
  185. package/dist/playbooks/runtime-orientation.md +35 -23
  186. package/dist/playbooks/task-lead.md +13 -11
  187. package/dist/runtime/bootstrap.d.ts +36 -13
  188. package/dist/runtime/bootstrap.js +310 -138
  189. package/dist/runtime/channel-queue.d.ts +23 -0
  190. package/dist/{dingtalk → runtime}/channel-queue.js +20 -9
  191. package/dist/runtime/daemon-lock.d.ts +12 -0
  192. package/dist/runtime/daemon-lock.js +28 -0
  193. package/dist/runtime/desk-runtime.d.ts +131 -0
  194. package/dist/runtime/desk-runtime.js +402 -0
  195. package/dist/runtime/durable-dispatch.d.ts +11 -5
  196. package/dist/runtime/durable-dispatch.js +20 -8
  197. package/dist/runtime/inbound-images.d.ts +32 -10
  198. package/dist/runtime/inbound-images.js +95 -21
  199. package/dist/runtime/ingress-busy.d.ts +26 -0
  200. package/dist/runtime/ingress-busy.js +211 -0
  201. package/dist/runtime/ingress-commands.d.ts +7 -0
  202. package/dist/runtime/ingress-commands.js +162 -0
  203. package/dist/runtime/ingress-deps.d.ts +62 -0
  204. package/dist/runtime/ingress-deps.js +1 -0
  205. package/dist/runtime/ingress.d.ts +22 -0
  206. package/dist/runtime/ingress.js +376 -0
  207. package/dist/runtime/request-execution.d.ts +19 -0
  208. package/dist/runtime/request-execution.js +88 -0
  209. package/dist/runtime/shutdown.d.ts +13 -5
  210. package/dist/runtime/shutdown.js +10 -4
  211. package/dist/runtime/task-driver.d.ts +38 -22
  212. package/dist/runtime/task-driver.js +142 -116
  213. package/dist/runtime/task-spawn.d.ts +4 -4
  214. package/dist/runtime/task-spawn.js +6 -5
  215. package/dist/runtime/task-wake.d.ts +6 -4
  216. package/dist/runtime/task-wake.js +7 -7
  217. package/dist/runtime/transports.d.ts +32 -0
  218. package/dist/runtime/transports.js +101 -0
  219. package/dist/runtime/turn-run.d.ts +18 -9
  220. package/dist/runtime/turn-run.js +302 -71
  221. package/dist/runtime/wake-coalescing.d.ts +11 -3
  222. package/dist/runtime/wake-coalescing.js +10 -0
  223. package/dist/security/config.js +5 -10
  224. package/dist/security/logger.js +1 -1
  225. package/dist/security/path-guard.js +7 -63
  226. package/dist/security/types.d.ts +27 -30
  227. package/dist/security/types.js +0 -1
  228. package/dist/shared/atomic-file.d.ts +2 -0
  229. package/dist/shared/atomic-file.js +14 -1
  230. package/dist/shared/file-lock.d.ts +35 -0
  231. package/dist/shared/file-lock.js +195 -0
  232. package/dist/shared/with-timeout.d.ts +2 -0
  233. package/dist/shared/with-timeout.js +21 -0
  234. package/dist/skills/loader.d.ts +1 -1
  235. package/dist/skills/loader.js +2 -2
  236. package/dist/skills/workspace.js +2 -2
  237. package/dist/subagents/completion-wake.d.ts +11 -2
  238. package/dist/subagents/completion-wake.js +22 -9
  239. package/dist/subagents/discovery.js +1 -1
  240. package/dist/subagents/dispatch.d.ts +0 -10
  241. package/dist/subagents/dispatch.js +10 -28
  242. package/dist/subagents/external/dispatch.js +1 -1
  243. package/dist/subagents/external/run.d.ts +1 -1
  244. package/dist/subagents/external/run.js +3 -3
  245. package/dist/subagents/internal/run.js +1 -1
  246. package/dist/subagents/internal/worker.js +6 -14
  247. package/dist/subagents/run-archive.d.ts +11 -0
  248. package/dist/subagents/run-archive.js +49 -0
  249. package/dist/subagents/run-record.d.ts +9 -8
  250. package/dist/subagents/run-record.js +3 -3
  251. package/dist/subagents/run-registry.d.ts +5 -3
  252. package/dist/subagents/run-registry.js +22 -45
  253. package/dist/subagents/runs.d.ts +23 -13
  254. package/dist/subagents/runs.js +75 -82
  255. package/dist/subagents/task-envelope.js +9 -11
  256. package/dist/subagents/types.d.ts +6 -5
  257. package/dist/tasks/board.d.ts +1 -1
  258. package/dist/tasks/board.js +2 -2
  259. package/dist/tasks/bound-work.d.ts +2 -2
  260. package/dist/tasks/bound-work.js +7 -7
  261. package/dist/tasks/brief.d.ts +1 -1
  262. package/dist/tasks/brief.js +9 -9
  263. package/dist/tasks/commands.d.ts +11 -2
  264. package/dist/tasks/commands.js +66 -41
  265. package/dist/tasks/contract.d.ts +0 -2
  266. package/dist/tasks/contract.js +1 -3
  267. package/dist/tasks/create.d.ts +3 -1
  268. package/dist/tasks/create.js +10 -4
  269. package/dist/tasks/frontmatter.d.ts +6 -2
  270. package/dist/tasks/frontmatter.js +10 -10
  271. package/dist/tasks/loop-log.d.ts +7 -13
  272. package/dist/tasks/loop-log.js +14 -17
  273. package/dist/tasks/mutation-lock.d.ts +7 -5
  274. package/dist/tasks/mutation-lock.js +32 -9
  275. package/dist/tasks/session-path.d.ts +3 -3
  276. package/dist/tasks/session-path.js +5 -5
  277. package/dist/tasks/steer.d.ts +5 -5
  278. package/dist/tasks/steer.js +42 -40
  279. package/dist/tasks/store.d.ts +11 -11
  280. package/dist/tasks/store.js +32 -29
  281. package/dist/tools/bash.d.ts +5 -5
  282. package/dist/tools/bash.js +19 -18
  283. package/dist/tools/contract/names.d.ts +7 -0
  284. package/dist/tools/contract/names.js +22 -0
  285. package/dist/tools/edit.js +1 -1
  286. package/dist/tools/event-manage.d.ts +3 -1
  287. package/dist/tools/event-manage.js +34 -33
  288. package/dist/tools/glob.js +5 -5
  289. package/dist/tools/grep.js +2 -2
  290. package/dist/tools/index.d.ts +9 -8
  291. package/dist/tools/index.js +12 -16
  292. package/dist/tools/job.d.ts +4 -2
  293. package/dist/tools/job.js +11 -8
  294. package/dist/tools/memory-manage.d.ts +5 -3
  295. package/dist/tools/memory-manage.js +24 -24
  296. package/dist/tools/read.js +1 -1
  297. package/dist/tools/registry.d.ts +12 -8
  298. package/dist/tools/registry.js +13 -9
  299. package/dist/tools/send-media.d.ts +2 -2
  300. package/dist/tools/send-media.js +3 -3
  301. package/dist/tools/session-search.d.ts +3 -1
  302. package/dist/tools/session-search.js +8 -6
  303. package/dist/tools/subagent-manage.d.ts +2 -8
  304. package/dist/tools/subagent-manage.js +19 -15
  305. package/dist/tools/subagent.js +1 -1
  306. package/dist/tools/task-manage/create.js +1 -1
  307. package/dist/tools/task-manage/factory.js +2 -2
  308. package/dist/tools/task-manage/lifecycle.js +3 -1
  309. package/dist/tools/task-manage/log-view.js +2 -2
  310. package/dist/tools/task-manage/shared.js +3 -3
  311. package/dist/tools/task-manage/step-end.js +3 -3
  312. package/dist/tools/task-manage/types.d.ts +8 -3
  313. package/dist/tools/web-cache.d.ts +3 -3
  314. package/dist/tools/web-cache.js +12 -12
  315. package/dist/tools/web-fetch.d.ts +2 -2
  316. package/dist/tools/web-fetch.js +7 -7
  317. package/dist/tools/write-content.js +1 -1
  318. package/dist/tui/cli.d.ts +17 -5
  319. package/dist/tui/cli.js +90 -27
  320. package/dist/tui/client.d.ts +26 -0
  321. package/dist/tui/client.js +157 -0
  322. package/dist/tui/colors.d.ts +0 -1
  323. package/dist/tui/colors.js +0 -1
  324. package/dist/tui/commands.d.ts +10 -51
  325. package/dist/tui/commands.js +16 -39
  326. package/dist/tui/frontend.d.ts +2 -2
  327. package/dist/tui/frontend.js +2 -2
  328. package/dist/tui/pitui-frontend.d.ts +0 -2
  329. package/dist/tui/pitui-frontend.js +1 -6
  330. package/dist/tui/render.d.ts +62 -0
  331. package/dist/tui/render.js +123 -0
  332. package/dist/tui/session.d.ts +92 -0
  333. package/dist/tui/session.js +317 -0
  334. package/dist/usage/ledger.d.ts +5 -0
  335. package/dist/usage/ledger.js +2 -0
  336. package/dist/usage/render.d.ts +6 -1
  337. package/dist/usage/render.js +18 -13
  338. package/dist/webapi/auth.d.ts +13 -0
  339. package/dist/webapi/auth.js +29 -0
  340. package/dist/webapi/config.d.ts +29 -0
  341. package/dist/webapi/config.js +100 -0
  342. package/dist/webapi/errors.d.ts +39 -0
  343. package/dist/webapi/errors.js +32 -0
  344. package/dist/webapi/http.d.ts +25 -0
  345. package/dist/webapi/http.js +4 -0
  346. package/dist/webapi/ids.d.ts +9 -0
  347. package/dist/webapi/ids.js +20 -0
  348. package/dist/webapi/input.d.ts +17 -0
  349. package/dist/webapi/input.js +229 -0
  350. package/dist/webapi/items.d.ts +37 -0
  351. package/dist/webapi/items.js +48 -0
  352. package/dist/webapi/key-command.d.ts +2 -0
  353. package/dist/webapi/key-command.js +110 -0
  354. package/dist/webapi/limits.d.ts +47 -0
  355. package/dist/webapi/limits.js +48 -0
  356. package/dist/webapi/request-policy.d.ts +17 -0
  357. package/dist/webapi/request-policy.js +160 -0
  358. package/dist/webapi/response-record.d.ts +68 -0
  359. package/dist/webapi/response-record.js +58 -0
  360. package/dist/webapi/response-state.d.ts +90 -0
  361. package/dist/webapi/response-state.js +347 -0
  362. package/dist/webapi/routes/conversations.d.ts +8 -0
  363. package/dist/webapi/routes/conversations.js +80 -0
  364. package/dist/webapi/routes/models.d.ts +3 -0
  365. package/dist/webapi/routes/models.js +12 -0
  366. package/dist/webapi/routes/responses.d.ts +8 -0
  367. package/dist/webapi/routes/responses.js +118 -0
  368. package/dist/webapi/routes/websocket.d.ts +9 -0
  369. package/dist/webapi/routes/websocket.js +328 -0
  370. package/dist/webapi/server.d.ts +24 -0
  371. package/dist/webapi/server.js +229 -0
  372. package/dist/webapi/service.d.ts +130 -0
  373. package/dist/webapi/service.js +588 -0
  374. package/dist/webapi/store.d.ts +46 -0
  375. package/dist/webapi/store.js +245 -0
  376. package/dist/webapi/stream.d.ts +13 -0
  377. package/dist/webapi/stream.js +76 -0
  378. package/dist/webapi/transport.d.ts +43 -0
  379. package/dist/webapi/transport.js +100 -0
  380. package/package.json +8 -2
  381. package/dist/channel/channel-paths.d.ts +0 -16
  382. package/dist/channel/channel-paths.js +0 -53
  383. package/dist/channel/commands.d.ts +0 -32
  384. package/dist/channel/commands.js +0 -109
  385. package/dist/channel/project-scope-store.d.ts +0 -51
  386. package/dist/channel/project-scope-store.js +0 -112
  387. package/dist/dingtalk/channel-queue.d.ts +0 -19
  388. package/dist/dingtalk/handler.d.ts +0 -90
  389. package/dist/memory/channel-maintenance-queue.d.ts +0 -5
  390. package/dist/memory/channel-maintenance-queue.js +0 -8
  391. package/dist/runtime/task-migration.d.ts +0 -30
  392. package/dist/runtime/task-migration.js +0 -465
  393. package/dist/runtime/turn-handler.d.ts +0 -47
  394. package/dist/runtime/turn-handler.js +0 -318
  395. package/dist/security/project-scope.d.ts +0 -45
  396. package/dist/security/project-scope.js +0 -105
  397. package/dist/tui/app.d.ts +0 -16
  398. package/dist/tui/app.js +0 -166
  399. package/dist/tui/terminal-context.d.ts +0 -27
  400. package/dist/tui/terminal-context.js +0 -84
  401. package/dist/tui/terminal-media-sender.d.ts +0 -9
  402. package/dist/tui/terminal-media-sender.js +0 -15
  403. package/dist/tui/turn-controller.d.ts +0 -64
  404. package/dist/tui/turn-controller.js +0 -311
  405. /package/dist/{dingtalk/handler.js → channel/transport.js} +0 -0
@@ -0,0 +1,347 @@
1
+ import * as log from "../log.js";
2
+ import { errorMessage } from "../shared/text-utils.js";
3
+ import { newId } from "./ids.js";
4
+ import { MAX_TOOL_OUTPUT_CHARS } from "./limits.js";
5
+ import { isTerminal, nowSeconds, toApiResponse } from "./response-record.js";
6
+ const SERVER_LABEL = "pipiclaw";
7
+ export class LiveResponse {
8
+ constructor(record, hooks,
9
+ /** Created with `background` and `stream`: a client may resume the stream while the log is kept. */
10
+ replayable = false) {
11
+ this.record = record;
12
+ this.hooks = hooks;
13
+ this.replayable = replayable;
14
+ this.log = [];
15
+ /** Events produced before the response was announced; they follow `response.created` in the log. */
16
+ this.deferred = [];
17
+ this.announced = false;
18
+ this.subscribers = new Set();
19
+ this.toolItems = new Map();
20
+ this.persisting = Promise.resolve();
21
+ // ---- internals -------------------------------------------------------------------------
22
+ this.endedFlag = false;
23
+ this.ended = new Promise((resolve) => {
24
+ this.resolveEnded = resolve;
25
+ });
26
+ }
27
+ get id() {
28
+ return this.record.id;
29
+ }
30
+ get status() {
31
+ return this.record.status;
32
+ }
33
+ get terminal() {
34
+ return isTerminal(this.record.status);
35
+ }
36
+ /** Resolves once the response has reached a terminal state. */
37
+ whenEnded() {
38
+ return this.ended;
39
+ }
40
+ /** Resolves once the last snapshot has been written (tests and shutdown). */
41
+ whenPersisted() {
42
+ return this.persisting;
43
+ }
44
+ snapshot() {
45
+ return toApiResponse(this.record);
46
+ }
47
+ // ---- lifecycle -------------------------------------------------------------------------
48
+ /**
49
+ * Make the response visible: `response.created` (and `queued` or `in_progress`) open the log,
50
+ * and whatever the turn already produced follows. Nothing is stored or announced before this.
51
+ */
52
+ announce(initial) {
53
+ if (this.announced)
54
+ return;
55
+ if (!this.terminal)
56
+ this.record.status = initial;
57
+ this.announced = true;
58
+ const skeleton = toApiResponse(this.record, { skeleton: initial });
59
+ this.commit({ type: "response.created", response: skeleton });
60
+ this.commit(initial === "queued"
61
+ ? { type: "response.queued", response: skeleton }
62
+ : { type: "response.in_progress", response: skeleton });
63
+ for (const pending of this.deferred.splice(0))
64
+ this.commit(pending);
65
+ this.save();
66
+ }
67
+ /** A queued response whose turn begins. */
68
+ start() {
69
+ if (this.record.status !== "queued")
70
+ return;
71
+ this.record.status = "in_progress";
72
+ this.emit({ type: "response.in_progress", response: toApiResponse(this.record, { skeleton: "in_progress" }) });
73
+ }
74
+ complete(usage) {
75
+ if (this.terminal)
76
+ return;
77
+ this.closeDanglingCalls();
78
+ this.record.status = "completed";
79
+ this.record.usage = usage;
80
+ this.record.completed_at = nowSeconds();
81
+ this.emit({ type: "response.completed", response: this.snapshot() });
82
+ this.settle();
83
+ }
84
+ fail(message, usage) {
85
+ if (this.terminal)
86
+ return;
87
+ this.closeDanglingCalls();
88
+ this.record.status = "failed";
89
+ this.record.error = { code: "server_error", message };
90
+ if (usage)
91
+ this.record.usage = usage;
92
+ this.record.completed_at = nowSeconds();
93
+ this.emit({ type: "error", code: "server_error", message, param: null });
94
+ this.emit({ type: "response.failed", response: this.snapshot() });
95
+ this.settle();
96
+ }
97
+ /** The response stopped before it was done (steering took over): `incomplete` with the reason. */
98
+ incomplete(reason, usage) {
99
+ if (this.terminal)
100
+ return;
101
+ this.closeDanglingCalls();
102
+ this.record.status = "incomplete";
103
+ this.record.incomplete_details = { reason };
104
+ if (usage)
105
+ this.record.usage = usage;
106
+ this.record.completed_at = nowSeconds();
107
+ this.emit({ type: "response.incomplete", response: this.snapshot() });
108
+ this.settle();
109
+ }
110
+ /**
111
+ * Cancelled by the caller. The API has no event for it: the stream ends where it is, and the
112
+ * outcome is read from the response object. Returns whether anything changed.
113
+ */
114
+ cancel() {
115
+ if (this.terminal)
116
+ return false;
117
+ this.markDanglingCallsIncomplete();
118
+ this.record.status = "cancelled";
119
+ this.record.completed_at = null;
120
+ this.settle();
121
+ this.endSubscribers();
122
+ return true;
123
+ }
124
+ // ---- items -----------------------------------------------------------------------------
125
+ /** A tool call begins: an `mcp_call` item, in progress, with its arguments. */
126
+ beginToolCall(callId, name, args) {
127
+ if (this.terminal || this.toolItems.has(callId))
128
+ return;
129
+ const item = {
130
+ id: newId("mcp"),
131
+ type: "mcp_call",
132
+ server_label: SERVER_LABEL,
133
+ name,
134
+ arguments: JSON.stringify(args ?? {}) ?? "{}",
135
+ status: "in_progress",
136
+ output: null,
137
+ error: null,
138
+ };
139
+ const index = this.record.output.push(item) - 1;
140
+ this.toolItems.set(callId, index);
141
+ this.emit({ type: "response.output_item.added", output_index: index, item: structuredClone(item) });
142
+ this.emit({
143
+ type: "response.mcp_call_arguments.done",
144
+ output_index: index,
145
+ item_id: item.id,
146
+ arguments: item.arguments,
147
+ });
148
+ this.emit({ type: "response.mcp_call.in_progress", output_index: index, item_id: item.id });
149
+ }
150
+ endToolCall(callId, ok, output, failure) {
151
+ const index = this.toolItems.get(callId);
152
+ if (index === undefined || this.terminal)
153
+ return;
154
+ this.toolItems.delete(callId);
155
+ const item = this.record.output[index];
156
+ const text = output.length > MAX_TOOL_OUTPUT_CHARS ? `${output.slice(0, MAX_TOOL_OUTPUT_CHARS)}…` : output;
157
+ item.output = text;
158
+ item.status = ok ? "completed" : "failed";
159
+ item.error = ok ? null : { type: "mcp_tool_execution_error", content: text };
160
+ if (!ok && failure)
161
+ item.pipiclaw_failure = failure;
162
+ this.emit({
163
+ type: ok ? "response.mcp_call.completed" : "response.mcp_call.failed",
164
+ output_index: index,
165
+ item_id: item.id,
166
+ });
167
+ this.emit({ type: "response.output_item.done", output_index: index, item: structuredClone(item) });
168
+ }
169
+ /** The model's reasoning, as a reasoning item with a one-part summary. */
170
+ addReasoning(text) {
171
+ if (this.terminal || !text.trim())
172
+ return;
173
+ const item = { id: newId("rs"), type: "reasoning", summary: [], status: "in_progress" };
174
+ const index = this.record.output.push(item) - 1;
175
+ this.emit({ type: "response.output_item.added", output_index: index, item: structuredClone(item) });
176
+ this.emit({
177
+ type: "response.reasoning_summary_part.added",
178
+ output_index: index,
179
+ item_id: item.id,
180
+ summary_index: 0,
181
+ part: { type: "summary_text", text: "" },
182
+ });
183
+ this.emit({
184
+ type: "response.reasoning_summary_text.delta",
185
+ output_index: index,
186
+ item_id: item.id,
187
+ summary_index: 0,
188
+ delta: text,
189
+ });
190
+ this.emit({
191
+ type: "response.reasoning_summary_text.done",
192
+ output_index: index,
193
+ item_id: item.id,
194
+ summary_index: 0,
195
+ text,
196
+ });
197
+ const part = { type: "summary_text", text };
198
+ this.emit({
199
+ type: "response.reasoning_summary_part.done",
200
+ output_index: index,
201
+ item_id: item.id,
202
+ summary_index: 0,
203
+ part,
204
+ });
205
+ item.summary = [part];
206
+ item.status = "completed";
207
+ this.emit({ type: "response.output_item.done", output_index: index, item: structuredClone(item) });
208
+ }
209
+ /** A finished assistant message: commentary between tool calls, or the final answer. */
210
+ addMessage(phase, text, level) {
211
+ if (this.terminal || !text.trim())
212
+ return;
213
+ const id = newId("msg");
214
+ const empty = {
215
+ id,
216
+ type: "message",
217
+ role: "assistant",
218
+ status: "in_progress",
219
+ phase,
220
+ content: [],
221
+ ...(level ? { pipiclaw_level: level } : {}),
222
+ };
223
+ const index = this.record.output.push(empty) - 1;
224
+ this.emit({ type: "response.output_item.added", output_index: index, item: structuredClone(empty) });
225
+ this.emit({
226
+ type: "response.content_part.added",
227
+ output_index: index,
228
+ item_id: id,
229
+ content_index: 0,
230
+ part: { type: "output_text", text: "", annotations: [] },
231
+ });
232
+ this.emit({
233
+ type: "response.output_text.delta",
234
+ output_index: index,
235
+ item_id: id,
236
+ content_index: 0,
237
+ delta: text,
238
+ logprobs: [],
239
+ });
240
+ this.emit({
241
+ type: "response.output_text.done",
242
+ output_index: index,
243
+ item_id: id,
244
+ content_index: 0,
245
+ text,
246
+ logprobs: [],
247
+ });
248
+ const part = { type: "output_text", text, annotations: [] };
249
+ this.emit({ type: "response.content_part.done", output_index: index, item_id: id, content_index: 0, part });
250
+ empty.content = [part];
251
+ empty.status = "completed";
252
+ this.emit({ type: "response.output_item.done", output_index: index, item: structuredClone(empty) });
253
+ }
254
+ /** Output items produced so far, for a caller that needs to know whether the turn said anything. */
255
+ get hasOutput() {
256
+ return this.record.output.length > 0;
257
+ }
258
+ // ---- streams ---------------------------------------------------------------------------
259
+ /**
260
+ * Replay the log from `fromSequence` (the first event to deliver), then follow it live. Returns
261
+ * the way to stop following. A response that has already ended is replayed and then `onEnd`.
262
+ */
263
+ subscribe(fromSequence, subscriber) {
264
+ for (const event of this.log.slice(Math.max(0, fromSequence)))
265
+ subscriber.onEvent(event);
266
+ if (this.endedFlag) {
267
+ subscriber.onEnd();
268
+ return () => undefined;
269
+ }
270
+ this.subscribers.add(subscriber);
271
+ return () => {
272
+ this.subscribers.delete(subscriber);
273
+ };
274
+ }
275
+ /** Whether events from `sequence` on can still be replayed (the log is whole from the start). */
276
+ get logLength() {
277
+ return this.log.length;
278
+ }
279
+ emit(event) {
280
+ if (this.announced)
281
+ this.commit(event);
282
+ else
283
+ this.deferred.push(event);
284
+ }
285
+ commit(event) {
286
+ const logged = { ...event, sequence_number: this.log.length };
287
+ this.log.push(logged);
288
+ for (const subscriber of [...this.subscribers]) {
289
+ try {
290
+ subscriber.onEvent(logged);
291
+ }
292
+ catch (error) {
293
+ log.logWarn("webapi.stream.subscriber_failed", "Stream subscriber failed", {
294
+ reason: errorMessage(error),
295
+ fields: { responseId: this.id },
296
+ });
297
+ }
298
+ }
299
+ if (isTerminalEvent(logged) && this.terminal)
300
+ this.endSubscribers();
301
+ }
302
+ endSubscribers() {
303
+ if (this.endedFlag)
304
+ return;
305
+ this.endedFlag = true;
306
+ for (const subscriber of [...this.subscribers])
307
+ subscriber.onEnd();
308
+ this.subscribers.clear();
309
+ }
310
+ /** The response is over: store the final record and let waiters go. */
311
+ settle() {
312
+ this.save();
313
+ this.hooks.onTerminal?.(this);
314
+ this.resolveEnded();
315
+ }
316
+ save() {
317
+ // A response that is not yet announced is not stored: a request refused at admission leaves nothing behind.
318
+ if (!this.announced)
319
+ return;
320
+ // Handed over at once, so the store registers the response before anything can ask about it.
321
+ const written = this.hooks.persist(structuredClone(this.record)).catch((error) => {
322
+ log.logWarn("webapi.response.persist_failed", "Response snapshot write failed", {
323
+ reason: errorMessage(error),
324
+ fields: { responseId: this.id },
325
+ });
326
+ });
327
+ this.persisting = Promise.all([this.persisting, written]).then(() => undefined);
328
+ }
329
+ /** Tool calls still running when the response ends are closed as `incomplete`, with their `done` events. */
330
+ closeDanglingCalls() {
331
+ for (const [callId, index] of [...this.toolItems]) {
332
+ this.toolItems.delete(callId);
333
+ const item = this.record.output[index];
334
+ item.status = "incomplete";
335
+ this.emit({ type: "response.output_item.done", output_index: index, item: structuredClone(item) });
336
+ }
337
+ }
338
+ markDanglingCallsIncomplete() {
339
+ for (const [callId, index] of [...this.toolItems]) {
340
+ this.toolItems.delete(callId);
341
+ this.record.output[index].status = "incomplete";
342
+ }
343
+ }
344
+ }
345
+ function isTerminalEvent(event) {
346
+ return (event.type === "response.completed" || event.type === "response.failed" || event.type === "response.incomplete");
347
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `/v1/conversations` (spec 061, D12/D13): create, retrieve, update metadata, list items. A
3
+ * conversation is a channel; its items are what its responses said and were asked, not the model's
4
+ * context. Deleting and editing items are not offered (404).
5
+ */
6
+ import type { FastifyInstance } from "fastify";
7
+ import { type RouteContext } from "../http.js";
8
+ export declare function registerConversationRoutes(app: FastifyInstance, { service }: RouteContext): void;
@@ -0,0 +1,80 @@
1
+ import { badRequest, notFound } from "../errors.js";
2
+ import { sendError } from "../http.js";
3
+ import { conversationItems, defaultPage, paginate, UnknownCursorError } from "../items.js";
4
+ import { MAX_PAGE_LIMIT } from "../limits.js";
5
+ import { validateMetadataParam } from "../request-policy.js";
6
+ function toApiConversation(conversation) {
7
+ return {
8
+ id: conversation.id,
9
+ object: "conversation",
10
+ created_at: conversation.created_at,
11
+ metadata: conversation.metadata ?? {},
12
+ };
13
+ }
14
+ const ITEMS_QUERY = {
15
+ type: "object",
16
+ additionalProperties: false,
17
+ properties: {
18
+ after: { type: "string" },
19
+ limit: { type: "integer", minimum: 1, maximum: MAX_PAGE_LIMIT },
20
+ order: { type: "string", enum: ["asc", "desc"] },
21
+ include: { type: "array", maxItems: 0 },
22
+ },
23
+ };
24
+ export function registerConversationRoutes(app, { service }) {
25
+ app.post("/v1/conversations", async (request, reply) => {
26
+ const body = (request.body ?? {});
27
+ for (const key of Object.keys(body)) {
28
+ if (key !== "metadata" && key !== "items") {
29
+ return sendError(reply, badRequest("unknown_parameter", `Unknown parameter \`${key}\`.`, key));
30
+ }
31
+ }
32
+ if (Array.isArray(body.items) ? body.items.length > 0 : body.items !== undefined && body.items !== null) {
33
+ return sendError(reply, badRequest("unsupported_parameter", "Seeding a conversation with `items` is not supported.", "items"));
34
+ }
35
+ const conversation = await service.store.createConversation(request.principal.name, validateMetadataParam(body.metadata));
36
+ request.auditConversationId = conversation.id;
37
+ return toApiConversation(conversation);
38
+ });
39
+ app.get("/v1/conversations/:id", async (request, reply) => {
40
+ try {
41
+ const conversation = service.conversationFor(request.principal, request.params.id);
42
+ request.auditConversationId = conversation.id;
43
+ return toApiConversation(conversation);
44
+ }
45
+ catch (error) {
46
+ return sendError(reply, error);
47
+ }
48
+ });
49
+ app.post("/v1/conversations/:id", async (request, reply) => {
50
+ const conversation = service.conversationFor(request.principal, request.params.id);
51
+ const body = (request.body ?? {});
52
+ for (const key of Object.keys(body)) {
53
+ if (key !== "metadata")
54
+ return sendError(reply, badRequest("unknown_parameter", `Unknown parameter \`${key}\`.`, key));
55
+ }
56
+ if (body.metadata === undefined) {
57
+ return sendError(reply, badRequest("missing_required_parameter", "`metadata` is required.", "metadata"));
58
+ }
59
+ request.auditConversationId = conversation.id;
60
+ return toApiConversation(await service.store.updateConversationMetadata(conversation.id, validateMetadataParam(body.metadata)));
61
+ });
62
+ app.delete("/v1/conversations/:id", async (request) => {
63
+ await service.deleteConversation(request.principal, request.params.id);
64
+ request.auditConversationId = request.params.id;
65
+ return { id: request.params.id, object: "conversation.deleted", deleted: true };
66
+ });
67
+ app.get("/v1/conversations/:id/items", { schema: { querystring: ITEMS_QUERY } }, async (request, reply) => {
68
+ const conversation = service.conversationFor(request.principal, request.params.id);
69
+ request.auditConversationId = conversation.id;
70
+ try {
71
+ return paginate(conversationItems(service.responsesOf(conversation.id)), defaultPage(request.query));
72
+ }
73
+ catch (error) {
74
+ if (error instanceof UnknownCursorError) {
75
+ return sendError(reply, notFound(`Item ${error.message}`));
76
+ }
77
+ throw error;
78
+ }
79
+ });
80
+ }
@@ -0,0 +1,3 @@
1
+ /** `GET /v1/models` and `GET /v1/models/{id}`: the one model there is (spec 061, D12). */
2
+ import type { FastifyInstance } from "fastify";
3
+ export declare function registerModelRoutes(app: FastifyInstance): void;
@@ -0,0 +1,12 @@
1
+ import { notFound } from "../errors.js";
2
+ import { sendError } from "../http.js";
3
+ import { MODEL_NAME } from "../response-record.js";
4
+ const MODEL = { id: MODEL_NAME, object: "model", created: 0, owned_by: "pipiclaw" };
5
+ export function registerModelRoutes(app) {
6
+ app.get("/v1/models", async () => ({ object: "list", data: [MODEL] }));
7
+ app.get("/v1/models/:id", async (request, reply) => {
8
+ if (request.params.id !== MODEL_NAME)
9
+ return sendError(reply, notFound(`Model ${request.params.id}`));
10
+ return MODEL;
11
+ });
12
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * `/v1/responses` over HTTP (spec 061, D13/D14/D17/D19/D20). One request is one message and one
3
+ * Response; what the caller gets back — the finished object, an event stream, or the object at once
4
+ * with the work continuing in the background — is the only thing the four modes differ in.
5
+ */
6
+ import type { FastifyInstance } from "fastify";
7
+ import { type RouteContext } from "../http.js";
8
+ export declare function registerResponseRoutes(app: FastifyInstance, context: RouteContext): void;
@@ -0,0 +1,118 @@
1
+ import { badRequest, notFound } from "../errors.js";
2
+ import { sendError } from "../http.js";
3
+ import { parseInput } from "../input.js";
4
+ import { defaultPage, paginate, UnknownCursorError } from "../items.js";
5
+ import { MAX_PAGE_LIMIT } from "../limits.js";
6
+ import { validateCreateRequest } from "../request-policy.js";
7
+ import { toApiResponse } from "../response-record.js";
8
+ import { openEventStream, pumpEvents } from "../stream.js";
9
+ const EMPTY_INCLUDE = { type: "array", maxItems: 0 };
10
+ const RETRIEVE_QUERY = {
11
+ type: "object",
12
+ additionalProperties: false,
13
+ properties: {
14
+ stream: { type: "boolean" },
15
+ starting_after: { type: "integer", minimum: 0 },
16
+ include: EMPTY_INCLUDE,
17
+ include_obfuscation: { type: "boolean" },
18
+ },
19
+ };
20
+ const INPUT_ITEMS_QUERY = {
21
+ type: "object",
22
+ additionalProperties: false,
23
+ properties: {
24
+ after: { type: "string" },
25
+ limit: { type: "integer", minimum: 1, maximum: MAX_PAGE_LIMIT },
26
+ order: { type: "string", enum: ["asc", "desc"] },
27
+ include: EMPTY_INCLUDE,
28
+ },
29
+ };
30
+ export function registerResponseRoutes(app, context) {
31
+ const { service } = context;
32
+ /** Cancel `live` if the caller walks away before it is done (a synchronous or streamed request). */
33
+ function cancelOnDisconnect(request, live) {
34
+ const socket = request.raw.socket;
35
+ const onClose = () => {
36
+ if (!live.terminal)
37
+ void service.cancel(live);
38
+ };
39
+ socket.once("close", onClose);
40
+ return () => socket.off("close", onClose);
41
+ }
42
+ app.post("/v1/responses", async (request, reply) => {
43
+ const create = validateCreateRequest(request.body, "http");
44
+ const input = parseInput(create.input);
45
+ const live = await service.create(request.principal, create, input);
46
+ request.auditConversationId = live.record.conversation_id;
47
+ if (create.stream) {
48
+ const stopWatching = create.background ? () => undefined : cancelOnDisconnect(request, live);
49
+ reply.hijack();
50
+ openEventStream(reply.raw);
51
+ try {
52
+ await pumpEvents(live, 0, reply.raw);
53
+ }
54
+ finally {
55
+ stopWatching();
56
+ reply.raw.end();
57
+ context.auditHijacked(request, 200);
58
+ }
59
+ return reply;
60
+ }
61
+ if (create.background)
62
+ return live.snapshot();
63
+ // Synchronous: the caller waits for the end, and leaving cancels the work.
64
+ const stopWatching = cancelOnDisconnect(request, live);
65
+ try {
66
+ await live.whenEnded();
67
+ }
68
+ finally {
69
+ stopWatching();
70
+ }
71
+ return live.snapshot();
72
+ });
73
+ app.get("/v1/responses/:id", { schema: { querystring: RETRIEVE_QUERY } }, async (request, reply) => {
74
+ const record = service.recordFor(request.principal, request.params.id);
75
+ request.auditConversationId = record.conversation_id;
76
+ const live = service.getLive(record.id);
77
+ if (!request.query.stream)
78
+ return live ? live.snapshot() : toApiResponse(record);
79
+ if (!live?.replayable) {
80
+ return sendError(reply, badRequest("stream_not_available", "Only a response created with `background: true` and `stream: true` can be streamed again, and only for a few minutes after it ends.", "stream"));
81
+ }
82
+ const from = request.query.starting_after === undefined ? 0 : request.query.starting_after + 1;
83
+ reply.hijack();
84
+ openEventStream(reply.raw);
85
+ try {
86
+ await pumpEvents(live, from, reply.raw);
87
+ }
88
+ finally {
89
+ reply.raw.end();
90
+ context.auditHijacked(request, 200);
91
+ }
92
+ return reply;
93
+ });
94
+ app.post("/v1/responses/:id/cancel", async (request, reply) => {
95
+ const record = service.recordFor(request.principal, request.params.id);
96
+ request.auditConversationId = record.conversation_id;
97
+ if (!record.background) {
98
+ return sendError(reply, badRequest("invalid_value", "Only a response created with `background: true` can be cancelled. To cancel a synchronous or streamed request, close the connection."));
99
+ }
100
+ const live = service.getLive(record.id);
101
+ if (!live)
102
+ return toApiResponse(record);
103
+ await service.cancel(live);
104
+ return live.snapshot();
105
+ });
106
+ app.get("/v1/responses/:id/input_items", { schema: { querystring: INPUT_ITEMS_QUERY } }, async (request, reply) => {
107
+ const record = service.recordFor(request.principal, request.params.id);
108
+ request.auditConversationId = record.conversation_id;
109
+ try {
110
+ return paginate(record.input_items, defaultPage(request.query));
111
+ }
112
+ catch (error) {
113
+ if (error instanceof UnknownCursorError)
114
+ return sendError(reply, notFound(`Item ${error.message}`));
115
+ throw error;
116
+ }
117
+ });
118
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * `GET /v1/responses` upgraded to a WebSocket (spec 061, D14/D18/D19/D22). The connection carries
3
+ * `response.create` (the same request an HTTP call makes, always streamed) and `response.steer`
4
+ * (mid-turn steering). Named `stream_id` lanes run in parallel and each lane runs its responses one
5
+ * at a time; a steered response ends `incomplete` and its successor carries on on the same lane.
6
+ */
7
+ import type { FastifyInstance } from "fastify";
8
+ import type { RouteContext } from "../http.js";
9
+ export declare function registerWebSocketRoute(app: FastifyInstance, context: RouteContext): void;