@codespar/sdk 0.9.0 → 0.10.1

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 (53) hide show
  1. package/README.md +182 -19
  2. package/dist/__tests__/base-url-resolution.test.d.ts +10 -0
  3. package/dist/__tests__/base-url-resolution.test.d.ts.map +1 -0
  4. package/dist/__tests__/base-url-resolution.test.js +57 -0
  5. package/dist/__tests__/base-url-resolution.test.js.map +1 -0
  6. package/dist/__tests__/errors.test.d.ts +16 -0
  7. package/dist/__tests__/errors.test.d.ts.map +1 -0
  8. package/dist/__tests__/errors.test.js +163 -0
  9. package/dist/__tests__/errors.test.js.map +1 -0
  10. package/dist/__tests__/forward-mocks.test.d.ts +15 -0
  11. package/dist/__tests__/forward-mocks.test.d.ts.map +1 -0
  12. package/dist/__tests__/forward-mocks.test.js +134 -0
  13. package/dist/__tests__/forward-mocks.test.js.map +1 -0
  14. package/dist/__tests__/mocks-wire-parity.test.d.ts +15 -0
  15. package/dist/__tests__/mocks-wire-parity.test.d.ts.map +1 -0
  16. package/dist/__tests__/mocks-wire-parity.test.js +71 -0
  17. package/dist/__tests__/mocks-wire-parity.test.js.map +1 -0
  18. package/dist/__tests__/shop.test.d.ts +17 -0
  19. package/dist/__tests__/shop.test.d.ts.map +1 -0
  20. package/dist/__tests__/shop.test.js +213 -0
  21. package/dist/__tests__/shop.test.js.map +1 -0
  22. package/dist/__tests__/testing.test.d.ts +2 -0
  23. package/dist/__tests__/testing.test.d.ts.map +1 -0
  24. package/dist/__tests__/testing.test.js +133 -0
  25. package/dist/__tests__/testing.test.js.map +1 -0
  26. package/dist/__tests__/tool-result-codes.test.d.ts +18 -0
  27. package/dist/__tests__/tool-result-codes.test.d.ts.map +1 -0
  28. package/dist/__tests__/tool-result-codes.test.js +164 -0
  29. package/dist/__tests__/tool-result-codes.test.js.map +1 -0
  30. package/dist/errors.d.ts +43 -0
  31. package/dist/errors.d.ts.map +1 -0
  32. package/dist/errors.js +77 -0
  33. package/dist/errors.js.map +1 -0
  34. package/dist/index.d.ts +4 -0
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +2 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/session.d.ts.map +1 -1
  39. package/dist/session.js +128 -49
  40. package/dist/session.js.map +1 -1
  41. package/dist/testing/index.d.ts +9 -0
  42. package/dist/testing/index.d.ts.map +1 -0
  43. package/dist/testing/index.js +97 -0
  44. package/dist/testing/index.js.map +1 -0
  45. package/dist/tool-result-codes.d.ts +82 -0
  46. package/dist/tool-result-codes.d.ts.map +1 -0
  47. package/dist/tool-result-codes.js +99 -0
  48. package/dist/tool-result-codes.js.map +1 -0
  49. package/dist/types.d.ts +20 -1
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/types.js +8 -0
  52. package/dist/types.js.map +1 -1
  53. package/package.json +6 -2
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Tool-result code guard tests.
3
+ *
4
+ * Asserts:
5
+ * - Positive + negative paths per guard.
6
+ * - Sibling-field-missing fixtures — a well-formed `code` with
7
+ * missing required siblings (e.g. `rule_id` for policy_denied)
8
+ * returns false. The guard does not narrow on the discriminant
9
+ * alone.
10
+ * - Unknown-code defense-in-depth — an unknown `code` value never
11
+ * narrows positive on any guard.
12
+ * - assertExhaustiveToolResult compiles when every variant is
13
+ * handled (the test below is the compile-time witness).
14
+ * - output.code vs error_code disagreement — guards key on the
15
+ * `code` field on the payload, ignoring sibling discrepancies.
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=tool-result-codes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-result-codes.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tool-result-codes.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Tool-result code guard tests.
3
+ *
4
+ * Asserts:
5
+ * - Positive + negative paths per guard.
6
+ * - Sibling-field-missing fixtures — a well-formed `code` with
7
+ * missing required siblings (e.g. `rule_id` for policy_denied)
8
+ * returns false. The guard does not narrow on the discriminant
9
+ * alone.
10
+ * - Unknown-code defense-in-depth — an unknown `code` value never
11
+ * narrows positive on any guard.
12
+ * - assertExhaustiveToolResult compiles when every variant is
13
+ * handled (the test below is the compile-time witness).
14
+ * - output.code vs error_code disagreement — guards key on the
15
+ * `code` field on the payload, ignoring sibling discrepancies.
16
+ */
17
+ import { describe, it, expect } from "vitest";
18
+ import { TOOL_RESULT_CODES, ToolResultCode, assertExhaustiveToolResult, isApprovalRequired, isMocksEngineError, isMocksExhausted, isPolicyDenied, isToolNotMocked, } from "../tool-result-codes.js";
19
+ describe("TOOL_RESULT_CODES set", () => {
20
+ it("includes the five canonical codes", () => {
21
+ expect(TOOL_RESULT_CODES).toContain("policy_denied");
22
+ expect(TOOL_RESULT_CODES).toContain("approval_required");
23
+ expect(TOOL_RESULT_CODES).toContain("mocks_exhausted");
24
+ expect(TOOL_RESULT_CODES).toContain("mocks_engine_error");
25
+ expect(TOOL_RESULT_CODES).toContain("tool_not_mocked");
26
+ });
27
+ });
28
+ describe("isPolicyDenied", () => {
29
+ it("returns true for a well-formed policy_denied output", () => {
30
+ const out = {
31
+ code: ToolResultCode.PolicyDenied,
32
+ rule_id: "spend_cap",
33
+ message: "exceeds tenant cap",
34
+ };
35
+ expect(isPolicyDenied(out)).toBe(true);
36
+ });
37
+ it("returns false when rule_id is missing", () => {
38
+ const out = {
39
+ code: ToolResultCode.PolicyDenied,
40
+ message: "missing rule",
41
+ };
42
+ expect(isPolicyDenied(out)).toBe(false);
43
+ });
44
+ it("returns false when message is missing", () => {
45
+ const out = {
46
+ code: ToolResultCode.PolicyDenied,
47
+ rule_id: "spend_cap",
48
+ };
49
+ expect(isPolicyDenied(out)).toBe(false);
50
+ });
51
+ it("returns false on a foreign discriminant", () => {
52
+ const out = {
53
+ code: "approval_required",
54
+ rule_id: "x",
55
+ message: "y",
56
+ };
57
+ expect(isPolicyDenied(out)).toBe(false);
58
+ });
59
+ it("returns false on an unknown code (defense in depth)", () => {
60
+ const out = {
61
+ code: "totally_made_up",
62
+ rule_id: "x",
63
+ message: "y",
64
+ };
65
+ expect(isPolicyDenied(out)).toBe(false);
66
+ });
67
+ it("returns false on null/undefined/non-object", () => {
68
+ expect(isPolicyDenied(null)).toBe(false);
69
+ expect(isPolicyDenied(undefined)).toBe(false);
70
+ expect(isPolicyDenied("policy_denied")).toBe(false);
71
+ });
72
+ });
73
+ describe("isApprovalRequired", () => {
74
+ it("returns true for a well-formed approval_required output", () => {
75
+ const out = {
76
+ code: ToolResultCode.ApprovalRequired,
77
+ approval_id: "apr_abc",
78
+ expires_at: "2026-12-01T00:00:00Z",
79
+ message: "approve the transfer",
80
+ };
81
+ expect(isApprovalRequired(out)).toBe(true);
82
+ });
83
+ it("returns false when approval_id is missing", () => {
84
+ const out = {
85
+ code: ToolResultCode.ApprovalRequired,
86
+ expires_at: "2026-12-01T00:00:00Z",
87
+ message: "x",
88
+ };
89
+ expect(isApprovalRequired(out)).toBe(false);
90
+ });
91
+ it("returns false when expires_at is missing", () => {
92
+ const out = {
93
+ code: ToolResultCode.ApprovalRequired,
94
+ approval_id: "apr_abc",
95
+ message: "x",
96
+ };
97
+ expect(isApprovalRequired(out)).toBe(false);
98
+ });
99
+ it("returns false when message is missing", () => {
100
+ const out = {
101
+ code: ToolResultCode.ApprovalRequired,
102
+ approval_id: "apr_abc",
103
+ expires_at: "x",
104
+ };
105
+ expect(isApprovalRequired(out)).toBe(false);
106
+ });
107
+ });
108
+ describe("isMocksExhausted and isMocksEngineError", () => {
109
+ it("isMocksExhausted: positive + sibling-missing", () => {
110
+ expect(isMocksExhausted({ code: ToolResultCode.MocksExhausted, message: "drained" })).toBe(true);
111
+ expect(isMocksExhausted({ code: ToolResultCode.MocksExhausted })).toBe(false);
112
+ });
113
+ it("isMocksEngineError: positive + sibling-missing", () => {
114
+ expect(isMocksEngineError({
115
+ code: ToolResultCode.MocksEngineError,
116
+ message: "consume failed",
117
+ })).toBe(true);
118
+ expect(isMocksEngineError({ code: ToolResultCode.MocksEngineError })).toBe(false);
119
+ });
120
+ });
121
+ describe("isToolNotMocked", () => {
122
+ it("returns true with tool_name + message", () => {
123
+ expect(isToolNotMocked({
124
+ code: ToolResultCode.ToolNotMocked,
125
+ tool_name: "asaas/create_payment",
126
+ message: "not in mocks map",
127
+ })).toBe(true);
128
+ });
129
+ it("returns false when tool_name is missing", () => {
130
+ expect(isToolNotMocked({ code: ToolResultCode.ToolNotMocked, message: "x" })).toBe(false);
131
+ });
132
+ });
133
+ describe("assertExhaustiveToolResult", () => {
134
+ it("compiles when every code variant is handled", () => {
135
+ // The test BODY here is the compile-time witness; runtime asserts
136
+ // the unreachable-default branch throws on a hostile cast.
137
+ function describe(value) {
138
+ switch (value.code) {
139
+ case ToolResultCode.PolicyDenied:
140
+ return "denied";
141
+ case ToolResultCode.ApprovalRequired:
142
+ return "approval";
143
+ case ToolResultCode.MocksExhausted:
144
+ return "exhausted";
145
+ case ToolResultCode.MocksEngineError:
146
+ return "engine";
147
+ case ToolResultCode.ToolNotMocked:
148
+ return "not_mocked";
149
+ default:
150
+ // If a 6th code lands without this branch being updated, TS
151
+ // fails: assertExhaustiveToolResult(value) would error at
152
+ // compile time on a non-never argument.
153
+ return assertExhaustiveToolResult(value);
154
+ }
155
+ }
156
+ expect(describe({
157
+ code: ToolResultCode.PolicyDenied,
158
+ rule_id: "x",
159
+ message: "y",
160
+ })).toBe("denied");
161
+ expect(() => assertExhaustiveToolResult({ code: "rogue" })).toThrow(/tool-result-codes/i);
162
+ });
163
+ });
164
+ //# sourceMappingURL=tool-result-codes.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-result-codes.test.js","sourceRoot":"","sources":["../../src/__tests__/tool-result-codes.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QA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kEAAkE;QAClE,2DAA2D;QAC3D,SAAS,QAAQ,CAAC,KAAwB;YACxC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;gBACnB,KAAK,cAAc,CAAC,YAAY;oBAC9B,OAAO,QAAQ,CAAC;gBAClB,KAAK,cAAc,CAAC,gBAAgB;oBAClC,OAAO,UAAU,CAAC;gBACpB,KAAK,cAAc,CAAC,cAAc;oBAChC,OAAO,WAAW,CAAC;gBACrB,KAAK,cAAc,CAAC,gBAAgB;oBAClC,OAAO,QAAQ,CAAC;gBAClB,KAAK,cAAc,CAAC,aAAa;oBAC/B,OAAO,YAAY,CAAC;gBACtB;oBACE,4DAA4D;oBAC5D,0DAA0D;oBAC1D,wCAAwC;oBACxC,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;QACD,MAAM,CACJ,QAAQ,CAAC;YACP,IAAI,EAAE,cAAc,CAAC,YAAY;YACjC,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,GAAG;SACb,CAAC,CACH,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjB,MAAM,CAAC,GAAG,EAAE,CACV,0BAA0B,CAAC,EAAE,IAAI,EAAE,OAAgB,EAAW,CAAC,CAChE,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Structured exception for every transport-failure path through the
3
+ * SDK. Replaces the old `throw new Error("send failed: 500 ...")`
4
+ * shape, so callers can branch on `e.code` rather than parsing
5
+ * `e.message` strings.
6
+ *
7
+ * The reserved code namespace covers the hosted-test-mode wire
8
+ * contract (tool-result codes + create-time envelope codes —
9
+ * see the README's "Reserved error codes" section). Customers
10
+ * extending CodesparApiError should prefix their own codes (e.g.
11
+ * `"myapp.policy_denied"`) to avoid collision with reserved values.
12
+ *
13
+ * `status: 0` is reserved for network errors that never reached the
14
+ * backend; the underlying `cause` carries the original `TypeError`
15
+ * or `DOMException` that `fetch` rejected with.
16
+ */
17
+ export interface CodesparApiErrorOptions {
18
+ status: number;
19
+ code?: string;
20
+ body?: unknown;
21
+ cause?: unknown;
22
+ }
23
+ export declare class CodesparApiError extends Error {
24
+ readonly status: number;
25
+ readonly code?: string;
26
+ readonly body?: unknown;
27
+ constructor(message: string, options: CodesparApiErrorOptions);
28
+ }
29
+ /**
30
+ * Build the canonical error message + extract the structured code +
31
+ * preserve the parsed body. Centralised so every transport call site
32
+ * surfaces the same shape — a customer parsing `e.message` is
33
+ * already on the deprecated path; new code branches on `e.code`.
34
+ */
35
+ export declare function throwFromResponse(response: Response, what: string): Promise<never>;
36
+ /**
37
+ * Convert a `fetch` rejection (network error, abort, DNS, TLS, etc.)
38
+ * into a CodesparApiError with `status: 0`. Preserves the underlying
39
+ * error as `cause` so callers debugging a transport failure can dig
40
+ * into the original `TypeError`.
41
+ */
42
+ export declare function networkErrorToApiError(cause: unknown, what: string): CodesparApiError;
43
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB;CAY9D;AAkCD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,CAAC,CAehB;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAMrF"}
package/dist/errors.js ADDED
@@ -0,0 +1,77 @@
1
+ export class CodesparApiError extends Error {
2
+ status;
3
+ code;
4
+ body;
5
+ constructor(message, options) {
6
+ // ES2022 `cause` shape — supported by Node 20 + modern browsers.
7
+ super(message, options.cause !== undefined ? { cause: options.cause } : undefined);
8
+ // Restore the prototype chain — without this, `instanceof
9
+ // CodesparApiError` returns false across some transpilers and
10
+ // realms (the classic ES5-target Error subclass trap).
11
+ Object.setPrototypeOf(this, CodesparApiError.prototype);
12
+ this.name = "CodesparApiError";
13
+ this.status = options.status;
14
+ this.code = options.code;
15
+ this.body = options.body;
16
+ }
17
+ }
18
+ function parseErrorPayload(raw) {
19
+ if (!raw)
20
+ return { body: undefined, parsed: {} };
21
+ try {
22
+ const body = JSON.parse(raw);
23
+ if (body && typeof body === "object" && !Array.isArray(body)) {
24
+ const obj = body;
25
+ const code = typeof obj.code === "string" ? obj.code : undefined;
26
+ // Legacy fallback: pre-PRD envelopes used `error` as the
27
+ // discriminant. `code` takes precedence; `error` honored only
28
+ // when `code` is missing.
29
+ const fallbackCode = code ?? (typeof obj.error === "string" ? obj.error : undefined);
30
+ const message = typeof obj.message === "string" ? obj.message : undefined;
31
+ return {
32
+ body,
33
+ parsed: { code: fallbackCode, message },
34
+ };
35
+ }
36
+ return { body, parsed: {} };
37
+ }
38
+ catch {
39
+ return { body: raw, parsed: {} };
40
+ }
41
+ }
42
+ /**
43
+ * Build the canonical error message + extract the structured code +
44
+ * preserve the parsed body. Centralised so every transport call site
45
+ * surfaces the same shape — a customer parsing `e.message` is
46
+ * already on the deprecated path; new code branches on `e.code`.
47
+ */
48
+ export async function throwFromResponse(response, what) {
49
+ const raw = await response.text();
50
+ const { body, parsed } = parseErrorPayload(raw);
51
+ const suffix = parsed.message
52
+ ? ` — ${parsed.message}`
53
+ : parsed.code
54
+ ? ` — ${parsed.code}`
55
+ : raw
56
+ ? ` ${raw}`
57
+ : "";
58
+ throw new CodesparApiError(`${what} failed: ${response.status}${suffix}`, {
59
+ status: response.status,
60
+ code: parsed.code,
61
+ body,
62
+ });
63
+ }
64
+ /**
65
+ * Convert a `fetch` rejection (network error, abort, DNS, TLS, etc.)
66
+ * into a CodesparApiError with `status: 0`. Preserves the underlying
67
+ * error as `cause` so callers debugging a transport failure can dig
68
+ * into the original `TypeError`.
69
+ */
70
+ export function networkErrorToApiError(cause, what) {
71
+ const message = cause instanceof Error ? cause.message : String(cause);
72
+ return new CodesparApiError(`${what} network error: ${message}`, {
73
+ status: 0,
74
+ cause,
75
+ });
76
+ }
77
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAuBA,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,MAAM,CAAS;IACf,IAAI,CAAU;IACd,IAAI,CAAW;IAExB,YAAY,OAAe,EAAE,OAAgC;QAC3D,iEAAiE;QACjE,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnF,0DAA0D;QAC1D,8DAA8D;QAC9D,uDAAuD;QACvD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACxD,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC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G,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO;QAC3B,CAAC,CAAC,MAAM,MAAM,CAAC,OAAO,EAAE;QACxB,CAAC,CAAC,MAAM,CAAC,IAAI;YACX,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE;YACrB,CAAC,CAAC,GAAG;gBACH,CAAC,CAAC,IAAI,GAAG,EAAE;gBACX,CAAC,CAAC,EAAE,CAAC;IACX,MAAM,IAAI,gBAAgB,CAAC,GAAG,IAAI,YAAY,QAAQ,CAAC,MAAM,GAAG,MAAM,EAAE,EAAE;QACxE,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI;KACL,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc,EAAE,IAAY;IACjE,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,IAAI,gBAAgB,CAAC,GAAG,IAAI,mBAAmB,OAAO,EAAE,EAAE;QAC/D,MAAM,EAAE,CAAC;QACT,KAAK;KACN,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -28,6 +28,10 @@ export type { CodeSparConfig, SessionConfig, Tool, LoopConfig, LoopStep, LoopRes
28
28
  export { SessionConfigSchema } from "./types.js";
29
29
  export { loop } from "./loop.js";
30
30
  export { tools, findTools } from "./tools.js";
31
+ export { CodesparApiError } from "./errors.js";
32
+ export type { CodesparApiErrorOptions } from "./errors.js";
33
+ export { TOOL_RESULT_CODES, ToolResultCode, assertExhaustiveToolResult, isApprovalRequired, isMocksEngineError, isMocksExhausted, isPolicyDenied, isToolNotMocked, } from "./tool-result-codes.js";
34
+ export type { ApprovalRequiredOutput, ApprovalRequiredToolCall, MocksEngineErrorOutput, MocksEngineErrorToolCall, MocksExhaustedOutput, MocksExhaustedToolCall, PolicyDeniedOutput, PolicyDeniedToolCall, ToolNotMockedOutput, ToolNotMockedToolCall, ToolResultOutcome, } from "./tool-result-codes.js";
31
35
  import type { CodeSparConfig, SessionConfig } from "./types.js";
32
36
  import type { Session } from "@codespar/types";
33
37
  export declare class CodeSpar {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,cAAc,iBAAiB,CAAC;AAEhC,YAAY,EACV,cAAc,EACd,aAAa,EACb,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM/C,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;gBAEtC,MAAM,GAAE,cAAmB;IAevC;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;CAS3E;AAED,eAAe,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,cAAc,iBAAiB,CAAC;AAEhC,YAAY,EACV,cAAc,EACd,aAAa,EACb,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,sBAAsB,EACtB,wBAAwB,EACxB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAM/C,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;gBAEtC,MAAM,GAAE,cAAmB;IAevC;;;;;OAKG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,aAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;CAS3E;AAED,eAAe,QAAQ,CAAC"}
package/dist/index.js CHANGED
@@ -27,6 +27,8 @@ export * from "@codespar/types";
27
27
  export { SessionConfigSchema } from "./types.js";
28
28
  export { loop } from "./loop.js";
29
29
  export { tools, findTools } from "./tools.js";
30
+ export { CodesparApiError } from "./errors.js";
31
+ export { TOOL_RESULT_CODES, ToolResultCode, assertExhaustiveToolResult, isApprovalRequired, isMocksEngineError, isMocksExhausted, isPolicyDenied, isToolNotMocked, } from "./tool-result-codes.js";
30
32
  import { SessionConfigSchema } from "./types.js";
31
33
  import { createSession } from "./session.js";
32
34
  const DEFAULT_BASE_URL = "https://api.codespar.dev";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,cAAc,iBAAiB,CAAC;AAWhC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD,MAAM,OAAO,QAAQ;IACF,MAAM,CAA2B;IAElD,YAAY,SAAyB,EAAE;QACrC,IAAI,CAAC,MAAM,GAAG;YACZ,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE;YAC3D,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,gBAAgB;YAC5E,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;SAClC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,yFAAyF;gBACvF,sEAAsE,CACzE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,SAAwB,EAAE;QACrD,mBAAmB,CA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OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,gBAAgB;YAC5E,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,EAAE;SAClC,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,yFAAyF;gBACvF,sEAAsE,CACzE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,SAAwB,EAAE;QACrD,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC;QACzE,OAAO,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;YACnC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO;YAC5B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;YAC1B,SAAS,EAAE,SAAS,IAAI,SAAS;SAClC,CAAC,CAAC;IACL,CAAC;CACF;AAED,eAAe,QAAQ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAQ,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EACV,OAAO,EAsBR,MAAM,iBAAiB,CAAC;AAEzB,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoBD,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,OAAO,CAAC,CAkWlB"}
1
+ {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAQ,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EACV,OAAO,EA4BR,MAAM,iBAAiB,CAAC;AAEzB,UAAU,WAAW;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAoCD,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,WAAW,GAChB,OAAO,CAAC,OAAO,CAAC,CAodlB"}