@jmanuelcorral/openteam 0.2.1 → 0.2.2

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.
@@ -20,6 +20,8 @@ export type RoleTaskInput = {
20
20
  directory?: string;
21
21
  /** Correlación opcional con una tarea del loop SDD/backlog (Fase D). */
22
22
  taskID?: string;
23
+ /** Role IDs this task depends on. Dependents only run after dependencies succeed. */
24
+ dependsOn?: readonly string[];
23
25
  };
24
26
  export type CoordinatorDeps = {
25
27
  client: OpencodeSessionClient;
@@ -42,10 +44,31 @@ export type RoleTaskResult = {
42
44
  subsession: SubsessionResult;
43
45
  record: CorrelatedCostRecord;
44
46
  };
47
+ /**
48
+ * Classifies a raw failure reason into a bounded, non-free-form code for
49
+ * persisted telemetry. The raw `failureReason` from `errorReason()` in
50
+ * `subsessions.ts` can contain SDK error messages that echo request content
51
+ * (provider content-filter rejections, validation errors quoting the payload).
52
+ * Persisting those verbatim violates the project's telemetry policy: "auditable
53
+ * JSONL with a hashed prompt by default; do not store sensitive prompts."
54
+ *
55
+ * The classified code preserves the debugging signal that actually gets
56
+ * aggregated (timeout vs. rejection vs. missing session) while carrying no
57
+ * payload. The raw string remains available in-memory via
58
+ * `CorrelatedCostRecord.failureReason` for the tool response.
59
+ *
60
+ * Pure: no I/O, clock, random, or env.
61
+ */
62
+ export type TelemetryFailureClass = "create-rejected" | "create-no-id" | "prompt-rejected" | "prompt-timeout" | "unknown";
63
+ export declare function classifyFailureForTelemetry(failureReason: string, failureStage: string | undefined): TelemetryFailureClass;
45
64
  /**
46
65
  * Mapea un `CorrelatedCostRecord` a un `route` event preservando la correlación
47
- * (decisionID/agent/success/batchID/failureReason/failureStage) que el sink de
66
+ * (decisionID/agent/success/batchID/failureStage) que el sink de
48
67
  * `CostRecord` legacy descartaba. Puro.
68
+ *
69
+ * `failureReason` is classified into a bounded code via
70
+ * `classifyFailureForTelemetry` rather than copied raw — the raw string may
71
+ * contain SDK error messages that echo request content.
49
72
  */
50
73
  export declare function correlatedCostRecordToRouteEvent(record: CorrelatedCostRecord): RouteEvent;
51
74
  /**
@@ -54,5 +77,17 @@ export declare function correlatedCostRecordToRouteEvent(record: CorrelatedCostR
54
77
  */
55
78
  export declare function buildMeetingEvent(inputs: readonly RoleTaskInput[], batchID: string, decisionIDs: readonly string[], ts: number): MeetingEvent | undefined;
56
79
  export declare function runRoleTask(input: RoleTaskInput, deps: CoordinatorDeps): Promise<RoleTaskResult>;
57
- export declare function runRoleTasks(inputs: readonly RoleTaskInput[], deps: CoordinatorDeps): Promise<RoleTaskResult[]>;
80
+ export type RoleBatchResult = {
81
+ readonly batchID: string;
82
+ readonly results: RoleTaskResult[];
83
+ /** Role IDs that were not executed because a dependency failed or was cancelled. */
84
+ readonly cancelled: readonly string[];
85
+ };
86
+ /**
87
+ * Computes topological waves from inputs: each wave contains roles whose
88
+ * dependencies all appear in earlier waves. Roles with no `dependsOn` are in
89
+ * wave 0. Pure and deterministic: same inputs produce the same waves.
90
+ */
91
+ export declare function topologicalWaves(inputs: readonly RoleTaskInput[]): RoleTaskInput[][];
92
+ export declare function runRoleTasks(inputs: readonly RoleTaskInput[], deps: CoordinatorDeps): Promise<RoleBatchResult>;
58
93
  //# sourceMappingURL=coordinator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,KAAK,EAEV,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAEf,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAA0B,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAEL,KAAK,YAAY,EA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H,MAAM,MAAM,qBAAqB,GAC7B,iBAAiB,GACjB,cAAc,GACd,iBAAiB,GACjB,gBAAgB,GAChB,SAAS,CAAC;AAEd,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,qBAAqB,CAmBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,oBAAoB,GAC3B,UAAU,CA4BZ;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,EAAE,EAAE,MAAM,GACT,YAAY,GAAG,SAAS,CAkB1B;AA4DD,wBAAsB,WAAW,CAC/B,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,cAAc,CAAC,CAIzB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,CAAC;IACnC,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,aAAa,EAAE,EAAE,CA2BnB;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,aAAa,EAAE,EAChC,IAAI,EAAE,eAAe,GACpB,OAAO,CAAC,eAAe,CAAC,CA2D1B"}
@@ -0,0 +1,197 @@
1
+ import { type ToolDefinition } from "@opencode-ai/plugin";
2
+ import { z } from "zod";
3
+ import type { GraphMode, OpenTeamConfig } from "../config/schema";
4
+ import type { GraphEventV1, GraphSpecV1 } from "../graph/schema";
5
+ import { type RoleTaskResult } from "../orchestrator/coordinator";
6
+ import type { OpencodeSessionClient } from "../orchestrator/subsessions";
7
+ import type { GraphJournal } from "../storage/graph/provider";
8
+ import type { EventSink } from "../telemetry/eventLog";
9
+ import type { ShadowObserver } from "./shadowPipeline";
10
+ /**
11
+ * Schema for the `openteam-orchestrate` tool boundary.
12
+ *
13
+ * `.strict()` rejects unknown keys, consistent with `ReportRunPayloadSchema`.
14
+ */
15
+ export declare const OrchestratePayloadSchema: z.ZodObject<{
16
+ assignments: z.ZodArray<z.ZodObject<{
17
+ roleID: z.ZodString;
18
+ prompt: z.ZodString;
19
+ title: z.ZodOptional<z.ZodString>;
20
+ dependsOn: z.ZodOptional<z.ZodArray<z.ZodString>>;
21
+ }, z.core.$strict>>;
22
+ parentSessionID: z.ZodOptional<z.ZodString>;
23
+ directory: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$strict>;
25
+ export type OrchestratePayload = z.infer<typeof OrchestratePayloadSchema>;
26
+ export type DependencyValidationError = {
27
+ code: "dangling-reference";
28
+ detail: string;
29
+ } | {
30
+ code: "cycle";
31
+ detail: string;
32
+ } | {
33
+ code: "duplicate-role";
34
+ detail: string;
35
+ };
36
+ /**
37
+ * Validates the dependency graph encoded in assignments. Returns an error
38
+ * if any `dependsOn` reference is dangling (refers to a non-existent roleID),
39
+ * if the graph contains a cycle, or if roleIDs are duplicated.
40
+ *
41
+ * Pure: no I/O, clock, random, or env vars.
42
+ */
43
+ export declare function validateAssignmentDependencies(assignments: readonly OrchestratePayload["assignments"][number][]): DependencyValidationError | undefined;
44
+ /** Per-role summary returned by the tool (reference-only — no prompt text). */
45
+ export type RoleResultSummary = {
46
+ roleID: string;
47
+ model: {
48
+ providerID: string;
49
+ modelID: string;
50
+ };
51
+ success: boolean;
52
+ sessionID?: string;
53
+ failureStage?: "create" | "prompt";
54
+ failureReason?: string;
55
+ };
56
+ export type OrchestrateResult = {
57
+ kind: "completed";
58
+ roles: readonly RoleResultSummary[];
59
+ cancelled?: readonly string[];
60
+ } | {
61
+ kind: "error";
62
+ reason: string;
63
+ };
64
+ /**
65
+ * Minimal port of the opencode SDK client surface used by this adapter.
66
+ *
67
+ * Structurally compatible with `ReturnType<typeof createOpencodeClient>` — the
68
+ * SDK client can be passed directly. Only the `session.create` and
69
+ * `session.prompt` methods are consumed; everything else is intentionally
70
+ * excluded so the adapter cannot reach surfaces the coordinator must not use.
71
+ */
72
+ export type SdkClientPort = {
73
+ session: {
74
+ create(args: {
75
+ body?: {
76
+ parentID?: string;
77
+ title?: string;
78
+ };
79
+ query?: {
80
+ directory?: string;
81
+ };
82
+ }): Promise<{
83
+ data: {
84
+ id: string;
85
+ } | undefined;
86
+ error: unknown;
87
+ }>;
88
+ prompt(args: {
89
+ path: {
90
+ id: string;
91
+ };
92
+ body: {
93
+ model?: {
94
+ providerID: string;
95
+ modelID: string;
96
+ };
97
+ agent?: string;
98
+ system?: string;
99
+ parts: Array<{
100
+ type: "text";
101
+ text: string;
102
+ }>;
103
+ };
104
+ }): Promise<{
105
+ data: unknown;
106
+ error: unknown;
107
+ }>;
108
+ };
109
+ };
110
+ /**
111
+ * Adapts the opencode SDK client to `OpencodeSessionClient`.
112
+ *
113
+ * The brief asked to use `opencodeSessionAdapter.ts`, but that adapter
114
+ * produces `OpencodeSessionAdapter` (6-method lifecycle interface for the
115
+ * graph runtime), not `OpencodeSessionClient` (2-method create/prompt
116
+ * interface consumed by `runSubsession`/`runRoleTasks`). Using the wrong
117
+ * type would compile but add an unused abstraction layer. This adapter
118
+ * bridges the SDK client directly to the type the coordinator consumes.
119
+ */
120
+ export declare function adaptSdkClient(sdk: SdkClientPort): OpencodeSessionClient;
121
+ /**
122
+ * Projects `RoleTaskResult[]` into a reference-only `OrchestrateResult`.
123
+ *
124
+ * `assertReferenceOnly` is the privacy guard: it rejects any structure
125
+ * carrying a key from `FORBIDDEN_RAW_KEYS` (e.g. "content", "text",
126
+ * "prompt", "message"). The current `RoleResultSummary` shape has no
127
+ * forbidden keys by design, but the guard is defense-in-depth against
128
+ * runtime contamination (e.g. `decision.selected` carrying extra
129
+ * properties from the SDK response). Exported for direct testing.
130
+ */
131
+ export declare function projectResults(results: readonly RoleTaskResult[], cancelled?: readonly string[]): OrchestrateResult;
132
+ export type OrchestrateDeps = {
133
+ readonly client: OpencodeSessionClient;
134
+ readonly sink: EventSink;
135
+ readonly config: OpenTeamConfig;
136
+ readonly now: () => number;
137
+ readonly newDecisionID: () => string;
138
+ /** Graph mode resolved from config. `off` disables shadow journaling. */
139
+ readonly graphMode: GraphMode;
140
+ /** Journal for persisting shadow graph runs. Required when graphMode !== "off". */
141
+ readonly journal?: GraphJournal | undefined;
142
+ /** Shadow pipeline observer. Required when graphMode !== "off". */
143
+ readonly observeLegacyExecution?: ShadowObserver | undefined;
144
+ };
145
+ /**
146
+ * Builds a `GraphSpecV1` from orchestrate payload assignments. Each assignment
147
+ * becomes a node; `dependsOn` on assignments maps to graph edges. All nodes
148
+ * are `implementer` role (the roster role is an orchestration concept, not a
149
+ * graph review relationship). Anchors use the batchID as taskID.
150
+ *
151
+ * Pure: no I/O, clock, random, or env vars.
152
+ */
153
+ export declare function buildGraphSpecFromAssignments(assignments: readonly OrchestratePayload["assignments"][number][], batchID: string): GraphSpecV1;
154
+ /**
155
+ * Synthesizes the journal event sequence from legacy role task results.
156
+ * Follows the same pattern as `mirrorJournal` in `graphShadow.ts`:
157
+ * run.started → (node.dispatched + node.succeeded/failed) per node → terminal.
158
+ *
159
+ * **Privacy**: events carry only nodeID, operationID, attemptID, and synthetic
160
+ * artifacts (`shadow://` scheme). No prompt text reaches the journal.
161
+ */
162
+ export declare function synthesizeJournalEvents(spec: GraphSpecV1, results: readonly RoleTaskResult[], cancelled?: readonly string[]): GraphEventV1[];
163
+ /**
164
+ * Bounded failure codes for shadow producer diagnostics. Never a raw error
165
+ * string — fs errors can carry full paths, SDK errors can echo request content.
166
+ * The same discipline applied at `coordinator.ts:328` for subsession failures.
167
+ */
168
+ export type ShadowProducerFailureClass = "invalid-node-id" | "journal-create-failed" | "journal-append-failed" | "observation-failed" | "unknown";
169
+ /**
170
+ * Classifies a shadow producer error into a bounded code. Pure.
171
+ */
172
+ export declare function classifyShadowFailure(_error: unknown, phase: "create" | "append" | "observe"): ShadowProducerFailureClass;
173
+ /** Result of shadow producer attempt — success or classified failure. */
174
+ export type ShadowProducerResult = {
175
+ readonly ok: true;
176
+ } | {
177
+ readonly ok: false;
178
+ readonly failureClass: ShadowProducerFailureClass;
179
+ };
180
+ /**
181
+ * Creates the `openteam-orchestrate` tool.
182
+ *
183
+ * This is the production entry point for code-driven roster orchestration.
184
+ * When an agent calls this tool with role assignments, openteam distributes
185
+ * the work via `runRoleTasks` — model selection, subsession lifecycle, and
186
+ * telemetry are all handled by our code, not improvised by the LLM.
187
+ *
188
+ * **Failure containment**: follows the `createShadowPipeline` idiom — no
189
+ * error escapes the tool boundary. A failure returns a structured error
190
+ * result rather than crashing the plugin or corrupting the user's session.
191
+ *
192
+ * **Privacy**: the result projection uses `assertReferenceOnly` to ensure
193
+ * no raw prompt text reaches telemetry or the tool response. Only role IDs,
194
+ * model selections, session IDs, and failure metadata are surfaced.
195
+ */
196
+ export declare function createOrchestrateTool(deps: OrchestrateDeps): ToolDefinition;
197
+ //# sourceMappingURL=orchestrateTool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orchestrateTool.d.ts","sourceRoot":"","sources":["../../src/plugin/orchestrateTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,OAAO,EAIL,KAAK,cAAc,EAEpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO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Q,CAAC,YAAY,EAAE,0BAA0B,CAAA;CAAE,CAAC;AAqH9E;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CA8E3E"}
@@ -133,6 +133,29 @@ export declare const SessionEndpointEventSchema: z.ZodObject<{
133
133
  worktree: z.ZodOptional<z.ZodString>;
134
134
  title: z.ZodOptional<z.ZodString>;
135
135
  }, z.core.$strip>;
136
+ /**
137
+ * Diagnostic event for the shadow producer. Emitted when the shadow pipeline
138
+ * was attempted but failed — making the failure observable rather than silent.
139
+ * Without this, a broken journal root or invalid roleID would silently prevent
140
+ * soak observations from accumulating, and the only symptom would be an absence.
141
+ *
142
+ * `failureClass` is a bounded code — never a raw error string, which could
143
+ * contain filesystem paths or SDK error messages that echo request content.
144
+ */
145
+ export declare const ShadowDiagnosticEventSchema: z.ZodObject<{
146
+ v: z.ZodLiteral<1>;
147
+ ts: z.ZodNumber;
148
+ sessionID: z.ZodString;
149
+ type: z.ZodLiteral<"shadow-diagnostic">;
150
+ batchID: z.ZodString;
151
+ failureClass: z.ZodEnum<{
152
+ "invalid-node-id": "invalid-node-id";
153
+ "journal-append-failed": "journal-append-failed";
154
+ "journal-create-failed": "journal-create-failed";
155
+ "observation-failed": "observation-failed";
156
+ unknown: "unknown";
157
+ }>;
158
+ }, z.core.$strip>;
136
159
  export declare const OpenTeamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
137
160
  v: z.ZodLiteral<1>;
138
161
  ts: z.ZodNumber;
@@ -235,6 +258,19 @@ export declare const OpenTeamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
235
258
  directory: z.ZodOptional<z.ZodString>;
236
259
  worktree: z.ZodOptional<z.ZodString>;
237
260
  title: z.ZodOptional<z.ZodString>;
261
+ }, z.core.$strip>, z.ZodObject<{
262
+ v: z.ZodLiteral<1>;
263
+ ts: z.ZodNumber;
264
+ sessionID: z.ZodString;
265
+ type: z.ZodLiteral<"shadow-diagnostic">;
266
+ batchID: z.ZodString;
267
+ failureClass: z.ZodEnum<{
268
+ "invalid-node-id": "invalid-node-id";
269
+ "journal-append-failed": "journal-append-failed";
270
+ "journal-create-failed": "journal-create-failed";
271
+ "observation-failed": "observation-failed";
272
+ unknown: "unknown";
273
+ }>;
238
274
  }, z.core.$strip>], "type">;
239
275
  export type OpenTeamEvent = z.infer<typeof OpenTeamEventSchema>;
240
276
  export type RouteEvent = z.infer<typeof RouteEventSchema>;
@@ -244,5 +280,6 @@ export type MeetingEvent = z.infer<typeof MeetingEventSchema>;
244
280
  export type DecisionEvent = z.infer<typeof DecisionEventSchema>;
245
281
  export type ActivityEvent = z.infer<typeof ActivityEventSchema>;
246
282
  export type SessionEndpointEvent = z.infer<typeof SessionEndpointEventSchema>;
283
+ export type ShadowDiagnosticEvent = z.infer<typeof ShadowDiagnosticEventSchema>;
247
284
  export type OpenTeamEventType = OpenTeamEvent["type"];
248
285
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/telemetry/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,EAAG,CAAU,CAAC;AAW/C,yEAAyE;AACzE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqB3B,CAAC;AAEH,+EAA+E;AAC/E,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;iBAc7B,CAAC;AAEH,sEAAsE;AACtE,eAAO,MAAM,mBAAmB;;;;;;;;;;;iBAS9B,CAAC;AAEH,iEAAiE;AACjE,eAAO,MAAM,kBAAkB;;;;;;;;;iBAM7B,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,mBAAmB;;;;;;;;iBAK9B,CAAC;AAEH,0DAA0D;AAC1D,eAAO,MAAM,mBAAmB;;;;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OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAChF,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Package version, inlined by the bundler at build time. */
2
+ export declare const PACKAGE_VERSION: string;
3
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,6DAA6D;AAC7D,eAAO,MAAM,eAAe,EAAE,MAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmanuelcorral/openteam",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "packageManager": "bun@1.3.14",
5
5
  "description": "Cost-aware, local-first routing plugin for opencode with cheapest-capable frontier fallback and multi-agent orchestration.",
6
6
  "license": "MIT",
@@ -1,32 +0,0 @@
1
- import type { StorageProvider } from "../provider";
2
- /** Plan (dry-run) de migración: solo rutas y conteo, nunca contenido. */
3
- export type BriefMigrationPlan = {
4
- readonly workspaceDir: string;
5
- readonly briefPaths: readonly string[];
6
- readonly count: number;
7
- };
8
- /** Resultado de aplicar la migración: manifiestos escritos y conteo. */
9
- export type BriefMigrationReport = {
10
- readonly workspaceDir: string;
11
- readonly migrated: readonly string[];
12
- readonly count: number;
13
- };
14
- /** Código de fallo fail-closed de la migración. */
15
- export type MigrationErrorCode = "unreadable" | "unknown-schema";
16
- /** Error tipado de una migración abortada (deja el crudo intacto). */
17
- export declare class MigrationError extends Error {
18
- readonly code: MigrationErrorCode;
19
- readonly path: string;
20
- constructor(code: MigrationErrorCode, path: string);
21
- }
22
- /**
23
- * Planifica la migración (dry-run). Lista los briefs crudos y devuelve sus
24
- * rutas y conteo; **no** lee ni transporta el cuerpo de ningún brief.
25
- */
26
- export declare function planLegacyBriefMigration(storage: StorageProvider, workspaceDir: string): Promise<BriefMigrationPlan>;
27
- /**
28
- * Aplica la migración: por cada brief crudo escribe el manifiesto redactado y
29
- * borra el crudo (sin backup). Idempotente y fail-closed.
30
- */
31
- export declare function applyLegacyBriefMigration(storage: StorageProvider, workspaceDir: string): Promise<BriefMigrationReport>;
32
- //# sourceMappingURL=migrateLegacyBriefs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migrateLegacyBriefs.d.ts","sourceRoot":"","sources":["../../../src/storage/graph/migrateLegacyBriefs.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AA4BnD,yEAAyE;AACzE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,mDAAmD;AACnD,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAEjE,sEAAsE;AACtE,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM,EAKjD;CACF;AA6CD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,kBAAkB,CAAC,CAM7B;AAED;;;GAGG;AACH,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,oBAAoB,CAAC,CAuB/B"}