@mgamadeus/ddd-agents 0.16.1 → 0.17.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 (94) hide show
  1. package/README.md +111 -8
  2. package/boundary.json +15 -1
  3. package/dist/admin-chat-widgets.js +158 -0
  4. package/dist/admin-chat-widgets.js.map +1 -0
  5. package/dist/admin.js +90 -63
  6. package/dist/admin.js.map +1 -1
  7. package/dist/chat.js +16 -16
  8. package/dist/chat.js.map +1 -1
  9. package/dist/chunks/AgentScheduleOrderDraftPanel-DM6pz_hc.js +304 -0
  10. package/dist/chunks/AgentScheduleOrderDraftPanel-DM6pz_hc.js.map +1 -0
  11. package/dist/chunks/{ConversationMarkdown-DNQcVuz-.js → ConversationMarkdown-W8NzeAT1.js} +5 -5
  12. package/dist/chunks/{ConversationMarkdown-DNQcVuz-.js.map → ConversationMarkdown-W8NzeAT1.js.map} +1 -1
  13. package/dist/chunks/{ConversationMessageInputComposerWidgets-BlpIule7.js → ConversationMessageInputComposerWidgets-BH7axorv.js} +6 -6
  14. package/dist/chunks/{ConversationMessageInputComposerWidgets-BlpIule7.js.map → ConversationMessageInputComposerWidgets-BH7axorv.js.map} +1 -1
  15. package/dist/chunks/{VoiceBarsIcon-eODB_UTI.js → VoiceBarsIcon-CT2HQSBH.js} +4 -4
  16. package/dist/chunks/{VoiceBarsIcon-eODB_UTI.js.map → VoiceBarsIcon-CT2HQSBH.js.map} +1 -1
  17. package/dist/chunks/{WebSearchResultsConversationWidget-l9Aek_lG.js → WebSearchResultsConversationWidget-BM624Fcx.js} +71 -62
  18. package/dist/chunks/WebSearchResultsConversationWidget-BM624Fcx.js.map +1 -0
  19. package/dist/chunks/{agents-http-trace-mappers-rsbGAf2_.js → agents-http-trace-mappers-CuGZOFu-.js} +53 -14
  20. package/dist/chunks/agents-http-trace-mappers-CuGZOFu-.js.map +1 -0
  21. package/dist/chunks/{browser-request-interception-D678IemW.js → browser-request-interception-BnOQWLaJ.js} +2 -2
  22. package/dist/chunks/{browser-request-interception-D678IemW.js.map → browser-request-interception-BnOQWLaJ.js.map} +1 -1
  23. package/dist/chunks/{canvas-label-context-C1Pc_Ldo.js → canvas-label-context-BKRsrpye.js} +3 -3
  24. package/dist/chunks/{canvas-label-context-C1Pc_Ldo.js.map → canvas-label-context-BKRsrpye.js.map} +1 -1
  25. package/dist/chunks/{canvas-reducers-BYArW_Ji.js → canvas-reducers-CZaOPvdt.js} +2 -2
  26. package/dist/chunks/{canvas-reducers-BYArW_Ji.js.map → canvas-reducers-CZaOPvdt.js.map} +1 -1
  27. package/dist/chunks/{canvasBodies-BpLPp-S8.js → canvasBodies-CMqo5eHg.js} +4 -4
  28. package/dist/chunks/{canvasBodies-BpLPp-S8.js.map → canvasBodies-CMqo5eHg.js.map} +1 -1
  29. package/dist/chunks/{canvasStorage-DSspwRMg.js → canvasStorage-ceJ7yaBd.js} +2 -2
  30. package/dist/chunks/{canvasStorage-DSspwRMg.js.map → canvasStorage-ceJ7yaBd.js.map} +1 -1
  31. package/dist/chunks/{content-from-unified-diff-DWyBHRSy.js → content-from-unified-diff-BKdgop63.js} +39 -5
  32. package/dist/chunks/content-from-unified-diff-BKdgop63.js.map +1 -0
  33. package/dist/chunks/{contract-DtFmOk91.js → contract-CQ6PO_e8.js} +2 -2
  34. package/dist/chunks/{contract-DtFmOk91.js.map → contract-CQ6PO_e8.js.map} +1 -1
  35. package/dist/chunks/{conversation-Cbrqtx-_.js → conversation-VosmRbsr.js} +4 -2
  36. package/dist/chunks/{conversation-Cbrqtx-_.js.map → conversation-VosmRbsr.js.map} +1 -1
  37. package/dist/chunks/conversation-trace-fVeh6Lg6.js.map +1 -1
  38. package/dist/chunks/{widget-name-resolver-DXIE9JUr.js → conversationWidgetRegistry-BW-U_RvC.js} +810 -530
  39. package/dist/chunks/conversationWidgetRegistry-BW-U_RvC.js.map +1 -0
  40. package/dist/chunks/{index-DZovGMpG.js → index-DAEGct6X.js} +61 -61
  41. package/dist/chunks/index-DAEGct6X.js.map +1 -0
  42. package/dist/chunks/{link-navigation-a_sRfmsj.js → link-navigation-DQWyeNkx.js} +2 -2
  43. package/dist/chunks/{link-navigation-a_sRfmsj.js.map → link-navigation-DQWyeNkx.js.map} +1 -1
  44. package/dist/chunks/{withPollingChangeSubscription-Cz3Diolr.js → withPollingChangeSubscription-Ct8kjmlL.js} +19 -2
  45. package/dist/chunks/withPollingChangeSubscription-Ct8kjmlL.js.map +1 -0
  46. package/dist/client-testing.js +39 -5
  47. package/dist/client-testing.js.map +1 -1
  48. package/dist/client.js +43 -14
  49. package/dist/client.js.map +1 -1
  50. package/dist/contract.js +4 -3
  51. package/dist/files/i18n-keys.json +619 -15
  52. package/dist/files/widgets/DriveFilesConversationWidget/DriveFilesConversationWidget.md +4 -2
  53. package/dist/files/widgets/OwnerStepConfirmationConversationWidget/OwnerStepConfirmationConversationWidget.md +54 -0
  54. package/dist/files/widgets/OwnerStepConfirmationConversationWidget/owner-step-confirmation.preview-fixtures.json +16 -0
  55. package/dist/image-render.js +8 -8
  56. package/dist/index.js +16 -16
  57. package/dist/kit.js +2 -2
  58. package/dist/preview.js +124 -117
  59. package/dist/preview.js.map +1 -1
  60. package/dist/provider.js +2 -2
  61. package/dist/renderer.js +53 -52
  62. package/dist/styles.css +46 -0
  63. package/dist/types/admin/schedules/AgentScheduleOrderDraftPanel.d.ts +45 -0
  64. package/dist/types/admin/schedules/AgentSchedulesPanel.d.ts +11 -3
  65. package/dist/types/admin/schedules/agent-schedules-api.d.ts +38 -2
  66. package/dist/types/admin/schedules/agent-schedules-format.d.ts +22 -1
  67. package/dist/types/admin/schedules/agent-schedules-types.d.ts +91 -1
  68. package/dist/types/admin-chat-widgets/ScheduleOrderApprovalConversationWidget.d.ts +37 -0
  69. package/dist/types/admin-chat-widgets/registerScheduleOrderApprovalWidget.d.ts +11 -0
  70. package/dist/types/chat/trace/TurnMetaLine.d.ts +5 -3
  71. package/dist/types/chat/trace/trace-counts.d.ts +2 -0
  72. package/dist/types/chat/trace/trace-types.d.ts +4 -0
  73. package/dist/types/client/AgentsConversationClient.d.ts +17 -1
  74. package/dist/types/client/http/agents-http-mappers.d.ts +4 -2
  75. package/dist/types/client/http/agents-http-trace-wire.d.ts +2 -0
  76. package/dist/types/client/http/agents-http-wire.d.ts +24 -0
  77. package/dist/types/client/testing/createInMemoryAgentsConversationClient.d.ts +13 -1
  78. package/dist/types/contract/conversation-trace.d.ts +4 -0
  79. package/dist/types/contract/conversation.d.ts +43 -0
  80. package/dist/types/entries/admin-chat-widgets.d.ts +2 -0
  81. package/dist/types/entries/admin.d.ts +4 -2
  82. package/dist/types/entries/renderer.d.ts +1 -1
  83. package/dist/types/renderer/widget-tree/composed-node-schema.d.ts +20 -3
  84. package/dist/types/widgets/DriveFilesConversationWidget/shared/drive-files.d.ts +3 -1
  85. package/dist/voice.js +2 -2
  86. package/dist/widgets.js +4 -4
  87. package/package.json +7 -1
  88. package/public-api.json +39 -0
  89. package/dist/chunks/WebSearchResultsConversationWidget-l9Aek_lG.js.map +0 -1
  90. package/dist/chunks/agents-http-trace-mappers-rsbGAf2_.js.map +0 -1
  91. package/dist/chunks/content-from-unified-diff-DWyBHRSy.js.map +0 -1
  92. package/dist/chunks/index-DZovGMpG.js.map +0 -1
  93. package/dist/chunks/widget-name-resolver-DXIE9JUr.js.map +0 -1
  94. package/dist/chunks/withPollingChangeSubscription-Cz3Diolr.js.map +0 -1
package/dist/admin.js CHANGED
@@ -4,16 +4,18 @@ 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, 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";
7
+ import { WrapText, Check, Copy, X, ChevronRight, Maximize2, CalendarClock, ChevronsDownUp, ChevronsUpDown, Zap, Repeat, ShieldCheck, MoreHorizontal, History, Pencil, Pause, Play, Trash2, Wallet, CircleAlert, TriangleAlert, RotateCcw, ArrowRight, ChartNoAxesColumn, ArrowDown, Wrench, CircleDashed, CircleX, Hand, Hourglass, ServerCrash, ShieldX, TextCursorInput, Clock, Flag, CircleMinus, CircleCheck, Ban, ChevronLeft, FlaskConical, PartyPopper, Download, Bot, ChevronsUp, CircleStop, GitBranch, ClipboardCheck, Archive, PanelRightOpen, Eye, FileJson, ScrollText, LayoutPanelTop, MessageSquarePlus, SlidersHorizontal, Square, Bug, Code, ListTree, ExternalLink, HardDrive, ChevronDown, Folder, File, Filter, SquarePen, RefreshCw, User, CornerDownRight, AlertTriangle, Columns3, CirclePause, Loader, CircleSlash, Mail, Plug, MessageCircle, MessageSquare, FolderOpen, Contact, CalendarDays, CircleHelp, Users, 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
- import { useCopyToClipboard, useMemoryUrlState, useUrlListState, defineStatusMap, useConfirm, notify, localToday as localToday$1, toFormSubmitError, formatRelativeTime, useDebouncedValue } from "@mgamadeus/ddd-admin-ui/logic";
9
+ import { useCopyToClipboard, useMemoryUrlState, useUrlListState, useConfirm, notify, defineStatusMap, 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";
11
11
  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 { 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";
15
+ import { a as AGENT_SCHEDULE_STATUS, b as AGENT_RUN_STATE, c as agentScheduleEditValuesOf, d as buildAgentScheduleUpdate, e as AGENT_SCHEDULE_TITLE_MAX_LENGTH, A as AgentScheduleOrderDraftPanel } from "./chunks/AgentScheduleOrderDraftPanel-DM6pz_hc.js";
16
+ import { D, f, i, r, s } from "./chunks/AgentScheduleOrderDraftPanel-DM6pz_hc.js";
17
+ import { v as mapWireTraceFileChange, x as mapWireTraceStep, A as mapWireTurnTrace, w as mapWireTraceMessage, y as mapWireTraceTaskPlanItems } from "./chunks/agents-http-trace-mappers-CuGZOFu-.js";
18
+ 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-BKdgop63.js";
17
19
  import { FormDialog, FormErrors, FormFieldFrame, FormDrawer, FormActions } from "@mgamadeus/ddd-admin-ui/form";
18
20
  import { QuickFilterPills } from "@mgamadeus/ddd-admin-ui/glass";
19
21
  const CodeBlock = ({
@@ -2873,56 +2875,6 @@ const formatBucketTitle = (bucket, locale) => {
2873
2875
  if (year === void 0 || month === void 0 || day === void 0 || Number.isNaN(year + month + day)) return bucket;
2874
2876
  return new Intl.DateTimeFormat(locale, { weekday: "short", day: "numeric", month: "short", year: "numeric", timeZone: "UTC" }).format(new Date(Date.UTC(year, month - 1, day)));
2875
2877
  };
2876
- const AGENT_SCHEDULE_STATUS = defineStatusMap(
2877
- {
2878
- ACTIVE: { label: m("Active", { context: "agent-schedule-status" }), tone: "success", icon: CirclePlay, description: m("Fires on its occurrences", { context: "agent-schedule-status" }) },
2879
- PAUSED: { label: m("Paused", { context: "agent-schedule-status" }), tone: "warning", icon: CirclePause, description: m("Stopped for now, keeps its state", { context: "agent-schedule-status" }) },
2880
- EXPIRED: { label: m("Expired", { context: "agent-schedule-status" }), tone: "neutral", icon: TimerOff, description: m("Ran past its end or its run limit", { context: "agent-schedule-status" }) },
2881
- DONE: { label: m("Done", { context: "agent-schedule-status" }), tone: "info", icon: CircleCheck, description: m("Its done criteria were fulfilled", { context: "agent-schedule-status" }) },
2882
- CANCELLED: { label: m("Cancelled", { context: "agent-schedule-status" }), tone: "neutral", icon: Ban, description: m("Cancelled, its runs stay readable", { context: "agent-schedule-status" }) },
2883
- ARCHIVED: { label: m("Archived", { context: "agent-schedule-status" }), tone: "neutral", icon: Archive, description: m("Deleted after it had run", { context: "agent-schedule-status" }) }
2884
- },
2885
- { context: "agent-schedule-status" }
2886
- );
2887
- const AGENT_RUN_STATE = defineStatusMap(
2888
- {
2889
- IDLE: { label: m("Finished", { context: "agent-run-state" }), tone: "success", icon: CircleCheck },
2890
- QUEUED: { label: m("Queued", { context: "agent-run-state" }), tone: "info", icon: Hourglass },
2891
- RUNNING: { label: m("Running", { context: "agent-run-state" }), tone: "info", icon: Loader },
2892
- AWAITING_DELEGATES: { label: m("Waiting for sub-agents", { context: "agent-run-state" }), tone: "warning", icon: Users },
2893
- COMPLETED: { label: m("Completed", { context: "agent-run-state" }), tone: "success", icon: CircleCheck },
2894
- FAILED: { label: m("Failed", { context: "agent-run-state" }), tone: "danger", icon: CircleX },
2895
- CANCELLED: { label: m("Cancelled", { context: "agent-run-state" }), tone: "neutral", icon: Ban }
2896
- },
2897
- { context: "agent-run-state" }
2898
- );
2899
- const scheduleLocalDateTimeOf = (utcDateTime, timeZone) => {
2900
- if (typeof utcDateTime !== "string" || utcDateTime.trim() === "") return "";
2901
- const date = /* @__PURE__ */ new Date(`${utcDateTime.trim().replace(" ", "T").slice(0, 19)}Z`);
2902
- if (Number.isNaN(date.getTime())) return "";
2903
- try {
2904
- const parts = new Intl.DateTimeFormat("en-CA", { timeZone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hourCycle: "h23" }).formatToParts(date);
2905
- const partOf = (type) => parts.find((part) => part.type === type)?.value ?? "";
2906
- return `${partOf("year")}-${partOf("month")}-${partOf("day")}T${partOf("hour")}:${partOf("minute")}`;
2907
- } catch {
2908
- return "";
2909
- }
2910
- };
2911
- const agentScheduleEditValuesOf = (item) => ({
2912
- title: item.schedule.title ?? "",
2913
- task: item.schedule.task ?? "",
2914
- cronSchedule: item.schedule.schedule ?? "",
2915
- runAtLocalTime: item.isOneTime === true ? scheduleLocalDateTimeOf(item.schedule.oneTimeAt, item.timezone ?? "UTC") : ""
2916
- });
2917
- const buildAgentScheduleUpdate = (scheduleId, initial, edited, isOneTime) => {
2918
- const update = { scheduleId };
2919
- if (edited.title.trim() !== initial.title.trim()) update.title = edited.title.trim();
2920
- if (edited.task.trim() !== initial.task.trim()) update.task = edited.task.trim();
2921
- if (!isOneTime && edited.cronSchedule.trim() !== initial.cronSchedule.trim()) update.cronSchedule = edited.cronSchedule.trim();
2922
- if (isOneTime && edited.runAtLocalTime !== initial.runAtLocalTime && edited.runAtLocalTime !== "") update.runAtLocalTime = edited.runAtLocalTime.replace("T", " ").slice(0, 16);
2923
- return Object.keys(update).length > 1 ? update : null;
2924
- };
2925
- const AGENT_SCHEDULE_TITLE_MAX_LENGTH = 60;
2926
2878
  const CronScheduleText = ({ expression, describeCronSchedule }) => {
2927
2879
  if (expression === "") return /* @__PURE__ */ jsx("span", { children: "–" });
2928
2880
  const words = describeCronSchedule?.(expression) ?? null;
@@ -2965,6 +2917,38 @@ const ScheduleRunsDrawer = ({ api, item, onClose, linkComponent, buildConversati
2965
2917
  }
2966
2918
  );
2967
2919
  };
2920
+ const ScheduleApprovalDialog = ({ api, item, onClose, writesAllowed, viewerAccountId, describeCronSchedule, describeRunPurpose, describePermission, agentName }) => {
2921
+ const { t } = useTranslate();
2922
+ return /* @__PURE__ */ jsx(
2923
+ Dialog,
2924
+ {
2925
+ open: item !== null,
2926
+ onOpenChange: (isOpen) => {
2927
+ if (!isOpen) onClose();
2928
+ },
2929
+ children: /* @__PURE__ */ jsxs(DialogContent, { "data-slot": "agent-schedule-approval-dialog", className: "max-h-[90dvh] overflow-y-auto sm:max-w-xl", children: [
2930
+ /* @__PURE__ */ jsxs(DialogHeader, { children: [
2931
+ /* @__PURE__ */ jsx(DialogTitle, { className: "break-words", children: item === null ? "" : (item.label ?? "").trim() !== "" ? item.label : `#${item.schedule.id}` }),
2932
+ /* @__PURE__ */ jsx(DialogDescription, { children: t("The task runs only once its owner approves this order.") })
2933
+ ] }),
2934
+ item !== null && /* @__PURE__ */ jsx(
2935
+ AgentScheduleOrderDraftPanel,
2936
+ {
2937
+ api,
2938
+ scheduleId: item.schedule.id,
2939
+ writesAllowed,
2940
+ viewerAccountId,
2941
+ describeCronSchedule,
2942
+ describeRunPurpose,
2943
+ describePermission,
2944
+ agentName,
2945
+ onApproved: onClose
2946
+ }
2947
+ )
2948
+ ] })
2949
+ }
2950
+ );
2951
+ };
2968
2952
  const ScheduleEditDialog = ({ api, item, onClose }) => {
2969
2953
  const { t } = useTranslate();
2970
2954
  const idPrefix = useId();
@@ -3057,6 +3041,10 @@ const AgentSchedulesPanel = ({
3057
3041
  buildConversationHref,
3058
3042
  describePlace,
3059
3043
  describeCronSchedule,
3044
+ describeRunPurpose,
3045
+ describePermission,
3046
+ agentName,
3047
+ viewerAccountId,
3060
3048
  selectedScheduleId,
3061
3049
  onSelectSchedule,
3062
3050
  title,
@@ -3072,6 +3060,7 @@ const AgentSchedulesPanel = ({
3072
3060
  const [deleteSchedule] = api.useDeleteAgentScheduleMutation();
3073
3061
  const [ownRunsScheduleId, setOwnRunsScheduleId] = useState(null);
3074
3062
  const [editScheduleId, setEditScheduleId] = useState(null);
3063
+ const [approvalScheduleId, setApprovalScheduleId] = useState(null);
3075
3064
  const [busyScheduleId, setBusyScheduleId] = useState(null);
3076
3065
  const items = useMemo(() => query.data?.items == null ? null : wireElementsOf(query.data.items), [query.data]);
3077
3066
  const runsScheduleId = selectedScheduleId !== void 0 ? selectedScheduleId : ownRunsScheduleId;
@@ -3167,6 +3156,10 @@ const AgentSchedulesPanel = ({
3167
3156
  ] }),
3168
3157
  /* @__PURE__ */ jsxs(TableCell, { className: "px-3 py-2.5 align-top", children: [
3169
3158
  /* @__PURE__ */ jsx(StatusBadge, { value: schedule.status ?? null, map: AGENT_SCHEDULE_STATUS }),
3159
+ schedule.status === "PENDING_APPROVAL" && /* @__PURE__ */ jsxs(Button, { type: "button", variant: "outline", size: "xs", rounded: "full", className: "mt-1.5 flex", "data-slot": "agent-schedule-review", onClick: () => setApprovalScheduleId(schedule.id), children: [
3160
+ /* @__PURE__ */ jsx(ShieldCheck, { "aria-hidden": true }),
3161
+ t("Review and approve")
3162
+ ] }),
3170
3163
  (schedule.failureStreak ?? 0) > 0 && /* @__PURE__ */ jsx("p", { className: "mt-1 text-xs text-destructive", children: t("{count, plural, one {# failed run in a row} other {# failed runs in a row}}", { count: schedule.failureStreak ?? 0 }) })
3171
3164
  ] }),
3172
3165
  /* @__PURE__ */ jsx(TableCell, { className: "px-3 py-2.5 align-top", children: /* @__PURE__ */ jsx(DateCell, { value: schedule.lastFiredAt }) }),
@@ -3188,6 +3181,10 @@ const AgentSchedulesPanel = ({
3188
3181
  /* @__PURE__ */ jsx(History, { "aria-hidden": true }),
3189
3182
  t("Runs", { context: "agent-schedule" })
3190
3183
  ] }),
3184
+ schedule.status === "PENDING_APPROVAL" && /* @__PURE__ */ jsxs(DropdownMenuItem, { onSelect: () => setApprovalScheduleId(schedule.id), children: [
3185
+ /* @__PURE__ */ jsx(ShieldCheck, { "aria-hidden": true }),
3186
+ t("Review and approve")
3187
+ ] }),
3191
3188
  hasWriteAction && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
3192
3189
  item.canBeEdited === true && /* @__PURE__ */ jsxs(DropdownMenuItem, { disabled: !writesAllowed, onSelect: () => setEditScheduleId(schedule.id), children: [
3193
3190
  /* @__PURE__ */ jsx(Pencil, { "aria-hidden": true }),
@@ -3217,7 +3214,21 @@ const AgentSchedulesPanel = ({
3217
3214
  ] })
3218
3215
  ] }),
3219
3216
  /* @__PURE__ */ jsx(ScheduleRunsDrawer, { api, item: itemOf(runsScheduleId ?? null), onClose: () => selectRuns(null), linkComponent, buildConversationHref }),
3220
- /* @__PURE__ */ jsx(ScheduleEditDialog, { api, item: itemOf(editScheduleId), onClose: () => setEditScheduleId(null) })
3217
+ /* @__PURE__ */ jsx(ScheduleEditDialog, { api, item: itemOf(editScheduleId), onClose: () => setEditScheduleId(null) }),
3218
+ /* @__PURE__ */ jsx(
3219
+ ScheduleApprovalDialog,
3220
+ {
3221
+ api,
3222
+ item: itemOf(approvalScheduleId),
3223
+ onClose: () => setApprovalScheduleId(null),
3224
+ writesAllowed,
3225
+ viewerAccountId,
3226
+ describeCronSchedule,
3227
+ describeRunPurpose,
3228
+ describePermission,
3229
+ agentName
3230
+ }
3231
+ )
3221
3232
  ] });
3222
3233
  };
3223
3234
  const BUDGET_METER_WARNING_SHARE = 0.8;
@@ -4323,11 +4334,14 @@ const buildAgentSchedulesRequests = (apiPrefix) => {
4323
4334
  resume: ({ scheduleId }) => ({ url: scheduleUrl(scheduleId, "resume"), method: "POST" }),
4324
4335
  runNow: ({ scheduleId }) => ({ url: scheduleUrl(scheduleId, "runNow"), method: "POST" }),
4325
4336
  update: ({ scheduleId, ...changes }) => ({ url: scheduleUrl(scheduleId, "update"), method: "POST", body: changes }),
4326
- remove: ({ scheduleId }) => ({ url: scheduleUrl(scheduleId), method: "DELETE" })
4337
+ remove: ({ scheduleId }) => ({ url: scheduleUrl(scheduleId), method: "DELETE" }),
4338
+ draft: ({ scheduleId }) => ({ url: scheduleUrl(scheduleId, "draft") }),
4339
+ approve: ({ scheduleId, draftHash }) => ({ url: scheduleUrl(scheduleId, "approve"), method: "POST", body: { draftHash } })
4327
4340
  };
4328
4341
  };
4329
4342
  const LIST$2 = { type: AGENT_SCHEDULES_TAG, id: "LIST" };
4330
4343
  const RUNS = { type: AGENT_SCHEDULES_TAG, id: "RUNS" };
4344
+ const DRAFT = { type: AGENT_SCHEDULES_TAG, id: "DRAFT" };
4331
4345
  const agentSchedulesEndpointDefinitions = (apiPrefix) => {
4332
4346
  const requests = buildAgentSchedulesRequests(apiPrefix);
4333
4347
  return {
@@ -4336,8 +4350,10 @@ const agentSchedulesEndpointDefinitions = (apiPrefix) => {
4336
4350
  adminUiAgentSchedulePause: { kind: "mutation", request: requests.pause, invalidatesTags: [LIST$2] },
4337
4351
  adminUiAgentScheduleResume: { kind: "mutation", request: requests.resume, invalidatesTags: [LIST$2] },
4338
4352
  adminUiAgentScheduleRunNow: { kind: "mutation", request: requests.runNow, invalidatesTags: [LIST$2, RUNS] },
4339
- adminUiAgentScheduleUpdate: { kind: "mutation", request: requests.update, invalidatesTags: [LIST$2] },
4340
- adminUiAgentScheduleDelete: { kind: "mutation", request: requests.remove, invalidatesTags: [LIST$2] }
4353
+ adminUiAgentScheduleUpdate: { kind: "mutation", request: requests.update, invalidatesTags: [LIST$2, DRAFT] },
4354
+ adminUiAgentScheduleDelete: { kind: "mutation", request: requests.remove, invalidatesTags: [LIST$2, DRAFT] },
4355
+ adminUiAgentScheduleOrderDraft: { kind: "query", request: requests.draft, providesTags: [DRAFT] },
4356
+ adminUiAgentScheduleApprove: { kind: "mutation", request: requests.approve, invalidatesTags: [LIST$2, DRAFT] }
4341
4357
  };
4342
4358
  };
4343
4359
  const createAgentSchedulesApi = ({ baseApi, apiPrefix }) => injectEndpointsOnce(
@@ -4352,7 +4368,9 @@ const createAgentSchedulesApi = ({ baseApi, apiPrefix }) => injectEndpointsOnce(
4352
4368
  useResumeAgentScheduleMutation: hookOf("adminUiAgentScheduleResume"),
4353
4369
  useRunAgentScheduleNowMutation: hookOf("adminUiAgentScheduleRunNow"),
4354
4370
  useUpdateAgentScheduleMutation: hookOf("adminUiAgentScheduleUpdate"),
4355
- useDeleteAgentScheduleMutation: hookOf("adminUiAgentScheduleDelete")
4371
+ useDeleteAgentScheduleMutation: hookOf("adminUiAgentScheduleDelete"),
4372
+ useAgentScheduleOrderDraftQuery: hookOf("adminUiAgentScheduleOrderDraft"),
4373
+ useApproveAgentScheduleMutation: hookOf("adminUiAgentScheduleApprove")
4356
4374
  })
4357
4375
  );
4358
4376
  const createStaticAgentSchedulesApi = (data) => ({
@@ -4362,8 +4380,11 @@ const createStaticAgentSchedulesApi = (data) => ({
4362
4380
  useResumeAgentScheduleMutation: staticMutationHook((arg) => data.resume?.(arg) ?? {}),
4363
4381
  useRunAgentScheduleNowMutation: staticMutationHook((arg) => data.runNow?.(arg) ?? {}),
4364
4382
  useUpdateAgentScheduleMutation: staticMutationHook((arg) => data.update?.(arg) ?? {}),
4365
- useDeleteAgentScheduleMutation: staticMutationHook((arg) => data.remove?.(arg) ?? {})
4383
+ useDeleteAgentScheduleMutation: staticMutationHook((arg) => data.remove?.(arg) ?? {}),
4384
+ useAgentScheduleOrderDraftQuery: staticQueryHook((arg) => data.draft?.(arg)),
4385
+ useApproveAgentScheduleMutation: staticMutationHook((arg) => data.approve?.(arg) ?? {})
4366
4386
  });
4387
+ const AGENT_SCHEDULE_ORDER_ACTION_CLASSES = ["SCHEDULED_ORDER", "CONNECTION_FILE_WRITE", "CONNECTION_MAIL_SEND", "CONNECTION_CHAT_POST"];
4367
4388
  const AGENT_QUALITY_TAG = "AdminUiAgentQuality";
4368
4389
  const buildAgentQualityRequests = (apiPrefix) => {
4369
4390
  const prefix = trimApiPrefix(apiPrefix);
@@ -5607,7 +5628,7 @@ const applyAgentInspectDebugSwitches = (steps, switches, keptStepId = null) => {
5607
5628
  const applyAgentInspectDebugSwitchesToTotals = (totals, switches) => {
5608
5629
  let shownTotals = totals;
5609
5630
  if (!switches.tokensAndCosts) {
5610
- shownTotals = { ...shownTotals, inputTokens: null, outputTokens: null, cachedInputTokens: null, cachePercent: null, costInUsd: null };
5631
+ shownTotals = { ...shownTotals, inputTokens: null, outputTokens: null, cachedInputTokens: null, cachePercent: null, costInUsd: null, newestModelCallInputTokens: null };
5611
5632
  }
5612
5633
  if (!switches.times) shownTotals = { ...shownTotals, durationMs: null };
5613
5634
  if (!switches.modelAndEffort) shownTotals = { ...shownTotals, modelName: null, effort: null };
@@ -6194,7 +6215,7 @@ const ChildConversationTrace = ({ conversationId, className }) => {
6194
6215
  turn.isRunning ? /* @__PURE__ */ jsx(LiveDot, { label: t("A turn runs right now") }) : null,
6195
6216
  turn.totals.durationMs !== null && !turn.isRunning ? /* @__PURE__ */ jsx("span", { children: format.duration(turn.totals.durationMs) }) : null,
6196
6217
  isDebug && turn.totals.costInUsd !== null ? /* @__PURE__ */ jsx("span", { children: formatCost(turn.totals.costInUsd) }) : null,
6197
- isDebug && turn.totals.inputTokens !== null ? /* @__PURE__ */ jsx("span", { children: t("%count% tokens", {
6218
+ isDebug && turn.totals.inputTokens !== null ? /* @__PURE__ */ jsx("span", { children: t("%count% tokens in total", {
6198
6219
  replacements: { count: formatAgentInspectCount((turn.totals.inputTokens ?? 0) + (turn.totals.outputTokens ?? 0), locale) }
6199
6220
  }) }) : null
6200
6221
  ] }),
@@ -13931,6 +13952,7 @@ export {
13931
13952
  AGENT_RUN_HEARTBEAT_FRESH_MS,
13932
13953
  AGENT_RUN_STATE,
13933
13954
  AGENT_SCHEDULES_TAG,
13955
+ AGENT_SCHEDULE_ORDER_ACTION_CLASSES,
13934
13956
  AGENT_SCHEDULE_STATUS,
13935
13957
  AGENT_SCHEDULE_TITLE_MAX_LENGTH,
13936
13958
  AGENT_SERIES_COLOR_VALUES,
@@ -13948,6 +13970,7 @@ export {
13948
13970
  AgentConversationsScreen,
13949
13971
  AgentQualityEvalRunScreen,
13950
13972
  AgentQualityScreen,
13973
+ AgentScheduleOrderDraftPanel,
13951
13974
  AgentSchedulesPanel,
13952
13975
  AgentSkillCatalogScreen,
13953
13976
  AgentTraceFrame,
@@ -13959,6 +13982,7 @@ export {
13959
13982
  ContextCompositionPanel,
13960
13983
  ContextSegmentList,
13961
13984
  DEFAULT_AGENT_CONNECTION_LOGOS,
13985
+ D as DEFAULT_SCHEDULE_RUN_PURPOSE,
13962
13986
  DetailModal,
13963
13987
  Disclosure,
13964
13988
  EMPTY_AGENT_CONNECTION_DRIVE_SEARCH_FILTERS,
@@ -14137,6 +14161,7 @@ export {
14137
14161
  formatJsonText,
14138
14162
  formatProportionShare,
14139
14163
  formatQualityDuration,
14164
+ f as formatScheduleMoment,
14140
14165
  formatSentPayloadText,
14141
14166
  formatShare,
14142
14167
  formatTokenFigure,
@@ -14171,6 +14196,7 @@ export {
14171
14196
  isRuntimeSettingName,
14172
14197
  isRuntimeSettingSwitch,
14173
14198
  isRuntimeSettingText,
14199
+ i as isShownScheduleDraftStale,
14174
14200
  isSkillPreloadCandidate,
14175
14201
  jsonChildCountOf,
14176
14202
  jsonChildEntriesOf,
@@ -14214,6 +14240,7 @@ export {
14214
14240
  readAgentConversationListSegment,
14215
14241
  readAgentConversationListValues,
14216
14242
  readAgentInspectDebugSwitches,
14243
+ r as readAgentScheduleApprovalOutcome,
14217
14244
  readSentPayloadValue,
14218
14245
  readSubjectFilter,
14219
14246
  releasableAgentSpaceIdsOfDriveRoot,
@@ -14223,7 +14250,7 @@ export {
14223
14250
  resolveAgentConversationListPeriod,
14224
14251
  runtimeSettingValueAsText,
14225
14252
  runtimeSettingsFormValuesOf,
14226
- scheduleLocalDateTimeOf,
14253
+ s as scheduleLocalDateTimeOf,
14227
14254
  serializePendingAgentConnect,
14228
14255
  seriesFillClassNameOf,
14229
14256
  sharedBlocksOf,