@anna-ai/app-runtime 0.25.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 +27 -0
  2. package/dist/index.js +30 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -101,6 +101,33 @@ 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
+
104
131
  ## Host context: theme & language (v0.24.0)
105
132
 
106
133
  The dashboard tells every App which **theme** and **UI language** the user
package/dist/index.js CHANGED
@@ -1,5 +1,27 @@
1
1
  /**
2
- * Anna App Runtime SDK — v0.25.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.
3
25
  *
4
26
  * v0.25.0 — Image async jobs + artifact re-signing (design:
5
27
  * platform-media-generation-image-jobs.md §7 / §12.1; dispatcher 0.29.0).
@@ -957,6 +979,13 @@
957
979
  // for await (const ev of sess.run({ content: "hi" })) {
958
980
  // if (ev.event === "model_token") render(ev.text);
959
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`.
960
989
  // ==== BEGIN anna-voice-client-core ====
961
990
  var AnnaVoiceClientCore = (function () {
962
991
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anna-ai/app-runtime",
3
- "version": "0.25.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",