@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,824 @@
1
+ /**
2
+ * Keyboard-driven Actor Inspector overlay for concrete Run instances.
3
+ * Zones: owned actor selection, Recipe/Trace/Control tabs, safe Run Kill confirmation
4
+ * Owns manual kernel navigation; evidence parsing and lifecycle mutation stay in ports.
5
+ */
6
+ import { readFileSync, statSync } from "node:fs";
7
+ import * as path from "node:path";
8
+ import { matchesKey, truncateToWidth, visibleWidth, } from "@earendil-works/pi-tui";
9
+ import * as ActorInspector from "./inspector.js";
10
+ import * as ControlProjection from "./control-projection.js";
11
+ import * as RunsControls from "./runs-controls.js";
12
+ import * as RunControlDelivery from "./runs-control-delivery.js";
13
+ import * as RunsTrace from "./runs-trace.js";
14
+ import * as Limits from "./limits.js";
15
+ import { computeRunControlCapacity } from "./run-evidence-policy.js";
16
+ import * as RuntimeTriage from "./runtime-triage.js";
17
+ import * as TraceProjection from "./trace-projection.js";
18
+ const TABS = ["recipe", "trace", "control"];
19
+ const TRACE_SOURCES = [
20
+ "all",
21
+ "lifecycle",
22
+ "control",
23
+ "process",
24
+ "agent",
25
+ "artifact",
26
+ "runtime",
27
+ ];
28
+ export class ActorInspectorOverlay {
29
+ done;
30
+ killRun;
31
+ ownerId;
32
+ readRuns;
33
+ readTrace;
34
+ stateRoot;
35
+ theme;
36
+ tui;
37
+ refreshTimer;
38
+ contentStripeIndices = [];
39
+ documentScroll = 0;
40
+ detailScroll = 0;
41
+ feedback;
42
+ focus = "runs";
43
+ killConfirmation;
44
+ killDialogChoice = "cancel";
45
+ rowIndex = 0;
46
+ runCache;
47
+ selectedTraceId;
48
+ runIndex = 0;
49
+ selectorIndex = 0;
50
+ selectorMode;
51
+ tabIndex = 0;
52
+ traceCache;
53
+ traceDetail;
54
+ traceSourceIndex = 0;
55
+ constructor(options) {
56
+ this.done = options.done;
57
+ this.killRun = options.killRun;
58
+ this.ownerId = options.ownerId;
59
+ this.readRuns = options.readRuns ?? ActorInspector.readActorInspectorRuns;
60
+ this.readTrace = options.readTrace ?? TraceProjection.projectRunTrace;
61
+ this.stateRoot = options.stateRoot;
62
+ this.theme = options.theme;
63
+ this.tui = options.tui;
64
+ this.refreshTimer = setInterval(() => {
65
+ this.invalidate();
66
+ this.tui.requestRender();
67
+ }, 1_000);
68
+ this.refreshTimer.unref?.();
69
+ }
70
+ dispose() {
71
+ clearInterval(this.refreshTimer);
72
+ }
73
+ invalidate() {
74
+ this.runCache = undefined;
75
+ this.traceCache = undefined;
76
+ }
77
+ handleInput(data) {
78
+ const runs = this.runs();
79
+ this.runIndex = Math.min(this.runIndex, Math.max(0, runs.length - 1));
80
+ if (matchesKey(data, "ctrl+c")) {
81
+ this.done();
82
+ return;
83
+ }
84
+ if (this.killConfirmation) {
85
+ this.handleKillInput(data);
86
+ this.tui.requestRender();
87
+ return;
88
+ }
89
+ if (data.toLowerCase() === "k") {
90
+ this.requestKill(runs[this.runIndex]);
91
+ this.tui.requestRender();
92
+ return;
93
+ }
94
+ if (matchesKey(data, "escape")) {
95
+ if (this.focus === "select") {
96
+ this.selectorMode = undefined;
97
+ this.focus = this.tab === "trace" ? "tabs" : "runs";
98
+ }
99
+ else if (this.focus === "detail") {
100
+ this.selectedTraceId = this.traceDetail?.id;
101
+ this.traceDetail = undefined;
102
+ this.detailScroll = 0;
103
+ this.focus = "list";
104
+ }
105
+ else if (this.focus === "document" || this.focus === "list") {
106
+ if (this.focus === "list")
107
+ this.selectedTraceId = undefined;
108
+ this.focus = "tabs";
109
+ }
110
+ else {
111
+ this.done();
112
+ }
113
+ this.tui.requestRender();
114
+ return;
115
+ }
116
+ if (this.focus === "select") {
117
+ this.handleSelectorInput(data, runs);
118
+ this.tui.requestRender();
119
+ return;
120
+ }
121
+ if (this.focus === "detail") {
122
+ this.handleScrollableInput(data, "detail");
123
+ this.tui.requestRender();
124
+ return;
125
+ }
126
+ if (this.focus === "document") {
127
+ if (matchesKey(data, "left"))
128
+ this.focus = "tabs";
129
+ else if (matchesKey(data, "up") && this.documentScroll === 0)
130
+ this.focus = "tabs";
131
+ else
132
+ this.handleScrollableInput(data, "document");
133
+ this.tui.requestRender();
134
+ return;
135
+ }
136
+ if (this.focus === "runs") {
137
+ if (matchesKey(data, "left"))
138
+ this.cycleRun(runs, -1);
139
+ else if (matchesKey(data, "right"))
140
+ this.cycleRun(runs, 1);
141
+ else if (matchesKey(data, "down"))
142
+ this.focus = "tabs";
143
+ else if (matchesKey(data, "return") && runs.length > 0) {
144
+ this.selectorMode = "run";
145
+ this.selectorIndex = this.runIndex;
146
+ this.focus = "select";
147
+ }
148
+ }
149
+ else if (this.focus === "tabs") {
150
+ if (matchesKey(data, "left") || matchesKey(data, "right") || matchesKey(data, "tab")) {
151
+ const direction = matchesKey(data, "left") ? -1 : 1;
152
+ this.tabIndex = (this.tabIndex + direction + TABS.length) % TABS.length;
153
+ this.resetContentPosition();
154
+ }
155
+ else if (matchesKey(data, "up")) {
156
+ this.focus = "runs";
157
+ }
158
+ else if (matchesKey(data, "down")) {
159
+ const items = this.tab === "trace" ? this.traceItems(runs[this.runIndex]) : [];
160
+ this.focus = items.length > 0 ? "list" : "document";
161
+ if (this.focus === "list") {
162
+ this.rowIndex = 0;
163
+ this.selectedTraceId = items[0]?.id;
164
+ }
165
+ }
166
+ else if (matchesKey(data, "return")) {
167
+ if (this.tab === "trace")
168
+ this.openSourceSelector(runs[this.runIndex]);
169
+ else
170
+ this.focus = "document";
171
+ }
172
+ }
173
+ else if (this.focus === "list") {
174
+ const items = this.traceItems(runs[this.runIndex]);
175
+ const count = items.length;
176
+ if (matchesKey(data, "left")) {
177
+ this.selectedTraceId = undefined;
178
+ this.focus = "tabs";
179
+ }
180
+ else if (matchesKey(data, "up")) {
181
+ if (this.rowIndex === 0) {
182
+ this.selectedTraceId = undefined;
183
+ this.focus = "tabs";
184
+ }
185
+ else
186
+ this.rowIndex -= 1;
187
+ }
188
+ else if (matchesKey(data, "down")) {
189
+ this.rowIndex = Math.min(Math.max(0, count - 1), this.rowIndex + 1);
190
+ }
191
+ else if (matchesKey(data, "pageUp")) {
192
+ this.rowIndex = Math.max(0, this.rowIndex - this.contentViewportRows());
193
+ }
194
+ else if (matchesKey(data, "pageDown")) {
195
+ this.rowIndex = Math.min(Math.max(0, count - 1), this.rowIndex + this.contentViewportRows());
196
+ }
197
+ else if (matchesKey(data, "return") || matchesKey(data, "right")) {
198
+ const item = items[this.rowIndex];
199
+ if (item) {
200
+ this.traceDetail = item;
201
+ this.detailScroll = 0;
202
+ this.focus = "detail";
203
+ }
204
+ }
205
+ if (this.focus === "list")
206
+ this.selectedTraceId = items[this.rowIndex]?.id;
207
+ }
208
+ if (data.toLowerCase() === "f" && this.tab === "trace") {
209
+ this.cycleTraceSource(runs[this.runIndex]);
210
+ }
211
+ this.tui.requestRender();
212
+ }
213
+ render(width) {
214
+ const safeWidth = Math.max(24, width);
215
+ const innerWidth = safeWidth - 2;
216
+ const runs = this.runs();
217
+ this.runIndex = Math.min(this.runIndex, Math.max(0, runs.length - 1));
218
+ const run = runs[this.runIndex];
219
+ if (this.killConfirmation)
220
+ return this.renderKillDialog(innerWidth);
221
+ const lines = [this.border("╭", " Actor Inspector ", "╮", innerWidth)];
222
+ lines.push(this.row(this.renderRunControl(run, runs.length - this.runIndex), innerWidth));
223
+ lines.push(this.row(this.renderTabs(run), innerWidth));
224
+ lines.push(this.border("├", "", "┤", innerWidth));
225
+ this.contentStripeIndices = [];
226
+ let content = this.renderContent(run, innerWidth);
227
+ if (this.feedback) {
228
+ const color = this.feedback.ok
229
+ ? "success"
230
+ : /^Kill (failed|rejected)/u.test(this.feedback.message)
231
+ ? "error"
232
+ : "warning";
233
+ content = [this.theme.fg(color, ` ${this.feedback.message}`), ...content];
234
+ this.contentStripeIndices = [0, ...this.contentStripeIndices];
235
+ }
236
+ const viewportRows = this.contentViewportRows();
237
+ content = content.slice(0, viewportRows);
238
+ for (let index = 0; index < viewportRows; index += 1) {
239
+ lines.push(this.stripedRow(content[index] ?? "", innerWidth, this.contentStripeIndices[index] ?? index));
240
+ }
241
+ lines.push(this.footerBorder(this.renderKeyHints(), innerWidth));
242
+ return lines;
243
+ }
244
+ get tab() {
245
+ return TABS[this.tabIndex];
246
+ }
247
+ runs() {
248
+ if (this.runCache)
249
+ return this.runCache;
250
+ this.runCache = this.readRuns(this.stateRoot, this.ownerId);
251
+ return this.runCache;
252
+ }
253
+ contentViewportRows() {
254
+ const rows = this.tui.terminal?.rows ?? 30;
255
+ const overlayRows = Math.floor(rows * 0.94);
256
+ return Math.max(4, Math.min(24, overlayRows - 5));
257
+ }
258
+ resetContentPosition() {
259
+ this.documentScroll = 0;
260
+ this.detailScroll = 0;
261
+ this.rowIndex = 0;
262
+ this.selectedTraceId = undefined;
263
+ this.traceDetail = undefined;
264
+ }
265
+ cycleRun(runs, direction) {
266
+ if (runs.length === 0)
267
+ return;
268
+ this.runIndex = (this.runIndex + direction + runs.length) % runs.length;
269
+ this.resetContentPosition();
270
+ }
271
+ handleScrollableInput(data, target) {
272
+ const key = target === "detail" ? "detailScroll" : "documentScroll";
273
+ if (matchesKey(data, "up"))
274
+ this[key] = Math.max(0, this[key] - 1);
275
+ else if (matchesKey(data, "down"))
276
+ this[key] += 1;
277
+ else if (matchesKey(data, "pageUp")) {
278
+ this[key] = Math.max(0, this[key] - this.contentViewportRows());
279
+ }
280
+ else if (matchesKey(data, "pageDown")) {
281
+ this[key] += this.contentViewportRows();
282
+ }
283
+ else if (matchesKey(data, "left") && target === "detail") {
284
+ this.selectedTraceId = this.traceDetail?.id;
285
+ this.traceDetail = undefined;
286
+ this.detailScroll = 0;
287
+ this.focus = "list";
288
+ }
289
+ }
290
+ handleSelectorInput(data, runs) {
291
+ const run = runs[this.runIndex];
292
+ const options = this.selectorMode === "run"
293
+ ? runs.map((item) => item.run)
294
+ : this.traceSources(run);
295
+ if (matchesKey(data, "up"))
296
+ this.selectorIndex = Math.max(0, this.selectorIndex - 1);
297
+ else if (matchesKey(data, "down")) {
298
+ this.selectorIndex = Math.min(Math.max(0, options.length - 1), this.selectorIndex + 1);
299
+ }
300
+ else if (matchesKey(data, "left")) {
301
+ this.focus = this.selectorMode === "run" ? "runs" : "tabs";
302
+ this.selectorMode = undefined;
303
+ }
304
+ else if (matchesKey(data, "return") || matchesKey(data, "right")) {
305
+ if (this.selectorMode === "run") {
306
+ this.runIndex = this.selectorIndex;
307
+ this.focus = "runs";
308
+ }
309
+ else {
310
+ this.traceSourceIndex = this.selectorIndex;
311
+ this.focus = "tabs";
312
+ }
313
+ this.selectorMode = undefined;
314
+ this.resetContentPosition();
315
+ }
316
+ }
317
+ openSourceSelector(run) {
318
+ const sources = this.traceSources(run);
319
+ this.selectorMode = "source";
320
+ this.selectorIndex = Math.min(this.traceSourceIndex, sources.length - 1);
321
+ this.focus = "select";
322
+ }
323
+ cycleTraceSource(run) {
324
+ const sources = this.traceSources(run);
325
+ this.traceSourceIndex = (this.traceSourceIndex + 1) % sources.length;
326
+ this.resetContentPosition();
327
+ }
328
+ requestKill(run) {
329
+ this.feedback = undefined;
330
+ if (this.focus !== "runs") {
331
+ this.feedback = { ok: false, message: "Focus Run before using Kill." };
332
+ return;
333
+ }
334
+ if (!run) {
335
+ this.feedback = { ok: false, message: "Kill unavailable: no owned run." };
336
+ return;
337
+ }
338
+ if (!this.killRun) {
339
+ this.feedback = { ok: false, message: "Kill unavailable in this Inspector." };
340
+ return;
341
+ }
342
+ if (run.status !== "running") {
343
+ this.feedback = { ok: false, message: `Kill unavailable: run is ${run.status}.` };
344
+ return;
345
+ }
346
+ if (!run.runInstanceId) {
347
+ this.feedback = { ok: false, message: "Kill unavailable: run generation unavailable." };
348
+ return;
349
+ }
350
+ this.killConfirmation = {
351
+ run: run.run,
352
+ runInstanceId: run.runInstanceId,
353
+ status: run.status,
354
+ };
355
+ this.killDialogChoice = "cancel";
356
+ }
357
+ handleKillInput(data) {
358
+ const key = data.toLowerCase();
359
+ if (matchesKey(data, "escape") || key === "n") {
360
+ this.feedback = { ok: false, message: "Kill cancelled." };
361
+ this.killConfirmation = undefined;
362
+ this.killDialogChoice = "cancel";
363
+ }
364
+ else if (matchesKey(data, "left") || matchesKey(data, "right") || matchesKey(data, "tab")) {
365
+ this.killDialogChoice = this.killDialogChoice === "cancel" ? "kill" : "cancel";
366
+ }
367
+ else if (key === "y") {
368
+ this.confirmKill();
369
+ }
370
+ else if (matchesKey(data, "return")) {
371
+ if (this.killDialogChoice === "kill")
372
+ this.confirmKill();
373
+ else {
374
+ this.feedback = { ok: false, message: "Kill cancelled." };
375
+ this.killConfirmation = undefined;
376
+ }
377
+ }
378
+ }
379
+ confirmKill() {
380
+ const confirmation = this.killConfirmation;
381
+ this.killConfirmation = undefined;
382
+ this.killDialogChoice = "cancel";
383
+ if (!confirmation || !this.killRun)
384
+ return;
385
+ try {
386
+ const result = this.killRun(confirmation.run, confirmation.runInstanceId);
387
+ this.feedback = result.ok ? undefined : result;
388
+ if (result.ok)
389
+ this.invalidate();
390
+ }
391
+ catch (error) {
392
+ const message = error instanceof Error ? error.message : String(error);
393
+ this.feedback = {
394
+ ok: false,
395
+ message: `Kill failed: ${message.replaceAll(/\s+/g, " ").slice(0, 160)}.`,
396
+ };
397
+ }
398
+ }
399
+ renderKillDialog(innerWidth) {
400
+ const confirmation = this.killConfirmation;
401
+ const cancel = this.killDialogChoice === "cancel"
402
+ ? this.theme.bg("customMessageBg", this.theme.fg("accent", " Cancel "))
403
+ : this.theme.fg("muted", " Cancel ");
404
+ const kill = this.killDialogChoice === "kill"
405
+ ? this.theme.bg("customMessageBg", this.theme.fg("error", " Kill actor "))
406
+ : this.theme.fg("error", " Kill actor ");
407
+ const body = [
408
+ "",
409
+ this.theme.fg("error", "Kill this running actor?"),
410
+ "",
411
+ `${this.theme.fg("muted", "Run:")} ${this.theme.fg("accent", `run:${confirmation.run}`)}`,
412
+ `${this.theme.fg("muted", "Current status:")} ${this.theme.fg("warning", confirmation.status)}`,
413
+ "",
414
+ this.theme.fg("text", "This invokes generation-fenced runtime kill."),
415
+ "",
416
+ `${cancel} ${kill}`,
417
+ "",
418
+ ];
419
+ const lines = [this.border("╭", " Confirm Actor Kill ", "╮", innerWidth)];
420
+ const availableRows = this.contentViewportRows() + 3;
421
+ const topPadding = Math.max(0, Math.floor((availableRows - body.length) / 2));
422
+ const rows = [...Array.from({ length: topPadding }, () => ""), ...body].slice(0, availableRows);
423
+ while (rows.length < availableRows)
424
+ rows.push("");
425
+ for (const line of rows)
426
+ lines.push(this.row(this.center(line, innerWidth), innerWidth));
427
+ lines.push(this.footerBorder(this.renderKeyHints(), innerWidth));
428
+ return lines;
429
+ }
430
+ renderRunControl(run, sequence) {
431
+ const active = this.focus === "runs" || (this.focus === "select" && this.selectorMode === "run");
432
+ const prefix = active ? this.theme.fg("accent", " ← ") : " ";
433
+ const suffix = active ? this.theme.fg("accent", " → ") : " ";
434
+ if (!run) {
435
+ const empty = this.theme.fg("muted", `${prefix}Run: none${suffix}`);
436
+ return this.focus === "runs" ? this.theme.bg("customMessageBg", empty) : empty;
437
+ }
438
+ const value = `${prefix}${this.theme.fg("muted", "Run: ")}${this.theme.fg("text", `#${sequence}`)} ${this.theme.fg("accent", run.run)} ${this.theme.fg(this.statusColor(run.status), run.status)}${suffix}`;
439
+ return this.focus === "runs" ? this.theme.bg("customMessageBg", value) : value;
440
+ }
441
+ renderTabs(run) {
442
+ const source = this.traceSource(run);
443
+ return TABS.map((tab, index) => {
444
+ const base = `${tab[0].toUpperCase()}${tab.slice(1)}`;
445
+ const label = tab === "trace" && source !== "all" ? `${base} (${source})` : base;
446
+ const selected = index === this.tabIndex;
447
+ const display = selected && this.focus !== "runs" ? `[ ${label} ]` : ` ${label} `;
448
+ const value = ` ${display} `;
449
+ if (!selected)
450
+ return this.theme.fg("muted", value);
451
+ const colored = this.theme.fg("accent", value);
452
+ return this.focus === "tabs" ? this.theme.bg("customMessageBg", colored) : colored;
453
+ }).join(" ");
454
+ }
455
+ renderContent(run, width) {
456
+ if (!run)
457
+ return [this.theme.fg("muted", " No owned actor runs")];
458
+ if (this.focus === "select")
459
+ return this.renderSelector(run);
460
+ if (this.focus === "detail")
461
+ return this.renderTraceDetail(width);
462
+ if (this.tab === "trace")
463
+ return this.renderTraceList(run);
464
+ const stateDir = path.join(this.stateRoot, run.run);
465
+ const value = this.tab === "recipe"
466
+ ? ActorInspector.readActorInspectorRecipe(stateDir)
467
+ : this.controlDocument(run, stateDir);
468
+ const projection = this.documentProjection(value, width);
469
+ const maxStart = Math.max(0, projection.lines.length - this.contentViewportRows());
470
+ this.documentScroll = Math.min(this.documentScroll, maxStart);
471
+ this.contentStripeIndices = projection.stripes.slice(this.documentScroll, this.documentScroll + this.contentViewportRows());
472
+ return projection.lines.slice(this.documentScroll, this.documentScroll + this.contentViewportRows());
473
+ }
474
+ renderSelector(run) {
475
+ const options = this.selectorMode === "run"
476
+ ? this.runs().map((item) => `run:${item.run} ${item.status}`)
477
+ : this.traceSources(run).map((source) => `Trace source: ${source}`);
478
+ const lines = this.renderMenuBox(options, this.selectorIndex);
479
+ this.contentStripeIndices = lines.map(() => 0);
480
+ return lines;
481
+ }
482
+ renderMenuBox(options, focusedIndex) {
483
+ if (options.length === 0)
484
+ return [this.theme.fg("muted", " No options")];
485
+ const visibleLimit = Math.max(1, Math.min(this.contentViewportRows(), options.length));
486
+ const maxStart = Math.max(0, options.length - visibleLimit);
487
+ const start = Math.max(0, Math.min(focusedIndex - Math.floor(visibleLimit / 2), maxStart));
488
+ const visible = options.slice(start, start + visibleLimit);
489
+ const width = Math.max(8, ...options.map((option) => visibleWidth(option) + 4));
490
+ const border = (left, right, marker = "") => this.theme.fg("borderAccent", `${left}${marker}${"─".repeat(Math.max(0, width - visibleWidth(marker)))}${right}`);
491
+ return [
492
+ border("╭", "╮", start > 0 ? "↑" : ""),
493
+ ...visible.map((option, offset) => {
494
+ const index = start + offset;
495
+ const row = this.fit(`${index === focusedIndex ? " ▶ " : " "}${option}`, width);
496
+ const colored = index === focusedIndex ? this.theme.fg("accent", row) : row;
497
+ const styled = index === focusedIndex ? this.theme.bg("customMessageBg", colored) : colored;
498
+ return `${this.theme.fg("borderAccent", "│")}${styled}${this.theme.fg("borderAccent", "│")}`;
499
+ }),
500
+ border("╰", "╯", start + visible.length < options.length ? "↓" : ""),
501
+ ];
502
+ }
503
+ renderTraceList(run) {
504
+ const items = this.traceItems(run);
505
+ const summary = RunsTrace.summarizeRunTraceJournal(RunsTrace.readRunTraceJournal(path.join(this.stateRoot, run.run)));
506
+ const banner = summary.history_complete ? [] : [this.theme.fg("warning", ` ! Trace history incomplete: ${summary.compacted ? `${summary.compactions_total} compaction(s), ` : ""}${summary.dropped_event_count_exact ? summary.dropped_events : "unknown"} dropped event(s), ${summary.dropped_bytes} bytes`)];
507
+ if (items.length === 0)
508
+ return [...banner, this.theme.fg("muted", " No Trace evidence")];
509
+ if (this.selectedTraceId) {
510
+ const selectedIndex = items.findIndex((item) => item.id === this.selectedTraceId);
511
+ if (selectedIndex >= 0)
512
+ this.rowIndex = selectedIndex;
513
+ else
514
+ this.selectedTraceId = undefined;
515
+ }
516
+ this.rowIndex = Math.min(this.rowIndex, items.length - 1);
517
+ if (this.focus === "list" && !this.selectedTraceId) {
518
+ this.selectedTraceId = items[this.rowIndex]?.id;
519
+ }
520
+ const viewportRows = this.contentViewportRows();
521
+ const maxStart = Math.max(0, items.length - viewportRows);
522
+ const start = Math.max(0, Math.min(this.rowIndex - Math.floor(viewportRows / 2), maxStart));
523
+ this.contentStripeIndices = items
524
+ .slice(start, start + viewportRows)
525
+ .map((_item, offset) => start + offset);
526
+ return [...banner, ...items.slice(start, start + viewportRows - banner.length).map((item, offset) => {
527
+ const index = start + offset;
528
+ const detail = item.detail && typeof item.detail === "object"
529
+ ? item.detail
530
+ : {};
531
+ const marker = item.level === "error"
532
+ ? this.theme.fg("error", "!")
533
+ : detail.attention
534
+ ? this.theme.fg("warning", "A")
535
+ : " ";
536
+ const prefix = this.focus === "list" && index === this.rowIndex
537
+ ? this.theme.fg("accent", " ▶ ")
538
+ : " ";
539
+ const row = `${prefix}${this.theme.fg("text", `#${items.length - index}`)} ${marker} ${this.theme.fg("muted", item.source)}/${this.theme.fg(item.level === "error" ? "error" : "accent", item.kind)} ${this.theme.fg("text", item.summary)}`;
540
+ return this.focus === "list" && index === this.rowIndex
541
+ ? this.theme.fg("accent", row)
542
+ : row;
543
+ })];
544
+ }
545
+ renderTraceDetail(width) {
546
+ if (!this.traceDetail)
547
+ return [this.theme.fg("warning", " Trace row is no longer available")];
548
+ const projection = this.documentProjection(this.traceDetail, width);
549
+ const maxStart = Math.max(0, projection.lines.length - this.contentViewportRows());
550
+ this.detailScroll = Math.min(this.detailScroll, maxStart);
551
+ this.contentStripeIndices = projection.stripes.slice(this.detailScroll, this.detailScroll + this.contentViewportRows());
552
+ return projection.lines.slice(this.detailScroll, this.detailScroll + this.contentViewportRows());
553
+ }
554
+ controlDocument(run, stateDir) {
555
+ const endpoint = run.runInstanceId
556
+ ? RunControlDelivery.readRunControlEndpoint(stateDir, run.runInstanceId)
557
+ : undefined;
558
+ const meta = this.readRunMeta(stateDir);
559
+ const journal = RunsControls.readRunControlJournalFromStateDir(stateDir);
560
+ const capacity = computeRunControlCapacity(journal.records);
561
+ const stalePending = journal.records.reduce((count, control) => count + Number(Boolean(RuntimeTriage.classifyRuntimeControl({ run: run.run,
562
+ runInstanceId: run.runInstanceId, status: run.status }, control, Date.now()).stale)), 0);
563
+ return {
564
+ status: run.status,
565
+ run_instance_id: run.runInstanceId,
566
+ pending: capacity.pending, pending_limit: capacity.limit,
567
+ available: capacity.available, backpressured: capacity.backpressured,
568
+ journal_bytes: (() => { try {
569
+ return statSync(RunsControls.runControlsFile(stateDir)).size;
570
+ }
571
+ catch {
572
+ return 0;
573
+ } })(),
574
+ journal_limit: Limits.RUN_CONTROL_JOURNAL_MAX_BYTES,
575
+ stale_pending: stalePending,
576
+ diagnostics: journal.diagnostics.map((item) => item.line === undefined
577
+ ? { reason: "unreadable_control_journal" } : { line: item.line, reason: "invalid_control_json" }),
578
+ actor_actions: Array.isArray(meta.control) ? meta.control : [],
579
+ runtime_actions: run.status === "running" ? ["kill"] : ["archive", "prune"],
580
+ endpoint,
581
+ recent_controls: journal.records.slice(-20).reverse().map((control) => ControlProjection.projectRunControl(control)),
582
+ };
583
+ }
584
+ allTraceItems(run) {
585
+ if (!run)
586
+ return [];
587
+ if (this.traceCache?.run === run.run &&
588
+ this.traceCache.runInstanceId === run.runInstanceId) {
589
+ return this.traceCache.items;
590
+ }
591
+ const items = this.readTrace(path.join(this.stateRoot, run.run), {
592
+ limit: 100,
593
+ source: "all",
594
+ });
595
+ this.traceCache = { run: run.run, runInstanceId: run.runInstanceId, items };
596
+ return items;
597
+ }
598
+ traceSources(run) {
599
+ const present = new Set(this.allTraceItems(run).map((item) => item.source));
600
+ return TRACE_SOURCES.filter((source) => source === "all" || present.has(source));
601
+ }
602
+ traceSource(run) {
603
+ const sources = this.traceSources(run);
604
+ this.traceSourceIndex %= sources.length;
605
+ return sources[this.traceSourceIndex] ?? "all";
606
+ }
607
+ traceItems(run) {
608
+ const source = this.traceSource(run);
609
+ const items = this.allTraceItems(run);
610
+ return source === "all" ? items : items.filter((item) => item.source === source);
611
+ }
612
+ readRunMeta(stateDir) {
613
+ try {
614
+ return JSON.parse(readFileSync(path.join(stateDir, "run.json"), "utf8"));
615
+ }
616
+ catch {
617
+ return {};
618
+ }
619
+ }
620
+ documentProjection(value, width) {
621
+ const sections = value && typeof value === "object" && !Array.isArray(value)
622
+ ? Object.entries(value).map(([key, item]) => this.labeledDocumentLines(key, item))
623
+ : [this.document(value)];
624
+ const lines = [];
625
+ const stripes = [];
626
+ sections.forEach((section, sectionIndex) => {
627
+ const wrapped = this.wrapDocument(section, width);
628
+ lines.push(...wrapped.map((line) => this.styleDocumentLine(line)));
629
+ stripes.push(...wrapped.map(() => sectionIndex));
630
+ });
631
+ return { lines, stripes };
632
+ }
633
+ inlineDocumentValue(value) {
634
+ if (Array.isArray(value)) {
635
+ if (value.length === 0)
636
+ return "[]";
637
+ if (value.every((item) => (item === null || typeof item !== "object") &&
638
+ !(typeof item === "string" && /[\r\n]/u.test(item)))) {
639
+ return `[${value.map((item) => String(item ?? "none")).join(", ")}]`;
640
+ }
641
+ return undefined;
642
+ }
643
+ if (value && typeof value === "object") {
644
+ if (Object.keys(value).length === 0)
645
+ return "{}";
646
+ }
647
+ return undefined;
648
+ }
649
+ labeledDocumentLines(key, value, depth = 0) {
650
+ const inline = this.inlineDocumentValue(value);
651
+ if (inline !== undefined)
652
+ return [`${" ".repeat(depth)}${key}: ${inline}`];
653
+ if (value && typeof value === "object") {
654
+ const indent = " ".repeat(depth);
655
+ const nested = this.document(value, depth);
656
+ return [`${indent}${key}: ${nested[0].slice(indent.length)}`, ...nested.slice(1)];
657
+ }
658
+ return this.labeledScalarLines(key, value, depth);
659
+ }
660
+ labeledScalarLines(key, value, depth = 0) {
661
+ const indent = " ".repeat(depth);
662
+ const [first = "", ...rest] = String(value ?? "none").split(/\r?\n/u);
663
+ return [
664
+ `${indent}${key}: ${first}`,
665
+ ...rest.map((line) => `${indent} ${line}`),
666
+ ];
667
+ }
668
+ document(value, depth = 0) {
669
+ if (value === null || value === undefined)
670
+ return [`${" ".repeat(depth)}none`];
671
+ const inline = this.inlineDocumentValue(value);
672
+ if (inline !== undefined)
673
+ return [`${" ".repeat(depth)}${inline}`];
674
+ if (Array.isArray(value)) {
675
+ const indent = " ".repeat(depth);
676
+ return [
677
+ `${indent}[`,
678
+ ...value.flatMap((item, index) => {
679
+ const marker = `${indent} - #${index + 1}`;
680
+ const itemInline = this.inlineDocumentValue(item);
681
+ return itemInline !== undefined
682
+ ? [`${marker}: ${itemInline}`]
683
+ : [marker, ...this.document(item, depth + 2)];
684
+ }),
685
+ `${indent}]`,
686
+ ];
687
+ }
688
+ if (typeof value === "object") {
689
+ const indent = " ".repeat(depth);
690
+ const entries = Object.entries(value);
691
+ return [
692
+ `${indent}{`,
693
+ ...entries.flatMap(([key, item], index) => {
694
+ const lines = this.labeledDocumentLines(key, item, depth + 1);
695
+ if (index < entries.length - 1)
696
+ lines[lines.length - 1] += ",";
697
+ return lines;
698
+ }),
699
+ `${indent}}`,
700
+ ];
701
+ }
702
+ return String(value)
703
+ .split(/\r?\n/u)
704
+ .map((line) => `${" ".repeat(depth)}${line}`);
705
+ }
706
+ wrapDocument(lines, width) {
707
+ return lines.flatMap((line) => {
708
+ const normalized = line.replaceAll("\t", " ");
709
+ if (visibleWidth(normalized) <= width)
710
+ return [normalized];
711
+ const leading = normalized.match(/^ */u)?.[0] ?? "";
712
+ const continuation = `${leading} `;
713
+ const wrapped = [];
714
+ let rest = normalized.slice(leading.length);
715
+ let prefix = leading;
716
+ while (rest && visibleWidth(`${prefix}${rest}`) > width) {
717
+ const available = Math.max(1, width - visibleWidth(prefix));
718
+ const candidate = this.visiblePrefix(rest, available);
719
+ const minimumBreak = Math.floor(candidate.length * 0.6);
720
+ const preferred = Math.max(candidate.lastIndexOf(" "), candidate.lastIndexOf("/"), candidate.lastIndexOf(","));
721
+ const cut = preferred >= minimumBreak ? preferred + 1 : candidate.length;
722
+ wrapped.push(`${prefix}${rest.slice(0, cut).trimEnd()}`);
723
+ rest = rest.slice(cut).trimStart();
724
+ prefix = continuation;
725
+ }
726
+ if (rest)
727
+ wrapped.push(`${prefix}${rest}`);
728
+ return wrapped;
729
+ });
730
+ }
731
+ styleDocumentLine(line) {
732
+ const indent = line.match(/^ */u)?.[0] ?? "";
733
+ const content = line.slice(indent.length);
734
+ if (/^- #\d+$/u.test(content) || content.endsWith(":")) {
735
+ return `${indent}${this.theme.fg("accent", content)}`;
736
+ }
737
+ const labeled = /^([^:]+:)(.*)$/u.exec(content);
738
+ if (labeled) {
739
+ return `${indent}${this.theme.fg("muted", labeled[1])}${this.theme.fg("text", labeled[2])}`;
740
+ }
741
+ return `${indent}${this.theme.fg(content === "none" || content === "[]" ? "muted" : "text", content)}`;
742
+ }
743
+ visiblePrefix(value, width) {
744
+ let consumed = 0;
745
+ let result = "";
746
+ for (const character of value) {
747
+ const characterWidth = visibleWidth(character);
748
+ if (consumed + characterWidth > width)
749
+ break;
750
+ result += character;
751
+ consumed += characterWidth;
752
+ }
753
+ return result;
754
+ }
755
+ renderKeyHints() {
756
+ const hint = (keys, description) => `${this.theme.fg("accent", keys)}${this.theme.fg("borderAccent", ` ${description}`)}`;
757
+ const divider = this.theme.fg("borderAccent", " ─ ");
758
+ const hints = (...items) => items.map(([keys, description]) => hint(keys, description)).join(divider);
759
+ if (this.killConfirmation) {
760
+ return hints(["←→/tab", "choose"], ["enter/y", "confirm"], ["esc/n", "cancel"]);
761
+ }
762
+ if (this.focus === "select") {
763
+ return hints(["↑↓", "option"], ["enter/→", "apply"], ["←/esc", "back"]);
764
+ }
765
+ if (this.focus === "detail") {
766
+ return hints(["↑↓/pgup/pgdn", "scroll"], ["←/esc", "back"]);
767
+ }
768
+ if (this.focus === "document") {
769
+ return hints(["↑↓/pgup/pgdn", "scroll"], ["↑ at top", "tabs"], ["←/esc", "tabs"]);
770
+ }
771
+ if (this.focus === "list") {
772
+ return hints(["↑↓/pgup/pgdn", "row"], ["→/enter", "open"], ["←", "tabs"], ["esc", "close"]);
773
+ }
774
+ if (this.focus === "runs") {
775
+ const items = [["←→", "run"], ["↓", "tabs"], ["enter", "list"]];
776
+ const run = this.runs()[this.runIndex];
777
+ if (this.killRun && run?.status === "running" && run.runInstanceId)
778
+ items.push(["k", "kill"]);
779
+ items.push(["esc", "close"]);
780
+ return hints(...items);
781
+ }
782
+ return this.tab === "trace"
783
+ ? hints(["←→", "tabs"], ["↑↓", "focus"], ["enter/f", "source"], ["esc", "close"])
784
+ : hints(["←→", "tabs"], ["↑↓", "focus"], ["enter", "open"], ["esc", "close"]);
785
+ }
786
+ statusColor(status) {
787
+ if (status === "failed")
788
+ return "error";
789
+ if (status === "running")
790
+ return "warning";
791
+ if (status === "done" || status === "terminal")
792
+ return "success";
793
+ return "muted";
794
+ }
795
+ footerBorder(hints, width) {
796
+ const prefix = " ";
797
+ const suffix = " ─";
798
+ const content = truncateToWidth(hints, Math.max(0, width - visibleWidth(prefix) - visibleWidth(suffix)), "");
799
+ const fill = "─".repeat(Math.max(0, width - visibleWidth(prefix) - visibleWidth(suffix) - visibleWidth(content)));
800
+ return `${this.theme.fg("borderAccent", `╰${prefix}`)}${content}${this.theme.fg("borderAccent", `${suffix}${fill}╯`)}`;
801
+ }
802
+ stripeBackground(content, index) {
803
+ return index % 2 === 0 ? content : this.theme.bg("customMessageBg", content);
804
+ }
805
+ stripedRow(content, width, index) {
806
+ const fitted = this.fit(content, width);
807
+ return `${this.theme.fg("borderAccent", "│")}${this.stripeBackground(fitted, index)}${this.theme.fg("borderAccent", "│")}`;
808
+ }
809
+ row(content, width) {
810
+ return `${this.theme.fg("borderAccent", "│")}${this.fit(content, width)}${this.theme.fg("borderAccent", "│")}`;
811
+ }
812
+ border(left, label, right, width) {
813
+ const bounded = truncateToWidth(label, width, "");
814
+ return this.theme.fg("borderAccent", `${left}${bounded}${"─".repeat(Math.max(0, width - visibleWidth(bounded)))}${right}`);
815
+ }
816
+ fit(content, width) {
817
+ const bounded = truncateToWidth(content, width, "");
818
+ return `${bounded}${" ".repeat(Math.max(0, width - visibleWidth(bounded)))}`;
819
+ }
820
+ center(content, width) {
821
+ const padding = Math.max(0, Math.floor((width - visibleWidth(content)) / 2));
822
+ return `${" ".repeat(padding)}${content}`;
823
+ }
824
+ }