@jmanuelcorral/openteam 0.1.40 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +15 -0
- package/README.es.md +1 -1
- package/README.md +1 -1
- package/dist/cli.js +457 -37
- package/dist/commands/graph.d.ts +73 -0
- package/dist/commands/graph.d.ts.map +1 -0
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/migrations.d.ts +27 -0
- package/dist/config/migrations.d.ts.map +1 -0
- package/dist/config/resolve.d.ts +34 -0
- package/dist/config/resolve.d.ts.map +1 -0
- package/dist/config/schema.d.ts +57 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/console/assets.d.ts +9 -1
- package/dist/console/assets.d.ts.map +1 -1
- package/dist/console/opencodeClient.d.ts +6 -0
- package/dist/console/opencodeClient.d.ts.map +1 -1
- package/dist/console/protocol.d.ts +8 -0
- package/dist/console/protocol.d.ts.map +1 -1
- package/dist/console/render.d.ts +25 -0
- package/dist/console/render.d.ts.map +1 -1
- package/dist/context/redaction.d.ts +48 -0
- package/dist/context/redaction.d.ts.map +1 -0
- package/dist/context/schema.d.ts +115 -0
- package/dist/context/schema.d.ts.map +1 -0
- package/dist/context/types.d.ts +8 -0
- package/dist/context/types.d.ts.map +1 -0
- package/dist/graph/events.d.ts +25 -0
- package/dist/graph/events.d.ts.map +1 -0
- package/dist/graph/ids.d.ts +5 -0
- package/dist/graph/ids.d.ts.map +1 -0
- package/dist/graph/planner.d.ts +15 -0
- package/dist/graph/planner.d.ts.map +1 -0
- package/dist/graph/policies.d.ts +34 -0
- package/dist/graph/policies.d.ts.map +1 -0
- package/dist/graph/privacyPolicy.d.ts +29 -0
- package/dist/graph/privacyPolicy.d.ts.map +1 -0
- package/dist/graph/reducer.d.ts +27 -0
- package/dist/graph/reducer.d.ts.map +1 -0
- package/dist/graph/replay.d.ts +20 -0
- package/dist/graph/replay.d.ts.map +1 -0
- package/dist/graph/reviewerPolicy.d.ts +27 -0
- package/dist/graph/reviewerPolicy.d.ts.map +1 -0
- package/dist/graph/schema.d.ts +220 -0
- package/dist/graph/schema.d.ts.map +1 -0
- package/dist/graph/types.d.ts +40 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/validate.d.ts +19 -0
- package/dist/graph/validate.d.ts.map +1 -0
- package/dist/index.js +46 -3
- package/dist/orchestrator/graphCancellation.d.ts +84 -0
- package/dist/orchestrator/graphCancellation.d.ts.map +1 -0
- package/dist/orchestrator/graphEffects.d.ts +63 -0
- package/dist/orchestrator/graphEffects.d.ts.map +1 -0
- package/dist/orchestrator/graphReview.d.ts +84 -0
- package/dist/orchestrator/graphReview.d.ts.map +1 -0
- package/dist/orchestrator/graphRuntime.d.ts +69 -0
- package/dist/orchestrator/graphRuntime.d.ts.map +1 -0
- package/dist/orchestrator/opencodeSessionAdapter.d.ts +117 -0
- package/dist/orchestrator/opencodeSessionAdapter.d.ts.map +1 -0
- package/dist/orchestrator/sdd.d.ts +38 -2
- package/dist/orchestrator/sdd.d.ts.map +1 -1
- package/dist/orchestrator/sddCompiler.d.ts +44 -0
- package/dist/orchestrator/sddCompiler.d.ts.map +1 -0
- package/dist/orchestrator/sessionReconciler.d.ts +74 -0
- package/dist/orchestrator/sessionReconciler.d.ts.map +1 -0
- package/dist/orchestrator/shadowComparator.d.ts +62 -0
- package/dist/orchestrator/shadowComparator.d.ts.map +1 -0
- package/dist/orchestrator/worktreeAdapter.d.ts +39 -0
- package/dist/orchestrator/worktreeAdapter.d.ts.map +1 -0
- package/dist/orchestrator/worktreeDispatch.d.ts +84 -0
- package/dist/orchestrator/worktreeDispatch.d.ts.map +1 -0
- package/dist/orchestrator/worktreeReconciler.d.ts +74 -0
- package/dist/orchestrator/worktreeReconciler.d.ts.map +1 -0
- package/dist/storage/graph/codec.d.ts +52 -0
- package/dist/storage/graph/codec.d.ts.map +1 -0
- package/dist/storage/graph/fsGraphJournal.d.ts +3 -0
- package/dist/storage/graph/fsGraphJournal.d.ts.map +1 -0
- package/dist/storage/graph/importLegacy.d.ts +62 -0
- package/dist/storage/graph/importLegacy.d.ts.map +1 -0
- package/dist/storage/graph/memoryGraphJournal.d.ts +11 -0
- package/dist/storage/graph/memoryGraphJournal.d.ts.map +1 -0
- package/dist/storage/graph/migrateLegacyBriefs.d.ts +32 -0
- package/dist/storage/graph/migrateLegacyBriefs.d.ts.map +1 -0
- package/dist/storage/graph/projections.d.ts +31 -0
- package/dist/storage/graph/projections.d.ts.map +1 -0
- package/dist/storage/graph/provider.d.ts +52 -0
- package/dist/storage/graph/provider.d.ts.map +1 -0
- package/dist/storage/graph/recovery.d.ts +38 -0
- package/dist/storage/graph/recovery.d.ts.map +1 -0
- package/dist/storage/graph/runRegistry.d.ts +17 -0
- package/dist/storage/graph/runRegistry.d.ts.map +1 -0
- package/dist/storage/graph/snapshot.d.ts +44 -0
- package/dist/storage/graph/snapshot.d.ts.map +1 -0
- package/dist/storage/graph/workspaceLease.d.ts +36 -0
- package/dist/storage/graph/workspaceLease.d.ts.map +1 -0
- package/dist/storage/graph/worktreeRegistry.d.ts +29 -0
- package/dist/storage/graph/worktreeRegistry.d.ts.map +1 -0
- package/dist/storage/graph/writer.d.ts +20 -0
- package/dist/storage/graph/writer.d.ts.map +1 -0
- package/dist/telemetry/graphProjection.d.ts +36 -0
- package/dist/telemetry/graphProjection.d.ts.map +1 -0
- package/dist/telemetry/graphView.d.ts +75 -0
- package/dist/telemetry/graphView.d.ts.map +1 -0
- package/dist/web/console.d.ts +6 -0
- package/dist/web/console.d.ts.map +1 -1
- package/dist/web/graphRoute.d.ts +36 -0
- package/dist/web/graphRoute.d.ts.map +1 -0
- package/dist/web/server.d.ts +21 -2
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/start.d.ts +11 -0
- package/dist/web/start.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphCancellation.d.ts","sourceRoot":"","sources":["../../src/orchestrator/graphCancellation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExE;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,gDAAgD;AAChD,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,eAAe,GACf,gBAAgB,GAChB,WAAW,CAAC;AAEhB,8DAA8D;AAC9D,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,iEAAiE;IACjE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,wDAAwD;IACxD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAQhE;AAED,kDAAkD;AAClD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,oEAAoE;IACpE,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,gBAAgB,CAiBpE;AAED,2DAA2D;AAC3D,MAAM,MAAM,oBAAoB,GAC5B,cAAc,GACd,cAAc,GACd,aAAa,GACb,YAAY,CAAC;AAEjB,iDAAiD;AACjD,MAAM,MAAM,qBAAqB,GAC7B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,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","sourceRoot":"","sources":["../../src/orchestrator/graphEffects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE7D;;;;;;;;;;GAUG;AAEH,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,kFAAkF;AAClF,MAAM,MAAM,aAAa,GACrB;IAAE,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAEpE,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;CACzD;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,WAAW,EACjB,SAAS,EAAE,SAAS,GACnB,SAAS,CAIX;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,qBAAqB,GAAG,IAAI,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAEvE"}
|
|
@@ -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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iEAAiE;IACjE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wDAAwD;IACxD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;CACtC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,GAAG,YAAY,CAaf;AAED,gEAAgE;AAChE,MAAM,MAAM,oBAAoB,GAC5B;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,mBAAmB,EAAE,KAAK,CAAC;CACrC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAErC;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CACxC,GAAG,oBAAoB,CAevB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { 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,W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CAAC;IACxB,mFAAmF;IACnF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,gEAAgE;IAChE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,oEAAoE;IACpE,IAAI,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACpC,iFAAiF;IACjF,eAAe,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChD;AAkDD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,GAAG,YAAY,CA2JvE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
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,EAA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AK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,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 **
|
|
11
|
-
*
|
|
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;
|
|
1
|
+
{"version":3,"file":"sdd.d.ts","sourceRoot":"","sources":["../../src/orchestrator/sdd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,UAAU,EACf,KAAK,YAAY,EAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAq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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,OAAO,GAAG,MAAM,CAAC;AAExE,uDAAuD;AACvD,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,WAAW,CAAC;AAExD,mEAAmE;AACnE,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC;CACpC,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1D;IAAE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5D,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAA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