@nyte-ai/plugin 0.0.25-beta.1 → 0.0.25-nightly.20261101.40

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 (88) hide show
  1. package/THIRD-PARTY-NOTICES.md +49 -32
  2. package/dist/chunks/bash-description-0ah30s12.js +33 -0
  3. package/dist/chunks/bash-description-4h0hnsv4.js +68 -0
  4. package/dist/chunks/{bash-description-dnvgk30y.js → bash-description-4rfavmha.js} +32 -1
  5. package/dist/chunks/bash-description-5dpf5hpt.js +724 -0
  6. package/dist/chunks/{bash-description-yyd9jznf.js → bash-description-94km1hm2.js} +1 -1
  7. package/dist/chunks/{bash-description-svrhh5a5.js → bash-description-99k8z2r7.js} +3 -2
  8. package/dist/chunks/bash-description-9gw9ets8.js +162 -0
  9. package/dist/chunks/{bash-description-h13r0byk.js → bash-description-axnga0jz.js} +3 -3
  10. package/dist/chunks/bash-description-b78pre8c.js +147 -0
  11. package/dist/chunks/{bash-description-ye3wk5r3.js → bash-description-bas41ptb.js} +6 -24
  12. package/dist/chunks/{bash-description-2v3g7rd9.js → bash-description-bj5yh7tr.js} +26 -64
  13. package/dist/chunks/{bash-description-6z2kgtyt.js → bash-description-bkhr9zrz.js} +4 -4
  14. package/dist/chunks/{bash-description-hg64tqf1.js → bash-description-f754ge33.js} +49 -3
  15. package/dist/chunks/{bash-description-zz15raxk.js → bash-description-ff18794t.js} +1 -1
  16. package/dist/chunks/{bash-description-wmcbg6fw.js → bash-description-g7gfy7nw.js} +1 -1
  17. package/dist/chunks/{bash-description-1neewp76.js → bash-description-hp4rb8k4.js} +4 -3
  18. package/dist/chunks/bash-description-myvnmtt2.js +125 -0
  19. package/dist/chunks/{bash-description-9nn3yp18.js → bash-description-q2v8wbn8.js} +9 -1
  20. package/dist/chunks/bash-description-qwyy182r.js +452 -0
  21. package/dist/chunks/bash-description-rxpx004v.js +295 -0
  22. package/dist/chunks/{bash-description-eqp7ap2w.js → bash-description-z1581a29.js} +23 -9
  23. package/dist/src/acp/connection.d.ts +3 -1
  24. package/dist/src/acp/connection.js +3 -3
  25. package/dist/src/acp/index.d.ts +7 -4
  26. package/dist/src/acp/index.js +41 -8
  27. package/dist/src/acp/registry.d.ts +9 -0
  28. package/dist/src/acp/registry.js +5 -3
  29. package/dist/src/acp/thread.js +2 -2
  30. package/dist/src/acp/transcript.js +2 -2
  31. package/dist/src/acp/translate.d.ts +10 -2
  32. package/dist/src/acp/translate.js +3 -1
  33. package/dist/src/approvals/approvals.d.ts +1 -1
  34. package/dist/src/approvals/approvals.js +2 -2
  35. package/dist/src/approvals/schema.d.ts +3 -3
  36. package/dist/src/approvals/schema.js +1 -1
  37. package/dist/src/browser-tools.js +8 -2
  38. package/dist/src/canvas/canvas-compile.js +2 -2
  39. package/dist/src/canvas/canvas-preview.js +2 -2
  40. package/dist/src/canvas/canvas-protocol.d.ts +46 -0
  41. package/dist/src/canvas/canvas-protocol.js +11 -1
  42. package/dist/src/canvas/canvas.d.ts +17 -3
  43. package/dist/src/canvas/canvas.js +75 -31
  44. package/dist/src/canvas/schema.d.ts +28 -7
  45. package/dist/src/canvas/schema.js +2 -2
  46. package/dist/src/claude-code-sdk/index.d.ts +0 -10
  47. package/dist/src/claude-code-sdk/index.js +19 -179
  48. package/dist/src/claude-code-sdk/session.d.ts +22 -23
  49. package/dist/src/claude-code-sdk/session.js +6 -3
  50. package/dist/src/claude-code-sdk/transcript.d.ts +0 -6
  51. package/dist/src/claude-code-sdk/transcript.js +2 -4
  52. package/dist/src/claude-code-sdk/translate.d.ts +1 -5
  53. package/dist/src/claude-code-sdk/translate.js +2 -8
  54. package/dist/src/client/mount.d.ts +4 -2
  55. package/dist/src/client/mount.js +3 -0
  56. package/dist/src/client/notifications.d.ts +12 -4
  57. package/dist/src/client/notifications.js +25 -10
  58. package/dist/src/client/presentation.d.ts +138 -8
  59. package/dist/src/client/presentation.js +86 -371
  60. package/dist/src/codemode.js +151 -46
  61. package/dist/src/core.d.ts +1 -1
  62. package/dist/src/question/client/questions-tui.js +3 -3
  63. package/dist/src/question/client/questions.js +3 -3
  64. package/dist/src/question/question.js +84 -5
  65. package/dist/src/question/schema.js +3 -3
  66. package/dist/src/rename.d.ts +7 -35
  67. package/dist/src/rename.js +115 -48
  68. package/dist/src/subagents.d.ts +30 -0
  69. package/dist/src/subagents.js +323 -0
  70. package/dist/src/tool-search.d.ts +49 -0
  71. package/dist/src/tool-search.js +14 -0
  72. package/dist/src/web/body.d.ts +3 -0
  73. package/dist/src/web/body.js +6 -0
  74. package/dist/src/web/fetch.d.ts +16 -0
  75. package/dist/src/web/fetch.js +8 -0
  76. package/dist/src/web/html-markdown.d.ts +9 -0
  77. package/dist/src/web/html-markdown.js +10 -0
  78. package/dist/src/web/index.d.ts +24 -0
  79. package/dist/src/web/index.js +93 -0
  80. package/dist/src/web/providers.d.ts +60 -0
  81. package/dist/src/web/providers.js +11 -0
  82. package/dist/src/web/search.d.ts +21 -0
  83. package/dist/src/web/search.js +6 -0
  84. package/package.json +16 -7
  85. package/dist/chunks/bash-description-3j77ss7y.js +0 -86
  86. package/dist/chunks/bash-description-wbe8w0te.js +0 -530
  87. package/dist/src/web-search.d.ts +0 -78
  88. package/dist/src/web-search.js +0 -219
@@ -1,6 +1,7 @@
1
1
  import { text, thinking } from "@nyte-ai/core";
2
2
  import type { PartState } from "@nyte-ai/core";
3
- import type { Execution, Failure, HeadInfo, Message, MessageSource, SessionInfo, ToolClass, ToolPartState, UserContent } from "@nyte-ai/schema";
3
+ import type { Execution, Failure, HeadInfo, Message, MessageSource, RunEnd, RunId, SessionInfo, ToolClass, ToolPartState, UserContent } from "@nyte-ai/schema";
4
+ export { jobTaskState } from "@nyte-ai/schema";
4
5
  /**
5
6
  * A message the user sent, or one a child, job or action delivered for them.
6
7
  *
@@ -142,17 +143,135 @@ export declare function toolStatus(message: Pick<ToolMessage, "state" | "status"
142
143
  */
143
144
  export declare function toolOutput(state: ToolPartState): string;
144
145
  /**
145
- * The mark a session list draws for a head's execution.
146
+ * A chat's, subagent's or job's state, each with one mark and one word ({@link taskLabel}). A
147
+ * stopped run or job is done, never failed.
146
148
  *
147
149
  * @category presentation
148
150
  */
149
- export type SessionMark = "waiting" | "retry" | "working" | "failed" | "idle";
151
+ export type TaskState = "waiting" | "retrying" | "working" | "background" | "failed" | "done";
150
152
  /**
151
- * The mark for an execution; a session without one is idle.
153
+ * Screen readers hear the same word sighted users see.
152
154
  *
153
155
  * @category presentation
154
156
  */
155
- export declare function executionMark(execution: Execution | undefined): SessionMark;
157
+ export declare function taskLabel(state: TaskState): string;
158
+ /**
159
+ * A delegate call's state as a task, for a child no client knows yet.
160
+ *
161
+ * @category presentation
162
+ */
163
+ export declare function callTaskState(status: ToolStatus): TaskState;
164
+ /**
165
+ * Whether a task has finished, either done or failed.
166
+ *
167
+ * @category presentation
168
+ */
169
+ export declare function taskEnded(state: TaskState): boolean;
170
+ /**
171
+ * The heading over a group of agents: how many still run, else how many finished and failed.
172
+ *
173
+ * @category presentation
174
+ */
175
+ export declare function agentGroupSummary(states: readonly TaskState[]): {
176
+ readonly title: string;
177
+ readonly detail: string | undefined;
178
+ };
179
+ /**
180
+ * A chat's own run; background work never changes it. The active kinds carry the run a Stop
181
+ * targets.
182
+ *
183
+ * @category presentation
184
+ */
185
+ export type RunStatus = {
186
+ readonly kind: "idle";
187
+ } | {
188
+ readonly kind: "completed";
189
+ } | {
190
+ readonly kind: "stopped";
191
+ } | {
192
+ readonly kind: "failed";
193
+ readonly failure: Failure;
194
+ } | {
195
+ readonly kind: "working";
196
+ readonly run: RunId;
197
+ readonly stopping: boolean;
198
+ } | {
199
+ readonly kind: "retrying";
200
+ readonly run: RunId;
201
+ } | {
202
+ readonly kind: "waiting-for-approval";
203
+ readonly run: RunId;
204
+ };
205
+ /**
206
+ * How many of a head's background items are still working and how many wait on the user.
207
+ *
208
+ * @category presentation
209
+ */
210
+ export type BackgroundWork = HeadInfo["background"];
211
+ /**
212
+ * A head's execution as a run status; none reads as idle, and a run waiting on a child, job or
213
+ * timer reads as working.
214
+ *
215
+ * @category presentation
216
+ */
217
+ export declare function runStatus(execution: Execution | undefined): RunStatus;
218
+ /**
219
+ * The status a run leaves when it ends; a stopped run is never a failure.
220
+ *
221
+ * @category presentation
222
+ */
223
+ export declare function endedStatus(end: RunEnd): RunStatus;
224
+ /**
225
+ * A chat's own run as a task state; a run that ended is done unless it failed.
226
+ *
227
+ * @category presentation
228
+ */
229
+ export declare function runMark(status: RunStatus): TaskState;
230
+ /**
231
+ * The state a list row shows, taking the first that applies: the chat's own active run,
232
+ * background work waiting on the user, the chat's own failure, background work still running,
233
+ * then how the chat's last run ended.
234
+ *
235
+ * @category presentation
236
+ */
237
+ export declare function rowMark(status: RunStatus, background: BackgroundWork): TaskState;
238
+ /**
239
+ * Words for a chat's background work, or `undefined` while none is working or waiting.
240
+ *
241
+ * @category presentation
242
+ */
243
+ export declare function backgroundLabel(background: BackgroundWork): string | undefined;
244
+ /**
245
+ * The live row's words after `planningMs` without progress. None at first, so a quick gap doesn't
246
+ * flash.
247
+ *
248
+ * @category presentation
249
+ */
250
+ export declare function planningLabel(planningMs: number): string | undefined;
251
+ /**
252
+ * Also holds the live row's place before {@link planningLabel} shows it.
253
+ *
254
+ * @category presentation
255
+ */
256
+ export declare const PLANNING_LABEL = "Planning next moves";
257
+ /**
258
+ * How long without progress before the live row says a run is planning.
259
+ *
260
+ * @category presentation
261
+ */
262
+ export declare const PLANNING_DELAY_MS = 200;
263
+ /**
264
+ * How long without progress before the live row says a run is taking longer than expected.
265
+ *
266
+ * @category presentation
267
+ */
268
+ export declare const SLOW_PLANNING_MS = 15000;
269
+ /**
270
+ * An execution's own run as a task; a session without one is done.
271
+ *
272
+ * @category presentation
273
+ */
274
+ export declare function executionMark(execution: Execution | undefined): TaskState;
156
275
  /**
157
276
  * The head a session row speaks for: `main`, else the first.
158
277
  *
@@ -160,11 +279,23 @@ export declare function executionMark(execution: Execution | undefined): Session
160
279
  */
161
280
  export declare function mainHead(session: Pick<SessionInfo, "heads">): HeadInfo | undefined;
162
281
  /**
163
- * The mark for a session's main head.
282
+ * A session's state, the same in a list row, a tab and a parent's task list.
283
+ *
284
+ * @category presentation
285
+ */
286
+ export declare function sessionMark(session: Pick<SessionInfo, "heads">): TaskState;
287
+ /**
288
+ * A session's title: its name, else "New chat" for a top-level chat or {@link SUBAGENT_TITLE}.
289
+ *
290
+ * @category presentation
291
+ */
292
+ export declare function sessionTitle(session: Pick<SessionInfo, "name" | "parent">): string;
293
+ /**
294
+ * A child session's title while it has no name or a client doesn't know it yet.
164
295
  *
165
296
  * @category presentation
166
297
  */
167
- export declare function sessionMark(session: Pick<SessionInfo, "heads">): SessionMark;
298
+ export declare const SUBAGENT_TITLE = "Subagent";
168
299
  /**
169
300
  * The text after a one-line draft's leading `/name `, while the caret is past
170
301
  * it: `start` is where that text begins, `query` runs from there to the caret.
@@ -333,4 +464,3 @@ export interface FailureNotice {
333
464
  * @category presentation
334
465
  */
335
466
  export declare function failureNotice(failure: Failure): FailureNotice;
336
- export {};
@@ -1,373 +1,88 @@
1
- // src/client/presentation.ts
2
- import { isPart, text, thinking, tool } from "@nyte-ai/core";
3
- function showsTool(message) {
4
- return isPart(message, tool);
5
- }
6
- function showsText(message) {
7
- return isPart(message, text);
8
- }
9
- function showsThinking(message) {
10
- return isPart(message, thinking);
11
- }
12
- function readRawPart(message) {
13
- const { state } = message;
14
- if (typeof state === "object" && state !== null && !Array.isArray(state)) {
15
- const prose = "markdown" in state ? state.markdown : ("text" in state) ? state.text : undefined;
16
- if (typeof prose === "string")
17
- return { format: "text", body: prose };
18
- }
19
- return { format: "json", body: state === undefined ? "null" : JSON.stringify(state, null, 2) };
20
- }
21
- function showsReport(message) {
22
- return message.source.kind === "child" || message.source.kind === "job";
23
- }
24
- function shownContent(message) {
25
- return message.source.kind === "action" ? message.source.label : message.content;
26
- }
27
- var RUNNING = { tense: "running", tone: "running", word: undefined };
28
- function toolStatus(message) {
29
- const { state, status } = message;
30
- if (state.phase !== "settled") {
31
- if (status.kind === "failed")
32
- return status.failure.class === "aborted" ? { tense: "none", tone: "stopped", word: "Stopped" } : { tense: "none", tone: "stopped", word: "Interrupted" };
33
- if (status.kind === "waiting" && status.on.kind === "part")
34
- return { tense: "running", tone: "attention", word: "Needs input" };
35
- return RUNNING;
36
- }
37
- switch (state.outcome.kind) {
38
- case "ok":
39
- return { tense: "past", tone: "success", word: undefined };
40
- case "failed":
41
- return { tense: "none", tone: "failure", word: "Failed" };
42
- case "rejected":
43
- return { tense: "none", tone: "failure", word: "Blocked" };
44
- case "stopped":
45
- return { tense: "none", tone: "stopped", word: "Stopped" };
46
- case "interrupted":
47
- return { tense: "none", tone: "stopped", word: "Interrupted" };
48
- default: {
49
- const _exhaustive = state.outcome;
50
- return _exhaustive;
51
- }
52
- }
53
- }
54
- function toolOutput(state) {
55
- if (state.phase !== "settled")
56
- return "";
57
- switch (state.outcome.kind) {
58
- case "ok":
59
- return state.outcome.content.flatMap((content) => content.kind === "text" && content.text !== "" ? [content.text] : []).join(`
60
- `);
61
- case "failed":
62
- return state.outcome.message;
63
- case "rejected":
64
- return state.outcome.reason;
65
- case "stopped":
66
- case "interrupted":
67
- return "";
68
- default: {
69
- const _exhaustive = state.outcome;
70
- return _exhaustive;
71
- }
72
- }
73
- }
74
- function executionMark(execution) {
75
- switch (execution?.kind) {
76
- case undefined:
77
- return "idle";
78
- case "idle":
79
- return execution.lastRun?.end.kind === "failed" ? "failed" : "idle";
80
- case "live":
81
- return "working";
82
- case "waiting":
83
- return execution.on.kind === "part" ? "waiting" : "working";
84
- case "retrying":
85
- return "retry";
86
- default: {
87
- const _exhaustive = execution;
88
- return _exhaustive;
89
- }
90
- }
91
- }
92
- function mainHead(session) {
93
- return session.heads.find((head) => head.name === "main") ?? session.heads[0];
94
- }
95
- function sessionMark(session) {
96
- return executionMark(mainHead(session)?.execution);
97
- }
98
- var COMMAND_ARGUMENT = /^[ \t]*\/([a-z0-9][a-z0-9-]*)[ \t]+/u;
99
- function findCommandArgument(value, cursor) {
100
- const found = COMMAND_ARGUMENT.exec(value);
101
- const command = found?.[1];
102
- if (found === null || command === undefined || /[\r\n]/u.test(value))
103
- return;
104
- const start = found[0].length;
105
- return cursor < start ? undefined : { command, start, query: value.slice(start, cursor) };
106
- }
107
- function completionTrigger(value, cursor = value.length) {
108
- const caret = Math.max(0, Math.min(cursor, value.length));
109
- let start = caret;
110
- while (start > 0 && (value[start - 1] ?? "").trim() !== "")
111
- start -= 1;
112
- const kind = value[start];
113
- if (start === caret || kind !== "@" && kind !== "/")
114
- return;
115
- let end = caret;
116
- while (end < value.length && (value[end] ?? "").trim() !== "")
117
- end += 1;
118
- return { kind, start, end, query: value.slice(start + 1, caret) };
119
- }
120
- var RAN = { running: "Running", past: "Ran" };
121
- var CLASS_VERBS = {
122
- read: { running: "Reading", past: "Read" },
123
- list: { running: "Listing", past: "Listed" },
124
- edit: { running: "Editing", past: "Edited" },
125
- shell: RAN
126
- };
127
- var DELEGATE_VERBS = {
128
- task: { running: "Delegating", past: "Delegated" },
129
- create: { running: "Creating", past: "Created" },
130
- send: { running: "Messaging", past: "Messaged" },
131
- await: { running: "Waiting on", past: "Waited on" },
132
- read: { running: "Reading transcript", past: "Read transcript" },
133
- stop: { running: "Stopping", past: "Stopped" }
134
- };
135
- var DELEGATE_NOUNS = {
136
- task: "agent",
137
- create: "agent",
138
- send: "message",
139
- await: "wait",
140
- read: "transcript",
141
- stop: "stop"
142
- };
143
- var NAMED_TOOLS = new Map([
144
- ["codemode", { verbs: { running: "Running script", past: "Ran script" } }],
145
- ["tool_search", { verbs: { running: "Exploring", past: "Explored" }, detail: "available tools" }],
146
- ["websearch", { verbs: { running: "Searching web", past: "Searched web" } }],
147
- ["web_search", { verbs: { running: "Searching web", past: "Searched web" } }],
148
- ["webfetch", { verbs: { running: "Fetching page", past: "Fetched page" } }],
149
- ["web_fetch", { verbs: { running: "Fetching page", past: "Fetched page" } }],
150
- ["rename_chat", { verbs: { running: "Renaming chat", past: "Renamed chat" } }],
151
- ["browser_open", { verbs: { running: "Opening page", past: "Opened page" } }],
152
- ["browser_click", { verbs: { running: "Clicking", past: "Clicked" } }],
153
- ["browser_type", { verbs: { running: "Typing", past: "Typed" } }],
154
- ["browser_press", { verbs: { running: "Pressing key", past: "Pressed key" } }],
155
- ["browser_scroll", { verbs: { running: "Scrolling", past: "Scrolled" } }],
156
- ["browser_wait", { verbs: { running: "Waiting", past: "Waited" } }],
157
- ["browser_snapshot", { verbs: { running: "Taking snapshot", past: "Took snapshot" } }],
158
- [
159
- "browser_console",
160
- { verbs: { running: "Checking console logs", past: "Checked console logs" } }
161
- ],
162
- ["browser_evaluate", { verbs: { running: "Executing JS", past: "Executed JS" } }]
163
- ]);
164
- var MCP_LABEL = /^(?<server>[^:\s]+): (?<name>\S+)$/u;
165
- var MCP_NAME = /^mcp__(?<server>.+?)__(?<name>.+)$/u;
166
- function customTool(label) {
167
- const named = NAMED_TOOLS.get(label);
168
- if (named !== undefined)
169
- return named;
170
- const mcp = (MCP_LABEL.exec(label) ?? MCP_NAME.exec(label))?.groups;
171
- if (mcp?.server !== undefined && mcp.name !== undefined)
172
- return { verbs: RAN, name: mcp.name, server: mcp.server };
173
- if (/\s/u.test(label))
174
- return { verbs: { running: label, past: label } };
175
- return { verbs: RAN, name: label };
176
- }
177
- function customDetail(custom) {
178
- if (custom.name === undefined)
179
- return custom.detail;
180
- return custom.server === undefined ? custom.name : `${custom.name} in ${custom.server}`;
181
- }
182
- function toolVerbs(toolClass) {
183
- switch (toolClass.kind) {
184
- case "read":
185
- case "list":
186
- case "edit":
187
- case "shell":
188
- return CLASS_VERBS[toolClass.kind];
189
- case "delegate":
190
- return DELEGATE_VERBS[toolClass.role];
191
- case "custom":
192
- return customTool(toolClass.label).verbs;
193
- default: {
194
- const _exhaustive = toolClass;
195
- return _exhaustive;
196
- }
197
- }
198
- }
199
- function toolNoun(toolClass) {
200
- switch (toolClass.kind) {
201
- case "read":
202
- case "list":
203
- case "edit":
204
- return toolClass.kind;
205
- case "delegate":
206
- return DELEGATE_NOUNS[toolClass.role];
207
- case "shell":
208
- case "custom":
209
- return;
210
- default: {
211
- const _exhaustive = toolClass;
212
- return _exhaustive;
213
- }
214
- }
215
- }
216
- function delegateSubject(toolClass) {
217
- return toolClass.title ?? "subagent";
218
- }
219
- function toolSubject(toolClass) {
220
- switch (toolClass.kind) {
221
- case "read":
222
- case "list":
223
- case "edit":
224
- return toolClass.path;
225
- case "shell":
226
- return toolClass.command;
227
- case "delegate":
228
- return delegateSubject(toolClass);
229
- case "custom":
230
- return customDetail(customTool(toolClass.label));
231
- default: {
232
- const _exhaustive = toolClass;
233
- return _exhaustive;
234
- }
235
- }
236
- }
237
- function toolTitle(toolClass, tense, subject = toolSubject(toolClass)) {
238
- if (tense !== "none") {
239
- const verb = toolVerbs(toolClass)[tense];
240
- return subject === undefined ? verb : `${verb} ${subject}`;
241
- }
242
- if (toolClass.kind === "custom" && customTool(toolClass.label).name === undefined)
243
- return toolClass.label;
244
- return [subject, toolNoun(toolClass)].filter((word) => word !== undefined).join(" ");
245
- }
246
- function tidyPath(path, cwd) {
247
- if (cwd !== undefined && path.startsWith(`${cwd}/`))
248
- return path.slice(cwd.length + 1);
249
- return path;
250
- }
251
- function basename(path) {
252
- return path.split(/[\\/]/u).at(-1) ?? path;
253
- }
254
- function placeName(path, cwd) {
255
- const tidy = tidyPath(path, cwd);
256
- if (tidy === "." || tidy === "./" || tidy === cwd)
257
- return basename(cwd ?? tidy) || tidy;
258
- return basename(tidy.replace(/[\\/]+$/u, "")) || tidy;
259
- }
260
- function condensedCommand(command, cwd) {
261
- const compact = command.replaceAll(/\s+/gu, " ").trim();
262
- if (cwd === undefined)
263
- return compact;
264
- const prefix = [cwd, `"${cwd}"`, `'${cwd}'`].flatMap((dir) => [`cd ${dir} && `, `cd ${dir}; `]).find((candidate) => compact.startsWith(candidate));
265
- return prefix === undefined ? compact : compact.slice(prefix.length);
266
- }
267
- function formatDuration(ms) {
268
- const seconds = Math.max(0, ms) / 1000;
269
- if (seconds < 10)
270
- return `${seconds.toFixed(1)}s`;
271
- if (seconds < 60)
272
- return `${String(Math.floor(seconds))}s`;
273
- const minutes = Math.floor(seconds / 60);
274
- if (minutes < 60)
275
- return `${String(minutes)}m ${String(Math.floor(seconds % 60))}s`;
276
- return `${String(Math.floor(minutes / 60))}h ${String(minutes % 60)}m`;
277
- }
278
- function formatWholeDuration(ms) {
279
- const seconds = Math.max(0, Math.round(ms / 1000));
280
- const minutes = Math.floor(seconds / 60);
281
- const hours = Math.floor(minutes / 60);
282
- if (hours > 0)
283
- return minutes % 60 === 0 ? `${String(hours)}h` : `${String(hours)}h ${String(minutes % 60)}m`;
284
- if (minutes > 0)
285
- return seconds % 60 === 0 ? `${String(minutes)}m` : `${String(minutes)}m ${String(seconds % 60)}s`;
286
- return `${String(seconds)}s`;
287
- }
288
- function toolDetail(toolClass, cwd) {
289
- switch (toolClass.kind) {
290
- case "edit": {
291
- const title = tidyPath(toolClass.path, cwd);
292
- return { text: basename(title), title };
293
- }
294
- case "read":
295
- case "list":
296
- return { text: placeName(toolClass.path, cwd), title: tidyPath(toolClass.path, cwd) };
297
- case "shell":
298
- return { text: condensedCommand(toolClass.command, cwd) };
299
- case "delegate":
300
- return { text: delegateSubject(toolClass) };
301
- case "custom": {
302
- const detail = customDetail(customTool(toolClass.label));
303
- return detail === undefined ? undefined : { text: detail };
304
- }
305
- default: {
306
- const _exhaustive = toolClass;
307
- return _exhaustive;
308
- }
309
- }
310
- }
311
- var NOTICE_LIMIT = 180;
312
- function oneLine(message) {
313
- const compact = message.replaceAll(/\s+/gu, " ").trim();
314
- if (compact === "")
315
- return;
316
- return compact.length <= NOTICE_LIMIT ? compact : `${compact.slice(0, NOTICE_LIMIT - 1).trimEnd()}…`;
317
- }
318
- function danger(notice, recovery) {
319
- return { text: notice, tone: "danger", recovery };
320
- }
321
- function failureNotice(failure) {
322
- switch (failure.class) {
323
- case "aborted":
324
- return { text: "Run stopped.", tone: "neutral", recovery: undefined };
325
- case "rate_limit":
326
- return danger("Rate limit reached. Try again shortly.");
327
- case "context_window":
328
- return danger("This chat no longer fits the model's context window.", "compact");
329
- case "quota":
330
- return danger("Provider quota reached.", "switch-model");
331
- case "auth":
332
- return danger("The provider rejected the sign-in.", "sign-in");
333
- case "overloaded":
334
- return danger("The model is temporarily unavailable. Try again shortly.");
335
- case "network":
336
- return danger("Connection lost. Check your network and try again.");
337
- case "provider":
338
- case "runner":
339
- return danger(oneLine(failure.message) ?? "Request failed.");
340
- default: {
341
- const _exhaustive = failure.class;
342
- return _exhaustive;
343
- }
344
- }
345
- }
1
+ import {
2
+ showsTool2,
3
+ showsText2,
4
+ showsThinking2,
5
+ readRawPart2,
6
+ showsReport2,
7
+ shownContent2,
8
+ toolStatus2,
9
+ toolOutput2,
10
+ taskLabel2,
11
+ callTaskState2,
12
+ taskEnded2,
13
+ agentGroupSummary2,
14
+ runStatus2,
15
+ endedStatus2,
16
+ runMark2,
17
+ rowMark2,
18
+ backgroundLabel2,
19
+ planningLabel2,
20
+ PLANNING_LABEL2,
21
+ PLANNING_DELAY_MS2,
22
+ SLOW_PLANNING_MS2,
23
+ executionMark2,
24
+ mainHead2,
25
+ sessionMark2,
26
+ sessionTitle2,
27
+ SUBAGENT_TITLE2,
28
+ findCommandArgument2,
29
+ completionTrigger2,
30
+ customTool2,
31
+ toolVerbs2,
32
+ toolNoun2,
33
+ delegateSubject2,
34
+ toolSubject2,
35
+ toolTitle2,
36
+ tidyPath2,
37
+ placeName2,
38
+ condensedCommand2,
39
+ formatDuration2,
40
+ formatWholeDuration2,
41
+ toolDetail2,
42
+ failureNotice2,
43
+ jobTaskState2
44
+ } from "../../chunks/bash-description-qwyy182r.js";
346
45
  export {
347
- completionTrigger,
348
- condensedCommand,
349
- customTool,
350
- delegateSubject,
351
- executionMark,
352
- failureNotice,
353
- findCommandArgument,
354
- formatDuration,
355
- formatWholeDuration,
356
- mainHead,
357
- placeName,
358
- readRawPart,
359
- sessionMark,
360
- shownContent,
361
- showsReport,
362
- showsText,
363
- showsThinking,
364
- showsTool,
365
- tidyPath,
366
- toolDetail,
367
- toolNoun,
368
- toolOutput,
369
- toolStatus,
370
- toolSubject,
371
- toolTitle,
372
- toolVerbs
46
+ PLANNING_DELAY_MS2 as PLANNING_DELAY_MS,
47
+ PLANNING_LABEL2 as PLANNING_LABEL,
48
+ SLOW_PLANNING_MS2 as SLOW_PLANNING_MS,
49
+ SUBAGENT_TITLE2 as SUBAGENT_TITLE,
50
+ agentGroupSummary2 as agentGroupSummary,
51
+ backgroundLabel2 as backgroundLabel,
52
+ callTaskState2 as callTaskState,
53
+ completionTrigger2 as completionTrigger,
54
+ condensedCommand2 as condensedCommand,
55
+ customTool2 as customTool,
56
+ delegateSubject2 as delegateSubject,
57
+ endedStatus2 as endedStatus,
58
+ executionMark2 as executionMark,
59
+ failureNotice2 as failureNotice,
60
+ findCommandArgument2 as findCommandArgument,
61
+ formatDuration2 as formatDuration,
62
+ formatWholeDuration2 as formatWholeDuration,
63
+ jobTaskState2 as jobTaskState,
64
+ mainHead2 as mainHead,
65
+ placeName2 as placeName,
66
+ planningLabel2 as planningLabel,
67
+ readRawPart2 as readRawPart,
68
+ rowMark2 as rowMark,
69
+ runMark2 as runMark,
70
+ runStatus2 as runStatus,
71
+ sessionMark2 as sessionMark,
72
+ sessionTitle2 as sessionTitle,
73
+ shownContent2 as shownContent,
74
+ showsReport2 as showsReport,
75
+ showsText2 as showsText,
76
+ showsThinking2 as showsThinking,
77
+ showsTool2 as showsTool,
78
+ taskEnded2 as taskEnded,
79
+ taskLabel2 as taskLabel,
80
+ tidyPath2 as tidyPath,
81
+ toolDetail2 as toolDetail,
82
+ toolNoun2 as toolNoun,
83
+ toolOutput2 as toolOutput,
84
+ toolStatus2 as toolStatus,
85
+ toolSubject2 as toolSubject,
86
+ toolTitle2 as toolTitle,
87
+ toolVerbs2 as toolVerbs
373
88
  };