@joiner-platform/cli 0.1.20 → 0.1.22
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/package.json +2 -2
- package/skills/synced-store/SKILL.md +4 -5
- package/skills/synced-store/references/architecture-scaling-and-performance.md +7 -4
- package/skills/synced-store/references/data-visibility.md +1 -1
- package/skills/synced-store/references/limitations.md +1 -1
- package/skills/tile-creator/references/backend-api.md +2 -2
- package/skills/tile-creator/references/cli.md +1 -1
- package/skills/tile-creator/references/client-api.md +1 -1
- package/src/commands/init/sdk-tarball-url.generated.ts +2 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joiner-platform/cli",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "0.1.22",
|
|
4
|
+
"gitHead": "6b046ce4102108cd14de9a3f0f8c69dc7a9de238",
|
|
5
5
|
"description": "The Joiner CLI: create, test, and publish Joiner tiles, with agent skills for coding agents.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"joiner",
|
|
@@ -416,18 +416,17 @@ startRound: async (ctx) => {
|
|
|
416
416
|
Read this reference when you want different apps to communicate with each other or trigger mutations on each other.
|
|
417
417
|
|
|
418
418
|
## System hooks — react to membership / parenting / permission changes
|
|
419
|
-
Declare hooks in a client-safe module and wire them into **both** `defineClientConfig({ hooks })` and `defineBackendConfig({ hooks })`. Backend hooks run on the server within the same atomic transaction as the system mutator that fired them. Client hooks run optimistically for fresh creator launches before server data arrives, then the server-authoritative data replaces that overlay. Receive a `MutationContext` — treat hooks like mutators (read + write tables, follow rebase-safe rules). If a hook has server-only side effects, split the deterministic writes into a shared helper and keep the server-only tail backend-local, or guard that tail with `if (ctx.isServer)`. `onInit` is supplied by `poe-tiles-kernel` for new child-room launches and root-group genesis. Read the current room topology from `await ctx.table("$$system").get("room")`; `ctx.userId` identifies the initiating user for user/external-store bootstraps, while `ctx.isSystem` indicates the hook is running in trusted system scope.
|
|
419
|
+
Declare hooks in a client-safe module and wire them into **both** `defineClientConfig({ hooks })` and `defineBackendConfig({ hooks })`. Backend hooks run on the server within the same atomic transaction as the system mutator that fired them. Client hooks run optimistically for fresh creator launches before server data arrives, then the server-authoritative data replaces that overlay. Receive a `MutationContext` — treat hooks like mutators (read + write tables, follow rebase-safe rules). If a hook has server-only side effects, split the deterministic writes into a shared helper and keep the server-only tail backend-local, or guard that tail with `if (ctx.isServer)`. `onInit` is supplied by `poe-tiles-kernel` for new child-room launches and root-group genesis. Read the current room topology from `await ctx.table("$$system").get("room")`; `ctx.userId` identifies the initiating user for user/external-store bootstraps, while `ctx.isSystem` indicates the hook is running in trusted system scope. Its input carries only `parentRoomUsers`, which is deprecated and always empty.
|
|
420
420
|
|
|
421
421
|
```ts
|
|
422
422
|
import type { InferSystemHooks } from "joiner-sdk/v1/client.js";
|
|
423
423
|
import type { TileSchema } from "./schema";
|
|
424
424
|
|
|
425
425
|
export const tileHooks = {
|
|
426
|
-
onInit: async (ctx
|
|
426
|
+
onInit: async (ctx) => {
|
|
427
427
|
const room = await ctx.table("$$system").get("room");
|
|
428
428
|
if (room?.type === "rootGroup") {
|
|
429
429
|
// Seed app-owned rows for a newly started group here.
|
|
430
|
-
// A fresh rootGroup genesis always has an empty parentRoomUsers.
|
|
431
430
|
}
|
|
432
431
|
},
|
|
433
432
|
onAddUsersV2: async (ctx, { users }) => {
|
|
@@ -445,7 +444,7 @@ export const tileHooks = {
|
|
|
445
444
|
} satisfies InferSystemHooks<TileSchema>;
|
|
446
445
|
```
|
|
447
446
|
|
|
448
|
-
- `onInit(ctx
|
|
447
|
+
- `onInit(ctx)` — new root-group or child-room instance initialized. Read `await ctx.table("$$system").get("room")` for the current room topology, and use `ctx.userId` for the initiating user when the bootstrap came from a user/external store; use `ctx.isSystem`, not `ctx.source.type === "system"`, to detect trusted system scope. Its `parentRoomUsers` input is **deprecated and always empty**: read the room type from `$$system`, read this store's own `$users` for its roster, and have a parent tile push anything else a child needs with `ctx.mutateExternal`. Apps may write their own tables on both passes. Do **not** write `$users` directly, and do not try to pull parent-room users into the instance: membership is platform-owned. The host seats the launcher at genesis (and both users when the tile is launched from a 2-person room, i.e. a DM); anyone else joins through the host picker/invite flows.
|
|
449
448
|
- The acting user (`ctx.userId`) is always a live `$users` member by the time their own pushed mutation runs or their own pull returns: the platform admits them first. Never wait, retry, or poll for your own row. Other members' rows can arrive later, through the room.
|
|
450
449
|
- Use `onInit` for deterministic one-time bootstrap, not membership. It is a good place to seed app-owned rows such as an initial activity or transcript message (`"{name} started the group"`).
|
|
451
450
|
- `onAddUsersV2(ctx, { users })` — users joined the instance, one call per batch (a genesis roster arrives whole), in admission order. Use it to auto-seat users or append membership activity. Read `$users[userId].addedBy` and `$userInfo` for attribution. Each entry's optional `addedBatchUserIds` is the ordered invitation group for its operation; it is not stored on membership rows, and one call can write one grouped announcement. Each entry's optional `joinKind` says how the member came in (`"added"` by another member, `"inviteLink"`, or on their own: `"group"`, `"session"`), and `invitedBy` names the creator of an invite link. Only this hook gets them; they are not stored on the `$users` row, so save what you need in your own table. Retain any history needed in your own message metadata.
|
|
@@ -559,7 +558,7 @@ Routine persistence and sync run in the background. Do not add saving indicators
|
|
|
559
558
|
- **Benign / idempotent / redundant-replay** ("already started", "already joined", "already claimed", or an outcome that depends on unreadable server-only data) → **early `return`**. Pending mutations replay on every rebase and can race the same action from another client/device, so these replays are normal, not errors; a throw here also logs `"Synced State | Error rebasing mutation"` to the user's console on every rebase.
|
|
560
559
|
- **An expected failure the UI must react to** (seat taken, hand folded, quota hit, validation the user should see) → **don't throw; write an error/status row to the store** and let clients subscribe, infer, and render it. This is the multi-user-correct channel: every client sees the state, not just the one caller who awaited `store.mutate.X(...)`. Throwing would only reach that caller (and only via `.confirmed`/`onBackgroundError`) and would spuriously toast.
|
|
561
560
|
- Throw only for genuinely invalid actions that indicate a bug, never for a state the app is expected to hit in normal use. [→ mutator-rules.md](references/mutator-rules.md) rule 5
|
|
562
|
-
- **Hooks can write app private tables for any user** - system hooks may update app-owned public, server-only, and private rows, including `ctx.privateOfUser(otherUserId).table(...)`. They still cannot write reserved system tables such as `$users` or `$$system` directly. `onInit` can seed app rows for new root groups by reading `$$system.room`; it cannot add members
|
|
561
|
+
- **Hooks can write app private tables for any user** - system hooks may update app-owned public, server-only, and private rows, including `ctx.privateOfUser(otherUserId).table(...)`. They still cannot write reserved system tables such as `$users` or `$$system` directly. `onInit` can seed app rows for new root groups by reading `$$system.room`; it cannot add members, because membership is platform-owned.
|
|
563
562
|
- **`.set()` takes `{ itemKey, value }`**, not positional args
|
|
564
563
|
- **Generate IDs + `Date.now()` outside mutators**, pass as input — mutators run on client + server + rebase
|
|
565
564
|
- **Use explicit values, not toggles** — rebase sees current state, so `!current.done` can flip the wrong way
|
|
@@ -139,10 +139,13 @@ longer to run and may hit the
|
|
|
139
139
|
host operations, such as scan-page reads or row writes, and turns that
|
|
140
140
|
process queued promises. CPU-heavy work between host operations can hit the
|
|
141
141
|
[30-second guest execution deadline](limitations.md#guest-execution-deadline).
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
That deadline is a cumulative budget for the whole mutator, action, or hook
|
|
143
|
+
call: it pauses while host operations run and resumes with the time left, so
|
|
144
|
+
every guest slice in the call spends from the same 30 seconds. It is enforced
|
|
145
|
+
where the host clock advances during computation, such as local and test
|
|
146
|
+
servers. On the production host the clock does not advance while your code
|
|
147
|
+
computes between host operations, so CPU-heavy code there is stopped only by
|
|
148
|
+
the store's 300-second CPU limit, which resets the whole instance.
|
|
146
149
|
|
|
147
150
|
Store migrations are treated as mutations and are subject to the same guest
|
|
148
151
|
deadline and [event-loop-tick limit](limitations.md#event-loop-ticks). Stores
|
|
@@ -90,6 +90,6 @@ Reading another user's private rows is rejected on the client with a thrown erro
|
|
|
90
90
|
|
|
91
91
|
## Hooks can write app private rows
|
|
92
92
|
|
|
93
|
-
System hooks (`onInit`, `onAddUsersV2`, `onRemoveUser`, `onAnonymizeUser`, `onSetTitle`, `onGrantPermission`, `onRevokePermission`, `onAddTileInstanceToRoom`, `onChangeTileParent`, `onAddChildTile`, `onChildInstancesAdded`, `onRoomMemberInstanceMovedOut`) run inside a system mutator, but app-owned public tables, server-only tables, and private tables are still app data. A hook may write `ctx.privateOfUser(otherUserId).table(...)` on the server when the write is a durable per-user projection tied directly to the hook event. Hooks still must not write reserved system tables such as `$users` or `$$system` directly. `onInit` can read the current room topology from `await ctx.table("$$system").get("room")`; `ctx.userId` identifies the initiating user for user/external-store bootstraps. Use it for deterministic bootstrap rows, such as an initial activity message (`"{name} started the group"`).
|
|
93
|
+
System hooks (`onInit`, `onAddUsersV2`, `onRemoveUser`, `onAnonymizeUser`, `onSetTitle`, `onGrantPermission`, `onRevokePermission`, `onAddTileInstanceToRoom`, `onChangeTileParent`, `onAddChildTile`, `onChildInstancesAdded`, `onRoomMemberInstanceMovedOut`) run inside a system mutator, but app-owned public tables, server-only tables, and private tables are still app data. A hook may write `ctx.privateOfUser(otherUserId).table(...)` on the server when the write is a durable per-user projection tied directly to the hook event. Hooks still must not write reserved system tables such as `$users` or `$$system` directly. `onInit` can read the current room topology from `await ctx.table("$$system").get("room")`; `ctx.userId` identifies the initiating user for user/external-store bootstraps. Use it for deterministic bootstrap rows, such as an initial activity message (`"{name} started the group"`). Its `parentRoomUsers` input is deprecated and always empty; read this store's own `$users`, or have the parent tile push what the child needs with `ctx.mutateExternal`. Membership is platform-owned: the host seats the launcher at genesis (both users when launched from a 2-person room, i.e. a DM), and everyone else joins through the host picker/invite flows. `onAddUsersV2` runs after the `$users` rows are written, so it can read `addedBy`, each user's optional `joinKind` and `invitedBy` (how they came in, and whose invite link they opened), and use each user's optional `addedBatchUserIds` for this operation’s ordered invitation group to auto-seat users or write membership activity such as `"{name} added {usernames...}"`. For user-initiated cross-user fan-out, prefer a regular mutator or an action enqueued with `ctx.enqueueAction(...)`.
|
|
94
94
|
|
|
95
95
|
Wire every hook into both `defineBackendConfig({ hooks })` and `defineClientConfig({ hooks })`. Client hook runs are optimistic seed data for fresh prepared stores, so they must be browser-safe: use public or current-user-readable data, avoid backend imports and platform calls, and guard server-only table/private-other-user writes behind `ctx.isServer`.
|
|
@@ -32,7 +32,7 @@ This table describes the synced-store behavior shipped on `main`. Sizes are UTF-
|
|
|
32
32
|
| Cross-store | Unconfirmed optimistic external | 5 minutes | The client reverts an overlay that remains unconfirmed past the TTL. Dispatch is detached from the source push; retryable infrastructure failures may be retried, so receivers must be idempotent or convergent. Ordinary mutator failures and overload responses are not retried. |
|
|
33
33
|
| Cross-store | Watched external stores | 16 per session | Further watch requests are rejected. Unwatch targets that are no longer needed. |
|
|
34
34
|
| Cross-store | Pending dispatches | 1,000 waiting per target, plus the active RPC | Overflow fails immediately. Reduce source fan-out or target recovery time. |
|
|
35
|
-
| Server execution | <a id="guest-execution-deadline"></a>Guest execution deadline | 30 seconds of
|
|
35
|
+
| Server execution | <a id="guest-execution-deadline"></a>Guest execution deadline | 30 seconds of cumulative guest time per mutator, action, or hook call, where the host clock advances during computation | The budget is summed across the whole call: it pauses while trusted host operations run and resumes with what is left when they settle, so host I/O does not count against it, but each guest slice spends from the same 30 seconds rather than getting a fresh deadline. Local and test servers enforce it, and because it is wall time on the instance's single thread, identical compute can take longer under concurrent load — leave headroom rather than designing near the deadline. On the production host the clock does not advance while your code computes between host operations, so this deadline does not stop guest computation there: compute-heavy code runs until the store's CPU limit (300 seconds) resets the instance, failing every request in flight on that store. Bound scans and external work, and never write an unbounded synchronous loop. |
|
|
36
36
|
| Server execution | <a id="host-wait-bound"></a>Host operation wait | 300,000 milliseconds (5 minutes) per awaited host operation | Applies to every mutator, action, and hook call. When an awaited `ctx.platform.call`, model-stream read, table or scan operation, or `ctx.sleep` has not settled after 300,000 milliseconds, the whole call fails; your code cannot catch it, and the host work is not cancelled. Concurrent host operations awaited together share one bound. Cross-store `.action()` calls and server-action `ctx.mutate` are exempt, because the called code bounds its own host operations. This is not a total wall-clock limit: each settled host operation restarts the bound. |
|
|
37
37
|
| Server execution | `structuredClone` | Available in mutators, actions and module scope | Copies plain objects, arrays, `Date`, `RegExp`, `Map`, `Set`, `ArrayBuffer`, typed arrays and `DataView`, keeping shared references and cycles. Errors keep `message` and `stack` but lose `cause` and other properties. Functions, symbols, `WeakMap`, `WeakSet`, `WeakRef`, `FinalizationRegistry`, `Promise`, iterators and generators (sync or async), `SharedArrayBuffer`, detached or out-of-bounds buffers and views, and a non-empty `transfer` list throw an error named `DataCloneError`; on the server it is an `Error`, not a `DOMException`, so check `error.name`. A `Proxy` (for example reactive-state objects) throws in the browser but is copied as plain data on the server, so do not rely on either. |
|
|
38
38
|
| Server execution | Action retry delays | 30,000 milliseconds cumulative per action invocation | `ctx.sleep(ms)` accepts integer milliseconds from 0 through 30,000. Sequential and concurrent requests share the allowance; exceeding it rejects before creating a timer. It is a retry delay, not a timeout or cancellation mechanism for another host call. |
|
|
@@ -98,7 +98,7 @@ export const myBackendConfig = defineBackendConfig({
|
|
|
98
98
|
|
|
99
99
|
| Hook | Input | When it fires |
|
|
100
100
|
|------|-------|---------------|
|
|
101
|
-
| `onInit` | `{ parentRoomUsers }` | A new
|
|
101
|
+
| `onInit` | `{ parentRoomUsers }` | A new instance is initialized (`parentRoomUsers` is deprecated and always empty) |
|
|
102
102
|
| `onAddUsersV2` | `{ users: Array<{ userId: string; batchUserIds?: string[]; addedBatchUserIds?: string[]; joinKind?: "added" \| "inviteLink" \| "group" \| "session"; invitedBy?: string; poeFeedbackResponder?: boolean }> }` | Users join the store instance; one call per batch |
|
|
103
103
|
| `onRemoveUser` | `{ userId: string }` | User leaves the store instance |
|
|
104
104
|
| `onAnonymizeUser` | `{ userId: string }` | User is hard-deleted/anonymized |
|
|
@@ -113,7 +113,7 @@ export const myBackendConfig = defineBackendConfig({
|
|
|
113
113
|
|
|
114
114
|
Common hook uses:
|
|
115
115
|
|
|
116
|
-
- `onInit` is for deterministic one-time bootstrap. Use it to seed app-owned rows such as an initial activity message (`"{name} started the group"`). `parentRoomUsers` is
|
|
116
|
+
- `onInit` is for deterministic one-time bootstrap. Use it to seed app-owned rows such as an initial activity message (`"{name} started the group"`). Its `parentRoomUsers` input is deprecated and always empty: read this store's own `$users`, or have the parent tile push what the child needs with `ctx.mutateExternal`. Membership is platform-owned: the host seats the launcher at genesis (both users when the tile is launched from a 2-person room, i.e. a DM); larger rooms stay picker-driven.
|
|
117
117
|
- `onAddUsersV2(ctx, { users })` runs after membership is written, once for every batch of users admitted together (a genesis roster, a multi-person invite), in admission order. Auto-seat users through this hook. Read `$users[userId].addedBy` and `$userInfo` for attribution; each entry's optional `addedBatchUserIds` is that operation’s ordered invitation group, so one call can write one grouped announcement. Retain historical names/IDs in your own message metadata; invitation context is not a membership table.
|
|
118
118
|
- Each entry's optional `joinKind` says how the member came in:
|
|
119
119
|
|
|
@@ -61,7 +61,7 @@ an older pin, so prefer the live result when upgrading:
|
|
|
61
61
|
|
|
62
62
|
<!-- begin: sdk-tarball-snippet (auto-generated by packages/poe-tiles-sdk/scripts/publish-tar.ts — do not edit by hand) -->
|
|
63
63
|
```json
|
|
64
|
-
"joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/
|
|
64
|
+
"joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/88142b185dbcc2742d07d1088b47e955e0a16afc2c7dad56d8fb13b241d1de7a"
|
|
65
65
|
```
|
|
66
66
|
<!-- end: sdk-tarball-snippet -->
|
|
67
67
|
|
|
@@ -1222,7 +1222,7 @@ For top-document apps (trusted apps not running in an iframe) that construct a `
|
|
|
1222
1222
|
|
|
1223
1223
|
### `Poe.languages`
|
|
1224
1224
|
|
|
1225
|
-
The viewer's preferred languages, as BCP 47 tags with the most preferred first (e.g. `["fr"]` or `["pt-BR", "pt", "en"]`). Never empty. Use it, not `navigator.languages`, to choose which of your translations to show
|
|
1225
|
+
The viewer's preferred languages, as BCP 47 tags with the most preferred first (e.g. `["fr"]` or `["pt-BR", "pt", "en"]`). Never empty. Use it, not `navigator.languages`, to choose which of your translations to show. To match by hand, walk the list and take the first language you have, else your default.
|
|
1226
1226
|
|
|
1227
1227
|
```typescript
|
|
1228
1228
|
const supported = ["en", "fr", "ja"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// Auto-generated by poe-tiles-sdk/scripts/publish-tar.ts — do not edit
|
|
2
|
-
// publishedAt: 2026-11-30T17:
|
|
2
|
+
// publishedAt: 2026-11-30T17:54:43.249Z
|
|
3
3
|
export const SDK_TARBALL_URL =
|
|
4
|
-
"https://misc-dev-uploads.quora-913.workers.dev/
|
|
4
|
+
"https://misc-dev-uploads.quora-913.workers.dev/88142b185dbcc2742d07d1088b47e955e0a16afc2c7dad56d8fb13b241d1de7a";
|