strands-darwin 0.0.32 → 0.0.34

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 (117) hide show
  1. package/README.md +3 -1
  2. package/README.zh-CN.md +3 -1
  3. package/dist/src/agent/background-delegation.d.ts +69 -11
  4. package/dist/src/agent/background-delegation.js +156 -28
  5. package/dist/src/agent/background-delegation.js.map +1 -1
  6. package/dist/src/agent/cache-miss.d.ts +143 -0
  7. package/dist/src/agent/cache-miss.js +182 -0
  8. package/dist/src/agent/cache-miss.js.map +1 -0
  9. package/dist/src/agent/compact.d.ts +28 -0
  10. package/dist/src/agent/compact.js +34 -0
  11. package/dist/src/agent/compact.js.map +1 -1
  12. package/dist/src/agent/context-breakdown.d.ts +109 -0
  13. package/dist/src/agent/context-breakdown.js +116 -0
  14. package/dist/src/agent/context-breakdown.js.map +1 -0
  15. package/dist/src/agent/instructions.d.ts +1 -1
  16. package/dist/src/agent/instructions.js.map +1 -1
  17. package/dist/src/agent/permission-rules.d.ts +81 -2
  18. package/dist/src/agent/permission-rules.js +226 -6
  19. package/dist/src/agent/permission-rules.js.map +1 -1
  20. package/dist/src/agent/permission.d.ts +116 -2
  21. package/dist/src/agent/permission.js +201 -26
  22. package/dist/src/agent/permission.js.map +1 -1
  23. package/dist/src/agent/prompt-cache.d.ts +12 -3
  24. package/dist/src/agent/prompt-cache.js +12 -3
  25. package/dist/src/agent/prompt-cache.js.map +1 -1
  26. package/dist/src/agent/runtime.d.ts +141 -1
  27. package/dist/src/agent/runtime.js +259 -13
  28. package/dist/src/agent/runtime.js.map +1 -1
  29. package/dist/src/agent/task-terminal-delivery.d.ts +43 -0
  30. package/dist/src/agent/task-terminal-delivery.js +115 -0
  31. package/dist/src/agent/task-terminal-delivery.js.map +1 -0
  32. package/dist/src/agents/child-recipe.d.ts +9 -1
  33. package/dist/src/agents/child-recipe.js +2 -0
  34. package/dist/src/agents/child-recipe.js.map +1 -1
  35. package/dist/src/agents/dispatch-registry.d.ts +18 -0
  36. package/dist/src/agents/dispatch-registry.js +2 -0
  37. package/dist/src/agents/dispatch-registry.js.map +1 -1
  38. package/dist/src/agents/retained-children.d.ts +101 -0
  39. package/dist/src/agents/retained-children.js +101 -0
  40. package/dist/src/agents/retained-children.js.map +1 -0
  41. package/dist/src/agents/subagent-tool.d.ts +56 -1
  42. package/dist/src/agents/subagent-tool.js +148 -10
  43. package/dist/src/agents/subagent-tool.js.map +1 -1
  44. package/dist/src/agents/workflow-tool.d.ts +2 -0
  45. package/dist/src/agents/workflow-tool.js +1 -1
  46. package/dist/src/agents/workflow-tool.js.map +1 -1
  47. package/dist/src/cli-doctor.js +3 -1
  48. package/dist/src/cli-doctor.js.map +1 -1
  49. package/dist/src/cli-main.js +14 -3
  50. package/dist/src/cli-main.js.map +1 -1
  51. package/dist/src/commands/custom-commands.js +5 -4
  52. package/dist/src/commands/custom-commands.js.map +1 -1
  53. package/dist/src/config.d.ts +57 -6
  54. package/dist/src/config.js +43 -16
  55. package/dist/src/config.js.map +1 -1
  56. package/dist/src/headless-protocol.d.ts +1 -1
  57. package/dist/src/headless-runner.js +7 -2
  58. package/dist/src/headless-runner.js.map +1 -1
  59. package/dist/src/hooks/tool-hooks.js +10 -6
  60. package/dist/src/hooks/tool-hooks.js.map +1 -1
  61. package/dist/src/skills/builtin/self-evolution-research/SKILL.md +14 -1
  62. package/dist/src/skills/prompt.d.ts +17 -0
  63. package/dist/src/skills/prompt.js +20 -0
  64. package/dist/src/skills/prompt.js.map +1 -1
  65. package/dist/src/tools/background-bash.d.ts +11 -2
  66. package/dist/src/tools/background-bash.js +11 -5
  67. package/dist/src/tools/background-bash.js.map +1 -1
  68. package/dist/src/tools/background-tail.d.ts +1 -0
  69. package/dist/src/tools/background-tail.js +2 -1
  70. package/dist/src/tools/background-tail.js.map +1 -1
  71. package/dist/src/tools/background-wait-contract.d.ts +7 -0
  72. package/dist/src/tools/background-wait-contract.js +17 -0
  73. package/dist/src/tools/background-wait-contract.js.map +1 -1
  74. package/dist/src/trajectory/record.d.ts +212 -2
  75. package/dist/src/trajectory/record.js +138 -0
  76. package/dist/src/trajectory/record.js.map +1 -1
  77. package/dist/src/trajectory/replay.d.ts +34 -1
  78. package/dist/src/trajectory/replay.js +148 -4
  79. package/dist/src/trajectory/replay.js.map +1 -1
  80. package/dist/src/trajectory/resume-recap.js +10 -3
  81. package/dist/src/trajectory/resume-recap.js.map +1 -1
  82. package/dist/src/trajectory/spend.d.ts +14 -1
  83. package/dist/src/trajectory/spend.js +40 -6
  84. package/dist/src/trajectory/spend.js.map +1 -1
  85. package/dist/src/trajectory/writer.d.ts +57 -6
  86. package/dist/src/trajectory/writer.js +141 -9
  87. package/dist/src/trajectory/writer.js.map +1 -1
  88. package/dist/src/tui/App.d.ts +8 -4
  89. package/dist/src/tui/App.js +302 -55
  90. package/dist/src/tui/App.js.map +1 -1
  91. package/dist/src/tui/background-tool-presentation.js +2 -2
  92. package/dist/src/tui/background-tool-presentation.js.map +1 -1
  93. package/dist/src/tui/context-format.d.ts +16 -0
  94. package/dist/src/tui/context-format.js +41 -0
  95. package/dist/src/tui/context-format.js.map +1 -1
  96. package/dist/src/tui/prompt-queue.d.ts +52 -8
  97. package/dist/src/tui/prompt-queue.js +68 -8
  98. package/dist/src/tui/prompt-queue.js.map +1 -1
  99. package/dist/src/tui/status-format.d.ts +35 -16
  100. package/dist/src/tui/status-format.js +67 -8
  101. package/dist/src/tui/status-format.js.map +1 -1
  102. package/dist/src/tui/subagent-format.d.ts +8 -0
  103. package/dist/src/tui/subagent-format.js +24 -1
  104. package/dist/src/tui/subagent-format.js.map +1 -1
  105. package/dist/src/tui/task-wake.d.ts +75 -0
  106. package/dist/src/tui/task-wake.js +201 -0
  107. package/dist/src/tui/task-wake.js.map +1 -0
  108. package/dist/src/tui/terminal-notify.d.ts +40 -0
  109. package/dist/src/tui/terminal-notify.js +136 -0
  110. package/dist/src/tui/terminal-notify.js.map +1 -0
  111. package/dist/src/tui/terminal-title.d.ts +94 -0
  112. package/dist/src/tui/terminal-title.js +121 -0
  113. package/dist/src/tui/terminal-title.js.map +1 -0
  114. package/dist/src/tui/turn-state.d.ts +10 -1
  115. package/dist/src/tui/turn-state.js +17 -1
  116. package/dist/src/tui/turn-state.js.map +1 -1
  117. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"context-format.js","sourceRoot":"","sources":["../../../src/tui/context-format.ts"],"names":[],"mappings":"AAcA,oEAAoE;AACpE,MAAM,UAAU,mBAAmB,CAAC,QAAyB;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,CAAC;IACtF,OAAO,GAAG,KAAK,MAAM,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAyB;IAC1D,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,QAAQ,CAAC,eAAe,CAAC,UAAU,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC1F,MAAM,MAAM,GACV,QAAQ,CAAC,YAAY,KAAK,SAAS;QACjC,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,GAAG,iBAAiB,CAAC,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;IAC9H,OAAO,GAAG,MAAM,MAAM,MAAM,MAAM,QAAQ,CAAC,YAAY,aAAa,CAAC;AACvE,CAAC;AAED;;;;GAIG;AACH,SAAS,WAAW,CAAC,QAAyB;IAC5C,IAAI,QAAQ,CAAC,cAAc,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrD,MAAM,IAAI,GACR,QAAQ,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC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IACE,SAAS,IAAI,CAAC;gBACd,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC;gBAC1C,QAAQ,CAAC,eAAe,GAAG,CAAC;gBAC5B,QAAQ,CAAC,YAAY,KAAK,SAAS;gBACnC,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;gBACvC,QAAQ,CAAC,YAAY,IAAI,CAAC,EAC1B,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,YAAY,CAAC;YAC/D,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;gBACvB,IAAI,cAAc;oBAAE,OAAO,IAAI,CAAC,CAAG,+BAA+B;gBAClE,cAAc,GAAG,IAAI,CAAC;gBACtB,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,CAAC;gBACpC,OAAO,CACL,8BAA8B,GAAG,oDAAoD;oBACrF,oDAAoD,CACrD,CAAC;YACJ,CAAC;YACD,cAAc,GAAG,KAAK,CAAC,CAAc,8BAA8B;YACnE,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED,yEAAyE;AACzE,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;AACvC,CAAC"}
@@ -19,13 +19,52 @@
19
19
  * The queue is live-session state only: `/clear` drops it with the conversation,
20
20
  * a cancelled or failed turn returns it to the editor unsent, and nothing about
21
21
  * an entry is recorded until the moment it is actually sent.
22
+ *
23
+ * Two entry kinds share the FIFO (SER-069): what the user typed, and a
24
+ * background-task wake — the session-originated prompt a finished `bash start`
25
+ * job leaves behind so the model learns of the completion without polling. Both
26
+ * drain the same way; only the wake is not the user's to edit (take-back and
27
+ * cancel-return leave it queued) and is recorded as `taskNotification`, never as
28
+ * a `userInput` line, so prompt recall never offers it.
22
29
  */
23
30
  import type { ImageBlock } from '@strands-agents/sdk';
24
- /** One live-only queued submission; image bytes never enter any durable record. */
25
- export interface QueuedPrompt {
31
+ import type { BackgroundDelegationStatus } from '../agent/background-delegation.js';
32
+ import type { TaskNotificationFields } from '../trajectory/record.js';
33
+ /** One live-only queued user submission; image bytes never enter any durable record. */
34
+ export interface QueuedUserPrompt {
35
+ /** Absent or `'user'`: what the user typed. */
36
+ readonly kind?: 'user';
26
37
  readonly text: string;
27
38
  readonly image?: ImageBlock;
28
39
  }
40
+ /**
41
+ * A background-task wake (SER-069): the session-originated prompt a finished
42
+ * `bash start` job leaves in the queue. Drained through the same `submit()` as a
43
+ * user entry, but it has nothing to edit — take-back and cancel-return leave it in
44
+ * the queue — and it is recorded as `taskNotification`, never `userInput`.
45
+ */
46
+ export interface QueuedTaskWake extends TaskNotificationFields {
47
+ readonly kind: 'taskNotification';
48
+ /** The model-facing `<task-notification>` block, already bounded. */
49
+ readonly text: string;
50
+ readonly image?: undefined;
51
+ }
52
+ export type QueuedPrompt = QueuedUserPrompt | QueuedTaskWake;
53
+ export declare function isTaskWake(entry: QueuedPrompt): entry is QueuedTaskWake;
54
+ /**
55
+ * The delegation wakes (SER-070) an idle session owes right now: one entry per
56
+ * background delegation the SDK still tracks whose run has settled and which has
57
+ * not been queued before. Pure — the App calls it at settlement (when idle) and
58
+ * whenever the session returns to idle, adds the returned ids to `alreadySent`, and
59
+ * appends the entries to the queue. A running delegation is never a wake; a settled
60
+ * one the SDK already delivered is no longer tracked and so never appears.
61
+ */
62
+ export declare function delegationWakeEntries(tracked: readonly BackgroundDelegationStatus[], alreadySent: ReadonlySet<string>, nowMs?: number): QueuedTaskWake[];
63
+ /** The queue split by ownership: what the user may take back, and what only drains. */
64
+ export declare function partitionQueue(entries: readonly QueuedPrompt[]): {
65
+ readonly user: QueuedUserPrompt[];
66
+ readonly wakes: QueuedTaskWake[];
67
+ };
29
68
  /** One clipboard image may be pending or queued at a time, bounding live memory. */
30
69
  export declare function hasQueuedImage(entries: readonly QueuedPrompt[]): boolean;
31
70
  /**
@@ -39,20 +78,25 @@ export declare function refusesToQueue(text: string): boolean;
39
78
  * One queued entry as one counted terminal row: marker, then the entry with its
40
79
  * newlines shown as `⏎` so a multi-line entry stays one row — the row is drawn
41
80
  * as a single `<Text wrap="truncate-end">`, so width overflow truncates and can
42
- * never grow a row the budget did not count.
81
+ * never grow a row the budget did not count. A background-task wake shows its
82
+ * bracketed task tag and command label instead of its model-facing text, so the
83
+ * row says what it is rather than imitating a typed prompt.
43
84
  */
44
85
  export declare function queueRowText(value: QueuedPrompt | string): string;
45
86
  /**
46
- * The draft a take-back (or a cancel-return) composes: queued entries one per
47
- * line, oldest first, **ahead of any typed text** — the Claude Code shape. The
87
+ * The draft a take-back (or a cancel-return) composes: queued **user** entries one
88
+ * per line, oldest first, **ahead of any typed text** — the Claude Code shape. The
48
89
  * entries were going to be sent before anything typed later, so they read in
49
- * that order too.
90
+ * that order too. A wake has nothing to edit and is skipped here: the App keeps
91
+ * it in the queue.
50
92
  */
51
93
  export declare function takeBackDraft(entries: readonly (QueuedPrompt | string)[], draft: string): string;
52
94
  /**
53
95
  * The busy hint's queue segment, or an empty string while nothing is queued.
54
96
  * It rides behind the live elapsed/spend readout and ahead of the static
55
97
  * command hints, on the same one truncated `<Text>` row — the count is how the
56
- * queue stays visible even when the listing's rows were all cut.
98
+ * queue stays visible even when the listing's rows were all cut. Wakes are
99
+ * counted apart from typed entries (` · 1 task wake`), so the hint says what
100
+ * kind of work is waiting.
57
101
  */
58
- export declare function queuedCountHint(count: number): string;
102
+ export declare function queuedCountHint(count: number, wakeCount?: number): string;
@@ -19,7 +19,52 @@
19
19
  * The queue is live-session state only: `/clear` drops it with the conversation,
20
20
  * a cancelled or failed turn returns it to the editor unsent, and nothing about
21
21
  * an entry is recorded until the moment it is actually sent.
22
+ *
23
+ * Two entry kinds share the FIFO (SER-069): what the user typed, and a
24
+ * background-task wake — the session-originated prompt a finished `bash start`
25
+ * job leaves behind so the model learns of the completion without polling. Both
26
+ * drain the same way; only the wake is not the user's to edit (take-back and
27
+ * cancel-return leave it queued) and is recorded as `taskNotification`, never as
28
+ * a `userInput` line, so prompt recall never offers it.
29
+ */
30
+ import { delegationWakeLabel } from './subagent-format.js';
31
+ import { delegationNotificationFields, formatDelegationNotification, taskWakeQueueTag } from './task-wake.js';
32
+ export function isTaskWake(entry) {
33
+ return entry.kind === 'taskNotification';
34
+ }
35
+ /**
36
+ * The delegation wakes (SER-070) an idle session owes right now: one entry per
37
+ * background delegation the SDK still tracks whose run has settled and which has
38
+ * not been queued before. Pure — the App calls it at settlement (when idle) and
39
+ * whenever the session returns to idle, adds the returned ids to `alreadySent`, and
40
+ * appends the entries to the queue. A running delegation is never a wake; a settled
41
+ * one the SDK already delivered is no longer tracked and so never appears.
22
42
  */
43
+ export function delegationWakeEntries(tracked, alreadySent, nowMs = Date.now()) {
44
+ const entries = [];
45
+ for (const delegation of tracked) {
46
+ if (delegation.state === 'running' || alreadySent.has(delegation.taskId))
47
+ continue;
48
+ const label = delegationWakeLabel(delegation);
49
+ const fields = delegationNotificationFields(delegation, label);
50
+ if (fields === undefined)
51
+ continue;
52
+ entries.push({ kind: 'taskNotification', ...fields, text: formatDelegationNotification(delegation, label, nowMs) });
53
+ }
54
+ return entries;
55
+ }
56
+ /** The queue split by ownership: what the user may take back, and what only drains. */
57
+ export function partitionQueue(entries) {
58
+ const user = [];
59
+ const wakes = [];
60
+ for (const entry of entries) {
61
+ if (isTaskWake(entry))
62
+ wakes.push(entry);
63
+ else
64
+ user.push(entry);
65
+ }
66
+ return { user, wakes };
67
+ }
23
68
  /** One clipboard image may be pending or queued at a time, bounding live memory. */
24
69
  export function hasQueuedImage(entries) {
25
70
  return entries.some((entry) => entry.image !== undefined);
@@ -45,30 +90,45 @@ export function refusesToQueue(text) {
45
90
  * One queued entry as one counted terminal row: marker, then the entry with its
46
91
  * newlines shown as `⏎` so a multi-line entry stays one row — the row is drawn
47
92
  * as a single `<Text wrap="truncate-end">`, so width overflow truncates and can
48
- * never grow a row the budget did not count.
93
+ * never grow a row the budget did not count. A background-task wake shows its
94
+ * bracketed task tag and command label instead of its model-facing text, so the
95
+ * row says what it is rather than imitating a typed prompt.
49
96
  */
50
97
  export function queueRowText(value) {
51
98
  const entry = typeof value === 'string' ? { text: value } : value;
99
+ if (isTaskWake(entry)) {
100
+ return `${QUEUED_MARKER} ${taskWakeQueueTag(entry)} ${entry.command.replace(/\s*\n\s*/g, ' ')}`;
101
+ }
52
102
  const attachment = entry.image === undefined ? '' : '[image] ';
53
103
  return `${QUEUED_MARKER} ${attachment}${entry.text.replace(/\n/g, ' ⏎ ')}`;
54
104
  }
55
105
  /**
56
- * The draft a take-back (or a cancel-return) composes: queued entries one per
57
- * line, oldest first, **ahead of any typed text** — the Claude Code shape. The
106
+ * The draft a take-back (or a cancel-return) composes: queued **user** entries one
107
+ * per line, oldest first, **ahead of any typed text** — the Claude Code shape. The
58
108
  * entries were going to be sent before anything typed later, so they read in
59
- * that order too.
109
+ * that order too. A wake has nothing to edit and is skipped here: the App keeps
110
+ * it in the queue.
60
111
  */
61
112
  export function takeBackDraft(entries, draft) {
62
- const queued = entries.map((entry) => typeof entry === 'string' ? entry : entry.text).join('\n');
113
+ const queued = entries
114
+ .filter((entry) => typeof entry === 'string' || !isTaskWake(entry))
115
+ .map((entry) => typeof entry === 'string' ? entry : entry.text)
116
+ .join('\n');
117
+ if (queued === '')
118
+ return draft;
63
119
  return draft === '' ? queued : `${queued}\n${draft}`;
64
120
  }
65
121
  /**
66
122
  * The busy hint's queue segment, or an empty string while nothing is queued.
67
123
  * It rides behind the live elapsed/spend readout and ahead of the static
68
124
  * command hints, on the same one truncated `<Text>` row — the count is how the
69
- * queue stays visible even when the listing's rows were all cut.
125
+ * queue stays visible even when the listing's rows were all cut. Wakes are
126
+ * counted apart from typed entries (` · 1 task wake`), so the hint says what
127
+ * kind of work is waiting.
70
128
  */
71
- export function queuedCountHint(count) {
72
- return count > 0 ? ` · ${count} queued` : '';
129
+ export function queuedCountHint(count, wakeCount = 0) {
130
+ const typed = count > 0 ? ` · ${count} queued` : '';
131
+ const wakes = wakeCount > 0 ? ` · ${wakeCount} task wake${wakeCount === 1 ? '' : 's'}` : '';
132
+ return `${typed}${wakes}`;
73
133
  }
74
134
  //# sourceMappingURL=prompt-queue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-queue.js","sourceRoot":"","sources":["../../../src/tui/prompt-queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAUH,oFAAoF;AACpF,MAAM,UAAU,cAAc,CAAC,OAAgC;IAC7D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC;AAC5D,CAAC;AAGD;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;AAExC;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;AAErG,uFAAuF;AACvF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC/C,OAAO,qBAAqB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAA4B;IACvD,MAAM,KAAK,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAClE,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,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C,CAAC,KAAK,CAAC,IAAI,CAAC;SAC9D,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAChC,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,KAAK,EAAE,CAAC;AACvD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,SAAS,GAAG,CAAC;IAC1D,MAAM,KAAK,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,MAAM,KAAK,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,SAAS,aAAa,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5F,OAAO,GAAG,KAAK,GAAG,KAAK,EAAE,CAAC;AAC5B,CAAC"}
@@ -1,25 +1,10 @@
1
- /**
2
- * Pure presentation for `/status` — one consolidated read-only report of the live
3
- * session (SER-026), on the `/mcp` read-only-projection precedent.
4
- *
5
- * A formatter over state the runtime already holds, never a new information
6
- * channel: every field of {@link StatusFacts} comes from an existing accessor
7
- * (`runtime.config`, `runtime.promptCache`, `runtime.listMcpServers()`, …), this
8
- * module performs no I/O, no model call and no mutation, and its output is a
9
- * transcript notice — the live frame gains no row. The report may restate what the
10
- * header shows (model, mode): a scrolled-away header is exactly the use case.
11
- *
12
- * This module also owns the model-line suffix renderers the header uses
13
- * ({@link formatPromptCache}, {@link formatThinking}), moved here from `App.tsx`
14
- * so the header and `/status` cannot describe the same cache or effort state
15
- * differently.
16
- */
17
1
  import type { ApprovalMode } from '../agent/permission.js';
18
2
  import type { PromptCachePlan } from '../agent/prompt-cache.js';
19
3
  import type { ContextEstimate, UsageTotals } from '../agent/runtime.js';
20
4
  import type { ThinkingPlan } from '../agent/thinking.js';
21
5
  import { type ModelPriceLookup, type ModelUsageShare } from '../agent/cost.js';
22
6
  import { type SessionCallStats } from '../agent/call-stats.js';
7
+ import { type CacheMissReport } from '../agent/cache-miss.js';
23
8
  import type { AppConfig } from '../config.js';
24
9
  import type { McpServerStatus } from '../mcp/registry.js';
25
10
  import type { TrajectoryStatus } from '../trajectory/writer.js';
@@ -49,10 +34,28 @@ export interface StatusFacts {
49
34
  mode: ApprovalMode;
50
35
  /** `runtime.allowRuleCount` — config rules plus grants accepted this session. */
51
36
  allowRuleCount: number;
37
+ /** `runtime.denyRuleCount` — configured deny-rules (SER-076), counted apart from allow-rules. */
38
+ denyRuleCount: number;
52
39
  /** `runtime.listMcpServers()` — states as they are; this report connects nothing. */
53
40
  mcpServers: readonly McpServerStatus[];
54
41
  /** `runtime.info.skillNames`. */
55
42
  skillNames: readonly string[];
43
+ /**
44
+ * `runtime.info.hookSources` — the active hook source files, in Pre policy
45
+ * order (SER-072). Hooks run commands on tool and lifecycle events, so what is
46
+ * armed is stated in-session; the paths are shown, never re-read.
47
+ */
48
+ hookSources: readonly string[];
49
+ /** `runtime.info.hookShadowNotices` — legacy hook inputs a `hooks/*.json` directory shadows. */
50
+ hookShadowNotices: readonly {
51
+ layer: string;
52
+ directory: string;
53
+ shadowed: readonly string[];
54
+ }[];
55
+ /** `runtime.info.projectRoot` — what a hook source path is shown relative to. */
56
+ projectRoot: string;
57
+ /** `os.homedir()` — the root `paths.ts` derives the global layers from; shown as `~`. */
58
+ homeDir: string;
56
59
  /** `runtime.trajectoryStatus`; undefined when recording is off. */
57
60
  trajectory: TrajectoryStatus | undefined;
58
61
  /** `runtime.diagnosticsStatus`; undefined when the log is off (the default). */
@@ -85,6 +88,13 @@ export interface StatusFacts {
85
88
  * byte-identical, the childUsage convention).
86
89
  */
87
90
  callStats: SessionCallStats | undefined;
91
+ /**
92
+ * `runtime.cacheMissReport()` — the likely cause of this session's last
93
+ * prompt-cache miss and how many were observed (SER-074). `misses: 0` keeps the
94
+ * model row byte-identical: the tracker is silent when counters are unreported
95
+ * or the live plan places no Darwin-managed cache point.
96
+ */
97
+ cacheMisses: CacheMissReport;
88
98
  /** True while a turn streams: the meter has not counted it yet, said out loud. */
89
99
  turnInFlight: boolean;
90
100
  /** The awaited `runtime.contextEstimate()`, or undefined when it failed. */
@@ -102,6 +112,15 @@ export interface StatusFacts {
102
112
  * omitted. Exported for the free spike, like `formatMcpReport`.
103
113
  */
104
114
  export declare function formatStatusReport(facts: StatusFacts): string;
115
+ /**
116
+ * The header's own wording for the three mode states, so `/status` and the header
117
+ * row cannot disagree about what the mode does — plus the live rule counts, which
118
+ * `/permissions` can expand. Exported so the header renders exactly this string.
119
+ *
120
+ * Deny-rules (SER-076) are counted apart from allow-rules and stated in every
121
+ * mode: they are what `yolo` still refuses and what `plan` does not ignore.
122
+ */
123
+ export declare function describeMode(mode: ApprovalMode, allowRuleCount: number, denyRuleCount: number): string;
105
124
  /** Plain cache state for notices that give prompt caching its own labelled row. */
106
125
  export declare function formatPromptCacheState(plan: PromptCachePlan): string;
107
126
  /**
@@ -1,6 +1,24 @@
1
+ /**
2
+ * Pure presentation for `/status` — one consolidated read-only report of the live
3
+ * session (SER-026), on the `/mcp` read-only-projection precedent.
4
+ *
5
+ * A formatter over state the runtime already holds, never a new information
6
+ * channel: every field of {@link StatusFacts} comes from an existing accessor
7
+ * (`runtime.config`, `runtime.promptCache`, `runtime.listMcpServers()`, …), this
8
+ * module performs no I/O, no model call and no mutation, and its output is a
9
+ * transcript notice — the live frame gains no row. The report may restate what the
10
+ * header shows (model, mode): a scrolled-away header is exactly the use case.
11
+ *
12
+ * This module also owns the model-line suffix renderers the header uses
13
+ * ({@link formatPromptCache}, {@link formatThinking}), moved here from `App.tsx`
14
+ * so the header and `/status` cannot describe the same cache or effort state
15
+ * differently.
16
+ */
17
+ import path from 'node:path';
1
18
  import { formatUsageValue, sumUsage, usageBuckets } from '../agent/usage.js';
2
19
  import { describeCost, describeModelCosts, withChildUsage } from '../agent/cost.js';
3
20
  import { describeCallEfficiency } from '../agent/call-stats.js';
21
+ import { describeCacheMissCause } from '../agent/cache-miss.js';
4
22
  import { formatContextValue } from './context-format.js';
5
23
  /**
6
24
  * Representative names shown per list (MCP servers, skills) before the report
@@ -22,12 +40,14 @@ export function formatStatusReport(facts) {
22
40
  [
23
41
  'model',
24
42
  `${facts.config.provider}/${facts.config.model}` +
25
- `${formatPromptCache(facts.promptCache)}${formatThinking(facts.thinking)}`,
43
+ `${formatPromptCache(facts.promptCache)}${formatThinking(facts.thinking)}` +
44
+ describeLastCacheMiss(facts),
26
45
  ],
27
46
  ['session', `${facts.sessionId}${facts.resumed ? ' (resumed)' : ''}`],
28
- ['mode', describeMode(facts.mode, facts.allowRuleCount)],
47
+ ['mode', describeMode(facts.mode, facts.allowRuleCount, facts.denyRuleCount)],
29
48
  ['mcp', describeMcpServers(facts.mcpServers)],
30
49
  ['skills', describeNames(facts.skillNames)],
50
+ ['hooks', describeHooks(facts)],
31
51
  ['trajectory', describeTrajectory(facts.trajectory)],
32
52
  ['diagnostics', describeDiagnostics(facts.diagnostics)],
33
53
  ['tokens', describeTokens(facts)],
@@ -66,19 +86,35 @@ export function formatStatusReport(facts) {
66
86
  }
67
87
  return ['status — this session', ...lines].join('\n');
68
88
  }
89
+ /**
90
+ * ` · last miss: <cause>` on the model row (SER-074), only once a miss was observed
91
+ * this session — the cache the row already describes is what missed, and the TTL
92
+ * cause names the TTL the row shows. Empty otherwise, so the row stays byte-identical.
93
+ */
94
+ function describeLastCacheMiss(facts) {
95
+ const { lastMiss, misses } = facts.cacheMisses;
96
+ if (misses <= 0 || lastMiss === undefined)
97
+ return '';
98
+ return ` · last miss: ${describeCacheMissCause(lastMiss.cause, facts.promptCache.ttl)}`;
99
+ }
69
100
  /**
70
101
  * The header's own wording for the three mode states, so `/status` and the header
71
- * row cannot disagree about what the mode does — plus the live rule count, which
72
- * `/permissions` can expand.
102
+ * row cannot disagree about what the mode does — plus the live rule counts, which
103
+ * `/permissions` can expand. Exported so the header renders exactly this string.
104
+ *
105
+ * Deny-rules (SER-076) are counted apart from allow-rules and stated in every
106
+ * mode: they are what `yolo` still refuses and what `plan` does not ignore.
73
107
  */
74
- function describeMode(mode, allowRuleCount) {
108
+ export function describeMode(mode, allowRuleCount, denyRuleCount) {
109
+ const deny = denyRuleCount > 0 ? ` · ${denyRuleCount} deny rule(s)` : '';
75
110
  if (mode === 'yolo')
76
- return 'yolo — every tool call runs without confirmation';
111
+ return `yolo — every tool call runs without confirmation${deny}`;
77
112
  if (mode === 'plan') {
78
113
  return ('plan — read-only; write and execute calls are denied' +
79
- (allowRuleCount > 0 ? ` · ${allowRuleCount} allow rule(s) ignored` : ''));
114
+ (allowRuleCount > 0 ? ` · ${allowRuleCount} allow rule(s) ignored` : '') +
115
+ deny);
80
116
  }
81
- return `${mode}${allowRuleCount > 0 ? ` · ${allowRuleCount} allow rule(s)` : ''}`;
117
+ return `${mode}${allowRuleCount > 0 ? ` · ${allowRuleCount} allow rule(s)` : ''}${deny}`;
82
118
  }
83
119
  /**
84
120
  * Every server with its state on one bounded line. States use `/mcp`'s own
@@ -117,6 +153,29 @@ function describeNames(names) {
117
153
  const suffix = remainder > 0 ? ` … ${remainder} more` : '';
118
154
  return `${names.length} — ${shown.join(', ')}${suffix}`;
119
155
  }
156
+ /**
157
+ * The armed hook source files (SER-072): the skills row's own bounding rule over
158
+ * the paths, shown project-relative inside the project and `~`-abbreviated under
159
+ * the home directory, plus how many legacy inputs a `hooks/*.json` directory
160
+ * shadows. `none` is the ordinary state, stated rather than omitted.
161
+ */
162
+ function describeHooks(facts) {
163
+ const sources = describeNames(facts.hookSources.map((file) => displayPath(file, facts.projectRoot, facts.homeDir)));
164
+ const shadowed = facts.hookShadowNotices.length;
165
+ return shadowed > 0 ? `${sources} · ${shadowed} shadowed` : sources;
166
+ }
167
+ /** A path as the user would type it: relative inside the project, `~` under home, else as is. */
168
+ function displayPath(file, projectRoot, homeDir) {
169
+ const relative = path.relative(projectRoot, file);
170
+ const inside = relative !== '' && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);
171
+ if (inside)
172
+ return relative;
173
+ if (file === homeDir)
174
+ return '~';
175
+ if (file.startsWith(homeDir + path.sep))
176
+ return `~${file.slice(homeDir.length)}`;
177
+ return file;
178
+ }
120
179
  /** `formatTrajectoryReport`'s states at line scale; the file is the useful fact. */
121
180
  function describeTrajectory(status) {
122
181
  if (status === undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"status-format.js","sourceRoot":"","sources":["../../../src/tui/status-format.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAA+C,MAAM,kBAAkB,CAAC;AACjI,OAAO,EAAE,sBAAsB,EAAyB,MAAM,wBAAwB,CAAC;AAKvF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AA8DlC;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAkB;IACnD,MAAM,IAAI,GAAuB;QAC/B;YACE,OAAO;YACP,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE;gBAC9C,GAAG,iBAAiB,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE;SAC7E;QACD,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;QACrE,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,E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C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACtD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAqB;IACrD,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,eAAe,CAAC;IAC3C,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC;IAC7B,6EAA6E;IAC7E,0EAA0E;IAC1E,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,YAAY,GAAG,EAAE,CAAC;AAC5F,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,IAAkB;IAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,gBAAgB,CAAC;IAC3E,OAAO,aAAa,IAAI,CAAC,SAAS,EAAE,CAAC;AACvC,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { type BackgroundDelegationStatus } from '../agent/background-delegation.js';
1
2
  import { type SubagentCancelResult, type SubagentDispatchPhase, type SubagentDispatchStatus } from '../agents/dispatch-registry.js';
2
3
  /** Elapsed milliseconds for one dispatch, defensive about the ISO contract. */
3
4
  export declare function dispatchElapsedMs(dispatch: SubagentDispatchStatus, nowMs?: number): number;
@@ -46,4 +47,11 @@ export declare function backgroundDelegationLiveSummary(baseSummary: string): st
46
47
  export declare function backgroundDelegationAckSummary(baseSummary: string, taskId: string): string;
47
48
  /** The finished result row, carrying the child's report like a foreground call. */
48
49
  export declare function backgroundDelegationResultSummary(baseSummary: string): string;
50
+ /**
51
+ * The label a delegation wake (SER-070) carries where a job wake carries its command:
52
+ * the same base summary the live row showed (`subagent general#bg1: count things`,
53
+ * or the classifier's summary for `workflow`), so the queue row, the notice and the
54
+ * record name the delegation exactly as the transcript did.
55
+ */
56
+ export declare function delegationWakeLabel(delegation: BackgroundDelegationStatus): string;
49
57
  export { backgroundAckTaskId } from '../agent/background-delegation.js';
@@ -13,6 +13,7 @@
13
13
  import { SUBAGENT_TOOL_NAME } from '../agents/subagent-tool.js';
14
14
  import { WORKFLOW_TOOL_NAME } from '../agents/workflow-tool.js';
15
15
  import { backgroundExecutionRequested } from '../agent/background-delegation.js';
16
+ import { classify } from '../agent/permission.js';
16
17
  import { dispatchLabel, shortDispatchId, } from '../agents/dispatch-registry.js';
17
18
  import { formatTaskDuration, summarizeTaskCommand } from './task-format.js';
18
19
  /** A delegated task is prose, so it gets less room than a shell command. */
@@ -43,9 +44,18 @@ export function formatDispatchesReport(dispatches, nowMs = Date.now()) {
43
44
  `subagent dispatches — this run (${dispatches.length})`,
44
45
  ...dispatches.map((dispatch) => ` ${dispatchLabel(dispatch).padEnd(LABEL_COLUMN)} ${dispatch.state.padEnd(STATE_COLUMN)} ` +
45
46
  `${formatTaskDuration(dispatchElapsedMs(dispatch, nowMs)).padStart(7)} ` +
46
- `${summarizeTaskCommand(dispatch.task, TASK_SUMMARY_LIMIT)}${dispatchUsageSuffix(dispatch)}`),
47
+ `${summarizeTaskCommand(dispatch.task, TASK_SUMMARY_LIMIT)}${dispatchContinuationSuffix(dispatch)}${dispatchUsageSuffix(dispatch)}`),
47
48
  ].join('\n');
48
49
  }
50
+ /**
51
+ * ` — continues #<id>` for a dispatch that ran inside a retained child's
52
+ * conversation (SER-075), nothing otherwise — an id only, never the conversation.
53
+ */
54
+ function dispatchContinuationSuffix(dispatch) {
55
+ if (dispatch.continuedFrom === undefined)
56
+ return '';
57
+ return ` — continues #${dispatch.continuedFrom}`;
58
+ }
49
59
  /**
50
60
  * ` — tokens in=X out=Y` when the dispatch snapshot carries usage, nothing
51
61
  * otherwise — a row never invents a zero for a meter that was not read.
@@ -70,6 +80,9 @@ export function formatDispatchPhase(phase) {
70
80
  case 'waiting-on-model':
71
81
  // The child's own throttled retry wait (SER-067): the attempt about to be made.
72
82
  return `waiting on model, retry ${phase.attempt}/${phase.maxAttempts}`;
83
+ case 'continuing-after-stream-interruption':
84
+ // The child's one continuation after the exact stream interruption (SRF-026).
85
+ return 'continuing after stream interruption';
73
86
  default:
74
87
  return phase.kind;
75
88
  }
@@ -142,5 +155,15 @@ export function backgroundDelegationAckSummary(baseSummary, taskId) {
142
155
  export function backgroundDelegationResultSummary(baseSummary) {
143
156
  return `${baseSummary} · background result`;
144
157
  }
158
+ /**
159
+ * The label a delegation wake (SER-070) carries where a job wake carries its command:
160
+ * the same base summary the live row showed (`subagent general#bg1: count things`,
161
+ * or the classifier's summary for `workflow`), so the queue row, the notice and the
162
+ * record name the delegation exactly as the transcript did.
163
+ */
164
+ export function delegationWakeLabel(delegation) {
165
+ return (subagentCallSummary(delegation.toolName, delegation.input, delegation.toolUseId) ??
166
+ classify(delegation.toolName, delegation.input).summary);
167
+ }
145
168
  export { backgroundAckTaskId } from '../agent/background-delegation.js';
146
169
  //# sourceMappingURL=subagent-format.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-format.js","sourceRoot":"","sources":["../../../src/tui/subagent-format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EACL,aAAa,EACb,eAAe,GAIhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAE5E,4EAA4E;AAC5E,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,kEAAkE;AAClE,MA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 *
5
+ * When a background job reaches a terminal state, the manager publishes exactly
6
+ * one immutable snapshot. Today's transcript notice tells the *user*; this module
7
+ * composes the one bounded, session-originated prompt that tells the *model* —
8
+ * delivered through the ordinary prompt queue as a distinct entry kind, drained at
9
+ * idle through `submit()`, so it is one ordinary turn (hooks, permission gate,
10
+ * trajectory barrier, `TurnComplete`) and never a mid-stream injection.
11
+ *
12
+ * Nothing here is I/O and nothing here decides *when* a wake is sent — the App
13
+ * owns the queue state machine and the runtime owns the "already delivered via
14
+ * `wait`/`status`" ledger. This module owns:
15
+ *
16
+ * - the model-facing text (`formatTaskNotification`): task id, command, state,
17
+ * exit code/signal, elapsed time and an output tail, bounded well under the
18
+ * trajectory record's field cap, in a vocabulary the model can act on;
19
+ * - the structured fields the record, the transcript row and the queue row are
20
+ * composed from (`taskNotificationFields`);
21
+ * - the one-row projections (`taskWakeQueueTag`, `formatTaskWakeNotice`) the
22
+ * queue listing and the `<Static>` transcript print, distinct from user text.
23
+ */
24
+ import { type BackgroundDelegationStatus } from '../agent/background-delegation.js';
25
+ import type { BackgroundTaskStatus } from '../tools/background-bash.js';
26
+ import type { BackgroundTail } from '../tools/background-tail.js';
27
+ import type { TaskNotificationFields } from '../trajectory/record.js';
28
+ /** Element name of the model-facing block; also the queue-entry `kind`'s vocabulary. */
29
+ export declare const TASK_NOTIFICATION_TAG = "task-notification";
30
+ /** Output lines read from the end of the job's log for the wake; the model can read more with `bash output`. */
31
+ export declare const TASK_WAKE_TAIL_LINES = 20;
32
+ /** Per-line cap inside the wake body, by code point. */
33
+ export declare const TASK_WAKE_TAIL_LINE_CODE_POINTS = 400;
34
+ /** Whole-tail cap inside the wake body, by code point. */
35
+ export declare const TASK_WAKE_TAIL_CODE_POINTS = 2000;
36
+ /** The command as the model sees it in the body, by code point (the notice row uses the shorter label). */
37
+ export declare const TASK_WAKE_COMMAND_CODE_POINTS = 400;
38
+ /** The identifying fields of one terminal snapshot; `running` is never a wake. */
39
+ export declare function taskNotificationFields(task: BackgroundTaskStatus): TaskNotificationFields | undefined;
40
+ /**
41
+ * The model-facing text of one wake. Every attribute value is manager-owned and
42
+ * character-safe (validated id, fixed state names, numbers, signal names); the
43
+ * command and output ride in the body, bounded and unable to close the element.
44
+ */
45
+ export declare function formatTaskNotification(task: BackgroundTaskStatus, tail: BackgroundTail | undefined, nowMs?: number): string;
46
+ /**
47
+ * The identifying fields of one settled background delegation (SER-070): the
48
+ * delegation label the transcript row carries stands where a job's command would,
49
+ * so the queue row, the notice and the record read the same way for both sources.
50
+ * `running` is never a wake.
51
+ */
52
+ export declare function delegationNotificationFields(delegation: BackgroundDelegationStatus, label: string): TaskNotificationFields | undefined;
53
+ /**
54
+ * The model-facing text of one delegation wake. Deliberately **not** the report: the
55
+ * SDK's own `_deliverReady` attaches the `strands_background_task_result` pair to
56
+ * this very turn's request, so the block only says which delegation ended, how, and
57
+ * where to read the result — a second copy would double the report in context and
58
+ * make two sources of one truth.
59
+ */
60
+ export declare function formatDelegationNotification(delegation: BackgroundDelegationStatus, label: string, nowMs?: number): string;
61
+ /**
62
+ * The bracketed tag a queued wake row carries after the `queued ·` marker, in the
63
+ * `[image]` attachment's vocabulary: `[task bg-1a2b3c4d succeeded]`, or
64
+ * `[delegation 1a2b3c4d succeeded]` for a background `subagent`/`workflow`. A user
65
+ * cannot type it into the queue — user rows never start with `[task ` or `[delegation `.
66
+ */
67
+ export declare function taskWakeQueueTag(fields: TaskNotificationFields): string;
68
+ /**
69
+ * The transcript row written when a wake is actually sent — composed from the
70
+ * recorded fields only, so a replayed `taskNotification` record prints the same
71
+ * row. Deliberately a notice and not a `you>` row: the user typed nothing.
72
+ */
73
+ export declare function formatTaskWakeNotice(fields: TaskNotificationFields): string;
74
+ /** The notice a wake that could not be delivered leaves behind (its turn was cancelled or failed). */
75
+ export declare function formatTaskWakeUndelivered(fields: TaskNotificationFields): string;