@ddtcorex/dsh-maestro-core 0.10.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/LICENSE +21 -0
- package/README.md +209 -0
- package/cordis.patch.yml +43 -0
- package/lib/bin.d.ts +2 -0
- package/lib/bin.js +3 -0
- package/lib/boot-guard.d.ts +33 -0
- package/lib/boot-guard.js +68 -0
- package/lib/boot-lock.d.ts +56 -0
- package/lib/boot-lock.js +155 -0
- package/lib/cli.d.ts +31 -0
- package/lib/cli.js +336 -0
- package/lib/client.js +2901 -0
- package/lib/config/index.d.ts +34 -0
- package/lib/config/index.js +62 -0
- package/lib/config/service.d.ts +18 -0
- package/lib/config/service.js +28 -0
- package/lib/config.d.ts +1 -0
- package/lib/config.js +19 -0
- package/lib/daemon-freshness.d.ts +48 -0
- package/lib/daemon-freshness.js +122 -0
- package/lib/debug-agent.d.ts +17 -0
- package/lib/debug-agent.js +144 -0
- package/lib/dsh-session.d.ts +26 -0
- package/lib/dsh-session.js +45 -0
- package/lib/guard/config.d.ts +82 -0
- package/lib/guard/config.js +211 -0
- package/lib/guard/decide.d.ts +30 -0
- package/lib/guard/decide.js +38 -0
- package/lib/guard/full-scan-tool.d.ts +6 -0
- package/lib/guard/full-scan-tool.js +65 -0
- package/lib/guard/index.d.ts +85 -0
- package/lib/guard/index.js +254 -0
- package/lib/guard/journal.d.ts +146 -0
- package/lib/guard/journal.js +398 -0
- package/lib/guard/migrate.d.ts +15 -0
- package/lib/guard/migrate.js +42 -0
- package/lib/guard/parse.d.ts +193 -0
- package/lib/guard/parse.js +1103 -0
- package/lib/guard/paths.d.ts +104 -0
- package/lib/guard/paths.js +254 -0
- package/lib/guard/permission-policy.d.ts +10 -0
- package/lib/guard/permission-policy.js +21 -0
- package/lib/guard/redact.d.ts +25 -0
- package/lib/guard/redact.js +52 -0
- package/lib/guard/rules.d.ts +65 -0
- package/lib/guard/rules.js +832 -0
- package/lib/guard/status-tool.d.ts +54 -0
- package/lib/guard/status-tool.js +195 -0
- package/lib/guard/tiers.d.ts +2 -0
- package/lib/guard/tiers.js +1 -0
- package/lib/guard/validators.d.ts +4 -0
- package/lib/guard/validators.js +45 -0
- package/lib/health-poller.d.ts +90 -0
- package/lib/health-poller.js +430 -0
- package/lib/index.d.ts +7 -0
- package/lib/index.js +7 -0
- package/lib/intents.d.ts +32 -0
- package/lib/intents.js +49 -0
- package/lib/notifier.d.ts +12 -0
- package/lib/notifier.js +62 -0
- package/lib/paths.d.ts +13 -0
- package/lib/paths.js +70 -0
- package/lib/plugin.d.ts +250 -0
- package/lib/plugin.js +1126 -0
- package/lib/preset.d.ts +73 -0
- package/lib/preset.js +158 -0
- package/lib/report.d.ts +11 -0
- package/lib/report.js +58 -0
- package/lib/restart-exec.d.ts +35 -0
- package/lib/restart-exec.js +60 -0
- package/lib/restart-guards.d.ts +39 -0
- package/lib/restart-guards.js +150 -0
- package/lib/restart-tool.d.ts +124 -0
- package/lib/restart-tool.js +539 -0
- package/lib/restart-web.d.ts +26 -0
- package/lib/restart-web.js +58 -0
- package/lib/resume-log.d.ts +24 -0
- package/lib/resume-log.js +18 -0
- package/lib/resume-tools.d.ts +131 -0
- package/lib/resume-tools.js +337 -0
- package/lib/resume.d.ts +33 -0
- package/lib/resume.js +221 -0
- package/lib/scan.d.ts +20 -0
- package/lib/scan.js +71 -0
- package/lib/self-kill-guard.d.ts +81 -0
- package/lib/self-kill-guard.js +208 -0
- package/lib/session-health.d.ts +89 -0
- package/lib/session-health.js +274 -0
- package/lib/session-log-file.d.ts +22 -0
- package/lib/session-log-file.js +74 -0
- package/lib/skill-provider.d.ts +6 -0
- package/lib/skill-provider.js +73 -0
- package/lib/snapshot.d.ts +59 -0
- package/lib/snapshot.js +358 -0
- package/lib/source.d.ts +19 -0
- package/lib/source.js +19 -0
- package/lib/store/index.d.ts +42 -0
- package/lib/store/index.js +340 -0
- package/lib/store/legacy.d.ts +17 -0
- package/lib/store/legacy.js +85 -0
- package/lib/supervisor.d.ts +119 -0
- package/lib/supervisor.js +741 -0
- package/lib/sync/backup-config.d.ts +55 -0
- package/lib/sync/backup-config.js +119 -0
- package/lib/sync/backup-service.d.ts +110 -0
- package/lib/sync/backup-service.js +440 -0
- package/lib/sync/bidirectional.d.ts +39 -0
- package/lib/sync/bidirectional.js +25 -0
- package/lib/sync/cli.d.ts +38 -0
- package/lib/sync/cli.js +536 -0
- package/lib/sync/config.d.ts +77 -0
- package/lib/sync/config.js +90 -0
- package/lib/sync/fingerprint.d.ts +29 -0
- package/lib/sync/fingerprint.js +65 -0
- package/lib/sync/hashing.d.ts +9 -0
- package/lib/sync/hashing.js +47 -0
- package/lib/sync/index.d.ts +6 -0
- package/lib/sync/index.js +634 -0
- package/lib/sync/machine-id.d.ts +29 -0
- package/lib/sync/machine-id.js +66 -0
- package/lib/sync/merge.d.ts +33 -0
- package/lib/sync/merge.js +88 -0
- package/lib/sync/peer-host.d.ts +22 -0
- package/lib/sync/peer-host.js +62 -0
- package/lib/sync/process-runner.d.ts +31 -0
- package/lib/sync/process-runner.js +161 -0
- package/lib/sync/remote-agent.d.ts +42 -0
- package/lib/sync/remote-agent.js +217 -0
- package/lib/sync/remote-cache.d.ts +18 -0
- package/lib/sync/remote-cache.js +60 -0
- package/lib/sync/remote-manifest.d.ts +8 -0
- package/lib/sync/remote-manifest.js +64 -0
- package/lib/sync/s3-object-store.d.ts +38 -0
- package/lib/sync/s3-object-store.js +126 -0
- package/lib/sync/session-merge.d.ts +18 -0
- package/lib/sync/session-merge.js +191 -0
- package/lib/sync/session-plan.d.ts +29 -0
- package/lib/sync/session-plan.js +213 -0
- package/lib/sync/sigv4.d.ts +20 -0
- package/lib/sync/sigv4.js +57 -0
- package/lib/sync/snapshot.d.ts +21 -0
- package/lib/sync/snapshot.js +176 -0
- package/lib/sync/ssh-mux.d.ts +12 -0
- package/lib/sync/ssh-mux.js +48 -0
- package/lib/sync/sync-plan.d.ts +24 -0
- package/lib/sync/sync-plan.js +366 -0
- package/lib/sync/sync-service.d.ts +177 -0
- package/lib/sync/sync-service.js +819 -0
- package/lib/sync/sync-types.d.ts +87 -0
- package/lib/sync/sync-types.js +1 -0
- package/lib/sync/transport.d.ts +75 -0
- package/lib/sync/transport.js +200 -0
- package/lib/sync/tunnel-restore.d.ts +77 -0
- package/lib/sync/tunnel-restore.js +142 -0
- package/lib/sync/validation.d.ts +10 -0
- package/lib/sync/validation.js +83 -0
- package/lib/tool-view.d.ts +62 -0
- package/lib/tool-view.js +70 -0
- package/lib/types/client/auto-reload.d.ts +8 -0
- package/lib/types/client/auto-reload.d.ts.map +1 -0
- package/lib/types/client/config/MaestroSettings.d.ts +25 -0
- package/lib/types/client/config/MaestroSettings.d.ts.map +1 -0
- package/lib/types/client/config/components/BrandMark.d.ts +50 -0
- package/lib/types/client/config/components/BrandMark.d.ts.map +1 -0
- package/lib/types/client/config/guard-view.d.ts +83 -0
- package/lib/types/client/config/guard-view.d.ts.map +1 -0
- package/lib/types/client/config/index.d.ts +20 -0
- package/lib/types/client/config/index.d.ts.map +1 -0
- package/lib/types/client/config/maestro-mark.d.ts +29 -0
- package/lib/types/client/config/maestro-mark.d.ts.map +1 -0
- package/lib/types/client/config/settings-nav-icon.d.ts +21 -0
- package/lib/types/client/config/settings-nav-icon.d.ts.map +1 -0
- package/lib/types/client/index.d.ts +16 -0
- package/lib/types/client/index.d.ts.map +1 -0
- package/lib/types/client/sync/R2SyncPanel.d.ts +6 -0
- package/lib/types/client/sync/R2SyncPanel.d.ts.map +1 -0
- package/lib/types/client/sync/SyncPanel.d.ts +12 -0
- package/lib/types/client/sync/SyncPanel.d.ts.map +1 -0
- package/lib/types/client/sync/confirm-dialog.d.ts +43 -0
- package/lib/types/client/sync/confirm-dialog.d.ts.map +1 -0
- package/lib/types/client/sync/index.d.ts +10 -0
- package/lib/types/client/sync/index.d.ts.map +1 -0
- package/lib/types/client/sync/ui.d.ts +79 -0
- package/lib/types/client/sync/ui.d.ts.map +1 -0
- package/lib/types/client/sync/use-backup.d.ts +50 -0
- package/lib/types/client/sync/use-backup.d.ts.map +1 -0
- package/lib/types/client/sync/use-sync.d.ts +88 -0
- package/lib/types/client/sync/use-sync.d.ts.map +1 -0
- package/package.json +89 -0
- package/skills/dsh-safe-restart/SKILL.md +206 -0
- package/skills/dsh-safe-restart/scripts/restart-dsh-web.sh +468 -0
- package/src/client/auto-reload.ts +104 -0
- package/src/client/config/MaestroSettings.tsx +892 -0
- package/src/client/config/components/BrandMark.tsx +94 -0
- package/src/client/config/guard-view.ts +187 -0
- package/src/client/config/index.tsx +109 -0
- package/src/client/config/maestro-mark.ts +37 -0
- package/src/client/config/settings-nav-icon.ts +68 -0
- package/src/client/index.tsx +33 -0
- package/src/client/sync/R2SyncPanel.tsx +260 -0
- package/src/client/sync/SyncPanel.tsx +422 -0
- package/src/client/sync/confirm-dialog.tsx +202 -0
- package/src/client/sync/index.tsx +336 -0
- package/src/client/sync/ui.tsx +313 -0
- package/src/client/sync/use-backup.ts +207 -0
- package/src/client/sync/use-sync.ts +502 -0
- package/src/host/bin.ts +3 -0
- package/src/host/boot-guard.ts +76 -0
- package/src/host/boot-lock.ts +155 -0
- package/src/host/cli.ts +288 -0
- package/src/host/config/index.ts +78 -0
- package/src/host/config/service.ts +40 -0
- package/src/host/config.ts +18 -0
- package/src/host/daemon-freshness.ts +143 -0
- package/src/host/debug-agent.ts +145 -0
- package/src/host/dsh-session.ts +56 -0
- package/src/host/dsh-skill.d.ts +44 -0
- package/src/host/guard/augment.d.ts +33 -0
- package/src/host/guard/config.ts +244 -0
- package/src/host/guard/decide.ts +40 -0
- package/src/host/guard/full-scan-tool.ts +61 -0
- package/src/host/guard/index.ts +281 -0
- package/src/host/guard/journal.ts +440 -0
- package/src/host/guard/migrate.ts +41 -0
- package/src/host/guard/parse.ts +1150 -0
- package/src/host/guard/paths.ts +239 -0
- package/src/host/guard/permission-policy.ts +15 -0
- package/src/host/guard/redact.ts +64 -0
- package/src/host/guard/rules.ts +891 -0
- package/src/host/guard/status-tool.ts +229 -0
- package/src/host/guard/tiers.ts +2 -0
- package/src/host/guard/validators.ts +29 -0
- package/src/host/health-poller.ts +446 -0
- package/src/host/index.ts +7 -0
- package/src/host/intents.ts +67 -0
- package/src/host/notifier.ts +71 -0
- package/src/host/paths.ts +70 -0
- package/src/host/plugin.ts +1097 -0
- package/src/host/preset.ts +170 -0
- package/src/host/report.ts +71 -0
- package/src/host/restart-exec.ts +81 -0
- package/src/host/restart-guards.ts +150 -0
- package/src/host/restart-tool.ts +483 -0
- package/src/host/restart-web.ts +72 -0
- package/src/host/resume-log.ts +39 -0
- package/src/host/resume-tools.ts +385 -0
- package/src/host/resume.ts +204 -0
- package/src/host/scan.ts +61 -0
- package/src/host/self-kill-guard.ts +216 -0
- package/src/host/session-health.ts +236 -0
- package/src/host/session-log-file.ts +77 -0
- package/src/host/skill-provider.ts +69 -0
- package/src/host/snapshot.ts +337 -0
- package/src/host/source.ts +19 -0
- package/src/host/store/index.ts +348 -0
- package/src/host/store/legacy.ts +96 -0
- package/src/host/supervisor.ts +720 -0
- package/src/host/sync/backup-config.ts +159 -0
- package/src/host/sync/backup-service.ts +453 -0
- package/src/host/sync/bidirectional.ts +66 -0
- package/src/host/sync/cli.ts +539 -0
- package/src/host/sync/config.ts +119 -0
- package/src/host/sync/fingerprint.ts +83 -0
- package/src/host/sync/hashing.ts +58 -0
- package/src/host/sync/index.ts +737 -0
- package/src/host/sync/machine-id.ts +81 -0
- package/src/host/sync/merge.ts +102 -0
- package/src/host/sync/peer-host.ts +65 -0
- package/src/host/sync/process-runner.ts +177 -0
- package/src/host/sync/remote-agent.ts +213 -0
- package/src/host/sync/remote-cache.ts +68 -0
- package/src/host/sync/remote-manifest.ts +70 -0
- package/src/host/sync/s3-object-store.ts +144 -0
- package/src/host/sync/session-merge.ts +220 -0
- package/src/host/sync/session-plan.ts +237 -0
- package/src/host/sync/sigv4.ts +81 -0
- package/src/host/sync/snapshot.ts +162 -0
- package/src/host/sync/ssh-mux.ts +56 -0
- package/src/host/sync/sync-plan.ts +366 -0
- package/src/host/sync/sync-service.ts +855 -0
- package/src/host/sync/sync-types.ts +102 -0
- package/src/host/sync/transport.ts +261 -0
- package/src/host/sync/tunnel-restore.ts +160 -0
- package/src/host/sync/validation.ts +91 -0
- package/src/host/tool-view.ts +98 -0
|
@@ -0,0 +1,892 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Maestro Settings — DSH-native redesign.
|
|
4
|
+
* Reuses DeepSeek Harness design tokens & primitive geometry maximally:
|
|
5
|
+
* - --dsw-alias-* color family (no hard-coded hex except QR tile #fff)
|
|
6
|
+
* - Button variants primary/ghost/outline (h36 capsule / h28 small) — same as @deepseek-ai/dsh-client-ui-primitives/Button
|
|
7
|
+
* - Input atom (h32, radius 8, bg-layer-1, focus border brand) — same as primitives/Input
|
|
8
|
+
* - DisclosureRow (24px row, 14px glyph, chevron hover) — same as primitives/DisclosureRow
|
|
9
|
+
* - Panel chroma: inner cards use bg-layer-2 / border-l2 / radius 12 / shadow lv3 where needed
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { createElement as h, useEffect, useState } from 'react'
|
|
13
|
+
import { RULE_META, effectiveGuardView, ruleTierPatch } from './guard-view.js'
|
|
14
|
+
import type { GuardTier } from './guard-view.js'
|
|
15
|
+
import { BrandBadge } from './components/BrandMark.js'
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// DSH tokens — single source, no custom hex (except QR quiet zone #fff)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
const t = {
|
|
21
|
+
bgLayer1: 'var(--dsw-alias-bg-layer-1)',
|
|
22
|
+
bgLayer2: 'var(--dsw-alias-bg-layer-2)',
|
|
23
|
+
bgLayer3: 'var(--dsw-alias-bg-layer-3)',
|
|
24
|
+
borderL2: 'var(--dsw-alias-border-l2)',
|
|
25
|
+
labelPrimary: 'var(--dsw-alias-label-primary)',
|
|
26
|
+
labelSecondary: 'var(--dsw-alias-label-secondary)',
|
|
27
|
+
labelTertiary: 'var(--dsw-alias-label-tertiary)',
|
|
28
|
+
labelDimmed: 'var(--dsw-alias-label-dimmed)',
|
|
29
|
+
labelFg: 'var(--dsw-alias-label-primary-foreground)',
|
|
30
|
+
primaryFill: 'var(--dsw-alias-button-primary-fill)',
|
|
31
|
+
primaryHover: 'var(--dsw-alias-button-primary-hover)',
|
|
32
|
+
interactiveHover: 'var(--dsw-alias-interactive-bg-hover)',
|
|
33
|
+
interactiveActive: 'var(--dsw-alias-interactive-bg-active)',
|
|
34
|
+
stateError: 'var(--dsw-alias-state-error-primary)',
|
|
35
|
+
brand: 'var(--dsw-alias-brand-primary)',
|
|
36
|
+
shadowLv3: 'var(--dsw-shadow-lv3)',
|
|
37
|
+
scrollbarL2: 'var(--dsw-alias-scrollbar-bg-l2)',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ---------------------------------------------------------------------------
|
|
41
|
+
// Nested pill tabs — unified with dsh-maestro-jobs (maestro-design: Minimalism & Swiss)
|
|
42
|
+
// Shared geometry: 40px min-height (44px jobs → 40px unified, touch-friendly ≥24px WCAG),
|
|
43
|
+
// 14px icon + 13px label gap 6, pill 999, border-l1, #EBEEF2 active, hover, focus ring.
|
|
44
|
+
// Icons: lucide-style 14px SVG, stroke 1.8, currentColor.
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
type TabIcon = 'shield' | 'cpu'
|
|
47
|
+
const TAB_ICON_PATHS: Record<TabIcon, string> = {
|
|
48
|
+
shield: 'M12 2l7 4v5c0 5-3.5 7.5-7 9-3.5-1.5-7-4-7-9V6l7-4z',
|
|
49
|
+
cpu: 'M5 12H2a2 2 0 0 1 2-2h2M12 5V2a2 2 0 0 1 2 2v2M19 12h2a2 2 0 0 1-2 2h-2M12 19v2a2 2 0 0 1-2-2v-2M8 8h8v8H8z',
|
|
50
|
+
}
|
|
51
|
+
function TabIcon({ name, size = 14 }: { name: TabIcon; size?: number }) {
|
|
52
|
+
return h('svg', { width: size, height: size, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 1.8, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': 'true', style: { flex: 'none' } }, h('path', { d: TAB_ICON_PATHS[name] }))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// Lightweight DSH primitive mirrors (geometry + tokens identical to host)
|
|
57
|
+
// Usage is identical to @deepseek-ai/dsh-client-ui-primitives at runtime.
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
type ButtonVariant = 'primary' | 'ghost' | 'outline'
|
|
60
|
+
function Button({
|
|
61
|
+
variant = 'ghost',
|
|
62
|
+
size = 'md',
|
|
63
|
+
icon,
|
|
64
|
+
children,
|
|
65
|
+
style,
|
|
66
|
+
...rest
|
|
67
|
+
}: {
|
|
68
|
+
variant?: ButtonVariant
|
|
69
|
+
size?: 'md' | 'sm'
|
|
70
|
+
icon?: unknown
|
|
71
|
+
children?: unknown
|
|
72
|
+
style?: Record<string, unknown>
|
|
73
|
+
} & Record<string, unknown>) {
|
|
74
|
+
const base: Record<string, unknown> = {
|
|
75
|
+
display: 'inline-flex',
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
justifyContent: 'center',
|
|
78
|
+
gap: 4,
|
|
79
|
+
border: 'none',
|
|
80
|
+
borderRadius: size === 'sm' ? 16 : 18,
|
|
81
|
+
cursor: 'pointer',
|
|
82
|
+
fontSize: size === 'sm' ? 13 : 14,
|
|
83
|
+
lineHeight: size === 'sm' ? '18px' : '22px',
|
|
84
|
+
padding: size === 'sm' ? '0 12px' : '0 14px',
|
|
85
|
+
height: size === 'sm' ? 32 : 36,
|
|
86
|
+
color: t.labelPrimary,
|
|
87
|
+
background: 'transparent',
|
|
88
|
+
fontFamily: 'inherit',
|
|
89
|
+
}
|
|
90
|
+
if (variant === 'primary') {
|
|
91
|
+
base.background = t.primaryFill
|
|
92
|
+
base.color = t.labelFg
|
|
93
|
+
}
|
|
94
|
+
if (variant === 'outline') {
|
|
95
|
+
base.border = `1px solid ${t.borderL2}`
|
|
96
|
+
base.background = 'transparent'
|
|
97
|
+
}
|
|
98
|
+
const merged = { ...base, ...(style as object) } as Record<string, string>
|
|
99
|
+
return h(
|
|
100
|
+
'button',
|
|
101
|
+
{
|
|
102
|
+
type: 'button',
|
|
103
|
+
style: merged,
|
|
104
|
+
onMouseEnter: (e: any) => {
|
|
105
|
+
if ((rest as any).disabled) return
|
|
106
|
+
if (variant === 'primary') (e.currentTarget as HTMLElement).style.background = t.primaryHover as string
|
|
107
|
+
else (e.currentTarget as HTMLElement).style.background = t.interactiveHover as string
|
|
108
|
+
},
|
|
109
|
+
onMouseLeave: (e: any) => {
|
|
110
|
+
if (variant === 'primary') (e.currentTarget as HTMLElement).style.background = t.primaryFill as string
|
|
111
|
+
else (e.currentTarget as HTMLElement).style.background = variant === 'outline' ? 'transparent' : 'transparent'
|
|
112
|
+
},
|
|
113
|
+
...(rest as any),
|
|
114
|
+
},
|
|
115
|
+
icon ? h('span', { style: { display: 'inline-flex', width: 16, height: 16, alignItems: 'center', justifyContent: 'center' } }, icon as any) : null,
|
|
116
|
+
children as any,
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function InputWrap({
|
|
121
|
+
icon,
|
|
122
|
+
children,
|
|
123
|
+
style,
|
|
124
|
+
focused,
|
|
125
|
+
}: {
|
|
126
|
+
icon?: unknown
|
|
127
|
+
children: unknown
|
|
128
|
+
style?: Record<string, unknown>
|
|
129
|
+
focused?: boolean
|
|
130
|
+
}) {
|
|
131
|
+
return h(
|
|
132
|
+
'span',
|
|
133
|
+
{
|
|
134
|
+
style: {
|
|
135
|
+
display: 'inline-flex',
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
gap: 8,
|
|
138
|
+
height: 36,
|
|
139
|
+
padding: '0 12px',
|
|
140
|
+
border: `1px solid ${focused ? t.brand : t.borderL2}`,
|
|
141
|
+
borderRadius: 10,
|
|
142
|
+
background: t.bgLayer1,
|
|
143
|
+
flex: 1,
|
|
144
|
+
minWidth: 0,
|
|
145
|
+
boxSizing: 'border-box' as const,
|
|
146
|
+
...(style as object),
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
icon
|
|
150
|
+
? h('span', { style: { display: 'inline-flex', width: 16, height: 16, color: t.labelTertiary } }, icon as any)
|
|
151
|
+
: null,
|
|
152
|
+
children as any,
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function FieldInput(props: React.InputHTMLAttributes<HTMLInputElement> & { icon?: unknown }) {
|
|
157
|
+
const [focused, setFocused] = useState(false)
|
|
158
|
+
const { icon, style, ...rest } = props as any
|
|
159
|
+
return h(
|
|
160
|
+
InputWrap as any,
|
|
161
|
+
{ icon, focused, style: { ...(style as object), flex: '1 1 auto' } },
|
|
162
|
+
h('input', {
|
|
163
|
+
...(rest as any),
|
|
164
|
+
onFocus: (e: any) => {
|
|
165
|
+
setFocused(true)
|
|
166
|
+
;(rest as any).onFocus?.(e)
|
|
167
|
+
},
|
|
168
|
+
onBlur: (e: any) => {
|
|
169
|
+
setFocused(false)
|
|
170
|
+
;(rest as any).onBlur?.(e)
|
|
171
|
+
},
|
|
172
|
+
style: {
|
|
173
|
+
flex: 1,
|
|
174
|
+
minWidth: 0,
|
|
175
|
+
border: 'none',
|
|
176
|
+
outline: 'none',
|
|
177
|
+
background: 'transparent',
|
|
178
|
+
fontSize: 14,
|
|
179
|
+
lineHeight: '22px',
|
|
180
|
+
color: t.labelPrimary,
|
|
181
|
+
fontFamily: 'inherit',
|
|
182
|
+
},
|
|
183
|
+
}),
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// DSH DisclosureRow — 24px row, 14px glyph, hover chevron swap, same semantics as host
|
|
188
|
+
function DisclosureRow({
|
|
189
|
+
icon,
|
|
190
|
+
title,
|
|
191
|
+
caption,
|
|
192
|
+
open,
|
|
193
|
+
expandable,
|
|
194
|
+
onToggle,
|
|
195
|
+
children,
|
|
196
|
+
}: {
|
|
197
|
+
icon: unknown
|
|
198
|
+
title: string
|
|
199
|
+
caption?: string
|
|
200
|
+
open: boolean
|
|
201
|
+
expandable: boolean
|
|
202
|
+
onToggle: () => void
|
|
203
|
+
children?: unknown
|
|
204
|
+
}) {
|
|
205
|
+
const rowExpands = expandable
|
|
206
|
+
return h(
|
|
207
|
+
'div',
|
|
208
|
+
{ style: { display: 'flex', flexDirection: 'column', width: '100%', minWidth: 0 } },
|
|
209
|
+
h(
|
|
210
|
+
'div',
|
|
211
|
+
{
|
|
212
|
+
role: rowExpands ? 'button' : undefined,
|
|
213
|
+
tabIndex: rowExpands ? 0 : undefined,
|
|
214
|
+
'aria-expanded': rowExpands ? open : undefined,
|
|
215
|
+
onClick: rowExpands ? onToggle : undefined,
|
|
216
|
+
onKeyDown: rowExpands
|
|
217
|
+
? (e: any) => {
|
|
218
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
219
|
+
e.preventDefault()
|
|
220
|
+
onToggle()
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
: undefined,
|
|
224
|
+
style: {
|
|
225
|
+
display: 'flex',
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
gap: 8,
|
|
228
|
+
minHeight: 40,
|
|
229
|
+
padding: '8px 10px',
|
|
230
|
+
borderRadius: 12,
|
|
231
|
+
cursor: rowExpands ? 'pointer' : 'default',
|
|
232
|
+
background: open ? 'var(--dsw-specific-sidebar-nav-item-active)' : 'transparent',
|
|
233
|
+
border: `1px solid ${open ? t.borderL2 : 'transparent'}`,
|
|
234
|
+
boxSizing: 'border-box' as const,
|
|
235
|
+
},
|
|
236
|
+
onMouseEnter: (e: any) => {
|
|
237
|
+
if (!open) (e.currentTarget as HTMLElement).style.background = 'var(--dsw-specific-sidebar-nav-item-hover)'
|
|
238
|
+
},
|
|
239
|
+
onMouseLeave: (e: any) => {
|
|
240
|
+
if (!open) (e.currentTarget as HTMLElement).style.background = 'transparent'
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
expandable
|
|
244
|
+
? h(
|
|
245
|
+
'button',
|
|
246
|
+
{
|
|
247
|
+
type: 'button',
|
|
248
|
+
'aria-expanded': open,
|
|
249
|
+
onClick: (e: any) => {
|
|
250
|
+
e.stopPropagation()
|
|
251
|
+
onToggle()
|
|
252
|
+
},
|
|
253
|
+
style: {
|
|
254
|
+
flex: 'none',
|
|
255
|
+
width: 20,
|
|
256
|
+
height: 20,
|
|
257
|
+
display: 'inline-flex',
|
|
258
|
+
alignItems: 'center',
|
|
259
|
+
justifyContent: 'center',
|
|
260
|
+
border: 'none',
|
|
261
|
+
background: 'none',
|
|
262
|
+
cursor: 'pointer',
|
|
263
|
+
color: t.labelTertiary,
|
|
264
|
+
padding: 0,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
open
|
|
268
|
+
? h('span', { style: { fontSize: 12, lineHeight: 1 } }, '▾')
|
|
269
|
+
: h('span', { style: { fontSize: 12, lineHeight: 1 } }, '▸'),
|
|
270
|
+
)
|
|
271
|
+
: h('span', { style: { width: 20, display: 'inline-flex', justifyContent: 'center', color: t.labelTertiary, flex: 'none' } }, icon as any),
|
|
272
|
+
h('span', { style: { flex: 1, minWidth: 0 } },
|
|
273
|
+
h('span', { style: { display: 'block', fontSize: 14, lineHeight: '20px', fontWeight: 500, color: t.labelPrimary } }, title),
|
|
274
|
+
caption ? h('span', { style: { display: 'block', fontSize: 12, lineHeight: '16px', color: t.labelSecondary, marginTop: 1 } }, caption) : null,
|
|
275
|
+
),
|
|
276
|
+
!open && expandable
|
|
277
|
+
? h('span', { style: { color: t.labelTertiary, fontSize: 12 } }, '›')
|
|
278
|
+
: null,
|
|
279
|
+
),
|
|
280
|
+
open ? h('div', { style: { padding: '10px 0 14px 30px', display: 'flex', flexDirection: 'column', gap: 10 } }, children as any) : null,
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// ---------------------------------------------------------------------------
|
|
285
|
+
// Shared field helpers — DSH-native label / caption rhythm
|
|
286
|
+
// ---------------------------------------------------------------------------
|
|
287
|
+
const fieldLabelStyle: Record<string, string> = {
|
|
288
|
+
display: 'flex',
|
|
289
|
+
flexDirection: 'column',
|
|
290
|
+
gap: '6px',
|
|
291
|
+
fontSize: '12px',
|
|
292
|
+
lineHeight: '16px',
|
|
293
|
+
fontWeight: '500',
|
|
294
|
+
color: t.labelSecondary as string,
|
|
295
|
+
margin: '12px 0 0',
|
|
296
|
+
}
|
|
297
|
+
const captionStyle: Record<string, string> = {
|
|
298
|
+
fontSize: '12px',
|
|
299
|
+
lineHeight: '16px',
|
|
300
|
+
color: t.labelSecondary as string,
|
|
301
|
+
margin: '4px 0',
|
|
302
|
+
}
|
|
303
|
+
const cardInsetStyle: Record<string, string> = {
|
|
304
|
+
display: 'flex',
|
|
305
|
+
flexDirection: 'column',
|
|
306
|
+
gap: '8px',
|
|
307
|
+
padding: '12px',
|
|
308
|
+
borderRadius: '12px',
|
|
309
|
+
border: `1px solid ${t.borderL2}`,
|
|
310
|
+
background: t.bgLayer1 as string,
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// ---------------------------------------------------------------------------
|
|
314
|
+
// DSH General row — title + desc left, control right, 16px 0, border-bottom
|
|
315
|
+
// ---------------------------------------------------------------------------
|
|
316
|
+
const rowStyle: Record<string, string> = {
|
|
317
|
+
display: 'flex',
|
|
318
|
+
alignItems: 'center',
|
|
319
|
+
gap: '8px',
|
|
320
|
+
padding: '16px 0',
|
|
321
|
+
borderBottom: `1px solid ${t.borderL2}`,
|
|
322
|
+
minWidth: '0',
|
|
323
|
+
}
|
|
324
|
+
const rowTextStyle: Record<string, string> = {
|
|
325
|
+
flex: '1',
|
|
326
|
+
minWidth: '0',
|
|
327
|
+
display: 'flex',
|
|
328
|
+
flexDirection: 'column',
|
|
329
|
+
gap: '4px',
|
|
330
|
+
paddingRight: '48px',
|
|
331
|
+
}
|
|
332
|
+
const rowTitleStyle: Record<string, string> = {
|
|
333
|
+
fontSize: '14px',
|
|
334
|
+
fontWeight: '400',
|
|
335
|
+
lineHeight: '22px',
|
|
336
|
+
color: t.labelPrimary as string,
|
|
337
|
+
}
|
|
338
|
+
const rowDescStyle: Record<string, string> = {
|
|
339
|
+
fontSize: '12px',
|
|
340
|
+
fontWeight: '400',
|
|
341
|
+
lineHeight: '18px',
|
|
342
|
+
color: t.labelTertiary as string,
|
|
343
|
+
}
|
|
344
|
+
// Pill selector — same as LanguageRow/EnterBehaviorRow: h36 r18 bg-module-platform
|
|
345
|
+
const pillSelectorStyle: Record<string, string> = {
|
|
346
|
+
display: 'inline-flex',
|
|
347
|
+
alignItems: 'center',
|
|
348
|
+
gap: '12px',
|
|
349
|
+
height: '36px',
|
|
350
|
+
padding: '0 14px',
|
|
351
|
+
border: 'none',
|
|
352
|
+
borderRadius: '18px',
|
|
353
|
+
background: 'var(--dsw-alias-bg-module-platform, #F5F6F7)',
|
|
354
|
+
font: 'inherit',
|
|
355
|
+
fontSize: '14px',
|
|
356
|
+
lineHeight: '22px',
|
|
357
|
+
color: t.labelPrimary as string,
|
|
358
|
+
cursor: 'pointer',
|
|
359
|
+
whiteSpace: 'nowrap',
|
|
360
|
+
}
|
|
361
|
+
function SettingRow({ title, description, control }: { title: string; description?: string; control: unknown }) {
|
|
362
|
+
return h(
|
|
363
|
+
'div',
|
|
364
|
+
{ 'data-maestro-row': '', style: rowStyle },
|
|
365
|
+
h('div', { 'data-maestro-row-text': '', style: rowTextStyle }, h('div', { style: rowTitleStyle }, title), description ? h('div', { style: rowDescStyle }, description) : null),
|
|
366
|
+
h('div', { 'data-maestro-control': '', style: { flex: 'none', display: 'flex', alignItems: 'center', justifyContent: 'flex-end', gap: 8, minHeight: '36px' } }, control as any),
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* A boolean settings row.
|
|
371
|
+
*
|
|
372
|
+
* `disabled` exists for one honest case: a value that an install-supplied
|
|
373
|
+
* Cordis `config:` block pins at a higher precedence than this store, so the
|
|
374
|
+
* checkbox would look interactive and silently do nothing. A locked row still
|
|
375
|
+
* shows the *effective* value (not the store's shadowed one) and says why.
|
|
376
|
+
*/
|
|
377
|
+
function ToggleRow({ title, description, checked, onChange, disabled }: { title: string; description?: string; checked?: boolean; onChange: (v: boolean) => void; disabled?: boolean }) {
|
|
378
|
+
const locked = disabled === true
|
|
379
|
+
return h(
|
|
380
|
+
'label',
|
|
381
|
+
{
|
|
382
|
+
'data-maestro-row': '',
|
|
383
|
+
'data-maestro-locked': locked ? 'true' : undefined,
|
|
384
|
+
style: { ...rowStyle, cursor: locked ? 'default' : 'pointer', alignItems: 'flex-start', opacity: locked ? 0.65 : 1 },
|
|
385
|
+
},
|
|
386
|
+
h('input', { type: 'checkbox', checked: checked === true, disabled: locked, 'aria-disabled': locked ? 'true' : undefined, onChange: (e: any) => { if (!locked) onChange(e.target.checked) }, style: { width: 16, height: 16, accentColor: t.primaryFill as string, marginTop: 4, flex: 'none' } }),
|
|
387
|
+
h('div', { 'data-maestro-row-text': '', style: { ...rowTextStyle, paddingRight: '0' } }, h('div', { style: rowTitleStyle }, title), description ? h('div', { style: rowDescStyle }, description) : null),
|
|
388
|
+
)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function deepMergeGuard(base: any, patch: any): any {
|
|
392
|
+
if (typeof base !== 'object' || base === null || Array.isArray(base)) return patch
|
|
393
|
+
if (typeof patch !== 'object' || patch === null || Array.isArray(patch)) return patch
|
|
394
|
+
const out: any = { ...base }
|
|
395
|
+
for (const key of Object.keys(patch)) out[key] = key in out ? deepMergeGuard(out[key], patch[key]) : patch[key]
|
|
396
|
+
return out
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// CommitField — a text input with a local draft committed on blur / Enter.
|
|
400
|
+
// Same no-per-keystroke contract as SecretField, for plain (non-secret)
|
|
401
|
+
// values: the store never sees a half-typed string.
|
|
402
|
+
function CommitField({ value, placeholder, onCommit, width, ariaLabel }: { value: string; placeholder: string; onCommit: (v: string) => void; width?: number; ariaLabel?: string }) {
|
|
403
|
+
const [draft, setDraft] = useState(value)
|
|
404
|
+
const [focused, setFocused] = useState(false)
|
|
405
|
+
useEffect(() => {
|
|
406
|
+
if (!focused) setDraft(value)
|
|
407
|
+
}, [value, focused])
|
|
408
|
+
return h(FieldInput as any, {
|
|
409
|
+
value: draft,
|
|
410
|
+
placeholder,
|
|
411
|
+
onChange: (e: any) => setDraft(e.target.value),
|
|
412
|
+
onFocus: () => setFocused(true),
|
|
413
|
+
onBlur: (e: any) => {
|
|
414
|
+
setFocused(false)
|
|
415
|
+
if (e.target.value !== value) onCommit(e.target.value)
|
|
416
|
+
},
|
|
417
|
+
onKeyDown: (e: any) => {
|
|
418
|
+
if (e.key === 'Enter') (e.target as HTMLInputElement).blur()
|
|
419
|
+
},
|
|
420
|
+
'aria-label': ariaLabel ?? placeholder,
|
|
421
|
+
style: { width: width ?? 260 } as any,
|
|
422
|
+
})
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// ListEditor — one input row per value with add/remove, for multi-value
|
|
426
|
+
// fields (branches, paths). A comma-joined single input would split a path
|
|
427
|
+
// that legitimately contains a comma or spaces, and gives no per-item
|
|
428
|
+
// affordance; rows commit the whole list at once, never per keystroke.
|
|
429
|
+
function ListEditor({ values, placeholder, onCommit, ariaLabel, emptyHint }: { values: string[]; placeholder: string; onCommit: (v: string[]) => void; ariaLabel: string; emptyHint?: string }) {
|
|
430
|
+
const [drafts, setDrafts] = useState(values)
|
|
431
|
+
const [editing, setEditing] = useState(false)
|
|
432
|
+
useEffect(() => {
|
|
433
|
+
if (!editing) setDrafts(values)
|
|
434
|
+
}, [values, editing])
|
|
435
|
+
const keyOf = (ds: string[]) => ds.join('\n')
|
|
436
|
+
const commitRows = (rows: string[]) => {
|
|
437
|
+
const cleaned = rows.map((s) => s.trim()).filter((s) => s !== '')
|
|
438
|
+
if (keyOf(cleaned) !== keyOf(values)) onCommit(cleaned)
|
|
439
|
+
setDrafts(cleaned.length > 0 ? cleaned : [])
|
|
440
|
+
setEditing(false)
|
|
441
|
+
}
|
|
442
|
+
return h(
|
|
443
|
+
'div',
|
|
444
|
+
{ 'data-maestro-list': '', style: { display: 'flex', flexDirection: 'column', gap: 8, width: '100%', minWidth: 0 } },
|
|
445
|
+
drafts.length === 0
|
|
446
|
+
? h('p', { style: { ...captionStyle, margin: 0 } }, emptyHint ?? 'No entries.')
|
|
447
|
+
: null,
|
|
448
|
+
...drafts.map((draft, i) =>
|
|
449
|
+
h(
|
|
450
|
+
'div',
|
|
451
|
+
{ key: `${i}`, style: { display: 'flex', gap: 8, alignItems: 'center', minWidth: 0 } },
|
|
452
|
+
h(FieldInput as any, {
|
|
453
|
+
value: draft,
|
|
454
|
+
placeholder,
|
|
455
|
+
onChange: (e: any) => {
|
|
456
|
+
setEditing(true)
|
|
457
|
+
setDrafts((prev: string[]) => prev.map((d, j) => (j === i ? e.target.value : d)))
|
|
458
|
+
},
|
|
459
|
+
onFocus: () => setEditing(true),
|
|
460
|
+
onBlur: () => commitRows(drafts),
|
|
461
|
+
onKeyDown: (e: any) => {
|
|
462
|
+
if (e.key === 'Enter') (e.target as HTMLInputElement).blur()
|
|
463
|
+
},
|
|
464
|
+
'aria-label': `${ariaLabel} ${i + 1}`,
|
|
465
|
+
style: { flex: '1 1 auto', minWidth: 0 } as any,
|
|
466
|
+
}),
|
|
467
|
+
h(
|
|
468
|
+
Button as any,
|
|
469
|
+
{
|
|
470
|
+
variant: 'outline', size: 'sm',
|
|
471
|
+
onClick: () => commitRows(drafts.filter((_, j) => j !== i)),
|
|
472
|
+
'aria-label': `Remove ${ariaLabel} ${i + 1}`, title: 'Remove entry',
|
|
473
|
+
},
|
|
474
|
+
'✕',
|
|
475
|
+
),
|
|
476
|
+
),
|
|
477
|
+
),
|
|
478
|
+
h(
|
|
479
|
+
'div',
|
|
480
|
+
null,
|
|
481
|
+
h(Button as any, { variant: 'outline', size: 'sm', onClick: () => { setEditing(true); setDrafts((prev: string[]) => [...prev, '']) } }, '+ Add entry'),
|
|
482
|
+
),
|
|
483
|
+
)
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
function ToggleField({ label, caption, checked, onChange }: { label: string; caption?: string; checked?: boolean; onChange: (v: boolean) => void }) {
|
|
487
|
+
return h(
|
|
488
|
+
'label',
|
|
489
|
+
{ style: { display: 'flex', alignItems: 'flex-start', gap: 10, margin: '8px 0', cursor: 'pointer' } },
|
|
490
|
+
h('input', { type: 'checkbox', checked: checked === true, onChange: (e: any) => onChange(e.target.checked), style: { marginTop: 4, width: 16, height: 16, accentColor: t.primaryFill as string } }),
|
|
491
|
+
h('span', null, h('div', { style: { fontSize: 13, color: t.labelPrimary as string, lineHeight: '18px' } }, label), caption ? h('div', { style: captionStyle }, caption) : null),
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export function MaestroSettingsTab({ configRpcCall, supervisorRpcCall }: { configRpcCall?: any; supervisorRpcCall?: any }) {
|
|
496
|
+
const [guard, setGuard] = useState<any>({})
|
|
497
|
+
const [patterns, setPatterns] = useState<string[]>([])
|
|
498
|
+
// Effective auto-resume state reported by the in-tree supervisor plugin
|
|
499
|
+
// (`/dsh-maestro-supervisor-resume` → `status`). null = supervisor not
|
|
500
|
+
// installed or not answering yet — the toggle then renders unlocked, which
|
|
501
|
+
// is the pre-existing behavior.
|
|
502
|
+
const [supervisorStatus, setSupervisorStatus] = useState<any>(null)
|
|
503
|
+
const [supervisorCfg, setSupervisorCfg] = useState<any>({})
|
|
504
|
+
const [activeTab, setActiveTab] = useState('guard')
|
|
505
|
+
// Mobile: inject responsive overrides once (mirrors dsh-maestro-mobile settings-sheet pill pattern + market catsWrap)
|
|
506
|
+
useEffect(() => {
|
|
507
|
+
const css = `
|
|
508
|
+
/* Model override dropdown — prevent right-edge overlap */
|
|
509
|
+
[data-maestro-control] [data-maestro-menu] { left:auto !important; right:0 !important; }
|
|
510
|
+
[data-maestro-project-card] [data-maestro-menu] { left:auto !important; right:0 !important; }
|
|
511
|
+
[data-maestro-trigger-wrap] { min-width:0; }
|
|
512
|
+
/* Maestro nested tabs — unified with dsh-maestro-jobs (maestro-design pill bar) */
|
|
513
|
+
[data-maestro-tabs] { display:flex; gap:6px; overflow-x:auto; overflow-y:hidden; scrollbar-width:none; -webkit-overflow-scrolling:touch; overscroll-behavior-x:contain; touch-action:pan-x; padding:2px 2px 8px; margin:0 -2px 4px; border-bottom:1px solid var(--dsw-alias-border-l1, rgba(0,0,0,.08)); }
|
|
514
|
+
[data-maestro-tabs]::-webkit-scrollbar { display:none; width:0; height:0; }
|
|
515
|
+
[data-maestro-tab] { flex:none; min-width:fit-content; min-height:40px; padding:0 14px; border-radius:999px; border:1px solid var(--dsw-alias-border-l1, rgba(0,0,0,.12)); background:transparent; color:var(--dsw-alias-label-secondary); font-size:13px; line-height:20px; font-weight:500; font-family:inherit; white-space:nowrap; display:inline-flex; align-items:center; justify-content:center; gap:6px; cursor:pointer; -webkit-tap-highlight-color:transparent; transition: background 150ms ease, color 150ms ease, border-color 150ms ease; touch-action:manipulation; }
|
|
516
|
+
[data-maestro-tab][data-active="true"] { background:var(--dsw-specific-sidebar-nav-item-active, #EBEEF2); border-color:var(--dsw-specific-sidebar-nav-item-active, #EBEEF2); color:var(--dsw-alias-label-primary); font-weight:600; }
|
|
517
|
+
[data-maestro-tab]:hover { background:var(--dsw-alias-interactive-bg-hover, rgba(0,0,0,.06)); }
|
|
518
|
+
[data-maestro-tab][data-active="true"]:hover { background:var(--dsw-specific-sidebar-nav-item-active, #EBEEF2); }
|
|
519
|
+
[data-maestro-tab]:focus-visible { outline:2px solid var(--dsw-alias-state-business-primary, #4f6ef7); outline-offset:1px; }
|
|
520
|
+
[data-maestro-tab]:active { transform: scale(.97); }
|
|
521
|
+
[data-maestro-panel] { width:100%; min-width:0; box-sizing:border-box; }
|
|
522
|
+
/* label/input overlap fix: flex column gap + full width */
|
|
523
|
+
[data-maestro-panel] label { gap:6px !important; }
|
|
524
|
+
[data-maestro-row]:last-child { border-bottom:none !important; }
|
|
525
|
+
[data-maestro-panel] label > span { width:100% !important; box-sizing:border-box !important; }
|
|
526
|
+
@media (prefers-reduced-motion: reduce) {
|
|
527
|
+
[data-maestro-tab] { transition: none !important; }
|
|
528
|
+
[data-maestro-tab]:active { transform: none !important; }
|
|
529
|
+
}
|
|
530
|
+
@media (max-width: 640px) {
|
|
531
|
+
[data-maestro-settings-card] { max-width:100% !important; gap:6px !important; padding:0 2px !important; }
|
|
532
|
+
/* Guard status card: stack the summary above the Reset button — the
|
|
533
|
+
DSH shell keeps its nav column beside the content on phones, so the
|
|
534
|
+
panel is ~200px wide and a side-by-side row wraps the button. */
|
|
535
|
+
[data-maestro-guard-status] { flex-direction:column !important; align-items:stretch !important; gap:8px !important; }
|
|
536
|
+
[data-maestro-guard-status] button { align-self:stretch !important; white-space:normal !important; max-width:100% !important; box-sizing:border-box !important; }
|
|
537
|
+
[data-maestro-tabs] { gap:6px !important; padding:2px 2px 8px !important; margin:0 -2px 8px !important; }
|
|
538
|
+
[data-maestro-tab] { min-height:40px !important; height:auto !important; padding:0 12px !important; font-size:13px !important; }
|
|
539
|
+
[data-maestro-qr-row] { flex-direction:column !important; align-items:flex-start !important; }
|
|
540
|
+
[data-maestro-trigger-wrap] { max-width:100% !important; }
|
|
541
|
+
[data-maestro-menu] { min-width:0 !important; max-width:calc(100vw - 32px) !important; left:0 !important; right:auto !important; }
|
|
542
|
+
[data-maestro-control] [data-maestro-menu] { left:0 !important; right:auto !important; }
|
|
543
|
+
[data-maestro-project-card] [data-maestro-menu] { left:0 !important; right:auto !important; }
|
|
544
|
+
[data-maestro-panel] label { gap:8px !important; }
|
|
545
|
+
div[data-maestro-row] { flex-direction:column !important; align-items:stretch !important; padding:12px 0 !important; }
|
|
546
|
+
[data-maestro-row-text] { padding-right:0 !important; }
|
|
547
|
+
[data-maestro-control] { width:100% !important; justify-content:flex-start !important; }
|
|
548
|
+
[data-maestro-control] > span { width:100% !important; }
|
|
549
|
+
[data-maestro-control] select { width:100% !important; }
|
|
550
|
+
[data-maestro-project-grid] { grid-template-columns:1fr !important; }
|
|
551
|
+
[data-maestro-project-card] { padding:10px !important; }
|
|
552
|
+
[data-maestro-project-profile-row] { flex-direction:column !important; align-items:stretch !important; }
|
|
553
|
+
[data-maestro-project-profile-row] > label { flex:1 1 100% !important; width:100% !important; }
|
|
554
|
+
}
|
|
555
|
+
@media (max-width: 390px) {
|
|
556
|
+
[data-maestro-tab] { min-height:38px !important; height:auto !important; padding:0 10px !important; font-size:12px !important; }
|
|
557
|
+
}
|
|
558
|
+
/* iOS 16px field floor hold (dsh-maestro-mobile zoom guard).
|
|
559
|
+
Every text field on the page is held at 16px under
|
|
560
|
+
html[data-mobile-nav-ios] inside this same predicate, because iOS WebKit
|
|
561
|
+
magnifies the visual viewport for a focused field below 16px. An earlier
|
|
562
|
+
revision of this panel opted its own fields back out to inherit for a
|
|
563
|
+
compact scale - and every tap on those fields zoomed the page on
|
|
564
|
+
iPhone, with modal sheets never blurring back. Function beats pixels:
|
|
565
|
+
hold the same 16px here. The :not(#…) clause matches every element (no node
|
|
566
|
+
carries that id) and exists purely for id-level specificity: the floor
|
|
567
|
+
carries ten :not([type=…]) clauses, so an equal-specificity !important rule
|
|
568
|
+
keeps winning over competing field rules. Android and desktop never carry
|
|
569
|
+
the marker, so the compact scale they were designed with is untouched. */
|
|
570
|
+
@media (max-width: 1023px) and (pointer: coarse) {
|
|
571
|
+
html[data-mobile-nav-ios] [data-maestro-panel] input:not(#dsh-field-floor-opt-out),
|
|
572
|
+
html[data-mobile-nav-ios] [data-maestro-panel] textarea:not(#dsh-field-floor-opt-out),
|
|
573
|
+
html[data-mobile-nav-ios] [data-maestro-panel] select:not(#dsh-field-floor-opt-out) { font-size:16px !important; }
|
|
574
|
+
}
|
|
575
|
+
`
|
|
576
|
+
const tag = document.createElement('style')
|
|
577
|
+
tag.dataset.plugin = '@ddtcorex/dsh-maestro-config'
|
|
578
|
+
tag.dataset.pluginCss = 'maestro/mobile-tabs.css'
|
|
579
|
+
tag.textContent = css
|
|
580
|
+
document.head.appendChild(tag)
|
|
581
|
+
return () => tag.remove()
|
|
582
|
+
}, [])
|
|
583
|
+
|
|
584
|
+
const unwrap = (res: any) => {
|
|
585
|
+
if (res && typeof res === 'object' && 'ok' in res) {
|
|
586
|
+
if (res.ok) return res.value
|
|
587
|
+
throw new Error(res.error?.message ?? 'RPC failed')
|
|
588
|
+
}
|
|
589
|
+
return res
|
|
590
|
+
}
|
|
591
|
+
const cfgGet = async (domain: string) => {
|
|
592
|
+
if (!configRpcCall) throw new Error('config RPC not available')
|
|
593
|
+
const res = await configRpcCall('get', { domain })
|
|
594
|
+
return unwrap(res)
|
|
595
|
+
}
|
|
596
|
+
const cfgSet = async (domain: string, patch: object) => {
|
|
597
|
+
if (!configRpcCall) throw new Error('config RPC not available')
|
|
598
|
+
const res = await configRpcCall('set', { domain, patch })
|
|
599
|
+
return unwrap(res)
|
|
600
|
+
}
|
|
601
|
+
// Deep-merge a guard patch into the local raw document (arrays replace, like
|
|
602
|
+
// the store's own deepMerge). Text fields commit on blur/Enter through
|
|
603
|
+
// CommitField below — never per keystroke, so a half-typed value is not
|
|
604
|
+
// persisted and the RPC is not spammed.
|
|
605
|
+
const saveGuard = async (patch: any) => {
|
|
606
|
+
setError(null)
|
|
607
|
+
setGuard((prev: any) => deepMergeGuard(prev ?? {}, patch))
|
|
608
|
+
try {
|
|
609
|
+
await cfgSet('guard', patch)
|
|
610
|
+
} catch (e: any) {
|
|
611
|
+
setError(e.message ?? String(e))
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
// One rule's tier. 'default' unsets the override (null patch — see
|
|
615
|
+
// ruleTierPatch) so the row truly returns to the built-in tier instead of
|
|
616
|
+
// storing an echo that would render "customized" forever.
|
|
617
|
+
const saveGuardRule = async (ruleId: string, tier: GuardTier | 'default') => {
|
|
618
|
+
await saveGuard({ rules: ruleTierPatch(ruleId, tier) })
|
|
619
|
+
}
|
|
620
|
+
// Reset everything the tab owns to the built-in behaviour. Deep-merge cannot
|
|
621
|
+
// delete keys, so rule overrides are nulled (the runtime drops non-string
|
|
622
|
+
// tiers at merge) and legacy booleans are neutralised to their inert values
|
|
623
|
+
// (only `false` ever migrated).
|
|
624
|
+
const resetGuardDefaults = async () => {
|
|
625
|
+
const rules: Record<string, GuardTier | null> = {}
|
|
626
|
+
for (const meta of RULE_META) rules[meta.id] = null
|
|
627
|
+
await saveGuard({
|
|
628
|
+
gitProtection: { enabled: true, branches: ['master', 'main'] },
|
|
629
|
+
publishBlocked: true,
|
|
630
|
+
cwdContainment: true,
|
|
631
|
+
credentialPaths: [],
|
|
632
|
+
rules,
|
|
633
|
+
protectedBranches: ['master', 'main'],
|
|
634
|
+
protectedPaths: [],
|
|
635
|
+
workingDirContainment: { enabled: true, spillReads: true },
|
|
636
|
+
journal: { enabled: true, allowCounters: true, retainDays: 30, retainFiles: 14 },
|
|
637
|
+
})
|
|
638
|
+
}
|
|
639
|
+
const commitBlacklistPatterns = async (list: string[]) => {
|
|
640
|
+
setError(null)
|
|
641
|
+
setPatterns(list)
|
|
642
|
+
try {
|
|
643
|
+
await cfgSet('guardBlacklist', { patterns: list })
|
|
644
|
+
} catch (e: any) {
|
|
645
|
+
setError(e.message ?? String(e))
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
const saveSupervisorCfg = async (patch: any) => {
|
|
649
|
+
setError(null)
|
|
650
|
+
setSupervisorCfg((prev: any) => ({ ...prev, ...patch }))
|
|
651
|
+
// Keep the effective-state view in step with an explicit write: without
|
|
652
|
+
// this the toggle would snap back to the plugin's last-reported value
|
|
653
|
+
// until the next status fetch.
|
|
654
|
+
if (typeof patch?.autoResumeEnabled === 'boolean') {
|
|
655
|
+
setSupervisorStatus((prev: any) => (prev ? { ...prev, autoResumeEnabled: patch.autoResumeEnabled } : prev))
|
|
656
|
+
}
|
|
657
|
+
try {
|
|
658
|
+
await cfgSet('supervisor', patch)
|
|
659
|
+
} catch (e: any) {
|
|
660
|
+
setError(e.message ?? String(e))
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
useEffect(() => {
|
|
665
|
+
if (configRpcCall) {
|
|
666
|
+
Promise.all([cfgGet('guard').catch(() => ({})), cfgGet('guardBlacklist').catch(() => ({ patterns: [] })), cfgGet('supervisor').catch(() => ({}))])
|
|
667
|
+
.then(([g, bl, sup]) => {
|
|
668
|
+
setGuard(g ?? {})
|
|
669
|
+
const pats = Array.isArray((bl as any)?.patterns) ? (bl as any).patterns.filter((p: any) => typeof p === 'string') : []
|
|
670
|
+
setPatterns(pats)
|
|
671
|
+
setSupervisorCfg(sup ?? {})
|
|
672
|
+
})
|
|
673
|
+
.catch(() => {})
|
|
674
|
+
}
|
|
675
|
+
// Ask the supervisor for the EFFECTIVE auto-resume state: `autoResumePinned`
|
|
676
|
+
// is true when an install-supplied Cordis `config:` block outranks this
|
|
677
|
+
// store, so the toggle must render locked rather than lie. Absent service
|
|
678
|
+
// (not installed) leaves the toggle interactive.
|
|
679
|
+
if (supervisorRpcCall) {
|
|
680
|
+
supervisorRpcCall('status', {})
|
|
681
|
+
.then((res: any) => setSupervisorStatus(unwrap(res)))
|
|
682
|
+
.catch(() => {})
|
|
683
|
+
}
|
|
684
|
+
}, [])
|
|
685
|
+
// A pin means an install-supplied Cordis `config:` block outranks this store,
|
|
686
|
+
// so a write here would be shadowed. Only claimed when the supervisor
|
|
687
|
+
// actually answered — an absent/unresponsive service keeps the toggle live.
|
|
688
|
+
const autoResumePinned = supervisorStatus?.autoResumePinned === true
|
|
689
|
+
// When the plugin answers, its value is the EFFECTIVE one (store, env,
|
|
690
|
+
// supervisor file and defaults folded together). Showing the raw store value
|
|
691
|
+
// instead would render a fresh install's toggle as OFF while the documented
|
|
692
|
+
// default keeps auto-resume ON.
|
|
693
|
+
const autoResumeChecked = typeof supervisorStatus?.autoResumeEnabled === 'boolean'
|
|
694
|
+
? supervisorStatus.autoResumeEnabled === true
|
|
695
|
+
: supervisorCfg.autoResumeEnabled === true
|
|
696
|
+
|
|
697
|
+
// Nested tabs — unified pill bar with icons (maestro-design, matches dsh-maestro-jobs).
|
|
698
|
+
// Blacklist has no pill of its own: it is an offline scan list, so it lives
|
|
699
|
+
// as a section at the bottom of the Guard tab instead of beside it.
|
|
700
|
+
const TABS: Array<{ id: string; label: string; icon: TabIcon }> = [
|
|
701
|
+
{ id: 'guard', label: 'Guard', icon: 'shield' },
|
|
702
|
+
{ id: 'supervisor', label: 'Supervisor', icon: 'cpu' },
|
|
703
|
+
]
|
|
704
|
+
|
|
705
|
+
// Effective guard state: the stored document may still carry legacy v1 keys,
|
|
706
|
+
// so the tab renders through the same precedence the runtime enforces.
|
|
707
|
+
const guardView = effectiveGuardView(guard)
|
|
708
|
+
const guardCustomCount = guardView.rules.filter((r) => r.source !== 'default').length
|
|
709
|
+
|
|
710
|
+
const tabContents: Record<string, unknown> = {
|
|
711
|
+
guard: h(
|
|
712
|
+
'div',
|
|
713
|
+
{ style: { display: 'flex', flexDirection: 'column' } },
|
|
714
|
+
// Status summary — what the stored document amounts to, in one line.
|
|
715
|
+
h(
|
|
716
|
+
'div',
|
|
717
|
+
{ style: { ...cardInsetStyle, marginTop: '12px' } },
|
|
718
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, color: t.labelPrimary as string } }, 'Protection status'),
|
|
719
|
+
h(
|
|
720
|
+
'div',
|
|
721
|
+
{ 'data-maestro-guard-status': '', style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 12, flexWrap: 'wrap' as const, marginTop: 4 } },
|
|
722
|
+
h(
|
|
723
|
+
'div',
|
|
724
|
+
{ style: { fontSize: 12, color: t.labelSecondary as string, lineHeight: '16px' } },
|
|
725
|
+
`${guardCustomCount} of ${guardView.rules.length} rules customized · branches: ${guardView.protectedBranches.join(', ') || 'defaults'} · journal ${guardView.journal.enabled ? `on (${guardView.journal.retainDays}d / ${guardView.journal.retainFiles} files)` : 'off'}`,
|
|
726
|
+
),
|
|
727
|
+
h(Button as any, { variant: 'outline', size: 'sm', onClick: resetGuardDefaults }, 'Reset to defaults'),
|
|
728
|
+
),
|
|
729
|
+
),
|
|
730
|
+
// Per-rule tiers, grouped by boundary. The select writes one rule id;
|
|
731
|
+
// 'Default' restores the built-in tier for that rule.
|
|
732
|
+
...(['Git', 'Publish', 'Filesystem', 'Network', 'Self-protection'] as const).map((group) =>
|
|
733
|
+
h(
|
|
734
|
+
'div',
|
|
735
|
+
{ key: group, style: { display: 'flex', flexDirection: 'column' } },
|
|
736
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, color: t.labelPrimary as string, padding: '12px 0 4px' } }, group),
|
|
737
|
+
...RULE_META.filter((meta) => meta.group === group).map((meta) => {
|
|
738
|
+
const current = guardView.rules.find((r) => r.id === meta.id) ?? { ...meta, tier: meta.defaultTier, source: 'default' as const }
|
|
739
|
+
const stateNote =
|
|
740
|
+
current.source === 'stored' ? ' Currently customized.' : current.source === 'legacy' ? ' Currently from an older setting.' : ` Default: ${meta.defaultTier}.`
|
|
741
|
+
return h(SettingRow as any, {
|
|
742
|
+
title: meta.label,
|
|
743
|
+
description: `${meta.hint}${stateNote}${meta.locked ? ' Locked: the guard never allows lowering this one.' : ''}`,
|
|
744
|
+
control: h(
|
|
745
|
+
'select',
|
|
746
|
+
{
|
|
747
|
+
value: current.source === 'default' ? 'default' : current.tier,
|
|
748
|
+
disabled: meta.locked === true,
|
|
749
|
+
onChange: (e: any) => {
|
|
750
|
+
const next = e.target.value
|
|
751
|
+
void saveGuardRule(meta.id, next as GuardTier | 'default')
|
|
752
|
+
},
|
|
753
|
+
'aria-label': meta.label,
|
|
754
|
+
style: {
|
|
755
|
+
height: 36, padding: '0 12px', border: `1px solid ${t.borderL2}`, borderRadius: 18,
|
|
756
|
+
background: 'var(--dsw-alias-bg-module-platform, #F5F6F7)' as string, color: t.labelPrimary as string, font: 'inherit', fontSize: 13,
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
h('option', { value: 'default' }, `Default (${meta.defaultTier})`),
|
|
760
|
+
...(meta.locked === true
|
|
761
|
+
? [h('option', { value: 'deny' }, 'Deny')]
|
|
762
|
+
: [h('option', { value: 'allow' }, 'Allow — run silently'), h('option', { value: 'journal' }, 'Journal — run + record'), h('option', { value: 'ask' }, 'Ask — prompt first'), h('option', { value: 'deny' }, 'Deny — refuse')]),
|
|
763
|
+
),
|
|
764
|
+
})
|
|
765
|
+
}),
|
|
766
|
+
),
|
|
767
|
+
),
|
|
768
|
+
// Lists + containment: live as soon as the next tool call runs.
|
|
769
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, color: t.labelPrimary as string, padding: '12px 0 4px' } }, 'Scope'),
|
|
770
|
+
h('div', { style: { padding: '12px 0', borderBottom: `1px solid ${t.borderL2}`, display: 'flex', flexDirection: 'column', gap: 8 } },
|
|
771
|
+
h('div', { style: rowTitleStyle }, 'Protected branches'),
|
|
772
|
+
h('div', { style: rowDescStyle }, 'One branch per row. Empty restores the defaults (master, main). Each row commits on blur or Enter — never per keystroke.'),
|
|
773
|
+
h(ListEditor as any, {
|
|
774
|
+
values: guardView.protectedBranches, placeholder: 'main', ariaLabel: 'Protected branch',
|
|
775
|
+
emptyHint: 'No branches listed — the defaults (master, main) apply.',
|
|
776
|
+
onCommit: (list: string[]) => { void saveGuard({ protectedBranches: list }) },
|
|
777
|
+
}),
|
|
778
|
+
),
|
|
779
|
+
h('div', { style: { padding: '12px 0', borderBottom: `1px solid ${t.borderL2}`, display: 'flex', flexDirection: 'column', gap: 8 } },
|
|
780
|
+
h('div', { style: rowTitleStyle }, 'Extra protected paths'),
|
|
781
|
+
h('div', { style: rowDescStyle }, 'One path per row — paths may contain commas or spaces. These add to the built-in protected list — the defaults cannot be removed from here.'),
|
|
782
|
+
h(ListEditor as any, {
|
|
783
|
+
values: guardView.protectedPaths, placeholder: '~/.config/credentials.yaml', ariaLabel: 'Protected path',
|
|
784
|
+
emptyHint: 'No extra paths — only the built-in list applies.',
|
|
785
|
+
onCommit: (list: string[]) => { void saveGuard({ protectedPaths: list }) },
|
|
786
|
+
}),
|
|
787
|
+
),
|
|
788
|
+
h(ToggleRow as any, {
|
|
789
|
+
title: 'Enforce working-directory containment',
|
|
790
|
+
description: 'Keep file writes inside the session working directory (the OS temp dir stays exempt). Off turns the outside-writes rule off entirely.',
|
|
791
|
+
checked: guardView.containment.enabled === true,
|
|
792
|
+
onChange: (v: boolean) => { void saveGuard({ workingDirContainment: { ...guardView.containment, enabled: v } }) },
|
|
793
|
+
}),
|
|
794
|
+
h(ToggleRow as any, {
|
|
795
|
+
title: 'Exempt runtime spill reads',
|
|
796
|
+
description: 'Let agents read back their own oversized tool results from the OS temp dir — blocking those reads breaks the retrieval flow.',
|
|
797
|
+
checked: guardView.containment.spillReads === true,
|
|
798
|
+
onChange: (v: boolean) => { void saveGuard({ workingDirContainment: { ...guardView.containment, spillReads: v } }) },
|
|
799
|
+
}),
|
|
800
|
+
// Journal: boot-time knobs — the guard reads them once at startup.
|
|
801
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, color: t.labelPrimary as string, padding: '12px 0 4px' } }, 'Journal'),
|
|
802
|
+
h('p', { style: { ...captionStyle, margin: '0 0 4px' } }, 'Journal settings apply after a host restart — the guard reads them once at boot, unlike the rules above.'),
|
|
803
|
+
h(ToggleRow as any, {
|
|
804
|
+
title: 'Keep a decision journal',
|
|
805
|
+
description: 'Off stops all journal writes; the guard status tools go empty.',
|
|
806
|
+
checked: guardView.journal.enabled === true,
|
|
807
|
+
onChange: (v: boolean) => { void saveGuard({ journal: { ...guardView.journal, enabled: v } }) },
|
|
808
|
+
}),
|
|
809
|
+
h(ToggleRow as any, {
|
|
810
|
+
title: 'Count silent allows',
|
|
811
|
+
description: 'Fold allow decisions into one periodic aggregate line instead of dropping them.',
|
|
812
|
+
checked: guardView.journal.allowCounters === true,
|
|
813
|
+
onChange: (v: boolean) => { void saveGuard({ journal: { ...guardView.journal, allowCounters: v } }) },
|
|
814
|
+
}),
|
|
815
|
+
h(SettingRow as any, {
|
|
816
|
+
title: 'Retain days',
|
|
817
|
+
description: 'Keep journal archives newer than this many days.',
|
|
818
|
+
control: h(CommitField as any, {
|
|
819
|
+
value: String(guardView.journal.retainDays), placeholder: '30', width: 160, ariaLabel: 'Retain days',
|
|
820
|
+
onCommit: (text: string) => {
|
|
821
|
+
const n = Number(text)
|
|
822
|
+
if (!Number.isInteger(n) || n <= 0) { setError('Retention must be a positive whole number.'); return }
|
|
823
|
+
void saveGuard({ journal: { ...guardView.journal, retainDays: n } })
|
|
824
|
+
},
|
|
825
|
+
}),
|
|
826
|
+
}),
|
|
827
|
+
h(SettingRow as any, {
|
|
828
|
+
title: 'Retain files',
|
|
829
|
+
description: 'Keep at least this many newest archive files.',
|
|
830
|
+
control: h(CommitField as any, {
|
|
831
|
+
value: String(guardView.journal.retainFiles), placeholder: '14', width: 160, ariaLabel: 'Retain files',
|
|
832
|
+
onCommit: (text: string) => {
|
|
833
|
+
const n = Number(text)
|
|
834
|
+
if (!Number.isInteger(n) || n <= 0) { setError('Retention must be a positive whole number.'); return }
|
|
835
|
+
void saveGuard({ journal: { ...guardView.journal, retainFiles: n } })
|
|
836
|
+
},
|
|
837
|
+
}),
|
|
838
|
+
}),
|
|
839
|
+
// Merged from the former Blacklist pill: an offline scan list, not a
|
|
840
|
+
// live gate — it belongs with the guard it is always confused with,
|
|
841
|
+
// labelled for what it actually is.
|
|
842
|
+
h('div', { style: { fontSize: 13, fontWeight: 600, color: t.labelPrimary as string, padding: '12px 0 4px' } }, 'Publish scan list (offline)'),
|
|
843
|
+
h('div', { style: { ...rowStyle, flexDirection: 'column', alignItems: 'stretch', gap: 8, borderBottom: 'none' } as any },
|
|
844
|
+
h('div', { style: rowTitleStyle }, 'Blacklist patterns'),
|
|
845
|
+
h('div', { style: rowDescStyle }, 'One pattern per row. These do NOT gate any live tool call — the guard runtime never reads this list. It only feeds the offline scan a human runs by hand: node scripts/check-public-blacklist.mjs. Matching files are reported there, not blocked at runtime.'),
|
|
846
|
+
h(ListEditor as any, {
|
|
847
|
+
values: patterns, placeholder: 'example-project', ariaLabel: 'Blacklist pattern',
|
|
848
|
+
emptyHint: 'No patterns — the offline scan reports nothing.',
|
|
849
|
+
onCommit: (list: string[]) => { void commitBlacklistPatterns(list) },
|
|
850
|
+
}),
|
|
851
|
+
),
|
|
852
|
+
),
|
|
853
|
+
supervisor: h(
|
|
854
|
+
'div',
|
|
855
|
+
{ style: { display: 'flex', flexDirection: 'column' } },
|
|
856
|
+
h('div', { style: { padding: '12px 0', borderBottom: `1px solid ${t.borderL2}` } }, h('p', { style: captionStyle }, 'Check interval and Down threshold belong to the standalone dsh-web-supervisor daemon (systemd). They have no effect on the in-tree auto-resume plugin below unless that daemon is installed and running.')),
|
|
857
|
+
h(SettingRow as any, { title: 'Check interval', description: 'Milliseconds between supervisor checks. Default 5000.', control: h(FieldInput as any, { type: 'number', value: supervisorCfg.intervalMs ?? '', placeholder: '5000', onChange: (e: any) => { const v = e.target.value === '' ? undefined : Number(e.target.value); saveSupervisorCfg({ intervalMs: v }) }, style: { width: 160 } as any }) }),
|
|
858
|
+
h(SettingRow as any, { title: 'Down threshold', description: 'Consecutive failures before marking a session as down.', control: h(FieldInput as any, { type: 'number', value: supervisorCfg.downThreshold ?? '', placeholder: '3', onChange: (e: any) => { const v = e.target.value === '' ? undefined : Number(e.target.value); saveSupervisorCfg({ downThreshold: v }) }, style: { width: 160 } as any }) }),
|
|
859
|
+
h(ToggleRow as any, {
|
|
860
|
+
title: 'Auto-resume sessions',
|
|
861
|
+
description: autoResumePinned
|
|
862
|
+
? 'Locked: this install pins auto-resume through its Cordis plugin config, which outranks this store. Change it where the supervisor row is mounted, not here.'
|
|
863
|
+
: 'Automatically resume sessions interrupted by a DSH restart within the resume window. Shown as the supervisor reports it — plugin config, environment, and defaults folded together.',
|
|
864
|
+
// Effective value from the plugin, not the (possibly shadowed) store.
|
|
865
|
+
checked: autoResumeChecked,
|
|
866
|
+
onChange: (v: boolean) => saveSupervisorCfg({ autoResumeEnabled: v }),
|
|
867
|
+
disabled: autoResumePinned,
|
|
868
|
+
}),
|
|
869
|
+
),
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
return h(
|
|
873
|
+
'div',
|
|
874
|
+
{ 'data-maestro-settings-card': '', style: { display: 'flex', flexDirection: 'column', gap: 8, width: '100%', maxWidth: 640, minWidth:0, boxSizing:'border-box' as any } },
|
|
875
|
+
h(
|
|
876
|
+
'div',
|
|
877
|
+
{ style: { padding: '2px 2px 8px', display: 'flex', gap: 10, alignItems: 'flex-start' } },
|
|
878
|
+
// Shared BrandBadge — components/BrandMark.tsx, the workspace reference implementation
|
|
879
|
+
h(BrandBadge as any, { style: { alignSelf: 'flex-start', marginTop: 2 } }),
|
|
880
|
+
h('div', { style: { display: 'flex', flexDirection: 'column', minWidth: 0 } },
|
|
881
|
+
h('div', { style: { fontSize: 15, fontWeight: 600, color: t.labelPrimary as string, lineHeight: '22px' } }, 'Maestro'),
|
|
882
|
+
h('div', { style: { fontSize: 12, color: t.labelSecondary as string, lineHeight: '16px', marginTop: 2 } }, 'Guard and supervisor settings, via the shared Maestro store. Uses the same tokens and primitives as DSH settings.'),
|
|
883
|
+
)
|
|
884
|
+
),
|
|
885
|
+
h('style', {}, '[data-maestro-logo]{background:#0A84FF !important; background-color:#0A84FF !important; color:#fff !important;}'),
|
|
886
|
+
h('div', { 'data-maestro-tabs': '', role:'tablist', 'aria-label':'Maestro settings sections' },
|
|
887
|
+
...TABS.map(tab => h('button', { key: tab.id, 'data-maestro-tab':'', 'data-active': String(activeTab===tab.id), role:'tab', 'aria-selected': activeTab===tab.id, onClick: (e: any) => { setActiveTab(tab.id); try { e.currentTarget.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' }) } catch {} } }, h(TabIcon as any, { name: tab.icon }), tab.label))
|
|
888
|
+
),
|
|
889
|
+
h('div', { 'data-maestro-panel': activeTab, style: { display:'flex', flexDirection:'column', gap:10, minWidth:0 } }, tabContents[activeTab] as any),
|
|
890
|
+
error ? h('p', { style: { color: t.stateError as string, fontSize: 12, margin: '8px 0 0', padding: '8px 10px', borderRadius: 8, background: 'color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent)', border: `1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 30%, transparent)` } }, error) : null,
|
|
891
|
+
)
|
|
892
|
+
}
|