@tangle-network/sandbox-ui 1.1.5 → 1.1.6
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.
|
@@ -53,8 +53,10 @@ interface AgentStreamRow {
|
|
|
53
53
|
stream?: string;
|
|
54
54
|
attempt?: number;
|
|
55
55
|
event: {
|
|
56
|
-
kind: "text" | "reasoning" | "tool-call" | "tool-result" | "user" | (string & {});
|
|
56
|
+
kind: "text" | "reasoning" | "tool-call" | "tool-result" | "user" | "notice" | (string & {});
|
|
57
57
|
text?: string;
|
|
58
|
+
/** A notice's origin: the agent's `delegated-input`, its `recorded-result`, or a capture fact such as `capture-unavailable`. */
|
|
59
|
+
provenance?: string;
|
|
58
60
|
toolCallId?: string;
|
|
59
61
|
toolName?: string;
|
|
60
62
|
args?: unknown;
|
|
@@ -68,6 +70,7 @@ type AgentTranscriptEntry = {
|
|
|
68
70
|
kind: "message";
|
|
69
71
|
role: "assistant" | "user";
|
|
70
72
|
content: string;
|
|
73
|
+
sealed?: true;
|
|
71
74
|
} | {
|
|
72
75
|
id: string;
|
|
73
76
|
at: number;
|
|
@@ -78,6 +81,11 @@ type AgentTranscriptEntry = {
|
|
|
78
81
|
at: number;
|
|
79
82
|
kind: "tool";
|
|
80
83
|
call: ToolCallData;
|
|
84
|
+
} | {
|
|
85
|
+
id: string;
|
|
86
|
+
at: number;
|
|
87
|
+
kind: "notice";
|
|
88
|
+
text: string;
|
|
81
89
|
};
|
|
82
90
|
interface AgentStreamState {
|
|
83
91
|
generation?: string | number;
|
|
@@ -85,6 +93,7 @@ interface AgentStreamState {
|
|
|
85
93
|
lastSeq: number;
|
|
86
94
|
/** The agent is still producing output. */
|
|
87
95
|
alive: boolean;
|
|
96
|
+
/** Why the stream shows nothing new; a reconnect that delivers rows clears it. */
|
|
88
97
|
error?: string;
|
|
89
98
|
}
|
|
90
99
|
/** Fold stream rows into transcript entries: text of one turn merges, a tool call becomes a row its result completes. */
|
package/dist/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ import { C as ChangedFile, D as SandboxArtifactTerminal, E as SandboxArtifactPan
|
|
|
16
16
|
import { n as DiffViewProps, t as DiffView } from "./diff-view-DDHWtR6X.js";
|
|
17
17
|
import { a as PreviewReadiness, i as PreviewAccess, n as EmbeddedAppView, r as EmbeddedAppViewProps, t as EmbeddedApp } from "./embedded-app-view-Ta5GI4hx.js";
|
|
18
18
|
import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIAction, OpenUIActionsNode, OpenUIArtifactRenderer, OpenUIArtifactRendererProps, OpenUIBadgeNode, OpenUICardNode, OpenUICodeNode, OpenUIComponentNode, OpenUIGridNode, OpenUIHeadingNode, OpenUIKeyValueNode, OpenUIMarkdownNode, OpenUIPrimitive, OpenUISchemaIssue, OpenUISchemaValidation, OpenUISeparatorNode, OpenUIStackNode, OpenUIStatNode, OpenUITableNode, OpenUITextNode, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode } from "./openui.js";
|
|
19
|
-
import { A as ToolCallType, B as TraceEvent, C as TaskListItem, D as ToolCallFeed, E as ToolCallData, F as AgentStreamRow, G as traceSpanMark, H as TraceWorkspaceProps, I as AgentStreamState, L as AgentTranscriptEntry, M as showsTaskPriority, N as taskProgress, O as ToolCallFeedProps, P as taskStatus, R as foldAgentRows, S as TaskList, T as TaskStatus, U as TraceWaterfall, V as TraceWorkspace, W as TraceWaterfallProps, _ as RunPhaseList, a as ApprovalPlanStep, b as RunRowStatus, c as FeedSegment, d as InlineToolItem, f as InlineToolItemProps, g as RunPhase, h as RunGroupProps, i as ApprovalDiffSummary, j as parseToolEvent, k as ToolCallStatus, l as InlineThinkingItem, m as RunGroup, n as ApprovalCardProps, o as ExpandedToolDetail, p as LiveDuration, r as ApprovalDiffFile, s as ExpandedToolDetailProps, t as ApprovalCard, u as InlineThinkingItemProps, v as RunRowShell, w as TaskListProps, x as RunRowStatusDot, y as RunRowShellProps, z as useAgentStream } from "./index-
|
|
19
|
+
import { A as ToolCallType, B as TraceEvent, C as TaskListItem, D as ToolCallFeed, E as ToolCallData, F as AgentStreamRow, G as traceSpanMark, H as TraceWorkspaceProps, I as AgentStreamState, L as AgentTranscriptEntry, M as showsTaskPriority, N as taskProgress, O as ToolCallFeedProps, P as taskStatus, R as foldAgentRows, S as TaskList, T as TaskStatus, U as TraceWaterfall, V as TraceWorkspace, W as TraceWaterfallProps, _ as RunPhaseList, a as ApprovalPlanStep, b as RunRowStatus, c as FeedSegment, d as InlineToolItem, f as InlineToolItemProps, g as RunPhase, h as RunGroupProps, i as ApprovalDiffSummary, j as parseToolEvent, k as ToolCallStatus, l as InlineThinkingItem, m as RunGroup, n as ApprovalCardProps, o as ExpandedToolDetail, p as LiveDuration, r as ApprovalDiffFile, s as ExpandedToolDetailProps, t as ApprovalCard, u as InlineThinkingItemProps, v as RunRowShell, w as TaskListProps, x as RunRowStatusDot, y as RunRowShellProps, z as useAgentStream } from "./index-72uBu5lu.js";
|
|
20
20
|
import { n as filterFileNodes, t as fileTreeFromPaths } from "./index-CrN4d8gd.js";
|
|
21
21
|
import { ActiveProjectActivity, ActiveSessionActivityOptions, ActiveSessionConnectionOptions, ActiveSessionConnectionState, ActiveSessionReconnectState, ActiveSessionRecord, ActiveSessionStatus, ActiveSessionTransportMode, ActiveSessionsState, ChatSession, RegisterActiveSessionOptions, SessionProjectKey, activeSessionsAtom, addMessage, addParts, bumpActiveSessionActivity, clearChat, connectSession, disconnectSession, getActiveSession, getAllActiveSessions, getAllProjectActivity, getSessionsByActivity, getSessionsForNavbar, getSessionsForProject, getTotalRunningSessionCount, hasBackgroundRunningSessions, isStreamingAtom, messagesAtom, partMapAtom, registerActiveSession, resetActiveSessions, sessionAtom, setActiveSessionAttention, setActiveSessionConnection, setActiveSessionError, setActiveSessionRunning, setForegroundActiveSession, unregisterActiveSession, updateActiveSessionMeta, updatePart, useActiveSession, useActiveSessions, useActiveSessionsState, useHasBackgroundRunningSessions, useNavbarSessions, useProjectActivity, useProjectSessions, useSessionsByActivity, useTotalRunningSessions } from "./stores.js";
|
|
22
22
|
import { AgentBranding, CustomToolRenderer, DisplayVariant, FinalTextPart, GroupedMessage, MessageRun, MessageUser, ReasoningPart, Run, RunStats, SessionMessage, SessionPart, TextPart, ToolCategory, ToolDisplayMetadata, ToolPart, ToolState, ToolStatus, ToolTime } from "./types.js";
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,7 @@ import { a as CodeSurface, i as CODE_THEME, n as buildUnifiedPatch, r as compute
|
|
|
13
13
|
import { n as PreviewView, t as EmbeddedAppView } from "./embedded-app-view-DXsoPale.js";
|
|
14
14
|
import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, OpenUIArtifactRenderer, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode } from "./openui.js";
|
|
15
15
|
import { a as MessageList, c as UserMessage, d as modelProvider, f as snapHarnessToModel, g as ReasoningLevelPicker, h as HARNESS_REASONING_OPTIONS, i as MessageAuthor, l as isViewerMessage, m as DEFAULT_REASONING_LEVEL_OPTIONS, n as ChatContainer, o as TRANSCRIPT_TEXT, p as AgentProfilePicker, r as ChatMessage, s as ThinkingIndicator, t as AgentTimeline, u as ArtifactAgentDock } from "./chat-4OZD23RA.js";
|
|
16
|
-
import { _ as TraceWorkspace, a as InlineToolItem, b as TraceWaterfall, c as RunPhaseList, d as TaskList, f as ToolCallFeed, g as taskStatus, h as taskProgress, i as InlineThinkingItem, l as RunRowShell, m as showsTaskPriority, n as ApprovalDiffSummary, o as LiveDuration, p as parseToolEvent, r as ExpandedToolDetail, s as RunGroup, t as ApprovalCard, u as RunRowStatusDot, v as foldAgentRows, x as traceSpanMark, y as useAgentStream } from "./run-
|
|
16
|
+
import { _ as TraceWorkspace, a as InlineToolItem, b as TraceWaterfall, c as RunPhaseList, d as TaskList, f as ToolCallFeed, g as taskStatus, h as taskProgress, i as InlineThinkingItem, l as RunRowShell, m as showsTaskPriority, n as ApprovalDiffSummary, o as LiveDuration, p as parseToolEvent, r as ExpandedToolDetail, s as RunGroup, t as ApprovalCard, u as RunRowStatusDot, v as foldAgentRows, x as traceSpanMark, y as useAgentStream } from "./run-DHx4RUm2.js";
|
|
17
17
|
import "./vault-tree.js";
|
|
18
18
|
import { a as TangleLoginButton, i as UserMenu, n as GitHubLoginButton, r as LoginLayout, t as AuthHeader } from "./auth-BDpoZ_2f.js";
|
|
19
19
|
import { t as AgentMessagingConnection } from "./connections-DymjzHe_.js";
|
|
@@ -60,6 +60,14 @@ const brief = (value, max = 240) => {
|
|
|
60
60
|
return text.length > max ? `${text.slice(0, max - 1)}…` : text;
|
|
61
61
|
};
|
|
62
62
|
const failed = (result) => typeof result === "object" && result !== null && ("error" in result || result.is_error === true);
|
|
63
|
+
const recorded = (text) => {
|
|
64
|
+
try {
|
|
65
|
+
const value = JSON.parse(text);
|
|
66
|
+
return typeof value === "object" && value !== null ? `\`\`\`json\n${text}\n\`\`\`` : text;
|
|
67
|
+
} catch {
|
|
68
|
+
return text;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
63
71
|
/** Fold stream rows into transcript entries: text of one turn merges, a tool call becomes a row its result completes. */
|
|
64
72
|
function foldAgentRows(entries, rows) {
|
|
65
73
|
const next = [...entries];
|
|
@@ -68,7 +76,7 @@ function foldAgentRows(entries, rows) {
|
|
|
68
76
|
const { event } = row;
|
|
69
77
|
const last = next[next.length - 1];
|
|
70
78
|
if (event.kind === "text" && event.text) {
|
|
71
|
-
if (last?.kind === "message" && last.role === "assistant") next[next.length - 1] = {
|
|
79
|
+
if (last?.kind === "message" && last.role === "assistant" && !last.sealed) next[next.length - 1] = {
|
|
72
80
|
...last,
|
|
73
81
|
content: last.content + event.text
|
|
74
82
|
};
|
|
@@ -86,7 +94,29 @@ function foldAgentRows(entries, rows) {
|
|
|
86
94
|
role: "user",
|
|
87
95
|
content: event.text
|
|
88
96
|
});
|
|
89
|
-
else if (event.kind === "
|
|
97
|
+
else if (event.kind === "notice" && event.text) {
|
|
98
|
+
if (event.provenance === "delegated-input") next.push({
|
|
99
|
+
id: `u-${row.seq}`,
|
|
100
|
+
at,
|
|
101
|
+
kind: "message",
|
|
102
|
+
role: "user",
|
|
103
|
+
content: recorded(event.text)
|
|
104
|
+
});
|
|
105
|
+
else if (event.provenance === "recorded-result") next.push({
|
|
106
|
+
id: `m-${row.seq}`,
|
|
107
|
+
at,
|
|
108
|
+
kind: "message",
|
|
109
|
+
role: "assistant",
|
|
110
|
+
content: recorded(event.text),
|
|
111
|
+
sealed: true
|
|
112
|
+
});
|
|
113
|
+
else next.push({
|
|
114
|
+
id: `n-${row.seq}`,
|
|
115
|
+
at,
|
|
116
|
+
kind: "notice",
|
|
117
|
+
text: event.text
|
|
118
|
+
});
|
|
119
|
+
} else if (event.kind === "reasoning" && event.text) {
|
|
90
120
|
if (last?.kind === "reasoning") next[next.length - 1] = {
|
|
91
121
|
...last,
|
|
92
122
|
text: last.text + event.text
|
|
@@ -145,17 +175,23 @@ function reduce(state, action) {
|
|
|
145
175
|
generation: action.generation ?? state.generation,
|
|
146
176
|
entries: foldAgentRows(base.entries, fresh),
|
|
147
177
|
lastSeq: fresh.reduce((max, row) => Math.max(max, row.seq), base.lastSeq),
|
|
148
|
-
alive: action.alive ?? state.alive
|
|
178
|
+
alive: action.alive ?? state.alive,
|
|
179
|
+
error: void 0
|
|
149
180
|
};
|
|
150
181
|
}
|
|
151
182
|
case "end": return {
|
|
152
183
|
...state,
|
|
153
|
-
alive: false
|
|
184
|
+
alive: false,
|
|
185
|
+
error: void 0
|
|
154
186
|
};
|
|
155
187
|
case "error": return {
|
|
156
188
|
...state,
|
|
157
189
|
error: action.message
|
|
158
190
|
};
|
|
191
|
+
case "unreachable": return {
|
|
192
|
+
...state,
|
|
193
|
+
error: "The agent stream is unreachable; the viewer may be closed."
|
|
194
|
+
};
|
|
159
195
|
}
|
|
160
196
|
}
|
|
161
197
|
/**
|
|
@@ -179,6 +215,10 @@ function useAgentStream(url) {
|
|
|
179
215
|
const target = new URL(url, globalThis.location?.href);
|
|
180
216
|
if (lastSeq > 0) target.searchParams.set("after", String(lastSeq));
|
|
181
217
|
source = new EventSource(target.toString());
|
|
218
|
+
let opened = false;
|
|
219
|
+
source.onopen = () => {
|
|
220
|
+
opened = true;
|
|
221
|
+
};
|
|
182
222
|
source.addEventListener("rows", (message) => {
|
|
183
223
|
const data = JSON.parse(message.data);
|
|
184
224
|
lastSeq = Math.max(lastSeq, data.lastSeq ?? 0, ...data.events.map((row) => row.seq));
|
|
@@ -203,7 +243,9 @@ function useAgentStream(url) {
|
|
|
203
243
|
});
|
|
204
244
|
source.onerror = () => {
|
|
205
245
|
source?.close();
|
|
206
|
-
if (
|
|
246
|
+
if (closed) return;
|
|
247
|
+
if (!opened) dispatch({ type: "unreachable" });
|
|
248
|
+
retry = setTimeout(open, 1e3);
|
|
207
249
|
};
|
|
208
250
|
};
|
|
209
251
|
open();
|
|
@@ -267,6 +309,14 @@ function timelineItems(entries, streaming) {
|
|
|
267
309
|
kind: "tool",
|
|
268
310
|
call: entry.call
|
|
269
311
|
};
|
|
312
|
+
if (entry.kind === "notice") return {
|
|
313
|
+
id: entry.id,
|
|
314
|
+
kind: "custom",
|
|
315
|
+
content: /* @__PURE__ */ jsx("p", {
|
|
316
|
+
className: "text-xs text-muted-foreground",
|
|
317
|
+
children: entry.text
|
|
318
|
+
})
|
|
319
|
+
};
|
|
270
320
|
return {
|
|
271
321
|
id: entry.id,
|
|
272
322
|
kind: "custom",
|
|
@@ -322,10 +372,11 @@ function TraceWorkspace({ trace, streamUrl, events, onTimeChange, files, scorebo
|
|
|
322
372
|
agentCards
|
|
323
373
|
]);
|
|
324
374
|
const shown = cursor === null || origin === void 0 ? stream.entries : stream.entries.filter((entry) => entry.at - origin <= cursor);
|
|
325
|
-
const items = useMemo(() => timelineItems(shown, cursor === null && stream.alive), [
|
|
375
|
+
const items = useMemo(() => timelineItems(shown, cursor === null && stream.alive && !stream.error), [
|
|
326
376
|
shown,
|
|
327
377
|
cursor,
|
|
328
|
-
stream.alive
|
|
378
|
+
stream.alive,
|
|
379
|
+
stream.error
|
|
329
380
|
]);
|
|
330
381
|
const scroller = useRef(null);
|
|
331
382
|
const pinned = useRef(true);
|
|
@@ -438,7 +489,7 @@ function TraceWorkspace({ trace, streamUrl, events, onTimeChange, files, scorebo
|
|
|
438
489
|
className: "min-h-0 flex-1 overflow-y-auto px-3 py-2",
|
|
439
490
|
children: streamUrl ? /* @__PURE__ */ jsx(AgentTimeline, {
|
|
440
491
|
items,
|
|
441
|
-
isThinking: stream.alive && cursor === null && items.length === 0,
|
|
492
|
+
isThinking: stream.alive && !stream.error && cursor === null && items.length === 0,
|
|
442
493
|
emptyState: /* @__PURE__ */ jsx("p", {
|
|
443
494
|
className: "p-4 text-sm text-muted-foreground",
|
|
444
495
|
children: stream.error ?? "No messages yet."
|
package/dist/run.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ToolCallType, B as TraceEvent, C as TaskListItem, D as ToolCallFeed, E as ToolCallData, F as AgentStreamRow, G as traceSpanMark, H as TraceWorkspaceProps, I as AgentStreamState, L as AgentTranscriptEntry, M as showsTaskPriority, N as taskProgress, O as ToolCallFeedProps, P as taskStatus, R as foldAgentRows, S as TaskList, T as TaskStatus, U as TraceWaterfall, V as TraceWorkspace, W as TraceWaterfallProps, _ as RunPhaseList, a as ApprovalPlanStep, b as RunRowStatus, c as FeedSegment, d as InlineToolItem, f as InlineToolItemProps, g as RunPhase, h as RunGroupProps, i as ApprovalDiffSummary, j as parseToolEvent, k as ToolCallStatus, l as InlineThinkingItem, m as RunGroup, n as ApprovalCardProps, o as ExpandedToolDetail, p as LiveDuration, r as ApprovalDiffFile, s as ExpandedToolDetailProps, t as ApprovalCard, u as InlineThinkingItemProps, v as RunRowShell, w as TaskListProps, x as RunRowStatusDot, y as RunRowShellProps, z as useAgentStream } from "./index-
|
|
1
|
+
import { A as ToolCallType, B as TraceEvent, C as TaskListItem, D as ToolCallFeed, E as ToolCallData, F as AgentStreamRow, G as traceSpanMark, H as TraceWorkspaceProps, I as AgentStreamState, L as AgentTranscriptEntry, M as showsTaskPriority, N as taskProgress, O as ToolCallFeedProps, P as taskStatus, R as foldAgentRows, S as TaskList, T as TaskStatus, U as TraceWaterfall, V as TraceWorkspace, W as TraceWaterfallProps, _ as RunPhaseList, a as ApprovalPlanStep, b as RunRowStatus, c as FeedSegment, d as InlineToolItem, f as InlineToolItemProps, g as RunPhase, h as RunGroupProps, i as ApprovalDiffSummary, j as parseToolEvent, k as ToolCallStatus, l as InlineThinkingItem, m as RunGroup, n as ApprovalCardProps, o as ExpandedToolDetail, p as LiveDuration, r as ApprovalDiffFile, s as ExpandedToolDetailProps, t as ApprovalCard, u as InlineThinkingItemProps, v as RunRowShell, w as TaskListProps, x as RunRowStatusDot, y as RunRowShellProps, z as useAgentStream } from "./index-72uBu5lu.js";
|
|
2
2
|
export { type AgentStreamRow, type AgentStreamState, type AgentTranscriptEntry, ApprovalCard, type ApprovalCardProps, type ApprovalDiffFile, ApprovalDiffSummary, type ApprovalPlanStep, ExpandedToolDetail, type ExpandedToolDetailProps, type FeedSegment, InlineThinkingItem, type InlineThinkingItemProps, InlineToolItem, type InlineToolItemProps, LiveDuration, RunGroup, type RunGroupProps, type RunPhase, RunPhaseList, RunRowShell, type RunRowShellProps, type RunRowStatus, RunRowStatusDot, TaskList, type TaskListItem, type TaskListProps, type TaskStatus, type ToolCallData, ToolCallFeed, type ToolCallFeedProps, type ToolCallStatus, type ToolCallType, type TraceEvent, TraceWaterfall, type TraceWaterfallProps, TraceWorkspace, type TraceWorkspaceProps, foldAgentRows, parseToolEvent, showsTaskPriority, taskProgress, taskStatus, traceSpanMark, useAgentStream };
|
package/dist/run.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ApprovalCard, n as ApprovalDiffSummary, r as ExpandedToolDetail, i as InlineThinkingItem, a as InlineToolItem, o as LiveDuration, s as RunGroup, c as RunPhaseList, l as RunRowShell, u as RunRowStatusDot, d as TaskList, f as ToolCallFeed, b as TraceWaterfall, _ as TraceWorkspace, v as foldAgentRows, p as parseToolEvent, m as showsTaskPriority, h as taskProgress, g as taskStatus, x as traceSpanMark, y as useAgentStream } from "./run-
|
|
1
|
+
export { t as ApprovalCard, n as ApprovalDiffSummary, r as ExpandedToolDetail, i as InlineThinkingItem, a as InlineToolItem, o as LiveDuration, s as RunGroup, c as RunPhaseList, l as RunRowShell, u as RunRowStatusDot, d as TaskList, f as ToolCallFeed, b as TraceWaterfall, _ as TraceWorkspace, v as foldAgentRows, p as parseToolEvent, m as showsTaskPriority, h as taskProgress, g as taskStatus, x as traceSpanMark, y as useAgentStream } from "./run-DHx4RUm2.js";
|
package/package.json
CHANGED