@joiner-platform/cli 0.1.19 → 0.1.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joiner-platform/cli",
3
- "version": "0.1.19",
4
- "gitHead": "95979a27890c7a1d4f5fdde8e7b293eb9a4c5aa2",
3
+ "version": "0.1.21",
4
+ "gitHead": "765250cdf89df1909f3bda218cdce7b372188771",
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. The input carries a read-only snapshot of the parent room's users for child rooms.
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, { parentRoomUsers }) => {
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, { parentRoomUsers })` — 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. `parentRoomUsers` is a **read-only snapshot** of the active parent room roster (`PoeUserInfo[]`) for child rooms and empty for root groups — useful to detect a fresh rootGroup genesis or to react to the parent roster, never a way to admit members. 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.
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 — `parentRoomUsers` is a read-only snapshot and membership is platform-owned.
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
@@ -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"`). Child-room `onInit` also receives `parentRoomUsers`, a **read-only snapshot** of the parent room's active roster — use it to react to the parent roster (a fresh rootGroup genesis always has an empty `parentRoomUsers`), never to admit members. 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(...)`.
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`.
@@ -93,8 +93,17 @@ await Poe.bundle.loadAsset("/deferred/credits.mp4", { cache: false });
93
93
 
94
94
  // The Vite plugin compiles a dynamic import of a deferred file to loadAsset:
95
95
  const { url: theme } = await import("/deferred/music/theme.mp3");
96
+
97
+ // A deferred JSON file imports like any JSON file, as its parsed value:
98
+ const { default: level } = await import("/deferred/levels/12.json");
96
99
  ```
97
100
 
101
+ A dynamic import of a deferred `.json` file resolves to `{ default }` holding
102
+ the parsed JSON, the same shape as importing a JSON file that ships in the
103
+ bundle. So code that loads data with `import()`, such as translation loaders,
104
+ works the same whether the file is bundled or deferred. Use
105
+ `Poe.bundle.loadAsset` when you want the file's URL instead.
106
+
98
107
  - **Only through `loadAsset` or `import()`.** A static import, an eager
99
108
  `import.meta.glob`, or a reference from HTML or CSS
100
109
  (`<img src="/deferred/a.png">`, `url(/deferred/a.png)`) fails the build. Add
@@ -98,7 +98,7 @@ export const myBackendConfig = defineBackendConfig({
98
98
 
99
99
  | Hook | Input | When it fires |
100
100
  |------|-------|---------------|
101
- | `onInit` | `{ parentRoomUsers }` | A new child-room instance is initialized with parent-room context (`parentRoomUsers` is a read-only roster snapshot) |
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 a read-only snapshot of the parent room's roster — never a way to admit members. 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.
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/ca6d9024d5d9881a193a9ea2d0e58b333d9e6e024e472ca2bb3b3e272ef73bb4"
64
+ "joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/a24d780e9f9cde5703b9efc8c706a70343ecfa3de87e237e75e86d659f9faac8"
65
65
  ```
66
66
  <!-- end: sdk-tarball-snippet -->
67
67
 
@@ -1,4 +1,4 @@
1
1
  // Auto-generated by poe-tiles-sdk/scripts/publish-tar.ts — do not edit
2
- // publishedAt: 2026-11-30T17:07:09.403Z
2
+ // publishedAt: 2026-11-30T17:36:20.227Z
3
3
  export const SDK_TARBALL_URL =
4
- "https://misc-dev-uploads.quora-913.workers.dev/ca6d9024d5d9881a193a9ea2d0e58b333d9e6e024e472ca2bb3b3e272ef73bb4";
4
+ "https://misc-dev-uploads.quora-913.workers.dev/a24d780e9f9cde5703b9efc8c706a70343ecfa3de87e237e75e86d659f9faac8";