@williambeto/ai-workflow 2.4.9 → 2.6.3
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/bin/ai-workflow.d.ts +3 -0
- package/bin/ai-workflow.js +2669 -1
- package/bin/ai-workflow.js.map +1 -0
- package/chunk-2AOV2ATY.js +749 -0
- package/chunk-5WRI5ZAA.js +31 -0
- package/chunk-6EMG6FAO.js +734 -0
- package/chunk-UHLZX2EG.js +1827 -0
- package/core/index.d.ts +440 -0
- package/core/index.js +32 -0
- package/core/index.js.map +1 -0
- package/dist-assets/AGENTS.md +23 -6
- package/dist-assets/agents/atlas.md +8 -8
- package/dist-assets/agents/nexus.md +4 -4
- package/dist-assets/agents/orion.md +1 -1
- package/dist-assets/agents/phoenix.md +1 -1
- package/dist-assets/agents/sage.md +1 -1
- package/dist-assets/commands/implement.md +1 -1
- package/dist-assets/docs/QUICKSTART.md +8 -8
- package/dist-assets/docs/cli-reference.md +7 -7
- package/dist-assets/docs/compatibility/provider-usage.md +1 -9
- package/dist-assets/docs/compatibility/runtime-matrix.md +5 -6
- package/dist-assets/docs/consumer-onboarding.md +2 -2
- package/dist-assets/docs/design-patterns-policy.md +1 -1
- package/dist-assets/docs/npm-consumer-quickstart.md +70 -109
- package/dist-assets/docs/policies/01-BRANCH_GATE.md +1 -1
- package/dist-assets/docs/policies/06-FINAL_EVIDENCE_CONTRACT.md +2 -2
- package/dist-assets/docs/policies/08-PRODUCT_TRUTHFULNESS_AND_PROJECT_DOCS.md +1 -1
- package/dist-assets/docs/policies/10-BEHAVIORAL_CONTRACT_HARDENING.md +1 -1
- package/dist-assets/docs/policies/ORCHESTRATION_PROTOCOL.md +8 -9
- package/dist-assets/docs/policies/PROCEDURE_DELIVERY_ARTIFACTS.md +4 -10
- package/dist-assets/docs/policies/SKILLS_COMMON_GOVERNANCE.md +1 -1
- package/dist-assets/docs/profiles/README.md +2 -2
- package/dist-assets/docs/specs/runtime-operational-contract.md +12 -12
- package/dist-assets/docs/troubleshooting-guide.md +2 -2
- package/dist-assets/docs/visual-validation-guide.md +3 -3
- package/dist-assets/schemas/evidence.schema.json +109 -0
- package/dist-assets/templates/ANTIGRAVITY.md.template +7 -5
- package/dist-assets/templates/CLAUDE.md.template +7 -5
- package/dist-assets/templates/CODEX.md.template +7 -5
- package/evidence-validator-76ZQQYDU.js +6661 -0
- package/package.json +7 -64
- package/{src/core/workspace/read-only-workspace.js → read-only-workspace-PZBE7KAX.js} +14 -31
- package/{src/commands/validate.js → validate-Q2NLLQ5G.js} +30 -22
- package/AGENTS.md +0 -34
- package/CHANGELOG.md +0 -259
- package/LICENSE +0 -21
- package/PUBLISH_MANIFEST.json +0 -34
- package/README.md +0 -129
- package/dist-assets/templates/.geminiignore.template +0 -8
- package/dist-assets/templates/GEMINI.md.template +0 -20
- package/docs/compatibility/provider-usage.md +0 -46
- package/docs/compatibility/runtime-matrix.md +0 -31
- package/docs/getting-started/DESKTOP_PROMPT.md +0 -52
- package/docs/getting-started/authoring-custom-skills.md +0 -80
- package/docs/getting-started/quickstart.md +0 -117
- package/docs/getting-started/troubleshooting.md +0 -123
- package/docs/getting-started/upgrading-to-v2.md +0 -62
- package/src/adapters/index.js +0 -4
- package/src/adapters/platforms/antigravity.js +0 -382
- package/src/adapters/platforms/claude.js +0 -126
- package/src/adapters/platforms/codex.js +0 -113
- package/src/adapters/platforms/gemini.js +0 -245
- package/src/cli.js +0 -155
- package/src/commands/clean.js +0 -106
- package/src/commands/collect-evidence.js +0 -25
- package/src/commands/doctor.js +0 -202
- package/src/commands/execute.js +0 -382
- package/src/commands/init.js +0 -359
- package/src/commands/run.js +0 -112
- package/src/core/backup.js +0 -65
- package/src/core/completion-contract.js +0 -35
- package/src/core/delegation-controller.js +0 -193
- package/src/core/evidence/evidence-ledger.js +0 -98
- package/src/core/execution-planner.js +0 -62
- package/src/core/filesystem.js +0 -141
- package/src/core/finalization/finalizer.js +0 -165
- package/src/core/finalization/workspace-snapshot.js +0 -110
- package/src/core/gates/branch-gate.js +0 -134
- package/src/core/gates/merge-gate.js +0 -74
- package/src/core/handoff/handoff-engine.js +0 -104
- package/src/core/healing/cli-remediation-executor.js +0 -153
- package/src/core/healing/healer-engine.js +0 -212
- package/src/core/healing/runtime-remediation-executor.js +0 -136
- package/src/core/identity.js +0 -43
- package/src/core/install-plan.js +0 -34
- package/src/core/opencode-merge.js +0 -150
- package/src/core/package-assets.js +0 -141
- package/src/core/request-classifier.js +0 -73
- package/src/core/request-router.js +0 -289
- package/src/core/runtime/opencode-adapter.js +0 -202
- package/src/core/sdd/validator.js +0 -67
- package/src/core/statuses.js +0 -29
- package/src/core/symlink-layout.js +0 -93
- package/src/core/templates.js +0 -229
- package/src/core/validation/artifact-fidelity-gate.js +0 -445
- package/src/core/validation/canonical-finalization.js +0 -43
- package/src/core/validation/delivery-decision-engine.js +0 -344
- package/src/core/validation/evidence-collector.js +0 -245
- package/src/core/validation/quality-guard.js +0 -251
- package/src/core/validation/stack-detector.js +0 -65
- package/src/core/validation/validation-planner.js +0 -134
- package/src/core/validation/visual-verifier.js +0 -175
- package/src/core/workflow-profiles.js +0 -107
- package/src/core/workflow-state-machine.js +0 -46
package/core/index.d.ts
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
interface RequestUnderstanding {
|
|
2
|
+
rawRequest: string;
|
|
3
|
+
taskGoal: string;
|
|
4
|
+
requestedActor?: string;
|
|
5
|
+
invalidActor?: string;
|
|
6
|
+
requestedCapability?: string;
|
|
7
|
+
operationType: string;
|
|
8
|
+
mutationIntent: "readonly" | "write" | "publish";
|
|
9
|
+
riskLevel: "low" | "medium" | "high";
|
|
10
|
+
requiredEvidence: string[];
|
|
11
|
+
safetyConstraints: string[];
|
|
12
|
+
specPolicy?: "none" | "required";
|
|
13
|
+
matchedSignals?: string[];
|
|
14
|
+
riskDrivers?: string[];
|
|
15
|
+
}
|
|
16
|
+
interface RoutingDecision {
|
|
17
|
+
requestedActor?: string;
|
|
18
|
+
selectedActor?: string;
|
|
19
|
+
operationType: string;
|
|
20
|
+
mutationIntent: "readonly" | "write" | "publish";
|
|
21
|
+
permissionDecision: "allowed" | "rerouted" | "blocked";
|
|
22
|
+
reason: string;
|
|
23
|
+
workflowPath: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface RequestClassifierResult {
|
|
27
|
+
request: string;
|
|
28
|
+
profile: string;
|
|
29
|
+
owner: string;
|
|
30
|
+
intent: "read-only" | "write";
|
|
31
|
+
/** @deprecated Use riskLevel, specPolicy, and evidencePolicy instead */
|
|
32
|
+
mode: "quick" | "standard" | "full";
|
|
33
|
+
risk: "low" | "medium" | "high";
|
|
34
|
+
specPolicy: "none" | "required";
|
|
35
|
+
evidencePolicy: "optional" | "required";
|
|
36
|
+
remediationLimit: number;
|
|
37
|
+
riskDrivers: string[];
|
|
38
|
+
matchedSignals: string[];
|
|
39
|
+
specNeeded: boolean;
|
|
40
|
+
validationNeeded: boolean;
|
|
41
|
+
skills: string[];
|
|
42
|
+
requestUnderstanding: RequestUnderstanding;
|
|
43
|
+
routingDecision: RoutingDecision;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* RequestClassifier - Classifies natural requests into structured, testable contracts.
|
|
47
|
+
*/
|
|
48
|
+
declare class RequestClassifier {
|
|
49
|
+
/**
|
|
50
|
+
* Classifies a natural request.
|
|
51
|
+
*/
|
|
52
|
+
classify(request?: string, options?: {
|
|
53
|
+
cwd?: string;
|
|
54
|
+
}): RequestClassifierResult;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
interface ExecutionPlan {
|
|
58
|
+
objective: string;
|
|
59
|
+
scope: string;
|
|
60
|
+
restrictions: string[];
|
|
61
|
+
owner: string;
|
|
62
|
+
skills: string[];
|
|
63
|
+
branchNeeded: boolean;
|
|
64
|
+
branchName: string | null;
|
|
65
|
+
validationsExpected: string[];
|
|
66
|
+
remediationLimit: number;
|
|
67
|
+
specPath: string | null;
|
|
68
|
+
specPolicy: "none" | "required";
|
|
69
|
+
evidencePolicy: "optional" | "required";
|
|
70
|
+
riskLevel: "low" | "medium" | "high";
|
|
71
|
+
/** @deprecated use specPolicy, evidencePolicy and riskLevel instead */
|
|
72
|
+
mode: "quick" | "standard" | "full";
|
|
73
|
+
profile: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* ExecutionPlanner - Formulates a minimum operational plan based on classification.
|
|
77
|
+
*/
|
|
78
|
+
declare class ExecutionPlanner {
|
|
79
|
+
cwd: string;
|
|
80
|
+
constructor({ cwd }?: {
|
|
81
|
+
cwd?: string;
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Generates an execution plan.
|
|
85
|
+
*/
|
|
86
|
+
plan(classification: RequestClassifierResult, taskSlug?: string): ExecutionPlan;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type WorkflowState = "RECEIVED" | "CLASSIFIED" | "PLANNED" | "BRANCH_READY" | "DELEGATED" | "IMPLEMENTING" | "IMPLEMENTED" | "VALIDATING" | "REMEDIATING" | "REVALIDATING" | "COMPLETED" | "COMPLETED_WITH_NOTES" | "BLOCKED";
|
|
90
|
+
interface StateHistoryEntry {
|
|
91
|
+
state: WorkflowState;
|
|
92
|
+
timestamp: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* WorkflowStateMachine - Enforces state transitions for the AI Workflow loop.
|
|
97
|
+
*/
|
|
98
|
+
declare class WorkflowStateMachine {
|
|
99
|
+
private state;
|
|
100
|
+
private history;
|
|
101
|
+
private validTransitions;
|
|
102
|
+
constructor();
|
|
103
|
+
/**
|
|
104
|
+
* Transitions the machine to a new state.
|
|
105
|
+
* @param newState - The state to transition to.
|
|
106
|
+
*/
|
|
107
|
+
transitionTo(newState: WorkflowState): void;
|
|
108
|
+
getCurrentState(): WorkflowState;
|
|
109
|
+
getHistory(): StateHistoryEntry[];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface LedgerEvent {
|
|
113
|
+
workflowId: string;
|
|
114
|
+
timestamp: string;
|
|
115
|
+
actor: string;
|
|
116
|
+
actorType?: string;
|
|
117
|
+
observed?: any;
|
|
118
|
+
runtime?: any;
|
|
119
|
+
eventType: string;
|
|
120
|
+
provenance: string;
|
|
121
|
+
data: any;
|
|
122
|
+
}
|
|
123
|
+
interface RoleConfinementResult {
|
|
124
|
+
passed: boolean;
|
|
125
|
+
status: "PASS" | "BLOCKED";
|
|
126
|
+
reason: string;
|
|
127
|
+
violations: string[];
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* EvidenceLedger - Traces structural workflow events to make delegation observable.
|
|
131
|
+
*/
|
|
132
|
+
declare class EvidenceLedger {
|
|
133
|
+
cwd: string;
|
|
134
|
+
workflowId: string;
|
|
135
|
+
events: LedgerEvent[];
|
|
136
|
+
constructor({ cwd, workflowId }?: {
|
|
137
|
+
cwd?: string;
|
|
138
|
+
workflowId?: string;
|
|
139
|
+
});
|
|
140
|
+
/**
|
|
141
|
+
* Logs a workflow event to the ledger.
|
|
142
|
+
*/
|
|
143
|
+
logEvent({ actor, eventType, provenance, data, actorType, observed, runtime }: {
|
|
144
|
+
actor: string;
|
|
145
|
+
eventType: string;
|
|
146
|
+
provenance: string;
|
|
147
|
+
data?: any;
|
|
148
|
+
actorType?: string;
|
|
149
|
+
observed?: any;
|
|
150
|
+
runtime?: any;
|
|
151
|
+
}): LedgerEvent;
|
|
152
|
+
getEvents(): LedgerEvent[];
|
|
153
|
+
/**
|
|
154
|
+
* Saves the ledger events to a JSON file.
|
|
155
|
+
*/
|
|
156
|
+
save(filePath: string): Promise<void>;
|
|
157
|
+
verifyRoleConfinement(): Promise<RoleConfinementResult>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
interface InspectResult {
|
|
161
|
+
available: boolean;
|
|
162
|
+
supports: {
|
|
163
|
+
run: boolean;
|
|
164
|
+
formatJson: boolean;
|
|
165
|
+
agent: boolean;
|
|
166
|
+
model: boolean;
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
interface ExecuteOptions {
|
|
170
|
+
agent?: string | null;
|
|
171
|
+
model?: string | null;
|
|
172
|
+
readOnly?: boolean;
|
|
173
|
+
fastTrack?: boolean;
|
|
174
|
+
}
|
|
175
|
+
interface ExecuteResult {
|
|
176
|
+
success: boolean;
|
|
177
|
+
status?: string;
|
|
178
|
+
commandsRun: string[];
|
|
179
|
+
eventCount: number;
|
|
180
|
+
error?: string;
|
|
181
|
+
runtimeAgentRequested?: string | null;
|
|
182
|
+
runtimeAgentApplied?: string | null;
|
|
183
|
+
runtimeAgentSupported?: boolean;
|
|
184
|
+
runtimeAgentSelectionMode?: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* OpenCodeAdapter - Real runtime integration with the OpenCode CLI.
|
|
188
|
+
*/
|
|
189
|
+
declare class OpenCodeAdapter {
|
|
190
|
+
cwd: string;
|
|
191
|
+
constructor({ cwd }?: {
|
|
192
|
+
cwd?: string;
|
|
193
|
+
});
|
|
194
|
+
/**
|
|
195
|
+
* Inspects the availability and capability of the OpenCode CLI.
|
|
196
|
+
*/
|
|
197
|
+
inspect(): Promise<InspectResult>;
|
|
198
|
+
/**
|
|
199
|
+
* Runs opencode with a prompt and options.
|
|
200
|
+
*/
|
|
201
|
+
execute(message: string, { agent, model, readOnly, fastTrack }?: ExecuteOptions): Promise<ExecuteResult>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
interface DelegationControllerOptions {
|
|
205
|
+
cwd?: string;
|
|
206
|
+
ledger?: EvidenceLedger;
|
|
207
|
+
adapter?: OpenCodeAdapter;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* DelegationController - Manages and logs coordination between Atlas, Astra, Sage, and Phoenix.
|
|
211
|
+
*/
|
|
212
|
+
declare class DelegationController {
|
|
213
|
+
cwd: string;
|
|
214
|
+
ledger?: EvidenceLedger;
|
|
215
|
+
adapter: OpenCodeAdapter;
|
|
216
|
+
lastRoutingDecision: RoutingDecision | null;
|
|
217
|
+
constructor({ cwd, ledger, adapter }?: DelegationControllerOptions);
|
|
218
|
+
/**
|
|
219
|
+
* Logs routing decision by Atlas.
|
|
220
|
+
*/
|
|
221
|
+
route(naturalRequest: string, classification: RequestClassifierResult): Promise<void>;
|
|
222
|
+
/**
|
|
223
|
+
* Logs and executes the implementation process by Astra.
|
|
224
|
+
*/
|
|
225
|
+
implement(promptMsg: string, owner: string, options?: Record<string, unknown>): Promise<{
|
|
226
|
+
success: boolean;
|
|
227
|
+
error?: string;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* Runs validation locally without logging Sage since no validation agent runtime was executed.
|
|
231
|
+
*/
|
|
232
|
+
validate(taskSlug: string, profile: string, verifyFn: () => Promise<Record<string, unknown>>, evidencePolicy?: "optional" | "required" | null): Promise<Record<string, unknown>>;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface HandoffGenerateOptions {
|
|
236
|
+
taskId: string;
|
|
237
|
+
author?: string;
|
|
238
|
+
status: string;
|
|
239
|
+
specPaths?: string[];
|
|
240
|
+
nextActions?: string;
|
|
241
|
+
evidence?: any;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* HandoffEngine - Bundles project context into a single Markdown packet.
|
|
245
|
+
*/
|
|
246
|
+
declare class HandoffEngine {
|
|
247
|
+
cwd: string;
|
|
248
|
+
constructor({ cwd }: {
|
|
249
|
+
cwd: string;
|
|
250
|
+
});
|
|
251
|
+
/**
|
|
252
|
+
* Generates a handoff packet.
|
|
253
|
+
*/
|
|
254
|
+
generate({ taskId, author, status, specPaths, nextActions, evidence }: HandoffGenerateOptions): Promise<string>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface HealerEngineOptions {
|
|
258
|
+
cwd: string;
|
|
259
|
+
/** @deprecated use remediationLimit instead */
|
|
260
|
+
mode?: "quick" | "standard" | "full";
|
|
261
|
+
taskSlug?: string;
|
|
262
|
+
/** @deprecated use remediationLimit instead */
|
|
263
|
+
maxAttempts?: number | null;
|
|
264
|
+
remediationLimit?: number | null;
|
|
265
|
+
ledger?: EvidenceLedger | null;
|
|
266
|
+
}
|
|
267
|
+
declare class HealerEngine {
|
|
268
|
+
cwd: string;
|
|
269
|
+
/** @deprecated use remediationLimit instead */
|
|
270
|
+
mode: "quick" | "standard" | "full";
|
|
271
|
+
taskSlug: string;
|
|
272
|
+
maxAttempts: number;
|
|
273
|
+
ledger: EvidenceLedger | null;
|
|
274
|
+
constructor({ cwd, mode, taskSlug, maxAttempts, remediationLimit, ledger }: HealerEngineOptions);
|
|
275
|
+
get statePath(): string;
|
|
276
|
+
fingerprint(result: any): string;
|
|
277
|
+
blockingCount(result: any): number;
|
|
278
|
+
affectedChecks(result: any): string[];
|
|
279
|
+
hasProgress(before: any, after: any, remediation?: any): boolean;
|
|
280
|
+
writeState(state: any): Promise<void>;
|
|
281
|
+
resetState(): Promise<void>;
|
|
282
|
+
writeRemediationRequest({ attempt, result }: {
|
|
283
|
+
attempt: number;
|
|
284
|
+
result: any;
|
|
285
|
+
}): Promise<string>;
|
|
286
|
+
run({ initialResult, validate, remediate }: {
|
|
287
|
+
initialResult: any;
|
|
288
|
+
validate: (options: {
|
|
289
|
+
affectedChecks: string[];
|
|
290
|
+
attempt: number;
|
|
291
|
+
}) => Promise<any>;
|
|
292
|
+
remediate: (options: {
|
|
293
|
+
attempt: number;
|
|
294
|
+
maxAttempts: number;
|
|
295
|
+
mode: string;
|
|
296
|
+
taskSlug: string;
|
|
297
|
+
result: any;
|
|
298
|
+
affectedChecks: string[];
|
|
299
|
+
requestPath: string;
|
|
300
|
+
}) => Promise<any>;
|
|
301
|
+
}): Promise<any>;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
interface SnapshotFile {
|
|
305
|
+
sha256: string;
|
|
306
|
+
mode: string;
|
|
307
|
+
}
|
|
308
|
+
interface WorkspaceSnapshotData {
|
|
309
|
+
branch: string;
|
|
310
|
+
head: string;
|
|
311
|
+
indexTree: string;
|
|
312
|
+
files: Record<string, SnapshotFile>;
|
|
313
|
+
stagedDiffHash: string;
|
|
314
|
+
unstagedDiffHash: string;
|
|
315
|
+
untrackedFilesHash: string;
|
|
316
|
+
}
|
|
317
|
+
declare class WorkspaceSnapshot {
|
|
318
|
+
cwd: string;
|
|
319
|
+
fastTrack: boolean;
|
|
320
|
+
constructor({ cwd, fastTrack }?: {
|
|
321
|
+
cwd?: string;
|
|
322
|
+
fastTrack?: boolean;
|
|
323
|
+
});
|
|
324
|
+
isIgnored(relativePath: string): boolean;
|
|
325
|
+
capture(): Promise<WorkspaceSnapshotData>;
|
|
326
|
+
scanDir(dir: string, filesMap: Record<string, SnapshotFile>): Promise<void>;
|
|
327
|
+
calculateHash(snapshot: WorkspaceSnapshotData): string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
interface VerifyFidelityResult {
|
|
331
|
+
passed: boolean;
|
|
332
|
+
status: string;
|
|
333
|
+
reason?: string;
|
|
334
|
+
deliveryClass: string;
|
|
335
|
+
requestFidelity: any;
|
|
336
|
+
}
|
|
337
|
+
interface VerifyIntegrityResult {
|
|
338
|
+
valid: boolean;
|
|
339
|
+
changes: {
|
|
340
|
+
added: string[];
|
|
341
|
+
modified: string[];
|
|
342
|
+
deleted: string[];
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
declare class Finalizer {
|
|
346
|
+
cwd: string;
|
|
347
|
+
snapshotManager: WorkspaceSnapshot;
|
|
348
|
+
fastTrack: boolean;
|
|
349
|
+
constructor({ cwd, fastTrack }?: {
|
|
350
|
+
cwd?: string;
|
|
351
|
+
fastTrack?: boolean;
|
|
352
|
+
});
|
|
353
|
+
getChangedFilesFromGit(): string[];
|
|
354
|
+
verifyFidelity(arg: any): Promise<VerifyFidelityResult>;
|
|
355
|
+
/**
|
|
356
|
+
* Compares the current workspace state with a previously captured snapshot.
|
|
357
|
+
*/
|
|
358
|
+
verifyIntegrity(previousSnapshot: WorkspaceSnapshotData): Promise<VerifyIntegrityResult>;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface DirtyState {
|
|
362
|
+
clean: boolean;
|
|
363
|
+
tracked: string[];
|
|
364
|
+
untracked: string[];
|
|
365
|
+
lines: string[];
|
|
366
|
+
}
|
|
367
|
+
interface BranchGateCheckResult {
|
|
368
|
+
blocked: boolean;
|
|
369
|
+
branch: string;
|
|
370
|
+
recovered?: boolean;
|
|
371
|
+
branchBefore?: string;
|
|
372
|
+
readOnly?: boolean;
|
|
373
|
+
reason?: string;
|
|
374
|
+
dirtyState?: DirtyState;
|
|
375
|
+
error?: string;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* BranchGate - Protects main/master and can recover safely onto a scoped branch.
|
|
379
|
+
*/
|
|
380
|
+
declare class BranchGate {
|
|
381
|
+
protectedBranches: string[];
|
|
382
|
+
logPath: string | null;
|
|
383
|
+
cwd: string;
|
|
384
|
+
constructor({ protectedBranches, memoryDir, cwd }?: {
|
|
385
|
+
protectedBranches?: string[];
|
|
386
|
+
memoryDir?: string;
|
|
387
|
+
cwd?: string;
|
|
388
|
+
});
|
|
389
|
+
run(command: string): string;
|
|
390
|
+
log(event: string): void;
|
|
391
|
+
getDirtyState(): DirtyState;
|
|
392
|
+
createScopedBranch(taskSlug: string): string;
|
|
393
|
+
getCurrentBranch(): string;
|
|
394
|
+
/**
|
|
395
|
+
* Strictly verifies branch safety without any override bypasses.
|
|
396
|
+
*/
|
|
397
|
+
check(overrideIgnored?: string, { taskSlug, readOnly }?: {
|
|
398
|
+
taskSlug?: string;
|
|
399
|
+
readOnly?: boolean;
|
|
400
|
+
}): BranchGateCheckResult;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
interface MergeGateResult {
|
|
404
|
+
status: "PASS" | "FAIL_QUALITY_GATE" | "ERROR";
|
|
405
|
+
reason?: string;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* MergeGate verifies that commit history on integration branches respects
|
|
409
|
+
* the non-fast-forward (--no-ff) merge strategy, preserving feature branch
|
|
410
|
+
* topology instead of flattening/fast-forwarding.
|
|
411
|
+
*/
|
|
412
|
+
declare class MergeGate {
|
|
413
|
+
cwd: string;
|
|
414
|
+
constructor({ cwd }?: {
|
|
415
|
+
cwd?: string;
|
|
416
|
+
});
|
|
417
|
+
runGit(command: string): string;
|
|
418
|
+
/**
|
|
419
|
+
* Checks the commit history of the repository/branch.
|
|
420
|
+
*/
|
|
421
|
+
check(branchName: string): MergeGateResult;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
interface SpecValidationResult {
|
|
425
|
+
valid: boolean;
|
|
426
|
+
reason?: string;
|
|
427
|
+
tier?: string;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* SpecValidator - Enforces "No Spec, No Code" rule.
|
|
431
|
+
* Validates existence, structure, and approval status of specifications.
|
|
432
|
+
*/
|
|
433
|
+
declare class SpecValidator {
|
|
434
|
+
/**
|
|
435
|
+
* Validates a specification file.
|
|
436
|
+
*/
|
|
437
|
+
validate(filePath: string): Promise<SpecValidationResult>;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export { BranchGate, DelegationController, EvidenceLedger, ExecutionPlanner, Finalizer, HandoffEngine, HealerEngine, MergeGate, OpenCodeAdapter, RequestClassifier, SpecValidator, WorkflowStateMachine };
|
package/core/index.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BranchGate,
|
|
3
|
+
DelegationController,
|
|
4
|
+
EvidenceLedger,
|
|
5
|
+
ExecutionPlanner,
|
|
6
|
+
Finalizer,
|
|
7
|
+
HandoffEngine,
|
|
8
|
+
HealerEngine,
|
|
9
|
+
OpenCodeAdapter,
|
|
10
|
+
RequestClassifier,
|
|
11
|
+
SpecValidator,
|
|
12
|
+
WorkflowStateMachine
|
|
13
|
+
} from "../chunk-UHLZX2EG.js";
|
|
14
|
+
import {
|
|
15
|
+
MergeGate
|
|
16
|
+
} from "../chunk-2AOV2ATY.js";
|
|
17
|
+
import "../chunk-5WRI5ZAA.js";
|
|
18
|
+
export {
|
|
19
|
+
BranchGate,
|
|
20
|
+
DelegationController,
|
|
21
|
+
EvidenceLedger,
|
|
22
|
+
ExecutionPlanner,
|
|
23
|
+
Finalizer,
|
|
24
|
+
HandoffEngine,
|
|
25
|
+
HealerEngine,
|
|
26
|
+
MergeGate,
|
|
27
|
+
OpenCodeAdapter,
|
|
28
|
+
RequestClassifier,
|
|
29
|
+
SpecValidator,
|
|
30
|
+
WorkflowStateMachine
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist-assets/AGENTS.md
CHANGED
|
@@ -16,19 +16,36 @@ Deliver useful software through proportionate workflow, minimum diff, observed v
|
|
|
16
16
|
|
|
17
17
|
## Routing & Delegation
|
|
18
18
|
|
|
19
|
-
Atlas routes. Nexus owns discovery, requirements, and spec authoring. Orion owns planning, PR sequencing, and release strategy. Astra implements substantial scoped work. Sage independently validates when risk or
|
|
19
|
+
Atlas routes. Nexus owns discovery, requirements, and spec authoring. Orion owns planning, PR sequencing, and release strategy. Astra implements substantial scoped work. Sage independently validates when high risk or required evidence policy justifies separation. Phoenix performs bounded remediation. Delegation must improve the result; do not create agent theatre or claim handoffs that did not occur.
|
|
20
20
|
|
|
21
|
-
##
|
|
21
|
+
## Proportional Execution Policies
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
23
|
+
The AI Workflow Kit enforces a single, mandatory execution path (Request → Planning → Branch Gate → Delegation → Implementation → Validation → Evidence). Steps are never bypassed, but operational constraints adapt proportionally:
|
|
24
|
+
|
|
25
|
+
- **Risk Level (low | medium | high):** Controls merge gate checks, branch protection verification, and validation depth. High risk tasks require independent auditor review.
|
|
26
|
+
- **Specification Policy (none | required):** Dictates whether a formal specification document (SDD) is required before implementation.
|
|
27
|
+
- **Evidence Policy (optional | required):** Determines whether observed execution validation must be saved as a persisted EVIDENCE.json artifact.
|
|
28
|
+
- **Remediation Limit (number):** Enforces a strict attempt threshold (e.g., 1 for low risk, 3 for high risk) for Phoenix automatic healing.
|
|
26
29
|
|
|
27
30
|
## Evidence
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
Low and medium risk tasks require only branch, changed areas, commands/results, and limitations in the handoff. High risk or publish tasks require persisted machine-generated EVIDENCE.json.
|
|
30
33
|
|
|
31
34
|
## Core Concept
|
|
32
35
|
|
|
33
36
|
AI Workflow is an npm CLI that installs agents, commands, skills, policies and templates into your repository.
|
|
34
37
|
It guides coding agents from request to implementation, validation and evidence. AI Workflow Kit preserves workflow integrity so coding agents cannot skip from request to code to success without an explicit implementation path, proportional validation, and final evidence.
|
|
38
|
+
|
|
39
|
+
## Available skills not exposed as subagents
|
|
40
|
+
|
|
41
|
+
The following skills ship in `dist-assets/skills/` but are intentionally **not registered as subagents** in `opencode-merge.ts`. They operate as contextual lenses — activated by existing actors (Astra, Sage, Backend-Engineer, etc.) when the request profile warrants it — rather than as autonomous actors that could compete with or duplicate the core delegation chain.
|
|
42
|
+
|
|
43
|
+
| Skill | Activated by | Rationale |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| `cyber-security` | Sage (audit), Astra (hardening tasks) | Security is a review lens, not an actor. Sage already owns independent audits. |
|
|
46
|
+
| `database` | Backend-Engineer, Astra | DB schema work is covered by the backend actor. Separate actor would duplicate scope. |
|
|
47
|
+
| `devops` | Deployment-Specialist, Astra | CI/CD and container work is already covered by Deployment-Specialist. |
|
|
48
|
+
| `localization` | Astra (i18n tasks), Full-Stack-Engineer | Narrow domain; rarely an isolated request. Astra activates this skill when needed. |
|
|
49
|
+
| `performance` | Astra (optimization tasks), QA-Engineer | Optimization is embedded in implementation and QA passes, not a separate actor. |
|
|
50
|
+
|
|
51
|
+
**Decision rule:** If a future request requires one of these skills to act as an autonomous, persistent actor with its own evidence trail, promote it to a subagent in `opencode-merge.ts` with explicit justification. Do not promote by default.
|
|
@@ -19,7 +19,7 @@ Atlas must:
|
|
|
19
19
|
* Produce routing/evidence decisions.
|
|
20
20
|
|
|
21
21
|
## Responsibilities
|
|
22
|
-
* Classify requests and select the lowest safe
|
|
22
|
+
* Classify requests and select the lowest safe proportional policies (riskLevel, evidencePolicy, specPolicy).
|
|
23
23
|
* Enforce protected-branch safety before writes.
|
|
24
24
|
* Route to specialists only when useful.
|
|
25
25
|
* Require observed validation and prevent false success.
|
|
@@ -38,7 +38,7 @@ Atlas must:
|
|
|
38
38
|
* Explicit actor or capability signals from the user.
|
|
39
39
|
|
|
40
40
|
## Constraints
|
|
41
|
-
* **
|
|
41
|
+
* **High-Risk Sequence Enforcement**: For high-risk tasks (specPolicy: required), Atlas must strictly enforce that the workflow runs sequentially through `discover`, `spec-create`, `spec-review`, and `plan` phases before any implementation or coding starts. Jumping directly to implementation is forbidden.
|
|
42
42
|
* **Authoritative Routing Integrity**: Atlas must routing-delegate requests strictly according to agent capabilities (e.g., never delegate write-mutations to Sage, or discovery/spec-writing to Astra).
|
|
43
43
|
* **Implementation Delegation Constraint**: Atlas must never perform dynamic code writing or logic modification of source files directly. Any code changes (excluding pure documentation, README updates, or spelling typos) must be delegated to Astra.
|
|
44
44
|
* **Quality Gate Authoritativeness**: Any non-zero exit code or `BLOCKED` status from a safety gate, validation check, or finalizer command must immediately halt the pipeline.
|
|
@@ -72,27 +72,27 @@ Atlas must:
|
|
|
72
72
|
* Claiming success without evidence.
|
|
73
73
|
|
|
74
74
|
## Operating procedure
|
|
75
|
-
1. classify requests and select the lowest safe
|
|
75
|
+
1. classify requests and select the lowest safe proportional policies.
|
|
76
76
|
2. Delegate to specialist actors:
|
|
77
77
|
* Delegation is proportional, not ceremonial.
|
|
78
78
|
* Use Astra for substantial implementation work.
|
|
79
|
-
* Use Sage for independent validation when risk
|
|
79
|
+
* Use Sage for independent validation when high risk justifies it.
|
|
80
80
|
* Use Phoenix only for concrete findings that need remediation.
|
|
81
81
|
* Do not claim that an agent acted unless that handoff actually occurred.
|
|
82
|
-
3. For
|
|
82
|
+
3. For low or medium risk tasks:
|
|
83
83
|
* Inspect status.
|
|
84
84
|
* Recover branch if needed.
|
|
85
85
|
* Coordinate and delegate any code-source modifications to Astra (Atlas must never execute code implementation directly).
|
|
86
86
|
* Run validation.
|
|
87
|
-
* For every write-capable
|
|
87
|
+
* For every write-capable low or medium risk task, Atlas must run the package finalizer after the final implementation changes and before reporting success:
|
|
88
88
|
```bash
|
|
89
|
-
npx ai-workflow collect-evidence --
|
|
89
|
+
npx ai-workflow collect-evidence --evidence-policy=optional --task=<short-task-slug>
|
|
90
90
|
```
|
|
91
91
|
The finalizer exit code and printed status are authoritative:
|
|
92
92
|
* exit code `0` with `COMPLETED` or `COMPLETED_WITH_NOTES`: Atlas may report that exact public state;
|
|
93
93
|
* non-zero exit code or `BLOCKED`: remediate within the configured bound or report `BLOCKED`;
|
|
94
94
|
* Atlas must never infer, upgrade, or replace the finalizer result from screenshots, manual checks, build output, or its own judgement.
|
|
95
|
-
4. For
|
|
95
|
+
4. For high-risk tasks requiring evidence (evidencePolicy: required), use the full workflow/orchestrator so persisted evidence and independent validation remain available.
|
|
96
96
|
|
|
97
97
|
## Expected output schema
|
|
98
98
|
Must include:
|
|
@@ -15,7 +15,7 @@ Nexus must inspect project structure, identify stack, entry points, scripts, con
|
|
|
15
15
|
## Responsibilities
|
|
16
16
|
* Inspect relevant project context.
|
|
17
17
|
* Clarify objective, scope, constraints, risks, and acceptance criteria.
|
|
18
|
-
* Recommend
|
|
18
|
+
* Recommend riskLevel, evidencePolicy, and specPolicy.
|
|
19
19
|
* Define meaningful validation.
|
|
20
20
|
* Identify assumptions and stop conditions.
|
|
21
21
|
|
|
@@ -31,13 +31,13 @@ Nexus must inspect project structure, identify stack, entry points, scripts, con
|
|
|
31
31
|
* Natural language requests, product requirements, user goals, or bug reports.
|
|
32
32
|
|
|
33
33
|
## Constraints
|
|
34
|
-
* **Traceability Matrix Enforcement**: Specifications created for
|
|
34
|
+
* **Traceability Matrix Enforcement**: Specifications created for medium or high risk tasks must include a traceability matrix mapping each business requirement to a specific automated verification method and DoD.
|
|
35
35
|
* **Strict Read-Only Discovery**: Under no circumstances should Nexus write, edit, or delete files in the repository during discovery or specification creation.
|
|
36
36
|
* **Measurable Acceptance (DoD)**: All acceptance criteria (DoD) must be concrete, binary, and verifiable through test suites, linting checks, or visual reports. Prohibit qualitative/subjective terms.
|
|
37
37
|
* Do not mutate files during discovery.
|
|
38
38
|
* Do not invent project details without evidence.
|
|
39
39
|
* Use the least documentation needed to remove material ambiguity.
|
|
40
|
-
* Do not create a
|
|
40
|
+
* Do not create a detailed specification for a low-risk reversible task.
|
|
41
41
|
|
|
42
42
|
## Allowed tools
|
|
43
43
|
* Read-only repository inspection tools (grep, list dir, view file).
|
|
@@ -56,7 +56,7 @@ Nexus must inspect project structure, identify stack, entry points, scripts, con
|
|
|
56
56
|
1. Inspect the codebase structure, files, stack, configuration, and dependencies.
|
|
57
57
|
2. Identify entry points, scripts, validation commands, and generated files.
|
|
58
58
|
3. Summarize architecture, risk areas, and technical assumptions.
|
|
59
|
-
4. Recommend the lowest safe
|
|
59
|
+
4. Recommend the lowest safe proportional policies (riskLevel, evidencePolicy, specPolicy).
|
|
60
60
|
5. Define meaningful validation checklists and stop conditions.
|
|
61
61
|
|
|
62
62
|
## Expected output schema
|
|
@@ -7,7 +7,7 @@ mode: primary
|
|
|
7
7
|
# Orion
|
|
8
8
|
|
|
9
9
|
## Role
|
|
10
|
-
Orion owns release and deployment readiness. Release work
|
|
10
|
+
Orion owns release and deployment readiness. Release work requires evidence and high risk level by default.
|
|
11
11
|
|
|
12
12
|
## Objective
|
|
13
13
|
Orion verifies version, changelog and release evidence, confirms clean working tree, runs release verification, generates package/tarball evidence, and requires explicit approval before publish/tag/push/release.
|
|
@@ -39,7 +39,7 @@ Phoenix acts only on concrete findings, identifies root cause, applies the small
|
|
|
39
39
|
* Do not rewrite unrelated areas.
|
|
40
40
|
* Do not bypass tests.
|
|
41
41
|
* Respect the maximum attempt budget.
|
|
42
|
-
* Remediation is bounded by
|
|
42
|
+
* Remediation is bounded by remediationLimit and must show progress. Repeated or unchanged findings become `BLOCKED`.
|
|
43
43
|
|
|
44
44
|
## Allowed tools
|
|
45
45
|
* File edit and write tools.
|
|
@@ -7,7 +7,7 @@ mode: primary
|
|
|
7
7
|
# Sage
|
|
8
8
|
|
|
9
9
|
## Role
|
|
10
|
-
Sage validates independently from implementation when Atlas selects independent review, especially for
|
|
10
|
+
Sage validates independently from implementation when Atlas selects independent review, especially for high-risk, security-sensitive, or release work.
|
|
11
11
|
|
|
12
12
|
## Objective
|
|
13
13
|
Sage validates implementation evidence independently, classifies risk, runs or inspects relevant tests, returns PASS, PASS_WITH_NOTES or BLOCKED, and reports findings with evidence.
|
|
@@ -48,7 +48,7 @@ Implement a small task with defined scope, verifying changes incrementally.
|
|
|
48
48
|
2. Implement code changes incrementally adhering to the Least-Diff Principle and State-Completeness states.
|
|
49
49
|
3. Check for proper observers, event handlers, and timer cleanups.
|
|
50
50
|
4. Run a proportional automated behavioral test to verify the changes.
|
|
51
|
-
5. Run the finalizer command: `npx ai-workflow collect-evidence --
|
|
51
|
+
5. Run the finalizer command: `npx ai-workflow collect-evidence --evidence-policy=optional --task=<short-task-slug>`
|
|
52
52
|
6. Capture git diff, bundle sizes, and test logs.
|
|
53
53
|
7. Create implementation handoff report.
|
|
54
54
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# AI Workflow Kit quickstart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
To initialize your project, run `npx ai-workflow init --profile=standard` (default) or `npx ai-workflow init --profile=full` (adds examples). Then, give Atlas a natural software request. Atlas chooses the lowest safe proportional policies and the closest workflow profile.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Proportional Policies
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Workflow constraints are calculated dynamically based on explicit policies:
|
|
8
|
+
- **Risk Level** (`low | medium | high`): Determines gate checks and validation depth.
|
|
9
|
+
- **Evidence Policy** (`optional | required`): Controls whether a machine-generated `EVIDENCE.json` must be persisted.
|
|
10
|
+
- **Remediation Limit**: Controls attempt budgets for automatic healing.
|
|
11
|
+
- **Specification Policy** (`none | required`): Controls if a formal specification (SDD) document is required.
|
|
12
12
|
|
|
13
13
|
## Safety
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ Write-capable work never runs on `main` or `master`. Existing relevant tests/bui
|
|
|
20
20
|
- `COMPLETED_WITH_NOTES`
|
|
21
21
|
- `BLOCKED`
|
|
22
22
|
|
|
23
|
-
Workflow documents are optional unless they provide lasting value or
|
|
23
|
+
Workflow documents are optional unless they provide lasting value or the specification policy requires them.
|
|
24
24
|
|
|
25
25
|
## Visual & Accessibility Evidence Requirements
|
|
26
26
|
|