@codyswann/lisa 4.85.0 → 4.86.1

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 (333) hide show
  1. package/all/copy-overwrite/scripts/lib/completion-proof-content.mjs +63 -22
  2. package/all/copy-overwrite/scripts/lib/npm-update-hosted-hook.mjs +6 -1
  3. package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net.sh +19 -3
  4. package/all/copy-overwrite/scripts/npm-updater-helper-graph.json +2 -2
  5. package/dist/cli/doctor-session-manager-pending.d.ts +17 -0
  6. package/dist/cli/doctor-session-manager-pending.d.ts.map +1 -0
  7. package/dist/cli/doctor-session-manager-pending.js +130 -0
  8. package/dist/cli/doctor-session-manager-pending.js.map +1 -0
  9. package/dist/cli/doctor-session-manager-token.d.ts +69 -0
  10. package/dist/cli/doctor-session-manager-token.d.ts.map +1 -0
  11. package/dist/cli/doctor-session-manager-token.js +264 -0
  12. package/dist/cli/doctor-session-manager-token.js.map +1 -0
  13. package/dist/cli/doctor-session-manager.d.ts +3 -1
  14. package/dist/cli/doctor-session-manager.d.ts.map +1 -1
  15. package/dist/cli/doctor-session-manager.js +168 -146
  16. package/dist/cli/doctor-session-manager.js.map +1 -1
  17. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  18. package/dist/core/lisa-owned-hash-ledger.js +16 -0
  19. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  20. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  21. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  22. package/dist/core/upstream-evidence-manifest.js +168 -26
  23. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  24. package/dist/opencode/plugin-templates/parity-safety-net.sh +19 -3
  25. package/package.json +4 -4
  26. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  27. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  28. package/plugins/lisa/.codex-plugin/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  29. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/SKILL.md +5 -3
  30. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  31. package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  32. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/SKILL.md +197 -54
  33. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/references/runbook-template.md +23 -10
  34. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  35. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  36. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  37. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  38. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  39. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  40. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  41. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  42. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  43. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/config.mjs +39 -11
  44. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  45. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  46. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  47. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  48. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  49. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  50. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  51. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  52. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  53. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  54. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  55. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  56. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  57. package/plugins/lisa/.codex-plugin/skills/lisa-session-manager/scripts/token.mjs +39 -120
  58. package/plugins/lisa/.codex-plugin/skills/lisa-setup-session-manager/SKILL.md +82 -19
  59. package/plugins/lisa/commands/session-manager.md +1 -1
  60. package/plugins/lisa/commands/setup/session-manager.md +1 -1
  61. package/plugins/lisa/hooks/parity-safety-net.sh +19 -3
  62. package/plugins/lisa/rules/reference/config-resolution.md +39 -7
  63. package/plugins/lisa/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  64. package/plugins/lisa/skills/lisa-secrets-access/SKILL.md +5 -3
  65. package/plugins/lisa/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  66. package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  67. package/plugins/lisa/skills/lisa-session-manager/SKILL.md +197 -54
  68. package/plugins/lisa/skills/lisa-session-manager/references/runbook-template.md +23 -10
  69. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  70. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  71. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  72. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  73. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  74. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  75. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  76. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  77. package/plugins/lisa/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  78. package/plugins/lisa/skills/lisa-session-manager/scripts/config.mjs +39 -11
  79. package/plugins/lisa/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  80. package/plugins/lisa/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  81. package/plugins/lisa/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  82. package/plugins/lisa/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  83. package/plugins/lisa/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  84. package/plugins/lisa/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  85. package/plugins/lisa/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  86. package/plugins/lisa/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  87. package/plugins/lisa/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  88. package/plugins/lisa/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  89. package/plugins/lisa/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  90. package/plugins/lisa/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  91. package/plugins/lisa/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  92. package/plugins/lisa/skills/lisa-session-manager/scripts/token.mjs +39 -120
  93. package/plugins/lisa/skills/lisa-setup-session-manager/SKILL.md +82 -19
  94. package/plugins/lisa-agy/commands/lisa/session-manager.md +1 -1
  95. package/plugins/lisa-agy/commands/lisa/setup/session-manager.md +1 -1
  96. package/plugins/lisa-agy/hooks/parity-safety-net.sh +19 -3
  97. package/plugins/lisa-agy/plugin.json +1 -1
  98. package/plugins/lisa-agy/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  99. package/plugins/lisa-agy/skills/lisa-secrets-access/SKILL.md +5 -3
  100. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  101. package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  102. package/plugins/lisa-agy/skills/lisa-session-manager/SKILL.md +197 -54
  103. package/plugins/lisa-agy/skills/lisa-session-manager/references/runbook-template.md +23 -10
  104. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  105. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  106. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  107. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  108. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  109. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  110. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  111. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  112. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  113. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/config.mjs +39 -11
  114. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  115. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  116. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  117. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  118. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  119. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  120. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  121. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  122. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  123. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  124. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  125. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  126. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  127. package/plugins/lisa-agy/skills/lisa-session-manager/scripts/token.mjs +39 -120
  128. package/plugins/lisa-agy/skills/lisa-setup-session-manager/SKILL.md +82 -19
  129. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  130. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  131. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  132. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  133. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  134. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  135. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  136. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  137. package/plugins/lisa-copilot/commands/lisa/session-manager.md +1 -1
  138. package/plugins/lisa-copilot/commands/lisa/setup/session-manager.md +1 -1
  139. package/plugins/lisa-copilot/hooks/parity-safety-net.sh +19 -3
  140. package/plugins/lisa-copilot/rules/reference/config-resolution.md +39 -7
  141. package/plugins/lisa-copilot/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  142. package/plugins/lisa-copilot/skills/lisa-secrets-access/SKILL.md +5 -3
  143. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  144. package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  145. package/plugins/lisa-copilot/skills/lisa-session-manager/SKILL.md +197 -54
  146. package/plugins/lisa-copilot/skills/lisa-session-manager/references/runbook-template.md +23 -10
  147. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  148. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  149. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  150. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  151. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  152. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  153. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  154. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  155. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  156. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/config.mjs +39 -11
  157. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  158. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  159. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  160. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  161. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  162. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  163. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  164. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  165. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  166. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  167. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  168. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  169. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  170. package/plugins/lisa-copilot/skills/lisa-session-manager/scripts/token.mjs +39 -120
  171. package/plugins/lisa-copilot/skills/lisa-setup-session-manager/SKILL.md +82 -19
  172. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  173. package/plugins/lisa-cursor/commands/lisa/session-manager.md +1 -1
  174. package/plugins/lisa-cursor/commands/lisa/setup/session-manager.md +1 -1
  175. package/plugins/lisa-cursor/hooks/parity-safety-net.sh +19 -3
  176. package/plugins/lisa-cursor/rules/config-resolution-reference.mdc +39 -7
  177. package/plugins/lisa-cursor/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  178. package/plugins/lisa-cursor/skills/lisa-secrets-access/SKILL.md +5 -3
  179. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  180. package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  181. package/plugins/lisa-cursor/skills/lisa-session-manager/SKILL.md +197 -54
  182. package/plugins/lisa-cursor/skills/lisa-session-manager/references/runbook-template.md +23 -10
  183. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  184. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  185. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  186. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  187. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  188. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  189. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  190. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  191. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  192. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/config.mjs +39 -11
  193. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  194. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  195. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  196. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  197. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  198. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  199. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  200. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  201. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  202. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  203. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  204. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  205. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  206. package/plugins/lisa-cursor/skills/lisa-session-manager/scripts/token.mjs +39 -120
  207. package/plugins/lisa-cursor/skills/lisa-setup-session-manager/SKILL.md +82 -19
  208. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  209. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  210. package/plugins/lisa-devin/hooks/parity-safety-net.sh +19 -3
  211. package/plugins/lisa-devin/rules/reference/config-resolution.md +39 -7
  212. package/plugins/lisa-devin/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  213. package/plugins/lisa-devin/skills/lisa-secrets-access/SKILL.md +5 -3
  214. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  215. package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  216. package/plugins/lisa-devin/skills/lisa-session-manager/SKILL.md +197 -54
  217. package/plugins/lisa-devin/skills/lisa-session-manager/references/runbook-template.md +23 -10
  218. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  219. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  220. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  221. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  222. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  223. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  224. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  225. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  226. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  227. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/config.mjs +39 -11
  228. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  229. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  230. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  231. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  232. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  233. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  234. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  235. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  236. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  237. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  238. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  239. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  240. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  241. package/plugins/lisa-devin/skills/lisa-session-manager/scripts/token.mjs +39 -120
  242. package/plugins/lisa-devin/skills/lisa-setup-session-manager/SKILL.md +82 -19
  243. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  244. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  245. package/plugins/lisa-expo-agy/plugin.json +1 -1
  246. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  247. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  248. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  249. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  250. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  251. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  252. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  253. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  254. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  255. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  256. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  257. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  258. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  259. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  260. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  261. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  262. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  263. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  264. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  265. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  266. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  267. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  268. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  269. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  270. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  271. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  272. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  273. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  274. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  275. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  276. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  277. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  278. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  279. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  280. package/plugins/lisa-rails-agy/plugin.json +1 -1
  281. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  282. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  283. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  284. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  285. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  286. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  287. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  288. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  289. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  290. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  291. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  292. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  293. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  294. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  295. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  296. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  297. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  298. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  299. package/plugins/src/base/commands/session-manager.md +1 -1
  300. package/plugins/src/base/commands/setup/session-manager.md +1 -1
  301. package/plugins/src/base/hooks/parity-safety-net.sh +19 -3
  302. package/plugins/src/base/rules/reference/config-resolution.md +39 -7
  303. package/plugins/src/base/skills/lisa-parity-sentry-sdk-setup/SKILL.md +24 -17
  304. package/plugins/src/base/skills/lisa-secrets-access/SKILL.md +5 -3
  305. package/plugins/src/base/skills/lisa-secrets-access/scripts/providers.mjs +121 -3
  306. package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +86 -31
  307. package/plugins/src/base/skills/lisa-session-manager/SKILL.md +197 -54
  308. package/plugins/src/base/skills/lisa-session-manager/references/runbook-template.md +23 -10
  309. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-cycle.mjs +21 -3
  310. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-human.mjs +199 -0
  311. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-manager-token.mjs +99 -0
  312. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-manager.mjs +52 -52
  313. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-queue.mjs +51 -139
  314. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-runtime.mjs +5 -3
  315. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-setup.mjs +94 -14
  316. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-status.mjs +73 -0
  317. package/plugins/src/base/skills/lisa-session-manager/scripts/cli-usage.mjs +105 -15
  318. package/plugins/src/base/skills/lisa-session-manager/scripts/config.mjs +39 -11
  319. package/plugins/src/base/skills/lisa-session-manager/scripts/human-answer.mjs +162 -0
  320. package/plugins/src/base/skills/lisa-session-manager/scripts/human-needed.mjs +198 -0
  321. package/plugins/src/base/skills/lisa-session-manager/scripts/json-input.mjs +34 -0
  322. package/plugins/src/base/skills/lisa-session-manager/scripts/launch-shell.mjs +115 -0
  323. package/plugins/src/base/skills/lisa-session-manager/scripts/launch.mjs +69 -60
  324. package/plugins/src/base/skills/lisa-session-manager/scripts/ledger-questions.mjs +252 -0
  325. package/plugins/src/base/skills/lisa-session-manager/scripts/ledger.mjs +22 -56
  326. package/plugins/src/base/skills/lisa-session-manager/scripts/queue-github.mjs +117 -0
  327. package/plugins/src/base/skills/lisa-session-manager/scripts/session-manager.mjs +17 -5
  328. package/plugins/src/base/skills/lisa-session-manager/scripts/token-migrate.mjs +180 -0
  329. package/plugins/src/base/skills/lisa-session-manager/scripts/token-provider.mjs +150 -0
  330. package/plugins/src/base/skills/lisa-session-manager/scripts/token-read.mjs +166 -0
  331. package/plugins/src/base/skills/lisa-session-manager/scripts/token-store.mjs +248 -0
  332. package/plugins/src/base/skills/lisa-session-manager/scripts/token.mjs +39 -120
  333. package/plugins/src/base/skills/lisa-setup-session-manager/SKILL.md +82 -19
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Human-needed subcommands of the session-manager CLI (CodySwannGT/lisa#4555,
3
+ * part 3): `mark-plan`, `answer` and `item-answer`.
4
+ *
5
+ * `mark-plan` says how to mark an item that needs a human: the configured
6
+ * human-needed label (else the configured `blocked` role), a move to the
7
+ * `blocked` role for an `exhausted` item, and the comment to post. It writes
8
+ * nothing; the manager applies the plan through `lisa-tracker-write`, so the
9
+ * tracker write stays with the vendor writers. `answer` and `item-answer`
10
+ * queue a human's answer in the ledger for the next cycle to deliver.
11
+ *
12
+ * Question and answer text arrive on stdin, never in argv, and are refused
13
+ * (exit 2) when they look like they hold a credential.
14
+ * @module session-manager/cli-human
15
+ */
16
+ import { resolveRole } from "../../../scripts/resolve-lifecycle-role.mjs";
17
+ import {
18
+ CliError,
19
+ EXIT,
20
+ asSetupError,
21
+ asSetupErrorAsync,
22
+ humanNeededLabel,
23
+ loadProject,
24
+ requirePositional,
25
+ stdinText,
26
+ validOrAbsent,
27
+ } from "./cli-runtime.mjs";
28
+ import { parseJson } from "./cli-queue.mjs";
29
+ import { notifyProvider } from "./config.mjs";
30
+ import { pickItemAnswer } from "./human-answer.mjs";
31
+ import { findCredentialShape, planMark } from "./human-needed.mjs";
32
+ import { readLedger } from "./ledger.mjs";
33
+ import { queueAnswer } from "./ledger-questions.mjs";
34
+
35
+ /**
36
+ * The project's configured tracker.
37
+ * @param {ReturnType<typeof loadProject>} project - Loaded project
38
+ * @returns {string | undefined} `github`, `jira` or `linear`
39
+ */
40
+ function trackerOf(project) {
41
+ return project.local?.tracker ?? project.global?.tracker;
42
+ }
43
+
44
+ /**
45
+ * `mark-plan <ref> --kind <kind>` (question or reason on stdin).
46
+ * @param {object} ctx - CLI context
47
+ * @returns {{ json: object }} `{ref,kind,marker,move?,comment,answerWith}`
48
+ */
49
+ export function markPlan(ctx) {
50
+ const ref = requirePositional(ctx, "ref");
51
+ const text = stdinText(ctx, "question or reason");
52
+ const project = loadProject(ctx.root);
53
+ const config = validOrAbsent(project);
54
+ const tracker = trackerOf(project);
55
+ const blocked = resolveRole({
56
+ role: "blocked",
57
+ vendor: tracker,
58
+ intent: "write",
59
+ local: project.local,
60
+ global: project.global,
61
+ }).value;
62
+ return {
63
+ json: asSetupError(() =>
64
+ planMark({
65
+ ref,
66
+ kind: ctx.values.kind,
67
+ text,
68
+ label: humanNeededLabel(project, tracker),
69
+ blocked: blocked || undefined,
70
+ channel: config ? notifyProvider(config) === "telegram" : false,
71
+ answerers: allowedAnswerers(config).length > 0,
72
+ })
73
+ ),
74
+ };
75
+ }
76
+
77
+ /**
78
+ * Refuse (exit 2) text that looks like it holds a credential.
79
+ * @param {string} text - Answer text
80
+ */
81
+ function refuseCredential(text) {
82
+ const shape = findCredentialShape(text);
83
+ if (shape) {
84
+ throw new CliError(
85
+ `The answer looks like it holds a credential (${shape}); nothing was queued. Keep secrets in the secrets provider.`,
86
+ EXIT.SETUP
87
+ );
88
+ }
89
+ }
90
+
91
+ /**
92
+ * `answer <ref>` (answer on stdin): queue an operator's answer from the
93
+ * terminal. Exit 2 when the ref has no pending question.
94
+ * @param {object} ctx - CLI context
95
+ * @returns {Promise<{ json: object }>} `{queued:true,ref,source}`
96
+ */
97
+ export async function answer(ctx) {
98
+ const ref = requirePositional(ctx, "ref");
99
+ const text = stdinText(ctx, "answer");
100
+ refuseCredential(text);
101
+ await asSetupErrorAsync(() =>
102
+ queueAnswer(ctx.root, { ref, source: "cli", text })
103
+ );
104
+ return { json: { queued: true, ref, source: "cli" } };
105
+ }
106
+
107
+ /**
108
+ * Who may answer on the item: operators and trusted authors only. There is
109
+ * no fallback to the tracker identity (`control.me`): workers and the
110
+ * manager post as that identity, so its comments cannot be told apart from
111
+ * an answer.
112
+ * @param {object | null} config - Resolved `sessionManager` block
113
+ * @returns {string[]} Allowed author ids (empty: nobody may answer there)
114
+ */
115
+ function allowedAnswerers(config) {
116
+ return [
117
+ ...(config?.operatorIds ?? []),
118
+ ...(config?.trustedAuthorIds ?? []),
119
+ ].map(String);
120
+ }
121
+
122
+ /** Why nothing is read off the item when nobody may answer there. */
123
+ /** Why no answer can be read, and the fix, when the question is not found. */
124
+ const NO_QUESTION =
125
+ "The question comment was not found on the item: its id is not recorded " +
126
+ "(or not among these comments), and no comment by an operator or trusted " +
127
+ "author starts with the question marker. Replies cannot be read until it " +
128
+ "is. Re-post the question comment from mark-plan, then record its id " +
129
+ "with ledger marked --comment-id <id>.";
130
+
131
+ const NO_ANSWERERS =
132
+ "No sessionManager.operatorIds or trustedAuthorIds are configured, so " +
133
+ "replies on the item are not read: the tracker identity is the one " +
134
+ "workers post as. Answer with the answerCommand that status lists, or " +
135
+ "set sessionManager.operatorIds.";
136
+
137
+ /**
138
+ * `item-answer <ref>` (stdin `{"comments":[...]}`): find the human's answer
139
+ * on the item and queue it. stdout `{queued:false,reason}` when there is none
140
+ * yet, or `reason: "no-answerers-configured"` (exit 0) when nobody may
141
+ * answer there. Exit 2 when the ref has no pending question.
142
+ * @param {object} ctx - CLI context
143
+ * @returns {Promise<{ json: object }>} What was queued, or why nothing was
144
+ */
145
+ export async function itemAnswer(ctx) {
146
+ const ref = requirePositional(ctx, "ref");
147
+ const input = parseJson(stdinText(ctx, "item comments JSON"), "stdin");
148
+ const config = validOrAbsent(loadProject(ctx.root));
149
+ const ledger = await readLedger(ctx.root);
150
+ const pending = Object.hasOwn(ledger.items, ref)
151
+ ? ledger.items[ref].pendingQuestion
152
+ : null;
153
+ if (!pending) {
154
+ throw new CliError(`${ref} has no pending question in the ledger.`, 2);
155
+ }
156
+ if (pending.answer) {
157
+ return { json: { queued: false, ref, reason: "already-queued" } };
158
+ }
159
+ const allowed = allowedAnswerers(config);
160
+ if (allowed.length === 0) {
161
+ return {
162
+ json: {
163
+ queued: false,
164
+ ref,
165
+ reason: "no-answerers-configured",
166
+ explanation: NO_ANSWERERS,
167
+ },
168
+ };
169
+ }
170
+ const picked = asSetupError(() =>
171
+ pickItemAnswer({
172
+ comments: input?.comments,
173
+ allowed,
174
+ managerCommentIds: pending.managerCommentIds ?? [],
175
+ })
176
+ );
177
+ if (!picked.answer) {
178
+ return {
179
+ json: {
180
+ queued: false,
181
+ ref,
182
+ reason: picked.reason,
183
+ ...(picked.reason === "no-question-comment"
184
+ ? { explanation: NO_QUESTION }
185
+ : {}),
186
+ },
187
+ };
188
+ }
189
+ refuseCredential(picked.answer.text);
190
+ await queueAnswer(ctx.root, {
191
+ ref,
192
+ source: "item",
193
+ text: picked.answer.text,
194
+ author: picked.answer.author,
195
+ });
196
+ return {
197
+ json: { queued: true, ref, source: "item", author: picked.answer.author },
198
+ };
199
+ }
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The Telegram-token half of the session-manager `start` subcommand (#4555),
3
+ * split out of cli-manager.mjs to keep it under the line budget: where the
4
+ * bot token comes from ({@link telegramToken}), and the tmux launch that
5
+ * hands a provider-held token to the manager's session on stdin, never in
6
+ * argv ({@link launchWithToken}). The token value never reaches a return
7
+ * value that is printed, an error message or a log line.
8
+ * @module session-manager/cli-manager-token
9
+ */
10
+ import path from "node:path";
11
+
12
+ import {
13
+ CliError,
14
+ EXIT,
15
+ asSetupError,
16
+ asSetupErrorAsync,
17
+ run,
18
+ } from "./cli-runtime.mjs";
19
+ import { buildSourcedLaunch, buildStoreTokenCommand } from "./launch.mjs";
20
+ import {
21
+ loadTokenSecrets,
22
+ resolveTelegramToken,
23
+ telegramSecretName,
24
+ } from "./token-store.mjs";
25
+ import { shellQuote } from "./token.mjs";
26
+
27
+ /**
28
+ * Where `start` gets the Telegram bot token (#4555). With a secrets provider
29
+ * it is resolved once from the provider (exit 2 for a leftover plaintext
30
+ * file, naming the `store-token` command that migrates it; exit 1 when the
31
+ * provider cannot answer). With none, the plugin reads `<stateDir>/.env`.
32
+ * The value is kept off the returned JSON; `shellVars` is the foreground
33
+ * line's way to resolve it in the operator's own shell instead.
34
+ * @param {object} ctx - CLI context
35
+ * @param {string} managerName - `sessionManager.name`
36
+ * @param {string} stateDir - Resolved state dir
37
+ * @returns {Promise<{ source: "file" } | { source: "provider",
38
+ * secret: string, value: string, shellVars: Record<string, string> }>}
39
+ * Token source
40
+ */
41
+ export async function telegramToken(ctx, managerName, stateDir) {
42
+ const secrets = await asSetupErrorAsync(() =>
43
+ loadTokenSecrets(ctx.root, ctx.env)
44
+ );
45
+ if (secrets === null) return { source: "file" };
46
+ const secret = telegramSecretName(managerName);
47
+ const value = await asSetupErrorAsync(() =>
48
+ resolveTelegramToken({
49
+ ...secrets,
50
+ name: secret,
51
+ stateDir,
52
+ fixCommand: buildStoreTokenCommand({
53
+ scriptsDir: ctx.scriptsDir,
54
+ projectRoot: ctx.root,
55
+ }),
56
+ })
57
+ );
58
+ const resolver = path.resolve(
59
+ ctx.scriptsDir,
60
+ "../../lisa-secrets-access/scripts/resolve-secret.mjs"
61
+ );
62
+ return {
63
+ source: "provider",
64
+ secret,
65
+ value,
66
+ shellVars: {
67
+ TELEGRAM_BOT_TOKEN: `$(node ${shellQuote(resolver)} get ${secret})`,
68
+ },
69
+ };
70
+ }
71
+
72
+ /**
73
+ * Start the manager's tmux session with the bot token on tmux's stdin
74
+ * (`start-server ; source-file -`), never in argv. tmux's own stderr is never
75
+ * passed through: a parse error can quote the line, which holds the token.
76
+ * @param {{ ctx: object, argv: string[], env: object,
77
+ * token: { value: string }, foreground: () => string }} input - Context,
78
+ * the launch argv, the scrubbed env, the token and the foreground line
79
+ */
80
+ export function launchWithToken({ ctx, argv, env, token, foreground }) {
81
+ const sourced = asSetupError(() =>
82
+ buildSourcedLaunch(argv, { TELEGRAM_BOT_TOKEN: token.value })
83
+ );
84
+ const result = run("tmux", sourced.argv, {
85
+ env,
86
+ cwd: ctx.root,
87
+ input: sourced.input,
88
+ });
89
+ if (result.missing) throw new CliError("tmux is not on PATH.", EXIT.SETUP);
90
+ if (result.status !== 0) {
91
+ throw new CliError(
92
+ `tmux could not start the manager's session (exit ` +
93
+ `${String(result.status)}). tmux's own error is not shown, because ` +
94
+ `the command it read carries the bot token. Run the launch in the ` +
95
+ `foreground to see the error:\n ${foreground()}`,
96
+ EXIT.FAILURE
97
+ );
98
+ }
99
+ }
@@ -3,13 +3,22 @@
3
3
  * repo-dir and validate. The setup ones (init-config, store-token,
4
4
  * trust-status, coexistence) live in cli-setup.mjs.
5
5
  *
6
- * `start` hosts the manager in tmux. It refuses (exit 2) unless the bot
7
- * token file exists with owner-only permissions in the project's own state
8
- * dir, and it treats an existing tmux session started in this root as
6
+ * `start` hosts the manager in tmux. With Telegram as the notification
7
+ * channel and a secrets provider configured, it resolves the bot token once
8
+ * from the provider and hands it to tmux on stdin (#4555; see
9
+ * token-store.mjs). With Telegram and no provider it refuses (exit 2) unless
10
+ * the bot token file exists with owner-only permissions in the project's own
11
+ * state dir; with no channel
12
+ * (`notify.provider` `"none"`, or no `notify` block) it needs no token, state
13
+ * dir or plugin and launches without `--channels` (#4555). It treats an existing tmux session started in this root as
9
14
  * "already running" rather than starting a second poller on the same bot. A
10
15
  * session of that name started in another root is another project's manager,
11
16
  * so both `start` and `stop` refuse it (exit 2). `stop` kills only the
12
17
  * manager's tmux session: workers hold claimed work and keep running.
18
+ *
19
+ * The token lookup and stdin launch live in cli-manager-token.mjs and
20
+ * `status` in cli-status.mjs (re-exported here), to keep each module under
21
+ * the line budget.
13
22
  * @module session-manager/cli-manager
14
23
  */
15
24
  import {
@@ -18,25 +27,25 @@ import {
18
27
  GLOBAL_CONFIG_FILE,
19
28
  asSetupError,
20
29
  intFlag,
21
- listAgents,
22
30
  loadProject,
23
31
  mustRun,
24
32
  requireConfig,
25
33
  requireLisaRepo,
26
34
  run,
27
35
  } from "./cli-runtime.mjs";
28
- import { resolveRepoDir } from "./config.mjs";
36
+ import { launchWithToken, telegramToken } from "./cli-manager-token.mjs";
37
+ import { notifyProvider, resolveRepoDir } from "./config.mjs";
29
38
  import { probeOwnSession, sessionSurvives } from "./isolation.mjs";
30
39
  import {
31
40
  assertTokenPresent,
32
41
  buildForegroundCommand,
33
- buildHasSession,
34
42
  buildManagerLaunch,
35
43
  buildStopManager,
36
44
  resolveStateDir,
37
45
  } from "./launch.mjs";
38
- import { readLedger } from "./ledger.mjs";
39
- import { parseWorkerName, scrubWorkerEnv } from "./workers.mjs";
46
+ import { scrubWorkerEnv } from "./workers.mjs";
47
+
48
+ export { status } from "./cli-status.mjs";
40
49
 
41
50
  /**
42
51
  * The configured state dir, resolved (exit 2 for the shared default dir).
@@ -85,32 +94,49 @@ function settleMsOf(ctx) {
85
94
  export async function start(ctx) {
86
95
  const settleMs = settleMsOf(ctx);
87
96
  const config = requireConfig(ctx);
88
- const stateDir = stateDirOf(ctx, config);
97
+ const notify = notifyProvider(config);
98
+ const stateDir = notify === "telegram" ? stateDirOf(ctx, config) : undefined;
89
99
  // tmux gets the scrubbed env: if this call starts the tmux server, its
90
100
  // global environment must not carry a TELEGRAM_* value into other sessions.
91
101
  const env = scrubWorkerEnv(ctx.env);
102
+ // A running manager already holds its token, so it is reported before the
103
+ // provider is asked for one: a rate-limited vault must not turn "already
104
+ // running" into a failure, or spend a vault call on nothing.
92
105
  const session = probeOwnSession(ctx, config.name, env);
93
106
  if (session.missing) throw new CliError("tmux is not on PATH.", EXIT.SETUP);
94
107
  if (session.running) {
95
108
  return { json: { status: "already-running", name: config.name } };
96
109
  }
97
- asSetupError(() => assertTokenPresent(stateDir));
110
+ // Resolved before any session is created: a provider that cannot answer
111
+ // must leave nothing half-started.
112
+ const token =
113
+ stateDir === undefined
114
+ ? null
115
+ : await telegramToken(ctx, config.name, stateDir);
116
+ if (token?.source === "file") {
117
+ asSetupError(() => assertTokenPresent(stateDir));
118
+ }
98
119
  const argv = asSetupError(() =>
99
120
  buildManagerLaunch({
100
121
  name: config.name,
101
122
  root: ctx.root,
102
- stateDir,
123
+ ...(stateDir === undefined ? {} : { stateDir }),
103
124
  scriptsDir: ctx.scriptsDir,
104
125
  interval: config.interval,
126
+ notify,
105
127
  })
106
128
  );
107
- mustRun("tmux", argv, { env, cwd: ctx.root });
129
+ const foreground = () => buildForegroundCommand(argv, token?.shellVars ?? {});
130
+ if (token?.source === "provider") {
131
+ launchWithToken({ ctx, argv, env, token, foreground });
132
+ } else {
133
+ mustRun("tmux", argv, { env, cwd: ctx.root });
134
+ }
108
135
  if (!(await sessionSurvives(config.name, env, settleMs))) {
109
- const foreground = buildForegroundCommand(argv);
110
136
  throw new CliError(
111
137
  `The manager's tmux session "${config.name}" exited within ` +
112
138
  `${settleMs} ms of starting, so the manager is not running. Run the ` +
113
- `launch in the foreground to see claude's error:\n ${foreground}`,
139
+ `launch in the foreground to see claude's error:\n ${foreground()}`,
114
140
  EXIT.SETUP
115
141
  );
116
142
  }
@@ -118,7 +144,14 @@ export async function start(ctx) {
118
144
  json: {
119
145
  status: "started",
120
146
  name: config.name,
121
- stateDir,
147
+ notify,
148
+ ...(stateDir === undefined ? {} : { stateDir }),
149
+ ...(token === null
150
+ ? {}
151
+ : {
152
+ tokenSource: token.source,
153
+ ...(token.secret ? { secret: token.secret } : {}),
154
+ }),
122
155
  attach: `tmux attach -t ${config.name}`,
123
156
  },
124
157
  };
@@ -174,7 +207,10 @@ function environmentProblems(ctx, config) {
174
207
  return [`sessionManager.repos.entries.${key}: ${error.message}`];
175
208
  }
176
209
  });
177
- if (typeof config.notify?.stateDir === "string") {
210
+ if (
211
+ notifyProvider(config) === "telegram" &&
212
+ typeof config.notify?.stateDir === "string"
213
+ ) {
178
214
  try {
179
215
  stateDirOf(ctx, config);
180
216
  } catch (error) {
@@ -199,39 +235,3 @@ export function validate(ctx) {
199
235
  exitCode: errors.length === 0 ? EXIT.OK : EXIT.SETUP,
200
236
  };
201
237
  }
202
-
203
- /**
204
- * `status`: is the manager's tmux session up, and what does the ledger say
205
- * about each worker it dispatched.
206
- * @param {object} ctx - CLI context
207
- * @returns {Promise<{ json: object }>} `{manager,control,workers,untracked}`
208
- */
209
- export async function status(ctx) {
210
- const config = requireConfig(ctx);
211
- const tmux = run("tmux", buildHasSession(config.name), { env: ctx.env });
212
- const agents = listAgents(ctx, { all: true });
213
- const ledger = await readLedger(ctx.root);
214
- const liveNames = new Set(
215
- agents.filter(agent => agent.active).map(agent => agent.name)
216
- );
217
- const tracked = new Set(Object.values(ledger.items).map(i => i.worker));
218
- return {
219
- json: {
220
- manager: { name: config.name, running: tmux.status === 0 },
221
- control: ledger.control,
222
- workers: Object.entries(ledger.items).map(([ref, item]) => ({
223
- ref,
224
- worker: item.worker ?? null,
225
- sessionId: item.sessionId ?? null,
226
- repo: item.repo ?? null,
227
- status: item.status ?? null,
228
- attempts: item.attempts ?? 0,
229
- pendingQuestion: Boolean(item.pendingQuestion),
230
- live: liveNames.has(item.worker),
231
- })),
232
- untracked: [...liveNames]
233
- .filter(name => parseWorkerName(name) !== null && !tracked.has(name))
234
- .sort(),
235
- },
236
- };
237
- }