@smithers-orchestrator/errors 0.21.0 → 0.22.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithers-orchestrator/errors",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Error types, tagged errors, and error utilities for Smithers",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -1,12 +1,18 @@
1
-
1
+ import { isKnownSmithersErrorCode } from "./isKnownSmithersErrorCode.js";
2
+ import { SmithersError } from "./SmithersError.js";
2
3
  /** @typedef {import("./SmithersError.js").SmithersError} SmithersError */
3
4
  /**
4
5
  * @param {unknown} value
5
6
  * @returns {value is SmithersError}
6
7
  */
7
8
  export function isSmithersError(value) {
9
+ if (value instanceof SmithersError) {
10
+ return true;
11
+ }
8
12
  return Boolean(value &&
9
13
  typeof value === "object" &&
10
14
  "code" in value &&
15
+ typeof (/** @type {{ code?: unknown }} */ (value).code) === "string" &&
16
+ isKnownSmithersErrorCode(/** @type {{ code: string }} */ (value).code) &&
11
17
  "message" in value);
12
18
  }
@@ -53,6 +53,26 @@ export const smithersErrorDefinitions = {
53
53
  when: "A task requests auto-hijack but its agent cannot provide a resumable session or conversation.",
54
54
  details: "{ nodeId, agentId? }",
55
55
  },
56
+ TASK_FORK_SOURCE_NOT_FOUND: {
57
+ category: "components",
58
+ when: "A <Task fork> references a source task id that is not present in the workflow graph (including a source that exists only in an unselected branch).",
59
+ details: "{ nodeId, forkSource }",
60
+ },
61
+ TASK_FORK_SOURCE_NOT_COMPLETE: {
62
+ category: "engine",
63
+ when: "A forked task began executing but its fork source has not completed, so no session snapshot exists yet.",
64
+ details: "{ nodeId, forkSource }",
65
+ },
66
+ TASK_FORK_SESSION_UNAVAILABLE: {
67
+ category: "engine",
68
+ when: "A <Task fork> cannot obtain a usable agent session snapshot — the forking task is not an agent task, or the source completed without producing a forkable conversation (e.g. a compute/static, skipped, or cancelled source).",
69
+ details: "{ nodeId, forkSource }",
70
+ },
71
+ TASK_FORK_CYCLE: {
72
+ category: "components",
73
+ when: "A <Task fork> introduces a dependency cycle, directly or indirectly.",
74
+ details: "{ nodeId, forkSource }",
75
+ },
56
76
  RUN_NOT_FOUND: {
57
77
  category: "engine",
58
78
  when: "A CLI or engine command references a run ID that does not exist in the database.",