@lunora/studio 1.0.0-alpha.5 → 1.0.0-alpha.50
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/LICENSE.md +6 -0
- package/__assets__/package-og.svg +1 -1
- package/dist/index.d.ts +45 -23
- package/dist/index.js +31 -31
- package/dist/mount.d.ts +1 -1
- package/dist/mount.js +3 -2
- package/dist/{packem_shared/ApiTab-W3no0KOj.js → packem_chunks/ApiTab.js} +5 -5
- package/dist/{packem_shared/AuditPanel-Bq4o_IqT.js → packem_chunks/AuditPanel.js} +29 -41
- package/dist/{packem_shared/ExportImportPanel-dxY56TDF.js → packem_chunks/ExportImportPanel.js} +16 -11
- package/dist/{packem_shared/FileBrowser-Dhy4zES8.js → packem_chunks/FileBrowser.js} +55 -32
- package/dist/{packem_shared/FunctionRunner--fQJRPAD.js → packem_chunks/FunctionRunner.js} +15 -32
- package/dist/{packem_shared/FunctionStatsPanel-BjRUA_G3.js → packem_chunks/FunctionStatsPanel.js} +153 -208
- package/dist/{packem_shared/HealthPanel-PxclMWmA.js → packem_chunks/HealthPanel.js} +37 -29
- package/dist/{packem_shared/InsightsPanel-CWS_C-xW.js → packem_chunks/InsightsPanel.js} +108 -69
- package/dist/{packem_shared/LogsPanel-CTW8CFcM.js → packem_chunks/LogsPanel.js} +46 -58
- package/dist/{packem_shared/MailPanel-BwkvfIHF.js → packem_chunks/MailPanel.js} +45 -139
- package/dist/{packem_shared/MetricsPanel-BLuOhZQ4.js → packem_chunks/MetricsPanel.js} +41 -322
- package/dist/{packem_shared/MigrationsPanel-DT3lnwHF.js → packem_chunks/MigrationsPanel.js} +44 -51
- package/dist/{packem_shared/PitrPanel-CdErL7EJ.js → packem_chunks/PitrPanel.js} +9 -9
- package/dist/{packem_shared/SchemaViewer-LJDcmNIO.js → packem_chunks/SchemaViewer.js} +17 -16
- package/dist/{packem_shared/SecurityAdvisorPanel-C_ETsPih.js → packem_chunks/SecurityAdvisorPanel.js} +47 -31
- package/dist/packem_chunks/SettingsPanel.js +391 -0
- package/dist/{packem_shared/sql-editor-panel-BFRpzj6r.js → packem_chunks/SqlEditorPanel.js} +159 -387
- package/dist/{packem_shared/TableEditor-ChfUOZec.js → packem_chunks/TableEditor.js} +13 -94
- package/dist/packem_chunks/agents-panel.js +326 -0
- package/dist/packem_chunks/analytics-panel.js +261 -0
- package/dist/packem_chunks/auth-config-panel.js +365 -0
- package/dist/packem_chunks/auth-sessions-panel.js +175 -0
- package/dist/packem_chunks/containers-panel.js +261 -0
- package/dist/packem_chunks/dashboards-panel.js +781 -0
- package/dist/packem_chunks/fanout-panel.js +482 -0
- package/dist/packem_chunks/flags-panel.js +176 -0
- package/dist/packem_chunks/issues-panel.js +188 -0
- package/dist/packem_chunks/kv-browser.js +1896 -0
- package/dist/packem_chunks/log-drains-panel.js +273 -0
- package/dist/packem_chunks/organizations-panel.js +3178 -0
- package/dist/packem_chunks/payments-panel.js +186 -0
- package/dist/packem_chunks/permissions-panel.js +805 -0
- package/dist/packem_chunks/queues-panel.js +1075 -0
- package/dist/packem_chunks/rls-panel.js +315 -0
- package/dist/packem_chunks/schedule-panel.js +831 -0
- package/dist/packem_chunks/sparkline.js +79 -0
- package/dist/packem_chunks/storage-rules-panel.js +140 -0
- package/dist/packem_chunks/subscriptions-panel.js +238 -0
- package/dist/packem_chunks/users-panel.js +1731 -0
- package/dist/packem_chunks/vector-browser.js +281 -0
- package/dist/packem_chunks/workflows-panel.js +562 -0
- package/dist/packem_shared/{ADMIN_FUNCTIONS-DmBqMZ-z.js → ADMIN_FUNCTIONS-DNeyYtUN.js} +8 -0
- package/dist/packem_shared/{ApiDocsPanel-C5-yJ1p7.js → ApiDocsPanel-_aEZxAMX.js} +2 -2
- package/dist/packem_shared/{ApiReferencePanel-1vubqG5s.js → ApiReferencePanel-Dd8pcswz.js} +2 -1
- package/dist/packem_shared/{CommandPalette-BtgkBzZI.js → CommandPalette-BXV4eKf5.js} +1 -1
- package/dist/packem_shared/{DataBrowser-CtBe1So9.js → DataBrowser-C8hejnub.js} +201 -250
- package/dist/packem_shared/{DataFilters-FNquMaiu.js → DataFilters-B1Q7mrt7.js} +6 -2
- package/dist/packem_shared/{GlobalDataBrowser-BTEmGrph.js → GlobalDataBrowser-CxJxRRf2.js} +37 -66
- package/dist/packem_shared/HomePanel-Ye8PaqQL.js +14 -0
- package/dist/packem_shared/{OpenRpcReferencePanel-vbcYbv3V.js → OpenRpcReferencePanel-CWaf0ZtX.js} +2 -1
- package/dist/packem_shared/{ScheduledJobs-CabfKbyM.js → ScheduledJobs-dHMgnJbx.js} +163 -60
- package/dist/packem_shared/{ShardInput-gx_DZXXn.js → ShardInput-CZnpHILL.js} +1 -1
- package/dist/packem_shared/Studio-xJLTlLpf.js +16 -0
- package/dist/packem_shared/{StudioApp-D4azxYBu.js → StudioApp-oCQholCL.js} +6 -21
- package/dist/packem_shared/{advisor-view-CGcfMiPq.js → advisor-view-Cx21PS_T.js} +6 -6
- package/dist/packem_shared/alert-CdAET2K_.js +68 -0
- package/dist/packem_shared/{app.d-CCmwDEVs.d.ts → app.d-CGdOmLTm.d.ts} +1 -1
- package/dist/packem_shared/{bar-chart-CzJAgqkp.js → bar-chart-DSwcWIRy.js} +5 -4
- package/dist/packem_shared/browser-storage-L4gOP5gJ.js +105 -0
- package/dist/packem_shared/{cf-links-2cktDedA.js → cf-links-BZfRdxSE.js} +1 -1
- package/dist/packem_shared/{data-grid-B5CaV3wS.js → data-grid-C9I16KWr.js} +1 -1
- package/dist/packem_shared/data-view-params-Cd6yRVbv.js +96 -0
- package/dist/packem_shared/error-alert-vIPQoN3Y.js +114 -0
- package/dist/packem_shared/{grid-features-CzUfqgsM.js → grid-features-B_fZH4iQ.js} +133 -164
- package/dist/packem_shared/home-panel-D62G8108.js +1889 -0
- package/dist/packem_shared/internal-zwBoOv24.js +122 -0
- package/dist/packem_shared/modal-shell-hyaJvIJ6.js +100 -0
- package/dist/packem_shared/{reference-view-B4E49Lip.js → reference-view-DUULLuOi.js} +8 -61
- package/dist/packem_shared/result-chart-DZradBAS.js +119 -0
- package/dist/packem_shared/scroll-area-DLhcy-ml.js +93 -0
- package/dist/packem_shared/select-UkNYCT3s.js +273 -0
- package/dist/packem_shared/shard-history-AxiJ1WPP.js +16 -0
- package/dist/packem_shared/skeleton-CGhL0p20.js +45 -0
- package/dist/packem_shared/{sparkline-10dG-_f0.js → sparkline-BnA1kC9X.js} +1 -1
- package/dist/packem_shared/studio-WZUOecDv.js +4069 -0
- package/dist/packem_shared/{table-_RzNvy3R.js → table-DsCa9Qp9.js} +1 -1
- package/dist/packem_shared/{table-list-sidebar-Bg7uzbvC.js → table-list-sidebar-huX4VmgI.js} +19 -9
- package/dist/packem_shared/use-admin-query-BGJ010yZ.js +106 -0
- package/dist/packem_shared/use-async-submit-DGCtuDyz.js +91 -0
- package/dist/standalone/chunk-22C6COGE.js +13 -0
- package/dist/standalone/chunk-2CCWLKQW.js +1 -0
- package/dist/standalone/chunk-2JTPX3CV.js +1 -0
- package/dist/standalone/chunk-2K47A3P6.js +1 -0
- package/dist/standalone/chunk-2MLA6WFH.js +1 -0
- package/dist/standalone/chunk-2NGUNNGW.js +1 -0
- package/dist/standalone/chunk-3CPQ5IQU.js +1 -0
- package/dist/standalone/chunk-3GXGLNKW.js +1 -0
- package/dist/standalone/chunk-3OA7PECS.js +6 -0
- package/dist/standalone/chunk-4AXW2ECS.js +13 -0
- package/dist/standalone/chunk-4BVRLBEW.js +1 -0
- package/dist/standalone/chunk-4PC7IXNY.js +1 -0
- package/dist/standalone/chunk-4QHKBC77.js +1 -0
- package/dist/standalone/chunk-5OIBXYZM.js +1 -0
- package/dist/standalone/chunk-5OZQHQ26.js +1 -0
- package/dist/standalone/chunk-6RREMPQX.js +2 -0
- package/dist/standalone/chunk-6ZBU3JWR.js +3 -0
- package/dist/standalone/chunk-7LDYSHOU.js +1 -0
- package/dist/standalone/chunk-7TJJXVSE.js +1 -0
- package/dist/standalone/chunk-A2DBMISD.js +1 -0
- package/dist/standalone/chunk-A3ZJACVT.js +4 -0
- package/dist/standalone/chunk-A66LI6OV.js +4 -0
- package/dist/standalone/chunk-AHILM3ZP.js +1 -0
- package/dist/standalone/chunk-AITOCPML.js +1 -0
- package/dist/standalone/chunk-APSSZB6Z.js +1 -0
- package/dist/standalone/chunk-BGG56IF5.js +1 -0
- package/dist/standalone/chunk-BJGBHGK3.js +1 -0
- package/dist/standalone/chunk-CJXJIRSN.js +1 -0
- package/dist/standalone/chunk-CKSHCYGC.js +2 -0
- package/dist/standalone/chunk-DR6LGPXE.js +1 -0
- package/dist/standalone/chunk-DWDILV2E.js +1 -0
- package/dist/standalone/chunk-EEWKIQUE.js +1 -0
- package/dist/standalone/chunk-EOE5NDMK.js +1 -0
- package/dist/standalone/chunk-FAUN4Z72.js +1 -0
- package/dist/standalone/chunk-G7ZBM54M.js +1 -0
- package/dist/standalone/chunk-GTM65MVX.js +1 -0
- package/dist/standalone/chunk-HAJSYWFT.js +8 -0
- package/dist/standalone/chunk-HQM6MBPS.js +1 -0
- package/dist/standalone/chunk-HTQNZXDT.js +1 -0
- package/dist/standalone/chunk-HV7G6DFP.js +5 -0
- package/dist/standalone/chunk-IO2XEI6T.js +1 -0
- package/dist/standalone/chunk-ITQKVEP7.js +19 -0
- package/dist/standalone/chunk-IZN4TYMN.js +1 -0
- package/dist/standalone/chunk-J6J54MBP.js +1 -0
- package/dist/standalone/chunk-JM7XBQVK.js +1 -0
- package/dist/standalone/chunk-JPILGFXT.js +1 -0
- package/dist/standalone/chunk-JSEXCW5Q.js +1 -0
- package/dist/standalone/chunk-JUDPYSJZ.js +1 -0
- package/dist/standalone/chunk-K4S652EQ.js +4 -0
- package/dist/standalone/chunk-KEGAWN6Y.js +1 -0
- package/dist/standalone/chunk-KJFFID72.js +1 -0
- package/dist/standalone/chunk-KJJ3WM6H.js +4 -0
- package/dist/standalone/chunk-KZ6INM5M.js +1 -0
- package/dist/standalone/chunk-L7SK4ZZD.js +1 -0
- package/dist/standalone/chunk-LAK5VSPI.js +1 -0
- package/dist/standalone/chunk-LJAAZNQ6.js +1 -0
- package/dist/standalone/chunk-LUP4YTBS.js +1 -0
- package/dist/standalone/chunk-LX7KONE3.js +1 -0
- package/dist/standalone/chunk-MDTNVR3G.js +1 -0
- package/dist/standalone/chunk-NS23QR4W.js +1 -0
- package/dist/standalone/chunk-NW6SZZ5O.js +1 -0
- package/dist/standalone/chunk-O3NAGRTR.js +1 -0
- package/dist/standalone/chunk-P2ERTKMB.js +1 -0
- package/dist/standalone/chunk-PS3XCCZD.js +1 -0
- package/dist/standalone/chunk-QAFAJBAW.js +1 -0
- package/dist/standalone/chunk-RRCPZMC2.js +22 -0
- package/dist/standalone/chunk-RS7S7XVP.js +1 -0
- package/dist/standalone/chunk-S5NTGHCG.js +1 -0
- package/dist/standalone/chunk-S7AB7Y75.js +1 -0
- package/dist/standalone/chunk-SDMZKBTD.js +1 -0
- package/dist/standalone/chunk-SDQE2IUJ.js +1 -0
- package/dist/standalone/chunk-SEU5V7I6.js +1 -0
- package/dist/standalone/chunk-SHERR7ZP.js +1 -0
- package/dist/standalone/chunk-SHJUAHC6.js +1 -0
- package/dist/standalone/chunk-TAD43CG5.js +1 -0
- package/dist/standalone/chunk-TO6D2PJC.js +6 -0
- package/dist/standalone/chunk-TQ36RWOP.js +1 -0
- package/dist/standalone/chunk-TYN6SQ73.js +1 -0
- package/dist/standalone/chunk-U26QNHMO.js +1 -0
- package/dist/standalone/chunk-UK64ZSUW.js +1 -0
- package/dist/standalone/chunk-UTHHHJYS.js +1 -0
- package/dist/standalone/chunk-V43BLH4J.js +1 -0
- package/dist/standalone/chunk-VL23Y44O.js +4 -0
- package/dist/standalone/chunk-VL6HOZHF.js +1 -0
- package/dist/standalone/chunk-VLXV72QE.js +1 -0
- package/dist/standalone/chunk-W666BB6V.js +1 -0
- package/dist/standalone/chunk-W6JKUZKD.js +1 -0
- package/dist/standalone/chunk-WI7GWFEG.js +1 -0
- package/dist/standalone/chunk-WUFVFVHJ.js +1 -0
- package/dist/standalone/chunk-WVTPZ6CM.js +1 -0
- package/dist/standalone/chunk-X2TQRMQV.js +1 -0
- package/dist/standalone/chunk-X4676IX6.js +1 -0
- package/dist/standalone/chunk-X4QFAAZ5.js +76 -0
- package/dist/standalone/chunk-XJU5SRNL.js +4 -0
- package/dist/standalone/chunk-XNJNSCLM.js +1 -0
- package/dist/standalone/chunk-XWPZBZSZ.js +3 -0
- package/dist/standalone/chunk-YLHDKM2P.js +1 -0
- package/dist/standalone/chunk-ZHVTQ37P.js +1 -0
- package/dist/standalone/chunk-ZIGWVHCS.js +1 -0
- package/dist/standalone/chunk-ZPP2KOR4.js +1 -0
- package/dist/standalone/chunk-ZPUO7FNI.js +1 -0
- package/dist/standalone/studio.js +104 -246
- package/dist/styles.css +2 -2
- package/package.json +17 -15
- package/dist/packem_shared/HomePanel-Cw16stjq.js +0 -1273
- package/dist/packem_shared/SettingsPanel-C0uLRf5P.js +0 -176
- package/dist/packem_shared/SqlEditorPanel-CguV7otm.js +0 -13
- package/dist/packem_shared/Studio-BmSGSIuY.js +0 -33
- package/dist/packem_shared/internal-rXJEAhXS.js +0 -68
- package/dist/packem_shared/shard-history-DyebH1R5.js +0 -38
- package/dist/packem_shared/studio-H9fuQgSj.js +0 -10303
- package/dist/packem_shared/use-live-admin-Dq6g3daN.js +0 -73
- package/dist/packem_shared/use-live-shard-seed-Cuk3dnH0.js +0 -76
|
@@ -2,104 +2,21 @@ import { c } from 'react/compiler-runtime';
|
|
|
2
2
|
import { useLunora } from '@lunora/react';
|
|
3
3
|
import { useNavigate, useRouter, useSearch } from '@tanstack/react-router';
|
|
4
4
|
import { useRef, useState, useEffect } from 'react';
|
|
5
|
-
import { T as TIER_META } from '
|
|
6
|
-
import { useT } from '
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { T as TIER_META } from '../packem_shared/storage-tier-CL98eOvn.js';
|
|
6
|
+
import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
7
|
+
import { s as searchToDataView, d as dataViewToSearch } from '../packem_shared/data-view-params-Cd6yRVbv.js';
|
|
8
|
+
import { f as fireAndForget } from '../packem_shared/internal-zwBoOv24.js';
|
|
9
|
+
import { l as loadJsonArray, s as saveJson } from '../packem_shared/browser-storage-L4gOP5gJ.js';
|
|
10
|
+
import { DataBrowser } from '../packem_shared/DataBrowser-C8hejnub.js';
|
|
11
|
+
import { GlobalDataBrowser } from '../packem_shared/GlobalDataBrowser-CxJxRRf2.js';
|
|
10
12
|
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
11
13
|
|
|
12
|
-
const VALID_OPERATORS = /* @__PURE__ */ new Set(["contains", "eq", "gt", "gte", "lt", "lte", "ne"]);
|
|
13
|
-
const isFilterClause = (entry) => {
|
|
14
|
-
if (entry === null || typeof entry !== "object") {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
const candidate = entry;
|
|
18
|
-
return typeof candidate.column === "string" && typeof candidate.operator === "string" && VALID_OPERATORS.has(candidate.operator);
|
|
19
|
-
};
|
|
20
|
-
const parseFilters = (raw) => {
|
|
21
|
-
if (typeof raw !== "string" || raw === "") {
|
|
22
|
-
return [];
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const parsed = JSON.parse(raw);
|
|
26
|
-
return Array.isArray(parsed) ? parsed.filter(isFilterClause) : [];
|
|
27
|
-
} catch {
|
|
28
|
-
return [];
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const parseOrder = (raw) => {
|
|
32
|
-
if (typeof raw !== "string" || raw === "") {
|
|
33
|
-
return void 0;
|
|
34
|
-
}
|
|
35
|
-
const separator = raw.lastIndexOf(":");
|
|
36
|
-
if (separator <= 0) {
|
|
37
|
-
return void 0;
|
|
38
|
-
}
|
|
39
|
-
const column = raw.slice(0, separator);
|
|
40
|
-
const direction = raw.slice(separator + 1);
|
|
41
|
-
if (direction !== "asc" && direction !== "desc") {
|
|
42
|
-
return void 0;
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
column,
|
|
46
|
-
direction
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
const searchToDataView = (search) => {
|
|
50
|
-
const filters = parseFilters(search["filters"]);
|
|
51
|
-
const orderBy = parseOrder(search["order"]);
|
|
52
|
-
return {
|
|
53
|
-
filters: filters.length > 0 ? filters : void 0,
|
|
54
|
-
orderBy,
|
|
55
|
-
search: typeof search["search"] === "string" && search["search"] !== "" ? search["search"] : void 0,
|
|
56
|
-
shard: typeof search["shard"] === "string" && search["shard"] !== "" ? search["shard"] : void 0,
|
|
57
|
-
table: typeof search["table"] === "string" && search["table"] !== "" ? search["table"] : void 0,
|
|
58
|
-
tier: search["schema"] === "global" ? "global" : "shard"
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
const dataViewToSearch = (view) => {
|
|
62
|
-
const filters = view.filters ?? [];
|
|
63
|
-
return {
|
|
64
|
-
filters: filters.length > 0 ? JSON.stringify(filters) : void 0,
|
|
65
|
-
order: view.orderBy === void 0 ? void 0 : `${view.orderBy.column}:${view.orderBy.direction}`,
|
|
66
|
-
schema: view.tier === "global" ? "global" : void 0,
|
|
67
|
-
search: view.search !== void 0 && view.search !== "" ? view.search : void 0,
|
|
68
|
-
shard: view.shard !== void 0 && view.shard !== "" ? view.shard : void 0,
|
|
69
|
-
table: view.table !== void 0 && view.table !== "" ? view.table : void 0
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
|
|
73
14
|
const STORAGE_KEY = "lunora-studio-saved-queries";
|
|
74
15
|
const MAX_SAVED = 50;
|
|
75
|
-
const store = () => {
|
|
76
|
-
try {
|
|
77
|
-
return globalThis.localStorage;
|
|
78
|
-
} catch {
|
|
79
|
-
return void 0;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
16
|
const isSavedQuery = (entry) => entry !== null && typeof entry === "object" && typeof entry.name === "string" && typeof entry.view === "object" && entry.view !== null;
|
|
83
|
-
const loadSavedQueries = () =>
|
|
84
|
-
try {
|
|
85
|
-
const raw = store()?.getItem(STORAGE_KEY);
|
|
86
|
-
if (raw === null || raw === void 0) {
|
|
87
|
-
return [];
|
|
88
|
-
}
|
|
89
|
-
const parsed = JSON.parse(raw);
|
|
90
|
-
return Array.isArray(parsed) ? parsed.filter(isSavedQuery) : [];
|
|
91
|
-
} catch {
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
};
|
|
17
|
+
const loadSavedQueries = () => loadJsonArray(STORAGE_KEY).filter(isSavedQuery);
|
|
95
18
|
const persist = (queries) => {
|
|
96
|
-
|
|
97
|
-
if (storage !== void 0) {
|
|
98
|
-
try {
|
|
99
|
-
storage.setItem(STORAGE_KEY, JSON.stringify(queries));
|
|
100
|
-
} catch {
|
|
101
|
-
}
|
|
102
|
-
}
|
|
19
|
+
saveJson(STORAGE_KEY, queries);
|
|
103
20
|
};
|
|
104
21
|
const saveQuery = (name, view) => {
|
|
105
22
|
const trimmed = name.trim();
|
|
@@ -260,14 +177,16 @@ const TableEditor = ({
|
|
|
260
177
|
to: "/data"
|
|
261
178
|
}));
|
|
262
179
|
};
|
|
263
|
-
const onSelectTable = (table_0) => {
|
|
180
|
+
const onSelectTable = (table_0, options) => {
|
|
264
181
|
if (!onDataRoute()) {
|
|
265
182
|
return;
|
|
266
183
|
}
|
|
267
184
|
fireAndForget(navigate({
|
|
268
185
|
search: (previous_1) => {
|
|
269
186
|
return {
|
|
270
|
-
|
|
187
|
+
schema: previous_1["schema"],
|
|
188
|
+
search: options?.search,
|
|
189
|
+
shard: previous_1["shard"],
|
|
271
190
|
table: table_0
|
|
272
191
|
};
|
|
273
192
|
},
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { E as ErrorAlert } from '../packem_shared/error-alert-vIPQoN3Y.js';
|
|
3
|
+
import { B as Badge } from '../packem_shared/badge-B2PKA1-5.js';
|
|
4
|
+
import { B as Button } from '../packem_shared/button-BhsN2uZH.js';
|
|
5
|
+
import { C as Card, a as CardContent } from '../packem_shared/card-DURq3ElK.js';
|
|
6
|
+
import { E as EmptyState } from '../packem_shared/empty-state-DY_oe0k6.js';
|
|
7
|
+
import { T as Table, a as TableHeader, b as TableRow, c as TableHead, d as TableBody, e as TableCell } from '../packem_shared/table-DsCa9Qp9.js';
|
|
8
|
+
import { u as useAdminQuery } from '../packem_shared/use-admin-query-BGJ010yZ.js';
|
|
9
|
+
import { useT } from '../packem_shared/DEFAULT_LOCALE-CiX4W7Kr.js';
|
|
10
|
+
import { ADMIN_FUNCTIONS } from '../packem_shared/ADMIN_FUNCTIONS-DNeyYtUN.js';
|
|
11
|
+
import { i as formatTimestamp } from '../packem_shared/internal-zwBoOv24.js';
|
|
12
|
+
import { jsxDEV } from 'react/jsx-dev-runtime';
|
|
13
|
+
|
|
14
|
+
const THREADS_TABLE = "agent_threads";
|
|
15
|
+
const MESSAGES_TABLE = "agent_messages";
|
|
16
|
+
const THREAD_LIMIT = 100;
|
|
17
|
+
const MESSAGE_LIMIT = 250;
|
|
18
|
+
const NO_ARGS = {};
|
|
19
|
+
const THREADS_ARGS = {
|
|
20
|
+
filters: [],
|
|
21
|
+
limit: THREAD_LIMIT,
|
|
22
|
+
offset: 0,
|
|
23
|
+
orderBy: {
|
|
24
|
+
column: "updatedAt",
|
|
25
|
+
direction: "desc"
|
|
26
|
+
},
|
|
27
|
+
skipCount: true,
|
|
28
|
+
table: THREADS_TABLE
|
|
29
|
+
};
|
|
30
|
+
const readString = (row, key) => {
|
|
31
|
+
const value = row[key];
|
|
32
|
+
return typeof value === "string" ? value : void 0;
|
|
33
|
+
};
|
|
34
|
+
const readNumber = (row, key) => {
|
|
35
|
+
const value = row[key];
|
|
36
|
+
return typeof value === "number" ? value : void 0;
|
|
37
|
+
};
|
|
38
|
+
const readTotalTokens = (row) => {
|
|
39
|
+
const {
|
|
40
|
+
usage
|
|
41
|
+
} = row;
|
|
42
|
+
if (usage === null || typeof usage !== "object") {
|
|
43
|
+
return void 0;
|
|
44
|
+
}
|
|
45
|
+
const {
|
|
46
|
+
totalTokens
|
|
47
|
+
} = usage;
|
|
48
|
+
return typeof totalTokens === "number" ? totalTokens : void 0;
|
|
49
|
+
};
|
|
50
|
+
const readToolNames = (row) => {
|
|
51
|
+
const {
|
|
52
|
+
toolCalls
|
|
53
|
+
} = row;
|
|
54
|
+
if (!Array.isArray(toolCalls)) {
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
return toolCalls.map((call) => call !== null && typeof call === "object" ? call.name : void 0).filter((name) => typeof name === "string");
|
|
58
|
+
};
|
|
59
|
+
const threadStatusVariant = (status) => {
|
|
60
|
+
switch (status) {
|
|
61
|
+
case "awaiting_input": {
|
|
62
|
+
return "warning";
|
|
63
|
+
}
|
|
64
|
+
case "cancelled": {
|
|
65
|
+
return "warning";
|
|
66
|
+
}
|
|
67
|
+
case "error": {
|
|
68
|
+
return "destructive";
|
|
69
|
+
}
|
|
70
|
+
case "running": {
|
|
71
|
+
return "info";
|
|
72
|
+
}
|
|
73
|
+
default: {
|
|
74
|
+
return "outline";
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const approvalVariant = (status) => {
|
|
79
|
+
switch (status) {
|
|
80
|
+
case "approved": {
|
|
81
|
+
return "success";
|
|
82
|
+
}
|
|
83
|
+
case "rejected": {
|
|
84
|
+
return "destructive";
|
|
85
|
+
}
|
|
86
|
+
default: {
|
|
87
|
+
return "warning";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const AgentsPanel = ({
|
|
92
|
+
initialShardKey = ""
|
|
93
|
+
}) => {
|
|
94
|
+
const t = useT();
|
|
95
|
+
const [selectedKey, setSelectedKey] = useState(void 0);
|
|
96
|
+
const {
|
|
97
|
+
data: tables
|
|
98
|
+
} = useAdminQuery(ADMIN_FUNCTIONS.listTables, NO_ARGS, {
|
|
99
|
+
live: true,
|
|
100
|
+
shardKey: initialShardKey
|
|
101
|
+
});
|
|
102
|
+
const loadedTables = tables !== void 0;
|
|
103
|
+
const hasAgentTables = Array.isArray(tables) && tables.some((table) => table.name === THREADS_TABLE);
|
|
104
|
+
const {
|
|
105
|
+
data: threadsPage,
|
|
106
|
+
error: threadsError,
|
|
107
|
+
errorSource: threadsErrorSource,
|
|
108
|
+
liveError: threadsLiveError
|
|
109
|
+
} = useAdminQuery(ADMIN_FUNCTIONS.readTablePage, THREADS_ARGS, {
|
|
110
|
+
enabled: hasAgentTables,
|
|
111
|
+
live: true,
|
|
112
|
+
shardKey: initialShardKey
|
|
113
|
+
});
|
|
114
|
+
const messagesArgs = {
|
|
115
|
+
filters: [{
|
|
116
|
+
column: "threadKey",
|
|
117
|
+
operator: "eq",
|
|
118
|
+
value: selectedKey ?? ""
|
|
119
|
+
}],
|
|
120
|
+
limit: MESSAGE_LIMIT,
|
|
121
|
+
offset: 0,
|
|
122
|
+
orderBy: {
|
|
123
|
+
column: "seq",
|
|
124
|
+
direction: "asc"
|
|
125
|
+
},
|
|
126
|
+
skipCount: true,
|
|
127
|
+
table: MESSAGES_TABLE
|
|
128
|
+
};
|
|
129
|
+
const {
|
|
130
|
+
data: messagesPage,
|
|
131
|
+
error: messagesError,
|
|
132
|
+
errorSource: messagesErrorSource
|
|
133
|
+
} = useAdminQuery(ADMIN_FUNCTIONS.readTablePage, messagesArgs, {
|
|
134
|
+
enabled: hasAgentTables && selectedKey !== void 0,
|
|
135
|
+
live: true,
|
|
136
|
+
shardKey: initialShardKey
|
|
137
|
+
});
|
|
138
|
+
const threads = Array.isArray(threadsPage?.rows) ? threadsPage.rows : [];
|
|
139
|
+
const messages = Array.isArray(messagesPage?.rows) ? messagesPage.rows : [];
|
|
140
|
+
const selectedThread = threads.find((row) => readString(row, "key") === selectedKey);
|
|
141
|
+
let body;
|
|
142
|
+
if (loadedTables && !hasAgentTables) {
|
|
143
|
+
body = /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
144
|
+
description: t("No @lunora/agent tables found in this deployment. Add lunora/agents.ts with defineAgent(...) and merge the agent schema extension to run durable AI agents."),
|
|
145
|
+
testId: "agents-unconfigured",
|
|
146
|
+
title: t("No agents configured")
|
|
147
|
+
}, void 0, false);
|
|
148
|
+
} else if (hasAgentTables && threads.length === 0) {
|
|
149
|
+
body = /* @__PURE__ */ jsxDEV(EmptyState, {
|
|
150
|
+
description: t("No agent has run yet. Start a run with ctx.agents.<name>.run(...) and its thread appears here."),
|
|
151
|
+
testId: "agents-empty",
|
|
152
|
+
title: t("No agent threads yet")
|
|
153
|
+
}, void 0, false);
|
|
154
|
+
} else {
|
|
155
|
+
body = /* @__PURE__ */ jsxDEV("div", {
|
|
156
|
+
className: "flex flex-col gap-6",
|
|
157
|
+
children: [/* @__PURE__ */ jsxDEV(Card, {
|
|
158
|
+
className: "overflow-hidden py-0",
|
|
159
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
160
|
+
className: "px-0",
|
|
161
|
+
children: /* @__PURE__ */ jsxDEV(Table, {
|
|
162
|
+
"data-testid": "agents-threads-table",
|
|
163
|
+
children: [/* @__PURE__ */ jsxDEV(TableHeader, {
|
|
164
|
+
children: /* @__PURE__ */ jsxDEV(TableRow, {
|
|
165
|
+
children: [/* @__PURE__ */ jsxDEV(TableHead, {
|
|
166
|
+
children: t("Agent")
|
|
167
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
168
|
+
children: t("Key")
|
|
169
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
170
|
+
children: t("Status")
|
|
171
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
172
|
+
children: t("Messages")
|
|
173
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
174
|
+
children: t("Tokens")
|
|
175
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
176
|
+
children: t("Updated")
|
|
177
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
178
|
+
"aria-label": t("Actions")
|
|
179
|
+
}, void 0, false)]
|
|
180
|
+
}, void 0, true)
|
|
181
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
|
|
182
|
+
children: threads.map((row_0) => {
|
|
183
|
+
const key = readString(row_0, "key") ?? "";
|
|
184
|
+
const status = readString(row_0, "status");
|
|
185
|
+
const totalTokens = readTotalTokens(row_0);
|
|
186
|
+
return /* @__PURE__ */ jsxDEV(TableRow, {
|
|
187
|
+
"data-active": key === selectedKey ? "" : void 0,
|
|
188
|
+
"data-testid": `agents-thread-${key}`,
|
|
189
|
+
children: [/* @__PURE__ */ jsxDEV(TableCell, {
|
|
190
|
+
className: "font-mono text-xs",
|
|
191
|
+
children: readString(row_0, "agent") ?? "—"
|
|
192
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
193
|
+
className: "font-mono text-xs text-muted-foreground",
|
|
194
|
+
children: key
|
|
195
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
196
|
+
children: /* @__PURE__ */ jsxDEV(Badge, {
|
|
197
|
+
"data-testid": `agents-thread-status-${key}`,
|
|
198
|
+
variant: threadStatusVariant(status),
|
|
199
|
+
children: status ?? "—"
|
|
200
|
+
}, void 0, false)
|
|
201
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
202
|
+
className: "tabular-nums",
|
|
203
|
+
children: readNumber(row_0, "messageCount") ?? "—"
|
|
204
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
205
|
+
className: "tabular-nums text-muted-foreground",
|
|
206
|
+
children: totalTokens ?? "—"
|
|
207
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
208
|
+
className: "text-muted-foreground tabular-nums",
|
|
209
|
+
children: formatTimestamp(readNumber(row_0, "updatedAt"), "—")
|
|
210
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
211
|
+
className: "text-right",
|
|
212
|
+
children: /* @__PURE__ */ jsxDEV(Button, {
|
|
213
|
+
"data-testid": `agents-thread-open-${key}`,
|
|
214
|
+
onClick: () => {
|
|
215
|
+
setSelectedKey(key);
|
|
216
|
+
},
|
|
217
|
+
size: "sm",
|
|
218
|
+
type: "button",
|
|
219
|
+
variant: "outline",
|
|
220
|
+
children: t("Timeline")
|
|
221
|
+
}, void 0, false)
|
|
222
|
+
}, void 0, false)]
|
|
223
|
+
}, key, true);
|
|
224
|
+
})
|
|
225
|
+
}, void 0, false)]
|
|
226
|
+
}, void 0, true)
|
|
227
|
+
}, void 0, false)
|
|
228
|
+
}, void 0, false), messagesError !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
|
|
229
|
+
error: messagesErrorSource,
|
|
230
|
+
testId: "agents-messages-error"
|
|
231
|
+
}, void 0, false), selectedKey !== void 0 && /* @__PURE__ */ jsxDEV(Card, {
|
|
232
|
+
className: "overflow-hidden py-0",
|
|
233
|
+
"data-testid": "agents-thread-detail",
|
|
234
|
+
children: /* @__PURE__ */ jsxDEV(CardContent, {
|
|
235
|
+
className: "flex flex-col gap-3 px-4 py-3",
|
|
236
|
+
children: [/* @__PURE__ */ jsxDEV("div", {
|
|
237
|
+
className: "flex items-center justify-between gap-2",
|
|
238
|
+
children: [/* @__PURE__ */ jsxDEV("span", {
|
|
239
|
+
className: "font-mono text-xs",
|
|
240
|
+
children: [t("Timeline"), " · ", selectedKey, selectedThread !== void 0 && /* @__PURE__ */ jsxDEV("span", {
|
|
241
|
+
className: "text-muted-foreground",
|
|
242
|
+
children: [" · ", t("Usage"), ": ", readTotalTokens(selectedThread) ?? 0, " ", t("Tokens")]
|
|
243
|
+
}, void 0, true)]
|
|
244
|
+
}, void 0, true), /* @__PURE__ */ jsxDEV(Button, {
|
|
245
|
+
"data-testid": "agents-thread-detail-close",
|
|
246
|
+
onClick: () => {
|
|
247
|
+
setSelectedKey(void 0);
|
|
248
|
+
},
|
|
249
|
+
size: "xs",
|
|
250
|
+
type: "button",
|
|
251
|
+
variant: "ghost",
|
|
252
|
+
children: t("Close")
|
|
253
|
+
}, void 0, false)]
|
|
254
|
+
}, void 0, true), messages.length === 0 ? /* @__PURE__ */ jsxDEV("p", {
|
|
255
|
+
className: "text-xs text-muted-foreground",
|
|
256
|
+
children: t("This thread has no messages yet.")
|
|
257
|
+
}, void 0, false) : /* @__PURE__ */ jsxDEV(Table, {
|
|
258
|
+
"data-testid": "agents-messages-table",
|
|
259
|
+
children: [/* @__PURE__ */ jsxDEV(TableHeader, {
|
|
260
|
+
children: /* @__PURE__ */ jsxDEV(TableRow, {
|
|
261
|
+
children: [/* @__PURE__ */ jsxDEV(TableHead, {
|
|
262
|
+
children: t("Role")
|
|
263
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
264
|
+
children: t("Content")
|
|
265
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
266
|
+
children: t("Tool")
|
|
267
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableHead, {
|
|
268
|
+
children: t("Approval")
|
|
269
|
+
}, void 0, false)]
|
|
270
|
+
}, void 0, true)
|
|
271
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableBody, {
|
|
272
|
+
children: messages.map((row_1, index) => {
|
|
273
|
+
const role = readString(row_1, "role") ?? "—";
|
|
274
|
+
const toolNames = readToolNames(row_1);
|
|
275
|
+
const toolName = readString(row_1, "toolName");
|
|
276
|
+
const approval = readString(row_1, "status");
|
|
277
|
+
const seq = readNumber(row_1, "seq") ?? index;
|
|
278
|
+
return /* @__PURE__ */ jsxDEV(TableRow, {
|
|
279
|
+
"data-testid": `agents-message-${String(seq)}`,
|
|
280
|
+
children: [/* @__PURE__ */ jsxDEV(TableCell, {
|
|
281
|
+
className: "font-mono text-xs align-top text-muted-foreground",
|
|
282
|
+
children: role
|
|
283
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
284
|
+
className: "max-w-md font-mono text-xs whitespace-pre-wrap break-words",
|
|
285
|
+
children: readString(row_1, "content") ?? "—"
|
|
286
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
287
|
+
className: "font-mono text-xs align-top text-muted-foreground",
|
|
288
|
+
children: toolName ?? (toolNames.length > 0 ? toolNames.join(", ") : "—")
|
|
289
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV(TableCell, {
|
|
290
|
+
className: "align-top",
|
|
291
|
+
children: approval === void 0 ? /* @__PURE__ */ jsxDEV("span", {
|
|
292
|
+
className: "text-xs text-muted-foreground",
|
|
293
|
+
children: "—"
|
|
294
|
+
}, void 0, false) : /* @__PURE__ */ jsxDEV(Badge, {
|
|
295
|
+
"data-testid": `agents-message-approval-${String(seq)}`,
|
|
296
|
+
variant: approvalVariant(approval),
|
|
297
|
+
children: approval
|
|
298
|
+
}, void 0, false)
|
|
299
|
+
}, void 0, false)]
|
|
300
|
+
}, readString(row_1, "messageKey") ?? `${role}:${String(seq)}`, true);
|
|
301
|
+
})
|
|
302
|
+
}, void 0, false)]
|
|
303
|
+
}, void 0, true)]
|
|
304
|
+
}, void 0, true)
|
|
305
|
+
}, void 0, false)]
|
|
306
|
+
}, void 0, true);
|
|
307
|
+
}
|
|
308
|
+
return /* @__PURE__ */ jsxDEV("div", {
|
|
309
|
+
className: "flex flex-col gap-6",
|
|
310
|
+
"data-testid": "lunora-agents-panel",
|
|
311
|
+
children: [threadsError !== null && /* @__PURE__ */ jsxDEV(ErrorAlert, {
|
|
312
|
+
error: threadsErrorSource,
|
|
313
|
+
testId: "agents-error"
|
|
314
|
+
}, void 0, false), /* @__PURE__ */ jsxDEV("p", {
|
|
315
|
+
className: "text-sm text-muted-foreground",
|
|
316
|
+
children: t("Agents run as durable workflows. Each run persists a thread of assistant and tool messages; select a thread to inspect its timeline, tool calls, approvals, and token usage.")
|
|
317
|
+
}, void 0, false), threadsLiveError !== void 0 && /* @__PURE__ */ jsxDEV("p", {
|
|
318
|
+
className: "text-xs text-amber-600 dark:text-amber-500",
|
|
319
|
+
"data-testid": "agents-live-error",
|
|
320
|
+
role: "alert",
|
|
321
|
+
children: t("Live updates unavailable; showing the last evaluation.")
|
|
322
|
+
}, void 0, false), body]
|
|
323
|
+
}, void 0, true);
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export { AgentsPanel };
|