@neta-art/cohub-cli 10.26.0 → 10.27.1

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.
@@ -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
  }
@@ -211,7 +211,7 @@ const ensureSandboxdBinary = async (options = {}) => {
211
211
  if (!await isExecutableFile(override)) throw new SandboxdDownloadError(`COHUB_SANDBOXD_BIN=${override} is not a file`);
212
212
  return override;
213
213
  }
214
- const version = options.version?.trim() || "v2.96.0";
214
+ const version = options.version?.trim() || "v2.98.0";
215
215
  const target = resolveTarget();
216
216
  const cached = cachedBinaryPath(version, target);
217
217
  if (await isExecutableFile(cached)) return cached;
@@ -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.26.0",
3
+ "version": "10.27.1",
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.17.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",