@cat-factory/orchestration 0.105.5 → 0.106.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.
Files changed (32) hide show
  1. package/dist/container.d.ts.map +1 -1
  2. package/dist/container.js +25 -0
  3. package/dist/container.js.map +1 -1
  4. package/dist/modules/execution/AgentContextBuilder.d.ts +9 -0
  5. package/dist/modules/execution/AgentContextBuilder.d.ts.map +1 -1
  6. package/dist/modules/execution/AgentContextBuilder.js +15 -0
  7. package/dist/modules/execution/AgentContextBuilder.js.map +1 -1
  8. package/dist/modules/execution/ExecutionService.d.ts +12 -2
  9. package/dist/modules/execution/ExecutionService.d.ts.map +1 -1
  10. package/dist/modules/execution/ExecutionService.js +16 -2
  11. package/dist/modules/execution/ExecutionService.js.map +1 -1
  12. package/dist/modules/execution/ForkChatService.d.ts +40 -0
  13. package/dist/modules/execution/ForkChatService.d.ts.map +1 -0
  14. package/dist/modules/execution/ForkChatService.js +74 -0
  15. package/dist/modules/execution/ForkChatService.js.map +1 -0
  16. package/dist/modules/execution/ForkDecisionController.d.ts +35 -1
  17. package/dist/modules/execution/ForkDecisionController.d.ts.map +1 -1
  18. package/dist/modules/execution/ForkDecisionController.js +107 -1
  19. package/dist/modules/execution/ForkDecisionController.js.map +1 -1
  20. package/dist/modules/execution/RunDispatcher.d.ts +3 -1
  21. package/dist/modules/execution/RunDispatcher.d.ts.map +1 -1
  22. package/dist/modules/execution/RunDispatcher.js +20 -14
  23. package/dist/modules/execution/RunDispatcher.js.map +1 -1
  24. package/dist/modules/execution/forkDecision.logic.d.ts +12 -3
  25. package/dist/modules/execution/forkDecision.logic.d.ts.map +1 -1
  26. package/dist/modules/execution/forkDecision.logic.js +17 -2
  27. package/dist/modules/execution/forkDecision.logic.js.map +1 -1
  28. package/dist/modules/execution/job.logic.d.ts +28 -0
  29. package/dist/modules/execution/job.logic.d.ts.map +1 -1
  30. package/dist/modules/execution/job.logic.js +33 -0
  31. package/dist/modules/execution/job.logic.js.map +1 -1
  32. package/package.json +11 -11
@@ -1,3 +1,4 @@
1
+ import { DomainError, getErrorMessage } from '@cat-factory/kernel';
1
2
  /**
2
3
  * Maximum number of times a step's *crash* eviction (OOM / a genuine crash) is
3
4
  * recovered automatically by re-dispatching a fresh container for the same step.
@@ -42,6 +43,38 @@ export const TRANSIENT_EVICTION_MARKER = 'transient infrastructure eviction';
42
43
  export function isContainerEvictionError(error) {
43
44
  return error !== undefined && /evicted or crashed/i.test(error);
44
45
  }
46
+ /**
47
+ * Classify a throw from an async agent dispatch (`startJob`) into a terminal failure. The
48
+ * dispatch catch used to assume EVERY throw was the container failing to accept the job, but a
49
+ * job is also built (auth, repo target, context) BEFORE any container is contacted — so a
50
+ * precondition can reject it up front. Three cases, most-specific first:
51
+ *
52
+ * - A domain PRECONDITION error (any {@link DomainError}, e.g. the `github_not_connected`
53
+ * `ConflictError` raised while building the job because the workspace has no connected repo)
54
+ * was rejected before dispatch. That is a `preflight` failure, not a container `dispatch`
55
+ * blip: surface its own actionable message and propagate its machine-readable `reason` so
56
+ * the SPA renders precise guidance ("GitHub not connected") instead of the misleading
57
+ * "container failed to start".
58
+ * - A container eviction/crash routes to `evicted` (a fresh-container retry may help).
59
+ * - Anything else is a genuine container accept failure (`dispatch`): the container/runner
60
+ * never accepted the job (an HTTP/network error, a capacity blip).
61
+ */
62
+ export function classifyDispatchFailure(error) {
63
+ const message = getErrorMessage(error);
64
+ if (error instanceof DomainError) {
65
+ const reason = error.details?.reason;
66
+ return {
67
+ error: message,
68
+ failureKind: 'preflight',
69
+ detail: message,
70
+ reason: typeof reason === 'string' ? reason : undefined,
71
+ };
72
+ }
73
+ if (isContainerEvictionError(message)) {
74
+ return { error: message, failureKind: 'evicted', detail: message };
75
+ }
76
+ return { error: 'The container failed to start.', failureKind: 'dispatch', detail: message };
77
+ }
45
78
  /**
46
79
  * Whether a container eviction was flagged by the runtime facade as *transient
47
80
  * infrastructure churn* (the facade tagged it with {@link TRANSIENT_EVICTION_MARKER})
@@ -1 +1 @@
1
- {"version":3,"file":"job.logic.js","sourceRoot":"","sources":["../../../src/modules/execution/job.logic.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAExC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAA;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAA;AAE5E;;;;;;;;;GASG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAyB;IAChE,OAAO,KAAK,KAAK,SAAS,IAAI,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAyB;IAC3D,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,QAAQ,CAAC,yBAAyB,CAAC,CAAA;AACzE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAyB;IACjE,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,oBAAoB,CAAC;QAC1B,KAAK,cAAc;YACjB,OAAO,SAAS,CAAA;QAClB,KAAK,OAAO,CAAC;QACb,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,kBAAkB,CAAC;QACxB,KAAK,YAAY;YACf,OAAO,OAAO,CAAA;QAChB;YACE,OAAO,SAAS,CAAA;IACpB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAC5D,IAAI,KAAK,IAAI,4CAA4C,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACvF,OAAO,OAAO,CAAA;AAChB,CAAC"}
1
+ {"version":3,"file":"job.logic.js","sourceRoot":"","sources":["../../../src/modules/execution/job.logic.ts"],"names":[],"mappings":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,yBAAyB,CAAC,CAAA;AACzE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAyB;IACjE,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,oBAAoB,CAAC;QAC1B,KAAK,cAAc;YACjB,OAAO,SAAS,CAAA;QAClB,KAAK,OAAO,CAAC;QACb,KAAK,KAAK,CAAC;QACX,KAAK,KAAK,CAAC;QACX,KAAK,kBAAkB,CAAC;QACxB,KAAK,YAAY;YACf,OAAO,OAAO,CAAA;QAChB;YACE,OAAO,SAAS,CAAA;IACpB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAyB;IAC5D,IAAI,KAAK,IAAI,4CAA4C,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IACvF,OAAO,OAAO,CAAA;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/orchestration",
3
- "version": "0.105.5",
3
+ "version": "0.106.0",
4
4
  "description": "Delivery-workflow engine for the Agent Architecture Board (execution, bootstrap, pipelines, board, boardScan, requirements, and composition root).",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,20 +25,20 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "ai": "^6.0.219",
28
- "@cat-factory/agents": "0.53.5",
29
- "@cat-factory/caching": "0.6.33",
30
- "@cat-factory/contracts": "0.126.0",
31
- "@cat-factory/integrations": "0.81.4",
32
- "@cat-factory/kernel": "0.121.0",
33
- "@cat-factory/prompt-fragments": "0.13.12",
34
- "@cat-factory/sandbox": "0.9.64",
35
- "@cat-factory/spend": "0.12.14",
36
- "@cat-factory/workspaces": "0.13.25"
28
+ "@cat-factory/agents": "0.54.0",
29
+ "@cat-factory/caching": "0.6.35",
30
+ "@cat-factory/contracts": "0.127.0",
31
+ "@cat-factory/integrations": "0.81.6",
32
+ "@cat-factory/kernel": "0.121.2",
33
+ "@cat-factory/prompt-fragments": "0.13.13",
34
+ "@cat-factory/sandbox": "0.9.66",
35
+ "@cat-factory/spend": "0.12.16",
36
+ "@cat-factory/workspaces": "0.13.27"
37
37
  },
38
38
  "devDependencies": {
39
39
  "typescript": "7.0.1-rc",
40
40
  "vitest": "^4.1.9",
41
- "@cat-factory/sandbox-fixtures": "0.7.147"
41
+ "@cat-factory/sandbox-fixtures": "0.7.148"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsc -b tsconfig.build.json",