@anna-ai/app-runtime 0.25.0 → 0.27.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.
- package/README.md +27 -0
- package/dist/index.js +51 -1
- 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,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anna App Runtime SDK — v0.
|
|
2
|
+
* Anna App Runtime SDK — v0.27.0
|
|
3
|
+
*
|
|
4
|
+
* v0.27.0 — Thinking / reasoning control (forum #454; design:
|
|
5
|
+
* docs/design/llm-thinking-control.md; dispatcher 0.32.0, schema 0.32.0,
|
|
6
|
+
* anna-app-core 0.27.1). Contract-only release — no code change:
|
|
7
|
+
* - `anna.llm.complete(req)` / `anna.llm.stream(req)` /
|
|
8
|
+
* `anna.agent.session.run(req)` accept an optional `thinking` field:
|
|
9
|
+
* `boolean | {enabled?, effort?: "minimal"|"low"|"medium"|"high"|"xhigh"|"max",
|
|
10
|
+
* budgetTokens?, includeReasoning?}`. Programmatic surfaces default to
|
|
11
|
+
* thinking OFF when the model can disable it; `agent.session.run` keeps
|
|
12
|
+
* the provider default. Pass `thinking: true` / `{effort}` to opt in.
|
|
13
|
+
* - Responses echo `_meta.thinking = {requested, effective:{enabled,
|
|
14
|
+
* effort?, budgetTokens?}, applied, reason, warning?}` (complete / stream
|
|
15
|
+
* terminal frame) or `run_meta.thinking` (agent run), plus additive
|
|
16
|
+
* `usage.reasoningTokens` when the provider reports it.
|
|
17
|
+
* - `llm.stream` may emit additive `{event:"reasoning_token", text}` frames
|
|
18
|
+
* when `thinking.includeReasoning === true`; `completeOverStream` already
|
|
19
|
+
* ignores unknown events, so the complete-over-stream sugar is unaffected.
|
|
20
|
+
* - Truncation check: `stopReason === "maxTokens" &&
|
|
21
|
+
* usage.outputTokens - (usage.reasoningTokens ?? 0) ≈ 0` ⇒ reasoning ate
|
|
22
|
+
* the budget — retry with `thinking:false` or a larger `maxTokens`.
|
|
23
|
+
* On DashScope/Qwen `maxTokens` INCLUDES reasoning tokens.
|
|
24
|
+
*
|
|
25
|
+
* v0.26.0 — Agent run output cap + truncation signal (forum #403;
|
|
26
|
+
* docs/bug/forum-403-agent-session-output-cap-8192-regression.md;
|
|
27
|
+
* dispatcher 0.30.0, host >= 1.1.0-beta.200). Contract-only release —
|
|
28
|
+
* `AgentSession.run` / `anna.agent.session.run` already pass every arg
|
|
29
|
+
* through; this documents the new wire fields:
|
|
30
|
+
* • `sess.run({content, maxTokens?})` — optional per-call output cap for
|
|
31
|
+
* every model call in the run (1..65536). Effective value is
|
|
32
|
+
* `min(maxTokens, model output cap, 65536)` further clamped to the
|
|
33
|
+
* model's context-budget reserve (10 % of context, ≤ 65 536); it can
|
|
34
|
+
* only lower the cap, never raise it above platform ∩ model. Omit to
|
|
35
|
+
* use the model's own output cap (the beta.179–199 fixed 8192 default
|
|
36
|
+
* is gone).
|
|
37
|
+
* • `run_meta.max_output_tokens` — the effective per-call cap for THIS
|
|
38
|
+
* run (after ceiling + clamp), published before any token.
|
|
39
|
+
* • `task_complete.{stop_reason, truncated, max_output_tokens}` —
|
|
40
|
+
* `status: "completed"` ONLY means the graph finished normally;
|
|
41
|
+
* `truncated === true` (⇔ `stop_reason === "maxTokens"`) flags that the
|
|
42
|
+
* FINAL assistant message hit the per-call cap and is incomplete
|
|
43
|
+
* (`history()` stores it as-is). `stop_reason` shares the
|
|
44
|
+
* `llm.complete` `stopReason` set: `endTurn | maxTokens |
|
|
45
|
+
* contentFilter | toolUse`. Older hosts omit all three fields.
|
|
3
46
|
*
|
|
4
47
|
* v0.25.0 — Image async jobs + artifact re-signing (design:
|
|
5
48
|
* platform-media-generation-image-jobs.md §7 / §12.1; dispatcher 0.29.0).
|
|
@@ -957,6 +1000,13 @@
|
|
|
957
1000
|
// for await (const ev of sess.run({ content: "hi" })) {
|
|
958
1001
|
// if (ev.event === "model_token") render(ev.text);
|
|
959
1002
|
// }
|
|
1003
|
+
//
|
|
1004
|
+
// `sess.run(opts)` wire args (all optional except `content`):
|
|
1005
|
+
// `{content, run_id?, recursion_limit?, systemPrompt?, allowed_tools?,
|
|
1006
|
+
// modelPreferences?, attachments?, maxTokens?}` — `maxTokens`
|
|
1007
|
+
// (v0.26.0 / dispatcher 0.30.0) caps every model call in the run; the
|
|
1008
|
+
// host discloses the effective value in `run_meta.max_output_tokens`
|
|
1009
|
+
// and flags a cut-off final message via `task_complete.truncated`.
|
|
960
1010
|
// ==== BEGIN anna-voice-client-core ====
|
|
961
1011
|
var AnnaVoiceClientCore = (function () {
|
|
962
1012
|
"use strict";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anna-ai/app-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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",
|