@neta-art/cohub-cli 10.20.0 → 10.22.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 +1 -0
- package/dist/about.d.ts +2 -0
- package/dist/about.js +71 -0
- package/dist/board-export.d.ts +2 -0
- package/dist/board-export.js +37 -9
- package/dist/board-gpu/daemon.js +3 -10
- package/dist/board-gpu/index.js +1 -1
- package/dist/board-gpu/page.js +668 -188
- package/dist/board-gpu/protocol.d.ts +14 -0
- package/dist/board-kernel.d.ts +2 -2
- package/dist/board-kernel.js +832 -188
- package/dist/board-media-export.d.ts +1 -0
- package/dist/board-media-export.js +17 -0
- package/dist/board-profile.d.ts +3 -1
- package/dist/board-profile.js +14 -0
- package/dist/board-simulate.d.ts +9 -2
- package/dist/board-simulate.js +93 -35
- package/dist/build.json +1 -0
- package/dist/commands/boards.js +77 -7
- package/dist/commands/feedback.js +2 -0
- package/dist/commands/version.d.ts +2 -0
- package/dist/commands/version.js +21 -0
- package/dist/host/serve.js +9 -3
- package/dist/index.js +4 -11
- package/dist/runtime/connection.js +2 -0
- package/dist/runtime/harnesses/claude-approval.d.ts +4 -1
- package/dist/runtime/harnesses/claude-approval.js +8 -3
- package/dist/runtime/harnesses/claude.js +20 -11
- package/dist/runtime/presentation.d.ts +1 -0
- package/dist/runtime/presentation.js +1 -0
- package/dist/runtime/supervisor.js +2 -1
- package/dist/version.d.ts +2 -0
- package/dist/version.js +17 -0
- package/package.json +9 -3
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
3
|
import { registerEndpointOptions } from "./endpoint-options.js";
|
|
5
4
|
import { registerAuth } from "./commands/auth.js";
|
|
6
5
|
import { registerBoards } from "./commands/boards.js";
|
|
@@ -23,24 +22,17 @@ import { registerRuntime } from "./commands/runtime.js";
|
|
|
23
22
|
import { registerTasks } from "./commands/tasks.js";
|
|
24
23
|
import { registerDesktop, registerLegacyUi } from "./commands/desktop.js";
|
|
25
24
|
import { registerHost } from "./commands/host.js";
|
|
25
|
+
import { registerVersion } from "./commands/version.js";
|
|
26
26
|
import { registerApps } from "./commands/apps.js";
|
|
27
27
|
import { registerRooms } from "./commands/rooms.js";
|
|
28
28
|
import { formatUnknownCommandError, resolveHelpPath } from "./help-path.js";
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
32
|
-
return pkg.version;
|
|
33
|
-
}
|
|
34
|
-
catch {
|
|
35
|
-
return "1.0.0";
|
|
36
|
-
}
|
|
37
|
-
})();
|
|
29
|
+
import { CLI_VERSION } from "./version.js";
|
|
38
30
|
const program = registerEndpointOptions(new Command("cohub"));
|
|
39
31
|
program
|
|
40
32
|
.name("cohub")
|
|
41
33
|
.summary("Work with Cohub from your terminal")
|
|
42
34
|
.description("Send prompts, manage Space files, and publish public output.")
|
|
43
|
-
.version(
|
|
35
|
+
.version(CLI_VERSION, "-v, --version", "Show version")
|
|
44
36
|
.option("-s, --space <space>", "Target Space: ID, slug, or username/slug")
|
|
45
37
|
.option("--json", "Print machine-readable JSON when supported")
|
|
46
38
|
.helpOption("-h, --help", "Show help")
|
|
@@ -116,6 +108,7 @@ registerFeedback(program);
|
|
|
116
108
|
registerDesktop(program);
|
|
117
109
|
registerLegacyUi(program);
|
|
118
110
|
registerHost(program);
|
|
111
|
+
registerVersion(program);
|
|
119
112
|
const argv = process.argv.slice(2);
|
|
120
113
|
const help = resolveHelpPath(program, argv);
|
|
121
114
|
if (help.kind === "help") {
|
|
@@ -3,6 +3,7 @@ import { setTimeout as delay } from "node:timers/promises";
|
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
import { RUNTIME_MAX_FRAME_BYTES, RUNTIME_PROTOCOL_VERSION, runtimeCapabilitiesSchema, runtimeCommandSchema, runtimeHelloCapabilities, runtimeReadySchema, runtimeNativeStopSchema, runtimeApprovalDecisionSchema, } from "@neta-art/cohub";
|
|
5
5
|
import { describeError } from "../network-error.js";
|
|
6
|
+
import { CLI_VERSION } from "../version.js";
|
|
6
7
|
import { executeTurn } from "./native/execution.js";
|
|
7
8
|
import { ContextRequiredError } from "./native/results.js";
|
|
8
9
|
import { SizeLimitError } from "./native/transcript.js";
|
|
@@ -413,6 +414,7 @@ async function connect(options) {
|
|
|
413
414
|
spaceId: options.spaceId,
|
|
414
415
|
token: currentToken,
|
|
415
416
|
capabilities: registered,
|
|
417
|
+
client: { name: "cli", version: CLI_VERSION },
|
|
416
418
|
});
|
|
417
419
|
}
|
|
418
420
|
catch (error) {
|
|
@@ -3,7 +3,10 @@ import { type JsonRecord } from "../json-rpc.js";
|
|
|
3
3
|
import type { ApprovalBroker, ApprovalRequest } from "../native/approvals.js";
|
|
4
4
|
/** Cards answer Claude Code's permission prompts, so without `--permission-prompt-tool stdio` no mode is offered. */
|
|
5
5
|
export declare function claudeApprovalModes(help: string): ApprovalMode[];
|
|
6
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The platform's read-only access always wins. No mode follows local settings, as the picker shows;
|
|
8
|
+
* a CLI that cannot ask (no modes) keeps `acceptEdits` (`null`), since its prompts would be denied.
|
|
9
|
+
*/
|
|
7
10
|
export declare function claudeApprovalMode(input: RuntimeTurnInput, modes: readonly ApprovalMode[]): ApprovalMode | null;
|
|
8
11
|
export declare const claudePermissionMode: (mode: Exclude<ApprovalMode, "read_only"> | null) => string | null;
|
|
9
12
|
/**
|
|
@@ -10,15 +10,20 @@ export function claudeApprovalModes(help) {
|
|
|
10
10
|
const choices = new Set([...(/\(choices:([^)]*)\)/.exec(option)?.[1] ?? "").matchAll(/"([^"]+)"/g)].map((match) => match[1]));
|
|
11
11
|
return APPROVAL_MODES.filter((mode) => mode === "inherit" || choices.has(PERMISSION_MODES[mode] ?? ""));
|
|
12
12
|
}
|
|
13
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The platform's read-only access always wins. No mode follows local settings, as the picker shows;
|
|
15
|
+
* a CLI that cannot ask (no modes) keeps `acceptEdits` (`null`), since its prompts would be denied.
|
|
16
|
+
*/
|
|
14
17
|
export function claudeApprovalMode(input, modes) {
|
|
15
18
|
if (input.accessMode === "read_only" && input.approvalMode && input.approvalMode !== "read_only") {
|
|
16
19
|
throw new Error("The approval mode conflicts with read-only access");
|
|
17
20
|
}
|
|
18
21
|
if (input.accessMode === "read_only")
|
|
19
22
|
return "read_only";
|
|
20
|
-
if (!input.approvalMode
|
|
21
|
-
return
|
|
23
|
+
if (!input.approvalMode)
|
|
24
|
+
return modes.includes("inherit") ? "inherit" : null;
|
|
25
|
+
if (modes.includes(input.approvalMode))
|
|
26
|
+
return input.approvalMode;
|
|
22
27
|
throw new Error(`This Claude Code does not support the ${input.approvalMode} approval mode; update Claude Code and restart the Runtime`);
|
|
23
28
|
}
|
|
24
29
|
export const claudePermissionMode = (mode) => mode ? PERMISSION_MODES[mode] : "acceptEdits";
|
|
@@ -122,14 +122,23 @@ async function claudeInitialize(executable, cwd, extra = []) {
|
|
|
122
122
|
await host.close();
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
/**
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
/**
|
|
126
|
+
* A gateway at `ANTHROPIC_BASE_URL` serves every model, built-in aliases included, so all carry its host.
|
|
127
|
+
* Discovered gateway models without a visible base URL (e.g. set in Claude settings) get a generic name.
|
|
128
|
+
*/
|
|
129
|
+
function claudeProvider(baseUrl, discovered = false) {
|
|
130
|
+
let host = "";
|
|
128
131
|
try {
|
|
129
132
|
if (baseUrl)
|
|
130
|
-
|
|
133
|
+
host = new URL(baseUrl).hostname.slice(0, 100);
|
|
131
134
|
}
|
|
132
|
-
catch { /*
|
|
135
|
+
catch { /* Unparsable; use the generic name. */ }
|
|
136
|
+
if (host === "api.anthropic.com")
|
|
137
|
+
return profile.provider;
|
|
138
|
+
return host || (baseUrl || discovered ? "gateway" : profile.provider);
|
|
139
|
+
}
|
|
140
|
+
function claudeModelCatalog(entries, baseUrl) {
|
|
141
|
+
const provider = claudeProvider(baseUrl, entries.some((value) => text(record(value).description).startsWith("From gateway")));
|
|
133
142
|
const seen = new Set();
|
|
134
143
|
return entries.flatMap((value) => {
|
|
135
144
|
const model = record(value);
|
|
@@ -139,8 +148,7 @@ function claudeModelCatalog(entries, baseUrl) {
|
|
|
139
148
|
seen.add(id);
|
|
140
149
|
const effortLevels = model.supportsEffort === true ? array(model.supportedEffortLevels).filter((level) => typeof level === "string") : [];
|
|
141
150
|
return [streamJsonModel(profile, id, (text(model.displayName) || id).slice(0, 255), {
|
|
142
|
-
reasoning: effortLevels.length > 0, effortLevels, isDefault: id === DEFAULT_MODEL,
|
|
143
|
-
provider: text(model.description).startsWith("From gateway") ? gateway : profile.provider,
|
|
151
|
+
reasoning: effortLevels.length > 0, effortLevels, isDefault: id === DEFAULT_MODEL, provider,
|
|
144
152
|
})];
|
|
145
153
|
});
|
|
146
154
|
}
|
|
@@ -162,11 +170,12 @@ export const claudeHarness = {
|
|
|
162
170
|
throw error;
|
|
163
171
|
}
|
|
164
172
|
// Aliases follow the signed-in account; Haiku takes no effort level.
|
|
173
|
+
const provider = claudeProvider(process.env.ANTHROPIC_BASE_URL);
|
|
165
174
|
return [
|
|
166
|
-
streamJsonModel(profile, DEFAULT_MODEL, "Default", { reasoning: true, isDefault: true }),
|
|
167
|
-
streamJsonModel(profile, "opus", "Claude Opus", { reasoning: true }),
|
|
168
|
-
streamJsonModel(profile, "sonnet", "Claude Sonnet", { reasoning: true }),
|
|
169
|
-
streamJsonModel(profile, "haiku", "Claude Haiku", { reasoning: false }),
|
|
175
|
+
streamJsonModel(profile, DEFAULT_MODEL, "Default", { reasoning: true, isDefault: true, provider }),
|
|
176
|
+
streamJsonModel(profile, "opus", "Claude Opus", { reasoning: true, provider }),
|
|
177
|
+
streamJsonModel(profile, "sonnet", "Claude Sonnet", { reasoning: true, provider }),
|
|
178
|
+
streamJsonModel(profile, "haiku", "Claude Haiku", { reasoning: false, provider }),
|
|
170
179
|
];
|
|
171
180
|
},
|
|
172
181
|
approvalModes: probeApprovalModes,
|
|
@@ -69,6 +69,7 @@ export function printRuntimeSummary(summary, json = false, reused = false) {
|
|
|
69
69
|
["URL", value.url],
|
|
70
70
|
["Directory", summary.root],
|
|
71
71
|
["Harness", summary.harnesses.join(" · ") || "Cohub"],
|
|
72
|
+
...(summary.version ? [["CLI", summary.version]] : []),
|
|
72
73
|
["Mode", summary.background ? "Background" : "Foreground"],
|
|
73
74
|
...(summary.display ? [["Screen", summary.display === "auto" ? "This computer" : summary.display]] : []),
|
|
74
75
|
...(summary.direct ? [["Direct", "Files and screens on this machine skip the network"]] : []),
|
|
@@ -8,6 +8,7 @@ import { resolveWebsocketUrl } from "@neta-art/cohub";
|
|
|
8
8
|
import { AuthRequiredError, resolveAccessToken } from "../auth.js";
|
|
9
9
|
import { createClient } from "../client.js";
|
|
10
10
|
import { currentIdentityKey } from "../space.js";
|
|
11
|
+
import { CLI_VERSION } from "../version.js";
|
|
11
12
|
import { ensureSandboxdBinary } from "../commands/sandboxd-binary.js";
|
|
12
13
|
import { serveRuntime } from "./connection.js";
|
|
13
14
|
import { discoverHarnesses, refreshHarnesses } from "./harnesses/index.js";
|
|
@@ -72,7 +73,7 @@ export async function runRuntime(config, onState, externalSignal, onDiagnostic)
|
|
|
72
73
|
});
|
|
73
74
|
let status = {
|
|
74
75
|
spaceId: config.spaceId, root: config.root, runtimeId: diagnostics.runtimeId,
|
|
75
|
-
pid: process.pid, harnesses: config.harnesses, background: config.background,
|
|
76
|
+
pid: process.pid, version: CLI_VERSION, harnesses: config.harnesses, background: config.background,
|
|
76
77
|
...(config.display ? { display: config.display } : {}),
|
|
77
78
|
state: "starting", harnessConnected: false, workspaceConnected: false,
|
|
78
79
|
diagnosticsPath: diagnostics.directory,
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
export const CLI_VERSION = (() => {
|
|
3
|
+
try {
|
|
4
|
+
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return "0.0.0";
|
|
8
|
+
}
|
|
9
|
+
})();
|
|
10
|
+
export function cliCommit() {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(readFileSync(new URL("./build.json", import.meta.url), "utf8")).commit ?? null;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neta-art/cohub-cli",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.22.0",
|
|
4
4
|
"description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=24"
|
|
8
8
|
},
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/netaart/cohub.git",
|
|
13
|
+
"directory": "packages/cli"
|
|
14
|
+
},
|
|
15
|
+
"homepage": "https://github.com/netaart/cohub",
|
|
10
16
|
"bin": {
|
|
11
17
|
"cohub": "./bin/cohub.js"
|
|
12
18
|
},
|
|
@@ -18,7 +24,7 @@
|
|
|
18
24
|
"NOTICE"
|
|
19
25
|
],
|
|
20
26
|
"dependencies": {
|
|
21
|
-
"@neta-art/cohub": "13.
|
|
27
|
+
"@neta-art/cohub": "13.13.0",
|
|
22
28
|
"@neta-art/generation": "0.2.15",
|
|
23
29
|
"commander": "^15.0.0",
|
|
24
30
|
"sharp": "^0.35.4",
|
|
@@ -41,7 +47,7 @@
|
|
|
41
47
|
"@napi-rs/canvas": "^1.0.13"
|
|
42
48
|
},
|
|
43
49
|
"scripts": {
|
|
44
|
-
"build": "tsc -p tsconfig.build.json && tsdown",
|
|
50
|
+
"build": "tsc -p tsconfig.build.json && tsdown && node scripts/stamp-build.mjs",
|
|
45
51
|
"verify:sandboxd": "node --import tsx scripts/verify-sandboxd-release.ts",
|
|
46
52
|
"verify:rtc": "node --import tsx scripts/verify-rtc-release.ts",
|
|
47
53
|
"verify:board-kernel": "node --import tsx scripts/verify-board-kernel.ts",
|