@ordewell/core 0.10.9 → 0.10.11

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 (40) hide show
  1. package/dist/{IFileSystem-C9W5mRYA.d.mts → IFileSystem-1PqRCjhu.d.mts} +21 -3
  2. package/dist/{IFileSystem-B8qRNC_6.d.ts → IFileSystem-lTRL_G9Z.d.ts} +21 -3
  3. package/dist/{ModeResolver-C1PN5FYG.d.mts → ModeResolver-6TQXVsde.d.mts} +1 -1
  4. package/dist/{ModeResolver-CaPnoU8N.d.ts → ModeResolver-CoJAJD-f.d.ts} +1 -1
  5. package/dist/{Task-hFfRS9rN.d.mts → Task-CfBM0wkV.d.mts} +94 -21
  6. package/dist/{Task-hFfRS9rN.d.ts → Task-CfBM0wkV.d.ts} +94 -21
  7. package/dist/{chunk-H7QX32BH.mjs → chunk-24EL4Z2W.mjs} +2 -2
  8. package/dist/{chunk-O6LQU3W6.mjs → chunk-ESKK5I4F.mjs} +138 -21
  9. package/dist/chunk-ESKK5I4F.mjs.map +1 -0
  10. package/dist/{chunk-LTHKFBKM.mjs → chunk-KWS3VEER.mjs} +3 -3
  11. package/dist/{chunk-EEE2GBLG.mjs → chunk-PFH7WFIB.mjs} +1 -1
  12. package/dist/chunk-PFH7WFIB.mjs.map +1 -0
  13. package/dist/index.d.mts +129 -20
  14. package/dist/index.d.ts +129 -20
  15. package/dist/index.js +556 -92
  16. package/dist/index.js.map +1 -1
  17. package/dist/index.mjs +432 -76
  18. package/dist/index.mjs.map +1 -1
  19. package/dist/parsing.d.mts +2 -2
  20. package/dist/parsing.d.ts +2 -2
  21. package/dist/parsing.js.map +1 -1
  22. package/dist/parsing.mjs +3 -3
  23. package/dist/plan-utils.d.mts +4 -4
  24. package/dist/plan-utils.d.ts +4 -4
  25. package/dist/plan-utils.js +144 -18
  26. package/dist/plan-utils.js.map +1 -1
  27. package/dist/plan-utils.mjs +22 -4
  28. package/dist/{runSettingsText-CGKX3aeV.d.ts → runSettingsText-C5uv2axI.d.ts} +29 -18
  29. package/dist/{runSettingsText-rLoYQlUH.d.mts → runSettingsText-Jb_efnI4.d.mts} +29 -18
  30. package/dist/testing.d.mts +12 -3
  31. package/dist/testing.d.ts +12 -3
  32. package/dist/testing.js +16 -1
  33. package/dist/testing.js.map +1 -1
  34. package/dist/testing.mjs +17 -2
  35. package/dist/testing.mjs.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-EEE2GBLG.mjs.map +0 -1
  38. package/dist/chunk-O6LQU3W6.mjs.map +0 -1
  39. /package/dist/{chunk-H7QX32BH.mjs.map → chunk-24EL4Z2W.mjs.map} +0 -0
  40. /package/dist/{chunk-LTHKFBKM.mjs.map → chunk-KWS3VEER.mjs.map} +0 -0
package/dist/parsing.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  parsePlanJson
3
- } from "./chunk-LTHKFBKM.mjs";
3
+ } from "./chunk-KWS3VEER.mjs";
4
4
  import {
5
5
  PlanParseError,
6
6
  extractJsonObject,
7
7
  stripModelNoise
8
- } from "./chunk-H7QX32BH.mjs";
9
- import "./chunk-EEE2GBLG.mjs";
8
+ } from "./chunk-24EL4Z2W.mjs";
9
+ import "./chunk-PFH7WFIB.mjs";
10
10
 
11
11
  // src/services/PartialPlanParser.ts
12
12
  function parsePartialPlan(partial) {
@@ -1,9 +1,9 @@
1
- export { e as ApprovalBlock, g as ApprovalStatus, l as AssignmentIssue, m as AssignmentScope, B as BlockingSubject, p as CHECKPOINT_TRUNCATE_LENGTH, u as CommandBlock, w as CommandStatus, y as CompactionBlock, H as ConversationInput, L as ConversationView, P as DiffRow, Q as DiffRowKind, R as DiffStat, S as DisplayBlock, T as EMPTY_CONVERSATION, U as EMPTY_HOLD, V as EMPTY_RUN, W as EMPTY_TASK_LOG, X as EMPTY_TASK_LOG_FOLLOW, a0 as GatedConversation, af as LocalEntry, ag as MarkdownToken, aj as MessageBlock, ak as MessageRole, am as NOT_STARTED, an as NO_TURN, ao as NewTaskFields, au as OutputPreview, ay as PlanBlock, az as PlanMarkerStatus, aU as PromptHold, aW as RefTask, b8 as RunnerLoadedBlock, bb as SUPERVISOR_LEVEL_LABEL, bt as SkillLoadBlock, bu as SkillToken, bz as SubagentBlock, bA as SubagentChild, bB as SubagentStatus, bL as TakenPrompt, bP as TaskLogBatch, bR as TaskLogFollow, bS as TaskLogFollowInput, bU as TaskLogView, b$ as TaskPlacement, c3 as TaskRef, c4 as TaskRowAction, c5 as TaskRowContext, c6 as TaskRowIsolation, c7 as TaskRowKind, c8 as TaskRowPlacement, c9 as TaskRowSubject, ca as TaskRowUsage, cb as TaskRowView, cd as TaskStatusKind, ce as ThinkingDisplayBlock, cf as ToolBlock, cg as ToolHeadline, ch as ToolStatus, ci as TreeTask, cj as TurnGate, ck as UsageBlock, cm as WAITS_FOR_APPROVAL_LABEL, ct as aheadOfDraft, cv as approvalLabel, cw as assignmentIssue, cx as assignmentIssueText, cA as awaitingLabel, cB as blockedByLabel, cC as blockingFailures, cD as canMergeTasks, cE as canSetDependencies, cF as canSplitTask, cG as capConflictFiles, cK as dependencyCandidates, cL as dependentsNotice, cM as dependentsOf, cO as diffRows, cP as diffStat, cQ as diffSummary, cS as drainNext, cU as followTaskLog, cV as followTurn, cW as fromTranscript, cY as hasHiddenDetail, cZ as holdPrompt, c_ as isTaskRunning, c$ as loadedSkillTokens, d0 as markAction, d1 as markRequestFor, d2 as markdownHtml, d3 as markdownTokens, d4 as namedRepos, d5 as newTaskFields, d6 as opsEditable, d7 as outputLines, d8 as outputPreview, d9 as parseCount, dd as pastGateConfirmation, di as reconcileApprovals, dj as reduceConversation, dl as reduceTaskLog, dn as replayTaskLog, dq as resolveTaskRef, dr as resolveUserTaskRef, ds as resumeLabel, dt as resumeTime, dv as runnerToolSubject, dz as skillTokens, dA as skippedLabel, dB as stopTurn, dC as subtreeIds, dD as summarizeToolCall, dH as takeAt, dJ as taskOrderLabel, dK as taskPlacement, dM as taskRef, dN as taskRefOf, dO as taskRowActions, dP as taskRowView, dQ as taskStartedNotice, dR as taskStatusKind, dU as titledRefs, dV as titledTaskRef, dW as titledTaskRefOf, dY as toolHeadline, d_ as truncateCheckpointSummary, d$ as unsendAll, e0 as unsendLatest, e1 as walkPlan } from './runSettingsText-rLoYQlUH.mjs';
2
- export { a as AttemptUsage, D as DEFAULT_RUNNERS, M as ModelUsage, O as PlanUsage, R as PlannerUsage, a5 as RunnerSessionCost, as as TaskUsageSummary, au as UsageLine, av as UsageRecord, aw as UsageTotals, az as addAttemptUsage, aA as addModelUsage, aB as addPlannerUsage, aC as addUsage, aD as addUsageTotals, aE as countedSessionCost, aI as endAttemptUsage, aM as isMeasured, aQ as partedPromptUsage, aR as pausedOnLimit, aS as planUsage, aT as plannerContextFill, aV as resumedSessionWindow, aW as startAttemptUsage, aX as taskUsageSummary, aY as usageLine } from './Task-hFfRS9rN.mjs';
3
- import './IFileSystem-C9W5mRYA.mjs';
1
+ export { e as ApprovalBlock, g as ApprovalStatus, l as AssignmentIssue, m as AssignmentScope, B as BlockingSubject, p as CHECKPOINT_TRUNCATE_LENGTH, u as CommandBlock, w as CommandStatus, y as CompactionBlock, H as ConversationInput, L as ConversationView, P as DiffRow, Q as DiffRowKind, R as DiffStat, S as DisplayBlock, T as EMPTY_CONVERSATION, U as EMPTY_HOLD, V as EMPTY_RUN, W as EMPTY_TASK_LOG, X as EMPTY_TASK_LOG_FOLLOW, a0 as GatedConversation, af as LocalEntry, ag as MarkdownToken, aj as MessageBlock, ak as MessageRole, am as NOT_STARTED, an as NO_TURN, ao as NewTaskFields, au as OutputPreview, ay as PlanBlock, az as PlanMarkerStatus, aU as PromptHold, aW as RefTask, b8 as RunnerLoadedBlock, bb as SUPERVISOR_LEVEL_LABEL, bt as SkillLoadBlock, bu as SkillToken, bz as SubagentBlock, bA as SubagentChild, bB as SubagentStatus, bL as TakenPrompt, bP as TaskLogBatch, bR as TaskLogFollow, bS as TaskLogFollowInput, bU as TaskLogView, b$ as TaskPlacement, c3 as TaskRef, c4 as TaskRowAction, c5 as TaskRowContext, c6 as TaskRowIsolation, c7 as TaskRowKind, c8 as TaskRowPlacement, c9 as TaskRowSubject, ca as TaskRowUsage, cb as TaskRowView, cd as TaskStatusKind, ce as ThinkingDisplayBlock, cf as ToolBlock, cg as ToolHeadline, ch as ToolStatus, ci as TreeTask, cj as TurnGate, ck as UsageBlock, cm as WAITS_FOR_APPROVAL_LABEL, ct as aheadOfDraft, cv as approvalLabel, cw as assignmentIssue, cx as assignmentIssueText, cA as awaitingLabel, cB as blockedByLabel, cC as blockingFailures, cD as canMergeTasks, cE as canSetDependencies, cF as canSplitTask, cG as capConflictFiles, cK as dependencyCandidates, cL as dependentsNotice, cM as dependentsOf, cO as diffRows, cP as diffStat, cQ as diffSummary, cS as drainNext, cU as followTaskLog, cV as followTurn, cW as fromTranscript, cY as hasHiddenDetail, cZ as holdPrompt, c_ as isTaskRunning, c$ as loadedSkillTokens, d0 as markAction, d1 as markRequestFor, d2 as markdownHtml, d3 as markdownTokens, d4 as namedRepos, d5 as newTaskFields, d6 as opsEditable, d7 as outputLines, d8 as outputPreview, d9 as parseCount, dd as pastGateConfirmation, di as reconcileApprovals, dj as reduceConversation, dl as reduceTaskLog, dn as replayTaskLog, dq as resolveTaskRef, dr as resolveUserTaskRef, ds as resumeLabel, dt as resumeTime, dv as runnerToolSubject, dz as skillTokens, dA as skippedLabel, dB as stopTurn, dC as subtreeIds, dD as summarizeToolCall, dH as takeAt, dJ as taskOrderLabel, dK as taskPlacement, dM as taskRef, dN as taskRefOf, dO as taskRowActions, dP as taskRowView, dQ as taskStartedNotice, dR as taskStatusKind, dU as titledRefs, dV as titledTaskRef, dW as titledTaskRefOf, dY as toolHeadline, d_ as truncateCheckpointSummary, d$ as unsendAll, e0 as unsendLatest, e1 as walkPlan } from './runSettingsText-Jb_efnI4.mjs';
2
+ export { a as AttemptUsage, C as ContextFill, d as CostProvenance, D as DEFAULT_RUNNERS, M as ModelUsage, R as PlanUsage, T as PlannerUsage, a0 as ReportedWindow, a8 as RunnerSessionCost, a9 as SessionBilling, aw as TaskUsageSummary, ay as UsageLine, az as UsageRecord, aA as UsageTotals, aD as addAttemptUsage, aE as addModelUsage, aF as addPlannerUsage, aG as addUsage, aH as addUsageTotals, aI as contextMeterText, aJ as contextMeterTitle, aK as costText, aL as countedSessionCost, aP as endAttemptUsage, aS as formatCost, aT as formatTokenCount, aV as isMeasured, aZ as modelCostTitle, a_ as partedPromptUsage, a$ as pausedOnLimit, b0 as planUsage, b1 as plannerContextFill, b3 as resumedSessionWindow, b4 as startAttemptUsage, b5 as subagentCostTitle, b6 as taskUsageSummary, b7 as tasksTotalText, b8 as usageLine, b9 as usageText } from './Task-CfBM0wkV.mjs';
3
+ import './IFileSystem-1PqRCjhu.mjs';
4
4
  import 'child_process';
5
5
  import 'zod/v4';
6
- import './ModeResolver-C1PN5FYG.mjs';
6
+ import './ModeResolver-6TQXVsde.mjs';
7
7
 
8
8
  /**
9
9
  * The one rule for an effort and a model: the effort a task keeps on a model,
@@ -1,9 +1,9 @@
1
- export { e as ApprovalBlock, g as ApprovalStatus, l as AssignmentIssue, m as AssignmentScope, B as BlockingSubject, p as CHECKPOINT_TRUNCATE_LENGTH, u as CommandBlock, w as CommandStatus, y as CompactionBlock, H as ConversationInput, L as ConversationView, P as DiffRow, Q as DiffRowKind, R as DiffStat, S as DisplayBlock, T as EMPTY_CONVERSATION, U as EMPTY_HOLD, V as EMPTY_RUN, W as EMPTY_TASK_LOG, X as EMPTY_TASK_LOG_FOLLOW, a0 as GatedConversation, af as LocalEntry, ag as MarkdownToken, aj as MessageBlock, ak as MessageRole, am as NOT_STARTED, an as NO_TURN, ao as NewTaskFields, au as OutputPreview, ay as PlanBlock, az as PlanMarkerStatus, aU as PromptHold, aW as RefTask, b8 as RunnerLoadedBlock, bb as SUPERVISOR_LEVEL_LABEL, bt as SkillLoadBlock, bu as SkillToken, bz as SubagentBlock, bA as SubagentChild, bB as SubagentStatus, bL as TakenPrompt, bP as TaskLogBatch, bR as TaskLogFollow, bS as TaskLogFollowInput, bU as TaskLogView, b$ as TaskPlacement, c3 as TaskRef, c4 as TaskRowAction, c5 as TaskRowContext, c6 as TaskRowIsolation, c7 as TaskRowKind, c8 as TaskRowPlacement, c9 as TaskRowSubject, ca as TaskRowUsage, cb as TaskRowView, cd as TaskStatusKind, ce as ThinkingDisplayBlock, cf as ToolBlock, cg as ToolHeadline, ch as ToolStatus, ci as TreeTask, cj as TurnGate, ck as UsageBlock, cm as WAITS_FOR_APPROVAL_LABEL, ct as aheadOfDraft, cv as approvalLabel, cw as assignmentIssue, cx as assignmentIssueText, cA as awaitingLabel, cB as blockedByLabel, cC as blockingFailures, cD as canMergeTasks, cE as canSetDependencies, cF as canSplitTask, cG as capConflictFiles, cK as dependencyCandidates, cL as dependentsNotice, cM as dependentsOf, cO as diffRows, cP as diffStat, cQ as diffSummary, cS as drainNext, cU as followTaskLog, cV as followTurn, cW as fromTranscript, cY as hasHiddenDetail, cZ as holdPrompt, c_ as isTaskRunning, c$ as loadedSkillTokens, d0 as markAction, d1 as markRequestFor, d2 as markdownHtml, d3 as markdownTokens, d4 as namedRepos, d5 as newTaskFields, d6 as opsEditable, d7 as outputLines, d8 as outputPreview, d9 as parseCount, dd as pastGateConfirmation, di as reconcileApprovals, dj as reduceConversation, dl as reduceTaskLog, dn as replayTaskLog, dq as resolveTaskRef, dr as resolveUserTaskRef, ds as resumeLabel, dt as resumeTime, dv as runnerToolSubject, dz as skillTokens, dA as skippedLabel, dB as stopTurn, dC as subtreeIds, dD as summarizeToolCall, dH as takeAt, dJ as taskOrderLabel, dK as taskPlacement, dM as taskRef, dN as taskRefOf, dO as taskRowActions, dP as taskRowView, dQ as taskStartedNotice, dR as taskStatusKind, dU as titledRefs, dV as titledTaskRef, dW as titledTaskRefOf, dY as toolHeadline, d_ as truncateCheckpointSummary, d$ as unsendAll, e0 as unsendLatest, e1 as walkPlan } from './runSettingsText-CGKX3aeV.js';
2
- export { a as AttemptUsage, D as DEFAULT_RUNNERS, M as ModelUsage, O as PlanUsage, R as PlannerUsage, a5 as RunnerSessionCost, as as TaskUsageSummary, au as UsageLine, av as UsageRecord, aw as UsageTotals, az as addAttemptUsage, aA as addModelUsage, aB as addPlannerUsage, aC as addUsage, aD as addUsageTotals, aE as countedSessionCost, aI as endAttemptUsage, aM as isMeasured, aQ as partedPromptUsage, aR as pausedOnLimit, aS as planUsage, aT as plannerContextFill, aV as resumedSessionWindow, aW as startAttemptUsage, aX as taskUsageSummary, aY as usageLine } from './Task-hFfRS9rN.js';
3
- import './IFileSystem-B8qRNC_6.js';
1
+ export { e as ApprovalBlock, g as ApprovalStatus, l as AssignmentIssue, m as AssignmentScope, B as BlockingSubject, p as CHECKPOINT_TRUNCATE_LENGTH, u as CommandBlock, w as CommandStatus, y as CompactionBlock, H as ConversationInput, L as ConversationView, P as DiffRow, Q as DiffRowKind, R as DiffStat, S as DisplayBlock, T as EMPTY_CONVERSATION, U as EMPTY_HOLD, V as EMPTY_RUN, W as EMPTY_TASK_LOG, X as EMPTY_TASK_LOG_FOLLOW, a0 as GatedConversation, af as LocalEntry, ag as MarkdownToken, aj as MessageBlock, ak as MessageRole, am as NOT_STARTED, an as NO_TURN, ao as NewTaskFields, au as OutputPreview, ay as PlanBlock, az as PlanMarkerStatus, aU as PromptHold, aW as RefTask, b8 as RunnerLoadedBlock, bb as SUPERVISOR_LEVEL_LABEL, bt as SkillLoadBlock, bu as SkillToken, bz as SubagentBlock, bA as SubagentChild, bB as SubagentStatus, bL as TakenPrompt, bP as TaskLogBatch, bR as TaskLogFollow, bS as TaskLogFollowInput, bU as TaskLogView, b$ as TaskPlacement, c3 as TaskRef, c4 as TaskRowAction, c5 as TaskRowContext, c6 as TaskRowIsolation, c7 as TaskRowKind, c8 as TaskRowPlacement, c9 as TaskRowSubject, ca as TaskRowUsage, cb as TaskRowView, cd as TaskStatusKind, ce as ThinkingDisplayBlock, cf as ToolBlock, cg as ToolHeadline, ch as ToolStatus, ci as TreeTask, cj as TurnGate, ck as UsageBlock, cm as WAITS_FOR_APPROVAL_LABEL, ct as aheadOfDraft, cv as approvalLabel, cw as assignmentIssue, cx as assignmentIssueText, cA as awaitingLabel, cB as blockedByLabel, cC as blockingFailures, cD as canMergeTasks, cE as canSetDependencies, cF as canSplitTask, cG as capConflictFiles, cK as dependencyCandidates, cL as dependentsNotice, cM as dependentsOf, cO as diffRows, cP as diffStat, cQ as diffSummary, cS as drainNext, cU as followTaskLog, cV as followTurn, cW as fromTranscript, cY as hasHiddenDetail, cZ as holdPrompt, c_ as isTaskRunning, c$ as loadedSkillTokens, d0 as markAction, d1 as markRequestFor, d2 as markdownHtml, d3 as markdownTokens, d4 as namedRepos, d5 as newTaskFields, d6 as opsEditable, d7 as outputLines, d8 as outputPreview, d9 as parseCount, dd as pastGateConfirmation, di as reconcileApprovals, dj as reduceConversation, dl as reduceTaskLog, dn as replayTaskLog, dq as resolveTaskRef, dr as resolveUserTaskRef, ds as resumeLabel, dt as resumeTime, dv as runnerToolSubject, dz as skillTokens, dA as skippedLabel, dB as stopTurn, dC as subtreeIds, dD as summarizeToolCall, dH as takeAt, dJ as taskOrderLabel, dK as taskPlacement, dM as taskRef, dN as taskRefOf, dO as taskRowActions, dP as taskRowView, dQ as taskStartedNotice, dR as taskStatusKind, dU as titledRefs, dV as titledTaskRef, dW as titledTaskRefOf, dY as toolHeadline, d_ as truncateCheckpointSummary, d$ as unsendAll, e0 as unsendLatest, e1 as walkPlan } from './runSettingsText-C5uv2axI.js';
2
+ export { a as AttemptUsage, C as ContextFill, d as CostProvenance, D as DEFAULT_RUNNERS, M as ModelUsage, R as PlanUsage, T as PlannerUsage, a0 as ReportedWindow, a8 as RunnerSessionCost, a9 as SessionBilling, aw as TaskUsageSummary, ay as UsageLine, az as UsageRecord, aA as UsageTotals, aD as addAttemptUsage, aE as addModelUsage, aF as addPlannerUsage, aG as addUsage, aH as addUsageTotals, aI as contextMeterText, aJ as contextMeterTitle, aK as costText, aL as countedSessionCost, aP as endAttemptUsage, aS as formatCost, aT as formatTokenCount, aV as isMeasured, aZ as modelCostTitle, a_ as partedPromptUsage, a$ as pausedOnLimit, b0 as planUsage, b1 as plannerContextFill, b3 as resumedSessionWindow, b4 as startAttemptUsage, b5 as subagentCostTitle, b6 as taskUsageSummary, b7 as tasksTotalText, b8 as usageLine, b9 as usageText } from './Task-CfBM0wkV.js';
3
+ import './IFileSystem-lTRL_G9Z.js';
4
4
  import 'child_process';
5
5
  import 'zod/v4';
6
- import './ModeResolver-CaPnoU8N.js';
6
+ import './ModeResolver-CoJAJD-f.js';
7
7
 
8
8
  /**
9
9
  * The one rule for an effort and a model: the effort a task keeps on a model,
@@ -58,6 +58,9 @@ __export(plan_utils_exports, {
58
58
  canSplitTask: () => canSplitTask,
59
59
  capConflictFiles: () => capConflictFiles,
60
60
  clampThinkingEffort: () => clampThinkingEffort,
61
+ contextMeterText: () => contextMeterText,
62
+ contextMeterTitle: () => contextMeterTitle,
63
+ costText: () => costText,
61
64
  countedSessionCost: () => countedSessionCost,
62
65
  dependencyCandidates: () => dependencyCandidates,
63
66
  dependentsNotice: () => dependentsNotice,
@@ -69,6 +72,8 @@ __export(plan_utils_exports, {
69
72
  endAttemptUsage: () => endAttemptUsage,
70
73
  followTaskLog: () => followTaskLog,
71
74
  followTurn: () => followTurn,
75
+ formatCost: () => formatCost,
76
+ formatTokenCount: () => formatTokenCount,
72
77
  fromTranscript: () => fromTranscript,
73
78
  hasHiddenDetail: () => hasHiddenDetail,
74
79
  holdPrompt: () => holdPrompt,
@@ -79,6 +84,7 @@ __export(plan_utils_exports, {
79
84
  markRequestFor: () => markRequestFor,
80
85
  markdownHtml: () => markdownHtml,
81
86
  markdownTokens: () => markdownTokens,
87
+ modelCostTitle: () => modelCostTitle,
82
88
  namedRepos: () => namedRepos,
83
89
  newTaskFields: () => newTaskFields,
84
90
  opsEditable: () => opsEditable,
@@ -104,6 +110,7 @@ __export(plan_utils_exports, {
104
110
  skippedLabel: () => skippedLabel,
105
111
  startAttemptUsage: () => startAttemptUsage,
106
112
  stopTurn: () => stopTurn,
113
+ subagentCostTitle: () => subagentCostTitle,
107
114
  subtreeIds: () => subtreeIds,
108
115
  summarizeToolCall: () => summarizeToolCall,
109
116
  takeAt: () => takeAt,
@@ -116,6 +123,7 @@ __export(plan_utils_exports, {
116
123
  taskStartedNotice: () => taskStartedNotice,
117
124
  taskStatusKind: () => taskStatusKind,
118
125
  taskUsageSummary: () => taskUsageSummary,
126
+ tasksTotalText: () => tasksTotalText,
119
127
  titledRefs: () => titledRefs,
120
128
  titledTaskRef: () => titledTaskRef,
121
129
  titledTaskRefOf: () => titledTaskRefOf,
@@ -124,6 +132,7 @@ __export(plan_utils_exports, {
124
132
  unsendAll: () => unsendAll,
125
133
  unsendLatest: () => unsendLatest,
126
134
  usageLine: () => usageLine,
135
+ usageText: () => usageText,
127
136
  walkPlan: () => walkPlan
128
137
  });
129
138
  module.exports = __toCommonJS(plan_utils_exports);
@@ -801,25 +810,66 @@ function addUsage(totals, record) {
801
810
  }
802
811
  if (record.reportedCost) {
803
812
  const { amount, currency } = record.reportedCost;
804
- next.reportedCost = { ...totals.reportedCost, [currency]: (totals.reportedCost?.[currency] ?? 0) + amount };
813
+ const provenance = record.reportedCost.kind || record.sessionBilling ? {
814
+ kind: record.reportedCost.kind ?? "unknown",
815
+ billing: record.sessionBilling?.type ?? "unknown",
816
+ ...record.reportedCost.basis ? { basis: record.reportedCost.basis } : {}
817
+ } : void 0;
818
+ addCost(next, currency, amount, provenance);
805
819
  }
806
820
  return next;
807
821
  }
822
+ function addCost(totals, currency, amount, provenance) {
823
+ const hadCost = totals.reportedCost?.[currency] !== void 0;
824
+ const previous = totals.costProvenance?.[currency];
825
+ totals.reportedCost = { ...totals.reportedCost, [currency]: (totals.reportedCost?.[currency] ?? 0) + amount };
826
+ if (!previous && !provenance) return;
827
+ const unknown = { kind: "unknown", billing: "unknown" };
828
+ const a = previous ?? unknown;
829
+ const b = provenance ?? unknown;
830
+ const merged = !hadCost ? b : {
831
+ kind: a.kind === "estimate" || b.kind === "estimate" ? "estimate" : a.kind === "billed" && b.kind === "billed" ? "billed" : "unknown",
832
+ billing: a.billing === b.billing ? a.billing : "mixed",
833
+ ...a.basis && a.basis === b.basis ? { basis: a.basis } : {}
834
+ };
835
+ totals.costProvenance = { ...totals.costProvenance, [currency]: merged };
836
+ }
808
837
  function addPlannerUsage(usage, record) {
809
- const next = { ...usage, totals: addUsage(usage.totals, record), byModel: addModelUsage(usage.byModel ?? [], record) };
838
+ if (record.compacted) {
839
+ if (record.subagentId || record.aggregate) return usage;
840
+ const next2 = { ...usage };
841
+ if (record.source !== void 0) next2.source = record.source;
842
+ if (record.model !== void 0) {
843
+ if (record.source !== usage.source || record.model !== usage.model) delete next2.contextWindow;
844
+ next2.model = record.model;
845
+ }
846
+ if (record.contextTokens !== void 0) next2.lastPromptTokens = record.contextTokens;
847
+ else delete next2.lastPromptTokens;
848
+ if (record.contextWindow !== void 0) next2.contextWindow = record.contextWindow > 0 ? record.contextWindow : void 0;
849
+ return next2;
850
+ }
851
+ if (record.sessionBilling && !record.reportedCost && record.inputTokens === void 0 && record.outputTokens === void 0 && record.cachedInputTokens === void 0 && record.contextWindow === void 0) {
852
+ return record.subagentId ? usage : { ...usage, sessionBilling: record.sessionBilling, source: record.source };
853
+ }
854
+ record = { ...record, sessionBilling: record.sessionBilling ?? (usage.source === void 0 || record.source === usage.source ? usage.sessionBilling : void 0) };
855
+ const next = { ...usage, ...!record.subagentId && record.sessionBilling ? { sessionBilling: record.sessionBilling } : {}, totals: addUsage(usage.totals, record), byModel: addModelUsage(usage.byModel ?? [], record) };
810
856
  if (record.subagentId) {
811
857
  next.bySubagent = { ...usage.bySubagent, [record.subagentId]: addUsage(usage.bySubagent?.[record.subagentId] ?? {}, record) };
812
858
  return next;
813
859
  }
814
- if (!record.aggregate) {
815
- if (record.source !== usage.source || record.model !== usage.model) {
816
- delete next.lastPromptTokens;
817
- delete next.contextWindow;
818
- }
819
- next.source = record.source;
820
- next.model = record.model;
860
+ if (record.aggregate) {
861
+ if (record.source !== usage.source && !record.sessionBilling) delete next.sessionBilling;
862
+ return next;
863
+ }
864
+ if (record.source !== usage.source || record.model !== usage.model) {
865
+ delete next.lastPromptTokens;
866
+ delete next.contextWindow;
821
867
  }
822
- if (record.inputTokens !== void 0) next.lastPromptTokens = record.inputTokens;
868
+ if (record.source !== usage.source && !record.sessionBilling) delete next.sessionBilling;
869
+ next.source = record.source;
870
+ next.model = record.model;
871
+ const used = record.contextTokens ?? record.inputTokens;
872
+ if (used !== void 0) next.lastPromptTokens = used;
823
873
  if (record.contextWindow !== void 0) next.contextWindow = record.contextWindow > 0 ? record.contextWindow : void 0;
824
874
  return next;
825
875
  }
@@ -830,6 +880,7 @@ function usageLine(usage) {
830
880
  const contextFill = plannerContextFill(usage);
831
881
  return {
832
882
  totals: usage.totals,
883
+ ...usage.sessionBilling ? { sessionBilling: usage.sessionBilling } : {},
833
884
  ...usage.byModel ? { byModel: usage.byModel } : {},
834
885
  ...usage.model ? { model: usage.model } : {},
835
886
  ...usage.bySubagent ? { bySubagent: usage.bySubagent } : {},
@@ -837,8 +888,8 @@ function usageLine(usage) {
837
888
  };
838
889
  }
839
890
  function plannerContextFill(usage) {
840
- if (usage.lastPromptTokens === void 0 || usage.contextWindow === void 0 || usage.contextWindow <= 0) return void 0;
841
- return { usedTokens: usage.lastPromptTokens, windowTokens: usage.contextWindow };
891
+ if (usage.lastPromptTokens === void 0) return void 0;
892
+ return { usedTokens: usage.lastPromptTokens, ...usage.contextWindow !== void 0 && usage.contextWindow > 0 ? { windowTokens: usage.contextWindow } : {} };
842
893
  }
843
894
  function addModelUsage(models, record) {
844
895
  const index = models.findIndex((m) => m.source === record.source && m.model === record.model);
@@ -850,13 +901,14 @@ function startAttemptUsage(attempt, runner, startedAt) {
850
901
  }
851
902
  function addAttemptUsage(usage, record, now) {
852
903
  const folded = addPlannerUsage(usage, record);
853
- return { ...usage, ...folded, lastPromptTokens: folded.lastPromptTokens, contextWindow: folded.contextWindow, wallTimeMs: Math.max(0, Date.parse(now) - Date.parse(usage.startedAt)) };
904
+ return { ...usage, ...folded, lastPromptTokens: folded.lastPromptTokens, contextWindow: folded.contextWindow, wallTimeMs: Math.max(0, Date.parse(usage.endedAt ?? now) - Date.parse(usage.startedAt)) };
854
905
  }
855
906
  function endAttemptUsage(usage, now, runnerSessionCost, sessionId) {
907
+ const endedAt = usage.endedAt ?? now;
856
908
  return {
857
909
  ...usage,
858
- endedAt: now,
859
- wallTimeMs: Math.max(0, Date.parse(now) - Date.parse(usage.startedAt)),
910
+ endedAt,
911
+ wallTimeMs: Math.max(0, Date.parse(endedAt) - Date.parse(usage.startedAt)),
860
912
  ...sessionId ? { sessionId } : {},
861
913
  ...runnerSessionCost ? { runnerSessionCost } : {}
862
914
  };
@@ -869,8 +921,8 @@ function resumedSessionWindow(attempts, runner, attempt, sessionId) {
869
921
  return last ? { source: last.source, model: last.model, contextWindow: last.contextWindow } : void 0;
870
922
  }
871
923
  function addUsageTotals(totals, addition) {
872
- let next = addUsage(totals, { source: "", inputTokens: addition.inputTokens, outputTokens: addition.outputTokens, cachedInputTokens: addition.cachedInputTokens });
873
- for (const [currency, amount] of Object.entries(addition.reportedCost ?? {})) next = addUsage(next, { source: "", reportedCost: { currency, amount } });
924
+ const next = addUsage(totals, { source: "", inputTokens: addition.inputTokens, outputTokens: addition.outputTokens, cachedInputTokens: addition.cachedInputTokens });
925
+ for (const [currency, amount] of Object.entries(addition.reportedCost ?? {})) addCost(next, currency, amount, addition.costProvenance?.[currency]);
874
926
  return next;
875
927
  }
876
928
  function planUsage(tasks) {
@@ -905,6 +957,71 @@ function taskUsageSummary(task) {
905
957
  ...contextFill ? { contextFill } : {}
906
958
  };
907
959
  }
960
+ function formatTokenCount(n) {
961
+ if (n < 1e3) return String(n);
962
+ if (n < 1e4) return `${(n / 1e3).toFixed(1).replace(/\.0$/, "")}k`;
963
+ if (n < 999500) return `${Math.round(n / 1e3)}k`;
964
+ return `${(n / 1e6).toFixed(1).replace(/\.0$/, "")}M`;
965
+ }
966
+ function formatCost(currency, amount) {
967
+ const value = amount >= 1 ? amount.toFixed(2) : (([whole, frac = ""]) => `${whole}.${frac.padEnd(2, "0")}`)(amount.toFixed(4).replace(/0+$/, "").split("."));
968
+ return currency.toLowerCase() === "usd" ? `$${value}` : `${value} ${currency.toUpperCase()}`;
969
+ }
970
+ function contextMeterText(fill) {
971
+ if (!fill) return null;
972
+ const used = `ctx ${formatTokenCount(fill.usedTokens)}`;
973
+ if (!fill.windowTokens) return used;
974
+ const share = fill.usedTokens / fill.windowTokens * 100;
975
+ return `${used} (${share < 1 ? "<1" : Math.round(share)}%)`;
976
+ }
977
+ function contextMeterTitle(fill) {
978
+ const used = fill.usedTokens.toLocaleString("en-US");
979
+ return fill.windowTokens ? `${used} of ${fill.windowTokens.toLocaleString("en-US")} tokens` : `${used} tokens`;
980
+ }
981
+ function costParts(totals) {
982
+ const rank = (currency) => currency.toLowerCase() === "usd" ? "" : currency.toUpperCase();
983
+ return Object.entries(totals.reportedCost ?? {}).sort(([a], [b]) => rank(a).localeCompare(rank(b))).map(([currency, amount]) => {
984
+ const provenance = totals.costProvenance?.[currency];
985
+ const equivalent = provenance?.billing === "subscription";
986
+ return `${provenance?.kind === "estimate" || equivalent ? "\u2248" : ""}${formatCost(currency, amount)}${equivalent ? " API-equivalent" : ""}`;
987
+ });
988
+ }
989
+ function costText(totals) {
990
+ const parts = costParts(totals);
991
+ return parts.length > 0 ? parts.join(" \xB7 ") : null;
992
+ }
993
+ function usageText(usage) {
994
+ const parts = [contextMeterText(usage.contextFill), costText(usage.totals)].filter((p) => p !== null);
995
+ return parts.length > 0 ? parts.join(" \xB7 ") : null;
996
+ }
997
+ function modelCostTitle(byModel) {
998
+ const lines2 = byModel.flatMap((m) => {
999
+ const cost = costParts(m.totals);
1000
+ const descriptions = [...new Set(Object.values(m.totals.costProvenance ?? {}).map((p) => {
1001
+ const source = m.source === "claude-code" ? "Claude Code" : m.source === "opencode" ? "OpenCode" : m.source === "openrouter" ? "OpenRouter" : m.source;
1002
+ const basis = p.basis === "list" ? " at list price" : p.basis === "managed" ? " at managed price" : "";
1003
+ const kind = p.kind === "estimate" ? `${source}'s estimate${basis}` : p.kind === "billed" ? `Amount billed by ${source}` : "Reported cost";
1004
+ return `${kind}${p.billing === "subscription" ? "; not billed on a subscription" : ""}`;
1005
+ }))];
1006
+ return cost.length > 0 ? [`${m.source} / ${m.model ?? "unattributed"}: ${cost.join(" \xB7 ")}${descriptions.length ? ` \u2014 ${descriptions.join("; ")}` : ""}`] : [];
1007
+ });
1008
+ return lines2.length > 0 ? lines2.join("\n") : void 0;
1009
+ }
1010
+ function subagentCostTitle(bySubagent) {
1011
+ return Object.entries(bySubagent).map(([id, totals]) => `${id}: ${costParts(totals).join(" \xB7 ") || "reported no cost"}`).join("\n");
1012
+ }
1013
+ function runnersOf(tasks) {
1014
+ return tasks.flatMap((task) => [...task.attemptUsage ?? [], ...runnersOf(task.subtasks ?? [])]);
1015
+ }
1016
+ function tasksTotalText(tasks) {
1017
+ const attempts = runnersOf(tasks);
1018
+ if (attempts.length === 0) return null;
1019
+ const costed = (a) => Object.keys(a.totals.reportedCost ?? {}).length > 0;
1020
+ const costless = [...new Set(attempts.filter((a) => a.endedAt !== void 0 && isMeasured(a.totals)).map((a) => a.runner))].filter((runner) => !attempts.some((a) => a.runner === runner && costed(a)));
1021
+ const note = costless.length === 0 ? [] : [`${costless.length === 1 ? costless[0] : `${costless.slice(0, -1).join(", ")} and ${costless.at(-1)}`} ${costless.length === 1 ? "reports" : "report"} no cost`];
1022
+ const parts = [...costParts(planUsage(tasks).totals), ...note];
1023
+ return parts.length > 0 ? `Tasks total: ${parts.join(" \xB7 ")}` : null;
1024
+ }
908
1025
 
909
1026
  // src/conversation/lanes.ts
910
1027
  function findLastIndex(items, match) {
@@ -1047,7 +1164,7 @@ function openTurn(view, { turnId, prompt = "", skills = [], wakeUps = [], forced
1047
1164
  wakeUps = wakeUps.slice(adopted.wakeUps);
1048
1165
  if (wakeUps.length === 0) return adopted.prompt || prompt === "" && adopted.wakeUps > 0 ? view : promptLine(view, turnId, prompt, skills, forced);
1049
1166
  const said = prompt === "" || adopted.prompt ? view : promptLine(view, turnId, prompt, skills, forced);
1050
- const at = prompt === "" ? said.blocks.length : findLastIndex(said.blocks, (b) => b.type === "message" && b.role === "user" && b.turnId === turnId);
1167
+ const at = prompt === "" ? said.blocks.length - (said.blocks.at(-1)?.type === "usage" ? 1 : 0) : findLastIndex(said.blocks, (b) => b.type === "message" && b.role === "user" && b.turnId === turnId);
1051
1168
  const updates = wakeUps.map((text2, n) => settledMessage(`b${said.nextId + n}`, "wake_up", text2, turnId));
1052
1169
  return { ...said, blocks: [...said.blocks.slice(0, at), ...updates, ...said.blocks.slice(at)], nextId: said.nextId + updates.length };
1053
1170
  }
@@ -2080,6 +2197,9 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2080
2197
  canSplitTask,
2081
2198
  capConflictFiles,
2082
2199
  clampThinkingEffort,
2200
+ contextMeterText,
2201
+ contextMeterTitle,
2202
+ costText,
2083
2203
  countedSessionCost,
2084
2204
  dependencyCandidates,
2085
2205
  dependentsNotice,
@@ -2091,6 +2211,8 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2091
2211
  endAttemptUsage,
2092
2212
  followTaskLog,
2093
2213
  followTurn,
2214
+ formatCost,
2215
+ formatTokenCount,
2094
2216
  fromTranscript,
2095
2217
  hasHiddenDetail,
2096
2218
  holdPrompt,
@@ -2101,6 +2223,7 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2101
2223
  markRequestFor,
2102
2224
  markdownHtml,
2103
2225
  markdownTokens,
2226
+ modelCostTitle,
2104
2227
  namedRepos,
2105
2228
  newTaskFields,
2106
2229
  opsEditable,
@@ -2126,6 +2249,7 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2126
2249
  skippedLabel,
2127
2250
  startAttemptUsage,
2128
2251
  stopTurn,
2252
+ subagentCostTitle,
2129
2253
  subtreeIds,
2130
2254
  summarizeToolCall,
2131
2255
  takeAt,
@@ -2138,6 +2262,7 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2138
2262
  taskStartedNotice,
2139
2263
  taskStatusKind,
2140
2264
  taskUsageSummary,
2265
+ tasksTotalText,
2141
2266
  titledRefs,
2142
2267
  titledTaskRef,
2143
2268
  titledTaskRefOf,
@@ -2146,6 +2271,7 @@ var EMPTY_RUN = { tasks: [], runMerge: null, handoff: null, mergeResult: null };
2146
2271
  unsendAll,
2147
2272
  unsendLatest,
2148
2273
  usageLine,
2274
+ usageText,
2149
2275
  walkPlan
2150
2276
  });
2151
2277
  //# sourceMappingURL=plan-utils.js.map