@ordewell/core 0.4.0 → 0.4.1

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/index.d.mts CHANGED
@@ -762,29 +762,33 @@ declare class HeadlessSession extends AbstractTerminalSession {
762
762
  private process;
763
763
  private outputBuffer;
764
764
  constructor(id: string, taskId: string, spawnImpl: SpawnFn);
765
+ get isStarted(): boolean;
765
766
  start(launch: LaunchPlan, cwd: string, resolvedPath: string, env?: Record<string, string>): void;
766
767
  kill(): void;
767
768
  getOutput(): string;
768
769
  write(text: string): void;
769
770
  }
771
+ type RunnerSpawnOptions = Parameters<ITerminalRunner['spawn']>[0];
772
+ /** Everything needed to start one runner process, resolved before any child exists. */
773
+ interface PreparedLaunch {
774
+ launch: LaunchPlan;
775
+ resolvedPath: string;
776
+ env: Record<string, string>;
777
+ /** True when the invocation was wrapped in `script` to allocate a PTY. */
778
+ pty: boolean;
779
+ }
770
780
  declare class HeadlessRunner extends AbstractRunner<HeadlessSession> {
771
781
  private spawnImpl;
772
782
  private hasScriptCmd;
773
783
  private resolvePath;
774
784
  private launchDeps;
785
+ /** Session shape when the caller names none; the VS Code runner overrides it to interactive. */
786
+ protected readonly defaultHeadless: boolean;
775
787
  constructor(deps?: HeadlessRunnerDeps);
776
- spawn(opts: {
777
- taskId: string;
778
- runner: string;
779
- prompt: string;
780
- modelId?: string;
781
- thinkingEffort?: string;
782
- modelVariants?: string[];
783
- mode?: string;
784
- headless?: boolean;
785
- cwd: string;
786
- registry?: RunnerRegistry;
787
- }): Promise<ITerminalSession>;
788
+ protected createSession(id: string, taskId: string): HeadlessSession;
789
+ /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
790
+ protected prepareLaunch(opts: RunnerSpawnOptions): Promise<PreparedLaunch>;
791
+ spawn(opts: RunnerSpawnOptions): Promise<ITerminalSession>;
788
792
  }
789
793
 
790
794
  /**
@@ -2698,6 +2702,30 @@ declare function buildRunnerInvocation(opts: {
2698
2702
  registry: RunnerRegistry;
2699
2703
  }): RunnerInvocation;
2700
2704
 
2705
+ interface PriorOutput {
2706
+ order: number;
2707
+ title: string;
2708
+ reviewReason: string;
2709
+ logTail: string;
2710
+ }
2711
+ declare function summarizeOutput(reviewReason: string | undefined, output: string): {
2712
+ reviewReason: string;
2713
+ logTail: string;
2714
+ capturedAt: string;
2715
+ };
2716
+ declare function collectDirectDependencyOutputs(task: Task, allTasks: Task[]): PriorOutput[];
2717
+ declare function renderPriorOutputs(outputs: PriorOutput[]): string;
2718
+ declare function augmentPromptWithPriorOutputs(task: Task, allTasks: Task[]): string;
2719
+ declare function renderPlanMap(allTasks: Task[], currentTaskId: string, opts?: {
2720
+ maxEntries?: number;
2721
+ }): string;
2722
+ interface ComposeOptions {
2723
+ planMapEnabled?: boolean;
2724
+ planMapMaxEntries?: number;
2725
+ tddEnabled?: boolean;
2726
+ }
2727
+ declare function composeAugmentedPrompt(task: Task, allTasks: Task[], opts?: ComposeOptions): string;
2728
+
2701
2729
  type ExecFileFn = (command: string, args: string[]) => Promise<{
2702
2730
  stdout: string;
2703
2731
  stderr: string;
@@ -2987,4 +3015,4 @@ declare function sanitizeSlug(raw: string): string;
2987
3015
  /** Save the PRD to `<workspace>/.scratch/<slug>/PRD.md` (to-prd native convention). */
2988
3016
  declare function savePrdMarkdown(workspace: string, slug: string, markdown: string): string;
2989
3017
 
2990
- export { ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DiscoveredModel, EmbeddedNewlineError, EnvConfig, type ExecFileFn, type ExecImpl, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, HeadlessRunner, type HeadlessRunnerDeps, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerReplyClassification, type PlannerRuntimeToggles, type PrdBlock, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, STATE_DIR, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, applyHeadLimit, augmentedPath, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, clearAugmentedPathCache, clearResearchShellCache, clearState, coerceAssignments, configuredProviders, createAiService, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, executionLogBlock, executionSummary, extractPrdBlock, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isOpenAiProvider, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, referencePattern, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
3018
+ export { ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, type ComposeOptions, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DiscoveredModel, EmbeddedNewlineError, EnvConfig, type ExecFileFn, type ExecImpl, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, HeadlessRunner, type HeadlessRunnerDeps, HeadlessSession, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerReplyClassification, type PlannerRuntimeToggles, type PrdBlock, type PreparedLaunch, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, type RunnerSpawnOptions, STATE_DIR, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, applyHeadLimit, augmentPromptWithPriorOutputs, augmentedPath, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, clearAugmentedPathCache, clearResearchShellCache, clearState, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, configuredProviders, createAiService, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, executionLogBlock, executionSummary, extractPrdBlock, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isOpenAiProvider, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, referencePattern, renderPlanMap, renderPriorOutputs, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, summarizeOutput, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
package/dist/index.d.ts CHANGED
@@ -762,29 +762,33 @@ declare class HeadlessSession extends AbstractTerminalSession {
762
762
  private process;
763
763
  private outputBuffer;
764
764
  constructor(id: string, taskId: string, spawnImpl: SpawnFn);
765
+ get isStarted(): boolean;
765
766
  start(launch: LaunchPlan, cwd: string, resolvedPath: string, env?: Record<string, string>): void;
766
767
  kill(): void;
767
768
  getOutput(): string;
768
769
  write(text: string): void;
769
770
  }
771
+ type RunnerSpawnOptions = Parameters<ITerminalRunner['spawn']>[0];
772
+ /** Everything needed to start one runner process, resolved before any child exists. */
773
+ interface PreparedLaunch {
774
+ launch: LaunchPlan;
775
+ resolvedPath: string;
776
+ env: Record<string, string>;
777
+ /** True when the invocation was wrapped in `script` to allocate a PTY. */
778
+ pty: boolean;
779
+ }
770
780
  declare class HeadlessRunner extends AbstractRunner<HeadlessSession> {
771
781
  private spawnImpl;
772
782
  private hasScriptCmd;
773
783
  private resolvePath;
774
784
  private launchDeps;
785
+ /** Session shape when the caller names none; the VS Code runner overrides it to interactive. */
786
+ protected readonly defaultHeadless: boolean;
775
787
  constructor(deps?: HeadlessRunnerDeps);
776
- spawn(opts: {
777
- taskId: string;
778
- runner: string;
779
- prompt: string;
780
- modelId?: string;
781
- thinkingEffort?: string;
782
- modelVariants?: string[];
783
- mode?: string;
784
- headless?: boolean;
785
- cwd: string;
786
- registry?: RunnerRegistry;
787
- }): Promise<ITerminalSession>;
788
+ protected createSession(id: string, taskId: string): HeadlessSession;
789
+ /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
790
+ protected prepareLaunch(opts: RunnerSpawnOptions): Promise<PreparedLaunch>;
791
+ spawn(opts: RunnerSpawnOptions): Promise<ITerminalSession>;
788
792
  }
789
793
 
790
794
  /**
@@ -2698,6 +2702,30 @@ declare function buildRunnerInvocation(opts: {
2698
2702
  registry: RunnerRegistry;
2699
2703
  }): RunnerInvocation;
2700
2704
 
2705
+ interface PriorOutput {
2706
+ order: number;
2707
+ title: string;
2708
+ reviewReason: string;
2709
+ logTail: string;
2710
+ }
2711
+ declare function summarizeOutput(reviewReason: string | undefined, output: string): {
2712
+ reviewReason: string;
2713
+ logTail: string;
2714
+ capturedAt: string;
2715
+ };
2716
+ declare function collectDirectDependencyOutputs(task: Task, allTasks: Task[]): PriorOutput[];
2717
+ declare function renderPriorOutputs(outputs: PriorOutput[]): string;
2718
+ declare function augmentPromptWithPriorOutputs(task: Task, allTasks: Task[]): string;
2719
+ declare function renderPlanMap(allTasks: Task[], currentTaskId: string, opts?: {
2720
+ maxEntries?: number;
2721
+ }): string;
2722
+ interface ComposeOptions {
2723
+ planMapEnabled?: boolean;
2724
+ planMapMaxEntries?: number;
2725
+ tddEnabled?: boolean;
2726
+ }
2727
+ declare function composeAugmentedPrompt(task: Task, allTasks: Task[], opts?: ComposeOptions): string;
2728
+
2701
2729
  type ExecFileFn = (command: string, args: string[]) => Promise<{
2702
2730
  stdout: string;
2703
2731
  stderr: string;
@@ -2987,4 +3015,4 @@ declare function sanitizeSlug(raw: string): string;
2987
3015
  /** Save the PRD to `<workspace>/.scratch/<slug>/PRD.md` (to-prd native convention). */
2988
3016
  declare function savePrdMarkdown(workspace: string, slug: string, markdown: string): string;
2989
3017
 
2990
- export { ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DiscoveredModel, EmbeddedNewlineError, EnvConfig, type ExecFileFn, type ExecImpl, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, HeadlessRunner, type HeadlessRunnerDeps, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerReplyClassification, type PlannerRuntimeToggles, type PrdBlock, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, STATE_DIR, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, applyHeadLimit, augmentedPath, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, clearAugmentedPathCache, clearResearchShellCache, clearState, coerceAssignments, configuredProviders, createAiService, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, executionLogBlock, executionSummary, extractPrdBlock, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isOpenAiProvider, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, referencePattern, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
3018
+ export { ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AgentAdapter, type AgentAdapterFactory, type AgentEvent, type AgentProcessDeps, type AgentStartOptions, AiProvider, ApprovalKind, ApprovalMode, ApprovalRequest, ApprovalSource, BaseAiService, BaseConfig, BaseFileSystem, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CMD_EXE_MAX_COMMAND_LINE, CORE_PLANNER_PROMPT, type CappedRows, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, CommandLineTooLongError, type CommandTier, type ComposeOptions, ConsoleLogger, ContextCollector, ConversationMessage, type ConversationRequest, type ConversationTurn, DiscoveredModel, EmbeddedNewlineError, EnvConfig, type ExecFileFn, type ExecImpl, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GeminiService, GlobOptions, type GrepInvocation, GrepOptions, HeadlessRunner, type HeadlessRunnerDeps, HeadlessSession, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, type LaunchDeps, type LaunchPlan, LegacyPlanState, LineBuffer, type MappedTool, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerReplyClassification, type PlannerRuntimeToggles, type PrdBlock, type PreparedLaunch, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, REFUSED_COMMANDS, ReadFileOpts, type RepairLoopOpts, type RepairVerdict, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchStep, ResearchToolType, type ResearchTurn, ResolveContext, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, type RunnerSpawnOptions, STATE_DIR, SYMBOL_LANGUAGES, type SerializedPlan, type SerializedTask, type SerializedTaskStatus, Session, type SessionBroadcaster, type SessionData, type SessionDeps, type SessionMessage, type SessionMeta, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SpawnSpec, StdioAgentAdapter, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, TaskOp, TaskOrchestrator, TaskSnapshot, TmuxRunner, type TmuxRunnerDeps, type ToolCall, ToolOutcome, type ToolResult, type UserSettings, Verdict, VerdictEngine, type VerdictListener, WINDOWS_MAX_COMMAND_LINE, applyHeadLimit, augmentPromptWithPriorOutputs, augmentedPath, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildShellInvocation, buildSplitPrompt, buildSubagentSystemPrompt, clampThinkingEffort, classifyCommand, classifyPlannerReply, clearAugmentedPathCache, clearResearchShellCache, clearState, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, configuredProviders, createAiService, defaultLogger, definitionPattern, deleteSession, discoverGeminiModels, effectiveAllowlist, ensureDir, executionLogBlock, executionSummary, extractPrdBlock, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, grantScopeFor, hasTmux, includeGlobFor, isCliProvider, isOpenAiProvider, killTree, languageForId, listSessions, loadSession, loadSessionPlanState, loadState, mapAgentTool, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, pendingEditRulesBlock, planDirectLaunch, planShellLaunch, posixShellQuote, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, referencePattern, renderPlanMap, renderPriorOutputs, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolveProviderFromPrefix, resolveResearchShell, resolveWithin, retargetTaskRunner, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, serializePlan, serializeTask, serializeTaskStatus, sessionRuntimeSettings, stateExists, stripAnsi, stripModelPrefix, summarizeOutput, taskOpsRejectedPrompt, tmuxSessionName, tmuxSocketName, tmuxWindowName, truncatedPlanReEmitPrompt, wellKnownBinDirs, windowsCommandLine, withPath, wrapWithPty };
package/dist/index.js CHANGED
@@ -56,6 +56,7 @@ __export(index_exports, {
56
56
  GREP_DEFAULT_HEAD_LIMIT: () => GREP_DEFAULT_HEAD_LIMIT,
57
57
  GeminiService: () => GeminiService,
58
58
  HeadlessRunner: () => HeadlessRunner,
59
+ HeadlessSession: () => HeadlessSession,
59
60
  JSON_REPAIR_INSTRUCTION: () => JSON_REPAIR_INSTRUCTION,
60
61
  LineBuffer: () => LineBuffer,
61
62
  ModelCatalog: () => ModelCatalog,
@@ -91,6 +92,7 @@ __export(index_exports, {
91
92
  addTaskToPlan: () => addTaskToPlan,
92
93
  applyHeadLimit: () => applyHeadLimit,
93
94
  applyTaskOps: () => applyTaskOps,
95
+ augmentPromptWithPriorOutputs: () => augmentPromptWithPriorOutputs,
94
96
  augmentedPath: () => augmentedPath,
95
97
  buildConversationSystemPrompt: () => buildConversationSystemPrompt,
96
98
  buildFallbackGrepArgs: () => buildFallbackGrepArgs,
@@ -123,7 +125,9 @@ __export(index_exports, {
123
125
  clearResearchShellCache: () => clearResearchShellCache,
124
126
  clearState: () => clearState,
125
127
  coerceAssignments: () => coerceAssignments,
128
+ collectDirectDependencyOutputs: () => collectDirectDependencyOutputs,
126
129
  collectProviderCredentials: () => collectProviderCredentials,
130
+ composeAugmentedPrompt: () => composeAugmentedPrompt,
127
131
  configuredProviders: () => configuredProviders,
128
132
  createAiService: () => createAiService,
129
133
  createEmptyPlan: () => createEmptyPlan,
@@ -190,6 +194,8 @@ __export(index_exports, {
190
194
  reEmitTaskOpsPrompt: () => reEmitTaskOpsPrompt,
191
195
  referencePattern: () => referencePattern,
192
196
  removeTaskFromPlan: () => removeTaskFromPlan,
197
+ renderPlanMap: () => renderPlanMap,
198
+ renderPriorOutputs: () => renderPriorOutputs,
193
199
  renumberTasks: () => renumberTasks,
194
200
  repairLoop: () => repairLoop,
195
201
  researchShellWarning: () => researchShellWarning,
@@ -219,6 +225,7 @@ __export(index_exports, {
219
225
  stripModelNoise: () => stripModelNoise,
220
226
  stripModelPrefix: () => stripModelPrefix,
221
227
  stripTrailingCommas: () => stripTrailingCommas,
228
+ summarizeOutput: () => summarizeOutput,
222
229
  summarizeToolCall: () => summarizeToolCall,
223
230
  taskOpsRejectedPrompt: () => taskOpsRejectedPrompt,
224
231
  textHasTaskOps: () => textHasTaskOps,
@@ -5599,6 +5606,14 @@ ${tail}`;
5599
5606
 
5600
5607
  ${blocks.join("\n\n")}`;
5601
5608
  }
5609
+ function augmentPromptWithPriorOutputs(task, allTasks) {
5610
+ const basePrompt = task.prompt ?? "";
5611
+ const outputs = collectDirectDependencyOutputs(task, allTasks);
5612
+ if (outputs.length === 0) return basePrompt;
5613
+ return `${renderPriorOutputs(outputs)}
5614
+
5615
+ ${basePrompt}`;
5616
+ }
5602
5617
  function planMapStatus(task, isCurrent) {
5603
5618
  if (isCurrent) return "NOW";
5604
5619
  if (task.status === "completed") return "done";
@@ -11641,7 +11656,11 @@ var HeadlessSession = class extends AbstractTerminalSession {
11641
11656
  spawnImpl;
11642
11657
  process = null;
11643
11658
  outputBuffer = "";
11659
+ get isStarted() {
11660
+ return this.process !== null;
11661
+ }
11644
11662
  start(launch, cwd, resolvedPath, env) {
11663
+ if (this.exited || this.process) return;
11645
11664
  this.process = this.spawnImpl(launch.file, launch.args, {
11646
11665
  env: withPath(process.env, resolvedPath, env),
11647
11666
  stdio: ["pipe", "pipe", "pipe"],
@@ -11670,6 +11689,7 @@ Process error: ${err.message}
11670
11689
  }
11671
11690
  kill() {
11672
11691
  killTree(this.process);
11692
+ if (!this.process) this.baseHandleExit(-1);
11673
11693
  }
11674
11694
  getOutput() {
11675
11695
  return this.outputBuffer;
@@ -11685,6 +11705,8 @@ var HeadlessRunner = class extends AbstractRunner {
11685
11705
  hasScriptCmd;
11686
11706
  resolvePath;
11687
11707
  launchDeps;
11708
+ /** Session shape when the caller names none; the VS Code runner overrides it to interactive. */
11709
+ defaultHeadless = true;
11688
11710
  constructor(deps = {}) {
11689
11711
  super();
11690
11712
  this.spawnImpl = deps.spawnImpl ?? import_child_process6.spawn;
@@ -11692,9 +11714,12 @@ var HeadlessRunner = class extends AbstractRunner {
11692
11714
  this.resolvePath = deps.resolvePath ?? augmentedPath;
11693
11715
  this.launchDeps = { resolvePath: this.resolvePath, ...deps.launchDeps };
11694
11716
  }
11695
- async spawn(opts) {
11696
- const id = `ordewell-${opts.taskId.slice(0, 8)}`;
11697
- const session = new HeadlessSession(id, opts.taskId, this.spawnImpl);
11717
+ createSession(id, taskId) {
11718
+ return new HeadlessSession(id, taskId, this.spawnImpl);
11719
+ }
11720
+ /** Everything up to, but not including, spawning — so a surface that owns its own child reaches the same decisions. */
11721
+ async prepareLaunch(opts) {
11722
+ const headless = opts.headless ?? this.defaultHeadless;
11698
11723
  const invocation = buildRunnerInvocation({
11699
11724
  runner: opts.runner,
11700
11725
  prompt: opts.prompt,
@@ -11702,21 +11727,27 @@ var HeadlessRunner = class extends AbstractRunner {
11702
11727
  thinkingEffort: opts.thinkingEffort,
11703
11728
  modelVariants: opts.modelVariants,
11704
11729
  mode: opts.mode,
11705
- headless: opts.headless ?? true,
11730
+ headless,
11706
11731
  registry: opts.registry
11707
11732
  });
11708
11733
  const manifest = opts.registry?.get(opts.runner)?.manifest;
11709
- const requiresTty = manifest?.runner.requiresTty === true && this.hasScriptCmd();
11710
- const modeStr = opts.mode === "plan" ? "plan" : "build";
11711
- console.error(`[headless] Starting ${opts.runner} [${modeStr}] (${opts.modelId || "default"}) for task ${opts.taskId.slice(0, 8)}${requiresTty ? " (PTY)" : ""}`);
11734
+ const pty = (manifest?.runner.requiresTty === true || !headless) && this.hasScriptCmd();
11712
11735
  const resolvedPath = await this.resolvePath();
11713
- const { command, args } = requiresTty ? wrapWithPty(invocation.command, invocation.args) : { command: invocation.command, args: invocation.args };
11714
- session.start(
11715
- await planDirectLaunch(command, args, this.launchDeps),
11716
- opts.cwd,
11736
+ const { command, args } = pty ? wrapWithPty(invocation.command, invocation.args) : { command: invocation.command, args: invocation.args };
11737
+ return {
11738
+ launch: await planDirectLaunch(command, args, this.launchDeps),
11717
11739
  resolvedPath,
11718
- invocation.env
11719
- );
11740
+ env: invocation.env,
11741
+ pty
11742
+ };
11743
+ }
11744
+ async spawn(opts) {
11745
+ const id = `ordewell-${opts.taskId.slice(0, 8)}`;
11746
+ const session = this.createSession(id, opts.taskId);
11747
+ const prepared = await this.prepareLaunch(opts);
11748
+ const modeStr = opts.mode === "plan" ? "plan" : "build";
11749
+ console.error(`[headless] Starting ${opts.runner} [${modeStr}] (${opts.modelId || "default"}) for task ${opts.taskId.slice(0, 8)}${prepared.pty ? " (PTY)" : ""}`);
11750
+ session.start(prepared.launch, opts.cwd, prepared.resolvedPath, prepared.env);
11720
11751
  this.registerSession(id, session);
11721
11752
  return session;
11722
11753
  }
@@ -12744,6 +12775,7 @@ var SettingsService = class {
12744
12775
  GREP_DEFAULT_HEAD_LIMIT,
12745
12776
  GeminiService,
12746
12777
  HeadlessRunner,
12778
+ HeadlessSession,
12747
12779
  JSON_REPAIR_INSTRUCTION,
12748
12780
  LineBuffer,
12749
12781
  ModelCatalog,
@@ -12779,6 +12811,7 @@ var SettingsService = class {
12779
12811
  addTaskToPlan,
12780
12812
  applyHeadLimit,
12781
12813
  applyTaskOps,
12814
+ augmentPromptWithPriorOutputs,
12782
12815
  augmentedPath,
12783
12816
  buildConversationSystemPrompt,
12784
12817
  buildFallbackGrepArgs,
@@ -12811,7 +12844,9 @@ var SettingsService = class {
12811
12844
  clearResearchShellCache,
12812
12845
  clearState,
12813
12846
  coerceAssignments,
12847
+ collectDirectDependencyOutputs,
12814
12848
  collectProviderCredentials,
12849
+ composeAugmentedPrompt,
12815
12850
  configuredProviders,
12816
12851
  createAiService,
12817
12852
  createEmptyPlan,
@@ -12878,6 +12913,8 @@ var SettingsService = class {
12878
12913
  reEmitTaskOpsPrompt,
12879
12914
  referencePattern,
12880
12915
  removeTaskFromPlan,
12916
+ renderPlanMap,
12917
+ renderPriorOutputs,
12881
12918
  renumberTasks,
12882
12919
  repairLoop,
12883
12920
  researchShellWarning,
@@ -12907,6 +12944,7 @@ var SettingsService = class {
12907
12944
  stripModelNoise,
12908
12945
  stripModelPrefix,
12909
12946
  stripTrailingCommas,
12947
+ summarizeOutput,
12910
12948
  summarizeToolCall,
12911
12949
  taskOpsRejectedPrompt,
12912
12950
  textHasTaskOps,