@mnaimfaizy/agent-kit 1.0.0-beta.14 → 1.0.0-beta.16
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/README.md +22 -4
- package/custom-harness.schema.json +243 -0
- package/harnesses.json +244 -6
- package/package.json +3 -2
- package/src/checks/ci-workflow.mjs +105 -0
- package/src/checks/claude-app.mjs +11 -2
- package/src/checks/custom-harness.mjs +157 -0
- package/src/checks/github-app.mjs +214 -0
- package/src/checks/rulesets.mjs +9 -8
- package/src/checks/secrets-and-variables.mjs +27 -8
- package/src/checks/stages.mjs +705 -0
- package/src/cli.mjs +583 -36
- package/src/deep-scan/agent.mjs +88 -21
- package/src/deep-scan/credential.mjs +81 -32
- package/src/deep-scan/docker-driver.mjs +105 -42
- package/src/deep-scan/harness-text.mjs +99 -0
- package/src/deep-scan/lifecycle.mjs +68 -178
- package/src/deep-scan/limits.mjs +13 -7
- package/src/deep-scan/model-proxy.mjs +21 -10
- package/src/deep-scan/preflight.mjs +19 -6
- package/src/deep-scan/recipe.mjs +4 -0
- package/src/deep-scan/runtime.mjs +54 -6
- package/src/deep-scan/sandbox-run.mjs +232 -0
- package/src/deep-scan/sbx-driver.mjs +224 -39
- package/src/deep-scan/tar.mjs +69 -22
- package/src/deep-scan/verify.mjs +6 -1
- package/src/deep-scan.mjs +73 -13
- package/src/doctor.mjs +166 -5
- package/src/exec.mjs +14 -5
- package/src/factory/budget/budget.mjs +259 -0
- package/src/factory/build/command.mjs +321 -0
- package/src/factory/build/factory.mjs +473 -0
- package/src/factory/build/findings.mjs +55 -0
- package/src/factory/build/host.mjs +230 -0
- package/src/factory/build/notes.mjs +191 -0
- package/src/factory/build/pull-request.mjs +74 -0
- package/src/factory/bundle.mjs +146 -0
- package/src/factory/checks/allowed-paths.mjs +50 -0
- package/src/factory/checks/plan-header.mjs +296 -0
- package/src/factory/checks/qa.mjs +85 -0
- package/src/factory/checks/review.mjs +73 -0
- package/src/factory/checks/security.mjs +50 -0
- package/src/factory/checks/stage-check.mjs +89 -0
- package/src/factory/claims/command.mjs +187 -0
- package/src/factory/claims/release.mjs +111 -0
- package/src/factory/decision/answers.mjs +103 -0
- package/src/factory/decision/command.mjs +64 -0
- package/src/factory/decision/plan.mjs +99 -0
- package/src/factory/decision/request.mjs +116 -0
- package/src/factory/doctor/files.mjs +329 -0
- package/src/factory/doctor/index.mjs +56 -0
- package/src/factory/doctor/local.mjs +497 -0
- package/src/factory/doctor/orchestrate.mjs +146 -0
- package/src/factory/engine/lease.mjs +146 -0
- package/src/factory/engine/local-engine.mjs +177 -0
- package/src/factory/engine/lockfile.mjs +64 -0
- package/src/factory/engine/workflow-engine.mjs +124 -0
- package/src/factory/gate/comment.mjs +88 -0
- package/src/factory/gate/config.mjs +57 -0
- package/src/factory/gate/gate-core.mjs +250 -0
- package/src/factory/gate/guarded.mjs +17 -0
- package/src/factory/gate/reads.mjs +105 -0
- package/src/factory/gate/task.mjs +193 -0
- package/src/factory/gate/trip-reads.mjs +82 -0
- package/src/factory/gate/trip.mjs +87 -0
- package/src/factory/init/blueprint.mjs +174 -0
- package/src/factory/init/index.mjs +337 -0
- package/src/factory/labels/evidence.mjs +162 -0
- package/src/factory/labels/moves.mjs +32 -0
- package/src/factory/labels/reconcile.mjs +267 -0
- package/src/factory/labels/revert.mjs +87 -0
- package/src/factory/labels/timeline.mjs +72 -0
- package/src/factory/labels/voided.mjs +59 -0
- package/src/factory/limits/harness.mjs +39 -0
- package/src/factory/limits/limits.mjs +123 -0
- package/src/factory/merge/command.mjs +172 -0
- package/src/factory/outbox/check.mjs +240 -0
- package/src/factory/outbox/rulings.mjs +195 -0
- package/src/factory/plan/command.mjs +66 -0
- package/src/factory/plan/comment.mjs +156 -0
- package/src/factory/plan/publish.mjs +149 -0
- package/src/factory/plan/risk.mjs +153 -0
- package/src/factory/qa/command.mjs +163 -0
- package/src/factory/records/engine-record.mjs +133 -0
- package/src/factory/records/main.mjs +96 -0
- package/src/factory/records/record.mjs +226 -0
- package/src/factory/records/sink.mjs +57 -0
- package/src/factory/report/build.mjs +92 -0
- package/src/factory/report/command.mjs +80 -0
- package/src/factory/report/facts.mjs +226 -0
- package/src/factory/report/gate-section.mjs +122 -0
- package/src/factory/report/metrics.mjs +111 -0
- package/src/factory/report/reads.mjs +246 -0
- package/src/factory/report/render.mjs +121 -0
- package/src/factory/report/rollout.mjs +154 -0
- package/src/factory/review/command.mjs +182 -0
- package/src/factory/run/awake.mjs +70 -0
- package/src/factory/run/collect.mjs +77 -0
- package/src/factory/run/command.mjs +490 -0
- package/src/factory/run/gh.mjs +46 -0
- package/src/factory/run/launch.mjs +47 -0
- package/src/factory/run/pipelines.mjs +261 -0
- package/src/factory/run/raw.mjs +96 -0
- package/src/factory/run/restart.mjs +83 -0
- package/src/factory/run/s3.mjs +193 -0
- package/src/factory/run/secrets.mjs +142 -0
- package/src/factory/run/teardown.mjs +242 -0
- package/src/factory/run/token.mjs +68 -0
- package/src/factory/security/command.mjs +157 -0
- package/src/factory/setup/app.mjs +122 -0
- package/src/factory/setup/command.mjs +409 -0
- package/src/factory/setup/labels.mjs +25 -0
- package/src/factory/setup/reads.mjs +129 -0
- package/src/factory/setup/writes.mjs +126 -0
- package/src/factory/snapshot/write.mjs +176 -0
- package/src/factory/stop/command.mjs +136 -0
- package/src/factory/sweep/actions-main.mjs +117 -0
- package/src/factory/sweep/command.mjs +65 -0
- package/src/factory/sweep/knobs.mjs +78 -0
- package/src/factory/sweep/marker-version.mjs +15 -0
- package/src/factory/sweep/markers.mjs +112 -0
- package/src/factory/sweep/overlap.mjs +24 -0
- package/src/factory/sweep/run.mjs +198 -0
- package/src/factory/sweep/shell.mjs +394 -0
- package/src/factory/sweep/split.mjs +104 -0
- package/src/factory/sweep/states.mjs +87 -0
- package/src/factory/sweep/sweep-core.mjs +1781 -0
- package/src/factory/tracker/github.mjs +674 -0
- package/src/factory/tracker/operations.mjs +153 -0
- package/src/factory/upgrade/index.mjs +83 -0
- package/src/harness/adapters.mjs +30 -0
- package/src/harness/antigravity.mjs +187 -0
- package/src/harness/claude-code.mjs +8 -1
- package/src/harness/codex.mjs +219 -0
- package/src/harness/cursor.mjs +199 -0
- package/src/harness/custom/registry.mjs +21 -0
- package/src/harness/custom/schema.mjs +90 -0
- package/src/harness/custom.mjs +299 -0
- package/src/harness/facts.mjs +44 -7
- package/src/harness/gemini.mjs +164 -0
- package/src/harness/install-layer.mjs +86 -3
- package/src/harness/opencode.mjs +289 -0
- package/src/harness/resolve.mjs +156 -0
- package/src/harness/support-levels.mjs +151 -3
- package/src/harness-live/assess.mjs +29 -6
- package/src/harness-live/cursor-real.mjs +146 -0
- package/src/harness-live/cursor-version.mjs +70 -0
- package/src/harness-live/cursor.mjs +80 -0
- package/src/harness-live/custom.mjs +91 -0
- package/src/harness-live/fixture-harness.mjs +45 -0
- package/src/harness-live/harnesses.mjs +263 -0
- package/src/harness-live/host.mjs +113 -4
- package/src/harness-live/opencode.mjs +289 -0
- package/src/harness-live/probes.mjs +87 -7
- package/src/harness-live/run.mjs +101 -20
- package/src/harness-live/setup.mjs +126 -0
- package/src/harness-live/stage.mjs +25 -15
- package/src/harness-live/suite.mjs +276 -95
- package/src/harness-test.mjs +116 -0
- package/src/init.mjs +374 -36
- package/src/kit-owned-paths.mjs +1 -1
- package/src/model-proxy/core.mjs +128 -20
- package/src/model-proxy/profiles/anthropic.mjs +54 -10
- package/src/model-proxy/profiles/gemini-api.mjs +311 -0
- package/src/model-proxy/profiles/openai.mjs +327 -0
- package/src/model-proxy/stub-dialects/gemini-api.mjs +178 -0
- package/src/model-proxy/stub-dialects/openai.mjs +173 -0
- package/src/model-proxy/stub.mjs +9 -1
- package/src/stage/audit.mjs +79 -0
- package/src/stage/egress-route.mjs +207 -0
- package/src/stage/implement/carry.mjs +308 -0
- package/src/stage/implement/sandbox.mjs +271 -0
- package/src/stage/implement/verify.mjs +70 -0
- package/src/stage/implement.mjs +218 -0
- package/src/stage/plan.mjs +115 -0
- package/src/stage/review-response.mjs +172 -0
- package/src/stage/review.mjs +185 -0
- package/src/stage/workspace.mjs +274 -0
- package/src/stage.mjs +1087 -0
- package/src/upgrade.mjs +39 -7
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// The live suite's setup scenario (ADRs 0025, 0029 and 0047): the implement
|
|
2
|
+
// Stage on a Consumer's `sandbox_image`, with `setup_commands` that try the
|
|
3
|
+
// network while setup's egress is open, and leave behind what could steer the
|
|
4
|
+
// agent: harness config, an instruction file and a git hook outside the
|
|
5
|
+
// workspace, an edit to the harness's files, and a running process. The Guards
|
|
6
|
+
// are judged as for every scenario, and two named assertions hold that the
|
|
7
|
+
// registry named was reached and no other host, and that none of what setup
|
|
8
|
+
// left reached the agent's container while the declared path did.
|
|
9
|
+
|
|
10
|
+
/** The harness the scenario runs on: the setup is the Launcher's, not a harness's. */
|
|
11
|
+
export const SETUP_HARNESS = "claude-code";
|
|
12
|
+
|
|
13
|
+
/** The node preset's image, by tag, so the run resolves its digest. */
|
|
14
|
+
export const SETUP_IMAGE = "node:22-bookworm";
|
|
15
|
+
|
|
16
|
+
/** The one registry the scenario names. */
|
|
17
|
+
export const SETUP_REGISTRY = "registry.npmjs.org";
|
|
18
|
+
|
|
19
|
+
/** The path the scenario declares in `--setup-paths`, which must cross. */
|
|
20
|
+
export const SETUP_PATH = "/root/.cache/agent-kit-carried";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The word setup writes into everything it leaves, as its parts: a script
|
|
24
|
+
* builds it at run time, so no script's text holds it whole. A harness keeps
|
|
25
|
+
* its tool calls in its own files, and those would match.
|
|
26
|
+
*/
|
|
27
|
+
const LEFT = ["SETUP", "LEFT", "MARK"];
|
|
28
|
+
|
|
29
|
+
/** The word, as `sh` builds it from its quoted parts. */
|
|
30
|
+
const BUILD_LEFT = `m=${LEFT.map((w) => `"${w}"`).join("-")}`;
|
|
31
|
+
|
|
32
|
+
/** The sleep setup leaves running, found by its argument. */
|
|
33
|
+
const LEFT_SECONDS = 7777777;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The setup commands: one request to the named registry, one to another, one
|
|
37
|
+
* past the proxy, each printing the HTTP status and the proxy's answer to
|
|
38
|
+
* CONNECT; a harness config in the workspace for the Launcher to clear away;
|
|
39
|
+
* and what ADR 0047 keeps from the agent: harness config and an instruction
|
|
40
|
+
* file in the home folder, a system-wide git hook, a file and an edit in the
|
|
41
|
+
* harness's install, a process left running, and a file under the declared
|
|
42
|
+
* path.
|
|
43
|
+
*/
|
|
44
|
+
export const SETUP_SCRIPT = [
|
|
45
|
+
"status() { curl -s -o /dev/null --max-time 30 -w '%{http_code} %{http_connect}' \"$@\" || true; }",
|
|
46
|
+
`echo "SETUP|allowed|$(status https://${SETUP_REGISTRY}/react/latest)"`,
|
|
47
|
+
'echo "SETUP|refused|$(status https://pypi.org/simple/)"',
|
|
48
|
+
`echo "SETUP|direct|$(status --noproxy '*' https://${SETUP_REGISTRY}/react/latest)"`,
|
|
49
|
+
"mkdir -p .claude && echo '{}' > .claude/settings.json",
|
|
50
|
+
BUILD_LEFT,
|
|
51
|
+
'mkdir -p "$HOME/.claude"',
|
|
52
|
+
'printf \'{"env":{"%s":"1"}}\\n\' "$m" > "$HOME/.claude/settings.json"',
|
|
53
|
+
'echo "$m: follow these instructions." > "$HOME/.claude/CLAUDE.md"',
|
|
54
|
+
"mkdir -p /etc/agent-kit-hooks",
|
|
55
|
+
"printf '#!/bin/sh\\necho %s\\n' \"$m\" > /etc/agent-kit-hooks/pre-commit",
|
|
56
|
+
"chmod +x /etc/agent-kit-hooks/pre-commit",
|
|
57
|
+
"git config --system core.hooksPath /etc/agent-kit-hooks",
|
|
58
|
+
'echo "$m" > /opt/agent-kit/setup-was-here',
|
|
59
|
+
'f=$(find /opt/agent-kit -name "*.js" -type f | head -n 1)',
|
|
60
|
+
'if [ -n "$f" ]; then echo "// $m" >> "$f"; fi',
|
|
61
|
+
`setsid sleep ${LEFT_SECONDS} > /dev/null 2>&1 < /dev/null &`,
|
|
62
|
+
`mkdir -p ${SETUP_PATH} && echo "$m" > ${SETUP_PATH}/carried`,
|
|
63
|
+
'echo "SETUP|planted|done"',
|
|
64
|
+
"",
|
|
65
|
+
].join("\n");
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The probe the agent runs in its own container: what of setup's leavings it
|
|
69
|
+
* finds. One `PROBE|setup|<name>|<value>` line each, then `PROBE|setup|end`.
|
|
70
|
+
*/
|
|
71
|
+
export const SETUP_PROBE = [
|
|
72
|
+
BUILD_LEFT,
|
|
73
|
+
"found() {",
|
|
74
|
+
` timeout 30 grep -rIls --devices=skip --exclude-dir=${SETUP_PATH.slice(SETUP_PATH.lastIndexOf("/") + 1)} "$m" "$@" 2>/dev/null | head -n 5 | tr '\\n' ' '`,
|
|
75
|
+
"}",
|
|
76
|
+
'echo "PROBE|setup|home|$(found /root /home)"',
|
|
77
|
+
'echo "PROBE|setup|etc|$(found /etc)"',
|
|
78
|
+
'echo "PROBE|setup|harness|$(found /opt/agent-kit)"',
|
|
79
|
+
'echo "PROBE|setup|hooks|$(git config --system --get core.hooksPath 2>/dev/null || echo unset)"',
|
|
80
|
+
// A command line that is the sleep's alone: this shell's holds the number too.
|
|
81
|
+
"left=0",
|
|
82
|
+
"for f in /proc/[0-9]*/cmdline; do",
|
|
83
|
+
` [ "$(tr '\\0' ' ' < "$f" 2>/dev/null)" = "sleep ${LEFT_SECONDS} " ] && left=$((left + 1))`,
|
|
84
|
+
"done",
|
|
85
|
+
'echo "PROBE|setup|process|$left"',
|
|
86
|
+
`echo "PROBE|setup|declared|$(cat ${SETUP_PATH}/carried 2>/dev/null || echo absent)"`,
|
|
87
|
+
'echo "PROBE|setup|end"',
|
|
88
|
+
].join("\n");
|
|
89
|
+
|
|
90
|
+
/** @type {Readonly<import("./harnesses.mjs").NamedAssertion>} */
|
|
91
|
+
export const SETUP_REACHES_ITS_REGISTRY_ALONE = Object.freeze({
|
|
92
|
+
name: "setup reaches the named registry alone",
|
|
93
|
+
check({ launcherOutput }) {
|
|
94
|
+
const seen = (probe) => new RegExp(`^SETUP\\|${probe}\\|(.*)$`, "m").exec(launcherOutput)?.[1];
|
|
95
|
+
const wanted = [
|
|
96
|
+
["allowed", "200 200", "the named registry was not reached"],
|
|
97
|
+
["refused", "000 403", "the proxy did not refuse another host"],
|
|
98
|
+
["direct", "000 000", "a request past the proxy got through"],
|
|
99
|
+
];
|
|
100
|
+
const failed = wanted.find(([probe, answer]) => seen(probe) !== answer);
|
|
101
|
+
return failed ? `${failed[2]} (saw ${seen(failed[0]) ?? "nothing"})` : null;
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
/** @type {Readonly<import("./harnesses.mjs").NamedAssertion>} */
|
|
106
|
+
export const SETUP_LEAVES_THE_AGENT_ALONE = Object.freeze({
|
|
107
|
+
name: "nothing setup left outside the workspace reaches the agent but the declared path",
|
|
108
|
+
check({ launcherOutput, outputs = {} }) {
|
|
109
|
+
if (!/^SETUP\|planted\|done$/m.test(launcherOutput))
|
|
110
|
+
return "setup did not plant what it leaves";
|
|
111
|
+
const output = outputs.setup ?? "";
|
|
112
|
+
if (!output.includes("PROBE|setup|end")) return "the setup probe did not finish";
|
|
113
|
+
const seen = (name) =>
|
|
114
|
+
new RegExp(`^PROBE\\|setup\\|${name}\\|(.*)$`, "m").exec(output)?.[1].trim();
|
|
115
|
+
const wanted = [
|
|
116
|
+
["home", "", "setup's harness config or instruction file reached the agent's home"],
|
|
117
|
+
["etc", "", "setup's system git hook reached the agent"],
|
|
118
|
+
["harness", "", "setup's edit to the harness's files reached the agent"],
|
|
119
|
+
["hooks", "unset", "setup's git hooksPath reached the agent"],
|
|
120
|
+
["process", "0", "a process setup left runs beside the agent"],
|
|
121
|
+
["declared", LEFT.join("-"), "the declared setup path did not reach the agent"],
|
|
122
|
+
];
|
|
123
|
+
const failed = wanted.find(([name, answer]) => seen(name) !== answer);
|
|
124
|
+
return failed ? `${failed[2]} (saw ${JSON.stringify(seen(failed[0]) ?? null)})` : null;
|
|
125
|
+
},
|
|
126
|
+
});
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// by its adapter's launch plan, in the Deep scan's sandbox driver, behind the
|
|
3
3
|
// real model proxy, handed a brief, with one result file copied out.
|
|
4
4
|
//
|
|
5
|
-
// The
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
5
|
+
// The CI Stages the kit runs enter through `agent-kit stage` itself
|
|
6
|
+
// (suite.mjs). This composes the same driver, adapter, agent script and proxy
|
|
7
|
+
// for the checkout-config control beside them, and nothing here ships to a
|
|
8
|
+
// Consumer's run. The checkout's config is kept out
|
|
9
|
+
// as the adapter's launch plan says: by its launch, and where the plan says so
|
|
10
|
+
// by removing it from the copy.
|
|
10
11
|
|
|
11
12
|
import { randomBytes } from "node:crypto";
|
|
12
13
|
import { writeFileSync } from "node:fs";
|
|
@@ -16,9 +17,8 @@ import { callerKeyFor, withoutCredentials } from "../deep-scan/credential.mjs";
|
|
|
16
17
|
import { dockerDriver } from "../deep-scan/docker-driver.mjs";
|
|
17
18
|
import { StepFailed } from "../deep-scan/steps.mjs";
|
|
18
19
|
import { tarOf } from "../deep-scan/tar.mjs";
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { anthropic } from "../model-proxy/profiles/anthropic.mjs";
|
|
20
|
+
import { adapterFor } from "../harness/adapters.mjs";
|
|
21
|
+
import { startModelProxy } from "../deep-scan/model-proxy.mjs";
|
|
22
22
|
|
|
23
23
|
/** Where the Stage's result goes in the sandbox. */
|
|
24
24
|
export const STAGE_RESULT_PATH = "/agent-kit/out/result.md";
|
|
@@ -40,11 +40,14 @@ const MAX_TOKENS = 20_000_000;
|
|
|
40
40
|
* runtime: import("../deep-scan/runtime.mjs").Runtime,
|
|
41
41
|
* root: string,
|
|
42
42
|
* commit: string,
|
|
43
|
+
* harness?: string,
|
|
43
44
|
* credential: string,
|
|
44
45
|
* credentialKind: "api-key" | "subscription",
|
|
46
|
+
* model?: string,
|
|
45
47
|
* modelApi: string,
|
|
46
48
|
* outDir: string,
|
|
47
|
-
*
|
|
49
|
+
* beforeAgent?: (container: string, launch: { env: string[], url: string, plan: import("../harness/claude-code.mjs").LaunchPlan }) => Promise<void>,
|
|
50
|
+
* beforeTeardown: (container: string, launch: { env: string[], url: string, plan: import("../harness/claude-code.mjs").LaunchPlan }) => Promise<void>,
|
|
48
51
|
* out: (s: string) => void,
|
|
49
52
|
* err: (s: string) => void,
|
|
50
53
|
* }} opts `modelApi` is the proxy's upstream: here, the stub model.
|
|
@@ -56,10 +59,13 @@ export async function runReadOnlyStage({
|
|
|
56
59
|
runtime,
|
|
57
60
|
root,
|
|
58
61
|
commit,
|
|
62
|
+
harness = "claude-code",
|
|
59
63
|
credential,
|
|
60
64
|
credentialKind,
|
|
65
|
+
model,
|
|
61
66
|
modelApi,
|
|
62
67
|
outDir,
|
|
68
|
+
beforeAgent = async () => {},
|
|
63
69
|
beforeTeardown,
|
|
64
70
|
out,
|
|
65
71
|
err,
|
|
@@ -69,8 +75,9 @@ export async function runReadOnlyStage({
|
|
|
69
75
|
const signal = AbortSignal.timeout(TIMEOUT_MS);
|
|
70
76
|
const call = (cmd, args, opts = {}) => runner.start(cmd, args, { ...opts, signal });
|
|
71
77
|
const id = randomBytes(6).toString("hex");
|
|
72
|
-
const request = { stage: "review", credentialKind };
|
|
73
|
-
const
|
|
78
|
+
const request = { stage: "review", credentialKind, model };
|
|
79
|
+
const adapter = adapterFor(harness);
|
|
80
|
+
const driver = dockerDriver({ runtime, id, call, plan: adapter(request) });
|
|
74
81
|
const steps = { setup: [], start: [], ready: [], seed: [], registries: [], grounding: [] };
|
|
75
82
|
const must = (condition, why) => {
|
|
76
83
|
if (!condition) throw new StepFailed([`FAILED ${why}.`]);
|
|
@@ -89,9 +96,10 @@ export async function runReadOnlyStage({
|
|
|
89
96
|
await driver.cutEgress();
|
|
90
97
|
const left = await driver.egressLeft();
|
|
91
98
|
must(left === null, `the network is not cut: ${left}`);
|
|
92
|
-
const callerKey = callerKeyFor(credentialKind);
|
|
99
|
+
const callerKey = callerKeyFor(credentialKind, harness, model);
|
|
93
100
|
const route = await driver.openModelRoute(async (bind) => {
|
|
94
|
-
proxy = await
|
|
101
|
+
proxy = await startModelProxy({
|
|
102
|
+
profile: adapter(request).modelRoute.profile,
|
|
95
103
|
credential,
|
|
96
104
|
kind: credentialKind,
|
|
97
105
|
bind,
|
|
@@ -112,7 +120,7 @@ export async function runReadOnlyStage({
|
|
|
112
120
|
]),
|
|
113
121
|
"copying the brief in",
|
|
114
122
|
);
|
|
115
|
-
const plan =
|
|
123
|
+
const plan = adapter({
|
|
116
124
|
...request,
|
|
117
125
|
proxyUrl: route.url,
|
|
118
126
|
briefPath: BRIEF_PATH,
|
|
@@ -121,12 +129,14 @@ export async function runReadOnlyStage({
|
|
|
121
129
|
callerKey,
|
|
122
130
|
});
|
|
123
131
|
out(`Agent step: ${plan.identity.displayName} ${plan.identity.version}, a read-only Stage.`);
|
|
132
|
+
const launch = { env: plan.launch.env, url: route.url, plan };
|
|
133
|
+
await beforeAgent(driver.container, launch);
|
|
124
134
|
const agent = await driver.exec(
|
|
125
135
|
agentScript({ plan, report: STAGE_RESULT_PATH, workspace: "/workspace" }),
|
|
126
136
|
{ env: plan.launch.env },
|
|
127
137
|
);
|
|
128
138
|
if (agent.status !== 0) err(`The agent step exited ${agent.status}:\n${agent.stderr}`);
|
|
129
|
-
await beforeTeardown(driver.container,
|
|
139
|
+
await beforeTeardown(driver.container, launch);
|
|
130
140
|
const file = await driver.copyOut(STAGE_RESULT_PATH, { maxBytes: MAX_RESULT });
|
|
131
141
|
if (!("data" in file)) {
|
|
132
142
|
err("FAILED no result came out.");
|