@neta-art/cohub 8.16.0 → 8.18.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.
@@ -0,0 +1 @@
1
+ import { z } from "zod";
@@ -1,3 +1,4 @@
1
+ import "./app-authorization.js";
1
2
  import { BOARD_STROKE_MAX_SIZE, BOARD_STROKE_MIN_SIZE, BoardCapability, BoardCoordinateSpace, BoardRenderCost, clampBoardStrokeSize } from "./board-constants.js";
2
3
  import { AUTO_BOARD_CONNECTION_ANCHOR, BOARD_CONNECTION_DIRECTIONS, BOARD_CONNECTION_LINES, BOARD_CONNECTION_ROUTINGS, BOARD_CONNECTION_SIDES, BoardConnection, BoardConnectionAnchor, BoardConnectionAnchorSchema, BoardConnectionDirection, BoardConnectionEndpoint, BoardConnectionEndpointSchema, BoardConnectionInput, BoardConnectionLine, BoardConnectionPatch, BoardConnectionPatchSchema, BoardConnectionRecord, BoardConnectionRouting, BoardConnectionRoutingConfig, BoardConnectionRoutingSchema, BoardConnectionSchema, BoardConnectionSide, BoardConnectionStyle, BoardConnectionStyleSchema, BoardConnectionWaypointSchema, BoardRelationSchema, DEFAULT_BOARD_CONNECTION_ROUTING, DEFAULT_BOARD_CONNECTION_STYLE, DEFAULT_BOARD_RELATION, connectionItemIds, connectionOtherItemId, connectionTouchesItem, createBoardConnection, flipBoardConnection, normalizeBoardConnectionStyle } from "./board-connection.js";
3
4
  import { BoardAnimationTarget, BoardAnimationTargetSchema, BoardComposition, BoardCompositionInput, BoardCompositionInputSchema, BoardCompositionSchema, BoardEasing, BoardEasingSchema, BoardProceduralClip, BoardProceduralClipSchema, BoardTimelineMarker, BoardTimelineMarkerSchema, BoardTrack, BoardTrackInterpolation, BoardTrackSchema } from "./board-composition.js";
@@ -11,6 +12,9 @@ import { BOARD_COLOR_IDS, BOARD_GEO_KINDS, BoardColorId, BoardGeoKind } from "./
11
12
  import "./board-codec.js";
12
13
  import "./board-content.js";
13
14
  import { BoardArrowGeometryInput, boardArrowFrame, boardDrawBounds, boardDrawSampleRadius } from "./board-geometry.js";
15
+ import "./runtime/index.js";
16
+ import "./model/turn.js";
17
+ import "./model/session.js";
14
18
  import "./realtime/board-awareness.js";
15
19
  import "./app.js";
16
20
  import "./realtime/types.js";
@@ -0,0 +1 @@
1
+ import "./turn.js";
@@ -0,0 +1 @@
1
+ import "../runtime/index.js";
@@ -1,5 +1,7 @@
1
1
  import "../board-composition.js";
2
2
  import "../board-effect.js";
3
3
  import "../board.js";
4
+ import "../model/turn.js";
5
+ import "../model/session.js";
4
6
  import "./board-awareness.js";
5
7
  import "../app.js";
@@ -0,0 +1 @@
1
+ import { z } from "zod";
@@ -0,0 +1 @@
1
+ import "./index.js";
@@ -0,0 +1,3 @@
1
+ import "./archive.js";
2
+ import "./context.js";
3
+ import { z } from "zod";
package/dist/types.d.ts CHANGED
@@ -3,6 +3,7 @@ import { BoardAnimationTarget, BoardComposition, BoardEasing, BoardProceduralCli
3
3
  import { BoardAssetRef, BoardEffect, BoardEffectInput } from "./protocol/dist/board-effect.js";
4
4
  import { BoardAuthoringItem, BoardAuthoringSnapshot, BoardSemanticCommand } from "./protocol/dist/board-authoring.js";
5
5
  import { BoardCameraFocus, BoardCameraFocusParams, BoardCameraState, BoardDiagnostic, BoardManifest, BoardMutationReceipt, BoardPlaybackSnapshot, BoardRecord, BoardTransactionOperation, BoardTransactionRecord, BoardTransactionsPage, BoardValidationResult } from "./protocol/dist/board.js";
6
+ import "./protocol/dist/model/session.js";
6
7
  import "./protocol/dist/index.js";
7
8
  //#region src/types.d.ts
8
9
  type UserProfile = {
@@ -1,8 +1,9 @@
1
1
  # Cohub App Runtime Guide
2
2
 
3
- This guide explains how to use the Cohub SDK **inside a published App** — the
4
- only environment where runtime APIs (`context()`, `auth.request`,
5
- `app.commerce.*`, `app.realtime.*`) function. Read this before building any
3
+ This guide explains the Cohub SDK in a published App iframe or an explicitly
4
+ configured standalone broker. New Apps should use `auth.authorize()`; see the
5
+ [authorization contract](../../../docs/app-authorization.md). Legacy APIs below
6
+ retain their original return types. Read this before building any
6
7
  App that calls Cohub capabilities from browser-side JavaScript.
7
8
 
8
9
  It is written to be self-contained: an agent or developer who reads only this
@@ -72,10 +73,9 @@ These runtime-only APIs form the foundation; everything else is standard SDK:
72
73
  | `client.context().permissions.viewerGrants` | Render the viewer's current per-space grants | `{ spaceId, scopes }[]` |
73
74
  | `client.app.commerce.*` / `client.app.realtime.*` | Commerce and realtime, bound to the app's runtime identity | (see below) |
74
75
 
75
- > **Runtime-only constraint.** These APIs only work inside a **published**
76
- > App. Outside that context (a static asset URL, a local `file://` preview,
77
- > a plain Node script) `context()` returns `null` and the other runtime APIs
78
- > fail. Always develop against a published App.
76
+ > **Runtime requirement.** Use a published App iframe or explicitly configure
77
+ > a broker. A standalone page without broker configuration has no runtime.
78
+ > Initialize `context()` before using APIs to discover Host capabilities.
79
79
 
80
80
  `client.app.onContextChanged(listener)` pushes a fresh context whenever the
81
81
  host's state changes (sign-in, invocation, grants), so an App can render its
@@ -134,14 +134,14 @@ a direct static-asset URL not wrapped in the Cohub iframe. The SDK opens a
134
134
 
135
135
  ```js
136
136
  const ctx = await client.context();
137
- const isBroker = !ctx?.space?.id; // bridge has a real id; broker is ""
137
+ const isBroker = ctx?.mode === "broker";
138
138
  ```
139
139
 
140
140
  In broker mode you cannot get a spaceId from `context()`. Resolve it via the
141
141
  public by-slug App API (anonymous, no token needed):
142
142
 
143
143
  ```js
144
- const isBroker = !ctx?.space?.id;
144
+ const isBroker = ctx?.mode === "broker";
145
145
  let spaceId;
146
146
  if (isBroker) {
147
147
  const detail = await client.apps.getBySlug(ownerUsername, spaceSlug, appSlug);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neta-art/cohub",
3
- "version": "8.16.0",
3
+ "version": "8.18.0",
4
4
  "description": "Cohub SDK for spaces, sessions, boards, and realtime agent collaboration.",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,