@llblab/pi-kit 0.1.0

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 (523) hide show
  1. package/AGENTS.md +35 -0
  2. package/BACKLOG.md +3 -0
  3. package/CHANGELOG.md +9 -0
  4. package/LICENSE +21 -0
  5. package/README.md +43 -0
  6. package/node_modules/@llblab/pi-actors/AGENTS.md +150 -0
  7. package/node_modules/@llblab/pi-actors/BACKLOG.md +6 -0
  8. package/node_modules/@llblab/pi-actors/CHANGELOG.md +865 -0
  9. package/node_modules/@llblab/pi-actors/README.md +231 -0
  10. package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
  11. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/artifact-manifest.json +9 -0
  12. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-endpoint.json +6 -0
  13. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-record.json +9 -0
  14. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/recipe-summary.json +8 -0
  15. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/run-state.json +10 -0
  16. package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/trace-event.json +9 -0
  17. package/node_modules/@llblab/pi-actors/dist/index.d.ts +7 -0
  18. package/node_modules/@llblab/pi-actors/dist/index.js +17 -0
  19. package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +146 -0
  20. package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +800 -0
  21. package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +20 -0
  22. package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +103 -0
  23. package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +85 -0
  24. package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +804 -0
  25. package/node_modules/@llblab/pi-actors/dist/lib/config.d.ts +34 -0
  26. package/node_modules/@llblab/pi-actors/dist/lib/config.js +216 -0
  27. package/node_modules/@llblab/pi-actors/dist/lib/control-projection.d.ts +20 -0
  28. package/node_modules/@llblab/pi-actors/dist/lib/control-projection.js +66 -0
  29. package/node_modules/@llblab/pi-actors/dist/lib/control.d.ts +15 -0
  30. package/node_modules/@llblab/pi-actors/dist/lib/control.js +97 -0
  31. package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.d.ts +65 -0
  32. package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.js +610 -0
  33. package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.d.ts +35 -0
  34. package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.js +126 -0
  35. package/node_modules/@llblab/pi-actors/dist/lib/draft-review.d.ts +56 -0
  36. package/node_modules/@llblab/pi-actors/dist/lib/draft-review.js +254 -0
  37. package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.d.ts +65 -0
  38. package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.js +467 -0
  39. package/node_modules/@llblab/pi-actors/dist/lib/execution-output.d.ts +25 -0
  40. package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +88 -0
  41. package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +17 -0
  42. package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +85 -0
  43. package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +99 -0
  44. package/node_modules/@llblab/pi-actors/dist/lib/execution.js +725 -0
  45. package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +21 -0
  46. package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +141 -0
  47. package/node_modules/@llblab/pi-actors/dist/lib/file-state.d.ts +18 -0
  48. package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +310 -0
  49. package/node_modules/@llblab/pi-actors/dist/lib/identity.d.ts +9 -0
  50. package/node_modules/@llblab/pi-actors/dist/lib/identity.js +27 -0
  51. package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +16 -0
  52. package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +57 -0
  53. package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.d.ts +7 -0
  54. package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +37 -0
  55. package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +100 -0
  56. package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +824 -0
  57. package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -0
  58. package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +136 -0
  59. package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +28 -0
  60. package/node_modules/@llblab/pi-actors/dist/lib/limits.js +28 -0
  61. package/node_modules/@llblab/pi-actors/dist/lib/model-context.d.ts +56 -0
  62. package/node_modules/@llblab/pi-actors/dist/lib/model-context.js +220 -0
  63. package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +186 -0
  64. package/node_modules/@llblab/pi-actors/dist/lib/observability.js +951 -0
  65. package/node_modules/@llblab/pi-actors/dist/lib/paths.d.ts +27 -0
  66. package/node_modules/@llblab/pi-actors/dist/lib/paths.js +72 -0
  67. package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +19 -0
  68. package/node_modules/@llblab/pi-actors/dist/lib/pi.js +21 -0
  69. package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.d.ts +27 -0
  70. package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.js +86 -0
  71. package/node_modules/@llblab/pi-actors/dist/lib/prompts.d.ts +24 -0
  72. package/node_modules/@llblab/pi-actors/dist/lib/prompts.js +49 -0
  73. package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.d.ts +7 -0
  74. package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.js +43 -0
  75. package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +36 -0
  76. package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +197 -0
  77. package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.d.ts +77 -0
  78. package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.js +783 -0
  79. package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.d.ts +113 -0
  80. package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.js +1108 -0
  81. package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.d.ts +21 -0
  82. package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.js +494 -0
  83. package/node_modules/@llblab/pi-actors/dist/lib/registry.d.ts +67 -0
  84. package/node_modules/@llblab/pi-actors/dist/lib/registry.js +504 -0
  85. package/node_modules/@llblab/pi-actors/dist/lib/review-control.d.ts +14 -0
  86. package/node_modules/@llblab/pi-actors/dist/lib/review-control.js +110 -0
  87. package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.d.ts +11 -0
  88. package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.js +148 -0
  89. package/node_modules/@llblab/pi-actors/dist/lib/review-projection.d.ts +14 -0
  90. package/node_modules/@llblab/pi-actors/dist/lib/review-projection.js +166 -0
  91. package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.d.ts +95 -0
  92. package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.js +177 -0
  93. package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +18 -0
  94. package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +125 -0
  95. package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +21 -0
  96. package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -0
  97. package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.d.ts +28 -0
  98. package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +150 -0
  99. package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +21 -0
  100. package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +89 -0
  101. package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.d.ts +39 -0
  102. package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +283 -0
  103. package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.d.ts +5 -0
  104. package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.js +11 -0
  105. package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +27 -0
  106. package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +142 -0
  107. package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +7 -0
  108. package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +96 -0
  109. package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.d.ts +51 -0
  110. package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.js +172 -0
  111. package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +22 -0
  112. package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +125 -0
  113. package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +18 -0
  114. package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +108 -0
  115. package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +12 -0
  116. package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +68 -0
  117. package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +10 -0
  118. package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +68 -0
  119. package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +48 -0
  120. package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +491 -0
  121. package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.d.ts +7 -0
  122. package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.js +35 -0
  123. package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.d.ts +29 -0
  124. package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.js +60 -0
  125. package/node_modules/@llblab/pi-actors/dist/lib/runtime.d.ts +69 -0
  126. package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +339 -0
  127. package/node_modules/@llblab/pi-actors/dist/lib/schema.d.ts +60 -0
  128. package/node_modules/@llblab/pi-actors/dist/lib/schema.js +428 -0
  129. package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +45 -0
  130. package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +204 -0
  131. package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +21 -0
  132. package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +74 -0
  133. package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +10 -0
  134. package/node_modules/@llblab/pi-actors/dist/lib/temp.js +90 -0
  135. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.d.ts +27 -0
  136. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.js +597 -0
  137. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.d.ts +24 -0
  138. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.js +98 -0
  139. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.d.ts +80 -0
  140. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.js +494 -0
  141. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.d.ts +50 -0
  142. package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.js +362 -0
  143. package/node_modules/@llblab/pi-actors/dist/lib/tool-review.d.ts +56 -0
  144. package/node_modules/@llblab/pi-actors/dist/lib/tool-review.js +197 -0
  145. package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +19 -0
  146. package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +44 -0
  147. package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +15 -0
  148. package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +532 -0
  149. package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +17 -0
  150. package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +191 -0
  151. package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +9 -0
  152. package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +139 -0
  153. package/node_modules/@llblab/pi-actors/dist/lib/tools-register.d.ts +18 -0
  154. package/node_modules/@llblab/pi-actors/dist/lib/tools-register.js +41 -0
  155. package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +20 -0
  156. package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +243 -0
  157. package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +15 -0
  158. package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +133 -0
  159. package/node_modules/@llblab/pi-actors/dist/lib/tools.d.ts +28 -0
  160. package/node_modules/@llblab/pi-actors/dist/lib/tools.js +49 -0
  161. package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +22 -0
  162. package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +231 -0
  163. package/node_modules/@llblab/pi-actors/dist/pi-actors/index.js +1 -0
  164. package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +555 -0
  165. package/node_modules/@llblab/pi-actors/dist/scripts/build-dist.mjs +60 -0
  166. package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +63 -0
  167. package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +126 -0
  168. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/command-validate.json +13 -0
  169. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/jsonl-tail.json +10 -0
  170. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/recipe-validate.json +11 -0
  171. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker-snapshot.json +11 -0
  172. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker.json +25 -0
  173. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-ops-snapshot.json +15 -0
  174. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-state-files.json +13 -0
  175. package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-summary.json +9 -0
  176. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +44 -0
  177. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/persistent-tools.md +76 -0
  178. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/recipes.md +51 -0
  179. package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +41 -0
  180. package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/resource-locker.mjs +425 -0
  181. package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/run-utils.mjs +164 -0
  182. package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/validate-recipe.mjs +370 -0
  183. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/SKILL.md +33 -0
  184. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/bundle.json +77 -0
  185. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/file-write.json +14 -0
  186. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/manifest.json +14 -0
  187. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/report.json +39 -0
  188. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/write.json +53 -0
  189. package/node_modules/@llblab/pi-actors/dist/skills/artifacts/scripts/artifact-utils.mjs +63 -0
  190. package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +57 -0
  191. package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +360 -0
  192. package/node_modules/@llblab/pi-actors/dist/skills/music-player/recipes/playback.json +29 -0
  193. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +143 -0
  194. package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +1446 -0
  195. package/node_modules/@llblab/pi-actors/dist/skills/project-work/SKILL.md +37 -0
  196. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-head.json +11 -0
  197. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-section.json +11 -0
  198. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/docs-maintenance.json +66 -0
  199. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-log.json +11 -0
  200. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-status.json +9 -0
  201. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/markdown-index.json +14 -0
  202. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/package-summary.json +9 -0
  203. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-readiness.json +115 -0
  204. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-summary.json +74 -0
  205. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/repo-health.json +75 -0
  206. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/run-ops.json +56 -0
  207. package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/skill-summary.json +11 -0
  208. package/node_modules/@llblab/pi-actors/dist/skills/project-work/scripts/project-utils.mjs +89 -0
  209. package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/SKILL.md +36 -0
  210. package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/draft-review.json +14 -0
  211. package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/tool-review.json +14 -0
  212. package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +84 -0
  213. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/architect.json +82 -0
  214. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/checkpoint-continuation.json +51 -0
  215. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/development-tasking.json +67 -0
  216. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/lens-review.json +63 -0
  217. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/quorum-review.json +65 -0
  218. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/research-synthesis.json +81 -0
  219. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/review-readiness.json +59 -0
  220. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-artifact.json +21 -0
  221. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-checkpoint.json +21 -0
  222. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-conflict-report.json +19 -0
  223. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
  224. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-critic.json +22 -0
  225. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-evidence-map.json +20 -0
  226. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-followup.json +21 -0
  227. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-judge.json +22 -0
  228. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-merge.json +24 -0
  229. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-normalize.json +20 -0
  230. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-plan.json +20 -0
  231. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-preflight.json +18 -0
  232. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompt.json +16 -0
  233. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompts.json +39 -0
  234. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-quorum.json +31 -0
  235. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
  236. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review.json +26 -0
  237. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-task-card.json +22 -0
  238. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-tools.json +15 -0
  239. package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-verify.json +23 -0
  240. package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +189 -0
  241. package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/review-swarms.md +115 -0
  242. package/node_modules/@llblab/pi-actors/docs/README.md +20 -0
  243. package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +50 -0
  244. package/node_modules/@llblab/pi-actors/docs/async-runs.md +141 -0
  245. package/node_modules/@llblab/pi-actors/docs/command-templates.md +321 -0
  246. package/node_modules/@llblab/pi-actors/docs/recipe-library.md +89 -0
  247. package/node_modules/@llblab/pi-actors/docs/releasing.md +28 -0
  248. package/node_modules/@llblab/pi-actors/docs/template-recipes.md +175 -0
  249. package/node_modules/@llblab/pi-actors/docs/tool-registry.md +90 -0
  250. package/node_modules/@llblab/pi-actors/fixtures/protocol/artifact-manifest.json +9 -0
  251. package/node_modules/@llblab/pi-actors/fixtures/protocol/control-endpoint.json +6 -0
  252. package/node_modules/@llblab/pi-actors/fixtures/protocol/control-record.json +9 -0
  253. package/node_modules/@llblab/pi-actors/fixtures/protocol/recipe-summary.json +8 -0
  254. package/node_modules/@llblab/pi-actors/fixtures/protocol/run-state.json +10 -0
  255. package/node_modules/@llblab/pi-actors/fixtures/protocol/trace-event.json +9 -0
  256. package/node_modules/@llblab/pi-actors/index.ts +30 -0
  257. package/node_modules/@llblab/pi-actors/lib/async-runs.ts +1245 -0
  258. package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +148 -0
  259. package/node_modules/@llblab/pi-actors/lib/command-templates.ts +1116 -0
  260. package/node_modules/@llblab/pi-actors/lib/config.ts +261 -0
  261. package/node_modules/@llblab/pi-actors/lib/control-projection.ts +105 -0
  262. package/node_modules/@llblab/pi-actors/lib/control.ts +117 -0
  263. package/node_modules/@llblab/pi-actors/lib/draft-consolidation-transaction.ts +821 -0
  264. package/node_modules/@llblab/pi-actors/lib/draft-consolidation.ts +181 -0
  265. package/node_modules/@llblab/pi-actors/lib/draft-review.ts +325 -0
  266. package/node_modules/@llblab/pi-actors/lib/draft-sleep.ts +575 -0
  267. package/node_modules/@llblab/pi-actors/lib/execution-output.ts +123 -0
  268. package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +111 -0
  269. package/node_modules/@llblab/pi-actors/lib/execution.ts +1153 -0
  270. package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +181 -0
  271. package/node_modules/@llblab/pi-actors/lib/file-state.ts +306 -0
  272. package/node_modules/@llblab/pi-actors/lib/identity.ts +29 -0
  273. package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +79 -0
  274. package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +54 -0
  275. package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +901 -0
  276. package/node_modules/@llblab/pi-actors/lib/inspector.ts +204 -0
  277. package/node_modules/@llblab/pi-actors/lib/limits.ts +29 -0
  278. package/node_modules/@llblab/pi-actors/lib/model-context.ts +359 -0
  279. package/node_modules/@llblab/pi-actors/lib/observability.ts +1337 -0
  280. package/node_modules/@llblab/pi-actors/lib/paths.ts +111 -0
  281. package/node_modules/@llblab/pi-actors/lib/pi.ts +47 -0
  282. package/node_modules/@llblab/pi-actors/lib/preflight-diagnostics.ts +132 -0
  283. package/node_modules/@llblab/pi-actors/lib/prompts.ts +69 -0
  284. package/node_modules/@llblab/pi-actors/lib/recipe-control.ts +52 -0
  285. package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +268 -0
  286. package/node_modules/@llblab/pi-actors/lib/recipes-discovery.ts +1060 -0
  287. package/node_modules/@llblab/pi-actors/lib/recipes-references.ts +1598 -0
  288. package/node_modules/@llblab/pi-actors/lib/recipes-usage.ts +638 -0
  289. package/node_modules/@llblab/pi-actors/lib/registry.ts +806 -0
  290. package/node_modules/@llblab/pi-actors/lib/review-control.ts +136 -0
  291. package/node_modules/@llblab/pi-actors/lib/review-diagnostics.ts +164 -0
  292. package/node_modules/@llblab/pi-actors/lib/review-projection.ts +196 -0
  293. package/node_modules/@llblab/pi-actors/lib/run-evidence-policy.ts +242 -0
  294. package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +155 -0
  295. package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +96 -0
  296. package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +209 -0
  297. package/node_modules/@llblab/pi-actors/lib/runs-control.ts +148 -0
  298. package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +282 -0
  299. package/node_modules/@llblab/pi-actors/lib/runs-identity.ts +14 -0
  300. package/node_modules/@llblab/pi-actors/lib/runs-index.ts +192 -0
  301. package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +136 -0
  302. package/node_modules/@llblab/pi-actors/lib/runs-parent-teardown.ts +257 -0
  303. package/node_modules/@llblab/pi-actors/lib/runs-process.ts +174 -0
  304. package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +140 -0
  305. package/node_modules/@llblab/pi-actors/lib/runs-start.ts +113 -0
  306. package/node_modules/@llblab/pi-actors/lib/runs-status.ts +101 -0
  307. package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +611 -0
  308. package/node_modules/@llblab/pi-actors/lib/runtime-identity.ts +39 -0
  309. package/node_modules/@llblab/pi-actors/lib/runtime-triage.ts +106 -0
  310. package/node_modules/@llblab/pi-actors/lib/runtime.ts +430 -0
  311. package/node_modules/@llblab/pi-actors/lib/schema.ts +525 -0
  312. package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +302 -0
  313. package/node_modules/@llblab/pi-actors/lib/state-readers.ts +93 -0
  314. package/node_modules/@llblab/pi-actors/lib/temp.ts +99 -0
  315. package/node_modules/@llblab/pi-actors/lib/tool-review-lineage-transaction.ts +881 -0
  316. package/node_modules/@llblab/pi-actors/lib/tool-review-lineage.ts +145 -0
  317. package/node_modules/@llblab/pi-actors/lib/tool-review-scheduler.ts +635 -0
  318. package/node_modules/@llblab/pi-actors/lib/tool-review-transaction.ts +563 -0
  319. package/node_modules/@llblab/pi-actors/lib/tool-review.ts +270 -0
  320. package/node_modules/@llblab/pi-actors/lib/tools-access.ts +68 -0
  321. package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +673 -0
  322. package/node_modules/@llblab/pi-actors/lib/tools-local.ts +303 -0
  323. package/node_modules/@llblab/pi-actors/lib/tools-message.ts +176 -0
  324. package/node_modules/@llblab/pi-actors/lib/tools-register.ts +63 -0
  325. package/node_modules/@llblab/pi-actors/lib/tools-response.ts +285 -0
  326. package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +212 -0
  327. package/node_modules/@llblab/pi-actors/lib/tools.ts +88 -0
  328. package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +306 -0
  329. package/node_modules/@llblab/pi-actors/package.json +76 -0
  330. package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +555 -0
  331. package/node_modules/@llblab/pi-actors/scripts/build-dist.mjs +60 -0
  332. package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +63 -0
  333. package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +126 -0
  334. package/node_modules/@llblab/pi-actors/skills/actors/recipes/command-validate.json +13 -0
  335. package/node_modules/@llblab/pi-actors/skills/actors/recipes/jsonl-tail.json +10 -0
  336. package/node_modules/@llblab/pi-actors/skills/actors/recipes/recipe-validate.json +11 -0
  337. package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker-snapshot.json +11 -0
  338. package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker.json +25 -0
  339. package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-ops-snapshot.json +15 -0
  340. package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-state-files.json +13 -0
  341. package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-summary.json +9 -0
  342. package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +44 -0
  343. package/node_modules/@llblab/pi-actors/skills/actors/references/persistent-tools.md +76 -0
  344. package/node_modules/@llblab/pi-actors/skills/actors/references/recipes.md +51 -0
  345. package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +41 -0
  346. package/node_modules/@llblab/pi-actors/skills/actors/scripts/resource-locker.mjs +425 -0
  347. package/node_modules/@llblab/pi-actors/skills/actors/scripts/run-utils.mjs +164 -0
  348. package/node_modules/@llblab/pi-actors/skills/actors/scripts/validate-recipe.mjs +370 -0
  349. package/node_modules/@llblab/pi-actors/skills/artifacts/SKILL.md +33 -0
  350. package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/bundle.json +77 -0
  351. package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/file-write.json +14 -0
  352. package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/manifest.json +14 -0
  353. package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/report.json +39 -0
  354. package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/write.json +53 -0
  355. package/node_modules/@llblab/pi-actors/skills/artifacts/scripts/artifact-utils.mjs +63 -0
  356. package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +57 -0
  357. package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +360 -0
  358. package/node_modules/@llblab/pi-actors/skills/music-player/recipes/playback.json +29 -0
  359. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +143 -0
  360. package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +1446 -0
  361. package/node_modules/@llblab/pi-actors/skills/project-work/SKILL.md +37 -0
  362. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-head.json +11 -0
  363. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-section.json +11 -0
  364. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/docs-maintenance.json +66 -0
  365. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-log.json +11 -0
  366. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-status.json +9 -0
  367. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/markdown-index.json +14 -0
  368. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/package-summary.json +9 -0
  369. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-readiness.json +115 -0
  370. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-summary.json +74 -0
  371. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/repo-health.json +75 -0
  372. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/run-ops.json +56 -0
  373. package/node_modules/@llblab/pi-actors/skills/project-work/recipes/skill-summary.json +11 -0
  374. package/node_modules/@llblab/pi-actors/skills/project-work/scripts/project-utils.mjs +89 -0
  375. package/node_modules/@llblab/pi-actors/skills/recipe-memory/SKILL.md +36 -0
  376. package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/draft-review.json +14 -0
  377. package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/tool-review.json +14 -0
  378. package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +84 -0
  379. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/architect.json +82 -0
  380. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/checkpoint-continuation.json +51 -0
  381. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/development-tasking.json +67 -0
  382. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/lens-review.json +63 -0
  383. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/quorum-review.json +65 -0
  384. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/research-synthesis.json +81 -0
  385. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/review-readiness.json +59 -0
  386. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-artifact.json +21 -0
  387. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-checkpoint.json +21 -0
  388. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-conflict-report.json +19 -0
  389. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
  390. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-critic.json +22 -0
  391. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-evidence-map.json +20 -0
  392. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-followup.json +21 -0
  393. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-judge.json +22 -0
  394. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-merge.json +24 -0
  395. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-normalize.json +20 -0
  396. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-plan.json +20 -0
  397. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-preflight.json +18 -0
  398. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompt.json +16 -0
  399. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompts.json +39 -0
  400. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-quorum.json +31 -0
  401. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
  402. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review.json +26 -0
  403. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-task-card.json +22 -0
  404. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-tools.json +15 -0
  405. package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-verify.json +23 -0
  406. package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +189 -0
  407. package/node_modules/@llblab/pi-actors/skills/swarm/references/review-swarms.md +115 -0
  408. package/node_modules/@llblab/pi-codex-usage/AGENTS.md +17 -0
  409. package/node_modules/@llblab/pi-codex-usage/BACKLOG.md +8 -0
  410. package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +80 -0
  411. package/node_modules/@llblab/pi-codex-usage/LICENSE +22 -0
  412. package/node_modules/@llblab/pi-codex-usage/README.md +113 -0
  413. package/node_modules/@llblab/pi-codex-usage/banner.jpg +0 -0
  414. package/node_modules/@llblab/pi-codex-usage/index.ts +1525 -0
  415. package/node_modules/@llblab/pi-codex-usage/package.json +59 -0
  416. package/node_modules/@llblab/pi-grow-loop/AGENTS.md +56 -0
  417. package/node_modules/@llblab/pi-grow-loop/BACKLOG.md +3 -0
  418. package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +126 -0
  419. package/node_modules/@llblab/pi-grow-loop/README.md +216 -0
  420. package/node_modules/@llblab/pi-grow-loop/banner.jpg +0 -0
  421. package/node_modules/@llblab/pi-grow-loop/index.ts +219 -0
  422. package/node_modules/@llblab/pi-grow-loop/package.json +64 -0
  423. package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +131 -0
  424. package/node_modules/@llblab/pi-grow-loop/skills/while-true/SKILL.md +233 -0
  425. package/node_modules/@llblab/pi-telegram/AGENTS.md +157 -0
  426. package/node_modules/@llblab/pi-telegram/BACKLOG.md +15 -0
  427. package/node_modules/@llblab/pi-telegram/CHANGELOG.md +886 -0
  428. package/node_modules/@llblab/pi-telegram/README.md +330 -0
  429. package/node_modules/@llblab/pi-telegram/api/activity.ts +15 -0
  430. package/node_modules/@llblab/pi-telegram/api/commands.ts +11 -0
  431. package/node_modules/@llblab/pi-telegram/api/delivery.ts +21 -0
  432. package/node_modules/@llblab/pi-telegram/api/inbound.ts +14 -0
  433. package/node_modules/@llblab/pi-telegram/api/keyboard.ts +11 -0
  434. package/node_modules/@llblab/pi-telegram/api/outbound.ts +11 -0
  435. package/node_modules/@llblab/pi-telegram/api/sections.ts +17 -0
  436. package/node_modules/@llblab/pi-telegram/api/status.ts +12 -0
  437. package/node_modules/@llblab/pi-telegram/api/updates.ts +16 -0
  438. package/node_modules/@llblab/pi-telegram/api/voice.ts +24 -0
  439. package/node_modules/@llblab/pi-telegram/docs/README.md +25 -0
  440. package/node_modules/@llblab/pi-telegram/docs/activity.md +304 -0
  441. package/node_modules/@llblab/pi-telegram/docs/architecture.md +418 -0
  442. package/node_modules/@llblab/pi-telegram/docs/callback-namespaces.md +48 -0
  443. package/node_modules/@llblab/pi-telegram/docs/command-templates.md +365 -0
  444. package/node_modules/@llblab/pi-telegram/docs/compact-matrix-literal.md +176 -0
  445. package/node_modules/@llblab/pi-telegram/docs/delivery.md +225 -0
  446. package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +310 -0
  447. package/node_modules/@llblab/pi-telegram/docs/inbound.md +136 -0
  448. package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +467 -0
  449. package/node_modules/@llblab/pi-telegram/docs/outbound.md +193 -0
  450. package/node_modules/@llblab/pi-telegram/docs/public-api.md +599 -0
  451. package/node_modules/@llblab/pi-telegram/docs/sections.md +452 -0
  452. package/node_modules/@llblab/pi-telegram/docs/ui-style.md +256 -0
  453. package/node_modules/@llblab/pi-telegram/docs/updates.md +171 -0
  454. package/node_modules/@llblab/pi-telegram/docs/voice.md +217 -0
  455. package/node_modules/@llblab/pi-telegram/index.ts +1336 -0
  456. package/node_modules/@llblab/pi-telegram/lib/activity-verbosity.ts +714 -0
  457. package/node_modules/@llblab/pi-telegram/lib/activity.ts +782 -0
  458. package/node_modules/@llblab/pi-telegram/lib/agent-messages.ts +121 -0
  459. package/node_modules/@llblab/pi-telegram/lib/bindings.ts +1129 -0
  460. package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +379 -0
  461. package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +1941 -0
  462. package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +2119 -0
  463. package/node_modules/@llblab/pi-telegram/lib/bus-transport.ts +244 -0
  464. package/node_modules/@llblab/pi-telegram/lib/bus.ts +2645 -0
  465. package/node_modules/@llblab/pi-telegram/lib/command-templates.ts +954 -0
  466. package/node_modules/@llblab/pi-telegram/lib/commands.ts +1854 -0
  467. package/node_modules/@llblab/pi-telegram/lib/config.ts +1143 -0
  468. package/node_modules/@llblab/pi-telegram/lib/delivery.ts +891 -0
  469. package/node_modules/@llblab/pi-telegram/lib/generative-app-worker.mjs +104 -0
  470. package/node_modules/@llblab/pi-telegram/lib/generative-apps.ts +958 -0
  471. package/node_modules/@llblab/pi-telegram/lib/inbound.ts +824 -0
  472. package/node_modules/@llblab/pi-telegram/lib/journal.ts +3140 -0
  473. package/node_modules/@llblab/pi-telegram/lib/keyboard.ts +59 -0
  474. package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +623 -0
  475. package/node_modules/@llblab/pi-telegram/lib/locks.ts +1422 -0
  476. package/node_modules/@llblab/pi-telegram/lib/logs.ts +393 -0
  477. package/node_modules/@llblab/pi-telegram/lib/media.ts +921 -0
  478. package/node_modules/@llblab/pi-telegram/lib/menu-model.ts +1182 -0
  479. package/node_modules/@llblab/pi-telegram/lib/menu-queue.ts +926 -0
  480. package/node_modules/@llblab/pi-telegram/lib/menu-settings.ts +876 -0
  481. package/node_modules/@llblab/pi-telegram/lib/menu-status.ts +274 -0
  482. package/node_modules/@llblab/pi-telegram/lib/menu-thinking.ts +185 -0
  483. package/node_modules/@llblab/pi-telegram/lib/menu.ts +867 -0
  484. package/node_modules/@llblab/pi-telegram/lib/model.ts +672 -0
  485. package/node_modules/@llblab/pi-telegram/lib/outbound-attachments.ts +981 -0
  486. package/node_modules/@llblab/pi-telegram/lib/outbound-buttons.ts +331 -0
  487. package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +515 -0
  488. package/node_modules/@llblab/pi-telegram/lib/outbound-voice.ts +285 -0
  489. package/node_modules/@llblab/pi-telegram/lib/outbound.ts +1007 -0
  490. package/node_modules/@llblab/pi-telegram/lib/ownership.ts +298 -0
  491. package/node_modules/@llblab/pi-telegram/lib/paths.ts +127 -0
  492. package/node_modules/@llblab/pi-telegram/lib/pi.ts +197 -0
  493. package/node_modules/@llblab/pi-telegram/lib/polling.ts +1588 -0
  494. package/node_modules/@llblab/pi-telegram/lib/preview.ts +846 -0
  495. package/node_modules/@llblab/pi-telegram/lib/prompt-templates.ts +158 -0
  496. package/node_modules/@llblab/pi-telegram/lib/prompts.ts +218 -0
  497. package/node_modules/@llblab/pi-telegram/lib/queue.ts +3075 -0
  498. package/node_modules/@llblab/pi-telegram/lib/recovery.ts +464 -0
  499. package/node_modules/@llblab/pi-telegram/lib/rendering.ts +1213 -0
  500. package/node_modules/@llblab/pi-telegram/lib/replies.ts +892 -0
  501. package/node_modules/@llblab/pi-telegram/lib/routing.ts +2889 -0
  502. package/node_modules/@llblab/pi-telegram/lib/runtime.ts +628 -0
  503. package/node_modules/@llblab/pi-telegram/lib/sections.ts +710 -0
  504. package/node_modules/@llblab/pi-telegram/lib/setup.ts +220 -0
  505. package/node_modules/@llblab/pi-telegram/lib/skills.ts +21 -0
  506. package/node_modules/@llblab/pi-telegram/lib/status.ts +1550 -0
  507. package/node_modules/@llblab/pi-telegram/lib/sync.ts +883 -0
  508. package/node_modules/@llblab/pi-telegram/lib/target.ts +49 -0
  509. package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +1747 -0
  510. package/node_modules/@llblab/pi-telegram/lib/text-groups.ts +487 -0
  511. package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +1002 -0
  512. package/node_modules/@llblab/pi-telegram/lib/threads.ts +3183 -0
  513. package/node_modules/@llblab/pi-telegram/lib/time-injection.ts +78 -0
  514. package/node_modules/@llblab/pi-telegram/lib/turns.ts +753 -0
  515. package/node_modules/@llblab/pi-telegram/lib/updates.ts +4950 -0
  516. package/node_modules/@llblab/pi-telegram/lib/voice.ts +340 -0
  517. package/node_modules/@llblab/pi-telegram/package.json +83 -0
  518. package/node_modules/@llblab/pi-telegram/screenshot.png +0 -0
  519. package/node_modules/@llblab/pi-telegram/scripts/check-downgrade.mjs +435 -0
  520. package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/SKILL.md +241 -0
  521. package/node_modules/@llblab/pi-telegram/skills/generative-apps/SKILL.md +114 -0
  522. package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +149 -0
  523. package/package.json +67 -0
@@ -0,0 +1,1143 @@
1
+ /**
2
+ * Telegram bridge config and pairing helpers
3
+ * Zones: telegram config, pairing, filesystem
4
+ * Owns persisted bot/session pairing state, local config storage, live config controls, authorization policy, and first-user pairing side effects
5
+ */
6
+
7
+ import { randomUUID } from "node:crypto";
8
+ import {
9
+ chmodSync,
10
+ existsSync,
11
+ mkdirSync,
12
+ readFileSync,
13
+ renameSync,
14
+ statSync,
15
+ unlinkSync,
16
+ writeFileSync,
17
+ } from "node:fs";
18
+ import { chmod, mkdir, rename, writeFile } from "node:fs/promises";
19
+ import {
20
+ resolveAgentDir,
21
+ resolveTelegramConfigPath,
22
+ TELEGRAM_DEFAULT_PROFILE_NAME,
23
+ } from "./paths.ts";
24
+ export { TELEGRAM_DEFAULT_PROFILE_NAME } from "./paths.ts";
25
+
26
+ import type { CommandTemplateObjectConfig } from "./command-templates.ts";
27
+ import type { TelegramInboundHandlerConfig } from "./inbound.ts";
28
+ import { withTelegramFileTransaction } from "./locks.ts";
29
+
30
+ const CONFIG_RUNTIME_KEY = "__piTelegramConfigRuntime__";
31
+ const CONFIG_REPLACE_RETRY_ATTEMPTS = 5;
32
+ const CONFIG_REPLACE_RETRY_DELAY_MS = 25;
33
+
34
+ function isRetryableConfigReplaceError(error: unknown): boolean {
35
+ const code = (error as { code?: unknown })?.code;
36
+ return code === "EPERM" || code === "EACCES" || code === "EBUSY";
37
+ }
38
+
39
+ function sleepConfigReplaceRetry(ms: number): void {
40
+ if (ms <= 0) return;
41
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
42
+ }
43
+
44
+ function replaceTelegramConfigFile(tempPath: string, configPath: string): void {
45
+ for (let attempt = 0; attempt < CONFIG_REPLACE_RETRY_ATTEMPTS; attempt += 1) {
46
+ try {
47
+ renameSync(tempPath, configPath);
48
+ return;
49
+ } catch (error) {
50
+ if (
51
+ !isRetryableConfigReplaceError(error) ||
52
+ attempt === CONFIG_REPLACE_RETRY_ATTEMPTS - 1
53
+ ) {
54
+ throw error;
55
+ }
56
+ sleepConfigReplaceRetry(CONFIG_REPLACE_RETRY_DELAY_MS * (attempt + 1));
57
+ }
58
+ }
59
+ }
60
+
61
+ function getConfigPath(): string {
62
+ return resolveTelegramConfigPath();
63
+ }
64
+
65
+ export type TelegramOutboundCommandTemplateConfig =
66
+ string | CommandTemplateObjectConfig;
67
+ export interface TelegramOutboundHandlerConfig extends CommandTemplateObjectConfig {
68
+ type?: string;
69
+ match?: string | string[];
70
+ output?: string;
71
+ timeout?: number | string;
72
+ }
73
+
74
+ export type TelegramTimeMode = "hidden" | "always" | "interval";
75
+
76
+ export interface TelegramTimeConfig {
77
+ interval?: number;
78
+ }
79
+
80
+ export interface ResolvedTelegramTimeConfig {
81
+ injectionMode: TelegramTimeMode;
82
+ interval: number;
83
+ timezone: string;
84
+ }
85
+
86
+ export type TelegramAssistantRenderingMode = "rich" | "html";
87
+ export type TelegramActivityVerbosity =
88
+ | "quiet"
89
+ | "thinking"
90
+ | "tools"
91
+ | "verbose";
92
+
93
+ export interface TelegramConfig {
94
+ /** @deprecated persisted identity belongs in profiles.default; retained for effective/legacy views */
95
+ botToken?: string;
96
+ /** @deprecated persisted identity belongs in profiles.default; retained for effective/legacy views */
97
+ botUsername?: string;
98
+ /** @deprecated persisted identity belongs in profiles.default; retained for effective/legacy views */
99
+ botId?: number;
100
+ /** @deprecated persisted identity belongs in profiles.default; retained for effective/legacy views */
101
+ allowedUserId?: number;
102
+ /** @deprecated persisted identity belongs in profiles.default; retained for effective/legacy views */
103
+ lastUpdateId?: number;
104
+ inboundHandlers?: TelegramInboundHandlerConfig[];
105
+ attachmentHandlers?: TelegramInboundHandlerConfig[];
106
+ outboundHandlers?: TelegramOutboundHandlerConfig[];
107
+ assistant?: {
108
+ draftPreviews?: boolean;
109
+ rendering?: TelegramAssistantRenderingMode;
110
+ proactivePush?: boolean;
111
+ activity?: TelegramActivityVerbosity;
112
+ timeInjection?: TelegramTimeMode;
113
+ /** @deprecated use activity */
114
+ activityVerbosity?: TelegramActivityVerbosity;
115
+ };
116
+ /** @deprecated use assistant.draftPreviews */
117
+ draftPreviews?: boolean;
118
+ /** @deprecated use assistant.draftPreviews */
119
+ richDraftPreviews?: boolean;
120
+ /** @deprecated use assistant.rendering */
121
+ assistantRendering?: TelegramAssistantRenderingMode;
122
+ voice?: {
123
+ replyMode?: "hidden" | "mirror" | "always";
124
+ /** Whether to attach the provider's transcriptText as caption on voice messages */
125
+ sendTranscript?: boolean;
126
+ };
127
+ time?: TelegramTimeConfig;
128
+ threads?: {
129
+ /** Delete this instance's bound Telegram thread on graceful Pi quit. */
130
+ automaticCleanup?: boolean;
131
+ };
132
+ /** Canonical bot/session profiles, including profiles.default. */
133
+ profiles?: Record<string, TelegramBotProfile>;
134
+ }
135
+
136
+ /**
137
+ * Per-profile bot/session identity fields.
138
+ * Stored under `profiles.<name>` in telegram.json.
139
+ * Shared bridge settings (inboundHandlers, outboundHandlers, voice, time,
140
+ * assistant) stay at the top level.
141
+ */
142
+ export interface TelegramBotProfile {
143
+ botToken: string;
144
+ botUsername?: string;
145
+ botId?: number;
146
+ allowedUserId?: number;
147
+ lastUpdateId?: number;
148
+ }
149
+
150
+ /** Profile names must contain only lowercase ASCII letters and digits; max 32 chars. */
151
+ const TELEGRAM_PROFILE_NAME_PATTERN = /^[a-z0-9]{1,32}$/;
152
+ const TELEGRAM_RESERVED_PROFILE_NAMES: ReadonlySet<string> = new Set([
153
+ "main",
154
+ "active",
155
+ ]);
156
+
157
+ export function isValidTelegramProfileName(name: string): boolean {
158
+ return (
159
+ TELEGRAM_PROFILE_NAME_PATTERN.test(name) &&
160
+ !TELEGRAM_RESERVED_PROFILE_NAMES.has(name)
161
+ );
162
+ }
163
+
164
+ /** List defined profile names. */
165
+ export function getTelegramProfileNames(config: TelegramConfig): string[] {
166
+ return Object.keys(config.profiles ?? {}).sort();
167
+ }
168
+
169
+ export interface TelegramConfigStore {
170
+ get: () => TelegramConfig;
171
+ getStoredConfig: () => TelegramConfig;
172
+ set: (config: TelegramConfig) => void;
173
+ setProfile: (profileName: string, profile: TelegramBotProfile) => void;
174
+ update: (mutate: (config: TelegramConfig) => void) => void;
175
+ activateProfile: (profileName: string | undefined) => boolean;
176
+ getActiveProfileName: () => string | undefined;
177
+ getBotToken: () => string | undefined;
178
+ hasBotToken: () => boolean;
179
+ getAllowedUserId: () => number | undefined;
180
+ getInboundHandlers: () => TelegramInboundHandlerConfig[] | undefined;
181
+ getAttachmentHandlers: () => TelegramInboundHandlerConfig[] | undefined;
182
+ getOutboundHandlers: () => TelegramOutboundHandlerConfig[] | undefined;
183
+ setAllowedUserId: (userId: number) => void;
184
+ load: () => Promise<void>;
185
+ didLastLoadRecoverInvalidConfig: () => boolean;
186
+ persist: (config?: TelegramConfig) => Promise<void>;
187
+ }
188
+
189
+ export function createTelegramConfigBotIdGetter(
190
+ store: Pick<TelegramConfigStore, "get">,
191
+ ): () => number | undefined {
192
+ return () => store.get().botId;
193
+ }
194
+
195
+ export function createTelegramActiveProfileKeyGetter(
196
+ store: Pick<TelegramConfigStore, "getActiveProfileName">,
197
+ ): () => string {
198
+ return () => store.getActiveProfileName() ?? TELEGRAM_DEFAULT_PROFILE_NAME;
199
+ }
200
+
201
+ export interface TelegramConfigStoreOptions {
202
+ initialConfig?: TelegramConfig;
203
+ agentDir?: string;
204
+ configPath?: string;
205
+ recordRuntimeEvent?: (
206
+ category: string,
207
+ error: unknown,
208
+ details?: Record<string, unknown>,
209
+ ) => void;
210
+ }
211
+
212
+ export interface TelegramInvalidConfigRecovery {
213
+ configPath: string;
214
+ recoveryPath: string;
215
+ error: unknown;
216
+ }
217
+
218
+ export interface TelegramConfigRuntime {
219
+ updateVoiceConfig: (voice: NonNullable<TelegramConfig["voice"]>) => void;
220
+ }
221
+
222
+ export function setGlobalTelegramConfigRuntime(
223
+ runtime: TelegramConfigRuntime | undefined,
224
+ ): void {
225
+ const globals = globalThis as Record<string, unknown>;
226
+ if (runtime) globals[CONFIG_RUNTIME_KEY] = runtime;
227
+ else delete globals[CONFIG_RUNTIME_KEY];
228
+ }
229
+
230
+ export function updateTelegramVoiceConfig(
231
+ voice: NonNullable<TelegramConfig["voice"]>,
232
+ ): boolean {
233
+ const runtime = (globalThis as Record<string, unknown>)[
234
+ CONFIG_RUNTIME_KEY
235
+ ] as TelegramConfigRuntime | undefined;
236
+ if (!runtime || typeof runtime.updateVoiceConfig !== "function") return false;
237
+ runtime.updateVoiceConfig(voice);
238
+ return true;
239
+ }
240
+
241
+ type TelegramMutableConfigStore = Pick<
242
+ TelegramConfigStore,
243
+ "get" | "set" | "persist"
244
+ > & {
245
+ load?: () => Promise<void>;
246
+ didLastLoadRecoverInvalidConfig?: () => boolean;
247
+ };
248
+
249
+ function isEmptyTelegramConfig(config: TelegramConfig): boolean {
250
+ return Object.keys(config).length === 0;
251
+ }
252
+
253
+ async function loadLatestTelegramConfig(
254
+ configStore: TelegramMutableConfigStore,
255
+ ): Promise<void> {
256
+ if (!configStore.load) return;
257
+ const before = configStore.get();
258
+ await configStore.load();
259
+ if (
260
+ !isEmptyTelegramConfig(before) &&
261
+ isEmptyTelegramConfig(configStore.get())
262
+ ) {
263
+ configStore.set(before);
264
+ }
265
+ }
266
+
267
+ export function bindGlobalTelegramConfigRuntime(
268
+ configStore: TelegramMutableConfigStore,
269
+ ): void {
270
+ setGlobalTelegramConfigRuntime({
271
+ updateVoiceConfig(voice) {
272
+ const current = configStore.get();
273
+ const next = {
274
+ ...current,
275
+ voice: { ...(current.voice ?? {}), ...voice },
276
+ };
277
+ configStore.set(next);
278
+ void configStore.persist(next);
279
+ },
280
+ });
281
+ }
282
+
283
+ function getInvalidTelegramConfigRecoveryPath(configPath: string): string {
284
+ return `${configPath}.invalid-${process.pid}-${Date.now()}`;
285
+ }
286
+
287
+ export async function readTelegramConfig(
288
+ configPath: string,
289
+ options: {
290
+ onInvalidConfig?: (recovery: TelegramInvalidConfigRecovery) => void;
291
+ } = {},
292
+ ): Promise<TelegramConfig> {
293
+ if (!existsSync(configPath)) return {};
294
+ const content = readFileSync(configPath, "utf8");
295
+ try {
296
+ return JSON.parse(content) as TelegramConfig;
297
+ } catch {
298
+ // Atomic config publication makes ordinary reads safe without serialization.
299
+ // Acquire the transaction only before destructive invalid-file recovery.
300
+ return withTelegramFileTransaction(`${configPath}.transaction`, () => {
301
+ if (!existsSync(configPath)) return {};
302
+ const identity = statSync(configPath);
303
+ const currentContent = readFileSync(configPath, "utf8");
304
+ try {
305
+ return JSON.parse(currentContent) as TelegramConfig;
306
+ } catch (error) {
307
+ const currentIdentity = statSync(configPath);
308
+ if (
309
+ currentIdentity.dev !== identity.dev ||
310
+ currentIdentity.ino !== identity.ino ||
311
+ currentIdentity.size !== identity.size ||
312
+ currentIdentity.mtimeMs !== identity.mtimeMs
313
+ ) {
314
+ throw new Error(
315
+ `Telegram config changed while validating invalid content: ${configPath}`,
316
+ { cause: error },
317
+ );
318
+ }
319
+ const recoveryPath = getInvalidTelegramConfigRecoveryPath(configPath);
320
+ renameSync(configPath, recoveryPath);
321
+ options.onInvalidConfig?.({ configPath, recoveryPath, error });
322
+ return {};
323
+ }
324
+ });
325
+ }
326
+ }
327
+
328
+ export async function writeTelegramConfig(
329
+ agentDir: string,
330
+ configPath: string,
331
+ config: TelegramConfig,
332
+ ): Promise<void> {
333
+ await mkdir(agentDir, { recursive: true });
334
+ const tempConfigPath = `${configPath}.tmp-${process.pid}-${Date.now()}`;
335
+ await writeFile(tempConfigPath, JSON.stringify(config, null, "\t") + "\n", {
336
+ encoding: "utf8",
337
+ mode: 0o600,
338
+ });
339
+ await chmod(tempConfigPath, 0o600);
340
+ await rename(tempConfigPath, configPath);
341
+ await chmod(configPath, 0o600);
342
+ }
343
+
344
+ function isPlainConfigRecord(value: unknown): value is Record<string, unknown> {
345
+ return !!value && typeof value === "object" && !Array.isArray(value);
346
+ }
347
+
348
+ function cloneTelegramConfig<T>(value: T): T {
349
+ return structuredClone(value);
350
+ }
351
+
352
+ function configValuesEqual(left: unknown, right: unknown): boolean {
353
+ return JSON.stringify(left) === JSON.stringify(right);
354
+ }
355
+
356
+ function mergeTelegramConfigDelta(
357
+ base: Record<string, unknown>,
358
+ desired: Record<string, unknown>,
359
+ latest: Record<string, unknown>,
360
+ ): Record<string, unknown> {
361
+ const merged = cloneTelegramConfig(latest);
362
+ for (const key of new Set([...Object.keys(base), ...Object.keys(desired)])) {
363
+ const baseHas = Object.hasOwn(base, key);
364
+ const desiredHas = Object.hasOwn(desired, key);
365
+ const baseValue = base[key];
366
+ const desiredValue = desired[key];
367
+ if (baseHas === desiredHas && configValuesEqual(baseValue, desiredValue)) {
368
+ continue;
369
+ }
370
+ if (!desiredHas) {
371
+ if (key !== "lastUpdateId") delete merged[key];
372
+ continue;
373
+ }
374
+ if (
375
+ key === "lastUpdateId" &&
376
+ typeof desiredValue === "number" &&
377
+ typeof merged[key] === "number"
378
+ ) {
379
+ merged[key] = Math.max(desiredValue, merged[key] as number);
380
+ continue;
381
+ }
382
+ if (
383
+ isPlainConfigRecord(desiredValue) &&
384
+ (!baseHas || isPlainConfigRecord(baseValue))
385
+ ) {
386
+ merged[key] = mergeTelegramConfigDelta(
387
+ isPlainConfigRecord(baseValue) ? baseValue : {},
388
+ desiredValue,
389
+ isPlainConfigRecord(merged[key]) ? merged[key] : {},
390
+ );
391
+ continue;
392
+ }
393
+ merged[key] = cloneTelegramConfig(desiredValue);
394
+ }
395
+ return merged;
396
+ }
397
+
398
+ function readTelegramConfigForTransaction(configPath: string): TelegramConfig {
399
+ if (!existsSync(configPath)) return {};
400
+ const parsed: unknown = JSON.parse(readFileSync(configPath, "utf8"));
401
+ if (!isPlainConfigRecord(parsed)) {
402
+ throw new Error(`Invalid Telegram config object: ${configPath}`);
403
+ }
404
+ return parsed as TelegramConfig;
405
+ }
406
+
407
+ function writeTelegramConfigInTransaction(
408
+ agentDir: string,
409
+ configPath: string,
410
+ config: TelegramConfig,
411
+ ): void {
412
+ mkdirSync(agentDir, { recursive: true, mode: 0o700 });
413
+ const tempConfigPath = `${configPath}.tmp-${process.pid}-${randomUUID()}`;
414
+ writeFileSync(tempConfigPath, `${JSON.stringify(config, null, "\t")}\n`, {
415
+ encoding: "utf8",
416
+ mode: 0o600,
417
+ });
418
+ chmodSync(tempConfigPath, 0o600);
419
+ try {
420
+ replaceTelegramConfigFile(tempConfigPath, configPath);
421
+ chmodSync(configPath, 0o600);
422
+ } finally {
423
+ try {
424
+ unlinkSync(tempConfigPath);
425
+ } catch {
426
+ /* rename consumed the temp file or cleanup is best effort */
427
+ }
428
+ }
429
+ }
430
+
431
+ export function getTelegramProfileFields(
432
+ config: TelegramConfig,
433
+ ): TelegramBotProfile | undefined {
434
+ const token = config.botToken?.trim();
435
+ if (!token) return undefined;
436
+ return {
437
+ botToken: token,
438
+ ...(config.botUsername !== undefined
439
+ ? { botUsername: config.botUsername }
440
+ : {}),
441
+ ...(config.botId !== undefined ? { botId: config.botId } : {}),
442
+ ...(config.allowedUserId !== undefined
443
+ ? { allowedUserId: config.allowedUserId }
444
+ : {}),
445
+ ...(config.lastUpdateId !== undefined
446
+ ? { lastUpdateId: config.lastUpdateId }
447
+ : {}),
448
+ };
449
+ }
450
+
451
+ function omitTelegramRootProfileFields(config: TelegramConfig): TelegramConfig {
452
+ const {
453
+ botToken: _botToken,
454
+ botUsername: _botUsername,
455
+ botId: _botId,
456
+ allowedUserId: _allowedUserId,
457
+ lastUpdateId: _lastUpdateId,
458
+ ...sharedConfig
459
+ } = config;
460
+ return sharedConfig;
461
+ }
462
+
463
+ export function normalizeTelegramDefaultProfileConfig(config: TelegramConfig): {
464
+ config: TelegramConfig;
465
+ changed: boolean;
466
+ } {
467
+ const hasLegacyRootProfile = [
468
+ "botToken",
469
+ "botUsername",
470
+ "botId",
471
+ "allowedUserId",
472
+ "lastUpdateId",
473
+ ].some((field) => Object.hasOwn(config, field));
474
+ if (!hasLegacyRootProfile) return { config, changed: false };
475
+ const canonicalProfile = config.profiles?.[TELEGRAM_DEFAULT_PROFILE_NAME];
476
+ const legacyToken = config.botToken?.trim();
477
+ if (Object.hasOwn(config, "botToken") && !legacyToken) {
478
+ throw new Error("Legacy Telegram default profile has no bot token");
479
+ }
480
+ const legacyProfile: Partial<TelegramBotProfile> = {
481
+ ...(legacyToken ? { botToken: legacyToken } : {}),
482
+ ...(config.botUsername !== undefined
483
+ ? { botUsername: config.botUsername }
484
+ : {}),
485
+ ...(config.botId !== undefined ? { botId: config.botId } : {}),
486
+ ...(config.allowedUserId !== undefined
487
+ ? { allowedUserId: config.allowedUserId }
488
+ : {}),
489
+ ...(config.lastUpdateId !== undefined
490
+ ? { lastUpdateId: config.lastUpdateId }
491
+ : {}),
492
+ };
493
+ if (!canonicalProfile && !legacyToken) {
494
+ throw new Error("Legacy Telegram default profile has no bot token");
495
+ }
496
+ const hasConflict = canonicalProfile
497
+ ? Object.entries(legacyProfile).some(
498
+ ([field, value]) =>
499
+ Object.hasOwn(canonicalProfile, field) &&
500
+ !configValuesEqual(
501
+ canonicalProfile[field as keyof TelegramBotProfile],
502
+ value,
503
+ ),
504
+ )
505
+ : false;
506
+ if (hasConflict) {
507
+ throw new Error(
508
+ "Conflicting Telegram default profile identity at root and profiles.default",
509
+ );
510
+ }
511
+ const normalizedProfile: TelegramBotProfile = canonicalProfile
512
+ ? { ...legacyProfile, ...canonicalProfile }
513
+ : (legacyProfile as TelegramBotProfile);
514
+ return {
515
+ config: {
516
+ ...omitTelegramRootProfileFields(config),
517
+ profiles: {
518
+ ...(config.profiles ?? {}),
519
+ [TELEGRAM_DEFAULT_PROFILE_NAME]: normalizedProfile,
520
+ },
521
+ },
522
+ changed: true,
523
+ };
524
+ }
525
+
526
+ function applyTelegramProfile(
527
+ config: TelegramConfig,
528
+ profileName: string | undefined,
529
+ ): TelegramConfig {
530
+ const effectiveProfileName = profileName ?? TELEGRAM_DEFAULT_PROFILE_NAME;
531
+ const profile = config.profiles?.[effectiveProfileName];
532
+ if (!profile) return omitTelegramRootProfileFields(config);
533
+ return {
534
+ ...omitTelegramRootProfileFields(config),
535
+ ...profile,
536
+ };
537
+ }
538
+
539
+ function storeTelegramEffectiveConfig(
540
+ baseConfig: TelegramConfig,
541
+ nextConfig: TelegramConfig,
542
+ profileName: string | undefined,
543
+ ): TelegramConfig {
544
+ const effectiveProfileName = profileName ?? TELEGRAM_DEFAULT_PROFILE_NAME;
545
+ const profile = getTelegramProfileFields(nextConfig);
546
+ const profiles = { ...(baseConfig.profiles ?? {}) };
547
+ if (profile) profiles[effectiveProfileName] = profile;
548
+ else delete profiles[effectiveProfileName];
549
+ return {
550
+ ...omitTelegramRootProfileFields(nextConfig),
551
+ profiles: Object.keys(profiles).length > 0 ? profiles : undefined,
552
+ };
553
+ }
554
+
555
+ export function createTelegramConfigStore(
556
+ options: TelegramConfigStoreOptions = {},
557
+ ): TelegramConfigStore {
558
+ let config: TelegramConfig = normalizeTelegramDefaultProfileConfig(
559
+ cloneTelegramConfig(options.initialConfig ?? {}),
560
+ ).config;
561
+ let persistedConfig: TelegramConfig = {};
562
+ let mutationVersion = 0;
563
+ let persistQueue: Promise<void> = Promise.resolve();
564
+ let activeProfileName: string | undefined;
565
+ let lastLoadRecoveredInvalidConfig = false;
566
+ const agentDir = options.agentDir ?? resolveAgentDir();
567
+ const configPath = options.configPath ?? getConfigPath();
568
+ const getEffectiveConfig = () =>
569
+ applyTelegramProfile(config, activeProfileName);
570
+ const setEffectiveConfig = (nextConfig: TelegramConfig) => {
571
+ config = storeTelegramEffectiveConfig(
572
+ config,
573
+ nextConfig,
574
+ activeProfileName,
575
+ );
576
+ mutationVersion += 1;
577
+ };
578
+ return {
579
+ get: getEffectiveConfig,
580
+ getStoredConfig: () => config,
581
+ set: setEffectiveConfig,
582
+ setProfile: (profileName, profile) => {
583
+ config = {
584
+ ...omitTelegramRootProfileFields(config),
585
+ profiles: {
586
+ ...(config.profiles ?? {}),
587
+ [profileName]: cloneTelegramConfig(profile),
588
+ },
589
+ };
590
+ mutationVersion += 1;
591
+ },
592
+ update: (mutate) => {
593
+ const nextConfig = getEffectiveConfig();
594
+ mutate(nextConfig);
595
+ setEffectiveConfig(nextConfig);
596
+ },
597
+ activateProfile: (profileName) => {
598
+ const normalizedProfileName =
599
+ !profileName || profileName === TELEGRAM_DEFAULT_PROFILE_NAME
600
+ ? undefined
601
+ : profileName;
602
+ if (normalizedProfileName && !config.profiles?.[normalizedProfileName]) {
603
+ return false;
604
+ }
605
+ activeProfileName = normalizedProfileName;
606
+ return true;
607
+ },
608
+ getActiveProfileName: () => activeProfileName,
609
+ getBotToken: () => getEffectiveConfig().botToken,
610
+ hasBotToken: () => !!getEffectiveConfig().botToken,
611
+ getAllowedUserId: () => getEffectiveConfig().allowedUserId,
612
+ getInboundHandlers: () => [
613
+ ...(config.inboundHandlers ?? []),
614
+ ...(config.attachmentHandlers ?? []),
615
+ ],
616
+ getAttachmentHandlers: () => config.attachmentHandlers,
617
+ getOutboundHandlers: () => config.outboundHandlers,
618
+ setAllowedUserId: (userId) => {
619
+ const nextConfig = getEffectiveConfig();
620
+ nextConfig.allowedUserId = userId;
621
+ setEffectiveConfig(nextConfig);
622
+ },
623
+ load: async () => {
624
+ lastLoadRecoveredInvalidConfig = false;
625
+ const loadedConfig = await readTelegramConfig(configPath, {
626
+ onInvalidConfig: (recovery) => {
627
+ lastLoadRecoveredInvalidConfig = true;
628
+ options.recordRuntimeEvent?.("config", recovery.error, {
629
+ phase: "load",
630
+ configPath: recovery.configPath,
631
+ recoveryPath: recovery.recoveryPath,
632
+ });
633
+ },
634
+ });
635
+ let normalized: ReturnType<typeof normalizeTelegramDefaultProfileConfig>;
636
+ try {
637
+ normalized = normalizeTelegramDefaultProfileConfig(loadedConfig);
638
+ } catch (error) {
639
+ options.recordRuntimeEvent?.("config", error, {
640
+ phase: "default-profile-normalize",
641
+ configPath,
642
+ });
643
+ throw error;
644
+ }
645
+ config = normalized.changed
646
+ ? withTelegramFileTransaction(`${configPath}.transaction`, () => {
647
+ const latestConfig = readTelegramConfigForTransaction(configPath);
648
+ const latestNormalized =
649
+ normalizeTelegramDefaultProfileConfig(latestConfig);
650
+ if (latestNormalized.changed) {
651
+ writeTelegramConfigInTransaction(
652
+ agentDir,
653
+ configPath,
654
+ latestNormalized.config,
655
+ );
656
+ }
657
+ return latestNormalized.config;
658
+ })
659
+ : normalized.config;
660
+ persistedConfig = cloneTelegramConfig(config);
661
+ mutationVersion += 1;
662
+ },
663
+ didLastLoadRecoverInvalidConfig: () => lastLoadRecoveredInvalidConfig,
664
+ persist: (nextConfig = getEffectiveConfig()) => {
665
+ const profileName = activeProfileName;
666
+ const desiredConfig = storeTelegramEffectiveConfig(
667
+ config,
668
+ cloneTelegramConfig(nextConfig),
669
+ profileName,
670
+ );
671
+ const baseConfig = cloneTelegramConfig(persistedConfig);
672
+ const capturedMutationVersion = mutationVersion;
673
+ const persist = persistQueue.then(() => {
674
+ const mergedConfig = withTelegramFileTransaction(
675
+ `${configPath}.transaction`,
676
+ () => {
677
+ const latestConfig = readTelegramConfigForTransaction(configPath);
678
+ const merged = mergeTelegramConfigDelta(
679
+ baseConfig as Record<string, unknown>,
680
+ desiredConfig as Record<string, unknown>,
681
+ latestConfig as Record<string, unknown>,
682
+ ) as TelegramConfig;
683
+ if (!configValuesEqual(latestConfig, merged)) {
684
+ writeTelegramConfigInTransaction(agentDir, configPath, merged);
685
+ }
686
+ return merged;
687
+ },
688
+ );
689
+ persistedConfig = cloneTelegramConfig(mergedConfig);
690
+ if (mutationVersion === capturedMutationVersion) {
691
+ config = cloneTelegramConfig(mergedConfig);
692
+ } else {
693
+ config = mergeTelegramConfigDelta(
694
+ baseConfig as Record<string, unknown>,
695
+ config as Record<string, unknown>,
696
+ mergedConfig as Record<string, unknown>,
697
+ ) as TelegramConfig;
698
+ }
699
+ });
700
+ persistQueue = persist.catch(() => undefined);
701
+ return persist;
702
+ },
703
+ };
704
+ }
705
+
706
+ export function createTelegramPollingOffsetPersister(
707
+ configStore: Pick<TelegramConfigStore, "get" | "set" | "persist">,
708
+ persist: () => Promise<void> = () => configStore.persist(),
709
+ ): (pollingConfig: { lastUpdateId?: number }) => Promise<void> {
710
+ return async (pollingConfig) => {
711
+ const nextOffset = pollingConfig.lastUpdateId;
712
+ if (typeof nextOffset === "number") {
713
+ const current = configStore.get();
714
+ const currentOffset = current.lastUpdateId;
715
+ configStore.set({
716
+ ...current,
717
+ lastUpdateId:
718
+ typeof currentOffset === "number"
719
+ ? Math.max(currentOffset, nextOffset)
720
+ : nextOffset,
721
+ });
722
+ }
723
+ await persist();
724
+ };
725
+ }
726
+
727
+ export function createTelegramProactivePushChecker(
728
+ configStore: Pick<TelegramConfigStore, "get">,
729
+ ): () => boolean {
730
+ return () => configStore.get().assistant?.proactivePush ?? true;
731
+ }
732
+
733
+ export function createTelegramProactivePushSetter(
734
+ configStore: TelegramMutableConfigStore,
735
+ ): (enabled: boolean) => Promise<void> {
736
+ return async (enabled) => {
737
+ await loadLatestTelegramConfig(configStore);
738
+ const current = configStore.get();
739
+ const config: TelegramConfig = {
740
+ ...current,
741
+ assistant: { ...current.assistant, proactivePush: enabled },
742
+ };
743
+ configStore.set(config);
744
+ await configStore.persist(config);
745
+ };
746
+ }
747
+
748
+ export function createTelegramDraftPreviewsChecker(
749
+ configStore: Pick<TelegramConfigStore, "get">,
750
+ ): () => boolean {
751
+ return () => {
752
+ const config = configStore.get();
753
+ return (
754
+ config.assistant?.draftPreviews ??
755
+ config.draftPreviews ??
756
+ config.richDraftPreviews ??
757
+ false
758
+ );
759
+ };
760
+ }
761
+
762
+ export function createTelegramDraftPreviewsSetter(
763
+ configStore: TelegramMutableConfigStore,
764
+ ): (enabled: boolean) => Promise<void> {
765
+ return async (enabled) => {
766
+ await loadLatestTelegramConfig(configStore);
767
+ const {
768
+ draftPreviews: _legacyDraftPreviews,
769
+ richDraftPreviews: _legacyRichDraftPreviews,
770
+ ...current
771
+ } = configStore.get();
772
+ const config = {
773
+ ...current,
774
+ assistant: { ...current.assistant, draftPreviews: enabled },
775
+ };
776
+ configStore.set(config);
777
+ await configStore.persist(config);
778
+ };
779
+ }
780
+
781
+ export function createTelegramAssistantRenderingModeGetter(
782
+ configStore: Pick<TelegramConfigStore, "get">,
783
+ ): () => TelegramAssistantRenderingMode {
784
+ return () => {
785
+ const config = configStore.get();
786
+ const mode = config.assistant?.rendering ?? config.assistantRendering;
787
+ return mode === "html" ? "html" : "rich";
788
+ };
789
+ }
790
+
791
+ export function createTelegramAssistantRenderingModeSetter(
792
+ configStore: TelegramMutableConfigStore,
793
+ ): (mode: TelegramAssistantRenderingMode) => Promise<void> {
794
+ return async (mode) => {
795
+ await loadLatestTelegramConfig(configStore);
796
+ const { assistantRendering: _legacyAssistantRendering, ...current } =
797
+ configStore.get();
798
+ const config = {
799
+ ...current,
800
+ assistant: { ...current.assistant, rendering: mode },
801
+ };
802
+ configStore.set(config);
803
+ await configStore.persist(config);
804
+ };
805
+ }
806
+
807
+ export function createTelegramActivityVerbosityGetter(
808
+ configStore: Pick<TelegramConfigStore, "get">,
809
+ ): () => TelegramActivityVerbosity {
810
+ return () => {
811
+ const assistant = configStore.get().assistant;
812
+ if (assistant?.activity !== undefined) {
813
+ if (
814
+ assistant.activity === "thinking" ||
815
+ assistant.activity === "tools" ||
816
+ assistant.activity === "verbose"
817
+ ) {
818
+ return assistant.activity;
819
+ }
820
+ return "quiet";
821
+ }
822
+ if (assistant?.activityVerbosity !== undefined) {
823
+ return assistant.activityVerbosity === "verbose" ? "verbose" : "quiet";
824
+ }
825
+ return "verbose";
826
+ };
827
+ }
828
+
829
+ export function createTelegramActivityVerbosityRefresher(
830
+ configStore: TelegramMutableConfigStore,
831
+ ): () => Promise<void> {
832
+ return () => loadLatestTelegramConfig(configStore);
833
+ }
834
+
835
+ export function createTelegramActivityVerbositySetter(
836
+ configStore: TelegramMutableConfigStore,
837
+ ): (verbosity: TelegramActivityVerbosity) => Promise<void> {
838
+ return async (verbosity) => {
839
+ await loadLatestTelegramConfig(configStore);
840
+ const current = configStore.get();
841
+ const {
842
+ activityVerbosity: _legacyActivityVerbosity,
843
+ ...assistant
844
+ } = current.assistant ?? {};
845
+ const config = {
846
+ ...current,
847
+ assistant: {
848
+ ...assistant,
849
+ activity: verbosity,
850
+ },
851
+ };
852
+ configStore.set(config);
853
+ await configStore.persist(config);
854
+ };
855
+ }
856
+
857
+ export function createTelegramVoiceReplyModeGetter(
858
+ configStore: Pick<TelegramConfigStore, "get">,
859
+ ): () => "hidden" | "mirror" | "always" {
860
+ return () => {
861
+ const mode = configStore.get().voice?.replyMode;
862
+ return mode === "mirror" || mode === "always" ? mode : "hidden";
863
+ };
864
+ }
865
+
866
+ export function createTelegramVoiceReplyModeConfiguredChecker(
867
+ configStore: Pick<TelegramConfigStore, "get">,
868
+ ): () => boolean {
869
+ return () => {
870
+ const mode = configStore.get().voice?.replyMode;
871
+ return mode === "mirror" || mode === "always";
872
+ };
873
+ }
874
+
875
+ export function createTelegramVoiceReplyModeSetter(
876
+ configStore: TelegramMutableConfigStore,
877
+ ): (replyMode: "hidden" | "mirror" | "always" | undefined) => Promise<void> {
878
+ return async (replyMode) => {
879
+ await loadLatestTelegramConfig(configStore);
880
+ const current = configStore.get();
881
+ if (replyMode === undefined || replyMode === "hidden") {
882
+ const { replyMode: _replyMode, ...remainingVoice } = current.voice ?? {};
883
+ const next = { ...current };
884
+ if (Object.keys(remainingVoice).length > 0) next.voice = remainingVoice;
885
+ else delete next.voice;
886
+ configStore.set(next);
887
+ await configStore.persist(next);
888
+ return;
889
+ }
890
+ const next = { ...current, voice: { ...(current.voice ?? {}), replyMode } };
891
+ configStore.set(next);
892
+ await configStore.persist(next);
893
+ };
894
+ }
895
+
896
+ function getSystemTimezone(): string {
897
+ try {
898
+ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
899
+ return tz && tz.length > 0 ? tz : "UTC";
900
+ } catch {
901
+ return "UTC";
902
+ }
903
+ }
904
+
905
+ export function resolveTelegramTimeConfig(
906
+ raw: TelegramTimeConfig | undefined,
907
+ timeInjection: TelegramTimeMode | undefined = undefined,
908
+ ): ResolvedTelegramTimeConfig {
909
+ const injectionMode: TelegramTimeMode =
910
+ timeInjection === undefined
911
+ ? "interval"
912
+ : timeInjection === "always" || timeInjection === "interval"
913
+ ? timeInjection
914
+ : "hidden";
915
+ const interval =
916
+ typeof raw?.interval === "number" && raw.interval > 0
917
+ ? raw.interval
918
+ : 60 * 60 * 1000;
919
+ const timezone = getSystemTimezone();
920
+ return { injectionMode, interval, timezone };
921
+ }
922
+
923
+ export function createTelegramTimeConfigGetter(
924
+ configStore: Pick<TelegramConfigStore, "get">,
925
+ ): () => ResolvedTelegramTimeConfig {
926
+ return () => {
927
+ const config = configStore.get();
928
+ return resolveTelegramTimeConfig(
929
+ config.time,
930
+ config.assistant?.timeInjection,
931
+ );
932
+ };
933
+ }
934
+
935
+ export function createTelegramTimeInjectionModeGetter(
936
+ configStore: Pick<TelegramConfigStore, "get">,
937
+ ): () => TelegramTimeMode {
938
+ return () => {
939
+ const config = configStore.get();
940
+ return resolveTelegramTimeConfig(
941
+ config.time,
942
+ config.assistant?.timeInjection,
943
+ ).injectionMode;
944
+ };
945
+ }
946
+
947
+ export function createTelegramTimeInjectionModeSetter(
948
+ configStore: TelegramMutableConfigStore,
949
+ ): (injectionMode: TelegramTimeMode) => Promise<void> {
950
+ return async (injectionMode) => {
951
+ await loadLatestTelegramConfig(configStore);
952
+ const current = configStore.get();
953
+ const next = {
954
+ ...current,
955
+ assistant: {
956
+ ...(current.assistant ?? {}),
957
+ timeInjection: injectionMode,
958
+ },
959
+ };
960
+ configStore.set(next);
961
+ await configStore.persist(next);
962
+ };
963
+ }
964
+
965
+ export interface TelegramProactivePushTarget {
966
+ chatId: number;
967
+ threadId?: number;
968
+ }
969
+
970
+ export function createTelegramProactivePushChatIdGetter(
971
+ getTarget: () => TelegramProactivePushTarget | undefined,
972
+ ): () => number | undefined {
973
+ return () => getTarget()?.chatId;
974
+ }
975
+
976
+ export function createTelegramProactivePushTargetGetter(deps: {
977
+ getActiveTurnTarget: () => TelegramProactivePushTarget | undefined;
978
+ getAssignedTarget: () => TelegramProactivePushTarget | undefined;
979
+ getAllowedUserId: () => number | undefined;
980
+ }): () => TelegramProactivePushTarget | undefined {
981
+ return () => {
982
+ const activeTarget = deps.getActiveTurnTarget();
983
+ if (activeTarget) return activeTarget;
984
+ const assignedTarget = deps.getAssignedTarget();
985
+ if (assignedTarget) return assignedTarget;
986
+ const chatId = deps.getAllowedUserId();
987
+ return typeof chatId === "number" ? { chatId } : undefined;
988
+ };
989
+ }
990
+
991
+ export function createTelegramAutomaticThreadCleanupChecker(
992
+ configStore: Pick<TelegramConfigStore, "get">,
993
+ ): () => boolean {
994
+ return () => configStore.get().threads?.automaticCleanup ?? true;
995
+ }
996
+
997
+ export function createTelegramAutomaticThreadCleanupResolver(
998
+ configStore: TelegramMutableConfigStore,
999
+ ): () => Promise<boolean> {
1000
+ return async () => {
1001
+ await loadLatestTelegramConfig(configStore);
1002
+ if (configStore.didLastLoadRecoverInvalidConfig?.()) {
1003
+ throw new Error(
1004
+ "Thread cleanup setting is unavailable after invalid Telegram config recovery.",
1005
+ );
1006
+ }
1007
+ return createTelegramAutomaticThreadCleanupChecker(configStore)();
1008
+ };
1009
+ }
1010
+
1011
+ export function createTelegramAutomaticThreadCleanupSetter(
1012
+ configStore: TelegramMutableConfigStore,
1013
+ ): (enabled: boolean) => Promise<void> {
1014
+ return async (enabled) => {
1015
+ await loadLatestTelegramConfig(configStore);
1016
+ const current = configStore.get();
1017
+ const config = {
1018
+ ...current,
1019
+ threads: { ...current.threads, automaticCleanup: enabled },
1020
+ };
1021
+ configStore.set(config);
1022
+ await configStore.persist(config);
1023
+ };
1024
+ }
1025
+
1026
+ export function createTelegramConfigControls(
1027
+ configStore: TelegramMutableConfigStore,
1028
+ ) {
1029
+ return {
1030
+ isProactivePushEnabled: createTelegramProactivePushChecker(configStore),
1031
+ setProactivePushEnabled: createTelegramProactivePushSetter(configStore),
1032
+ areDraftPreviewsEnabled: createTelegramDraftPreviewsChecker(configStore),
1033
+ setDraftPreviewsEnabled: createTelegramDraftPreviewsSetter(configStore),
1034
+ getAssistantRenderingMode:
1035
+ createTelegramAssistantRenderingModeGetter(configStore),
1036
+ setAssistantRenderingMode:
1037
+ createTelegramAssistantRenderingModeSetter(configStore),
1038
+ getActivityVerbosity:
1039
+ createTelegramActivityVerbosityGetter(configStore),
1040
+ refreshActivityVerbosity:
1041
+ createTelegramActivityVerbosityRefresher(configStore),
1042
+ setActivityVerbosity:
1043
+ createTelegramActivityVerbositySetter(configStore),
1044
+ getVoiceReplyMode: createTelegramVoiceReplyModeGetter(configStore),
1045
+ isVoiceReplyModeConfigured:
1046
+ createTelegramVoiceReplyModeConfiguredChecker(configStore),
1047
+ setVoiceReplyMode: createTelegramVoiceReplyModeSetter(configStore),
1048
+ getTimeInjectionMode: createTelegramTimeInjectionModeGetter(configStore),
1049
+ setTimeInjectionMode: createTelegramTimeInjectionModeSetter(configStore),
1050
+ isAutomaticThreadCleanupEnabled:
1051
+ createTelegramAutomaticThreadCleanupChecker(configStore),
1052
+ resolveAutomaticThreadCleanupEnabled:
1053
+ createTelegramAutomaticThreadCleanupResolver(configStore),
1054
+ setAutomaticThreadCleanupEnabled:
1055
+ createTelegramAutomaticThreadCleanupSetter(configStore),
1056
+ };
1057
+ }
1058
+
1059
+ export type TelegramAuthorizationState =
1060
+ { kind: "pair"; userId: number } | { kind: "allow" } | { kind: "deny" };
1061
+
1062
+ export interface TelegramUserPairingDeps<TContext> {
1063
+ allowedUserId?: number;
1064
+ ctx: TContext;
1065
+ setAllowedUserId: (userId: number) => void;
1066
+ persistConfig: () => Promise<void>;
1067
+ updateStatus: (ctx: TContext) => void;
1068
+ assertExecutionCurrent?: () => void;
1069
+ }
1070
+
1071
+ export interface TelegramUserPairingRuntimeDeps<TContext> {
1072
+ getAllowedUserId: () => number | undefined;
1073
+ setAllowedUserId: (userId: number) => void;
1074
+ persistConfig: () => Promise<void>;
1075
+ updateStatus: (ctx: TContext) => void;
1076
+ }
1077
+
1078
+ export interface TelegramUserPairingRuntime<TContext> {
1079
+ pairIfNeeded: (
1080
+ userId: number,
1081
+ ctx: TContext,
1082
+ assertExecutionCurrent?: () => void,
1083
+ ) => Promise<boolean>;
1084
+ }
1085
+
1086
+ export function getTelegramAuthorizationState(
1087
+ userId: number,
1088
+ allowedUserId?: number,
1089
+ ): TelegramAuthorizationState {
1090
+ if (allowedUserId === undefined) {
1091
+ return { kind: "pair", userId };
1092
+ }
1093
+ if (userId === allowedUserId) {
1094
+ return { kind: "allow" };
1095
+ }
1096
+ return { kind: "deny" };
1097
+ }
1098
+
1099
+ function isTelegramStaleContextError(error: unknown): boolean {
1100
+ return (
1101
+ error instanceof Error &&
1102
+ (error.message.includes("stale after session") ||
1103
+ error.message.includes("stale ctx"))
1104
+ );
1105
+ }
1106
+
1107
+ export async function pairTelegramUserIfNeeded<TContext>(
1108
+ userId: number,
1109
+ deps: TelegramUserPairingDeps<TContext>,
1110
+ ): Promise<boolean> {
1111
+ const authorization = getTelegramAuthorizationState(
1112
+ userId,
1113
+ deps.allowedUserId,
1114
+ );
1115
+ if (authorization.kind !== "pair") return false;
1116
+ deps.assertExecutionCurrent?.();
1117
+ deps.setAllowedUserId(authorization.userId);
1118
+ deps.assertExecutionCurrent?.();
1119
+ await deps.persistConfig();
1120
+ deps.assertExecutionCurrent?.();
1121
+ try {
1122
+ deps.updateStatus(deps.ctx);
1123
+ } catch (error) {
1124
+ if (!isTelegramStaleContextError(error)) throw error;
1125
+ }
1126
+ return true;
1127
+ }
1128
+
1129
+ export function createTelegramUserPairingRuntime<TContext>(
1130
+ deps: TelegramUserPairingRuntimeDeps<TContext>,
1131
+ ): TelegramUserPairingRuntime<TContext> {
1132
+ return {
1133
+ pairIfNeeded: (userId, ctx, assertExecutionCurrent) =>
1134
+ pairTelegramUserIfNeeded(userId, {
1135
+ allowedUserId: deps.getAllowedUserId(),
1136
+ ctx,
1137
+ setAllowedUserId: deps.setAllowedUserId,
1138
+ persistConfig: deps.persistConfig,
1139
+ updateStatus: deps.updateStatus,
1140
+ assertExecutionCurrent,
1141
+ }),
1142
+ };
1143
+ }