agent-contracts-runtime 0.0.1

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.
@@ -0,0 +1,532 @@
1
+ cliContracts: 0.1.0
2
+
3
+ info:
4
+ title: agent-runtime CLI
5
+ version: 0.1.0
6
+ description: |
7
+ Runtime bridge for executing agent-contracts workflows on Agent SDKs.
8
+ Generates typed contracts, handoff validators, and guardrail hooks from DSL,
9
+ then runs workflows through pluggable SDK adapters.
10
+ license:
11
+ name: MIT
12
+
13
+ commandSets:
14
+ agent-runtime:
15
+ summary: CLI for agent-contracts-runtime — generate, run, and manage agent workflows.
16
+ globalOptions:
17
+ - name: config
18
+ aliases: [c]
19
+ description: Path to agent-runtime.config.yaml.
20
+ schema:
21
+ type: string
22
+ default: ./agent-runtime.config.yaml
23
+ file:
24
+ mode: read
25
+ exists: true
26
+ mediaType: application/yaml
27
+
28
+ - name: verbose
29
+ aliases: [v]
30
+ description: Enable verbose output.
31
+ schema:
32
+ type: boolean
33
+ default: false
34
+
35
+ - name: quiet
36
+ aliases: [q]
37
+ description: Suppress non-error output.
38
+ schema:
39
+ type: boolean
40
+ default: false
41
+
42
+ commands:
43
+ # -----------------------------------------------------------------------
44
+ # init
45
+ # -----------------------------------------------------------------------
46
+ init:
47
+ summary: Initialize runtime scaffolding for a project.
48
+ description: |
49
+ Generates the initial directory structure and configuration files
50
+ for using agent-contracts-runtime in a project.
51
+ Creates agent-runtime.config.yaml and agent/src/ user code templates.
52
+ options:
53
+ - name: adapter
54
+ aliases: [a]
55
+ description: Default SDK adapter to configure.
56
+ schema:
57
+ type: string
58
+ enum: [cursor, claude, openai, mock]
59
+ default: mock
60
+
61
+ - name: output
62
+ aliases: [o]
63
+ description: Output directory for generated scaffolding.
64
+ schema:
65
+ type: string
66
+ default: "."
67
+
68
+ - name: force
69
+ aliases: [f]
70
+ description: Overwrite existing files without prompting.
71
+ schema:
72
+ type: boolean
73
+ default: false
74
+
75
+ exits:
76
+ "0":
77
+ description: Scaffolding generated successfully.
78
+ stdout:
79
+ format: json
80
+ schema:
81
+ $ref: "#/components/schemas/InitResult"
82
+
83
+ "1":
84
+ description: Initialization failed (existing files, permission error, etc.).
85
+ stderr:
86
+ format: text
87
+
88
+ x-agent:
89
+ riskLevel: low
90
+ requiresConfirmation: false
91
+ idempotent: false
92
+ sideEffects:
93
+ - filesystem_write
94
+ safeDryRunOption: null
95
+
96
+ # -----------------------------------------------------------------------
97
+ # generate
98
+ # -----------------------------------------------------------------------
99
+ generate:
100
+ summary: Generate runtime contracts and hooks from DSL.
101
+ description: |
102
+ Reads agent-contracts.yaml, resolves the DSL, validates it,
103
+ and generates typed contracts, handoff schemas, guardrail hooks,
104
+ and a runtime manifest into the configured generated_dir.
105
+
106
+ Each generated file includes a DO NOT EDIT header.
107
+ options:
108
+ - name: clean
109
+ description: |
110
+ Delete generated_dir before regenerating.
111
+ Removes stale files that may remain from previous generations.
112
+ schema:
113
+ type: boolean
114
+ default: false
115
+
116
+ - name: check
117
+ description: |
118
+ Dry-run mode for CI. Does not write files.
119
+ Compares current generated output with what would be regenerated.
120
+ Exits with code 1 if any differences are found.
121
+ schema:
122
+ type: boolean
123
+ default: false
124
+
125
+ exits:
126
+ "0":
127
+ description: Generation completed successfully (or --check found no differences).
128
+ stdout:
129
+ format: json
130
+ schema:
131
+ $ref: "#/components/schemas/GenerateResult"
132
+
133
+ "1":
134
+ description: |
135
+ Generation failed, or --check detected differences between
136
+ current generated files and expected output.
137
+ stderr:
138
+ format: text
139
+
140
+ "2":
141
+ description: DSL validation error. The input DSL has structural or semantic issues.
142
+ stderr:
143
+ format: json
144
+ schema:
145
+ $ref: "#/components/schemas/ValidationError"
146
+
147
+ x-agent:
148
+ riskLevel: low
149
+ requiresConfirmation: false
150
+ idempotent: true
151
+ sideEffects:
152
+ - filesystem_write
153
+ safeDryRunOption: check
154
+
155
+ # -----------------------------------------------------------------------
156
+ # run
157
+ # -----------------------------------------------------------------------
158
+ run:
159
+ summary: Execute a workflow.
160
+ description: |
161
+ Loads generated contracts, creates an SDK adapter, registers user plugins,
162
+ and executes the specified workflow with the given user request.
163
+
164
+ The workflow runner orchestrates task delegation, retry, gate handling,
165
+ and handoff validation mechanically.
166
+ arguments:
167
+ - name: workflow-id
168
+ required: true
169
+ description: ID of the workflow to execute (e.g. feature-implement, issue-fix).
170
+ schema:
171
+ type: string
172
+
173
+ - name: user-request
174
+ required: true
175
+ description: Natural language description of what to do.
176
+ schema:
177
+ type: string
178
+
179
+ options:
180
+ - name: adapter
181
+ aliases: [a]
182
+ description: SDK adapter to use. Overrides config.
183
+ schema:
184
+ type: string
185
+ enum: [cursor, claude, openai, mock]
186
+
187
+ - name: max-retries
188
+ aliases: [r]
189
+ description: Override default max retries per step.
190
+ schema:
191
+ type: integer
192
+ minimum: 0
193
+ maximum: 10
194
+
195
+ - name: dry-run
196
+ aliases: [n]
197
+ description: Simulate execution without calling the SDK adapter.
198
+ schema:
199
+ type: boolean
200
+ default: false
201
+
202
+ - name: auto-approve-gates
203
+ description: Automatically approve all gate steps.
204
+ schema:
205
+ type: boolean
206
+ default: false
207
+
208
+ exits:
209
+ "0":
210
+ description: Workflow completed successfully.
211
+ stdout:
212
+ format: json
213
+ schema:
214
+ $ref: "#/components/schemas/WorkflowResult"
215
+
216
+ "1":
217
+ description: Workflow failed (escalation, error, or gate rejection).
218
+ stdout:
219
+ format: json
220
+ schema:
221
+ $ref: "#/components/schemas/WorkflowResult"
222
+ stderr:
223
+ format: text
224
+
225
+ "2":
226
+ description: Invalid arguments or unknown workflow/adapter.
227
+ stderr:
228
+ format: text
229
+
230
+ "3":
231
+ description: Generated files outdated. Run `agent-runtime generate` first.
232
+ stderr:
233
+ format: text
234
+
235
+ x-agent:
236
+ riskLevel: high
237
+ requiresConfirmation: true
238
+ idempotent: false
239
+ sideEffects:
240
+ - sdk_call
241
+ - filesystem_write
242
+ safeDryRunOption: dry-run
243
+ recommendedBeforeUse:
244
+ - Run `agent-runtime generate --check` to ensure contracts are up to date.
245
+ - Run `agent-runtime doctor` to verify SDK configuration.
246
+
247
+ # -----------------------------------------------------------------------
248
+ # list
249
+ # -----------------------------------------------------------------------
250
+ list:
251
+ summary: List available workflows, tasks, or agents.
252
+ description: |
253
+ Reads generated contracts and displays available resources.
254
+ Useful for discovering what workflows, tasks, and agents
255
+ are defined in the current project.
256
+ arguments:
257
+ - name: resource
258
+ required: true
259
+ description: Type of resource to list.
260
+ schema:
261
+ type: string
262
+ enum: [workflows, tasks, agents]
263
+
264
+ options:
265
+ - name: format
266
+ description: Output format.
267
+ schema:
268
+ type: string
269
+ enum: [table, json]
270
+ default: table
271
+
272
+ exits:
273
+ "0":
274
+ description: Resources listed successfully.
275
+ stdout:
276
+ format: json
277
+ schema:
278
+ $ref: "#/components/schemas/ListResult"
279
+
280
+ "1":
281
+ description: Failed to load contracts.
282
+ stderr:
283
+ format: text
284
+
285
+ x-agent:
286
+ riskLevel: none
287
+ requiresConfirmation: false
288
+ idempotent: true
289
+ sideEffects: []
290
+
291
+ # -----------------------------------------------------------------------
292
+ # doctor
293
+ # -----------------------------------------------------------------------
294
+ doctor:
295
+ summary: Verify configuration, generated files, and SDK connectivity.
296
+ description: |
297
+ Runs a series of diagnostic checks to verify that the project
298
+ is correctly configured for agent-runtime execution.
299
+
300
+ Checks: config existence, DSL existence, generated manifest freshness,
301
+ adapter configuration, API key environment variables, plugin entrypoint.
302
+ exits:
303
+ "0":
304
+ description: All checks passed.
305
+ stdout:
306
+ format: json
307
+ schema:
308
+ $ref: "#/components/schemas/DoctorResult"
309
+
310
+ "1":
311
+ description: One or more checks failed.
312
+ stdout:
313
+ format: json
314
+ schema:
315
+ $ref: "#/components/schemas/DoctorResult"
316
+
317
+ x-agent:
318
+ riskLevel: none
319
+ requiresConfirmation: false
320
+ idempotent: true
321
+ sideEffects: []
322
+
323
+ # -----------------------------------------------------------------------
324
+ # replay
325
+ # -----------------------------------------------------------------------
326
+ replay:
327
+ summary: Replay a past workflow execution from logs.
328
+ description: |
329
+ Reads a previous workflow execution log and re-executes or validates it.
330
+ Useful for debugging, regression testing, and auditing past runs.
331
+
332
+ Phase 3 feature — initial implementation is optional.
333
+ arguments:
334
+ - name: run-dir
335
+ required: true
336
+ description: Path to the .agent-runs/<run-id> directory.
337
+ schema:
338
+ type: string
339
+ file:
340
+ mode: read
341
+ exists: true
342
+
343
+ options:
344
+ - name: validate-only
345
+ description: Only validate the run log without re-execution.
346
+ schema:
347
+ type: boolean
348
+ default: false
349
+
350
+ exits:
351
+ "0":
352
+ description: Replay completed or validation passed.
353
+ stdout:
354
+ format: json
355
+ schema:
356
+ $ref: "#/components/schemas/WorkflowResult"
357
+
358
+ "1":
359
+ description: Replay failed or validation found issues.
360
+ stderr:
361
+ format: text
362
+
363
+ x-agent:
364
+ riskLevel: medium
365
+ requiresConfirmation: true
366
+ idempotent: false
367
+ sideEffects:
368
+ - sdk_call
369
+ safeDryRunOption: validate-only
370
+
371
+ # =============================================================================
372
+ # Components
373
+ # =============================================================================
374
+
375
+ components:
376
+ schemas:
377
+ # -------------------------------------------------------------------------
378
+ # init
379
+ # -------------------------------------------------------------------------
380
+ InitResult:
381
+ type: object
382
+ required: [filesCreated]
383
+ properties:
384
+ filesCreated:
385
+ type: array
386
+ items:
387
+ type: string
388
+ description: List of files created by init.
389
+
390
+ # -------------------------------------------------------------------------
391
+ # generate
392
+ # -------------------------------------------------------------------------
393
+ GenerateResult:
394
+ type: object
395
+ required: [filesGenerated, dslHash, generationInputHash]
396
+ properties:
397
+ filesGenerated:
398
+ type: array
399
+ items:
400
+ type: string
401
+ description: List of generated file paths.
402
+ dslHash:
403
+ type: string
404
+ description: SHA-256 hash of the resolved DSL (canonical stringify).
405
+ generationInputHash:
406
+ type: string
407
+ description: SHA-256 hash of all generation inputs.
408
+ cleaned:
409
+ type: boolean
410
+ description: Whether --clean was used.
411
+ checkMode:
412
+ type: boolean
413
+ description: Whether --check was used.
414
+ hasDifferences:
415
+ type: boolean
416
+ description: In --check mode, whether differences were found.
417
+
418
+ ValidationError:
419
+ type: object
420
+ required: [errors]
421
+ properties:
422
+ errors:
423
+ type: array
424
+ items:
425
+ type: object
426
+ required: [code, message]
427
+ properties:
428
+ code:
429
+ type: string
430
+ message:
431
+ type: string
432
+ path:
433
+ type: string
434
+ description: JSON path to the invalid element.
435
+
436
+ # -------------------------------------------------------------------------
437
+ # run
438
+ # -------------------------------------------------------------------------
439
+ WorkflowResult:
440
+ type: object
441
+ required: [workflow_id, status, steps, total_elapsed_ms]
442
+ properties:
443
+ workflow_id:
444
+ type: string
445
+ status:
446
+ type: string
447
+ enum: [completed, escalated, gate_rejected, error]
448
+ steps:
449
+ type: array
450
+ items:
451
+ $ref: "#/components/schemas/StepResult"
452
+ total_elapsed_ms:
453
+ type: integer
454
+ minimum: 0
455
+ escalation_reason:
456
+ type: string
457
+ error_message:
458
+ type: string
459
+
460
+ StepResult:
461
+ type: object
462
+ required: [step_index, retries_used, elapsed_ms, outcome]
463
+ properties:
464
+ step_index:
465
+ type: integer
466
+ minimum: 0
467
+ task_id:
468
+ type: string
469
+ gate_kind:
470
+ type: string
471
+ outcome:
472
+ type: object
473
+ required: [status]
474
+ properties:
475
+ status:
476
+ type: string
477
+ enum: [success, validation_error, escalation, error, gate_approved, gate_rejected, skipped]
478
+ retries_used:
479
+ type: integer
480
+ minimum: 0
481
+ elapsed_ms:
482
+ type: integer
483
+ minimum: 0
484
+
485
+ # -------------------------------------------------------------------------
486
+ # list
487
+ # -------------------------------------------------------------------------
488
+ ListResult:
489
+ type: object
490
+ required: [resource, items]
491
+ properties:
492
+ resource:
493
+ type: string
494
+ enum: [workflows, tasks, agents]
495
+ items:
496
+ type: array
497
+ items:
498
+ type: object
499
+ required: [id, description]
500
+ properties:
501
+ id:
502
+ type: string
503
+ description:
504
+ type: string
505
+
506
+ # -------------------------------------------------------------------------
507
+ # doctor
508
+ # -------------------------------------------------------------------------
509
+ DoctorResult:
510
+ type: object
511
+ required: [checks, allPassed]
512
+ properties:
513
+ checks:
514
+ type: array
515
+ items:
516
+ $ref: "#/components/schemas/DoctorCheck"
517
+ allPassed:
518
+ type: boolean
519
+
520
+ DoctorCheck:
521
+ type: object
522
+ required: [name, status]
523
+ properties:
524
+ name:
525
+ type: string
526
+ description: Check name (e.g. config_exists, dsl_exists, manifest_fresh).
527
+ status:
528
+ type: string
529
+ enum: [pass, fail, warn]
530
+ message:
531
+ type: string
532
+ description: Human-readable detail.
@@ -0,0 +1,20 @@
1
+ import { S as SdkAdapter } from '../task-runner-B5SV4eCS.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Claude Agent SDK Adapter — implements SdkAdapter for Claude Agent SDK
6
+ */
7
+
8
+ declare class ClaudeAgentSdkAdapter implements SdkAdapter {
9
+ private cwd;
10
+ private model;
11
+ constructor(config: {
12
+ cwd?: string;
13
+ model?: string;
14
+ });
15
+ send(prompt: string, options: {
16
+ readonly: boolean;
17
+ }): Promise<string>;
18
+ }
19
+
20
+ export { ClaudeAgentSdkAdapter };
@@ -0,0 +1,31 @@
1
+ // src/adapters/claude-agent-sdk.ts
2
+ var ClaudeAgentSdkAdapter = class {
3
+ cwd;
4
+ model;
5
+ constructor(config) {
6
+ this.cwd = config.cwd ?? process.cwd();
7
+ this.model = config.model ?? "claude-sonnet-4-20250514";
8
+ }
9
+ async send(prompt, options) {
10
+ const allowedTools = options.readonly ? ["Read", "Glob", "Grep"] : ["Read", "Glob", "Grep", "Edit", "Write", "Bash"];
11
+ const { query } = await import("@anthropic-ai/claude-agent-sdk");
12
+ const messages = [];
13
+ for await (const msg of query({
14
+ prompt,
15
+ options: {
16
+ model: this.model,
17
+ cwd: this.cwd,
18
+ allowedTools
19
+ }
20
+ })) {
21
+ if (msg.type === "text") {
22
+ messages.push(msg.content);
23
+ }
24
+ }
25
+ return messages.join("");
26
+ }
27
+ };
28
+ export {
29
+ ClaudeAgentSdkAdapter
30
+ };
31
+ //# sourceMappingURL=claude-agent-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/adapters/claude-agent-sdk.ts"],"sourcesContent":["/**\n * Claude Agent SDK Adapter — implements SdkAdapter for Claude Agent SDK\n */\n\nimport type { SdkAdapter } from \"../lib/task-runner.js\";\n\nexport class ClaudeAgentSdkAdapter implements SdkAdapter {\n private cwd: string;\n private model: string;\n\n constructor(config: { cwd?: string; model?: string }) {\n this.cwd = config.cwd ?? process.cwd();\n this.model = config.model ?? \"claude-sonnet-4-20250514\";\n }\n\n async send(prompt: string, options: { readonly: boolean }): Promise<string> {\n const allowedTools = options.readonly\n ? [\"Read\", \"Glob\", \"Grep\"]\n : [\"Read\", \"Glob\", \"Grep\", \"Edit\", \"Write\", \"Bash\"];\n\n // @ts-expect-error — @anthropic-ai/claude-agent-sdk is an optional peer dependency\n const { query } = await import(\"@anthropic-ai/claude-agent-sdk\") as { query: (opts: Record<string, unknown>) => AsyncIterable<unknown> };\n\n const messages: string[] = [];\n for await (const msg of query({\n prompt,\n options: {\n model: this.model,\n cwd: this.cwd,\n allowedTools,\n },\n })) {\n if ((msg as { type: string }).type === \"text\") {\n messages.push((msg as { content: string }).content);\n }\n }\n return messages.join(\"\");\n }\n}\n"],"mappings":";AAMO,IAAM,wBAAN,MAAkD;AAAA,EAC/C;AAAA,EACA;AAAA,EAER,YAAY,QAA0C;AACpD,SAAK,MAAM,OAAO,OAAO,QAAQ,IAAI;AACrC,SAAK,QAAQ,OAAO,SAAS;AAAA,EAC/B;AAAA,EAEA,MAAM,KAAK,QAAgB,SAAiD;AAC1E,UAAM,eAAe,QAAQ,WACzB,CAAC,QAAQ,QAAQ,MAAM,IACvB,CAAC,QAAQ,QAAQ,QAAQ,QAAQ,SAAS,MAAM;AAGpD,UAAM,EAAE,MAAM,IAAI,MAAM,OAAO,gCAAgC;AAE/D,UAAM,WAAqB,CAAC;AAC5B,qBAAiB,OAAO,MAAM;AAAA,MAC5B;AAAA,MACA,SAAS;AAAA,QACP,OAAO,KAAK;AAAA,QACZ,KAAK,KAAK;AAAA,QACV;AAAA,MACF;AAAA,IACF,CAAC,GAAG;AACF,UAAK,IAAyB,SAAS,QAAQ;AAC7C,iBAAS,KAAM,IAA4B,OAAO;AAAA,MACpD;AAAA,IACF;AACA,WAAO,SAAS,KAAK,EAAE;AAAA,EACzB;AACF;","names":[]}
@@ -0,0 +1,21 @@
1
+ import { S as SdkAdapter } from '../task-runner-B5SV4eCS.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Cursor SDK Adapter — implements SdkAdapter for Cursor Cloud Agents API
6
+ */
7
+
8
+ declare class CursorSdkAdapter implements SdkAdapter {
9
+ private agent;
10
+ constructor(agent: unknown);
11
+ send(prompt: string, _options: {
12
+ readonly: boolean;
13
+ }): Promise<string>;
14
+ static create(config: {
15
+ apiKey: string;
16
+ model?: string;
17
+ cwd?: string;
18
+ }): Promise<CursorSdkAdapter>;
19
+ }
20
+
21
+ export { CursorSdkAdapter };
@@ -0,0 +1,35 @@
1
+ // src/adapters/cursor-sdk.ts
2
+ var CursorSdkAdapter = class _CursorSdkAdapter {
3
+ agent;
4
+ constructor(agent) {
5
+ this.agent = agent;
6
+ }
7
+ async send(prompt, _options) {
8
+ const agent = this.agent;
9
+ const run = await agent.send(prompt);
10
+ let fullOutput = "";
11
+ for await (const event of run.stream()) {
12
+ if (event.type === "assistant" && event.message?.content) {
13
+ for (const part of event.message.content) {
14
+ if (part.type === "text" && part.text) {
15
+ fullOutput += part.text;
16
+ }
17
+ }
18
+ }
19
+ }
20
+ return fullOutput;
21
+ }
22
+ static async create(config) {
23
+ const { Agent } = await import("@cursor/sdk");
24
+ const agent = await Agent.create({
25
+ apiKey: config.apiKey,
26
+ model: { id: config.model ?? "composer-2" },
27
+ local: { cwd: config.cwd ?? process.cwd() }
28
+ });
29
+ return new _CursorSdkAdapter(agent);
30
+ }
31
+ };
32
+ export {
33
+ CursorSdkAdapter
34
+ };
35
+ //# sourceMappingURL=cursor-sdk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/adapters/cursor-sdk.ts"],"sourcesContent":["/**\n * Cursor SDK Adapter — implements SdkAdapter for Cursor Cloud Agents API\n */\n\nimport type { SdkAdapter } from \"../lib/task-runner.js\";\n\nexport class CursorSdkAdapter implements SdkAdapter {\n private agent: unknown;\n\n constructor(agent: unknown) {\n this.agent = agent;\n }\n\n async send(prompt: string, _options: { readonly: boolean }): Promise<string> {\n const agent = this.agent as { send(p: string): Promise<{ stream(): AsyncIterable<{ type: string; message?: { content?: Array<{ type: string; text?: string }> } }> }> };\n const run = await agent.send(prompt);\n\n let fullOutput = \"\";\n for await (const event of run.stream()) {\n if (event.type === \"assistant\" && event.message?.content) {\n for (const part of event.message.content) {\n if (part.type === \"text\" && part.text) {\n fullOutput += part.text;\n }\n }\n }\n }\n return fullOutput;\n }\n\n static async create(config: {\n apiKey: string;\n model?: string;\n cwd?: string;\n }): Promise<CursorSdkAdapter> {\n // @ts-expect-error — @cursor/sdk is an optional peer dependency\n const { Agent } = await import(\"@cursor/sdk\") as { Agent: { create(opts: Record<string, unknown>): Promise<unknown> } };\n const agent = await Agent.create({\n apiKey: config.apiKey,\n model: { id: config.model ?? \"composer-2\" },\n local: { cwd: config.cwd ?? process.cwd() },\n });\n return new CursorSdkAdapter(agent);\n }\n}\n"],"mappings":";AAMO,IAAM,mBAAN,MAAM,kBAAuC;AAAA,EAC1C;AAAA,EAER,YAAY,OAAgB;AAC1B,SAAK,QAAQ;AAAA,EACf;AAAA,EAEA,MAAM,KAAK,QAAgB,UAAkD;AAC3E,UAAM,QAAQ,KAAK;AACnB,UAAM,MAAM,MAAM,MAAM,KAAK,MAAM;AAEnC,QAAI,aAAa;AACjB,qBAAiB,SAAS,IAAI,OAAO,GAAG;AACtC,UAAI,MAAM,SAAS,eAAe,MAAM,SAAS,SAAS;AACxD,mBAAW,QAAQ,MAAM,QAAQ,SAAS;AACxC,cAAI,KAAK,SAAS,UAAU,KAAK,MAAM;AACrC,0BAAc,KAAK;AAAA,UACrB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,aAAa,OAAO,QAIU;AAE5B,UAAM,EAAE,MAAM,IAAI,MAAM,OAAO,aAAa;AAC5C,UAAM,QAAQ,MAAM,MAAM,OAAO;AAAA,MAC/B,QAAQ,OAAO;AAAA,MACf,OAAO,EAAE,IAAI,OAAO,SAAS,aAAa;AAAA,MAC1C,OAAO,EAAE,KAAK,OAAO,OAAO,QAAQ,IAAI,EAAE;AAAA,IAC5C,CAAC;AACD,WAAO,IAAI,kBAAiB,KAAK;AAAA,EACnC;AACF;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { S as SdkAdapter } from '../task-runner-B5SV4eCS.js';
2
+ import 'zod';
3
+
4
+ /**
5
+ * Mock SDK Adapter — for testing and demo purposes
6
+ */
7
+
8
+ declare class MockAdapter implements SdkAdapter {
9
+ private responses;
10
+ private defaultLatencyMs;
11
+ constructor(options?: {
12
+ responses?: Record<string, (userRequest: string) => string>;
13
+ defaultLatencyMs?: number;
14
+ });
15
+ send(prompt: string, _options: {
16
+ readonly: boolean;
17
+ }): Promise<string>;
18
+ }
19
+
20
+ export { MockAdapter };
@@ -0,0 +1,27 @@
1
+ // src/adapters/mock.ts
2
+ var MockAdapter = class {
3
+ responses;
4
+ defaultLatencyMs;
5
+ constructor(options) {
6
+ this.responses = options?.responses ?? {};
7
+ this.defaultLatencyMs = options?.defaultLatencyMs ?? 0;
8
+ }
9
+ async send(prompt, _options) {
10
+ const match = prompt.match(/## Task: (\S+)/);
11
+ const taskId = match?.[1] ?? "unknown";
12
+ const reqMatch = prompt.match(/## User Request\n\n([\s\S]*?)(?:\n\n---|$)/);
13
+ const userRequest = reqMatch?.[1]?.trim() ?? "";
14
+ if (this.defaultLatencyMs > 0) {
15
+ await new Promise((r) => setTimeout(r, this.defaultLatencyMs));
16
+ }
17
+ const responseFn = this.responses[taskId];
18
+ if (!responseFn) {
19
+ return `Task "${taskId}" completed but no structured output available.`;
20
+ }
21
+ return responseFn(userRequest);
22
+ }
23
+ };
24
+ export {
25
+ MockAdapter
26
+ };
27
+ //# sourceMappingURL=mock.js.map