opencode-windows-scheduler 1.3.0 → 1.4.0
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/CHANGELOG.md +23 -1
- package/README.md +9 -3
- package/ROADMAP-STRATEGY.md +11 -11
- package/ROADMAP.md +2 -7
- package/dist/core/audit.d.ts +68 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +206 -0
- package/dist/core/secrets.d.ts +57 -0
- package/dist/core/secrets.d.ts.map +1 -0
- package/dist/core/secrets.js +331 -0
- package/dist/core/structured-log.d.ts.map +1 -1
- package/dist/core/structured-log.js +9 -0
- package/dist/db/schema.d.ts +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +15 -0
- package/dist/index.d.ts +24 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +342 -19
- package/dist/rpc.d.ts +400 -0
- package/dist/rpc.d.ts.map +1 -1
- package/dist/rpc.js +146 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +67 -0
- package/dist/settings.d.ts +16 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +29 -0
- package/dist/workspaces.d.ts +8 -2
- package/dist/workspaces.d.ts.map +1 -1
- package/dist/workspaces.js +21 -4
- package/docs/ARCHITECTURE.md +13 -5
- package/docs/FEATURES.md +29 -1
- package/docs/README.ru.md +13 -3
- package/gui-experimental.cjs +4 -4
- package/package.json +4 -2
- package/src/core/audit.ts +291 -0
- package/src/core/secrets.ts +385 -0
- package/src/core/structured-log.ts +9 -0
- package/src/db/schema.ts +15 -0
- package/src/gui.tsx +323 -0
- package/src/index.ts +452 -19
- package/src/rpc.ts +157 -0
- package/src/server.ts +67 -0
- package/src/settings.ts +51 -0
- package/src/workspaces.ts +22 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { LOG_DIR } from "../types.js";
|
|
4
|
+
import { redactSecretsInText } from "./secrets.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Машиночитаемые логи запусков (Спринт 22).
|
|
@@ -120,6 +121,14 @@ export function appendStructuredLog(
|
|
|
120
121
|
...record,
|
|
121
122
|
ts: record.ts ?? new Date().toISOString(),
|
|
122
123
|
};
|
|
124
|
+
// Спринт 26: даже если ошибка пришла из внешнего процесса, известные
|
|
125
|
+
// значения секретов и присваивания TOKEN=/password: вырезаются.
|
|
126
|
+
if (typeof payload.error === "string") {
|
|
127
|
+
payload.error = redactSecretsInText(payload.error);
|
|
128
|
+
}
|
|
129
|
+
if (typeof payload.reason === "string") {
|
|
130
|
+
payload.reason = redactSecretsInText(payload.reason);
|
|
131
|
+
}
|
|
123
132
|
fs.appendFileSync(STRUCTURED_LOG_FILE, `${JSON.stringify(payload)}\n`, "utf8");
|
|
124
133
|
return true;
|
|
125
134
|
} catch (err) {
|
package/src/db/schema.ts
CHANGED
|
@@ -67,6 +67,21 @@ CREATE TABLE IF NOT EXISTS workspaces (
|
|
|
67
67
|
env_file TEXT,
|
|
68
68
|
created_at TEXT NOT NULL
|
|
69
69
|
);
|
|
70
|
+
|
|
71
|
+
CREATE TABLE IF NOT EXISTS audit_log (
|
|
72
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
73
|
+
ts TEXT NOT NULL,
|
|
74
|
+
action TEXT NOT NULL,
|
|
75
|
+
target_type TEXT,
|
|
76
|
+
target TEXT,
|
|
77
|
+
actor TEXT NOT NULL,
|
|
78
|
+
source TEXT,
|
|
79
|
+
details_json TEXT,
|
|
80
|
+
remote TEXT
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
CREATE INDEX IF NOT EXISTS idx_audit_ts ON audit_log(ts DESC);
|
|
84
|
+
CREATE INDEX IF NOT EXISTS idx_audit_action ON audit_log(action, ts DESC);
|
|
70
85
|
`;
|
|
71
86
|
|
|
72
87
|
interface SchemaDb {
|
package/src/gui.tsx
CHANGED
|
@@ -377,6 +377,25 @@ export default Plugin.define({
|
|
|
377
377
|
const [quietTo, setQuietTo] = createSignal("08:00")
|
|
378
378
|
const [digestBusy, setDigestBusy] = createSignal(false)
|
|
379
379
|
|
|
380
|
+
// Секреты (Спринт 26): зашифрованное хранилище.
|
|
381
|
+
const [secretsList, setSecretsList] = createSignal<{ name: string; preview: string; updatedAt: string }[]>([])
|
|
382
|
+
const [secretsBusy, setSecretsBusy] = createSignal(false)
|
|
383
|
+
const [secretName, setSecretName] = createSignal("")
|
|
384
|
+
const [secretValue, setSecretValue] = createSignal("")
|
|
385
|
+
|
|
386
|
+
// Аудит (Спринт 26): журнал мутаций.
|
|
387
|
+
const [auditRecords, setAuditRecords] = createSignal<{ id: number; ts: string; action: string; targetType: string | null; target: string | null; actor: string; source: string | null; details: unknown; remote: string | null }[]>([])
|
|
388
|
+
const [auditBusy, setAuditBusy] = createSignal(false)
|
|
389
|
+
const [auditCollapsed, setAuditCollapsed] = createSignal(true)
|
|
390
|
+
const [auditFilterAction, setAuditFilterAction] = createSignal("")
|
|
391
|
+
const [auditFilterActor, setAuditFilterActor] = createSignal("")
|
|
392
|
+
const [auditFilterTarget, setAuditFilterTarget] = createSignal("")
|
|
393
|
+
|
|
394
|
+
// Настройки аудита (ретеншн).
|
|
395
|
+
const [auditRetentionEnabled, setAuditRetentionEnabled] = createSignal(true)
|
|
396
|
+
const [auditRetentionDays, setAuditRetentionDays] = createSignal(90)
|
|
397
|
+
const [auditMaxRecords, setAuditMaxRecords] = createSignal(10000)
|
|
398
|
+
|
|
380
399
|
// Настройки ретеншна истории (Спринт 18): очистка старых записей.
|
|
381
400
|
const [historyRetentionDays, setHistoryRetentionDays] = createSignal(30)
|
|
382
401
|
const [historyMaxRecords, setHistoryMaxRecords] = createSignal(5000)
|
|
@@ -439,6 +458,10 @@ export default Plugin.define({
|
|
|
439
458
|
setQuietEnabled(Boolean(n?.quietHours?.enabled))
|
|
440
459
|
setQuietFrom(n?.quietHours?.from ?? "22:00")
|
|
441
460
|
setQuietTo(n?.quietHours?.to ?? "08:00")
|
|
461
|
+
const a = n?.audit
|
|
462
|
+
setAuditRetentionEnabled(Boolean(a?.enabled !== false))
|
|
463
|
+
setAuditRetentionDays(Number(a?.retentionDays ?? 90))
|
|
464
|
+
setAuditMaxRecords(Number(a?.maxRecords ?? 10000))
|
|
442
465
|
}
|
|
443
466
|
|
|
444
467
|
async function loadSettingsGui() {
|
|
@@ -452,9 +475,16 @@ export default Plugin.define({
|
|
|
452
475
|
setHistoryMaxRecords(Number(h?.maxRecords ?? 5000))
|
|
453
476
|
setHistoryLastCleanupAt(h?.lastCleanupAt ?? null)
|
|
454
477
|
setHistoryLastCleanupDeleted(Number(h?.lastCleanupDeleted ?? 0))
|
|
478
|
+
const au = s.audit
|
|
479
|
+
setAuditRetentionEnabled(Boolean(au?.enabled !== false))
|
|
480
|
+
setAuditRetentionDays(Number(au?.retentionDays ?? 90))
|
|
481
|
+
setAuditMaxRecords(Number(au?.maxRecords ?? 10000))
|
|
455
482
|
} catch (err: any) {
|
|
456
483
|
console.error("RPC Error (get_settings):", err)
|
|
457
484
|
}
|
|
485
|
+
|
|
486
|
+
void loadSecretsGui()
|
|
487
|
+
void loadAuditGui()
|
|
458
488
|
}
|
|
459
489
|
|
|
460
490
|
/** Текущие настройки уведомлений из сигналов формы. */
|
|
@@ -516,6 +546,11 @@ export default Plugin.define({
|
|
|
516
546
|
time: (digestTime() || "09:00").trim(),
|
|
517
547
|
lastSentAt: digestLastSentAt(),
|
|
518
548
|
},
|
|
549
|
+
audit: {
|
|
550
|
+
enabled: auditRetentionEnabled(),
|
|
551
|
+
retentionDays: auditRetentionDays(),
|
|
552
|
+
maxRecords: auditMaxRecords(),
|
|
553
|
+
},
|
|
519
554
|
}
|
|
520
555
|
}
|
|
521
556
|
|
|
@@ -549,6 +584,12 @@ export default Plugin.define({
|
|
|
549
584
|
setHistoryLastCleanupAt(h?.lastCleanupAt ?? null)
|
|
550
585
|
setHistoryLastCleanupDeleted(Number(h?.lastCleanupDeleted ?? 0))
|
|
551
586
|
}
|
|
587
|
+
if (patch.audit !== undefined) {
|
|
588
|
+
const au = s.audit
|
|
589
|
+
setAuditRetentionEnabled(Boolean(au?.enabled !== false))
|
|
590
|
+
setAuditRetentionDays(Number(au?.retentionDays ?? 90))
|
|
591
|
+
setAuditMaxRecords(Number(au?.maxRecords ?? 10000))
|
|
592
|
+
}
|
|
552
593
|
} catch (err: any) {
|
|
553
594
|
console.error("RPC Error (save_settings):", err)
|
|
554
595
|
ctx.toast.show({ title: "Не удалось сохранить настройки", variant: "error", description: errorMessage(err) })
|
|
@@ -596,6 +637,87 @@ export default Plugin.define({
|
|
|
596
637
|
}
|
|
597
638
|
}
|
|
598
639
|
|
|
640
|
+
/** Загрузка списка секретов (имена + превью, без значений). */
|
|
641
|
+
async function loadSecretsGui() {
|
|
642
|
+
setSecretsBusy(true)
|
|
643
|
+
try {
|
|
644
|
+
const result = await rpc.list_secrets({})
|
|
645
|
+
setSecretsList(result?.secrets ?? [])
|
|
646
|
+
} catch (err: any) {
|
|
647
|
+
console.error("RPC Error (list_secrets):", err)
|
|
648
|
+
} finally {
|
|
649
|
+
setSecretsBusy(false)
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
/** Сохранить/создать секрет. */
|
|
654
|
+
async function handleSaveSecret() {
|
|
655
|
+
const name = secretName().trim()
|
|
656
|
+
const value = secretValue()
|
|
657
|
+
if (!name || !value) return
|
|
658
|
+
setSecretsBusy(true)
|
|
659
|
+
try {
|
|
660
|
+
const result = await rpc.save_secret({ name, value })
|
|
661
|
+
if (result?.success) {
|
|
662
|
+
setSecretName("")
|
|
663
|
+
setSecretValue("")
|
|
664
|
+
ctx.toast.show({ title: "Секрет сохранён", variant: "success", description: result.message })
|
|
665
|
+
void loadSecretsGui()
|
|
666
|
+
} else {
|
|
667
|
+
ctx.toast.show({ title: "Секрет не сохранён", variant: "error", description: result?.message ?? "" })
|
|
668
|
+
}
|
|
669
|
+
} catch (err: any) {
|
|
670
|
+
console.error("RPC Error (save_secret):", err)
|
|
671
|
+
ctx.toast.show({ title: "Секрет не сохранён", variant: "error", description: errorMessage(err) })
|
|
672
|
+
} finally {
|
|
673
|
+
setSecretsBusy(false)
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/** Удалить секрет по имени. */
|
|
678
|
+
async function handleDeleteSecret(name: string) {
|
|
679
|
+
setSecretsBusy(true)
|
|
680
|
+
try {
|
|
681
|
+
const result = await rpc.delete_secret({ name })
|
|
682
|
+
if (result?.success) {
|
|
683
|
+
ctx.toast.show({ title: "Секрет удалён", variant: "success", description: result?.message ?? "" })
|
|
684
|
+
void loadSecretsGui()
|
|
685
|
+
} else {
|
|
686
|
+
ctx.toast.show({ title: "Секрет не удалён", variant: "error", description: result?.message ?? "" })
|
|
687
|
+
}
|
|
688
|
+
} catch (err: any) {
|
|
689
|
+
console.error("RPC Error (delete_secret):", err)
|
|
690
|
+
ctx.toast.show({ title: "Секрет не удалён", variant: "error", description: errorMessage(err) })
|
|
691
|
+
} finally {
|
|
692
|
+
setSecretsBusy(false)
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
/** Загрузка журнала аудита с фильтрами. */
|
|
697
|
+
async function loadAuditGui() {
|
|
698
|
+
setAuditBusy(true)
|
|
699
|
+
try {
|
|
700
|
+
const result = await rpc.get_audit({
|
|
701
|
+
action: auditFilterAction() || undefined,
|
|
702
|
+
actor: auditFilterActor() || undefined,
|
|
703
|
+
target: auditFilterTarget() || undefined,
|
|
704
|
+
limit: 200,
|
|
705
|
+
})
|
|
706
|
+
if (result?.success) {
|
|
707
|
+
setAuditRecords(result?.records ?? [])
|
|
708
|
+
}
|
|
709
|
+
} catch (err: any) {
|
|
710
|
+
console.error("RPC Error (get_audit):", err)
|
|
711
|
+
} finally {
|
|
712
|
+
setAuditBusy(false)
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
/** Сохраняет настройки аудита. */
|
|
717
|
+
async function saveAuditSettings() {
|
|
718
|
+
await persistSettings({ audit: { enabled: auditRetentionEnabled(), retentionDays: auditRetentionDays(), maxRecords: auditMaxRecords() } })
|
|
719
|
+
}
|
|
720
|
+
|
|
599
721
|
/** Кнопка «🧪 Тестовое уведомление». */
|
|
600
722
|
async function handleTestNotification() {
|
|
601
723
|
setTestNotificationBusy(true)
|
|
@@ -2765,6 +2887,65 @@ export default Plugin.define({
|
|
|
2765
2887
|
</div>
|
|
2766
2888
|
</div>
|
|
2767
2889
|
|
|
2890
|
+
{/* 🔐 Секреты (Спринт 26) */}
|
|
2891
|
+
<div style="width:100%;max-width:700px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
2892
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|
|
2893
|
+
<span style="font-size:12px;font-weight:600;color:#e0e0e0">🔐 Секреты</span>
|
|
2894
|
+
<span style="font-size:11px;color:#8e8e93">{secretsList().length}</span>
|
|
2895
|
+
</div>
|
|
2896
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
2897
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
2898
|
+
<input
|
|
2899
|
+
type="text"
|
|
2900
|
+
value={secretName()}
|
|
2901
|
+
placeholder="Имя секрета (A-Za-z0-9_.-)"
|
|
2902
|
+
onInput={(e) => setSecretName(e.currentTarget.value)}
|
|
2903
|
+
style="width:220px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
2904
|
+
/>
|
|
2905
|
+
<input
|
|
2906
|
+
type="password"
|
|
2907
|
+
autocomplete="new-password"
|
|
2908
|
+
value={secretValue()}
|
|
2909
|
+
placeholder="Значение (не возвращается при чтении)"
|
|
2910
|
+
onInput={(e) => setSecretValue(e.currentTarget.value)}
|
|
2911
|
+
style="width:320px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
2912
|
+
/>
|
|
2913
|
+
<button
|
|
2914
|
+
onClick={() => void handleSaveSecret()}
|
|
2915
|
+
disabled={secretsBusy() || !secretName().trim() || !secretValue()}
|
|
2916
|
+
style={secretsBusy() || !secretName().trim() || !secretValue()
|
|
2917
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
2918
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
2919
|
+
>
|
|
2920
|
+
{secretsBusy() ? "Сохранение..." : "💾 Сохранить"}
|
|
2921
|
+
</button>
|
|
2922
|
+
</div>
|
|
2923
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap;overflow:auto">
|
|
2924
|
+
{secretsList().map((item) => (
|
|
2925
|
+
<span
|
|
2926
|
+
key={item.name}
|
|
2927
|
+
style="display:flex;align-items:center;gap:6px;padding:4px 8px;background:#252526;border:1px solid #333;border-radius:4px;font-size:11px;color:#e0e0e0"
|
|
2928
|
+
>
|
|
2929
|
+
<span style="font-weight:600;color:#569cd6">{item.name}</span>
|
|
2930
|
+
<span style="color:#ce9178">•••• {item.preview}</span>
|
|
2931
|
+
<button
|
|
2932
|
+
onClick={() => void handleDeleteSecret(item.name)}
|
|
2933
|
+
title="Удалить"
|
|
2934
|
+
style="padding:2px 6px;background:#c43b2b;color:white;border:none;border-radius:3px;cursor:pointer;font-size:10px;font-weight:600;line-height:1"
|
|
2935
|
+
>
|
|
2936
|
+
×
|
|
2937
|
+
</button>
|
|
2938
|
+
</span>
|
|
2939
|
+
))}
|
|
2940
|
+
{secretsList().length === 0 && (
|
|
2941
|
+
<span style="font-size:11px;color:#8e8e93">Секретов нет. Значения хранятся зашифрованно в secrets.json.</span>
|
|
2942
|
+
)}
|
|
2943
|
+
</div>
|
|
2944
|
+
<div style="font-size:11px;color:#8e8e93">
|
|
2945
|
+
В задачах используйте ссылку <code style="color:#dcdcaa">${"{secret:NAME}"}</code> — значение подставляется из хранилища при запуске и маскируется в логах.
|
|
2946
|
+
</div>
|
|
2947
|
+
</div>
|
|
2948
|
+
</div>
|
|
2768
2949
|
{/* Уведомления о матрицах (Спринт 20) */}
|
|
2769
2950
|
<div style="border-top:1px solid #333;padding-top:10px;display:flex;flex-direction:column;gap:8px">
|
|
2770
2951
|
<div style="font-size:12px;color:#e0e0e0;font-weight:600">Матрицы</div>
|
|
@@ -2964,6 +3145,148 @@ export default Plugin.define({
|
|
|
2964
3145
|
)}
|
|
2965
3146
|
</div>
|
|
2966
3147
|
|
|
3148
|
+
{/* 📜 Журнал аудита (Спринт 26) */}
|
|
3149
|
+
<div style="width:100%;max-width:900px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
3150
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|
|
3151
|
+
<button
|
|
3152
|
+
onClick={() => setAuditCollapsed(!auditCollapsed())}
|
|
3153
|
+
style="display:flex;align-items:center;gap:8px;background:transparent;border:none;color:#e0e0e0;font-size:12px;font-weight:600;cursor:pointer;text-align:left;padding:0"
|
|
3154
|
+
>
|
|
3155
|
+
<span>📜 Журнал аудита</span>
|
|
3156
|
+
<span style="font-size:11px;font-weight:400;color:#8e8e93">{auditRecords().length}</span>
|
|
3157
|
+
<span style="font-size:11px;color:#8e8e93">{auditCollapsed() ? "▾" : "▴"}</span>
|
|
3158
|
+
</button>
|
|
3159
|
+
</div>
|
|
3160
|
+
|
|
3161
|
+
{!auditCollapsed() && (
|
|
3162
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
3163
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
3164
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">Действие</label>
|
|
3165
|
+
<input
|
|
3166
|
+
type="text"
|
|
3167
|
+
value={auditFilterAction()}
|
|
3168
|
+
placeholder="например task.create"
|
|
3169
|
+
onInput={(e) => setAuditFilterAction(e.currentTarget.value)}
|
|
3170
|
+
onChange={() => void loadAuditGui()}
|
|
3171
|
+
style="width:150px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3172
|
+
/>
|
|
3173
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">Источник</label>
|
|
3174
|
+
<input
|
|
3175
|
+
type="text"
|
|
3176
|
+
value={auditFilterActor()}
|
|
3177
|
+
placeholder="mcp/gui/http"
|
|
3178
|
+
onInput={(e) => setAuditFilterActor(e.currentTarget.value)}
|
|
3179
|
+
onChange={() => void loadAuditGui()}
|
|
3180
|
+
style="width:110px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3181
|
+
/>
|
|
3182
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">Цель</label>
|
|
3183
|
+
<input
|
|
3184
|
+
type="text"
|
|
3185
|
+
value={auditFilterTarget()}
|
|
3186
|
+
placeholder="имя задачи/секрета"
|
|
3187
|
+
onInput={(e) => setAuditFilterTarget(e.currentTarget.value)}
|
|
3188
|
+
onChange={() => void loadAuditGui()}
|
|
3189
|
+
style="width:180px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3190
|
+
/>
|
|
3191
|
+
<button
|
|
3192
|
+
onClick={() => void loadAuditGui()}
|
|
3193
|
+
disabled={auditBusy()}
|
|
3194
|
+
style={auditBusy()
|
|
3195
|
+
? "padding:6px 12px;background:#666;color:white;border:none;border-radius:6px;cursor:not-allowed;font-size:12px;font-weight:500;opacity:0.6"
|
|
3196
|
+
: "padding:6px 12px;background:#007acc;color:white;border:none;border-radius:6px;cursor:pointer;font-size:12px;font-weight:500;opacity:1"}
|
|
3197
|
+
>
|
|
3198
|
+
{auditBusy() ? "Загрузка..." : "Обновить"}
|
|
3199
|
+
</button>
|
|
3200
|
+
</div>
|
|
3201
|
+
<div style="width:100%;overflow:auto;border:1px solid #333;border-radius:6px;background:#0f0f0f">
|
|
3202
|
+
<table style="width:100%;border-collapse:collapse;font-size:11px">
|
|
3203
|
+
<thead>
|
|
3204
|
+
<tr style="border-bottom:1px solid #333">
|
|
3205
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Время</th>
|
|
3206
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Действие</th>
|
|
3207
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Цель</th>
|
|
3208
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Источник</th>
|
|
3209
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Автор</th>
|
|
3210
|
+
<th style="text-align:left;padding:6px 8px;color:#8e8e93">Удалён с</th>
|
|
3211
|
+
</tr>
|
|
3212
|
+
</thead>
|
|
3213
|
+
<tbody>
|
|
3214
|
+
{auditRecords().map((r) => (
|
|
3215
|
+
<tr key={r.id} style="border-bottom:1px solid #222">
|
|
3216
|
+
<td style="padding:5px 8px;color:#e0e0e0;white-space:nowrap">{new Date(r.ts).toLocaleString()}</td>
|
|
3217
|
+
<td style="padding:5px 8px;color:#569cd6">{r.action}</td>
|
|
3218
|
+
<td style="padding:5px 8px;color:#e0e0e0;white-space:nowrap">{r.targetType ?? ""}: {r.target ?? "—"}</td>
|
|
3219
|
+
<td style="padding:5px 8px;color:#ce9178">{r.source ?? "—"}</td>
|
|
3220
|
+
<td style="padding:5px 8px;color:#e0e0e0">{r.actor}</td>
|
|
3221
|
+
<td style="padding:5px 8px;color:#8e8e93;white-space:nowrap">{r.remote ?? "—"}</td>
|
|
3222
|
+
</tr>
|
|
3223
|
+
))}
|
|
3224
|
+
{auditRecords().length === 0 && (
|
|
3225
|
+
<tr>
|
|
3226
|
+
<td colspan="6" style="padding:10px 8px;color:#8e8e93;text-align:center">Записей аудита нет.</td>
|
|
3227
|
+
</tr>
|
|
3228
|
+
)}
|
|
3229
|
+
</tbody>
|
|
3230
|
+
</table>
|
|
3231
|
+
</div>
|
|
3232
|
+
<div style="font-size:11px;color:#8e8e93">
|
|
3233
|
+
Записываются мутации задач, настроек, шаблонов, профилей, рабочих зон, секретов, импорта и очистки истории. Детали маскируются (секреты заменены на <code style="color:#dcdcaa">***</code>).
|
|
3234
|
+
</div>
|
|
3235
|
+
</div>
|
|
3236
|
+
)}
|
|
3237
|
+
</div>
|
|
3238
|
+
|
|
3239
|
+
{/* 🧹 Настройки аудита (ретеншн) */}
|
|
3240
|
+
<div style="width:100%;max-width:700px;box-sizing:border-box;margin-top:8px;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
3241
|
+
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|
|
3242
|
+
<span style="font-size:12px;font-weight:600;color:#e0e0e0">Журнал аудита — хранение</span>
|
|
3243
|
+
</div>
|
|
3244
|
+
<div style="padding:0 14px 14px;display:flex;flex-direction:column;gap:10px">
|
|
3245
|
+
<div style="display:flex;align-items:center;gap:8px;flex-wrap:wrap">
|
|
3246
|
+
<label style="display:flex;align-items:center;gap:6px;font-size:12px;cursor:pointer">
|
|
3247
|
+
<input
|
|
3248
|
+
type="checkbox"
|
|
3249
|
+
checked={auditRetentionEnabled()}
|
|
3250
|
+
onChange={(e) => {
|
|
3251
|
+
setAuditRetentionEnabled(e.currentTarget.checked)
|
|
3252
|
+
void saveAuditSettings()
|
|
3253
|
+
}}
|
|
3254
|
+
style="accent-color:#5ac8fa;cursor:pointer;margin:0"
|
|
3255
|
+
/>
|
|
3256
|
+
Включить аудит
|
|
3257
|
+
</label>
|
|
3258
|
+
</div>
|
|
3259
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
3260
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">Удалять записи старше, дней</label>
|
|
3261
|
+
<input
|
|
3262
|
+
type="number"
|
|
3263
|
+
min="0"
|
|
3264
|
+
value={auditRetentionDays()}
|
|
3265
|
+
onChange={(e) => {
|
|
3266
|
+
setAuditRetentionDays(Math.max(0, Math.floor(Number(e.currentTarget.value) || 0)))
|
|
3267
|
+
void saveAuditSettings()
|
|
3268
|
+
}}
|
|
3269
|
+
style="width:80px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3270
|
+
/>
|
|
3271
|
+
<span style="font-size:11px;color:#8e8e93">0 = не удалять по возрасту</span>
|
|
3272
|
+
</div>
|
|
3273
|
+
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
3274
|
+
<label style="font-size:12px;color:#e0e0e0;white-space:nowrap">Хранить не более записей</label>
|
|
3275
|
+
<input
|
|
3276
|
+
type="number"
|
|
3277
|
+
min="0"
|
|
3278
|
+
value={auditMaxRecords()}
|
|
3279
|
+
onChange={(e) => {
|
|
3280
|
+
setAuditMaxRecords(Math.max(0, Math.floor(Number(e.currentTarget.value) || 0)))
|
|
3281
|
+
void saveAuditSettings()
|
|
3282
|
+
}}
|
|
3283
|
+
style="width:80px;padding:4px 6px;background:#1e1e1e;border:1px solid #333;border-radius:4px;color:#fff;font-size:12px;outline:none"
|
|
3284
|
+
/>
|
|
3285
|
+
<span style="font-size:11px;color:#8e8e93">0 = без ограничения</span>
|
|
3286
|
+
</div>
|
|
3287
|
+
</div>
|
|
3288
|
+
</div>
|
|
3289
|
+
|
|
2967
3290
|
{/* 📦 Multi-repo workspaces */}
|
|
2968
3291
|
<div style="width:100%;max-width:700px;box-sizing:border-box;background:#1e1e1e;border:1px solid #333;border-radius:10px;overflow:hidden">
|
|
2969
3292
|
<div style="display:flex;align-items:center;justify-content:space-between;gap:8px;padding:10px 14px">
|