home-hosted 0.12.0 → 0.13.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 (221) hide show
  1. package/README.md +95 -49
  2. package/dist/chunks/{archive-DpCwA8Nf.js → archive-DP-XQR8X.js} +15 -2
  3. package/dist/chunks/archive-DP-XQR8X.js.map +1 -0
  4. package/dist/chunks/{atomic-CEfCUfkQ.js → atomic-C1PfJpE7.js} +3 -2
  5. package/dist/chunks/atomic-C1PfJpE7.js.map +1 -0
  6. package/dist/chunks/{backup-CPrJVPJI.js → backup-CZcVca2a.js} +101 -76
  7. package/dist/chunks/backup-CZcVca2a.js.map +1 -0
  8. package/dist/chunks/{backups-Bd2SF2qd.js → backups-CFRaWe_m.js} +881 -536
  9. package/dist/chunks/backups-CFRaWe_m.js.map +1 -0
  10. package/dist/chunks/{contracts-ku5ypHXJ.js → contracts-CMBD1TF9.js} +381 -407
  11. package/dist/chunks/contracts-CMBD1TF9.js.map +1 -0
  12. package/dist/chunks/{daemon-TwXk5vb8.js → daemon-qKVECISl.js} +52 -20
  13. package/dist/chunks/daemon-qKVECISl.js.map +1 -0
  14. package/dist/chunks/{docker-CGv4Uv7w.js → docker-Cy9Lyvda.js} +4 -3
  15. package/dist/chunks/docker-Cy9Lyvda.js.map +1 -0
  16. package/dist/chunks/{down-BlX5X3bm.js → down-pKbGCW9d.js} +22 -17
  17. package/dist/chunks/down-pKbGCW9d.js.map +1 -0
  18. package/dist/chunks/{init-DdmqHVra.js → init-BZ7hK9Vf.js} +19 -6
  19. package/dist/chunks/init-BZ7hK9Vf.js.map +1 -0
  20. package/dist/chunks/{last-stop-BZ08Z89-.js → last-stop-C-BXz_XI.js} +6 -5
  21. package/dist/chunks/last-stop-C-BXz_XI.js.map +1 -0
  22. package/dist/chunks/{layout-D74TGUnr.js → layout-DwTtmund.js} +2 -2
  23. package/dist/chunks/{layout-D74TGUnr.js.map → layout-DwTtmund.js.map} +1 -1
  24. package/dist/chunks/lazy-Ce5zEAq1.js +66 -0
  25. package/dist/chunks/lazy-Ce5zEAq1.js.map +1 -0
  26. package/dist/chunks/{log-buffer-HnP0jKhZ.js → log-buffer-Dy9HHDMD.js} +114 -50
  27. package/dist/chunks/log-buffer-Dy9HHDMD.js.map +1 -0
  28. package/dist/chunks/{logs-gI_69Q1P.js → logs---TI_bxM.js} +23 -21
  29. package/dist/chunks/logs---TI_bxM.js.map +1 -0
  30. package/dist/chunks/{migrate-BTlsibvF.js → migrate-Cfoq-Vgh.js} +5 -5
  31. package/dist/chunks/{migrate-BTlsibvF.js.map → migrate-Cfoq-Vgh.js.map} +1 -1
  32. package/dist/chunks/{nanny-CjnnrIpm.js → nanny-B-Eu0sFW.js} +3 -3
  33. package/dist/chunks/{nanny-CjnnrIpm.js.map → nanny-B-Eu0sFW.js.map} +1 -1
  34. package/dist/chunks/{nanny-20aBXL1o.js → nanny-BtWfy0QH.js} +121 -23
  35. package/dist/chunks/nanny-BtWfy0QH.js.map +1 -0
  36. package/dist/chunks/{nanny-DUaAfCV-.js → nanny-ChMtq1Zl.js} +3 -3
  37. package/dist/chunks/{nanny-DUaAfCV-.js.map → nanny-ChMtq1Zl.js.map} +1 -1
  38. package/dist/chunks/{nanny-sweep-Ca9kPAVi.js → nanny-sweep-DErnlPY1.js} +5 -4
  39. package/dist/chunks/nanny-sweep-DErnlPY1.js.map +1 -0
  40. package/dist/chunks/{parse-B9owE47G.js → parse-DhmG26fI.js} +4 -4
  41. package/dist/chunks/{parse-B9owE47G.js.map → parse-DhmG26fI.js.map} +1 -1
  42. package/dist/chunks/{paths-BT94q6-w.js → paths-CGlGDrOU.js} +36 -2
  43. package/dist/chunks/paths-CGlGDrOU.js.map +1 -0
  44. package/dist/chunks/{restart-UZgeDukG.js → restart-Des4DrAN.js} +25 -59
  45. package/dist/chunks/restart-Des4DrAN.js.map +1 -0
  46. package/dist/chunks/{schema-o7Lgk0V1.js → schema-B240VXcV.js} +11 -10
  47. package/dist/chunks/schema-B240VXcV.js.map +1 -0
  48. package/dist/chunks/{secrets-D7PdYh71.js → secrets-BieELnZh.js} +22 -4
  49. package/dist/chunks/secrets-BieELnZh.js.map +1 -0
  50. package/dist/chunks/{server-BuIeSsRu.js → server-Bge2r2qQ.js} +3 -3
  51. package/dist/chunks/{server-BuIeSsRu.js.map → server-Bge2r2qQ.js.map} +1 -1
  52. package/dist/chunks/{set-password-DegMumPh.js → set-password-D5vZqqSX.js} +7 -7
  53. package/dist/chunks/set-password-D5vZqqSX.js.map +1 -0
  54. package/dist/chunks/{set-token-21d1FTDC.js → set-token-obPiEJYk.js} +7 -7
  55. package/dist/chunks/set-token-obPiEJYk.js.map +1 -0
  56. package/dist/chunks/{settings-BVSBnIwJ.js → settings-xu-XTfWg.js} +126 -35
  57. package/dist/chunks/settings-xu-XTfWg.js.map +1 -0
  58. package/dist/chunks/{setup-temp-XiuAtiW2.js → setup-temp-CAN4_bA-.js} +6 -6
  59. package/dist/chunks/setup-temp-CAN4_bA-.js.map +1 -0
  60. package/dist/chunks/{src-BL97vLVb.js → src-BtWMFmzZ.js} +2246 -1061
  61. package/dist/chunks/src-BtWMFmzZ.js.map +1 -0
  62. package/dist/chunks/{status-EuWdRq8Q.js → status-DT1EsA-B.js} +12 -8
  63. package/dist/chunks/status-DT1EsA-B.js.map +1 -0
  64. package/dist/chunks/{ui-DbPuwddJ.js → ui-D562aqw5.js} +9 -7
  65. package/dist/chunks/ui-D562aqw5.js.map +1 -0
  66. package/dist/chunks/{ui-revert-BhqOAhmM.js → ui-revert-EkBBwRTt.js} +3 -3
  67. package/dist/chunks/{ui-revert-BhqOAhmM.js.map → ui-revert-EkBBwRTt.js.map} +1 -1
  68. package/dist/chunks/{ui-switch-CMoslPO2.js → ui-switch-BnZTdMDd.js} +3 -3
  69. package/dist/chunks/{ui-switch-CMoslPO2.js.map → ui-switch-BnZTdMDd.js.map} +1 -1
  70. package/dist/chunks/{ui-update-TTBBoDik.js → ui-update-_xryLYxw.js} +5 -5
  71. package/dist/chunks/{ui-update-TTBBoDik.js.map → ui-update-_xryLYxw.js.map} +1 -1
  72. package/dist/chunks/{up-C4H13hBw.js → up-Pdz-l6IH.js} +25 -11
  73. package/dist/chunks/up-Pdz-l6IH.js.map +1 -0
  74. package/dist/chunks/{usage-CSBgLRN5.js → usage-DFrCVXpT.js} +29 -3
  75. package/dist/chunks/usage-DFrCVXpT.js.map +1 -0
  76. package/dist/chunks/{workspaces-CAln2sQ7.js → workspaces-DYcfvKV_.js} +16 -8
  77. package/dist/chunks/workspaces-DYcfvKV_.js.map +1 -0
  78. package/dist/chunks/wsl-temperature-BiCI4iK6.js.map +1 -1
  79. package/dist/cli.js +80 -70
  80. package/dist/cli.js.map +1 -1
  81. package/dist/client.js +25 -1
  82. package/dist/client.js.map +1 -1
  83. package/dist/types/api/backups.d.ts +8 -3
  84. package/dist/types/api/control.d.ts +4 -3
  85. package/dist/types/api/events.d.ts +2 -1
  86. package/dist/types/api/health.d.ts +1 -0
  87. package/dist/types/api/metrics.d.ts +3 -1
  88. package/dist/types/api/settings.d.ts +2 -2
  89. package/dist/types/api/state.d.ts +8 -2
  90. package/dist/types/app.d.ts +26 -11
  91. package/dist/types/cli/backup.d.ts +7 -0
  92. package/dist/types/cli/down.d.ts +5 -0
  93. package/dist/types/cli/logs.d.ts +14 -2
  94. package/dist/types/cli/restart.d.ts +0 -1
  95. package/dist/types/cli/set-password.d.ts +2 -2
  96. package/dist/types/cli/up.d.ts +8 -2
  97. package/dist/types/client.d.ts +5618 -11
  98. package/dist/types/config/secrets.d.ts +2 -0
  99. package/dist/types/config/settings.d.ts +54 -8
  100. package/dist/types/config/store.d.ts +16 -3
  101. package/dist/types/config/workspaces.d.ts +4 -1
  102. package/dist/types/helpers/copy-tree.d.ts +5 -0
  103. package/dist/types/helpers/daemon.d.ts +20 -7
  104. package/dist/types/helpers/error.d.ts +8 -0
  105. package/dist/types/helpers/event-stream.d.ts +21 -0
  106. package/dist/types/helpers/openapi.d.ts +12 -24
  107. package/dist/types/helpers/paths.d.ts +18 -0
  108. package/dist/types/helpers/utf8-chunks.d.ts +15 -0
  109. package/dist/types/middleware/auth.d.ts +19 -3
  110. package/dist/types/providers/host.d.ts +1 -1
  111. package/dist/types/providers/log-tail.d.ts +27 -0
  112. package/dist/types/providers/nanny-sweep.d.ts +3 -0
  113. package/dist/types/providers/nanny.d.ts +10 -0
  114. package/dist/types/providers/proc.d.ts +9 -0
  115. package/dist/types/providers/process.d.ts +17 -0
  116. package/dist/types/providers/telegram.d.ts +45 -3
  117. package/dist/types/providers/wsl-temperature.d.ts +0 -4
  118. package/dist/types/services/auth.d.ts +36 -4
  119. package/dist/types/services/backups.d.ts +125 -1
  120. package/dist/types/services/ddns.d.ts +5 -0
  121. package/dist/types/services/exposure.d.ts +54 -1
  122. package/dist/types/services/history.d.ts +1 -0
  123. package/dist/types/services/host-monitor.d.ts +1 -0
  124. package/dist/types/services/log-buffer.d.ts +11 -0
  125. package/dist/types/services/log-files.d.ts +1 -11
  126. package/dist/types/services/log-relay.d.ts +0 -1
  127. package/dist/types/services/panel.d.ts +19 -0
  128. package/dist/types/services/proxy-certificates/certificates.d.ts +116 -0
  129. package/dist/types/services/proxy.d.ts +46 -69
  130. package/dist/types/services/state.d.ts +0 -3
  131. package/dist/types/services/supervisor/entry.d.ts +10 -0
  132. package/dist/types/services/supervisor/health.d.ts +3 -2
  133. package/dist/types/services/supervisor/output.d.ts +126 -0
  134. package/dist/types/services/supervisor/persistent.d.ts +4 -1
  135. package/dist/types/services/supervisor/records.d.ts +81 -1
  136. package/dist/types/services/supervisor.d.ts +32 -0
  137. package/dist/types/shared/action-outcome.d.ts +25 -0
  138. package/dist/types/shared/api-client.d.ts +218 -4
  139. package/dist/types/shared/backup-scope.d.ts +58 -0
  140. package/dist/types/shared/contracts.d.ts +142 -200
  141. package/dist/types/shared/ddns-form.d.ts +13 -0
  142. package/dist/types/shared/form-repair.d.ts +6 -0
  143. package/dist/types/shared/lazy.d.ts +4 -0
  144. package/dist/types/shared/live-frames.d.ts +22 -0
  145. package/dist/types/shared/live-series.d.ts +21 -0
  146. package/dist/types/shared/live-store.d.ts +72 -0
  147. package/dist/types/shared/patch-diff.d.ts +13 -2
  148. package/dist/types/shared/proxy-form.d.ts +2 -0
  149. package/dist/types/shared/server-form.d.ts +121 -0
  150. package/dist/types/shared/stream-access.d.ts +20 -0
  151. package/docs/API.md +45 -16
  152. package/docs/BACKUPS.md +31 -11
  153. package/docs/CLI.md +34 -61
  154. package/docs/DDNS.md +3 -1
  155. package/docs/NOTIFICATIONS.md +7 -1
  156. package/docs/REVERSE_PROXY.md +7 -1
  157. package/docs/SECURITY.md +21 -10
  158. package/docs/SERVERS.md +102 -23
  159. package/docs/UI_CREATION.md +10 -1
  160. package/docs/demo/blank-host-restore.sh +4 -3
  161. package/package.json +5 -7
  162. package/uis/stock/dist/assets/CopyButton-BUBKRJyY.js +1 -0
  163. package/uis/stock/dist/assets/GlobalSettingsView-yYMcRWvt.js +1 -0
  164. package/uis/stock/dist/assets/LogViewer-DIliXy62.js +1 -0
  165. package/uis/stock/dist/assets/LogsView-B7Z-7RNg.js +1 -0
  166. package/uis/stock/dist/assets/Modal-DmKa5Qpp.js +39 -0
  167. package/uis/stock/dist/assets/ProxyView-DvZiNkwb.js +1 -0
  168. package/uis/stock/dist/assets/ServerDetailView-6idGT_EX.js +2 -0
  169. package/uis/stock/dist/assets/SettingsShell-CeGtleYI.js +1 -0
  170. package/uis/stock/dist/assets/SettingsView-BrhJIrmk.js +2 -0
  171. package/uis/stock/dist/assets/de-BRITeb0H.js +1 -0
  172. package/uis/stock/dist/assets/es-B2zIEssV.js +1 -0
  173. package/uis/stock/dist/assets/fr-s0ZOBEqh.js +1 -0
  174. package/uis/stock/dist/assets/index-C1MehbKy.css +2 -0
  175. package/uis/stock/dist/assets/index-CnBN54wF.js +15 -0
  176. package/uis/stock/dist/assets/ja-CU7MR85V.js +1 -0
  177. package/uis/stock/dist/assets/ko-tL5Me6d-.js +1 -0
  178. package/uis/stock/dist/assets/ru-92yrvkNJ.js +1 -0
  179. package/uis/stock/dist/assets/vi-CzvY16k2.js +1 -0
  180. package/uis/stock/dist/assets/zh-CN-DDwFW_uW.js +1 -0
  181. package/uis/stock/dist/index.html +3 -2
  182. package/uis/stock/dist/ui.json +3 -3
  183. package/dist/chunks/archive-DpCwA8Nf.js.map +0 -1
  184. package/dist/chunks/atomic-CEfCUfkQ.js.map +0 -1
  185. package/dist/chunks/backup-CPrJVPJI.js.map +0 -1
  186. package/dist/chunks/backups-Bd2SF2qd.js.map +0 -1
  187. package/dist/chunks/contracts-ku5ypHXJ.js.map +0 -1
  188. package/dist/chunks/daemon-TwXk5vb8.js.map +0 -1
  189. package/dist/chunks/docker-CGv4Uv7w.js.map +0 -1
  190. package/dist/chunks/down-BlX5X3bm.js.map +0 -1
  191. package/dist/chunks/init-DdmqHVra.js.map +0 -1
  192. package/dist/chunks/last-stop-BZ08Z89-.js.map +0 -1
  193. package/dist/chunks/log-buffer-HnP0jKhZ.js.map +0 -1
  194. package/dist/chunks/logs-gI_69Q1P.js.map +0 -1
  195. package/dist/chunks/nanny-20aBXL1o.js.map +0 -1
  196. package/dist/chunks/nanny-sweep-Ca9kPAVi.js.map +0 -1
  197. package/dist/chunks/paths-BT94q6-w.js.map +0 -1
  198. package/dist/chunks/restart-UZgeDukG.js.map +0 -1
  199. package/dist/chunks/schema-o7Lgk0V1.js.map +0 -1
  200. package/dist/chunks/secrets-D7PdYh71.js.map +0 -1
  201. package/dist/chunks/set-password-DegMumPh.js.map +0 -1
  202. package/dist/chunks/set-token-21d1FTDC.js.map +0 -1
  203. package/dist/chunks/settings-BVSBnIwJ.js.map +0 -1
  204. package/dist/chunks/setup-temp-XiuAtiW2.js.map +0 -1
  205. package/dist/chunks/src-BL97vLVb.js.map +0 -1
  206. package/dist/chunks/status-EuWdRq8Q.js.map +0 -1
  207. package/dist/chunks/ui-DbPuwddJ.js.map +0 -1
  208. package/dist/chunks/up-C4H13hBw.js.map +0 -1
  209. package/dist/chunks/usage-CSBgLRN5.js.map +0 -1
  210. package/dist/chunks/workspaces-CAln2sQ7.js.map +0 -1
  211. package/docs/RESTORE_DEMO.md +0 -306
  212. package/uis/stock/dist/assets/de-DyGrM1KK.js +0 -1
  213. package/uis/stock/dist/assets/es-BebHdc0E.js +0 -1
  214. package/uis/stock/dist/assets/fr-DsDTrxhI.js +0 -1
  215. package/uis/stock/dist/assets/index-6LANO2Ua.css +0 -2
  216. package/uis/stock/dist/assets/index-D06cUZbM.js +0 -56
  217. package/uis/stock/dist/assets/ja-D3RARJjW.js +0 -1
  218. package/uis/stock/dist/assets/ko-CKI3dFoD.js +0 -1
  219. package/uis/stock/dist/assets/ru-DEU5ujXt.js +0 -1
  220. package/uis/stock/dist/assets/vi-ULKPnasj.js +0 -1
  221. package/uis/stock/dist/assets/zh-CN-tCvnOxWy.js +0 -1
@@ -9,16 +9,32 @@
9
9
  * Every dependency here is already in `src/shared`, so this module imports nothing upward — the
10
10
  * constraint that keeps `rpc.ts` and the `ddns`/`proxy` helpers in the UIs, which import Vue.
11
11
  *
12
- * **Deliberately not here:** the workspace-scoped wrappers. Each UI spells that differently —
13
- * `noc-console` reads a reactive `selectedWorkspaceId`, `stock` takes an explicit argument — so their
14
- * `scoped()` differs and the calls that use it stay in the UI.
12
+ * **The workspace-scoped half lives here too** (see "Workspace-scoped calls" at the foot of this
13
+ * file). It used to be a hand-maintained copy in each UI's `lib/api.ts`, on the theory that each
14
+ * spells the workspace differently. They did not: 387 and 386 lines, 61% identical, 31 of 35 shared
15
+ * names, and three drifts. The only genuine difference was *where the workspace comes from*, which
16
+ * is now one injected resolver — see `useWorkspaceResolver`.
15
17
  */
16
- import type { DdnsView, ProxyPatch, ProxyView, RestorePlan, SessionView, SettingsView, UiStatus, WslTemperatureStatus } from './contracts.js';
18
+ import type { AppState, BackupSelection, DdnsConfig, DdnsView, FreePortResult, LogHistoryView, LogServerView, ProxyPatch, ProxyView, RestorePlan, ServerCreate, ServerPatch, ServerView, SessionView, SettingsPatch, SettingsSaved, SettingsView, UiStatus, WorkspaceCreate, WorkspaceSettingsPatch, WorkspaceSettingsView, WorkspaceView, WslTemperatureStatus } from './contracts.js';
19
+ import { tlsReviewResponseSchema } from './contracts.js';
17
20
  /** Thrown on a 401 with `code: "AUTH_REQUIRED"`, so the SPA can route to the login view. */
18
21
  export declare class AuthRequiredError extends Error {
19
22
  name: string;
20
23
  constructor();
21
24
  }
25
+ /**
26
+ * Thrown on a 401 that signing in cannot fix: no password is in force, so only the machine running
27
+ * the panel may use `/api`. `AUTH_UNARMED` is auth on without a password; `AUTH_DISABLED_REMOTE` is
28
+ * auth off and a caller that is not this machine. Both are answered the same way — set a password on
29
+ * that machine — and the message is the panel's own sentence saying so.
30
+ */
31
+ export declare class LocalOnlyError extends Error {
32
+ readonly code: string;
33
+ name: string;
34
+ constructor(message: string, code: string);
35
+ }
36
+ /** The 401 codes `LocalOnlyError` stands for. */
37
+ export declare const LOCAL_ONLY_CODES: ReadonlySet<string>;
22
38
  /**
23
39
  * What a restore may carry. Identical in both UIs apart from one doc comment; the fuller wording is
24
40
  * kept.
@@ -66,6 +82,11 @@ export interface CreateBackupOptions {
66
82
  export declare function createBackupBody(options?: CreateBackupOptions): Record<string, unknown>;
67
83
  /** The caller re-reads `/api/state` afterwards, which carries the fresh list. */
68
84
  export declare function createBackup(options?: CreateBackupOptions): Promise<unknown>;
85
+ /**
86
+ * What a created backup wants a person to look at: a declared path that held no files, say. The
87
+ * archive was still written. Absent on an older panel, and anything that is not a string is ignored.
88
+ */
89
+ export declare function backupWarnings(result: unknown): string[];
69
90
  /** Replaces the API token with a new one, returned once. Needs a signed-in session. */
70
91
  export declare function generateApiToken(): Promise<{
71
92
  token: string;
@@ -135,3 +156,196 @@ export declare function uploadUi(file: File): Promise<{
135
156
  meta: UiStatus['meta'];
136
157
  ui: UiStatus;
137
158
  }>;
159
+ /**
160
+ * Install the workspace resolver; called once per UI at module load.
161
+ *
162
+ * A setter rather than a constructor argument because the call sites are free functions the views
163
+ * import directly (`api.fetchLogServers()`), and threading an instance through every component
164
+ * would rewrite every view to buy nothing.
165
+ */
166
+ export declare function useWorkspaceResolver(resolve: () => string | null): void;
167
+ /**
168
+ * One workspace-scoped URL: `path` plus a `workspace` query, merged with whatever `extra` carries.
169
+ *
170
+ * A caller that names a workspace wins; the resolver is consulted only when it did not. An empty
171
+ * string counts as omitted — a blank id is never a workspace, and `?workspace=` would be a 404 on
172
+ * any panel whose default is not blank.
173
+ *
174
+ * The separator is chosen against the **path**, so a route already carrying a query (the log
175
+ * download link) appends with `&` instead of a second `?`. `stock`'s copy lacked that and was saved
176
+ * from being a live bug only by having no such caller; shared, it would have become both UIs'.
177
+ */
178
+ export declare function scoped(path: string, workspace?: string | null, extra?: URLSearchParams): string;
179
+ /**
180
+ * The typed view of a frame: the schema accepts a request-shaped `port` (possibly absent) while the
181
+ * panel always emits the normalized `number | null`, so these carry that one narrowing.
182
+ */
183
+ export type WorkspaceState = Omit<WorkspaceView, 'servers'> & {
184
+ servers: ServerView[];
185
+ };
186
+ export type AppStateView = Omit<AppState, 'workspaces'> & {
187
+ workspaces: WorkspaceState[];
188
+ };
189
+ export interface ActionResult {
190
+ ok: boolean;
191
+ error?: string;
192
+ }
193
+ export interface LogServerInfo extends LogServerView {
194
+ }
195
+ export interface LogQuery {
196
+ tail?: number;
197
+ search?: string;
198
+ stream?: string;
199
+ }
200
+ export interface WorkspaceRemoved {
201
+ ok: boolean;
202
+ removed: unknown;
203
+ }
204
+ /** Validated at the boundary: contract drift fails loudly here, not in the UI. */
205
+ export declare function fetchState(): Promise<AppStateView>;
206
+ /** Every workspace the panel serves, in panel order; the first is the default. */
207
+ export declare function fetchWorkspaces(): Promise<WorkspaceState[]>;
208
+ export declare function createWorkspace(input?: WorkspaceCreate): Promise<WorkspaceState>;
209
+ export declare function renameWorkspace(id: string, label: string): Promise<WorkspaceState>;
210
+ /**
211
+ * Stop and remove a workspace.
212
+ *
213
+ * One spelling, returning the removal the route documents. The copies differed — one typed the
214
+ * answer as `WorkspaceRemoved`, the other as an inline duplicate of the same object literal — and
215
+ * only this one was validated.
216
+ */
217
+ export declare function deleteWorkspace(id: string): Promise<{
218
+ ok: boolean;
219
+ removed: {
220
+ id: string;
221
+ label: string;
222
+ };
223
+ }>;
224
+ /**
225
+ * Writes the panel-wide groups, answering with where the listener lands.
226
+ *
227
+ * Validated, because this answer decides a redirect: `rebinding`/`targetUrl` is what tells the page
228
+ * to follow the panel to a new origin. A cast here would let a missing pair read as `undefined`,
229
+ * which is falsy, and leave the browser on a stale socket with no error.
230
+ */
231
+ export declare function patchSettings(patch: SettingsPatch): Promise<SettingsSaved>;
232
+ /** `GET /api/settings/workspace?workspace=<id>`: defaults, logs and notifications. */
233
+ export declare function fetchWorkspaceSettings(workspace?: string | null): Promise<WorkspaceSettingsView>;
234
+ export declare function patchWorkspaceSettings(patch: WorkspaceSettingsPatch, workspace?: string | null): Promise<WorkspaceSettingsView>;
235
+ export declare function fetchLogServers(workspace?: string | null): Promise<LogServerInfo[]>;
236
+ export declare function fetchLogHistory(id: string, query: LogQuery, workspace?: string | null): Promise<LogHistoryView>;
237
+ export declare function clearLogHistory(id: string, workspace?: string | null): Promise<unknown>;
238
+ /** Direct link; the session cookie is sent by the browser. */
239
+ export declare function logDownloadUrl(id: string, file: string, workspace?: string | null): string;
240
+ /**
241
+ * Backups are panel-wide: every workspace is a selectable entry in the archive.
242
+ *
243
+ * Validated, which is the half of this pair that used to differ — one UI checked the payload, the
244
+ * other cast it, so a contract change would have surfaced as an empty capture tree in exactly one
245
+ * product.
246
+ */
247
+ export declare function fetchBackups(): Promise<BackupSelection>;
248
+ /**
249
+ * A Telegram destination's bot token.
250
+ *
251
+ * Keyed by destination id in the path: a workspace may point at several chats and each carries its
252
+ * own bot. The token never travels in the settings patch, so it never lands in a config file.
253
+ */
254
+ export declare function saveTelegramToken(id: string, botToken: string, workspace?: string | null): Promise<{
255
+ ok: boolean;
256
+ username: string | null;
257
+ }>;
258
+ export declare function clearTelegramToken(id: string, workspace?: string | null): Promise<unknown>;
259
+ export declare function sendTelegramTest(id: string, payload: {
260
+ chatId?: string;
261
+ }, workspace?: string | null): Promise<{
262
+ ok: boolean;
263
+ error?: string;
264
+ }>;
265
+ export declare function detectTelegramChats(id: string, payload: {
266
+ botToken?: string;
267
+ }, workspace?: string | null): Promise<{
268
+ chats: Array<{
269
+ id: number | string;
270
+ title: string;
271
+ }>;
272
+ }>;
273
+ /**
274
+ * One webhook destination, as a settings form holds it. The whole draft travels, so an unsaved URL
275
+ * and header block are what gets tried — `id` is echoed so the result lands against the right row.
276
+ */
277
+ export interface WebhookTestTarget {
278
+ url: string;
279
+ method: 'POST' | 'PUT';
280
+ format: 'json' | 'text';
281
+ headers: string;
282
+ enabled: boolean;
283
+ cooldownMs: number;
284
+ onCrash: boolean;
285
+ onUnhealthy: boolean;
286
+ onForcedRestart: boolean;
287
+ onRecovered: boolean;
288
+ onHost: boolean;
289
+ onDdns: boolean;
290
+ }
291
+ export declare function testWebhook(workspace: string | null | undefined, payload: {
292
+ target: WebhookTestTarget;
293
+ id?: string;
294
+ }): Promise<{
295
+ ok: boolean;
296
+ error?: string;
297
+ }>;
298
+ export declare function fetchDdns(workspace?: string | null): Promise<DdnsView>;
299
+ export declare function saveDdns(config: DdnsConfig, workspace?: string | null): Promise<DdnsView>;
300
+ /** The provider travels with the request: the account may still be an unsaved draft. */
301
+ export declare function saveDdnsCredentials(id: string, provider: string, credentials: Record<string, string>, workspace?: string | null): Promise<DdnsView>;
302
+ export declare function clearDdnsCredentials(id: string, workspace?: string | null): Promise<DdnsView>;
303
+ /** Runs a pass now; the answer carries the fresh status. */
304
+ export declare function checkDdns(workspace?: string | null): Promise<DdnsView>;
305
+ /**
306
+ * One lifecycle call: start, stop or restart an entry.
307
+ *
308
+ * Plain `fetch`, not the typed RPC client `stock` had adopted. `rpc` is inferred from `AppType` in
309
+ * the server's `src/app.ts`, which `src/shared` may not import — that layering is what lets the
310
+ * server and both UIs build on this module. Nothing is lost by it here: a lifecycle refusal answers
311
+ * `{ ok: false, error }` rather than the `{ message }` envelope, and `failureMessage` reads both, so
312
+ * "port 3000 is already in use" still reaches the toast instead of "request failed with 409".
313
+ */
314
+ export declare function serverAction(id: string, action: 'start' | 'stop' | 'restart', workspace?: string | null): Promise<ActionResult>;
315
+ /** Stops a process the panel started that no entry claims any more; see the workspace view. */
316
+ export declare function stopOrphan(workspace: string | null | undefined, serverId: string): Promise<ActionResult>;
317
+ export declare function startAll(workspace?: string | null): Promise<unknown>;
318
+ /**
319
+ * Frees a server's port by asking the listener holding it to stop. The server re-lists the holders
320
+ * itself, so a pid quoted in an old banner is never signalled.
321
+ */
322
+ export declare function freePort(id: string, workspace?: string | null): Promise<FreePortResult>;
323
+ /**
324
+ * Stop every server in a workspace.
325
+ *
326
+ * `withPersistent` is the CLI's `--with-persistent`: a persistent entry outlives the panel, so
327
+ * leaving it running is the default and ending it has to be asked for.
328
+ */
329
+ export declare function stopAll(workspace?: string | null, options?: {
330
+ withPersistent?: boolean;
331
+ }): Promise<unknown>;
332
+ export declare function clearLogs(id: string, workspace?: string | null): Promise<unknown>;
333
+ export type ServerPatchPayload = Partial<ServerPatch> & Record<string, unknown>;
334
+ export declare function patchServer(id: string, patch: ServerPatchPayload, workspace?: string | null): Promise<unknown>;
335
+ export declare function removeServer(id: string, workspace?: string | null): Promise<unknown>;
336
+ /** The create body is exactly the strict, defaulted schema the route validates. */
337
+ export type CreateServerPayload = ServerCreate;
338
+ export declare function createServer(payload: CreateServerPayload, workspace?: string | null): Promise<unknown>;
339
+ /** The per-server event stream, addressed by the workspace that owns it. */
340
+ export declare function serverStreamUrl(id: string, workspace?: string | null): string;
341
+ /**
342
+ * What the panel's own TLS routes answer: the listener as it stands, and the move in flight.
343
+ *
344
+ * Deliberately **not** `SettingsSaved`. The routes return `{ control, rebinding, targetUrl }` only —
345
+ * no `host`, `backups` or `ui` — so the console's old `uploadTls(): Promise<SettingsSaveResult>`
346
+ * promised three fields the response never carried. A page that read one would have got `undefined`
347
+ * with nothing to fail on.
348
+ */
349
+ export type TlsReview = typeof tlsReviewResponseSchema.infer;
350
+ export declare function uploadTls(certificate: string, privateKey: string): Promise<TlsReview>;
351
+ export declare function clearTls(): Promise<TlsReview>;
@@ -26,6 +26,64 @@ export declare function selectionOf(options: {
26
26
  }): ((id: string) => boolean) & {
27
27
  isExcluded: (id: string) => boolean;
28
28
  };
29
+ /**
30
+ * One entry of the capture tree as a **selection** sees it: its id, plus the short ids that name it.
31
+ *
32
+ * The alias is not a second way to spell the id, it is part of the item: `config` is what the person
33
+ * ticks in a UI, `global:settings` is what the archive stores, and both name one file.
34
+ */
35
+ export interface SelectableItem {
36
+ id: string;
37
+ /** Coarse ids that select this item too (`config` for `global:settings`). */
38
+ aliases?: readonly string[];
39
+ }
40
+ /**
41
+ * The panel-wide entries, declared once.
42
+ *
43
+ * The restore's own item list and the credential guard both read this, so "which item is the
44
+ * credential file" cannot be answered two ways — which it was: the guard tested the exact id while
45
+ * the restore also honoured the alias, so `include: ["secrets"]` selected the item and skipped the
46
+ * guard. A second string literal at the guard would be the same defect one rename later.
47
+ */
48
+ export declare const GLOBAL_RESTORE_ITEMS: {
49
+ readonly settings: {
50
+ readonly id: "global:settings";
51
+ readonly aliases: readonly ["config"];
52
+ };
53
+ readonly credentials: {
54
+ readonly id: "global:secrets";
55
+ readonly aliases: readonly ["secrets"];
56
+ };
57
+ readonly tls: {
58
+ readonly id: "global:tls";
59
+ readonly aliases: readonly ["tls"];
60
+ };
61
+ };
62
+ /**
63
+ * The one rule for "does this selection choose this item", aliases included.
64
+ *
65
+ * An exclusion beats an alias (`--exclude global:secrets` must not be undone by the item's own
66
+ * short alias selecting it back in), then any of the item's ids may select it.
67
+ */
68
+ export declare function selectedBy(selects: ((id: string) => boolean) & {
69
+ isExcluded: (id: string) => boolean;
70
+ }, item: SelectableItem): boolean;
71
+ /**
72
+ * Whether a selection reaches anything inside one item: the item itself, an alias, or a leaf of it.
73
+ *
74
+ * A leaf counts because selection is downwards only — naming `global:secrets:password` does not
75
+ * select `global:secrets` — yet the restore still writes that one field of the same file.
76
+ *
77
+ * Both spellings of a leaf are recognised (`global:secrets:password` and its alias
78
+ * `secrets:password`), because an exclusion the person wrote as `--exclude secrets` reaches the
79
+ * leaves of that item through `selectionOf`'s prefix rule. Answering "the item is untouched" there
80
+ * while the restore still wrote its leaves was a real bypass: `{"exclude":["secrets"]}` — the
81
+ * spelling the docs recommend to leave credentials behind — rewrote the password and token hashes.
82
+ */
83
+ export declare function selectionTouches(options: {
84
+ include?: readonly string[];
85
+ exclude?: readonly string[];
86
+ }, item: SelectableItem): boolean;
29
87
  /**
30
88
  * Whether a restore selection would write the panel's own credential store.
31
89
  *