@abelxiaoxing/cadence 1.0.13 → 1.1.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/README.md +29 -13
- package/agents/contract-reviewer.md +2 -2
- package/agents/design-explorer.md +1 -1
- package/agents/diagnosis-worker.md +6 -3
- package/agents/implementation-worker.md +14 -9
- package/config/.env.example +5 -17
- package/config/routes.example.json +42 -0
- package/package.json +3 -3
- package/prompts/abel-design.md +150 -228
- package/prompts/abel-diagnose.md +37 -18
- package/prompts/abel-implement.md +111 -178
- package/prompts/abel-init.md +36 -33
- package/skills/abel-workflow/SKILL.md +156 -168
- package/src/apply-transaction.ts +1427 -0
- package/src/artifact-store.ts +204 -0
- package/src/child-session.ts +136 -17
- package/src/contracts.ts +105 -696
- package/src/control-contracts.ts +259 -0
- package/src/delivery-compiler.ts +1088 -0
- package/src/file-snapshot.ts +5 -0
- package/src/implement-graph.ts +11 -4
- package/src/index.ts +1465 -133
- package/src/isolation-backend.ts +269 -0
- package/src/packet-runtime.ts +533 -0
- package/src/parent-provider.ts +23 -4
- package/src/route-policy.ts +483 -0
- package/src/run-state.ts +393 -0
- package/src/run-store.ts +918 -0
- package/src/safe-path.ts +11 -0
- package/src/scoped-tools.ts +36 -0
- package/src/state-root.ts +215 -0
- package/src/subagent-activity.ts +526 -27
- package/src/submit-tool.ts +274 -0
- package/src/task-ledger.ts +1380 -0
- package/src/verification-capability.ts +529 -42
- package/src/worker-broker.ts +703 -0
- package/src/workflow-engine.ts +7391 -0
- package/src/workspace-store.ts +544 -0
- package/src/candidate-preflight.ts +0 -1618
- package/src/drain.ts +0 -20
- package/src/patch.ts +0 -505
- package/src/result-store.ts +0 -312
- package/src/runtime.ts +0 -2436
- package/src/scheduler.ts +0 -384
- package/src/subagent-endpoint.ts +0 -158
- package/src/worker.ts +0 -204
package/src/worker.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
// Process-local task registry for the private Implement runtime.
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
CandidateFailure,
|
|
5
|
-
ImplementationPhase,
|
|
6
|
-
ImplementGraphBoundary,
|
|
7
|
-
PhaseAttempt,
|
|
8
|
-
TaskBoundary,
|
|
9
|
-
TaskFailure,
|
|
10
|
-
} from "./contracts.ts";
|
|
11
|
-
import type { ConflictDeclaration } from "./scheduler.ts";
|
|
12
|
-
import type { SubagentEndpoint } from "./subagent-endpoint.ts";
|
|
13
|
-
|
|
14
|
-
export type TaskState =
|
|
15
|
-
| {
|
|
16
|
-
kind: "ready";
|
|
17
|
-
phase: ImplementationPhase;
|
|
18
|
-
launchIndex: 0 | 1;
|
|
19
|
-
correction?: CandidateFailure;
|
|
20
|
-
}
|
|
21
|
-
| {
|
|
22
|
-
kind: "candidate-pending";
|
|
23
|
-
phase: ImplementationPhase;
|
|
24
|
-
launchIndex: 0 | 1;
|
|
25
|
-
originRequestId: string;
|
|
26
|
-
resultId: string;
|
|
27
|
-
}
|
|
28
|
-
| {
|
|
29
|
-
kind: "agents-checkpoint-pending";
|
|
30
|
-
finalPhase: "green" | "refactor";
|
|
31
|
-
attemptIndex: 0 | 1;
|
|
32
|
-
}
|
|
33
|
-
| { kind: "blocked"; phase: ImplementationPhase; failure: TaskFailure }
|
|
34
|
-
| { kind: "completed"; finalPhase: "green" | "refactor" };
|
|
35
|
-
|
|
36
|
-
export interface TaskRecord {
|
|
37
|
-
key: string;
|
|
38
|
-
workspaceRoot: string;
|
|
39
|
-
workerIdentity: string;
|
|
40
|
-
subagentEndpoint: Readonly<SubagentEndpoint> | null;
|
|
41
|
-
boundary: TaskBoundary;
|
|
42
|
-
conflict: ConflictDeclaration;
|
|
43
|
-
state: TaskState;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface ImplementGraphRecord {
|
|
47
|
-
key: string;
|
|
48
|
-
workspaceRoot: string;
|
|
49
|
-
graphHash: string;
|
|
50
|
-
boundary: ImplementGraphBoundary;
|
|
51
|
-
completedTasks: Set<string>;
|
|
52
|
-
blockedTasks: Set<string>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function graphRecordKey(
|
|
56
|
-
workspaceRoot: string,
|
|
57
|
-
changeId: string,
|
|
58
|
-
): string {
|
|
59
|
-
return `${workspaceRoot}\0${changeId}`;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export function taskRecordKey(
|
|
63
|
-
workspaceRoot: string,
|
|
64
|
-
changeId: string,
|
|
65
|
-
taskId: string,
|
|
66
|
-
): string {
|
|
67
|
-
return `${workspaceRoot}\0${changeId}\0${taskId}`;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export function taskConflictOf(boundary: TaskBoundary): ConflictDeclaration {
|
|
71
|
-
const phases = [
|
|
72
|
-
boundary.phases.red,
|
|
73
|
-
boundary.phases.green,
|
|
74
|
-
...(boundary.phases.refactor ? [boundary.phases.refactor] : []),
|
|
75
|
-
];
|
|
76
|
-
const write = new Set(phases.flatMap((phase) => phase.write));
|
|
77
|
-
if (boundary.agents.impact !== "none" && boundary.agents.target) {
|
|
78
|
-
write.add(boundary.agents.target);
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
taskId: boundary.taskId,
|
|
82
|
-
read: [...new Set(phases.flatMap((phase) => phase.read))],
|
|
83
|
-
write: [...write],
|
|
84
|
-
conflicts: [...boundary.scheduling.conflicts],
|
|
85
|
-
resources: [...boundary.scheduling.resources],
|
|
86
|
-
verificationLocks: [
|
|
87
|
-
...new Set(
|
|
88
|
-
phases.flatMap((phase) =>
|
|
89
|
-
phase.verificationLock ? [phase.verificationLock] : [],
|
|
90
|
-
),
|
|
91
|
-
),
|
|
92
|
-
],
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
// Stable provider/model/API identity fingerprint. Fresh auth may be acquired
|
|
97
|
-
// for each phase, while the selected execution identity remains pinned.
|
|
98
|
-
export function workerIdentity(model: {
|
|
99
|
-
provider?: unknown;
|
|
100
|
-
api?: unknown;
|
|
101
|
-
baseUrl?: unknown;
|
|
102
|
-
id?: unknown;
|
|
103
|
-
name?: unknown;
|
|
104
|
-
}): string {
|
|
105
|
-
const parts: string[] = [
|
|
106
|
-
`p:${String(model.provider ?? "")}`,
|
|
107
|
-
`a:${String(model.api ?? "")}`,
|
|
108
|
-
];
|
|
109
|
-
if (model.baseUrl !== undefined) parts.push(`u:${String(model.baseUrl)}`);
|
|
110
|
-
if (typeof model.id === "string") parts.push(`id:${model.id}`);
|
|
111
|
-
if (typeof model.name === "string") parts.push(`n:${model.name}`);
|
|
112
|
-
return parts.join("|");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export class WorkerRegistry {
|
|
116
|
-
private readonly tasks = new Map<string, TaskRecord>();
|
|
117
|
-
private readonly graphs = new Map<string, ImplementGraphRecord>();
|
|
118
|
-
|
|
119
|
-
admitGraph(
|
|
120
|
-
boundary: ImplementGraphBoundary,
|
|
121
|
-
graphHash: string,
|
|
122
|
-
workspaceRoot: string,
|
|
123
|
-
state: {
|
|
124
|
-
completedTasks: readonly string[];
|
|
125
|
-
blockedTasks: readonly string[];
|
|
126
|
-
},
|
|
127
|
-
): ImplementGraphRecord {
|
|
128
|
-
const key = graphRecordKey(workspaceRoot, boundary.changeId);
|
|
129
|
-
if (this.graphs.has(key)) throw new Error("duplicate graph admission");
|
|
130
|
-
const record: ImplementGraphRecord = {
|
|
131
|
-
key,
|
|
132
|
-
workspaceRoot,
|
|
133
|
-
graphHash,
|
|
134
|
-
boundary: structuredClone(boundary),
|
|
135
|
-
completedTasks: new Set(state.completedTasks),
|
|
136
|
-
blockedTasks: new Set(state.blockedTasks),
|
|
137
|
-
};
|
|
138
|
-
this.graphs.set(key, record);
|
|
139
|
-
return record;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
getGraph(
|
|
143
|
-
workspaceRoot: string,
|
|
144
|
-
changeId: string,
|
|
145
|
-
): ImplementGraphRecord | undefined {
|
|
146
|
-
return this.graphs.get(graphRecordKey(workspaceRoot, changeId));
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
has(key: string): boolean {
|
|
150
|
-
return this.tasks.has(key);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
get(key: string): TaskRecord | undefined {
|
|
154
|
-
return this.tasks.get(key);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
find(workspaceRoot: string, taskId: string): TaskRecord | undefined {
|
|
158
|
-
const matches = [...this.tasks.values()].filter(
|
|
159
|
-
(record) =>
|
|
160
|
-
record.workspaceRoot === workspaceRoot &&
|
|
161
|
-
record.boundary.taskId === taskId,
|
|
162
|
-
);
|
|
163
|
-
return matches.length === 1 ? matches[0] : undefined;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
open(
|
|
167
|
-
boundary: TaskBoundary,
|
|
168
|
-
identity: string,
|
|
169
|
-
workspaceRoot: string,
|
|
170
|
-
attempt: PhaseAttempt,
|
|
171
|
-
subagentEndpoint: Readonly<SubagentEndpoint> | null = null,
|
|
172
|
-
): TaskRecord {
|
|
173
|
-
const key = taskRecordKey(
|
|
174
|
-
workspaceRoot,
|
|
175
|
-
boundary.changeId,
|
|
176
|
-
boundary.taskId,
|
|
177
|
-
);
|
|
178
|
-
if (this.tasks.has(key)) throw new Error("duplicate task open");
|
|
179
|
-
const storedBoundary = structuredClone(boundary);
|
|
180
|
-
const record: TaskRecord = {
|
|
181
|
-
key,
|
|
182
|
-
workspaceRoot,
|
|
183
|
-
workerIdentity: identity,
|
|
184
|
-
subagentEndpoint:
|
|
185
|
-
subagentEndpoint === null
|
|
186
|
-
? null
|
|
187
|
-
: Object.freeze({ ...subagentEndpoint }),
|
|
188
|
-
boundary: storedBoundary,
|
|
189
|
-
conflict: taskConflictOf(storedBoundary),
|
|
190
|
-
state: { kind: "ready", phase: attempt.phase, launchIndex: 0 },
|
|
191
|
-
};
|
|
192
|
-
this.tasks.set(key, record);
|
|
193
|
-
return record;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
values(): TaskRecord[] {
|
|
197
|
-
return [...this.tasks.values()];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
clear(): void {
|
|
201
|
-
this.tasks.clear();
|
|
202
|
-
this.graphs.clear();
|
|
203
|
-
}
|
|
204
|
-
}
|