@neta-art/cohub 8.17.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.
- package/dist/chunks/environment.d.ts +510 -3
- package/dist/chunks/http.d.ts +47 -2
- package/dist/chunks/http.js +972 -943
- package/dist/chunks/websocket.d.ts +1 -1
- package/dist/http.d.ts +2 -2
- package/dist/index.d.ts +35 -4
- package/dist/index.js +823 -30
- package/dist/protocol/dist/app-authorization.d.ts +1 -0
- package/dist/protocol/dist/index.d.ts +4 -0
- package/dist/protocol/dist/model/session.d.ts +1 -0
- package/dist/protocol/dist/model/turn.d.ts +1 -0
- package/dist/protocol/dist/realtime/types.d.ts +2 -0
- package/dist/protocol/dist/runtime/archive.d.ts +1 -0
- package/dist/protocol/dist/runtime/context.d.ts +1 -0
- package/dist/protocol/dist/runtime/index.d.ts +3 -0
- package/dist/types.d.ts +1 -0
- package/docs/app-runtime-guide.md +9 -9
- package/package.json +1 -1
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index.js";
|
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
|
|
4
|
-
|
|
5
|
-
|
|
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
|
|
76
|
-
>
|
|
77
|
-
>
|
|
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 =
|
|
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 =
|
|
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);
|