@mgamadeus/ddd-agents 0.15.2 → 0.16.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.
Files changed (55) hide show
  1. package/README.md +34 -1
  2. package/dist/admin.js +258 -15
  3. package/dist/admin.js.map +1 -1
  4. package/dist/chat.js +221 -63
  5. package/dist/chat.js.map +1 -1
  6. package/dist/chunks/{agents-http-trace-mappers-BYEpNy0b.js → agents-http-trace-mappers-rsbGAf2_.js} +64 -14
  7. package/dist/chunks/agents-http-trace-mappers-rsbGAf2_.js.map +1 -0
  8. package/dist/chunks/{content-from-unified-diff-Dzsh8kR2.js → content-from-unified-diff-DWyBHRSy.js} +233 -63
  9. package/dist/chunks/content-from-unified-diff-DWyBHRSy.js.map +1 -0
  10. package/dist/chunks/{contract-IQHESBXq.js → contract-DtFmOk91.js} +5 -3
  11. package/dist/chunks/contract-DtFmOk91.js.map +1 -0
  12. package/dist/chunks/{conversation-B7-evdj_.js → conversation-Cbrqtx-_.js} +6 -2
  13. package/dist/chunks/{conversation-B7-evdj_.js.map → conversation-Cbrqtx-_.js.map} +1 -1
  14. package/dist/chunks/conversation-trace-fVeh6Lg6.js.map +1 -1
  15. package/dist/chunks/{withPollingChangeSubscription-XvCpjGmd.js → withPollingChangeSubscription-Cz3Diolr.js} +10 -2
  16. package/dist/chunks/withPollingChangeSubscription-Cz3Diolr.js.map +1 -0
  17. package/dist/client-testing.js +22 -2
  18. package/dist/client-testing.js.map +1 -1
  19. package/dist/client.js +23 -11
  20. package/dist/client.js.map +1 -1
  21. package/dist/contract.js +5 -3
  22. package/dist/files/i18n-keys.json +807 -13
  23. package/dist/styles.css +73 -1
  24. package/dist/types/admin/conversations/AgentConversationDetailScreen.d.ts +1 -1
  25. package/dist/types/admin/conversations/BackgroundJobsPanel.d.ts +28 -0
  26. package/dist/types/admin/conversations/agent-inspect-api.d.ts +13 -1
  27. package/dist/types/admin/conversations/agent-inspect-mappers.d.ts +3 -1
  28. package/dist/types/admin/conversations/agent-inspect-types.d.ts +45 -0
  29. package/dist/types/chat/controller/use-conversation-activity.d.ts +13 -1
  30. package/dist/types/chat/trace/ConversationTurnTrace.d.ts +4 -2
  31. package/dist/types/chat/trace/RunningBackgroundJobLines.d.ts +19 -0
  32. package/dist/types/chat/trace/StepKindDetails.d.ts +11 -1
  33. package/dist/types/chat/trace/ToolStepDetail.d.ts +2 -0
  34. package/dist/types/chat/trace/UntrustedContentText.d.ts +11 -0
  35. package/dist/types/chat/trace/index.d.ts +4 -2
  36. package/dist/types/chat/trace/running-background-jobs-context.d.ts +20 -0
  37. package/dist/types/chat/trace/trace-counts.d.ts +2 -0
  38. package/dist/types/chat/trace/trace-labels.d.ts +15 -2
  39. package/dist/types/chat/trace/trace-types.d.ts +22 -0
  40. package/dist/types/chat/trace/untrusted-content.d.ts +23 -0
  41. package/dist/types/client/AgentsConversationClient.d.ts +8 -1
  42. package/dist/types/client/http/agents-http-mappers.d.ts +8 -2
  43. package/dist/types/client/http/agents-http-trace-mappers.d.ts +4 -2
  44. package/dist/types/client/http/agents-http-trace-wire.d.ts +18 -0
  45. package/dist/types/client/http/agents-http-wire.d.ts +18 -0
  46. package/dist/types/client/testing/createInMemoryAgentsConversationClient.d.ts +6 -1
  47. package/dist/types/contract/conversation-trace.d.ts +30 -0
  48. package/dist/types/contract/conversation.d.ts +45 -0
  49. package/dist/types/entries/admin.d.ts +3 -2
  50. package/package.json +1 -1
  51. package/public-api.json +31 -0
  52. package/dist/chunks/agents-http-trace-mappers-BYEpNy0b.js.map +0 -1
  53. package/dist/chunks/content-from-unified-diff-Dzsh8kR2.js.map +0 -1
  54. package/dist/chunks/contract-IQHESBXq.js.map +0 -1
  55. package/dist/chunks/withPollingChangeSubscription-XvCpjGmd.js.map +0 -1
package/README.md CHANGED
@@ -57,6 +57,7 @@ const client = createAgentsHttpConversationClient({
57
57
  | `startConversation` | `POST /start`, or `POST /start/{agentSpaceKey}` for a key above 0 (`buildStartPath` changes it) |
58
58
  | `postMessage`, `injectSignal`, `retryConversation` | `POST /{id}/postMessage`, `/{id}/injectSignal`, `/{id}/retry` |
59
59
  | `renameConversation`, `deleteConversation` | `PATCH /{id}/title`, `DELETE /{id}` |
60
+ | `stopBackgroundJob` | `POST /{id}/backgroundJobs/{backgroundJobId}/stop` (`AgentConversationBackgroundJobsTrait`, which the application mounts beside the reads and writes) |
60
61
  | `getSelectableModels` | `GET /selectable-models`, only with `hasSelectableModelsRoute: true` |
61
62
 
62
63
  Further options: `fetch` (default: the global one), `extraRequestParameters` (query parameters per operation),
@@ -68,6 +69,17 @@ body first (`AI_BUDGET_REACHED`, `RATE_LIMIT_EXCEEDED`, `CONVERSATION_CLOSED`),
68
69
  (`Wire…`) and the mappers (`mapWireConversation`, `mapWireConversationMessage`, …) are exported for a binding of its own
69
70
  over the same routes.
70
71
 
72
+ **Background jobs.** The activity answer carries `ConversationActivity.runningBackgroundJobs`: the jobs of the
73
+ conversation whose end is not reported yet, oldest first, whatever the turn (`ConversationBackgroundJob`: id, kind,
74
+ label, state, live status and note, start, deadline, due time; states `CONVERSATION_BACKGROUND_JOB_STATES`, live
75
+ statuses `CONVERSATION_BACKGROUND_JOB_LIVE_STATUSES`, types `ConversationBackgroundJobState`,
76
+ `ConversationBackgroundJobLiveStatus`). The optional port function `stopBackgroundJob(conversationId,
77
+ backgroundJobId)` stops one job and answers `ConversationBackgroundJobStop` (`isStopped`, the job's `state`); the agent
78
+ reads the stop in its next turn, it is not woken. `withPollingChangeSubscription` and
79
+ `createInMemoryAgentsConversationClient` pass it through. Wire shapes and mappers for a binding of its own:
80
+ `WireBackgroundJob`, `WireBackgroundJobStopResponse`, `mapWireBackgroundJob`, `mapWireRunningBackgroundJobs`,
81
+ `mapWireBackgroundJobStop`.
82
+
71
83
  **Client context.** `clientContext(operation)` tells the agent what the owner sees: it is read on every start, posted
72
84
  message and injected signal and sent as the body field `clientContext` — the route path, the route parameters (a flat
73
85
  map), the record kind and id, the tab (`AgentsClientContext`). The server stores it on that owner message, and the agent
@@ -184,7 +196,10 @@ const uiClient = useAgentUIClient({
184
196
  Every interface text of the package goes through `AgentsEnvironment.texts.translate(key, replacements, context)`; the key
185
197
  is the English text with `%placeholders%`, `context` the plural category (`one` / `other`) where a count decides.
186
198
  `@mgamadeus/ddd-agents/i18n-keys.json` lists every key: `key`, `defaultText`, `placeholders`, `contexts`, `usedIn` (the
187
- source files). A counted text of the trace blocks has one key per form, each asked with its category
199
+ source files). `contexts` names every context the key is asked in (a plural category, or the context an admin screen
200
+ gives a word); a key asked only without a context has `contexts: []`, and a key asked with a context in one place and
201
+ without one in another lists that use as the empty context `""` (first), so an export that keys a text with a context as
202
+ `<text>__<context>` keeps the plain `<text>` too. A counted text of the trace blocks has one key per form, each asked with its category
188
203
  (`%count% step` with `one`, `%count% steps` with `other`), so the English default reads right as it is. Set `texts` app-wide (`setAgentsEnvironment`) or per subtree (`<AgentsProvider environment={{ texts }}>`).
189
204
 
190
205
  ```ts
@@ -374,6 +389,15 @@ Pass one stable component (what changes comes through a context of the host), or
374
389
  activity ticker keeps one source of live step rows: the trace in `normal` and `verbose`, the ticker in `summary`.
375
390
  A spoken sentence a voice call left without an answer (an owner row with a `PHONE_CALL_ENDED` marker above it) is
376
391
  no turn in flight: no working line, no live trace, no Stop — only the server's run status shows a turn then.
392
+ - **Background jobs beside the turns.** A job runs on after the turn that started it answered (a command past the
393
+ detach window, a wake-up the agent set). `AgentChat` provides `RunningBackgroundJobsContext` from the activity read
394
+ (`useRunningBackgroundJobs()`, `RunningBackgroundJobsContextValue`), and `ConversationTurnTrace` draws
395
+ `RunningBackgroundJobLines` under the newest turn: one line per job with a spinner, its label, its clock (a wake-up:
396
+ "rings in …"), the hint while it waits for the host, and a Stop for that job alone when the client has
397
+ `stopBackgroundJob`. The chat keeps its running state while a job whose end wakes the agent runs. In the steps, a
398
+ call that started a job shows it as pills (`BackgroundJobFacts`, the state in words `describeBackgroundJobState`,
399
+ block data `TraceBackgroundJob`, contract `ConversationTraceBackgroundJob`, wire `WireTraceBackgroundJob` with
400
+ `mapWireTraceBackgroundJob`); its end is the signal step of its notification.
377
401
  - **A step that waits for the owner's click.** A write the server stored for the owner's click on its widget (setting
378
402
  `AI.ownerConsent.stepConfirmation.byButtonInChat`) arrives as `ConversationTraceStep.isAwaitingOwnerClick` without
379
403
  `isHeldForConsent`: it reads as waiting (key `Click on a step`), and no approval card is drawn beside it — the
@@ -652,6 +676,15 @@ export const agentSkillCatalogApi = createAgentSkillCatalogApi({ baseApi: adminA
652
676
  `diffLines` (a line diff by longest common subsequence; above `maximumCells` it lists removed then added lines and says
653
677
  so) and `foldEqualLines`.
654
678
 
679
+ **Background jobs of a conversation.** `AgentConversationDetailScreen` has the tab `backgroundJobs`
680
+ (`AGENT_CONVERSATION_DETAIL_TABS`): the jobs of the conversation's tree, newest first, with every stored field — state
681
+ (`AGENT_BACKGROUND_JOB_STATE`, context `AGENT_BACKGROUND_JOB_STATE_CONTEXT`), delivery, live status, deadline, checks,
682
+ how the end was reported (`AGENT_BACKGROUND_JOB_REPORT_KIND_LABELS`, context `AGENT_BACKGROUND_JOB_REPORT_CONTEXT`) and
683
+ the outcome (`AgentInspectBackgroundJobOutcome`). It reads `useBackgroundJobsQuery` of `createAgentInspectApi` on
684
+ `GET <prefix>/{conversationId}/backgroundJobs` (`AgentInspectBackgroundJobsResponse`, mapped by
685
+ `mapAgentInspectBackgroundJobs` to `AgentInspectBackgroundJob`; empty at the trace level RESULT);
686
+ `createStaticAgentInspectApi` answers it from `backgroundJobs`.
687
+
655
688
  ## Stylesheet and theme
656
689
 
657
690
  - The package's root rules (`:root` variables, the image render's `html, body` reset) sit in the cascade layer
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, 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";
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, Bot, ChevronsUp, CircleStop, GitBranch, ClipboardCheck, PanelRightOpen, Eye, FileJson, ScrollText, LayoutPanelTop, MessageSquarePlus, SlidersHorizontal, Square, Bug, Code, ListTree, ExternalLink, HardDrive, ChevronDown, Folder, File, Filter, 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";
@@ -12,8 +12,8 @@ import { normalizeDddError, parseDddDateTime } from "@mgamadeus/ddd-web/contract
12
12
  import { StatusCallout, PageHeader, EntityTabs, DefinitionList, EntityDetailShell, MoreActionsMenu, EntityListPage, StatusCalloutAction, PageToolbar } from "@mgamadeus/ddd-admin-ui/page";
13
13
  import { MarkdownPreview } from "@mgamadeus/ddd-admin-ui/markdown";
14
14
  import { NoteList, MetricGrid, MetricTile, DeltaText } from "@mgamadeus/ddd-admin-ui/data";
15
- import { p as mapWireTraceFileChange, s as mapWireTraceStep, v as mapWireTurnTrace, q as mapWireTraceMessage, t as mapWireTraceTaskPlanItems } from "./chunks/agents-http-trace-mappers-BYEpNy0b.js";
16
- import { ab as describeTraceModelName, o as readTaskPlanCountsOfStep, w as readTaskPlanCounts, r as readTraceMoment, a9 as describeTraceDecisionSite, ad as describeTraceSignal, B as readTraceStepState, a3 as createTraceFormat, as as describeTraceEffort, v as ToolStepGroup, t as TurnMetaLine, F as FileChangesSummary, L as LoadedSkillsDisclosure, an as readTraceStateOfStatus, f as formatTraceClock, am as readTraceRunResultText, V as TerminalBlock, ag as formatShortSha256, k as FileEditBlock, ac as describeTraceMount, e as readTraceFileChangeLetter, aj as readContentFromUnifiedDiff, at as readTraceFileName, X as ToolStepDetail, $ as TraceViewModeSwitch } from "./chunks/content-from-unified-diff-Dzsh8kR2.js";
15
+ import { u as mapWireTraceFileChange, w as mapWireTraceStep, z as mapWireTurnTrace, v as mapWireTraceMessage, x as mapWireTraceTaskPlanItems } from "./chunks/agents-http-trace-mappers-rsbGAf2_.js";
16
+ import { r as readTraceMoment, au as UntrustedContentText, ad as describeTraceModelName, o as readTaskPlanCountsOfStep, w as readTaskPlanCounts, ab as describeTraceDecisionSite, af as describeTraceSignal, B as readTraceStepState, a4 as createTraceFormat, av as describeTraceEffort, v as ToolStepGroup, t as TurnMetaLine, F as FileChangesSummary, L as LoadedSkillsDisclosure, ap as readTraceStateOfStatus, f as formatTraceClock, ao as readTraceRunResultText, W as TerminalBlock, ai as formatShortSha256, k as FileEditBlock, ae as describeTraceMount, e as readTraceFileChangeLetter, al as readContentFromUnifiedDiff, aw as readTraceFileName, ax as describeTraceDetachedCallLine, Y as ToolStepDetail, ay as describeTraceSignalText, a0 as TraceViewModeSwitch } from "./chunks/content-from-unified-diff-DWyBHRSy.js";
17
17
  import { FormDialog, FormErrors, FormFieldFrame, FormDrawer, FormActions } from "@mgamadeus/ddd-admin-ui/form";
18
18
  import { QuickFilterPills } from "@mgamadeus/ddd-admin-ui/glass";
19
19
  const CodeBlock = ({
@@ -5025,6 +5025,7 @@ const buildAgentInspectRequests = (apiPrefix) => {
5025
5025
  workedSubjects: (arg) => ({
5026
5026
  url: `${conversationPath(arg)}/workedSubjects${toQueryString({ afterId: arg.afterId, limit: arg.limit })}`
5027
5027
  }),
5028
+ backgroundJobs: (arg) => ({ url: `${conversationPath(arg)}/backgroundJobs` }),
5028
5029
  fileChangeDiff: (arg) => ({
5029
5030
  url: `${conversationPath(arg)}/fileChanges/${encodeURIComponent(String(arg.fileChangeId))}/diff`
5030
5031
  }),
@@ -5058,6 +5059,7 @@ const agentInspectEndpointDefinitions = (apiPrefix) => {
5058
5059
  adminUiAgentInspectDelegations: { kind: "query", request: requests.delegations, providesTags: [CONVERSATION] },
5059
5060
  adminUiAgentInspectFileChanges: { kind: "query", request: requests.fileChanges, providesTags: [CONVERSATION] },
5060
5061
  adminUiAgentInspectWorkedSubjects: { kind: "query", request: requests.workedSubjects, providesTags: [CONVERSATION] },
5062
+ adminUiAgentInspectBackgroundJobs: { kind: "query", request: requests.backgroundJobs, providesTags: [CONVERSATION] },
5061
5063
  adminUiAgentInspectFileChangeDiff: { kind: "query", request: requests.fileChangeDiff },
5062
5064
  adminUiAgentInspectSandbox: { kind: "query", request: requests.sandbox, providesTags: [CONVERSATION] },
5063
5065
  adminUiAgentInspectCompactionNodes: { kind: "query", request: requests.compactionNodes, providesTags: [CONVERSATION] },
@@ -5085,6 +5087,7 @@ const createAgentInspectApi = ({ baseApi, apiPrefix }) => {
5085
5087
  useDelegationsQuery: hookOf("adminUiAgentInspectDelegations"),
5086
5088
  useFileChangesQuery: hookOf("adminUiAgentInspectFileChanges"),
5087
5089
  useWorkedSubjectsQuery: hookOf("adminUiAgentInspectWorkedSubjects"),
5090
+ useBackgroundJobsQuery: hookOf("adminUiAgentInspectBackgroundJobs"),
5088
5091
  useFileChangeDiffQuery: hookOf("adminUiAgentInspectFileChangeDiff"),
5089
5092
  useSandboxQuery: hookOf("adminUiAgentInspectSandbox"),
5090
5093
  useCompactionNodesQuery: hookOf("adminUiAgentInspectCompactionNodes"),
@@ -5108,6 +5111,7 @@ const createStaticAgentInspectApi = (data) => ({
5108
5111
  useDelegationsQuery: staticQueryHook((arg) => data.delegations?.(arg)),
5109
5112
  useFileChangesQuery: staticQueryHook((arg) => data.fileChanges?.(arg)),
5110
5113
  useWorkedSubjectsQuery: staticQueryHook((arg) => data.workedSubjects?.(arg)),
5114
+ useBackgroundJobsQuery: staticQueryHook((arg) => data.backgroundJobs?.(arg)),
5111
5115
  useFileChangeDiffQuery: staticQueryHook((arg) => data.fileChangeDiff?.(arg)),
5112
5116
  useSandboxQuery: staticQueryHook((arg) => data.sandbox?.(arg)),
5113
5117
  useCompactionNodesQuery: staticQueryHook((arg) => data.compactionNodes?.(arg)),
@@ -5164,6 +5168,43 @@ const mapAgentInspectWorkedSubject = (wireEntry) => {
5164
5168
  };
5165
5169
  };
5166
5170
  const mapAgentInspectWorkedSubjects = (response) => objectsOf(response?.workedSubjects).map(mapAgentInspectWorkedSubject).filter((workedSubject) => workedSubject !== null);
5171
+ const mapAgentInspectBackgroundJob = (wireJob) => {
5172
+ const id = numberOrNull(wireJob.id);
5173
+ if (id === null) return null;
5174
+ const wireOutcome = isWireObject(wireJob.outcome) ? wireJob.outcome : null;
5175
+ return {
5176
+ id,
5177
+ rootConversationId: numberOrNull(wireJob.rootConversationId),
5178
+ startedByConversationId: numberOrNull(wireJob.startedByConversationId),
5179
+ toolCallMessageId: numberOrNull(wireJob.toolCallMessageId),
5180
+ toolCallId: stringOrNull(wireJob.toolCallId),
5181
+ toolName: stringOrNull(wireJob.toolName),
5182
+ workspaceKey: stringOrNull(wireJob.workspaceKey),
5183
+ kind: stringOrNull(wireJob.kind),
5184
+ reference: stringOrNull(wireJob.reference),
5185
+ label: stringOrNull(wireJob.label) ?? "",
5186
+ state: stringOrNull(wireJob.state),
5187
+ delivery: stringOrNull(wireJob.delivery),
5188
+ liveStatus: stringOrNull(wireJob.liveStatus),
5189
+ liveNote: stringOrNull(wireJob.liveNote),
5190
+ startedAt: stringOrNull(wireJob.startedAt),
5191
+ dueAt: stringOrNull(wireJob.dueAt),
5192
+ deadlineAt: stringOrNull(wireJob.deadlineAt),
5193
+ nextCheckAt: stringOrNull(wireJob.nextCheckAt),
5194
+ lastCheckedAt: stringOrNull(wireJob.lastCheckedAt),
5195
+ checkCount: numberOrNull(wireJob.checkCount) ?? 0,
5196
+ endedAt: stringOrNull(wireJob.endedAt),
5197
+ reportedAt: stringOrNull(wireJob.reportedAt),
5198
+ reportKind: stringOrNull(wireJob.reportKind),
5199
+ outcome: wireOutcome === null ? null : {
5200
+ text: stringOrNull(wireOutcome.text),
5201
+ fullResultLocation: stringOrNull(wireOutcome.fullResultLocation),
5202
+ exitCode: numberOrNull(wireOutcome.exitCode),
5203
+ runSeconds: numberOrNull(wireOutcome.runSeconds)
5204
+ }
5205
+ };
5206
+ };
5207
+ const mapAgentInspectBackgroundJobs = (response) => objectsOf(response?.elements).map(mapAgentInspectBackgroundJob).filter((backgroundJob) => backgroundJob !== null);
5167
5208
  const shortAgentInspectSubjectClass = (subjectEntityClass) => subjectEntityClass.split("\\").pop() ?? subjectEntityClass;
5168
5209
  const mapSubAgent = (wireSubAgent, mapped) => {
5169
5210
  if (!isWireObject(wireSubAgent) || mapped === null) return null;
@@ -5328,6 +5369,157 @@ const AGENT_INSPECT_SEGMENTS = ["ALL", "RUNNING", "AWAITING_OWNER", "WITH_PROBLE
5328
5369
  const AGENT_INSPECT_SORT_ORDERS = ["LAST_ACTIVITY", "CREATED", "COST"];
5329
5370
  const AGENT_INSPECT_RUN_STATES = ["IDLE", "QUEUED", "RUNNING", "AWAITING_DELEGATES", "COMPLETED", "FAILED", "CANCELLED"];
5330
5371
  const AGENT_INSPECT_ORIGINS = ["OWNER", "DELEGATION", "SCHEDULE", "ADMIN_TASK", "PHONE_CALL", "EXTERNAL_AGENT"];
5372
+ const AgentInspectScopeContext = createContext(null);
5373
+ const AgentInspectScopeProvider = AgentInspectScopeContext.Provider;
5374
+ const useAgentInspectScope = () => {
5375
+ const scope = useContext(AgentInspectScopeContext);
5376
+ if (scope === null) throw new Error("This block is a part of AgentConversationDetailScreen and needs its scope.");
5377
+ return scope;
5378
+ };
5379
+ const AGENT_BACKGROUND_JOB_STATE_CONTEXT = "agent-background-job-state";
5380
+ const AGENT_BACKGROUND_JOB_STATE = defineStatusMap$1(
5381
+ {
5382
+ RUNNING: { label: m("Running", { context: "agent-background-job-state" }), tone: "info" },
5383
+ SUCCEEDED: { label: m("Finished", { context: "agent-background-job-state" }), tone: "success" },
5384
+ FAILED: { label: m("Failed", { context: "agent-background-job-state" }), tone: "danger" },
5385
+ TIMED_OUT: { label: m("Timed out", { context: "agent-background-job-state" }), tone: "danger" },
5386
+ CANCELLED: { label: m("Stopped", { context: "agent-background-job-state" }), tone: "neutral" },
5387
+ LOST: { label: m("Lost", { context: "agent-background-job-state" }), tone: "warning" }
5388
+ },
5389
+ { context: AGENT_BACKGROUND_JOB_STATE_CONTEXT }
5390
+ );
5391
+ const AGENT_BACKGROUND_JOB_REPORT_CONTEXT = "agent-background-job-report";
5392
+ const AGENT_BACKGROUND_JOB_REPORT_KIND_LABELS = {
5393
+ NOTIFICATION: m("reported to the agent", { context: "agent-background-job-report" }),
5394
+ TOOL_RESULT: m("reported in a tool result", { context: "agent-background-job-report" }),
5395
+ SYNCHRONOUS_STEP: m("read in the same step", { context: "agent-background-job-report" }),
5396
+ AGENT_STOP: m("stopped by the agent", { context: "agent-background-job-report" }),
5397
+ OWNER_STOP: m("stopped by the owner", { context: "agent-background-job-report" }),
5398
+ TURN_STOP: m("stopped with the turn", { context: "agent-background-job-report" }),
5399
+ RUN_CANCEL: m("stopped with the cancelled run", { context: "agent-background-job-report" }),
5400
+ CONVERSATION_DELETED: m("conversation deleted", { context: "agent-background-job-report" })
5401
+ };
5402
+ const BackgroundJobReportValue = ({ reportKind, reportedAt }) => {
5403
+ const { t } = useTranslate();
5404
+ if (!reportKind) return null;
5405
+ const label = Object.hasOwn(AGENT_BACKGROUND_JOB_REPORT_KIND_LABELS, reportKind) ? t(AGENT_BACKGROUND_JOB_REPORT_KIND_LABELS[reportKind], { context: AGENT_BACKGROUND_JOB_REPORT_CONTEXT }) : reportKind;
5406
+ return /* @__PURE__ */ jsxs("span", { "data-testid": "agent-background-job-report", "data-report-kind": reportKind, children: [
5407
+ /* @__PURE__ */ jsx("span", { title: reportKind, children: label }),
5408
+ reportedAt ? ` · ${reportedAt}` : null
5409
+ ] });
5410
+ };
5411
+ const isKnownBackgroundJobState = (state) => state !== null && Object.hasOwn(AGENT_BACKGROUND_JOB_STATE, state);
5412
+ const BackgroundJobFact = ({ label, value, breakable = false }) => value === null || value === void 0 || value === "" ? null : /* @__PURE__ */ jsxs("span", { className: breakable ? "min-w-0 break-all" : "whitespace-nowrap", children: [
5413
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
5414
+ label,
5415
+ " "
5416
+ ] }),
5417
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums", children: value })
5418
+ ] });
5419
+ const BackgroundJobRow = ({ backgroundJob, formatMoment }) => {
5420
+ const { t } = useTranslate();
5421
+ const { linkComponent: Link, conversationId, buildConversationHref } = useAgentInspectScope();
5422
+ const state = backgroundJob.state;
5423
+ const startedByConversationId = backgroundJob.startedByConversationId;
5424
+ const rootConversationId = backgroundJob.rootConversationId ?? conversationId;
5425
+ const isSubAgent = startedByConversationId !== null && startedByConversationId !== rootConversationId;
5426
+ const subAgentHref = isSubAgent && startedByConversationId !== null && startedByConversationId !== conversationId ? buildConversationHref?.(startedByConversationId) ?? null : null;
5427
+ const isWaitingForHost = state === "RUNNING" && backgroundJob.liveStatus === "WAITING_FOR_HOST";
5428
+ const startedAt = formatMoment(backgroundJob.startedAt);
5429
+ const endedAt = formatMoment(backgroundJob.endedAt);
5430
+ return /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1.5 px-3 py-2.5", "data-testid": "agent-background-job", "data-background-job-id": backgroundJob.id, children: [
5431
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
5432
+ backgroundJob.kind ? /* @__PURE__ */ jsx(Tag, { size: "sm", children: backgroundJob.kind }) : null,
5433
+ /* @__PURE__ */ jsx("span", { className: "truncate text-sm font-medium", title: backgroundJob.label, children: backgroundJob.label || t("Background job", { context: "agent-background-jobs" }) }),
5434
+ /* @__PURE__ */ jsxs("span", { className: "text-xs text-muted-foreground tabular-nums", children: [
5435
+ "#",
5436
+ backgroundJob.id
5437
+ ] }),
5438
+ isKnownBackgroundJobState(state) ? /* @__PURE__ */ jsx(StatusBadge, { tone: AGENT_BACKGROUND_JOB_STATE[state].tone, label: t(AGENT_BACKGROUND_JOB_STATE[state].label, { context: AGENT_BACKGROUND_JOB_STATE_CONTEXT }) }) : state ? /* @__PURE__ */ jsx(StatusBadge, { tone: "neutral", label: state }) : null,
5439
+ isWaitingForHost ? /* @__PURE__ */ jsx(StatusBadge, { tone: "warning", label: t("Waits for the host", { context: "agent-background-jobs" }) }) : null,
5440
+ backgroundJob.delivery === "WITHOUT_RESUME" ? /* @__PURE__ */ jsx(Tag, { size: "sm", children: t("read later", { context: "agent-background-jobs" }) }) : null,
5441
+ isSubAgent ? /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
5442
+ /* @__PURE__ */ jsx(Bot, { "aria-hidden": true, className: "size-3" }),
5443
+ subAgentHref !== null ? /* @__PURE__ */ jsx(Link, { href: subAgentHref, className: "underline-offset-2 hover:underline", children: t("by a sub-agent", { context: "agent-background-jobs" }) }) : t("by a sub-agent", { context: "agent-background-jobs" })
5444
+ ] }) : null
5445
+ ] }),
5446
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-[13px]", children: [
5447
+ /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 whitespace-nowrap tabular-nums", children: [
5448
+ /* @__PURE__ */ jsx(Hourglass, { "aria-hidden": true, className: "size-3.5 text-muted-foreground" }),
5449
+ startedAt === null ? /* @__PURE__ */ jsx(EmptyValue, {}) : endedAt === null ? startedAt : `${startedAt} – ${endedAt}`
5450
+ ] }),
5451
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("due", { context: "agent-background-jobs" }), value: formatMoment(backgroundJob.dueAt) }),
5452
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("limit", { context: "agent-background-jobs" }), value: formatMoment(backgroundJob.deadlineAt) }),
5453
+ /* @__PURE__ */ jsx(
5454
+ BackgroundJobFact,
5455
+ {
5456
+ label: t("checks", { context: "agent-background-jobs" }),
5457
+ value: backgroundJob.checkCount > 0 || backgroundJob.lastCheckedAt ? formatUiNumber(backgroundJob.checkCount) : null
5458
+ }
5459
+ ),
5460
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("last check", { context: "agent-background-jobs" }), value: formatMoment(backgroundJob.lastCheckedAt) }),
5461
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("next check", { context: "agent-background-jobs" }), value: state === "RUNNING" ? formatMoment(backgroundJob.nextCheckAt) : null }),
5462
+ /* @__PURE__ */ jsx(
5463
+ BackgroundJobFact,
5464
+ {
5465
+ label: t("end", { context: "agent-background-jobs" }),
5466
+ value: backgroundJob.reportKind === null ? null : /* @__PURE__ */ jsx(BackgroundJobReportValue, { reportKind: backgroundJob.reportKind, reportedAt: formatMoment(backgroundJob.reportedAt) })
5467
+ }
5468
+ ),
5469
+ /* @__PURE__ */ jsx(
5470
+ BackgroundJobFact,
5471
+ {
5472
+ label: t("started by the tool", { context: "agent-background-jobs" }),
5473
+ value: backgroundJob.toolName ? /* @__PURE__ */ jsx("code", { className: "font-mono text-xs", title: backgroundJob.toolName, children: backgroundJob.toolName }) : null
5474
+ }
5475
+ )
5476
+ ] }),
5477
+ backgroundJob.liveNote ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: backgroundJob.liveNote }) : null,
5478
+ backgroundJob.outcome?.text ? /* @__PURE__ */ jsx("pre", { className: "max-h-40 overflow-auto whitespace-pre-wrap rounded-lg bg-muted px-2.5 py-2 text-xs", "data-testid": "agent-background-job-outcome", children: /* @__PURE__ */ jsx(UntrustedContentText, { text: backgroundJob.outcome.text }) }) : null,
5479
+ backgroundJob.reference || backgroundJob.workspaceKey ? /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-x-4 gap-y-1 font-mono text-[11.5px] text-muted-foreground", children: [
5480
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("reference", { context: "agent-background-jobs" }), value: backgroundJob.reference, breakable: true }),
5481
+ /* @__PURE__ */ jsx(BackgroundJobFact, { label: t("workspace", { context: "agent-background-jobs" }), value: backgroundJob.workspaceKey, breakable: true })
5482
+ ] }) : null
5483
+ ] });
5484
+ };
5485
+ const BackgroundJobsPanel = () => {
5486
+ const { t } = useTranslate();
5487
+ const { api, conversationId, locale } = useAgentInspectScope();
5488
+ const query = api.useBackgroundJobsQuery({ conversationId });
5489
+ const backgroundJobs = useMemo(() => query.data ? mapAgentInspectBackgroundJobs(query.data) : null, [query.data]);
5490
+ const formatMoment = useMemo(() => {
5491
+ const format = new Intl.DateTimeFormat(locale, { dateStyle: "short", timeStyle: "medium" });
5492
+ return (value) => {
5493
+ const moment = readTraceMoment(value);
5494
+ return moment === null ? null : format.format(moment);
5495
+ };
5496
+ }, [locale]);
5497
+ if (query.isError) {
5498
+ return /* @__PURE__ */ jsx(
5499
+ StatusCallout,
5500
+ {
5501
+ tone: "destructive",
5502
+ title: t("The background jobs could not be loaded", { context: "agent-background-jobs" }),
5503
+ description: normalizeDddError(query.error, t("The background jobs could not be loaded.", { context: "agent-background-jobs" })).message
5504
+ }
5505
+ );
5506
+ }
5507
+ if (backgroundJobs === null) return /* @__PURE__ */ jsx(Skeleton, { className: "h-32 w-full rounded-2xl" });
5508
+ if (backgroundJobs.length === 0) {
5509
+ return /* @__PURE__ */ jsx(
5510
+ StatusCallout,
5511
+ {
5512
+ tone: "info",
5513
+ title: t("No background jobs", { context: "agent-background-jobs" }),
5514
+ description: t("No tool call of this conversation left work running in the background.", { context: "agent-background-jobs" })
5515
+ }
5516
+ );
5517
+ }
5518
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-testid": "agent-background-jobs-panel", children: [
5519
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: t("Every background job of the conversation and its sub-agents, newest first.", { context: "agent-background-jobs" }) }),
5520
+ /* @__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: backgroundJobs.map((backgroundJob) => /* @__PURE__ */ jsx(BackgroundJobRow, { backgroundJob, formatMoment }, backgroundJob.id)) }) }) })
5521
+ ] });
5522
+ };
5331
5523
  const AGENT_INSPECT_DEBUG_SWITCH_NAMES = [
5332
5524
  "skills",
5333
5525
  "toolCalls",
@@ -5603,13 +5795,6 @@ const InspectActionButton = ({
5603
5795
  ]
5604
5796
  }
5605
5797
  );
5606
- const AgentInspectScopeContext = createContext(null);
5607
- const AgentInspectScopeProvider = AgentInspectScopeContext.Provider;
5608
- const useAgentInspectScope = () => {
5609
- const scope = useContext(AgentInspectScopeContext);
5610
- if (scope === null) throw new Error("This block is a part of AgentConversationDetailScreen and needs its scope.");
5611
- return scope;
5612
- };
5613
5798
  const AGENT_DECISION_STATUS_CONTEXT = "agent-decision-status";
5614
5799
  const AGENT_DECISION_STATUS_LABELS = {
5615
5800
  decided: m("decided", { context: "agent-decision-status" }),
@@ -8430,6 +8615,7 @@ const ToolCallDetail = ({ step }) => {
8430
8615
  const format = useMemo(() => createTraceFormat(locale), [locale]);
8431
8616
  const skillLoad = step.skillLoad;
8432
8617
  const skillEntries = skillLoad?.skills ?? [];
8618
+ const stepLine = (step.kind === "TOOL_CALL" ? describeTraceDetachedCallLine(step.backgroundJob, step.terminal != null, (text, replacements) => t(text, { replacements })) : null) ?? step.line;
8433
8619
  const planItems = step.taskPlanItems ?? [];
8434
8620
  return /* @__PURE__ */ jsxs(Fragment, { children: [
8435
8621
  /* @__PURE__ */ jsx(
@@ -8452,7 +8638,7 @@ const ToolCallDetail = ({ step }) => {
8452
8638
  ]
8453
8639
  }
8454
8640
  ),
8455
- step.line && step.line !== step.toolName ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: step.line }) : null,
8641
+ stepLine && stepLine !== step.toolName ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: stepLine }) : null,
8456
8642
  skillEntries.length > 0 ? /* @__PURE__ */ jsxs(DetailSection, { title: t("Skills of this load"), children: [
8457
8643
  /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-1 text-xs", "data-slot": "agent-step-skill-load", children: skillEntries.map((skill) => /* @__PURE__ */ jsxs("li", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5", children: [
8458
8644
  /* @__PURE__ */ jsx("span", { className: "font-mono font-semibold", children: skill.name }),
@@ -8467,6 +8653,7 @@ const ToolCallDetail = ({ step }) => {
8467
8653
  /* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1", children: item.title }),
8468
8654
  item.status ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: item.status.toLowerCase().replace(/_/g, " ") }) : null
8469
8655
  ] }, item.key)) }) }) : null,
8656
+ /* @__PURE__ */ jsx(BackgroundJobDetail, { step }),
8470
8657
  step.terminal ? /* @__PURE__ */ jsx(TerminalBlock, { ...step.terminal }) : null,
8471
8658
  step.fileChanges.map((fileChange, index) => /* @__PURE__ */ jsx(FileEditBlock, { fileChange, describeMount, onLoadFullDiff: loadFullDiff, onOpenInViewer: host.openFileInViewer }, `${fileChange.id ?? index}:${fileChange.path}`)),
8472
8659
  /* @__PURE__ */ jsx(
@@ -8483,6 +8670,48 @@ const ToolCallDetail = ({ step }) => {
8483
8670
  )
8484
8671
  ] });
8485
8672
  };
8673
+ const BackgroundJobDetail = ({ step }) => {
8674
+ const { t } = useTranslate();
8675
+ const { locale } = useAgentInspectScope();
8676
+ const formatMoment = useMemo(() => {
8677
+ const format = new Intl.DateTimeFormat(locale, { dateStyle: "short", timeStyle: "medium" });
8678
+ return (value) => {
8679
+ const moment = readTraceMoment(value);
8680
+ return moment === null ? null : format.format(moment);
8681
+ };
8682
+ }, [locale]);
8683
+ const backgroundJob = step.backgroundJob;
8684
+ if (!backgroundJob) return null;
8685
+ const state = backgroundJob.state;
8686
+ const stateEntry = state !== null && Object.hasOwn(AGENT_BACKGROUND_JOB_STATE, state) ? AGENT_BACKGROUND_JOB_STATE[state] : null;
8687
+ return /* @__PURE__ */ jsx(DetailSection, { title: t("Background job #%number%", { context: "agent-step-section", replacements: { number: backgroundJob.id } }), children: /* @__PURE__ */ jsx(
8688
+ FactList,
8689
+ {
8690
+ facts: [
8691
+ [t("Job", { context: "agent-step-fact" }), backgroundJob.label || null],
8692
+ [t("Kind", { context: "agent-step-fact" }), backgroundJob.kind ? /* @__PURE__ */ jsx("span", { className: "font-mono text-xs", children: backgroundJob.kind }) : null],
8693
+ [
8694
+ t("Status", { context: "agent-step-fact" }),
8695
+ stateEntry !== null ? /* @__PURE__ */ jsx(StatusBadge, { tone: stateEntry.tone, label: t(stateEntry.label, { context: AGENT_BACKGROUND_JOB_STATE_CONTEXT }) }) : state
8696
+ ],
8697
+ [
8698
+ t("Live status", { context: "agent-step-fact" }),
8699
+ state === "RUNNING" && backgroundJob.liveStatus === "WAITING_FOR_HOST" ? /* @__PURE__ */ jsx(StatusBadge, { tone: "warning", label: t("Waits for the host", { context: "agent-background-jobs" }) }) : null
8700
+ ],
8701
+ [t("Started", { context: "agent-step-fact" }), formatMoment(backgroundJob.startedAt)],
8702
+ [t("Due", { context: "agent-step-fact" }), formatMoment(backgroundJob.dueAt)],
8703
+ [t("Deadline", { context: "agent-step-fact" }), formatMoment(backgroundJob.deadlineAt)],
8704
+ [t("Checks", { context: "agent-step-fact" }), backgroundJob.checkCount > 0 ? formatUiNumber(backgroundJob.checkCount) : null],
8705
+ [t("Last check", { context: "agent-step-fact" }), formatMoment(backgroundJob.lastCheckedAt)],
8706
+ [t("Ended", { context: "agent-step-fact" }), formatMoment(backgroundJob.endedAt)],
8707
+ [
8708
+ t("How it ended", { context: "agent-step-fact" }),
8709
+ backgroundJob.reportKind ? /* @__PURE__ */ jsx(BackgroundJobReportValue, { reportKind: backgroundJob.reportKind, reportedAt: formatMoment(backgroundJob.reportedAt) }) : null
8710
+ ]
8711
+ ]
8712
+ }
8713
+ ) });
8714
+ };
8486
8715
  const SubAgentDetail = ({ step }) => {
8487
8716
  const { t } = useTranslate();
8488
8717
  const { locale, formatCost, buildConversationHref, linkComponent: Link } = useAgentInspectScope();
@@ -8523,12 +8752,18 @@ const SubAgentDetail = ({ step }) => {
8523
8752
  const PlainStepDetail = ({ step }) => {
8524
8753
  const { t } = useTranslate();
8525
8754
  const signalText = step.signal?.text ?? step.signalText;
8755
+ const signalSource = step.signal?.source ?? step.signalSource;
8756
+ const translateLabel = (text, replacements) => t(text, { replacements });
8757
+ const signalNote = step.kind === "SIGNAL" ? describeTraceSignalText(signalText, translateLabel) : null;
8526
8758
  return /* @__PURE__ */ jsxs(Fragment, { children: [
8527
8759
  /* @__PURE__ */ jsx(
8528
8760
  FactList,
8529
8761
  {
8530
8762
  facts: [
8531
- [t("Source", { context: "agent-step-fact" }), step.signal?.source ?? step.signalSource],
8763
+ [
8764
+ t("Source", { context: "agent-step-fact" }),
8765
+ signalSource ? /* @__PURE__ */ jsx("span", { title: signalSource, children: describeTraceSignal(null, signalSource, null, translateLabel) ?? signalSource }) : null
8766
+ ],
8532
8767
  [t("Signal kind", { context: "agent-step-fact" }), step.signal?.kind],
8533
8768
  [t("Widget", { context: "agent-step-fact" }), step.widget?.type],
8534
8769
  [t("Written by", { context: "agent-step-fact" }), step.widget?.emittedBy],
@@ -8538,6 +8773,7 @@ const PlainStepDetail = ({ step }) => {
8538
8773
  ]
8539
8774
  }
8540
8775
  ),
8776
+ signalNote ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", "data-testid": "agent-step-signal-note", children: signalNote }) : null,
8541
8777
  step.widget?.summary ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: step.widget.summary }) : null,
8542
8778
  step.widget && !step.widget.isValid ? /* @__PURE__ */ jsx(StatusCallout, { size: "compact", tone: "warning", title: t("not a readable widget") }) : null,
8543
8779
  signalText ? /* @__PURE__ */ jsx(
@@ -8545,7 +8781,7 @@ const PlainStepDetail = ({ step }) => {
8545
8781
  {
8546
8782
  title: t("Text of the signal"),
8547
8783
  aside: step.signal?.isTextCut ? /* @__PURE__ */ jsx(Tag, { size: "sm", children: t("shortened", { context: "agent-inspect" }) }) : void 0,
8548
- children: /* @__PURE__ */ jsx("p", { className: "max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-muted px-3 py-2 text-xs leading-5", children: signalText })
8784
+ children: /* @__PURE__ */ jsx("p", { className: "max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-muted px-3 py-2 text-xs leading-5", children: /* @__PURE__ */ jsx(UntrustedContentText, { text: signalText }) })
8549
8785
  }
8550
8786
  ) : null,
8551
8787
  step.compactionNode ? /* @__PURE__ */ jsx(CompactionNodeLine, { node: step.compactionNode }) : null,
@@ -8559,7 +8795,7 @@ const StepDetailDialog = ({ stepId, step, isLoading, canSwitchToDebug = false, o
8559
8795
  const { locale, frameAttributes } = useAgentInspectScope();
8560
8796
  const format = useMemo(() => createTraceFormat(locale), [locale]);
8561
8797
  const kindLabel = step !== null && Object.hasOwn(KIND_LABELS, step.kind) ? t(KIND_LABELS[step.kind], { context: KIND_CONTEXT }) : step?.kind ?? "";
8562
- const name = step === null ? null : step.kind === "DECISION" ? step.decision?.siteLabel ?? (step.decision?.site ? wordsOfIdentifier(step.decision.site) : null) : step.kind === "MODEL_CALL" || step.kind === "THINKING" ? step.modelLabel ?? describeTraceModelName(step.modelCall?.modelName) : step.kind === "SUB_AGENT" ? step.subAgent?.label ?? null : step.kind === "WIDGET" ? step.widgetType : step.toolName;
8798
+ const name = step === null ? null : step.kind === "DECISION" ? step.decision?.siteLabel ?? (step.decision?.site ? wordsOfIdentifier(step.decision.site) : null) : step.kind === "MODEL_CALL" || step.kind === "THINKING" ? step.modelLabel ?? describeTraceModelName(step.modelCall?.modelName) : step.kind === "SUB_AGENT" ? step.subAgent?.label ?? null : step.kind === "WIDGET" ? step.widgetType : step.kind === "SIGNAL" ? describeTraceSignal(step.signal?.tag ?? step.signal?.kind ?? null, step.signal?.source ?? step.signalSource, null, (text, replacements) => t(text, { replacements })) : step.toolName;
8563
8799
  const state = step !== null ? readTraceStepState(step) : null;
8564
8800
  const startedAt = step !== null ? readTraceMoment(step.startedAt) : null;
8565
8801
  const facts = [
@@ -8752,7 +8988,7 @@ const useQueryLoader = (useQuery, keyOf2) => {
8752
8988
  const runners = pendingLoads.map((pendingLoad) => /* @__PURE__ */ jsx(QueryRunner, { useQuery, arg: pendingLoad.arg, onSettled: (outcome) => settle(pendingLoad.key, outcome) }, pendingLoad.key));
8753
8989
  return [load, runners];
8754
8990
  };
8755
- const AGENT_CONVERSATION_DETAIL_TABS = ["conversation", "delegation", "sandbox", "files", "records", "requests", "context"];
8991
+ const AGENT_CONVERSATION_DETAIL_TABS = ["conversation", "delegation", "sandbox", "files", "records", "backgroundJobs", "requests", "context"];
8756
8992
  const AGENT_CONVERSATION_DETAIL_KEYS = ["tab", "debug", "view", "switches", "truncated", "call", "callView", "message", "step", "file", "change", "subject"];
8757
8993
  const buildAgentConversationSandboxQuery = ({ path, fileChangeId }) => {
8758
8994
  const query = new URLSearchParams({ tab: "sandbox" });
@@ -8767,6 +9003,7 @@ const TAB_LABELS = {
8767
9003
  sandbox: m("Sandbox", { context: "agent-conversation-tab" }),
8768
9004
  files: m("Files", { context: "agent-conversation-tab" }),
8769
9005
  records: m("Worked records", { context: "agent-conversation-tab" }),
9006
+ backgroundJobs: m("Background jobs", { context: "agent-conversation-tab" }),
8770
9007
  requests: m("Requests", { context: "agent-conversation-tab" }),
8771
9008
  context: m("Context", { context: "agent-conversation-tab" })
8772
9009
  };
@@ -9225,6 +9462,7 @@ const AgentConversationDetailScreen = ({
9225
9462
  activeTab === "sandbox" ? /* @__PURE__ */ jsx(SandboxPanel, {}) : null,
9226
9463
  activeTab === "files" ? /* @__PURE__ */ jsx(FilesPanel, {}) : null,
9227
9464
  activeTab === "records" ? /* @__PURE__ */ jsx(WorkedRecordsPanel, {}) : null,
9465
+ activeTab === "backgroundJobs" ? /* @__PURE__ */ jsx(BackgroundJobsPanel, {}) : null,
9228
9466
  activeTab === "requests" ? /* @__PURE__ */ jsx(RequestsPanel, { conversationCosts: header, subAgentConversationCount, livePollingIntervalMs }) : null,
9229
9467
  activeTab === "context" ? /* @__PURE__ */ jsx(ContextPanel, { turnPageSize: pageSize }) : null
9230
9468
  ] }) : conversationQuery.isLoading ? null : /* @__PURE__ */ jsx(StatusCallout, { tone: "info", title: fallbackTitle, description: t("The conversation does not exist.") }),
@@ -13606,6 +13844,10 @@ const AgentConnectionsScreen = ({ title, description, headerActions, ...panel })
13606
13844
  export {
13607
13845
  ADMIN_PERIOD_MAX_DAYS,
13608
13846
  ADMIN_PERIOD_PRESETS,
13847
+ AGENT_BACKGROUND_JOB_REPORT_CONTEXT,
13848
+ AGENT_BACKGROUND_JOB_REPORT_KIND_LABELS,
13849
+ AGENT_BACKGROUND_JOB_STATE,
13850
+ AGENT_BACKGROUND_JOB_STATE_CONTEXT,
13609
13851
  AGENT_CONNECTIONS_PAGE_SURFACE,
13610
13852
  AGENT_CONNECTIONS_TAG,
13611
13853
  AGENT_CONNECTIONS_URL_KEYS,
@@ -13933,6 +14175,7 @@ export {
13933
14175
  jsonChildCountOf,
13934
14176
  jsonChildEntriesOf,
13935
14177
  jsonValueKindOf,
14178
+ mapAgentInspectBackgroundJobs,
13936
14179
  mapAgentInspectCompactionNode,
13937
14180
  mapAgentInspectDelegationTree,
13938
14181
  mapAgentInspectFileChange,