@anna-ai/app-runtime 0.11.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.
- package/dist/index.js +31 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -173,6 +173,36 @@
|
|
|
173
173
|
);
|
|
174
174
|
}
|
|
175
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
|
+
|
|
176
206
|
// ---- Agent namespace (v0.2.0) ----
|
|
177
207
|
//
|
|
178
208
|
// Exposes both raw RPCs (`anna.agent.session.create({submode, ...})`,
|
|
@@ -481,7 +511,7 @@
|
|
|
481
511
|
this.geometry = null;
|
|
482
512
|
|
|
483
513
|
// namespace proxies
|
|
484
|
-
this.tools =
|
|
514
|
+
this.tools = buildToolsNamespace(this);
|
|
485
515
|
this.chat = buildNamespace(this, "chat");
|
|
486
516
|
this.artifact = buildNamespace(this, "artifact");
|
|
487
517
|
this.llm = buildLlmNamespace(this);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anna-ai/app-runtime",
|
|
3
|
-
"version": "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",
|