@abelxiaoxing/cadence 1.8.3 → 2.0.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 +324 -111
- package/THIRD_PARTY_NOTICES.md +15 -0
- package/agents/design-explorer.md +14 -26
- package/agents/diagnosis-worker.md +14 -25
- package/agents/implementation-worker.md +16 -35
- package/config/.env.example +2 -5
- package/config/workflow-task.example.json +7 -0
- package/docs/remote-access.md +60 -0
- package/docs/reuse-and-distribution.md +44 -0
- package/docs/service-management.md +108 -0
- package/licenses/bundled-web.txt +6245 -0
- package/licenses/pi-web-ui-MIT.txt +21 -0
- package/licenses/pi-web-ui-reuse.md +22 -0
- package/package.json +94 -21
- package/src/index.ts +22 -1807
- package/src/native-build.ts +6 -0
- package/src/native-client.ts +103 -0
- package/src/native-export.ts +58 -0
- package/src/native-history.ts +359 -0
- package/src/operator-cli.mjs +453 -1937
- package/src/plan-proposal.ts +87 -0
- package/src/sdk-worker.mjs +549 -0
- package/src/service/contracts/active.ts +82 -0
- package/src/service/contracts/budget.ts +148 -0
- package/src/service/contracts/build.ts +67 -0
- package/src/service/contracts/capture.ts +48 -0
- package/src/service/contracts/core.ts +33 -0
- package/src/service/contracts/current.ts +261 -0
- package/src/service/contracts/domain.ts +68 -0
- package/src/service/contracts/history.ts +2245 -0
- package/src/service/contracts/models.ts +139 -0
- package/src/service/coordination.ts +862 -0
- package/src/service/private-files.ts +204 -0
- package/src/service-cli.mjs +5592 -0
- package/src/service-client.ts +747 -0
- package/src/service-contract.ts +245 -0
- package/src/service-host.mjs +22382 -0
- package/src/service-http-client.ts +425 -0
- package/src/service-wire.ts +372 -0
- package/src/task-shell.ts +1045 -0
- package/src/task-store.ts +479 -0
- package/src/task-types.ts +184 -0
- package/src/verification-diagnostics.ts +29 -72
- package/src/worker-capture.mjs +1197 -0
- package/src/worker-public.mjs +1753 -0
- package/src/worker-redaction.mjs +608 -0
- package/src/worker-tools.mjs +202 -0
- package/web/dist/assets/KaTeX_AMS-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_AMS-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.woff +0 -0
- package/web/dist/assets/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Main-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.woff +0 -0
- package/web/dist/assets/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_Math-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Script-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size1-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size2-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size3-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Size4-Regular.woff2 +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.ttf +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.woff +0 -0
- package/web/dist/assets/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/web/dist/assets/cadence.css +2 -0
- package/web/dist/assets/cadence.js +7 -0
- package/web/dist/assets/markdown.js +296 -0
- package/web/dist/assets/react.js +9 -0
- package/web/dist/assets/rolldown-runtime.js +1 -0
- package/web/dist/assets/timeline-client.js +41 -0
- package/web/dist/assets/vis-timeline.css +1274 -0
- package/web/dist/assets/vis-timeline.js +32 -0
- package/web/dist/index.html +18 -0
- package/web/dist/manifest.json +505 -0
- package/config/plan-draft.example.json +0 -125
- package/config/plan-draft.multiple-tasks.example.json +0 -375
- package/config/plan-draft.quick.example.json +0 -78
- package/config/routes.example.json +0 -39
- package/prompts/abel-design.md +0 -382
- package/prompts/abel-diagnose.md +0 -71
- package/prompts/abel-implement.md +0 -284
- package/prompts/abel-init.md +0 -52
- package/src/activation.ts +0 -44
- package/src/activity-contracts.ts +0 -82
- package/src/agent-registry.ts +0 -53
- package/src/apply-transaction.ts +0 -1437
- package/src/artifact-store.ts +0 -213
- package/src/build-windows-job.mjs +0 -95
- package/src/candidate-artifact.ts +0 -143
- package/src/candidate-patch.ts +0 -271
- package/src/candidate-workspace.ts +0 -80
- package/src/canonical.ts +0 -16
- package/src/change-contract-schema.ts +0 -191
- package/src/change-contract.ts +0 -324
- package/src/change-verification.ts +0 -1617
- package/src/child-budget.ts +0 -58
- package/src/child-model.ts +0 -142
- package/src/child-session.ts +0 -640
- package/src/contracts.ts +0 -2476
- package/src/control-contracts.ts +0 -382
- package/src/delivery-compiler.ts +0 -1805
- package/src/delivery-revision.ts +0 -42
- package/src/design-control.ts +0 -1299
- package/src/design-diagnostics.ts +0 -181
- package/src/design-journal.ts +0 -1773
- package/src/directory-sync.ts +0 -36
- package/src/durable-contracts.ts +0 -231
- package/src/durable-workflow.ts +0 -978
- package/src/evidence-draft.ts +0 -122
- package/src/execution-profile.ts +0 -64
- package/src/execution-retention.ts +0 -77
- package/src/file-snapshot.ts +0 -163
- package/src/implement-continuation.ts +0 -559
- package/src/implement-graph.ts +0 -690
- package/src/implement-plan.ts +0 -72
- package/src/install-config.d.mts +0 -6
- package/src/isolation-backend.ts +0 -353
- package/src/model-source.ts +0 -22
- package/src/openspec-cli.ts +0 -494
- package/src/operator-cli-entry.mjs +0 -24
- package/src/operator-tools.ts +0 -309
- package/src/package-candidate.ts +0 -227
- package/src/package-delivery.ts +0 -486
- package/src/package-state.ts +0 -320
- package/src/package-verification.ts +0 -635
- package/src/package-workflow.ts +0 -342
- package/src/packet-runtime.ts +0 -570
- package/src/parent-provider.ts +0 -375
- package/src/phase-execution.ts +0 -2259
- package/src/pi-adapter.ts +0 -19
- package/src/plan-draft-summary.ts +0 -527
- package/src/plan-draft.ts +0 -502
- package/src/remove-path.ts +0 -32
- package/src/route-policy.ts +0 -545
- package/src/run-state.ts +0 -420
- package/src/run-store.ts +0 -1179
- package/src/safe-path.ts +0 -77
- package/src/scoped-grep-worker.mjs +0 -23
- package/src/scoped-tools.ts +0 -775
- package/src/single-task-draft.ts +0 -142
- package/src/sqlite-schema.ts +0 -171
- package/src/state-root.ts +0 -215
- package/src/storage-schema.ts +0 -360
- package/src/subagent-activity.ts +0 -1417
- package/src/submit-tool.ts +0 -950
- package/src/task-ledger.ts +0 -1338
- package/src/transport-budget.ts +0 -52
- package/src/verification-capability.ts +0 -1191
- package/src/verification-environment-io.ts +0 -389
- package/src/verification-environment.ts +0 -162
- package/src/verification-identity.ts +0 -77
- package/src/verification-scan.ts +0 -64
- package/src/windows-job-backend.ts +0 -419
- package/src/windows-job.c +0 -149
- package/src/worker-broker.ts +0 -806
- package/src/workflow-engine.ts +0 -28
- package/src/workflow-policy.ts +0 -1679
- package/src/workflow-recovery-policy.ts +0 -97
- package/src/workflow-scheduling.ts +0 -105
- package/src/workflow-state-machine.ts +0 -4355
- package/src/workflow-status.ts +0 -576
- package/src/workspace-io-entry.mjs +0 -76
- package/src/workspace-io-worker.mjs +0 -1312
- package/src/workspace-io.ts +0 -89
- package/src/workspace-store.ts +0 -634
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import type { ImplementPlan } from "./implement-plan.ts";
|
|
2
|
-
|
|
3
|
-
export type RecoveryActionRequest = {
|
|
4
|
-
kind: "affected-repair" | "cumulative-repair" | "red-correction";
|
|
5
|
-
attempt: number;
|
|
6
|
-
};
|
|
7
|
-
export type RecoveryActionDecision =
|
|
8
|
-
| { allowed: true }
|
|
9
|
-
| {
|
|
10
|
-
allowed: false;
|
|
11
|
-
code: "repair-attempts-exhausted" | "artifact-attempts-exhausted";
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** One policy for every nested recovery action; execution services supply facts only. */
|
|
15
|
-
export function decideRecoveryAction(
|
|
16
|
-
plan: ImplementPlan,
|
|
17
|
-
request: RecoveryActionRequest,
|
|
18
|
-
authority: { additionalAttempt?: boolean; verificationOnly?: boolean } = {},
|
|
19
|
-
): RecoveryActionDecision {
|
|
20
|
-
const correction = request.kind === "red-correction";
|
|
21
|
-
const limit =
|
|
22
|
-
authority.additionalAttempt || authority.verificationOnly
|
|
23
|
-
? 1
|
|
24
|
-
: correction
|
|
25
|
-
? plan.verification.artifactCorrection.maxAttempts
|
|
26
|
-
: plan.verification.repair.maxAttempts;
|
|
27
|
-
return Number.isSafeInteger(request.attempt) &&
|
|
28
|
-
request.attempt > 0 &&
|
|
29
|
-
request.attempt <= limit
|
|
30
|
-
? { allowed: true }
|
|
31
|
-
: {
|
|
32
|
-
allowed: false,
|
|
33
|
-
code: correction
|
|
34
|
-
? "artifact-attempts-exhausted"
|
|
35
|
-
: "repair-attempts-exhausted",
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface WorkflowRecoveryFeedback {
|
|
40
|
-
code: string;
|
|
41
|
-
attempt: number;
|
|
42
|
-
maxAttempts: number;
|
|
43
|
-
strategy:
|
|
44
|
-
| "revise-candidate"
|
|
45
|
-
| "refresh-candidate"
|
|
46
|
-
| "repair-verification"
|
|
47
|
-
| "compact-patch";
|
|
48
|
-
failureIdentities?: string[];
|
|
49
|
-
/** Last observed baseline condition; execution/display renaming cannot refund failures. */
|
|
50
|
-
prerequisiteIdentity?: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface WorkflowRecoveryFact {
|
|
54
|
-
key: string;
|
|
55
|
-
failures: number;
|
|
56
|
-
feedback: WorkflowRecoveryFeedback;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function recoveryExhausted(
|
|
60
|
-
incident: WorkflowRecoveryFact | undefined,
|
|
61
|
-
maximum: number,
|
|
62
|
-
granted: boolean,
|
|
63
|
-
): boolean {
|
|
64
|
-
return !granted && incident !== undefined && incident.failures >= maximum;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** A grant is a recommendation until the state machine validates and records it in its lease transaction. */
|
|
68
|
-
export function assessRecoveryGrant(input: {
|
|
69
|
-
current: boolean;
|
|
70
|
-
incident?: WorkflowRecoveryFact;
|
|
71
|
-
failureSequence: number;
|
|
72
|
-
requestedSequence: number;
|
|
73
|
-
reason: string;
|
|
74
|
-
previous: { route?: string | null; context?: string | null };
|
|
75
|
-
observed: { route?: string | null; context?: string | null };
|
|
76
|
-
budget?: { used: number; max_work: number };
|
|
77
|
-
}): string | undefined {
|
|
78
|
-
if (
|
|
79
|
-
!input.current ||
|
|
80
|
-
!input.incident ||
|
|
81
|
-
input.incident.failures < input.incident.feedback.maxAttempts ||
|
|
82
|
-
input.failureSequence !== input.requestedSequence
|
|
83
|
-
)
|
|
84
|
-
return "recovery-request-stale";
|
|
85
|
-
if (
|
|
86
|
-
(input.reason === "route-changed" &&
|
|
87
|
-
(!input.previous.route ||
|
|
88
|
-
input.previous.route === input.observed.route)) ||
|
|
89
|
-
(input.reason === "context-extended" &&
|
|
90
|
-
(!input.previous.context ||
|
|
91
|
-
input.previous.context === input.observed.context))
|
|
92
|
-
)
|
|
93
|
-
return "recovery-evidence-unavailable";
|
|
94
|
-
if (!input.budget || input.budget.used >= input.budget.max_work)
|
|
95
|
-
return "change-work-budget-exhausted";
|
|
96
|
-
return undefined;
|
|
97
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import type { PlanTaskDraft } from "./implement-plan.ts";
|
|
2
|
-
import { type EngineTaskRow, taskConflicts } from "./workflow-policy.ts";
|
|
3
|
-
|
|
4
|
-
function taskPlan(row: EngineTaskRow): PlanTaskDraft {
|
|
5
|
-
return JSON.parse(row.plan_json) as PlanTaskDraft;
|
|
6
|
-
}
|
|
7
|
-
export function hasTaskConflict(
|
|
8
|
-
row: EngineTaskRow,
|
|
9
|
-
rows: EngineTaskRow[],
|
|
10
|
-
selectedTaskIds: ReadonlySet<string>,
|
|
11
|
-
): boolean {
|
|
12
|
-
const candidate = taskPlan(row);
|
|
13
|
-
return rows.some((other) => {
|
|
14
|
-
if (other.task_id === row.task_id || other.state === "verified") {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
if (other.state === "queued") {
|
|
18
|
-
if (row.state !== "queued") return false;
|
|
19
|
-
const candidatePosition = row.queue_position ?? Number.MAX_SAFE_INTEGER;
|
|
20
|
-
const otherPosition = other.queue_position ?? Number.MAX_SAFE_INTEGER;
|
|
21
|
-
if (
|
|
22
|
-
otherPosition > candidatePosition ||
|
|
23
|
-
(otherPosition === candidatePosition &&
|
|
24
|
-
other.task_order > row.task_order)
|
|
25
|
-
) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (other.task_order > row.task_order && other.state === "pending") {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
if (other.state === "pending" && !dependenciesVerified(other, rows)) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
const conflict = taskConflicts(candidate, taskPlan(other));
|
|
36
|
-
return (
|
|
37
|
-
conflict.taskLifetime ||
|
|
38
|
-
(conflict.verification &&
|
|
39
|
-
([
|
|
40
|
-
"pending",
|
|
41
|
-
"phase-ready",
|
|
42
|
-
"phase-running",
|
|
43
|
-
"validating",
|
|
44
|
-
"queued",
|
|
45
|
-
].includes(other.state) ||
|
|
46
|
-
selectedTaskIds.has(other.task_id)))
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function dependenciesVerified(
|
|
52
|
-
row: EngineTaskRow,
|
|
53
|
-
rows: EngineTaskRow[],
|
|
54
|
-
): boolean {
|
|
55
|
-
const byId = new Map(rows.map((candidate) => [candidate.task_id, candidate]));
|
|
56
|
-
return taskPlan(row).dependsOn.every(
|
|
57
|
-
(dependency) => byId.get(dependency)?.state === "verified",
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/** Simulate ordered queue decisions without storage access or launch authority. */
|
|
62
|
-
export function selectRunnableTasks(input: {
|
|
63
|
-
rows: readonly EngineTaskRow[];
|
|
64
|
-
attempted: ReadonlySet<string>;
|
|
65
|
-
activeTasks: number;
|
|
66
|
-
capacity: number;
|
|
67
|
-
nextQueuePosition: number;
|
|
68
|
-
}) {
|
|
69
|
-
const rows = input.rows.map((row) => ({ ...row }));
|
|
70
|
-
const runnable: string[] = [];
|
|
71
|
-
const selected = new Set<string>();
|
|
72
|
-
const updates: Array<
|
|
73
|
-
| { kind: "pending"; taskId: string }
|
|
74
|
-
| { kind: "queue"; taskId: string; reason: "conflict" | "capacity" }
|
|
75
|
-
> = [];
|
|
76
|
-
let position = input.nextQueuePosition;
|
|
77
|
-
let capacityBlocked = false;
|
|
78
|
-
for (const row of rows) {
|
|
79
|
-
if (row.state === "verified" || input.attempted.has(row.task_id)) continue;
|
|
80
|
-
if (!dependenciesVerified(row, rows)) {
|
|
81
|
-
if (row.state !== "pending") {
|
|
82
|
-
updates.push({ kind: "pending", taskId: row.task_id });
|
|
83
|
-
row.state = "pending";
|
|
84
|
-
row.pause_code = null;
|
|
85
|
-
row.queue_position = null;
|
|
86
|
-
}
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
const conflict = hasTaskConflict(row, rows, selected);
|
|
90
|
-
const capacity = input.activeTasks + runnable.length >= input.capacity;
|
|
91
|
-
if (conflict || capacity) {
|
|
92
|
-
const reason = conflict ? "conflict" : "capacity";
|
|
93
|
-
updates.push({ kind: "queue", taskId: row.task_id, reason });
|
|
94
|
-
if (row.state !== "queued" || row.queue_position === null)
|
|
95
|
-
row.queue_position = position++;
|
|
96
|
-
row.state = "queued";
|
|
97
|
-
row.pause_code = reason === "capacity" ? "worker-capacity" : null;
|
|
98
|
-
if (!conflict) capacityBlocked = true;
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
runnable.push(row.task_id);
|
|
102
|
-
selected.add(row.task_id);
|
|
103
|
-
}
|
|
104
|
-
return { runnable, updates, capacityBlocked };
|
|
105
|
-
}
|