@band-ai/band-sdk-core 2.6.0 → 2.8.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 +33 -0
- package/band_sdk_core.js +198 -53
- package/band_sdk_core_bg.wasm +0 -0
- package/index.d.ts +83 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -244,6 +244,39 @@ outcome to `"processed"` or `"failed"`.
|
|
|
244
244
|
exposed for a host's own call sites that classify a sender without going
|
|
245
245
|
through either function.
|
|
246
246
|
|
|
247
|
+
### Turn outcome
|
|
248
|
+
|
|
249
|
+
`TurnLedger` judges one agent turn — design decisions live as rustdoc in
|
|
250
|
+
`crates/core/src/turn.rs`. Create one per turn, `record` the `TurnEffect` of
|
|
251
|
+
each successful tool call (a failed call records nothing), and ask for the
|
|
252
|
+
`verdict()` when the model stops: `"complete"` once the turn replied,
|
|
253
|
+
declined, or did real work, else `"missing_reply"` (fail the turn with
|
|
254
|
+
`missingReplyMessage()`). `settle()` marks a turn the SDK answered itself and
|
|
255
|
+
`noteReported()` one whose failure was already reported; both complete it.
|
|
256
|
+
`replySettled()` is `true` once a recorded call posted to the room or
|
|
257
|
+
declined to, so no fallback text is due. `record` throws a plain `Error` for
|
|
258
|
+
anything but a `TurnEffect` wire name.
|
|
259
|
+
|
|
260
|
+
`bandToolEffects()` maps every canonical Band tool name to its `TurnEffect`;
|
|
261
|
+
normalize an alias to its canonical name before the lookup. `noReplyTool()`
|
|
262
|
+
returns `band_no_reply`'s definition as a `ToolSpec` (`name`, `description`,
|
|
263
|
+
`parameters`). `turnEffects()` and `turnVerdicts()` list the wire names.
|
|
264
|
+
|
|
265
|
+
```ts
|
|
266
|
+
import { TurnLedger, bandToolEffects } from "@band-ai/band-sdk-core";
|
|
267
|
+
|
|
268
|
+
const ledger = new TurnLedger();
|
|
269
|
+
ledger.record(bandToolEffects().band_send_event);
|
|
270
|
+
if (ledger.verdict() !== "missing_reply") {
|
|
271
|
+
throw new Error("an observe-only turn is a missing reply");
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
ledger.record("reply");
|
|
275
|
+
if (ledger.verdict() !== "complete" || !ledger.replySettled()) {
|
|
276
|
+
throw new Error("a reply must complete the turn");
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
247
280
|
The public declaration is
|
|
248
281
|
[`index.d.ts`](https://github.com/band-ai/band-sdk-core/blob/main/crates/wasm/index.d.ts).
|
|
249
282
|
|
package/band_sdk_core.js
CHANGED
|
@@ -88,6 +88,17 @@ class AgentFailure {
|
|
|
88
88
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* The canonical failure payload under Core's extension-data key.
|
|
93
|
+
* @returns {any}
|
|
94
|
+
*/
|
|
95
|
+
toExtensionData() {
|
|
96
|
+
const ret = wasm.agentfailure_toExtensionData(this.__wbg_ptr);
|
|
97
|
+
if (ret[2]) {
|
|
98
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
99
|
+
}
|
|
100
|
+
return takeFromExternrefTable0(ret[0]);
|
|
101
|
+
}
|
|
91
102
|
/**
|
|
92
103
|
* The failure as a plain JSON-shaped object: unlike the getters above,
|
|
93
104
|
* an absent `code`/`detail` serializes as `null` here, matching the
|
|
@@ -1358,6 +1369,68 @@ class SubscriptionTracker {
|
|
|
1358
1369
|
if (Symbol.dispose) SubscriptionTracker.prototype[Symbol.dispose] = SubscriptionTracker.prototype.free;
|
|
1359
1370
|
exports.SubscriptionTracker = SubscriptionTracker;
|
|
1360
1371
|
|
|
1372
|
+
/**
|
|
1373
|
+
* One agent turn's progress toward a reply. `record` throws a plain
|
|
1374
|
+
* `Error` for anything but a `TurnEffect` wire name.
|
|
1375
|
+
*/
|
|
1376
|
+
class TurnLedger {
|
|
1377
|
+
__destroy_into_raw() {
|
|
1378
|
+
const ptr = this.__wbg_ptr;
|
|
1379
|
+
this.__wbg_ptr = 0;
|
|
1380
|
+
TurnLedgerFinalization.unregister(this);
|
|
1381
|
+
return ptr;
|
|
1382
|
+
}
|
|
1383
|
+
free() {
|
|
1384
|
+
const ptr = this.__destroy_into_raw();
|
|
1385
|
+
wasm.__wbg_turnledger_free(ptr, 0);
|
|
1386
|
+
}
|
|
1387
|
+
constructor() {
|
|
1388
|
+
const ret = wasm.turnledger_new();
|
|
1389
|
+
this.__wbg_ptr = ret;
|
|
1390
|
+
TurnLedgerFinalization.register(this, this.__wbg_ptr, this);
|
|
1391
|
+
return this;
|
|
1392
|
+
}
|
|
1393
|
+
noteReported() {
|
|
1394
|
+
wasm.turnledger_noteReported(this.__wbg_ptr);
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* @param {any} effect
|
|
1398
|
+
*/
|
|
1399
|
+
record(effect) {
|
|
1400
|
+
const ret = wasm.turnledger_record(this.__wbg_ptr, effect);
|
|
1401
|
+
if (ret[1]) {
|
|
1402
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1403
|
+
}
|
|
1404
|
+
}
|
|
1405
|
+
/**
|
|
1406
|
+
* @returns {boolean}
|
|
1407
|
+
*/
|
|
1408
|
+
replySettled() {
|
|
1409
|
+
const ret = wasm.turnledger_replySettled(this.__wbg_ptr);
|
|
1410
|
+
return ret !== 0;
|
|
1411
|
+
}
|
|
1412
|
+
settle() {
|
|
1413
|
+
wasm.turnledger_settle(this.__wbg_ptr);
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* @returns {string}
|
|
1417
|
+
*/
|
|
1418
|
+
verdict() {
|
|
1419
|
+
let deferred1_0;
|
|
1420
|
+
let deferred1_1;
|
|
1421
|
+
try {
|
|
1422
|
+
const ret = wasm.turnledger_verdict(this.__wbg_ptr);
|
|
1423
|
+
deferred1_0 = ret[0];
|
|
1424
|
+
deferred1_1 = ret[1];
|
|
1425
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1426
|
+
} finally {
|
|
1427
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
if (Symbol.dispose) TurnLedger.prototype[Symbol.dispose] = TurnLedger.prototype.free;
|
|
1432
|
+
exports.TurnLedger = TurnLedger;
|
|
1433
|
+
|
|
1361
1434
|
/**
|
|
1362
1435
|
* This platform's Phoenix Channels topic for the `agent_contacts` channel.
|
|
1363
1436
|
* @param {any} agentId
|
|
@@ -1433,6 +1506,20 @@ function agentRoomsTopic(agentId) {
|
|
|
1433
1506
|
}
|
|
1434
1507
|
exports.agentRoomsTopic = agentRoomsTopic;
|
|
1435
1508
|
|
|
1509
|
+
/**
|
|
1510
|
+
* Every Band tool's canonical name and its `TurnEffect` wire name, as a
|
|
1511
|
+
* plain object in the core table's order.
|
|
1512
|
+
* @returns {any}
|
|
1513
|
+
*/
|
|
1514
|
+
function bandToolEffects() {
|
|
1515
|
+
const ret = wasm.bandToolEffects();
|
|
1516
|
+
if (ret[2]) {
|
|
1517
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1518
|
+
}
|
|
1519
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1520
|
+
}
|
|
1521
|
+
exports.bandToolEffects = bandToolEffects;
|
|
1522
|
+
|
|
1436
1523
|
/**
|
|
1437
1524
|
* This platform's Phoenix Channels topic for a room's `chat_room` channel.
|
|
1438
1525
|
* @param {any} roomId
|
|
@@ -1673,6 +1760,37 @@ function memoryTypes() {
|
|
|
1673
1760
|
}
|
|
1674
1761
|
exports.memoryTypes = memoryTypes;
|
|
1675
1762
|
|
|
1763
|
+
/**
|
|
1764
|
+
* The text shown to the room on a `"missing_reply"` verdict.
|
|
1765
|
+
* @returns {string}
|
|
1766
|
+
*/
|
|
1767
|
+
function missingReplyMessage() {
|
|
1768
|
+
let deferred1_0;
|
|
1769
|
+
let deferred1_1;
|
|
1770
|
+
try {
|
|
1771
|
+
const ret = wasm.missingReplyMessage();
|
|
1772
|
+
deferred1_0 = ret[0];
|
|
1773
|
+
deferred1_1 = ret[1];
|
|
1774
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1775
|
+
} finally {
|
|
1776
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1777
|
+
}
|
|
1778
|
+
}
|
|
1779
|
+
exports.missingReplyMessage = missingReplyMessage;
|
|
1780
|
+
|
|
1781
|
+
/**
|
|
1782
|
+
* `band_no_reply`'s definition as a plain `ToolSpec` object.
|
|
1783
|
+
* @returns {any}
|
|
1784
|
+
*/
|
|
1785
|
+
function noReplyTool() {
|
|
1786
|
+
const ret = wasm.noReplyTool();
|
|
1787
|
+
if (ret[2]) {
|
|
1788
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1789
|
+
}
|
|
1790
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1791
|
+
}
|
|
1792
|
+
exports.noReplyTool = noReplyTool;
|
|
1793
|
+
|
|
1676
1794
|
/**
|
|
1677
1795
|
* This platform's Phoenix Channels topic for a room's `room_participants`
|
|
1678
1796
|
* channel.
|
|
@@ -1699,6 +1817,30 @@ function roomParticipantsTopic(roomId) {
|
|
|
1699
1817
|
}
|
|
1700
1818
|
exports.roomParticipantsTopic = roomParticipantsTopic;
|
|
1701
1819
|
|
|
1820
|
+
/**
|
|
1821
|
+
* r" Every [`TurnEffect`] wire name, in declaration order.
|
|
1822
|
+
* @returns {string[]}
|
|
1823
|
+
*/
|
|
1824
|
+
function turnEffects() {
|
|
1825
|
+
const ret = wasm.turnEffects();
|
|
1826
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
1827
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1828
|
+
return v1;
|
|
1829
|
+
}
|
|
1830
|
+
exports.turnEffects = turnEffects;
|
|
1831
|
+
|
|
1832
|
+
/**
|
|
1833
|
+
* r" Every [`TurnVerdict`] wire name, in declaration order.
|
|
1834
|
+
* @returns {string[]}
|
|
1835
|
+
*/
|
|
1836
|
+
function turnVerdicts() {
|
|
1837
|
+
const ret = wasm.turnVerdicts();
|
|
1838
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
|
|
1839
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
1840
|
+
return v1;
|
|
1841
|
+
}
|
|
1842
|
+
exports.turnVerdicts = turnVerdicts;
|
|
1843
|
+
|
|
1702
1844
|
/**
|
|
1703
1845
|
* Validate and normalize an inbound platform event payload.
|
|
1704
1846
|
*
|
|
@@ -1742,7 +1884,7 @@ exports.validateMemoryTypeForSystem = validateMemoryTypeForSystem;
|
|
|
1742
1884
|
function __wbg_get_imports() {
|
|
1743
1885
|
const import0 = {
|
|
1744
1886
|
__proto__: null,
|
|
1745
|
-
|
|
1887
|
+
__wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
|
|
1746
1888
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
1747
1889
|
return ret;
|
|
1748
1890
|
},
|
|
@@ -1753,68 +1895,68 @@ function __wbg_get_imports() {
|
|
|
1753
1895
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1754
1896
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1755
1897
|
},
|
|
1756
|
-
|
|
1898
|
+
__wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
|
|
1757
1899
|
const v = arg1;
|
|
1758
1900
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1759
1901
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1760
1902
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1761
1903
|
},
|
|
1762
|
-
|
|
1904
|
+
__wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
|
|
1763
1905
|
const v = arg0;
|
|
1764
1906
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
1765
1907
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
1766
1908
|
},
|
|
1767
|
-
|
|
1909
|
+
__wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
|
|
1768
1910
|
const ret = debugString(arg1);
|
|
1769
1911
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1770
1912
|
const len1 = WASM_VECTOR_LEN;
|
|
1771
1913
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1772
1914
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1773
1915
|
},
|
|
1774
|
-
|
|
1916
|
+
__wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
|
|
1775
1917
|
const ret = arg0 in arg1;
|
|
1776
1918
|
return ret;
|
|
1777
1919
|
},
|
|
1778
|
-
|
|
1920
|
+
__wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
|
|
1779
1921
|
const ret = typeof(arg0) === 'bigint';
|
|
1780
1922
|
return ret;
|
|
1781
1923
|
},
|
|
1782
|
-
|
|
1924
|
+
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
1783
1925
|
const ret = typeof(arg0) === 'function';
|
|
1784
1926
|
return ret;
|
|
1785
1927
|
},
|
|
1786
|
-
|
|
1928
|
+
__wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
|
|
1787
1929
|
const ret = arg0 === null;
|
|
1788
1930
|
return ret;
|
|
1789
1931
|
},
|
|
1790
|
-
|
|
1932
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
1791
1933
|
const val = arg0;
|
|
1792
1934
|
const ret = typeof(val) === 'object' && val !== null;
|
|
1793
1935
|
return ret;
|
|
1794
1936
|
},
|
|
1795
|
-
|
|
1937
|
+
__wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
|
|
1796
1938
|
const ret = typeof(arg0) === 'string';
|
|
1797
1939
|
return ret;
|
|
1798
1940
|
},
|
|
1799
|
-
|
|
1941
|
+
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
1800
1942
|
const ret = arg0 === undefined;
|
|
1801
1943
|
return ret;
|
|
1802
1944
|
},
|
|
1803
|
-
|
|
1945
|
+
__wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
|
|
1804
1946
|
const ret = arg0 === arg1;
|
|
1805
1947
|
return ret;
|
|
1806
1948
|
},
|
|
1807
|
-
|
|
1949
|
+
__wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
|
|
1808
1950
|
const ret = arg0 == arg1;
|
|
1809
1951
|
return ret;
|
|
1810
1952
|
},
|
|
1811
|
-
|
|
1953
|
+
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
1812
1954
|
const obj = arg1;
|
|
1813
1955
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1814
1956
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1815
1957
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1816
1958
|
},
|
|
1817
|
-
|
|
1959
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
1818
1960
|
const obj = arg1;
|
|
1819
1961
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1820
1962
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -1822,38 +1964,38 @@ function __wbg_get_imports() {
|
|
|
1822
1964
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1823
1965
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1824
1966
|
},
|
|
1825
|
-
|
|
1967
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
1826
1968
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1827
1969
|
},
|
|
1828
|
-
|
|
1970
|
+
__wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
|
|
1829
1971
|
const ret = arg0.call(arg1);
|
|
1830
1972
|
return ret;
|
|
1831
1973
|
}, arguments); },
|
|
1832
|
-
|
|
1974
|
+
__wbg_done_b41a1d26cdb37fb6: function(arg0) {
|
|
1833
1975
|
const ret = arg0.done;
|
|
1834
1976
|
return ret;
|
|
1835
1977
|
},
|
|
1836
|
-
|
|
1978
|
+
__wbg_entries_fb6397112b1de25f: function(arg0) {
|
|
1837
1979
|
const ret = Object.entries(arg0);
|
|
1838
1980
|
return ret;
|
|
1839
1981
|
},
|
|
1840
|
-
|
|
1982
|
+
__wbg_from_296ca31f8d0f1c52: function(arg0) {
|
|
1841
1983
|
const ret = Array.from(arg0);
|
|
1842
1984
|
return ret;
|
|
1843
1985
|
},
|
|
1844
|
-
|
|
1986
|
+
__wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
|
|
1845
1987
|
const ret = Reflect.get(arg0, arg1);
|
|
1846
1988
|
return ret;
|
|
1847
1989
|
}, arguments); },
|
|
1848
|
-
|
|
1990
|
+
__wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
|
|
1849
1991
|
const ret = Reflect.get(arg0, arg1);
|
|
1850
1992
|
return ret;
|
|
1851
1993
|
}, arguments); },
|
|
1852
|
-
|
|
1994
|
+
__wbg_get_6c896e0571ddae51: function(arg0, arg1) {
|
|
1853
1995
|
const ret = arg0[arg1 >>> 0];
|
|
1854
1996
|
return ret;
|
|
1855
1997
|
},
|
|
1856
|
-
|
|
1998
|
+
__wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
|
|
1857
1999
|
const ret = arg0[arg1 >>> 0];
|
|
1858
2000
|
return ret;
|
|
1859
2001
|
},
|
|
@@ -1861,7 +2003,7 @@ function __wbg_get_imports() {
|
|
|
1861
2003
|
const ret = arg0[arg1];
|
|
1862
2004
|
return ret;
|
|
1863
2005
|
},
|
|
1864
|
-
|
|
2006
|
+
__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
|
|
1865
2007
|
let result;
|
|
1866
2008
|
try {
|
|
1867
2009
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -1871,7 +2013,7 @@ function __wbg_get_imports() {
|
|
|
1871
2013
|
const ret = result;
|
|
1872
2014
|
return ret;
|
|
1873
2015
|
},
|
|
1874
|
-
|
|
2016
|
+
__wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
|
|
1875
2017
|
let result;
|
|
1876
2018
|
try {
|
|
1877
2019
|
result = arg0 instanceof Map;
|
|
@@ -1881,7 +2023,7 @@ function __wbg_get_imports() {
|
|
|
1881
2023
|
const ret = result;
|
|
1882
2024
|
return ret;
|
|
1883
2025
|
},
|
|
1884
|
-
|
|
2026
|
+
__wbg_instanceof_Set_3b384cb03733893a: function(arg0) {
|
|
1885
2027
|
let result;
|
|
1886
2028
|
try {
|
|
1887
2029
|
result = arg0 instanceof Set;
|
|
@@ -1891,7 +2033,7 @@ function __wbg_get_imports() {
|
|
|
1891
2033
|
const ret = result;
|
|
1892
2034
|
return ret;
|
|
1893
2035
|
},
|
|
1894
|
-
|
|
2036
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
1895
2037
|
let result;
|
|
1896
2038
|
try {
|
|
1897
2039
|
result = arg0 instanceof Uint8Array;
|
|
@@ -1901,84 +2043,84 @@ function __wbg_get_imports() {
|
|
|
1901
2043
|
const ret = result;
|
|
1902
2044
|
return ret;
|
|
1903
2045
|
},
|
|
1904
|
-
|
|
2046
|
+
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
1905
2047
|
const ret = Array.isArray(arg0);
|
|
1906
2048
|
return ret;
|
|
1907
2049
|
},
|
|
1908
|
-
|
|
2050
|
+
__wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
|
|
1909
2051
|
const ret = Number.isSafeInteger(arg0);
|
|
1910
2052
|
return ret;
|
|
1911
2053
|
},
|
|
1912
|
-
|
|
2054
|
+
__wbg_iterator_e3c31c892080e444: function() {
|
|
1913
2055
|
const ret = Symbol.iterator;
|
|
1914
2056
|
return ret;
|
|
1915
2057
|
},
|
|
1916
|
-
|
|
2058
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
1917
2059
|
const ret = arg0.length;
|
|
1918
2060
|
return ret;
|
|
1919
2061
|
},
|
|
1920
|
-
|
|
2062
|
+
__wbg_length_d4bdea10311bd9cf: function(arg0) {
|
|
1921
2063
|
const ret = arg0.length;
|
|
1922
2064
|
return ret;
|
|
1923
2065
|
},
|
|
1924
|
-
|
|
2066
|
+
__wbg_new_1dbf7428bba60a42: function(arg0) {
|
|
1925
2067
|
const ret = new Uint8Array(arg0);
|
|
1926
2068
|
return ret;
|
|
1927
2069
|
},
|
|
1928
|
-
|
|
2070
|
+
__wbg_new_28744009d011f847: function() {
|
|
1929
2071
|
const ret = new Map();
|
|
1930
2072
|
return ret;
|
|
1931
2073
|
},
|
|
1932
|
-
|
|
2074
|
+
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
1933
2075
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1934
2076
|
return ret;
|
|
1935
2077
|
},
|
|
1936
|
-
|
|
2078
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
1937
2079
|
const ret = new Object();
|
|
1938
2080
|
return ret;
|
|
1939
2081
|
},
|
|
1940
|
-
|
|
2082
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
1941
2083
|
const ret = new Array();
|
|
1942
2084
|
return ret;
|
|
1943
2085
|
},
|
|
1944
|
-
|
|
2086
|
+
__wbg_next_33784799010f1bbe: function(arg0) {
|
|
1945
2087
|
const ret = arg0.next;
|
|
1946
2088
|
return ret;
|
|
1947
2089
|
},
|
|
1948
|
-
|
|
2090
|
+
__wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
|
|
1949
2091
|
const ret = arg0.next();
|
|
1950
2092
|
return ret;
|
|
1951
2093
|
}, arguments); },
|
|
1952
|
-
|
|
2094
|
+
__wbg_of_20798cb14708764f: function(arg0, arg1) {
|
|
1953
2095
|
const ret = Array.of(arg0, arg1);
|
|
1954
2096
|
return ret;
|
|
1955
2097
|
},
|
|
1956
|
-
|
|
2098
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
1957
2099
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1958
2100
|
},
|
|
1959
|
-
|
|
2101
|
+
__wbg_push_2baf45db356cf468: function(arg0, arg1) {
|
|
1960
2102
|
const ret = arg0.push(arg1);
|
|
1961
2103
|
return ret;
|
|
1962
2104
|
},
|
|
1963
|
-
|
|
2105
|
+
__wbg_random_5a4cafd2f02395ff: function() {
|
|
1964
2106
|
const ret = Math.random();
|
|
1965
2107
|
return ret;
|
|
1966
2108
|
},
|
|
1967
|
-
|
|
1968
|
-
arg0[arg1 >>> 0] = arg2;
|
|
1969
|
-
},
|
|
1970
|
-
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
1971
|
-
arg0[arg1] = arg2;
|
|
1972
|
-
},
|
|
1973
|
-
__wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
|
|
2109
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
1974
2110
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1975
2111
|
return ret;
|
|
1976
2112
|
}, arguments); },
|
|
1977
|
-
|
|
2113
|
+
__wbg_set_6ae97e73113c4f0b: function(arg0, arg1, arg2) {
|
|
1978
2114
|
const ret = arg0.set(arg1, arg2);
|
|
1979
2115
|
return ret;
|
|
1980
2116
|
},
|
|
1981
|
-
|
|
2117
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
2118
|
+
arg0[arg1] = arg2;
|
|
2119
|
+
},
|
|
2120
|
+
__wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
|
|
2121
|
+
arg0[arg1 >>> 0] = arg2;
|
|
2122
|
+
},
|
|
2123
|
+
__wbg_value_f3c585ee8f5ba40c: function(arg0) {
|
|
1982
2124
|
const ret = arg0.value;
|
|
1983
2125
|
return ret;
|
|
1984
2126
|
},
|
|
@@ -2051,6 +2193,9 @@ const SessionPolicyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
2051
2193
|
const SubscriptionTrackerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2052
2194
|
? { register: () => {}, unregister: () => {} }
|
|
2053
2195
|
: new FinalizationRegistry(ptr => wasm.__wbg_subscriptiontracker_free(ptr, 1));
|
|
2196
|
+
const TurnLedgerFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
2197
|
+
? { register: () => {}, unregister: () => {} }
|
|
2198
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_turnledger_free(ptr, 1));
|
|
2054
2199
|
|
|
2055
2200
|
function addToExternrefTable0(obj) {
|
|
2056
2201
|
const idx = wasm.__externref_table_alloc();
|
package/band_sdk_core_bg.wasm
CHANGED
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -20,6 +20,10 @@ export class AgentFailure {
|
|
|
20
20
|
* absent `code`/`detail` serializes as `null` here, not `undefined`.
|
|
21
21
|
*/
|
|
22
22
|
toObject(): Record<string, unknown>;
|
|
23
|
+
/**
|
|
24
|
+
* The `toObject()` payload under Core's `band.ai/failure` extension key.
|
|
25
|
+
*/
|
|
26
|
+
toExtensionData(): Record<string, unknown>;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
/** Canonical inbound wire-event names `validateEventPayload` accepts. */
|
|
@@ -613,3 +617,82 @@ export function evaluateAdapterResult(
|
|
|
613
617
|
* `senderId`/`senderType`/`agentId` is not a string.
|
|
614
618
|
*/
|
|
615
619
|
export function isSelfEcho(senderId: string, senderType: string, agentId: string): boolean;
|
|
620
|
+
|
|
621
|
+
/** What a successful tool call contributes to the turn. */
|
|
622
|
+
export type TurnEffect = "observe" | "act" | "reply" | "decline";
|
|
623
|
+
|
|
624
|
+
/** How the SDK ends a turn, per {@link TurnLedger.verdict}. */
|
|
625
|
+
export type TurnVerdict = "complete" | "missing_reply";
|
|
626
|
+
|
|
627
|
+
/** Every Band tool's canonical name. */
|
|
628
|
+
export type BandToolName =
|
|
629
|
+
| "band_get_participants"
|
|
630
|
+
| "band_lookup_peers"
|
|
631
|
+
| "band_list_contacts"
|
|
632
|
+
| "band_list_contact_requests"
|
|
633
|
+
| "band_list_memories"
|
|
634
|
+
| "band_get_memory"
|
|
635
|
+
| "band_list_room_files"
|
|
636
|
+
| "band_read_room_file"
|
|
637
|
+
| "band_list_tasks"
|
|
638
|
+
| "band_get_task"
|
|
639
|
+
| "band_get_task_history"
|
|
640
|
+
| "band_get_board"
|
|
641
|
+
| "band_send_event"
|
|
642
|
+
| "band_add_participant"
|
|
643
|
+
| "band_remove_participant"
|
|
644
|
+
| "band_create_chatroom"
|
|
645
|
+
| "band_add_contact"
|
|
646
|
+
| "band_remove_contact"
|
|
647
|
+
| "band_respond_contact_request"
|
|
648
|
+
| "band_store_memory"
|
|
649
|
+
| "band_supersede_memory"
|
|
650
|
+
| "band_archive_memory"
|
|
651
|
+
| "band_create_task"
|
|
652
|
+
| "band_update_task"
|
|
653
|
+
| "band_set_board"
|
|
654
|
+
| "band_send_message"
|
|
655
|
+
| "band_send_room_file"
|
|
656
|
+
| "band_no_reply";
|
|
657
|
+
|
|
658
|
+
/** Every {@link TurnEffect} wire name, in declaration order. */
|
|
659
|
+
export function turnEffects(): TurnEffect[];
|
|
660
|
+
|
|
661
|
+
/** Every {@link TurnVerdict} wire name, in declaration order. */
|
|
662
|
+
export function turnVerdicts(): TurnVerdict[];
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* One agent turn's progress toward a reply. Record only successful tool
|
|
666
|
+
* calls. `record` throws a plain `Error` for anything but a
|
|
667
|
+
* {@link TurnEffect}.
|
|
668
|
+
*/
|
|
669
|
+
export class TurnLedger {
|
|
670
|
+
constructor();
|
|
671
|
+
record(effect: TurnEffect): void;
|
|
672
|
+
settle(): void;
|
|
673
|
+
noteReported(): void;
|
|
674
|
+
replySettled(): boolean;
|
|
675
|
+
verdict(): TurnVerdict;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/** Every Band tool's canonical name and its {@link TurnEffect}. */
|
|
679
|
+
export function bandToolEffects(): Record<BandToolName, TurnEffect>;
|
|
680
|
+
|
|
681
|
+
/** One parameter of a {@link ToolSpec}. Each SDK declares its value type. */
|
|
682
|
+
export interface ToolParameterSpec {
|
|
683
|
+
name: string;
|
|
684
|
+
description: string;
|
|
685
|
+
required: boolean;
|
|
686
|
+
}
|
|
687
|
+
/** A tool definition as the model reads it. */
|
|
688
|
+
export interface ToolSpec {
|
|
689
|
+
name: string;
|
|
690
|
+
description: string;
|
|
691
|
+
parameters: ToolParameterSpec[];
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
/** `band_no_reply`'s definition. */
|
|
695
|
+
export function noReplyTool(): ToolSpec;
|
|
696
|
+
|
|
697
|
+
/** The text shown to the room on a `"missing_reply"` verdict. */
|
|
698
|
+
export function missingReplyMessage(): string;
|