@band-ai/band-sdk-core 2.7.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 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
@@ -1369,6 +1369,68 @@ class SubscriptionTracker {
1369
1369
  if (Symbol.dispose) SubscriptionTracker.prototype[Symbol.dispose] = SubscriptionTracker.prototype.free;
1370
1370
  exports.SubscriptionTracker = SubscriptionTracker;
1371
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
+
1372
1434
  /**
1373
1435
  * This platform's Phoenix Channels topic for the `agent_contacts` channel.
1374
1436
  * @param {any} agentId
@@ -1444,6 +1506,20 @@ function agentRoomsTopic(agentId) {
1444
1506
  }
1445
1507
  exports.agentRoomsTopic = agentRoomsTopic;
1446
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
+
1447
1523
  /**
1448
1524
  * This platform's Phoenix Channels topic for a room's `chat_room` channel.
1449
1525
  * @param {any} roomId
@@ -1684,6 +1760,37 @@ function memoryTypes() {
1684
1760
  }
1685
1761
  exports.memoryTypes = memoryTypes;
1686
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
+
1687
1794
  /**
1688
1795
  * This platform's Phoenix Channels topic for a room's `room_participants`
1689
1796
  * channel.
@@ -1710,6 +1817,30 @@ function roomParticipantsTopic(roomId) {
1710
1817
  }
1711
1818
  exports.roomParticipantsTopic = roomParticipantsTopic;
1712
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
+
1713
1844
  /**
1714
1845
  * Validate and normalize an inbound platform event payload.
1715
1846
  *
@@ -1753,7 +1884,7 @@ exports.validateMemoryTypeForSystem = validateMemoryTypeForSystem;
1753
1884
  function __wbg_get_imports() {
1754
1885
  const import0 = {
1755
1886
  __proto__: null,
1756
- __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
1887
+ __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
1757
1888
  const ret = Error(getStringFromWasm0(arg0, arg1));
1758
1889
  return ret;
1759
1890
  },
@@ -1764,68 +1895,68 @@ function __wbg_get_imports() {
1764
1895
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1765
1896
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1766
1897
  },
1767
- __wbg___wbindgen_bigint_get_as_i64_b482365c149396c8: function(arg0, arg1) {
1898
+ __wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
1768
1899
  const v = arg1;
1769
1900
  const ret = typeof(v) === 'bigint' ? v : undefined;
1770
1901
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
1771
1902
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1772
1903
  },
1773
- __wbg___wbindgen_boolean_get_7a12af2b3f899c5a: function(arg0) {
1904
+ __wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
1774
1905
  const v = arg0;
1775
1906
  const ret = typeof(v) === 'boolean' ? v : undefined;
1776
1907
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
1777
1908
  },
1778
- __wbg___wbindgen_debug_string_0e68cf47c9cbd9b0: function(arg0, arg1) {
1909
+ __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
1779
1910
  const ret = debugString(arg1);
1780
1911
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1781
1912
  const len1 = WASM_VECTOR_LEN;
1782
1913
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1783
1914
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1784
1915
  },
1785
- __wbg___wbindgen_in_50072d4d6e45c193: function(arg0, arg1) {
1916
+ __wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
1786
1917
  const ret = arg0 in arg1;
1787
1918
  return ret;
1788
1919
  },
1789
- __wbg___wbindgen_is_bigint_60fc0336cb14f5d7: function(arg0) {
1920
+ __wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
1790
1921
  const ret = typeof(arg0) === 'bigint';
1791
1922
  return ret;
1792
1923
  },
1793
- __wbg___wbindgen_is_function_fcda5e3902d732fe: function(arg0) {
1924
+ __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
1794
1925
  const ret = typeof(arg0) === 'function';
1795
1926
  return ret;
1796
1927
  },
1797
- __wbg___wbindgen_is_null_5160b3e381865372: function(arg0) {
1928
+ __wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
1798
1929
  const ret = arg0 === null;
1799
1930
  return ret;
1800
1931
  },
1801
- __wbg___wbindgen_is_object_edb6b15aa3afe12e: function(arg0) {
1932
+ __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
1802
1933
  const val = arg0;
1803
1934
  const ret = typeof(val) === 'object' && val !== null;
1804
1935
  return ret;
1805
1936
  },
1806
- __wbg___wbindgen_is_string_c4f7cb494a2a21f1: function(arg0) {
1937
+ __wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
1807
1938
  const ret = typeof(arg0) === 'string';
1808
1939
  return ret;
1809
1940
  },
1810
- __wbg___wbindgen_is_undefined_8c687d0b90d5b524: function(arg0) {
1941
+ __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
1811
1942
  const ret = arg0 === undefined;
1812
1943
  return ret;
1813
1944
  },
1814
- __wbg___wbindgen_jsval_eq_9fdcd3c0a860dd3b: function(arg0, arg1) {
1945
+ __wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
1815
1946
  const ret = arg0 === arg1;
1816
1947
  return ret;
1817
1948
  },
1818
- __wbg___wbindgen_jsval_loose_eq_3c30021c243b64cd: function(arg0, arg1) {
1949
+ __wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
1819
1950
  const ret = arg0 == arg1;
1820
1951
  return ret;
1821
1952
  },
1822
- __wbg___wbindgen_number_get_1dc732b810cb937c: function(arg0, arg1) {
1953
+ __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
1823
1954
  const obj = arg1;
1824
1955
  const ret = typeof(obj) === 'number' ? obj : undefined;
1825
1956
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
1826
1957
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
1827
1958
  },
1828
- __wbg___wbindgen_string_get_92ab86bb19cbc12f: function(arg0, arg1) {
1959
+ __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
1829
1960
  const obj = arg1;
1830
1961
  const ret = typeof(obj) === 'string' ? obj : undefined;
1831
1962
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -1833,38 +1964,38 @@ function __wbg_get_imports() {
1833
1964
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1834
1965
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1835
1966
  },
1836
- __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
1967
+ __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
1837
1968
  throw new Error(getStringFromWasm0(arg0, arg1));
1838
1969
  },
1839
- __wbg_call_269c5566fbede3eb: function() { return handleError(function (arg0, arg1) {
1970
+ __wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
1840
1971
  const ret = arg0.call(arg1);
1841
1972
  return ret;
1842
1973
  }, arguments); },
1843
- __wbg_done_cffed884d87aa22e: function(arg0) {
1974
+ __wbg_done_b41a1d26cdb37fb6: function(arg0) {
1844
1975
  const ret = arg0.done;
1845
1976
  return ret;
1846
1977
  },
1847
- __wbg_entries_972a87586902cf87: function(arg0) {
1978
+ __wbg_entries_fb6397112b1de25f: function(arg0) {
1848
1979
  const ret = Object.entries(arg0);
1849
1980
  return ret;
1850
1981
  },
1851
- __wbg_from_a39669ce566077da: function(arg0) {
1982
+ __wbg_from_296ca31f8d0f1c52: function(arg0) {
1852
1983
  const ret = Array.from(arg0);
1853
1984
  return ret;
1854
1985
  },
1855
- __wbg_get_6cf5a4d4d8ad3c5a: function() { return handleError(function (arg0, arg1) {
1986
+ __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
1856
1987
  const ret = Reflect.get(arg0, arg1);
1857
1988
  return ret;
1858
1989
  }, arguments); },
1859
- __wbg_get_989d0a1309644f2b: function() { return handleError(function (arg0, arg1) {
1990
+ __wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
1860
1991
  const ret = Reflect.get(arg0, arg1);
1861
1992
  return ret;
1862
1993
  }, arguments); },
1863
- __wbg_get_b1f0ab13c737f856: function(arg0, arg1) {
1994
+ __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
1864
1995
  const ret = arg0[arg1 >>> 0];
1865
1996
  return ret;
1866
1997
  },
1867
- __wbg_get_unchecked_363572bdd397d473: function(arg0, arg1) {
1998
+ __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
1868
1999
  const ret = arg0[arg1 >>> 0];
1869
2000
  return ret;
1870
2001
  },
@@ -1872,7 +2003,7 @@ function __wbg_get_imports() {
1872
2003
  const ret = arg0[arg1];
1873
2004
  return ret;
1874
2005
  },
1875
- __wbg_instanceof_ArrayBuffer_d4ff01f8247925ae: function(arg0) {
2006
+ __wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
1876
2007
  let result;
1877
2008
  try {
1878
2009
  result = arg0 instanceof ArrayBuffer;
@@ -1882,7 +2013,7 @@ function __wbg_get_imports() {
1882
2013
  const ret = result;
1883
2014
  return ret;
1884
2015
  },
1885
- __wbg_instanceof_Map_1ff6a2b54c899f0d: function(arg0) {
2016
+ __wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
1886
2017
  let result;
1887
2018
  try {
1888
2019
  result = arg0 instanceof Map;
@@ -1892,7 +2023,7 @@ function __wbg_get_imports() {
1892
2023
  const ret = result;
1893
2024
  return ret;
1894
2025
  },
1895
- __wbg_instanceof_Set_daa5e1ad3c6acaeb: function(arg0) {
2026
+ __wbg_instanceof_Set_3b384cb03733893a: function(arg0) {
1896
2027
  let result;
1897
2028
  try {
1898
2029
  result = arg0 instanceof Set;
@@ -1902,7 +2033,7 @@ function __wbg_get_imports() {
1902
2033
  const ret = result;
1903
2034
  return ret;
1904
2035
  },
1905
- __wbg_instanceof_Uint8Array_598adc0fef426aa8: function(arg0) {
2036
+ __wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
1906
2037
  let result;
1907
2038
  try {
1908
2039
  result = arg0 instanceof Uint8Array;
@@ -1912,84 +2043,84 @@ function __wbg_get_imports() {
1912
2043
  const ret = result;
1913
2044
  return ret;
1914
2045
  },
1915
- __wbg_isArray_5674713bb7b79043: function(arg0) {
2046
+ __wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
1916
2047
  const ret = Array.isArray(arg0);
1917
2048
  return ret;
1918
2049
  },
1919
- __wbg_isSafeInteger_8f51c743827d1ec5: function(arg0) {
2050
+ __wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
1920
2051
  const ret = Number.isSafeInteger(arg0);
1921
2052
  return ret;
1922
2053
  },
1923
- __wbg_iterator_22ddeb808cf55a6f: function() {
2054
+ __wbg_iterator_e3c31c892080e444: function() {
1924
2055
  const ret = Symbol.iterator;
1925
2056
  return ret;
1926
2057
  },
1927
- __wbg_length_31bdaf014f5fbde2: function(arg0) {
2058
+ __wbg_length_7f3c00c40364105e: function(arg0) {
1928
2059
  const ret = arg0.length;
1929
2060
  return ret;
1930
2061
  },
1931
- __wbg_length_4e1adc0d42e23620: function(arg0) {
2062
+ __wbg_length_d4bdea10311bd9cf: function(arg0) {
1932
2063
  const ret = arg0.length;
1933
2064
  return ret;
1934
2065
  },
1935
- __wbg_new_1da3429bc3c4541c: function(arg0) {
2066
+ __wbg_new_1dbf7428bba60a42: function(arg0) {
1936
2067
  const ret = new Uint8Array(arg0);
1937
2068
  return ret;
1938
2069
  },
1939
- __wbg_new_8d36e20aa758e411: function() {
2070
+ __wbg_new_28744009d011f847: function() {
1940
2071
  const ret = new Map();
1941
2072
  return ret;
1942
2073
  },
1943
- __wbg_new_a32a1ab6c6655abe: function(arg0, arg1) {
2074
+ __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
1944
2075
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1945
2076
  return ret;
1946
2077
  },
1947
- __wbg_new_bebc3f4757acf305: function() {
2078
+ __wbg_new_617a8cdb8bb1130e: function() {
1948
2079
  const ret = new Object();
1949
2080
  return ret;
1950
2081
  },
1951
- __wbg_new_ffa92086ea89f79c: function() {
2082
+ __wbg_new_ee2291f50781bf1d: function() {
1952
2083
  const ret = new Array();
1953
2084
  return ret;
1954
2085
  },
1955
- __wbg_next_95053e306b1c3aed: function(arg0) {
2086
+ __wbg_next_33784799010f1bbe: function(arg0) {
1956
2087
  const ret = arg0.next;
1957
2088
  return ret;
1958
2089
  },
1959
- __wbg_next_f31ecb8646d2c605: function() { return handleError(function (arg0) {
2090
+ __wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
1960
2091
  const ret = arg0.next();
1961
2092
  return ret;
1962
2093
  }, arguments); },
1963
- __wbg_of_1c173c2ad96e2f7e: function(arg0, arg1) {
2094
+ __wbg_of_20798cb14708764f: function(arg0, arg1) {
1964
2095
  const ret = Array.of(arg0, arg1);
1965
2096
  return ret;
1966
2097
  },
1967
- __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
2098
+ __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
1968
2099
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
1969
2100
  },
1970
- __wbg_push_bfdf956ba476f65b: function(arg0, arg1) {
2101
+ __wbg_push_2baf45db356cf468: function(arg0, arg1) {
1971
2102
  const ret = arg0.push(arg1);
1972
2103
  return ret;
1973
2104
  },
1974
- __wbg_random_7bce4e9e78e2e0d0: function() {
2105
+ __wbg_random_5a4cafd2f02395ff: function() {
1975
2106
  const ret = Math.random();
1976
2107
  return ret;
1977
2108
  },
1978
- __wbg_set_13d25b81ab403f5e: function(arg0, arg1, arg2) {
1979
- arg0[arg1 >>> 0] = arg2;
1980
- },
1981
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1982
- arg0[arg1] = arg2;
1983
- },
1984
- __wbg_set_a377297433dfea63: function() { return handleError(function (arg0, arg1, arg2) {
2109
+ __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
1985
2110
  const ret = Reflect.set(arg0, arg1, arg2);
1986
2111
  return ret;
1987
2112
  }, arguments); },
1988
- __wbg_set_bf6dde4923b9b059: function(arg0, arg1, arg2) {
2113
+ __wbg_set_6ae97e73113c4f0b: function(arg0, arg1, arg2) {
1989
2114
  const ret = arg0.set(arg1, arg2);
1990
2115
  return ret;
1991
2116
  },
1992
- __wbg_value_c227f843d21da141: function(arg0) {
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) {
1993
2124
  const ret = arg0.value;
1994
2125
  return ret;
1995
2126
  },
@@ -2062,6 +2193,9 @@ const SessionPolicyFinalization = (typeof FinalizationRegistry === 'undefined')
2062
2193
  const SubscriptionTrackerFinalization = (typeof FinalizationRegistry === 'undefined')
2063
2194
  ? { register: () => {}, unregister: () => {} }
2064
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));
2065
2199
 
2066
2200
  function addToExternrefTable0(obj) {
2067
2201
  const idx = wasm.__externref_table_alloc();
Binary file
package/index.d.ts CHANGED
@@ -617,3 +617,82 @@ export function evaluateAdapterResult(
617
617
  * `senderId`/`senderType`/`agentId` is not a string.
618
618
  */
619
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/band-sdk-core",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Shared Band event-payload validation",
5
5
  "license": "MIT",
6
6
  "repository": {