@neta-art/cohub-cli 10.25.1 → 10.27.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/chunks/id.js CHANGED
@@ -6,6 +6,10 @@ const BOARD_PAGE_SIZE = {
6
6
  width: 960,
7
7
  height: 540
8
8
  };
9
+ const BOARD_CAMERA_VIEWPORT = {
10
+ width: 1600,
11
+ height: 900
12
+ };
9
13
  const BOARD_TEXT_SCALE = {
10
14
  title: 56,
11
15
  heading: 40,
@@ -827,7 +831,11 @@ const BoardAnimationHeaderSchema = object({
827
831
  delay: nonNegative.default(0),
828
832
  loop: boolean().default(false),
829
833
  end: _enum(["hold", "reset"]).default("hold").describe("hold keeps the last frame; reset returns to the start."),
830
- markers: array(BoardMarkerSchema).max(1e4).default([]).describe("Labeled points on this timeline; a nested animation's markers do not carry over.")
834
+ markers: array(BoardMarkerSchema).max(1e4).default([]).describe("Labeled points on this timeline; a nested animation's markers do not carry over."),
835
+ viewport: object({
836
+ width: number().int().positive().max(8192),
837
+ height: number().int().positive().max(8192)
838
+ }).strict().optional().describe(`Screen pixels the camera tracks are framed for, ${BOARD_CAMERA_VIEWPORT.width}x${BOARD_CAMERA_VIEWPORT.height} by default. Every screen and export shows that framing, scaled to fit.`)
831
839
  }).strict();
832
840
  BoardAnimationHeaderSchema.extend({ tracks: record(BoardKeySchema, BoardTrackSchema).default({}) }).strict();
833
841
  const BOARD_ENTER_PRESETS = [
@@ -1837,6 +1845,28 @@ function error(path, code, message) {
1837
1845
  message
1838
1846
  };
1839
1847
  }
1848
+ const OUTLINE = [
1849
+ "fill",
1850
+ "fillOpacity",
1851
+ "stroke",
1852
+ "strokeWidth",
1853
+ "dash",
1854
+ "radius",
1855
+ "trim"
1856
+ ];
1857
+ function undrawnStyle(id, item, body, created) {
1858
+ const [undrawn, reason] = item.type === "text" ? [OUTLINE.filter((key) => key !== "fill"), "text draws only its fill color"] : item.type === "file" ? [OUTLINE, "file cards follow the theme"] : item.type === "frame" && item.props.decoration === "none" ? [OUTLINE, "a frame with decoration \"none\" draws no box; put a shape inside it instead"] : [[], ""];
1859
+ const style = isRecord(body.style) ? body.style : {};
1860
+ const all = created || isRecord(body.props) && "decoration" in body.props;
1861
+ const keys = undrawn.filter((key) => item.style[key] !== void 0 && (all || key in style));
1862
+ if (!keys.length) return null;
1863
+ return {
1864
+ severity: "warning",
1865
+ code: "STYLE_NOT_DRAWN",
1866
+ path: `items.${id}.style`,
1867
+ message: `${keys.join(", ")} ${keys.length === 1 ? "has" : "have"} no effect: ${reason}.`
1868
+ };
1869
+ }
1840
1870
  function stripId(value) {
1841
1871
  if (!("id" in value)) return value;
1842
1872
  const { id: _id, ...rest } = value;
@@ -1850,6 +1880,7 @@ function applyBoardPatch(state, input, options = {}) {
1850
1880
  };
1851
1881
  const patch = parsedPatch.data;
1852
1882
  const diagnostics = [];
1883
+ const warnings = [];
1853
1884
  const keep = (existing) => options.keepUnknown ? keepAllBoardFields : existing ? keepBoardFieldsOf(existing) : void 0;
1854
1885
  const nextItems = /* @__PURE__ */ new Map();
1855
1886
  const nextAnimations = /* @__PURE__ */ new Map();
@@ -1897,6 +1928,8 @@ function applyBoardPatch(state, input, options = {}) {
1897
1928
  }
1898
1929
  if (current && boardJsonEquals(current, parsed.item)) continue;
1899
1930
  nextItems.set(id, parsed.item);
1931
+ const warning = undrawnStyle(id, parsed.item, body, replacing);
1932
+ if (warning) warnings.push(warning);
1900
1933
  }
1901
1934
  for (const [id, value] of Object.entries(patch.animations ?? {})) {
1902
1935
  if (value === null) {
@@ -2109,7 +2142,7 @@ function applyBoardPatch(state, input, options = {}) {
2109
2142
  ok: true,
2110
2143
  before: withoutEmpty(before),
2111
2144
  after: withoutEmpty(after),
2112
- diagnostics: []
2145
+ diagnostics: warnings
2113
2146
  };
2114
2147
  }
2115
2148
  function validateTrack(path, animationId, value, item, animation, track, script, state, keepUnknownProperty = false) {
@@ -2413,4 +2446,4 @@ function createBoardItemId() {
2413
2446
  return `item_${createBoardEntityId()}`;
2414
2447
  }
2415
2448
  //#endregion
2416
- export { BoardAnimationHeaderSchema as $, invertMatrix as A, taskArtifactPreviewUrl as B, clampBoardFontSize as C, estimateTextWidth as D, drawSampleRadius as E, pointsRect as F, BOARD_COLOR_TOKENS as G, isBoardPath as H, scaleVector as I, BOARD_EXTENSION_TYPE_PATTERN as J, BOARD_EFFECT_KINDS as K, setBoardTextLayouter as L, layoutBoardText as M, matrixRotation as N, fitBoardMediaSize as O, multiplyMatrix as P, BOARD_SHAPE_GEOMETRIES as Q, sideAnchor as R, bendControl as S, clampBoardStrokeSize as St, drawPointsBounds as T, parseBoardManifest as U, BOARD_CLIPBOARD_KIND as V, BOARD_CAMERA_TARGET as W, BOARD_ITEM_TYPES as X, BOARD_ITEM_SCHEMAS as Y, BOARD_SHADOW_DEFAULTS as Z, IDENTITY_MATRIX as _, BOARD_MONO_FONT_STACK as _t, isTextMime as a, BoardSettingsSchema as at, arrowBindings as b, BOARD_TEXT_SCALE as bt, normalizeMime as c, hasAuthoredSize as ct, diffMergePatch as d, parseBoardMediaSource as dt, BoardColorSchema as et, listBoardProperties as f, isPublicBoardRemoteAddress as ft, resolveBoardProperty as g, BOARD_FONT_STACK as gt, pruneBoardTrack as h, BOARD_DEFAULT_SIZES as ht, isModelMime as i, BoardScriptSchema as it, isArrowBinding as j, framePoint as k, applyBoardDelta as l, isBuiltinItemType as lt, parseBoardDocument as m, BOARD_ARROW_STROKE_SIZE as mt, createBoardItemId as n, BoardIdSchema as nt, mimeTypeForPath as o, BoardTrackSchema as ot, mergePatch as p, normalizeBoardRemoteUrl as pt, BOARD_EFFECT_KIND_INFO as q, sameJson as r, BoardKeySchema as rt, modelFormatForPath as s, boardItemPreview as st, createBoardEntityId as t, BoardExtensionItemSchema as tt, applyBoardPatchToDocument as u, parseBoardItem as ut, adoptBoardNaturalSize as v, BOARD_PAGE_SIZE as vt, createBoardLayout as w, autoAnchorSide as x, boardDefaultSize as xt, applyMatrix as y, BOARD_TEXT_FONT_FAMILY as yt, featuredTaskArtifact as z };
2449
+ export { BoardAnimationHeaderSchema as $, invertMatrix as A, taskArtifactPreviewUrl as B, clampBoardFontSize as C, clampBoardStrokeSize as Ct, estimateTextWidth as D, drawSampleRadius as E, pointsRect as F, BOARD_COLOR_TOKENS as G, isBoardPath as H, scaleVector as I, BOARD_EXTENSION_TYPE_PATTERN as J, BOARD_EFFECT_KINDS as K, setBoardTextLayouter as L, layoutBoardText as M, matrixRotation as N, fitBoardMediaSize as O, multiplyMatrix as P, BOARD_SHAPE_GEOMETRIES as Q, sideAnchor as R, bendControl as S, boardDefaultSize as St, drawPointsBounds as T, parseBoardManifest as U, BOARD_CLIPBOARD_KIND as V, BOARD_CAMERA_TARGET as W, BOARD_ITEM_TYPES as X, BOARD_ITEM_SCHEMAS as Y, BOARD_SHADOW_DEFAULTS as Z, IDENTITY_MATRIX as _, BOARD_FONT_STACK as _t, isTextMime as a, BoardSettingsSchema as at, arrowBindings as b, BOARD_TEXT_FONT_FAMILY as bt, normalizeMime as c, hasAuthoredSize as ct, diffMergePatch as d, parseBoardMediaSource as dt, BoardColorSchema as et, listBoardProperties as f, isPublicBoardRemoteAddress as ft, resolveBoardProperty as g, BOARD_DEFAULT_SIZES as gt, pruneBoardTrack as h, BOARD_CAMERA_VIEWPORT as ht, isModelMime as i, BoardScriptSchema as it, isArrowBinding as j, framePoint as k, applyBoardDelta as l, isBuiltinItemType as lt, parseBoardDocument as m, BOARD_ARROW_STROKE_SIZE as mt, createBoardItemId as n, BoardIdSchema as nt, mimeTypeForPath as o, BoardTrackSchema as ot, mergePatch as p, normalizeBoardRemoteUrl as pt, BOARD_EFFECT_KIND_INFO as q, sameJson as r, BoardKeySchema as rt, modelFormatForPath as s, boardItemPreview as st, createBoardEntityId as t, BoardExtensionItemSchema as tt, applyBoardPatchToDocument as u, parseBoardItem as ut, adoptBoardNaturalSize as v, BOARD_MONO_FONT_STACK as vt, createBoardLayout as w, autoAnchorSide as x, BOARD_TEXT_SCALE as xt, applyMatrix as y, BOARD_PAGE_SIZE as yt, featuredTaskArtifact as z };
@@ -10997,6 +10997,7 @@ const RETRY_MAX_MS = 3e5;
10997
10997
  * small enough to answer well within the request timeout; the protocol allows more.
10998
10998
  */
10999
10999
  const INGEST_BATCH_TURNS = Math.min(50, 500);
11000
+ const STAGE_BATCH_MESSAGES = 1e3;
11000
11001
  const IMPORT_FAILURES_KEPT = 100;
11001
11002
  const fileVersion = (info) => `${info.ino}:${info.size}:${info.mtimeMs}`;
11002
11003
  /** Headers are read this many at a time; each costs one small read. */
@@ -11049,15 +11050,16 @@ async function discoverTranscripts(cwd, harnesses, options = {}) {
11049
11050
  }));
11050
11051
  return kept.filter((candidate) => candidate !== null);
11051
11052
  }
11052
- /** Ingest batches stay well under the Runtime frame limit. */
11053
- const BATCH_MAX_BYTES = 8388608;
11053
+ /** Room left in a batch for the frame around its items: ids, harness, separators. */
11054
+ const ITEMS_MAX_BYTES = 8323072;
11055
+ const frameBytes = (value) => Buffer.byteLength(JSON.stringify(value));
11054
11056
  /** Split in order into batches of at most `count` items and the byte budget. */
11055
11057
  function* chunks(items, count, size = () => 0) {
11056
11058
  let batch = [];
11057
11059
  let bytes = 0;
11058
11060
  for (const item of items) {
11059
11061
  const itemBytes = size(item);
11060
- if (batch.length && (batch.length >= count || bytes + itemBytes > BATCH_MAX_BYTES)) {
11062
+ if (batch.length && (batch.length >= count || bytes + itemBytes > ITEMS_MAX_BYTES)) {
11061
11063
  yield batch;
11062
11064
  batch = [];
11063
11065
  bytes = 0;
@@ -11689,7 +11691,10 @@ var NativeIngest = class {
11689
11691
  result: item.settled ? this.complete(item.turn.result ?? this.cutOff(item, pending)) : null
11690
11692
  }
11691
11693
  }));
11692
- for (const batch of chunks(payloads, INGEST_BATCH_TURNS, (payload) => JSON.stringify(payload.turn).length)) {
11694
+ const sizes = new Map(payloads.map((payload) => [payload, frameBytes(payload.turn)]));
11695
+ for (const batch of chunks(payloads, INGEST_BATCH_TURNS, (payload) => sizes.get(payload) ?? 0)) {
11696
+ const [only] = batch;
11697
+ if (batch.length === 1 && only && (sizes.get(only) ?? 0) > ITEMS_MAX_BYTES) only.turn = await this.stage(state, transport, only.turn, known.get(only.item.turnId)?.sessionId);
11693
11698
  const result = await transport.ingest({
11694
11699
  type: "ingest",
11695
11700
  input: {
@@ -11719,6 +11724,49 @@ var NativeIngest = class {
11719
11724
  state.headTurnId = head;
11720
11725
  if (lastSettled) await this.archive(state, lastSettled.turn, lastSettled.turnId);
11721
11726
  }
11727
+ /**
11728
+ * Sends a settled Turn's messages in frames within the batch budget, resuming where the server's
11729
+ * staged messages end, and returns the Turn with an empty result tail to seal them.
11730
+ */
11731
+ async stage(state, transport, turn, sessionId) {
11732
+ const result = turn.result, stage = transport.messages;
11733
+ if (!result || !stage) return turn;
11734
+ const target = sessionId ?? (await transport.ingest({
11735
+ type: "ingest",
11736
+ input: {
11737
+ harness: state.harness,
11738
+ nativeSessionId: state.nativeSessionId,
11739
+ turns: [{
11740
+ ...turn,
11741
+ result: null
11742
+ }]
11743
+ }
11744
+ })).turns.find((entry) => entry.turnId === turn.turnId)?.sessionId;
11745
+ if (!target) throw new Error("Server did not record a native Turn");
11746
+ const send = (from, messages) => stage({
11747
+ type: "messages",
11748
+ sessionId: target,
11749
+ turnId: turn.turnId,
11750
+ input: {
11751
+ from,
11752
+ messages
11753
+ }
11754
+ });
11755
+ let from = Math.min((await send(0, [])).count, result.messages.length);
11756
+ for (const batch of chunks(result.messages.slice(from), STAGE_BATCH_MESSAGES, frameBytes)) {
11757
+ const { count } = await send(from, batch);
11758
+ if (count !== from + batch.length) throw new Error("Server staged an unexpected number of native messages");
11759
+ from = count;
11760
+ }
11761
+ return {
11762
+ ...turn,
11763
+ result: {
11764
+ ...result,
11765
+ from,
11766
+ messages: []
11767
+ }
11768
+ };
11769
+ }
11722
11770
  markRunning(state, sessionId, item) {
11723
11771
  const changed = state.runningTurnId !== item.turnId;
11724
11772
  state.sessionId = sessionId;
package/dist/chunks/me.js CHANGED
@@ -9,6 +9,7 @@ function parseInteger(value, name, min) {
9
9
  }
10
10
  return parsed;
11
11
  }
12
+ const usd = (value) => `${value < 0 ? "-" : ""}$${Math.abs(value).toFixed(2)}`;
12
13
  function registerMe(program) {
13
14
  const meCmd = program.command("me").description("Account-level data across your spaces");
14
15
  meCmd.command("sessions").alias("list-sessions").description("List sessions you created across all spaces (archived sessions are hidden by default)").option("--limit <n>", "Maximum number of sessions (default 20)").option("--cursor <cursor>", "Pagination cursor from a previous result").option("--archived", "List only archived sessions").option("--all", "Include archived sessions").option("--json", "Output as JSON").action(async (opts) => {
@@ -51,34 +52,63 @@ function registerMe(program) {
51
52
  handleHttp(e);
52
53
  }
53
54
  });
54
- meCmd.command("billing-activity").description("List your personal wallet activity, including generation reserves and refunds").option("--page <n>", "Page number (default 1)").option("--json", "Output as JSON").action(async (opts) => {
55
+ meCmd.command("billing").description("Show your balance, current plan, and credits expiring soon").option("--json", "Output as JSON").action(async (opts) => {
55
56
  const client = createClient();
56
57
  try {
57
- const { activities } = await client.billing.getBalanceActivities({ page: opts.page ? parseInteger(opts.page, "page", 1) : void 0 });
58
- if (jsonRequested(opts)) return json(activities);
59
- if (activities.items.length === 0) {
60
- console.log(" (empty)");
58
+ const [credits, { catalog }] = await Promise.all([client.billing.getCredits(), client.billing.getCatalog()]);
59
+ const plan = catalog.currentSubscriptions.find((item) => item.status === "active" || item.status === "trialing") ?? catalog.currentSubscriptions.find((item) => item.status === "past_due") ?? null;
60
+ if (jsonRequested(opts)) return json({
61
+ credits,
62
+ plan
63
+ });
64
+ if (!catalog.billing.configured) {
65
+ console.log(" Billing is not enabled on this server");
61
66
  return;
62
67
  }
68
+ console.log(` Balance ${usd(credits.netUsd)}`);
69
+ const period = plan?.currentPeriodEnd ? `, ${plan.cancelAtPeriodEnd ? "ends" : "renews"} ${formatLocalDateTime(plan.currentPeriodEnd)}` : "";
70
+ console.log(` Plan ${plan ? `${plan.productName ?? plan.productKey} (${plan.status}${period})` : "Free"}`);
71
+ for (const group of credits.groups) if (group.key === "lt_7d" || group.key === "lt_30d") console.log(` Expiring ${usd(group.remainingAmountUsd)} within ${group.key === "lt_7d" ? 7 : 30} days`);
72
+ } catch (e) {
73
+ handleHttp(e);
74
+ }
75
+ });
76
+ meCmd.command("billing-activity").description("List your personal wallet activity, newest first").option("--filter <filter>", "Only show usage, grant, or refund activity").option("--limit <n>", "Activities per page (default 50, max 100)").option("--cursor <cursor>", "Pagination cursor from a previous result").option("--json", "Output as JSON").action(async (opts) => {
77
+ if (opts.filter && ![
78
+ "usage",
79
+ "grant",
80
+ "refund"
81
+ ].includes(opts.filter)) {
82
+ process.stderr.write("\n ✗ Invalid filter\n filter must be usage, grant, or refund\n\n");
83
+ process.exit(1);
84
+ }
85
+ const client = createClient();
86
+ try {
87
+ const { activities } = await client.billing.getBalanceActivities({
88
+ filter: opts.filter,
89
+ limit: opts.limit ? parseInteger(opts.limit, "limit", 1) : void 0,
90
+ cursor: opts.cursor ?? null
91
+ });
92
+ if (jsonRequested(opts)) return json(activities);
63
93
  table(activities.items, [
64
94
  {
65
95
  key: "title",
66
96
  label: "Activity"
67
97
  },
68
98
  {
69
- key: "amountUsd",
70
- label: "Amount (USD)"
99
+ key: "description",
100
+ label: "Detail"
71
101
  },
72
102
  {
73
- key: "operationId",
74
- label: "Operation"
103
+ key: "amountUsd",
104
+ label: "Amount (USD)"
75
105
  },
76
106
  {
77
107
  key: "createdAt",
78
108
  label: "Date"
79
109
  }
80
110
  ]);
81
- if (activities.pagination.hasMore) console.log(` More: --page ${activities.page + 1}`);
111
+ if (activities.nextCursor) console.log(`\n More: --cursor ${activities.nextCursor}`);
82
112
  } catch (e) {
83
113
  handleHttp(e);
84
114
  }
@@ -220,9 +220,14 @@ const nativeTurnProgressSchema = object({
220
220
  from: number().int().nonnegative().max(1e4).optional(),
221
221
  messages: array(nativeTurnMessageSchema).max(1e4)
222
222
  }).strict();
223
- /** Final, immutable Turn receipt. Native bytes are archived separately, without lossy normalization. */
223
+ const messageOrdinal = number().int().nonnegative().max(1e4);
224
+ /**
225
+ * Final, immutable Turn receipt. Native bytes are archived separately, without lossy normalization.
226
+ * `messages` start at ordinal `from`; earlier ones were staged with `messages` events.
227
+ */
224
228
  const nativeTurnCompleteSchema = object({
225
229
  messages: array(nativeTurnMessageSchema).max(1e4),
230
+ from: messageOrdinal.optional(),
226
231
  status: _enum([
227
232
  "completed",
228
233
  "failed",
@@ -230,6 +235,11 @@ const nativeTurnCompleteSchema = object({
230
235
  ]),
231
236
  completedAt: datetime()
232
237
  }).strict();
238
+ /** Stages a registered Turn's messages from ordinal `from`, so no frame has to carry a whole Turn. */
239
+ const nativeTurnMessagesSchema = object({
240
+ from: messageOrdinal,
241
+ messages: array(nativeTurnMessageSchema).max(1e4)
242
+ }).strict();
233
243
  /** Durable ingest of one transcript's Turns. */
234
244
  const nativeIngestTurnSchema = object({
235
245
  turnId: id$1,
@@ -288,6 +298,12 @@ const nativeRuntimeEventSchema = discriminatedUnion("type", [
288
298
  turnId: id$1,
289
299
  progress: nativeTurnProgressSchema
290
300
  }).strict(),
301
+ object({
302
+ type: literal("messages"),
303
+ sessionId: id$1,
304
+ turnId: id$1,
305
+ input: nativeTurnMessagesSchema
306
+ }).strict(),
291
307
  object({
292
308
  type: literal("status"),
293
309
  sessionId: id$1,
@@ -1549,11 +1549,9 @@ function registerSpaceWallet(spaces) {
1549
1549
  handleHttp(cause);
1550
1550
  }
1551
1551
  });
1552
- wallet.command("activity").option("--page <page>", "Page number", "1").option("--json", "Output as JSON").action(async (opts) => {
1552
+ wallet.command("activity").description("List wallet activity, newest first").option("--cursor <cursor>", "Pagination cursor from a previous result").option("--json", "Output as JSON").action(async (opts) => {
1553
1553
  try {
1554
- const page = Number(opts.page);
1555
- if (!Number.isInteger(page) || page < 1 || page > 1e4) throw new Error("Page must be an integer between 1 and 10000");
1556
- const value = await (await space()).activities(page);
1554
+ const value = await (await space()).activities(opts.cursor);
1557
1555
  if (jsonRequested(opts)) return json(value);
1558
1556
  table(value.items, [
1559
1557
  {
@@ -1573,6 +1571,7 @@ function registerSpaceWallet(spaces) {
1573
1571
  label: "Date"
1574
1572
  }
1575
1573
  ]);
1574
+ if (value.nextCursor) console.log(`\n More: --cursor ${value.nextCursor}`);
1576
1575
  } catch (cause) {
1577
1576
  handleHttp(cause);
1578
1577
  }
@@ -647,7 +647,7 @@ async function connect(options) {
647
647
  const timer = setTimeout(() => {
648
648
  nativePending.delete(requestId);
649
649
  reject(/* @__PURE__ */ new Error("Native Runtime event timed out"));
650
- }, event.type === "ingest" ? 12e4 : 3e4);
650
+ }, event.type === "ingest" || event.type === "messages" ? 12e4 : 3e4);
651
651
  nativePending.set(requestId, {
652
652
  resolve,
653
653
  reject,
@@ -865,7 +865,10 @@ async function connect(options) {
865
865
  }, { connectionId });
866
866
  nativeChannelReady = true;
867
867
  capabilitiesFrame = frame.features?.includes("capabilities") === true;
868
- options.onNativeChannel?.(sendNative, { approvals: frame.features?.includes("approvals") === true });
868
+ options.onNativeChannel?.(sendNative, {
869
+ approvals: frame.features?.includes("approvals") === true,
870
+ nativeMessages: frame.features?.includes("nativeMessages") === true
871
+ });
869
872
  options.onReady();
870
873
  options.announce.current = announceHere;
871
874
  options.catalog.publish = publishCatalog;
@@ -1625,7 +1628,7 @@ var NativeSessions = class {
1625
1628
  * Transcript ingest travels over the existing Runtime WebSocket: one connection, one credential, no
1626
1629
  * second channel and no local receipts.
1627
1630
  */
1628
- function nativeWebSocketTransport(send) {
1631
+ function nativeWebSocketTransport(send, features = {}) {
1629
1632
  const call = async (event, options) => {
1630
1633
  options?.signal?.throwIfAborted();
1631
1634
  return await send(event);
@@ -1637,6 +1640,7 @@ function nativeWebSocketTransport(send) {
1637
1640
  input: { turnIds }
1638
1641
  }, options)).turns,
1639
1642
  progress: (event, options) => call(event, options),
1643
+ ...features.messages ? { messages: (event, options) => call(event, options) } : {},
1640
1644
  status: (sessionId, turnId, controllable, options) => call({
1641
1645
  type: "status",
1642
1646
  sessionId,
@@ -1778,10 +1782,10 @@ var NativeRuntime = class {
1778
1782
  await this.ingest.watch(signal).catch(degraded("native.watch_unavailable"));
1779
1783
  if (this.codex.enabled) this.codex.get();
1780
1784
  }
1781
- /** `approvals`: the Gateway relays approval decisions back. */
1785
+ /** `approvals`: the Gateway relays approval decisions back. `nativeMessages`: a large Turn is sent in several frames. */
1782
1786
  connect(send, features = {}) {
1783
1787
  this.send = send;
1784
- this.ingest.connect(send ? nativeWebSocketTransport(send) : null);
1788
+ this.ingest.connect(send ? nativeWebSocketTransport(send, { messages: features.nativeMessages }) : null);
1785
1789
  this.approvals.connect(send && features.approvals ? send : null);
1786
1790
  }
1787
1791
  stop(sessionId, turnId) {
@@ -1,4 +1,4 @@
1
- import { A as invertMatrix, C as clampBoardFontSize, I as scaleVector, M as layoutBoardText, N as matrixRotation, T as drawPointsBounds, W as BOARD_CAMERA_TARGET, Z as BOARD_SHADOW_DEFAULTS, _ as IDENTITY_MATRIX, b as arrowBindings, et as BoardColorSchema, g as resolveBoardProperty, nt as BoardIdSchema, r as sameJson, t as createBoardEntityId, u as applyBoardPatchToDocument, w as createBoardLayout, y as applyMatrix } from "./id.js";
1
+ import { A as invertMatrix, C as clampBoardFontSize, I as scaleVector, M as layoutBoardText, N as matrixRotation, T as drawPointsBounds, W as BOARD_CAMERA_TARGET, Z as BOARD_SHADOW_DEFAULTS, _ as IDENTITY_MATRIX, b as arrowBindings, et as BoardColorSchema, g as resolveBoardProperty, ht as BOARD_CAMERA_VIEWPORT, nt as BoardIdSchema, r as sameJson, t as createBoardEntityId, u as applyBoardPatchToDocument, w as createBoardLayout, y as applyMatrix } from "./id.js";
2
2
  //#region ../sdk/src/board/model/geometry.ts
3
3
  function screenPoint(x, y) {
4
4
  return {
@@ -13,14 +13,20 @@ function worldPoint(x, y) {
13
13
  };
14
14
  }
15
15
  const MIN_BOARD_ZOOM = .05;
16
+ const LEAST_BOARD_ZOOM = .001;
16
17
  const DEFAULT_BOARD_VIEWPORT = {
17
18
  x: 0,
18
19
  y: 0,
19
20
  zoom: 1
20
21
  };
21
- function clampZoom(zoom) {
22
+ function clampZoom(zoom, min = LEAST_BOARD_ZOOM) {
22
23
  const value = Number.isFinite(zoom) ? zoom : DEFAULT_BOARD_VIEWPORT.zoom;
23
- return Math.min(8, Math.max(MIN_BOARD_ZOOM, value));
24
+ return Math.min(8, Math.max(min, value));
25
+ }
26
+ function boardZoomFloor(content, surface) {
27
+ if (!content || content.width <= 0 || content.height <= 0 || surface.width <= 0 || surface.height <= 0) return MIN_BOARD_ZOOM;
28
+ const fit = Math.min(Math.max(1, surface.width - 128) / content.width, Math.max(1, surface.height - 128) / content.height);
29
+ return clampZoom(Math.min(MIN_BOARD_ZOOM, fit));
24
30
  }
25
31
  function normalizeViewport(viewport, fallback = DEFAULT_BOARD_VIEWPORT) {
26
32
  const fallbackX = Number.isFinite(fallback.x) ? fallback.x : DEFAULT_BOARD_VIEWPORT.x;
@@ -372,9 +378,9 @@ function normalizeRotation(degrees) {
372
378
  function pointToWorld(point, viewport) {
373
379
  return worldPoint((point.x - viewport.x) / viewport.zoom, (point.y - viewport.y) / viewport.zoom);
374
380
  }
375
- function zoomAround(viewport, anchor, nextZoom) {
381
+ function zoomAround(viewport, anchor, nextZoom, minZoom) {
376
382
  const current = normalizeViewport(viewport);
377
- const zoom = Number.isFinite(nextZoom) ? clampZoom(nextZoom) : current.zoom;
383
+ const zoom = Number.isFinite(nextZoom) ? clampZoom(nextZoom, minZoom) : current.zoom;
378
384
  const world = pointToWorld(anchor, current);
379
385
  return {
380
386
  x: anchor.x - world.x * zoom,
@@ -410,7 +416,7 @@ function cameraForRect(content, surface, options = {}) {
410
416
  const availableW = Math.max(1, surface.width - padding * 2);
411
417
  const availableH = Math.max(1, surface.height - padding * 2);
412
418
  const fitZoom = options.fit === "cover" ? Math.max(availableW / content.width, availableH / content.height) : Math.min(availableW / content.width, availableH / content.height);
413
- const minZoom = clampZoom(options.minZoom ?? .05);
419
+ const minZoom = clampZoom(options.minZoom ?? 0);
414
420
  const maxZoom = clampZoom(options.maxZoom ?? 8);
415
421
  const zoom = Math.min(Math.max(fitZoom, Math.min(minZoom, maxZoom)), Math.max(minZoom, maxZoom));
416
422
  const center = rectCenter(content);
@@ -684,6 +690,63 @@ export function draw(ctx, { width, height, state }) {
684
690
  ctx.fill();
685
691
  }
686
692
  `;
693
+ const BOARD_SCRIPT_SPARKS_EXAMPLE = `export default function (ctx) {
694
+ ctx.state.sparks = [];
695
+ ctx.state.peers = [];
696
+ ctx.hitRegions({ pad: { target: "self", label: "Make sparks" } });
697
+
698
+ // Every viewer receives the burst, this one included, so everyone sees it.
699
+ ctx.on("click", ({ point }) => ctx.broadcast("burst", { x: point.x, y: point.y }));
700
+
701
+ let stop = null;
702
+ const step = ({ dt }) => {
703
+ const s = dt / 1000;
704
+ ctx.state.sparks = ctx.state.sparks.filter((p) => {
705
+ p.x += p.vx * s;
706
+ p.y += p.vy * s;
707
+ p.vy += 240 * s;
708
+ p.life -= s * 1.4;
709
+ return p.life > 0;
710
+ });
711
+ if (!ctx.state.sparks.length && stop) {
712
+ stop();
713
+ stop = null;
714
+ }
715
+ };
716
+ ctx.on("burst", ({ data, peer }) => {
717
+ for (let i = 0; i < 24; i++) {
718
+ const angle = ctx.random() * Math.PI * 2;
719
+ const speed = 60 + ctx.random() * 140;
720
+ ctx.state.sparks.push({ x: data.x, y: data.y, vx: Math.cos(angle) * speed, vy: Math.sin(angle) * speed, life: 1, color: peer?.color ?? "#e67845" });
721
+ }
722
+ stop ??= ctx.onFrame(step);
723
+ });
724
+
725
+ ctx.on("peerschange", ({ data }) => {
726
+ ctx.state.peers = data;
727
+ ctx.invalidate();
728
+ });
729
+ }
730
+
731
+ export function draw(ctx, { state }) {
732
+ for (const peer of state.peers) {
733
+ if (!peer.point) continue;
734
+ ctx.strokeStyle = ctx.fillStyle = peer.color;
735
+ ctx.globalAlpha = peer.pressed ? 0.35 : 0.6;
736
+ ctx.beginPath();
737
+ ctx.arc(peer.point.x, peer.point.y, 18, 0, Math.PI * 2);
738
+ if (peer.pressed) ctx.fill();
739
+ else ctx.stroke();
740
+ }
741
+ for (const p of state.sparks) {
742
+ ctx.globalAlpha = p.life;
743
+ ctx.fillStyle = p.color;
744
+ ctx.beginPath();
745
+ ctx.arc(p.x, p.y, 2 + 3 * p.life, 0, Math.PI * 2);
746
+ ctx.fill();
747
+ }
748
+ }
749
+ `;
687
750
  //#endregion
688
751
  //#region ../sdk/src/board/model/animation.ts
689
752
  const linear = (x) => x;
@@ -1022,13 +1085,16 @@ function outranks(track, time, other, otherTime) {
1022
1085
  function evaluateBoardAnimations(compiled, times, options = {}) {
1023
1086
  const resolveColor = options.resolveColor ?? parseAnimationColor;
1024
1087
  const local = new Map(times instanceof Map ? times : Object.entries(times));
1088
+ const nester = /* @__PURE__ */ new Map();
1025
1089
  for (const id of compiled.order) {
1026
1090
  const animation = compiled.animations.get(id);
1027
1091
  const time = local.get(id);
1028
1092
  if (!animation || time === void 0) continue;
1029
1093
  for (const track of animation.children) {
1030
1094
  const value = sampleBoardTrack(track, time, resolveColor);
1031
- if (typeof value === "number") local.set(track.target, Math.max(0, value));
1095
+ if (typeof value !== "number") continue;
1096
+ local.set(track.target, Math.max(0, value));
1097
+ nester.set(track.target, id);
1032
1098
  }
1033
1099
  }
1034
1100
  const groups = /* @__PURE__ */ new Map();
@@ -1049,17 +1115,20 @@ function evaluateBoardAnimations(compiled, times, options = {}) {
1049
1115
  }
1050
1116
  if (track.composite === "add") {
1051
1117
  group.adds.push([track, time]);
1118
+ group.source ??= id;
1052
1119
  continue;
1053
1120
  }
1054
1121
  if (!group.winner || outranks(track, time, group.winner, group.winnerTime)) {
1055
1122
  group.winner = track;
1056
1123
  group.winnerTime = time;
1124
+ group.source = id;
1057
1125
  }
1058
1126
  }
1059
1127
  }
1060
1128
  const items = /* @__PURE__ */ new Map();
1061
1129
  const scripts = /* @__PURE__ */ new Map();
1062
1130
  const camera = {};
1131
+ let cameraSource;
1063
1132
  const ordered = [...groups.values()].sort((a, b) => a.path.length - b.path.length);
1064
1133
  for (const group of ordered) {
1065
1134
  const isCamera = group.target === BOARD_CAMERA_TARGET;
@@ -1082,6 +1151,7 @@ function evaluateBoardAnimations(compiled, times, options = {}) {
1082
1151
  }
1083
1152
  if (isCamera) {
1084
1153
  camera[group.path[0]] = value;
1154
+ cameraSource ??= group.source;
1085
1155
  continue;
1086
1156
  }
1087
1157
  if (script) {
@@ -1098,10 +1168,17 @@ function evaluateBoardAnimations(compiled, times, options = {}) {
1098
1168
  }
1099
1169
  items.set(group.target, next);
1100
1170
  }
1171
+ let cameraViewport;
1172
+ const visited = /* @__PURE__ */ new Set();
1173
+ for (let id = cameraSource; id && !cameraViewport && !visited.has(id); id = nester.get(id)) {
1174
+ visited.add(id);
1175
+ cameraViewport = compiled.document.animations[id]?.viewport;
1176
+ }
1101
1177
  return {
1102
1178
  items,
1103
1179
  scripts,
1104
1180
  camera,
1181
+ cameraViewport,
1105
1182
  times: local
1106
1183
  };
1107
1184
  }
@@ -1516,9 +1593,13 @@ function createBoardAnimationSampler(document, animation, options = {}) {
1516
1593
  at(time) {
1517
1594
  if (current?.time === time) return current.value;
1518
1595
  const sampled = stateAt(time);
1596
+ let scene;
1519
1597
  const value = {
1520
1598
  ...sampled,
1521
- scene: buildBoardScene(sampled.document)
1599
+ get scene() {
1600
+ scene ??= buildBoardScene(sampled.document);
1601
+ return scene;
1602
+ }
1522
1603
  };
1523
1604
  current = {
1524
1605
  time,
@@ -1528,12 +1609,24 @@ function createBoardAnimationSampler(document, animation, options = {}) {
1528
1609
  }
1529
1610
  };
1530
1611
  }
1612
+ function boardCameraScale(surface, viewport = BOARD_CAMERA_VIEWPORT) {
1613
+ return Math.min(surface.width / viewport.width, surface.height / viewport.height);
1614
+ }
1531
1615
  function resolveBoardAnimationCamera(override, bounds, surface, time, base = {
1532
1616
  x: 0,
1533
1617
  y: 0,
1534
1618
  zoom: 1
1535
- }) {
1536
- let camera = override.focus === void 0 ? base : cameraForFocus(override.focus, bounds, surface, { padding: 48 }) ?? base;
1619
+ }, viewport = BOARD_CAMERA_VIEWPORT) {
1620
+ const scale = boardCameraScale(surface, viewport);
1621
+ if (!(scale > 0) || Object.keys(override).length === 0) return base;
1622
+ const left = (surface.width - viewport.width * scale) / 2;
1623
+ const top = (surface.height - viewport.height * scale) / 2;
1624
+ const framed = {
1625
+ x: (base.x - left) / scale,
1626
+ y: (base.y - top) / scale,
1627
+ zoom: base.zoom / scale
1628
+ };
1629
+ let camera = override.focus === void 0 ? framed : cameraForFocus(override.focus, bounds, viewport, { padding: 48 }) ?? framed;
1537
1630
  if (override.zoom !== void 0) camera = {
1538
1631
  ...camera,
1539
1632
  zoom: override.zoom
@@ -1542,13 +1635,17 @@ function resolveBoardAnimationCamera(override, bounds, surface, time, base = {
1542
1635
  centerX: override.center.x,
1543
1636
  centerY: override.center.y,
1544
1637
  zoom: camera.zoom
1545
- }, surface);
1638
+ }, viewport);
1546
1639
  if (override.shake) camera = {
1547
1640
  ...camera,
1548
1641
  x: camera.x + Math.sin(time / 1e3 * 91.3) * override.shake,
1549
1642
  y: camera.y + Math.cos(time / 1e3 * 77.9) * override.shake
1550
1643
  };
1551
- return camera;
1644
+ return {
1645
+ x: camera.x * scale + left,
1646
+ y: camera.y * scale + top,
1647
+ zoom: camera.zoom * scale
1648
+ };
1552
1649
  }
1553
1650
  const VISIBLE = "visible";
1554
1651
  function newBoardTrackId(tracks, target, property) {
@@ -2895,4 +2992,4 @@ const BOARD_THEME_DATA = {
2895
2992
  }
2896
2993
  };
2897
2994
  //#endregion
2898
- export { rectCenter as $, compileBoardAnimations as A, clampZoom as B, resolveBoardAnimationCamera as C, sceneItemToItem as D, refreshBoardScene as E, BOARD_SCRIPT_SENSES_EXAMPLE as F, frameEdgeHandleAt as G, effectBounds as H, BOARD_SCRIPT_TILT_EXAMPLE as I, itemBounds as J, frameHandlePosition as K, CORNER_RESIZE_HANDLES as L, withBoardScripts as M, BOARD_SCRIPT_DRAWING_EXAMPLE as N, BOARD_SCRIPT_HISTORY_MS as O, BOARD_SCRIPT_RAIN_EXAMPLE as P, pointToWorld as Q, cameraForRect as R, createBoardAnimationSampler as S, placeItem as T, frameContainsPoint as U, degToRad as V, frameCornerRotationHandleAt as W, normalizeViewport as X, normalizeRotation as Y, panBy as Z, boardSplitTarget as _, boardNavigableFrames as a, rotationHandlePosition as at, findBoardKeyTrack as b, boardPathTrack as c, selectionBounds as ct, boardSequencePatch as d, visibleWorldRect as dt, rectContainsPoint as et, boardInsertTime as f, worldPoint as ft, boardShiftTargets as g, boardRemoveTime as h, boardFrameRegions as i, rotatePointAround as it, evaluateBoardAnimations as j, boardAnimatesScriptParams as k, boardPlacePatch as l, stateForCamera as lt, boardRemoveTarget as m, BOARD_THEME_IDS as n, resizeFrame as nt, boardReadingOrder as o, scaleFrames as ot, boardPlaceTarget as p, zoomAround as pt, frameRect as q, boardFrameRegion as r, rotateFrames as rt, boardRegionStep as s, screenPoint as st, BOARD_THEME_DATA as t, rectsIntersect as tt, boardSequence as u, unionRects as ut, boardTargetSpan as v, buildBoardScene as w, newBoardTrackId as x, boardTrimTarget as y, cameraForState as z };
2995
+ export { panBy as $, boardAnimatesScriptParams as A, boardZoomFloor as B, createBoardAnimationSampler as C, refreshBoardScene as D, placeItem as E, BOARD_SCRIPT_RAIN_EXAMPLE as F, frameContainsPoint as G, cameraForState as H, BOARD_SCRIPT_SENSES_EXAMPLE as I, frameHandlePosition as J, frameCornerRotationHandleAt as K, BOARD_SCRIPT_SPARKS_EXAMPLE as L, evaluateBoardAnimations as M, withBoardScripts as N, sceneItemToItem as O, BOARD_SCRIPT_DRAWING_EXAMPLE as P, normalizeViewport as Q, BOARD_SCRIPT_TILT_EXAMPLE as R, boardCameraScale as S, buildBoardScene as T, degToRad as U, cameraForRect as V, effectBounds as W, itemBounds as X, frameRect as Y, normalizeRotation as Z, boardSplitTarget as _, boardNavigableFrames as a, rotateFrames as at, findBoardKeyTrack as b, boardPathTrack as c, scaleFrames as ct, boardSequencePatch as d, stateForCamera as dt, pointToWorld as et, boardInsertTime as f, unionRects as ft, boardShiftTargets as g, boardRemoveTime as h, zoomAround as ht, boardFrameRegions as i, resizeFrame as it, compileBoardAnimations as j, BOARD_SCRIPT_HISTORY_MS as k, boardPlacePatch as l, screenPoint as lt, boardRemoveTarget as m, worldPoint as mt, BOARD_THEME_IDS as n, rectContainsPoint as nt, boardReadingOrder as o, rotatePointAround as ot, boardPlaceTarget as p, visibleWorldRect as pt, frameEdgeHandleAt as q, boardFrameRegion as r, rectsIntersect as rt, boardRegionStep as s, rotationHandlePosition as st, BOARD_THEME_DATA as t, rectCenter as tt, boardSequence as u, selectionBounds as ut, boardTargetSpan as v, resolveBoardAnimationCamera as w, newBoardTrackId as x, boardTrimTarget as y, CORNER_RESIZE_HANDLES as z };
@@ -0,0 +1,16 @@
1
+ //#region ../protocol/src/user-lists.ts
2
+ const USER_APP_FILTERS = [
3
+ "mine",
4
+ "all",
5
+ "disabled"
6
+ ];
7
+ const USER_CRONJOB_FILTERS = [
8
+ "mine",
9
+ "all",
10
+ "paused",
11
+ "attention"
12
+ ];
13
+ const isUserAppFilter = (value) => USER_APP_FILTERS.includes(value);
14
+ const isUserCronJobFilter = (value) => USER_CRONJOB_FILTERS.includes(value);
15
+ //#endregion
16
+ export { isUserCronJobFilter as n, isUserAppFilter as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub-cli",
3
- "version": "10.25.1",
3
+ "version": "10.27.0",
4
4
  "description": "CLI for Cohub — spaces, sessions, and agent collaboration.",
5
5
  "type": "module",
6
6
  "engines": {
@@ -33,7 +33,7 @@
33
33
  "@fontsource-variable/figtree": "^5.3.0",
34
34
  "@fontsource-variable/geist": "^5.3.0",
35
35
  "@fontsource-variable/geist-mono": "^5.3.0",
36
- "@neta-art/cohub": "13.16.0",
36
+ "@neta-art/cohub": "13.18.0",
37
37
  "@types/node": "26.6.4",
38
38
  "@types/ws": "^8.18.1",
39
39
  "commander": "^15.0.0",