@neta-art/cohub-cli 10.23.0 → 10.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (369) hide show
  1. package/README.md +18 -5
  2. package/bin/cohub.js +4 -1
  3. package/dist/board-gpu/page.js +1566 -71230
  4. package/dist/bootstrap.js +67 -27
  5. package/dist/build.json +1 -1
  6. package/dist/{board-kernel/FilterPipe.js → chunks/Geometry.js} +10447 -10469
  7. package/dist/chunks/about.js +102 -0
  8. package/dist/chunks/app-realtime.js +2216 -0
  9. package/dist/chunks/app-realtime2.js +2 -0
  10. package/dist/chunks/app-ref.js +88 -0
  11. package/dist/chunks/apps.js +1423 -0
  12. package/dist/chunks/auth.js +175 -0
  13. package/dist/chunks/avatar.js +146 -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 +309 -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 +2511 -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 -118
  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 -64
  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 -2139
  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 -6
  354. package/dist/session-status.js +0 -16
  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
package/dist/http-put.js DELETED
@@ -1,132 +0,0 @@
1
- import { createReadStream } from "node:fs";
2
- const DEFAULT_ATTEMPTS = 3;
3
- const DEFAULT_DELAY_MS = 200;
4
- const RETRYABLE_STATUS = new Set([408, 411, 425, 429, 500, 502, 503, 504]);
5
- const RETRYABLE_CODES = new Set([
6
- "BodyTimeoutError",
7
- "ConnectTimeoutError",
8
- "EAI_AGAIN",
9
- "ECONNREFUSED",
10
- "ECONNRESET",
11
- "EHOSTUNREACH",
12
- "ENETUNREACH",
13
- "ENOTFOUND",
14
- "EPIPE",
15
- "ETIMEDOUT",
16
- "HeadersTimeoutError",
17
- "UND_ERR_BODY_TIMEOUT",
18
- "UND_ERR_CONNECT",
19
- "UND_ERR_CONNECT_TIMEOUT",
20
- "UND_ERR_HEADERS_TIMEOUT",
21
- "UND_ERR_SOCKET",
22
- ]);
23
- export class HttpPutError extends Error {
24
- status;
25
- body;
26
- constructor(message, status, body = "") {
27
- super(message);
28
- this.name = "HttpPutError";
29
- this.status = status;
30
- this.body = body;
31
- }
32
- }
33
- function withContentLength(headers, contentLength) {
34
- const result = new Headers(headers);
35
- if (contentLength !== undefined && !result.has("content-length")) {
36
- result.set("content-length", String(contentLength));
37
- }
38
- return result;
39
- }
40
- function errorCode(error) {
41
- if (!error || typeof error !== "object")
42
- return undefined;
43
- const record = error;
44
- if (typeof record.code === "string")
45
- return record.code;
46
- if (typeof record.cause?.code === "string")
47
- return record.cause.code;
48
- if (typeof record.cause?.name === "string")
49
- return record.cause.name;
50
- if (typeof record.name === "string")
51
- return record.name;
52
- return undefined;
53
- }
54
- function isRetryableError(error) {
55
- const code = errorCode(error);
56
- return Boolean(code && RETRYABLE_CODES.has(code));
57
- }
58
- function isRetryableStatus(status) {
59
- return RETRYABLE_STATUS.has(status);
60
- }
61
- function defaultSleep(ms) {
62
- return new Promise((resolve) => setTimeout(resolve, ms));
63
- }
64
- function failureMessage(label, status, detail) {
65
- return `Failed to upload ${label}: HTTP ${status}${detail ? ` — ${detail}` : ""}`;
66
- }
67
- async function putWithRetry(input) {
68
- const attempts = input.attempts ?? DEFAULT_ATTEMPTS;
69
- const delayMs = input.delayMs ?? DEFAULT_DELAY_MS;
70
- const sleep = input.sleep ?? defaultSleep;
71
- const fetchImpl = input.fetch ?? fetch;
72
- let lastError;
73
- for (let attempt = 0; attempt < attempts; attempt += 1) {
74
- try {
75
- const response = await fetchImpl(input.url, {
76
- method: "PUT",
77
- headers: withContentLength(input.headers, input.contentLength),
78
- body: input.body(),
79
- ...(input.duplex ? { duplex: "half" } : {}),
80
- });
81
- if (response.ok)
82
- return response;
83
- const detail = await response.text().catch(() => "");
84
- const error = new HttpPutError(failureMessage(input.label, response.status, detail), response.status, detail);
85
- if (attempt < attempts - 1 && isRetryableStatus(response.status)) {
86
- lastError = error;
87
- await sleep(delayMs * 2 ** attempt);
88
- continue;
89
- }
90
- throw error;
91
- }
92
- catch (error) {
93
- if (error instanceof HttpPutError)
94
- throw error;
95
- lastError = error;
96
- if (attempt < attempts - 1 && isRetryableError(error)) {
97
- await sleep(delayMs * 2 ** attempt);
98
- continue;
99
- }
100
- throw error;
101
- }
102
- }
103
- throw lastError;
104
- }
105
- export async function putLocalFile(input) {
106
- await putWithRetry({
107
- url: input.url,
108
- body: () => createReadStream(input.filePath),
109
- headers: input.headers,
110
- contentLength: input.size,
111
- duplex: true,
112
- label: input.label,
113
- attempts: input.attempts,
114
- delayMs: input.delayMs,
115
- sleep: input.sleep,
116
- fetch: input.fetch,
117
- });
118
- }
119
- export async function putBytes(input) {
120
- const body = input.body;
121
- await putWithRetry({
122
- url: input.url,
123
- body: () => body,
124
- headers: input.headers,
125
- contentLength: input.size,
126
- label: input.label,
127
- attempts: input.attempts,
128
- delayMs: input.delayMs,
129
- sleep: input.sleep,
130
- fetch: input.fetch,
131
- });
132
- }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
package/dist/index.js DELETED
@@ -1,129 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from "commander";
3
- import { registerEndpointOptions } from "./endpoint-options.js";
4
- import { registerAuth } from "./commands/auth.js";
5
- import { registerBoards } from "./commands/boards.js";
6
- import { registerChannels } from "./commands/channels.js";
7
- import { registerCronJobs } from "./commands/cron-jobs.js";
8
- import { registerFeedback } from "./commands/feedback.js";
9
- import { registerGenerations } from "./commands/generations.js";
10
- import { registerMe } from "./commands/me.js";
11
- import { registerModels } from "./commands/models.js";
12
- import { registerProfile } from "./commands/profile.js";
13
- import { registerPrompts } from "./commands/prompts.js";
14
- import { registerPublic } from "./commands/public.js";
15
- import { registerSkills } from "./commands/skills.js";
16
- import { registerSearch } from "./commands/search.js";
17
- import { registerReferences } from "./commands/references.js";
18
- import { registerReferrals } from "./commands/referrals.js";
19
- import { registerPrompt, registerSpaces } from "./commands/spaces.js";
20
- import { maybeHandleRunCommand, printRunHelp } from "./commands/run.js";
21
- import { registerRuntime } from "./commands/runtime.js";
22
- import { registerTasks } from "./commands/tasks.js";
23
- import { registerDesktop, registerLegacyUi } from "./commands/desktop.js";
24
- import { registerHost } from "./commands/host.js";
25
- import { registerVersion } from "./commands/version.js";
26
- import { registerApps } from "./commands/apps.js";
27
- import { registerRooms } from "./commands/rooms.js";
28
- import { formatUnknownCommandError, resolveHelpPath } from "./help-path.js";
29
- import { CLI_VERSION } from "./version.js";
30
- const program = registerEndpointOptions(new Command("cohub"));
31
- program
32
- .name("cohub")
33
- .summary("Work with Cohub from your terminal")
34
- .description("Send prompts, manage Space files, and publish public output.")
35
- .version(CLI_VERSION, "-v, --version", "Show version")
36
- .option("-s, --space <space>", "Target Space: ID, slug, or username/slug")
37
- .option("--json", "Print machine-readable JSON when supported")
38
- .helpOption("-h, --help", "Show help")
39
- .addHelpText("after", `
40
-
41
- Help:
42
- cohub apps publish --help
43
- cohub help apps publish
44
-
45
- Common commands:
46
- cohub auth login
47
- cohub profile avatar ./avatar.png
48
- cohub spaces ls
49
- cohub prompt "Fix the failing tests"
50
- cohub completion "Summarize AGENTS.md" --system-prompt AGENTS.md --stream
51
- cohub decision "I was charged twice" -q questions.json
52
- cohub run -- git status
53
- cohub runtime up ./my-project
54
- cohub runtime logs --follow
55
- cohub search "release notes"
56
- cohub -s <space-id> boards get <board-id>
57
- cohub -s <space-id> spaces turns ls --author others
58
- cohub -s <space-id> spaces sessions turns ls <session-id>
59
- cohub -s home spaces files ls
60
- cohub -s <space-id> public upload ./dist demo
61
- cohub -s <space-id> apps publish demo --file dist/index.html
62
- cohub desktop open <app-id> --call selection.get
63
- cohub rooms join <invite>
64
- cohub -s <space-id> spaces commerce products list
65
- cohub models ls
66
- cohub models ls --model-type multimodal
67
- cohub generate "A calm lake at sunrise" --model <model> --output lake.png
68
- cohub feedback "Describe the problem" -f screenshot.png
69
-
70
- Target space:
71
- -s <space>, then COHUB_SPACE_ID, then the current directory Runtime binding.
72
- <space> is an ID, a slug you own such as home, or username/slug.
73
- prompt, completion, decision, generate, apps, and public fall back to your Home Space;
74
- other Space commands need a target.
75
-
76
- Environment:
77
- COHUB_SPACE_ID Target Space when -s is omitted
78
- COHUB_EXECUTION_TOKEN Use this token instead of the stored Logto session
79
- COHUB_BASE_URL Override the API base URL
80
- COHUB_WS_URL Override the realtime WebSocket URL
81
- COHUB_WEB_URL Override the web URL used in links
82
- COHUB_NO_DIRECT=1 Send files and screens through the API even when this machine serves the Space
83
- ENV=dev Use the development Cohub environment
84
- HTTPS_PROXY Honored for API and uploads (also HTTP_PROXY, NO_PROXY)
85
- Runtime logs ~/.local/state/cohub/runtime/<space-id>/diagnostics
86
- `);
87
- registerAuth(program);
88
- registerBoards(program);
89
- registerProfile(program);
90
- registerMe(program);
91
- registerPrompt(program);
92
- registerSpaces(program);
93
- registerRuntime(program);
94
- registerChannels(program);
95
- registerGenerations(program);
96
- registerModels(program);
97
- registerPrompts(program);
98
- registerPublic(program);
99
- registerSkills(program);
100
- registerSearch(program);
101
- registerReferences(program);
102
- registerReferrals(program);
103
- registerTasks(program);
104
- registerCronJobs(program);
105
- registerApps(program);
106
- registerRooms(program);
107
- registerFeedback(program);
108
- registerDesktop(program);
109
- registerLegacyUi(program);
110
- registerHost(program);
111
- registerVersion(program);
112
- const argv = process.argv.slice(2);
113
- const help = resolveHelpPath(program, argv);
114
- if (help.kind === "help") {
115
- help.command.outputHelp();
116
- }
117
- else if (help.kind === "run-help") {
118
- printRunHelp();
119
- }
120
- else if (help.kind === "unknown") {
121
- process.stderr.write(formatUnknownCommandError(help));
122
- process.exit(1);
123
- }
124
- else if (await maybeHandleRunCommand(argv)) {
125
- process.exit();
126
- }
127
- else {
128
- program.parse();
129
- }
@@ -1,4 +0,0 @@
1
- export declare function exitCodeForChild(code: number | null, signal: NodeJS.Signals | null): number;
2
- export declare function relaunchCli(entrypoint: string, argv: string[], options?: {
3
- execArgv?: readonly string[];
4
- }): Promise<number>;
package/dist/launcher.js DELETED
@@ -1,38 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { constants } from "node:os";
3
- const FORWARDED_SIGNALS = ["SIGINT", "SIGTERM", "SIGHUP"];
4
- export function exitCodeForChild(code, signal) {
5
- if (code !== null)
6
- return code;
7
- if (!signal)
8
- return 1;
9
- return 128 + (constants.signals[signal] ?? 1);
10
- }
11
- export function relaunchCli(entrypoint, argv, options) {
12
- return new Promise((resolve, reject) => {
13
- const child = spawn(process.execPath, [...(options?.execArgv ?? []), entrypoint, ...argv], {
14
- env: process.env,
15
- stdio: "inherit",
16
- });
17
- const signalHandlers = FORWARDED_SIGNALS.map((signal) => {
18
- const forward = () => {
19
- if (child.exitCode === null && child.signalCode === null)
20
- child.kill(signal);
21
- };
22
- process.on(signal, forward);
23
- return [signal, forward];
24
- });
25
- const cleanup = () => {
26
- for (const [signal, forward] of signalHandlers)
27
- process.off(signal, forward);
28
- };
29
- child.once("error", (error) => {
30
- cleanup();
31
- reject(error);
32
- });
33
- child.once("close", (code, signal) => {
34
- cleanup();
35
- resolve(exitCodeForChild(code, signal));
36
- });
37
- });
38
- }
@@ -1,2 +0,0 @@
1
- import type { MediaFacts } from "@neta-art/cohub/media";
2
- export declare function localMediaFacts(file: string, type: "image" | "video", signal?: AbortSignal): Promise<MediaFacts | null>;
@@ -1,30 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
3
- const run = promisify(execFile);
4
- const oriented = (width, height, turned) => (turned ? { width: height, height: width } : { width, height });
5
- export async function localMediaFacts(file, type, signal) {
6
- try {
7
- if (type === "image") {
8
- const { default: sharp } = await import("sharp");
9
- const { width = 0, height = 0, orientation = 1 } = await sharp(file).metadata();
10
- return width > 0 && height > 0 ? oriented(width, height, orientation >= 5) : null;
11
- }
12
- const { stdout } = await run("ffprobe", [
13
- "-v", "error", "-select_streams", "v:0",
14
- "-show_entries", "stream=width,height:stream_side_data=rotation:format=duration", "-of", "json", file,
15
- ], { signal, timeout: 5_000 });
16
- const { streams, format } = JSON.parse(stdout);
17
- const stream = streams?.[0];
18
- if (!stream?.width || !stream.height)
19
- return null;
20
- const rotation = stream.side_data_list?.find((data) => data.rotation !== undefined)?.rotation ?? 0;
21
- const durationMs = Math.round(Number(format?.duration) * 1000);
22
- return {
23
- ...oriented(stream.width, stream.height, Math.abs(rotation) % 180 === 90),
24
- ...(durationMs > 0 ? { durationMs } : {}),
25
- };
26
- }
27
- catch {
28
- return null;
29
- }
30
- }
@@ -1,3 +0,0 @@
1
- export declare const isFetchFailure: (error: unknown) => error is Error;
2
- export declare function fetchFailureReason(error: unknown): string | null;
3
- export declare function describeError(error: unknown): string;
@@ -1,22 +0,0 @@
1
- const text = (value) => (typeof value === "string" && value ? value : null);
2
- export const isFetchFailure = (error) => error instanceof Error && error.message === "fetch failed";
3
- export function fetchFailureReason(error) {
4
- if (!isFetchFailure(error) || typeof error.cause !== "object" || !error.cause)
5
- return null;
6
- const cause = error.cause;
7
- const message = text(cause.message);
8
- const code = text(cause.code);
9
- const hostname = text(cause.hostname);
10
- const parts = [
11
- code && !message?.includes(code) ? code : null,
12
- hostname && !message?.includes(hostname) ? `host: ${hostname}` : null,
13
- message,
14
- ].filter(Boolean);
15
- return parts.length > 0 ? parts.join(" · ") : null;
16
- }
17
- export function describeError(error) {
18
- if (!(error instanceof Error))
19
- return String(error);
20
- const reason = fetchFailureReason(error);
21
- return reason ? `${error.message} (${reason})` : error.message;
22
- }
package/dist/output.d.ts DELETED
@@ -1,46 +0,0 @@
1
- export type Row = Record<string, unknown>;
2
- /**
3
- * A table column. `format` maps a raw cell value to its display string, so
4
- * machine-oriented fields (epoch timestamps, byte counts) stay unmodified in
5
- * `--json` output while the human-facing table shows something readable.
6
- */
7
- export type Column = {
8
- key: string;
9
- label: string;
10
- format?: (value: unknown, row: Row) => string;
11
- };
12
- /**
13
- * Timestamp → local ISO-style date and time with the system's UTC offset.
14
- *
15
- * CLI tables are for people and follow the machine's local timezone. Structured
16
- * output remains untouched so scripts continue to receive the server value.
17
- */
18
- export declare function formatLocalDateTime(value: unknown): string;
19
- /**
20
- * Epoch milliseconds → local date and time.
21
- *
22
- * Absent values render empty rather than falling through `Number()` coercion:
23
- * `null` and `""` both become 0 there, which would print a confident-looking
24
- * Unix epoch for a timestamp the server never sent.
25
- */
26
- export declare function formatEpochMs(value: unknown): string;
27
- /**
28
- * Collapse whitespace and clip long text for a single-line table cell, so
29
- * multi-line values cannot break the row layout. `--json` output keeps the
30
- * raw value; only the human-facing table is shortened.
31
- */
32
- export declare function truncateText(value: unknown, maxLength: number): string;
33
- export declare function table(rows: Row[], columns: Column[]): void;
34
- export declare function json(data: unknown): void;
35
- export declare function jsonRequested(opts?: {
36
- json?: boolean;
37
- }): boolean;
38
- export declare function ok(msg: string): void;
39
- export declare function warn(msg: string): void;
40
- export declare function error(msg: string, detail?: string): never;
41
- export declare function handleHttp(e: unknown): never;
42
- export declare function spinner(): {
43
- start(msg: string): void;
44
- update(msg: string): void;
45
- stop(msg: string): void;
46
- };
package/dist/output.js DELETED
@@ -1,244 +0,0 @@
1
- import process from "node:process";
2
- import { extractBillingPayload } from "@neta-art/cohub";
3
- import { fetchFailureReason, isFetchFailure } from "./network-error.js";
4
- /**
5
- * Timestamp → local ISO-style date and time with the system's UTC offset.
6
- *
7
- * CLI tables are for people and follow the machine's local timezone. Structured
8
- * output remains untouched so scripts continue to receive the server value.
9
- */
10
- export function formatLocalDateTime(value) {
11
- const date = value instanceof Date
12
- ? value
13
- : typeof value === "number"
14
- ? new Date(value)
15
- : typeof value === "string" && value.trim() !== ""
16
- ? new Date(value)
17
- : null;
18
- if (!date || Number.isNaN(date.getTime()))
19
- return "";
20
- const pad = (part) => String(part).padStart(2, "0");
21
- const offsetMinutes = -date.getTimezoneOffset();
22
- const offsetSign = offsetMinutes >= 0 ? "+" : "-";
23
- const absoluteOffset = Math.abs(offsetMinutes);
24
- const offset = `${offsetSign}${pad(Math.floor(absoluteOffset / 60))}:${pad(absoluteOffset % 60)}`;
25
- return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(date.getSeconds())} ${offset}`;
26
- }
27
- /**
28
- * Epoch milliseconds → local date and time.
29
- *
30
- * Absent values render empty rather than falling through `Number()` coercion:
31
- * `null` and `""` both become 0 there, which would print a confident-looking
32
- * Unix epoch for a timestamp the server never sent.
33
- */
34
- export function formatEpochMs(value) {
35
- const ms = typeof value === "number"
36
- ? value
37
- : typeof value === "string" && value.trim() !== ""
38
- ? Number(value)
39
- : Number.NaN;
40
- if (!Number.isFinite(ms))
41
- return "";
42
- return formatLocalDateTime(ms);
43
- }
44
- /**
45
- * Collapse whitespace and clip long text for a single-line table cell, so
46
- * multi-line values cannot break the row layout. `--json` output keeps the
47
- * raw value; only the human-facing table is shortened.
48
- */
49
- export function truncateText(value, maxLength) {
50
- const text = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
51
- if (text.length <= maxLength)
52
- return text;
53
- return `${text.slice(0, Math.max(0, maxLength - 1)).trimEnd()}…`;
54
- }
55
- function cellText(column, row) {
56
- const raw = row[column.key];
57
- if (column.format)
58
- return column.format(raw, row);
59
- if (/(?:At|Timestamp)$/.test(column.key))
60
- return formatLocalDateTime(raw);
61
- const v = raw ?? "";
62
- return typeof v === "object" ? JSON.stringify(v) : String(v);
63
- }
64
- function colWidth(rows, column) {
65
- const maxVal = rows.reduce((m, r) => Math.max(m, cellText(column, r).length), 0);
66
- return Math.max(column.label.length, maxVal) + 2;
67
- }
68
- export function table(rows, columns) {
69
- if (rows.length === 0) {
70
- console.log(" (empty)");
71
- return;
72
- }
73
- const widths = columns.map((c) => colWidth(rows, c));
74
- const header = columns
75
- .map((c, i) => c.label.padEnd(widths[i] ?? 0))
76
- .join(" │ ")
77
- .trimEnd();
78
- console.log(header);
79
- console.log("─".repeat(header.length));
80
- for (const row of rows) {
81
- const line = columns
82
- .map((c, i) => cellText(c, row).padEnd(widths[i] ?? 0))
83
- .join(" │ ")
84
- .trimEnd();
85
- console.log(line);
86
- }
87
- }
88
- // -- Output helpers ----------------------------------------------------------
89
- export function json(data) {
90
- console.log(JSON.stringify(data, null, 2));
91
- }
92
- export function jsonRequested(opts) {
93
- return Boolean(opts?.json || process.argv.includes("--json"));
94
- }
95
- export function ok(msg) {
96
- console.log(`\n ✓ ${msg}\n`);
97
- }
98
- export function warn(msg) {
99
- console.log(`\n ⚠ ${msg}\n`);
100
- }
101
- export function error(msg, detail) {
102
- process.stderr.write(`\n ✗ ${msg}\n`);
103
- if (detail)
104
- process.stderr.write(` ${detail}\n`);
105
- process.stderr.write("\n");
106
- process.exit(1);
107
- }
108
- // -- HTTP error handler ------------------------------------------------------
109
- function errorMessageFromBody(body) {
110
- if (!body || typeof body !== "object")
111
- return null;
112
- const errorBody = body;
113
- if (typeof errorBody.message === "string" && errorBody.message.trim())
114
- return errorBody.message;
115
- return null;
116
- }
117
- function diagnosticDetailFromBody(body) {
118
- if (!body || typeof body !== "object")
119
- return null;
120
- const diagnostics = body.diagnostics;
121
- if (!Array.isArray(diagnostics) || diagnostics.length === 0)
122
- return null;
123
- const lines = diagnostics.slice(0, 8).flatMap((item) => {
124
- if (!item || typeof item !== "object")
125
- return [];
126
- const diagnostic = item;
127
- if (typeof diagnostic.message !== "string" || !diagnostic.message.trim())
128
- return [];
129
- const path = typeof diagnostic.path === "string" ? diagnostic.path : "";
130
- const message = diagnostic.message.replace(path ? `${path}: ` : "", "");
131
- return [`${path ? `${path}: ` : ""}${message}`];
132
- });
133
- if (lines.length === 0)
134
- return null;
135
- const suffix = diagnostics.length > lines.length ? ` (+${diagnostics.length - lines.length} more)` : "";
136
- return `${lines.join("; ")}${suffix}`;
137
- }
138
- function debugErrorMetaFromBody(body) {
139
- if (!body || typeof body !== "object")
140
- return [];
141
- const errorBody = body;
142
- const items = [];
143
- const code = typeof errorBody.code === "string" ? errorBody.code : null;
144
- if (code)
145
- items.push(code);
146
- if (typeof errorBody.requestId === "string")
147
- items.push(`requestId: ${errorBody.requestId}`);
148
- if (typeof errorBody.traceId === "string")
149
- items.push(`traceId: ${errorBody.traceId}`);
150
- return items;
151
- }
152
- function fetchFailureDetail(e) {
153
- if (!isFetchFailure(e))
154
- return null;
155
- const reason = fetchFailureReason(e);
156
- return `Network request failed${reason ? ` (${reason})` : ""}. Check DNS/proxy/firewall settings and try again.`;
157
- }
158
- function errorPresentationFromHttpError(e) {
159
- const httpError = e;
160
- if (httpError.code === "space_commerce_not_initialized") {
161
- return {
162
- message: "space commerce is not initialized",
163
- detail: "run `cohub -s <space-id> spaces commerce setup` first",
164
- };
165
- }
166
- return null;
167
- }
168
- export function handleHttp(e) {
169
- const status = e.status;
170
- const body = e.body;
171
- if (jsonRequested()) {
172
- const payload = body && typeof body === "object"
173
- ? body
174
- : {
175
- code: e.code ?? "CLI_ERROR",
176
- message: e instanceof Error ? e.message : String(e),
177
- ...(status ? { status } : {}),
178
- };
179
- process.stderr.write(`${JSON.stringify(payload, null, 2)}\n`);
180
- process.exit(1);
181
- }
182
- if (e instanceof Error && e.name === "AuthRequiredError") {
183
- return error("not authenticated", "run `cohub auth login`");
184
- }
185
- if (status === 402) {
186
- const conversion = extractBillingPayload(body)?.conversion;
187
- if (conversion) {
188
- return error(conversion.title || "Upgrade required", [conversion.message, "Manage billing at your Cohub account settings."]
189
- .filter(Boolean)
190
- .join(" · "));
191
- }
192
- }
193
- const presentation = errorPresentationFromHttpError(e);
194
- const message = presentation?.message ?? errorMessageFromBody(body) ?? (e instanceof Error ? e.message : String(e));
195
- const fetchDetail = fetchFailureDetail(e);
196
- const diagnosticDetail = diagnosticDetailFromBody(body);
197
- const detailParts = [];
198
- if (diagnosticDetail)
199
- detailParts.push(diagnosticDetail);
200
- if (presentation?.detail)
201
- detailParts.push(presentation.detail);
202
- if (process.env.COHUB_DEBUG_ERRORS) {
203
- if (status)
204
- detailParts.push(`HTTP ${status}`);
205
- detailParts.push(...debugErrorMetaFromBody(body));
206
- }
207
- error(message, detailParts.length > 0 ? detailParts.join(" · ") : fetchDetail ?? undefined);
208
- }
209
- // -- Spinner -----------------------------------------------------------------
210
- export function spinner() {
211
- let interval = null;
212
- const frames = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
213
- let i = 0;
214
- let currentMsg = "";
215
- return {
216
- start(msg) {
217
- currentMsg = msg;
218
- if (process.env.CI || !process.stderr.isTTY) {
219
- process.stderr.write(` ${currentMsg}...\n`);
220
- return;
221
- }
222
- process.stderr.write(` ${currentMsg} `);
223
- interval = setInterval(() => {
224
- process.stderr.clearLine?.(0);
225
- process.stderr.cursorTo?.(0);
226
- process.stderr.write(` ${frames[i++ % frames.length] ?? ""} ${currentMsg} `);
227
- }, 80);
228
- },
229
- update(msg) {
230
- currentMsg = msg;
231
- },
232
- stop(msg) {
233
- if (interval)
234
- clearInterval(interval);
235
- if (process.env.CI || !process.stderr.isTTY) {
236
- process.stderr.write(` ${msg}\n`);
237
- return;
238
- }
239
- process.stderr.clearLine?.(0);
240
- process.stderr.cursorTo?.(0);
241
- process.stderr.write(` ✓ ${msg}\n`);
242
- },
243
- };
244
- }