@cat-factory/server 0.215.0 → 0.216.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/modules/publicApi/PublicDecisionController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicDecisionController.js +41 -322
- package/dist/modules/publicApi/PublicDecisionController.js.map +1 -1
- package/dist/modules/publicApi/decisions/approvalRoutes.d.ts +4 -0
- package/dist/modules/publicApi/decisions/approvalRoutes.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/approvalRoutes.js +96 -0
- package/dist/modules/publicApi/decisions/approvalRoutes.js.map +1 -0
- package/dist/modules/publicApi/decisions/dialogueRoutes.d.ts +5 -0
- package/dist/modules/publicApi/decisions/dialogueRoutes.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/dialogueRoutes.js +161 -0
- package/dist/modules/publicApi/decisions/dialogueRoutes.js.map +1 -0
- package/dist/modules/publicApi/decisions/gateRoutes.d.ts +5 -0
- package/dist/modules/publicApi/decisions/gateRoutes.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/gateRoutes.js +120 -0
- package/dist/modules/publicApi/decisions/gateRoutes.js.map +1 -0
- package/dist/modules/publicApi/decisions/projection.d.ts +62 -0
- package/dist/modules/publicApi/decisions/projection.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/projection.js +489 -0
- package/dist/modules/publicApi/decisions/projection.js.map +1 -0
- package/dist/modules/publicApi/decisions/requirementsRoutes.d.ts +11 -0
- package/dist/modules/publicApi/decisions/requirementsRoutes.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/requirementsRoutes.js +91 -0
- package/dist/modules/publicApi/decisions/requirementsRoutes.js.map +1 -0
- package/dist/modules/publicApi/decisions/scope.d.ts +107 -0
- package/dist/modules/publicApi/decisions/scope.d.ts.map +1 -0
- package/dist/modules/publicApi/decisions/scope.js +142 -0
- package/dist/modules/publicApi/decisions/scope.js.map +1 -0
- package/dist/modules/publicApi/publicApiAdmission.d.ts +9 -5
- package/dist/modules/publicApi/publicApiAdmission.d.ts.map +1 -1
- package/dist/modules/publicApi/publicApiAdmission.js +13 -5
- package/dist/modules/publicApi/publicApiAdmission.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { incorporatePublicRunBrainstormContract, incorporatePublicRunClarityContract, proceedPublicRunBrainstormContract, proceedPublicRunClarityContract, replyPublicRunBrainstormOptionContract, replyPublicRunClarityFindingContract, reReviewPublicRunBrainstormContract, reReviewPublicRunClarityContract, resolvePublicRunBrainstormExceededContract, resolvePublicRunClarityExceededContract, setPublicRunBrainstormOptionStatusContract, setPublicRunClarityFindingStatusContract, } from '@cat-factory/contracts';
|
|
2
|
+
import { buildHonoRoute } from '@toad-contracts/hono';
|
|
3
|
+
import { buildDecisionList } from './projection.js';
|
|
4
|
+
import { failureBody, gateBrainstormAction, gateClarityAction } from './scope.js';
|
|
5
|
+
// The two iterative-review loops beside requirements: CLARITY (bug-report triage) and the two
|
|
6
|
+
// BRAINSTORM dialogues. Both mirror the requirements routes verb for verb, because they are the
|
|
7
|
+
// same loop over a different subject — the engine drives all three through one
|
|
8
|
+
// `ReviewGateController`, so exposing them differently here would invent a distinction the
|
|
9
|
+
// platform does not have.
|
|
10
|
+
//
|
|
11
|
+
// Both are addressed the way requirements is: by ITEM id, with the live entity resolved from the
|
|
12
|
+
// run's block (and, for a brainstorm, its stage). The INTERNAL routes for both are entity-keyed
|
|
13
|
+
// (`/clarity-reviews/:reviewId/items/:itemId`, `/brainstorms/:sessionId/items/:itemId`); copying
|
|
14
|
+
// that here would make a headless caller thread through an id it never chose.
|
|
15
|
+
export function registerClarityDecisionRoutes(app) {
|
|
16
|
+
// Answer one triage finding.
|
|
17
|
+
buildHonoRoute(app, replyPublicRunClarityFindingContract, async (c) => {
|
|
18
|
+
const { runId, itemId } = c.req.valid('param');
|
|
19
|
+
const gated = await gateClarityAction(c, runId);
|
|
20
|
+
if ('fail' in gated) {
|
|
21
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
22
|
+
}
|
|
23
|
+
const { workspaceId, scoped, clarity, review } = gated;
|
|
24
|
+
await clarity.service.replyToItem(workspaceId, review.id, itemId, c.req.valid('json').reply);
|
|
25
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
26
|
+
});
|
|
27
|
+
// Dismiss a finding as not applicable, or reopen one dismissed by mistake.
|
|
28
|
+
buildHonoRoute(app, setPublicRunClarityFindingStatusContract, async (c) => {
|
|
29
|
+
const { runId, itemId } = c.req.valid('param');
|
|
30
|
+
const gated = await gateClarityAction(c, runId);
|
|
31
|
+
if ('fail' in gated) {
|
|
32
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
33
|
+
}
|
|
34
|
+
const { workspaceId, scoped, clarity, review } = gated;
|
|
35
|
+
await clarity.service.setItemStatus(workspaceId, review.id, itemId, c.req.valid('json').status);
|
|
36
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
37
|
+
});
|
|
38
|
+
// Fold the recorded answers into a standardized bug report. ASYNCHRONOUS, as requirements.
|
|
39
|
+
buildHonoRoute(app, incorporatePublicRunClarityContract, async (c) => {
|
|
40
|
+
const { runId } = c.req.valid('param');
|
|
41
|
+
const gated = await gateClarityAction(c, runId);
|
|
42
|
+
if ('fail' in gated) {
|
|
43
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
44
|
+
}
|
|
45
|
+
const { workspaceId, scoped } = gated;
|
|
46
|
+
await c
|
|
47
|
+
.get('container')
|
|
48
|
+
.executionService.clarityReview.incorporate(workspaceId, scoped.blockId, c.req.valid('json').feedback);
|
|
49
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
50
|
+
});
|
|
51
|
+
// One more triage pass over the clarified report.
|
|
52
|
+
buildHonoRoute(app, reReviewPublicRunClarityContract, async (c) => {
|
|
53
|
+
const { runId } = c.req.valid('param');
|
|
54
|
+
const gated = await gateClarityAction(c, runId);
|
|
55
|
+
if ('fail' in gated) {
|
|
56
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
57
|
+
}
|
|
58
|
+
const { workspaceId, scoped } = gated;
|
|
59
|
+
await c.get('container').executionService.clarityReview.reReview(workspaceId, scoped.blockId);
|
|
60
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
61
|
+
});
|
|
62
|
+
// Settle the clarity phase and advance the parked run.
|
|
63
|
+
buildHonoRoute(app, proceedPublicRunClarityContract, async (c) => {
|
|
64
|
+
const { runId } = c.req.valid('param');
|
|
65
|
+
const gated = await gateClarityAction(c, runId);
|
|
66
|
+
if ('fail' in gated) {
|
|
67
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
68
|
+
}
|
|
69
|
+
const { workspaceId, scoped } = gated;
|
|
70
|
+
await c.get('container').executionService.clarityReview.proceed(workspaceId, scoped.blockId);
|
|
71
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
72
|
+
});
|
|
73
|
+
// Resolve a review that hit its iteration cap (extra round / proceed / stop and reset).
|
|
74
|
+
buildHonoRoute(app, resolvePublicRunClarityExceededContract, async (c) => {
|
|
75
|
+
const { runId } = c.req.valid('param');
|
|
76
|
+
const gated = await gateClarityAction(c, runId);
|
|
77
|
+
if ('fail' in gated) {
|
|
78
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
79
|
+
}
|
|
80
|
+
const { workspaceId, scoped } = gated;
|
|
81
|
+
await c
|
|
82
|
+
.get('container')
|
|
83
|
+
.executionService.clarityReview.resolveExceeded(workspaceId, scoped.blockId, c.req.valid('json').choice);
|
|
84
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function registerBrainstormDecisionRoutes(app) {
|
|
88
|
+
// Respond to one proposed option (pick it, or steer it).
|
|
89
|
+
buildHonoRoute(app, replyPublicRunBrainstormOptionContract, async (c) => {
|
|
90
|
+
const { runId, stage, itemId } = c.req.valid('param');
|
|
91
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
92
|
+
if ('fail' in gated) {
|
|
93
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
94
|
+
}
|
|
95
|
+
const { workspaceId, scoped, brainstorm, review } = gated;
|
|
96
|
+
await brainstorm.services[stage].replyToItem(workspaceId, review.id, itemId, c.req.valid('json').reply);
|
|
97
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
98
|
+
});
|
|
99
|
+
// Dismiss a proposed option, or reopen one dismissed by mistake.
|
|
100
|
+
buildHonoRoute(app, setPublicRunBrainstormOptionStatusContract, async (c) => {
|
|
101
|
+
const { runId, stage, itemId } = c.req.valid('param');
|
|
102
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
103
|
+
if ('fail' in gated) {
|
|
104
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
105
|
+
}
|
|
106
|
+
const { workspaceId, scoped, brainstorm, review } = gated;
|
|
107
|
+
await brainstorm.services[stage].setItemStatus(workspaceId, review.id, itemId, c.req.valid('json').status);
|
|
108
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
109
|
+
});
|
|
110
|
+
// Fold the picks into one converged direction. ASYNCHRONOUS, as requirements.
|
|
111
|
+
buildHonoRoute(app, incorporatePublicRunBrainstormContract, async (c) => {
|
|
112
|
+
const { runId, stage } = c.req.valid('param');
|
|
113
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
114
|
+
if ('fail' in gated) {
|
|
115
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
116
|
+
}
|
|
117
|
+
const { workspaceId, scoped } = gated;
|
|
118
|
+
await c
|
|
119
|
+
.get('container')
|
|
120
|
+
.executionService.brainstorm.incorporate(workspaceId, scoped.blockId, stage, c.req.valid('json').feedback);
|
|
121
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
122
|
+
});
|
|
123
|
+
// One more brainstorm pass against the converged direction.
|
|
124
|
+
buildHonoRoute(app, reReviewPublicRunBrainstormContract, async (c) => {
|
|
125
|
+
const { runId, stage } = c.req.valid('param');
|
|
126
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
127
|
+
if ('fail' in gated) {
|
|
128
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
129
|
+
}
|
|
130
|
+
const { workspaceId, scoped } = gated;
|
|
131
|
+
await c
|
|
132
|
+
.get('container')
|
|
133
|
+
.executionService.brainstorm.reReview(workspaceId, scoped.blockId, stage);
|
|
134
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
135
|
+
});
|
|
136
|
+
// Settle the brainstorm (the last converged direction wins downstream) and advance the run.
|
|
137
|
+
buildHonoRoute(app, proceedPublicRunBrainstormContract, async (c) => {
|
|
138
|
+
const { runId, stage } = c.req.valid('param');
|
|
139
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
140
|
+
if ('fail' in gated) {
|
|
141
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
142
|
+
}
|
|
143
|
+
const { workspaceId, scoped } = gated;
|
|
144
|
+
await c.get('container').executionService.brainstorm.proceed(workspaceId, scoped.blockId, stage);
|
|
145
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
146
|
+
});
|
|
147
|
+
// Resolve a session that hit its iteration cap (extra round / proceed / stop and reset).
|
|
148
|
+
buildHonoRoute(app, resolvePublicRunBrainstormExceededContract, async (c) => {
|
|
149
|
+
const { runId, stage } = c.req.valid('param');
|
|
150
|
+
const gated = await gateBrainstormAction(c, runId, stage);
|
|
151
|
+
if ('fail' in gated) {
|
|
152
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
153
|
+
}
|
|
154
|
+
const { workspaceId, scoped } = gated;
|
|
155
|
+
await c
|
|
156
|
+
.get('container')
|
|
157
|
+
.executionService.brainstorm.resolveExceeded(workspaceId, scoped.blockId, stage, c.req.valid('json').choice);
|
|
158
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=dialogueRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogueRoutes.js","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/dialogueRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sCAAsC,EACtC,mCAAmC,EACnC,kCAAkC,EAClC,+BAA+B,EAC/B,sCAAsC,EACtC,oCAAoC,EACpC,mCAAmC,EACnC,gCAAgC,EAChC,0CAA0C,EAC1C,uCAAuC,EACvC,0CAA0C,EAC1C,wCAAwC,GACzC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAEjF,8FAA8F;AAC9F,gGAAgG;AAChG,+EAA+E;AAC/E,2FAA2F;AAC3F,0BAA0B;AAC1B,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,iGAAiG;AACjG,8EAA8E;AAE9E,MAAM,UAAU,6BAA6B,CAAC,GAAiB;IAC7D,6BAA6B;IAC7B,cAAc,CAAC,GAAG,EAAE,oCAAoC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QACpE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC9C,MAAM,KAAK,GAAG,MAAM,iBAAiB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAC/C,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,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CAAC,CAAC,IAAI,CAAC,MAAM,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;IAEF,yFAAyF;IACzF,cAAc,CAAC,GAAG,EAAE,0CAA0C,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC1E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC7C,MAAM,KAAK,GAAG,MAAM,oBAAoB,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;QACzD,IAAI,MAAM,IAAI,KAAK,EAAE,CAAC;YACpB,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3D,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;QACrC,MAAM,CAAC;aACJ,GAAG,CAAC,WAAW,CAAC;aAChB,gBAAgB,CAAC,UAAU,CAAC,eAAe,CAC1C,WAAW,EACX,MAAM,CAAC,OAAO,EACd,KAAK,EACL,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3B,CAAA;QACH,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import type { AppEnv } from '../../../http/env.js';
|
|
3
|
+
export declare function registerPrReviewDecisionRoutes(app: Hono<AppEnv>): void;
|
|
4
|
+
export declare function registerHumanVerdictGateRoutes(app: Hono<AppEnv>): void;
|
|
5
|
+
//# sourceMappingURL=gateRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateRoutes.d.ts","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/gateRoutes.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAqBlD,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CA2DtE;AAED,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAoEtE"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { approvePublicRunVisualConfirmContract, challengePublicRunPrReviewFindingContract, confirmPublicRunHumanTestContract, dismissPublicRunPrReviewFindingContract, requestPublicRunHumanTestFixContract, requestPublicRunVisualConfirmFixContract, resolvePublicRunPrReviewContract, } from '@cat-factory/contracts';
|
|
2
|
+
import { buildHonoRoute } from '@toad-contracts/hono';
|
|
3
|
+
import { runWithInitiator } from '../../../github/runInitiatorContext.js';
|
|
4
|
+
import { buildDecisionList } from './projection.js';
|
|
5
|
+
import { failureBody, gateDecisionAction } from './scope.js';
|
|
6
|
+
// The three CONTAINER-BACKED parks: the PR deep review's finding curation, and the two
|
|
7
|
+
// human-verdict gates (human-test, visual-confirmation).
|
|
8
|
+
//
|
|
9
|
+
// All three are reachable only through `POST /api/v1/tasks/:taskId/start`, since each is produced
|
|
10
|
+
// by a container step and the jobs surface is inline-only. That is also why a route here that can
|
|
11
|
+
// DISPATCH runs under the run's own initiator: standing up a container agent (a fixer, a challenge
|
|
12
|
+
// investigator) or writing to the pull request must keep using the credentials the run was started
|
|
13
|
+
// with rather than the deployment default. `dismiss` is the one route that does not, and the
|
|
14
|
+
// omission is deliberate rather than missed: dropping a finding from the parked review writes the
|
|
15
|
+
// step and nothing else, so there is no outbound work for an initiator to credential.
|
|
16
|
+
//
|
|
17
|
+
// The human-verdict gates are addressed by RUN, not by the parked step, because their service
|
|
18
|
+
// methods are block-scoped (the SPA drives them from the task's window). That makes the `runId`
|
|
19
|
+
// decorative to everything downstream, which is safe for the reason `loadScopedRun` documents: a
|
|
20
|
+
// run that is no longer its block's live run is not resolvable, so resolution IS the check.
|
|
21
|
+
export function registerPrReviewDecisionRoutes(app) {
|
|
22
|
+
// Resolve the parked review with the curated selection. `fix` and `post` act on the real pull
|
|
23
|
+
// request — the one place this surface has an effect outside the platform.
|
|
24
|
+
buildHonoRoute(app, resolvePublicRunPrReviewContract, async (c) => {
|
|
25
|
+
const { runId } = c.req.valid('param');
|
|
26
|
+
const gated = await gateDecisionAction(c, runId);
|
|
27
|
+
if ('fail' in gated) {
|
|
28
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
29
|
+
}
|
|
30
|
+
const { workspaceId, scoped } = gated;
|
|
31
|
+
// The public body leaves both fields plainly optional (a schema `default` on a REQUEST field
|
|
32
|
+
// emits four SDKs whose types insist on a value the API does not require), so the same
|
|
33
|
+
// fallbacks the internal schema declares are applied here.
|
|
34
|
+
const { action, findingIds } = c.req.valid('json');
|
|
35
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c.get('container').executionService.resolvePrReview(workspaceId, scoped.execution.id, {
|
|
36
|
+
action: action ?? 'finish',
|
|
37
|
+
findingIds: findingIds ?? [],
|
|
38
|
+
}));
|
|
39
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
40
|
+
});
|
|
41
|
+
// Drop one finding from the review entirely. Curation, not a resolution: the run stays parked,
|
|
42
|
+
// and nothing is dispatched, hence no initiator scope (see the note at the top of this file).
|
|
43
|
+
buildHonoRoute(app, dismissPublicRunPrReviewFindingContract, async (c) => {
|
|
44
|
+
const { runId, findingId } = c.req.valid('param');
|
|
45
|
+
const gated = await gateDecisionAction(c, runId);
|
|
46
|
+
if ('fail' in gated) {
|
|
47
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
48
|
+
}
|
|
49
|
+
const { workspaceId, scoped } = gated;
|
|
50
|
+
await c
|
|
51
|
+
.get('container')
|
|
52
|
+
.executionService.dismissPrReviewFinding(workspaceId, scoped.execution.id, findingId);
|
|
53
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
54
|
+
});
|
|
55
|
+
// Challenge one finding: dispatch the read-only investigator to re-examine it. The review
|
|
56
|
+
// returns to `awaiting_selection` carrying the verdict, so the caller polls for the outcome.
|
|
57
|
+
buildHonoRoute(app, challengePublicRunPrReviewFindingContract, async (c) => {
|
|
58
|
+
const { runId, findingId } = c.req.valid('param');
|
|
59
|
+
const gated = await gateDecisionAction(c, runId);
|
|
60
|
+
if ('fail' in gated) {
|
|
61
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
62
|
+
}
|
|
63
|
+
const { workspaceId, scoped } = gated;
|
|
64
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
65
|
+
.get('container')
|
|
66
|
+
.executionService.challengePrReviewFinding(workspaceId, scoped.execution.id, findingId, c.req.valid('json')));
|
|
67
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export function registerHumanVerdictGateRoutes(app) {
|
|
71
|
+
// Human-test: the change works. Tear the ephemeral environment down and advance the run.
|
|
72
|
+
buildHonoRoute(app, confirmPublicRunHumanTestContract, async (c) => {
|
|
73
|
+
const { runId } = c.req.valid('param');
|
|
74
|
+
const gated = await gateDecisionAction(c, runId);
|
|
75
|
+
if ('fail' in gated) {
|
|
76
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
77
|
+
}
|
|
78
|
+
const { workspaceId, scoped } = gated;
|
|
79
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c.get('container').executionService.humanTest.confirm(workspaceId, scoped.blockId));
|
|
80
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
81
|
+
});
|
|
82
|
+
// Human-test: submit findings and dispatch the fixer, then rebuild the environment.
|
|
83
|
+
buildHonoRoute(app, requestPublicRunHumanTestFixContract, async (c) => {
|
|
84
|
+
const { runId } = c.req.valid('param');
|
|
85
|
+
const gated = await gateDecisionAction(c, runId);
|
|
86
|
+
if ('fail' in gated) {
|
|
87
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
88
|
+
}
|
|
89
|
+
const { workspaceId, scoped } = gated;
|
|
90
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
91
|
+
.get('container')
|
|
92
|
+
.executionService.humanTest.requestFix(workspaceId, scoped.blockId, c.req.valid('json').findings));
|
|
93
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
94
|
+
});
|
|
95
|
+
// Visual confirmation: the screenshots match. Advance the run.
|
|
96
|
+
buildHonoRoute(app, approvePublicRunVisualConfirmContract, async (c) => {
|
|
97
|
+
const { runId } = c.req.valid('param');
|
|
98
|
+
const gated = await gateDecisionAction(c, runId);
|
|
99
|
+
if ('fail' in gated) {
|
|
100
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
101
|
+
}
|
|
102
|
+
const { workspaceId, scoped } = gated;
|
|
103
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c.get('container').executionService.visualConfirm.approve(workspaceId, scoped.blockId));
|
|
104
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
105
|
+
});
|
|
106
|
+
// Visual confirmation: submit findings and dispatch the fixer, then re-park.
|
|
107
|
+
buildHonoRoute(app, requestPublicRunVisualConfirmFixContract, async (c) => {
|
|
108
|
+
const { runId } = c.req.valid('param');
|
|
109
|
+
const gated = await gateDecisionAction(c, runId);
|
|
110
|
+
if ('fail' in gated) {
|
|
111
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
112
|
+
}
|
|
113
|
+
const { workspaceId, scoped } = gated;
|
|
114
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
115
|
+
.get('container')
|
|
116
|
+
.executionService.visualConfirm.requestFix(workspaceId, scoped.blockId, c.req.valid('json').findings));
|
|
117
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=gateRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateRoutes.js","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/gateRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,yCAAyC,EACzC,iCAAiC,EACjC,uCAAuC,EACvC,oCAAoC,EACpC,wCAAwC,EACxC,gCAAgC,GACjC,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE5D,uFAAuF;AACvF,yDAAyD;AACzD,EAAE;AACF,kGAAkG;AAClG,kGAAkG;AAClG,mGAAmG;AACnG,mGAAmG;AACnG,6FAA6F;AAC7F,kGAAkG;AAClG,sFAAsF;AACtF,EAAE;AACF,8FAA8F;AAC9F,gGAAgG;AAChG,iGAAiG;AACjG,4FAA4F;AAE5F,MAAM,UAAU,8BAA8B,CAAC,GAAiB;IAC9D,8FAA8F;IAC9F,2EAA2E;IAC3E,cAAc,CAAC,GAAG,EAAE,gCAAgC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAChE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,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X,MAAM,CAAC,OAAO,EACd,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,QAAQ,CAC7B,CACJ,CAAA;QACD,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,iBAAiB,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,CAAA;IACrE,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { BrainstormSession, ClarityReview, Decision, ForkDecisionStepState, HumanTestStepState, JudgeStepState, PipelineStep, PrReviewStepState, PublicDecision, PublicDecisionList, RequirementReview, RunInputGate, StepApproval, VisualConfirmStepState } from '@cat-factory/contracts';
|
|
2
|
+
import type { Context } from 'hono';
|
|
3
|
+
import type { AppEnv } from '../../../http/env.js';
|
|
4
|
+
import type { ScopedRun } from './scope.js';
|
|
5
|
+
/** Project a live requirements review onto the external decision resource. */
|
|
6
|
+
export declare function toRequirementsDecision(review: RequirementReview): PublicDecision;
|
|
7
|
+
/** Project a live clarity (bug-triage) review — the requirements twin over its own document. */
|
|
8
|
+
export declare function toClarityDecision(review: ClarityReview): PublicDecision;
|
|
9
|
+
/** Project a live brainstorm session for one stage. */
|
|
10
|
+
export declare function toBrainstormDecision(session: BrainstormSession): PublicDecision;
|
|
11
|
+
/** Project a run's fork-decision step state onto the external decision resource. */
|
|
12
|
+
export declare function toForkDecision(state: ForkDecisionStepState): PublicDecision;
|
|
13
|
+
/**
|
|
14
|
+
* Project a run's JUDGE step state onto the external decision resource. The rubric body is
|
|
15
|
+
* deliberately omitted (see `publicJudgeDecisionSchema`) — a caller answers the findings.
|
|
16
|
+
*/
|
|
17
|
+
export declare function toJudgeDecision(stepKind: string, state: JudgeStepState): PublicDecision;
|
|
18
|
+
/**
|
|
19
|
+
* Project a step's APPROVAL GATE. `exceeded` is read off the step's companion state rather than
|
|
20
|
+
* the approval itself, because that is where the engine records it — and it is what tells a caller
|
|
21
|
+
* to answer with `resolve-exceeded` instead of `approve`. Reading it as a plain boolean (rather
|
|
22
|
+
* than only when a companion exists) means an ordinary pipeline gate reports `false`, which is the
|
|
23
|
+
* true statement, not an omission.
|
|
24
|
+
*/
|
|
25
|
+
export declare function toApprovalDecision(step: PipelineStep, stepIndex: number, approval: StepApproval): PublicDecision;
|
|
26
|
+
/** Project a decision an agent raised mid-work. */
|
|
27
|
+
export declare function toAgentDecision(step: PipelineStep, decision: Decision): PublicDecision;
|
|
28
|
+
/**
|
|
29
|
+
* Project a parked PR deep review's curation state.
|
|
30
|
+
*
|
|
31
|
+
* The slices and findings go through their own projections rather than crossing the wire as the
|
|
32
|
+
* engine holds them: the internal shapes are mid-evolution (per-slice resume reports) while the
|
|
33
|
+
* published ones must not move, and the `optional | null` internals collapse to always-present
|
|
34
|
+
* nullables so four generated clients have one shape to check.
|
|
35
|
+
*/
|
|
36
|
+
export declare function toPrReviewDecision(state: PrReviewStepState): PublicDecision;
|
|
37
|
+
/** Project a parked human-test gate: what to test against, and how much fix budget is left. */
|
|
38
|
+
export declare function toHumanTestDecision(state: HumanTestStepState): PublicDecision;
|
|
39
|
+
/** Project a parked visual-confirmation gate: the pairings awaiting a verdict. */
|
|
40
|
+
export declare function toVisualConfirmDecision(state: VisualConfirmStepState): PublicDecision;
|
|
41
|
+
/**
|
|
42
|
+
* Project the PRE-DISPATCH INPUT GATE's verdict for an external caller. The issue CODES are the same
|
|
43
|
+
* closed vocabulary the SPA renders, so an integration maps them to its own copy (or hands them to
|
|
44
|
+
* whoever filed the ticket) rather than parsing our prose.
|
|
45
|
+
*/
|
|
46
|
+
export declare function toInputGateDecision(gate: RunInputGate): PublicDecision;
|
|
47
|
+
/**
|
|
48
|
+
* Build the run's decision list: whatever it is currently asking a human, plus the run status so a
|
|
49
|
+
* caller can distinguish "parked, answer me" from "still working".
|
|
50
|
+
*
|
|
51
|
+
* The run is RE-READ rather than taken from the `ScopedRun` the caller was gated with, because
|
|
52
|
+
* every mutating route builds its response through here AFTER acting: a `proceed` that advanced the
|
|
53
|
+
* run, or an `incorporate` that flipped it out of `blocked`, must not report the pre-action status.
|
|
54
|
+
* A run that vanished between the gate and here (a concurrent delete) falls back to the gated
|
|
55
|
+
* snapshot rather than 500-ing on an action that already succeeded.
|
|
56
|
+
*
|
|
57
|
+
* Everything that rides the run's STEPS is read off the instance already in hand; only the
|
|
58
|
+
* separately-stored iterative reviews cost a round-trip, and those are bounded by what the run's
|
|
59
|
+
* own step chain can produce (see {@link liveDialogueDecisions}).
|
|
60
|
+
*/
|
|
61
|
+
export declare function buildDecisionList<E extends AppEnv>(c: Context<E>, workspaceId: string, scoped: ScopedRun): Promise<PublicDecisionList>;
|
|
62
|
+
//# sourceMappingURL=projection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/projection.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,EACb,QAAQ,EAER,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,EACd,YAAY,EAGZ,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAGlB,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AACnC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAgB3C,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,iBAAiB,GAAG,cAAc,CAWhF;AAED,gGAAgG;AAChG,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,cAAc,CAWvE;AAED,uDAAuD;AACvD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAY/E;AAoBD,oFAA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