@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,29 @@
1
+ import type { PrivacyClass } from "../context/schema";
2
+ /**
3
+ * Política pura de privacidad en el despacho de efectos. Deterministas: sin
4
+ * I/O, reloj ni random. Reexporta `assertReferenceOnly` para rechazar payloads
5
+ * con contenido crudo en la frontera de despacho.
6
+ */
7
+ export { assertReferenceOnly } from "../context/redaction";
8
+ /** Modo de privacidad efectivo (coincide con `config.privacyMode`). */
9
+ export type PrivacyMode = "forceLocalOnSensitive" | "consentBeforeFrontier" | "off";
10
+ /** Destino de ruta de un efecto. */
11
+ export type RouteKind = "local" | "frontier";
12
+ /** Error tipado de una violación de privacidad en el despacho. */
13
+ export declare class PrivacyPolicyError extends Error {
14
+ readonly code: "sensitive-forced-local";
15
+ readonly detail: string;
16
+ constructor(detail: string);
17
+ }
18
+ /**
19
+ * `true` si una clase de privacidad puede planificar frontier bajo un modo. Un
20
+ * artefacto `sensitive` con `forceLocalOnSensitive` nunca puede ir a frontier.
21
+ */
22
+ export declare function frontierAllowed(privacyClass: PrivacyClass, mode: PrivacyMode): boolean;
23
+ /** Lanza si un despacho a frontier viola la política de privacidad. */
24
+ export declare function assertPrivacyDispatch(input: {
25
+ privacyClass: PrivacyClass;
26
+ mode: PrivacyMode;
27
+ routeKind: RouteKind;
28
+ }): void;
29
+ //# sourceMappingURL=privacyPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacyPolicy.d.ts","sourceRoot":"","sources":["../../src/graph/privacyPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;GAIG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,uEAAuE;AACvE,MAAM,MAAM,WAAW,GACnB,uBAAuB,GACvB,uBAAuB,GACvB,KAAK,CAAC;AAEV,oCAAoC;AACpC,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,UAAU,CAAC;AAE7C,kEAAkE;AAClE,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;CAM3B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,WAAW,GAChB,OAAO,CAET;AAED,uEAAuE;AACvE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,YAAY,EAAE,YAAY,CAAC;IAC3B,IAAI,EAAE,WAAW,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAOP"}
@@ -0,0 +1,27 @@
1
+ import type { GraphEventV1, GraphSpecV1 } from "./schema";
2
+ import { type GraphState } from "./types";
3
+ /**
4
+ * Reducer total y determinista de Graph V1.
5
+ *
6
+ * Aplica un evento a un estado y devuelve el nuevo estado, o lanza
7
+ * `ReducerError` cerrando en falso ante transiciones ilegales, conflictos de
8
+ * identidad o mutaciones post-terminales. Reaplicar un evento ya reflejado
9
+ * (misma operación/intento) es idempotente. Puro: sin I/O, reloj ni random.
10
+ */
11
+ export type ReducerErrorCode = "run-mismatch" | "post-terminal" | "run-started-conflict" | "unknown-node" | "dependency-not-satisfied" | "dispatch-conflict" | "receipt-conflict" | "illegal-transition" | "incomplete-run";
12
+ /** Error tipado de una transición inválida del reducer. */
13
+ export declare class ReducerError extends Error {
14
+ readonly code: ReducerErrorCode;
15
+ readonly detail: string;
16
+ constructor(code: ReducerErrorCode, detail: string);
17
+ }
18
+ /** Estado inicial: todos los nodos `pending`, run `running`, sin eventos. */
19
+ export declare function initialState(spec: GraphSpecV1): GraphState;
20
+ /**
21
+ * Aplica un evento al estado. Idempotente ante duplicados exactos; cierra en
22
+ * falso ante conflictos, transiciones ilegales o mutación post-terminal.
23
+ */
24
+ export declare function applyEvent(spec: GraphSpecV1, state: GraphState, event: GraphEventV1): GraphState;
25
+ /** Hash SHA-256 determinista del estado reducido (orden de nodos estable). */
26
+ export declare function stateHash(state: GraphState): string;
27
+ //# sourceMappingURL=reducer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/graph/reducer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAa,WAAW,EAAE,MAAM,UAAU,CAAC;AACrE,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,SAAS,CAAC;AAEjB;;;;;;;GAOG;AAEH,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,eAAe,GACf,sBAAsB,GACtB,cAAc,GACd,0BAA0B,GAC1B,mBAAmB,GACnB,kBAAkB,GAClB,oBAAoB,GACpB,gBAAgB,CAAC;AAErB,2DAA2D;AAC3D,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM;CAMnD;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAM1D;AAoLD;;;GAGG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,YAAY,GAClB,UAAU,CAkCZ;AAyBD,8EAA8E;AAC9E,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,20 @@
1
+ import type { GraphEventV1, GraphSpecV1 } from "./schema";
2
+ import type { GraphState } from "./types";
3
+ /**
4
+ * Replay estricto de un journal de eventos sobre un spec.
5
+ *
6
+ * Exige secuencia contigua desde 0: cualquier hueco, reordenación o duplicado
7
+ * de `seq` cierra en falso. Los mismos bytes producen el mismo estado y el
8
+ * mismo hash. Puro: sin I/O, reloj ni random.
9
+ */
10
+ /** Error tipado de un journal con secuencia inválida. */
11
+ export declare class ReplayError extends Error {
12
+ readonly code: "sequence-gap";
13
+ readonly detail: string;
14
+ constructor(detail: string);
15
+ }
16
+ /** Reduce una secuencia estricta de eventos al estado final. */
17
+ export declare function replay(spec: GraphSpecV1, events: readonly GraphEventV1[]): GraphState;
18
+ /** Hash determinista del estado resultante del replay. */
19
+ export declare function replayHash(spec: GraphSpecV1, events: readonly GraphEventV1[]): string;
20
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/graph/replay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;GAMG;AAEH,yDAAyD;AACzD,qBAAa,WAAY,SAAQ,KAAK;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM;CAM3B;AAED,gEAAgE;AAChE,wBAAgB,MAAM,CACpB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,UAAU,CASZ;AAED,0DAA0D;AAC1D,wBAAgB,UAAU,CACxB,IAAI,EAAE,WAAW,EACjB,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,MAAM,CAER"}
@@ -0,0 +1,27 @@
1
+ import type { GraphSpecV1 } from "./schema";
2
+ import type { Capability } from "./types";
3
+ /**
4
+ * Políticas puras de reviewer: independencia autor/reviewer y lockout de
5
+ * capacidades. Deterministas: sin I/O, reloj ni random.
6
+ */
7
+ /** Capacidades que un reviewer puede planificar (solo lectura). */
8
+ export declare const REVIEWER_ALLOWED_CAPABILITIES: readonly Capability[];
9
+ export type ReviewerPolicyCode = "self-review" | "reviewer-capability" | "unassigned";
10
+ /** Error tipado de una violación de política de reviewer. */
11
+ export declare class ReviewerPolicyError extends Error {
12
+ readonly code: ReviewerPolicyCode;
13
+ readonly detail: string;
14
+ constructor(code: ReviewerPolicyCode, detail: string);
15
+ }
16
+ /** `true` si el reviewer no es el autor del artefacto que revisa. */
17
+ export declare function reviewerCanReview(authorID: string, reviewerID: string): boolean;
18
+ /** Lanza si autor y reviewer coinciden (self-review). */
19
+ export declare function assertReviewerIndependence(authorID: string, reviewerID: string): void;
20
+ /** Lanza si el reviewer planifica cualquier capacidad mutante. */
21
+ export declare function assertReviewerCapabilities(planned: readonly Capability[]): void;
22
+ /**
23
+ * Valida las asignaciones autor/reviewer del spec: cada reviewer debe estar
24
+ * asignado a alguien distinto del autor del nodo que revisa.
25
+ */
26
+ export declare function assertReviewAssignments(spec: GraphSpecV1, assignments: Readonly<Record<string, string>>): void;
27
+ //# sourceMappingURL=reviewerPolicy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewerPolicy.d.ts","sourceRoot":"","sources":["../../src/graph/reviewerPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;GAGG;AAEH,mEAAmE;AACnE,eAAO,MAAM,6BAA6B,EAAE,SAAS,UAAU,EAAa,CAAC;AAE7E,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,qBAAqB,GACrB,YAAY,CAAC;AAEjB,6DAA6D;AAC7D,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM;CAMrD;AAED,qEAAqE;AACrE,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAET;AAED,yDAAyD;AACzD,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,IAAI,CAIN;AAED,kEAAkE;AAClE,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,SAAS,UAAU,EAAE,GAC7B,IAAI,CAMN;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,WAAW,EACjB,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAC5C,IAAI,CAYN"}
@@ -0,0 +1,220 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Esquemas Zod versionados de Graph V1: spec estático, nodos, roles y el sobre
4
+ * de eventos como unión discriminada exhaustiva.
5
+ *
6
+ * Superficie de validación pura: sin I/O, SDK, storage, router, telemetría,
7
+ * reloj, random ni env. `.strict()` en todos los objetos rechaza campos
8
+ * desconocidos —incluidos campos de contenido crudo— con un error tipado.
9
+ */
10
+ export declare const GRAPH_SPEC_VERSION: 1;
11
+ export declare const GRAPH_EVENT_VERSION: 1;
12
+ /** Identificador de nodo/run: charset acotado y path-safe, determinista. */
13
+ export declare const NodeIDSchema: z.ZodString;
14
+ export type NodeID = z.infer<typeof NodeIDSchema>;
15
+ /** Rol de un nodo: quién ejecuta el efecto. */
16
+ export declare const NodeRoleSchema: z.ZodEnum<{
17
+ implementer: "implementer";
18
+ reviewer: "reviewer";
19
+ }>;
20
+ export type NodeRole = z.infer<typeof NodeRoleSchema>;
21
+ /** ID de operación/intento: hex derivado de forma determinista (`ids.ts`). */
22
+ export declare const OperationIDSchema: z.ZodString;
23
+ export declare const AttemptIDSchema: z.ZodString;
24
+ /** Taxonomía acotada de clases de error de un efecto. */
25
+ export declare const ErrorClassSchema: z.ZodEnum<{
26
+ unknown: "unknown";
27
+ transient: "transient";
28
+ permanent: "permanent";
29
+ timeout: "timeout";
30
+ cancelled: "cancelled";
31
+ }>;
32
+ export type ErrorClass = z.infer<typeof ErrorClassSchema>;
33
+ /**
34
+ * Nodo del grafo. Un `reviewer` referencia con `reviews` el nodo cuyo artefacto
35
+ * revisa; un `implementer` nunca lleva `reviews`.
36
+ */
37
+ export declare const GraphNodeSchema: z.ZodObject<{
38
+ id: z.ZodString;
39
+ role: z.ZodEnum<{
40
+ implementer: "implementer";
41
+ reviewer: "reviewer";
42
+ }>;
43
+ dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
44
+ anchor: z.ZodObject<{
45
+ taskID: z.ZodString;
46
+ specDigest: z.ZodString;
47
+ }, z.core.$strict>;
48
+ reviews: z.ZodOptional<z.ZodString>;
49
+ }, z.core.$strict>;
50
+ export type GraphNode = z.infer<typeof GraphNodeSchema>;
51
+ /** Spec estático versionado de un run: un DAG con al menos un nodo. */
52
+ export declare const GraphSpecV1Schema: z.ZodObject<{
53
+ version: z.ZodLiteral<1>;
54
+ runID: z.ZodString;
55
+ nodes: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ role: z.ZodEnum<{
58
+ implementer: "implementer";
59
+ reviewer: "reviewer";
60
+ }>;
61
+ dependsOn: z.ZodDefault<z.ZodArray<z.ZodString>>;
62
+ anchor: z.ZodObject<{
63
+ taskID: z.ZodString;
64
+ specDigest: z.ZodString;
65
+ }, z.core.$strict>;
66
+ reviews: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strict>>;
68
+ }, z.core.$strict>;
69
+ export type GraphSpecV1 = z.infer<typeof GraphSpecV1Schema>;
70
+ export declare const RunStartedEventSchema: z.ZodObject<{
71
+ type: z.ZodLiteral<"run.started">;
72
+ specDigest: z.ZodString;
73
+ v: z.ZodLiteral<1>;
74
+ seq: z.ZodNumber;
75
+ runID: z.ZodString;
76
+ }, z.core.$strict>;
77
+ export declare const NodeDispatchedEventSchema: z.ZodObject<{
78
+ type: z.ZodLiteral<"node.dispatched">;
79
+ nodeID: z.ZodString;
80
+ operationID: z.ZodString;
81
+ attemptID: z.ZodString;
82
+ v: z.ZodLiteral<1>;
83
+ seq: z.ZodNumber;
84
+ runID: z.ZodString;
85
+ }, z.core.$strict>;
86
+ export declare const NodeSucceededEventSchema: z.ZodObject<{
87
+ type: z.ZodLiteral<"node.succeeded">;
88
+ nodeID: z.ZodString;
89
+ operationID: z.ZodString;
90
+ attemptID: z.ZodString;
91
+ artifact: z.ZodObject<{
92
+ uri: z.ZodString;
93
+ sha256: z.ZodString;
94
+ bytes: z.ZodNumber;
95
+ mediaType: z.ZodOptional<z.ZodString>;
96
+ }, z.core.$strict>;
97
+ v: z.ZodLiteral<1>;
98
+ seq: z.ZodNumber;
99
+ runID: z.ZodString;
100
+ }, z.core.$strict>;
101
+ export declare const NodeFailedEventSchema: z.ZodObject<{
102
+ type: z.ZodLiteral<"node.failed">;
103
+ nodeID: z.ZodString;
104
+ operationID: z.ZodString;
105
+ attemptID: z.ZodString;
106
+ errorClass: z.ZodEnum<{
107
+ unknown: "unknown";
108
+ transient: "transient";
109
+ permanent: "permanent";
110
+ timeout: "timeout";
111
+ cancelled: "cancelled";
112
+ }>;
113
+ v: z.ZodLiteral<1>;
114
+ seq: z.ZodNumber;
115
+ runID: z.ZodString;
116
+ }, z.core.$strict>;
117
+ export declare const NodeCancelledEventSchema: z.ZodObject<{
118
+ type: z.ZodLiteral<"node.cancelled">;
119
+ nodeID: z.ZodString;
120
+ v: z.ZodLiteral<1>;
121
+ seq: z.ZodNumber;
122
+ runID: z.ZodString;
123
+ }, z.core.$strict>;
124
+ export declare const RunCompletedEventSchema: z.ZodObject<{
125
+ type: z.ZodLiteral<"run.completed">;
126
+ v: z.ZodLiteral<1>;
127
+ seq: z.ZodNumber;
128
+ runID: z.ZodString;
129
+ }, z.core.$strict>;
130
+ export declare const RunFailedEventSchema: z.ZodObject<{
131
+ type: z.ZodLiteral<"run.failed">;
132
+ v: z.ZodLiteral<1>;
133
+ seq: z.ZodNumber;
134
+ runID: z.ZodString;
135
+ }, z.core.$strict>;
136
+ export declare const RunCancelledEventSchema: z.ZodObject<{
137
+ type: z.ZodLiteral<"run.cancelled">;
138
+ v: z.ZodLiteral<1>;
139
+ seq: z.ZodNumber;
140
+ runID: z.ZodString;
141
+ }, z.core.$strict>;
142
+ /** Unión discriminada exhaustiva de los eventos de Graph V1. */
143
+ export declare const GraphEventV1Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{
144
+ type: z.ZodLiteral<"run.started">;
145
+ specDigest: z.ZodString;
146
+ v: z.ZodLiteral<1>;
147
+ seq: z.ZodNumber;
148
+ runID: z.ZodString;
149
+ }, z.core.$strict>, z.ZodObject<{
150
+ type: z.ZodLiteral<"node.dispatched">;
151
+ nodeID: z.ZodString;
152
+ operationID: z.ZodString;
153
+ attemptID: z.ZodString;
154
+ v: z.ZodLiteral<1>;
155
+ seq: z.ZodNumber;
156
+ runID: z.ZodString;
157
+ }, z.core.$strict>, z.ZodObject<{
158
+ type: z.ZodLiteral<"node.succeeded">;
159
+ nodeID: z.ZodString;
160
+ operationID: z.ZodString;
161
+ attemptID: z.ZodString;
162
+ artifact: z.ZodObject<{
163
+ uri: z.ZodString;
164
+ sha256: z.ZodString;
165
+ bytes: z.ZodNumber;
166
+ mediaType: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strict>;
168
+ v: z.ZodLiteral<1>;
169
+ seq: z.ZodNumber;
170
+ runID: z.ZodString;
171
+ }, z.core.$strict>, z.ZodObject<{
172
+ type: z.ZodLiteral<"node.failed">;
173
+ nodeID: z.ZodString;
174
+ operationID: z.ZodString;
175
+ attemptID: z.ZodString;
176
+ errorClass: z.ZodEnum<{
177
+ unknown: "unknown";
178
+ transient: "transient";
179
+ permanent: "permanent";
180
+ timeout: "timeout";
181
+ cancelled: "cancelled";
182
+ }>;
183
+ v: z.ZodLiteral<1>;
184
+ seq: z.ZodNumber;
185
+ runID: z.ZodString;
186
+ }, z.core.$strict>, z.ZodObject<{
187
+ type: z.ZodLiteral<"node.cancelled">;
188
+ nodeID: z.ZodString;
189
+ v: z.ZodLiteral<1>;
190
+ seq: z.ZodNumber;
191
+ runID: z.ZodString;
192
+ }, z.core.$strict>, z.ZodObject<{
193
+ type: z.ZodLiteral<"run.completed">;
194
+ v: z.ZodLiteral<1>;
195
+ seq: z.ZodNumber;
196
+ runID: z.ZodString;
197
+ }, z.core.$strict>, z.ZodObject<{
198
+ type: z.ZodLiteral<"run.failed">;
199
+ v: z.ZodLiteral<1>;
200
+ seq: z.ZodNumber;
201
+ runID: z.ZodString;
202
+ }, z.core.$strict>, z.ZodObject<{
203
+ type: z.ZodLiteral<"run.cancelled">;
204
+ v: z.ZodLiteral<1>;
205
+ seq: z.ZodNumber;
206
+ runID: z.ZodString;
207
+ }, z.core.$strict>], "type">;
208
+ export type GraphEventV1 = z.infer<typeof GraphEventV1Schema>;
209
+ export type GraphEventType = GraphEventV1["type"];
210
+ /** Error tipado de validación de esquema Graph. */
211
+ export declare class GraphSchemaError extends Error {
212
+ readonly code: "invalid-spec" | "invalid-event";
213
+ readonly issues: string[];
214
+ constructor(code: "invalid-spec" | "invalid-event", error: z.ZodError);
215
+ }
216
+ /** Parsea un spec, lanzando `GraphSchemaError` con `code="invalid-spec"`. */
217
+ export declare function parseGraphSpec(input: unknown): GraphSpecV1;
218
+ /** Parsea un evento, lanzando `GraphSchemaError` con `code="invalid-event"`. */
219
+ export declare function parseGraphEvent(input: unknown): GraphEventV1;
220
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/graph/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;GAOG;AAEH,eAAO,MAAM,kBAAkB,EAAG,CAAU,CAAC;AAC7C,eAAO,MAAM,mBAAmB,EAAG,CAAU,CAAC;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,YAAY,aAIkC,CAAC;AAC5D,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAElD,+CAA+C;AAC/C,eAAO,MAAM,cAAc;;;EAAsC,CAAC;AAClE,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,8EAA8E;AAC9E,eAAO,MAAM,iBAAiB,aAEsB,CAAC;AACrD,eAAO,MAAM,eAAe,aAEsB,CAAC;AAEnD,yDAAyD;AACzD,eAAO,MAAM,gBAAgB;;;;;;EAM3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE1D;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;kBAQjB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,uEAAuE;AACvE,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;kBAMnB,CAAC;AACZ,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,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reducido y
4
+ * capacidades. No se parsean de entrada externa (los construye el reducer), por
5
+ * eso viven fuera de los esquemas Zod. Puro: sin I/O ni estado global.
6
+ */
7
+ /** Estado persistente de un nodo. `pending` es el estado inicial. */
8
+ export type NodeStatus = "pending" | "running" | "succeeded" | "failed" | "cancelled";
9
+ /** Estado del run completo. */
10
+ export type RunStatus = "running" | "completed" | "failed" | "cancelled";
11
+ /** Estados terminales (no admiten más transiciones). */
12
+ export declare const TERMINAL_NODE_STATUSES: ReadonlySet<NodeStatus>;
13
+ export declare const TERMINAL_RUN_STATUSES: ReadonlySet<RunStatus>;
14
+ /** Estado runtime de un nodo dentro del estado reducido. */
15
+ export type NodeRuntimeState = {
16
+ status: NodeStatus;
17
+ attempts: number;
18
+ operationID?: string;
19
+ attemptID?: string;
20
+ artifactSha256?: string;
21
+ };
22
+ /** Estado reducido y determinista de un run. */
23
+ export type GraphState = {
24
+ runID: string;
25
+ status: RunStatus;
26
+ /** Seq del último evento aplicado; -1 antes de `run.started`. */
27
+ seq: number;
28
+ specDigest?: string;
29
+ nodes: Record<string, NodeRuntimeState>;
30
+ };
31
+ /** Capacidad que un efecto puede planificar. */
32
+ export type Capability = "read" | "edit" | "shell" | "network" | "destructive";
33
+ /** Nodo listo para despacho, con sus IDs deterministas ya calculados. */
34
+ export type ReadyNode = {
35
+ nodeID: NodeID;
36
+ operationID: string;
37
+ attemptID: string;
38
+ };
39
+ export type { ErrorClass, GraphEventType, GraphEventV1, GraphNode, GraphSpecV1, NodeID, NodeRole, };
40
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graph/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,SAAS,EACT,WAAW,EACX,MAAM,EACN,QAAQ,EACT,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AAEH,qEAAqE;AACrE,MAAM,MAAM,UAAU,GA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conforme al esquema.
4
+ * Detecta de forma **determinista** duplicados, dependencias colgantes, ciclos,
5
+ * violaciones de rol/review y grafos desconectados. Sin I/O ni estado global.
6
+ */
7
+ export type GraphValidationCode = "duplicate-node" | "missing-dependency" | "cycle" | "implementer-has-review" | "reviewer-missing-review" | "self-review" | "invalid-review-target" | "disconnected";
8
+ /** Error tipado de validación estructural. */
9
+ export declare class GraphValidationError extends Error {
10
+ readonly code: GraphValidationCode;
11
+ readonly detail: string;
12
+ constructor(code: GraphValidationCode, detail: string);
13
+ }
14
+ /**
15
+ * Valida la estructura del DAG. Lanza `GraphValidationError` en el primer fallo,
16
+ * en orden determinista. No devuelve nada si el spec es válido.
17
+ */
18
+ export declare function validateGraphSpec(spec: GraphSpecV1): void;
19
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/graph/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvD;;;;GAIG;AAEH,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,oBAAoB,GACpB,OAAO,GACP,wBAAwB,GACxB,yBAAyB,GACzB,aAAa,GACb,uBAAuB,GACvB,cAAc,CAAC;AAEnB,8CAA8C;AAC9C,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM;CAMtD;AAqHD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAMzD"}
package/dist/index.js CHANGED
@@ -336,6 +336,11 @@ var PrivacyModeSchema = z.enum([
336
336
  "off"
337
337
  ]);
338
338
  var BaselineModeSchema = z.enum(["auto", "pinned"]);
339
+ var GraphModeSchema = z.enum(["off", "shadow", "active"]);
340
+ var GraphConfigSchema = z.object({
341
+ mode: GraphModeSchema.default("off"),
342
+ killSwitch: z.boolean().default(false)
343
+ });
339
344
  var ConsoleHostSchema = z.enum(["127.0.0.1", "localhost"]);
340
345
  var ConsoleConfigSchema = z.object({
341
346
  host: ConsoleHostSchema.default("127.0.0.1"),
@@ -477,7 +482,8 @@ var OpenTeamConfigObjectSchema = z.object({
477
482
  privacyMode: PrivacyModeSchema.default("forceLocalOnSensitive"),
478
483
  console: ConsoleConfigSchema,
479
484
  storage: StorageConfigSchema,
480
- memory: MemoryConfigSchema.optional()
485
+ memory: MemoryConfigSchema.optional(),
486
+ graph: GraphConfigSchema.optional()
481
487
  });
482
488
  var OpenTeamConfigSchema = OpenTeamConfigObjectSchema;
483
489
  function resolveMemorySemantic(config) {
@@ -498,9 +504,40 @@ async function writeOpenTeamConfigFile(config, path = DEFAULT_CONFIG_PATH, stora
498
504
  // src/commands/setup.ts
499
505
  var OPENCODE_CONFIG_PATH = "opencode.json";
500
506
 
507
+ // src/config/migrations.ts
508
+ var CURRENT_CONFIG_VERSION = 1;
509
+
510
+ class ConfigMigrationError extends Error {
511
+ code;
512
+ detail;
513
+ constructor(code, detail) {
514
+ super(`${code}: ${detail}`);
515
+ this.name = "ConfigMigrationError";
516
+ this.code = code;
517
+ this.detail = detail;
518
+ }
519
+ }
520
+ function migrateConfig(raw) {
521
+ if (typeof raw !== "object" || raw === null) {
522
+ return raw;
523
+ }
524
+ const record = raw;
525
+ const version = record.configVersion;
526
+ if (version === undefined) {
527
+ return { ...record, configVersion: CURRENT_CONFIG_VERSION };
528
+ }
529
+ if (typeof version !== "number" || !Number.isInteger(version) || version < 1) {
530
+ throw new ConfigMigrationError("unknown-version", String(version));
531
+ }
532
+ if (version > CURRENT_CONFIG_VERSION) {
533
+ throw new ConfigMigrationError("unsupported-version", String(version));
534
+ }
535
+ return record;
536
+ }
537
+
501
538
  // src/config/load.ts
502
539
  function loadOpenTeamConfig(raw) {
503
- return OpenTeamConfigSchema.parse(raw ?? {});
540
+ return OpenTeamConfigSchema.parse(migrateConfig(raw ?? {}));
504
541
  }
505
542
 
506
543
  // src/local/openai-compatible.ts
@@ -0,0 +1,84 @@
1
+ import type { GraphState, NodeStatus, RunStatus } from "../graph/types";
2
+ /**
3
+ * Políticas puras de cancelación, timeout y compleción tardía (GE-034).
4
+ *
5
+ * Deciden, sin I/O ni reloj, qué hacer ante tres situaciones del runtime de
6
+ * Graph. El runtime les inyecta la evidencia ya observada (estado del nodo, si
7
+ * ya se pidió el abort, si expiró la ventana de gracia) y aplica el resultado:
8
+ *
9
+ * - `timeoutAction`: en un timeout se pide **primero** el abort y solo se
10
+ * reconcilia tras agotar una ventana de gracia acotada; un nodo no `running`
11
+ * no tiene nada que expirar.
12
+ * - `planCancellation`: cancelar un run en curso cancela sus nodos `pending` y
13
+ * `running` (así los `pending` no llegan a despacharse) y pide abort de los
14
+ * `running`; cancelar un run ya terminal es un no-op idempotente.
15
+ * - `classifyLateCompletion`: un resultado que llega tarde se **audita** pero no
16
+ * puede revivir un intento cancelado, superado (otro `attemptID`/`operationID`)
17
+ * ni de un run ya terminal.
18
+ *
19
+ * Todo es determinista: la misma evidencia produce la misma decisión, de modo
20
+ * que se reproduce igual tras un reinicio.
21
+ */
22
+ /** Acción de timeout sobre el nodo en vuelo. */
23
+ export type TimeoutAction = "noop" | "request-abort" | "awaiting-grace" | "reconcile";
24
+ /** Evidencia inyectada para decidir el timeout de un nodo. */
25
+ export type TimeoutInput = {
26
+ readonly nodeStatus: NodeStatus;
27
+ /** `true` si el runtime ya solicitó el abort de este intento. */
28
+ readonly abortRequested: boolean;
29
+ /** `true` si la ventana de gracia acotada ya expiró. */
30
+ readonly graceExceeded: boolean;
31
+ };
32
+ /**
33
+ * Decide la acción de timeout. Solo un nodo `running` puede expirar: si aún no
34
+ * se pidió el abort, se pide; si ya se pidió, se espera hasta agotar la gracia y
35
+ * entonces se reconcilia. Un nodo no `running` es un no-op.
36
+ */
37
+ export declare function timeoutAction(input: TimeoutInput): TimeoutAction;
38
+ /** Plan determinista de cancelación de un run. */
39
+ export type CancellationPlan = {
40
+ /** `true` si el run sigue en curso y debe marcarse `cancelled`. */
41
+ readonly cancelRun: boolean;
42
+ /** Nodos a marcar `cancelled` (los `pending` y `running`), en orden estable. */
43
+ readonly cancelNodeIDs: readonly string[];
44
+ /** Nodos `running` cuyo efecto debe abortarse, en orden estable. */
45
+ readonly abortNodeIDs: readonly string[];
46
+ };
47
+ /**
48
+ * Planifica la cancelación del run. Cancela los nodos `pending` (para que no
49
+ * lleguen a despacharse) y `running`, y pide abort de los `running`. Un run ya
50
+ * terminal no vuelve a cancelarse y no deja nodos por cancelar (idempotente).
51
+ */
52
+ export declare function planCancellation(state: GraphState): CancellationPlan;
53
+ /** Motivo por el que una compleción tardía se descarta. */
54
+ export type LateCompletionReason = "run-terminal" | "unknown-node" | "not-running" | "superseded";
55
+ /** Veredicto sobre un recibo que llega tarde. */
56
+ export type LateCompletionVerdict = {
57
+ readonly kind: "apply";
58
+ } | {
59
+ readonly kind: "stale";
60
+ readonly reason: LateCompletionReason;
61
+ };
62
+ /** Estado mínimo del nodo destino del recibo tardío. */
63
+ export type LateCompletionNode = {
64
+ readonly status: NodeStatus;
65
+ readonly operationID?: string;
66
+ readonly attemptID?: string;
67
+ };
68
+ /** Entrada para clasificar una compleción tardía. */
69
+ export type LateCompletionInput = {
70
+ readonly runStatus: RunStatus;
71
+ readonly node: LateCompletionNode | undefined;
72
+ readonly receipt: {
73
+ readonly operationID: string;
74
+ readonly attemptID: string;
75
+ };
76
+ };
77
+ /**
78
+ * Clasifica un recibo tardío. Solo se aplica al intento `running` vigente con
79
+ * `operationID`/`attemptID` coincidentes; en cualquier otro caso (run terminal,
80
+ * nodo desconocido, nodo no `running`, intento superado) se marca `stale` para
81
+ * auditarlo sin mutar el estado.
82
+ */
83
+ export declare function classifyLateCompletion(input: LateCompletionInput): LateCompletionVerdict;
84
+ //# sourceMappingURL=graphCancellation.d.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AoB,CAAA;CAAE,CAAC;AAEtE,wDAAwD;AACxD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC;CACH,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,mBAAmB,GACzB,qBAAqB,CAkBvB"}
@@ -0,0 +1,63 @@
1
+ import type { ContextRef, PrivacyClass } from "../context/schema";
2
+ import { type PrivacyMode, type RouteKind } from "../graph/privacyPolicy";
3
+ import type { ErrorClass, GraphNode } from "../graph/schema";
4
+ /**
5
+ * `GraphEffectExecutor` — puerto del único efecto que el runtime de Graph
6
+ * (GE-031) ejecuta por nodo. El runtime commitea la intención (`node.dispatched`)
7
+ * en el journal **antes** de invocar `execute`, y el recibo (`node.succeeded` o
8
+ * `node.failed`) **después**; el executor solo produce el resultado del efecto.
9
+ *
10
+ * Este módulo es solo tipos: sin I/O, SDK, storage ni estado global. El runtime
11
+ * recibe un executor inyectado; en producción lo implementará el adaptador de
12
+ * sesión de opencode (GE-030), y en tests un doble determinista. Mantener el
13
+ * seam como puerto permite probar el runtime sin red ni SDK reales.
14
+ */
15
+ /** Solicitud de ejecución de un efecto para un nodo e intento concretos. */
16
+ export type EffectRequest = {
17
+ readonly runID: string;
18
+ readonly node: GraphNode;
19
+ readonly operationID: string;
20
+ readonly attemptID: string;
21
+ };
22
+ /** Recibo de un efecto: éxito con artefacto referenciado, o fallo clasificado. */
23
+ export type EffectReceipt = {
24
+ readonly outcome: "succeeded";
25
+ readonly artifact: ContextRef;
26
+ } | {
27
+ readonly outcome: "failed";
28
+ readonly errorClass: ErrorClass;
29
+ };
30
+ /** Ejecutor inyectable del efecto de un nodo. Determinista dado el request. */
31
+ export interface GraphEffectExecutor {
32
+ execute(request: EffectRequest): Promise<EffectReceipt>;
33
+ }
34
+ /**
35
+ * Contexto de privacidad de un despacho: clase de privacidad del nodo, modo
36
+ * efectivo de la config y ruta preferida por el router. Deja al seam de efectos
37
+ * la decisión reference-only/frontier antes y después de invocar al executor.
38
+ */
39
+ export type EffectDispatchContext = {
40
+ readonly privacyClass: PrivacyClass;
41
+ readonly mode: PrivacyMode;
42
+ readonly routeKind: RouteKind;
43
+ };
44
+ /**
45
+ * Resuelve la ruta **efectiva** de un despacho (GE-037). Si la política prohíbe
46
+ * frontier para la clase de privacidad bajo el modo activo, degrada a `local`
47
+ * en vez de lanzar: un nodo `sensitive` con `forceLocalOnSensitive` produce
48
+ * **cero** despachos a frontier. Puro y determinista.
49
+ */
50
+ export declare function resolveDispatchRoute(privacyClass: PrivacyClass, mode: PrivacyMode, preferred: RouteKind): RouteKind;
51
+ /**
52
+ * Gate de privacidad **antes** de invocar al executor: lanza
53
+ * `PrivacyPolicyError` si un nodo `sensitive` bajo `forceLocalOnSensitive`
54
+ * intenta una ruta frontier.
55
+ */
56
+ export declare function assertDispatchAllowed(ctx: EffectDispatchContext): void;
57
+ /**
58
+ * Gate reference-only **después** del executor: el recibo solo puede llevar una
59
+ * `ContextRef` (éxito) o una clase de error (fallo); lanza `RedactionError` si
60
+ * alguna estructura transporta un campo de contenido crudo.
61
+ */
62
+ export declare function assertReceiptReferenceOnly(receipt: EffectReceipt): void;
63
+ //# sourceMappingURL=graphEffects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphEffects.d.ts","sourceRo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