artifact-contracts 0.1.1 → 0.2.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 (113) hide show
  1. package/README.md +254 -2
  2. package/cli-contract.yaml +529 -0
  3. package/dist/agents/index.d.ts +3 -0
  4. package/dist/agents/index.d.ts.map +1 -0
  5. package/dist/agents/index.js +2 -0
  6. package/dist/agents/index.js.map +1 -0
  7. package/dist/agents/orchestrator.d.ts +3 -0
  8. package/dist/agents/orchestrator.d.ts.map +1 -0
  9. package/dist/agents/orchestrator.js +109 -0
  10. package/dist/agents/orchestrator.js.map +1 -0
  11. package/dist/agents/types.d.ts +21 -0
  12. package/dist/agents/types.d.ts.map +1 -0
  13. package/dist/agents/types.js +2 -0
  14. package/dist/agents/types.js.map +1 -0
  15. package/dist/cli/audit.d.ts +12 -0
  16. package/dist/cli/audit.d.ts.map +1 -0
  17. package/dist/cli/audit.js +122 -0
  18. package/dist/cli/audit.js.map +1 -0
  19. package/dist/cli/explain.d.ts +5 -0
  20. package/dist/cli/explain.d.ts.map +1 -0
  21. package/dist/cli/explain.js +47 -0
  22. package/dist/cli/explain.js.map +1 -0
  23. package/dist/cli/index.d.ts +3 -0
  24. package/dist/cli/index.d.ts.map +1 -0
  25. package/dist/cli/index.js +35 -0
  26. package/dist/cli/index.js.map +1 -0
  27. package/dist/cli/list.d.ts +7 -0
  28. package/dist/cli/list.d.ts.map +1 -0
  29. package/dist/cli/list.js +49 -0
  30. package/dist/cli/list.js.map +1 -0
  31. package/dist/cli/resolve.d.ts +5 -0
  32. package/dist/cli/resolve.d.ts.map +1 -0
  33. package/dist/cli/resolve.js +21 -0
  34. package/dist/cli/resolve.js.map +1 -0
  35. package/dist/cli/validate.d.ts +5 -0
  36. package/dist/cli/validate.d.ts.map +1 -0
  37. package/dist/cli/validate.js +36 -0
  38. package/dist/cli/validate.js.map +1 -0
  39. package/dist/core/index.d.ts +10 -0
  40. package/dist/core/index.d.ts.map +1 -0
  41. package/dist/core/index.js +6 -0
  42. package/dist/core/index.js.map +1 -0
  43. package/dist/core/lookup.d.ts +12 -0
  44. package/dist/core/lookup.d.ts.map +1 -0
  45. package/dist/core/lookup.js +24 -0
  46. package/dist/core/lookup.js.map +1 -0
  47. package/dist/core/matcher.d.ts +3 -0
  48. package/dist/core/matcher.d.ts.map +1 -0
  49. package/dist/core/matcher.js +14 -0
  50. package/dist/core/matcher.js.map +1 -0
  51. package/dist/core/resolver.d.ts +18 -0
  52. package/dist/core/resolver.d.ts.map +1 -0
  53. package/dist/core/resolver.js +98 -0
  54. package/dist/core/resolver.js.map +1 -0
  55. package/dist/core/schema.d.ts +160 -0
  56. package/dist/core/schema.d.ts.map +1 -0
  57. package/dist/core/schema.js +69 -0
  58. package/dist/core/schema.js.map +1 -0
  59. package/dist/core/validator.d.ts +16 -0
  60. package/dist/core/validator.d.ts.map +1 -0
  61. package/dist/core/validator.js +86 -0
  62. package/dist/core/validator.js.map +1 -0
  63. package/dist/generated/commands.d.ts +2 -0
  64. package/dist/generated/commands.d.ts.map +1 -0
  65. package/dist/generated/commands.js +2 -0
  66. package/dist/generated/commands.js.map +1 -0
  67. package/dist/generated/dsl/agents.d.ts +34 -0
  68. package/dist/generated/dsl/agents.d.ts.map +1 -0
  69. package/dist/generated/dsl/agents.js +42 -0
  70. package/dist/generated/dsl/agents.js.map +1 -0
  71. package/dist/generated/dsl/handoffs.d.ts +339 -0
  72. package/dist/generated/dsl/handoffs.d.ts.map +1 -0
  73. package/dist/generated/dsl/handoffs.js +74 -0
  74. package/dist/generated/dsl/handoffs.js.map +1 -0
  75. package/dist/generated/dsl/index.d.ts +13 -0
  76. package/dist/generated/dsl/index.d.ts.map +1 -0
  77. package/dist/generated/dsl/index.js +10 -0
  78. package/dist/generated/dsl/index.js.map +1 -0
  79. package/dist/generated/dsl/tasks.d.ts +23 -0
  80. package/dist/generated/dsl/tasks.d.ts.map +1 -0
  81. package/dist/generated/dsl/tasks.js +25 -0
  82. package/dist/generated/dsl/tasks.js.map +1 -0
  83. package/dist/generated/dsl/workflows.d.ts +31 -0
  84. package/dist/generated/dsl/workflows.d.ts.map +1 -0
  85. package/dist/generated/dsl/workflows.js +32 -0
  86. package/dist/generated/dsl/workflows.js.map +1 -0
  87. package/dist/generated/index.d.ts +7 -0
  88. package/dist/generated/index.d.ts.map +1 -0
  89. package/dist/generated/index.js +7 -0
  90. package/dist/generated/index.js.map +1 -0
  91. package/dist/generated/policy.d.ts +146 -0
  92. package/dist/generated/policy.d.ts.map +1 -0
  93. package/dist/generated/policy.js +236 -0
  94. package/dist/generated/policy.js.map +1 -0
  95. package/dist/generated/program.d.ts +33 -0
  96. package/dist/generated/program.d.ts.map +1 -0
  97. package/dist/generated/program.js +92 -0
  98. package/dist/generated/program.js.map +1 -0
  99. package/dist/generated/schemas.d.ts +471 -0
  100. package/dist/generated/schemas.d.ts.map +1 -0
  101. package/dist/generated/schemas.js +640 -0
  102. package/dist/generated/schemas.js.map +1 -0
  103. package/dist/generated/types.d.ts +187 -0
  104. package/dist/generated/types.d.ts.map +1 -0
  105. package/dist/generated/types.js +3 -0
  106. package/dist/generated/types.js.map +1 -0
  107. package/dist/index.d.ts +4 -3
  108. package/dist/index.d.ts.map +1 -0
  109. package/dist/index.js +3 -5
  110. package/dist/index.js.map +1 -0
  111. package/package.json +47 -10
  112. package/schemas/2026A.config.json +47 -0
  113. package/schemas/2026A.json +116 -0
@@ -0,0 +1,529 @@
1
+ # yaml-language-server: $schema=./node_modules/cli-contracts/schemas/cli-contract.schema.json
2
+ cliContracts: 0.1.0
3
+
4
+ info:
5
+ title: artifact-contracts CLI
6
+ version: 0.1.1
7
+ description: >-
8
+ Declarative artifact registry — define file properties, resolve
9
+ paths to artifact IDs, and detect definition overlaps.
10
+ stdout is reserved for primary output (JSON/YAML/text result);
11
+ all diagnostics and progress messages go to stderr.
12
+ license:
13
+ name: MIT
14
+ contact:
15
+ name: foo-ogawa
16
+ url: https://github.com/foo-ogawa/artifact-contracts
17
+
18
+ commandSets:
19
+ artifact-contracts:
20
+ summary: >-
21
+ Artifact registry CLI — validate definitions, resolve artifacts,
22
+ list registered entries, and explain file properties.
23
+ executable: artifact-contracts
24
+
25
+ globalOptions:
26
+ - name: version
27
+ aliases: [V]
28
+ description: Output the version number
29
+ schema:
30
+ type: boolean
31
+ - name: help
32
+ aliases: [h]
33
+ description: Display help for command
34
+ schema:
35
+ type: boolean
36
+
37
+ commands:
38
+ validate:
39
+ summary: Validate artifact-contracts definitions
40
+ description: >-
41
+ Validates artifact-contracts.yaml against the schema, checks
42
+ artifact ID naming conventions, ensures path_patterns are
43
+ non-empty, and optionally detects overlapping definitions
44
+ against real repository files.
45
+ options:
46
+ - name: config
47
+ description: Path to artifact-contracts.config.yaml
48
+ valueName: path
49
+ - name: check-files
50
+ description: >-
51
+ Scan repository files to detect path_patterns overlaps
52
+ that static glob analysis cannot fully determine.
53
+ When enabled, reads all files from git ls-files or glob.
54
+ schema:
55
+ type: boolean
56
+ effects:
57
+ riskLevel: low
58
+ reads:
59
+ - target: artifact-definitions
60
+ description: artifact-contracts.yaml and config
61
+ - target: repository-files
62
+ description: >-
63
+ All tracked files via git ls-files.
64
+ Only read when --check-files is specified.
65
+ executionMode: normal
66
+ x-agent:
67
+ expectedDurationMs: 5000
68
+ retryableExitCodes: []
69
+ stdout:
70
+ schema:
71
+ $ref: "#/components/schemas/ValidationResult"
72
+ description: >-
73
+ Validation diagnostics. On exit 0 stdout is empty (diagnostics
74
+ go to stderr). On exit 1/2 with --format json, structured
75
+ diagnostics are written to stdout.
76
+ exits:
77
+ "0":
78
+ description: Validation passed with no errors
79
+ "1":
80
+ description: Schema or naming convention errors detected
81
+ "2":
82
+ description: Overlap detected — same path matches multiple artifacts
83
+ "3":
84
+ description: Config or input file not found / parse error
85
+
86
+ resolve:
87
+ summary: Output fully-resolved artifact definitions
88
+ description: >-
89
+ Expands config variables, applies authority-based defaults
90
+ for manual_edit and change_control, and outputs the complete
91
+ resolved DSL. Default format is yaml.
92
+ options:
93
+ - name: config
94
+ description: Path to artifact-contracts.config.yaml
95
+ valueName: path
96
+ - name: format
97
+ description: "Output format (default: yaml)"
98
+ schema:
99
+ type: string
100
+ enum: [yaml, json]
101
+ effects:
102
+ riskLevel: low
103
+ reads:
104
+ - target: artifact-definitions
105
+ description: artifact-contracts.yaml and config
106
+ executionMode: normal
107
+ x-agent:
108
+ expectedDurationMs: 2000
109
+ retryableExitCodes: []
110
+ stdout:
111
+ schema:
112
+ $ref: "#/components/schemas/ResolvedDefinitions"
113
+ description: >-
114
+ Fully resolved artifact definitions with authority-based
115
+ defaults applied. Format varies by --format (yaml default, json).
116
+ exits:
117
+ "0":
118
+ description: Successfully output resolved definitions
119
+ "1":
120
+ description: Error resolving definitions
121
+ "3":
122
+ description: Config or input file not found / parse error
123
+
124
+ list:
125
+ summary: List registered artifacts
126
+ description: >-
127
+ Displays all registered artifacts with optional filtering
128
+ by authority. Use --path for simple ID lookup; use explain
129
+ for full governance metadata. Default format is text.
130
+ options:
131
+ - name: config
132
+ description: Path to artifact-contracts.config.yaml
133
+ valueName: path
134
+ - name: authority
135
+ description: Filter by authority type
136
+ schema:
137
+ type: string
138
+ enum: [canonical, derived, generated, control]
139
+ - name: path
140
+ description: >-
141
+ Reverse-lookup — show artifact IDs matching this file
142
+ path. For full governance details, use the explain command.
143
+ valueName: file
144
+ - name: format
145
+ description: "Output format (default: text)"
146
+ schema:
147
+ type: string
148
+ enum: [text, json, yaml]
149
+ effects:
150
+ riskLevel: low
151
+ reads:
152
+ - target: artifact-definitions
153
+ description: artifact-contracts.yaml and config
154
+ executionMode: normal
155
+ x-agent:
156
+ expectedDurationMs: 2000
157
+ retryableExitCodes: []
158
+ stdout:
159
+ schema:
160
+ $ref: "#/components/schemas/ArtifactList"
161
+ description: >-
162
+ List of matching artifacts. Schema applies to --format json
163
+ and --format yaml. Text format is human-readable only.
164
+ exits:
165
+ "0":
166
+ description: Successfully listed artifacts
167
+ "1":
168
+ description: Error reading definitions
169
+ "3":
170
+ description: Config or input file not found / parse error
171
+
172
+ explain:
173
+ summary: Explain artifact properties for a file path
174
+ description: >-
175
+ Given a file path, resolves the matching artifact and displays
176
+ its full governance properties — artifact ID, authority,
177
+ manual_edit policy, change_control, and other metadata.
178
+ Useful for humans and LLM agents to understand file
179
+ governance. Default format is text.
180
+ arguments:
181
+ - name: path
182
+ description: File path to explain
183
+ required: true
184
+ options:
185
+ - name: config
186
+ description: Path to artifact-contracts.config.yaml
187
+ valueName: path
188
+ - name: format
189
+ description: "Output format (default: text)"
190
+ schema:
191
+ type: string
192
+ enum: [text, json, yaml]
193
+ effects:
194
+ riskLevel: low
195
+ reads:
196
+ - target: artifact-definitions
197
+ description: artifact-contracts.yaml and config
198
+ executionMode: normal
199
+ x-agent:
200
+ expectedDurationMs: 2000
201
+ retryableExitCodes: []
202
+ stdout:
203
+ schema:
204
+ $ref: "#/components/schemas/ArtifactExplanation"
205
+ description: >-
206
+ Artifact governance metadata for the resolved path.
207
+ Schema applies to --format json and --format yaml.
208
+ Text format is human-readable only.
209
+ exits:
210
+ "0":
211
+ description: Path resolved to an artifact
212
+ "2":
213
+ description: Overlap — path matches multiple artifacts
214
+ "3":
215
+ description: Config or input file not found / parse error
216
+ "4":
217
+ description: Path does not match any registered artifact
218
+
219
+ audit:
220
+ summary: LLM-based semantic audit of artifact definitions
221
+ description: >-
222
+ Performs semantic analysis of artifact definitions using LLM
223
+ to identify quality issues that static validation cannot
224
+ detect — naming inconsistencies, missing coverage for common
225
+ file types, authority mismatches, and structural improvements.
226
+ options:
227
+ - name: config
228
+ description: Path to artifact-contracts.config.yaml
229
+ valueName: path
230
+ - name: adapter
231
+ description: LLM adapter to use
232
+ schema:
233
+ type: string
234
+ enum: [mock, cursor, openai, claude, gemini]
235
+ - name: model
236
+ description: Model name to pass to the adapter
237
+ - name: show-prompt
238
+ description: Output the constructed prompt without calling the LLM API
239
+ schema:
240
+ type: boolean
241
+ - name: dry-run
242
+ aliases: [n]
243
+ description: Alias for --show-prompt (output prompt without LLM call)
244
+ schema:
245
+ type: boolean
246
+ - name: fail-on
247
+ description: >-
248
+ Minimum severity that causes exit 10. Ordering:
249
+ critical > error > warning > info. For example,
250
+ --fail-on warning exits 10 on warning, error, or critical.
251
+ schema:
252
+ type: string
253
+ enum: [info, warning, error, critical]
254
+ - name: output
255
+ aliases: [o]
256
+ description: Write result to a file instead of stdout
257
+ valueName: file
258
+ - name: report-format
259
+ description: >-
260
+ Output format for the report (default: text).
261
+ LLM commands use --report-format; deterministic
262
+ commands use --format.
263
+ schema:
264
+ type: string
265
+ enum: [text, json, yaml]
266
+ effects:
267
+ riskLevel: medium
268
+ reads:
269
+ - target: artifact-definitions
270
+ description: artifact-contracts.yaml and config
271
+ writes:
272
+ - target: output-file
273
+ description: Written only when --output is specified
274
+ overwrite: true
275
+ network:
276
+ description: LLM API calls to configured provider
277
+ idempotent: false
278
+ executionMode: normal
279
+ stdout:
280
+ schema:
281
+ $ref: "#/components/schemas/AgentAuditResult"
282
+ description: >-
283
+ Structured audit result conforming to the AgentAuditResult
284
+ schema. Format varies by --report-format (json, yaml, text).
285
+ x-agent:
286
+ expectedDurationMs: 120000
287
+ retryableExitCodes: [1]
288
+ recommendedBeforeUse:
289
+ - "Run with --show-prompt first to preview the prompt"
290
+ exits:
291
+ "0":
292
+ description: Audit completed — no findings above threshold
293
+ "1":
294
+ description: General / transient error
295
+ "3":
296
+ description: Config or input file not found / parse error
297
+ "10":
298
+ description: Findings detected above --fail-on threshold
299
+ "11":
300
+ description: agent-contracts-runtime is not installed
301
+ "12":
302
+ description: Adapter initialization error (missing API key, etc.)
303
+
304
+ env:
305
+ OPENAI_API_KEY:
306
+ description: >-
307
+ OpenAI API key. Required when --adapter openai is selected.
308
+ required: false
309
+ ANTHROPIC_API_KEY:
310
+ description: >-
311
+ Anthropic API key. Required when --adapter claude is selected.
312
+ required: false
313
+ GEMINI_API_KEY:
314
+ description: >-
315
+ Google Gemini API key. Required when --adapter gemini is selected.
316
+ required: false
317
+ CURSOR_API_KEY:
318
+ description: >-
319
+ Cursor API key. Required when --adapter cursor is selected.
320
+ required: false
321
+
322
+ components:
323
+ schemas:
324
+ AgentFinding:
325
+ type: object
326
+ properties:
327
+ id:
328
+ type: string
329
+ severity:
330
+ type: string
331
+ enum: [critical, error, warning, info]
332
+ category:
333
+ type: string
334
+ title:
335
+ type: string
336
+ description:
337
+ type: string
338
+ location:
339
+ type: string
340
+ target:
341
+ type: string
342
+ recommendation:
343
+ type: string
344
+ evidence:
345
+ type: array
346
+ items:
347
+ $ref: "#/components/schemas/AgentEvidence"
348
+ required: [id, severity, category, title, description]
349
+
350
+ AgentAuditResult:
351
+ type: object
352
+ properties:
353
+ summary:
354
+ type: string
355
+ riskLevel:
356
+ type: string
357
+ enum: [none, low, medium, high, critical]
358
+ findings:
359
+ type: array
360
+ items:
361
+ $ref: "#/components/schemas/AgentFinding"
362
+ recommendedActions:
363
+ type: array
364
+ items:
365
+ $ref: "#/components/schemas/AgentRecommendedAction"
366
+ metadata:
367
+ type: object
368
+ properties:
369
+ totalArtifacts:
370
+ type: integer
371
+ analyzedArtifacts:
372
+ type: integer
373
+ analysisScope:
374
+ type: string
375
+ required: [summary, riskLevel, findings, recommendedActions]
376
+
377
+ AgentEvidence:
378
+ type: object
379
+ properties:
380
+ kind:
381
+ type: string
382
+ enum: [schema, code, config, runtime, doc]
383
+ target:
384
+ type: string
385
+ location:
386
+ type: string
387
+ excerpt:
388
+ type: string
389
+ reasoning:
390
+ type: string
391
+ required: [kind]
392
+
393
+ AgentRecommendedAction:
394
+ type: object
395
+ properties:
396
+ action:
397
+ type: string
398
+ priority:
399
+ type: string
400
+ enum: [high, medium, low]
401
+ description:
402
+ type: string
403
+ required: [action, priority]
404
+
405
+ ResolvedDefinitions:
406
+ type: object
407
+ description: Output of the resolve command
408
+ properties:
409
+ artifactContracts:
410
+ type: string
411
+ system:
412
+ type: object
413
+ properties:
414
+ id:
415
+ type: string
416
+ name:
417
+ type: string
418
+ required: [id]
419
+ artifacts:
420
+ type: object
421
+ description: Map of artifact ID to resolved artifact definition
422
+ additionalProperties:
423
+ $ref: "#/components/schemas/ArtifactDefinition"
424
+ required: [artifactContracts, system, artifacts]
425
+
426
+ ArtifactExplanation:
427
+ type: object
428
+ description: Output of the explain command (json/yaml format)
429
+ properties:
430
+ id:
431
+ type: string
432
+ type:
433
+ type: string
434
+ authority:
435
+ type: string
436
+ manual_edit:
437
+ type: string
438
+ change_control:
439
+ type: string
440
+ visibility:
441
+ type: string
442
+ description:
443
+ type: string
444
+ path_patterns:
445
+ type: array
446
+ items:
447
+ type: string
448
+ exclude_patterns:
449
+ type: array
450
+ items:
451
+ type: string
452
+ required: [id, type, authority, manual_edit, change_control]
453
+
454
+ ArtifactDefinition:
455
+ type: object
456
+ description: A single resolved artifact definition
457
+ properties:
458
+ type:
459
+ type: string
460
+ authority:
461
+ type: string
462
+ enum: [canonical, derived, generated, control]
463
+ manual_edit:
464
+ type: string
465
+ enum: [allowed, discouraged, forbidden]
466
+ change_control:
467
+ type: string
468
+ enum: [none, approval-required, regeneration-required]
469
+ visibility:
470
+ type: string
471
+ enum: [public, internal, private]
472
+ description:
473
+ type: string
474
+ path_patterns:
475
+ type: array
476
+ items:
477
+ type: string
478
+ exclude_patterns:
479
+ type: array
480
+ items:
481
+ type: string
482
+ states:
483
+ type: array
484
+ items:
485
+ type: string
486
+ required: [type, authority, manual_edit, change_control, visibility, path_patterns]
487
+
488
+ ArtifactList:
489
+ type: object
490
+ description: Output of the list command (json/yaml format)
491
+ properties:
492
+ artifacts:
493
+ type: object
494
+ description: Map of artifact ID to resolved artifact definition
495
+ additionalProperties:
496
+ $ref: "#/components/schemas/ArtifactDefinition"
497
+
498
+ ValidationResult:
499
+ type: object
500
+ description: Output of the validate command (json format, on error)
501
+ properties:
502
+ valid:
503
+ type: boolean
504
+ diagnostics:
505
+ type: array
506
+ items:
507
+ type: object
508
+ properties:
509
+ path:
510
+ type: string
511
+ message:
512
+ type: string
513
+ severity:
514
+ type: string
515
+ enum: [error, warning]
516
+ required: [message, severity]
517
+ overlaps:
518
+ type: array
519
+ items:
520
+ type: object
521
+ properties:
522
+ path:
523
+ type: string
524
+ matchingArtifacts:
525
+ type: array
526
+ items:
527
+ type: string
528
+ required: [path, matchingArtifacts]
529
+ required: [valid, diagnostics, overlaps]
@@ -0,0 +1,3 @@
1
+ export { runAgentTask } from "./orchestrator.js";
2
+ export type { TaskId, AuditConfig, AuditOptions, AuditRunResult } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { runAgentTask } from "./orchestrator.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { TaskId, AuditConfig, AuditOptions, AuditRunResult } from "./types.js";
2
+ export declare function runAgentTask(userRequest: string, taskId: TaskId, auditConfig: AuditConfig, options: AuditOptions): Promise<AuditRunResult>;
3
+ //# sourceMappingURL=orchestrator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.d.ts","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKpF,wBAAsB,YAAY,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,cAAc,CAAC,CAyFzB"}
@@ -0,0 +1,109 @@
1
+ const EXIT_RUNTIME_MISSING = 11;
2
+ const EXIT_ADAPTER_ERROR = 12;
3
+ export async function runAgentTask(userRequest, taskId, auditConfig, options) {
4
+ if (options.dryRun) {
5
+ return {
6
+ taskId,
7
+ data: null,
8
+ raw: "",
9
+ prompt: userRequest,
10
+ dryRun: true,
11
+ status: "success",
12
+ followUpsUsed: 0,
13
+ retriesUsed: 0,
14
+ };
15
+ }
16
+ const RUNTIME_PKG = ["agent-contracts", "runtime"].join("-");
17
+ let runTask;
18
+ let agentRegistry;
19
+ let taskRegistry;
20
+ let handoffSchemas;
21
+ try {
22
+ const runtime = await import(RUNTIME_PKG);
23
+ runTask = runtime.runTask;
24
+ }
25
+ catch {
26
+ throw Object.assign(new Error("agent-contracts-runtime is not installed. " +
27
+ "Install it to use this command, or use --dry-run to inspect the prompt.\n" +
28
+ " npm install agent-contracts-runtime"), { exitCode: EXIT_RUNTIME_MISSING });
29
+ }
30
+ try {
31
+ const dsl = await import("../generated/dsl/index.js");
32
+ agentRegistry = dsl.agentRegistry;
33
+ taskRegistry = dsl.taskRegistry;
34
+ handoffSchemas = dsl.handoffSchemas;
35
+ }
36
+ catch {
37
+ agentRegistry = {};
38
+ taskRegistry = {};
39
+ handoffSchemas = {};
40
+ }
41
+ const adapterName = auditConfig.adapter ?? "mock";
42
+ let adapter;
43
+ try {
44
+ adapter = await createAdapter(RUNTIME_PKG, adapterName, auditConfig);
45
+ }
46
+ catch (err) {
47
+ throw Object.assign(err, { exitCode: EXIT_ADAPTER_ERROR });
48
+ }
49
+ const result = await runTask(adapter, taskId, {
50
+ user_request: userRequest,
51
+ }, {
52
+ maxFollowUps: 3,
53
+ maxRetries: 1,
54
+ agentRegistry,
55
+ taskRegistry,
56
+ handoffSchemas,
57
+ });
58
+ const outcome = result.outcome;
59
+ return {
60
+ taskId,
61
+ data: outcome.status === "success" ? (outcome.data ?? null) : null,
62
+ raw: outcome.raw ?? "",
63
+ status: outcome.status === "success" ? "success" : "error",
64
+ errorMessage: outcome.status === "error"
65
+ ? outcome.message
66
+ : outcome.status === "validation_error"
67
+ ? outcome.errors?.message
68
+ : undefined,
69
+ followUpsUsed: result.follow_ups_used,
70
+ retriesUsed: result.retries_used,
71
+ };
72
+ }
73
+ async function createAdapter(runtimePkg, name, config) {
74
+ switch (name) {
75
+ case "mock": {
76
+ const mod = await import(`${runtimePkg}/adapters/mock`);
77
+ return new mod.MockAdapter();
78
+ }
79
+ case "cursor": {
80
+ const mod = await import(`${runtimePkg}/adapters/cursor-sdk`);
81
+ return mod.CursorSdkAdapter.create({
82
+ apiKey: process.env.CURSOR_API_KEY,
83
+ model: config.model,
84
+ });
85
+ }
86
+ case "openai": {
87
+ const mod = await import(`${runtimePkg}/adapters/openai-agents-sdk`);
88
+ return new mod.OpenAIAgentsSdkAdapter({
89
+ model: config.model,
90
+ });
91
+ }
92
+ case "claude": {
93
+ const mod = await import(`${runtimePkg}/adapters/claude-agent-sdk`);
94
+ return new mod.ClaudeAgentSdkAdapter({
95
+ model: config.model,
96
+ });
97
+ }
98
+ case "gemini": {
99
+ const mod = await import(`${runtimePkg}/adapters/gemini-sdk`);
100
+ return new mod.GeminiSdkAdapter({
101
+ apiKey: process.env.GEMINI_API_KEY,
102
+ model: config.model,
103
+ });
104
+ }
105
+ default:
106
+ throw new Error(`Unknown adapter: ${name}`);
107
+ }
108
+ }
109
+ //# sourceMappingURL=orchestrator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/agents/orchestrator.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAmB,EACnB,MAAc,EACd,WAAwB,EACxB,OAAqB;IAErB,IAAI,OA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;
5
+ }
6
+ export interface AuditOptions {
7
+ dryRun: boolean;
8
+ failOn: string;
9
+ }
10
+ export interface AuditRunResult {
11
+ taskId: TaskId;
12
+ data: unknown;
13
+ raw: string;
14
+ prompt?: string;
15
+ dryRun?: boolean;
16
+ status: "success" | "error";
17
+ errorMessage?: string;
18
+ followUpsUsed: number;
19
+ retriesUsed: number;
20
+ }
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agents/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,4BAA4B,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB"}