@mnaimfaizy/agent-kit 1.0.0-beta.13 → 1.0.0-beta.15

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 (79) hide show
  1. package/README.md +24 -5
  2. package/custom-harness.schema.json +243 -0
  3. package/harnesses.json +286 -0
  4. package/package.json +4 -2
  5. package/src/checks/ci-workflow.mjs +105 -0
  6. package/src/checks/claude-app.mjs +11 -2
  7. package/src/checks/custom-harness.mjs +157 -0
  8. package/src/checks/github-app.mjs +214 -0
  9. package/src/checks/review-response.mjs +54 -27
  10. package/src/checks/rulesets.mjs +9 -8
  11. package/src/checks/secrets-and-variables.mjs +220 -43
  12. package/src/checks/stages.mjs +705 -0
  13. package/src/cli.mjs +277 -31
  14. package/src/deep-scan/agent.mjs +145 -117
  15. package/src/deep-scan/credential.mjs +88 -42
  16. package/src/deep-scan/docker-driver.mjs +131 -49
  17. package/src/deep-scan/harness-text.mjs +99 -0
  18. package/src/deep-scan/lifecycle.mjs +92 -199
  19. package/src/deep-scan/limits.mjs +13 -7
  20. package/src/deep-scan/model-proxy.mjs +47 -602
  21. package/src/deep-scan/preflight.mjs +81 -1
  22. package/src/deep-scan/recipe.mjs +7 -7
  23. package/src/deep-scan/runtime.mjs +54 -6
  24. package/src/deep-scan/sandbox-run.mjs +232 -0
  25. package/src/deep-scan/sbx-driver.mjs +242 -50
  26. package/src/deep-scan/tar.mjs +69 -22
  27. package/src/deep-scan/verify.mjs +6 -1
  28. package/src/deep-scan.mjs +98 -14
  29. package/src/doctor.mjs +113 -4
  30. package/src/harness/adapters.mjs +30 -0
  31. package/src/harness/antigravity.mjs +187 -0
  32. package/src/harness/claude-code.mjs +236 -0
  33. package/src/harness/codex.mjs +219 -0
  34. package/src/harness/cursor.mjs +199 -0
  35. package/src/harness/custom/registry.mjs +21 -0
  36. package/src/harness/custom/schema.mjs +90 -0
  37. package/src/harness/custom.mjs +299 -0
  38. package/src/harness/facts.mjs +157 -0
  39. package/src/harness/gemini.mjs +164 -0
  40. package/src/harness/install-layer.mjs +141 -0
  41. package/src/harness/opencode.mjs +289 -0
  42. package/src/harness/resolve.mjs +156 -0
  43. package/src/harness/support-levels.mjs +197 -0
  44. package/src/harness-live/assess.mjs +291 -0
  45. package/src/harness-live/cursor-real.mjs +146 -0
  46. package/src/harness-live/cursor-version.mjs +70 -0
  47. package/src/harness-live/cursor.mjs +80 -0
  48. package/src/harness-live/custom.mjs +91 -0
  49. package/src/harness-live/fixture-harness.mjs +45 -0
  50. package/src/harness-live/harnesses.mjs +263 -0
  51. package/src/harness-live/host.mjs +414 -0
  52. package/src/harness-live/opencode.mjs +289 -0
  53. package/src/harness-live/probes.mjs +239 -0
  54. package/src/harness-live/run.mjs +214 -0
  55. package/src/harness-live/setup.mjs +126 -0
  56. package/src/harness-live/stage.mjs +161 -0
  57. package/src/harness-live/suite.mjs +481 -0
  58. package/src/harness-test.mjs +116 -0
  59. package/src/init.mjs +339 -23
  60. package/src/model-proxy/core.mjs +657 -0
  61. package/src/model-proxy/profiles/anthropic.mjs +241 -0
  62. package/src/model-proxy/profiles/gemini-api.mjs +311 -0
  63. package/src/model-proxy/profiles/openai.mjs +327 -0
  64. package/src/model-proxy/stub-dialects/anthropic.mjs +110 -0
  65. package/src/model-proxy/stub-dialects/gemini-api.mjs +178 -0
  66. package/src/model-proxy/stub-dialects/openai.mjs +173 -0
  67. package/src/model-proxy/stub.mjs +182 -0
  68. package/src/stage/audit.mjs +79 -0
  69. package/src/stage/egress-route.mjs +207 -0
  70. package/src/stage/implement/carry.mjs +308 -0
  71. package/src/stage/implement/sandbox.mjs +271 -0
  72. package/src/stage/implement/verify.mjs +70 -0
  73. package/src/stage/implement.mjs +218 -0
  74. package/src/stage/plan.mjs +115 -0
  75. package/src/stage/review-response.mjs +172 -0
  76. package/src/stage/review.mjs +185 -0
  77. package/src/stage/workspace.mjs +274 -0
  78. package/src/stage.mjs +1068 -0
  79. package/src/deep-scan/claude-code.mjs +0 -25
package/src/cli.mjs CHANGED
@@ -1,18 +1,21 @@
1
1
  // Argument parsing and dispatch. Exit codes: 0 ok, 1 a check failed (or a
2
2
  // warning under --strict, the tag or the change was refused, or deep-scan
3
- // refused, or a sandbox step failed), 2 usage error (including a missing
4
- // answer when there is no terminal to ask on), 3 a deep-scan limit stopped
5
- // the run (after copying out any report and tearing the sandbox down), 130
6
- // or 143 deep-scan was interrupted by SIGINT or SIGTERM (likewise).
3
+ // refused, a sandbox step failed, or a Stage did not complete), 2 usage error
4
+ // (including a missing answer when there is no terminal to ask on), 3 a
5
+ // deep-scan or stage limit stopped the run (after copying out any report and
6
+ // tearing the sandbox down), 130 or 143 one was interrupted by SIGINT or
7
+ // SIGTERM (likewise).
7
8
 
8
9
  import { parseArgs } from "node:util";
9
10
  import { runDeepScan } from "./deep-scan.mjs";
10
11
  import { formatReport, runDoctor } from "./doctor.mjs";
12
+ import { runHarnessTest } from "./harness-test.mjs";
11
13
  import { REPO_PATTERN, sanitizeLine } from "./checks/result.mjs";
12
14
  import { runnerFor } from "./exec.mjs";
13
15
  import { askYesNo } from "./prompt.mjs";
14
16
  import { CLI_VERSION, isReleaseTag } from "./tags.mjs";
15
17
  import { runInit } from "./init.mjs";
18
+ import { runStage, STAGE_COMMANDS } from "./stage.mjs";
16
19
  import { runUpgrade } from "./upgrade.mjs";
17
20
 
18
21
  export const VERSION = CLI_VERSION;
@@ -37,12 +40,24 @@ Commands:
37
40
  chooses a sandbox runtime from the host or refuses (no
38
41
  override), then runs the sandbox: image, copy-in of the
39
42
  default branch's tip, setup with egress only to the recipe's
40
- registries, network cut, the real Claude Code behind a
43
+ registries, network cut, the real harness behind a
41
44
  key-injecting model proxy on this machine (its only route
42
45
  out), copy-out of the report only, and teardown. Every run
43
46
  is bounded by wall clocks, a turn limit and a token cap.
44
47
  With --verify <file> --ref <ref>, a local-only
45
48
  Verification run: does a fix hold for known findings?
49
+ stage Run one CI Stage in the same sandbox, as the reusable
50
+ workflows do: stage audit, the static security audit, stage
51
+ plan, the plan of an issue, stage review, the pull request
52
+ review, stage implement, the implementer, or stage
53
+ review-response, the Review responder. Copies the
54
+ checked-out commit in, hands the harness the brief it is
55
+ given, and writes the Stage result and the raw transcript to
56
+ private files. Writes nothing to GitHub.
57
+ harness harness test custom:<name>: run the live probe suite on your
58
+ own Custom harness file, against a stub model, in the real
59
+ sandbox under gVisor. The first half of a Proving run. It needs
60
+ no model credential.
46
61
 
47
62
  Options for doctor:
48
63
  --ci Check only Kit-owned paths and uses: pins (no gh needed).
@@ -62,44 +77,70 @@ Options for init (each one is asked for when missing, on a terminal):
62
77
  prompt, \\n separates commands.
63
78
  --preset <name|none> Inline examples/setup-presets/<name>.sh as
64
79
  setup_commands (pipeline, review-response;
65
- default none).
80
+ default none), and the sandbox_image and
81
+ setup_registries its header names into the
82
+ implement job.
83
+ --harness <name> The harness for every Stage (default claude-code);
84
+ it changes only the printed steps.
66
85
  --threat-pack-dir <d> Where the Threat pack goes (audit; default .security).
67
86
  --yes Ask nothing; every answer comes from flags.
68
87
  --force Overwrite existing Callers, Threat pack files and
69
88
  Kit-owned paths (use upgrade to change tags).
70
89
 
71
90
  Options for deep-scan:
91
+ --harness <name> The harness that scans: claude-code, codex, gemini,
92
+ antigravity, opencode or custom:<name>
93
+ (default: AGENT_KIT_DEEP_SCAN_HARNESS, then
94
+ AGENT_KIT_HARNESS, then claude-code). The run
95
+ names it and its Support Level.
72
96
  --recipe <path> The Scan recipe, relative to the repository root
73
97
  (default .security/scan-recipe.yml).
74
98
  --default-branch <b> The branch whose tip the recipe is read from
75
99
  (default: origin's HEAD, else main).
76
100
  --credential <kind> The model credential's kind: api-key (default),
77
- an Anthropic API key, or subscription, a Claude
78
- subscription token from claude setup-token, an
79
- opt-in at your own risk: it relies on
101
+ the harness's own (Anthropic's for Claude Code,
102
+ OpenAI's for Codex CLI, Gemini's for Gemini CLI and
103
+ Antigravity CLI, the model's provider's for
104
+ opencode),
105
+ or, on Claude Code alone,
106
+ subscription, a Claude subscription token from
107
+ claude setup-token, an opt-in at your own risk: it relies on
80
108
  undocumented Claude Code behaviour, has no
81
109
  refresh, and the token cap is its only spend
82
110
  lever (see docs/security-audit.md#credentials).
83
111
  --credential-from <s> Where the credential is read from: env:<NAME>
84
112
  (default env:ANTHROPIC_API_KEY, or
85
113
  env:CLAUDE_CODE_OAUTH_TOKEN with --credential
86
- subscription; op run can fill either) or an
114
+ subscription, env:OPENAI_API_KEY on Codex CLI,
115
+ env:GEMINI_API_KEY on Gemini CLI and Antigravity
116
+ CLI, or env:CURSOR_API_KEY on Cursor CLI; on opencode, the variable of its model's
117
+ provider; op run can
118
+ fill any) or an
87
119
  op:// reference, read with op read. Never the
88
120
  credential itself. It stays outside the
89
- sandbox, in the model proxy.
121
+ sandbox, in the model proxy; on Cursor CLI, which the
122
+ proxy cannot front, the key sits in the sandbox.
90
123
  --setup-minutes <n> The setup wall clock: image to agent step
91
124
  (default 20).
92
125
  --scan-minutes <n> The scan wall clock: the agent step (default 60).
93
- --max-turns <n> Claude Code's turn limit (default 200).
126
+ --max-turns <n> Claude Code's or Gemini CLI's turn limit (default
127
+ 200). Codex CLI, Antigravity CLI and opencode have
128
+ none, and ignore it.
94
129
  --max-tokens <n> The model proxy's token cap for the run, counting
95
130
  input, output and cache tokens (default 5000000).
96
131
  A limit that fires stops the run, copies out its
97
132
  report with a Stopped: line, and exits 3.
98
- --model <id> The Claude model the agent runs on, a plain id
99
- such as claude-opus-5-5 (default: Claude Code's).
100
- --effort <level> The effort level Claude Code runs at: low,
101
- medium, high, xhigh or max (default: Claude
102
- Code's). The Agent step line names the model
133
+ --model <id> The model the agent runs on, a plain id in the
134
+ harness's own words, such as claude-opus-5-5
135
+ (default: the harness's). On opencode it is
136
+ provider/model, with the provider anthropic,
137
+ openai or google.
138
+ --effort <level> The effort level the harness runs at: low,
139
+ medium, high, xhigh or max, and ultra on Codex
140
+ CLI; Gemini CLI, Cursor CLI and opencode have no effort setting,
141
+ and each Antigravity CLI model takes only some
142
+ (default: the harness's). The Agent step line
143
+ names the model
103
144
  and effort asked for, and the Model proxy line
104
145
  the model the API answered with.
105
146
  --report <path> Write the report to this new file, in a folder
@@ -121,10 +162,98 @@ Options for deep-scan:
121
162
  such as your fix branch. The recipe, the skill
122
163
  and the Threat pack still come from the default
123
164
  branch.
165
+ --proving-run Run on a harness whose Support Level for the Deep
166
+ scan is below tried, to record the evidence that
167
+ raises it (a Proving run, marked in the output
168
+ and the run summary). Without it such a run is
169
+ refused. It relaxes nothing else. No Caller input
170
+ sets it, and the Deep scan workflow never passes it.
124
171
  In GitHub Actions (GITHUB_ACTIONS=true) deep-scan keeps the Public-log
125
- rule: it prints nothing the scan shaped (Claude Code's error output, the
172
+ rule: it prints nothing the scan shaped (the harness's error output, the
126
173
  model proxy's refusals), since the Actions log is world-readable.
127
174
 
175
+ Options for stage audit (--harness, --credential, --credential-from,
176
+ --model, --effort, --setup-minutes, --scan-minutes, --max-turns and
177
+ --max-tokens as for deep-scan; the harness also from
178
+ AGENT_KIT_SECURITY_AUDIT_HARNESS. On Claude Code a subscription token in
179
+ CLAUDE_CODE_OAUTH_TOKEN is used before an API key. Defaults: setup 10
180
+ min, scan 30 min, 100 turns, 5000000 tokens):
181
+ --proving-run Run on a harness whose Support Level for the audit
182
+ is below tried, as a Proving run. Without it such
183
+ a run is refused. No Caller input sets it: the
184
+ audit workflow passes it only in Agent-kit's own
185
+ repository.
186
+ --brief <file> The audit's brief, as the trusted step built it.
187
+ --result <file> Write the Stage result, the report, to this new
188
+ file.
189
+ --transcript <file> Write the harness's raw event stream here
190
+ (default: a new private folder). Never read.
191
+ --error-log <file> Write the harness's error output here.
192
+ --trusted-ref <ref> The commit the harness's instruction files come
193
+ from (default: the checked-out one). A Custom
194
+ harness's file is read from it too (without it,
195
+ from the default branch).
196
+ --untracked Copy untracked files in too, such as a
197
+ scanner's output.
198
+ Exit codes: 0 the harness exited cleanly and left a valid result, 1
199
+ refused or failed, 2 usage error, 3 a limit stopped the run.
200
+
201
+ Options for stage plan (stage audit's, without --untracked; the harness
202
+ also from AGENT_KIT_PLAN_HARNESS. It runs on a pair at documented, with
203
+ a warning. Its result is one Markdown file that opens with "## Agent
204
+ plan", and a run a limit stopped leaves nothing to publish. Defaults:
205
+ setup 10 min, scan 20 min, 60 turns, 5000000 tokens).
206
+
207
+ Options for stage review (stage audit's, without --untracked; the
208
+ harness also from AGENT_KIT_REVIEW_HARNESS. It runs on a pair at
209
+ documented, with a warning. Its result is one JSON file, and a run a
210
+ limit stopped leaves nothing to publish. Defaults: setup 10 min, scan
211
+ 30 min, 120 turns, 10000000 tokens):
212
+ --input <file> A file the trusted step prepared, such as the
213
+ diff, copied in beside the brief. Repeat it for
214
+ each.
215
+
216
+ Options for stage implement and stage review-response (stage review's; the harness also from
217
+ AGENT_KIT_IMPLEMENT_HARNESS and AGENT_KIT_REVIEW_RESPONSE_HARNESS. It runs on a pair at documented, with a
218
+ warning. The agent commits in the sandbox; the result is a JSON title
219
+ and body for implement, and replies and Verdicts for review-response, and
220
+ a run a limit stopped leaves neither. Defaults: setup 20 min, scan 60 min,
221
+ 200 turns (review-response: 150), 40000000 tokens):
222
+ --bundle <file> Where the git bundle of the agent's commits goes.
223
+ Nothing is pushed.
224
+ --sandbox-image <ref> The image the harness is layered on (default: the
225
+ kit's Harness image). A tag is accepted and the
226
+ digest it resolves to printed. It needs glibc
227
+ Linux, git and bash.
228
+ --setup-commands <file> Commands run in the sandbox before the network cut.
229
+ --setup-registries <hosts>
230
+ The hosts those commands may reach, separated by
231
+ spaces, commas or lines (default: none, so no
232
+ network).
233
+ --setup-paths <paths> Absolute paths outside the workspace that setup
234
+ may change and the agent's container takes, one
235
+ per line (default: none). Setup runs in a
236
+ container of its own; only the workspace, these
237
+ paths and .git/ from the trusted commit reach the
238
+ agent's. Harness, git, shell and system locations
239
+ are refused.
240
+ --verify-commands <file>
241
+ The verify run, with no agent: it runs the setup
242
+ commands, cuts the network, then runs these on the
243
+ checked-out commit. It takes --harness, the sandbox
244
+ and setup flags, --setup-minutes (default 20) and
245
+ --scan-minutes (default 30, the commands' limit)
246
+ alone. Exit 0 when they pass.
247
+
248
+ Options for harness test:
249
+ --trusted-ref <ref> The commit to read the Custom harness file from
250
+ (default: the default branch's tip, as this
251
+ checkout has it).
252
+ --default-branch <name> The default branch, where origin's HEAD does not
253
+ name it.
254
+ Exit codes: 0 every Guard held in every scenario, 1 refused or failed, 2
255
+ usage error.
256
+
128
257
  Options for upgrade:
129
258
  --tag <vY> The Agent-kit tag to move to (asked for when missing).
130
259
  --from <vX> The tag you are leaving, when the pins already name <vY>
@@ -139,6 +268,7 @@ Options for upgrade:
139
268
 
140
269
  const COMMAND_OPTIONS = {
141
270
  doctor: ["ci", "strict", "repo"],
271
+ harness: ["trusted-ref", "default-branch"],
142
272
  init: [
143
273
  "tag",
144
274
  "flows",
@@ -146,12 +276,14 @@ const COMMAND_OPTIONS = {
146
276
  "default-branch",
147
277
  "verify",
148
278
  "preset",
279
+ "harness",
149
280
  "threat-pack-dir",
150
281
  "yes",
151
282
  "force",
152
283
  ],
153
284
  upgrade: ["tag", "from", "yes", "force"],
154
285
  "deep-scan": [
286
+ "harness",
155
287
  "recipe",
156
288
  "default-branch",
157
289
  "credential",
@@ -165,6 +297,32 @@ const COMMAND_OPTIONS = {
165
297
  "report",
166
298
  "verify",
167
299
  "ref",
300
+ "proving-run",
301
+ ],
302
+ stage: [
303
+ "harness",
304
+ "credential",
305
+ "credential-from",
306
+ "setup-minutes",
307
+ "scan-minutes",
308
+ "max-turns",
309
+ "max-tokens",
310
+ "model",
311
+ "effort",
312
+ "proving-run",
313
+ "brief",
314
+ "result",
315
+ "bundle",
316
+ "transcript",
317
+ "error-log",
318
+ "trusted-ref",
319
+ "untracked",
320
+ "input",
321
+ "sandbox-image",
322
+ "setup-registries",
323
+ "setup-commands",
324
+ "setup-paths",
325
+ "verify-commands",
168
326
  ],
169
327
  };
170
328
 
@@ -219,6 +377,7 @@ export async function main(argv, io) {
219
377
  verify: { type: "string" },
220
378
  preset: { type: "string" },
221
379
  "threat-pack-dir": { type: "string" },
380
+ harness: { type: "string" },
222
381
  recipe: { type: "string" },
223
382
  credential: { type: "string" },
224
383
  "credential-from": { type: "string" },
@@ -230,6 +389,20 @@ export async function main(argv, io) {
230
389
  effort: { type: "string" },
231
390
  report: { type: "string" },
232
391
  ref: { type: "string" },
392
+ "proving-run": { type: "boolean" },
393
+ brief: { type: "string" },
394
+ result: { type: "string" },
395
+ bundle: { type: "string" },
396
+ transcript: { type: "string" },
397
+ "error-log": { type: "string" },
398
+ "trusted-ref": { type: "string" },
399
+ untracked: { type: "boolean" },
400
+ input: { type: "string", multiple: true },
401
+ "sandbox-image": { type: "string" },
402
+ "setup-registries": { type: "string" },
403
+ "setup-commands": { type: "string" },
404
+ "setup-paths": { type: "string" },
405
+ "verify-commands": { type: "string" },
233
406
  yes: { type: "boolean", short: "y" },
234
407
  force: { type: "boolean" },
235
408
  help: { type: "boolean", short: "h" },
@@ -254,7 +427,23 @@ export async function main(argv, io) {
254
427
  stderr(`Unknown command: ${command}\n\n${USAGE}`);
255
428
  return 2;
256
429
  }
257
- if (rest.length) {
430
+ // `stage` takes its Stage's name; no other command takes an argument.
431
+ if (command === "stage") {
432
+ const names = Object.keys(STAGE_COMMANDS).join(", ");
433
+ if (!rest.length) {
434
+ stderr(`stage needs a Stage name: ${names}`);
435
+ return 2;
436
+ }
437
+ if (rest.length > 1) {
438
+ stderr(`stage takes one Stage, got: ${rest.join(" ")}`);
439
+ return 2;
440
+ }
441
+ } else if (command === "harness") {
442
+ if (rest.length !== 2 || rest[0] !== "test") {
443
+ stderr("harness takes `test custom:<name>`, as in: agent-kit harness test custom:mine");
444
+ return 2;
445
+ }
446
+ } else if (rest.length) {
258
447
  stderr(`${command} takes no arguments, got: ${rest.join(" ")}`);
259
448
  return 2;
260
449
  }
@@ -267,7 +456,9 @@ export async function main(argv, io) {
267
456
  }
268
457
  const runner =
269
458
  io.runner ??
270
- runnerFor(command, {
459
+ // `stage` and `harness test` run in the Deep scan's sandbox, on the same
460
+ // commands.
461
+ runnerFor(command === "stage" || command === "harness" ? "deep-scan" : command, {
271
462
  ...(io.spawn ? { spawn: io.spawn } : {}),
272
463
  ...(io.spawnAsync ? { spawnAsync: io.spawnAsync } : {}),
273
464
  });
@@ -284,6 +475,7 @@ export async function main(argv, io) {
284
475
  defaultBranch: values["default-branch"],
285
476
  verify: values.verify,
286
477
  preset: values.preset,
478
+ harness: values.harness,
287
479
  threatPackDir: values["threat-pack-dir"],
288
480
  },
289
481
  force: Boolean(values.force),
@@ -300,6 +492,7 @@ export async function main(argv, io) {
300
492
  return runDeepScan({
301
493
  cwd,
302
494
  runner,
495
+ harness: values.harness,
303
496
  recipePath: values.recipe,
304
497
  defaultBranch: values["default-branch"],
305
498
  credential: values.credential,
@@ -309,19 +502,56 @@ export async function main(argv, io) {
309
502
  reportPath: values.report,
310
503
  verifyPath: values.verify,
311
504
  ref: values.ref,
312
- limitFlags: {
313
- "setup-minutes": values["setup-minutes"],
314
- "scan-minutes": values["scan-minutes"],
315
- "max-turns": values["max-turns"],
316
- "max-tokens": values["max-tokens"],
317
- },
318
- ...(io.platform !== undefined ? { platform: io.platform } : {}),
319
- ...(io.env !== undefined ? { env: io.env } : {}),
505
+ provingRun: Boolean(values["proving-run"]),
506
+ limitFlags: limitFlagsOf(values),
507
+ ...hostOf(io),
320
508
  ...(io.fetch !== undefined ? { fetch: io.fetch } : {}),
321
- ...(io.signals !== undefined ? { signals: io.signals } : {}),
322
509
  ...(io.reportDir !== undefined ? { reportDir: io.reportDir } : {}),
323
- ...(io.modelApi !== undefined ? { modelApi: io.modelApi } : {}),
324
- ...(io.timers !== undefined ? { timers: io.timers } : {}),
510
+ out: stdout,
511
+ err: stderr,
512
+ });
513
+ }
514
+ if (command === "stage") {
515
+ stdout(`agent-kit stage ${VERSION}`);
516
+ return runStage({
517
+ cwd,
518
+ runner,
519
+ stage: rest[0],
520
+ harness: values.harness,
521
+ model: values.model,
522
+ effort: values.effort,
523
+ credential: values.credential,
524
+ credentialFrom: values["credential-from"],
525
+ briefPath: values.brief,
526
+ resultPath: values.result,
527
+ bundlePath: values.bundle,
528
+ transcriptPath: values.transcript,
529
+ errorLogPath: values["error-log"],
530
+ trustedRef: values["trusted-ref"],
531
+ untracked: Boolean(values.untracked),
532
+ inputPaths: values.input,
533
+ sandboxImage: values["sandbox-image"],
534
+ setupRegistries: values["setup-registries"],
535
+ setupPath: values["setup-commands"],
536
+ setupPaths: values["setup-paths"],
537
+ verifyPath: values["verify-commands"],
538
+ provingRun: Boolean(values["proving-run"]),
539
+ limitFlags: limitFlagsOf(values),
540
+ ...hostOf(io),
541
+ out: stdout,
542
+ err: stderr,
543
+ });
544
+ }
545
+ if (command === "harness") {
546
+ stdout(`agent-kit harness test ${VERSION}`);
547
+ return runHarnessTest({
548
+ cwd,
549
+ runner,
550
+ harness: rest[1],
551
+ trustedRef: values["trusted-ref"],
552
+ defaultBranch: values["default-branch"],
553
+ ...hostOf(io),
554
+ ...(io.scenarioRunner !== undefined ? { scenarioRunner: io.scenarioRunner } : {}),
325
555
  out: stdout,
326
556
  err: stderr,
327
557
  });
@@ -346,6 +576,22 @@ export async function main(argv, io) {
346
576
  return report.exitCode;
347
577
  }
348
578
 
579
+ /** The limit flags' values, keyed by flag name. */
580
+ const limitFlagsOf = (values) => ({
581
+ "setup-minutes": values["setup-minutes"],
582
+ "scan-minutes": values["scan-minutes"],
583
+ "max-turns": values["max-turns"],
584
+ "max-tokens": values["max-tokens"],
585
+ });
586
+
587
+ /** The host's seams `deep-scan` and `stage` share, where `io` replaces them. */
588
+ const hostOf = (io) =>
589
+ Object.fromEntries(
590
+ ["platform", "env", "signals", "modelApi", "timers"]
591
+ .filter((name) => io[name] !== undefined)
592
+ .map((name) => [name, io[name]]),
593
+ );
594
+
349
595
  async function upgrade(values, { cwd, runner, openRepo, prompt, stdout, stderr }) {
350
596
  if (!prompt) {
351
597
  // No terminal: every answer must come from a flag.