@agent-native/dispatch 0.24.0 → 0.24.3
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 +12 -12
- package/dist/components/admin-navigation.d.ts.map +1 -1
- package/dist/components/admin-navigation.js +21 -5
- package/dist/components/admin-navigation.js.map +1 -1
- package/dist/components/agents-panel.d.ts.map +1 -1
- package/dist/components/agents-panel.js +7 -2
- package/dist/components/agents-panel.js.map +1 -1
- package/dist/components/app-list-row.d.ts +1 -1
- package/dist/components/app-list-row.d.ts.map +1 -1
- package/dist/components/app-list-row.js +1 -1
- package/dist/components/app-list-row.js.map +1 -1
- package/dist/components/app-open-actions.d.ts +1 -17
- package/dist/components/app-open-actions.d.ts.map +1 -1
- package/dist/components/app-open-actions.js +1 -20
- package/dist/components/app-open-actions.js.map +1 -1
- package/dist/components/app-row-settings.d.ts +6 -0
- package/dist/components/app-row-settings.d.ts.map +1 -0
- package/dist/components/app-row-settings.js +11 -0
- package/dist/components/app-row-settings.js.map +1 -0
- package/dist/components/automation-run-history-dialog.d.ts.map +1 -1
- package/dist/components/automation-run-history-dialog.js +3 -2
- package/dist/components/automation-run-history-dialog.js.map +1 -1
- package/dist/components/connected-app-card.d.ts.map +1 -1
- package/dist/components/connected-app-card.js +1 -1
- package/dist/components/connected-app-card.js.map +1 -1
- package/dist/components/create-app-popover.js +2 -2
- package/dist/components/create-app-popover.js.map +1 -1
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +23 -7
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/dispatch-shell.d.ts.map +1 -1
- package/dist/components/dispatch-shell.js +5 -1
- package/dist/components/dispatch-shell.js.map +1 -1
- package/dist/components/docs-link.d.ts +16 -0
- package/dist/components/docs-link.d.ts.map +1 -0
- package/dist/components/docs-link.js +34 -0
- package/dist/components/docs-link.js.map +1 -0
- package/dist/components/layout/Layout.d.ts +1 -0
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +37 -28
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/messaging-setup-panel.d.ts.map +1 -1
- package/dist/components/messaging-setup-panel.js +3 -2
- package/dist/components/messaging-setup-panel.js.map +1 -1
- package/dist/components/usage-alerts-panel.d.ts +11 -0
- package/dist/components/usage-alerts-panel.d.ts.map +1 -0
- package/dist/components/usage-alerts-panel.js +125 -0
- package/dist/components/usage-alerts-panel.js.map +1 -0
- package/dist/components/workspace-app-card.d.ts +3 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +70 -29
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/components/workspace-app-search.d.ts +10 -0
- package/dist/components/workspace-app-search.d.ts.map +1 -0
- package/dist/components/workspace-app-search.js +27 -0
- package/dist/components/workspace-app-search.js.map +1 -0
- package/dist/components/workspace-resource-effective-stack.d.ts.map +1 -1
- package/dist/components/workspace-resource-effective-stack.js +3 -2
- package/dist/components/workspace-resource-effective-stack.js.map +1 -1
- package/dist/components/workspace-template-card.d.ts.map +1 -1
- package/dist/components/workspace-template-card.js +2 -1
- package/dist/components/workspace-template-card.js.map +1 -1
- package/dist/lib/workspace-app-layout.d.ts +19 -0
- package/dist/lib/workspace-app-layout.d.ts.map +1 -0
- package/dist/lib/workspace-app-layout.js +75 -0
- package/dist/lib/workspace-app-layout.js.map +1 -0
- package/dist/lib/workspace-apps.d.ts +10 -0
- package/dist/lib/workspace-apps.d.ts.map +1 -1
- package/dist/lib/workspace-apps.js +59 -0
- package/dist/lib/workspace-apps.js.map +1 -1
- package/dist/lib/workspace-apps.test.js +18 -1
- package/dist/lib/workspace-apps.test.js.map +1 -1
- package/dist/routes/pages/$appId.d.ts.map +1 -1
- package/dist/routes/pages/$appId.js +4 -2
- package/dist/routes/pages/$appId.js.map +1 -1
- package/dist/routes/pages/agents.d.ts.map +1 -1
- package/dist/routes/pages/agents.js +2 -3
- package/dist/routes/pages/agents.js.map +1 -1
- package/dist/routes/pages/apps.$appId.d.ts.map +1 -1
- package/dist/routes/pages/apps.$appId.js +8 -3
- package/dist/routes/pages/apps.$appId.js.map +1 -1
- package/dist/routes/pages/apps.d.ts.map +1 -1
- package/dist/routes/pages/apps.js +31 -16
- package/dist/routes/pages/apps.js.map +1 -1
- package/dist/routes/pages/audit.d.ts.map +1 -1
- package/dist/routes/pages/audit.js +2 -1
- package/dist/routes/pages/audit.js.map +1 -1
- package/dist/routes/pages/dreams.d.ts.map +1 -1
- package/dist/routes/pages/dreams.js +14 -18
- package/dist/routes/pages/dreams.js.map +1 -1
- package/dist/routes/pages/integrations.d.ts.map +1 -1
- package/dist/routes/pages/integrations.js +51 -14
- package/dist/routes/pages/integrations.js.map +1 -1
- package/dist/routes/pages/metrics.d.ts.map +1 -1
- package/dist/routes/pages/metrics.js +4 -1
- package/dist/routes/pages/metrics.js.map +1 -1
- package/dist/routes/pages/operations.js +1 -1
- package/dist/routes/pages/operations.js.map +1 -1
- package/dist/routes/pages/settings.d.ts.map +1 -1
- package/dist/routes/pages/settings.js +7 -2
- package/dist/routes/pages/settings.js.map +1 -1
- package/dist/routes/pages/thread-debug.d.ts.map +1 -1
- package/dist/routes/pages/thread-debug.js +5 -8
- package/dist/routes/pages/thread-debug.js.map +1 -1
- package/dist/routes/pages/vault.d.ts.map +1 -1
- package/dist/routes/pages/vault.js +1 -1
- package/dist/routes/pages/vault.js.map +1 -1
- package/dist/routes/pages/workspace.d.ts.map +1 -1
- package/dist/routes/pages/workspace.js +13 -10
- package/dist/routes/pages/workspace.js.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -0
- package/dist/server/index.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +12 -52
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/dist/shared/app-roles.d.ts +9 -0
- package/dist/shared/app-roles.d.ts.map +1 -0
- package/dist/shared/app-roles.js +7 -0
- package/dist/shared/app-roles.js.map +1 -0
- package/package.json +4 -3
- package/src/components/admin-navigation.tsx +57 -11
- package/src/components/agents-panel.tsx +54 -29
- package/src/components/app-list-row.tsx +1 -2
- package/src/components/app-open-actions.tsx +5 -114
- package/src/components/app-row-settings.tsx +54 -0
- package/src/components/automation-run-history-dialog.tsx +8 -4
- package/src/components/connected-app-card.tsx +0 -1
- package/src/components/create-app-popover.spec.tsx +1 -1
- package/src/components/create-app-popover.tsx +2 -2
- package/src/components/dispatch-control-plane.spec.tsx +36 -2
- package/src/components/dispatch-control-plane.tsx +83 -27
- package/src/components/dispatch-shell.tsx +7 -1
- package/src/components/docs-link.tsx +52 -0
- package/src/components/layout/Layout.spec.tsx +10 -0
- package/src/components/layout/Layout.tsx +50 -23
- package/src/components/messaging-setup-panel.tsx +10 -3
- package/src/components/usage-alerts-panel.tsx +445 -0
- package/src/components/workspace-app-card.spec.tsx +130 -9
- package/src/components/workspace-app-card.tsx +128 -71
- package/src/components/workspace-app-search.tsx +96 -0
- package/src/components/workspace-resource-effective-stack.tsx +10 -5
- package/src/components/workspace-template-card.spec.tsx +52 -23
- package/src/components/workspace-template-card.tsx +7 -10
- package/src/lib/workspace-app-layout.spec.ts +47 -0
- package/src/lib/workspace-app-layout.ts +121 -0
- package/src/lib/workspace-apps.test.ts +45 -1
- package/src/lib/workspace-apps.ts +72 -0
- package/src/routes/pages/$appId.tsx +3 -6
- package/src/routes/pages/agents.tsx +6 -3
- package/src/routes/pages/apps.$appId.tsx +6 -6
- package/src/routes/pages/apps.tsx +116 -62
- package/src/routes/pages/audit.tsx +28 -8
- package/src/routes/pages/dreams.tsx +92 -142
- package/src/routes/pages/integrations.tsx +147 -68
- package/src/routes/pages/metrics.tsx +8 -0
- package/src/routes/pages/operations.tsx +2 -2
- package/src/routes/pages/settings.tsx +14 -9
- package/src/routes/pages/thread-debug.tsx +18 -36
- package/src/routes/pages/vault.tsx +7 -2
- package/src/routes/pages/workspace.tsx +92 -56
- package/src/server/index.ts +4 -0
- package/src/server/lib/app-creation-store.spec.ts +90 -43
- package/src/server/lib/app-creation-store.ts +15 -61
- package/src/shared/app-roles.ts +8 -0
|
@@ -49,7 +49,7 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
49
49
|
}, {
|
|
50
50
|
id?: undefined;
|
|
51
51
|
deleted?: undefined;
|
|
52
|
-
|
|
52
|
+
provider?: undefined;
|
|
53
53
|
providers: {
|
|
54
54
|
id: string;
|
|
55
55
|
label: string;
|
|
@@ -60,45 +60,45 @@ declare const _default: import("node_modules/@agent-native/core/dist").ActionDef
|
|
|
60
60
|
updatedAt: number;
|
|
61
61
|
}[];
|
|
62
62
|
count: number;
|
|
63
|
-
provider?: undefined;
|
|
64
63
|
found?: undefined;
|
|
65
64
|
registered?: undefined;
|
|
66
65
|
label?: undefined;
|
|
66
|
+
message?: undefined;
|
|
67
67
|
} | {
|
|
68
|
-
count?: undefined;
|
|
69
68
|
id?: undefined;
|
|
70
69
|
deleted?: undefined;
|
|
71
|
-
message?: undefined;
|
|
72
70
|
providers?: undefined;
|
|
71
|
+
count?: undefined;
|
|
73
72
|
found: boolean;
|
|
74
73
|
provider: import("node_modules/@agent-native/core/dist/provider-api").CustomProviderConfig;
|
|
75
74
|
registered?: undefined;
|
|
76
75
|
label?: undefined;
|
|
76
|
+
message?: undefined;
|
|
77
77
|
} | {
|
|
78
|
-
count?: undefined;
|
|
79
78
|
deleted?: undefined;
|
|
80
|
-
message?: undefined;
|
|
81
|
-
providers?: undefined;
|
|
82
79
|
provider?: undefined;
|
|
80
|
+
providers?: undefined;
|
|
81
|
+
count?: undefined;
|
|
83
82
|
found: boolean;
|
|
84
83
|
id: string;
|
|
85
84
|
registered?: undefined;
|
|
86
85
|
label?: undefined;
|
|
87
|
-
} | {
|
|
88
|
-
count?: undefined;
|
|
89
86
|
message?: undefined;
|
|
90
|
-
|
|
87
|
+
} | {
|
|
91
88
|
provider?: undefined;
|
|
89
|
+
providers?: undefined;
|
|
90
|
+
count?: undefined;
|
|
92
91
|
found?: undefined;
|
|
93
92
|
deleted: boolean;
|
|
94
93
|
id: string;
|
|
95
94
|
registered?: undefined;
|
|
96
95
|
label?: undefined;
|
|
96
|
+
message?: undefined;
|
|
97
97
|
} | {
|
|
98
|
-
count?: undefined;
|
|
99
98
|
deleted?: undefined;
|
|
100
|
-
providers?: undefined;
|
|
101
99
|
provider?: undefined;
|
|
100
|
+
providers?: undefined;
|
|
101
|
+
count?: undefined;
|
|
102
102
|
found?: undefined;
|
|
103
103
|
registered: boolean;
|
|
104
104
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-navigation.d.ts","sourceRoot":"","sources":["../../src/components/admin-navigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"admin-navigation.d.ts","sourceRoot":"","sources":["../../src/components/admin-navigation.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAK1D,OAAO,EAAyB,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;CACnC;AAED,QAAA,MAAM,yBAAyB,EAAE,SAAS,aAAa,EAoItD,CAAC;AAwCF,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,mDA8FA;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,wBAAgB,iBAAiB,IAAI,SAAS,aAAa,EAAE,CAiB5D"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useT } from "@agent-native/core/client/i18n";
|
|
3
|
-
import { IconActivity, IconArrowUpRight, IconBrain, IconBrandTelegram, IconChartBar, IconFingerprint, IconHistory, IconKey, IconLayersSubtract, IconMail, IconMessages, IconPlugConnected, IconPuzzle, IconSettingsAutomation, IconShield, IconShieldCheck, } from "@tabler/icons-react";
|
|
3
|
+
import { IconActivity, IconArrowUpRight, IconBrain, IconBrandTelegram, IconChartBar, IconFingerprint, IconHistory, IconKey, IconLayersSubtract, IconMail, IconMessages, IconPlugConnected, IconPuzzle, IconSettingsAutomation, IconShield, IconShieldCheck, IconSearch, IconX, } from "@tabler/icons-react";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
4
5
|
import { NavLink } from "react-router";
|
|
5
6
|
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { DISPATCH_DOCS, DocsLink } from "./docs-link.js";
|
|
6
8
|
import { useDispatchExtensions } from "./layout/Layout.js";
|
|
7
9
|
const BUILT_IN_ADMIN_NAV_GROUPS = [
|
|
8
10
|
{
|
|
@@ -152,11 +154,25 @@ function AdminNavLink({ item, onNavigate, }) {
|
|
|
152
154
|
export function AdminShell({ children, onNavigate, }) {
|
|
153
155
|
const t = useT();
|
|
154
156
|
const groups = useAdminNavGroups();
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
const [query, setQuery] = useState("");
|
|
158
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
159
|
+
const visibleGroups = useMemo(() => groups
|
|
160
|
+
.map((group) => ({
|
|
161
|
+
...group,
|
|
162
|
+
items: group.items.filter((item) => {
|
|
163
|
+
if (!normalizedQuery)
|
|
164
|
+
return true;
|
|
165
|
+
const label = itemLabel(t, item).toLowerCase();
|
|
166
|
+
return `${label} ${group.label.toLowerCase()}`.includes(normalizedQuery);
|
|
167
|
+
}),
|
|
168
|
+
}))
|
|
169
|
+
.filter((group) => group.items.length > 0), [groups, normalizedQuery, t]);
|
|
170
|
+
return (_jsxs("div", { className: "grid min-w-0 gap-6 lg:grid-cols-[13rem_minmax(0,1fr)]", "data-dispatch-admin-shell": true, children: [_jsxs("aside", { className: "min-w-0 border-b pb-5 lg:sticky lg:top-2 lg:self-start lg:border-b-0", children: [_jsxs("div", { className: "flex items-center gap-1 px-2", children: [_jsxs("div", { className: "relative min-w-0 flex-1", children: [_jsx(IconSearch, { className: "pointer-events-none absolute start-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground" }), _jsx("input", { type: "search", value: query, onChange: (event) => setQuery(event.target.value), onKeyDown: (event) => {
|
|
171
|
+
if (event.key === "Escape")
|
|
172
|
+
setQuery("");
|
|
173
|
+
}, placeholder: "Search admin", "aria-label": "Search admin", className: "h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40" }), query ? (_jsx("button", { type: "button", onClick: () => setQuery(""), "aria-label": "Clear admin search", className: "absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground", children: _jsx(IconX, { className: "size-3.5" }) })) : null] }), _jsx(DocsLink, { href: DISPATCH_DOCS.dispatch, label: "Open Dispatch admin documentation" })] }), _jsxs("nav", { "aria-label": t("dispatch.pages.adminNavigation", {
|
|
158
174
|
defaultValue: "Admin navigation",
|
|
159
|
-
}), className: "mt-5 space-y-5", children:
|
|
175
|
+
}), className: "mt-5 space-y-5", children: [visibleGroups.map((group) => (_jsxs("section", { children: [_jsx("h2", { className: "px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70", children: t(group.labelKey, { defaultValue: group.label }) }), _jsx("ul", { className: "mt-1 space-y-0.5", children: group.items.map((item) => (_jsx(AdminNavLink, { item: item, onNavigate: onNavigate }, item.id))) })] }, group.id))), visibleGroups.length === 0 ? (_jsx("p", { className: "px-2 py-6 text-center text-xs text-muted-foreground", children: "No matching admin pages" })) : null] })] }), _jsx("section", { className: "min-w-0", "data-dispatch-admin-content": true, children: children })] }));
|
|
160
176
|
}
|
|
161
177
|
export { BUILT_IN_ADMIN_NAV_GROUPS };
|
|
162
178
|
export function useAdminNavGroups() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin-navigation.js","sourceRoot":"","sources":["../../src/components/admin-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,sBAAsB,EACtB,UAAU,EACV,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAwB,MAAM,iBAAiB,CAAC;AAS9E,MAAM,yBAAyB,GAA6B;IAC1D;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,WAAW;QAClB,QAAQ,EAAE,+BAA+B;QACzC,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,gBAAgB;gBACpB,EAAE,EAAE,QAAQ;gBACZ,KAAK,EAAE,UAAU;gBACjB,IAAI,EAAE,UAAU;aACjB;YACD;gBACE,EAAE,EAAE,iBAAiB;gBACrB,EAAE,EAAE,kBAAkB;gBACtB,KAAK,EAAE,WAAW;gBAClB,IAAI,EAAE,kBAAkB;aACzB;SACF;KACF;IACD;QACE,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,YAAY;QACnB,QAAQ,EAAE,gCAAgC;QAC1C,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,YAAY;gBAChB,EAAE,EAAE,mBAAmB;gB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E,EAAE,CAAC,CACzB,KAAC,YAAY,IAEX,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,IAFjB,IAAI,CAAC,EAAE,CAGZ,CACH,CAAC,GACC,KAZO,KAAK,CAAC,EAAE,CAaZ,CACX,CAAC,GACE,IACA,EAER,kBAAS,SAAS,EAAC,SAAS,iDACzB,QAAQ,GACD,IACN,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CACxD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,YAAY,CACxC,CAAC;IAEF,OAAO,cAAc,CAAC,MAAM;QAC1B,CAAC,CAAC;YACE,GAAG,yBAAyB;YAC5B;gBACE,EAAE,EAAE,sBAAsB;gBAC1B,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE,yCAAyC;gBACnD,KAAK,EAAE,cAAc;aACtB;SACF;QACH,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconActivity,\n IconArrowUpRight,\n IconBrain,\n IconBrandTelegram,\n IconChartBar,\n IconFingerprint,\n IconHistory,\n IconKey,\n IconLayersSubtract,\n IconMail,\n IconMessages,\n IconPlugConnected,\n IconPuzzle,\n IconSettingsAutomation,\n IconShield,\n IconShieldCheck,\n} from \"@tabler/icons-react\";\nimport { type ReactNode } from \"react\";\nimport { NavLink } from \"react-router\";\n\nimport { cn } from \"../lib/utils\";\nimport { useDispatchExtensions, type DispatchNavItem } from \"./layout/Layout\";\n\nexport interface AdminNavGroup {\n id: string;\n label: string;\n labelKey: string;\n items: readonly DispatchNavItem[];\n}\n\nconst BUILT_IN_ADMIN_NAV_GROUPS: readonly AdminNavGroup[] = [\n {\n id: \"workspace\",\n label: \"Workspace\",\n labelKey: \"dispatch.pages.adminWorkspace\",\n items: [\n {\n id: \"admin-overview\",\n to: \"/admin\",\n label: \"Overview\",\n icon: IconShield,\n },\n {\n id: \"admin-resources\",\n to: \"/admin/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n },\n ],\n },\n {\n id: \"operations\",\n label: \"Operations\",\n labelKey: \"dispatch.pages.adminOperations\",\n items: [\n {\n id: \"operations\",\n to: \"/admin/operations\",\n label: \"Operations\",\n icon: IconActivity,\n },\n {\n id: \"metrics\",\n to: \"/admin/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n },\n {\n id: \"audit\",\n to: \"/admin/audit\",\n label: \"Audit\",\n icon: IconHistory,\n },\n {\n id: \"thread-debug\",\n to: \"/admin/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n },\n ],\n },\n {\n id: \"automation\",\n label: \"Automation & delivery\",\n labelKey: \"dispatch.pages.adminAutomation\",\n items: [\n {\n id: \"automations\",\n to: \"/admin/automations\",\n label: \"Automations\",\n icon: IconSettingsAutomation,\n },\n {\n id: \"approvals\",\n to: \"/admin/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n },\n {\n id: \"destinations\",\n to: \"/admin/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n },\n {\n id: \"transactional-email\",\n to: \"/admin/transactional-email\",\n label: \"Transactional email\",\n icon: IconMail,\n },\n ],\n },\n {\n id: \"connections\",\n label: \"Connections\",\n labelKey: \"dispatch.pages.adminConnections\",\n items: [\n {\n id: \"integrations\",\n to: \"/admin/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n },\n {\n id: \"vault\",\n to: \"/admin/vault\",\n label: \"Vault\",\n icon: IconKey,\n },\n {\n id: \"messaging\",\n to: \"/admin/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n },\n {\n id: \"identities\",\n to: \"/admin/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n },\n ],\n },\n {\n id: \"agent-platform\",\n label: \"Agent platform\",\n labelKey: \"dispatch.pages.adminAgentPlatform\",\n items: [\n {\n id: \"agents\",\n to: \"/admin/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n },\n {\n id: \"dreams\",\n to: \"/admin/dreams\",\n label: \"Dreams\",\n icon: IconBrain,\n },\n ],\n },\n];\n\nfunction itemLabel(t: ReturnType<typeof useT>, item: DispatchNavItem) {\n return t(`dispatch.nav.${item.id}`, { defaultValue: item.label });\n}\n\nfunction AdminNavLink({\n item,\n onNavigate,\n}: {\n item: DispatchNavItem;\n onNavigate?: () => void;\n}) {\n const t = useT();\n const to = item.adminTo ?? item.to;\n const label = itemLabel(t, item);\n const Icon = item.icon;\n\n return (\n <li>\n <NavLink\n to={to}\n end={item.id === \"admin-overview\"}\n onClick={onNavigate}\n className={({ isActive }) =>\n cn(\n \"flex min-h-8 items-center gap-2 rounded-md px-2 text-sm transition-colors\",\n isActive\n ? \"bg-accent font-medium text-accent-foreground\"\n : \"text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n )\n }\n >\n {Icon ? <Icon size={15} className=\"shrink-0\" /> : null}\n <span className=\"truncate\">{label}</span>\n </NavLink>\n </li>\n );\n}\n\nexport function AdminShell({\n children,\n onNavigate,\n}: {\n children: ReactNode;\n onNavigate?: () => void;\n}) {\n const t = useT();\n const groups = useAdminNavGroups();\n\n return (\n <div\n className=\"grid min-w-0 gap-6 lg:grid-cols-[13rem_minmax(0,1fr)]\"\n data-dispatch-admin-shell\n >\n <aside className=\"min-w-0 border-b pb-5 lg:sticky lg:top-2 lg:self-start lg:border-b-0 lg:border-e lg:pe-6\">\n <div className=\"px-2\">\n <div className=\"text-[11px] font-medium uppercase tracking-wide text-muted-foreground\">\n {t(\"dispatch.nav.admin\", { defaultValue: \"Admin\" })}\n </div>\n <p className=\"mt-1 text-xs leading-5 text-muted-foreground\">\n {t(\"dispatch.pages.adminDescription\", {\n defaultValue: \"Workspace controls and operations\",\n })}\n </p>\n </div>\n\n <nav\n aria-label={t(\"dispatch.pages.adminNavigation\", {\n defaultValue: \"Admin navigation\",\n })}\n className=\"mt-5 space-y-5\"\n >\n {groups.map((group) => (\n <section key={group.id}>\n <h2 className=\"px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n {t(group.labelKey, { defaultValue: group.label })}\n </h2>\n <ul className=\"mt-1 space-y-0.5\">\n {group.items.map((item) => (\n <AdminNavLink\n key={item.id}\n item={item}\n onNavigate={onNavigate}\n />\n ))}\n </ul>\n </section>\n ))}\n </nav>\n </aside>\n\n <section className=\"min-w-0\" data-dispatch-admin-content>\n {children}\n </section>\n </div>\n );\n}\n\nexport { BUILT_IN_ADMIN_NAV_GROUPS };\n\nexport function useAdminNavGroups(): readonly AdminNavGroup[] {\n const extensions = useDispatchExtensions();\n const extensionItems = (extensions?.navItems ?? []).filter(\n (item) => item.section === \"operations\",\n );\n\n return extensionItems.length\n ? [\n ...BUILT_IN_ADMIN_NAV_GROUPS,\n {\n id: \"workspace-extensions\",\n label: \"Workspace extensions\",\n labelKey: \"dispatch.pages.adminWorkspaceExtensions\",\n items: extensionItems,\n },\n ]\n : BUILT_IN_ADMIN_NAV_GROUPS;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"admin-navigation.js","sourceRoot":"","sources":["../../src/components/admin-navigation.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,WAAW,EACX,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,UAAU,EACV,KAAK,GACN,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,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Q,GACD,IACN,CACP,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,yBAAyB,EAAE,CAAC;AAErC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,UAAU,GAAG,qBAAqB,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CACxD,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,YAAY,CACxC,CAAC;IAEF,OAAO,cAAc,CAAC,MAAM;QAC1B,CAAC,CAAC;YACE,GAAG,yBAAyB;YAC5B;gBACE,EAAE,EAAE,sBAAsB;gBAC1B,KAAK,EAAE,sBAAsB;gBAC7B,QAAQ,EAAE,yCAAyC;gBACnD,KAAK,EAAE,cAAc;aACtB;SACF;QACH,CAAC,CAAC,yBAAyB,CAAC;AAChC,CAAC","sourcesContent":["import { useT } from \"@agent-native/core/client/i18n\";\nimport {\n IconActivity,\n IconArrowUpRight,\n IconBrain,\n IconBrandTelegram,\n IconChartBar,\n IconFingerprint,\n IconHistory,\n IconKey,\n IconLayersSubtract,\n IconMail,\n IconMessages,\n IconPlugConnected,\n IconPuzzle,\n IconSettingsAutomation,\n IconShield,\n IconShieldCheck,\n IconSearch,\n IconX,\n} from \"@tabler/icons-react\";\nimport { useMemo, useState, type ReactNode } from \"react\";\nimport { NavLink } from \"react-router\";\n\nimport { cn } from \"../lib/utils\";\nimport { DISPATCH_DOCS, DocsLink } from \"./docs-link\";\nimport { useDispatchExtensions, type DispatchNavItem } from \"./layout/Layout\";\n\nexport interface AdminNavGroup {\n id: string;\n label: string;\n labelKey: string;\n items: readonly DispatchNavItem[];\n}\n\nconst BUILT_IN_ADMIN_NAV_GROUPS: readonly AdminNavGroup[] = [\n {\n id: \"workspace\",\n label: \"Workspace\",\n labelKey: \"dispatch.pages.adminWorkspace\",\n items: [\n {\n id: \"admin-overview\",\n to: \"/admin\",\n label: \"Overview\",\n icon: IconShield,\n },\n {\n id: \"admin-resources\",\n to: \"/admin/workspace\",\n label: \"Resources\",\n icon: IconLayersSubtract,\n },\n ],\n },\n {\n id: \"operations\",\n label: \"Operations\",\n labelKey: \"dispatch.pages.adminOperations\",\n items: [\n {\n id: \"operations\",\n to: \"/admin/operations\",\n label: \"Operations\",\n icon: IconActivity,\n },\n {\n id: \"metrics\",\n to: \"/admin/metrics\",\n label: \"Metrics\",\n icon: IconChartBar,\n },\n {\n id: \"audit\",\n to: \"/admin/audit\",\n label: \"Audit\",\n icon: IconHistory,\n },\n {\n id: \"thread-debug\",\n to: \"/admin/thread-debug\",\n label: \"Thread Debug\",\n icon: IconMessages,\n },\n ],\n },\n {\n id: \"automation\",\n label: \"Automation & delivery\",\n labelKey: \"dispatch.pages.adminAutomation\",\n items: [\n {\n id: \"automations\",\n to: \"/admin/automations\",\n label: \"Automations\",\n icon: IconSettingsAutomation,\n },\n {\n id: \"approvals\",\n to: \"/admin/approvals\",\n label: \"Approvals\",\n icon: IconShieldCheck,\n },\n {\n id: \"destinations\",\n to: \"/admin/destinations\",\n label: \"Destinations\",\n icon: IconArrowUpRight,\n },\n {\n id: \"transactional-email\",\n to: \"/admin/transactional-email\",\n label: \"Transactional email\",\n icon: IconMail,\n },\n ],\n },\n {\n id: \"connections\",\n label: \"Connections\",\n labelKey: \"dispatch.pages.adminConnections\",\n items: [\n {\n id: \"integrations\",\n to: \"/admin/integrations\",\n label: \"Integrations\",\n icon: IconPuzzle,\n },\n {\n id: \"vault\",\n to: \"/admin/vault\",\n label: \"Vault\",\n icon: IconKey,\n },\n {\n id: \"messaging\",\n to: \"/admin/messaging\",\n label: \"Messaging\",\n icon: IconBrandTelegram,\n },\n {\n id: \"identities\",\n to: \"/admin/identities\",\n label: \"Identities\",\n icon: IconFingerprint,\n },\n ],\n },\n {\n id: \"agent-platform\",\n label: \"Agent platform\",\n labelKey: \"dispatch.pages.adminAgentPlatform\",\n items: [\n {\n id: \"agents\",\n to: \"/admin/agents\",\n label: \"Agents\",\n icon: IconPlugConnected,\n },\n {\n id: \"dreams\",\n to: \"/admin/dreams\",\n label: \"Dreams\",\n icon: IconBrain,\n },\n ],\n },\n];\n\nfunction itemLabel(t: ReturnType<typeof useT>, item: DispatchNavItem) {\n return t(`dispatch.nav.${item.id}`, { defaultValue: item.label });\n}\n\nfunction AdminNavLink({\n item,\n onNavigate,\n}: {\n item: DispatchNavItem;\n onNavigate?: () => void;\n}) {\n const t = useT();\n const to = item.adminTo ?? item.to;\n const label = itemLabel(t, item);\n const Icon = item.icon;\n\n return (\n <li>\n <NavLink\n to={to}\n end={item.id === \"admin-overview\"}\n onClick={onNavigate}\n className={({ isActive }) =>\n cn(\n \"flex min-h-8 items-center gap-2 rounded-md px-2 text-sm transition-colors\",\n isActive\n ? \"bg-accent font-medium text-accent-foreground\"\n : \"text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n )\n }\n >\n {Icon ? <Icon size={15} className=\"shrink-0\" /> : null}\n <span className=\"truncate\">{label}</span>\n </NavLink>\n </li>\n );\n}\n\nexport function AdminShell({\n children,\n onNavigate,\n}: {\n children: ReactNode;\n onNavigate?: () => void;\n}) {\n const t = useT();\n const groups = useAdminNavGroups();\n const [query, setQuery] = useState(\"\");\n const normalizedQuery = query.trim().toLowerCase();\n const visibleGroups = useMemo(\n () =>\n groups\n .map((group) => ({\n ...group,\n items: group.items.filter((item) => {\n if (!normalizedQuery) return true;\n const label = itemLabel(t, item).toLowerCase();\n return `${label} ${group.label.toLowerCase()}`.includes(\n normalizedQuery,\n );\n }),\n }))\n .filter((group) => group.items.length > 0),\n [groups, normalizedQuery, t],\n );\n\n return (\n <div\n className=\"grid min-w-0 gap-6 lg:grid-cols-[13rem_minmax(0,1fr)]\"\n data-dispatch-admin-shell\n >\n <aside className=\"min-w-0 border-b pb-5 lg:sticky lg:top-2 lg:self-start lg:border-b-0\">\n <div className=\"flex items-center gap-1 px-2\">\n <div className=\"relative min-w-0 flex-1\">\n <IconSearch className=\"pointer-events-none absolute start-2.5 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n type=\"search\"\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") setQuery(\"\");\n }}\n placeholder=\"Search admin\"\n aria-label=\"Search admin\"\n className=\"h-8 w-full rounded-md border border-border bg-background ps-8 pe-7 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground focus:border-foreground/30 focus:ring-2 focus:ring-accent/40\"\n />\n {query ? (\n <button\n type=\"button\"\n onClick={() => setQuery(\"\")}\n aria-label=\"Clear admin search\"\n className=\"absolute end-1.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-muted-foreground hover:bg-accent/60 hover:text-foreground\"\n >\n <IconX className=\"size-3.5\" />\n </button>\n ) : null}\n </div>\n <DocsLink\n href={DISPATCH_DOCS.dispatch}\n label=\"Open Dispatch admin documentation\"\n />\n </div>\n\n <nav\n aria-label={t(\"dispatch.pages.adminNavigation\", {\n defaultValue: \"Admin navigation\",\n })}\n className=\"mt-5 space-y-5\"\n >\n {visibleGroups.map((group) => (\n <section key={group.id}>\n <h2 className=\"px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n {t(group.labelKey, { defaultValue: group.label })}\n </h2>\n <ul className=\"mt-1 space-y-0.5\">\n {group.items.map((item) => (\n <AdminNavLink\n key={item.id}\n item={item}\n onNavigate={onNavigate}\n />\n ))}\n </ul>\n </section>\n ))}\n {visibleGroups.length === 0 ? (\n <p className=\"px-2 py-6 text-center text-xs text-muted-foreground\">\n No matching admin pages\n </p>\n ) : null}\n </nav>\n </aside>\n\n <section className=\"min-w-0\" data-dispatch-admin-content>\n {children}\n </section>\n </div>\n );\n}\n\nexport { BUILT_IN_ADMIN_NAV_GROUPS };\n\nexport function useAdminNavGroups(): readonly AdminNavGroup[] {\n const extensions = useDispatchExtensions();\n const extensionItems = (extensions?.navItems ?? []).filter(\n (item) => item.section === \"operations\",\n );\n\n return extensionItems.length\n ? [\n ...BUILT_IN_ADMIN_NAV_GROUPS,\n {\n id: \"workspace-extensions\",\n label: \"Workspace extensions\",\n labelKey: \"dispatch.pages.adminWorkspaceExtensions\",\n items: extensionItems,\n },\n ]\n : BUILT_IN_ADMIN_NAV_GROUPS;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-panel.d.ts","sourceRoot":"","sources":["../../src/components/agents-panel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agents-panel.d.ts","sourceRoot":"","sources":["../../src/components/agents-panel.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAC;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAC/B;AA4CD,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,IAAI,CAAC;CACvB,mDA+SA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { agentNativePath } from "@agent-native/core/client/api-path";
|
|
3
|
+
import { useOrgRole } from "@agent-native/core/client/org";
|
|
3
4
|
import { IconExternalLink, IconTrash } from "@tabler/icons-react";
|
|
4
5
|
import { useRef, useState } from "react";
|
|
5
6
|
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "./ui/alert-dialog.js";
|
|
@@ -46,6 +47,10 @@ function validateAgentForm(name, url) {
|
|
|
46
47
|
return errors;
|
|
47
48
|
}
|
|
48
49
|
export function AgentsPanel({ agents, onRefresh, }) {
|
|
50
|
+
const { org, isLoading: orgLoading, error: orgError } = useOrgRole();
|
|
51
|
+
const canManageSharedAgents = !orgLoading &&
|
|
52
|
+
!orgError &&
|
|
53
|
+
(!org?.orgId || org.role === "owner" || org.role === "admin");
|
|
49
54
|
const [name, setName] = useState("");
|
|
50
55
|
const [url, setUrl] = useState("");
|
|
51
56
|
const [description, setDescription] = useState("");
|
|
@@ -117,12 +122,12 @@ export function AgentsPanel({ agents, onRefresh, }) {
|
|
|
117
122
|
if (res.ok)
|
|
118
123
|
onRefresh();
|
|
119
124
|
};
|
|
120
|
-
return (_jsx("section", { className: "rounded-2xl bg-card p-5", children: _jsxs("div", { className: "grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Available by default" }), _jsxs("div", { className: "mt-2 flex flex-wrap gap-2", children: [builtinAgents.map((agent) => (_jsxs("div", { className: "inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground", children: [_jsx("span", { className: "h-2 w-2 rounded-full", style: { backgroundColor: agent.color } }), _jsx("span", { children: agent.name })] }, agent.id))), builtinAgents.length === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "No default agents detected." }))] })] }), _jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Added in this workspace" }), _jsxs("div", { className: "mt-2 space-y-2", children: [workspaceAgents.map((agent) => (_jsx("div", { className: "flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3", children: _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: agent.name }), agent.description ? (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: agent.description })) : null, _jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: _jsxs("a", { href: agent.url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1 hover:text-foreground", children: [agent.url, _jsx(IconExternalLink, { className: "h-3 w-3" })] }) })] }) }, agent.id))), customAgents.map((agent) => (_jsxs("div", { className: "flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: agent.name }), agent.description ? (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: agent.description })) : null, _jsxs("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [_jsxs("a", { href: agent.url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1 hover:text-foreground", children: [agent.url, _jsx(IconExternalLink, { className: "h-3 w-3" })] }), _jsx("span", { children: "\u00B7" }), _jsx("span", { children: agent.scope || "shared" })] })] }), _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", children: _jsx(IconTrash, { className: "h-4 w-4" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Remove this agent?" }), _jsxs(AlertDialogDescription, { children: ["\u201C", agent.name, "\u201D will be removed from the workspace. Any jobs or chats that delegate to it will stop working."] })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Cancel" }), _jsx(AlertDialogAction, { onClick: () => handleDelete(agent.resourceId), children: "Remove" })] })] })] })] }, agent.id))), workspaceAgents.length === 0 && customAgents.length === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "No extra agents added yet." }))] })] })] }), _jsxs("div", { className: "rounded-xl border bg-muted/20 p-4", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Add external agent" }), _jsx("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: "Add another A2A-compatible app by saving its agent endpoint here." }), _jsxs("form", { className:
|
|
125
|
+
return (_jsx("section", { className: "rounded-2xl bg-card p-5", children: _jsxs("div", { className: "grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]", children: [_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Available by default" }), _jsxs("div", { className: "mt-2 flex flex-wrap gap-2", children: [builtinAgents.map((agent) => (_jsxs("div", { className: "inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground", children: [_jsx("span", { className: "h-2 w-2 rounded-full", style: { backgroundColor: agent.color } }), _jsx("span", { children: agent.name })] }, agent.id))), builtinAgents.length === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "No default agents detected." }))] })] }), _jsxs("div", { children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Added in this workspace" }), _jsxs("div", { className: "mt-2 space-y-2", children: [workspaceAgents.map((agent) => (_jsx("div", { className: "flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3", children: _jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: agent.name }), agent.description ? (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: agent.description })) : null, _jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: _jsxs("a", { href: agent.url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1 hover:text-foreground", children: [agent.url, _jsx(IconExternalLink, { className: "h-3 w-3" })] }) })] }) }, agent.id))), customAgents.map((agent) => (_jsxs("div", { className: "flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: agent.name }), agent.description ? (_jsx("div", { className: "mt-1 text-xs text-muted-foreground", children: agent.description })) : null, _jsxs("div", { className: "mt-1 flex items-center gap-2 text-xs text-muted-foreground", children: [_jsxs("a", { href: agent.url, target: "_blank", rel: "noreferrer", className: "inline-flex items-center gap-1 hover:text-foreground", children: [agent.url, _jsx(IconExternalLink, { className: "h-3 w-3" })] }), _jsx("span", { children: "\u00B7" }), _jsx("span", { children: agent.scope || "shared" })] })] }), canManageSharedAgents && (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", children: _jsx(IconTrash, { className: "h-4 w-4" }) }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Remove this agent?" }), _jsxs(AlertDialogDescription, { children: ["\u201C", agent.name, "\u201D will be removed from the workspace. Any jobs or chats that delegate to it will stop working."] })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Cancel" }), _jsx(AlertDialogAction, { onClick: () => handleDelete(agent.resourceId), children: "Remove" })] })] })] }))] }, agent.id))), workspaceAgents.length === 0 && customAgents.length === 0 && (_jsx("div", { className: "rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground", children: "No extra agents added yet." }))] })] })] }), _jsxs("div", { className: "rounded-xl border bg-muted/20 p-4", children: [_jsx("div", { className: "text-sm font-medium text-foreground", children: "Add external agent" }), canManageSharedAgents ? (_jsx("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: "Add another A2A-compatible app by saving its agent endpoint here." })) : !orgLoading ? (_jsx("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: "Only workspace owners and admins can add shared agents." })) : null, _jsxs("form", { className: `mt-4 space-y-3 ${canManageSharedAgents ? "" : "hidden"}`, onSubmit: handleAdd, noValidate: true, children: [_jsxs("div", { className: "space-y-1.5", children: [_jsx(Input, { ref: nameRef, value: name, onChange: (event) => {
|
|
121
126
|
setName(event.target.value);
|
|
122
127
|
setErrors((current) => ({ ...current, name: undefined }));
|
|
123
128
|
}, placeholder: "Name", "aria-invalid": Boolean(errors.name), "aria-describedby": errors.name ? "external-agent-name-error" : undefined }), errors.name ? (_jsx("p", { id: "external-agent-name-error", className: "text-xs font-medium text-destructive", children: errors.name })) : null] }), _jsxs("div", { className: "space-y-1.5", children: [_jsx(Input, { value: url, onChange: (event) => {
|
|
124
129
|
setUrl(event.target.value);
|
|
125
130
|
setErrors((current) => ({ ...current, url: undefined }));
|
|
126
|
-
}, placeholder: "https://app.example.com", "aria-invalid": Boolean(errors.url), "aria-describedby": errors.url ? "external-agent-url-error" : undefined }), errors.url ? (_jsx("p", { id: "external-agent-url-error", className: "text-xs font-medium text-destructive", children: errors.url })) : null] }), _jsx(Input, { value: description, onChange: (event) => setDescription(event.target.value), placeholder: "Description (optional)" }), errors.form ? (_jsx("p", { className: "text-xs font-medium text-destructive", children: errors.form })) : null, _jsx(Button, { type: "submit", className: "w-full", disabled: saving, children: saving ? "Saving..." : "Add agent" })] })] })] }) }));
|
|
131
|
+
}, placeholder: "https://app.example.com", "aria-invalid": Boolean(errors.url), "aria-describedby": errors.url ? "external-agent-url-error" : undefined }), errors.url ? (_jsx("p", { id: "external-agent-url-error", className: "text-xs font-medium text-destructive", children: errors.url })) : null] }), _jsx(Input, { value: description, onChange: (event) => setDescription(event.target.value), placeholder: "Description (optional)" }), errors.form ? (_jsx("p", { className: "text-xs font-medium text-destructive", children: errors.form })) : null, _jsx(Button, { type: "submit", className: "w-full", disabled: saving || !canManageSharedAgents, children: saving ? "Saving..." : "Add agent" })] })] })] }) }));
|
|
127
132
|
}
|
|
128
133
|
//# sourceMappingURL=agents-panel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents-panel.js","sourceRoot":"","sources":["../../src/components/agents-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,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CAAC,IAAI,CAAC,CAAC,CAAC,CACb,YAAG,SAAS,EAAC,sCAAsC,YAChD,MAAM,CAAC,IAAI,GACV,CACL,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,MAAM,YACtD,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAC5B,IACJ,IACH,IACF,GACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport { IconExternalLink, IconTrash } from \"@tabler/icons-react\";\nimport { useRef, useState, type FormEvent } from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"./ui/alert-dialog\";\nimport { Button } from \"./ui/button\";\nimport { Input } from \"./ui/input\";\n\nexport interface ConnectedAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n source: \"builtin\" | \"custom\" | \"workspace\";\n resourceId?: string;\n path?: string;\n scope?: \"shared\" | \"personal\";\n}\n\ntype AgentFormErrors = Partial<Record<\"name\" | \"url\" | \"form\", string>>;\n\nfunction slugifyAgentName(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nfunction validateAgentForm(name: string, url: string): AgentFormErrors {\n const errors: AgentFormErrors = {};\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n\n if (!trimmedName) {\n errors.name = \"Agent name is required.\";\n } else if (!slugifyAgentName(trimmedName)) {\n errors.name = \"Agent name must include at least one letter or number.\";\n }\n\n if (!trimmedUrl) {\n errors.url = \"Agent endpoint URL is required.\";\n } else {\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n errors.url = \"Use an http:// or https:// endpoint URL.\";\n } else if (!parsed.hostname) {\n errors.url = \"Enter a complete endpoint URL with a host.\";\n } else if (parsed.username || parsed.password) {\n errors.url = \"Do not include credentials in the endpoint URL.\";\n }\n } catch {\n errors.url =\n \"Enter a valid endpoint URL, such as https://app.example.com.\";\n }\n }\n\n return errors;\n}\n\nexport function AgentsPanel({\n agents,\n onRefresh,\n}: {\n agents: ConnectedAgent[];\n onRefresh: () => void;\n}) {\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [errors, setErrors] = useState<AgentFormErrors>({});\n const nameRef = useRef<HTMLInputElement>(null);\n\n const customAgents = agents.filter((agent) => agent.source === \"custom\");\n const workspaceAgents = agents.filter(\n (agent) => agent.source === \"workspace\",\n );\n const builtinAgents = agents.filter((agent) => agent.source === \"builtin\");\n\n const handleAdd = async (event?: FormEvent<HTMLFormElement>) => {\n event?.preventDefault();\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n const nextErrors = validateAgentForm(trimmedName, trimmedUrl);\n if (Object.keys(nextErrors).length > 0) {\n setErrors(nextErrors);\n return;\n }\n\n const id = slugifyAgentName(trimmedName);\n const agentJson = JSON.stringify(\n {\n id,\n name: trimmedName,\n description: description.trim() || undefined,\n url: trimmedUrl,\n color: \"#6B7280\",\n },\n null,\n 2,\n );\n\n setSaving(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/resources\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n path: `remote-agents/${id}.json`,\n content: agentJson,\n shared: true,\n }),\n });\n if (res.ok) {\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setErrors({});\n onRefresh();\n nameRef.current?.focus();\n } else {\n setErrors({\n form: `Could not add agent. Request failed with ${res.status}.`,\n });\n }\n } catch (error) {\n setErrors({\n form:\n error instanceof Error\n ? error.message\n : \"Could not add agent. Please try again.\",\n });\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (resourceId?: string) => {\n if (!resourceId) return;\n const res = await fetch(\n agentNativePath(`/_agent-native/resources/${resourceId}`),\n {\n method: \"DELETE\",\n },\n );\n if (res.ok) onRefresh();\n };\n\n return (\n <section className=\"rounded-2xl bg-card p-5\">\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"space-y-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Available by default\n </div>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {builtinAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground\"\n >\n <span\n className=\"h-2 w-2 rounded-full\"\n style={{ backgroundColor: agent.color }}\n />\n <span>{agent.name}</span>\n </div>\n ))}\n {builtinAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No default agents detected.\n </div>\n )}\n </div>\n </div>\n\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Added in this workspace\n </div>\n <div className=\"mt-2 space-y-2\">\n {workspaceAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n </div>\n </div>\n </div>\n ))}\n {customAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 flex items-center gap-2 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n <span>·</span>\n <span>{agent.scope || \"shared\"}</span>\n </div>\n </div>\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\">\n <IconTrash className=\"h-4 w-4\" />\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>Remove this agent?</AlertDialogTitle>\n <AlertDialogDescription>\n “{agent.name}” will be removed from the workspace. Any\n jobs or chats that delegate to it will stop working.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => handleDelete(agent.resourceId)}\n >\n Remove\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n </div>\n ))}\n {workspaceAgents.length === 0 && customAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No extra agents added yet.\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-muted/20 p-4\">\n <div className=\"text-sm font-medium text-foreground\">\n Add external agent\n </div>\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n Add another A2A-compatible app by saving its agent endpoint here.\n </p>\n <form className=\"mt-4 space-y-3\" onSubmit={handleAdd} noValidate>\n <div className=\"space-y-1.5\">\n <Input\n ref={nameRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n setErrors((current) => ({ ...current, name: undefined }));\n }}\n placeholder=\"Name\"\n aria-invalid={Boolean(errors.name)}\n aria-describedby={\n errors.name ? \"external-agent-name-error\" : undefined\n }\n />\n {errors.name ? (\n <p\n id=\"external-agent-name-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.name}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-1.5\">\n <Input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n setErrors((current) => ({ ...current, url: undefined }));\n }}\n placeholder=\"https://app.example.com\"\n aria-invalid={Boolean(errors.url)}\n aria-describedby={\n errors.url ? \"external-agent-url-error\" : undefined\n }\n />\n {errors.url ? (\n <p\n id=\"external-agent-url-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.url}\n </p>\n ) : null}\n </div>\n <Input\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n placeholder=\"Description (optional)\"\n />\n {errors.form ? (\n <p className=\"text-xs font-medium text-destructive\">\n {errors.form}\n </p>\n ) : null}\n <Button type=\"submit\" className=\"w-full\" disabled={saving}>\n {saving ? \"Saving...\" : \"Add agent\"}\n </Button>\n </form>\n </div>\n </div>\n </section>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"agents-panel.js","sourceRoot":"","sources":["../../src/components/agents-panel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAEzD,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;A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AC,sCAAsC,YAE/C,MAAM,CAAC,GAAG,GACT,CACL,CAAC,CAAC,CAAC,IAAI,IACJ,EACN,KAAC,KAAK,IACJ,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACvD,WAAW,EAAC,wBAAwB,GACpC,EACD,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CACb,YAAG,SAAS,EAAC,sCAAsC,YAChD,MAAM,CAAC,IAAI,GACV,CACL,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,QAAQ,EAClB,QAAQ,EAAE,MAAM,IAAI,CAAC,qBAAqB,YAEzC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,GAC5B,IACJ,IACH,IACF,GACE,CACX,CAAC;AACJ,CAAC","sourcesContent":["import { agentNativePath } from \"@agent-native/core/client/api-path\";\nimport { useOrgRole } from \"@agent-native/core/client/org\";\nimport { IconExternalLink, IconTrash } from \"@tabler/icons-react\";\nimport { useRef, useState, type FormEvent } from \"react\";\n\nimport {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n AlertDialogTrigger,\n} from \"./ui/alert-dialog\";\nimport { Button } from \"./ui/button\";\nimport { Input } from \"./ui/input\";\n\nexport interface ConnectedAgent {\n id: string;\n name: string;\n description: string;\n url: string;\n color: string;\n source: \"builtin\" | \"custom\" | \"workspace\";\n resourceId?: string;\n path?: string;\n scope?: \"shared\" | \"personal\";\n}\n\ntype AgentFormErrors = Partial<Record<\"name\" | \"url\" | \"form\", string>>;\n\nfunction slugifyAgentName(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\n\nfunction validateAgentForm(name: string, url: string): AgentFormErrors {\n const errors: AgentFormErrors = {};\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n\n if (!trimmedName) {\n errors.name = \"Agent name is required.\";\n } else if (!slugifyAgentName(trimmedName)) {\n errors.name = \"Agent name must include at least one letter or number.\";\n }\n\n if (!trimmedUrl) {\n errors.url = \"Agent endpoint URL is required.\";\n } else {\n try {\n const parsed = new URL(trimmedUrl);\n if (parsed.protocol !== \"https:\" && parsed.protocol !== \"http:\") {\n errors.url = \"Use an http:// or https:// endpoint URL.\";\n } else if (!parsed.hostname) {\n errors.url = \"Enter a complete endpoint URL with a host.\";\n } else if (parsed.username || parsed.password) {\n errors.url = \"Do not include credentials in the endpoint URL.\";\n }\n } catch {\n errors.url =\n \"Enter a valid endpoint URL, such as https://app.example.com.\";\n }\n }\n\n return errors;\n}\n\nexport function AgentsPanel({\n agents,\n onRefresh,\n}: {\n agents: ConnectedAgent[];\n onRefresh: () => void;\n}) {\n const { org, isLoading: orgLoading, error: orgError } = useOrgRole();\n const canManageSharedAgents =\n !orgLoading &&\n !orgError &&\n (!org?.orgId || org.role === \"owner\" || org.role === \"admin\");\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [saving, setSaving] = useState(false);\n const [errors, setErrors] = useState<AgentFormErrors>({});\n const nameRef = useRef<HTMLInputElement>(null);\n\n const customAgents = agents.filter((agent) => agent.source === \"custom\");\n const workspaceAgents = agents.filter(\n (agent) => agent.source === \"workspace\",\n );\n const builtinAgents = agents.filter((agent) => agent.source === \"builtin\");\n\n const handleAdd = async (event?: FormEvent<HTMLFormElement>) => {\n event?.preventDefault();\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n const nextErrors = validateAgentForm(trimmedName, trimmedUrl);\n if (Object.keys(nextErrors).length > 0) {\n setErrors(nextErrors);\n return;\n }\n\n const id = slugifyAgentName(trimmedName);\n const agentJson = JSON.stringify(\n {\n id,\n name: trimmedName,\n description: description.trim() || undefined,\n url: trimmedUrl,\n color: \"#6B7280\",\n },\n null,\n 2,\n );\n\n setSaving(true);\n try {\n const res = await fetch(agentNativePath(\"/_agent-native/resources\"), {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({\n path: `remote-agents/${id}.json`,\n content: agentJson,\n shared: true,\n }),\n });\n if (res.ok) {\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setErrors({});\n onRefresh();\n nameRef.current?.focus();\n } else {\n setErrors({\n form: `Could not add agent. Request failed with ${res.status}.`,\n });\n }\n } catch (error) {\n setErrors({\n form:\n error instanceof Error\n ? error.message\n : \"Could not add agent. Please try again.\",\n });\n } finally {\n setSaving(false);\n }\n };\n\n const handleDelete = async (resourceId?: string) => {\n if (!resourceId) return;\n const res = await fetch(\n agentNativePath(`/_agent-native/resources/${resourceId}`),\n {\n method: \"DELETE\",\n },\n );\n if (res.ok) onRefresh();\n };\n\n return (\n <section className=\"rounded-2xl bg-card p-5\">\n <div className=\"grid gap-4 xl:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"space-y-4\">\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Available by default\n </div>\n <div className=\"mt-2 flex flex-wrap gap-2\">\n {builtinAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"inline-flex items-center gap-2 rounded-full border px-3 py-1.5 text-xs text-muted-foreground\"\n >\n <span\n className=\"h-2 w-2 rounded-full\"\n style={{ backgroundColor: agent.color }}\n />\n <span>{agent.name}</span>\n </div>\n ))}\n {builtinAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No default agents detected.\n </div>\n )}\n </div>\n </div>\n\n <div>\n <div className=\"text-sm font-medium text-foreground\">\n Added in this workspace\n </div>\n <div className=\"mt-2 space-y-2\">\n {workspaceAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n </div>\n </div>\n </div>\n ))}\n {customAgents.map((agent) => (\n <div\n key={agent.id}\n className=\"flex items-start justify-between gap-3 rounded-xl border bg-muted/30 px-4 py-3\"\n >\n <div className=\"min-w-0\">\n <div className=\"text-sm font-medium text-foreground\">\n {agent.name}\n </div>\n {agent.description ? (\n <div className=\"mt-1 text-xs text-muted-foreground\">\n {agent.description}\n </div>\n ) : null}\n <div className=\"mt-1 flex items-center gap-2 text-xs text-muted-foreground\">\n <a\n href={agent.url}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-1 hover:text-foreground\"\n >\n {agent.url}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n <span>·</span>\n <span>{agent.scope || \"shared\"}</span>\n </div>\n </div>\n {canManageSharedAgents && (\n <AlertDialog>\n <AlertDialogTrigger asChild>\n <Button variant=\"ghost\" size=\"icon\">\n <IconTrash className=\"h-4 w-4\" />\n </Button>\n </AlertDialogTrigger>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>\n Remove this agent?\n </AlertDialogTitle>\n <AlertDialogDescription>\n “{agent.name}” will be removed from the workspace.\n Any jobs or chats that delegate to it will stop\n working.\n </AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>Cancel</AlertDialogCancel>\n <AlertDialogAction\n onClick={() => handleDelete(agent.resourceId)}\n >\n Remove\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n )}\n </div>\n ))}\n {workspaceAgents.length === 0 && customAgents.length === 0 && (\n <div className=\"rounded-xl border border-dashed px-4 py-6 text-sm text-muted-foreground\">\n No extra agents added yet.\n </div>\n )}\n </div>\n </div>\n </div>\n\n <div className=\"rounded-xl border bg-muted/20 p-4\">\n <div className=\"text-sm font-medium text-foreground\">\n Add external agent\n </div>\n {canManageSharedAgents ? (\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n Add another A2A-compatible app by saving its agent endpoint here.\n </p>\n ) : !orgLoading ? (\n <p className=\"mt-1 text-xs leading-relaxed text-muted-foreground\">\n Only workspace owners and admins can add shared agents.\n </p>\n ) : null}\n <form\n className={`mt-4 space-y-3 ${canManageSharedAgents ? \"\" : \"hidden\"}`}\n onSubmit={handleAdd}\n noValidate\n >\n <div className=\"space-y-1.5\">\n <Input\n ref={nameRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n setErrors((current) => ({ ...current, name: undefined }));\n }}\n placeholder=\"Name\"\n aria-invalid={Boolean(errors.name)}\n aria-describedby={\n errors.name ? \"external-agent-name-error\" : undefined\n }\n />\n {errors.name ? (\n <p\n id=\"external-agent-name-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.name}\n </p>\n ) : null}\n </div>\n <div className=\"space-y-1.5\">\n <Input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n setErrors((current) => ({ ...current, url: undefined }));\n }}\n placeholder=\"https://app.example.com\"\n aria-invalid={Boolean(errors.url)}\n aria-describedby={\n errors.url ? \"external-agent-url-error\" : undefined\n }\n />\n {errors.url ? (\n <p\n id=\"external-agent-url-error\"\n className=\"text-xs font-medium text-destructive\"\n >\n {errors.url}\n </p>\n ) : null}\n </div>\n <Input\n value={description}\n onChange={(event) => setDescription(event.target.value)}\n placeholder=\"Description (optional)\"\n />\n {errors.form ? (\n <p className=\"text-xs font-medium text-destructive\">\n {errors.form}\n </p>\n ) : null}\n <Button\n type=\"submit\"\n className=\"w-full\"\n disabled={saving || !canManageSharedAgents}\n >\n {saving ? \"Saving...\" : \"Add agent\"}\n </Button>\n </form>\n </div>\n </div>\n </section>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
export declare const APP_LIST_GRID_CLASS = "
|
|
2
|
+
export declare const APP_LIST_GRID_CLASS = "w-full xl:grid xl:grid-cols-2 xl:gap-3";
|
|
3
3
|
export declare const APP_LIST_GRID_ROW_CLASS = "xl:rounded-2xl xl:border xl:border-transparent xl:bg-card xl:transition-[background-color,border-color] xl:hover:border-border xl:focus-within:border-ring/50";
|
|
4
4
|
export declare function AppList({ children, className, }: {
|
|
5
5
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-list-row.d.ts","sourceRoot":"","sources":["../../src/components/app-list-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"app-list-row.d.ts","sourceRoot":"","sources":["../../src/components/app-list-row.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,eAAO,MAAM,mBAAmB,2CAA2C,CAAC;AAC5E,eAAO,MAAM,uBAAuB,kKAC6H,CAAC;AAElK,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,mDAMA;AAED,wBAAgB,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,GACV,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,mDAWA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
-
export const APP_LIST_GRID_CLASS = "
|
|
3
|
+
export const APP_LIST_GRID_CLASS = "w-full xl:grid xl:grid-cols-2 xl:gap-3";
|
|
4
4
|
export const APP_LIST_GRID_ROW_CLASS = "xl:rounded-2xl xl:border xl:border-transparent xl:bg-card xl:transition-[background-color,border-color] xl:hover:border-border xl:focus-within:border-ring/50";
|
|
5
5
|
export function AppList({ children, className, }) {
|
|
6
6
|
return (_jsx("div", { className: cn("overflow-hidden rounded-2xl bg-card", className), children: children }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-list-row.js","sourceRoot":"","sources":["../../src/components/app-list-row.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"app-list-row.js","sourceRoot":"","sources":["../../src/components/app-list-row.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC,MAAM,CAAC,MAAM,mBAAmB,GAAG,wCAAwC,CAAC;AAC5E,MAAM,CAAC,MAAM,uBAAuB,GAClC,+JAA+J,CAAC;AAElK,MAAM,UAAU,OAAO,CAAC,EACtB,QAAQ,EACR,SAAS,GAIV;IACC,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,qCAAqC,EAAE,SAAS,CAAC,YACjE,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,EACzB,QAAQ,EACR,SAAS,GAIV;IACC,OAAO,CACL,cACE,SAAS,EAAE,EAAE,CACX,kKAAkK,EAClK,SAAS,CACV,YAEA,QAAQ,GACL,CACP,CAAC;AACJ,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\n\nimport { cn } from \"../lib/utils\";\n\nexport const APP_LIST_GRID_CLASS = \"w-full xl:grid xl:grid-cols-2 xl:gap-3\";\nexport const APP_LIST_GRID_ROW_CLASS =\n \"xl:rounded-2xl xl:border xl:border-transparent xl:bg-card xl:transition-[background-color,border-color] xl:hover:border-border xl:focus-within:border-ring/50\";\n\nexport function AppList({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div className={cn(\"overflow-hidden rounded-2xl bg-card\", className)}>\n {children}\n </div>\n );\n}\n\nexport function AppListRow({\n children,\n className,\n}: {\n children: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n \"group flex min-w-0 items-center gap-3 border-b px-4 py-3.5 last:border-b-0 transition-[background-color,border-color] hover:bg-muted/30 focus-within:bg-muted/30\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"]}
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
addApp: string;
|
|
3
|
-
openApp: string;
|
|
4
|
-
openInline: string;
|
|
5
|
-
openInNewTab: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function AppOpenActions({ name, href, target, rel, labels: labelOverrides, onAddApp, onOpenInline, showInlineOption, showNewTabOption, }: {
|
|
8
|
-
name: string;
|
|
9
|
-
href: string | null;
|
|
10
|
-
target?: "_blank";
|
|
11
|
-
rel?: string;
|
|
12
|
-
labels?: Partial<AppOpenActionLabels>;
|
|
13
|
-
onAddApp?: () => void;
|
|
14
|
-
onOpenInline?: () => void;
|
|
15
|
-
showInlineOption?: boolean;
|
|
16
|
-
showNewTabOption?: boolean;
|
|
17
|
-
}): import("node_modules/@types/react").JSX.Element;
|
|
1
|
+
export { AppOpenActions, type AppOpenActionLabels, type AppOpenActionMenuItem, } from "@agent-native/core/client/chat-first";
|
|
18
2
|
//# sourceMappingURL=app-open-actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-open-actions.d.ts","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-open-actions.d.ts","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,GAC3B,MAAM,sCAAsC,CAAC"}
|
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { IconChevronDown, IconPlus } from "@tabler/icons-react";
|
|
3
|
-
import { Button } from "./ui/button.js";
|
|
4
|
-
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
|
|
5
|
-
const DEFAULT_LABELS = {
|
|
6
|
-
addApp: "Add app",
|
|
7
|
-
openApp: "Open app",
|
|
8
|
-
openInline: "Open inline",
|
|
9
|
-
openInNewTab: "Open in new tab",
|
|
10
|
-
};
|
|
11
|
-
export function AppOpenActions({ name, href, target, rel, labels: labelOverrides, onAddApp, onOpenInline, showInlineOption = false, showNewTabOption = false, }) {
|
|
12
|
-
const labels = { ...DEFAULT_LABELS, ...labelOverrides };
|
|
13
|
-
const canOfferNewTab = showNewTabOption && target !== "_blank";
|
|
14
|
-
const hasMenu = Boolean(onAddApp) ||
|
|
15
|
-
(Boolean(href) && (showInlineOption || canOfferNewTab));
|
|
16
|
-
if (!href && !hasMenu) {
|
|
17
|
-
return (_jsx(Button, { size: "sm", variant: "outline", disabled: true, children: labels.openApp }));
|
|
18
|
-
}
|
|
19
|
-
return (_jsxs("div", { className: "flex shrink-0 overflow-hidden rounded-md border border-border focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2", children: [_jsx(Button, { asChild: Boolean(href), size: "sm", variant: "outline", className: "rounded-none border-0 border-e border-border", disabled: !href, children: href ? (_jsx("a", { href: href, target: target, rel: rel, children: labels.openApp })) : (_jsx("span", { children: labels.openApp })) }), hasMenu ? (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", size: "sm", variant: "outline", className: "size-9 rounded-none border-0 p-0", "aria-label": `Open options for ${name}`, children: _jsx(IconChevronDown, { size: 15 }) }) }), _jsxs(DropdownMenuContent, { align: "end", className: "min-w-40", children: [onAddApp ? (_jsxs(DropdownMenuItem, { onSelect: onAddApp, children: [_jsx(IconPlus, { size: 14, className: "mr-2" }), labels.addApp] })) : null, showInlineOption && href ? (_jsx(DropdownMenuItem, { onSelect: onOpenInline, children: labels.openInline })) : null, canOfferNewTab && href ? (_jsx(DropdownMenuItem, { asChild: true, children: _jsx("a", { href: href, target: "_blank", rel: "noreferrer", children: labels.openInNewTab }) })) : null] })] })) : null] }));
|
|
20
|
-
}
|
|
1
|
+
export { AppOpenActions, } from "@agent-native/core/client/chat-first";
|
|
21
2
|
//# sourceMappingURL=app-open-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-open-actions.js","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"app-open-actions.js","sourceRoot":"","sources":["../../src/components/app-open-actions.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,GAGf,MAAM,sCAAsC,CAAC","sourcesContent":["export {\n AppOpenActions,\n type AppOpenActionLabels,\n type AppOpenActionMenuItem,\n} from \"@agent-native/core/client/chat-first\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-row-settings.d.ts","sourceRoot":"","sources":["../../src/components/app-row-settings.tsx"],"names":[],"mappings":"AAeA,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,WAAuB,EACvB,QAAQ,GACT,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,mDA8BA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { APP_ACTION_MENU_CONTENT_CLASS } from "@agent-native/core/client/chat-first";
|
|
3
|
+
import { IconPlus, IconSettings } from "@tabler/icons-react";
|
|
4
|
+
import { Button } from "./ui/button.js";
|
|
5
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger, } from "./ui/dropdown-menu.js";
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip.js";
|
|
7
|
+
const APP_ROW_ACTION_CLASS = "size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground";
|
|
8
|
+
export function AppRowSettings({ name, addAppLabel = "Add app", onAddApp, }) {
|
|
9
|
+
return (_jsxs(DropdownMenu, { children: [_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { type: "button", variant: "ghost", size: "sm", "aria-label": `Settings for ${name}`, className: APP_ROW_ACTION_CLASS, children: _jsx(IconSettings, { size: 15 }) }) }) }), _jsx(TooltipContent, { children: "App settings" })] }), _jsx(DropdownMenuContent, { align: "end", className: APP_ACTION_MENU_CONTENT_CLASS, children: _jsxs(DropdownMenuItem, { onSelect: onAddApp, children: [_jsx(IconPlus, { size: 14, "aria-hidden": "true" }), addAppLabel] }) })] }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=app-row-settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-row-settings.js","sourceRoot":"","sources":["../../src/components/app-row-settings.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,6BAA6B,EAAE,MAAM,sCAAsC,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEvE,MAAM,oBAAoB,GACxB,6PAA6P,CAAC;AAEhQ,MAAM,UAAU,cAAc,CAAC,EAC7B,IAAI,EACJ,WAAW,GAAG,SAAS,EACvB,QAAQ,GAKT;IACC,OAAO,CACL,MAAC,YAAY,eACX,MAAC,OAAO,eACN,KAAC,cAAc,IAAC,OAAO,kBACrB,KAAC,mBAAmB,IAAC,OAAO,kBAC1B,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,IAAI,gBACG,gBAAgB,IAAI,EAAE,EAClC,SAAS,EAAE,oBAAoB,YAE/B,KAAC,YAAY,IAAC,IAAI,EAAE,EAAE,GAAI,GACnB,GACW,GACP,EACjB,KAAC,cAAc,+BAA8B,IACrC,EACV,KAAC,mBAAmB,IAClB,KAAK,EAAC,KAAK,EACX,SAAS,EAAE,6BAA6B,YAExC,MAAC,gBAAgB,IAAC,QAAQ,EAAE,QAAQ,aAClC,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,EACxC,WAAW,IACK,GACC,IACT,CAChB,CAAC;AACJ,CAAC","sourcesContent":["import { APP_ACTION_MENU_CONTENT_CLASS } from \"@agent-native/core/client/chat-first\";\nimport { IconPlus, IconSettings } from \"@tabler/icons-react\";\n\nimport { Button } from \"./ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuTrigger,\n} from \"./ui/dropdown-menu\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\n\nconst APP_ROW_ACTION_CLASS =\n \"size-7 rounded-md p-0 text-muted-foreground transition-[background-color,color] hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-foreground\";\n\nexport function AppRowSettings({\n name,\n addAppLabel = \"Add app\",\n onAddApp,\n}: {\n name: string;\n addAppLabel?: string;\n onAddApp: () => void;\n}) {\n return (\n <DropdownMenu>\n <Tooltip>\n <TooltipTrigger asChild>\n <DropdownMenuTrigger asChild>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n aria-label={`Settings for ${name}`}\n className={APP_ROW_ACTION_CLASS}\n >\n <IconSettings size={15} />\n </Button>\n </DropdownMenuTrigger>\n </TooltipTrigger>\n <TooltipContent>App settings</TooltipContent>\n </Tooltip>\n <DropdownMenuContent\n align=\"end\"\n className={APP_ACTION_MENU_CONTENT_CLASS}\n >\n <DropdownMenuItem onSelect={onAddApp}>\n <IconPlus size={14} aria-hidden=\"true\" />\n {addAppLabel}\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automation-run-history-dialog.d.ts","sourceRoot":"","sources":["../../src/components/automation-run-history-dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"automation-run-history-dialog.d.ts","sourceRoot":"","sources":["../../src/components/automation-run-history-dialog.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAsBjE,UAAU,+BAA+B;IACvC,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAgCD,wBAAgB,0BAA0B,CAAC,EACzC,UAAU,EACV,IAAI,EACJ,YAAY,GACb,EAAE,+BAA+B,mDA4KjC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useActionQuery } from "@agent-native/core/client/hooks";
|
|
3
|
-
import { IconAlertTriangle, IconClock, IconExternalLink,
|
|
3
|
+
import { IconAlertTriangle, IconClock, IconExternalLink, } from "@tabler/icons-react";
|
|
4
4
|
import { Link } from "react-router";
|
|
5
5
|
import { automationScopeLabel, automationTarget, } from "../lib/automation-display.js";
|
|
6
6
|
import { ActionQueryError } from "./action-query-error.js";
|
|
7
7
|
import { Badge } from "./ui/badge.js";
|
|
8
8
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "./ui/dialog.js";
|
|
9
|
+
import { Skeleton } from "./ui/skeleton.js";
|
|
9
10
|
function runStatusVariant(status) {
|
|
10
11
|
if (status === "error")
|
|
11
12
|
return "destructive";
|
|
@@ -53,7 +54,7 @@ export function AutomationRunHistoryDialog({ automation, open, onOpenChange, })
|
|
|
53
54
|
: "Execution history" })] }), automation ? (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3 rounded-lg border bg-muted/20 p-3 text-sm", children: [_jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Status" }), _jsx("div", { className: "mt-1 font-medium", children: automation.lastStatus ??
|
|
54
55
|
(automation.enabled ? "ready" : "paused") })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Last check" }), _jsx("div", { className: "mt-1 font-medium", children: automation.lastCheck
|
|
55
56
|
? formatTimestamp(new Date(automation.lastCheck).getTime())
|
|
56
|
-
: "Not recorded" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Created by" }), _jsx("div", { className: "mt-1 break-words font-medium", children: automation.createdBy ?? "Unknown" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Timezone" }), _jsx("div", { className: "mt-1 font-medium", children: automation.timezone ?? "Account default" })] })] }), automation.lastError ? (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3", children: [_jsx(IconAlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-destructive", children: "Latest scheduler result" }), _jsx("p", { className: "mt-1 break-words text-sm text-muted-foreground", children: automation.lastError })] })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Past runs" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Only executions that actually started appear here. Blocked or skipped scheduler checks are shown above, not as fake runs." })] }), runs.length > 0 ? (_jsxs(Badge, { variant: "outline", children: [runs.length, " shown"] })) : null] }), _jsx("div", { className: "mt-3", children: runsQuery.isLoading ? (
|
|
57
|
+
: "Not recorded" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Created by" }), _jsx("div", { className: "mt-1 break-words font-medium", children: automation.createdBy ?? "Unknown" })] }), _jsxs("div", { children: [_jsx("div", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: "Timezone" }), _jsx("div", { className: "mt-1 font-medium", children: automation.timezone ?? "Account default" })] })] }), automation.lastError ? (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3", children: [_jsx(IconAlertTriangle, { className: "mt-0.5 size-4 shrink-0 text-destructive" }), _jsxs("div", { className: "min-w-0", children: [_jsx("p", { className: "text-sm font-medium text-destructive", children: "Latest scheduler result" }), _jsx("p", { className: "mt-1 break-words text-sm text-muted-foreground", children: automation.lastError })] })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-semibold text-foreground", children: "Past runs" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Only executions that actually started appear here. Blocked or skipped scheduler checks are shown above, not as fake runs." })] }), runs.length > 0 ? (_jsxs(Badge, { variant: "outline", children: [runs.length, " shown"] })) : null] }), _jsx("div", { className: "mt-3", children: runsQuery.isLoading ? (_jsx("div", { className: "space-y-3 rounded-lg border p-4", children: Array.from({ length: 3 }).map((_, index) => (_jsxs("div", { className: "space-y-2", children: [_jsx(Skeleton, { className: "h-4 w-2/3" }), _jsx(Skeleton, { className: "h-3 w-1/2" })] }, index))) })) : runsQuery.isError ? (_jsx(ActionQueryError, { error: runsQuery.error, onRetry: () => void runsQuery.refetch() })) : runs.length === 0 ? (_jsx("div", { className: "rounded-lg border border-dashed p-4 text-sm text-muted-foreground", children: "This automation has not recorded an execution yet. If it is enabled but shows no runs, inspect the latest scheduler result and last check above." })) : (_jsx("ul", { className: "divide-y rounded-lg border", children: runs.map((run) => {
|
|
57
58
|
const debugPath = runDebugPath(run);
|
|
58
59
|
const duration = formatDuration(run);
|
|
59
60
|
return (_jsxs("li", { className: "space-y-2 p-3", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2 text-sm", children: [_jsx(Badge, { variant: runStatusVariant(run.status), children: run.status }), _jsx("span", { className: "text-muted-foreground", children: formatTimestamp(run.startedAt) }), duration ? (_jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [_jsx(IconClock, { className: "size-3.5" }), duration] })) : null, debugPath ? (_jsxs(Link, { to: debugPath, className: "ml-auto inline-flex items-center gap-1 text-xs font-medium text-foreground underline-offset-4 hover:underline", children: [_jsx(IconExternalLink, { className: "size-3.5" }), "Open debug"] })) : null] }), run.error ? (_jsx("p", { className: "break-words text-sm text-destructive", children: run.error })) : null] }, run.id));
|