@cat-factory/orchestration 0.193.0 → 0.195.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/container/dependencies.d.ts +17 -1
- package/dist/container/dependencies.d.ts.map +1 -1
- package/dist/container/module-shapes.d.ts +5 -0
- package/dist/container/module-shapes.d.ts.map +1 -1
- package/dist/container/platform-modules.d.ts.map +1 -1
- package/dist/container/platform-modules.js +14 -1
- package/dist/container/platform-modules.js.map +1 -1
- package/dist/container.d.ts +20 -2
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +14 -0
- package/dist/container.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/board/BoardService.d.ts +2 -0
- package/dist/modules/board/BoardService.d.ts.map +1 -1
- package/dist/modules/board/BoardService.js +4 -0
- package/dist/modules/board/BoardService.js.map +1 -1
- package/dist/modules/board/publicBoardReads.d.ts +12 -0
- package/dist/modules/board/publicBoardReads.d.ts.map +1 -1
- package/dist/modules/board/publicBoardReads.js +19 -4
- package/dist/modules/board/publicBoardReads.js.map +1 -1
- package/dist/modules/debug/RunDebugService.d.ts +27 -1
- package/dist/modules/debug/RunDebugService.d.ts.map +1 -1
- package/dist/modules/debug/RunDebugService.js +24 -2
- package/dist/modules/debug/RunDebugService.js.map +1 -1
- package/dist/modules/debug/debug.logic.d.ts +3 -3
- package/dist/modules/debug/debug.logic.d.ts.map +1 -1
- package/dist/modules/debug/debug.logic.js +4 -1
- package/dist/modules/debug/debug.logic.js.map +1 -1
- package/dist/modules/execution/AgentDispatchController.d.ts +115 -0
- package/dist/modules/execution/AgentDispatchController.d.ts.map +1 -0
- package/dist/modules/execution/AgentDispatchController.js +307 -0
- package/dist/modules/execution/AgentDispatchController.js.map +1 -0
- package/dist/modules/execution/ExecutionService.d.ts +18 -105
- package/dist/modules/execution/ExecutionService.d.ts.map +1 -1
- package/dist/modules/execution/ExecutionService.js +77 -589
- package/dist/modules/execution/ExecutionService.js.map +1 -1
- package/dist/modules/execution/ExecutionServiceDependencies.d.ts +6 -0
- package/dist/modules/execution/ExecutionServiceDependencies.d.ts.map +1 -1
- package/dist/modules/execution/IterationCapController.d.ts +57 -0
- package/dist/modules/execution/IterationCapController.d.ts.map +1 -0
- package/dist/modules/execution/IterationCapController.js +141 -0
- package/dist/modules/execution/IterationCapController.js.map +1 -0
- package/dist/modules/execution/MergeResolver.d.ts +14 -2
- package/dist/modules/execution/MergeResolver.d.ts.map +1 -1
- package/dist/modules/execution/MergeResolver.js +83 -30
- package/dist/modules/execution/MergeResolver.js.map +1 -1
- package/dist/modules/execution/PrVerificationReportController.d.ts +23 -0
- package/dist/modules/execution/PrVerificationReportController.d.ts.map +1 -1
- package/dist/modules/execution/PrVerificationReportController.js +18 -0
- package/dist/modules/execution/PrVerificationReportController.js.map +1 -1
- package/dist/modules/execution/RunDispatcher.d.ts +31 -195
- package/dist/modules/execution/RunDispatcher.d.ts.map +1 -1
- package/dist/modules/execution/RunDispatcher.js +47 -313
- package/dist/modules/execution/RunDispatcher.js.map +1 -1
- package/dist/modules/execution/RunDispatcherDependencies.d.ts +142 -0
- package/dist/modules/execution/RunDispatcherDependencies.d.ts.map +1 -0
- package/dist/modules/execution/RunDispatcherDependencies.js +27 -0
- package/dist/modules/execution/RunDispatcherDependencies.js.map +1 -0
- package/dist/modules/execution/RunLifecycleController.d.ts +154 -0
- package/dist/modules/execution/RunLifecycleController.d.ts.map +1 -0
- package/dist/modules/execution/RunLifecycleController.js +507 -0
- package/dist/modules/execution/RunLifecycleController.js.map +1 -0
- package/dist/modules/execution/RunStateMachine.d.ts.map +1 -1
- package/dist/modules/execution/RunStateMachine.js +27 -14
- package/dist/modules/execution/RunStateMachine.js.map +1 -1
- package/dist/modules/execution/StepDecisionController.d.ts +20 -0
- package/dist/modules/execution/StepDecisionController.d.ts.map +1 -1
- package/dist/modules/execution/StepDecisionController.js +30 -0
- package/dist/modules/execution/StepDecisionController.js.map +1 -1
- package/dist/modules/execution/policy-types.d.ts +14 -1
- package/dist/modules/execution/policy-types.d.ts.map +1 -1
- package/dist/modules/execution/prReport.commands.d.ts +54 -0
- package/dist/modules/execution/prReport.commands.d.ts.map +1 -0
- package/dist/modules/execution/prReport.commands.js +316 -0
- package/dist/modules/execution/prReport.commands.js.map +1 -0
- package/dist/modules/execution/prReport.environments.d.ts +11 -0
- package/dist/modules/execution/prReport.environments.d.ts.map +1 -1
- package/dist/modules/execution/prReport.environments.js +9 -1
- package/dist/modules/execution/prReport.environments.js.map +1 -1
- package/dist/modules/execution/prReport.logic.d.ts.map +1 -1
- package/dist/modules/execution/prReport.logic.js +23 -2
- package/dist/modules/execution/prReport.logic.js.map +1 -1
- package/dist/modules/execution/reproductionProof.logic.js +1 -1
- package/dist/modules/execution/reproductionProof.logic.js.map +1 -1
- package/dist/modules/execution/retry.logic.d.ts +3 -2
- package/dist/modules/execution/retry.logic.d.ts.map +1 -1
- package/dist/modules/execution/retry.logic.js +14 -2
- package/dist/modules/execution/retry.logic.js.map +1 -1
- package/dist/modules/execution/run-action-controllers.d.ts +18 -0
- package/dist/modules/execution/run-action-controllers.d.ts.map +1 -0
- package/dist/modules/execution/run-action-controllers.js +19 -0
- package/dist/modules/execution/run-action-controllers.js.map +1 -0
- package/dist/modules/execution/runMode.logic.d.ts +78 -0
- package/dist/modules/execution/runMode.logic.d.ts.map +1 -0
- package/dist/modules/execution/runMode.logic.js +78 -0
- package/dist/modules/execution/runMode.logic.js.map +1 -0
- package/dist/modules/execution/runStartOptions.d.ts +16 -1
- package/dist/modules/execution/runStartOptions.d.ts.map +1 -1
- package/dist/modules/merge/RiskPolicyService.d.ts.map +1 -1
- package/dist/modules/merge/RiskPolicyService.js +4 -0
- package/dist/modules/merge/RiskPolicyService.js.map +1 -1
- package/dist/modules/observability/LlmObservabilityService.d.ts +35 -4
- package/dist/modules/observability/LlmObservabilityService.d.ts.map +1 -1
- package/dist/modules/observability/LlmObservabilityService.js +43 -7
- package/dist/modules/observability/LlmObservabilityService.js.map +1 -1
- package/dist/modules/observability/observability.logic.d.ts +12 -2
- package/dist/modules/observability/observability.logic.d.ts.map +1 -1
- package/dist/modules/observability/observability.logic.js +31 -2
- package/dist/modules/observability/observability.logic.js.map +1 -1
- package/dist/modules/tutorial/TutorialProgressService.d.ts +51 -0
- package/dist/modules/tutorial/TutorialProgressService.d.ts.map +1 -0
- package/dist/modules/tutorial/TutorialProgressService.js +111 -0
- package/dist/modules/tutorial/TutorialProgressService.js.map +1 -0
- package/dist/modules/tutorial/TutorialTelemetryService.d.ts +47 -0
- package/dist/modules/tutorial/TutorialTelemetryService.d.ts.map +1 -0
- package/dist/modules/tutorial/TutorialTelemetryService.js +67 -0
- package/dist/modules/tutorial/TutorialTelemetryService.js.map +1 -0
- package/package.json +11 -11
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { parseMergeAssessment } from '@cat-factory/contracts';
|
|
2
|
-
import {
|
|
2
|
+
import { resolveRoleScopedMergeClassRule } from '@cat-factory/kernel';
|
|
3
|
+
import { isDryRun } from './runMode.logic.js';
|
|
3
4
|
/** Format a 0..1 score as a rounded percentage for notification copy. */
|
|
4
5
|
function pct(score) {
|
|
5
6
|
return `${Math.round(score * 100)}%`;
|
|
@@ -60,7 +61,20 @@ export class MergeResolver {
|
|
|
60
61
|
changeClass: 'unknown',
|
|
61
62
|
fileCount: 0,
|
|
62
63
|
};
|
|
63
|
-
|
|
64
|
+
// The class rule, then that rule NARROWED by the tier the run was admitted under. Narrowing is
|
|
65
|
+
// subtractive by construction (see `narrowMergeClassRule`), so this can only ever move the
|
|
66
|
+
// decision toward review — it cannot hand a role something the preset withholds, and a run
|
|
67
|
+
// with no pinned role comes back exactly as it did before role scoping existed.
|
|
68
|
+
const { base: classRule, effective: effectiveRule, narrowedByRole, } = resolveRoleScopedMergeClassRule({
|
|
69
|
+
rules: preset.classRules,
|
|
70
|
+
byRole: preset.classRulesByRole,
|
|
71
|
+
role: instance.initiatedByRole,
|
|
72
|
+
changeClass: classification.changeClass,
|
|
73
|
+
});
|
|
74
|
+
// Whether this run may land ANYTHING. Read off the run rather than re-derived from the preset:
|
|
75
|
+
// the mode was settled and pinned at start, so a preset edited mid-flight cannot un-sandbox a
|
|
76
|
+
// run a human is already reviewing (nor sandbox one that has been merging all along).
|
|
77
|
+
const dryRun = isDryRun(instance.mode);
|
|
64
78
|
const thresholds = {
|
|
65
79
|
presetName: preset.name,
|
|
66
80
|
maxComplexity: preset.maxComplexity,
|
|
@@ -68,6 +82,10 @@ export class MergeResolver {
|
|
|
68
82
|
maxImpact: preset.maxImpact,
|
|
69
83
|
autoMergeEnabled: preset.autoMergeEnabled,
|
|
70
84
|
...(classRule !== 'thresholds' ? { classRule } : {}),
|
|
85
|
+
...(instance.initiatedByRole ? { initiatorRole: instance.initiatedByRole } : {}),
|
|
86
|
+
// Recorded only when the role CHANGED the outcome, so its presence always means "this
|
|
87
|
+
// would have gone differently for someone else" rather than "a role was involved".
|
|
88
|
+
...(narrowedByRole ? { roleRule: effectiveRule } : {}),
|
|
71
89
|
};
|
|
72
90
|
const base = {
|
|
73
91
|
assessment: assessment ?? undefined,
|
|
@@ -83,15 +101,21 @@ export class MergeResolver {
|
|
|
83
101
|
const credible = assessment !== null && assessment.rationale.trim() !== '';
|
|
84
102
|
const exceededAxes = assessment ? exceededAxesOf(assessment, preset) : [];
|
|
85
103
|
// Auto-merge precedence, most-significant first:
|
|
86
|
-
// 1.
|
|
104
|
+
// 1. A DRY RUN merges nothing, whatever else says. It outranks even `autoMergeEnabled`
|
|
105
|
+
// because it is a property of the RUN rather than of the policy: the person who started
|
|
106
|
+
// it was never authorised to land this work, so no preset can consent on their behalf.
|
|
107
|
+
// 2. `autoMergeEnabled: false` — the master switch. "Manual review only" stays manual and
|
|
87
108
|
// a class rule can NEVER override it.
|
|
88
|
-
//
|
|
89
|
-
// rationale backstop — an explicit operator policy keyed on
|
|
90
|
-
// classification outranks the agent's self-report); `never`
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
109
|
+
// 3. The class rule AS NARROWED BY THE INITIATOR'S ROLE: `always` merges regardless of the
|
|
110
|
+
// scores (and regardless of the rationale backstop — an explicit operator policy keyed on
|
|
111
|
+
// a DETERMINISTIC backend classification outranks the agent's self-report); `never`
|
|
112
|
+
// always routes to a human. A role entry can only push this arm toward `never`.
|
|
113
|
+
// 4. The existing credibility + threshold comparison.
|
|
114
|
+
const within = !dryRun &&
|
|
115
|
+
preset.autoMergeEnabled &&
|
|
116
|
+
(effectiveRule === 'always' ||
|
|
117
|
+
(effectiveRule !== 'never' && credible && exceededAxes.length === 0));
|
|
118
|
+
const mergeReason = effectiveRule === 'always' ? 'class_auto_merge' : 'within_thresholds';
|
|
95
119
|
const record = (decision) => this.deps.mergeTrackRecord?.recordDecision(workspaceId, {
|
|
96
120
|
block,
|
|
97
121
|
executionId: instance.id,
|
|
@@ -121,6 +145,7 @@ export class MergeResolver {
|
|
|
121
145
|
await this.raiseReviewAndBlock(workspaceId, instance, block, assessment, {
|
|
122
146
|
changeClass: classification.changeClass,
|
|
123
147
|
recordId: pending?.id,
|
|
148
|
+
dryRun,
|
|
124
149
|
});
|
|
125
150
|
return { ...base, outcome: 'awaiting_review', reason: 'merge_failed', exceededAxes };
|
|
126
151
|
}
|
|
@@ -129,24 +154,42 @@ export class MergeResolver {
|
|
|
129
154
|
await this.raiseReviewAndBlock(workspaceId, instance, block, assessment, {
|
|
130
155
|
changeClass: classification.changeClass,
|
|
131
156
|
recordId: pending?.id,
|
|
157
|
+
dryRun,
|
|
132
158
|
});
|
|
133
|
-
// Classify WHY review is needed, most-specific first, so the banner is precise
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
// the
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
// Classify WHY review is needed, most-specific first, so the banner is precise, in the SAME
|
|
160
|
+
// order the auto-merge branch above applies. A missing/unparseable assessment
|
|
161
|
+
// (`no_assessment`) is distinct from one that returned scores but no rationale
|
|
162
|
+
// (`no_rationale`): the latter DID produce visible scores, so the banner must not claim there
|
|
163
|
+
// was no assessment at all.
|
|
164
|
+
//
|
|
165
|
+
// `dry_run` tops the ladder for the reason it tops the precedence: a sandboxed run's scores
|
|
166
|
+
// were never consulted, so reporting it as `exceeded_thresholds` (or as `auto_merge_disabled`,
|
|
167
|
+
// on a preset that would happily have merged it) sends someone to edit a ceiling that had no
|
|
168
|
+
// part in the outcome. `role_requires_review` is likewise kept apart from
|
|
169
|
+
// `class_requires_review` even though both mean "the rule says never": one is fixed by editing
|
|
170
|
+
// the class rule, the other by a teammate on a higher tier merging the PR as it stands.
|
|
171
|
+
const reason = dryRun
|
|
172
|
+
? 'dry_run'
|
|
173
|
+
: !preset.autoMergeEnabled
|
|
174
|
+
? 'auto_merge_disabled'
|
|
175
|
+
: effectiveRule === 'never'
|
|
176
|
+
? narrowedByRole
|
|
177
|
+
? 'role_requires_review'
|
|
178
|
+
: 'class_requires_review'
|
|
179
|
+
: assessment === null
|
|
180
|
+
? 'no_assessment'
|
|
181
|
+
: !credible
|
|
182
|
+
? 'no_rationale'
|
|
183
|
+
: 'exceeded_thresholds';
|
|
147
184
|
return { ...base, outcome: 'awaiting_review', reason, exceededAxes };
|
|
148
185
|
}
|
|
149
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* The track-record context a review card carries so the human can tag in the same tap.
|
|
188
|
+
*
|
|
189
|
+
* Takes only what it PROJECTS. `dryRun` rides the same {@link ReviewCardContext} the callers
|
|
190
|
+
* thread, but it changes the card's WORDING rather than its track-record link, so naming it
|
|
191
|
+
* here would advertise an input this function has no use for.
|
|
192
|
+
*/
|
|
150
193
|
trackContext = (ctx) => ({
|
|
151
194
|
...(ctx.changeClass !== 'unknown' ? { changeClass: ctx.changeClass } : {}),
|
|
152
195
|
...(ctx.recordId ? { mergeTrackRecordId: ctx.recordId } : {}),
|
|
@@ -175,11 +218,21 @@ export class MergeResolver {
|
|
|
175
218
|
async raiseMergeReview(workspaceId, instance, block, assessment, track) {
|
|
176
219
|
if (!this.deps.notificationService)
|
|
177
220
|
return;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
221
|
+
// A sandboxed run's card must not describe the scores as the thing holding the PR back: they
|
|
222
|
+
// were never consulted, and a card blaming them sends the reader to edit a ceiling that had
|
|
223
|
+
// no part in the outcome. Report the assessment as the INFORMATION it is on a dry run, and
|
|
224
|
+
// say plainly why nothing merged.
|
|
225
|
+
const scores = assessment
|
|
226
|
+
? `complexity ${pct(assessment.complexity)}, risk ${pct(assessment.risk)}, ` +
|
|
227
|
+
`impact ${pct(assessment.impact)}`
|
|
228
|
+
: null;
|
|
229
|
+
const body = track.dryRun
|
|
230
|
+
? `This was a dry run, so its PR was left open for a human regardless of the assessment.` +
|
|
231
|
+
(scores && assessment ? ` The merger scored it ${scores}. ${assessment.rationale}` : '')
|
|
232
|
+
: assessment
|
|
233
|
+
? `The merger scored this PR outside the task's auto-merge thresholds ` +
|
|
234
|
+
`(${scores}). ${assessment.rationale}`
|
|
235
|
+
: `The merger could not produce a valid assessment for this PR. Review and merge manually.`;
|
|
183
236
|
await this.deps.notificationService.raise(workspaceId, {
|
|
184
237
|
type: 'merge_review',
|
|
185
238
|
blockId: block.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MergeResolver.js","sourceRoot":"","sources":["../../../src/modules/execution/MergeResolver.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MergeResolver.js","sourceRoot":"","sources":["../../../src/modules/execution/MergeResolver.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,EAAE,+BAA+B,EAAE,MAAM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BACrE,IAAI,MAAM,MAAM,UAAU,CAAC,SAAS,EAAE;gBACxC,CAAC,CAAC,yFAAyF,CAAA;QAC/F,MAAM,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,WAAW,EAAE;YACrD,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,KAAK,CAAC,EAAE;YACjB,WAAW,EAAE,QAAQ,CAAC,EAAE;YACxB,KAAK,EAAE,kBAAkB,KAAK,CAAC,KAAK,GAAG;YACvC,IAAI;YACJ,OAAO,EAAE;gBACP,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrC,GAAG,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACnE,YAAY,EAAE,QAAQ,CAAC,YAAY;gBACnC,qFAAqF;gBACrF,kEAAkE;gBAClE,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;aAC5B;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -56,6 +56,17 @@ export interface PrVerificationReportControllerDeps {
|
|
|
56
56
|
* (better than emitting a link to nowhere).
|
|
57
57
|
*/
|
|
58
58
|
appBaseUrl?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Optional: this deployment's own externally-reachable BACKEND base URL (`PUBLIC_URL` on Node,
|
|
61
|
+
* `WORKER_PUBLIC_URL` on the Worker), used to build direct links to the bytes of the artifacts
|
|
62
|
+
* the report lists. Absent ⇒ the rows carry their artifact ids and no link.
|
|
63
|
+
*
|
|
64
|
+
* Deliberately separate from {@link appBaseUrl}: the two are the same origin on a same-origin
|
|
65
|
+
* deployment and different ones the moment the SPA is served from its own host, and a link built
|
|
66
|
+
* from the wrong one is worse than no link. They also answer different questions — the app URL
|
|
67
|
+
* opens a panel a human browses, this one returns bytes to anything holding a credential.
|
|
68
|
+
*/
|
|
69
|
+
apiBaseUrl?: string;
|
|
59
70
|
/**
|
|
60
71
|
* Optional structured logger for the best-effort failure path. Wire it: publishing is the
|
|
61
72
|
* one part of the run that is DESIGNED to fail silently, so without a log a revoked token or
|
|
@@ -159,6 +170,18 @@ export declare class PrVerificationReportController {
|
|
|
159
170
|
* are values that narrow parser knows: adding a third means teaching it the view first, or
|
|
160
171
|
* the link silently degrades to "the right board, no panel".
|
|
161
172
|
*/
|
|
173
|
+
/**
|
|
174
|
+
* The direct link to ONE stored artifact's bytes, on this deployment's authenticated blob
|
|
175
|
+
* endpoint (`GET /workspaces/:ws/artifacts/:id/blob`), or null when no public backend URL is
|
|
176
|
+
* configured.
|
|
177
|
+
*
|
|
178
|
+
* This is what turns a captured screenshot from an opaque id into something a reviewer can open
|
|
179
|
+
* and a downstream tool can fetch. The endpoint is authenticated, which is the point: the bytes
|
|
180
|
+
* are workspace-scoped, and a report on a public repository must never carry an unguessable-URL
|
|
181
|
+
* bypass of that. A reader without access gets a 401 rather than the image — the honest outcome,
|
|
182
|
+
* and the same one the app deep link beside it produces.
|
|
183
|
+
*/
|
|
184
|
+
private artifactUrl;
|
|
162
185
|
private deepLink;
|
|
163
186
|
}
|
|
164
187
|
//# sourceMappingURL=PrVerificationReportController.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrVerificationReportController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/PrVerificationReportController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,KAAK,EACL,iBAAiB,EACjB,MAAM,EAEN,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EAErB,cAAc,EACd,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAuB5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,kCAAkC;IACjD,eAAe,EAAE,eAAe,CAAA;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,6BAA6B,CAAA;IACzC,+EAA+E;IAC/E,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,qBAAqB,CAAA;IAC7C;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,2BAA2B,CAAA;IACzD;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,IAAI,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAA;IACnE;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,qBAAa,8BAA8B;IA2B7B,OAAO,CAAC,QAAQ,CAAC,IAAI;IA1BjC;;;;;;;;;;;;;;OAcG;IACH,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA4B;IAE1D;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAAM;IAE9C,YAA6B,IAAI,EAAE,kCAAkC,EAAI;IAEzE;;;OAGG;IACG,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"PrVerificationReportController.d.ts","sourceRoot":"","sources":["../../../src/modules/execution/PrVerificationReportController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EACf,KAAK,EACL,iBAAiB,EACjB,MAAM,EAEN,6BAA6B,EAC7B,yBAAyB,EACzB,qBAAqB,EAErB,cAAc,EACd,2BAA2B,EAC5B,MAAM,qBAAqB,CAAA;AAuB5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,kCAAkC;IACjD,eAAe,EAAE,eAAe,CAAA;IAChC,KAAK,EAAE,KAAK,CAAA;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,6BAA6B,CAAA;IACzC,+EAA+E;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, instance),
|
|
80
80
|
evidenceUrl: this.deepLink(workspaceId, instance, 'test-evidence'),
|
|
81
|
+
artifactUrl: (artifactId) => this.artifactUrl(workspaceId, artifactId),
|
|
81
82
|
},
|
|
82
83
|
now: this.deps.clock.now(),
|
|
83
84
|
}));
|
|
@@ -257,6 +258,23 @@ export class PrVerificationReportController {
|
|
|
257
258
|
* are values that narrow parser knows: adding a third means teaching it the view first, or
|
|
258
259
|
* the link silently degrades to "the right board, no panel".
|
|
259
260
|
*/
|
|
261
|
+
/**
|
|
262
|
+
* The direct link to ONE stored artifact's bytes, on this deployment's authenticated blob
|
|
263
|
+
* endpoint (`GET /workspaces/:ws/artifacts/:id/blob`), or null when no public backend URL is
|
|
264
|
+
* configured.
|
|
265
|
+
*
|
|
266
|
+
* This is what turns a captured screenshot from an opaque id into something a reviewer can open
|
|
267
|
+
* and a downstream tool can fetch. The endpoint is authenticated, which is the point: the bytes
|
|
268
|
+
* are workspace-scoped, and a report on a public repository must never carry an unguessable-URL
|
|
269
|
+
* bypass of that. A reader without access gets a 401 rather than the image — the honest outcome,
|
|
270
|
+
* and the same one the app deep link beside it produces.
|
|
271
|
+
*/
|
|
272
|
+
artifactUrl(workspaceId, artifactId) {
|
|
273
|
+
const base = this.deps.apiBaseUrl?.trim();
|
|
274
|
+
if (!base)
|
|
275
|
+
return null;
|
|
276
|
+
return `${base.replace(/\/$/, '')}/workspaces/${encodeURIComponent(workspaceId)}/artifacts/${encodeURIComponent(artifactId)}/blob`;
|
|
277
|
+
}
|
|
260
278
|
deepLink(workspaceId, instance, view) {
|
|
261
279
|
const base = this.deps.appBaseUrl?.trim();
|
|
262
280
|
if (!base)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrVerificationReportController.js","sourceRoot":"","sources":["../../../src/modules/execution/PrVerificationReportController.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,wBAAwB,GAAG,GAAG,CAAA;
|
|
1
|
+
{"version":3,"file":"PrVerificationReportController.js","sourceRoot":"","sources":["../../../src/modules/execution/PrVerificationReportController.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,0BAA0B,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAE7F,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C;;;;;;;;;;;;GAYG;AACH,MAAM,wBAAwB,GAAG,GAAG,CAAA;AA8EpC,MAAM,OAAO,8BAA8B;IA2BZ,IAAI;IA1BjC;;;;;;;;;;;;;;OAcG;IACc,aAAa,GAAG,IAAI,GAAG,EAAkB,CAAA;IAE1D;;;;;;OAMG;IACK,MAAM,CAAU,gBAAgB,GAAG,GAAG,CAAA;IAE9C,YAA6B,IAAwC;oBAAxC,IAAI;IAAuC,CAAC;IAEzE;;;OAGG;IACH,KAAK,CAAC,aAAa,CAAC,WAAmB,EAAE,QAA2B;QAClE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAA;QACrC,IAAI,CAAC,SAAS;YAAE,OAAM;QACtB,IAAI,CAAC;YACH,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;gBAAE,OAAM;YACxD,0FAA0F;YAC1F,q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CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAA;QACzC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA;QACtB,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,kBAAkB,CAAC,WAAW,CAAC,cAAc,kBAAkB,CAAC,UAAU,CAAC,OAAO,CAAA;IACpI,CAAC;IAEO,QAAQ,CACd,WAAmB,EACnB,QAA2B,EAC3B,IAAuC;QAEvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAA;QACzC,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA;QACtB,yFAAyF;QACzF,yEAAyE;QACzE,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC;YAC3B,EAAE,EAAE,WAAW;YACf,KAAK,EAAE,QAAQ,CAAC,OAAO;YACvB,GAAG,EAAE,QAAQ,CAAC,EAAE;YAChB,IAAI;SACL,CAAC;aACC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;aAC5D,IAAI,CAAC,GAAG,CAAC,CAAA;QACZ,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAA;IAC/C,CAAC;CACF"}
|
|
@@ -1,128 +1,24 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { AgentKindRegistry } from '@cat-factory/agents';
|
|
3
|
-
import type { BugIntakeService, EnvironmentProvisioningService } from '@cat-factory/integrations';
|
|
4
|
-
import { AgentContextBuilder, type FragmentBodyResolver } from './AgentContextBuilder.js';
|
|
5
|
-
import { CompanionController } from './CompanionController.js';
|
|
6
|
-
import { HumanTestController } from './HumanTestController.js';
|
|
7
|
-
import { MergeResolver } from './MergeResolver.js';
|
|
8
|
-
import { ReviewGateController, type ReviewKind } from './ReviewGateController.js';
|
|
9
|
-
import { ForkDecisionController } from './ForkDecisionController.js';
|
|
10
|
-
import { PrReviewController } from './PrReviewController.js';
|
|
11
|
-
import type { PrVerificationReportController } from './PrVerificationReportController.js';
|
|
12
|
-
import type { InterviewGateController } from './InterviewGateController.js';
|
|
13
|
-
import { RunStateMachine } from './RunStateMachine.js';
|
|
14
|
-
import { StepGraph } from './StepGraph.js';
|
|
15
|
-
import { TesterController } from './TesterController.js';
|
|
16
|
-
import { RalphController } from './RalphController.js';
|
|
17
|
-
import { VisualConfirmationController } from './VisualConfirmationController.js';
|
|
1
|
+
import type { AgentRunContext, AgentRunResult, ChallengePrReviewFindingInput, ChooseForkInput, ExecutionInstance, FollowUpsStepState, ForkChatRequestInput, ForkDecisionStepState, GateDefinition, JudgeDefinition, JudgeStepState, PipelineStep, PrReviewStepState, ResolveJudgeInput, ResolvePrReviewInput } from '@cat-factory/kernel';
|
|
18
2
|
import { type StepHandlerContext } from './step-handler-registry.js';
|
|
19
3
|
import type { AdvanceOptions, AdvanceResult } from './advance.js';
|
|
20
|
-
import type
|
|
21
|
-
|
|
22
|
-
import type { SpendService } from '@cat-factory/spend';
|
|
23
|
-
import type { BlueprintReconciler } from './ExecutionService.js';
|
|
4
|
+
import { type RunDispatcherDeps } from './RunDispatcherDependencies.js';
|
|
5
|
+
export type { ResolvedRiskPolicy, RunDispatcherDeps } from './RunDispatcherDependencies.js';
|
|
24
6
|
/**
|
|
25
|
-
* The
|
|
26
|
-
*
|
|
27
|
-
*
|
|
7
|
+
* The per-step dispatch + completion spine of the execution engine. It owns the four
|
|
8
|
+
* registries (step handlers, completion interceptors, post-completion / terminal resolvers,
|
|
9
|
+
* polling gates), the completion hub (`recordStepResult` / `handleAgentStep`), the gate
|
|
10
|
+
* machinery (`evaluateGate` / `dispatchGateHelper` / `pollGate` / `resolveGatePollExhaustion`),
|
|
11
|
+
* the deterministic `deployer` / `tracker` steps, the registered pre/post-op cluster, the
|
|
12
|
+
* structured-artifact ingest helpers, and the follow-up companion gate + its human-action API.
|
|
13
|
+
*
|
|
14
|
+
* Extracted out of `ExecutionService` so the handlers depend on a cohesive surface rather than
|
|
15
|
+
* a fat per-callback bag. It composes the existing collaborators ({@link RunStateMachine} /
|
|
16
|
+
* {@link StepGraph} / the five gate controllers / {@link MergeResolver}); the merge/auto-start
|
|
17
|
+
* subgraph deliberately STAYS on the engine, reached only through the injected
|
|
18
|
+
* `resolveRiskPolicy` callback + the {@link MergeResolver} (which itself closes over the
|
|
19
|
+
* engine's `finalizeMerge`). `ExecutionService.stepInstance` / `pollAgentJob` / `pollGate`
|
|
20
|
+
* delegate here; no behaviour changes in the move.
|
|
28
21
|
*/
|
|
29
|
-
type ResolvedRiskPolicy = {
|
|
30
|
-
maxComplexity: number;
|
|
31
|
-
maxRisk: number;
|
|
32
|
-
maxImpact: number;
|
|
33
|
-
ciMaxAttempts: number;
|
|
34
|
-
maxRequirementIterations: number;
|
|
35
|
-
maxRequirementConcernAllowed: RequirementConcernLevel;
|
|
36
|
-
judgeMinScore: number;
|
|
37
|
-
judgeMaxBounces: number;
|
|
38
|
-
releaseWatchWindowMinutes: number;
|
|
39
|
-
releaseMaxAttempts: number;
|
|
40
|
-
humanReviewGraceMinutes: number;
|
|
41
|
-
forkDecision?: StepGating | null;
|
|
42
|
-
};
|
|
43
|
-
/** Collaborators + leaf dependencies the {@link RunDispatcher} needs. */
|
|
44
|
-
export interface RunDispatcherDeps {
|
|
45
|
-
blockRepository: BlockRepository;
|
|
46
|
-
executionRepository: ExecutionRepository;
|
|
47
|
-
agentExecutor: AgentExecutor;
|
|
48
|
-
/** App-owned agent-kind registry: a registered kind's step spec + pre/post-op hooks. */
|
|
49
|
-
agentKindRegistry: AgentKindRegistry;
|
|
50
|
-
/** App-owned polling-gate registry (built-ins installed by the facade via `registerBuiltinGates`). */
|
|
51
|
-
gateRegistry: GateRegistry;
|
|
52
|
-
/**
|
|
53
|
-
* The app-owned JUDGE registry (the fourth step-taxonomy bucket) the composition root
|
|
54
|
-
* injected, plus the verdict producer. An absent / disabled assessor makes every judge step
|
|
55
|
-
* a pass-through, which is exactly what a deployment with no model wired (and the
|
|
56
|
-
* conformance/e2e suites) gets. See `docs/initiatives/judge-registry.md`.
|
|
57
|
-
*/
|
|
58
|
-
judgeRegistry: JudgeRegistry;
|
|
59
|
-
judgeAssessor?: JudgeAssessor;
|
|
60
|
-
/**
|
|
61
|
-
* The prompt-fragment library, used by the judge driver for ONE thing: resolving a rubric's
|
|
62
|
-
* per-workspace override body (see `JudgeRubric.fragmentId`). Absent ⇒ the registration's
|
|
63
|
-
* default rubric.
|
|
64
|
-
*/
|
|
65
|
-
fragmentResolver?: FragmentBodyResolver;
|
|
66
|
-
/** App-owned step-completion-resolver registry (deployment-registered resolvers). */
|
|
67
|
-
stepResolverRegistry: StepResolverRegistry;
|
|
68
|
-
/** App-owned provider registry the gate machine's {@link GateContext} reads (gate data sources). */
|
|
69
|
-
providerRegistry: ProviderRegistry;
|
|
70
|
-
workRunner: WorkRunner;
|
|
71
|
-
events: ExecutionEventPublisher;
|
|
72
|
-
idGenerator: IdGenerator;
|
|
73
|
-
clock: Clock;
|
|
74
|
-
/**
|
|
75
|
-
* Where the dispatcher's best-effort hooks (issue writeback, lease release, repo ops) report
|
|
76
|
-
* their drops. Absent ⇒ `noopLogger`, which is what the engine unit tests construct with.
|
|
77
|
-
*/
|
|
78
|
-
logger?: Logger;
|
|
79
|
-
/**
|
|
80
|
-
* Optional settled-gate projection: the gate machine records each terminal verdict into it
|
|
81
|
-
* for the operator dashboard's attempt statistics. Absent ⇒ nothing is recorded.
|
|
82
|
-
*/
|
|
83
|
-
gateOutcomeRepository?: GateOutcomeRepository;
|
|
84
|
-
spend: SpendService;
|
|
85
|
-
stepGraph: StepGraph;
|
|
86
|
-
runStateMachine: RunStateMachine;
|
|
87
|
-
contextBuilder: AgentContextBuilder;
|
|
88
|
-
mergeResolver: MergeResolver;
|
|
89
|
-
companionController: CompanionController;
|
|
90
|
-
testerController: TesterController;
|
|
91
|
-
ralphController: RalphController;
|
|
92
|
-
humanTestController: HumanTestController;
|
|
93
|
-
visualConfirmationController: VisualConfirmationController;
|
|
94
|
-
reviewGate: ReviewGateController;
|
|
95
|
-
forkDecisionController: ForkDecisionController;
|
|
96
|
-
prReviewController: PrReviewController;
|
|
97
|
-
requirementsKind: ReviewKind<RequirementReview>;
|
|
98
|
-
clarityKind: ReviewKind<ClarityReview>;
|
|
99
|
-
requirementsBrainstormKind: ReviewKind<BrainstormSession>;
|
|
100
|
-
architectureBrainstormKind: ReviewKind<BrainstormSession>;
|
|
101
|
-
/**
|
|
102
|
-
* The interactive-interviewer gates wired for this deployment (initiative-planning, document
|
|
103
|
-
* interview, …). Each rides the shared {@link InterviewGateController} spine and is routed by
|
|
104
|
-
* the `interview-gate` TRAIT, keyed on its own `agentKind` — so adding a new interviewer wires
|
|
105
|
-
* its controller here, with no new dispatch branch. Absent/unwired kinds pass through.
|
|
106
|
-
*/
|
|
107
|
-
interviewControllers?: InterviewGateController<unknown>[];
|
|
108
|
-
/** Keeps the run's verification report current on its PR; a no-op with no publisher wired. */
|
|
109
|
-
prVerificationReport: PrVerificationReportController;
|
|
110
|
-
runInitiatorScope: RunInitiatorScope;
|
|
111
|
-
environmentProvisioning?: EnvironmentProvisioningService;
|
|
112
|
-
ticketTrackerProvider?: TicketTrackerProvider;
|
|
113
|
-
issueWriteback?: IssueWritebackProvider;
|
|
114
|
-
/** The recurring `bug-intake` step's read-and-claim helper; absent → the step is a no-op. */
|
|
115
|
-
bugIntakeService?: BugIntakeService;
|
|
116
|
-
notificationService?: NotificationService;
|
|
117
|
-
blueprintReconciler?: BlueprintReconciler;
|
|
118
|
-
initiativeService?: InitiativeService;
|
|
119
|
-
resolveRunRepoContext?: ResolveRunRepoContext;
|
|
120
|
-
resolveProviderCapabilities?: (workspaceId: string, initiatedBy?: string | null, modelPresetId?: string) => Promise<ProviderCapabilities>;
|
|
121
|
-
/** Resolve a task's merge preset (stays on the engine, shared with the merge subgraph). */
|
|
122
|
-
resolveRiskPolicy: (workspaceId: string, block: Block) => Promise<ResolvedRiskPolicy>;
|
|
123
|
-
/** Whether a resolved model id incurs metered monetary cost (the start gate's predicate). */
|
|
124
|
-
modelIdIsMetered: (id: string | undefined, caps: ProviderCapabilities) => boolean;
|
|
125
|
-
}
|
|
126
22
|
export declare class RunDispatcher {
|
|
127
23
|
private readonly blockRepository;
|
|
128
24
|
private readonly executionRepository;
|
|
@@ -158,10 +54,7 @@ export declare class RunDispatcher {
|
|
|
158
54
|
private readonly notificationService?;
|
|
159
55
|
private readonly blueprintReconciler?;
|
|
160
56
|
private readonly initiativeService?;
|
|
161
|
-
private readonly resolveRunRepoContext?;
|
|
162
|
-
private readonly resolveProviderCapabilities?;
|
|
163
57
|
private readonly resolveRiskPolicy;
|
|
164
|
-
private readonly modelIdIsMetered;
|
|
165
58
|
/**
|
|
166
59
|
* The deterministic `deployer` step family (the multi-frame provision fan-out, the async
|
|
167
60
|
* deploy-job poll, and the environment projection env-aware steps surface), extracted to
|
|
@@ -176,6 +69,13 @@ export declare class RunDispatcher {
|
|
|
176
69
|
private readonly pollCompletion;
|
|
177
70
|
/** The RUNNING half of the poll branch tree — the sibling of {@link pollCompletion}. */
|
|
178
71
|
private readonly pollRunning;
|
|
72
|
+
/**
|
|
73
|
+
* The DISPATCH side of a step — the other side of the park from the two poll controllers above:
|
|
74
|
+
* context build, registered pre-ops, the async start-and-park / inline call, and the facts only a
|
|
75
|
+
* dispatch can record (resolved model, job attribution, investigation diagnostics). The public
|
|
76
|
+
* methods below are thin pass-throughs the execution service and the step registries re-export.
|
|
77
|
+
*/
|
|
78
|
+
private readonly agentDispatch;
|
|
179
79
|
/** The one-shot engine steps (`tracker` / `bug-intake` / `initiative-committer`). */
|
|
180
80
|
private readonly oneShot;
|
|
181
81
|
/**
|
|
@@ -222,72 +122,16 @@ export declare class RunDispatcher {
|
|
|
222
122
|
* retry); every other error propagates so real failures still fail the run.
|
|
223
123
|
*/
|
|
224
124
|
private redriveOnContention;
|
|
225
|
-
/**
|
|
226
|
-
* The generic container/inline-agent step — the lowest-priority StepHandler, claiming
|
|
227
|
-
* every step no more-specific handler did (coder, architect, spec-writer, merger,
|
|
228
|
-
* task-estimator, the container-backed companions, …). Builds the agent context, runs the
|
|
229
|
-
* kind's pre-ops, then either dispatches an async container job and parks (the durable
|
|
230
|
-
* driver polls between sleeps) or runs the inline LLM call and records the result. This is
|
|
231
|
-
* what the dispatch chain falls through to; all the deterministic / gate / inline-review
|
|
232
|
-
* kinds are claimed earlier by their own handlers (see {@link buildStepHandlerRegistry}).
|
|
233
|
-
*/
|
|
125
|
+
/** @see AgentDispatchController.handleAgentStep */
|
|
234
126
|
private handleAgentStep;
|
|
235
|
-
/**
|
|
236
|
-
* Stamp the run's investigation diagnostics from a container dispatch (the `lastDispatch`
|
|
237
|
-
* block + the control-plane host). Mutates `instance` in place; the caller upserts. Reflects
|
|
238
|
-
* the MOST RECENT dispatch — a run's failure is almost always in its latest step, and keeping
|
|
239
|
-
* one block (not a per-step history) keeps the record small. `executionBackend` is left for the
|
|
240
|
-
* first poll to fill (the transport reports it). Never carries a token/secret.
|
|
241
|
-
*/
|
|
242
|
-
private recordDispatchDiagnostics;
|
|
243
|
-
/**
|
|
244
|
-
* Fill in `diagnostics.lastDispatch.executionBackend` from the transport-reported backend on
|
|
245
|
-
* the first poll that carries it (native host process vs. sandboxed container — the datum that
|
|
246
|
-
* is otherwise indistinguishable after the fact). Idempotent: a no-op once set, or when the
|
|
247
|
-
* update carries no backend / the dispatch block is missing. Returns whether it changed
|
|
248
|
-
* anything (so the caller can skip a redundant upsert).
|
|
249
|
-
*/
|
|
127
|
+
/** @see AgentDispatchController.recordBackendDiagnostics */
|
|
250
128
|
private recordBackendDiagnostics;
|
|
251
|
-
/**
|
|
252
|
-
* Preview the model a step will run (`provider:model`) ahead of the work, so the
|
|
253
|
-
* board can show it during the inline query / container cold-boot rather than only
|
|
254
|
-
* once the result or job handle lands. Best-effort: the executor may not implement
|
|
255
|
-
* a preview, and a resolution failure (e.g. an unwired container kind that fails at
|
|
256
|
-
* dispatch anyway) must never break the run — both yield undefined.
|
|
257
|
-
*/
|
|
129
|
+
/** @see AgentDispatchController.previewStepModel */
|
|
258
130
|
previewStepModel(context: AgentRunContext): Promise<string | undefined>;
|
|
259
|
-
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
* resolved through the executor (the authority on "subscriptions always win").
|
|
264
|
-
* - a LOCAL-runner model (Ollama / LM Studio / …) — keyless, runs on the user's own
|
|
265
|
-
* endpoint, so it costs the deployment nothing; detected off the resolved model id.
|
|
266
|
-
* This is what makes a `0` budget mean "no PAID spend" without bricking a workspace that
|
|
267
|
-
* deliberately runs only local models or subscriptions (see the spend-budget docs).
|
|
268
|
-
*
|
|
269
|
-
* Once the executor resolves the step's concrete model id, the metered/non-metered
|
|
270
|
-
* decision is delegated to the SAME {@link modelIdIsMetered} predicate the up-front
|
|
271
|
-
* {@link assertBudgetAllowsPipeline} gate uses, so the two gates can't classify a model
|
|
272
|
-
* differently (a divergence would let a run pass the start gate then immediately pause,
|
|
273
|
-
* or vice versa). The executor's `isQuotaBased` is still consulted first as the
|
|
274
|
-
* authoritative subscription-routing signal; the shared predicate covers local-runner +
|
|
275
|
-
* subscription-by-capability + Cloudflare classification identically to the start gate.
|
|
276
|
-
* Falls back to a bare local-id check when no capability resolver is wired.
|
|
277
|
-
*
|
|
278
|
-
* Best-effort and side-effect-free: an executor without the capability, a missing block,
|
|
279
|
-
* or any resolution error all report false (treated as budget-metered, the prior
|
|
280
|
-
* behaviour). Only consulted on the over-budget path, so it never touches the happy path.
|
|
281
|
-
*/
|
|
282
|
-
currentStepIsNonMetered(workspaceId: string, instance: ExecutionInstance, step: ExecutionInstance['steps'][number]): Promise<boolean>;
|
|
283
|
-
/**
|
|
284
|
-
* Resolve the reviewed PR's head sha at review-START, stamped onto `step.prReview` when the
|
|
285
|
-
* `pr-reviewer` first dispatches. The `post` resolution later re-reads the PR head and folds
|
|
286
|
-
* every finding into the summary when it moved (the frozen line numbers may have drifted). Best
|
|
287
|
-
* effort: null on any failure, no PR number, or a client without the `pullRequestHeadSha`
|
|
288
|
-
* capability — the drift check then simply doesn't run (posting falls back to per-line filtering).
|
|
289
|
-
*/
|
|
290
|
-
private resolveReviewedHeadSha;
|
|
131
|
+
/** @see AgentDispatchController.currentStepIsNonMetered */
|
|
132
|
+
currentStepIsNonMetered(workspaceId: string, instance: ExecutionInstance, step: PipelineStep): Promise<boolean>;
|
|
133
|
+
/** @see AgentDispatchController.runAgent */
|
|
134
|
+
runAgent(context: AgentRunContext, options?: AdvanceOptions): Promise<AgentRunResult>;
|
|
291
135
|
/**
|
|
292
136
|
* Poll the asynchronous job a parked step dispatched. Returns `awaiting_job`
|
|
293
137
|
* while it runs (the driver keeps polling), records the result and advances on
|
|
@@ -475,13 +319,6 @@ export declare class RunDispatcher {
|
|
|
475
319
|
answerFollowUp(workspaceId: string, executionId: string, itemId: string, answer: string): Promise<FollowUpsStepState>;
|
|
476
320
|
/** @see FollowUpGateController.dismissFollowUp */
|
|
477
321
|
dismissFollowUp(workspaceId: string, executionId: string, itemId: string): Promise<FollowUpsStepState>;
|
|
478
|
-
/**
|
|
479
|
-
* Invoke the agent for an already-built context. Failures are swallowed into the
|
|
480
|
-
* step output so a run never wedges — unless `rethrowAgentErrors` is set (the
|
|
481
|
-
* durable path), in which case the error propagates so the driver's per-step
|
|
482
|
-
* retry can take over.
|
|
483
|
-
*/
|
|
484
|
-
runAgent(context: AgentRunContext, options?: AdvanceOptions): Promise<AgentRunResult>;
|
|
485
322
|
/**
|
|
486
323
|
* Strictly parse a Blueprinter step's tree and reconcile it onto the board. The
|
|
487
324
|
* blueprint maps the whole repository, so it is reconciled onto the run block's
|
|
@@ -499,5 +336,4 @@ export declare class RunDispatcher {
|
|
|
499
336
|
*/
|
|
500
337
|
private ingestSpec;
|
|
501
338
|
}
|
|
502
|
-
export {};
|
|
503
339
|
//# sourceMappingURL=RunDispatcher.d.ts.map
|