@cat-factory/server 0.214.1 → 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/agents/ContainerAgentExecutor.d.ts +5 -1
- package/dist/agents/ContainerAgentExecutor.d.ts.map +1 -1
- package/dist/agents/ContainerAgentExecutor.js +6 -13
- package/dist/agents/ContainerAgentExecutor.js.map +1 -1
- package/dist/agents/toolTrajectory.d.ts +40 -0
- package/dist/agents/toolTrajectory.d.ts.map +1 -0
- package/dist/agents/toolTrajectory.js +67 -0
- package/dist/agents/toolTrajectory.js.map +1 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +7 -0
- package/dist/app.js.map +1 -1
- package/dist/http/cors.d.ts +7 -0
- package/dist/http/cors.d.ts.map +1 -1
- package/dist/http/cors.js +8 -0
- package/dist/http/cors.js.map +1 -1
- package/dist/http/loopback.d.ts +23 -0
- package/dist/http/loopback.d.ts.map +1 -0
- package/dist/http/loopback.js +53 -0
- package/dist/http/loopback.js.map +1 -0
- package/dist/modules/publicApi/PublicDebugController.d.ts.map +1 -1
- package/dist/modules/publicApi/PublicDebugController.js +43 -1
- package/dist/modules/publicApi/PublicDebugController.js.map +1 -1
- 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/PublicMcpController.d.ts +5 -0
- package/dist/modules/publicApi/PublicMcpController.d.ts.map +1 -0
- package/dist/modules/publicApi/PublicMcpController.js +74 -0
- package/dist/modules/publicApi/PublicMcpController.js.map +1 -0
- 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/dist/modules/publicApi/publicApiAuth.d.ts +22 -0
- package/dist/modules/publicApi/publicApiAuth.d.ts.map +1 -1
- package/dist/modules/publicApi/publicApiAuth.js +39 -2
- package/dist/modules/publicApi/publicApiAuth.js.map +1 -1
- package/dist/modules/telemetry/TelemetryIngestController.d.ts.map +1 -1
- package/dist/modules/telemetry/TelemetryIngestController.js +13 -3
- package/dist/modules/telemetry/TelemetryIngestController.js.map +1 -1
- package/dist/persistence/rpc-allowlist.d.ts +1 -1
- package/dist/persistence/rpc-allowlist.d.ts.map +1 -1
- package/dist/persistence/rpc-allowlist.js +1 -0
- package/dist/persistence/rpc-allowlist.js.map +1 -1
- package/dist/telemetry/machineTelemetry.d.ts +8 -1
- package/dist/telemetry/machineTelemetry.d.ts.map +1 -1
- package/dist/telemetry/machineTelemetry.js +6 -0
- package/dist/telemetry/machineTelemetry.js.map +1 -1
- package/dist/telemetry/machineTelemetryRead.d.ts +36 -1
- package/dist/telemetry/machineTelemetryRead.d.ts.map +1 -1
- package/dist/telemetry/machineTelemetryRead.js +29 -0
- package/dist/telemetry/machineTelemetryRead.js.map +1 -1
- package/package.json +9 -8
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// The `./http` entry point, NOT the package root: the root re-exports the stdio boot, whose
|
|
2
|
+
// transport imports `node:process`, and this package is bundled into the Worker facade.
|
|
3
|
+
import { handleMcpHttpRequest, refuseMcpMethod } from '@cat-factory/mcp-server/http';
|
|
4
|
+
import { describeError } from '@cat-factory/kernel';
|
|
5
|
+
import { Hono } from 'hono';
|
|
6
|
+
import { requestLogger } from '../../http/requestLogging.js';
|
|
7
|
+
import { authorizeOrThrow, bearerToken } from './publicApiAuth.js';
|
|
8
|
+
// The HOSTED MCP endpoint (`POST /api/v1/mcp`): the public API spoken as Model Context Protocol, so
|
|
9
|
+
// a host reaches this deployment with no install.
|
|
10
|
+
//
|
|
11
|
+
// Until now the only way to drive cat-factory from a model was `npx @cat-factory/mcp-server`: an npm
|
|
12
|
+
// dependency, a local process per host, and a long-lived key sitting in the host's config file. That
|
|
13
|
+
// rules out every host that cannot spawn one — claude.ai, a hosted agent, a phone — which is most of
|
|
14
|
+
// where people actually work. This is the SAME server behind an HTTP transport, so those hosts need a
|
|
15
|
+
// URL and a key and nothing else. The stdio binary stays: it is the path that needs no backend
|
|
16
|
+
// deployment at all, and the only one for a host with no HTTP MCP support.
|
|
17
|
+
//
|
|
18
|
+
// The protocol implementation is `@cat-factory/mcp-server`'s, deliberately. This controller decides
|
|
19
|
+
// three things and nothing else: who is calling, what their key's scope means for the tool list, and
|
|
20
|
+
// where the tools' own API calls go. Everything a tool DOES is one `/api/v1` request under the
|
|
21
|
+
// caller's own key through the loopback, so this surface cannot drift from the surface it exposes and
|
|
22
|
+
// no capability exists here that the caller could not have reached with `curl`.
|
|
23
|
+
//
|
|
24
|
+
// NOT an OpenAPI operation, unlike every other `/api/v1` route. A JSON-RPC endpoint has no operation
|
|
25
|
+
// shape to describe (one path, one verb, a union of dozens of method bodies), and adding it to the
|
|
26
|
+
// spec would mint an SDK method in four languages for a protocol none of those clients speaks. It is
|
|
27
|
+
// PUBLIC SURFACE under the stability contract from its first release all the same;
|
|
28
|
+
// `backend/docs/public-api.md` carries that obligation in the spec's place.
|
|
29
|
+
//
|
|
30
|
+
// Two refusal shapes, and the split is the caller's own: an auth failure is HTTP-level in the MCP
|
|
31
|
+
// spec (the client reads the status), so it throws and `handleError` renders the deployment's error
|
|
32
|
+
// envelope with its correlation id and machine-readable reason. A method refusal is the TRANSPORT's
|
|
33
|
+
// vocabulary, so it is answered in the transport's own JSON-RPC frame by `refuseMcpMethod`.
|
|
34
|
+
export function publicMcpController(loopback) {
|
|
35
|
+
const app = new Hono();
|
|
36
|
+
// Every verb on one handler, so a `GET` gets the protocol's "no stream here" rather than Hono's
|
|
37
|
+
// bare 404, which a client reads as "no MCP endpoint at this URL".
|
|
38
|
+
app.all('/api/v1/mcp', async (c) => {
|
|
39
|
+
const refused = refuseMcpMethod(c.req.method);
|
|
40
|
+
if (refused)
|
|
41
|
+
return refused;
|
|
42
|
+
// `read` is the FLOOR, not a per-tool requirement: the ladder is inclusive, so this refuses only
|
|
43
|
+
// an absent, unknown or revoked key. What each tool may do stays enforced where it already is, by
|
|
44
|
+
// the `/api/v1` handler the loopback reaches — a scope table restated here would be a second
|
|
45
|
+
// authority on the same question, free to disagree with the first.
|
|
46
|
+
const auth = await authorizeOrThrow(c, 'read');
|
|
47
|
+
const log = requestLogger(c);
|
|
48
|
+
return handleMcpHttpRequest(c.req.raw, {
|
|
49
|
+
// The deployment's own origin, taken from the request being answered: the tools resolve their
|
|
50
|
+
// paths against it, and it is the one value that is right on a preview URL, a custom domain and
|
|
51
|
+
// a test harness alike.
|
|
52
|
+
baseUrl: new URL(c.req.url).origin,
|
|
53
|
+
// Forwarded verbatim, so the tools authenticate as the CALLER rather than as the deployment.
|
|
54
|
+
// That is what keeps the workspace scoping and the per-tool scope ladder applying unchanged.
|
|
55
|
+
// Non-empty by construction: the gate above authenticated THIS value, so the fallback is
|
|
56
|
+
// unreachable rather than a default standing in for a missing key.
|
|
57
|
+
apiKey: bearerToken(c) ?? '',
|
|
58
|
+
fetch: (input, init) => loopback(new Request(input, init), c),
|
|
59
|
+
// A `read` key can only be REFUSED by a write tool, so listing the writes would spend a model's
|
|
60
|
+
// turns discovering that. The reason rides along because the fix is a wider key rather than an
|
|
61
|
+
// operator's edit, and the server's instructions name the right one.
|
|
62
|
+
...(auth.scope === 'read' ? { readOnly: true, readOnlyReason: 'key-scope' } : {}),
|
|
63
|
+
onTransportError: (error) => {
|
|
64
|
+
// The transport has already answered by the time this fires, so a drop here leaves a caller
|
|
65
|
+
// reporting a broken endpoint and nothing on this side to read. Through `describeError`
|
|
66
|
+
// rather than `error.message`: it binds the kind alongside the message and scrubs through
|
|
67
|
+
// `redactSecrets`, and the request this fault interrupted was carrying a live API key.
|
|
68
|
+
log.warn('Hosted MCP transport error', describeError(error));
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
return app;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=PublicMcpController.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PublicMcpController.js","sourceRoot":"","sources":["../../../src/modules/publicApi/PublicMcpController.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,wFAAwF;AACxF,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAA;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CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM;YAClC,6FAA6F;YAC7F,6FAA6F;YAC7F,yFAAyF;YACzF,mEAAmE;YACnE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE;YAC5B,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7D,gGAAgG;YAChG,+FAA+F;YAC/F,qEAAqE;YACrE,GAAG,CAAC,IAAI,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,WAAoB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC1F,gBAAgB,EAAE,CAAC,KAAK,EAAE,EAAE;gBAC1B,4FAA4F;gBAC5F,wFAAwF;gBACxF,0FAA0F;gBAC1F,uFAAuF;gBACvF,GAAG,CAAC,IAAI,CAAC,4BAA4B,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;YAC9D,CAAC;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvalRoutes.d.ts","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/approvalRoutes.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAsBlD,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAoGtE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { approvePublicRunStepContract, rejectPublicRunStepContract, requestPublicRunStepChangesContract, resolvePublicRunAgentDecisionContract, resolvePublicRunStepExceededContract, } 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 GENERIC approval gate — "pause a run until a human approves" — plus the decisions an agent
|
|
7
|
+
// raises mid-work. Both are answered by an id the caller read from `GET .../decisions`, and both
|
|
8
|
+
// delegate to the SAME `StepDecisionController` methods the SPA's rail calls, so the engine's
|
|
9
|
+
// arbitration decides who wins when a person and an integration answer at once.
|
|
10
|
+
//
|
|
11
|
+
// Every route here runs under the RUN'S OWN initiator, for the reason the fork and judge routes
|
|
12
|
+
// do: releasing the park wakes the durable driver, and a board run started in the SPA carries a
|
|
13
|
+
// `usr_*` initiator whose per-user credentials the resumed container work must keep using.
|
|
14
|
+
// Answering such a run over the API must not silently demote its clone/push to the deployment
|
|
15
|
+
// default. A genuinely headless run has `initiatedBy: null`, where this is a no-op.
|
|
16
|
+
//
|
|
17
|
+
// What is deliberately NOT re-implemented: the SPA's `activateForInteraction` re-mint of a
|
|
18
|
+
// personal credential before the engine dispatches the next step. It exists so a browser client
|
|
19
|
+
// can be 428'd into re-prompting a human for a password, and there is no human here to prompt — a
|
|
20
|
+
// key-authenticated caller has no personal credential to unlock, which is the same reason the
|
|
21
|
+
// public start paths refuse a task pinned to an individual-usage model.
|
|
22
|
+
export function registerApprovalDecisionRoutes(app) {
|
|
23
|
+
// Approve the gated proposal (optionally replacing it with an edited one) and advance the run.
|
|
24
|
+
buildHonoRoute(app, approvePublicRunStepContract, async (c) => {
|
|
25
|
+
const { runId, approvalId } = 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
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
32
|
+
.get('container')
|
|
33
|
+
.executionService.approveStep(workspaceId, scoped.execution.id, approvalId, {
|
|
34
|
+
proposal: c.req.valid('json').proposal,
|
|
35
|
+
}));
|
|
36
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
37
|
+
});
|
|
38
|
+
// Request changes: the gated step re-runs with the caller's guidance folded in.
|
|
39
|
+
buildHonoRoute(app, requestPublicRunStepChangesContract, async (c) => {
|
|
40
|
+
const { runId, approvalId } = c.req.valid('param');
|
|
41
|
+
const gated = await gateDecisionAction(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 runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
47
|
+
.get('container')
|
|
48
|
+
.executionService.requestStepChanges(workspaceId, scoped.execution.id, approvalId, {
|
|
49
|
+
feedback: c.req.valid('json').feedback,
|
|
50
|
+
}));
|
|
51
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
52
|
+
});
|
|
53
|
+
// Reject: the run stops entirely. No initiator scope — nothing is dispatched, and the terminal
|
|
54
|
+
// `rejected` failure is exactly what the board offers a retry on.
|
|
55
|
+
buildHonoRoute(app, rejectPublicRunStepContract, async (c) => {
|
|
56
|
+
const { runId, approvalId } = c.req.valid('param');
|
|
57
|
+
const gated = await gateDecisionAction(c, runId);
|
|
58
|
+
if ('fail' in gated) {
|
|
59
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
60
|
+
}
|
|
61
|
+
const { workspaceId, scoped } = gated;
|
|
62
|
+
await c
|
|
63
|
+
.get('container')
|
|
64
|
+
.executionService.rejectStep(workspaceId, scoped.execution.id, approvalId, c.req.valid('json').reason);
|
|
65
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
66
|
+
});
|
|
67
|
+
// Resolve a companion gate parked at its automatic-rework cap. A DIFFERENT route from approve on
|
|
68
|
+
// purpose: the engine refuses the generic verbs on this park (`assertNotIterativeGate`), and the
|
|
69
|
+
// decision projection flags it as `exceeded` so a caller reaches for this one.
|
|
70
|
+
buildHonoRoute(app, resolvePublicRunStepExceededContract, async (c) => {
|
|
71
|
+
const { runId, approvalId } = c.req.valid('param');
|
|
72
|
+
const gated = await gateDecisionAction(c, runId);
|
|
73
|
+
if ('fail' in gated) {
|
|
74
|
+
return c.json(failureBody(gated.fail), gated.fail.status);
|
|
75
|
+
}
|
|
76
|
+
const { workspaceId, scoped } = gated;
|
|
77
|
+
await runWithInitiator({ workspaceId, initiatedBy: scoped.execution.initiatedBy }, () => c
|
|
78
|
+
.get('container')
|
|
79
|
+
.executionService.resolveCompanionExceeded(workspaceId, scoped.execution.id, approvalId, c.req.valid('json').choice));
|
|
80
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
81
|
+
});
|
|
82
|
+
// Answer a decision an agent raised: the asking step RE-RUNS with the choice folded in.
|
|
83
|
+
buildHonoRoute(app, resolvePublicRunAgentDecisionContract, async (c) => {
|
|
84
|
+
const { runId, decisionId } = 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.resolveDecision(workspaceId, scoped.execution.id, decisionId, c.req.valid('json').choice));
|
|
93
|
+
return c.json(await buildDecisionList(c, workspaceId, scoped), 200);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=approvalRoutes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approvalRoutes.js","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/approvalRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,mCAAmC,EACnC,qCAAqC,EACrC,oCAAoC,GACrC,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,iGAAiG;AACjG,iGAAiG;AACjG,8FAA8F;AAC9F,gFAAgF;AAChF,EAAE;AACF,gGAAgG;AAChG,gGAAgG;AAChG,2FAA2F;AAC3F,8FAA8F;AAC9F,oFAAoF;AACpF,EAAE;AACF,2FAA2F;AAC3F,gGAAgG;AAChG,kGAAkG;AAClG,8FAA8F;AAC9F,wEAAwE;AAExE,MAAM,UAAU,8BAA8B,CAAC,GAAiB;IAC9D,+FAA+F;IAC/F,cAAc,CAAC,GAAG,EAAE,4BAA4B,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE;QAC5D,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAClD,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAChD,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,gBAAgB,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CAAC,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAC3D,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAA;QACrC,MAAM,gBAAgB,CAAC,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,GAAG,EAAE,CACtF,CAAC;aACE,GAAG,CAAC,WAAW,CAAC;aAChB,gBAAgB,CAAC,eAAe,CAC/B,WAAW,EACX,MAAM,CAAC,SAAS,CAAC,EAAE,EACnB,UAAU,EACV,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,CAC3B,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,5 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import type { AppEnv } from '../../../http/env.js';
|
|
3
|
+
export declare function registerClarityDecisionRoutes(app: Hono<AppEnv>): void;
|
|
4
|
+
export declare function registerBrainstormDecisionRoutes(app: Hono<AppEnv>): void;
|
|
5
|
+
//# sourceMappingURL=dialogueRoutes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogueRoutes.d.ts","sourceRoot":"","sources":["../../../../src/modules/publicApi/decisions/dialogueRoutes.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAelD,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAoFrE;AAED,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAkGxE"}
|
|
@@ -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=dialogueRout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,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,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,KAAK,GAAG,MAAM,kBAAkB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;QAChD,IAAI,MAAM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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;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,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,KAAK,EAAE,qBAAqB,GAAG,cAAc,CAO3E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,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