@band-ai/band-sdk-core 6.0.0 → 6.1.1
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 +33 -0
- package/band_sdk_core.js +46 -1
- package/band_sdk_core_bg.wasm +0 -0
- package/index.d.ts +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -299,6 +299,39 @@ just pack-npm # Node tarball + require/import consumers
|
|
|
299
299
|
just build-wasm # Node package output
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
+
|
|
303
|
+
## Room-activity observations
|
|
304
|
+
|
|
305
|
+
`normalizeRoomActivitySnapshot(raw, selfAgentId, traceContext?)` accepts the
|
|
306
|
+
decoded data object containing `working_agents` and returns typed native
|
|
307
|
+
`RoomActivityPeer` objects. It validates all rows, keeps the last duplicate
|
|
308
|
+
agent/execution key, excludes self and sorts by agent/execution with null
|
|
309
|
+
first. Output omits execution IDs. Missing detail and unknown string kinds
|
|
310
|
+
become reasoning; malformed fields throw `Error` with `issues` and
|
|
311
|
+
`traceContext`. The canonical field rules live on the Rust
|
|
312
|
+
[`normalize_room_activity_snapshot`](https://github.com/band-ai/band-sdk-core/blob/main/crates/core/src/activity.rs).
|
|
313
|
+
|
|
314
|
+
```ts
|
|
315
|
+
import { normalizeRoomActivitySnapshot } from "@band-ai/band-sdk-core";
|
|
316
|
+
|
|
317
|
+
const peers = normalizeRoomActivitySnapshot({working_agents: [
|
|
318
|
+
{agent_id: "peer", working: true, activity: {kind: "tool_call", name: "search"}},
|
|
319
|
+
]}, "self");
|
|
320
|
+
if (peers[0].activity.kind !== "tool_call" || peers[0].activity.name !== "search") {
|
|
321
|
+
throw new Error("expected peer tool declaration");
|
|
322
|
+
}
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
Input must be JSON-native: plain objects from any realm (including null-prototype
|
|
326
|
+
objects) with data properties, dense arrays, finite JavaScript `Number` values
|
|
327
|
+
and Unicode scalar strings. Undefined values, sparse arrays,
|
|
328
|
+
accessors, symbols, nonfinite numbers and lone UTF-16 surrogates throw plain
|
|
329
|
+
`Error` before lossy conversion. Maximum depth is 64 (root zero), with 65,536
|
|
330
|
+
values and 1 MiB of UTF-8 string content including keys and string arguments.
|
|
331
|
+
Extra fields are checked too. Cycles and excessive input reject safely.
|
|
332
|
+
Each call is independent; the SDK owns I/O and availability. This observation
|
|
333
|
+
does not provide a lock or proof that no peer is working.
|
|
334
|
+
|
|
302
335
|
## License
|
|
303
336
|
|
|
304
337
|
Proprietary, binary-only Band SDK License Agreement — see the bundled
|
package/band_sdk_core.js
CHANGED
|
@@ -1981,6 +1981,27 @@ function noReplyTool() {
|
|
|
1981
1981
|
}
|
|
1982
1982
|
exports.noReplyTool = noReplyTool;
|
|
1983
1983
|
|
|
1984
|
+
/**
|
|
1985
|
+
* Normalize a complete room-activity data object into native peer objects.
|
|
1986
|
+
*
|
|
1987
|
+
* Semantic failures throw structured `Error`; invalid host representations
|
|
1988
|
+
* throw plain `Error`. Input is copied once without invoking accessors.
|
|
1989
|
+
* The caller supplies a complete, authorized observation and owns the requesting
|
|
1990
|
+
* room/turn lifetime. Collection failure must not be encoded as empty activity.
|
|
1991
|
+
* @param {any} raw
|
|
1992
|
+
* @param {any} selfAgentId
|
|
1993
|
+
* @param {any} traceContext
|
|
1994
|
+
* @returns {any}
|
|
1995
|
+
*/
|
|
1996
|
+
function normalizeRoomActivitySnapshot(raw, selfAgentId, traceContext) {
|
|
1997
|
+
const ret = wasm.normalizeRoomActivitySnapshot(raw, selfAgentId, traceContext);
|
|
1998
|
+
if (ret[2]) {
|
|
1999
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
2000
|
+
}
|
|
2001
|
+
return takeFromExternrefTable0(ret[0]);
|
|
2002
|
+
}
|
|
2003
|
+
exports.normalizeRoomActivitySnapshot = normalizeRoomActivitySnapshot;
|
|
2004
|
+
|
|
1984
2005
|
/**
|
|
1985
2006
|
* r" Every `ClaimRegistry.parkAck` reason, in declaration order.
|
|
1986
2007
|
* @returns {string[]}
|
|
@@ -2181,6 +2202,10 @@ function __wbg_get_imports() {
|
|
|
2181
2202
|
const ret = arg0.call(arg1);
|
|
2182
2203
|
return ret;
|
|
2183
2204
|
}, arguments); },
|
|
2205
|
+
__wbg_charCodeAt_bbfbcedfafe34880: function(arg0, arg1) {
|
|
2206
|
+
const ret = arg0.charCodeAt(arg1 >>> 0);
|
|
2207
|
+
return ret;
|
|
2208
|
+
},
|
|
2184
2209
|
__wbg_done_b41a1d26cdb37fb6: function(arg0) {
|
|
2185
2210
|
const ret = arg0.done;
|
|
2186
2211
|
return ret;
|
|
@@ -2197,6 +2222,14 @@ function __wbg_get_imports() {
|
|
|
2197
2222
|
const ret = Array.from(arg0);
|
|
2198
2223
|
return ret;
|
|
2199
2224
|
},
|
|
2225
|
+
__wbg_getOwnPropertyDescriptor_6f8590055297310c: function() { return handleError(function (arg0, arg1) {
|
|
2226
|
+
const ret = Reflect.getOwnPropertyDescriptor(arg0, arg1);
|
|
2227
|
+
return ret;
|
|
2228
|
+
}, arguments); },
|
|
2229
|
+
__wbg_getPrototypeOf_4e7d85b5bf38d546: function() { return handleError(function (arg0) {
|
|
2230
|
+
const ret = Reflect.getPrototypeOf(arg0);
|
|
2231
|
+
return ret;
|
|
2232
|
+
}, arguments); },
|
|
2200
2233
|
__wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
|
|
2201
2234
|
const ret = Reflect.get(arg0, arg1);
|
|
2202
2235
|
return ret;
|
|
@@ -2217,6 +2250,10 @@ function __wbg_get_imports() {
|
|
|
2217
2250
|
const ret = arg0[arg1];
|
|
2218
2251
|
return ret;
|
|
2219
2252
|
},
|
|
2253
|
+
__wbg_has_5d6706e5209576c1: function() { return handleError(function (arg0, arg1) {
|
|
2254
|
+
const ret = Reflect.has(arg0, arg1);
|
|
2255
|
+
return ret;
|
|
2256
|
+
}, arguments); },
|
|
2220
2257
|
__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
|
|
2221
2258
|
let result;
|
|
2222
2259
|
try {
|
|
@@ -2257,7 +2294,7 @@ function __wbg_get_imports() {
|
|
|
2257
2294
|
const ret = result;
|
|
2258
2295
|
return ret;
|
|
2259
2296
|
},
|
|
2260
|
-
|
|
2297
|
+
__wbg_isArray_be88a1655beccfb4: function() { return handleError(function (arg0) {
|
|
2261
2298
|
const ret = Array.isArray(arg0);
|
|
2262
2299
|
return ret;
|
|
2263
2300
|
}, arguments); },
|
|
@@ -2273,6 +2310,10 @@ function __wbg_get_imports() {
|
|
|
2273
2310
|
const ret = Symbol.iterator;
|
|
2274
2311
|
return ret;
|
|
2275
2312
|
},
|
|
2313
|
+
__wbg_length_78dac82682e59660: function(arg0) {
|
|
2314
|
+
const ret = arg0.length;
|
|
2315
|
+
return ret;
|
|
2316
|
+
},
|
|
2276
2317
|
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
2277
2318
|
const ret = arg0.length;
|
|
2278
2319
|
return ret;
|
|
@@ -2313,6 +2354,10 @@ function __wbg_get_imports() {
|
|
|
2313
2354
|
const ret = Array.of(arg0, arg1);
|
|
2314
2355
|
return ret;
|
|
2315
2356
|
},
|
|
2357
|
+
__wbg_ownKeys_7f46b96dc7311fe8: function() { return handleError(function (arg0) {
|
|
2358
|
+
const ret = Reflect.ownKeys(arg0);
|
|
2359
|
+
return ret;
|
|
2360
|
+
}, arguments); },
|
|
2316
2361
|
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
2317
2362
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
2318
2363
|
},
|
package/band_sdk_core_bg.wasm
CHANGED
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -753,3 +753,32 @@ export function noReplyTool(): ToolSpec;
|
|
|
753
753
|
|
|
754
754
|
/** The text shown to the room on a `"missing_reply"` verdict. */
|
|
755
755
|
export function missingReplyMessage(): string;
|
|
756
|
+
|
|
757
|
+
/** A peer declaration; tool names are untrusted display data. */
|
|
758
|
+
export type RoomActivity =
|
|
759
|
+
| { kind: "reasoning" | "memory" | "permission" }
|
|
760
|
+
| { kind: "tool_call"; name: string };
|
|
761
|
+
|
|
762
|
+
/** One execution; multiple entries may share an agent ID. */
|
|
763
|
+
export interface RoomActivityPeer {
|
|
764
|
+
agent_id: string;
|
|
765
|
+
agent_name: string;
|
|
766
|
+
activity: RoomActivity;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* Normalize a complete data object containing working_agents, with no retained state.
|
|
771
|
+
* Validates all rows, keeps the last composite-key duplicate, excludes self and
|
|
772
|
+
* sorts by agent/execution (null first). No execution IDs appear in output.
|
|
773
|
+
* Semantic failures throw Error with issues/traceContext. Nonfinite numbers,
|
|
774
|
+
* invalid Unicode, unsupported host values or exceeded input limits throw plain Error.
|
|
775
|
+
* Input must be JSON-native, with dense arrays and plain objects from any realm
|
|
776
|
+
* (including null-prototype objects), with data properties and no accessors.
|
|
777
|
+
* Numbers use the finite JavaScript Number representation. The caller owns
|
|
778
|
+
* authorization, collection completeness and the requesting room/turn lifetime.
|
|
779
|
+
*/
|
|
780
|
+
export function normalizeRoomActivitySnapshot(
|
|
781
|
+
raw: unknown,
|
|
782
|
+
selfAgentId: string,
|
|
783
|
+
traceContext?: string | null,
|
|
784
|
+
): RoomActivityPeer[];
|