@jmanuelcorral/openteam 0.1.40 → 0.1.41

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 (87) hide show
  1. package/AGENTS.md +15 -0
  2. package/README.es.md +1 -1
  3. package/README.md +1 -1
  4. package/dist/cli.js +39 -2
  5. package/dist/commands/graph.d.ts +65 -0
  6. package/dist/commands/graph.d.ts.map +1 -0
  7. package/dist/config/load.d.ts.map +1 -1
  8. package/dist/config/migrations.d.ts +27 -0
  9. package/dist/config/migrations.d.ts.map +1 -0
  10. package/dist/config/resolve.d.ts +34 -0
  11. package/dist/config/resolve.d.ts.map +1 -0
  12. package/dist/config/schema.d.ts +39 -0
  13. package/dist/config/schema.d.ts.map +1 -1
  14. package/dist/context/redaction.d.ts +48 -0
  15. package/dist/context/redaction.d.ts.map +1 -0
  16. package/dist/context/schema.d.ts +115 -0
  17. package/dist/context/schema.d.ts.map +1 -0
  18. package/dist/context/types.d.ts +8 -0
  19. package/dist/context/types.d.ts.map +1 -0
  20. package/dist/graph/events.d.ts +25 -0
  21. package/dist/graph/events.d.ts.map +1 -0
  22. package/dist/graph/ids.d.ts +5 -0
  23. package/dist/graph/ids.d.ts.map +1 -0
  24. package/dist/graph/planner.d.ts +15 -0
  25. package/dist/graph/planner.d.ts.map +1 -0
  26. package/dist/graph/policies.d.ts +34 -0
  27. package/dist/graph/policies.d.ts.map +1 -0
  28. package/dist/graph/privacyPolicy.d.ts +29 -0
  29. package/dist/graph/privacyPolicy.d.ts.map +1 -0
  30. package/dist/graph/reducer.d.ts +27 -0
  31. package/dist/graph/reducer.d.ts.map +1 -0
  32. package/dist/graph/replay.d.ts +20 -0
  33. package/dist/graph/replay.d.ts.map +1 -0
  34. package/dist/graph/reviewerPolicy.d.ts +27 -0
  35. package/dist/graph/reviewerPolicy.d.ts.map +1 -0
  36. package/dist/graph/schema.d.ts +220 -0
  37. package/dist/graph/schema.d.ts.map +1 -0
  38. package/dist/graph/types.d.ts +40 -0
  39. package/dist/graph/types.d.ts.map +1 -0
  40. package/dist/graph/validate.d.ts +19 -0
  41. package/dist/graph/validate.d.ts.map +1 -0
  42. package/dist/index.js +39 -2
  43. package/dist/orchestrator/graphCancellation.d.ts +84 -0
  44. package/dist/orchestrator/graphCancellation.d.ts.map +1 -0
  45. package/dist/orchestrator/graphEffects.d.ts +63 -0
  46. package/dist/orchestrator/graphEffects.d.ts.map +1 -0
  47. package/dist/orchestrator/graphReview.d.ts +84 -0
  48. package/dist/orchestrator/graphReview.d.ts.map +1 -0
  49. package/dist/orchestrator/graphRuntime.d.ts +69 -0
  50. package/dist/orchestrator/graphRuntime.d.ts.map +1 -0
  51. package/dist/orchestrator/opencodeSessionAdapter.d.ts +117 -0
  52. package/dist/orchestrator/opencodeSessionAdapter.d.ts.map +1 -0
  53. package/dist/orchestrator/sdd.d.ts +38 -2
  54. package/dist/orchestrator/sdd.d.ts.map +1 -1
  55. package/dist/orchestrator/sddCompiler.d.ts +44 -0
  56. package/dist/orchestrator/sddCompiler.d.ts.map +1 -0
  57. package/dist/orchestrator/sessionReconciler.d.ts +74 -0
  58. package/dist/orchestrator/sessionReconciler.d.ts.map +1 -0
  59. package/dist/orchestrator/shadowComparator.d.ts +62 -0
  60. package/dist/orchestrator/shadowComparator.d.ts.map +1 -0
  61. package/dist/storage/graph/codec.d.ts +52 -0
  62. package/dist/storage/graph/codec.d.ts.map +1 -0
  63. package/dist/storage/graph/fsGraphJournal.d.ts +3 -0
  64. package/dist/storage/graph/fsGraphJournal.d.ts.map +1 -0
  65. package/dist/storage/graph/importLegacy.d.ts +62 -0
  66. package/dist/storage/graph/importLegacy.d.ts.map +1 -0
  67. package/dist/storage/graph/memoryGraphJournal.d.ts +11 -0
  68. package/dist/storage/graph/memoryGraphJournal.d.ts.map +1 -0
  69. package/dist/storage/graph/migrateLegacyBriefs.d.ts +32 -0
  70. package/dist/storage/graph/migrateLegacyBriefs.d.ts.map +1 -0
  71. package/dist/storage/graph/projections.d.ts +31 -0
  72. package/dist/storage/graph/projections.d.ts.map +1 -0
  73. package/dist/storage/graph/provider.d.ts +52 -0
  74. package/dist/storage/graph/provider.d.ts.map +1 -0
  75. package/dist/storage/graph/recovery.d.ts +38 -0
  76. package/dist/storage/graph/recovery.d.ts.map +1 -0
  77. package/dist/storage/graph/runRegistry.d.ts +17 -0
  78. package/dist/storage/graph/runRegistry.d.ts.map +1 -0
  79. package/dist/storage/graph/snapshot.d.ts +44 -0
  80. package/dist/storage/graph/snapshot.d.ts.map +1 -0
  81. package/dist/storage/graph/workspaceLease.d.ts +36 -0
  82. package/dist/storage/graph/workspaceLease.d.ts.map +1 -0
  83. package/dist/storage/graph/writer.d.ts +20 -0
  84. package/dist/storage/graph/writer.d.ts.map +1 -0
  85. package/dist/telemetry/graphProjection.d.ts +36 -0
  86. package/dist/telemetry/graphProjection.d.ts.map +1 -0
  87. package/package.json +1 -1
@@ -0,0 +1,84 @@
1
+ import { type Sha256, type TaskAnchor } from "../context/schema";
2
+ import type { Capability } from "../graph/types";
3
+ /** Veredicto normalizado de una revisión. */
4
+ export type ReviewVerdict = {
5
+ readonly decision: "approved";
6
+ } | {
7
+ readonly decision: "rejected";
8
+ readonly reason: string;
9
+ } | {
10
+ readonly decision: "inconclusive";
11
+ readonly reason: string;
12
+ };
13
+ /** Lo que el runtime despachó y a lo que debe anclarse la aprobación. */
14
+ export type ReviewExpectation = {
15
+ readonly anchor: TaskAnchor;
16
+ readonly artifactSha256: Sha256;
17
+ };
18
+ /**
19
+ * Parsea el veredicto de forma conservadora. Entrada no estructurada o inválida
20
+ * es `inconclusive`; un rechazo se honra con su motivo; una aprobación exige un
21
+ * ancla y un digest de artefacto que coincidan con lo despachado, y en cualquier
22
+ * discrepancia degrada a `inconclusive` (fail-closed).
23
+ */
24
+ export declare function parseReviewVerdict(raw: unknown, expected: ReviewExpectation): ReviewVerdict;
25
+ /** Decisión de lockout del efecto de un reviewer antes del despacho. */
26
+ export type ReviewerEffectDecision = {
27
+ readonly kind: "allow";
28
+ } | {
29
+ readonly kind: "reject";
30
+ readonly capability: Capability;
31
+ };
32
+ /**
33
+ * Bloquea el efecto de un reviewer a solo lectura. Devuelve `reject` con la
34
+ * primera capacidad mutante planificada (orden de entrada, determinista); si
35
+ * todas las capacidades son de solo lectura, `allow`.
36
+ */
37
+ export declare function reviewerEffectDecision(capabilities: readonly Capability[]): ReviewerEffectDecision;
38
+ /** Plan de linaje tras un rechazo: nueva revisión enlazada o agotamiento. */
39
+ export type RevisionPlan = {
40
+ readonly kind: "revise";
41
+ readonly nodeID: string;
42
+ /** Índice de la nueva revisión (0 la implementación inicial). */
43
+ readonly revision: number;
44
+ /** Operación de la nueva revisión, distinta de la anterior. */
45
+ readonly operationID: string;
46
+ /** Operación de la que procede (enlace append-only). */
47
+ readonly previousOperationID: string;
48
+ } | {
49
+ readonly kind: "exhausted";
50
+ readonly revision: number;
51
+ };
52
+ /**
53
+ * Planifica la revisión que enlaza un rechazo. Si aún queda margen bajo el
54
+ * límite, produce una nueva revisión con una `operationID` distinta que apunta
55
+ * a la anterior (`previousOperationID`), preservando la historia append-only;
56
+ * si se agotó el margen, `exhausted`.
57
+ */
58
+ export declare function planRevision(input: {
59
+ readonly runID: string;
60
+ readonly nodeID: string;
61
+ readonly currentRevision: number;
62
+ readonly currentOperationID: string;
63
+ readonly limit?: number;
64
+ }): RevisionPlan;
65
+ /** Resultado de reasignar el reviewer tras un fallo técnico. */
66
+ export type ReviewerReassignment = {
67
+ readonly kind: "reassign";
68
+ readonly reviewerID: string;
69
+ /** Un fallo técnico del reviewer no re-ejecuta la implementación. */
70
+ readonly rerunImplementation: false;
71
+ } | {
72
+ readonly kind: "no-reviewer";
73
+ };
74
+ /**
75
+ * Reasigna la revisión al primer candidato elegible (orden de entrada), nunca
76
+ * el autor ni un reviewer que ya falló. La implementación no se re-ejecuta: su
77
+ * artefacto se conserva. Sin candidatos elegibles, `no-reviewer`.
78
+ */
79
+ export declare function reassignReviewer(input: {
80
+ readonly authorID: string;
81
+ readonly failedReviewers: readonly string[];
82
+ readonly candidates: readonly string[];
83
+ }): ReviewerReassignment;
84
+ //# sourceMappingURL=graphReview.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphReview.d.ts","sourceRoot":"","sources":["../../src/orchestrator/graphReview.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,MAAM,EAEX,KAAK,UAAU,EAEhB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA6BjD,6CAA6C;AAC7C,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;CAAE,GACjC;IAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnE,yEAAyE;AACzE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACjC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,iBAAiB,GAC1B,aAAa,CAsBf;AAED,wEAAwE;AACxE,MAAM,MAAM,sBAAsB,GAC9B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,SAAS,UAAU,EAAE,GAClC,sBAAsB,CAOxB;AAED,6EAA6E;AAC7E,MAAM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GraphSpecV1 } from "../graph/schema";
2
+ import type { RunStatus } from "../graph/types";
3
+ import type { GraphJournal } from "../storage/graph/provider";
4
+ import type { WorkspaceLease } from "../storage/graph/workspaceLease";
5
+ import type { GraphEffectExecutor } from "./graphEffects";
6
+ /**
7
+ * Runtime single-writer de Graph (GE-031, GE-033).
8
+ *
9
+ * Un `step` adquiere (idempotentemente) el lease del workspace, garantiza el
10
+ * evento `run.started`, y avanza **como mucho un efecto**: commitea la intención
11
+ * (`node.dispatched`) en el journal antes de invocar el executor y el recibo
12
+ * (`node.succeeded`/`node.failed`) después. Reanuda tras un reinicio tomando el
13
+ * relevo del journal (`takeOver`) y no re-despacha un efecto en vuelo: un nodo
14
+ * `running` sin recibo se deja a la reconciliación (GE-032) devolviendo
15
+ * `blocked`. El fencing del lease impide un segundo orquestador simultáneo.
16
+ *
17
+ * Reintentos (GE-033): un nodo `failed` con una clase de error reintentable
18
+ * (`transient`/`timeout`) y dentro del límite se vuelve a despachar con el mismo
19
+ * `operationID` y un `attemptID` nuevo derivado del journal, de modo que la
20
+ * decisión y el ID reaparecen igual tras un reinicio. El retardo de backoff es
21
+ * una función pura del índice de intento que el runtime expone en el resultado
22
+ * del paso; no duerme ni consulta reloj.
23
+ *
24
+ * El runtime aísla toda la lógica de orquestación; el I/O real vive en los
25
+ * puertos inyectados (`WorkspaceLease`, `GraphJournal`, `GraphEffectExecutor`),
26
+ * de modo que se prueba con dobles deterministas sin red ni SDK.
27
+ */
28
+ /** Resultado de un `step` del runtime. */
29
+ export type RuntimeStepOutcome = {
30
+ readonly kind: "dispatched";
31
+ readonly nodeID: string;
32
+ readonly operationID: string;
33
+ readonly attemptID: string;
34
+ /** Índice de intento (0 el primero); crece en cada reintento. */
35
+ readonly attempt: number;
36
+ /** Retardo determinista sugerido antes de este intento, en ms. */
37
+ readonly backoffMs: number;
38
+ } | {
39
+ readonly kind: "completed";
40
+ } | {
41
+ readonly kind: "failed";
42
+ } | {
43
+ readonly kind: "blocked";
44
+ readonly reason: "in-flight-effect";
45
+ } | {
46
+ readonly kind: "terminal";
47
+ readonly status: RunStatus;
48
+ };
49
+ /** Dependencias inyectadas del runtime; ninguna hace I/O dentro de este módulo. */
50
+ export type GraphRuntimeDeps = {
51
+ readonly spec: GraphSpecV1;
52
+ readonly journal: GraphJournal;
53
+ readonly lease: WorkspaceLease;
54
+ readonly effects: GraphEffectExecutor;
55
+ readonly holder: string;
56
+ /** Límite de intentos por nodo reintentable; por defecto `DEFAULT_RETRY_LIMIT`. */
57
+ readonly retryLimit?: number;
58
+ };
59
+ /** Runtime que avanza un run de Graph paso a paso. */
60
+ export interface GraphRuntime {
61
+ /** Adquiere el lease y garantiza `run.started`; idempotente. */
62
+ start(): Promise<void>;
63
+ /** Avanza como mucho un efecto y devuelve el resultado del paso. */
64
+ step(): Promise<RuntimeStepOutcome>;
65
+ /** Repite `step` hasta un estado no despachador (terminal, completado, etc.). */
66
+ runToCompletion(): Promise<RuntimeStepOutcome>;
67
+ }
68
+ export declare function createGraphRuntime(deps: GraphRuntimeDeps): GraphRuntime;
69
+ //# sourceMappingURL=graphRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphRuntime.d.ts","sourceRoot":"","sources":["../../src/orchestrator/graphRuntime.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAc,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,KAAK,EACV,YAAY,EAGb,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,kBAAkB,GAC1B;IACE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAA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 @@
1
+ import type { ModelSelection } from "../router/types";
2
+ /**
3
+ * Adaptador tipado de sesión de opencode (GE-030).
4
+ *
5
+ * Estrecha la superficie de sesión de opencode a las seis operaciones de ciclo
6
+ * de vida verificadas por el contrato (create, dispatch/prompt, children,
7
+ * status/get, messages, abort) y normaliza cada fallo del cliente a un error
8
+ * tipado {@link SessionAdapterError}. Deliberadamente **no** expone acciones
9
+ * destructivas ni de resumen (delete, summarize, share/unshare, fork, command):
10
+ * la autoridad del grafo nunca borra ni resume una sesión de forma automática.
11
+ *
12
+ * El adaptador no realiza I/O propio: envuelve un cliente inyectado
13
+ * ({@link GraphSessionClient}) cuya forma es asignable desde el cliente real de
14
+ * `@opencode-ai/sdk`. Un contract test fija esa correspondencia.
15
+ */
16
+ /** Resultado del SDK: dato tipado o error opaco, nunca ambos. */
17
+ type ClientResult<T> = {
18
+ data?: T;
19
+ error?: unknown;
20
+ };
21
+ /** Referencia mínima a una sesión (subconjunto verificado de `Session`). */
22
+ export type SessionInfo = {
23
+ readonly id: string;
24
+ };
25
+ /**
26
+ * Puerto del cliente de sesión de opencode acotado a las operaciones que usa el
27
+ * adaptador. Estructuralmente compatible con `client.session` del SDK real.
28
+ */
29
+ export type GraphSessionClient = {
30
+ session: {
31
+ create(args: {
32
+ body?: {
33
+ parentID?: string;
34
+ title?: string;
35
+ };
36
+ query?: {
37
+ directory?: string;
38
+ };
39
+ }): Promise<ClientResult<{
40
+ id: string;
41
+ }>>;
42
+ prompt(args: {
43
+ path: {
44
+ id: string;
45
+ };
46
+ body: {
47
+ model?: ModelSelection;
48
+ agent?: string;
49
+ system?: string;
50
+ parts: Array<{
51
+ type: "text";
52
+ text: string;
53
+ }>;
54
+ };
55
+ }): Promise<ClientResult<unknown>>;
56
+ children(args: {
57
+ path: {
58
+ id: string;
59
+ };
60
+ }): Promise<ClientResult<ReadonlyArray<SessionInfo>>>;
61
+ get(args: {
62
+ path: {
63
+ id: string;
64
+ };
65
+ }): Promise<ClientResult<SessionInfo>>;
66
+ messages(args: {
67
+ path: {
68
+ id: string;
69
+ };
70
+ }): Promise<ClientResult<ReadonlyArray<unknown>>>;
71
+ abort(args: {
72
+ path: {
73
+ id: string;
74
+ };
75
+ }): Promise<ClientResult<boolean>>;
76
+ };
77
+ };
78
+ /** Taxonomía cerrada de errores del adaptador de sesión. */
79
+ export type SessionAdapterErrorCode = "create-failed" | "missing-session-id" | "dispatch-failed" | "children-failed" | "status-failed" | "messages-failed" | "abort-failed";
80
+ /** Error tipado de una operación de sesión que falló o devolvió datos inválidos. */
81
+ export declare class SessionAdapterError extends Error {
82
+ readonly code: SessionAdapterErrorCode;
83
+ readonly detail: string;
84
+ constructor(code: SessionAdapterErrorCode, detail: string);
85
+ }
86
+ /** Datos para crear una sub-sesión hija. */
87
+ export type CreateChildInput = {
88
+ readonly parentSessionID?: string;
89
+ readonly title?: string;
90
+ readonly directory?: string;
91
+ };
92
+ /** Datos para despachar un prompt (el efecto) a una sesión existente. */
93
+ export type DispatchInput = {
94
+ readonly sessionID: string;
95
+ readonly prompt: string;
96
+ readonly model?: ModelSelection;
97
+ readonly agent?: string;
98
+ readonly system?: string;
99
+ };
100
+ /** Superficie verificada del adaptador de sesión de opencode. */
101
+ export interface OpencodeSessionAdapter {
102
+ /** Crea una sub-sesión hija y devuelve su id; falla cerrado si no hay id. */
103
+ createChild(input: CreateChildInput): Promise<string>;
104
+ /** Despacha un prompt a la sesión y devuelve la respuesta cruda del efecto. */
105
+ dispatch(input: DispatchInput): Promise<unknown>;
106
+ /** Lista los ids de las sesiones hijas. */
107
+ listChildren(sessionID: string): Promise<readonly string[]>;
108
+ /** Devuelve el estado de la sesión (get por id). */
109
+ getStatus(sessionID: string): Promise<SessionInfo>;
110
+ /** Lista los mensajes de la sesión. */
111
+ listMessages(sessionID: string): Promise<readonly unknown[]>;
112
+ /** Solicita abortar la sesión; devuelve si el runtime lo aceptó. */
113
+ abort(sessionID: string): Promise<boolean>;
114
+ }
115
+ export declare function createOpencodeSessionAdapter(client: GraphSessionClient): OpencodeSessionAdapter;
116
+ export {};
117
+ //# sourceMappingURL=opencodeSessionAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencodeSessionAdapter.d.ts","sourceRoot":"","sources":["../../src/orchestrator/opencodeSessionAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD;;;;;;;;;;;;;GAaG;AAEH,iEAAiE;AACjE,KAAK,YAAY,CAAC,CAAC,IAAI;IAAE,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAErD,4EAA4E;AAC5E,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE;QACP,MAAM,CAAC,IAAI,EAAE;YACX,IAAI,CAAC,EAAE;gBAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;YAC7C,KAAK,CAAC,EAAE;gBAAE,SAAS,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SAChC,GAAG,OAAO,CAAC,YAAY,CAAC;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,EAAE;YACX,IAAI,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAA;aAAE,CAAC;YACrB,IAAI,EAAE;gBACJ,KAAK,CAAC,EAAE,cAAc,CAAC;gBACvB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,KAAK,EAAE,KAAK,CAAC;oBAAE,IAAI,EAAE,MAAM,CAAC;oBAAC,IAAI,EAAE,MAAM,CAAA;iBAAE,CAAC,CAAC;aAC9C,CAAC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,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,sBAAsB;IACrC,6EAA6E;IAC7E,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,2CAA2C;IAC3C,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC5D,oDAAoD;IACpD,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACnD,uCAAuC;IACvC,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;IAC7D,oEAAoE;IACpE,KAAK,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5C;AAiBD,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,kBAAkB,GACzB,sBAAsB,CA4GxB"}
@@ -1,4 +1,5 @@
1
1
  import type { OpenTeamConfig } from "../config/schema";
2
+ import { type ArtifactManifest, type ContextRef, type PrivacyClass } from "../context/schema";
2
3
  import type { TaskSignals } from "../router/types";
3
4
  import type { StorageProvider } from "../storage/provider";
4
5
  import { type CoordinatorDeps, type RoleTaskResult } from "./coordinator";
@@ -7,8 +8,10 @@ import { type CoordinatorDeps, type RoleTaskResult } from "./coordinator";
7
8
  * boundary de openteam. Por cada tarea:
8
9
  *
9
10
  * 1. Reanuda desde el ledger: si la tarea ya está `complete`, la salta.
10
- * 2. Persiste un **task brief** como fichero (higiene de contexto: el
11
- * implementer recibe solo su tarea, no el historial acumulado).
11
+ * 2. Persiste un **manifiesto redactado** de inputs del brief (referencia +
12
+ * digest, nunca el brief crudo) y entrega el brief íntegro al implementer
13
+ * **en memoria** vía el prompt (higiene de contexto: el implementer recibe
14
+ * solo su tarea, no el historial acumulado).
12
15
  * 3. Despacha el **implementer** con el brief.
13
16
  * 4. Despacha el **reviewer** (rol con alto code-quality) para revisar el
14
17
  * cambio; la generación del diff vive en el propio agente reviewer.
@@ -71,6 +74,39 @@ export type SddPlanResult = {
71
74
  failed: string[];
72
75
  skipped: string[];
73
76
  };
77
+ /**
78
+ * Texto **completo** del brief en memoria para el prompt del implementer.
79
+ *
80
+ * GE-007 congela que el brief íntegro es un input de dispatch **en memoria**
81
+ * (byte a byte), nunca solo una ruta a fichero; un prompt path-only es una
82
+ * regresión funcional. GE-038 lo cablea al text part de `session.prompt`. Puro:
83
+ * no persiste nada.
84
+ */
85
+ export declare function implementerBriefInput(task: SddTask): string;
86
+ /** Opciones del manifiesto redactado de inputs del brief. */
87
+ export type BriefManifestOptions = {
88
+ /** Clase de privacidad del manifiesto (def: `internal`). */
89
+ privacyClass?: PrivacyClass;
90
+ /** Referencia estable del brief cuando persiste como artefacto revalidable. */
91
+ briefRef?: ContextRef;
92
+ };
93
+ /** Manifiesto redactado del brief más su elegibilidad para shadow. */
94
+ export type BriefManifestResult = {
95
+ manifest: ArtifactManifest;
96
+ /** Solo elegible si **cada** input seleccionado tiene referencia estable. */
97
+ shadowEligible: boolean;
98
+ };
99
+ /**
100
+ * Construye el manifiesto **redactado** de inputs del brief (GE-007).
101
+ *
102
+ * Sustituye el fichero de brief crudo por una referencia/digest ordenada:
103
+ * versión, taskID, clase de privacidad y una entrada por input con digest
104
+ * SHA-256 y tamaño en bytes; nunca título, extracto, prompt ni salida del
105
+ * modelo. Un brief sin referencia estable produce una entrada solo-digest y
106
+ * queda **inelegible** para shadow (no se fabrica una referencia). Puro y
107
+ * determinista: solo cómputo de digest, sin I/O.
108
+ */
109
+ export declare function briefInputManifest(task: SddTask, options?: BriefManifestOptions): BriefManifestResult;
74
110
  /** Extrae texto de una respuesta opaca del modelo (best-effort). Puro. */
75
111
  export declare function extractResponseText(response: unknown): string;
76
112
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sdd.d.ts","sourceRoot":"","sources":["../../src/orchestrator/sdd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,cAAc,EAEpB,MAAM,eAAe,CAAC;AASvB;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,2BAA2B,CAAC;AAElE,gCAAgC;AAChC,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB,wEAAwE;IACxE,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,IAAI,EAAE,WAAW,CAAC;IAClB,oEAAoE;IACpE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;C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GACjC,mBAAmB,CAarB;AA6ED,0EAA0E;AAC1E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAuB7D;AAKD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,cAAc,GAAG,aAAa,CAO1E;AAuBD,8EAA8E;AAC9E,wBAAsB,UAAU,CAC9B,IAAI,EAAE,OAAO,EACb,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,cAAc,CAAC,CAuHzB;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,KAAK,EAAE,SAAS,OAAO,EAAE,EACzB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,aAAa,CAAC,CAoBxB"}
@@ -0,0 +1,44 @@
1
+ import { type GraphSpecV1 } from "../graph/schema";
2
+ import { type SddTask } from "./sdd";
3
+ /**
4
+ * Compilador **puro** de una tarea SDD legacy a un `GraphSpecV1` estático
5
+ * (GE-041).
6
+ *
7
+ * La cadena implement → review → revise → re-review se expande a un DAG
8
+ * acíclico versionado: un nodo `implementer` inicial, su `reviewer`, y por cada
9
+ * ronda de revisión un nuevo `implementer` (revise) con su `reviewer`
10
+ * (re-review). El spec resultante:
11
+ *
12
+ * - es **reference-only**: los nodos solo llevan ids, roles y un `anchor`
13
+ * (taskID + digest), nunca el brief crudo;
14
+ * - es **determinista**: la misma tarea produce el mismo spec y el mismo
15
+ * digest (`graphSpecDigest`);
16
+ * - **falla antes de dispatch** ante un rol inválido, un autor que también
17
+ * revisa, o un id de tarea que no es un `NodeID` válido.
18
+ *
19
+ * Sin I/O, reloj ni random: solo cómputo de digest y validación estructural.
20
+ */
21
+ /** Código de fallo de compilación (falla antes de cualquier dispatch). */
22
+ export type SddCompileErrorCode = "invalid-role" | "author-is-reviewer" | "invalid-spec";
23
+ /** Error tipado de una compilación rechazada. */
24
+ export declare class SddCompileError extends Error {
25
+ readonly code: SddCompileErrorCode;
26
+ readonly detail: string;
27
+ constructor(code: SddCompileErrorCode, detail: string);
28
+ }
29
+ /** Opciones de compilación. */
30
+ export type SddCompileOptions = {
31
+ /** Rol del reviewer (def: el de la tarea o `reviewer`). */
32
+ reviewerRoleID?: string;
33
+ /** Rondas de revisión revise/re-review a expandir (def: 1). */
34
+ revisionRounds?: number;
35
+ };
36
+ /** Digest SHA-256 estable del spec compilado (reproducible). */
37
+ export declare function graphSpecDigest(spec: GraphSpecV1): string;
38
+ /**
39
+ * Compila una tarea SDD legacy a un `GraphSpecV1` validado. Lanza
40
+ * `SddCompileError` ante rol/autor/spec inválidos, siempre **antes** de
41
+ * cualquier dispatch.
42
+ */
43
+ export declare function compileSddTask(task: SddTask, options?: SddCompileOptions): GraphSpecV1;
44
+ //# sourceMappingURL=sddCompiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sddCompiler.d.ts","sourceRoot":"","sources":["../../src/orchestrator/sddCompiler.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,WAAW,EAEjB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA4B,KAAK,OAAO,EAAE,MAAM,OAAO,CAAC;AAE/D;;;;;;;;;;;;;;;;;GAiBG;AAEH,0EAA0E;AAC1E,MAAM,MAAM,mBAAmB,GAC3B,cAAc,GACd,oBAAoB,GACpB,cAAc,CAAC;AAEnB,iDAAiD;AACjD,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM;CAMtD;AAED,+BAA+B;AAC/B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAuCF,gEAAgE;AAChE,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,iBAAsB,GAC9B,WAAW,CA0Db"}
@@ -0,0 +1,74 @@
1
+ import type { NodeStatus } from "../graph/types";
2
+ /**
3
+ * Reconciliador de ventanas de crash de create/prompt (GE-032).
4
+ *
5
+ * Tras un fallo a mitad de crear la sub-sesión hija o despachar el prompt, el
6
+ * runtime no sabe si el efecto llegó a empezar. Este módulo clasifica la
7
+ * ventana usando la **sesión hija correlacionada** de opencode y decide sin
8
+ * reintentar a ciegas:
9
+ *
10
+ * - `not-started`: no hay hija correlacionada; el efecto puede despacharse.
11
+ * - `active`: existe una única hija correlacionada aún en curso; se **adopta**.
12
+ * - `completed`: existe una única hija correlacionada terminada; se **adopta**.
13
+ * - `unknown`: la evidencia es ambigua (varias hijas correlacionadas); se
14
+ * **bloquea** el reintento ciego y se exige reconciliación segura.
15
+ *
16
+ * Un nodo con recibo ya escrito (terminal) hace que la reconciliación sea un
17
+ * **no-op idempotente**. Puro y determinista: sin I/O, reloj ni random; el
18
+ * runtime le pasa la evidencia ya observada a través de puertos inyectados.
19
+ */
20
+ /** Clasificación de la ventana de crash de un efecto. */
21
+ export type CrashWindowClass = "not-started" | "active" | "completed" | "unknown";
22
+ /** Decisión de reconciliación derivada de la ventana. */
23
+ export type ReconcileDecision = "dispatch" | "adopt" | "block" | "noop";
24
+ /** Estado observado de una sesión hija de opencode. */
25
+ export type ObservedChildState = "active" | "completed";
26
+ /** Sesión hija observada con su título de correlación y estado. */
27
+ export type ObservedChild = {
28
+ readonly sessionID: string;
29
+ readonly title: string;
30
+ readonly state: ObservedChildState;
31
+ };
32
+ /** Evidencia correlacionada sobre la hija de un intento concreto. */
33
+ export type ChildObservation = {
34
+ readonly kind: "none";
35
+ } | {
36
+ readonly kind: "active";
37
+ readonly sessionID: string;
38
+ } | {
39
+ readonly kind: "completed";
40
+ readonly sessionID: string;
41
+ } | {
42
+ readonly kind: "ambiguous";
43
+ readonly detail: string;
44
+ };
45
+ /** Entrada de la reconciliación de un nodo. */
46
+ export type ReconcileInput = {
47
+ readonly nodeStatus: NodeStatus;
48
+ readonly observation: ChildObservation;
49
+ };
50
+ /** Resultado de la reconciliación: ventana, decisión y hija adoptada si aplica. */
51
+ export type ReconcileResult = {
52
+ readonly window: CrashWindowClass;
53
+ readonly decision: ReconcileDecision;
54
+ readonly sessionID?: string;
55
+ };
56
+ /**
57
+ * Título de correlación determinista de la hija del intento `(runID, op,
58
+ * attempt)`. El runtime lo fija como título de la sub-sesión al crearla, de
59
+ * modo que un reinicio pueda reencontrar exactamente la misma hija.
60
+ */
61
+ export declare function correlationTitle(runID: string, operationID: string, attemptID: string): string;
62
+ /**
63
+ * Reduce las hijas observadas a la evidencia correlacionada del intento. Cero
64
+ * coincidencias es `none`; exactamente una determina `active`/`completed`;
65
+ * más de una es `ambiguous` (no se puede adoptar una sola con seguridad).
66
+ */
67
+ export declare function observeChild(expectedTitle: string, children: readonly ObservedChild[]): ChildObservation;
68
+ /**
69
+ * Clasifica la ventana de crash de un nodo y decide la acción segura. Un nodo
70
+ * terminal (recibo ya escrito) es un no-op idempotente; un nodo `pending` no ha
71
+ * empezado; un nodo `running` se clasifica por la evidencia correlacionada.
72
+ */
73
+ export declare function reconcileSession(input: ReconcileInput): ReconcileResult;
74
+ //# sourceMappingURL=sessionReconciler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionReconciler.d.ts","sourceRoot":"","sources":["../../src/orchestrator/sessionReconciler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AAEH,yDAAyD;AACzD,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,QAAQ,GACR,WAAW,GACX,SAAS,CAAC;AAEd,yDAAyD;AACzD,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,GAAG,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AQ,EAAE,SAAS,aAAa,EAAE,GACjC,gBAAgB,CAelB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAiCvE"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Comparador de **paridad shadow** y tally de proyección idempotente (GE-044).
3
+ *
4
+ * Compara un run legacy con su espejo shadow (sin efectos) sobre dimensiones
5
+ * **normalizadas**: estado terminal, orden de nodos, roles, modelos, número de
6
+ * fixes y outcome. La ausencia de evidencia en cualquier lado es
7
+ * `inconclusive`. El informe es **reference-only**: solo códigos y veredicto,
8
+ * nunca contenido crudo. El tally de proyección es **idempotente** por run: una
9
+ * proyección duplicada no vuelve a contar.
10
+ *
11
+ * Puro y determinista: sin I/O, reloj, random ni estado global.
12
+ */
13
+ /** Rol normalizado de un nodo del run. */
14
+ export type ShadowNodeRole = "implementer" | "reviewer";
15
+ /** Estado terminal normalizado de un run. */
16
+ export type ShadowRunStatus = "completed" | "failed" | "cancelled";
17
+ /** Outcome normalizado del review de un run. */
18
+ export type ShadowRunOutcome = "approved" | "rejected" | "inconclusive";
19
+ /** Resumen normalizado de un nodo (solo referencias/etiquetas acotadas). */
20
+ export type ShadowNodeSummary = {
21
+ readonly id: string;
22
+ readonly role: ShadowNodeRole;
23
+ readonly model: string;
24
+ };
25
+ /** Resumen normalizado de un run, apto para comparar paridad. */
26
+ export type ShadowRunSummary = {
27
+ readonly runID: string;
28
+ readonly status: ShadowRunStatus;
29
+ readonly outcome: ShadowRunOutcome;
30
+ readonly fixes: number;
31
+ readonly nodes: readonly ShadowNodeSummary[];
32
+ };
33
+ /** Dimensión en la que legacy y shadow divergen. */
34
+ export type ShadowDivergenceCode = "status" | "order" | "roles" | "models" | "fixes" | "outcome";
35
+ /** Veredicto de paridad. */
36
+ export type ShadowParityVerdict = "match" | "divergent" | "inconclusive";
37
+ /** Informe reference-only de paridad shadow. */
38
+ export type ShadowParityReport = {
39
+ readonly verdict: ShadowParityVerdict;
40
+ readonly divergences: readonly ShadowDivergenceCode[];
41
+ };
42
+ /**
43
+ * Compara la paridad entre el run legacy y su espejo shadow. Si falta evidencia
44
+ * en cualquier lado, el veredicto es `inconclusive`. En caso contrario reporta
45
+ * las dimensiones divergentes de forma determinista.
46
+ */
47
+ export declare function compareShadowRun(legacy: ShadowRunSummary | undefined, shadow: ShadowRunSummary | undefined): ShadowParityReport;
48
+ /** Acumulador idempotente de veredictos de paridad por run. */
49
+ export type ShadowParityTally = {
50
+ readonly seen: ReadonlySet<string>;
51
+ readonly match: number;
52
+ readonly divergent: number;
53
+ readonly inconclusive: number;
54
+ };
55
+ /** Tally vacío. */
56
+ export declare function emptyShadowTally(): ShadowParityTally;
57
+ /**
58
+ * Proyecta un veredicto en el tally. **Idempotente por run**: si el `runID` ya
59
+ * se contabilizó, devuelve el tally intacto (no doble conteo).
60
+ */
61
+ export declare function tallyShadowParity(tally: ShadowParityTally, runID: string, report: ShadowParityReport): ShadowParityTally;
62
+ //# sourceMappingURL=shadowComparator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadowComparator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/shadowComparator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC;AAExD,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEnE,gDAAgD;AAChD,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU,GAAG,cAAc,CAAC;AAExE,4EAA4E;AAC5E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,iEAAiE;AACjE,MAAM,MAAM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
1
+ import type { GraphEventV1 } from "../../graph/schema";
2
+ /**
3
+ * Códec estricto del journal de Graph: framing versionado con cadena de digest.
4
+ *
5
+ * Cada evento se serializa como un **frame** NDJSON con `{ v, seq, prev, sum,
6
+ * event }`, donde `sum = sha256(prev ∥ canonical(event))` y `prev` es el `sum`
7
+ * del frame anterior (o `GENESIS_DIGEST` en el primero). La cadena hace el log
8
+ * a prueba de manipulación: reescribir o reordenar un frame rompe el enlace.
9
+ *
10
+ * Reglas de decodificación (fail-closed salvo la cola parcial):
11
+ * - Sólo los frames **terminados en `\n`** son autoritativos.
12
+ * - Un segmento final sin `\n` es una **cola parcial reconocida** (escritura
13
+ * truncada) y se descarta sin error, señalando `partialTail`.
14
+ * - Frame ilegible/estructura inválida o basura intermedia → `bad-frame`.
15
+ * - `v` desconocido → `bad-version`; `seq` no contiguo → `bad-sequence`;
16
+ * `prev` que no enlaza → `chain-break`; `sum` que no cuadra → `bad-checksum`.
17
+ *
18
+ * Puro y determinista: sin I/O, reloj ni random; sólo SHA-256 y serialización.
19
+ */
20
+ export declare const CODEC_VERSION: 1;
21
+ /** Digest raíz de la cadena (antes del primer frame). */
22
+ export declare const GENESIS_DIGEST: string;
23
+ /** Digest de cadena de un frame dado su predecesor y su evento. */
24
+ export declare function frameDigest(prev: string, event: GraphEventV1): string;
25
+ /** Códigos de fallo de decodificación (todos cierran en falso). */
26
+ export type JournalCodecErrorCode = "bad-frame" | "bad-version" | "bad-sequence" | "chain-break" | "bad-checksum";
27
+ /** Error tipado de un frame corrupto o inconsistente. */
28
+ export declare class JournalCodecError extends Error {
29
+ readonly code: JournalCodecErrorCode;
30
+ readonly detail: string;
31
+ constructor(code: JournalCodecErrorCode, detail: string);
32
+ }
33
+ /** Un frame codificado más el digest de cadena que produce. */
34
+ export type EncodedFrame = {
35
+ line: string;
36
+ digest: string;
37
+ };
38
+ /** Codifica un frame para `event` en la posición `seq` sobre `prev`. */
39
+ export declare function encodeFrame(prev: string, seq: number, event: GraphEventV1): EncodedFrame;
40
+ /** Codifica una secuencia completa desde génesis a stream NDJSON con framing. */
41
+ export declare function encodeJournal(events: readonly GraphEventV1[]): string;
42
+ /** Resultado de decodificar un journal: prefijo válido y estado de la cola. */
43
+ export type DecodedJournal = {
44
+ events: GraphEventV1[];
45
+ /** Cabeza de la cadena tras el último frame válido (génesis si vacío). */
46
+ digest: string;
47
+ /** `true` si se descartó una cola parcial reconocida (escritura truncada). */
48
+ partialTail: boolean;
49
+ };
50
+ /** Decodifica un stream NDJSON con framing en su prefijo válido de eventos. */
51
+ export declare function decodeJournal(text: string): DecodedJournal;
52
+ //# sourceMappingURL=codec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codec.d.ts","sourceRoot":"","sources":["../../../src/storage/graph/codec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,aAAa,EAAG,CAAU,CAAC;AAExC,yDAAyD;AACzD,eAAO,MAAM,cAAc,QAAiD,CAAC;AAsB7E,mEAAmE;AACnE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,GAAG,MAAM,CAErE;AAED,mEAAmE;AACnE,MAAM,MAAM,qBAAqB,GAC7B,WAAW,GACX,aAAa,GACb,cAAc,GACd,aAAa,GACb,cAAc,CAAC;AAEnB,yDAAyD;AACzD,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM;CAMxD;AAED,+DAA+D;AAC/D,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wEAAwE;AACxE,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,YAAY,GAClB,YAAY,CAId;AAED,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CASrE;AAED,+EAA+E;AAC/E,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC;AAkDF,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAc1D"}
@@ -0,0 +1,3 @@
1
+ import { type GraphJournal } from "./provider";
2
+ export declare function createFsGraphJournal(root: string): GraphJournal;
3
+ //# sourceMappingURL=fsGraphJournal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fsGraphJournal.d.ts","sourceRoot":"","sources":["../../../src/storage/graph/fsGraphJournal.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,YAAY,CAAC;AA6BpB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CA2G/D"}