@cat-factory/server 0.315.2 → 0.317.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.
- package/dist/agents/ContainerAgentExecutor.d.ts +24 -20
- package/dist/agents/ContainerAgentExecutor.d.ts.map +1 -1
- package/dist/agents/ContainerAgentExecutor.js +61 -113
- package/dist/agents/ContainerAgentExecutor.js.map +1 -1
- package/dist/agents/ContainerEnvironmentProbeAgent.d.ts +163 -0
- package/dist/agents/ContainerEnvironmentProbeAgent.d.ts.map +1 -0
- package/dist/agents/ContainerEnvironmentProbeAgent.js +414 -0
- package/dist/agents/ContainerEnvironmentProbeAgent.js.map +1 -0
- package/dist/agents/ModelRouter.d.ts +40 -4
- package/dist/agents/ModelRouter.d.ts.map +1 -1
- package/dist/agents/ModelRouter.js +1 -1
- package/dist/agents/ModelRouter.js.map +1 -1
- package/dist/agents/containerJobAccounting.d.ts +10 -3
- package/dist/agents/containerJobAccounting.d.ts.map +1 -1
- package/dist/agents/containerJobAccounting.js +11 -4
- package/dist/agents/containerJobAccounting.js.map +1 -1
- package/dist/agents/containerJobAuth.d.ts +146 -0
- package/dist/agents/containerJobAuth.d.ts.map +1 -0
- package/dist/agents/containerJobAuth.js +171 -0
- package/dist/agents/containerJobAuth.js.map +1 -0
- package/dist/agents/dispatchPromptContext.d.ts +30 -0
- package/dist/agents/dispatchPromptContext.d.ts.map +1 -0
- package/dist/agents/dispatchPromptContext.js +23 -0
- package/dist/agents/dispatchPromptContext.js.map +1 -0
- package/dist/agents/singleKindModel.d.ts +46 -0
- package/dist/agents/singleKindModel.d.ts.map +1 -0
- package/dist/agents/singleKindModel.js +59 -0
- package/dist/agents/singleKindModel.js.map +1 -0
- package/dist/agents/testCredentials.d.ts +25 -0
- package/dist/agents/testCredentials.d.ts.map +1 -0
- package/dist/agents/testCredentials.js +23 -0
- package/dist/agents/testCredentials.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/environments/EnvironmentController.d.ts.map +1 -1
- package/dist/modules/environments/EnvironmentController.js +46 -1
- package/dist/modules/environments/EnvironmentController.js.map +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { failureKindFromHarnessCause, getErrorMessage } from '@cat-factory/kernel';
|
|
2
|
+
import { environmentProbeSystemPrompt, environmentProbeUserPrompt, ENVIRONMENT_PROBE_SHAPE_HINT, } from '@cat-factory/agents';
|
|
3
|
+
import { environmentProbeAgentKind, isEnvironmentProbeReportPayload } from '@cat-factory/contracts';
|
|
4
|
+
import { ContainerJobAccounting, } from './containerJobAccounting.js';
|
|
5
|
+
import { providerOf } from './containerJobAddressing.js';
|
|
6
|
+
import { resolveTestCredentials } from './testCredentials.js';
|
|
7
|
+
import { githubRepoOrigin } from './containerAgentBody.js';
|
|
8
|
+
import { RunnerJobClient } from './RunnerJobClient.js';
|
|
9
|
+
import { logger } from '../observability/logger.js';
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// The AGENT DRY RUN's dispatcher: one read-only `explore` job pointed at a freshly provisioned
|
|
12
|
+
// ephemeral environment, whose whole product is the structured report on `result.custom`.
|
|
13
|
+
//
|
|
14
|
+
// It implements the kernel {@link EnvironmentProbeAgent} port and is shaped exactly like
|
|
15
|
+
// {@link import('./ContainerEnvConfigRepairer.js').ContainerEnvConfigRepairer}: mint the tokens,
|
|
16
|
+
// build the harness body, dispatch through the shared {@link RunnerJobClient}, poll, reclaim. What
|
|
17
|
+
// differs from that flow is only what the job IS: `mode: 'explore'` with a structured output and
|
|
18
|
+
// NO push (this agent must never change the repository), against `infra: ephemeral`, which stands
|
|
19
|
+
// nothing up and hands the environment's URL to the harness so a container backend can bridge it.
|
|
20
|
+
//
|
|
21
|
+
// Four details are load-bearing and each cost a real bug elsewhere in this codebase first:
|
|
22
|
+
//
|
|
23
|
+
// - The dispatch DECLARES its environment through `RunnerDispatchOptions.environments`. That is
|
|
24
|
+
// what feeds the container's hosts entry (`--add-host` / `hostAliases`), and a transport is
|
|
25
|
+
// documented never to reach into the body for it. Omitted, the local backend cannot bridge the
|
|
26
|
+
// environment's name and every operation the prober attempts reports `unreachable`.
|
|
27
|
+
// - The IMAGE is pinned per surface, and the same value rides the `RunnerJobRef` on every poll
|
|
28
|
+
// and release. A per-run container backend puts a differently-imaged job in its own container,
|
|
29
|
+
// so a poll that forgot the variant polls a container that was never started, and a release
|
|
30
|
+
// that forgot it leaves a browser container running for its full lifetime.
|
|
31
|
+
// - The MODEL is resolved PER DISPATCH, by the same precedence a pipeline step's is (the frame's
|
|
32
|
+
// pin, else the workspace's model preset for this prober's kind, else the deployment's env
|
|
33
|
+
// routing), and with it the HARNESS and the credential that opens it. Read at wiring from the
|
|
34
|
+
// env routing instead, it is whatever that deployment defaults to: a workspace running
|
|
35
|
+
// everything on its Claude preset had its dry run dispatched at Qwen, which the LLM proxy then
|
|
36
|
+
// refused for having no key, and the prober's subscription was never asked for at all.
|
|
37
|
+
// - The TEST SECRETS are resolved ONCE here: the values go on the body's dedicated `testSecrets`
|
|
38
|
+
// field (the harness turns them into the agent process's environment) and the key +
|
|
39
|
+
// description pairs of that SAME list are what the prompt advertises. One resolution, so the
|
|
40
|
+
// prompt cannot name a variable the container does not carry, and the three states that
|
|
41
|
+
// resolution can END in are stated to the prober rather than collapsed into an empty list.
|
|
42
|
+
// - What the dispatch RESOLVED rides back on the handle and is persisted by the caller, and what
|
|
43
|
+
// the job SPENT is filed through the same `ContainerJobAccounting` a pipeline step's is. A
|
|
44
|
+
// subscription-routed dry run talks straight to the vendor, so the LLM proxy meters none of it:
|
|
45
|
+
// with no accounting here its whole burn was absent from `llm_call_metrics`, from the leased
|
|
46
|
+
// token's usage-aware rotation, and from the modeled quota cycle. Free and invisible, on the one
|
|
47
|
+
// flow whose own admission gate is a budget.
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
/**
|
|
50
|
+
* The `provider:model` label a dispatch is recorded under, spelled the same way the step path
|
|
51
|
+
* spells it (`ContainerAgentExecutor`'s `buildJobBody`), so one reader can parse either.
|
|
52
|
+
*/
|
|
53
|
+
function modelLabel(ref) {
|
|
54
|
+
return `${ref.provider}:${ref.model}`;
|
|
55
|
+
}
|
|
56
|
+
/** Which executor image each surface needs. */
|
|
57
|
+
const IMAGE_BY_SURFACE = {
|
|
58
|
+
// The plain harness image: `curl` and the repo's own runtime are all an HTTP prober needs.
|
|
59
|
+
api: undefined,
|
|
60
|
+
// The heavier UI image, which bundles Playwright and a browser. A browser prober on the plain
|
|
61
|
+
// image discovers it has no browser only after the container is up and the model has started
|
|
62
|
+
// reasoning, and reports it as `tooling_missing`: a spent dispatch that says nothing about the
|
|
63
|
+
// environment.
|
|
64
|
+
ui: 'ui',
|
|
65
|
+
};
|
|
66
|
+
export class ContainerEnvironmentProbeAgent {
|
|
67
|
+
deps;
|
|
68
|
+
jobs;
|
|
69
|
+
accounting;
|
|
70
|
+
constructor(deps) {
|
|
71
|
+
this.deps = deps;
|
|
72
|
+
this.jobs = new RunnerJobClient(deps.resolveTransport);
|
|
73
|
+
this.accounting = new ContainerJobAccounting(deps.accounting ?? {});
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Whether the workspace's resolved runner backend can serve this surface's executor image.
|
|
77
|
+
*
|
|
78
|
+
* The backend is asked because it is the only thing that knows: a Worker binds container
|
|
79
|
+
* classes, a local transport pins image tags, and a self-hosted pool resolves images on its own
|
|
80
|
+
* side and cannot answer at all. That last case answers TRUE (see the port): an unknown is not a
|
|
81
|
+
* refusal, and a deployment whose pool has no UI image still fails at dispatch exactly as every
|
|
82
|
+
* other container flow does there.
|
|
83
|
+
*
|
|
84
|
+
* A transport that cannot even be RESOLVED is `false`: a dry run needs a runner, and refusing at
|
|
85
|
+
* admission is the whole point of asking here.
|
|
86
|
+
*/
|
|
87
|
+
async supports(workspaceId, surface) {
|
|
88
|
+
const transport = await this.deps.resolveTransport(workspaceId).catch(() => null);
|
|
89
|
+
if (!transport)
|
|
90
|
+
return false;
|
|
91
|
+
return transport.supportsImage?.(IMAGE_BY_SURFACE[surface]) ?? true;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Whether the model this frame's dry run resolves to can actually be dispatched, run at ADMISSION
|
|
95
|
+
* over the same two steps `start` takes: resolve the model (which refuses a provider the LLM proxy
|
|
96
|
+
* cannot serve), then ask the auth resolver whether the harness that model names has a credential
|
|
97
|
+
* to open it.
|
|
98
|
+
*
|
|
99
|
+
* Asked here rather than left to the dispatch because both answers are already knowable, and
|
|
100
|
+
* neither is knowable cheaply later: reached from inside `stage.dispatch`, each one fails the run
|
|
101
|
+
* at `probing` after a throwaway branch, a full provision and a teardown, to report something the
|
|
102
|
+
* workspace's own preset said before anything was created.
|
|
103
|
+
*
|
|
104
|
+
* A resolution that THROWS is the refusal, carried verbatim: `resolveDispatchRef`'s message
|
|
105
|
+
* already names the fix (pick a Workers AI model, configure a provider key, add a local runner),
|
|
106
|
+
* and re-wording it here would hand the operator two spellings of one problem.
|
|
107
|
+
*/
|
|
108
|
+
async checkDispatchable(subject) {
|
|
109
|
+
let resolved;
|
|
110
|
+
try {
|
|
111
|
+
resolved = await this.resolveModel(subject, subject.surface);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
return { ok: false, detail: getErrorMessage(error) };
|
|
115
|
+
}
|
|
116
|
+
const gap = await this.deps.auth.describeAuthGap({
|
|
117
|
+
harness: resolved.harness,
|
|
118
|
+
subscriptionVendor: resolved.subscriptionVendor,
|
|
119
|
+
workspaceId: subject.workspaceId,
|
|
120
|
+
...(subject.initiatedBy ? { initiatedByUserId: subject.initiatedBy } : {}),
|
|
121
|
+
});
|
|
122
|
+
return gap ? { ok: false, detail: gap } : { ok: true, model: modelLabel(resolved.ref) };
|
|
123
|
+
}
|
|
124
|
+
async start(request) {
|
|
125
|
+
const { workspaceId, jobId, surface, repo, environment } = request;
|
|
126
|
+
const log = logger.child({
|
|
127
|
+
jobId,
|
|
128
|
+
workspaceId,
|
|
129
|
+
surface,
|
|
130
|
+
repo: `${repo.owner}/${repo.name}`,
|
|
131
|
+
});
|
|
132
|
+
const installation = await this.deps.installationRepository.getByWorkspace(workspaceId);
|
|
133
|
+
if (!installation || installation.deletedAt) {
|
|
134
|
+
throw new Error(`Workspace '${workspaceId}' is not connected to a source-control provider, so the ` +
|
|
135
|
+
'agent dry run has no repository to read.');
|
|
136
|
+
}
|
|
137
|
+
if (!environment.url) {
|
|
138
|
+
throw new Error('The environment exposed no URL, so there is nothing for an agent to drive.');
|
|
139
|
+
}
|
|
140
|
+
const agentKind = environmentProbeAgentKind(surface);
|
|
141
|
+
// The model this dispatch runs, then the credential that opens it. Both per dispatch, and in
|
|
142
|
+
// this order: the harness the model names decides which auth channel there is to resolve.
|
|
143
|
+
const { ref, harness, subscriptionVendor } = await this.resolveModel(request, surface);
|
|
144
|
+
const { auth, subscriptionTokenId } = await this.deps.auth.resolve({
|
|
145
|
+
harness,
|
|
146
|
+
ref,
|
|
147
|
+
subscriptionVendor,
|
|
148
|
+
workspaceId,
|
|
149
|
+
// The self-test run IS this flow's run, so its id is what the container's calls are metered
|
|
150
|
+
// under, and (for an individual-usage vendor) the id the initiator's credential activation
|
|
151
|
+
// was minted against by the start gate.
|
|
152
|
+
executionId: jobId,
|
|
153
|
+
agentKind,
|
|
154
|
+
...(request.initiatedBy ? { initiatedByUserId: request.initiatedBy } : {}),
|
|
155
|
+
});
|
|
156
|
+
// ONE resolution, two consumers: the values become the container's environment variables and
|
|
157
|
+
// the keys + descriptions of the same list are what the prompt advertises. See the class note.
|
|
158
|
+
// The SAME resolution the tester step's dispatch uses: one read, two projections (the values
|
|
159
|
+
// for the container, the state for the prompt). Shared because a dry run's claim is that it
|
|
160
|
+
// predicts what a tester will be handed, which it cannot do from a different read.
|
|
161
|
+
const secrets = await resolveTestCredentials({
|
|
162
|
+
...(this.deps.resolveTestSecrets ? { resolve: this.deps.resolveTestSecrets } : {}),
|
|
163
|
+
workspaceId,
|
|
164
|
+
blockId: request.blockId,
|
|
165
|
+
logger: log,
|
|
166
|
+
});
|
|
167
|
+
const repoIds = await this.resolveRepoScope(workspaceId, repo.owner, repo.name);
|
|
168
|
+
const ghToken = await this.deps.mintInstallationToken(installation.installationId, {
|
|
169
|
+
executionId: jobId,
|
|
170
|
+
workspaceId,
|
|
171
|
+
repoIds,
|
|
172
|
+
...(request.initiatedBy ? { initiatedBy: request.initiatedBy } : {}),
|
|
173
|
+
});
|
|
174
|
+
const origin = (this.deps.resolveRepoOrigin ?? githubRepoOrigin)({
|
|
175
|
+
installationId: installation.installationId,
|
|
176
|
+
repoId: repoIds[0] ?? '',
|
|
177
|
+
owner: repo.owner,
|
|
178
|
+
name: repo.name,
|
|
179
|
+
baseBranch: repo.branch,
|
|
180
|
+
...(repo.provider ? { provider: repo.provider } : {}),
|
|
181
|
+
...(repo.serviceDirectory ? { serviceDirectory: repo.serviceDirectory } : {}),
|
|
182
|
+
});
|
|
183
|
+
const body = {
|
|
184
|
+
jobId,
|
|
185
|
+
workspaceId,
|
|
186
|
+
// A single-job flow: its run IS its one job, so the correlation id the container logs bind
|
|
187
|
+
// to is the self-test run id, exactly as bootstrap and config-repair do.
|
|
188
|
+
executionId: jobId,
|
|
189
|
+
mode: 'explore',
|
|
190
|
+
systemPrompt: environmentProbeSystemPrompt(surface),
|
|
191
|
+
userPrompt: environmentProbeUserPrompt({
|
|
192
|
+
surface,
|
|
193
|
+
service: request.service,
|
|
194
|
+
environment,
|
|
195
|
+
testSecrets: secrets.brief,
|
|
196
|
+
repo: {
|
|
197
|
+
owner: repo.owner,
|
|
198
|
+
name: repo.name,
|
|
199
|
+
branch: repo.branch,
|
|
200
|
+
...(repo.serviceDirectory ? { serviceDirectory: repo.serviceDirectory } : {}),
|
|
201
|
+
},
|
|
202
|
+
}),
|
|
203
|
+
model: ref.model,
|
|
204
|
+
// The resolved auth channel, spread exactly as a pipeline step's body spreads it, so the
|
|
205
|
+
// harness cannot tell a dry run's dispatch from a step's by how it was authenticated.
|
|
206
|
+
...auth,
|
|
207
|
+
ghToken,
|
|
208
|
+
repo: {
|
|
209
|
+
owner: repo.owner,
|
|
210
|
+
name: repo.name,
|
|
211
|
+
baseBranch: repo.branch,
|
|
212
|
+
cloneUrl: origin.cloneUrl,
|
|
213
|
+
provider: origin.provider,
|
|
214
|
+
...(repo.serviceDirectory ? { serviceDirectory: repo.serviceDirectory } : {}),
|
|
215
|
+
},
|
|
216
|
+
// The THROWAWAY branch the environment was provisioned from, so the tree the prober reads
|
|
217
|
+
// is the tree that is running.
|
|
218
|
+
branch: repo.branch,
|
|
219
|
+
// `repair: true` because a dry run's whole deliverable is this JSON and a single malformed
|
|
220
|
+
// field would discard a report somebody has to act on. Deliberately NOT
|
|
221
|
+
// `failOnUnusableFinal`: the coercion is lenient by design, so a partial report is worth
|
|
222
|
+
// more than a failed stage, and a reply with nothing in it at all still reaches the caller
|
|
223
|
+
// as an `inoperable` verdict with no operations, which reads exactly as what happened.
|
|
224
|
+
output: { kind: 'structured', shapeHint: ENVIRONMENT_PROBE_SHAPE_HINT, repair: true },
|
|
225
|
+
// Stand NOTHING up: the environment is already deployed and the URL is echoed for context.
|
|
226
|
+
// The same spec a Tester gets for a provisioned service, which is what keeps the harness
|
|
227
|
+
// free of any knowledge that this flow exists.
|
|
228
|
+
infra: { kind: 'service', environment: 'ephemeral', environmentUrl: environment.url },
|
|
229
|
+
// Narrowed to `{ key, value }`, exactly as the step executor's `testSecretEnv` is: the
|
|
230
|
+
// DESCRIPTION is prompt-facing metadata, and this is the secret-bearing channel the
|
|
231
|
+
// agent-context snapshot's allow-list omits. Sending it here would put prose in a field
|
|
232
|
+
// nothing reads and the harness does not parse.
|
|
233
|
+
...(secrets.env.length ? { testSecrets: secrets.env } : {}),
|
|
234
|
+
...(this.deps.githubApiBase ? { githubApiBase: this.deps.githubApiBase } : {}),
|
|
235
|
+
};
|
|
236
|
+
log.info('environment dry run: dispatching container');
|
|
237
|
+
await this.jobs.dispatch(workspaceId, this.ref(jobId, surface), body, 'agent', {
|
|
238
|
+
...(IMAGE_BY_SURFACE[surface] ? { image: IMAGE_BY_SURFACE[surface] } : {}),
|
|
239
|
+
// Declared, never read back out of the body: see the class note. `address` rides along
|
|
240
|
+
// whenever the platform proved one, because a name that resolves nowhere from inside the
|
|
241
|
+
// container is the whole reason the bridge exists.
|
|
242
|
+
environments: [
|
|
243
|
+
{
|
|
244
|
+
url: environment.url,
|
|
245
|
+
...(environment.reachability?.address
|
|
246
|
+
? { address: environment.reachability.address }
|
|
247
|
+
: {}),
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
});
|
|
251
|
+
log.info('environment dry run: container accepted job');
|
|
252
|
+
return {
|
|
253
|
+
workspaceId,
|
|
254
|
+
jobId,
|
|
255
|
+
surface,
|
|
256
|
+
blockId: request.blockId,
|
|
257
|
+
initiatedBy: request.initiatedBy,
|
|
258
|
+
// What only THIS moment knows, handed back for the caller to persist: see
|
|
259
|
+
// `EnvironmentProbeDispatch`. The leased pooled token id in particular has no second source,
|
|
260
|
+
// and it is the row the settled job's tokens are attributed back to.
|
|
261
|
+
dispatch: {
|
|
262
|
+
model: modelLabel(ref),
|
|
263
|
+
...(subscriptionTokenId ? { subscriptionTokenId } : {}),
|
|
264
|
+
...(subscriptionVendor ? { subscriptionVendor } : {}),
|
|
265
|
+
},
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
async poll(handle) {
|
|
269
|
+
const view = await this.jobs.poll(handle.workspaceId, this.ref(handle.jobId, handle.surface));
|
|
270
|
+
// What the job has SPENT, filed on every poll and on every terminal state alike, exactly as the
|
|
271
|
+
// step path files it. See `settleAccounting` for why the failed branches below are not
|
|
272
|
+
// shortcuts past it.
|
|
273
|
+
await this.accounting.recordCalls(this.jobHandle(handle), view.callMetrics);
|
|
274
|
+
if (view.state === 'running') {
|
|
275
|
+
return view.progress ? { state: 'running', subtasks: view.progress } : { state: 'running' };
|
|
276
|
+
}
|
|
277
|
+
await this.settleAccounting(handle, view);
|
|
278
|
+
if (view.state === 'failed') {
|
|
279
|
+
return {
|
|
280
|
+
state: 'failed',
|
|
281
|
+
// The transport's structured eviction verdict first, then the harness's own cause. Both
|
|
282
|
+
// eviction kinds collapse to `evicted`: a dry run has no recovery budget to split them
|
|
283
|
+
// with (only the run driver's `recoverContainerEviction` does), so the distinction would
|
|
284
|
+
// be recorded and never acted on.
|
|
285
|
+
failureKind: view.evicted
|
|
286
|
+
? 'evicted'
|
|
287
|
+
: (failureKindFromHarnessCause(view.failureCause) ?? 'agent'),
|
|
288
|
+
error: view.error ?? 'The agent dry run job failed.',
|
|
289
|
+
...(view.error ? { detail: view.error } : {}),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
const result = view.result ?? {};
|
|
293
|
+
if (result.error) {
|
|
294
|
+
return {
|
|
295
|
+
state: 'failed',
|
|
296
|
+
failureKind: failureKindFromHarnessCause(view.failureCause) ?? 'agent',
|
|
297
|
+
error: `The agent dry run failed: ${result.error}`,
|
|
298
|
+
detail: result.error,
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
if (!isEnvironmentProbeReportPayload(result.custom)) {
|
|
302
|
+
// The job completed and returned nothing a report can be read out of: no `custom` at all, or
|
|
303
|
+
// a top-level array/string/number the harness's repair pass let through. Reported as a
|
|
304
|
+
// FAILED dry run rather than as an empty report, and the shape question is asked with the
|
|
305
|
+
// SAME predicate the coercion applies: an agent that produced nothing has established
|
|
306
|
+
// nothing about the environment, while an empty report is graded `inoperable` and rendered
|
|
307
|
+
// as a finding about the service.
|
|
308
|
+
return {
|
|
309
|
+
state: 'failed',
|
|
310
|
+
failureKind: failureKindFromHarnessCause(view.failureCause) ?? 'agent',
|
|
311
|
+
error: 'The agent dry run finished without returning a usable report, so nothing was ' +
|
|
312
|
+
'established about the environment.',
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
// The model the container RAN, as the dispatch recorded it and the caller handed it back: never
|
|
316
|
+
// re-resolved here. A fresh poll process asking the frame and the preset again would answer
|
|
317
|
+
// about them as they are NOW, so a pin cleared while the container worked stamps the report
|
|
318
|
+
// with a model nobody ran, which is the one label an operator weighs the verdict by. Absent is
|
|
319
|
+
// a state the report already documents ("absent when the dispatch did not say"), so a handle
|
|
320
|
+
// that carries none leaves the field off rather than guessing at one.
|
|
321
|
+
return {
|
|
322
|
+
state: 'done',
|
|
323
|
+
report: result.custom,
|
|
324
|
+
...(handle.dispatch?.model ? { model: handle.dispatch.model } : {}),
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Everything a SETTLED job owes the ledger, run once the poll knows the job is terminal and
|
|
329
|
+
* BEFORE any of the failure branches return.
|
|
330
|
+
*
|
|
331
|
+
* Before them deliberately: a dry run that spent tokens and then failed (an evicted container, a
|
|
332
|
+
* reply with no JSON) is exactly the run an operator most needs the spend for, and it is the one
|
|
333
|
+
* whose numbers a `return` above this line would drop. The three writes are the step path's own,
|
|
334
|
+
* each idempotent per job id, so the durable driver's replay of a terminal poll cannot
|
|
335
|
+
* double-count.
|
|
336
|
+
*
|
|
337
|
+
* A Pi job reports none of this: the LLM proxy is its single metering point and files its rows
|
|
338
|
+
* itself, so every call here is a no-op for it and the whole method exists for the subscription
|
|
339
|
+
* harnesses, which talk to the vendor direct and are metered nowhere else.
|
|
340
|
+
*/
|
|
341
|
+
async settleAccounting(handle, view) {
|
|
342
|
+
const job = this.jobHandle(handle);
|
|
343
|
+
const result = view.result ?? {};
|
|
344
|
+
await this.accounting.recordCallsOnce(job, result);
|
|
345
|
+
await this.accounting.recordPooledUsageOnce(job, result);
|
|
346
|
+
await this.accounting.recordQuotaUsageOnce(job, result);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* The dry run's handle as the shared accounting reads one.
|
|
350
|
+
*
|
|
351
|
+
* A self-test is a SINGLE-JOB flow, so the run and the job are one row and `runId` is the job id
|
|
352
|
+
* (which is what makes the recorded rows join to the self-test run the SPA renders). The model,
|
|
353
|
+
* the leased token and the initiator all come off the persisted dispatch attribution rather than
|
|
354
|
+
* being re-derived, for the reason `EnvironmentProbeDispatch` states.
|
|
355
|
+
*/
|
|
356
|
+
jobHandle(handle) {
|
|
357
|
+
const model = handle.dispatch?.model;
|
|
358
|
+
return {
|
|
359
|
+
jobId: handle.jobId,
|
|
360
|
+
runId: handle.jobId,
|
|
361
|
+
workspaceId: handle.workspaceId,
|
|
362
|
+
agentKind: environmentProbeAgentKind(handle.surface),
|
|
363
|
+
...(model ? { model, provider: providerOf(model) } : {}),
|
|
364
|
+
...(handle.dispatch?.subscriptionTokenId
|
|
365
|
+
? { subscriptionTokenId: handle.dispatch.subscriptionTokenId }
|
|
366
|
+
: {}),
|
|
367
|
+
...(handle.dispatch?.subscriptionVendor
|
|
368
|
+
? { subscriptionVendor: handle.dispatch.subscriptionVendor }
|
|
369
|
+
: {}),
|
|
370
|
+
...(handle.initiatedBy ? { initiatedByUserId: handle.initiatedBy } : {}),
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
async stop(handle) {
|
|
374
|
+
await this.jobs.release(handle.workspaceId, this.ref(handle.jobId, handle.surface));
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* The model + harness + vendor this surface's prober runs on, asked under the prober's OWN agent
|
|
378
|
+
* kind.
|
|
379
|
+
*
|
|
380
|
+
* Its own kind rather than the tester's, which is what {@link environmentProbeAgentKind}
|
|
381
|
+
* documents: a workspace routes its probers by editing the preset entry named after them, and
|
|
382
|
+
* the START gate resolves an individual-usage vendor for that same kind. Borrowing `tester-api`
|
|
383
|
+
* here would put the gate and the dispatch on two different questions.
|
|
384
|
+
*/
|
|
385
|
+
resolveModel(subject, surface) {
|
|
386
|
+
return this.deps.resolveModel({
|
|
387
|
+
workspaceId: subject.workspaceId,
|
|
388
|
+
blockId: subject.blockId,
|
|
389
|
+
agentKind: environmentProbeAgentKind(surface),
|
|
390
|
+
...(subject.initiatedBy ? { initiatedByUserId: subject.initiatedBy } : {}),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* The job's address. The IMAGE is part of it on every call, not only the dispatch: see the
|
|
395
|
+
* class note on why a poll or release that drops it addresses the wrong container.
|
|
396
|
+
*/
|
|
397
|
+
ref(jobId, surface) {
|
|
398
|
+
const image = IMAGE_BY_SURFACE[surface];
|
|
399
|
+
return { runId: jobId, jobId, ...(image ? { image } : {}) };
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* The repo the prober's token may reach, as the neutral id the mint's scope speaks in. An empty
|
|
403
|
+
* result is returned rather than thrown, for the reason the repairer states: a projection
|
|
404
|
+
* lagging behind a just-linked repo is a reason to widen the token and report it, not to refuse
|
|
405
|
+
* a diagnostic the developer asked for.
|
|
406
|
+
*/
|
|
407
|
+
async resolveRepoScope(workspaceId, owner, repo) {
|
|
408
|
+
const projected = await this.deps.repoRepository.list(workspaceId);
|
|
409
|
+
const match = projected.find((row) => row.owner.toLowerCase() === owner.toLowerCase() &&
|
|
410
|
+
row.name.toLowerCase() === repo.toLowerCase());
|
|
411
|
+
return match ? [String(match.githubId)] : [];
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=ContainerEnvironmentProbeAgent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContainerEnvironmentProbeAgent.js","sourceRoot":"","sources":["../../src/agents/ContainerEnvironmentProbeAgent.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAClF,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,yBAAyB,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AAEnG,OAAO,EACL,sBAAsB,GAEvB,MAAM,6BAA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IACK,GAAG,CAAC,KAAa,EAAE,OAAgC;QACzD,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;QACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IAC7D,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,gBAAgB,CAC5B,WAAmB,EACnB,KAAa,EACb,IAAY;QAEZ,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QAClE,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAC1B,CAAC,GAAG,EAAE,EAAE,CACN,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,WAAW,EAAE;YAC/C,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAChD,CAAA;QACD,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC9C,CAAC;CACF"}
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LocalModelDeclarations, ModelFlavor, ModelRef, SubscriptionVendor } from '@cat-factory/kernel';
|
|
2
2
|
import type { HarnessKind } from '@cat-factory/kernel';
|
|
3
3
|
import { type AgentRouting } from '@cat-factory/agents';
|
|
4
|
+
/**
|
|
5
|
+
* Everything the router reads to pick a model: the agent kind, the workspace, whatever the block
|
|
6
|
+
* pins, and who started the work.
|
|
7
|
+
*
|
|
8
|
+
* A structural SUBSET of {@link import('@cat-factory/kernel').AgentRunContext}, which is what the
|
|
9
|
+
* pipeline path still passes. The point is the caller that has no run context to pass: the AGENT
|
|
10
|
+
* DRY RUN's prober is not an `ExecutionInstance`: it has a workspace, a frame and an initiator, and
|
|
11
|
+
* nothing else the run context describes. Asking it for a whole `AgentRunContext` would have it
|
|
12
|
+
* fabricate a pipeline name, a step index and a final-step flag, and a fabricated run context is a
|
|
13
|
+
* thing later code reads as one. Taking the subset instead is what lets that dispatch resolve its
|
|
14
|
+
* model through THIS precedence rather than reaching for the deployment's env routing directly,
|
|
15
|
+
* which is a model nobody's preset chose.
|
|
16
|
+
*
|
|
17
|
+
* The two OTHER single-job container flows still read the env routing at WIRING and do not come
|
|
18
|
+
* through here: the env-config repairer pins `coder`'s routed ref (and disables itself when it is
|
|
19
|
+
* not proxyable), and the repo bootstrapper pins `architect`'s. Neither has a frame to resolve
|
|
20
|
+
* against (`EnvConfigRepairRequest` and a bootstrap both name a REPOSITORY, and a bootstrap runs
|
|
21
|
+
* before the board has a service block at all), so giving them this precedence is a change to their
|
|
22
|
+
* ports, not a change here.
|
|
23
|
+
*/
|
|
24
|
+
export interface StepModelSelection {
|
|
25
|
+
agentKind: string;
|
|
26
|
+
/** Absent ⇒ no workspace defaults are consulted and the env routing decides. */
|
|
27
|
+
workspaceId?: string;
|
|
28
|
+
/** Whoever started the work: whose personal (individual-usage) subscription may be leased. */
|
|
29
|
+
initiatedByUserId?: string;
|
|
30
|
+
/** The route order the preset in force states; absent ⇒ the deployment's default order. */
|
|
31
|
+
providerPreference?: readonly ModelFlavor[];
|
|
32
|
+
/** The initiator's local-runner declarations, folded onto the resolved ref. */
|
|
33
|
+
localModelDeclarations?: readonly LocalModelDeclarations[];
|
|
34
|
+
/** What the block itself pins, if anything. `{}` for a caller whose subject pins nothing. */
|
|
35
|
+
block: {
|
|
36
|
+
modelId?: string;
|
|
37
|
+
modelPresetId?: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
4
40
|
/** The collaborators {@link ModelRouter} needs to resolve a step's model + subscription path. */
|
|
5
41
|
export interface ModelRouterDependencies {
|
|
6
42
|
/** Default model routing; used when the block pins no (usable) model. */
|
|
@@ -43,7 +79,7 @@ export declare class ModelRouter {
|
|
|
43
79
|
* workspace per-kind default > env routing). Side-effect-free and dispatch-free,
|
|
44
80
|
* so it backs both the up-front `resolveModel` preview and `buildJobBody`.
|
|
45
81
|
*/
|
|
46
|
-
resolveRef(context:
|
|
82
|
+
resolveRef(context: StepModelSelection): Promise<ModelRef>;
|
|
47
83
|
/**
|
|
48
84
|
* The canonical catalog model id the step resolves to (block pin > workspace
|
|
49
85
|
* per-kind default), or undefined when it falls through to the env routing
|
|
@@ -62,7 +98,7 @@ export declare class ModelRouter {
|
|
|
62
98
|
* base. So a subscriber runs GLM on their plan while a non-subscriber on the same
|
|
63
99
|
* workspace falls back to Cloudflare GLM.
|
|
64
100
|
*/
|
|
65
|
-
resolveEffectiveRef(context:
|
|
101
|
+
resolveEffectiveRef(context: StepModelSelection, workspaceId: string): Promise<{
|
|
66
102
|
ref: ModelRef;
|
|
67
103
|
subscriptionVendor?: SubscriptionVendor;
|
|
68
104
|
}>;
|
|
@@ -78,7 +114,7 @@ export declare class ModelRouter {
|
|
|
78
114
|
* harnesses (Claude Code / Codex) talk direct to the vendor with a pooled token, so the
|
|
79
115
|
* proxyable guard does not apply to them.
|
|
80
116
|
*/
|
|
81
|
-
resolveDispatchRef(context:
|
|
117
|
+
resolveDispatchRef(context: StepModelSelection, workspaceId: string): Promise<{
|
|
82
118
|
ref: ModelRef;
|
|
83
119
|
harness: HarnessKind;
|
|
84
120
|
subscriptionVendor?: SubscriptionVendor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelRouter.d.ts","sourceRoot":"","sources":["../../src/agents/ModelRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"ModelRouter.d.ts","sourceRoot":"","sources":["../../src/agents/ModelRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,WAAW,EACX,QAAQ,EACR,kBAAkB,EACnB,MAAM,qBAA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O,CAAC,CAAA;CAC3F;AAED;;;;;;GAMG;AACH,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAjC,YAA6B,IAAI,EAAE,uBAAuB,EAAI;IAE9D;;;;OAIG;IACH,UAAU,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA4BzD;IAED;;;;;OAKG;YACW,uBAAuB;IAcrC;;;;;;;;;;OAUG;IACG,mBAAmB,CACvB,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,GAAG,EAAE,QAAQ,CAAC;QAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC,CA2BrE;IAED;;;;;;;;;;;OAWG;IACG,kBAAkB,CACtB,OAAO,EAAE,kBAAkB,EAC3B,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;QAAE,GAAG,EAAE,QAAQ,CAAC;QAAC,OAAO,EAAE,WAAW,CAAC;QAAC,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;KAAE,CAAC,CAa3F;CACF"}
|
|
@@ -110,7 +110,7 @@ export class ModelRouter {
|
|
|
110
110
|
const { ref, subscriptionVendor } = await this.resolveEffectiveRef(context, workspaceId);
|
|
111
111
|
const harness = ref.harness ?? 'pi';
|
|
112
112
|
if (harness === 'pi' && !isProxyableProvider(ref.provider)) {
|
|
113
|
-
throw new Error(`
|
|
113
|
+
throw new Error(`A container dispatch needs a model the LLM proxy can serve ` +
|
|
114
114
|
`(Workers AI, a direct OpenAI-compatible provider, or a local runner); ` +
|
|
115
115
|
`'${ref.provider}' is not supported. Pick a Workers AI model, configure a ` +
|
|
116
116
|
`provider key (QWEN_API_KEY / DEEPSEEK_API_KEY / MOONSHOT_API_KEY), or add a local ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModelRouter.js","sourceRoot":"","sources":["../../src/agents/ModelRouter.ts"],"names":[],"mappings":"AAOA,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|
105
105
|
* Fold the SAME subscription usage into the modeled quota-cycle counters (Part B), for
|
|
106
106
|
* BOTH pooled and personal runs. A subscription run is the one reporting per-call
|
|
107
|
-
* metrics (Pi is proxy-metered and has none)
|
|
108
|
-
*
|
|
109
|
-
*
|
|
107
|
+
* metrics (Pi is proxy-metered and has none). Scope = the leased pool token when present,
|
|
108
|
+
* else the run initiator (personal). Best-effort, once per job id so a replayed poll can't
|
|
109
|
+
* double-count.
|
|
110
|
+
*
|
|
111
|
+
* Keyed on the VENDOR the dispatch resolved, and only then on the provider parsed off the
|
|
112
|
+
* model. The two differ for four of the five vendors (`claude`⇄`anthropic`, `codex`⇄`openai`,
|
|
113
|
+
* `glm`⇄`zai`, `kimi`⇄`moonshot`), so a fold that took the provider alone matched DeepSeek and
|
|
114
|
+
* silently counted nothing for the rest: a quota cycle that reported zero for the vendors the
|
|
115
|
+
* feature exists to track. The provider stays as the fallback, so a handle minted before the
|
|
116
|
+
* dispatch carried a vendor still folds exactly as it used to.
|
|
110
117
|
*/
|
|
111
118
|
recordQuotaUsageOnce(handle: AgentJobHandle, result: RunnerJobResult): Promise<void>;
|
|
112
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerJobAccounting.d.ts","sourceRoot":"","sources":["../../src/agents/containerJobAccounting.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAE7B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAoBzE,wFAAwF;AACxF,MAAM,WAAW,0BAA0B;IACzC,0FAA0F;IAC1F,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACtE,uEAAuE;IACvE,uBAAuB,CAAC,EAAE,CACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EA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GAAG,OAAO,CAAC,IAAI,CAAC,CAmB/F;IAED;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAS5B;;;;;;;;;;;OAWG;IACG,eAAe,CACnB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE;QAAE,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAA;KAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAYf;IAED;;;;;OAKG;IACG,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAmB1F;IAED;;;;;;;;;;;;;OAaG;IACG,oBAAoB,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBzF;CACF"}
|
|
@@ -162,12 +162,19 @@ export class ContainerJobAccounting {
|
|
|
162
162
|
/**
|
|
163
163
|
* Fold the SAME subscription usage into the modeled quota-cycle counters (Part B), for
|
|
164
164
|
* BOTH pooled and personal runs. A subscription run is the one reporting per-call
|
|
165
|
-
* metrics (Pi is proxy-metered and has none)
|
|
166
|
-
*
|
|
167
|
-
*
|
|
165
|
+
* metrics (Pi is proxy-metered and has none). Scope = the leased pool token when present,
|
|
166
|
+
* else the run initiator (personal). Best-effort, once per job id so a replayed poll can't
|
|
167
|
+
* double-count.
|
|
168
|
+
*
|
|
169
|
+
* Keyed on the VENDOR the dispatch resolved, and only then on the provider parsed off the
|
|
170
|
+
* model. The two differ for four of the five vendors (`claude`⇄`anthropic`, `codex`⇄`openai`,
|
|
171
|
+
* `glm`⇄`zai`, `kimi`⇄`moonshot`), so a fold that took the provider alone matched DeepSeek and
|
|
172
|
+
* silently counted nothing for the rest: a quota cycle that reported zero for the vendors the
|
|
173
|
+
* feature exists to track. The provider stays as the fallback, so a handle minted before the
|
|
174
|
+
* dispatch carried a vendor still folds exactly as it used to.
|
|
168
175
|
*/
|
|
169
176
|
async recordQuotaUsageOnce(handle, result) {
|
|
170
|
-
const quotaVendor = handle.provider ?? providerOf(handle.model);
|
|
177
|
+
const quotaVendor = handle.subscriptionVendor ?? handle.provider ?? providerOf(handle.model);
|
|
171
178
|
if (result.callMetrics &&
|
|
172
179
|
result.callMetrics.length > 0 &&
|
|
173
180
|
result.usage &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containerJobAccounting.js","sourceRoot":"","sources":["../../src/agents/containerJobAccounting.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,oBAAoB,GACrB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAExD,2FAA2F;AAC3F,6FAA6F;AAC7F,yCAAyC;AACzC,EAAE;AACF,0FAA0F;AAC1F,6FAA6F;AAC7F,iGAAiG;AACjG,gGAAgG;AAChG,wFAAwF;AACxF,EAAE;AACF,kGAAkG;AAClG,iGAAiG;AACjG,wEAAwE;AAExE,uEAAuE;AACvE,MAAM,SAAS,GAAG,MAAM,CAAA;AAmBxB,MAAM,OAAO,sBAAsB;IA4CJ,IAAI;IA3CjC;;;;;;;;;OASG;IACc,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;IAEtD;;;;;OAKG;IACc,sBAAsB,GAAG,IAAI,GAAG,EAAU,CAAA;IAE3D;;;;;;;;;;;;OAYG;IACc,gBAAgB,GAAG,IAAI,GAAG,EAAuB,CAAA;IAElE;;;;;OAKG;IACc,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;IAEtD,YAA6B,IAAgC;oBAAhC,IAAI;IAA+B,CAAC;IAEjE;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,WAAW,CAAC,MAAsB,EAAE,KAAsC;QAC9E,IAAI,CAAC,MAAM,CAAC,WAAW,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACzF,OAAM;QACR,CAAC;QAC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