@mgamadeus/ddd-agents 0.15.0 → 0.15.2
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/admin.js +195 -13
- package/dist/admin.js.map +1 -1
- package/dist/files/i18n-keys.json +195 -0
- package/dist/types/admin/conversations/AgentConversationDetailScreen.d.ts +7 -4
- package/dist/types/admin/conversations/WorkedRecordsPanel.d.ts +24 -0
- package/dist/types/admin/conversations/agent-inspect-api.d.ts +13 -1
- package/dist/types/admin/conversations/agent-inspect-mappers.d.ts +7 -1
- package/dist/types/admin/conversations/agent-inspect-types.d.ts +37 -0
- package/dist/types/admin/conversations/inspect-scope.d.ts +11 -0
- package/dist/types/entries/admin.d.ts +4 -3
- package/package.json +1 -1
- package/public-api.json +11 -1
package/dist/admin.js
CHANGED
|
@@ -4,7 +4,7 @@ import { CodeText, extensionOf, codeLanguageOfExtension } from "@mgamadeus/ddd-a
|
|
|
4
4
|
import { useTranslate, m, getUiLocale, formatUiNumber, useFormatLocale } from "@mgamadeus/ddd-admin-ui/i18n";
|
|
5
5
|
import { CopyButton, SearchField, StatusBadge, DateCell, formatDate, formatDateTime, defineStatusMap as defineStatusMap$1, Tag, EmptyValue, Combobox, EntityListBody, EntityListToolbar, FilterPanel, FilterDateRange, FilterMultiSelect, FilterSelect, FilterText, FilterField as FilterField$1, EntityListViewToggle, EntityListCard } from "@mgamadeus/ddd-admin-ui/list";
|
|
6
6
|
import { cn, SheetTitle, DialogTitle, SheetDescription, DialogDescription, SegmentedControl, Button, SheetClose, DialogClose, Sheet, SheetContent, Dialog, DialogContent, Collapsible, CollapsibleTrigger, CollapsibleContent, TooltipContent, Tooltip, TooltipTrigger, Badge, Skeleton, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Input, Card, CardHeader, CardTitle, CardDescription, CardContent, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, SheetHeader, useLinkComponent, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DialogHeader, Label, Textarea, DialogFooter, Switch, SheetFooter, TableFooter, DropdownMenuLabel, DropdownMenuCheckboxItem } from "@mgamadeus/ddd-admin-ui/primitives";
|
|
7
|
-
import { WrapText, Check, Copy, X, ChevronRight, Maximize2, CalendarClock, ChevronsDownUp, ChevronsUpDown, Ban, CircleX, CircleCheck, Users, Loader, Hourglass, Archive, TimerOff, CirclePause, CirclePlay, Zap, Repeat, MoreHorizontal, History, Pencil, Pause, Play, Trash2, Wallet, CircleAlert, TriangleAlert, RotateCcw, ArrowRight, ChartNoAxesColumn, ArrowDown, Wrench, CircleDashed, Hand, ServerCrash, ShieldX, TextCursorInput, Clock, Flag, CircleMinus, ChevronLeft, FlaskConical, PartyPopper, Download, ChevronsUp, CircleStop, GitBranch, ClipboardCheck, PanelRightOpen, Eye, FileJson, ScrollText, LayoutPanelTop, MessageSquarePlus, SlidersHorizontal, Square, Bug, Code, ListTree, ExternalLink, HardDrive, ChevronDown, Folder, File, RefreshCw, User, CornerDownRight, AlertTriangle, Columns3, CircleSlash, Mail, Plug, MessageCircle, MessageSquare, FolderOpen, Contact, CalendarDays, CircleHelp, Lock, FolderTree, Unplug, Plus, Globe, ShieldAlert, Share2, Undo2, Layers, FolderPlus, SearchCheck, ArrowLeft, Sparkles } from "lucide-react";
|
|
7
|
+
import { WrapText, Check, Copy, X, ChevronRight, Maximize2, CalendarClock, ChevronsDownUp, ChevronsUpDown, Ban, CircleX, CircleCheck, Users, Loader, Hourglass, Archive, TimerOff, CirclePause, CirclePlay, Zap, Repeat, MoreHorizontal, History, Pencil, Pause, Play, Trash2, Wallet, CircleAlert, TriangleAlert, RotateCcw, ArrowRight, ChartNoAxesColumn, ArrowDown, Wrench, CircleDashed, Hand, ServerCrash, ShieldX, TextCursorInput, Clock, Flag, CircleMinus, ChevronLeft, FlaskConical, PartyPopper, Download, ChevronsUp, CircleStop, GitBranch, ClipboardCheck, PanelRightOpen, Eye, FileJson, ScrollText, LayoutPanelTop, MessageSquarePlus, SlidersHorizontal, Square, Bug, Code, ListTree, ExternalLink, HardDrive, ChevronDown, Folder, File, Filter, Bot, SquarePen, RefreshCw, User, CornerDownRight, AlertTriangle, Columns3, CircleSlash, Mail, Plug, MessageCircle, MessageSquare, FolderOpen, Contact, CalendarDays, CircleHelp, Lock, FolderTree, Unplug, Plus, Globe, ShieldAlert, Share2, Undo2, Layers, FolderPlus, SearchCheck, ArrowLeft, Sparkles } from "lucide-react";
|
|
8
8
|
import { useState, useId, useMemo, Fragment as Fragment$1, useEffect, createContext, useContext, useCallback, useRef } from "react";
|
|
9
9
|
import { useCopyToClipboard, useMemoryUrlState, useUrlListState, defineStatusMap, useConfirm, notify, localToday as localToday$1, toFormSubmitError, formatRelativeTime, useDebouncedValue } from "@mgamadeus/ddd-admin-ui/logic";
|
|
10
10
|
import { trimApiPrefix, injectEndpointsOnce, staticQueryHook, toQueryString, addCalendarDays, localToday, staticMutationHook } from "@mgamadeus/ddd-admin-ui/logic/pure";
|
|
@@ -5015,11 +5015,16 @@ const buildAgentInspectRequests = (apiPrefix) => {
|
|
|
5015
5015
|
fromTurnNumber: arg.fromTurnNumber,
|
|
5016
5016
|
limit: arg.limit,
|
|
5017
5017
|
afterMessageIndex: arg.afterMessageIndex,
|
|
5018
|
-
includeTruncated: arg.includeTruncated === true ? 1 : void 0
|
|
5018
|
+
includeTruncated: arg.includeTruncated === true ? 1 : void 0,
|
|
5019
|
+
onlySubjectEntityClass: arg.onlySubjectEntityClass,
|
|
5020
|
+
onlySubjectEntityId: arg.onlySubjectEntityId
|
|
5019
5021
|
})}`
|
|
5020
5022
|
}),
|
|
5021
5023
|
delegations: (arg) => ({ url: `${conversationPath(arg)}/delegations` }),
|
|
5022
5024
|
fileChanges: (arg) => ({ url: `${conversationPath(arg)}/fileChanges` }),
|
|
5025
|
+
workedSubjects: (arg) => ({
|
|
5026
|
+
url: `${conversationPath(arg)}/workedSubjects${toQueryString({ afterId: arg.afterId, limit: arg.limit })}`
|
|
5027
|
+
}),
|
|
5023
5028
|
fileChangeDiff: (arg) => ({
|
|
5024
5029
|
url: `${conversationPath(arg)}/fileChanges/${encodeURIComponent(String(arg.fileChangeId))}/diff`
|
|
5025
5030
|
}),
|
|
@@ -5052,6 +5057,7 @@ const agentInspectEndpointDefinitions = (apiPrefix) => {
|
|
|
5052
5057
|
adminUiAgentInspectTrace: { kind: "query", request: requests.trace, providesTags: [CONVERSATION] },
|
|
5053
5058
|
adminUiAgentInspectDelegations: { kind: "query", request: requests.delegations, providesTags: [CONVERSATION] },
|
|
5054
5059
|
adminUiAgentInspectFileChanges: { kind: "query", request: requests.fileChanges, providesTags: [CONVERSATION] },
|
|
5060
|
+
adminUiAgentInspectWorkedSubjects: { kind: "query", request: requests.workedSubjects, providesTags: [CONVERSATION] },
|
|
5055
5061
|
adminUiAgentInspectFileChangeDiff: { kind: "query", request: requests.fileChangeDiff },
|
|
5056
5062
|
adminUiAgentInspectSandbox: { kind: "query", request: requests.sandbox, providesTags: [CONVERSATION] },
|
|
5057
5063
|
adminUiAgentInspectCompactionNodes: { kind: "query", request: requests.compactionNodes, providesTags: [CONVERSATION] },
|
|
@@ -5078,6 +5084,7 @@ const createAgentInspectApi = ({ baseApi, apiPrefix }) => {
|
|
|
5078
5084
|
useTraceQuery: hookOf("adminUiAgentInspectTrace"),
|
|
5079
5085
|
useDelegationsQuery: hookOf("adminUiAgentInspectDelegations"),
|
|
5080
5086
|
useFileChangesQuery: hookOf("adminUiAgentInspectFileChanges"),
|
|
5087
|
+
useWorkedSubjectsQuery: hookOf("adminUiAgentInspectWorkedSubjects"),
|
|
5081
5088
|
useFileChangeDiffQuery: hookOf("adminUiAgentInspectFileChangeDiff"),
|
|
5082
5089
|
useSandboxQuery: hookOf("adminUiAgentInspectSandbox"),
|
|
5083
5090
|
useCompactionNodesQuery: hookOf("adminUiAgentInspectCompactionNodes"),
|
|
@@ -5100,6 +5107,7 @@ const createStaticAgentInspectApi = (data) => ({
|
|
|
5100
5107
|
useTraceQuery: staticQueryHook((arg) => data.trace?.(arg)),
|
|
5101
5108
|
useDelegationsQuery: staticQueryHook((arg) => data.delegations?.(arg)),
|
|
5102
5109
|
useFileChangesQuery: staticQueryHook((arg) => data.fileChanges?.(arg)),
|
|
5110
|
+
useWorkedSubjectsQuery: staticQueryHook((arg) => data.workedSubjects?.(arg)),
|
|
5103
5111
|
useFileChangeDiffQuery: staticQueryHook((arg) => data.fileChangeDiff?.(arg)),
|
|
5104
5112
|
useSandboxQuery: staticQueryHook((arg) => data.sandbox?.(arg)),
|
|
5105
5113
|
useCompactionNodesQuery: staticQueryHook((arg) => data.compactionNodes?.(arg)),
|
|
@@ -5135,6 +5143,28 @@ const mapAgentInspectFileChange = (wireFileChange) => {
|
|
|
5135
5143
|
};
|
|
5136
5144
|
const fileChangesOf = (value) => readInspectList(value).map(mapAgentInspectFileChange).filter((fileChange) => fileChange !== null);
|
|
5137
5145
|
const mapAgentInspectFileChanges = (response) => fileChangesOf(response?.fileChanges);
|
|
5146
|
+
const mapAgentInspectWorkedSubject = (wireEntry) => {
|
|
5147
|
+
if (!isWireObject(wireEntry)) return null;
|
|
5148
|
+
const subjectEntityClass = stringOrNull(wireEntry.subjectEntityClass);
|
|
5149
|
+
const subjectEntityId = numberOrNull(wireEntry.subjectEntityId);
|
|
5150
|
+
if (subjectEntityClass === null || subjectEntityClass === "" || subjectEntityId === null || subjectEntityId < 1) return null;
|
|
5151
|
+
return {
|
|
5152
|
+
conversationId: numberOrNull(wireEntry.aiConversationId),
|
|
5153
|
+
rootConversationId: numberOrNull(wireEntry.rootConversationId),
|
|
5154
|
+
subjectEntityClass,
|
|
5155
|
+
subjectEntityId,
|
|
5156
|
+
writeCallCount: numberOrNull(wireEntry.writeCallCount) ?? 0,
|
|
5157
|
+
heldCallCount: numberOrNull(wireEntry.heldCallCount) ?? 0,
|
|
5158
|
+
firstToolCallId: stringOrNull(wireEntry.firstToolCallId),
|
|
5159
|
+
lastToolCallId: stringOrNull(wireEntry.lastToolCallId),
|
|
5160
|
+
firstWorkedAt: stringOrNull(wireEntry.firstWorkedAt),
|
|
5161
|
+
lastWorkedAt: stringOrNull(wireEntry.lastWorkedAt),
|
|
5162
|
+
name: stringOrNull(wireEntry.name),
|
|
5163
|
+
link: stringOrNull(wireEntry.link)
|
|
5164
|
+
};
|
|
5165
|
+
};
|
|
5166
|
+
const mapAgentInspectWorkedSubjects = (response) => objectsOf(response?.workedSubjects).map(mapAgentInspectWorkedSubject).filter((workedSubject) => workedSubject !== null);
|
|
5167
|
+
const shortAgentInspectSubjectClass = (subjectEntityClass) => subjectEntityClass.split("\\").pop() ?? subjectEntityClass;
|
|
5138
5168
|
const mapSubAgent = (wireSubAgent, mapped) => {
|
|
5139
5169
|
if (!isWireObject(wireSubAgent) || mapped === null) return null;
|
|
5140
5170
|
const queuedAtByRunNumber = {};
|
|
@@ -6327,10 +6357,11 @@ const TurnCard = ({ turn, viewMode, debugSwitches, loadedSkills, ownerLabel, isF
|
|
|
6327
6357
|
}
|
|
6328
6358
|
);
|
|
6329
6359
|
};
|
|
6360
|
+
const subjectFilterArgOf = (onlySubject) => onlySubject === null ? {} : { onlySubjectEntityClass: onlySubject.subjectEntityClass, onlySubjectEntityId: onlySubject.subjectEntityId };
|
|
6330
6361
|
const OlderTurnsLoader = ({ window: window2, includeTruncated, onLoaded }) => {
|
|
6331
6362
|
const { t } = useTranslate();
|
|
6332
|
-
const { api, conversationId, level } = useAgentInspectScope();
|
|
6333
|
-
const query = api.useTraceQuery({ conversationId, detailLevel: level, fromTurnNumber: window2.fromTurnNumber, limit: window2.limit, includeTruncated });
|
|
6363
|
+
const { api, conversationId, level, onlySubject } = useAgentInspectScope();
|
|
6364
|
+
const query = api.useTraceQuery({ conversationId, detailLevel: level, fromTurnNumber: window2.fromTurnNumber, limit: window2.limit, includeTruncated, ...subjectFilterArgOf(onlySubject) });
|
|
6334
6365
|
const { currentData } = query;
|
|
6335
6366
|
const answerKey = useMemo(() => currentData === void 0 ? null : JSON.stringify(currentData), [currentData]);
|
|
6336
6367
|
const answer = useRef(currentData);
|
|
@@ -6360,11 +6391,16 @@ const ConversationTurns = ({
|
|
|
6360
6391
|
onFocusSearchChange
|
|
6361
6392
|
}) => {
|
|
6362
6393
|
const { t } = useTranslate();
|
|
6363
|
-
const { api, conversationId, level, isDebug } = useAgentInspectScope();
|
|
6394
|
+
const { api, conversationId, level, isDebug, onlySubject } = useAgentInspectScope();
|
|
6395
|
+
const subjectFilterArg = useMemo(() => subjectFilterArgOf(onlySubject), [onlySubject]);
|
|
6364
6396
|
const [olderWindows, setOlderWindows] = useState([]);
|
|
6365
6397
|
const [olderPageByKey, setOlderPageByKey] = useState({});
|
|
6366
|
-
const
|
|
6367
|
-
const
|
|
6398
|
+
const subjectKey = onlySubject ? `${onlySubject.subjectEntityClass}#${onlySubject.subjectEntityId}` : "";
|
|
6399
|
+
const pageKeyOf = useCallback(
|
|
6400
|
+
(window2) => `${level}:${includeTruncated}:${subjectKey}:${window2.fromTurnNumber}:${window2.limit}`,
|
|
6401
|
+
[level, includeTruncated, subjectKey]
|
|
6402
|
+
);
|
|
6403
|
+
const newestQuery = api.useTraceQuery({ conversationId, detailLevel: level, limit: turnPageSize, includeTruncated, ...subjectFilterArg });
|
|
6368
6404
|
const newestTrace = useMemo(() => newestQuery.data ? mapAgentInspectTrace(newestQuery.data) : null, [newestQuery.data]);
|
|
6369
6405
|
const { refetch: refetchNewest } = newestQuery;
|
|
6370
6406
|
useEffect(() => {
|
|
@@ -6373,7 +6409,7 @@ const ConversationTurns = ({
|
|
|
6373
6409
|
const afterMessageIndex = newestTrace ? followUpPositionOfAgentInspectTrace(newestTrace) : null;
|
|
6374
6410
|
const [isFollowing, setIsFollowing] = useState(false);
|
|
6375
6411
|
const followUpQuery = api.useTraceQuery(
|
|
6376
|
-
{ conversationId, detailLevel: level, afterMessageIndex: afterMessageIndex ?? 0, includeTruncated },
|
|
6412
|
+
{ conversationId, detailLevel: level, afterMessageIndex: afterMessageIndex ?? 0, includeTruncated, ...subjectFilterArg },
|
|
6377
6413
|
{ skip: afterMessageIndex === null || !(newestTrace?.isRunLive === true || isFollowing), pollingInterval: isFollowing ? livePollingIntervalMs : 0 }
|
|
6378
6414
|
);
|
|
6379
6415
|
const followUpTrace = useMemo(() => followUpQuery.currentData ? mapAgentInspectTrace(followUpQuery.currentData) : null, [followUpQuery.currentData]);
|
|
@@ -6422,6 +6458,16 @@ const ConversationTurns = ({
|
|
|
6422
6458
|
/* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full rounded-2xl" })
|
|
6423
6459
|
] });
|
|
6424
6460
|
}
|
|
6461
|
+
if (trace.turns.length === 0 && onlySubject !== null) {
|
|
6462
|
+
return /* @__PURE__ */ jsx(
|
|
6463
|
+
StatusCallout,
|
|
6464
|
+
{
|
|
6465
|
+
tone: "info",
|
|
6466
|
+
title: t("No step on this record", { context: "agent-worked-records" }),
|
|
6467
|
+
description: t("No step of this conversation carries the record. Runs from before the worked records carry no mark on their steps.", { context: "agent-worked-records" })
|
|
6468
|
+
}
|
|
6469
|
+
);
|
|
6470
|
+
}
|
|
6425
6471
|
if (trace.turns.length === 0) return /* @__PURE__ */ jsx(StatusCallout, { tone: "info", title: t("No turn yet"), description: t("The conversation holds no message that started a turn.") });
|
|
6426
6472
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-testid": "agent-inspect-turns", "data-level": level, "data-has-older-turns": trace.hasOlderTurns ? "true" : "false", children: [
|
|
6427
6473
|
olderWindows.map((window2) => /* @__PURE__ */ jsx(OlderTurnsLoader, { window: window2, includeTruncated, onLoaded: addOlderPage }, pageKeyOf(window2))),
|
|
@@ -8557,6 +8603,121 @@ const StepDetailDialog = ({ stepId, step, isLoading, canSwitchToDebug = false, o
|
|
|
8557
8603
|
}
|
|
8558
8604
|
);
|
|
8559
8605
|
};
|
|
8606
|
+
const isApplicationPath = (link) => link.startsWith("/") && !link.startsWith("//");
|
|
8607
|
+
const writeSubjectFilter = (subject) => `${subject.subjectEntityClass}#${subject.subjectEntityId}`;
|
|
8608
|
+
const readSubjectFilter = (value) => {
|
|
8609
|
+
const match = /^([A-Za-z_][A-Za-z0-9_\\]*)#([1-9][0-9]*)$/.exec(value ?? "");
|
|
8610
|
+
return match ? { subjectEntityClass: match[1], subjectEntityId: Number(match[2]) } : null;
|
|
8611
|
+
};
|
|
8612
|
+
const subjectKindLabelOf = (subjectEntityClass, describeSubjectKind) => describeSubjectKind?.(subjectEntityClass) ?? shortAgentInspectSubjectClass(subjectEntityClass);
|
|
8613
|
+
const SubjectFilterNote = ({ onlySubject, describeSubjectKind, onClear }) => {
|
|
8614
|
+
const { t } = useTranslate();
|
|
8615
|
+
const record = `${subjectKindLabelOf(onlySubject.subjectEntityClass, describeSubjectKind)} #${onlySubject.subjectEntityId}`;
|
|
8616
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 rounded-xl bg-muted px-3 py-2 text-xs", "data-testid": "agent-subject-filter-note", children: [
|
|
8617
|
+
/* @__PURE__ */ jsx(Filter, { "aria-hidden": true, className: "size-3.5 shrink-0 text-muted-foreground" }),
|
|
8618
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: t("Only the steps on %record%", { context: "agent-worked-records", replacements: { record } }) }),
|
|
8619
|
+
/* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 gap-1 px-2 text-xs", onClick: onClear, children: [
|
|
8620
|
+
/* @__PURE__ */ jsx(X, { "aria-hidden": true, className: "size-3.5" }),
|
|
8621
|
+
t("Show every step", { context: "agent-worked-records" })
|
|
8622
|
+
] })
|
|
8623
|
+
] });
|
|
8624
|
+
};
|
|
8625
|
+
const WorkedRecordRow = ({ workedSubject, formatMoment }) => {
|
|
8626
|
+
const { t } = useTranslate();
|
|
8627
|
+
const { linkComponent: Link, conversationId, buildConversationHref, describeSubjectKind, showStepsOfSubject } = useAgentInspectScope();
|
|
8628
|
+
const kind = subjectKindLabelOf(workedSubject.subjectEntityClass, describeSubjectKind);
|
|
8629
|
+
const fallbackLabel = `${kind} #${workedSubject.subjectEntityId}`;
|
|
8630
|
+
const label = workedSubject.name !== null && workedSubject.name !== "" ? workedSubject.name : fallbackLabel;
|
|
8631
|
+
const link = workedSubject.link;
|
|
8632
|
+
const subject = { subjectEntityClass: workedSubject.subjectEntityClass, subjectEntityId: workedSubject.subjectEntityId };
|
|
8633
|
+
const isSubAgent = workedSubject.conversationId !== null && workedSubject.conversationId !== conversationId;
|
|
8634
|
+
const subAgentHref = isSubAgent && workedSubject.conversationId !== null ? buildConversationHref?.(workedSubject.conversationId) ?? null : null;
|
|
8635
|
+
const subAgentStepsHref = subAgentHref !== null ? `${subAgentHref}${subAgentHref.includes("?") ? "&" : "?"}subject=${encodeURIComponent(writeSubjectFilter(subject))}` : null;
|
|
8636
|
+
const firstWorkedAt = formatMoment(workedSubject.firstWorkedAt);
|
|
8637
|
+
const lastWorkedAt = formatMoment(workedSubject.lastWorkedAt);
|
|
8638
|
+
const showStepsLabel = t("Show steps", { context: "agent-worked-records" });
|
|
8639
|
+
return /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1.5 px-3 py-2.5 sm:flex-row sm:items-center sm:gap-4", "data-testid": "agent-worked-record", children: [
|
|
8640
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
8641
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
|
|
8642
|
+
/* @__PURE__ */ jsx(Tag, { size: "sm", children: kind }),
|
|
8643
|
+
link === null || link === "" ? /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", title: label, children: label }) : isApplicationPath(link) ? /* @__PURE__ */ jsx(Link, { href: link, className: "truncate text-sm font-medium underline-offset-2 hover:underline", children: label }) : /* @__PURE__ */ jsx("a", { href: link, target: "_blank", rel: "noopener noreferrer", className: "truncate text-sm font-medium underline-offset-2 hover:underline", title: label, children: label }),
|
|
8644
|
+
label !== fallbackLabel ? /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground tabular-nums", children: [
|
|
8645
|
+
"#",
|
|
8646
|
+
workedSubject.subjectEntityId
|
|
8647
|
+
] }) : null
|
|
8648
|
+
] }),
|
|
8649
|
+
isSubAgent ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
8650
|
+
/* @__PURE__ */ jsx(Bot, { "aria-hidden": true, className: "size-3" }),
|
|
8651
|
+
subAgentHref !== null ? /* @__PURE__ */ jsx(Link, { href: subAgentHref, className: "underline-offset-2 hover:underline", children: t("by a sub-agent", { context: "agent-worked-records" }) }) : t("by a sub-agent", { context: "agent-worked-records" })
|
|
8652
|
+
] }) : null
|
|
8653
|
+
] }),
|
|
8654
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]", children: [
|
|
8655
|
+
workedSubject.writeCallCount > 0 ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", title: t("Writing calls that ran", { context: "agent-worked-records" }), children: [
|
|
8656
|
+
/* @__PURE__ */ jsx(SquarePen, { "aria-hidden": true, className: "size-3.5 text-success" }),
|
|
8657
|
+
t("changed %count%×", { context: "agent-worked-records", replacements: { count: formatUiNumber(workedSubject.writeCallCount) } })
|
|
8658
|
+
] }) : null,
|
|
8659
|
+
workedSubject.heldCallCount > 0 ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1", title: t("Writing calls held for the owner", { context: "agent-worked-records" }), children: [
|
|
8660
|
+
/* @__PURE__ */ jsx(Hand, { "aria-hidden": true, className: "size-3.5 text-warning" }),
|
|
8661
|
+
t("held %count%×", { context: "agent-worked-records", replacements: { count: formatUiNumber(workedSubject.heldCallCount) } })
|
|
8662
|
+
] }) : null,
|
|
8663
|
+
/* @__PURE__ */ jsx("span", { className: "whitespace-nowrap text-muted-foreground tabular-nums", children: firstWorkedAt === null ? /* @__PURE__ */ jsx(EmptyValue, {}) : firstWorkedAt === lastWorkedAt || lastWorkedAt === null ? firstWorkedAt : `${firstWorkedAt} – ${lastWorkedAt}` }),
|
|
8664
|
+
isSubAgent ? subAgentStepsHref !== null ? /* @__PURE__ */ jsxs(Link, { href: subAgentStepsHref, className: "inline-flex items-center gap-1 text-xs font-medium underline-offset-2 hover:underline", children: [
|
|
8665
|
+
/* @__PURE__ */ jsx(Filter, { "aria-hidden": true, className: "size-3.5" }),
|
|
8666
|
+
showStepsLabel
|
|
8667
|
+
] }) : null : /* @__PURE__ */ jsxs(Button, { type: "button", variant: "ghost", size: "sm", className: "h-7 gap-1 px-2 text-xs", onClick: () => showStepsOfSubject(subject), "data-testid": "agent-worked-record-steps", children: [
|
|
8668
|
+
/* @__PURE__ */ jsx(Filter, { "aria-hidden": true, className: "size-3.5" }),
|
|
8669
|
+
showStepsLabel
|
|
8670
|
+
] })
|
|
8671
|
+
] })
|
|
8672
|
+
] });
|
|
8673
|
+
};
|
|
8674
|
+
const WorkedRecordsPanel = () => {
|
|
8675
|
+
const { t } = useTranslate();
|
|
8676
|
+
const { api, conversationId, locale } = useAgentInspectScope();
|
|
8677
|
+
const query = api.useWorkedSubjectsQuery({ conversationId });
|
|
8678
|
+
const workedSubjects = useMemo(() => query.data ? mapAgentInspectWorkedSubjects(query.data) : null, [query.data]);
|
|
8679
|
+
const hasMore = typeof query.data?.nextAfterId === "number";
|
|
8680
|
+
const formatMoment = useMemo(() => {
|
|
8681
|
+
const format = new Intl.DateTimeFormat(locale, { dateStyle: "short", timeStyle: "short" });
|
|
8682
|
+
return (value) => {
|
|
8683
|
+
const moment = readTraceMoment(value);
|
|
8684
|
+
return moment === null ? null : format.format(moment);
|
|
8685
|
+
};
|
|
8686
|
+
}, [locale]);
|
|
8687
|
+
if (query.isError) {
|
|
8688
|
+
return /* @__PURE__ */ jsx(
|
|
8689
|
+
StatusCallout,
|
|
8690
|
+
{
|
|
8691
|
+
tone: "destructive",
|
|
8692
|
+
title: t("The worked records could not be loaded", { context: "agent-worked-records" }),
|
|
8693
|
+
description: normalizeDddError(query.error, t("The worked records could not be loaded.", { context: "agent-worked-records" })).message
|
|
8694
|
+
}
|
|
8695
|
+
);
|
|
8696
|
+
}
|
|
8697
|
+
if (workedSubjects === null) return /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full rounded-2xl" });
|
|
8698
|
+
if (workedSubjects.length === 0) {
|
|
8699
|
+
return /* @__PURE__ */ jsx(
|
|
8700
|
+
StatusCallout,
|
|
8701
|
+
{
|
|
8702
|
+
tone: "info",
|
|
8703
|
+
title: t("No worked records", { context: "agent-worked-records" }),
|
|
8704
|
+
description: t("No writing call of this conversation changed a record. Reads and lists never appear here.", { context: "agent-worked-records" })
|
|
8705
|
+
}
|
|
8706
|
+
);
|
|
8707
|
+
}
|
|
8708
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-testid": "agent-worked-records-panel", children: [
|
|
8709
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("Every record a writing call changed or held for the owner, in the order the run first worked on it.", { context: "agent-worked-records" }) }),
|
|
8710
|
+
/* @__PURE__ */ jsx(Card, { className: "gap-0 py-0", children: /* @__PURE__ */ jsx(CardContent, { className: "px-0", children: /* @__PURE__ */ jsx("ul", { className: "divide-y divide-border", children: workedSubjects.map((workedSubject) => /* @__PURE__ */ jsx(
|
|
8711
|
+
WorkedRecordRow,
|
|
8712
|
+
{
|
|
8713
|
+
workedSubject,
|
|
8714
|
+
formatMoment
|
|
8715
|
+
},
|
|
8716
|
+
`${workedSubject.conversationId ?? "run"}-${workedSubject.subjectEntityClass}-${workedSubject.subjectEntityId}`
|
|
8717
|
+
)) }) }) }),
|
|
8718
|
+
hasMore ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("The first %count% records are shown.", { context: "agent-worked-records", replacements: { count: formatUiNumber(workedSubjects.length) } }) }) : null
|
|
8719
|
+
] });
|
|
8720
|
+
};
|
|
8560
8721
|
const QueryRunner = ({ useQuery, arg, onSettled }) => {
|
|
8561
8722
|
const result = useQuery(arg);
|
|
8562
8723
|
const { currentData, isError, error } = result;
|
|
@@ -8591,8 +8752,8 @@ const useQueryLoader = (useQuery, keyOf2) => {
|
|
|
8591
8752
|
const runners = pendingLoads.map((pendingLoad) => /* @__PURE__ */ jsx(QueryRunner, { useQuery, arg: pendingLoad.arg, onSettled: (outcome) => settle(pendingLoad.key, outcome) }, pendingLoad.key));
|
|
8592
8753
|
return [load, runners];
|
|
8593
8754
|
};
|
|
8594
|
-
const AGENT_CONVERSATION_DETAIL_TABS = ["conversation", "delegation", "sandbox", "files", "requests", "context"];
|
|
8595
|
-
const AGENT_CONVERSATION_DETAIL_KEYS = ["tab", "debug", "view", "switches", "truncated", "call", "callView", "message", "step", "file", "change"];
|
|
8755
|
+
const AGENT_CONVERSATION_DETAIL_TABS = ["conversation", "delegation", "sandbox", "files", "records", "requests", "context"];
|
|
8756
|
+
const AGENT_CONVERSATION_DETAIL_KEYS = ["tab", "debug", "view", "switches", "truncated", "call", "callView", "message", "step", "file", "change", "subject"];
|
|
8596
8757
|
const buildAgentConversationSandboxQuery = ({ path, fileChangeId }) => {
|
|
8597
8758
|
const query = new URLSearchParams({ tab: "sandbox" });
|
|
8598
8759
|
if (path) query.set("file", path);
|
|
@@ -8605,6 +8766,7 @@ const TAB_LABELS = {
|
|
|
8605
8766
|
delegation: m("Delegation", { context: "agent-conversation-tab" }),
|
|
8606
8767
|
sandbox: m("Sandbox", { context: "agent-conversation-tab" }),
|
|
8607
8768
|
files: m("Files", { context: "agent-conversation-tab" }),
|
|
8769
|
+
records: m("Worked records", { context: "agent-conversation-tab" }),
|
|
8608
8770
|
requests: m("Requests", { context: "agent-conversation-tab" }),
|
|
8609
8771
|
context: m("Context", { context: "agent-conversation-tab" })
|
|
8610
8772
|
};
|
|
@@ -8748,6 +8910,7 @@ const AgentConversationDetailScreen = ({
|
|
|
8748
8910
|
renderFilePreview,
|
|
8749
8911
|
renderSandboxFacts,
|
|
8750
8912
|
describeModelName,
|
|
8913
|
+
describeSubjectKind,
|
|
8751
8914
|
qualityApi,
|
|
8752
8915
|
loadCodeHighlighter,
|
|
8753
8916
|
debugSwitches: debugSwitchesOfHost,
|
|
@@ -8818,6 +8981,11 @@ const AgentConversationDetailScreen = ({
|
|
|
8818
8981
|
}),
|
|
8819
8982
|
[selectedFilePath, selectedFileChangeId, setValues]
|
|
8820
8983
|
);
|
|
8984
|
+
const onlySubject = useMemo(() => readSubjectFilter(url.values.subject), [url.values.subject]);
|
|
8985
|
+
const showStepsOfSubject = useCallback(
|
|
8986
|
+
(subject) => setValues(subject === null ? { subject: "" } : { tab: "", subject: `${subject.subjectEntityClass}#${subject.subjectEntityId}`, message: "", step: "" }),
|
|
8987
|
+
[setValues]
|
|
8988
|
+
);
|
|
8821
8989
|
const sandboxFacts = useMemo(() => renderSandboxFacts && header ? () => renderSandboxFacts(header) : void 0, [renderSandboxFacts, header]);
|
|
8822
8990
|
const host = useMemo(
|
|
8823
8991
|
() => ({
|
|
@@ -8858,7 +9026,10 @@ const AgentConversationDetailScreen = ({
|
|
|
8858
9026
|
renderFilePreview,
|
|
8859
9027
|
loadCodeHighlighter,
|
|
8860
9028
|
renderSandboxFacts: sandboxFacts,
|
|
8861
|
-
describeModelName
|
|
9029
|
+
describeModelName,
|
|
9030
|
+
describeSubjectKind,
|
|
9031
|
+
onlySubject,
|
|
9032
|
+
showStepsOfSubject
|
|
8862
9033
|
}),
|
|
8863
9034
|
[
|
|
8864
9035
|
api,
|
|
@@ -8884,7 +9055,10 @@ const AgentConversationDetailScreen = ({
|
|
|
8884
9055
|
renderFilePreview,
|
|
8885
9056
|
loadCodeHighlighter,
|
|
8886
9057
|
sandboxFacts,
|
|
8887
|
-
describeModelName
|
|
9058
|
+
describeModelName,
|
|
9059
|
+
describeSubjectKind,
|
|
9060
|
+
onlySubject,
|
|
9061
|
+
showStepsOfSubject
|
|
8888
9062
|
]
|
|
8889
9063
|
);
|
|
8890
9064
|
const availableTabs = AGENT_CONVERSATION_DETAIL_TABS.filter((tab) => (tab !== "sandbox" || hasSandbox) && (tab !== "requests" || isDebugAllowed));
|
|
@@ -9029,6 +9203,7 @@ const AgentConversationDetailScreen = ({
|
|
|
9029
9203
|
/* @__PURE__ */ jsx("span", { children: t("Debug shows skills, tool calls with arguments and results, compaction, model and effort per turn, tokens, costs, times, sub-agents and the request that was sent.") })
|
|
9030
9204
|
] }) : null
|
|
9031
9205
|
] }),
|
|
9206
|
+
onlySubject !== null ? /* @__PURE__ */ jsx(SubjectFilterNote, { onlySubject, describeSubjectKind, onClear: () => showStepsOfSubject(null) }) : null,
|
|
9032
9207
|
/* @__PURE__ */ jsx(
|
|
9033
9208
|
ConversationTurns,
|
|
9034
9209
|
{
|
|
@@ -9049,6 +9224,7 @@ const AgentConversationDetailScreen = ({
|
|
|
9049
9224
|
activeTab === "delegation" ? /* @__PURE__ */ jsx(DelegationPanel, {}) : null,
|
|
9050
9225
|
activeTab === "sandbox" ? /* @__PURE__ */ jsx(SandboxPanel, {}) : null,
|
|
9051
9226
|
activeTab === "files" ? /* @__PURE__ */ jsx(FilesPanel, {}) : null,
|
|
9227
|
+
activeTab === "records" ? /* @__PURE__ */ jsx(WorkedRecordsPanel, {}) : null,
|
|
9052
9228
|
activeTab === "requests" ? /* @__PURE__ */ jsx(RequestsPanel, { conversationCosts: header, subAgentConversationCount, livePollingIntervalMs }) : null,
|
|
9053
9229
|
activeTab === "context" ? /* @__PURE__ */ jsx(ContextPanel, { turnPageSize: pageSize }) : null
|
|
9054
9230
|
] }) : conversationQuery.isLoading ? null : /* @__PURE__ */ jsx(StatusCallout, { tone: "info", title: fallbackTitle, description: t("The conversation does not exist.") }),
|
|
@@ -13766,6 +13942,8 @@ export {
|
|
|
13766
13942
|
mapAgentInspectSubAgent,
|
|
13767
13943
|
mapAgentInspectTrace,
|
|
13768
13944
|
mapAgentInspectTurn,
|
|
13945
|
+
mapAgentInspectWorkedSubject,
|
|
13946
|
+
mapAgentInspectWorkedSubjects,
|
|
13769
13947
|
mergeAgentConnectionLogos,
|
|
13770
13948
|
mergeAgentInspectTraces,
|
|
13771
13949
|
mergeAgentInspectTurns,
|
|
@@ -13794,6 +13972,7 @@ export {
|
|
|
13794
13972
|
readAgentConversationListValues,
|
|
13795
13973
|
readAgentInspectDebugSwitches,
|
|
13796
13974
|
readSentPayloadValue,
|
|
13975
|
+
readSubjectFilter,
|
|
13797
13976
|
releasableAgentSpaceIdsOfDriveRoot,
|
|
13798
13977
|
resolveAdminPeriod,
|
|
13799
13978
|
resolveAgentConnectReturn,
|
|
@@ -13806,6 +13985,7 @@ export {
|
|
|
13806
13985
|
seriesFillClassNameOf,
|
|
13807
13986
|
sharedBlocksOf,
|
|
13808
13987
|
shiftAgentInspectDay,
|
|
13988
|
+
shortAgentInspectSubjectClass,
|
|
13809
13989
|
skillGroupSectionKeyOf,
|
|
13810
13990
|
skillLoadCountsByNameOf,
|
|
13811
13991
|
skillToolDefinitionTokensOf,
|
|
@@ -13814,6 +13994,7 @@ export {
|
|
|
13814
13994
|
skillToolParametersSchemaOf,
|
|
13815
13995
|
skillToolTokenPartFillClassNameOf,
|
|
13816
13996
|
sortToolResponseStats,
|
|
13997
|
+
subjectKindLabelOf,
|
|
13817
13998
|
sumControlPanelSequence,
|
|
13818
13999
|
sumSubSkillTotals,
|
|
13819
14000
|
summarizeAgentContextComposition,
|
|
@@ -13834,6 +14015,7 @@ export {
|
|
|
13834
14015
|
wireNumberOf,
|
|
13835
14016
|
withInspectStepLine,
|
|
13836
14017
|
wordsOfIdentifier,
|
|
13837
|
-
writeAgentInspectDebugSwitches
|
|
14018
|
+
writeAgentInspectDebugSwitches,
|
|
14019
|
+
writeSubjectFilter
|
|
13838
14020
|
};
|
|
13839
14021
|
//# sourceMappingURL=admin.js.map
|