substrate-ai 0.20.64 → 0.20.65

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 (35) hide show
  1. package/dist/adapter-registry-BbVWH3Yv.js +4 -0
  2. package/dist/cli/index.js +93 -24
  3. package/dist/{decision-router-BA__VYIp.js → decision-router-DblHY8se.js} +1 -1
  4. package/dist/{decisions-4F91LrVD.js → decisions-DilHo99V.js} +2 -2
  5. package/dist/{dist-W2emvN3F.js → dist-K_RRWnBX.js} +2 -2
  6. package/dist/{errors-CKFu8YI9.js → errors-pSiZbn6e.js} +2 -2
  7. package/dist/{experimenter-BgpUcUaW.js → experimenter-DT9v2Pto.js} +1 -1
  8. package/dist/health-DC3y-sR6.js +1715 -0
  9. package/dist/health-qhtWYh49.js +8 -0
  10. package/dist/index-c924O9mj.d.ts +1432 -0
  11. package/dist/index.d.ts +56 -735
  12. package/dist/index.js +2 -2
  13. package/dist/interactive-prompt-C7wpE4z4.js +183 -0
  14. package/dist/{health-DudlnqXd.js → manifest-read-DDkXC3L_.js} +120 -2012
  15. package/dist/modules/interactive-prompt/index.d.ts +86 -0
  16. package/dist/modules/interactive-prompt/index.js +6 -0
  17. package/dist/recovery-engine-BKGBeBnW.js +281 -0
  18. package/dist/{routing-0ykvBl_4.js → routing-CzF0p6lI.js} +2 -2
  19. package/dist/run-DX95j4_D.js +14 -0
  20. package/dist/{run-CCxsv-9M.js → run-DzB4rgkj.js} +224 -31
  21. package/dist/src/modules/decision-router/index.js +1 -1
  22. package/dist/src/modules/recovery-engine/index.d.ts +1101 -0
  23. package/dist/src/modules/recovery-engine/index.js +5 -0
  24. package/dist/{upgrade-OFeC_NIx.js → upgrade-DxzQ1nss.js} +3 -3
  25. package/dist/{upgrade-aW7GYL2F.js → upgrade-MP9XzrI6.js} +2 -2
  26. package/dist/version-manager-impl-GZDUBt0Q.js +4 -0
  27. package/dist/work-graph-repository-DZyJv5pV.js +265 -0
  28. package/package.json +1 -1
  29. package/dist/adapter-registry-k7ZX3Bz6.js +0 -4
  30. package/dist/health-CLNmnZiw.js +0 -6
  31. package/dist/run-ChxsPICN.js +0 -10
  32. package/dist/version-manager-impl-BCSf5E3j.js +0 -4
  33. /package/dist/{decisions-C0pz9Clx.js → decisions-CzSIEeGP.js} +0 -0
  34. /package/dist/{routing-CcBOCuC9.js → routing-DFxoKHDt.js} +0 -0
  35. /package/dist/{version-manager-impl-FH4TTnXm.js → version-manager-impl-qFBiO4Eh.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { AdapterDiscoveryResult, AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, DiscoveryReport, GeminiCLIAdapter, Recommendation, TypedEventBus } from "./index-c924O9mj.js";
1
2
  import pino from "pino";
2
3
  import { z } from "zod";
3
4
  import { Readable, Writable } from "node:stream";
@@ -767,7 +768,7 @@ interface DecisionHaltSkippedNonInteractiveEvent {
767
768
  * ```
768
769
  */
769
770
  type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFlightFailureEvent | PipelineProfileStaleEvent | PipelineContractMismatchEvent | PipelineContractVerificationSummaryEvent | StoryPhaseEvent | StoryDoneEvent | StoryEscalationEvent | StoryWarnEvent | StoryLogEvent | PipelineHeartbeatEvent | StoryStallEvent | StoryZeroDiffEscalationEvent | StoryBuildVerificationFailedEvent | StoryBuildVerificationPassedEvent | StoryInterfaceChangeWarningEvent | StoryMetricsEvent | SupervisorPollEvent | SupervisorKillEvent | SupervisorRestartEvent | SupervisorAbortEvent | SupervisorSummaryEvent | SupervisorAnalysisCompleteEvent | SupervisorAnalysisErrorEvent | SupervisorExperimentStartEvent | SupervisorExperimentSkipEvent | SupervisorExperimentRecommendationsEvent | SupervisorExperimentCompleteEvent | SupervisorExperimentErrorEvent | RoutingModelSelectedEvent | PipelinePhaseStartEvent | PipelinePhaseCompleteEvent | StoryAutoApprovedEvent | VerificationCheckCompleteEvent | VerificationStoryCompleteEvent | CostWarningEvent | CostCeilingReachedEvent | DecisionHaltSkippedNonInteractiveEvent; //#endregion
770
- //#region packages/core/dist/types.d.ts
771
+ //#region src/core/errors.d.ts
771
772
 
772
773
  /**
773
774
  * Exhaustive list of all PipelineEvent `type` discriminant strings.
@@ -776,734 +777,6 @@ type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFli
776
777
  * tests to ensure PIPELINE_EVENT_METADATA in help-agent.ts never falls
777
778
  * out of sync with the actual event type definitions.
778
779
  */
779
- /**
780
- * Core types for Substrate
781
- * Shared type definitions used across all modules
782
- */
783
- /** Unique identifier for a task in the DAG */
784
- type TaskId$1 = string;
785
- /** Unique identifier for a worker/agent instance */
786
-
787
- /** Unique identifier for a registered agent type */
788
- type AgentId$1 = string;
789
- /** Status of an individual task */
790
-
791
- /** Billing mode for a worker/agent */
792
- type BillingMode$1 = 'subscription' | 'api' | 'free';
793
-
794
- //#endregion
795
- //#region packages/core/dist/events/types.d.ts
796
- /** Severity level for errors and log messages */
797
- /**
798
- * Base event type primitives for the TypedEventBus system.
799
- *
800
- * These types are the foundation of the event bus contract.
801
- * All event maps must satisfy EventMap; all handlers must satisfy EventHandler<T>.
802
- */
803
- /**
804
- * Base constraint for event maps.
805
- * Each key is an event name (string), and the value is the payload type.
806
- *
807
- * Using `object` (not `Record<string, unknown>`) so that TypeScript interfaces
808
- * with named properties (without index signatures) satisfy the constraint.
809
- * TypeScript interfaces extend `object` but may not extend `Record<string, unknown>`
810
- * unless they have an explicit index signature.
811
- */
812
- type EventMap = object;
813
- /**
814
- * A typed event handler function for payload type T.
815
- */
816
- type EventHandler<T> = (payload: T) => void;
817
-
818
- //#endregion
819
- //#region packages/core/dist/events/event-bus.d.ts
820
- //# sourceMappingURL=types.d.ts.map
821
- /**
822
- * A type-safe event bus parameterized over an event map E.
823
- *
824
- * @example
825
- * const bus: TypedEventBus<CoreEvents & SdlcEvents> = createEventBus()
826
- * bus.on('orchestrator:story-complete', ({ storyKey }) => { ... })
827
- */
828
- interface TypedEventBus$1<E extends EventMap> {
829
- /**
830
- * Emit an event with a typed payload.
831
- * All registered handlers for this event key are called synchronously.
832
- */
833
- emit<K extends keyof E>(event: K, payload: E[K]): void;
834
- /**
835
- * Register a handler for an event.
836
- */
837
- on<K extends keyof E>(event: K, handler: EventHandler<E[K]>): void;
838
- /**
839
- * Unregister a previously registered handler.
840
- */
841
- off<K extends keyof E>(event: K, handler: EventHandler<E[K]>): void;
842
- }
843
-
844
- //#endregion
845
- //#region packages/core/dist/dispatch/types.d.ts
846
- /**
847
- * Concrete implementation of TypedEventBus backed by Node.js EventEmitter.
848
- *
849
- * Dispatch is SYNCHRONOUS — all handlers run before emit() returns (per ADR-004).
850
- * maxListeners is set to 100 to avoid spurious warnings in large systems.
851
- *
852
- * @example
853
- * const bus = new TypedEventBusImpl<CoreEvents & SdlcEvents>()
854
- * bus.on('orchestrator:story-complete', ({ storyKey }) => { ... })
855
- * bus.emit('orchestrator:story-complete', { storyKey: '1-1', reviewCycles: 1 })
856
- */
857
-
858
- /**
859
- * Logger interface compatible with both pino-style loggers and console.
860
- * Methods accept any argument pattern: (msg: string) or (obj: unknown, msg?: string).
861
- */
862
- interface ILogger {
863
- info(...args: unknown[]): void;
864
- warn(...args: unknown[]): void;
865
- error(...args: unknown[]): void;
866
- debug(...args: unknown[]): void;
867
- }
868
-
869
- //#endregion
870
- //#region packages/core/dist/config/errors.d.ts
871
- //# sourceMappingURL=types.d.ts.map
872
- /**
873
- * Config-specific error classes for @substrate-ai/core.
874
- *
875
- * AdtError is defined here as the canonical base class. ConfigError and
876
- * ConfigIncompatibleFormatError extend it. The monolith's src/core/errors.ts
877
- * re-exports AdtError from here so that all error classes share the same
878
- * base class instance — enabling instanceof checks to work across the
879
- * monolith/core boundary.
880
- */
881
- /** Base error class for all Substrate errors */
882
- declare class AdtError extends Error {
883
- readonly code: string;
884
- readonly context: Record<string, unknown>;
885
- constructor(message: string, code: string, context?: Record<string, unknown>);
886
- toJSON(): Record<string, unknown>;
887
- }
888
- /** Error thrown when configuration is invalid or missing */
889
- declare class ConfigError extends AdtError {
890
- constructor(message: string, context?: Record<string, unknown>);
891
- }
892
- /** Error thrown when a config file uses an incompatible format version */
893
- declare class ConfigIncompatibleFormatError extends AdtError {
894
- constructor(message: string, context?: Record<string, unknown>);
895
- }
896
-
897
- //#endregion
898
- //#region packages/core/dist/adapters/types.d.ts
899
- //# sourceMappingURL=errors.d.ts.map
900
- /**
901
- * A spawn command descriptor that the orchestrator uses to invoke a CLI agent.
902
- * Contains all information needed to execute an agent process.
903
- */
904
- interface SpawnCommand$1 {
905
- /** The binary to execute (e.g., "claude", "codex", "gemini") */
906
- binary: string;
907
- /** Arguments to pass to the binary */
908
- args: string[];
909
- /** Optional environment variable overrides */
910
- env?: Record<string, string>;
911
- /** Optional list of environment variable keys to unset in the child process */
912
- unsetEnvKeys?: string[];
913
- /** Working directory for the process */
914
- cwd: string;
915
- /** Optional data to pipe to stdin */
916
- stdin?: string;
917
- /** Optional timeout in milliseconds */
918
- timeoutMs?: number;
919
- }
920
- /**
921
- * Options passed to adapter methods for each invocation.
922
- * Controls execution context for a specific task run.
923
- */
924
- interface AdapterOptions$1 {
925
- /** Path to the git worktree for this task */
926
- worktreePath: string;
927
- /** Billing mode to use for this execution */
928
- billingMode: BillingMode$1;
929
- /** Optional model identifier override */
930
- model?: string;
931
- /** Optional additional CLI flags to append */
932
- additionalFlags?: string[];
933
- /** Optional API key override (used when billingMode is 'api') */
934
- apiKey?: string;
935
- /** Optional maximum agentic turns (passed as --max-turns to Claude CLI) */
936
- maxTurns?: number;
937
- /**
938
- * Optional OTLP endpoint URL for telemetry export (Story 27-9).
939
- * When set, injects OTLP env vars into the spawned process so that
940
- * Claude Code exports telemetry to the local IngestionServer.
941
- * Example: "http://localhost:4318"
942
- */
943
- otlpEndpoint?: string;
944
- /**
945
- * Optional story key for OTEL resource attribute tagging.
946
- * Injected as `substrate.story_key` via OTEL_RESOURCE_ATTRIBUTES
947
- * so the telemetry pipeline can group spans/events per story.
948
- */
949
- storyKey?: string;
950
- /**
951
- * Optional maximum context tokens. Historically passed as --max-context-tokens to
952
- * Claude CLI; that flag was removed in Claude Code v2.x and is now silently ignored
953
- * by the claude-adapter. The field remains on the options shape for backward compat
954
- * with callers (Story 30-8 efficiency-gated retry logic) but no longer constrains
955
- * dispatch behavior. --max-turns continues to bound dispatch length.
956
- */
957
- maxContextTokens?: number;
958
- /**
959
- * Optional optimization directives derived from prior stories' telemetry (Story 30-6).
960
- * When set, appended to the system prompt to guide the sub-agent toward efficient patterns.
961
- * Generated by TelemetryAdvisor.formatOptimizationDirectives().
962
- */
963
- optimizationDirectives?: string;
964
- /** Dispatch context: task type (create-story, dev-story, code-review, etc.) for OTLP attribution */
965
- taskType?: string;
966
- /** Dispatch context: unique dispatch ID for per-dispatch telemetry correlation */
967
- dispatchId?: string;
968
- }
969
- /**
970
- * Capabilities reported by an adapter for this CLI agent.
971
- * Used for routing and planning decisions.
972
- */
973
- interface AdapterCapabilities$1 {
974
- /** Whether the agent outputs structured JSON */
975
- supportsJsonOutput: boolean;
976
- /** Whether the agent supports streaming output */
977
- supportsStreaming: boolean;
978
- /** Whether the agent supports subscription-based billing */
979
- supportsSubscriptionBilling: boolean;
980
- /** Whether the agent supports API-key-based billing */
981
- supportsApiBilling: boolean;
982
- /** Whether the agent can generate task planning graphs */
983
- supportsPlanGeneration: boolean;
984
- /** Maximum context tokens the agent supports */
985
- maxContextTokens: number;
986
- /** Task types this agent can handle */
987
- supportedTaskTypes: string[];
988
- /** Programming languages the agent supports */
989
- supportedLanguages: string[];
990
- /**
991
- * Timeout multiplier relative to default dispatch timeouts.
992
- * Agents that are slower (e.g., Codex) declare a multiplier > 1.0
993
- * so the dispatcher scales timeouts automatically.
994
- * Default: 1.0 (no scaling).
995
- */
996
- timeoutMultiplier?: number;
997
- /**
998
- * Whether the agent supports a --system-prompt flag.
999
- * Claude Code: true. Codex/Gemini: false.
1000
- * When false, system-level instructions must be embedded in the prompt itself.
1001
- */
1002
- supportsSystemPrompt?: boolean;
1003
- /**
1004
- * Whether the agent exports OTLP telemetry (spans, metrics, logs).
1005
- * Claude Code: true. Codex/Gemini: false.
1006
- * When false, telemetry is heuristic-only (character-based token estimates).
1007
- */
1008
- supportsOtlpExport?: boolean;
1009
- /**
1010
- * Whether the dispatcher should append a YAML output format reminder to prompts.
1011
- * Claude Code: false (follows methodology pack format instructions reliably).
1012
- * Codex/Gemini: true (need explicit final nudge to emit fenced YAML blocks).
1013
- */
1014
- requiresYamlSuffix?: boolean;
1015
- /**
1016
- * Default maximum review cycles for this agent backend.
1017
- * Claude Code: 2 (converges quickly). Codex: 3 (needs more iterations).
1018
- * Overridden by explicit --max-review-cycles CLI flag.
1019
- */
1020
- defaultMaxReviewCycles?: number;
1021
- }
1022
- /**
1023
- * Result returned from an adapter health check.
1024
- * Indicates whether the CLI binary is present and functional.
1025
- */
1026
- interface AdapterHealthResult$1 {
1027
- /** Whether the adapter is considered healthy and usable */
1028
- healthy: boolean;
1029
- /** Detected version string of the CLI binary */
1030
- version?: string;
1031
- /** Full path to the CLI binary, if resolved */
1032
- cliPath?: string;
1033
- /** Error message when healthy is false */
1034
- error?: string;
1035
- /** Detected billing mode(s) available for this adapter */
1036
- detectedBillingModes?: BillingMode$1[];
1037
- /** Whether the CLI supports headless/non-interactive mode */
1038
- supportsHeadless: boolean;
1039
- }
1040
- /**
1041
- * Parsed result from a task execution.
1042
- * Normalized representation from CLI agent JSON output.
1043
- */
1044
- interface TaskResult$2 {
1045
- /** Task identifier this result belongs to */
1046
- taskId?: TaskId$1;
1047
- /** Whether the task completed successfully */
1048
- success: boolean;
1049
- /** Primary output content from the agent */
1050
- output: string;
1051
- /** Error message if the task failed */
1052
- error?: string;
1053
- /** Raw exit code from the CLI process */
1054
- exitCode: number;
1055
- /** Execution metadata */
1056
- metadata?: {
1057
- executionTime?: number;
1058
- tokensUsed?: TokenEstimate$1;
1059
- };
1060
- /**
1061
- * True when the dispatcher's AdapterOutputNormalizer exhausted all
1062
- * normalization strategies without extracting parseable YAML.
1063
- * Authoritative signal for the 'adapter-format' root cause category (story 53-10).
1064
- * Optional — existing callers without the field continue to compile unchanged.
1065
- */
1066
- adapterError?: boolean;
1067
- }
1068
- /**
1069
- * Token usage estimate for budget tracking.
1070
- */
1071
- interface TokenEstimate$1 {
1072
- /** Estimated input tokens */
1073
- input: number;
1074
- /** Estimated output tokens */
1075
- output: number;
1076
- /** Total token estimate */
1077
- total: number;
1078
- }
1079
- /**
1080
- * Request input for plan generation.
1081
- */
1082
- interface PlanRequest$1 {
1083
- /** High-level goal or description of work to plan */
1084
- goal: string;
1085
- /** Additional context for the planning agent */
1086
- context?: string;
1087
- /** Maximum number of tasks to generate */
1088
- maxTasks?: number;
1089
- }
1090
- /**
1091
- * Parsed result from a plan generation invocation.
1092
- */
1093
- interface PlanParseResult$1 {
1094
- /** Whether plan generation succeeded */
1095
- success: boolean;
1096
- /** Parsed list of planned task descriptions */
1097
- tasks: PlannedTask$1[];
1098
- /** Error message if plan generation failed */
1099
- error?: string;
1100
- /** Raw output for debugging */
1101
- rawOutput?: string;
1102
- }
1103
- /**
1104
- * A single task entry in a generated plan.
1105
- */
1106
- interface PlannedTask$1 {
1107
- /** Task title */
1108
- title: string;
1109
- /** Detailed description */
1110
- description: string;
1111
- /** Estimated complexity (1-10) */
1112
- complexity?: number;
1113
- /** Other task titles this task depends on */
1114
- dependencies?: string[];
1115
- }
1116
- /**
1117
- * Result from a single adapter discovery attempt.
1118
- */
1119
- interface AdapterDiscoveryResult {
1120
- /** Adapter id that was tried */
1121
- adapterId: AgentId$1;
1122
- /** Display name of the adapter */
1123
- displayName: string;
1124
- /** Health check result */
1125
- healthResult: AdapterHealthResult$1;
1126
- /** Whether the adapter was registered (healthy) */
1127
- registered: boolean;
1128
- }
1129
- /**
1130
- * Summary result from discoverAndRegister().
1131
- */
1132
- interface DiscoveryReport {
1133
- /** Number of adapters successfully registered */
1134
- registeredCount: number;
1135
- /** Number of adapters that failed health checks */
1136
- failedCount: number;
1137
- /** Per-adapter detail results */
1138
- results: AdapterDiscoveryResult[];
1139
- }
1140
-
1141
- //#endregion
1142
- //#region packages/core/dist/adapters/worker-adapter.d.ts
1143
- //# sourceMappingURL=types.d.ts.map
1144
- /**
1145
- * WorkerAdapter — the interface every CLI agent adapter must implement.
1146
- *
1147
- * Adapters are responsible for:
1148
- * 1. Verifying their CLI binary is installed and responsive (healthCheck)
1149
- * 2. Constructing the spawn command to execute a task (buildCommand)
1150
- * 3. Constructing the spawn command for plan generation (buildPlanningCommand)
1151
- * 4. Parsing task result output from the CLI (parseOutput)
1152
- * 5. Parsing plan result output from the CLI (parsePlanOutput)
1153
- * 6. Estimating token usage for budget tracking (estimateTokens)
1154
- * 7. Reporting their capabilities for routing decisions (getCapabilities)
1155
- */
1156
- interface WorkerAdapter$1 {
1157
- /**
1158
- * Unique identifier for this adapter type.
1159
- * Used as the Map key in AdapterRegistry.
1160
- * @example "claude-code"
1161
- */
1162
- readonly id: AgentId$1;
1163
- /**
1164
- * Human-readable display name for the adapter.
1165
- * @example "Claude Code"
1166
- */
1167
- readonly displayName: string;
1168
- /**
1169
- * Semantic version of this adapter implementation.
1170
- * @example "1.0.0"
1171
- */
1172
- readonly adapterVersion: string;
1173
- /**
1174
- * Verify that the underlying CLI binary is installed, accessible, and
1175
- * able to respond in headless/non-interactive mode.
1176
- *
1177
- * This method must NOT throw — failures should be captured in the returned
1178
- * AdapterHealthResult.
1179
- *
1180
- * @returns A promise resolving to health check details
1181
- *
1182
- * @example
1183
- * ```typescript
1184
- * const result = await adapter.healthCheck()
1185
- * if (!result.healthy) console.error(result.error)
1186
- * ```
1187
- */
1188
- healthCheck(): Promise<AdapterHealthResult$1>;
1189
- /**
1190
- * Generate the spawn command to execute a coding task.
1191
- *
1192
- * The returned SpawnCommand must set `cwd` to options.worktreePath so the
1193
- * CLI agent operates in the correct git worktree (NFR10).
1194
- *
1195
- * @param prompt Prompt or description of the task to execute
1196
- * @param options Per-invocation execution options
1197
- * @returns SpawnCommand ready to be executed by the orchestrator
1198
- *
1199
- * @example
1200
- * ```typescript
1201
- * const cmd = adapter.buildCommand('Fix the failing tests', { worktreePath: '/tmp/wt', billingMode: 'api' })
1202
- * // spawn(cmd.binary, cmd.args, { cwd: cmd.cwd, env: { ...process.env, ...cmd.env } })
1203
- * ```
1204
- */
1205
- buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
1206
- /**
1207
- * Generate the spawn command to invoke the CLI agent for plan generation.
1208
- *
1209
- * @param request Plan request with goal and context
1210
- * @param options Per-invocation execution options
1211
- * @returns SpawnCommand for the planning invocation
1212
- */
1213
- buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
1214
- /**
1215
- * Parse the raw CLI process output into a normalized TaskResult.
1216
- *
1217
- * This method must handle all output variations including:
1218
- * - Valid JSON stdout
1219
- * - Non-JSON stdout (fallback)
1220
- * - Non-zero exit codes
1221
- * - Combined stdout + stderr
1222
- *
1223
- * @param stdout Standard output captured from the CLI process
1224
- * @param stderr Standard error captured from the CLI process
1225
- * @param exitCode Exit code from the CLI process
1226
- * @returns Normalized TaskResult
1227
- */
1228
- parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
1229
- /**
1230
- * Parse the raw CLI output from a planning invocation into a PlanParseResult.
1231
- *
1232
- * @param stdout Standard output from the planning invocation
1233
- * @param stderr Standard error from the planning invocation
1234
- * @param exitCode Exit code from the planning invocation
1235
- * @returns Parsed plan result
1236
- */
1237
- parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
1238
- /**
1239
- * Estimate the token count for a given prompt string.
1240
- *
1241
- * Used for pre-execution budget checks. Implementations may use heuristics
1242
- * (e.g., character count / 3) when exact tokenizers are unavailable.
1243
- *
1244
- * @param prompt The prompt text to estimate
1245
- * @returns TokenEstimate with input, output, and total projections
1246
- *
1247
- * @example
1248
- * ```typescript
1249
- * const estimate = adapter.estimateTokens('Fix the failing tests in auth.ts')
1250
- * if (estimate.total > budgetCap) throw new BudgetExceededError(...)
1251
- * ```
1252
- */
1253
- estimateTokens(prompt: string): TokenEstimate$1;
1254
- /**
1255
- * Return the capabilities of this adapter's underlying CLI agent.
1256
- *
1257
- * The returned object is used by the orchestrator for:
1258
- * - Routing decisions (which adapter handles which task type)
1259
- * - Plan generation eligibility
1260
- * - Budget mode selection
1261
- *
1262
- * @returns AdapterCapabilities for this agent
1263
- */
1264
- getCapabilities(): AdapterCapabilities$1;
1265
- }
1266
-
1267
- //#endregion
1268
- //#region packages/core/dist/adapters/adapter-registry.d.ts
1269
- /**
1270
- * AdapterRegistry — public interface for the adapter registry.
1271
- *
1272
- * Defined here (not in types.ts) to avoid a circular dependency between
1273
- * types.ts and worker-adapter.ts. AdapterRegistry references WorkerAdapter,
1274
- * which is defined in this file, so placing it here keeps the dep graph acyclic.
1275
- *
1276
- * The concrete implementation (AdapterRegistry class) lives in the monolith
1277
- * until Epic 41. This interface exposes only the public method surface.
1278
- *
1279
- * Usage:
1280
- * ```typescript
1281
- * const registry: AdapterRegistry = new ConcreteAdapterRegistry()
1282
- * const report = await registry.discoverAndRegister()
1283
- * const claude = registry.get('claude-code')
1284
- * ```
1285
- */
1286
- /**
1287
- * AdapterRegistry manages the lifecycle of WorkerAdapter instances.
1288
- *
1289
- * Usage:
1290
- * ```typescript
1291
- * const registry = new AdapterRegistry()
1292
- * const report = await registry.discoverAndRegister()
1293
- * const claude = registry.get('claude-code')
1294
- * ```
1295
- */
1296
- declare class AdapterRegistry {
1297
- private readonly _adapters;
1298
- /**
1299
- * Register an adapter by its id.
1300
- * Overwrites any existing adapter with the same id.
1301
- */
1302
- register(adapter: WorkerAdapter$1): void;
1303
- /**
1304
- * Retrieve a registered adapter by id.
1305
- * @returns The adapter, or undefined if not registered
1306
- */
1307
- get(id: AgentId$1): WorkerAdapter$1 | undefined;
1308
- /**
1309
- * Return all registered adapters as an array.
1310
- */
1311
- getAll(): WorkerAdapter$1[];
1312
- /**
1313
- * Return all registered adapters that support plan generation.
1314
- */
1315
- getPlanningCapable(): WorkerAdapter$1[];
1316
- /**
1317
- * Instantiate all built-in adapters, run health checks sequentially,
1318
- * and register those that pass.
1319
- *
1320
- * Failed adapters are included in the report but do NOT prevent startup.
1321
- *
1322
- * @returns Discovery report with per-adapter results
1323
- */
1324
- discoverAndRegister(): Promise<DiscoveryReport>;
1325
- }
1326
-
1327
- //#endregion
1328
- //#region packages/core/dist/adapters/claude-adapter.d.ts
1329
- //# sourceMappingURL=adapter-registry.d.ts.map
1330
- /**
1331
- * Adapter for the Claude Code CLI agent.
1332
- *
1333
- * Capabilities: JSON output, streaming, both billing modes, plan generation.
1334
- * Health check: runs `claude --version` to verify install.
1335
- * Billing detection: detects subscription vs API via version output or env.
1336
- */
1337
- declare class ClaudeCodeAdapter implements WorkerAdapter$1 {
1338
- readonly id: AgentId$1;
1339
- readonly displayName = "Claude Code";
1340
- readonly adapterVersion = "1.0.0";
1341
- private readonly _logger;
1342
- constructor(logger?: ILogger);
1343
- /**
1344
- * Verify the `claude` binary is installed and responsive.
1345
- * Detects subscription vs API billing mode.
1346
- */
1347
- healthCheck(): Promise<AdapterHealthResult$1>;
1348
- /**
1349
- * Build spawn command for a coding task.
1350
- * Uses: `claude -p --model <model> --dangerously-skip-permissions --system-prompt <minimal>`
1351
- * Prompt is delivered via stdin (not CLI arg) to avoid E2BIG on large prompts.
1352
- */
1353
- buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
1354
- /**
1355
- * Build spawn command for plan generation.
1356
- */
1357
- buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
1358
- /**
1359
- * Parse Claude Code JSON output into a TaskResult.
1360
- */
1361
- parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
1362
- /**
1363
- * Parse Claude plan generation output.
1364
- */
1365
- parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
1366
- /**
1367
- * Estimate token count using character-based heuristic.
1368
- */
1369
- estimateTokens(prompt: string): TokenEstimate$1;
1370
- /**
1371
- * Return Claude Code capabilities.
1372
- */
1373
- getCapabilities(): AdapterCapabilities$1;
1374
- private _detectBillingModes;
1375
- private _buildPlanningPrompt;
1376
- }
1377
-
1378
- //#endregion
1379
- //#region packages/core/dist/adapters/codex-adapter.d.ts
1380
- //# sourceMappingURL=claude-adapter.d.ts.map
1381
- /**
1382
- * Adapter for the OpenAI Codex CLI agent.
1383
- *
1384
- * Codex CLI uses stdin for the prompt and outputs JSON when --json flag is used.
1385
- * Codex supports subscription billing (via `codex login`) and API key billing.
1386
- */
1387
- declare class CodexCLIAdapter implements WorkerAdapter$1 {
1388
- readonly id: AgentId$1;
1389
- readonly displayName = "Codex CLI";
1390
- readonly adapterVersion = "1.0.0";
1391
- private readonly _logger;
1392
- constructor(logger?: ILogger);
1393
- /**
1394
- * Verify the `codex` binary is installed and responsive.
1395
- */
1396
- healthCheck(): Promise<AdapterHealthResult$1>;
1397
- /**
1398
- * Build spawn command for a coding task.
1399
- * Uses: `codex exec` with prompt delivered via stdin.
1400
- *
1401
- * Do NOT use --json: it produces a JSONL event stream that prevents
1402
- * extractYamlBlock from finding the structured result block in stdout.
1403
- * Raw text output is required (same rationale as Claude adapter).
1404
- */
1405
- buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
1406
- /**
1407
- * Build spawn command for plan generation.
1408
- * Uses codex exec with a JSON plan generation prompt via stdin.
1409
- */
1410
- buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
1411
- /**
1412
- * Parse Codex CLI output into a TaskResult.
1413
- *
1414
- * With raw text mode (no --json), stdout is the agent's direct output.
1415
- * YAML extraction happens in the dispatcher's extractYamlBlock, not here.
1416
- */
1417
- parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
1418
- /**
1419
- * Parse Codex plan generation output.
1420
- */
1421
- parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
1422
- /**
1423
- * Estimate token count using character-based heuristic.
1424
- */
1425
- estimateTokens(prompt: string): TokenEstimate$1;
1426
- /**
1427
- * Return Codex CLI capabilities.
1428
- */
1429
- getCapabilities(): AdapterCapabilities$1;
1430
- private _buildPlanningPrompt;
1431
- }
1432
-
1433
- //#endregion
1434
- //#region packages/core/dist/adapters/gemini-adapter.d.ts
1435
- //# sourceMappingURL=codex-adapter.d.ts.map
1436
- /**
1437
- * Adapter for the Google Gemini CLI agent.
1438
- *
1439
- * Gemini CLI follows similar patterns to Claude Code: prompt via `-p` flag,
1440
- * JSON output via `--output-format json`, and model via `--model`.
1441
- */
1442
- declare class GeminiCLIAdapter implements WorkerAdapter$1 {
1443
- readonly id: AgentId$1;
1444
- readonly displayName = "Gemini CLI";
1445
- readonly adapterVersion = "1.0.0";
1446
- private readonly _logger;
1447
- constructor(logger?: ILogger);
1448
- /**
1449
- * Verify the `gemini` binary is installed and responsive.
1450
- * Detects subscription vs API billing mode.
1451
- */
1452
- healthCheck(): Promise<AdapterHealthResult$1>;
1453
- /**
1454
- * Build spawn command for a coding task.
1455
- * Uses: `gemini -p <prompt> --output-format json --model <model>`
1456
- */
1457
- buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
1458
- /**
1459
- * Build spawn command for plan generation.
1460
- */
1461
- buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
1462
- /**
1463
- * Parse Gemini CLI JSON output into a TaskResult.
1464
- */
1465
- parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
1466
- /**
1467
- * Parse Gemini plan generation output.
1468
- */
1469
- parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
1470
- /**
1471
- * Estimate token count using character-based heuristic.
1472
- */
1473
- estimateTokens(prompt: string): TokenEstimate$1;
1474
- /**
1475
- * Return Gemini CLI capabilities.
1476
- */
1477
- getCapabilities(): AdapterCapabilities$1;
1478
- private _detectBillingModes;
1479
- private _buildPlanningPrompt;
1480
- }
1481
-
1482
- //#endregion
1483
- //#region packages/core/dist/monitor/recommendation-types.d.ts
1484
- //# sourceMappingURL=gemini-adapter.d.ts.map
1485
- /**
1486
- * Recommendation Types — data structures for the routing recommendations engine.
1487
- * Migrated to @substrate-ai/core (Story 41-7)
1488
- */
1489
- type ConfidenceLevel = 'low' | 'medium' | 'high';
1490
- interface Recommendation {
1491
- task_type: string;
1492
- current_agent: string;
1493
- recommended_agent: string;
1494
- reason: string;
1495
- confidence: ConfidenceLevel;
1496
- current_success_rate: number;
1497
- recommended_success_rate: number;
1498
- current_avg_tokens: number;
1499
- recommended_avg_tokens: number;
1500
- improvement_percentage: number;
1501
- sample_size_current: number;
1502
- sample_size_recommended: number;
1503
- }
1504
-
1505
- //#endregion
1506
- //#region src/core/errors.d.ts
1507
780
  /** Error thrown when task configuration is invalid */
1508
781
  declare class TaskConfigError extends AdtError {
1509
782
  constructor(message: string, context?: Record<string, unknown>);
@@ -2582,10 +1855,58 @@ interface OrchestratorEvents {
2582
1855
  /** Human-readable reason for autonomous action. */
2583
1856
  reason: string;
2584
1857
  };
2585
- }
2586
-
2587
- //#endregion
1858
+ /**
1859
+ * Story 73-1: Tier A auto-retry — recovery engine re-dispatched a story
1860
+ * with diagnosis + findings prepended to the retry prompt.
1861
+ *
1862
+ * Mirror of CoreEvents['recovery:tier-a-retry']; both must stay in sync.
1863
+ */
1864
+ 'recovery:tier-a-retry': {
1865
+ runId: string;
1866
+ storyKey: string;
1867
+ rootCause: string;
1868
+ attempt: number;
1869
+ retryBudgetRemaining: number;
1870
+ };
1871
+ /**
1872
+ * Story 73-1: Tier B re-scope proposal — recovery engine appended a
1873
+ * re-scope proposal to RunManifest.pending_proposals.
1874
+ *
1875
+ * Mirror of CoreEvents['recovery:tier-b-proposal']; both must stay in sync.
1876
+ */
1877
+ 'recovery:tier-b-proposal': {
1878
+ runId: string;
1879
+ storyKey: string;
1880
+ rootCause: string;
1881
+ attempts: number;
1882
+ suggestedAction: string;
1883
+ blastRadius: string[];
1884
+ };
1885
+ /**
1886
+ * Story 73-1: Tier C halt — recovery engine determined a halt is required.
1887
+ * The orchestrator yields to the Decision Router / Interactive Prompt (Story 73-2).
1888
+ *
1889
+ * Mirror of CoreEvents['recovery:tier-c-halt']; both must stay in sync.
1890
+ */
1891
+ 'recovery:tier-c-halt': {
1892
+ runId: string;
1893
+ storyKey: string;
1894
+ rootCause: string;
1895
+ };
1896
+ /**
1897
+ * Story 73-1: Safety valve — pending_proposals count reached 5 or more.
1898
+ * The orchestrator exits the main loop with code 1.
1899
+ *
1900
+ * Mirror of CoreEvents['pipeline:halted-pending-proposals']; both must stay
1901
+ * in sync.
1902
+ */
1903
+ 'pipeline:halted-pending-proposals': {
1904
+ runId: string;
1905
+ pendingProposalsCount: number;
1906
+ };
1907
+ } //#endregion
2588
1908
  //#region src/core/event-bus.d.ts
1909
+
2589
1910
  //# sourceMappingURL=event-bus.types.d.ts.map
2590
1911
  /**
2591
1912
  * Backward-compatible type alias: TypedEventBus specialized to OrchestratorEvents.
@@ -2594,7 +1915,7 @@ interface OrchestratorEvents {
2594
1915
  * This alias ensures those declarations continue to enforce OrchestratorEvents
2595
1916
  * handler types rather than defaulting to Record<string, unknown>.
2596
1917
  */
2597
- type TypedEventBus = TypedEventBus$1<OrchestratorEvents>;
1918
+ type TypedEventBus$1 = TypedEventBus<OrchestratorEvents>;
2598
1919
  /**
2599
1920
  * Concrete implementation specialized to OrchestratorEvents.
2600
1921
  *
@@ -2616,7 +1937,7 @@ type TypedEventBus = TypedEventBus$1<OrchestratorEvents>;
2616
1937
  * @example
2617
1938
  * const bus = createEventBus()
2618
1939
  */
2619
- declare function createEventBus(): TypedEventBus;
1940
+ declare function createEventBus(): TypedEventBus$1;
2620
1941
 
2621
1942
  //#endregion
2622
1943
  //#region src/core/di.d.ts
@@ -3130,5 +2451,5 @@ interface TuiState {
3130
2451
  //#endregion
3131
2452
  //# sourceMappingURL=types.d.ts.map
3132
2453
 
3133
- export { AdapterCapabilities, AdapterDiscoveryResult, AdapterHealthResult, AdapterOptions, AdapterRegistry, AdtError, AgentCapability, AgentId, BaseService, BillingMode, BudgetExceededError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, CostRecord, DiscoveryReport, EscalationIssue, GeminiCLIAdapter, GitError, LogLevel, OrchestratorEvents, PipelineCompleteEvent, PipelineEvent, PipelinePhase, PipelineStartEvent, PlanParseResult, PlanRequest, PlannedTask, RecoveryError, ServiceRegistry, SessionConfig, SessionStatus, SpawnCommand, StoryDoneEvent, StoryEscalationEvent, StoryLogEvent, StoryPhaseEvent, StoryPhaseLabel, StoryStatus, StoryWarnEvent, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, TaskId, TaskNode, TaskPriority, TaskResult, TaskStatus, TokenEstimate, TuiApp, TuiLogEntry, TuiState, TuiStoryState, TuiView, TypedEventBus, WorkerAdapter, WorkerError, WorkerId, WorkerNotFoundError, assertDefined, childLogger, createEventBus, createLogger, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, logger, printNonTtyWarning, sleep, withRetry };
2454
+ export { AdapterCapabilities, AdapterDiscoveryResult, AdapterHealthResult, AdapterOptions, AdapterRegistry, AdtError, AgentCapability, AgentId, BaseService, BillingMode, BudgetExceededError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, CostRecord, DiscoveryReport, EscalationIssue, GeminiCLIAdapter, GitError, LogLevel, OrchestratorEvents, PipelineCompleteEvent, PipelineEvent, PipelinePhase, PipelineStartEvent, PlanParseResult, PlanRequest, PlannedTask, RecoveryError, ServiceRegistry, SessionConfig, SessionStatus, SpawnCommand, StoryDoneEvent, StoryEscalationEvent, StoryLogEvent, StoryPhaseEvent, StoryPhaseLabel, StoryStatus, StoryWarnEvent, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, TaskId, TaskNode, TaskPriority, TaskResult, TaskStatus, TokenEstimate, TuiApp, TuiLogEntry, TuiState, TuiStoryState, TuiView, TypedEventBus$1 as TypedEventBus, WorkerAdapter, WorkerError, WorkerId, WorkerNotFoundError, assertDefined, childLogger, createEventBus, createLogger, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, logger, printNonTtyWarning, sleep, withRetry };
3134
2455
  //# sourceMappingURL=index.d.ts.map