@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.
Files changed (285) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +209 -0
  3. package/cordis.patch.yml +43 -0
  4. package/lib/bin.d.ts +2 -0
  5. package/lib/bin.js +3 -0
  6. package/lib/boot-guard.d.ts +33 -0
  7. package/lib/boot-guard.js +68 -0
  8. package/lib/boot-lock.d.ts +56 -0
  9. package/lib/boot-lock.js +155 -0
  10. package/lib/cli.d.ts +31 -0
  11. package/lib/cli.js +336 -0
  12. package/lib/client.js +2901 -0
  13. package/lib/config/index.d.ts +34 -0
  14. package/lib/config/index.js +62 -0
  15. package/lib/config/service.d.ts +18 -0
  16. package/lib/config/service.js +28 -0
  17. package/lib/config.d.ts +1 -0
  18. package/lib/config.js +19 -0
  19. package/lib/daemon-freshness.d.ts +48 -0
  20. package/lib/daemon-freshness.js +122 -0
  21. package/lib/debug-agent.d.ts +17 -0
  22. package/lib/debug-agent.js +144 -0
  23. package/lib/dsh-session.d.ts +26 -0
  24. package/lib/dsh-session.js +45 -0
  25. package/lib/guard/config.d.ts +82 -0
  26. package/lib/guard/config.js +211 -0
  27. package/lib/guard/decide.d.ts +30 -0
  28. package/lib/guard/decide.js +38 -0
  29. package/lib/guard/full-scan-tool.d.ts +6 -0
  30. package/lib/guard/full-scan-tool.js +65 -0
  31. package/lib/guard/index.d.ts +85 -0
  32. package/lib/guard/index.js +254 -0
  33. package/lib/guard/journal.d.ts +146 -0
  34. package/lib/guard/journal.js +398 -0
  35. package/lib/guard/migrate.d.ts +15 -0
  36. package/lib/guard/migrate.js +42 -0
  37. package/lib/guard/parse.d.ts +193 -0
  38. package/lib/guard/parse.js +1103 -0
  39. package/lib/guard/paths.d.ts +104 -0
  40. package/lib/guard/paths.js +254 -0
  41. package/lib/guard/permission-policy.d.ts +10 -0
  42. package/lib/guard/permission-policy.js +21 -0
  43. package/lib/guard/redact.d.ts +25 -0
  44. package/lib/guard/redact.js +52 -0
  45. package/lib/guard/rules.d.ts +65 -0
  46. package/lib/guard/rules.js +832 -0
  47. package/lib/guard/status-tool.d.ts +54 -0
  48. package/lib/guard/status-tool.js +195 -0
  49. package/lib/guard/tiers.d.ts +2 -0
  50. package/lib/guard/tiers.js +1 -0
  51. package/lib/guard/validators.d.ts +4 -0
  52. package/lib/guard/validators.js +45 -0
  53. package/lib/health-poller.d.ts +90 -0
  54. package/lib/health-poller.js +430 -0
  55. package/lib/index.d.ts +7 -0
  56. package/lib/index.js +7 -0
  57. package/lib/intents.d.ts +32 -0
  58. package/lib/intents.js +49 -0
  59. package/lib/notifier.d.ts +12 -0
  60. package/lib/notifier.js +62 -0
  61. package/lib/paths.d.ts +13 -0
  62. package/lib/paths.js +70 -0
  63. package/lib/plugin.d.ts +250 -0
  64. package/lib/plugin.js +1126 -0
  65. package/lib/preset.d.ts +73 -0
  66. package/lib/preset.js +158 -0
  67. package/lib/report.d.ts +11 -0
  68. package/lib/report.js +58 -0
  69. package/lib/restart-exec.d.ts +35 -0
  70. package/lib/restart-exec.js +60 -0
  71. package/lib/restart-guards.d.ts +39 -0
  72. package/lib/restart-guards.js +150 -0
  73. package/lib/restart-tool.d.ts +124 -0
  74. package/lib/restart-tool.js +539 -0
  75. package/lib/restart-web.d.ts +26 -0
  76. package/lib/restart-web.js +58 -0
  77. package/lib/resume-log.d.ts +24 -0
  78. package/lib/resume-log.js +18 -0
  79. package/lib/resume-tools.d.ts +131 -0
  80. package/lib/resume-tools.js +337 -0
  81. package/lib/resume.d.ts +33 -0
  82. package/lib/resume.js +221 -0
  83. package/lib/scan.d.ts +20 -0
  84. package/lib/scan.js +71 -0
  85. package/lib/self-kill-guard.d.ts +81 -0
  86. package/lib/self-kill-guard.js +208 -0
  87. package/lib/session-health.d.ts +89 -0
  88. package/lib/session-health.js +274 -0
  89. package/lib/session-log-file.d.ts +22 -0
  90. package/lib/session-log-file.js +74 -0
  91. package/lib/skill-provider.d.ts +6 -0
  92. package/lib/skill-provider.js +73 -0
  93. package/lib/snapshot.d.ts +59 -0
  94. package/lib/snapshot.js +358 -0
  95. package/lib/source.d.ts +19 -0
  96. package/lib/source.js +19 -0
  97. package/lib/store/index.d.ts +42 -0
  98. package/lib/store/index.js +340 -0
  99. package/lib/store/legacy.d.ts +17 -0
  100. package/lib/store/legacy.js +85 -0
  101. package/lib/supervisor.d.ts +119 -0
  102. package/lib/supervisor.js +741 -0
  103. package/lib/sync/backup-config.d.ts +55 -0
  104. package/lib/sync/backup-config.js +119 -0
  105. package/lib/sync/backup-service.d.ts +110 -0
  106. package/lib/sync/backup-service.js +440 -0
  107. package/lib/sync/bidirectional.d.ts +39 -0
  108. package/lib/sync/bidirectional.js +25 -0
  109. package/lib/sync/cli.d.ts +38 -0
  110. package/lib/sync/cli.js +536 -0
  111. package/lib/sync/config.d.ts +77 -0
  112. package/lib/sync/config.js +90 -0
  113. package/lib/sync/fingerprint.d.ts +29 -0
  114. package/lib/sync/fingerprint.js +65 -0
  115. package/lib/sync/hashing.d.ts +9 -0
  116. package/lib/sync/hashing.js +47 -0
  117. package/lib/sync/index.d.ts +6 -0
  118. package/lib/sync/index.js +634 -0
  119. package/lib/sync/machine-id.d.ts +29 -0
  120. package/lib/sync/machine-id.js +66 -0
  121. package/lib/sync/merge.d.ts +33 -0
  122. package/lib/sync/merge.js +88 -0
  123. package/lib/sync/peer-host.d.ts +22 -0
  124. package/lib/sync/peer-host.js +62 -0
  125. package/lib/sync/process-runner.d.ts +31 -0
  126. package/lib/sync/process-runner.js +161 -0
  127. package/lib/sync/remote-agent.d.ts +42 -0
  128. package/lib/sync/remote-agent.js +217 -0
  129. package/lib/sync/remote-cache.d.ts +18 -0
  130. package/lib/sync/remote-cache.js +60 -0
  131. package/lib/sync/remote-manifest.d.ts +8 -0
  132. package/lib/sync/remote-manifest.js +64 -0
  133. package/lib/sync/s3-object-store.d.ts +38 -0
  134. package/lib/sync/s3-object-store.js +126 -0
  135. package/lib/sync/session-merge.d.ts +18 -0
  136. package/lib/sync/session-merge.js +191 -0
  137. package/lib/sync/session-plan.d.ts +29 -0
  138. package/lib/sync/session-plan.js +213 -0
  139. package/lib/sync/sigv4.d.ts +20 -0
  140. package/lib/sync/sigv4.js +57 -0
  141. package/lib/sync/snapshot.d.ts +21 -0
  142. package/lib/sync/snapshot.js +176 -0
  143. package/lib/sync/ssh-mux.d.ts +12 -0
  144. package/lib/sync/ssh-mux.js +48 -0
  145. package/lib/sync/sync-plan.d.ts +24 -0
  146. package/lib/sync/sync-plan.js +366 -0
  147. package/lib/sync/sync-service.d.ts +177 -0
  148. package/lib/sync/sync-service.js +819 -0
  149. package/lib/sync/sync-types.d.ts +87 -0
  150. package/lib/sync/sync-types.js +1 -0
  151. package/lib/sync/transport.d.ts +75 -0
  152. package/lib/sync/transport.js +200 -0
  153. package/lib/sync/tunnel-restore.d.ts +77 -0
  154. package/lib/sync/tunnel-restore.js +142 -0
  155. package/lib/sync/validation.d.ts +10 -0
  156. package/lib/sync/validation.js +83 -0
  157. package/lib/tool-view.d.ts +62 -0
  158. package/lib/tool-view.js +70 -0
  159. package/lib/types/client/auto-reload.d.ts +8 -0
  160. package/lib/types/client/auto-reload.d.ts.map +1 -0
  161. package/lib/types/client/config/MaestroSettings.d.ts +25 -0
  162. package/lib/types/client/config/MaestroSettings.d.ts.map +1 -0
  163. package/lib/types/client/config/components/BrandMark.d.ts +50 -0
  164. package/lib/types/client/config/components/BrandMark.d.ts.map +1 -0
  165. package/lib/types/client/config/guard-view.d.ts +83 -0
  166. package/lib/types/client/config/guard-view.d.ts.map +1 -0
  167. package/lib/types/client/config/index.d.ts +20 -0
  168. package/lib/types/client/config/index.d.ts.map +1 -0
  169. package/lib/types/client/config/maestro-mark.d.ts +29 -0
  170. package/lib/types/client/config/maestro-mark.d.ts.map +1 -0
  171. package/lib/types/client/config/settings-nav-icon.d.ts +21 -0
  172. package/lib/types/client/config/settings-nav-icon.d.ts.map +1 -0
  173. package/lib/types/client/index.d.ts +16 -0
  174. package/lib/types/client/index.d.ts.map +1 -0
  175. package/lib/types/client/sync/R2SyncPanel.d.ts +6 -0
  176. package/lib/types/client/sync/R2SyncPanel.d.ts.map +1 -0
  177. package/lib/types/client/sync/SyncPanel.d.ts +12 -0
  178. package/lib/types/client/sync/SyncPanel.d.ts.map +1 -0
  179. package/lib/types/client/sync/confirm-dialog.d.ts +43 -0
  180. package/lib/types/client/sync/confirm-dialog.d.ts.map +1 -0
  181. package/lib/types/client/sync/index.d.ts +10 -0
  182. package/lib/types/client/sync/index.d.ts.map +1 -0
  183. package/lib/types/client/sync/ui.d.ts +79 -0
  184. package/lib/types/client/sync/ui.d.ts.map +1 -0
  185. package/lib/types/client/sync/use-backup.d.ts +50 -0
  186. package/lib/types/client/sync/use-backup.d.ts.map +1 -0
  187. package/lib/types/client/sync/use-sync.d.ts +88 -0
  188. package/lib/types/client/sync/use-sync.d.ts.map +1 -0
  189. package/package.json +89 -0
  190. package/skills/dsh-safe-restart/SKILL.md +206 -0
  191. package/skills/dsh-safe-restart/scripts/restart-dsh-web.sh +468 -0
  192. package/src/client/auto-reload.ts +104 -0
  193. package/src/client/config/MaestroSettings.tsx +892 -0
  194. package/src/client/config/components/BrandMark.tsx +94 -0
  195. package/src/client/config/guard-view.ts +187 -0
  196. package/src/client/config/index.tsx +109 -0
  197. package/src/client/config/maestro-mark.ts +37 -0
  198. package/src/client/config/settings-nav-icon.ts +68 -0
  199. package/src/client/index.tsx +33 -0
  200. package/src/client/sync/R2SyncPanel.tsx +260 -0
  201. package/src/client/sync/SyncPanel.tsx +422 -0
  202. package/src/client/sync/confirm-dialog.tsx +202 -0
  203. package/src/client/sync/index.tsx +336 -0
  204. package/src/client/sync/ui.tsx +313 -0
  205. package/src/client/sync/use-backup.ts +207 -0
  206. package/src/client/sync/use-sync.ts +502 -0
  207. package/src/host/bin.ts +3 -0
  208. package/src/host/boot-guard.ts +76 -0
  209. package/src/host/boot-lock.ts +155 -0
  210. package/src/host/cli.ts +288 -0
  211. package/src/host/config/index.ts +78 -0
  212. package/src/host/config/service.ts +40 -0
  213. package/src/host/config.ts +18 -0
  214. package/src/host/daemon-freshness.ts +143 -0
  215. package/src/host/debug-agent.ts +145 -0
  216. package/src/host/dsh-session.ts +56 -0
  217. package/src/host/dsh-skill.d.ts +44 -0
  218. package/src/host/guard/augment.d.ts +33 -0
  219. package/src/host/guard/config.ts +244 -0
  220. package/src/host/guard/decide.ts +40 -0
  221. package/src/host/guard/full-scan-tool.ts +61 -0
  222. package/src/host/guard/index.ts +281 -0
  223. package/src/host/guard/journal.ts +440 -0
  224. package/src/host/guard/migrate.ts +41 -0
  225. package/src/host/guard/parse.ts +1150 -0
  226. package/src/host/guard/paths.ts +239 -0
  227. package/src/host/guard/permission-policy.ts +15 -0
  228. package/src/host/guard/redact.ts +64 -0
  229. package/src/host/guard/rules.ts +891 -0
  230. package/src/host/guard/status-tool.ts +229 -0
  231. package/src/host/guard/tiers.ts +2 -0
  232. package/src/host/guard/validators.ts +29 -0
  233. package/src/host/health-poller.ts +446 -0
  234. package/src/host/index.ts +7 -0
  235. package/src/host/intents.ts +67 -0
  236. package/src/host/notifier.ts +71 -0
  237. package/src/host/paths.ts +70 -0
  238. package/src/host/plugin.ts +1097 -0
  239. package/src/host/preset.ts +170 -0
  240. package/src/host/report.ts +71 -0
  241. package/src/host/restart-exec.ts +81 -0
  242. package/src/host/restart-guards.ts +150 -0
  243. package/src/host/restart-tool.ts +483 -0
  244. package/src/host/restart-web.ts +72 -0
  245. package/src/host/resume-log.ts +39 -0
  246. package/src/host/resume-tools.ts +385 -0
  247. package/src/host/resume.ts +204 -0
  248. package/src/host/scan.ts +61 -0
  249. package/src/host/self-kill-guard.ts +216 -0
  250. package/src/host/session-health.ts +236 -0
  251. package/src/host/session-log-file.ts +77 -0
  252. package/src/host/skill-provider.ts +69 -0
  253. package/src/host/snapshot.ts +337 -0
  254. package/src/host/source.ts +19 -0
  255. package/src/host/store/index.ts +348 -0
  256. package/src/host/store/legacy.ts +96 -0
  257. package/src/host/supervisor.ts +720 -0
  258. package/src/host/sync/backup-config.ts +159 -0
  259. package/src/host/sync/backup-service.ts +453 -0
  260. package/src/host/sync/bidirectional.ts +66 -0
  261. package/src/host/sync/cli.ts +539 -0
  262. package/src/host/sync/config.ts +119 -0
  263. package/src/host/sync/fingerprint.ts +83 -0
  264. package/src/host/sync/hashing.ts +58 -0
  265. package/src/host/sync/index.ts +737 -0
  266. package/src/host/sync/machine-id.ts +81 -0
  267. package/src/host/sync/merge.ts +102 -0
  268. package/src/host/sync/peer-host.ts +65 -0
  269. package/src/host/sync/process-runner.ts +177 -0
  270. package/src/host/sync/remote-agent.ts +213 -0
  271. package/src/host/sync/remote-cache.ts +68 -0
  272. package/src/host/sync/remote-manifest.ts +70 -0
  273. package/src/host/sync/s3-object-store.ts +144 -0
  274. package/src/host/sync/session-merge.ts +220 -0
  275. package/src/host/sync/session-plan.ts +237 -0
  276. package/src/host/sync/sigv4.ts +81 -0
  277. package/src/host/sync/snapshot.ts +162 -0
  278. package/src/host/sync/ssh-mux.ts +56 -0
  279. package/src/host/sync/sync-plan.ts +366 -0
  280. package/src/host/sync/sync-service.ts +855 -0
  281. package/src/host/sync/sync-types.ts +102 -0
  282. package/src/host/sync/transport.ts +261 -0
  283. package/src/host/sync/tunnel-restore.ts +160 -0
  284. package/src/host/sync/validation.ts +91 -0
  285. package/src/host/tool-view.ts +98 -0
@@ -0,0 +1,79 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Sync UI kit — DSH-native primitives, Minimalism & Swiss (design-system/MASTER.md).
4
+ * Every color/geometry value maps to a --dsw-alias-* / --dsw-* token; the only
5
+ * fixed hex is the shared Maestro logo tile #0A84FF (branding rule).
6
+ * Components style themselves via [data-sync-*] attributes + tokens (mirrors
7
+ * the dsh-maestro-jobs ui kit so mobile media queries live in one CSS layer).
8
+ */
9
+ export declare const RPC_CHANNEL: "/dsh-maestro-sync";
10
+ export declare const t: {
11
+ readonly bgBase: "var(--dsw-alias-bg-base)";
12
+ readonly bgLayer1: "var(--dsw-alias-bg-layer-1)";
13
+ readonly bgLayer2: "var(--dsw-alias-bg-layer-2)";
14
+ readonly bgLayer3: "var(--dsw-alias-bg-layer-3)";
15
+ readonly bgOverlay: "var(--dsw-alias-bg-overlay)";
16
+ readonly borderL1: "var(--dsw-alias-border-l1)";
17
+ readonly borderL2: "var(--dsw-alias-border-l2)";
18
+ readonly labelPrimary: "var(--dsw-alias-label-primary)";
19
+ readonly labelSecondary: "var(--dsw-alias-label-secondary)";
20
+ readonly labelTertiary: "var(--dsw-alias-label-tertiary)";
21
+ readonly labelFg: "var(--dsw-alias-label-primary-foreground)";
22
+ readonly primaryFill: "var(--dsw-alias-button-primary-fill)";
23
+ readonly primaryHover: "var(--dsw-alias-button-primary-hover)";
24
+ readonly interactiveHover: "var(--dsw-alias-interactive-bg-hover)";
25
+ readonly interactiveActive: "var(--dsw-alias-interactive-bg-active)";
26
+ readonly brand: "var(--dsw-alias-brand-primary)";
27
+ readonly stateError: "var(--dsw-alias-state-error-primary)";
28
+ readonly stateSuccess: "var(--dsw-alias-state-success-primary)";
29
+ readonly stateWarn: "var(--dsw-alias-state-warn-primary)";
30
+ readonly shadowLv3: "var(--dsw-shadow-lv3)";
31
+ };
32
+ export declare function MaestroMark(props: {
33
+ size?: number;
34
+ }): React.JSX.Element;
35
+ export declare function MaestroLogo(props: {
36
+ outer?: number;
37
+ size?: number;
38
+ radius?: number;
39
+ }): React.JSX.Element;
40
+ export type IconName = 'refresh' | 'download' | 'upload' | 'swap' | 'file' | 'folder' | 'star' | 'message' | 'calendar' | 'server' | 'clock' | 'alert' | 'check' | 'close' | 'chevron-down' | 'chevron-right' | 'external';
41
+ export declare function Icon(props: {
42
+ name: IconName;
43
+ size?: number;
44
+ }): React.JSX.Element;
45
+ export declare function Button(props: {
46
+ variant?: 'primary' | 'outline' | 'ghost';
47
+ size?: 'sm' | 'md';
48
+ icon?: IconName;
49
+ busy?: boolean;
50
+ children?: React.ReactNode;
51
+ style?: React.CSSProperties;
52
+ } & Record<string, unknown>): React.JSX.Element;
53
+ export declare function StatTile(props: {
54
+ icon: IconName;
55
+ value: React.ReactNode;
56
+ label: string;
57
+ hint?: string;
58
+ tone?: 'default' | 'success' | 'error' | 'warn';
59
+ onClick?: () => void;
60
+ ariaLabel?: string;
61
+ }): React.JSX.Element;
62
+ export declare function Badge(props: {
63
+ children: React.ReactNode;
64
+ tone?: 'default' | 'success' | 'error' | 'warn' | 'brand';
65
+ icon?: IconName;
66
+ }): React.JSX.Element;
67
+ export declare function formatLastSync(v: string | null): string;
68
+ export declare function fileIcon(path: string): IconName;
69
+ export declare function formatFile(path: string): {
70
+ icon: IconName;
71
+ title: string;
72
+ path: string;
73
+ meta: string;
74
+ };
75
+ /** Exact action label — same-name files are never called "in sync" here. */
76
+ export declare function actionLabel(action: any): string;
77
+ export declare function actionTone(action: any): 'default' | 'success' | 'error' | 'warn' | 'brand';
78
+ export declare function humanSummary(status: any): string;
79
+ //# sourceMappingURL=ui.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../../src/client/sync/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B;;;;;;GAMG;AAEH,eAAO,MAAM,WAAW,EAAG,mBAA4B,CAAA;AAGvD,eAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;CAqBJ,CAAA;AAGV,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,qBAOnD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,qBA4BpF;AAGD,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,UAAU,GACV,QAAQ,GACR,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,SAAS,GACT,UAAU,GACV,QAAQ,GACR,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,cAAc,GACd,eAAe,GACf,UAAU,CAAA;AA2Cd,wBAAgB,IAAI,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,qBAO5D;AAGD,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAC5B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IACzC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;CAC5B,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,qBA+C1B;AAGD,wBAAgB,QAAQ,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,qBAqBlM;AAGD,wBAAgB,KAAK,CAAC,KAAK,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,QAAQ,CAAA;CAAE,qBAQrI;AAGD,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CASvD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAM/C;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAmBtG;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAW/C;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,GAAG,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAW1F;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,CAMhD"}
@@ -0,0 +1,50 @@
1
+ export interface BackupStatusView {
2
+ configured: boolean;
3
+ source: 'env' | 'file' | 'none';
4
+ bucket: string;
5
+ prefix: string;
6
+ /** Non-secret snapshot for the config form (never secret material). */
7
+ r2?: {
8
+ provider: string;
9
+ endpoint: string;
10
+ region: string;
11
+ bucket: string;
12
+ prefix: string;
13
+ };
14
+ lastManifest: string | null;
15
+ eligible: {
16
+ md: number;
17
+ sessions: number;
18
+ };
19
+ }
20
+ export declare function useBackupTarget(ctx: any): {
21
+ status: BackupStatusView | null;
22
+ checking: boolean;
23
+ busy: boolean;
24
+ error: string;
25
+ backupPreview: any;
26
+ restorePreview: any;
27
+ gcReport: any;
28
+ confirmOpen: "backup" | "restore" | "gc" | null;
29
+ canBackup: boolean;
30
+ loadStatus: () => Promise<void>;
31
+ saveR2Config: (fields: {
32
+ provider: string;
33
+ accountId: string;
34
+ endpoint: string;
35
+ region: string;
36
+ bucket: string;
37
+ prefix: string;
38
+ }) => Promise<{
39
+ ok: boolean;
40
+ error?: string;
41
+ }>;
42
+ previewBackup: () => Promise<void>;
43
+ applyBackup: () => Promise<void>;
44
+ previewRestore: (mode: "new-dir" | "in-place") => Promise<void>;
45
+ applyRestore: (mode: "new-dir" | "in-place", destDir?: string) => Promise<void>;
46
+ previewGc: () => Promise<void>;
47
+ applyGc: () => Promise<void>;
48
+ cancelDialog: () => void;
49
+ };
50
+ //# sourceMappingURL=use-backup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-backup.d.ts","sourceRoot":"","sources":["../../../../src/client/sync/use-backup.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,EAAE,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5F,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG;;;;;;;;;;;2BA+IrB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;;;2BA9EtJ,SAAS,GAAG,UAAU;yBAmBtB,SAAS,GAAG,UAAU,YAAY,MAAM;;;;EAwGxD"}
@@ -0,0 +1,88 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Shared Sync state machine — confirmation-first Preview/Apply.
4
+ * - Preview is read-only; apply exists only inside a confirmation dialog bound
5
+ * to the live preview id, with {confirm:true}. Escape cancels; nothing applies
6
+ * without confirmation.
7
+ * - status pages two buckets (localOnly / remoteOnly) with cursors.
8
+ */
9
+ export interface SyncConnection {
10
+ ok: boolean;
11
+ host: string;
12
+ latencyMs?: number;
13
+ error?: string;
14
+ }
15
+ export interface PageState {
16
+ files: string[];
17
+ total: number;
18
+ next: number | null;
19
+ /** true once the first page has settled — separates "still loading" from "genuinely empty" */
20
+ loaded?: boolean;
21
+ }
22
+ export type Bucket = 'localOnly' | 'remoteOnly';
23
+ export declare function useSync(ctx: any): {
24
+ remoteHost: string;
25
+ remoteSource: string;
26
+ lastSync: string | null;
27
+ status: any;
28
+ connection: SyncConnection | null;
29
+ machines: {
30
+ localId: string | null;
31
+ remoteId: string | null;
32
+ from?: string;
33
+ to?: string;
34
+ ok?: boolean;
35
+ reason?: string;
36
+ } | null;
37
+ checking: boolean;
38
+ busy: boolean;
39
+ result: {
40
+ kind: string;
41
+ ok: boolean;
42
+ text: string;
43
+ } | null;
44
+ error: string;
45
+ hostFieldError: string | null;
46
+ setHostFieldError: React.Dispatch<React.SetStateAction<string | null>>;
47
+ preview: any;
48
+ previewDirection: "push" | "pull";
49
+ confirmOpen: boolean;
50
+ biPreview: any;
51
+ biConfirmOpen: boolean;
52
+ tunnelPreview: any;
53
+ tunnelConfirmOpen: boolean;
54
+ actionLimit: number;
55
+ progress: {
56
+ phase: string;
57
+ current: number;
58
+ total: number;
59
+ file?: string;
60
+ } | null;
61
+ pages: Record<Bucket, PageState>;
62
+ setActionLimit: React.Dispatch<React.SetStateAction<number>>;
63
+ setError: React.Dispatch<React.SetStateAction<string>>;
64
+ setResult: React.Dispatch<React.SetStateAction<{
65
+ kind: string;
66
+ ok: boolean;
67
+ text: string;
68
+ } | null>>;
69
+ loadStatus: () => Promise<void>;
70
+ loadPage: (bucket: Bucket, cursor: number) => Promise<void>;
71
+ saveRemoteHost: (host: string) => Promise<{
72
+ ok: boolean;
73
+ error?: string;
74
+ }>;
75
+ checkConnection: () => Promise<boolean>;
76
+ loadMachines: () => Promise<void>;
77
+ handleTunnelRestorePreview: () => Promise<void>;
78
+ confirmTunnelRestore: () => Promise<void>;
79
+ cancelTunnelRestore: () => void;
80
+ handlePreview: (direction: "pull" | "push") => Promise<void>;
81
+ handleApply: () => Promise<void>;
82
+ cancelDialog: () => void;
83
+ handleBidirectionalPreview: () => Promise<void>;
84
+ handleBidirectionalApply: () => Promise<void>;
85
+ cancelBidirectionalDialog: () => void;
86
+ };
87
+ export type SyncState = ReturnType<typeof useSync>;
88
+ //# sourceMappingURL=use-sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-sync.d.ts","sourceRoot":"","sources":["../../../../src/client/sync/use-sync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B;;;;;;GAMG;AAEH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,OAAO,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,8FAA8F;IAC9F,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,MAAM,MAAM,GAAG,WAAW,GAAG,YAAY,CAAA;AAE/C,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG;;;;;;;iBAgB4B,MAAM,GAAG,IAAI;kBAAY,MAAM,GAAG,IAAI;eAAS,MAAM;aAAO,MAAM;aAAO,OAAO;iBAAW,MAAM;;;;;cAIxG,MAAM;YAAM,OAAO;cAAQ,MAAM;;;;;;;;;;;;;;eAkB5B,MAAM;iBAAW,MAAM;eAAS,MAAM;eAAS,MAAM;;;;;;cAlB1D,MAAM;YAAM,OAAO;cAAQ,MAAM;;;uBA0CnE,MAAM,UAAU,MAAM;2BA8NxB,MAAM,KAAG,OAAO,CAAC;QAAE,EAAE,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;2BAiDZ,OAAO,CAAC,OAAO,CAAC;wBAfnB,OAAO,CAAC,IAAI,CAAC;sCA+CC,OAAO,CAAC,IAAI,CAAC;gCAwBnB,OAAO,CAAC,IAAI,CAAC;;+BApQlD,MAAM,GAAG,MAAM;;;;;;EAsVpC;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,89 @@
1
+ {
2
+ "name": "@ddtcorex/dsh-maestro-core",
3
+ "version": "0.10.0",
4
+ "description": "Supervisor daemon for DSH Web resilience — auto-detect crashes, rollback to LKG, report",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ddtcorex/dsh-maestro-core.git"
9
+ },
10
+ "engines": {
11
+ "node": "^22.19.0 || >=24.0.0"
12
+ },
13
+ "type": "module",
14
+ "main": "./lib/index.js",
15
+ "types": "./lib/types/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./lib/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
21
+ "./client": {
22
+ "types": "./lib/types/client/index.d.ts",
23
+ "default": "./lib/client.js"
24
+ },
25
+ "./store": {
26
+ "types": "./lib/store/index.d.ts",
27
+ "default": "./lib/store/index.js"
28
+ },
29
+ "./lib/*": "./lib/*",
30
+ "./cordis.patch.yml": "./cordis.patch.yml",
31
+ "./package.json": "./package.json"
32
+ },
33
+ "bin": {
34
+ "dsh-web-supervisor": "./lib/bin.js"
35
+ },
36
+ "dsh": {
37
+ "bundle": {
38
+ "patch": "./cordis.patch.yml"
39
+ },
40
+ "client": {
41
+ "platform": "web",
42
+ "inject": [
43
+ "@deepseek-ai/dsh-client-connection",
44
+ "@deepseek-ai/dsh-client-ui-slots"
45
+ ]
46
+ }
47
+ },
48
+ "files": [
49
+ "lib",
50
+ "src",
51
+ "skills",
52
+ "README.md",
53
+ "cordis.patch.yml"
54
+ ],
55
+ "peerDependencies": {
56
+ "@deepseek-ai/cordis": "~4.0.4",
57
+ "@deepseek-ai/dsh-client-connection": "^0.1.0-rc.6 || >=0.1.1-rc.0 <0.3.0-0",
58
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6 || >=0.1.1-rc.0 <0.3.0-0"
59
+ },
60
+ "dependencies": {
61
+ "fzstd": "0.1.1"
62
+ },
63
+ "devDependencies": {
64
+ "@deepseek-ai/cordis": "~4.0.4",
65
+ "@deepseek-ai/dsh-client-connection": "0.2.0-rc.2",
66
+ "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2",
67
+ "@deepseek-ai/dsh-llm": "0.2.0-rc.2",
68
+ "@deepseek-ai/dsh-tools": "0.2.0-rc.2",
69
+ "@testing-library/dom": "^10.4.1",
70
+ "@testing-library/jest-dom": "^7.0.1",
71
+ "@testing-library/react": "^16.3.3",
72
+ "@testing-library/user-event": "^14.6.6",
73
+ "@types/node": "^26.3.0",
74
+ "@types/react": "~18.3.1",
75
+ "@types/react-dom": "~18.3.0",
76
+ "esbuild": "^0.25.12",
77
+ "jsdom": "^30.0.1",
78
+ "react": "^18.3.1",
79
+ "react-dom": "^18.3.1",
80
+ "typescript": "^5.9.3",
81
+ "vitest": "^3.2.4"
82
+ },
83
+ "scripts": {
84
+ "build": "tsc -p tsconfig.json && tsc -p tsconfig.client.json && node scripts/build-client.mjs",
85
+ "verify": "tsc --noEmit && tsc -p tsconfig.client.json --noEmit",
86
+ "test": "NODE_ENV=test vitest run --testTimeout=10000",
87
+ "test:watch": "vitest"
88
+ }
89
+ }
@@ -0,0 +1,206 @@
1
+ ---
2
+ name: dsh-safe-restart
3
+ description: Use before updating any dsh-maestro-* client bundle or DSH Web asset, before reloading the running dsh web host process, or when a rebuilt plugin's lib/ is newer than the running supervisor daemon; validate first and perform a user-approved host restart through the bundled guarded recipe. In-session agents use the `dsh_web_restart` tool; hand off to a human only if the tool is unavailable.
4
+ compatibility: dsh
5
+ ---
6
+
7
+ # Safe DSH Web Restart
8
+
9
+ ## Purpose
10
+
11
+ One `dsh web` process owns the whole Web surface: the raw webserver on
12
+ `127.0.0.1:3082` (launch-token fence) plus the two Maestro proxies created by
13
+ `dsh-maestro-remote` — the LAN PIN gate on `:3080` (canonical local/LAN URL)
14
+ and the public tunnel proxy on `:3081` — and the `/hooks/gitlab-mr*` webhook
15
+ intake (port 3000 is deprecated/unbound). A host restart drops the live
16
+ socket and the in-flight turn, although sessions rehydrate from the
17
+ append-only log when the browser reconnects. Treat a restart as disruptive:
18
+ validate first and get explicit user consent before a real swap.
19
+
20
+ ## Classify the change before touching the live process
21
+
22
+ - **Static asset in `apps/web/dist/`** — patch the asset and verify served
23
+ bytes with `curl`; no restart.
24
+ - **Client plugin bundle** (client JavaScript, CSS, slots, React) — run that
25
+ package's `build:client`, confirm a bundle marker, then refresh the browser;
26
+ no host restart.
27
+ - **Host Node library, `cordis.patch.yml`, or profile plugin composition** —
28
+ validate a candidate and restart only after the user says to do so.
29
+
30
+ ## Required preflight for a host restart
31
+
32
+ 1. Run relevant package tests and build steps, then check the output really
33
+ carries the expected marker.
34
+ 2. **Assert no bundle is silently skipped.** Editing a profile manifest does NOT
35
+ relink `node_modules`: a `link:` row whose target has moved or been deleted
36
+ leaves a broken symlink, and the boot then drops that plugin with a
37
+ `skipping profile bundle ... cannot resolve profile bundle` line on stderr
38
+ rather than erroring. The user sees a working host missing a toolset, which
39
+ reads as "my tools vanished", not as a failure. Check BOTH arms — the
40
+ workspace's upgrade-preflight grep does not cover this one:
41
+
42
+ ```sh
43
+ dsh --profile <p> --dump-config 2>&1 \
44
+ | grep -E "skipping profile bundle|cannot resolve profile bundle|name mismatch|entry .* not found"
45
+ ```
46
+
47
+ Expect no output, and confirm every declared bundle appears as a `# == `
48
+ header. A clean upgrade-preflight result alone is NOT evidence here: it
49
+ prints "clean" on exactly the broken state. Run
50
+ `dsh plugin --profile <p> install` after any manifest edit so `node_modules`
51
+ is relinked before the check.
52
+ 3. Dry-boot the candidate on an ephemeral port with an isolated `DSH_HOME`.
53
+ Keep the live process and its sessions/settings untouched. If the review
54
+ webhook conflicts on a bound port, exclude that provider for the candidate
55
+ or run a no-server composition check instead.
56
+ 4. Verify HTTP 200 and the new marker on the candidate. Retain last-known-good
57
+ assets until the real swap has passed post-swap checks.
58
+ 5. Check the **second** long-lived process, not only `dsh web`: the standalone
59
+ `dsh-web-supervisor` daemon also caches this package's `lib/*.js` in RAM at
60
+ start, and it is the process that judges the new boot. A daemon older than
61
+ the newest build still applies the OLD rollback rules — on 2026-09-13 that
62
+ is exactly what rolled `dsh web` back in a loop every ~90s
63
+ (`rollback — degraded: This operation was aborted`) while `:3080` answered
64
+ in 1.4ms. Compare the daemon's start with the newest build:
65
+ `ps -o lstart= -p "$(pgrep -f 'lib/bin.js daemon')"` against
66
+ `stat -c '%y' <package>/lib/*.js`; a build newer than the daemon's start
67
+ means the daemon is **stale** and must be reloaded BEFORE the swap.
68
+ `restart-dsh-web.sh --check-supervisor` reports this and changes nothing.
69
+ 6. Ask for explicit consent and timing. “restart đi” is consent; silence is
70
+ not.
71
+
72
+ ## Run the bundled helper only after consent
73
+
74
+ The skill loader provides this directory as the skill resource base. Substitute
75
+ that real path for `<skill-resource-base>`; never use a copied, machine-specific
76
+ path from documentation.
77
+
78
+ ```bash
79
+ # Safe inspection only: resolves the serving tree but changes nothing.
80
+ bash <skill-resource-base>/scripts/restart-dsh-web.sh \
81
+ --repo /path/to/deepseek-harness --dry-run
82
+ ```
83
+
84
+ Run the `dsh_web_restart` tool instead of executing the helper — the helper is
85
+ for external agents and humans. In-session agents must never run it from their
86
+ own turn (see "Never do these" below).
87
+
88
+ `--repo` may be replaced by `DSH_REPO`; `--log` or `DSH_RESTART_LOG` changes
89
+ the append-only log destination. The helper refuses a real swap without
90
+ `--confirm`, dynamically resolves listeners rather than trusting saved PIDs,
91
+ and refuses to launch if ports are still occupied. `--dry-run` never runs
92
+ `kill` or `setsid`.
93
+
94
+ The helper reloads a stale supervisor daemon itself, before it stops `dsh web`,
95
+ and aborts the swap (exit 70) when that reload fails — keeping the old process
96
+ beats handing a fresh boot to old rollback rules. Both daemon modes are
97
+ standalone: no `--repo`, no listeners, no `--confirm`, and they never touch
98
+ `dsh web`.
99
+
100
+ ```bash
101
+ bash <skill-resource-base>/scripts/restart-dsh-web.sh --check-supervisor # fresh|stale|absent
102
+ bash <skill-resource-base>/scripts/restart-dsh-web.sh --reload-supervisor # reload only when stale
103
+ ```
104
+
105
+ `DSH_SUPERVISOR_RELOAD_WAIT` (seconds, default 15) bounds the wait for systemd
106
+ to bring the daemon back. Only systemd owns that relaunch
107
+ (`dsh-web-supervisor.service` is `Restart=always`), so a hand-started daemon is
108
+ reported and left running, never killed.
109
+
110
+ ## In-session validation without restart
111
+
112
+ In-session agents have three tools (same row as `dsh_web_restart`) that never
113
+ touch the live process:
114
+
115
+ - `dsh_web_dryboot` (`{ timeoutMs? }`) — boots a copy of the live profile on an
116
+ ephemeral port with an isolated `DSH_HOME` and returns `{ ok, detail }`.
117
+ Prefer this over hand-rolled `cp -r` + spawn: the copy repairs relative
118
+ `link:` symlinks and the child is always killed with the temp home removed.
119
+ - `dsh_web_gc` (`{ confirm? }`) — lists orphaned dry-boot processes
120
+ (`DSH_HOME=/tmp/dsh-dryboot-*` + ephemeral listener, never self / live ports
121
+ / real-home processes). Default returns the preview list; `confirm:true`
122
+ SIGKILLs and verifies absence.
123
+ - `dsh_web_restart_status` (no params) — reads the calling session's restart
124
+ outcome: `pending` until the daemon swaps, then `ok`/`failed` with
125
+ `oldPid`/`newPid`/`httpStatus`. `dsh_web_restart` itself now returns
126
+ `{ ok, detail, oldPid, intentPath }` — quote all four when reporting. Its
127
+ `detail` also carries the supervisor-daemon verdict and the real swap budget
128
+ (see "Budget the turn, not the tool call").
129
+
130
+ Settings-staging rule: config-lib memoizes settings per process, so an
131
+ out-of-band settings edit is invisible to the host until restart. Stage ALL
132
+ such edits, then restart ONCE. Prefer in-host Settings UI saves — they are
133
+ visible immediately with no restart at all.
134
+
135
+ TLS note for plugin authors: Node/undici reads `NODE_EXTRA_CA_CERTS` from the
136
+ birth environment only; assigning it at runtime is silently ignored. The
137
+ durable path for a local CA (e.g. a Govard/Caddy dev CA) is a systemd user
138
+ drop-in (`~/.config/systemd/user/dsh-web.service.d/*.conf` with
139
+ `Environment=NODE_EXTRA_CA_CERTS=<path>`), followed by a daemon reload and a
140
+ host restart.
141
+
142
+ ## Budget the turn, not the tool call
143
+
144
+ `dsh_web_restart` returns in well under a second. The swap does not: measured
145
+ 2026-10-02, schedule → outcome took **5m04s** — the dry-boot gate, the daemon's
146
+ poll for the request, the ~90s SIGTERM stop and the new boot all sit inside
147
+ that window. Plan against minutes, and shape the turn so the swap costs one
148
+ turn instead of five.
149
+
150
+ - **Call it as the LAST action of the turn.** The swap kills the calling turn
151
+ mid-flight; a `sleep`/verify tool call issued in the same turn is discarded
152
+ (`tool call interrupted … no result durably recorded`) and has to be re-issued.
153
+ Verify with `dsh_web_restart_status` in the **next** turn.
154
+ - **Do not call `dsh_web_dryboot` first when the plugin tree changed.** The
155
+ restart tool runs that gate itself; a separate call just pays for a second
156
+ full boot of every linked plugin.
157
+ - **Read the daemon verdict in the tool's own result.** It now classifies the
158
+ supervisor daemon (`fresh` / `stale` / `absent` / `unknown`) at schedule time.
159
+ A `stale` line carries the exact `kill -TERM <daemon pid>` to run **now, in
160
+ this turn, before the swap lands** — systemd brings it back in ~2s. Reloading
161
+ it after the restart is the mistake that costs an extra cycle (2026-10-02:
162
+ build 19:58:19, daemon started 19:18:01, discovered only after the swap).
163
+ - **Skip the fixed "sleep 150s and hope" tail.** Poll `dsh_web_restart_status`
164
+ and the listener tree instead; a rollback loop shows up in the daemon's
165
+ outcome and the pid, not in an arbitrary wait.
166
+ - **One restart per batch.** Stage every settings/lib change, then restart once.
167
+ Config-lib memoizes per process, so N edits need N restarts unless they are
168
+ staged together.
169
+
170
+ ## Post-swap checks
171
+
172
+ Do not read the top of an old append-only log as liveness evidence. Instead:
173
+
174
+ 1. Confirm exactly one healthy process owns the listener tree 3080/3081 +
175
+ 127.0.0.1:3082 with `ss -tlnp` (port 3000 is no longer bound).
176
+ 2. Confirm HTTP 200 from port 3080 (the Maestro PIN login page is 200; the
177
+ app itself loads after the PIN).
178
+ 3. Check served bytes contain the **new**, unique marker; or make a fresh
179
+ browser/Playwright probe for the changed UI. Shared third-party markers are
180
+ not sufficient proof.
181
+ 4. If a marker or live behaviour is wrong, restore the retained last-known-good
182
+ assets and relaunch with the same guarded process.
183
+
184
+ ## Never do these
185
+
186
+ - Kill the process from an inline agent shell; the killing action can terminate
187
+ that shell before it relaunches DSH.
188
+ - **Never invoke this skill from inside a DSH chat session's agent turn.** The agent itself runs inside `dsh web`; killing `dsh web` from its own turn interrupts that turn (`interrupted` in the append-only log) and the `setsid nohup` relaunch never completes from the killed shell. If you are an agent, run the `dsh_web_restart` tool instead — it performs the swap from the safe side of the tree. Print the exact `setsid nohup ... --confirm` command only when the tool is unavailable, and only for the human to run in their own terminal; do not execute it yourself.
189
+ - Restart for a client-only or static change.
190
+ - Hard-code a PID or a local developer's workspace path.
191
+ - Treat a 200 response alone as proof that a rebuilt plugin was loaded.
192
+ - Treat a rebuilt `lib/` as loaded while the supervisor daemon that judges the
193
+ boot still runs the previous one; the two processes load the code separately.
194
+ - Sleep, curl or otherwise verify inside the same turn that called
195
+ `dsh_web_restart` — that turn dies at the swap and the check is thrown away.
196
+ - Run a separate `dsh_web_dryboot` before `dsh_web_restart`; the restart tool
197
+ already gates on it, and a second boot is pure wall-clock cost.
198
+
199
+ ## Agent handoff (required when you are an agent)
200
+
201
+ If you are running inside `dsh web` (any `dsh-*` skill, `maestro-*` skill, or subagent), you **must not** execute the helper or the restart yourself:
202
+
203
+ 1. Run all preflight checks (`--dry-run`, `pnpm verify`, marker grep) and report the results.
204
+ 2. Run the `dsh_web_restart` tool instead of executing the helper — the helper is for external agents and humans.
205
+ 3. If the tool reports it is unavailable, print the exact detached `setsid nohup ... --confirm` command for the human to run; then wait for explicit human confirmation in a new terminal. The interrupted turn will rehydrate from the log when the browser reconnects — no data is lost.
206
+ 4. A stale supervisor daemon blocks a correct restart just as much as a stale `lib/`, and in-session you cannot run the helper (`restart-dsh-web` in a command is refused by the self-kill guard, as is any `systemctl`). Compare the daemon start (`ps -o lstart= -p "$(pgrep -f 'lib/bin.js daemon')"` — quote the pid you actually resolved) with `stat -c '%y' <package>/lib/*.js`; when the build is newer, reload with a bare `kill -TERM <daemon pid>` after confirming `/proc/<pid>/cmdline` contains `bin.js daemon`. systemd restarts it in ~2s and `dsh web`, the browser and the session are untouched — never signal the `dsh web` pid for this. If that form is refused, or the daemon does not come back as a new pid, stop and hand the human the exact pid plus the reload command (same handoff as step 3); never fall back to `systemctl` or a broad `pkill`.