@anna-ai/app-runtime 0.12.0 → 0.14.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 +67 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,17 @@
1
1
  /**
2
- * Anna App Runtime SDK — v0.11.0
2
+ * Anna App Runtime SDK — v0.14.0
3
+ *
4
+ * v0.14.0 — Adds `anna.agent.session.catalog()` — pre-create discovery of
5
+ * the platform-tool universe for agent sessions. Returns
6
+ * `{platform_tools: [{name, description, dev_safe, declared_in_manifest,
7
+ * user_granted, eligible, blocked_by?}], inherit_host_tools_granted,
8
+ * manifest_declared, user_granted}` so apps can learn which names are
9
+ * legal in create-time `quotaCaps.allowed_tools` / per-run
10
+ * `allowed_tools` — previously only discoverable after-the-fact via the
11
+ * create response's `granted_tools` echo. Read-only; mints no session.
12
+ * Coordinated bump: wire method `agent/session.catalog` —
13
+ * dispatcher_version 0.18.0 + schema 0.18.0 + anna-app-core 0.17.0.
14
+ * Additive: old hosts reject with `not_implemented`.
3
15
  *
4
16
  * v0.11.0 — Adds the `anna.credentials.*` namespace — platform-credentials
5
17
  * multi-account access (design platform-credentials-multi-account.md §7).
@@ -155,6 +167,10 @@
155
167
  // browser→R2 PUT itself is direct (not via this SDK), but the host
156
168
  // round-trip for finalize needs DB+R2 head ~ up to a few seconds.
157
169
  files: 60000,
170
+ // `web.*` — search is usually <5s but fetch crawls up to 10 pages with
171
+ // a 30s per-page budget under host-side concurrency limits. Apps doing
172
+ // large fetch batches should pass { timeoutMs: 90000 } per call.
173
+ web: 60000,
158
174
  };
159
175
  const DEFAULT_TIMEOUT_MS = 30000;
160
176
 
@@ -173,6 +189,29 @@
173
189
  );
174
190
  }
175
191
 
192
+ // ---- Web namespace (v0.13.0; Phase 2 adds image_search / image_fetch) ----
193
+ //
194
+ // Plain proxy over the `web` namespace with camelCase aliases so both
195
+ // `anna.web.image_search(...)` (wire name, matches the manifest
196
+ // `ui.host_api.web` entry) and `anna.web.imageSearch(...)` (RFC §2.3
197
+ // spelling) hit the same dispatcher method.
198
+ const WEB_METHOD_ALIASES = {
199
+ imageSearch: "image_search",
200
+ imageFetch: "image_fetch",
201
+ };
202
+ function buildWebNamespace(rt) {
203
+ return new Proxy(
204
+ {},
205
+ {
206
+ get(_, method) {
207
+ if (typeof method !== "string") return undefined;
208
+ const wire = WEB_METHOD_ALIASES[method] || method;
209
+ return (args, opts) => rt.call("web", wire, args || {}, opts);
210
+ },
211
+ }
212
+ );
213
+ }
214
+
176
215
  // ---- Tools namespace (v0.12.0) ----
177
216
  //
178
217
  // Plain RPC proxy (`anna.tools.invoke`, `anna.tools.list`) plus one
@@ -238,7 +277,9 @@
238
277
  // lives only here, not on the per-session AgentSession wrapper. `refresh`
239
278
  // is identity-authed (re-mints token + slides idle window by uuid) and is
240
279
  // also exposed as `.refresh()` sugar on the AgentSession handle.
241
- for (const m of ["create", "run", "cancel", "history", "delete", "list", "refresh"]) {
280
+ // `catalog` is the pre-create discovery surface (platform-tool universe
281
+ // + per-app eligibility) — read-only, no session required.
282
+ for (const m of ["create", "run", "cancel", "history", "delete", "list", "refresh", "catalog"]) {
242
283
  ns.session[m] = sessionRpcs[m];
243
284
  }
244
285
  // `attach` re-wraps an EXISTING session (known uuid) as an AgentSession
@@ -543,6 +584,30 @@
543
584
  // user-enabled per-app credentials_grant.
544
585
  this.credentials = buildNamespace(this, "credentials");
545
586
 
587
+ // ---- web namespace (v0.13.0; host-managed search/fetch) ----
588
+ // anna.web.search({query, max_results?, search_depth?, topic?,
589
+ // time_range?, region?, include_domains?, exclude_domains?})
590
+ // → {results, provider_tier, quota_consumed, cached?}
591
+ // anna.web.fetch({urls, format?, max_chars?, timeout_ms?})
592
+ // → {pages, quota_consumed}
593
+ // Phase 2:
594
+ // anna.web.image_search({query, max_results?, min_width?, min_height?,
595
+ // aspect?}) → {results: [{image_url, thumbnail_url?, source_url,
596
+ // title?, width?, height?, mime_type?, license_hint?}],
597
+ // quota_consumed, cached?} (safe-search force-enabled host-side)
598
+ // anna.web.image_fetch({url, max_bytes?, purpose?})
599
+ // → {path, get_url, mime_type, bytes_size, sha256, source_url,
600
+ // final_url, quota_consumed} (artifact reference — never bytes;
601
+ // stored in the app's APS files self-scope)
602
+ // camelCase aliases: anna.web.imageSearch / anna.web.imageFetch map to
603
+ // the same wire methods (image_search / image_fetch).
604
+ // Provider keys / routing / SSRF guard / billing all stay host-side.
605
+ // Requires manifest ui.host_api.web AND the user-enabled per-app
606
+ // web_grant (first call returns APP_NOT_GRANTED → consent card;
607
+ // image_search / image_fetch default OFF even when web is enabled).
608
+ // See matrix-nexus docs/design/app-web-search.md §2.
609
+ this.web = buildWebNamespace(this);
610
+
546
611
  // ---- files namespace (APS object/blob API; v0.5.x) ----
547
612
  // anna.files.upload_init({path, content_type, size, ttl_seconds?, metadata?, tags?, if_match?})
548
613
  // 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.12.0",
3
+ "version": "0.14.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",