@uncarved/jade 0.1.3 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (450) hide show
  1. package/bin/jade.js +5 -27
  2. package/dist/api.d.ts +266 -0
  3. package/dist/api.js +38 -0
  4. package/dist/api.js.map +1 -0
  5. package/dist/config.d.ts +13 -32
  6. package/dist/config.js +39 -121
  7. package/dist/config.js.map +1 -1
  8. package/dist/fetch.d.ts +20 -0
  9. package/dist/fetch.js +190 -0
  10. package/dist/fetch.js.map +1 -0
  11. package/dist/hash.d.ts +2 -0
  12. package/dist/hash.js +42 -0
  13. package/dist/hash.js.map +1 -0
  14. package/dist/host.d.ts +71 -0
  15. package/dist/host.js +400 -0
  16. package/dist/host.js.map +1 -0
  17. package/dist/index.d.ts +11 -30
  18. package/dist/index.js +11 -30
  19. package/dist/index.js.map +1 -1
  20. package/dist/install.d.ts +78 -0
  21. package/dist/install.js +292 -0
  22. package/dist/install.js.map +1 -0
  23. package/dist/main.d.ts +1 -2
  24. package/dist/main.js +159 -1362
  25. package/dist/main.js.map +1 -1
  26. package/dist/manifest.d.ts +23 -0
  27. package/dist/manifest.js +159 -0
  28. package/dist/manifest.js.map +1 -0
  29. package/dist/membrane.d.ts +33 -0
  30. package/dist/membrane.js +140 -0
  31. package/dist/membrane.js.map +1 -0
  32. package/dist/remote.d.ts +10 -0
  33. package/dist/remote.js +292 -0
  34. package/dist/remote.js.map +1 -0
  35. package/dist/rescue.d.ts +10 -0
  36. package/dist/rescue.js +216 -0
  37. package/dist/rescue.js.map +1 -0
  38. package/dist/resolve.d.ts +34 -0
  39. package/dist/resolve.js +178 -0
  40. package/dist/resolve.js.map +1 -0
  41. package/dist/rpc.d.ts +26 -0
  42. package/dist/rpc.js +144 -0
  43. package/dist/rpc.js.map +1 -0
  44. package/dist/secrets.d.ts +12 -0
  45. package/dist/secrets.js +125 -0
  46. package/dist/secrets.js.map +1 -0
  47. package/dist/session.d.ts +45 -0
  48. package/dist/session.js +401 -0
  49. package/dist/session.js.map +1 -0
  50. package/dist/source.d.ts +12 -0
  51. package/dist/source.js +72 -0
  52. package/dist/source.js.map +1 -0
  53. package/dist/state.d.ts +37 -0
  54. package/dist/state.js +93 -0
  55. package/dist/state.js.map +1 -0
  56. package/dist/update.d.ts +2 -0
  57. package/dist/update.js +6 -3
  58. package/dist/update.js.map +1 -1
  59. package/package.json +10 -8
  60. package/plugins/approval/index.ts +297 -0
  61. package/plugins/approval/plugin.json +18 -0
  62. package/{src/plugins → plugins/approval}/policy.ts +21 -100
  63. package/{src/plugins → plugins/approval}/review.ts +62 -16
  64. package/plugins/ask/index.ts +159 -0
  65. package/plugins/ask/plugin.json +8 -0
  66. package/plugins/budget/index.ts +38 -0
  67. package/plugins/budget/plugin.json +13 -0
  68. package/{src/plugins → plugins/checks}/checks.ts +48 -38
  69. package/plugins/checks/index.ts +158 -0
  70. package/plugins/checks/plugin.json +14 -0
  71. package/plugins/checks/project.ts +81 -0
  72. package/plugins/commands/index.ts +76 -0
  73. package/plugins/commands/plugin.json +7 -0
  74. package/{src/plugins → plugins/compact}/compact.ts +73 -38
  75. package/plugins/compact/index.ts +115 -0
  76. package/plugins/compact/plugin.json +17 -0
  77. package/plugins/compact/style.ts +17 -0
  78. package/plugins/continue/index.ts +58 -0
  79. package/plugins/continue/plugin.json +13 -0
  80. package/{src/ui → plugins/fs}/diff.ts +2 -2
  81. package/{src/tools → plugins/fs}/fs.ts +19 -42
  82. package/{src/tools → plugins/fs}/grep.ts +1 -1
  83. package/plugins/fs/index.ts +34 -0
  84. package/plugins/fs/plugin.json +7 -0
  85. package/{src/ui → plugins/fs}/renderers.ts +25 -70
  86. package/plugins/fs/style.ts +18 -0
  87. package/plugins/fs/sys.ts +81 -0
  88. package/plugins/keys/index.ts +53 -0
  89. package/plugins/keys/plugin.json +7 -0
  90. package/plugins/mcp/index.ts +192 -0
  91. package/{src → plugins/mcp}/mcp.ts +32 -32
  92. package/plugins/mcp/plugin.json +7 -0
  93. package/plugins/mcp/project.ts +93 -0
  94. package/plugins/memory/index.ts +105 -0
  95. package/{src → plugins/memory}/memory.ts +20 -2
  96. package/plugins/memory/notes.ts +43 -0
  97. package/plugins/memory/plugin.json +7 -0
  98. package/plugins/memory/style.ts +17 -0
  99. package/plugins/mentions/attach.ts +127 -0
  100. package/plugins/mentions/index.ts +79 -0
  101. package/plugins/mentions/plugin.json +7 -0
  102. package/plugins/mentions/style.ts +17 -0
  103. package/plugins/models/config.ts +53 -0
  104. package/plugins/models/configure.ts +455 -0
  105. package/plugins/models/context.ts +32 -0
  106. package/plugins/models/index.ts +198 -0
  107. package/plugins/models/plugin.json +8 -0
  108. package/{src → plugins/models}/provider.ts +16 -119
  109. package/plugins/models/saved.ts +94 -0
  110. package/plugins/modes/index.ts +222 -0
  111. package/plugins/modes/plugin.json +9 -0
  112. package/plugins/plugins/index.ts +38 -0
  113. package/plugins/plugins/plugin.json +7 -0
  114. package/plugins/print/index.ts +142 -0
  115. package/plugins/print/plugin.json +8 -0
  116. package/plugins/prompts/index.ts +83 -0
  117. package/plugins/prompts/plugin.json +8 -0
  118. package/plugins/prompts/prompts.ts +253 -0
  119. package/plugins/prompts/sys.ts +72 -0
  120. package/plugins/renderers/index.ts +78 -0
  121. package/plugins/renderers/plugin.json +7 -0
  122. package/plugins/repeats/index.ts +165 -0
  123. package/plugins/repeats/plugin.json +6 -0
  124. package/plugins/schedule/cron.ts +74 -0
  125. package/plugins/schedule/index.ts +292 -0
  126. package/plugins/schedule/plugin.json +13 -0
  127. package/plugins/schedule/store.ts +149 -0
  128. package/plugins/scratch/index.ts +31 -0
  129. package/plugins/scratch/plugin.json +7 -0
  130. package/plugins/screenshot/index.ts +40 -0
  131. package/plugins/screenshot/plugin.json +7 -0
  132. package/plugins/screenshot/sys.ts +84 -0
  133. package/{src/tools/screenshot.ts → plugins/screenshot/tool.ts} +6 -6
  134. package/plugins/sessions/index.ts +148 -0
  135. package/plugins/sessions/plugin.json +8 -0
  136. package/plugins/shell/index.ts +33 -0
  137. package/plugins/shell/plugin.json +17 -0
  138. package/plugins/shell/renderers.ts +45 -0
  139. package/plugins/shell/service.ts +44 -0
  140. package/{src/tools → plugins/shell}/shell.ts +31 -20
  141. package/{src → plugins/shell}/sys.ts +2 -43
  142. package/plugins/skills/index.ts +96 -0
  143. package/plugins/skills/plugin.json +7 -0
  144. package/plugins/skills/project.ts +49 -0
  145. package/{src → plugins/skills}/skills.ts +4 -11
  146. package/plugins/suggest/index.ts +286 -0
  147. package/plugins/suggest/plugin.json +18 -0
  148. package/plugins/task/index.ts +167 -0
  149. package/plugins/task/plugin.json +15 -0
  150. package/plugins/task/style.ts +17 -0
  151. package/plugins/task/subagent.ts +257 -0
  152. package/{src/tools/todo.ts → plugins/todo/index.ts} +33 -7
  153. package/plugins/todo/plugin.json +7 -0
  154. package/{src/ui → plugins/tui}/editor.ts +3 -0
  155. package/plugins/tui/frontend.ts +596 -0
  156. package/plugins/tui/index.ts +37 -0
  157. package/plugins/tui/mentions.ts +113 -0
  158. package/plugins/tui/plugin.json +10 -0
  159. package/{src/ui → plugins/tui}/render.ts +8 -2
  160. package/{src/ui → plugins/tui}/screen.ts +8 -3
  161. package/{src/ui → plugins/tui}/transcript.ts +74 -99
  162. package/{src/ui/tui.tsx → plugins/tui/tui.ts} +358 -387
  163. package/{src/tools → plugins/undo}/checkpoint.ts +21 -60
  164. package/plugins/undo/index.ts +139 -0
  165. package/plugins/undo/notes.ts +43 -0
  166. package/plugins/undo/plugin.json +7 -0
  167. package/plugins/undo/style.ts +17 -0
  168. package/plugins/update/index.ts +40 -0
  169. package/plugins/update/plugin.json +13 -0
  170. package/plugins/web/env.ts +78 -0
  171. package/plugins/web/index.ts +133 -0
  172. package/plugins/web/plugin.json +15 -0
  173. package/plugins/web/renderers.ts +11 -0
  174. package/{src/tools → plugins/web}/web.ts +58 -26
  175. package/plugins-dist/approval/index.js +271 -0
  176. package/plugins-dist/approval/plugin.json +24 -0
  177. package/{dist/plugins → plugins-dist/approval}/policy.js +15 -81
  178. package/{dist/plugins → plugins-dist/approval}/review.js +56 -10
  179. package/{dist/plugins → plugins-dist/approval}/schema.js +0 -1
  180. package/plugins-dist/ask/index.js +145 -0
  181. package/plugins-dist/ask/plugin.json +12 -0
  182. package/plugins-dist/budget/index.js +37 -0
  183. package/plugins-dist/budget/plugin.json +15 -0
  184. package/{dist/plugins → plugins-dist/checks}/checks.js +46 -35
  185. package/plugins-dist/checks/index.js +150 -0
  186. package/plugins-dist/checks/plugin.json +21 -0
  187. package/plugins-dist/checks/project.js +76 -0
  188. package/plugins-dist/commands/index.js +33 -0
  189. package/plugins-dist/commands/plugin.json +9 -0
  190. package/{dist/plugins → plugins-dist/compact}/compact.js +51 -33
  191. package/plugins-dist/compact/index.js +100 -0
  192. package/plugins-dist/compact/plugin.json +25 -0
  193. package/plugins-dist/compact/style.js +14 -0
  194. package/plugins-dist/continue/index.js +57 -0
  195. package/plugins-dist/continue/plugin.json +15 -0
  196. package/{dist/ui → plugins-dist/fs}/diff.js +2 -3
  197. package/{dist/tools → plugins-dist/fs}/fs.js +17 -42
  198. package/{dist/tools → plugins-dist/fs}/grep.js +1 -2
  199. package/plugins-dist/fs/index.js +36 -0
  200. package/plugins-dist/fs/plugin.json +10 -0
  201. package/{dist/ui → plugins-dist/fs}/renderers.js +24 -61
  202. package/plugins-dist/fs/style.js +15 -0
  203. package/plugins-dist/fs/sys.js +54 -0
  204. package/plugins-dist/keys/index.js +36 -0
  205. package/plugins-dist/keys/plugin.json +9 -0
  206. package/plugins-dist/mcp/index.js +187 -0
  207. package/{dist → plugins-dist/mcp}/mcp.js +34 -30
  208. package/plugins-dist/mcp/plugin.json +12 -0
  209. package/plugins-dist/mcp/project.js +90 -0
  210. package/plugins-dist/memory/index.js +94 -0
  211. package/{dist → plugins-dist/memory}/memory.js +21 -3
  212. package/plugins-dist/memory/notes.js +36 -0
  213. package/plugins-dist/memory/plugin.json +11 -0
  214. package/plugins-dist/memory/style.js +14 -0
  215. package/plugins-dist/mentions/attach.js +120 -0
  216. package/plugins-dist/mentions/index.js +69 -0
  217. package/plugins-dist/mentions/plugin.json +9 -0
  218. package/plugins-dist/mentions/style.js +14 -0
  219. package/plugins-dist/models/config.js +53 -0
  220. package/plugins-dist/models/configure.js +415 -0
  221. package/plugins-dist/models/context.js +27 -0
  222. package/plugins-dist/models/index.js +167 -0
  223. package/plugins-dist/models/plugin.json +14 -0
  224. package/{dist → plugins-dist/models}/provider.js +18 -81
  225. package/plugins-dist/models/saved.js +80 -0
  226. package/plugins-dist/modes/index.js +190 -0
  227. package/plugins-dist/modes/plugin.json +18 -0
  228. package/plugins-dist/plugins/index.js +37 -0
  229. package/plugins-dist/plugins/plugin.json +10 -0
  230. package/plugins-dist/print/index.js +153 -0
  231. package/plugins-dist/print/plugin.json +14 -0
  232. package/plugins-dist/prompts/index.js +57 -0
  233. package/plugins-dist/prompts/plugin.json +13 -0
  234. package/plugins-dist/prompts/prompts.js +227 -0
  235. package/plugins-dist/prompts/sys.js +46 -0
  236. package/plugins-dist/renderers/index.js +36 -0
  237. package/plugins-dist/renderers/plugin.json +9 -0
  238. package/plugins-dist/repeats/index.js +165 -0
  239. package/plugins-dist/repeats/plugin.json +6 -0
  240. package/plugins-dist/schedule/cron.js +67 -0
  241. package/plugins-dist/schedule/index.js +281 -0
  242. package/plugins-dist/schedule/plugin.json +16 -0
  243. package/plugins-dist/schedule/store.js +125 -0
  244. package/plugins-dist/scratch/index.js +26 -0
  245. package/plugins-dist/scratch/plugin.json +10 -0
  246. package/plugins-dist/screenshot/index.js +35 -0
  247. package/plugins-dist/screenshot/plugin.json +11 -0
  248. package/plugins-dist/screenshot/sys.js +76 -0
  249. package/{dist/tools/screenshot.js → plugins-dist/screenshot/tool.js} +5 -4
  250. package/plugins-dist/sessions/index.js +136 -0
  251. package/plugins-dist/sessions/plugin.json +12 -0
  252. package/plugins-dist/shell/index.js +33 -0
  253. package/plugins-dist/shell/plugin.json +19 -0
  254. package/plugins-dist/shell/renderers.js +40 -0
  255. package/plugins-dist/shell/service.js +29 -0
  256. package/{dist/tools → plugins-dist/shell}/shell.js +31 -22
  257. package/{dist → plugins-dist/shell}/sys.js +2 -43
  258. package/plugins-dist/skills/index.js +90 -0
  259. package/plugins-dist/skills/plugin.json +12 -0
  260. package/plugins-dist/skills/project.js +47 -0
  261. package/{dist → plugins-dist/skills}/skills.js +3 -7
  262. package/plugins-dist/suggest/index.js +282 -0
  263. package/plugins-dist/suggest/plugin.json +23 -0
  264. package/plugins-dist/task/index.js +151 -0
  265. package/plugins-dist/task/plugin.json +23 -0
  266. package/plugins-dist/task/style.js +14 -0
  267. package/plugins-dist/task/subagent.js +208 -0
  268. package/{dist/tools/todo.js → plugins-dist/todo/index.js} +29 -7
  269. package/plugins-dist/todo/plugin.json +9 -0
  270. package/{dist/ui → plugins-dist/tui}/editor.js +3 -1
  271. package/plugins-dist/tui/frontend.js +586 -0
  272. package/{dist → plugins-dist/tui}/history.js +0 -1
  273. package/plugins-dist/tui/index.js +21 -0
  274. package/{dist/ui → plugins-dist/tui}/markdown.js +0 -1
  275. package/plugins-dist/tui/mentions.js +115 -0
  276. package/plugins-dist/tui/plugin.json +25 -0
  277. package/{dist/ui → plugins-dist/tui}/render.js +7 -3
  278. package/{dist/ui → plugins-dist/tui}/screen.js +6 -2
  279. package/{dist/ui → plugins-dist/tui}/transcript.js +76 -98
  280. package/{dist/ui → plugins-dist/tui}/tui.js +185 -53
  281. package/{dist/tools → plugins-dist/undo}/checkpoint.js +21 -55
  282. package/plugins-dist/undo/index.js +140 -0
  283. package/plugins-dist/undo/notes.js +36 -0
  284. package/plugins-dist/undo/plugin.json +9 -0
  285. package/plugins-dist/undo/style.js +14 -0
  286. package/plugins-dist/update/index.js +34 -0
  287. package/plugins-dist/update/plugin.json +15 -0
  288. package/plugins-dist/web/env.js +80 -0
  289. package/plugins-dist/web/index.js +124 -0
  290. package/plugins-dist/web/plugin.json +21 -0
  291. package/plugins-dist/web/renderers.js +7 -0
  292. package/{dist/tools → plugins-dist/web}/web.js +50 -24
  293. package/sdk/python/__pycache__/jade_plugin.cpython-312.pyc +0 -0
  294. package/sdk/python/jade_plugin.py +380 -0
  295. package/src/api.ts +298 -0
  296. package/src/config.ts +32 -134
  297. package/src/fetch.ts +216 -0
  298. package/src/hash.ts +39 -0
  299. package/src/host.ts +429 -0
  300. package/src/index.ts +23 -30
  301. package/src/install.ts +355 -0
  302. package/src/main.ts +155 -1387
  303. package/src/manifest.ts +160 -0
  304. package/src/membrane.ts +142 -0
  305. package/src/remote.ts +288 -0
  306. package/src/rescue.ts +217 -0
  307. package/src/resolve.ts +199 -0
  308. package/src/rpc.ts +144 -0
  309. package/src/secrets.ts +122 -0
  310. package/src/session.ts +458 -0
  311. package/src/source.ts +83 -0
  312. package/src/state.ts +120 -0
  313. package/src/update.ts +265 -262
  314. package/LICENSE +0 -21
  315. package/README.md +0 -204
  316. package/dist/commands.d.ts +0 -50
  317. package/dist/commands.js +0 -126
  318. package/dist/commands.js.map +0 -1
  319. package/dist/context.d.ts +0 -17
  320. package/dist/context.js +0 -53
  321. package/dist/context.js.map +0 -1
  322. package/dist/distro.d.ts +0 -141
  323. package/dist/distro.js +0 -462
  324. package/dist/distro.js.map +0 -1
  325. package/dist/history.d.ts +0 -10
  326. package/dist/history.js.map +0 -1
  327. package/dist/mcp.d.ts +0 -114
  328. package/dist/mcp.js.map +0 -1
  329. package/dist/memory.d.ts +0 -19
  330. package/dist/memory.js.map +0 -1
  331. package/dist/mentions.d.ts +0 -35
  332. package/dist/mentions.js +0 -130
  333. package/dist/mentions.js.map +0 -1
  334. package/dist/plugin-cli.d.ts +0 -16
  335. package/dist/plugin-cli.js +0 -294
  336. package/dist/plugin-cli.js.map +0 -1
  337. package/dist/plugins/budget.d.ts +0 -9
  338. package/dist/plugins/budget.js +0 -30
  339. package/dist/plugins/budget.js.map +0 -1
  340. package/dist/plugins/builtins.d.ts +0 -10
  341. package/dist/plugins/builtins.js +0 -25
  342. package/dist/plugins/builtins.js.map +0 -1
  343. package/dist/plugins/checks.d.ts +0 -71
  344. package/dist/plugins/checks.js.map +0 -1
  345. package/dist/plugins/compact.d.ts +0 -26
  346. package/dist/plugins/compact.js.map +0 -1
  347. package/dist/plugins/core.d.ts +0 -47
  348. package/dist/plugins/core.js +0 -229
  349. package/dist/plugins/core.js.map +0 -1
  350. package/dist/plugins/host.d.ts +0 -52
  351. package/dist/plugins/host.js +0 -115
  352. package/dist/plugins/host.js.map +0 -1
  353. package/dist/plugins/install.d.ts +0 -68
  354. package/dist/plugins/install.js +0 -377
  355. package/dist/plugins/install.js.map +0 -1
  356. package/dist/plugins/loader.d.ts +0 -410
  357. package/dist/plugins/loader.js +0 -407
  358. package/dist/plugins/loader.js.map +0 -1
  359. package/dist/plugins/policy.d.ts +0 -98
  360. package/dist/plugins/policy.js.map +0 -1
  361. package/dist/plugins/prompts.d.ts +0 -43
  362. package/dist/plugins/prompts.js +0 -284
  363. package/dist/plugins/prompts.js.map +0 -1
  364. package/dist/plugins/repeats.d.ts +0 -16
  365. package/dist/plugins/repeats.js +0 -151
  366. package/dist/plugins/repeats.js.map +0 -1
  367. package/dist/plugins/review.d.ts +0 -18
  368. package/dist/plugins/review.js.map +0 -1
  369. package/dist/plugins/schema.d.ts +0 -2
  370. package/dist/plugins/schema.js.map +0 -1
  371. package/dist/plugins/sessions.d.ts +0 -7
  372. package/dist/plugins/sessions.js +0 -110
  373. package/dist/plugins/sessions.js.map +0 -1
  374. package/dist/provider.d.ts +0 -165
  375. package/dist/provider.js.map +0 -1
  376. package/dist/session-lifecycle.d.ts +0 -61
  377. package/dist/session-lifecycle.js +0 -167
  378. package/dist/session-lifecycle.js.map +0 -1
  379. package/dist/session-scope.d.ts +0 -53
  380. package/dist/session-scope.js +0 -116
  381. package/dist/session-scope.js.map +0 -1
  382. package/dist/sessions.d.ts +0 -28
  383. package/dist/sessions.js +0 -73
  384. package/dist/sessions.js.map +0 -1
  385. package/dist/skills.d.ts +0 -37
  386. package/dist/skills.js.map +0 -1
  387. package/dist/sys.d.ts +0 -51
  388. package/dist/sys.js.map +0 -1
  389. package/dist/tools/ask.d.ts +0 -11
  390. package/dist/tools/ask.js +0 -62
  391. package/dist/tools/ask.js.map +0 -1
  392. package/dist/tools/checkpoint.d.ts +0 -43
  393. package/dist/tools/checkpoint.js.map +0 -1
  394. package/dist/tools/fs.d.ts +0 -39
  395. package/dist/tools/fs.js.map +0 -1
  396. package/dist/tools/grep.d.ts +0 -6
  397. package/dist/tools/grep.js.map +0 -1
  398. package/dist/tools/screenshot.d.ts +0 -15
  399. package/dist/tools/screenshot.js.map +0 -1
  400. package/dist/tools/shell.d.ts +0 -55
  401. package/dist/tools/shell.js.map +0 -1
  402. package/dist/tools/task.d.ts +0 -39
  403. package/dist/tools/task.js +0 -117
  404. package/dist/tools/task.js.map +0 -1
  405. package/dist/tools/todo.d.ts +0 -10
  406. package/dist/tools/todo.js.map +0 -1
  407. package/dist/tools/web.d.ts +0 -53
  408. package/dist/tools/web.js.map +0 -1
  409. package/dist/ui/configure.d.ts +0 -20
  410. package/dist/ui/configure.js +0 -447
  411. package/dist/ui/configure.js.map +0 -1
  412. package/dist/ui/diff.d.ts +0 -20
  413. package/dist/ui/diff.js.map +0 -1
  414. package/dist/ui/editor.d.ts +0 -41
  415. package/dist/ui/editor.js.map +0 -1
  416. package/dist/ui/markdown.d.ts +0 -22
  417. package/dist/ui/markdown.js.map +0 -1
  418. package/dist/ui/render.d.ts +0 -14
  419. package/dist/ui/render.js.map +0 -1
  420. package/dist/ui/renderers.d.ts +0 -8
  421. package/dist/ui/renderers.js.map +0 -1
  422. package/dist/ui/screen.d.ts +0 -118
  423. package/dist/ui/screen.js.map +0 -1
  424. package/dist/ui/transcript.d.ts +0 -46
  425. package/dist/ui/transcript.js.map +0 -1
  426. package/dist/ui/tui.d.ts +0 -47
  427. package/dist/ui/tui.js.map +0 -1
  428. package/src/commands.ts +0 -144
  429. package/src/context.ts +0 -64
  430. package/src/distro.ts +0 -577
  431. package/src/mentions.ts +0 -135
  432. package/src/plugin-cli.ts +0 -278
  433. package/src/plugins/budget.ts +0 -37
  434. package/src/plugins/builtins.ts +0 -34
  435. package/src/plugins/core.ts +0 -257
  436. package/src/plugins/host.ts +0 -146
  437. package/src/plugins/install.ts +0 -429
  438. package/src/plugins/loader.ts +0 -742
  439. package/src/plugins/prompts.ts +0 -327
  440. package/src/plugins/repeats.ts +0 -157
  441. package/src/plugins/sessions.ts +0 -109
  442. package/src/session-lifecycle.ts +0 -194
  443. package/src/session-scope.ts +0 -135
  444. package/src/sessions.ts +0 -78
  445. package/src/tools/ask.ts +0 -72
  446. package/src/tools/task.ts +0 -149
  447. package/src/ui/configure.ts +0 -471
  448. /package/{src/plugins → plugins/approval}/schema.ts +0 -0
  449. /package/{src → plugins/tui}/history.ts +0 -0
  450. /package/{src/ui → plugins/tui}/markdown.ts +0 -0
package/src/host.ts ADDED
@@ -0,0 +1,429 @@
1
+ // 进程级的插件宿主:发现、解析、激活、服务注册、故障隔离、关闭(3.1、4.1、5.3、5.4)。
2
+
3
+ import path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { importProjectModule, UntrustedPlugin, type Plugin, type TrustOptions } from "uncarved";
6
+ import {
7
+ API_VERSION,
8
+ PluginError,
9
+ ServiceUnavailable,
10
+ StaleContext,
11
+ type Caller,
12
+ type Disposer,
13
+ type Jade,
14
+ type PluginLayer,
15
+ type PluginModule,
16
+ type PluginSource,
17
+ type ProcessContext,
18
+ type Secrets,
19
+ } from "./api.ts";
20
+ import { pluginConfig, readConfigFile, type ConfigFile } from "./config.ts";
21
+ import { discover, type BrokenSource, type LayerRoot } from "./manifest.ts";
22
+ import { ambient, invoke, Scope, serviceHandle, type Owner } from "./membrane.ts";
23
+ import { startRemote } from "./remote.ts";
24
+ import { resolve, type Plan, type PlanState } from "./resolve.ts";
25
+ import { scopedSecrets, SecretsStore } from "./secrets.ts";
26
+ import { Sessions } from "./session.ts";
27
+ import { countFault, readFaults, readPluginsConfig, writeFaults, type Faults } from "./state.ts";
28
+
29
+ /** untrusted:项目层插件没有得到用户确认,没有执行它的任何代码 */
30
+ export type PluginState = PlanState | "broken" | "failed" | "untrusted" | "quarantined";
31
+
32
+ export interface PluginInfo {
33
+ id?: string;
34
+ version?: string;
35
+ layer: PluginLayer;
36
+ dir: string;
37
+ state: PluginState;
38
+ reason?: string;
39
+ }
40
+
41
+ export interface HostOptions {
42
+ roots: LayerRoot[];
43
+ /** $JADE_HOME:plugins.json、state/faults.json 所在目录 */
44
+ home: string;
45
+ /** 工作目录,默认 process.cwd() */
46
+ cwd?: string;
47
+ /** 配置文件(第 8 节):用户层默认 $JADE_HOME/config.json;项目层不写就没有 */
48
+ config?: { user?: string; project?: string };
49
+ flags?: readonly string[];
50
+ safe?: boolean;
51
+ /** 项目层插件的确认(第 7 节):确认记录和向用户提问的方式。不提供时不加载带代码的项目层插件 */
52
+ trust?: TrustOptions;
53
+ /** 要告诉用户的事(插件失败、被隔离、自动停用……),由前端或 CLI 显示 */
54
+ report?: (message: string) => void;
55
+ }
56
+
57
+ /** 核心自己的身份:核心通过服务句柄调用插件(例如 frontend@1)时的调用方 */
58
+ const CORE_ID = "jade";
59
+
60
+ /** 核心自己提供的诊断服务(3.4),名字要和 api.ts 的 Jade 一致 */
61
+ export const JADE_SERVICE = "jade@1";
62
+
63
+ interface Active {
64
+ source: PluginSource;
65
+ module: PluginModule;
66
+ /** 进程级作用域 */
67
+ owner: Owner;
68
+ /** 会话级作用域:隔离插件时一并关闭 */
69
+ sessions: Set<Scope>;
70
+ /** 项目层插件:把它交给内核的插件标记为已确认(内核拒绝未经确认的项目层插件) */
71
+ mark?: (p: Plugin) => Plugin;
72
+ }
73
+
74
+ /** 状态在启动时由 plugins.json、faults.json 和清单算出(不执行插件代码),之后只由宿主改动 */
75
+ export async function planPlugins(opts: Pick<HostOptions, "roots" | "home" | "flags" | "safe">): Promise<{ plan: Plan; broken: BrokenSource[]; faults: Faults }> {
76
+ const [{ sources, broken }, config, faults] = await Promise.all([discover(opts.roots), readPluginsConfig(opts.home), readFaults(opts.home)]);
77
+ const disabled = new Set([...config.disabled, ...faults.autoDisabled]);
78
+ const plan = resolve(sources, { apiVersion: API_VERSION, disabled, safe: opts.safe, flags: opts.flags, coreServices: [JADE_SERVICE] });
79
+ // 区分"用户停用"和"连续崩溃后自动停用"
80
+ for (const e of plan.entries) {
81
+ if (e.state === "disabled" && e.reason !== "safe mode" && !config.disabled.includes(e.source.manifest.id)) {
82
+ e.reason = `disabled after ${faults.streaks[e.source.manifest.id]?.count ?? "repeated"} faulty launches (last: ${faults.streaks[e.source.manifest.id]?.last ?? "unknown"}); run "jade plugins enable ${e.source.manifest.id}" to retry`;
83
+ }
84
+ }
85
+ return { plan, broken, faults };
86
+ }
87
+
88
+ export class PluginHost {
89
+ readonly plan: Plan;
90
+ readonly #opts: HostOptions;
91
+ readonly #broken: BrokenSource[];
92
+ readonly #faults: Faults;
93
+ /** 本次启动里已经记过故障的插件 */
94
+ readonly #faulted = new Set<string>();
95
+ readonly #status = new Map<string, { state: PluginState; reason?: string }>();
96
+ readonly #active: Active[] = [];
97
+ readonly #services = new Map<string, { impl: object | ((caller: Caller) => object); provider: Owner }>();
98
+ /** 按调用方创建的服务实例:调用方作用域 → 服务名 → 实例 */
99
+ readonly #perCaller = new WeakMap<Scope, Map<string, object>>();
100
+ readonly #core: Owner = { plugin: CORE_ID, scope: new Scope(CORE_ID) };
101
+ /** 每个插件自己的密钥;进程级和会话级 ctx 共享同一个实例 */
102
+ readonly #secrets: SecretsStore;
103
+ #config: { user: ConfigFile; project: ConfigFile } = { user: {}, project: {} };
104
+ readonly #pluginConfigs = new Map<string, Readonly<Record<string, unknown>>>();
105
+ #sessions: Sessions | undefined;
106
+ #writing: Promise<void> = Promise.resolve();
107
+
108
+ private constructor(opts: HostOptions, plan: Plan, broken: BrokenSource[], faults: Faults) {
109
+ this.#opts = opts;
110
+ this.plan = plan;
111
+ this.#broken = broken;
112
+ this.#faults = faults;
113
+ this.#secrets = new SecretsStore(opts.home);
114
+ for (const e of plan.entries) this.#status.set(e.source.dir, { state: e.state, ...(e.reason ? { reason: e.reason } : {}) });
115
+ // 核心自己的诊断服务:插件在激活阶段就能取(`/plugins` 用它)
116
+ this.#services.set(JADE_SERVICE, {
117
+ impl: {
118
+ plugins: () => this.status().map((p) => ({ ...p })),
119
+ services: () => [...this.#services].map(([service, e]) => ({ service, provider: e.provider.plugin })).sort((a, b) => a.service.localeCompare(b.service)),
120
+ } satisfies Jade,
121
+ provider: this.#core,
122
+ });
123
+ }
124
+
125
+ /** 解析并按顺序激活全部插件。单个插件失败不影响其他插件,不抛出 */
126
+ static async start(opts: HostOptions): Promise<PluginHost> {
127
+ const { plan, broken, faults } = await planPlugins(opts);
128
+ const host = new PluginHost(opts, plan, broken, faults);
129
+ const [user, project] = await Promise.all([
130
+ readConfigFile(opts.config?.user ?? path.join(opts.home, "config.json")),
131
+ opts.config?.project ? readConfigFile(opts.config.project) : { config: {}, error: undefined },
132
+ ]);
133
+ host.#config = { user: user.config, project: project.config };
134
+ for (const e of [user.error, project.error]) if (e) host.#report(e);
135
+ for (const w of plan.warnings) host.#report(w);
136
+ // 缺依赖、成环而没加载的插件:例如停用 jade/shell 之后 jade/checks 也不会运行,不能悄悄发生
137
+ for (const e of plan.entries) if (e.state === "skipped" && !e.expected) host.#report(`plugin ${e.source.manifest.id} is not loaded: ${e.reason}`);
138
+ for (const b of broken) host.#report(`plugin at ${b.dir}: ${b.error}`);
139
+ for (const source of plan.order) await host.#activate(source);
140
+ await host.#saveFaults();
141
+ return host;
142
+ }
143
+
144
+ /** 每个插件的状态和原因,包括读不出清单的目录 */
145
+ status(): PluginInfo[] {
146
+ const infos: PluginInfo[] = this.plan.entries.map((e) => {
147
+ const s = this.#status.get(e.source.dir)!;
148
+ return { id: e.source.manifest.id, version: e.source.manifest.version, layer: e.source.layer, dir: e.source.dir, state: s.state, ...(s.reason ? { reason: s.reason } : {}) };
149
+ });
150
+ for (const b of this.#broken) infos.push({ layer: b.layer, dir: b.dir, state: "broken", reason: b.error });
151
+ return infos;
152
+ }
153
+
154
+ /** 核心取服务(例如 frontend@1、provider@1)。没有提供者时返回 undefined */
155
+ service<T extends object>(name: string): T | undefined {
156
+ return this.#handle<T>(name, this.#core);
157
+ }
158
+
159
+ /** 一个插件的密钥;会话级 ctx 也用它,和进程级共享同一份 */
160
+ secrets(plugin: string): Secrets {
161
+ return this.#secrets.for(plugin);
162
+ }
163
+
164
+ /**
165
+ * 处理没人接住的异常(5.3)。归属顺序:AsyncLocalStorage → 错误栈里的插件目录 → 未归属。
166
+ * 能归到插件的隔离它;未归属的记下来,进程不退出
167
+ */
168
+ handleUncaught(error: unknown): void {
169
+ const plugin = ambient.getStore()?.plugin ?? (error instanceof PluginError ? error.plugin : undefined) ?? this.#blame(error);
170
+ const message = error instanceof Error ? error.message : String(error);
171
+ if (plugin && plugin !== CORE_ID) {
172
+ void this.quarantine(plugin, message);
173
+ return;
174
+ }
175
+ this.#faults.unattributed.push({ at: new Date().toISOString(), error: error instanceof Error ? (error.stack ?? message) : message });
176
+ this.#report(`unhandled error not attributable to any plugin: ${message}`);
177
+ void this.#saveFaults();
178
+ }
179
+
180
+ /** 安装进程级的异常处理器,返回卸载函数 */
181
+ installProcessHandlers(): () => void {
182
+ const handler = (e: unknown) => this.handleUncaught(e);
183
+ process.on("uncaughtException", handler);
184
+ process.on("unhandledRejection", handler);
185
+ return () => {
186
+ process.off("uncaughtException", handler);
187
+ process.off("unhandledRejection", handler);
188
+ };
189
+ }
190
+
191
+ /** 隔离一个插件:关闭它的作用域、撤销它的注册,它提供的服务随之失效(5.3) */
192
+ async quarantine(id: string, reason: string): Promise<void> {
193
+ const i = this.#active.findIndex((a) => a.source.manifest.id === id);
194
+ if (i === -1) return;
195
+ const [a] = this.#active.splice(i, 1);
196
+ this.#status.set(a!.source.dir, { state: "quarantined", reason });
197
+ this.#report(`plugin ${id} was stopped after an error: ${reason}`);
198
+ this.#fault(id, reason);
199
+ // 先会话级、再进程级:会话里的东西可能用着进程级的服务
200
+ for (const s of [...a!.sessions, a!.owner.scope]) {
201
+ for (const e of await s.close()) this.#report(String(e instanceof Error ? e.message : e));
202
+ }
203
+ await this.#saveFaults();
204
+ }
205
+
206
+ /** 会话:新建、恢复、切换(4.2) */
207
+ get sessions(): Sessions {
208
+ return (this.#sessions ??= new Sessions({
209
+ home: this.#opts.home,
210
+ cwd: this.#cwd,
211
+ config: (source) => this.#configOf(source),
212
+ core: this.#core,
213
+ active: () => this.#active,
214
+ service: (name, caller) => this.#handle(name, caller),
215
+ provider: (name) => this.plan.providers.get(name),
216
+ secrets: (plugin) => this.#secrets.for(plugin),
217
+ track: (plugin, scope) => this.#active.find((a) => a.source.manifest.id === plugin)?.sessions.add(scope),
218
+ untrack: (plugin, scope) => this.#active.find((a) => a.source.manifest.id === plugin)?.sessions.delete(scope),
219
+ fault: (plugin, reason) => {
220
+ this.#fault(plugin, reason);
221
+ void this.#saveFaults();
222
+ },
223
+ report: (m) => this.#report(m),
224
+ }));
225
+ }
226
+
227
+ /**
228
+ * 逆序关闭全部插件。这次启动里跑过、没出故障的插件,连续故障计数清零;
229
+ * 没有加载的(自动停用、用户停用、安全模式)不算,保留它们的记录和最后一次的错误
230
+ */
231
+ async close(): Promise<void> {
232
+ if (this.#sessions) await this.#sessions.close();
233
+ await this.#core.scope.close();
234
+ const ran = new Set(this.#active.map((a) => a.source.manifest.id));
235
+ while (this.#active.length > 0) {
236
+ const a = this.#active.pop()!;
237
+ for (const e of await a.owner.scope.close()) this.#report(String(e instanceof Error ? e.message : e));
238
+ }
239
+ for (const id of Object.keys(this.#faults.streaks)) if (ran.has(id) && !this.#faulted.has(id)) delete this.#faults.streaks[id];
240
+ await this.#saveFaults();
241
+ }
242
+
243
+ // ---------- 激活 ----------
244
+
245
+ async #activate(source: PluginSource): Promise<void> {
246
+ const { manifest, dir } = source;
247
+ const id = manifest.id;
248
+ // 必需服务的提供者激活失败:不激活,原因精确到服务
249
+ for (const need of manifest.requires ?? []) {
250
+ const provider = this.plan.providers.get(need);
251
+ if (provider && !this.#services.has(need)) {
252
+ this.#status.set(dir, { state: "skipped", reason: `requires ${need}: its provider ${provider} failed to activate` });
253
+ return;
254
+ }
255
+ }
256
+ const scope = new Scope(id);
257
+ const owner: Owner = { plugin: id, scope };
258
+ try {
259
+ const { module, mark } = await this.#load(source, owner);
260
+ if (module.process) await invoke(owner, "process", () => module.process!(this.#processContext(source, owner)));
261
+ const missing = (manifest.provides ?? []).filter((s) => this.#services.get(s)?.provider !== owner);
262
+ if (missing.length > 0) throw new Error(`declares ${missing.join(", ")} in provides but did not provide it`);
263
+ this.#active.push({ source, module, owner, sessions: new Set(), ...(mark ? { mark } : {}) });
264
+ } catch (e) {
265
+ // 事务性:已经做的注册全部撤销(4.1)
266
+ await scope.close();
267
+ const reason = e instanceof PluginError && e.plugin === id ? String((e.cause as Error)?.message ?? e.message) : e instanceof Error ? e.message : String(e);
268
+ // 用户没有确认不是插件的故障,不计入连续崩溃
269
+ const untrusted = e instanceof UntrustedPlugin;
270
+ this.#status.set(dir, { state: untrusted ? "untrusted" : "failed", reason });
271
+ this.#report(`plugin ${id} ${untrusted ? "was not loaded" : "failed to activate"}: ${reason}`);
272
+ if (!untrusted) this.#fault(id, reason);
273
+ }
274
+ }
275
+
276
+ async #load(source: PluginSource, owner: Owner): Promise<{ module: PluginModule; mark?: (p: Plugin) => Plugin }> {
277
+ const { manifest, dir } = source;
278
+ if (manifest.runtime) {
279
+ // 进程外的项目层插件:内核的确认只能检查 JS 的 import,管不住另一种语言的代码从目录外加载什么
280
+ if (source.layer === "project") throw new Error(`out-of-process plugins cannot be loaded from a project yet; put it in ${path.join(this.#opts.home, "plugins")}`);
281
+ const module = await startRemote(source, owner, { report: (m) => this.#report(m), exited: (reason) => void this.quarantine(manifest.id, reason) });
282
+ return { module };
283
+ }
284
+ let mod: { default?: unknown };
285
+ let mark: ((p: Plugin) => Plugin) | undefined;
286
+ if (source.layer === "project") {
287
+ // 项目层:内核负责确认(哈希、import 不出目录、请求确认、导入),之前不执行任何代码(第 7 节)
288
+ const trust = this.#opts.trust;
289
+ if (!trust) throw new UntrustedPlugin(dir, "project plugins need confirmation, which this jade cannot ask for");
290
+ // 模块顶层代码也归这个插件(顶层启动的定时器出错时能找到它)
291
+ const loaded = await ambient.run(owner, () => importProjectModule(dir, { ...trust, entry: manifest.entry! }));
292
+ mod = loaded.module as { default?: unknown };
293
+ mark = loaded.mark;
294
+ } else {
295
+ const file = path.resolve(dir, manifest.entry!);
296
+ const rel = path.relative(dir, file);
297
+ if (rel.startsWith("..") || path.isAbsolute(rel)) throw new Error(`entry ${manifest.entry} is outside the plugin directory`);
298
+ mod = (await ambient.run(owner, () => import(pathToFileURL(file).href))) as { default?: unknown };
299
+ }
300
+ const m = mod.default;
301
+ if (typeof m !== "object" || m === null) throw new Error(`entry ${manifest.entry} must default-export definePlugin({ ... })`);
302
+ return { module: m as PluginModule, ...(mark ? { mark } : {}) };
303
+ }
304
+
305
+ #processContext(source: PluginSource, owner: Owner): ProcessContext {
306
+ const { manifest } = source;
307
+ const id = manifest.id;
308
+ // 每个方法都先检查:作用域关闭后旧 ctx 一律抛 StaleContext(4.1)
309
+ const declared = (name: string, lists: (readonly string[] | undefined)[]) => {
310
+ if (owner.scope.closed) throw new StaleContext(id);
311
+ if (!lists.some((l) => l?.includes(name))) throw new Error(`plugin ${id}: ${name} is not declared in plugin.json`);
312
+ };
313
+ return {
314
+ plugin: id,
315
+ signal: owner.scope.signal,
316
+ cwd: this.#cwd,
317
+ home: this.#opts.home,
318
+ config: this.#configOf(source),
319
+ secrets: scopedSecrets(this.#secrets.for(id), () => owner.scope.closed, id),
320
+ require: <T extends object>(name: string): T => {
321
+ declared(name, [manifest.requires]);
322
+ const h = this.#handle<T>(name, owner);
323
+ if (!h) throw new ServiceUnavailable(name, this.plan.providers.get(name) ?? "(none)");
324
+ return h;
325
+ },
326
+ service: <T extends object>(name: string): T | undefined => {
327
+ declared(name, [manifest.requires, manifest.optional]);
328
+ return this.#handle<T>(name, owner);
329
+ },
330
+ provide: (name: string, impl: object | ((caller: Caller) => object)): void => {
331
+ declared(name, [manifest.provides]);
332
+ if (this.plan.providers.get(name) !== id) throw new Error(`plugin ${id}: ${name} is provided by ${this.plan.providers.get(name)}`);
333
+ if (this.#services.has(name)) throw new Error(`plugin ${id}: ${name} is already provided`);
334
+ owner.scope.add(() => {
335
+ if (this.#services.get(name)?.provider === owner) this.#services.delete(name);
336
+ });
337
+ this.#services.set(name, { impl, provider: owner });
338
+ },
339
+ effect: async (start): Promise<void> => {
340
+ if (owner.scope.closed) throw new StaleContext(id);
341
+ // 插件调用自己的代码,不过膜:膜会把返回的清理函数也包起来,作用域关闭时它就被当成过期调用拒绝了。
342
+ // Scope.close 自己以插件身份执行清理函数、接住错误
343
+ const d = (await ambient.run(owner, start)) as Disposer | void;
344
+ if (typeof d === "function") owner.scope.add(d);
345
+ },
346
+ };
347
+ }
348
+
349
+ #handle<T extends object>(name: string, caller: Owner): T | undefined {
350
+ const entry = this.#services.get(name);
351
+ if (!entry) return undefined;
352
+ const { impl, provider } = entry;
353
+ const isLive = () => this.#services.get(name)?.provider === provider && !provider.scope.closed;
354
+ if (typeof impl !== "function") return serviceHandle<T>(name, impl, provider, caller, isLive);
355
+
356
+ let mine = this.#perCaller.get(caller.scope);
357
+ if (!mine) this.#perCaller.set(caller.scope, (mine = new Map()));
358
+ let instance = mine.get(name);
359
+ if (!instance) {
360
+ const info: Caller = {
361
+ plugin: caller.plugin,
362
+ layer: caller === this.#core ? "core" : (this.plan.entries.find((e) => e.source.manifest.id === caller.plugin)?.source.layer ?? "core"),
363
+ signal: caller.scope.signal,
364
+ onDispose: (d) => caller.scope.add(d, provider),
365
+ };
366
+ try {
367
+ instance = ambient.run(provider, () => impl(info));
368
+ } catch (e) {
369
+ throw new PluginError(provider.plugin, `${name} for ${caller.plugin}`, e);
370
+ }
371
+ if (typeof instance !== "object" || instance === null) throw new PluginError(provider.plugin, name, new Error("the service factory must return an object"));
372
+ mine.set(name, instance);
373
+ }
374
+ return serviceHandle<T>(name, instance, provider, caller, isLive);
375
+ }
376
+
377
+ get #cwd(): string {
378
+ return this.#opts.cwd ?? process.cwd();
379
+ }
380
+
381
+ /** 插件的配置;项目层设置了不允许设置的键时告诉用户一次 */
382
+ #configOf(source: PluginSource): Readonly<Record<string, unknown>> {
383
+ const id = source.manifest.id;
384
+ let c = this.#pluginConfigs.get(id);
385
+ if (!c) {
386
+ const { config, ignored } = pluginConfig(source, this.#config.user, this.#config.project);
387
+ if (ignored.length > 0) this.#report(`project config for ${id}: ${ignored.join(", ")} can only be set in your own config.json; ignored`);
388
+ this.#pluginConfigs.set(id, (c = config));
389
+ }
390
+ return c;
391
+ }
392
+
393
+ // ---------- 故障 ----------
394
+
395
+ /** 错误栈里第一个落在某个激活插件目录下的帧(5.3 第 2 步) */
396
+ #blame(error: unknown): string | undefined {
397
+ const stack = error instanceof Error ? error.stack : undefined;
398
+ if (!stack) return undefined;
399
+ const norm = (p: string) => p.replaceAll("\\", "/").toLowerCase();
400
+ let decoded = stack;
401
+ try {
402
+ decoded = decodeURIComponent(stack); // file:// URL 里的空格等被编码过
403
+ } catch {}
404
+ const frames = norm(decoded);
405
+ let best: { id: string; at: number } | undefined;
406
+ for (const a of this.#active) {
407
+ const at = frames.indexOf(norm(a.source.dir) + "/");
408
+ if (at !== -1 && (!best || at < best.at)) best = { id: a.source.manifest.id, at };
409
+ }
410
+ return best?.id;
411
+ }
412
+
413
+ #fault(id: string, reason: string): void {
414
+ if (this.#faulted.has(id)) return;
415
+ this.#faulted.add(id);
416
+ if (countFault(this.#faults, id, reason)) {
417
+ this.#report(`plugin ${id} faulted in ${this.#faults.streaks[id]!.count} launches in a row and will be disabled from the next launch; run "jade plugins enable ${id}" to retry`);
418
+ }
419
+ }
420
+
421
+ #saveFaults(): Promise<void> {
422
+ this.#writing = this.#writing.then(() => writeFaults(this.#opts.home, this.#faults)).catch((e) => this.#report(`cannot save faults: ${e instanceof Error ? e.message : e}`));
423
+ return this.#writing;
424
+ }
425
+
426
+ #report(message: string): void {
427
+ this.#opts.report?.(message);
428
+ }
429
+ }
package/src/index.ts CHANGED
@@ -1,30 +1,23 @@
1
- export * from "./distro.ts";
2
- export * from "./provider.ts";
3
- export * from "./sessions.ts";
4
- export * from "./memory.ts";
5
- export * from "./mentions.ts";
6
- export * from "./plugins/budget.ts";
7
- export * from "./plugins/compact.ts";
8
- export * from "./plugins/checks.ts";
9
- export * from "./plugins/policy.ts";
10
- export * from "./plugins/review.ts";
11
- export * from "./plugins/prompts.ts";
12
- export * from "./plugins/schema.ts";
13
- export * from "./tools/fs.ts";
14
- export * from "./tools/grep.ts";
15
- export * from "./tools/web.ts";
16
- export * from "./tools/screenshot.ts";
17
- export * from "./tools/shell.ts";
18
- export * from "./tools/task.ts";
19
- export * from "./tools/checkpoint.ts";
20
- export * from "./tools/todo.ts";
21
- export * from "./tools/ask.ts";
22
- export * from "./config.ts";
23
- export * from "./context.ts";
24
- export * from "./commands.ts";
25
- export * from "./plugins/loader.ts";
26
- export * from "./plugins/install.ts";
27
- export * from "./plugins/builtins.ts";
28
- export * from "./mcp.ts";
29
- export * from "./skills.ts";
30
- export * from "./plugins/host.ts";
1
+ export * from "./api.ts";
2
+ export { discover, isPluginId, parseManifest, satisfiesCaret, type BrokenSource, type LayerRoot } from "./manifest.ts";
3
+ export { resolve, type Plan, type PlanEntry, type PlanState, type ResolveOptions } from "./resolve.ts";
4
+ export { PluginHost, planPlugins, type HostOptions, type PluginInfo, type PluginState } from "./host.ts";
5
+ export { pluginsCommand } from "./rescue.ts";
6
+ export {
7
+ addPlugin,
8
+ installDir,
9
+ readRecords,
10
+ removePlugin,
11
+ updatePlugins,
12
+ type AddOptions,
13
+ type Added,
14
+ type InstallRecord,
15
+ type UpdateOptions,
16
+ type UpdateResult,
17
+ type UpdateStatus,
18
+ } from "./install.ts";
19
+ export { parseSource, type PluginSourceSpec, type SourceKind } from "./source.ts";
20
+ export { treeHash } from "./hash.ts";
21
+ export { CORE_PLUGIN_ID, NO_APPROVAL_REASON, Sessions } from "./session.ts";
22
+ export { pluginConfig, readConfigFile, type ConfigFile } from "./config.ts";
23
+ export { FAULT_LIMIT } from "./state.ts";