@tangle-network/ui 11.10.0 → 11.11.1

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 (132) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +4 -1
  3. package/dist/active-sessions-store-Gt1R0rFG.js +262 -0
  4. package/dist/{active-sessions-store-CeOmXgv5.d.ts → active-sessions-store-nl70ZnMC.d.ts} +40 -41
  5. package/dist/artifact-pane-BL_DFWNl.d.ts +32 -0
  6. package/dist/artifact-pane-DMXT9a8U.js +70 -0
  7. package/dist/auth-DOETfnd9.js +154 -0
  8. package/dist/auth.d.ts +2 -74
  9. package/dist/auth.js +2 -16
  10. package/dist/branding-26d5ARIr.d.ts +14 -0
  11. package/dist/button-C87nEe2R.js +78 -0
  12. package/dist/button-yoIv77e2.d.ts +16 -0
  13. package/dist/chat-D4jAfEmj.js +667 -0
  14. package/dist/chat.d.ts +2 -201
  15. package/dist/chat.js +2 -31
  16. package/dist/code-block-B36KVUSN.js +165 -0
  17. package/dist/code-block-B9miUPht.d.ts +23 -0
  18. package/dist/diff-preview-BcK3nRXb.js +533 -0
  19. package/dist/document-editor-pane-BcoABlhn.d.ts +131 -0
  20. package/dist/document-editor-pane-BxlPjaTP.js +1287 -0
  21. package/dist/dropdown-menu-BpcLa5vF.js +101 -0
  22. package/dist/editor.d.ts +76 -78
  23. package/dist/editor.js +2 -34
  24. package/dist/file-format-BgXbr-Ib.js +160 -0
  25. package/dist/files-Bug33qCl.js +743 -0
  26. package/dist/files.d.ts +2 -243
  27. package/dist/files.js +3 -41
  28. package/dist/focus-BcE_SHqz.js +57 -0
  29. package/dist/format-DfcLWqMa.js +54 -0
  30. package/dist/hooks.d.ts +30 -37
  31. package/dist/hooks.js +111 -46
  32. package/dist/index-2UntyjBb.d.ts +52 -0
  33. package/dist/index-BgUHilZm.d.ts +108 -0
  34. package/dist/index-COgqsFAQ.d.ts +42 -0
  35. package/dist/index-CPDET_s1.d.ts +549 -0
  36. package/dist/index-CUhfHT_V.d.ts +204 -0
  37. package/dist/index-Cg6gYAqh.d.ts +73 -0
  38. package/dist/index-Cq-EJzqW.d.ts +16 -0
  39. package/dist/index-DhYmSaLF.d.ts +245 -0
  40. package/dist/index-DjKxO357.d.ts +128 -0
  41. package/dist/index.d.ts +26 -43
  42. package/dist/index.js +35 -472
  43. package/dist/markdown-BGqicV82.js +45 -0
  44. package/dist/markdown.d.ts +3 -18
  45. package/dist/markdown.js +3 -15
  46. package/dist/message-vhUI0c5G.d.ts +16 -0
  47. package/dist/nav.d.ts +6 -8
  48. package/dist/nav.js +29 -11
  49. package/dist/openui-artifact-renderer-D3E5bIAI.d.ts +114 -0
  50. package/dist/openui-artifact-renderer-DrU1AdVk.js +266 -0
  51. package/dist/openui.d.ts +2 -115
  52. package/dist/openui.js +2 -13
  53. package/dist/parts-5mhy9yJ3.d.ts +37 -0
  54. package/dist/primitives-Cb8GGVKr.js +1239 -0
  55. package/dist/primitives.d.ts +5 -525
  56. package/dist/primitives.js +9 -212
  57. package/dist/redaction-CGGB2ENG.js +74 -0
  58. package/dist/redaction.d.ts +2 -42
  59. package/dist/redaction.js +2 -7
  60. package/dist/run-OyWmIDqu.d.ts +41 -0
  61. package/dist/run-ZsIKPA6J.js +17 -0
  62. package/dist/run-group-BACLbCFl.js +410 -0
  63. package/dist/run.d.ts +3 -126
  64. package/dist/run.js +5 -40
  65. package/dist/sdk-hooks.d.ts +2 -285
  66. package/dist/sdk-hooks.js +3 -36
  67. package/dist/stores.d.ts +13 -14
  68. package/dist/stores.js +34 -76
  69. package/dist/table-Bss73DhB.js +146 -0
  70. package/dist/tabs-BVHR6NkO.js +40 -0
  71. package/dist/text-shimmer-BUUo6I-g.js +64 -0
  72. package/dist/tool-call-feed-BeB1_4pX.d.ts +47 -0
  73. package/dist/tool-call-feed-Djt2q11V.js +109 -0
  74. package/dist/tool-call-step-DNebqhmX.js +434 -0
  75. package/dist/tool-display-BAuAVa43.js +158 -0
  76. package/dist/{tool-display-z4JcDmMQ.d.ts → tool-display-DgmL5rIU.d.ts} +16 -16
  77. package/dist/tool-previews.d.ts +2 -48
  78. package/dist/tool-previews.js +2 -23
  79. package/dist/types.d.ts +6 -19
  80. package/dist/types.js +0 -1
  81. package/dist/use-auto-scroll-C5Pjeqon.js +153 -0
  82. package/dist/use-sse-stream-BVgO1QBN.js +884 -0
  83. package/dist/use-sse-stream-Dm6R5YWz.d.ts +282 -0
  84. package/dist/utils-Bl_CZ0Qp.js +37 -0
  85. package/dist/{chunk-RQHJBTEU.js → utils-C_uf36nf.js} +4 -6
  86. package/dist/utils.d.ts +2 -104
  87. package/dist/utils.js +6 -44
  88. package/package.json +39 -41
  89. package/src/lib/focus.ts +2 -1
  90. package/dist/artifact-pane-DpuWcAiF.d.ts +0 -33
  91. package/dist/button-CMQuQEW_.d.ts +0 -17
  92. package/dist/chunk-34A66VBG.js +0 -214
  93. package/dist/chunk-3OI2QKFD.js +0 -0
  94. package/dist/chunk-3XXBZL53.js +0 -174
  95. package/dist/chunk-42PAH5D2.js +0 -112
  96. package/dist/chunk-4CLN43XT.js +0 -45
  97. package/dist/chunk-55WHV7SS.js +0 -1604
  98. package/dist/chunk-565EATZZ.js +0 -156
  99. package/dist/chunk-5Z5ZYMOJ.js +0 -0
  100. package/dist/chunk-6BGQA4BQ.js +0 -0
  101. package/dist/chunk-BEBXZPHW.js +0 -299
  102. package/dist/chunk-C5WF4WMV.js +0 -734
  103. package/dist/chunk-HFL6R6IF.js +0 -37
  104. package/dist/chunk-HGML45QH.js +0 -104
  105. package/dist/chunk-HMAPIH7L.js +0 -595
  106. package/dist/chunk-K5XFRUS4.js +0 -1401
  107. package/dist/chunk-KFQGHD73.js +0 -198
  108. package/dist/chunk-L57WRIND.js +0 -59
  109. package/dist/chunk-LTEKI7YJ.js +0 -59
  110. package/dist/chunk-M3QZK62R.js +0 -233
  111. package/dist/chunk-ND3ZFXQK.js +0 -179
  112. package/dist/chunk-OEX7NZE3.js +0 -321
  113. package/dist/chunk-OL5GYLHV.js +0 -60
  114. package/dist/chunk-QGFYBNSO.js +0 -133
  115. package/dist/chunk-R7B3UWPF.js +0 -550
  116. package/dist/chunk-R7SUY4E3.js +0 -65
  117. package/dist/chunk-REJESC5U.js +0 -117
  118. package/dist/chunk-RQGKSCEZ.js +0 -0
  119. package/dist/chunk-SNLR2AEA.js +0 -40
  120. package/dist/chunk-WKWBTL2V.js +0 -15
  121. package/dist/chunk-X7CU776B.js +0 -1048
  122. package/dist/chunk-XU3HB5QL.js +0 -127
  123. package/dist/chunk-YTO5V6QS.js +0 -19
  124. package/dist/chunk-YU4E5J2N.js +0 -437
  125. package/dist/chunk-YZ6AK25N.js +0 -886
  126. package/dist/code-block-0kSpWMnf.d.ts +0 -25
  127. package/dist/document-editor-pane-IAEQn_Dl.d.ts +0 -128
  128. package/dist/document-editor-pane-QHDOBA43.js +0 -13
  129. package/dist/message-BHWbxBtT.d.ts +0 -15
  130. package/dist/parts-dj7AcUg0.d.ts +0 -36
  131. package/dist/run-PfLmDAox.d.ts +0 -41
  132. package/dist/tool-call-feed-D9iofJgW.d.ts +0 -46
@@ -1,179 +0,0 @@
1
- // src/utils/tool-display.ts
2
- var TOOL_NAME_PREFIX = "tool:";
3
- function normalizeToolName(tool) {
4
- const n = tool?.toLowerCase() ?? "";
5
- return n.startsWith(TOOL_NAME_PREFIX) ? n.slice(TOOL_NAME_PREFIX.length) : n;
6
- }
7
- function extractString(obj, key) {
8
- if (typeof obj === "object" && obj !== null && key in obj) {
9
- const val = obj[key];
10
- if (typeof val === "string") return val;
11
- }
12
- return void 0;
13
- }
14
- function extractCommand(input) {
15
- if (typeof input === "string") return input;
16
- return extractString(input, "command") ?? extractString(input, "cmd");
17
- }
18
- function extractFilePath(input) {
19
- return extractString(input, "file_path") ?? extractString(input, "path") ?? extractString(input, "filePath") ?? extractString(input, "file");
20
- }
21
- var TOOL_CATEGORY_ICONS = {
22
- command: "terminal",
23
- write: "file-plus",
24
- read: "file-text",
25
- search: "search",
26
- edit: "file-edit",
27
- task: "cpu",
28
- web: "globe",
29
- todo: "check-square",
30
- other: "box"
31
- };
32
- function getToolCategory(toolName) {
33
- const name = normalizeToolName(toolName);
34
- switch (name) {
35
- case "bash":
36
- case "shell":
37
- case "command":
38
- case "execute":
39
- return "command";
40
- case "write":
41
- case "write_file":
42
- case "create_file":
43
- return "write";
44
- case "read":
45
- case "read_file":
46
- case "cat":
47
- return "read";
48
- case "grep":
49
- case "search":
50
- case "rg":
51
- return "search";
52
- case "edit":
53
- case "patch":
54
- case "sed":
55
- return "edit";
56
- case "glob":
57
- case "find":
58
- case "ls":
59
- return "search";
60
- case "web_search":
61
- case "web_fetch":
62
- case "fetch":
63
- return "web";
64
- case "task":
65
- case "agent":
66
- case "spawn":
67
- return "task";
68
- case "todo":
69
- case "todo_write":
70
- return "todo";
71
- default:
72
- return "other";
73
- }
74
- }
75
- function getToolDisplayMetadata(part) {
76
- const name = normalizeToolName(part.tool);
77
- const input = part.state.status !== "pending" ? part.state.input : void 0;
78
- const filePath = extractFilePath(input);
79
- const command = extractCommand(input);
80
- switch (name) {
81
- case "bash":
82
- case "shell":
83
- case "command":
84
- case "execute":
85
- return {
86
- title: "Shell",
87
- description: command ? truncateCommand(command) : void 0,
88
- displayVariant: "command",
89
- commandSnippet: command
90
- };
91
- case "write":
92
- case "write_file":
93
- case "create_file":
94
- return {
95
- title: "Write",
96
- description: filePath,
97
- displayVariant: "write-file",
98
- targetPath: filePath
99
- };
100
- case "edit":
101
- case "patch":
102
- return {
103
- title: "Edit",
104
- description: filePath,
105
- hasDiffOutput: true,
106
- diffFilePath: filePath,
107
- displayVariant: "diff",
108
- targetPath: filePath
109
- };
110
- case "read":
111
- case "read_file":
112
- case "cat":
113
- return {
114
- title: "Read",
115
- description: filePath,
116
- displayVariant: "read-file",
117
- targetPath: filePath
118
- };
119
- case "grep":
120
- case "search":
121
- case "rg": {
122
- const pattern = extractString(input, "pattern");
123
- return {
124
- title: "Search",
125
- description: pattern,
126
- displayVariant: "grep"
127
- };
128
- }
129
- case "glob":
130
- case "find":
131
- case "ls": {
132
- const pattern = extractString(input, "pattern");
133
- return {
134
- title: "Find",
135
- description: pattern,
136
- displayVariant: "glob"
137
- };
138
- }
139
- case "web_search":
140
- case "web_fetch":
141
- case "fetch": {
142
- const query = extractString(input, "query") ?? extractString(input, "url");
143
- return {
144
- title: name === "web_search" ? "Web search" : "Fetch",
145
- description: query ? truncateCommand(query) : void 0,
146
- displayVariant: "web-search"
147
- };
148
- }
149
- case "task":
150
- case "agent":
151
- case "spawn": {
152
- const desc = extractString(input, "description") ?? extractString(input, "prompt");
153
- return {
154
- title: "Task",
155
- description: desc ? truncateCommand(desc) : void 0
156
- };
157
- }
158
- default:
159
- return {
160
- title: part.tool || "Tool",
161
- description: command ?? filePath ?? extractString(input, "pattern") ?? extractString(input, "query")
162
- };
163
- }
164
- }
165
- function truncateCommand(cmd) {
166
- const first = cmd.split("\n")[0];
167
- return first.length > 60 ? first.slice(0, 57) + "..." : first;
168
- }
169
- function getToolErrorText(part, fallback) {
170
- if (part.state.status !== "error") return void 0;
171
- return part.state.error || fallback;
172
- }
173
-
174
- export {
175
- TOOL_CATEGORY_ICONS,
176
- getToolCategory,
177
- getToolDisplayMetadata,
178
- getToolErrorText
179
- };
@@ -1,321 +0,0 @@
1
- // src/stores/active-sessions-store.ts
2
- import { useStore } from "@nanostores/react";
3
- import { atom } from "nanostores";
4
- import { useMemo } from "react";
5
- var INITIAL_STATE = {
6
- sessions: {},
7
- lastUpdatedAt: 0
8
- };
9
- var STATUS_PRIORITY = {
10
- running: 0,
11
- error: 1,
12
- "attention-needed": 2,
13
- idle: 3
14
- };
15
- var DEFAULT_RECORD = {
16
- status: "idle",
17
- isRunning: false,
18
- isForeground: false,
19
- needsAttention: false,
20
- connectionState: "disconnected",
21
- reconnectState: "idle",
22
- transportMode: null,
23
- lastError: null,
24
- lastEventAt: null
25
- };
26
- var activeSessionsAtom = atom(INITIAL_STATE);
27
- var foregroundSessionId = null;
28
- function createRecord(options, now) {
29
- return {
30
- sessionId: options.sessionId,
31
- projectId: options.projectId ?? null,
32
- projectLabel: options.projectLabel,
33
- title: options.title,
34
- href: options.href,
35
- registeredAt: now,
36
- lastActivityAt: now,
37
- metadata: options.metadata,
38
- ...DEFAULT_RECORD,
39
- isForeground: options.sessionId === foregroundSessionId
40
- };
41
- }
42
- function resolveStatus(session) {
43
- if (session.isRunning) return "running";
44
- if (session.lastError || session.reconnectState === "failed") return "error";
45
- if (session.needsAttention) return "attention-needed";
46
- return "idle";
47
- }
48
- function normalizeSession(session) {
49
- return {
50
- ...session,
51
- status: resolveStatus(session)
52
- };
53
- }
54
- function updateSession(sessionId, updater) {
55
- const current = activeSessionsAtom.get();
56
- const existing = current.sessions[sessionId];
57
- if (!existing) return;
58
- const now = Date.now();
59
- activeSessionsAtom.set({
60
- sessions: {
61
- ...current.sessions,
62
- [sessionId]: normalizeSession(updater(existing, now))
63
- },
64
- lastUpdatedAt: now
65
- });
66
- }
67
- function registerActiveSession(options) {
68
- const now = Date.now();
69
- const current = activeSessionsAtom.get();
70
- const existing = current.sessions[options.sessionId];
71
- activeSessionsAtom.set({
72
- sessions: {
73
- ...current.sessions,
74
- [options.sessionId]: normalizeSession(
75
- existing ? {
76
- ...existing,
77
- projectId: existing.projectId ?? options.projectId ?? null,
78
- projectLabel: options.projectLabel ?? existing.projectLabel,
79
- title: options.title ?? existing.title,
80
- href: options.href ?? existing.href,
81
- metadata: options.metadata ?? existing.metadata,
82
- lastActivityAt: now,
83
- isForeground: options.sessionId === foregroundSessionId || existing.isForeground
84
- } : createRecord(options, now)
85
- )
86
- },
87
- lastUpdatedAt: now
88
- });
89
- }
90
- function unregisterActiveSession(sessionId) {
91
- const current = activeSessionsAtom.get();
92
- if (!current.sessions[sessionId]) return;
93
- const { [sessionId]: _removed, ...remaining } = current.sessions;
94
- if (foregroundSessionId === sessionId) {
95
- foregroundSessionId = null;
96
- }
97
- activeSessionsAtom.set({
98
- sessions: remaining,
99
- lastUpdatedAt: Date.now()
100
- });
101
- }
102
- function setForegroundActiveSession(sessionId) {
103
- foregroundSessionId = sessionId;
104
- const current = activeSessionsAtom.get();
105
- const now = Date.now();
106
- let changed = false;
107
- const sessions = Object.fromEntries(
108
- Object.entries(current.sessions).map(([id, session]) => {
109
- const isForeground = id === sessionId;
110
- if (session.isForeground !== isForeground) {
111
- changed = true;
112
- }
113
- return [
114
- id,
115
- {
116
- ...session,
117
- isForeground,
118
- lastActivityAt: isForeground ? now : session.lastActivityAt
119
- }
120
- ];
121
- })
122
- );
123
- if (!changed) return;
124
- activeSessionsAtom.set({
125
- sessions,
126
- lastUpdatedAt: now
127
- });
128
- }
129
- function updateActiveSessionMeta(sessionId, meta) {
130
- updateSession(sessionId, (session, now) => ({
131
- ...session,
132
- ...meta,
133
- lastActivityAt: now
134
- }));
135
- }
136
- function setActiveSessionConnection(sessionId, options) {
137
- updateSession(sessionId, (session, now) => ({
138
- ...session,
139
- connectionState: options.connectionState,
140
- reconnectState: options.reconnectState ?? session.reconnectState,
141
- transportMode: options.transportMode ?? session.transportMode,
142
- lastError: options.lastError === void 0 ? session.lastError : options.lastError,
143
- lastEventAt: options.lastEventAt ?? session.lastEventAt,
144
- lastActivityAt: now
145
- }));
146
- }
147
- function setActiveSessionRunning(sessionId, isRunning, options) {
148
- updateSession(sessionId, (session, now) => ({
149
- ...session,
150
- isRunning,
151
- needsAttention: isRunning ? false : session.needsAttention,
152
- lastError: isRunning ? null : session.lastError,
153
- lastEventAt: options?.lastEventAt ?? session.lastEventAt,
154
- lastActivityAt: now
155
- }));
156
- }
157
- function setActiveSessionAttention(sessionId, needsAttention, options) {
158
- updateSession(sessionId, (session, now) => ({
159
- ...session,
160
- needsAttention,
161
- isRunning: needsAttention ? false : session.isRunning,
162
- lastEventAt: options?.lastEventAt ?? session.lastEventAt,
163
- lastActivityAt: now
164
- }));
165
- }
166
- function setActiveSessionError(sessionId, error) {
167
- updateSession(sessionId, (session, now) => ({
168
- ...session,
169
- isRunning: false,
170
- needsAttention: false,
171
- lastError: error,
172
- reconnectState: error ? "failed" : "idle",
173
- connectionState: error ? "error" : session.connectionState,
174
- lastEventAt: now,
175
- lastActivityAt: now
176
- }));
177
- }
178
- function bumpActiveSessionActivity(sessionId, options) {
179
- updateSession(sessionId, (session, now) => ({
180
- ...session,
181
- lastEventAt: options?.lastEventAt ?? session.lastEventAt ?? now,
182
- lastActivityAt: now
183
- }));
184
- }
185
- function resetActiveSessions() {
186
- foregroundSessionId = null;
187
- activeSessionsAtom.set(INITIAL_STATE);
188
- }
189
- function getAllActiveSessions(state) {
190
- return Object.values(state.sessions);
191
- }
192
- function getActiveSession(state, sessionId) {
193
- return state.sessions[sessionId] ?? null;
194
- }
195
- function getSessionsForProject(state, projectId) {
196
- return Object.values(state.sessions).filter((session) => session.projectId === projectId);
197
- }
198
- function getSessionsForNavbar(state, projectId) {
199
- const sessions = projectId == null ? Object.values(state.sessions) : getSessionsForProject(state, projectId);
200
- return [...sessions].sort((left, right) => {
201
- if (left.isForeground !== right.isForeground) {
202
- return Number(right.isForeground) - Number(left.isForeground);
203
- }
204
- const statusDiff = STATUS_PRIORITY[left.status] - STATUS_PRIORITY[right.status];
205
- if (statusDiff !== 0) {
206
- return statusDiff;
207
- }
208
- return right.lastActivityAt - left.lastActivityAt;
209
- });
210
- }
211
- function getSessionsByActivity(state) {
212
- return [...Object.values(state.sessions)].sort(
213
- (left, right) => right.lastActivityAt - left.lastActivityAt
214
- );
215
- }
216
- function getTotalRunningSessionCount(state) {
217
- return Object.values(state.sessions).filter((session) => session.isRunning).length;
218
- }
219
- function hasBackgroundRunningSessions(state) {
220
- return Object.values(state.sessions).some(
221
- (session) => session.isRunning && !session.isForeground
222
- );
223
- }
224
- function getAllProjectActivity(state) {
225
- const grouped = /* @__PURE__ */ new Map();
226
- for (const session of Object.values(state.sessions)) {
227
- if (session.projectId == null) continue;
228
- const existing = grouped.get(session.projectId);
229
- if (existing) {
230
- existing.activeSessionCount += 1;
231
- existing.lastActivityAt = Math.max(existing.lastActivityAt, session.lastActivityAt);
232
- if (session.isRunning) {
233
- existing.runningSessionIds.push(session.sessionId);
234
- }
235
- if (!existing.projectLabel && session.projectLabel) {
236
- existing.projectLabel = session.projectLabel;
237
- }
238
- continue;
239
- }
240
- grouped.set(session.projectId, {
241
- projectId: session.projectId,
242
- projectLabel: session.projectLabel,
243
- activeSessionCount: 1,
244
- runningSessionIds: session.isRunning ? [session.sessionId] : [],
245
- lastActivityAt: session.lastActivityAt
246
- });
247
- }
248
- return [...grouped.values()].sort((left, right) => right.lastActivityAt - left.lastActivityAt);
249
- }
250
- function useActiveSessionsState() {
251
- return useStore(activeSessionsAtom);
252
- }
253
- function useActiveSessions() {
254
- const state = useStore(activeSessionsAtom);
255
- return useMemo(() => getAllActiveSessions(state), [state]);
256
- }
257
- function useActiveSession(sessionId) {
258
- const state = useStore(activeSessionsAtom);
259
- return useMemo(
260
- () => sessionId ? getActiveSession(state, sessionId) : null,
261
- [sessionId, state]
262
- );
263
- }
264
- function useProjectSessions(projectId) {
265
- const state = useStore(activeSessionsAtom);
266
- return useMemo(
267
- () => projectId == null ? [] : getSessionsForProject(state, projectId),
268
- [projectId, state]
269
- );
270
- }
271
- function useNavbarSessions(projectId) {
272
- const state = useStore(activeSessionsAtom);
273
- return useMemo(() => getSessionsForNavbar(state, projectId), [projectId, state]);
274
- }
275
- function useSessionsByActivity() {
276
- const state = useStore(activeSessionsAtom);
277
- return useMemo(() => getSessionsByActivity(state), [state]);
278
- }
279
- function useProjectActivity() {
280
- const state = useStore(activeSessionsAtom);
281
- return useMemo(() => getAllProjectActivity(state), [state]);
282
- }
283
- function useTotalRunningSessions() {
284
- const state = useStore(activeSessionsAtom);
285
- return useMemo(() => getTotalRunningSessionCount(state), [state]);
286
- }
287
- function useHasBackgroundRunningSessions() {
288
- const state = useStore(activeSessionsAtom);
289
- return useMemo(() => hasBackgroundRunningSessions(state), [state]);
290
- }
291
-
292
- export {
293
- activeSessionsAtom,
294
- registerActiveSession,
295
- unregisterActiveSession,
296
- setForegroundActiveSession,
297
- updateActiveSessionMeta,
298
- setActiveSessionConnection,
299
- setActiveSessionRunning,
300
- setActiveSessionAttention,
301
- setActiveSessionError,
302
- bumpActiveSessionActivity,
303
- resetActiveSessions,
304
- getAllActiveSessions,
305
- getActiveSession,
306
- getSessionsForProject,
307
- getSessionsForNavbar,
308
- getSessionsByActivity,
309
- getTotalRunningSessionCount,
310
- hasBackgroundRunningSessions,
311
- getAllProjectActivity,
312
- useActiveSessionsState,
313
- useActiveSessions,
314
- useActiveSession,
315
- useProjectSessions,
316
- useNavbarSessions,
317
- useSessionsByActivity,
318
- useProjectActivity,
319
- useTotalRunningSessions,
320
- useHasBackgroundRunningSessions
321
- };
@@ -1,60 +0,0 @@
1
- import {
2
- CodeBlock,
3
- CopyButton
4
- } from "./chunk-3XXBZL53.js";
5
- import {
6
- cn
7
- } from "./chunk-RQHJBTEU.js";
8
-
9
- // src/markdown/markdown.tsx
10
- import { memo } from "react";
11
- import ReactMarkdown from "react-markdown";
12
- import remarkGfm from "remark-gfm";
13
- import rehypeSanitize from "rehype-sanitize";
14
- import { Fragment, jsx } from "react/jsx-runtime";
15
- var Markdown = memo(({ children, className, urlTransform }) => {
16
- return /* @__PURE__ */ jsx(
17
- "div",
18
- {
19
- className: cn("tangle-prose max-w-none text-sm", className),
20
- children: /* @__PURE__ */ jsx(
21
- ReactMarkdown,
22
- {
23
- remarkPlugins: [remarkGfm],
24
- rehypePlugins: [rehypeSanitize],
25
- urlTransform,
26
- components: {
27
- pre({ children: preChildren }) {
28
- return /* @__PURE__ */ jsx(Fragment, { children: preChildren });
29
- },
30
- code({ className: codeClass, children: codeChildren, ...rest }) {
31
- const match = /language-(\w+)/.exec(codeClass || "");
32
- const language = match?.[1];
33
- const code = String(codeChildren).replace(/\n$/, "");
34
- if (!language && !code.includes("\n")) {
35
- return /* @__PURE__ */ jsx(
36
- "code",
37
- {
38
- className: cn(
39
- "px-1.5 py-0.5 rounded border border-border bg-card text-[var(--code-keyword)] text-[0.85em] font-mono",
40
- codeClass
41
- ),
42
- ...rest,
43
- children: codeChildren
44
- }
45
- );
46
- }
47
- return /* @__PURE__ */ jsx(CodeBlock, { code, language, children: /* @__PURE__ */ jsx(CopyButton, { text: code }) });
48
- }
49
- },
50
- children
51
- }
52
- )
53
- }
54
- );
55
- });
56
- Markdown.displayName = "Markdown";
57
-
58
- export {
59
- Markdown
60
- };
@@ -1,133 +0,0 @@
1
- import {
2
- ToolCallGroup,
3
- ToolCallStep
4
- } from "./chunk-R7B3UWPF.js";
5
- import {
6
- Markdown
7
- } from "./chunk-OL5GYLHV.js";
8
- import {
9
- cn
10
- } from "./chunk-RQHJBTEU.js";
11
-
12
- // src/run/tool-call-feed.tsx
13
- import { jsx } from "react/jsx-runtime";
14
- function ToolCallFeed({ segments, className }) {
15
- if (segments.length === 0) return null;
16
- return /* @__PURE__ */ jsx("div", { className: cn("space-y-1", className), children: segments.map((segment, i) => {
17
- if (segment.kind === "text") {
18
- return segment.content.trim() ? /* @__PURE__ */ jsx(Markdown, { children: segment.content }, i) : null;
19
- }
20
- if (segment.kind === "tool_call") {
21
- return /* @__PURE__ */ jsx(
22
- ToolCallStep,
23
- {
24
- type: segment.call.type,
25
- label: segment.call.label,
26
- status: segment.call.status,
27
- detail: segment.call.detail,
28
- output: segment.call.output,
29
- duration: segment.call.duration
30
- },
31
- segment.call.id || i
32
- );
33
- }
34
- if (segment.kind === "tool_group") {
35
- return /* @__PURE__ */ jsx(ToolCallGroup, { title: segment.title, children: segment.calls.map((call) => /* @__PURE__ */ jsx(
36
- ToolCallStep,
37
- {
38
- type: call.type,
39
- label: call.label,
40
- status: call.status,
41
- detail: call.detail,
42
- output: call.output,
43
- duration: call.duration
44
- },
45
- call.id
46
- )) }, i);
47
- }
48
- return null;
49
- }) });
50
- }
51
- function parseToolEvent(event) {
52
- const { type, data } = event;
53
- if (type === "tool.invocation" || type === "tool_use") {
54
- const toolName = data.name || data.tool || "unknown";
55
- const input = data.input;
56
- return {
57
- id: data.id || data.toolUseId || createId(),
58
- type: mapToolName(toolName),
59
- label: formatToolLabel(toolName, input),
60
- status: "running",
61
- detail: input ? formatToolInput(toolName, input) : void 0
62
- };
63
- }
64
- if (type === "tool.result" || type === "tool_result") {
65
- return {
66
- id: data.id || data.toolUseId || "",
67
- type: mapToolName(data.name || data.tool || "unknown"),
68
- label: formatToolLabel(data.name || data.tool || "unknown"),
69
- status: data.error ? "error" : "success",
70
- output: truncate(data.output || data.result || "", 500),
71
- duration: data.duration
72
- };
73
- }
74
- return null;
75
- }
76
- function createId() {
77
- if (typeof globalThis.crypto !== "undefined" && typeof globalThis.crypto.randomUUID === "function") {
78
- try {
79
- return globalThis.crypto.randomUUID();
80
- } catch {
81
- }
82
- }
83
- return `tool_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
84
- }
85
- function mapToolName(name) {
86
- const lower = name.toLowerCase();
87
- if (lower.includes("bash") || lower.includes("terminal") || lower.includes("exec")) return "bash";
88
- if (lower.includes("read") || lower.includes("cat")) return "read";
89
- if (lower.includes("write") || lower.includes("create")) return "write";
90
- if (lower.includes("edit") || lower.includes("replace")) return "edit";
91
- if (lower.includes("glob") || lower.includes("find")) return "glob";
92
- if (lower.includes("grep") || lower.includes("search")) return "grep";
93
- if (lower.includes("list") || lower.includes("ls")) return "list";
94
- if (lower.includes("inspect")) return "inspect";
95
- if (lower.includes("audit")) return "audit";
96
- return "unknown";
97
- }
98
- function formatToolLabel(toolName, input) {
99
- const lower = toolName.toLowerCase();
100
- if (lower.includes("bash") && input?.command) {
101
- const cmd = String(input.command);
102
- return cmd.length > 80 ? `${cmd.slice(0, 77)}...` : cmd;
103
- }
104
- if ((lower.includes("read") || lower.includes("cat")) && input?.path) {
105
- return `Read ${input.path}`;
106
- }
107
- if (lower.includes("write") && input?.path) {
108
- return `Write ${input.path}`;
109
- }
110
- if (lower.includes("edit") && input?.path) {
111
- return `Edit ${input.path}`;
112
- }
113
- if (lower.includes("glob") && input?.pattern) {
114
- return `Find ${input.pattern}`;
115
- }
116
- if (lower.includes("grep") && input?.pattern) {
117
- return `Search for ${input.pattern}`;
118
- }
119
- return toolName;
120
- }
121
- function formatToolInput(toolName, input) {
122
- if (input.command) return String(input.command);
123
- if (input.path) return String(input.path);
124
- return JSON.stringify(input, null, 2).slice(0, 300);
125
- }
126
- function truncate(text, max) {
127
- return text.length > max ? text.slice(0, max - 3) + "..." : text;
128
- }
129
-
130
- export {
131
- ToolCallFeed,
132
- parseToolEvent
133
- };