@band-ai/band-sdk-core 0.4.0-dev.1 → 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.
Files changed (2) hide show
  1. package/README.md +53 -0
  2. package/package.json +3 -2
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
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@band-ai/band-sdk-core",
3
- "version": "0.4.0-dev.1",
3
+ "version": "0.4.0-dev.2",
4
4
  "description": "Shared Band event-payload validation",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -10,7 +10,8 @@
10
10
  "files": [
11
11
  "band_sdk_core.js",
12
12
  "band_sdk_core_bg.wasm",
13
- "index.d.ts"
13
+ "index.d.ts",
14
+ "README.md"
14
15
  ],
15
16
  "main": "./band_sdk_core.js",
16
17
  "types": "./index.d.ts",