@ordewell/core 0.10.8 → 0.10.9

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.
@@ -76,7 +76,7 @@ import {
76
76
  unsendAll,
77
77
  unsendLatest,
78
78
  usageLine
79
- } from "./chunk-DMG4ISUG.mjs";
79
+ } from "./chunk-O6LQU3W6.mjs";
80
80
  import {
81
81
  clampThinkingEffort
82
82
  } from "./chunk-H7QX32BH.mjs";
@@ -1,6 +1,6 @@
1
- import { ai as Task, a4 as RunnerId, aq as TaskSnapshot, b as AwaitingReason, av as UsageRecord, a5 as RunnerSessionCost, d as DiscoveredModel, af as SkillsService, aa as SkillInfo, Z as RepoGroupLayout, I as IWorktreeIsolation, w as IsolationRun, k as IsolationHandoff, J as PlanIsolation, x as IsolationTaskRecord, al as TaskIsolation, H as IsolationView, S as PrepareIntent, V as PreviousWork, s as IsolationOutcome, X as RepairEvidence, at as TreeSnapshot, aj as TaskDiffRead, ak as TaskDiffResult, r as IsolationMergeResult, ax as Verdict, ap as TaskSkillSnapshot, ao as TaskSkillNotice, ag as SubagentOutcome, L as LegacyPlanState, C as ConversationMessage, ac as SkillLoadNotice, P as PendingPlanTurn, a as AttemptUsage, a3 as RunSettings, O as PlanUsage, Y as ReplyRun, M as ModelUsage, aw as UsageTotals, f as ExecutionRecord, a0 as ResearchStep, K as PlanState, $ as ResearchProgress, _ as ResearchLogEntry, ab as SkillLoad, N as PlanStatus, ah as SupervisorLevel, a1 as ResearchStepOutcome, R as PlannerUsage, am as TaskIsolationState, as as TaskUsageSummary } from './Task-C0o4i3Nn.js';
2
- import { N as IRunnerSession, K as IConfig, aL as TaskMessageFrom, ax as RunnerModelRef, ap as RunnerCommand, au as RunnerMcpServer, aE as StructuredTurnEnd, j as ApprovalDecision, aD as StructuredEvent, ah as QueuedTaskMessage, k as ApprovalKind, q as ApprovalSource, M as IRunner, ay as RunnerRegistry, J as IApproval, aU as ToolOutcome, d as AgentProcessDeps, a as AgentAdapter, a4 as OrdewellMcpServer, L as IFileSystem, aV as UsageLimitSignal, ac as PlannerToolHandler, p as ApprovalRequest, i as ApprovalAnswer, f as AiProvider, a3 as OrchestratorOption, a9 as PlannerBackendId } from './IFileSystem-C4_mpfze.js';
3
- import { R as RunnerModeInfo } from './ModeResolver-DGK2rWHE.js';
1
+ import { ai as Task, a4 as RunnerId, aq as TaskSnapshot, b as AwaitingReason, av as UsageRecord, a5 as RunnerSessionCost, d as DiscoveredModel, af as SkillsService, aa as SkillInfo, Z as RepoGroupLayout, I as IWorktreeIsolation, w as IsolationRun, k as IsolationHandoff, J as PlanIsolation, x as IsolationTaskRecord, al as TaskIsolation, H as IsolationView, S as PrepareIntent, V as PreviousWork, s as IsolationOutcome, X as RepairEvidence, at as TreeSnapshot, aj as TaskDiffRead, ak as TaskDiffResult, r as IsolationMergeResult, ax as Verdict, ap as TaskSkillSnapshot, ao as TaskSkillNotice, ag as SubagentOutcome, L as LegacyPlanState, C as ConversationMessage, ac as SkillLoadNotice, P as PendingPlanTurn, a as AttemptUsage, a3 as RunSettings, O as PlanUsage, Y as ReplyRun, M as ModelUsage, aw as UsageTotals, f as ExecutionRecord, a0 as ResearchStep, K as PlanState, $ as ResearchProgress, _ as ResearchLogEntry, ab as SkillLoad, N as PlanStatus, ah as SupervisorLevel, a1 as ResearchStepOutcome, R as PlannerUsage, am as TaskIsolationState, as as TaskUsageSummary } from './Task-hFfRS9rN.js';
2
+ import { N as IRunnerSession, K as IConfig, aL as TaskMessageFrom, ax as RunnerModelRef, ap as RunnerCommand, au as RunnerMcpServer, aE as StructuredTurnEnd, j as ApprovalDecision, aD as StructuredEvent, ah as QueuedTaskMessage, k as ApprovalKind, q as ApprovalSource, M as IRunner, ay as RunnerRegistry, J as IApproval, aU as ToolOutcome, d as AgentProcessDeps, a as AgentAdapter, a4 as OrdewellMcpServer, L as IFileSystem, aV as UsageLimitSignal, ac as PlannerToolHandler, p as ApprovalRequest, i as ApprovalAnswer, f as AiProvider, a3 as OrchestratorOption, a9 as PlannerBackendId } from './IFileSystem-B8qRNC_6.js';
3
+ import { R as RunnerModeInfo } from './ModeResolver-CaPnoU8N.js';
4
4
 
5
5
  type NotificationAction = {
6
6
  label: string;
@@ -394,6 +394,12 @@ interface PlannerModes {
394
394
  type IsolationNoticeLevel = 'info' | 'warn' | 'error';
395
395
  /** How an attempt that may run in a worktree gets one: fresh, the kept one for a repair, or restoring the previous attempt's work. */
396
396
  type AttemptIntent = 'fresh' | 'repair' | PrepareIntent;
397
+ /**
398
+ * What adopting a persisted run found: nothing to change, landed work git
399
+ * shows the user has merged since, or a settled run that had nothing left to
400
+ * hand over and was cleared up.
401
+ */
402
+ type AdoptOutcome = 'unchanged' | 'changed' | 'cleared';
397
403
  interface AttemptWorkspace {
398
404
  cwd: string;
399
405
  worktree: boolean;
@@ -451,6 +457,8 @@ declare class IsolationRunController {
451
457
  private readonly listener;
452
458
  private readonly liveTasks;
453
459
  private run;
460
+ /** An adoption stays scoped even while cleanup temporarily leaves no run record. */
461
+ private adoptions;
454
462
  /** Copied paths already reported for the current run: every task gets the same copies. */
455
463
  private reportedCopies;
456
464
  private reportedSetupFailures;
@@ -492,13 +500,20 @@ declare class IsolationRunController {
492
500
  * Take over a plan's persisted isolation, or none for a plan that has not
493
501
  * isolated yet. Whatever a crashed process left behind for the run — a
494
502
  * worktree still marked active, a directory no record owns — is pruned,
495
- * while kept, failed and conflicted worktrees stay for the user.
503
+ * while kept, failed and conflicted worktrees stay for the user. Then git is
504
+ * asked which landed work the user has merged since the record was saved:
505
+ * a settled run whose landed work is all in HEAD has nothing left to hand
506
+ * over, so it is cleared up as Merge all would have, unless it still holds
507
+ * work that never landed (ADR-0013).
496
508
  *
497
- * Deliberately not reported as a change: adopting is not a change to
498
- * persist, and a host that adopts without persisting (VS Code's restore)
499
- * would otherwise write a new session file on every reload.
500
- */
501
- adopt(state: PlanIsolation | null): Promise<void>;
509
+ * Deliberately not reported to the listener: adopting is not a change of the
510
+ * session's own, and a host that adopts without persisting (VS Code's
511
+ * restore) would otherwise write a new session file on every reload. What
512
+ * git changed is returned instead, for the caller to save where it can and
513
+ * announce. A plan loaded meanwhile supersedes this adoption, which then
514
+ * touches nothing and resolves `unchanged`.
515
+ */
516
+ adopt(state: PlanIsolation | null): Promise<AdoptOutcome>;
502
517
  /** Open a run if none is, leaving whether it isolates to its first change task. */
503
518
  open(): void;
504
519
  /**
@@ -587,6 +602,10 @@ declare class IsolationRunController {
587
602
  * with git. Resolves true when some was found.
588
603
  */
589
604
  refreshInHead(): Promise<boolean>;
605
+ /** Mark the run's landed work git finds in HEAD; true when some was found. */
606
+ private findLanded;
607
+ /** The run landed something and every landing is in the user's HEAD. */
608
+ private allMerged;
590
609
  /**
591
610
  * The tracked state of the workspace as an attempt whose tree is checked
592
611
  * starts (see `attemptKind.checksTree`), for {@link filesChangedSince}
@@ -645,6 +664,10 @@ declare class IsolationRunController {
645
664
  * than leaving that work to a deletion.
646
665
  */
647
666
  private clearMerged;
667
+ /** The records that keep a settled run from being cleared up: live, or holding work that never landed. */
668
+ private holdouts;
669
+ /** The run's worktrees and merged branches go; false, said, when git would not let them. */
670
+ private discardMerged;
648
671
  /** Say what a removal kept back instead of deleting: where the work went, or which worktree stayed. */
649
672
  private report;
650
673
  private forget;
@@ -2788,6 +2811,12 @@ declare class CliAgentAiService implements IAiService {
2788
2811
  * `startConversation` reseeds from Ordewell's transcript, which is the same
2789
2812
  * degradation `restoreChat` already performs on every surface.
2790
2813
  *
2814
+ * A process can end while idle without Ordewell stopping it — the OS, the
2815
+ * CLI itself, a sleeping machine, a signal sent to its group — and every
2816
+ * path of ours that kills one also drops its adapter. So an adapter still
2817
+ * held whose process has ended died on its own, and is restarted here
2818
+ * rather than answering the next message with its exit code.
2819
+ *
2791
2820
  * Also restarted when the policy's decision on the runner's own search has
2792
2821
  * changed since the process was spawned: the running thread would otherwise
2793
2822
  * keep searching unasked after Full turned Guarded. Codex 0.162 applies
@@ -1,6 +1,6 @@
1
- import { ai as Task, a4 as RunnerId, aq as TaskSnapshot, b as AwaitingReason, av as UsageRecord, a5 as RunnerSessionCost, d as DiscoveredModel, af as SkillsService, aa as SkillInfo, Z as RepoGroupLayout, I as IWorktreeIsolation, w as IsolationRun, k as IsolationHandoff, J as PlanIsolation, x as IsolationTaskRecord, al as TaskIsolation, H as IsolationView, S as PrepareIntent, V as PreviousWork, s as IsolationOutcome, X as RepairEvidence, at as TreeSnapshot, aj as TaskDiffRead, ak as TaskDiffResult, r as IsolationMergeResult, ax as Verdict, ap as TaskSkillSnapshot, ao as TaskSkillNotice, ag as SubagentOutcome, L as LegacyPlanState, C as ConversationMessage, ac as SkillLoadNotice, P as PendingPlanTurn, a as AttemptUsage, a3 as RunSettings, O as PlanUsage, Y as ReplyRun, M as ModelUsage, aw as UsageTotals, f as ExecutionRecord, a0 as ResearchStep, K as PlanState, $ as ResearchProgress, _ as ResearchLogEntry, ab as SkillLoad, N as PlanStatus, ah as SupervisorLevel, a1 as ResearchStepOutcome, R as PlannerUsage, am as TaskIsolationState, as as TaskUsageSummary } from './Task-C0o4i3Nn.mjs';
2
- import { N as IRunnerSession, K as IConfig, aL as TaskMessageFrom, ax as RunnerModelRef, ap as RunnerCommand, au as RunnerMcpServer, aE as StructuredTurnEnd, j as ApprovalDecision, aD as StructuredEvent, ah as QueuedTaskMessage, k as ApprovalKind, q as ApprovalSource, M as IRunner, ay as RunnerRegistry, J as IApproval, aU as ToolOutcome, d as AgentProcessDeps, a as AgentAdapter, a4 as OrdewellMcpServer, L as IFileSystem, aV as UsageLimitSignal, ac as PlannerToolHandler, p as ApprovalRequest, i as ApprovalAnswer, f as AiProvider, a3 as OrchestratorOption, a9 as PlannerBackendId } from './IFileSystem-DUgeWWQN.mjs';
3
- import { R as RunnerModeInfo } from './ModeResolver-4qNjxcDs.mjs';
1
+ import { ai as Task, a4 as RunnerId, aq as TaskSnapshot, b as AwaitingReason, av as UsageRecord, a5 as RunnerSessionCost, d as DiscoveredModel, af as SkillsService, aa as SkillInfo, Z as RepoGroupLayout, I as IWorktreeIsolation, w as IsolationRun, k as IsolationHandoff, J as PlanIsolation, x as IsolationTaskRecord, al as TaskIsolation, H as IsolationView, S as PrepareIntent, V as PreviousWork, s as IsolationOutcome, X as RepairEvidence, at as TreeSnapshot, aj as TaskDiffRead, ak as TaskDiffResult, r as IsolationMergeResult, ax as Verdict, ap as TaskSkillSnapshot, ao as TaskSkillNotice, ag as SubagentOutcome, L as LegacyPlanState, C as ConversationMessage, ac as SkillLoadNotice, P as PendingPlanTurn, a as AttemptUsage, a3 as RunSettings, O as PlanUsage, Y as ReplyRun, M as ModelUsage, aw as UsageTotals, f as ExecutionRecord, a0 as ResearchStep, K as PlanState, $ as ResearchProgress, _ as ResearchLogEntry, ab as SkillLoad, N as PlanStatus, ah as SupervisorLevel, a1 as ResearchStepOutcome, R as PlannerUsage, am as TaskIsolationState, as as TaskUsageSummary } from './Task-hFfRS9rN.mjs';
2
+ import { N as IRunnerSession, K as IConfig, aL as TaskMessageFrom, ax as RunnerModelRef, ap as RunnerCommand, au as RunnerMcpServer, aE as StructuredTurnEnd, j as ApprovalDecision, aD as StructuredEvent, ah as QueuedTaskMessage, k as ApprovalKind, q as ApprovalSource, M as IRunner, ay as RunnerRegistry, J as IApproval, aU as ToolOutcome, d as AgentProcessDeps, a as AgentAdapter, a4 as OrdewellMcpServer, L as IFileSystem, aV as UsageLimitSignal, ac as PlannerToolHandler, p as ApprovalRequest, i as ApprovalAnswer, f as AiProvider, a3 as OrchestratorOption, a9 as PlannerBackendId } from './IFileSystem-C9W5mRYA.mjs';
3
+ import { R as RunnerModeInfo } from './ModeResolver-C1PN5FYG.mjs';
4
4
 
5
5
  type NotificationAction = {
6
6
  label: string;
@@ -394,6 +394,12 @@ interface PlannerModes {
394
394
  type IsolationNoticeLevel = 'info' | 'warn' | 'error';
395
395
  /** How an attempt that may run in a worktree gets one: fresh, the kept one for a repair, or restoring the previous attempt's work. */
396
396
  type AttemptIntent = 'fresh' | 'repair' | PrepareIntent;
397
+ /**
398
+ * What adopting a persisted run found: nothing to change, landed work git
399
+ * shows the user has merged since, or a settled run that had nothing left to
400
+ * hand over and was cleared up.
401
+ */
402
+ type AdoptOutcome = 'unchanged' | 'changed' | 'cleared';
397
403
  interface AttemptWorkspace {
398
404
  cwd: string;
399
405
  worktree: boolean;
@@ -451,6 +457,8 @@ declare class IsolationRunController {
451
457
  private readonly listener;
452
458
  private readonly liveTasks;
453
459
  private run;
460
+ /** An adoption stays scoped even while cleanup temporarily leaves no run record. */
461
+ private adoptions;
454
462
  /** Copied paths already reported for the current run: every task gets the same copies. */
455
463
  private reportedCopies;
456
464
  private reportedSetupFailures;
@@ -492,13 +500,20 @@ declare class IsolationRunController {
492
500
  * Take over a plan's persisted isolation, or none for a plan that has not
493
501
  * isolated yet. Whatever a crashed process left behind for the run — a
494
502
  * worktree still marked active, a directory no record owns — is pruned,
495
- * while kept, failed and conflicted worktrees stay for the user.
503
+ * while kept, failed and conflicted worktrees stay for the user. Then git is
504
+ * asked which landed work the user has merged since the record was saved:
505
+ * a settled run whose landed work is all in HEAD has nothing left to hand
506
+ * over, so it is cleared up as Merge all would have, unless it still holds
507
+ * work that never landed (ADR-0013).
496
508
  *
497
- * Deliberately not reported as a change: adopting is not a change to
498
- * persist, and a host that adopts without persisting (VS Code's restore)
499
- * would otherwise write a new session file on every reload.
500
- */
501
- adopt(state: PlanIsolation | null): Promise<void>;
509
+ * Deliberately not reported to the listener: adopting is not a change of the
510
+ * session's own, and a host that adopts without persisting (VS Code's
511
+ * restore) would otherwise write a new session file on every reload. What
512
+ * git changed is returned instead, for the caller to save where it can and
513
+ * announce. A plan loaded meanwhile supersedes this adoption, which then
514
+ * touches nothing and resolves `unchanged`.
515
+ */
516
+ adopt(state: PlanIsolation | null): Promise<AdoptOutcome>;
502
517
  /** Open a run if none is, leaving whether it isolates to its first change task. */
503
518
  open(): void;
504
519
  /**
@@ -587,6 +602,10 @@ declare class IsolationRunController {
587
602
  * with git. Resolves true when some was found.
588
603
  */
589
604
  refreshInHead(): Promise<boolean>;
605
+ /** Mark the run's landed work git finds in HEAD; true when some was found. */
606
+ private findLanded;
607
+ /** The run landed something and every landing is in the user's HEAD. */
608
+ private allMerged;
590
609
  /**
591
610
  * The tracked state of the workspace as an attempt whose tree is checked
592
611
  * starts (see `attemptKind.checksTree`), for {@link filesChangedSince}
@@ -645,6 +664,10 @@ declare class IsolationRunController {
645
664
  * than leaving that work to a deletion.
646
665
  */
647
666
  private clearMerged;
667
+ /** The records that keep a settled run from being cleared up: live, or holding work that never landed. */
668
+ private holdouts;
669
+ /** The run's worktrees and merged branches go; false, said, when git would not let them. */
670
+ private discardMerged;
648
671
  /** Say what a removal kept back instead of deleting: where the work went, or which worktree stayed. */
649
672
  private report;
650
673
  private forget;
@@ -2788,6 +2811,12 @@ declare class CliAgentAiService implements IAiService {
2788
2811
  * `startConversation` reseeds from Ordewell's transcript, which is the same
2789
2812
  * degradation `restoreChat` already performs on every surface.
2790
2813
  *
2814
+ * A process can end while idle without Ordewell stopping it — the OS, the
2815
+ * CLI itself, a sleeping machine, a signal sent to its group — and every
2816
+ * path of ours that kills one also drops its adapter. So an adapter still
2817
+ * held whose process has ended died on its own, and is restarted here
2818
+ * rather than answering the next message with its exit code.
2819
+ *
2791
2820
  * Also restarted when the policy's decision on the runner's own search has
2792
2821
  * changed since the process was spawned: the running thread would otherwise
2793
2822
  * keep searching unasked after Full turned Guarded. Codex 0.162 applies
@@ -1,5 +1,5 @@
1
- import { N as IRunnerSession, ah as QueuedTaskMessage, aE as StructuredTurnEnd, aD as StructuredEvent, aJ as TaskCompleteArgs, r as CheckpointAnswer, aL as TaskMessageFrom, ap as RunnerCommand, O as InvokedCommand, j as ApprovalDecision, K as IConfig, L as IFileSystem } from './IFileSystem-DUgeWWQN.mjs';
2
- import { h as IntegrationDisposal, a5 as RunnerSessionCost, I as IWorktreeIsolation, j as IsolationAvailability, r as IsolationMergeResult, at as TreeSnapshot, a6 as SetupFailure, t as IsolationPruneResult, u as IsolationRemoval, s as IsolationOutcome, X as RepairEvidence, w as IsolationRun, ai as Task, T as PreparedTask, k as IsolationHandoff } from './Task-C0o4i3Nn.mjs';
1
+ import { N as IRunnerSession, ah as QueuedTaskMessage, aE as StructuredTurnEnd, aD as StructuredEvent, aJ as TaskCompleteArgs, r as CheckpointAnswer, aL as TaskMessageFrom, ap as RunnerCommand, O as InvokedCommand, j as ApprovalDecision, K as IConfig, L as IFileSystem } from './IFileSystem-C9W5mRYA.mjs';
2
+ import { h as IntegrationDisposal, a5 as RunnerSessionCost, I as IWorktreeIsolation, j as IsolationAvailability, r as IsolationMergeResult, at as TreeSnapshot, a6 as SetupFailure, t as IsolationPruneResult, u as IsolationRemoval, s as IsolationOutcome, X as RepairEvidence, w as IsolationRun, ai as Task, T as PreparedTask, k as IsolationHandoff } from './Task-hFfRS9rN.mjs';
3
3
  import 'child_process';
4
4
  import 'zod/v4';
5
5
 
package/dist/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { N as IRunnerSession, ah as QueuedTaskMessage, aE as StructuredTurnEnd, aD as StructuredEvent, aJ as TaskCompleteArgs, r as CheckpointAnswer, aL as TaskMessageFrom, ap as RunnerCommand, O as InvokedCommand, j as ApprovalDecision, K as IConfig, L as IFileSystem } from './IFileSystem-C4_mpfze.js';
2
- import { h as IntegrationDisposal, a5 as RunnerSessionCost, I as IWorktreeIsolation, j as IsolationAvailability, r as IsolationMergeResult, at as TreeSnapshot, a6 as SetupFailure, t as IsolationPruneResult, u as IsolationRemoval, s as IsolationOutcome, X as RepairEvidence, w as IsolationRun, ai as Task, T as PreparedTask, k as IsolationHandoff } from './Task-C0o4i3Nn.js';
1
+ import { N as IRunnerSession, ah as QueuedTaskMessage, aE as StructuredTurnEnd, aD as StructuredEvent, aJ as TaskCompleteArgs, r as CheckpointAnswer, aL as TaskMessageFrom, ap as RunnerCommand, O as InvokedCommand, j as ApprovalDecision, K as IConfig, L as IFileSystem } from './IFileSystem-B8qRNC_6.js';
2
+ import { h as IntegrationDisposal, a5 as RunnerSessionCost, I as IWorktreeIsolation, j as IsolationAvailability, r as IsolationMergeResult, at as TreeSnapshot, a6 as SetupFailure, t as IsolationPruneResult, u as IsolationRemoval, s as IsolationOutcome, X as RepairEvidence, w as IsolationRun, ai as Task, T as PreparedTask, k as IsolationHandoff } from './Task-hFfRS9rN.js';
3
3
  import 'child_process';
4
4
  import 'zod/v4';
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ordewell/core",
3
- "version": "0.10.8",
3
+ "version": "0.10.9",
4
4
  "description": "Ordewell core — planner, orchestrator, runners and verification engine.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Alessandro Costanzo Ciano",