@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.
- package/README.md +6 -0
- package/dist/board-export-resources.d.ts +2 -0
- package/dist/board-export-resources.js +1 -0
- package/dist/board-export.d.ts +11 -2
- package/dist/board-export.js +181 -62
- package/dist/board-gpu/index.d.ts +32 -0
- package/dist/board-gpu/index.js +188 -0
- package/dist/board-gpu/page.js +70384 -0
- package/dist/board-gpu/protocol.d.ts +38 -0
- package/dist/board-gpu/protocol.js +1 -0
- package/dist/board-kernel/{getPo2TextureFromSource.js → FilterPipe.js} +251 -1
- package/dist/board-kernel/browserAll.js +1 -1
- package/dist/board-kernel/init.js +1 -251
- package/dist/board-kernel/webworkerAll.js +1 -1
- package/dist/board-kernel.d.ts +3 -3
- package/dist/board-kernel.js +6501 -414
- package/dist/board-media-export.d.ts +16 -0
- package/dist/board-media-export.js +147 -0
- package/dist/board-media.d.ts +2 -1
- package/dist/board-media.js +23 -0
- package/dist/board-simulate.d.ts +4 -0
- package/dist/board-simulate.js +34 -4
- package/dist/client.d.ts +1 -0
- package/dist/client.js +4 -1
- package/dist/commands/apps.js +25 -3
- package/dist/commands/boards/authoring.js +45 -3
- package/dist/commands/boards/examples.js +21 -5
- package/dist/commands/boards.js +10 -2
- package/dist/commands/space-displays.d.ts +1 -1
- package/dist/commands/space-displays.js +356 -85
- package/dist/commands/spaces.js +11 -2
- package/dist/host/runtime.d.ts +12 -2
- package/dist/host/runtime.js +155 -10
- package/dist/host/serve.js +49 -11
- package/dist/host/workspaces.d.ts +2 -0
- package/dist/host/workspaces.js +18 -0
- package/dist/index.js +1 -0
- package/dist/output.d.ts +1 -0
- package/dist/output.js +3 -0
- package/dist/runtime/cli-path.d.ts +5 -0
- package/dist/runtime/cli-path.js +27 -0
- package/dist/runtime/connection.d.ts +22 -4
- package/dist/runtime/connection.js +13 -3
- package/dist/runtime/harnesses/claude-approval.d.ts +31 -0
- package/dist/runtime/harnesses/claude-approval.js +119 -0
- package/dist/runtime/harnesses/claude.js +42 -3
- package/dist/runtime/harnesses/codex-approval.d.ts +25 -0
- package/dist/runtime/harnesses/codex-approval.js +69 -0
- package/dist/runtime/harnesses/codex.js +36 -5
- package/dist/runtime/harnesses/index.js +12 -3
- package/dist/runtime/harnesses/stream-json.d.ts +16 -2
- package/dist/runtime/harnesses/stream-json.js +26 -6
- package/dist/runtime/harnesses/types.d.ts +3 -1
- package/dist/runtime/instance.d.ts +1 -0
- package/dist/runtime/instance.js +1 -0
- package/dist/runtime/launch.js +2 -4
- package/dist/runtime/local-workspace.d.ts +15 -0
- package/dist/runtime/local-workspace.js +52 -0
- package/dist/runtime/model-catalog.js +7 -4
- package/dist/runtime/native/approvals.d.ts +18 -0
- package/dist/runtime/native/approvals.js +54 -0
- package/dist/runtime/native/codex-link.d.ts +7 -0
- package/dist/runtime/native/codex-link.js +40 -5
- package/dist/runtime/native/daemon.d.ts +5 -1
- package/dist/runtime/native/daemon.js +6 -1
- package/dist/runtime/native/execution.d.ts +2 -0
- package/dist/runtime/preferences.d.ts +7 -0
- package/dist/runtime/preferences.js +22 -0
- package/dist/runtime/presentation.d.ts +3 -0
- package/dist/runtime/presentation.js +2 -1
- package/dist/runtime/supervisor.js +92 -9
- package/dist/safe-remote-image.d.ts +4 -0
- package/dist/safe-remote-image.js +8 -0
- package/dist/space-files/transfer.js +3 -2
- package/dist/space-files/upload.d.ts +5 -2
- package/dist/space-files/upload.js +41 -1
- 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 >
|
|
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
|
-
|
|
8
|
+
type UploadOptions = {
|
|
9
9
|
targetDir?: string;
|
|
10
10
|
onUploaded?: (entry: LocalUploadEntry) => void;
|
|
11
|
-
}
|
|
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 {
|
|
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.
|
|
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.
|
|
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",
|