@parhelia/core 0.1.12749 → 0.1.12755
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/agents-view/AgentsView.js +3 -3
- package/dist/agents-view/AgentsView.js.map +1 -1
- package/dist/agents-view/AgentsWorkspaceView.js +28 -23
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/components/ui/PlaceholderInput.js +3 -3
- package/dist/components/ui/PlaceholderInput.js.map +1 -1
- package/dist/components/ui/PlaceholderInputTypes.js +2 -2
- package/dist/components/ui/PlaceholderInputTypes.js.map +1 -1
- package/dist/components/ui/PlaceholderItemSelector.js +2 -2
- package/dist/components/ui/PlaceholderItemSelector.js.map +1 -1
- package/dist/config/config.js +4 -1
- package/dist/config/config.js.map +1 -1
- package/dist/editor/LinkEditorDialog.js +2 -2
- package/dist/editor/LinkEditorDialog.js.map +1 -1
- package/dist/editor/MainLayout.d.ts +1 -0
- package/dist/editor/MainLayout.js +64 -1
- package/dist/editor/MainLayout.js.map +1 -1
- package/dist/editor/ai/AgentBanners.d.ts +11 -0
- package/dist/editor/ai/AgentBanners.js +16 -0
- package/dist/editor/ai/AgentBanners.js.map +1 -0
- package/dist/editor/ai/AgentCostDisplay.d.ts +12 -0
- package/dist/editor/ai/AgentCostDisplay.js +24 -1
- package/dist/editor/ai/AgentCostDisplay.js.map +1 -1
- package/dist/editor/ai/AgentDocumentList.js +5 -4
- package/dist/editor/ai/AgentDocumentList.js.map +1 -1
- package/dist/editor/ai/AgentInlineDialogContent.d.ts +17 -0
- package/dist/editor/ai/AgentInlineDialogContent.js +32 -0
- package/dist/editor/ai/AgentInlineDialogContent.js.map +1 -0
- package/dist/editor/ai/AgentSharingSection.d.ts +6 -0
- package/dist/editor/ai/AgentSharingSection.js +149 -0
- package/dist/editor/ai/AgentSharingSection.js.map +1 -0
- package/dist/editor/ai/AgentTerminal.d.ts +2 -1
- package/dist/editor/ai/AgentTerminal.js +288 -984
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/AgentTerminalStatusBar.d.ts +18 -0
- package/dist/editor/ai/AgentTerminalStatusBar.js +388 -125
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/Agents.js +10 -5
- package/dist/editor/ai/Agents.js.map +1 -1
- package/dist/editor/ai/HeartbeatMessage.d.ts +4 -0
- package/dist/editor/ai/HeartbeatMessage.js +7 -0
- package/dist/editor/ai/HeartbeatMessage.js.map +1 -0
- package/dist/editor/ai/InitialThinkingSplash.d.ts +3 -0
- package/dist/editor/ai/InitialThinkingSplash.js +9 -0
- package/dist/editor/ai/InitialThinkingSplash.js.map +1 -0
- package/dist/editor/ai/InlineAiDialog.js +49 -1
- package/dist/editor/ai/InlineAiDialog.js.map +1 -1
- package/dist/editor/ai/QueuedPromptsPanel.d.ts +4 -0
- package/dist/editor/ai/QueuedPromptsPanel.js +36 -0
- package/dist/editor/ai/QueuedPromptsPanel.js.map +1 -0
- package/dist/editor/ai/TodoListPanel.d.ts +5 -0
- package/dist/editor/ai/TodoListPanel.js +113 -0
- package/dist/editor/ai/TodoListPanel.js.map +1 -0
- package/dist/editor/ai/ToolCallDisplay.js +54 -10
- package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
- package/dist/editor/ai/UserMessage.d.ts +4 -0
- package/dist/editor/ai/UserMessage.js +42 -0
- package/dist/editor/ai/UserMessage.js.map +1 -0
- package/dist/editor/ai/agentMessageConversion.d.ts +11 -0
- package/dist/editor/ai/agentMessageConversion.js +134 -0
- package/dist/editor/ai/agentMessageConversion.js.map +1 -0
- package/dist/editor/ai/agentMessageGrouping.d.ts +22 -0
- package/dist/editor/ai/agentMessageGrouping.js +103 -0
- package/dist/editor/ai/agentMessageGrouping.js.map +1 -0
- package/dist/editor/ai/agentMessageHelpers.d.ts +23 -0
- package/dist/editor/ai/agentMessageHelpers.js +124 -0
- package/dist/editor/ai/agentMessageHelpers.js.map +1 -0
- package/dist/editor/ai/agentMessageMarkdown.d.ts +2 -0
- package/dist/editor/ai/agentMessageMarkdown.js +14 -0
- package/dist/editor/ai/agentMessageMarkdown.js.map +1 -0
- package/dist/editor/ai/agentTodoExtraction.d.ts +12 -0
- package/dist/editor/ai/agentTodoExtraction.js +205 -0
- package/dist/editor/ai/agentTodoExtraction.js.map +1 -0
- package/dist/editor/ai/useAgentStatus.js +2 -2
- package/dist/editor/ai/useAgentStatus.js.map +1 -1
- package/dist/editor/client/EditorShell.js +19 -1
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +5 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/operations.d.ts +4 -1
- package/dist/editor/client/operations.js +57 -5
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.js +3 -4
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/commands/componentCommands.js +35 -2
- package/dist/editor/commands/componentCommands.js.map +1 -1
- package/dist/editor/menubar/ItemLanguageVersion.js +22 -3
- package/dist/editor/menubar/ItemLanguageVersion.js.map +1 -1
- package/dist/editor/menubar/PreviewDatePicker.d.ts +1 -0
- package/dist/editor/menubar/PreviewDatePicker.js +55 -0
- package/dist/editor/menubar/PreviewDatePicker.js.map +1 -0
- package/dist/editor/menubar/VersionPreviewCard.js +34 -3
- package/dist/editor/menubar/VersionPreviewCard.js.map +1 -1
- package/dist/editor/menubar/VersionSelector.d.ts +2 -1
- package/dist/editor/menubar/VersionSelector.js +14 -15
- package/dist/editor/menubar/VersionSelector.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js +2 -2
- package/dist/editor/menubar/toolbar-sections/ViewportControls.js.map +1 -1
- package/dist/editor/page-editor-chrome/FrameMenu.js +2 -2
- package/dist/editor/page-editor-chrome/FrameMenu.js.map +1 -1
- package/dist/editor/page-viewer/EditorForm.js +81 -1
- package/dist/editor/page-viewer/EditorForm.js.map +1 -1
- package/dist/editor/page-viewer/PageViewer.js +22 -90
- package/dist/editor/page-viewer/PageViewer.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +12 -2
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js +4 -0
- package/dist/editor/page-viewer/pageModelSkeletonBuilder.js.map +1 -1
- package/dist/editor/page-viewer/pageViewContext.d.ts +2 -0
- package/dist/editor/page-viewer/pageViewContext.js +8 -1
- package/dist/editor/page-viewer/pageViewContext.js.map +1 -1
- package/dist/editor/pageModel.d.ts +2 -0
- package/dist/editor/personalization/ActionList.d.ts +7 -0
- package/dist/editor/personalization/ActionList.js +16 -0
- package/dist/editor/personalization/ActionList.js.map +1 -0
- package/dist/editor/personalization/ConditionTreeEditor.d.ts +7 -0
- package/dist/editor/personalization/ConditionTreeEditor.js +117 -0
- package/dist/editor/personalization/ConditionTreeEditor.js.map +1 -0
- package/dist/editor/personalization/PersonalizationPanel.d.ts +12 -0
- package/dist/editor/personalization/PersonalizationPanel.js +308 -0
- package/dist/editor/personalization/PersonalizationPanel.js.map +1 -0
- package/dist/editor/personalization/RuleElementPicker.d.ts +11 -0
- package/dist/editor/personalization/RuleElementPicker.js +68 -0
- package/dist/editor/personalization/RuleElementPicker.js.map +1 -0
- package/dist/editor/personalization/RuleList.d.ts +19 -0
- package/dist/editor/personalization/RuleList.js +132 -0
- package/dist/editor/personalization/RuleList.js.map +1 -0
- package/dist/editor/personalization/RuleParameterInput.d.ts +10 -0
- package/dist/editor/personalization/RuleParameterInput.js +115 -0
- package/dist/editor/personalization/RuleParameterInput.js.map +1 -0
- package/dist/editor/personalization/TreeItemPicker.d.ts +9 -0
- package/dist/editor/personalization/TreeItemPicker.js +115 -0
- package/dist/editor/personalization/TreeItemPicker.js.map +1 -0
- package/dist/editor/personalization/utils.d.ts +6 -0
- package/dist/editor/personalization/utils.js +37 -0
- package/dist/editor/personalization/utils.js.map +1 -0
- package/dist/editor/reviews/SuggestedEdit.js +65 -48
- package/dist/editor/reviews/SuggestedEdit.js.map +1 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js +5 -1
- package/dist/editor/reviews/SuggestionDisplayPopover.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +24 -0
- package/dist/editor/services/agentService.js +40 -0
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/agentStatus.d.ts +1 -0
- package/dist/editor/services/agentStatus.js +55 -1
- package/dist/editor/services/agentStatus.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +10 -0
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +5 -0
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/personalizationService.d.ts +5 -0
- package/dist/editor/services/personalizationService.js +32 -0
- package/dist/editor/services/personalizationService.js.map +1 -0
- package/dist/editor/services/serviceHelper.d.ts +1 -1
- package/dist/editor/services/serviceHelper.js +2 -1
- package/dist/editor/services/serviceHelper.js.map +1 -1
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js +1 -1
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js.map +1 -1
- package/dist/editor/sidebar/OperationItem.js +1 -0
- package/dist/editor/sidebar/OperationItem.js.map +1 -1
- package/dist/editor/sidebar/SidebarPanel.js +3 -3
- package/dist/editor/sidebar/SidebarPanel.js.map +1 -1
- package/dist/editor/ui/PublishRestrictionsDialog.js +1 -0
- package/dist/editor/ui/PublishRestrictionsDialog.js.map +1 -1
- package/dist/editor/ui/SimpleTabs.d.ts +1 -0
- package/dist/editor/ui/SimpleTabs.js +2 -2
- package/dist/editor/ui/SimpleTabs.js.map +1 -1
- package/dist/editor/ui/Splitter.d.ts +4 -0
- package/dist/editor/ui/Splitter.js +42 -17
- package/dist/editor/ui/Splitter.js.map +1 -1
- package/dist/editor/utils/sitecoreDate.d.ts +2 -0
- package/dist/editor/utils/sitecoreDate.js +27 -0
- package/dist/editor/utils/sitecoreDate.js.map +1 -0
- package/dist/editor/utils/versionAtDate.d.ts +2 -0
- package/dist/editor/utils/versionAtDate.js +23 -0
- package/dist/editor/utils/versionAtDate.js.map +1 -0
- package/dist/lib/viewTransition.d.ts +1 -0
- package/dist/lib/viewTransition.js +17 -0
- package/dist/lib/viewTransition.js.map +1 -0
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/task-board/TaskBoardWorkspace.js +126 -87
- package/dist/task-board/TaskBoardWorkspace.js.map +1 -1
- package/dist/task-board/components/ProjectAgentsPanel.js +2 -2
- package/dist/task-board/components/ProjectAgentsPanel.js.map +1 -1
- package/dist/task-board/components/ProjectDashboard.js +2 -3
- package/dist/task-board/components/ProjectDashboard.js.map +1 -1
- package/dist/task-board/components/ProjectPropertiesPanel.js +76 -24
- package/dist/task-board/components/ProjectPropertiesPanel.js.map +1 -1
- package/dist/task-board/components/TaskBoardTitlebar.js +2 -1
- package/dist/task-board/components/TaskBoardTitlebar.js.map +1 -1
- package/dist/task-board/components/TaskDetailPanel.d.ts +10 -0
- package/dist/task-board/components/TaskDetailPanel.js +10 -5
- package/dist/task-board/components/TaskDetailPanel.js.map +1 -1
- package/dist/types.d.ts +55 -1
- package/package.json +1 -1
- package/styles.css +11 -10
- package/dist/task-board/components/AssignAgentDialog.d.ts +0 -7
- package/dist/task-board/components/AssignAgentDialog.js +0 -104
- package/dist/task-board/components/AssignAgentDialog.js.map +0 -1
|
@@ -12,11 +12,20 @@ export type LiveTotals = {
|
|
|
12
12
|
output: number;
|
|
13
13
|
cached: number;
|
|
14
14
|
cacheWrite?: number;
|
|
15
|
+
inputAudio?: number;
|
|
16
|
+
outputAudio?: number;
|
|
17
|
+
outputImage?: number;
|
|
18
|
+
reasoning?: number;
|
|
15
19
|
inputCost: number;
|
|
16
20
|
outputCost: number;
|
|
17
21
|
cachedCost: number;
|
|
18
22
|
cacheWriteCost?: number;
|
|
23
|
+
inputAudioCost?: number;
|
|
24
|
+
outputAudioCost?: number;
|
|
25
|
+
outputImageCost?: number;
|
|
19
26
|
imageCost: number;
|
|
27
|
+
markupCost?: number;
|
|
28
|
+
reportedTotalCost?: number;
|
|
20
29
|
totalCost: number;
|
|
21
30
|
currency?: string;
|
|
22
31
|
} | null;
|
|
@@ -25,12 +34,21 @@ export type TotalTokensForDisplay = {
|
|
|
25
34
|
output: number;
|
|
26
35
|
cached: number;
|
|
27
36
|
cacheWrite: number;
|
|
37
|
+
inputAudio?: number;
|
|
38
|
+
outputAudio?: number;
|
|
39
|
+
outputImage?: number;
|
|
40
|
+
reasoning?: number;
|
|
28
41
|
totalCost: number;
|
|
29
42
|
inputCost: number;
|
|
30
43
|
outputCost: number;
|
|
31
44
|
cachedCost: number;
|
|
32
45
|
cacheWriteCost: number;
|
|
46
|
+
inputAudioCost?: number;
|
|
47
|
+
outputAudioCost?: number;
|
|
48
|
+
outputImageCost?: number;
|
|
33
49
|
imageCost: number;
|
|
50
|
+
markupCost?: number;
|
|
51
|
+
reportedTotalCost?: number;
|
|
34
52
|
};
|
|
35
53
|
export interface AgentTerminalStatusBarProps {
|
|
36
54
|
agent: AgentDetails | undefined;
|
|
@@ -3,7 +3,7 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
3
3
|
import { Bug } from "lucide-react";
|
|
4
4
|
import { Popover, PopoverContent, PopoverTrigger, } from "../../components/ui/popover";
|
|
5
5
|
import { Tooltip, TooltipContent, TooltipTrigger, } from "../../components/ui/tooltip";
|
|
6
|
-
import { getAgentDiagnostics, getLastPayload, } from "../services/agentService";
|
|
6
|
+
import { getAgentDiagnostics, getAgentOperationAllowances, getLastPayload, } from "../services/agentService";
|
|
7
7
|
import { AgentCostDisplay } from "./AgentCostDisplay";
|
|
8
8
|
import { ContentInspectorPopover, } from "./ContentInspectorPopover";
|
|
9
9
|
import { formatAgentDiagnosticsEvent, formatSeqRanges, interpretAgentRunDiagnostics, } from "./agentDiagnostics";
|
|
@@ -19,6 +19,12 @@ function yesNo(value) {
|
|
|
19
19
|
function lines(values) {
|
|
20
20
|
return values.filter(Boolean).join("\n");
|
|
21
21
|
}
|
|
22
|
+
function joinSubsections(subsections) {
|
|
23
|
+
return subsections
|
|
24
|
+
.map((s) => (s && s.content ? `── ${s.title} ──\n${s.content}` : null))
|
|
25
|
+
.filter((v) => Boolean(v))
|
|
26
|
+
.join("\n\n");
|
|
27
|
+
}
|
|
22
28
|
const CLIENT_SOCKET_RAW_MESSAGE_MAX_LENGTH = 10_000;
|
|
23
29
|
function formatClientSocketMessageEvent(event) {
|
|
24
30
|
const header = formatAgentDiagnosticsEvent(event);
|
|
@@ -267,8 +273,218 @@ function buildPersistentLogsSection(persistentLogs) {
|
|
|
267
273
|
: undefined,
|
|
268
274
|
};
|
|
269
275
|
}
|
|
276
|
+
function formatNumber(value) {
|
|
277
|
+
if (value == null || !Number.isFinite(value))
|
|
278
|
+
return "—";
|
|
279
|
+
return value.toLocaleString();
|
|
280
|
+
}
|
|
281
|
+
function formatCost(value, currency) {
|
|
282
|
+
if (value == null || !Number.isFinite(value))
|
|
283
|
+
return "—";
|
|
284
|
+
return `${value.toFixed(4)} ${currency}`;
|
|
285
|
+
}
|
|
286
|
+
function formatPercent(value) {
|
|
287
|
+
if (value == null || !Number.isFinite(value))
|
|
288
|
+
return "—";
|
|
289
|
+
return `${value.toFixed(1)}%`;
|
|
290
|
+
}
|
|
291
|
+
function buildAgentSummaryLines(agentId, agent, resolvedModelName) {
|
|
292
|
+
if (!agent) {
|
|
293
|
+
return [`Agent ID: ${agentId}`, "Agent details: not available"];
|
|
294
|
+
}
|
|
295
|
+
return [
|
|
296
|
+
`Agent: ${agent.name || "—"}`,
|
|
297
|
+
`Agent ID: ${agent.id}`,
|
|
298
|
+
`Agent status: ${agent.status || "—"}`,
|
|
299
|
+
agent.statusMessage ? `Agent status message: ${agent.statusMessage}` : null,
|
|
300
|
+
`Profile: ${agent.profileName || "—"}${agent.profileId ? ` (${agent.profileId})` : ""}`,
|
|
301
|
+
`Model: ${resolvedModelName || agent.model || "—"}`,
|
|
302
|
+
`Owner: ${agent.ownerName || agent.userId || "—"}`,
|
|
303
|
+
agent.visibilityMode ? `Visibility: ${agent.visibilityMode}` : null,
|
|
304
|
+
agent.effectiveAccessLevel
|
|
305
|
+
? `Access level: ${agent.effectiveAccessLevel}`
|
|
306
|
+
: null,
|
|
307
|
+
agent.parentAgentId ? `Parent agent: ${agent.parentAgentId}` : null,
|
|
308
|
+
`Created: ${formatDiagnosticTime(agent.createdDate)}`,
|
|
309
|
+
`Updated: ${formatDiagnosticTime(agent.updatedDate)}`,
|
|
310
|
+
`Last message: ${formatDiagnosticTime(agent.lastMessageDate)}`,
|
|
311
|
+
agent.nextRunAt
|
|
312
|
+
? `Next scheduled run: ${formatDiagnosticTime(agent.nextRunAt)}`
|
|
313
|
+
: null,
|
|
314
|
+
`Messages in conversation: ${agent.messageCount ?? 0}`,
|
|
315
|
+
agent.compressionMarkerIndex != null
|
|
316
|
+
? `Compression marker index: ${agent.compressionMarkerIndex}`
|
|
317
|
+
: null,
|
|
318
|
+
agent.triggerSubscriptionCount != null
|
|
319
|
+
? `Trigger subscriptions: ${agent.triggerSubscriptionCount}`
|
|
320
|
+
: null,
|
|
321
|
+
agent.assignedSkillIds && agent.assignedSkillIds.length > 0
|
|
322
|
+
? `Assigned skills (${agent.assignedSkillIds.length}): ${agent.assignedSkillIds.join(", ")}`
|
|
323
|
+
: `Assigned skills: none`,
|
|
324
|
+
];
|
|
325
|
+
}
|
|
326
|
+
function buildTokensSection(params) {
|
|
327
|
+
const { agent, liveTotals, totalTokens, contextWindowStatus, costLimit, resolvedModelName, } = params;
|
|
328
|
+
const currency = liveTotals?.currency || agent?.currency || "USD";
|
|
329
|
+
const breakdown = liveTotals ?? totalTokens;
|
|
330
|
+
const totalCost = breakdown?.totalCost ?? agent?.totalCost ?? 0;
|
|
331
|
+
const limitPercent = costLimit && costLimit > 0 ? (totalCost / costLimit) * 100 : null;
|
|
332
|
+
const liveSection = breakdown
|
|
333
|
+
? joinSubsections([
|
|
334
|
+
{
|
|
335
|
+
title: "Current run / live totals",
|
|
336
|
+
content: lines([
|
|
337
|
+
`Input tokens: ${formatNumber(breakdown.input)} (${formatCost(breakdown.inputCost, currency)})`,
|
|
338
|
+
`Output tokens: ${formatNumber(breakdown.output)} (${formatCost(breakdown.outputCost, currency)})`,
|
|
339
|
+
`Cached input tokens: ${formatNumber(breakdown.cached)} (${formatCost(breakdown.cachedCost, currency)})`,
|
|
340
|
+
breakdown.cacheWrite || breakdown.cacheWriteCost
|
|
341
|
+
? `Cache write tokens: ${formatNumber(breakdown.cacheWrite ?? 0)} (${formatCost(breakdown.cacheWriteCost ?? 0, currency)})`
|
|
342
|
+
: null,
|
|
343
|
+
breakdown.reasoning
|
|
344
|
+
? `Reasoning tokens: ${formatNumber(breakdown.reasoning)}`
|
|
345
|
+
: null,
|
|
346
|
+
breakdown.inputAudio || breakdown.inputAudioCost
|
|
347
|
+
? `Input audio tokens: ${formatNumber(breakdown.inputAudio ?? 0)} (${formatCost(breakdown.inputAudioCost ?? 0, currency)})`
|
|
348
|
+
: null,
|
|
349
|
+
breakdown.outputAudio || breakdown.outputAudioCost
|
|
350
|
+
? `Output audio tokens: ${formatNumber(breakdown.outputAudio ?? 0)} (${formatCost(breakdown.outputAudioCost ?? 0, currency)})`
|
|
351
|
+
: null,
|
|
352
|
+
breakdown.outputImage || breakdown.outputImageCost
|
|
353
|
+
? `Output image tokens: ${formatNumber(breakdown.outputImage ?? 0)} (${formatCost(breakdown.outputImageCost ?? 0, currency)})`
|
|
354
|
+
: null,
|
|
355
|
+
breakdown.imageCost
|
|
356
|
+
? `Image cost: ${formatCost(breakdown.imageCost, currency)}`
|
|
357
|
+
: null,
|
|
358
|
+
"markupCost" in breakdown && breakdown.markupCost
|
|
359
|
+
? `Provider markup: ${formatCost(breakdown.markupCost, currency)}`
|
|
360
|
+
: null,
|
|
361
|
+
"reportedTotalCost" in breakdown &&
|
|
362
|
+
breakdown.reportedTotalCost != null
|
|
363
|
+
? `Provider-reported total: ${formatCost(breakdown.reportedTotalCost, currency)}`
|
|
364
|
+
: null,
|
|
365
|
+
]),
|
|
366
|
+
},
|
|
367
|
+
])
|
|
368
|
+
: "No token usage has been recorded for the current run yet.";
|
|
369
|
+
const cumulativeSection = agent
|
|
370
|
+
? joinSubsections([
|
|
371
|
+
{
|
|
372
|
+
title: "Cumulative (entire conversation)",
|
|
373
|
+
content: lines([
|
|
374
|
+
`Total tokens used: ${formatNumber(agent.totalTokensUsed)}`,
|
|
375
|
+
`Input tokens: ${formatNumber(agent.totalInputTokens)} (${formatCost(agent.totalInputTokenCost, currency)})`,
|
|
376
|
+
`Output tokens: ${formatNumber(agent.totalOutputTokens)} (${formatCost(agent.totalOutputTokenCost, currency)})`,
|
|
377
|
+
`Cached input tokens: ${formatNumber(agent.totalCachedInputTokens)} (${formatCost(agent.totalCachedInputTokenCost, currency)})`,
|
|
378
|
+
agent.totalImageCost
|
|
379
|
+
? `Image cost: ${formatCost(agent.totalImageCost, currency)}`
|
|
380
|
+
: null,
|
|
381
|
+
`Total cost: ${formatCost(agent.totalCost, currency)}`,
|
|
382
|
+
]),
|
|
383
|
+
},
|
|
384
|
+
])
|
|
385
|
+
: "";
|
|
386
|
+
const limitSection = joinSubsections([
|
|
387
|
+
{
|
|
388
|
+
title: "Cost limit",
|
|
389
|
+
content: lines([
|
|
390
|
+
`Cost limit: ${costLimit != null && costLimit > 0 ? formatCost(costLimit, currency) : "Unlimited"}`,
|
|
391
|
+
limitPercent != null
|
|
392
|
+
? `Used: ${formatCost(totalCost, currency)} (${formatPercent(limitPercent)})`
|
|
393
|
+
: `Used: ${formatCost(totalCost, currency)}`,
|
|
394
|
+
]),
|
|
395
|
+
},
|
|
396
|
+
]);
|
|
397
|
+
const contextSection = contextWindowStatus
|
|
398
|
+
? joinSubsections([
|
|
399
|
+
{
|
|
400
|
+
title: "Context window",
|
|
401
|
+
content: lines([
|
|
402
|
+
resolvedModelName ? `Model: ${resolvedModelName}` : null,
|
|
403
|
+
`Window size: ${formatNumber(contextWindowStatus.contextWindowTokens)} tokens`,
|
|
404
|
+
`Estimated input tokens: ${formatNumber(contextWindowStatus.estimatedInputTokens)}`,
|
|
405
|
+
`Used: ${formatPercent(contextWindowStatus.contextUsedPercent)}`,
|
|
406
|
+
agent?.contextUsedTokens != null
|
|
407
|
+
? `Persisted context tokens: ${formatNumber(agent.contextUsedTokens)}`
|
|
408
|
+
: null,
|
|
409
|
+
agent?.contextWindowTokens != null
|
|
410
|
+
? `Persisted window size: ${formatNumber(agent.contextWindowTokens)}`
|
|
411
|
+
: null,
|
|
412
|
+
]),
|
|
413
|
+
},
|
|
414
|
+
])
|
|
415
|
+
: agent?.contextUsedTokens != null || agent?.contextWindowTokens != null
|
|
416
|
+
? joinSubsections([
|
|
417
|
+
{
|
|
418
|
+
title: "Context window",
|
|
419
|
+
content: lines([
|
|
420
|
+
resolvedModelName ? `Model: ${resolvedModelName}` : null,
|
|
421
|
+
agent?.contextWindowTokens != null
|
|
422
|
+
? `Window size: ${formatNumber(agent.contextWindowTokens)} tokens`
|
|
423
|
+
: null,
|
|
424
|
+
agent?.contextUsedTokens != null
|
|
425
|
+
? `Used tokens: ${formatNumber(agent.contextUsedTokens)}`
|
|
426
|
+
: null,
|
|
427
|
+
]),
|
|
428
|
+
},
|
|
429
|
+
])
|
|
430
|
+
: "";
|
|
431
|
+
const content = [liveSection, cumulativeSection, limitSection, contextSection]
|
|
432
|
+
.filter((s) => s && s.length > 0)
|
|
433
|
+
.join("\n\n");
|
|
434
|
+
return {
|
|
435
|
+
title: "Tokens & cost",
|
|
436
|
+
content: content || "No token or cost information is available yet.",
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function buildAllowancesSection(allowances) {
|
|
440
|
+
if (!allowances) {
|
|
441
|
+
return {
|
|
442
|
+
title: "Allowances",
|
|
443
|
+
content: "Operation allowances could not be loaded.",
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
const sitecore = allowances.sitecore ?? [];
|
|
447
|
+
const filesystem = allowances.filesystem ?? [];
|
|
448
|
+
const sitecoreBlock = sitecore.length > 0
|
|
449
|
+
? sitecore
|
|
450
|
+
.map((a) => lines([
|
|
451
|
+
`• ${a.itemPath}`,
|
|
452
|
+
` ID: ${a.itemId}`,
|
|
453
|
+
` Operation: ${a.operationType}`,
|
|
454
|
+
` Scope: ${a.scopeType}`,
|
|
455
|
+
a.source ? ` Source: ${a.source}` : null,
|
|
456
|
+
a.grantedBy ? ` Granted by: ${a.grantedBy}` : null,
|
|
457
|
+
a.grantedAt ? ` Granted at: ${formatDiagnosticTime(a.grantedAt)}` : null,
|
|
458
|
+
]))
|
|
459
|
+
.join("\n")
|
|
460
|
+
: "No Sitecore item allowances granted.";
|
|
461
|
+
const filesystemBlock = filesystem.length > 0
|
|
462
|
+
? filesystem
|
|
463
|
+
.map((a) => lines([
|
|
464
|
+
`• ${a.normalizedPath}`,
|
|
465
|
+
` Operation: ${a.operationType}`,
|
|
466
|
+
a.source ? ` Source: ${a.source}` : null,
|
|
467
|
+
a.grantedBy ? ` Granted by: ${a.grantedBy}` : null,
|
|
468
|
+
a.grantedAt ? ` Granted at: ${formatDiagnosticTime(a.grantedAt)}` : null,
|
|
469
|
+
]))
|
|
470
|
+
.join("\n")
|
|
471
|
+
: "No filesystem allowances granted.";
|
|
472
|
+
return {
|
|
473
|
+
title: `Allowances (${sitecore.length + filesystem.length})`,
|
|
474
|
+
content: joinSubsections([
|
|
475
|
+
{
|
|
476
|
+
title: `Sitecore items (${sitecore.length})`,
|
|
477
|
+
content: sitecoreBlock,
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
title: `Filesystem paths (${filesystem.length})`,
|
|
481
|
+
content: filesystemBlock,
|
|
482
|
+
},
|
|
483
|
+
]),
|
|
484
|
+
};
|
|
485
|
+
}
|
|
270
486
|
function buildDiagnosticsSections(params) {
|
|
271
|
-
const { socketDiagnostics, runDiagnosticsSnapshot, serverDiagnostics, messages, payload, rawResponse, } = params;
|
|
487
|
+
const { agent, socketDiagnostics, runDiagnosticsSnapshot, serverDiagnostics, allowances, liveTotals, totalTokens, contextWindowStatus, costLimit, resolvedModelName = "", messages, payload, rawResponse, } = params;
|
|
272
488
|
const summary = interpretAgentRunDiagnostics({
|
|
273
489
|
socketDiagnostics,
|
|
274
490
|
localSnapshot: runDiagnosticsSnapshot,
|
|
@@ -279,19 +495,7 @@ function buildDiagnosticsSections(params) {
|
|
|
279
495
|
const lastResponse = extractLastResponseFromRawResponse(rawResponse) ||
|
|
280
496
|
extractLastMessageByRole(messages, "assistant");
|
|
281
497
|
const machineCapacitySection = buildMachineCapacitySection(params.agentId, serverDiagnostics);
|
|
282
|
-
const
|
|
283
|
-
{
|
|
284
|
-
title: "Summary",
|
|
285
|
-
content: lines([
|
|
286
|
-
`Diagnosis: ${summary.title}`,
|
|
287
|
-
summary.detail,
|
|
288
|
-
`Socket: ${socketDiagnostics.readyStateLabel}`,
|
|
289
|
-
`Session connected: ${yesNo(serverDiagnostics.currentSession.isConnected)}`,
|
|
290
|
-
`Session subscribed: ${yesNo(serverDiagnostics.currentSession.isSubscribed)}`,
|
|
291
|
-
`Server status: ${serverDiagnostics.execution.status || "unknown"}`,
|
|
292
|
-
`Last seq: ${serverDiagnostics.transport.lastSeq ?? runDiagnosticsSnapshot.lastSeq ?? "—"}`,
|
|
293
|
-
]),
|
|
294
|
-
},
|
|
498
|
+
const connectionContent = joinSubsections([
|
|
295
499
|
{
|
|
296
500
|
title: "Client connection",
|
|
297
501
|
content: lines([
|
|
@@ -315,7 +519,31 @@ function buildDiagnosticsSections(params) {
|
|
|
315
519
|
]),
|
|
316
520
|
},
|
|
317
521
|
{
|
|
318
|
-
title: "
|
|
522
|
+
title: "Current session",
|
|
523
|
+
content: lines([
|
|
524
|
+
`Session found: ${yesNo(serverDiagnostics.currentSession.sessionFound)}`,
|
|
525
|
+
`Browser matched: ${yesNo(serverDiagnostics.currentSession.browserMatched)}`,
|
|
526
|
+
`Connected: ${yesNo(serverDiagnostics.currentSession.isConnected)}`,
|
|
527
|
+
`Subscribed: ${yesNo(serverDiagnostics.currentSession.isSubscribed)}`,
|
|
528
|
+
`Connected at: ${formatDiagnosticTime(serverDiagnostics.currentSession.connectedAt)}`,
|
|
529
|
+
`Last delivery attempt: ${formatDiagnosticTime(serverDiagnostics.currentSession.lastDelivery?.lastAttemptAt)}`,
|
|
530
|
+
`Last delivery success: ${formatDiagnosticTime(serverDiagnostics.currentSession.lastDelivery?.lastSuccessAt)}`,
|
|
531
|
+
`Last delivery failure: ${formatDiagnosticTime(serverDiagnostics.currentSession.lastDelivery?.lastFailureAt)}`,
|
|
532
|
+
serverDiagnostics.currentSession.lastDelivery?.lastFailureReason
|
|
533
|
+
? `Failure reason: ${serverDiagnostics.currentSession.lastDelivery.lastFailureReason}`
|
|
534
|
+
: null,
|
|
535
|
+
serverDiagnostics.currentSession.lastDelivery?.lastMessageType
|
|
536
|
+
? `Last delivered message: ${serverDiagnostics.currentSession.lastDelivery.lastMessageType}`
|
|
537
|
+
: null,
|
|
538
|
+
serverDiagnostics.currentSession.lastDelivery?.lastSeq != null
|
|
539
|
+
? `Last delivered seq: ${serverDiagnostics.currentSession.lastDelivery.lastSeq}`
|
|
540
|
+
: null,
|
|
541
|
+
]),
|
|
542
|
+
},
|
|
543
|
+
]);
|
|
544
|
+
const runContent = joinSubsections([
|
|
545
|
+
{
|
|
546
|
+
title: "Agent stream (client)",
|
|
319
547
|
content: lines([
|
|
320
548
|
`Submitting: ${yesNo(runDiagnosticsSnapshot.isSubmitting)}`,
|
|
321
549
|
`Connecting: ${yesNo(runDiagnosticsSnapshot.isConnecting)}`,
|
|
@@ -340,17 +568,6 @@ function buildDiagnosticsSections(params) {
|
|
|
340
568
|
`Last local event: ${runDiagnosticsSnapshot.lastEventType || "—"} @ ${formatDiagnosticTime(runDiagnosticsSnapshot.lastEventAt)}`,
|
|
341
569
|
]),
|
|
342
570
|
},
|
|
343
|
-
{
|
|
344
|
-
title: "Tool UI state",
|
|
345
|
-
content: lines([
|
|
346
|
-
`Assistant messages: ${runDiagnosticsSnapshot.assistantMessageCount}`,
|
|
347
|
-
`Assistant groups: ${runDiagnosticsSnapshot.assistantGroupCount}`,
|
|
348
|
-
`Groups with renderable tool calls: ${runDiagnosticsSnapshot.assistantGroupsWithRenderableToolCalls}`,
|
|
349
|
-
`Messages with tool calls: ${runDiagnosticsSnapshot.messagesWithToolCalls}`,
|
|
350
|
-
`Total tool calls in local state: ${runDiagnosticsSnapshot.totalToolCallCount}`,
|
|
351
|
-
`Incomplete tool calls in local state: ${runDiagnosticsSnapshot.incompleteToolCallCount}`,
|
|
352
|
-
]),
|
|
353
|
-
},
|
|
354
571
|
{
|
|
355
572
|
title: "Server execution",
|
|
356
573
|
content: lines([
|
|
@@ -376,8 +593,6 @@ function buildDiagnosticsSections(params) {
|
|
|
376
593
|
: null,
|
|
377
594
|
]),
|
|
378
595
|
},
|
|
379
|
-
...(machineCapacitySection ? [machineCapacitySection] : []),
|
|
380
|
-
buildPersistentLogsSection(serverDiagnostics.persistentLogs ?? []),
|
|
381
596
|
{
|
|
382
597
|
title: "Run telemetry",
|
|
383
598
|
content: lines([
|
|
@@ -405,112 +620,149 @@ function buildDiagnosticsSections(params) {
|
|
|
405
620
|
]),
|
|
406
621
|
},
|
|
407
622
|
{
|
|
408
|
-
title: "
|
|
623
|
+
title: "Tool UI state",
|
|
409
624
|
content: lines([
|
|
410
|
-
`
|
|
411
|
-
`
|
|
412
|
-
`
|
|
413
|
-
`
|
|
414
|
-
`
|
|
415
|
-
`
|
|
416
|
-
`Last delivery success: ${formatDiagnosticTime(serverDiagnostics.currentSession.lastDelivery?.lastSuccessAt)}`,
|
|
417
|
-
`Last delivery failure: ${formatDiagnosticTime(serverDiagnostics.currentSession.lastDelivery?.lastFailureAt)}`,
|
|
418
|
-
serverDiagnostics.currentSession.lastDelivery?.lastFailureReason
|
|
419
|
-
? `Failure reason: ${serverDiagnostics.currentSession.lastDelivery.lastFailureReason}`
|
|
420
|
-
: null,
|
|
421
|
-
serverDiagnostics.currentSession.lastDelivery?.lastMessageType
|
|
422
|
-
? `Last delivered message: ${serverDiagnostics.currentSession.lastDelivery.lastMessageType}`
|
|
423
|
-
: null,
|
|
424
|
-
serverDiagnostics.currentSession.lastDelivery?.lastSeq != null
|
|
425
|
-
? `Last delivered seq: ${serverDiagnostics.currentSession.lastDelivery.lastSeq}`
|
|
426
|
-
: null,
|
|
625
|
+
`Assistant messages: ${runDiagnosticsSnapshot.assistantMessageCount}`,
|
|
626
|
+
`Assistant groups: ${runDiagnosticsSnapshot.assistantGroupCount}`,
|
|
627
|
+
`Groups with renderable tool calls: ${runDiagnosticsSnapshot.assistantGroupsWithRenderableToolCalls}`,
|
|
628
|
+
`Messages with tool calls: ${runDiagnosticsSnapshot.messagesWithToolCalls}`,
|
|
629
|
+
`Total tool calls in local state: ${runDiagnosticsSnapshot.totalToolCallCount}`,
|
|
630
|
+
`Incomplete tool calls in local state: ${runDiagnosticsSnapshot.incompleteToolCallCount}`,
|
|
427
631
|
]),
|
|
428
632
|
},
|
|
633
|
+
]);
|
|
634
|
+
const clientEventsBlock = (() => {
|
|
635
|
+
const events = runDiagnosticsSnapshot.recentEvents;
|
|
636
|
+
if (events.length === 0) {
|
|
637
|
+
return "No recent client-side agent stream events were captured for this terminal.";
|
|
638
|
+
}
|
|
639
|
+
const total = runDiagnosticsSnapshot.currentRunTotalEventCount;
|
|
640
|
+
const header = total > events.length
|
|
641
|
+
? `Showing last ${events.length} of ${total} agent:run:* events received in current run.`
|
|
642
|
+
: `Showing all ${events.length} agent:run:* events received in current run.`;
|
|
643
|
+
const body = events
|
|
644
|
+
.slice()
|
|
645
|
+
.reverse()
|
|
646
|
+
.map((event) => formatAgentDiagnosticsEvent(event))
|
|
647
|
+
.join("\n");
|
|
648
|
+
return `${header}\n${body}`;
|
|
649
|
+
})();
|
|
650
|
+
const clientWebSocketBlock = (() => {
|
|
651
|
+
const events = runDiagnosticsSnapshot.recentEvents;
|
|
652
|
+
if (events.length === 0) {
|
|
653
|
+
return "No raw client-side agent WebSocket messages were captured for this terminal.";
|
|
654
|
+
}
|
|
655
|
+
const total = runDiagnosticsSnapshot.currentRunTotalEventCount;
|
|
656
|
+
const header = total > events.length
|
|
657
|
+
? `Showing last ${events.length} of ${total} agent:run:* messages received in current run.`
|
|
658
|
+
: `Showing all ${events.length} agent:run:* messages received in current run.`;
|
|
659
|
+
const body = events
|
|
660
|
+
.slice()
|
|
661
|
+
.reverse()
|
|
662
|
+
.map((event) => formatClientSocketMessageEvent(event))
|
|
663
|
+
.join("\n\n");
|
|
664
|
+
return `${header}\n\n${body}`;
|
|
665
|
+
})();
|
|
666
|
+
const toolUiEventsBlock = runDiagnosticsSnapshot.recentToolUiEvents.length > 0
|
|
667
|
+
? runDiagnosticsSnapshot.recentToolUiEvents
|
|
668
|
+
.slice()
|
|
669
|
+
.reverse()
|
|
670
|
+
.map((event) => formatAgentDiagnosticsEvent(event))
|
|
671
|
+
.join("\n")
|
|
672
|
+
: "No recent tool-specific UI events were captured for this terminal.";
|
|
673
|
+
const serverEventsBlock = serverDiagnostics.transport.recentEvents.length > 0
|
|
674
|
+
? serverDiagnostics.transport.recentEvents
|
|
675
|
+
.map((event) => formatAgentDiagnosticsEvent(event))
|
|
676
|
+
.join("\n")
|
|
677
|
+
: "No recent server-side agent transport events were recorded.";
|
|
678
|
+
const eventsContent = joinSubsections([
|
|
679
|
+
{ title: "Client events", content: clientEventsBlock },
|
|
680
|
+
{ title: "Server events", content: serverEventsBlock },
|
|
681
|
+
{ title: "Tool UI events", content: toolUiEventsBlock },
|
|
682
|
+
{ title: "Client WebSocket messages (raw)", content: clientWebSocketBlock },
|
|
683
|
+
]);
|
|
684
|
+
const promptContent = joinSubsections([
|
|
429
685
|
{
|
|
430
|
-
title: "
|
|
431
|
-
content:
|
|
432
|
-
const events = runDiagnosticsSnapshot.recentEvents;
|
|
433
|
-
if (events.length === 0) {
|
|
434
|
-
return "No recent client-side agent stream events were captured for this terminal.";
|
|
435
|
-
}
|
|
436
|
-
const total = runDiagnosticsSnapshot.currentRunTotalEventCount;
|
|
437
|
-
const header = total > events.length
|
|
438
|
-
? `Showing last ${events.length} of ${total} agent:run:* events received in current run.`
|
|
439
|
-
: `Showing all ${events.length} agent:run:* events received in current run.`;
|
|
440
|
-
const body = events
|
|
441
|
-
.slice()
|
|
442
|
-
.reverse()
|
|
443
|
-
.map((event) => formatAgentDiagnosticsEvent(event))
|
|
444
|
-
.join("\n");
|
|
445
|
-
return `${header}\n${body}`;
|
|
446
|
-
})(),
|
|
686
|
+
title: "Last prompt",
|
|
687
|
+
content: lastPrompt ?? "No prompt was captured for this agent run yet.",
|
|
447
688
|
},
|
|
689
|
+
payload
|
|
690
|
+
? {
|
|
691
|
+
title: "Raw full prompt",
|
|
692
|
+
content: payload,
|
|
693
|
+
}
|
|
694
|
+
: null,
|
|
695
|
+
]);
|
|
696
|
+
const assembledResponse = rawResponse
|
|
697
|
+
? extractLastResponseFromRawResponse(rawResponse)
|
|
698
|
+
: null;
|
|
699
|
+
const responseContent = joinSubsections([
|
|
448
700
|
{
|
|
449
|
-
title: "
|
|
450
|
-
content:
|
|
451
|
-
|
|
452
|
-
if (events.length === 0) {
|
|
453
|
-
return "No raw client-side agent WebSocket messages were captured for this terminal.";
|
|
454
|
-
}
|
|
455
|
-
const total = runDiagnosticsSnapshot.currentRunTotalEventCount;
|
|
456
|
-
const header = total > events.length
|
|
457
|
-
? `Showing last ${events.length} of ${total} agent:run:* messages received in current run.`
|
|
458
|
-
: `Showing all ${events.length} agent:run:* messages received in current run.`;
|
|
459
|
-
const body = events
|
|
460
|
-
.slice()
|
|
461
|
-
.reverse()
|
|
462
|
-
.map((event) => formatClientSocketMessageEvent(event))
|
|
463
|
-
.join("\n\n");
|
|
464
|
-
return `${header}\n\n${body}`;
|
|
465
|
-
})(),
|
|
701
|
+
title: "Last response",
|
|
702
|
+
content: lastResponse ??
|
|
703
|
+
"No assistant response was captured for this agent run yet.",
|
|
466
704
|
},
|
|
705
|
+
assembledResponse ? { title: "Response", content: assembledResponse } : null,
|
|
706
|
+
rawResponse ? { title: "Raw response", content: rawResponse } : null,
|
|
707
|
+
]);
|
|
708
|
+
const summaryCurrency = liveTotals?.currency || agent?.currency || "USD";
|
|
709
|
+
const summaryTotalCost = liveTotals?.totalCost ?? totalTokens?.totalCost ?? agent?.totalCost ?? null;
|
|
710
|
+
const summaryLimitPercent = summaryTotalCost != null && costLimit && costLimit > 0
|
|
711
|
+
? (summaryTotalCost / costLimit) * 100
|
|
712
|
+
: null;
|
|
713
|
+
const tokensSection = buildTokensSection({
|
|
714
|
+
agent,
|
|
715
|
+
liveTotals: liveTotals ?? null,
|
|
716
|
+
totalTokens: totalTokens ?? null,
|
|
717
|
+
contextWindowStatus: contextWindowStatus ?? null,
|
|
718
|
+
costLimit,
|
|
719
|
+
resolvedModelName,
|
|
720
|
+
});
|
|
721
|
+
const allowancesSection = buildAllowancesSection(allowances ?? null);
|
|
722
|
+
const agentSummaryLines = buildAgentSummaryLines(params.agentId, agent, resolvedModelName);
|
|
723
|
+
const sections = [
|
|
467
724
|
{
|
|
468
|
-
title: "
|
|
469
|
-
content:
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
.
|
|
475
|
-
|
|
725
|
+
title: "Summary",
|
|
726
|
+
content: lines([
|
|
727
|
+
`Diagnosis: ${summary.title}`,
|
|
728
|
+
summary.detail,
|
|
729
|
+
...agentSummaryLines,
|
|
730
|
+
serverDiagnostics.execution.runId
|
|
731
|
+
? `Run ID: ${serverDiagnostics.execution.runId}`
|
|
732
|
+
: null,
|
|
733
|
+
`Socket: ${socketDiagnostics.readyStateLabel}`,
|
|
734
|
+
`Session connected: ${yesNo(serverDiagnostics.currentSession.isConnected)}`,
|
|
735
|
+
`Session subscribed: ${yesNo(serverDiagnostics.currentSession.isSubscribed)}`,
|
|
736
|
+
`Server status: ${serverDiagnostics.execution.status || "unknown"}`,
|
|
737
|
+
`Last seq: ${serverDiagnostics.transport.lastSeq ?? runDiagnosticsSnapshot.lastSeq ?? "—"}`,
|
|
738
|
+
agent?.messageCount != null
|
|
739
|
+
? `Messages: ${agent.messageCount}`
|
|
740
|
+
: null,
|
|
741
|
+
summaryTotalCost != null
|
|
742
|
+
? `Total cost: ${formatCost(summaryTotalCost, summaryCurrency)}${costLimit && costLimit > 0
|
|
743
|
+
? ` / ${formatCost(costLimit, summaryCurrency)}${summaryLimitPercent != null ? ` (${formatPercent(summaryLimitPercent)})` : ""}`
|
|
744
|
+
: ""}`
|
|
745
|
+
: null,
|
|
746
|
+
contextWindowStatus
|
|
747
|
+
? `Context: ${formatNumber(contextWindowStatus.estimatedInputTokens)} / ${formatNumber(contextWindowStatus.contextWindowTokens)} (${formatPercent(contextWindowStatus.contextUsedPercent)})`
|
|
748
|
+
: null,
|
|
749
|
+
]),
|
|
476
750
|
},
|
|
751
|
+
{ title: "Prompt", content: promptContent },
|
|
752
|
+
{ title: "Response", content: responseContent },
|
|
753
|
+
tokensSection,
|
|
477
754
|
{
|
|
478
|
-
title: "
|
|
479
|
-
content:
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
: "No recent server-side agent transport events were recorded.",
|
|
755
|
+
title: "Connection & run",
|
|
756
|
+
content: joinSubsections([
|
|
757
|
+
{ title: "Connection", content: connectionContent },
|
|
758
|
+
{ title: "Run", content: runContent },
|
|
759
|
+
]),
|
|
484
760
|
},
|
|
761
|
+
{ title: "Events", content: eventsContent },
|
|
762
|
+
buildPersistentLogsSection(serverDiagnostics.persistentLogs ?? []),
|
|
763
|
+
allowancesSection,
|
|
764
|
+
...(machineCapacitySection ? [machineCapacitySection] : []),
|
|
485
765
|
];
|
|
486
|
-
if (payload) {
|
|
487
|
-
sections.splice(1, 0, {
|
|
488
|
-
title: "Raw full prompt",
|
|
489
|
-
content: payload,
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
if (rawResponse) {
|
|
493
|
-
const rawInsertAt = payload ? 2 : 1;
|
|
494
|
-
sections.splice(rawInsertAt, 0, {
|
|
495
|
-
title: "Raw response",
|
|
496
|
-
content: rawResponse,
|
|
497
|
-
});
|
|
498
|
-
const assembledResponse = extractLastResponseFromRawResponse(rawResponse);
|
|
499
|
-
if (assembledResponse) {
|
|
500
|
-
sections.splice(rawInsertAt + 1, 0, {
|
|
501
|
-
title: "Response",
|
|
502
|
-
content: assembledResponse,
|
|
503
|
-
});
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
sections.push({
|
|
507
|
-
title: "Last prompt",
|
|
508
|
-
content: lastPrompt ?? "No prompt was captured for this agent run yet.",
|
|
509
|
-
});
|
|
510
|
-
sections.push({
|
|
511
|
-
title: "Last response",
|
|
512
|
-
content: lastResponse ?? "No assistant response was captured for this agent run yet.",
|
|
513
|
-
});
|
|
514
766
|
return sections;
|
|
515
767
|
}
|
|
516
768
|
export function AgentTerminalStatusBar({ agent, contextWindowStatus, effectiveModelName, socketDiagnostics, runDiagnosticsSnapshot, liveTotals, totalTokens, costLimit, messages, showCompressionPopover, setShowCompressionPopover, }) {
|
|
@@ -587,12 +839,13 @@ export function AgentTerminalStatusBar({ agent, contextWindowStatus, effectiveMo
|
|
|
587
839
|
imageCost: liveTotals.imageCost ?? 0,
|
|
588
840
|
totalCost: liveTotals.totalCost,
|
|
589
841
|
}
|
|
590
|
-
: totalTokens, costLimit: costLimit }), agent?.id && (_jsxs(Tooltip, { children: [_jsx(ContentInspectorPopover, { title: "Run diagnostics", emptyMessage: "No diagnostics are available for this agent yet.", downloadFileName: `agent-${agent.id}-diagnostics.txt`, loadSections: async () => {
|
|
842
|
+
: totalTokens, costLimit: costLimit }), agent?.id && (_jsxs(Tooltip, { children: [_jsx(ContentInspectorPopover, { title: "Run diagnostics", emptyMessage: "No diagnostics are available for this agent yet.", downloadFileName: `agent-${agent.id}-diagnostics.txt`, className: "w-[min(64rem,calc(100vw-2rem))]", loadSections: async () => {
|
|
591
843
|
if (!agent?.id)
|
|
592
844
|
return [];
|
|
593
|
-
const [diagnosticsResult, payloadResult] = await Promise.allSettled([
|
|
845
|
+
const [diagnosticsResult, payloadResult, allowancesResult] = await Promise.allSettled([
|
|
594
846
|
getAgentDiagnostics(agent.id, socketDiagnostics.sessionId),
|
|
595
847
|
getLastPayload(agent.id),
|
|
848
|
+
getAgentOperationAllowances(agent.id),
|
|
596
849
|
]);
|
|
597
850
|
if (diagnosticsResult.status !== "fulfilled") {
|
|
598
851
|
throw diagnosticsResult.reason;
|
|
@@ -603,11 +856,21 @@ export function AgentTerminalStatusBar({ agent, contextWindowStatus, effectiveMo
|
|
|
603
856
|
const rawResponse = payloadResult.status === "fulfilled"
|
|
604
857
|
? payloadResult.value.rawResponse
|
|
605
858
|
: "";
|
|
859
|
+
const allowances = allowancesResult.status === "fulfilled"
|
|
860
|
+
? allowancesResult.value
|
|
861
|
+
: null;
|
|
606
862
|
return buildDiagnosticsSections({
|
|
607
863
|
agentId: agent.id,
|
|
864
|
+
agent,
|
|
608
865
|
socketDiagnostics,
|
|
609
866
|
runDiagnosticsSnapshot,
|
|
610
867
|
serverDiagnostics: diagnosticsResult.value,
|
|
868
|
+
allowances,
|
|
869
|
+
liveTotals,
|
|
870
|
+
totalTokens,
|
|
871
|
+
contextWindowStatus,
|
|
872
|
+
costLimit,
|
|
873
|
+
resolvedModelName,
|
|
611
874
|
messages,
|
|
612
875
|
payload,
|
|
613
876
|
rawResponse,
|