@neta-art/cohub-cli 10.24.0 → 10.25.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 (369) hide show
  1. package/bin/cohub.js +4 -1
  2. package/dist/board-gpu/page.js +1566 -71230
  3. package/dist/bootstrap.js +67 -27
  4. package/dist/build.json +1 -1
  5. package/dist/{board-kernel/FilterPipe.js → chunks/Geometry.js} +10447 -10469
  6. package/dist/chunks/about.js +102 -0
  7. package/dist/chunks/app-realtime.js +2216 -0
  8. package/dist/chunks/app-realtime2.js +2 -0
  9. package/dist/chunks/app-ref.js +88 -0
  10. package/dist/chunks/apps.js +1423 -0
  11. package/dist/chunks/auth.js +175 -0
  12. package/dist/chunks/avatar.js +146 -0
  13. package/dist/chunks/binary-pins.js +5 -0
  14. package/dist/chunks/board-export-resources.js +232 -0
  15. package/dist/chunks/board-export.js +874 -0
  16. package/dist/chunks/board-export2.js +2 -0
  17. package/dist/{board-kernel.js → chunks/board-kernel.js} +18032 -28512
  18. package/dist/chunks/board-kernel2.js +4 -0
  19. package/dist/chunks/board-profile.js +69 -0
  20. package/dist/chunks/board-simulate.js +315 -0
  21. package/dist/chunks/board-time.js +34 -0
  22. package/dist/chunks/boards.js +1943 -0
  23. package/dist/{board-kernel → chunks}/browserAll.js +9 -8
  24. package/dist/chunks/channels.js +64 -0
  25. package/dist/chunks/client.js +12606 -0
  26. package/dist/chunks/command-input.js +17 -0
  27. package/dist/chunks/commander.js +2962 -0
  28. package/dist/chunks/cron-jobs.js +163 -0
  29. package/dist/chunks/daemon.js +545 -0
  30. package/dist/chunks/daemon2.js +2 -0
  31. package/dist/chunks/desktop.js +172 -0
  32. package/dist/chunks/endpoint-options.js +26 -0
  33. package/dist/chunks/env-proxy.js +35 -0
  34. package/dist/chunks/environment.js +154 -0
  35. package/dist/chunks/feedback.js +120 -0
  36. package/dist/chunks/generations.js +379 -0
  37. package/dist/chunks/host.js +9 -0
  38. package/dist/chunks/http-put.js +131 -0
  39. package/dist/chunks/id.js +2416 -0
  40. package/dist/{board-kernel → chunks}/init.js +1 -1
  41. package/dist/chunks/install.js +11959 -0
  42. package/dist/chunks/launch.js +374 -0
  43. package/dist/chunks/local-media.js +47 -0
  44. package/dist/chunks/me.js +134 -0
  45. package/dist/chunks/media.js +315 -0
  46. package/dist/chunks/models.js +242 -0
  47. package/dist/chunks/operands.js +46 -0
  48. package/dist/chunks/package-paths.js +13 -0
  49. package/dist/chunks/policy.js +221 -0
  50. package/dist/chunks/preferences.js +29 -0
  51. package/dist/chunks/profile.js +64 -0
  52. package/dist/chunks/prompts.js +41 -0
  53. package/dist/chunks/public.js +2 -0
  54. package/dist/chunks/public2.js +244 -0
  55. package/dist/chunks/references.js +197 -0
  56. package/dist/chunks/referrals.js +90 -0
  57. package/dist/chunks/rolldown-runtime.js +26 -0
  58. package/dist/chunks/rooms-connect.js +2 -0
  59. package/dist/chunks/rooms-connect2.js +151 -0
  60. package/dist/chunks/rooms-rtc.js +311 -0
  61. package/dist/chunks/rooms.js +211 -0
  62. package/dist/chunks/run.js +220 -0
  63. package/dist/chunks/runtime.js +638 -0
  64. package/dist/chunks/runtime2.js +286 -0
  65. package/dist/chunks/runtimes.js +48 -0
  66. package/dist/chunks/safe-remote-image.js +198 -0
  67. package/dist/chunks/schemas.js +6017 -0
  68. package/dist/chunks/search.js +113 -0
  69. package/dist/chunks/self-update.js +238 -0
  70. package/dist/chunks/serve.js +1246 -0
  71. package/dist/chunks/session-status.js +24 -0
  72. package/dist/chunks/skills.js +35 -0
  73. package/dist/chunks/spaces.js +5080 -0
  74. package/dist/chunks/src.js +405 -0
  75. package/dist/chunks/supervisor.js +2513 -0
  76. package/dist/chunks/supervisor2.js +2 -0
  77. package/dist/chunks/tasks.js +82 -0
  78. package/dist/chunks/themes.js +2898 -0
  79. package/dist/chunks/version.js +2 -0
  80. package/dist/chunks/version2.js +22 -0
  81. package/dist/chunks/version3.js +18 -0
  82. package/dist/chunks/web.js +7 -0
  83. package/dist/{board-kernel → chunks}/webworkerAll.js +1 -1
  84. package/dist/runtime/native/pi-extension.js +174 -166
  85. package/dist/runtime/worker.js +27 -16
  86. package/package.json +8 -9
  87. package/dist/about.d.ts +0 -2
  88. package/dist/about.js +0 -71
  89. package/dist/app-download.d.ts +0 -11
  90. package/dist/app-download.js +0 -252
  91. package/dist/app-ref.d.ts +0 -5
  92. package/dist/app-ref.js +0 -8
  93. package/dist/app-target.d.ts +0 -26
  94. package/dist/app-target.js +0 -55
  95. package/dist/auth.d.ts +0 -45
  96. package/dist/auth.js +0 -307
  97. package/dist/avatar.d.ts +0 -55
  98. package/dist/avatar.js +0 -104
  99. package/dist/board-command-support.d.ts +0 -6
  100. package/dist/board-command-support.js +0 -88
  101. package/dist/board-export-resources.d.ts +0 -12
  102. package/dist/board-export-resources.js +0 -51
  103. package/dist/board-export.d.ts +0 -110
  104. package/dist/board-export.js +0 -592
  105. package/dist/board-fonts.d.ts +0 -11
  106. package/dist/board-fonts.js +0 -10
  107. package/dist/board-gpu/daemon.d.ts +0 -11
  108. package/dist/board-gpu/daemon.js +0 -295
  109. package/dist/board-gpu/index.d.ts +0 -33
  110. package/dist/board-gpu/index.js +0 -189
  111. package/dist/board-gpu/protocol.d.ts +0 -77
  112. package/dist/board-gpu/protocol.js +0 -1
  113. package/dist/board-kernel.d.ts +0 -5
  114. package/dist/board-media-export.d.ts +0 -17
  115. package/dist/board-media-export.js +0 -164
  116. package/dist/board-media.d.ts +0 -5
  117. package/dist/board-media.js +0 -66
  118. package/dist/board-profile.d.ts +0 -21
  119. package/dist/board-profile.js +0 -67
  120. package/dist/board-simulate.d.ts +0 -67
  121. package/dist/board-simulate.js +0 -259
  122. package/dist/board-time.d.ts +0 -3
  123. package/dist/board-time.js +0 -34
  124. package/dist/bootstrap.d.ts +0 -2
  125. package/dist/client.d.ts +0 -5
  126. package/dist/client.js +0 -24
  127. package/dist/command-input.d.ts +0 -4
  128. package/dist/command-input.js +0 -16
  129. package/dist/commands/app-commerce.d.ts +0 -2
  130. package/dist/commands/app-commerce.js +0 -228
  131. package/dist/commands/app-domains.d.ts +0 -2
  132. package/dist/commands/app-domains.js +0 -133
  133. package/dist/commands/apps.d.ts +0 -4
  134. package/dist/commands/apps.js +0 -827
  135. package/dist/commands/auth.d.ts +0 -2
  136. package/dist/commands/auth.js +0 -186
  137. package/dist/commands/boards/authoring.d.ts +0 -2
  138. package/dist/commands/boards/authoring.js +0 -166
  139. package/dist/commands/boards/examples.d.ts +0 -10
  140. package/dist/commands/boards/examples.js +0 -118
  141. package/dist/commands/boards.d.ts +0 -13
  142. package/dist/commands/boards.js +0 -836
  143. package/dist/commands/channels.d.ts +0 -2
  144. package/dist/commands/channels.js +0 -74
  145. package/dist/commands/cron-jobs.d.ts +0 -2
  146. package/dist/commands/cron-jobs.js +0 -155
  147. package/dist/commands/decision.d.ts +0 -4
  148. package/dist/commands/decision.js +0 -113
  149. package/dist/commands/desktop.d.ts +0 -10
  150. package/dist/commands/desktop.js +0 -233
  151. package/dist/commands/feedback.d.ts +0 -2
  152. package/dist/commands/feedback.js +0 -131
  153. package/dist/commands/generations.d.ts +0 -2
  154. package/dist/commands/generations.js +0 -427
  155. package/dist/commands/host.d.ts +0 -2
  156. package/dist/commands/host.js +0 -11
  157. package/dist/commands/me.d.ts +0 -2
  158. package/dist/commands/me.js +0 -121
  159. package/dist/commands/models.d.ts +0 -28
  160. package/dist/commands/models.js +0 -271
  161. package/dist/commands/profile.d.ts +0 -2
  162. package/dist/commands/profile.js +0 -81
  163. package/dist/commands/prompts.d.ts +0 -2
  164. package/dist/commands/prompts.js +0 -37
  165. package/dist/commands/public.d.ts +0 -20
  166. package/dist/commands/public.js +0 -291
  167. package/dist/commands/references.d.ts +0 -2
  168. package/dist/commands/references.js +0 -193
  169. package/dist/commands/referrals.d.ts +0 -2
  170. package/dist/commands/referrals.js +0 -88
  171. package/dist/commands/rooms-connect.d.ts +0 -17
  172. package/dist/commands/rooms-connect.js +0 -140
  173. package/dist/commands/rooms-rtc-binary.d.ts +0 -2
  174. package/dist/commands/rooms-rtc-binary.js +0 -107
  175. package/dist/commands/rooms-rtc.d.ts +0 -21
  176. package/dist/commands/rooms-rtc.js +0 -171
  177. package/dist/commands/rooms.d.ts +0 -3
  178. package/dist/commands/rooms.js +0 -277
  179. package/dist/commands/run.d.ts +0 -13
  180. package/dist/commands/run.js +0 -246
  181. package/dist/commands/runtime.d.ts +0 -3
  182. package/dist/commands/runtime.js +0 -320
  183. package/dist/commands/sandboxd-binary.d.ts +0 -11
  184. package/dist/commands/sandboxd-binary.js +0 -238
  185. package/dist/commands/search.d.ts +0 -2
  186. package/dist/commands/search.js +0 -114
  187. package/dist/commands/session-access.d.ts +0 -2
  188. package/dist/commands/session-access.js +0 -70
  189. package/dist/commands/skills.d.ts +0 -2
  190. package/dist/commands/skills.js +0 -34
  191. package/dist/commands/space-activity.d.ts +0 -26
  192. package/dist/commands/space-activity.js +0 -147
  193. package/dist/commands/space-commerce.d.ts +0 -2
  194. package/dist/commands/space-commerce.js +0 -514
  195. package/dist/commands/space-displays.d.ts +0 -2
  196. package/dist/commands/space-displays.js +0 -620
  197. package/dist/commands/space-files.d.ts +0 -5
  198. package/dist/commands/space-files.js +0 -215
  199. package/dist/commands/space-invitations.d.ts +0 -29
  200. package/dist/commands/space-invitations.js +0 -189
  201. package/dist/commands/space-turns.d.ts +0 -49
  202. package/dist/commands/space-turns.js +0 -205
  203. package/dist/commands/space-wallet.d.ts +0 -2
  204. package/dist/commands/space-wallet.js +0 -141
  205. package/dist/commands/space-webhooks.d.ts +0 -7
  206. package/dist/commands/space-webhooks.js +0 -73
  207. package/dist/commands/spaces.d.ts +0 -25
  208. package/dist/commands/spaces.js +0 -2170
  209. package/dist/commands/tasks.d.ts +0 -8
  210. package/dist/commands/tasks.js +0 -80
  211. package/dist/commands/version.d.ts +0 -2
  212. package/dist/commands/version.js +0 -21
  213. package/dist/endpoint-options.d.ts +0 -4
  214. package/dist/endpoint-options.js +0 -26
  215. package/dist/env-proxy.d.ts +0 -5
  216. package/dist/env-proxy.js +0 -20
  217. package/dist/help-path.d.ts +0 -18
  218. package/dist/help-path.js +0 -223
  219. package/dist/host/auth.d.ts +0 -20
  220. package/dist/host/auth.js +0 -119
  221. package/dist/host/login-env.d.ts +0 -1
  222. package/dist/host/login-env.js +0 -31
  223. package/dist/host/runtime.d.ts +0 -35
  224. package/dist/host/runtime.js +0 -395
  225. package/dist/host/runtimes.d.ts +0 -9
  226. package/dist/host/runtimes.js +0 -42
  227. package/dist/host/serve.d.ts +0 -2
  228. package/dist/host/serve.js +0 -117
  229. package/dist/host/workspaces.d.ts +0 -2
  230. package/dist/host/workspaces.js +0 -18
  231. package/dist/http-put.d.ts +0 -25
  232. package/dist/http-put.js +0 -132
  233. package/dist/index.d.ts +0 -2
  234. package/dist/index.js +0 -129
  235. package/dist/launcher.d.ts +0 -4
  236. package/dist/launcher.js +0 -38
  237. package/dist/local-media.d.ts +0 -2
  238. package/dist/local-media.js +0 -30
  239. package/dist/network-error.d.ts +0 -3
  240. package/dist/network-error.js +0 -22
  241. package/dist/output.d.ts +0 -46
  242. package/dist/output.js +0 -244
  243. package/dist/runtime/archive-store.d.ts +0 -54
  244. package/dist/runtime/archive-store.js +0 -379
  245. package/dist/runtime/cli-path.d.ts +0 -5
  246. package/dist/runtime/cli-path.js +0 -27
  247. package/dist/runtime/codex-usage.d.ts +0 -7
  248. package/dist/runtime/codex-usage.js +0 -11
  249. package/dist/runtime/connection.d.ts +0 -42
  250. package/dist/runtime/connection.js +0 -789
  251. package/dist/runtime/diagnostics.d.ts +0 -107
  252. package/dist/runtime/diagnostics.js +0 -392
  253. package/dist/runtime/harnesses/chained-projection.d.ts +0 -40
  254. package/dist/runtime/harnesses/chained-projection.js +0 -95
  255. package/dist/runtime/harnesses/chained-transcript.d.ts +0 -24
  256. package/dist/runtime/harnesses/chained-transcript.js +0 -62
  257. package/dist/runtime/harnesses/claude-approval.d.ts +0 -34
  258. package/dist/runtime/harnesses/claude-approval.js +0 -124
  259. package/dist/runtime/harnesses/claude-transcript.d.ts +0 -8
  260. package/dist/runtime/harnesses/claude-transcript.js +0 -138
  261. package/dist/runtime/harnesses/claude.d.ts +0 -8
  262. package/dist/runtime/harnesses/claude.js +0 -225
  263. package/dist/runtime/harnesses/codex-approval.d.ts +0 -25
  264. package/dist/runtime/harnesses/codex-approval.js +0 -69
  265. package/dist/runtime/harnesses/codex.d.ts +0 -4
  266. package/dist/runtime/harnesses/codex.js +0 -269
  267. package/dist/runtime/harnesses/cursor-transcript.d.ts +0 -37
  268. package/dist/runtime/harnesses/cursor-transcript.js +0 -183
  269. package/dist/runtime/harnesses/cursor.d.ts +0 -24
  270. package/dist/runtime/harnesses/cursor.js +0 -620
  271. package/dist/runtime/harnesses/index.d.ts +0 -16
  272. package/dist/runtime/harnesses/index.js +0 -73
  273. package/dist/runtime/harnesses/pi.d.ts +0 -4
  274. package/dist/runtime/harnesses/pi.js +0 -247
  275. package/dist/runtime/harnesses/process.d.ts +0 -31
  276. package/dist/runtime/harnesses/process.js +0 -75
  277. package/dist/runtime/harnesses/stream-json.d.ts +0 -48
  278. package/dist/runtime/harnesses/stream-json.js +0 -336
  279. package/dist/runtime/harnesses/types.d.ts +0 -117
  280. package/dist/runtime/harnesses/types.js +0 -1
  281. package/dist/runtime/harnesses/workbuddy-transcript.d.ts +0 -8
  282. package/dist/runtime/harnesses/workbuddy-transcript.js +0 -127
  283. package/dist/runtime/harnesses/workbuddy.d.ts +0 -21
  284. package/dist/runtime/harnesses/workbuddy.js +0 -123
  285. package/dist/runtime/instance.d.ts +0 -20
  286. package/dist/runtime/instance.js +0 -247
  287. package/dist/runtime/json-rpc.d.ts +0 -53
  288. package/dist/runtime/json-rpc.js +0 -212
  289. package/dist/runtime/launch.d.ts +0 -25
  290. package/dist/runtime/launch.js +0 -247
  291. package/dist/runtime/local-workspace.d.ts +0 -15
  292. package/dist/runtime/local-workspace.js +0 -52
  293. package/dist/runtime/model-catalog.d.ts +0 -12
  294. package/dist/runtime/model-catalog.js +0 -84
  295. package/dist/runtime/native/adapters.d.ts +0 -15
  296. package/dist/runtime/native/adapters.js +0 -11
  297. package/dist/runtime/native/approvals.d.ts +0 -18
  298. package/dist/runtime/native/approvals.js +0 -54
  299. package/dist/runtime/native/archive.d.ts +0 -19
  300. package/dist/runtime/native/archive.js +0 -142
  301. package/dist/runtime/native/attach.d.ts +0 -36
  302. package/dist/runtime/native/attach.js +0 -128
  303. package/dist/runtime/native/codex-link.d.ts +0 -60
  304. package/dist/runtime/native/codex-link.js +0 -322
  305. package/dist/runtime/native/config.d.ts +0 -16
  306. package/dist/runtime/native/config.js +0 -24
  307. package/dist/runtime/native/daemon.d.ts +0 -92
  308. package/dist/runtime/native/daemon.js +0 -380
  309. package/dist/runtime/native/execution.d.ts +0 -26
  310. package/dist/runtime/native/execution.js +0 -34
  311. package/dist/runtime/native/identity.d.ts +0 -9
  312. package/dist/runtime/native/identity.js +0 -15
  313. package/dist/runtime/native/ingest.d.ts +0 -263
  314. package/dist/runtime/native/ingest.js +0 -884
  315. package/dist/runtime/native/install.d.ts +0 -9
  316. package/dist/runtime/native/install.js +0 -113
  317. package/dist/runtime/native/paths.d.ts +0 -2
  318. package/dist/runtime/native/paths.js +0 -7
  319. package/dist/runtime/native/pi-extension.d.ts +0 -36
  320. package/dist/runtime/native/pi-link.d.ts +0 -69
  321. package/dist/runtime/native/pi-link.js +0 -269
  322. package/dist/runtime/native/results.d.ts +0 -41
  323. package/dist/runtime/native/results.js +0 -128
  324. package/dist/runtime/native/sessions.d.ts +0 -45
  325. package/dist/runtime/native/sessions.js +0 -87
  326. package/dist/runtime/native/transcript.d.ts +0 -89
  327. package/dist/runtime/native/transcript.js +0 -656
  328. package/dist/runtime/native/translate.d.ts +0 -46
  329. package/dist/runtime/native/translate.js +0 -299
  330. package/dist/runtime/native/transport.d.ts +0 -7
  331. package/dist/runtime/native/transport.js +0 -16
  332. package/dist/runtime/native/version.d.ts +0 -5
  333. package/dist/runtime/native/version.js +0 -21
  334. package/dist/runtime/preferences.d.ts +0 -7
  335. package/dist/runtime/preferences.js +0 -22
  336. package/dist/runtime/presentation.d.ts +0 -32
  337. package/dist/runtime/presentation.js +0 -124
  338. package/dist/runtime/process-group.d.ts +0 -5
  339. package/dist/runtime/process-group.js +0 -161
  340. package/dist/runtime/projection-store.d.ts +0 -27
  341. package/dist/runtime/projection-store.js +0 -30
  342. package/dist/runtime/space-binding.d.ts +0 -48
  343. package/dist/runtime/space-binding.js +0 -342
  344. package/dist/runtime/supervisor.d.ts +0 -19
  345. package/dist/runtime/supervisor.js +0 -441
  346. package/dist/runtime/turn-projection.d.ts +0 -41
  347. package/dist/runtime/turn-projection.js +0 -120
  348. package/dist/runtime/worker.d.ts +0 -1
  349. package/dist/safe-remote-image.d.ts +0 -36
  350. package/dist/safe-remote-image.js +0 -191
  351. package/dist/self-update.d.ts +0 -7
  352. package/dist/self-update.js +0 -202
  353. package/dist/session-status.d.ts +0 -10
  354. package/dist/session-status.js +0 -25
  355. package/dist/space-files/limit.d.ts +0 -2
  356. package/dist/space-files/limit.js +0 -16
  357. package/dist/space-files/operands.d.ts +0 -17
  358. package/dist/space-files/operands.js +0 -33
  359. package/dist/space-files/transfer.d.ts +0 -53
  360. package/dist/space-files/transfer.js +0 -297
  361. package/dist/space-files/upload.d.ts +0 -17
  362. package/dist/space-files/upload.js +0 -76
  363. package/dist/space.d.ts +0 -44
  364. package/dist/space.js +0 -192
  365. package/dist/version.d.ts +0 -2
  366. package/dist/version.js +0 -17
  367. package/dist/web.d.ts +0 -1
  368. package/dist/web.js +0 -4
  369. /package/dist/{board-kernel → chunks}/lexer.js +0 -0
@@ -1,8 +0,0 @@
1
- import type { Command } from "commander";
2
- import { createClient } from "../client.js";
3
- type TasksClient = ReturnType<typeof createClient>;
4
- type RegisterTasksDependencies = {
5
- createClient?: () => TasksClient;
6
- };
7
- export declare function registerTasks(program: Command, dependencies?: RegisterTasksDependencies): void;
8
- export {};
@@ -1,80 +0,0 @@
1
- import { createClient } from "../client.js";
2
- import { table, json as outJson, jsonRequested, handleHttp } from "../output.js";
3
- export function registerTasks(program, dependencies = {}) {
4
- const getClient = dependencies.createClient ?? createClient;
5
- const cmd = program.command("tasks").description("Task runs");
6
- cmd
7
- .command("ls")
8
- .alias("list")
9
- .description("List task runs")
10
- .option("--cron-job <id>", "Filter by cron job")
11
- .option("--space <id>", "Filter by space")
12
- .option("--session <id>", "Filter by session")
13
- .option("--type <type>", "Filter by task type")
14
- .option("--status <status>", "Filter by status: active, pending, running, completed, failed")
15
- .option("--limit <n>", "Page size", "50")
16
- .option("--cursor <cursor>", "Page cursor")
17
- .option("--json", "Output as JSON")
18
- .action(async (opts) => {
19
- const client = getClient();
20
- try {
21
- const limit = opts.limit ? Number(opts.limit) : 50;
22
- if (!Number.isFinite(limit) || limit < 1)
23
- throw new Error("limit must be a positive number");
24
- const filters = { limit: Math.floor(limit) };
25
- const spaceId = opts.space ?? program.opts().space;
26
- if (opts.cronJob)
27
- filters.cronJobId = opts.cronJob;
28
- if (spaceId)
29
- filters.spaceId = spaceId;
30
- if (opts.session)
31
- filters.sessionId = opts.session;
32
- if (opts.type)
33
- filters.taskType = opts.type;
34
- if (opts.status)
35
- filters.status = opts.status;
36
- if (opts.cursor)
37
- filters.cursor = opts.cursor;
38
- const result = await client.tasks.list(filters);
39
- if (jsonRequested(opts))
40
- return outJson(result);
41
- if (result.runs.length === 0)
42
- return console.log(" (empty)");
43
- table(result.runs, [
44
- { key: "id", label: "ID" },
45
- { key: "taskType", label: "Type" },
46
- { key: "status", label: "Status" },
47
- { key: "sessionId", label: "Session" },
48
- { key: "createdAt", label: "Created" },
49
- ]);
50
- if (result.pageInfo?.hasMore && result.pageInfo.nextCursor) {
51
- console.log(`\n More task runs available — next cursor: ${result.pageInfo.nextCursor}`);
52
- }
53
- }
54
- catch (e) {
55
- handleHttp(e);
56
- }
57
- });
58
- cmd
59
- .command("get <id>")
60
- .description("Task run details")
61
- .option("--json", "Output as JSON")
62
- .action(async (id, opts) => {
63
- const client = getClient();
64
- try {
65
- const result = await client.tasks.get(id);
66
- if (jsonRequested(opts))
67
- return outJson(result);
68
- table([result.run], [
69
- { key: "id", label: "ID" },
70
- { key: "taskType", label: "Type" },
71
- { key: "status", label: "Status" },
72
- { key: "attemptCount", label: "Attempts" },
73
- { key: "createdAt", label: "Created" },
74
- ]);
75
- }
76
- catch (e) {
77
- handleHttp(e);
78
- }
79
- });
80
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerVersion(program: Command): void;
@@ -1,21 +0,0 @@
1
- import { describeCli } from "../about.js";
2
- import { json, jsonRequested } from "../output.js";
3
- import { isNewerVersion } from "../self-update.js";
4
- import { currentIdentityKey } from "../space.js";
5
- export function registerVersion(program) {
6
- program
7
- .command("version")
8
- .description("This CLI, the cohub on PATH, and the versions running Runtimes serve")
9
- .option("--json", "JSON output")
10
- .action(async (options) => {
11
- const about = await describeCli(process.env, currentIdentityKey());
12
- if (jsonRequested(options))
13
- return json(about);
14
- const rows = [
15
- `cohub ${about.version}${about.commit ? ` (${about.commit})` : ""} · Node ${about.node}`,
16
- `PATH ${about.path ? `${about.path.path} · ${about.path.version ?? "unknown"}` : "No cohub on PATH"}`,
17
- ...about.runtimes.map((runtime, index) => `${index ? " " : "Runtimes "} ${runtime.version ?? "older"} · ${runtime.root}${isNewerVersion(about.version, runtime.version ?? undefined) ? " (reconnect to update)" : ""}`),
18
- ];
19
- process.stdout.write(`${rows.join("\n")}\n`);
20
- });
21
- }
@@ -1,4 +0,0 @@
1
- import { type Command } from "commander";
2
- export declare function setApiBaseUrl(value: string): string;
3
- export declare function registerEndpointOptions(program: Command): Command;
4
- export declare function consumeBaseUrlOption(tokens: string[], index: number): number | null;
@@ -1,26 +0,0 @@
1
- import { normalizeBaseUrl } from "@neta-art/cohub";
2
- import { InvalidArgumentError } from "commander";
3
- export function setApiBaseUrl(value) {
4
- const url = normalizeBaseUrl(value);
5
- if (!url)
6
- throw new InvalidArgumentError("API base URL must not be empty");
7
- process.env.COHUB_BASE_URL = url;
8
- return url;
9
- }
10
- export function registerEndpointOptions(program) {
11
- return program.option("--base-url <url>", "API base URL (overrides COHUB_BASE_URL)", setApiBaseUrl);
12
- }
13
- export function consumeBaseUrlOption(tokens, index) {
14
- const token = tokens[index];
15
- if (token?.startsWith("--base-url=")) {
16
- setApiBaseUrl(token.slice("--base-url=".length));
17
- return index;
18
- }
19
- if (token !== "--base-url")
20
- return null;
21
- const value = tokens[index + 1];
22
- if (value === undefined)
23
- throw new InvalidArgumentError("--base-url requires a value");
24
- setApiBaseUrl(value);
25
- return index + 1;
26
- }
@@ -1,5 +0,0 @@
1
- export declare function proxyEnvPresent(env?: NodeJS.ProcessEnv): boolean;
2
- export declare function envProxyAlreadyEnabled(execArgv?: readonly string[], env?: NodeJS.ProcessEnv): boolean;
3
- export declare function supportsUseEnvProxy(version?: string): boolean;
4
- export declare function shouldRelaunchWithEnvProxy(execArgv?: readonly string[], env?: NodeJS.ProcessEnv, nodeVersion?: string): boolean;
5
- export declare const envProxyExecArgv: readonly ["--use-env-proxy"];
package/dist/env-proxy.js DELETED
@@ -1,20 +0,0 @@
1
- const PROXY_ENV_KEYS = ["http_proxy", "https_proxy", "HTTP_PROXY", "HTTPS_PROXY", "all_proxy", "ALL_PROXY"];
2
- const USE_ENV_PROXY_FLAG = "--use-env-proxy";
3
- export function proxyEnvPresent(env = process.env) {
4
- return PROXY_ENV_KEYS.some((key) => Boolean(env[key]?.trim()));
5
- }
6
- export function envProxyAlreadyEnabled(execArgv = process.execArgv, env = process.env) {
7
- if (execArgv.includes(USE_ENV_PROXY_FLAG) || env.NODE_USE_ENV_PROXY === "1")
8
- return true;
9
- return (env.NODE_OPTIONS ?? "").split(/\s+/).includes(USE_ENV_PROXY_FLAG);
10
- }
11
- export function supportsUseEnvProxy(version = process.versions.node) {
12
- const [major = 0, minor = 0] = version.split(".").map((part) => Number.parseInt(part, 10));
13
- if (!Number.isFinite(major) || !Number.isFinite(minor))
14
- return false;
15
- return major >= 24 || (major === 22 && minor >= 21);
16
- }
17
- export function shouldRelaunchWithEnvProxy(execArgv = process.execArgv, env = process.env, nodeVersion = process.versions.node) {
18
- return supportsUseEnvProxy(nodeVersion) && proxyEnvPresent(env) && !envProxyAlreadyEnabled(execArgv, env);
19
- }
20
- export const envProxyExecArgv = [USE_ENV_PROXY_FLAG];
@@ -1,18 +0,0 @@
1
- import type { Command } from "commander";
2
- export type HelpResolution = {
3
- kind: "passthrough";
4
- } | {
5
- kind: "help";
6
- command: Command;
7
- } | {
8
- kind: "run-help";
9
- } | {
10
- kind: "unknown";
11
- token: string;
12
- tryCommand?: string;
13
- suggestion?: string;
14
- };
15
- export declare function resolveHelpPath(program: Command, argv: string[]): HelpResolution;
16
- export declare function formatUnknownCommandError(result: Extract<HelpResolution, {
17
- kind: "unknown";
18
- }>): string;
package/dist/help-path.js DELETED
@@ -1,223 +0,0 @@
1
- function isHelpFlag(token) {
2
- return token === "-h" || token === "--help";
3
- }
4
- function findChild(command, name) {
5
- return command.commands.find((child) => {
6
- if (child.name() === "help")
7
- return false;
8
- return child.name() === name || child.aliases().includes(name);
9
- });
10
- }
11
- function hasSubcommands(command) {
12
- return command.commands.some((child) => child.name() !== "help");
13
- }
14
- function knownOptions(command) {
15
- const options = [];
16
- let current = command;
17
- while (current) {
18
- options.push(...current.options);
19
- current = current.parent;
20
- }
21
- return options;
22
- }
23
- function matchOption(command, token) {
24
- if (!token.startsWith("-") || token === "-")
25
- return undefined;
26
- const eq = token.indexOf("=");
27
- const inline = eq >= 0;
28
- const flag = inline ? token.slice(0, eq) : token;
29
- for (const option of knownOptions(command)) {
30
- if (option.short === flag || option.long === flag)
31
- return { option, inline };
32
- }
33
- return undefined;
34
- }
35
- function skipOption(command, argv, index) {
36
- const token = argv[index] ?? "";
37
- const matched = matchOption(command, token);
38
- const next = index + 1;
39
- if (matched?.inline)
40
- return next;
41
- const value = argv[next];
42
- if (!value)
43
- return next;
44
- if (matched?.option.required)
45
- return next + 1;
46
- if (matched?.option.optional && !value.startsWith("-"))
47
- return next + 1;
48
- return next;
49
- }
50
- function remainderRequestsHelp(command, argv) {
51
- let index = 0;
52
- while (index < argv.length) {
53
- const token = argv[index] ?? "";
54
- if (token === "--")
55
- break;
56
- if (isHelpFlag(token))
57
- return true;
58
- if (token.startsWith("-")) {
59
- index = skipOption(command, argv, index);
60
- continue;
61
- }
62
- index += 1;
63
- }
64
- return false;
65
- }
66
- /** Match `run.ts`: Cohub flags first, then the rest is the shell command. */
67
- function runRemainderRequestsHelp(argv) {
68
- for (let index = 0; index < argv.length; index += 1) {
69
- const token = argv[index] ?? "";
70
- if (token === "--")
71
- return false;
72
- if (isHelpFlag(token))
73
- return true;
74
- if (token === "--async" || token === "--json")
75
- continue;
76
- if (token === "-c" || token === "--command" || token === "--base-url") {
77
- index += 1;
78
- continue;
79
- }
80
- if (token.startsWith("--command=") || token.startsWith("--base-url="))
81
- continue;
82
- return false;
83
- }
84
- return false;
85
- }
86
- function walkCommandPath(program, argv) {
87
- let command = program;
88
- const path = [];
89
- let helpRequested = false;
90
- let index = 0;
91
- while (index < argv.length) {
92
- const token = argv[index] ?? "";
93
- if (token === "--")
94
- break;
95
- if (isHelpFlag(token)) {
96
- helpRequested = true;
97
- index += 1;
98
- continue;
99
- }
100
- if (token.startsWith("-")) {
101
- index = skipOption(command, argv, index);
102
- continue;
103
- }
104
- if (token === "help" && hasSubcommands(command)) {
105
- helpRequested = true;
106
- index += 1;
107
- continue;
108
- }
109
- const child = findChild(command, token);
110
- if (child) {
111
- command = child;
112
- path.push(child.name());
113
- index += 1;
114
- continue;
115
- }
116
- if (hasSubcommands(command)) {
117
- const remainder = argv.slice(index + 1);
118
- const helpAfter = token === "run" && path.length === 0
119
- ? runRemainderRequestsHelp(remainder)
120
- : remainderRequestsHelp(command, remainder);
121
- return {
122
- command,
123
- path,
124
- helpRequested: helpRequested || helpAfter,
125
- unknown: token,
126
- };
127
- }
128
- index += 1;
129
- }
130
- return { command, path, helpRequested, unknown: null };
131
- }
132
- function stripRootCommand(program, argv, name) {
133
- let index = 0;
134
- while (index < argv.length) {
135
- const token = argv[index] ?? "";
136
- if (token === "--")
137
- return undefined;
138
- if (isHelpFlag(token) || token === "help") {
139
- index += 1;
140
- continue;
141
- }
142
- if (token.startsWith("-")) {
143
- index = skipOption(program, argv, index);
144
- continue;
145
- }
146
- if (token !== name)
147
- return undefined;
148
- return [...argv.slice(0, index), ...argv.slice(index + 1)];
149
- }
150
- return undefined;
151
- }
152
- function editDistance(a, b) {
153
- if (a === b)
154
- return 0;
155
- if (Math.abs(a.length - b.length) > 3)
156
- return Math.max(a.length, b.length);
157
- const rows = a.length + 1;
158
- const cols = b.length + 1;
159
- const previous = Array.from({ length: cols }, (_, index) => index);
160
- const current = new Array(cols);
161
- for (let i = 1; i < rows; i += 1) {
162
- current[0] = i;
163
- for (let j = 1; j < cols; j += 1) {
164
- const cost = a[i - 1] === b[j - 1] ? 0 : 1;
165
- current[j] = Math.min((previous[j] ?? 0) + 1, (current[j - 1] ?? 0) + 1, (previous[j - 1] ?? 0) + cost);
166
- }
167
- for (let j = 0; j < cols; j += 1)
168
- previous[j] = current[j] ?? 0;
169
- }
170
- return previous[b.length] ?? Math.max(a.length, b.length);
171
- }
172
- function suggestCommand(command, token) {
173
- const names = [...new Set(command.commands.flatMap((child) => {
174
- if (child.name() === "help" || child.name().length <= 1)
175
- return [];
176
- return [child.name(), ...child.aliases().filter((alias) => alias.length > 1)];
177
- }))];
178
- let best;
179
- let bestDistance = 3;
180
- for (const name of names) {
181
- const distance = editDistance(token, name);
182
- const length = Math.max(token.length, name.length);
183
- if (distance >= bestDistance || (length - distance) / length <= 0.4)
184
- continue;
185
- bestDistance = distance;
186
- best = name;
187
- }
188
- return best;
189
- }
190
- export function resolveHelpPath(program, argv) {
191
- const walk = walkCommandPath(program, argv);
192
- const cliAtRoot = walk.unknown === "cli" && walk.path.length === 0;
193
- if (cliAtRoot) {
194
- const stripped = stripRootCommand(program, argv, "cli");
195
- return {
196
- kind: "unknown",
197
- token: "cli",
198
- tryCommand: stripped && stripped.length > 0 ? stripped.join(" ") : undefined,
199
- };
200
- }
201
- if (!walk.helpRequested)
202
- return { kind: "passthrough" };
203
- if (walk.unknown === "run" && walk.path.length === 0)
204
- return { kind: "run-help" };
205
- if (walk.unknown) {
206
- return {
207
- kind: "unknown",
208
- token: walk.unknown,
209
- suggestion: suggestCommand(walk.command, walk.unknown),
210
- };
211
- }
212
- return { kind: "help", command: walk.command };
213
- }
214
- export function formatUnknownCommandError(result) {
215
- const lines = [`error: unknown command '${result.token}'`];
216
- if (result.tryCommand)
217
- lines.push(`Try: cohub ${result.tryCommand}`);
218
- else if (result.token === "cli")
219
- lines.push(`cohub has no "cli" subcommand. See cohub --help`);
220
- else if (result.suggestion)
221
- lines.push(`(Did you mean ${result.suggestion}?)`);
222
- return `${lines.join("\n")}\n`;
223
- }
@@ -1,20 +0,0 @@
1
- import type { HostEmit } from "./serve.js";
2
- export declare class HostAuth {
3
- #private;
4
- private readonly emit;
5
- private readonly onAccountChanged;
6
- constructor(emit: HostEmit, onAccountChanged: () => void);
7
- watch(): void;
8
- close(): void;
9
- get subject(): string | null;
10
- accessToken(forceRefresh?: boolean): Promise<string | null>;
11
- sessionVersion(): number;
12
- session(): {
13
- authenticated: boolean;
14
- userUuid: null;
15
- subject: string | null;
16
- email: null;
17
- };
18
- signIn(redirectPath?: string): Promise<boolean>;
19
- signOut(): Promise<boolean>;
20
- }
package/dist/host/auth.js DELETED
@@ -1,119 +0,0 @@
1
- import { mkdirSync, watch } from "node:fs";
2
- import { basename, dirname } from "node:path";
3
- import { HOST_SERVICE_SHELL_EVENTS, hostAuthChangedSchema, hostShellOpenSchema } from "@neta-art/cohub/host-bridge";
4
- import { AuthRequiredError, authSessionPath, pollDeviceCode, readAuthSession, requestDeviceCode, resolveAccessToken, revokeAndClearAuthSession, } from "../auth.js";
5
- import { clearHomeSpaceCache, jwtClaim } from "../space.js";
6
- const REOPEN_AFTER_MS = 10_000;
7
- function snapshot() {
8
- const session = readAuthSession();
9
- if (!session)
10
- return { subject: null, revision: null };
11
- return {
12
- subject: jwtClaim(session.idToken, "sub") ?? jwtClaim(session.accessToken, "sub"),
13
- revision: `${session.updatedAt}:${session.refreshToken}`,
14
- };
15
- }
16
- export class HostAuth {
17
- emit;
18
- onAccountChanged;
19
- #current = snapshot();
20
- #version = 0;
21
- #watcher = null;
22
- #debounce;
23
- #rewatch;
24
- #pending = null;
25
- #requesting = null;
26
- #redirectPath;
27
- constructor(emit, onAccountChanged) {
28
- this.emit = emit;
29
- this.onAccountChanged = onAccountChanged;
30
- }
31
- watch() {
32
- const path = authSessionPath();
33
- mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
34
- this.#watcher = watch(dirname(path), (_event, name) => {
35
- if (name && name !== basename(path))
36
- return;
37
- clearTimeout(this.#debounce);
38
- this.#debounce = setTimeout(() => this.#sync(), 50);
39
- });
40
- this.#watcher.once("error", () => {
41
- this.#watcher?.close();
42
- this.#rewatch = setTimeout(() => this.watch(), 1_000).unref();
43
- });
44
- }
45
- close() {
46
- clearTimeout(this.#debounce);
47
- clearTimeout(this.#rewatch);
48
- this.#watcher?.close();
49
- }
50
- get subject() {
51
- return this.#current.subject;
52
- }
53
- async accessToken(forceRefresh = false) {
54
- try {
55
- return await resolveAccessToken({ forceRefresh });
56
- }
57
- catch (error) {
58
- if (error instanceof AuthRequiredError)
59
- return null;
60
- throw error;
61
- }
62
- }
63
- sessionVersion() {
64
- return this.#version;
65
- }
66
- session() {
67
- const { subject } = snapshot();
68
- return { authenticated: subject !== null, userUuid: null, subject, email: null };
69
- }
70
- async signIn(redirectPath) {
71
- this.#redirectPath = hostAuthChangedSchema.shape.redirectPath.safeParse(redirectPath).data;
72
- const pending = this.#pending;
73
- if (pending && pending.expiresAt > Date.now()) {
74
- if (Date.now() - pending.openedAt >= REOPEN_AFTER_MS)
75
- this.#openPending(pending);
76
- return true;
77
- }
78
- this.#requesting ??= this.#request().finally(() => { this.#requesting = null; });
79
- await this.#requesting;
80
- return true;
81
- }
82
- async #request() {
83
- const code = await requestDeviceCode();
84
- const pending = { url: code.verificationUriComplete, expiresAt: code.expiresAt, openedAt: 0 };
85
- this.#pending = pending;
86
- this.#openPending(pending);
87
- void pollDeviceCode(code)
88
- .then(() => this.#sync({ redirectPath: this.#redirectPath, signedIn: true }))
89
- .catch((error) => process.stderr.write(`Sign-in did not complete: ${error instanceof Error ? error.message : String(error)}\n`))
90
- .finally(() => { if (this.#pending === pending)
91
- this.#pending = null; });
92
- }
93
- #openPending(pending) {
94
- pending.openedAt = Date.now();
95
- this.#open(pending.url);
96
- }
97
- async signOut() {
98
- await revokeAndClearAuthSession();
99
- clearHomeSpaceCache();
100
- this.#sync();
101
- this.emit("auth.signedOut");
102
- return true;
103
- }
104
- #open(url) {
105
- this.emit(HOST_SERVICE_SHELL_EVENTS.open, hostShellOpenSchema.parse({ url }));
106
- }
107
- #sync({ redirectPath, signedIn = false } = {}) {
108
- const next = snapshot();
109
- const accountChanged = next.subject !== this.#current.subject;
110
- if (next.revision !== this.#current.revision || accountChanged)
111
- this.#version += 1;
112
- this.#current = next;
113
- if (accountChanged)
114
- this.onAccountChanged();
115
- if (!accountChanged && !signedIn)
116
- return;
117
- this.emit("auth.changed", hostAuthChangedSchema.parse({ authenticated: next.subject !== null, ...(redirectPath ? { redirectPath } : {}) }));
118
- }
119
- }
@@ -1 +0,0 @@
1
- export declare function loginShellEnv(base?: NodeJS.ProcessEnv, platform?: NodeJS.Platform): Promise<NodeJS.ProcessEnv>;
@@ -1,31 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { randomUUID } from "node:crypto";
3
- const TIMEOUT_MS = 10_000;
4
- // Cohub settings come from the host, never from the user's shell.
5
- const SCOPED = /^(COHUB_.*|ENV)$/;
6
- const quote = (value) => `'${value.replaceAll("'", `'\\''`)}'`;
7
- export async function loginShellEnv(base = process.env, platform = process.platform) {
8
- const scoped = Object.fromEntries(Object.entries(base).filter(([key]) => SCOPED.test(key)));
9
- if (platform === "win32")
10
- return base;
11
- const shell = base.SHELL || (platform === "darwin" ? "/bin/zsh" : "/bin/sh");
12
- const mark = randomUUID();
13
- const print = `${quote(process.execPath)} -e ${quote("process.stdout.write(JSON.stringify(process.env))")}`;
14
- const output = await new Promise((resolve) => {
15
- execFile(shell, ["-l", "-i", "-c", `printf %s ${mark}; ${print}; printf %s ${mark}`], {
16
- encoding: "utf8", timeout: TIMEOUT_MS, maxBuffer: 4 * 1024 * 1024,
17
- env: base,
18
- }, (_error, stdout) => resolve(typeof stdout === "string" ? stdout : null));
19
- });
20
- const json = output?.split(mark)[1];
21
- if (!json)
22
- return base;
23
- try {
24
- const shellEnv = JSON.parse(json);
25
- const inherited = Object.fromEntries(Object.entries(shellEnv).filter(([key]) => !SCOPED.test(key)));
26
- return { ...inherited, ...scoped };
27
- }
28
- catch {
29
- return base;
30
- }
31
- }
@@ -1,35 +0,0 @@
1
- import type { DEVICE_RUNTIME_REFUSALS, DEVICE_RUNTIME_STOP_REFUSALS, DeviceDisplayStatus, DeviceFolderListing, DeviceRuntime } from "@neta-art/cohub/host-bridge";
2
- import type { HostEmit } from "./serve.js";
3
- type Refusal = (typeof DEVICE_RUNTIME_REFUSALS)[number];
4
- type StopRefusal = (typeof DEVICE_RUNTIME_STOP_REFUSALS)[number];
5
- export type DeviceRuntimeHostOptions = {
6
- cli: string;
7
- env: () => Promise<NodeJS.ProcessEnv>;
8
- account: () => string | null;
9
- };
10
- export declare class DeviceRuntimeHost {
11
- #private;
12
- private readonly emit;
13
- private readonly options;
14
- constructor(emit: HostEmit, options: DeviceRuntimeHostOptions);
15
- watch(): void;
16
- close(): void;
17
- changed(): void;
18
- list(): Promise<DeviceRuntime>;
19
- browse(path?: string): Promise<DeviceFolderListing>;
20
- connect(spaceId: string, root: string): Promise<DeviceRuntime & {
21
- refused: Refusal | null;
22
- }>;
23
- disconnect(spaceId: string, force?: boolean): Promise<DeviceRuntime & {
24
- refused: StopRefusal | null;
25
- }>;
26
- stopAccount(): Promise<void>;
27
- accountChanged(): void;
28
- displayStatus(): Promise<DeviceDisplayStatus>;
29
- share(spaceId: string): Promise<DeviceDisplayStatus>;
30
- stopSharing(): Promise<DeviceDisplayStatus>;
31
- stopOwnSharing(): Promise<void>;
32
- keepAwake(enabled?: boolean): Promise<boolean>;
33
- restore(): Promise<void>;
34
- }
35
- export {};