@skillcdn/console 0.4.7 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (599) hide show
  1. package/README.md +74 -14
  2. package/SKILLCDN.md +5 -3
  3. package/dist/agent-page.d.ts +44 -0
  4. package/dist/agent-page.d.ts.map +1 -0
  5. package/dist/agent-page.js +415 -0
  6. package/dist/agent-page.js.map +1 -0
  7. package/dist/agent-stream.d.ts +52 -0
  8. package/dist/agent-stream.d.ts.map +1 -0
  9. package/dist/agent-stream.js +155 -0
  10. package/dist/agent-stream.js.map +1 -0
  11. package/dist/api.d.ts +12 -6
  12. package/dist/api.d.ts.map +1 -1
  13. package/dist/api.js +11 -5
  14. package/dist/api.js.map +1 -1
  15. package/dist/avatar.d.ts +137 -0
  16. package/dist/avatar.d.ts.map +1 -0
  17. package/dist/avatar.js +1216 -0
  18. package/dist/avatar.js.map +1 -0
  19. package/dist/charts.d.ts +103 -0
  20. package/dist/charts.d.ts.map +1 -0
  21. package/dist/charts.js +182 -0
  22. package/dist/charts.js.map +1 -0
  23. package/dist/cli/cli.d.ts +39 -1
  24. package/dist/cli/cli.d.ts.map +1 -1
  25. package/dist/cli/cli.js +2424 -296
  26. package/dist/cli/cli.js.map +1 -1
  27. package/dist/cli/command-words.d.ts +20 -0
  28. package/dist/cli/command-words.d.ts.map +1 -0
  29. package/dist/cli/command-words.js +51 -0
  30. package/dist/cli/command-words.js.map +1 -0
  31. package/dist/cli/credentials.d.ts +59 -5
  32. package/dist/cli/credentials.d.ts.map +1 -1
  33. package/dist/cli/credentials.js +128 -16
  34. package/dist/cli/credentials.js.map +1 -1
  35. package/dist/cli/directory.d.ts +19 -4
  36. package/dist/cli/directory.d.ts.map +1 -1
  37. package/dist/cli/directory.js +16 -8
  38. package/dist/cli/directory.js.map +1 -1
  39. package/dist/cli/format.d.ts +91 -8
  40. package/dist/cli/format.d.ts.map +1 -1
  41. package/dist/cli/format.js +386 -57
  42. package/dist/cli/format.js.map +1 -1
  43. package/dist/cli/help.d.ts +13 -4
  44. package/dist/cli/help.d.ts.map +1 -1
  45. package/dist/cli/help.js +202 -62
  46. package/dist/cli/help.js.map +1 -1
  47. package/dist/cli/main.js +94 -0
  48. package/dist/cli/main.js.map +1 -1
  49. package/dist/cli/pack.d.ts +69 -36
  50. package/dist/cli/pack.d.ts.map +1 -1
  51. package/dist/cli/pack.js +241 -188
  52. package/dist/cli/pack.js.map +1 -1
  53. package/dist/cli/plugin-check.d.ts +42 -0
  54. package/dist/cli/plugin-check.d.ts.map +1 -1
  55. package/dist/cli/plugin-check.js +221 -36
  56. package/dist/cli/plugin-check.js.map +1 -1
  57. package/dist/cli/plugin-cli.d.ts +6 -1
  58. package/dist/cli/plugin-cli.d.ts.map +1 -1
  59. package/dist/cli/plugin-cli.js +21 -4
  60. package/dist/cli/plugin-cli.js.map +1 -1
  61. package/dist/cli/plugin-main.js +1 -0
  62. package/dist/cli/plugin-main.js.map +1 -1
  63. package/dist/cli/runner-host.d.ts +36 -0
  64. package/dist/cli/runner-host.d.ts.map +1 -0
  65. package/dist/cli/runner-host.js +154 -0
  66. package/dist/cli/runner-host.js.map +1 -0
  67. package/dist/cli/serve.d.ts +33 -1
  68. package/dist/cli/serve.d.ts.map +1 -1
  69. package/dist/cli/serve.js +275 -6
  70. package/dist/cli/serve.js.map +1 -1
  71. package/dist/cli/setup-machine.d.ts +36 -0
  72. package/dist/cli/setup-machine.d.ts.map +1 -0
  73. package/dist/cli/setup-machine.js +109 -0
  74. package/dist/cli/setup-machine.js.map +1 -0
  75. package/dist/client.d.ts +189 -10
  76. package/dist/client.d.ts.map +1 -1
  77. package/dist/client.js +192 -57
  78. package/dist/client.js.map +1 -1
  79. package/dist/compat.d.ts +1 -1
  80. package/dist/compat.js +2 -2
  81. package/dist/components/agent-page.d.ts +384 -0
  82. package/dist/components/agent-page.d.ts.map +1 -0
  83. package/dist/components/agent-page.js +985 -0
  84. package/dist/components/agent-page.js.map +1 -0
  85. package/dist/components/agents.d.ts +102 -0
  86. package/dist/components/agents.d.ts.map +1 -0
  87. package/dist/components/agents.js +246 -0
  88. package/dist/components/agents.js.map +1 -0
  89. package/dist/components/calendar.d.ts +17 -17
  90. package/dist/components/calendar.d.ts.map +1 -1
  91. package/dist/components/calendar.js +7 -2
  92. package/dist/components/calendar.js.map +1 -1
  93. package/dist/components/charts.d.ts +157 -0
  94. package/dist/components/charts.d.ts.map +1 -0
  95. package/dist/components/charts.js +182 -0
  96. package/dist/components/charts.js.map +1 -0
  97. package/dist/components/comments.d.ts +2 -0
  98. package/dist/components/comments.d.ts.map +1 -1
  99. package/dist/components/comments.js +1 -1
  100. package/dist/components/comments.js.map +1 -1
  101. package/dist/components/connect.d.ts.map +1 -1
  102. package/dist/components/connect.js +7 -2
  103. package/dist/components/connect.js.map +1 -1
  104. package/dist/components/decision-form.d.ts +21 -0
  105. package/dist/components/decision-form.d.ts.map +1 -1
  106. package/dist/components/decision-form.js +20 -6
  107. package/dist/components/decision-form.js.map +1 -1
  108. package/dist/components/decision-list.d.ts +24 -0
  109. package/dist/components/decision-list.d.ts.map +1 -1
  110. package/dist/components/decision-list.js +54 -5
  111. package/dist/components/decision-list.js.map +1 -1
  112. package/dist/components/desk-records.d.ts +102 -0
  113. package/dist/components/desk-records.d.ts.map +1 -0
  114. package/dist/components/desk-records.js +221 -0
  115. package/dist/components/desk-records.js.map +1 -0
  116. package/dist/components/desk.d.ts +85 -0
  117. package/dist/components/desk.d.ts.map +1 -0
  118. package/dist/components/desk.js +135 -0
  119. package/dist/components/desk.js.map +1 -0
  120. package/dist/components/event-feed.d.ts.map +1 -1
  121. package/dist/components/event-feed.js +26 -1
  122. package/dist/components/event-feed.js.map +1 -1
  123. package/dist/components/home.d.ts +12 -1
  124. package/dist/components/home.d.ts.map +1 -1
  125. package/dist/components/home.js +175 -16
  126. package/dist/components/home.js.map +1 -1
  127. package/dist/components/my-decisions.d.ts +5 -0
  128. package/dist/components/my-decisions.d.ts.map +1 -1
  129. package/dist/components/my-decisions.js +3 -3
  130. package/dist/components/my-decisions.js.map +1 -1
  131. package/dist/components/people.d.ts +17 -0
  132. package/dist/components/people.d.ts.map +1 -1
  133. package/dist/components/people.js +55 -19
  134. package/dist/components/people.js.map +1 -1
  135. package/dist/components/picker.d.ts +2 -0
  136. package/dist/components/picker.d.ts.map +1 -1
  137. package/dist/components/picker.js +1 -1
  138. package/dist/components/picker.js.map +1 -1
  139. package/dist/components/pictures.d.ts +38 -10
  140. package/dist/components/pictures.d.ts.map +1 -1
  141. package/dist/components/pictures.js +195 -40
  142. package/dist/components/pictures.js.map +1 -1
  143. package/dist/components/plugin-events.d.ts +29 -0
  144. package/dist/components/plugin-events.d.ts.map +1 -0
  145. package/dist/components/plugin-events.js +139 -0
  146. package/dist/components/plugin-events.js.map +1 -0
  147. package/dist/components/plugin-frame.d.ts.map +1 -1
  148. package/dist/components/plugin-frame.js +14 -37
  149. package/dist/components/plugin-frame.js.map +1 -1
  150. package/dist/components/plugin-settings.d.ts.map +1 -1
  151. package/dist/components/plugin-settings.js +58 -7
  152. package/dist/components/plugin-settings.js.map +1 -1
  153. package/dist/components/projects.d.ts.map +1 -1
  154. package/dist/components/projects.js +30 -10
  155. package/dist/components/projects.js.map +1 -1
  156. package/dist/components/rules.d.ts +8 -10
  157. package/dist/components/rules.d.ts.map +1 -1
  158. package/dist/components/rules.js +36 -14
  159. package/dist/components/rules.js.map +1 -1
  160. package/dist/components/sessions.d.ts.map +1 -1
  161. package/dist/components/sessions.js +8 -4
  162. package/dist/components/sessions.js.map +1 -1
  163. package/dist/components/setup.d.ts +59 -0
  164. package/dist/components/setup.d.ts.map +1 -0
  165. package/dist/components/setup.js +93 -0
  166. package/dist/components/setup.js.map +1 -0
  167. package/dist/components/sign-in.js +1 -1
  168. package/dist/components/sign-in.js.map +1 -1
  169. package/dist/components/task-form.d.ts.map +1 -1
  170. package/dist/components/task-form.js +2 -2
  171. package/dist/components/task-form.js.map +1 -1
  172. package/dist/components/task-list.d.ts +7 -6
  173. package/dist/components/task-list.d.ts.map +1 -1
  174. package/dist/components/task-list.js.map +1 -1
  175. package/dist/components/task-view.d.ts +3 -0
  176. package/dist/components/task-view.d.ts.map +1 -1
  177. package/dist/components/task-view.js +1 -1
  178. package/dist/components/task-view.js.map +1 -1
  179. package/dist/components/ui.d.ts +78 -8
  180. package/dist/components/ui.d.ts.map +1 -1
  181. package/dist/components/ui.js +88 -9
  182. package/dist/components/ui.js.map +1 -1
  183. package/dist/components/work.d.ts +5 -5
  184. package/dist/components/work.d.ts.map +1 -1
  185. package/dist/components/work.js.map +1 -1
  186. package/dist/components/workspace.d.ts +17 -0
  187. package/dist/components/workspace.d.ts.map +1 -1
  188. package/dist/components/workspace.js +129 -2
  189. package/dist/components/workspace.js.map +1 -1
  190. package/dist/connect-page.d.ts.map +1 -1
  191. package/dist/connect-page.js +5 -2
  192. package/dist/connect-page.js.map +1 -1
  193. package/dist/console.css +7551 -4580
  194. package/dist/console.d.ts +20 -0
  195. package/dist/console.d.ts.map +1 -1
  196. package/dist/console.js +331 -57
  197. package/dist/console.js.map +1 -1
  198. package/dist/data.d.ts +22 -1
  199. package/dist/data.d.ts.map +1 -1
  200. package/dist/data.js +62 -34
  201. package/dist/data.js.map +1 -1
  202. package/dist/desk-page.d.ts +38 -0
  203. package/dist/desk-page.d.ts.map +1 -0
  204. package/dist/desk-page.js +184 -0
  205. package/dist/desk-page.js.map +1 -0
  206. package/dist/desk-records-page.d.ts +18 -0
  207. package/dist/desk-records-page.d.ts.map +1 -0
  208. package/dist/desk-records-page.js +130 -0
  209. package/dist/desk-records-page.js.map +1 -0
  210. package/dist/desk-records.d.ts +247 -0
  211. package/dist/desk-records.d.ts.map +1 -0
  212. package/dist/desk-records.js +543 -0
  213. package/dist/desk-records.js.map +1 -0
  214. package/dist/desk.d.ts +122 -0
  215. package/dist/desk.d.ts.map +1 -0
  216. package/dist/desk.js +211 -0
  217. package/dist/desk.js.map +1 -0
  218. package/dist/feed-stream.d.ts +39 -0
  219. package/dist/feed-stream.d.ts.map +1 -0
  220. package/dist/feed-stream.js +117 -0
  221. package/dist/feed-stream.js.map +1 -0
  222. package/dist/glances.d.ts +39 -0
  223. package/dist/glances.d.ts.map +1 -0
  224. package/dist/glances.js +94 -0
  225. package/dist/glances.js.map +1 -0
  226. package/dist/home-tiles.d.ts +69 -5
  227. package/dist/home-tiles.d.ts.map +1 -1
  228. package/dist/home-tiles.js +347 -9
  229. package/dist/home-tiles.js.map +1 -1
  230. package/dist/i18n/en.d.ts +773 -3
  231. package/dist/i18n/en.d.ts.map +1 -1
  232. package/dist/i18n/en.js +770 -9
  233. package/dist/i18n/en.js.map +1 -1
  234. package/dist/i18n/ko.d.ts.map +1 -1
  235. package/dist/i18n/ko.js +736 -9
  236. package/dist/i18n/ko.js.map +1 -1
  237. package/dist/index.d.ts +19 -7
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/index.js +17 -5
  240. package/dist/index.js.map +1 -1
  241. package/dist/limits.d.ts +67 -0
  242. package/dist/limits.d.ts.map +1 -1
  243. package/dist/limits.js +67 -0
  244. package/dist/limits.js.map +1 -1
  245. package/dist/onboarding.d.ts +21 -0
  246. package/dist/onboarding.d.ts.map +1 -0
  247. package/dist/onboarding.js +43 -0
  248. package/dist/onboarding.js.map +1 -0
  249. package/dist/persona.d.ts +34 -0
  250. package/dist/persona.d.ts.map +1 -0
  251. package/dist/persona.js +71 -0
  252. package/dist/persona.js.map +1 -0
  253. package/dist/plugin/context.d.ts +42 -11
  254. package/dist/plugin/context.d.ts.map +1 -1
  255. package/dist/plugin/limits.d.ts +2 -0
  256. package/dist/plugin/limits.d.ts.map +1 -1
  257. package/dist/plugin/limits.js +2 -0
  258. package/dist/plugin/limits.js.map +1 -1
  259. package/dist/plugin/manifest.d.ts +13 -0
  260. package/dist/plugin/manifest.d.ts.map +1 -1
  261. package/dist/plugin/manifest.js +34 -4
  262. package/dist/plugin/manifest.js.map +1 -1
  263. package/dist/plugin/rest-schemas.d.ts +56 -0
  264. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  265. package/dist/plugin/rest-schemas.js +42 -0
  266. package/dist/plugin/rest-schemas.js.map +1 -1
  267. package/dist/plugin/sandbox.d.ts.map +1 -1
  268. package/dist/plugin/sandbox.js +4 -1
  269. package/dist/plugin/sandbox.js.map +1 -1
  270. package/dist/plugin/testing.d.ts +6 -2
  271. package/dist/plugin/testing.d.ts.map +1 -1
  272. package/dist/plugin/testing.js +52 -10
  273. package/dist/plugin/testing.js.map +1 -1
  274. package/dist/plugin.d.ts +1 -1
  275. package/dist/plugin.d.ts.map +1 -1
  276. package/dist/plugin.js +1 -1
  277. package/dist/plugin.js.map +1 -1
  278. package/dist/records.d.ts +283 -0
  279. package/dist/records.d.ts.map +1 -0
  280. package/dist/records.js +543 -0
  281. package/dist/records.js.map +1 -0
  282. package/dist/router.d.ts +50 -3
  283. package/dist/router.d.ts.map +1 -1
  284. package/dist/router.js +78 -7
  285. package/dist/router.js.map +1 -1
  286. package/dist/routes.d.ts +12 -2
  287. package/dist/routes.d.ts.map +1 -1
  288. package/dist/routes.js +14 -1
  289. package/dist/routes.js.map +1 -1
  290. package/dist/rules.d.ts +30 -11
  291. package/dist/rules.d.ts.map +1 -1
  292. package/dist/rules.js +99 -42
  293. package/dist/rules.js.map +1 -1
  294. package/dist/runner/acp.d.ts +20 -0
  295. package/dist/runner/acp.d.ts.map +1 -0
  296. package/dist/runner/acp.js +1132 -0
  297. package/dist/runner/acp.js.map +1 -0
  298. package/dist/runner/claude.d.ts +13 -0
  299. package/dist/runner/claude.d.ts.map +1 -0
  300. package/dist/runner/claude.js +615 -0
  301. package/dist/runner/claude.js.map +1 -0
  302. package/dist/runner/codex.d.ts +19 -0
  303. package/dist/runner/codex.d.ts.map +1 -0
  304. package/dist/runner/codex.js +597 -0
  305. package/dist/runner/codex.js.map +1 -0
  306. package/dist/runner/config.d.ts +35 -0
  307. package/dist/runner/config.d.ts.map +1 -0
  308. package/dist/runner/config.js +74 -0
  309. package/dist/runner/config.js.map +1 -0
  310. package/dist/runner/desk.d.ts +81 -0
  311. package/dist/runner/desk.d.ts.map +1 -0
  312. package/dist/runner/desk.js +303 -0
  313. package/dist/runner/desk.js.map +1 -0
  314. package/dist/runner/launchd.d.ts +7 -0
  315. package/dist/runner/launchd.d.ts.map +1 -0
  316. package/dist/runner/launchd.js +78 -0
  317. package/dist/runner/launchd.js.map +1 -0
  318. package/dist/runner/message.d.ts +66 -0
  319. package/dist/runner/message.d.ts.map +1 -0
  320. package/dist/runner/message.js +181 -0
  321. package/dist/runner/message.js.map +1 -0
  322. package/dist/runner/modules.d.ts +13 -0
  323. package/dist/runner/modules.d.ts.map +1 -0
  324. package/dist/runner/modules.js +30 -0
  325. package/dist/runner/modules.js.map +1 -0
  326. package/dist/runner/process.d.ts +7 -0
  327. package/dist/runner/process.d.ts.map +1 -0
  328. package/dist/runner/process.js +65 -0
  329. package/dist/runner/process.js.map +1 -0
  330. package/dist/runner/redact.d.ts +48 -0
  331. package/dist/runner/redact.d.ts.map +1 -0
  332. package/dist/runner/redact.js +214 -0
  333. package/dist/runner/redact.js.map +1 -0
  334. package/dist/runner/registry.d.ts +37 -0
  335. package/dist/runner/registry.d.ts.map +1 -0
  336. package/dist/runner/registry.js +26 -0
  337. package/dist/runner/registry.js.map +1 -0
  338. package/dist/runner/runner.d.ts +130 -0
  339. package/dist/runner/runner.d.ts.map +1 -0
  340. package/dist/runner/runner.js +1551 -0
  341. package/dist/runner/runner.js.map +1 -0
  342. package/dist/runner/slack.d.ts +16 -0
  343. package/dist/runner/slack.d.ts.map +1 -0
  344. package/dist/runner/slack.js +157 -0
  345. package/dist/runner/slack.js.map +1 -0
  346. package/dist/runner/systemd-user.d.ts +7 -0
  347. package/dist/runner/systemd-user.d.ts.map +1 -0
  348. package/dist/runner/systemd-user.js +93 -0
  349. package/dist/runner/systemd-user.js.map +1 -0
  350. package/dist/runner/task-scheduler.d.ts +38 -0
  351. package/dist/runner/task-scheduler.d.ts.map +1 -0
  352. package/dist/runner/task-scheduler.js +216 -0
  353. package/dist/runner/task-scheduler.js.map +1 -0
  354. package/dist/runner/types.d.ts +315 -0
  355. package/dist/runner/types.d.ts.map +1 -0
  356. package/dist/runner/types.js +24 -0
  357. package/dist/runner/types.js.map +1 -0
  358. package/dist/runner.d.ts +18 -0
  359. package/dist/runner.d.ts.map +1 -0
  360. package/dist/runner.js +20 -0
  361. package/dist/runner.js.map +1 -0
  362. package/dist/schemas.d.ts +6082 -1295
  363. package/dist/schemas.d.ts.map +1 -1
  364. package/dist/schemas.js +930 -31
  365. package/dist/schemas.js.map +1 -1
  366. package/dist/services.d.ts +110 -0
  367. package/dist/services.d.ts.map +1 -0
  368. package/dist/services.js +305 -0
  369. package/dist/services.js.map +1 -0
  370. package/dist/setup-guide.d.ts +64 -0
  371. package/dist/setup-guide.d.ts.map +1 -0
  372. package/dist/setup-guide.js +256 -0
  373. package/dist/setup-guide.js.map +1 -0
  374. package/dist/setup-page.d.ts +6 -0
  375. package/dist/setup-page.d.ts.map +1 -0
  376. package/dist/setup-page.js +29 -0
  377. package/dist/setup-page.js.map +1 -0
  378. package/dist/sse.d.ts +15 -0
  379. package/dist/sse.d.ts.map +1 -0
  380. package/dist/sse.js +73 -0
  381. package/dist/sse.js.map +1 -0
  382. package/dist/tab-title.d.ts +6 -0
  383. package/dist/tab-title.d.ts.map +1 -0
  384. package/dist/tab-title.js +22 -0
  385. package/dist/tab-title.js.map +1 -0
  386. package/dist/tokens.d.ts.map +1 -1
  387. package/dist/tokens.js +3 -0
  388. package/dist/tokens.js.map +1 -1
  389. package/dist/use-action.d.ts +5 -2
  390. package/dist/use-action.d.ts.map +1 -1
  391. package/dist/use-action.js +6 -1
  392. package/dist/use-action.js.map +1 -1
  393. package/dist/vocabulary.d.ts +84 -4
  394. package/dist/vocabulary.d.ts.map +1 -1
  395. package/dist/vocabulary.js +115 -3
  396. package/dist/vocabulary.js.map +1 -1
  397. package/docs/specs/cli.md +147 -41
  398. package/docs/specs/plugins.md +37 -27
  399. package/docs/specs/records.md +113 -0
  400. package/docs/specs/rest.md +155 -20
  401. package/docs/specs/runner.md +347 -0
  402. package/package.json +12 -3
  403. package/skills/building-a-console/SKILL.md +4 -4
  404. package/skills/building-a-console/references/configuring.md +1 -0
  405. package/skills/building-a-plugin/SKILL.md +7 -7
  406. package/skills/deploying-a-console/SKILL.md +4 -4
  407. package/skills/deploying-a-console/references/resources.md +48 -8
  408. package/skills/deploying-a-console/references/running-it-again.md +3 -2
  409. package/skills/keeping-a-desk/SKILL.md +133 -0
  410. package/skills/keeping-a-desk/collections.md +96 -0
  411. package/skills/planning-the-board/SKILL.md +14 -18
  412. package/skills/planning-the-board/references/a-task.md +2 -2
  413. package/skills/planning-the-board/references/project-rules.md +13 -14
  414. package/skills/planning-the-board/references/setting-up.md +22 -9
  415. package/skills/running-an-agent/SKILL.md +107 -0
  416. package/skills/running-an-agent/references/slack-app.md +61 -0
  417. package/skills/working-the-board/SKILL.md +66 -39
  418. package/skills/working-the-board/references/terms.md +9 -5
  419. package/skills/working-the-board/references/the-pack.md +14 -9
  420. package/skills/working-the-board/references/the-sentence.md +2 -2
  421. package/src/agent-page.tsx +1039 -0
  422. package/src/agent-stream.ts +199 -0
  423. package/src/api.ts +317 -2
  424. package/src/avatar.ts +1506 -0
  425. package/src/charts.ts +250 -0
  426. package/src/cli/cli.ts +3210 -503
  427. package/src/cli/command-words.ts +56 -0
  428. package/src/cli/credentials.ts +188 -16
  429. package/src/cli/directory.ts +28 -10
  430. package/src/cli/format.ts +470 -67
  431. package/src/cli/help.ts +233 -61
  432. package/src/cli/main.ts +89 -0
  433. package/src/cli/pack.ts +332 -263
  434. package/src/cli/plugin-check.ts +275 -34
  435. package/src/cli/plugin-cli.ts +28 -4
  436. package/src/cli/plugin-main.ts +1 -0
  437. package/src/cli/runner-host.ts +188 -0
  438. package/src/cli/serve.ts +320 -5
  439. package/src/cli/setup-machine.ts +153 -0
  440. package/src/client.ts +711 -126
  441. package/src/compat.ts +2 -2
  442. package/src/components/agent-page.tsx +1946 -0
  443. package/src/components/agents.tsx +638 -0
  444. package/src/components/calendar.tsx +74 -53
  445. package/src/components/charts.tsx +680 -0
  446. package/src/components/comments.tsx +3 -0
  447. package/src/components/connect.tsx +37 -2
  448. package/src/components/decision-form.tsx +89 -51
  449. package/src/components/decision-list.tsx +140 -4
  450. package/src/components/desk-records.tsx +724 -0
  451. package/src/components/desk.tsx +471 -0
  452. package/src/components/event-feed.tsx +30 -1
  453. package/src/components/home.tsx +353 -12
  454. package/src/components/my-decisions.tsx +8 -2
  455. package/src/components/people.tsx +300 -203
  456. package/src/components/picker.tsx +3 -1
  457. package/src/components/pictures.tsx +256 -44
  458. package/src/components/plugin-events.ts +159 -0
  459. package/src/components/plugin-frame.tsx +14 -38
  460. package/src/components/plugin-settings.tsx +178 -22
  461. package/src/components/projects.tsx +33 -15
  462. package/src/components/rules.tsx +96 -36
  463. package/src/components/sessions.tsx +7 -4
  464. package/src/components/setup.tsx +252 -0
  465. package/src/components/sign-in.tsx +1 -1
  466. package/src/components/task-form.tsx +11 -2
  467. package/src/components/task-list.tsx +7 -6
  468. package/src/components/task-view.tsx +4 -0
  469. package/src/components/ui.tsx +169 -25
  470. package/src/components/work.tsx +9 -9
  471. package/src/components/workspace.tsx +345 -4
  472. package/src/connect-page.tsx +15 -2
  473. package/src/console.tsx +657 -83
  474. package/src/data.ts +109 -43
  475. package/src/desk-page.tsx +332 -0
  476. package/src/desk-records-page.tsx +256 -0
  477. package/src/desk-records.ts +808 -0
  478. package/src/desk.ts +329 -0
  479. package/src/feed-stream.ts +144 -0
  480. package/src/glances.ts +132 -0
  481. package/src/home-tiles.ts +411 -9
  482. package/src/i18n/en.ts +828 -10
  483. package/src/i18n/ko.ts +792 -10
  484. package/src/index.ts +172 -3
  485. package/src/limits.ts +67 -0
  486. package/src/onboarding.ts +84 -0
  487. package/src/persona.ts +100 -0
  488. package/src/plugin/context.ts +55 -12
  489. package/src/plugin/limits.ts +2 -0
  490. package/src/plugin/manifest.ts +42 -3
  491. package/src/plugin/rest-schemas.ts +46 -0
  492. package/src/plugin/sandbox.ts +4 -1
  493. package/src/plugin/testing.ts +63 -12
  494. package/src/plugin.ts +2 -0
  495. package/src/records.ts +702 -0
  496. package/src/router.ts +120 -10
  497. package/src/routes.ts +17 -1
  498. package/src/rules.ts +109 -44
  499. package/src/runner/acp.ts +1267 -0
  500. package/src/runner/claude.ts +695 -0
  501. package/src/runner/codex.ts +691 -0
  502. package/src/runner/config.ts +97 -0
  503. package/src/runner/desk.ts +377 -0
  504. package/src/runner/launchd.ts +86 -0
  505. package/src/runner/message.ts +232 -0
  506. package/src/runner/modules.ts +30 -0
  507. package/src/runner/process.ts +72 -0
  508. package/src/runner/redact.ts +242 -0
  509. package/src/runner/registry.ts +67 -0
  510. package/src/runner/runner.ts +1879 -0
  511. package/src/runner/slack.ts +180 -0
  512. package/src/runner/systemd-user.ts +103 -0
  513. package/src/runner/task-scheduler.ts +236 -0
  514. package/src/runner/types.ts +334 -0
  515. package/src/runner.ts +110 -0
  516. package/src/schemas.ts +1183 -30
  517. package/src/services.ts +424 -0
  518. package/src/setup-guide.ts +336 -0
  519. package/src/setup-page.tsx +46 -0
  520. package/src/sse.ts +84 -0
  521. package/src/styles/README.md +111 -0
  522. package/src/styles/base.css +130 -0
  523. package/src/styles/console.css +85 -7095
  524. package/src/styles/drawn-by-pages.json +256 -0
  525. package/src/styles/pages/agents.css +1195 -0
  526. package/src/styles/pages/board.css +380 -0
  527. package/src/styles/pages/calendar.css +214 -0
  528. package/src/styles/pages/connect.css +182 -0
  529. package/src/styles/pages/decisions.css +370 -0
  530. package/src/styles/pages/desk.css +126 -0
  531. package/src/styles/pages/documents.css +273 -0
  532. package/src/styles/pages/feed.css +118 -0
  533. package/src/styles/pages/home.css +718 -0
  534. package/src/styles/pages/people.css +90 -0
  535. package/src/styles/pages/plugins.css +212 -0
  536. package/src/styles/pages/roadmap.css +377 -0
  537. package/src/styles/pages/settings.css +171 -0
  538. package/src/styles/pages/shell.css +208 -0
  539. package/src/styles/pages/sign-in.css +178 -0
  540. package/src/styles/pages/task.css +108 -0
  541. package/src/styles/pages/thread.css +331 -0
  542. package/src/styles/pages/work.css +68 -0
  543. package/src/styles/parts/avatar.css +82 -0
  544. package/src/styles/parts/badge.css +227 -0
  545. package/src/styles/parts/bars.css +80 -0
  546. package/src/styles/parts/button.css +99 -0
  547. package/src/styles/parts/calendar.css +547 -0
  548. package/src/styles/parts/callout.css +41 -0
  549. package/src/styles/parts/category.css +8 -0
  550. package/src/styles/parts/chart.css +173 -0
  551. package/src/styles/parts/chip.css +90 -0
  552. package/src/styles/parts/code.css +48 -0
  553. package/src/styles/parts/count.css +27 -0
  554. package/src/styles/parts/crumbs.css +61 -0
  555. package/src/styles/parts/detail.css +110 -0
  556. package/src/styles/parts/empty.css +21 -0
  557. package/src/styles/parts/eyebrow.css +9 -0
  558. package/src/styles/parts/facts.css +147 -0
  559. package/src/styles/parts/figures.css +65 -0
  560. package/src/styles/parts/files.css +38 -0
  561. package/src/styles/parts/filters.css +42 -0
  562. package/src/styles/parts/form.css +109 -0
  563. package/src/styles/parts/frame.css +45 -0
  564. package/src/styles/parts/input.css +243 -0
  565. package/src/styles/parts/legend.css +48 -0
  566. package/src/styles/parts/links.css +37 -0
  567. package/src/styles/parts/mark.css +79 -0
  568. package/src/styles/parts/menu.css +147 -0
  569. package/src/styles/parts/page.css +174 -0
  570. package/src/styles/parts/pager.css +19 -0
  571. package/src/styles/parts/panel.css +33 -0
  572. package/src/styles/parts/person.css +257 -0
  573. package/src/styles/parts/picker.css +185 -0
  574. package/src/styles/parts/progress.css +25 -0
  575. package/src/styles/parts/prose.css +128 -0
  576. package/src/styles/parts/rows.css +63 -0
  577. package/src/styles/parts/series.css +32 -0
  578. package/src/styles/parts/settings.css +101 -0
  579. package/src/styles/parts/share.css +25 -0
  580. package/src/styles/parts/spark.css +23 -0
  581. package/src/styles/parts/spinner.css +29 -0
  582. package/src/styles/parts/stat.css +69 -0
  583. package/src/styles/parts/steps.css +68 -0
  584. package/src/styles/parts/tabs.css +175 -0
  585. package/src/styles/parts/text.css +61 -0
  586. package/src/styles/parts/toggle.css +71 -0
  587. package/src/styles/parts/workers.css +37 -0
  588. package/src/styles/tokens.css +295 -0
  589. package/src/tab-title.ts +25 -0
  590. package/src/tokens.ts +3 -0
  591. package/src/use-action.ts +7 -2
  592. package/src/vocabulary.ts +151 -3
  593. package/template/desk-web/README.md +8 -0
  594. package/template/desk-web/index.html +13 -0
  595. package/template/desk-web/package.json +25 -0
  596. package/template/desk-web/src/main.tsx +24 -0
  597. package/template/desk-web/src/page.tsx +51 -0
  598. package/template/desk-web/tsconfig.json +16 -0
  599. package/template/desk-web/vite.config.ts +15 -0
package/src/cli/pack.ts CHANGED
@@ -1,66 +1,71 @@
1
1
  import {
2
- type BrowseResult,
3
- browseBody,
4
- browseResultOf,
5
- catalogStateOf,
6
- type DirectoryResult,
7
- directoryBody,
8
- directoryResultOf,
9
- type FileResult,
10
- type FindItem,
11
- type FindResult,
12
- fileBody,
13
- fileResultOf,
14
- findResultOf,
15
- joinSkillPages,
16
- type MountSummary,
17
- mountSummaryOf,
2
+ type BrowseQuery,
3
+ type CodePage,
4
+ type DataQuery,
5
+ type FileQuery,
6
+ type FindQuery,
7
+ type Pack,
8
+ PackError,
9
+ type RowsPage,
10
+ } from "@skillcdn/cli";
11
+ import {
12
+ isReadmePath,
18
13
  parseAddress,
19
14
  parseRepoPath,
20
15
  parseSkillUri,
21
16
  type RestBrowse,
22
17
  type RestFile,
18
+ type RestFind,
23
19
  type RestMount,
24
- type RestSkill,
25
- renderBrowseResult,
26
- renderDirectoryResult,
27
- renderFileResult,
28
- renderFindResult,
29
- renderInstructions,
30
- renderSkillResult,
31
- type SkillResult,
32
- skillOutcome,
33
- skillResultOf,
20
+ type RestSkill as RestSkillPage,
34
21
  type ToolWords,
35
22
  } from "@skillcdn/core";
36
- import type {
37
- RestSkillBrowse,
38
- RestSkillFile,
39
- RestSkillFind,
40
- RestSkillLoad,
41
- RestSkills,
42
- } from "../schemas.js";
23
+ import type { PackClient } from "../client.js";
24
+ import type { RestSkills } from "../schemas.js";
43
25
  import type { SkillsStatus } from "../vocabulary.js";
26
+ import { commandLine, NO_LINE_TO_RUN } from "./command-words.js";
44
27
 
45
- // The pack of the project, as the command prints it (ADR-0028, ADR-0031): the console answers
46
- // what the pack's REST API answered, in the shapes of @skillcdn/core, and the command renders
47
- // it with the functions a deployment's own tools render for a model, naming the reads as its
48
- // own commands, so that an agent reads here what it would read over MCP, or with the skillcdn
49
- // command. The pages a read came in are joined first: a skill, a folder and a file arrive whole.
28
+ // The pack of the project, as the command prints it (ADR-0028, ADR-0031, ADR-0124): the console
29
+ // answers what the pack's REST API answered, in the shapes of @skillcdn/core, and the command
30
+ // hands those answers, as a pack, to the reads the skillcdn command itself prints with
31
+ // (`readPack` of @skillcdn/cli), naming the reads as its own commands. So an agent reads here
32
+ // what it would read over MCP, or with the skillcdn command, and a change of that command's text
33
+ // comes with its next version. What is here is the console's own: the pack made of the console's
34
+ // answers, the lines around a listing, and the words of a pack the console could not read,
35
+ // which is a project's or the organization's and whose token is the console's to hold.
50
36
 
51
- /** How the results name the four reads, so that an agent is told the command and not a tool. */
52
- export const CONSOLE_WORDS: ToolWords = {
53
- browse: "console skills <folder>",
54
- search: "console skills --search",
55
- load: "console skill",
56
- read: "console skill --file",
57
- };
37
+ /** How the results name the four reads of a pack read with `skills` and `skill`, so that an agent is told the command and not a tool. */
38
+ export const packWords = (skills: string, skill: string): ToolWords => ({
39
+ browse: `${skills} <folder>`,
40
+ search: `${skills} --search`,
41
+ load: skill,
42
+ read: `${skill} --file`,
43
+ });
58
44
 
59
- /** Where the reads of a pack are rendered at: what the listing said the address serves. */
60
- export type PackSummary = MountSummary;
45
+ /** The words of the project's pack, and the organization's: `console skills` and `console skill`. */
46
+ export const CONSOLE_WORDS: ToolWords = packWords("console skills", "console skill");
61
47
 
62
48
  export const NO_ADDRESS = "No skills address: neither this project nor the console names one.";
63
49
 
50
+ /**
51
+ * Whose pack a read is of, for the words of a read that did not happen: a project's, or the
52
+ * organization's, which is what a command reads where no project is named (ADR-0113).
53
+ */
54
+ export type PackOwner = "project" | "organization";
55
+
56
+ const NO_ORGANIZATION_ADDRESS =
57
+ "No skills address: the console names none for the organization's skills, and no project is named here.";
58
+
59
+ const noAddress = (owner: PackOwner): string =>
60
+ owner === "organization" ? NO_ORGANIZATION_ADDRESS : NO_ADDRESS;
61
+
62
+ /**
63
+ * What a read of the organization's pack begins with: whose pack it is, since the command
64
+ * would otherwise read as if a project had been named, and how a project's own is read.
65
+ */
66
+ export const ORGANIZATION_PACK_LINE =
67
+ "The organization's pack, since no project is named here: --project <key>, or a directory bound with console use <key>, reads a project's own.";
68
+
64
69
  /** The words of a read that did not happen, by status, with what to do about it. */
65
70
  const SKILLS_WORDS: Readonly<Record<Exclude<SkillsStatus, "none" | "ready">, string>> = {
66
71
  indexing: "The pack is still being indexed; ask again in a moment.",
@@ -73,20 +78,63 @@ const SKILLS_WORDS: Readonly<Record<Exclude<SkillsStatus, "none" | "ready">, str
73
78
  unavailable: "The pack could not be reached; ask again later.",
74
79
  };
75
80
 
76
- type Envelope = Pick<RestSkills, "address" | "source" | "page" | "status" | "refusal">;
81
+ /** The same, where the pack is the organization's: the token is the workspace's, an administrator's to set. */
82
+ const ORGANIZATION_WORDS: Readonly<Record<"not_found" | "token_invalid", string>> = {
83
+ not_found:
84
+ "Nothing is served to the console at this address or path: it is not there, or the organization's pack is private and the workspace holds no SkillCDN token for it (console workspace pack-token --connect, for an administrator).",
85
+ token_invalid:
86
+ "The SkillCDN token the workspace holds no longer works at the deployment: an administrator sets a new one (console workspace pack-token --connect).",
87
+ };
88
+
89
+ /** What every answer of the console about a pack says first: where it is, and how the read went. */
90
+ export type PackEnvelope = Pick<RestSkills, "address" | "source" | "page" | "status" | "refusal">;
91
+
92
+ /** One answer of the console to a read of a pack: the envelope, and the pack's own answer in it. */
93
+ export type PackAnswer = PackEnvelope & { readonly read: unknown };
77
94
 
78
95
  /** The first line of an answer about the pack: what was read, where the pack is, and how it went. */
79
- function head(what: string, answer: Envelope): string {
96
+ function head(what: string, answer: PackEnvelope): string {
80
97
  const where =
81
98
  answer.source === null ? "read from the console's machine" : `served by ${answer.source}`;
82
99
  return `${what} at ${answer.address}, ${where}: ${answer.status}`;
83
100
  }
84
101
 
85
- /** A read that did not happen: the head, the words of its status, and the pack's own refusal when it gave one. */
86
- function refused(what: string, answer: Envelope): string {
102
+ /**
103
+ * Whether a refusal is the pack's answer to one read: a path with nothing at it, a read asked
104
+ * wrong, a file it will not carry, in the pack's own code and words. The pack answered, so no
105
+ * token is what is missing, and saying so would send an agent to mend a pack that is served.
106
+ * Every other refusal is of the pack as a whole: nothing is served to the console at the
107
+ * address, the token is no good there, the index is not there to read, or it was not reached.
108
+ */
109
+ const ofOneRead = (answer: PackEnvelope): boolean =>
110
+ answer.refusal !== null &&
111
+ (answer.status === "not_found" || answer.status === "failed") &&
112
+ !/^(mount|auth|index)\./.test(answer.refusal.code);
113
+
114
+ /**
115
+ * A read the console could not make, of the pack as a whole, as the command says it on standard
116
+ * error: that no address is named; or where the pack is and how it stands, the words of that
117
+ * standing with whose token is missing, and the pack's own refusal when it gave one. `what` is
118
+ * the read in a word: `skills`, `folder`, `search`, `skill`, `file`, `tables`, `code blocks`.
119
+ */
120
+ export function refusalWords(
121
+ what: string,
122
+ answer: PackEnvelope,
123
+ owner: PackOwner = "project",
124
+ ): string {
125
+ if (answer.status === "none" || answer.address === null) {
126
+ return noAddress(owner);
127
+ }
87
128
  const lines = [head(what, answer)];
88
- if (answer.status !== "none" && answer.status !== "ready") {
89
- lines.push(SKILLS_WORDS[answer.status]);
129
+ if (answer.status === "ready") {
130
+ lines.push("Nothing was read.");
131
+ } else {
132
+ lines.push(
133
+ owner === "organization" &&
134
+ (answer.status === "not_found" || answer.status === "token_invalid")
135
+ ? ORGANIZATION_WORDS[answer.status]
136
+ : SKILLS_WORDS[answer.status],
137
+ );
90
138
  }
91
139
  if (answer.refusal !== null) {
92
140
  lines.push(answer.refusal.message);
@@ -94,97 +142,269 @@ function refused(what: string, answer: Envelope): string {
94
142
  return lines.join("\n");
95
143
  }
96
144
 
97
- /** What the listing said the address serves, for the reads to be rendered at; nothing when it did not answer. */
98
- export function summaryOf(listing: RestSkills): PackSummary | undefined {
99
- return listing.mount === null ? undefined : mountSummaryOf(listing.mount);
100
- }
145
+ /**
146
+ * A read of the pack as a whole that the console could not make: thrown by the pack made of the
147
+ * console's answers, for the command to say in the console's words ({@link refusalWords}). A
148
+ * refusal of one read, in the pack's own code and words, is a `PackError` instead, as the
149
+ * skillcdn command's own pack throws one.
150
+ */
151
+ export class PackRefusal extends Error {
152
+ /** The read in a word, as the first line of the refusal names it. */
153
+ readonly what: string;
154
+ /** What the console answered. */
155
+ readonly answer: PackAnswer;
101
156
 
102
- /** Every skill and document the address serves, as one listing: what `search_repo` without words answers. */
103
- function listingOf(mount: RestMount, summary: PackSummary): FindResult | undefined {
104
- if (mount.index.status !== "ready") {
105
- return undefined;
157
+ constructor(what: string, answer: PackAnswer) {
158
+ super(`${what}: ${answer.status}`);
159
+ this.name = "PackRefusal";
160
+ this.what = what;
161
+ this.answer = answer;
106
162
  }
163
+ }
164
+
165
+ type Ready<T> = Extract<T, { readonly status: "ready" }>;
166
+
167
+ /**
168
+ * Every skill and document the address serves, as a search without words answers them, made
169
+ * from what the pack says of itself in the one answer the console already has (ADR-0118, point
170
+ * 5): the console's API takes no search without words, and a listing asked page by page through
171
+ * a console that may be far would be several requests for the answer one gives. A folder's
172
+ * README is marked as its overview by the rule @skillcdn/core exports.
173
+ */
174
+ function listingOf(mount: RestMount): Ready<RestFind> {
107
175
  const { index } = mount;
108
- const items: FindItem[] = [];
176
+ if (index.status !== "ready") {
177
+ throw new PackError(503, `index.${index.status}`, "The pack is not ready to read.");
178
+ }
179
+ const items: Ready<RestFind>["items"] = [];
109
180
  for (const skill of index.skills) {
110
- const directory = parseRepoPath(skill.directory);
111
- if (!directory.ok) {
112
- continue;
113
- }
114
- const path = parseRepoPath(
115
- skill.path ?? (skill.directory === "" ? "SKILL.md" : `${skill.directory}/SKILL.md`),
116
- );
117
181
  items.push({
118
182
  kind: "skill",
119
- ...(path.ok ? { path: path.value } : {}),
183
+ path: skill.path ?? (skill.directory === "" ? "SKILL.md" : `${skill.directory}/SKILL.md`),
120
184
  name: skill.name,
121
- directory: directory.value,
185
+ directory: skill.directory,
122
186
  description: skill.description,
187
+ translations: skill.translations,
123
188
  files: [],
124
189
  moreFiles: 0,
125
- // For people, and not rendered for a model.
126
- translations: {},
127
190
  });
128
191
  }
129
192
  for (const document of index.documents) {
130
193
  const path = parseRepoPath(document.path);
131
- if (path.ok) {
132
- items.push({
133
- kind: "document",
134
- path: path.value,
135
- title: document.title ?? undefined,
136
- summary: document.summary ?? undefined,
137
- skillDirectory: undefined,
138
- });
139
- }
194
+ items.push({
195
+ kind: "document",
196
+ path: document.path,
197
+ title: document.title,
198
+ summary: document.summary,
199
+ skillDirectory: null,
200
+ ...(path.ok && isReadmePath(path.value) ? { overview: true } : {}),
201
+ });
140
202
  }
141
- const state = catalogStateOf(mount);
142
203
  return {
143
- mount: summary,
144
- query: undefined,
204
+ status: "ready",
205
+ query: null,
206
+ commit: mount.commit,
145
207
  items,
208
+ diagnostics: index.diagnostics,
146
209
  // The counts stand in the instructions above; without totals here, nothing suggests a cursor.
147
- totals: undefined,
148
- diagnostics: state.status === "ready" ? state.catalog.diagnostics : [],
210
+ totals: null,
211
+ nextCursor: null,
212
+ };
213
+ }
214
+
215
+ /**
216
+ * A document's outline with the reads of its tables and its code blocks named as commands
217
+ * (ADR-0100): where the console said an address of its own for one, the command that reads it,
218
+ * `command` being the one the pack is read with, so that an agent is told what to run. Where the
219
+ * path has no spelling both shells take whole, what to run is said in words, with why.
220
+ */
221
+ function withDataCommands(read: Ready<RestBrowse>, command: string): Ready<RestBrowse> {
222
+ const outline = read.outline;
223
+ if (outline?.data === undefined) {
224
+ return read;
225
+ }
226
+ const line = (flag: string): string =>
227
+ commandLine(command, [flag, outline.path]) ??
228
+ `${command} ${flag} with this file's path, quoted for your shell. ${NO_LINE_TO_RUN}`;
229
+ return {
230
+ ...read,
231
+ outline: {
232
+ ...outline,
233
+ data: {
234
+ ...(outline.data.rows === undefined ? {} : { rows: line("--rows") }),
235
+ ...(outline.data.code === undefined ? {} : { code: line("--code") }),
236
+ },
237
+ },
238
+ };
239
+ }
240
+
241
+ /**
242
+ * How many pages of a skill, of tables or of code blocks one command follows before it stops:
243
+ * far above what a pack holds, and the end of a read that would otherwise go round a console
244
+ * that names the same cursor again.
245
+ */
246
+ const MAX_PAGES = 64;
247
+
248
+ /** A pack made of the console's answers, which says what the console answered last. */
249
+ export interface ConsolePack extends Pack {
250
+ /** The console's answer to the last read made of the pack: what `--json` prints around the pack's own answer, and what a refusal is said from. */
251
+ answered(): PackAnswer | undefined;
252
+ }
253
+
254
+ /**
255
+ * The pack `reader` reads, as the reads of the skillcdn command take one (ADR-0124): each read
256
+ * asked of the console, and the pack's own answer taken out of the console's. `listing` is the
257
+ * console's answer about the pack as a whole, which the command asks first; nothing is made of
258
+ * one that does not answer a pack, and the command says that as it stands. `url` is the console's
259
+ * origin, where a pack with no deployment of its own is read. With `dataCommand`, the outline of
260
+ * a document names the commands that read its tables and its code blocks, `dataCommand` being
261
+ * the one the pack is read with; without it, the console's addresses stay, as `--json` has them.
262
+ */
263
+ export function consolePack(
264
+ reader: PackClient,
265
+ listing: RestSkills,
266
+ options: { readonly url: string; readonly dataCommand?: string | undefined },
267
+ ): ConsolePack | undefined {
268
+ const { mount } = listing;
269
+ const address = listing.address === null ? undefined : parseAddress(listing.address);
270
+ if (listing.status !== "ready" || mount === null || address === undefined || !address.ok) {
271
+ return undefined;
272
+ }
273
+ let last: PackAnswer | undefined;
274
+ let pages = 0;
275
+ /** One more page of a read the command joins, within what one command follows. */
276
+ const another = (what: string, path: string | undefined): void => {
277
+ pages += 1;
278
+ if (pages > MAX_PAGES) {
279
+ throw new PackError(
280
+ 0,
281
+ "invalid_response",
282
+ `The ${what} under ${path ?? "the pack"} are more than the command reads at once (${MAX_PAGES} pages): name a folder or a file under it.`,
283
+ );
284
+ }
285
+ };
286
+ /** The pack's own answer in the console's: a refusal of the one read as the pack's, any other as the console's. */
287
+ const taken = <R>(what: string, answer: PackEnvelope & { readonly read: R | null }): R => {
288
+ last = answer;
289
+ if (answer.status === "ready" && answer.read !== null) {
290
+ return answer.read;
291
+ }
292
+ if (answer.refusal !== null && ofOneRead(answer)) {
293
+ throw new PackError(
294
+ answer.status === "failed" ? 415 : 404,
295
+ answer.refusal.code,
296
+ answer.refusal.message,
297
+ {
298
+ directories: answer.refusal.directories,
299
+ sourceUrl: answer.refusal.sourceUrl ?? undefined,
300
+ },
301
+ );
302
+ }
303
+ throw new PackRefusal(what, answer);
304
+ };
305
+ /** The same, of a read the pack answers with its own standing: ready, or the console says how it stands. */
306
+ const ready = <R extends { readonly status: string }>(
307
+ what: string,
308
+ answer: PackEnvelope & { readonly read: R | null },
309
+ ): Ready<R> => {
310
+ const read = taken(what, answer);
311
+ if (read.status !== "ready") {
312
+ throw new PackRefusal(what, answer);
313
+ }
314
+ return read as Ready<R>;
315
+ };
316
+ return {
317
+ address: address.value,
318
+ source: { kind: "deployment", url: listing.source ?? options.url },
319
+ answered: () => last,
320
+ mount: async () => mount,
321
+ browse: async (query: BrowseQuery): Promise<RestBrowse> => {
322
+ const read = ready("folder", await reader.skillBrowse(query));
323
+ return options.dataCommand === undefined ? read : withDataCommands(read, options.dataCommand);
324
+ },
325
+ find: async (query: FindQuery): Promise<RestFind> =>
326
+ query.query === undefined
327
+ ? listingOf(mount)
328
+ : ready(
329
+ "search",
330
+ await reader.skillFind(query.query, {
331
+ path: query.path,
332
+ cursor: query.cursor,
333
+ limit: query.limit,
334
+ }),
335
+ ),
336
+ skill: async (path: string, cursor?: string): Promise<RestSkillPage> => {
337
+ pages += 1;
338
+ if (pages > MAX_PAGES) {
339
+ throw new PackError(
340
+ 0,
341
+ "invalid_response",
342
+ "The pack answers more pages of a skill than one read takes.",
343
+ );
344
+ }
345
+ return ready("skill", await reader.skill(path, cursor));
346
+ },
347
+ file: async (query: FileQuery): Promise<RestFile> =>
348
+ taken(
349
+ "file",
350
+ await reader.skillFile(query.path, { offset: query.offset, limit: query.limit }),
351
+ ),
352
+ rows: async (query: DataQuery): Promise<RowsPage> => {
353
+ another("tables", query.path);
354
+ return ready("tables", await reader.skillRows(query));
355
+ },
356
+ code: async (query: DataQuery): Promise<CodePage> => {
357
+ another("code blocks", query.path);
358
+ return ready("code blocks", await reader.skillCode(query));
359
+ },
149
360
  };
150
361
  }
151
362
 
152
363
  /**
153
- * The pack: where it is and how it answered; what a client is told on connect, as the
154
- * deployment tells one; every skill and document; where a person connects an agent of its own;
155
- * and where the console's own skills are on this machine.
364
+ * The listing of a pack as the command prints it. Where the pack answered, `text` is what the
365
+ * skillcdn command prints for it, what a client is told on connect and then every skill and
366
+ * document, between the lines of the console's own: where the pack is and how it answered,
367
+ * where a person connects an agent of their own, and where the console's own skills are on this
368
+ * machine. Where it did not, why, with that last line still.
156
369
  */
157
- export function formatSkills(skills: RestSkills, ownSkills?: string): string {
370
+ export function formatSkills(
371
+ skills: RestSkills,
372
+ text: string | undefined,
373
+ ownSkills?: string,
374
+ owner: PackOwner = "project",
375
+ words: ToolWords = CONSOLE_WORDS,
376
+ ): string {
158
377
  const own =
159
378
  ownSkills === undefined
160
379
  ? []
161
- : ["", `The console's own skills, for working the board: ${ownSkills}`];
162
- if (skills.status === "none" || skills.address === null) {
163
- return [NO_ADDRESS, ...own].join("\n");
164
- }
165
- const summary = summaryOf(skills);
166
- if (skills.status !== "ready" || skills.mount === null || summary === undefined) {
167
- return [refused("skills", skills), ...own].join("\n");
168
- }
169
- const lines = [
170
- head("skills", skills),
171
- "",
172
- renderInstructions(catalogStateOf(skills.mount), CONSOLE_WORDS),
173
- ];
174
- const listing = listingOf(skills.mount, summary);
175
- if (listing !== undefined) {
176
- lines.push("", renderFindResult(listing, CONSOLE_WORDS));
380
+ : ["", `The console's own skills, for working the board and keeping a desk: ${ownSkills}`];
381
+ if (text === undefined || skills.status !== "ready") {
382
+ return [refusalWords("skills", skills, owner), ...own].join("\n");
177
383
  }
384
+ const lines = [head("skills", skills), "", text];
178
385
  if (skills.page !== null) {
179
386
  lines.push(
180
387
  "",
181
- `A host with a SkillCDN connection of its own loads a skill by its URI, which a person makes at ${skills.page}; through the console, ${CONSOLE_WORDS.load} takes the URI too. --json adds the page of each skill, for a person.`,
388
+ `A host with a SkillCDN connection of its own loads a skill by its URI, which a person makes at ${skills.page}; through the console, ${words.load} takes the URI too. --json adds the page of each skill, for a person.`,
182
389
  );
183
390
  }
184
391
  lines.push(...own);
185
392
  return lines.join("\n");
186
393
  }
187
394
 
395
+ /**
396
+ * The `SKILL.md` a path names: the path itself where it names one, else the one in the folder
397
+ * it names, since a skill is its folder and a listing cut short shows the folder alone; the
398
+ * root's own for the dot, as the root is everywhere.
399
+ */
400
+ function skillFileOf(given: string): string {
401
+ const path = given.replace(/\/+$/, "");
402
+ if (path === "" || path === ".") {
403
+ return "SKILL.md";
404
+ }
405
+ return path === "SKILL.md" || path.endsWith("/SKILL.md") ? path : `${path}/SKILL.md`;
406
+ }
407
+
188
408
  /**
189
409
  * A skill's path as given, or taken out of the URI the listing names it by
190
410
  * (`skill://<host>/<owner>/<name>/<path>`); a URI of another pack would read this pack's skill
@@ -200,7 +420,7 @@ export function skillPathIn(
200
420
  ? {
201
421
  error: `Not a skill's URI the console knows: ${given}. Say the path of its SKILL.md from the repository's root, or the URI console skills lists.`,
202
422
  }
203
- : { path: given };
423
+ : { path: skillFileOf(given) };
204
424
  }
205
425
  const pack = packAddress === null ? undefined : parseAddress(packAddress);
206
426
  if (
@@ -216,157 +436,6 @@ export function skillPathIn(
216
436
  return { path: uri.path };
217
437
  }
218
438
 
219
- /** The pages of a skill, as the console answered them, as the one skill they were cut from. */
220
- export function joinSkill(
221
- pages: readonly RestSkillLoad[],
222
- summary: PackSummary,
223
- ): SkillResult | undefined {
224
- return joinSkillPages(
225
- pages.flatMap((page) =>
226
- page.read?.status === "ready" ? (skillResultOf(page.read, summary) ?? []) : [],
227
- ),
228
- );
229
- }
230
-
231
- /** The skill whole, as the REST API answers one, for `--json`. */
232
- export function bodyOfSkill(skill: SkillResult): RestSkill {
233
- const outcome = skillOutcome({ status: "ready", lookup: { kind: "found", skill } });
234
- if ("failure" in outcome) {
235
- throw new Error("a skill that was found has a body");
236
- }
237
- return outcome.body;
238
- }
239
-
240
- /** One skill as `load_skill` lays it out for a model: the rules, the body, the included files, its files and references. */
241
- export function formatSkillLoad(loaded: RestSkillLoad, whole: SkillResult | undefined): string {
242
- if (loaded.status === "none" || loaded.address === null) {
243
- return NO_ADDRESS;
244
- }
245
- if (loaded.status !== "ready") {
246
- return refused("skill", loaded);
247
- }
248
- if (whole === undefined) {
249
- return `${head("skill", loaded)}\nNothing was read.`;
250
- }
251
- return renderSkillResult(whole, CONSOLE_WORDS);
252
- }
253
-
254
- /** The pages of a folder, as the console answered them, as the one listing they were cut from. */
255
- export function joinFolder(
256
- pages: readonly RestSkillBrowse[],
257
- summary: PackSummary,
258
- ): BrowseResult | undefined {
259
- const results = pages.flatMap((page) =>
260
- page.read?.status === "ready" ? (browseResultOf(page.read, summary) ?? []) : [],
261
- );
262
- const first = results[0];
263
- const last = results[results.length - 1];
264
- if (first === undefined || last === undefined) {
265
- return undefined;
266
- }
267
- // A file's path answers its outline (SkillCDN 0.4), its headings paged as a folder's entries are.
268
- const outline =
269
- first.outline === undefined
270
- ? undefined
271
- : {
272
- ...first.outline,
273
- headings: results.flatMap((result) => result.outline?.headings ?? []),
274
- };
275
- return {
276
- ...first,
277
- mount: last.mount,
278
- entries: results.flatMap((result) => result.entries),
279
- nextCursor: last.nextCursor,
280
- ...(outline === undefined ? {} : { outline }),
281
- };
282
- }
283
-
284
- /** A folder whole, as the REST API answers one page, for `--json`. */
285
- export const bodyOfFolder = (result: BrowseResult): RestBrowse =>
286
- browseBody({ status: "ready", result });
287
-
288
- /** What a folder holds, as `browse_repo` lays it out for a model. */
289
- export function formatSkillBrowse(
290
- browsed: RestSkillBrowse,
291
- whole: BrowseResult | undefined,
292
- ): string {
293
- if (browsed.status === "none" || browsed.address === null) {
294
- return NO_ADDRESS;
295
- }
296
- if (browsed.status !== "ready") {
297
- return refused("folder", browsed);
298
- }
299
- if (whole === undefined) {
300
- return `${head("folder", browsed)}\nNothing was read.`;
301
- }
302
- return renderBrowseResult(whole, CONSOLE_WORDS);
303
- }
304
-
305
- /** What words found, as `search_repo` lays it out for a model, one page of it. */
306
- export function formatSkillFind(found: RestSkillFind, summary: PackSummary | undefined): string {
307
- if (found.status === "none" || found.address === null) {
308
- return NO_ADDRESS;
309
- }
310
- if (found.status !== "ready" || found.read?.status !== "ready" || summary === undefined) {
311
- return refused("search", found);
312
- }
313
- return renderFindResult(findResultOf(found.read, summary), CONSOLE_WORDS);
314
- }
315
-
316
- /**
317
- * The pages of a file, as the console answered them, as the file whole; or the folder the path
318
- * named. With `requested`, the one page is a section read as asked (`--offset`, `--limit`): the
319
- * result carries the length asked for, so that the renderer says where the file continues rather
320
- * than asking for the rest.
321
- */
322
- export function joinFile(
323
- pages: readonly RestSkillFile[],
324
- summary: PackSummary,
325
- requested?: number,
326
- ): FileResult | DirectoryResult | undefined {
327
- const reads = pages.flatMap((page) => (page.read === null ? [] : [page.read]));
328
- const first = reads[0];
329
- if (first === undefined) {
330
- return undefined;
331
- }
332
- if (first.kind === "directory") {
333
- return directoryResultOf(first, summary);
334
- }
335
- const files = reads.flatMap((read) =>
336
- read.kind === "file" ? (fileResultOf(read, summary) ?? []) : [],
337
- );
338
- const opening = files[0];
339
- const closing = files[files.length - 1];
340
- if (opening === undefined || closing === undefined) {
341
- return undefined;
342
- }
343
- return {
344
- ...opening,
345
- mount: closing.mount,
346
- content: files.map((file) => file.content).join(""),
347
- nextOffset: closing.nextOffset,
348
- totalLength: closing.totalLength,
349
- ...(requested === undefined ? {} : { requestedLength: requested }),
350
- };
351
- }
352
-
353
- /** A file whole, or a folder, as the REST API answers it, for `--json`. */
354
- export const bodyOfFile = (result: FileResult | DirectoryResult): RestFile =>
355
- "entries" in result ? directoryBody(result) : fileBody(result);
356
-
357
- /** A file as `read_repo_file` lays it out for a model, whole; or what the folder holds. */
358
- export function formatSkillFile(
359
- read: RestSkillFile,
360
- whole: FileResult | DirectoryResult | undefined,
361
- ): string {
362
- if (read.status === "none" || read.address === null) {
363
- return NO_ADDRESS;
364
- }
365
- if (read.status !== "ready") {
366
- return refused("file", read);
367
- }
368
- if (whole === undefined) {
369
- return `${head("file", read)}\nNothing was read.`;
370
- }
371
- return "entries" in whole ? renderDirectoryResult(whole) : renderFileResult(whole, CONSOLE_WORDS);
372
- }
439
+ /** Whether a read of data held nothing, by what the read says it holds: no table, or no code block. */
440
+ export const holdsNothing = (holds: string | undefined): boolean =>
441
+ holds !== undefined && /(^| )0 (tables|code blocks)$/.test(holds);