@neta-art/cohub-cli 10.21.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/dist/board-gpu/page.js +1 -0
- package/dist/board-kernel.js +42 -13
- package/dist/board-simulate.d.ts +1 -1
- package/dist/board-simulate.js +1 -1
- package/dist/build.json +1 -1
- package/dist/commands/boards.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/package.json +2 -2
package/dist/board-gpu/page.js
CHANGED
|
@@ -67659,6 +67659,7 @@ function createScriptRuntime(module, initial, host) {
|
|
|
67659
67659
|
invalidate(false);
|
|
67660
67660
|
},
|
|
67661
67661
|
async commit(patch) {
|
|
67662
|
+
if (input.capabilities && !input.capabilities.includes("board.commit")) throw new Error("This viewer cannot edit the Board.");
|
|
67662
67663
|
return await host.call("board.commit", {
|
|
67663
67664
|
patch,
|
|
67664
67665
|
frame: stepping
|
package/dist/board-kernel.js
CHANGED
|
@@ -44495,6 +44495,7 @@ function createScriptRuntime(module, initial, host) {
|
|
|
44495
44495
|
invalidate(false);
|
|
44496
44496
|
},
|
|
44497
44497
|
async commit(patch) {
|
|
44498
|
+
if (input.capabilities && !input.capabilities.includes("board.commit")) throw new Error("This viewer cannot edit the Board.");
|
|
44498
44499
|
return await host.call("board.commit", {
|
|
44499
44500
|
patch,
|
|
44500
44501
|
frame: stepping
|
|
@@ -47531,6 +47532,7 @@ function createNodeBoardScriptHost(renderer, options) {
|
|
|
47531
47532
|
}
|
|
47532
47533
|
function createNodeBoardScriptRuntime(renderer, options) {
|
|
47533
47534
|
const { callbacks } = options;
|
|
47535
|
+
const capabilities = Object.keys(callbacks.capabilities);
|
|
47534
47536
|
const lanes = createNodeScriptLanes(renderer, {
|
|
47535
47537
|
...options,
|
|
47536
47538
|
call: (id, name, input) => {
|
|
@@ -47651,10 +47653,13 @@ function createNodeBoardScriptRuntime(renderer, options) {
|
|
|
47651
47653
|
entries.set(id, entry);
|
|
47652
47654
|
}
|
|
47653
47655
|
if (entry.error || entry.busy) continue;
|
|
47654
|
-
const input =
|
|
47655
|
-
|
|
47656
|
-
|
|
47657
|
-
|
|
47656
|
+
const input = {
|
|
47657
|
+
...scopedInput(document, attachment, item ? scene.layout.box(id) : {
|
|
47658
|
+
width: 0,
|
|
47659
|
+
height: 0
|
|
47660
|
+
}),
|
|
47661
|
+
capabilities
|
|
47662
|
+
};
|
|
47658
47663
|
const inputKey = JSON.stringify(input);
|
|
47659
47664
|
if (!(inputKey !== entry.inputKey || entry.dirty || entry.events.length > 0) && entry.output && (entry.time === time || !entry.output.animated && !entry.output.updating)) continue;
|
|
47660
47665
|
entry.dirty = false;
|
|
@@ -50335,7 +50340,10 @@ function createInteractionModule(ctx) {
|
|
|
50335
50340
|
});
|
|
50336
50341
|
}
|
|
50337
50342
|
function browsing() {
|
|
50338
|
-
return options.readonly === true || ctx.frames.view()?.present === true;
|
|
50343
|
+
return options.readonly === true || state.tool === "play" || ctx.frames.view()?.present === true;
|
|
50344
|
+
}
|
|
50345
|
+
function movable(item) {
|
|
50346
|
+
return Boolean(item && !ctx.query.isLocked(item) && registry.capabilities(item).canMove);
|
|
50339
50347
|
}
|
|
50340
50348
|
function opensOnTap(item) {
|
|
50341
50349
|
return registry.activation(item, browsing()) === "tap";
|
|
@@ -50549,7 +50557,7 @@ function createInteractionModule(ctx) {
|
|
|
50549
50557
|
const dx = event.screen.x - gesture.start.x;
|
|
50550
50558
|
const dy = event.screen.y - gesture.start.y;
|
|
50551
50559
|
const item = state.scene.get(gesture.itemId);
|
|
50552
|
-
if (!(!
|
|
50560
|
+
if (!(!options.readonly && !ctx.frames.view()?.present && (state.tool === "select" || state.tool === "play") && movable(item))) {
|
|
50553
50561
|
state.interaction = {
|
|
50554
50562
|
type: "panning",
|
|
50555
50563
|
start: gesture.start,
|
|
@@ -50585,7 +50593,7 @@ function createInteractionModule(ctx) {
|
|
|
50585
50593
|
}
|
|
50586
50594
|
const id = gesture.type === "pressing" ? gesture.itemId : gesture.type === "panning" && !gesture.moved ? gesture.tapSelection?.targetId : null;
|
|
50587
50595
|
const item = id ? state.scene.get(id) : null;
|
|
50588
|
-
if (!
|
|
50596
|
+
if (!movable(item)) return null;
|
|
50589
50597
|
state.selection = [item.id];
|
|
50590
50598
|
state.tool = "select";
|
|
50591
50599
|
state.interaction = {
|
|
@@ -50624,6 +50632,23 @@ function createInteractionModule(ctx) {
|
|
|
50624
50632
|
return item?.type === "frame" && registry.hitTest(item, point);
|
|
50625
50633
|
});
|
|
50626
50634
|
}
|
|
50635
|
+
function play(event) {
|
|
50636
|
+
if (!state.spaceHeld && pressCard(event)) return;
|
|
50637
|
+
const item = !state.spaceHeld && event.button === 0 ? ctx.query.pickAt(event.world, event.pointerType) : null;
|
|
50638
|
+
state.interaction = movable(item) ? {
|
|
50639
|
+
type: "translating",
|
|
50640
|
+
start: event.world,
|
|
50641
|
+
...ctx.selection.grab([item.id]),
|
|
50642
|
+
moved: false,
|
|
50643
|
+
duplicate: false
|
|
50644
|
+
} : {
|
|
50645
|
+
type: "panning",
|
|
50646
|
+
start: event.screen,
|
|
50647
|
+
origin: { ...state.camera },
|
|
50648
|
+
moved: false,
|
|
50649
|
+
tapSelection: null
|
|
50650
|
+
};
|
|
50651
|
+
}
|
|
50627
50652
|
function translateSelection(event, tap) {
|
|
50628
50653
|
state.interaction = {
|
|
50629
50654
|
type: "translating",
|
|
@@ -50678,6 +50703,7 @@ function createInteractionModule(ctx) {
|
|
|
50678
50703
|
}
|
|
50679
50704
|
browseByTouch(event);
|
|
50680
50705
|
const { tool, spaceHeld } = state;
|
|
50706
|
+
if (tool === "play") return play(event);
|
|
50681
50707
|
const additive = event.shiftKey || event.metaKey || event.ctrlKey;
|
|
50682
50708
|
if (!spaceHeld && (tool === "hand" || options.readonly) && pressCard(event)) return;
|
|
50683
50709
|
const fingerOnPenCanvas = tool === "draw" && event.pointerType === "touch" && penSeen;
|
|
@@ -50908,7 +50934,8 @@ function createInteractionModule(ctx) {
|
|
|
50908
50934
|
};
|
|
50909
50935
|
let tx = dx;
|
|
50910
50936
|
let ty = dy;
|
|
50911
|
-
|
|
50937
|
+
const playing = state.tool === "play";
|
|
50938
|
+
if (!playing && !event.metaKey && !event.ctrlKey) {
|
|
50912
50939
|
const snap = computeTranslationSnap(shift(dx, dy), movingWith(current.origin));
|
|
50913
50940
|
tx += snap.dx;
|
|
50914
50941
|
ty += snap.dy;
|
|
@@ -50916,7 +50943,9 @@ function createInteractionModule(ctx) {
|
|
|
50916
50943
|
} else state.snapGuides = [];
|
|
50917
50944
|
ctx.document.writeDraft(ctx.selection.placed(shift(tx, ty), current.grabbed), false, current.grabbed);
|
|
50918
50945
|
let dropTargetId = null;
|
|
50919
|
-
|
|
50946
|
+
if (!playing) {
|
|
50947
|
+
for (const parent of dropParents(current.origin, true).values()) if (parent) dropTargetId = parent;
|
|
50948
|
+
}
|
|
50920
50949
|
if ((current.dropTargetId ?? null) !== dropTargetId) state.interaction = {
|
|
50921
50950
|
...current,
|
|
50922
50951
|
dropTargetId
|
|
@@ -52322,7 +52351,7 @@ function createBoardEditor(options) {
|
|
|
52322
52351
|
ctx.chosenTool = value;
|
|
52323
52352
|
state.tool = value;
|
|
52324
52353
|
if (isCreationBoardTool(value)) state.hoverId = null;
|
|
52325
|
-
if (value === "draw" || value === "arrow") {
|
|
52354
|
+
if (value === "draw" || value === "arrow" || value === "play") {
|
|
52326
52355
|
state.selection = [];
|
|
52327
52356
|
state.editingId = null;
|
|
52328
52357
|
}
|
|
@@ -52940,7 +52969,7 @@ function boardScriptsMayTakeInput(event, editor) {
|
|
|
52940
52969
|
return !editor.onHandle();
|
|
52941
52970
|
}
|
|
52942
52971
|
function boardScriptTakesTool(tools, tool, readonly) {
|
|
52943
|
-
return readonly || (tools ?? DEFAULT_TOOLS).includes(tool);
|
|
52972
|
+
return readonly || tool === "play" || (tools ?? DEFAULT_TOOLS).includes(tool);
|
|
52944
52973
|
}
|
|
52945
52974
|
const DEFAULT_TOOLS = ["select", "hand"];
|
|
52946
52975
|
//#endregion
|
|
@@ -53078,10 +53107,10 @@ function createBoardScriptController(options) {
|
|
|
53078
53107
|
throw error;
|
|
53079
53108
|
}
|
|
53080
53109
|
},
|
|
53081
|
-
"board.commit": (id, value) => {
|
|
53110
|
+
...editor.readonly ? {} : { "board.commit": async (id, value) => {
|
|
53082
53111
|
const { patch, frame } = value;
|
|
53083
53112
|
return commits.commit(id, patch, !frame && activated(id));
|
|
53084
|
-
},
|
|
53113
|
+
} },
|
|
53085
53114
|
"board.layoutText": async (_id, value) => layoutBoardScriptText(value)
|
|
53086
53115
|
},
|
|
53087
53116
|
onOutput: (id, output) => {
|
package/dist/board-simulate.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BoardExportRegion, BoardThemeId } from "@neta-art/cohub/board";
|
|
2
2
|
import type { BoardNodeExportFormat } from "@neta-art/cohub/board/export/node";
|
|
3
3
|
import type { BoardScriptHarnessPointer, BoardScriptHarnessPress } from "@neta-art/cohub/board/testing";
|
|
4
|
-
declare const TOOLS: readonly ["select", "hand", "text", "shape", "draw", "arrow", "frame"];
|
|
4
|
+
declare const TOOLS: readonly ["select", "hand", "play", "text", "shape", "draw", "arrow", "frame"];
|
|
5
5
|
type Point = {
|
|
6
6
|
x: number;
|
|
7
7
|
y: number;
|
package/dist/board-simulate.js
CHANGED
|
@@ -6,7 +6,7 @@ import { boardScriptAttachments, boardShaderParameters, buildBoardScene, checkBo
|
|
|
6
6
|
import { settleBoardDocument } from "./board-media.js";
|
|
7
7
|
import { parseBoardTime } from "./board-time.js";
|
|
8
8
|
import { createClient } from "./client.js";
|
|
9
|
-
const TOOLS = ["select", "hand", "text", "shape", "draw", "arrow", "frame"];
|
|
9
|
+
const TOOLS = ["select", "hand", "play", "text", "shape", "draw", "arrow", "frame"];
|
|
10
10
|
const POINTER_TYPES = ["mouse", "pen", "touch"];
|
|
11
11
|
const MAX_STEPS = 10_000;
|
|
12
12
|
const MAX_TIME_MS = 600_000;
|
package/dist/build.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commit":"
|
|
1
|
+
{"commit":"7ce9bec"}
|
package/dist/commands/boards.js
CHANGED
|
@@ -350,6 +350,8 @@ function registerSimulateCommand(boards) {
|
|
|
350
350
|
Steps are {"steps": [...]}, points in board coordinates, run on a virtual clock:
|
|
351
351
|
{"wait": "500ms"} {"tool": "draw"} {"tap": [x, y]} {"drag": [[x, y], ...], "pointerType": "pen"}
|
|
352
352
|
{"pointer": "down", "at": [x, y]} {"key": "Enter"} {"select": ["id"]}
|
|
353
|
+
{"tool": "play"} acts like an App visitor: drags move unlocked items, empty space pans,
|
|
354
|
+
and script regions take every press.
|
|
353
355
|
|
|
354
356
|
Shaders are compiled with a local Chrome, Chromium or Edge when one is found, before
|
|
355
357
|
the steps run; their errors join the scripts' errors and stop the run.
|
|
@@ -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,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"NOTICE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@neta-art/cohub": "13.
|
|
27
|
+
"@neta-art/cohub": "13.13.0",
|
|
28
28
|
"@neta-art/generation": "0.2.15",
|
|
29
29
|
"commander": "^15.0.0",
|
|
30
30
|
"sharp": "^0.35.4",
|