@jmanuelcorral/openteam 0.1.41 → 0.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.
Files changed (117) hide show
  1. package/.opencode/openteam.example.json +6 -1
  2. package/README.es.md +1 -1
  3. package/README.md +1 -1
  4. package/dist/capabilities/types.d.ts +4 -4
  5. package/dist/classifier/types.d.ts +3 -3
  6. package/dist/cli.js +430 -36
  7. package/dist/commands/doctor.d.ts +2 -0
  8. package/dist/commands/doctor.d.ts.map +1 -1
  9. package/dist/commands/graph.d.ts +36 -2
  10. package/dist/commands/graph.d.ts.map +1 -1
  11. package/dist/config/graphFeatureGate.d.ts +96 -0
  12. package/dist/config/graphFeatureGate.d.ts.map +1 -0
  13. package/dist/config/migrations.d.ts.map +1 -1
  14. package/dist/config/resolve.d.ts +20 -1
  15. package/dist/config/resolve.d.ts.map +1 -1
  16. package/dist/config/schema.d.ts +40 -19
  17. package/dist/config/schema.d.ts.map +1 -1
  18. package/dist/console/assets.d.ts +9 -1
  19. package/dist/console/assets.d.ts.map +1 -1
  20. package/dist/console/opencodeClient.d.ts +6 -0
  21. package/dist/console/opencodeClient.d.ts.map +1 -1
  22. package/dist/console/protocol.d.ts +8 -0
  23. package/dist/console/protocol.d.ts.map +1 -1
  24. package/dist/console/render.d.ts +25 -0
  25. package/dist/console/render.d.ts.map +1 -1
  26. package/dist/context/redaction.d.ts +23 -0
  27. package/dist/context/redaction.d.ts.map +1 -1
  28. package/dist/context/schema.d.ts +3 -3
  29. package/dist/contract/opencode.d.ts +2 -2
  30. package/dist/contract/opencode.d.ts.map +1 -1
  31. package/dist/graph/certificate.d.ts +505 -0
  32. package/dist/graph/certificate.d.ts.map +1 -0
  33. package/dist/graph/ids.d.ts +9 -0
  34. package/dist/graph/ids.d.ts.map +1 -1
  35. package/dist/graph/privacyPolicy.d.ts.map +1 -1
  36. package/dist/graph/reducer.d.ts.map +1 -1
  37. package/dist/graph/replay.d.ts.map +1 -1
  38. package/dist/graph/reviewerPolicy.d.ts.map +1 -1
  39. package/dist/graph/schema.d.ts +33 -33
  40. package/dist/graph/schema.d.ts.map +1 -1
  41. package/dist/graph/soakLedger.d.ts +144 -0
  42. package/dist/graph/soakLedger.d.ts.map +1 -0
  43. package/dist/graph/types.d.ts +2 -0
  44. package/dist/graph/types.d.ts.map +1 -1
  45. package/dist/graph/validate.d.ts.map +1 -1
  46. package/dist/index.d.ts +47 -0
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +2351 -180
  49. package/dist/local/registry.d.ts.map +1 -1
  50. package/dist/memory/types.d.ts +2 -2
  51. package/dist/orchestrator/graphFacade.d.ts +39 -0
  52. package/dist/orchestrator/graphFacade.d.ts.map +1 -0
  53. package/dist/orchestrator/graphIngress.d.ts +136 -0
  54. package/dist/orchestrator/graphIngress.d.ts.map +1 -0
  55. package/dist/orchestrator/graphShadow.d.ts +121 -0
  56. package/dist/orchestrator/graphShadow.d.ts.map +1 -0
  57. package/dist/orchestrator/ledger.d.ts +14 -2
  58. package/dist/orchestrator/ledger.d.ts.map +1 -1
  59. package/dist/orchestrator/opencodeSessionAdapter.d.ts.map +1 -1
  60. package/dist/orchestrator/roles.d.ts +3 -3
  61. package/dist/orchestrator/sdd.d.ts +55 -1
  62. package/dist/orchestrator/sdd.d.ts.map +1 -1
  63. package/dist/orchestrator/sddCompiler.d.ts +6 -2
  64. package/dist/orchestrator/sddCompiler.d.ts.map +1 -1
  65. package/dist/orchestrator/worktreeAdapter.d.ts +39 -0
  66. package/dist/orchestrator/worktreeAdapter.d.ts.map +1 -0
  67. package/dist/orchestrator/worktreeDispatch.d.ts +84 -0
  68. package/dist/orchestrator/worktreeDispatch.d.ts.map +1 -0
  69. package/dist/orchestrator/worktreeReconciler.d.ts +74 -0
  70. package/dist/orchestrator/worktreeReconciler.d.ts.map +1 -0
  71. package/dist/plugin/graphShadowIngress.d.ts +165 -0
  72. package/dist/plugin/graphShadowIngress.d.ts.map +1 -0
  73. package/dist/plugin/graphTool.d.ts +63 -0
  74. package/dist/plugin/graphTool.d.ts.map +1 -0
  75. package/dist/plugin/hooks.d.ts +6 -0
  76. package/dist/plugin/hooks.d.ts.map +1 -1
  77. package/dist/plugin/legacyRunProducer.d.ts +60 -0
  78. package/dist/plugin/legacyRunProducer.d.ts.map +1 -0
  79. package/dist/plugin/reportRunSchema.d.ts +60 -0
  80. package/dist/plugin/reportRunSchema.d.ts.map +1 -0
  81. package/dist/plugin/sessionTracker.d.ts +42 -0
  82. package/dist/plugin/sessionTracker.d.ts.map +1 -0
  83. package/dist/plugin/shadowPipeline.d.ts +49 -0
  84. package/dist/plugin/shadowPipeline.d.ts.map +1 -0
  85. package/dist/plugin/soakObserver.d.ts +73 -0
  86. package/dist/plugin/soakObserver.d.ts.map +1 -0
  87. package/dist/storage/graph/codec.d.ts.map +1 -1
  88. package/dist/storage/graph/migrateLegacyBriefs.d.ts.map +1 -1
  89. package/dist/storage/graph/migration.d.ts +91 -0
  90. package/dist/storage/graph/migration.d.ts.map +1 -0
  91. package/dist/storage/graph/provider.d.ts +1 -0
  92. package/dist/storage/graph/provider.d.ts.map +1 -1
  93. package/dist/storage/graph/recovery.d.ts.map +1 -1
  94. package/dist/storage/graph/runRegistry.d.ts.map +1 -1
  95. package/dist/storage/graph/soakRecorder.d.ts +59 -0
  96. package/dist/storage/graph/soakRecorder.d.ts.map +1 -0
  97. package/dist/storage/graph/workspaceLease.d.ts.map +1 -1
  98. package/dist/storage/graph/worktreeRegistry.d.ts +29 -0
  99. package/dist/storage/graph/worktreeRegistry.d.ts.map +1 -0
  100. package/dist/storage/graph/writer.d.ts +15 -0
  101. package/dist/storage/graph/writer.d.ts.map +1 -1
  102. package/dist/storage/path.d.ts.map +1 -1
  103. package/dist/telemetry/events.d.ts +12 -12
  104. package/dist/telemetry/graphRuntimeHealth.d.ts +53 -0
  105. package/dist/telemetry/graphRuntimeHealth.d.ts.map +1 -0
  106. package/dist/telemetry/graphView.d.ts +76 -0
  107. package/dist/telemetry/graphView.d.ts.map +1 -0
  108. package/dist/telemetry/types.d.ts +4 -4
  109. package/dist/web/console.d.ts +6 -0
  110. package/dist/web/console.d.ts.map +1 -1
  111. package/dist/web/graphRoute.d.ts +36 -0
  112. package/dist/web/graphRoute.d.ts.map +1 -0
  113. package/dist/web/server.d.ts +21 -2
  114. package/dist/web/server.d.ts.map +1 -1
  115. package/dist/web/start.d.ts +11 -0
  116. package/dist/web/start.d.ts.map +1 -1
  117. package/package.json +7 -5
@@ -0,0 +1,84 @@
1
+ import type { WorktreeBinding } from "../storage/graph/worktreeRegistry";
2
+ /**
3
+ * Seam de despacho al worktree del run (GE-073, D-W3).
4
+ *
5
+ * Decide, para un efecto del runtime de Graph, el `directory` con el que se crea
6
+ * la sub-sesión hija (`query.directory`) y verifica la correlación del contrato
7
+ * `PluginInput.directory`/`worktree` (GE-005). Es lógica pura y determinista:
8
+ * sin I/O, SDK, reloj ni estado global; el probe de salud del worktree y la
9
+ * consulta al registro (GE-072) los hace el llamante y entrega sus resultados
10
+ * como datos.
11
+ *
12
+ * Invariante de UX-neutralidad: con el aislamiento **desactivado**
13
+ * (`graph.worktrees.enabled` = `false`, el default) el directorio resuelto es
14
+ * exactamente el del workspace actual, de modo que el despacho es idéntico al
15
+ * de hoy. Con el aislamiento activo se exige un worktree sano vinculado al run
16
+ * y se cierra en falso (`WorktreeDispatchError`) si falta la vinculación, el
17
+ * directorio desapareció (`missing`) o está sucio (`unclean`). Ninguna ruta viva
18
+ * llama todavía a este seam; lo consumirá la integración del executor.
19
+ */
20
+ /** Salud observada del worktree de un run (resultado del probe del llamante). */
21
+ export type WorktreeHealth = "ready" | "missing" | "unclean";
22
+ /** Estado del despacho respecto al aislamiento por worktree del run. */
23
+ export type WorktreeDispatchState = {
24
+ readonly kind: "disabled";
25
+ } | {
26
+ readonly kind: "unbound";
27
+ } | {
28
+ readonly kind: "missing";
29
+ readonly worktreePath: string;
30
+ } | {
31
+ readonly kind: "unclean";
32
+ readonly worktreePath: string;
33
+ } | {
34
+ readonly kind: "ready";
35
+ readonly worktreePath: string;
36
+ };
37
+ /** Taxonomía cerrada de fallos al vincular el despacho a un worktree. */
38
+ export type WorktreeDispatchErrorCode = "unbound" | "missing" | "unclean" | "mismatch";
39
+ /** Error tipado de un despacho que no puede vincularse a un worktree sano. */
40
+ export declare class WorktreeDispatchError extends Error {
41
+ readonly code: WorktreeDispatchErrorCode;
42
+ readonly detail: string;
43
+ constructor(code: WorktreeDispatchErrorCode, detail: string);
44
+ }
45
+ /** Directorio efectivo del despacho de un efecto. */
46
+ export type DispatchDirectory = {
47
+ /**
48
+ * Directorio a pasar como `query.directory`. `undefined` = raíz del workspace
49
+ * (comportamiento actual cuando el aislamiento está desactivado).
50
+ */
51
+ readonly directory: string | undefined;
52
+ /** Worktree correlacionado; `undefined` salvo con aislamiento activo. */
53
+ readonly worktree: string | undefined;
54
+ };
55
+ /** Correlación observada del contrato `PluginInput` de una sub-sesión. */
56
+ export type ObservedWorktreeCorrelation = {
57
+ readonly directory: string;
58
+ readonly worktree: string;
59
+ };
60
+ /**
61
+ * Combina el flag de aislamiento, la vinculación del registro (GE-072) y la
62
+ * salud observada del worktree en un estado de despacho. Cierra en falso por
63
+ * defecto: una salud ausente o desconocida se trata como `missing`.
64
+ */
65
+ export declare function worktreeDispatchState(input: {
66
+ readonly enabled: boolean;
67
+ readonly binding: WorktreeBinding | undefined;
68
+ readonly health: WorktreeHealth | undefined;
69
+ }): WorktreeDispatchState;
70
+ /**
71
+ * Resuelve el directorio efectivo del despacho. Con el aislamiento desactivado
72
+ * devuelve el `workspaceDirectory` tal cual (idéntico al comportamiento actual);
73
+ * con un worktree sano devuelve su ruta como `directory` y `worktree`; en
74
+ * cualquier otro estado cierra en falso con `WorktreeDispatchError`.
75
+ */
76
+ export declare function resolveDispatchDirectory(state: WorktreeDispatchState, workspaceDirectory: string | undefined): DispatchDirectory;
77
+ /**
78
+ * Verifica la correlación del contrato `PluginInput` (GE-005): el
79
+ * `directory`/`worktree` observado de la sub-sesión debe coincidir con el
80
+ * worktree leaseado del run. Lanza `WorktreeDispatchError("mismatch")` si
81
+ * alguno difiere; comparación de rutas normalizada por plataforma.
82
+ */
83
+ export declare function assertWorktreeCorrelation(observed: ObservedWorktreeCorrelation, leasedWorktree: string): void;
84
+ //# sourceMappingURL=worktreeDispatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktreeDispatch.d.ts","sourceRoot":"","sources":["../../src/orchestrator/worktreeDispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE;;;;;;;;;;;;;;;;;GAiBG;AAEH,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,yEAAyE;AACzE,MAAM,MAAM,yBAAyB,GACjC,SAAS,GACT,SAAS,GACT,SAAS,GACT,UAAU,CAAC;AAEf,8EAA8E;AAC9E,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,YAAY,IAAI,EAAE,yBAAyB,EAAE,MAAM,EAAE,MAAM,EAK1D;CACF;AAED,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;CACvC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAUF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,CAAC;CAC7C,GAAG,qBAAqB,CAgBxB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,qBAAqB,EAC5B,kBAAkB,EAAE,MAAM,GAAG,SAAS,GACrC,iBAAiB,CAanB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,2BAA2B,EACrC,cAAc,EAAE,MAAM,GACrB,IAAI,CAaN"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Reconciliador de worktrees huérfanos tras un crash (GE-074, D-W4).
3
+ *
4
+ * Sigue el mismo contrato dry-run que los comandos de operador (GE-045,
5
+ * `src/commands/graph.ts`): es **lógica pura y determinista** que recibe un
6
+ * snapshot ya observado (worktrees listados por el adapter GE-071, qué runs
7
+ * siguen activos según el registro de runs GE-025, y el estado de merge-back
8
+ * probado por el llamante) y decide, sin ejecutar, qué acción es segura para
9
+ * cada worktree. La ejecución real (`prune`/merge-back) vive en la capa de
10
+ * wiring y sólo cuando el plan la autoriza.
11
+ *
12
+ * Política de reconciliación:
13
+ * - **Run activo** → `retain`: nunca se toca un worktree cuyo run sigue vivo.
14
+ * - **Huérfano limpio y sin commits** → `prune`: eliminación segura y reportada.
15
+ * - **Huérfano limpio con commits** → `merge-back`: explícito e idempotente;
16
+ * nunca descarta en silencio la rama del run. Una segunda pasada, cuando la
17
+ * rama ya está integrada (`alreadyMerged`), planifica `prune` en vez de
18
+ * volver a fusionar.
19
+ * - **Sucio o ambiguo** → `block`: se detiene para una decisión del operador.
20
+ *
21
+ * Invariante de UX-neutralidad (D-W4): con `graph.worktrees.enabled` = `false`
22
+ * (el default) el reconciliador es un **no-op** — devuelve un informe vacío, no
23
+ * planifica ni crea ni poda ningún worktree. Ninguna ruta viva lo llama todavía.
24
+ */
25
+ /** Estado de merge-back observado de un worktree (probe de git del llamante). */
26
+ export type WorktreeMergeState = "clean-empty" | "clean-ahead" | "dirty";
27
+ /** Snapshot observado de un worktree candidato a reconciliar. */
28
+ export type WorktreeObservation = {
29
+ readonly runID: string;
30
+ readonly path: string;
31
+ /** El run sigue activo según el registro de runs (lease vigente). */
32
+ readonly runActive: boolean;
33
+ /** Estado de merge-back observado. */
34
+ readonly mergeState: WorktreeMergeState;
35
+ /**
36
+ * Sólo relevante con `mergeState: "clean-ahead"`: la rama del run ya está
37
+ * integrada en la base, de modo que la reconciliación es idempotente y puede
38
+ * podar en vez de volver a fusionar.
39
+ */
40
+ readonly alreadyMerged?: boolean;
41
+ };
42
+ /** Acción planificada para un worktree, decidida sin ejecutarla. */
43
+ export type WorktreeReconcileAction = "retain" | "prune" | "merge-back" | "block";
44
+ /** Plan de reconciliación de un worktree concreto. */
45
+ export type WorktreeReconcilePlan = {
46
+ readonly runID: string;
47
+ readonly path: string;
48
+ readonly action: WorktreeReconcileAction;
49
+ /** Razón estable y machine-readable de la decisión. */
50
+ readonly reason: string;
51
+ /** `true` cuando la acción preserva invariantes sin override del operador. */
52
+ readonly safe: boolean;
53
+ };
54
+ /** Informe agregado de la reconciliación. */
55
+ export type WorktreeReconcileReport = {
56
+ /** Estado del flag de aislamiento en el momento de reconciliar. */
57
+ readonly enabled: boolean;
58
+ /** Plan por worktree, en el orden observado. */
59
+ readonly plans: readonly WorktreeReconcilePlan[];
60
+ readonly retained: number;
61
+ readonly pruned: number;
62
+ readonly mergeBack: number;
63
+ readonly blocked: number;
64
+ };
65
+ /**
66
+ * Planifica la reconciliación de un conjunto de worktrees observados. Con el
67
+ * aislamiento desactivado devuelve un informe vacío (no-op). Puro: no ejecuta
68
+ * git ni toca I/O.
69
+ */
70
+ export declare function planWorktreeReconciliation(input: {
71
+ readonly enabled: boolean;
72
+ readonly worktrees: readonly WorktreeObservation[];
73
+ }): WorktreeReconcileReport;
74
+ //# sourceMappingURL=worktreeReconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worktreeReconciler.d.ts","sourceRoot":"","sources":["../../src/orchestrator/worktreeReconciler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,iFAAiF;AACjF,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG,aAAa,GAAG,OAAO,CAAC;AAEzE,iEAAiE;AACjE,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,oEAAoE;AACpE,MAAM,MAAM,uBAAuB,GAC/B,QAAQ,GACR,OAAO,GACP,YAAY,GACZ,OAAO,CAAC;AAEZ,sDAAsD;AACtD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,6CAA6C;AAC7C,MAAM,MAAM,uBAAuB,GAAG;IACpC,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAkCF;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,mBAAmB,EAAE,CAAC;CACpD,GAAG,uBAAuB,CAwB1B"}
@@ -0,0 +1,165 @@
1
+ import { z } from "zod";
2
+ import type { GraphMode } from "../config/schema";
3
+ /**
4
+ * **Ingesta shadow productiva** (GE-042): observa **una** ejecución legacy real
5
+ * y la proyecta a un `LegacyExecutionTraceV1` **reference-only**, sin duplicar
6
+ * trabajo.
7
+ *
8
+ * El trace es el input que el espejo sin efectos (GE-043) compila para que el
9
+ * comparador de paridad (GE-044) lo contraste. Por eso transporta exactamente
10
+ * las dimensiones que el comparador normaliza —estado terminal, orden de nodos,
11
+ * roles, modelos, nº de fixes y outcome— y **nada de contenido crudo**: ni
12
+ * brief, ni prompt, ni argumentos de tool, ni salida del modelo. Solo ids,
13
+ * roles, referencias de modelo/sesión, clases de error y contadores.
14
+ *
15
+ * Garantías estructurales del boundary:
16
+ * - **Sin efectos ni LLM:** este módulo solo mapea una observación ya
17
+ * producida; nunca despacha una tool, ejecuta un efecto ni llama al modelo,
18
+ * así que no puede duplicar la ejecución legacy que observa.
19
+ * - **Sin trace sintético:** una observación que no ejecutó de verdad
20
+ * (reanudada o `skipped`) o sin nodos es **inelegible de forma explícita**;
21
+ * el builder nunca fabrica un run.
22
+ * - **Gate dormant:** solo observa con `graph.mode` en `shadow`/`active` y sin
23
+ * `killSwitch`; con `off` (o sección ausente) o kill-switch, inelegible.
24
+ * - **Reference-only:** un guard final rechaza cualquier campo crudo y el
25
+ * parser de boundary rechaza además claves desconocidas.
26
+ *
27
+ * Módulo **puro y determinista**: sin I/O, red, reloj, random ni env vars.
28
+ */
29
+ /** Versión del trace de ejecución legacy. */
30
+ export declare const LEGACY_EXECUTION_TRACE_VERSION: 1;
31
+ /** Estado terminal normalizado de la ejecución legacy observada. */
32
+ export declare const LegacyExecutionStatusSchema: z.ZodEnum<{
33
+ cancelled: "cancelled";
34
+ completed: "completed";
35
+ failed: "failed";
36
+ }>;
37
+ export type LegacyExecutionStatus = z.infer<typeof LegacyExecutionStatusSchema>;
38
+ /** Outcome normalizado del review de la ejecución legacy observada. */
39
+ export declare const LegacyReviewOutcomeSchema: z.ZodEnum<{
40
+ approved: "approved";
41
+ inconclusive: "inconclusive";
42
+ rejected: "rejected";
43
+ }>;
44
+ export type LegacyReviewOutcome = z.infer<typeof LegacyReviewOutcomeSchema>;
45
+ /**
46
+ * Nodo del trace: solo referencias y etiquetas acotadas. `model` es la
47
+ * referencia normalizada del modelo (p. ej. `provider/model`); `sessionRef` es
48
+ * el id de la subsesión de opencode, nunca su contenido; `errorClass` es la
49
+ * taxonomía acotada de fallo que comparte el runtime del grafo.
50
+ */
51
+ export declare const LegacyTraceNodeV1Schema: z.ZodObject<{
52
+ id: z.ZodString;
53
+ role: z.ZodEnum<{
54
+ implementer: "implementer";
55
+ reviewer: "reviewer";
56
+ }>;
57
+ model: z.ZodString;
58
+ sessionRef: z.ZodOptional<z.ZodString>;
59
+ errorClass: z.ZodOptional<z.ZodEnum<{
60
+ cancelled: "cancelled";
61
+ permanent: "permanent";
62
+ timeout: "timeout";
63
+ transient: "transient";
64
+ unknown: "unknown";
65
+ }>>;
66
+ }, z.core.$strict>;
67
+ export type LegacyTraceNodeV1 = z.infer<typeof LegacyTraceNodeV1Schema>;
68
+ /**
69
+ * Trace versionado y reference-only de una única ejecución legacy productiva.
70
+ * `nodes` conserva el **orden** de despacho (implementer, reviewer, fixes...),
71
+ * que es una de las dimensiones de paridad.
72
+ */
73
+ export declare const LegacyExecutionTraceV1Schema: z.ZodObject<{
74
+ version: z.ZodLiteral<1>;
75
+ runID: z.ZodString;
76
+ status: z.ZodEnum<{
77
+ cancelled: "cancelled";
78
+ completed: "completed";
79
+ failed: "failed";
80
+ }>;
81
+ outcome: z.ZodEnum<{
82
+ approved: "approved";
83
+ inconclusive: "inconclusive";
84
+ rejected: "rejected";
85
+ }>;
86
+ fixes: z.ZodNumber;
87
+ nodes: z.ZodArray<z.ZodObject<{
88
+ id: z.ZodString;
89
+ role: z.ZodEnum<{
90
+ implementer: "implementer";
91
+ reviewer: "reviewer";
92
+ }>;
93
+ model: z.ZodString;
94
+ sessionRef: z.ZodOptional<z.ZodString>;
95
+ errorClass: z.ZodOptional<z.ZodEnum<{
96
+ cancelled: "cancelled";
97
+ permanent: "permanent";
98
+ timeout: "timeout";
99
+ transient: "transient";
100
+ unknown: "unknown";
101
+ }>>;
102
+ }, z.core.$strict>>;
103
+ parentSessionRef: z.ZodOptional<z.ZodString>;
104
+ }, z.core.$strict>;
105
+ export type LegacyExecutionTraceV1 = z.infer<typeof LegacyExecutionTraceV1Schema>;
106
+ /** Gate de elegibilidad: subconjunto observado de la config `graph`. */
107
+ export type ShadowIngressGate = {
108
+ readonly mode: GraphMode;
109
+ readonly killSwitch: boolean;
110
+ };
111
+ /** Motivo **explícito** por el que una observación no produce trace. */
112
+ export type ShadowIngressIneligibleReason = "graph-disabled" | "kill-switch" | "not-executed" | "no-observation";
113
+ /** Nodo observado de la ejecución legacy real (puerto de entrada acotado). */
114
+ export type ObservedLegacyNode = {
115
+ readonly id: string;
116
+ readonly role: LegacyTraceNodeV1["role"];
117
+ readonly model: string;
118
+ /** Éxito terminal del nodo; deriva el outcome cuando el nodo es reviewer. */
119
+ readonly ok: boolean;
120
+ readonly sessionRef?: string;
121
+ readonly errorClass?: LegacyTraceNodeV1["errorClass"];
122
+ };
123
+ /**
124
+ * Observación de **una** ejecución legacy real, correlada por el orquestador a
125
+ * partir de los hooks de evento/tool. `executed: false` marca una reanudación o
126
+ * un `skipped` (sin ejecución real): inelegible explícito.
127
+ */
128
+ export type ObservedLegacyRun = {
129
+ readonly runID: string;
130
+ readonly executed: boolean;
131
+ readonly status: LegacyExecutionStatus;
132
+ readonly fixes: number;
133
+ readonly nodes: readonly ObservedLegacyNode[];
134
+ readonly parentSessionRef?: string;
135
+ };
136
+ /** Resultado de la ingesta: trace elegible o inelegibilidad explícita. */
137
+ export type ShadowIngressResult = {
138
+ readonly eligible: true;
139
+ readonly trace: LegacyExecutionTraceV1;
140
+ } | {
141
+ readonly eligible: false;
142
+ readonly reason: ShadowIngressIneligibleReason;
143
+ };
144
+ /** El gate está abierto cuando la observación shadow es elegible. */
145
+ export declare function shadowIngressGateOpen(gate: ShadowIngressGate | undefined): boolean;
146
+ /**
147
+ * Ingesta la observación de una ejecución legacy real y devuelve un
148
+ * `LegacyExecutionTraceV1` reference-only, o la inelegibilidad explícita. No
149
+ * ejecuta efectos, no llama al modelo y no fabrica traces: solo proyecta lo
150
+ * observado cuando el gate está abierto y la ejecución fue real.
151
+ */
152
+ export declare function ingestLegacyExecution(observation: ObservedLegacyRun, gate: ShadowIngressGate | undefined): ShadowIngressResult;
153
+ /** Error tipado de validación del trace legacy en el boundary. */
154
+ export declare class LegacyTraceError extends Error {
155
+ readonly code: "invalid-legacy-trace";
156
+ readonly issues: string[];
157
+ constructor(error: z.ZodError);
158
+ }
159
+ /**
160
+ * Valida y parsea un trace legacy en el boundary (lo consume GE-043). Lanza
161
+ * `LegacyTraceError` si la forma es inválida o transporta claves desconocidas,
162
+ * incluidos los campos de contenido crudo.
163
+ */
164
+ export declare function parseLegacyExecutionTrace(input: unknown): LegacyExecutionTraceV1;
165
+ //# sourceMappingURL=graphShadowIngress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphShadowIngress.d.ts","sourceRoot":"","sources":["../../src/plugin/graphShadowIngress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAQlD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,8BAA8B,EAAG,CAAU,CAAC;AAEzD,oEAAoE;AACpE,eAAO,MAAM,2BAA2B;;;;EAItC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,uEAAuE;AACvE,eAAO,MAAM,yBAAyB;;;;EAIpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;kBAQzB,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAU9B,CAAC;AACZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAC1C,OAAO,4BAA4B,CACpC,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,IAAI,EAAE,S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S,GAClC,OAAO,CAET;AA0BD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,iBAAiB,EAC9B,IAAI,EAAE,iBAAiB,GAAG,SAAS,GAClC,mBAAmB,CA0BrB;AAED,kEAAkE;AAClE,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAG,sBAAsB,CAAU;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC;IAE1B,YAAY,KAAK,EAAE,CAAC,CAAC,QAAQ,EAQ5B;CACF;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,OAAO,GACb,sBAAsB,CAMxB"}
@@ -0,0 +1,63 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import type { GraphIngress, IngressDecision, IngressOutcome, IngressPolicy } from "../orchestrator/graphIngress";
3
+ import type { SessionTracker } from "./sessionTracker";
4
+ import { type ShadowObserver, type ShadowPipelineDeps } from "./shadowPipeline";
5
+ /**
6
+ * GE-050 — superficie de opencode del ingress activo de SDD.
7
+ *
8
+ * En R1 la herramienta se registra pero la puerta interna está cerrada, así que
9
+ * responde siempre "no disponible" y **explica el bloqueo más externo**. Se
10
+ * registra igualmente porque el punto de entrada es justo lo que faltaba: sin
11
+ * él, "activar el grafo" seguiría sin significar nada operativamente y R2 no
12
+ * tendría dónde enchufar el piloto.
13
+ *
14
+ * `ingress` es opcional a propósito: R1 no tiene ejecutor de efectos de sesión
15
+ * (lo aporta GE-030/GE-051), y fabricar uno falso en producción sería peor que
16
+ * declarar la ausencia. Mientras no exista, ninguna acción mutante es posible.
17
+ *
18
+ * Este módulo no nombra el otorgante interno de la capability: la puerta solo se
19
+ * abre desde el módulo que la declara, y eso se verifica estructuralmente en g5.
20
+ */
21
+ /** Acciones expuestas por la herramienta `openteam-graph`. */
22
+ export type GraphToolAction = "status" | "start" | "cancel" | "report-run";
23
+ export type GraphToolDeps = {
24
+ readonly policy: IngressPolicy;
25
+ /** Ingress real; ausente mientras el runtime activo no esté enchufado. */
26
+ readonly ingress?: GraphIngress;
27
+ /** Shadow pipeline deps; absent under mode "off" or when kill switch is active. */
28
+ readonly shadow?: ShadowPipelineDeps | undefined;
29
+ /** Session/model tracker for cross-verification of agent-reported fields. */
30
+ readonly tracker: SessionTracker;
31
+ };
32
+ /** Surface returned by createGraphTool: the tool definition plus the shadow observer. */
33
+ export type GraphToolSurface = {
34
+ /** The opencode tool definition for registration. */
35
+ readonly definition: ToolDefinition;
36
+ /**
37
+ * Observe a legacy execution through the shadow pipeline. Returns a result
38
+ * indicating whether an observation was persisted, was ineligible, or
39
+ * failed with containment. If shadow deps were not provided, returns
40
+ * ineligible with reason "shadow-not-configured".
41
+ */
42
+ readonly observeLegacyExecution: ShadowObserver;
43
+ };
44
+ /** Texto estable para una decisión de enrutado. Puro y total. */
45
+ export declare function describeDecision(decision: IngressDecision): string;
46
+ /** Texto estable para el resultado de una operación. Puro y total. */
47
+ export declare function describeOutcome(outcome: IngressOutcome): string;
48
+ /** Motivo por el que una acción mutante no puede ejecutarse todavía. */
49
+ export declare function unavailableReason(deps: GraphToolDeps, taskID: string): string;
50
+ export declare function createGraphTool(deps: GraphToolDeps): GraphToolSurface;
51
+ /**
52
+ * Despacha la acción `report-run`: valida, contrasta y produce una
53
+ * observación shadow. Contenido por try/catch: un fallo aquí nunca
54
+ * se propaga como excepción al agente.
55
+ *
56
+ * `tracker` es obligatorio: sin él no hay capacidad de contraverificación
57
+ * y todos los nodos quedan como no verificables. El compilador caza la
58
+ * omisión; el guard runtime maneja el caso dinámico imposible.
59
+ *
60
+ * Exportado para testing directo de la capa de contención externa.
61
+ */
62
+ export declare function handleReportRun(args: Record<string, unknown>, observe: ShadowObserver, tracker: SessionTracker): Promise<string>;
63
+ //# sourceMappingURL=graphTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphTool.d.ts","sourceRoot":"","sources":["../../src/plugin/graphTool.ts"],"names":[],"mapp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ACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAwDjB"}
@@ -14,6 +14,12 @@ export type ChatMessageHookOptions = {
14
14
  * altera el determinismo del router ni el hash del prompt.
15
15
  */
16
16
  injectMemory?: (queryText: string) => Promise<string | null>;
17
+ /**
18
+ * Callback de routing (issue #53): notifica la sesión y el modelo enrutado
19
+ * tras cada decisión de `chat.message`. Usado por el `SessionTracker` para
20
+ * contraverificar los campos auto-reportados del agente en `report-run`.
21
+ */
22
+ onRoute?: (sessionID: string, model: string) => void;
17
23
  };
18
24
  export declare function deriveTaskSignals(input: Parameters<ChatMessageHook>[0], output: Parameters<ChatMessageHook>[1]): TaskSignals;
19
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/plugin/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,MAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;AAEjE,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC9D,CAA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OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD,CAAC;AA8CF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EACrC,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,GACrC,WAAW,CAqBb;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EACtC,KAAK,EAAE,MAAM,GACZ,OAAO,CAQT;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,oBAAoB,EAClC,OAAO,GAAE,sBAA2B,GACnC,eAAe,CA0DjB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,EACtB,YAAY,EAAE,oBAAoB,EAClC,OAAO,GAAE,sBAA2B,GACnC,KAAK,CAIP"}
@@ -0,0 +1,60 @@
1
+ import type { ObservedLegacyRun } from "./graphShadowIngress";
2
+ import type { ReportRunPayload } from "./reportRunSchema";
3
+ import type { SessionTracker } from "./sessionTracker";
4
+ import type { ShadowPipelineResult } from "./shadowPipeline";
5
+ /**
6
+ * **Productor de `ObservedLegacyRun`** (issue #53, ADR Option D §3–4).
7
+ *
8
+ * Recibe un `ReportRunPayload` validado por Zod en la frontera, contrasta
9
+ * los campos `model` y `sessionRef` contra la telemetría de sesión/routing
10
+ * acumulada por el `SessionTracker`, construye un `ObservedLegacyRun` y lo
11
+ * pasa al observador shadow.
12
+ *
13
+ * Módulo puro (sin I/O, reloj ni azar). La contención de fallos la da el
14
+ * shadow pipeline; aquí solo se construye la observación.
15
+ */
16
+ /**
17
+ * Resultado de la producción de la observación legacy. Extiende el
18
+ * `ShadowPipelineResult` con metadatos de contraverificación.
19
+ */
20
+ export type ProducerResult = {
21
+ /** Resultado del pipeline shadow. */
22
+ readonly pipeline: ShadowPipelineResult;
23
+ /** Nodos con modelo no verificable (sessionRef ausente o sin routing). */
24
+ readonly unverifiedModels: readonly string[];
25
+ /** Nodos con modelo verificado y discrepancia. */
26
+ readonly modelMismatches: readonly string[];
27
+ /** Nodos con sessionRef desconocida. */
28
+ readonly unknownSessions: readonly string[];
29
+ };
30
+ /** Resultado conciso devuelto a la herramienta como texto. */
31
+ export type ReportRunResponse = {
32
+ readonly result: "observed" | "observation-rejected" | "ineligible" | "contained-failure";
33
+ readonly detail?: string;
34
+ /** Avisos de contraverificación, si hubo. */
35
+ readonly warnings?: readonly string[];
36
+ };
37
+ /**
38
+ * Produce una `ObservedLegacyRun` a partir de un reporte validado del agente.
39
+ * El run se marca como `executed: true` porque la acción solo se invoca al
40
+ * completar una ejecución real.
41
+ */
42
+ export declare function buildObservedRun(payload: ReportRunPayload): ObservedLegacyRun;
43
+ /**
44
+ * Contrasta los campos del reporte contra la telemetría acumulada.
45
+ * Devuelve avisos de contraverificación (warnings), nunca bloquea.
46
+ */
47
+ export declare function crossVerify(payload: ReportRunPayload, tracker: SessionTracker): {
48
+ unverifiedModels: string[];
49
+ modelMismatches: string[];
50
+ unknownSessions: string[];
51
+ };
52
+ /**
53
+ * Formatea los warnings de contraverificación para la respuesta al agente.
54
+ */
55
+ export declare function formatWarnings(verification: ReturnType<typeof crossVerify>): string[];
56
+ /**
57
+ * Construye la respuesta de texto que la herramienta devuelve al agente.
58
+ */
59
+ export declare function formatResponse(response: ReportRunResponse): string;
60
+ //# sourceMappingURL=legacyRunProducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacyRunProducer.d.ts","sourceRoot":"","sources":["../../src/plugin/legacyRunProducer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAqB,cAAc,EAAE,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";
2
+ /**
3
+ * **Esquema Zod de la acción `report-run`** (issue #53, ADR Option D).
4
+ *
5
+ * Valida la forma estructural del reporte que el agente orquestador envía
6
+ * a través de la herramienta `openteam-graph`. Claves desconocidas se
7
+ * rechazan (`.strict()`): el payload del agente solo transporta campos
8
+ * documentados.
9
+ *
10
+ * Módulo puro: sin I/O, reloj ni azar.
11
+ */
12
+ /** Nodo reportado por el agente: identidad + rol + modelo + éxito. */
13
+ export declare const ReportRunNodeSchema: z.ZodObject<{
14
+ id: z.ZodString;
15
+ role: z.ZodEnum<{
16
+ implementer: "implementer";
17
+ reviewer: "reviewer";
18
+ }>;
19
+ model: z.ZodString;
20
+ ok: z.ZodBoolean;
21
+ sessionRef: z.ZodOptional<z.ZodString>;
22
+ errorClass: z.ZodOptional<z.ZodEnum<{
23
+ cancelled: "cancelled";
24
+ permanent: "permanent";
25
+ timeout: "timeout";
26
+ transient: "transient";
27
+ unknown: "unknown";
28
+ }>>;
29
+ }, z.core.$strict>;
30
+ export type ReportRunNode = z.infer<typeof ReportRunNodeSchema>;
31
+ /** Payload completo de `report-run`. */
32
+ export declare const ReportRunPayloadSchema: z.ZodObject<{
33
+ runID: z.ZodString;
34
+ status: z.ZodEnum<{
35
+ cancelled: "cancelled";
36
+ completed: "completed";
37
+ failed: "failed";
38
+ }>;
39
+ fixes: z.ZodNumber;
40
+ nodes: z.ZodArray<z.ZodObject<{
41
+ id: z.ZodString;
42
+ role: z.ZodEnum<{
43
+ implementer: "implementer";
44
+ reviewer: "reviewer";
45
+ }>;
46
+ model: z.ZodString;
47
+ ok: z.ZodBoolean;
48
+ sessionRef: z.ZodOptional<z.ZodString>;
49
+ errorClass: z.ZodOptional<z.ZodEnum<{
50
+ cancelled: "cancelled";
51
+ permanent: "permanent";
52
+ timeout: "timeout";
53
+ transient: "transient";
54
+ unknown: "unknown";
55
+ }>>;
56
+ }, z.core.$strict>>;
57
+ parentSessionRef: z.ZodOptional<z.ZodString>;
58
+ }, z.core.$strict>;
59
+ export type ReportRunPayload = z.infer<typeof ReportRunPayloadSchema>;
60
+ //# sourceMappingURL=reportRunSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportRunSchema.d.ts","sourceRoot":"","sources":["../../src/plugin/reportRunSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB;;;;;;;;;GASG;AAEH,sEAAsE;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;kBASrB,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,wCAAwC;AACxC,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQxB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * **Rastreador de sesiones y modelos** (issue #53, ADR Option D §1).
3
+ *
4
+ * Acumula en memoria las sesiones conocidas (de eventos de ciclo de vida) y
5
+ * el modelo enrutado por sesión (de decisiones de `chat.message`). Ambos
6
+ * datos se usan para contraverificar los campos auto-reportados del agente
7
+ * en la acción `report-run`.
8
+ *
9
+ * Módulo con estado mutable (in-memory map); vive en `plugin/` porque es
10
+ * parte de la superficie de producción del plugin, no del router puro.
11
+ */
12
+ /** Resultado de la contraverificación de modelo para un nodo. */
13
+ export type ModelVerification = {
14
+ readonly verified: true;
15
+ readonly match: boolean;
16
+ } | {
17
+ readonly verified: false;
18
+ };
19
+ /** Resultado de la contraverificación de sessionRef. */
20
+ export type SessionRefVerification = {
21
+ readonly known: true;
22
+ } | {
23
+ readonly known: false;
24
+ } | {
25
+ readonly known: null;
26
+ };
27
+ export type SessionTracker = {
28
+ /** Registra una sesión conocida (de session.created, session.idle, etc.). */
29
+ readonly trackSession: (sessionID: string) => void;
30
+ /** Registra el modelo enrutado para una sesión (de chat.message). */
31
+ readonly trackRoutedModel: (sessionID: string, model: string) => void;
32
+ /** Verifica si un modelo reportado coincide con el enrutado. */
33
+ readonly verifyModel: (sessionRef: string, reportedModel: string) => ModelVerification;
34
+ /** Verifica si una referencia de sesión corresponde a una sesión conocida. */
35
+ readonly verifySessionRef: (sessionRef: string | undefined) => SessionRefVerification;
36
+ };
37
+ /**
38
+ * Crea un rastreador de sesiones y modelos. El estado es efímero: vive
39
+ * mientras el plugin esté cargado, no se persiste.
40
+ */
41
+ export declare function createSessionTracker(): SessionTracker;
42
+ //# sourceMappingURL=sessionTracker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionTracker.d.ts","sourceRoot":"","sources":["../../src/plugin/sessionTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iEAAiE;AACjE,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAA;CAAE,CAAC;AAEjC,wDAAwD;AACxD,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CAAC;AAE7B,MAAM,MAAM,cAAc,GAAG;IAC3B,6EAA6E;IAC7E,QAAQ,CAAC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,qEAAqE;IACrE,QAAQ,CAAC,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,CACpB,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,KAClB,iBAAiB,CAAC;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,EAAE,CACzB,UAAU,EAAE,MAAM,GAAG,SAAS,KAC3B,sBAAsB,CAAC;CAC7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CA4BrD"}