@cat-factory/orchestration 0.232.1 → 0.234.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 (41) hide show
  1. package/dist/modules/execution/AgentContextBuilder.d.ts +6 -0
  2. package/dist/modules/execution/AgentContextBuilder.d.ts.map +1 -1
  3. package/dist/modules/execution/AgentContextBuilder.js +20 -14
  4. package/dist/modules/execution/AgentContextBuilder.js.map +1 -1
  5. package/dist/modules/execution/PollRunningController.d.ts.map +1 -1
  6. package/dist/modules/execution/PollRunningController.js +7 -0
  7. package/dist/modules/execution/PollRunningController.js.map +1 -1
  8. package/dist/modules/execution/RunDispatcher.d.ts.map +1 -1
  9. package/dist/modules/execution/RunDispatcher.js +10 -27
  10. package/dist/modules/execution/RunDispatcher.js.map +1 -1
  11. package/dist/modules/execution/builder-context-files.d.ts +15 -0
  12. package/dist/modules/execution/builder-context-files.d.ts.map +1 -1
  13. package/dist/modules/execution/builder-context-files.js +24 -4
  14. package/dist/modules/execution/builder-context-files.js.map +1 -1
  15. package/dist/modules/execution/builder-step-observations.d.ts +18 -1
  16. package/dist/modules/execution/builder-step-observations.d.ts.map +1 -1
  17. package/dist/modules/execution/builder-step-observations.js +19 -0
  18. package/dist/modules/execution/builder-step-observations.js.map +1 -1
  19. package/dist/modules/execution/linked-context.d.ts +16 -3
  20. package/dist/modules/execution/linked-context.d.ts.map +1 -1
  21. package/dist/modules/execution/linked-context.js +1 -0
  22. package/dist/modules/execution/linked-context.js.map +1 -1
  23. package/dist/modules/execution/prReport.context.d.ts +24 -0
  24. package/dist/modules/execution/prReport.context.d.ts.map +1 -0
  25. package/dist/modules/execution/prReport.context.js +152 -0
  26. package/dist/modules/execution/prReport.context.js.map +1 -0
  27. package/dist/modules/execution/prReport.logic.d.ts.map +1 -1
  28. package/dist/modules/execution/prReport.logic.js +8 -0
  29. package/dist/modules/execution/prReport.logic.js.map +1 -1
  30. package/dist/modules/execution/runOutcome.boundary.d.ts.map +1 -1
  31. package/dist/modules/execution/runOutcome.boundary.js +30 -0
  32. package/dist/modules/execution/runOutcome.boundary.js.map +1 -1
  33. package/dist/modules/execution/step-fold.logic.d.ts +21 -0
  34. package/dist/modules/execution/step-fold.logic.d.ts.map +1 -1
  35. package/dist/modules/execution/step-fold.logic.js +31 -0
  36. package/dist/modules/execution/step-fold.logic.js.map +1 -1
  37. package/dist/modules/execution/toolServers.logic.d.ts +35 -0
  38. package/dist/modules/execution/toolServers.logic.d.ts.map +1 -0
  39. package/dist/modules/execution/toolServers.logic.js +99 -0
  40. package/dist/modules/execution/toolServers.logic.js.map +1 -0
  41. package/package.json +11 -11
@@ -41,6 +41,12 @@ const MAX_TEXT_CHARS = 2_000;
41
41
  const MAX_REQUIREMENT_ENTRIES = 500;
42
42
  /** How many tester areas and concerns one response carries. Same reasoning as the rows. */
43
43
  const MAX_TESTER_LIST = 200;
44
+ /**
45
+ * How many linked-source rows one response carries. A task links a handful of pages; the cap is
46
+ * the same pathological ceiling the rows above are, and the run's own reading ORDER is what a cap
47
+ * keeps, so the note needs no ordering caveat.
48
+ */
49
+ const MAX_SOURCE_ROWS = 200;
44
50
  /** Scrub, then clamp. Null in, null out: an absent value is not an empty one. */
45
51
  function text(value) {
46
52
  const scrubbed = redactSecrets(value) ?? null;
@@ -127,6 +133,29 @@ function boundVisuals(visuals) {
127
133
  })),
128
134
  };
129
135
  }
136
+ function boundSources(sources, truncations) {
137
+ if (sources.status === 'absent')
138
+ return sources;
139
+ return {
140
+ status: 'reported',
141
+ sources: cap(sources.sources, 'sources', truncations, MAX_SOURCE_ROWS).map((source) => ({
142
+ // Title and URL are authored on the SOURCE, by whoever owns the page, so they are the same
143
+ // untrusted text the verification report scrubs before writing this row onto a PR body. A
144
+ // document URL routinely carries a query string, which is where a share token would ride.
145
+ title: required(source.title),
146
+ url: text(source.url),
147
+ origin: source.origin,
148
+ // `version` is the source's own opaque revision token (a Figma file version, a git sha):
149
+ // short, machine-shaped, and the one field a reviewer opens the source WITH, so it is
150
+ // scrubbed like any other source-supplied string but never clamped away. The rest of the
151
+ // variant is a closed vocabulary.
152
+ freshness: source.freshness?.status === 'confirmed'
153
+ ? { ...source.freshness, version: required(source.freshness.version) }
154
+ : source.freshness,
155
+ movedDuringRun: source.movedDuringRun,
156
+ })),
157
+ };
158
+ }
130
159
  /**
131
160
  * The outcome summary as a public response body: scrubbed, clamped, bounded, and honest about
132
161
  * every drop.
@@ -151,6 +180,7 @@ export function boundOutcomeForApi(outcome) {
151
180
  requirements: boundRequirements(outcome.requirements, truncations),
152
181
  tests: boundTests(outcome.tests, truncations),
153
182
  visuals: boundVisuals(outcome.visuals),
183
+ sources: boundSources(outcome.sources, truncations),
154
184
  // A closed vocabulary of enum members and one nullable enum: nothing here is authored text.
155
185
  checks: outcome.checks.map((check) => ({
156
186
  kind: check.kind,
@@ -1 +1 @@
1
- {"version":3,"file":"runOutcome.boundary.js","sourceRoot":"","sources":["../../../src/modules/execution/runOutcome.boundary.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,8EAA8E;AAC9E,yEAAyE;AACzE,qCAAqC;AACrC,EAAE;AACF,0FAA0F;AAC1F,8FAA8F;AAC9F,8FAA8F;AAC9F,iGAAiG;AACjG,gGAAgG;AAChG,gGAAgG;AAChG,8FAA8F;AAC9F,+FAA+F;AAC/F,sEAAsE;AACtE,EAAE;AACF,qEAAqE;AACrE,EAAE;AACF,gGAAgG;AAChG,iGAAiG;AACjG,kEAAkE;AAClE,gGAAgG;AAChG,yFAAyF;AACzF,8CAA8C;AAC9C,EAAE;AACF,4FAA4F;AAC5F,+FAA+F;AAC/F,8CAA8C;AAC9C,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,cAAc,GAAG,KAAK,CAAA;AAE5B;;;;GAIG;AACH,MAAM,uBAAuB,GAAG,GAAG,CAAA;AAEnC,2FAA2F;AAC3F,MAAM,eAAe,GAAG,GAAG,CAAA;AAE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O,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC;QAC9B,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9C,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC;YACrB,MAAM,EAAE,EAAE,CAAC,MAAM;YACjB,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;YACvB,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC;SACpB,CAAC,CAAC;QACH,YAAY,EAAE,iBAAiB,CAAC,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC;QAClE,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,CAAC;QAC7C,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC;QACtC,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,WAAW,CAAC;QACnD,4FAA4F;QAC5F,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACrC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC,CAAC;QACH,WAAW;KACZ,CAAA;AACH,CAAC"}
@@ -1,4 +1,25 @@
1
1
  import { type AgentJobHandle, type PipelineStep } from '@cat-factory/kernel';
2
+ /**
3
+ * Rebuild the job handle a settled/running POLL addresses, from the step alone.
4
+ *
5
+ * The exact counterpart of {@link recordDispatchAttribution}, and here for the same reason it is:
6
+ * the poll site has no dispatch in scope, so everything the executor needs off the handle has to
7
+ * be read back from what the dispatch persisted. Each field is load-bearing on the container
8
+ * executor:
9
+ *
10
+ * - `agentKind` — `toRunResult` maps a migrated `merger`/`on-call`'s structured result into
11
+ * `mergeAssessment`/`onCallAssessment` KIND-AWARE, so without it the coercion no-ops and the
12
+ * merge gate / post-release-health gate see no assessment at all;
13
+ * - `runId` — the executor addresses the same per-run container; the step stored only a job id;
14
+ * - `model` — absent, `recordStepResult` records 'unknown', which `SpendService.parseModel`
15
+ * splits into provider "unknown" / model "", corrupting the `token_usage` row of EVERY
16
+ * subscription-harness step;
17
+ * - `subscriptionTokenId` — gates the pooled-token usage feedback that drives usage-aware
18
+ * rotation; absent, it is skipped outright;
19
+ * - `initiatedByUserId` — the quota-cycle counters' fallback target for a PERSONAL
20
+ * (individual-usage) run, which leases no pooled token; absent, the target is null.
21
+ */
22
+ export declare function pollHandleFor(step: PipelineStep, workspaceId: string, executionId: string): AgentJobHandle;
2
23
  /**
3
24
  * Persist the attribution a DISPATCH knows and the poll site cannot re-derive: the resolved
4
25
  * model, plus (for a subscription-harness job) the leased pool row and the run's initiator,
@@ -1 +1 @@
1
- {"version":3,"file":"step-fold.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/step-fold.logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAY1F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,GACrB,IAAI,CAwBN;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACpE,OAAO,CAkBT;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,GAC/B,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI3F"}
1
+ {"version":3,"file":"step-fold.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/step-fold.logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAY1F;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,cAAc,CAUhB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,cAAc,EACtB,cAAc,EAAE,MAAM,GACrB,IAAI,CAwBN;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACpE,OAAO,CAkBT;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,GAC/B,OAAO,CAKT;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAI3F"}
@@ -8,6 +8,37 @@ import { shouldPersistActivity } from './job.logic.js';
8
8
  // one because it also parses the harness payload). {@link recordDispatchAttribution} is the one
9
9
  // member folding a DISPATCH rather than a poll — it lives here because every dispatch site needs
10
10
  // it and it is the exact counterpart the poll site reads back.
11
+ /**
12
+ * Rebuild the job handle a settled/running POLL addresses, from the step alone.
13
+ *
14
+ * The exact counterpart of {@link recordDispatchAttribution}, and here for the same reason it is:
15
+ * the poll site has no dispatch in scope, so everything the executor needs off the handle has to
16
+ * be read back from what the dispatch persisted. Each field is load-bearing on the container
17
+ * executor:
18
+ *
19
+ * - `agentKind` — `toRunResult` maps a migrated `merger`/`on-call`'s structured result into
20
+ * `mergeAssessment`/`onCallAssessment` KIND-AWARE, so without it the coercion no-ops and the
21
+ * merge gate / post-release-health gate see no assessment at all;
22
+ * - `runId` — the executor addresses the same per-run container; the step stored only a job id;
23
+ * - `model` — absent, `recordStepResult` records 'unknown', which `SpendService.parseModel`
24
+ * splits into provider "unknown" / model "", corrupting the `token_usage` row of EVERY
25
+ * subscription-harness step;
26
+ * - `subscriptionTokenId` — gates the pooled-token usage feedback that drives usage-aware
27
+ * rotation; absent, it is skipped outright;
28
+ * - `initiatedByUserId` — the quota-cycle counters' fallback target for a PERSONAL
29
+ * (individual-usage) run, which leases no pooled token; absent, the target is null.
30
+ */
31
+ export function pollHandleFor(step, workspaceId, executionId) {
32
+ return {
33
+ jobId: step.jobId,
34
+ runId: executionId,
35
+ workspaceId,
36
+ agentKind: step.agentKind,
37
+ model: step.model,
38
+ subscriptionTokenId: step.subscriptionTokenId,
39
+ initiatedByUserId: step.initiatedByUserId,
40
+ };
41
+ }
11
42
  /**
12
43
  * Persist the attribution a DISPATCH knows and the poll site cannot re-derive: the resolved
13
44
  * model, plus (for a subscription-harness job) the leased pool row and the run's initiator,
@@ -1 +1 @@
1
- {"version":3,"file":"step-fold.logic.js","sourceRoot":"","sources":["../../../src/modules/execution/step-fold.logic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA0C,MAAM,qBAAqB,CAAA;AAC1F,OAAO,EAAE,q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AAC;QAAE,OAAO,KAAK,CAAA;IACvE,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAA;IAC9B,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { ObservedToolServer } from '@cat-factory/contracts';
2
+ import type { PipelineStep } from '@cat-factory/kernel';
3
+ /**
4
+ * Fold the CLI's tool-server startup report onto a step, returning whether anything changed.
5
+ *
6
+ * Applied on all three poll paths for the same reason `applyValidationReport` is, plus one of its
7
+ * own: the CLI announces its servers ONCE, near the start of the run, so a job that settles
8
+ * between two polls is never seen `running` and only its terminal poll can deliver the report.
9
+ *
10
+ * Two guards that are load-bearing rather than defensive:
11
+ *
12
+ * - it REFUSES to create the record. `step.toolServers` is written at dispatch and carries the
13
+ * `agentKind` the lists belong to; minting one here would produce a record with no kind (or a
14
+ * guessed one) describing servers nobody can attribute. A step with no dispatch record has
15
+ * nothing for an observation to be beside, and an observation with nothing to compare against
16
+ * is not the missing half of anything.
17
+ * - an unreadable or EMPTY payload leaves the step untouched rather than writing `[]`. Absent
18
+ * means "not observed" on this field, and the harness never publishes an empty list, so an
19
+ * empty one here is a producer this code does not understand — writing it through would turn
20
+ * "we did not look" into "we looked and the CLI loaded nothing", which is the one reading that
21
+ * would send an operator after a healthy server.
22
+ */
23
+ export declare function applyObservedToolServers(step: PipelineStep, raw: unknown): boolean;
24
+ /**
25
+ * Parse a harness observation defensively; `null` for absent, unparseable or empty payloads.
26
+ *
27
+ * Entries are validated INDIVIDUALLY and a malformed one is dropped rather than failing the whole
28
+ * report: the rows are independent facts about independent servers, so one row this image cannot
29
+ * read is no reason to discard what the CLI said about the others. A status outside the closed
30
+ * vocabulary becomes `unknown` rather than dropping the row, for the reason the vocabulary
31
+ * documents — the CLI's status words are a third party's, and a server whose state cannot be named
32
+ * is still a server the CLI knew about.
33
+ */
34
+ export declare function coerceObservedToolServers(raw: unknown): ObservedToolServer[] | null;
35
+ //# sourceMappingURL=toolServers.logic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolServers.logic.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/toolServers.logic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAA4B,MAAM,wBAAwB,CAAA;AAE1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAYvD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAQlF;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,EAAE,GAAG,IAAI,CAuBnF"}
@@ -0,0 +1,99 @@
1
+ import { isToolServerObservedStatus } from '@cat-factory/contracts';
2
+ // Pure helpers for the OBSERVED half of a step's tool-server record: what the agent's CLI
3
+ // reported about the servers it loaded, folded onto the record the dispatch already wrote.
4
+ //
5
+ // The dispatch half (`recordDispatchAttribution` → `step.toolServers.wired`/`unavailable`) is the
6
+ // PLATFORM's account: what it promised the agent and what it deliberately withheld. This is the
7
+ // CLI's account of what it managed to start, and it is the only source for the failure mode the
8
+ // platform's half structurally cannot see — a server that passed every check and then failed to
9
+ // come up in the container. NO repository access, and nothing here is a control signal: no run
10
+ // behaviour branches on an observation.
11
+ /**
12
+ * Fold the CLI's tool-server startup report onto a step, returning whether anything changed.
13
+ *
14
+ * Applied on all three poll paths for the same reason `applyValidationReport` is, plus one of its
15
+ * own: the CLI announces its servers ONCE, near the start of the run, so a job that settles
16
+ * between two polls is never seen `running` and only its terminal poll can deliver the report.
17
+ *
18
+ * Two guards that are load-bearing rather than defensive:
19
+ *
20
+ * - it REFUSES to create the record. `step.toolServers` is written at dispatch and carries the
21
+ * `agentKind` the lists belong to; minting one here would produce a record with no kind (or a
22
+ * guessed one) describing servers nobody can attribute. A step with no dispatch record has
23
+ * nothing for an observation to be beside, and an observation with nothing to compare against
24
+ * is not the missing half of anything.
25
+ * - an unreadable or EMPTY payload leaves the step untouched rather than writing `[]`. Absent
26
+ * means "not observed" on this field, and the harness never publishes an empty list, so an
27
+ * empty one here is a producer this code does not understand — writing it through would turn
28
+ * "we did not look" into "we looked and the CLI loaded nothing", which is the one reading that
29
+ * would send an operator after a healthy server.
30
+ */
31
+ export function applyObservedToolServers(step, raw) {
32
+ const record = step.toolServers;
33
+ if (!record)
34
+ return false;
35
+ const observed = coerceObservedToolServers(raw);
36
+ if (!observed)
37
+ return false;
38
+ if (sameObservation(record.observed, observed))
39
+ return false;
40
+ step.toolServers = { ...record, observed };
41
+ return true;
42
+ }
43
+ /**
44
+ * Parse a harness observation defensively; `null` for absent, unparseable or empty payloads.
45
+ *
46
+ * Entries are validated INDIVIDUALLY and a malformed one is dropped rather than failing the whole
47
+ * report: the rows are independent facts about independent servers, so one row this image cannot
48
+ * read is no reason to discard what the CLI said about the others. A status outside the closed
49
+ * vocabulary becomes `unknown` rather than dropping the row, for the reason the vocabulary
50
+ * documents — the CLI's status words are a third party's, and a server whose state cannot be named
51
+ * is still a server the CLI knew about.
52
+ */
53
+ export function coerceObservedToolServers(raw) {
54
+ if (!Array.isArray(raw))
55
+ return null;
56
+ const observed = [];
57
+ const seen = new Set();
58
+ for (const entry of raw) {
59
+ if (typeof entry !== 'object' || entry === null)
60
+ continue;
61
+ const record = entry;
62
+ const id = record.id;
63
+ if (typeof id !== 'string' || id === '' || seen.has(id))
64
+ continue;
65
+ seen.add(id);
66
+ const toolCount = record.toolCount;
67
+ observed.push({
68
+ id,
69
+ status: coerceObservedStatus(record.status),
70
+ // Guarded on the NUMBER rather than on truthiness: `0` is a server that connected and
71
+ // exposed nothing, which is the single most useful count on this field and the one a
72
+ // truthiness check would silently turn into "not counted".
73
+ ...(typeof toolCount === 'number' && Number.isFinite(toolCount) && toolCount >= 0
74
+ ? { toolCount }
75
+ : {}),
76
+ });
77
+ }
78
+ return observed.length ? observed : null;
79
+ }
80
+ /** Narrow a reported status onto the closed vocabulary, defaulting to `unknown`. */
81
+ function coerceObservedStatus(raw) {
82
+ return isToolServerObservedStatus(raw) ? raw : 'unknown';
83
+ }
84
+ /**
85
+ * Whether an incoming observation says the same thing as the one already recorded, so an idle
86
+ * poll re-offering the CLI's one announcement does not churn storage or the event stream. Ordered
87
+ * comparison, because the producer emits the CLI's own order and re-emits it unchanged.
88
+ */
89
+ function sameObservation(previous, next) {
90
+ if (!previous || previous.length !== next.length)
91
+ return false;
92
+ return previous.every((server, index) => {
93
+ const other = next[index];
94
+ return (server.id === other.id &&
95
+ server.status === other.status &&
96
+ server.toolCount === other.toolCount);
97
+ });
98
+ }
99
+ //# sourceMappingURL=toolServers.logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolServers.logic.js","sourceRoot":"","sources":["../../../src/modules/execution/toolServers.logic.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAA;AAGnE,0FAA0F;AAC1F,2FAA2F;AAC3F,EAAE;AACF,kGAAkG;AAClG,gGAAgG;AAChG,gGAAgG;AAChG,gGAAgG;AAChG,+FAA+F;AAC/F,wCAAwC;AAExC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAwB,CAAC,IAAkB,EAAE,GAAY;IACvE,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAA;IAC/B,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IACzB,MAAM,QAAQ,GAAG,yBAAyB,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3B,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAA;IAC5D,IAAI,CAAC,WAAW,GAAG,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,CAAA;IAC1C,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;;;;;GASG;AACH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;GAIG;AACH,SAAS,eAAe,CACtB,QAAmD,EACnD,IAAmC;IAEnC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAC9D,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAE,CAAA;QAC1B,OAAO,CACL,MAAM,CAAC,EAAE,KAAK,KAAK,CAAC,EAAE;YACtB,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;YAC9B,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS,CACrC,CAAA;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/orchestration",
3
- "version": "0.232.1",
3
+ "version": "0.234.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": "^7.0.51",
28
- "@cat-factory/agents": "0.117.3",
29
- "@cat-factory/caching": "0.18.4",
30
- "@cat-factory/contracts": "0.265.0",
31
- "@cat-factory/integrations": "0.142.0",
32
- "@cat-factory/kernel": "0.263.0",
33
- "@cat-factory/prompt-fragments": "1.0.13",
34
- "@cat-factory/sandbox": "0.11.90",
35
- "@cat-factory/spend": "0.15.31",
36
- "@cat-factory/workspaces": "0.26.3"
28
+ "@cat-factory/agents": "0.117.5",
29
+ "@cat-factory/caching": "0.18.6",
30
+ "@cat-factory/contracts": "0.267.0",
31
+ "@cat-factory/integrations": "0.143.1",
32
+ "@cat-factory/kernel": "0.265.0",
33
+ "@cat-factory/prompt-fragments": "1.0.15",
34
+ "@cat-factory/sandbox": "0.11.92",
35
+ "@cat-factory/spend": "0.15.33",
36
+ "@cat-factory/workspaces": "0.26.5"
37
37
  },
38
38
  "devDependencies": {
39
39
  "typescript": "7.0.2",
40
40
  "vitest": "^4.1.10",
41
- "@cat-factory/sandbox-fixtures": "0.7.300"
41
+ "@cat-factory/sandbox-fixtures": "0.7.302"
42
42
  },
43
43
  "scripts": {
44
44
  "build": "tsc -b tsconfig.build.json",