@band-ai/band-sdk-core 0.0.0-dev.0 → 0.4.0-dev.2
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 +53 -0
- package/{bandcore.js → band_sdk_core.js} +2 -2
- package/band_sdk_core_bg.wasm +0 -0
- package/package.json +7 -6
- package/bandcore_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# band-sdk-core-wasm
|
|
2
|
+
|
|
3
|
+
JavaScript package for [`band-sdk-core-core`](../core), published as
|
|
4
|
+
`@band-ai/band-sdk-core` for Node.
|
|
5
|
+
|
|
6
|
+
## Public surface
|
|
7
|
+
|
|
8
|
+
`validateEventPayload(eventType, raw, traceContext?)`. `eventType` is the
|
|
9
|
+
platform event name (`"message_created"`, `"agent.control"`, …). `raw` is a
|
|
10
|
+
plain JS value. Success returns the normalized payload (`event_created`
|
|
11
|
+
returns the input unchanged). Failure throws a native `Error` with
|
|
12
|
+
`.issues` (`{path, code, message}` objects) and `.traceContext` — not a
|
|
13
|
+
message-only error. There is no custom exception class.
|
|
14
|
+
|
|
15
|
+
`ClaimRegistry`, `RetryTracker`, and `ParticipantRoster` are the
|
|
16
|
+
inbound-delivery runtime state classes -- lifecycle and design decisions:
|
|
17
|
+
[`../core/docs/runtime-state-policy.md`](../core/docs/runtime-state-policy.md).
|
|
18
|
+
A participant is any plain object; `add`/`setAll` read `id`, `name`,
|
|
19
|
+
`type`, `handle`, `description` from it and `list()` returns objects with
|
|
20
|
+
exactly those five keys. `id` is required and must be a string; the other
|
|
21
|
+
four are each a string or `null`/absent. `setAll` takes an optional
|
|
22
|
+
`traceContext` and throws -- leaving the roster unchanged, with `.issues`
|
|
23
|
+
and `.traceContext` attached like `validateEventPayload`'s error -- if its
|
|
24
|
+
snapshot names the same `id` twice. `RetryTracker`'s `maxTracked` must be
|
|
25
|
+
at least `1`; `0` throws. `ClaimRegistry`'s `maxCompleted` must be at
|
|
26
|
+
least `1` too -- `0` also throws.
|
|
27
|
+
|
|
28
|
+
`validateMemoryTypeForSystem(system, type, traceContext?)` validates the
|
|
29
|
+
canonical memory taxonomy -- design decisions:
|
|
30
|
+
[`../core/docs/memory-taxonomy-policy.md`](../core/docs/memory-taxonomy-policy.md).
|
|
31
|
+
`system` and `type` are wire-name strings (`MemorySystem`/`MemoryType` in
|
|
32
|
+
`index.d.ts` are string-literal types, not classes -- there is no runtime
|
|
33
|
+
enum on this boundary, matching how `EventType` stays a plain string in
|
|
34
|
+
`validateEventPayload`). Returns `void` on success. Failure throws a
|
|
35
|
+
native `Error` with the same `.issues`/`.traceContext` contract as
|
|
36
|
+
`validateEventPayload` -- an unrecognized `system` and an unrecognized
|
|
37
|
+
`type` are independent issues, both reported when both strings are
|
|
38
|
+
invalid.
|
|
39
|
+
|
|
40
|
+
The package is Node CommonJS with an eager WASM load. There is no default
|
|
41
|
+
`init`. The public declaration is `index.d.ts`:
|
|
42
|
+
`validateEventPayload(...): unknown`. Node `require()` and ESM `import()`
|
|
43
|
+
both resolve `@band-ai/band-sdk-core` at the package root.
|
|
44
|
+
|
|
45
|
+
## Build / test
|
|
46
|
+
|
|
47
|
+
`just check` compiles and lints this crate for the host.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
just test-wasm # suite in Node
|
|
51
|
+
just pack-npm # Node tarball + require/import consumers
|
|
52
|
+
just build-wasm # Node package output
|
|
53
|
+
```
|
|
@@ -637,7 +637,7 @@ function __wbg_get_imports() {
|
|
|
637
637
|
};
|
|
638
638
|
return {
|
|
639
639
|
__proto__: null,
|
|
640
|
-
"./
|
|
640
|
+
"./band_sdk_core_bg.js": import0,
|
|
641
641
|
};
|
|
642
642
|
}
|
|
643
643
|
|
|
@@ -835,7 +835,7 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
835
835
|
|
|
836
836
|
let WASM_VECTOR_LEN = 0;
|
|
837
837
|
|
|
838
|
-
const wasmPath = `${__dirname}/
|
|
838
|
+
const wasmPath = `${__dirname}/band_sdk_core_bg.wasm`;
|
|
839
839
|
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
840
840
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
841
841
|
let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@band-ai/band-sdk-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-dev.2",
|
|
4
4
|
"description": "Shared Band event-payload validation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -8,16 +8,17 @@
|
|
|
8
8
|
"url": "https://github.com/band-ai/band-sdk-core"
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"index.d.ts"
|
|
11
|
+
"band_sdk_core.js",
|
|
12
|
+
"band_sdk_core_bg.wasm",
|
|
13
|
+
"index.d.ts",
|
|
14
|
+
"README.md"
|
|
14
15
|
],
|
|
15
|
-
"main": "./
|
|
16
|
+
"main": "./band_sdk_core.js",
|
|
16
17
|
"types": "./index.d.ts",
|
|
17
18
|
"exports": {
|
|
18
19
|
".": {
|
|
19
20
|
"types": "./index.d.ts",
|
|
20
|
-
"default": "./
|
|
21
|
+
"default": "./band_sdk_core.js"
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
}
|
package/bandcore_bg.wasm
DELETED
|
Binary file
|