@anna-ai/app-runtime 0.10.0 → 0.12.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 (2) hide show
  1. package/dist/index.js +52 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,17 @@
1
1
  /**
2
- * Anna App Runtime SDK — v0.10.0
2
+ * Anna App Runtime SDK — v0.11.0
3
+ *
4
+ * v0.11.0 — Adds the `anna.credentials.*` namespace — platform-credentials
5
+ * multi-account access (design platform-credentials-multi-account.md §7).
6
+ * `anna.credentials.list_accounts({provider})` lists the user's authorized
7
+ * accounts (metadata only — never tokens); `anna.credentials.get_token(
8
+ * {provider, account_id?})` returns a short-lived access_token for one
9
+ * account (`account_id` omitted → the user's default account). Gated by
10
+ * manifest `ui.host_api.credentials` (a list of PROVIDER IDS, e.g.
11
+ * ["google"]) plus the user-enabled per-app `credentials_grant`.
12
+ * Coordinated bump: wire namespace `credentials/*` — dispatcher_version
13
+ * 0.13.0 + schema 0.13.0 + anna-app-core 0.12.0. Additive: old hosts
14
+ * return `-32601 Method not found` for `credentials.*`.
3
15
  *
4
16
  * v0.10.0 — Adds `anna.llm.stream(req)` — streaming L1 completion. Takes the
5
17
  * SAME request shape as `anna.llm.complete(req)` but returns an
@@ -161,6 +173,36 @@
161
173
  );
162
174
  }
163
175
 
176
+ // ---- Tools namespace (v0.12.0) ----
177
+ //
178
+ // Plain RPC proxy (`anna.tools.invoke`, `anna.tools.list`) plus one
179
+ // client-side subscription helper:
180
+ //
181
+ // const off = anna.tools.onChanged(({ client_id, deployed }) => {
182
+ // // deploy reconciliation just landed tools on the agent —
183
+ // // re-run anna.tools.list() and re-enable buttons.
184
+ // });
185
+ //
186
+ // Fired when the host broadcasts a `tools.changed` window event (deploy
187
+ // reconciliation §6.3). Returns an unsubscribe function. `tools.list`
188
+ // entries MAY carry an optional `status` field ("available" |
189
+ // "deploying" | "unavailable"); treat a missing `status` as available
190
+ // (hosts without fact data degrade to the legacy static list).
191
+ function buildToolsNamespace(rt) {
192
+ return new Proxy(
193
+ {},
194
+ {
195
+ get(_, method) {
196
+ if (typeof method !== "string") return undefined;
197
+ if (method === "onChanged") {
198
+ return (fn) => rt.on("tools.changed", fn);
199
+ }
200
+ return (args, opts) => rt.call("tools", method, args || {}, opts);
201
+ },
202
+ }
203
+ );
204
+ }
205
+
164
206
  // ---- Agent namespace (v0.2.0) ----
165
207
  //
166
208
  // Exposes both raw RPCs (`anna.agent.session.create({submode, ...})`,
@@ -469,7 +511,7 @@
469
511
  this.geometry = null;
470
512
 
471
513
  // namespace proxies
472
- this.tools = buildNamespace(this, "tools");
514
+ this.tools = buildToolsNamespace(this);
473
515
  this.chat = buildNamespace(this, "chat");
474
516
  this.artifact = buildNamespace(this, "artifact");
475
517
  this.llm = buildLlmNamespace(this);
@@ -493,6 +535,14 @@
493
535
  this.image = buildNamespace(this, "image");
494
536
  this.upload = buildNamespace(this, "upload");
495
537
 
538
+ // ---- credentials namespace (v0.11.0; multi-account) ----
539
+ // anna.credentials.list_accounts({provider}) — metadata only, no tokens
540
+ // anna.credentials.get_token({provider, account_id?}) — short-lived
541
+ // access_token for one account; account_id omitted → default account.
542
+ // Requires manifest ui.host_api.credentials (provider ids) AND the
543
+ // user-enabled per-app credentials_grant.
544
+ this.credentials = buildNamespace(this, "credentials");
545
+
496
546
  // ---- files namespace (APS object/blob API; v0.5.x) ----
497
547
  // anna.files.upload_init({path, content_type, size, ttl_seconds?, metadata?, tags?, if_match?})
498
548
  // anna.files.upload_finalize({path, etag, size_bytes, metadata?})
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anna-ai/app-runtime",
3
- "version": "0.10.0",
3
+ "version": "0.12.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",