@anna-ai/app-runtime 0.29.0 → 0.30.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 +22 -0
- package/dist/index.js +57 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,6 +95,28 @@ The bundle author writes the same
|
|
|
95
95
|
`import { AnnaAppRuntime } from "/static/anna-apps/_sdk/latest/index.js"`
|
|
96
96
|
either way; the URL is part of the host contract.
|
|
97
97
|
|
|
98
|
+
### Loading the exact build the host runs
|
|
99
|
+
|
|
100
|
+
`latest` is a mutable alias: a browser or CDN that still holds an older copy
|
|
101
|
+
can hand your app an SDK that predates the host's (missing namespaces). The
|
|
102
|
+
production host therefore also names the exact build in the iframe URL, as the
|
|
103
|
+
`sdk` query parameter — a content-addressed path such as
|
|
104
|
+
`/static/anna-apps/_sdk/0.29.0/index.js?v=44987f881836`. That address changes
|
|
105
|
+
whenever the SDK does, so no cache can return a stale file. Prefer it, and keep
|
|
106
|
+
`latest` as the fallback for hosts that do not send it (`anna-app dev`, older
|
|
107
|
+
nexus):
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
const LATEST = "/static/anna-apps/_sdk/latest/index.js";
|
|
111
|
+
const PINNED = /^\/static\/anna-apps\/_sdk\/[\w.-]+\/index\.js(\?v=[0-9a-f]+)?$/;
|
|
112
|
+
|
|
113
|
+
const named = new URLSearchParams(location.search).get("sdk");
|
|
114
|
+
const { AnnaAppRuntime } = await import(named && PINNED.test(named) ? named : LATEST);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Validate the value as above: it is read from the URL, so accept nothing but
|
|
118
|
+
the host's own SDK path.
|
|
119
|
+
|
|
98
120
|
## Versioning
|
|
99
121
|
|
|
100
122
|
This package's version tracks `dispatcher_version` (wire protocol). See
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Anna App Runtime SDK — v0.
|
|
2
|
+
* Anna App Runtime SDK — v0.30.0
|
|
3
|
+
*
|
|
4
|
+
* v0.30.0 — Cross-user messaging (design: docs/design/apps/chat-e2ee.md §6;
|
|
5
|
+
* dispatcher 0.37.0, schema 0.37.0, anna-app-core 0.32.0). Additive:
|
|
6
|
+
* - `anna.peers.me/lookup/block/report`, `anna.peers.keys.publish`,
|
|
7
|
+
* `anna.peers.channel.open/list/respond/leave/append/read` — exchange
|
|
8
|
+
* opaque events with the same App under another user's account. The
|
|
9
|
+
* platform stores and relays bytes it never parses (`body` / `public`
|
|
10
|
+
* are standard base64 on the wire).
|
|
11
|
+
* - `anna.peers.onEvent(fn)` — `{channel_uuid, type, seq}` hints
|
|
12
|
+
* (`type` is "event" or "channel"). Hints are best-effort and carry no
|
|
13
|
+
* content: pull with `channel.read` / `channel.list`, and poll as a
|
|
14
|
+
* fallback. Returns an unsubscribe function.
|
|
15
|
+
* Requires manifest `ui.host_api.peers = true`.
|
|
3
16
|
*
|
|
4
17
|
* v0.29.0 — Durable conversations (design: docs/design/apps/chat.md §5;
|
|
5
18
|
* dispatcher 0.36.0, schema 0.36.0, anna-app-core 0.31.0). Additive:
|
|
@@ -1864,6 +1877,28 @@ var AnnaVoiceClientCore = (function () {
|
|
|
1864
1877
|
);
|
|
1865
1878
|
}
|
|
1866
1879
|
|
|
1880
|
+
// ---- peers namespace (v0.30.0; cross-user messaging) ----
|
|
1881
|
+
//
|
|
1882
|
+
// Thin RPC wrappers; the nested `keys.*` / `channel.*` methods map to wire
|
|
1883
|
+
// methods `peers/keys.<m>` / `peers/channel.<m>`.
|
|
1884
|
+
function buildPeersNamespace(rt) {
|
|
1885
|
+
const rpc = (method) => (args, opts) =>
|
|
1886
|
+
rt.call("peers", method, args || {}, opts);
|
|
1887
|
+
const group = (prefix, methods) =>
|
|
1888
|
+
Object.fromEntries(methods.map((m) => [m, rpc(prefix + "." + m)]));
|
|
1889
|
+
return {
|
|
1890
|
+
me: rpc("me"),
|
|
1891
|
+
lookup: rpc("lookup"),
|
|
1892
|
+
block: rpc("block"),
|
|
1893
|
+
report: rpc("report"),
|
|
1894
|
+
keys: group("keys", ["publish"]),
|
|
1895
|
+
channel: group("channel", [
|
|
1896
|
+
"open", "list", "respond", "leave", "append", "read",
|
|
1897
|
+
]),
|
|
1898
|
+
onEvent: (fn) => rt.on("peers", fn),
|
|
1899
|
+
};
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1867
1902
|
// ---- conversation namespace (v0.29.0; durable conversations) ----
|
|
1868
1903
|
//
|
|
1869
1904
|
// `send` / `attach` reuse AgentRunStream unchanged: frames arrive as
|
|
@@ -2276,6 +2311,27 @@ var AnnaVoiceClientCore = (function () {
|
|
|
2276
2311
|
// declaration; design apps/chat.md §5.1).
|
|
2277
2312
|
this.conversation = buildConversationNamespace(this);
|
|
2278
2313
|
|
|
2314
|
+
// ---- peers namespace (v0.30.0; cross-user messaging) ----
|
|
2315
|
+
// anna.peers.me() → {username, display_name, avatar_url, public,
|
|
2316
|
+
// key_updated_at}
|
|
2317
|
+
// anna.peers.lookup({username}) → same shape; exact match only
|
|
2318
|
+
// anna.peers.keys.publish({public}) → {key_updated_at}
|
|
2319
|
+
// anna.peers.channel.open({username}) → Channel
|
|
2320
|
+
// anna.peers.channel.list() → {channels}
|
|
2321
|
+
// anna.peers.channel.respond({channel_uuid, accept}) → Channel
|
|
2322
|
+
// anna.peers.channel.leave({channel_uuid}) → {left}
|
|
2323
|
+
// anna.peers.channel.append({channel_uuid, client_msg_id, body})
|
|
2324
|
+
// → {seq, created_at}; idempotent on client_msg_id
|
|
2325
|
+
// anna.peers.channel.read({channel_uuid, after_seq?, before_seq?,
|
|
2326
|
+
// limit?}) → {events, last_seq}
|
|
2327
|
+
// anna.peers.block({username, blocked}) → {blocked}
|
|
2328
|
+
// anna.peers.report({channel_uuid, reason, evidence?}) → {reported}
|
|
2329
|
+
// anna.peers.onEvent(fn) → unsubscribe; fn({channel_uuid, type, seq})
|
|
2330
|
+
// `body` / `public` are opaque bytes (standard base64) the platform
|
|
2331
|
+
// never parses. Requires manifest ui.host_api.peers = true
|
|
2332
|
+
// (second-principal declaration; design apps/chat-e2ee.md §6.1).
|
|
2333
|
+
this.peers = buildPeersNamespace(this);
|
|
2334
|
+
|
|
2279
2335
|
// ---- mobile namespace (v0.16.0; anna-mobile native bridge) ----
|
|
2280
2336
|
// anna.mobile.share({title?, text?, url?, filename?, data_url?})
|
|
2281
2337
|
// → {shared} (user cancel = {shared:false}, not an error)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anna-ai/app-runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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",
|