@neta-art/cohub-cli 10.12.3 → 10.14.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.
@@ -1,10 +1,11 @@
1
1
  import { readBoardJsonObject } from "../../board-command-support.js";
2
2
  import { loadBoardDocument, resolveBundledFonts } from "../../board-export.js";
3
3
  import { settleBoardDocument } from "../../board-media.js";
4
- import { boardPathTrack, boardSequencePatch, buildBoardScene, createBoardAnimationSampler, createNodeBoardRenderer, inspectBoardItems, } from "../../board-kernel.js";
4
+ import { boardFrameRegions, boardPathTrack, boardRegionStep, boardSequencePatch, buildBoardScene, createBoardAnimationSampler, createNodeBoardRenderer, inspectBoardItems, } from "../../board-kernel.js";
5
5
  import { parseBoardTimes } from "../../board-time.js";
6
- import { handleHttp, json as outJson } from "../../output.js";
6
+ import { handleHttp, json as outJson, jsonRequested, table } from "../../output.js";
7
7
  import { resolveSpace } from "../../space.js";
8
+ const DIRECTIONS = ["left", "right", "up", "down"];
8
9
  export function registerBoardAuthoringCommands(boards) {
9
10
  boards
10
11
  .command("inspect <board>")
@@ -45,6 +46,39 @@ Example: cohub boards inspect lesson.board --animation lecture --at 0:20s:1s --j
45
46
  handleHttp(cause);
46
47
  }
47
48
  });
49
+ boards
50
+ .command("frames <board>")
51
+ .description("List the frames viewers step through, in order, and where each arrow leads")
52
+ .option("--json", "Output as JSON")
53
+ .addHelpText("after", `
54
+ Order follows placement: rows top to bottom, each left to right. Move a frame to
55
+ change where it falls. A plain (decoration: none) frame with a label is a page;
56
+ without one, the frames inside it count. Frames inside pages do not. Left and right continue in reading order past a row's end.
57
+ Viewers step with N, the arrow keys and swipes; #focus=<frame>&present presents.`)
58
+ .action(async (target, options) => {
59
+ try {
60
+ const { document } = await loadBoardDocument(await resolveSpace(boards), target);
61
+ const regions = boardFrameRegions(buildBoardScene(document));
62
+ const frames = regions.map((region, index) => ({
63
+ index: index + 1,
64
+ id: region.id,
65
+ label: region.label ?? null,
66
+ rect: region.rect,
67
+ ...Object.fromEntries(DIRECTIONS.map((direction) => [direction, boardRegionStep(regions, region, direction)?.id ?? null])),
68
+ }));
69
+ if (jsonRequested(options))
70
+ return outJson({ frames });
71
+ table(frames, [
72
+ { key: "index", label: "#" },
73
+ { key: "id", label: "ID" },
74
+ { key: "label", label: "Label", format: (value) => value ?? "" },
75
+ ...DIRECTIONS.map((direction) => ({ key: direction, label: direction[0]?.toUpperCase() + direction.slice(1), format: (value) => value ?? "–" })),
76
+ ]);
77
+ }
78
+ catch (cause) {
79
+ handleHttp(cause);
80
+ }
81
+ });
48
82
  boards
49
83
  .command("sequence <board>")
50
84
  .description("Compile chapters to an apply-ready animation patch; does not write")
@@ -313,6 +313,7 @@ A Board is one JSON document: { board, items, animations }.
313
313
  sequence join chapter animations into one timeline
314
314
  path sample a polyline into a position track
315
315
  inspect measure items and report layout hints
316
+ frames the frames viewers step through, in order
316
317
  export render an image, a frame sequence or a video
317
318
  play shared playback; also pause, resume, next, seek, stop
318
319
  watch stream changes and playback
@@ -1,5 +1,5 @@
1
1
  import { createClient } from "../client.js";
2
- import { error, handleHttp, json as outJson, jsonRequested, ok, table } from "../output.js";
2
+ import { error, formatLocalDateTime, handleHttp, json as outJson, jsonRequested, ok, table } from "../output.js";
3
3
  import { webUrl } from "../web.js";
4
4
  function referralUrl(code) {
5
5
  return webUrl(`/referrals/${code}`);
@@ -33,6 +33,9 @@ export function registerReferrals(program) {
33
33
  if (jsonRequested(opts))
34
34
  return outJson(output);
35
35
  console.log(`\nReferral link: ${output.url}`);
36
+ const { quota } = result;
37
+ const resets = quota.cycleEndsAt ? `, resets ${formatLocalDateTime(quota.cycleEndsAt)}` : "";
38
+ console.log(`Cycle: ${quota.used}/${quota.limit} used, ${quota.reserved} pending, ${quota.available} available${resets}`);
36
39
  console.log(`Rewarded: ${result.summary.rewarded}`);
37
40
  console.log(`Earned: $${result.summary.earnedUsd.toFixed(2)}\n`);
38
41
  }
@@ -54,8 +57,9 @@ export function registerReferrals(program) {
54
57
  table(result.items, [
55
58
  { key: "id", label: "ID" },
56
59
  { key: "status", label: "Status" },
57
- { key: "claimedAt", label: "Claimed" },
58
- { key: "rewardedAt", label: "Rewarded" },
60
+ { key: "claimedAt", label: "Claimed", format: formatLocalDateTime },
61
+ { key: "expiresAt", label: "Expires", format: formatLocalDateTime },
62
+ { key: "rewardedAt", label: "Rewarded", format: formatLocalDateTime },
59
63
  ]);
60
64
  }
61
65
  catch (error) {
@@ -167,12 +167,14 @@ export function registerSpaceDisplays(spacesCmd) {
167
167
  table(result.displays.map((display) => ({
168
168
  ...display,
169
169
  size: `${display.width}x${display.height}`,
170
+ platform: display.platform ?? "—",
170
171
  abilities: [display.stream && "view", display.capture && "capture", display.input && "control", display.tree && "tree", display.desktop && "desktop"].filter(Boolean).join(", "),
171
172
  watching: display.viewers?.length ? `${display.viewers.length}${display.viewers.some((viewer) => viewer.control) ? " (controlling)" : ""}` : "—",
172
173
  })), [
173
174
  { key: "id", label: "ID" },
174
175
  { key: "name", label: "Name" },
175
176
  { key: "size", label: "Size" },
177
+ { key: "platform", label: "Platform" },
176
178
  { key: "abilities", label: "Abilities" },
177
179
  { key: "watching", label: "Watching" },
178
180
  ]);
@@ -190,6 +190,14 @@ async function sendPrompt(command, words, opts) {
190
190
  return error("Conflicting schedule", "Use only one of --delay-ms, --at, or --cron");
191
191
  if (opts.cron && !opts.timezone)
192
192
  return error("Missing timezone", "--timezone is required with --cron");
193
+ if (opts.note) {
194
+ const agentOnly = Object.entries({
195
+ "--delay-ms": opts.delayMs, "--at": opts.at, "--cron": opts.cron, "--model": opts.model, "--provider": opts.provider,
196
+ "--thinking-level": opts.thinkingLevel, "--read-only": opts.readOnly, "--steer": opts.steer, "--env": opts.env?.length,
197
+ }).flatMap(([flag, value]) => value ? [flag] : []);
198
+ if (agentOnly.length)
199
+ return error("Conflicting options", `--note cannot be combined with ${agentOnly.join(", ")}`);
200
+ }
193
201
  const thinkingLevel = opts.thinkingLevel?.trim() || undefined;
194
202
  if (thinkingLevel
195
203
  && !new Set(["off", "minimal", "low", "medium", "high", "xhigh", "max"]).has(thinkingLevel)) {
@@ -234,6 +242,7 @@ async function sendPrompt(command, words, opts) {
234
242
  ...imageBlocks,
235
243
  ];
236
244
  const result = await client.space(spaceId).prompt({
245
+ ...(opts.note ? { mode: "note" } : {}),
237
246
  sessionId,
238
247
  title: sessionId === opts.session ? opts.title : undefined,
239
248
  content: promptContent,
@@ -250,7 +259,7 @@ async function sendPrompt(command, words, opts) {
250
259
  if (jsonRequested(opts))
251
260
  return outJson(result);
252
261
  if (result.mode === "immediate")
253
- return ok(`Prompt sent — sessionId: ${result.session.id}, turnId: ${result.turn.id}`);
262
+ return ok(`${opts.note ? "Note recorded" : "Prompt sent"} — sessionId: ${result.session.id}, turnId: ${result.turn.id}`);
254
263
  if (result.mode === "repeat")
255
264
  return ok(`Prompt scheduled — cronJobId: ${result.cronJobId}, nextRunAt: ${result.nextRunAt}`);
256
265
  return ok(`Prompt scheduled — taskRunId: ${result.taskRunId}, scheduledAt: ${result.scheduledAt}`);
@@ -357,6 +366,7 @@ export function registerPrompt(program) {
357
366
  .option("--label <ref>", "Attach a label, e.g. Bug or Area/Frontend", collectOption, [])
358
367
  .option("--env <key=value>", "Set an environment variable for this turn", collectOption, [])
359
368
  .option("--image <path>", "Attach an image", collectOption, [])
369
+ .option("--note", "Record the message without an AI reply")
360
370
  .option("--json", "Output as JSON")
361
371
  .action((words, opts) => sendPrompt(program, words, opts));
362
372
  program
@@ -720,6 +730,7 @@ export function registerSpaces(program) {
720
730
  .option("--label <ref>", "Attach a label, e.g. Bug or Area/Frontend", collectOption, [])
721
731
  .option("--env <key=value>", "Set an environment variable for this turn", collectOption, [])
722
732
  .option("--image <path>", "Attach an image", collectOption, [])
733
+ .option("--note", "Record the message without an AI reply")
723
734
  .option("--json", "Output as JSON")
724
735
  .action((words, opts) => sendPrompt(spacesCmd, words, opts));
725
736
  // ── spaces completion ──
@@ -1617,6 +1628,8 @@ function registerTurns(sessionsCmd) {
1617
1628
  { key: "stopReason", label: "Stop" },
1618
1629
  { key: "errorMessage", label: "Error" },
1619
1630
  ]);
1631
+ if (result.turn.summary?.reason === "billing")
1632
+ console.log("\nStopped: insufficient balance. Manage billing at your Cohub account settings.");
1620
1633
  const origin = readSessionTurnOrigin(result.turn.meta, spaceId);
1621
1634
  if (origin)
1622
1635
  console.log(`\nOrigin (${origin.kind}): space=${origin.spaceId} session=${origin.sessionId} turn=${origin.turnId}${origin.toolCallId ? ` toolCall=${origin.toolCallId}` : ""}`);
@@ -5,6 +5,8 @@ export function sessionStatusText(session) {
5
5
  const issue = session.lastTurnIssue;
6
6
  if (issue?.status === "failed")
7
7
  return "failed";
8
+ if (issue?.reason === "billing")
9
+ return "stopped: insufficient balance";
8
10
  return issue?.reason === "stale_active_recovered" ? "interrupted" : "";
9
11
  }
10
12
  export const SESSION_STATUS_COLUMN = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "10.12.3",
3
+ "version": "10.14.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.1.0",
21
+ "@neta-art/cohub": "13.3.0",
22
22
  "@neta-art/generation": "^0.1.41",
23
23
  "commander": "^15.0.0",
24
24
  "sharp": "^0.35.4",