@gtrabanco/agentic-workflow-schema 3.0.0 → 3.2.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 +53 -0
- package/README.md +49 -0
- package/dist/index.d.ts +138 -1
- package/dist/index.js +601 -14
- package/package.json +2 -2
package/README.es.md
CHANGED
|
@@ -65,6 +65,32 @@ estructurados.
|
|
|
65
65
|
pueden continuar con `parseEnvelope(text)`; los nuevos usan
|
|
66
66
|
`parseEnvelopeV2Strict(text)` o el uniforme `parseTurn({skill, text})`.
|
|
67
67
|
|
|
68
|
+
## Perfiles de capacidades
|
|
69
|
+
|
|
70
|
+
Cada perfil integrado de `WORKFLOW_SKILL_PROFILES` lleva un objeto `capabilities`
|
|
71
|
+
opcional e inmutable: rol, clase de razonamiento, **efectos máximos**, fuentes
|
|
72
|
+
de contexto y evidencia requerida, todos dentro de los vocabularios cerrados
|
|
73
|
+
exportados (`SKILL_ROLES`, `SKILL_EFFECTS`, `SKILL_REASONING`,
|
|
74
|
+
`SKILL_CONTEXT_SOURCES`, `SKILL_REQUIRED_EVIDENCE`).
|
|
75
|
+
|
|
76
|
+
Semántica de las capacidades:
|
|
77
|
+
|
|
78
|
+
- **La evidencia del repositorio es autoritativa.** `effects`, `contextSources`
|
|
79
|
+
y `requiredEvidence` documentan las capacidades máximas revisadas de los
|
|
80
|
+
documentos del propio workflow (`docs/`); nunca prometen nada sobre un modelo
|
|
81
|
+
o un runtime de proveedor.
|
|
82
|
+
- **El contexto es orientativo.** `semantic-context` y `episodic-memory`
|
|
83
|
+
describen contexto que *puede* ayudar; nunca cambian lo que una skill puede
|
|
84
|
+
hacer.
|
|
85
|
+
- **Las exportaciones son inmutables.** Los arrays de vocabulario y cada perfil
|
|
86
|
+
quedan congelados en runtime (`Object.isFrozen`); no se soporta ensanchar un
|
|
87
|
+
perfil en runtime. Cualquier cambio de vocabulario o perfil es una release
|
|
88
|
+
revisada del paquete.
|
|
89
|
+
|
|
90
|
+
`capabilities` es opcional por compatibilidad de fuente. Un consumidor que
|
|
91
|
+
entiende capacidades debe **fallar cerrado** cuando está ausente: nunca inferir
|
|
92
|
+
el rol o los efectos de una skill por su nombre.
|
|
93
|
+
|
|
68
94
|
## Compilar estado determinista
|
|
69
95
|
|
|
70
96
|
El paquete nunca lee el sistema de archivos, Git ni una forja. El llamador
|
|
@@ -129,3 +155,30 @@ publicado. Los campos aditivos son minor; arreglos de parser, documentación o
|
|
|
129
155
|
implementación son patch. Consulta la
|
|
130
156
|
[orquestación programática](../../docs/workflow/ORCHESTRATION.es.md) para el
|
|
131
157
|
protocolo de driver.
|
|
158
|
+
|
|
159
|
+
## Decisor de transición del workflow
|
|
160
|
+
|
|
161
|
+
Exporta `decideWorkflowAction(input)` — una función pura y determinista que
|
|
162
|
+
combina un `WorkflowSnapshot v1`, el último `SkillOutcome v1` validado y una
|
|
163
|
+
`WorkflowDecisionPolicy` provista por el driver para decidir si puede invocar
|
|
164
|
+
la siguiente habilidad, debe refrescar con `workflow-status` o debe detenerse.
|
|
165
|
+
|
|
166
|
+
```ts
|
|
167
|
+
function decideWorkflowAction(input: WorkflowDecisionInput): WorkflowActionDecision
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
- **Elisión segura:** cuando el snapshot está congelado y la habilidad →
|
|
171
|
+
siguiente intento está probada por la tabla congelada
|
|
172
|
+
`WORKFLOW_TRANSITION_TABLE`, el driver invoca directamente sin llamar a
|
|
173
|
+
`workflow-status`.
|
|
174
|
+
- **Respaldo obligatorio:** en evidencia ausente, revisión obsoleta, estado
|
|
175
|
+
bloqueado, contradicciones, efectos no autorizados o cualquier transición
|
|
176
|
+
no reconocida, la función retorna `sense` (llamar `workflow-status`) o
|
|
177
|
+
`stop` (terminar).
|
|
178
|
+
|
|
179
|
+
**Puntos obligatorios de sensor:** ejecución inicial (sin outcome), ejecución
|
|
180
|
+
recuperada (revisión obsoleta), snapshot desconocido o contradicho, siguiente
|
|
181
|
+
intento no reconocido, y cualquier transición no en la tabla cerrada.
|
|
182
|
+
|
|
183
|
+
Consulta el [SPEC](../features/24-workflow-transition-decider/SPEC.md) para el
|
|
184
|
+
diseño completo, tablas de transición y vocabulario de códigos de razón.
|
package/README.md
CHANGED
|
@@ -63,6 +63,30 @@ driver-level failure. Do not promote arbitrary prose to structured facts.
|
|
|
63
63
|
continue to use `parseEnvelope(text)`; new consumers use
|
|
64
64
|
`parseEnvelopeV2Strict(text)` or the uniform `parseTurn({skill, text})`.
|
|
65
65
|
|
|
66
|
+
## Capability profiles
|
|
67
|
+
|
|
68
|
+
Every built-in profile in `WORKFLOW_SKILL_PROFILES` carries an optional,
|
|
69
|
+
immutable `capabilities` object: role, reasoning class, **maximum effects**,
|
|
70
|
+
context sources, and required evidence, all from the exported closed
|
|
71
|
+
vocabularies (`SKILL_ROLES`, `SKILL_EFFECTS`, `SKILL_REASONING`,
|
|
72
|
+
`SKILL_CONTEXT_SOURCES`, `SKILL_REQUIRED_EVIDENCE`).
|
|
73
|
+
|
|
74
|
+
Capability semantics:
|
|
75
|
+
|
|
76
|
+
- **Repository evidence is authoritative.** `effects`, `contextSources` and
|
|
77
|
+
`requiredEvidence` document the reviewed maximum capabilities from the
|
|
78
|
+
workflow's own documents (`docs/`); they never promise anything about a
|
|
79
|
+
model or provider runtime.
|
|
80
|
+
- **Context is advisory.** `semantic-context` and `episodic-memory` describe
|
|
81
|
+
context that *may* help; they never change what a skill may do.
|
|
82
|
+
- **Exports are immutable.** Vocabulary arrays and every profile are frozen at
|
|
83
|
+
runtime (`Object.isFrozen`); widening a profile at runtime is unsupported.
|
|
84
|
+
Any vocabulary or profile change is a reviewed package release.
|
|
85
|
+
|
|
86
|
+
`capabilities` is optional for source compatibility. A capability-aware
|
|
87
|
+
consumer must **fail closed** when it is absent — never infer a skill's role
|
|
88
|
+
or effects from its name.
|
|
89
|
+
|
|
66
90
|
## Compile deterministic state
|
|
67
91
|
|
|
68
92
|
The package never reads the filesystem, Git, or a forge. The caller supplies
|
|
@@ -121,6 +145,31 @@ It refuses a nonzero issue count without identities, an unmatched unit id, and
|
|
|
121
145
|
unstructured prose. The compatibility diagnostics make every repair visible to
|
|
122
146
|
the driver.
|
|
123
147
|
|
|
148
|
+
## Workflow transition decider
|
|
149
|
+
|
|
150
|
+
Export `decideWorkflowAction(input)` — a pure, deterministic function that
|
|
151
|
+
combines a `WorkflowSnapshot v1`, the last validated `SkillOutcome v1`, and a
|
|
152
|
+
caller-provided `WorkflowDecisionPolicy` to decide whether a headless driver
|
|
153
|
+
may invoke the next skill, must refresh with `workflow-status`, or must stop.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
function decideWorkflowAction(input: WorkflowDecisionInput): WorkflowActionDecision
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
- **Safe elision:** when the snapshot is frozen and the last skill → next intent
|
|
160
|
+
is proven by the frozen `WORKFLOW_TRANSITION_TABLE`, the driver invokes
|
|
161
|
+
directly without calling `workflow-status`.
|
|
162
|
+
- **Mandatory fallback:** on missing evidence, stale revision, blocked status,
|
|
163
|
+
contradictions, unauthorized effects, or any unrecognized transition, the
|
|
164
|
+
function returns `sense` (call `workflow-status`) or `stop` (terminate).
|
|
165
|
+
|
|
166
|
+
**Mandatory sensor points:** initial run (no outcome), recovered run (stale
|
|
167
|
+
revision), snapshot state unknown or contradicted, unrecognized next intent,
|
|
168
|
+
and any transition not in the closed table.
|
|
169
|
+
|
|
170
|
+
See [SPEC](../features/24-workflow-transition-decider/SPEC.md) for the full
|
|
171
|
+
design, transition tables, and reason-code vocabulary.
|
|
172
|
+
|
|
124
173
|
Package major versions signal a breaking change to any published contract.
|
|
125
174
|
Additive contract fields are minor; parser, documentation, or implementation
|
|
126
175
|
fixes are patch releases. See
|
package/dist/index.d.ts
CHANGED
|
@@ -173,16 +173,153 @@ export type StrictEnvelopeParseResult = {
|
|
|
173
173
|
export declare function parseEnvelopeV2Strict(text: string): StrictEnvelopeParseResult;
|
|
174
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
175
|
export declare const WORKFLOW_INTENTS: readonly WorkflowIntent[];
|
|
176
|
+
/** Sense reason codes: transition cannot proceed without more sensor input. */
|
|
177
|
+
export declare const WORKFLOW_DECISION_SENSE_CODES: readonly ["sense-initial", "sense-stale-revision", "sense-missing-evidence", "sense-unknown-state", "sense-unlisted-transition"];
|
|
178
|
+
export type WorkflowDecisionSenseReason = (typeof WORKFLOW_DECISION_SENSE_CODES)[number];
|
|
179
|
+
/** Stop reason codes: the transition is explicitly blocked or must terminate. */
|
|
180
|
+
export declare const WORKFLOW_DECISION_STOP_CODES: readonly ["stop-blocked", "stop-needs-input", "stop-failed", "stop-contradiction", "stop-policy-denied", "stop-forbidden-transition"];
|
|
181
|
+
export type WorkflowDecisionStopReason = (typeof WORKFLOW_DECISION_STOP_CODES)[number];
|
|
182
|
+
/** Invoke reason codes: transition is proven and allowed. */
|
|
183
|
+
export declare const WORKFLOW_DECISION_INVOKE_CODES: readonly ["invoke-proven-transition"];
|
|
184
|
+
export type WorkflowDecisionInvokeReason = (typeof WORKFLOW_DECISION_INVOKE_CODES)[number];
|
|
185
|
+
export type WorkflowDecisionReasonCode = WorkflowDecisionSenseReason | WorkflowDecisionStopReason | WorkflowDecisionInvokeReason;
|
|
186
|
+
/** Policy a caller provides to control the transition decision. */
|
|
187
|
+
export interface WorkflowDecisionPolicy {
|
|
188
|
+
/** Intents the caller is permitted to invoke. */
|
|
189
|
+
readonly allowedIntents: readonly WorkflowIntent[];
|
|
190
|
+
/** Whether the caller has forge-write authorization. */
|
|
191
|
+
readonly forgeWriteAuthorized: boolean;
|
|
192
|
+
}
|
|
193
|
+
/** Input to the transition decision function. */
|
|
194
|
+
export interface WorkflowDecisionInput {
|
|
195
|
+
/** A validated WorkflowSnapshot v1. */
|
|
196
|
+
readonly snapshot: WorkflowSnapshot;
|
|
197
|
+
/** The last validated SkillOutcome v1, or null. */
|
|
198
|
+
readonly lastOutcome: SkillOutcome | null;
|
|
199
|
+
/** The revision at which the last outcome was recorded. */
|
|
200
|
+
readonly lastOutcomeSourceRevision: string | null;
|
|
201
|
+
/** Closed caller policy governing what transitions are permitted. */
|
|
202
|
+
readonly policy: WorkflowDecisionPolicy;
|
|
203
|
+
}
|
|
204
|
+
/** Intent values that may be directly invoked (excludes non-invocation intents). */
|
|
205
|
+
export type WorkflowInvocableIntent = Exclude<WorkflowIntent, "status" | "ask-human" | "stop" | "none">;
|
|
206
|
+
export type WorkflowActionDecision = {
|
|
207
|
+
readonly kind: "invoke";
|
|
208
|
+
readonly intent: WorkflowInvocableIntent;
|
|
209
|
+
readonly targets: readonly string[];
|
|
210
|
+
readonly reasonCode: "invoke-proven-transition";
|
|
211
|
+
readonly evidenceRefs: readonly string[];
|
|
212
|
+
readonly detail: string;
|
|
213
|
+
} | {
|
|
214
|
+
readonly kind: "sense";
|
|
215
|
+
readonly intent: "status";
|
|
216
|
+
readonly targets: readonly [];
|
|
217
|
+
readonly reasonCode: WorkflowDecisionSenseReason;
|
|
218
|
+
readonly evidenceRefs: readonly string[];
|
|
219
|
+
readonly detail: string;
|
|
220
|
+
} | {
|
|
221
|
+
readonly kind: "stop";
|
|
222
|
+
readonly intent: "ask-human" | "stop";
|
|
223
|
+
readonly targets: readonly string[];
|
|
224
|
+
readonly reasonCode: WorkflowDecisionStopReason;
|
|
225
|
+
readonly evidenceRefs: readonly string[];
|
|
226
|
+
readonly detail: string;
|
|
227
|
+
};
|
|
228
|
+
/** One row of the direct-invocation transition table. */
|
|
229
|
+
export interface WorkflowTransitionTableRow {
|
|
230
|
+
/** The last validated skill / workflow intent. */
|
|
231
|
+
readonly key: WorkflowIntent;
|
|
232
|
+
/** Allowed next intents (may be empty, or contain a single literal "*" for wildcard). */
|
|
233
|
+
readonly allowed: readonly string[];
|
|
234
|
+
/** Description of the row conditions (arity, identity, state constraints). */
|
|
235
|
+
readonly condition: string;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Frozen, versioned direct-invocation transition table.
|
|
239
|
+
*
|
|
240
|
+
* Maps each last-validated skill to its allowed next intents. Rows whose
|
|
241
|
+
* `allowed` array contains a literal "frozen" permit transitions only when
|
|
242
|
+
* the snapshot repository state is "frozen"; rows with an empty array
|
|
243
|
+
* explicitly forbid any transition (return sense/stop rather than invoke).
|
|
244
|
+
*
|
|
245
|
+
* Derived condition semantics (from the Design):
|
|
246
|
+
* none → sense-initial
|
|
247
|
+
* init-workspace → exactly discover-repository-state
|
|
248
|
+
* workflow-status → broad set of planning/execution skills
|
|
249
|
+
* discover-repository-state → row allowed iff snapshot.state === "frozen"
|
|
250
|
+
* resolve-repository-state → row allowed iff snapshot.contradictions.length > 0
|
|
251
|
+
* design-feature, plan-feature → 0..n allowed, each must be a plan/execute skill
|
|
252
|
+
* plan-fix → exactly 1, must be triage-issue
|
|
253
|
+
* triage-issue → 1..n allowed, each must be an issue identity string
|
|
254
|
+
* init-workspace, discover-repository-state → 0 allowed → stop-forbidden-transition
|
|
255
|
+
* resolve-repository-state → each allowed must match a contradiction field
|
|
256
|
+
* merge → exactly 1, must be the PR identity from audit-pr
|
|
257
|
+
*/
|
|
258
|
+
export declare const WORKFLOW_TRANSITION_TABLE: readonly WorkflowTransitionTableRow[];
|
|
259
|
+
/**
|
|
260
|
+
* Decide whether a headless consumer may invoke the next skill, must refresh
|
|
261
|
+
* with workflow-status, or must stop.
|
|
262
|
+
*
|
|
263
|
+
* Pure, deterministic, fail-closed — no I/O, no randomness, no locale.
|
|
264
|
+
*/
|
|
265
|
+
export declare function decideWorkflowAction(input: WorkflowDecisionInput): WorkflowActionDecision;
|
|
266
|
+
/** Role a built-in skill plays in the workflow pipeline. */
|
|
267
|
+
export declare const SKILL_ROLES: readonly ["sensor", "planner", "executor", "reviewer", "auditor", "publisher"];
|
|
268
|
+
export type SkillRole = (typeof SKILL_ROLES)[number];
|
|
269
|
+
/** Maximum repository/forge effects permitted by a built-in profile. */
|
|
270
|
+
export declare const SKILL_EFFECTS: readonly ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"];
|
|
271
|
+
export type SkillEffect = (typeof SKILL_EFFECTS)[number];
|
|
272
|
+
/** Reasoning class a profile declares for its primary route. */
|
|
273
|
+
export declare const SKILL_REASONING: readonly ["mechanical", "semantic", "critical"];
|
|
274
|
+
export type SkillReasoning = (typeof SKILL_REASONING)[number];
|
|
275
|
+
/** Context sources a profile may consult. */
|
|
276
|
+
export declare const SKILL_CONTEXT_SOURCES: readonly ["repository", "semantic-context", "episodic-memory", "execution-state"];
|
|
277
|
+
export type SkillContextSource = (typeof SKILL_CONTEXT_SOURCES)[number];
|
|
278
|
+
/** Evidence a capability-aware driver should require before trusting results. */
|
|
279
|
+
export declare const SKILL_REQUIRED_EVIDENCE: readonly ["workflow-snapshot", "current-candidate", "verification", "independent-review", "audit", "issue-state", "pull-request-state"];
|
|
280
|
+
export type SkillRequiredEvidence = (typeof SKILL_REQUIRED_EVIDENCE)[number];
|
|
281
|
+
/**
|
|
282
|
+
* Declarative, closed-vocabulary capability metadata for a built-in profile.
|
|
283
|
+
* Repository evidence is the authoritative limit; semantic and episodic
|
|
284
|
+
* context is advisory and never extends the declared maximum effects.
|
|
285
|
+
*/
|
|
286
|
+
export interface WorkflowSkillCapabilities {
|
|
287
|
+
readonly role: SkillRole;
|
|
288
|
+
readonly reasoning: SkillReasoning;
|
|
289
|
+
readonly effects: readonly SkillEffect[];
|
|
290
|
+
readonly contextSources: readonly SkillContextSource[];
|
|
291
|
+
readonly requiredEvidence: readonly SkillRequiredEvidence[];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Public profile boundary — source-compatible for external consumers that
|
|
295
|
+
* construct or mutate profiles. The three legacy fields are writable so
|
|
296
|
+
* third-party code can assign to them without TS2540.
|
|
297
|
+
*/
|
|
176
298
|
export interface WorkflowSkillProfile {
|
|
177
299
|
skill: string;
|
|
178
300
|
output: "envelope-v2" | "skill-outcome-v1";
|
|
179
301
|
nativeFallback: "none" | "fixed-verdict";
|
|
302
|
+
/**
|
|
303
|
+
* Optional for source compatibility; every built-in populates it and a
|
|
304
|
+
* capability-aware consumer fails closed when it is absent.
|
|
305
|
+
*/
|
|
306
|
+
capabilities?: WorkflowSkillCapabilities;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Deeply readonly boundary for shipped built-in profiles. The immutable type
|
|
310
|
+
* guarantees compile-time immutability without narrowing the public boundary.
|
|
311
|
+
*/
|
|
312
|
+
export interface BuiltInSkillProfile {
|
|
313
|
+
readonly skill: string;
|
|
314
|
+
readonly output: "envelope-v2" | "skill-outcome-v1";
|
|
315
|
+
readonly nativeFallback: "none" | "fixed-verdict";
|
|
316
|
+
readonly capabilities?: Readonly<WorkflowSkillCapabilities>;
|
|
180
317
|
}
|
|
181
318
|
/**
|
|
182
319
|
* The portable skill inventory consumed by headless drivers. Profiles are
|
|
183
320
|
* programmatic metadata, not duplicated prompt sections in user-facing skills.
|
|
184
321
|
*/
|
|
185
|
-
export declare const WORKFLOW_SKILL_PROFILES: readonly
|
|
322
|
+
export declare const WORKFLOW_SKILL_PROFILES: readonly BuiltInSkillProfile[];
|
|
186
323
|
export type SkillOutcomeStatus = "completed" | "continue" | "blocked" | "needs-input" | "failed";
|
|
187
324
|
export interface SkillOutcomeBlocker {
|
|
188
325
|
kind: BlockerKind;
|
package/dist/index.js
CHANGED
|
@@ -444,24 +444,611 @@ export const WORKFLOW_INTENTS = [
|
|
|
444
444
|
"stop",
|
|
445
445
|
"none",
|
|
446
446
|
];
|
|
447
|
+
// ---------------------------------------------------------------------------
|
|
448
|
+
// Workflow transition decider — reason codes, decision types, transition table
|
|
449
|
+
// ---------------------------------------------------------------------------
|
|
450
|
+
/** Sense reason codes: transition cannot proceed without more sensor input. */
|
|
451
|
+
export const WORKFLOW_DECISION_SENSE_CODES = Object.freeze([
|
|
452
|
+
"sense-initial",
|
|
453
|
+
"sense-stale-revision",
|
|
454
|
+
"sense-missing-evidence",
|
|
455
|
+
"sense-unknown-state",
|
|
456
|
+
"sense-unlisted-transition",
|
|
457
|
+
]);
|
|
458
|
+
/** Stop reason codes: the transition is explicitly blocked or must terminate. */
|
|
459
|
+
export const WORKFLOW_DECISION_STOP_CODES = Object.freeze([
|
|
460
|
+
"stop-blocked",
|
|
461
|
+
"stop-needs-input",
|
|
462
|
+
"stop-failed",
|
|
463
|
+
"stop-contradiction",
|
|
464
|
+
"stop-policy-denied",
|
|
465
|
+
"stop-forbidden-transition",
|
|
466
|
+
]);
|
|
467
|
+
/** Invoke reason codes: transition is proven and allowed. */
|
|
468
|
+
export const WORKFLOW_DECISION_INVOKE_CODES = Object.freeze([
|
|
469
|
+
"invoke-proven-transition",
|
|
470
|
+
]);
|
|
471
|
+
/**
|
|
472
|
+
* Frozen, versioned direct-invocation transition table.
|
|
473
|
+
*
|
|
474
|
+
* Maps each last-validated skill to its allowed next intents. Rows whose
|
|
475
|
+
* `allowed` array contains a literal "frozen" permit transitions only when
|
|
476
|
+
* the snapshot repository state is "frozen"; rows with an empty array
|
|
477
|
+
* explicitly forbid any transition (return sense/stop rather than invoke).
|
|
478
|
+
*
|
|
479
|
+
* Derived condition semantics (from the Design):
|
|
480
|
+
* none → sense-initial
|
|
481
|
+
* init-workspace → exactly discover-repository-state
|
|
482
|
+
* workflow-status → broad set of planning/execution skills
|
|
483
|
+
* discover-repository-state → row allowed iff snapshot.state === "frozen"
|
|
484
|
+
* resolve-repository-state → row allowed iff snapshot.contradictions.length > 0
|
|
485
|
+
* design-feature, plan-feature → 0..n allowed, each must be a plan/execute skill
|
|
486
|
+
* plan-fix → exactly 1, must be triage-issue
|
|
487
|
+
* triage-issue → 1..n allowed, each must be an issue identity string
|
|
488
|
+
* init-workspace, discover-repository-state → 0 allowed → stop-forbidden-transition
|
|
489
|
+
* resolve-repository-state → each allowed must match a contradiction field
|
|
490
|
+
* merge → exactly 1, must be the PR identity from audit-pr
|
|
491
|
+
*/
|
|
492
|
+
export const WORKFLOW_TRANSITION_TABLE = Object.freeze([
|
|
493
|
+
// Last skill = none → no transition possible
|
|
494
|
+
{
|
|
495
|
+
key: "none",
|
|
496
|
+
allowed: [],
|
|
497
|
+
condition: "no last validated skill; return sense-initial",
|
|
498
|
+
},
|
|
499
|
+
// init-workspace → discover-repository-state only
|
|
500
|
+
{
|
|
501
|
+
key: "init-workspace",
|
|
502
|
+
allowed: ["discover-repository-state"],
|
|
503
|
+
condition: "exactly 1 target; any other target → stop-forbidden-transition",
|
|
504
|
+
},
|
|
505
|
+
// status → broad planning and execution set
|
|
506
|
+
{
|
|
507
|
+
key: "status",
|
|
508
|
+
allowed: [
|
|
509
|
+
"init-workspace",
|
|
510
|
+
"discover-repository-state",
|
|
511
|
+
"resolve-repository-state",
|
|
512
|
+
"design-feature",
|
|
513
|
+
"plan-feature",
|
|
514
|
+
"plan-fix",
|
|
515
|
+
"triage-issue",
|
|
516
|
+
"execute-phase",
|
|
517
|
+
"review-change",
|
|
518
|
+
"loop-review-fold",
|
|
519
|
+
"audit-pr",
|
|
520
|
+
"ask-human",
|
|
521
|
+
"stop",
|
|
522
|
+
],
|
|
523
|
+
condition: "all allowed intents after status",
|
|
524
|
+
},
|
|
525
|
+
// discover-repository-state → planning allowed only when repo is frozen
|
|
526
|
+
{
|
|
527
|
+
key: "discover-repository-state",
|
|
528
|
+
allowed: [
|
|
529
|
+
"resolve-repository-state",
|
|
530
|
+
"design-feature",
|
|
531
|
+
"plan-feature",
|
|
532
|
+
"plan-fix",
|
|
533
|
+
"triage-issue",
|
|
534
|
+
"execute-phase",
|
|
535
|
+
"review-change",
|
|
536
|
+
"loop-review-fold",
|
|
537
|
+
"audit-pr",
|
|
538
|
+
"ask-human",
|
|
539
|
+
"stop",
|
|
540
|
+
],
|
|
541
|
+
condition: "row allowed only when snapshot.repositoryState === 'frozen';"
|
|
542
|
+
+ " any target when state is not frozen → sense-missing-evidence",
|
|
543
|
+
},
|
|
544
|
+
// resolve-repository-state → contradiction targets only
|
|
545
|
+
{
|
|
546
|
+
key: "resolve-repository-state",
|
|
547
|
+
allowed: ["resolve-repository-state"],
|
|
548
|
+
condition: "0..n allowed, each === a snapshot contradiction field identity;"
|
|
549
|
+
+ " non-contradiction target → stop-forbidden-transition",
|
|
550
|
+
},
|
|
551
|
+
// design-feature → next roadmap unit or the active unit / named dependency
|
|
552
|
+
{
|
|
553
|
+
key: "design-feature",
|
|
554
|
+
allowed: [
|
|
555
|
+
"plan-feature",
|
|
556
|
+
"plan-fix",
|
|
557
|
+
"triage-issue",
|
|
558
|
+
"execute-phase",
|
|
559
|
+
"review-change",
|
|
560
|
+
"loop-review-fold",
|
|
561
|
+
"audit-pr",
|
|
562
|
+
"ask-human",
|
|
563
|
+
"stop",
|
|
564
|
+
],
|
|
565
|
+
condition: "0..n allowed, each must be the next roadmap unit, the active unit id,"
|
|
566
|
+
+ " or the named dependency unit recorded by the last outcome;"
|
|
567
|
+
+ " non-allowed target → stop-forbidden-transition",
|
|
568
|
+
},
|
|
569
|
+
// plan-feature → active or dependency unit, max 1
|
|
570
|
+
{
|
|
571
|
+
key: "plan-feature",
|
|
572
|
+
allowed: [
|
|
573
|
+
"triage-issue",
|
|
574
|
+
"execute-phase",
|
|
575
|
+
"review-change",
|
|
576
|
+
"loop-review-fold",
|
|
577
|
+
"audit-pr",
|
|
578
|
+
"ask-human",
|
|
579
|
+
"stop",
|
|
580
|
+
],
|
|
581
|
+
condition: "0..1 allowed; 0 → next roadmap unit; 1 → active unit id or named dependency;"
|
|
582
|
+
+ ">1 → stop-forbidden-transition",
|
|
583
|
+
},
|
|
584
|
+
// plan-fix → triage-issue only, exactly 1
|
|
585
|
+
{
|
|
586
|
+
key: "plan-fix",
|
|
587
|
+
allowed: ["triage-issue"],
|
|
588
|
+
condition: "exactly 1 target (the issue identity); 0 → sense-missing-evidence;"
|
|
589
|
+
+ ">1 → stop-forbidden-transition",
|
|
590
|
+
},
|
|
591
|
+
// triage-issue → issue identities, 1..n
|
|
592
|
+
{
|
|
593
|
+
key: "triage-issue",
|
|
594
|
+
allowed: [
|
|
595
|
+
"execute-phase",
|
|
596
|
+
"review-change",
|
|
597
|
+
"loop-review-fold",
|
|
598
|
+
"audit-pr",
|
|
599
|
+
"ask-human",
|
|
600
|
+
"stop",
|
|
601
|
+
],
|
|
602
|
+
condition: "1..n allowed, each must be an issue identity recorded by the last outcome;"
|
|
603
|
+
+ " 0 → sense-missing-evidence",
|
|
604
|
+
},
|
|
605
|
+
// execute-phase → planning and execution, max 1
|
|
606
|
+
{
|
|
607
|
+
key: "execute-phase",
|
|
608
|
+
allowed: [
|
|
609
|
+
"design-feature",
|
|
610
|
+
"plan-feature",
|
|
611
|
+
"plan-fix",
|
|
612
|
+
"triage-issue",
|
|
613
|
+
"review-change",
|
|
614
|
+
"loop-review-fold",
|
|
615
|
+
"audit-pr",
|
|
616
|
+
"ask-human",
|
|
617
|
+
"stop",
|
|
618
|
+
],
|
|
619
|
+
condition: "0..1 allowed; each must be a plan/execute skill or ask-human/stop;"
|
|
620
|
+
+ ">1 → stop-forbidden-transition",
|
|
621
|
+
},
|
|
622
|
+
// review-change → planning and execution
|
|
623
|
+
{
|
|
624
|
+
key: "review-change",
|
|
625
|
+
allowed: [
|
|
626
|
+
"plan-feature",
|
|
627
|
+
"plan-fix",
|
|
628
|
+
"triage-issue",
|
|
629
|
+
"execute-phase",
|
|
630
|
+
"review-change",
|
|
631
|
+
"loop-review-fold",
|
|
632
|
+
"audit-pr",
|
|
633
|
+
"ask-human",
|
|
634
|
+
"stop",
|
|
635
|
+
],
|
|
636
|
+
condition: "0..n allowed, each must be a plan/execute/review skill or ask-human/stop;"
|
|
637
|
+
+ " non-allowed target → stop-forbidden-transition",
|
|
638
|
+
},
|
|
639
|
+
// loop-review-fold → planning and execution
|
|
640
|
+
{
|
|
641
|
+
key: "loop-review-fold",
|
|
642
|
+
allowed: [
|
|
643
|
+
"plan-feature",
|
|
644
|
+
"plan-fix",
|
|
645
|
+
"triage-issue",
|
|
646
|
+
"execute-phase",
|
|
647
|
+
"review-change",
|
|
648
|
+
"loop-review-fold",
|
|
649
|
+
"audit-pr",
|
|
650
|
+
"ask-human",
|
|
651
|
+
"stop",
|
|
652
|
+
],
|
|
653
|
+
condition: "0..n allowed, each must be a plan/execute/review skill or ask-human/stop;"
|
|
654
|
+
+ " non-allowed target → stop-forbidden-transition",
|
|
655
|
+
},
|
|
656
|
+
// audit-pr → merge, execute-phase, or stop
|
|
657
|
+
{
|
|
658
|
+
key: "audit-pr",
|
|
659
|
+
allowed: ["merge", "execute-phase", "ask-human", "stop"],
|
|
660
|
+
condition: "exactly 1 allowed: merge, execute-phase, ask-human, or stop;"
|
|
661
|
+
+ ">1 → stop-forbidden-transition",
|
|
662
|
+
},
|
|
663
|
+
// merge → none (end of pipeline)
|
|
664
|
+
{
|
|
665
|
+
key: "merge",
|
|
666
|
+
allowed: [],
|
|
667
|
+
condition: "merge is the terminal action; no allowed transitions;"
|
|
668
|
+
+ " any target → stop-forbidden-transition",
|
|
669
|
+
},
|
|
670
|
+
]);
|
|
671
|
+
// ---------------------------------------------------------------------------
|
|
672
|
+
// Workflow transition decider — decideWorkflowAction pipeline
|
|
673
|
+
// ---------------------------------------------------------------------------
|
|
674
|
+
/** Build evidence refs from snapshot provenance and contradictions. */
|
|
675
|
+
function buildEvidenceRefs(snapshot, lastOutcome) {
|
|
676
|
+
const refs = [];
|
|
677
|
+
for (const p of snapshot.provenance) {
|
|
678
|
+
refs.push(`${p.field}@${p.source}:${p.line}`);
|
|
679
|
+
}
|
|
680
|
+
for (const c of snapshot.contradictions) {
|
|
681
|
+
refs.push(`contradiction:${c.field}`);
|
|
682
|
+
}
|
|
683
|
+
if (lastOutcome && lastOutcome.evidence_refs.length > 0) {
|
|
684
|
+
refs.push(...lastOutcome.evidence_refs);
|
|
685
|
+
}
|
|
686
|
+
return refs;
|
|
687
|
+
}
|
|
688
|
+
/** Check effect authorization: the target skill must declare at least one effect.
|
|
689
|
+
* Built-in terminal actions without a capability profile are allowed.
|
|
690
|
+
*/
|
|
691
|
+
function checkEffectAuth(intent) {
|
|
692
|
+
const profile = workflowSkillProfile(intent);
|
|
693
|
+
if (profile === undefined)
|
|
694
|
+
return true; // no profile → allowed (built-in terminal)
|
|
695
|
+
return profile.capabilities !== undefined && profile.capabilities.effects.length > 0;
|
|
696
|
+
}
|
|
697
|
+
/** Check evidence authorization: all required evidence must be present.
|
|
698
|
+
* Intents without a capability profile are allowed (no required evidence).
|
|
699
|
+
*/
|
|
700
|
+
function checkEvidenceAuth(intent, evidenceRefs) {
|
|
701
|
+
const profile = workflowSkillProfile(intent);
|
|
702
|
+
if (profile === undefined)
|
|
703
|
+
return true; // no profile → allowed
|
|
704
|
+
const required = profile.capabilities?.requiredEvidence;
|
|
705
|
+
if (required === undefined || required.length === 0)
|
|
706
|
+
return true;
|
|
707
|
+
for (const req of required) {
|
|
708
|
+
if (!evidenceRefs.includes(req))
|
|
709
|
+
return false;
|
|
710
|
+
}
|
|
711
|
+
return true;
|
|
712
|
+
}
|
|
713
|
+
/** Policy gate: check allowed intents and forge-write authorization. */
|
|
714
|
+
function checkPolicyGate(intent, policy) {
|
|
715
|
+
if (!policy.allowedIntents.includes(intent))
|
|
716
|
+
return false;
|
|
717
|
+
if (policy.forgeWriteAuthorized === false && intent === "merge")
|
|
718
|
+
return false;
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Decide whether a headless consumer may invoke the next skill, must refresh
|
|
723
|
+
* with workflow-status, or must stop.
|
|
724
|
+
*
|
|
725
|
+
* Pure, deterministic, fail-closed — no I/O, no randomness, no locale.
|
|
726
|
+
*/
|
|
727
|
+
export function decideWorkflowAction(input) {
|
|
728
|
+
// Defensive: malformed input never throws
|
|
729
|
+
if (typeof input !== "object" || input === null ||
|
|
730
|
+
!("snapshot" in input) || !("lastOutcome" in input) || !("policy" in input)) {
|
|
731
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-missing-evidence", evidenceRefs: [], detail: "malformed input" };
|
|
732
|
+
}
|
|
733
|
+
const policy = input.policy;
|
|
734
|
+
if (typeof policy !== "object" || policy === null || !("allowedIntents" in policy) || !("forgeWriteAuthorized" in policy)) {
|
|
735
|
+
return { kind: "stop", intent: "stop", targets: [], reasonCode: "stop-policy-denied", evidenceRefs: [], detail: "malformed policy" };
|
|
736
|
+
}
|
|
737
|
+
const typedPolicy = policy;
|
|
738
|
+
// Validate snapshot
|
|
739
|
+
const snapshotResult = validateWorkflowSnapshotV1(input.snapshot);
|
|
740
|
+
if (!snapshotResult.ok) {
|
|
741
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-missing-evidence", evidenceRefs: [], detail: `malformed snapshot: ${snapshotResult.errors.join(", ")}` };
|
|
742
|
+
}
|
|
743
|
+
const snapshot = snapshotResult.snapshot;
|
|
744
|
+
// Initial: no last outcome
|
|
745
|
+
if (input.lastOutcome === null) {
|
|
746
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-initial", evidenceRefs: [], detail: "no last validated outcome" };
|
|
747
|
+
}
|
|
748
|
+
// Freshness: stale revision
|
|
749
|
+
if (input.lastOutcomeSourceRevision !== null &&
|
|
750
|
+
snapshot.sourceRevision !== input.lastOutcomeSourceRevision) {
|
|
751
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-stale-revision", evidenceRefs: [], detail: `outcome from revision ${input.lastOutcomeSourceRevision} does not match current ${snapshot.sourceRevision}` };
|
|
752
|
+
}
|
|
753
|
+
// Build evidence refs
|
|
754
|
+
const evidenceRefs = buildEvidenceRefs(snapshot, input.lastOutcome);
|
|
755
|
+
// Outcome-status stop routing
|
|
756
|
+
const status = input.lastOutcome.status;
|
|
757
|
+
if (status === "blocked") {
|
|
758
|
+
return { kind: "stop", intent: "stop", targets: input.lastOutcome.blockers.map((b) => b.id), reasonCode: "stop-blocked", evidenceRefs: [], detail: "outcome blocked" };
|
|
759
|
+
}
|
|
760
|
+
if (status === "needs-input") {
|
|
761
|
+
return { kind: "stop", intent: "stop", targets: input.lastOutcome.questions.map((q) => q.id), reasonCode: "stop-needs-input", evidenceRefs: [], detail: "outcome needs input" };
|
|
762
|
+
}
|
|
763
|
+
if (status === "failed") {
|
|
764
|
+
const targets = input.lastOutcome.discoveries.length > 0
|
|
765
|
+
? input.lastOutcome.discoveries.map((d) => d.summary)
|
|
766
|
+
: [];
|
|
767
|
+
return { kind: "stop", intent: "stop", targets, reasonCode: "stop-failed", evidenceRefs: [], detail: "outcome failed" };
|
|
768
|
+
}
|
|
769
|
+
// Contradiction routing
|
|
770
|
+
if (snapshot.contradictions.length > 0) {
|
|
771
|
+
const proposal = input.lastOutcome.next.intent;
|
|
772
|
+
if (proposal === "resolve-repository-state") {
|
|
773
|
+
const contradictionFields = snapshot.contradictions.map((c) => c.field);
|
|
774
|
+
const allowedContradictionTargets = contradictionFields.length > 0
|
|
775
|
+
? ["resolve-repository-state"]
|
|
776
|
+
: [];
|
|
777
|
+
if (allowedContradictionTargets.includes(proposal)) {
|
|
778
|
+
return {
|
|
779
|
+
kind: "stop", intent: "stop", targets: contradictionFields,
|
|
780
|
+
reasonCode: "stop-contradiction",
|
|
781
|
+
evidenceRefs: snapshot.contradictions.map((c) => `contradiction:${c.field}`),
|
|
782
|
+
detail: "snapshot contradictions present",
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
// Non-matching proposal under contradiction
|
|
787
|
+
return {
|
|
788
|
+
kind: "stop", intent: "stop", targets: [],
|
|
789
|
+
reasonCode: "stop-contradiction",
|
|
790
|
+
evidenceRefs: snapshot.contradictions.map((c) => `contradiction:${c.field}`),
|
|
791
|
+
detail: "snapshot contradictions present",
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
// Recommendation → closed-table match
|
|
795
|
+
const proposal = input.lastOutcome.next.intent;
|
|
796
|
+
const targets = input.lastOutcome.next.targets || [];
|
|
797
|
+
const lastSkill = input.lastOutcome.skill;
|
|
798
|
+
const entry = WORKFLOW_TRANSITION_TABLE.find((r) => r.key === lastSkill);
|
|
799
|
+
if (entry === undefined) {
|
|
800
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-unlisted-transition", evidenceRefs: [], detail: `unlisted transition: ${lastSkill}` };
|
|
801
|
+
}
|
|
802
|
+
// Check if proposal is in the allowed list for the last skill
|
|
803
|
+
if (!entry.allowed.includes(proposal)) {
|
|
804
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-unlisted-transition", evidenceRefs: [], detail: `${proposal} not allowed after ${entry.key}` };
|
|
805
|
+
}
|
|
806
|
+
// Row condition checks
|
|
807
|
+
if (proposal === "discover-repository-state") {
|
|
808
|
+
if (snapshot.repositoryState !== "frozen") {
|
|
809
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-missing-evidence", evidenceRefs: [], detail: "repository not frozen" };
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
if (lastSkill === "resolve-repository-state") {
|
|
813
|
+
const contradictionFields = snapshot.contradictions.map((c) => c.field);
|
|
814
|
+
if (contradictionFields.length > 0 && !contradictionFields.includes(targets[0])) {
|
|
815
|
+
return { kind: "stop", intent: "stop", targets, reasonCode: "stop-forbidden-transition", evidenceRefs: [], detail: `target ${targets[0]} does not match contradiction fields` };
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
// Effect authorization
|
|
819
|
+
if (!checkEffectAuth(proposal)) {
|
|
820
|
+
return { kind: "stop", intent: "stop", targets: [], reasonCode: "stop-forbidden-transition", evidenceRefs: [], detail: "unauthorized effect" };
|
|
821
|
+
}
|
|
822
|
+
// Evidence authorization
|
|
823
|
+
if (!checkEvidenceAuth(proposal, evidenceRefs)) {
|
|
824
|
+
return { kind: "sense", intent: "status", targets: [], reasonCode: "sense-missing-evidence", evidenceRefs: [], detail: "missing required evidence" };
|
|
825
|
+
}
|
|
826
|
+
// Policy gate
|
|
827
|
+
if (!checkPolicyGate(proposal, typedPolicy)) {
|
|
828
|
+
return { kind: "stop", intent: "stop", targets: [], reasonCode: "stop-policy-denied", evidenceRefs: [], detail: "policy denied" };
|
|
829
|
+
}
|
|
830
|
+
// Non-invocable intents can never reach invoke
|
|
831
|
+
if (proposal === "status" || proposal === "ask-human" || proposal === "stop" || proposal === "none") {
|
|
832
|
+
return { kind: "stop", intent: "stop", targets: [], reasonCode: "stop-forbidden-transition", evidenceRefs: [], detail: "non-invocable intent" };
|
|
833
|
+
}
|
|
834
|
+
// Target count validation for audit-pr: exactly 1 target
|
|
835
|
+
if (lastSkill === "audit-pr" && targets.length !== 1) {
|
|
836
|
+
return { kind: "stop", intent: "stop", targets, reasonCode: "stop-forbidden-transition", evidenceRefs: [], detail: targets.length === 0 ? "missing target" : "extra targets" };
|
|
837
|
+
}
|
|
838
|
+
// Proven transition — invoke
|
|
839
|
+
const invocable = proposal;
|
|
840
|
+
// Proven transition — invoke
|
|
841
|
+
return {
|
|
842
|
+
kind: "invoke", intent: invocable,
|
|
843
|
+
targets: targets.length > 0 ? targets : [],
|
|
844
|
+
reasonCode: "invoke-proven-transition",
|
|
845
|
+
evidenceRefs,
|
|
846
|
+
detail: `invoke-proven-transition: ${proposal} to [${targets.join(", ") || "*"}]`,
|
|
847
|
+
};
|
|
848
|
+
}
|
|
849
|
+
// ---------------------------------------------------------------------------
|
|
850
|
+
// Capability metadata — closed vocabularies, immutable exports (issue #136)
|
|
851
|
+
// ---------------------------------------------------------------------------
|
|
852
|
+
/** Role a built-in skill plays in the workflow pipeline. */
|
|
853
|
+
export const SKILL_ROLES = Object.freeze([
|
|
854
|
+
"sensor",
|
|
855
|
+
"planner",
|
|
856
|
+
"executor",
|
|
857
|
+
"reviewer",
|
|
858
|
+
"auditor",
|
|
859
|
+
"publisher",
|
|
860
|
+
]);
|
|
861
|
+
/** Maximum repository/forge effects permitted by a built-in profile. */
|
|
862
|
+
export const SKILL_EFFECTS = Object.freeze([
|
|
863
|
+
"repository-read",
|
|
864
|
+
"repository-write",
|
|
865
|
+
"git-write",
|
|
866
|
+
"forge-read",
|
|
867
|
+
"forge-write",
|
|
868
|
+
]);
|
|
869
|
+
/** Reasoning class a profile declares for its primary route. */
|
|
870
|
+
export const SKILL_REASONING = Object.freeze([
|
|
871
|
+
"mechanical",
|
|
872
|
+
"semantic",
|
|
873
|
+
"critical",
|
|
874
|
+
]);
|
|
875
|
+
/** Context sources a profile may consult. */
|
|
876
|
+
export const SKILL_CONTEXT_SOURCES = Object.freeze([
|
|
877
|
+
"repository",
|
|
878
|
+
"semantic-context",
|
|
879
|
+
"episodic-memory",
|
|
880
|
+
"execution-state",
|
|
881
|
+
]);
|
|
882
|
+
/** Evidence a capability-aware driver should require before trusting results. */
|
|
883
|
+
export const SKILL_REQUIRED_EVIDENCE = Object.freeze([
|
|
884
|
+
"workflow-snapshot",
|
|
885
|
+
"current-candidate",
|
|
886
|
+
"verification",
|
|
887
|
+
"independent-review",
|
|
888
|
+
"audit",
|
|
889
|
+
"issue-state",
|
|
890
|
+
"pull-request-state",
|
|
891
|
+
]);
|
|
892
|
+
/** Recursively freezes exported metadata so runtime widening is impossible. */
|
|
893
|
+
function deepFreeze(value) {
|
|
894
|
+
if (value !== null && typeof value === "object") {
|
|
895
|
+
for (const key of Object.keys(value)) {
|
|
896
|
+
deepFreeze(value[key]);
|
|
897
|
+
}
|
|
898
|
+
Object.freeze(value);
|
|
899
|
+
}
|
|
900
|
+
return value;
|
|
901
|
+
}
|
|
447
902
|
/**
|
|
448
903
|
* The portable skill inventory consumed by headless drivers. Profiles are
|
|
449
904
|
* programmatic metadata, not duplicated prompt sections in user-facing skills.
|
|
450
905
|
*/
|
|
451
|
-
export const WORKFLOW_SKILL_PROFILES = [
|
|
452
|
-
{
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
906
|
+
export const WORKFLOW_SKILL_PROFILES = deepFreeze([
|
|
907
|
+
{
|
|
908
|
+
skill: "init-workspace",
|
|
909
|
+
output: "skill-outcome-v1",
|
|
910
|
+
nativeFallback: "none",
|
|
911
|
+
capabilities: {
|
|
912
|
+
role: "executor",
|
|
913
|
+
reasoning: "semantic",
|
|
914
|
+
effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
|
|
915
|
+
contextSources: ["repository", "semantic-context"],
|
|
916
|
+
requiredEvidence: [],
|
|
917
|
+
},
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
skill: "workflow-status",
|
|
921
|
+
output: "envelope-v2",
|
|
922
|
+
nativeFallback: "none",
|
|
923
|
+
capabilities: {
|
|
924
|
+
role: "sensor",
|
|
925
|
+
reasoning: "mechanical",
|
|
926
|
+
effects: ["repository-read", "forge-read"],
|
|
927
|
+
contextSources: ["repository", "execution-state"],
|
|
928
|
+
requiredEvidence: ["workflow-snapshot"],
|
|
929
|
+
},
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
skill: "discover-repository-state",
|
|
933
|
+
output: "skill-outcome-v1",
|
|
934
|
+
nativeFallback: "none",
|
|
935
|
+
capabilities: {
|
|
936
|
+
role: "sensor",
|
|
937
|
+
reasoning: "semantic",
|
|
938
|
+
effects: ["repository-read", "repository-write", "git-write"],
|
|
939
|
+
contextSources: ["repository", "semantic-context"],
|
|
940
|
+
requiredEvidence: [],
|
|
941
|
+
},
|
|
942
|
+
},
|
|
943
|
+
{
|
|
944
|
+
skill: "resolve-repository-state",
|
|
945
|
+
output: "skill-outcome-v1",
|
|
946
|
+
nativeFallback: "none",
|
|
947
|
+
capabilities: {
|
|
948
|
+
role: "planner",
|
|
949
|
+
reasoning: "critical",
|
|
950
|
+
effects: ["repository-read", "repository-write"],
|
|
951
|
+
contextSources: ["repository", "semantic-context", "execution-state"],
|
|
952
|
+
requiredEvidence: ["workflow-snapshot"],
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
{
|
|
956
|
+
skill: "design-feature",
|
|
957
|
+
output: "skill-outcome-v1",
|
|
958
|
+
nativeFallback: "none",
|
|
959
|
+
capabilities: {
|
|
960
|
+
role: "planner",
|
|
961
|
+
reasoning: "critical",
|
|
962
|
+
effects: ["repository-read", "repository-write", "forge-read"],
|
|
963
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
964
|
+
requiredEvidence: ["workflow-snapshot"],
|
|
965
|
+
},
|
|
966
|
+
},
|
|
967
|
+
{
|
|
968
|
+
skill: "plan-feature",
|
|
969
|
+
output: "skill-outcome-v1",
|
|
970
|
+
nativeFallback: "none",
|
|
971
|
+
capabilities: {
|
|
972
|
+
role: "planner",
|
|
973
|
+
reasoning: "critical",
|
|
974
|
+
effects: ["repository-read", "repository-write", "forge-read"],
|
|
975
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
976
|
+
requiredEvidence: ["workflow-snapshot"],
|
|
977
|
+
},
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
skill: "plan-fix",
|
|
981
|
+
output: "skill-outcome-v1",
|
|
982
|
+
nativeFallback: "none",
|
|
983
|
+
capabilities: {
|
|
984
|
+
role: "planner",
|
|
985
|
+
reasoning: "critical",
|
|
986
|
+
effects: ["repository-read", "repository-write", "git-write", "forge-read"],
|
|
987
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
988
|
+
requiredEvidence: ["workflow-snapshot", "issue-state"],
|
|
989
|
+
},
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
skill: "triage-issue",
|
|
993
|
+
output: "skill-outcome-v1",
|
|
994
|
+
nativeFallback: "none",
|
|
995
|
+
capabilities: {
|
|
996
|
+
role: "planner",
|
|
997
|
+
reasoning: "critical",
|
|
998
|
+
effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
|
|
999
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
1000
|
+
requiredEvidence: ["workflow-snapshot", "issue-state"],
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
{
|
|
1004
|
+
skill: "execute-phase",
|
|
1005
|
+
output: "skill-outcome-v1",
|
|
1006
|
+
nativeFallback: "none",
|
|
1007
|
+
capabilities: {
|
|
1008
|
+
role: "executor",
|
|
1009
|
+
reasoning: "semantic",
|
|
1010
|
+
effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
|
|
1011
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
1012
|
+
requiredEvidence: ["workflow-snapshot", "current-candidate"],
|
|
1013
|
+
},
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
skill: "review-change",
|
|
1017
|
+
output: "skill-outcome-v1",
|
|
1018
|
+
nativeFallback: "none",
|
|
1019
|
+
capabilities: {
|
|
1020
|
+
role: "reviewer",
|
|
1021
|
+
reasoning: "critical",
|
|
1022
|
+
effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
|
|
1023
|
+
contextSources: ["repository", "semantic-context", "execution-state"],
|
|
1024
|
+
requiredEvidence: ["current-candidate", "verification"],
|
|
1025
|
+
},
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
skill: "loop-review-fold",
|
|
1029
|
+
output: "skill-outcome-v1",
|
|
1030
|
+
nativeFallback: "fixed-verdict",
|
|
1031
|
+
capabilities: {
|
|
1032
|
+
role: "reviewer",
|
|
1033
|
+
reasoning: "critical",
|
|
1034
|
+
effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
|
|
1035
|
+
contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
|
|
1036
|
+
requiredEvidence: ["current-candidate", "independent-review"],
|
|
1037
|
+
},
|
|
1038
|
+
},
|
|
1039
|
+
{
|
|
1040
|
+
skill: "audit-pr",
|
|
1041
|
+
output: "skill-outcome-v1",
|
|
1042
|
+
nativeFallback: "fixed-verdict",
|
|
1043
|
+
capabilities: {
|
|
1044
|
+
role: "auditor",
|
|
1045
|
+
reasoning: "critical",
|
|
1046
|
+
effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
|
|
1047
|
+
contextSources: ["repository", "semantic-context", "execution-state"],
|
|
1048
|
+
requiredEvidence: ["current-candidate", "verification", "independent-review", "pull-request-state"],
|
|
1049
|
+
},
|
|
1050
|
+
},
|
|
1051
|
+
]);
|
|
465
1052
|
function workflowSkillProfile(skill) {
|
|
466
1053
|
return WORKFLOW_SKILL_PROFILES.find((profile) => profile.skill === skill);
|
|
467
1054
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/agentic-workflow-schema",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Versioned machine contracts, JSON Schemas, parsers, and deterministic document snapshots for agentic-workflow orchestration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-workflow",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"build": "tsc",
|
|
50
|
-
"test": "tsc && node --test test/*.test.mjs",
|
|
50
|
+
"test": "tsc && tsc -p tsconfig.test.json && node --test test/*.test.mjs",
|
|
51
51
|
"prepublishOnly": "npm test"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|