@joiner-platform/cli 0.1.21 → 0.1.23

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.21",
4
- "gitHead": "765250cdf89df1909f3bda218cdce7b372188771",
3
+ "version": "0.1.23",
4
+ "gitHead": "c68c1b3632a81025ba67cbd096d751895933393a",
5
5
  "description": "The Joiner CLI: create, test, and publish Joiner tiles, with agent skills for coding agents.",
6
6
  "keywords": [
7
7
  "joiner",
@@ -389,12 +389,12 @@ composes with `--publish-as-poe` and the other publish-as identities. To release
389
389
  an already published version, use `tiles promote` instead. See the
390
390
  publish-rollout reference for schema-downgrade limitations.
391
391
 
392
- Use the current schema v10 to set the config-only `instancing` field
392
+ Use the current schema v11 to set the config-only `instancing` field
393
393
  (there is no CLI flag for it):
394
394
 
395
395
  ```json
396
396
  {
397
- "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json",
397
+ "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v11.json",
398
398
  "handle": "word-duel",
399
399
  "instancing": "per-context"
400
400
  }
@@ -402,6 +402,8 @@ Use the current schema v10 to set the config-only `instancing` field
402
402
 
403
403
  `per-launch` is the default. Omitting `instancing` on a later upload preserves the existing value; set `"per-launch"` explicitly to reset it.
404
404
 
405
+ The config-only `languages` field (schema v11) lists the BCP 47 tags a tile renders, source language included, such as `"languages": ["en", "fr", "ja"]`. Each upload records its own set: omitting the field carries the previous upload's, and `null` declares none. The tile's languages are its live version's. See the CLI reference for the rules.
406
+
405
407
  Categories are assigned automatically by the platform. Do not submit a
406
408
  `categories` field. If a legacy `.poe-tile.json` contains it, delete the top-level
407
409
  field (including a `null` or empty value) and retry; keep other metadata intact.
@@ -40,7 +40,7 @@ Write exactly three files under `/workspace/<name>/`. `<name>` is a kebab-case b
40
40
 
41
41
  ```json
42
42
  {
43
- "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json",
43
+ "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v11.json",
44
44
  "handle": "cat-flap-8c41e67ba203",
45
45
  "displayName": "New Arcade Tile",
46
46
  "shortDescription": "One sentence about what this does, under 140 characters.",
@@ -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
- Completing host operations refreshes that deadline for the next guest slice.
143
- A slice that computes without ever awaiting a host operation is not caught by
144
- that deadline; it runs until the store's 300-second CPU limit resets the whole
145
- instance.
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
@@ -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 wall-clock time per guest execution slice | Measured in wall-clock time while your code runs, per mutator, action, or hook call; trusted host operations refresh the deadline when they settle, so this is not a total wall-clock limit on host I/O. Because the budget 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. Bound scans and external work. The deadline is checked against a clock that does not advance while your code computes without awaiting a host operation, so a slice that never yields is not stopped at 30 seconds: it runs until the store's CPU limit (300 seconds) resets the instance, failing every request in flight on that store. Never write an unbounded synchronous loop. |
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. |
@@ -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/a24d780e9f9cde5703b9efc8c706a70343ecfa3de87e237e75e86d659f9faac8"
64
+ "joiner-sdk": "https://misc-dev-uploads.quora-913.workers.dev/d1cae6fe8c9e5e0ae3fdf95b46a0790f3e4c9f892264319c01de68a51169b459"
65
65
  ```
66
66
  <!-- end: sdk-tarball-snippet -->
67
67
 
@@ -388,12 +388,13 @@ re-upload.
388
388
  | _(config only — no flag)_ | `screenshots` | Ordered list of ≤8 detail-card screenshots (local PNG/JPG/WEBP paths or `https://` URLs). Requires `$schema` v3+. |
389
389
  | _(config only — no flag)_ | `players` | Player-count facet `{ min, max?, recommended? }` (total seats: humans + AI), or `null` to clear. Requires `$schema` v5. Shown on tile cards and the detail page. |
390
390
  | _(config only — no flag)_ | `instancing` | `"per-context"` reuses one instance per context; `"per-launch"` creates a fresh instance for each launch. Requires `$schema` v7. |
391
+ | _(config only — no flag)_ | `languages` | The languages the tile renders, as BCP 47 tags with the source language included (`["en", "fr", "ja"]`; English text is the message key, so list `en`), or `null` to declare none. 1 to 64 tags, canonicalized (`EN-us` becomes `en-US`), no duplicates, stored sorted. Each upload records its own set; omitting the field carries the previous upload's. The tile's languages are its live version's, so a change reaches players when that version goes live. Requires `$schema` v11. |
391
392
  | _(config only — no flag)_ | `remixOf` | The app — and the exact publish of it — this app was remixed from, or `null` to clear. Requires `$schema` v9. **`joiner remix` writes this for you**; see below. Shows the original in a "Remix of" row on your detail card, and lists a public app in a "Remixes" row on the original's. Self-declared, not verified. |
392
393
 
393
394
  These fields are gated by the `.poe-tile.json` `$schema` version: the
394
395
  metadata text fields need `v2.json`+, `screenshots` needs `v3.json`+,
395
396
  `players` needs `v5.json`, `instancing` needs `v7.json`, and `remixOf` needs
396
- `v9.json`. The current schema is `v10.json`; categories are no longer creator inputs. Update the `$schema` value in your
397
+ `v9.json`, and `languages` needs `v11.json`. The current schema is `v11.json`; categories are no longer creator inputs. Update the `$schema` value in your
397
398
  config to the newest version to use the latest fields; using a field under an
398
399
  older schema is a loud error, never a silent drop. The previous v1 schema is
399
400
  rejected by the current CLI.
@@ -402,7 +403,7 @@ rejected by the current CLI.
402
403
 
403
404
  ```jsonc
404
405
  {
405
- "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json",
406
+ "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v11.json",
406
407
  "handle": "word-duel",
407
408
  "players": { "min": 2, "max": 4, "recommended": { "min": 3, "max": 4 } },
408
409
  "instancing": "per-launch"
@@ -414,6 +415,11 @@ bound. `recommended` is an optional `{ min, max }` sub-range bounded by
414
415
  `[min, max ?? 1000]`. Set `"players": null` to un-declare a previously
415
416
  published value.
416
417
 
418
+ `languages` takes plain BCP 47 tags, for example `"languages": ["en", "es", "pt-BR"]`.
419
+ The CLI canonicalizes and sorts them and rejects an empty list, a malformed
420
+ tag, or the same tag twice. Set `"languages": null` to declare none for the
421
+ next upload.
422
+
417
423
  Categories are managed by the platform, not by creators. The current CLI
418
424
  rejects any top-level `categories` field, including `null` and an empty list,
419
425
  under every accepted config schema. Fix a legacy config by deleting that field:
@@ -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: walk the list and take the first language you have, else your default.
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"];
@@ -132,7 +132,7 @@ Complete text metadata. `displayName` is a nonempty string of at most 80 charact
132
132
  - Omit `players` for utilities where participant count does not describe the experience. Do not publish `players: null` for a new tile; `null` is only the explicit clear sentinel when republishing an existing tile.
133
133
  - This field also decides testability, not just the listing page: a tile the range calls multiplayer gets a **multiplayer simulation** link in upload output and in the Creator chat receipt, opening `recommended.min` (else `min`) dev-user phones already inside the tile. See [cli.md](cli.md#tiles-upload-output).
134
134
 
135
- 5. **Leave discovery categories to the platform.** Do not add a `categories` field to `.poe-tile.json`. Use schema v10; when editing older source, remove the obsolete top-level field before publishing. Single-player / Multiplayer remain derived from the supported `players` range.
135
+ 5. **Leave discovery categories to the platform.** Do not add a `categories` field to `.poe-tile.json`. Use schema v11; when editing older source, remove the obsolete top-level field before publishing. Single-player / Multiplayer remain derived from the supported `players` range.
136
136
 
137
137
  Generate the profile picture automatically before the first publish; do not ask for permission or wait for public-publish authorization. Keep an existing icon during edit drafts; when finalizing an update to an already-public tile, regenerate it automatically only when it is missing or materially stale.
138
138
 
package/src/client.ts CHANGED
@@ -1034,6 +1034,11 @@ export class SlopPoeClient {
1034
1034
  * omitting the field preserves it (preserve-on-republish).
1035
1035
  */
1036
1036
  players?: { value: TilePlayerCount } | { clear: true };
1037
+ /**
1038
+ * Optional supported languages (BCP 47 tags). `{ value }` sets the set;
1039
+ * `{ clear: true }` sends the clear sentinel; omitting preserves it.
1040
+ */
1041
+ languages?: { value: string[] } | { clear: true };
1037
1042
  /**
1038
1043
  * Optional remix provenance. `{ value }` claims that this app was remixed
1039
1044
  * from that app/publish; `{ clear: true }` sends the clear sentinel (the
@@ -1215,6 +1220,16 @@ export class SlopPoeClient {
1215
1220
  ),
1216
1221
  );
1217
1222
  }
1223
+ if (options.languages) {
1224
+ // The field always holds JSON: an array sets the set, and the JSON
1225
+ // literal `null` is the clear sentinel. Absent → preserve.
1226
+ formData.append(
1227
+ "languages",
1228
+ JSON.stringify(
1229
+ "clear" in options.languages ? null : options.languages.value,
1230
+ ),
1231
+ );
1232
+ }
1218
1233
  if (options.remixOf) {
1219
1234
  // The field always holds JSON: an object sets the claim, and the
1220
1235
  // JSON literal `null` is the clear sentinel. Absent → preserve.
@@ -1,4 +1,4 @@
1
1
  // Auto-generated by poe-tiles-sdk/scripts/publish-tar.ts — do not edit
2
- // publishedAt: 2026-11-30T17:36:20.227Z
2
+ // publishedAt: 2026-11-30T18:51:12.739Z
3
3
  export const SDK_TARBALL_URL =
4
- "https://misc-dev-uploads.quora-913.workers.dev/a24d780e9f9cde5703b9efc8c706a70343ecfa3de87e237e75e86d659f9faac8";
4
+ "https://misc-dev-uploads.quora-913.workers.dev/d1cae6fe8c9e5e0ae3fdf95b46a0790f3e4c9f892264319c01de68a51169b459";
@@ -0,0 +1,104 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Languages config field for `.poe-tile.json` (v11+), split out of
4
+ * `poe-tile-config.ts` so the validator stays in a focused companion file.
5
+ *
6
+ * The caps, the tag pattern, and {@link normalizeTileLanguages} are INLINED
7
+ * copies of the canonical definitions in `@lib/tile-registry`
8
+ * (`src/tile-languages.ts`). The CLI deliberately carries no `workspace:*`
9
+ * runtime deps (see `packaging.test.ts`). Drift between this copy and the
10
+ * upstream canonical value/behavior is caught by
11
+ * `workspace-sync-languages.test.ts`.
12
+ */
13
+
14
+ /** Most tags one tile may declare. */
15
+ export const TILE_LANGUAGES_MAX_COUNT = 64;
16
+
17
+ /** Longest tag accepted (RFC 5646 section 4.4.1). */
18
+ export const TILE_LANGUAGE_TAG_MAX_LENGTH = 35;
19
+
20
+ /** A canonical tag's shape: ASCII letters and digits in hyphenated subtags. */
21
+ export const TILE_LANGUAGE_TAG_PATTERN =
22
+ /^[A-Za-z0-9]{1,8}(-[A-Za-z0-9]{1,8})*$/;
23
+
24
+ /**
25
+ * Validate a declared `languages` list and return its canonical tags, sorted.
26
+ * INLINED copy of `normalizeTileLanguages` in `@lib/tile-registry`.
27
+ */
28
+ export function normalizeTileLanguages(value: unknown): string[] {
29
+ if (!Array.isArray(value) || value.length === 0) {
30
+ throw new Error("languages must be a non-empty array of BCP 47 tags.");
31
+ }
32
+ if (value.length > TILE_LANGUAGES_MAX_COUNT) {
33
+ throw new Error(
34
+ `languages lists ${value.length} tags; the maximum is ${TILE_LANGUAGES_MAX_COUNT}.`,
35
+ );
36
+ }
37
+ const tags = new Set<string>();
38
+ for (const [index, entry] of value.entries()) {
39
+ const tag = canonicalTag(entry, index);
40
+ if (tags.has(tag)) {
41
+ throw new Error(`languages lists ${JSON.stringify(tag)} twice.`);
42
+ }
43
+ tags.add(tag);
44
+ }
45
+ return [...tags].sort();
46
+ }
47
+
48
+ function canonicalTag(entry: unknown, index: number): string {
49
+ const invalid = new Error(
50
+ `languages[${index}] must be a BCP 47 language tag such as "en" or "pt-BR", got ${JSON.stringify(entry)}.`,
51
+ );
52
+ if (
53
+ typeof entry !== "string" ||
54
+ entry.length > TILE_LANGUAGE_TAG_MAX_LENGTH ||
55
+ !TILE_LANGUAGE_TAG_PATTERN.test(entry)
56
+ ) {
57
+ throw invalid;
58
+ }
59
+ let canonical: string | undefined;
60
+ try {
61
+ [canonical] = Intl.getCanonicalLocales(entry);
62
+ } catch {
63
+ throw invalid;
64
+ }
65
+ if (
66
+ canonical === undefined ||
67
+ canonical.length > TILE_LANGUAGE_TAG_MAX_LENGTH
68
+ ) {
69
+ throw invalid;
70
+ }
71
+ return canonical;
72
+ }
73
+
74
+ /**
75
+ * Validate the optional `.poe-tile.json` `languages` field. Returns the
76
+ * canonical sorted tags when set, `null` to declare none for this upload
77
+ * (`"languages": null`), or `undefined` when absent (carry the previous upload's).
78
+ *
79
+ * Throws when `languages` is present under a pre-v11 `$schema`, or when it
80
+ * fails {@link normalizeTileLanguages}. The config filename is prefixed onto
81
+ * the message.
82
+ */
83
+ export function parseLanguagesConfigField(opts: {
84
+ raw: unknown;
85
+ schemaSupportsLanguages: boolean;
86
+ configFilename: string;
87
+ schemaUrl: string;
88
+ }): string[] | null | undefined {
89
+ const { raw, schemaSupportsLanguages, configFilename, schemaUrl } = opts;
90
+ if (raw === undefined) return undefined;
91
+ if (!schemaSupportsLanguages) {
92
+ throw new Error(
93
+ `${configFilename}.languages requires $schema ${JSON.stringify(schemaUrl)} (v11+). Bump the $schema URL to use the languages field.`,
94
+ );
95
+ }
96
+ if (raw === null) return null;
97
+ try {
98
+ return normalizeTileLanguages(raw);
99
+ } catch (err) {
100
+ throw new Error(
101
+ `${configFilename}.${err instanceof Error ? err.message : String(err)}`,
102
+ );
103
+ }
104
+ }
@@ -7,13 +7,14 @@
7
7
  * defaults so creators don't have to re-pass flags on every publish:
8
8
  *
9
9
  * {
10
- * "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json",
10
+ * "$schema": "https://joiner-docs.pages.dev/schemas/poe-tile/v11.json",
11
11
  * "handle": "my-cool-app",
12
12
  * "profilePicture": "./assets/icon.png", // optional — local path OR https URL
13
13
  * "shortDescription": "A cool app for cool people", // optional — ≤140 chars
14
14
  * "longDescription": "./README.md", // optional — local path to markdown file
15
15
  * "screenshots": ["./shots/1.webp", "./shots/2.webp"], // optional (v3+) — local paths OR https URLs
16
16
  * "players": { "min": 2, "max": 4, "recommended": { "min": 3, "max": 4 } }, // optional (v5+)
17
+ * "languages": ["en", "fr", "ja"], // optional (v11+) — locales the tile renders, source language included
17
18
  * "instancing": "per-context", // optional (v7+) — one instance per room context
18
19
  * "remixOf": { // optional (v9+) — written by `poe-tiles remix`
19
20
  * "tileId": "…", "versionNumber": 3, "sourceBundleId": "…"
@@ -46,6 +47,7 @@ import {
46
47
  POE_APP_CONFIG_SCHEMA_URLS_V2,
47
48
  readPoeTileConfigFiles,
48
49
  } from "./poe-tile-config-files.js";
50
+ import { parseLanguagesConfigField } from "./poe-tile-config-languages.js";
49
51
  import {
50
52
  parsePlayersConfigField,
51
53
  type TilePlayerCount,
@@ -120,7 +122,7 @@ export const POE_TILE_CONFIG_FILENAME = ".poe-tile.json";
120
122
  * so old CLIs in the wild stay functional.
121
123
  */
122
124
  export const POE_TILE_CONFIG_SCHEMA_URL =
123
- "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json";
125
+ "https://joiner-docs.pages.dev/schemas/poe-tile/v11.json";
124
126
 
125
127
  /**
126
128
  * The docs moved to `joiner-docs.pages.dev`; the old host 301s there. This CLI
@@ -144,10 +146,11 @@ function sameHostSchemaUrl(schema: unknown): unknown {
144
146
  * visibility; v3 added the optional `screenshots` field; v4 removes
145
147
  * config-level `publishAsPoe`; v5 adds the optional `players` field; v6 adds
146
148
  * the optional `video` field; v7 adds the optional `instancing` field; v8 adds
147
- * the optional `categories` field; v9 adds `remixOf`; v10 removes categories. A
149
+ * the optional `categories` field; v9 adds `remixOf`; v10 removes categories; v11
150
+ * adds the optional `languages` field. A
148
151
  * config that uses `screenshots` must declare v3+, one that uses `players`
149
152
  * must declare v5+, one that uses `video` must declare v6+, one that uses
150
- * `instancing` must declare v7+, and `remixOf` requires v9+. Categories are
153
+ * `instancing` must declare v7+, `remixOf` requires v9+, and `languages` requires v11. Categories are
151
154
  * rejected regardless of the declared schema (all enforced in
152
155
  * {@link validatePoeTileConfig}). The v1 URL is NOT accepted (it predates the
153
156
  * metadata fields) — it only drives a tailored upgrade hint.
@@ -168,6 +171,8 @@ export const POE_TILE_CONFIG_SCHEMA_URL_V8 =
168
171
  "https://joiner-docs.pages.dev/schemas/poe-tile/v8.json";
169
172
  export const POE_TILE_CONFIG_SCHEMA_URL_V9 =
170
173
  "https://joiner-docs.pages.dev/schemas/poe-tile/v9.json";
174
+ export const POE_TILE_CONFIG_SCHEMA_URL_V10 =
175
+ "https://joiner-docs.pages.dev/schemas/poe-tile/v10.json";
171
176
 
172
177
  /**
173
178
  * Caps for the app-metadata fields added in v2 of the config schema:
@@ -275,6 +280,14 @@ export type PoeTileConfig = {
275
280
  * sentinel (un-declare on republish).
276
281
  */
277
282
  players?: TilePlayerCount | null;
283
+ /**
284
+ * Optional supported languages (v11+): BCP 47 tags the tile renders, the
285
+ * source language included. Canonicalized and sorted at read time. Requires
286
+ * `$schema` v11 — present under a pre-v11 `$schema` is a loud error, never a
287
+ * silent drop. `languages: null` is the explicit clear sentinel; omitted
288
+ * preserves the stored set on republish.
289
+ */
290
+ languages?: string[] | null;
278
291
  /**
279
292
  * Optional gameplay preview video (v6+). `{ src, poster }`, both **local
280
293
  * paths** (no `https://` pass-through — see {@link PoeTileConfigVideo}).
@@ -493,10 +506,10 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
493
506
  }
494
507
  const declaredSchema = obj["$schema"];
495
508
  const schema = sameHostSchemaUrl(declaredSchema);
496
- // v10 is canonical; v2..v9 are still accepted when they avoid newer/removed
509
+ // v11 is canonical; v2..v10 are still accepted when they avoid newer/removed
497
510
  // fields. v2 added the metadata fields; v3 added screenshots; v4 removed
498
511
  // config-level publishAsPoe; v5 added players; v6 added video; v7 added
499
- // instancing; v8 added categories; v9 added remixOf; v10 removes categories.
512
+ // instancing; v8 added categories; v9 added remixOf; v10 removes categories; v11 added languages.
500
513
  // The v1 URL is not
501
514
  // accepted: it predates the metadata fields, so it gets a tailored upgrade
502
515
  // hint. Anything else is an unknown schema.
@@ -512,6 +525,7 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
512
525
  const isV7 = schema === POE_TILE_CONFIG_SCHEMA_URL_V7;
513
526
  const isV8 = schema === POE_TILE_CONFIG_SCHEMA_URL_V8;
514
527
  const isV9 = schema === POE_TILE_CONFIG_SCHEMA_URL_V9;
528
+ const isV10 = schema === POE_TILE_CONFIG_SCHEMA_URL_V10;
515
529
  if (
516
530
  schema !== POE_TILE_CONFIG_SCHEMA_URL &&
517
531
  !isV2 &&
@@ -521,17 +535,18 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
521
535
  !isV6 &&
522
536
  !isV7 &&
523
537
  !isV8 &&
524
- !isV9
538
+ !isV9 &&
539
+ !isV10
525
540
  ) {
526
541
  const isLegacyV1 =
527
542
  schema === "https://joiner-docs.pages.dev/schemas/poe-tile/v1.json";
528
543
  const hint = isLegacyV1
529
- ? ` Update the $schema URL to ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL)} — v2 adds optional profilePicture, shortDescription, longDescription, and visibility fields; v3 adds screenshots; v4 removes config-level publishAsPoe; v5 adds players; v6 adds video; v7 adds instancing; v8 adds categories; v9 adds remixOf; v10 removes creator categories. Pass --publish-as-poe when publishing under @poe.`
544
+ ? ` Update the $schema URL to ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL)} — v2 adds optional profilePicture, shortDescription, longDescription, and visibility fields; v3 adds screenshots; v4 removes config-level publishAsPoe; v5 adds players; v6 adds video; v7 adds instancing; v8 adds categories; v9 adds remixOf; v10 removes creator categories; v11 adds languages. Pass --publish-as-poe when publishing under @poe.`
530
545
  : " Upgrade the CLI or update the config's $schema URL.";
531
546
  throw new Error(
532
547
  `${POE_TILE_CONFIG_FILENAME} has $schema=${JSON.stringify(
533
548
  declaredSchema,
534
- )} but this CLI understands $schema=${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL)} (or legacy ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V9)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V8)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V7)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V6)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V5)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V4)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V3)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V2)}).${hint}`,
549
+ )} but this CLI understands $schema=${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL)} (or legacy ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V10)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V9)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V8)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V7)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V6)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V5)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V4)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V3)} / ${JSON.stringify(POE_TILE_CONFIG_SCHEMA_URL_V2)}).${hint}`,
535
550
  );
536
551
  }
537
552
  const handle = obj["handle"];
@@ -639,6 +654,7 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
639
654
  isV7 ||
640
655
  isV8 ||
641
656
  isV9 ||
657
+ isV10 ||
642
658
  schema === POE_TILE_CONFIG_SCHEMA_URL,
643
659
  configFilename: POE_TILE_CONFIG_FILENAME,
644
660
  schemaUrl: POE_TILE_CONFIG_SCHEMA_URL,
@@ -649,7 +665,12 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
649
665
  // is the explicit clear sentinel and is preserved through to publish.
650
666
  const video = parseVideoField(
651
667
  obj["video"],
652
- isV6 || isV7 || isV8 || isV9 || schema === POE_TILE_CONFIG_SCHEMA_URL,
668
+ isV6 ||
669
+ isV7 ||
670
+ isV8 ||
671
+ isV9 ||
672
+ isV10 ||
673
+ schema === POE_TILE_CONFIG_SCHEMA_URL,
653
674
  );
654
675
 
655
676
  // New in v7: optional `instancing` mode. Gated on v7+; a present
@@ -657,7 +678,7 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
657
678
  // drop). Two-state — `per-launch` resets to default, no `null` sentinel.
658
679
  const instancing = parseInstancingField(
659
680
  obj["instancing"],
660
- isV7 || isV8 || isV9 || schema === POE_TILE_CONFIG_SCHEMA_URL,
681
+ isV7 || isV8 || isV9 || isV10 || schema === POE_TILE_CONFIG_SCHEMA_URL,
661
682
  );
662
683
 
663
684
  // New in v9: optional `remixOf` provenance. Gated on v9+; a
@@ -666,7 +687,18 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
666
687
  // through to publish, which stores the claim as-is (shape-checked only).
667
688
  const remixOf = parseRemixOfConfigField({
668
689
  raw: obj["remixOf"],
669
- schemaSupportsRemixOf: isV9 || schema === POE_TILE_CONFIG_SCHEMA_URL,
690
+ schemaSupportsRemixOf:
691
+ isV9 || isV10 || schema === POE_TILE_CONFIG_SCHEMA_URL,
692
+ configFilename: POE_TILE_CONFIG_FILENAME,
693
+ schemaUrl: POE_TILE_CONFIG_SCHEMA_URL,
694
+ });
695
+
696
+ // New in v11: optional `languages` set. Gated on v11 only; a present
697
+ // `languages` under an older `$schema` is a loud error. `null` is the
698
+ // explicit clear sentinel and is preserved through to publish.
699
+ const languages = parseLanguagesConfigField({
700
+ raw: obj["languages"],
701
+ schemaSupportsLanguages: schema === POE_TILE_CONFIG_SCHEMA_URL,
670
702
  configFilename: POE_TILE_CONFIG_FILENAME,
671
703
  schemaUrl: POE_TILE_CONFIG_SCHEMA_URL,
672
704
  });
@@ -757,6 +789,7 @@ export function validatePoeTileConfig(value: unknown): PoeTileConfig {
757
789
  ...(longDescription !== undefined ? { longDescription } : {}),
758
790
  ...(screenshots !== undefined ? { screenshots } : {}),
759
791
  ...(players !== undefined ? { players } : {}),
792
+ ...(languages !== undefined ? { languages } : {}),
760
793
  ...(video !== undefined ? { video } : {}),
761
794
  ...(instancing !== undefined ? { instancing } : {}),
762
795
  ...(remixOf !== undefined ? { remixOf } : {}),
@@ -0,0 +1,14 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * The publish options' shared tri-state for config-only facets: `undefined`
4
+ * (absent) preserves the stored value on republish, `null` is the explicit
5
+ * clear sentinel, and anything else sets the value.
6
+ */
7
+ export type SetOrClear<T> = { value: T } | { clear: true };
8
+
9
+ export function toSetOrClear<T>(
10
+ configured: T | null | undefined,
11
+ ): SetOrClear<T> | undefined {
12
+ if (configured === undefined) return undefined;
13
+ return configured === null ? { clear: true } : { value: configured };
14
+ }
@@ -50,6 +50,7 @@ import {
50
50
  validatePublishBoundaryOverrides,
51
51
  } from "./publish-overrides-validation.js";
52
52
  import type { PublishPhaseObserver } from "./publish-phases.js";
53
+ import { toSetOrClear } from "./publish-set-or-clear.js";
53
54
  import {
54
55
  IMAGE_UPLOAD_MAX_BYTES,
55
56
  inferImageMimeType,
@@ -156,6 +157,7 @@ export async function publishTileFromConfig(
156
157
  let configDisplayName: string | undefined;
157
158
  let configScreenshots: string[] | undefined;
158
159
  let configPlayers: TilePlayerCount | null | undefined;
160
+ let configLanguages: string[] | null | undefined;
159
161
  let configRemixOf: PoeTileConfigRemixOf | null | undefined;
160
162
  let configVideo: PoeTileConfigVideo | null | undefined;
161
163
  let configInstancing: TileInstancing | undefined;
@@ -188,6 +190,7 @@ export async function publishTileFromConfig(
188
190
  configDisplayName = result.config.displayName;
189
191
  configScreenshots = result.config.screenshots;
190
192
  configPlayers = result.config.players;
193
+ configLanguages = result.config.languages;
191
194
  configRemixOf = result.config.remixOf;
192
195
  configVideo = result.config.video;
193
196
  configInstancing = result.config.instancing;
@@ -340,23 +343,16 @@ export async function publishTileFromConfig(
340
343
  // Players is config-only (no CLI flag). `undefined` → preserve on republish;
341
344
  // `null` → the explicit clear sentinel; an object → set the value. The
342
345
  // config validator already canonicalized + capped it.
343
- const players: { value: TilePlayerCount } | { clear: true } | undefined =
344
- configPlayers === undefined
345
- ? undefined
346
- : configPlayers === null
347
- ? { clear: true }
348
- : { value: configPlayers };
346
+ const players = toSetOrClear(configPlayers);
347
+
348
+ // Languages is config-only too, with the same tri-state as players.
349
+ const languages = toSetOrClear(configLanguages);
349
350
 
350
351
  // Remix provenance is config-only (no CLI flag) — `poe-tiles remix` writes
351
352
  // it into `.poe-tile.json`. Same tri-state: `undefined` → preserve on
352
353
  // republish; `null` → the explicit clear sentinel; an object → claim. The
353
354
  // config validator checked the shape, which is all the server checks too.
354
- const remixOf: { value: PoeTileConfigRemixOf } | { clear: true } | undefined =
355
- configRemixOf === undefined
356
- ? undefined
357
- : configRemixOf === null
358
- ? { clear: true }
359
- : { value: configRemixOf };
355
+ const remixOf = toSetOrClear(configRemixOf);
360
356
 
361
357
  // Video is config-only (no CLI flag), same tri-state. `resolveVideo` reads
362
358
  // the local mp4 + poster into bytes; `null` → clear.
@@ -405,6 +401,7 @@ export async function publishTileFromConfig(
405
401
  sourceBundle: resolvedSourceBundle,
406
402
  screenshots,
407
403
  players,
404
+ languages,
408
405
  remixOf,
409
406
  // Instancing is config-only (no CLI flag). Two-state: `undefined` →
410
407
  // preserve on republish; a mode literal → set (`per-launch` resets).
@@ -154,6 +154,7 @@ function addMappedFields(form: FormData, commit: Commit): void {
154
154
  }
155
155
  for (const [formField, commitField] of [
156
156
  ["players", "players"],
157
+ ["languages", "languages"],
157
158
  ["remix_of", "remixOf"],
158
159
  ] as const) {
159
160
  const value = jsonField(form, formField);