wotann 0.5.39 → 0.5.41

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 (149) hide show
  1. package/dist/autopilot/completion-oracle.d.ts +71 -0
  2. package/dist/autopilot/completion-oracle.d.ts.map +1 -1
  3. package/dist/autopilot/completion-oracle.js +69 -2
  4. package/dist/autopilot/completion-oracle.js.map +1 -1
  5. package/dist/context/compaction-floor.d.ts +100 -0
  6. package/dist/context/compaction-floor.d.ts.map +1 -0
  7. package/dist/context/compaction-floor.js +94 -0
  8. package/dist/context/compaction-floor.js.map +1 -0
  9. package/dist/context/compaction.d.ts +27 -1
  10. package/dist/context/compaction.d.ts.map +1 -1
  11. package/dist/context/compaction.js +31 -0
  12. package/dist/context/compaction.js.map +1 -1
  13. package/dist/daemon/kairos-rpc.d.ts +1 -0
  14. package/dist/daemon/kairos-rpc.d.ts.map +1 -1
  15. package/dist/daemon/kairos-rpc.js +24 -0
  16. package/dist/daemon/kairos-rpc.js.map +1 -1
  17. package/dist/daemon/rpc-handlers/ports-rpc.d.ts +100 -0
  18. package/dist/daemon/rpc-handlers/ports-rpc.d.ts.map +1 -0
  19. package/dist/daemon/rpc-handlers/ports-rpc.js +278 -0
  20. package/dist/daemon/rpc-handlers/ports-rpc.js.map +1 -0
  21. package/dist/hooks/agentmemory-event-taxonomy.d.ts +144 -0
  22. package/dist/hooks/agentmemory-event-taxonomy.d.ts.map +1 -0
  23. package/dist/hooks/agentmemory-event-taxonomy.js +85 -0
  24. package/dist/hooks/agentmemory-event-taxonomy.js.map +1 -0
  25. package/dist/hooks/built-in.d.ts.map +1 -1
  26. package/dist/hooks/built-in.js +7 -3
  27. package/dist/hooks/built-in.js.map +1 -1
  28. package/dist/hooks/engine.d.ts +14 -0
  29. package/dist/hooks/engine.d.ts.map +1 -1
  30. package/dist/hooks/engine.js +62 -0
  31. package/dist/hooks/engine.js.map +1 -1
  32. package/dist/index.js +91 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/lib.d.ts +1 -1
  35. package/dist/lib.d.ts.map +1 -1
  36. package/dist/lib.js +1 -1
  37. package/dist/lib.js.map +1 -1
  38. package/dist/memory/injection-scanner.d.ts +78 -0
  39. package/dist/memory/injection-scanner.d.ts.map +1 -0
  40. package/dist/memory/injection-scanner.js +204 -0
  41. package/dist/memory/injection-scanner.js.map +1 -0
  42. package/dist/middleware/output-truncation.d.ts +18 -5
  43. package/dist/middleware/output-truncation.d.ts.map +1 -1
  44. package/dist/middleware/output-truncation.js +73 -1
  45. package/dist/middleware/output-truncation.js.map +1 -1
  46. package/dist/middleware/ttsr.d.ts +79 -3
  47. package/dist/middleware/ttsr.d.ts.map +1 -1
  48. package/dist/middleware/ttsr.js +136 -16
  49. package/dist/middleware/ttsr.js.map +1 -1
  50. package/dist/orchestration/autonomous.d.ts +182 -0
  51. package/dist/orchestration/autonomous.d.ts.map +1 -1
  52. package/dist/orchestration/autonomous.js +288 -1
  53. package/dist/orchestration/autonomous.js.map +1 -1
  54. package/dist/orchestration/ports-bridge.d.ts +325 -0
  55. package/dist/orchestration/ports-bridge.d.ts.map +1 -0
  56. package/dist/orchestration/ports-bridge.js +712 -0
  57. package/dist/orchestration/ports-bridge.js.map +1 -0
  58. package/dist/orchestration/textgrad-refinement.d.ts +123 -0
  59. package/dist/orchestration/textgrad-refinement.d.ts.map +1 -0
  60. package/dist/orchestration/textgrad-refinement.js +111 -0
  61. package/dist/orchestration/textgrad-refinement.js.map +1 -0
  62. package/dist/prompt/engine.d.ts +15 -0
  63. package/dist/prompt/engine.d.ts.map +1 -1
  64. package/dist/prompt/engine.js +20 -7
  65. package/dist/prompt/engine.js.map +1 -1
  66. package/dist/prompt/modules/capabilities.d.ts.map +1 -1
  67. package/dist/prompt/modules/capabilities.js +1 -0
  68. package/dist/prompt/modules/capabilities.js.map +1 -1
  69. package/dist/prompt/modules/caveman.d.ts.map +1 -1
  70. package/dist/prompt/modules/caveman.js +1 -0
  71. package/dist/prompt/modules/caveman.js.map +1 -1
  72. package/dist/prompt/modules/conventions.d.ts.map +1 -1
  73. package/dist/prompt/modules/conventions.js +1 -0
  74. package/dist/prompt/modules/conventions.js.map +1 -1
  75. package/dist/prompt/modules/identity.d.ts.map +1 -1
  76. package/dist/prompt/modules/identity.js +1 -0
  77. package/dist/prompt/modules/identity.js.map +1 -1
  78. package/dist/prompt/modules/index.d.ts +29 -0
  79. package/dist/prompt/modules/index.d.ts.map +1 -1
  80. package/dist/prompt/modules/index.js +51 -9
  81. package/dist/prompt/modules/index.js.map +1 -1
  82. package/dist/prompt/modules/llms-txt.d.ts.map +1 -1
  83. package/dist/prompt/modules/llms-txt.js +2 -4
  84. package/dist/prompt/modules/llms-txt.js.map +1 -1
  85. package/dist/prompt/modules/safety.d.ts.map +1 -1
  86. package/dist/prompt/modules/safety.js +1 -0
  87. package/dist/prompt/modules/safety.js.map +1 -1
  88. package/dist/prompt/modules/security.d.ts.map +1 -1
  89. package/dist/prompt/modules/security.js +1 -0
  90. package/dist/prompt/modules/security.js.map +1 -1
  91. package/dist/prompt/modules/skills.d.ts.map +1 -1
  92. package/dist/prompt/modules/skills.js +1 -0
  93. package/dist/prompt/modules/skills.js.map +1 -1
  94. package/dist/prompt/modules/tools.d.ts.map +1 -1
  95. package/dist/prompt/modules/tools.js +1 -0
  96. package/dist/prompt/modules/tools.js.map +1 -1
  97. package/dist/prompt/modules/user.d.ts.map +1 -1
  98. package/dist/prompt/modules/user.js +1 -0
  99. package/dist/prompt/modules/user.js.map +1 -1
  100. package/dist/providers/credential-pool.d.ts +45 -1
  101. package/dist/providers/credential-pool.d.ts.map +1 -1
  102. package/dist/providers/credential-pool.js +94 -1
  103. package/dist/providers/credential-pool.js.map +1 -1
  104. package/dist/providers/sticky-rotation-wire.d.ts +133 -0
  105. package/dist/providers/sticky-rotation-wire.d.ts.map +1 -0
  106. package/dist/providers/sticky-rotation-wire.js +185 -0
  107. package/dist/providers/sticky-rotation-wire.js.map +1 -0
  108. package/dist/runtime-hooks/ttsr-rule.d.ts +82 -0
  109. package/dist/runtime-hooks/ttsr-rule.d.ts.map +1 -0
  110. package/dist/runtime-hooks/ttsr-rule.js +207 -0
  111. package/dist/runtime-hooks/ttsr-rule.js.map +1 -0
  112. package/dist/runtime-hooks/ttsr-runner.d.ts +129 -0
  113. package/dist/runtime-hooks/ttsr-runner.d.ts.map +1 -0
  114. package/dist/runtime-hooks/ttsr-runner.js +193 -0
  115. package/dist/runtime-hooks/ttsr-runner.js.map +1 -0
  116. package/dist/runtime-hooks/ttsr-scope.d.ts +115 -0
  117. package/dist/runtime-hooks/ttsr-scope.d.ts.map +1 -0
  118. package/dist/runtime-hooks/ttsr-scope.js +378 -0
  119. package/dist/runtime-hooks/ttsr-scope.js.map +1 -0
  120. package/dist/sandbox/unified-exec.d.ts.map +1 -1
  121. package/dist/sandbox/unified-exec.js +6 -1
  122. package/dist/sandbox/unified-exec.js.map +1 -1
  123. package/dist/skills/cli-anything.d.ts.map +1 -1
  124. package/dist/skills/cli-anything.js +4 -1
  125. package/dist/skills/cli-anything.js.map +1 -1
  126. package/dist/skills/limits.d.ts +86 -0
  127. package/dist/skills/limits.d.ts.map +1 -0
  128. package/dist/skills/limits.js +140 -0
  129. package/dist/skills/limits.js.map +1 -0
  130. package/dist/skills/loader.d.ts +9 -0
  131. package/dist/skills/loader.d.ts.map +1 -1
  132. package/dist/skills/loader.js +29 -1
  133. package/dist/skills/loader.js.map +1 -1
  134. package/dist/storage/session-artifacts.d.ts +105 -0
  135. package/dist/storage/session-artifacts.d.ts.map +1 -0
  136. package/dist/storage/session-artifacts.js +198 -0
  137. package/dist/storage/session-artifacts.js.map +1 -0
  138. package/dist/tools/workspace-pack.d.ts +97 -0
  139. package/dist/tools/workspace-pack.d.ts.map +1 -0
  140. package/dist/tools/workspace-pack.js +228 -0
  141. package/dist/tools/workspace-pack.js.map +1 -0
  142. package/dist/tui/composer-history.d.ts +99 -0
  143. package/dist/tui/composer-history.d.ts.map +1 -0
  144. package/dist/tui/composer-history.js +169 -0
  145. package/dist/tui/composer-history.js.map +1 -0
  146. package/dist/ui/components/PromptInput.d.ts.map +1 -1
  147. package/dist/ui/components/PromptInput.js +80 -9
  148. package/dist/ui/components/PromptInput.js.map +1 -1
  149. package/package.json +1 -1
@@ -40,6 +40,9 @@ import { type PhasedExecutorState } from "./phased-executor.js";
40
40
  import { GoalDriftDetector, type DriftAssessment } from "./goal-drift.js";
41
41
  import type { TodoProvider } from "./todo-provider.js";
42
42
  import { SelfHealingPipeline } from "./self-healing-pipeline.js";
43
+ import { type TextGradRefinementOpts, type TextGradRefinementSummary } from "./textgrad-refinement.js";
44
+ import type { TextGradOptimizeResult } from "../optimize/textgrad-optimizer.js";
45
+ import type { TaskInstance } from "../optimize/textgrad-types.js";
43
46
  export interface AutonomousConfig {
44
47
  readonly maxCycles: number;
45
48
  readonly maxTimeMs: number;
@@ -143,6 +146,90 @@ export interface AutonomousConfig {
143
146
  * old behavior is preserved verbatim.
144
147
  */
145
148
  readonly voterStrategy?: "auto" | "elo-tournament" | "single-score";
149
+ /**
150
+ * GenericAgent zombie-wire #1 (src/loop/tool-description-reset.ts).
151
+ *
152
+ * When set to a positive integer N, instantiates a per-run TurnCounter
153
+ * with interval N. After every model call the counter increments;
154
+ * when `shouldResetTools()` returns `true`, the executor invokes
155
+ * `callbacks.onToolDescriptionReset` (if provided) so the caller can
156
+ * clear its tool-description cache key, then `acknowledgeReset()` so
157
+ * the same boundary doesn't fire twice.
158
+ *
159
+ * Default `undefined` — the counter is never instantiated and existing
160
+ * callers see no behavior change. Set to 10 to match the GenericAgent
161
+ * upstream constant.
162
+ */
163
+ readonly toolDescriptionResetTurns?: number;
164
+ /**
165
+ * GenericAgent zombie-wire #2 (src/skills/sop-completion-gate.ts).
166
+ *
167
+ * When `true`, instantiates a per-run SOPCompletionGate. Before the
168
+ * autonomous loop marks a success as final, the executor checks
169
+ * `gate.isComplete()`. If false, it emits a "verification: SOP
170
+ * closeout missing" follow-up via `callbacks.onSOPCloseoutMissing`
171
+ * (when supplied) asking the model to call
172
+ * `update_working_checkpoint → complete_task → set_todo`. The closeout
173
+ * loop then advances to the next cycle WITHOUT exiting the run,
174
+ * so the model has a chance to satisfy the gate. Once the gate is
175
+ * complete the success exit proceeds normally.
176
+ *
177
+ * Default `false` — opt-in to avoid breaking existing tests that
178
+ * don't drive the gate. Callers MUST supply `callbacks.recordSOPStep`
179
+ * for the gate to make progress; otherwise the run will loop on
180
+ * "closeout missing" until maxCycles exhausts.
181
+ */
182
+ readonly enforceSOPCloseout?: boolean;
183
+ /**
184
+ * GenericAgent zombie-wire #3 (src/skills/sop-template.ts).
185
+ *
186
+ * When `true` AND `sopCrystallization.enabled` is also `true`, the
187
+ * default trajectory passed to `crystallizeSop()` is first formatted
188
+ * through `renderSOPTemplate()` so the crystallized .md has the
189
+ * canonical 4-section structure (`Start`/`Choose`/`Execute`/`Finalize`).
190
+ * The formatted markdown is folded into the `taskSummary` field so
191
+ * downstream consumers (recipe loader, skill dispatch) see the SOP
192
+ * shape immediately.
193
+ *
194
+ * Default `true` (effective only when `sopCrystallization.enabled`).
195
+ * Set to `false` to preserve the pre-wire trajectory format.
196
+ */
197
+ readonly useSOPTemplate?: boolean;
198
+ /**
199
+ * GenericAgent zombie-wire #4 (src/skills/history-deduper.ts).
200
+ *
201
+ * When `true`, instantiates a per-run HistoryDeduper. Before kicking
202
+ * off the run, the executor calls `deduper.hasRecentDuplicate(taskKey, 3)`.
203
+ * If `true`, the executor emits a warning via
204
+ * `callbacks.onTaskHistoryDuplicate` (when supplied). The caller can
205
+ * abort by setting `callbacks.onTaskHistoryDuplicate` to return
206
+ * `"abort"` (sync); otherwise the run proceeds. On success the
207
+ * executor calls `deduper.record(taskKey)` to prevent the next call
208
+ * from also tripping the gate.
209
+ *
210
+ * `taskKey` defaults to the original `task` argument. Override via
211
+ * `callbacks.getDedupeTaskKey` for richer keying (e.g. hash of the
212
+ * normalized task description).
213
+ *
214
+ * Default `false` — opt-in to avoid changing existing-test semantics.
215
+ */
216
+ readonly dedupeTaskHistory?: boolean;
217
+ /**
218
+ * GenericAgent zombie-wire #5 (src/orchestration/textgrad-refinement.ts).
219
+ *
220
+ * When `true`, the executor routes the autonomous-loop's "refine"
221
+ * pass through `runTextgradRefinement()` instead of the bare
222
+ * LLM-modification path. The caller MUST supply
223
+ * `callbacks.getTextgradRefinementOpts` to provide the critic LLM,
224
+ * evaluator, modifier, and training set; without that hook the wire
225
+ * is a no-op.
226
+ *
227
+ * Default `false` — opt-in. The refinement runs ONCE per successful
228
+ * run, after the success gates pass but before the success exit, so
229
+ * the final solution can be polished without breaking the existing
230
+ * cycle/verifier contract.
231
+ */
232
+ readonly useTextgradRefinement?: boolean;
146
233
  }
147
234
  export interface AutonomousCycleResult {
148
235
  readonly cycle: number;
@@ -429,6 +516,101 @@ export declare class AutonomousExecutor {
429
516
  readonly taskId: string;
430
517
  readonly onDrift?: (assessment: DriftAssessment, cycle: number) => void;
431
518
  };
519
+ /**
520
+ * GenericAgent zombie-wire #1 callback — TurnCounter reset hook.
521
+ *
522
+ * Called every time the TurnCounter signals a reset boundary
523
+ * (configured via `config.toolDescriptionResetTurns`). The caller
524
+ * should clear its tool-description cache key so the next model
525
+ * call re-injects the schema. The executor automatically calls
526
+ * `counter.acknowledgeReset()` after this hook returns (even on
527
+ * thrown error) so the boundary doesn't re-fire next cycle.
528
+ *
529
+ * `turnCount` is the absolute turn number (>=1) on the boundary.
530
+ * When omitted the wire is silent: counter still increments and
531
+ * acknowledges, but no caller-visible effect.
532
+ */
533
+ onToolDescriptionReset?: (turnCount: number) => void | Promise<void>;
534
+ /**
535
+ * GenericAgent zombie-wire #2 callback — SOP closeout step recorder.
536
+ *
537
+ * When `config.enforceSOPCloseout` is true, the executor must know
538
+ * which closeout steps the model has invoked. This callback is the
539
+ * read-side: called every cycle after the model output is produced,
540
+ * it returns the SOP step (if any) that the model called this turn.
541
+ * Returning `null` means "no closeout step this turn".
542
+ *
543
+ * The executor passes the returned step to `gate.recordStep()` so
544
+ * the gate's nextExpected() tracks model progress correctly.
545
+ */
546
+ recordSOPStep?: (cycle: number, output: string) => Promise<"update_working_checkpoint" | "complete_task" | "set_todo" | null>;
547
+ /**
548
+ * GenericAgent zombie-wire #2 callback — closeout-missing reporter.
549
+ *
550
+ * When the gate is incomplete on the success branch, the executor
551
+ * invokes this callback with the next expected step so the caller
552
+ * can prompt the model accordingly. The follow-up cycle's prompt
553
+ * is built via `buildSOPCloseoutPrompt()` regardless of whether
554
+ * this callback fires; the callback is for visibility/telemetry.
555
+ */
556
+ onSOPCloseoutMissing?: (nextExpected: "update_working_checkpoint" | "complete_task" | "set_todo", cycle: number) => void;
557
+ /**
558
+ * GenericAgent zombie-wire #4 callback — duplicate-task notifier.
559
+ *
560
+ * When `config.dedupeTaskHistory` is true and the deduper signals
561
+ * that the same taskKey was recently run 3 times back-to-back, the
562
+ * executor invokes this callback BEFORE entering the cycle loop.
563
+ * Returning `"abort"` cancels the run with exitReason `"cancelled"`;
564
+ * any other value (including `undefined`) lets the run proceed.
565
+ *
566
+ * `entries` is the recent history tail so callers can log the
567
+ * dedupe context without re-reading the file themselves.
568
+ */
569
+ onTaskHistoryDuplicate?: (taskKey: string) => "abort" | "proceed" | void | Promise<"abort" | "proceed" | void>;
570
+ /**
571
+ * GenericAgent zombie-wire #4 callback — taskKey derivation.
572
+ *
573
+ * Overrides the default taskKey (the full task string). Use this
574
+ * to normalize the key (e.g. lowercase, trim, hash) so trivially
575
+ * different prompts dedupe consistently.
576
+ */
577
+ getDedupeTaskKey?: (task: string) => string;
578
+ /**
579
+ * GenericAgent zombie-wire #5 callback — textgrad refinement opts.
580
+ *
581
+ * When `config.useTextgradRefinement` is true and this callback
582
+ * is supplied, the executor invokes `runTextgradRefinement()` once
583
+ * per successful run, after success gates pass but before the
584
+ * success exit. The callback returns the critic LLM, evaluator,
585
+ * modifier, training set, and refinement options. Returning `null`
586
+ * skips the refinement for this run.
587
+ *
588
+ * The refinement summary is forwarded via `onTextgradRefinement`.
589
+ * Errors are caught and reported; they never regress a passing run.
590
+ */
591
+ getTextgradRefinementOpts?: (finalOutput: string, task: string) => Promise<{
592
+ readonly originalSolution: string;
593
+ readonly evaluator: (output: string, task: TaskInstance) => Promise<number>;
594
+ readonly modifier: (prompt: string, task: TaskInstance) => Promise<string>;
595
+ readonly opts: TextGradRefinementOpts;
596
+ } | null>;
597
+ /**
598
+ * GenericAgent zombie-wire #5 callback — refinement result observer.
599
+ *
600
+ * Called with `{ ok: true, result, summary }` on success or
601
+ * `{ ok: false, reason }` on error. Always called when the
602
+ * refinement attempt fires (even if the underlying call threw)
603
+ * so callers can observe "fired but failed" distinctly from
604
+ * "never fired".
605
+ */
606
+ onTextgradRefinement?: (result: {
607
+ readonly ok: true;
608
+ readonly result: TextGradOptimizeResult;
609
+ readonly summary: TextGradRefinementSummary;
610
+ } | {
611
+ readonly ok: false;
612
+ readonly reason: string;
613
+ }) => void;
432
614
  }): Promise<AutonomousResult>;
433
615
  /**
434
616
  * Phase-13 wire: save TrajectoryRecorder frames to disk. Honest: on
@@ -1 +1 @@
1
- {"version":3,"file":"autonomous.d.ts","sourceRoot":"","sources":["../../src/orchestration/autonomous.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAc,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,iCAAiC,CAAC;AACpG,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,aAAa,EAEnB,MAAM,sCAAsC,CAAC;AAM9C,OAAO,EAEL,KAAK,iBAAiB,E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2BAA2B;IAgCzC;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,mCAAmC;IAW3C;;;;;;;;;;OAUG;IACH,OAAO,CAAC,8BAA8B;IAoBtC;;;;;OAKG;YACW,mBAAmB;YAMnB,iBAAiB;IAM/B,OAAO,CAAC,WAAW;CAqBpB;AAgQD,MAAM,MAAM,aAAa,GACrB,oBAAoB,GACpB,cAAc,GACd,YAAY,GACZ,cAAc,GACd,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,SAAS,CAAC;AA+Fd,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,mBAAmB,EAC1B,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,gBAAgB,EAAE,MAAM,GACvB,oBAAoB,CAYtB"}
@@ -43,6 +43,32 @@ import { crystallizeSop, } from "../recipes/sop-crystallizer.js";
43
43
  import { TrajectoryRecorder, saveTrajectory, } from "../autopilot/trajectory-recorder.js";
44
44
  import { saveCheckpoint, checkpointFilename, CHECKPOINT_VERSION, } from "../autopilot/checkpoint.js";
45
45
  import { PhasedExecutor } from "./phased-executor.js";
46
+ // GenericAgent zombie-wires (commit 41a7016 ports). All five primitives
47
+ // ship with passing unit tests but had ZERO production callers until this
48
+ // wire. Each is gated behind an opt-in config flag so existing callers
49
+ // see EXACTLY the previous behavior unless they explicitly opt in.
50
+ //
51
+ // - TurnCounter (src/loop/tool-description-reset.ts): periodic tool-schema
52
+ // re-injection every N model calls. Counters tool-fatigue drift on long
53
+ // sessions. Default OFF (toolDescriptionResetTurns undefined → no reset).
54
+ // - SOPCompletionGate (src/skills/sop-completion-gate.ts): enforces the
55
+ // `update_working_checkpoint → complete_task → set_todo` closeout sequence
56
+ // before a success can pass. Default OFF (enforceSOPCloseout: false).
57
+ // - renderSOPTemplate (src/skills/sop-template.ts): formats the trajectory
58
+ // into the canonical 4-section SOP shape (Start/Choose/Execute/Finalize)
59
+ // before crystallizeSop writes the SKILL.md. Default ON when
60
+ // sopCrystallization.enabled is true (useSOPTemplate: true).
61
+ // - HistoryDeduper (src/skills/history-deduper.ts): blocks running the same
62
+ // taskKey 3 times back-to-back. Default OFF (dedupeTaskHistory: false).
63
+ // - runTextgradRefinement (src/orchestration/textgrad-refinement.ts):
64
+ // optional gradient-based refinement pass routed through the textgrad
65
+ // helper instead of bare LLM modifications. Default OFF
66
+ // (useTextgradRefinement: false).
67
+ import { TurnCounter } from "../loop/tool-description-reset.js";
68
+ import { SOPCompletionGate } from "../skills/sop-completion-gate.js";
69
+ import { renderSOPTemplate } from "../skills/sop-template.js";
70
+ import { HistoryDeduper } from "../skills/history-deduper.js";
71
+ import { runTextgradRefinement, } from "./textgrad-refinement.js";
46
72
  const DEFAULT_CONFIG = {
47
73
  maxCycles: 25,
48
74
  maxTimeMs: 60 * 60 * 1000, // 1 hour
@@ -72,6 +98,19 @@ const DEFAULT_CONFIG = {
72
98
  // only fires inside that gated path, so unopted-in callers see no
73
99
  // behavior change.
74
100
  voterStrategy: "auto",
101
+ // GenericAgent zombie-wires: each opt-in. The defaults match
102
+ // pre-wire behavior — no flag flipped means no behavior change.
103
+ // - toolDescriptionResetTurns: undefined => TurnCounter never built.
104
+ // - enforceSOPCloseout: false => gate built lazily, not enforced.
105
+ // - useSOPTemplate: true => when sopCrystallization is also enabled,
106
+ // format the default trajectory through renderSOPTemplate. When
107
+ // sopCrystallization is undefined this flag is moot.
108
+ // - dedupeTaskHistory: false => deduper not consulted, history not recorded.
109
+ // - useTextgradRefinement: false => refinement helper never invoked.
110
+ useSOPTemplate: true,
111
+ enforceSOPCloseout: false,
112
+ dedupeTaskHistory: false,
113
+ useTextgradRefinement: false,
75
114
  };
76
115
  /**
77
116
  * Strategy escalation: each failure level tries a different approach.
@@ -310,6 +349,45 @@ export class AutonomousExecutor {
310
349
  ? selectIntelligentFirstStrategy(task)
311
350
  : "direct";
312
351
  const filesChanged = [];
352
+ // ── GenericAgent zombie-wires (per-run instances) ──
353
+ // Each wire is constructed only when its opt-in flag is set, so the
354
+ // default-config path pays no allocation cost. Per-run scoping means
355
+ // two parallel `execute()` calls cannot share state — matches
356
+ // WOTANN quality bar #7 (no module globals).
357
+ const turnCounter = typeof this.config.toolDescriptionResetTurns === "number" &&
358
+ this.config.toolDescriptionResetTurns > 0
359
+ ? new TurnCounter(this.config.toolDescriptionResetTurns)
360
+ : null;
361
+ const sopGate = this.config.enforceSOPCloseout
362
+ ? new SOPCompletionGate()
363
+ : null;
364
+ const historyDeduper = this.config.dedupeTaskHistory
365
+ ? new HistoryDeduper()
366
+ : null;
367
+ // ── Wire #4 (history-deduper) pre-flight check ──
368
+ // Consult the deduper BEFORE entering the cycle loop so the caller
369
+ // can abort fast on a thrashing run. Wrapped in try/catch — a
370
+ // corrupt history file must not crash the run; deduper falls back
371
+ // to "no duplicate" (permissive). Honest stub: a real IO failure on
372
+ // `hasRecentDuplicate` surfaces via console.warn rather than being
373
+ // silently swallowed as "no dupe found".
374
+ if (historyDeduper) {
375
+ try {
376
+ const taskKey = callbacks?.getDedupeTaskKey ? callbacks.getDedupeTaskKey(task) : task;
377
+ if (historyDeduper.hasRecentDuplicate(taskKey, 3)) {
378
+ if (callbacks?.onTaskHistoryDuplicate) {
379
+ const decision = await callbacks.onTaskHistoryDuplicate(taskKey);
380
+ if (decision === "abort") {
381
+ this.exitMode();
382
+ return this.buildResult(false, cycles, totalCost, totalTokens, "cancelled", currentStrategy, filesChanged);
383
+ }
384
+ }
385
+ }
386
+ }
387
+ catch (err) {
388
+ console.warn(`[autonomous] history-deduper preflight failed: ${err.message}`);
389
+ }
390
+ }
313
391
  // P1-B7 goal-drift state:
314
392
  // - actionHistory: rolling log of last 5 strategy prompts as
315
393
  // AgentAction descriptors. Cheap stand-in for a real tool-call
@@ -581,6 +659,48 @@ export class AutonomousExecutor {
581
659
  totalCost += costUsd;
582
660
  totalTokens += tokensUsed;
583
661
  this.heartbeat();
662
+ // ── GenericAgent zombie-wire #1: TurnCounter increment + reset ──
663
+ // After every model call, advance the counter. On reset boundaries
664
+ // (every `toolDescriptionResetTurns` turns), invoke the caller's
665
+ // tool-description cache clear hook then acknowledge so the same
666
+ // boundary doesn't re-fire. Wrapped in try/catch — a misbehaving
667
+ // hook must not fail the parent run.
668
+ if (turnCounter) {
669
+ try {
670
+ const turnCount = turnCounter.increment();
671
+ if (turnCounter.shouldResetTools()) {
672
+ try {
673
+ await callbacks?.onToolDescriptionReset?.(turnCount);
674
+ }
675
+ catch (hookErr) {
676
+ console.warn(`[autonomous] onToolDescriptionReset hook failed: ${hookErr.message}`);
677
+ }
678
+ finally {
679
+ turnCounter.acknowledgeReset();
680
+ }
681
+ }
682
+ }
683
+ catch (err) {
684
+ console.warn(`[autonomous] turn-counter failed: ${err.message}`);
685
+ }
686
+ }
687
+ // ── GenericAgent zombie-wire #2 (read-side): record SOP step ──
688
+ // When the gate is active, ask the caller which closeout step the
689
+ // model invoked this turn (if any). Record it on the gate so
690
+ // `gate.isComplete()` and `gate.nextExpected()` track progress.
691
+ // Wrapped in try/catch — a recordSOPStep failure must not kill
692
+ // the parent run; gate just stays at its current progress.
693
+ if (sopGate && callbacks?.recordSOPStep) {
694
+ try {
695
+ const step = await callbacks.recordSOPStep(cycle, output);
696
+ if (step !== null) {
697
+ sopGate.recordStep(step);
698
+ }
699
+ }
700
+ catch (err) {
701
+ console.warn(`[autonomous] recordSOPStep failed: ${err.message}`);
702
+ }
703
+ }
584
704
  trajectory.record("response", output.slice(0, 400), { cycle, tokensUsed });
585
705
  // ── Phase-13: hidden-test-aware patch scoring ──
586
706
  let patchScoreRetry = false;
@@ -835,6 +955,35 @@ export class AutonomousExecutor {
835
955
  continue;
836
956
  }
837
957
  if (testsOk && typecheckOk && lintOk) {
958
+ // ── GenericAgent zombie-wire #2: SOP closeout gate enforcement ──
959
+ // BEFORE marking the run successful, verify the SOP closeout
960
+ // sequence is complete (update_working_checkpoint → complete_task
961
+ // → set_todo). If not, emit a "verification: SOP closeout missing"
962
+ // recovery prompt asking the model to call the remaining step,
963
+ // and continue the loop (don't exit as success yet). Wrapped in
964
+ // try/catch — a gate failure must not crash the parent run.
965
+ if (sopGate) {
966
+ try {
967
+ if (!sopGate.isComplete()) {
968
+ const next = sopGate.nextExpected();
969
+ if (next) {
970
+ try {
971
+ callbacks?.onSOPCloseoutMissing?.(next, cycle);
972
+ }
973
+ catch (hookErr) {
974
+ console.warn(`[autonomous] onSOPCloseoutMissing hook failed: ${hookErr.message}`);
975
+ }
976
+ consecutiveFailures++;
977
+ this.recordCircuitFailure();
978
+ currentPrompt = buildSOPCloseoutPrompt(task, next, cycle, this.config.maxCycles);
979
+ continue;
980
+ }
981
+ }
982
+ }
983
+ catch (err) {
984
+ console.warn(`[autonomous] sop-completion-gate failed: ${err.message}`);
985
+ }
986
+ }
838
987
  this.recordCircuitSuccess();
839
988
  // Shadow git commit on passing cycle
840
989
  if (this.config.enableShadowGit && callbacks?.onShadowGitCommit) {
@@ -925,9 +1074,38 @@ export class AutonomousExecutor {
925
1074
  const skillsDir = sopPkg.skillsDir ??
926
1075
  this.config.sopCrystallization.skillsDir ??
927
1076
  (await this.defaultSopSkillsDir());
1077
+ // ── GenericAgent zombie-wire #3: renderSOPTemplate ──
1078
+ // Default ON when sopCrystallization is enabled (per
1079
+ // `useSOPTemplate` default). Folds the canonical 4-section
1080
+ // SOP shape (Start/Choose/Execute/Finalize) into the
1081
+ // `taskSummary` field so the crystallized SKILL.md has
1082
+ // the upstream-compatible structure. Wrapped in try/catch
1083
+ // — a template render failure falls back to the raw
1084
+ // taskSummary rather than aborting the crystallization.
1085
+ let renderedTaskSummary = sopPkg.taskSummary;
1086
+ if (this.config.useSOPTemplate !== false) {
1087
+ try {
1088
+ const steps = sopPkg.trajectory.map((step, i) => {
1089
+ const outcome = step.outcome === "success" ? "ok" : "failed";
1090
+ const result = step.resultSummary ? ` — ${step.resultSummary}` : "";
1091
+ return `${i + 1}. ${step.tool} [${outcome}]${result}`;
1092
+ });
1093
+ const successCount = sopPkg.trajectory.filter((s) => s.outcome === "success").length;
1094
+ const outcomeLine = `${successCount}/${sopPkg.trajectory.length} steps succeeded`;
1095
+ renderedTaskSummary = renderSOPTemplate({
1096
+ task: sopPkg.taskSummary,
1097
+ steps,
1098
+ outcome: outcomeLine,
1099
+ });
1100
+ }
1101
+ catch (renderErr) {
1102
+ console.warn(`[autonomous] renderSOPTemplate failed (using raw summary): ${renderErr.message}`);
1103
+ renderedTaskSummary = sopPkg.taskSummary;
1104
+ }
1105
+ }
928
1106
  const sopResult = await crystallizeSop({
929
1107
  trajectory: sopPkg.trajectory,
930
- taskSummary: sopPkg.taskSummary,
1108
+ taskSummary: renderedTaskSummary,
931
1109
  skillsDir,
932
1110
  });
933
1111
  callbacks?.onSopCrystallize?.(sopResult);
@@ -947,6 +1125,95 @@ export class AutonomousExecutor {
947
1125
  console.warn(`[autonomous] sop-crystallizer threw: ${reason}`);
948
1126
  }
949
1127
  }
1128
+ // ── GenericAgent zombie-wire #5: TextGrad refinement pass ──
1129
+ // Run a single textgrad refinement on the final solution if
1130
+ // both `useTextgradRefinement` is enabled AND the caller
1131
+ // supplies the required opts (critic + evaluator + modifier +
1132
+ // training set). Errors are caught and forwarded to
1133
+ // `onTextgradRefinement` — refinement failures NEVER regress
1134
+ // a passing run, matching the WOTANN "honest stubs over silent
1135
+ // success" bar.
1136
+ if (this.config.useTextgradRefinement && callbacks?.getTextgradRefinementOpts) {
1137
+ try {
1138
+ const pkg = await callbacks.getTextgradRefinementOpts(output, task);
1139
+ if (pkg) {
1140
+ try {
1141
+ let capturedSummary = null;
1142
+ // Inject our own onTelemetry alongside the caller's (if
1143
+ // supplied) so we always capture the summary, never
1144
+ // silently dropping it.
1145
+ const userTelemetry = pkg.opts.onTelemetry;
1146
+ const wrappedOpts = {
1147
+ ...pkg.opts,
1148
+ onTelemetry: (summary) => {
1149
+ capturedSummary = summary;
1150
+ try {
1151
+ userTelemetry?.(summary);
1152
+ }
1153
+ catch {
1154
+ /* caller telemetry handler must not break refinement */
1155
+ }
1156
+ },
1157
+ };
1158
+ const tgResult = await runTextgradRefinement(pkg.originalSolution, pkg.evaluator, pkg.modifier, wrappedOpts);
1159
+ if (capturedSummary) {
1160
+ callbacks.onTextgradRefinement?.({
1161
+ ok: true,
1162
+ result: tgResult,
1163
+ summary: capturedSummary,
1164
+ });
1165
+ }
1166
+ else {
1167
+ // Optimizer didn't fire telemetry — synthesize the
1168
+ // summary so the observer always hears the result.
1169
+ const delta = tgResult.bestScore - tgResult.initialScore;
1170
+ callbacks.onTextgradRefinement?.({
1171
+ ok: true,
1172
+ result: tgResult,
1173
+ summary: {
1174
+ initialScore: tgResult.initialScore,
1175
+ bestScore: tgResult.bestScore,
1176
+ delta,
1177
+ stopped: tgResult.stopped,
1178
+ iterationsRun: tgResult.iterationsRun,
1179
+ improved: delta > 0,
1180
+ },
1181
+ });
1182
+ }
1183
+ }
1184
+ catch (tgErr) {
1185
+ callbacks.onTextgradRefinement?.({
1186
+ ok: false,
1187
+ reason: `runTextgradRefinement threw: ${tgErr instanceof Error ? tgErr.message : String(tgErr)}`,
1188
+ });
1189
+ console.warn(`[autonomous] textgrad refinement failed: ${tgErr.message}`);
1190
+ }
1191
+ }
1192
+ }
1193
+ catch (err) {
1194
+ // getTextgradRefinementOpts itself threw — still surface so
1195
+ // callers can observe "fired but failed".
1196
+ callbacks.onTextgradRefinement?.({
1197
+ ok: false,
1198
+ reason: `getTextgradRefinementOpts threw: ${err instanceof Error ? err.message : String(err)}`,
1199
+ });
1200
+ console.warn(`[autonomous] textgrad opts provider failed: ${err.message}`);
1201
+ }
1202
+ }
1203
+ // ── GenericAgent zombie-wire #4: record taskKey to history ──
1204
+ // On successful exit, record the taskKey so the NEXT run's
1205
+ // preflight dedupe check has updated history. Wrapped in
1206
+ // try/catch — a record failure must not regress a passing
1207
+ // run; the worst case is the next run's dedupe check is stale.
1208
+ if (historyDeduper) {
1209
+ try {
1210
+ const taskKey = callbacks?.getDedupeTaskKey ? callbacks.getDedupeTaskKey(task) : task;
1211
+ historyDeduper.record(taskKey);
1212
+ }
1213
+ catch (err) {
1214
+ console.warn(`[autonomous] history-deduper record failed: ${err.message}`);
1215
+ }
1216
+ }
950
1217
  this.exitMode();
951
1218
  await this.persistTrajectoryBestEffort(trajectory, callbacks?.trajectoryPath);
952
1219
  return this.buildResult(true, cycles, totalCost, totalTokens, "tests-pass", currentStrategy, filesChanged);
@@ -1126,6 +1393,26 @@ function buildContextGuardPrompt(base, usage) {
1126
1393
  base,
1127
1394
  ].join("\n");
1128
1395
  }
1396
+ /**
1397
+ * Build a follow-up prompt for the SOP closeout gate (GenericAgent
1398
+ * zombie-wire #2). When the verifier passes but the gate is incomplete,
1399
+ * the executor needs the model to invoke the next expected closeout
1400
+ * step rather than exit. This prompt tells the model exactly which
1401
+ * call is still missing, in the order defined by SOP_CLOSEOUT_SEQUENCE.
1402
+ */
1403
+ function buildSOPCloseoutPrompt(originalTask, nextExpected, cycle, maxCycles) {
1404
+ return [
1405
+ `Cycle ${cycle + 1}/${maxCycles} — verification: SOP closeout missing.`,
1406
+ "",
1407
+ `The task verifier passed, but the SOP closeout sequence is incomplete.`,
1408
+ `Required order: update_working_checkpoint -> complete_task -> set_todo.`,
1409
+ `Next expected call: \`${nextExpected}\`.`,
1410
+ "",
1411
+ `Original task: ${originalTask}`,
1412
+ "",
1413
+ `Invoke \`${nextExpected}\` now. Do not start new work; close out the existing task.`,
1414
+ ].join("\n");
1415
+ }
1129
1416
  // ── DoomLoop Detection ─────────────────────────────────────
1130
1417
  /**
1131
1418
  * Pattern-based doom loop detection.