@abelxiaoxing/cadence 1.8.4 → 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.
Files changed (202) hide show
  1. package/README.md +324 -117
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/agents/design-explorer.md +14 -18
  4. package/agents/diagnosis-worker.md +14 -14
  5. package/agents/implementation-worker.md +16 -17
  6. package/config/workflow-task.example.json +7 -0
  7. package/docs/remote-access.md +60 -0
  8. package/docs/reuse-and-distribution.md +44 -0
  9. package/docs/service-management.md +108 -0
  10. package/licenses/bundled-web.txt +6245 -0
  11. package/licenses/pi-web-ui-MIT.txt +21 -0
  12. package/licenses/pi-web-ui-reuse.md +22 -0
  13. package/package.json +92 -20
  14. package/src/index.ts +21 -1802
  15. package/src/native-build.ts +6 -0
  16. package/src/native-client.ts +103 -0
  17. package/src/native-export.ts +58 -0
  18. package/src/native-history.ts +359 -0
  19. package/src/operator-cli.mjs +453 -1937
  20. package/src/plan-proposal.ts +87 -0
  21. package/src/sdk-worker.mjs +549 -0
  22. package/src/service/contracts/active.ts +82 -0
  23. package/src/service/contracts/budget.ts +148 -0
  24. package/src/service/contracts/build.ts +67 -0
  25. package/src/service/contracts/capture.ts +48 -0
  26. package/src/service/contracts/core.ts +33 -0
  27. package/src/service/contracts/current.ts +261 -0
  28. package/src/service/contracts/domain.ts +68 -0
  29. package/src/service/contracts/history.ts +2245 -0
  30. package/src/service/contracts/models.ts +139 -0
  31. package/src/service/coordination.ts +862 -0
  32. package/src/service/private-files.ts +204 -0
  33. package/src/service-cli.mjs +5592 -0
  34. package/src/service-client.ts +747 -0
  35. package/src/service-contract.ts +245 -0
  36. package/src/service-host.mjs +22382 -0
  37. package/src/service-http-client.ts +425 -0
  38. package/src/service-wire.ts +372 -0
  39. package/src/task-shell.ts +1045 -0
  40. package/src/task-store.ts +479 -0
  41. package/src/task-types.ts +184 -0
  42. package/src/verification-diagnostics.ts +29 -72
  43. package/src/worker-capture.mjs +1197 -0
  44. package/src/worker-public.mjs +1753 -0
  45. package/src/worker-redaction.mjs +608 -0
  46. package/src/worker-tools.mjs +202 -0
  47. package/web/dist/assets/KaTeX_AMS-Regular.ttf +0 -0
  48. package/web/dist/assets/KaTeX_AMS-Regular.woff +0 -0
  49. package/web/dist/assets/KaTeX_AMS-Regular.woff2 +0 -0
  50. package/web/dist/assets/KaTeX_Caligraphic-Bold.ttf +0 -0
  51. package/web/dist/assets/KaTeX_Caligraphic-Bold.woff +0 -0
  52. package/web/dist/assets/KaTeX_Caligraphic-Bold.woff2 +0 -0
  53. package/web/dist/assets/KaTeX_Caligraphic-Regular.ttf +0 -0
  54. package/web/dist/assets/KaTeX_Caligraphic-Regular.woff +0 -0
  55. package/web/dist/assets/KaTeX_Caligraphic-Regular.woff2 +0 -0
  56. package/web/dist/assets/KaTeX_Fraktur-Bold.ttf +0 -0
  57. package/web/dist/assets/KaTeX_Fraktur-Bold.woff +0 -0
  58. package/web/dist/assets/KaTeX_Fraktur-Bold.woff2 +0 -0
  59. package/web/dist/assets/KaTeX_Fraktur-Regular.ttf +0 -0
  60. package/web/dist/assets/KaTeX_Fraktur-Regular.woff +0 -0
  61. package/web/dist/assets/KaTeX_Fraktur-Regular.woff2 +0 -0
  62. package/web/dist/assets/KaTeX_Main-Bold.ttf +0 -0
  63. package/web/dist/assets/KaTeX_Main-Bold.woff +0 -0
  64. package/web/dist/assets/KaTeX_Main-Bold.woff2 +0 -0
  65. package/web/dist/assets/KaTeX_Main-BoldItalic.ttf +0 -0
  66. package/web/dist/assets/KaTeX_Main-BoldItalic.woff +0 -0
  67. package/web/dist/assets/KaTeX_Main-BoldItalic.woff2 +0 -0
  68. package/web/dist/assets/KaTeX_Main-Italic.ttf +0 -0
  69. package/web/dist/assets/KaTeX_Main-Italic.woff +0 -0
  70. package/web/dist/assets/KaTeX_Main-Italic.woff2 +0 -0
  71. package/web/dist/assets/KaTeX_Main-Regular.ttf +0 -0
  72. package/web/dist/assets/KaTeX_Main-Regular.woff +0 -0
  73. package/web/dist/assets/KaTeX_Main-Regular.woff2 +0 -0
  74. package/web/dist/assets/KaTeX_Math-BoldItalic.ttf +0 -0
  75. package/web/dist/assets/KaTeX_Math-BoldItalic.woff +0 -0
  76. package/web/dist/assets/KaTeX_Math-BoldItalic.woff2 +0 -0
  77. package/web/dist/assets/KaTeX_Math-Italic.ttf +0 -0
  78. package/web/dist/assets/KaTeX_Math-Italic.woff +0 -0
  79. package/web/dist/assets/KaTeX_Math-Italic.woff2 +0 -0
  80. package/web/dist/assets/KaTeX_SansSerif-Bold.ttf +0 -0
  81. package/web/dist/assets/KaTeX_SansSerif-Bold.woff +0 -0
  82. package/web/dist/assets/KaTeX_SansSerif-Bold.woff2 +0 -0
  83. package/web/dist/assets/KaTeX_SansSerif-Italic.ttf +0 -0
  84. package/web/dist/assets/KaTeX_SansSerif-Italic.woff +0 -0
  85. package/web/dist/assets/KaTeX_SansSerif-Italic.woff2 +0 -0
  86. package/web/dist/assets/KaTeX_SansSerif-Regular.ttf +0 -0
  87. package/web/dist/assets/KaTeX_SansSerif-Regular.woff +0 -0
  88. package/web/dist/assets/KaTeX_SansSerif-Regular.woff2 +0 -0
  89. package/web/dist/assets/KaTeX_Script-Regular.ttf +0 -0
  90. package/web/dist/assets/KaTeX_Script-Regular.woff +0 -0
  91. package/web/dist/assets/KaTeX_Script-Regular.woff2 +0 -0
  92. package/web/dist/assets/KaTeX_Size1-Regular.ttf +0 -0
  93. package/web/dist/assets/KaTeX_Size1-Regular.woff +0 -0
  94. package/web/dist/assets/KaTeX_Size1-Regular.woff2 +0 -0
  95. package/web/dist/assets/KaTeX_Size2-Regular.ttf +0 -0
  96. package/web/dist/assets/KaTeX_Size2-Regular.woff +0 -0
  97. package/web/dist/assets/KaTeX_Size2-Regular.woff2 +0 -0
  98. package/web/dist/assets/KaTeX_Size3-Regular.ttf +0 -0
  99. package/web/dist/assets/KaTeX_Size3-Regular.woff +0 -0
  100. package/web/dist/assets/KaTeX_Size3-Regular.woff2 +0 -0
  101. package/web/dist/assets/KaTeX_Size4-Regular.ttf +0 -0
  102. package/web/dist/assets/KaTeX_Size4-Regular.woff +0 -0
  103. package/web/dist/assets/KaTeX_Size4-Regular.woff2 +0 -0
  104. package/web/dist/assets/KaTeX_Typewriter-Regular.ttf +0 -0
  105. package/web/dist/assets/KaTeX_Typewriter-Regular.woff +0 -0
  106. package/web/dist/assets/KaTeX_Typewriter-Regular.woff2 +0 -0
  107. package/web/dist/assets/cadence.css +2 -0
  108. package/web/dist/assets/cadence.js +7 -0
  109. package/web/dist/assets/markdown.js +296 -0
  110. package/web/dist/assets/react.js +9 -0
  111. package/web/dist/assets/rolldown-runtime.js +1 -0
  112. package/web/dist/assets/timeline-client.js +41 -0
  113. package/web/dist/assets/vis-timeline.css +1274 -0
  114. package/web/dist/assets/vis-timeline.js +32 -0
  115. package/web/dist/index.html +18 -0
  116. package/web/dist/manifest.json +505 -0
  117. package/config/plan-draft.example.json +0 -125
  118. package/config/plan-draft.multiple-tasks.example.json +0 -375
  119. package/config/plan-draft.quick.example.json +0 -78
  120. package/prompts/abel-design.md +0 -382
  121. package/prompts/abel-diagnose.md +0 -71
  122. package/prompts/abel-implement.md +0 -284
  123. package/prompts/abel-init.md +0 -52
  124. package/src/activation.ts +0 -44
  125. package/src/activity-contracts.ts +0 -82
  126. package/src/agent-registry.ts +0 -53
  127. package/src/apply-transaction.ts +0 -1437
  128. package/src/artifact-store.ts +0 -213
  129. package/src/build-windows-job.mjs +0 -95
  130. package/src/candidate-artifact.ts +0 -143
  131. package/src/candidate-context.ts +0 -289
  132. package/src/candidate-patch.ts +0 -271
  133. package/src/candidate-workspace.ts +0 -80
  134. package/src/canonical.ts +0 -16
  135. package/src/change-contract-schema.ts +0 -191
  136. package/src/change-contract.ts +0 -324
  137. package/src/change-verification.ts +0 -1617
  138. package/src/contracts.ts +0 -2466
  139. package/src/control-contracts.ts +0 -382
  140. package/src/delivery-compiler.ts +0 -1805
  141. package/src/delivery-revision.ts +0 -42
  142. package/src/design-control.ts +0 -1299
  143. package/src/design-diagnostics.ts +0 -181
  144. package/src/design-journal.ts +0 -1773
  145. package/src/directory-sync.ts +0 -36
  146. package/src/durable-contracts.ts +0 -227
  147. package/src/durable-workflow.ts +0 -822
  148. package/src/evidence-draft.ts +0 -122
  149. package/src/execution-profile.ts +0 -64
  150. package/src/execution-retention.ts +0 -77
  151. package/src/file-snapshot.ts +0 -163
  152. package/src/implement-continuation.ts +0 -559
  153. package/src/implement-graph.ts +0 -690
  154. package/src/implement-plan.ts +0 -72
  155. package/src/install-config.d.mts +0 -6
  156. package/src/isolation-backend.ts +0 -353
  157. package/src/model-source.ts +0 -22
  158. package/src/openspec-cli.ts +0 -494
  159. package/src/operator-cli-entry.mjs +0 -24
  160. package/src/operator-tools.ts +0 -309
  161. package/src/package-candidate-process.ts +0 -206
  162. package/src/package-candidate.ts +0 -24
  163. package/src/package-delivery.ts +0 -486
  164. package/src/package-state.ts +0 -320
  165. package/src/package-verification.ts +0 -635
  166. package/src/package-workflow.ts +0 -305
  167. package/src/packet-runtime.ts +0 -459
  168. package/src/phase-execution.ts +0 -2163
  169. package/src/pi-adapter.ts +0 -19
  170. package/src/plan-draft-summary.ts +0 -527
  171. package/src/plan-draft.ts +0 -502
  172. package/src/remove-path.ts +0 -32
  173. package/src/run-state.ts +0 -420
  174. package/src/run-store.ts +0 -1179
  175. package/src/safe-path.ts +0 -77
  176. package/src/scoped-grep-worker.mjs +0 -23
  177. package/src/scoped-tools.ts +0 -775
  178. package/src/single-task-draft.ts +0 -142
  179. package/src/sqlite-schema.ts +0 -171
  180. package/src/state-root.ts +0 -215
  181. package/src/storage-schema.ts +0 -360
  182. package/src/subagent-activity.ts +0 -1417
  183. package/src/subagent-process.ts +0 -476
  184. package/src/task-ledger.ts +0 -1338
  185. package/src/transport-budget.ts +0 -50
  186. package/src/verification-capability.ts +0 -1191
  187. package/src/verification-environment-io.ts +0 -389
  188. package/src/verification-environment.ts +0 -162
  189. package/src/verification-identity.ts +0 -77
  190. package/src/verification-scan.ts +0 -64
  191. package/src/windows-job-backend.ts +0 -419
  192. package/src/windows-job.c +0 -149
  193. package/src/workflow-engine.ts +0 -28
  194. package/src/workflow-policy.ts +0 -1670
  195. package/src/workflow-recovery-policy.ts +0 -97
  196. package/src/workflow-scheduling.ts +0 -105
  197. package/src/workflow-state-machine.ts +0 -4341
  198. package/src/workflow-status.ts +0 -576
  199. package/src/workspace-io-entry.mjs +0 -76
  200. package/src/workspace-io-worker.mjs +0 -1312
  201. package/src/workspace-io.ts +0 -89
  202. package/src/workspace-store.ts +0 -634
@@ -1,36 +0,0 @@
1
- import { closeSync, constants, fstatSync, fsyncSync, openSync } from "node:fs";
2
-
3
- /**
4
- * Flush a published directory entry where Node supports it. Windows rejects
5
- * FlushFileBuffers on Node's read-only directory handle with EPERM. This is
6
- * specifically a missing directory barrier, NOT permission to ignore file
7
- * flush, open, close, rename or other I/O errors.
8
- *
9
- * Callers must flush file bytes before publishing and retain their integrity
10
- * checks / write-ahead recovery records. On Windows this provides process-crash
11
- * recovery, not a POSIX directory-fsync guarantee across sudden power loss.
12
- */
13
- export function syncDirectory(
14
- directory: string,
15
- ): "synced" | "unsupported-directory-barrier" {
16
- const descriptor = openSync(directory, constants.O_RDONLY);
17
- try {
18
- try {
19
- fsyncSync(descriptor);
20
- return "synced";
21
- } catch (error) {
22
- const failure = error as NodeJS.ErrnoException | null;
23
- if (
24
- process.platform === "win32" &&
25
- failure?.code === "EPERM" &&
26
- failure.syscall === "fsync" &&
27
- fstatSync(descriptor).isDirectory()
28
- ) {
29
- return "unsupported-directory-barrier";
30
- }
31
- throw error;
32
- }
33
- } finally {
34
- closeSync(descriptor);
35
- }
36
- }
@@ -1,227 +0,0 @@
1
- import type { ArtifactStore } from "./artifact-store.ts";
2
- import type { CandidateArtifactSubmission } from "./candidate-context.ts";
3
- import type {
4
- StructuredVerificationContract,
5
- VerificationInputObservation,
6
- } from "./contracts.ts";
7
- import type { ImplementPlan, PlanTaskDraft } from "./delivery-compiler.ts";
8
- import type { ResolvedStateRoot } from "./state-root.ts";
9
- import type { TaskLedger } from "./task-ledger.ts";
10
-
11
- import type {
12
- DurableCandidateProposal,
13
- DurableVerificationScope,
14
- RedArtifactCorrection,
15
- WorkflowAttemptOutcome,
16
- WorkflowContextRequest,
17
- WorkflowDeliverySource,
18
- WorkflowRecoveryFeedback,
19
- WorkflowVerificationPrerequisite,
20
- } from "./workflow-policy.ts";
21
-
22
- import type { WorkspaceStore } from "./workspace-store.ts";
23
-
24
- export interface DurableResourceInput {
25
- runId: string;
26
- deliveryRevision: number;
27
- plan?: ImplementPlan;
28
- baselineRevisionId?: string;
29
- currentWorkspaceRevisionId?: string;
30
- }
31
-
32
- export type DurablePhaseVerificationResult =
33
- | {
34
- ok: true;
35
- exitCode: number;
36
- classification: "expected-red" | "expected-green" | "expected-refactor";
37
- diagnostic: { kind: "assertion" | "compiler"; id: string };
38
- }
39
- | {
40
- ok: false;
41
- kind: "paused" | "retryable" | "approval-needed";
42
- code: string;
43
- inputObservation?: VerificationInputObservation;
44
- };
45
-
46
- export type DurableChangeVerificationResult =
47
- | {
48
- ok: true;
49
- exitCode: 0;
50
- classification: string;
51
- failureIdentities?: string[];
52
- attributionReliable?: boolean;
53
- }
54
- | {
55
- ok: false;
56
- kind:
57
- | "artifact"
58
- | "environment"
59
- | "verification"
60
- | "verification-adapter"
61
- | "approval-boundary"
62
- | "cancelled";
63
- code: string;
64
- failureIdentities?: string[];
65
- attributionReliable?: boolean;
66
- inputObservation?: VerificationInputObservation;
67
- };
68
-
69
- export interface DurableVerificationObservation {
70
- status: "passed" | "failed";
71
- verificationId: string;
72
- failureIdentities: string[];
73
- code?: string;
74
- attributionReliable?: boolean;
75
- /** Code-owned comparable verification obligation, excluding display identity. */
76
- contractIdentity?: string;
77
- }
78
-
79
- export interface DurableVerificationBaseline {
80
- revisionId: string;
81
- targetContracts: Array<{
82
- taskId: string;
83
- verificationId: string;
84
- expectedFailure: string;
85
- }>;
86
- affected: Array<{
87
- taskId: string;
88
- observation: DurableVerificationObservation;
89
- }>;
90
- fullSuite: DurableVerificationObservation;
91
- }
92
-
93
- export type DurableObservedVerification =
94
- | { ok: true; observation: DurableVerificationObservation }
95
- | {
96
- ok: false;
97
- outcome:
98
- | {
99
- kind: "paused";
100
- code: string;
101
- prerequisite?: WorkflowVerificationPrerequisite;
102
- }
103
- | { kind: "approval-needed"; code: string }
104
- | { kind: "operation-cancelled"; code: "cancelled" };
105
- };
106
-
107
- export type DurableBaselineResult =
108
- | { ok: true; baseline: DurableVerificationBaseline }
109
- | Extract<DurableObservedVerification, { ok: false }>;
110
-
111
- export type DurableAffectedResult =
112
- | { kind: "verified"; attribution: "none" | "pre-existing" }
113
- | {
114
- kind: "repairable";
115
- attribution: "introduced";
116
- failureIdentities: string[];
117
- }
118
- | Extract<DurableObservedVerification, { ok: false }>["outcome"];
119
-
120
- export interface DurableWorkflowEngineOptions {
121
- consumerRoot: string;
122
- stateRoot: ResolvedStateRoot;
123
- deliverySource: WorkflowDeliverySource;
124
- proposeCandidate(input: {
125
- runId: string;
126
- operationId: string;
127
- deliveryRevision: number;
128
- taskId: string;
129
- phase: "red" | "green" | "refactor";
130
- task: PlanTaskDraft;
131
- workspaceRoot: string;
132
- ledgerProjection: unknown;
133
- candidateArtifact: CandidateArtifactSubmission;
134
- repair?: {
135
- attempt: number;
136
- attribution: "introduced";
137
- failureIdentities: string[];
138
- };
139
- artifactCorrection?: RedArtifactCorrection;
140
- contextRequest?: WorkflowContextRequest;
141
- contextReadPaths?: string[];
142
- recoveryFeedback?: WorkflowRecoveryFeedback;
143
- signal: AbortSignal;
144
- onRequestStart?(): void;
145
- onHeaders(): void;
146
- onProgress(): void;
147
- }): Promise<DurableCandidateProposal>;
148
- verifyPhase(input: {
149
- executionWritePaths?: readonly string[];
150
- runId: string;
151
- deliveryRevision: number;
152
- taskId: string;
153
- phase: "red" | "green" | "refactor";
154
- root: string;
155
- verification: StructuredVerificationContract;
156
- signal: AbortSignal;
157
- }): Promise<DurablePhaseVerificationResult>;
158
- verifyChange(input: {
159
- runId: string;
160
- deliveryRevision: number;
161
- root: string;
162
- plan: ImplementPlan;
163
- scope?: DurableVerificationScope;
164
- verification?: StructuredVerificationContract;
165
- taskId?: string;
166
- signal: AbortSignal;
167
- }): Promise<DurableChangeVerificationResult>;
168
- now?: () => number;
169
- leaseTtlMs?: number;
170
- workHardLimit?: number;
171
- verificationPolicy?: string;
172
- /** Real process executors must settle cancellation before post-apply cleanup. */
173
- awaitPostApplySettlement?: boolean;
174
- verificationEnvironment?(
175
- plan: ImplementPlan,
176
- signal: AbortSignal,
177
- ): Promise<string>;
178
- }
179
-
180
- export interface DurableExecutionResources {
181
- runId: string;
182
- root: string;
183
- plan: ImplementPlan;
184
- deliveryRevision: number;
185
- artifacts: ArtifactStore;
186
- workspaces: WorkspaceStore;
187
- ledgers: Map<number, TaskLedger>;
188
- /** Run-shared original-baseline observations, independent of delivery revision. */
189
- baselineLedger?: TaskLedger;
190
- baselineRevisionId: string;
191
- /** Root capture before any authorized boundary expansion; immutable evidence source. */
192
- originalBaselineRevisionId?: string;
193
- currentRevisionId: string;
194
- mergeTail: Promise<void>;
195
- verificationFact?: object;
196
- baselinePromises: Map<string | number, Promise<DurableBaselineResult>>;
197
- environmentIdentity?: string;
198
- }
199
-
200
- export interface DurablePhaseFact {
201
- kind: "phase-verified" | "repair-verified";
202
- phase: "red" | "green" | "refactor";
203
- isolatedRevisionId: string;
204
- outputFacts: Array<
205
- | { path: string; kind: "absent" }
206
- | { path: string; kind: "file"; hash: string; bytes: number }
207
- >;
208
- }
209
-
210
- export interface DurableCandidateCommit {
211
- artifactHash: string;
212
- isolatedRevisionId: string;
213
- exitCode: number;
214
- classification: "expected-red" | "expected-green" | "expected-refactor";
215
- diagnostic: { kind: "assertion" | "compiler"; id: string };
216
- outputFacts: DurablePhaseFact["outputFacts"];
217
- routeId: string;
218
- routeFingerprint: string;
219
- }
220
-
221
- export type DurableRepairResult =
222
- | { kind: "repair-committed"; commit: DurableCandidateCommit }
223
- | Exclude<WorkflowAttemptOutcome, { kind: "phase-committed" }>;
224
- export type PhaseResources = Omit<
225
- DurableExecutionResources,
226
- "verificationFact"
227
- >;