@ordewell/core 0.6.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +1 -1
  2. package/dist/{IFileSystem-DQEKyC6H.d.ts → IFileSystem-D4ADfTrX.d.ts} +1 -1
  3. package/dist/{IFileSystem-Qj2MWHn_.d.mts → IFileSystem-DgpX0BU7.d.mts} +1 -1
  4. package/dist/{ModeResolver-ByNpC0EP.d.ts → ModeResolver-BEcRAz1c.d.ts} +3 -3
  5. package/dist/{ModeResolver-rqaY_4Ex.d.mts → ModeResolver-Cv01ZDd9.d.mts} +3 -3
  6. package/dist/{Task-xqdxugt2.d.mts → Task-CoKhvBa1.d.mts} +275 -2
  7. package/dist/{Task-xqdxugt2.d.ts → Task-CoKhvBa1.d.ts} +275 -2
  8. package/dist/{chunk-M4KXBEFJ.mjs → chunk-J3YSTPCE.mjs} +41 -41
  9. package/dist/chunk-J3YSTPCE.mjs.map +1 -0
  10. package/dist/{chunk-I6U3PVHL.mjs → chunk-LSGY7AIZ.mjs} +74 -23
  11. package/dist/chunk-LSGY7AIZ.mjs.map +1 -0
  12. package/dist/{chunk-JRZPSNRO.mjs → chunk-YU4UKKKI.mjs} +1 -1
  13. package/dist/chunk-YU4UKKKI.mjs.map +1 -0
  14. package/dist/index.d.mts +250 -34
  15. package/dist/index.d.ts +250 -34
  16. package/dist/index.js +2002 -670
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +1642 -366
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/order-labels.d.mts +2 -1
  21. package/dist/order-labels.d.ts +2 -1
  22. package/dist/{parsing-DDZ1rUYa.d.mts → parsing-B4OCHH1_.d.mts} +24 -3
  23. package/dist/{parsing-COPG8-Ep.d.ts → parsing-DMdOq-BV.d.ts} +24 -3
  24. package/dist/parsing.d.mts +4 -3
  25. package/dist/parsing.d.ts +4 -3
  26. package/dist/parsing.js +36 -38
  27. package/dist/parsing.js.map +1 -1
  28. package/dist/parsing.mjs +2 -2
  29. package/dist/{plan-utils-Br8UAoiu.d.ts → plan-utils-BdYPRBno.d.ts} +28 -3
  30. package/dist/{plan-utils-DMgajMvd.d.mts → plan-utils-CD1Xu65s.d.mts} +28 -3
  31. package/dist/plan-utils.d.mts +4 -3
  32. package/dist/plan-utils.d.ts +4 -3
  33. package/dist/plan-utils.js +111 -58
  34. package/dist/plan-utils.js.map +1 -1
  35. package/dist/plan-utils.mjs +8 -2
  36. package/dist/testing.d.mts +11 -2
  37. package/dist/testing.d.ts +11 -2
  38. package/dist/testing.js +17 -0
  39. package/dist/testing.js.map +1 -1
  40. package/dist/testing.mjs +17 -0
  41. package/dist/testing.mjs.map +1 -1
  42. package/package.json +4 -2
  43. package/dist/chunk-I6U3PVHL.mjs.map +0 -1
  44. package/dist/chunk-JRZPSNRO.mjs.map +0 -1
  45. package/dist/chunk-M4KXBEFJ.mjs.map +0 -1
package/dist/parsing.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  parsePartialPlan,
3
3
  parsePlanJson
4
- } from "./chunk-M4KXBEFJ.mjs";
4
+ } from "./chunk-J3YSTPCE.mjs";
5
5
  import {
6
6
  PlanParseError,
7
7
  extractJsonObject
8
- } from "./chunk-JRZPSNRO.mjs";
8
+ } from "./chunk-YU4UKKKI.mjs";
9
9
  import "./chunk-HPNUFBIT.mjs";
10
10
  export {
11
11
  PlanParseError,
@@ -1,5 +1,5 @@
1
- import { aS as StructuredTurnEnd, aU as SubagentOutcome, bb as UsageRecord, k as ApprovalDecision, aQ as StructuredEvent, aG as RunnerId, w as DiscoveredModel, aV as Task, a6 as LegacyPlanState, aw as QueuedMessage, bc as UsageTotals, bi as Verdict, aW as TaskIsolation, b5 as TaskTransport, r as AwaitingReason, ax as QueuedTaskMessage, Q as IsolationHandoff, X as IsolationMergeResult, aC as ResearchStep, l as ApprovalKind, q as ApprovalSource, aD as ResearchStepOutcome, u as ConversationMessage, aA as ResearchLogEntry, ai as PlannerUsage } from './Task-xqdxugt2.js';
2
- import { R as RunnerModeInfo } from './ModeResolver-ByNpC0EP.js';
1
+ import { b7 as StructuredTurnEnd, b9 as SubagentOutcome, bz as UsageRecord, k as ApprovalDecision, b5 as StructuredEvent, aX as RunnerId, y as DiscoveredModel, bc as Task, a9 as LegacyPlanState, aN as QueuedMessage, bA as UsageTotals, bG as Verdict, be as TaskIsolation, bt as TaskTransport, r as AwaitingReason, aO as QueuedTaskMessage, T as IsolationHandoff, _ as IsolationMergeResult, aT as ResearchStep, l as ApprovalKind, q as ApprovalSource, aU as ResearchStepOutcome, w as ConversationMessage, aR as ResearchLogEntry, az as PlannerUsage } from './Task-CoKhvBa1.js';
2
+ import { R as RunnerModeInfo } from './ModeResolver-BEcRAz1c.js';
3
3
 
4
4
  /**
5
5
  * One entry of a structured task's log (ADR-0018, P1): what a runner did,
@@ -647,6 +647,11 @@ interface ToolHeadline {
647
647
  keyArg: string;
648
648
  }
649
649
  type ToolStatus = 'pending' | 'ok' | 'error' | 'denied' | 'interrupted';
650
+ /** What a file edit changed, counted from its diff. */
651
+ interface DiffStat {
652
+ added: number;
653
+ removed: number;
654
+ }
650
655
  interface ToolBlock {
651
656
  type: 'tool';
652
657
  id: string;
@@ -662,6 +667,8 @@ interface ToolBlock {
662
667
  output: string;
663
668
  /** Every line of `output`, counted as {@link outputPreview} counts them. */
664
669
  outputLineCount: number;
670
+ /** Present when the call edited a file and `output` is its diff: a surface draws it as one. */
671
+ diff?: DiffStat;
665
672
  turnId?: string;
666
673
  /**
667
674
  * The subagent this call starts. The call becomes that subagent's block once
@@ -831,6 +838,24 @@ interface OutputPreview {
831
838
  declare function outputLines(output: string): string[];
832
839
  /** The head of a tool's output for a collapsed row, and how many lines it leaves out. */
833
840
  declare function outputPreview(output: string, maxLines: number): OutputPreview;
841
+ /**
842
+ * The lines a diff adds and removes, or null when `output` is not one: every
843
+ * line a hunk header, context, an addition or a removal, and at least one of
844
+ * the last two.
845
+ */
846
+ declare function diffStat(output: string): DiffStat | null;
847
+ /** `gap` stands between two hunks, for the lines a diff leaves out. */
848
+ type DiffRowKind = 'added' | 'removed' | 'context' | 'gap';
849
+ interface DiffRow {
850
+ kind: DiffRowKind;
851
+ /** The line in the file: the old file's for a removal, the new file's otherwise. */
852
+ line?: number;
853
+ text: string;
854
+ }
855
+ /** A diff as the rows a surface draws, numbered as an editor would number them. */
856
+ declare function diffRows(output: string): DiffRow[];
857
+ /** "Added 2 lines, removed 1 line": the summary every surface puts on an edit's row. */
858
+ declare function diffSummary({ added, removed }: DiffStat): string;
834
859
 
835
860
  /**
836
861
  * Prompts the user sent while a planner turn was in flight, waiting to be the
@@ -900,4 +925,4 @@ declare function hasHiddenDetail(blocks: readonly DisplayBlock[]): boolean;
900
925
  /** The conversation line for a task starting, worded the same on every surface. */
901
926
  declare function taskStartedNotice(title: string, runner?: string): string;
902
927
 
903
- export { followTurn as $, type ApplyTaskOpsResult as A, type TurnGate as B, CHECKPOINT_TRUNCATE_LENGTH as C, type DisplayBlock as D, EMPTY_CONVERSATION as E, aheadOfDraft as F, type GatedConversation as G, applyTaskOps as H, canMergeTasks as I, canSetDependencies as J, canSplitTask as K, type LocalEntry as L, type MergeGateView as M, NO_TURN as N, type OutputPreview as O, type PlanBlock as P, capConflictFiles as Q, classifyOutcome as R, type SerializedPlan as S, type TakenPrompt as T, type UsageBlock as U, coalesceTaskLog as V, dependencyCandidates as W, dependentsOf as X, digestTaskLog as Y, drainNext as Z, executionSummary as _, type ApprovalBlock as a, fromTranscript as a0, hasHiddenDetail as a1, holdPrompt as a2, outputLines as a3, outputPreview as a4, parseTaskOpsJson as a5, reduceConversation as a6, reduceTaskLog as a7, replayTaskLog as a8, runnerToolSubject as a9, serializePlan as aa, serializeTask as ab, serializeTaskStatus as ac, stopTurn as ad, summarizeToolCall as ae, taskStartedNotice as af, textHasTaskOps as ag, toTaskLogEvent as ah, toolHeadline as ai, trimToolOutput as aj, truncateCheckpointSummary as ak, unsendAll as al, unsendLatest as am, type ApprovalStatus as b, type ConversationInput as c, type ConversationView as d, EMPTY_HOLD as e, EMPTY_TASK_LOG as f, type MessageBlock as g, type MessageRole as h, type PlanMarkerStatus as i, type PromptHold as j, type SerializedTask as k, type SerializedTaskStatus as l, type SessionBroadcaster as m, type SessionMessage as n, type SessionNotice as o, type SubagentBlock as p, type SubagentChild as q, type SubagentStatus as r, type TaskLogEvent as s, type TaskLogView as t, type TaskOp as u, type TaskRef as v, type ThinkingDisplayBlock as w, type ToolBlock as x, type ToolHeadline as y, type ToolStatus as z };
928
+ export { diffRows as $, type ApplyTaskOpsResult as A, type ToolBlock as B, CHECKPOINT_TRUNCATE_LENGTH as C, type DiffRow as D, EMPTY_CONVERSATION as E, type ToolHeadline as F, type GatedConversation as G, type ToolStatus as H, type TurnGate as I, aheadOfDraft as J, applyTaskOps as K, type LocalEntry as L, type MergeGateView as M, NO_TURN as N, type OutputPreview as O, type PlanBlock as P, canMergeTasks as Q, canSetDependencies as R, type SerializedPlan as S, type TakenPrompt as T, type UsageBlock as U, canSplitTask as V, capConflictFiles as W, classifyOutcome as X, coalesceTaskLog as Y, dependencyCandidates as Z, dependentsOf as _, type ApprovalBlock as a, diffStat as a0, diffSummary as a1, digestTaskLog as a2, drainNext as a3, executionSummary as a4, followTurn as a5, fromTranscript as a6, hasHiddenDetail as a7, holdPrompt as a8, outputLines as a9, outputPreview as aa, parseTaskOpsJson as ab, reduceConversation as ac, reduceTaskLog as ad, replayTaskLog as ae, runnerToolSubject as af, serializePlan as ag, serializeTask as ah, serializeTaskStatus as ai, stopTurn as aj, summarizeToolCall as ak, taskStartedNotice as al, textHasTaskOps as am, toTaskLogEvent as an, toolHeadline as ao, trimToolOutput as ap, truncateCheckpointSummary as aq, unsendAll as ar, unsendLatest as as, type ApprovalStatus as b, type ConversationInput as c, type ConversationView as d, type DiffRowKind as e, type DiffStat as f, type DisplayBlock as g, EMPTY_HOLD as h, EMPTY_TASK_LOG as i, type MessageBlock as j, type MessageRole as k, type PlanMarkerStatus as l, type PromptHold as m, type SerializedTask as n, type SerializedTaskStatus as o, type SessionBroadcaster as p, type SessionMessage as q, type SessionNotice as r, type SubagentBlock as s, type SubagentChild as t, type SubagentStatus as u, type TaskLogEvent as v, type TaskLogView as w, type TaskOp as x, type TaskRef as y, type ThinkingDisplayBlock as z };
@@ -1,5 +1,5 @@
1
- import { aS as StructuredTurnEnd, aU as SubagentOutcome, bb as UsageRecord, k as ApprovalDecision, aQ as StructuredEvent, aG as RunnerId, w as DiscoveredModel, aV as Task, a6 as LegacyPlanState, aw as QueuedMessage, bc as UsageTotals, bi as Verdict, aW as TaskIsolation, b5 as TaskTransport, r as AwaitingReason, ax as QueuedTaskMessage, Q as IsolationHandoff, X as IsolationMergeResult, aC as ResearchStep, l as ApprovalKind, q as ApprovalSource, aD as ResearchStepOutcome, u as ConversationMessage, aA as ResearchLogEntry, ai as PlannerUsage } from './Task-xqdxugt2.mjs';
2
- import { R as RunnerModeInfo } from './ModeResolver-rqaY_4Ex.mjs';
1
+ import { b7 as StructuredTurnEnd, b9 as SubagentOutcome, bz as UsageRecord, k as ApprovalDecision, b5 as StructuredEvent, aX as RunnerId, y as DiscoveredModel, bc as Task, a9 as LegacyPlanState, aN as QueuedMessage, bA as UsageTotals, bG as Verdict, be as TaskIsolation, bt as TaskTransport, r as AwaitingReason, aO as QueuedTaskMessage, T as IsolationHandoff, _ as IsolationMergeResult, aT as ResearchStep, l as ApprovalKind, q as ApprovalSource, aU as ResearchStepOutcome, w as ConversationMessage, aR as ResearchLogEntry, az as PlannerUsage } from './Task-CoKhvBa1.mjs';
2
+ import { R as RunnerModeInfo } from './ModeResolver-Cv01ZDd9.mjs';
3
3
 
4
4
  /**
5
5
  * One entry of a structured task's log (ADR-0018, P1): what a runner did,
@@ -647,6 +647,11 @@ interface ToolHeadline {
647
647
  keyArg: string;
648
648
  }
649
649
  type ToolStatus = 'pending' | 'ok' | 'error' | 'denied' | 'interrupted';
650
+ /** What a file edit changed, counted from its diff. */
651
+ interface DiffStat {
652
+ added: number;
653
+ removed: number;
654
+ }
650
655
  interface ToolBlock {
651
656
  type: 'tool';
652
657
  id: string;
@@ -662,6 +667,8 @@ interface ToolBlock {
662
667
  output: string;
663
668
  /** Every line of `output`, counted as {@link outputPreview} counts them. */
664
669
  outputLineCount: number;
670
+ /** Present when the call edited a file and `output` is its diff: a surface draws it as one. */
671
+ diff?: DiffStat;
665
672
  turnId?: string;
666
673
  /**
667
674
  * The subagent this call starts. The call becomes that subagent's block once
@@ -831,6 +838,24 @@ interface OutputPreview {
831
838
  declare function outputLines(output: string): string[];
832
839
  /** The head of a tool's output for a collapsed row, and how many lines it leaves out. */
833
840
  declare function outputPreview(output: string, maxLines: number): OutputPreview;
841
+ /**
842
+ * The lines a diff adds and removes, or null when `output` is not one: every
843
+ * line a hunk header, context, an addition or a removal, and at least one of
844
+ * the last two.
845
+ */
846
+ declare function diffStat(output: string): DiffStat | null;
847
+ /** `gap` stands between two hunks, for the lines a diff leaves out. */
848
+ type DiffRowKind = 'added' | 'removed' | 'context' | 'gap';
849
+ interface DiffRow {
850
+ kind: DiffRowKind;
851
+ /** The line in the file: the old file's for a removal, the new file's otherwise. */
852
+ line?: number;
853
+ text: string;
854
+ }
855
+ /** A diff as the rows a surface draws, numbered as an editor would number them. */
856
+ declare function diffRows(output: string): DiffRow[];
857
+ /** "Added 2 lines, removed 1 line": the summary every surface puts on an edit's row. */
858
+ declare function diffSummary({ added, removed }: DiffStat): string;
834
859
 
835
860
  /**
836
861
  * Prompts the user sent while a planner turn was in flight, waiting to be the
@@ -900,4 +925,4 @@ declare function hasHiddenDetail(blocks: readonly DisplayBlock[]): boolean;
900
925
  /** The conversation line for a task starting, worded the same on every surface. */
901
926
  declare function taskStartedNotice(title: string, runner?: string): string;
902
927
 
903
- export { followTurn as $, type ApplyTaskOpsResult as A, type TurnGate as B, CHECKPOINT_TRUNCATE_LENGTH as C, type DisplayBlock as D, EMPTY_CONVERSATION as E, aheadOfDraft as F, type GatedConversation as G, applyTaskOps as H, canMergeTasks as I, canSetDependencies as J, canSplitTask as K, type LocalEntry as L, type MergeGateView as M, NO_TURN as N, type OutputPreview as O, type PlanBlock as P, capConflictFiles as Q, classifyOutcome as R, type SerializedPlan as S, type TakenPrompt as T, type UsageBlock as U, coalesceTaskLog as V, dependencyCandidates as W, dependentsOf as X, digestTaskLog as Y, drainNext as Z, executionSummary as _, type ApprovalBlock as a, fromTranscript as a0, hasHiddenDetail as a1, holdPrompt as a2, outputLines as a3, outputPreview as a4, parseTaskOpsJson as a5, reduceConversation as a6, reduceTaskLog as a7, replayTaskLog as a8, runnerToolSubject as a9, serializePlan as aa, serializeTask as ab, serializeTaskStatus as ac, stopTurn as ad, summarizeToolCall as ae, taskStartedNotice as af, textHasTaskOps as ag, toTaskLogEvent as ah, toolHeadline as ai, trimToolOutput as aj, truncateCheckpointSummary as ak, unsendAll as al, unsendLatest as am, type ApprovalStatus as b, type ConversationInput as c, type ConversationView as d, EMPTY_HOLD as e, EMPTY_TASK_LOG as f, type MessageBlock as g, type MessageRole as h, type PlanMarkerStatus as i, type PromptHold as j, type SerializedTask as k, type SerializedTaskStatus as l, type SessionBroadcaster as m, type SessionMessage as n, type SessionNotice as o, type SubagentBlock as p, type SubagentChild as q, type SubagentStatus as r, type TaskLogEvent as s, type TaskLogView as t, type TaskOp as u, type TaskRef as v, type ThinkingDisplayBlock as w, type ToolBlock as x, type ToolHeadline as y, type ToolStatus as z };
928
+ export { diffRows as $, type ApplyTaskOpsResult as A, type ToolBlock as B, CHECKPOINT_TRUNCATE_LENGTH as C, type DiffRow as D, EMPTY_CONVERSATION as E, type ToolHeadline as F, type GatedConversation as G, type ToolStatus as H, type TurnGate as I, aheadOfDraft as J, applyTaskOps as K, type LocalEntry as L, type MergeGateView as M, NO_TURN as N, type OutputPreview as O, type PlanBlock as P, canMergeTasks as Q, canSetDependencies as R, type SerializedPlan as S, type TakenPrompt as T, type UsageBlock as U, canSplitTask as V, capConflictFiles as W, classifyOutcome as X, coalesceTaskLog as Y, dependencyCandidates as Z, dependentsOf as _, type ApprovalBlock as a, diffStat as a0, diffSummary as a1, digestTaskLog as a2, drainNext as a3, executionSummary as a4, followTurn as a5, fromTranscript as a6, hasHiddenDetail as a7, holdPrompt as a8, outputLines as a9, outputPreview as aa, parseTaskOpsJson as ab, reduceConversation as ac, reduceTaskLog as ad, replayTaskLog as ae, runnerToolSubject as af, serializePlan as ag, serializeTask as ah, serializeTaskStatus as ai, stopTurn as aj, summarizeToolCall as ak, taskStartedNotice as al, textHasTaskOps as am, toTaskLogEvent as an, toolHeadline as ao, trimToolOutput as ap, truncateCheckpointSummary as aq, unsendAll as ar, unsendLatest as as, type ApprovalStatus as b, type ConversationInput as c, type ConversationView as d, type DiffRowKind as e, type DiffStat as f, type DisplayBlock as g, EMPTY_HOLD as h, EMPTY_TASK_LOG as i, type MessageBlock as j, type MessageRole as k, type PlanMarkerStatus as l, type PromptHold as m, type SerializedTask as n, type SerializedTaskStatus as o, type SessionBroadcaster as p, type SessionMessage as q, type SessionNotice as r, type SubagentBlock as s, type SubagentChild as t, type SubagentStatus as u, type TaskLogEvent as v, type TaskLogView as w, type TaskOp as x, type TaskRef as y, type ThinkingDisplayBlock as z };
@@ -1,5 +1,6 @@
1
- export { a as ApprovalBlock, b as ApprovalStatus, C as CHECKPOINT_TRUNCATE_LENGTH, c as ConversationInput, d as ConversationView, D as DisplayBlock, E as EMPTY_CONVERSATION, e as EMPTY_HOLD, f as EMPTY_TASK_LOG, G as GatedConversation, L as LocalEntry, g as MessageBlock, h as MessageRole, N as NO_TURN, O as OutputPreview, P as PlanBlock, i as PlanMarkerStatus, j as PromptHold, p as SubagentBlock, q as SubagentChild, r as SubagentStatus, T as TakenPrompt, t as TaskLogView, v as TaskRef, w as ThinkingDisplayBlock, x as ToolBlock, y as ToolHeadline, z as ToolStatus, B as TurnGate, U as UsageBlock, F as aheadOfDraft, I as canMergeTasks, J as canSetDependencies, K as canSplitTask, Q as capConflictFiles, W as dependencyCandidates, X as dependentsOf, Z as drainNext, $ as followTurn, a0 as fromTranscript, a1 as hasHiddenDetail, a2 as holdPrompt, a3 as outputLines, a4 as outputPreview, a6 as reduceConversation, a7 as reduceTaskLog, a8 as replayTaskLog, a9 as runnerToolSubject, ad as stopTurn, ae as summarizeToolCall, af as taskStartedNotice, ai as toolHeadline, ak as truncateCheckpointSummary, al as unsendAll, am as unsendLatest } from './plan-utils-DMgajMvd.mjs';
2
- import './Task-xqdxugt2.mjs';
1
+ 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, l as PlanMarkerStatus, m as PromptHold, s as SubagentBlock, t as SubagentChild, u as SubagentStatus, T as TakenPrompt, w as TaskLogView, y as TaskRef, z as ThinkingDisplayBlock, B as ToolBlock, F as ToolHeadline, H as ToolStatus, I as TurnGate, U as UsageBlock, J as aheadOfDraft, Q as canMergeTasks, R as canSetDependencies, V as canSplitTask, W as capConflictFiles, Z as dependencyCandidates, _ as dependentsOf, $ as diffRows, a0 as diffStat, a1 as diffSummary, a3 as drainNext, a5 as followTurn, a6 as fromTranscript, a7 as hasHiddenDetail, a8 as holdPrompt, a9 as outputLines, aa as outputPreview, ac as reduceConversation, ad as reduceTaskLog, ae as replayTaskLog, af as runnerToolSubject, aj as stopTurn, ak as summarizeToolCall, al as taskStartedNotice, ao as toolHeadline, aq as truncateCheckpointSummary, ar as unsendAll, as as unsendLatest } from './plan-utils-CD1Xu65s.mjs';
2
+ import './Task-CoKhvBa1.mjs';
3
3
  import 'child_process';
4
4
  import 'events';
5
- import './ModeResolver-rqaY_4Ex.mjs';
5
+ import 'zod/v4';
6
+ import './ModeResolver-Cv01ZDd9.mjs';
@@ -1,5 +1,6 @@
1
- export { a as ApprovalBlock, b as ApprovalStatus, C as CHECKPOINT_TRUNCATE_LENGTH, c as ConversationInput, d as ConversationView, D as DisplayBlock, E as EMPTY_CONVERSATION, e as EMPTY_HOLD, f as EMPTY_TASK_LOG, G as GatedConversation, L as LocalEntry, g as MessageBlock, h as MessageRole, N as NO_TURN, O as OutputPreview, P as PlanBlock, i as PlanMarkerStatus, j as PromptHold, p as SubagentBlock, q as SubagentChild, r as SubagentStatus, T as TakenPrompt, t as TaskLogView, v as TaskRef, w as ThinkingDisplayBlock, x as ToolBlock, y as ToolHeadline, z as ToolStatus, B as TurnGate, U as UsageBlock, F as aheadOfDraft, I as canMergeTasks, J as canSetDependencies, K as canSplitTask, Q as capConflictFiles, W as dependencyCandidates, X as dependentsOf, Z as drainNext, $ as followTurn, a0 as fromTranscript, a1 as hasHiddenDetail, a2 as holdPrompt, a3 as outputLines, a4 as outputPreview, a6 as reduceConversation, a7 as reduceTaskLog, a8 as replayTaskLog, a9 as runnerToolSubject, ad as stopTurn, ae as summarizeToolCall, af as taskStartedNotice, ai as toolHeadline, ak as truncateCheckpointSummary, al as unsendAll, am as unsendLatest } from './plan-utils-Br8UAoiu.js';
2
- import './Task-xqdxugt2.js';
1
+ 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, l as PlanMarkerStatus, m as PromptHold, s as SubagentBlock, t as SubagentChild, u as SubagentStatus, T as TakenPrompt, w as TaskLogView, y as TaskRef, z as ThinkingDisplayBlock, B as ToolBlock, F as ToolHeadline, H as ToolStatus, I as TurnGate, U as UsageBlock, J as aheadOfDraft, Q as canMergeTasks, R as canSetDependencies, V as canSplitTask, W as capConflictFiles, Z as dependencyCandidates, _ as dependentsOf, $ as diffRows, a0 as diffStat, a1 as diffSummary, a3 as drainNext, a5 as followTurn, a6 as fromTranscript, a7 as hasHiddenDetail, a8 as holdPrompt, a9 as outputLines, aa as outputPreview, ac as reduceConversation, ad as reduceTaskLog, ae as replayTaskLog, af as runnerToolSubject, aj as stopTurn, ak as summarizeToolCall, al as taskStartedNotice, ao as toolHeadline, aq as truncateCheckpointSummary, ar as unsendAll, as as unsendLatest } from './plan-utils-BdYPRBno.js';
2
+ import './Task-CoKhvBa1.js';
3
3
  import 'child_process';
4
4
  import 'events';
5
- import './ModeResolver-ByNpC0EP.js';
5
+ import 'zod/v4';
6
+ import './ModeResolver-BEcRAz1c.js';
@@ -32,6 +32,9 @@ __export(plan_utils_exports, {
32
32
  capConflictFiles: () => capConflictFiles,
33
33
  dependencyCandidates: () => dependencyCandidates,
34
34
  dependentsOf: () => dependentsOf,
35
+ diffRows: () => diffRows,
36
+ diffStat: () => diffStat,
37
+ diffSummary: () => diffSummary,
35
38
  drainNext: () => drainNext,
36
39
  followTurn: () => followTurn,
37
40
  fromTranscript: () => fromTranscript,
@@ -268,9 +271,9 @@ function oneLine(text2) {
268
271
  return text2.replace(/\s+/g, " ").trim();
269
272
  }
270
273
  function firstLineOf(command) {
271
- const lines = command.trim().split(/\r?\n/);
272
- const more = lines.length - 1;
273
- return more > 0 ? `${lines[0]} \u2026 +${more} line${more === 1 ? "" : "s"}` : lines[0];
274
+ const lines2 = command.trim().split(/\r?\n/);
275
+ const more = lines2.length - 1;
276
+ return more > 0 ? `${lines2[0]} \u2026 +${more} line${more === 1 ? "" : "s"}` : lines2[0];
274
277
  }
275
278
  function text(value) {
276
279
  return typeof value === "string" ? value : "";
@@ -317,14 +320,108 @@ function toolHeadline(tool, args, toolLabel) {
317
320
  return { name, keyArg: parsed ? keyArgOf(tool, parsed) : oneLine(args) };
318
321
  }
319
322
  function outputLines(output) {
320
- const lines = output.replace(/\r\n?/g, "\n").replace(ANSI_OR_CTRL_RE, "").split("\n");
321
- while (lines.length > 0 && lines[lines.length - 1].trim() === "") lines.pop();
322
- return lines;
323
+ const lines2 = output.replace(/\r\n?/g, "\n").replace(ANSI_OR_CTRL_RE, "").split("\n");
324
+ while (lines2.length > 0 && lines2[lines2.length - 1].trim() === "") lines2.pop();
325
+ return lines2;
323
326
  }
324
327
  function outputPreview(output, maxLines) {
325
- const lines = outputLines(output);
326
- const shown = lines.slice(0, Math.max(0, maxLines));
327
- return { lines: shown, hiddenLineCount: lines.length - shown.length };
328
+ const lines2 = outputLines(output);
329
+ const shown = lines2.slice(0, Math.max(0, maxLines));
330
+ return { lines: shown, hiddenLineCount: lines2.length - shown.length };
331
+ }
332
+ function diffStat(output) {
333
+ const lines2 = outputLines(output);
334
+ let added = 0;
335
+ let removed = 0;
336
+ for (const line of lines2) {
337
+ if (line.startsWith("+")) added += 1;
338
+ else if (line.startsWith("-")) removed += 1;
339
+ else if (!(line.startsWith("@@") || line.startsWith(" ") || line === "" || line.startsWith("\\"))) return null;
340
+ }
341
+ return added + removed > 0 ? { added, removed } : null;
342
+ }
343
+ var HUNK_RANGE = /^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;
344
+ function diffRows(output) {
345
+ const rows = [];
346
+ let oldLine = 1;
347
+ let newLine = 1;
348
+ for (const line of outputLines(output)) {
349
+ const range = HUNK_RANGE.exec(line);
350
+ if (range) {
351
+ if (rows.length > 0) rows.push({ kind: "gap", text: "" });
352
+ oldLine = Number(range[1]);
353
+ newLine = Number(range[2]);
354
+ } else if (line.startsWith("+")) {
355
+ rows.push({ kind: "added", line: newLine++, text: line.slice(1) });
356
+ } else if (line.startsWith("-")) {
357
+ rows.push({ kind: "removed", line: oldLine++, text: line.slice(1) });
358
+ } else if (!line.startsWith("\\")) {
359
+ rows.push({ kind: "context", line: newLine, text: line.slice(1) });
360
+ oldLine += 1;
361
+ newLine += 1;
362
+ }
363
+ }
364
+ return rows;
365
+ }
366
+ function lines(count) {
367
+ return `${count} line${count === 1 ? "" : "s"}`;
368
+ }
369
+ function diffSummary({ added, removed }) {
370
+ if (!removed) return `Added ${lines(added)}`;
371
+ if (!added) return `Removed ${lines(removed)}`;
372
+ return `Added ${lines(added)}, removed ${lines(removed)}`;
373
+ }
374
+
375
+ // src/services/harness/agentTools.ts
376
+ var KNOWN_TOOLS = {
377
+ // Claude Code
378
+ read: "read_file",
379
+ grep: "grep",
380
+ glob: "glob",
381
+ bash: "bash",
382
+ ls: "list_dir",
383
+ webfetch: "fetch",
384
+ websearch: "web_search",
385
+ // Codex — its sandboxed command tool is a shell by another name
386
+ shell: "bash",
387
+ exec_command: "bash",
388
+ local_shell: "bash",
389
+ // OpenCode
390
+ list: "list_dir",
391
+ fetch: "fetch"
392
+ };
393
+ var FILE_EDIT_TOOLS = /* @__PURE__ */ new Set(["edit", "write", "multiedit", "notebookedit", "applypatch", "patch", "add", "update", "delete", "filechange"]);
394
+ function isFileEditTool(name) {
395
+ return FILE_EDIT_TOOLS.has(name.trim().toLowerCase().replace(/[_-]/g, ""));
396
+ }
397
+ function mapAgentTool(name) {
398
+ const normalized = name.trim().toLowerCase().replace(/[_-]/g, "");
399
+ const direct = KNOWN_TOOLS[normalized] ?? KNOWN_TOOLS[name.trim().toLowerCase()];
400
+ if (direct) {
401
+ return { tool: direct, toolLabel: name };
402
+ }
403
+ return { tool: "agent_tool", toolLabel: name };
404
+ }
405
+ function normalizeAgentArgs(tool, args) {
406
+ const out = { ...args };
407
+ const alias = (from, to) => {
408
+ if (out[to] === void 0 && out[from] !== void 0) out[to] = out[from];
409
+ };
410
+ if (tool === "read_file" || tool === "list_dir") {
411
+ alias("filePath", "path");
412
+ alias("file_path", "path");
413
+ alias("target", "path");
414
+ }
415
+ if (tool === "bash") {
416
+ alias("cmd", "command");
417
+ alias("script", "command");
418
+ if (typeof out.command !== "string" && Array.isArray(out.command)) {
419
+ out.command = out.command.join(" ");
420
+ }
421
+ }
422
+ if (tool === "fetch") alias("uri", "url");
423
+ if (tool === "web_search") alias("q", "query");
424
+ return out;
328
425
  }
329
426
 
330
427
  // src/conversation/records.ts
@@ -353,7 +450,8 @@ var STATUS_OF_OUTCOME = {
353
450
  not_executed: "interrupted"
354
451
  };
355
452
  function finishedTool(call, output, outcome) {
356
- return { ...call, status: STATUS_OF_OUTCOME[outcome], outcome, output, outputLineCount: outputLines(output).length };
453
+ const diff = outcome === "success" && isFileEditTool(call.toolLabel ?? call.tool) ? diffStat(output) : null;
454
+ return { ...call, status: STATUS_OF_OUTCOME[outcome], outcome, output, outputLineCount: outputLines(output).length, ...diff ? { diff } : {} };
357
455
  }
358
456
  function settledTool(call, step) {
359
457
  return finishedTool(call, step.result, step.outcome);
@@ -788,54 +886,6 @@ function fromTranscript(conversationHistory, researchLog, plannerUsage) {
788
886
  return { blocks, nextId, ...transcriptAt ? { transcriptAt } : {} };
789
887
  }
790
888
 
791
- // src/services/harness/agentTools.ts
792
- var KNOWN_TOOLS = {
793
- // Claude Code
794
- read: "read_file",
795
- grep: "grep",
796
- glob: "glob",
797
- bash: "bash",
798
- ls: "list_dir",
799
- webfetch: "fetch",
800
- websearch: "web_search",
801
- // Codex — its sandboxed command tool is a shell by another name
802
- shell: "bash",
803
- exec_command: "bash",
804
- local_shell: "bash",
805
- // OpenCode
806
- list: "list_dir",
807
- fetch: "fetch"
808
- };
809
- function mapAgentTool(name) {
810
- const normalized = name.trim().toLowerCase().replace(/[_-]/g, "");
811
- const direct = KNOWN_TOOLS[normalized] ?? KNOWN_TOOLS[name.trim().toLowerCase()];
812
- if (direct) {
813
- return { tool: direct, toolLabel: name };
814
- }
815
- return { tool: "agent_tool", toolLabel: name };
816
- }
817
- function normalizeAgentArgs(tool, args) {
818
- const out = { ...args };
819
- const alias = (from, to) => {
820
- if (out[to] === void 0 && out[from] !== void 0) out[to] = out[from];
821
- };
822
- if (tool === "read_file" || tool === "list_dir") {
823
- alias("filePath", "path");
824
- alias("file_path", "path");
825
- alias("target", "path");
826
- }
827
- if (tool === "bash") {
828
- alias("cmd", "command");
829
- alias("script", "command");
830
- if (typeof out.command !== "string" && Array.isArray(out.command)) {
831
- out.command = out.command.join(" ");
832
- }
833
- }
834
- if (tool === "fetch") alias("uri", "url");
835
- if (tool === "web_search") alias("q", "query");
836
- return out;
837
- }
838
-
839
889
  // src/conversation/taskLog.ts
840
890
  var EMPTY_TASK_LOG = { blocks: [], nextId: 1, queued: [], working: false, streams: {} };
841
891
  var TEXT_STREAM = "text";
@@ -1119,6 +1169,9 @@ function taskStartedNotice(title, runner) {
1119
1169
  capConflictFiles,
1120
1170
  dependencyCandidates,
1121
1171
  dependentsOf,
1172
+ diffRows,
1173
+ diffStat,
1174
+ diffSummary,
1122
1175
  drainNext,
1123
1176
  followTurn,
1124
1177
  fromTranscript,