@band-ai/band-sdk-core 2.2.0 → 2.3.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/band_sdk_core.js CHANGED
@@ -1,5 +1,110 @@
1
1
  /* @ts-self-types="./index.d.ts" */
2
2
 
3
+ /**
4
+ * One agent-provider failure, surfaced verbatim rather than classified.
5
+ */
6
+ class AgentFailure {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ AgentFailureFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_agentfailure_free(ptr, 0);
16
+ }
17
+ /**
18
+ * @returns {string | undefined}
19
+ */
20
+ get code() {
21
+ const ret = wasm.agentfailure_code(this.__wbg_ptr);
22
+ let v1;
23
+ if (ret[0] !== 0) {
24
+ v1 = getStringFromWasm0(ret[0], ret[1]);
25
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
26
+ }
27
+ return v1;
28
+ }
29
+ /**
30
+ * `undefined` when absent, matching every other optional getter in
31
+ * this crate (e.g. `SessionOutcome.deadReason`) -- `toObject()` below
32
+ * represents the same absence as JSON `null` instead, since it mirrors
33
+ * the wire shape rather than idiomatic JS/TS property access.
34
+ * @returns {any}
35
+ */
36
+ get detail() {
37
+ const ret = wasm.agentfailure_detail(this.__wbg_ptr);
38
+ if (ret[2]) {
39
+ throw takeFromExternrefTable0(ret[1]);
40
+ }
41
+ return takeFromExternrefTable0(ret[0]);
42
+ }
43
+ /**
44
+ * @returns {string}
45
+ */
46
+ get message() {
47
+ let deferred1_0;
48
+ let deferred1_1;
49
+ try {
50
+ const ret = wasm.agentfailure_message(this.__wbg_ptr);
51
+ deferred1_0 = ret[0];
52
+ deferred1_1 = ret[1];
53
+ return getStringFromWasm0(ret[0], ret[1]);
54
+ } finally {
55
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
56
+ }
57
+ }
58
+ /**
59
+ * Throws a plain `Error` if `provider`/`message` is not a string, or
60
+ * `code` is present but not a string or `null`. A `detail` that cannot
61
+ * be converted from JSON throws a plain `Error` too.
62
+ * @param {any} provider
63
+ * @param {any} message
64
+ * @param {any} code
65
+ * @param {any} detail
66
+ */
67
+ constructor(provider, message, code, detail) {
68
+ const ret = wasm.agentfailure_new(provider, message, code, detail);
69
+ if (ret[2]) {
70
+ throw takeFromExternrefTable0(ret[1]);
71
+ }
72
+ this.__wbg_ptr = ret[0];
73
+ AgentFailureFinalization.register(this, this.__wbg_ptr, this);
74
+ return this;
75
+ }
76
+ /**
77
+ * @returns {string}
78
+ */
79
+ get provider() {
80
+ let deferred1_0;
81
+ let deferred1_1;
82
+ try {
83
+ const ret = wasm.agentfailure_provider(this.__wbg_ptr);
84
+ deferred1_0 = ret[0];
85
+ deferred1_1 = ret[1];
86
+ return getStringFromWasm0(ret[0], ret[1]);
87
+ } finally {
88
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
89
+ }
90
+ }
91
+ /**
92
+ * The failure as a plain JSON-shaped object: unlike the getters above,
93
+ * an absent `code`/`detail` serializes as `null` here, matching the
94
+ * core type's own `Serialize` output.
95
+ * @returns {any}
96
+ */
97
+ toObject() {
98
+ const ret = wasm.agentfailure_toObject(this.__wbg_ptr);
99
+ if (ret[2]) {
100
+ throw takeFromExternrefTable0(ret[1]);
101
+ }
102
+ return takeFromExternrefTable0(ret[0]);
103
+ }
104
+ }
105
+ if (Symbol.dispose) AgentFailure.prototype[Symbol.dispose] = AgentFailure.prototype.free;
106
+ exports.AgentFailure = AgentFailure;
107
+
3
108
  /**
4
109
  * Ownership ledger for the inbound message-delivery lifecycle: in-flight,
5
110
  * ack-pending, and completed states, each scoped by `(roomId,
@@ -1629,6 +1734,9 @@ function __wbg_get_imports() {
1629
1734
  };
1630
1735
  }
1631
1736
 
1737
+ const AgentFailureFinalization = (typeof FinalizationRegistry === 'undefined')
1738
+ ? { register: () => {}, unregister: () => {} }
1739
+ : new FinalizationRegistry(ptr => wasm.__wbg_agentfailure_free(ptr, 1));
1632
1740
  const ClaimRegistryFinalization = (typeof FinalizationRegistry === 'undefined')
1633
1741
  ? { register: () => {}, unregister: () => {} }
1634
1742
  : new FinalizationRegistry(ptr => wasm.__wbg_claimregistry_free(ptr, 1));
Binary file
package/index.d.ts CHANGED
@@ -1,3 +1,27 @@
1
+ /**
2
+ * One agent-provider failure, surfaced verbatim rather than classified.
3
+ * `detail` is an opaque passthrough of whatever JSON shape the provider (or
4
+ * the adapter, for a self-declared failure such as `code: "timeout"`)
5
+ * attaches -- this package never inspects it.
6
+ *
7
+ * Throws a plain `Error` if `provider`/`message` is not a string, `code` is
8
+ * present but not a string or `null`/`undefined`, or `detail` cannot be
9
+ * converted from JSON.
10
+ */
11
+ export class AgentFailure {
12
+ constructor(provider: string, message: string, code?: string | null, detail?: unknown);
13
+ readonly provider: string;
14
+ readonly code: string | undefined;
15
+ readonly message: string;
16
+ /** `undefined` when absent; {@link toObject} represents the same absence as `null` instead. */
17
+ readonly detail: unknown | undefined;
18
+ /**
19
+ * The failure as a plain JSON-shaped object. Unlike the getters above, an
20
+ * absent `code`/`detail` serializes as `null` here, not `undefined`.
21
+ */
22
+ toObject(): Record<string, unknown>;
23
+ }
24
+
1
25
  /** Canonical inbound wire-event names `validateEventPayload` accepts. */
2
26
  export type EventType =
3
27
  | "message_created"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/band-sdk-core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Shared Band event-payload validation",
5
5
  "license": "MIT",
6
6
  "repository": {