@musnows/scriverse 0.6.9 → 0.6.10
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/ai-tool-results.js +13 -1
- package/dist/ai-tool-results.js.map +1 -1
- package/dist/ai.js +4 -4
- package/dist/ai.js.map +1 -1
- package/dist/app.js +84 -4
- package/dist/app.js.map +1 -1
- package/dist/database.js +166 -7
- package/dist/database.js.map +1 -1
- package/dist/logger.js +2 -2
- package/dist/logger.js.map +1 -1
- package/dist/public/app.js +342 -5
- package/dist/public/global-search.js +12 -3
- package/dist/public/index.html +46 -2
- package/dist/public/s3-backup-ui.d.ts +17 -0
- package/dist/public/s3-backup-ui.js +28 -0
- package/dist/public/styles.css +84 -1
- package/dist/s3-backup.js +654 -0
- package/dist/s3-backup.js.map +1 -0
- package/dist/security.js +25 -0
- package/dist/security.js.map +1 -1
- package/dist/store.js +7 -3
- package/dist/store.js.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function s3BackupRootPrefix(basePath = "") {
|
|
2
|
+
const normalized = String(basePath).trim().replace(/^\/+|\/+$/gu, "").replace(/\/{2,}/gu, "/");
|
|
3
|
+
return normalized ? `${normalized}/scriverse` : "scriverse";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function s3BackupStatusLabel(status) {
|
|
7
|
+
if (status === "succeeded") return "成功";
|
|
8
|
+
if (status === "failed") return "失败";
|
|
9
|
+
return "执行中";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function collectS3BackupRunTransitions(previousSnapshots, runs, initialized, maximumSnapshots = 500) {
|
|
13
|
+
const snapshots = new Map(previousSnapshots);
|
|
14
|
+
const failures = [];
|
|
15
|
+
for (const run of runs) {
|
|
16
|
+
const previousStatus = snapshots.get(run.id);
|
|
17
|
+
if (initialized && run.status === "failed" && previousStatus !== "failed") failures.push(run);
|
|
18
|
+
snapshots.delete(run.id);
|
|
19
|
+
snapshots.set(run.id, run.status);
|
|
20
|
+
}
|
|
21
|
+
while (snapshots.size > maximumSnapshots) snapshots.delete(snapshots.keys().next().value);
|
|
22
|
+
return { snapshots, failures };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function s3BackupFailureToast(run) {
|
|
26
|
+
const reason = String(run?.errorMessage || "S3 服务请求失败").trim();
|
|
27
|
+
return `S3 备份目标“${run?.targetName || "未命名目标"}”失败:${reason}`;
|
|
28
|
+
}
|
package/dist/public/styles.css
CHANGED
|
@@ -794,6 +794,53 @@ body.is-panel-resizing { cursor: col-resize; user-select: none; }
|
|
|
794
794
|
cursor: not-allowed;
|
|
795
795
|
opacity: .46;
|
|
796
796
|
}
|
|
797
|
+
.dialog.s3-backup-dialog { width: min(900px, 94vw); }
|
|
798
|
+
.s3-backup-body { display: grid; gap: 18px; max-height: calc(88vh - 86px); overflow-y: auto; padding: 18px 24px 24px; }
|
|
799
|
+
.s3-backup-overview { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
|
|
800
|
+
.s3-backup-overview h3, .s3-backup-history h3 { margin: 0; font-size: 15px; font-weight: 600; }
|
|
801
|
+
.s3-backup-overview p, .s3-backup-history header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
|
|
802
|
+
.s3-backup-overview-actions, .s3-backup-target-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
|
|
803
|
+
.s3-backup-overview-actions button, .s3-backup-target-actions button, .s3-backup-history header button { min-height: 34px; padding: 7px 11px; font-size: 11px; }
|
|
804
|
+
.s3-backup-target-list, .s3-backup-run-list { display: grid; gap: 9px; }
|
|
805
|
+
.s3-backup-target-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 13px 18px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
|
|
806
|
+
.s3-backup-target-card.is-failed { border-color: color-mix(in srgb, var(--toast-error-fg) 36%, var(--line)); }
|
|
807
|
+
.s3-backup-target-heading { display: flex; align-items: flex-start; gap: 9px; min-width: 0; }
|
|
808
|
+
.s3-backup-target-heading > div { display: grid; gap: 4px; min-width: 0; }
|
|
809
|
+
.s3-backup-target-heading strong { overflow: hidden; color: var(--ink); font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
|
|
810
|
+
.s3-backup-target-heading code, .s3-backup-history code { overflow-wrap: anywhere; color: var(--muted); font: 10px/1.45 var(--font-latin), monospace; }
|
|
811
|
+
.s3-backup-status { flex: 0 0 auto; padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 650; line-height: 1.25; }
|
|
812
|
+
.s3-backup-status.is-enabled, .s3-backup-status.is-succeeded { border-color: color-mix(in srgb, var(--green) 38%, var(--line)); color: var(--green); }
|
|
813
|
+
.s3-backup-status.is-failed { border-color: color-mix(in srgb, var(--toast-error-fg) 42%, var(--line)); color: var(--toast-error-fg); }
|
|
814
|
+
.s3-backup-status.is-running { border-color: color-mix(in srgb, var(--accent) 42%, var(--line)); color: var(--accent-dark); }
|
|
815
|
+
.s3-backup-target-meta { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; }
|
|
816
|
+
.s3-backup-target-meta > div { display: grid; gap: 3px; min-width: 0; padding: 9px 10px; border-radius: 5px; background: var(--surface); }
|
|
817
|
+
.s3-backup-target-meta dt { color: var(--muted); font-size: 9px; }
|
|
818
|
+
.s3-backup-target-meta dd { overflow: hidden; margin: 0; color: var(--ink); font: 10px/1.4 var(--font-latin), var(--font-cjk), sans-serif; text-overflow: ellipsis; white-space: nowrap; }
|
|
819
|
+
.s3-backup-target-error { grid-column: 1 / -1; margin: 0; padding: 9px 11px; border-radius: 5px; background: var(--toast-error-bg); color: var(--toast-error-fg); font-size: 10px; line-height: 1.55; overflow-wrap: anywhere; }
|
|
820
|
+
.s3-backup-history { display: grid; gap: 10px; padding-top: 2px; }
|
|
821
|
+
.s3-backup-history > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
|
822
|
+
.s3-backup-run-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
|
|
823
|
+
.s3-backup-run-copy { display: grid; gap: 3px; min-width: 0; }
|
|
824
|
+
.s3-backup-run-copy strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
|
825
|
+
.s3-backup-run-copy small, .s3-backup-run-metrics { color: var(--muted); font-size: 9px; line-height: 1.5; }
|
|
826
|
+
.s3-backup-run-metrics { text-align: right; white-space: nowrap; }
|
|
827
|
+
.s3-backup-run-card details { grid-column: 2 / -1; min-width: 0; }
|
|
828
|
+
.s3-backup-run-card summary { color: var(--muted); font-size: 9px; cursor: pointer; }
|
|
829
|
+
.s3-backup-run-card pre { max-height: 180px; overflow: auto; margin: 7px 0 0; padding: 9px; border-radius: 4px; background: var(--ink); color: var(--panel); font: 9px/1.5 var(--font-latin), monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
830
|
+
.s3-backup-empty { margin: 0; padding: 24px 16px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; line-height: 1.6; text-align: center; }
|
|
831
|
+
.dialog.s3-backup-target-dialog { width: min(780px, 94vw); height: min(720px, calc(100dvh - 24px)); max-height: calc(100dvh - 24px); overflow: hidden; }
|
|
832
|
+
.s3-backup-target-dialog > form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
|
|
833
|
+
.s3-backup-target-dialog .dialog-fields { min-height: 0; max-height: none; }
|
|
834
|
+
.s3-backup-target-fields > .s3-backup-wide-field { grid-column: 1 / -1; }
|
|
835
|
+
.s3-backup-target-fields input[spellcheck="false"], .s3-backup-target-fields code { font-family: var(--font-latin), monospace; }
|
|
836
|
+
.s3-backup-target-fields label > small { color: var(--muted); font-size: 9px; line-height: 1.5; }
|
|
837
|
+
.s3-backup-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; min-width: 0; margin: 0; padding: 13px; border: 1px solid var(--line); border-radius: 6px; }
|
|
838
|
+
.s3-backup-options legend { padding: 0 6px; color: var(--ink); font-size: 11px; font-weight: 600; }
|
|
839
|
+
.dialog-fields .s3-backup-options label { display: flex; align-items: flex-start; gap: 8px; padding: 10px; border-radius: 5px; background: var(--surface-soft); color: var(--ink); cursor: pointer; }
|
|
840
|
+
.dialog-fields .s3-backup-options input { flex: 0 0 auto; width: 15px; height: 15px; margin: 2px 0 0; padding: 0; }
|
|
841
|
+
.s3-backup-options span { display: grid; gap: 3px; }
|
|
842
|
+
.s3-backup-options strong { font-size: 10px; font-weight: 600; }
|
|
843
|
+
.s3-backup-options small { color: var(--muted); font-size: 9px; line-height: 1.45; }
|
|
797
844
|
.member-permission-form { display: grid; gap: 12px; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); }
|
|
798
845
|
.member-person-field { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
|
|
799
846
|
.member-person-field small, .member-permission-help { color: var(--muted); font-size: 10px; line-height: 1.5; }
|
|
@@ -1765,6 +1812,7 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
1765
1812
|
.ai-agent-tools input { width: 16px; margin-top: 2px; }
|
|
1766
1813
|
.ai-agent-tools strong { color: var(--ink); font-size: 12px; font-weight: 600; }
|
|
1767
1814
|
.ai-agent-tools small { display: block; margin-top: 2px; font-size: 10px; }
|
|
1815
|
+
.ai-agent-tools-section + .empty-state { margin-top: 24px; border-top: 1px solid var(--line); }
|
|
1768
1816
|
.default-model-select { min-width: 260px; padding: 7px 9px; font-size: 11px; }
|
|
1769
1817
|
.empty-state { padding: 70px 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); }
|
|
1770
1818
|
.empty-state b { display: block; color: var(--ink); margin-bottom: 8px; }
|
|
@@ -2139,9 +2187,15 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
2139
2187
|
.config-inline-save .context-compact-threshold-field,
|
|
2140
2188
|
.config-inline-save .agent-tool-call-limit-field,
|
|
2141
2189
|
.config-inline-save .daily-token-quota-field { display: grid; gap: 6px; width: 64px; margin: 0; color: var(--muted); font-size: 10px; }
|
|
2190
|
+
.config-inline-save .book-summary-context-percent-field,
|
|
2191
|
+
.config-inline-save .context-compact-threshold-field { grid-template-columns: minmax(110px, 130px) 88px; align-items: center; column-gap: 12px; width: min(100%, 230px); }
|
|
2192
|
+
.config-inline-save .book-summary-context-percent-field input,
|
|
2193
|
+
.config-inline-save .context-compact-threshold-field input { width: 88px; }
|
|
2142
2194
|
.config-inline-save .daily-token-quota-field { width: 144px; }
|
|
2143
2195
|
.config-inline-save .agent-tool-call-global-multiplier-field { display: grid; gap: 6px; width: auto; margin: 0; color: var(--muted); font-size: 10px; }
|
|
2144
|
-
.
|
|
2196
|
+
.config-inline-save > .config-checkbox-field { display: inline-flex !important; align-items: center; gap: 8px; min-height: 32px; margin: 0; color: var(--muted); font-size: calc(11px * var(--ui-font-scale)); line-height: 1.4; white-space: nowrap; }
|
|
2197
|
+
.config-inline-save > .config-checkbox-field input[type="checkbox"] { width: 18px; min-width: 18px; height: 18px; }
|
|
2198
|
+
.agent-tool-call-global-multiplier-toggle button { width: 32px; min-width: 32px; height: 30px; min-height: 30px; padding: 0; font-family: var(--font-latin), monospace; font-size: 11px; font-variant-numeric: tabular-nums; }
|
|
2145
2199
|
.relationship-index-summary { display: grid; gap: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
|
|
2146
2200
|
.relationship-index-state-row { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; color: var(--muted); font-size: 10px; }
|
|
2147
2201
|
.relationship-index-state-row strong { color: var(--ink); font-family: var(--font-latin), monospace; font-weight: 600; }
|
|
@@ -2173,6 +2227,10 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
2173
2227
|
.platform-image-tool-field select, .platform-image-tool-panel .config-save-button { height: 40px; min-height: 40px; }
|
|
2174
2228
|
.platform-image-tool-panel .config-save-button { width: 100%; }
|
|
2175
2229
|
}
|
|
2230
|
+
@media (max-width: 640px) {
|
|
2231
|
+
.config-inline-save .book-summary-context-percent-field,
|
|
2232
|
+
.config-inline-save .context-compact-threshold-field { grid-template-columns: minmax(0, 1fr); row-gap: 6px; width: 100%; }
|
|
2233
|
+
}
|
|
2176
2234
|
.field-label textarea {
|
|
2177
2235
|
width: 100%;
|
|
2178
2236
|
min-height: 140px;
|
|
@@ -2206,6 +2264,10 @@ select:focus, input:focus, textarea:focus { border-color: #a77768; box-shadow: 0
|
|
|
2206
2264
|
.message-body { min-width: 0; overflow-wrap: anywhere; }
|
|
2207
2265
|
.assistant-message.is-error .message-body { font-family: inherit; font-size: inherit; line-height: inherit; }
|
|
2208
2266
|
.assistant-message.is-error .ai-error-text { margin: 0; white-space: pre-wrap; font: inherit; }
|
|
2267
|
+
.ai-error-settings-link-wrap { margin: 12px 0 0; }
|
|
2268
|
+
.ai-error-settings-link { color: var(--accent); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
|
|
2269
|
+
.ai-error-settings-link:hover, .ai-error-settings-link:focus-visible { color: var(--accent-dark); }
|
|
2270
|
+
.config-section.is-targeted { border-radius: 5px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 34%, transparent); }
|
|
2209
2271
|
.message-card-actions { position: absolute; right: 0; bottom: -31px; display: flex; align-items: center; gap: 12px; height: 24px; }
|
|
2210
2272
|
.message-card-actions button { display: inline-flex; align-items: center; gap: 4px; min-width: 0; padding: 3px 2px; border: 0; background: transparent; color: var(--muted); font-size: 9px; }
|
|
2211
2273
|
.message-card-actions button:hover, .message-card-actions button:focus-visible { color: var(--accent-dark); }
|
|
@@ -3388,3 +3450,24 @@ body { font-size: var(--ui-font-size); }
|
|
|
3388
3450
|
.ai-tool-call-info dt, .ai-tool-call-detail h3 { font-size: calc(9px * var(--ai-font-scale)); }
|
|
3389
3451
|
.ai-tool-call-info dd { font-size: calc(11px * var(--ai-font-scale)); }
|
|
3390
3452
|
.ai-tool-call-detail pre { font-size: calc(10px * var(--ai-font-scale)); }
|
|
3453
|
+
|
|
3454
|
+
@media (max-width: 850px) {
|
|
3455
|
+
.s3-backup-target-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
|
|
3456
|
+
.s3-backup-options { grid-template-columns: minmax(0, 1fr); }
|
|
3457
|
+
}
|
|
3458
|
+
|
|
3459
|
+
@media (max-width: 640px) {
|
|
3460
|
+
.s3-backup-body { gap: 14px; padding: 14px 16px 18px; }
|
|
3461
|
+
.s3-backup-overview, .s3-backup-history > header { align-items: stretch; flex-direction: column; }
|
|
3462
|
+
.s3-backup-overview-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
|
|
3463
|
+
.s3-backup-overview-actions button { width: 100%; }
|
|
3464
|
+
.s3-backup-target-card { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 13px; }
|
|
3465
|
+
.s3-backup-target-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); justify-content: stretch; }
|
|
3466
|
+
.s3-backup-target-actions button { min-width: 0; padding-inline: 6px; }
|
|
3467
|
+
.s3-backup-target-meta { grid-template-columns: minmax(0, 1fr); }
|
|
3468
|
+
.s3-backup-run-card { grid-template-columns: auto minmax(0, 1fr); }
|
|
3469
|
+
.s3-backup-run-metrics { grid-column: 2; text-align: left; white-space: normal; }
|
|
3470
|
+
.s3-backup-run-card details { grid-column: 1 / -1; }
|
|
3471
|
+
.s3-backup-target-fields { grid-template-columns: minmax(0, 1fr) !important; padding-inline: 16px !important; }
|
|
3472
|
+
.s3-backup-target-fields > * { grid-column: 1 !important; }
|
|
3473
|
+
}
|