@anvailabs/sandhi 0.5.1 → 0.6.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.
@@ -1,48 +0,0 @@
1
- // SandhiProviderError rewrap contract (TD-0008 P2/C): typed payloads become the
2
- // class; binding-internal failures pass through untouched.
3
- import assert from "node:assert/strict";
4
- import { test } from "node:test";
5
- import { createRequire } from "node:module";
6
-
7
- const require = createRequire(import.meta.url);
8
- const sandhi = require("../sandhi.js");
9
-
10
- test("SandhiProviderError exposes typed fields from a ProviderErrorV1 payload", () => {
11
- const payload = {
12
- code: "upstream_error",
13
- message: "upstream status 400: bad tool pairing",
14
- retryable: false,
15
- http_status: 400,
16
- provider: "moonshot",
17
- request_id: "req_abc",
18
- details: { upstream_body: "{\"error\":\"bad tool pairing\"}" },
19
- };
20
- const err = new sandhi.SandhiProviderError(payload, JSON.stringify(payload));
21
- assert.equal(err.name, "SandhiProviderError");
22
- assert.equal(err.code, "upstream_error");
23
- assert.equal(err.httpStatus, 400);
24
- assert.equal(err.retryable, false);
25
- assert.equal(err.requestId, "req_abc");
26
- assert.ok(err instanceof Error);
27
- assert.equal(err.details.upstream_body, "{\"error\":\"bad tool pairing\"}");
28
- });
29
-
30
- test("async iterator rewraps typed error messages and passes others through", async () => {
31
- const typedJson = JSON.stringify({ code: "rate_limited", message: "rate limited (429)", retryable: true, http_status: 429 });
32
- const makeStream = (error) => {
33
- const stream = Object.create(sandhi.TypedEventStream.prototype);
34
- stream.read = async () => { throw error; };
35
- return stream;
36
- };
37
-
38
- await assert.rejects(
39
- async () => { for await (const _ of makeStream(new Error(typedJson))) { /* drain */ } },
40
- (err) => err instanceof sandhi.SandhiProviderError && err.code === "rate_limited" && err.retryable === true
41
- );
42
-
43
- const plain = new Error("segfault in binding");
44
- await assert.rejects(
45
- async () => { for await (const _ of makeStream(plain)) { /* drain */ } },
46
- (err) => err === plain && !(err instanceof sandhi.SandhiProviderError)
47
- );
48
- });
Binary file
Binary file
package/build.rs DELETED
@@ -1,3 +0,0 @@
1
- fn main() {
2
- napi_build::setup();
3
- }
@@ -1,19 +0,0 @@
1
- {
2
- "name": "@anvailabs/sandhi-darwin-arm64",
3
- "version": "0.5.1",
4
- "main": "sandhi.darwin-arm64.node",
5
- "files": [
6
- "sandhi.darwin-arm64.node"
7
- ],
8
- "description": "Platform binary for @anvailabs/sandhi (darwin-arm64)",
9
- "license": "Apache-2.0",
10
- "engines": {
11
- "node": ">= 10"
12
- },
13
- "cpu": [
14
- "arm64"
15
- ],
16
- "os": [
17
- "darwin"
18
- ]
19
- }
@@ -1,22 +0,0 @@
1
- {
2
- "name": "@anvailabs/sandhi-linux-x64-gnu",
3
- "version": "0.5.1",
4
- "main": "sandhi.linux-x64-gnu.node",
5
- "files": [
6
- "sandhi.linux-x64-gnu.node"
7
- ],
8
- "description": "Platform binary for @anvailabs/sandhi (linux-x64-gnu)",
9
- "license": "Apache-2.0",
10
- "engines": {
11
- "node": ">= 10"
12
- },
13
- "cpu": [
14
- "x64"
15
- ],
16
- "os": [
17
- "linux"
18
- ],
19
- "libc": [
20
- "glibc"
21
- ]
22
- }