@turri-dev/cli 0.4.3-next.a60ada5 → 0.4.3-next.fd01774

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 (530) hide show
  1. package/README.md +23 -3
  2. package/dist/banner.js +248 -0
  3. package/dist/capture-cli.js +4 -4
  4. package/dist/capture-view.js +99 -0
  5. package/dist/chat-commands.js +6 -6
  6. package/dist/chat-models.js +17 -15
  7. package/dist/chat-tab-header.js +21 -9
  8. package/dist/chat-tabs.js +1 -1
  9. package/dist/chat-terminal.js +127 -67
  10. package/dist/chat-waiting.js +0 -20
  11. package/dist/cli-options.js +11 -7
  12. package/dist/cli-root.js +101 -0
  13. package/dist/cli.js +20 -26
  14. package/dist/conform-cli.js +4 -6
  15. package/dist/cultivate-cli.js +65 -97
  16. package/dist/doctor-cli.js +99 -0
  17. package/dist/drift-cli.js +2 -7
  18. package/dist/entry-renderers.js +107 -0
  19. package/dist/extension.js +14 -3355
  20. package/dist/init-config-cli.js +209 -0
  21. package/dist/launch-cli.js +55 -91
  22. package/dist/lineage-cli.js +2 -4
  23. package/dist/loop-cli.js +118 -237
  24. package/dist/panel-view.js +409 -0
  25. package/dist/parse-cli.js +5 -2
  26. package/dist/pi-launch.js +41 -13
  27. package/dist/pi-themes.js +2 -2
  28. package/dist/plain-code-blocks.js +1 -1
  29. package/dist/print-mode.js +20 -0
  30. package/dist/question-dialog.js +10 -6
  31. package/dist/quiet.js +7 -106
  32. package/dist/regenerate/diff-view.js +6 -87
  33. package/dist/regenerate/jobs-tree.js +2 -17
  34. package/dist/regenerate/spec-map-view.js +3 -68
  35. package/dist/regenerate-cli.js +7 -11
  36. package/dist/reopen.js +40 -7
  37. package/dist/skill-progress.js +25 -0
  38. package/dist/skill-report.js +52 -0
  39. package/dist/terminal-marks.js +21 -0
  40. package/dist/terminal-notifications.js +116 -31
  41. package/dist/terminal-view.js +275 -0
  42. package/dist/turri-versions.js +64 -6
  43. package/docs/README.md +2 -2
  44. package/docs/capture.md +47 -11
  45. package/docs/chats.md +7 -5
  46. package/docs/claude-subscription.md +1 -1
  47. package/docs/config.md +10 -7
  48. package/docs/development.md +30 -64
  49. package/docs/headless.md +3 -1
  50. package/docs/hosting.md +3 -251
  51. package/docs/installation.md +5 -3
  52. package/docs/launch.md +1 -1
  53. package/docs/sandbox.md +2 -0
  54. package/docs/sentinel.md +4 -4
  55. package/docs/using.md +3 -3
  56. package/package.json +13 -31
  57. package/dist/ask.d.ts +0 -90
  58. package/dist/ask.js +0 -170
  59. package/dist/background-skills.d.ts +0 -56
  60. package/dist/background-skills.js +0 -129
  61. package/dist/bedrock-region.d.ts +0 -66
  62. package/dist/bedrock-region.js +0 -144
  63. package/dist/brand.d.ts +0 -13
  64. package/dist/btw.d.ts +0 -69
  65. package/dist/btw.js +0 -174
  66. package/dist/capture/agents.d.ts +0 -361
  67. package/dist/capture/agents.js +0 -332
  68. package/dist/capture/area.d.ts +0 -58
  69. package/dist/capture/area.js +0 -197
  70. package/dist/capture/assemble.d.ts +0 -122
  71. package/dist/capture/assemble.js +0 -452
  72. package/dist/capture/capture.d.ts +0 -116
  73. package/dist/capture/capture.js +0 -1228
  74. package/dist/capture/chat.d.ts +0 -29
  75. package/dist/capture/chat.js +0 -94
  76. package/dist/capture/checks.d.ts +0 -142
  77. package/dist/capture/checks.js +0 -643
  78. package/dist/capture/config.d.ts +0 -13
  79. package/dist/capture/config.js +0 -60
  80. package/dist/capture/interface.d.ts +0 -71
  81. package/dist/capture/interface.js +0 -199
  82. package/dist/capture/map.d.ts +0 -56
  83. package/dist/capture/map.js +0 -530
  84. package/dist/capture/progress.d.ts +0 -108
  85. package/dist/capture/progress.js +0 -234
  86. package/dist/capture/report.d.ts +0 -75
  87. package/dist/capture/report.js +0 -267
  88. package/dist/capture/scripts.d.ts +0 -26
  89. package/dist/capture/scripts.js +0 -33
  90. package/dist/capture/state.d.ts +0 -296
  91. package/dist/capture/state.js +0 -43
  92. package/dist/capture/trial.d.ts +0 -34
  93. package/dist/capture/trial.js +0 -89
  94. package/dist/capture-cli.d.ts +0 -1
  95. package/dist/chat-commands.d.ts +0 -17
  96. package/dist/chat-idle.d.ts +0 -7
  97. package/dist/chat-idle.js +0 -20
  98. package/dist/chat-models.d.ts +0 -22
  99. package/dist/chat-records.d.ts +0 -50
  100. package/dist/chat-records.js +0 -107
  101. package/dist/chat-scope.d.ts +0 -14
  102. package/dist/chat-scope.js +0 -15
  103. package/dist/chat-skills.d.ts +0 -17
  104. package/dist/chat-skills.js +0 -18
  105. package/dist/chat-tab-header.d.ts +0 -15
  106. package/dist/chat-tabs.d.ts +0 -26
  107. package/dist/chat-terminal.d.ts +0 -24
  108. package/dist/chat-ui.d.ts +0 -33
  109. package/dist/chat-waiting.d.ts +0 -67
  110. package/dist/chats.d.ts +0 -343
  111. package/dist/chats.js +0 -1010
  112. package/dist/cli-options.d.ts +0 -24
  113. package/dist/cli.d.ts +0 -9
  114. package/dist/config-edit.d.ts +0 -83
  115. package/dist/config-edit.js +0 -391
  116. package/dist/config.d.ts +0 -428
  117. package/dist/config.js +0 -811
  118. package/dist/conform-cli.d.ts +0 -1
  119. package/dist/conformance-switch.d.ts +0 -25
  120. package/dist/conformance-switch.js +0 -86
  121. package/dist/cultivate-cli.d.ts +0 -1
  122. package/dist/doctor-tool.d.ts +0 -11
  123. package/dist/doctor-tool.js +0 -33
  124. package/dist/drift-cli.d.ts +0 -1
  125. package/dist/environment.d.ts +0 -37
  126. package/dist/environment.js +0 -109
  127. package/dist/extension.d.ts +0 -209
  128. package/dist/genome.d.ts +0 -77
  129. package/dist/genome.js +0 -288
  130. package/dist/graph.d.ts +0 -52
  131. package/dist/graph.js +0 -247
  132. package/dist/host-session.d.ts +0 -112
  133. package/dist/host-session.js +0 -103
  134. package/dist/host.d.ts +0 -40
  135. package/dist/host.js +0 -54
  136. package/dist/identity.d.ts +0 -7
  137. package/dist/identity.js +0 -75
  138. package/dist/init-config.d.ts +0 -169
  139. package/dist/init-config.js +0 -841
  140. package/dist/installed-providers.d.ts +0 -40
  141. package/dist/installed-providers.js +0 -98
  142. package/dist/jellyfish.d.ts +0 -40
  143. package/dist/judge.d.ts +0 -25
  144. package/dist/judge.js +0 -62
  145. package/dist/launch-agent.d.ts +0 -62
  146. package/dist/launch-agent.js +0 -339
  147. package/dist/launch-cli.d.ts +0 -1
  148. package/dist/launch-session.d.ts +0 -68
  149. package/dist/launch-session.js +0 -225
  150. package/dist/launch-tools.d.ts +0 -28
  151. package/dist/launch-tools.js +0 -72
  152. package/dist/launch-track.d.ts +0 -175
  153. package/dist/launch-track.js +0 -497
  154. package/dist/lineage-cli.d.ts +0 -1
  155. package/dist/loop-cli.d.ts +0 -35
  156. package/dist/loop-tools.d.ts +0 -103
  157. package/dist/loop-tools.js +0 -361
  158. package/dist/model-check.d.ts +0 -72
  159. package/dist/model-check.js +0 -162
  160. package/dist/module-report.d.ts +0 -9
  161. package/dist/new-project.d.ts +0 -10
  162. package/dist/new-project.js +0 -42
  163. package/dist/notice.d.ts +0 -115
  164. package/dist/notice.js +0 -61
  165. package/dist/parse-cli.d.ts +0 -1
  166. package/dist/parse-tool.d.ts +0 -9
  167. package/dist/parse-tool.js +0 -33
  168. package/dist/pi-launch.d.ts +0 -1
  169. package/dist/pi-settings.d.ts +0 -4
  170. package/dist/pi-themes.d.ts +0 -3
  171. package/dist/pi.d.ts +0 -248
  172. package/dist/pi.js +0 -889
  173. package/dist/picture-row.d.ts +0 -10
  174. package/dist/plain/check.d.ts +0 -63
  175. package/dist/plain/check.js +0 -236
  176. package/dist/plain/concepts.d.ts +0 -37
  177. package/dist/plain/concepts.js +0 -283
  178. package/dist/plain/cycles.d.ts +0 -21
  179. package/dist/plain/cycles.js +0 -190
  180. package/dist/plain/errors.d.ts +0 -26
  181. package/dist/plain/errors.js +0 -50
  182. package/dist/plain/files.d.ts +0 -47
  183. package/dist/plain/files.js +0 -161
  184. package/dist/plain/graph.d.ts +0 -107
  185. package/dist/plain/graph.js +0 -194
  186. package/dist/plain/highlight.d.ts +0 -43
  187. package/dist/plain/highlight.js +0 -196
  188. package/dist/plain/index.d.ts +0 -18
  189. package/dist/plain/index.js +0 -18
  190. package/dist/plain/liquid.d.ts +0 -22
  191. package/dist/plain/liquid.js +0 -124
  192. package/dist/plain/markdown.d.ts +0 -103
  193. package/dist/plain/markdown.js +0 -330
  194. package/dist/plain/module-concepts.d.ts +0 -32
  195. package/dist/plain/module-concepts.js +0 -80
  196. package/dist/plain/parser.d.ts +0 -163
  197. package/dist/plain/parser.js +0 -930
  198. package/dist/plain/plain.tmLanguage.json +0 -150
  199. package/dist/plain/project.d.ts +0 -48
  200. package/dist/plain/project.js +0 -155
  201. package/dist/plain/spec.d.ts +0 -152
  202. package/dist/plain/spec.js +0 -265
  203. package/dist/plain/stdlib.d.ts +0 -16
  204. package/dist/plain/stdlib.js +0 -48
  205. package/dist/plain/test-plain-file.d.ts +0 -59
  206. package/dist/plain/test-plain-file.js +0 -232
  207. package/dist/plain-code-blocks.d.ts +0 -14
  208. package/dist/plain-files.d.ts +0 -21
  209. package/dist/plain-files.js +0 -156
  210. package/dist/pointer-hover.d.ts +0 -12
  211. package/dist/question-dialog.d.ts +0 -60
  212. package/dist/questioning.d.ts +0 -55
  213. package/dist/questioning.js +0 -109
  214. package/dist/quiet.d.ts +0 -34
  215. package/dist/regenerate/activity.d.ts +0 -227
  216. package/dist/regenerate/activity.js +0 -250
  217. package/dist/regenerate/agent-env.d.ts +0 -51
  218. package/dist/regenerate/agent-env.js +0 -311
  219. package/dist/regenerate/agent-shell.d.ts +0 -54
  220. package/dist/regenerate/agent-shell.js +0 -121
  221. package/dist/regenerate/arbiter.d.ts +0 -68
  222. package/dist/regenerate/arbiter.js +0 -133
  223. package/dist/regenerate/audit.d.ts +0 -69
  224. package/dist/regenerate/audit.js +0 -212
  225. package/dist/regenerate/base-folder.d.ts +0 -70
  226. package/dist/regenerate/base-folder.js +0 -186
  227. package/dist/regenerate/cases.d.ts +0 -12
  228. package/dist/regenerate/cases.js +0 -149
  229. package/dist/regenerate/change-view.d.ts +0 -23
  230. package/dist/regenerate/change-view.js +0 -153
  231. package/dist/regenerate/chunk-plan.d.ts +0 -217
  232. package/dist/regenerate/chunk-plan.js +0 -937
  233. package/dist/regenerate/codebase.d.ts +0 -21
  234. package/dist/regenerate/codebase.js +0 -75
  235. package/dist/regenerate/command-check.d.ts +0 -66
  236. package/dist/regenerate/command-check.js +0 -577
  237. package/dist/regenerate/compaction.d.ts +0 -13
  238. package/dist/regenerate/compaction.js +0 -20
  239. package/dist/regenerate/confine.d.ts +0 -69
  240. package/dist/regenerate/confine.js +0 -311
  241. package/dist/regenerate/conform.d.ts +0 -66
  242. package/dist/regenerate/conform.js +0 -132
  243. package/dist/regenerate/conformance-agents.d.ts +0 -388
  244. package/dist/regenerate/conformance-agents.js +0 -1162
  245. package/dist/regenerate/conformance.d.ts +0 -191
  246. package/dist/regenerate/conformance.js +0 -1035
  247. package/dist/regenerate/conversation-writes.d.ts +0 -10
  248. package/dist/regenerate/conversation-writes.js +0 -100
  249. package/dist/regenerate/credentials.d.ts +0 -18
  250. package/dist/regenerate/credentials.js +0 -88
  251. package/dist/regenerate/debug-log.d.ts +0 -56
  252. package/dist/regenerate/debug-log.js +0 -236
  253. package/dist/regenerate/debugger.d.ts +0 -36
  254. package/dist/regenerate/debugger.js +0 -133
  255. package/dist/regenerate/delivery.d.ts +0 -2
  256. package/dist/regenerate/diagnose-job.d.ts +0 -2
  257. package/dist/regenerate/diagnose-job.js +0 -40
  258. package/dist/regenerate/diagnose.d.ts +0 -46
  259. package/dist/regenerate/diagnose.js +0 -92
  260. package/dist/regenerate/diff-view.d.ts +0 -64
  261. package/dist/regenerate/drift.d.ts +0 -120
  262. package/dist/regenerate/drift.js +0 -285
  263. package/dist/regenerate/environment-error.d.ts +0 -167
  264. package/dist/regenerate/environment-error.js +0 -342
  265. package/dist/regenerate/failure-reports.d.ts +0 -28
  266. package/dist/regenerate/failure-reports.js +0 -79
  267. package/dist/regenerate/job-log.d.ts +0 -30
  268. package/dist/regenerate/job-log.js +0 -105
  269. package/dist/regenerate/job-panel.d.ts +0 -20
  270. package/dist/regenerate/job-panel.js +0 -54
  271. package/dist/regenerate/jobs-tree.d.ts +0 -76
  272. package/dist/regenerate/jobs.d.ts +0 -231
  273. package/dist/regenerate/jobs.js +0 -522
  274. package/dist/regenerate/lanes.d.ts +0 -16
  275. package/dist/regenerate/lanes.js +0 -32
  276. package/dist/regenerate/launch.d.ts +0 -256
  277. package/dist/regenerate/launch.js +0 -689
  278. package/dist/regenerate/ledger-view.d.ts +0 -87
  279. package/dist/regenerate/ledger-view.js +0 -325
  280. package/dist/regenerate/ledger.d.ts +0 -368
  281. package/dist/regenerate/ledger.js +0 -357
  282. package/dist/regenerate/lineage.d.ts +0 -105
  283. package/dist/regenerate/lineage.js +0 -485
  284. package/dist/regenerate/list-arguments.d.ts +0 -21
  285. package/dist/regenerate/list-arguments.js +0 -121
  286. package/dist/regenerate/loop.d.ts +0 -423
  287. package/dist/regenerate/loop.js +0 -2087
  288. package/dist/regenerate/masking.d.ts +0 -19
  289. package/dist/regenerate/masking.js +0 -95
  290. package/dist/regenerate/model-names.d.ts +0 -33
  291. package/dist/regenerate/model-names.js +0 -92
  292. package/dist/regenerate/notes.d.ts +0 -159
  293. package/dist/regenerate/notes.js +0 -446
  294. package/dist/regenerate/os-sandbox.d.ts +0 -93
  295. package/dist/regenerate/os-sandbox.js +0 -283
  296. package/dist/regenerate/panel-dock.d.ts +0 -23
  297. package/dist/regenerate/paths.d.ts +0 -110
  298. package/dist/regenerate/paths.js +0 -190
  299. package/dist/regenerate/plain-palette.d.ts +0 -34
  300. package/dist/regenerate/prompt.d.ts +0 -230
  301. package/dist/regenerate/prompt.js +0 -741
  302. package/dist/regenerate/pulse-files.d.ts +0 -14
  303. package/dist/regenerate/pulse-files.js +0 -63
  304. package/dist/regenerate/records.d.ts +0 -132
  305. package/dist/regenerate/records.js +0 -327
  306. package/dist/regenerate/regenerate.d.ts +0 -106
  307. package/dist/regenerate/regenerate.js +0 -660
  308. package/dist/regenerate/regression.d.ts +0 -58
  309. package/dist/regenerate/regression.js +0 -188
  310. package/dist/regenerate/renames.d.ts +0 -42
  311. package/dist/regenerate/renames.js +0 -185
  312. package/dist/regenerate/requires.d.ts +0 -117
  313. package/dist/regenerate/requires.js +0 -377
  314. package/dist/regenerate/resources.d.ts +0 -57
  315. package/dist/regenerate/resources.js +0 -162
  316. package/dist/regenerate/scripts-being-written.d.ts +0 -19
  317. package/dist/regenerate/scripts-being-written.js +0 -30
  318. package/dist/regenerate/self-check.d.ts +0 -29
  319. package/dist/regenerate/self-check.js +0 -119
  320. package/dist/regenerate/services.d.ts +0 -28
  321. package/dist/regenerate/services.js +0 -158
  322. package/dist/regenerate/shell.d.ts +0 -91
  323. package/dist/regenerate/shell.js +0 -320
  324. package/dist/regenerate/side-panel.d.ts +0 -64
  325. package/dist/regenerate/spec-map-view.d.ts +0 -147
  326. package/dist/regenerate/spec-map.d.ts +0 -160
  327. package/dist/regenerate/spec-map.js +0 -596
  328. package/dist/regenerate/spec-steps.d.ts +0 -180
  329. package/dist/regenerate/spec-steps.js +0 -729
  330. package/dist/regenerate/standing.d.ts +0 -28
  331. package/dist/regenerate/standing.js +0 -30
  332. package/dist/regenerate/state.d.ts +0 -21
  333. package/dist/regenerate/state.js +0 -10
  334. package/dist/regenerate/steering.d.ts +0 -56
  335. package/dist/regenerate/steering.js +0 -119
  336. package/dist/regenerate/stop-report.d.ts +0 -43
  337. package/dist/regenerate/stop-report.js +0 -160
  338. package/dist/regenerate/submit-work.d.ts +0 -44
  339. package/dist/regenerate/submit-work.js +0 -76
  340. package/dist/regenerate/test-kinds.d.ts +0 -85
  341. package/dist/regenerate/test-kinds.js +0 -171
  342. package/dist/regenerate/test-scripts.d.ts +0 -240
  343. package/dist/regenerate/test-scripts.js +0 -847
  344. package/dist/regenerate/testing-steps.d.ts +0 -52
  345. package/dist/regenerate/testing-steps.js +0 -129
  346. package/dist/regenerate/testing.d.ts +0 -150
  347. package/dist/regenerate/testing.js +0 -438
  348. package/dist/regenerate/transcript-view.d.ts +0 -21
  349. package/dist/regenerate/unit-gate.d.ts +0 -27
  350. package/dist/regenerate/unit-gate.js +0 -20
  351. package/dist/regenerate/unit-review.d.ts +0 -152
  352. package/dist/regenerate/unit-review.js +0 -361
  353. package/dist/regenerate/web.d.ts +0 -61
  354. package/dist/regenerate/web.js +0 -256
  355. package/dist/regenerate/workspace.d.ts +0 -12
  356. package/dist/regenerate/workspace.js +0 -99
  357. package/dist/regenerate-cli.d.ts +0 -1
  358. package/dist/reopen.d.ts +0 -29
  359. package/dist/resume-line.d.ts +0 -5
  360. package/dist/review/live.d.ts +0 -72
  361. package/dist/review/live.js +0 -166
  362. package/dist/rules.d.ts +0 -20
  363. package/dist/rules.js +0 -47
  364. package/dist/run-report.d.ts +0 -88
  365. package/dist/run-report.js +0 -338
  366. package/dist/screen-padding.d.ts +0 -28
  367. package/dist/self-invocation.d.ts +0 -36
  368. package/dist/self-invocation.js +0 -137
  369. package/dist/sentinel-chat.d.ts +0 -19
  370. package/dist/sentinel-chat.js +0 -226
  371. package/dist/sentinel-check.d.ts +0 -36
  372. package/dist/sentinel-check.js +0 -78
  373. package/dist/sentinel.d.ts +0 -107
  374. package/dist/sentinel.js +0 -601
  375. package/dist/settings.d.ts +0 -45
  376. package/dist/settings.js +0 -378
  377. package/dist/setup.d.ts +0 -97
  378. package/dist/setup.js +0 -436
  379. package/dist/skill-progress.d.ts +0 -46
  380. package/dist/skill.d.ts +0 -102
  381. package/dist/skill.js +0 -147
  382. package/dist/skills.d.ts +0 -54
  383. package/dist/skills.js +0 -111
  384. package/dist/spawn-async.d.ts +0 -18
  385. package/dist/spawn-async.js +0 -35
  386. package/dist/stack.d.ts +0 -80
  387. package/dist/stack.js +0 -206
  388. package/dist/stdlib.d.ts +0 -43
  389. package/dist/stdlib.js +0 -118
  390. package/dist/surface.d.ts +0 -5
  391. package/dist/surface.js +0 -18
  392. package/dist/terminal-images.d.ts +0 -2
  393. package/dist/terminal-notifications.d.ts +0 -31
  394. package/dist/test-plain-files.d.ts +0 -41
  395. package/dist/test-plain-files.js +0 -172
  396. package/dist/tools.d.ts +0 -101
  397. package/dist/tools.js +0 -242
  398. package/dist/turri-versions.d.ts +0 -71
  399. package/genome/capture/capture.md +0 -26
  400. package/genome/capture/check-conventions.md +0 -5
  401. package/genome/capture/check-reference.md +0 -11
  402. package/genome/capture/concepts.md +0 -3
  403. package/genome/capture/divide.md +0 -9
  404. package/genome/capture/feature.md +0 -45
  405. package/genome/capture/interface.md +0 -9
  406. package/genome/capture/modules.md +0 -23
  407. package/genome/capture/outline.md +0 -11
  408. package/genome/capture/readability.md +0 -12
  409. package/genome/capture/reference.md +0 -10
  410. package/genome/capture/split.md +0 -9
  411. package/genome/capture/survey.md +0 -37
  412. package/genome/capture/trial.md +0 -18
  413. package/genome/capture/verify.md +0 -7
  414. package/genome/rules/bullet-continuation.md +0 -61
  415. package/genome/rules/concise-specs-examples.md +0 -460
  416. package/genome/rules/concise-specs-integration-examples.md +0 -281
  417. package/genome/rules/concise-specs.md +0 -80
  418. package/genome/rules/definitions.md +0 -107
  419. package/genome/rules/examples/integration-embedded-testing/run_conformance_tests_java.sh +0 -161
  420. package/genome/rules/examples/integration-embedded-testing/run_unittests_java.sh +0 -50
  421. package/genome/rules/exported-concepts.md +0 -39
  422. package/genome/rules/func-specs.md +0 -164
  423. package/genome/rules/impl-reqs.md +0 -68
  424. package/genome/rules/import-modules.md +0 -49
  425. package/genome/rules/integration-embedded-testing.md +0 -273
  426. package/genome/rules/integration-embedded.md +0 -171
  427. package/genome/rules/integration-standalone.md +0 -135
  428. package/genome/rules/integrations.md +0 -136
  429. package/genome/rules/linked-resources.md +0 -76
  430. package/genome/rules/module-structure.md +0 -112
  431. package/genome/rules/project-model.md +0 -69
  432. package/genome/rules/required-concepts.md +0 -44
  433. package/genome/rules/requires-modules.md +0 -81
  434. package/genome/rules/semantic-ids.md +0 -49
  435. package/genome/rules/stdlib.md +0 -37
  436. package/genome/rules/test-plain-files.md +0 -138
  437. package/genome/rules/test-reqs.md +0 -57
  438. package/genome/rules/turri-regeneration.md +0 -66
  439. package/genome/skills/analyze-2-func-specs/SKILL.md +0 -116
  440. package/genome/skills/analyze-func-specs/SKILL.md +0 -137
  441. package/genome/skills/break-down-func-spec/SKILL.md +0 -229
  442. package/genome/skills/consolidate-concepts/SKILL.md +0 -192
  443. package/genome/skills/convert-old-syntax/SKILL.md +0 -68
  444. package/genome/skills/convert-old-syntax/references/rubric.md +0 -11
  445. package/genome/skills/debug-specs/SKILL.md +0 -194
  446. package/genome/skills/implement-conformance-testing-script/SKILL.md +0 -247
  447. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_cypress.ps1 +0 -337
  448. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_golang.ps1 +0 -111
  449. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_java.sh +0 -151
  450. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.ps1 +0 -103
  451. package/genome/skills/implement-conformance-testing-script/assets/run_conformance_tests_python.sh +0 -146
  452. package/genome/skills/implement-unit-testing-script/SKILL.md +0 -171
  453. package/genome/skills/implement-unit-testing-script/assets/run_unittests_flutter.ps1 +0 -87
  454. package/genome/skills/implement-unit-testing-script/assets/run_unittests_golang.ps1 +0 -73
  455. package/genome/skills/implement-unit-testing-script/assets/run_unittests_java.sh +0 -82
  456. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.ps1 +0 -81
  457. package/genome/skills/implement-unit-testing-script/assets/run_unittests_python.sh +0 -102
  458. package/genome/skills/implement-unit-testing-script/assets/run_unittests_react.ps1 +0 -87
  459. package/genome/skills/refactor-module/SKILL.md +0 -218
  460. package/genome/skills/resolve-section-ownership/SKILL.md +0 -64
  461. package/genome/skills/resolve-spec-conflict/SKILL.md +0 -102
  462. package/stdlib/backend/common.plain +0 -25
  463. package/stdlib/backend/conformance/common.plain +0 -12
  464. package/stdlib/backend/conformance/go-gin.plain +0 -9
  465. package/stdlib/backend/conformance/go-nethttp.plain +0 -9
  466. package/stdlib/backend/conformance/java-springboot.plain +0 -9
  467. package/stdlib/backend/conformance/python-django.plain +0 -9
  468. package/stdlib/backend/conformance/python-fastapi.plain +0 -9
  469. package/stdlib/backend/conformance/python-flask.plain +0 -9
  470. package/stdlib/backend/conformance/rust-axum.plain +0 -9
  471. package/stdlib/backend/conformance/typescript-express.plain +0 -9
  472. package/stdlib/backend/conformance/typescript-fastify.plain +0 -9
  473. package/stdlib/backend/conformance/typescript-nestjs.plain +0 -9
  474. package/stdlib/backend/go-gin.plain +0 -18
  475. package/stdlib/backend/go-nethttp.plain +0 -18
  476. package/stdlib/backend/java-springboot.plain +0 -19
  477. package/stdlib/backend/python-django.plain +0 -19
  478. package/stdlib/backend/python-fastapi.plain +0 -23
  479. package/stdlib/backend/python-flask.plain +0 -23
  480. package/stdlib/backend/rust-axum.plain +0 -17
  481. package/stdlib/backend/typescript-express.plain +0 -19
  482. package/stdlib/backend/typescript-fastify.plain +0 -19
  483. package/stdlib/backend/typescript-nestjs.plain +0 -19
  484. package/stdlib/cli/common.plain +0 -17
  485. package/stdlib/cli/conformance/common.plain +0 -11
  486. package/stdlib/cli/conformance/go-cobra.plain +0 -9
  487. package/stdlib/cli/conformance/go-flag.plain +0 -9
  488. package/stdlib/cli/conformance/java-picocli.plain +0 -9
  489. package/stdlib/cli/conformance/python-argparse.plain +0 -9
  490. package/stdlib/cli/conformance/python-click.plain +0 -9
  491. package/stdlib/cli/conformance/python-typer.plain +0 -9
  492. package/stdlib/cli/conformance/rust-clap.plain +0 -9
  493. package/stdlib/cli/conformance/typescript-commander.plain +0 -9
  494. package/stdlib/cli/go-cobra.plain +0 -14
  495. package/stdlib/cli/go-flag.plain +0 -14
  496. package/stdlib/cli/java-picocli.plain +0 -15
  497. package/stdlib/cli/python-argparse.plain +0 -18
  498. package/stdlib/cli/python-click.plain +0 -16
  499. package/stdlib/cli/python-typer.plain +0 -16
  500. package/stdlib/cli/rust-clap.plain +0 -14
  501. package/stdlib/cli/typescript-commander.plain +0 -17
  502. package/stdlib/frontend/angular.plain +0 -17
  503. package/stdlib/frontend/common.plain +0 -17
  504. package/stdlib/frontend/conformance/angular.plain +0 -5
  505. package/stdlib/frontend/conformance/common.plain +0 -11
  506. package/stdlib/frontend/conformance/react-vite.plain +0 -5
  507. package/stdlib/frontend/conformance/sveltekit-spa.plain +0 -5
  508. package/stdlib/frontend/conformance/vue-vite.plain +0 -5
  509. package/stdlib/frontend/react-vite.plain +0 -16
  510. package/stdlib/frontend/sveltekit-spa.plain +0 -16
  511. package/stdlib/frontend/vue-vite.plain +0 -16
  512. package/stdlib/lang/go.plain +0 -13
  513. package/stdlib/lang/java.plain +0 -12
  514. package/stdlib/lang/python.plain +0 -18
  515. package/stdlib/lang/rust.plain +0 -12
  516. package/stdlib/lang/typescript.plain +0 -13
  517. package/stdlib/library/common.plain +0 -15
  518. package/stdlib/library/conformance/common.plain +0 -9
  519. package/stdlib/library/conformance/go.plain +0 -9
  520. package/stdlib/library/conformance/java-gradle.plain +0 -9
  521. package/stdlib/library/conformance/java-maven.plain +0 -9
  522. package/stdlib/library/conformance/python.plain +0 -9
  523. package/stdlib/library/conformance/rust.plain +0 -9
  524. package/stdlib/library/conformance/typescript.plain +0 -9
  525. package/stdlib/library/go.plain +0 -12
  526. package/stdlib/library/java-gradle.plain +0 -13
  527. package/stdlib/library/java-maven.plain +0 -13
  528. package/stdlib/library/python.plain +0 -13
  529. package/stdlib/library/rust.plain +0 -12
  530. package/stdlib/library/typescript.plain +0 -15
@@ -1,339 +0,0 @@
1
- import { existsSync, readdirSync, readFileSync } from "node:fs";
2
- import { isAbsolute, join, relative, resolve, sep } from "node:path";
3
- import { createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, defineTool, } from "@earendil-works/pi-coding-agent";
4
- import { Type } from "typebox";
5
- import { describeExport, describeFreed, describeHolder, freeHeld, howToFree, launchLogDir, listenersOf, runningLaunched, shortPath, startLaunched, turriFrees, whoHolds, } from "./regenerate/launch.js";
6
- import { machineChange, machineChangeReason } from "./regenerate/command-check.js";
7
- import { projectDirOf } from "./regenerate/paths.js";
8
- import { ask, BEGIN, createExecutor } from "./pi.js";
9
- /**
10
- * The person's own shell, in the host codebase: it installs what the launch needs into the project, and runs it. It
11
- * changes nothing of the machine's - no toolchain installed, no system setting changed: a command that would is refused.
12
- */
13
- export function launchShell(dir) {
14
- const bash = createBashToolDefinition(dir);
15
- return {
16
- ...bash,
17
- description: `${bash.description}\n\nIt runs on the person's own machine, in ${shortPath(dir)}. Never start a server here: activate does. It installs nothing on the machine and changes none of its settings: what the machine lacks, the person installs.`,
18
- async execute(toolCallId, params, signal, onUpdate, ctx) {
19
- const changes = machineChange(String(params.command ?? ""));
20
- if (changes !== undefined)
21
- throw new Error(machineChangeReason(changes));
22
- return bash.execute(toolCallId, params, signal, onUpdate, ctx);
23
- },
24
- };
25
- }
26
- /** A file tool that writes, refused inside plain_modules: the built code is the ***plain's to change, never a launch's. */
27
- function outsideBuiltCode(tool, dir) {
28
- return {
29
- ...tool,
30
- async execute(toolCallId, params, signal, onUpdate, ctx) {
31
- const path = resolve(dir, String(params.path ?? ""));
32
- if (relative(dir, path).split(sep).includes("plain_modules")) {
33
- throw new Error(`Not written: ${shortPath(path)} is built code. A launch never changes it - a fix belongs in the ***plain.`);
34
- }
35
- // The ***plain - a module, a test plain file - is the person's: a launch that finds it wrong says so, never rewrites it.
36
- if (path.endsWith(".plain")) {
37
- throw new Error(`Not written: ${shortPath(path)} is ***plain. A launch never changes it - say what is wrong with it instead.`);
38
- }
39
- return tool.execute(toolCallId, params, signal, onUpdate, ctx);
40
- },
41
- };
42
- }
43
- function shown(file, max = 40_000) {
44
- const text = readFileSync(file, "utf8");
45
- const body = text.length > max ? `${text.slice(0, max)}\n… [the rest of ${shortPath(file)} is not shown]` : text;
46
- return `<file path="${shortPath(file)}">\n${body.trimEnd()}\n</file>`;
47
- }
48
- /**
49
- * What the project says of itself, for the agent to find launch guidance in: its AGENTS.md and its skills
50
- * (`.agents/skills`, `.pi/skills`, `.claude/skills`), where turri runs and in the host codebase - once each, whole.
51
- */
52
- export function projectNotes(dirs) {
53
- const roots = [...new Set(dirs.map((dir) => resolve(dir)))];
54
- const files = new Set();
55
- for (const root of roots) {
56
- const agents = join(root, "AGENTS.md");
57
- if (existsSync(agents))
58
- files.add(agents);
59
- for (const skills of [".agents/skills", ".pi/skills", ".claude/skills"].map((folder) => join(root, folder))) {
60
- if (!existsSync(skills))
61
- continue;
62
- for (const name of readdirSync(skills)) {
63
- const skill = join(skills, name, "SKILL.md");
64
- if (existsSync(skill))
65
- files.add(skill);
66
- }
67
- }
68
- }
69
- return [...files].map((file) => shown(file));
70
- }
71
- function text(value, details = {}) {
72
- return { content: [{ type: "text", text: value }], details };
73
- }
74
- /** The folder a command runs in: in dist, or - `from: host` - in the host codebase; a folder inside either. */
75
- function inside(root, dir) {
76
- const target = resolve(root, dir ?? ".");
77
- const rel = relative(root, target);
78
- if (rel.startsWith("..") || isAbsolute(rel))
79
- throw new Error(`${dir} is outside ${shortPath(root)}: what activate starts runs from there, or a folder inside it.`);
80
- return target;
81
- }
82
- const launchOf = (launch) => (launch.id !== undefined && launch.short !== undefined ? { launch: { id: launch.id, commit: launch.short } } : {});
83
- /**
84
- * activate: start what keeps running - a backend, a frontend's dev server - owned by the harness: in its own process
85
- * group, its output kept, stopped on the codebase's next launch, on /halt and when turri exits. A port held by what
86
- * turri's own launches started is taken - what held it stopped, and `freed` told.
87
- */
88
- export function activateTool(launch, code, freed) {
89
- return defineTool({
90
- name: "activate",
91
- label: "Activate",
92
- description: "Start something that keeps running - a backend, a frontend's dev server - on this machine: in the background, its " +
93
- "output kept, stopped on the next launch, on /halt and when turri exits. With `url`, waits until something answers " +
94
- "there and says so, or shows the end of its output. A port held by a server turri's own launches started - another " +
95
- "module's, an earlier session's - is taken: turri stops that server and says so. A port anything else holds is said - " +
96
- "what holds it, whose it is, how to free it - and nothing is started.",
97
- promptSnippet: "start a server of the launched code, and wait for it to answer",
98
- parameters: Type.Object({
99
- name: Type.String({ description: "A short name for it: backend, frontend, app" }),
100
- command: Type.String({ description: "The command that starts it, as run from its folder" }),
101
- url: Type.Optional(Type.String({ description: "Where it serves, e.g. http://localhost:5173 - it is ready once this answers" })),
102
- from: Type.Optional(Type.Union([Type.Literal("dist"), Type.Literal("host")], {
103
- description: `Where dir is named from: dist, the launched code (${shortPath(code.dir)}) - the default; host, the host codebase (${shortPath(launch.hostDir)}), when guidance says to start it there.`,
104
- })),
105
- dir: Type.Optional(Type.String({ description: "The folder to run it in, inside the one `from` names - e.g. frontend. Default: that folder itself." })),
106
- }),
107
- async execute(_id, params) {
108
- const root = params.from === "host" ? launch.hostDir : code.dir;
109
- const started = await startLaunched({
110
- name: params.name,
111
- command: params.command,
112
- dir: inside(root, params.dir),
113
- root,
114
- moduleName: launch.codebase,
115
- logDir: launchLogDir(projectDirOf(launch.plainFile)),
116
- ...(params.url !== undefined ? { url: params.url } : {}),
117
- ...launchOf(launch),
118
- ...(freed !== undefined ? { freed } : {}),
119
- });
120
- return text(started.text, { ok: started.ok, ...(started.process !== undefined ? { pid: started.process.pid, log: started.process.log } : {}) });
121
- },
122
- });
123
- }
124
- /**
125
- * stop_launched: free what a server turri's own launches started holds that this launch needs - a socket, a lock or pid
126
- * file, a container name, a port - by any process of it. Stopped only when turri's records say a launch of turri started
127
- * it - this session's for another module, or a turri that has ended; anything else is refused, saying whose it is.
128
- */
129
- export function stopLaunchedTool(launch, freed) {
130
- return defineTool({
131
- name: "stop_launched",
132
- label: "Stop launched",
133
- description: "Stop a server an earlier launch of turri's started - another module's, an earlier session's - that holds something " +
134
- "this launch needs: a socket, a lock or pid file, a container name, a database it keeps open. Give any pid of it - " +
135
- "from the error, lsof, ps - and what it holds. turri stops it only when its records say a launch of turri's " +
136
- "started it, and says so in the launch's summary itself; a process turri did not start, or another turri's still " +
137
- "running, is never stopped: you are told whose it is and how the person frees it. A port activate takes itself.",
138
- promptSnippet: "stop an earlier launch's server that holds what this launch needs",
139
- parameters: Type.Object({
140
- pid: Type.Integer({ description: "A process of the server that holds it" }),
141
- holds: Type.String({ description: "What it holds that this launch needs, in a few words: the socket /tmp/app.sock, the lock on data/app.db" }),
142
- }),
143
- async execute(_id, params) {
144
- const holder = whoHolds(params.pid, launchLogDir(projectDirOf(launch.plainFile)));
145
- if (holder.kind === "this" && holder.process.launch !== undefined && holder.process.launch === launch.id) {
146
- throw new Error(`Not stopped: ${describeHolder(holder)} - this launch started it itself. activate it again under the same name to restart it.`);
147
- }
148
- if (!turriFrees(holder))
149
- throw new Error(`Not stopped: ${describeHolder(holder)}. ${howToFree(holder)} Say so in submit_launch.`);
150
- const stopped = await freeHeld([holder], params.holds.trim() || "what this launch needs");
151
- freed?.(stopped);
152
- if (stopped.length === 0)
153
- return text(`Nothing stopped: ${describeHolder(holder)} has ended already.`);
154
- return text(`${stopped.map((each) => describeFreed(each, launch.codebase)).join("\n")}\nturri says so in the launch's summary: start what needs it now.`);
155
- },
156
- });
157
- }
158
- /** What holds each port a summary names, said with whose it is - none for a port nothing listens on. */
159
- function heldPorts(ports, logDir) {
160
- const lines = [];
161
- for (const port of ports) {
162
- const pids = listenersOf(port);
163
- if (pids === undefined || pids.length === 0)
164
- continue;
165
- for (const pid of pids) {
166
- const holder = whoHolds(pid, logDir);
167
- lines.push(`port ${port}: ${describeHolder(holder)}. ${howToFree(holder)}`);
168
- }
169
- }
170
- return lines;
171
- }
172
- /** The ports of the URLs a summary names. */
173
- function portsIn(summary) {
174
- const ports = new Set();
175
- for (const match of summary.matchAll(/\bhttps?:\/\/[^\s/"'`)<>]+/g)) {
176
- try {
177
- const url = new URL(match[0]);
178
- ports.add(url.port !== "" ? Number(url.port) : url.protocol === "https:" ? 443 : 80);
179
- }
180
- catch {
181
- /* not a URL after all */
182
- }
183
- }
184
- return [...ports];
185
- }
186
- /**
187
- * Why a launch said to be up is not: it says something serves - `serves`, or a URL in its summary - and nothing this
188
- * launch started with activate still runs. Something else answering there - an earlier build left running, another
189
- * program - is not this launch. Undefined when it holds.
190
- */
191
- export function notBacked(launch, outcome) {
192
- if (!outcome.launched)
193
- return undefined;
194
- const ports = portsIn(outcome.summary);
195
- if (outcome.serves !== true && ports.length === 0)
196
- return undefined;
197
- const since = launch.serversSince ?? 0;
198
- if (runningLaunched(launch.codebase).some((item) => item.startedAt >= since))
199
- return undefined;
200
- const held = heldPorts(ports, launchLogDir(projectDirOf(launch.plainFile)));
201
- return [
202
- `nothing this launch started with activate is running, so what answers${ports.length > 0 ? ` at port ${ports.join(", ")}` : ""} is not this launch's code${held.length > 0 ? " - it is held by:" : "."}`,
203
- ...held,
204
- ].join("\n");
205
- }
206
- /** submit_launch: how the launch went, once, last - the harness reads its arguments, never the agent's prose. */
207
- function submitLaunchTool(launch, submitted) {
208
- return defineTool({
209
- name: "submit_launch",
210
- label: "Submit launch",
211
- description: "Say how the launch went - once, last. launched: true when it is running, or in place for the person to try - a CLI " +
212
- "or a library ready to run from its folder; false when it is not. The summary is what the person is told: where to " +
213
- "open it, or what to run - or why it did not come up, and what they can do. Something that serves counts as running " +
214
- "only when you started it with activate and it still runs: something else answering at its port - an earlier build, " +
215
- "another program - is not it, and is refused.",
216
- parameters: Type.Object({
217
- launched: Type.Boolean({ description: "true: it runs, or is in place to try; false: it did not come up" }),
218
- serves: Type.Boolean({ description: "true: something keeps running for the person to open or call - a backend, a frontend; false: a CLI or a library, tried from its folder" }),
219
- summary: Type.String({ description: "In a line or three: where it runs - the URL to open, the API's in a line - or the commands to try it; or why it did not come up" }),
220
- }),
221
- async execute(_id, params) {
222
- const why = notBacked(launch, params);
223
- if (why !== undefined) {
224
- throw new Error(`Not taken: you say it runs, but ${why}\nStart it with activate - stopping nothing turri did not start - or call submit_launch with launched false, saying what holds the port and whose it is, as said here.`);
225
- }
226
- submitted.outcome = { launched: params.launched, summary: params.summary, serves: params.serves };
227
- return text("Taken. You are done: end your turn.");
228
- },
229
- });
230
- }
231
- /** What the agent does once the code is in dist: find guidance and follow it from the host, or start it from dist. */
232
- export function launchGuide(code, hostDir) {
233
- const dist = shortPath(code.dir);
234
- const host = shortPath(hostDir);
235
- const built = shortPath(code.buildDir);
236
- return [
237
- "First ask yourself: is there guidance for how this project launches it - what the person said, the project's notes and",
238
- "skills below, or anything else you find? An integration a host application loads, say, put in place with the host's own",
239
- "scripts. Then:",
240
- "",
241
- `Without guidance - start it from ${dist}, as best it can be:`,
242
- `1. Find out how it runs: its README, its manifests (package.json, pyproject.toml, requirements.txt, go.mod, Cargo.toml, pom.xml, build.gradle, docker-compose.yml) and entry points, in ${dist}.`,
243
- "2. Check the toolchains it needs are on this machine (`command -v node`, `python3 --version`, `go version`, ...) - under another name too: python where python3 is not, of the version it needs. One missing: you install nothing on the machine and change none of its settings - stop, and say exactly what to install, the command the person runs themselves (`brew install node`), and that launching again picks it up.",
244
- "3. Install what it needs into the project yourself, in your shell - dependencies into a virtual environment or node_modules, a build that fetches packages, an image pull. Do not ask: do it, and fix what fails - within the project: never a global install, never a system setting.",
245
- "4. Start anything that keeps running - a backend, a frontend's dev server - with activate, with the URL it serves at: never in the shell with & or nohup. An app with a backend and a frontend: start both, the backend first.",
246
- "",
247
- `With guidance - follow it, on this machine, from the host codebase ${host}:`,
248
- `1. The code to launch is in ${dist}: the commit, whole. Take it from there, never from ${built}, where a pulse may be writing - always: where the guidance's own tooling reads ${built}, point it at ${dist} if it can take another source; if it cannot, do by hand, from ${dist}, what it does.`,
249
- `2. Read what the guidance leaves open - the scripts, files and commands it names, in ${host} - then do what it says, in its order. Where it says to change the host - a registration, an import, a config entry - change it.`,
250
- "3. Run the project's scripts and install what it needs into the project yourself, in your shell. A toolchain or system tool the machine lacks you never install, nor change a setting of the machine's: say the command the person runs themselves.",
251
- "4. Start what keeps running - a start script, a dev server - with activate (from: host when it runs in the host codebase), with the URL it serves at - never in the shell with & or nohup.",
252
- "",
253
- `Either way, never change ${built} or ${dist}: they are what was built, and a fix belongs in the ***plain. A config file it needs made from its example (a .env from .env.example) is fine.`,
254
- "",
255
- "Something it needs held already: a port, activate takes itself when a server turri's own launches started holds it, and",
256
- "says so. Anything else - a socket, a lock or pid file, a container name - held by a server one of turri's launches",
257
- "started (listed below, when any runs): free it with stop_launched. This launch is the newest: it always takes what",
258
- "turri's own earlier launches hold - never leave it unstarted to keep one of theirs running, whatever the reason, even",
259
- "to compare the two; turri tells the person what it stopped. Never decide from lsof yourself: call activate, and it says",
260
- "what holds the port and whose it is. What turri did not start, or another turri still",
261
- "running started, is never stopped and the app is never moved to another port: say what holds it, whose it is and how",
262
- "the person frees it, as the tools said it - never that turri did not start something its tools say it did.",
263
- "",
264
- "Last, call submit_launch once: launched, whether it serves, and in a line or three where to open it - the frontend's URL,",
265
- "and the API's in one line when there is one - or, a CLI or a library, a few commands to paste, run from its folder, with",
266
- "what they print; or why it did not come up. Where the guidance does not fit what you find, say so, and do not guess past it.",
267
- "Something answering at the app's port that this launch did not start with activate is not this launch: it is not",
268
- "launched, and you say what holds the port and whose it is. Stop a process only with activate or stop_launched, never in",
269
- "your shell.",
270
- ].join("\n");
271
- }
272
- /** What turri's launches of other modules run now, a line each with its pid - what stop_launched frees. */
273
- function otherLaunches(codebase) {
274
- return runningLaunched()
275
- .filter((item) => item.moduleName !== codebase)
276
- .map((item) => `- ${item.name}: pid ${item.pid}, ${item.moduleName}'s launch${item.launch !== undefined ? ` ${item.launch}` : ""}${item.commit !== undefined ? ` at ${item.commit}` : ""} - ${item.url ?? item.command}, in ${shortPath(item.dir)}`);
277
- }
278
- /** Run the launch agent to its end: how it went, as it submitted it - or, never submitted, its last words as a failure. */
279
- export async function runLaunchAgent(input) {
280
- const { launch, code } = input;
281
- const dir = launch.hostDir;
282
- const notes = projectNotes([input.cwd, dir, projectDirOf(launch.plainFile)]);
283
- const fileTools = [
284
- createReadToolDefinition(dir),
285
- createLsToolDefinition(dir),
286
- createGrepToolDefinition(dir),
287
- createFindToolDefinition(dir),
288
- // Guidance may say to change the host - a registration, an import.
289
- outsideBuiltCode(createEditToolDefinition(dir), dir),
290
- outsideBuiltCode(createWriteToolDefinition(dir), dir),
291
- ];
292
- const submitted = {};
293
- const tools = [activateTool(launch, code, input.freed), stopLaunchedTool(launch, input.freed), submitLaunchTool(launch, submitted)];
294
- const others = otherLaunches(launch.codebase);
295
- const executor = await createExecutor({
296
- // Its sessions are kept in the project, not in the folder it launches.
297
- cwd: projectDirOf(launch.plainFile),
298
- customTools: [...fileTools, launchShell(dir), ...tools],
299
- tools: [...fileTools.map((tool) => tool.name), "bash", ...tools.map((tool) => tool.name)],
300
- ...(input.model !== undefined ? { model: input.model } : {}),
301
- role: "launch",
302
- system: [
303
- "You get software that was just built running on the person's own machine, so they and turri's sentinel can try it. You ask no one: do it.",
304
- `Your file tools and your shell start in ${dir}. Your shell is the person's own - not a sandbox.`,
305
- ].join("\n"),
306
- task: [
307
- "pulse" in launch.cause
308
- ? `A pulse of ${launch.codebase} just landed: ${launch.cause.title}. The project launches what every pulse lands: launch it now, whether or not the guidance speaks of launching after a build - what the guidance says is how.`
309
- : `Launch ${launch.codebase} for the person to try.`,
310
- "",
311
- describeExport(code),
312
- "",
313
- launchGuide(code, dir),
314
- ...(launch.inModule !== undefined ? ["", `It is the codebase of module ${launch.inModule}.`] : []),
315
- ...(launch.guidance !== undefined ? ["", "What the person said of how to launch it:", launch.guidance] : []),
316
- ...(others.length > 0 ? ["", "What turri's launches of other modules run now - each its own module's, left running unless it holds what this launch needs:", ...others] : []),
317
- ...(notes.length > 0 ? ["", "The project's notes and skills:", ...notes] : []),
318
- ].join("\n"),
319
- });
320
- const stop = () => void executor.abort();
321
- input.signal?.addEventListener("abort", stop, { once: true });
322
- // What it said is checked again as it ends: a server it started may have exited since.
323
- const checked = (outcome) => {
324
- const why = notBacked(launch, outcome);
325
- return why !== undefined ? { launched: false, summary: `Not launched: the launch agent said it runs, but ${why}` } : { launched: outcome.launched, summary: outcome.summary };
326
- };
327
- try {
328
- const said = await ask(executor, BEGIN, input.onDelta);
329
- if (submitted.outcome !== undefined)
330
- return checked(submitted.outcome);
331
- // Ended without saying how it went: asked once more, then taken as not launched.
332
- const again = await ask(executor, "Call submit_launch now: launched or not, and in a line or three where it runs or why it did not come up.", input.onDelta);
333
- return submitted.outcome !== undefined ? checked(submitted.outcome) : { launched: false, summary: (again.trim() || said.trim() || "The launch agent ended without saying how it went.") };
334
- }
335
- finally {
336
- input.signal?.removeEventListener("abort", stop);
337
- executor.dispose();
338
- }
339
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,68 +0,0 @@
1
- import type { SentinelLaunches } from "./chats.ts";
2
- import { type Launch, type LaunchTrack } from "./launch-track.ts";
3
- import { type LaunchedProcess } from "./regenerate/launch.ts";
4
- import { type Job, type JobRegistry, type PulseSpec } from "./regenerate/jobs.ts";
5
- import type { SentinelCheck } from "./notice.ts";
6
- /** What runs for a pulse, as the sentinel is told it. */
7
- export interface PulseLaunch {
8
- /** The commit the pulse landed - none when it did not land. */
9
- commit?: string;
10
- /** launch-after-pulse was off as it landed: nothing launched for it. */
11
- off?: boolean;
12
- /** Its launch could not be asked for, and why. */
13
- notAsked?: string;
14
- /** The launch whose commit holds it - what runs. */
15
- launch?: Launch;
16
- /** The person stopped the launch: nothing runs to test. */
17
- stopped?: boolean;
18
- /** The pulses that landed after it which the launch holds too, oldest first. */
19
- later: Job[];
20
- /** Its functional specs a later pulse in the launch changed too: those pulses' checks test them. */
21
- laterSpecs: PulseSpec[];
22
- running: LaunchedProcess[];
23
- }
24
- export interface SessionLaunches extends SentinelLaunches {
25
- track: LaunchTrack;
26
- /** A pulse landed, its commit final: kept - and, under launch-after-pulse, its launch asked for. */
27
- landed(input: {
28
- job: Job;
29
- plainFile: string;
30
- moduleName: string;
31
- commit: string;
32
- title: string;
33
- }): void;
34
- /** What runs for a pulse, once `readyFor` resolved. */
35
- forPulse(job: Job): PulseLaunch;
36
- /** What the sentinel is told to carry on with a paused check: throws when what runs no longer holds it. */
37
- resumeText(work: {
38
- job: Job;
39
- } | {
40
- check: SentinelCheck;
41
- }): string;
42
- }
43
- export declare function createSessionLaunches(options: {
44
- cwd: string;
45
- jobs: JobRegistry;
46
- /** The launch agent's model: the coding model of the codebase. */
47
- model: (plainFile: string) => string | undefined;
48
- onChange: (launch: Launch) => void;
49
- }): SessionLaunches;
50
- /**
51
- * What the sentinel tests in, whatever is launched: what turri launched, and nothing it starts itself. Said in every
52
- * brief - a server it starts from plain_modules would pass on code nobody launched.
53
- */
54
- export declare const LAUNCHED_ONLY = "Never run the code in plain_modules, where a pulse may be writing, nor start a server of your own - not in your shell, not with a host's terminal: what would pass there is not what the person tries. A server that should run and does not is your finding.";
55
- /** The folder a launch's code is in: dist/<module>, where it is tried from. */
56
- export declare function launchedDir(launch: Pick<Launch, "code" | "plainFile" | "codebase">): string;
57
- /**
58
- * What runs of a launch, a line each: where, from where, its output - or that nothing was left running, and the folder it
59
- * is tried from.
60
- */
61
- export declare function whatRuns(running: LaunchedProcess[], from?: string): string[];
62
- /**
63
- * What the chat that asked for a launch is told when a newer one takes its place - superseded as it waited, or ended with
64
- * the newer one waiting, which stops what it started: it is told the newer one's end instead.
65
- */
66
- export declare function replacedNote(launch: Launch, next: Launch, job?: Job): string;
67
- /** What a chat is told of a launch that ended - one it asked for, or one after a pulse with the sentinel off. */
68
- export declare function launchedNote(launch: Launch, job?: Job): string;
@@ -1,225 +0,0 @@
1
- import { dirname, join } from "node:path";
2
- import { configForSpec, readProjectConfig } from "./config.js";
3
- import { createLaunchTrack, launchText } from "./launch-track.js";
4
- import { runLaunchAgent } from "./launch-agent.js";
5
- import { holdsAcross, runningLaunched } from "./regenerate/launch.js";
6
- import { distDirFor, projectDirOf } from "./regenerate/paths.js";
7
- import { pulseName } from "./regenerate/jobs.js";
8
- /** How long a pulse that landed is waited for to say its commit: the loop says it as the pulse settles. */
9
- const COMMIT_WAIT_MS = 10_000;
10
- export function createSessionLaunches(options) {
11
- const landedPulses = new Map();
12
- const waiters = new Map();
13
- const track = createLaunchTrack({
14
- cwd: options.cwd,
15
- run: (launch, code, signal, freed) => {
16
- const model = options.model(launch.plainFile);
17
- return runLaunchAgent({ launch, code, cwd: options.cwd, signal, freed, ...(model !== undefined ? { model } : {}) });
18
- },
19
- onChange: options.onChange,
20
- });
21
- // What an earlier session's launches left running holds the ports this one's need: stopped as the session starts.
22
- void track.sweep().catch(() => undefined);
23
- /** Whether the pulse's module launches what lands: its config as the pulse was queued with it. */
24
- const launchesAfter = (job) => {
25
- try {
26
- return readProjectConfig(options.cwd, job.configModule).launchAfterPulse === true;
27
- }
28
- catch {
29
- return false;
30
- }
31
- };
32
- const landedJob = (job) => job.status === "succeeded" && job.details?.landed === true && job.module !== undefined;
33
- /** The pulse's landing, once the loop has said its commit - none for one that did not land, or never said. */
34
- const landingOf = async (job) => {
35
- if (!landedJob(job))
36
- return undefined;
37
- const known = landedPulses.get(job.id);
38
- if (known !== undefined)
39
- return known;
40
- await new Promise((resolve) => {
41
- const timer = setTimeout(resolve, COMMIT_WAIT_MS);
42
- const list = waiters.get(job.id) ?? [];
43
- list.push(() => (clearTimeout(timer), resolve()));
44
- waiters.set(job.id, list);
45
- });
46
- return landedPulses.get(job.id);
47
- };
48
- const short = (commit) => commit.slice(0, 7);
49
- /** The last launch that took the codebase's code on - its own, or one of a module built on it - none superseded. */
50
- const lastFor = (codebase) => [...track.list()].reverse().find((launch) => launch.status !== "superseded" && track.replacing(launch).includes(codebase));
51
- /** The person stopped the last launch of the codebase's code: nothing of it runs. */
52
- const stoppedLast = (codebase) => lastFor(codebase)?.status === "stopped";
53
- /** Throws when what runs of the codebase's code does not hold the pulse's commit. */
54
- const mustHold = (job, landing) => {
55
- const runs = track.runs(landing.codebase);
56
- if (runs === undefined) {
57
- const last = lastFor(landing.codebase);
58
- const by = last?.replacedBy !== undefined ? track.list().find((launch) => launch.id === last.replacedBy) : undefined;
59
- if (last !== undefined && by !== undefined && by.codebase !== last.codebase) {
60
- throw new Error(`what ${last.codebase}'s launch ${last.id} started was stopped for ${by.codebase}'s launch ${by.id}, which needed what it held - nothing of ${landing.codebase} runs to test pulse ${job.id} in.`);
61
- }
62
- throw new Error(`nothing of ${landing.codebase} runs - no launch holds pulse ${job.id}'s commit ${short(landing.commit)}, and none that would is waiting.`);
63
- }
64
- if (!track.holds(landing.codebase, landing.commit)) {
65
- throw new Error(`what runs of ${landing.codebase} is ${runs.codebase === landing.codebase ? "its" : `${runs.codebase}'s`} commit ${runs.short}, which does not hold pulse ${job.id}'s commit ${short(landing.commit)} - and no launch that would is waiting.`);
66
- }
67
- return runs;
68
- };
69
- return {
70
- track,
71
- landed({ job, plainFile, moduleName, commit, title }) {
72
- const landing = { commit, plainFile, codebase: moduleName };
73
- if (configForSpec(plainFile).launchAfterPulse === true) {
74
- try {
75
- const { launch } = track.request({ plainFile, commit, cause: { pulse: job.id, title } });
76
- landing.codebase = launch.codebase;
77
- landing.launch = launch.id;
78
- }
79
- catch (error) {
80
- landing.notAsked = error instanceof Error ? error.message : String(error);
81
- }
82
- }
83
- landedPulses.set(job.id, landing);
84
- for (const resolve of waiters.get(job.id) ?? [])
85
- resolve();
86
- waiters.delete(job.id);
87
- },
88
- async readyFor(job) {
89
- // Nothing is launched for it: there is nothing to wait for.
90
- if (!launchesAfter(job))
91
- return;
92
- const landing = await landingOf(job);
93
- if (landing === undefined || landing.launch === undefined)
94
- return;
95
- await track.settled(landing.codebase);
96
- if (stoppedLast(landing.codebase))
97
- return;
98
- mustHold(job, landing);
99
- },
100
- async readyForCheck(check) {
101
- await track.settled(check.module);
102
- if (track.runs(check.module) === undefined && runningLaunched(check.module).length === 0) {
103
- throw new Error(`nothing of ${check.module} is launched to test it in - ask the chat to try it first, which launches it.`);
104
- }
105
- },
106
- settled: (codebase) => track.settled(codebase),
107
- replacing: (launch) => track.replacing(launch),
108
- forPulse(job) {
109
- const landing = landedPulses.get(job.id);
110
- if (landing === undefined)
111
- return { later: [], laterSpecs: [], running: [], ...(landedJob(job) && !launchesAfter(job) ? { off: true } : {}) };
112
- const launch = track.runs(landing.codebase);
113
- const base = { commit: landing.commit, running: runningLaunched(launch?.codebase ?? landing.codebase), later: [], laterSpecs: [] };
114
- if (landing.notAsked !== undefined)
115
- return { ...base, notAsked: landing.notAsked };
116
- if (landing.launch === undefined)
117
- return { ...base, off: true };
118
- if (launch === undefined || !track.holds(landing.codebase, landing.commit))
119
- return { ...base, stopped: true };
120
- // The pulses that landed after it, which what runs holds too - of its codebase, or of one built on it: what they
121
- // changed is theirs to test.
122
- const at = (codebase) => join(dirname(launch.moduleDir), codebase);
123
- const later = options.jobs
124
- .list()
125
- .filter((other) => {
126
- const theirs = landedPulses.get(other.id);
127
- return (other.id !== job.id &&
128
- theirs !== undefined &&
129
- theirs.commit !== landing.commit &&
130
- holdsAcross({ codebase: landing.codebase, commit: landing.commit }, { codebase: theirs.codebase, moduleDir: at(theirs.codebase), commit: theirs.commit }) &&
131
- holdsAcross({ codebase: theirs.codebase, commit: theirs.commit }, { codebase: launch.codebase, moduleDir: launch.moduleDir, commit: launch.commit }));
132
- })
133
- .sort((a, b) => a.sequence - b.sequence);
134
- const key = (spec) => `${spec.module}:${spec.funcId}`;
135
- const theirs = new Set(later.flatMap((other) => specsOf(other).map(key)));
136
- return { ...base, launch, later, laterSpecs: specsOf(job).filter((spec) => theirs.has(key(spec))) };
137
- },
138
- resumeText(work) {
139
- if ("job" in work) {
140
- const landing = landedPulses.get(work.job.id);
141
- if (landing === undefined)
142
- throw new Error(`turri has no commit for pulse ${work.job.id}.`);
143
- const launch = mustHold(work.job, landing);
144
- return [
145
- `What you were testing was launched again: ${launch.codebase} at ${launch.short} (${launch.id}${launch.status === "failed" ? ", which did not come up" : ""}). It still holds pulse ${work.job.id}'s commit, ${short(landing.commit)}${launch.codebase !== landing.codebase ? ` - built on ${landing.codebase}, it holds its code` : ""}.`,
146
- launch.status === "failed" ? `It did not come up: ${launchText(launch) || "the launch agent did not say why"}. That is what you find out about now.` : "What runs now:",
147
- ...(launch.status === "failed" ? [] : whatRuns(runningLaunched(launch.codebase), launchedDir(launch))),
148
- "",
149
- LAUNCHED_ONLY,
150
- "Carry on the check where you were. Do again what you were doing as it restarted: what failed then may have failed for that alone.",
151
- ].join("\n");
152
- }
153
- const runs = track.runs(work.check.module);
154
- const running = runningLaunched(runs?.codebase ?? work.check.module);
155
- if (runs === undefined && running.length === 0)
156
- throw new Error(`nothing of ${work.check.module} runs any more to test check ${work.check.id} in.`);
157
- return [
158
- `What you were testing was launched again: ${runs !== undefined ? `${runs.codebase} at ${runs.short}${runs.codebase !== work.check.module ? `, built on ${work.check.module} and holding its code` : ""}` : work.check.module}. What runs now:`,
159
- ...whatRuns(running, runs !== undefined ? launchedDir(runs) : undefined),
160
- "",
161
- LAUNCHED_ONLY,
162
- "Carry on the check where you were. Do again what you were doing as it restarted: what failed then may have failed for that alone.",
163
- ].join("\n");
164
- },
165
- };
166
- }
167
- /** A pulse's functional specs, every case. */
168
- function specsOf(job) {
169
- const cases = job.cases;
170
- return cases === undefined ? [] : [...cases.add, ...cases.patch, ...cases.again, ...cases.delete];
171
- }
172
- /**
173
- * What the sentinel tests in, whatever is launched: what turri launched, and nothing it starts itself. Said in every
174
- * brief - a server it starts from plain_modules would pass on code nobody launched.
175
- */
176
- export const LAUNCHED_ONLY = "Never run the code in plain_modules, where a pulse may be writing, nor start a server of your own - not in your shell, not with a host's terminal: what would pass there is not what the person tries. A server that should run and does not is your finding.";
177
- /** The folder a launch's code is in: dist/<module>, where it is tried from. */
178
- export function launchedDir(launch) {
179
- return launch.code?.dir ?? distDirFor(projectDirOf(launch.plainFile), launch.codebase);
180
- }
181
- /**
182
- * What runs of a launch, a line each: where, from where, its output - or that nothing was left running, and the folder it
183
- * is tried from.
184
- */
185
- export function whatRuns(running, from) {
186
- if (running.length === 0) {
187
- return [
188
- from !== undefined
189
- ? ` nothing is left running. It is in place in ${from}: try it from there - a CLI or a library as its README and entry points say. Something there that should serve and does not is what you find out about.`
190
- : " nothing is left running.",
191
- ];
192
- }
193
- return running.map((item) => ` ${item.name}: ${item.url ?? item.command} - in ${item.dir}, its output in ${item.log}`);
194
- }
195
- /** Why a launch was asked for, as the chat is told it: after which pulse landed - nothing for one a chat asked for. */
196
- const afterPulse = (launch, job) => ("pulse" in launch.cause ? ` after ${job !== undefined ? pulseName(job) : `pulse ${launch.cause.pulse}`} landed` : "");
197
- /**
198
- * What the chat that asked for a launch is told when a newer one takes its place - superseded as it waited, or ended with
199
- * the newer one waiting, which stops what it started: it is told the newer one's end instead.
200
- */
201
- export function replacedNote(launch, next, job) {
202
- const how = launch.status === "superseded" ? "never started" : launch.status === "launched" ? "came up, but not for long" : "ended";
203
- return [
204
- `The launch of ${launch.codebase} at ${launch.short} you asked for (${launch.id}) ${how}: a newer launch of it, ${next.id} at ${next.short}${afterPulse(next, job)}, takes its place${launch.status === "superseded" ? "" : " and stops what it started"}.`,
205
- "You are told where that one runs, or why it did not come up, once it ends. Say so in a line, if the person is waiting for it; open nothing and start nothing for it now.",
206
- ].join("\n");
207
- }
208
- /** What a chat is told of a launch that ended - one it asked for, or one after a pulse with the sentinel off. */
209
- export function launchedNote(launch, job) {
210
- const after = afterPulse(launch, job);
211
- if (launch.status === "stopped")
212
- return `The launch of ${launch.codebase} at ${launch.short}${after} was stopped on request: nothing of it runs. Say so in a line.`;
213
- const head = launch.status === "launched"
214
- ? `${launch.codebase} at ${launch.short} is launched${after}${launch.already === true ? " - out already" : ""}.`
215
- : `The launch of ${launch.codebase} at ${launch.short}${after} did not come up.`;
216
- return [
217
- head,
218
- "",
219
- launchText(launch),
220
- "",
221
- launch.status === "launched"
222
- ? "Tell the person in a line or two where it runs - what the summary says to open or run - then do what you were told to do once something is launched (opening it where the person can watch it, saying what to test), if anything. Start no other work."
223
- : "Tell the person in a line or two why it did not come up and what they can do - what the machine lacks they install themselves. Do not launch it again unless they ask.",
224
- ].join("\n");
225
- }