@gtrabanco/agentic-workflow-schema 1.0.2 → 2.1.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 +206 -0
- package/README.md +8 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.js +39 -2
- package/envelope.schema.json +21 -5
- package/package.json +2 -1
package/README.es.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# @gtrabanco/agentic-workflow-schema
|
|
2
|
+
|
|
3
|
+
> 🇬🇧 [English version](README.md)
|
|
4
|
+
|
|
5
|
+
Tipos, JSON Schema, y parser/validador para el **sobre-máquina** de
|
|
6
|
+
[agentic-workflow](https://github.com/gtrabanco/agentic-workflow) — el
|
|
7
|
+
bloque JSON fijo con el que termina un turno de agente conducido (emitido
|
|
8
|
+
siempre por `workflow-status`, y por cualquier otra skill cuando el driver
|
|
9
|
+
inyecta el fragmento canónico de system-prompt — ver el protocolo de driver
|
|
10
|
+
abajo), para que orquestadores externos puedan enrutar el flujo de trabajo
|
|
11
|
+
programáticamente (qué comando sigue, en qué nivel de modelo).
|
|
12
|
+
|
|
13
|
+
Cero dependencias en tiempo de ejecución. Fuente de verdad del contrato:
|
|
14
|
+
[`skills/orchestration-envelope/SKILL.md`](https://github.com/gtrabanco/agentic-workflow/blob/main/skills/orchestration-envelope/SKILL.md);
|
|
15
|
+
protocolo de driver:
|
|
16
|
+
[`docs/workflow/ORCHESTRATION.md`](https://github.com/gtrabanco/agentic-workflow/blob/main/docs/workflow/ORCHESTRATION.md).
|
|
17
|
+
|
|
18
|
+
## Instalación
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npm install @gtrabanco/agentic-workflow-schema
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Uso
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import {
|
|
28
|
+
parseEnvelope,
|
|
29
|
+
isTerminal,
|
|
30
|
+
isRunHalt,
|
|
31
|
+
} from "@gtrabanco/agentic-workflow-schema";
|
|
32
|
+
|
|
33
|
+
const output = await runAgentHeadless("Follow the installed SKILL.md for: /workflow-status --json-only");
|
|
34
|
+
|
|
35
|
+
const result = parseEnvelope(output); // extracts the LAST fenced ```json block
|
|
36
|
+
if (!result.ok) throw new Error(result.errors.join("; "));
|
|
37
|
+
|
|
38
|
+
const env = result.envelope; // fully typed
|
|
39
|
+
if (isRunHalt(env)) stopEverythingAndPage(env.blockers);
|
|
40
|
+
else if (isTerminal(env.state)) askHuman(env);
|
|
41
|
+
else invokeNext(env.next.recommended, env.next.tier); // "strong" | "cheap"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
El contrato de parseo es exactamente lo que prometen las skills: **el
|
|
45
|
+
último bloque
|
|
46
|
+
```` ```json ````…```` ``` ```` entre comillas del mensaje final es el
|
|
47
|
+
sobre**, uno por turno, todas las claves de nivel superior siempre
|
|
48
|
+
presentes.
|
|
49
|
+
|
|
50
|
+
También exportados: `extractLastJsonBlock(text)`, `validateEnvelope(value)`,
|
|
51
|
+
`ENVELOPE_STATES` (el enum de 11 estados), `TERMINAL_STATES`, y cada tipo
|
|
52
|
+
de campo. También se distribuye un **JSON Schema** agnóstico de lenguaje —
|
|
53
|
+
funciona con el mínimo de `engines.node` (>=18):
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { createRequire } from "node:module";
|
|
57
|
+
const schema = createRequire(import.meta.url)("@gtrabanco/agentic-workflow-schema/envelope.schema.json");
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
En Node 20.10+/22, la forma más nueva de import-attributes también
|
|
61
|
+
funciona:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import schema from "@gtrabanco/agentic-workflow-schema/envelope.schema.json" with { type: "json" };
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## El sobre, campo por campo
|
|
68
|
+
|
|
69
|
+
Cada clave de nivel superior está **siempre presente** (`required` en el
|
|
70
|
+
JSON Schema) — una skill que no tiene nada que reportar para una clave usa
|
|
71
|
+
`null` / `[]` / `0`, nunca la omite. **Cerrado** = el enum exacto de abajo
|
|
72
|
+
es exhaustivo (el validador rechaza cualquier otra cosa); **abierto** =
|
|
73
|
+
forma libre, cualquier valor del tipo indicado.
|
|
74
|
+
|
|
75
|
+
| Campo | Tipo | Valores | Significado |
|
|
76
|
+
|---|---|---|---|
|
|
77
|
+
| `skill` | string | abierto (no vacío) | Qué skill produjo este sobre. |
|
|
78
|
+
| `state` | enum | **cerrado** — los 11 estados de abajo | La clave de enrutamiento. Todo lo que decide un orquestador empieza aquí. |
|
|
79
|
+
| `summary` | string | abierto | Una frase en texto plano: qué pasó este turno. |
|
|
80
|
+
| `unit.type` | enum | **cerrado** — `feature` · `fix` · `docs` · `none` | Qué tipo de unidad trabajó el turno. |
|
|
81
|
+
| `unit.id` | string\|null | abierto | El identificador de la unidad (`NN-slug` para features, `n-topic` para fixes). |
|
|
82
|
+
| `unit.issue` | integer\|null | abierto | El número del issue de rastreo, cuando la unidad nace de un issue. |
|
|
83
|
+
| `unit.branch` | string\|null | abierto | La rama de trabajo. |
|
|
84
|
+
| `phase.current` | string\|null | abierto (por convención `P1`, `P2`, …) | Fase recién trabajada, para features en fases (M/L). |
|
|
85
|
+
| `phase.total` / `phase.completed` | integer\|null | abierto | Recuentos de fase; `null` para unidades de pase único. |
|
|
86
|
+
| `pr.number` / `pr.url` / `pr.head_sha` | int/str\|null | abierto | El PR de la unidad, una vez que existe. |
|
|
87
|
+
| `pr.state` | enum | **cerrado** — `open` · `merged` · `none` | El estado de merge vive en la forja, no en el roadmap. |
|
|
88
|
+
| `pr.merge_ready` | boolean\|null | abierto | `true` solo después de un veredicto MERGE-READY de `audit-pr` sobre la cabeza actual. |
|
|
89
|
+
| `pr.ci` | enum | **cerrado** — `green` · `red` · `pending` · `none` · `null` | `none` = el proyecto no tiene CI; `null` = no comprobado este turno. |
|
|
90
|
+
| `gates.verification` | enum | **cerrado** — `green` · `red` · `not-run` · `null` | La propia puerta del proyecto (chequeo de tipos + tests + build) tal como se ejecutó por última vez. |
|
|
91
|
+
| `gates.review_pending` / `gates.audit_pending` | boolean\|null | abierto | Si la revisión obligatoria / auditoría de merge todavía tiene que suceder. |
|
|
92
|
+
| `findings.fix_now[]` | array de objetos | items: `id`/`file`/`axis`/`class`/`route` (abierto), `severity` (**cerrado** — `high`·`med`·`low`), `suggested_tier` (**cerrado** — `strong`·`cheap`) | Hallazgos que deben incorporarse a la rama ACTUAL antes de que avance — un item por cada fila sin foldear del ledger de fold fix-now (`review-findings.md`) de la unidad. |
|
|
93
|
+
| `findings.issues_filed[]` | array de enteros | abierto | Números de issue creados/actualizados este turno. |
|
|
94
|
+
| `findings.untriaged` | integer ≥ 0 | abierto | Hallazgos todavía sin destino — las skills cuyo contrato enruta todo deben reportar `0`. |
|
|
95
|
+
| `findings.decisions_recorded` | integer ≥ 0 | abierto | Decisiones escritas en registros clase `decisions.md` este turno. |
|
|
96
|
+
| `blockers[].kind` | enum | **cerrado** — `dependency` · `issue` · `gate` · `merge-conflict` · `substrate` · `input` | Por qué la unidad (o la ejecución) no puede avanzar. |
|
|
97
|
+
| `blockers[].scope` | enum | **cerrado** — `unit` · `run` | `run` significa parar-el-mundo: nada más avanza tampoco. |
|
|
98
|
+
| `blockers[].id` / `blockers[].detail` | string | abierto | Qué exactamente (un slug, `#N`, un nombre de check) + una línea de contexto. |
|
|
99
|
+
| `dependencies.unmet[]` / `dependencies.build_order[]` | arrays de string | abierto | Referencias de roadmap/issue no cumplidas, y el orden más-profundo-primero para construirlas. |
|
|
100
|
+
| `recommendations.product_audit` | boolean | abierto | `true` cuando una desviación recurrente sugiere que las suposiciones fundacionales están obsoletas. |
|
|
101
|
+
| `recommendations.reason` | string\|null | abierto | Por qué (requerido en la práctica cuando el flag es `true`). |
|
|
102
|
+
| `needs_input` | object\|null | `question` (abierto) + `options[]` (abierto) | No-nulo solo en `state: NEEDS_INPUT` — la decisión humana a mostrar, con opciones concretas. Nada se adivinó. |
|
|
103
|
+
| `next.recommended` | string | abierto (una invocación de skill) | El único mejor comando siguiente. |
|
|
104
|
+
| `next.alternatives[]` | array de string | abierto | Las otras elecciones defendibles. |
|
|
105
|
+
| `next.tier` | enum | **cerrado** — `strong` · `cheap` | Qué clase de modelo merece el siguiente paso — juicio vs. mecánico. |
|
|
106
|
+
| `next.suggested[]` | array de objetos, opcional | items: `command`/`trigger`/`source_skill` (todos strings abiertos) | Sugerencias atribuidas a un disparador (solo `workflow-status`) — cada entrada nombra el comando, la condición exacta que lo disparó, y la skill dueña de esa condición; con fuente única, nunca una segunda copia de la lógica del disparador. Ausente en sobres que no lo emiten. |
|
|
107
|
+
| `detail` | any | abierto (específico de la skill) | Carga útil por skill — p. ej. `workflow-status` lleva aquí el árbol completo del proyecto (`features`, `fixes`, `startable_now`, `blocked_units`, `crash_recovery`, …). |
|
|
108
|
+
|
|
109
|
+
### La tabla de enrutamiento de `state` (cerrada — exactamente estos 11)
|
|
110
|
+
|
|
111
|
+
| `state` | Significado | Acción del orquestador |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `OK` | La skill terminó su trabajo | Invocar `next.recommended` en `next.tier` |
|
|
114
|
+
| `CONTINUE` | Misma unidad, más del mismo trabajo | Reinvocar `next.recommended` (los checkpoints consultivos también aterrizan aquí — la alternativa está listada) |
|
|
115
|
+
| `READY_FOR_REVIEW` | Unidad terminada; revisión obligatoria a continuación | `/review-change` en un modelo fuerte, contexto nuevo |
|
|
116
|
+
| `READY_FOR_AUDIT` | Revisión limpia | `/audit-pr` (fuerte) |
|
|
117
|
+
| `MERGE_READY` | Auditoría aprobada sobre el SHA de cabeza actual | El humano fusiona — o lo hace tu política de auto-merge escrita |
|
|
118
|
+
| `MERGED` | Un auto-merge autorizado se ejecutó este turno | Siguiente unidad: consultar `workflow-status` |
|
|
119
|
+
| `NEEDS_FIXES` | `findings.fix_now` no está vacío | Incorporar en la rama (commit Y push), luego reejecutar la puerta que los emitió |
|
|
120
|
+
| `BLOCKED` | Dependencia no cumplida / causa externa | Seguir `dependencies.build_order`, o resolver `blockers[]` |
|
|
121
|
+
| `NEEDS_INPUT` | Un humano debe decidir | Mostrar `needs_input.question` + `options`; reanudar con la respuesta |
|
|
122
|
+
| `FAILED` | Reintentos agotados | Detener esta unidad; un humano la revisa |
|
|
123
|
+
| `HALT` | Descubrimiento de parar-el-mundo (`blockers[].scope: "run"`) | Detener toda la ejecución; nada avanza hasta que un humano lo despeje |
|
|
124
|
+
|
|
125
|
+
`isTerminal(state)` cubre `NEEDS_INPUT` / `FAILED` / `HALT` (+
|
|
126
|
+
`MERGE_READY` con puerta humana); `isRunHalt(envelope)` es la comprobación
|
|
127
|
+
de `HALT` / bloqueador con alcance de ejecución.
|
|
128
|
+
|
|
129
|
+
## Orquestar con este esquema
|
|
130
|
+
|
|
131
|
+
Dos patrones, ambos consumiendo el mismo sobre. En ambos, **inyecta el
|
|
132
|
+
fragmento canónico de system-prompt** en cada invocación headless (las
|
|
133
|
+
skills no emiten el sobre por sí solas — `workflow-status` es la única
|
|
134
|
+
excepción):
|
|
135
|
+
|
|
136
|
+
```text
|
|
137
|
+
Every turn you produce MUST end with exactly one fenced ```json block matching
|
|
138
|
+
the orchestration envelope schema (all top-level keys present; values only
|
|
139
|
+
from verified command output). Emit nothing after it.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
…y ejecuta el **bucle de reparación** ante un fallo de parseo — un
|
|
143
|
+
reintento, luego falla el paso:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
async function turn(prompt: string) {
|
|
147
|
+
let out = await invokeAgent(prompt, { system: SNIPPET });
|
|
148
|
+
let r = parseEnvelope(out);
|
|
149
|
+
if (!r.ok) {
|
|
150
|
+
out = await invokeAgent("Emit only the machine envelope for the turn above.", { resume: true });
|
|
151
|
+
r = parseEnvelope(out);
|
|
152
|
+
if (!r.ok) throw new Error(`step failed: no valid envelope (${r.errors.join("; ")})`);
|
|
153
|
+
}
|
|
154
|
+
return r.envelope;
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Patrón 1 — bucle de driver fijo** (empieza aquí): consulta el sensor,
|
|
159
|
+
enruta por `state`, repite. Esqueleto completo en
|
|
160
|
+
[`docs/workflow/ORCHESTRATION.md`](https://github.com/gtrabanco/agentic-workflow/blob/main/docs/workflow/ORCHESTRATION.md),
|
|
161
|
+
incluido el protocolo de reinicio de recuperación ante caídas (pista
|
|
162
|
+
`--last-envelope` + diario de sobres solo-anexar).
|
|
163
|
+
|
|
164
|
+
**Patrón 2 — flujos de trabajo dinámicos** (el patrón conductor): un
|
|
165
|
+
contexto conductor de larga duración *escribe y monitoriza* el plan de
|
|
166
|
+
trabajo; cada trabajador se ejecuta en un **contexto limpio** y solo su
|
|
167
|
+
sobre fluye de vuelta hacia arriba — el conductor nunca ingiere
|
|
168
|
+
transcripciones en bruto, que es lo que le permite mantenerse de larga
|
|
169
|
+
duración sin degradarse. El sobre es precisamente el "resultado
|
|
170
|
+
estructurado" que necesita este patrón:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
// Conductor: fan out independent units (workflow-status said they're startable
|
|
174
|
+
// in parallel and the project declares `worktrees`), read back only envelopes.
|
|
175
|
+
const status = await turn("Follow the installed SKILL.md for: /workflow-status --json-only");
|
|
176
|
+
const units = status.detail.startable_now as string[];
|
|
177
|
+
|
|
178
|
+
const results = await Promise.all(
|
|
179
|
+
units.map((u) => turn(`Follow the installed SKILL.md for: /execute-phase ${u}`))
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
for (const env of results) {
|
|
183
|
+
if (isRunHalt(env)) throw new Error(`HALT: ${JSON.stringify(env.blockers)}`);
|
|
184
|
+
if (env.state === "NEEDS_FIXES")
|
|
185
|
+
await turn(`Fold the fix-now findings on ${env.unit.branch}: ${JSON.stringify(env.findings.fix_now)}`);
|
|
186
|
+
}
|
|
187
|
+
// The conductor's own context grew by a few KB of envelopes — not by N transcripts.
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Piso de seguridad para cualquier driver, bucle fijo o dinámico: nunca
|
|
191
|
+
saltarse una puerta `review_pending`/`audit_pending`, nunca fusionar salvo
|
|
192
|
+
con un `MERGE_READY` fresco ligado al SHA de cabeza actual, y tratar
|
|
193
|
+
`HALT` como terminal hasta que un humano lo despeje.
|
|
194
|
+
|
|
195
|
+
## Versionado
|
|
196
|
+
|
|
197
|
+
El semver de este paquete sigue al **contrato del sobre**, no al
|
|
198
|
+
repositorio: cambio disruptivo del esquema (clave eliminada/renombrada,
|
|
199
|
+
estado eliminado) → major; aditivo (clave opcional nueva, estado nuevo) →
|
|
200
|
+
minor; arreglos/docs → patch. Cuando cambia la skill
|
|
201
|
+
`orchestration-envelope`, este paquete cambia en el mismo PR.
|
|
202
|
+
|
|
203
|
+
**2.1.0** — aditivo, minor: `next.suggested[]` opcional (ver la tabla de
|
|
204
|
+
campos arriba), publicado junto con la exposición de señales de driver de
|
|
205
|
+
`workflow-status` (fix #79). Ninguna clave requerida cambió; los sobres
|
|
206
|
+
antiguos sin este campo siguen validando.
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @gtrabanco/agentic-workflow-schema
|
|
2
2
|
|
|
3
|
+
> 🇪🇸 [Versión en español](README.es.md)
|
|
4
|
+
|
|
3
5
|
Types, JSON Schema, and parser/validator for the
|
|
4
6
|
[agentic-workflow](https://github.com/gtrabanco/agentic-workflow) **machine
|
|
5
7
|
envelope** — the fixed JSON block a driven agent turn ends with (emitted by
|
|
@@ -83,7 +85,7 @@ rejects anything else); **open** = free-form, any value of the stated type.
|
|
|
83
85
|
| `pr.ci` | enum | **closed** — `green` · `red` · `pending` · `none` · `null` | `none` = the project has no CI; `null` = not checked this turn. |
|
|
84
86
|
| `gates.verification` | enum | **closed** — `green` · `red` · `not-run` · `null` | The project's own gate (type-check + tests + build) as last RUN. |
|
|
85
87
|
| `gates.review_pending` / `gates.audit_pending` | boolean\|null | open | Whether the mandatory review / merge audit still has to happen. |
|
|
86
|
-
| `findings.fix_now[]` | object array | items: `
|
|
88
|
+
| `findings.fix_now[]` | object array | items: `id`/`file`/`axis`/`class`/`route` (open), `severity` (**closed** — `high`·`med`·`low`), `suggested_tier` (**closed** — `strong`·`cheap`) | Findings that must fold into the CURRENT branch before it advances — one item per unfolded row of the unit's `review-findings.md` fold ledger. |
|
|
87
89
|
| `findings.issues_filed[]` | integer array | open | Issue numbers created/updated this turn. |
|
|
88
90
|
| `findings.untriaged` | integer ≥ 0 | open | Findings still without a destination — skills whose contract routes everything must report `0`. |
|
|
89
91
|
| `findings.decisions_recorded` | integer ≥ 0 | open | Decisions written to `decisions.md`-class records this turn. |
|
|
@@ -97,6 +99,7 @@ rejects anything else); **open** = free-form, any value of the stated type.
|
|
|
97
99
|
| `next.recommended` | string | open (a skill invocation) | The single best next command. |
|
|
98
100
|
| `next.alternatives[]` | string array | open | The other defensible choices. |
|
|
99
101
|
| `next.tier` | enum | **closed** — `strong` · `cheap` | Which model class the next step deserves — judgment vs mechanical. |
|
|
102
|
+
| `next.suggested[]` | object array, optional | items: `command`/`trigger`/`source_skill` (all open strings) | Trigger-attributed suggestions (`workflow-status` only) — each entry names the command, the exact condition that fired it, and the skill that owns that condition; single-sourced, never a second copy of the trigger logic. Absent on envelopes that don't emit it. |
|
|
100
103
|
| `detail` | any | open (skill-specific) | Per-skill payload — e.g. `workflow-status` carries the full project tree (`features`, `fixes`, `startable_now`, `blocked_units`, `crash_recovery`, …) here. |
|
|
101
104
|
|
|
102
105
|
### The `state` routing table (closed — exactly these 11)
|
|
@@ -187,3 +190,7 @@ This package's semver tracks the **envelope contract**, not the repo:
|
|
|
187
190
|
breaking schema change (key removed/renamed, state removed) → major;
|
|
188
191
|
additive (new optional key, new state) → minor; fixes/docs → patch. When the
|
|
189
192
|
`orchestration-envelope` skill changes, this package changes in the same PR.
|
|
193
|
+
|
|
194
|
+
**2.1.0** — additive minor: optional `next.suggested[]` (see the field table
|
|
195
|
+
above), landed with `workflow-status`'s driver-signal exposure (fix #79). No
|
|
196
|
+
required key changed; older envelopes without the field still validate.
|
package/dist/index.d.ts
CHANGED
|
@@ -45,10 +45,15 @@ export interface EnvelopeGates {
|
|
|
45
45
|
review_pending: boolean | null;
|
|
46
46
|
audit_pending: boolean | null;
|
|
47
47
|
}
|
|
48
|
+
export type FixNowSeverity = "high" | "med" | "low";
|
|
48
49
|
export interface EnvelopeFixNowFinding {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
id: string;
|
|
51
|
+
file: string;
|
|
52
|
+
axis: string;
|
|
53
|
+
severity: FixNowSeverity;
|
|
54
|
+
class: string;
|
|
55
|
+
route: string;
|
|
56
|
+
suggested_tier: Tier;
|
|
52
57
|
}
|
|
53
58
|
export interface EnvelopeFindings {
|
|
54
59
|
fix_now: EnvelopeFixNowFinding[];
|
|
@@ -76,10 +81,17 @@ export interface EnvelopeNeedsInput {
|
|
|
76
81
|
question: string;
|
|
77
82
|
options: string[];
|
|
78
83
|
}
|
|
84
|
+
export interface EnvelopeSuggestion {
|
|
85
|
+
command: string;
|
|
86
|
+
trigger: string;
|
|
87
|
+
source_skill: string;
|
|
88
|
+
}
|
|
79
89
|
export interface EnvelopeNext {
|
|
80
90
|
recommended: string;
|
|
81
91
|
alternatives: string[];
|
|
82
92
|
tier: Tier;
|
|
93
|
+
/** Optional trigger-attributed suggestions (workflow-status only). */
|
|
94
|
+
suggested?: EnvelopeSuggestion[];
|
|
83
95
|
}
|
|
84
96
|
export interface Envelope {
|
|
85
97
|
skill: string;
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ const BLOCKER_KINDS = [
|
|
|
72
72
|
"input",
|
|
73
73
|
];
|
|
74
74
|
const BLOCKER_SCOPES = ["unit", "run"];
|
|
75
|
+
const FIX_NOW_SEVERITIES = ["high", "med", "low"];
|
|
75
76
|
const REQUIRED_KEYS = [
|
|
76
77
|
"skill",
|
|
77
78
|
"state",
|
|
@@ -226,8 +227,25 @@ export function validateEnvelope(value) {
|
|
|
226
227
|
}
|
|
227
228
|
else {
|
|
228
229
|
findings.fix_now.forEach((f, i) => {
|
|
229
|
-
if (!isObj(f)
|
|
230
|
-
errors.push(`findings.fix_now[${i}] must be
|
|
230
|
+
if (!isObj(f)) {
|
|
231
|
+
errors.push(`findings.fix_now[${i}] must be an object`);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (typeof f.id !== "string")
|
|
235
|
+
errors.push(`findings.fix_now[${i}].id must be a string`);
|
|
236
|
+
if (typeof f.file !== "string")
|
|
237
|
+
errors.push(`findings.fix_now[${i}].file must be a string`);
|
|
238
|
+
if (typeof f.axis !== "string")
|
|
239
|
+
errors.push(`findings.fix_now[${i}].axis must be a string`);
|
|
240
|
+
if (!FIX_NOW_SEVERITIES.includes(f.severity)) {
|
|
241
|
+
errors.push(`findings.fix_now[${i}].severity must be one of ${FIX_NOW_SEVERITIES.join("|")} (got: ${String(f.severity)})`);
|
|
242
|
+
}
|
|
243
|
+
if (typeof f.class !== "string")
|
|
244
|
+
errors.push(`findings.fix_now[${i}].class must be a string`);
|
|
245
|
+
if (typeof f.route !== "string")
|
|
246
|
+
errors.push(`findings.fix_now[${i}].route must be a string`);
|
|
247
|
+
if (f.suggested_tier !== "strong" && f.suggested_tier !== "cheap") {
|
|
248
|
+
errors.push(`findings.fix_now[${i}].suggested_tier must be strong|cheap (got: ${String(f.suggested_tier)})`);
|
|
231
249
|
}
|
|
232
250
|
});
|
|
233
251
|
}
|
|
@@ -255,6 +273,25 @@ export function validateEnvelope(value) {
|
|
|
255
273
|
if (value.next.tier !== "strong" && value.next.tier !== "cheap") {
|
|
256
274
|
errors.push(`next.tier must be strong|cheap (got: ${String(value.next.tier)})`);
|
|
257
275
|
}
|
|
276
|
+
if (value.next.suggested !== undefined) {
|
|
277
|
+
if (!Array.isArray(value.next.suggested)) {
|
|
278
|
+
errors.push("next.suggested must be an array when present");
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
value.next.suggested.forEach((s, i) => {
|
|
282
|
+
if (!isObj(s)) {
|
|
283
|
+
errors.push(`next.suggested[${i}] must be an object`);
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (typeof s.command !== "string")
|
|
287
|
+
errors.push(`next.suggested[${i}].command must be a string`);
|
|
288
|
+
if (typeof s.trigger !== "string")
|
|
289
|
+
errors.push(`next.suggested[${i}].trigger must be a string`);
|
|
290
|
+
if (typeof s.source_skill !== "string")
|
|
291
|
+
errors.push(`next.suggested[${i}].source_skill must be a string`);
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
}
|
|
258
295
|
}
|
|
259
296
|
if (value.needs_input !== null && value.needs_input !== undefined) {
|
|
260
297
|
if (!isObj(value.needs_input) ||
|
package/envelope.schema.json
CHANGED
|
@@ -85,11 +85,15 @@
|
|
|
85
85
|
"type": "array",
|
|
86
86
|
"items": {
|
|
87
87
|
"type": "object",
|
|
88
|
-
"required": ["
|
|
88
|
+
"required": ["id", "file", "axis", "severity", "class", "route", "suggested_tier"],
|
|
89
89
|
"properties": {
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
90
|
+
"id": { "type": "string" },
|
|
91
|
+
"file": { "type": "string" },
|
|
92
|
+
"axis": { "type": "string" },
|
|
93
|
+
"severity": { "enum": ["high", "med", "low"] },
|
|
94
|
+
"class": { "type": "string" },
|
|
95
|
+
"route": { "type": "string" },
|
|
96
|
+
"suggested_tier": { "enum": ["strong", "cheap"] }
|
|
93
97
|
}
|
|
94
98
|
}
|
|
95
99
|
},
|
|
@@ -148,7 +152,19 @@
|
|
|
148
152
|
"properties": {
|
|
149
153
|
"recommended": { "type": "string" },
|
|
150
154
|
"alternatives": { "type": "array", "items": { "type": "string" } },
|
|
151
|
-
"tier": { "enum": ["strong", "cheap"] }
|
|
155
|
+
"tier": { "enum": ["strong", "cheap"] },
|
|
156
|
+
"suggested": {
|
|
157
|
+
"type": "array",
|
|
158
|
+
"items": {
|
|
159
|
+
"type": "object",
|
|
160
|
+
"required": ["command", "trigger", "source_skill"],
|
|
161
|
+
"properties": {
|
|
162
|
+
"command": { "type": "string" },
|
|
163
|
+
"trigger": { "type": "string" },
|
|
164
|
+
"source_skill": { "type": "string" }
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
152
168
|
}
|
|
153
169
|
},
|
|
154
170
|
"detail": {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtrabanco/agentic-workflow-schema",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Types, JSON Schema, and parser/validator for the agentic-workflow machine envelope — the fixed JSON block a driven agent turn ends with (workflow-status always; other skills under the driver-injected snippet), for programmatic orchestration.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentic-workflow",
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"dist",
|
|
33
33
|
"envelope.schema.json",
|
|
34
34
|
"README.md",
|
|
35
|
+
"README.es.md",
|
|
35
36
|
"LICENSE"
|
|
36
37
|
],
|
|
37
38
|
"engines": {
|