@mhingston5/lasso 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/README.md +707 -0
  2. package/docs/agent-wrangling.png +0 -0
  3. package/package.json +26 -0
  4. package/src/capabilities/matcher.ts +25 -0
  5. package/src/capabilities/registry.ts +103 -0
  6. package/src/capabilities/types.ts +15 -0
  7. package/src/cir/lower.ts +253 -0
  8. package/src/cir/optimize.ts +251 -0
  9. package/src/cir/types.ts +131 -0
  10. package/src/cir/validate.ts +265 -0
  11. package/src/compiler/compile.ts +601 -0
  12. package/src/compiler/feedback.ts +471 -0
  13. package/src/compiler/runtime-helpers.ts +455 -0
  14. package/src/composition/chain.ts +58 -0
  15. package/src/composition/conditional.ts +76 -0
  16. package/src/composition/parallel.ts +75 -0
  17. package/src/composition/types.ts +105 -0
  18. package/src/environment/analyzer.ts +56 -0
  19. package/src/environment/discovery.ts +179 -0
  20. package/src/environment/types.ts +68 -0
  21. package/src/failures/classifiers.ts +134 -0
  22. package/src/failures/generator.ts +421 -0
  23. package/src/failures/map-reference-failures.ts +23 -0
  24. package/src/failures/ontology.ts +210 -0
  25. package/src/failures/recovery.ts +214 -0
  26. package/src/failures/types.ts +14 -0
  27. package/src/index.ts +67 -0
  28. package/src/memory/advisor.ts +132 -0
  29. package/src/memory/extractor.ts +166 -0
  30. package/src/memory/store.ts +107 -0
  31. package/src/memory/types.ts +53 -0
  32. package/src/metaharness/engine.ts +256 -0
  33. package/src/metaharness/predictor.ts +168 -0
  34. package/src/metaharness/types.ts +40 -0
  35. package/src/mutation/derive.ts +308 -0
  36. package/src/mutation/diff.ts +52 -0
  37. package/src/mutation/engine.ts +256 -0
  38. package/src/mutation/types.ts +84 -0
  39. package/src/pi/command-input.ts +209 -0
  40. package/src/pi/commands.ts +351 -0
  41. package/src/pi/extension.ts +16 -0
  42. package/src/planner/synthesize.ts +83 -0
  43. package/src/planner/template-rules.ts +183 -0
  44. package/src/planner/types.ts +42 -0
  45. package/src/reference/catalog.ts +128 -0
  46. package/src/reference/patch-validation-strategies.ts +170 -0
  47. package/src/reference/patch-validation.ts +174 -0
  48. package/src/reference/pr-review-merge.ts +155 -0
  49. package/src/reference/strategies.ts +126 -0
  50. package/src/reference/types.ts +33 -0
  51. package/src/replanner/risk-rules.ts +161 -0
  52. package/src/replanner/runtime.ts +308 -0
  53. package/src/replanner/synthesize.ts +619 -0
  54. package/src/replanner/types.ts +73 -0
  55. package/src/spec/schema.ts +254 -0
  56. package/src/spec/types.ts +319 -0
  57. package/src/spec/validate.ts +296 -0
  58. package/src/state/snapshots.ts +43 -0
  59. package/src/state/types.ts +12 -0
  60. package/src/synthesis/graph-builder.ts +267 -0
  61. package/src/synthesis/harness-builder.ts +113 -0
  62. package/src/synthesis/intent-ir.ts +63 -0
  63. package/src/synthesis/policy-builder.ts +320 -0
  64. package/src/synthesis/risk-analyzer.ts +182 -0
  65. package/src/synthesis/skill-parser.ts +441 -0
  66. package/src/verification/engine.ts +230 -0
  67. package/src/versioning/file-store.ts +103 -0
  68. package/src/versioning/history.ts +43 -0
  69. package/src/versioning/store.ts +16 -0
  70. package/src/versioning/types.ts +31 -0
  71. package/test/capabilities/matcher.test.ts +67 -0
  72. package/test/capabilities/registry.test.ts +136 -0
  73. package/test/capabilities/synthesis.test.ts +264 -0
  74. package/test/cir/lower.test.ts +417 -0
  75. package/test/cir/optimize.test.ts +266 -0
  76. package/test/cir/validate.test.ts +368 -0
  77. package/test/compiler/adaptive-runtime.test.ts +157 -0
  78. package/test/compiler/compile.test.ts +1198 -0
  79. package/test/compiler/feedback.test.ts +784 -0
  80. package/test/compiler/guardrails.test.ts +191 -0
  81. package/test/compiler/trace.test.ts +404 -0
  82. package/test/composition/chain.test.ts +328 -0
  83. package/test/composition/conditional.test.ts +241 -0
  84. package/test/composition/parallel.test.ts +215 -0
  85. package/test/environment/analyzer.test.ts +204 -0
  86. package/test/environment/discovery.test.ts +149 -0
  87. package/test/failures/classifiers.test.ts +287 -0
  88. package/test/failures/generator.test.ts +203 -0
  89. package/test/failures/ontology.test.ts +439 -0
  90. package/test/failures/recovery.test.ts +300 -0
  91. package/test/helpers/createFixtureRepo.ts +84 -0
  92. package/test/helpers/createPatchValidationFixture.ts +144 -0
  93. package/test/helpers/runCompiledWorkflow.ts +208 -0
  94. package/test/memory/advisor.test.ts +332 -0
  95. package/test/memory/extractor.test.ts +295 -0
  96. package/test/memory/store.test.ts +244 -0
  97. package/test/metaharness/engine.test.ts +575 -0
  98. package/test/metaharness/predictor.test.ts +436 -0
  99. package/test/mutation/derive-failure.test.ts +209 -0
  100. package/test/mutation/engine.test.ts +622 -0
  101. package/test/package-smoke.test.ts +29 -0
  102. package/test/pi/command-input.test.ts +153 -0
  103. package/test/pi/commands.test.ts +623 -0
  104. package/test/planner/classify-template.test.ts +32 -0
  105. package/test/planner/synthesize.test.ts +901 -0
  106. package/test/reference/PatchValidation.failures.test.ts +137 -0
  107. package/test/reference/PatchValidation.test.ts +326 -0
  108. package/test/reference/PrReviewMerge.failures.test.ts +121 -0
  109. package/test/reference/PrReviewMerge.test.ts +55 -0
  110. package/test/reference/catalog-open.test.ts +70 -0
  111. package/test/replanner/runtime.test.ts +207 -0
  112. package/test/replanner/synthesize.test.ts +303 -0
  113. package/test/spec/validate.test.ts +1056 -0
  114. package/test/state/snapshots.test.ts +264 -0
  115. package/test/synthesis/custom-workflow.test.ts +264 -0
  116. package/test/synthesis/graph-builder.test.ts +370 -0
  117. package/test/synthesis/harness-builder.test.ts +128 -0
  118. package/test/synthesis/policy-builder.test.ts +149 -0
  119. package/test/synthesis/risk-analyzer.test.ts +230 -0
  120. package/test/synthesis/skill-parser.test.ts +796 -0
  121. package/test/verification/engine.test.ts +509 -0
  122. package/test/versioning/history.test.ts +144 -0
  123. package/test/versioning/store.test.ts +254 -0
  124. package/vitest.config.ts +9 -0
@@ -0,0 +1,254 @@
1
+ /**
2
+ * JSON Schema for HarnessSpec validation using Ajv
3
+ */
4
+
5
+ export const harnessSpecSchema = {
6
+ type: "object",
7
+ required: ["name", "graph"],
8
+ additionalProperties: false,
9
+ properties: {
10
+ name: { type: "string", minLength: 1 },
11
+ graph: {
12
+ type: "object",
13
+ required: ["entryNodeId", "nodes", "edges"],
14
+ additionalProperties: false,
15
+ properties: {
16
+ entryNodeId: { type: "string", minLength: 1 },
17
+ nodes: {
18
+ type: "array",
19
+ items: {
20
+ oneOf: [
21
+ {
22
+ type: "object",
23
+ required: ["id", "kind", "tool", "args"],
24
+ additionalProperties: false,
25
+ properties: {
26
+ id: { type: "string", minLength: 1 },
27
+ kind: { const: "tool" },
28
+ tool: { type: "string", minLength: 1 },
29
+ args: { type: "array", items: { type: "string" } },
30
+ env: {
31
+ type: "object",
32
+ additionalProperties: { type: "string" }
33
+ },
34
+ cwd: { type: "string" },
35
+ label: { type: "string" },
36
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
37
+ retryPolicy: { $ref: "#/$defs/retryPolicy" },
38
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
39
+ }
40
+ },
41
+ {
42
+ type: "object",
43
+ required: ["id", "kind", "provider", "model", "prompt"],
44
+ additionalProperties: false,
45
+ properties: {
46
+ id: { type: "string", minLength: 1 },
47
+ kind: { const: "llm" },
48
+ provider: { type: "string", minLength: 1 },
49
+ model: { type: "string", minLength: 1 },
50
+ prompt: { type: "string", minLength: 1 },
51
+ system: { type: "string" },
52
+ temperature: { type: "number" },
53
+ maxTokens: { type: "number" },
54
+ label: { type: "string" },
55
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
56
+ retryPolicy: { $ref: "#/$defs/retryPolicy" },
57
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
58
+ }
59
+ },
60
+ {
61
+ type: "object",
62
+ required: ["id", "kind", "prompt", "interactionType"],
63
+ additionalProperties: false,
64
+ properties: {
65
+ id: { type: "string", minLength: 1 },
66
+ kind: { const: "human" },
67
+ prompt: { type: "string", minLength: 1 },
68
+ interactionType: { enum: ["approval", "input", "choice"] },
69
+ options: { type: "array", items: { type: "string" } },
70
+ timeout: { type: "number" },
71
+ label: { type: "string" },
72
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
73
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
74
+ }
75
+ },
76
+ {
77
+ type: "object",
78
+ required: ["id", "kind", "condition", "thenNodeId", "elseNodeId"],
79
+ additionalProperties: false,
80
+ properties: {
81
+ id: { type: "string", minLength: 1 },
82
+ kind: { const: "condition" },
83
+ condition: { type: "string", minLength: 1 },
84
+ thenNodeId: { type: "string", minLength: 1 },
85
+ elseNodeId: { type: "string", minLength: 1 },
86
+ label: { type: "string" },
87
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
88
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
89
+ }
90
+ },
91
+ {
92
+ type: "object",
93
+ required: ["id", "kind", "waitFor"],
94
+ additionalProperties: false,
95
+ properties: {
96
+ id: { type: "string", minLength: 1 },
97
+ kind: { const: "merge" },
98
+ waitFor: { type: "array", items: { type: "string", minLength: 1 }, minItems: 1 },
99
+ strategy: { enum: ["all", "any", "majority"] },
100
+ label: { type: "string" },
101
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
102
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
103
+ }
104
+ },
105
+ {
106
+ type: "object",
107
+ required: ["id", "kind", "specRef"],
108
+ additionalProperties: false,
109
+ properties: {
110
+ id: { type: "string", minLength: 1 },
111
+ kind: { const: "subworkflow" },
112
+ specRef: { type: "string", minLength: 1 },
113
+ inputs: { type: "object" },
114
+ label: { type: "string" },
115
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
116
+ retryPolicy: { $ref: "#/$defs/retryPolicy" },
117
+ verificationPolicy: { $ref: "#/$defs/verificationPolicy" }
118
+ }
119
+ }
120
+ ]
121
+ }
122
+ },
123
+ edges: {
124
+ type: "array",
125
+ items: {
126
+ type: "object",
127
+ required: ["from", "to"],
128
+ additionalProperties: false,
129
+ properties: {
130
+ from: { type: "string", minLength: 1 },
131
+ to: { type: "string", minLength: 1 }
132
+ }
133
+ }
134
+ }
135
+ }
136
+ },
137
+ executionPolicy: { $ref: "#/$defs/executionPolicy" },
138
+ humanPolicy: { $ref: "#/$defs/humanPolicy" },
139
+ observabilityPolicy: { $ref: "#/$defs/observabilityPolicy" }
140
+ },
141
+ $defs: {
142
+ executionPolicy: {
143
+ type: "object",
144
+ additionalProperties: false,
145
+ properties: {
146
+ timeout: { type: "number" },
147
+ maxMemory: { type: "number" },
148
+ maxSteps: { type: "number", minimum: 1 },
149
+ costLimitUsd: { type: "number", exclusiveMinimum: 0 },
150
+ continueOnFailure: { type: "boolean" },
151
+ failureClassification: {
152
+ type: "array",
153
+ items: {
154
+ type: "object",
155
+ required: ["pattern", "category", "retry"],
156
+ additionalProperties: false,
157
+ properties: {
158
+ pattern: { type: "string", minLength: 1 },
159
+ category: { enum: ["transient", "permanent", "resource", "configuration"] },
160
+ retry: { type: "boolean" }
161
+ }
162
+ }
163
+ }
164
+ }
165
+ },
166
+ retryPolicy: {
167
+ type: "object",
168
+ required: ["maxAttempts", "backoff"],
169
+ additionalProperties: false,
170
+ properties: {
171
+ maxAttempts: { type: "number", minimum: 1 },
172
+ backoff: { enum: ["constant", "linear", "exponential"] },
173
+ initialDelay: { type: "number" },
174
+ maxDelay: { type: "number" },
175
+ retryOn: {
176
+ type: "array",
177
+ items: { enum: ["transient", "resource"] }
178
+ }
179
+ }
180
+ },
181
+ verificationPolicy: {
182
+ type: "object",
183
+ required: ["rules"],
184
+ additionalProperties: false,
185
+ properties: {
186
+ rules: {
187
+ type: "array",
188
+ items: {
189
+ oneOf: [
190
+ {
191
+ type: "object",
192
+ required: ["kind", "checkNodeId", "onFail"],
193
+ additionalProperties: false,
194
+ properties: {
195
+ kind: { const: "tool" },
196
+ checkNodeId: { type: "string", minLength: 1 },
197
+ onFail: { enum: ["block", "warn", "retry"] },
198
+ maxAttempts: { type: "number" }
199
+ }
200
+ },
201
+ {
202
+ type: "object",
203
+ required: ["kind", "checkNodeId", "onFail"],
204
+ additionalProperties: false,
205
+ properties: {
206
+ kind: { const: "llm" },
207
+ checkNodeId: { type: "string", minLength: 1 },
208
+ onFail: { enum: ["block", "warn", "retry"] },
209
+ maxAttempts: { type: "number" }
210
+ }
211
+ },
212
+ {
213
+ type: "object",
214
+ required: ["kind", "checkNodeId", "onFail"],
215
+ additionalProperties: false,
216
+ properties: {
217
+ kind: { const: "expression" },
218
+ checkNodeId: { type: "string", minLength: 1 },
219
+ onFail: { enum: ["block", "warn", "retry"] },
220
+ maxAttempts: { type: "number" }
221
+ }
222
+ }
223
+ ]
224
+ }
225
+ }
226
+ }
227
+ },
228
+ humanPolicy: {
229
+ type: "object",
230
+ additionalProperties: false,
231
+ properties: {
232
+ defaultTimeout: { type: "number" },
233
+ allowAsync: { type: "boolean" },
234
+ notificationChannels: {
235
+ type: "array",
236
+ items: { type: "string" }
237
+ }
238
+ }
239
+ },
240
+ observabilityPolicy: {
241
+ type: "object",
242
+ additionalProperties: false,
243
+ properties: {
244
+ tracing: { type: "boolean" },
245
+ metrics: { type: "boolean" },
246
+ logLevel: { enum: ["debug", "info", "warn", "error"] },
247
+ logDestinations: {
248
+ type: "array",
249
+ items: { type: "string" }
250
+ }
251
+ }
252
+ }
253
+ }
254
+ };
@@ -0,0 +1,319 @@
1
+ /**
2
+ * Lasso Harness Specification Types
3
+ *
4
+ * Declarative contract for defining autonomous task workflows.
5
+ */
6
+
7
+ // ============================================================================
8
+ // Core Harness Spec
9
+ // ============================================================================
10
+
11
+ export interface HarnessSpec {
12
+ /** Unique name for this harness */
13
+ name: string;
14
+
15
+ /** Task graph defining the workflow */
16
+ graph: TaskGraph;
17
+
18
+ /** Global execution policies (optional) */
19
+ executionPolicy?: ExecutionPolicy;
20
+
21
+ /** Human intervention policies (optional) */
22
+ humanPolicy?: HumanPolicy;
23
+
24
+ /** Observability configuration (optional) */
25
+ observabilityPolicy?: ObservabilityPolicy;
26
+ }
27
+
28
+ // ============================================================================
29
+ // Task Graph
30
+ // ============================================================================
31
+
32
+ export interface TaskGraph {
33
+ /** ID of the entry node where execution begins */
34
+ entryNodeId: string;
35
+
36
+ /** All nodes in the graph */
37
+ nodes: TaskNode[];
38
+
39
+ /** Edges connecting nodes */
40
+ edges: TaskEdge[];
41
+ }
42
+
43
+ export interface TaskEdge {
44
+ /** Source node ID */
45
+ from: string;
46
+
47
+ /** Target node ID */
48
+ to: string;
49
+ }
50
+
51
+ // ============================================================================
52
+ // Node Types
53
+ // ============================================================================
54
+
55
+ export type TaskNode =
56
+ | ToolNode
57
+ | LlmNode
58
+ | HumanNode
59
+ | ConditionNode
60
+ | MergeNode
61
+ | SubworkflowNode;
62
+
63
+ export interface BaseNode {
64
+ /** Unique node identifier */
65
+ id: string;
66
+
67
+ /** Optional human-readable label */
68
+ label?: string;
69
+
70
+ /** Execution policy for this node */
71
+ executionPolicy?: ExecutionPolicy;
72
+
73
+ /** Retry policy for this node (only valid for tool, llm, subworkflow nodes) */
74
+ retryPolicy?: RetryPolicy;
75
+
76
+ /** Verification policy for this node */
77
+ verificationPolicy?: VerificationPolicy;
78
+ }
79
+
80
+ /** Execute a tool command */
81
+ export interface ToolNode extends BaseNode {
82
+ kind: "tool";
83
+
84
+ /** Tool name or path */
85
+ tool: string;
86
+
87
+ /** Arguments to pass to the tool */
88
+ args: string[];
89
+
90
+ /** Environment variables (optional) */
91
+ env?: Record<string, string>;
92
+
93
+ /** Working directory (optional) */
94
+ cwd?: string;
95
+ }
96
+
97
+ /** Execute an LLM prompt */
98
+ export interface LlmNode extends BaseNode {
99
+ kind: "llm";
100
+
101
+ /** LLM provider identifier */
102
+ provider: string;
103
+
104
+ /** Model name */
105
+ model: string;
106
+
107
+ /** Prompt template or literal */
108
+ prompt: string;
109
+
110
+ /** Optional system message */
111
+ system?: string;
112
+
113
+ /** Temperature (optional) */
114
+ temperature?: number;
115
+
116
+ /** Max tokens (optional) */
117
+ maxTokens?: number;
118
+ }
119
+
120
+ /** Wait for human input/approval */
121
+ export interface HumanNode extends BaseNode {
122
+ kind: "human";
123
+
124
+ /** Prompt to show the human */
125
+ prompt: string;
126
+
127
+ /** Type of human interaction */
128
+ interactionType: "approval" | "input" | "choice";
129
+
130
+ /** For choice interactions, the available options */
131
+ options?: string[];
132
+
133
+ /** Timeout in seconds (optional) */
134
+ timeout?: number;
135
+ }
136
+
137
+ /** Conditional branching based on expression */
138
+ export interface ConditionNode extends BaseNode {
139
+ kind: "condition";
140
+
141
+ /** Condition expression to evaluate */
142
+ condition: string;
143
+
144
+ /** Node ID to execute if condition is true */
145
+ thenNodeId: string;
146
+
147
+ /** Node ID to execute if condition is false */
148
+ elseNodeId: string;
149
+ }
150
+
151
+ /** Merge point for parallel branches */
152
+ export interface MergeNode extends BaseNode {
153
+ kind: "merge";
154
+
155
+ /** List of node IDs to wait for */
156
+ waitFor: string[];
157
+
158
+ /** Merge strategy */
159
+ strategy?: "all" | "any" | "majority";
160
+ }
161
+
162
+ /** Execute a sub-workflow */
163
+ export interface SubworkflowNode extends BaseNode {
164
+ kind: "subworkflow";
165
+
166
+ /** Reference to another harness spec */
167
+ specRef: string;
168
+
169
+ /** Input parameters to pass to the subworkflow */
170
+ inputs?: Record<string, any>;
171
+ }
172
+
173
+ // ============================================================================
174
+ // Execution Policies
175
+ // ============================================================================
176
+
177
+ export interface ExecutionPolicy {
178
+ /** Timeout in seconds (optional) */
179
+ timeout?: number;
180
+
181
+ /** Maximum memory in MB (optional) */
182
+ maxMemory?: number;
183
+
184
+ /** Maximum number of node executions (optional) */
185
+ maxSteps?: number;
186
+
187
+ /** Maximum LLM cost in USD (optional) */
188
+ costLimitUsd?: number;
189
+
190
+ /** Whether to continue on failure */
191
+ continueOnFailure?: boolean;
192
+
193
+ /** Failure classification rules */
194
+ failureClassification?: FailureClassification[];
195
+ }
196
+
197
+ export interface FailureClassification {
198
+ /** Pattern to match against error messages */
199
+ pattern: string;
200
+
201
+ /** Classification category */
202
+ category: "transient" | "permanent" | "resource" | "configuration";
203
+
204
+ /** Whether to retry on this classification */
205
+ retry: boolean;
206
+ }
207
+
208
+ // ============================================================================
209
+ // Retry Policy
210
+ // ============================================================================
211
+
212
+ export interface RetryPolicy {
213
+ /** Maximum number of retry attempts */
214
+ maxAttempts: number;
215
+
216
+ /** Backoff strategy */
217
+ backoff: "constant" | "linear" | "exponential";
218
+
219
+ /** Initial delay in seconds (optional) */
220
+ initialDelay?: number;
221
+
222
+ /** Maximum delay in seconds (optional) */
223
+ maxDelay?: number;
224
+
225
+ /** Retry only on specific failure categories (optional) */
226
+ retryOn?: Array<"transient" | "resource">;
227
+ }
228
+
229
+ // ============================================================================
230
+ // Verification Policy
231
+ // ============================================================================
232
+
233
+ export interface VerificationPolicy {
234
+ /** Verification rules */
235
+ rules: VerificationRule[];
236
+
237
+ /** Verification strategy */
238
+ strategy?: "all-must-pass" | "first-pass" | "any-block";
239
+ }
240
+
241
+ export type VerificationRule =
242
+ | ToolVerificationRule
243
+ | LlmVerificationRule
244
+ | ExpressionVerificationRule;
245
+
246
+ export interface ToolVerificationRule {
247
+ /** Verification kind - tool verifier */
248
+ kind: "tool";
249
+
250
+ /** Node ID of the tool verification check to run */
251
+ checkNodeId: string;
252
+
253
+ /** Action to take on verification failure */
254
+ onFail: "block" | "warn" | "retry";
255
+
256
+ /** Maximum verification attempts (optional) */
257
+ maxAttempts?: number;
258
+ }
259
+
260
+ export interface LlmVerificationRule {
261
+ /** Verification kind - LLM verifier */
262
+ kind: "llm";
263
+
264
+ /** Node ID of the LLM verification check to run */
265
+ checkNodeId: string;
266
+
267
+ /** Action to take on verification failure */
268
+ onFail: "block" | "warn" | "retry";
269
+
270
+ /** Maximum verification attempts (optional) */
271
+ maxAttempts?: number;
272
+ }
273
+
274
+ export interface ExpressionVerificationRule {
275
+ /** Verification kind - expression verifier */
276
+ kind: "expression";
277
+
278
+ /** Node ID of the condition verification check to run */
279
+ checkNodeId: string;
280
+
281
+ /** Action to take on verification failure */
282
+ onFail: "block" | "warn" | "retry";
283
+
284
+ /** Maximum verification attempts (optional) */
285
+ maxAttempts?: number;
286
+ }
287
+
288
+ // ============================================================================
289
+ // Human Policy
290
+ // ============================================================================
291
+
292
+ export interface HumanPolicy {
293
+ /** Default timeout for human interactions in seconds */
294
+ defaultTimeout?: number;
295
+
296
+ /** Whether to allow asynchronous human interactions */
297
+ allowAsync?: boolean;
298
+
299
+ /** Notification channels for human interventions */
300
+ notificationChannels?: string[];
301
+ }
302
+
303
+ // ============================================================================
304
+ // Observability Policy
305
+ // ============================================================================
306
+
307
+ export interface ObservabilityPolicy {
308
+ /** Whether to collect traces */
309
+ tracing?: boolean;
310
+
311
+ /** Whether to collect metrics */
312
+ metrics?: boolean;
313
+
314
+ /** Log level */
315
+ logLevel?: "debug" | "info" | "warn" | "error";
316
+
317
+ /** Custom log destinations */
318
+ logDestinations?: string[];
319
+ }