@neta-art/cohub-cli 10.24.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 (368) 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/board-export-resources.js +232 -0
  14. package/dist/chunks/board-export.js +874 -0
  15. package/dist/chunks/board-export2.js +2 -0
  16. package/dist/{board-kernel.js → chunks/board-kernel.js} +18032 -28512
  17. package/dist/chunks/board-kernel2.js +4 -0
  18. package/dist/chunks/board-profile.js +69 -0
  19. package/dist/chunks/board-simulate.js +315 -0
  20. package/dist/chunks/board-time.js +34 -0
  21. package/dist/chunks/boards.js +1943 -0
  22. package/dist/{board-kernel → chunks}/browserAll.js +9 -8
  23. package/dist/chunks/channels.js +64 -0
  24. package/dist/chunks/client.js +12606 -0
  25. package/dist/chunks/command-input.js +17 -0
  26. package/dist/chunks/commander.js +2962 -0
  27. package/dist/chunks/cron-jobs.js +163 -0
  28. package/dist/chunks/daemon.js +545 -0
  29. package/dist/chunks/daemon2.js +2 -0
  30. package/dist/chunks/desktop.js +172 -0
  31. package/dist/chunks/endpoint-options.js +26 -0
  32. package/dist/chunks/env-proxy.js +35 -0
  33. package/dist/chunks/environment.js +154 -0
  34. package/dist/chunks/feedback.js +120 -0
  35. package/dist/chunks/generations.js +379 -0
  36. package/dist/chunks/host.js +9 -0
  37. package/dist/chunks/http-put.js +131 -0
  38. package/dist/chunks/id.js +2416 -0
  39. package/dist/{board-kernel → chunks}/init.js +1 -1
  40. package/dist/chunks/install.js +11959 -0
  41. package/dist/chunks/launch.js +374 -0
  42. package/dist/chunks/local-media.js +47 -0
  43. package/dist/chunks/me.js +134 -0
  44. package/dist/chunks/media.js +315 -0
  45. package/dist/chunks/models.js +242 -0
  46. package/dist/chunks/operands.js +46 -0
  47. package/dist/chunks/package-paths.js +13 -0
  48. package/dist/chunks/policy.js +221 -0
  49. package/dist/chunks/preferences.js +29 -0
  50. package/dist/chunks/profile.js +64 -0
  51. package/dist/chunks/prompts.js +41 -0
  52. package/dist/chunks/public.js +2 -0
  53. package/dist/chunks/public2.js +244 -0
  54. package/dist/chunks/references.js +197 -0
  55. package/dist/chunks/referrals.js +90 -0
  56. package/dist/chunks/rolldown-runtime.js +26 -0
  57. package/dist/chunks/rooms-connect.js +2 -0
  58. package/dist/chunks/rooms-connect2.js +151 -0
  59. package/dist/chunks/rooms-rtc.js +309 -0
  60. package/dist/chunks/rooms.js +211 -0
  61. package/dist/chunks/run.js +220 -0
  62. package/dist/chunks/runtime.js +638 -0
  63. package/dist/chunks/runtime2.js +286 -0
  64. package/dist/chunks/runtimes.js +48 -0
  65. package/dist/chunks/safe-remote-image.js +198 -0
  66. package/dist/chunks/schemas.js +6017 -0
  67. package/dist/chunks/search.js +113 -0
  68. package/dist/chunks/self-update.js +238 -0
  69. package/dist/chunks/serve.js +1246 -0
  70. package/dist/chunks/session-status.js +24 -0
  71. package/dist/chunks/skills.js +35 -0
  72. package/dist/chunks/spaces.js +5080 -0
  73. package/dist/chunks/src.js +405 -0
  74. package/dist/chunks/supervisor.js +2511 -0
  75. package/dist/chunks/supervisor2.js +2 -0
  76. package/dist/chunks/tasks.js +82 -0
  77. package/dist/chunks/themes.js +2898 -0
  78. package/dist/chunks/version.js +2 -0
  79. package/dist/chunks/version2.js +22 -0
  80. package/dist/chunks/version3.js +18 -0
  81. package/dist/chunks/web.js +7 -0
  82. package/dist/{board-kernel → chunks}/webworkerAll.js +1 -1
  83. package/dist/runtime/native/pi-extension.js +174 -166
  84. package/dist/runtime/worker.js +27 -16
  85. package/package.json +8 -9
  86. package/dist/about.d.ts +0 -2
  87. package/dist/about.js +0 -71
  88. package/dist/app-download.d.ts +0 -11
  89. package/dist/app-download.js +0 -252
  90. package/dist/app-ref.d.ts +0 -5
  91. package/dist/app-ref.js +0 -8
  92. package/dist/app-target.d.ts +0 -26
  93. package/dist/app-target.js +0 -55
  94. package/dist/auth.d.ts +0 -45
  95. package/dist/auth.js +0 -307
  96. package/dist/avatar.d.ts +0 -55
  97. package/dist/avatar.js +0 -104
  98. package/dist/board-command-support.d.ts +0 -6
  99. package/dist/board-command-support.js +0 -88
  100. package/dist/board-export-resources.d.ts +0 -12
  101. package/dist/board-export-resources.js +0 -51
  102. package/dist/board-export.d.ts +0 -110
  103. package/dist/board-export.js +0 -592
  104. package/dist/board-fonts.d.ts +0 -11
  105. package/dist/board-fonts.js +0 -10
  106. package/dist/board-gpu/daemon.d.ts +0 -11
  107. package/dist/board-gpu/daemon.js +0 -295
  108. package/dist/board-gpu/index.d.ts +0 -33
  109. package/dist/board-gpu/index.js +0 -189
  110. package/dist/board-gpu/protocol.d.ts +0 -77
  111. package/dist/board-gpu/protocol.js +0 -1
  112. package/dist/board-kernel.d.ts +0 -5
  113. package/dist/board-media-export.d.ts +0 -17
  114. package/dist/board-media-export.js +0 -164
  115. package/dist/board-media.d.ts +0 -5
  116. package/dist/board-media.js +0 -66
  117. package/dist/board-profile.d.ts +0 -21
  118. package/dist/board-profile.js +0 -67
  119. package/dist/board-simulate.d.ts +0 -67
  120. package/dist/board-simulate.js +0 -259
  121. package/dist/board-time.d.ts +0 -3
  122. package/dist/board-time.js +0 -34
  123. package/dist/bootstrap.d.ts +0 -2
  124. package/dist/client.d.ts +0 -5
  125. package/dist/client.js +0 -24
  126. package/dist/command-input.d.ts +0 -4
  127. package/dist/command-input.js +0 -16
  128. package/dist/commands/app-commerce.d.ts +0 -2
  129. package/dist/commands/app-commerce.js +0 -228
  130. package/dist/commands/app-domains.d.ts +0 -2
  131. package/dist/commands/app-domains.js +0 -133
  132. package/dist/commands/apps.d.ts +0 -4
  133. package/dist/commands/apps.js +0 -827
  134. package/dist/commands/auth.d.ts +0 -2
  135. package/dist/commands/auth.js +0 -186
  136. package/dist/commands/boards/authoring.d.ts +0 -2
  137. package/dist/commands/boards/authoring.js +0 -166
  138. package/dist/commands/boards/examples.d.ts +0 -10
  139. package/dist/commands/boards/examples.js +0 -118
  140. package/dist/commands/boards.d.ts +0 -13
  141. package/dist/commands/boards.js +0 -836
  142. package/dist/commands/channels.d.ts +0 -2
  143. package/dist/commands/channels.js +0 -74
  144. package/dist/commands/cron-jobs.d.ts +0 -2
  145. package/dist/commands/cron-jobs.js +0 -155
  146. package/dist/commands/decision.d.ts +0 -4
  147. package/dist/commands/decision.js +0 -113
  148. package/dist/commands/desktop.d.ts +0 -10
  149. package/dist/commands/desktop.js +0 -233
  150. package/dist/commands/feedback.d.ts +0 -2
  151. package/dist/commands/feedback.js +0 -131
  152. package/dist/commands/generations.d.ts +0 -2
  153. package/dist/commands/generations.js +0 -427
  154. package/dist/commands/host.d.ts +0 -2
  155. package/dist/commands/host.js +0 -11
  156. package/dist/commands/me.d.ts +0 -2
  157. package/dist/commands/me.js +0 -121
  158. package/dist/commands/models.d.ts +0 -28
  159. package/dist/commands/models.js +0 -271
  160. package/dist/commands/profile.d.ts +0 -2
  161. package/dist/commands/profile.js +0 -81
  162. package/dist/commands/prompts.d.ts +0 -2
  163. package/dist/commands/prompts.js +0 -37
  164. package/dist/commands/public.d.ts +0 -20
  165. package/dist/commands/public.js +0 -291
  166. package/dist/commands/references.d.ts +0 -2
  167. package/dist/commands/references.js +0 -193
  168. package/dist/commands/referrals.d.ts +0 -2
  169. package/dist/commands/referrals.js +0 -88
  170. package/dist/commands/rooms-connect.d.ts +0 -17
  171. package/dist/commands/rooms-connect.js +0 -140
  172. package/dist/commands/rooms-rtc-binary.d.ts +0 -2
  173. package/dist/commands/rooms-rtc-binary.js +0 -107
  174. package/dist/commands/rooms-rtc.d.ts +0 -21
  175. package/dist/commands/rooms-rtc.js +0 -171
  176. package/dist/commands/rooms.d.ts +0 -3
  177. package/dist/commands/rooms.js +0 -277
  178. package/dist/commands/run.d.ts +0 -13
  179. package/dist/commands/run.js +0 -246
  180. package/dist/commands/runtime.d.ts +0 -3
  181. package/dist/commands/runtime.js +0 -320
  182. package/dist/commands/sandboxd-binary.d.ts +0 -11
  183. package/dist/commands/sandboxd-binary.js +0 -238
  184. package/dist/commands/search.d.ts +0 -2
  185. package/dist/commands/search.js +0 -114
  186. package/dist/commands/session-access.d.ts +0 -2
  187. package/dist/commands/session-access.js +0 -70
  188. package/dist/commands/skills.d.ts +0 -2
  189. package/dist/commands/skills.js +0 -34
  190. package/dist/commands/space-activity.d.ts +0 -26
  191. package/dist/commands/space-activity.js +0 -147
  192. package/dist/commands/space-commerce.d.ts +0 -2
  193. package/dist/commands/space-commerce.js +0 -514
  194. package/dist/commands/space-displays.d.ts +0 -2
  195. package/dist/commands/space-displays.js +0 -620
  196. package/dist/commands/space-files.d.ts +0 -5
  197. package/dist/commands/space-files.js +0 -215
  198. package/dist/commands/space-invitations.d.ts +0 -29
  199. package/dist/commands/space-invitations.js +0 -189
  200. package/dist/commands/space-turns.d.ts +0 -49
  201. package/dist/commands/space-turns.js +0 -205
  202. package/dist/commands/space-wallet.d.ts +0 -2
  203. package/dist/commands/space-wallet.js +0 -141
  204. package/dist/commands/space-webhooks.d.ts +0 -7
  205. package/dist/commands/space-webhooks.js +0 -73
  206. package/dist/commands/spaces.d.ts +0 -25
  207. package/dist/commands/spaces.js +0 -2170
  208. package/dist/commands/tasks.d.ts +0 -8
  209. package/dist/commands/tasks.js +0 -80
  210. package/dist/commands/version.d.ts +0 -2
  211. package/dist/commands/version.js +0 -21
  212. package/dist/endpoint-options.d.ts +0 -4
  213. package/dist/endpoint-options.js +0 -26
  214. package/dist/env-proxy.d.ts +0 -5
  215. package/dist/env-proxy.js +0 -20
  216. package/dist/help-path.d.ts +0 -18
  217. package/dist/help-path.js +0 -223
  218. package/dist/host/auth.d.ts +0 -20
  219. package/dist/host/auth.js +0 -119
  220. package/dist/host/login-env.d.ts +0 -1
  221. package/dist/host/login-env.js +0 -31
  222. package/dist/host/runtime.d.ts +0 -35
  223. package/dist/host/runtime.js +0 -395
  224. package/dist/host/runtimes.d.ts +0 -9
  225. package/dist/host/runtimes.js +0 -42
  226. package/dist/host/serve.d.ts +0 -2
  227. package/dist/host/serve.js +0 -117
  228. package/dist/host/workspaces.d.ts +0 -2
  229. package/dist/host/workspaces.js +0 -18
  230. package/dist/http-put.d.ts +0 -25
  231. package/dist/http-put.js +0 -132
  232. package/dist/index.d.ts +0 -2
  233. package/dist/index.js +0 -129
  234. package/dist/launcher.d.ts +0 -4
  235. package/dist/launcher.js +0 -38
  236. package/dist/local-media.d.ts +0 -2
  237. package/dist/local-media.js +0 -30
  238. package/dist/network-error.d.ts +0 -3
  239. package/dist/network-error.js +0 -22
  240. package/dist/output.d.ts +0 -46
  241. package/dist/output.js +0 -244
  242. package/dist/runtime/archive-store.d.ts +0 -54
  243. package/dist/runtime/archive-store.js +0 -379
  244. package/dist/runtime/cli-path.d.ts +0 -5
  245. package/dist/runtime/cli-path.js +0 -27
  246. package/dist/runtime/codex-usage.d.ts +0 -7
  247. package/dist/runtime/codex-usage.js +0 -11
  248. package/dist/runtime/connection.d.ts +0 -42
  249. package/dist/runtime/connection.js +0 -789
  250. package/dist/runtime/diagnostics.d.ts +0 -107
  251. package/dist/runtime/diagnostics.js +0 -392
  252. package/dist/runtime/harnesses/chained-projection.d.ts +0 -40
  253. package/dist/runtime/harnesses/chained-projection.js +0 -95
  254. package/dist/runtime/harnesses/chained-transcript.d.ts +0 -24
  255. package/dist/runtime/harnesses/chained-transcript.js +0 -62
  256. package/dist/runtime/harnesses/claude-approval.d.ts +0 -34
  257. package/dist/runtime/harnesses/claude-approval.js +0 -124
  258. package/dist/runtime/harnesses/claude-transcript.d.ts +0 -8
  259. package/dist/runtime/harnesses/claude-transcript.js +0 -138
  260. package/dist/runtime/harnesses/claude.d.ts +0 -8
  261. package/dist/runtime/harnesses/claude.js +0 -225
  262. package/dist/runtime/harnesses/codex-approval.d.ts +0 -25
  263. package/dist/runtime/harnesses/codex-approval.js +0 -69
  264. package/dist/runtime/harnesses/codex.d.ts +0 -4
  265. package/dist/runtime/harnesses/codex.js +0 -269
  266. package/dist/runtime/harnesses/cursor-transcript.d.ts +0 -37
  267. package/dist/runtime/harnesses/cursor-transcript.js +0 -183
  268. package/dist/runtime/harnesses/cursor.d.ts +0 -24
  269. package/dist/runtime/harnesses/cursor.js +0 -620
  270. package/dist/runtime/harnesses/index.d.ts +0 -16
  271. package/dist/runtime/harnesses/index.js +0 -73
  272. package/dist/runtime/harnesses/pi.d.ts +0 -4
  273. package/dist/runtime/harnesses/pi.js +0 -247
  274. package/dist/runtime/harnesses/process.d.ts +0 -31
  275. package/dist/runtime/harnesses/process.js +0 -75
  276. package/dist/runtime/harnesses/stream-json.d.ts +0 -48
  277. package/dist/runtime/harnesses/stream-json.js +0 -336
  278. package/dist/runtime/harnesses/types.d.ts +0 -117
  279. package/dist/runtime/harnesses/types.js +0 -1
  280. package/dist/runtime/harnesses/workbuddy-transcript.d.ts +0 -8
  281. package/dist/runtime/harnesses/workbuddy-transcript.js +0 -127
  282. package/dist/runtime/harnesses/workbuddy.d.ts +0 -21
  283. package/dist/runtime/harnesses/workbuddy.js +0 -123
  284. package/dist/runtime/instance.d.ts +0 -20
  285. package/dist/runtime/instance.js +0 -247
  286. package/dist/runtime/json-rpc.d.ts +0 -53
  287. package/dist/runtime/json-rpc.js +0 -212
  288. package/dist/runtime/launch.d.ts +0 -25
  289. package/dist/runtime/launch.js +0 -247
  290. package/dist/runtime/local-workspace.d.ts +0 -15
  291. package/dist/runtime/local-workspace.js +0 -52
  292. package/dist/runtime/model-catalog.d.ts +0 -12
  293. package/dist/runtime/model-catalog.js +0 -84
  294. package/dist/runtime/native/adapters.d.ts +0 -15
  295. package/dist/runtime/native/adapters.js +0 -11
  296. package/dist/runtime/native/approvals.d.ts +0 -18
  297. package/dist/runtime/native/approvals.js +0 -54
  298. package/dist/runtime/native/archive.d.ts +0 -19
  299. package/dist/runtime/native/archive.js +0 -142
  300. package/dist/runtime/native/attach.d.ts +0 -36
  301. package/dist/runtime/native/attach.js +0 -128
  302. package/dist/runtime/native/codex-link.d.ts +0 -60
  303. package/dist/runtime/native/codex-link.js +0 -322
  304. package/dist/runtime/native/config.d.ts +0 -16
  305. package/dist/runtime/native/config.js +0 -24
  306. package/dist/runtime/native/daemon.d.ts +0 -92
  307. package/dist/runtime/native/daemon.js +0 -380
  308. package/dist/runtime/native/execution.d.ts +0 -26
  309. package/dist/runtime/native/execution.js +0 -34
  310. package/dist/runtime/native/identity.d.ts +0 -9
  311. package/dist/runtime/native/identity.js +0 -15
  312. package/dist/runtime/native/ingest.d.ts +0 -263
  313. package/dist/runtime/native/ingest.js +0 -884
  314. package/dist/runtime/native/install.d.ts +0 -9
  315. package/dist/runtime/native/install.js +0 -113
  316. package/dist/runtime/native/paths.d.ts +0 -2
  317. package/dist/runtime/native/paths.js +0 -7
  318. package/dist/runtime/native/pi-extension.d.ts +0 -36
  319. package/dist/runtime/native/pi-link.d.ts +0 -69
  320. package/dist/runtime/native/pi-link.js +0 -269
  321. package/dist/runtime/native/results.d.ts +0 -41
  322. package/dist/runtime/native/results.js +0 -128
  323. package/dist/runtime/native/sessions.d.ts +0 -45
  324. package/dist/runtime/native/sessions.js +0 -87
  325. package/dist/runtime/native/transcript.d.ts +0 -89
  326. package/dist/runtime/native/transcript.js +0 -656
  327. package/dist/runtime/native/translate.d.ts +0 -46
  328. package/dist/runtime/native/translate.js +0 -299
  329. package/dist/runtime/native/transport.d.ts +0 -7
  330. package/dist/runtime/native/transport.js +0 -16
  331. package/dist/runtime/native/version.d.ts +0 -5
  332. package/dist/runtime/native/version.js +0 -21
  333. package/dist/runtime/preferences.d.ts +0 -7
  334. package/dist/runtime/preferences.js +0 -22
  335. package/dist/runtime/presentation.d.ts +0 -32
  336. package/dist/runtime/presentation.js +0 -124
  337. package/dist/runtime/process-group.d.ts +0 -5
  338. package/dist/runtime/process-group.js +0 -161
  339. package/dist/runtime/projection-store.d.ts +0 -27
  340. package/dist/runtime/projection-store.js +0 -30
  341. package/dist/runtime/space-binding.d.ts +0 -48
  342. package/dist/runtime/space-binding.js +0 -342
  343. package/dist/runtime/supervisor.d.ts +0 -19
  344. package/dist/runtime/supervisor.js +0 -441
  345. package/dist/runtime/turn-projection.d.ts +0 -41
  346. package/dist/runtime/turn-projection.js +0 -120
  347. package/dist/runtime/worker.d.ts +0 -1
  348. package/dist/safe-remote-image.d.ts +0 -36
  349. package/dist/safe-remote-image.js +0 -191
  350. package/dist/self-update.d.ts +0 -7
  351. package/dist/self-update.js +0 -202
  352. package/dist/session-status.d.ts +0 -10
  353. package/dist/session-status.js +0 -25
  354. package/dist/space-files/limit.d.ts +0 -2
  355. package/dist/space-files/limit.js +0 -16
  356. package/dist/space-files/operands.d.ts +0 -17
  357. package/dist/space-files/operands.js +0 -33
  358. package/dist/space-files/transfer.d.ts +0 -53
  359. package/dist/space-files/transfer.js +0 -297
  360. package/dist/space-files/upload.d.ts +0 -17
  361. package/dist/space-files/upload.js +0 -76
  362. package/dist/space.d.ts +0 -44
  363. package/dist/space.js +0 -192
  364. package/dist/version.d.ts +0 -2
  365. package/dist/version.js +0 -17
  366. package/dist/web.d.ts +0 -1
  367. package/dist/web.js +0 -4
  368. /package/dist/{board-kernel → chunks}/lexer.js +0 -0
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerChannels(program: Command): void;
@@ -1,74 +0,0 @@
1
- import { createClient } from "../client.js";
2
- import { table, json as outJson, jsonRequested, ok, error, handleHttp } from "../output.js";
3
- export function registerChannels(program) {
4
- const cmd = program.command("channels", { hidden: true }).description("Channel integrations");
5
- cmd
6
- .command("ls")
7
- .alias("list")
8
- .description("List channels")
9
- .option("--json", "Output as JSON")
10
- .action(async (opts) => {
11
- const client = createClient();
12
- try {
13
- const items = await client.channels.list();
14
- if (jsonRequested(opts))
15
- return outJson(items);
16
- if (items.length === 0)
17
- return console.log(" (empty)");
18
- table(items, [
19
- { key: "id", label: "ID" },
20
- { key: "provider", label: "Provider" },
21
- { key: "name", label: "Name" },
22
- { key: "status", label: "Status" },
23
- ]);
24
- }
25
- catch (e) {
26
- handleHttp(e);
27
- }
28
- });
29
- cmd
30
- .command("create")
31
- .description("Create a channel")
32
- .requiredOption("-p, --provider <provider>", "Channel provider")
33
- .requiredOption("-n, --name <name>", "Channel name")
34
- .option("--credentials <json>", "Credentials as JSON string")
35
- .option("--json", "Output as JSON")
36
- .action(async (opts) => {
37
- let credentials = {};
38
- if (opts.credentials) {
39
- try {
40
- credentials = JSON.parse(opts.credentials);
41
- }
42
- catch {
43
- return error("Invalid JSON", "--credentials must be valid JSON");
44
- }
45
- }
46
- const client = createClient();
47
- try {
48
- const result = await client.channels.create({
49
- provider: opts.provider,
50
- name: opts.name,
51
- credentials,
52
- });
53
- if (jsonRequested(opts))
54
- return outJson(result);
55
- ok("Channel created");
56
- }
57
- catch (e) {
58
- handleHttp(e);
59
- }
60
- });
61
- cmd
62
- .command("delete <id>")
63
- .description("Delete a channel")
64
- .action(async (id) => {
65
- const client = createClient();
66
- try {
67
- await client.channels.delete(id);
68
- ok(`Channel deleted: ${id}`);
69
- }
70
- catch (e) {
71
- handleHttp(e);
72
- }
73
- });
74
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerCronJobs(program: Command): void;
@@ -1,155 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { createClient } from "../client.js";
3
- import { table, json as outJson, jsonRequested, ok, error, handleHttp } from "../output.js";
4
- function readJsonObject(pathOrJson) {
5
- const raw = pathOrJson.trim().startsWith("{") ? pathOrJson : readFileSync(pathOrJson, "utf8");
6
- const parsed = JSON.parse(raw);
7
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
8
- error("Invalid payload", "Expected a JSON object");
9
- return parsed;
10
- }
11
- export function registerCronJobs(program) {
12
- const cmd = program.command("cron-jobs").description("Scheduled jobs");
13
- cmd
14
- .command("ls [spaceId]")
15
- .alias("list")
16
- .description("List scheduled jobs")
17
- .option("--json", "Output as JSON")
18
- .action(async (spaceId, opts) => {
19
- const client = createClient();
20
- try {
21
- const result = await client.cronJobs.list(spaceId);
22
- if (jsonRequested(opts))
23
- return outJson(result);
24
- if (result.jobs.length === 0)
25
- return console.log(" (empty)");
26
- table(result.jobs, [
27
- { key: "id", label: "ID" },
28
- { key: "title", label: "Title" },
29
- { key: "taskType", label: "Type" },
30
- { key: "cronExpression", label: "Schedule" },
31
- { key: "enabled", label: "Enabled" },
32
- { key: "spaceId", label: "Space" },
33
- ]);
34
- }
35
- catch (e) {
36
- handleHttp(e);
37
- }
38
- });
39
- cmd
40
- .command("get <id>")
41
- .description("Show scheduled job")
42
- .option("--json", "Output as JSON")
43
- .action(async (id, opts) => {
44
- const client = createClient();
45
- try {
46
- const result = await client.cronJobs.get(id);
47
- if (jsonRequested(opts))
48
- return outJson(result);
49
- table([result.job], [
50
- { key: "id", label: "ID" },
51
- { key: "title", label: "Title" },
52
- { key: "taskType", label: "Type" },
53
- { key: "cronExpression", label: "Schedule" },
54
- { key: "timezone", label: "Timezone" },
55
- { key: "enabled", label: "Enabled" },
56
- { key: "spaceId", label: "Space" },
57
- ]);
58
- }
59
- catch (e) {
60
- handleHttp(e);
61
- }
62
- });
63
- cmd
64
- .command("update <id>")
65
- .description("Update scheduled job")
66
- .option("--title <title>", "Update title")
67
- .option("--cron <expression>", "Update cron expression")
68
- .option("--timezone <timezone>", "Update timezone")
69
- .option("--payload <jsonOrPath>", "Update payload from JSON string or file")
70
- .option("--json", "Output as JSON")
71
- .action(async (id, opts) => {
72
- const client = createClient();
73
- try {
74
- const patch = {};
75
- if (opts.title !== undefined)
76
- patch.title = opts.title;
77
- if (opts.cron !== undefined)
78
- patch.cronExpression = opts.cron;
79
- if (opts.timezone !== undefined)
80
- patch.timezone = opts.timezone;
81
- if (opts.payload !== undefined)
82
- patch.payload = readJsonObject(opts.payload);
83
- if (Object.keys(patch).length === 0)
84
- error("No changes provided", "Use --title, --cron, --timezone, or --payload");
85
- const result = await client.cronJobs.update(id, patch);
86
- if (jsonRequested(opts))
87
- return outJson(result);
88
- ok(`Cron job updated: ${result.job.id}`);
89
- }
90
- catch (e) {
91
- if (e instanceof Error && /ENOENT|Unexpected token|JSON/.test(e.message)) {
92
- error("Invalid payload", e.message);
93
- }
94
- handleHttp(e);
95
- }
96
- });
97
- cmd
98
- .command("delete <id>")
99
- .description("Delete scheduled job")
100
- .action(async (id) => {
101
- const client = createClient();
102
- try {
103
- await client.cronJobs.delete(id);
104
- ok(`Cron job deleted: ${id}`);
105
- }
106
- catch (e) {
107
- handleHttp(e);
108
- }
109
- });
110
- cmd
111
- .command("toggle <id> <on|off>")
112
- .description("Enable or pause scheduled job")
113
- .action(async (id, state) => {
114
- if (state !== "on" && state !== "off")
115
- return error("Invalid state", "Use on or off");
116
- const enabled = state === "on";
117
- const client = createClient();
118
- try {
119
- await client.cronJobs.toggle(id, enabled);
120
- ok(`Cron job ${enabled ? "enabled" : "disabled"}: ${id}`);
121
- }
122
- catch (e) {
123
- handleHttp(e);
124
- }
125
- });
126
- cmd
127
- .command("runs <id>")
128
- .description("List scheduled job runs")
129
- .option("--limit <limit>", "Page size", "20")
130
- .option("--cursor <cursor>", "Pagination cursor")
131
- .option("--json", "Output as JSON")
132
- .action(async (id, opts) => {
133
- const client = createClient();
134
- const limit = Number(opts.limit ?? 20);
135
- try {
136
- const result = await client.cronJobs.runs(id, { limit: Number.isFinite(limit) ? limit : 20, cursor: opts.cursor });
137
- if (jsonRequested(opts))
138
- return outJson(result);
139
- if (result.runs.length === 0)
140
- return console.log(" (empty)");
141
- table(result.runs, [
142
- { key: "id", label: "ID" },
143
- { key: "status", label: "Status" },
144
- { key: "scheduledAt", label: "Scheduled" },
145
- { key: "startedAt", label: "Started" },
146
- { key: "finishedAt", label: "Finished" },
147
- ]);
148
- if (result.pageInfo.hasMore && result.pageInfo.nextCursor)
149
- console.log(`\nNext cursor: ${result.pageInfo.nextCursor}`);
150
- }
151
- catch (e) {
152
- handleHttp(e);
153
- }
154
- });
155
- }
@@ -1,4 +0,0 @@
1
- import type { DecisionStateImage } from "@neta-art/cohub";
2
- import type { Command } from "commander";
3
- export declare function mergeDecisionState(state: unknown, text: string, images: DecisionStateImage[]): unknown;
4
- export declare function registerDecisionCommand(parent: Command): void;
@@ -1,113 +0,0 @@
1
- import { readFile } from "node:fs/promises";
2
- import { uploadChatImageAsset } from "../avatar.js";
3
- import { createClient } from "../client.js";
4
- import { collectOption, readPromptContent } from "../command-input.js";
5
- import { error, handleHttp, json as outJson, jsonRequested, table } from "../output.js";
6
- import { resolveSpace } from "../space.js";
7
- const REMOTE_URL = /^https?:\/\//i;
8
- async function readJsonObject(source, label) {
9
- const text = source.trim().startsWith("{")
10
- ? source
11
- : await readFile(source, "utf-8").catch(() => error(`Cannot read ${label}`, source));
12
- let value;
13
- try {
14
- value = JSON.parse(text);
15
- }
16
- catch {
17
- return error(`Invalid ${label}`, "Expected a JSON object or a path to a JSON file");
18
- }
19
- if (!value || typeof value !== "object" || Array.isArray(value)) {
20
- return error(`Invalid ${label}`, "Expected a JSON object");
21
- }
22
- return value;
23
- }
24
- export function mergeDecisionState(state, text, images) {
25
- if (!text && images.length === 0)
26
- return state;
27
- if (state !== undefined && typeof state !== "string" && !Array.isArray(state)) {
28
- throw new Error("Cannot combine a JSON object state with text or --image; use a text/image array in --input instead.");
29
- }
30
- const parts = [
31
- ...(Array.isArray(state) ? state : typeof state === "string" ? [state] : []),
32
- ...(text ? [text] : []),
33
- ...images,
34
- ];
35
- return parts.length === 1 && typeof parts[0] === "string" ? parts[0] : parts;
36
- }
37
- function formatAnswer(answer) {
38
- if (answer.type === "noul")
39
- return (answer.noul ?? 0).toFixed(2);
40
- if (answer.type === "choice")
41
- return answer.choice ?? "";
42
- const top = Object.entries(answer.probabilities ?? {}).sort(([, a], [, b]) => b - a)[0]?.[0];
43
- const label = top === undefined ? undefined : answer.legend?.[top];
44
- return `${(answer.score ?? 0).toFixed(2)}${label ? ` ${label}` : ""}`;
45
- }
46
- function printResult(result) {
47
- table(Object.entries(result.answers).map(([key, answer]) => ({
48
- question: key,
49
- type: answer.type,
50
- answer: formatAnswer(answer),
51
- confidence: answer.confidence,
52
- })), [
53
- { key: "question", label: "QUESTION" },
54
- { key: "type", label: "TYPE" },
55
- { key: "answer", label: "ANSWER" },
56
- { key: "confidence", label: "CONFIDENCE", format: (value) => (typeof value === "number" ? value.toFixed(2) : "") },
57
- ]);
58
- const cost = result.usage.cost?.total;
59
- process.stderr.write(`\n ${result.provider}/${result.model}${typeof cost === "number" ? ` cost: $${cost}` : ""}\n`);
60
- }
61
- async function runDecisionCommand(command, words, opts) {
62
- const base = opts.input ? await readJsonObject(opts.input, "input") : {};
63
- const questions = opts.questions ? await readJsonObject(opts.questions, "questions") : base.questions;
64
- if (!questions)
65
- return error("Questions required", "Pass --questions or --input");
66
- const spaceId = await resolveSpace(command, { home: true });
67
- const client = createClient();
68
- try {
69
- const images = opts.image ?? [];
70
- const text = words.length > 0 || base.state === undefined
71
- ? await readPromptContent(words, { allowEmpty: images.length > 0 })
72
- : "";
73
- const imageParts = images.map((url) => ({ type: "image_url", image_url: { url } }));
74
- const state = mergeDecisionState(base.state, text, imageParts);
75
- await Promise.all(imageParts.map(async (part) => {
76
- if (!REMOTE_URL.test(part.image_url.url)) {
77
- part.image_url.url = (await uploadChatImageAsset({ client, spaceId, path: part.image_url.url })).publicUrl;
78
- }
79
- }));
80
- const input = {
81
- ...base,
82
- provider: opts.provider ?? base.provider,
83
- model: opts.model ?? base.model,
84
- state,
85
- questions,
86
- };
87
- const result = await client.space(spaceId).decision(input);
88
- if (jsonRequested(opts))
89
- return outJson(result);
90
- printResult(result);
91
- }
92
- catch (e) {
93
- handleHttp(e);
94
- }
95
- }
96
- export function registerDecisionCommand(parent) {
97
- parent
98
- .command("decision [state...]")
99
- .description("Answer yes/no, choice and score questions about text or images")
100
- .option("-q, --questions <json|path>", "Questions as inline JSON or a JSON file")
101
- .option("--input <path>", "Full request JSON file (state, questions, model)")
102
- .option("--image <path-or-url>", "Attach an image to the state", collectOption, [])
103
- .option("-m, --model <model>", "Decision model ID")
104
- .option("-p, --provider <provider>", "Provider name")
105
- .option("--json", "Output as JSON")
106
- .addHelpText("after", `
107
- Examples:
108
- cohub decision "I was charged twice" -q '{"refund":{"type":"noul","instructions":"Refund?"}}'
109
- cat ticket.txt | cohub decision -q questions.json --json
110
- cohub decision "Duplicate charge?" --image receipt.png -q questions.json
111
- cohub decision --input request.json`)
112
- .action((words, opts) => runDecisionCommand(parent, words, opts));
113
- }
@@ -1,10 +0,0 @@
1
- import { resolveOpenSurface } from "@neta-art/cohub";
2
- import type { Command } from "commander";
3
- export { resolveOpenSurface };
4
- /** Never falls back to Home, so a plain target stays eligible for App resolution. */
5
- export declare function resolveOptionalSpaceId(command: Command, options?: {
6
- cwd?: string;
7
- bindingsPath?: string;
8
- }): Promise<string | undefined>;
9
- export declare function registerDesktop(program: Command): void;
10
- export declare function registerLegacyUi(program: Command): void;
@@ -1,233 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { HttpError, parseAppRef, resolveOpenSurface, DESKTOP_COMMAND_ACCEPT_TIMEOUT_MS, DESKTOP_COMMAND_DEFAULT_TIMEOUT_MS, DESKTOP_COMMAND_MAX_TIMEOUT_MS, DESKTOP_COMMAND_OPEN_TIMEOUT_MS, } from "@neta-art/cohub";
3
- import { createClient } from "../client.js";
4
- import { error, handleHttp, json as outJson, jsonRequested, ok } from "../output.js";
5
- import { explicitSpace, failSpaceTarget, resolveBoundSpace, resolveSpaceRef } from "../space.js";
6
- import { getAppByRef } from "../app-ref.js";
7
- export { resolveOpenSurface };
8
- const FILE_SCHEME = "file://";
9
- const APP_SCHEME = "app://";
10
- const LEGACY_WORK_SCHEME = "work://";
11
- /** Never falls back to Home, so a plain target stays eligible for App resolution. */
12
- export async function resolveOptionalSpaceId(command, options = {}) {
13
- const explicit = explicitSpace(command);
14
- if (explicit)
15
- return resolveSpaceRef(explicit).catch(failSpaceTarget);
16
- return (await resolveBoundSpace(options)) ?? undefined;
17
- }
18
- function parseFilePath(value) {
19
- const path = value.slice(FILE_SCHEME.length).trim();
20
- if (!path ||
21
- path.startsWith("/") ||
22
- path.includes("\0") ||
23
- path.split("/").some((segment) => segment === "..") ||
24
- path.includes("\\")) {
25
- return error("Invalid file path", "Use a relative Space path after file://.");
26
- }
27
- return path;
28
- }
29
- function hasFileScheme(value) {
30
- return value.toLowerCase().startsWith(FILE_SCHEME);
31
- }
32
- function hasAppScheme(value) {
33
- const lowered = value.toLowerCase();
34
- return lowered.startsWith(APP_SCHEME) || lowered.startsWith(LEGACY_WORK_SCHEME);
35
- }
36
- function readCallInput(opts) {
37
- if (opts.data !== undefined && opts.input !== undefined) {
38
- return error("Conflicting input", "Use either --data or --input, not both.");
39
- }
40
- const raw = opts.data !== undefined
41
- ? opts.data
42
- : opts.input !== undefined
43
- ? opts.input === "-"
44
- ? readFileSync(0, "utf-8")
45
- : readFileSync(opts.input, "utf-8")
46
- : undefined;
47
- if (raw === undefined)
48
- return undefined;
49
- try {
50
- return JSON.parse(raw);
51
- }
52
- catch {
53
- return error("Invalid input", "Call input must be valid JSON.");
54
- }
55
- }
56
- function parseTimeout(value) {
57
- if (!value)
58
- return undefined;
59
- const parsed = Math.floor(Number(value));
60
- if (!Number.isFinite(parsed) || parsed <= 0 || parsed > DESKTOP_COMMAND_MAX_TIMEOUT_MS) {
61
- return error("Invalid timeout", `--timeout-ms must be between 1 and ${DESKTOP_COMMAND_MAX_TIMEOUT_MS} milliseconds.`);
62
- }
63
- return parsed;
64
- }
65
- async function resolveAppTarget(client, ref) {
66
- const normalized = hasAppScheme(ref) ? ref.replace(/^[a-zA-Z]+:\/\//, "") : ref;
67
- const parsed = parseAppRef(normalized);
68
- const detail = await getAppByRef(client, normalized);
69
- const declared = detail.app.meta?.presentation?.surface;
70
- return {
71
- kind: "app",
72
- appId: detail.app.id,
73
- label: detail.app.slug,
74
- launch: {
75
- ...(parsed.search ? { search: parsed.search } : {}),
76
- ...(parsed.hash ? { hash: parsed.hash } : {}),
77
- },
78
- ...(declared === "overlay" || declared === "window" ? { surface: declared } : {}),
79
- };
80
- }
81
- async function resolveOpenTarget(client, command, value) {
82
- if (hasFileScheme(value))
83
- return { kind: "file", path: parseFilePath(value) };
84
- if (hasAppScheme(value))
85
- return resolveAppTarget(client, value);
86
- const spaceId = await resolveOptionalSpaceId(command);
87
- if (spaceId) {
88
- try {
89
- await client.space(spaceId).files.read(value);
90
- return { kind: "file", path: value };
91
- }
92
- catch (cause) {
93
- if (!(cause instanceof HttpError) || cause.status !== 404)
94
- throw cause;
95
- }
96
- }
97
- return resolveAppTarget(client, value);
98
- }
99
- function reportDispatch(record) {
100
- if (record.status !== "pending") {
101
- reportOutcome(record, Boolean(record.command.call));
102
- return;
103
- }
104
- ok(`Desktop command dispatched (${record.commandId})`);
105
- }
106
- function reportOutcome(record, called) {
107
- if (record.status === "applied") {
108
- ok(called ? "App window shown and method called" : "Window shown");
109
- if (record.result !== undefined) {
110
- console.log(typeof record.result === "string" ? record.result : JSON.stringify(record.result, null, 2));
111
- }
112
- return;
113
- }
114
- error(`Desktop command ${record.status}`, record.error?.message ?? "The Cohub desktop did not apply this command.");
115
- }
116
- async function openWindow(target, opts, command) {
117
- const callInput = opts.call ? readCallInput(opts) : undefined;
118
- if (!opts.call && (opts.data !== undefined || opts.input !== undefined)) {
119
- return error("Missing --call", "--data and --input only apply together with --call.");
120
- }
121
- if (opts.noWait && opts.timeoutMs !== undefined) {
122
- return error("Conflicting wait options", "Use either --no-wait or --timeout-ms, not both.");
123
- }
124
- if (opts.as !== undefined && opts.as !== "window" && opts.as !== "overlay") {
125
- return error("Invalid surface", "--as must be one of: window, overlay.");
126
- }
127
- const timeoutMs = parseTimeout(opts.timeoutMs);
128
- const client = createClient();
129
- try {
130
- const resolved = await resolveOpenTarget(client, command, target);
131
- if (resolved.kind === "file" && opts.call) {
132
- return error("Unsupported option", "--call only applies to app targets.");
133
- }
134
- if (resolved.kind === "file" && opts.as) {
135
- return error("Unsupported option", "--as only applies to app targets.");
136
- }
137
- const call = opts.call
138
- ? { method: opts.call, ...(callInput === undefined ? {} : { input: callInput }) }
139
- : undefined;
140
- const input = {
141
- command: {
142
- type: "desktop.open",
143
- target: resolved.kind === "file"
144
- ? resolved
145
- : {
146
- kind: "app",
147
- appId: resolved.appId,
148
- label: resolved.label,
149
- ...(resolved.launch.search || resolved.launch.hash ? { launch: resolved.launch } : {}),
150
- ...(resolveOpenSurface(opts.as, resolved.surface) ? { surface: "overlay" } : {}),
151
- },
152
- ...(call ? { call } : {}),
153
- },
154
- ...(opts.client ? { targetClientId: opts.client } : {}),
155
- ...(opts.commandId ? { commandId: opts.commandId } : {}),
156
- };
157
- const record = opts.noWait
158
- ? (await client.desktop.create(input)).command
159
- : await client.desktop.run(input, { timeoutMs });
160
- if (jsonRequested(opts))
161
- return outJson(record);
162
- if (opts.noWait)
163
- return reportDispatch(record);
164
- reportOutcome(record, Boolean(call));
165
- }
166
- catch (e) {
167
- if (e instanceof Error && e.name === "AppRefParseError")
168
- return error(e.message);
169
- handleHttp(e);
170
- }
171
- }
172
- const OPEN_HELP = `
173
- Commands reach only the desktop that originated the current chat, resolved
174
- from request provenance. Nothing else can be targeted.
175
-
176
- Examples:
177
- cohub desktop open <app-or-file>
178
- cohub desktop open file://src/main.ts
179
- cohub desktop open app://alice/studio/launch
180
- cohub desktop open alice/studio/launch
181
- cohub desktop open https://cohub.live/alice/studio/w/launch?view=timeline
182
- cohub desktop open <app-id> --as overlay
183
- cohub desktop open <app-id> --call selection.get
184
- cohub desktop open <app-id> --call board.focus --data '{"nodeId":"n1"}'
185
- `;
186
- const OPEN_NOTES = `
187
- Notes:
188
- - Use file:// and app:// to make the target explicit; the legacy work://
189
- scheme is still accepted.
190
- - A plain target checks the explicit Space or current directory Runtime binding for a file before resolving an app; it does not fall back to Home.
191
- - Opening a window is idempotent; repeating it re-activates the same tab.
192
- - A desktop that does not respond within ${DESKTOP_COMMAND_ACCEPT_TIMEOUT_MS / 1_000} seconds (closed, asleep, or
193
- offline) fails fast with no_active_client instead of waiting out the timeout.
194
- - --as picks the surface: window (a preview tab) or overlay (a transparent
195
- layer above the workspace). Without it, an App published with
196
- <meta name="cohub:surface" content="overlay"> opens as an overlay.
197
- - --call waits for the app to announce readiness, then invokes the method.
198
- - Which methods exist is up to the app author.
199
- `;
200
- function registerOpen(parent, deprecated) {
201
- const open = parent
202
- .command(deprecated ? "preview <app-or-file>" : "open <app-or-file>")
203
- .description(deprecated ? "Deprecated: use `cohub desktop open`" : "Open a file or app window on the Cohub desktop, optionally calling an app method")
204
- .option("--call <method>", "Method the app registered via client.app.surface.handle()")
205
- .option("--data <json>", "Inline JSON input for --call")
206
- .option("-i, --input <file>", "JSON input file for --call; use - for stdin")
207
- .option("--client <clientId>", "Target a specific desktop instance of your account")
208
- .option("--command-id <id>", "Stable id so retries never dispatch twice")
209
- .option("--no-wait", "Dispatch the command and exit without waiting for a result")
210
- .option("--as <surface>", "Surface role for app targets: window (default) or overlay")
211
- .option("--timeout-ms <ms>", `How long to wait for the desktop (default: ${DESKTOP_COMMAND_OPEN_TIMEOUT_MS}, or ${DESKTOP_COMMAND_DEFAULT_TIMEOUT_MS} with --call; max: ${DESKTOP_COMMAND_MAX_TIMEOUT_MS})`)
212
- .option("--json", "Output as JSON")
213
- .action(async (target, opts, thisCommand) => {
214
- if (deprecated) {
215
- ok("Deprecated: `cohub ui preview` is now `cohub desktop open`.");
216
- }
217
- await openWindow(target, opts, thisCommand);
218
- });
219
- open.addHelpText("after", deprecated ? OPEN_NOTES : OPEN_HELP + OPEN_NOTES);
220
- }
221
- export function registerDesktop(program) {
222
- const desktop = program
223
- .command("desktop")
224
- .description("Drive the Cohub desktop that started this chat");
225
- registerOpen(desktop, false);
226
- }
227
- export function registerLegacyUi(program) {
228
- const ui = program
229
- .command("ui", { hidden: true })
230
- .description("Deprecated: use `cohub desktop open`")
231
- .addHelpText("after", OPEN_HELP);
232
- registerOpen(ui, true);
233
- }
@@ -1,2 +0,0 @@
1
- import type { Command } from "commander";
2
- export declare function registerFeedback(program: Command): void;