@telora/factory 0.4.5

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 (301) hide show
  1. package/dist/audit.d.ts +69 -0
  2. package/dist/audit.d.ts.map +1 -0
  3. package/dist/audit.js +376 -0
  4. package/dist/audit.js.map +1 -0
  5. package/dist/builder-completion.d.ts +35 -0
  6. package/dist/builder-completion.d.ts.map +1 -0
  7. package/dist/builder-completion.js +375 -0
  8. package/dist/builder-completion.js.map +1 -0
  9. package/dist/builder-spawner.d.ts +40 -0
  10. package/dist/builder-spawner.d.ts.map +1 -0
  11. package/dist/builder-spawner.js +493 -0
  12. package/dist/builder-spawner.js.map +1 -0
  13. package/dist/completion-gate.d.ts +52 -0
  14. package/dist/completion-gate.d.ts.map +1 -0
  15. package/dist/completion-gate.js +336 -0
  16. package/dist/completion-gate.js.map +1 -0
  17. package/dist/completion-report.d.ts +36 -0
  18. package/dist/completion-report.d.ts.map +1 -0
  19. package/dist/completion-report.js +348 -0
  20. package/dist/completion-report.js.map +1 -0
  21. package/dist/completion.d.ts +58 -0
  22. package/dist/completion.d.ts.map +1 -0
  23. package/dist/completion.js +287 -0
  24. package/dist/completion.js.map +1 -0
  25. package/dist/config.d.ts +16 -0
  26. package/dist/config.d.ts.map +1 -0
  27. package/dist/config.js +57 -0
  28. package/dist/config.js.map +1 -0
  29. package/dist/context-manager.d.ts +152 -0
  30. package/dist/context-manager.d.ts.map +1 -0
  31. package/dist/context-manager.js +421 -0
  32. package/dist/context-manager.js.map +1 -0
  33. package/dist/crash-detection.d.ts +70 -0
  34. package/dist/crash-detection.d.ts.map +1 -0
  35. package/dist/crash-detection.js +123 -0
  36. package/dist/crash-detection.js.map +1 -0
  37. package/dist/crash-recovery.d.ts +83 -0
  38. package/dist/crash-recovery.d.ts.map +1 -0
  39. package/dist/crash-recovery.js +522 -0
  40. package/dist/crash-recovery.js.map +1 -0
  41. package/dist/crash-resolution.d.ts +34 -0
  42. package/dist/crash-resolution.d.ts.map +1 -0
  43. package/dist/crash-resolution.js +382 -0
  44. package/dist/crash-resolution.js.map +1 -0
  45. package/dist/escalation.d.ts +150 -0
  46. package/dist/escalation.d.ts.map +1 -0
  47. package/dist/escalation.js +352 -0
  48. package/dist/escalation.js.map +1 -0
  49. package/dist/execution-target.d.ts +31 -0
  50. package/dist/execution-target.d.ts.map +1 -0
  51. package/dist/execution-target.js +71 -0
  52. package/dist/execution-target.js.map +1 -0
  53. package/dist/execution-unit-init.d.ts +28 -0
  54. package/dist/execution-unit-init.d.ts.map +1 -0
  55. package/dist/execution-unit-init.js +115 -0
  56. package/dist/execution-unit-init.js.map +1 -0
  57. package/dist/execution.d.ts +17 -0
  58. package/dist/execution.d.ts.map +1 -0
  59. package/dist/execution.js +20 -0
  60. package/dist/execution.js.map +1 -0
  61. package/dist/factory-engine.d.ts +100 -0
  62. package/dist/factory-engine.d.ts.map +1 -0
  63. package/dist/factory-engine.js +243 -0
  64. package/dist/factory-engine.js.map +1 -0
  65. package/dist/gap-detection.d.ts +43 -0
  66. package/dist/gap-detection.d.ts.map +1 -0
  67. package/dist/gap-detection.js +149 -0
  68. package/dist/gap-detection.js.map +1 -0
  69. package/dist/gate-context.d.ts +23 -0
  70. package/dist/gate-context.d.ts.map +1 -0
  71. package/dist/gate-context.js +63 -0
  72. package/dist/gate-context.js.map +1 -0
  73. package/dist/gate-engine.d.ts +55 -0
  74. package/dist/gate-engine.d.ts.map +1 -0
  75. package/dist/gate-engine.js +191 -0
  76. package/dist/gate-engine.js.map +1 -0
  77. package/dist/gates/adversarial.d.ts +59 -0
  78. package/dist/gates/adversarial.d.ts.map +1 -0
  79. package/dist/gates/adversarial.js +426 -0
  80. package/dist/gates/adversarial.js.map +1 -0
  81. package/dist/gates/adversary-spawner.d.ts +35 -0
  82. package/dist/gates/adversary-spawner.d.ts.map +1 -0
  83. package/dist/gates/adversary-spawner.js +286 -0
  84. package/dist/gates/adversary-spawner.js.map +1 -0
  85. package/dist/gates/adversary-test-dir.d.ts +41 -0
  86. package/dist/gates/adversary-test-dir.d.ts.map +1 -0
  87. package/dist/gates/adversary-test-dir.js +150 -0
  88. package/dist/gates/adversary-test-dir.js.map +1 -0
  89. package/dist/gates/behavioral-parser.d.ts +32 -0
  90. package/dist/gates/behavioral-parser.d.ts.map +1 -0
  91. package/dist/gates/behavioral-parser.js +190 -0
  92. package/dist/gates/behavioral-parser.js.map +1 -0
  93. package/dist/gates/behavioral-runner.d.ts +36 -0
  94. package/dist/gates/behavioral-runner.d.ts.map +1 -0
  95. package/dist/gates/behavioral-runner.js +306 -0
  96. package/dist/gates/behavioral-runner.js.map +1 -0
  97. package/dist/gates/behavioral.d.ts +37 -0
  98. package/dist/gates/behavioral.d.ts.map +1 -0
  99. package/dist/gates/behavioral.js +485 -0
  100. package/dist/gates/behavioral.js.map +1 -0
  101. package/dist/gates/deterministic.d.ts +24 -0
  102. package/dist/gates/deterministic.d.ts.map +1 -0
  103. package/dist/gates/deterministic.js +186 -0
  104. package/dist/gates/deterministic.js.map +1 -0
  105. package/dist/git-factory.d.ts +59 -0
  106. package/dist/git-factory.d.ts.map +1 -0
  107. package/dist/git-factory.js +102 -0
  108. package/dist/git-factory.js.map +1 -0
  109. package/dist/guard-evaluation.d.ts +48 -0
  110. package/dist/guard-evaluation.d.ts.map +1 -0
  111. package/dist/guard-evaluation.js +416 -0
  112. package/dist/guard-evaluation.js.map +1 -0
  113. package/dist/index.d.ts +30 -0
  114. package/dist/index.d.ts.map +1 -0
  115. package/dist/index.js +39 -0
  116. package/dist/index.js.map +1 -0
  117. package/dist/instance-completion.d.ts +34 -0
  118. package/dist/instance-completion.d.ts.map +1 -0
  119. package/dist/instance-completion.js +366 -0
  120. package/dist/instance-completion.js.map +1 -0
  121. package/dist/instance-lifecycle.d.ts +15 -0
  122. package/dist/instance-lifecycle.d.ts.map +1 -0
  123. package/dist/instance-lifecycle.js +18 -0
  124. package/dist/instance-lifecycle.js.map +1 -0
  125. package/dist/instance-phase-dispatch.d.ts +75 -0
  126. package/dist/instance-phase-dispatch.d.ts.map +1 -0
  127. package/dist/instance-phase-dispatch.js +674 -0
  128. package/dist/instance-phase-dispatch.js.map +1 -0
  129. package/dist/instance-poll-loop.d.ts +43 -0
  130. package/dist/instance-poll-loop.d.ts.map +1 -0
  131. package/dist/instance-poll-loop.js +360 -0
  132. package/dist/instance-poll-loop.js.map +1 -0
  133. package/dist/instance-state-machine.d.ts +52 -0
  134. package/dist/instance-state-machine.d.ts.map +1 -0
  135. package/dist/instance-state-machine.js +235 -0
  136. package/dist/instance-state-machine.js.map +1 -0
  137. package/dist/log-manager.d.ts +28 -0
  138. package/dist/log-manager.d.ts.map +1 -0
  139. package/dist/log-manager.js +71 -0
  140. package/dist/log-manager.js.map +1 -0
  141. package/dist/pipeline-evaluator.d.ts +61 -0
  142. package/dist/pipeline-evaluator.d.ts.map +1 -0
  143. package/dist/pipeline-evaluator.js +107 -0
  144. package/dist/pipeline-evaluator.js.map +1 -0
  145. package/dist/pipeline-metrics.d.ts +52 -0
  146. package/dist/pipeline-metrics.d.ts.map +1 -0
  147. package/dist/pipeline-metrics.js +40 -0
  148. package/dist/pipeline-metrics.js.map +1 -0
  149. package/dist/pipeline-traversal.d.ts +43 -0
  150. package/dist/pipeline-traversal.d.ts.map +1 -0
  151. package/dist/pipeline-traversal.js +68 -0
  152. package/dist/pipeline-traversal.js.map +1 -0
  153. package/dist/plan-parser.d.ts +76 -0
  154. package/dist/plan-parser.d.ts.map +1 -0
  155. package/dist/plan-parser.js +223 -0
  156. package/dist/plan-parser.js.map +1 -0
  157. package/dist/planning-phase.d.ts +52 -0
  158. package/dist/planning-phase.d.ts.map +1 -0
  159. package/dist/planning-phase.js +444 -0
  160. package/dist/planning-phase.js.map +1 -0
  161. package/dist/planning-prompt.d.ts +64 -0
  162. package/dist/planning-prompt.d.ts.map +1 -0
  163. package/dist/planning-prompt.js +251 -0
  164. package/dist/planning-prompt.js.map +1 -0
  165. package/dist/planning.d.ts +16 -0
  166. package/dist/planning.d.ts.map +1 -0
  167. package/dist/planning.js +17 -0
  168. package/dist/planning.js.map +1 -0
  169. package/dist/process-runner.d.ts +41 -0
  170. package/dist/process-runner.d.ts.map +1 -0
  171. package/dist/process-runner.js +81 -0
  172. package/dist/process-runner.js.map +1 -0
  173. package/dist/product-config.d.ts +34 -0
  174. package/dist/product-config.d.ts.map +1 -0
  175. package/dist/product-config.js +43 -0
  176. package/dist/product-config.js.map +1 -0
  177. package/dist/queries/cycle-evaluations.d.ts +23 -0
  178. package/dist/queries/cycle-evaluations.d.ts.map +1 -0
  179. package/dist/queries/cycle-evaluations.js +37 -0
  180. package/dist/queries/cycle-evaluations.js.map +1 -0
  181. package/dist/queries/escalations.d.ts +30 -0
  182. package/dist/queries/escalations.d.ts.map +1 -0
  183. package/dist/queries/escalations.js +42 -0
  184. package/dist/queries/escalations.js.map +1 -0
  185. package/dist/queries/execution-units.d.ts +76 -0
  186. package/dist/queries/execution-units.d.ts.map +1 -0
  187. package/dist/queries/execution-units.js +109 -0
  188. package/dist/queries/execution-units.js.map +1 -0
  189. package/dist/queries/gate-results.d.ts +32 -0
  190. package/dist/queries/gate-results.d.ts.map +1 -0
  191. package/dist/queries/gate-results.js +44 -0
  192. package/dist/queries/gate-results.js.map +1 -0
  193. package/dist/queries/instances.d.ts +51 -0
  194. package/dist/queries/instances.d.ts.map +1 -0
  195. package/dist/queries/instances.js +77 -0
  196. package/dist/queries/instances.js.map +1 -0
  197. package/dist/queries/sessions.d.ts +50 -0
  198. package/dist/queries/sessions.d.ts.map +1 -0
  199. package/dist/queries/sessions.js +81 -0
  200. package/dist/queries/sessions.js.map +1 -0
  201. package/dist/queries/shared.d.ts +38 -0
  202. package/dist/queries/shared.d.ts.map +1 -0
  203. package/dist/queries/shared.js +119 -0
  204. package/dist/queries/shared.js.map +1 -0
  205. package/dist/queries/specs.d.ts +12 -0
  206. package/dist/queries/specs.d.ts.map +1 -0
  207. package/dist/queries/specs.js +21 -0
  208. package/dist/queries/specs.js.map +1 -0
  209. package/dist/queries/strategies.d.ts +14 -0
  210. package/dist/queries/strategies.d.ts.map +1 -0
  211. package/dist/queries/strategies.js +18 -0
  212. package/dist/queries/strategies.js.map +1 -0
  213. package/dist/queries/work-units.d.ts +42 -0
  214. package/dist/queries/work-units.d.ts.map +1 -0
  215. package/dist/queries/work-units.js +57 -0
  216. package/dist/queries/work-units.js.map +1 -0
  217. package/dist/queries/workflows.d.ts +29 -0
  218. package/dist/queries/workflows.d.ts.map +1 -0
  219. package/dist/queries/workflows.js +103 -0
  220. package/dist/queries/workflows.js.map +1 -0
  221. package/dist/remediation-units.d.ts +40 -0
  222. package/dist/remediation-units.d.ts.map +1 -0
  223. package/dist/remediation-units.js +263 -0
  224. package/dist/remediation-units.js.map +1 -0
  225. package/dist/replanning.d.ts +72 -0
  226. package/dist/replanning.d.ts.map +1 -0
  227. package/dist/replanning.js +403 -0
  228. package/dist/replanning.js.map +1 -0
  229. package/dist/resource-limits.d.ts +62 -0
  230. package/dist/resource-limits.d.ts.map +1 -0
  231. package/dist/resource-limits.js +322 -0
  232. package/dist/resource-limits.js.map +1 -0
  233. package/dist/scheduler.d.ts +98 -0
  234. package/dist/scheduler.d.ts.map +1 -0
  235. package/dist/scheduler.js +203 -0
  236. package/dist/scheduler.js.map +1 -0
  237. package/dist/session-adapter.d.ts +89 -0
  238. package/dist/session-adapter.d.ts.map +1 -0
  239. package/dist/session-adapter.js +108 -0
  240. package/dist/session-adapter.js.map +1 -0
  241. package/dist/sop-generator.d.ts +29 -0
  242. package/dist/sop-generator.d.ts.map +1 -0
  243. package/dist/sop-generator.js +235 -0
  244. package/dist/sop-generator.js.map +1 -0
  245. package/dist/spec-profiles.d.ts +41 -0
  246. package/dist/spec-profiles.d.ts.map +1 -0
  247. package/dist/spec-profiles.js +131 -0
  248. package/dist/spec-profiles.js.map +1 -0
  249. package/dist/strategy-design-graph.d.ts +23 -0
  250. package/dist/strategy-design-graph.d.ts.map +1 -0
  251. package/dist/strategy-design-graph.js +205 -0
  252. package/dist/strategy-design-graph.js.map +1 -0
  253. package/dist/strategy-design-prompt.d.ts +28 -0
  254. package/dist/strategy-design-prompt.d.ts.map +1 -0
  255. package/dist/strategy-design-prompt.js +108 -0
  256. package/dist/strategy-design-prompt.js.map +1 -0
  257. package/dist/strategy-design-schema.d.ts +767 -0
  258. package/dist/strategy-design-schema.d.ts.map +1 -0
  259. package/dist/strategy-design-schema.js +126 -0
  260. package/dist/strategy-design-schema.js.map +1 -0
  261. package/dist/strategy-design.d.ts +69 -0
  262. package/dist/strategy-design.d.ts.map +1 -0
  263. package/dist/strategy-design.js +411 -0
  264. package/dist/strategy-design.js.map +1 -0
  265. package/dist/strategy-gating.d.ts +31 -0
  266. package/dist/strategy-gating.d.ts.map +1 -0
  267. package/dist/strategy-gating.js +276 -0
  268. package/dist/strategy-gating.js.map +1 -0
  269. package/dist/team-prompt-builder.d.ts +47 -0
  270. package/dist/team-prompt-builder.d.ts.map +1 -0
  271. package/dist/team-prompt-builder.js +362 -0
  272. package/dist/team-prompt-builder.js.map +1 -0
  273. package/dist/trace-engine.d.ts +40 -0
  274. package/dist/trace-engine.d.ts.map +1 -0
  275. package/dist/trace-engine.js +344 -0
  276. package/dist/trace-engine.js.map +1 -0
  277. package/dist/types.d.ts +612 -0
  278. package/dist/types.d.ts.map +1 -0
  279. package/dist/types.js +9 -0
  280. package/dist/types.js.map +1 -0
  281. package/dist/unit-session-lifecycle.d.ts +78 -0
  282. package/dist/unit-session-lifecycle.d.ts.map +1 -0
  283. package/dist/unit-session-lifecycle.js +141 -0
  284. package/dist/unit-session-lifecycle.js.map +1 -0
  285. package/dist/unit-session.d.ts +30 -0
  286. package/dist/unit-session.d.ts.map +1 -0
  287. package/dist/unit-session.js +370 -0
  288. package/dist/unit-session.js.map +1 -0
  289. package/dist/watchdogs.d.ts +33 -0
  290. package/dist/watchdogs.d.ts.map +1 -0
  291. package/dist/watchdogs.js +170 -0
  292. package/dist/watchdogs.js.map +1 -0
  293. package/dist/work-unit-scheduler.d.ts +34 -0
  294. package/dist/work-unit-scheduler.d.ts.map +1 -0
  295. package/dist/work-unit-scheduler.js +91 -0
  296. package/dist/work-unit-scheduler.js.map +1 -0
  297. package/dist/workflow-transition.d.ts +90 -0
  298. package/dist/workflow-transition.d.ts.map +1 -0
  299. package/dist/workflow-transition.js +340 -0
  300. package/dist/workflow-transition.js.map +1 -0
  301. package/package.json +65 -0
@@ -0,0 +1,767 @@
1
+ /**
2
+ * Strategy design types, Zod schemas, and dependency validation.
3
+ *
4
+ * Pure data definitions and validation logic for AI-generated strategy designs.
5
+ * No side effects, no I/O -- safe to import from any module.
6
+ */
7
+ import { z } from 'zod';
8
+ /** Kind of artifact in an interface contract. */
9
+ export type ContractItemKind = 'file' | 'export' | 'api_endpoint' | 'db_table' | 'type';
10
+ /**
11
+ * A single artifact in an interface contract.
12
+ * Describes one thing a strategy produces or consumes.
13
+ */
14
+ export interface ContractItem {
15
+ /** What kind of artifact this is. */
16
+ kind: ContractItemKind;
17
+ /** Identifier (e.g. file path, export name, endpoint path, table name). */
18
+ identifier: string;
19
+ /** Optional description of the artifact. */
20
+ description?: string;
21
+ }
22
+ /**
23
+ * Per-strategy interface contract declaring what a strategy produces and consumes.
24
+ */
25
+ export interface StrategyContract {
26
+ /** Artifacts this strategy will create or expose. */
27
+ produces: ContractItem[];
28
+ /** Artifacts this strategy needs from its dependencies. */
29
+ consumes: ContractItem[];
30
+ }
31
+ /**
32
+ * A cross-strategy interface contract between two strategies.
33
+ * Describes what one strategy exposes that another depends on.
34
+ */
35
+ export interface InterfaceContract {
36
+ /** What is being shared (e.g. "UserService API", "auth middleware"). */
37
+ name: string;
38
+ /** Which strategy exposes this contract (tempId reference). */
39
+ provider: string;
40
+ /** Which strategy consumes this contract (tempId reference). */
41
+ consumer: string;
42
+ /** Description of the interface boundary. */
43
+ description: string;
44
+ }
45
+ /**
46
+ * A single strategy in the AI-generated design plan.
47
+ * tempId is used for dependency references before real UUIDs are assigned.
48
+ */
49
+ export interface StrategyDesignUnit {
50
+ /** Temporary ID for DAG references (e.g. "s-0", "s-1"). */
51
+ tempId: string;
52
+ /** Human-readable strategy name. */
53
+ name: string;
54
+ /** What this strategy covers and its scope boundary. */
55
+ description: string;
56
+ /** Technical context: stack, key files, architecture notes. */
57
+ techContext: string;
58
+ /** Priority order (0 = highest). */
59
+ priorityRank: number;
60
+ /** TempIds of strategies this one depends on (DAG edges). */
61
+ dependsOn: string[];
62
+ /** Per-strategy interface contract (what it produces and consumes). */
63
+ interfaceContract: StrategyContract;
64
+ }
65
+ /**
66
+ * The full strategy design plan returned by the designing phase AI.
67
+ */
68
+ export interface StrategyDesignPlan {
69
+ /** The decomposed strategies. */
70
+ strategies: StrategyDesignUnit[];
71
+ /** Cross-strategy interface contracts. */
72
+ interfaceContracts: InterfaceContract[];
73
+ /** High-level summary of the decomposition rationale. */
74
+ summary: string;
75
+ }
76
+ /** A node in the strategy dependency graph. */
77
+ export interface StrategyGraphNode {
78
+ strategyId: string;
79
+ name: string;
80
+ dependsOn: string[];
81
+ dependedOnBy: string[];
82
+ interfaceContract: StrategyContract | null;
83
+ }
84
+ /** Validated DAG of strategy dependencies. */
85
+ export interface StrategyDependencyGraph {
86
+ /** All nodes keyed by strategy ID. */
87
+ nodes: Map<string, StrategyGraphNode>;
88
+ /** Topological execution order (strategies appear after all their dependencies). */
89
+ executionOrder: string[];
90
+ /** Groups of strategies with no cross-dependencies (can run in parallel). */
91
+ independentSubgraphs: string[][];
92
+ }
93
+ /** Result of interface contract validation. */
94
+ export interface ContractValidationResult {
95
+ valid: boolean;
96
+ errors: ContractMismatch[];
97
+ warnings: ContractWarning[];
98
+ }
99
+ /** A contract mismatch where a consumer needs something a producer doesn't declare. */
100
+ export interface ContractMismatch {
101
+ consumerStrategyId: string;
102
+ producerStrategyId: string;
103
+ consumedItem: ContractItem;
104
+ reason: string;
105
+ }
106
+ /** A non-fatal advisory about contract quality. */
107
+ export interface ContractWarning {
108
+ strategyId: string;
109
+ message: string;
110
+ }
111
+ /** Mapping from tempId to real strategy UUID. */
112
+ export interface StrategyMapping {
113
+ tempId: string;
114
+ strategyId: string;
115
+ name: string;
116
+ }
117
+ /** Execution status for factory-created strategies. */
118
+ export type StrategyExecutionStatus = 'pending' | 'in_progress' | 'completed' | 'failed' | 'gating_deterministic' | 'gating_behavioral' | 'gating_adversarial' | 'gate_fix_pending';
119
+ /** A persisted strategy returned from the API (full data for planning). */
120
+ export interface PersistedStrategy {
121
+ id: string;
122
+ name: string;
123
+ description: string | null;
124
+ techContext: string | null;
125
+ priorityRank: number;
126
+ status: string;
127
+ executionStatus: StrategyExecutionStatus | null;
128
+ interfaceContract: StrategyContract | null;
129
+ dependsOn: string[];
130
+ /** When the strategy entered gate_fix_pending (null when not in that state). */
131
+ gateFixStartedAt: string | null;
132
+ }
133
+ /** Result of a single strategy design generation attempt. */
134
+ export type StrategyGenerationResult = {
135
+ success: true;
136
+ strategyDesign: StrategyDesignPlan;
137
+ tokenUsage: ParsedTokenUsage | null;
138
+ } | {
139
+ success: false;
140
+ error: string;
141
+ tokenUsage: ParsedTokenUsage | null;
142
+ };
143
+ /** Input for building the dependency graph from persisted strategy data. */
144
+ export interface StrategyGraphInput {
145
+ strategyId: string;
146
+ name: string;
147
+ dependsOn: string[];
148
+ interfaceContract: StrategyContract | null;
149
+ }
150
+ export declare const ContractItemSchema: z.ZodObject<{
151
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
152
+ identifier: z.ZodString;
153
+ description: z.ZodOptional<z.ZodString>;
154
+ }, "strip", z.ZodTypeAny, {
155
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
156
+ identifier: string;
157
+ description?: string | undefined;
158
+ }, {
159
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
160
+ identifier: string;
161
+ description?: string | undefined;
162
+ }>;
163
+ export declare const StrategyContractSchema: z.ZodObject<{
164
+ produces: z.ZodArray<z.ZodObject<{
165
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
166
+ identifier: z.ZodString;
167
+ description: z.ZodOptional<z.ZodString>;
168
+ }, "strip", z.ZodTypeAny, {
169
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
170
+ identifier: string;
171
+ description?: string | undefined;
172
+ }, {
173
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
174
+ identifier: string;
175
+ description?: string | undefined;
176
+ }>, "many">;
177
+ consumes: z.ZodArray<z.ZodObject<{
178
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
179
+ identifier: z.ZodString;
180
+ description: z.ZodOptional<z.ZodString>;
181
+ }, "strip", z.ZodTypeAny, {
182
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
183
+ identifier: string;
184
+ description?: string | undefined;
185
+ }, {
186
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
187
+ identifier: string;
188
+ description?: string | undefined;
189
+ }>, "many">;
190
+ }, "strip", z.ZodTypeAny, {
191
+ produces: {
192
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
193
+ identifier: string;
194
+ description?: string | undefined;
195
+ }[];
196
+ consumes: {
197
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
198
+ identifier: string;
199
+ description?: string | undefined;
200
+ }[];
201
+ }, {
202
+ produces: {
203
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
204
+ identifier: string;
205
+ description?: string | undefined;
206
+ }[];
207
+ consumes: {
208
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
209
+ identifier: string;
210
+ description?: string | undefined;
211
+ }[];
212
+ }>;
213
+ export declare const InterfaceContractSchema: z.ZodObject<{
214
+ name: z.ZodString;
215
+ provider: z.ZodString;
216
+ consumer: z.ZodString;
217
+ description: z.ZodString;
218
+ }, "strip", z.ZodTypeAny, {
219
+ description: string;
220
+ name: string;
221
+ provider: string;
222
+ consumer: string;
223
+ }, {
224
+ description: string;
225
+ name: string;
226
+ provider: string;
227
+ consumer: string;
228
+ }>;
229
+ export declare const StrategyDesignUnitSchema: z.ZodObject<{
230
+ tempId: z.ZodString;
231
+ name: z.ZodString;
232
+ description: z.ZodString;
233
+ techContext: z.ZodString;
234
+ priorityRank: z.ZodNumber;
235
+ dependsOn: z.ZodArray<z.ZodString, "many">;
236
+ interfaceContract: z.ZodObject<{
237
+ produces: z.ZodArray<z.ZodObject<{
238
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
239
+ identifier: z.ZodString;
240
+ description: z.ZodOptional<z.ZodString>;
241
+ }, "strip", z.ZodTypeAny, {
242
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
243
+ identifier: string;
244
+ description?: string | undefined;
245
+ }, {
246
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
247
+ identifier: string;
248
+ description?: string | undefined;
249
+ }>, "many">;
250
+ consumes: z.ZodArray<z.ZodObject<{
251
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
252
+ identifier: z.ZodString;
253
+ description: z.ZodOptional<z.ZodString>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
256
+ identifier: string;
257
+ description?: string | undefined;
258
+ }, {
259
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
260
+ identifier: string;
261
+ description?: string | undefined;
262
+ }>, "many">;
263
+ }, "strip", z.ZodTypeAny, {
264
+ produces: {
265
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
266
+ identifier: string;
267
+ description?: string | undefined;
268
+ }[];
269
+ consumes: {
270
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
271
+ identifier: string;
272
+ description?: string | undefined;
273
+ }[];
274
+ }, {
275
+ produces: {
276
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
277
+ identifier: string;
278
+ description?: string | undefined;
279
+ }[];
280
+ consumes: {
281
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
282
+ identifier: string;
283
+ description?: string | undefined;
284
+ }[];
285
+ }>;
286
+ }, "strip", z.ZodTypeAny, {
287
+ description: string;
288
+ name: string;
289
+ tempId: string;
290
+ techContext: string;
291
+ priorityRank: number;
292
+ dependsOn: string[];
293
+ interfaceContract: {
294
+ produces: {
295
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
296
+ identifier: string;
297
+ description?: string | undefined;
298
+ }[];
299
+ consumes: {
300
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
301
+ identifier: string;
302
+ description?: string | undefined;
303
+ }[];
304
+ };
305
+ }, {
306
+ description: string;
307
+ name: string;
308
+ tempId: string;
309
+ techContext: string;
310
+ priorityRank: number;
311
+ dependsOn: string[];
312
+ interfaceContract: {
313
+ produces: {
314
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
315
+ identifier: string;
316
+ description?: string | undefined;
317
+ }[];
318
+ consumes: {
319
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
320
+ identifier: string;
321
+ description?: string | undefined;
322
+ }[];
323
+ };
324
+ }>;
325
+ export declare const StrategyDesignPlanSchema: z.ZodObject<{
326
+ strategies: z.ZodArray<z.ZodObject<{
327
+ tempId: z.ZodString;
328
+ name: z.ZodString;
329
+ description: z.ZodString;
330
+ techContext: z.ZodString;
331
+ priorityRank: z.ZodNumber;
332
+ dependsOn: z.ZodArray<z.ZodString, "many">;
333
+ interfaceContract: z.ZodObject<{
334
+ produces: z.ZodArray<z.ZodObject<{
335
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
336
+ identifier: z.ZodString;
337
+ description: z.ZodOptional<z.ZodString>;
338
+ }, "strip", z.ZodTypeAny, {
339
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
340
+ identifier: string;
341
+ description?: string | undefined;
342
+ }, {
343
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
344
+ identifier: string;
345
+ description?: string | undefined;
346
+ }>, "many">;
347
+ consumes: z.ZodArray<z.ZodObject<{
348
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
349
+ identifier: z.ZodString;
350
+ description: z.ZodOptional<z.ZodString>;
351
+ }, "strip", z.ZodTypeAny, {
352
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
353
+ identifier: string;
354
+ description?: string | undefined;
355
+ }, {
356
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
357
+ identifier: string;
358
+ description?: string | undefined;
359
+ }>, "many">;
360
+ }, "strip", z.ZodTypeAny, {
361
+ produces: {
362
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
363
+ identifier: string;
364
+ description?: string | undefined;
365
+ }[];
366
+ consumes: {
367
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
368
+ identifier: string;
369
+ description?: string | undefined;
370
+ }[];
371
+ }, {
372
+ produces: {
373
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
374
+ identifier: string;
375
+ description?: string | undefined;
376
+ }[];
377
+ consumes: {
378
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
379
+ identifier: string;
380
+ description?: string | undefined;
381
+ }[];
382
+ }>;
383
+ }, "strip", z.ZodTypeAny, {
384
+ description: string;
385
+ name: string;
386
+ tempId: string;
387
+ techContext: string;
388
+ priorityRank: number;
389
+ dependsOn: string[];
390
+ interfaceContract: {
391
+ produces: {
392
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
393
+ identifier: string;
394
+ description?: string | undefined;
395
+ }[];
396
+ consumes: {
397
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
398
+ identifier: string;
399
+ description?: string | undefined;
400
+ }[];
401
+ };
402
+ }, {
403
+ description: string;
404
+ name: string;
405
+ tempId: string;
406
+ techContext: string;
407
+ priorityRank: number;
408
+ dependsOn: string[];
409
+ interfaceContract: {
410
+ produces: {
411
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
412
+ identifier: string;
413
+ description?: string | undefined;
414
+ }[];
415
+ consumes: {
416
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
417
+ identifier: string;
418
+ description?: string | undefined;
419
+ }[];
420
+ };
421
+ }>, "many">;
422
+ interfaceContracts: z.ZodArray<z.ZodObject<{
423
+ name: z.ZodString;
424
+ provider: z.ZodString;
425
+ consumer: z.ZodString;
426
+ description: z.ZodString;
427
+ }, "strip", z.ZodTypeAny, {
428
+ description: string;
429
+ name: string;
430
+ provider: string;
431
+ consumer: string;
432
+ }, {
433
+ description: string;
434
+ name: string;
435
+ provider: string;
436
+ consumer: string;
437
+ }>, "many">;
438
+ summary: z.ZodString;
439
+ }, "strip", z.ZodTypeAny, {
440
+ strategies: {
441
+ description: string;
442
+ name: string;
443
+ tempId: string;
444
+ techContext: string;
445
+ priorityRank: number;
446
+ dependsOn: string[];
447
+ interfaceContract: {
448
+ produces: {
449
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
450
+ identifier: string;
451
+ description?: string | undefined;
452
+ }[];
453
+ consumes: {
454
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
455
+ identifier: string;
456
+ description?: string | undefined;
457
+ }[];
458
+ };
459
+ }[];
460
+ interfaceContracts: {
461
+ description: string;
462
+ name: string;
463
+ provider: string;
464
+ consumer: string;
465
+ }[];
466
+ summary: string;
467
+ }, {
468
+ strategies: {
469
+ description: string;
470
+ name: string;
471
+ tempId: string;
472
+ techContext: string;
473
+ priorityRank: number;
474
+ dependsOn: string[];
475
+ interfaceContract: {
476
+ produces: {
477
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
478
+ identifier: string;
479
+ description?: string | undefined;
480
+ }[];
481
+ consumes: {
482
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
483
+ identifier: string;
484
+ description?: string | undefined;
485
+ }[];
486
+ };
487
+ }[];
488
+ interfaceContracts: {
489
+ description: string;
490
+ name: string;
491
+ provider: string;
492
+ consumer: string;
493
+ }[];
494
+ summary: string;
495
+ }>;
496
+ /** Zod schema for validating getStrategiesByFactoryInstance response. */
497
+ export declare const PersistedStrategySchema: z.ZodObject<{
498
+ id: z.ZodString;
499
+ name: z.ZodString;
500
+ description: z.ZodNullable<z.ZodString>;
501
+ techContext: z.ZodNullable<z.ZodString>;
502
+ priorityRank: z.ZodNumber;
503
+ status: z.ZodString;
504
+ executionStatus: z.ZodNullable<z.ZodEnum<["pending", "in_progress", "completed", "failed", "gating_deterministic", "gating_behavioral", "gating_adversarial", "gate_fix_pending"]>>;
505
+ interfaceContract: z.ZodNullable<z.ZodObject<{
506
+ produces: z.ZodArray<z.ZodObject<{
507
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
508
+ identifier: z.ZodString;
509
+ description: z.ZodOptional<z.ZodString>;
510
+ }, "strip", z.ZodTypeAny, {
511
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
512
+ identifier: string;
513
+ description?: string | undefined;
514
+ }, {
515
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
516
+ identifier: string;
517
+ description?: string | undefined;
518
+ }>, "many">;
519
+ consumes: z.ZodArray<z.ZodObject<{
520
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
521
+ identifier: z.ZodString;
522
+ description: z.ZodOptional<z.ZodString>;
523
+ }, "strip", z.ZodTypeAny, {
524
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
525
+ identifier: string;
526
+ description?: string | undefined;
527
+ }, {
528
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
529
+ identifier: string;
530
+ description?: string | undefined;
531
+ }>, "many">;
532
+ }, "strip", z.ZodTypeAny, {
533
+ produces: {
534
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
535
+ identifier: string;
536
+ description?: string | undefined;
537
+ }[];
538
+ consumes: {
539
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
540
+ identifier: string;
541
+ description?: string | undefined;
542
+ }[];
543
+ }, {
544
+ produces: {
545
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
546
+ identifier: string;
547
+ description?: string | undefined;
548
+ }[];
549
+ consumes: {
550
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
551
+ identifier: string;
552
+ description?: string | undefined;
553
+ }[];
554
+ }>>;
555
+ dependsOn: z.ZodArray<z.ZodString, "many">;
556
+ gateFixStartedAt: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
557
+ }, "strip", z.ZodTypeAny, {
558
+ status: string;
559
+ description: string | null;
560
+ name: string;
561
+ techContext: string | null;
562
+ priorityRank: number;
563
+ dependsOn: string[];
564
+ interfaceContract: {
565
+ produces: {
566
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
567
+ identifier: string;
568
+ description?: string | undefined;
569
+ }[];
570
+ consumes: {
571
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
572
+ identifier: string;
573
+ description?: string | undefined;
574
+ }[];
575
+ } | null;
576
+ id: string;
577
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
578
+ gateFixStartedAt: string | null;
579
+ }, {
580
+ status: string;
581
+ description: string | null;
582
+ name: string;
583
+ techContext: string | null;
584
+ priorityRank: number;
585
+ dependsOn: string[];
586
+ interfaceContract: {
587
+ produces: {
588
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
589
+ identifier: string;
590
+ description?: string | undefined;
591
+ }[];
592
+ consumes: {
593
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
594
+ identifier: string;
595
+ description?: string | undefined;
596
+ }[];
597
+ } | null;
598
+ id: string;
599
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
600
+ gateFixStartedAt?: string | null | undefined;
601
+ }>;
602
+ export declare const GetInstanceStrategiesResponseSchema: z.ZodObject<{
603
+ strategies: z.ZodArray<z.ZodObject<{
604
+ id: z.ZodString;
605
+ name: z.ZodString;
606
+ description: z.ZodNullable<z.ZodString>;
607
+ techContext: z.ZodNullable<z.ZodString>;
608
+ priorityRank: z.ZodNumber;
609
+ status: z.ZodString;
610
+ executionStatus: z.ZodNullable<z.ZodEnum<["pending", "in_progress", "completed", "failed", "gating_deterministic", "gating_behavioral", "gating_adversarial", "gate_fix_pending"]>>;
611
+ interfaceContract: z.ZodNullable<z.ZodObject<{
612
+ produces: z.ZodArray<z.ZodObject<{
613
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
614
+ identifier: z.ZodString;
615
+ description: z.ZodOptional<z.ZodString>;
616
+ }, "strip", z.ZodTypeAny, {
617
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
618
+ identifier: string;
619
+ description?: string | undefined;
620
+ }, {
621
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
622
+ identifier: string;
623
+ description?: string | undefined;
624
+ }>, "many">;
625
+ consumes: z.ZodArray<z.ZodObject<{
626
+ kind: z.ZodEnum<["file", "export", "api_endpoint", "db_table", "type"]>;
627
+ identifier: z.ZodString;
628
+ description: z.ZodOptional<z.ZodString>;
629
+ }, "strip", z.ZodTypeAny, {
630
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
631
+ identifier: string;
632
+ description?: string | undefined;
633
+ }, {
634
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
635
+ identifier: string;
636
+ description?: string | undefined;
637
+ }>, "many">;
638
+ }, "strip", z.ZodTypeAny, {
639
+ produces: {
640
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
641
+ identifier: string;
642
+ description?: string | undefined;
643
+ }[];
644
+ consumes: {
645
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
646
+ identifier: string;
647
+ description?: string | undefined;
648
+ }[];
649
+ }, {
650
+ produces: {
651
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
652
+ identifier: string;
653
+ description?: string | undefined;
654
+ }[];
655
+ consumes: {
656
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
657
+ identifier: string;
658
+ description?: string | undefined;
659
+ }[];
660
+ }>>;
661
+ dependsOn: z.ZodArray<z.ZodString, "many">;
662
+ gateFixStartedAt: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
663
+ }, "strip", z.ZodTypeAny, {
664
+ status: string;
665
+ description: string | null;
666
+ name: string;
667
+ techContext: string | null;
668
+ priorityRank: number;
669
+ dependsOn: string[];
670
+ interfaceContract: {
671
+ produces: {
672
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
673
+ identifier: string;
674
+ description?: string | undefined;
675
+ }[];
676
+ consumes: {
677
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
678
+ identifier: string;
679
+ description?: string | undefined;
680
+ }[];
681
+ } | null;
682
+ id: string;
683
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
684
+ gateFixStartedAt: string | null;
685
+ }, {
686
+ status: string;
687
+ description: string | null;
688
+ name: string;
689
+ techContext: string | null;
690
+ priorityRank: number;
691
+ dependsOn: string[];
692
+ interfaceContract: {
693
+ produces: {
694
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
695
+ identifier: string;
696
+ description?: string | undefined;
697
+ }[];
698
+ consumes: {
699
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
700
+ identifier: string;
701
+ description?: string | undefined;
702
+ }[];
703
+ } | null;
704
+ id: string;
705
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
706
+ gateFixStartedAt?: string | null | undefined;
707
+ }>, "many">;
708
+ }, "strip", z.ZodTypeAny, {
709
+ strategies: {
710
+ status: string;
711
+ description: string | null;
712
+ name: string;
713
+ techContext: string | null;
714
+ priorityRank: number;
715
+ dependsOn: string[];
716
+ interfaceContract: {
717
+ produces: {
718
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
719
+ identifier: string;
720
+ description?: string | undefined;
721
+ }[];
722
+ consumes: {
723
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
724
+ identifier: string;
725
+ description?: string | undefined;
726
+ }[];
727
+ } | null;
728
+ id: string;
729
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
730
+ gateFixStartedAt: string | null;
731
+ }[];
732
+ }, {
733
+ strategies: {
734
+ status: string;
735
+ description: string | null;
736
+ name: string;
737
+ techContext: string | null;
738
+ priorityRank: number;
739
+ dependsOn: string[];
740
+ interfaceContract: {
741
+ produces: {
742
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
743
+ identifier: string;
744
+ description?: string | undefined;
745
+ }[];
746
+ consumes: {
747
+ kind: "type" | "file" | "export" | "api_endpoint" | "db_table";
748
+ identifier: string;
749
+ description?: string | undefined;
750
+ }[];
751
+ } | null;
752
+ id: string;
753
+ executionStatus: "pending" | "completed" | "failed" | "in_progress" | "gating_deterministic" | "gating_behavioral" | "gating_adversarial" | "gate_fix_pending" | null;
754
+ gateFixStartedAt?: string | null | undefined;
755
+ }[];
756
+ }>;
757
+ /**
758
+ * Validate that all dependsOn references point to valid tempIds within the plan,
759
+ * and that interface contract provider/consumer references are valid.
760
+ *
761
+ * Also checks for self-dependencies and cycles (via topological sort).
762
+ * Returns an error message if validation fails, null if valid.
763
+ */
764
+ export declare function validateStrategyDependencies(plan: StrategyDesignPlan): string | null;
765
+ import type { ParsedTokenUsage } from './queries/shared.js';
766
+ export type { ParsedTokenUsage };
767
+ //# sourceMappingURL=strategy-design-schema.d.ts.map