substrate-ai 0.8.6 → 0.10.0
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/dist/adapter-registry-DXLMTmfD.js +0 -0
- package/dist/adapter-registry-neBZrkr3.js +4 -0
- package/dist/cli/index.js +5594 -5951
- package/dist/decisions-C0pz9Clx.js +0 -0
- package/dist/{decisions-BDLp3tJB.js → decisions-DQZW0h9X.js} +2 -1
- package/dist/dist-eNB_v7Iy.js +10205 -0
- package/dist/errors-BvyMlvCX.js +74 -0
- package/dist/experimenter-Dos3NsCg.js +3 -0
- package/dist/health-BvYILeQQ.js +6 -0
- package/dist/{health-C-VRJruD.js → health-CiDi90gC.js} +57 -1850
- package/dist/{helpers-CpMs8VZX.js → helpers-DTp3VJ2-.js} +31 -121
- package/dist/index.d.ts +672 -253
- package/dist/index.js +5 -3
- package/dist/{logger-D2fS2ccL.js → logger-KeHncl-f.js} +2 -42
- package/dist/routing-CcBOCuC9.js +0 -0
- package/dist/{routing-CD8bIci_.js → routing-HaYsjEIS.js} +2 -2
- package/dist/{run-ClxNDHbr.js → run-CAUhTR7Y.js} +594 -4249
- package/dist/run-DPZOQOvB.js +9 -0
- package/dist/{upgrade-B1S61VXJ.js → upgrade-DFGrqjGI.js} +3 -3
- package/dist/{upgrade-BK0HrKA6.js → upgrade-DYdYuuJK.js} +3 -3
- package/dist/version-manager-impl-BmOWu8ml.js +0 -0
- package/dist/version-manager-impl-CKv6I1S0.js +4 -0
- package/package.json +7 -2
- package/dist/adapter-registry-D2zdMwVu.js +0 -840
- package/dist/adapter-registry-WAyFydN5.js +0 -4
- package/dist/config-migrator-CtGelIsG.js +0 -250
- package/dist/decisions-DhAA2HG2.js +0 -397
- package/dist/experimenter-D_N_7ZF3.js +0 -503
- package/dist/git-utils-DxPx6erV.js +0 -365
- package/dist/health-DMbNP9bw.js +0 -5
- package/dist/operational-BdcdmDqS.js +0 -374
- package/dist/routing-BVrxrM6v.js +0 -832
- package/dist/run-MAQ3Wuju.js +0 -10
- package/dist/version-manager-impl-BIxOe7gZ.js +0 -372
- package/dist/version-manager-impl-RrWs-CI6.js +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -619,7 +619,7 @@ interface PipelinePhaseCompleteEvent {
|
|
|
619
619
|
* ```
|
|
620
620
|
*/
|
|
621
621
|
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; //#endregion
|
|
622
|
-
//#region
|
|
622
|
+
//#region packages/core/dist/types.d.ts
|
|
623
623
|
|
|
624
624
|
/**
|
|
625
625
|
* Exhaustive list of all PipelineEvent `type` discriminant strings.
|
|
@@ -629,8 +629,106 @@ type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFli
|
|
|
629
629
|
* out of sync with the actual event type definitions.
|
|
630
630
|
*/
|
|
631
631
|
/**
|
|
632
|
-
*
|
|
633
|
-
*
|
|
632
|
+
* Core types for Substrate
|
|
633
|
+
* Shared type definitions used across all modules
|
|
634
|
+
*/
|
|
635
|
+
/** Unique identifier for a task in the DAG */
|
|
636
|
+
type TaskId$1 = string;
|
|
637
|
+
/** Unique identifier for a worker/agent instance */
|
|
638
|
+
|
|
639
|
+
/** Unique identifier for a registered agent type */
|
|
640
|
+
type AgentId$1 = string;
|
|
641
|
+
/** Status of an individual task */
|
|
642
|
+
|
|
643
|
+
/** Billing mode for a worker/agent */
|
|
644
|
+
type BillingMode$1 = 'subscription' | 'api' | 'free';
|
|
645
|
+
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region packages/core/dist/events/types.d.ts
|
|
648
|
+
/** Severity level for errors and log messages */
|
|
649
|
+
/**
|
|
650
|
+
* Base event type primitives for the TypedEventBus system.
|
|
651
|
+
*
|
|
652
|
+
* These types are the foundation of the event bus contract.
|
|
653
|
+
* All event maps must satisfy EventMap; all handlers must satisfy EventHandler<T>.
|
|
654
|
+
*/
|
|
655
|
+
/**
|
|
656
|
+
* Base constraint for event maps.
|
|
657
|
+
* Each key is an event name (string), and the value is the payload type.
|
|
658
|
+
*
|
|
659
|
+
* Using `object` (not `Record<string, unknown>`) so that TypeScript interfaces
|
|
660
|
+
* with named properties (without index signatures) satisfy the constraint.
|
|
661
|
+
* TypeScript interfaces extend `object` but may not extend `Record<string, unknown>`
|
|
662
|
+
* unless they have an explicit index signature.
|
|
663
|
+
*/
|
|
664
|
+
type EventMap = object;
|
|
665
|
+
/**
|
|
666
|
+
* A typed event handler function for payload type T.
|
|
667
|
+
*/
|
|
668
|
+
type EventHandler<T> = (payload: T) => void;
|
|
669
|
+
|
|
670
|
+
//#endregion
|
|
671
|
+
//#region packages/core/dist/events/event-bus.d.ts
|
|
672
|
+
//# sourceMappingURL=types.d.ts.map
|
|
673
|
+
/**
|
|
674
|
+
* A type-safe event bus parameterized over an event map E.
|
|
675
|
+
*
|
|
676
|
+
* @example
|
|
677
|
+
* const bus: TypedEventBus<CoreEvents & SdlcEvents> = createEventBus()
|
|
678
|
+
* bus.on('orchestrator:story-complete', ({ storyKey }) => { ... })
|
|
679
|
+
*/
|
|
680
|
+
interface TypedEventBus$1<E extends EventMap> {
|
|
681
|
+
/**
|
|
682
|
+
* Emit an event with a typed payload.
|
|
683
|
+
* All registered handlers for this event key are called synchronously.
|
|
684
|
+
*/
|
|
685
|
+
emit<K extends keyof E>(event: K, payload: E[K]): void;
|
|
686
|
+
/**
|
|
687
|
+
* Register a handler for an event.
|
|
688
|
+
*/
|
|
689
|
+
on<K extends keyof E>(event: K, handler: EventHandler<E[K]>): void;
|
|
690
|
+
/**
|
|
691
|
+
* Unregister a previously registered handler.
|
|
692
|
+
*/
|
|
693
|
+
off<K extends keyof E>(event: K, handler: EventHandler<E[K]>): void;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region packages/core/dist/dispatch/types.d.ts
|
|
698
|
+
/**
|
|
699
|
+
* Concrete implementation of TypedEventBus backed by Node.js EventEmitter.
|
|
700
|
+
*
|
|
701
|
+
* Dispatch is SYNCHRONOUS — all handlers run before emit() returns (per ADR-004).
|
|
702
|
+
* maxListeners is set to 100 to avoid spurious warnings in large systems.
|
|
703
|
+
*
|
|
704
|
+
* @example
|
|
705
|
+
* const bus = new TypedEventBusImpl<CoreEvents & SdlcEvents>()
|
|
706
|
+
* bus.on('orchestrator:story-complete', ({ storyKey }) => { ... })
|
|
707
|
+
* bus.emit('orchestrator:story-complete', { storyKey: '1-1', reviewCycles: 1 })
|
|
708
|
+
*/
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Logger interface compatible with both pino-style loggers and console.
|
|
712
|
+
* Methods accept any argument pattern: (msg: string) or (obj: unknown, msg?: string).
|
|
713
|
+
*/
|
|
714
|
+
interface ILogger {
|
|
715
|
+
info(...args: unknown[]): void;
|
|
716
|
+
warn(...args: unknown[]): void;
|
|
717
|
+
error(...args: unknown[]): void;
|
|
718
|
+
debug(...args: unknown[]): void;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
//#endregion
|
|
722
|
+
//#region packages/core/dist/config/errors.d.ts
|
|
723
|
+
//# sourceMappingURL=types.d.ts.map
|
|
724
|
+
/**
|
|
725
|
+
* Config-specific error classes for @substrate-ai/core.
|
|
726
|
+
*
|
|
727
|
+
* AdtError is defined here as the canonical base class. ConfigError and
|
|
728
|
+
* ConfigIncompatibleFormatError extend it. The monolith's src/core/errors.ts
|
|
729
|
+
* re-exports AdtError from here so that all error classes share the same
|
|
730
|
+
* base class instance — enabling instanceof checks to work across the
|
|
731
|
+
* monolith/core boundary.
|
|
634
732
|
*/
|
|
635
733
|
/** Base error class for all Substrate errors */
|
|
636
734
|
declare class AdtError extends Error {
|
|
@@ -639,6 +737,557 @@ declare class AdtError extends Error {
|
|
|
639
737
|
constructor(message: string, code: string, context?: Record<string, unknown>);
|
|
640
738
|
toJSON(): Record<string, unknown>;
|
|
641
739
|
}
|
|
740
|
+
/** Error thrown when configuration is invalid or missing */
|
|
741
|
+
declare class ConfigError extends AdtError {
|
|
742
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
743
|
+
}
|
|
744
|
+
/** Error thrown when a config file uses an incompatible format version */
|
|
745
|
+
declare class ConfigIncompatibleFormatError extends AdtError {
|
|
746
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
//#endregion
|
|
750
|
+
//#region packages/core/dist/adapters/types.d.ts
|
|
751
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
752
|
+
/**
|
|
753
|
+
* A spawn command descriptor that the orchestrator uses to invoke a CLI agent.
|
|
754
|
+
* Contains all information needed to execute an agent process.
|
|
755
|
+
*/
|
|
756
|
+
interface SpawnCommand$1 {
|
|
757
|
+
/** The binary to execute (e.g., "claude", "codex", "gemini") */
|
|
758
|
+
binary: string;
|
|
759
|
+
/** Arguments to pass to the binary */
|
|
760
|
+
args: string[];
|
|
761
|
+
/** Optional environment variable overrides */
|
|
762
|
+
env?: Record<string, string>;
|
|
763
|
+
/** Optional list of environment variable keys to unset in the child process */
|
|
764
|
+
unsetEnvKeys?: string[];
|
|
765
|
+
/** Working directory for the process */
|
|
766
|
+
cwd: string;
|
|
767
|
+
/** Optional data to pipe to stdin */
|
|
768
|
+
stdin?: string;
|
|
769
|
+
/** Optional timeout in milliseconds */
|
|
770
|
+
timeoutMs?: number;
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Options passed to adapter methods for each invocation.
|
|
774
|
+
* Controls execution context for a specific task run.
|
|
775
|
+
*/
|
|
776
|
+
interface AdapterOptions$1 {
|
|
777
|
+
/** Path to the git worktree for this task */
|
|
778
|
+
worktreePath: string;
|
|
779
|
+
/** Billing mode to use for this execution */
|
|
780
|
+
billingMode: BillingMode$1;
|
|
781
|
+
/** Optional model identifier override */
|
|
782
|
+
model?: string;
|
|
783
|
+
/** Optional additional CLI flags to append */
|
|
784
|
+
additionalFlags?: string[];
|
|
785
|
+
/** Optional API key override (used when billingMode is 'api') */
|
|
786
|
+
apiKey?: string;
|
|
787
|
+
/** Optional maximum agentic turns (passed as --max-turns to Claude CLI) */
|
|
788
|
+
maxTurns?: number;
|
|
789
|
+
/**
|
|
790
|
+
* Optional OTLP endpoint URL for telemetry export (Story 27-9).
|
|
791
|
+
* When set, injects OTLP env vars into the spawned process so that
|
|
792
|
+
* Claude Code exports telemetry to the local IngestionServer.
|
|
793
|
+
* Example: "http://localhost:4318"
|
|
794
|
+
*/
|
|
795
|
+
otlpEndpoint?: string;
|
|
796
|
+
/**
|
|
797
|
+
* Optional story key for OTEL resource attribute tagging.
|
|
798
|
+
* Injected as `substrate.story_key` via OTEL_RESOURCE_ATTRIBUTES
|
|
799
|
+
* so the telemetry pipeline can group spans/events per story.
|
|
800
|
+
*/
|
|
801
|
+
storyKey?: string;
|
|
802
|
+
/**
|
|
803
|
+
* Optional maximum context tokens (passed as --max-context-tokens to Claude CLI).
|
|
804
|
+
* When set, constrains the context window to prevent runaway token usage.
|
|
805
|
+
* Used by efficiency-gated retry logic (Story 30-8) to cap context for stories
|
|
806
|
+
* that previously exhibited context spike patterns.
|
|
807
|
+
*/
|
|
808
|
+
maxContextTokens?: number;
|
|
809
|
+
/**
|
|
810
|
+
* Optional optimization directives derived from prior stories' telemetry (Story 30-6).
|
|
811
|
+
* When set, appended to the system prompt to guide the sub-agent toward efficient patterns.
|
|
812
|
+
* Generated by TelemetryAdvisor.formatOptimizationDirectives().
|
|
813
|
+
*/
|
|
814
|
+
optimizationDirectives?: string;
|
|
815
|
+
/** Dispatch context: task type (create-story, dev-story, code-review, etc.) for OTLP attribution */
|
|
816
|
+
taskType?: string;
|
|
817
|
+
/** Dispatch context: unique dispatch ID for per-dispatch telemetry correlation */
|
|
818
|
+
dispatchId?: string;
|
|
819
|
+
}
|
|
820
|
+
/**
|
|
821
|
+
* Capabilities reported by an adapter for this CLI agent.
|
|
822
|
+
* Used for routing and planning decisions.
|
|
823
|
+
*/
|
|
824
|
+
interface AdapterCapabilities$1 {
|
|
825
|
+
/** Whether the agent outputs structured JSON */
|
|
826
|
+
supportsJsonOutput: boolean;
|
|
827
|
+
/** Whether the agent supports streaming output */
|
|
828
|
+
supportsStreaming: boolean;
|
|
829
|
+
/** Whether the agent supports subscription-based billing */
|
|
830
|
+
supportsSubscriptionBilling: boolean;
|
|
831
|
+
/** Whether the agent supports API-key-based billing */
|
|
832
|
+
supportsApiBilling: boolean;
|
|
833
|
+
/** Whether the agent can generate task planning graphs */
|
|
834
|
+
supportsPlanGeneration: boolean;
|
|
835
|
+
/** Maximum context tokens the agent supports */
|
|
836
|
+
maxContextTokens: number;
|
|
837
|
+
/** Task types this agent can handle */
|
|
838
|
+
supportedTaskTypes: string[];
|
|
839
|
+
/** Programming languages the agent supports */
|
|
840
|
+
supportedLanguages: string[];
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* Result returned from an adapter health check.
|
|
844
|
+
* Indicates whether the CLI binary is present and functional.
|
|
845
|
+
*/
|
|
846
|
+
interface AdapterHealthResult$1 {
|
|
847
|
+
/** Whether the adapter is considered healthy and usable */
|
|
848
|
+
healthy: boolean;
|
|
849
|
+
/** Detected version string of the CLI binary */
|
|
850
|
+
version?: string;
|
|
851
|
+
/** Full path to the CLI binary, if resolved */
|
|
852
|
+
cliPath?: string;
|
|
853
|
+
/** Error message when healthy is false */
|
|
854
|
+
error?: string;
|
|
855
|
+
/** Detected billing mode(s) available for this adapter */
|
|
856
|
+
detectedBillingModes?: BillingMode$1[];
|
|
857
|
+
/** Whether the CLI supports headless/non-interactive mode */
|
|
858
|
+
supportsHeadless: boolean;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Parsed result from a task execution.
|
|
862
|
+
* Normalized representation from CLI agent JSON output.
|
|
863
|
+
*/
|
|
864
|
+
interface TaskResult$2 {
|
|
865
|
+
/** Task identifier this result belongs to */
|
|
866
|
+
taskId?: TaskId$1;
|
|
867
|
+
/** Whether the task completed successfully */
|
|
868
|
+
success: boolean;
|
|
869
|
+
/** Primary output content from the agent */
|
|
870
|
+
output: string;
|
|
871
|
+
/** Error message if the task failed */
|
|
872
|
+
error?: string;
|
|
873
|
+
/** Raw exit code from the CLI process */
|
|
874
|
+
exitCode: number;
|
|
875
|
+
/** Execution metadata */
|
|
876
|
+
metadata?: {
|
|
877
|
+
executionTime?: number;
|
|
878
|
+
tokensUsed?: TokenEstimate$1;
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Token usage estimate for budget tracking.
|
|
883
|
+
*/
|
|
884
|
+
interface TokenEstimate$1 {
|
|
885
|
+
/** Estimated input tokens */
|
|
886
|
+
input: number;
|
|
887
|
+
/** Estimated output tokens */
|
|
888
|
+
output: number;
|
|
889
|
+
/** Total token estimate */
|
|
890
|
+
total: number;
|
|
891
|
+
}
|
|
892
|
+
/**
|
|
893
|
+
* Request input for plan generation.
|
|
894
|
+
*/
|
|
895
|
+
interface PlanRequest$1 {
|
|
896
|
+
/** High-level goal or description of work to plan */
|
|
897
|
+
goal: string;
|
|
898
|
+
/** Additional context for the planning agent */
|
|
899
|
+
context?: string;
|
|
900
|
+
/** Maximum number of tasks to generate */
|
|
901
|
+
maxTasks?: number;
|
|
902
|
+
}
|
|
903
|
+
/**
|
|
904
|
+
* Parsed result from a plan generation invocation.
|
|
905
|
+
*/
|
|
906
|
+
interface PlanParseResult$1 {
|
|
907
|
+
/** Whether plan generation succeeded */
|
|
908
|
+
success: boolean;
|
|
909
|
+
/** Parsed list of planned task descriptions */
|
|
910
|
+
tasks: PlannedTask$1[];
|
|
911
|
+
/** Error message if plan generation failed */
|
|
912
|
+
error?: string;
|
|
913
|
+
/** Raw output for debugging */
|
|
914
|
+
rawOutput?: string;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* A single task entry in a generated plan.
|
|
918
|
+
*/
|
|
919
|
+
interface PlannedTask$1 {
|
|
920
|
+
/** Task title */
|
|
921
|
+
title: string;
|
|
922
|
+
/** Detailed description */
|
|
923
|
+
description: string;
|
|
924
|
+
/** Estimated complexity (1-10) */
|
|
925
|
+
complexity?: number;
|
|
926
|
+
/** Other task titles this task depends on */
|
|
927
|
+
dependencies?: string[];
|
|
928
|
+
}
|
|
929
|
+
/**
|
|
930
|
+
* Result from a single adapter discovery attempt.
|
|
931
|
+
*/
|
|
932
|
+
interface AdapterDiscoveryResult {
|
|
933
|
+
/** Adapter id that was tried */
|
|
934
|
+
adapterId: AgentId$1;
|
|
935
|
+
/** Display name of the adapter */
|
|
936
|
+
displayName: string;
|
|
937
|
+
/** Health check result */
|
|
938
|
+
healthResult: AdapterHealthResult$1;
|
|
939
|
+
/** Whether the adapter was registered (healthy) */
|
|
940
|
+
registered: boolean;
|
|
941
|
+
}
|
|
942
|
+
/**
|
|
943
|
+
* Summary result from discoverAndRegister().
|
|
944
|
+
*/
|
|
945
|
+
interface DiscoveryReport {
|
|
946
|
+
/** Number of adapters successfully registered */
|
|
947
|
+
registeredCount: number;
|
|
948
|
+
/** Number of adapters that failed health checks */
|
|
949
|
+
failedCount: number;
|
|
950
|
+
/** Per-adapter detail results */
|
|
951
|
+
results: AdapterDiscoveryResult[];
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
//#endregion
|
|
955
|
+
//#region packages/core/dist/adapters/worker-adapter.d.ts
|
|
956
|
+
//# sourceMappingURL=types.d.ts.map
|
|
957
|
+
/**
|
|
958
|
+
* WorkerAdapter — the interface every CLI agent adapter must implement.
|
|
959
|
+
*
|
|
960
|
+
* Adapters are responsible for:
|
|
961
|
+
* 1. Verifying their CLI binary is installed and responsive (healthCheck)
|
|
962
|
+
* 2. Constructing the spawn command to execute a task (buildCommand)
|
|
963
|
+
* 3. Constructing the spawn command for plan generation (buildPlanningCommand)
|
|
964
|
+
* 4. Parsing task result output from the CLI (parseOutput)
|
|
965
|
+
* 5. Parsing plan result output from the CLI (parsePlanOutput)
|
|
966
|
+
* 6. Estimating token usage for budget tracking (estimateTokens)
|
|
967
|
+
* 7. Reporting their capabilities for routing decisions (getCapabilities)
|
|
968
|
+
*/
|
|
969
|
+
interface WorkerAdapter$1 {
|
|
970
|
+
/**
|
|
971
|
+
* Unique identifier for this adapter type.
|
|
972
|
+
* Used as the Map key in AdapterRegistry.
|
|
973
|
+
* @example "claude-code"
|
|
974
|
+
*/
|
|
975
|
+
readonly id: AgentId$1;
|
|
976
|
+
/**
|
|
977
|
+
* Human-readable display name for the adapter.
|
|
978
|
+
* @example "Claude Code"
|
|
979
|
+
*/
|
|
980
|
+
readonly displayName: string;
|
|
981
|
+
/**
|
|
982
|
+
* Semantic version of this adapter implementation.
|
|
983
|
+
* @example "1.0.0"
|
|
984
|
+
*/
|
|
985
|
+
readonly adapterVersion: string;
|
|
986
|
+
/**
|
|
987
|
+
* Verify that the underlying CLI binary is installed, accessible, and
|
|
988
|
+
* able to respond in headless/non-interactive mode.
|
|
989
|
+
*
|
|
990
|
+
* This method must NOT throw — failures should be captured in the returned
|
|
991
|
+
* AdapterHealthResult.
|
|
992
|
+
*
|
|
993
|
+
* @returns A promise resolving to health check details
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* ```typescript
|
|
997
|
+
* const result = await adapter.healthCheck()
|
|
998
|
+
* if (!result.healthy) console.error(result.error)
|
|
999
|
+
* ```
|
|
1000
|
+
*/
|
|
1001
|
+
healthCheck(): Promise<AdapterHealthResult$1>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Generate the spawn command to execute a coding task.
|
|
1004
|
+
*
|
|
1005
|
+
* The returned SpawnCommand must set `cwd` to options.worktreePath so the
|
|
1006
|
+
* CLI agent operates in the correct git worktree (NFR10).
|
|
1007
|
+
*
|
|
1008
|
+
* @param prompt Prompt or description of the task to execute
|
|
1009
|
+
* @param options Per-invocation execution options
|
|
1010
|
+
* @returns SpawnCommand ready to be executed by the orchestrator
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* ```typescript
|
|
1014
|
+
* const cmd = adapter.buildCommand('Fix the failing tests', { worktreePath: '/tmp/wt', billingMode: 'api' })
|
|
1015
|
+
* // spawn(cmd.binary, cmd.args, { cwd: cmd.cwd, env: { ...process.env, ...cmd.env } })
|
|
1016
|
+
* ```
|
|
1017
|
+
*/
|
|
1018
|
+
buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
|
|
1019
|
+
/**
|
|
1020
|
+
* Generate the spawn command to invoke the CLI agent for plan generation.
|
|
1021
|
+
*
|
|
1022
|
+
* @param request Plan request with goal and context
|
|
1023
|
+
* @param options Per-invocation execution options
|
|
1024
|
+
* @returns SpawnCommand for the planning invocation
|
|
1025
|
+
*/
|
|
1026
|
+
buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
|
|
1027
|
+
/**
|
|
1028
|
+
* Parse the raw CLI process output into a normalized TaskResult.
|
|
1029
|
+
*
|
|
1030
|
+
* This method must handle all output variations including:
|
|
1031
|
+
* - Valid JSON stdout
|
|
1032
|
+
* - Non-JSON stdout (fallback)
|
|
1033
|
+
* - Non-zero exit codes
|
|
1034
|
+
* - Combined stdout + stderr
|
|
1035
|
+
*
|
|
1036
|
+
* @param stdout Standard output captured from the CLI process
|
|
1037
|
+
* @param stderr Standard error captured from the CLI process
|
|
1038
|
+
* @param exitCode Exit code from the CLI process
|
|
1039
|
+
* @returns Normalized TaskResult
|
|
1040
|
+
*/
|
|
1041
|
+
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
|
|
1042
|
+
/**
|
|
1043
|
+
* Parse the raw CLI output from a planning invocation into a PlanParseResult.
|
|
1044
|
+
*
|
|
1045
|
+
* @param stdout Standard output from the planning invocation
|
|
1046
|
+
* @param stderr Standard error from the planning invocation
|
|
1047
|
+
* @param exitCode Exit code from the planning invocation
|
|
1048
|
+
* @returns Parsed plan result
|
|
1049
|
+
*/
|
|
1050
|
+
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
|
|
1051
|
+
/**
|
|
1052
|
+
* Estimate the token count for a given prompt string.
|
|
1053
|
+
*
|
|
1054
|
+
* Used for pre-execution budget checks. Implementations may use heuristics
|
|
1055
|
+
* (e.g., character count / 3) when exact tokenizers are unavailable.
|
|
1056
|
+
*
|
|
1057
|
+
* @param prompt The prompt text to estimate
|
|
1058
|
+
* @returns TokenEstimate with input, output, and total projections
|
|
1059
|
+
*
|
|
1060
|
+
* @example
|
|
1061
|
+
* ```typescript
|
|
1062
|
+
* const estimate = adapter.estimateTokens('Fix the failing tests in auth.ts')
|
|
1063
|
+
* if (estimate.total > budgetCap) throw new BudgetExceededError(...)
|
|
1064
|
+
* ```
|
|
1065
|
+
*/
|
|
1066
|
+
estimateTokens(prompt: string): TokenEstimate$1;
|
|
1067
|
+
/**
|
|
1068
|
+
* Return the capabilities of this adapter's underlying CLI agent.
|
|
1069
|
+
*
|
|
1070
|
+
* The returned object is used by the orchestrator for:
|
|
1071
|
+
* - Routing decisions (which adapter handles which task type)
|
|
1072
|
+
* - Plan generation eligibility
|
|
1073
|
+
* - Budget mode selection
|
|
1074
|
+
*
|
|
1075
|
+
* @returns AdapterCapabilities for this agent
|
|
1076
|
+
*/
|
|
1077
|
+
getCapabilities(): AdapterCapabilities$1;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
//#endregion
|
|
1081
|
+
//#region packages/core/dist/adapters/adapter-registry.d.ts
|
|
1082
|
+
/**
|
|
1083
|
+
* AdapterRegistry — public interface for the adapter registry.
|
|
1084
|
+
*
|
|
1085
|
+
* Defined here (not in types.ts) to avoid a circular dependency between
|
|
1086
|
+
* types.ts and worker-adapter.ts. AdapterRegistry references WorkerAdapter,
|
|
1087
|
+
* which is defined in this file, so placing it here keeps the dep graph acyclic.
|
|
1088
|
+
*
|
|
1089
|
+
* The concrete implementation (AdapterRegistry class) lives in the monolith
|
|
1090
|
+
* until Epic 41. This interface exposes only the public method surface.
|
|
1091
|
+
*
|
|
1092
|
+
* Usage:
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* const registry: AdapterRegistry = new ConcreteAdapterRegistry()
|
|
1095
|
+
* const report = await registry.discoverAndRegister()
|
|
1096
|
+
* const claude = registry.get('claude-code')
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
/**
|
|
1100
|
+
* AdapterRegistry manages the lifecycle of WorkerAdapter instances.
|
|
1101
|
+
*
|
|
1102
|
+
* Usage:
|
|
1103
|
+
* ```typescript
|
|
1104
|
+
* const registry = new AdapterRegistry()
|
|
1105
|
+
* const report = await registry.discoverAndRegister()
|
|
1106
|
+
* const claude = registry.get('claude-code')
|
|
1107
|
+
* ```
|
|
1108
|
+
*/
|
|
1109
|
+
declare class AdapterRegistry {
|
|
1110
|
+
private readonly _adapters;
|
|
1111
|
+
/**
|
|
1112
|
+
* Register an adapter by its id.
|
|
1113
|
+
* Overwrites any existing adapter with the same id.
|
|
1114
|
+
*/
|
|
1115
|
+
register(adapter: WorkerAdapter$1): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* Retrieve a registered adapter by id.
|
|
1118
|
+
* @returns The adapter, or undefined if not registered
|
|
1119
|
+
*/
|
|
1120
|
+
get(id: AgentId$1): WorkerAdapter$1 | undefined;
|
|
1121
|
+
/**
|
|
1122
|
+
* Return all registered adapters as an array.
|
|
1123
|
+
*/
|
|
1124
|
+
getAll(): WorkerAdapter$1[];
|
|
1125
|
+
/**
|
|
1126
|
+
* Return all registered adapters that support plan generation.
|
|
1127
|
+
*/
|
|
1128
|
+
getPlanningCapable(): WorkerAdapter$1[];
|
|
1129
|
+
/**
|
|
1130
|
+
* Instantiate all built-in adapters, run health checks sequentially,
|
|
1131
|
+
* and register those that pass.
|
|
1132
|
+
*
|
|
1133
|
+
* Failed adapters are included in the report but do NOT prevent startup.
|
|
1134
|
+
*
|
|
1135
|
+
* @returns Discovery report with per-adapter results
|
|
1136
|
+
*/
|
|
1137
|
+
discoverAndRegister(): Promise<DiscoveryReport>;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
//#endregion
|
|
1141
|
+
//#region packages/core/dist/adapters/claude-adapter.d.ts
|
|
1142
|
+
//# sourceMappingURL=adapter-registry.d.ts.map
|
|
1143
|
+
/**
|
|
1144
|
+
* Adapter for the Claude Code CLI agent.
|
|
1145
|
+
*
|
|
1146
|
+
* Capabilities: JSON output, streaming, both billing modes, plan generation.
|
|
1147
|
+
* Health check: runs `claude --version` to verify install.
|
|
1148
|
+
* Billing detection: detects subscription vs API via version output or env.
|
|
1149
|
+
*/
|
|
1150
|
+
declare class ClaudeCodeAdapter implements WorkerAdapter$1 {
|
|
1151
|
+
readonly id: AgentId$1;
|
|
1152
|
+
readonly displayName = "Claude Code";
|
|
1153
|
+
readonly adapterVersion = "1.0.0";
|
|
1154
|
+
private readonly _logger;
|
|
1155
|
+
constructor(logger?: ILogger);
|
|
1156
|
+
/**
|
|
1157
|
+
* Verify the `claude` binary is installed and responsive.
|
|
1158
|
+
* Detects subscription vs API billing mode.
|
|
1159
|
+
*/
|
|
1160
|
+
healthCheck(): Promise<AdapterHealthResult$1>;
|
|
1161
|
+
/**
|
|
1162
|
+
* Build spawn command for a coding task.
|
|
1163
|
+
* Uses: `claude -p --model <model> --dangerously-skip-permissions --system-prompt <minimal>`
|
|
1164
|
+
* Prompt is delivered via stdin (not CLI arg) to avoid E2BIG on large prompts.
|
|
1165
|
+
*/
|
|
1166
|
+
buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
|
|
1167
|
+
/**
|
|
1168
|
+
* Build spawn command for plan generation.
|
|
1169
|
+
*/
|
|
1170
|
+
buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
|
|
1171
|
+
/**
|
|
1172
|
+
* Parse Claude Code JSON output into a TaskResult.
|
|
1173
|
+
*/
|
|
1174
|
+
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
|
|
1175
|
+
/**
|
|
1176
|
+
* Parse Claude plan generation output.
|
|
1177
|
+
*/
|
|
1178
|
+
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
|
|
1179
|
+
/**
|
|
1180
|
+
* Estimate token count using character-based heuristic.
|
|
1181
|
+
*/
|
|
1182
|
+
estimateTokens(prompt: string): TokenEstimate$1;
|
|
1183
|
+
/**
|
|
1184
|
+
* Return Claude Code capabilities.
|
|
1185
|
+
*/
|
|
1186
|
+
getCapabilities(): AdapterCapabilities$1;
|
|
1187
|
+
private _detectBillingModes;
|
|
1188
|
+
private _buildPlanningPrompt;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region packages/core/dist/adapters/codex-adapter.d.ts
|
|
1193
|
+
//# sourceMappingURL=claude-adapter.d.ts.map
|
|
1194
|
+
/**
|
|
1195
|
+
* Adapter for the OpenAI Codex CLI agent.
|
|
1196
|
+
*
|
|
1197
|
+
* Codex CLI uses stdin for the prompt and outputs JSON when --json flag is used.
|
|
1198
|
+
* Codex supports subscription billing (via `codex login`) and API key billing.
|
|
1199
|
+
*/
|
|
1200
|
+
declare class CodexCLIAdapter implements WorkerAdapter$1 {
|
|
1201
|
+
readonly id: AgentId$1;
|
|
1202
|
+
readonly displayName = "Codex CLI";
|
|
1203
|
+
readonly adapterVersion = "1.0.0";
|
|
1204
|
+
private readonly _logger;
|
|
1205
|
+
constructor(logger?: ILogger);
|
|
1206
|
+
/**
|
|
1207
|
+
* Verify the `codex` binary is installed and responsive.
|
|
1208
|
+
*/
|
|
1209
|
+
healthCheck(): Promise<AdapterHealthResult$1>;
|
|
1210
|
+
/**
|
|
1211
|
+
* Build spawn command for a coding task.
|
|
1212
|
+
* Uses: `codex exec --json` with prompt delivered via stdin.
|
|
1213
|
+
*/
|
|
1214
|
+
buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
|
|
1215
|
+
/**
|
|
1216
|
+
* Build spawn command for plan generation.
|
|
1217
|
+
* Uses codex exec with a JSON plan generation prompt via stdin.
|
|
1218
|
+
*/
|
|
1219
|
+
buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
|
|
1220
|
+
/**
|
|
1221
|
+
* Parse Codex CLI JSON output into a TaskResult.
|
|
1222
|
+
*/
|
|
1223
|
+
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
|
|
1224
|
+
/**
|
|
1225
|
+
* Parse Codex plan generation output.
|
|
1226
|
+
*/
|
|
1227
|
+
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
|
|
1228
|
+
/**
|
|
1229
|
+
* Estimate token count using character-based heuristic.
|
|
1230
|
+
*/
|
|
1231
|
+
estimateTokens(prompt: string): TokenEstimate$1;
|
|
1232
|
+
/**
|
|
1233
|
+
* Return Codex CLI capabilities.
|
|
1234
|
+
*/
|
|
1235
|
+
getCapabilities(): AdapterCapabilities$1;
|
|
1236
|
+
private _buildPlanningPrompt;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
//#endregion
|
|
1240
|
+
//#region packages/core/dist/adapters/gemini-adapter.d.ts
|
|
1241
|
+
//# sourceMappingURL=codex-adapter.d.ts.map
|
|
1242
|
+
/**
|
|
1243
|
+
* Adapter for the Google Gemini CLI agent.
|
|
1244
|
+
*
|
|
1245
|
+
* Gemini CLI follows similar patterns to Claude Code: prompt via `-p` flag,
|
|
1246
|
+
* JSON output via `--output-format json`, and model via `--model`.
|
|
1247
|
+
*/
|
|
1248
|
+
declare class GeminiCLIAdapter implements WorkerAdapter$1 {
|
|
1249
|
+
readonly id: AgentId$1;
|
|
1250
|
+
readonly displayName = "Gemini CLI";
|
|
1251
|
+
readonly adapterVersion = "1.0.0";
|
|
1252
|
+
private readonly _logger;
|
|
1253
|
+
constructor(logger?: ILogger);
|
|
1254
|
+
/**
|
|
1255
|
+
* Verify the `gemini` binary is installed and responsive.
|
|
1256
|
+
* Detects subscription vs API billing mode.
|
|
1257
|
+
*/
|
|
1258
|
+
healthCheck(): Promise<AdapterHealthResult$1>;
|
|
1259
|
+
/**
|
|
1260
|
+
* Build spawn command for a coding task.
|
|
1261
|
+
* Uses: `gemini -p <prompt> --output-format json --model <model>`
|
|
1262
|
+
*/
|
|
1263
|
+
buildCommand(prompt: string, options: AdapterOptions$1): SpawnCommand$1;
|
|
1264
|
+
/**
|
|
1265
|
+
* Build spawn command for plan generation.
|
|
1266
|
+
*/
|
|
1267
|
+
buildPlanningCommand(request: PlanRequest$1, options: AdapterOptions$1): SpawnCommand$1;
|
|
1268
|
+
/**
|
|
1269
|
+
* Parse Gemini CLI JSON output into a TaskResult.
|
|
1270
|
+
*/
|
|
1271
|
+
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult$2;
|
|
1272
|
+
/**
|
|
1273
|
+
* Parse Gemini plan generation output.
|
|
1274
|
+
*/
|
|
1275
|
+
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult$1;
|
|
1276
|
+
/**
|
|
1277
|
+
* Estimate token count using character-based heuristic.
|
|
1278
|
+
*/
|
|
1279
|
+
estimateTokens(prompt: string): TokenEstimate$1;
|
|
1280
|
+
/**
|
|
1281
|
+
* Return Gemini CLI capabilities.
|
|
1282
|
+
*/
|
|
1283
|
+
getCapabilities(): AdapterCapabilities$1;
|
|
1284
|
+
private _detectBillingModes;
|
|
1285
|
+
private _buildPlanningPrompt;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
//#endregion
|
|
1289
|
+
//#region src/core/errors.d.ts
|
|
1290
|
+
//# sourceMappingURL=gemini-adapter.d.ts.map
|
|
642
1291
|
/** Error thrown when task configuration is invalid */
|
|
643
1292
|
declare class TaskConfigError extends AdtError {
|
|
644
1293
|
constructor(message: string, context?: Record<string, unknown>);
|
|
@@ -667,18 +1316,10 @@ declare class BudgetExceededError extends AdtError {
|
|
|
667
1316
|
declare class GitError extends AdtError {
|
|
668
1317
|
constructor(message: string, context?: Record<string, unknown>);
|
|
669
1318
|
}
|
|
670
|
-
/** Error thrown when configuration is invalid or missing */
|
|
671
|
-
declare class ConfigError extends AdtError {
|
|
672
|
-
constructor(message: string, context?: Record<string, unknown>);
|
|
673
|
-
}
|
|
674
1319
|
/** Error thrown when state recovery fails */
|
|
675
1320
|
declare class RecoveryError extends AdtError {
|
|
676
1321
|
constructor(message: string, context?: Record<string, unknown>);
|
|
677
1322
|
}
|
|
678
|
-
/** Error thrown when a config file uses an incompatible format version */
|
|
679
|
-
declare class ConfigIncompatibleFormatError extends AdtError {
|
|
680
|
-
constructor(message: string, context?: Record<string, unknown>);
|
|
681
|
-
}
|
|
682
1323
|
/** Error thrown when a task graph file uses an incompatible format version */
|
|
683
1324
|
declare class TaskGraphIncompatibleFormatError extends AdtError {
|
|
684
1325
|
constructor(message: string, context?: Record<string, unknown>);
|
|
@@ -754,7 +1395,6 @@ declare function withRetry<T>(fn: () => Promise<T>, maxRetries?: number, baseDel
|
|
|
754
1395
|
//#endregion
|
|
755
1396
|
//#region src/modules/config/config-schema.d.ts
|
|
756
1397
|
//# sourceMappingURL=helpers.d.ts.map
|
|
757
|
-
|
|
758
1398
|
declare const SubstrateConfigSchema: z.ZodObject<{
|
|
759
1399
|
config_format_version: z.ZodEnum<{
|
|
760
1400
|
1: "1";
|
|
@@ -764,12 +1404,12 @@ declare const SubstrateConfigSchema: z.ZodObject<{
|
|
|
764
1404
|
}>>;
|
|
765
1405
|
global: z.ZodObject<{
|
|
766
1406
|
log_level: z.ZodEnum<{
|
|
767
|
-
fatal: "fatal";
|
|
768
|
-
error: "error";
|
|
769
|
-
warn: "warn";
|
|
770
|
-
info: "info";
|
|
771
|
-
debug: "debug";
|
|
772
1407
|
trace: "trace";
|
|
1408
|
+
debug: "debug";
|
|
1409
|
+
info: "info";
|
|
1410
|
+
warn: "warn";
|
|
1411
|
+
error: "error";
|
|
1412
|
+
fatal: "fatal";
|
|
773
1413
|
}>;
|
|
774
1414
|
max_concurrent_tasks: z.ZodNumber;
|
|
775
1415
|
budget_cap_tokens: z.ZodNumber;
|
|
@@ -782,9 +1422,9 @@ declare const SubstrateConfigSchema: z.ZodObject<{
|
|
|
782
1422
|
enabled: z.ZodBoolean;
|
|
783
1423
|
cli_path: z.ZodOptional<z.ZodString>;
|
|
784
1424
|
subscription_routing: z.ZodEnum<{
|
|
785
|
-
auto: "auto";
|
|
786
1425
|
subscription: "subscription";
|
|
787
1426
|
api: "api";
|
|
1427
|
+
auto: "auto";
|
|
788
1428
|
disabled: "disabled";
|
|
789
1429
|
}>;
|
|
790
1430
|
max_concurrent: z.ZodNumber;
|
|
@@ -799,9 +1439,9 @@ declare const SubstrateConfigSchema: z.ZodObject<{
|
|
|
799
1439
|
enabled: z.ZodBoolean;
|
|
800
1440
|
cli_path: z.ZodOptional<z.ZodString>;
|
|
801
1441
|
subscription_routing: z.ZodEnum<{
|
|
802
|
-
auto: "auto";
|
|
803
1442
|
subscription: "subscription";
|
|
804
1443
|
api: "api";
|
|
1444
|
+
auto: "auto";
|
|
805
1445
|
disabled: "disabled";
|
|
806
1446
|
}>;
|
|
807
1447
|
max_concurrent: z.ZodNumber;
|
|
@@ -816,9 +1456,9 @@ declare const SubstrateConfigSchema: z.ZodObject<{
|
|
|
816
1456
|
enabled: z.ZodBoolean;
|
|
817
1457
|
cli_path: z.ZodOptional<z.ZodString>;
|
|
818
1458
|
subscription_routing: z.ZodEnum<{
|
|
819
|
-
auto: "auto";
|
|
820
1459
|
subscription: "subscription";
|
|
821
1460
|
api: "api";
|
|
1461
|
+
auto: "auto";
|
|
822
1462
|
disabled: "disabled";
|
|
823
1463
|
}>;
|
|
824
1464
|
max_concurrent: z.ZodNumber;
|
|
@@ -1417,28 +2057,19 @@ interface OrchestratorEvents {
|
|
|
1417
2057
|
//#region src/core/event-bus.d.ts
|
|
1418
2058
|
//# sourceMappingURL=event-bus.types.d.ts.map
|
|
1419
2059
|
/**
|
|
1420
|
-
*
|
|
2060
|
+
* Backward-compatible type alias: TypedEventBus specialized to OrchestratorEvents.
|
|
1421
2061
|
*
|
|
1422
|
-
*
|
|
2062
|
+
* Existing monolith code declares `let bus: TypedEventBus` (non-generic).
|
|
2063
|
+
* This alias ensures those declarations continue to enforce OrchestratorEvents
|
|
2064
|
+
* handler types rather than defaulting to Record<string, unknown>.
|
|
1423
2065
|
*/
|
|
1424
|
-
|
|
1425
|
-
/**
|
|
1426
|
-
* Emit an event with a strongly-typed payload.
|
|
1427
|
-
* Dispatch is synchronous — all registered handlers run before emit() returns.
|
|
1428
|
-
*/
|
|
1429
|
-
emit<K extends keyof OrchestratorEvents>(event: K, payload: OrchestratorEvents[K]): void;
|
|
1430
|
-
/**
|
|
1431
|
-
* Subscribe to an event. The handler is called synchronously on each emit.
|
|
1432
|
-
*/
|
|
1433
|
-
on<K extends keyof OrchestratorEvents>(event: K, handler: (payload: OrchestratorEvents[K]) => void): void;
|
|
1434
|
-
/**
|
|
1435
|
-
* Unsubscribe a previously registered handler.
|
|
1436
|
-
* If the handler was not registered, this is a no-op.
|
|
1437
|
-
*/
|
|
1438
|
-
off<K extends keyof OrchestratorEvents>(event: K, handler: (payload: OrchestratorEvents[K]) => void): void;
|
|
1439
|
-
}
|
|
2066
|
+
type TypedEventBus = TypedEventBus$1<OrchestratorEvents>;
|
|
1440
2067
|
/**
|
|
1441
|
-
* Concrete implementation
|
|
2068
|
+
* Concrete implementation specialized to OrchestratorEvents.
|
|
2069
|
+
*
|
|
2070
|
+
* Sub-classing the generic impl preserves the non-generic surface that
|
|
2071
|
+
* existing tests and callers rely on:
|
|
2072
|
+
* bus = new TypedEventBusImpl() // no type param needed
|
|
1442
2073
|
*
|
|
1443
2074
|
* @example
|
|
1444
2075
|
* const bus = new TypedEventBusImpl()
|
|
@@ -1449,7 +2080,7 @@ interface TypedEventBus {
|
|
|
1449
2080
|
*/
|
|
1450
2081
|
|
|
1451
2082
|
/**
|
|
1452
|
-
* Create a new TypedEventBus instance.
|
|
2083
|
+
* Create a new TypedEventBus instance specialized to OrchestratorEvents.
|
|
1453
2084
|
*
|
|
1454
2085
|
* @example
|
|
1455
2086
|
* const bus = createEventBus()
|
|
@@ -1846,221 +2477,9 @@ interface WorkerAdapter {
|
|
|
1846
2477
|
getCapabilities(): AdapterCapabilities;
|
|
1847
2478
|
}
|
|
1848
2479
|
|
|
1849
|
-
//#endregion
|
|
1850
|
-
//#region src/adapters/adapter-registry.d.ts
|
|
1851
|
-
//# sourceMappingURL=worker-adapter.d.ts.map
|
|
1852
|
-
/**
|
|
1853
|
-
* Result from a single adapter discovery attempt.
|
|
1854
|
-
*/
|
|
1855
|
-
interface AdapterDiscoveryResult {
|
|
1856
|
-
/** Adapter id that was tried */
|
|
1857
|
-
adapterId: AgentId;
|
|
1858
|
-
/** Display name of the adapter */
|
|
1859
|
-
displayName: string;
|
|
1860
|
-
/** Health check result */
|
|
1861
|
-
healthResult: AdapterHealthResult;
|
|
1862
|
-
/** Whether the adapter was registered (healthy) */
|
|
1863
|
-
registered: boolean;
|
|
1864
|
-
}
|
|
1865
|
-
/**
|
|
1866
|
-
* Summary result from discoverAndRegister().
|
|
1867
|
-
*/
|
|
1868
|
-
interface DiscoveryReport {
|
|
1869
|
-
/** Number of adapters successfully registered */
|
|
1870
|
-
registeredCount: number;
|
|
1871
|
-
/** Number of adapters that failed health checks */
|
|
1872
|
-
failedCount: number;
|
|
1873
|
-
/** Per-adapter detail results */
|
|
1874
|
-
results: AdapterDiscoveryResult[];
|
|
1875
|
-
}
|
|
1876
|
-
/**
|
|
1877
|
-
* AdapterRegistry manages the lifecycle of WorkerAdapter instances.
|
|
1878
|
-
*
|
|
1879
|
-
* Usage:
|
|
1880
|
-
* ```typescript
|
|
1881
|
-
* const registry = new AdapterRegistry()
|
|
1882
|
-
* const report = await registry.discoverAndRegister()
|
|
1883
|
-
* const claude = registry.get('claude-code')
|
|
1884
|
-
* ```
|
|
1885
|
-
*/
|
|
1886
|
-
declare class AdapterRegistry {
|
|
1887
|
-
private readonly _adapters;
|
|
1888
|
-
/**
|
|
1889
|
-
* Register an adapter by its id.
|
|
1890
|
-
* Overwrites any existing adapter with the same id.
|
|
1891
|
-
*/
|
|
1892
|
-
register(adapter: WorkerAdapter): void;
|
|
1893
|
-
/**
|
|
1894
|
-
* Retrieve a registered adapter by id.
|
|
1895
|
-
* @returns The adapter, or undefined if not registered
|
|
1896
|
-
*/
|
|
1897
|
-
get(id: AgentId): WorkerAdapter | undefined;
|
|
1898
|
-
/**
|
|
1899
|
-
* Return all registered adapters as an array.
|
|
1900
|
-
*/
|
|
1901
|
-
getAll(): WorkerAdapter[];
|
|
1902
|
-
/**
|
|
1903
|
-
* Return all registered adapters that support plan generation.
|
|
1904
|
-
*/
|
|
1905
|
-
getPlanningCapable(): WorkerAdapter[];
|
|
1906
|
-
/**
|
|
1907
|
-
* Instantiate all built-in adapters, run health checks sequentially,
|
|
1908
|
-
* and register those that pass.
|
|
1909
|
-
*
|
|
1910
|
-
* Failed adapters are included in the report but do NOT prevent startup.
|
|
1911
|
-
*
|
|
1912
|
-
* @returns Discovery report with per-adapter results
|
|
1913
|
-
*/
|
|
1914
|
-
discoverAndRegister(): Promise<DiscoveryReport>;
|
|
1915
|
-
}
|
|
1916
|
-
|
|
1917
|
-
//#endregion
|
|
1918
|
-
//#region src/adapters/claude-adapter.d.ts
|
|
1919
|
-
//# sourceMappingURL=adapter-registry.d.ts.map
|
|
1920
|
-
/**
|
|
1921
|
-
* Adapter for the Claude Code CLI agent.
|
|
1922
|
-
*
|
|
1923
|
-
* Capabilities: JSON output, streaming, both billing modes, plan generation.
|
|
1924
|
-
* Health check: runs `claude --version` to verify install.
|
|
1925
|
-
* Billing detection: detects subscription vs API via version output or env.
|
|
1926
|
-
*/
|
|
1927
|
-
declare class ClaudeCodeAdapter implements WorkerAdapter {
|
|
1928
|
-
readonly id: AgentId;
|
|
1929
|
-
readonly displayName = "Claude Code";
|
|
1930
|
-
readonly adapterVersion = "1.0.0";
|
|
1931
|
-
/**
|
|
1932
|
-
* Verify the `claude` binary is installed and responsive.
|
|
1933
|
-
* Detects subscription vs API billing mode.
|
|
1934
|
-
*/
|
|
1935
|
-
healthCheck(): Promise<AdapterHealthResult>;
|
|
1936
|
-
/**
|
|
1937
|
-
* Build spawn command for a coding task.
|
|
1938
|
-
* Uses: `claude -p --model <model> --dangerously-skip-permissions --system-prompt <minimal>`
|
|
1939
|
-
* Prompt is delivered via stdin (not CLI arg) to avoid E2BIG on large prompts.
|
|
1940
|
-
*/
|
|
1941
|
-
buildCommand(prompt: string, options: AdapterOptions): SpawnCommand;
|
|
1942
|
-
/**
|
|
1943
|
-
* Build spawn command for plan generation.
|
|
1944
|
-
* Appends a structured planning directive to the prompt.
|
|
1945
|
-
*/
|
|
1946
|
-
buildPlanningCommand(request: PlanRequest, options: AdapterOptions): SpawnCommand;
|
|
1947
|
-
/**
|
|
1948
|
-
* Parse Claude CLI JSON stdout output into TaskResult.
|
|
1949
|
-
*/
|
|
1950
|
-
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult;
|
|
1951
|
-
/**
|
|
1952
|
-
* Parse plan generation output from Claude.
|
|
1953
|
-
*/
|
|
1954
|
-
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult;
|
|
1955
|
-
/**
|
|
1956
|
-
* Estimate token count using character-based heuristic.
|
|
1957
|
-
* Approximation: 1 token ≈ 3 characters for English text.
|
|
1958
|
-
*/
|
|
1959
|
-
estimateTokens(prompt: string): TokenEstimate;
|
|
1960
|
-
/**
|
|
1961
|
-
* Return Claude Code's capabilities.
|
|
1962
|
-
*/
|
|
1963
|
-
getCapabilities(): AdapterCapabilities;
|
|
1964
|
-
private _detectBillingModes;
|
|
1965
|
-
private _buildPlanningPrompt;
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
//#endregion
|
|
1969
|
-
//#region src/adapters/codex-adapter.d.ts
|
|
1970
|
-
//# sourceMappingURL=claude-adapter.d.ts.map
|
|
1971
|
-
/**
|
|
1972
|
-
* Adapter for the OpenAI Codex CLI agent.
|
|
1973
|
-
*
|
|
1974
|
-
* Codex CLI uses stdin for the prompt and outputs JSON when --json flag is used.
|
|
1975
|
-
* Codex supports subscription billing (via `codex login`) and API key billing.
|
|
1976
|
-
*/
|
|
1977
|
-
declare class CodexCLIAdapter implements WorkerAdapter {
|
|
1978
|
-
readonly id: AgentId;
|
|
1979
|
-
readonly displayName = "Codex CLI";
|
|
1980
|
-
readonly adapterVersion = "1.0.0";
|
|
1981
|
-
/**
|
|
1982
|
-
* Verify the `codex` binary is installed and responsive.
|
|
1983
|
-
*/
|
|
1984
|
-
healthCheck(): Promise<AdapterHealthResult>;
|
|
1985
|
-
/**
|
|
1986
|
-
* Build spawn command for a coding task.
|
|
1987
|
-
* Uses: `codex exec --json` with prompt delivered via stdin.
|
|
1988
|
-
*/
|
|
1989
|
-
buildCommand(prompt: string, options: AdapterOptions): SpawnCommand;
|
|
1990
|
-
/**
|
|
1991
|
-
* Build spawn command for plan generation.
|
|
1992
|
-
* Uses codex exec with a JSON plan generation prompt via stdin.
|
|
1993
|
-
*/
|
|
1994
|
-
buildPlanningCommand(request: PlanRequest, options: AdapterOptions): SpawnCommand;
|
|
1995
|
-
/**
|
|
1996
|
-
* Parse Codex CLI JSON output into a TaskResult.
|
|
1997
|
-
*/
|
|
1998
|
-
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult;
|
|
1999
|
-
/**
|
|
2000
|
-
* Parse Codex plan generation output.
|
|
2001
|
-
*/
|
|
2002
|
-
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult;
|
|
2003
|
-
/**
|
|
2004
|
-
* Estimate token count using character-based heuristic.
|
|
2005
|
-
*/
|
|
2006
|
-
estimateTokens(prompt: string): TokenEstimate;
|
|
2007
|
-
/**
|
|
2008
|
-
* Return Codex CLI capabilities.
|
|
2009
|
-
*/
|
|
2010
|
-
getCapabilities(): AdapterCapabilities;
|
|
2011
|
-
private _buildPlanningPrompt;
|
|
2012
|
-
}
|
|
2013
|
-
|
|
2014
|
-
//#endregion
|
|
2015
|
-
//#region src/adapters/gemini-adapter.d.ts
|
|
2016
|
-
//# sourceMappingURL=codex-adapter.d.ts.map
|
|
2017
|
-
/**
|
|
2018
|
-
* Adapter for the Google Gemini CLI agent.
|
|
2019
|
-
*
|
|
2020
|
-
* Gemini CLI follows similar patterns to Claude Code: prompt via `-p` flag,
|
|
2021
|
-
* JSON output via `--output-format json`, and model via `--model`.
|
|
2022
|
-
*/
|
|
2023
|
-
declare class GeminiCLIAdapter implements WorkerAdapter {
|
|
2024
|
-
readonly id: AgentId;
|
|
2025
|
-
readonly displayName = "Gemini CLI";
|
|
2026
|
-
readonly adapterVersion = "1.0.0";
|
|
2027
|
-
/**
|
|
2028
|
-
* Verify the `gemini` binary is installed and responsive.
|
|
2029
|
-
* Detects subscription vs API billing mode.
|
|
2030
|
-
*/
|
|
2031
|
-
healthCheck(): Promise<AdapterHealthResult>;
|
|
2032
|
-
/**
|
|
2033
|
-
* Build spawn command for a coding task.
|
|
2034
|
-
* Uses: `gemini -p <prompt> --output-format json --model <model>`
|
|
2035
|
-
*/
|
|
2036
|
-
buildCommand(prompt: string, options: AdapterOptions): SpawnCommand;
|
|
2037
|
-
/**
|
|
2038
|
-
* Build spawn command for plan generation.
|
|
2039
|
-
*/
|
|
2040
|
-
buildPlanningCommand(request: PlanRequest, options: AdapterOptions): SpawnCommand;
|
|
2041
|
-
/**
|
|
2042
|
-
* Parse Gemini CLI JSON output into a TaskResult.
|
|
2043
|
-
*/
|
|
2044
|
-
parseOutput(stdout: string, stderr: string, exitCode: number): TaskResult;
|
|
2045
|
-
/**
|
|
2046
|
-
* Parse Gemini plan generation output.
|
|
2047
|
-
*/
|
|
2048
|
-
parsePlanOutput(stdout: string, stderr: string, exitCode: number): PlanParseResult;
|
|
2049
|
-
/**
|
|
2050
|
-
* Estimate token count using character-based heuristic.
|
|
2051
|
-
*/
|
|
2052
|
-
estimateTokens(prompt: string): TokenEstimate;
|
|
2053
|
-
/**
|
|
2054
|
-
* Return Gemini CLI capabilities.
|
|
2055
|
-
*/
|
|
2056
|
-
getCapabilities(): AdapterCapabilities;
|
|
2057
|
-
private _detectBillingModes;
|
|
2058
|
-
private _buildPlanningPrompt;
|
|
2059
|
-
}
|
|
2060
|
-
|
|
2061
2480
|
//#endregion
|
|
2062
2481
|
//#region src/tui/app.d.ts
|
|
2063
|
-
//# sourceMappingURL=
|
|
2482
|
+
//# sourceMappingURL=worker-adapter.d.ts.map
|
|
2064
2483
|
/**
|
|
2065
2484
|
* Public interface for the TUI application.
|
|
2066
2485
|
*/
|