@gtrabanco/agentic-workflow-schema 2.0.0 → 3.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.es.md +93 -162
- package/README.md +90 -153
- package/dist/index.d.ts +200 -5
- package/dist/index.js +921 -10
- package/envelope.schema.json +30 -4
- package/package.json +9 -5
- package/skill-outcome.schema.json +68 -0
- package/workflow-snapshot.schema.json +90 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @gtrabanco/agentic-workflow-schema
|
|
3
3
|
*
|
|
4
|
-
* Types, extraction, and validation for the agentic-workflow
|
|
5
|
-
*
|
|
6
|
-
* workflow-status always, and by any other skill when the driver injects the
|
|
7
|
-
* canonical system-prompt snippet).
|
|
4
|
+
* Types, extraction, and validation for the agentic-workflow machine contracts:
|
|
5
|
+
* Envelope v2, SkillOutcome v1, and WorkflowSnapshot v1.
|
|
8
6
|
*
|
|
9
|
-
*
|
|
7
|
+
* Envelope parse contract:
|
|
10
8
|
* take the LAST fenced ```json block of the assistant's final message;
|
|
11
9
|
* exactly one envelope per turn; all top-level keys always present.
|
|
12
10
|
*/
|
|
@@ -81,10 +79,17 @@ export interface EnvelopeNeedsInput {
|
|
|
81
79
|
question: string;
|
|
82
80
|
options: string[];
|
|
83
81
|
}
|
|
82
|
+
export interface EnvelopeSuggestion {
|
|
83
|
+
command: string;
|
|
84
|
+
trigger: string;
|
|
85
|
+
source_skill: string;
|
|
86
|
+
}
|
|
84
87
|
export interface EnvelopeNext {
|
|
85
88
|
recommended: string;
|
|
86
89
|
alternatives: string[];
|
|
87
90
|
tier: Tier;
|
|
91
|
+
/** Optional trigger-attributed suggestions (workflow-status only). */
|
|
92
|
+
suggested?: EnvelopeSuggestion[];
|
|
88
93
|
}
|
|
89
94
|
export interface Envelope {
|
|
90
95
|
skill: string;
|
|
@@ -139,3 +144,193 @@ export declare function parseEnvelope(text: string): ParseResult;
|
|
|
139
144
|
export declare function isTerminal(state: EnvelopeState): boolean;
|
|
140
145
|
/** True when every blocker (or any) demands stopping the whole run. */
|
|
141
146
|
export declare function isRunHalt(envelope: Envelope): boolean;
|
|
147
|
+
export type StrictEnvelopeValidationResult = {
|
|
148
|
+
ok: true;
|
|
149
|
+
envelope: Envelope;
|
|
150
|
+
} | {
|
|
151
|
+
ok: false;
|
|
152
|
+
errors: string[];
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Validates the documented v2 shape at a driver boundary.
|
|
156
|
+
*
|
|
157
|
+
* `validateEnvelope()` remains intentionally source-compatible for existing
|
|
158
|
+
* package consumers. New drivers use this stricter entry point: `detail` is
|
|
159
|
+
* present and top-level schema extensions are rejected instead of silently
|
|
160
|
+
* becoming a second, undocumented contract.
|
|
161
|
+
*/
|
|
162
|
+
export declare function validateEnvelopeV2Strict(value: unknown): StrictEnvelopeValidationResult;
|
|
163
|
+
export type StrictEnvelopeParseResult = {
|
|
164
|
+
ok: true;
|
|
165
|
+
envelope: Envelope;
|
|
166
|
+
raw: string;
|
|
167
|
+
} | {
|
|
168
|
+
ok: false;
|
|
169
|
+
errors: string[];
|
|
170
|
+
raw: string | null;
|
|
171
|
+
};
|
|
172
|
+
/** Extract, parse, and validate the strict driver-facing v2 envelope. */
|
|
173
|
+
export declare function parseEnvelopeV2Strict(text: string): StrictEnvelopeParseResult;
|
|
174
|
+
export type WorkflowIntent = "init-workspace" | "status" | "discover-repository-state" | "resolve-repository-state" | "design-feature" | "plan-feature" | "plan-fix" | "triage-issue" | "execute-phase" | "review-change" | "loop-review-fold" | "audit-pr" | "merge" | "ask-human" | "stop" | "none";
|
|
175
|
+
export declare const WORKFLOW_INTENTS: readonly WorkflowIntent[];
|
|
176
|
+
export interface WorkflowSkillProfile {
|
|
177
|
+
skill: string;
|
|
178
|
+
output: "envelope-v2" | "skill-outcome-v1";
|
|
179
|
+
nativeFallback: "none" | "fixed-verdict";
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* The portable skill inventory consumed by headless drivers. Profiles are
|
|
183
|
+
* programmatic metadata, not duplicated prompt sections in user-facing skills.
|
|
184
|
+
*/
|
|
185
|
+
export declare const WORKFLOW_SKILL_PROFILES: readonly WorkflowSkillProfile[];
|
|
186
|
+
export type SkillOutcomeStatus = "completed" | "continue" | "blocked" | "needs-input" | "failed";
|
|
187
|
+
export interface SkillOutcomeBlocker {
|
|
188
|
+
kind: BlockerKind;
|
|
189
|
+
id: string;
|
|
190
|
+
scope: BlockerScope;
|
|
191
|
+
detail: string;
|
|
192
|
+
}
|
|
193
|
+
export interface SkillOutcomeQuestion {
|
|
194
|
+
id: string;
|
|
195
|
+
question: string;
|
|
196
|
+
options: string[];
|
|
197
|
+
}
|
|
198
|
+
export interface SkillOutcomeDiscovery {
|
|
199
|
+
kind: "defect" | "risk" | "opportunity" | "environment" | "scope-gap" | "unknown";
|
|
200
|
+
scope: "current-unit" | "outside-unit" | "run";
|
|
201
|
+
summary: string;
|
|
202
|
+
evidence_refs: string[];
|
|
203
|
+
proposed_intent: WorkflowIntent;
|
|
204
|
+
}
|
|
205
|
+
export interface SkillOutcome {
|
|
206
|
+
contract: "agentic-workflow/skill-outcome";
|
|
207
|
+
version: 1;
|
|
208
|
+
skill: string;
|
|
209
|
+
status: SkillOutcomeStatus;
|
|
210
|
+
summary: string;
|
|
211
|
+
next: {
|
|
212
|
+
intent: WorkflowIntent;
|
|
213
|
+
targets: string[];
|
|
214
|
+
};
|
|
215
|
+
blockers: SkillOutcomeBlocker[];
|
|
216
|
+
questions: SkillOutcomeQuestion[];
|
|
217
|
+
discoveries: SkillOutcomeDiscovery[];
|
|
218
|
+
evidence_refs: string[];
|
|
219
|
+
}
|
|
220
|
+
export interface TurnParseContext {
|
|
221
|
+
/** Trusted driver state used only for a checked legacy normalization. */
|
|
222
|
+
unitId?: string;
|
|
223
|
+
}
|
|
224
|
+
export interface TurnParseDiagnostic {
|
|
225
|
+
code: string;
|
|
226
|
+
detail: string;
|
|
227
|
+
}
|
|
228
|
+
export type TurnParseSource = "skill-outcome-v1" | "envelope-v2-strict" | "envelope-v2-compat" | "native";
|
|
229
|
+
export type TurnParseResult = {
|
|
230
|
+
ok: true;
|
|
231
|
+
source: TurnParseSource;
|
|
232
|
+
outcome: SkillOutcome;
|
|
233
|
+
envelope: Envelope | null;
|
|
234
|
+
diagnostics: TurnParseDiagnostic[];
|
|
235
|
+
} | {
|
|
236
|
+
ok: false;
|
|
237
|
+
errors: string[];
|
|
238
|
+
diagnostics: TurnParseDiagnostic[];
|
|
239
|
+
};
|
|
240
|
+
export interface ParseTurnInput {
|
|
241
|
+
skill: string;
|
|
242
|
+
text: string;
|
|
243
|
+
context?: TurnParseContext;
|
|
244
|
+
}
|
|
245
|
+
export type SkillOutcomeValidationResult = {
|
|
246
|
+
ok: true;
|
|
247
|
+
outcome: SkillOutcome;
|
|
248
|
+
} | {
|
|
249
|
+
ok: false;
|
|
250
|
+
errors: string[];
|
|
251
|
+
};
|
|
252
|
+
/** Validates the strict, model-owned SkillOutcome v1 JSON contract. */
|
|
253
|
+
export declare function validateSkillOutcomeV1(value: unknown): SkillOutcomeValidationResult;
|
|
254
|
+
/**
|
|
255
|
+
* Parses a machine result in strict precedence order. Compatibility mappings
|
|
256
|
+
* are intentionally small and named; arbitrary prose is never promoted into
|
|
257
|
+
* a workflow fact.
|
|
258
|
+
*/
|
|
259
|
+
export declare function parseTurn(input: ParseTurnInput): TurnParseResult;
|
|
260
|
+
/** Returns the smallest driver instruction appropriate for the selected skill. */
|
|
261
|
+
export declare function renderOutputInstruction(skill: string): string;
|
|
262
|
+
export interface WorkflowDocument {
|
|
263
|
+
path: string;
|
|
264
|
+
content: string;
|
|
265
|
+
}
|
|
266
|
+
export interface WorkflowSnapshotInput {
|
|
267
|
+
sourceRevision: string;
|
|
268
|
+
repository: {
|
|
269
|
+
branch: string;
|
|
270
|
+
headSha: string;
|
|
271
|
+
dirty: boolean;
|
|
272
|
+
};
|
|
273
|
+
documents: WorkflowDocument[];
|
|
274
|
+
}
|
|
275
|
+
export interface SnapshotProvenance {
|
|
276
|
+
field: string;
|
|
277
|
+
source: string;
|
|
278
|
+
line: number;
|
|
279
|
+
}
|
|
280
|
+
export interface SnapshotUnknown {
|
|
281
|
+
field: string;
|
|
282
|
+
reason: string;
|
|
283
|
+
}
|
|
284
|
+
export interface SnapshotContradiction {
|
|
285
|
+
field: string;
|
|
286
|
+
source: string;
|
|
287
|
+
line: number;
|
|
288
|
+
detail: string;
|
|
289
|
+
}
|
|
290
|
+
export interface WorkflowSnapshot {
|
|
291
|
+
contract: "agentic-workflow/workflow-snapshot";
|
|
292
|
+
version: 1;
|
|
293
|
+
sourceRevision: string;
|
|
294
|
+
repository: {
|
|
295
|
+
branch: string;
|
|
296
|
+
headSha: string;
|
|
297
|
+
dirty: boolean;
|
|
298
|
+
};
|
|
299
|
+
repositoryState: "missing" | "draft" | "frozen" | "contradicted" | "needs-input" | "unknown";
|
|
300
|
+
unit: {
|
|
301
|
+
kind: "feature" | "fix";
|
|
302
|
+
id: string;
|
|
303
|
+
status: string;
|
|
304
|
+
} | null;
|
|
305
|
+
phase: {
|
|
306
|
+
current: string | null;
|
|
307
|
+
total: number | null;
|
|
308
|
+
completed: number | null;
|
|
309
|
+
names: string[];
|
|
310
|
+
};
|
|
311
|
+
provenance: SnapshotProvenance[];
|
|
312
|
+
contradictions: SnapshotContradiction[];
|
|
313
|
+
unknowns: SnapshotUnknown[];
|
|
314
|
+
}
|
|
315
|
+
export type WorkflowSnapshotResult = {
|
|
316
|
+
ok: true;
|
|
317
|
+
snapshot: WorkflowSnapshot;
|
|
318
|
+
} | {
|
|
319
|
+
ok: false;
|
|
320
|
+
errors: string[];
|
|
321
|
+
};
|
|
322
|
+
export type WorkflowSnapshotValidationResult = {
|
|
323
|
+
ok: true;
|
|
324
|
+
snapshot: WorkflowSnapshot;
|
|
325
|
+
} | {
|
|
326
|
+
ok: false;
|
|
327
|
+
errors: string[];
|
|
328
|
+
};
|
|
329
|
+
/** Validates the strict, deterministic WorkflowSnapshot v1 JSON contract. */
|
|
330
|
+
export declare function validateWorkflowSnapshotV1(value: unknown): WorkflowSnapshotValidationResult;
|
|
331
|
+
/**
|
|
332
|
+
* Compiles only facts represented by the versioned workflow documents passed
|
|
333
|
+
* in by the caller. It performs no filesystem or Git I/O and records source
|
|
334
|
+
* locations for every value it derives.
|
|
335
|
+
*/
|
|
336
|
+
export declare function compileWorkflowSnapshot(input: WorkflowSnapshotInput): WorkflowSnapshotResult;
|