agent-contracts-runtime 0.35.2 → 0.35.4
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.
- package/dist/agent-runtime.bundle.mjs +680 -455
- package/dist/agent-runtime.bundle.mjs.map +4 -4
- package/dsl/agents/implementation-auditor.yaml +5 -5
- package/dsl/agents/llm-feature-implementer.yaml +3 -3
- package/dsl/tasks.yaml +7 -7
- package/package.json +2 -2
- package/templates/implement-reference-templates.md +12 -12
- package/templates/implement-reference.md +4 -4
|
@@ -36,7 +36,7 @@ implementation-auditor:
|
|
|
36
36
|
|
|
37
37
|
### Layer 3: cli-contracts Compliance
|
|
38
38
|
- cli-contract.yaml has LLM commands with all standard options:
|
|
39
|
-
--adapter, --model, --
|
|
39
|
+
--adapter, --model, --show-prompt, --fail-on, --output, --report-format
|
|
40
40
|
- x-agent metadata present (riskLevel, safeDryRunOption, expectedDurationMs)
|
|
41
41
|
- Exit codes follow convention (0, 1, 3, 10, 11, 12)
|
|
42
42
|
- components/schemas includes AgentAuditResult and related types
|
|
@@ -46,7 +46,7 @@ implementation-auditor:
|
|
|
46
46
|
- src/agents/ module structure (orchestrator, context-builder, formatter, types)
|
|
47
47
|
- Context builder caps input at 16KB
|
|
48
48
|
- Formatter implements computeExitCode with correct threshold logic
|
|
49
|
-
- --
|
|
49
|
+
- --show-prompt returns prompt without LLM call
|
|
50
50
|
- No direct LLM API calls anywhere in the codebase
|
|
51
51
|
|
|
52
52
|
### Semantic Design Coherence
|
|
@@ -121,12 +121,12 @@ implementation-auditor:
|
|
|
121
121
|
# --- CLI contract audit ---
|
|
122
122
|
- >-
|
|
123
123
|
Check cli-contract.yaml for each LLM command: all six standard
|
|
124
|
-
options present (--adapter, --model, --
|
|
124
|
+
options present (--adapter, --model, --show-prompt, --fail-on,
|
|
125
125
|
--output, --report-format). Verify --report-format is used
|
|
126
126
|
(not --format).
|
|
127
127
|
- >-
|
|
128
128
|
Verify x-agent metadata on each LLM command: riskLevel,
|
|
129
|
-
safeDryRunOption (must be "
|
|
129
|
+
safeDryRunOption (must be "show-prompt"), expectedDurationMs.
|
|
130
130
|
Flag high-risk commands without requiresConfirmation.
|
|
131
131
|
- >-
|
|
132
132
|
Check exit code definitions: 0 (success), 1 (error), 3 (validation),
|
|
@@ -143,7 +143,7 @@ implementation-auditor:
|
|
|
143
143
|
functions with 16KB cap), formatter.ts (computeExitCode,
|
|
144
144
|
formatResultText, formatResultJson).
|
|
145
145
|
- >-
|
|
146
|
-
Check that --
|
|
146
|
+
Check that --show-prompt mode returns the constructed prompt without
|
|
147
147
|
making any LLM API call.
|
|
148
148
|
- >-
|
|
149
149
|
Scan for direct LLM API imports (@anthropic-ai/sdk, openai,
|
|
@@ -107,7 +107,7 @@ llm-feature-implementer:
|
|
|
107
107
|
# --- CLI contract update ---
|
|
108
108
|
- >-
|
|
109
109
|
Update cli-contract.yaml: add command definitions with standard LLM options
|
|
110
|
-
(--adapter, --model, --
|
|
110
|
+
(--adapter, --model, --show-prompt, --fail-on, --output, --report-format),
|
|
111
111
|
exit codes (0, 1, 3, 10, 11, 12), x-agent metadata, and register
|
|
112
112
|
AgentAuditResult/AgentFinding/AgentRecommendedAction in components/schemas.
|
|
113
113
|
|
|
@@ -155,7 +155,7 @@ llm-feature-implementer:
|
|
|
155
155
|
Standard LLM command options (all must be present):
|
|
156
156
|
--adapter <name> (mock|cursor|claude|openai|gemini, default varies),
|
|
157
157
|
--model <name> (optional override),
|
|
158
|
-
--
|
|
158
|
+
--show-prompt (output prompt without LLM call),
|
|
159
159
|
--fail-on <level> (warning|error|critical, default error),
|
|
160
160
|
--output/-o <file> (write to file instead of stdout),
|
|
161
161
|
--report-format <fmt> (json|text|yaml, default json).
|
|
@@ -235,7 +235,7 @@ llm-feature-implementer:
|
|
|
235
235
|
riskLevel (low for read-only analysis), requiresConfirmation (false
|
|
236
236
|
for read-only), idempotent (true for analysis), sideEffects ([network]),
|
|
237
237
|
sideEffectNote (describe network call and optional file write),
|
|
238
|
-
safeDryRunOption (
|
|
238
|
+
safeDryRunOption (show-prompt), expectedDurationMs (120000 typical),
|
|
239
239
|
retryableExitCodes ([1, 12]).
|
|
240
240
|
|
|
241
241
|
rules:
|
package/dsl/tasks.yaml
CHANGED
|
@@ -354,7 +354,7 @@ implement-llm-feature:
|
|
|
354
354
|
schema: { type: string, enum: [mock, cursor, claude, openai, gemini] }
|
|
355
355
|
- name: model
|
|
356
356
|
schema: { type: string }
|
|
357
|
-
- name:
|
|
357
|
+
- name: show-prompt
|
|
358
358
|
schema: { type: boolean, default: false }
|
|
359
359
|
- name: fail-on
|
|
360
360
|
schema: { type: string, enum: [warning, error, critical], default: error }
|
|
@@ -372,7 +372,7 @@ implement-llm-feature:
|
|
|
372
372
|
sideEffectNote: >-
|
|
373
373
|
Network calls to LLM provider when adapter is not mock.
|
|
374
374
|
Filesystem write only when --output is specified.
|
|
375
|
-
safeDryRunOption:
|
|
375
|
+
safeDryRunOption: show-prompt
|
|
376
376
|
expectedDurationMs: 120000
|
|
377
377
|
retryableExitCodes: [1, 12]
|
|
378
378
|
exits:
|
|
@@ -410,7 +410,7 @@ implement-llm-feature:
|
|
|
410
410
|
- Implement the complete src/agents/ module following the exact patterns
|
|
411
411
|
- Create CLI command handlers integrating with the project's existing CLI structure
|
|
412
412
|
- Update cli-contract.yaml with proper x-agent metadata and component schemas
|
|
413
|
-
- Ensure the implementation compiles and --
|
|
413
|
+
- Ensure the implementation compiles and --show-prompt mode works
|
|
414
414
|
|
|
415
415
|
completion_criteria:
|
|
416
416
|
- dsl/ directory contains valid DSL definitions that pass agent-runtime generate
|
|
@@ -423,11 +423,11 @@ implement-llm-feature:
|
|
|
423
423
|
- src/agents/formatter.ts implements computeExitCode with the standard exit code mapping
|
|
424
424
|
- src/commands/ has a handler for each new LLM command, passing cwd to AgentConfig
|
|
425
425
|
- CLI entry point uses cli-contracts' createProgram(handlers, version) with CommandHandlers interface
|
|
426
|
-
- cli-contract.yaml has all new commands with --adapter, --model, --
|
|
426
|
+
- cli-contract.yaml has all new commands with --adapter, --model, --show-prompt, --fail-on, --output, --report-format options
|
|
427
427
|
- cli-contract.yaml has x-agent metadata on each new command (riskLevel, safeDryRunOption, expectedDurationMs)
|
|
428
428
|
- components/schemas includes AgentAuditResult and related schemas
|
|
429
429
|
- All generated TypeScript compiles without type errors
|
|
430
|
-
- --
|
|
430
|
+
- --show-prompt returns the constructed prompt without calling the LLM
|
|
431
431
|
|
|
432
432
|
# =============================================================================
|
|
433
433
|
# Audit tasks — parallelized by layer
|
|
@@ -573,7 +573,7 @@ audit-cli-contract:
|
|
|
573
573
|
Parse cli-contract.yaml and check each LLM command:
|
|
574
574
|
|
|
575
575
|
ERROR: missing standard options (category: cli-contract-options):
|
|
576
|
-
- --adapter, --model, --
|
|
576
|
+
- --adapter, --model, --show-prompt, --fail-on, --output, --report-format
|
|
577
577
|
- Using --format instead of --report-format for LLM commands
|
|
578
578
|
|
|
579
579
|
ERROR: missing x-agent metadata (category: cli-contract-xagent):
|
|
@@ -625,7 +625,7 @@ audit-architecture:
|
|
|
625
625
|
- src/agents/formatter.ts exists with computeExitCode
|
|
626
626
|
|
|
627
627
|
Verify behavior (category: architecture-dry-run):
|
|
628
|
-
- --
|
|
628
|
+
- --show-prompt path returns the constructed prompt without calling the adapter
|
|
629
629
|
- buildTaskPrompt is used (not a placeholder string)
|
|
630
630
|
|
|
631
631
|
CRITICAL: context-builder SSoT violations (category: architecture-context-builder):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-contracts-runtime",
|
|
3
|
-
"version": "0.35.
|
|
3
|
+
"version": "0.35.4",
|
|
4
4
|
"description": "Runtime bridge for executing agent-contracts workflows on Agent SDKs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"node": ">=22.0.0"
|
|
95
95
|
},
|
|
96
96
|
"dependencies": {
|
|
97
|
-
"agent-contracts": "^0.
|
|
97
|
+
"agent-contracts": "^0.34.0",
|
|
98
98
|
"commander": "^12.1.0",
|
|
99
99
|
"dotenv": "^17.4.2",
|
|
100
100
|
"handlebars": "^4.7.9",
|
|
@@ -400,7 +400,7 @@ export interface AgentConfig {
|
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
export interface AgentOptions {
|
|
403
|
-
|
|
403
|
+
showPrompt?: boolean;
|
|
404
404
|
failOn?: "warning" | "error" | "critical";
|
|
405
405
|
}
|
|
406
406
|
|
|
@@ -409,7 +409,7 @@ export interface AgentRunResult {
|
|
|
409
409
|
data: {ResultType} | null;
|
|
410
410
|
raw: string;
|
|
411
411
|
prompt: string;
|
|
412
|
-
|
|
412
|
+
showPrompt: boolean;
|
|
413
413
|
status: "success" | "error" | "escalation" | "validation_error";
|
|
414
414
|
errorMessage?: string;
|
|
415
415
|
followUpsUsed: number;
|
|
@@ -468,8 +468,8 @@ export async function runAgentTask(
|
|
|
468
468
|
config: AgentConfig,
|
|
469
469
|
options: AgentOptions,
|
|
470
470
|
): Promise<AgentRunResult> {
|
|
471
|
-
if (options.
|
|
472
|
-
return { taskId, data: null, raw: "", prompt: userRequest,
|
|
471
|
+
if (options.showPrompt) {
|
|
472
|
+
return { taskId, data: null, raw: "", prompt: userRequest, showPrompt: true,
|
|
473
473
|
status: "success", followUpsUsed: 0, retriesUsed: 0 };
|
|
474
474
|
}
|
|
475
475
|
|
|
@@ -513,7 +513,7 @@ export async function runAgentTask(
|
|
|
513
513
|
data: outcome.status === "success" ? outcome.data : null,
|
|
514
514
|
raw: (outcome.raw as string) ?? "",
|
|
515
515
|
prompt: userRequest,
|
|
516
|
-
|
|
516
|
+
showPrompt: false,
|
|
517
517
|
status: outcome.status,
|
|
518
518
|
errorMessage:
|
|
519
519
|
outcome.status === "error" ? outcome.message :
|
|
@@ -532,7 +532,7 @@ export async function runAgentTask(
|
|
|
532
532
|
import type { AgentRunResult, AgentOptions } from "./types.js";
|
|
533
533
|
|
|
534
534
|
export function computeExitCode(result: AgentRunResult, options: AgentOptions): number {
|
|
535
|
-
if (result.
|
|
535
|
+
if (result.showPrompt) return 0;
|
|
536
536
|
if (result.status !== "success" || !result.data) return 1;
|
|
537
537
|
|
|
538
538
|
const failOn = options.failOn ?? "error";
|
|
@@ -545,7 +545,7 @@ export function computeExitCode(result: AgentRunResult, options: AgentOptions):
|
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
export function formatResultText(result: AgentRunResult): string {
|
|
548
|
-
if (result.
|
|
548
|
+
if (result.showPrompt) return result.prompt;
|
|
549
549
|
if (result.status !== "success" || !result.data) {
|
|
550
550
|
return result.errorMessage ?? `Task failed: ${result.status}`;
|
|
551
551
|
}
|
|
@@ -577,7 +577,7 @@ export function formatResultText(result: AgentRunResult): string {
|
|
|
577
577
|
}
|
|
578
578
|
|
|
579
579
|
export function formatResultJson(result: AgentRunResult): string {
|
|
580
|
-
if (result.
|
|
580
|
+
if (result.showPrompt) return JSON.stringify({ showPrompt: true, prompt: result.prompt }, null, 2);
|
|
581
581
|
if (!result.data) return JSON.stringify({ error: result.errorMessage, status: result.status }, null, 2);
|
|
582
582
|
return JSON.stringify(result.data, null, 2);
|
|
583
583
|
}
|
|
@@ -593,7 +593,7 @@ const audit = new Command("audit")
|
|
|
593
593
|
.argument("[target]", "file or directory to audit")
|
|
594
594
|
.option("--adapter <name>", "LLM adapter (cursor, openai, gemini, claude, mock)", "mock")
|
|
595
595
|
.option("--model <name>", "Model name to pass to the adapter")
|
|
596
|
-
.option("--
|
|
596
|
+
.option("--show-prompt", "Output the constructed prompt without calling the LLM API")
|
|
597
597
|
.option("--fail-on <level>", "Minimum severity for non-zero exit", "error")
|
|
598
598
|
.option("-o, --output <file>", "Write result to file instead of stdout")
|
|
599
599
|
.option("--report-format <fmt>", "Output format (json, text, yaml)", "json")
|
|
@@ -632,8 +632,8 @@ commands:
|
|
|
632
632
|
schema:
|
|
633
633
|
type: string
|
|
634
634
|
|
|
635
|
-
- name:
|
|
636
|
-
description: Output the prompt
|
|
635
|
+
- name: show-prompt
|
|
636
|
+
description: Output the constructed prompt without calling the LLM API.
|
|
637
637
|
schema:
|
|
638
638
|
type: boolean
|
|
639
639
|
default: false
|
|
@@ -673,7 +673,7 @@ commands:
|
|
|
673
673
|
sideEffectNote: >-
|
|
674
674
|
Network calls to LLM provider when adapter is not mock.
|
|
675
675
|
Filesystem write only when --output is specified.
|
|
676
|
-
safeDryRunOption:
|
|
676
|
+
safeDryRunOption: show-prompt
|
|
677
677
|
expectedDurationMs: 120000
|
|
678
678
|
retryableExitCodes: [1, 12]
|
|
679
679
|
|
|
@@ -106,7 +106,7 @@ Critical implementation details:
|
|
|
106
106
|
- Dynamic-import `agent-contracts-runtime` so the tool works without it installed (graceful degradation)
|
|
107
107
|
- Dynamic-import adapter packages (`/adapters/cursor-sdk`, `/adapters/openai-agents-sdk`, etc.)
|
|
108
108
|
- Import generated DSL registries (including `workflowRegistry`) and pass to `runWorkflow()` — NEVER use `runTask()` (low-level internal API)
|
|
109
|
-
- Support `--
|
|
109
|
+
- Support `--show-prompt` by returning the prompt without calling the LLM
|
|
110
110
|
- Use exit codes: 0 = success, 1 = error, 10 = findings, 11 = runtime missing, 12 = adapter error
|
|
111
111
|
|
|
112
112
|
**context-builder.ts**:
|
|
@@ -137,7 +137,7 @@ export async function command{Name}(config, target, opts) {
|
|
|
137
137
|
Register in CLI with the **cli-contracts standard LLM command options**:
|
|
138
138
|
- `--adapter <name>` — LLM adapter (cursor, openai, gemini, claude, mock)
|
|
139
139
|
- `--model <name>` — Model name to pass to the adapter
|
|
140
|
-
- `--
|
|
140
|
+
- `--show-prompt` — Output the constructed prompt without calling the LLM API
|
|
141
141
|
- `--fail-on <level>` — Minimum severity that causes a non-zero exit (warning, error, critical)
|
|
142
142
|
- `--output <file>` / `-o` — Write result to a file instead of stdout
|
|
143
143
|
- `--report-format <fmt>` — Output format for the report (json, text, yaml). Note: LLM commands use `--report-format`, NOT `--format`. `--format` is reserved for core deterministic commands
|
|
@@ -155,7 +155,7 @@ x-agent:
|
|
|
155
155
|
sideEffectNote: >-
|
|
156
156
|
Network calls to LLM provider when adapter is not mock.
|
|
157
157
|
Filesystem write only when --output is specified.
|
|
158
|
-
safeDryRunOption:
|
|
158
|
+
safeDryRunOption: show-prompt
|
|
159
159
|
expectedDurationMs: 120000
|
|
160
160
|
retryableExitCodes: [1, 12]
|
|
161
161
|
```
|
|
@@ -202,7 +202,7 @@ Follow this structure — concise mention high up, detailed section after mechan
|
|
|
202
202
|
```bash
|
|
203
203
|
npm run build
|
|
204
204
|
npm test
|
|
205
|
-
npx {tool} {llm-command} --
|
|
205
|
+
npx {tool} {llm-command} --show-prompt # verify prompt construction
|
|
206
206
|
npx {tool} {llm-command} --adapter mock # verify with mock adapter
|
|
207
207
|
npx {tool} {llm-command} --adapter openai # real LLM test
|
|
208
208
|
```
|