@percena/weft-react 0.1.4 → 0.1.5-next.0
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.
- package/dist/index.cjs +269 -186
- package/dist/index.d.cts +43 -1
- package/dist/index.d.ts +43 -1
- package/dist/index.js +210 -131
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -30,9 +30,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ActivityDetailsPanel: () => ActivityDetailsPanel,
|
|
34
|
+
ActivityInspector: () => ActivityInspector,
|
|
33
35
|
AgentChatPanel: () => AgentChatPanel,
|
|
34
36
|
AnnotationIslandMenu: () => AnnotationIslandMenu,
|
|
35
37
|
AnnotationOverlayLayer: () => AnnotationOverlayLayer,
|
|
38
|
+
AssistantTurnCard: () => AssistantTurnCard,
|
|
36
39
|
ChatTranscript: () => ChatTranscript,
|
|
37
40
|
CodeBlock: () => CodeBlock,
|
|
38
41
|
CollapsibleMarkdownProvider: () => CollapsibleMarkdownProvider,
|
|
@@ -43,6 +46,7 @@ __export(src_exports, {
|
|
|
43
46
|
Markdown: () => Markdown,
|
|
44
47
|
MemoizedMarkdown: () => MemoizedMarkdown,
|
|
45
48
|
PendingIndicator: () => PendingIndicator,
|
|
49
|
+
PermissionModeMenu: () => PermissionModeMenu,
|
|
46
50
|
PermissionRequestCard: () => PermissionRequestCard,
|
|
47
51
|
PlatformProvider: () => PlatformProvider,
|
|
48
52
|
ResponseCard: () => ResponseCard,
|
|
@@ -240,6 +244,12 @@ var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
|
240
244
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
241
245
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
242
246
|
var import_react15 = require("react");
|
|
247
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
248
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
249
|
+
var import_react16 = require("react");
|
|
250
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
251
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
252
|
+
var import_react17 = require("react");
|
|
243
253
|
function getAssistantTurnUiKey(turn, index) {
|
|
244
254
|
if (turn.response?.messageId) {
|
|
245
255
|
return `assistant:msg:${turn.response.messageId}`;
|
|
@@ -5190,6 +5200,162 @@ function PendingIndicator({
|
|
|
5190
5200
|
delay
|
|
5191
5201
|
)) }) });
|
|
5192
5202
|
}
|
|
5203
|
+
function AssistantTurnCard({
|
|
5204
|
+
sessionId,
|
|
5205
|
+
turn,
|
|
5206
|
+
isLast,
|
|
5207
|
+
onInspectActivity
|
|
5208
|
+
}) {
|
|
5209
|
+
const [isExpanded, setIsExpanded] = (0, import_react15.useState)(true);
|
|
5210
|
+
const [expandedActivityGroups, setExpandedActivityGroups] = (0, import_react15.useState)(/* @__PURE__ */ new Set());
|
|
5211
|
+
(0, import_react15.useEffect)(() => {
|
|
5212
|
+
if (turn.isStreaming) {
|
|
5213
|
+
setIsExpanded(true);
|
|
5214
|
+
}
|
|
5215
|
+
}, [turn.isStreaming]);
|
|
5216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
5217
|
+
TurnCard,
|
|
5218
|
+
{
|
|
5219
|
+
sessionId,
|
|
5220
|
+
turnId: turn.turnId,
|
|
5221
|
+
activities: turn.activities,
|
|
5222
|
+
response: turn.response,
|
|
5223
|
+
intent: turn.intent,
|
|
5224
|
+
isStreaming: turn.isStreaming,
|
|
5225
|
+
isComplete: turn.isComplete,
|
|
5226
|
+
isExpanded,
|
|
5227
|
+
onExpandedChange: setIsExpanded,
|
|
5228
|
+
expandedActivityGroups,
|
|
5229
|
+
onExpandedActivityGroupsChange: setExpandedActivityGroups,
|
|
5230
|
+
onOpenActivityDetails: onInspectActivity,
|
|
5231
|
+
hasEditOrWriteActivities: turn.activities.some(
|
|
5232
|
+
(activity) => activity.toolName === "Edit" || activity.toolName === "Write"
|
|
5233
|
+
),
|
|
5234
|
+
todos: turn.todos,
|
|
5235
|
+
isLastResponse: isLast,
|
|
5236
|
+
displayMode: "detailed",
|
|
5237
|
+
animateResponse: true,
|
|
5238
|
+
annotationInteractionMode: "tooltip-only"
|
|
5239
|
+
}
|
|
5240
|
+
);
|
|
5241
|
+
}
|
|
5242
|
+
function ActivityInspector({
|
|
5243
|
+
activity,
|
|
5244
|
+
onClose
|
|
5245
|
+
}) {
|
|
5246
|
+
if (!activity) {
|
|
5247
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "rounded-[8px] bg-background shadow-minimal p-4 text-[13px] text-muted-foreground", children: "Select an activity from the turn card to inspect its input and output." });
|
|
5248
|
+
}
|
|
5249
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-col overflow-hidden", children: [
|
|
5250
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-start justify-between gap-3 border-b border-border px-4 py-3", children: [
|
|
5251
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "min-w-0", children: [
|
|
5252
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "truncate text-[13px] font-medium text-foreground", children: activity.displayName ?? activity.toolName ?? "Activity" }),
|
|
5253
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mt-1 text-[12px] text-muted-foreground", children: activity.intent ?? activity.status ?? "unknown" })
|
|
5254
|
+
] }),
|
|
5255
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
5256
|
+
"button",
|
|
5257
|
+
{
|
|
5258
|
+
type: "button",
|
|
5259
|
+
onClick: onClose,
|
|
5260
|
+
className: "flex h-7 w-7 items-center justify-center rounded-[6px] text-[16px] leading-none text-muted-foreground transition hover:bg-foreground/[0.06] hover:text-foreground",
|
|
5261
|
+
"aria-label": "Close activity details",
|
|
5262
|
+
children: "\u2715"
|
|
5263
|
+
}
|
|
5264
|
+
)
|
|
5265
|
+
] }),
|
|
5266
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "overflow-y-auto space-y-4 p-4", children: [
|
|
5267
|
+
activity.toolInput && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
5268
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mb-2 text-[12px] font-medium text-muted-foreground", children: "Input" }),
|
|
5269
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "max-h-[280px] overflow-auto rounded-[6px] bg-foreground/[0.04] p-3 text-[12px] leading-relaxed text-foreground", children: JSON.stringify(activity.toolInput, null, 2) })
|
|
5270
|
+
] }),
|
|
5271
|
+
activity.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
5272
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mb-2 text-[12px] font-medium text-muted-foreground", children: "Error" }),
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "max-h-[320px] overflow-auto whitespace-pre-wrap rounded-[6px] bg-foreground/[0.04] p-3 text-[12px] leading-relaxed text-foreground", children: activity.error })
|
|
5274
|
+
] }),
|
|
5275
|
+
activity.content && !activity.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
5276
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mb-2 text-[12px] font-medium text-muted-foreground", children: "Output" }),
|
|
5277
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "max-h-[320px] overflow-y-auto rounded-[6px] bg-foreground/[0.04] px-3 py-2 text-[12px] text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Markdown, { mode: "minimal", className: "text-[12px] leading-relaxed", children: activity.content }) })
|
|
5278
|
+
] })
|
|
5279
|
+
] })
|
|
5280
|
+
] });
|
|
5281
|
+
}
|
|
5282
|
+
function ActivityDetailsPanel({
|
|
5283
|
+
activity,
|
|
5284
|
+
onClose
|
|
5285
|
+
}) {
|
|
5286
|
+
(0, import_react16.useEffect)(() => {
|
|
5287
|
+
if (!activity) return;
|
|
5288
|
+
const handleKeyDown = (e) => {
|
|
5289
|
+
if (e.key === "Escape") onClose();
|
|
5290
|
+
};
|
|
5291
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
5292
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
5293
|
+
}, [activity, onClose]);
|
|
5294
|
+
if (!activity) return null;
|
|
5295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5296
|
+
"div",
|
|
5297
|
+
{
|
|
5298
|
+
className: "fixed inset-0 z-50 flex items-center justify-center bg-background/60 backdrop-blur-sm",
|
|
5299
|
+
onClick: onClose,
|
|
5300
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
5301
|
+
"div",
|
|
5302
|
+
{
|
|
5303
|
+
className: "relative w-full max-w-[640px] max-h-[80vh] overflow-hidden rounded-[12px] border border-border bg-background shadow-strong mx-4",
|
|
5304
|
+
onClick: (e) => e.stopPropagation(),
|
|
5305
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(ActivityInspector, { activity, onClose })
|
|
5306
|
+
}
|
|
5307
|
+
)
|
|
5308
|
+
}
|
|
5309
|
+
);
|
|
5310
|
+
}
|
|
5311
|
+
var PERMISSION_CONFIG = [
|
|
5312
|
+
{ mode: "safe", label: "Explore", description: "Read-only planning and inspection.", icon: "\u25CE" },
|
|
5313
|
+
{ mode: "ask", label: "Ask", description: "Review changes before execution.", icon: "\u24D8" },
|
|
5314
|
+
{ mode: "allow-all", label: "Execute", description: "Allow edits and commands in this session.", icon: "\u21C4" }
|
|
5315
|
+
];
|
|
5316
|
+
function PermissionModeMenu({
|
|
5317
|
+
value,
|
|
5318
|
+
onChange,
|
|
5319
|
+
onClose,
|
|
5320
|
+
isOpen,
|
|
5321
|
+
onToggle
|
|
5322
|
+
}) {
|
|
5323
|
+
const selected = PERMISSION_CONFIG.find((o) => o.mode === value) ?? PERMISSION_CONFIG[1];
|
|
5324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "relative", children: [
|
|
5325
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "absolute bottom-[calc(100%+6px)] left-0 z-20 w-[204px] rounded-[9px] border border-border bg-background p-1.5 shadow-modal-small", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "space-y-0.5", children: PERMISSION_CONFIG.map((option) => /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
5326
|
+
"button",
|
|
5327
|
+
{
|
|
5328
|
+
type: "button",
|
|
5329
|
+
onClick: () => {
|
|
5330
|
+
onChange(option.mode);
|
|
5331
|
+
onClose?.();
|
|
5332
|
+
},
|
|
5333
|
+
className: `flex h-8 w-full items-center gap-2 rounded-[6px] px-2 text-left text-[12px] transition ${option.mode === value ? "bg-foreground/[0.08] text-foreground" : "text-muted-foreground hover:bg-foreground/[0.05] hover:text-foreground"}`,
|
|
5334
|
+
children: [
|
|
5335
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "w-4 text-center text-[12px]", children: option.icon }),
|
|
5336
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "flex-1", children: option.label }),
|
|
5337
|
+
option.mode === value && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { "aria-hidden": "true", className: "text-[12px] text-foreground", children: "\u25CF" })
|
|
5338
|
+
]
|
|
5339
|
+
},
|
|
5340
|
+
option.mode
|
|
5341
|
+
)) }) }),
|
|
5342
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
5343
|
+
"button",
|
|
5344
|
+
{
|
|
5345
|
+
type: "button",
|
|
5346
|
+
"aria-haspopup": "menu",
|
|
5347
|
+
"aria-expanded": isOpen,
|
|
5348
|
+
onClick: onToggle,
|
|
5349
|
+
className: "inline-flex h-8 items-center gap-1.5 rounded-[7px] border border-border bg-foreground/[0.035] px-2.5 text-[12px] text-foreground transition hover:bg-foreground/[0.06]",
|
|
5350
|
+
children: [
|
|
5351
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: selected.icon }),
|
|
5352
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { children: selected.label }),
|
|
5353
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: "text-muted-foreground", children: "\u2304" })
|
|
5354
|
+
]
|
|
5355
|
+
}
|
|
5356
|
+
)
|
|
5357
|
+
] });
|
|
5358
|
+
}
|
|
5193
5359
|
function generateMessageId2() {
|
|
5194
5360
|
return generateMessageId();
|
|
5195
5361
|
}
|
|
@@ -6591,6 +6757,10 @@ function normalizeTimelineToolName(name) {
|
|
|
6591
6757
|
return name;
|
|
6592
6758
|
}
|
|
6593
6759
|
function optionalToolDisplayName(toolName, detail) {
|
|
6760
|
+
if (detail && typeof detail === "object") {
|
|
6761
|
+
const explicit = detail.displayName;
|
|
6762
|
+
if (typeof explicit === "string" && explicit) return { toolDisplayName: explicit };
|
|
6763
|
+
}
|
|
6594
6764
|
if (toolName !== "commandExecution") return {};
|
|
6595
6765
|
const displayName = commandDisplayName(detail);
|
|
6596
6766
|
return displayName ? { toolDisplayName: displayName } : {};
|
|
@@ -6726,12 +6896,12 @@ function normalizeTokenUsage(usage) {
|
|
|
6726
6896
|
}
|
|
6727
6897
|
function useEventProcessor(options) {
|
|
6728
6898
|
const { eventSource, sessionId, workspaceId, workspaceName, onEffect, onError, onClose } = options;
|
|
6729
|
-
const [session, setSession] = (0,
|
|
6730
|
-
const sessionRef = (0,
|
|
6731
|
-
const streamingStates = (0,
|
|
6732
|
-
const [isConnected, setIsConnected] = (0,
|
|
6733
|
-
const processedCount = (0,
|
|
6734
|
-
const processAgentEvent = (0,
|
|
6899
|
+
const [session, setSession] = (0, import_react17.useState)(null);
|
|
6900
|
+
const sessionRef = (0, import_react17.useRef)(null);
|
|
6901
|
+
const streamingStates = (0, import_react17.useRef)(/* @__PURE__ */ new Map());
|
|
6902
|
+
const [isConnected, setIsConnected] = (0, import_react17.useState)(false);
|
|
6903
|
+
const processedCount = (0, import_react17.useRef)(0);
|
|
6904
|
+
const processAgentEvent = (0, import_react17.useCallback)((event) => {
|
|
6735
6905
|
const processorEvent = mapCoreEventToProcessorEvent(event, sessionId);
|
|
6736
6906
|
const currentSession = sessionRef.current ?? createEmptySession(sessionId, workspaceId, workspaceName ?? "");
|
|
6737
6907
|
const currentState = {
|
|
@@ -6751,7 +6921,7 @@ function useEventProcessor(options) {
|
|
|
6751
6921
|
effects: result.effects
|
|
6752
6922
|
};
|
|
6753
6923
|
}, [sessionId, workspaceId, workspaceName]);
|
|
6754
|
-
(0,
|
|
6924
|
+
(0, import_react17.useEffect)(() => {
|
|
6755
6925
|
eventSource.connect(
|
|
6756
6926
|
(coreEvent) => {
|
|
6757
6927
|
const result = processAgentEvent(coreEvent);
|
|
@@ -6774,10 +6944,10 @@ function useEventProcessor(options) {
|
|
|
6774
6944
|
setIsConnected(false);
|
|
6775
6945
|
};
|
|
6776
6946
|
}, [eventSource, processAgentEvent, onEffect, onError, onClose]);
|
|
6777
|
-
const clearStreamingState = (0,
|
|
6947
|
+
const clearStreamingState = (0, import_react17.useCallback)(() => {
|
|
6778
6948
|
streamingStates.current.delete(sessionId);
|
|
6779
6949
|
}, [sessionId]);
|
|
6780
|
-
const getStreamingState = (0,
|
|
6950
|
+
const getStreamingState = (0, import_react17.useCallback)(() => {
|
|
6781
6951
|
return streamingStates.current.get(sessionId) ?? null;
|
|
6782
6952
|
}, [sessionId]);
|
|
6783
6953
|
return {
|
|
@@ -6909,8 +7079,8 @@ var InProcessEventSource = class {
|
|
|
6909
7079
|
};
|
|
6910
7080
|
|
|
6911
7081
|
// ../local-chat/dist/index.js
|
|
6912
|
-
var
|
|
6913
|
-
var
|
|
7082
|
+
var import_react18 = require("react");
|
|
7083
|
+
var import_react19 = require("react");
|
|
6914
7084
|
|
|
6915
7085
|
// ../timeline/dist/index.js
|
|
6916
7086
|
function createTimelineCursor(cursor) {
|
|
@@ -6958,9 +7128,9 @@ function timelineKey(item) {
|
|
|
6958
7128
|
}
|
|
6959
7129
|
|
|
6960
7130
|
// ../local-chat/dist/index.js
|
|
6961
|
-
var
|
|
6962
|
-
var
|
|
6963
|
-
var
|
|
7131
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
7132
|
+
var import_react20 = require("react");
|
|
7133
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6964
7134
|
function createAgentChatPanelModel(args) {
|
|
6965
7135
|
return {
|
|
6966
7136
|
turns: args.session ? groupMessagesByTurn(args.session.messages) : [],
|
|
@@ -7047,8 +7217,8 @@ function createTimelineDetailItems(timeline) {
|
|
|
7047
7217
|
}
|
|
7048
7218
|
function useAgentChatSession(options) {
|
|
7049
7219
|
const { runtime, workspaceId = "local-workspace", workspaceName = "Local Workspace" } = options;
|
|
7050
|
-
const [auth, setAuth] = (0,
|
|
7051
|
-
const [error, setError] = (0,
|
|
7220
|
+
const [auth, setAuth] = (0, import_react19.useState)(null);
|
|
7221
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
7052
7222
|
const processor = useEventProcessor({
|
|
7053
7223
|
eventSource: runtime.events,
|
|
7054
7224
|
sessionId: runtime.sessionId,
|
|
@@ -7056,7 +7226,7 @@ function useAgentChatSession(options) {
|
|
|
7056
7226
|
workspaceName,
|
|
7057
7227
|
onError: setError
|
|
7058
7228
|
});
|
|
7059
|
-
const sendMessage = (0,
|
|
7229
|
+
const sendMessage = (0, import_react19.useCallback)(async (message) => {
|
|
7060
7230
|
setError(null);
|
|
7061
7231
|
try {
|
|
7062
7232
|
if (!auth) {
|
|
@@ -7072,13 +7242,13 @@ function useAgentChatSession(options) {
|
|
|
7072
7242
|
throw err;
|
|
7073
7243
|
}
|
|
7074
7244
|
}, [auth, runtime]);
|
|
7075
|
-
const abort = (0,
|
|
7245
|
+
const abort = (0, import_react19.useCallback)(async () => {
|
|
7076
7246
|
await runtime.commands.abort("User aborted");
|
|
7077
7247
|
}, [runtime]);
|
|
7078
|
-
const respondToPermission = (0,
|
|
7248
|
+
const respondToPermission = (0, import_react19.useCallback)(async (requestId, allowed, remember) => {
|
|
7079
7249
|
await runtime.commands.respondToPermission(requestId, allowed, remember);
|
|
7080
7250
|
}, [runtime]);
|
|
7081
|
-
const model = (0,
|
|
7251
|
+
const model = (0, import_react19.useMemo)(
|
|
7082
7252
|
() => createAgentChatPanelModel({ session: processor.session, runtime, auth, error }),
|
|
7083
7253
|
[processor.session, runtime, auth, error]
|
|
7084
7254
|
);
|
|
@@ -7095,13 +7265,13 @@ function useAgentChatSession(options) {
|
|
|
7095
7265
|
}
|
|
7096
7266
|
function useTimelineAgentChatSession(options) {
|
|
7097
7267
|
const { runtime, workspaceId = "local-workspace", workspaceName = "Local Workspace" } = options;
|
|
7098
|
-
const [timeline, setTimeline] = (0,
|
|
7099
|
-
const [capabilityReport, setCapabilityReport] = (0,
|
|
7100
|
-
const [error, setError] = (0,
|
|
7101
|
-
const [isReconnecting, setIsReconnecting] = (0,
|
|
7102
|
-
const [hasGap, setHasGap] = (0,
|
|
7103
|
-
const lastCursorRef = (0,
|
|
7104
|
-
(0,
|
|
7268
|
+
const [timeline, setTimeline] = (0, import_react19.useState)([]);
|
|
7269
|
+
const [capabilityReport, setCapabilityReport] = (0, import_react19.useState)(null);
|
|
7270
|
+
const [error, setError] = (0, import_react19.useState)(null);
|
|
7271
|
+
const [isReconnecting, setIsReconnecting] = (0, import_react19.useState)(false);
|
|
7272
|
+
const [hasGap, setHasGap] = (0, import_react19.useState)(false);
|
|
7273
|
+
const lastCursorRef = (0, import_react19.useRef)(null);
|
|
7274
|
+
(0, import_react19.useEffect)(() => {
|
|
7105
7275
|
let catchupAbort = false;
|
|
7106
7276
|
const onEvent = (envelope) => {
|
|
7107
7277
|
lastCursorRef.current = { epoch: envelope.epoch, afterSeq: envelope.seq };
|
|
@@ -7137,7 +7307,7 @@ function useTimelineAgentChatSession(options) {
|
|
|
7137
7307
|
runtime.events.disconnect();
|
|
7138
7308
|
};
|
|
7139
7309
|
}, [runtime]);
|
|
7140
|
-
const sendMessage = (0,
|
|
7310
|
+
const sendMessage = (0, import_react19.useCallback)(async (message, options2) => {
|
|
7141
7311
|
setError(null);
|
|
7142
7312
|
setHasGap(false);
|
|
7143
7313
|
try {
|
|
@@ -7152,13 +7322,13 @@ function useTimelineAgentChatSession(options) {
|
|
|
7152
7322
|
throw err;
|
|
7153
7323
|
}
|
|
7154
7324
|
}, [capabilityReport, runtime]);
|
|
7155
|
-
const abort = (0,
|
|
7325
|
+
const abort = (0, import_react19.useCallback)(async () => {
|
|
7156
7326
|
await runtime.commands.abort("User aborted");
|
|
7157
7327
|
}, [runtime]);
|
|
7158
|
-
const respondToPermission = (0,
|
|
7328
|
+
const respondToPermission = (0, import_react19.useCallback)(async (requestId, allowed, remember) => {
|
|
7159
7329
|
await runtime.commands.respondToPermission(requestId, allowed, remember);
|
|
7160
7330
|
}, [runtime]);
|
|
7161
|
-
const model = (0,
|
|
7331
|
+
const model = (0, import_react19.useMemo)(
|
|
7162
7332
|
() => createTimelineAgentChatPanelModel({
|
|
7163
7333
|
timeline,
|
|
7164
7334
|
sessionId: runtime.sessionId,
|
|
@@ -7395,7 +7565,7 @@ function AgentChatPanel({
|
|
|
7395
7565
|
className
|
|
7396
7566
|
}) {
|
|
7397
7567
|
const chat = useAgentChatSession({ runtime, workspaceId, workspaceName });
|
|
7398
|
-
const [draft, setDraft] = (0,
|
|
7568
|
+
const [draft, setDraft] = (0, import_react18.useState)("");
|
|
7399
7569
|
async function handleSubmit(event) {
|
|
7400
7570
|
event.preventDefault();
|
|
7401
7571
|
const message = draft.trim();
|
|
@@ -7407,8 +7577,8 @@ function AgentChatPanel({
|
|
|
7407
7577
|
}
|
|
7408
7578
|
}
|
|
7409
7579
|
const storedSession = chat.session ? toStoredSession(chat.session, workspaceId) : createEmptyStoredSession(runtime.sessionId, workspaceId, workspaceName);
|
|
7410
|
-
const footer = /* @__PURE__ */ (0,
|
|
7411
|
-
/* @__PURE__ */ (0,
|
|
7580
|
+
const footer = /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("form", { onSubmit: handleSubmit, className: "flex gap-2 p-3", children: [
|
|
7581
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7412
7582
|
"textarea",
|
|
7413
7583
|
{
|
|
7414
7584
|
value: draft,
|
|
@@ -7418,7 +7588,7 @@ function AgentChatPanel({
|
|
|
7418
7588
|
className: "min-h-10 flex-1 resize-none rounded-md border px-3 py-2 text-sm"
|
|
7419
7589
|
}
|
|
7420
7590
|
),
|
|
7421
|
-
/* @__PURE__ */ (0,
|
|
7591
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7422
7592
|
"button",
|
|
7423
7593
|
{
|
|
7424
7594
|
type: "submit",
|
|
@@ -7427,7 +7597,7 @@ function AgentChatPanel({
|
|
|
7427
7597
|
children: "Send"
|
|
7428
7598
|
}
|
|
7429
7599
|
),
|
|
7430
|
-
chat.isRunning && /* @__PURE__ */ (0,
|
|
7600
|
+
chat.isRunning && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7431
7601
|
"button",
|
|
7432
7602
|
{
|
|
7433
7603
|
type: "button",
|
|
@@ -7437,9 +7607,9 @@ function AgentChatPanel({
|
|
|
7437
7607
|
}
|
|
7438
7608
|
)
|
|
7439
7609
|
] });
|
|
7440
|
-
return /* @__PURE__ */ (0,
|
|
7441
|
-
chat.error && /* @__PURE__ */ (0,
|
|
7442
|
-
/* @__PURE__ */ (0,
|
|
7610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className, children: [
|
|
7611
|
+
chat.error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "border-b px-3 py-2 text-sm text-red-600", children: chat.error.message }),
|
|
7612
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
7443
7613
|
SessionViewer,
|
|
7444
7614
|
{
|
|
7445
7615
|
session: storedSession,
|
|
@@ -7511,27 +7681,24 @@ function TimelineAgentChatPanel({
|
|
|
7511
7681
|
className
|
|
7512
7682
|
}) {
|
|
7513
7683
|
const chat = useTimelineAgentChatSession({ runtime, workspaceId, workspaceName });
|
|
7514
|
-
const [draft, setDraft] = (0,
|
|
7515
|
-
const [selectedActivity, setSelectedActivity] = (0,
|
|
7516
|
-
const [selectedDetail, setSelectedDetail] = (0,
|
|
7517
|
-
const [permissionMode, setPermissionMode] = (0,
|
|
7518
|
-
const [
|
|
7519
|
-
const handleTurnExpandedChange = (0, import_react18.useCallback)((turnId, expanded) => {
|
|
7520
|
-
setTurnExpandOverride((prev) => ({ ...prev, [turnId]: expanded }));
|
|
7521
|
-
}, []);
|
|
7684
|
+
const [draft, setDraft] = (0, import_react20.useState)("");
|
|
7685
|
+
const [selectedActivity, setSelectedActivity] = (0, import_react20.useState)(null);
|
|
7686
|
+
const [selectedDetail, setSelectedDetail] = (0, import_react20.useState)(null);
|
|
7687
|
+
const [permissionMode, setPermissionMode] = (0, import_react20.useState)("ask");
|
|
7688
|
+
const [isPermMenuOpen, setIsPermMenuOpen] = (0, import_react20.useState)(false);
|
|
7522
7689
|
const runtimeState = runtime.getState();
|
|
7523
7690
|
const isWaitingPermission = runtimeState.status === "waiting_for_permission";
|
|
7524
7691
|
const waitingRequestId = runtimeState.waitingPermissionRequestId;
|
|
7525
|
-
const permissionRequest = (0,
|
|
7692
|
+
const permissionRequest = (0, import_react20.useMemo)(() => {
|
|
7526
7693
|
if (!isWaitingPermission || !waitingRequestId) return null;
|
|
7527
7694
|
return findActivePermissionRequest(chat.timeline);
|
|
7528
7695
|
}, [isWaitingPermission, waitingRequestId, chat.timeline]);
|
|
7529
|
-
const detailItems = (0,
|
|
7696
|
+
const detailItems = (0, import_react20.useMemo)(
|
|
7530
7697
|
() => createTimelineDetailItems(chat.timeline),
|
|
7531
7698
|
[chat.timeline]
|
|
7532
7699
|
);
|
|
7533
|
-
const scrollRef = (0,
|
|
7534
|
-
(0,
|
|
7700
|
+
const scrollRef = (0, import_react20.useRef)(null);
|
|
7701
|
+
(0, import_react20.useEffect)(() => {
|
|
7535
7702
|
if (scrollRef.current) {
|
|
7536
7703
|
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
|
7537
7704
|
}
|
|
@@ -7546,60 +7713,45 @@ function TimelineAgentChatPanel({
|
|
|
7546
7713
|
} catch {
|
|
7547
7714
|
}
|
|
7548
7715
|
}
|
|
7549
|
-
const handlePermissionAllow = (0,
|
|
7716
|
+
const handlePermissionAllow = (0, import_react20.useCallback)((requestId, remember) => {
|
|
7550
7717
|
void chat.respondToPermission(requestId, true, remember);
|
|
7551
7718
|
}, [chat]);
|
|
7552
|
-
const handlePermissionDeny = (0,
|
|
7719
|
+
const handlePermissionDeny = (0, import_react20.useCallback)((requestId) => {
|
|
7553
7720
|
void chat.respondToPermission(requestId, false);
|
|
7554
7721
|
}, [chat]);
|
|
7555
|
-
return /* @__PURE__ */ (0,
|
|
7556
|
-
showStatusBar && /* @__PURE__ */ (0,
|
|
7557
|
-
/* @__PURE__ */ (0,
|
|
7558
|
-
/* @__PURE__ */ (0,
|
|
7559
|
-
/* @__PURE__ */ (0,
|
|
7560
|
-
/* @__PURE__ */ (0,
|
|
7722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: `flex flex-col h-full ${className ?? ""}`, children: [
|
|
7723
|
+
showStatusBar && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "shrink-0 border-b border-border bg-background/70 px-4 py-2 backdrop-blur", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
7724
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex items-center gap-2 text-[12px] text-muted-foreground", children: [
|
|
7725
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: chat.isConnected ? "text-green-500" : "text-muted-foreground", children: chat.isConnected ? "\u25CF" : "\u25CB" }),
|
|
7726
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { children: chat.isConnected ? "Connected" : chat.isReconnecting ? "Reconnecting" : "Disconnected" }),
|
|
7727
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: isWaitingPermission ? "text-yellow-500" : chat.isRunning ? "text-green-500" : "", children: isWaitingPermission ? " \u25C9 Awaiting approval" : chat.isRunning ? " \u25CF Running" : "" })
|
|
7561
7728
|
] }),
|
|
7562
|
-
/* @__PURE__ */ (0,
|
|
7563
|
-
chat.hasGap && /* @__PURE__ */ (0,
|
|
7729
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "text-[12px] text-muted-foreground", children: [
|
|
7730
|
+
chat.hasGap && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "text-yellow-500", children: "\u26A0 Gap detected \xB7 " }),
|
|
7564
7731
|
summarizeCapability(chat.capabilityReport)
|
|
7565
7732
|
] })
|
|
7566
7733
|
] }) }),
|
|
7567
|
-
chat.error && /* @__PURE__ */ (0,
|
|
7568
|
-
/* @__PURE__ */ (0,
|
|
7569
|
-
chat.turns.length === 0 && !chat.isRunning && !isWaitingPermission && /* @__PURE__ */ (0,
|
|
7734
|
+
chat.error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "shrink-0 border-b border-border bg-red-500/[0.08] px-4 py-2 text-[13px] text-red-600", children: chat.error.message }),
|
|
7735
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex-1 min-h-0 overflow-y-auto", ref: scrollRef, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "mx-auto max-w-[760px] flex flex-col gap-4 px-4 py-6", children: [
|
|
7736
|
+
chat.turns.length === 0 && !chat.isRunning && !isWaitingPermission && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "rounded-[8px] bg-background shadow-minimal p-5 text-[13px] text-muted-foreground", children: "Send a message to start an agent session." }),
|
|
7570
7737
|
chat.turns.map((turn, index) => {
|
|
7571
7738
|
if (turn.type === "user") {
|
|
7572
|
-
return /* @__PURE__ */ (0,
|
|
7739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "flex justify-end py-1", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(UserMessageBubble, { content: turn.message.content }) }, `user-${turn.message.id}`);
|
|
7573
7740
|
}
|
|
7574
7741
|
if (turn.type === "assistant") {
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
const isExpanded = turnExpandOverride[turn.turnId] ?? defaultExpanded;
|
|
7578
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7579
|
-
TurnCard,
|
|
7742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7743
|
+
AssistantTurnCard,
|
|
7580
7744
|
{
|
|
7581
7745
|
sessionId: workspaceId,
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
intent: turn.intent,
|
|
7586
|
-
isStreaming: turn.isStreaming,
|
|
7587
|
-
isComplete: turn.isComplete,
|
|
7588
|
-
isExpanded,
|
|
7589
|
-
onExpandedChange: (expanded) => handleTurnExpandedChange(turn.turnId, expanded),
|
|
7590
|
-
onOpenActivityDetails: setSelectedActivity,
|
|
7591
|
-
hasEditOrWriteActivities: turn.activities.some(
|
|
7592
|
-
(a) => a.toolName === "Edit" || a.toolName === "Write"
|
|
7593
|
-
),
|
|
7594
|
-
todos: turn.todos,
|
|
7595
|
-
isLastResponse: isLast,
|
|
7596
|
-
displayMode: "detailed"
|
|
7746
|
+
turn,
|
|
7747
|
+
isLast: index === chat.turns.length - 1,
|
|
7748
|
+
onInspectActivity: setSelectedActivity
|
|
7597
7749
|
},
|
|
7598
7750
|
`assistant-${turn.turnId}`
|
|
7599
7751
|
);
|
|
7600
7752
|
}
|
|
7601
7753
|
if (turn.type === "auth-request") {
|
|
7602
|
-
return /* @__PURE__ */ (0,
|
|
7754
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7603
7755
|
PermissionRequestCard,
|
|
7604
7756
|
{
|
|
7605
7757
|
requestId: turn.message.authRequestId ?? turn.message.id,
|
|
@@ -7614,7 +7766,7 @@ function TimelineAgentChatPanel({
|
|
|
7614
7766
|
}
|
|
7615
7767
|
return null;
|
|
7616
7768
|
}),
|
|
7617
|
-
isWaitingPermission && permissionRequest && /* @__PURE__ */ (0,
|
|
7769
|
+
isWaitingPermission && permissionRequest && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7618
7770
|
PermissionRequestCard,
|
|
7619
7771
|
{
|
|
7620
7772
|
requestId: permissionRequest.requestId,
|
|
@@ -7627,7 +7779,7 @@ function TimelineAgentChatPanel({
|
|
|
7627
7779
|
onDeny: handlePermissionDeny
|
|
7628
7780
|
}
|
|
7629
7781
|
),
|
|
7630
|
-
isWaitingPermission && !permissionRequest && waitingRequestId && /* @__PURE__ */ (0,
|
|
7782
|
+
isWaitingPermission && !permissionRequest && waitingRequestId && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7631
7783
|
PermissionRequestCard,
|
|
7632
7784
|
{
|
|
7633
7785
|
requestId: waitingRequestId,
|
|
@@ -7639,9 +7791,9 @@ function TimelineAgentChatPanel({
|
|
|
7639
7791
|
}
|
|
7640
7792
|
)
|
|
7641
7793
|
] }) }),
|
|
7642
|
-
showDetailPanel && /* @__PURE__ */ (0,
|
|
7643
|
-
/* @__PURE__ */ (0,
|
|
7644
|
-
detailItems.length === 0 ? /* @__PURE__ */ (0,
|
|
7794
|
+
showDetailPanel && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "shrink-0 border-t border-border bg-background/70 max-h-[260px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "px-4 py-3 space-y-2", children: [
|
|
7795
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-[12px] font-medium uppercase text-muted-foreground", children: "Runtime Details" }),
|
|
7796
|
+
detailItems.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "text-[12px] text-muted-foreground", children: "No runtime details yet." }) : detailItems.slice(-10).map((item) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7645
7797
|
"button",
|
|
7646
7798
|
{
|
|
7647
7799
|
type: "button",
|
|
@@ -7652,9 +7804,9 @@ function TimelineAgentChatPanel({
|
|
|
7652
7804
|
item.id
|
|
7653
7805
|
))
|
|
7654
7806
|
] }) }),
|
|
7655
|
-
/* @__PURE__ */ (0,
|
|
7656
|
-
/* @__PURE__ */ (0,
|
|
7657
|
-
/* @__PURE__ */ (0,
|
|
7807
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "shrink-0 border-t border-border", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col gap-2 p-3", children: [
|
|
7808
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex gap-2", children: [
|
|
7809
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7658
7810
|
"textarea",
|
|
7659
7811
|
{
|
|
7660
7812
|
value: draft,
|
|
@@ -7664,7 +7816,7 @@ function TimelineAgentChatPanel({
|
|
|
7664
7816
|
className: "min-h-10 flex-1 resize-none rounded-[7px] border border-border bg-background px-3 py-2 text-[13px] text-foreground outline-none placeholder:text-muted-foreground focus:ring-2 focus:ring-accent"
|
|
7665
7817
|
}
|
|
7666
7818
|
),
|
|
7667
|
-
/* @__PURE__ */ (0,
|
|
7819
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7668
7820
|
"button",
|
|
7669
7821
|
{
|
|
7670
7822
|
type: "submit",
|
|
@@ -7673,7 +7825,7 @@ function TimelineAgentChatPanel({
|
|
|
7673
7825
|
children: "Send"
|
|
7674
7826
|
}
|
|
7675
7827
|
),
|
|
7676
|
-
chat.isRunning && /* @__PURE__ */ (0,
|
|
7828
|
+
chat.isRunning && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7677
7829
|
"button",
|
|
7678
7830
|
{
|
|
7679
7831
|
type: "button",
|
|
@@ -7683,24 +7835,19 @@ function TimelineAgentChatPanel({
|
|
|
7683
7835
|
}
|
|
7684
7836
|
)
|
|
7685
7837
|
] }),
|
|
7686
|
-
/* @__PURE__ */ (0,
|
|
7687
|
-
|
|
7688
|
-
|
|
7689
|
-
|
|
7690
|
-
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("option", { value: "allow-all", children: "Auto-run (no prompts)" })
|
|
7697
|
-
]
|
|
7698
|
-
}
|
|
7699
|
-
)
|
|
7700
|
-
] })
|
|
7838
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7839
|
+
PermissionModeMenu,
|
|
7840
|
+
{
|
|
7841
|
+
value: permissionMode,
|
|
7842
|
+
onChange: setPermissionMode,
|
|
7843
|
+
onClose: () => setIsPermMenuOpen(false),
|
|
7844
|
+
isOpen: isPermMenuOpen,
|
|
7845
|
+
onToggle: () => setIsPermMenuOpen((o) => !o)
|
|
7846
|
+
}
|
|
7847
|
+
)
|
|
7701
7848
|
] }) }),
|
|
7702
|
-
|
|
7703
|
-
|
|
7849
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
7850
|
+
ActivityDetailsPanel,
|
|
7704
7851
|
{
|
|
7705
7852
|
activity: selectedActivity,
|
|
7706
7853
|
onClose: () => setSelectedActivity(null)
|
|
@@ -7708,74 +7855,6 @@ function TimelineAgentChatPanel({
|
|
|
7708
7855
|
)
|
|
7709
7856
|
] });
|
|
7710
7857
|
}
|
|
7711
|
-
function formatActivityValue(value) {
|
|
7712
|
-
if (value == null) return "";
|
|
7713
|
-
if (typeof value === "string") return value;
|
|
7714
|
-
try {
|
|
7715
|
-
return JSON.stringify(value, null, 2);
|
|
7716
|
-
} catch {
|
|
7717
|
-
return String(value);
|
|
7718
|
-
}
|
|
7719
|
-
}
|
|
7720
|
-
function ActivityDetailOverlay({
|
|
7721
|
-
activity,
|
|
7722
|
-
onClose
|
|
7723
|
-
}) {
|
|
7724
|
-
const title = activity.displayName || activity.toolName || activity.type;
|
|
7725
|
-
const input = activity.toolInput && Object.keys(activity.toolInput).length > 0 ? formatActivityValue(activity.toolInput) : "";
|
|
7726
|
-
const result = formatActivityValue(activity.content);
|
|
7727
|
-
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7728
|
-
"div",
|
|
7729
|
-
{
|
|
7730
|
-
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
7731
|
-
onClick: onClose,
|
|
7732
|
-
role: "presentation",
|
|
7733
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
7734
|
-
"div",
|
|
7735
|
-
{
|
|
7736
|
-
className: "flex max-h-[80vh] w-full max-w-[640px] flex-col overflow-hidden rounded-[10px] border border-border bg-background shadow-lg",
|
|
7737
|
-
onClick: (e) => e.stopPropagation(),
|
|
7738
|
-
role: "dialog",
|
|
7739
|
-
"aria-modal": "true",
|
|
7740
|
-
"aria-label": `${title} details`,
|
|
7741
|
-
children: [
|
|
7742
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between gap-2 border-b border-border px-4 py-3", children: [
|
|
7743
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "min-w-0", children: [
|
|
7744
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "truncate text-[13px] font-medium text-foreground", children: title }),
|
|
7745
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "text-[11px] text-muted-foreground", children: [
|
|
7746
|
-
activity.type,
|
|
7747
|
-
" \xB7 ",
|
|
7748
|
-
activity.status
|
|
7749
|
-
] })
|
|
7750
|
-
] }),
|
|
7751
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7752
|
-
"button",
|
|
7753
|
-
{
|
|
7754
|
-
type: "button",
|
|
7755
|
-
onClick: onClose,
|
|
7756
|
-
className: "shrink-0 rounded-[6px] px-2 py-1 text-[12px] text-muted-foreground transition hover:bg-foreground/[0.06] hover:text-foreground",
|
|
7757
|
-
children: "Close"
|
|
7758
|
-
}
|
|
7759
|
-
)
|
|
7760
|
-
] }),
|
|
7761
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex-1 overflow-y-auto px-4 py-3 space-y-3", children: [
|
|
7762
|
-
activity.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "rounded-[6px] bg-red-500/[0.08] px-3 py-2 text-[12px] text-red-600", children: activity.error }),
|
|
7763
|
-
input && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
7764
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mb-1 text-[11px] font-medium uppercase text-muted-foreground", children: "Request" }),
|
|
7765
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "overflow-x-auto rounded-[6px] bg-foreground/[0.04] px-3 py-2 text-[12px] text-foreground whitespace-pre-wrap break-words", children: input })
|
|
7766
|
-
] }),
|
|
7767
|
-
result && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { children: [
|
|
7768
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mb-1 text-[11px] font-medium uppercase text-muted-foreground", children: "Result" }),
|
|
7769
|
-
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)("pre", { className: "overflow-x-auto rounded-[6px] bg-foreground/[0.04] px-3 py-2 text-[12px] text-foreground whitespace-pre-wrap break-words", children: result })
|
|
7770
|
-
] }),
|
|
7771
|
-
!input && !result && !activity.error && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "text-[12px] text-muted-foreground", children: "No additional detail for this step." })
|
|
7772
|
-
] })
|
|
7773
|
-
]
|
|
7774
|
-
}
|
|
7775
|
-
)
|
|
7776
|
-
}
|
|
7777
|
-
);
|
|
7778
|
-
}
|
|
7779
7858
|
|
|
7780
7859
|
// ../runtime-core/dist/index.js
|
|
7781
7860
|
var RUNTIME_KINDS = ["native-sdk", "app-server", "compatible-sdk", "cli-fallback"];
|
|
@@ -8337,13 +8416,13 @@ var PushTimelineStream = class {
|
|
|
8337
8416
|
};
|
|
8338
8417
|
|
|
8339
8418
|
// src/use-agent-session.ts
|
|
8340
|
-
var
|
|
8419
|
+
var import_react21 = require("react");
|
|
8341
8420
|
function useAgentSession(options) {
|
|
8342
|
-
const onTokenExpiredRef = (0,
|
|
8421
|
+
const onTokenExpiredRef = (0, import_react21.useRef)(options.onTokenExpired);
|
|
8343
8422
|
onTokenExpiredRef.current = options.onTokenExpired;
|
|
8344
|
-
const tokenRef = (0,
|
|
8423
|
+
const tokenRef = (0, import_react21.useRef)(options.token);
|
|
8345
8424
|
tokenRef.current = options.token;
|
|
8346
|
-
const runtime = (0,
|
|
8425
|
+
const runtime = (0, import_react21.useMemo)(() => {
|
|
8347
8426
|
return createDeferredAgentRuntime({
|
|
8348
8427
|
provider: "flitro",
|
|
8349
8428
|
runtimeKind: "app-server",
|
|
@@ -8356,7 +8435,7 @@ function useAgentSession(options) {
|
|
|
8356
8435
|
})
|
|
8357
8436
|
});
|
|
8358
8437
|
}, [options.server, options.sessionId]);
|
|
8359
|
-
(0,
|
|
8438
|
+
(0, import_react21.useEffect)(() => {
|
|
8360
8439
|
return () => {
|
|
8361
8440
|
void runtime.disposeIfCreated();
|
|
8362
8441
|
};
|
|
@@ -8441,9 +8520,12 @@ function createDeferredAgentRuntime(options) {
|
|
|
8441
8520
|
}
|
|
8442
8521
|
// Annotate the CommonJS export names for ESM import in node:
|
|
8443
8522
|
0 && (module.exports = {
|
|
8523
|
+
ActivityDetailsPanel,
|
|
8524
|
+
ActivityInspector,
|
|
8444
8525
|
AgentChatPanel,
|
|
8445
8526
|
AnnotationIslandMenu,
|
|
8446
8527
|
AnnotationOverlayLayer,
|
|
8528
|
+
AssistantTurnCard,
|
|
8447
8529
|
ChatTranscript,
|
|
8448
8530
|
CodeBlock,
|
|
8449
8531
|
CollapsibleMarkdownProvider,
|
|
@@ -8454,6 +8536,7 @@ function createDeferredAgentRuntime(options) {
|
|
|
8454
8536
|
Markdown,
|
|
8455
8537
|
MemoizedMarkdown,
|
|
8456
8538
|
PendingIndicator,
|
|
8539
|
+
PermissionModeMenu,
|
|
8457
8540
|
PermissionRequestCard,
|
|
8458
8541
|
PlatformProvider,
|
|
8459
8542
|
ResponseCard,
|