dsh-mcviseron-plugin 0.7.3 → 0.7.8

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/lib/client.js CHANGED
@@ -45,6 +45,9 @@ var SESSION_END_API = {
45
45
  var AUTH_COOKIE_API = {
46
46
  prune: "/api/dsh-mcviseron/auth-cookies/prune"
47
47
  };
48
+ var ARCHIVE_API = {
49
+ status: "/api/dsh-mcviseron/archive-integration/status"
50
+ };
48
51
 
49
52
  // src/client/AppearanceScheduleRow.tsx
50
53
  var import_react = require("react");
@@ -1209,6 +1212,35 @@ var SESSION_END_FIELDS = [
1209
1212
  var import_jsx_runtime6 = require("react/jsx-runtime");
1210
1213
  function SettingsSection({ t }) {
1211
1214
  const [tab, setTab] = (0, import_react6.useState)("restart");
1215
+ const [archive, setArchive] = (0, import_react6.useState)(null);
1216
+ const loadArchive = async () => {
1217
+ try {
1218
+ const response = await fetch(ARCHIVE_API.status, { credentials: "same-origin", cache: "no-store" });
1219
+ if (!response.ok) {
1220
+ setArchive(null);
1221
+ return;
1222
+ }
1223
+ const value = await response.json();
1224
+ if (value.available) {
1225
+ try {
1226
+ const inventoryResponse = await fetch("/api/dsh-session-archive/inventory", { credentials: "same-origin", cache: "no-store" });
1227
+ if (inventoryResponse.ok) {
1228
+ const inventory = await inventoryResponse.json();
1229
+ const rows = Array.isArray(inventory.rows) ? inventory.rows : [];
1230
+ value.archivedCount = rows.filter((row) => row.archived === true).length;
1231
+ value.unknownCount = rows.filter((row) => row.archived === true && row.archivedAt === void 0).length;
1232
+ }
1233
+ } catch {
1234
+ }
1235
+ }
1236
+ setArchive(value.available ? value : null);
1237
+ } catch {
1238
+ setArchive(null);
1239
+ }
1240
+ };
1241
+ (0, import_react6.useEffect)(() => {
1242
+ void loadArchive();
1243
+ }, []);
1212
1244
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.page, children: [
1213
1245
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { style: pageStyles.heading, children: t("page.title") }),
1214
1246
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { style: pageStyles.lede, children: t("page.description") }),
@@ -1265,6 +1297,19 @@ function SettingsSection({ t }) {
1265
1297
  children: t("page.tab.sessionEnd")
1266
1298
  }
1267
1299
  ),
1300
+ archive?.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1301
+ "button",
1302
+ {
1303
+ type: "button",
1304
+ role: "tab",
1305
+ "aria-selected": tab === "archive",
1306
+ onClick: () => {
1307
+ setTab("archive");
1308
+ },
1309
+ style: tab === "archive" ? { ...pageStyles.tab, ...pageStyles.tabActive } : pageStyles.tab,
1310
+ children: t("page.tab.archive")
1311
+ }
1312
+ ) : null,
1268
1313
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1269
1314
  "button",
1270
1315
  {
@@ -1303,7 +1348,36 @@ function SettingsSection({ t }) {
1303
1348
  description: "page.sessionEnd.description",
1304
1349
  fields: SESSION_END_FIELDS
1305
1350
  }
1306
- ) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.card, children: [
1351
+ ) : tab === "archive" && archive?.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.card, children: [
1352
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: pageStyles.cardTitle, children: t("page.archive.title") }),
1353
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1354
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.available") }),
1355
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.ledgerExists ? t("page.archive.ledger") : archive.ledgerPath })
1356
+ ] }),
1357
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1358
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.archived") }),
1359
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.archivedCount })
1360
+ ] }),
1361
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1362
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.observed") }),
1363
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.observed })
1364
+ ] }),
1365
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1366
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.manual") }),
1367
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.manual })
1368
+ ] }),
1369
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1370
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.unknown") }),
1371
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.unknownCount })
1372
+ ] }),
1373
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1374
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.archive.ledger") }),
1375
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: archive.ledgerPath })
1376
+ ] }),
1377
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", onClick: () => {
1378
+ void loadArchive();
1379
+ }, style: pageStyles.tab, children: t("page.archive.refresh") })
1380
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.card, children: [
1307
1381
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: pageStyles.cardTitle, children: t("page.components.title") }),
1308
1382
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1309
1383
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.components.appearance") }),
@@ -1329,6 +1403,10 @@ function SettingsSection({ t }) {
1329
1403
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.components.sessionEnd") }),
1330
1404
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: t("page.components.sessionEndHint") })
1331
1405
  ] }),
1406
+ archive?.available ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { style: pageStyles.componentRow, children: [
1407
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentName, children: t("page.components.archive") }),
1408
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { style: pageStyles.componentHint, children: t("page.components.archiveHint") })
1409
+ ] }) : null,
1332
1410
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { style: pageStyles.cardStatus, children: t("page.components.note") })
1333
1411
  ] })
1334
1412
  ] });
@@ -1567,12 +1645,25 @@ var zh = {
1567
1645
  "form.taskGuard.exclude": "\u4E0D\u7EDF\u8BA1\u8FD9\u4E9B\u5DE5\u5177",
1568
1646
  "form.taskGuard.listHint": "\u9017\u53F7\u5206\u9694\uFF0C\u652F\u6301 *\uFF1B\u7559\u7A7A\u8868\u793A\u5168\u90E8",
1569
1647
  "page.tab.sessionEnd": "\u4F1A\u8BDD\u540E\u52A8\u4F5C",
1648
+ "page.tab.archive": "\u5F52\u6863\u65F6\u95F4",
1649
+ "page.archive.title": "\u5F52\u6863\u65F6\u95F4",
1650
+ "page.archive.description": "\u7B2C\u4E09\u65B9\u4F1A\u8BDD\u5F52\u6863\u63D2\u4EF6\u7684\u5F52\u6863\u65F6\u95F4\u72B6\u6001\u3002\u4EC5\u5728\u68C0\u6D4B\u5230 @linxin666/dsh-session-archive \u65F6\u663E\u793A\uFF0C\u672A\u5B89\u88C5\u65F6\u4E0D\u4F1A\u6CE8\u518C\u6B64\u9875\u3002",
1651
+ "page.archive.available": "\u5DF2\u68C0\u6D4B\u5230\u7B2C\u4E09\u65B9\u5F52\u6863\u63D2\u4EF6",
1652
+ "page.archive.ledger": "\u5F52\u6863\u53F0\u8D26",
1653
+ "page.archive.observed": "\u5386\u53F2\u8865\u8BB0",
1654
+ "page.archive.manual": "\u6B63\u5E38\u8BB0\u5F55",
1655
+ "page.archive.unknown": "\u672A\u77E5\u5F52\u6863\u65F6\u95F4",
1656
+ "page.archive.archived": "\u5DF2\u5F52\u6863\u4F1A\u8BDD",
1657
+ "page.archive.refresh": "\u5237\u65B0\u72B6\u6001",
1658
+ "page.archive.note": "\u5386\u53F2\u672A\u77E5\u5F52\u6863\u5728\u9996\u6B21\u521D\u59CB\u5316\u65F6\u8865\u8BB0\uFF08\u8865\u8BB0\uFF09\uFF1B\u521D\u59CB\u5316\u540E\u7684\u65B0\u5F52\u6863\u8BB0\u5F55\u6B63\u5E38\u65F6\u95F4\u3002\u81EA\u52A8\u5220\u9664\u4ECD\u7531\u5F52\u6863\u63D2\u4EF6\u63A7\u5236\u3002",
1570
1659
  "page.sessionEnd.title": "\u4F1A\u8BDD\u540E\u52A8\u4F5C",
1571
1660
  "page.sessionEnd.description": "\u672C\u8F6E\u6700\u7EC8\u56DE\u590D\u5B8C\u6574\u663E\u793A\u540E\u6267\u884C\u4E00\u6B21\u52A8\u4F5C\uFF1B\u91CD\u542F\u4F1A\u7B49\u5F85\u6240\u6709\u4F1A\u8BDD\u4E0E\u540E\u53F0\u4EFB\u52A1\u7ED3\u675F\uFF0C\u8BBE\u7F6E\u9875\u7684\u91CD\u542F\u4E0D\u53D7\u6B64\u7EA6\u675F\u3002",
1572
1661
  "page.components.authCookie": "\u8BA4\u8BC1 cookie \u6E05\u7406",
1573
1662
  "page.components.authCookieHint": "\u81EA\u52A8\u8FD0\u884C\uFF0C\u65E0\u8BBE\u7F6E",
1574
1663
  "page.components.sessionEnd": "\u4F1A\u8BDD\u540E\u52A8\u4F5C",
1575
1664
  "page.components.sessionEndHint": "\u8F93\u5165\u6846\u5DE6\u4FA7\u7684\u300C\u4F1A\u8BDD\u540E\u91CD\u542F\u300D\u4E0B\u62C9",
1665
+ "page.components.archive": "\u5F52\u6863\u65F6\u95F4\uFF08\u53EF\u9009\uFF09",
1666
+ "page.components.archiveHint": "\u68C0\u6D4B\u5230\u7B2C\u4E09\u65B9\u5F52\u6863\u63D2\u4EF6\u65F6\u663E\u793A",
1576
1667
  "form.sessionEnd.enabled": "\u542F\u7528\u4F1A\u8BDD\u540E\u52A8\u4F5C",
1577
1668
  "form.sessionEnd.enabledHint": "\u5728\u5BF9\u8BDD\u8F93\u5165\u6846\u663E\u793A\u300C\u4F1A\u8BDD\u540E\u91CD\u542F\u300D\u4E0B\u62C9\uFF0C\u5E76\u5141\u8BB8 AI \u8BBE\u7F6E",
1578
1669
  "form.sessionEnd.grace": "\u6700\u7EC8\u56DE\u590D\u663E\u793A\u7B49\u5F85\uFF08\u6BEB\u79D2\uFF09",
@@ -1695,12 +1786,25 @@ var en = {
1695
1786
  "form.taskGuard.exclude": "Exclude these tools",
1696
1787
  "form.taskGuard.listHint": "Comma-separated, * supported; empty means all",
1697
1788
  "page.tab.sessionEnd": "After-session action",
1789
+ "page.tab.archive": "Archive time",
1790
+ "page.archive.title": "Archive time",
1791
+ "page.archive.description": "Archive-time status of the third-party session archive plugin. Shown only when @linxin666/dsh-session-archive is detected; no page is registered when it is absent.",
1792
+ "page.archive.available": "Third-party archive plugin detected",
1793
+ "page.archive.ledger": "Archive ledger",
1794
+ "page.archive.observed": "Historical backfilled",
1795
+ "page.archive.manual": "Normal records",
1796
+ "page.archive.unknown": "Unknown archive times",
1797
+ "page.archive.archived": "Archived sessions",
1798
+ "page.archive.refresh": "Refresh status",
1799
+ "page.archive.note": "Historical unknown archives are backfilled on first initialization and marked (backfilled); new archives after initialization are recorded as normal times. Auto-delete remains controlled by the archive plugin.",
1698
1800
  "page.sessionEnd.title": "After-session action",
1699
1801
  "page.sessionEnd.description": "One action after the final reply is fully displayed. A restart waits for every running conversation and background job; the Settings restart button is not delayed.",
1700
1802
  "page.components.authCookie": "Auth-cookie cleanup",
1701
1803
  "page.components.authCookieHint": "Runs automatically; no settings",
1702
1804
  "page.components.sessionEnd": "After-session action",
1703
1805
  "page.components.sessionEndHint": "The \u201CRestart after session\u201D dropdown left of the composer",
1806
+ "page.components.archive": "Archive time (optional)",
1807
+ "page.components.archiveHint": "Shown only when the third-party archive plugin is detected",
1704
1808
  "form.sessionEnd.enabled": "Enable after-session actions",
1705
1809
  "form.sessionEnd.enabledHint": "Show the \u201CRestart after session\u201D dropdown in the composer and let the AI arm it",
1706
1810
  "form.sessionEnd.grace": "Final-reply render grace (ms)",