@ordewell/core 0.7.1 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{IFileSystem-BnLh-_SK.d.mts → IFileSystem-B5asBRDa.d.mts} +1 -1
- package/dist/{IFileSystem-DofiRcCo.d.ts → IFileSystem-CbCmUDBn.d.ts} +1 -1
- package/dist/{ModeResolver-DZzJSdIU.d.mts → ModeResolver-DcqAho4y.d.mts} +1 -1
- package/dist/{ModeResolver-DkMYf4uS.d.ts → ModeResolver-DtfhWeVL.d.ts} +1 -1
- package/dist/{Task-BnLxkVQF.d.mts → Task-BpzIbunq.d.mts} +7 -2
- package/dist/{Task-BnLxkVQF.d.ts → Task-BpzIbunq.d.ts} +7 -2
- package/dist/{chunk-Y36NIASW.mjs → chunk-AJ5KDO6V.mjs} +38 -68
- package/dist/chunk-AJ5KDO6V.mjs.map +1 -0
- package/dist/chunk-H5O74L77.mjs +185 -0
- package/dist/chunk-H5O74L77.mjs.map +1 -0
- package/dist/{chunk-LGQNXPBX.mjs → chunk-MZYZS7B3.mjs} +5 -185
- package/dist/chunk-MZYZS7B3.mjs.map +1 -0
- package/dist/{chunk-ZV5LDNCO.mjs → chunk-OUIQWNS3.mjs} +6 -4
- package/dist/{chunk-ZV5LDNCO.mjs.map → chunk-OUIQWNS3.mjs.map} +1 -1
- package/dist/index.d.mts +634 -248
- package/dist/index.d.ts +634 -248
- package/dist/index.js +3605 -2735
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3610 -2713
- package/dist/index.mjs.map +1 -1
- package/dist/order-labels.d.mts +1 -1
- package/dist/order-labels.d.ts +1 -1
- package/dist/{parsing-ddZXZFP4.d.ts → parsing-COFGUEWx.d.ts} +2 -2
- package/dist/{parsing-B6ctfF80.d.mts → parsing-D0uo-Icd.d.mts} +2 -2
- package/dist/parsing.d.mts +3 -3
- package/dist/parsing.d.ts +3 -3
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -2
- package/dist/{plan-utils-CKgNtDwQ.d.mts → plan-utils-CdW3mxt5.d.mts} +3 -5
- package/dist/{plan-utils--kQRzSE-.d.ts → plan-utils-D4Z8UyLL.d.ts} +3 -5
- package/dist/plan-utils.d.mts +3 -3
- package/dist/plan-utils.d.ts +3 -3
- package/dist/plan-utils.js +8 -0
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +6 -2
- package/dist/testing.d.mts +2 -2
- package/dist/testing.d.ts +2 -2
- package/dist/testing.js +5 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +5 -1
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-LGQNXPBX.mjs.map +0 -1
- package/dist/chunk-Y36NIASW.mjs.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { d as AgentAdapterFactory, i as AllProviderModels, l as ApprovalKind, o as ApprovalPolicyOptions, q as ApprovalSource, B as BlockingPrompt, C as CMD_EXE_MAX_COMMAND_LINE, s as CatalogModel, u as CheckpointArgs, v as CommandLineTooLongError, D as
|
|
3
|
-
import {
|
|
4
|
-
export { a as ApprovalBlock, b as ApprovalStatus, C as CHECKPOINT_TRUNCATE_LENGTH, c as ConversationInput, d as ConversationView, D as DiffRow, e as DiffRowKind, f as DiffStat, g as DisplayBlock, E as EMPTY_CONVERSATION, h as EMPTY_HOLD, i as EMPTY_TASK_LOG, G as GatedConversation, L as LocalEntry,
|
|
5
|
-
import { I as IFileSystem, R as ReadFileOpts, T as ToolOutcome, b as GrepOptions, a as GlobOptions, F as FindSymbolOptions } from './IFileSystem-
|
|
6
|
-
export { G as GREP_DEFAULT_HEAD_LIMIT, c as GrepOutputMode, S as SEARCH_EXCLUSIONS } from './IFileSystem-
|
|
7
|
-
import { R as RunnerModeInfo } from './ModeResolver-
|
|
8
|
-
export { M as ManifestLookup, a as autonomyLevelLabel, b as buildModeGuide, f as filteredBuildModes, p as parseAutonomyLevel, r as resolveDefaultMode, c as resolveTaskMode, d as runnerModesFrom } from './ModeResolver-
|
|
1
|
+
import { b0 as RunnerId, ay as PlanStatus, ac as LegacyPlanState, M as IApproval, p as ApprovalRequest, k as ApprovalDecision, j as ApprovalAnswer, P as ITerminalRunner, N as IConfig, h as AiProvider, aN as ProviderModelLists, m as ApprovalMode, $ as IsolationMergeResult, X as IsolationLandedTask, R as IWorktreeIsolation, a8 as IsolationTaskStatus, av as PlanIsolation, b5 as RunnerTransport, aV as RepoGroupLayout, Q as ITerminalSession, z as DiscoveredModel, bi as Task, f as AgentProcessDeps, c as AgentAdapter, as as OrdewellMcpServer, aX as ResearchProgress, aW as ResearchLogEntry, w as ConversationMessage, aB as PlannerToolHandler, bF as UsageRecord, bu as TaskSnapshot, r as AwaitingReason, U as IsolationHandoff, a4 as IsolationRun, a5 as IsolationTaskRecord, bk as TaskIsolation, a9 as IsolationView, a0 as IsolationOutcome, aU as RepairEvidence, bD as TreeSnapshot, bM as Verdict, b3 as RunnerRegistry, aS as QueuedTaskMessage, aR as QueuedMessage, b as ActiveTaskSession, ar as OrchestratorOption, bn as TaskModeAgentAdapter, g as AgentStartOptions, e as AgentEvent, a_ as ResearchToolType, aC as PlannerUsage, n as ApprovalPolicy, ax as PlanState, bj as TaskCompleteArgs, t as CheckpointAnswer, b1 as RunnerInvocation, A as AbstractRunner, a as AbstractTerminalSession, b6 as RunnerVersionProbe, bb as StructuredSessionCapability, bv as TaskStartOptions, bx as TaskTokenScope, bc as StructuredTurnEnd, ba as StructuredEvent, b4 as RunnerSpawnOptions, O as IPluginStore, b2 as RunnerPluginManifest, a$ as ResolveContext, bt as TaskRunnerFlags } from './Task-BpzIbunq.js';
|
|
2
|
+
export { d as AgentAdapterFactory, i as AllProviderModels, l as ApprovalKind, o as ApprovalPolicyOptions, q as ApprovalSource, B as BlockingPrompt, C as CMD_EXE_MAX_COMMAND_LINE, s as CatalogModel, u as CheckpointArgs, v as CommandLineTooLongError, D as DEFAULT_RUNNERS, x as DENY_ALL, y as DiscoveredMode, E as DiscoveryCommand, F as EditPlanArgs, G as EmbeddedNewlineError, H as ExecutableNotFoundError, I as FetchAllProviderModelsOptions, J as HeadlessRunner, K as HeadlessRunnerDeps, L as HeadlessSession, S as IntegrationDisposal, T as IsolationAvailability, V as IsolationHandoffRepo, W as IsolationInactiveReason, Y as IsolationLanding, Z as IsolationMergeBlock, _ as IsolationMergeBlockReason, a1 as IsolationPruneResult, a2 as IsolationRemoval, a3 as IsolationRepo, a6 as IsolationTaskRef, a7 as IsolationTaskRepo, aa as LaunchDeps, ab as LaunchPlan, ad as LineBuffer, ae as ListModelsArgs, af as ListRunnersArgs, ag as McpClientConfig, ah as McpCredential, ai as McpTool, aj as McpToolContext, ak as McpToolReply, al as Message, am as ModelCatalog, an as ModelShortcut, ao as ORCHESTRATOR_SHORTCUTS, ap as ORDEWELL_MCP_PATH, aq as ORDEWELL_MCP_SERVER_NAME, at as OwnerOnlyFile, au as PLANNER_TOOLS, aw as PlanModificationWarnings, az as PlannerStartOptions, aA as PlannerTokenScope, aD as PluginCloneFn, aE as PluginEntry, aF as PluginFeatures, aG as PluginMode, aH as PluginModelDiscovery, aI as PluginRunnerDef, aJ as PreparedLaunch, aK as PreparedTask, aL as PreservedWork, aM as ProviderCredentialSource, aO as ProviderModelsResult, aP as PtySize, aQ as PtyWrapOptions, aT as RefusedRemoval, aY as ResearchStep, aZ as ResearchStepOutcome, b7 as StreamEvent, b8 as StreamStepEvent, b9 as StreamThinkingEvent, bd as SubagentLogEntry, be as SubagentOutcome, bf as SubmitPlanArgs, bg as TASK_COMPLETE_TOOL, bh as TASK_TOOLS, bl as TaskIsolationState, bm as TaskMode, bo as TaskModeUnsupportedError, bp as TaskModelAssignment, bq as TaskOutputArgs, br as TaskOutputSummary, bs as TaskQueryArgs, bw as TaskStatus, by as TaskToolHandler, bz as TaskTransport, bA as TaskType, bB as TaskWithParent, bC as ThinkingBlock, bE as UsageLine, bG as UsageTotals, bH as UserPromptEntry, bI as UserStep, bJ as ValidationCheck, bK as ValidationContext, bL as ValidationResult, bN as VerificationCheck, bO as WINDOWS_MAX_COMMAND_LINE, bP as addPlannerUsage, bQ as addTaskToPlan, bR as addUsage, bS as approvalScopes, bT as buildShellInvocation, bU as collectProviderCredentials, bV as createEmptyPlan, bW as createTask, bX as emptyWarnings, bY as enabledRunners, bZ as fetchAllProviderModels, b_ as flattenTasks, b$ as flattenTasksWithParents, c0 as inheritedOps, c1 as isAwaitingReason, c2 as isExecutableResolved, c3 as isGranted, c4 as isMeasured, c5 as isReservedRunnerName, c6 as isRunnerApproval, c7 as isRunnerTransport, c8 as isStructuredSession, c9 as keepExecutionState, ca as knownModelId, cb as mcpClientConfig, cc as migrateLegacyPlan, cd as migratePlanState, ce as migrateTask, cf as opsFlag, cg as ownerOnlyConfigFile, ch as partedPromptUsage, ci as planDirectLaunch, cj as planShellLaunch, ck as plannerContextFill, cl as posixShellQuote, cm as removeTaskFromPlan, cn as renumberTasks, co as resolveModelShortcut, cp as resolveProvider, cq as sharedMcpServer, cr as stripAnsi, cs as toApprovalDecision, ct as toOrchestratorOptions, cu as updateTaskInPlan, cv as usageLine, cw as validateModifiedPlan, cx as warningsText, cy as windowsCommandLine, cz as wrapWithPty } from './Task-BpzIbunq.js';
|
|
3
|
+
import { B as TaskOp, M as MergeGateView, j as EditCatalog, s as SessionBroadcaster, A as ApplyTaskOpsResult, t as SessionMessage, u as SessionNotice, y as TaskLogEvent } from './plan-utils-D4Z8UyLL.js';
|
|
4
|
+
export { a as ApprovalBlock, b as ApprovalStatus, C as CHECKPOINT_TRUNCATE_LENGTH, c as ConversationInput, d as ConversationView, D as DiffRow, e as DiffRowKind, f as DiffStat, g as DisplayBlock, E as EMPTY_CONVERSATION, h as EMPTY_HOLD, i as EMPTY_TASK_LOG, G as GatedConversation, L as LocalEntry, k as MessageBlock, l as MessageRole, N as NOT_STARTED, m as NO_TURN, n as NewTaskFields, O as OutputPreview, P as PlanBlock, o as PlanMarkerStatus, p as PromptHold, S as SerializedPlan, q as SerializedTask, r as SerializedTaskStatus, v as SubagentBlock, w as SubagentChild, x as SubagentStatus, T as TakenPrompt, z as TaskLogView, F as TaskRef, H as TaskRowAction, I as TaskRowContext, J as TaskRowIsolation, K as TaskRowKind, Q as TaskRowPlacement, R as TaskRowSubject, U as TaskRowView, V as TaskStatusKind, W as ThinkingDisplayBlock, X as ToolBlock, Y as ToolHeadline, Z as ToolStatus, _ as TurnGate, $ as UsageBlock, a0 as aheadOfDraft, a1 as applyTaskOps, a2 as approvalLabel, a3 as awaitingLabel, a4 as canMergeTasks, a5 as canSetDependencies, a6 as canSplitTask, a7 as capConflictFiles, a8 as classifyOutcome, a9 as coalesceTaskLog, aa as dependencyCandidates, ab as dependentsNotice, ac as dependentsOf, ad as diffRows, ae as diffStat, af as diffSummary, ag as digestTaskLog, ah as drainNext, ai as executionSummary, aj as followTurn, ak as fromTranscript, al as hasHiddenDetail, am as holdPrompt, an as isTaskRunning, ao as markAction, ap as markRequestFor, aq as namedRepos, ar as newTaskFields, as as opsEditable, at as outputLines, au as outputPreview, av as parseTaskOpsJson, aw as pastGateConfirmation, ax as reduceConversation, ay as reduceTaskLog, az as replayTaskLog, aA as runnerToolSubject, aB as serializePlan, aC as serializeTask, aD as serializeTaskStatus, aE as stopTurn, aF as summarizeToolCall, aG as taskRowActions, aH as taskRowView, aI as taskStartedNotice, aJ as taskStatusKind, aK as textHasTaskOps, aL as titledRefs, aM as toTaskLogEvent, aN as toolHeadline, aO as trimToolOutput, aP as truncateCheckpointSummary, aQ as unsendAll, aR as unsendLatest } from './plan-utils-D4Z8UyLL.js';
|
|
5
|
+
import { I as IFileSystem, R as ReadFileOpts, T as ToolOutcome, b as GrepOptions, a as GlobOptions, F as FindSymbolOptions } from './IFileSystem-CbCmUDBn.js';
|
|
6
|
+
export { G as GREP_DEFAULT_HEAD_LIMIT, c as GrepOutputMode, S as SEARCH_EXCLUSIONS } from './IFileSystem-CbCmUDBn.js';
|
|
7
|
+
import { R as RunnerModeInfo } from './ModeResolver-DtfhWeVL.js';
|
|
8
|
+
export { M as ManifestLookup, a as autonomyLevelLabel, b as buildModeGuide, f as filteredBuildModes, p as parseAutonomyLevel, r as resolveDefaultMode, c as resolveTaskMode, d as runnerModesFrom } from './ModeResolver-DtfhWeVL.js';
|
|
9
9
|
import { ChildProcess } from 'child_process';
|
|
10
|
-
import { b as PlanParseError } from './parsing-
|
|
11
|
-
export { P as PLAN_ENVELOPE_KEY, a as PartialPlanTask, c as PlanTaskError, d as PlanTasksResult, T as TASK_OPS_ENVELOPE_KEY, e as TASK_QUERY_ENVELOPE_KEY, f as checkDepsResolve, g as checkImmutableLog, h as checkInProgress, i as checkNoCycles, j as checkUniqueIds, k as escapeControlCharsInStrings, l as extractJsonObject, m as extractObjectWithBalance, n as extractObjectsWithKey, o as looksLikePlanAttempt, p as opensWithJsonObject, q as parsePartialPlan, r as parsePlanJson, s as stripModelNoise, t as stripTrailingCommas, v as validatePlanModification, u as validatePlanTasks } from './parsing-
|
|
10
|
+
import { b as PlanParseError } from './parsing-COFGUEWx.js';
|
|
11
|
+
export { P as PLAN_ENVELOPE_KEY, a as PartialPlanTask, c as PlanTaskError, d as PlanTasksResult, T as TASK_OPS_ENVELOPE_KEY, e as TASK_QUERY_ENVELOPE_KEY, f as checkDepsResolve, g as checkImmutableLog, h as checkInProgress, i as checkNoCycles, j as checkUniqueIds, k as escapeControlCharsInStrings, l as extractJsonObject, m as extractObjectWithBalance, n as extractObjectsWithKey, o as looksLikePlanAttempt, p as opensWithJsonObject, q as parsePartialPlan, r as parsePlanJson, s as stripModelNoise, t as stripTrailingCommas, v as validatePlanModification, u as validatePlanTasks } from './parsing-COFGUEWx.js';
|
|
12
12
|
export { resolveOrderLabel, taskOrderLabel, taskRef, titledTaskRef } from './order-labels.js';
|
|
13
13
|
import 'events';
|
|
14
14
|
import 'zod/v4';
|
|
@@ -650,6 +650,7 @@ type GitExecFn = (file: string, args: string[], opts: {
|
|
|
650
650
|
stdout: string;
|
|
651
651
|
stderr: string;
|
|
652
652
|
}>;
|
|
653
|
+
|
|
653
654
|
interface WorktreeIsolationDeps {
|
|
654
655
|
config: Pick<IConfig, 'worktreeIsolation' | 'worktreeSetupCommand' | 'workspaceRepos' | 'worktreeLinks'>;
|
|
655
656
|
/** Test seam: every git invocation goes through this. */
|
|
@@ -1106,10 +1107,13 @@ interface ConversationRequest {
|
|
|
1106
1107
|
* atomically and answers queries out of its own state; the AI service only
|
|
1107
1108
|
* parses them.
|
|
1108
1109
|
*/
|
|
1109
|
-
type ConversationTurn =
|
|
1110
|
+
type ConversationTurn =
|
|
1111
|
+
/** `aborted`: the call was stopped, and `text` is only what it had by then. */
|
|
1112
|
+
{
|
|
1110
1113
|
kind: 'message';
|
|
1111
1114
|
text: string;
|
|
1112
1115
|
researchLog: ResearchLogEntry[];
|
|
1116
|
+
aborted?: boolean;
|
|
1113
1117
|
} | {
|
|
1114
1118
|
kind: 'plan';
|
|
1115
1119
|
tasks: Task[];
|
|
@@ -1464,15 +1468,6 @@ declare class PlanStore {
|
|
|
1464
1468
|
setTaskVerdict(id: string, verdict: Task['verdict']): void;
|
|
1465
1469
|
setTaskOutputSummary(id: string, summary: Task['outputSummary']): void;
|
|
1466
1470
|
setTaskTransport(id: string, transport: Task['transport']): void;
|
|
1467
|
-
getPlanVisualization(): {
|
|
1468
|
-
tasks: {
|
|
1469
|
-
id: string;
|
|
1470
|
-
title: string;
|
|
1471
|
-
dependencies: string[];
|
|
1472
|
-
parallelGroups: number[][];
|
|
1473
|
-
}[];
|
|
1474
|
-
parallelGroups: number[][];
|
|
1475
|
-
};
|
|
1476
1471
|
/**
|
|
1477
1472
|
* Widen the plan's runner set. Retargeting a task onto a runner the plan has
|
|
1478
1473
|
* not used before has to land here as well as on the plan state, or
|
|
@@ -1552,6 +1547,8 @@ declare class IsolationRunController {
|
|
|
1552
1547
|
/** Resolver task id → the conflicted task it resolves; see {@link linkResolver}. */
|
|
1553
1548
|
private resolvers;
|
|
1554
1549
|
private opening;
|
|
1550
|
+
/** Bumped by an interrupt, so an activation in flight across it does not open the run it ended. */
|
|
1551
|
+
private activations;
|
|
1555
1552
|
/** The start a dirty tree turned away, handed back once the user chooses how to go on. */
|
|
1556
1553
|
private blockedStart;
|
|
1557
1554
|
/** The dirty repos behind {@link blockedStart}, for the stash notice. */
|
|
@@ -1746,6 +1743,10 @@ declare class IsolationRunController {
|
|
|
1746
1743
|
* whole. One that cannot be continued for another reason — it ran from a
|
|
1747
1744
|
* different workspace path — keeps its integration branch in each repo that
|
|
1748
1745
|
* has not merged it: only the user gives landed work up.
|
|
1746
|
+
*
|
|
1747
|
+
* False when `interrupted` came while git was minting: a newer activation
|
|
1748
|
+
* may be minting its own run, so this one is never installed over it, and
|
|
1749
|
+
* is discarded rather than left as branches no record names.
|
|
1749
1750
|
*/
|
|
1750
1751
|
private mint;
|
|
1751
1752
|
private reportCopies;
|
|
@@ -1897,7 +1898,7 @@ interface OrchestratorObserver {
|
|
|
1897
1898
|
}): void;
|
|
1898
1899
|
onTick?(): void;
|
|
1899
1900
|
onExecutionComplete?(): void;
|
|
1900
|
-
/**
|
|
1901
|
+
/** The run is parked behind queued user messages, with nothing live, until they are drained. */
|
|
1901
1902
|
onQueueReady?(): void;
|
|
1902
1903
|
onReviewNeeded?(data: {
|
|
1903
1904
|
tasks: Task[];
|
|
@@ -1951,9 +1952,9 @@ interface TaskAttemptSnapshot {
|
|
|
1951
1952
|
}
|
|
1952
1953
|
/**
|
|
1953
1954
|
* The wiring a {@link TaskOrchestrator} runs on, every collaborator resolved.
|
|
1954
|
-
* {@link
|
|
1955
|
-
* through
|
|
1956
|
-
*
|
|
1955
|
+
* {@link TaskOrchestrator.compose} is the only production caller; tests build
|
|
1956
|
+
* one through it too. The constructor makes nothing itself, so there is exactly
|
|
1957
|
+
* one place defaults live.
|
|
1957
1958
|
*/
|
|
1958
1959
|
interface TaskOrchestratorDeps {
|
|
1959
1960
|
config: IConfig;
|
|
@@ -1978,9 +1979,9 @@ interface TaskOrchestratorDeps {
|
|
|
1978
1979
|
previousAttemptFromLog: (taskId: string) => string | null;
|
|
1979
1980
|
}
|
|
1980
1981
|
/**
|
|
1981
|
-
* What a caller supplies to {@link
|
|
1982
|
-
* gets its default there. This is what a host or test chooses, not the
|
|
1983
|
-
* wiring the orchestrator itself runs on.
|
|
1982
|
+
* What a caller supplies to {@link TaskOrchestrator.compose}; every optional
|
|
1983
|
+
* one gets its default there. This is what a host or test chooses, not the
|
|
1984
|
+
* resolved wiring the orchestrator itself runs on.
|
|
1984
1985
|
*/
|
|
1985
1986
|
interface TaskOrchestratorOptions {
|
|
1986
1987
|
config: IConfig;
|
|
@@ -2151,7 +2152,6 @@ declare class TaskOrchestrator {
|
|
|
2151
2152
|
/** Task id → session id of every attempt whose runner is up; a spawn in flight has no session yet. */
|
|
2152
2153
|
get activeSessionMap(): Map<string, string>;
|
|
2153
2154
|
getAttempt(taskId: string): TaskAttemptSnapshot | undefined;
|
|
2154
|
-
getAttemptSession(taskId: string): ITerminalSession | undefined;
|
|
2155
2155
|
get queuedCount(): number;
|
|
2156
2156
|
/**
|
|
2157
2157
|
* "Merge all"; a settled run that merged everything is cleared up and
|
|
@@ -2183,7 +2183,6 @@ declare class TaskOrchestrator {
|
|
|
2183
2183
|
removeQueuedMessage(id: string): boolean;
|
|
2184
2184
|
setQueuedMessages(messages: QueuedMessage[]): void;
|
|
2185
2185
|
clearQueuedMessages(): void;
|
|
2186
|
-
processNextQueuedMessage(): QueuedMessage | null;
|
|
2187
2186
|
loadPlan(tasks: readonly Task[], planRunners?: RunnerId[]): void;
|
|
2188
2187
|
/**
|
|
2189
2188
|
* Adopt an edited plan without letting go of the run in progress. Everything
|
|
@@ -2224,7 +2223,16 @@ declare class TaskOrchestrator {
|
|
|
2224
2223
|
* run up, so neither may happen under a task the plan still shows at work.
|
|
2225
2224
|
*/
|
|
2226
2225
|
private get settled();
|
|
2227
|
-
|
|
2226
|
+
/**
|
|
2227
|
+
* The boundary a verdict crosses: nothing awaits the verifier's listener, so
|
|
2228
|
+
* a throw from reading the output, landing, releasing a worktree or the tick
|
|
2229
|
+
* after would be an unhandled rejection — and an attempt left integrating is
|
|
2230
|
+
* live work forever. One that never settled fails (a repair waits on the
|
|
2231
|
+
* user, as its conflict did); either way the run halts and says why.
|
|
2232
|
+
*/
|
|
2233
|
+
private deliverVerdict;
|
|
2234
|
+
/** Work nothing awaits: a rejection is said, not left unhandled. */
|
|
2235
|
+
private unawaited;
|
|
2228
2236
|
private onVerdict;
|
|
2229
2237
|
private afterVerdict;
|
|
2230
2238
|
/**
|
|
@@ -2281,7 +2289,6 @@ declare class TaskOrchestrator {
|
|
|
2281
2289
|
*/
|
|
2282
2290
|
releaseTask(taskId: string): Promise<void>;
|
|
2283
2291
|
markTaskComplete(taskId: string): Promise<void>;
|
|
2284
|
-
markAiTaskComplete(taskId: string): Promise<void>;
|
|
2285
2292
|
/**
|
|
2286
2293
|
* Undo a completion: return the task to "not executed" — pending, verdict and
|
|
2287
2294
|
* summary dropped, archive entry removed. It is put on hold like a cancel, so
|
|
@@ -2328,16 +2335,9 @@ declare class TaskOrchestrator {
|
|
|
2328
2335
|
isAllComplete(): boolean;
|
|
2329
2336
|
isAnyFailed(): boolean;
|
|
2330
2337
|
approveReview(): Promise<void>;
|
|
2331
|
-
getPlanVisualization(): {
|
|
2332
|
-
tasks: {
|
|
2333
|
-
id: string;
|
|
2334
|
-
title: string;
|
|
2335
|
-
dependencies: string[];
|
|
2336
|
-
parallelGroups: number[][];
|
|
2337
|
-
}[];
|
|
2338
|
-
parallelGroups: number[][];
|
|
2339
|
-
};
|
|
2340
2338
|
tick(): Promise<void>;
|
|
2339
|
+
/** Whether the scheduler may start `id` now: it passes every readiness gate and a slot is free. */
|
|
2340
|
+
private stillReady;
|
|
2341
2341
|
/**
|
|
2342
2342
|
* A run paused at merge gates says so, as plainly as a task that waits on
|
|
2343
2343
|
* the user: which tasks wait, and that Merge all lets them go on (ADR-0020).
|
|
@@ -2395,12 +2395,6 @@ declare class TaskOrchestrator {
|
|
|
2395
2395
|
private saveNativeSession;
|
|
2396
2396
|
private endAllAttempts;
|
|
2397
2397
|
}
|
|
2398
|
-
/**
|
|
2399
|
-
* Build a {@link TaskOrchestrator}, filling in every collaborator a caller did
|
|
2400
|
-
* not inject. The one entry point for hosts, bench harnesses and tests alike;
|
|
2401
|
-
* {@link TaskOrchestrator} itself constructs nothing.
|
|
2402
|
-
*/
|
|
2403
|
-
declare function createTaskOrchestrator(options: TaskOrchestratorOptions): TaskOrchestrator;
|
|
2404
2398
|
|
|
2405
2399
|
/**
|
|
2406
2400
|
* Everything needed to produce a plan from a goal. Carries the planning context
|
|
@@ -2641,6 +2635,37 @@ declare function isCliProvider(id: AiProvider): boolean;
|
|
|
2641
2635
|
declare function runnerForProvider(id: AiProvider): string | null;
|
|
2642
2636
|
/** The harness planner that wraps a given runner, or null when none does. */
|
|
2643
2637
|
declare function providerForRunner(runner: string): AiProvider | null;
|
|
2638
|
+
/** One runner's planner usability, as `RunnerInstallation.plannerUsability` reports it. */
|
|
2639
|
+
interface PlannerUsability {
|
|
2640
|
+
usable: boolean;
|
|
2641
|
+
reason?: string;
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* One entry of the planner backend list (ADR-0009). `id` is the `AiProvider`
|
|
2645
|
+
* either way; `runner` is set only for a harness planner, whose model catalog
|
|
2646
|
+
* comes from that runner, and `reason` is the second line a surface renders —
|
|
2647
|
+
* the block detail for a harness planner, the API-key variable for a vendor.
|
|
2648
|
+
*/
|
|
2649
|
+
interface PlannerBackendEntry {
|
|
2650
|
+
id: AiProvider;
|
|
2651
|
+
label: string;
|
|
2652
|
+
kind: 'harness' | 'vendor';
|
|
2653
|
+
runner?: string;
|
|
2654
|
+
usable: boolean;
|
|
2655
|
+
reason?: string;
|
|
2656
|
+
}
|
|
2657
|
+
/** The detail a usable harness planner is always shown with. */
|
|
2658
|
+
declare const HARNESS_PLANNER_REASON = "coding agent \u00B7 no API key needed";
|
|
2659
|
+
/**
|
|
2660
|
+
* The planner backends every surface offers, in order: the harness planners
|
|
2661
|
+
* first, always listed so a missing CLI is greyed with its reason rather than
|
|
2662
|
+
* hidden, then the configured vendors in `PROVIDER_PRIORITY` order. Pure: the
|
|
2663
|
+
* caller supplies what it knows of each runner (VS Code its `plannerUsability`
|
|
2664
|
+
* results, the TUI its installed set) and maps the entries to its own item
|
|
2665
|
+
* type, keeping surface-specific affordances — e.g. the CLI's empty-vendor
|
|
2666
|
+
* placeholder — to itself.
|
|
2667
|
+
*/
|
|
2668
|
+
declare function plannerBackendEntries(usability: Readonly<Record<string, PlannerUsability>>, configured: readonly AiProvider[]): PlannerBackendEntry[];
|
|
2644
2669
|
/**
|
|
2645
2670
|
* The single definition of which providers count as "configured" — one API
|
|
2646
2671
|
* key each, or (for `openai_compatible`) an explicit base URL. Every surface
|
|
@@ -2740,8 +2765,8 @@ interface SpawnSpec {
|
|
|
2740
2765
|
*
|
|
2741
2766
|
* Subclasses own their agent's protocol: what to spawn, how to phrase a user
|
|
2742
2767
|
* turn, and how to read one protocol line. Everything below — line framing,
|
|
2743
|
-
* turn lifecycle, abort
|
|
2744
|
-
*
|
|
2768
|
+
* turn lifecycle, abort — is the same for all of them, and the process itself
|
|
2769
|
+
* is a {@link RunnerProcess}.
|
|
2745
2770
|
*/
|
|
2746
2771
|
declare abstract class StdioAgentAdapter implements AgentAdapter {
|
|
2747
2772
|
protected deps: AgentProcessDeps;
|
|
@@ -2749,8 +2774,7 @@ declare abstract class StdioAgentAdapter implements AgentAdapter {
|
|
|
2749
2774
|
protected process: ChildProcess | null;
|
|
2750
2775
|
protected sessionId: string | null;
|
|
2751
2776
|
private readonly stdout;
|
|
2752
|
-
private
|
|
2753
|
-
private exited;
|
|
2777
|
+
private readonly runner;
|
|
2754
2778
|
/** Set for the duration of a turn. Outside one, events are buffered rather than dropped. */
|
|
2755
2779
|
private turnEmit;
|
|
2756
2780
|
/** Set for the duration of a turn. Pinged on every raw line, whether or not `handleLine` turns it into an event. */
|
|
@@ -2772,11 +2796,6 @@ declare abstract class StdioAgentAdapter implements AgentAdapter {
|
|
|
2772
2796
|
/** A task's session, which wants what the agent says on its own after a turn closed; a planner registers none and drops it. */
|
|
2773
2797
|
private outOfTurnListener;
|
|
2774
2798
|
private disposed;
|
|
2775
|
-
/** Resolves when the process ends, so a handshake can lose the race instead of waiting out its timeout. */
|
|
2776
|
-
protected processEnded: Promise<void>;
|
|
2777
|
-
/** The environment the agent was spawned under, for any side process a handshake needs. */
|
|
2778
|
-
protected spawnEnv: NodeJS.ProcessEnv;
|
|
2779
|
-
private markEnded;
|
|
2780
2799
|
/** What this process is to the user — a planner or a task's runner — for the words a failure is reported in. */
|
|
2781
2800
|
protected role: 'planner' | 'task';
|
|
2782
2801
|
constructor(deps: AgentProcessDeps);
|
|
@@ -2792,6 +2811,17 @@ declare abstract class StdioAgentAdapter implements AgentAdapter {
|
|
|
2792
2811
|
/** Protocol handshake, if the agent needs one before it accepts a turn. */
|
|
2793
2812
|
protected handshake(_opts: AgentStartOptions): Promise<void>;
|
|
2794
2813
|
start(opts: AgentStartOptions): Promise<void>;
|
|
2814
|
+
/**
|
|
2815
|
+
* Every protocol line goes to `handleLine`, turn or no turn: an agent's
|
|
2816
|
+
* handshake and its session-id announcement both arrive before the first
|
|
2817
|
+
* message is sent, and dropping them left the handshake waiting on a reply
|
|
2818
|
+
* that had already come and gone.
|
|
2819
|
+
*/
|
|
2820
|
+
private readProtocol;
|
|
2821
|
+
/** Resolves when the process ends, so a handshake can lose the race instead of waiting out its timeout. */
|
|
2822
|
+
protected get processEnded(): Promise<void>;
|
|
2823
|
+
/** The environment the agent was spawned under, for any side process a handshake needs. */
|
|
2824
|
+
protected get spawnEnv(): NodeJS.ProcessEnv;
|
|
2795
2825
|
send(message: string, onEvent: (event: AgentEvent) => void, signal?: AbortSignal, onActivity?: () => void): Promise<void>;
|
|
2796
2826
|
onOutOfTurn(listener: (event: AgentEvent) => void): void;
|
|
2797
2827
|
nativeSessionId(): string | null;
|
|
@@ -2868,7 +2898,6 @@ declare class ClaudeCodeAdapter extends StdioAgentAdapter implements TaskModeAge
|
|
|
2868
2898
|
/** The file holding the token lives exactly as long as the process that reads it. */
|
|
2869
2899
|
private ordewellServerArgs;
|
|
2870
2900
|
private removeMcpConfig;
|
|
2871
|
-
start(opts: AgentStartOptions): Promise<void>;
|
|
2872
2901
|
/** Asks the CLI itself, which reports `pending` until its connection attempt settles. */
|
|
2873
2902
|
mcpAttached(): Promise<boolean>;
|
|
2874
2903
|
/**
|
|
@@ -2974,16 +3003,12 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2974
3003
|
private threadId;
|
|
2975
3004
|
/** The model Codex opened the thread with — usage records name it. */
|
|
2976
3005
|
private threadModel;
|
|
2977
|
-
private
|
|
2978
|
-
private settleHandshake;
|
|
2979
|
-
private handshakeError;
|
|
3006
|
+
private readonly rpc;
|
|
2980
3007
|
private startOpts;
|
|
2981
3008
|
/** Whether this turn has already emitted prose — see the `agentMessage` case. */
|
|
2982
3009
|
private turnHasText;
|
|
2983
3010
|
/** The turn in flight. `turn/interrupt` and `turn/steer` cannot be sent before it has an id. */
|
|
2984
3011
|
private turn;
|
|
2985
|
-
/** The JSON-RPC id of the `turn/start` that opened {@link turn}. */
|
|
2986
|
-
private turnRequestId;
|
|
2987
3012
|
/** The last turn this adapter ended — so its second end signal, landing late, ends nothing. */
|
|
2988
3013
|
private endedTurnId;
|
|
2989
3014
|
/** An interrupt was asked for during this turn, so however it ends, it was cut short. */
|
|
@@ -2994,8 +3019,6 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2994
3019
|
* that belongs to no turn of the agent's any more (ADR-0023, F4).
|
|
2995
3020
|
*/
|
|
2996
3021
|
private readonly interruptedTurnIds;
|
|
2997
|
-
/** An interrupt asked for before Codex named the turn, sent once it does. */
|
|
2998
|
-
private interruptOnStart;
|
|
2999
3022
|
/** A task's approval requests still waiting for an answer, by the request id as a string. */
|
|
3000
3023
|
private readonly openPermissions;
|
|
3001
3024
|
/**
|
|
@@ -3005,10 +3028,6 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3005
3028
|
private readonly fileChangePaths;
|
|
3006
3029
|
/** The row each announced file of an in-flight `fileChange` item is shown under, by the file's shown path. */
|
|
3007
3030
|
private readonly fileChangeRows;
|
|
3008
|
-
/** Requests this adapter sent and awaits an answer to, by JSON-RPC id. */
|
|
3009
|
-
private readonly pendingRequests;
|
|
3010
|
-
private resumeAttempted;
|
|
3011
|
-
private resumeFallbackSent;
|
|
3012
3031
|
private sandbox;
|
|
3013
3032
|
/** The Ordewell server's startup state, as Codex last reported it for this thread. */
|
|
3014
3033
|
private mcpStartup;
|
|
@@ -3019,6 +3038,7 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3019
3038
|
* one stream; the thread id is what tells them apart (see {@link subagentOf}).
|
|
3020
3039
|
*/
|
|
3021
3040
|
private readonly subagents;
|
|
3041
|
+
constructor(deps: AgentProcessDeps);
|
|
3022
3042
|
protected spawnSpec(opts: AgentStartOptions): SpawnSpec;
|
|
3023
3043
|
/**
|
|
3024
3044
|
* `initialize`, then `thread/start`, both before the first user message. A
|
|
@@ -3028,16 +3048,18 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3028
3048
|
* construction. A task's runs as its mode says (see {@link threadParams}).
|
|
3029
3049
|
*/
|
|
3030
3050
|
protected handshake(opts: AgentStartOptions): Promise<void>;
|
|
3051
|
+
private handshakeIncomplete;
|
|
3031
3052
|
/**
|
|
3032
3053
|
* Open this session's thread. A resume id means the previous
|
|
3033
3054
|
* process died mid-session: `thread/resume` puts the agent back in front of
|
|
3034
3055
|
* the context it already paid to read. A planner's failed resume is not an
|
|
3035
|
-
* error —
|
|
3036
|
-
*
|
|
3037
|
-
*
|
|
3038
|
-
*
|
|
3056
|
+
* error — it falls back to a fresh thread, which is the same degradation
|
|
3057
|
+
* `restoreChat` performs on every surface (T4). A task's is: Continue (K1)
|
|
3058
|
+
* offers the session that did the work, and a fresh thread in its place
|
|
3059
|
+
* would pretend it was resumed.
|
|
3039
3060
|
*/
|
|
3040
|
-
private
|
|
3061
|
+
private openThread;
|
|
3062
|
+
private requestThread;
|
|
3041
3063
|
private threadParams;
|
|
3042
3064
|
/**
|
|
3043
3065
|
* Codex's own startup report for the server, which it sends once the thread
|
|
@@ -3048,10 +3070,12 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3048
3070
|
private effort;
|
|
3049
3071
|
/**
|
|
3050
3072
|
* `turn/interrupt` names the turn as well as the thread, so an interrupt
|
|
3051
|
-
* asked for before Codex has named the turn waits for it
|
|
3052
|
-
* with an empty result, then ends the turn as `interrupted`.
|
|
3073
|
+
* asked for before Codex has named the turn waits for it, as a steer does.
|
|
3074
|
+
* Codex acknowledges with an empty result, then ends the turn as `interrupted`.
|
|
3053
3075
|
*/
|
|
3054
3076
|
interrupt(timeoutMs: number): Promise<boolean>;
|
|
3077
|
+
/** Run `send` now if Codex has named the turn, and once it does if not. */
|
|
3078
|
+
private whenNamed;
|
|
3055
3079
|
/**
|
|
3056
3080
|
* `turn/steer` into the running turn (ADR-0023). Codex answers with the
|
|
3057
3081
|
* turn's id at once — acceptance, not delivery — and shows the input to the
|
|
@@ -3070,6 +3094,8 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3070
3094
|
*/
|
|
3071
3095
|
answerPermission(id: string, decision: ApprovalDecision): boolean;
|
|
3072
3096
|
protected turnPayload(message: string): string;
|
|
3097
|
+
/** `turn/start`'s answer. One for a turn that has since closed or been replaced names and closes nothing. */
|
|
3098
|
+
private turnAnswered;
|
|
3073
3099
|
protected handleLine(line: string, emit: (event: AgentEvent) => void): void;
|
|
3074
3100
|
private turnStarted;
|
|
3075
3101
|
/**
|
|
@@ -3148,8 +3174,8 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
3148
3174
|
* (ADR-0009, ADR-0018).
|
|
3149
3175
|
*
|
|
3150
3176
|
* The odd one out: `opencode serve` is a real server rather than a stdio
|
|
3151
|
-
* protocol, so this adapter owns both halves of the boundary — it
|
|
3152
|
-
* process
|
|
3177
|
+
* protocol, so this adapter owns both halves of the boundary — it starts the
|
|
3178
|
+
* process as the same {@link RunnerProcess} every other adapter uses, then
|
|
3153
3179
|
* talks to it through the injected `fetch`. Both are part of the one seam the
|
|
3154
3180
|
* tests drive.
|
|
3155
3181
|
*
|
|
@@ -3169,12 +3195,8 @@ declare class OpenCodeAdapter implements TaskModeAgentAdapter {
|
|
|
3169
3195
|
/** Sent on every request to a task's server, which a per-task password secures. */
|
|
3170
3196
|
private authorization;
|
|
3171
3197
|
private sessionId;
|
|
3172
|
-
private
|
|
3173
|
-
private exited;
|
|
3174
|
-
private exitCode;
|
|
3198
|
+
private readonly runner;
|
|
3175
3199
|
private disposed;
|
|
3176
|
-
private markEnded;
|
|
3177
|
-
private readonly processEnded;
|
|
3178
3200
|
private planner;
|
|
3179
3201
|
private task;
|
|
3180
3202
|
/** The last assistant message already settled — the baseline {@link recoverReply} measures a new reply against. */
|
|
@@ -3190,7 +3212,19 @@ declare class OpenCodeAdapter implements TaskModeAgentAdapter {
|
|
|
3190
3212
|
/** The Ordewell server this process was configured with; null when none was given or its config could not be merged. */
|
|
3191
3213
|
private ordewell;
|
|
3192
3214
|
constructor(deps: AgentProcessDeps);
|
|
3215
|
+
private get processEnded();
|
|
3216
|
+
private get exited();
|
|
3193
3217
|
start(opts: AgentStartOptions): Promise<void>;
|
|
3218
|
+
private launch;
|
|
3219
|
+
/**
|
|
3220
|
+
* Where `serve` listens, or null once it ends or gives up. Stdout only: that
|
|
3221
|
+
* is where `serve` prints its address, and stderr can carry another URL — a
|
|
3222
|
+
* warning about a provider it could not reach. Read a line at a time, and
|
|
3223
|
+
* only until the address is known.
|
|
3224
|
+
*/
|
|
3225
|
+
private serverAddress;
|
|
3226
|
+
/** From the server's address to an open session — the 2.x API's, or a 1.x one created or resumed. */
|
|
3227
|
+
private connect;
|
|
3194
3228
|
send(message: string, onEvent: (event: AgentEvent) => void, signal?: AbortSignal, onActivity?: () => void): Promise<void>;
|
|
3195
3229
|
/**
|
|
3196
3230
|
* One task turn. `prompt_async` only queues the work, so the turn is over
|
|
@@ -3340,12 +3374,155 @@ declare function mapAgentTool(name: string): MappedTool;
|
|
|
3340
3374
|
*/
|
|
3341
3375
|
declare function normalizeAgentArgs(tool: ResearchToolType, args: Record<string, unknown>): Record<string, unknown>;
|
|
3342
3376
|
|
|
3377
|
+
/** What a runner offers a task: the models discovered for it and the modes its manifest declares. */
|
|
3378
|
+
interface RunnerCatalog {
|
|
3379
|
+
models: DiscoveredModel[];
|
|
3380
|
+
modes: RunnerModeInfo[];
|
|
3381
|
+
/**
|
|
3382
|
+
* The mode a task lands on when it carries none this runner offers: the
|
|
3383
|
+
* manifest's `autonomous`/`safe`-tagged mode under the user's toggle
|
|
3384
|
+
* (ADR-0001). Absent, `modes[0]` stands in — which for Codex is its
|
|
3385
|
+
* workspace-write sandbox, not the full access an unattended run needs.
|
|
3386
|
+
*/
|
|
3387
|
+
defaultMode?: string;
|
|
3388
|
+
}
|
|
3389
|
+
/**
|
|
3390
|
+
* The model, thinking effort and mode a runner offers for a task.
|
|
3391
|
+
*
|
|
3392
|
+
* A task's model, effort and mode are all scoped to its runner:
|
|
3393
|
+
* `claude-sonnet-4-5` on Codex, or `acceptEdits` on OpenCode, are not degraded
|
|
3394
|
+
* choices but unspawnable ones. So this is where any task acquires a runnable
|
|
3395
|
+
* assignment — a runner change (below) and a hand-added task derive it the same
|
|
3396
|
+
* way. Each field in `current` is preserved when the runner also offers it, and
|
|
3397
|
+
* otherwise snapped to that runner's preferred entry (discovery already sorts
|
|
3398
|
+
* models by the manifest's `preferredPatterns`; the mode is the catalog's
|
|
3399
|
+
* `defaultMode`).
|
|
3400
|
+
*
|
|
3401
|
+
* An empty catalog means discovery failed or the runner is a plugin we have no
|
|
3402
|
+
* list for — not that the runner offers nothing. That field is left out of the
|
|
3403
|
+
* patch and the runner validates last, matching `coerceAssignments`.
|
|
3404
|
+
*/
|
|
3405
|
+
declare function runnerAssignment(catalog: RunnerCatalog, current?: Pick<Task, 'assignedModel' | 'taskMode'>): Partial<Task>;
|
|
3406
|
+
/**
|
|
3407
|
+
* Move a task onto a different runner, carrying its model, thinking effort and
|
|
3408
|
+
* mode over to values that runner actually offers. A runner change is never a
|
|
3409
|
+
* single-field edit — it either brings the other three with it or leaves the
|
|
3410
|
+
* task unrunnable.
|
|
3411
|
+
*
|
|
3412
|
+
* Returns the patch to apply, or `{}` when there is nothing to change.
|
|
3413
|
+
*/
|
|
3414
|
+
declare function retargetTaskRunner(task: Task, runner: RunnerId, catalog: RunnerCatalog): Partial<Task>;
|
|
3415
|
+
|
|
3416
|
+
type ModelsByRunner = Partial<Record<RunnerId, DiscoveredModel[]>>;
|
|
3417
|
+
interface SessionCatalogDeps {
|
|
3418
|
+
config: Pick<IConfig, 'enabledRunners' | 'autonomousMode'>;
|
|
3419
|
+
registry: Pick<RunnerRegistry, 'getManifest'>;
|
|
3420
|
+
modelResolver: Pick<ModelResolver, 'modelsForRunners' | 'getCachedRunnerModels'>;
|
|
3421
|
+
/** Read at each call: a toggle or allowlist edit made since the session was built counts (#69). */
|
|
3422
|
+
settings: () => {
|
|
3423
|
+
enabledRunners?: RunnerId[];
|
|
3424
|
+
modelAllowlist?: Record<string, string[]>;
|
|
3425
|
+
};
|
|
3426
|
+
/** The runners of the plan being edited; empty while the session has none. */
|
|
3427
|
+
planRunners: () => RunnerId[];
|
|
3428
|
+
}
|
|
3429
|
+
/**
|
|
3430
|
+
* What a session may assign: the enabled runners, their modes, the models
|
|
3431
|
+
* discovery found for them and the allowlist narrowing those. Every view of
|
|
3432
|
+
* it — the planner's per-turn block, its tools, a user's direct edit — reads
|
|
3433
|
+
* it here, so none can be shown or checked against something the others are not.
|
|
3434
|
+
*
|
|
3435
|
+
* The discovered models are remembered per runner and only ever merged into:
|
|
3436
|
+
* discovering one runner must not forget another's, since coercion later clamps
|
|
3437
|
+
* thinking efforts against whatever was last found.
|
|
3438
|
+
*/
|
|
3439
|
+
declare class SessionCatalog {
|
|
3440
|
+
private readonly deps;
|
|
3441
|
+
private discovered;
|
|
3442
|
+
constructor(deps: SessionCatalogDeps);
|
|
3443
|
+
/** The runners enabled right now. */
|
|
3444
|
+
enabledRunners(): RunnerId[];
|
|
3445
|
+
/**
|
|
3446
|
+
* The allowlist in force right now. Unset means no restriction — falling
|
|
3447
|
+
* back to the one planning started under would keep a restriction the user
|
|
3448
|
+
* has since cleared.
|
|
3449
|
+
*/
|
|
3450
|
+
allowlist(): Record<string, string[]>;
|
|
3451
|
+
/** The models the user allows on one runner; unset means no restriction. */
|
|
3452
|
+
allowlistFor(runner: RunnerId): string[] | undefined;
|
|
3453
|
+
/**
|
|
3454
|
+
* The discovered catalog as the resolver holds it now, per runner, with this
|
|
3455
|
+
* session's own discovery as the fallback where the resolver has nothing
|
|
3456
|
+
* cached. The resolver's cache outlives this session's snapshot in both
|
|
3457
|
+
* directions — an allowlist picker re-discovers into it mid-session — and a
|
|
3458
|
+
* model allowed after that must reach the planner with its real label and
|
|
3459
|
+
* variants, not as an id-only stub. Never triggers discovery itself.
|
|
3460
|
+
*/
|
|
3461
|
+
models(): ModelsByRunner;
|
|
3462
|
+
/** What this session's own discovery found for a runner; empty when it never ran there. */
|
|
3463
|
+
known(runner: RunnerId): DiscoveredModel[];
|
|
3464
|
+
/** Discover the runners' models, spawning their CLIs where the resolver has none cached, and remember them. */
|
|
3465
|
+
discover(runners: RunnerId[]): Promise<ModelsByRunner>;
|
|
3466
|
+
/**
|
|
3467
|
+
* Keep what an admitted runner was found to offer, for the next coercion's
|
|
3468
|
+
* effort clamping. An empty list is discovery having found nothing, not a
|
|
3469
|
+
* runner offering nothing, so it never displaces what is known.
|
|
3470
|
+
*/
|
|
3471
|
+
admit(runner: RunnerId, models: DiscoveredModel[]): void;
|
|
3472
|
+
/** Session boundaries are hard: nothing discovered for one goal informs the next. */
|
|
3473
|
+
reset(): void;
|
|
3474
|
+
modes(runners: RunnerId[]): Record<RunnerId, RunnerModeInfo[]>;
|
|
3475
|
+
/**
|
|
3476
|
+
* What a planner may assign right now: every enabled runner, its modes, and
|
|
3477
|
+
* its allowlisted models. Discovers a runner's models the first time it is
|
|
3478
|
+
* asked for.
|
|
3479
|
+
*/
|
|
3480
|
+
live(): Promise<TaskQueryCatalog>;
|
|
3481
|
+
queryCatalog(runners: RunnerId[]): TaskQueryCatalog;
|
|
3482
|
+
/**
|
|
3483
|
+
* The catalog a model/task-mode edit is checked against — the same
|
|
3484
|
+
* discovered models and manifest modes the per-turn catalog block shows the
|
|
3485
|
+
* planner, so a refusal here can never name something invalid that the
|
|
3486
|
+
* planner was never told about. The catalog is not filtered by the
|
|
3487
|
+
* allowlist here — `checkModelAndModeValidity` narrows by allowlist itself,
|
|
3488
|
+
* the same way `coerceAssignments` does.
|
|
3489
|
+
*/
|
|
3490
|
+
edit(runners?: RunnerId[]): EditCatalog;
|
|
3491
|
+
/** What a runner offers, as `runnerAssignment` needs it. Spawns the runner's CLI to list models. */
|
|
3492
|
+
runner(runner: RunnerId): Promise<RunnerCatalog>;
|
|
3493
|
+
/**
|
|
3494
|
+
* The one place planning discovers what it may draw from: the runners'
|
|
3495
|
+
* models and their modes. `filteredModels` is the allowlisted view a prompt
|
|
3496
|
+
* may show; `modelsByRunner` stays whole because coercion needs real labels
|
|
3497
|
+
* and variants.
|
|
3498
|
+
*/
|
|
3499
|
+
planning(runners: RunnerId[]): Promise<{
|
|
3500
|
+
modelsByRunner: Partial<Record<string, DiscoveredModel[]>>;
|
|
3501
|
+
filteredModels: Partial<Record<string, DiscoveredModel[]>>;
|
|
3502
|
+
runnerModes: Record<string, RunnerModeInfo[]>;
|
|
3503
|
+
}>;
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3343
3506
|
/** The dialogue record a fork carries — what {@link PlannerConversation.clone} returns. */
|
|
3344
3507
|
interface ForkedDialogue {
|
|
3345
3508
|
conversationHistory: ConversationMessage[];
|
|
3346
3509
|
researchLog: ResearchLogEntry[];
|
|
3347
3510
|
}
|
|
3348
3511
|
|
|
3512
|
+
/**
|
|
3513
|
+
* The planner turn (see CONTEXT.md): the one piece of planner work that holds
|
|
3514
|
+
* the conversation, from its claim to its settled outcome. Its signal is what a
|
|
3515
|
+
* stop aborts.
|
|
3516
|
+
*/
|
|
3517
|
+
declare class PlannerTurn {
|
|
3518
|
+
private readonly controller;
|
|
3519
|
+
private dropped;
|
|
3520
|
+
get signal(): AbortSignal;
|
|
3521
|
+
/** The plan it was answering was dropped under it, so nothing it settles may land. */
|
|
3522
|
+
get abandoned(): boolean;
|
|
3523
|
+
stop(): void;
|
|
3524
|
+
abandon(): void;
|
|
3525
|
+
}
|
|
3349
3526
|
/** A read made through a planner tool: refused once the turn's budget is gone, else answered, told to land when the budget asks it to. */
|
|
3350
3527
|
type ToolRead<T> = {
|
|
3351
3528
|
status: 'refused';
|
|
@@ -3386,7 +3563,7 @@ interface PlannerConversationHost {
|
|
|
3386
3563
|
* conversation never reaches into execution state directly.
|
|
3387
3564
|
*/
|
|
3388
3565
|
liveOutput: LiveOutputLookup;
|
|
3389
|
-
|
|
3566
|
+
isExecuting(): boolean;
|
|
3390
3567
|
/** The session's single mutation ritual: op → persist → notify (default: the plan). */
|
|
3391
3568
|
mutate(op: () => boolean, notify?: () => void): LegacyPlanState | null;
|
|
3392
3569
|
broadcast: SessionBroadcaster;
|
|
@@ -3401,6 +3578,8 @@ interface PlannerConversationHost {
|
|
|
3401
3578
|
queueEdit(userMessage: string): number;
|
|
3402
3579
|
/** Wake a scheduler an applied edit may have unblocked. */
|
|
3403
3580
|
afterEdit(): Promise<void>;
|
|
3581
|
+
/** The planner turn was stopped or abandoned: whatever it is waiting on (a parked approval) will never be answered. */
|
|
3582
|
+
turnAborted(): void;
|
|
3404
3583
|
}
|
|
3405
3584
|
/**
|
|
3406
3585
|
* A conversation edit (rewind, fork) the conversation refused because the
|
|
@@ -3419,6 +3598,25 @@ declare class ConversationEditError extends Error {
|
|
|
3419
3598
|
declare class ConversationBusyError extends ConversationEditError {
|
|
3420
3599
|
constructor(operation: string);
|
|
3421
3600
|
}
|
|
3601
|
+
/**
|
|
3602
|
+
* A planner turn that settled after the plan it was answering was dropped (a
|
|
3603
|
+
* new plan, another session adopted, the session closed), or after its call
|
|
3604
|
+
* was cut off by something other than its own stop. Nothing it produced was
|
|
3605
|
+
* committed: landing it would write one session's reply into another's
|
|
3606
|
+
* transcript.
|
|
3607
|
+
*/
|
|
3608
|
+
declare class PlannerTurnDiscardedError extends Error {
|
|
3609
|
+
constructor(options?: ErrorOptions);
|
|
3610
|
+
}
|
|
3611
|
+
/**
|
|
3612
|
+
* The user stopped the turn and the backend reported that as a thrown error
|
|
3613
|
+
* rather than a settled reply. Typed so a surface can stay quiet for it without
|
|
3614
|
+
* reading the message: some SDKs' abort errors are plain `Error`s by name, and
|
|
3615
|
+
* a real failure can mention "aborted" too.
|
|
3616
|
+
*/
|
|
3617
|
+
declare class PlannerTurnStoppedError extends Error {
|
|
3618
|
+
constructor(options?: ErrorOptions);
|
|
3619
|
+
}
|
|
3422
3620
|
/** A user message a rewind can fork the conversation from just before. */
|
|
3423
3621
|
interface RewindTarget {
|
|
3424
3622
|
/** Position in the transcript — what {@link PlannerConversation.cloneBefore} takes. */
|
|
@@ -3474,13 +3672,32 @@ declare class PlannerConversation {
|
|
|
3474
3672
|
private persisted;
|
|
3475
3673
|
/** Saves an execution event made while a turn may be in flight; see {@link restore}. */
|
|
3476
3674
|
private savedInBackground;
|
|
3477
|
-
private
|
|
3478
|
-
private compacting;
|
|
3675
|
+
private live;
|
|
3479
3676
|
private openTurn;
|
|
3480
3677
|
constructor(host: PlannerConversationHost);
|
|
3481
3678
|
get transcript(): readonly ConversationMessage[];
|
|
3482
|
-
/** Whether a
|
|
3679
|
+
/** Whether a planner turn holds the conversation. */
|
|
3483
3680
|
get isTurnInFlight(): boolean;
|
|
3681
|
+
/** Stop the planner turn in flight; it settles as stopped. False when none is. */
|
|
3682
|
+
stopTurn(): boolean;
|
|
3683
|
+
/**
|
|
3684
|
+
* Drop the planner turn in flight together with the plan it was answering:
|
|
3685
|
+
* it is stopped, whatever it settles is discarded, and the conversation is
|
|
3686
|
+
* free at once rather than when the abandoned turn finishes unwinding.
|
|
3687
|
+
*/
|
|
3688
|
+
abandonTurn(): void;
|
|
3689
|
+
/**
|
|
3690
|
+
* Run planner work that is not a conversation turn — one-shot plan
|
|
3691
|
+
* generation — as the planner turn, so it is stopped, refused and superseded
|
|
3692
|
+
* like one. It starts a fresh plan, so it supersedes the turn in flight.
|
|
3693
|
+
*/
|
|
3694
|
+
hold<T>(signal: AbortSignal | undefined, body: (turn: PlannerTurn) => Promise<T>): Promise<T>;
|
|
3695
|
+
/**
|
|
3696
|
+
* Take the conversation for a new planner turn. A caller's own signal stops
|
|
3697
|
+
* the turn too; the relay is detached on release because a caller may reuse
|
|
3698
|
+
* that signal, and a stale listener would stop the next turn with it.
|
|
3699
|
+
*/
|
|
3700
|
+
private claim;
|
|
3484
3701
|
/** The user turn being answered, for what the host raises during it — an approval the turn's research asks for. */
|
|
3485
3702
|
get currentTurnId(): string | undefined;
|
|
3486
3703
|
/**
|
|
@@ -3589,8 +3806,11 @@ declare class PlannerConversation {
|
|
|
3589
3806
|
* inside the host's mutation ritual.
|
|
3590
3807
|
*/
|
|
3591
3808
|
recordQueuedEditsFailed(messages: string[], reason: string): void;
|
|
3592
|
-
/**
|
|
3593
|
-
|
|
3809
|
+
/**
|
|
3810
|
+
* Open the conversation on the host's fresh plan: the goal is its first
|
|
3811
|
+
* message. `prepare` (discovery) runs inside the turn, so a stop reaches it.
|
|
3812
|
+
*/
|
|
3813
|
+
start(goal: string, prepare: () => Promise<ConversationOpening>, signal?: AbortSignal): Promise<LegacyPlanState>;
|
|
3594
3814
|
/**
|
|
3595
3815
|
* Every later user message, from the transcript append to a persisted
|
|
3596
3816
|
* outcome. A turn that throws before anything was persisted takes its own
|
|
@@ -3607,7 +3827,20 @@ declare class PlannerConversation {
|
|
|
3607
3827
|
*/
|
|
3608
3828
|
private editTouchesLiveWork;
|
|
3609
3829
|
private assertIdle;
|
|
3610
|
-
|
|
3830
|
+
/**
|
|
3831
|
+
* Refuse to land a turn that no longer belongs here: it was abandoned, its
|
|
3832
|
+
* plan is no longer the host's, or its call was cut off by something other
|
|
3833
|
+
* than its own stop (`IAiService.reset` under a plan change) — what such a
|
|
3834
|
+
* call hands back is a fragment of an answer to a dialogue that is gone.
|
|
3835
|
+
*/
|
|
3836
|
+
private assertCurrent;
|
|
3837
|
+
/**
|
|
3838
|
+
* A live conversation is only safe to continue in-place when it also
|
|
3839
|
+
* matches the model/effort configured right now — a harness planner's
|
|
3840
|
+
* running process was spawned with the old one baked in and cannot pick up
|
|
3841
|
+
* a switch (ADR-0009). Otherwise the turn resumes from the transcript.
|
|
3842
|
+
*/
|
|
3843
|
+
private canContinueLive;
|
|
3611
3844
|
/**
|
|
3612
3845
|
* Bracket one user turn with its start and end, under an id minted here:
|
|
3613
3846
|
* the turn is where the stream a surface draws begins and ends, and only the
|
|
@@ -3652,10 +3885,11 @@ declare class PlannerConversation {
|
|
|
3652
3885
|
*/
|
|
3653
3886
|
private taskQueryAnswer;
|
|
3654
3887
|
/**
|
|
3655
|
-
* Drive a planner turn to a persisted, broadcast
|
|
3656
|
-
* atomically; validation failures are fed back to
|
|
3657
|
-
* silent retries, then surfaced as a message with the
|
|
3658
|
-
* first turn and every later turn route through here —
|
|
3888
|
+
* Drive a planner turn, its reads already drained, to a persisted, broadcast
|
|
3889
|
+
* outcome. Task edits apply atomically; validation failures are fed back to
|
|
3890
|
+
* the model for up to 2 silent retries, then surfaced as a message with the
|
|
3891
|
+
* plan untouched. The first turn and every later turn route through here —
|
|
3892
|
+
* one path, not two.
|
|
3659
3893
|
*/
|
|
3660
3894
|
private settle;
|
|
3661
3895
|
/** Validate + commit a task_ops turn atomically. Returns the errors on rejection (plan untouched). */
|
|
@@ -3766,8 +4000,12 @@ interface SessionEventRelayDeps {
|
|
|
3766
4000
|
/** What a task's waiting checkpoint asks, whole. */
|
|
3767
4001
|
checkpointQuestion?: (taskId: string) => string | undefined;
|
|
3768
4002
|
}
|
|
3769
|
-
/**
|
|
3770
|
-
|
|
4003
|
+
/**
|
|
4004
|
+
* Every orchestrator event the relay announces. `onTaskSettled` is persistence
|
|
4005
|
+
* only and `onQueueReady` is the Session's cue to drain its queue, so both are
|
|
4006
|
+
* the Session's alone.
|
|
4007
|
+
*/
|
|
4008
|
+
type RelayObserver = Required<Omit<OrchestratorObserver, 'onTaskSettled' | 'onQueueReady'>>;
|
|
3771
4009
|
/**
|
|
3772
4010
|
* Turns orchestrator and planner events into {@link SessionMessage}
|
|
3773
4011
|
* broadcasts — the one place a surface's view of a Session is produced. It
|
|
@@ -3967,7 +4205,7 @@ declare function createSession(deps: SessionDeps): Session;
|
|
|
3967
4205
|
/** What {@link createSession} hands a Session: every collaborator, already built and wired. */
|
|
3968
4206
|
interface SessionParts {
|
|
3969
4207
|
config: IConfig;
|
|
3970
|
-
|
|
4208
|
+
catalog: SessionCatalog;
|
|
3971
4209
|
workspace: string;
|
|
3972
4210
|
fsAdapter: IFileSystem;
|
|
3973
4211
|
broadcast: SessionBroadcaster;
|
|
@@ -4012,7 +4250,7 @@ declare class Session {
|
|
|
4012
4250
|
private readonly runs;
|
|
4013
4251
|
private readonly store;
|
|
4014
4252
|
private readonly config;
|
|
4015
|
-
private readonly
|
|
4253
|
+
private readonly catalog;
|
|
4016
4254
|
private plan;
|
|
4017
4255
|
private goal;
|
|
4018
4256
|
private workspace;
|
|
@@ -4025,8 +4263,12 @@ declare class Session {
|
|
|
4025
4263
|
private readonly fetcher;
|
|
4026
4264
|
private readonly settingsFn;
|
|
4027
4265
|
private readonly save;
|
|
4028
|
-
/**
|
|
4029
|
-
private
|
|
4266
|
+
/** The queue drain in flight, which a second call joins; see {@link processQueuedMessages}. */
|
|
4267
|
+
private queueDrain;
|
|
4268
|
+
/** The queued messages the planner has been given, no longer the user's to take back. */
|
|
4269
|
+
private drainingIds;
|
|
4270
|
+
/** User controls in flight; see {@link withSave}. */
|
|
4271
|
+
private controlsInFlight;
|
|
4030
4272
|
private unsubObserver;
|
|
4031
4273
|
private readonly hostSessionId?;
|
|
4032
4274
|
private currentSessionId;
|
|
@@ -4059,7 +4301,7 @@ declare class Session {
|
|
|
4059
4301
|
/**
|
|
4060
4302
|
* The relay announces every orchestrator event; this adds the saves some of
|
|
4061
4303
|
* them owe, each made before the announcement so no surface sees state the
|
|
4062
|
-
* disk lacks.
|
|
4304
|
+
* disk lacks, and drains the queue the scheduler parked behind.
|
|
4063
4305
|
*/
|
|
4064
4306
|
private observer;
|
|
4065
4307
|
/**
|
|
@@ -4094,43 +4336,8 @@ declare class Session {
|
|
|
4094
4336
|
* session.
|
|
4095
4337
|
*/
|
|
4096
4338
|
reset(): void;
|
|
4097
|
-
/**
|
|
4098
|
-
* What a planner may assign right now: every enabled runner, its modes, and
|
|
4099
|
-
* its allowlisted models — read as of this call, so a runner enabled or an
|
|
4100
|
-
* allowlist edited since planning started is in it (#69). Discovers a
|
|
4101
|
-
* runner's models the first time it is asked for.
|
|
4102
|
-
*/
|
|
4339
|
+
/** What a planner may assign right now; see {@link SessionCatalog.live}. */
|
|
4103
4340
|
liveCatalog(): Promise<TaskQueryCatalog>;
|
|
4104
|
-
private catalogOf;
|
|
4105
|
-
private runnerModesFor;
|
|
4106
|
-
/**
|
|
4107
|
-
* The catalog a model/task-mode edit is checked against — the same
|
|
4108
|
-
* discovered models and manifest modes the per-turn catalog block shows the
|
|
4109
|
-
* planner, so a refusal here can never name something invalid that the
|
|
4110
|
-
* planner was never told about. The catalog is not filtered by the
|
|
4111
|
-
* allowlist here — {@link checkModelAndModeValidity} narrows by
|
|
4112
|
-
* allowlist itself, the same way `coerceAssignments` does.
|
|
4113
|
-
*/
|
|
4114
|
-
private editCatalog;
|
|
4115
|
-
/** The runners enabled right now — a toggle made since the session was built counts (#69). */
|
|
4116
|
-
private enabledRunners;
|
|
4117
|
-
/**
|
|
4118
|
-
* The allowlist in force right now. Unset means no restriction — falling
|
|
4119
|
-
* back to the one planning started under would keep a restriction the user
|
|
4120
|
-
* has since cleared.
|
|
4121
|
-
*/
|
|
4122
|
-
private allowlist;
|
|
4123
|
-
/**
|
|
4124
|
-
* The discovered catalog as the resolver holds it now, per runner, with this
|
|
4125
|
-
* session's own discovery as the fallback where the resolver has nothing
|
|
4126
|
-
* cached. The resolver's cache outlives this session's snapshot in both
|
|
4127
|
-
* directions — an allowlist picker re-discovers into it mid-session — and a
|
|
4128
|
-
* model allowed after that must reach the planner with its real label and
|
|
4129
|
-
* variants, not as an id-only stub. Never triggers discovery itself.
|
|
4130
|
-
*/
|
|
4131
|
-
private models;
|
|
4132
|
-
/** What a runner offers, as `runnerAssignment` needs it. Spawns the runner's CLI to list models. */
|
|
4133
|
-
private catalogFor;
|
|
4134
4341
|
get planState(): LegacyPlanState | null;
|
|
4135
4342
|
/**
|
|
4136
4343
|
* The live plan in the shape a saved session is read back as. The disk
|
|
@@ -4146,24 +4353,16 @@ declare class Session {
|
|
|
4146
4353
|
* nothing executing, and reporting it as executing is what left the plan
|
|
4147
4354
|
* unstartable after its last live task was cancelled.
|
|
4148
4355
|
*/
|
|
4149
|
-
get isExecuting(): boolean;
|
|
4150
4356
|
/** See {@link TaskOrchestrator.hasLiveWork} — a spawned runner, not merely an armed scheduler. */
|
|
4151
|
-
get
|
|
4357
|
+
get isExecuting(): boolean;
|
|
4152
4358
|
get status(): 'approved' | 'running' | 'completed';
|
|
4359
|
+
/** Whether a planner turn — a reply, a compaction, plan generation — holds the conversation. */
|
|
4360
|
+
get isPlannerBusy(): boolean;
|
|
4153
4361
|
/**
|
|
4154
|
-
*
|
|
4155
|
-
*
|
|
4156
|
-
* waiting on has no one left to serve, and denying it unblocks the research
|
|
4157
|
-
* loop instead of stranding it. Without this the request sat out its
|
|
4158
|
-
* five-minute timeout and the loop then carried on as if nothing had
|
|
4159
|
-
* happened — the abort was real, but invisible until long after the user
|
|
4160
|
-
* pressed stop.
|
|
4161
|
-
*
|
|
4162
|
-
* The listener is returned as a disposer rather than left attached: callers
|
|
4163
|
-
* own the signal and may reuse it, and a leaked listener would deny the
|
|
4164
|
-
* *next* turn's prompts the moment that stale signal aborted.
|
|
4362
|
+
* Stop the planner turn in flight. It still settles — a backend hands back
|
|
4363
|
+
* what it had — and ends as stopped. False when no turn is in flight.
|
|
4165
4364
|
*/
|
|
4166
|
-
|
|
4365
|
+
abortPlannerTurn(): boolean;
|
|
4167
4366
|
generatePlan(goal: string, runners: RunnerId[], options?: GeneratePlanOptions): Promise<LegacyPlanState>;
|
|
4168
4367
|
/**
|
|
4169
4368
|
* Kick off the planner conversation (ADR-0002): research + the first planner
|
|
@@ -4233,13 +4432,6 @@ declare class Session {
|
|
|
4233
4432
|
* bare /unknown through to be mis-resolved.
|
|
4234
4433
|
*/
|
|
4235
4434
|
private resolveSkillInvocation;
|
|
4236
|
-
/**
|
|
4237
|
-
* The one place planning discovers what it may draw from: the runners'
|
|
4238
|
-
* models (cached for later effort clamping), their modes, and the settings
|
|
4239
|
-
* in force. `filteredModels` is the allowlisted view a prompt may show;
|
|
4240
|
-
* `modelsByRunner` stays whole because coercion needs real labels and variants.
|
|
4241
|
-
*/
|
|
4242
|
-
private plannerCatalog;
|
|
4243
4435
|
private conversationOpening;
|
|
4244
4436
|
/**
|
|
4245
4437
|
* Load planner-produced tasks, coerced to the allowlist read live — it may
|
|
@@ -4276,7 +4468,17 @@ declare class Session {
|
|
|
4276
4468
|
cancelTask(taskId: string): Promise<void>;
|
|
4277
4469
|
markTaskComplete(taskId: string): Promise<void>;
|
|
4278
4470
|
markTaskIncomplete(taskId: string): Promise<void>;
|
|
4471
|
+
/**
|
|
4472
|
+
* Hand the queued edits to the planner. The Session does this itself each
|
|
4473
|
+
* time the scheduler parks behind the queue, so no surface has to; a caller
|
|
4474
|
+
* only needs it to await the drain. The messages stay queued until the
|
|
4475
|
+
* planner's answer is applied, so the scheduler stays paused behind them
|
|
4476
|
+
* meanwhile; one drain runs at a time, and a call made during it joins it.
|
|
4477
|
+
* Whatever was queued while it ran is drained after, before the run goes on.
|
|
4478
|
+
*/
|
|
4279
4479
|
processQueuedMessages(): Promise<void>;
|
|
4480
|
+
private drainQueue;
|
|
4481
|
+
private applyQueuedEdits;
|
|
4280
4482
|
/**
|
|
4281
4483
|
* Every finished task as the log records it: this run's own entries, plus
|
|
4282
4484
|
* the tasks earlier runs completed, which the log dropped when this run
|
|
@@ -4303,7 +4505,7 @@ declare class Session {
|
|
|
4303
4505
|
removeQueuedTaskMessage(taskId: string, id: string): boolean;
|
|
4304
4506
|
interruptTask(taskId: string): Promise<void>;
|
|
4305
4507
|
getQueuedMessages(): QueuedMessage[];
|
|
4306
|
-
/** Take back one unsent message; the plan's persisted queue follows so a reload cannot resurrect it. */
|
|
4508
|
+
/** Take back one unsent message — false once the planner has it; the plan's persisted queue follows so a reload cannot resurrect it. */
|
|
4307
4509
|
removeQueuedMessage(id: string): boolean;
|
|
4308
4510
|
setQueuedMessages(msgs: QueuedMessage[]): void;
|
|
4309
4511
|
/** Replay a run a dirty tree blocked, after stashing the tracked changes. */
|
|
@@ -4343,6 +4545,21 @@ declare class Session {
|
|
|
4343
4545
|
/** Add the task that merges a conflicted task's branch by hand; see {@link PlanEditor.addConflictResolver}. */
|
|
4344
4546
|
resolveConflictAsTask(taskId: string): Promise<LegacyPlanState | null>;
|
|
4345
4547
|
stopExecution(): void;
|
|
4548
|
+
/**
|
|
4549
|
+
* Run a user control and save what it changed before any surface hears of
|
|
4550
|
+
* it. Not a status hold, as {@link saved} is: these await spawns and git, so
|
|
4551
|
+
* a hold would stall every task's status for as long, and an
|
|
4552
|
+
* `execution_complete` the control triggers would overtake the status held
|
|
4553
|
+
* back — which a surface treats as the end of the stream. Instead each status
|
|
4554
|
+
* announced while one runs is saved first (see {@link observer}), as the
|
|
4555
|
+
* background save of an execution event: it may land mid planner turn. So
|
|
4556
|
+
* is the last one where the control is itself execution, not the user's
|
|
4557
|
+
* word on the plan (`background`).
|
|
4558
|
+
*/
|
|
4559
|
+
private withSave;
|
|
4560
|
+
private saveForControl;
|
|
4561
|
+
/** A control that finishes synchronously: its status is held until it is saved. */
|
|
4562
|
+
private saved;
|
|
4346
4563
|
/**
|
|
4347
4564
|
* The one mutation seam: every structural plan mutation runs the same
|
|
4348
4565
|
* ritual — store op → persist (which snapshots tasks from PlanStore) →
|
|
@@ -4399,6 +4616,261 @@ declare class PlanEditError extends Error {
|
|
|
4399
4616
|
constructor(message: string);
|
|
4400
4617
|
}
|
|
4401
4618
|
|
|
4619
|
+
/** What the user last picked for one planner backend. */
|
|
4620
|
+
interface PlannerModelChoice {
|
|
4621
|
+
model: string;
|
|
4622
|
+
effort?: string;
|
|
4623
|
+
}
|
|
4624
|
+
/**
|
|
4625
|
+
* A candidate model as this planner's catalog lists it. Deliberately plain
|
|
4626
|
+
* data: a harness planner's catalog is its runner's own model list and a
|
|
4627
|
+
* vendor's is a picker list (ADR-0009), and the rule below is the same for
|
|
4628
|
+
* both — so the caller normalizes, and this module never reaches for a
|
|
4629
|
+
* ModelResolver, a config or the network.
|
|
4630
|
+
*/
|
|
4631
|
+
interface PlannerModelCandidate {
|
|
4632
|
+
id: string;
|
|
4633
|
+
variants?: {
|
|
4634
|
+
id: string;
|
|
4635
|
+
}[];
|
|
4636
|
+
}
|
|
4637
|
+
interface PlannerModelRecall {
|
|
4638
|
+
model: string;
|
|
4639
|
+
effort: string;
|
|
4640
|
+
source: 'remembered' | 'catalog-default' | 'none';
|
|
4641
|
+
}
|
|
4642
|
+
/** The slice of `SettingsService` this needs, so tests can pass a plain object. */
|
|
4643
|
+
interface PlannerModelStore {
|
|
4644
|
+
getPlannerModel(provider: string): PlannerModelChoice | undefined;
|
|
4645
|
+
setPlannerModel(provider: string, entry: PlannerModelChoice | undefined): void;
|
|
4646
|
+
}
|
|
4647
|
+
/**
|
|
4648
|
+
* Remembers, per planner backend, the model the user last chose for it.
|
|
4649
|
+
*
|
|
4650
|
+
* Switching the planner has to clear the model — an id is scoped to the agent
|
|
4651
|
+
* that listed it, so an OpenRouter slug handed to Claude Code points it at
|
|
4652
|
+
* something it cannot spawn. That clear is correct and stays; what was missing
|
|
4653
|
+
* is that switching *back* then forced a re-pick of a model the user had
|
|
4654
|
+
* already chosen. Both surfaces' clears and the restore now read one rule from
|
|
4655
|
+
* here rather than three copies drifting apart.
|
|
4656
|
+
*/
|
|
4657
|
+
declare class PlannerModelMemory {
|
|
4658
|
+
private store;
|
|
4659
|
+
constructor(store: PlannerModelStore);
|
|
4660
|
+
/** Record what the user picked for `provider`; a blank model forgets it instead. */
|
|
4661
|
+
remember(provider: string, model: string, effort?: string): void;
|
|
4662
|
+
/**
|
|
4663
|
+
* What the model and effort should become when `provider` takes over the
|
|
4664
|
+
* planner, given the models it actually serves. The `source` is what the
|
|
4665
|
+
* three surfaces word their notice from — restored, defaulted, or nothing.
|
|
4666
|
+
*/
|
|
4667
|
+
recall(provider: string, catalog: PlannerModelCandidate[]): PlannerModelRecall;
|
|
4668
|
+
}
|
|
4669
|
+
|
|
4670
|
+
/**
|
|
4671
|
+
* The daemon contract: every HTTP body the local daemon sends, in one place.
|
|
4672
|
+
*
|
|
4673
|
+
* The daemon's routes build their bodies against these types and the CLI's
|
|
4674
|
+
* `ApiClient` reads them back, so a field added on one side is a compile error
|
|
4675
|
+
* on the other. Before this there were three hand-written copies — the routes'
|
|
4676
|
+
* inline `c.json`, the client's per-method generics, and the TUI's slice of the
|
|
4677
|
+
* client — and they had drifted (the client declared a `headless` field the
|
|
4678
|
+
* daemon never sent, and typed `GET /sessions/:id`'s plan as the wrong shape).
|
|
4679
|
+
*
|
|
4680
|
+
* Types only. Core is the one package both the daemon and its clients already
|
|
4681
|
+
* depend on; importing from the daemon would pull its runtime into the CLI.
|
|
4682
|
+
*/
|
|
4683
|
+
/**
|
|
4684
|
+
* Why a request was refused, as a stable code a client switches on instead of
|
|
4685
|
+
* reading the message. Absent on a refusal nobody needs to tell apart — a
|
|
4686
|
+
* missing field, say — where the message is all there is.
|
|
4687
|
+
*/
|
|
4688
|
+
type DaemonErrorCode = 'session_not_found' | 'task_not_found' | 'no_plan' | 'already_executing' | 'workspace_not_found' | 'workspace_not_a_project' | 'conversation_busy'
|
|
4689
|
+
/** The user stopped the planner turn: the turn ended as asked, so a client stays quiet. */
|
|
4690
|
+
| 'planner_turn_stopped'
|
|
4691
|
+
/** The planner turn settled after its plan was dropped; nothing it produced was kept. */
|
|
4692
|
+
| 'planner_turn_discarded'
|
|
4693
|
+
/** The request asked for something the plan, task or conversation does not allow. */
|
|
4694
|
+
| 'refused' | 'checkpoint_not_waiting' | 'approval_not_outstanding';
|
|
4695
|
+
/** The body of every non-2xx answer a route gives. */
|
|
4696
|
+
interface ErrorBody {
|
|
4697
|
+
error: string;
|
|
4698
|
+
code?: DaemonErrorCode;
|
|
4699
|
+
/** Set with `workspace_not_a_project`: the directory the daemon refused, so a client can offer to initialize it. */
|
|
4700
|
+
workspace?: string;
|
|
4701
|
+
}
|
|
4702
|
+
interface OkResponse {
|
|
4703
|
+
ok: boolean;
|
|
4704
|
+
}
|
|
4705
|
+
/**
|
|
4706
|
+
* A plan as the planner routes return it: the session's plan state itself, not
|
|
4707
|
+
* the `SerializedPlan` a websocket `plan_generated` carries. The two differ —
|
|
4708
|
+
* this one holds raw tasks and the dialogue's bookkeeping — and a client that
|
|
4709
|
+
* reads either reads only the fields it needs.
|
|
4710
|
+
*/
|
|
4711
|
+
interface PlanResponse {
|
|
4712
|
+
plan: LegacyPlanState;
|
|
4713
|
+
}
|
|
4714
|
+
/** `POST /plans/:id/resolve-conflict`: `null` when the session had no conflict to hand a resolver task. */
|
|
4715
|
+
interface ResolveConflictResponse {
|
|
4716
|
+
plan: LegacyPlanState | null;
|
|
4717
|
+
}
|
|
4718
|
+
/** What `GET /api/models` returns, and what the pool's provider discovery produces. */
|
|
4719
|
+
interface ModelsResponse {
|
|
4720
|
+
models: DiscoveredModel[];
|
|
4721
|
+
modelsByRunner: Record<string, DiscoveredModel[]>;
|
|
4722
|
+
/** Each runner's manifest modes, so a surface can offer a per-task mode picker. */
|
|
4723
|
+
modesByRunner: Record<string, RunnerModeInfo[]>;
|
|
4724
|
+
orchestratorModel: string;
|
|
4725
|
+
providers: AiProvider[];
|
|
4726
|
+
/** Full cross-provider catalog for the orchestrator (planner) model picker. */
|
|
4727
|
+
orchestratorModels: OrchestratorOption[];
|
|
4728
|
+
/** Per-provider catalog-fetch failures, keyed by provider id. */
|
|
4729
|
+
providerErrors: Record<string, string>;
|
|
4730
|
+
}
|
|
4731
|
+
/** One-shot planning answers in the phase-tagged shape a saved session is read back in. */
|
|
4732
|
+
interface GeneratePlanResponse extends Pick<ModelsResponse, 'models' | 'modelsByRunner'> {
|
|
4733
|
+
plan: PlanState;
|
|
4734
|
+
}
|
|
4735
|
+
interface ExecuteResponse {
|
|
4736
|
+
status: 'running';
|
|
4737
|
+
}
|
|
4738
|
+
interface StopResponse {
|
|
4739
|
+
status: 'stopped';
|
|
4740
|
+
}
|
|
4741
|
+
interface CancelPlanningResponse {
|
|
4742
|
+
cancelled: boolean;
|
|
4743
|
+
}
|
|
4744
|
+
interface TaskMessageResponse {
|
|
4745
|
+
id: string;
|
|
4746
|
+
}
|
|
4747
|
+
interface ForceSendResponse {
|
|
4748
|
+
sent: boolean;
|
|
4749
|
+
}
|
|
4750
|
+
interface RemoveMessageResponse {
|
|
4751
|
+
removed: boolean;
|
|
4752
|
+
}
|
|
4753
|
+
interface MergeGateEntry {
|
|
4754
|
+
id: string;
|
|
4755
|
+
order: number;
|
|
4756
|
+
title: string;
|
|
4757
|
+
}
|
|
4758
|
+
interface MergeGateResponse {
|
|
4759
|
+
mergeGate: MergeGateEntry[];
|
|
4760
|
+
}
|
|
4761
|
+
interface IsolationDiffResponse {
|
|
4762
|
+
diff: string;
|
|
4763
|
+
}
|
|
4764
|
+
/** A merge that conflicts or is blocked is an outcome, not a refusal, so it answers 200 with the result. */
|
|
4765
|
+
type IsolationMergeResponse = IsolationMergeResult;
|
|
4766
|
+
/** A fork the daemon has already adopted. */
|
|
4767
|
+
interface ConversationForkResponse {
|
|
4768
|
+
sessionId: string;
|
|
4769
|
+
goal: string;
|
|
4770
|
+
plan: LegacyPlanState;
|
|
4771
|
+
}
|
|
4772
|
+
/** A fork made by a rewind, with the full text of the message it was made just before. */
|
|
4773
|
+
interface ConversationRewindResponse extends ConversationForkResponse {
|
|
4774
|
+
rewoundMessage: string;
|
|
4775
|
+
}
|
|
4776
|
+
interface RewindTargetsResponse {
|
|
4777
|
+
targets: RewindTarget[];
|
|
4778
|
+
}
|
|
4779
|
+
interface ConversationCompactResponse extends ConversationCompaction, PlanResponse {
|
|
4780
|
+
}
|
|
4781
|
+
interface PrdResponse {
|
|
4782
|
+
prdMarkdown: string;
|
|
4783
|
+
}
|
|
4784
|
+
interface RunnerEntry {
|
|
4785
|
+
id: string;
|
|
4786
|
+
name: string;
|
|
4787
|
+
enabled: boolean;
|
|
4788
|
+
}
|
|
4789
|
+
interface RunnersResponse {
|
|
4790
|
+
runners: RunnerEntry[];
|
|
4791
|
+
orchestratorModel: string;
|
|
4792
|
+
}
|
|
4793
|
+
/** Sessions: a saved one comes off its file, a live one from the pool's store. */
|
|
4794
|
+
interface SessionResponse {
|
|
4795
|
+
meta: SessionMeta;
|
|
4796
|
+
plan: PlanState;
|
|
4797
|
+
}
|
|
4798
|
+
interface AdoptSessionResponse extends OkResponse {
|
|
4799
|
+
plan: LegacyPlanState;
|
|
4800
|
+
goal: string;
|
|
4801
|
+
}
|
|
4802
|
+
interface TaskLogAttemptsResponse {
|
|
4803
|
+
attempts: number[];
|
|
4804
|
+
}
|
|
4805
|
+
interface TaskLogResponse {
|
|
4806
|
+
attempt: number;
|
|
4807
|
+
events: TaskLogEvent[];
|
|
4808
|
+
}
|
|
4809
|
+
type SessionListResponse = SessionMeta[];
|
|
4810
|
+
interface SettingsResponse {
|
|
4811
|
+
orchestratorModel: string;
|
|
4812
|
+
/** Who plans (ADR-0009) — a vendor id, or one of the three harness planners. */
|
|
4813
|
+
aiProvider: AiProvider;
|
|
4814
|
+
plannerThinkingEffort: string;
|
|
4815
|
+
maxParallel: number;
|
|
4816
|
+
tdd: UserSettings['tdd'];
|
|
4817
|
+
verification: UserSettings['verification'];
|
|
4818
|
+
modelAllowlist: UserSettings['modelAllowlist'];
|
|
4819
|
+
plannerModels: UserSettings['plannerModels'];
|
|
4820
|
+
runnerTransport: RunnerTransport;
|
|
4821
|
+
}
|
|
4822
|
+
/** What `PATCH /api/settings` answers: the settings as they now stand, plus what the write itself decided. */
|
|
4823
|
+
interface SettingsUpdateResponse extends SettingsResponse {
|
|
4824
|
+
/**
|
|
4825
|
+
* Which model a planner switch landed on and why — remembered for that
|
|
4826
|
+
* backend, its catalog default, or none. Present only when the write changed
|
|
4827
|
+
* the planner; absent for every other write, where nothing was recalled.
|
|
4828
|
+
*/
|
|
4829
|
+
switchRecall?: PlannerModelRecall;
|
|
4830
|
+
/** Env keys the daemon refused to apply, so a client does not persist what the daemon would not. */
|
|
4831
|
+
rejectedEnvKeys?: string[];
|
|
4832
|
+
}
|
|
4833
|
+
interface CommandDescriptor {
|
|
4834
|
+
name: string;
|
|
4835
|
+
description: string;
|
|
4836
|
+
}
|
|
4837
|
+
interface CommandsResponse {
|
|
4838
|
+
commands: CommandDescriptor[];
|
|
4839
|
+
}
|
|
4840
|
+
interface CommandResponse extends OkResponse {
|
|
4841
|
+
settings: SettingsResponse;
|
|
4842
|
+
}
|
|
4843
|
+
interface WorkspacesResponse {
|
|
4844
|
+
workspaces: string[];
|
|
4845
|
+
}
|
|
4846
|
+
interface ApprovalsResponse {
|
|
4847
|
+
pending: PendingApproval[];
|
|
4848
|
+
approvedScopes: string[];
|
|
4849
|
+
}
|
|
4850
|
+
interface ApprovalAnswerResponse extends OkResponse {
|
|
4851
|
+
granted: boolean;
|
|
4852
|
+
decision: ApprovalDecision['decision'];
|
|
4853
|
+
}
|
|
4854
|
+
|
|
4855
|
+
/**
|
|
4856
|
+
* Why a call on a session could not be made. Each is a class rather than a
|
|
4857
|
+
* message so the daemon can map it to a status and a stable code in one place,
|
|
4858
|
+
* and a client can switch on that code instead of reading the wording. Like
|
|
4859
|
+
* `PlanEditError`, none carries a status: core is transport-agnostic.
|
|
4860
|
+
*/
|
|
4861
|
+
/** No session with that id is held — never planned in this process, or dropped by a restart. */
|
|
4862
|
+
declare class SessionNotFoundError extends Error {
|
|
4863
|
+
constructor();
|
|
4864
|
+
}
|
|
4865
|
+
/** The session holds no plan (or an empty one) for the operation to act on. */
|
|
4866
|
+
declare class NoPlanError extends Error {
|
|
4867
|
+
constructor(operation: 'execute' | 'review');
|
|
4868
|
+
}
|
|
4869
|
+
/** A run is already live, and starting another would reset the one in flight. */
|
|
4870
|
+
declare class AlreadyExecutingError extends Error {
|
|
4871
|
+
constructor();
|
|
4872
|
+
}
|
|
4873
|
+
|
|
4402
4874
|
/**
|
|
4403
4875
|
* Where Ordewell keeps machine-global data (settings, daemon tokens, caches,
|
|
4404
4876
|
* user plugins). A single home for everything not tied to a project directory,
|
|
@@ -4537,6 +5009,8 @@ declare class VerdictEngine {
|
|
|
4537
5009
|
markComplete(task: Task): Verdict;
|
|
4538
5010
|
/** Clear verification state for a task (used on retry). */
|
|
4539
5011
|
clear(task: Task): void;
|
|
5012
|
+
/** Drop a task's verification state and invalidate any callbacks still holding its generation. */
|
|
5013
|
+
private ceaseTracking;
|
|
4540
5014
|
/** Drop all tracking state (used on stop / loadPlan). */
|
|
4541
5015
|
reset(): void;
|
|
4542
5016
|
private decide;
|
|
@@ -4623,45 +5097,6 @@ declare function clampThinkingEffort(effort: string | undefined, variants: {
|
|
|
4623
5097
|
}[]): string | undefined;
|
|
4624
5098
|
declare function coerceAssignments(tasks: readonly Task[], perRunnerAllowlist: Partial<Record<RunnerId, string[]>>, allowedRunners?: RunnerId[], modelsByRunner?: Partial<Record<RunnerId, DiscoveredModel[]>>): Task[];
|
|
4625
5099
|
|
|
4626
|
-
/** What a runner offers a task: the models discovered for it and the modes its manifest declares. */
|
|
4627
|
-
interface RunnerCatalog {
|
|
4628
|
-
models: DiscoveredModel[];
|
|
4629
|
-
modes: RunnerModeInfo[];
|
|
4630
|
-
/**
|
|
4631
|
-
* The mode a task lands on when it carries none this runner offers: the
|
|
4632
|
-
* manifest's `autonomous`/`safe`-tagged mode under the user's toggle
|
|
4633
|
-
* (ADR-0001). Absent, `modes[0]` stands in — which for Codex is its
|
|
4634
|
-
* workspace-write sandbox, not the full access an unattended run needs.
|
|
4635
|
-
*/
|
|
4636
|
-
defaultMode?: string;
|
|
4637
|
-
}
|
|
4638
|
-
/**
|
|
4639
|
-
* The model, thinking effort and mode a runner offers for a task.
|
|
4640
|
-
*
|
|
4641
|
-
* A task's model, effort and mode are all scoped to its runner:
|
|
4642
|
-
* `claude-sonnet-4-5` on Codex, or `acceptEdits` on OpenCode, are not degraded
|
|
4643
|
-
* choices but unspawnable ones. So this is where any task acquires a runnable
|
|
4644
|
-
* assignment — a runner change (below) and a hand-added task derive it the same
|
|
4645
|
-
* way. Each field in `current` is preserved when the runner also offers it, and
|
|
4646
|
-
* otherwise snapped to that runner's preferred entry (discovery already sorts
|
|
4647
|
-
* models by the manifest's `preferredPatterns`; the mode is the catalog's
|
|
4648
|
-
* `defaultMode`).
|
|
4649
|
-
*
|
|
4650
|
-
* An empty catalog means discovery failed or the runner is a plugin we have no
|
|
4651
|
-
* list for — not that the runner offers nothing. That field is left out of the
|
|
4652
|
-
* patch and the runner validates last, matching `coerceAssignments`.
|
|
4653
|
-
*/
|
|
4654
|
-
declare function runnerAssignment(catalog: RunnerCatalog, current?: Pick<Task, 'assignedModel' | 'taskMode'>): Partial<Task>;
|
|
4655
|
-
/**
|
|
4656
|
-
* Move a task onto a different runner, carrying its model, thinking effort and
|
|
4657
|
-
* mode over to values that runner actually offers. A runner change is never a
|
|
4658
|
-
* single-field edit — it either brings the other three with it or leaves the
|
|
4659
|
-
* task unrunnable.
|
|
4660
|
-
*
|
|
4661
|
-
* Returns the patch to apply, or `{}` when there is nothing to change.
|
|
4662
|
-
*/
|
|
4663
|
-
declare function retargetTaskRunner(task: Task, runner: RunnerId, catalog: RunnerCatalog): Partial<Task>;
|
|
4664
|
-
|
|
4665
5100
|
declare function buildResearchToolsPrompt(): string;
|
|
4666
5101
|
/**
|
|
4667
5102
|
* System prompt for one read-only research subagent (issue #34). The digest
|
|
@@ -5435,6 +5870,8 @@ interface KillTreeDeps {
|
|
|
5435
5870
|
unref?: () => void;
|
|
5436
5871
|
};
|
|
5437
5872
|
clearTimeoutImpl?: (handle: unknown) => void;
|
|
5873
|
+
/** Signals a pid, or a process group as its negated id. Injected so the group path needs no real processes. */
|
|
5874
|
+
killImpl?: (pid: number, signal: NodeJS.Signals | 0) => void;
|
|
5438
5875
|
}
|
|
5439
5876
|
/**
|
|
5440
5877
|
* Terminate `proc` and everything it started.
|
|
@@ -5664,57 +6101,6 @@ declare function sanitizeSlug(raw: string): string;
|
|
|
5664
6101
|
/** Save the PRD to `<workspace>/.scratch/<slug>/PRD.md` (to-prd native convention). */
|
|
5665
6102
|
declare function savePrdMarkdown(workspace: string, slug: string, markdown: string): string;
|
|
5666
6103
|
|
|
5667
|
-
/** What the user last picked for one planner backend. */
|
|
5668
|
-
interface PlannerModelChoice {
|
|
5669
|
-
model: string;
|
|
5670
|
-
effort?: string;
|
|
5671
|
-
}
|
|
5672
|
-
/**
|
|
5673
|
-
* A candidate model as this planner's catalog lists it. Deliberately plain
|
|
5674
|
-
* data: a harness planner's catalog is its runner's own model list and a
|
|
5675
|
-
* vendor's is a picker list (ADR-0009), and the rule below is the same for
|
|
5676
|
-
* both — so the caller normalizes, and this module never reaches for a
|
|
5677
|
-
* ModelResolver, a config or the network.
|
|
5678
|
-
*/
|
|
5679
|
-
interface PlannerModelCandidate {
|
|
5680
|
-
id: string;
|
|
5681
|
-
variants?: {
|
|
5682
|
-
id: string;
|
|
5683
|
-
}[];
|
|
5684
|
-
}
|
|
5685
|
-
interface PlannerModelRecall {
|
|
5686
|
-
model: string;
|
|
5687
|
-
effort: string;
|
|
5688
|
-
source: 'remembered' | 'catalog-default' | 'none';
|
|
5689
|
-
}
|
|
5690
|
-
/** The slice of `SettingsService` this needs, so tests can pass a plain object. */
|
|
5691
|
-
interface PlannerModelStore {
|
|
5692
|
-
getPlannerModel(provider: string): PlannerModelChoice | undefined;
|
|
5693
|
-
setPlannerModel(provider: string, entry: PlannerModelChoice | undefined): void;
|
|
5694
|
-
}
|
|
5695
|
-
/**
|
|
5696
|
-
* Remembers, per planner backend, the model the user last chose for it.
|
|
5697
|
-
*
|
|
5698
|
-
* Switching the planner has to clear the model — an id is scoped to the agent
|
|
5699
|
-
* that listed it, so an OpenRouter slug handed to Claude Code points it at
|
|
5700
|
-
* something it cannot spawn. That clear is correct and stays; what was missing
|
|
5701
|
-
* is that switching *back* then forced a re-pick of a model the user had
|
|
5702
|
-
* already chosen. Both surfaces' clears and the restore now read one rule from
|
|
5703
|
-
* here rather than three copies drifting apart.
|
|
5704
|
-
*/
|
|
5705
|
-
declare class PlannerModelMemory {
|
|
5706
|
-
private store;
|
|
5707
|
-
constructor(store: PlannerModelStore);
|
|
5708
|
-
/** Record what the user picked for `provider`; a blank model forgets it instead. */
|
|
5709
|
-
remember(provider: string, model: string, effort?: string): void;
|
|
5710
|
-
/**
|
|
5711
|
-
* What the model and effort should become when `provider` takes over the
|
|
5712
|
-
* planner, given the models it actually serves. The `source` is what the
|
|
5713
|
-
* three surfaces word their notice from — restored, defaulted, or nothing.
|
|
5714
|
-
*/
|
|
5715
|
-
recall(provider: string, catalog: PlannerModelCandidate[]): PlannerModelRecall;
|
|
5716
|
-
}
|
|
5717
|
-
|
|
5718
6104
|
/** How many AI tasks may run at once: `ORDEWELL_MAX_PARALLEL`, `/parallel`, `ordewell.maxParallelSessions`. */
|
|
5719
6105
|
declare const DEFAULT_MAX_PARALLEL = 3;
|
|
5720
6106
|
/**
|
|
@@ -5725,4 +6111,4 @@ declare const DEFAULT_MAX_PARALLEL = 3;
|
|
|
5725
6111
|
*/
|
|
5726
6112
|
declare function parseMaxParallel(value: unknown): number | null;
|
|
5727
6113
|
|
|
5728
|
-
export { ALLOWED_PLUGIN_HOSTS, ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type Adr0013IsolationRun, type Adr0013PlanIsolation, type Adr0013TaskRecord, AgentAdapter, AgentEvent, AgentProcessDeps, AgentStartOptions, AiProvider, ApplyTaskOpsResult, ApprovalAnswer, ApprovalDecision, ApprovalMode, ApprovalPolicy, ApprovalRequest, type AskOptions, AwaitingReason, BUILTIN_SKILL_NAMES, BaseAiService, BaseConfig, BaseFileSystem, BufferedTaskOutputSource, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CORE_PLANNER_PROMPT, type CappedRows, CheckpointAnswer, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, type CommandTier, type ComposeOptions, ConsoleLogger, ContextCollector, type Continuability, ConversationBusyError, type ConversationCompaction, ConversationEditError, type ConversationFork, ConversationMessage, type ConversationRequest, type ConversationRewind, type ConversationTurn, type ConversationVariant, DAEMON_SUBPROTOCOL, DAEMON_TOKEN_SUBPROTOCOL_PREFIX, DEFAULT_MAX_PARALLEL, DiscoveredModel, type EnvAdmission, EnvConfig, type ExecFileFn, type ExecImpl, FindSymbolOptions, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GREP_PCRE_PROBE_ARGS, GeminiService, type GitExecFn, GlobOptions, type GrepInvocation, GrepOptions, type GrepRegex, type HasBinFn, HomeTranscriptReader, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, IWorktreeIsolation, IsolationHandoff, IsolationLandedTask, IsolationMergeResult, IsolationOutcome, IsolationRun, IsolationTaskRecord, IsolationTaskStatus, IsolationView, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, LegacyPlanState, type LiveOutputLookup, type LiveTail, type LiveTailOptions, type MappedTool, MergeGateView, ModelResolver, type ModelResolverDeps, type ModifyPlanRequest, type NotificationAction, OPENCODE_MANIFEST, ORDEWELL_SETTABLE_ENV, OUTPUT_LINES_DEFAULT, OUTPUT_LINES_MAX, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, OrdewellMcpServer, PLUGIN_NAME_PATTERN, PROVIDER_CREDENTIAL_ENV, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanEditError, PlanIsolation, PlanParseError, type PlanRequest, PlanState, PlanStatus, PlanStore, Planner, type PlannerModelCandidate, type PlannerModelChoice, PlannerModelMemory, type PlannerModelRecall, type PlannerModelStore, type PlannerReplyClassification, type PlannerRuntimeToggles, type PlannerSubmission, PlannerToolHandler, PlannerUsage, type PluginSource, type PrdBlock, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, QueuedTaskMessage, REFUSED_COMMANDS, ReadFileOpts, RepairEvidence, type RepairLoopOpts, type RepairVerdict, RepoGroupLayout, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchToolType, type ResearchTurn, ResolveContext, type RewindTarget, RunnerApprovals, type RunnerCatalog, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, RunnerSpawnOptions, RunnerTransport, SETTINGS_ENV_ALLOWLIST, SETTINGS_ENV_REFUSED, STATE_DIR, STOPPED_TOOL_RESULT, SYMBOL_LANGUAGES, type SaveSession, Session, SessionBroadcaster, type SessionData, type SessionDeps, SessionMessage, type SessionMeta, SessionNotice, type SessionPlanner, type SessionRuntimeSettings, SettingsService, type ShellDialect, type SkillInfo, type SkillMetadata, SkillsService, type SpawnSpec, StdioAgentAdapter, StructuredEvent, StructuredRunner, type StructuredRunnerDeps, StructuredSession, StructuredSessionCapability, StructuredTurnEnd, TASK_QUERY_ANSWER_MAX_CHARS, TASK_QUERY_ANSWER_OR_OPS, TASK_QUERY_FIELDS, TASK_QUERY_PROTOCOL, TASK_QUERY_REMINDER, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, type TaskAttemptSnapshot, TaskCompleteArgs, TaskControlError, TaskIsolation, TaskLogEvent, type TaskLogFile, type TaskLogLocation, TaskLogRecorder, type TaskLogRecorderDeps, TaskModeAgentAdapter, TaskOp, TaskOrchestrator, type TaskOrchestratorDeps, type TaskOrchestratorOptions, type TaskOutputAttempt, type TaskOutputSource, type TaskQuery, type TaskQueryCatalog, type TaskQueryField, TaskRunnerFlags, TaskSnapshot, TaskStartOptions, TaskTokenScope, TmuxRunner, type TmuxRunnerDeps, type TokenCarriers, type ToolCall, ToolOutcome, type ToolResult, type TranscriptQuery, type TranscriptReader, type TransportRoute, TransportRouter, TreeSnapshot, UsageRecord, type UserSettings, Verdict, VerdictEngine, type VerdictListener, type WorkspaceCheckDeps, WorkspaceNotAProjectError, WorkspaceNotFoundError, type WorkspaceProjectCheckDeps, type WorktreeIsolationDeps, admitSettingsEnv, applyHeadLimit, assertInstallablePluginUrl, assertPlainPluginName, assertWorkspaceExists, assertWorkspaceIsProject, augmentPromptWithPriorOutputs, augmentedPath, bearerHeaderValue, buildConflictRepairPrompt, buildConflictResolutionPrompt, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildSplitPrompt, buildSubagentSystemPrompt, canContinue, clampThinkingEffort, classifyCommand, classifyPlannerReply, classifyPluginSource, clearAugmentedPathCache, clearDaemonToken, clearResearchShellCache, clearState, clipboardCopyCommand, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, composeContinuationPrompt, configuredProviders, continuability, createAiService, createSession, createSkillsService, createTaskAdapter,
|
|
6114
|
+
export { ALLOWED_PLUGIN_HOSTS, ALL_PROVIDERS, AUTO_COMMANDS, AbstractRunner, AbstractTerminalSession, ActiveTaskSession, type AdoptSessionResponse, type Adr0013IsolationRun, type Adr0013PlanIsolation, type Adr0013TaskRecord, AgentAdapter, AgentEvent, AgentProcessDeps, AgentStartOptions, AiProvider, AlreadyExecutingError, ApplyTaskOpsResult, ApprovalAnswer, type ApprovalAnswerResponse, ApprovalDecision, ApprovalMode, ApprovalPolicy, ApprovalRequest, type ApprovalsResponse, type AskOptions, AwaitingReason, BUILTIN_SKILL_NAMES, BaseAiService, BaseConfig, BaseFileSystem, BufferedTaskOutputSource, CLAUDE_CODE_MANIFEST, CLI_PROVIDERS, CORE_PLANNER_PROMPT, type CancelPlanningResponse, type CappedRows, CheckpointAnswer, type CheckpointListener, ClaudeCodeAdapter, CliAgentAiService, type CliAgentAiServiceDeps, CodexAdapter, type CommandClassification, type CommandDescriptor, type CommandResponse, type CommandTier, type CommandsResponse, type ComposeOptions, ConsoleLogger, ContextCollector, type Continuability, ConversationBusyError, type ConversationCompactResponse, type ConversationCompaction, ConversationEditError, type ConversationFork, type ConversationForkResponse, ConversationMessage, type ConversationRequest, type ConversationRewind, type ConversationRewindResponse, type ConversationTurn, type ConversationVariant, DAEMON_SUBPROTOCOL, DAEMON_TOKEN_SUBPROTOCOL_PREFIX, DEFAULT_MAX_PARALLEL, type DaemonErrorCode, DiscoveredModel, type EnvAdmission, EnvConfig, type ErrorBody, type ExecFileFn, type ExecImpl, type ExecuteResponse, FindSymbolOptions, type ForceSendResponse, FsPluginStore, GIT_READONLY_SUBCOMMANDS, GREP_PCRE_PROBE_ARGS, GeminiService, type GeneratePlanResponse, type GitExecFn, GlobOptions, type GrepInvocation, GrepOptions, type GrepRegex, HARNESS_PLANNER_REASON, type HasBinFn, HomeTranscriptReader, type IAiService, IApproval, IConfig, IFileSystem, type ILogger, type INotification, IPluginStore, ITerminalRunner, ITerminalSession, IWorktreeIsolation, type IsolationDiffResponse, IsolationHandoff, IsolationLandedTask, type IsolationMergeResponse, IsolationMergeResult, IsolationOutcome, IsolationRun, IsolationTaskRecord, IsolationTaskStatus, IsolationView, JSON_REPAIR_INSTRUCTION, type KillTreeDeps, LegacyPlanState, type LiveOutputLookup, type LiveTail, type LiveTailOptions, type MappedTool, type MergeGateEntry, type MergeGateResponse, MergeGateView, ModelResolver, type ModelResolverDeps, type ModelsResponse, type ModifyPlanRequest, NoPlanError, type NotificationAction, OPENCODE_MANIFEST, ORDEWELL_SETTABLE_ENV, OUTPUT_LINES_DEFAULT, OUTPUT_LINES_MAX, type OkResponse, OpenAiService, OpenCodeAdapter, type OrchestratorObserver, OrchestratorOption, OrdewellMcpServer, PLUGIN_NAME_PATTERN, PROVIDER_CREDENTIAL_ENV, PROVIDER_DETECT_PRIORITY, PROVIDER_LABEL, PROVIDER_PRIORITY, PROVIDER_SHORT_LABEL, type PendingApproval, PendingApprovals, type PendingApprovalsOptions, PlanEditError, PlanIsolation, PlanParseError, type PlanRequest, type PlanResponse, PlanState, PlanStatus, PlanStore, Planner, type PlannerBackendEntry, type PlannerModelCandidate, type PlannerModelChoice, PlannerModelMemory, type PlannerModelRecall, type PlannerModelStore, type PlannerReplyClassification, type PlannerRuntimeToggles, type PlannerSubmission, PlannerToolHandler, PlannerTurnDiscardedError, PlannerTurnStoppedError, type PlannerUsability, PlannerUsage, type PluginSource, type PrdBlock, type PrdResponse, type PriorOutput, type ProbeFn, ProviderModelLists, type ProviderRegistration, QueuedMessage, QueuedTaskMessage, REFUSED_COMMANDS, ReadFileOpts, type RemoveMessageResponse, RepairEvidence, type RepairLoopOpts, type RepairVerdict, RepoGroupLayout, type ResearchChat, ResearchLogEntry, ResearchProgress, type ResearchShell, type ResearchShellDeps, ResearchToolType, type ResearchTurn, type ResolveConflictResponse, ResolveContext, type RewindTarget, type RewindTargetsResponse, RunnerApprovals, type RunnerCatalog, type RunnerEntry, RunnerId, RunnerInstallation, RunnerInvocation, type RunnerMode, RunnerModeInfo, RunnerPluginManifest, RunnerRegistry, RunnerSpawnOptions, RunnerTransport, type RunnersResponse, SETTINGS_ENV_ALLOWLIST, SETTINGS_ENV_REFUSED, STATE_DIR, STOPPED_TOOL_RESULT, SYMBOL_LANGUAGES, type SaveSession, Session, SessionBroadcaster, type SessionData, type SessionDeps, type SessionListResponse, SessionMessage, type SessionMeta, SessionNotFoundError, SessionNotice, type SessionPlanner, type SessionResponse, type SessionRuntimeSettings, type SettingsResponse, SettingsService, type SettingsUpdateResponse, type ShellDialect, type SkillInfo, type SkillMetadata, SkillsService, type SpawnSpec, StdioAgentAdapter, type StopResponse, StructuredEvent, StructuredRunner, type StructuredRunnerDeps, StructuredSession, StructuredSessionCapability, StructuredTurnEnd, TASK_QUERY_ANSWER_MAX_CHARS, TASK_QUERY_ANSWER_OR_OPS, TASK_QUERY_FIELDS, TASK_QUERY_PROTOCOL, TASK_QUERY_REMINDER, TRUNCATED_PLAN_REPAIR_INSTRUCTION, Task, type TaskAttemptSnapshot, TaskCompleteArgs, TaskControlError, TaskIsolation, type TaskLogAttemptsResponse, TaskLogEvent, type TaskLogFile, type TaskLogLocation, TaskLogRecorder, type TaskLogRecorderDeps, type TaskLogResponse, type TaskMessageResponse, TaskModeAgentAdapter, TaskOp, TaskOrchestrator, type TaskOrchestratorDeps, type TaskOrchestratorOptions, type TaskOutputAttempt, type TaskOutputSource, type TaskQuery, type TaskQueryCatalog, type TaskQueryField, TaskRunnerFlags, TaskSnapshot, TaskStartOptions, TaskTokenScope, TmuxRunner, type TmuxRunnerDeps, type TokenCarriers, type ToolCall, ToolOutcome, type ToolResult, type TranscriptQuery, type TranscriptReader, type TransportRoute, TransportRouter, TreeSnapshot, UsageRecord, type UserSettings, Verdict, VerdictEngine, type VerdictListener, type WorkspaceCheckDeps, WorkspaceNotAProjectError, WorkspaceNotFoundError, type WorkspaceProjectCheckDeps, type WorkspacesResponse, type WorktreeIsolationDeps, admitSettingsEnv, applyHeadLimit, assertInstallablePluginUrl, assertPlainPluginName, assertWorkspaceExists, assertWorkspaceIsProject, augmentPromptWithPriorOutputs, augmentedPath, bearerHeaderValue, buildConflictRepairPrompt, buildConflictResolutionPrompt, buildConversationSystemPrompt, buildFallbackGrepArgs, buildGlobArgs, buildGrepArgs, buildMergePrompt, buildModifyDuringExecutionPrompt, buildModifyPlanPrompt, buildPlanWithResults, buildResearchPrompt, buildResearchToolsPrompt, buildRunnerInvocation, buildSplitPrompt, buildSubagentSystemPrompt, canContinue, clampThinkingEffort, classifyCommand, classifyPlannerReply, classifyPluginSource, clearAugmentedPathCache, clearDaemonToken, clearResearchShellCache, clearState, clipboardCopyCommand, coerceAssignments, collectDirectDependencyOutputs, composeAugmentedPrompt, composeContinuationPrompt, configuredProviders, continuability, createAiService, createSession, createSkillsService, createTaskAdapter, createWorktreeIsolation, daemonTokenPath, defaultLogger, definitionPattern, defuseMarkers, deleteSession, describeMergeResult, discoverGeminiModels, effectiveAllowlist, ensureDir, ensurePrivateDir, ensureStateDirIgnored, executionLogBlock, extractPrdBlock, extractPresentedToken, filterFallbackByAnchoredInclude, filterModelsForPrompt, formatSearchOutput, generatePlanWithRepair, getLatestSession, getProviderMeta, getSettingsPath, getStateDir, globalDataDir, grantScopeFor, grepRegexFromProbe, hasTmux, idSegment, includeGlobFor, isCliProvider, isOpenAiProvider, isPlainPluginName, isValidManifest, killTree, languageForId, listSessions, listTaskLogAttempts, loadSession, loadSessionPlanState, loadState, mapAgentTool, migrateOldConfigDir, migratePlanIsolation, mintDaemonToken, mintSessionId, modelContextBlock, modifyValidationFeedback, normalizeAgentArgs, normalizeGeminiModel, openTaskLog, parseMaxParallel, parseTaskQueryJson, pendingEditRulesBlock, plannerBackendEntries, prefixModelId, providerForRunner, reEmitPlanPrompt, reEmitTaskOpsPrompt, reEmitTaskQueryPrompt, readDaemonToken, readTaskLog, referencePattern, renderPlanMap, renderPriorOutputs, renderTaskQueryAnswer, repairLoop, researchShellWarning, researchToolsPath, resolveArgs, resolvePluginInstallDir, resolveProviderFromPrefix, resolveResearchShell, resolveSkillInvocation, resolveTaskRunnerFlags, resolveWithin, retargetTaskRunner, routeTransport, runnerAssignment, runnerForProvider, sanitizeSlug, savePrdMarkdown, saveSession, saveState, sessionDataDir, sessionRuntimeSettings, stateExists, stripModelPrefix, summarizeOutput, supportsTaskMode, taskOpsRejectedPrompt, taskQuerySignature, textHasTaskQuery, tmuxSessionName, tmuxSocketName, tmuxWindowName, tokenSubprotocols, tokensMatch, truncatedPlanReEmitPrompt, wellKnownBinDirs, withPath, writePrivateFile };
|