@neta-art/cohub-cli 10.17.1 → 10.19.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 (77) hide show
  1. package/README.md +6 -0
  2. package/dist/board-export-resources.d.ts +2 -0
  3. package/dist/board-export-resources.js +1 -0
  4. package/dist/board-export.d.ts +11 -2
  5. package/dist/board-export.js +181 -62
  6. package/dist/board-gpu/index.d.ts +32 -0
  7. package/dist/board-gpu/index.js +188 -0
  8. package/dist/board-gpu/page.js +70384 -0
  9. package/dist/board-gpu/protocol.d.ts +38 -0
  10. package/dist/board-gpu/protocol.js +1 -0
  11. package/dist/board-kernel/{getPo2TextureFromSource.js → FilterPipe.js} +251 -1
  12. package/dist/board-kernel/browserAll.js +1 -1
  13. package/dist/board-kernel/init.js +1 -251
  14. package/dist/board-kernel/webworkerAll.js +1 -1
  15. package/dist/board-kernel.d.ts +3 -3
  16. package/dist/board-kernel.js +6501 -414
  17. package/dist/board-media-export.d.ts +16 -0
  18. package/dist/board-media-export.js +147 -0
  19. package/dist/board-media.d.ts +2 -1
  20. package/dist/board-media.js +23 -0
  21. package/dist/board-simulate.d.ts +4 -0
  22. package/dist/board-simulate.js +34 -4
  23. package/dist/client.d.ts +1 -0
  24. package/dist/client.js +4 -1
  25. package/dist/commands/apps.js +25 -3
  26. package/dist/commands/boards/authoring.js +45 -3
  27. package/dist/commands/boards/examples.js +21 -5
  28. package/dist/commands/boards.js +10 -2
  29. package/dist/commands/space-displays.d.ts +1 -1
  30. package/dist/commands/space-displays.js +356 -85
  31. package/dist/commands/spaces.js +11 -2
  32. package/dist/host/runtime.d.ts +12 -2
  33. package/dist/host/runtime.js +155 -10
  34. package/dist/host/serve.js +49 -11
  35. package/dist/host/workspaces.d.ts +2 -0
  36. package/dist/host/workspaces.js +18 -0
  37. package/dist/index.js +1 -0
  38. package/dist/output.d.ts +1 -0
  39. package/dist/output.js +3 -0
  40. package/dist/runtime/cli-path.d.ts +5 -0
  41. package/dist/runtime/cli-path.js +27 -0
  42. package/dist/runtime/connection.d.ts +22 -4
  43. package/dist/runtime/connection.js +13 -3
  44. package/dist/runtime/harnesses/claude-approval.d.ts +31 -0
  45. package/dist/runtime/harnesses/claude-approval.js +119 -0
  46. package/dist/runtime/harnesses/claude.js +42 -3
  47. package/dist/runtime/harnesses/codex-approval.d.ts +25 -0
  48. package/dist/runtime/harnesses/codex-approval.js +69 -0
  49. package/dist/runtime/harnesses/codex.js +36 -5
  50. package/dist/runtime/harnesses/index.js +12 -3
  51. package/dist/runtime/harnesses/stream-json.d.ts +16 -2
  52. package/dist/runtime/harnesses/stream-json.js +26 -6
  53. package/dist/runtime/harnesses/types.d.ts +3 -1
  54. package/dist/runtime/instance.d.ts +1 -0
  55. package/dist/runtime/instance.js +1 -0
  56. package/dist/runtime/launch.js +2 -4
  57. package/dist/runtime/local-workspace.d.ts +15 -0
  58. package/dist/runtime/local-workspace.js +52 -0
  59. package/dist/runtime/model-catalog.js +7 -4
  60. package/dist/runtime/native/approvals.d.ts +18 -0
  61. package/dist/runtime/native/approvals.js +54 -0
  62. package/dist/runtime/native/codex-link.d.ts +7 -0
  63. package/dist/runtime/native/codex-link.js +40 -5
  64. package/dist/runtime/native/daemon.d.ts +5 -1
  65. package/dist/runtime/native/daemon.js +6 -1
  66. package/dist/runtime/native/execution.d.ts +2 -0
  67. package/dist/runtime/preferences.d.ts +7 -0
  68. package/dist/runtime/preferences.js +22 -0
  69. package/dist/runtime/presentation.d.ts +3 -0
  70. package/dist/runtime/presentation.js +2 -1
  71. package/dist/runtime/supervisor.js +92 -9
  72. package/dist/safe-remote-image.d.ts +4 -0
  73. package/dist/safe-remote-image.js +8 -0
  74. package/dist/space-files/transfer.js +3 -2
  75. package/dist/space-files/upload.d.ts +5 -2
  76. package/dist/space-files/upload.js +41 -1
  77. package/package.json +2 -2
@@ -6,7 +6,7 @@ import { Readable } from "node:stream";
6
6
  import { pipeline } from "node:stream/promises";
7
7
  import { UPLOAD_MAX_FILE_BYTES } from "@neta-art/cohub";
8
8
  import { createLimiter } from "./limit.js";
9
- import { uploadLocalFiles } from "./upload.js";
9
+ import { uploadLocalFiles, uploadsDirectly } from "./upload.js";
10
10
  export class CopyAbortError extends Error {
11
11
  name = "CopyAbortError";
12
12
  }
@@ -106,6 +106,7 @@ export async function uploadToSpace(input) {
106
106
  for (const entry of node.tree.entries)
107
107
  existing.set(entry.path, entry.type);
108
108
  })));
109
+ const maxFileBytes = await uploadsDirectly(files) ? Number.POSITIVE_INFINITY : UPLOAD_MAX_FILE_BYTES;
109
110
  const upload = entries.filter((entry) => {
110
111
  const current = existing.get(entry.relativePath);
111
112
  if (current === "dir") {
@@ -120,7 +121,7 @@ export async function uploadToSpace(input) {
120
121
  fail(entry.relativePath, "name_invalid", `cannot upload '${entry.localPath}': unsupported file name`);
121
122
  return false;
122
123
  }
123
- if (entry.size > UPLOAD_MAX_FILE_BYTES) {
124
+ if (entry.size > maxFileBytes) {
124
125
  fail(entry.relativePath, "file_too_large", `cannot upload '${entry.localPath}': file exceeds the upload size limit`);
125
126
  return false;
126
127
  }
@@ -5,10 +5,13 @@ export type LocalUploadEntry = {
5
5
  relativePath: string;
6
6
  size: number;
7
7
  };
8
- export declare function uploadLocalFiles(files: SpaceFiles, entries: LocalUploadEntry[], options?: {
8
+ type UploadOptions = {
9
9
  targetDir?: string;
10
10
  onUploaded?: (entry: LocalUploadEntry) => void;
11
- }): Promise<{
11
+ };
12
+ export declare const uploadsDirectly: (files: SpaceFiles) => Promise<boolean>;
13
+ export declare function uploadLocalFiles(files: SpaceFiles, entries: LocalUploadEntry[], options?: UploadOptions): Promise<{
12
14
  uploaded: SpaceFsUploadEntry[];
13
15
  uploadIds: string[];
14
16
  }>;
17
+ export {};
@@ -1,9 +1,49 @@
1
1
  import { randomUUID } from "node:crypto";
2
- import { batchUploadEntries } from "@neta-art/cohub";
2
+ import { openAsBlob } from "node:fs";
3
+ import { posix } from "node:path";
4
+ import { batchUploadEntries, LocalWorkspaceUnavailableError, localWorkspaceHttpError, mimeTypeForPath, } from "@neta-art/cohub";
3
5
  import { putLocalFile } from "../http-put.js";
4
6
  import { createLimiter } from "./limit.js";
5
7
  const PUT_CONCURRENCY = 4;
8
+ export const uploadsDirectly = async (files) => Boolean((await files.workspace())?.put);
6
9
  export async function uploadLocalFiles(files, entries, options = {}) {
10
+ const workspace = await files.workspace();
11
+ if (!workspace?.put)
12
+ return uploadThroughApi(files, entries, options);
13
+ const { uploaded, remaining } = await putLocalFiles(workspace, workspace.put, entries, options);
14
+ if (!remaining.length)
15
+ return { uploaded, uploadIds: [] };
16
+ const rest = await uploadThroughApi(files, remaining, options);
17
+ return { uploaded: [...uploaded, ...rest.uploaded], uploadIds: rest.uploadIds };
18
+ }
19
+ async function putLocalFiles(workspace, put, entries, options) {
20
+ const limit = createLimiter(PUT_CONCURRENCY);
21
+ const uploaded = [];
22
+ const remaining = [];
23
+ const failures = [];
24
+ await Promise.all(entries.map((entry) => limit(async () => {
25
+ const path = options.targetDir ? posix.join(options.targetDir, entry.relativePath) : entry.relativePath;
26
+ try {
27
+ // As the API's uploads do: a file edited meanwhile is a conflict, never overwritten.
28
+ const version = await workspace.fs.statVersion(path);
29
+ const expected = version.exists ? { expected: { size: version.size, mtimeMs: version.mtimeMs } } : { exclusive: true };
30
+ const result = await put(path, await openAsBlob(entry.localPath), expected);
31
+ const name = posix.basename(path);
32
+ uploaded.push({ path, name, size: result.bytesWritten, mimeType: mimeTypeForPath(name), mtimeMs: result.mtimeMs ?? Date.now(), created: result.created });
33
+ options.onUploaded?.(entry);
34
+ }
35
+ catch (error) {
36
+ if (error instanceof LocalWorkspaceUnavailableError)
37
+ remaining.push(entry);
38
+ else
39
+ failures.push(error);
40
+ }
41
+ })));
42
+ if (failures.length)
43
+ throw localWorkspaceHttpError(failures[0]);
44
+ return { uploaded, remaining };
45
+ }
46
+ async function uploadThroughApi(files, entries, options) {
7
47
  const uploaded = [];
8
48
  const uploadIds = [];
9
49
  const limit = createLimiter(PUT_CONCURRENCY);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "10.17.1",
3
+ "version": "10.19.0",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -18,7 +18,7 @@
18
18
  "NOTICE"
19
19
  ],
20
20
  "dependencies": {
21
- "@neta-art/cohub": "13.8.0",
21
+ "@neta-art/cohub": "13.10.0",
22
22
  "@neta-art/generation": "0.2.15",
23
23
  "commander": "^15.0.0",
24
24
  "sharp": "^0.35.4",