@agent-native/dispatch 0.15.16 → 0.15.17
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/actions/provider-api-register.d.ts +5 -5
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +5 -3
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/lib/automation-display.d.ts +1 -0
- package/dist/lib/automation-display.d.ts.map +1 -1
- package/dist/lib/automation-display.js +4 -0
- package/dist/lib/automation-display.js.map +1 -1
- package/dist/lib/overview-chat.d.ts +7 -2
- package/dist/lib/overview-chat.d.ts.map +1 -1
- package/dist/lib/overview-chat.js +3 -1
- package/dist/lib/overview-chat.js.map +1 -1
- package/dist/routes/pages/automations.d.ts.map +1 -1
- package/dist/routes/pages/automations.js +4 -3
- package/dist/routes/pages/automations.js.map +1 -1
- package/dist/routes/pages/chat.d.ts.map +1 -1
- package/dist/routes/pages/chat.js +4 -0
- package/dist/routes/pages/chat.js.map +1 -1
- package/dist/routes/pages/thread-debug.d.ts.map +1 -1
- package/dist/routes/pages/thread-debug.js +11 -6
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/package.json +2 -2
- package/src/components/dispatch-control-plane.spec.tsx +41 -16
- package/src/components/dispatch-control-plane.tsx +18 -1
- package/src/lib/automation-display.spec.ts +7 -0
- package/src/lib/automation-display.ts +7 -0
- package/src/lib/overview-chat.spec.ts +4 -0
- package/src/lib/overview-chat.ts +13 -2
- package/src/routes/pages/automations.tsx +19 -3
- package/src/routes/pages/chat.tsx +6 -0
- package/src/routes/pages/thread-debug.tsx +11 -6
|
@@ -47,7 +47,7 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
47
47
|
notes?: string | undefined;
|
|
48
48
|
scope?: "org" | "user" | undefined;
|
|
49
49
|
}, {
|
|
50
|
-
|
|
50
|
+
found?: undefined;
|
|
51
51
|
message?: undefined;
|
|
52
52
|
deleted?: undefined;
|
|
53
53
|
providers: {
|
|
@@ -61,11 +61,10 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
61
61
|
}[];
|
|
62
62
|
count: number;
|
|
63
63
|
provider?: undefined;
|
|
64
|
-
found?: undefined;
|
|
65
64
|
registered?: undefined;
|
|
65
|
+
id?: undefined;
|
|
66
66
|
label?: undefined;
|
|
67
67
|
} | {
|
|
68
|
-
id?: undefined;
|
|
69
68
|
message?: undefined;
|
|
70
69
|
deleted?: undefined;
|
|
71
70
|
providers?: undefined;
|
|
@@ -73,6 +72,7 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
73
72
|
found: boolean;
|
|
74
73
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
75
74
|
registered?: undefined;
|
|
75
|
+
id?: undefined;
|
|
76
76
|
label?: undefined;
|
|
77
77
|
} | {
|
|
78
78
|
message?: undefined;
|
|
@@ -85,21 +85,21 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
85
85
|
registered?: undefined;
|
|
86
86
|
label?: undefined;
|
|
87
87
|
} | {
|
|
88
|
+
found?: undefined;
|
|
88
89
|
message?: undefined;
|
|
89
90
|
providers?: undefined;
|
|
90
91
|
count?: undefined;
|
|
91
92
|
provider?: undefined;
|
|
92
|
-
found?: undefined;
|
|
93
93
|
deleted: boolean;
|
|
94
94
|
id: string;
|
|
95
95
|
registered?: undefined;
|
|
96
96
|
label?: undefined;
|
|
97
97
|
} | {
|
|
98
|
+
found?: undefined;
|
|
98
99
|
deleted?: undefined;
|
|
99
100
|
providers?: undefined;
|
|
100
101
|
count?: undefined;
|
|
101
102
|
provider?: undefined;
|
|
102
|
-
found?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
105
105
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dispatch-control-plane.d.ts","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":"AAmLA,wBAAgB,oBAAoB,oDAqBnC"}
|
|
@@ -18,7 +18,7 @@ function SectionHeader({ title, action, }) {
|
|
|
18
18
|
}
|
|
19
19
|
function CommandPanel() {
|
|
20
20
|
const t = useT();
|
|
21
|
-
const { selectedModel } = useChatModels();
|
|
21
|
+
const { availableModels, isLoading: modelListLoading, onEffortChange, onModelChange, selectedEffort, selectedEngine, selectedModel, } = useChatModels({ storageKey: "dispatch" });
|
|
22
22
|
const navigate = useNavigate();
|
|
23
23
|
const promptSuggestions = [
|
|
24
24
|
t("dispatch.pages.suggestionWorkspaceHealth", {
|
|
@@ -45,6 +45,8 @@ function CommandPanel() {
|
|
|
45
45
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
46
46
|
message: trimmed,
|
|
47
47
|
selectedModel,
|
|
48
|
+
selectedEngine,
|
|
49
|
+
selectedEffort,
|
|
48
50
|
},
|
|
49
51
|
},
|
|
50
52
|
});
|
|
@@ -53,9 +55,9 @@ function CommandPanel() {
|
|
|
53
55
|
defaultValue: "Chat across your apps",
|
|
54
56
|
}) }), _jsx("p", { className: "mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground", children: t("dispatch.pages.chatAcrossAppsDescription", {
|
|
55
57
|
defaultValue: "Route work, inspect status, or create something new from one place.",
|
|
56
|
-
}) })] }), _jsx(PromptComposer, { placeholder: t("dispatch.pages.overviewPromptPlaceholder", {
|
|
58
|
+
}) })] }), _jsx(PromptComposer, { availableModels: availableModels, modelListLoading: modelListLoading, placeholder: t("dispatch.pages.overviewPromptPlaceholder", {
|
|
57
59
|
defaultValue: "Ask Dispatch anything...",
|
|
58
|
-
}), onSubmit: (text) => send(text) }), _jsx("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: promptSuggestions.map((suggestion) => (_jsx("button", { type: "button", onClick: () => send(suggestion), className: "cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground", children: suggestion }, suggestion))) })] }) }));
|
|
60
|
+
}), selectedEffort: selectedEffort, selectedEngine: selectedEngine, selectedModel: selectedModel, onEffortChange: onEffortChange, onModelChange: onModelChange, onSubmit: (text) => send(text) }), _jsx("div", { className: "mt-3 flex flex-wrap justify-center gap-2", children: promptSuggestions.map((suggestion) => (_jsx("button", { type: "button", onClick: () => send(suggestion), className: "cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground", children: suggestion }, suggestion))) })] }) }));
|
|
59
61
|
}
|
|
60
62
|
function AppsPanel({ apps, isLoading, }) {
|
|
61
63
|
const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,mCAAmC,EACnC,aAAa,GACd,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB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AAE,iBAAiB,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,CACpD,CAAC;IACF,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,EAAE,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IAEvE,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,YAAY,KAAG,EACf,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CACnB,KAAC,gBAAgB,IACf,KAAK,EAAE,SAAS,CAAC,KAAK,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,OAAO,EAAE,GACvC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAE,aAAa,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,GAAI,CACjE,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { IconArrowUpRight } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const { selectedModel } = useChatModels();\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-3xl flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptComposer\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n onSubmit={(text) => send(text)}\n />\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const showSkeletons = isLoading && visibleApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-xl border border-border/60 bg-card/40 p-4\"\n >\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : visibleApps.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {visibleApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n </section>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dispatch-control-plane.js","sourceRoot":"","sources":["../../src/components/dispatch-control-plane.tsx"],"names":[],"mappings":";AA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AC,OAAO,EAAE,GACvC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,SAAS,IAAC,IAAI,EAAE,aAAa,IAAI,EAAE,EAAE,SAAS,EAAE,WAAW,GAAI,CACjE,IACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n navigateWithAgentChatViewTransition,\n useChatModels,\n} from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport { IconArrowUpRight } from \"@tabler/icons-react\";\nimport type { ReactNode } from \"react\";\nimport { Link, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../lib/overview-chat\";\nimport type { WorkspaceAppSummary } from \"../lib/workspace-apps\";\nimport { ActionQueryError } from \"./action-query-error\";\nimport { CreateAppPopover } from \"./create-app-popover\";\nimport { useSetPageTitle } from \"./layout/HeaderActions\";\nimport { Button } from \"./ui/button\";\nimport { Skeleton } from \"./ui/skeleton\";\nimport { WorkspaceAppCard } from \"./workspace-app-card\";\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}) {\n return (\n <div className=\"flex min-w-0 items-center justify-between gap-3\">\n <h2 className=\"truncate text-sm font-semibold text-foreground\">\n {title}\n </h2>\n {action ? <div className=\"shrink-0\">{action}</div> : null}\n </div>\n );\n}\n\nfunction CommandPanel() {\n const t = useT();\n const {\n availableModels,\n isLoading: modelListLoading,\n onEffortChange,\n onModelChange,\n selectedEffort,\n selectedEngine,\n selectedModel,\n } = useChatModels({ storageKey: \"dispatch\" });\n const navigate = useNavigate();\n const promptSuggestions = [\n t(\"dispatch.pages.suggestionWorkspaceHealth\", {\n defaultValue: \"Summarize the current workspace health\",\n }),\n t(\"dispatch.pages.suggestionOnboardingApp\", {\n defaultValue: \"Create an app for onboarding requests\",\n }),\n t(\"dispatch.pages.suggestionAnalyticsAgents\", {\n defaultValue: \"Check which agents can help with analytics\",\n }),\n ];\n\n function send(message: string) {\n const trimmed = message.trim();\n if (!trimmed) return;\n\n if (isInBuilderFrame()) {\n submitOverviewPrompt(trimmed, selectedModel);\n return;\n }\n\n navigateWithAgentChatViewTransition(navigate, \"/chat\", {\n state: {\n dispatchPrompt: {\n id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,\n message: trimmed,\n selectedModel,\n selectedEngine,\n selectedEffort,\n },\n },\n });\n }\n\n return (\n <section className=\"flex flex-col\">\n <div className=\"mx-auto flex w-full max-w-3xl flex-col pt-4 sm:pt-6\">\n <div className=\"mb-5 text-center\">\n <h2 className=\"text-2xl font-semibold tracking-tight text-foreground sm:text-3xl\">\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h2>\n <p className=\"mx-auto mt-2 max-w-xl text-sm leading-6 text-muted-foreground\">\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n <PromptComposer\n availableModels={availableModels}\n modelListLoading={modelListLoading}\n placeholder={t(\"dispatch.pages.overviewPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch anything...\",\n })}\n selectedEffort={selectedEffort}\n selectedEngine={selectedEngine}\n selectedModel={selectedModel}\n onEffortChange={onEffortChange}\n onModelChange={onModelChange}\n onSubmit={(text) => send(text)}\n />\n <div className=\"mt-3 flex flex-wrap justify-center gap-2\">\n {promptSuggestions.map((suggestion) => (\n <button\n key={suggestion}\n type=\"button\"\n onClick={() => send(suggestion)}\n className=\"cursor-pointer rounded-md border border-transparent bg-muted/60 px-2.5 py-1.5 text-xs text-muted-foreground transition-[background-color,color] hover:bg-muted hover:text-foreground\"\n >\n {suggestion}\n </button>\n ))}\n </div>\n </div>\n </section>\n );\n}\n\nfunction AppsPanel({\n apps,\n isLoading,\n}: {\n apps: WorkspaceAppSummary[];\n isLoading: boolean;\n}) {\n const visibleApps = apps.filter((app) => !app.isDispatch && !app.archived);\n const showSkeletons = isLoading && visibleApps.length === 0;\n\n return (\n <section className=\"flex flex-col gap-3\">\n <SectionHeader\n title=\"Apps\"\n action={\n <Button variant=\"outline\" size=\"sm\" asChild>\n <Link to=\"/apps\">\n View all\n <IconArrowUpRight size={14} />\n </Link>\n </Button>\n }\n />\n {showSkeletons ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {Array.from({ length: 4 }).map((_, index) => (\n <div\n key={index}\n className=\"rounded-xl border border-border/60 bg-card/40 p-4\"\n >\n <Skeleton className=\"h-4 w-32\" />\n <Skeleton className=\"mt-3 h-3 w-24\" />\n <Skeleton className=\"mt-3 h-3 w-full\" />\n </div>\n ))}\n </div>\n ) : visibleApps.length > 0 ? (\n <div className=\"grid gap-3 md:grid-cols-2\">\n {visibleApps.map((app) => (\n <WorkspaceAppCard key={app.id} app={app} className=\"min-h-32\" />\n ))}\n </div>\n ) : (\n <CreateAppPopover />\n )}\n </section>\n );\n}\n\nexport function DispatchControlPlane() {\n useSetPageTitle(<span aria-hidden />);\n const appsQuery = useActionQuery<WorkspaceAppSummary[]>(\n \"list-workspace-apps\",\n { includeAgentCards: false, includeArchived: true },\n );\n const { data: workspaceApps = [], isLoading: appsLoading } = appsQuery;\n\n return (\n <div className=\"flex flex-col gap-8\">\n <CommandPanel />\n {appsQuery.isError ? (\n <ActionQueryError\n error={appsQuery.error}\n onRetry={() => void appsQuery.refetch()}\n />\n ) : (\n <AppsPanel apps={workspaceApps ?? []} isLoading={appsLoading} />\n )}\n </div>\n );\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DispatchAutomationItem } from "./automations.js";
|
|
2
2
|
export type AutomationStatusTone = "default" | "success" | "warning" | "danger" | "muted";
|
|
3
3
|
export declare function automationIdentity(item: Pick<DispatchAutomationItem, "owner" | "path">): string;
|
|
4
|
+
export declare function automationTroubleshootPath(item: Pick<DispatchAutomationItem, "name">): string;
|
|
4
5
|
export declare function automationTarget(item: DispatchAutomationItem): string;
|
|
5
6
|
export declare function relativeRunTime(value: string | null | undefined): string;
|
|
6
7
|
export declare function automationLastRun(item: DispatchAutomationItem): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automation-display.d.ts","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,MAAM,CAAC,GACnD,MAAM,CAER;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAKrE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWxE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAEtE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAItE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAUA;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,sBAAsB,EAAE,GACpC,sBAAsB,EAAE,CAO1B"}
|
|
1
|
+
{"version":3,"file":"automation-display.d.ts","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE/D,MAAM,MAAM,oBAAoB,GAC5B,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,CAAC;AAEZ,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,OAAO,GAAG,MAAM,CAAC,GACnD,MAAM,CAER;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC,GACzC,MAAM,CAGR;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAKrE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAWxE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAEtE;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAItE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAUA;AAED,wBAAgB,eAAe,CAC7B,WAAW,EAAE,sBAAsB,EAAE,GACpC,sBAAsB,EAAE,CAO1B"}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export function automationIdentity(item) {
|
|
2
2
|
return `${item.owner}:${item.path}`;
|
|
3
3
|
}
|
|
4
|
+
export function automationTroubleshootPath(item) {
|
|
5
|
+
const params = new URLSearchParams({ query: item.name });
|
|
6
|
+
return `/thread-debug?${params.toString()}`;
|
|
7
|
+
}
|
|
4
8
|
export function automationTarget(item) {
|
|
5
9
|
if (item.triggerType === "event" && item.event)
|
|
6
10
|
return item.event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automation-display.js","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAChC,IAAoD;IAEpD,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AACtC,CAA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CAC7B,WAAqC;IAErC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DispatchAutomationItem } from \"./automations.js\";\n\nexport type AutomationStatusTone =\n | \"default\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\";\n\nexport function automationIdentity(\n item: Pick<DispatchAutomationItem, \"owner\" | \"path\">,\n): string {\n return `${item.owner}:${item.path}`;\n}\n\nexport function automationTarget(item: DispatchAutomationItem): string {\n if (item.triggerType === \"event\" && item.event) return item.event;\n if (item.scheduleDescription) return item.scheduleDescription;\n if (item.schedule) return item.schedule;\n return item.triggerType || \"schedule\";\n}\n\nexport function relativeRunTime(value: string | null | undefined): string {\n if (!value) return \"never\";\n const timestamp = new Date(value).getTime();\n if (!Number.isFinite(timestamp)) return \"never\";\n const diff = timestamp - Date.now();\n const abs = Math.abs(diff);\n const suffix = diff >= 0 ? \"from now\" : \"ago\";\n if (abs < 60_000) return diff >= 0 ? \"soon\" : \"now\";\n if (abs < 3_600_000) return `${Math.floor(abs / 60_000)}m ${suffix}`;\n if (abs < 86_400_000) return `${Math.floor(abs / 3_600_000)}h ${suffix}`;\n return `${Math.floor(abs / 86_400_000)}d ${suffix}`;\n}\n\nexport function automationLastRun(item: DispatchAutomationItem): string {\n return item.lastRun ? relativeRunTime(item.lastRun) : \"never\";\n}\n\nexport function automationNextRun(item: DispatchAutomationItem): string {\n if (!item.enabled) return \"paused\";\n if (item.triggerType === \"event\") return \"on event\";\n return item.nextRun ? relativeRunTime(item.nextRun) : \"not scheduled\";\n}\n\nexport function automationStatus(item: DispatchAutomationItem): {\n label: string;\n tone: AutomationStatusTone;\n} {\n if (!item.enabled) return { label: \"Paused\", tone: \"muted\" };\n if (item.lastStatus === \"error\") return { label: \"Error\", tone: \"danger\" };\n if (item.lastStatus === \"running\")\n return { label: \"Running\", tone: \"warning\" };\n if (item.lastStatus === \"skipped\")\n return { label: \"Skipped\", tone: \"warning\" };\n if (item.lastStatus === \"success\")\n return { label: \"Healthy\", tone: \"success\" };\n return { label: \"Ready\", tone: \"default\" };\n}\n\nexport function sortAutomations(\n automations: DispatchAutomationItem[],\n): DispatchAutomationItem[] {\n return [...automations].sort((a, b) => {\n const aError = a.enabled && a.lastStatus === \"error\" ? 1 : 0;\n const bError = b.enabled && b.lastStatus === \"error\" ? 1 : 0;\n if (aError !== bError) return bError - aError;\n return (b.lastRun || \"\").localeCompare(a.lastRun || \"\");\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"automation-display.js","sourceRoot":"","sources":["../../src/lib/automation-display.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,kBAAkB,CAChC,IAAoD;IAEpD,OAAO,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,IAA0C;IAE1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACzD,OAAO,iBAAiB,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,MA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AqC;IAErC,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,MAAM,MAAM,GAAG,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,UAAU,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,IAAI,MAAM,KAAK,MAAM;YAAE,OAAO,MAAM,GAAG,MAAM,CAAC;QAC9C,OAAO,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { DispatchAutomationItem } from \"./automations.js\";\n\nexport type AutomationStatusTone =\n | \"default\"\n | \"success\"\n | \"warning\"\n | \"danger\"\n | \"muted\";\n\nexport function automationIdentity(\n item: Pick<DispatchAutomationItem, \"owner\" | \"path\">,\n): string {\n return `${item.owner}:${item.path}`;\n}\n\nexport function automationTroubleshootPath(\n item: Pick<DispatchAutomationItem, \"name\">,\n): string {\n const params = new URLSearchParams({ query: item.name });\n return `/thread-debug?${params.toString()}`;\n}\n\nexport function automationTarget(item: DispatchAutomationItem): string {\n if (item.triggerType === \"event\" && item.event) return item.event;\n if (item.scheduleDescription) return item.scheduleDescription;\n if (item.schedule) return item.schedule;\n return item.triggerType || \"schedule\";\n}\n\nexport function relativeRunTime(value: string | null | undefined): string {\n if (!value) return \"never\";\n const timestamp = new Date(value).getTime();\n if (!Number.isFinite(timestamp)) return \"never\";\n const diff = timestamp - Date.now();\n const abs = Math.abs(diff);\n const suffix = diff >= 0 ? \"from now\" : \"ago\";\n if (abs < 60_000) return diff >= 0 ? \"soon\" : \"now\";\n if (abs < 3_600_000) return `${Math.floor(abs / 60_000)}m ${suffix}`;\n if (abs < 86_400_000) return `${Math.floor(abs / 3_600_000)}h ${suffix}`;\n return `${Math.floor(abs / 86_400_000)}d ${suffix}`;\n}\n\nexport function automationLastRun(item: DispatchAutomationItem): string {\n return item.lastRun ? relativeRunTime(item.lastRun) : \"never\";\n}\n\nexport function automationNextRun(item: DispatchAutomationItem): string {\n if (!item.enabled) return \"paused\";\n if (item.triggerType === \"event\") return \"on event\";\n return item.nextRun ? relativeRunTime(item.nextRun) : \"not scheduled\";\n}\n\nexport function automationStatus(item: DispatchAutomationItem): {\n label: string;\n tone: AutomationStatusTone;\n} {\n if (!item.enabled) return { label: \"Paused\", tone: \"muted\" };\n if (item.lastStatus === \"error\") return { label: \"Error\", tone: \"danger\" };\n if (item.lastStatus === \"running\")\n return { label: \"Running\", tone: \"warning\" };\n if (item.lastStatus === \"skipped\")\n return { label: \"Skipped\", tone: \"warning\" };\n if (item.lastStatus === \"success\")\n return { label: \"Healthy\", tone: \"success\" };\n return { label: \"Ready\", tone: \"default\" };\n}\n\nexport function sortAutomations(\n automations: DispatchAutomationItem[],\n): DispatchAutomationItem[] {\n return [...automations].sort((a, b) => {\n const aError = a.enabled && a.lastStatus === \"error\" ? 1 : 0;\n const bError = b.enabled && b.lastStatus === \"error\" ? 1 : 0;\n if (aError !== bError) return bError - aError;\n return (b.lastRun || \"\").localeCompare(a.lastRun || \"\");\n });\n}\n"]}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { type AgentChatMessage } from "@agent-native/core/client/agent-chat";
|
|
2
|
+
interface OverviewChatOptions {
|
|
2
3
|
openSidebar?: boolean;
|
|
3
|
-
|
|
4
|
+
selectedEngine?: string | null;
|
|
5
|
+
selectedEffort?: AgentChatMessage["effort"];
|
|
6
|
+
}
|
|
7
|
+
export declare function submitOverviewPrompt(message: string, selectedModel?: string | null, options?: OverviewChatOptions): string | null;
|
|
8
|
+
export {};
|
|
4
9
|
//# sourceMappingURL=overview-chat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview-chat.d.ts","sourceRoot":"","sources":["../../src/lib/overview-chat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"overview-chat.d.ts","sourceRoot":"","sources":["../../src/lib/overview-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,sCAAsC,CAAC;AAG9C,UAAU,mBAAmB;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,EAC7B,OAAO,CAAC,EAAE,mBAAmB,GAC5B,MAAM,GAAG,IAAI,CAqBf"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
1
|
+
import { sendToAgentChat, } from "@agent-native/core/client/agent-chat";
|
|
2
2
|
import { isInBuilderFrame } from "@agent-native/core/client/host";
|
|
3
3
|
export function submitOverviewPrompt(message, selectedModel, options) {
|
|
4
4
|
const trimmed = message.trim();
|
|
@@ -16,6 +16,8 @@ export function submitOverviewPrompt(message, selectedModel, options) {
|
|
|
16
16
|
submit: true,
|
|
17
17
|
newTab: true,
|
|
18
18
|
model: selectedModel || undefined,
|
|
19
|
+
...(options?.selectedEngine ? { engine: options.selectedEngine } : {}),
|
|
20
|
+
...(options?.selectedEffort ? { effort: options.selectedEffort } : {}),
|
|
19
21
|
...(options?.openSidebar === false ? { openSidebar: false } : {}),
|
|
20
22
|
});
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overview-chat.js","sourceRoot":"","sources":["../../src/lib/overview-chat.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"overview-chat.js","sourceRoot":"","sources":["../../src/lib/overview-chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAQlE,MAAM,UAAU,oBAAoB,CAClC,OAAe,EACf,aAA6B,EAC7B,OAA6B;IAE7B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAC/B,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAE1B,IAAI,gBAAgB,EAAE,EAAE,CAAC;QACvB,OAAO,eAAe,CAAC;YACrB,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;IAED,OAAO,eAAe,CAAC;QACrB,OAAO,EAAE,OAAO;QAChB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE,aAAa,IAAI,SAAS;QACjC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n sendToAgentChat,\n type AgentChatMessage,\n} from \"@agent-native/core/client/agent-chat\";\nimport { isInBuilderFrame } from \"@agent-native/core/client/host\";\n\ninterface OverviewChatOptions {\n openSidebar?: boolean;\n selectedEngine?: string | null;\n selectedEffort?: AgentChatMessage[\"effort\"];\n}\n\nexport function submitOverviewPrompt(\n message: string,\n selectedModel?: string | null,\n options?: OverviewChatOptions,\n): string | null {\n const trimmed = message.trim();\n if (!trimmed) return null;\n\n if (isInBuilderFrame()) {\n return sendToAgentChat({\n message: trimmed,\n submit: true,\n type: \"code\",\n });\n }\n\n return sendToAgentChat({\n message: trimmed,\n submit: true,\n newTab: true,\n model: selectedModel || undefined,\n ...(options?.selectedEngine ? { engine: options.selectedEngine } : {}),\n ...(options?.selectedEffort ? { effort: options.selectedEffort } : {}),\n ...(options?.openSidebar === false ? { openSidebar: false } : {}),\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/automations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/automations.tsx"],"names":[],"mappings":"AA2CA,wBAAgB,IAAI;;IAEnB;AAmID,MAAM,CAAC,OAAO,UAAU,gBAAgB,oDAoHvC"}
|
|
@@ -2,9 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
3
3
|
import { PromptComposer } from "@agent-native/core/client/composer";
|
|
4
4
|
import { useChangeVersions } from "@agent-native/core/client/hooks";
|
|
5
|
-
import { IconPlus, IconSettingsAutomation } from "@tabler/icons-react";
|
|
5
|
+
import { IconFileSearch, IconPlus, IconSettingsAutomation, } from "@tabler/icons-react";
|
|
6
6
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
7
7
|
import { useMemo, useState } from "react";
|
|
8
|
+
import { Link } from "react-router";
|
|
8
9
|
import { toast } from "sonner";
|
|
9
10
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
10
11
|
import { Badge } from "../../components/ui/badge.js";
|
|
@@ -12,7 +13,7 @@ import { Button } from "../../components/ui/button.js";
|
|
|
12
13
|
import { Popover, PopoverContent, PopoverTrigger, } from "../../components/ui/popover.js";
|
|
13
14
|
import { Skeleton } from "../../components/ui/skeleton.js";
|
|
14
15
|
import { Switch } from "../../components/ui/switch.js";
|
|
15
|
-
import { automationIdentity, automationLastRun, automationNextRun, automationStatus, automationTarget, sortAutomations, } from "../../lib/automation-display.js";
|
|
16
|
+
import { automationIdentity, automationLastRun, automationNextRun, automationStatus, automationTarget, automationTroubleshootPath, sortAutomations, } from "../../lib/automation-display.js";
|
|
16
17
|
import { listDispatchAutomations, setDispatchAutomationEnabled, } from "../../lib/automations.js";
|
|
17
18
|
import { cn } from "../../lib/utils.js";
|
|
18
19
|
const AUTOMATIONS_QUERY_KEY = ["dispatch-automations"];
|
|
@@ -97,7 +98,7 @@ export default function AutomationsRoute() {
|
|
|
97
98
|
const status = automationStatus(item);
|
|
98
99
|
const canUpdate = item.canUpdate !== false;
|
|
99
100
|
const isToggling = pendingToggleIdentity === automationIdentity(item);
|
|
100
|
-
return (_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] gap-3 px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(StatusDot, { tone: status.tone }), _jsx("span", { className: "truncate text-sm font-medium text-foreground", children: item.name })] }), _jsx("div", { className: "mt-1 truncate text-xs text-muted-foreground", children: automationTarget(item) }), _jsxs("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: [_jsxs("span", { children: ["Last ", automationLastRun(item)] }), _jsxs("span", { children: ["Next ", automationNextRun(item)] })] }), item.lastError ? (
|
|
101
|
+
return (_jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto] gap-3 px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [_jsx(StatusDot, { tone: status.tone }), _jsx("span", { className: "truncate text-sm font-medium text-foreground", children: item.name })] }), _jsx("div", { className: "mt-1 truncate text-xs text-muted-foreground", children: automationTarget(item) }), _jsxs("div", { className: "mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground", children: [_jsxs("span", { children: ["Last ", automationLastRun(item)] }), _jsxs("span", { children: ["Next ", automationNextRun(item)] })] }), item.lastError ? (_jsxs("div", { className: "mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-destructive", children: [_jsx("span", { className: "min-w-0 break-words", children: item.lastError }), _jsxs(Link, { to: automationTroubleshootPath(item), className: "inline-flex shrink-0 items-center gap-1 font-medium text-foreground underline-offset-4 hover:underline", "aria-label": `Troubleshoot ${item.name} in Thread Debug`, children: [_jsx(IconFileSearch, { size: 13, "aria-hidden": "true" }), "Troubleshoot in Thread Debug"] })] })) : null] }), _jsxs("div", { className: "flex flex-col items-end gap-2", children: [_jsx(Badge, { variant: status.tone === "danger" ? "destructive" : "outline", className: "h-5", children: status.label }), _jsx(Switch, { checked: !!item.enabled, disabled: !canUpdate || isToggling, "aria-label": `${item.enabled ? "Disable" : "Enable"} automation ${item.name}`, onCheckedChange: (checked) => toggleAutomation.mutate({
|
|
101
102
|
owner: item.owner,
|
|
102
103
|
path: item.path,
|
|
103
104
|
enabled: checked,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automations.js","sourceRoot":"","sources":["../../../src/routes/pages/automations.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC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;gDACtB,KAAK,EAAE,IAAI,CAAC,KAAK;gDACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gDACf,OAAO,EAAE,OAAO;6CACjB,CAAC,GAEJ,IACE,KA5CD,IAAI,CAAC,EAAE,CA6CR,CACP,CAAC;oBACJ,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,sDAAsD,mHAG/D,CACP,GACG,IACE,GACI,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { sendToAgentChat } from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useChangeVersions } from \"@agent-native/core/client/hooks\";\nimport { IconPlus, IconSettingsAutomation } from \"@tabler/icons-react\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMemo, useState } from \"react\";\nimport { toast } from \"sonner\";\n\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../../components/ui/popover\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport { Switch } from \"../../components/ui/switch\";\nimport {\n automationIdentity,\n automationLastRun,\n automationNextRun,\n automationStatus,\n automationTarget,\n sortAutomations,\n type AutomationStatusTone,\n} from \"../../lib/automation-display\";\nimport {\n listDispatchAutomations,\n setDispatchAutomationEnabled,\n type DispatchAutomationItem,\n type SetDispatchAutomationEnabledInput,\n} from \"../../lib/automations\";\nimport { cn } from \"../../lib/utils\";\n\nconst AUTOMATIONS_QUERY_KEY = [\"dispatch-automations\"] as const;\n\nexport function meta() {\n return [{ title: \"Automations — Dispatch\" }];\n}\n\nfunction StatusDot({ tone }: { tone: AutomationStatusTone }) {\n return (\n <span\n className={cn(\n \"size-2 shrink-0 rounded-full\",\n tone === \"success\" && \"bg-emerald-500\",\n tone === \"warning\" && \"bg-amber-500\",\n tone === \"danger\" && \"bg-destructive\",\n tone === \"muted\" && \"bg-muted-foreground/35\",\n tone === \"default\" && \"bg-primary\",\n )}\n />\n );\n}\n\nfunction useAutomations() {\n const version = useChangeVersions([\"action\", \"screen-refresh\"]);\n return useQuery<DispatchAutomationItem[]>({\n queryKey: [...AUTOMATIONS_QUERY_KEY, version],\n queryFn: listDispatchAutomations,\n placeholderData: (prev) => prev,\n staleTime: 5_000,\n });\n}\n\nfunction useToggleAutomation() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: setDispatchAutomationEnabled,\n onMutate: async (input: SetDispatchAutomationEnabledInput) => {\n await queryClient.cancelQueries({ queryKey: AUTOMATIONS_QUERY_KEY });\n const snapshots = queryClient.getQueriesData<DispatchAutomationItem[]>({\n queryKey: AUTOMATIONS_QUERY_KEY,\n });\n\n queryClient.setQueriesData<DispatchAutomationItem[]>(\n { queryKey: AUTOMATIONS_QUERY_KEY },\n (rows) =>\n rows?.map((item) =>\n automationIdentity(item) === automationIdentity(input)\n ? { ...item, enabled: input.enabled }\n : item,\n ),\n );\n\n return { snapshots };\n },\n onError: (err, _input, context) => {\n for (const [queryKey, data] of context?.snapshots ?? []) {\n queryClient.setQueryData(queryKey, data);\n }\n toast.error(\n `Could not update automation: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n },\n onSuccess: (updated) => {\n queryClient.setQueriesData<DispatchAutomationItem[]>(\n { queryKey: AUTOMATIONS_QUERY_KEY },\n (rows) =>\n rows?.map((item) =>\n automationIdentity(item) === automationIdentity(updated)\n ? updated\n : item,\n ),\n );\n },\n onSettled: () => {\n void queryClient.invalidateQueries({ queryKey: AUTOMATIONS_QUERY_KEY });\n },\n });\n}\n\nfunction CreateAutomationButton() {\n const [open, setOpen] = useState(false);\n const [scope, setScope] = useState<\"personal\" | \"organization\">(\"personal\");\n\n function handleSubmit(text: string) {\n const trimmed = text.trim();\n if (!trimmed) return;\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n sendToAgentChat({\n message: trimmed,\n context: `The user wants to create a new automation. Scope: ${scope}. Use manage-automations with action=define to create it. Ask clarifying questions if needed about what event to trigger on, conditions, and what actions to take.`,\n submit: true,\n newTab: true,\n });\n setOpen(false);\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button size=\"sm\">\n <IconPlus size={14} />\n New automation\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[min(100vw-2rem,24rem)] p-3\">\n <p className=\"pb-2 text-sm font-semibold text-foreground\">\n New automation\n </p>\n <PromptComposer\n autoFocus\n placeholder=\"Describe what you want to automate...\"\n draftScope=\"dispatch-automations:create\"\n onSubmit={handleSubmit}\n />\n <select\n value={scope}\n onChange={(event) =>\n setScope(event.target.value as \"personal\" | \"organization\")\n }\n className=\"mt-2 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-1.5 text-xs text-foreground\"\n >\n <option value=\"personal\">Personal</option>\n <option value=\"organization\">Organization</option>\n </select>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport default function AutomationsRoute() {\n const automationsQuery = useAutomations();\n const toggleAutomation = useToggleAutomation();\n const automations = automationsQuery.data ?? [];\n const ordered = useMemo(() => sortAutomations(automations), [automations]);\n const enabledCount = automations.filter((item) => item.enabled).length;\n const errorCount = automations.filter(\n (item) => item.enabled && item.lastStatus === \"error\",\n ).length;\n const pendingToggleIdentity = toggleAutomation.isPending\n ? toggleAutomation.variables\n ? automationIdentity(toggleAutomation.variables)\n : null\n : null;\n\n return (\n <DispatchShell\n title=\"Automations\"\n description=\"See scheduled and event-triggered jobs, pause them, or ask the agent to create one.\"\n >\n <section className=\"flex flex-col gap-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2 text-sm text-muted-foreground\">\n <IconSettingsAutomation size={16} className=\"shrink-0\" />\n <span>\n {enabledCount} enabled\n {errorCount > 0 ? ` · ${errorCount} errors` : \"\"}\n </span>\n </div>\n <CreateAutomationButton />\n </div>\n\n <div className=\"divide-y rounded-lg border bg-card\">\n {automationsQuery.isLoading && ordered.length === 0 ? (\n Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"px-4 py-3\">\n <Skeleton className=\"h-4 w-40\" />\n <Skeleton className=\"mt-2 h-3 w-28\" />\n </div>\n ))\n ) : ordered.length > 0 ? (\n ordered.map((item) => {\n const status = automationStatus(item);\n const canUpdate = item.canUpdate !== false;\n const isToggling =\n pendingToggleIdentity === automationIdentity(item);\n return (\n <div\n key={item.id}\n className=\"grid grid-cols-[minmax(0,1fr)_auto] gap-3 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <StatusDot tone={status.tone} />\n <span className=\"truncate text-sm font-medium text-foreground\">\n {item.name}\n </span>\n </div>\n <div className=\"mt-1 truncate text-xs text-muted-foreground\">\n {automationTarget(item)}\n </div>\n <div className=\"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground\">\n <span>Last {automationLastRun(item)}</span>\n <span>Next {automationNextRun(item)}</span>\n </div>\n {item.lastError ? (\n <div className=\"mt-1 truncate text-xs text-destructive\">\n {item.lastError}\n </div>\n ) : null}\n </div>\n <div className=\"flex flex-col items-end gap-2\">\n <Badge\n variant={\n status.tone === \"danger\" ? \"destructive\" : \"outline\"\n }\n className=\"h-5\"\n >\n {status.label}\n </Badge>\n <Switch\n checked={!!item.enabled}\n disabled={!canUpdate || isToggling}\n aria-label={`${item.enabled ? \"Disable\" : \"Enable\"} automation ${item.name}`}\n onCheckedChange={(checked) =>\n toggleAutomation.mutate({\n owner: item.owner,\n path: item.path,\n enabled: checked,\n })\n }\n />\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"px-4 py-10 text-center text-sm text-muted-foreground\">\n No automations yet. Create one here, or ask Dispatch to set up a\n scheduled or event-triggered job.\n </div>\n )}\n </div>\n </section>\n </DispatchShell>\n );\n}\n"]}
|
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IAAI,CAAC,EACpC,SAAS,EAAC,wGAAwG,gBACtG,gBAAgB,IAAI,CAAC,IAAI,kBAAkB,aAEvD,KAAC,cAAc,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,oCAE1C,IACH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,EACN,eAAK,SAAS,EAAC,+BAA+B,aAC5C,KAAC,KAAK,IACJ,OAAO,EACL,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,EAEtD,SAAS,EAAC,KAAK,YAEd,MAAM,CAAC,KAAK,GACP,EACR,KAAC,MAAM,IACL,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,EACvB,QAAQ,EAAE,CAAC,SAAS,IAAI,UAAU,gBACtB,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,eAAe,IAAI,CAAC,IAAI,EAAE,EAC5E,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAC3B,gBAAgB,CAAC,MAAM,CAAC;gDACtB,KAAK,EAAE,IAAI,CAAC,KAAK;gDACjB,IAAI,EAAE,IAAI,CAAC,IAAI;gDACf,OAAO,EAAE,OAAO;6CACjB,CAAC,GAEJ,IACE,KAtDD,IAAI,CAAC,EAAE,CAuDR,CACP,CAAC;oBACJ,CAAC,CAAC,CACH,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,sDAAsD,mHAG/D,CACP,GACG,IACE,GACI,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { sendToAgentChat } from \"@agent-native/core/client/agent-chat\";\nimport { PromptComposer } from \"@agent-native/core/client/composer\";\nimport { useChangeVersions } from \"@agent-native/core/client/hooks\";\nimport {\n IconFileSearch,\n IconPlus,\n IconSettingsAutomation,\n} from \"@tabler/icons-react\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { toast } from \"sonner\";\n\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport {\n Popover,\n PopoverContent,\n PopoverTrigger,\n} from \"../../components/ui/popover\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport { Switch } from \"../../components/ui/switch\";\nimport {\n automationIdentity,\n automationLastRun,\n automationNextRun,\n automationStatus,\n automationTarget,\n automationTroubleshootPath,\n sortAutomations,\n type AutomationStatusTone,\n} from \"../../lib/automation-display\";\nimport {\n listDispatchAutomations,\n setDispatchAutomationEnabled,\n type DispatchAutomationItem,\n type SetDispatchAutomationEnabledInput,\n} from \"../../lib/automations\";\nimport { cn } from \"../../lib/utils\";\n\nconst AUTOMATIONS_QUERY_KEY = [\"dispatch-automations\"] as const;\n\nexport function meta() {\n return [{ title: \"Automations — Dispatch\" }];\n}\n\nfunction StatusDot({ tone }: { tone: AutomationStatusTone }) {\n return (\n <span\n className={cn(\n \"size-2 shrink-0 rounded-full\",\n tone === \"success\" && \"bg-emerald-500\",\n tone === \"warning\" && \"bg-amber-500\",\n tone === \"danger\" && \"bg-destructive\",\n tone === \"muted\" && \"bg-muted-foreground/35\",\n tone === \"default\" && \"bg-primary\",\n )}\n />\n );\n}\n\nfunction useAutomations() {\n const version = useChangeVersions([\"action\", \"screen-refresh\"]);\n return useQuery<DispatchAutomationItem[]>({\n queryKey: [...AUTOMATIONS_QUERY_KEY, version],\n queryFn: listDispatchAutomations,\n placeholderData: (prev) => prev,\n staleTime: 5_000,\n });\n}\n\nfunction useToggleAutomation() {\n const queryClient = useQueryClient();\n\n return useMutation({\n mutationFn: setDispatchAutomationEnabled,\n onMutate: async (input: SetDispatchAutomationEnabledInput) => {\n await queryClient.cancelQueries({ queryKey: AUTOMATIONS_QUERY_KEY });\n const snapshots = queryClient.getQueriesData<DispatchAutomationItem[]>({\n queryKey: AUTOMATIONS_QUERY_KEY,\n });\n\n queryClient.setQueriesData<DispatchAutomationItem[]>(\n { queryKey: AUTOMATIONS_QUERY_KEY },\n (rows) =>\n rows?.map((item) =>\n automationIdentity(item) === automationIdentity(input)\n ? { ...item, enabled: input.enabled }\n : item,\n ),\n );\n\n return { snapshots };\n },\n onError: (err, _input, context) => {\n for (const [queryKey, data] of context?.snapshots ?? []) {\n queryClient.setQueryData(queryKey, data);\n }\n toast.error(\n `Could not update automation: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n },\n onSuccess: (updated) => {\n queryClient.setQueriesData<DispatchAutomationItem[]>(\n { queryKey: AUTOMATIONS_QUERY_KEY },\n (rows) =>\n rows?.map((item) =>\n automationIdentity(item) === automationIdentity(updated)\n ? updated\n : item,\n ),\n );\n },\n onSettled: () => {\n void queryClient.invalidateQueries({ queryKey: AUTOMATIONS_QUERY_KEY });\n },\n });\n}\n\nfunction CreateAutomationButton() {\n const [open, setOpen] = useState(false);\n const [scope, setScope] = useState<\"personal\" | \"organization\">(\"personal\");\n\n function handleSubmit(text: string) {\n const trimmed = text.trim();\n if (!trimmed) return;\n window.dispatchEvent(\n new CustomEvent(\"agent-panel:set-mode\", {\n detail: { mode: \"chat\" },\n }),\n );\n sendToAgentChat({\n message: trimmed,\n context: `The user wants to create a new automation. Scope: ${scope}. Use manage-automations with action=define to create it. Ask clarifying questions if needed about what event to trigger on, conditions, and what actions to take.`,\n submit: true,\n newTab: true,\n });\n setOpen(false);\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger asChild>\n <Button size=\"sm\">\n <IconPlus size={14} />\n New automation\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"end\" className=\"w-[min(100vw-2rem,24rem)] p-3\">\n <p className=\"pb-2 text-sm font-semibold text-foreground\">\n New automation\n </p>\n <PromptComposer\n autoFocus\n placeholder=\"Describe what you want to automate...\"\n draftScope=\"dispatch-automations:create\"\n onSubmit={handleSubmit}\n />\n <select\n value={scope}\n onChange={(event) =>\n setScope(event.target.value as \"personal\" | \"organization\")\n }\n className=\"mt-2 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-1.5 text-xs text-foreground\"\n >\n <option value=\"personal\">Personal</option>\n <option value=\"organization\">Organization</option>\n </select>\n </PopoverContent>\n </Popover>\n );\n}\n\nexport default function AutomationsRoute() {\n const automationsQuery = useAutomations();\n const toggleAutomation = useToggleAutomation();\n const automations = automationsQuery.data ?? [];\n const ordered = useMemo(() => sortAutomations(automations), [automations]);\n const enabledCount = automations.filter((item) => item.enabled).length;\n const errorCount = automations.filter(\n (item) => item.enabled && item.lastStatus === \"error\",\n ).length;\n const pendingToggleIdentity = toggleAutomation.isPending\n ? toggleAutomation.variables\n ? automationIdentity(toggleAutomation.variables)\n : null\n : null;\n\n return (\n <DispatchShell\n title=\"Automations\"\n description=\"See scheduled and event-triggered jobs, pause them, or ask the agent to create one.\"\n >\n <section className=\"flex flex-col gap-4\">\n <div className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"flex min-w-0 items-center gap-2 text-sm text-muted-foreground\">\n <IconSettingsAutomation size={16} className=\"shrink-0\" />\n <span>\n {enabledCount} enabled\n {errorCount > 0 ? ` · ${errorCount} errors` : \"\"}\n </span>\n </div>\n <CreateAutomationButton />\n </div>\n\n <div className=\"divide-y rounded-lg border bg-card\">\n {automationsQuery.isLoading && ordered.length === 0 ? (\n Array.from({ length: 4 }).map((_, index) => (\n <div key={index} className=\"px-4 py-3\">\n <Skeleton className=\"h-4 w-40\" />\n <Skeleton className=\"mt-2 h-3 w-28\" />\n </div>\n ))\n ) : ordered.length > 0 ? (\n ordered.map((item) => {\n const status = automationStatus(item);\n const canUpdate = item.canUpdate !== false;\n const isToggling =\n pendingToggleIdentity === automationIdentity(item);\n return (\n <div\n key={item.id}\n className=\"grid grid-cols-[minmax(0,1fr)_auto] gap-3 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <StatusDot tone={status.tone} />\n <span className=\"truncate text-sm font-medium text-foreground\">\n {item.name}\n </span>\n </div>\n <div className=\"mt-1 truncate text-xs text-muted-foreground\">\n {automationTarget(item)}\n </div>\n <div className=\"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground\">\n <span>Last {automationLastRun(item)}</span>\n <span>Next {automationNextRun(item)}</span>\n </div>\n {item.lastError ? (\n <div className=\"mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-destructive\">\n <span className=\"min-w-0 break-words\">\n {item.lastError}\n </span>\n <Link\n to={automationTroubleshootPath(item)}\n className=\"inline-flex shrink-0 items-center gap-1 font-medium text-foreground underline-offset-4 hover:underline\"\n aria-label={`Troubleshoot ${item.name} in Thread Debug`}\n >\n <IconFileSearch size={13} aria-hidden=\"true\" />\n Troubleshoot in Thread Debug\n </Link>\n </div>\n ) : null}\n </div>\n <div className=\"flex flex-col items-end gap-2\">\n <Badge\n variant={\n status.tone === \"danger\" ? \"destructive\" : \"outline\"\n }\n className=\"h-5\"\n >\n {status.label}\n </Badge>\n <Switch\n checked={!!item.enabled}\n disabled={!canUpdate || isToggling}\n aria-label={`${item.enabled ? \"Disable\" : \"Enable\"} automation ${item.name}`}\n onCheckedChange={(checked) =>\n toggleAutomation.mutate({\n owner: item.owner,\n path: item.path,\n enabled: checked,\n })\n }\n />\n </div>\n </div>\n );\n })\n ) : (\n <div className=\"px-4 py-10 text-center text-sm text-muted-foreground\">\n No automations yet. Create one here, or ask Dispatch to set up a\n scheduled or event-triggered job.\n </div>\n )}\n </div>\n </section>\n </DispatchShell>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":"AAqFA,wBAAgB,IAAI;;IAEnB;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,oDAiIhC"}
|
|
@@ -85,6 +85,8 @@ export default function ChatRoute() {
|
|
|
85
85
|
if (message) {
|
|
86
86
|
submitOverviewPrompt(message, prompt?.selectedModel, {
|
|
87
87
|
openSidebar: false,
|
|
88
|
+
selectedEngine: prompt?.selectedEngine,
|
|
89
|
+
selectedEffort: prompt?.selectedEffort,
|
|
88
90
|
});
|
|
89
91
|
}
|
|
90
92
|
navigate(`${location.pathname}${location.search}${location.hash}`, {
|
|
@@ -101,6 +103,8 @@ export default function ChatRoute() {
|
|
|
101
103
|
prompt?.id,
|
|
102
104
|
prompt?.message,
|
|
103
105
|
prompt?.selectedModel,
|
|
106
|
+
prompt?.selectedEngine,
|
|
107
|
+
prompt?.selectedEffort,
|
|
104
108
|
thread?.id,
|
|
105
109
|
thread?.threadId,
|
|
106
110
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,GAEP,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,SAAS,cAAc,CAAC,QAAuB;IAC7C,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACtE,CAAC;AAED,SAAS,aAAa,CAAC,QAAgB;IACrC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,IAAI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AAY,EACV,qEAAqE;yBACxE,CAAC,GACA,IACA,CACP,CAAC,CAAC,CAAC,IAAI,GAEV,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n AgentChatSurface,\n markAgentChatHomeHandoff,\n} from \"@agent-native/core/client/agent-chat\";\nimport { appBasePath, appPath } from \"@agent-native/core/client/api-path\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ComponentProps,\n} from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../../lib/overview-chat\";\n\nfunction chatThreadPath(threadId: string | null): string {\n return threadId ? `/chat/${encodeURIComponent(threadId)}` : \"/chat\";\n}\n\nfunction stripBasePath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\n// The chat surface renders for both `/chat` and the `/chat/:threadId` deep\n// link. The thread id is read from the pathname (not `useParams`) because the\n// param is owned by the nested deep-link route, not this leaf component.\nfunction threadIdFromPath(pathname: string): string | null {\n const match = stripBasePath(pathname).match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\n// Mirror the basename handling Dispatch's nav links use: pass a router-local\n// path when the live URL is already under the mount, otherwise prefix it.\nfunction dispatchNavTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\ninterface DispatchThreadUrlSync {\n routeThreadId: string | null;\n getPath: (threadId: string | null) => string;\n navigate: (path: string, options?: { replace?: boolean }) => void;\n}\n\ntype DispatchAgentChatSurfaceProps = ComponentProps<typeof AgentChatSurface> & {\n threadUrlSync?: DispatchThreadUrlSync;\n};\n\nfunction DispatchAgentChatSurface(props: DispatchAgentChatSurfaceProps) {\n return <AgentChatSurface {...props} />;\n}\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport function meta() {\n return [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n const routeThreadId = threadIdFromPath(location.pathname);\n const handledStateIds = useRef(new Set<string>());\n\n const navigateThreadUrl = useCallback(\n (path: string, options?: { replace?: boolean }) =>\n navigate(dispatchNavTarget(path), options),\n [navigate],\n );\n const threadUrlSync = useMemo<DispatchThreadUrlSync>(\n () => ({\n routeThreadId: routeThreadId ?? null,\n getPath: chatThreadPath,\n navigate: navigateThreadUrl,\n }),\n [routeThreadId, navigateThreadUrl],\n );\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n thread?.id,\n thread?.threadId,\n ]);\n\n useEffect(() => {\n function handleChatRunning(event: Event) {\n const detail = (event as CustomEvent).detail;\n if (detail?.isRunning === true) markAgentChatHomeHandoff(\"dispatch\");\n }\n\n window.addEventListener(\"agentNative.chatRunning\", handleChatRunning);\n return () =>\n window.removeEventListener(\"agentNative.chatRunning\", handleChatRunning);\n }, []);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <DispatchAgentChatSurface\n mode=\"page\"\n chatViewTransition\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n storageKey=\"dispatch\"\n threadUrlSync={threadUrlSync}\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText={t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n emptyStateDisplay=\"hidden\"\n {...(!prompt?.message\n ? {\n centerComposerWhenEmpty: true,\n composerLayoutVariant: \"hero\" as const,\n }\n : {})}\n composerPlaceholder={t(\"dispatch.pages.chatPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch...\",\n })}\n composerSlot={\n !prompt?.message ? (\n <div className=\"dispatch-chat-intro\">\n <h1>\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h1>\n <p>\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n ) : null\n }\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/routes/pages/chat.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM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AqE;aACxE,CAAC,EACF,iBAAiB,EAAC,QAAQ,KACtB,CAAC,CAAC,MAAM,EAAE,OAAO;gBACnB,CAAC,CAAC;oBACE,uBAAuB,EAAE,IAAI;oBAC7B,qBAAqB,EAAE,MAAe;iBACvC;gBACH,CAAC,CAAC,EAAE,CAAC,EACP,mBAAmB,EAAE,CAAC,CAAC,sCAAsC,EAAE;gBAC7D,YAAY,EAAE,iBAAiB;aAChC,CAAC,EACF,YAAY,EACV,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CACjB,eAAK,SAAS,EAAC,qBAAqB,aAClC,uBACG,CAAC,CAAC,+BAA+B,EAAE;4BAClC,YAAY,EAAE,uBAAuB;yBACtC,CAAC,GACC,EACL,sBACG,CAAC,CAAC,0CAA0C,EAAE;4BAC7C,YAAY,EACV,qEAAqE;yBACxE,CAAC,GACA,IACA,CACP,CAAC,CAAC,CAAC,IAAI,GAEV,GACE,CACP,CAAC;AACJ,CAAC","sourcesContent":["import {\n AgentChatSurface,\n markAgentChatHomeHandoff,\n} from \"@agent-native/core/client/agent-chat\";\nimport { appBasePath, appPath } from \"@agent-native/core/client/api-path\";\nimport { useT } from \"@agent-native/core/client/i18n\";\nimport {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n type ComponentProps,\n} from \"react\";\nimport { useLocation, useNavigate } from \"react-router\";\n\nimport { submitOverviewPrompt } from \"../../lib/overview-chat\";\n\nfunction chatThreadPath(threadId: string | null): string {\n return threadId ? `/chat/${encodeURIComponent(threadId)}` : \"/chat\";\n}\n\nfunction stripBasePath(pathname: string): string {\n const basePath = appBasePath();\n if (!basePath) return pathname;\n if (pathname === basePath) return \"/\";\n if (pathname.startsWith(`${basePath}/`)) {\n return pathname.slice(basePath.length) || \"/\";\n }\n return pathname;\n}\n\n// The chat surface renders for both `/chat` and the `/chat/:threadId` deep\n// link. The thread id is read from the pathname (not `useParams`) because the\n// param is owned by the nested deep-link route, not this leaf component.\nfunction threadIdFromPath(pathname: string): string | null {\n const match = stripBasePath(pathname).match(/^\\/chat\\/([^/]+)/);\n if (!match) return null;\n try {\n const value = decodeURIComponent(match[1]).trim();\n return value || null;\n } catch {\n return null;\n }\n}\n\n// Mirror the basename handling Dispatch's nav links use: pass a router-local\n// path when the live URL is already under the mount, otherwise prefix it.\nfunction dispatchNavTarget(path: string): string {\n if (typeof window === \"undefined\") return path;\n const basePath = appBasePath();\n if (!basePath) return path;\n const pathname = window.location.pathname;\n const routerHasBasename =\n pathname === basePath || pathname.startsWith(`${basePath}/`);\n return routerHasBasename ? path : appPath(path);\n}\n\ninterface DispatchThreadUrlSync {\n routeThreadId: string | null;\n getPath: (threadId: string | null) => string;\n navigate: (path: string, options?: { replace?: boolean }) => void;\n}\n\ntype DispatchAgentChatSurfaceProps = ComponentProps<typeof AgentChatSurface> & {\n threadUrlSync?: DispatchThreadUrlSync;\n};\n\nfunction DispatchAgentChatSurface(props: DispatchAgentChatSurfaceProps) {\n return <AgentChatSurface {...props} />;\n}\n\ninterface DispatchChatLocationState {\n dispatchPrompt?: {\n id?: string | number;\n message?: string;\n selectedModel?: string | null;\n selectedEngine?: string | null;\n selectedEffort?: ComponentProps<typeof AgentChatSurface>[\"selectedEffort\"];\n };\n dispatchThread?: {\n id?: string | number;\n threadId?: string;\n };\n}\n\nexport function meta() {\n return [{ title: \"Chat — Dispatch\" }];\n}\n\nexport default function ChatRoute() {\n const t = useT();\n const location = useLocation();\n const navigate = useNavigate();\n const routeThreadId = threadIdFromPath(location.pathname);\n const handledStateIds = useRef(new Set<string>());\n\n const navigateThreadUrl = useCallback(\n (path: string, options?: { replace?: boolean }) =>\n navigate(dispatchNavTarget(path), options),\n [navigate],\n );\n const threadUrlSync = useMemo<DispatchThreadUrlSync>(\n () => ({\n routeThreadId: routeThreadId ?? null,\n getPath: chatThreadPath,\n navigate: navigateThreadUrl,\n }),\n [routeThreadId, navigateThreadUrl],\n );\n const state = location.state as DispatchChatLocationState | null;\n const prompt = state?.dispatchPrompt;\n const thread = state?.dispatchThread;\n\n useEffect(() => {\n const message = prompt?.message?.trim();\n const threadId = thread?.threadId?.trim();\n if (!message && !threadId) return;\n\n const stateId = String(\n prompt?.id ?? thread?.id ?? `${message ?? \"\"}:${threadId ?? \"\"}`,\n );\n if (handledStateIds.current.has(stateId)) return;\n handledStateIds.current.add(stateId);\n\n const timer = window.setTimeout(() => {\n if (threadId) {\n window.dispatchEvent(\n new CustomEvent(\"agent-chat:open-thread\", {\n detail: { threadId },\n }),\n );\n }\n if (message) {\n submitOverviewPrompt(message, prompt?.selectedModel, {\n openSidebar: false,\n selectedEngine: prompt?.selectedEngine,\n selectedEffort: prompt?.selectedEffort,\n });\n }\n navigate(`${location.pathname}${location.search}${location.hash}`, {\n replace: true,\n state: null,\n });\n }, 0);\n\n return () => window.clearTimeout(timer);\n }, [\n location.hash,\n location.pathname,\n location.search,\n navigate,\n prompt?.id,\n prompt?.message,\n prompt?.selectedModel,\n prompt?.selectedEngine,\n prompt?.selectedEffort,\n thread?.id,\n thread?.threadId,\n ]);\n\n useEffect(() => {\n function handleChatRunning(event: Event) {\n const detail = (event as CustomEvent).detail;\n if (detail?.isRunning === true) markAgentChatHomeHandoff(\"dispatch\");\n }\n\n window.addEventListener(\"agentNative.chatRunning\", handleChatRunning);\n return () =>\n window.removeEventListener(\"agentNative.chatRunning\", handleChatRunning);\n }, []);\n\n return (\n <div className=\"flex h-full min-h-0 flex-col bg-background\">\n <DispatchAgentChatSurface\n mode=\"page\"\n chatViewTransition\n className=\"dispatch-chat-panel\"\n defaultMode=\"chat\"\n storageKey=\"dispatch\"\n threadUrlSync={threadUrlSync}\n showHeader={false}\n showTabBar={false}\n dynamicSuggestions={false}\n suggestions={[]}\n emptyStateText={t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n emptyStateDisplay=\"hidden\"\n {...(!prompt?.message\n ? {\n centerComposerWhenEmpty: true,\n composerLayoutVariant: \"hero\" as const,\n }\n : {})}\n composerPlaceholder={t(\"dispatch.pages.chatPromptPlaceholder\", {\n defaultValue: \"Ask Dispatch...\",\n })}\n composerSlot={\n !prompt?.message ? (\n <div className=\"dispatch-chat-intro\">\n <h1>\n {t(\"dispatch.pages.chatAcrossApps\", {\n defaultValue: \"Chat across your apps\",\n })}\n </h1>\n <p>\n {t(\"dispatch.pages.chatAcrossAppsDescription\", {\n defaultValue:\n \"Route work, inspect status, or create something new from one place.\",\n })}\n </p>\n </div>\n ) : null\n }\n />\n </div>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-debug.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/thread-debug.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"thread-debug.d.ts","sourceRoot":"","sources":["../../../src/routes/pages/thread-debug.tsx"],"names":[],"mappings":"AAgCA,wBAAgB,IAAI;;IAEnB;AAgYD,MAAM,CAAC,OAAO,UAAU,gBAAgB,oDA2RvC"}
|
|
@@ -3,6 +3,7 @@ import { agentNativePath } from "@agent-native/core/client/api-path";
|
|
|
3
3
|
import { useActionQuery } from "@agent-native/core/client/hooks";
|
|
4
4
|
import { IconDatabase, IconFileSearch, IconRefresh, IconSearch, } from "@tabler/icons-react";
|
|
5
5
|
import { useEffect, useMemo, useState } from "react";
|
|
6
|
+
import { useSearchParams } from "react-router";
|
|
6
7
|
import { ActionQueryError } from "../../components/action-query-error.js";
|
|
7
8
|
import { DispatchShell } from "../../components/dispatch-shell.js";
|
|
8
9
|
import { Badge } from "../../components/ui/badge.js";
|
|
@@ -91,14 +92,18 @@ function ThreadDetail({ detail }) {
|
|
|
91
92
|
} })] })] }) }), _jsxs(TabsContent, { value: "raw", className: "mt-4 space-y-4", children: [_jsx(RawBlock, { value: rawBundle }), _jsx(RawBlock, { value: detail.rawThreadData })] })] })] }));
|
|
92
93
|
}
|
|
93
94
|
export default function ThreadDebugRoute() {
|
|
94
|
-
const [
|
|
95
|
-
const
|
|
96
|
-
const
|
|
95
|
+
const [routeSearchParams] = useSearchParams();
|
|
96
|
+
const initialSourceId = routeSearchParams.get("source") || "current";
|
|
97
|
+
const initialQuery = routeSearchParams.get("query") || "";
|
|
98
|
+
const initialOwnerEmail = routeSearchParams.get("ownerEmail") || "";
|
|
99
|
+
const [sourceId, setSourceId] = useState(initialSourceId);
|
|
100
|
+
const [query, setQuery] = useState(initialQuery);
|
|
101
|
+
const [ownerEmail, setOwnerEmail] = useState(initialOwnerEmail);
|
|
97
102
|
const [threadId, setThreadId] = useState("");
|
|
98
103
|
const [submittedSearch, setSubmittedSearch] = useState({
|
|
99
|
-
sourceId:
|
|
100
|
-
query:
|
|
101
|
-
ownerEmail:
|
|
104
|
+
sourceId: initialSourceId,
|
|
105
|
+
query: initialQuery,
|
|
106
|
+
ownerEmail: initialOwnerEmail,
|
|
102
107
|
});
|
|
103
108
|
const [selected, setSelected] = useState(null);
|
|
104
109
|
const sourcesQuery = useActionQuery("list-agent-thread-sources", {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thread-debug.js","sourceRoot":"","sources":["../../../src/routes/pages/thread-debug.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,2BA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C1C,QAAQ,EAAE,GAAG,EAAE,CACb,WAAW,CAAC;gDACV,QAAQ,EAAE,eAAe,CAAC,QAAQ;gDAClC,QAAQ,EAAE,MAAM,CAAC,EAAE;gDACnB,UAAU,EAAE,eAAe,CAAC,UAAU,IAAI,SAAS;6CACpD,CAAC,IARC,MAAM,CAAC,EAAE,CAUd,CACH,CAAC,IACE,IACE,EAEV,mBAAS,SAAS,EAAC,SAAS,aACzB,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,IACf,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,aAAa,EAAE,GACnC,CACH,CAAC,CAAC,CAAC,IAAI,EACP,aAAa,CAAC,CAAC,CAAC,CACf,eAAK,SAAS,EAAC,+BAA+B,aAC5C,KAAC,QAAQ,IAAC,SAAS,EAAC,UAAU,GAAG,EACjC,KAAC,QAAQ,IAAC,SAAS,EAAC,eAAe,GAAG,EACtC,KAAC,QAAQ,IAAC,SAAS,EAAC,uBAAuB,GAAG,IAC1C,CACP,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CACX,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI,CACjC,CAAC,CAAC,CAAC,CACF,eAAK,SAAS,EAAC,gJAAgJ,aAC7J,KAAC,cAAc,IAAC,SAAS,EAAC,cAAc,GAAG,mCAEvC,CACP,IACO,IACN,IACF,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport {\n IconDatabase,\n IconFileSearch,\n IconRefresh,\n IconSearch,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState } from \"react\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../../components/ui/select\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport {\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n} from \"../../components/ui/tabs\";\nimport { cn } from \"../../lib/utils\";\n\nexport function meta() {\n return [{ title: \"Thread Debug — Dispatch\" }];\n}\n\ninterface ThreadDebugSource {\n id: string;\n label: string;\n kind: \"current\" | \"env\" | \"configured\";\n current: boolean;\n connected: boolean;\n databaseUrlEnv: string | null;\n databaseAuthTokenEnv: string | null;\n canInspectAll: boolean;\n}\n\ninterface ThreadSearchResult {\n id: string;\n ownerEmail: string;\n title: string;\n preview: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n snippet: string;\n}\n\ninterface ThreadMessage {\n index: number;\n id: string | null;\n role: string;\n createdAt: string | number | null;\n status: unknown;\n text: string;\n contentParts: any[];\n attachments: any[];\n metadata: unknown;\n}\n\ninterface ThreadRun {\n id: string;\n status: string;\n abortReason: string | null;\n startedAt: number;\n completedAt: number | null;\n heartbeatAt: number | null;\n events: Array<{ seq: number; event: any; rawEventData: string }>;\n}\n\ninterface ThreadDebugResponse {\n source: {\n id: string;\n label: string;\n kind: string;\n databaseUrlEnv: string | null;\n };\n access: { viewerEmail: string; scope: string; canInspectAll: boolean };\n thread: ThreadSearchResult;\n messages: ThreadMessage[];\n debug: any;\n debugRuns: any[];\n queuedMessages: any[];\n threadData: any;\n rawThreadData: string;\n runs: ThreadRun[];\n traces: { summaries: any[]; spans: any[] };\n feedback: any[];\n satisfaction: any[];\n evals: any[];\n checkpoints: any[];\n}\n\nfunction formatDate(value: number | string | null | undefined): string {\n if (value == null || value === \"\") return \"n/a\";\n const numeric = Number(value);\n const date = Number.isFinite(numeric) ? new Date(numeric) : new Date(value);\n if (Number.isNaN(date.getTime())) return \"n/a\";\n return date.toLocaleString();\n}\n\nfunction json(value: unknown): string {\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\nfunction eventLabel(event: any): string {\n if (!event || typeof event !== \"object\") return \"event\";\n if (event.type === \"tool_start\") return `tool_start · ${event.tool}`;\n if (event.type === \"tool_done\") return `tool_done · ${event.tool}`;\n if (event.type === \"text\") return \"text\";\n if (event.type === \"error\") return `error · ${event.errorCode ?? \"agent\"}`;\n return String(event.type ?? \"event\");\n}\n\nfunction messageTitle(message: ThreadMessage): string {\n const role = message.role || \"unknown\";\n return `${role.charAt(0).toUpperCase()}${role.slice(1)} ${message.index + 1}`;\n}\n\nfunction toolParts(message: ThreadMessage): any[] {\n return message.contentParts.filter((part) => part?.type === \"tool-call\");\n}\n\nfunction RawBlock({\n value,\n className,\n}: {\n value: unknown;\n className?: string;\n}) {\n return (\n <pre\n className={cn(\n \"max-h-[520px] overflow-auto rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-foreground\",\n \"whitespace-pre-wrap break-words\",\n className,\n )}\n >\n {typeof value === \"string\" ? value : json(value)}\n </pre>\n );\n}\n\nfunction SourceBadge({ source }: { source: ThreadDebugSource }) {\n return (\n <Badge variant={source.current ? \"default\" : \"secondary\"}>\n {source.current ? \"current\" : source.kind}\n </Badge>\n );\n}\n\nfunction ResultCard({\n result,\n selected,\n onSelect,\n}: {\n result: ThreadSearchResult;\n selected: boolean;\n onSelect: () => void;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className={cn(\n \"w-full rounded-lg border px-3 py-3 text-left transition-colors\",\n selected\n ? \"border-foreground bg-muted\"\n : \"bg-card hover:border-foreground/30 hover:bg-muted/40\",\n )}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-medium text-foreground\">\n {result.title || result.preview || result.id}\n </div>\n <div className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {result.id}\n </div>\n </div>\n <Badge variant=\"outline\" className=\"shrink-0\">\n {result.messageCount}\n </Badge>\n </div>\n <div className=\"mt-2 line-clamp-3 text-xs leading-relaxed text-muted-foreground\">\n {result.snippet || result.preview || \"No preview\"}\n </div>\n <div className=\"mt-2 flex items-center justify-between gap-3 text-[11px] text-muted-foreground\">\n <span className=\"truncate\">{result.ownerEmail}</span>\n <span className=\"shrink-0\">{formatDate(result.updatedAt)}</span>\n </div>\n </button>\n );\n}\n\nfunction MessageBlock({ message }: { message: ThreadMessage }) {\n const tools = toolParts(message);\n return (\n <div className=\"rounded-lg border bg-card\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 border-b px-3 py-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <Badge\n variant={message.role === \"assistant\" ? \"default\" : \"secondary\"}\n >\n {message.role}\n </Badge>\n <span className=\"truncate text-sm font-medium text-foreground\">\n {messageTitle(message)}\n </span>\n </div>\n <div className=\"flex items-center gap-2 text-[11px] text-muted-foreground\">\n {message.attachments.length > 0 ? (\n <Badge variant=\"outline\">{message.attachments.length} files</Badge>\n ) : null}\n <span>{formatDate(message.createdAt)}</span>\n </div>\n </div>\n <div className=\"space-y-3 px-3 py-3\">\n {message.text ? (\n <div className=\"whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground\">\n {message.text}\n </div>\n ) : (\n <div className=\"text-sm text-muted-foreground\">No text content</div>\n )}\n {tools.length > 0 ? (\n <div className=\"space-y-2\">\n {tools.map((tool, index) => (\n <details\n key={`${message.id ?? message.index}-tool-${index}`}\n className=\"rounded-md border bg-muted/30 px-3 py-2\"\n >\n <summary className=\"cursor-pointer text-xs font-medium text-foreground\">\n {tool.toolName ?? tool.name ?? \"tool-call\"}\n </summary>\n <RawBlock value={tool} className=\"mt-2 max-h-72\" />\n </details>\n ))}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nfunction ThreadDetail({ detail }: { detail: ThreadDebugResponse }) {\n const rawBundle = useMemo(\n () => ({\n thread: detail.thread,\n debug: detail.debug,\n debugRuns: detail.debugRuns,\n queuedMessages: detail.queuedMessages,\n threadData: detail.threadData,\n runs: detail.runs,\n traces: detail.traces,\n feedback: detail.feedback,\n satisfaction: detail.satisfaction,\n evals: detail.evals,\n checkpoints: detail.checkpoints,\n }),\n [detail],\n );\n\n return (\n <div className=\"rounded-lg border bg-card\">\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-base font-semibold text-foreground\">\n {detail.thread.title || detail.thread.preview || detail.thread.id}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {detail.thread.id}\n </div>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{detail.messages.length} messages</Badge>\n <Badge variant=\"secondary\">{detail.runs.length} runs</Badge>\n <Badge variant=\"outline\">{detail.source.label}</Badge>\n </div>\n </div>\n <div className=\"mt-3 grid gap-2 text-xs text-muted-foreground sm:grid-cols-3\">\n <div className=\"truncate\">Owner: {detail.thread.ownerEmail}</div>\n <div>Created: {formatDate(detail.thread.createdAt)}</div>\n <div>Updated: {formatDate(detail.thread.updatedAt)}</div>\n </div>\n </div>\n\n <Tabs defaultValue=\"transcript\" className=\"p-4\">\n <TabsList>\n <TabsTrigger value=\"transcript\">Transcript</TabsTrigger>\n <TabsTrigger value=\"runs\">Runs</TabsTrigger>\n <TabsTrigger value=\"internals\">Internals</TabsTrigger>\n <TabsTrigger value=\"raw\">Raw</TabsTrigger>\n </TabsList>\n\n <TabsContent value=\"transcript\" className=\"mt-4 space-y-3\">\n {detail.messages.length > 0 ? (\n detail.messages.map((message) => (\n <MessageBlock\n key={message.id ?? `message-${message.index}`}\n message={message}\n />\n ))\n ) : (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No persisted messages.\n </div>\n )}\n </TabsContent>\n\n <TabsContent value=\"runs\" className=\"mt-4 space-y-3\">\n {detail.runs.length > 0 ? (\n detail.runs.map((run) => (\n <details key={run.id} className=\"rounded-lg border bg-card\">\n <summary className=\"cursor-pointer px-4 py-3\">\n <div className=\"inline-flex flex-wrap items-center gap-2\">\n <Badge variant=\"outline\">{run.status}</Badge>\n <span className=\"font-mono text-xs text-foreground\">\n {run.id}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {formatDate(run.startedAt)}\n </span>\n </div>\n </summary>\n <div className=\"space-y-2 border-t px-4 py-3\">\n {run.events.map((event) => (\n <details\n key={`${run.id}-${event.seq}`}\n className=\"rounded-md border bg-muted/30 px-3 py-2\"\n >\n <summary className=\"cursor-pointer text-xs font-medium text-foreground\">\n #{event.seq} {eventLabel(event.event)}\n </summary>\n <RawBlock value={event.event} className=\"mt-2 max-h-72\" />\n </details>\n ))}\n {run.events.length === 0 ? (\n <div className=\"text-sm text-muted-foreground\">\n No retained run events.\n </div>\n ) : null}\n </div>\n </details>\n ))\n ) : (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No retained runs.\n </div>\n )}\n </TabsContent>\n\n <TabsContent value=\"internals\" className=\"mt-4 space-y-4\">\n <div className=\"grid gap-4 lg:grid-cols-2\">\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Debug Runs\n </div>\n <RawBlock\n value={\n detail.debugRuns.length > 0\n ? detail.debugRuns\n : (detail.debug ?? {})\n }\n />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Trace Summaries\n </div>\n <RawBlock value={detail.traces.summaries} />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Trace Spans\n </div>\n <RawBlock value={detail.traces.spans} />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Feedback And Evals\n </div>\n <RawBlock\n value={{\n feedback: detail.feedback,\n satisfaction: detail.satisfaction,\n evals: detail.evals,\n checkpoints: detail.checkpoints,\n }}\n />\n </div>\n </div>\n </TabsContent>\n\n <TabsContent value=\"raw\" className=\"mt-4 space-y-4\">\n <RawBlock value={rawBundle} />\n <RawBlock value={detail.rawThreadData} />\n </TabsContent>\n </Tabs>\n </div>\n );\n}\n\nexport default function ThreadDebugRoute() {\n const [sourceId, setSourceId] = useState(\"current\");\n const [query, setQuery] = useState(\"\");\n const [ownerEmail, setOwnerEmail] = useState(\"\");\n const [threadId, setThreadId] = useState(\"\");\n const [submittedSearch, setSubmittedSearch] = useState({\n sourceId: \"current\",\n query: \"\",\n ownerEmail: \"\",\n });\n const [selected, setSelected] = useState<{\n sourceId: string;\n threadId: string;\n ownerEmail?: string;\n } | null>(null);\n\n const sourcesQuery = useActionQuery<{\n access: {\n viewerEmail: string;\n orgId: string | null;\n role: string | null;\n envAdmin: boolean;\n canInspectAll: boolean;\n memberCount: number;\n };\n sources: ThreadDebugSource[];\n }>(\"list-agent-thread-sources\", {});\n const { data: sourcesData, isLoading: sourcesLoading } = sourcesQuery;\n\n const sources: ThreadDebugSource[] = sourcesData?.sources ?? [];\n const searchParams = useMemo(\n () => ({\n sourceId: submittedSearch.sourceId,\n query: submittedSearch.query || undefined,\n ownerEmail: submittedSearch.ownerEmail || undefined,\n limit: 25,\n }),\n [submittedSearch],\n );\n const {\n data: searchData,\n isLoading: searchLoading,\n error: searchError,\n refetch: refetchSearch,\n } = useActionQuery<{\n count: number;\n threads: ThreadSearchResult[];\n access: { scope: string; canInspectAll: boolean };\n source: { id: string; label: string };\n }>(\"search-agent-threads\", searchParams);\n const searchThreads: ThreadSearchResult[] = searchData?.threads ?? [];\n\n const detailParams = useMemo(\n () => ({\n sourceId: selected?.sourceId ?? \"current\",\n threadId: selected?.threadId ?? \"\",\n ownerEmail: selected?.ownerEmail,\n maxRuns: 20,\n maxEvents: 800,\n maxTraceSpans: 600,\n }),\n [selected],\n );\n const {\n data: detail,\n isLoading: detailLoading,\n error: detailError,\n refetch: refetchDetail,\n } = useActionQuery<ThreadDebugResponse>(\n \"get-agent-thread-debug\",\n detailParams,\n {\n enabled: Boolean(selected?.threadId),\n },\n );\n\n const selectedSource = sources.find((source) => source.id === sourceId);\n\n useEffect(() => {\n fetch(agentNativePath(\"/_agent-native/application-state/navigation\"), {\n method: \"PUT\",\n keepalive: true,\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n view: \"thread-debug\",\n path:\n typeof window === \"undefined\"\n ? \"/thread-debug\"\n : window.location.pathname,\n sourceId,\n query,\n ownerEmail: ownerEmail.trim() || undefined,\n threadId: selected?.threadId ?? (threadId.trim() || undefined),\n }),\n }).catch(() => {});\n }, [ownerEmail, query, selected?.threadId, sourceId, threadId]);\n\n return (\n <DispatchShell\n title=\"Thread Debug\"\n description=\"Inspect persisted agent chat threads, run events, and AI internals.\"\n >\n <div className=\"space-y-4\">\n {sourcesQuery.isError ? (\n <ActionQueryError\n error={sourcesQuery.error}\n onRetry={() => void sourcesQuery.refetch()}\n />\n ) : null}\n <section className=\"rounded-lg border bg-card p-4\">\n <div className=\"grid gap-3 lg:grid-cols-[220px_1fr_260px_auto]\">\n <Select value={sourceId} onValueChange={setSourceId}>\n <SelectTrigger>\n <SelectValue placeholder=\"Source\" />\n </SelectTrigger>\n <SelectContent>\n {sources.map((source) => (\n <SelectItem key={source.id} value={source.id}>\n {source.label}\n </SelectItem>\n ))}\n {sources.length === 0 ? (\n <SelectItem value=\"current\">Current Dispatch DB</SelectItem>\n ) : null}\n </SelectContent>\n </Select>\n <Input\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n placeholder=\"Search title, preview, messages, tools\"\n />\n <Input\n value={ownerEmail}\n onChange={(event) => setOwnerEmail(event.target.value)}\n placeholder=\"Owner email\"\n />\n <Button\n type=\"button\"\n onClick={() =>\n setSubmittedSearch({\n sourceId,\n query: query.trim(),\n ownerEmail: ownerEmail.trim(),\n })\n }\n >\n <IconSearch size={16} />\n Search\n </Button>\n </div>\n\n <div className=\"mt-3 grid gap-3 lg:grid-cols-[1fr_auto]\">\n <Input\n value={threadId}\n onChange={(event) => setThreadId(event.target.value)}\n placeholder=\"Paste thread ID\"\n className=\"font-mono\"\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n const trimmed = threadId.trim();\n if (!trimmed) return;\n setSelected({\n sourceId,\n threadId: trimmed,\n ownerEmail: ownerEmail.trim() || undefined,\n });\n }}\n >\n <IconFileSearch size={16} />\n Inspect\n </Button>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 text-xs text-muted-foreground\">\n {sourcesLoading ? <Skeleton className=\"h-5 w-32\" /> : null}\n {selectedSource ? <SourceBadge source={selectedSource} /> : null}\n {selectedSource?.databaseUrlEnv ? (\n <Badge variant=\"outline\" className=\"font-mono\">\n {selectedSource.databaseUrlEnv}\n </Badge>\n ) : null}\n {sourcesData?.access ? (\n <span>\n {sourcesData.access.viewerEmail} ·{\" \"}\n {sourcesData.access.canInspectAll ? \"admin scope\" : \"own scope\"}\n </span>\n ) : null}\n </div>\n </section>\n\n {searchError ? (\n <ActionQueryError\n error={searchError}\n onRetry={() => void refetchSearch()}\n />\n ) : null}\n\n <div className=\"grid gap-4 xl:grid-cols-[380px_1fr]\">\n <section className=\"min-h-[520px] rounded-lg border bg-card\">\n <div className=\"flex items-center justify-between border-b px-4 py-3\">\n <div>\n <div className=\"text-sm font-semibold text-foreground\">\n Threads\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {searchData?.count ?? 0} results ·{\" \"}\n {searchData?.access?.scope ?? \"current scope\"}\n </div>\n </div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => refetchSearch()}\n aria-label=\"Refresh threads\"\n >\n <IconRefresh size={16} />\n </Button>\n </div>\n <div className=\"max-h-[760px] space-y-2 overflow-auto p-3\">\n {searchLoading ? (\n <>\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n </>\n ) : null}\n {!searchLoading && searchThreads.length === 0 ? (\n <div className=\"flex min-h-64 flex-col items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground\">\n <IconDatabase className=\"mb-2 h-5 w-5\" />\n No threads found.\n </div>\n ) : null}\n {searchThreads.map((result) => (\n <ResultCard\n key={result.id}\n result={result}\n selected={selected?.threadId === result.id}\n onSelect={() =>\n setSelected({\n sourceId: submittedSearch.sourceId,\n threadId: result.id,\n ownerEmail: submittedSearch.ownerEmail || undefined,\n })\n }\n />\n ))}\n </div>\n </section>\n\n <section className=\"min-w-0\">\n {detailError ? (\n <ActionQueryError\n error={detailError}\n onRetry={() => void refetchDetail()}\n />\n ) : null}\n {detailLoading ? (\n <div className=\"rounded-lg border bg-card p-4\">\n <Skeleton className=\"h-6 w-72\" />\n <Skeleton className=\"mt-3 h-4 w-96\" />\n <Skeleton className=\"mt-6 h-[520px] w-full\" />\n </div>\n ) : detail ? (\n <ThreadDetail detail={detail} />\n ) : (\n <div className=\"flex min-h-[520px] flex-col items-center justify-center rounded-lg border border-dashed bg-card px-4 text-center text-sm text-muted-foreground\">\n <IconFileSearch className=\"mb-2 h-5 w-5\" />\n Select or inspect a thread.\n </div>\n )}\n </section>\n </div>\n </div>\n </DispatchShell>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"thread-debug.js","sourceRoot":"","sources":["../../../src/routes/pages/thread-debug.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,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,SAAS,EAAC,cAAc,GAAG,mCAEvC,CACP,IACO,IACN,IACF,GACQ,CACjB,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport { useActionQuery } from \"@agent-native/core/client/hooks\";\nimport {\n IconDatabase,\n IconFileSearch,\n IconRefresh,\n IconSearch,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport { useSearchParams } from \"react-router\";\n\nimport { ActionQueryError } from \"../../components/action-query-error\";\nimport { DispatchShell } from \"../../components/dispatch-shell\";\nimport { Badge } from \"../../components/ui/badge\";\nimport { Button } from \"../../components/ui/button\";\nimport { Input } from \"../../components/ui/input\";\nimport {\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from \"../../components/ui/select\";\nimport { Skeleton } from \"../../components/ui/skeleton\";\nimport {\n Tabs,\n TabsContent,\n TabsList,\n TabsTrigger,\n} from \"../../components/ui/tabs\";\nimport { cn } from \"../../lib/utils\";\n\nexport function meta() {\n return [{ title: \"Thread Debug — Dispatch\" }];\n}\n\ninterface ThreadDebugSource {\n id: string;\n label: string;\n kind: \"current\" | \"env\" | \"configured\";\n current: boolean;\n connected: boolean;\n databaseUrlEnv: string | null;\n databaseAuthTokenEnv: string | null;\n canInspectAll: boolean;\n}\n\ninterface ThreadSearchResult {\n id: string;\n ownerEmail: string;\n title: string;\n preview: string;\n messageCount: number;\n createdAt: number;\n updatedAt: number;\n snippet: string;\n}\n\ninterface ThreadMessage {\n index: number;\n id: string | null;\n role: string;\n createdAt: string | number | null;\n status: unknown;\n text: string;\n contentParts: any[];\n attachments: any[];\n metadata: unknown;\n}\n\ninterface ThreadRun {\n id: string;\n status: string;\n abortReason: string | null;\n startedAt: number;\n completedAt: number | null;\n heartbeatAt: number | null;\n events: Array<{ seq: number; event: any; rawEventData: string }>;\n}\n\ninterface ThreadDebugResponse {\n source: {\n id: string;\n label: string;\n kind: string;\n databaseUrlEnv: string | null;\n };\n access: { viewerEmail: string; scope: string; canInspectAll: boolean };\n thread: ThreadSearchResult;\n messages: ThreadMessage[];\n debug: any;\n debugRuns: any[];\n queuedMessages: any[];\n threadData: any;\n rawThreadData: string;\n runs: ThreadRun[];\n traces: { summaries: any[]; spans: any[] };\n feedback: any[];\n satisfaction: any[];\n evals: any[];\n checkpoints: any[];\n}\n\nfunction formatDate(value: number | string | null | undefined): string {\n if (value == null || value === \"\") return \"n/a\";\n const numeric = Number(value);\n const date = Number.isFinite(numeric) ? new Date(numeric) : new Date(value);\n if (Number.isNaN(date.getTime())) return \"n/a\";\n return date.toLocaleString();\n}\n\nfunction json(value: unknown): string {\n try {\n return JSON.stringify(value, null, 2);\n } catch {\n return String(value);\n }\n}\n\nfunction eventLabel(event: any): string {\n if (!event || typeof event !== \"object\") return \"event\";\n if (event.type === \"tool_start\") return `tool_start · ${event.tool}`;\n if (event.type === \"tool_done\") return `tool_done · ${event.tool}`;\n if (event.type === \"text\") return \"text\";\n if (event.type === \"error\") return `error · ${event.errorCode ?? \"agent\"}`;\n return String(event.type ?? \"event\");\n}\n\nfunction messageTitle(message: ThreadMessage): string {\n const role = message.role || \"unknown\";\n return `${role.charAt(0).toUpperCase()}${role.slice(1)} ${message.index + 1}`;\n}\n\nfunction toolParts(message: ThreadMessage): any[] {\n return message.contentParts.filter((part) => part?.type === \"tool-call\");\n}\n\nfunction RawBlock({\n value,\n className,\n}: {\n value: unknown;\n className?: string;\n}) {\n return (\n <pre\n className={cn(\n \"max-h-[520px] overflow-auto rounded-lg border bg-muted/30 p-3 text-xs leading-relaxed text-foreground\",\n \"whitespace-pre-wrap break-words\",\n className,\n )}\n >\n {typeof value === \"string\" ? value : json(value)}\n </pre>\n );\n}\n\nfunction SourceBadge({ source }: { source: ThreadDebugSource }) {\n return (\n <Badge variant={source.current ? \"default\" : \"secondary\"}>\n {source.current ? \"current\" : source.kind}\n </Badge>\n );\n}\n\nfunction ResultCard({\n result,\n selected,\n onSelect,\n}: {\n result: ThreadSearchResult;\n selected: boolean;\n onSelect: () => void;\n}) {\n return (\n <button\n type=\"button\"\n onClick={onSelect}\n className={cn(\n \"w-full rounded-lg border px-3 py-3 text-left transition-colors\",\n selected\n ? \"border-foreground bg-muted\"\n : \"bg-card hover:border-foreground/30 hover:bg-muted/40\",\n )}\n >\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-sm font-medium text-foreground\">\n {result.title || result.preview || result.id}\n </div>\n <div className=\"mt-1 truncate font-mono text-[11px] text-muted-foreground\">\n {result.id}\n </div>\n </div>\n <Badge variant=\"outline\" className=\"shrink-0\">\n {result.messageCount}\n </Badge>\n </div>\n <div className=\"mt-2 line-clamp-3 text-xs leading-relaxed text-muted-foreground\">\n {result.snippet || result.preview || \"No preview\"}\n </div>\n <div className=\"mt-2 flex items-center justify-between gap-3 text-[11px] text-muted-foreground\">\n <span className=\"truncate\">{result.ownerEmail}</span>\n <span className=\"shrink-0\">{formatDate(result.updatedAt)}</span>\n </div>\n </button>\n );\n}\n\nfunction MessageBlock({ message }: { message: ThreadMessage }) {\n const tools = toolParts(message);\n return (\n <div className=\"rounded-lg border bg-card\">\n <div className=\"flex flex-wrap items-center justify-between gap-2 border-b px-3 py-2\">\n <div className=\"flex min-w-0 items-center gap-2\">\n <Badge\n variant={message.role === \"assistant\" ? \"default\" : \"secondary\"}\n >\n {message.role}\n </Badge>\n <span className=\"truncate text-sm font-medium text-foreground\">\n {messageTitle(message)}\n </span>\n </div>\n <div className=\"flex items-center gap-2 text-[11px] text-muted-foreground\">\n {message.attachments.length > 0 ? (\n <Badge variant=\"outline\">{message.attachments.length} files</Badge>\n ) : null}\n <span>{formatDate(message.createdAt)}</span>\n </div>\n </div>\n <div className=\"space-y-3 px-3 py-3\">\n {message.text ? (\n <div className=\"whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground\">\n {message.text}\n </div>\n ) : (\n <div className=\"text-sm text-muted-foreground\">No text content</div>\n )}\n {tools.length > 0 ? (\n <div className=\"space-y-2\">\n {tools.map((tool, index) => (\n <details\n key={`${message.id ?? message.index}-tool-${index}`}\n className=\"rounded-md border bg-muted/30 px-3 py-2\"\n >\n <summary className=\"cursor-pointer text-xs font-medium text-foreground\">\n {tool.toolName ?? tool.name ?? \"tool-call\"}\n </summary>\n <RawBlock value={tool} className=\"mt-2 max-h-72\" />\n </details>\n ))}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nfunction ThreadDetail({ detail }: { detail: ThreadDebugResponse }) {\n const rawBundle = useMemo(\n () => ({\n thread: detail.thread,\n debug: detail.debug,\n debugRuns: detail.debugRuns,\n queuedMessages: detail.queuedMessages,\n threadData: detail.threadData,\n runs: detail.runs,\n traces: detail.traces,\n feedback: detail.feedback,\n satisfaction: detail.satisfaction,\n evals: detail.evals,\n checkpoints: detail.checkpoints,\n }),\n [detail],\n );\n\n return (\n <div className=\"rounded-lg border bg-card\">\n <div className=\"border-b px-4 py-3\">\n <div className=\"flex flex-wrap items-start justify-between gap-3\">\n <div className=\"min-w-0\">\n <div className=\"truncate text-base font-semibold text-foreground\">\n {detail.thread.title || detail.thread.preview || detail.thread.id}\n </div>\n <div className=\"mt-1 truncate font-mono text-xs text-muted-foreground\">\n {detail.thread.id}\n </div>\n </div>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Badge variant=\"secondary\">{detail.messages.length} messages</Badge>\n <Badge variant=\"secondary\">{detail.runs.length} runs</Badge>\n <Badge variant=\"outline\">{detail.source.label}</Badge>\n </div>\n </div>\n <div className=\"mt-3 grid gap-2 text-xs text-muted-foreground sm:grid-cols-3\">\n <div className=\"truncate\">Owner: {detail.thread.ownerEmail}</div>\n <div>Created: {formatDate(detail.thread.createdAt)}</div>\n <div>Updated: {formatDate(detail.thread.updatedAt)}</div>\n </div>\n </div>\n\n <Tabs defaultValue=\"transcript\" className=\"p-4\">\n <TabsList>\n <TabsTrigger value=\"transcript\">Transcript</TabsTrigger>\n <TabsTrigger value=\"runs\">Runs</TabsTrigger>\n <TabsTrigger value=\"internals\">Internals</TabsTrigger>\n <TabsTrigger value=\"raw\">Raw</TabsTrigger>\n </TabsList>\n\n <TabsContent value=\"transcript\" className=\"mt-4 space-y-3\">\n {detail.messages.length > 0 ? (\n detail.messages.map((message) => (\n <MessageBlock\n key={message.id ?? `message-${message.index}`}\n message={message}\n />\n ))\n ) : (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No persisted messages.\n </div>\n )}\n </TabsContent>\n\n <TabsContent value=\"runs\" className=\"mt-4 space-y-3\">\n {detail.runs.length > 0 ? (\n detail.runs.map((run) => (\n <details key={run.id} className=\"rounded-lg border bg-card\">\n <summary className=\"cursor-pointer px-4 py-3\">\n <div className=\"inline-flex flex-wrap items-center gap-2\">\n <Badge variant=\"outline\">{run.status}</Badge>\n <span className=\"font-mono text-xs text-foreground\">\n {run.id}\n </span>\n <span className=\"text-xs text-muted-foreground\">\n {formatDate(run.startedAt)}\n </span>\n </div>\n </summary>\n <div className=\"space-y-2 border-t px-4 py-3\">\n {run.events.map((event) => (\n <details\n key={`${run.id}-${event.seq}`}\n className=\"rounded-md border bg-muted/30 px-3 py-2\"\n >\n <summary className=\"cursor-pointer text-xs font-medium text-foreground\">\n #{event.seq} {eventLabel(event.event)}\n </summary>\n <RawBlock value={event.event} className=\"mt-2 max-h-72\" />\n </details>\n ))}\n {run.events.length === 0 ? (\n <div className=\"text-sm text-muted-foreground\">\n No retained run events.\n </div>\n ) : null}\n </div>\n </details>\n ))\n ) : (\n <div className=\"rounded-lg border border-dashed px-4 py-8 text-center text-sm text-muted-foreground\">\n No retained runs.\n </div>\n )}\n </TabsContent>\n\n <TabsContent value=\"internals\" className=\"mt-4 space-y-4\">\n <div className=\"grid gap-4 lg:grid-cols-2\">\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Debug Runs\n </div>\n <RawBlock\n value={\n detail.debugRuns.length > 0\n ? detail.debugRuns\n : (detail.debug ?? {})\n }\n />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Trace Summaries\n </div>\n <RawBlock value={detail.traces.summaries} />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Trace Spans\n </div>\n <RawBlock value={detail.traces.spans} />\n </div>\n <div>\n <div className=\"mb-2 text-sm font-medium text-foreground\">\n Feedback And Evals\n </div>\n <RawBlock\n value={{\n feedback: detail.feedback,\n satisfaction: detail.satisfaction,\n evals: detail.evals,\n checkpoints: detail.checkpoints,\n }}\n />\n </div>\n </div>\n </TabsContent>\n\n <TabsContent value=\"raw\" className=\"mt-4 space-y-4\">\n <RawBlock value={rawBundle} />\n <RawBlock value={detail.rawThreadData} />\n </TabsContent>\n </Tabs>\n </div>\n );\n}\n\nexport default function ThreadDebugRoute() {\n const [routeSearchParams] = useSearchParams();\n const initialSourceId = routeSearchParams.get(\"source\") || \"current\";\n const initialQuery = routeSearchParams.get(\"query\") || \"\";\n const initialOwnerEmail = routeSearchParams.get(\"ownerEmail\") || \"\";\n const [sourceId, setSourceId] = useState(initialSourceId);\n const [query, setQuery] = useState(initialQuery);\n const [ownerEmail, setOwnerEmail] = useState(initialOwnerEmail);\n const [threadId, setThreadId] = useState(\"\");\n const [submittedSearch, setSubmittedSearch] = useState({\n sourceId: initialSourceId,\n query: initialQuery,\n ownerEmail: initialOwnerEmail,\n });\n const [selected, setSelected] = useState<{\n sourceId: string;\n threadId: string;\n ownerEmail?: string;\n } | null>(null);\n\n const sourcesQuery = useActionQuery<{\n access: {\n viewerEmail: string;\n orgId: string | null;\n role: string | null;\n envAdmin: boolean;\n canInspectAll: boolean;\n memberCount: number;\n };\n sources: ThreadDebugSource[];\n }>(\"list-agent-thread-sources\", {});\n const { data: sourcesData, isLoading: sourcesLoading } = sourcesQuery;\n\n const sources: ThreadDebugSource[] = sourcesData?.sources ?? [];\n const searchParams = useMemo(\n () => ({\n sourceId: submittedSearch.sourceId,\n query: submittedSearch.query || undefined,\n ownerEmail: submittedSearch.ownerEmail || undefined,\n limit: 25,\n }),\n [submittedSearch],\n );\n const {\n data: searchData,\n isLoading: searchLoading,\n error: searchError,\n refetch: refetchSearch,\n } = useActionQuery<{\n count: number;\n threads: ThreadSearchResult[];\n access: { scope: string; canInspectAll: boolean };\n source: { id: string; label: string };\n }>(\"search-agent-threads\", searchParams);\n const searchThreads: ThreadSearchResult[] = searchData?.threads ?? [];\n\n const detailParams = useMemo(\n () => ({\n sourceId: selected?.sourceId ?? \"current\",\n threadId: selected?.threadId ?? \"\",\n ownerEmail: selected?.ownerEmail,\n maxRuns: 20,\n maxEvents: 800,\n maxTraceSpans: 600,\n }),\n [selected],\n );\n const {\n data: detail,\n isLoading: detailLoading,\n error: detailError,\n refetch: refetchDetail,\n } = useActionQuery<ThreadDebugResponse>(\n \"get-agent-thread-debug\",\n detailParams,\n {\n enabled: Boolean(selected?.threadId),\n },\n );\n\n const selectedSource = sources.find((source) => source.id === sourceId);\n\n useEffect(() => {\n fetch(agentNativePath(\"/_agent-native/application-state/navigation\"), {\n method: \"PUT\",\n keepalive: true,\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n view: \"thread-debug\",\n path:\n typeof window === \"undefined\"\n ? \"/thread-debug\"\n : window.location.pathname,\n sourceId,\n query,\n ownerEmail: ownerEmail.trim() || undefined,\n threadId: selected?.threadId ?? (threadId.trim() || undefined),\n }),\n }).catch(() => {});\n }, [ownerEmail, query, selected?.threadId, sourceId, threadId]);\n\n return (\n <DispatchShell\n title=\"Thread Debug\"\n description=\"Inspect persisted agent chat threads, run events, and AI internals.\"\n >\n <div className=\"space-y-4\">\n {sourcesQuery.isError ? (\n <ActionQueryError\n error={sourcesQuery.error}\n onRetry={() => void sourcesQuery.refetch()}\n />\n ) : null}\n <section className=\"rounded-lg border bg-card p-4\">\n <div className=\"grid gap-3 lg:grid-cols-[220px_1fr_260px_auto]\">\n <Select value={sourceId} onValueChange={setSourceId}>\n <SelectTrigger>\n <SelectValue placeholder=\"Source\" />\n </SelectTrigger>\n <SelectContent>\n {sources.map((source) => (\n <SelectItem key={source.id} value={source.id}>\n {source.label}\n </SelectItem>\n ))}\n {sources.length === 0 ? (\n <SelectItem value=\"current\">Current Dispatch DB</SelectItem>\n ) : null}\n </SelectContent>\n </Select>\n <Input\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n placeholder=\"Search title, preview, messages, tools\"\n />\n <Input\n value={ownerEmail}\n onChange={(event) => setOwnerEmail(event.target.value)}\n placeholder=\"Owner email\"\n />\n <Button\n type=\"button\"\n onClick={() =>\n setSubmittedSearch({\n sourceId,\n query: query.trim(),\n ownerEmail: ownerEmail.trim(),\n })\n }\n >\n <IconSearch size={16} />\n Search\n </Button>\n </div>\n\n <div className=\"mt-3 grid gap-3 lg:grid-cols-[1fr_auto]\">\n <Input\n value={threadId}\n onChange={(event) => setThreadId(event.target.value)}\n placeholder=\"Paste thread ID\"\n className=\"font-mono\"\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n const trimmed = threadId.trim();\n if (!trimmed) return;\n setSelected({\n sourceId,\n threadId: trimmed,\n ownerEmail: ownerEmail.trim() || undefined,\n });\n }}\n >\n <IconFileSearch size={16} />\n Inspect\n </Button>\n </div>\n\n <div className=\"mt-3 flex flex-wrap items-center gap-2 text-xs text-muted-foreground\">\n {sourcesLoading ? <Skeleton className=\"h-5 w-32\" /> : null}\n {selectedSource ? <SourceBadge source={selectedSource} /> : null}\n {selectedSource?.databaseUrlEnv ? (\n <Badge variant=\"outline\" className=\"font-mono\">\n {selectedSource.databaseUrlEnv}\n </Badge>\n ) : null}\n {sourcesData?.access ? (\n <span>\n {sourcesData.access.viewerEmail} ·{\" \"}\n {sourcesData.access.canInspectAll ? \"admin scope\" : \"own scope\"}\n </span>\n ) : null}\n </div>\n </section>\n\n {searchError ? (\n <ActionQueryError\n error={searchError}\n onRetry={() => void refetchSearch()}\n />\n ) : null}\n\n <div className=\"grid gap-4 xl:grid-cols-[380px_1fr]\">\n <section className=\"min-h-[520px] rounded-lg border bg-card\">\n <div className=\"flex items-center justify-between border-b px-4 py-3\">\n <div>\n <div className=\"text-sm font-semibold text-foreground\">\n Threads\n </div>\n <div className=\"text-xs text-muted-foreground\">\n {searchData?.count ?? 0} results ·{\" \"}\n {searchData?.access?.scope ?? \"current scope\"}\n </div>\n </div>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => refetchSearch()}\n aria-label=\"Refresh threads\"\n >\n <IconRefresh size={16} />\n </Button>\n </div>\n <div className=\"max-h-[760px] space-y-2 overflow-auto p-3\">\n {searchLoading ? (\n <>\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n <Skeleton className=\"h-28 w-full rounded-lg\" />\n </>\n ) : null}\n {!searchLoading && searchThreads.length === 0 ? (\n <div className=\"flex min-h-64 flex-col items-center justify-center rounded-lg border border-dashed px-4 text-center text-sm text-muted-foreground\">\n <IconDatabase className=\"mb-2 h-5 w-5\" />\n No threads found.\n </div>\n ) : null}\n {searchThreads.map((result) => (\n <ResultCard\n key={result.id}\n result={result}\n selected={selected?.threadId === result.id}\n onSelect={() =>\n setSelected({\n sourceId: submittedSearch.sourceId,\n threadId: result.id,\n ownerEmail: submittedSearch.ownerEmail || undefined,\n })\n }\n />\n ))}\n </div>\n </section>\n\n <section className=\"min-w-0\">\n {detailError ? (\n <ActionQueryError\n error={detailError}\n onRetry={() => void refetchDetail()}\n />\n ) : null}\n {detailLoading ? (\n <div className=\"rounded-lg border bg-card p-4\">\n <Skeleton className=\"h-6 w-72\" />\n <Skeleton className=\"mt-3 h-4 w-96\" />\n <Skeleton className=\"mt-6 h-[520px] w-full\" />\n </div>\n ) : detail ? (\n <ThreadDetail detail={detail} />\n ) : (\n <div className=\"flex min-h-[520px] flex-col items-center justify-center rounded-lg border border-dashed bg-card px-4 text-center text-sm text-muted-foreground\">\n <IconFileSearch className=\"mb-2 h-5 w-5\" />\n Select or inspect a thread.\n </div>\n )}\n </section>\n </div>\n </div>\n </DispatchShell>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/dispatch",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.17",
|
|
4
4
|
"description": "Dispatch — workspace control plane for agent-native apps. Vault, integrations, destinations, scheduled jobs, and cross-app delegation, shipped as a single drop-in package.",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"typescript-7": "npm:typescript@^7.0.2",
|
|
101
101
|
"vite": "8.1.0",
|
|
102
102
|
"vitest": "^4.1.5",
|
|
103
|
-
"@agent-native/core": "0.
|
|
103
|
+
"@agent-native/core": "0.120.1"
|
|
104
104
|
},
|
|
105
105
|
"peerDependencies": {
|
|
106
106
|
"@agent-native/core": ">=0.8.0",
|
|
@@ -9,6 +9,18 @@ import { TooltipProvider } from "./ui/tooltip";
|
|
|
9
9
|
|
|
10
10
|
const clientState = vi.hoisted(() => ({
|
|
11
11
|
navigateWithTransition: vi.fn(),
|
|
12
|
+
promptComposerProps: null as Record<string, unknown> | null,
|
|
13
|
+
useChatModels: vi.fn(() => ({
|
|
14
|
+
availableModels: [],
|
|
15
|
+
defaultModel: "auto",
|
|
16
|
+
selectedModel: "auto",
|
|
17
|
+
selectedEngine: "",
|
|
18
|
+
selectedEffort: "medium" as const,
|
|
19
|
+
isLoading: false,
|
|
20
|
+
onModelChange: vi.fn(),
|
|
21
|
+
onEffortChange: vi.fn(),
|
|
22
|
+
refreshEngines: vi.fn(),
|
|
23
|
+
})),
|
|
12
24
|
}));
|
|
13
25
|
|
|
14
26
|
vi.mock("@agent-native/core/client/agent-chat", () => ({
|
|
@@ -17,25 +29,24 @@ vi.mock("@agent-native/core/client/agent-chat", () => ({
|
|
|
17
29
|
path: string,
|
|
18
30
|
options?: unknown,
|
|
19
31
|
) => clientState.navigateWithTransition(navigate, path, options),
|
|
20
|
-
useChatModels:
|
|
32
|
+
useChatModels: clientState.useChatModels,
|
|
21
33
|
}));
|
|
22
34
|
|
|
23
35
|
vi.mock("@agent-native/core/client/composer", () => ({
|
|
24
|
-
PromptComposer: ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
),
|
|
36
|
+
PromptComposer: (props: Record<string, unknown>) => {
|
|
37
|
+
clientState.promptComposerProps = props;
|
|
38
|
+
const onSubmit = props.onSubmit as (value: string) => void;
|
|
39
|
+
const placeholder = props.placeholder as string;
|
|
40
|
+
return (
|
|
41
|
+
<button
|
|
42
|
+
type="button"
|
|
43
|
+
data-placeholder={placeholder}
|
|
44
|
+
onClick={() => onSubmit("Route onboarding work")}
|
|
45
|
+
>
|
|
46
|
+
Composer
|
|
47
|
+
</button>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
39
50
|
}));
|
|
40
51
|
|
|
41
52
|
vi.mock("@agent-native/core/client/hooks", () => ({
|
|
@@ -67,6 +78,8 @@ describe("DispatchControlPlane", () => {
|
|
|
67
78
|
beforeEach(() => {
|
|
68
79
|
vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
|
|
69
80
|
clientState.navigateWithTransition.mockReset();
|
|
81
|
+
clientState.promptComposerProps = null;
|
|
82
|
+
clientState.useChatModels.mockClear();
|
|
70
83
|
container = document.createElement("div");
|
|
71
84
|
document.body.appendChild(container);
|
|
72
85
|
root = createRoot(container);
|
|
@@ -97,6 +110,16 @@ describe("DispatchControlPlane", () => {
|
|
|
97
110
|
expect(
|
|
98
111
|
container.querySelector('[data-placeholder="Ask Dispatch anything..."]'),
|
|
99
112
|
).not.toBeNull();
|
|
113
|
+
expect(clientState.useChatModels).toHaveBeenCalledWith({
|
|
114
|
+
storageKey: "dispatch",
|
|
115
|
+
});
|
|
116
|
+
expect(clientState.promptComposerProps).toMatchObject({
|
|
117
|
+
availableModels: [],
|
|
118
|
+
modelListLoading: false,
|
|
119
|
+
selectedEffort: "medium",
|
|
120
|
+
selectedEngine: "",
|
|
121
|
+
selectedModel: "auto",
|
|
122
|
+
});
|
|
100
123
|
|
|
101
124
|
await act(async () => {
|
|
102
125
|
container.querySelector<HTMLButtonElement>("[data-placeholder]")?.click();
|
|
@@ -110,6 +133,8 @@ describe("DispatchControlPlane", () => {
|
|
|
110
133
|
dispatchPrompt: expect.objectContaining({
|
|
111
134
|
message: "Route onboarding work",
|
|
112
135
|
selectedModel: "auto",
|
|
136
|
+
selectedEngine: "",
|
|
137
|
+
selectedEffort: "medium",
|
|
113
138
|
}),
|
|
114
139
|
},
|
|
115
140
|
}),
|
|
@@ -38,7 +38,15 @@ function SectionHeader({
|
|
|
38
38
|
|
|
39
39
|
function CommandPanel() {
|
|
40
40
|
const t = useT();
|
|
41
|
-
const {
|
|
41
|
+
const {
|
|
42
|
+
availableModels,
|
|
43
|
+
isLoading: modelListLoading,
|
|
44
|
+
onEffortChange,
|
|
45
|
+
onModelChange,
|
|
46
|
+
selectedEffort,
|
|
47
|
+
selectedEngine,
|
|
48
|
+
selectedModel,
|
|
49
|
+
} = useChatModels({ storageKey: "dispatch" });
|
|
42
50
|
const navigate = useNavigate();
|
|
43
51
|
const promptSuggestions = [
|
|
44
52
|
t("dispatch.pages.suggestionWorkspaceHealth", {
|
|
@@ -67,6 +75,8 @@ function CommandPanel() {
|
|
|
67
75
|
id: `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
68
76
|
message: trimmed,
|
|
69
77
|
selectedModel,
|
|
78
|
+
selectedEngine,
|
|
79
|
+
selectedEffort,
|
|
70
80
|
},
|
|
71
81
|
},
|
|
72
82
|
});
|
|
@@ -89,9 +99,16 @@ function CommandPanel() {
|
|
|
89
99
|
</p>
|
|
90
100
|
</div>
|
|
91
101
|
<PromptComposer
|
|
102
|
+
availableModels={availableModels}
|
|
103
|
+
modelListLoading={modelListLoading}
|
|
92
104
|
placeholder={t("dispatch.pages.overviewPromptPlaceholder", {
|
|
93
105
|
defaultValue: "Ask Dispatch anything...",
|
|
94
106
|
})}
|
|
107
|
+
selectedEffort={selectedEffort}
|
|
108
|
+
selectedEngine={selectedEngine}
|
|
109
|
+
selectedModel={selectedModel}
|
|
110
|
+
onEffortChange={onEffortChange}
|
|
111
|
+
onModelChange={onModelChange}
|
|
95
112
|
onSubmit={(text) => send(text)}
|
|
96
113
|
/>
|
|
97
114
|
<div className="mt-3 flex flex-wrap justify-center gap-2">
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
automationNextRun,
|
|
6
6
|
automationStatus,
|
|
7
7
|
automationTarget,
|
|
8
|
+
automationTroubleshootPath,
|
|
8
9
|
sortAutomations,
|
|
9
10
|
} from "./automation-display.js";
|
|
10
11
|
import type { DispatchAutomationItem } from "./automations.js";
|
|
@@ -26,6 +27,12 @@ describe("automation-display", () => {
|
|
|
26
27
|
).toBe("user@example.com:jobs/digest.md");
|
|
27
28
|
});
|
|
28
29
|
|
|
30
|
+
it("prepares a thread-debug search for an automation", () => {
|
|
31
|
+
expect(
|
|
32
|
+
automationTroubleshootPath({ name: "coach onboarding reminder" }),
|
|
33
|
+
).toBe("/thread-debug?query=coach+onboarding+reminder");
|
|
34
|
+
});
|
|
35
|
+
|
|
29
36
|
it("prefers event names, then schedule descriptions", () => {
|
|
30
37
|
expect(
|
|
31
38
|
automationTarget(
|
|
@@ -13,6 +13,13 @@ export function automationIdentity(
|
|
|
13
13
|
return `${item.owner}:${item.path}`;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export function automationTroubleshootPath(
|
|
17
|
+
item: Pick<DispatchAutomationItem, "name">,
|
|
18
|
+
): string {
|
|
19
|
+
const params = new URLSearchParams({ query: item.name });
|
|
20
|
+
return `/thread-debug?${params.toString()}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
16
23
|
export function automationTarget(item: DispatchAutomationItem): string {
|
|
17
24
|
if (item.triggerType === "event" && item.event) return item.event;
|
|
18
25
|
if (item.scheduleDescription) return item.scheduleDescription;
|
|
@@ -34,6 +34,8 @@ describe("submitOverviewPrompt", () => {
|
|
|
34
34
|
it("can submit to a mounted page chat without opening the sidebar", () => {
|
|
35
35
|
const tabId = submitOverviewPrompt(" build a metrics app ", "auto", {
|
|
36
36
|
openSidebar: false,
|
|
37
|
+
selectedEngine: "openai",
|
|
38
|
+
selectedEffort: "high",
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
expect(tabId).toBe("chat-tab");
|
|
@@ -42,6 +44,8 @@ describe("submitOverviewPrompt", () => {
|
|
|
42
44
|
submit: true,
|
|
43
45
|
newTab: true,
|
|
44
46
|
model: "auto",
|
|
47
|
+
engine: "openai",
|
|
48
|
+
effort: "high",
|
|
45
49
|
openSidebar: false,
|
|
46
50
|
});
|
|
47
51
|
});
|
package/src/lib/overview-chat.ts
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
sendToAgentChat,
|
|
3
|
+
type AgentChatMessage,
|
|
4
|
+
} from "@agent-native/core/client/agent-chat";
|
|
2
5
|
import { isInBuilderFrame } from "@agent-native/core/client/host";
|
|
3
6
|
|
|
7
|
+
interface OverviewChatOptions {
|
|
8
|
+
openSidebar?: boolean;
|
|
9
|
+
selectedEngine?: string | null;
|
|
10
|
+
selectedEffort?: AgentChatMessage["effort"];
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
export function submitOverviewPrompt(
|
|
5
14
|
message: string,
|
|
6
15
|
selectedModel?: string | null,
|
|
7
|
-
options?:
|
|
16
|
+
options?: OverviewChatOptions,
|
|
8
17
|
): string | null {
|
|
9
18
|
const trimmed = message.trim();
|
|
10
19
|
if (!trimmed) return null;
|
|
@@ -22,6 +31,8 @@ export function submitOverviewPrompt(
|
|
|
22
31
|
submit: true,
|
|
23
32
|
newTab: true,
|
|
24
33
|
model: selectedModel || undefined,
|
|
34
|
+
...(options?.selectedEngine ? { engine: options.selectedEngine } : {}),
|
|
35
|
+
...(options?.selectedEffort ? { effort: options.selectedEffort } : {}),
|
|
25
36
|
...(options?.openSidebar === false ? { openSidebar: false } : {}),
|
|
26
37
|
});
|
|
27
38
|
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { sendToAgentChat } from "@agent-native/core/client/agent-chat";
|
|
2
2
|
import { PromptComposer } from "@agent-native/core/client/composer";
|
|
3
3
|
import { useChangeVersions } from "@agent-native/core/client/hooks";
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
IconFileSearch,
|
|
6
|
+
IconPlus,
|
|
7
|
+
IconSettingsAutomation,
|
|
8
|
+
} from "@tabler/icons-react";
|
|
5
9
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
10
|
import { useMemo, useState } from "react";
|
|
11
|
+
import { Link } from "react-router";
|
|
7
12
|
import { toast } from "sonner";
|
|
8
13
|
|
|
9
14
|
import { DispatchShell } from "../../components/dispatch-shell";
|
|
@@ -22,6 +27,7 @@ import {
|
|
|
22
27
|
automationNextRun,
|
|
23
28
|
automationStatus,
|
|
24
29
|
automationTarget,
|
|
30
|
+
automationTroubleshootPath,
|
|
25
31
|
sortAutomations,
|
|
26
32
|
type AutomationStatusTone,
|
|
27
33
|
} from "../../lib/automation-display";
|
|
@@ -234,8 +240,18 @@ export default function AutomationsRoute() {
|
|
|
234
240
|
<span>Next {automationNextRun(item)}</span>
|
|
235
241
|
</div>
|
|
236
242
|
{item.lastError ? (
|
|
237
|
-
<div className="mt-1
|
|
238
|
-
|
|
243
|
+
<div className="mt-1 flex flex-wrap items-baseline gap-x-2 gap-y-1 text-xs text-destructive">
|
|
244
|
+
<span className="min-w-0 break-words">
|
|
245
|
+
{item.lastError}
|
|
246
|
+
</span>
|
|
247
|
+
<Link
|
|
248
|
+
to={automationTroubleshootPath(item)}
|
|
249
|
+
className="inline-flex shrink-0 items-center gap-1 font-medium text-foreground underline-offset-4 hover:underline"
|
|
250
|
+
aria-label={`Troubleshoot ${item.name} in Thread Debug`}
|
|
251
|
+
>
|
|
252
|
+
<IconFileSearch size={13} aria-hidden="true" />
|
|
253
|
+
Troubleshoot in Thread Debug
|
|
254
|
+
</Link>
|
|
239
255
|
</div>
|
|
240
256
|
) : null}
|
|
241
257
|
</div>
|
|
@@ -74,6 +74,8 @@ interface DispatchChatLocationState {
|
|
|
74
74
|
id?: string | number;
|
|
75
75
|
message?: string;
|
|
76
76
|
selectedModel?: string | null;
|
|
77
|
+
selectedEngine?: string | null;
|
|
78
|
+
selectedEffort?: ComponentProps<typeof AgentChatSurface>["selectedEffort"];
|
|
77
79
|
};
|
|
78
80
|
dispatchThread?: {
|
|
79
81
|
id?: string | number;
|
|
@@ -131,6 +133,8 @@ export default function ChatRoute() {
|
|
|
131
133
|
if (message) {
|
|
132
134
|
submitOverviewPrompt(message, prompt?.selectedModel, {
|
|
133
135
|
openSidebar: false,
|
|
136
|
+
selectedEngine: prompt?.selectedEngine,
|
|
137
|
+
selectedEffort: prompt?.selectedEffort,
|
|
134
138
|
});
|
|
135
139
|
}
|
|
136
140
|
navigate(`${location.pathname}${location.search}${location.hash}`, {
|
|
@@ -148,6 +152,8 @@ export default function ChatRoute() {
|
|
|
148
152
|
prompt?.id,
|
|
149
153
|
prompt?.message,
|
|
150
154
|
prompt?.selectedModel,
|
|
155
|
+
prompt?.selectedEngine,
|
|
156
|
+
prompt?.selectedEffort,
|
|
151
157
|
thread?.id,
|
|
152
158
|
thread?.threadId,
|
|
153
159
|
]);
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
IconSearch,
|
|
8
8
|
} from "@tabler/icons-react";
|
|
9
9
|
import { useEffect, useMemo, useState } from "react";
|
|
10
|
+
import { useSearchParams } from "react-router";
|
|
10
11
|
|
|
11
12
|
import { ActionQueryError } from "../../components/action-query-error";
|
|
12
13
|
import { DispatchShell } from "../../components/dispatch-shell";
|
|
@@ -416,14 +417,18 @@ function ThreadDetail({ detail }: { detail: ThreadDebugResponse }) {
|
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
export default function ThreadDebugRoute() {
|
|
419
|
-
const [
|
|
420
|
-
const
|
|
421
|
-
const
|
|
420
|
+
const [routeSearchParams] = useSearchParams();
|
|
421
|
+
const initialSourceId = routeSearchParams.get("source") || "current";
|
|
422
|
+
const initialQuery = routeSearchParams.get("query") || "";
|
|
423
|
+
const initialOwnerEmail = routeSearchParams.get("ownerEmail") || "";
|
|
424
|
+
const [sourceId, setSourceId] = useState(initialSourceId);
|
|
425
|
+
const [query, setQuery] = useState(initialQuery);
|
|
426
|
+
const [ownerEmail, setOwnerEmail] = useState(initialOwnerEmail);
|
|
422
427
|
const [threadId, setThreadId] = useState("");
|
|
423
428
|
const [submittedSearch, setSubmittedSearch] = useState({
|
|
424
|
-
sourceId:
|
|
425
|
-
query:
|
|
426
|
-
ownerEmail:
|
|
429
|
+
sourceId: initialSourceId,
|
|
430
|
+
query: initialQuery,
|
|
431
|
+
ownerEmail: initialOwnerEmail,
|
|
427
432
|
});
|
|
428
433
|
const [selected, setSelected] = useState<{
|
|
429
434
|
sourceId: string;
|