@anna-ai/app-runtime 0.23.0 → 0.26.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.
Files changed (3) hide show
  1. package/README.md +100 -0
  2. package/dist/index.js +189 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -101,6 +101,65 @@ Single file `dist/index.js`. Native ES module (ends in
101
101
  `export { AnnaAppRuntime, ... }`), no build step, runs directly in any modern
102
102
  browser via `<script type="module">` / `import`.
103
103
 
104
+ ## Agent run output cap & truncation (v0.26.0)
105
+
106
+ Host ≥ 1.1.0-beta.200 / dispatcher 0.30.0 (forum #403). The per-call output
107
+ cap of `agent.session.run` is `min(model output cap, 65 536)` clamped to the
108
+ model's context-budget reserve (10 % of context, ≤ 65 536) — e.g. 65 536 on
109
+ 1M-context models, 20 000 on 200K-context models. It is disclosed per run and
110
+ truncation of the final message is now signalled:
111
+
112
+ ```js
113
+ const sess = await anna.agent.session({ submode: "auto" });
114
+ for await (const ev of sess.run({ content: prompt, maxTokens: 16384 })) {
115
+ if (ev.event === "run_meta") console.log("cap:", ev.max_output_tokens);
116
+ const tc = ev.choices?.[0]?.delta?.task_complete;
117
+ if (tc?.truncated) {
118
+ // status is still "completed": the graph ended normally, but the final
119
+ // assistant message hit the per-call cap. Continue in the same session:
120
+ // sess.run({ content: "continue exactly from: " + tail })
121
+ }
122
+ }
123
+ ```
124
+
125
+ - `maxTokens?` (1..65536) can only **lower** the cap — never above platform ∩
126
+ model. Omit to use the model's own output cap.
127
+ - `task_complete.stop_reason` ∈ `endTurn | maxTokens | contentFilter | toolUse`
128
+ (same set as `llm.complete`'s `stopReason`); `truncated === (stop_reason === "maxTokens")`.
129
+ - Older hosts omit `max_output_tokens` / `stop_reason` / `truncated`.
130
+
131
+ ## Host context: theme & language (v0.24.0)
132
+
133
+ The dashboard tells every App which **theme** and **UI language** the user
134
+ chose, so Apps no longer guess from `prefers-color-scheme` / `navigator.language`.
135
+ No manifest grant is involved — these are one-way host→app broadcasts (like
136
+ `auth.refresh`), never callable RPC methods.
137
+
138
+ ```js
139
+ const anna = await AnnaAppRuntime.connect();
140
+
141
+ anna.theme; // 'light' | 'dark' — already correct before the first paint
142
+ anna.themeMode; // 'light' | 'dark' | 'system' — what the user picked
143
+ anna.locale; // 'en' | 'zh-CN' | … — dashboard UI language
144
+
145
+ // Subscribe; both replay the current value once, then fire on every change.
146
+ anna.onThemeChange(({ theme }) => { document.documentElement.dataset.theme = theme; });
147
+ anna.onLocaleChange(({ lang }) => i18n.setLocale(lang));
148
+ ```
149
+
150
+ Wire details: initial values ride on the iframe URL
151
+ (`…?wid=&t=&theme=light&themeMode=system&lang=zh-CN`) and are read synchronously
152
+ in `connect()`; live changes arrive as `{kind:"event", event:"theme.changed",
153
+ payload:{theme, mode}}` and `{event:"locale.changed", payload:{lang}}`. Hosts older
154
+ than this release send neither — the SDK falls back to `prefers-color-scheme` and
155
+ `navigator.language`, so keep a CSS fallback for standalone previews:
156
+
157
+ ```css
158
+ :root[data-theme="light"] { /* light tokens */ }
159
+ :root[data-theme="dark"] { /* dark tokens */ }
160
+ @media (prefers-color-scheme: dark) { :root:not([data-theme]) { /* dark tokens */ } }
161
+ ```
162
+
104
163
  ## Media generation (v0.20.0)
105
164
 
106
165
  Async video jobs + sync audio, gated by the per-app `media_grant`
@@ -160,6 +219,47 @@ song.idempotentReplay; // true when the key hit an existing job
160
219
  await anna.music.generate({ prompt: "ambient pad", model: "fal-ai/ace-step", durationSec: 30, instrumental: true });
161
220
  ```
162
221
 
222
+ ### Image async jobs & re-signing (v0.25.0)
223
+
224
+ `anna.image.generate` / `anna.image.edit` stay synchronous and unchanged. For
225
+ 2K/4K or `quality: "high"` renders (60–120 s) opt into the same async-job shape
226
+ as video / music — `ijob_…` ids, `media_job` events, pre-hold → settle (on the
227
+ actual number of images) → refund — and re-sign any already-paid artifact for
228
+ 7 days instead of losing it after the 30-min URL TTL. Requires
229
+ `ui.host_api.image` listing the new method names + the existing `image_grant`
230
+ (`allowGenerate` / `allowEdit`; no new grant).
231
+
232
+ ```js
233
+ // Same request body as image.generate, plus clientTag / idempotencyKey.
234
+ const job = await anna.image.generateAwait(
235
+ { prompt: "A bold art-deco poster of the planet Mars", n: 2,
236
+ model: "fal-ai/nano-banana-2", aspect_ratio: "9:16", params: { resolution: "4K" },
237
+ clientTag: "poster-v3", idempotencyKey: `poster-v3:${attempt}` }, // 24h replay → same job, no re-charge
238
+ { onProgress: (p) => status.textContent = `${p.state} · queue ${p.queuePosition ?? "-"}`,
239
+ signal: abortController.signal } // → image.cancelJob
240
+ );
241
+ job.result.images; // [{url, r2Key, mimeType, width, height, expiresIn}] — url re-signed by getJob
242
+ job.billedCostCU; // settled on actual output (≤ estimatedCostCU)
243
+
244
+ // Edit (optionally mask-based) as a job:
245
+ await anna.image.editAwait({ image_url, prompt: "replace the sky with aurora", mask_url, model: "openai/gpt-image-2" });
246
+
247
+ // Reload recovery / correlation — same four-pack as video / music:
248
+ const { jobs } = await anna.image.listJobs({ state: "running", clientTag: "poster-v3" });
249
+ const fresh = await anna.image.getJob({ jobId }); // every result.images[].url re-signed (~30 min)
250
+
251
+ // Re-sign already-paid artifacts (sync `images[].r2_key` or job `r2Key`), up to 7 days:
252
+ const { urls } = await anna.image.resign({ r2Keys: [img.images[0].r2_key, job.result.images[0].r2Key] });
253
+ // One key that is not yours → whole call fails with IMAGE_ASSET_NOT_FOUND (details.data.index).
254
+ ```
255
+
256
+ Errors surface as `HostRpcError` names: `IMAGE_JOB_NOT_FOUND`,
257
+ `IMAGE_JOB_NOT_CANCELLABLE`, `IMAGE_CONTENT_REJECTED` (also replaces the sync
258
+ path's former `APP_PROVIDER_ERROR` for provider safety rejections),
259
+ `IMAGE_JOB_EXPIRED`, `IMAGE_ASSET_NOT_FOUND`; `error.details.data` now carries
260
+ `allowed` / `alternatives` / `index`. `anna.llm.catalog` image entries report
261
+ `capabilities.jobs` and, for `image_edit`, the real `options.n.max`.
262
+
163
263
  ### Model-aware options (v0.22.0)
164
264
 
165
265
  Every TTS / image model describes its knobs in `capabilities.options`
package/dist/index.js CHANGED
@@ -1,5 +1,84 @@
1
1
  /**
2
- * Anna App Runtime SDK — v0.23.0
2
+ * Anna App Runtime SDK — v0.26.0
3
+ *
4
+ * v0.26.0 — Agent run output cap + truncation signal (forum #403;
5
+ * docs/bug/forum-403-agent-session-output-cap-8192-regression.md;
6
+ * dispatcher 0.30.0, host >= 1.1.0-beta.200). Contract-only release —
7
+ * `AgentSession.run` / `anna.agent.session.run` already pass every arg
8
+ * through; this documents the new wire fields:
9
+ * • `sess.run({content, maxTokens?})` — optional per-call output cap for
10
+ * every model call in the run (1..65536). Effective value is
11
+ * `min(maxTokens, model output cap, 65536)` further clamped to the
12
+ * model's context-budget reserve (10 % of context, ≤ 65 536); it can
13
+ * only lower the cap, never raise it above platform ∩ model. Omit to
14
+ * use the model's own output cap (the beta.179–199 fixed 8192 default
15
+ * is gone).
16
+ * • `run_meta.max_output_tokens` — the effective per-call cap for THIS
17
+ * run (after ceiling + clamp), published before any token.
18
+ * • `task_complete.{stop_reason, truncated, max_output_tokens}` —
19
+ * `status: "completed"` ONLY means the graph finished normally;
20
+ * `truncated === true` (⇔ `stop_reason === "maxTokens"`) flags that the
21
+ * FINAL assistant message hit the per-call cap and is incomplete
22
+ * (`history()` stores it as-is). `stop_reason` shares the
23
+ * `llm.complete` `stopReason` set: `endTurn | maxTokens |
24
+ * contentFilter | toolUse`. Older hosts omit all three fields.
25
+ *
26
+ * v0.25.0 — Image async jobs + artifact re-signing (design:
27
+ * platform-media-generation-image-jobs.md §7 / §12.1; dispatcher 0.29.0).
28
+ * Image becomes the third media line with the video / music job shape —
29
+ * as an *opt-in* next to the unchanged synchronous `anna.image.generate`
30
+ * / `anna.image.edit` (byte-for-byte identical contract):
31
+ * • `anna.image.generateAsync(args & {clientTag?, idempotencyKey?})` /
32
+ * `anna.image.editAsync(...)` → `{jobId:"ijob_…", kind:"image",
33
+ * state:"queued", estimatedCostCU, deadlineAt, idempotentReplay}`.
34
+ * Request body = the sync body; one job = one user action = `n` images
35
+ * (held up-front, settled on actual output, refunded on failure /
36
+ * cancel). Same `idempotencyKey` rules as music (≤64 chars, 24 h).
37
+ * • `anna.image.getJob({jobId})` (re-signs every `result.images[].url`,
38
+ * ~30 min), `listJobs({state?, clientTag?, limit?, cursor?})`,
39
+ * `cancelJob({jobId})` (queued = full refund; running = best-effort).
40
+ * • `anna.image.generateAwait(args, {onProgress, signal, timeoutMs})` /
41
+ * `editAwait(...)` — the image twins of `video.generateAwait`
42
+ * (shared `mediaGenerateAwaitImpl`, now parameterised by the create
43
+ * method and filtering `media_job` events by `kind === "image"` /
44
+ * `ijob_` prefix). Resolve with the terminal job view whose
45
+ * `result.images[]` carry `{url, r2Key, mimeType, width, height,
46
+ * expiresIn}`; `url` is `null` once the object was GC'd (7 days).
47
+ * • `anna.image.resign({r2Keys})` → `{urls:[{r2Key, url, expiresIn}]}` —
48
+ * re-sign any already-paid artifact (sync result `r2_key` or job
49
+ * `r2Key`) for 7 days; one foreign / malformed key fails the whole call
50
+ * with `IMAGE_ASSET_NOT_FOUND` (`details.data.index`).
51
+ * • `anna.image.onJobEvent(fn)` — raw `media_job` stream (kind "image").
52
+ * Errors: `IMAGE_JOB_NOT_FOUND` / `IMAGE_JOB_NOT_CANCELLABLE` /
53
+ * `IMAGE_CONTENT_REJECTED` / `IMAGE_JOB_EXPIRED` / `IMAGE_ASSET_NOT_FOUND`
54
+ * via `HostRpcError` (name + `details.jsonrpc_code`; `details.data` now
55
+ * carries the facade `data` — `allowed`, `alternatives`, `index`). The sync
56
+ * path's provider content rejection moved from `APP_PROVIDER_ERROR` to
57
+ * `IMAGE_CONTENT_REJECTED` (-32115). `llm.catalog` image entries gain
58
+ * `capabilities.jobs` and `image_edit` entries report the real
59
+ * `options.n.max` (= grant `maxPerCallEdit`). Grant: `image_grant`
60
+ * (`allowGenerate` / `allowEdit`) — no new grant; manifest `host_api.image`
61
+ * must list the new method names. Coordinated: dispatcher / schema 0.29.0,
62
+ * anna-app-core 0.26.0, runtime-local a30, cli 0.1.60.
63
+ *
64
+ * v0.24.0 — Theme & locale propagation (design:
65
+ * anna-app-theme-propagation.md §2/§4, extended with locale per
66
+ * docs/design/apps/anna-music.md §12.2-G8).
67
+ * The host now tells every App which theme and UI language the user has
68
+ * chosen, so Apps no longer have to guess from `prefers-color-scheme` /
69
+ * `navigator.language`:
70
+ * • Initial values ride on the iframe URL (`?theme=light|dark&themeMode=
71
+ * light|dark|system&lang=en|zh-CN`) and are read synchronously in
72
+ * `connect()` — before any RPC, so the first paint is already right.
73
+ * • Live changes arrive as one-way host→app broadcast events
74
+ * `theme.changed {theme, mode}` and `locale.changed {lang}` (same
75
+ * envelope as `auth.refresh`; no `host_api` grant involved).
76
+ * • Read-only mirrors `rt.theme`, `rt.themeMode`, `rt.locale` are kept
77
+ * fresh even without subscribers; `rt.onThemeChange(fn)` /
78
+ * `rt.onLocaleChange(fn)` subscribe AND replay the current value once.
79
+ * Hosts older than this release send neither — the SDK falls back to
80
+ * `prefers-color-scheme` / `navigator.language` so old+new combinations
81
+ * keep working. No dispatcher / schema / backend change (additive).
3
82
  *
4
83
  * v0.23.0 — Music generation surface (design:
5
84
  * platform-media-generation-music.md §7/§9/§12.1).
@@ -653,13 +732,20 @@
653
732
  return err;
654
733
  }
655
734
 
656
- // Shared by video (v0.20.0) and music (v0.23.0): `ns` selects the RPC
657
- // namespace; wire shapes are identical except the music job view carries
658
- // `idempotentReplay` (a terminal replay resolves without polling).
659
- function mediaGenerateAwaitImpl(rt, ns, args, opts = {}) {
735
+ // Shared by video (v0.20.0), music (v0.23.0) and image (v0.25.0): `ns`
736
+ // selects the RPC namespace; wire shapes are identical except the music /
737
+ // image job views carry `idempotentReplay` (a terminal replay resolves
738
+ // without polling). `impl.createMethod` (default "generate") lets image
739
+ // submit through `generateAsync` / `editAsync` while the sync `generate` /
740
+ // `edit` keep their contract; `impl.kindFilter` (default = ns) drops
741
+ // `media_job` events of other kinds sharing the stream.
742
+ function mediaGenerateAwaitImpl(rt, ns, args, opts = {}, impl = {}) {
660
743
  const onProgress =
661
744
  typeof opts.onProgress === "function" ? opts.onProgress : null;
662
745
  const signal = opts.signal || null;
746
+ const createMethod = impl.createMethod || "generate";
747
+ const kindFilter = impl.kindFilter || ns;
748
+ const label = `${ns}.${impl.awaitName || "generateAwait"}`;
663
749
 
664
750
  return new Promise((resolve, reject) => {
665
751
  let settled = false;
@@ -731,6 +817,7 @@
731
817
  e &&
732
818
  (e.code === "VIDEO_JOB_NOT_FOUND" ||
733
819
  e.code === "MUSIC_JOB_NOT_FOUND" ||
820
+ e.code === "IMAGE_JOB_NOT_FOUND" ||
734
821
  e.code === "job_not_found")
735
822
  ) {
736
823
  settleErr(e);
@@ -745,6 +832,7 @@
745
832
 
746
833
  const onJobEvent = (payload) => {
747
834
  if (settled || !payload || payload.jobId !== jobId) return;
835
+ if (payload.kind && payload.kind !== kindFilter) return;
748
836
  eventSeen = true;
749
837
  deliverProgress(payload.seq, payload.progress, payload.state);
750
838
  // Terminal push → fetch the authoritative view immediately (the
@@ -754,14 +842,14 @@
754
842
 
755
843
  const start = async () => {
756
844
  if (signal && signal.aborted) {
757
- const err = new Error(`${ns}.generateAwait aborted before start`);
845
+ const err = new Error(`${label} aborted before start`);
758
846
  err.code = "cancelled";
759
847
  settleErr(err);
760
848
  return;
761
849
  }
762
850
  let created;
763
851
  try {
764
- created = await rt.call(ns, "generate", args || {});
852
+ created = await rt.call(ns, createMethod, args || {});
765
853
  } catch (e) {
766
854
  settleErr(e);
767
855
  return;
@@ -783,7 +871,7 @@
783
871
  : 35 * 60 * 1000;
784
872
  wallTimer = setTimeout(() => {
785
873
  const err = new Error(
786
- `${ns}.generateAwait wall clock elapsed after ${wallMs}ms; ` +
874
+ `${label} wall clock elapsed after ${wallMs}ms; ` +
787
875
  `job ${jobId} may still be rendering — recover it with ` +
788
876
  `anna.${ns}.getJob({jobId})`
789
877
  );
@@ -837,6 +925,49 @@
837
925
  return buildMediaJobNamespace(rt, "music");
838
926
  }
839
927
 
928
+ // v0.25.0 — anna.image.* (platform-media-generation-image-jobs.md §12.1):
929
+ // the plain `image` proxy (sync generate / edit / resign + job four-pack)
930
+ // wrapped with `generateAwait` / `editAwait` (submit via generateAsync /
931
+ // editAsync, then the shared await loop filtered to kind "image") and
932
+ // `onJobEvent` (raw `media_job` stream, image events only).
933
+ function buildImageNamespace(rt) {
934
+ const base = buildNamespace(rt, "image");
935
+ return new Proxy(base, {
936
+ get(target, method) {
937
+ if (typeof method !== "string") return undefined;
938
+ if (method === "onJobEvent") {
939
+ return (fn) =>
940
+ rt.on("media_job", (payload) => {
941
+ if (!payload) return;
942
+ const isImage =
943
+ payload.kind === "image" ||
944
+ (!payload.kind &&
945
+ typeof payload.jobId === "string" &&
946
+ payload.jobId.startsWith("ijob_"));
947
+ if (isImage) fn(payload);
948
+ });
949
+ }
950
+ if (method === "generateAwait") {
951
+ return (args, opts) =>
952
+ mediaGenerateAwaitImpl(rt, "image", args, opts || {}, {
953
+ createMethod: "generateAsync",
954
+ kindFilter: "image",
955
+ awaitName: "generateAwait",
956
+ });
957
+ }
958
+ if (method === "editAwait") {
959
+ return (args, opts) =>
960
+ mediaGenerateAwaitImpl(rt, "image", args, opts || {}, {
961
+ createMethod: "editAsync",
962
+ kindFilter: "image",
963
+ awaitName: "editAwait",
964
+ });
965
+ }
966
+ return target[method];
967
+ },
968
+ });
969
+ }
970
+
840
971
  // ---- Agent namespace (v0.2.0) ----
841
972
  //
842
973
  // Exposes both raw RPCs (`anna.agent.session.create({submode, ...})`,
@@ -848,6 +979,13 @@
848
979
  // for await (const ev of sess.run({ content: "hi" })) {
849
980
  // if (ev.event === "model_token") render(ev.text);
850
981
  // }
982
+ //
983
+ // `sess.run(opts)` wire args (all optional except `content`):
984
+ // `{content, run_id?, recursion_limit?, systemPrompt?, allowed_tools?,
985
+ // modelPreferences?, attachments?, maxTokens?}` — `maxTokens`
986
+ // (v0.26.0 / dispatcher 0.30.0) caps every model call in the run; the
987
+ // host discloses the effective value in `run_meta.max_output_tokens`
988
+ // and flags a cut-off final message via `task_complete.truncated`.
851
989
  // ==== BEGIN anna-voice-client-core ====
852
990
  var AnnaVoiceClientCore = (function () {
853
991
  "use strict";
@@ -1920,6 +2058,11 @@ var AnnaVoiceClientCore = (function () {
1920
2058
  this.app = null;
1921
2059
  this.runtimeState = null;
1922
2060
  this.geometry = null;
2061
+ // v0.24.0 host context mirrors (filled by connect() from the URL, then
2062
+ // kept fresh by `theme.changed` / `locale.changed` broadcasts).
2063
+ this.theme = null; // 'light' | 'dark'
2064
+ this.themeMode = null; // 'light' | 'dark' | 'system'
2065
+ this.locale = null; // BCP-47-ish host tag, e.g. 'en' | 'zh-CN'
1923
2066
 
1924
2067
  // namespace proxies
1925
2068
  this.tools = buildToolsNamespace(this);
@@ -1947,7 +2090,7 @@ var AnnaVoiceClientCore = (function () {
1947
2090
  // anna.upload.inline({filename, mime_type, content_b64, purpose?, metadata?})
1948
2091
  // anna.upload.negotiate({filename, mime_type, size_bytes, purpose?, metadata?})
1949
2092
  // anna.upload.confirm({r2_key})
1950
- this.image = buildNamespace(this, "image");
2093
+ this.image = buildImageNamespace(this);
1951
2094
  this.upload = buildNamespace(this, "upload");
1952
2095
 
1953
2096
  // ---- video / audio namespaces (v0.20.0; media generation) ----
@@ -2103,6 +2246,12 @@ var AnnaVoiceClientCore = (function () {
2103
2246
  // handlers (and later reads) observe the updated values.
2104
2247
  if (msg.event === "entry_payload") {
2105
2248
  this.entryPayload = msg.payload || {};
2249
+ } else if (msg.event === "theme.changed" && msg.payload) {
2250
+ // v0.24.0: cache first so late subscribers / plain reads see it.
2251
+ if (msg.payload.theme === "light" || msg.payload.theme === "dark") this.theme = msg.payload.theme;
2252
+ if (msg.payload.mode) this.themeMode = String(msg.payload.mode);
2253
+ } else if (msg.event === "locale.changed" && msg.payload) {
2254
+ if (msg.payload.lang) this.locale = String(msg.payload.lang);
2106
2255
  } else if (msg.event === "runtime_state_synced") {
2107
2256
  const patch = msg.payload && msg.payload.patch;
2108
2257
  if (patch) {
@@ -2121,6 +2270,28 @@ var AnnaVoiceClientCore = (function () {
2121
2270
  return () => set.delete(fn);
2122
2271
  }
2123
2272
 
2273
+ /**
2274
+ * v0.24.0 — subscribe to host theme changes. Replays the current value
2275
+ * immediately so callers never race the handshake. Returns unsubscribe.
2276
+ * @param {(t:{theme:'light'|'dark', mode:'light'|'dark'|'system'})=>void} fn
2277
+ */
2278
+ onThemeChange(fn) {
2279
+ const off = this.on("theme.changed", (p) => fn({ theme: this.theme, mode: this.themeMode, ...(p || {}) }));
2280
+ try { fn({ theme: this.theme, mode: this.themeMode }); } catch (_) {}
2281
+ return off;
2282
+ }
2283
+
2284
+ /**
2285
+ * v0.24.0 — subscribe to host UI-language changes (`{lang}`), replaying
2286
+ * the current value immediately. Returns unsubscribe.
2287
+ * @param {(l:{lang:string})=>void} fn
2288
+ */
2289
+ onLocaleChange(fn) {
2290
+ const off = this.on("locale.changed", (p) => fn({ lang: this.locale, ...(p || {}) }));
2291
+ try { fn({ lang: this.locale }); } catch (_) {}
2292
+ return off;
2293
+ }
2294
+
2124
2295
  call(ns, method, args, opts) {
2125
2296
  if (this._closed) return Promise.reject(new Error("runtime closed"));
2126
2297
  const timeoutMs =
@@ -2207,6 +2378,15 @@ var AnnaVoiceClientCore = (function () {
2207
2378
  throw new Error("[anna-sdk] missing wid/t URL parameters");
2208
2379
  }
2209
2380
  const rt = new AnnaAppRuntime({ windowUuid: wid, token, parent: window.parent });
2381
+ // v0.24.0: host context from the iframe URL — synchronous, pre-RPC, so
2382
+ // the first paint already matches the dashboard. Old hosts omit these;
2383
+ // fall back to the browser's own signals.
2384
+ const urlTheme = params.get("theme");
2385
+ rt.theme = urlTheme === "light" || urlTheme === "dark"
2386
+ ? urlTheme
2387
+ : (typeof window.matchMedia === "function" && window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : "dark");
2388
+ rt.themeMode = params.get("themeMode") || (urlTheme ? rt.theme : "system");
2389
+ rt.locale = params.get("lang") || (typeof navigator !== "undefined" && navigator.language) || "en";
2210
2390
  const hello = await rt.call("window", "hello", {});
2211
2391
  rt.capabilities = hello.capabilities;
2212
2392
  rt.viewMeta = hello.view_meta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anna-ai/app-runtime",
3
- "version": "0.23.0",
3
+ "version": "0.26.0",
4
4
  "description": "Anna App browser runtime SDK. Loaded by every Anna App iframe; provides typed proxy over the postMessage RPC bridge to the host (Anna dashboard / `anna-app dev` harness).",
5
5
  "license": "MIT",
6
6
  "type": "module",