@ccdd/project 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/monitor-ui/assets/GraphView-CYMJ1Nb7.css +1 -0
- package/dist/monitor-ui/assets/GraphView-UjtW4QRC.js +27 -0
- package/dist/monitor-ui/assets/ValidationView-CC1FvqUl.js +1 -0
- package/dist/monitor-ui/assets/ValidationView-DWl4b8Ug.css +1 -0
- package/dist/monitor-ui/assets/_plugin-vue_export-helper-BDNMzG2s.js +1 -0
- package/dist/monitor-ui/assets/elk-api-yRi2AOS6.js +1 -0
- package/dist/monitor-ui/assets/elk.bundled-CtLobQTy.js +24 -0
- package/dist/monitor-ui/assets/graph-layout-worker-CgfWoa9t.js +22 -0
- package/dist/monitor-ui/assets/index-CUzg-dht.css +1 -0
- package/dist/monitor-ui/assets/index-Cpm0fC0p.js +8 -0
- package/dist/monitor-ui/index.html +15 -0
- package/dist/scripts/prepare-demo.d.ts +26 -0
- package/dist/scripts/prepare-demo.js +121 -0
- package/dist/scripts/prepare-demo.js.map +1 -0
- package/dist/src/artifacts/groups.d.ts +9 -0
- package/dist/src/artifacts/groups.js +77 -0
- package/dist/src/artifacts/groups.js.map +1 -0
- package/dist/src/artifacts/human.d.ts +38 -0
- package/dist/src/artifacts/human.js +156 -0
- package/dist/src/artifacts/human.js.map +1 -0
- package/dist/src/artifacts/index.d.ts +149 -0
- package/dist/src/artifacts/index.js +354 -0
- package/dist/src/artifacts/index.js.map +1 -0
- package/dist/src/artifacts/instruction.d.ts +23 -0
- package/dist/src/artifacts/instruction.js +94 -0
- package/dist/src/artifacts/instruction.js.map +1 -0
- package/dist/src/artifacts/mcp-server.d.ts +6 -0
- package/dist/src/artifacts/mcp-server.js +96 -0
- package/dist/src/artifacts/mcp-server.js.map +1 -0
- package/dist/src/artifacts/tool-check.d.ts +40 -0
- package/dist/src/artifacts/tool-check.js +113 -0
- package/dist/src/artifacts/tool-check.js.map +1 -0
- package/dist/src/artifacts/types.d.ts +43 -0
- package/dist/src/artifacts/types.js +97 -0
- package/dist/src/artifacts/types.js.map +1 -0
- package/dist/src/broker/config.d.ts +11 -0
- package/dist/src/broker/config.js +141 -0
- package/dist/src/broker/config.js.map +1 -0
- package/dist/src/broker/graph.d.ts +69 -0
- package/dist/src/broker/graph.js +94 -0
- package/dist/src/broker/graph.js.map +1 -0
- package/dist/src/broker/index.d.ts +170 -0
- package/dist/src/broker/index.js +931 -0
- package/dist/src/broker/index.js.map +1 -0
- package/dist/src/cli.d.ts +24 -0
- package/dist/src/cli.js +340 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/contracts.d.ts +116 -0
- package/dist/src/contracts.js +2 -0
- package/dist/src/contracts.js.map +1 -0
- package/dist/src/definitions.d.ts +53 -0
- package/dist/src/definitions.js +2 -0
- package/dist/src/definitions.js.map +1 -0
- package/dist/src/doctor/index.d.ts +41 -0
- package/dist/src/doctor/index.js +189 -0
- package/dist/src/doctor/index.js.map +1 -0
- package/dist/src/executors/auth.d.ts +16 -0
- package/dist/src/executors/auth.js +150 -0
- package/dist/src/executors/auth.js.map +1 -0
- package/dist/src/executors/errors.d.ts +6 -0
- package/dist/src/executors/errors.js +10 -0
- package/dist/src/executors/errors.js.map +1 -0
- package/dist/src/executors/index.d.ts +20 -0
- package/dist/src/executors/index.js +262 -0
- package/dist/src/executors/index.js.map +1 -0
- package/dist/src/executors/pi.d.ts +32 -0
- package/dist/src/executors/pi.js +190 -0
- package/dist/src/executors/pi.js.map +1 -0
- package/dist/src/executors/process.d.ts +22 -0
- package/dist/src/executors/process.js +70 -0
- package/dist/src/executors/process.js.map +1 -0
- package/dist/src/local.d.ts +13 -0
- package/dist/src/local.js +20 -0
- package/dist/src/local.js.map +1 -0
- package/dist/src/monitor/actions.d.ts +12 -0
- package/dist/src/monitor/actions.js +74 -0
- package/dist/src/monitor/actions.js.map +1 -0
- package/dist/src/monitor/server.d.ts +8 -0
- package/dist/src/monitor/server.js +493 -0
- package/dist/src/monitor/server.js.map +1 -0
- package/dist/src/monitor/store.d.ts +22 -0
- package/dist/src/monitor/store.js +517 -0
- package/dist/src/monitor/store.js.map +1 -0
- package/dist/src/monitor/types.d.ts +143 -0
- package/dist/src/monitor/types.js +2 -0
- package/dist/src/monitor/types.js.map +1 -0
- package/dist/src/monitor/ui/api.d.ts +11 -0
- package/dist/src/monitor/ui/api.js +29 -0
- package/dist/src/monitor/ui/api.js.map +1 -0
- package/dist/src/monitor/ui/critic-presentation.d.ts +11 -0
- package/dist/src/monitor/ui/critic-presentation.js +60 -0
- package/dist/src/monitor/ui/critic-presentation.js.map +1 -0
- package/dist/src/monitor/ui/format.d.ts +9 -0
- package/dist/src/monitor/ui/format.js +22 -0
- package/dist/src/monitor/ui/format.js.map +1 -0
- package/dist/src/monitor/ui/graph-layout.d.ts +43 -0
- package/dist/src/monitor/ui/graph-layout.js +191 -0
- package/dist/src/monitor/ui/graph-layout.js.map +1 -0
- package/dist/src/monitor/ui/tool-content.d.ts +13 -0
- package/dist/src/monitor/ui/tool-content.js +22 -0
- package/dist/src/monitor/ui/tool-content.js.map +1 -0
- package/dist/src/monitor/ui/tool-input.d.ts +23 -0
- package/dist/src/monitor/ui/tool-input.js +112 -0
- package/dist/src/monitor/ui/tool-input.js.map +1 -0
- package/dist/src/project/cli.d.ts +9 -0
- package/dist/src/project/cli.js +306 -0
- package/dist/src/project/cli.js.map +1 -0
- package/dist/src/project/graph.d.ts +4 -0
- package/dist/src/project/graph.js +26 -0
- package/dist/src/project/graph.js.map +1 -0
- package/dist/src/project/identity.d.ts +5 -0
- package/dist/src/project/identity.js +87 -0
- package/dist/src/project/identity.js.map +1 -0
- package/dist/src/project/index.d.ts +19 -0
- package/dist/src/project/index.js +26 -0
- package/dist/src/project/index.js.map +1 -0
- package/dist/src/project/query.d.ts +9 -0
- package/dist/src/project/query.js +136 -0
- package/dist/src/project/query.js.map +1 -0
- package/dist/src/project/store.d.ts +15 -0
- package/dist/src/project/store.js +47 -0
- package/dist/src/project/store.js.map +1 -0
- package/dist/src/project/types.d.ts +106 -0
- package/dist/src/project/types.js +2 -0
- package/dist/src/project/types.js.map +1 -0
- package/dist/src/requester/index.d.ts +16 -0
- package/dist/src/requester/index.js +96 -0
- package/dist/src/requester/index.js.map +1 -0
- package/dist/src/runtime-paths.d.ts +1 -0
- package/dist/src/runtime-paths.js +4 -0
- package/dist/src/runtime-paths.js.map +1 -0
- package/dist/src/sdk.d.ts +9 -0
- package/dist/src/sdk.js +3 -0
- package/dist/src/sdk.js.map +1 -0
- package/dist/src/tools/contracts.d.ts +108 -0
- package/dist/src/tools/contracts.js +2 -0
- package/dist/src/tools/contracts.js.map +1 -0
- package/dist/src/tools/host.d.ts +7 -0
- package/dist/src/tools/host.js +98 -0
- package/dist/src/tools/host.js.map +1 -0
- package/dist/src/tools/paths.d.ts +2 -0
- package/dist/src/tools/paths.js +18 -0
- package/dist/src/tools/paths.js.map +1 -0
- package/dist/src/tools/runner.d.ts +54 -0
- package/dist/src/tools/runner.js +194 -0
- package/dist/src/tools/runner.js.map +1 -0
- package/dist/src/tools/runtime-host.d.ts +1 -0
- package/dist/src/tools/runtime-host.js +116 -0
- package/dist/src/tools/runtime-host.js.map +1 -0
- package/dist/src/tools/schema.d.ts +6 -0
- package/dist/src/tools/schema.js +106 -0
- package/dist/src/tools/schema.js.map +1 -0
- package/dist/src/worker-client.d.ts +27 -0
- package/dist/src/worker-client.js +96 -0
- package/dist/src/worker-client.js.map +1 -0
- package/dist/src/worker.d.ts +1 -0
- package/dist/src/worker.js +50 -0
- package/dist/src/worker.js.map +1 -0
- package/dist/src/workspaces/index.d.ts +33 -0
- package/dist/src/workspaces/index.js +394 -0
- package/dist/src/workspaces/index.js.map +1 -0
- package/package.json +26 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { isArtifactGroup, validateArtifactDefinitions } from '../artifacts/groups.js';
|
|
2
|
+
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
3
|
+
const identifier = /^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/;
|
|
4
|
+
const statuses = new Set(['BLOCKED', 'QUEUED', 'RUNNING', 'WAITING_HUMAN', 'GREEN', 'RED', 'ERROR']);
|
|
5
|
+
/** Validate only the immutable graph metadata; no payloads, providers or workspace reads. */
|
|
6
|
+
export function validateGraphDefinition(value) {
|
|
7
|
+
if (!object(value) || value.version !== 1 || !object(value.artifacts) || !Array.isArray(value.critics) || !value.critics.length || value.critics.length > 32)
|
|
8
|
+
throw new Error('Invalid Artifact graph definition.');
|
|
9
|
+
validateArtifactDefinitions(value.artifacts);
|
|
10
|
+
const artifacts = value.artifacts;
|
|
11
|
+
const seen = new Set();
|
|
12
|
+
const targets = new Set();
|
|
13
|
+
const adjacency = new Map(Object.keys(artifacts).map(id => [id, new Set()]));
|
|
14
|
+
for (const critic of value.critics) {
|
|
15
|
+
if (!object(critic) || typeof critic.id !== 'string' || !identifier.test(critic.id) || seen.has(critic.id) || typeof critic.title !== 'string' || !critic.title.trim() || typeof critic.target !== 'string' || !Object.hasOwn(artifacts, critic.target) || !Array.isArray(critic.deps) || new Set(critic.deps).size !== critic.deps.length || critic.deps.some(dep => typeof dep !== 'string' || !Object.hasOwn(artifacts, dep)) || !['agent', 'human', 'runtime'].includes(String(critic.kind)))
|
|
16
|
+
throw new Error('Critics require unique IDs, one known target, and unique known deps.');
|
|
17
|
+
if (critic.deps.includes(critic.target))
|
|
18
|
+
throw new Error(`Critic ${critic.id} cannot include its target in deps; target access is already provided.`);
|
|
19
|
+
seen.add(critic.id);
|
|
20
|
+
targets.add(critic.target);
|
|
21
|
+
for (const dep of critic.deps)
|
|
22
|
+
adjacency.get(dep).add(critic.target);
|
|
23
|
+
}
|
|
24
|
+
for (const id of targets)
|
|
25
|
+
if (artifacts[id].basis)
|
|
26
|
+
throw new Error(`Basis Artifact ${id} cannot also be a Critic target.`);
|
|
27
|
+
for (const critic of value.critics) {
|
|
28
|
+
for (const dep of critic.deps)
|
|
29
|
+
if (!targets.has(dep) && !artifacts[dep].basis)
|
|
30
|
+
throw new Error(`Dependency Artifact ${dep} has no Critic. Declare basis: true if it is an accepted review basis.`);
|
|
31
|
+
}
|
|
32
|
+
const visiting = new Set(), visited = new Set();
|
|
33
|
+
const visit = (id) => {
|
|
34
|
+
if (visiting.has(id))
|
|
35
|
+
throw new Error(`Artifact dependencies must form a DAG; cycle includes ${id}.`);
|
|
36
|
+
if (visited.has(id))
|
|
37
|
+
return;
|
|
38
|
+
visiting.add(id);
|
|
39
|
+
for (const next of adjacency.get(id))
|
|
40
|
+
visit(next);
|
|
41
|
+
visiting.delete(id);
|
|
42
|
+
visited.add(id);
|
|
43
|
+
};
|
|
44
|
+
for (const id of adjacency.keys())
|
|
45
|
+
visit(id);
|
|
46
|
+
}
|
|
47
|
+
export function createGraphDefinition(config) {
|
|
48
|
+
validateArtifactDefinitions(config.artifacts);
|
|
49
|
+
const graph = {
|
|
50
|
+
version: 1,
|
|
51
|
+
artifacts: Object.fromEntries(Object.entries(config.artifacts).map(([id, artifact]) => [id, { ...(isArtifactGroup(artifact) ? { kind: 'group', members: [...artifact.members] } : { type: artifact.type, path: artifact.path }), ...(artifact.basis === undefined ? {} : { basis: artifact.basis }), ...(artifact.stale ? { stale: structuredClone(artifact.stale) } : {}) }])),
|
|
52
|
+
critics: config.critics.map(critic => ({ id: critic.id, title: critic.title, target: critic.target, deps: [...critic.deps], kind: critic.profile.kind })),
|
|
53
|
+
};
|
|
54
|
+
validateGraphDefinition(graph);
|
|
55
|
+
return graph;
|
|
56
|
+
}
|
|
57
|
+
export function prerequisiteCriticIds(request, graph) {
|
|
58
|
+
return graph.critics.filter(critic => request.deps.includes(critic.target)).map(critic => critic.id);
|
|
59
|
+
}
|
|
60
|
+
/** Call with requests from exactly one Run. Missing evaluations never count as passing. */
|
|
61
|
+
export function projectGraph(graph, requests) {
|
|
62
|
+
validateGraphDefinition(graph);
|
|
63
|
+
const byCritic = new Map();
|
|
64
|
+
for (const request of requests) {
|
|
65
|
+
if (!graph.critics.some(critic => critic.id === request.criticId) || byCritic.has(request.criticId) || !statuses.has(request.status))
|
|
66
|
+
throw new Error('Graph requests must be unique evaluations from one Run.');
|
|
67
|
+
byCritic.set(request.criticId, request);
|
|
68
|
+
}
|
|
69
|
+
const critics = graph.critics.map(critic => {
|
|
70
|
+
const request = byCritic.get(critic.id);
|
|
71
|
+
return { id: critic.id, title: critic.title, target: critic.target, deps: [...critic.deps], kind: critic.kind, requestId: request?.id ?? null, status: request?.status ?? null, claimedBy: request?.claimedBy ?? null, blockedReason: request?.blockedReason ?? null };
|
|
72
|
+
});
|
|
73
|
+
const artifacts = Object.entries(graph.artifacts).map(([id, artifact]) => {
|
|
74
|
+
const own = critics.filter(critic => critic.target === id), included = own.filter(critic => critic.requestId !== null).length;
|
|
75
|
+
const passed = own.filter(critic => critic.status === 'GREEN').length;
|
|
76
|
+
let status = artifact.basis ? 'BASIS' : 'UNREVIEWED';
|
|
77
|
+
if (own.length) {
|
|
78
|
+
if (passed === own.length)
|
|
79
|
+
status = 'GREEN';
|
|
80
|
+
else
|
|
81
|
+
status = ['ERROR', 'RED', 'RUNNING', 'WAITING_HUMAN', 'QUEUED', 'BLOCKED'].find(candidate => own.some(critic => critic.status === candidate)) ?? 'UNREVIEWED';
|
|
82
|
+
}
|
|
83
|
+
return { id, ...(isArtifactGroup(artifact) ? { kind: 'group', members: [...artifact.members] } : { type: artifact.type, path: artifact.path }), basis: artifact.basis === true, status, criticIds: own.map(critic => critic.id), passed, total: own.length, included };
|
|
84
|
+
});
|
|
85
|
+
const edges = new Map();
|
|
86
|
+
for (const critic of critics)
|
|
87
|
+
for (const source of critic.deps) {
|
|
88
|
+
const key = `${source}/${critic.target}`, edge = edges.get(key) ?? { source, target: critic.target, criticIds: [] };
|
|
89
|
+
edge.criticIds.push(critic.id);
|
|
90
|
+
edges.set(key, edge);
|
|
91
|
+
}
|
|
92
|
+
return { artifacts, critics, edges: [...edges.values()] };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,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { type GraphDefinition } from './graph.js';
|
|
2
|
+
import { prepareWorkspace, reopenWorkspace, type WorkspaceDescriptor, type WorkspaceMode } from '../workspaces/index.js';
|
|
3
|
+
import type { ProjectRunDefinition, ProjectSelection } from '../project/types.js';
|
|
4
|
+
import type { RunStatus } from '../contracts.js';
|
|
5
|
+
import type { ReviewRequest, ReviewStatus, ExecutionContext, ExecutorReadiness } from '../contracts.js';
|
|
6
|
+
export interface RunRecord {
|
|
7
|
+
id: string;
|
|
8
|
+
repoId: string;
|
|
9
|
+
snapshotHash: string;
|
|
10
|
+
workspace: WorkspaceDescriptor;
|
|
11
|
+
requesterId: string;
|
|
12
|
+
scope?: {
|
|
13
|
+
kind: 'graph';
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'chain';
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'critic';
|
|
18
|
+
criticId: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: 'project';
|
|
21
|
+
};
|
|
22
|
+
project?: ProjectRunDefinition;
|
|
23
|
+
graph?: GraphDefinition;
|
|
24
|
+
status: RunStatus;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
completedAt?: string;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface BrokerEvent {
|
|
30
|
+
id: number;
|
|
31
|
+
runId: string;
|
|
32
|
+
requestId: string | null;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
type: string;
|
|
35
|
+
message: string;
|
|
36
|
+
data?: unknown;
|
|
37
|
+
}
|
|
38
|
+
export interface RunView extends RunRecord {
|
|
39
|
+
scope: NonNullable<RunRecord['scope']>;
|
|
40
|
+
owner: {
|
|
41
|
+
pid: number;
|
|
42
|
+
claimedAt: string;
|
|
43
|
+
} | null;
|
|
44
|
+
requests: ReviewRequest[];
|
|
45
|
+
events: BrokerEvent[];
|
|
46
|
+
}
|
|
47
|
+
export interface BrokerExecutors {
|
|
48
|
+
validateWorkspace?(repoPath: string): void | Promise<void>;
|
|
49
|
+
canExecute(request: ReviewRequest): ExecutorReadiness | Promise<ExecutorReadiness>;
|
|
50
|
+
execute(request: ReviewRequest, context: ExecutionContext & {
|
|
51
|
+
signal: AbortSignal;
|
|
52
|
+
}): Promise<unknown>;
|
|
53
|
+
notifyHuman?(request: ReviewRequest, context: {
|
|
54
|
+
signal: AbortSignal;
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
}
|
|
57
|
+
export interface BrokerOptions {
|
|
58
|
+
repoPath: string;
|
|
59
|
+
stateDir: string;
|
|
60
|
+
repoId?: string;
|
|
61
|
+
executors?: BrokerExecutors;
|
|
62
|
+
workspaceAdapter?: {
|
|
63
|
+
prepareWorkspace: typeof prepareWorkspace;
|
|
64
|
+
reopenWorkspace: typeof reopenWorkspace;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Read an existing store's repository identity without creating state or needing its source. */
|
|
68
|
+
export declare function readStateContext(stateDir: string): {
|
|
69
|
+
repoPath: string;
|
|
70
|
+
repoId: string;
|
|
71
|
+
stateDir: string;
|
|
72
|
+
};
|
|
73
|
+
/** Durable broker operations. Merely opening the store never starts a worker. */
|
|
74
|
+
export declare function createBroker({ repoPath, stateDir, repoId, executors, workspaceAdapter }: BrokerOptions): {
|
|
75
|
+
submitProject({ mode, requesterId, selection, recursive, force }: {
|
|
76
|
+
mode?: WorkspaceMode;
|
|
77
|
+
requesterId?: string;
|
|
78
|
+
selection: ProjectSelection;
|
|
79
|
+
recursive?: boolean;
|
|
80
|
+
force?: boolean;
|
|
81
|
+
}): Promise<RunView>;
|
|
82
|
+
submit({ mode, requesterId, reviewRequests, criticId, snapshotCommit }?: {
|
|
83
|
+
mode?: WorkspaceMode;
|
|
84
|
+
requesterId?: unknown;
|
|
85
|
+
reviewRequests?: unknown;
|
|
86
|
+
criticId?: unknown;
|
|
87
|
+
snapshotCommit?: unknown;
|
|
88
|
+
}): Promise<RunView>;
|
|
89
|
+
run: (runId: string, { signal, onStarted }?: {
|
|
90
|
+
signal?: AbortSignal;
|
|
91
|
+
onStarted?: (value: {
|
|
92
|
+
runId: string;
|
|
93
|
+
pid: number;
|
|
94
|
+
}) => void;
|
|
95
|
+
}) => Promise<(RunRecord & {
|
|
96
|
+
requests: ReviewRequest[];
|
|
97
|
+
}) | null>;
|
|
98
|
+
reconcile: (runId?: string) => void;
|
|
99
|
+
listRuns(): {
|
|
100
|
+
id: string;
|
|
101
|
+
repoId: string;
|
|
102
|
+
snapshotHash: string;
|
|
103
|
+
workspace: WorkspaceDescriptor;
|
|
104
|
+
requesterId: string;
|
|
105
|
+
project?: ProjectRunDefinition;
|
|
106
|
+
graph?: GraphDefinition;
|
|
107
|
+
status: RunStatus;
|
|
108
|
+
createdAt: string;
|
|
109
|
+
completedAt?: string;
|
|
110
|
+
error?: string;
|
|
111
|
+
scope: NonNullable<RunRecord['scope']>;
|
|
112
|
+
owner: {
|
|
113
|
+
pid: number;
|
|
114
|
+
claimedAt: string;
|
|
115
|
+
} | null;
|
|
116
|
+
events: undefined;
|
|
117
|
+
requests: {
|
|
118
|
+
repoId: string;
|
|
119
|
+
snapshotHash: string;
|
|
120
|
+
criticId: string;
|
|
121
|
+
title: string;
|
|
122
|
+
artifacts: import("../contracts.js").ArtifactReference[];
|
|
123
|
+
artifactGroups?: import("../definitions.js").ArtifactGroupReference[];
|
|
124
|
+
artifactTypes: Record<string, import("../contracts.js").ArtifactTypeDefinition>;
|
|
125
|
+
configManifest?: import("../sdk.js").ConfigManifest;
|
|
126
|
+
payload: import("../definitions.js").ReviewPayload;
|
|
127
|
+
profile: import("../definitions.js").CriticProfile;
|
|
128
|
+
target: string;
|
|
129
|
+
deps: string[];
|
|
130
|
+
validationInput?: import("../project/types.js").ValidationInput;
|
|
131
|
+
id: string;
|
|
132
|
+
runId: string;
|
|
133
|
+
workspace: WorkspaceDescriptor;
|
|
134
|
+
worktreePath: string;
|
|
135
|
+
predecessorId?: string | null;
|
|
136
|
+
status: ReviewStatus;
|
|
137
|
+
createdAt: string;
|
|
138
|
+
startedAt?: string | null;
|
|
139
|
+
completedAt?: string | null;
|
|
140
|
+
claimedBy?: string | null;
|
|
141
|
+
claimedAt?: string | null;
|
|
142
|
+
notifiedAt?: string | null;
|
|
143
|
+
errorCode?: string | null;
|
|
144
|
+
blockedReason?: string | null;
|
|
145
|
+
error?: string | null;
|
|
146
|
+
result: {
|
|
147
|
+
verdict: "GREEN" | "RED";
|
|
148
|
+
summary: string;
|
|
149
|
+
} | null;
|
|
150
|
+
}[];
|
|
151
|
+
}[];
|
|
152
|
+
getRun: (id: string) => RunView | null;
|
|
153
|
+
getRequest(id: string): ReviewRequest | null;
|
|
154
|
+
claimHuman(requestId: string, reviewerId: unknown): ReviewRequest | null;
|
|
155
|
+
executeHumanTool(requestId: string, { reviewerId, toolName, arguments: args, signal }: {
|
|
156
|
+
reviewerId: unknown;
|
|
157
|
+
toolName: string;
|
|
158
|
+
arguments?: unknown;
|
|
159
|
+
signal?: AbortSignal;
|
|
160
|
+
}): Promise<any>;
|
|
161
|
+
completeHuman(requestId: string, { reviewerId, result }: {
|
|
162
|
+
reviewerId: unknown;
|
|
163
|
+
result: unknown;
|
|
164
|
+
}): Promise<ReviewRequest | null>;
|
|
165
|
+
failRun(runId: string, error: unknown): RunView | null;
|
|
166
|
+
cancel(runId: string): RunView | null;
|
|
167
|
+
onChange(callback: () => void): () => boolean;
|
|
168
|
+
close(): Promise<void>;
|
|
169
|
+
};
|
|
170
|
+
export type Broker = ReturnType<typeof createBroker>;
|