@pellux/goodvibes-sdk 0.34.0 → 0.34.2

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 (195) hide show
  1. package/dist/contracts/artifacts/operator-contract.json +1 -1
  2. package/dist/events/workflows.d.ts +4 -0
  3. package/dist/events/workflows.d.ts.map +1 -1
  4. package/dist/platform/agents/message-bus-core.d.ts +11 -0
  5. package/dist/platform/agents/message-bus-core.d.ts.map +1 -1
  6. package/dist/platform/agents/message-bus-core.js +28 -21
  7. package/dist/platform/agents/orchestrator-runner.d.ts.map +1 -1
  8. package/dist/platform/agents/orchestrator-runner.js +6 -4
  9. package/dist/platform/agents/wrfc-config.d.ts.map +1 -1
  10. package/dist/platform/agents/wrfc-config.js +16 -10
  11. package/dist/platform/agents/wrfc-controller.d.ts +26 -0
  12. package/dist/platform/agents/wrfc-controller.d.ts.map +1 -1
  13. package/dist/platform/agents/wrfc-controller.js +134 -138
  14. package/dist/platform/agents/wrfc-runtime-events.d.ts +1 -0
  15. package/dist/platform/agents/wrfc-runtime-events.d.ts.map +1 -1
  16. package/dist/platform/agents/wrfc-runtime-events.js +4 -1
  17. package/dist/platform/automation/delivery-manager.d.ts.map +1 -1
  18. package/dist/platform/automation/delivery-manager.js +1 -6
  19. package/dist/platform/batch/manager.d.ts.map +1 -1
  20. package/dist/platform/batch/manager.js +1 -3
  21. package/dist/platform/channels/policy-manager.d.ts.map +1 -1
  22. package/dist/platform/channels/policy-manager.js +1 -3
  23. package/dist/platform/channels/reply-pipeline.d.ts.map +1 -1
  24. package/dist/platform/channels/reply-pipeline.js +4 -0
  25. package/dist/platform/config/schema-domain-core.d.ts +1 -1
  26. package/dist/platform/config/schema-domain-core.d.ts.map +1 -1
  27. package/dist/platform/config/schema-domain-core.js +12 -12
  28. package/dist/platform/config/schema-domain-runtime.d.ts +1 -1
  29. package/dist/platform/config/schema-domain-runtime.d.ts.map +1 -1
  30. package/dist/platform/config/schema-domain-runtime.js +19 -18
  31. package/dist/platform/config/schema-domain-surfaces.d.ts +1 -1
  32. package/dist/platform/config/schema-domain-surfaces.d.ts.map +1 -1
  33. package/dist/platform/config/schema-domain-surfaces.js +4 -3
  34. package/dist/platform/config/schema-shared.d.ts +6 -0
  35. package/dist/platform/config/schema-shared.d.ts.map +1 -1
  36. package/dist/platform/config/schema-shared.js +21 -1
  37. package/dist/platform/control-plane/approval-broker.d.ts.map +1 -1
  38. package/dist/platform/control-plane/approval-broker.js +1 -3
  39. package/dist/platform/control-plane/session-broker-state.d.ts.map +1 -1
  40. package/dist/platform/control-plane/session-broker-state.js +1 -3
  41. package/dist/platform/core/compaction-sections.d.ts +3 -1
  42. package/dist/platform/core/compaction-sections.d.ts.map +1 -1
  43. package/dist/platform/core/compaction-sections.js +70 -66
  44. package/dist/platform/core/context-compaction.d.ts.map +1 -1
  45. package/dist/platform/core/context-compaction.js +10 -16
  46. package/dist/platform/core/orchestrator-context-runtime.d.ts +2 -2
  47. package/dist/platform/core/orchestrator-context-runtime.d.ts.map +1 -1
  48. package/dist/platform/core/orchestrator-context-runtime.js +24 -21
  49. package/dist/platform/core/orchestrator-tool-runtime.d.ts.map +1 -1
  50. package/dist/platform/core/orchestrator-tool-runtime.js +2 -1
  51. package/dist/platform/core/session-lineage.d.ts +2 -5
  52. package/dist/platform/core/session-lineage.d.ts.map +1 -1
  53. package/dist/platform/core/session-lineage.js +4 -16
  54. package/dist/platform/core/wrfc-routing.d.ts.map +1 -1
  55. package/dist/platform/core/wrfc-routing.js +1 -3
  56. package/dist/platform/daemon/http/mcp-routes.d.ts.map +1 -1
  57. package/dist/platform/daemon/http/mcp-routes.js +1 -3
  58. package/dist/platform/daemon/http/openai-compatible-routes.d.ts.map +1 -1
  59. package/dist/platform/daemon/http/openai-compatible-routes.js +1 -3
  60. package/dist/platform/daemon/http/runtime-routes.d.ts.map +1 -1
  61. package/dist/platform/daemon/http/runtime-routes.js +1 -3
  62. package/dist/platform/hooks/runners/http.d.ts.map +1 -1
  63. package/dist/platform/hooks/runners/http.js +9 -19
  64. package/dist/platform/integrations/webhooks.js +2 -11
  65. package/dist/platform/knowledge/semantic/self-improvement.d.ts.map +1 -1
  66. package/dist/platform/knowledge/semantic/self-improvement.js +2 -21
  67. package/dist/platform/mcp/client.d.ts.map +1 -1
  68. package/dist/platform/mcp/client.js +1 -3
  69. package/dist/platform/mcp/config.d.ts.map +1 -1
  70. package/dist/platform/mcp/config.js +1 -3
  71. package/dist/platform/media/builtin-generation-providers.d.ts.map +1 -1
  72. package/dist/platform/media/builtin-generation-providers.js +1 -6
  73. package/dist/platform/providers/anthropic-compat.d.ts.map +1 -1
  74. package/dist/platform/providers/anthropic-compat.js +11 -131
  75. package/dist/platform/providers/anthropic-sdk-provider.d.ts.map +1 -1
  76. package/dist/platform/providers/anthropic-sdk-provider.js +8 -42
  77. package/dist/platform/providers/anthropic-sse-assembler.d.ts +80 -0
  78. package/dist/platform/providers/anthropic-sse-assembler.d.ts.map +1 -0
  79. package/dist/platform/providers/anthropic-sse-assembler.js +146 -0
  80. package/dist/platform/providers/anthropic-stream.d.ts +30 -0
  81. package/dist/platform/providers/anthropic-stream.d.ts.map +1 -0
  82. package/dist/platform/providers/anthropic-stream.js +44 -0
  83. package/dist/platform/providers/anthropic-vertex.d.ts.map +1 -1
  84. package/dist/platform/providers/anthropic-vertex.js +1 -3
  85. package/dist/platform/providers/anthropic.d.ts.map +1 -1
  86. package/dist/platform/providers/anthropic.js +15 -151
  87. package/dist/platform/providers/capabilities.d.ts.map +1 -1
  88. package/dist/platform/providers/capabilities.js +11 -7
  89. package/dist/platform/providers/context-discovery.d.ts.map +1 -1
  90. package/dist/platform/providers/context-discovery.js +9 -16
  91. package/dist/platform/providers/context-window-fallback.d.ts +24 -0
  92. package/dist/platform/providers/context-window-fallback.d.ts.map +1 -0
  93. package/dist/platform/providers/context-window-fallback.js +48 -0
  94. package/dist/platform/providers/gemini.d.ts.map +1 -1
  95. package/dist/platform/providers/gemini.js +3 -6
  96. package/dist/platform/providers/json-ttl-cache.d.ts +35 -0
  97. package/dist/platform/providers/json-ttl-cache.d.ts.map +1 -0
  98. package/dist/platform/providers/json-ttl-cache.js +52 -0
  99. package/dist/platform/providers/llama-cpp.d.ts.map +1 -1
  100. package/dist/platform/providers/llama-cpp.js +2 -23
  101. package/dist/platform/providers/lm-studio-helpers.d.ts +1 -1
  102. package/dist/platform/providers/lm-studio-helpers.d.ts.map +1 -1
  103. package/dist/platform/providers/lm-studio-helpers.js +5 -25
  104. package/dist/platform/providers/model-benchmarks.d.ts.map +1 -1
  105. package/dist/platform/providers/model-benchmarks.js +11 -34
  106. package/dist/platform/providers/model-catalog-cache.d.ts.map +1 -1
  107. package/dist/platform/providers/model-catalog-cache.js +15 -38
  108. package/dist/platform/providers/model-catalog-synthetic.d.ts.map +1 -1
  109. package/dist/platform/providers/model-catalog-synthetic.js +3 -2
  110. package/dist/platform/providers/model-catalog.d.ts.map +1 -1
  111. package/dist/platform/providers/model-catalog.js +3 -2
  112. package/dist/platform/providers/model-limits.d.ts.map +1 -1
  113. package/dist/platform/providers/model-limits.js +18 -42
  114. package/dist/platform/providers/ollama.d.ts.map +1 -1
  115. package/dist/platform/providers/ollama.js +3 -24
  116. package/dist/platform/providers/openai-codex.d.ts.map +1 -1
  117. package/dist/platform/providers/openai-codex.js +8 -9
  118. package/dist/platform/providers/openai-compat.d.ts.map +1 -1
  119. package/dist/platform/providers/openai-compat.js +13 -40
  120. package/dist/platform/providers/openai-stream-helpers.d.ts +62 -0
  121. package/dist/platform/providers/openai-stream-helpers.d.ts.map +1 -0
  122. package/dist/platform/providers/openai-stream-helpers.js +73 -0
  123. package/dist/platform/providers/openai.d.ts.map +1 -1
  124. package/dist/platform/providers/openai.js +13 -41
  125. package/dist/platform/providers/provider-error.d.ts +17 -0
  126. package/dist/platform/providers/provider-error.d.ts.map +1 -0
  127. package/dist/platform/providers/provider-error.js +33 -0
  128. package/dist/platform/providers/provider-stop-reason.d.ts +15 -0
  129. package/dist/platform/providers/provider-stop-reason.d.ts.map +1 -0
  130. package/dist/platform/providers/provider-stop-reason.js +15 -0
  131. package/dist/platform/providers/sse-line-buffer.d.ts +13 -0
  132. package/dist/platform/providers/sse-line-buffer.d.ts.map +1 -0
  133. package/dist/platform/providers/sse-line-buffer.js +23 -0
  134. package/dist/platform/providers/tool-formats.d.ts +5 -0
  135. package/dist/platform/providers/tool-formats.d.ts.map +1 -1
  136. package/dist/platform/providers/tool-formats.js +14 -0
  137. package/dist/platform/runtime/bootstrap-runtime-events.d.ts.map +1 -1
  138. package/dist/platform/runtime/bootstrap-runtime-events.js +6 -0
  139. package/dist/platform/runtime/bootstrap-services.d.ts.map +1 -1
  140. package/dist/platform/runtime/bootstrap-services.js +4 -5
  141. package/dist/platform/runtime/emitters/workflows.d.ts +4 -0
  142. package/dist/platform/runtime/emitters/workflows.d.ts.map +1 -1
  143. package/dist/platform/runtime/emitters/workflows.js +3 -0
  144. package/dist/platform/runtime/remote/distributed-runtime-store.d.ts.map +1 -1
  145. package/dist/platform/runtime/remote/distributed-runtime-store.js +1 -3
  146. package/dist/platform/runtime/retention/pruner.js +2 -5
  147. package/dist/platform/runtime/store/helpers/reducers/lifecycle.d.ts.map +1 -1
  148. package/dist/platform/runtime/store/helpers/reducers/lifecycle.js +15 -14
  149. package/dist/platform/runtime/store/helpers/reducers/shared.d.ts +6 -0
  150. package/dist/platform/runtime/store/helpers/reducers/shared.d.ts.map +1 -1
  151. package/dist/platform/runtime/store/helpers/reducers/shared.js +8 -1
  152. package/dist/platform/runtime/telemetry/exporters/queue.d.ts.map +1 -1
  153. package/dist/platform/runtime/telemetry/exporters/queue.js +1 -7
  154. package/dist/platform/runtime/transports/http-helpers.d.ts +0 -1
  155. package/dist/platform/runtime/transports/http-helpers.d.ts.map +1 -1
  156. package/dist/platform/runtime/transports/http-helpers.js +1 -3
  157. package/dist/platform/runtime/ui-read-model-helpers.d.ts +2 -0
  158. package/dist/platform/runtime/ui-read-model-helpers.d.ts.map +1 -1
  159. package/dist/platform/runtime/ui-read-model-helpers.js +8 -0
  160. package/dist/platform/runtime/ui-read-models-core.d.ts.map +1 -1
  161. package/dist/platform/runtime/ui-read-models-core.js +3 -5
  162. package/dist/platform/runtime/ui-read-models-observability-remote.d.ts.map +1 -1
  163. package/dist/platform/runtime/ui-read-models-observability-remote.js +2 -4
  164. package/dist/platform/runtime/ui-read-models-operations.d.ts.map +1 -1
  165. package/dist/platform/runtime/ui-read-models-operations.js +8 -26
  166. package/dist/platform/scheduler/scheduler.d.ts.map +1 -1
  167. package/dist/platform/scheduler/scheduler.js +1 -3
  168. package/dist/platform/tools/agent/index.d.ts +1 -0
  169. package/dist/platform/tools/agent/index.d.ts.map +1 -1
  170. package/dist/platform/tools/agent/index.js +1 -0
  171. package/dist/platform/tools/agent/predicates.d.ts +15 -0
  172. package/dist/platform/tools/agent/predicates.d.ts.map +1 -0
  173. package/dist/platform/tools/agent/predicates.js +15 -0
  174. package/dist/platform/tools/exec/runtime.d.ts.map +1 -1
  175. package/dist/platform/tools/exec/runtime.js +1 -7
  176. package/dist/platform/tools/fetch/runtime.d.ts.map +1 -1
  177. package/dist/platform/tools/fetch/runtime.js +9 -20
  178. package/dist/platform/tools/shared/process-manager.d.ts.map +1 -1
  179. package/dist/platform/tools/shared/process-manager.js +1 -6
  180. package/dist/platform/utils/concurrency.d.ts +1 -0
  181. package/dist/platform/utils/concurrency.d.ts.map +1 -1
  182. package/dist/platform/utils/concurrency.js +1 -0
  183. package/dist/platform/utils/error-display.d.ts +9 -0
  184. package/dist/platform/utils/error-display.d.ts.map +1 -1
  185. package/dist/platform/utils/error-display.js +11 -0
  186. package/dist/platform/utils/fetch-with-timeout.d.ts +22 -2
  187. package/dist/platform/utils/fetch-with-timeout.d.ts.map +1 -1
  188. package/dist/platform/utils/fetch-with-timeout.js +33 -15
  189. package/dist/platform/utils/record-coerce.d.ts +5 -0
  190. package/dist/platform/utils/record-coerce.d.ts.map +1 -1
  191. package/dist/platform/utils/record-coerce.js +7 -0
  192. package/dist/platform/utils/retry.d.ts.map +1 -1
  193. package/dist/platform/utils/retry.js +2 -4
  194. package/dist/platform/version.js +1 -1
  195. package/package.json +9 -9
@@ -11,7 +11,7 @@ import { summarizeError } from '../utils/error-display.js';
11
11
  import { emitAgentCompleted, emitAgentFailed, emitAgentProgress, emitAgentRunning, emitWorkflowChainFailed, emitWorkflowFixAttempted, emitWorkflowReviewCompleted, } from '../runtime/emitters/index.js';
12
12
  import { getWrfcAutoCommit, getWrfcMaxFixAttempts, getWrfcScoreThreshold, getWrfcAgentHeartbeatTimeoutMs, } from './wrfc-config.js';
13
13
  import { buildEngineerConstraintAddendum, } from './wrfc-prompt-addenda.js';
14
- import { completeWrfcOrchestrationNode, createWrfcWorkflowContext, emitWrfcAutoCommitted, emitWrfcCascadeAbort, emitWrfcChainCreated, emitWrfcChainPassed, emitWrfcConstraintsEnumerated, emitWrfcGraphCreated, emitWrfcStateChanged, failWrfcOrchestrationNode, startWrfcOrchestrationNode, } from './wrfc-runtime-events.js';
14
+ import { completeWrfcOrchestrationNode, createWrfcWorkflowContext, emitWrfcAutoCommitted, emitWrfcCascadeAbort, emitWrfcChainCreated, emitWrfcChainPassed, emitWrfcConstraintsEnumerated, emitWrfcGraphCreated, emitWrfcScoreRegression, emitWrfcStateChanged, failWrfcOrchestrationNode, startWrfcOrchestrationNode, } from './wrfc-runtime-events.js';
15
15
  import { runWrfcGateChecks } from './wrfc-gate-runtime.js';
16
16
  export { extractScoreFromText, extractPassedFromText, extractIssuesFromText } from './wrfc-reporting.js';
17
17
  /**
@@ -29,6 +29,18 @@ const VALID_TRANSITIONS = {
29
29
  gating: ['passed', 'failed', 'committing', 'fixing'],
30
30
  committing: ['passed', 'failed'],
31
31
  };
32
+ /** Returns true when a chain is in a terminal state (passed or failed). */
33
+ function isChainTerminal(state) {
34
+ return state === 'passed' || state === 'failed';
35
+ }
36
+ /** Returns true when a chain is actively executing (not terminal and not pending). */
37
+ function isChainActive(state) {
38
+ return !isChainTerminal(state) && state !== 'pending';
39
+ }
40
+ /** Type guard: returns true when an agent record is in-flight (pending or running). */
41
+ function isAgentInFlight(record) {
42
+ return record != null && (record.status === 'pending' || record.status === 'running');
43
+ }
32
44
  const MAX_ACTIVE_CHAINS = 6;
33
45
  const CHAIN_CLEANUP_DELAY_MS = 60_000;
34
46
  export class WrfcController {
@@ -112,7 +124,7 @@ export class WrfcController {
112
124
  listChains() { return Array.from(this.chains.values()); }
113
125
  resumeChain(chainId) {
114
126
  const chain = this.chains.get(chainId);
115
- if (!chain || chain.state === 'passed' || chain.state === 'failed')
127
+ if (!chain || isChainTerminal(chain.state))
116
128
  return false;
117
129
  if (this.hasRunningChild(chain)) {
118
130
  this.appendOwnerDecision(chain, 'resume_skipped', 'WRFC chain already has an active child agent');
@@ -276,7 +288,7 @@ export class WrfcController {
276
288
  */
277
289
  importChain(chain, force = false) {
278
290
  const existing = this.chains.get(chain.id);
279
- if (existing && existing.state !== 'passed' && existing.state !== 'failed' && !force) {
291
+ if (existing && !isChainTerminal(existing.state) && !force) {
280
292
  logger.warn('WrfcController.importChain: refused — existing chain is non-terminal; use force=true to overwrite', {
281
293
  chainId: chain.id,
282
294
  existingState: existing.state,
@@ -312,7 +324,7 @@ export class WrfcController {
312
324
  }
313
325
  const from = chain.state;
314
326
  chain.state = to;
315
- if (to !== 'passed' && to !== 'failed') {
327
+ if (!isChainTerminal(to)) {
316
328
  this.keepOwnerAgentActive(chain);
317
329
  }
318
330
  emitWrfcStateChanged(this.runtimeBus, this.sessionId, chain.id, from, to);
@@ -328,7 +340,7 @@ export class WrfcController {
328
340
  if (role === 'owner') {
329
341
  record.progress = this.ownerProgress(chain);
330
342
  }
331
- if (record.status === 'pending' || record.status === 'running') {
343
+ if (isAgentInFlight(record)) {
332
344
  emitAgentProgress(this.runtimeBus, {
333
345
  sessionId: this.sessionId,
334
346
  traceId: `${this.sessionId}:wrfc-agent-metadata:${record.id}`,
@@ -344,8 +356,32 @@ export class WrfcController {
344
356
  });
345
357
  }
346
358
  }
359
+ /** Wire up a freshly spawned WRFC child agent in one canonical order:
360
+ * stamp metadata, push to allAgentIds tracking list, register with message bus.
361
+ * Keeps the role-field assignment at each call site to preserve clarity. */
362
+ /** Prepend a formatted block of synthetic controller-injected issues to a review task body.
363
+ * Returns the augmented task string; does NOT clear the issues array (caller's responsibility). */
364
+ prependSyntheticIssues(issues, reviewTask) {
365
+ if (issues.length === 0)
366
+ return reviewTask;
367
+ const syntheticBlock = [
368
+ `## Synthetic issues from controller`,
369
+ ``,
370
+ ...issues.map((issue) => `- [${issue.severity.toUpperCase()}] ${issue.description}`),
371
+ ].join('\n');
372
+ return syntheticBlock + '\n\n---\n\n' + reviewTask;
373
+ }
374
+ registerSpawnedChild(chain, record, role, subtaskId) {
375
+ this.applyWrfcAgentMetadata(chain, record, role, subtaskId);
376
+ chain.allAgentIds.push(record.id);
377
+ this.messageBus.registerAgent({
378
+ agentId: record.id,
379
+ role,
380
+ wrfcId: chain.id,
381
+ });
382
+ }
347
383
  keepOwnerAgentActive(chain, reason) {
348
- if (chain.ownerTerminalEmitted || chain.state === 'passed' || chain.state === 'failed')
384
+ if (chain.ownerTerminalEmitted || isChainTerminal(chain.state))
349
385
  return;
350
386
  const owner = this.agentManager.getStatus(chain.ownerAgentId);
351
387
  if (!owner)
@@ -459,7 +495,7 @@ export class WrfcController {
459
495
  tickWatchdog(timeoutMs) {
460
496
  const now = Date.now();
461
497
  for (const chain of this.chains.values()) {
462
- if (chain.state === 'passed' || chain.state === 'failed' || chain.state === 'pending')
498
+ if (!isChainActive(chain.state))
463
499
  continue;
464
500
  // Find the active child agent for this chain.
465
501
  const activeAgentId = this.activeChildAgentId(chain);
@@ -586,7 +622,7 @@ export class WrfcController {
586
622
  const chain = this.findChainByAgentId(agentId);
587
623
  if (!chain)
588
624
  return;
589
- if (agentId === chain.ownerAgentId && (chain.state === 'passed' || chain.state === 'failed'))
625
+ if (agentId === chain.ownerAgentId && isChainTerminal(chain.state))
590
626
  return;
591
627
  if (agentId === chain.ownerAgentId) {
592
628
  this.keepOwnerAgentActive(chain, 'Ignored premature owner failure event; WRFC lifecycle is still active');
@@ -606,7 +642,7 @@ export class WrfcController {
606
642
  }
607
643
  onAgentCancelled(agentId, reason) {
608
644
  const chain = this.findChainByAgentId(agentId);
609
- if (!chain || chain.state === 'passed' || chain.state === 'failed')
645
+ if (!chain || isChainTerminal(chain.state))
610
646
  return;
611
647
  if (agentId === chain.ownerAgentId) {
612
648
  this.setWrfcWorkPlanTaskStatus(chain, agentId, 'cancelled', reason ?? 'WRFC owner agent cancelled');
@@ -621,24 +657,13 @@ export class WrfcController {
621
657
  // Prepend any synthetic issues from the controller (e.g. fixer constraint-continuity
622
658
  // violations) to the review task body, then clear them so they fire only once.
623
659
  let reviewTask = buildReviewTask(chain.id, chain.task, report, getWrfcScoreThreshold(this.configManager), chain.constraints);
624
- if (chain.syntheticIssues && chain.syntheticIssues.length > 0) {
625
- const syntheticBlock = [
626
- `## Synthetic issues from controller`,
627
- ``,
628
- ...chain.syntheticIssues.map((issue) => `- [${issue.severity.toUpperCase()}] ${issue.description}`),
629
- ].join('\n');
630
- reviewTask = syntheticBlock + '\n\n---\n\n' + reviewTask;
660
+ if (chain.syntheticIssues?.length) {
661
+ reviewTask = this.prependSyntheticIssues(chain.syntheticIssues, reviewTask);
631
662
  chain.syntheticIssues = [];
632
663
  }
633
664
  const reviewerRecord = this.spawnWrfcAgent(chain, 'reviewer', 'reviewer', reviewTask, true);
634
665
  chain.reviewerAgentId = reviewerRecord.id;
635
- this.applyWrfcAgentMetadata(chain, reviewerRecord, 'reviewer');
636
- chain.allAgentIds.push(reviewerRecord.id);
637
- this.messageBus.registerAgent({
638
- agentId: reviewerRecord.id,
639
- role: 'reviewer',
640
- wrfcId: chain.id,
641
- });
666
+ this.registerSpawnedChild(chain, reviewerRecord, 'reviewer');
642
667
  chain.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `review:${chain.reviewCycles + 1}`, 'reviewer', 'Reviewer assessment', reviewerRecord.id);
643
668
  logger.debug('WrfcController.startReview', {
644
669
  chainId: chain.id,
@@ -719,7 +744,7 @@ export class WrfcController {
719
744
  const initial = scores[0];
720
745
  const lastTwo = scores.slice(-2);
721
746
  if (lastTwo[0] < initial && lastTwo[1] < initial) {
722
- emitWrfcCascadeAbort(this.runtimeBus, this.sessionId, chain.id, `Score regression warning: initial ${initial}/10, last two ${lastTwo[0]}/10, ${lastTwo[1]}/10 — both below initial. Fix quality may be degrading.`);
747
+ emitWrfcScoreRegression(this.runtimeBus, this.sessionId, chain.id, `Score regression warning: initial ${initial}/10, last two ${lastTwo[0]}/10, ${lastTwo[1]}/10 — both below initial. Fix quality may be degrading.`);
723
748
  }
724
749
  }
725
750
  const maxFixAttempts = getWrfcMaxFixAttempts(this.configManager);
@@ -750,13 +775,7 @@ export class WrfcController {
750
775
  });
751
776
  const fixerRecord = this.spawnWrfcAgent(chain, 'fixer', 'engineer', buildFixTask(chain.id, chain.task, review, getWrfcScoreThreshold(this.configManager), chain.fixAttempts, chain.constraints, review.constraintFindings ?? []), true);
752
777
  chain.fixerAgentId = fixerRecord.id;
753
- this.applyWrfcAgentMetadata(chain, fixerRecord, 'fixer');
754
- chain.allAgentIds.push(fixerRecord.id);
755
- this.messageBus.registerAgent({
756
- agentId: fixerRecord.id,
757
- role: 'fixer',
758
- wrfcId: chain.id,
759
- });
778
+ this.registerSpawnedChild(chain, fixerRecord, 'fixer');
760
779
  chain.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `fix:${chain.fixAttempts}`, 'fixer', `Fix attempt ${chain.fixAttempts}`, fixerRecord.id);
761
780
  this.workmap.append({
762
781
  ts: new Date().toISOString(),
@@ -791,8 +810,8 @@ export class WrfcController {
791
810
  },
792
811
  });
793
812
  }
794
- evaluateConstraints(chain, review) {
795
- if (chain.constraints.length === 0) {
813
+ evaluateConstraintSet(constraints, review) {
814
+ if (constraints.length === 0) {
796
815
  return {
797
816
  constraintsSatisfied: 0,
798
817
  constraintsTotal: 0,
@@ -801,7 +820,7 @@ export class WrfcController {
801
820
  constraintFailure: false,
802
821
  };
803
822
  }
804
- const expectedIds = new Set(chain.constraints.map((constraint) => constraint.id));
823
+ const expectedIds = new Set(constraints.map((constraint) => constraint.id));
805
824
  const findingMap = new Map();
806
825
  const ignoredConstraintFindingIds = [];
807
826
  for (const finding of review.constraintFindings ?? []) {
@@ -815,7 +834,7 @@ export class WrfcController {
815
834
  }
816
835
  let constraintsSatisfied = 0;
817
836
  const unsatisfiedConstraintIds = [];
818
- for (const constraint of chain.constraints) {
837
+ for (const constraint of constraints) {
819
838
  const finding = findingMap.get(constraint.id);
820
839
  if (finding?.satisfied === true) {
821
840
  constraintsSatisfied += 1;
@@ -826,52 +845,17 @@ export class WrfcController {
826
845
  }
827
846
  return {
828
847
  constraintsSatisfied,
829
- constraintsTotal: chain.constraints.length,
848
+ constraintsTotal: constraints.length,
830
849
  unsatisfiedConstraintIds,
831
850
  ignoredConstraintFindingIds,
832
851
  constraintFailure: unsatisfiedConstraintIds.length > 0,
833
852
  };
834
853
  }
854
+ evaluateConstraints(chain, review) {
855
+ return this.evaluateConstraintSet(chain.constraints, review);
856
+ }
835
857
  evaluateSubtaskConstraints(subtask, review) {
836
- if (subtask.constraints.length === 0) {
837
- return {
838
- constraintsSatisfied: 0,
839
- constraintsTotal: 0,
840
- unsatisfiedConstraintIds: [],
841
- ignoredConstraintFindingIds: [],
842
- constraintFailure: false,
843
- };
844
- }
845
- const expectedIds = new Set(subtask.constraints.map((constraint) => constraint.id));
846
- const findingMap = new Map();
847
- const ignoredConstraintFindingIds = [];
848
- for (const finding of review.constraintFindings ?? []) {
849
- if (!expectedIds.has(finding.constraintId)) {
850
- ignoredConstraintFindingIds.push(finding.constraintId);
851
- continue;
852
- }
853
- if (!findingMap.has(finding.constraintId)) {
854
- findingMap.set(finding.constraintId, finding);
855
- }
856
- }
857
- let constraintsSatisfied = 0;
858
- const unsatisfiedConstraintIds = [];
859
- for (const constraint of subtask.constraints) {
860
- const finding = findingMap.get(constraint.id);
861
- if (finding?.satisfied === true) {
862
- constraintsSatisfied += 1;
863
- }
864
- else {
865
- unsatisfiedConstraintIds.push(constraint.id);
866
- }
867
- }
868
- return {
869
- constraintsSatisfied,
870
- constraintsTotal: subtask.constraints.length,
871
- unsatisfiedConstraintIds,
872
- ignoredConstraintFindingIds,
873
- constraintFailure: unsatisfiedConstraintIds.length > 0,
874
- };
858
+ return this.evaluateConstraintSet(subtask.constraints, review);
875
859
  }
876
860
  async processGateResults(chain, results) {
877
861
  if (!chain.currentNodeId?.includes(':gate:')) {
@@ -927,14 +911,8 @@ export class WrfcController {
927
911
  });
928
912
  const gateFixTask = buildGateFailureTask(chain.id, chain.task, failedGates, chain.constraints);
929
913
  const fixerRecord = this.spawnWrfcAgent(chain, 'fixer', 'engineer', gateFixTask, true);
930
- this.applyWrfcAgentMetadata(chain, fixerRecord, 'fixer');
931
914
  chain.fixerAgentId = fixerRecord.id;
932
- chain.allAgentIds.push(fixerRecord.id);
933
- this.messageBus.registerAgent({
934
- agentId: fixerRecord.id,
935
- role: 'fixer',
936
- wrfcId: chain.id,
937
- });
915
+ this.registerSpawnedChild(chain, fixerRecord, 'fixer');
938
916
  chain.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `fix:${chain.fixAttempts}:gates`, 'fixer', `Gate fix attempt ${chain.fixAttempts}`, fixerRecord.id);
939
917
  this.workmap.append({
940
918
  ts: new Date().toISOString(),
@@ -957,14 +935,14 @@ export class WrfcController {
957
935
  }
958
936
  scheduleChainCleanup(chain) {
959
937
  const timer = setTimeout(() => {
960
- if (chain.state === 'passed' || chain.state === 'failed') {
938
+ if (isChainTerminal(chain.state)) {
961
939
  this.chains.delete(chain.id);
962
940
  }
963
941
  }, CHAIN_CLEANUP_DELAY_MS);
964
942
  timer.unref?.();
965
943
  }
966
944
  async checkAndRunGatesForAll() {
967
- const allChains = Array.from(this.chains.values()).filter((chain) => chain.state !== 'passed' && chain.state !== 'failed');
945
+ const allChains = Array.from(this.chains.values()).filter((chain) => !isChainTerminal(chain.state));
968
946
  const activeWorkChains = allChains.filter((chain) => (chain.state === 'pending'
969
947
  || chain.state === 'engineering'
970
948
  || chain.state === 'integrating'
@@ -985,12 +963,27 @@ export class WrfcController {
985
963
  });
986
964
  const gateRunner = readyChains[0];
987
965
  const results = await this.runGates(gateRunner);
988
- for (const chain of readyChains) {
989
- if (chain.id !== gateRunner.id) {
990
- this.transition(chain, 'gating');
991
- chain.gateResults = results;
966
+ const allGatesPassed = results.length === 0 || results.every((r) => r.passed);
967
+ if (allGatesPassed) {
968
+ // All gates passed: process each waiting chain so it can commit/pass.
969
+ for (const chain of readyChains) {
970
+ if (chain.id !== gateRunner.id) {
971
+ this.transition(chain, 'gating');
972
+ chain.gateResults = results;
973
+ }
974
+ await this.processGateResults(chain, results);
992
975
  }
993
- await this.processGateResults(chain, results);
976
+ }
977
+ else {
978
+ // Gate failure: spawn exactly ONE fixer (for the gateRunner). Non-owner chains
979
+ // stay in awaiting_gates — they will be committed/passed once the gateRunner's
980
+ // fix→review cycle eventually brings gates back to passing.
981
+ for (const chain of readyChains) {
982
+ if (chain.id !== gateRunner.id) {
983
+ chain.gateResults = results; // record for reporting; state stays awaiting_gates
984
+ }
985
+ }
986
+ await this.processGateResults(gateRunner, results);
994
987
  }
995
988
  }
996
989
  async autoCommit(chain) {
@@ -1069,8 +1062,7 @@ export class WrfcController {
1069
1062
  }
1070
1063
  const writeRoles = new Set(['engineer', 'fixer', 'integrator']);
1071
1064
  for (const agentId of chain.allAgentIds) {
1072
- const recordRole = this.agentManager.getStatus(agentId)?.wrfcRole;
1073
- const role = recordRole ?? this.workPlanRoleForAgent(chain, agentId);
1065
+ const role = this.resolveWrfcRole(chain, agentId);
1074
1066
  if (role && writeRoles.has(role))
1075
1067
  add(agentId);
1076
1068
  }
@@ -1084,7 +1076,7 @@ export class WrfcController {
1084
1076
  if (chain.state === 'pending') {
1085
1077
  this.chainQueue = this.chainQueue.filter((queued) => queued.record.id !== chain.ownerAgentId);
1086
1078
  }
1087
- const wasActive = chain.state !== 'passed' && chain.state !== 'failed' && chain.state !== 'pending';
1079
+ const wasActive = isChainActive(chain.state);
1088
1080
  this.failCurrentNode(chain, reason);
1089
1081
  for (const subtask of chain.subtasks ?? []) {
1090
1082
  if (subtask.currentNodeId) {
@@ -1114,13 +1106,16 @@ export class WrfcController {
1114
1106
  logger.error('WrfcController.failChain', { chainId: chain.id, reason });
1115
1107
  this.scheduleChainCleanup(chain);
1116
1108
  this.safeDequeueNext();
1109
+ // Orphan safety: re-promote a gate-runner for any chains still in awaiting_gates
1110
+ // after this chain terminally fails (e.g. gate-retry exhaustion or fixer failure).
1111
+ this.safeCheckAndRunGatesForAll();
1117
1112
  }
1118
1113
  cancelRunningChildren(chain) {
1119
1114
  for (const agentId of chain.allAgentIds) {
1120
1115
  if (agentId === chain.ownerAgentId)
1121
1116
  continue;
1122
1117
  const record = this.agentManager.getStatus(agentId);
1123
- if (record?.status === 'pending' || record?.status === 'running') {
1118
+ if (isAgentInFlight(record)) {
1124
1119
  this.agentManager.cancel(agentId);
1125
1120
  }
1126
1121
  }
@@ -1130,7 +1125,7 @@ export class WrfcController {
1130
1125
  if (agentId === chain.ownerAgentId)
1131
1126
  return false;
1132
1127
  const record = this.agentManager.getStatus(agentId);
1133
- return record?.status === 'pending' || record?.status === 'running';
1128
+ return isAgentInFlight(record);
1134
1129
  });
1135
1130
  }
1136
1131
  cancelChain(chain, reason) {
@@ -1156,7 +1151,7 @@ export class WrfcController {
1156
1151
  agentId: chain.ownerAgentId,
1157
1152
  });
1158
1153
  const owner = this.agentManager.getStatus(chain.ownerAgentId);
1159
- if (owner && (owner.status === 'pending' || owner.status === 'running')) {
1154
+ if (isAgentInFlight(owner)) {
1160
1155
  owner.status = 'cancelled';
1161
1156
  owner.completedAt = Date.now();
1162
1157
  owner.progress = reason;
@@ -1303,14 +1298,8 @@ export class WrfcController {
1303
1298
  this.transition(chain, 'engineering');
1304
1299
  this.setWrfcWorkPlanTaskStatus(chain, chain.ownerAgentId, 'in_progress');
1305
1300
  const engineerRecord = this.spawnWrfcAgent(chain, 'engineer', 'engineer', chain.task, true);
1306
- this.applyWrfcAgentMetadata(chain, engineerRecord, 'engineer');
1307
1301
  chain.engineerAgentId = engineerRecord.id;
1308
- chain.allAgentIds.push(engineerRecord.id);
1309
- this.messageBus.registerAgent({
1310
- agentId: engineerRecord.id,
1311
- role: 'engineer',
1312
- wrfcId: chain.id,
1313
- });
1302
+ this.registerSpawnedChild(chain, engineerRecord, 'engineer');
1314
1303
  chain.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `engineer:${chain.fixAttempts}`, 'engineer', 'Engineer implementation', engineerRecord.id);
1315
1304
  if (emitCreated) {
1316
1305
  emitWrfcChainCreated(this.runtimeBus, this.sessionId, chain.id, chain.task);
@@ -1333,14 +1322,8 @@ export class WrfcController {
1333
1322
  for (const subtask of chain.subtasks ?? []) {
1334
1323
  subtask.state = 'engineering';
1335
1324
  const engineerRecord = this.spawnWrfcAgent(chain, 'engineer', 'engineer', this.buildSubtaskEngineerTask(chain, subtask), true, subtask.id);
1336
- this.applyWrfcAgentMetadata(chain, engineerRecord, 'engineer', subtask.id);
1337
1325
  subtask.engineerAgentId = engineerRecord.id;
1338
- chain.allAgentIds.push(engineerRecord.id);
1339
- this.messageBus.registerAgent({
1340
- agentId: engineerRecord.id,
1341
- role: 'engineer',
1342
- wrfcId: chain.id,
1343
- });
1326
+ this.registerSpawnedChild(chain, engineerRecord, 'engineer', subtask.id);
1344
1327
  subtask.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `subtask:${subtask.id}:engineer:0`, 'engineer', `Engineer ${subtask.title}`, engineerRecord.id);
1345
1328
  this.appendOwnerDecision(chain, 'spawn_engineer', this.withRouteReason(`Start compound WRFC engineer child for ${subtask.id}`, engineerRecord), {
1346
1329
  agentId: engineerRecord.id,
@@ -1649,24 +1632,13 @@ export class WrfcController {
1649
1632
  startCompoundSubtaskReview(chain, subtask, report) {
1650
1633
  subtask.state = 'reviewing';
1651
1634
  let reviewTask = buildReviewTask(chain.id, `Parent WRFC ask:\n${chain.task}\n\nSub-deliverable ${subtask.id}:\n${subtask.task}`, report, getWrfcScoreThreshold(this.configManager), subtask.constraints);
1652
- if (subtask.syntheticIssues && subtask.syntheticIssues.length > 0) {
1653
- const syntheticBlock = [
1654
- `## Synthetic issues from controller`,
1655
- ``,
1656
- ...subtask.syntheticIssues.map((issue) => `- [${issue.severity.toUpperCase()}] ${issue.description}`),
1657
- ].join('\n');
1658
- reviewTask = syntheticBlock + '\n\n---\n\n' + reviewTask;
1635
+ if (subtask.syntheticIssues?.length) {
1636
+ reviewTask = this.prependSyntheticIssues(subtask.syntheticIssues, reviewTask);
1659
1637
  subtask.syntheticIssues = [];
1660
1638
  }
1661
1639
  const reviewerRecord = this.spawnWrfcAgent(chain, 'reviewer', 'reviewer', reviewTask, true, subtask.id);
1662
1640
  subtask.reviewerAgentId = reviewerRecord.id;
1663
- this.applyWrfcAgentMetadata(chain, reviewerRecord, 'reviewer', subtask.id);
1664
- chain.allAgentIds.push(reviewerRecord.id);
1665
- this.messageBus.registerAgent({
1666
- agentId: reviewerRecord.id,
1667
- role: 'reviewer',
1668
- wrfcId: chain.id,
1669
- });
1641
+ this.registerSpawnedChild(chain, reviewerRecord, 'reviewer', subtask.id);
1670
1642
  subtask.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `subtask:${subtask.id}:review:${subtask.reviewCycles + 1}`, 'reviewer', `Review ${subtask.title}`, reviewerRecord.id);
1671
1643
  this.appendOwnerDecision(chain, 'spawn_reviewer', this.withRouteReason(`Review compound sub-deliverable ${subtask.id} after engineer output exists`, reviewerRecord), {
1672
1644
  agentId: reviewerRecord.id,
@@ -1708,6 +1680,14 @@ export class WrfcController {
1708
1680
  })),
1709
1681
  });
1710
1682
  subtask.reviewScores.push(review.score);
1683
+ const subtaskScores = subtask.reviewScores;
1684
+ if (subtaskScores.length >= 3) {
1685
+ const initial = subtaskScores[0];
1686
+ const lastTwo = subtaskScores.slice(-2);
1687
+ if (lastTwo[0] < initial && lastTwo[1] < initial) {
1688
+ emitWrfcScoreRegression(this.runtimeBus, this.sessionId, chain.id, `Score regression warning (subtask ${subtask.id}): initial ${initial}/10, last two ${lastTwo[0]}/10, ${lastTwo[1]}/10 — both below initial. Fix quality may be degrading.`);
1689
+ }
1690
+ }
1711
1691
  if (passed) {
1712
1692
  subtask.state = 'passed';
1713
1693
  this.appendOwnerDecision(chain, 'subtask_review_passed', `Sub-deliverable ${subtask.id} passed review with ${review.score}/10`, {
@@ -1745,13 +1725,7 @@ export class WrfcController {
1745
1725
  });
1746
1726
  const fixerRecord = this.spawnWrfcAgent(chain, 'fixer', 'engineer', buildFixTask(chain.id, `Parent WRFC ask:\n${chain.task}\n\nSub-deliverable ${subtask.id}:\n${subtask.task}`, review, getWrfcScoreThreshold(this.configManager), subtask.fixAttempts, subtask.constraints, review.constraintFindings ?? []), true, subtask.id);
1747
1727
  subtask.fixerAgentId = fixerRecord.id;
1748
- this.applyWrfcAgentMetadata(chain, fixerRecord, 'fixer', subtask.id);
1749
- chain.allAgentIds.push(fixerRecord.id);
1750
- this.messageBus.registerAgent({
1751
- agentId: fixerRecord.id,
1752
- role: 'fixer',
1753
- wrfcId: chain.id,
1754
- });
1728
+ this.registerSpawnedChild(chain, fixerRecord, 'fixer', subtask.id);
1755
1729
  subtask.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `subtask:${subtask.id}:fix:${subtask.fixAttempts}`, 'fixer', `Fix ${subtask.title}`, fixerRecord.id);
1756
1730
  this.appendOwnerDecision(chain, 'spawn_fixer', this.withRouteReason(`Fix compound sub-deliverable ${subtask.id}`, fixerRecord), {
1757
1731
  agentId: fixerRecord.id,
@@ -1764,13 +1738,7 @@ export class WrfcController {
1764
1738
  this.transition(chain, 'integrating');
1765
1739
  const integratorRecord = this.spawnWrfcAgent(chain, 'integrator', 'integrator', this.buildCompoundIntegrationTask(chain), true);
1766
1740
  chain.integratorAgentId = integratorRecord.id;
1767
- this.applyWrfcAgentMetadata(chain, integratorRecord, 'integrator');
1768
- chain.allAgentIds.push(integratorRecord.id);
1769
- this.messageBus.registerAgent({
1770
- agentId: integratorRecord.id,
1771
- role: 'integrator',
1772
- wrfcId: chain.id,
1773
- });
1741
+ this.registerSpawnedChild(chain, integratorRecord, 'integrator');
1774
1742
  chain.currentNodeId = startWrfcOrchestrationNode(this.runtimeBus, this.sessionId, chain.id, `integrator:${Date.now()}`, 'integrator', 'Integrate passed deliverables', integratorRecord.id);
1775
1743
  this.appendOwnerDecision(chain, 'spawn_integrator', this.withRouteReason('Integrate all passed compound WRFC deliverables before final full-scope review', integratorRecord), {
1776
1744
  agentId: integratorRecord.id,
@@ -1941,7 +1909,7 @@ export class WrfcController {
1941
1909
  setWrfcWorkPlanTaskStatus(chain, agentId, status, reason) {
1942
1910
  if (!this.workPlanService)
1943
1911
  return;
1944
- const role = this.workPlanRoleForAgent(chain, agentId);
1912
+ const role = this.resolveWrfcRole(chain, agentId);
1945
1913
  if (!role)
1946
1914
  return;
1947
1915
  const taskId = this.workPlanTaskIdForAgent(chain, agentId, role);
@@ -1985,6 +1953,29 @@ export class WrfcController {
1985
1953
  });
1986
1954
  this.workPlanTaskQueues.set(taskId, next);
1987
1955
  }
1956
+ /**
1957
+ * Resolve the work-plan-visible role for an agent in a chain.
1958
+ *
1959
+ * Primary source: the durable `record.wrfcRole` stamped by
1960
+ * `applyWrfcAgentMetadata`. This preserves superseded-agent identity
1961
+ * (e.g. an earlier fixer whose `fixerAgentId` slot was reassigned still
1962
+ * resolves to 'fixer', so autoCommit continues to include its worktree).
1963
+ *
1964
+ * Structural fallback: `workPlanRoleForAgent`, which matches against the
1965
+ * CURRENT chain/subtask agent-id slots. Returns null for any agent no
1966
+ * longer in a current slot.
1967
+ *
1968
+ * Note: 'orchestrator' and 'verifier' are filtered out because they have
1969
+ * no work-plan task representation; workPlanTaskIdForAgent does not
1970
+ * accept those roles.
1971
+ */
1972
+ resolveWrfcRole(chain, agentId) {
1973
+ const recordRole = this.agentManager.getStatus(agentId)?.wrfcRole;
1974
+ if (recordRole && recordRole !== 'orchestrator' && recordRole !== 'verifier') {
1975
+ return recordRole;
1976
+ }
1977
+ return this.workPlanRoleForAgent(chain, agentId);
1978
+ }
1988
1979
  workPlanRoleForAgent(chain, agentId) {
1989
1980
  if (agentId === chain.ownerAgentId)
1990
1981
  return 'owner';
@@ -2015,6 +2006,11 @@ export class WrfcController {
2015
2006
  : role.charAt(0).toUpperCase() + role.slice(1);
2016
2007
  return `${label}: ${task.slice(0, 120)}`;
2017
2008
  }
2009
+ safeCheckAndRunGatesForAll() {
2010
+ this.checkAndRunGatesForAll().catch((error) => {
2011
+ logger.error('WrfcController.checkAndRunGatesForAll unhandled error', { error: summarizeError(error) });
2012
+ });
2013
+ }
2018
2014
  safeDequeueNext() {
2019
2015
  this.dequeueNext().catch((error) => {
2020
2016
  logger.error('WrfcController.dequeueNext unhandled error', { error: summarizeError(error) });
@@ -15,6 +15,7 @@ export declare function emitWrfcGateResult(runtimeBus: RuntimeEventBus, sessionI
15
15
  export declare function emitWrfcChainPassed(runtimeBus: RuntimeEventBus, sessionId: string, chainId: string): void;
16
16
  export declare function emitWrfcAutoCommitted(runtimeBus: RuntimeEventBus, sessionId: string, chainId: string, commitHash?: string | undefined): void;
17
17
  export declare function emitWrfcCascadeAbort(runtimeBus: RuntimeEventBus, sessionId: string, chainId: string, reason: string): void;
18
+ export declare function emitWrfcScoreRegression(runtimeBus: RuntimeEventBus, sessionId: string, chainId: string, reason: string): void;
18
19
  /**
19
20
  * Thin wrapper for WORKFLOW_CONSTRAINTS_ENUMERATED.
20
21
  * Emitted once per chain when the controller captures the authoritative constraints.
@@ -1 +1 @@
1
- {"version":3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BAAqB,CACnC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,GAC9B,IAAI,CAEN;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI,CAEN;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,IAAI,CAMN;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAqBR;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAUN;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,IAAI,CAUN"}
1
+ {"version":3,"file":"wrfc-runtime-events.d.ts","sourceRoot":"","sources":["../../../src/platform/agents/wrfc-runtime-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,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SAAS,GAC9B,IAAI,CAEN;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,IAAI,CAEN;AAED,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,UAAU,EAAE,GACxB,IAAI,CAEN;AAED,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,GACZ,IAAI,CAMN;AAED,wBAAgB,0BAA0B,CACxC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAqBR;AAED,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,MAAM,GACf,IAAI,CAUN;AAED,wBAAgB,yBAAyB,CACvC,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,GACZ,IAAI,CAUN"}
@@ -1,4 +1,4 @@
1
- import { emitOrchestrationGraphCreated, emitOrchestrationNodeAdded, emitOrchestrationNodeCompleted, emitOrchestrationNodeFailed, emitOrchestrationNodeStarted, emitWorkflowAutoCommitted, emitWorkflowCascadeAborted, emitWorkflowChainCreated, emitWorkflowChainPassed, emitWorkflowConstraintsEnumerated, emitWorkflowGateResult, emitWorkflowStateChanged, } from '../runtime/emitters/index.js';
1
+ import { emitOrchestrationGraphCreated, emitOrchestrationNodeAdded, emitOrchestrationNodeCompleted, emitOrchestrationNodeFailed, emitOrchestrationNodeStarted, emitWorkflowAutoCommitted, emitWorkflowCascadeAborted, emitWorkflowChainCreated, emitWorkflowChainPassed, emitWorkflowConstraintsEnumerated, emitWorkflowGateResult, emitWorkflowScoreRegression, emitWorkflowStateChanged, } from '../runtime/emitters/index.js';
2
2
  export function createWrfcWorkflowContext(sessionId, chainId) {
3
3
  return {
4
4
  sessionId,
@@ -27,6 +27,9 @@ export function emitWrfcAutoCommitted(runtimeBus, sessionId, chainId, commitHash
27
27
  export function emitWrfcCascadeAbort(runtimeBus, sessionId, chainId, reason) {
28
28
  emitWorkflowCascadeAborted(runtimeBus, createWrfcWorkflowContext(sessionId, chainId), { chainId, reason });
29
29
  }
30
+ export function emitWrfcScoreRegression(runtimeBus, sessionId, chainId, reason) {
31
+ emitWorkflowScoreRegression(runtimeBus, createWrfcWorkflowContext(sessionId, chainId), { chainId, reason });
32
+ }
30
33
  /**
31
34
  * Thin wrapper for WORKFLOW_CONSTRAINTS_ENUMERATED.
32
35
  * Emitted once per chain when the controller captures the authoritative constraints.
@@ -1 +1 @@
1
- {"version":3,"file":"delivery-manager.d.ts","sourceRoot":"","sources":["../../../src/platform/automation/delivery-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAA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,GAAG,IAAI,GAAG,IAAI;IAIjG,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC;IAoBpG,WAAW,CACf,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,aAAa,EAClB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,SAAS,wBAAwB,EAAE,GAC3C,OAAO,CAAC,SAAS,yBAAyB,EAAE,CAAC;IAyFhD,OAAO,CAAC,cAAc;YAoBR,UAAU;IAoBxB,OAAO,CAAC,WAAW;CA8DpB"}
@@ -6,12 +6,7 @@ import { emitDeliveryFailed, emitDeliveryQueued, emitDeliveryStarted, emitDelive
6
6
  import { classifyDeliveryError } from '../integrations/delivery.js';
7
7
  import { summarizeError } from '../utils/error-display.js';
8
8
  import { isFeatureGateEnabled, isSurfaceFeatureGateEnabled } from '../runtime/feature-flags/index.js';
9
- function sleep(ms) {
10
- return new Promise((resolve) => {
11
- const timer = setTimeout(resolve, ms);
12
- timer.unref?.();
13
- });
14
- }
9
+ import { sleep } from '../utils/concurrency.js';
15
10
  function calculateRetryDelay(baseDelayMs, attempt, strategy, maxDelayMs, jitterMs) {
16
11
  const multiplier = strategy === 'fixed' ? 1 : strategy === 'linear' ? attempt : Math.pow(2, attempt - 1);
17
12
  const base = baseDelayMs * multiplier;
@@ -1 +1 @@
1
- {"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../../src/platform/batch/manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,OAAO,KAAK,EACV,yBAAyB,EACzB,cAAc,EACd,0BAA0B,EAE1B,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAkFpB,qBAAa,kBAAkB;IAO3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAN1B,OAAO,CA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,GAAE;QAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC;YAQ9E,OAAO;YAgBP,gBAAgB;YA2BhB,mBAAmB;YA+DnB,mBAAmB;IA+DjC,OAAO,CAAC,oBAAoB;IAoC5B,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,2BAA2B;YASrB,IAAI;YAMJ,OAAO;IAIrB,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,eAAe;CAIxB"}
@@ -3,6 +3,7 @@ import { PersistentStore } from '../state/persistent-store.js';
3
3
  import { summarizeError } from '../utils/error-display.js';
4
4
  import { logger } from '../utils/logger.js';
5
5
  import { DaemonBatchError } from './types.js';
6
+ import { isRecord } from '../utils/record-coerce.js';
6
7
  const TERMINAL_JOB_STATUSES = new Set([
7
8
  'completed',
8
9
  'failed',
@@ -25,9 +26,6 @@ function makeEmptyStore() {
25
26
  function estimateJsonBytes(value) {
26
27
  return new TextEncoder().encode(JSON.stringify(value)).byteLength;
27
28
  }
28
- function isRecord(value) {
29
- return typeof value === 'object' && value !== null && !Array.isArray(value);
30
- }
31
29
  function isFiniteNumber(value) {
32
30
  return typeof value === 'number' && Number.isFinite(value);
33
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"policy-manager.d.ts","sourceRoot":"","sources":["../../../src/platform/channels/policy-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAGV,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,UAAU,qBAAsB,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,QAAQ,CAAC,QAAQ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