@crewhaus/recovery-engine 0.1.1 → 0.1.3

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/package.json +6 -11
  2. package/src/index.test.ts +25 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewhaus/recovery-engine",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "description": "Pure recovery taxonomy: classify Anthropic API errors into a RecoveryAction (compact/retry/continue/tombstone/fail)",
6
6
  "main": "src/index.ts",
@@ -12,13 +12,13 @@
12
12
  "test": "bun test src"
13
13
  },
14
14
  "dependencies": {
15
- "@crewhaus/errors": "0.1.1"
15
+ "@crewhaus/errors": "0.1.3"
16
16
  },
17
17
  "license": "Apache-2.0",
18
18
  "author": {
19
19
  "name": "Max Meier",
20
- "email": "max@studiomax.io",
21
- "url": "https://studiomax.io"
20
+ "email": "max@crewhaus.ai",
21
+ "url": "https://crewhaus.ai"
22
22
  },
23
23
  "repository": {
24
24
  "type": "git",
@@ -30,12 +30,7 @@
30
30
  "url": "https://github.com/crewhaus/factory/issues"
31
31
  },
32
32
  "publishConfig": {
33
- "access": "restricted"
33
+ "access": "public"
34
34
  },
35
- "files": [
36
- "src",
37
- "README.md",
38
- "LICENSE",
39
- "NOTICE"
40
- ]
35
+ "files": ["src", "README.md", "LICENSE", "NOTICE"]
41
36
  }
package/src/index.test.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  BUDGETS,
6
6
  type NamedFailureClass,
7
7
  type RecoveryAction,
8
+ RecoveryEngineError,
8
9
  advanceState,
9
10
  backoffMs,
10
11
  classify,
@@ -287,3 +288,27 @@ describe("Track A — named failure taxonomy", () => {
287
288
  expect(matchNamedFailure({ message: "anything" }, badTaxonomy)).toBeUndefined();
288
289
  });
289
290
  });
291
+
292
+ describe("RecoveryEngineError", () => {
293
+ test("carries the 'runtime' code and the RecoveryEngineError name", () => {
294
+ const err = new RecoveryEngineError("boom");
295
+ expect(err).toBeInstanceOf(RecoveryEngineError);
296
+ expect(err).toBeInstanceOf(Error);
297
+ expect(err.name).toBe("RecoveryEngineError");
298
+ expect(err.code).toBe("runtime");
299
+ expect(err.message).toBe("boom");
300
+ });
301
+
302
+ test("preserves the underlying cause chain", () => {
303
+ const cause = new Error("upstream");
304
+ const err = new RecoveryEngineError("wrapped", cause);
305
+ expect(err.cause).toBe(cause);
306
+ // toJSON (inherited from CrewhausError) serializes the cause for logging.
307
+ expect(err.toJSON()).toEqual({
308
+ name: "RecoveryEngineError",
309
+ code: "runtime",
310
+ message: "wrapped",
311
+ cause: { name: "Error", message: "upstream" },
312
+ });
313
+ });
314
+ });