@ordewell/core 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{IFileSystem-DgpX0BU7.d.mts → IFileSystem-BnLh-_SK.d.mts} +1 -1
- package/dist/{IFileSystem-D4ADfTrX.d.ts → IFileSystem-DofiRcCo.d.ts} +1 -1
- package/dist/{ModeResolver-Cv01ZDd9.d.mts → ModeResolver-DZzJSdIU.d.mts} +1 -1
- package/dist/{ModeResolver-BEcRAz1c.d.ts → ModeResolver-DkMYf4uS.d.ts} +1 -1
- package/dist/{Task-CoKhvBa1.d.mts → Task-BnLxkVQF.d.mts} +140 -21
- package/dist/{Task-CoKhvBa1.d.ts → Task-BnLxkVQF.d.ts} +140 -21
- package/dist/{chunk-YU4UKKKI.mjs → chunk-LGQNXPBX.mjs} +10 -2
- package/dist/chunk-LGQNXPBX.mjs.map +1 -0
- package/dist/{chunk-N66ZHFGN.mjs → chunk-OYUSADFM.mjs} +11 -1
- package/dist/chunk-OYUSADFM.mjs.map +1 -0
- package/dist/{chunk-HPNUFBIT.mjs → chunk-V3JHS7AX.mjs} +9 -1
- package/dist/chunk-V3JHS7AX.mjs.map +1 -0
- package/dist/{chunk-LSGY7AIZ.mjs → chunk-Y36NIASW.mjs} +183 -11
- package/dist/chunk-Y36NIASW.mjs.map +1 -0
- package/dist/{chunk-J3YSTPCE.mjs → chunk-ZV5LDNCO.mjs} +5 -4
- package/dist/chunk-ZV5LDNCO.mjs.map +1 -0
- package/dist/index.d.mts +287 -223
- package/dist/index.d.ts +287 -223
- package/dist/index.js +2111 -1086
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1973 -1117
- package/dist/index.mjs.map +1 -1
- package/dist/order-labels.d.mts +15 -2
- package/dist/order-labels.d.ts +15 -2
- package/dist/order-labels.js +12 -2
- package/dist/order-labels.js.map +1 -1
- package/dist/order-labels.mjs +7 -3
- package/dist/{parsing-B4OCHH1_.d.mts → parsing-B6ctfF80.d.mts} +2 -2
- package/dist/{parsing-DMdOq-BV.d.ts → parsing-ddZXZFP4.d.ts} +2 -2
- package/dist/parsing.d.mts +3 -3
- package/dist/parsing.d.ts +3 -3
- package/dist/parsing.js +6 -3
- package/dist/parsing.js.map +1 -1
- package/dist/parsing.mjs +3 -3
- package/dist/{plan-utils-BdYPRBno.d.ts → plan-utils--kQRzSE-.d.ts} +226 -7
- package/dist/{plan-utils-CD1Xu65s.d.mts → plan-utils-CKgNtDwQ.d.mts} +226 -7
- package/dist/plan-utils.d.mts +4 -3
- package/dist/plan-utils.d.ts +4 -3
- package/dist/plan-utils.js +202 -3
- package/dist/plan-utils.js.map +1 -1
- package/dist/plan-utils.mjs +40 -3
- package/dist/testing.d.mts +17 -5
- package/dist/testing.d.ts +17 -5
- package/dist/testing.js +45 -2
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +45 -4
- package/dist/testing.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HPNUFBIT.mjs.map +0 -1
- package/dist/chunk-J3YSTPCE.mjs.map +0 -1
- package/dist/chunk-LSGY7AIZ.mjs.map +0 -1
- package/dist/chunk-N66ZHFGN.mjs.map +0 -1
- package/dist/chunk-YU4UKKKI.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
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 DENY_ALL, x as DiscoveredMode, z as DiscoveryCommand, E as EditPlanArgs, F as EmbeddedNewlineError, G as ExecutableNotFoundError, H as FetchAllProviderModelsOptions, I as HeadlessRunner, J as HeadlessRunnerDeps, K as HeadlessSession, R as IntegrationDisposal, S as IsolationAvailability, U as IsolationHandoffRepo, V as IsolationInactiveReason, X as IsolationLanding, Y as IsolationMergeBlock, Z as IsolationMergeBlockReason, a0 as IsolationPruneResult, a1 as IsolationRepo,
|
|
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, j as MessageBlock, k as MessageRole, N as NO_TURN, O as OutputPreview, P as PlanBlock,
|
|
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 { a$ as RunnerId, ax as PlanStatus, ab as LegacyPlanState, L as IApproval, k as ApprovalDecision, p as ApprovalRequest, j as ApprovalAnswer, O as ITerminalRunner, M as IConfig, h as AiProvider, aM as ProviderModelLists, m as ApprovalMode, _ as IsolationMergeResult, W as IsolationLandedTask, Q as IWorktreeIsolation, a7 as IsolationTaskStatus, au as PlanIsolation, b4 as RunnerTransport, aU as RepoGroupLayout, P as ITerminalSession, y as DiscoveredModel, bh as Task, f as AgentProcessDeps, c as AgentAdapter, ar as OrdewellMcpServer, aW as ResearchProgress, aV as ResearchLogEntry, w as ConversationMessage, aA as PlannerToolHandler, bE as UsageRecord, bt as TaskSnapshot, r as AwaitingReason, T as IsolationHandoff, a3 as IsolationRun, a4 as IsolationTaskRecord, bj as TaskIsolation, a8 as IsolationView, $ as IsolationOutcome, aT as RepairEvidence, bC as TreeSnapshot, bL as Verdict, b2 as RunnerRegistry, aR as QueuedTaskMessage, aQ as QueuedMessage, b as ActiveTaskSession, aq as OrchestratorOption, bm as TaskModeAgentAdapter, g as AgentStartOptions, e as AgentEvent, aZ as ResearchToolType, aB as PlannerUsage, n as ApprovalPolicy, aw as PlanState, bi as TaskCompleteArgs, t as CheckpointAnswer, b0 as RunnerInvocation, A as AbstractRunner, a as AbstractTerminalSession, b5 as RunnerVersionProbe, ba as StructuredSessionCapability, bu as TaskStartOptions, bw as TaskTokenScope, bb as StructuredTurnEnd, b9 as StructuredEvent, b3 as RunnerSpawnOptions, N as IPluginStore, b1 as RunnerPluginManifest, a_ as ResolveContext, bs as TaskRunnerFlags } from './Task-BnLxkVQF.mjs';
|
|
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 DENY_ALL, x as DiscoveredMode, z as DiscoveryCommand, E as EditPlanArgs, F as EmbeddedNewlineError, G as ExecutableNotFoundError, H as FetchAllProviderModelsOptions, I as HeadlessRunner, J as HeadlessRunnerDeps, K as HeadlessSession, R as IntegrationDisposal, S as IsolationAvailability, U as IsolationHandoffRepo, V as IsolationInactiveReason, X as IsolationLanding, Y as IsolationMergeBlock, Z as IsolationMergeBlockReason, a0 as IsolationPruneResult, a1 as IsolationRemoval, a2 as IsolationRepo, a5 as IsolationTaskRef, a6 as IsolationTaskRepo, a9 as LaunchDeps, aa as LaunchPlan, ac as LineBuffer, ad as ListModelsArgs, ae as ListRunnersArgs, af as McpClientConfig, ag as McpCredential, ah as McpTool, ai as McpToolContext, aj as McpToolReply, ak as Message, al as ModelCatalog, am as ModelShortcut, an as ORCHESTRATOR_SHORTCUTS, ao as ORDEWELL_MCP_PATH, ap as ORDEWELL_MCP_SERVER_NAME, as as OwnerOnlyFile, at as PLANNER_TOOLS, av as PlanModificationWarnings, ay as PlannerStartOptions, az as PlannerTokenScope, aC as PluginCloneFn, aD as PluginEntry, aE as PluginFeatures, aF as PluginMode, aG as PluginModelDiscovery, aH as PluginRunnerDef, aI as PreparedLaunch, aJ as PreparedTask, aK as PreservedWork, aL as ProviderCredentialSource, aN as ProviderModelsResult, aO as PtySize, aP as PtyWrapOptions, aS as RefusedRemoval, aX as ResearchStep, aY as ResearchStepOutcome, b6 as StreamEvent, b7 as StreamStepEvent, b8 as StreamThinkingEvent, bc as SubagentLogEntry, bd as SubagentOutcome, be as SubmitPlanArgs, bf as TASK_COMPLETE_TOOL, bg as TASK_TOOLS, bk as TaskIsolationState, bl as TaskMode, bn as TaskModeUnsupportedError, bo as TaskModelAssignment, bp as TaskOutputArgs, bq as TaskOutputSummary, br as TaskQueryArgs, bv as TaskStatus, bx as TaskToolHandler, by as TaskTransport, bz as TaskType, bA as TaskWithParent, bB as ThinkingBlock, bD as UsageLine, bF as UsageTotals, bG as UserPromptEntry, bH as UserStep, bI as ValidationCheck, bJ as ValidationContext, bK as ValidationResult, bM as VerificationCheck, bN as WINDOWS_MAX_COMMAND_LINE, bO as addPlannerUsage, bP as addTaskToPlan, bQ as addUsage, bR as approvalScopes, bS as buildShellInvocation, bT as collectProviderCredentials, bU as createEmptyPlan, bV as createTask, bW as emptyWarnings, bX as enabledRunners, bY as fetchAllProviderModels, bZ as flattenTasks, b_ as flattenTasksWithParents, b$ as inheritedOps, c0 as isAwaitingReason, c1 as isExecutableResolved, c2 as isGranted, c3 as isMeasured, c4 as isReservedRunnerName, c5 as isRunnerApproval, c6 as isRunnerTransport, c7 as isStructuredSession, c8 as keepExecutionState, c9 as knownModelId, ca as mcpClientConfig, cb as migrateLegacyPlan, cc as migratePlanState, cd as migrateTask, ce as opsFlag, cf as ownerOnlyConfigFile, cg as partedPromptUsage, ch as planDirectLaunch, ci as planShellLaunch, cj as plannerContextFill, ck as posixShellQuote, cl as removeTaskFromPlan, cm as renumberTasks, cn as resolveModelShortcut, co as resolveProvider, cp as sharedMcpServer, cq as stripAnsi, cr as toApprovalDecision, cs as toOrchestratorOptions, ct as updateTaskInPlan, cu as usageLine, cv as validateModifiedPlan, cw as warningsText, cx as windowsCommandLine, cy as wrapWithPty } from './Task-BnLxkVQF.mjs';
|
|
3
|
+
import { z as TaskOp, M as MergeGateView, r as SessionBroadcaster, A as ApplyTaskOpsResult, s as SessionMessage, t as SessionNotice, x as TaskLogEvent } from './plan-utils-CKgNtDwQ.mjs';
|
|
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, j as MessageBlock, k as MessageRole, N as NOT_STARTED, l as NO_TURN, m as NewTaskFields, O as OutputPreview, P as PlanBlock, n as PlanMarkerStatus, o as PromptHold, S as SerializedPlan, p as SerializedTask, q as SerializedTaskStatus, u as SubagentBlock, v as SubagentChild, w as SubagentStatus, T as TakenPrompt, y as TaskLogView, B as TaskRef, F as TaskRowAction, H as TaskRowContext, I as TaskRowIsolation, J as TaskRowKind, K as TaskRowPlacement, Q as TaskRowSubject, R as TaskRowView, U as TaskStatusKind, V as ThinkingDisplayBlock, W as ToolBlock, X as ToolHeadline, Y as ToolStatus, Z as TurnGate, _ as UsageBlock, $ as aheadOfDraft, a0 as applyTaskOps, a1 as approvalLabel, a2 as awaitingLabel, a3 as canMergeTasks, a4 as canSetDependencies, a5 as canSplitTask, a6 as capConflictFiles, a7 as classifyOutcome, a8 as coalesceTaskLog, a9 as dependencyCandidates, aa as dependentsNotice, ab as dependentsOf, ac as diffRows, ad as diffStat, ae as diffSummary, af as digestTaskLog, ag as drainNext, ah as executionSummary, ai as followTurn, aj as fromTranscript, ak as hasHiddenDetail, al as holdPrompt, am as isTaskRunning, an as markAction, ao as markRequestFor, ap as namedRepos, aq as newTaskFields, ar as opsEditable, as as outputLines, at as outputPreview, au as parseTaskOpsJson, av as pastGateConfirmation, aw as reduceConversation, ax as reduceTaskLog, ay as replayTaskLog, az as runnerToolSubject, aA as serializePlan, aB as serializeTask, aC as serializeTaskStatus, aD as stopTurn, aE as summarizeToolCall, aF as taskRowActions, aG as taskRowView, aH as taskStartedNotice, aI as taskStatusKind, aJ as textHasTaskOps, aK as titledRefs, aL as toTaskLogEvent, aM as toolHeadline, aN as trimToolOutput, aO as truncateCheckpointSummary, aP as unsendAll, aQ as unsendLatest } from './plan-utils-CKgNtDwQ.mjs';
|
|
5
|
+
import { I as IFileSystem, R as ReadFileOpts, T as ToolOutcome, b as GrepOptions, a as GlobOptions, F as FindSymbolOptions } from './IFileSystem-BnLh-_SK.mjs';
|
|
6
|
+
export { G as GREP_DEFAULT_HEAD_LIMIT, c as GrepOutputMode, S as SEARCH_EXCLUSIONS } from './IFileSystem-BnLh-_SK.mjs';
|
|
7
|
+
import { R as RunnerModeInfo } from './ModeResolver-DZzJSdIU.mjs';
|
|
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-DZzJSdIU.mjs';
|
|
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-
|
|
12
|
-
export { resolveOrderLabel, taskOrderLabel } from './order-labels.mjs';
|
|
10
|
+
import { b as PlanParseError } from './parsing-B6ctfF80.mjs';
|
|
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-B6ctfF80.mjs';
|
|
12
|
+
export { resolveOrderLabel, taskOrderLabel, taskRef, titledTaskRef } from './order-labels.mjs';
|
|
13
13
|
import 'events';
|
|
14
14
|
import 'zod/v4';
|
|
15
15
|
|
|
@@ -1517,6 +1517,12 @@ interface IsolationRunControllerDeps {
|
|
|
1517
1517
|
notifications: INotification;
|
|
1518
1518
|
workspaceRoot: () => string;
|
|
1519
1519
|
listener: IsolationRunListener;
|
|
1520
|
+
/**
|
|
1521
|
+
* The tasks no clean-up of the whole run may take a worktree from: an
|
|
1522
|
+
* attempt is running them, or the plan has them in progress or waiting on
|
|
1523
|
+
* the user mid-attempt.
|
|
1524
|
+
*/
|
|
1525
|
+
liveTasks: () => ReadonlySet<string>;
|
|
1520
1526
|
}
|
|
1521
1527
|
/**
|
|
1522
1528
|
* The lifecycle of a plan's isolation run (ADR-0013, ADR-0014, ADR-0020),
|
|
@@ -1533,6 +1539,7 @@ declare class IsolationRunController {
|
|
|
1533
1539
|
private readonly notifications;
|
|
1534
1540
|
private readonly workspaceRoot;
|
|
1535
1541
|
private readonly listener;
|
|
1542
|
+
private readonly liveTasks;
|
|
1536
1543
|
private run;
|
|
1537
1544
|
/** Copied paths already reported for the current run: every task gets the same copies. */
|
|
1538
1545
|
private reportedCopies;
|
|
@@ -1561,6 +1568,7 @@ declare class IsolationRunController {
|
|
|
1561
1568
|
get blocked(): boolean;
|
|
1562
1569
|
/** What the plan persists of isolated execution; null when no run ever isolated. */
|
|
1563
1570
|
get planIsolation(): PlanIsolation | null;
|
|
1571
|
+
/** The one guard of every action on the run: a plan that never isolated is a request refused, not a fault. */
|
|
1564
1572
|
requireRun(): IsolationRun;
|
|
1565
1573
|
/** A task's record in the open run, only while that run isolates. */
|
|
1566
1574
|
openRecord(taskId: string): IsolationTaskRecord | undefined;
|
|
@@ -1604,20 +1612,27 @@ declare class IsolationRunController {
|
|
|
1604
1612
|
*/
|
|
1605
1613
|
continueBlocked(how: 'stash' | 'shared'): Promise<(() => Promise<void>) | null>;
|
|
1606
1614
|
/**
|
|
1607
|
-
* The
|
|
1608
|
-
*
|
|
1609
|
-
*
|
|
1610
|
-
*
|
|
1611
|
-
*
|
|
1612
|
-
* is
|
|
1615
|
+
* The working directory of an attempt that may run in a worktree — which
|
|
1616
|
+
* attempts do is the attempt kind's to say (see `attemptKind.attemptCwd`):
|
|
1617
|
+
* the worktree prepared for it in an isolated run, the kept one for a
|
|
1618
|
+
* conflict repair, else the workspace root. `worktree` says which. Does not
|
|
1619
|
+
* itself report a worktree it creates as a change — the caller does once
|
|
1620
|
+
* the attempt is committed as running, so a spawn abandoned or failed after
|
|
1621
|
+
* this settles is not misreported as a change that stuck.
|
|
1613
1622
|
*/
|
|
1614
1623
|
attemptCwd(task: Task, opts: {
|
|
1615
1624
|
repair: boolean;
|
|
1616
|
-
ops?: boolean;
|
|
1617
1625
|
}): Promise<{
|
|
1618
1626
|
cwd: string;
|
|
1619
1627
|
worktree: boolean;
|
|
1620
1628
|
}>;
|
|
1629
|
+
/** The workspace root, for an attempt that runs outside any worktree. */
|
|
1630
|
+
workspaceCwd(task: Task): Promise<{
|
|
1631
|
+
cwd: string;
|
|
1632
|
+
worktree: boolean;
|
|
1633
|
+
}>;
|
|
1634
|
+
private reopenCwd;
|
|
1635
|
+
private prepareCwd;
|
|
1621
1636
|
/**
|
|
1622
1637
|
* Land a task's work on the run's integration branches. The record is
|
|
1623
1638
|
* reported changed once the landing is set and before the first merge, so
|
|
@@ -1654,10 +1669,11 @@ declare class IsolationRunController {
|
|
|
1654
1669
|
*/
|
|
1655
1670
|
refreshInHead(): Promise<boolean>;
|
|
1656
1671
|
/**
|
|
1657
|
-
* The tracked state of the workspace as an
|
|
1658
|
-
* {@link filesChangedSince}
|
|
1659
|
-
*
|
|
1660
|
-
* it, or a workspace git
|
|
1672
|
+
* The tracked state of the workspace as an attempt whose tree is checked
|
|
1673
|
+
* starts (see `attemptKind.checksTree`), for {@link filesChangedSince}
|
|
1674
|
+
* (ADR-0020). Null where the check does not run: a run that shares the
|
|
1675
|
+
* workspace root, where every task's edits land in it, or a workspace git
|
|
1676
|
+
* cannot isolate at all.
|
|
1661
1677
|
*/
|
|
1662
1678
|
snapshotWorkspace(): Promise<TreeSnapshot | null>;
|
|
1663
1679
|
/** Tracked files changed since `snapshot`; none when the run has since gone on in the workspace root. */
|
|
@@ -1672,7 +1688,9 @@ declare class IsolationRunController {
|
|
|
1672
1688
|
/**
|
|
1673
1689
|
* Mark which added task resolves which conflict. The resolver merges the
|
|
1674
1690
|
* conflicted task's branch by hand in its own worktree; once that lands, the
|
|
1675
|
-
* conflicted task can land in turn
|
|
1691
|
+
* conflicted task can land in turn — through the same merge, so a resolver
|
|
1692
|
+
* that did not really bring it along conflicts again instead of being taken
|
|
1693
|
+
* at its word.
|
|
1676
1694
|
*/
|
|
1677
1695
|
linkResolver(resolverId: string, conflictedId: string): void;
|
|
1678
1696
|
/** The conflicted task a landed resolver was added for, forgotten as it is returned. */
|
|
@@ -1687,11 +1705,28 @@ declare class IsolationRunController {
|
|
|
1687
1705
|
* HEAD somehow does not contain stays for the next run's sweep.
|
|
1688
1706
|
*/
|
|
1689
1707
|
merge(): Promise<IsolationMergeResult>;
|
|
1690
|
-
/**
|
|
1708
|
+
/**
|
|
1709
|
+
* Worktrees and task branches go; the integration branch and the record stay
|
|
1710
|
+
* for review and merge. Refused while a task of the run is still live.
|
|
1711
|
+
*/
|
|
1691
1712
|
cleanup(): Promise<void>;
|
|
1692
|
-
/**
|
|
1713
|
+
/**
|
|
1714
|
+
* The run and everything it made go, and the plan forgets it; the next run
|
|
1715
|
+
* starts afresh. Refused while a task of the run is still live.
|
|
1716
|
+
*/
|
|
1693
1717
|
discard(): Promise<void>;
|
|
1718
|
+
/** The records of tasks still live, whose worktrees no clean-up of the whole run may take. */
|
|
1719
|
+
private liveRecords;
|
|
1720
|
+
private refuseWhileLive;
|
|
1721
|
+
/**
|
|
1722
|
+
* Clear a settled run up once everything it landed is merged — and only
|
|
1723
|
+
* when nothing else is left in it: a live task, or a worktree holding work
|
|
1724
|
+
* that never landed, keeps the whole run, worktrees and branches, rather
|
|
1725
|
+
* than leaving that work to a deletion.
|
|
1726
|
+
*/
|
|
1694
1727
|
private clearMerged;
|
|
1728
|
+
/** Say what a removal kept back instead of deleting: where the work went, or which worktree stayed. */
|
|
1729
|
+
private report;
|
|
1695
1730
|
private forget;
|
|
1696
1731
|
private assess;
|
|
1697
1732
|
private activate;
|
|
@@ -2008,8 +2043,18 @@ declare class TaskOrchestrator {
|
|
|
2008
2043
|
* task whose spawn always throws.
|
|
2009
2044
|
*/
|
|
2010
2045
|
private onHold;
|
|
2011
|
-
/**
|
|
2012
|
-
|
|
2046
|
+
/**
|
|
2047
|
+
* Tasks Mark complete is landing after it ended their attempt: in progress
|
|
2048
|
+
* with no attempt for as long as that takes, and not orphans for it.
|
|
2049
|
+
*/
|
|
2050
|
+
private completing;
|
|
2051
|
+
/**
|
|
2052
|
+
* The plan's isolation run and the open run's lifecycle (ADR-0013); see
|
|
2053
|
+
* {@link IsolationRunController}. Read and acted on there directly, except
|
|
2054
|
+
* Merge all: that goes through {@link mergeRun}, which keeps it apart from
|
|
2055
|
+
* ops tasks and starts the tasks its merge lets through.
|
|
2056
|
+
*/
|
|
2057
|
+
readonly runs: IsolationRunController;
|
|
2013
2058
|
/** A passed attempt's work onto the integration branch, and the conflict repair a landing may need. */
|
|
2014
2059
|
private landing;
|
|
2015
2060
|
private registry;
|
|
@@ -2054,13 +2099,24 @@ declare class TaskOrchestrator {
|
|
|
2054
2099
|
private envForTask;
|
|
2055
2100
|
approveCheckpoint(taskId: string): void;
|
|
2056
2101
|
rejectCheckpoint(taskId: string, reason?: string): void;
|
|
2057
|
-
|
|
2102
|
+
/** What the task's waiting checkpoint asks, whole; undefined once it settles or when none waits. */
|
|
2103
|
+
getCheckpointQuestion(taskId: string): string | undefined;
|
|
2104
|
+
awaitsCheckpoint(taskId: string): boolean;
|
|
2058
2105
|
/**
|
|
2059
2106
|
* Send a structured task a user message (ADR-0018, M1). Mid-turn it queues
|
|
2060
2107
|
* behind the turn; a task waiting for input takes it at once and is back in
|
|
2061
2108
|
* progress. Returns the message's id, for {@link removeQueuedTaskMessage}.
|
|
2062
2109
|
*/
|
|
2063
2110
|
sendTaskMessage(taskId: string, text: string): string;
|
|
2111
|
+
/**
|
|
2112
|
+
* Force send (ADR-0023, F1–F3): interrupt the running turn and deliver the
|
|
2113
|
+
* message as the next one, ahead of anything queued, without the task
|
|
2114
|
+
* waiting for input in between. A task already waiting for input just takes it.
|
|
2115
|
+
*/
|
|
2116
|
+
forceSendTaskMessage(taskId: string, text: string): string;
|
|
2117
|
+
private messageTask;
|
|
2118
|
+
/** Force send a message still queued behind the running turn; false once the runner has it. */
|
|
2119
|
+
forceSendQueuedTaskMessage(taskId: string, id: string): boolean;
|
|
2064
2120
|
/** Take back a message still queued behind a turn; false once it was delivered. */
|
|
2065
2121
|
removeQueuedTaskMessage(taskId: string, id: string): boolean;
|
|
2066
2122
|
/** Stop a structured task's running turn; it then waits for input like any turn that ends without its marker. */
|
|
@@ -2095,30 +2151,13 @@ declare class TaskOrchestrator {
|
|
|
2095
2151
|
/** Task id → session id of every attempt whose runner is up; a spawn in flight has no session yet. */
|
|
2096
2152
|
get activeSessionMap(): Map<string, string>;
|
|
2097
2153
|
getAttempt(taskId: string): TaskAttemptSnapshot | undefined;
|
|
2098
|
-
/** Where a task's isolated work stands; null when the plan has no isolation run to speak of. */
|
|
2099
|
-
getTaskIsolation(taskId: string): TaskIsolation | null;
|
|
2100
|
-
/**
|
|
2101
|
-
* The plan's isolation as a surface shows it, for one with no stream to have
|
|
2102
|
-
* told it — a reconnected webview, a session just loaded. Null without a run.
|
|
2103
|
-
*/
|
|
2104
|
-
isolationView(): IsolationView | null;
|
|
2105
2154
|
getAttemptSession(taskId: string): ITerminalSession | undefined;
|
|
2106
2155
|
get queuedCount(): number;
|
|
2107
|
-
/** A run is waiting on the user to stash or to go on without isolation. */
|
|
2108
|
-
get awaitingIsolationChoice(): boolean;
|
|
2109
|
-
/**
|
|
2110
|
-
* Take over a plan's persisted isolation, or none for a plan that has not
|
|
2111
|
-
* isolated yet, pruning what a crashed process left behind. Silent on the
|
|
2112
|
-
* observer: adopting is not a change to persist.
|
|
2113
|
-
*/
|
|
2114
|
-
adoptIsolation(state: PlanIsolation | null): Promise<void>;
|
|
2115
|
-
reviewRunDiff(): Promise<string>;
|
|
2116
2156
|
/**
|
|
2117
2157
|
* "Merge all"; a settled run that merged everything is cleared up and
|
|
2118
2158
|
* forgotten. During a run it merges what has landed and the run goes on:
|
|
2119
2159
|
* the tasks waiting at a merge gate for that work then start (ADR-0020).
|
|
2120
|
-
* Never
|
|
2121
|
-
* one overlap the plan cannot order, because the merge is the user's.
|
|
2160
|
+
* Never alongside ops work, either way round ({@link mergeExcludes}).
|
|
2122
2161
|
*/
|
|
2123
2162
|
mergeRun(): Promise<IsolationMergeResult>;
|
|
2124
2163
|
/**
|
|
@@ -2133,13 +2172,7 @@ declare class TaskOrchestrator {
|
|
|
2133
2172
|
* the task has started, and for every other task.
|
|
2134
2173
|
*/
|
|
2135
2174
|
getMergeGate(taskId: string): string[];
|
|
2136
|
-
/** Worktrees and task branches go; the integration branch and the record stay for review and merge. */
|
|
2137
|
-
cleanupRun(): Promise<void>;
|
|
2138
|
-
/** The run and everything it made go, and the plan forgets it; the next run starts afresh. */
|
|
2139
|
-
discardRun(): Promise<void>;
|
|
2140
2175
|
private watchBlockingPrompts;
|
|
2141
|
-
/** What the plan persists of isolated execution; null when no run ever isolated. */
|
|
2142
|
-
get isolationRecord(): PlanIsolation | null;
|
|
2143
2176
|
/** The transport the plan's latest run copied from the setting; null before its first run. */
|
|
2144
2177
|
get runnerTransport(): RunnerTransport | null;
|
|
2145
2178
|
/** Take over a saved plan's copied transport. The next run copies the setting afresh. */
|
|
@@ -2167,6 +2200,30 @@ declare class TaskOrchestrator {
|
|
|
2167
2200
|
start(): Promise<void>;
|
|
2168
2201
|
private haltOnFailure;
|
|
2169
2202
|
stop(): void;
|
|
2203
|
+
/** Name the tasks a stop took down, so none is mistaken for one still at work. */
|
|
2204
|
+
private sayStopped;
|
|
2205
|
+
/**
|
|
2206
|
+
* A task in progress with no attempt has nothing running it: a stop, a plan
|
|
2207
|
+
* load or anything else that ended its attempt left its status behind. It
|
|
2208
|
+
* is put back to not started, and said, so it can be retried rather than
|
|
2209
|
+
* read as running — or, in an isolated run, count as live work forever.
|
|
2210
|
+
*/
|
|
2211
|
+
private recoverOrphans;
|
|
2212
|
+
/**
|
|
2213
|
+
* Task ids still live, whose worktrees no clean-up of the whole run may
|
|
2214
|
+
* take: an attempt is running them, or the plan has them in progress or
|
|
2215
|
+
* waiting on the user mid-attempt — at a checkpoint, or for input. One
|
|
2216
|
+
* waiting on the user's decision instead (a conflict, a usage limit, files
|
|
2217
|
+
* an ops task changed) is not: no runner is at work on it, and a clean-up
|
|
2218
|
+
* keeps what it holds on a branch before its worktree goes.
|
|
2219
|
+
*/
|
|
2220
|
+
private liveTaskIds;
|
|
2221
|
+
/**
|
|
2222
|
+
* Whether the run may close with its handoff: no task is live. A handoff
|
|
2223
|
+
* tells the user the run has finished, and a Merge all after it clears the
|
|
2224
|
+
* run up, so neither may happen under a task the plan still shows at work.
|
|
2225
|
+
*/
|
|
2226
|
+
private get settled();
|
|
2170
2227
|
onUserTaskComplete(taskId: string): Promise<void>;
|
|
2171
2228
|
private onVerdict;
|
|
2172
2229
|
private afterVerdict;
|
|
@@ -2192,24 +2249,17 @@ declare class TaskOrchestrator {
|
|
|
2192
2249
|
* the ending attempt freed and never one more than the run allows.
|
|
2193
2250
|
*/
|
|
2194
2251
|
private settleUnlanded;
|
|
2195
|
-
/**
|
|
2196
|
-
* Mark which added task resolves which conflict. The resolver merges the
|
|
2197
|
-
* conflicted task's branch by hand in its own worktree; once that lands, the
|
|
2198
|
-
* conflicted task's branch is already on the integration branch and it can
|
|
2199
|
-
* land in turn — through the same merge, so a resolver that did not really
|
|
2200
|
-
* bring it along conflicts again instead of being taken at its word.
|
|
2201
|
-
*/
|
|
2202
|
-
linkConflictResolver(resolverId: string, conflictedId: string): void;
|
|
2203
2252
|
private landResolved;
|
|
2204
2253
|
getReadyTasks(): Task[];
|
|
2205
2254
|
private readiness;
|
|
2206
2255
|
/**
|
|
2207
|
-
* Open the run a task starts in, and
|
|
2208
|
-
*
|
|
2209
|
-
*
|
|
2210
|
-
* their choice replays.
|
|
2256
|
+
* Open the run a task starts in, and decide whether it isolates if the
|
|
2257
|
+
* task's next attempt needs that ({@link decidesIsolation}). False while a
|
|
2258
|
+
* dirty tree waits on the user; `resume` is what their choice replays.
|
|
2211
2259
|
*/
|
|
2212
2260
|
private openFor;
|
|
2261
|
+
/** The kind a task's next attempt starts as, short of a repair or a continue: what is weighed before one exists. */
|
|
2262
|
+
private nextAttemptKind;
|
|
2213
2263
|
/**
|
|
2214
2264
|
* Cancel a running (or scheduled) task: kill its session and return it to
|
|
2215
2265
|
* 'pending' — "not executed". The task is put on hold so the scheduler
|
|
@@ -2321,11 +2371,6 @@ declare class TaskOrchestrator {
|
|
|
2321
2371
|
private abandonSpawn;
|
|
2322
2372
|
private tell;
|
|
2323
2373
|
private say;
|
|
2324
|
-
/**
|
|
2325
|
-
* Whether the run in force, or else the next one, gives each task its own
|
|
2326
|
-
* worktrees, and of which repo group — what the planner is told.
|
|
2327
|
-
*/
|
|
2328
|
-
plannerIsolation(): Promise<IsolatedExecution>;
|
|
2329
2374
|
/**
|
|
2330
2375
|
* Replay the start a dirty tree turned away. `stash` puts the user's tracked
|
|
2331
2376
|
* changes on the git stash first, so the run isolates; `shared` runs this one
|
|
@@ -2518,7 +2563,9 @@ declare class RunnerInstallation {
|
|
|
2518
2563
|
* typing a real goal is the failure this exists to prevent.
|
|
2519
2564
|
*
|
|
2520
2565
|
* "Usable" is deliberately shallow: the binary answers `--version`, and the
|
|
2521
|
-
* runner
|
|
2566
|
+
* runner has a connector to plan over. Plugin runners have none yet: a
|
|
2567
|
+
* manifest-level planner capability, so a plugin can declare itself
|
|
2568
|
+
* plannable, is a follow-up. Whether the user's subscription is
|
|
2522
2569
|
* live cannot be known without spending a turn on it, so an expired login
|
|
2523
2570
|
* surfaces where it actually bites — as the agent's own error text on the
|
|
2524
2571
|
* first turn.
|
|
@@ -2672,7 +2719,7 @@ interface EnvAdmission {
|
|
|
2672
2719
|
*/
|
|
2673
2720
|
declare function admitSettingsEnv(env: Record<string, unknown>): EnvAdmission;
|
|
2674
2721
|
|
|
2675
|
-
/** Whether a runner's tasks can run on the structured transport. */
|
|
2722
|
+
/** Whether a runner's tasks can run on the structured transport (ADR-0018, S3). */
|
|
2676
2723
|
declare function supportsTaskMode(runner: string): boolean;
|
|
2677
2724
|
/** The adapter that drives one task. Throws {@link TaskModeUnsupportedError} for a runner without a connector. */
|
|
2678
2725
|
declare function createTaskAdapter(runner: string, deps: AgentProcessDeps): TaskModeAgentAdapter;
|
|
@@ -2802,8 +2849,12 @@ declare class ClaudeCodeAdapter extends StdioAgentAdapter implements TaskModeAge
|
|
|
2802
2849
|
private pendingResume;
|
|
2803
2850
|
/** The `--mcp-config` file of the running process, which holds its token; removed with the process. */
|
|
2804
2851
|
private mcpConfig;
|
|
2805
|
-
/**
|
|
2806
|
-
private
|
|
2852
|
+
/** Whether this process was given the server, so its tools' requests are Ordewell's own. */
|
|
2853
|
+
private givenOrdewell;
|
|
2854
|
+
/** Messages written into a running task turn, by the `uuid` their echo will carry, until it does (ADR-0023). */
|
|
2855
|
+
private readonly steers;
|
|
2856
|
+
/** The last turn's `result` ended it, so a steer's echo now opens a turn the CLI started for that message. */
|
|
2857
|
+
private turnClosed;
|
|
2807
2858
|
protected spawnSpec(opts: AgentStartOptions): SpawnSpec;
|
|
2808
2859
|
/**
|
|
2809
2860
|
* A task's run: the manifest decides what its mode and effort mean
|
|
@@ -2814,13 +2865,7 @@ declare class ClaudeCodeAdapter extends StdioAgentAdapter implements TaskModeAge
|
|
|
2814
2865
|
* without it `-p` refuses them silently and nothing can ever surface one.
|
|
2815
2866
|
*/
|
|
2816
2867
|
private taskSpawnSpec;
|
|
2817
|
-
/**
|
|
2818
|
-
* `--mcp-config` takes a path as well as inline JSON; the path keeps the
|
|
2819
|
-
* token out of the argv every local user can list (ADR-0022, A5). The file
|
|
2820
|
-
* lives exactly as long as the process that reads it. `alwaysLoad` because
|
|
2821
|
-
* the CLI otherwise defers MCP tools behind its tool search, and a model
|
|
2822
|
-
* that has to look an Ordewell tool up first tends to go on without it.
|
|
2823
|
-
*/
|
|
2868
|
+
/** The file holding the token lives exactly as long as the process that reads it. */
|
|
2824
2869
|
private ordewellServerArgs;
|
|
2825
2870
|
private removeMcpConfig;
|
|
2826
2871
|
start(opts: AgentStartOptions): Promise<void>;
|
|
@@ -2833,6 +2878,15 @@ declare class ClaudeCodeAdapter extends StdioAgentAdapter implements TaskModeAge
|
|
|
2833
2878
|
* as an interrupted `turn_end`.
|
|
2834
2879
|
*/
|
|
2835
2880
|
interrupt(timeoutMs: number): Promise<boolean>;
|
|
2881
|
+
/**
|
|
2882
|
+
* A `user` line written mid-turn is Claude Code's own queue (ADR-0023): the
|
|
2883
|
+
* CLI attaches it to the next tool result, or runs it as a turn of its own
|
|
2884
|
+
* after `result` — an interrupted one included — so it never lets go of one,
|
|
2885
|
+
* and nothing is ever reported dropped. Refused while an interrupt is in
|
|
2886
|
+
* flight, and before a `--resume` is taken up: a refused resume closes stdin
|
|
2887
|
+
* with the message unread.
|
|
2888
|
+
*/
|
|
2889
|
+
steer(id: string, text: string): Promise<boolean>;
|
|
2836
2890
|
/** Send a control request and wait for its answer; null when none came in time or the process ended. */
|
|
2837
2891
|
private control;
|
|
2838
2892
|
/**
|
|
@@ -2852,6 +2906,13 @@ declare class ClaudeCodeAdapter extends StdioAgentAdapter implements TaskModeAge
|
|
|
2852
2906
|
dispose(): void;
|
|
2853
2907
|
private clearFollowOnTimer;
|
|
2854
2908
|
protected turnPayload(message: string): string;
|
|
2909
|
+
private openTurnState;
|
|
2910
|
+
/**
|
|
2911
|
+
* The echo of a steered message: the model has it. After a closed turn it
|
|
2912
|
+
* opens the CLI's own turn for the message, which then runs like one Ordewell
|
|
2913
|
+
* sent. The first prompt is echoed too, and is no steer.
|
|
2914
|
+
*/
|
|
2915
|
+
private steerDelivered;
|
|
2855
2916
|
protected handleLine(line: string, emit: (event: AgentEvent) => void): void;
|
|
2856
2917
|
/**
|
|
2857
2918
|
* `--permission-mode auto` on a model or account without auto mode is not
|
|
@@ -2919,10 +2980,7 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2919
2980
|
private startOpts;
|
|
2920
2981
|
/** Whether this turn has already emitted prose — see the `agentMessage` case. */
|
|
2921
2982
|
private turnHasText;
|
|
2922
|
-
/**
|
|
2923
|
-
* The turn in flight. Its id arrives with `turn/started` or the `turn/start`
|
|
2924
|
-
* response, whichever lands first; `turn/interrupt` cannot be sent without it.
|
|
2925
|
-
*/
|
|
2983
|
+
/** The turn in flight. `turn/interrupt` and `turn/steer` cannot be sent before it has an id. */
|
|
2926
2984
|
private turn;
|
|
2927
2985
|
/** The JSON-RPC id of the `turn/start` that opened {@link turn}. */
|
|
2928
2986
|
private turnRequestId;
|
|
@@ -2930,6 +2988,12 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2930
2988
|
private endedTurnId;
|
|
2931
2989
|
/** An interrupt was asked for during this turn, so however it ends, it was cut short. */
|
|
2932
2990
|
private interruptRequested;
|
|
2991
|
+
/**
|
|
2992
|
+
* Turns an interrupt cut short. Codex leaves their command running and
|
|
2993
|
+
* reports it when it ends, inside whatever turn is live by then — a report
|
|
2994
|
+
* that belongs to no turn of the agent's any more (ADR-0023, F4).
|
|
2995
|
+
*/
|
|
2996
|
+
private readonly interruptedTurnIds;
|
|
2933
2997
|
/** An interrupt asked for before Codex named the turn, sent once it does. */
|
|
2934
2998
|
private interruptOnStart;
|
|
2935
2999
|
/** A task's approval requests still waiting for an answer, by the request id as a string. */
|
|
@@ -2988,6 +3052,17 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2988
3052
|
* with an empty result, then ends the turn as `interrupted`.
|
|
2989
3053
|
*/
|
|
2990
3054
|
interrupt(timeoutMs: number): Promise<boolean>;
|
|
3055
|
+
/**
|
|
3056
|
+
* `turn/steer` into the running turn (ADR-0023). Codex answers with the
|
|
3057
|
+
* turn's id at once — acceptance, not delivery — and shows the input to the
|
|
3058
|
+
* model after the item in flight, as a `userMessage` item carrying the
|
|
3059
|
+
* `clientUserMessageId` sent; that item is the delivery. The request needs
|
|
3060
|
+
* the turn's id, so a steer asked for before Codex named the turn waits for
|
|
3061
|
+
* it, as an interrupt does. Refused when the turn has ended or is another one.
|
|
3062
|
+
*/
|
|
3063
|
+
steer(id: string, text: string): Promise<boolean>;
|
|
3064
|
+
/** The one way input reaches a running turn: a task message, or a deny note. */
|
|
3065
|
+
private requestSteer;
|
|
2991
3066
|
/**
|
|
2992
3067
|
* Answer an open approval in its own result schema. Codex's decline carries
|
|
2993
3068
|
* no message, so a deny note reaches the agent as input steered into the
|
|
@@ -2997,7 +3072,15 @@ declare class CodexAdapter extends StdioAgentAdapter implements TaskModeAgentAda
|
|
|
2997
3072
|
protected turnPayload(message: string): string;
|
|
2998
3073
|
protected handleLine(line: string, emit: (event: AgentEvent) => void): void;
|
|
2999
3074
|
private turnStarted;
|
|
3075
|
+
/**
|
|
3076
|
+
* Ahead of the event that ends the turn: a steer Codex accepted and the turn
|
|
3077
|
+
* never consumed is gone — Codex keeps no queue across turns — and one not
|
|
3078
|
+
* yet accepted never will be (ADR-0023, D4).
|
|
3079
|
+
*/
|
|
3000
3080
|
private closeTurn;
|
|
3081
|
+
private fromInterruptedTurn;
|
|
3082
|
+
/** The `userMessage` item a steer turns into once the item before it completes: the model has it. */
|
|
3083
|
+
private steerDelivered;
|
|
3001
3084
|
/**
|
|
3002
3085
|
* The child thread id when `threadId` names a subagent's thread, or undefined
|
|
3003
3086
|
* for the planner's own. Codex replays both threads on one stream and only
|
|
@@ -3094,15 +3177,14 @@ declare class OpenCodeAdapter implements TaskModeAgentAdapter {
|
|
|
3094
3177
|
private readonly processEnded;
|
|
3095
3178
|
private planner;
|
|
3096
3179
|
private task;
|
|
3097
|
-
/** Whether this turn has already emitted reply text — see {@link emitPart}. */
|
|
3098
|
-
private turnHasText;
|
|
3099
3180
|
/** The last assistant message already settled — the baseline {@link recoverReply} measures a new reply against. */
|
|
3100
3181
|
private lastAssistantId;
|
|
3101
3182
|
private taskTurn;
|
|
3102
3183
|
/** An abort was posted during the current task turn, so the idle that follows ends it as interrupted. */
|
|
3103
3184
|
private interruptRequested;
|
|
3104
|
-
|
|
3105
|
-
|
|
3185
|
+
private readonly permissions;
|
|
3186
|
+
/** Messages handed into the running task turn, until the model reads them (ADR-0023). Kept across turns: the server keeps the message too. */
|
|
3187
|
+
private readonly steers;
|
|
3106
3188
|
/** Set once the server turns out to speak the 2.x API, which then owns the session. */
|
|
3107
3189
|
private v2;
|
|
3108
3190
|
/** The Ordewell server this process was configured with; null when none was given or its config could not be merged. */
|
|
@@ -3120,6 +3202,20 @@ declare class OpenCodeAdapter implements TaskModeAgentAdapter {
|
|
|
3120
3202
|
* {@link recoverReply}, never applies.
|
|
3121
3203
|
*/
|
|
3122
3204
|
private sendTask;
|
|
3205
|
+
/**
|
|
3206
|
+
* The prompt that carries a task message: the mode as the agent, the task
|
|
3207
|
+
* model and effort, and only `question` withheld. A steer names its own
|
|
3208
|
+
* `messageID` so the frames can be told apart from the first prompt's.
|
|
3209
|
+
*/
|
|
3210
|
+
private taskPromptBody;
|
|
3211
|
+
/** Hand a message into the running task turn (ADR-0023, D2), naming it so its delivery is observable. */
|
|
3212
|
+
steer(id: string, text: string): Promise<boolean>;
|
|
3213
|
+
/**
|
|
3214
|
+
* Messages handed over but unread when the turn ended. Each is deleted from
|
|
3215
|
+
* the session — so the next turn's re-send is not a duplicate — and reported
|
|
3216
|
+
* dropped, which is what puts it back in Ordewell's queue.
|
|
3217
|
+
*/
|
|
3218
|
+
private dropUnreadSteers;
|
|
3123
3219
|
/**
|
|
3124
3220
|
* Whatever of the turn's own messages the stream missed. Each part is
|
|
3125
3221
|
* emitted once, so a turn the stream saw whole adds nothing here; one that
|
|
@@ -3207,48 +3303,15 @@ declare class OpenCodeAdapter implements TaskModeAgentAdapter {
|
|
|
3207
3303
|
* none of this turn's business.
|
|
3208
3304
|
*/
|
|
3209
3305
|
private onFrame;
|
|
3210
|
-
/**
|
|
3211
|
-
|
|
3212
|
-
* with its first visible delta, so the deltas add up to exactly the text the
|
|
3213
|
-
* completed part then re-sends; a part that is only whitespace so far is
|
|
3214
|
-
* held back, for the reason {@link emitPart} drops one.
|
|
3215
|
-
*/
|
|
3216
|
-
private onTextDelta;
|
|
3217
|
-
/**
|
|
3218
|
-
* Deny one permission request (T1). OpenCode blocks the turn until the
|
|
3219
|
-
* request is answered, so this must answer — `reject` rather than a silent
|
|
3220
|
-
* drop, which is the same "absent answer is a denial" invariant ADR-0008
|
|
3221
|
-
* states for Ordewell's own tools. The refusal is announced so the timeline
|
|
3222
|
-
* shows the planner reaching for something it may not have.
|
|
3223
|
-
*/
|
|
3224
|
-
private denyPermission;
|
|
3225
|
-
/**
|
|
3226
|
-
* A task's request. Under a mode whose manifest sets `approvals: auto` —
|
|
3227
|
-
* `build`, which the terminal transport runs with `--auto` — it is answered
|
|
3228
|
-
* at once with what `run --auto` answers, so the same plan behaves the same
|
|
3229
|
-
* on both transports (ADR-0001), and announced already decided so the log
|
|
3230
|
-
* still shows it. Any other mode leaves it open for an approval card.
|
|
3231
|
-
*/
|
|
3232
|
-
private askPermission;
|
|
3306
|
+
/** A planner's request is refused (T1); a task's is answered at once or left open for a card. */
|
|
3307
|
+
private onPermissionAsked;
|
|
3233
3308
|
/**
|
|
3234
3309
|
* `POST /permission/:id/reply` is the current answer. The per-session path
|
|
3235
3310
|
* it replaced is tried only when a server too old to know the new one 404s.
|
|
3236
3311
|
*/
|
|
3237
3312
|
private replyPermission;
|
|
3238
|
-
/**
|
|
3239
|
-
* Open `/event` for one turn and wait until it is connected. The stream
|
|
3240
|
-
* stopped being best-effort the moment permission answers moved onto it: a
|
|
3241
|
-
* request raised before we connect is one nobody answers, and the turn
|
|
3242
|
-
* hangs on it. Waiting is bounded so a server that never opens `/event`
|
|
3243
|
-
* still gets its turn.
|
|
3244
|
-
*/
|
|
3313
|
+
/** `/event` for one turn — see {@link openEventStream}. Load-bearing for {@link onPermissionAsked}. */
|
|
3245
3314
|
private openStream;
|
|
3246
|
-
/**
|
|
3247
|
-
* Server-sent events from `/event`: the turn's live text, reasoning, tool
|
|
3248
|
-
* activity and usage, and the only channel permission requests arrive on —
|
|
3249
|
-
* so the stream is load-bearing for {@link denyPermission}.
|
|
3250
|
-
*/
|
|
3251
|
-
private streamEvents;
|
|
3252
3315
|
private json;
|
|
3253
3316
|
private request;
|
|
3254
3317
|
private headers;
|
|
@@ -3694,11 +3757,14 @@ interface SessionEventRelayDeps {
|
|
|
3694
3757
|
/** Where isolation notices go, for a host whose notifications are not seen by the user. */
|
|
3695
3758
|
onNotice?: (notice: SessionNotice) => void;
|
|
3696
3759
|
store: Pick<PlanStore, 'allTasks' | 'snapshot'>;
|
|
3697
|
-
orchestrator: Pick<TaskOrchestrator, 'getIdleSince' | '
|
|
3760
|
+
orchestrator: Pick<TaskOrchestrator, 'getIdleSince' | 'getQueuedTaskMessages' | 'getMergeGate' | 'mergeGateView'>;
|
|
3761
|
+
runs: Pick<IsolationRunController, 'taskIsolation'>;
|
|
3698
3762
|
/** Shared with the Session, which snapshots, restores and clears it. */
|
|
3699
3763
|
usage: PlannerUsageLedger;
|
|
3700
3764
|
/** How many of a task's runner requests wait for an answer (ADR-0018, A1). */
|
|
3701
3765
|
awaitingApproval?: (taskId: string) => number;
|
|
3766
|
+
/** What a task's waiting checkpoint asks, whole. */
|
|
3767
|
+
checkpointQuestion?: (taskId: string) => string | undefined;
|
|
3702
3768
|
}
|
|
3703
3769
|
/** Every orchestrator event the relay announces; `onTaskSettled` is persistence only, so it is the Session's. */
|
|
3704
3770
|
type RelayObserver = Required<Omit<OrchestratorObserver, 'onTaskSettled'>>;
|
|
@@ -3713,8 +3779,10 @@ declare class SessionEventRelay {
|
|
|
3713
3779
|
private readonly onNotice?;
|
|
3714
3780
|
private readonly store;
|
|
3715
3781
|
private readonly orchestrator;
|
|
3782
|
+
private readonly runs;
|
|
3716
3783
|
private readonly usage;
|
|
3717
3784
|
private readonly awaitingApproval;
|
|
3785
|
+
private readonly checkpointQuestion;
|
|
3718
3786
|
/**
|
|
3719
3787
|
* The in-flight turn's subagent activity, grouped one run per subagent so a
|
|
3720
3788
|
* replay nests each step under its own brief/result. Folded into the plan's
|
|
@@ -3780,16 +3848,6 @@ declare function openTaskLog(location: TaskLogLocation, taskId: string): TaskLog
|
|
|
3780
3848
|
*/
|
|
3781
3849
|
declare function readTaskLog(location: TaskLogLocation, taskId: string, attempt: number): TaskLogEvent[];
|
|
3782
3850
|
|
|
3783
|
-
/**
|
|
3784
|
-
* A direct (non-planner) plan edit the session refused. Distinct from a plain
|
|
3785
|
-
* Error so a surface can tell "you asked for something invalid" from "something
|
|
3786
|
-
* broke" and say which — the HTTP routes used to collapse both into 404/500,
|
|
3787
|
-
* which read to the TUI and VS Code as the edit silently doing nothing. Carries
|
|
3788
|
-
* no status code: core is transport-agnostic, the route maps it.
|
|
3789
|
-
*/
|
|
3790
|
-
declare class PlanEditError extends Error {
|
|
3791
|
-
constructor(message: string);
|
|
3792
|
-
}
|
|
3793
3851
|
/**
|
|
3794
3852
|
* Options for plan generation. Progress is not overridable: every planner
|
|
3795
3853
|
* progress event is translated to a SessionMessage inside the Session and
|
|
@@ -3921,6 +3979,8 @@ interface SessionParts {
|
|
|
3921
3979
|
planner: SessionPlanner;
|
|
3922
3980
|
store: PlanStore;
|
|
3923
3981
|
orchestrator: TaskOrchestrator;
|
|
3982
|
+
/** The orchestrator's own: Session reads the run and acts on it there, Merge all aside. */
|
|
3983
|
+
runs: IsolationRunController;
|
|
3924
3984
|
events: SessionEventRelay;
|
|
3925
3985
|
usage: PlannerUsageLedger;
|
|
3926
3986
|
approvals: PendingApprovals;
|
|
@@ -3949,6 +4009,7 @@ declare class Session {
|
|
|
3949
4009
|
private readonly events;
|
|
3950
4010
|
private readonly planner;
|
|
3951
4011
|
private readonly orchestrator;
|
|
4012
|
+
private readonly runs;
|
|
3952
4013
|
private readonly store;
|
|
3953
4014
|
private readonly config;
|
|
3954
4015
|
private readonly registry;
|
|
@@ -3971,6 +4032,7 @@ declare class Session {
|
|
|
3971
4032
|
private currentSessionId;
|
|
3972
4033
|
private readonly skillsService;
|
|
3973
4034
|
private readonly conversation;
|
|
4035
|
+
private readonly editor;
|
|
3974
4036
|
private readonly plannerTools;
|
|
3975
4037
|
constructor(parts: SessionParts);
|
|
3976
4038
|
/**
|
|
@@ -4067,6 +4129,8 @@ declare class Session {
|
|
|
4067
4129
|
* variants, not as an id-only stub. Never triggers discovery itself.
|
|
4068
4130
|
*/
|
|
4069
4131
|
private models;
|
|
4132
|
+
/** What a runner offers, as `runnerAssignment` needs it. Spawns the runner's CLI to list models. */
|
|
4133
|
+
private catalogFor;
|
|
4070
4134
|
get planState(): LegacyPlanState | null;
|
|
4071
4135
|
/**
|
|
4072
4136
|
* The live plan in the shape a saved session is read back as. The disk
|
|
@@ -4221,12 +4285,21 @@ declare class Session {
|
|
|
4221
4285
|
private finishedWork;
|
|
4222
4286
|
approveCheckpoint(taskId: string): void;
|
|
4223
4287
|
rejectCheckpoint(taskId: string, reason?: string): void;
|
|
4288
|
+
/** Whether an answer would reach the task: it waits at a checkpoint and a runner is left to hear it. */
|
|
4289
|
+
awaitsCheckpoint(taskId: string): boolean;
|
|
4224
4290
|
/**
|
|
4225
4291
|
* A user message to a structured task (ADR-0018, M1); throws
|
|
4226
4292
|
* `TaskControlError` for one that cannot take it. A task waiting for input
|
|
4227
4293
|
* is back in progress, and saved so before any surface is told.
|
|
4228
4294
|
*/
|
|
4229
4295
|
sendTaskMessage(taskId: string, text: string): string;
|
|
4296
|
+
/**
|
|
4297
|
+
* Force send (ADR-0023, F1): interrupt the task's running turn and deliver
|
|
4298
|
+
* this message next. Throws `TaskControlError` where a plain message would,
|
|
4299
|
+
* and for a task on the terminal transport.
|
|
4300
|
+
*/
|
|
4301
|
+
forceSendTaskMessage(taskId: string, text: string): string;
|
|
4302
|
+
forceSendQueuedTaskMessage(taskId: string, id: string): boolean;
|
|
4230
4303
|
removeQueuedTaskMessage(taskId: string, id: string): boolean;
|
|
4231
4304
|
interruptTask(taskId: string): Promise<void>;
|
|
4232
4305
|
getQueuedMessages(): QueuedMessage[];
|
|
@@ -4267,14 +4340,7 @@ declare class Session {
|
|
|
4267
4340
|
*/
|
|
4268
4341
|
discardRun(): Promise<void>;
|
|
4269
4342
|
private requireSettledRun;
|
|
4270
|
-
/**
|
|
4271
|
-
* The opt-in way through a merge conflict: add an AI task, on the conflicted
|
|
4272
|
-
* task's own runner and model, that merges its branch by hand in a worktree
|
|
4273
|
-
* of its own. When that task lands, the conflicted one lands through it (see
|
|
4274
|
-
* {@link TaskOrchestrator.linkConflictResolver}). The automatic answer to a
|
|
4275
|
-
* conflict is a repair, a new attempt of the same task (ADR-0015); a task is
|
|
4276
|
-
* only ever added to the plan by this call.
|
|
4277
|
-
*/
|
|
4343
|
+
/** Add the task that merges a conflicted task's branch by hand; see {@link PlanEditor.addConflictResolver}. */
|
|
4278
4344
|
resolveConflictAsTask(taskId: string): Promise<LegacyPlanState | null>;
|
|
4279
4345
|
stopExecution(): void;
|
|
4280
4346
|
/**
|
|
@@ -4283,88 +4349,19 @@ declare class Session {
|
|
|
4283
4349
|
* broadcast — in that order, once. A store op returning false aborts
|
|
4284
4350
|
* before anything is persisted. PlanStore is the single authority for
|
|
4285
4351
|
* task state; LegacyPlanState.tasks is populated only at persist time.
|
|
4352
|
+
* Direct edits reach it through the {@link PlanEditor}, which adds the
|
|
4353
|
+
* reschedule they owe.
|
|
4286
4354
|
*/
|
|
4287
4355
|
private mutatePlan;
|
|
4288
|
-
/**
|
|
4289
|
-
* The direct-edit seam: {@link mutatePlan} plus the reschedule every
|
|
4290
|
-
* structural edit owes an armed scheduler. Nothing else wakes one after a
|
|
4291
|
-
* hand edit — the queue-drain path never runs, because a direct edit never
|
|
4292
|
-
* queues — so a task the edit just unblocked would sit ready and never
|
|
4293
|
-
* start. `tick()` no-ops while the scheduler is idle, so this costs nothing
|
|
4294
|
-
* during plain planning. The planner-driven path re-ticks in
|
|
4295
|
-
* {@link PlannerConversation} instead (`afterEdit`); it must not tick twice.
|
|
4296
|
-
*/
|
|
4297
|
-
private editPlan;
|
|
4298
|
-
/**
|
|
4299
|
-
* Patch one task's fields. A hand-set dependency list, or a type flip
|
|
4300
|
-
* between AI and MAN, are the patches that can leave a task incoherent
|
|
4301
|
-
* (unschedulable, or carrying fields that mean nothing for its new type),
|
|
4302
|
-
* so both go through the same {@link validateTaskEdit} guard the planner's
|
|
4303
|
-
* task-ops applier uses (as the 'direct' actor, which skips the lock rule)
|
|
4304
|
-
* rather than a second copy of the rules — and throws, so the surface can
|
|
4305
|
-
* say why. Gated on the task existing so an edit to an unknown id still
|
|
4306
|
-
* falls through to the no-op `store.update` below instead of throwing.
|
|
4307
|
-
*/
|
|
4356
|
+
/** Patch one task's fields, checked as the planner's task ops are; see {@link PlanEditor.updateTask}. */
|
|
4308
4357
|
updateTask(taskId: string, changes: Partial<Task>): Promise<LegacyPlanState | null>;
|
|
4309
|
-
/**
|
|
4310
|
-
* Move one task onto a different runner. Distinct from {@link updateTask}
|
|
4311
|
-
* because a runner change is never a single-field edit: the task's model,
|
|
4312
|
-
* thinking effort and mode are all scoped to its runner, so they are
|
|
4313
|
-
* re-derived from the new runner's catalog (see {@link retargetTaskRunner}).
|
|
4314
|
-
* That needs discovery, which is why it is not a branch inside `updateTask`.
|
|
4315
|
-
*
|
|
4316
|
-
* The runner is also admitted into `plan.runners` — see {@link admitRunner}.
|
|
4317
|
-
*/
|
|
4358
|
+
/** Move one task onto a different runner, re-deriving what is scoped to it; see {@link PlanEditor.setTaskRunner}. */
|
|
4318
4359
|
setTaskRunner(taskId: string, runner: RunnerId): Promise<LegacyPlanState | null>;
|
|
4319
|
-
/**
|
|
4320
|
-
private catalogFor;
|
|
4321
|
-
/**
|
|
4322
|
-
* What a *derived* assignment may draw from: the runner's catalog narrowed to
|
|
4323
|
-
* the user's allowlist. Deriving from the full catalog would hand a task the
|
|
4324
|
-
* runner's first model regardless of a restriction the user set — the next
|
|
4325
|
-
* planner turn's `coerceAssignments` would snap it back anyway, so the user
|
|
4326
|
-
* would see their pick silently change instead of never being offered.
|
|
4327
|
-
*
|
|
4328
|
-
* `catalogFor` stays unnarrowed because {@link admitRunner} caches it as what
|
|
4329
|
-
* the runner really offers, which is what effort clamping needs.
|
|
4330
|
-
*/
|
|
4331
|
-
private allowedCatalog;
|
|
4332
|
-
/**
|
|
4333
|
-
* Make a runner a first-class member of this plan. Without this, the next
|
|
4334
|
-
* planner turn's `coerceAssignments` would treat it as disallowed and snap
|
|
4335
|
-
* every task on it back, silently undoing the user's choice; and that same
|
|
4336
|
-
* pass clamps efforts against `modelsCache`, so a catalog missing from there
|
|
4337
|
-
* makes the effort we just derived read as unverifiable.
|
|
4338
|
-
*/
|
|
4339
|
-
private admitRunner;
|
|
4340
|
-
/**
|
|
4341
|
-
* Replace one task's dependency list — the named entry point the surfaces'
|
|
4342
|
-
* dependency pickers call. The guard itself lives in {@link updateTask}, so
|
|
4343
|
-
* a dependency list arriving as a plain field patch is rejected by the same
|
|
4344
|
-
* rule instead of slipping past it.
|
|
4345
|
-
*/
|
|
4360
|
+
/** Replace one task's dependency list, under the same guard as a field patch; see {@link PlanEditor.setTaskDependencies}. */
|
|
4346
4361
|
setTaskDependencies(taskId: string, dependencies: string[]): Promise<LegacyPlanState | null>;
|
|
4347
|
-
/**
|
|
4348
|
-
* Delete one task. A running task is cancelled first: the plan can drop it
|
|
4349
|
-
* either way, but nothing can reach its runner afterwards — the tmux session
|
|
4350
|
-
* outlives the plan and the orchestrator keeps counting it as active. The
|
|
4351
|
-
* planner-driven path refuses instead (see {@link applyTaskOps}); a user
|
|
4352
|
-
* deleting their own task means it.
|
|
4353
|
-
*/
|
|
4362
|
+
/** Delete one task, cancelling its runner first if it runs; see {@link PlanEditor.removeTask}. */
|
|
4354
4363
|
removeTask(taskId: string): Promise<LegacyPlanState | null>;
|
|
4355
|
-
/**
|
|
4356
|
-
* Add one task, filling in whatever the caller left unset. A task with no
|
|
4357
|
-
* runnable assignment is not a lighter task but an unspawnable one, so the
|
|
4358
|
-
* runner falls back to the plan's first and the model, effort and mode are
|
|
4359
|
-
* derived from that runner's catalog — the same derivation a runner change
|
|
4360
|
-
* uses ({@link runnerAssignment}), which is why this is async like
|
|
4361
|
-
* {@link setTaskRunner}. Anything the caller did choose survives when the
|
|
4362
|
-
* runner offers it.
|
|
4363
|
-
*
|
|
4364
|
-
* Dependencies naming tasks that don't exist are dropped rather than rejected:
|
|
4365
|
-
* the caller is a picker over the current plan, so a stale id means the plan
|
|
4366
|
-
* moved on, not that the whole task should be refused.
|
|
4367
|
-
*/
|
|
4364
|
+
/** Add one task, deriving what the caller left unset; see {@link PlanEditor.addTask}. */
|
|
4368
4365
|
addTask(draft: Partial<Task>): Promise<LegacyPlanState | null>;
|
|
4369
4366
|
/**
|
|
4370
4367
|
* Planner-driven merge: validate compatibility up front, then ask the planner
|
|
@@ -4389,6 +4386,19 @@ declare class Session {
|
|
|
4389
4386
|
get aiServiceInstance(): IAiService;
|
|
4390
4387
|
}
|
|
4391
4388
|
|
|
4389
|
+
/**
|
|
4390
|
+
* A request on the plan the session refused: a direct (non-planner) edit that
|
|
4391
|
+
* is not valid, or an isolation action on a plan with no isolated run to act
|
|
4392
|
+
* on. Distinct from a plain Error so a surface can tell "you asked for
|
|
4393
|
+
* something invalid" from "something broke" and say which — the HTTP routes
|
|
4394
|
+
* used to collapse both into 404/500, which read to the TUI and VS Code as the
|
|
4395
|
+
* edit silently doing nothing. Carries no status code: core is
|
|
4396
|
+
* transport-agnostic, the route maps it.
|
|
4397
|
+
*/
|
|
4398
|
+
declare class PlanEditError extends Error {
|
|
4399
|
+
constructor(message: string);
|
|
4400
|
+
}
|
|
4401
|
+
|
|
4392
4402
|
/**
|
|
4393
4403
|
* Where Ordewell keeps machine-global data (settings, daemon tokens, caches,
|
|
4394
4404
|
* user plugins). A single home for everything not tied to a project directory,
|
|
@@ -4419,6 +4429,8 @@ type CheckpointWithdrawnListener = (taskId: string) => void;
|
|
|
4419
4429
|
type IdleListener = (taskId: string, idleSince: string | null) => void;
|
|
4420
4430
|
declare class VerdictEngine {
|
|
4421
4431
|
private markerSeen;
|
|
4432
|
+
private pendingVerdicts;
|
|
4433
|
+
private structuredSessions;
|
|
4422
4434
|
private markerTails;
|
|
4423
4435
|
private checkpointCarry;
|
|
4424
4436
|
private pausedSessions;
|
|
@@ -4431,6 +4443,8 @@ declare class VerdictEngine {
|
|
|
4431
4443
|
* answer is typed into the session instead.
|
|
4432
4444
|
*/
|
|
4433
4445
|
private toolCheckpoints;
|
|
4446
|
+
/** The question a task's checkpoint asks, whole, for as long as it waits — by either route. */
|
|
4447
|
+
private checkpointQuestions;
|
|
4434
4448
|
private idleListeners;
|
|
4435
4449
|
/**
|
|
4436
4450
|
* Per-task generation. Replaced on every watch(), clear() and verdict.
|
|
@@ -4479,6 +4493,8 @@ declare class VerdictEngine {
|
|
|
4479
4493
|
* `\n`-terminated line, and the leading newline flushes a partial line.
|
|
4480
4494
|
*/
|
|
4481
4495
|
private resumeToken;
|
|
4496
|
+
/** What a task's waiting checkpoint asks, untruncated; undefined when none waits. */
|
|
4497
|
+
getCheckpointQuestion(taskId: string): string | undefined;
|
|
4482
4498
|
approveCheckpoint(taskId: string): void;
|
|
4483
4499
|
rejectCheckpoint(taskId: string, reason: string): void;
|
|
4484
4500
|
/**
|
|
@@ -4497,6 +4513,10 @@ declare class VerdictEngine {
|
|
|
4497
4513
|
* task's current one or another signal already settled it.
|
|
4498
4514
|
*/
|
|
4499
4515
|
signalComplete(taskId: string, generation: number, report: TaskCompleteArgs): void;
|
|
4516
|
+
/** The runner was told something after its evidence so far, so only what it reports from here counts. */
|
|
4517
|
+
private supersede;
|
|
4518
|
+
private acceptVerdict;
|
|
4519
|
+
private publishVerdict;
|
|
4500
4520
|
/**
|
|
4501
4521
|
* The runner's `checkpoint` call (ADR-0022, V5): raised through the same
|
|
4502
4522
|
* listeners as the marker, so the task waits on the user the same way, and
|
|
@@ -4504,6 +4524,8 @@ declare class VerdictEngine {
|
|
|
4504
4524
|
* withdrawn, never left hanging, once the attempt is over or the call goes.
|
|
4505
4525
|
*/
|
|
4506
4526
|
raiseCheckpoint(taskId: string, generation: number, question: string, signal: AbortSignal): Promise<CheckpointAnswer>;
|
|
4527
|
+
/** The open `checkpoint` call can no longer be answered: refuse it, and let the task out of the wait. */
|
|
4528
|
+
private callWentAway;
|
|
4507
4529
|
private withdrawToolCheckpoint;
|
|
4508
4530
|
private approvalOpened;
|
|
4509
4531
|
private approvalClosed;
|
|
@@ -5067,8 +5089,9 @@ interface SessionLaunch {
|
|
|
5067
5089
|
* an `ITerminalSession`, so everything downstream of `onOutput` is unchanged;
|
|
5068
5090
|
* what a terminal cannot do sits on {@link StructuredSessionCapability}.
|
|
5069
5091
|
*
|
|
5070
|
-
* Ordewell owns the message queue (M1)
|
|
5071
|
-
*
|
|
5092
|
+
* Ordewell owns the message queue (M1). A message sent mid-turn is handed to a
|
|
5093
|
+
* runner that can take one at its next step (ADR-0023); otherwise it waits for
|
|
5094
|
+
* the turn to end rather than being typed into a runner that is busy.
|
|
5072
5095
|
*/
|
|
5073
5096
|
declare class StructuredSession extends AbstractTerminalSession implements StructuredSessionCapability {
|
|
5074
5097
|
private readonly launch;
|
|
@@ -5112,13 +5135,36 @@ declare class StructuredSession extends AbstractTerminalSession implements Struc
|
|
|
5112
5135
|
private issueTools;
|
|
5113
5136
|
private revokeTools;
|
|
5114
5137
|
protected baseHandleExit(code: number): void;
|
|
5115
|
-
/**
|
|
5138
|
+
/**
|
|
5139
|
+
* A reply typed at the task — a checkpoint answer, most often — is a user
|
|
5140
|
+
* message like any other: into the running turn where the runner takes one,
|
|
5141
|
+
* else the next turn. A runner that stopped to ask reads it at once either way.
|
|
5142
|
+
*/
|
|
5116
5143
|
write(text: string): void;
|
|
5117
5144
|
kill(): void;
|
|
5118
5145
|
turnState(): 'working' | 'idle';
|
|
5119
5146
|
onTurnEnd(listener: (reason: StructuredTurnEnd) => void): void;
|
|
5120
5147
|
onEvent(listener: (event: StructuredEvent) => void): void;
|
|
5121
5148
|
sendMessage(text: string): string;
|
|
5149
|
+
/**
|
|
5150
|
+
* Force send (ADR-0023, F1–F3): interrupt the running turn — and the tool
|
|
5151
|
+
* call in flight — then deliver this message as the turn that replaces it,
|
|
5152
|
+
* ahead of everything still queued. With no turn to interrupt it is a plain
|
|
5153
|
+
* {@link sendMessage}.
|
|
5154
|
+
*/
|
|
5155
|
+
forceSend(text: string): string;
|
|
5156
|
+
/** Force send a message still waiting in the queue. False once the runner has it, or it is gone. */
|
|
5157
|
+
forceSendQueued(id: string): boolean;
|
|
5158
|
+
/**
|
|
5159
|
+
* Behind earlier forced messages and ahead of the rest, handed-over ones
|
|
5160
|
+
* included: what the runner already has is the runner's to order (F2). Held
|
|
5161
|
+
* back from steering while the interrupt runs, it opens the next turn — and
|
|
5162
|
+
* a queue that is not empty when the turn ends is what keeps the task out of
|
|
5163
|
+
* "waiting for input" between the two (F3).
|
|
5164
|
+
*/
|
|
5165
|
+
private force;
|
|
5166
|
+
private runningTurn;
|
|
5167
|
+
/** No runner can recall a message once offered to it, so only a queued one comes back. */
|
|
5122
5168
|
removeQueued(id: string): boolean;
|
|
5123
5169
|
queued(): QueuedTaskMessage[];
|
|
5124
5170
|
nativeSessionId(): string | null;
|
|
@@ -5136,6 +5182,16 @@ declare class StructuredSession extends AbstractTerminalSession implements Struc
|
|
|
5136
5182
|
private startAdapter;
|
|
5137
5183
|
private openTurn;
|
|
5138
5184
|
private deliver;
|
|
5185
|
+
/**
|
|
5186
|
+
* Offer the oldest queued message to the running turn (ADR-0023, D2), one at
|
|
5187
|
+
* a time so the runner takes them in the order they were sent. A refusal
|
|
5188
|
+
* leaves it, and everything behind it, for the turn's end.
|
|
5189
|
+
*/
|
|
5190
|
+
private offerNext;
|
|
5191
|
+
private steered;
|
|
5192
|
+
private delivered;
|
|
5193
|
+
/** Back to waiting in Ordewell's queue, removable again; the log hears of it only if it had shown as handed over. */
|
|
5194
|
+
private requeue;
|
|
5139
5195
|
private route;
|
|
5140
5196
|
/**
|
|
5141
5197
|
* The runner spoke with no message of ours in flight. When it is working — a
|
|
@@ -5150,9 +5206,17 @@ declare class StructuredSession extends AbstractTerminalSession implements Struc
|
|
|
5150
5206
|
/**
|
|
5151
5207
|
* A queued message goes out as the turn closes, and the state never passes
|
|
5152
5208
|
* through `idle` on the way, so a listener told the turn ended can already
|
|
5153
|
-
* see the task is not waiting.
|
|
5209
|
+
* see the task is not waiting. Nor does a message the runner owes, or one
|
|
5210
|
+
* still being offered: the runner is about to read it, or Ordewell to send
|
|
5211
|
+
* it (ADR-0023, D5).
|
|
5154
5212
|
*/
|
|
5155
5213
|
private endTurn;
|
|
5214
|
+
/**
|
|
5215
|
+
* Between turns the oldest message opens the next one — but only once it is
|
|
5216
|
+
* back in Ordewell's hands: while it is on offer or owed, nothing overtakes it.
|
|
5217
|
+
*/
|
|
5218
|
+
private deliverNext;
|
|
5219
|
+
private undeliverQueued;
|
|
5156
5220
|
private emitEvent;
|
|
5157
5221
|
}
|
|
5158
5222
|
/**
|