@gtrabanco/agentic-workflow-schema 3.0.0 → 3.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 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
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
package/dist/index.d.ts CHANGED
@@ -173,16 +173,63 @@ 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
+ /** Role a built-in skill plays in the workflow pipeline. */
177
+ export declare const SKILL_ROLES: readonly ["sensor", "planner", "executor", "reviewer", "auditor", "publisher"];
178
+ export type SkillRole = (typeof SKILL_ROLES)[number];
179
+ /** Maximum repository/forge effects permitted by a built-in profile. */
180
+ export declare const SKILL_EFFECTS: readonly ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"];
181
+ export type SkillEffect = (typeof SKILL_EFFECTS)[number];
182
+ /** Reasoning class a profile declares for its primary route. */
183
+ export declare const SKILL_REASONING: readonly ["mechanical", "semantic", "critical"];
184
+ export type SkillReasoning = (typeof SKILL_REASONING)[number];
185
+ /** Context sources a profile may consult. */
186
+ export declare const SKILL_CONTEXT_SOURCES: readonly ["repository", "semantic-context", "episodic-memory", "execution-state"];
187
+ export type SkillContextSource = (typeof SKILL_CONTEXT_SOURCES)[number];
188
+ /** Evidence a capability-aware driver should require before trusting results. */
189
+ export declare const SKILL_REQUIRED_EVIDENCE: readonly ["workflow-snapshot", "current-candidate", "verification", "independent-review", "audit", "issue-state", "pull-request-state"];
190
+ export type SkillRequiredEvidence = (typeof SKILL_REQUIRED_EVIDENCE)[number];
191
+ /**
192
+ * Declarative, closed-vocabulary capability metadata for a built-in profile.
193
+ * Repository evidence is the authoritative limit; semantic and episodic
194
+ * context is advisory and never extends the declared maximum effects.
195
+ */
196
+ export interface WorkflowSkillCapabilities {
197
+ readonly role: SkillRole;
198
+ readonly reasoning: SkillReasoning;
199
+ readonly effects: readonly SkillEffect[];
200
+ readonly contextSources: readonly SkillContextSource[];
201
+ readonly requiredEvidence: readonly SkillRequiredEvidence[];
202
+ }
203
+ /**
204
+ * Public profile boundary — source-compatible for external consumers that
205
+ * construct or mutate profiles. The three legacy fields are writable so
206
+ * third-party code can assign to them without TS2540.
207
+ */
176
208
  export interface WorkflowSkillProfile {
177
209
  skill: string;
178
210
  output: "envelope-v2" | "skill-outcome-v1";
179
211
  nativeFallback: "none" | "fixed-verdict";
212
+ /**
213
+ * Optional for source compatibility; every built-in populates it and a
214
+ * capability-aware consumer fails closed when it is absent.
215
+ */
216
+ capabilities?: WorkflowSkillCapabilities;
217
+ }
218
+ /**
219
+ * Deeply readonly boundary for shipped built-in profiles. The immutable type
220
+ * guarantees compile-time immutability without narrowing the public boundary.
221
+ */
222
+ export interface BuiltInSkillProfile {
223
+ readonly skill: string;
224
+ readonly output: "envelope-v2" | "skill-outcome-v1";
225
+ readonly nativeFallback: "none" | "fixed-verdict";
226
+ readonly capabilities?: Readonly<WorkflowSkillCapabilities>;
180
227
  }
181
228
  /**
182
229
  * The portable skill inventory consumed by headless drivers. Profiles are
183
230
  * programmatic metadata, not duplicated prompt sections in user-facing skills.
184
231
  */
185
- export declare const WORKFLOW_SKILL_PROFILES: readonly WorkflowSkillProfile[];
232
+ export declare const WORKFLOW_SKILL_PROFILES: readonly BuiltInSkillProfile[];
186
233
  export type SkillOutcomeStatus = "completed" | "continue" | "blocked" | "needs-input" | "failed";
187
234
  export interface SkillOutcomeBlocker {
188
235
  kind: BlockerKind;
package/dist/index.js CHANGED
@@ -444,24 +444,209 @@ export const WORKFLOW_INTENTS = [
444
444
  "stop",
445
445
  "none",
446
446
  ];
447
+ // ---------------------------------------------------------------------------
448
+ // Capability metadata — closed vocabularies, immutable exports (issue #136)
449
+ // ---------------------------------------------------------------------------
450
+ /** Role a built-in skill plays in the workflow pipeline. */
451
+ export const SKILL_ROLES = Object.freeze([
452
+ "sensor",
453
+ "planner",
454
+ "executor",
455
+ "reviewer",
456
+ "auditor",
457
+ "publisher",
458
+ ]);
459
+ /** Maximum repository/forge effects permitted by a built-in profile. */
460
+ export const SKILL_EFFECTS = Object.freeze([
461
+ "repository-read",
462
+ "repository-write",
463
+ "git-write",
464
+ "forge-read",
465
+ "forge-write",
466
+ ]);
467
+ /** Reasoning class a profile declares for its primary route. */
468
+ export const SKILL_REASONING = Object.freeze([
469
+ "mechanical",
470
+ "semantic",
471
+ "critical",
472
+ ]);
473
+ /** Context sources a profile may consult. */
474
+ export const SKILL_CONTEXT_SOURCES = Object.freeze([
475
+ "repository",
476
+ "semantic-context",
477
+ "episodic-memory",
478
+ "execution-state",
479
+ ]);
480
+ /** Evidence a capability-aware driver should require before trusting results. */
481
+ export const SKILL_REQUIRED_EVIDENCE = Object.freeze([
482
+ "workflow-snapshot",
483
+ "current-candidate",
484
+ "verification",
485
+ "independent-review",
486
+ "audit",
487
+ "issue-state",
488
+ "pull-request-state",
489
+ ]);
490
+ /** Recursively freezes exported metadata so runtime widening is impossible. */
491
+ function deepFreeze(value) {
492
+ if (value !== null && typeof value === "object") {
493
+ for (const key of Object.keys(value)) {
494
+ deepFreeze(value[key]);
495
+ }
496
+ Object.freeze(value);
497
+ }
498
+ return value;
499
+ }
447
500
  /**
448
501
  * The portable skill inventory consumed by headless drivers. Profiles are
449
502
  * programmatic metadata, not duplicated prompt sections in user-facing skills.
450
503
  */
451
- export const WORKFLOW_SKILL_PROFILES = [
452
- { skill: "init-workspace", output: "skill-outcome-v1", nativeFallback: "none" },
453
- { skill: "workflow-status", output: "envelope-v2", nativeFallback: "none" },
454
- { skill: "discover-repository-state", output: "skill-outcome-v1", nativeFallback: "none" },
455
- { skill: "resolve-repository-state", output: "skill-outcome-v1", nativeFallback: "none" },
456
- { skill: "design-feature", output: "skill-outcome-v1", nativeFallback: "none" },
457
- { skill: "plan-feature", output: "skill-outcome-v1", nativeFallback: "none" },
458
- { skill: "plan-fix", output: "skill-outcome-v1", nativeFallback: "none" },
459
- { skill: "triage-issue", output: "skill-outcome-v1", nativeFallback: "none" },
460
- { skill: "execute-phase", output: "skill-outcome-v1", nativeFallback: "none" },
461
- { skill: "review-change", output: "skill-outcome-v1", nativeFallback: "none" },
462
- { skill: "loop-review-fold", output: "skill-outcome-v1", nativeFallback: "fixed-verdict" },
463
- { skill: "audit-pr", output: "skill-outcome-v1", nativeFallback: "fixed-verdict" },
464
- ];
504
+ export const WORKFLOW_SKILL_PROFILES = deepFreeze([
505
+ {
506
+ skill: "init-workspace",
507
+ output: "skill-outcome-v1",
508
+ nativeFallback: "none",
509
+ capabilities: {
510
+ role: "executor",
511
+ reasoning: "semantic",
512
+ effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
513
+ contextSources: ["repository", "semantic-context"],
514
+ requiredEvidence: [],
515
+ },
516
+ },
517
+ {
518
+ skill: "workflow-status",
519
+ output: "envelope-v2",
520
+ nativeFallback: "none",
521
+ capabilities: {
522
+ role: "sensor",
523
+ reasoning: "mechanical",
524
+ effects: ["repository-read", "forge-read"],
525
+ contextSources: ["repository", "execution-state"],
526
+ requiredEvidence: ["workflow-snapshot"],
527
+ },
528
+ },
529
+ {
530
+ skill: "discover-repository-state",
531
+ output: "skill-outcome-v1",
532
+ nativeFallback: "none",
533
+ capabilities: {
534
+ role: "sensor",
535
+ reasoning: "semantic",
536
+ effects: ["repository-read", "repository-write", "git-write"],
537
+ contextSources: ["repository", "semantic-context"],
538
+ requiredEvidence: [],
539
+ },
540
+ },
541
+ {
542
+ skill: "resolve-repository-state",
543
+ output: "skill-outcome-v1",
544
+ nativeFallback: "none",
545
+ capabilities: {
546
+ role: "planner",
547
+ reasoning: "critical",
548
+ effects: ["repository-read", "repository-write"],
549
+ contextSources: ["repository", "semantic-context", "execution-state"],
550
+ requiredEvidence: ["workflow-snapshot"],
551
+ },
552
+ },
553
+ {
554
+ skill: "design-feature",
555
+ output: "skill-outcome-v1",
556
+ nativeFallback: "none",
557
+ capabilities: {
558
+ role: "planner",
559
+ reasoning: "critical",
560
+ effects: ["repository-read", "repository-write", "forge-read"],
561
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
562
+ requiredEvidence: ["workflow-snapshot"],
563
+ },
564
+ },
565
+ {
566
+ skill: "plan-feature",
567
+ output: "skill-outcome-v1",
568
+ nativeFallback: "none",
569
+ capabilities: {
570
+ role: "planner",
571
+ reasoning: "critical",
572
+ effects: ["repository-read", "repository-write", "forge-read"],
573
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
574
+ requiredEvidence: ["workflow-snapshot"],
575
+ },
576
+ },
577
+ {
578
+ skill: "plan-fix",
579
+ output: "skill-outcome-v1",
580
+ nativeFallback: "none",
581
+ capabilities: {
582
+ role: "planner",
583
+ reasoning: "critical",
584
+ effects: ["repository-read", "repository-write", "git-write", "forge-read"],
585
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
586
+ requiredEvidence: ["workflow-snapshot", "issue-state"],
587
+ },
588
+ },
589
+ {
590
+ skill: "triage-issue",
591
+ output: "skill-outcome-v1",
592
+ nativeFallback: "none",
593
+ capabilities: {
594
+ role: "planner",
595
+ reasoning: "critical",
596
+ effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
597
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
598
+ requiredEvidence: ["workflow-snapshot", "issue-state"],
599
+ },
600
+ },
601
+ {
602
+ skill: "execute-phase",
603
+ output: "skill-outcome-v1",
604
+ nativeFallback: "none",
605
+ capabilities: {
606
+ role: "executor",
607
+ reasoning: "semantic",
608
+ effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
609
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
610
+ requiredEvidence: ["workflow-snapshot", "current-candidate"],
611
+ },
612
+ },
613
+ {
614
+ skill: "review-change",
615
+ output: "skill-outcome-v1",
616
+ nativeFallback: "none",
617
+ capabilities: {
618
+ role: "reviewer",
619
+ reasoning: "critical",
620
+ effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
621
+ contextSources: ["repository", "semantic-context", "execution-state"],
622
+ requiredEvidence: ["current-candidate", "verification"],
623
+ },
624
+ },
625
+ {
626
+ skill: "loop-review-fold",
627
+ output: "skill-outcome-v1",
628
+ nativeFallback: "fixed-verdict",
629
+ capabilities: {
630
+ role: "reviewer",
631
+ reasoning: "critical",
632
+ effects: ["repository-read", "repository-write", "git-write", "forge-read", "forge-write"],
633
+ contextSources: ["repository", "semantic-context", "episodic-memory", "execution-state"],
634
+ requiredEvidence: ["current-candidate", "independent-review"],
635
+ },
636
+ },
637
+ {
638
+ skill: "audit-pr",
639
+ output: "skill-outcome-v1",
640
+ nativeFallback: "fixed-verdict",
641
+ capabilities: {
642
+ role: "auditor",
643
+ reasoning: "critical",
644
+ effects: ["repository-read", "repository-write", "forge-read", "forge-write"],
645
+ contextSources: ["repository", "semantic-context", "execution-state"],
646
+ requiredEvidence: ["current-candidate", "verification", "independent-review", "pull-request-state"],
647
+ },
648
+ },
649
+ ]);
465
650
  function workflowSkillProfile(skill) {
466
651
  return WORKFLOW_SKILL_PROFILES.find((profile) => profile.skill === skill);
467
652
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/agentic-workflow-schema",
3
- "version": "3.0.0",
3
+ "version": "3.1.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": {