@inflatable-cookie/longhorn-poodle-svelte 0.1.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/package.json +171 -0
  4. package/src/bindings/index.ts +4 -0
  5. package/src/bindings/layout.svelte.ts +143 -0
  6. package/src/bindings/lifecycle.svelte.ts +246 -0
  7. package/src/bindings/optimistic.svelte.ts +96 -0
  8. package/src/bindings/scheduler.ts +13 -0
  9. package/src/bindings/surface-transfer-actions.ts +281 -0
  10. package/src/bindings/surface-transfer.svelte.ts +230 -0
  11. package/src/bindings/surfaces.svelte.ts +179 -0
  12. package/src/bindings/transfer-actions.ts +240 -0
  13. package/src/bindings/transfer-model.ts +138 -0
  14. package/src/bindings/transfer.svelte.ts +388 -0
  15. package/src/bindings/window-chrome.ts +63 -0
  16. package/src/bindings/window-drag.ts +161 -0
  17. package/src/commands/poodle/CommandPaletteBinding.svelte +51 -0
  18. package/src/commands/poodle/KeybindingSettings.svelte +138 -0
  19. package/src/commands/poodle/projectors.ts +37 -0
  20. package/src/commands/poodle.ts +9 -0
  21. package/src/commands/svelte/lifecycle.ts +13 -0
  22. package/src/commands/svelte/session.svelte.ts +212 -0
  23. package/src/commands/svelte.ts +2 -0
  24. package/src/config/poodle/BackupSettingsPage.svelte +295 -0
  25. package/src/config/poodle/RestoreSettingsPage.svelte +535 -0
  26. package/src/config/poodle/StorageSettingsPage.svelte +361 -0
  27. package/src/config/poodle/restore-model.ts +63 -0
  28. package/src/config/poodle/types.ts +11 -0
  29. package/src/config/poodle.ts +8 -0
  30. package/src/history/svelte/lifecycle.ts +13 -0
  31. package/src/history/svelte/session.svelte.ts +97 -0
  32. package/src/history/svelte.ts +2 -0
  33. package/src/history-tree/svelte/lifecycle.ts +11 -0
  34. package/src/history-tree/svelte/session.svelte.ts +27 -0
  35. package/src/history-tree/svelte.ts +3 -0
  36. package/src/licence/poodle/LicenceActivation.svelte +62 -0
  37. package/src/licence/poodle/LicenceSeats.svelte +57 -0
  38. package/src/licence/poodle/LicenceStatus.svelte +34 -0
  39. package/src/licence/poodle/LicenceSurface.svelte.ts +43 -0
  40. package/src/licence/poodle.ts +3 -0
  41. package/src/native-content/index.ts +4 -0
  42. package/src/native-content/lifecycle.ts +13 -0
  43. package/src/native-content/session.svelte.ts +526 -0
  44. package/src/native-content/viewport.ts +27 -0
  45. package/src/native-content/visibility.ts +19 -0
  46. package/src/notifications/poodle/NotificationPanel.svelte +66 -0
  47. package/src/notifications/poodle/NotificationToastHost.svelte +40 -0
  48. package/src/notifications/poodle/NotificationToastStack.svelte +22 -0
  49. package/src/notifications/poodle/projectors.ts +30 -0
  50. package/src/notifications/poodle.ts +4 -0
  51. package/src/notifications/svelte/lifecycle.ts +11 -0
  52. package/src/notifications/svelte/session.svelte.ts +57 -0
  53. package/src/notifications/svelte.ts +2 -0
  54. package/src/operation/poodle/OperationPanel.svelte +200 -0
  55. package/src/operation/poodle/projectors.ts +78 -0
  56. package/src/operation/poodle.ts +2 -0
  57. package/src/operation/svelte/lifecycle.ts +13 -0
  58. package/src/operation/svelte/session.svelte.ts +80 -0
  59. package/src/operation/svelte.ts +2 -0
  60. package/src/poodle/LayoutDockRegion.svelte +148 -0
  61. package/src/poodle/LayoutSplitView.svelte +120 -0
  62. package/src/poodle/LayoutTabs.svelte +91 -0
  63. package/src/poodle/binding.ts +401 -0
  64. package/src/poodle/document.ts +117 -0
  65. package/src/poodle/index.ts +8 -0
  66. package/src/poodle/projectors.ts +125 -0
  67. package/src/poodle/transfer.ts +188 -0
  68. package/src/poodle/types.ts +89 -0
  69. package/src/settings/poodle/SettingsShell.svelte +382 -0
  70. package/src/settings/poodle.ts +2 -0
  71. package/src/settings/svelte/context.ts +61 -0
  72. package/src/settings/svelte/document.svelte.ts +202 -0
  73. package/src/settings/svelte/errors.ts +84 -0
  74. package/src/settings/svelte/lifecycle.ts +18 -0
  75. package/src/settings/svelte/page.svelte.ts +266 -0
  76. package/src/settings/svelte/runtime.svelte.ts +187 -0
  77. package/src/settings/svelte/scope.svelte.ts +123 -0
  78. package/src/settings/svelte/session.svelte.ts +288 -0
  79. package/src/settings/svelte/types.ts +90 -0
  80. package/src/settings/svelte.ts +6 -0
  81. package/src/svelte.d.ts +6 -0
  82. package/src/update/poodle/UpdateCentre.svelte +64 -0
  83. package/src/update/poodle/UpdateSettings.svelte +64 -0
  84. package/src/update/poodle/UpdateStatus.svelte +51 -0
  85. package/src/update/poodle/UpdateSurface.svelte.ts +88 -0
  86. package/src/update/poodle.ts +3 -0
@@ -0,0 +1,535 @@
1
+ <script lang="ts">
2
+ import {
3
+ Button,
4
+ Callout,
5
+ ConfirmAction,
6
+ DetailItem,
7
+ Field,
8
+ FormActions,
9
+ Grid,
10
+ RadioGroup,
11
+ Select,
12
+ Stack,
13
+ Surface,
14
+ } from "@inflatable-cookie/poodle-svelte";
15
+ import type { RadioGroupOption, SelectOption } from "@inflatable-cookie/poodle-svelte";
16
+ import { onMount } from "svelte";
17
+
18
+ import {
19
+ CONFIG_OPERATIONS_PROTOCOL_VERSION,
20
+ RESTORE_AUTHENTICITY_LABELS,
21
+ RESTORE_INTEGRITY_LABELS,
22
+ type ConfigOperationRejection,
23
+ type ConfigOperationsSnapshot,
24
+ type RestoreAdapterReceiptProjection,
25
+ type RestoreDomainChoice,
26
+ type RestoreDomainInspectionProjection,
27
+ type RestoreExecutionFailureProjection,
28
+ type RestoreExecutionReceiptProjection,
29
+ type RestoreInspectionProjection,
30
+ type RestorePlanProjection,
31
+ type RestoreRecoveryReceiptProjection,
32
+ } from "@inflatable-cookie/longhorn/config";
33
+ import {
34
+ canUseArchive,
35
+ compatibilityLabel,
36
+ identityLabel,
37
+ type RestoreChoice,
38
+ } from "./restore-model.ts";
39
+ import type { ConfigOperationsPageProps } from "./types.ts";
40
+
41
+ type Activity = "idle" | "inspecting" | "planning" | "publishing" | "recovering";
42
+
43
+ let {
44
+ client,
45
+ initialSnapshot = null,
46
+ nextRequestId = () => `config:${crypto.randomUUID()}`,
47
+ onSnapshot,
48
+ }: ConfigOperationsPageProps = $props();
49
+
50
+ const initialSnapshotValue = (() => initialSnapshot)();
51
+ let snapshot = $state<ConfigOperationsSnapshot | null>(initialSnapshotValue);
52
+ let selection = $state("hostPicker");
53
+ let inspection = $state<RestoreInspectionProjection | null>(null);
54
+ let inspectionGeneration = $state<number | null>(null);
55
+ let choices = $state<Record<string, RestoreChoice>>({});
56
+ let plan = $state<RestorePlanProjection | null>(null);
57
+ let planGeneration = $state<number | null>(null);
58
+ let activity = $state<Activity>("idle");
59
+ let error = $state<string | null>(null);
60
+ let notice = $state<string | null>(null);
61
+ // Its own flag: `refresh` runs under `run("idle", ...)`, so `activity` says
62
+ // nothing about the first read being in flight.
63
+ let loading = $state(false);
64
+ let failure = $state<RestoreExecutionFailureProjection | null>(null);
65
+ let execution = $state<RestoreExecutionReceiptProjection | null>(null);
66
+ let adapterReceipt = $state<RestoreAdapterReceiptProjection | null>(null);
67
+ let recoveryReceipt = $state<RestoreRecoveryReceiptProjection | null>(null);
68
+
69
+ const restore = $derived(snapshot?.restore ?? null);
70
+ const canInspect = $derived(snapshot?.capabilities.includes("restoreInspection") === true);
71
+ const canExecute = $derived(snapshot?.capabilities.includes("restoreExecution") === true);
72
+ const canExecuteAdapter = $derived(
73
+ snapshot?.capabilities.includes("restoreAdapterExecution") === true,
74
+ );
75
+ const canRecover = $derived(snapshot?.capabilities.includes("restoreRecovery") === true);
76
+ const blockedByRestore = $derived(
77
+ restore?.state === "active" || restore?.state === "recoveryRequired",
78
+ );
79
+ const allChoicesMade = $derived(
80
+ inspection !== null &&
81
+ inspection.domains.every((domain) => choices[domain.domainId] === "useArchive" ||
82
+ choices[domain.domainId] === "keepCurrent") &&
83
+ inspection.domains.some((domain) => choices[domain.domainId] === "useArchive"),
84
+ );
85
+ const archiveOptions = $derived<SelectOption[]>([
86
+ { value: "hostPicker", label: "Choose archive…" },
87
+ ...(snapshot?.backup?.inventory.archives.map((archive) => ({
88
+ value: archive.archiveSha256,
89
+ label: `${archive.createdAt} — ${archive.archiveId}`,
90
+ })) ?? []),
91
+ ]);
92
+ const conflictOptions: RadioGroupOption[] = [
93
+ { value: "useArchive", label: "Use archive" },
94
+ { value: "keepCurrent", label: "Keep current" },
95
+ ];
96
+
97
+ onMount(() => {
98
+ if (snapshot === null) void refresh();
99
+ });
100
+
101
+ async function refresh(): Promise<void> {
102
+ loading = true;
103
+ await run("idle", async () => {
104
+ acceptSnapshot(
105
+ await client.snapshot({
106
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
107
+ requestId: nextRequestId(),
108
+ }),
109
+ );
110
+ });
111
+ loading = false;
112
+ }
113
+
114
+ async function inspect(): Promise<void> {
115
+ clearResult();
116
+ await run("inspecting", async () => {
117
+ const outcome = await client.inspectRestore({
118
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
119
+ requestId: nextRequestId(),
120
+ selection:
121
+ selection === "hostPicker"
122
+ ? { source: "hostPicker" }
123
+ : { source: "inventory", archiveSha256: selection },
124
+ });
125
+ if (outcome.status === "ready") {
126
+ inspection = outcome.inspection;
127
+ inspectionGeneration = outcome.generation;
128
+ choices = Object.fromEntries(
129
+ outcome.inspection.domains.map((domain) => [domain.domainId, ""]),
130
+ );
131
+ } else if (outcome.status === "locked") {
132
+ error = `Archive locked: ${outcome.detail}`;
133
+ } else {
134
+ reject(outcome.rejection);
135
+ }
136
+ });
137
+ }
138
+
139
+ async function createPlan(): Promise<void> {
140
+ if (inspection === null || inspectionGeneration === null || !allChoicesMade) return;
141
+ await run("planning", async () => {
142
+ const domainChoices: RestoreDomainChoice[] = inspection!.domains.map((domain) => ({
143
+ domainId: domain.domainId,
144
+ choice: choices[domain.domainId] as Exclude<RestoreChoice, "">,
145
+ }));
146
+ const outcome = await client.planRestore({
147
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
148
+ requestId: nextRequestId(),
149
+ generation: inspectionGeneration!,
150
+ archiveSha256: inspection!.archiveSha256,
151
+ choices: domainChoices,
152
+ });
153
+ if (outcome.status === "ready") {
154
+ plan = outcome.plan;
155
+ planGeneration = outcome.generation;
156
+ } else {
157
+ reject(outcome.rejection);
158
+ }
159
+ });
160
+ }
161
+
162
+ async function execute(): Promise<void> {
163
+ if (plan === null || planGeneration === null) return;
164
+ await run("publishing", async () => {
165
+ const outcome = await client.executeRestore({
166
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
167
+ requestId: nextRequestId(),
168
+ generation: planGeneration!,
169
+ confirmationDigest: plan!.confirmationDigest,
170
+ });
171
+ if (outcome.status === "succeeded") {
172
+ execution = outcome.receipt;
173
+ acceptSnapshot(outcome.snapshot);
174
+ notice = "Restore published and verified.";
175
+ } else if (outcome.status === "rolledBack") {
176
+ failure = outcome.failure;
177
+ acceptSnapshot(outcome.snapshot);
178
+ notice = "Restore failed and the host verified rollback.";
179
+ } else if (outcome.status === "recoveryRequired") {
180
+ failure = outcome.failure;
181
+ acceptSnapshot(outcome.snapshot);
182
+ error = "Restore could not establish rollback. Recovery is required.";
183
+ } else {
184
+ reject(outcome.rejection);
185
+ }
186
+ });
187
+ }
188
+
189
+ async function executeAdapter(
190
+ domainId: string,
191
+ confirmationDigest: string,
192
+ requirement: "failureAtomic" | "allowSeparate",
193
+ ): Promise<void> {
194
+ if (inspection === null || inspectionGeneration === null) return;
195
+ await run("publishing", async () => {
196
+ const outcome = await client.executeAdapterRestore({
197
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
198
+ requestId: nextRequestId(),
199
+ generation: inspectionGeneration!,
200
+ archiveSha256: inspection!.archiveSha256,
201
+ domainId,
202
+ confirmationDigest,
203
+ requirement,
204
+ });
205
+ if (outcome.status === "completed") {
206
+ adapterReceipt = outcome.receipt;
207
+ acceptSnapshot(outcome.snapshot);
208
+ notice = `Adapter restore finished with ${outcome.receipt.outcome}.`;
209
+ } else {
210
+ reject(outcome.rejection);
211
+ }
212
+ });
213
+ }
214
+
215
+ function executeInspectedAdapter(
216
+ domain: RestoreDomainInspectionProjection,
217
+ ): Promise<void> {
218
+ if (domain.compatibility.status !== "customAdapterReady") {
219
+ return Promise.resolve();
220
+ }
221
+ return executeAdapter(
222
+ domain.domainId,
223
+ domain.compatibility.confirmationDigest,
224
+ domain.compatibility.participation.kind === "failureAtomic"
225
+ ? "failureAtomic"
226
+ : "allowSeparate",
227
+ );
228
+ }
229
+
230
+ async function recover(): Promise<void> {
231
+ await run("recovering", async () => {
232
+ const outcome = await client.recoverRestore({
233
+ protocolVersion: CONFIG_OPERATIONS_PROTOCOL_VERSION,
234
+ requestId: nextRequestId(),
235
+ });
236
+ if (outcome.status === "recovered") {
237
+ recoveryReceipt = outcome.receipt;
238
+ acceptSnapshot(outcome.snapshot);
239
+ notice = `Recovery finished with ${outcome.receipt.outcome}.`;
240
+ } else if (outcome.status === "recoveryRequired") {
241
+ failure = outcome.failure;
242
+ acceptSnapshot(outcome.snapshot);
243
+ error = "Recovery remains required.";
244
+ } else {
245
+ reject(outcome.rejection);
246
+ }
247
+ });
248
+ }
249
+
250
+ async function run(nextActivity: Activity, action: () => Promise<void>): Promise<void> {
251
+ activity = nextActivity;
252
+ error = null;
253
+ notice = null;
254
+ try {
255
+ await action();
256
+ } catch (cause) {
257
+ error = cause instanceof Error ? cause.message : String(cause);
258
+ } finally {
259
+ activity = "idle";
260
+ }
261
+ }
262
+
263
+ function choose(domainId: string, choice: string): void {
264
+ choices = { ...choices, [domainId]: choice as RestoreChoice };
265
+ plan = null;
266
+ planGeneration = null;
267
+ }
268
+
269
+ function reject(rejection: ConfigOperationRejection): void {
270
+ error = `${rejection.code}: ${rejection.detail}`;
271
+ if (rejection.snapshot) acceptSnapshot(rejection.snapshot);
272
+ if (rejection.code === "restorePlanStale" || rejection.code === "authorityChanged") {
273
+ plan = null;
274
+ planGeneration = null;
275
+ }
276
+ }
277
+
278
+ function clearResult(): void {
279
+ inspection = null;
280
+ inspectionGeneration = null;
281
+ choices = {};
282
+ plan = null;
283
+ planGeneration = null;
284
+ failure = null;
285
+ execution = null;
286
+ adapterReceipt = null;
287
+ }
288
+
289
+ function acceptSnapshot(value: ConfigOperationsSnapshot): void {
290
+ snapshot = value;
291
+ onSnapshot?.(value);
292
+ }
293
+ </script>
294
+
295
+ <div aria-busy={activity !== "idle"}>
296
+ <Stack gap="md">
297
+ {#if error}
298
+ <Callout tone="danger" title="Restore operation failed" message={error} announceMode="assertive" />
299
+ {/if}
300
+ {#if notice}
301
+ <Callout tone="success" title="Restore operation complete" message={notice} announceMode="polite" />
302
+ {/if}
303
+
304
+ <!-- Three different situations used to render this one warning: the first
305
+ read still in flight, a read that failed, and a host that genuinely
306
+ composed no restore inspection. Only the third is what the message claims, and a
307
+ Retry beside the other two is either pointless or premature. The load
308
+ is now its own state, so what a reader sees is what happened. -->
309
+ {#if restore === null && snapshot === null && loading}
310
+ <Callout tone="pending" title="Loading restore inspection" announceMode="polite" />
311
+ {:else if snapshot === null}
312
+ <Callout
313
+ tone="warning"
314
+ title="Settings could not be read"
315
+ message="No configuration snapshot arrived. The read did not fail, so the host answered with nothing."
316
+ >
317
+ {#snippet actions()}
318
+ <Button onClick={() => void refresh()}>Retry</Button>
319
+ {/snippet}
320
+ </Callout>
321
+ {:else if restore === null}
322
+ <Callout
323
+ tone="warning"
324
+ title="Restore unavailable"
325
+ message="This host did not compose restore inspection for this window."
326
+ />
327
+ {:else if blockedByRestore}
328
+ <Callout
329
+ tone="danger"
330
+ title={restore.state === "active" ? "Restore publication in progress" : "Recovery required"}
331
+ message="Configuration reads and mutations remain blocked until the host establishes a terminal restore state."
332
+ announceMode="assertive"
333
+ >
334
+ {#snippet actions()}
335
+ {#if canRecover}
336
+ <ConfirmAction
337
+ title="Run restore recovery?"
338
+ description="The host will inspect the durable restore journal and establish rollback or completed publication."
339
+ triggerLabel="Run recovery"
340
+ confirmLabel="Confirm recovery"
341
+ onConfirm={recover}
342
+ />
343
+ {/if}
344
+ {/snippet}
345
+ </Callout>
346
+ {:else}
347
+ <Surface asRole="region" label="Select restore archive">
348
+ <Field id="longhorn-restore-archive" label="Backup archive">
349
+ <Grid columns="minmax(12rem, 1fr) auto" gap="sm">
350
+ <Stack>
351
+ <Select
352
+ id="longhorn-restore-archive"
353
+ value={selection}
354
+ options={archiveOptions}
355
+ native={true}
356
+ disabled={activity !== "idle" || !canInspect}
357
+ onValueChange={(value) => (selection = value)}
358
+ />
359
+ </Stack>
360
+ <Stack direction="row" align="end">
361
+ <Button
362
+ variant="secondary"
363
+ loading={activity === "inspecting"}
364
+ disabled={activity !== "idle" || !canInspect}
365
+ onClick={() => void inspect()}
366
+ >
367
+ Inspect archive
368
+ </Button>
369
+ </Stack>
370
+ </Grid>
371
+ </Field>
372
+ <p>Paths, unlock material, and archive bytes remain inside host authority.</p>
373
+ </Surface>
374
+
375
+ {#if inspection}
376
+ <Surface asRole="region" label="Verified archive inspection">
377
+ <h3>Verified archive</h3>
378
+ <Grid columns="repeat(auto-fit, minmax(14rem, 1fr))" gap="md">
379
+ <DetailItem label="Archive" value={inspection.archiveId} />
380
+ <DetailItem label="Created" value={inspection.createdAt} />
381
+ <DetailItem label="Integrity" value={RESTORE_INTEGRITY_LABELS[inspection.integrity]} />
382
+ <DetailItem label="Authenticity" value={RESTORE_AUTHENTICITY_LABELS[inspection.authenticity]} />
383
+ <DetailItem label="Application identity" value={identityLabel(inspection.identity.application)} />
384
+ <DetailItem label="Producer identity" value={identityLabel(inspection.identity.producer)} />
385
+ <DetailItem label="Archive digest" value={inspection.archiveSha256} truncateValue={true} />
386
+ </Grid>
387
+ </Surface>
388
+
389
+ <section aria-label="Restore conflict choices">
390
+ <h3>Domain choices</h3>
391
+ {#each inspection.domains as domain (domain.domainId)}
392
+ <Surface asRole="group" label={domain.domainId}>
393
+ <Grid columns="minmax(0, 1fr) minmax(12rem, auto)" gap="md">
394
+ <Stack gap="sm">
395
+ <strong>{domain.domainId}</strong>
396
+ <p>{compatibilityLabel(domain.compatibility)}</p>
397
+ <small>{domain.storageClass} · {domain.consistencyGroup} · {domain.sourceState}</small>
398
+ </Stack>
399
+ <Stack>
400
+ <RadioGroup
401
+ ariaLabel={`Restore choice for ${domain.domainId}`}
402
+ value={choices[domain.domainId]}
403
+ options={conflictOptions.map((option) => ({
404
+ ...option,
405
+ disabled: option.value === "useArchive" && !canUseArchive(domain),
406
+ }))}
407
+ disabled={activity !== "idle"}
408
+ onValueChange={(value) => choose(domain.domainId, value)}
409
+ />
410
+ </Stack>
411
+ </Grid>
412
+ {#if domain.compatibility.status === "customAdapterReady" && canExecuteAdapter}
413
+ <ConfirmAction
414
+ title={`Restore ${domain.domainId} with ${domain.compatibility.adapter}?`}
415
+ description="This is a separate adapter-owned operation with its own terminal receipt."
416
+ triggerLabel="Restore with adapter…"
417
+ confirmLabel="Run adapter restore"
418
+ onConfirm={() => executeInspectedAdapter(domain)}
419
+ />
420
+ {/if}
421
+ </Surface>
422
+ {/each}
423
+ </section>
424
+
425
+ {#if inspection.consistencyGroups.length > 0}
426
+ <Surface asRole="region" label="Archive consistency groups">
427
+ <h3>Consistency groups</h3>
428
+ <Stack gap="sm" asRole="list">
429
+ {#each inspection.consistencyGroups as group (group.id)}
430
+ <span role="listitem"><strong>{group.id}</strong>: {group.mode} via {group.authority}</span>
431
+ {/each}
432
+ </Stack>
433
+ </Surface>
434
+ {/if}
435
+
436
+ {#if inspection.exclusions.length > 0}
437
+ <Callout
438
+ tone="info"
439
+ title="Archive exclusions"
440
+ message={inspection.exclusions
441
+ .map((excluded) => `${excluded.domainId}: ${excluded.reason}`)
442
+ .join(", ")}
443
+ />
444
+ {/if}
445
+
446
+ <FormActions>
447
+ <Button
448
+ variant="secondary"
449
+ loading={activity === "planning"}
450
+ disabled={activity !== "idle" || !allChoicesMade}
451
+ onClick={() => void createPlan()}
452
+ >
453
+ Review exact plan
454
+ </Button>
455
+ </FormActions>
456
+ {/if}
457
+
458
+ {#if plan}
459
+ <Surface asRole="region" label="Exact restore plan">
460
+ <h3>Exact restore plan</h3>
461
+ <p>
462
+ {plan.receipt.selected} selected; {plan.receipt.skipped} preserved;
463
+ {plan.receipt.migrations} migration(s).
464
+ </p>
465
+ <Stack gap="sm" asRole="list">
466
+ {#each plan.entries as entry (entry.domainId)}
467
+ <span role="listitem">
468
+ <strong>{entry.domainId}</strong>: {entry.choice}
469
+ {#if entry.action} → {entry.action}{/if}
470
+ {#if entry.current?.state === "present"}
471
+ ({entry.current.byteLength} bytes, {entry.current.sha256})
472
+ {/if}
473
+ </span>
474
+ {/each}
475
+ </Stack>
476
+ <p>{plan.confirmationDigest}</p>
477
+ {#if canExecute}
478
+ <ConfirmAction
479
+ title="Publish this exact restore plan?"
480
+ description="The host will recheck current evidence, stage privately, create a safety backup, then publish under a durable journal."
481
+ triggerLabel="Restore selected domains…"
482
+ confirmLabel="Publish restore"
483
+ onConfirm={execute}
484
+ />
485
+ {/if}
486
+ </Surface>
487
+ {/if}
488
+ {/if}
489
+
490
+ {#if activity === "publishing"}
491
+ <Callout
492
+ tone="warning"
493
+ title="Host-owned publication in progress"
494
+ message="Closing this view does not cancel staging, safety backup, publication, rollback, or recovery."
495
+ announceMode="assertive"
496
+ />
497
+ {:else if activity === "recovering"}
498
+ <Callout
499
+ tone="warning"
500
+ title="Host-owned recovery in progress"
501
+ message="Closing this view does not cancel recovery."
502
+ announceMode="assertive"
503
+ />
504
+ {/if}
505
+
506
+ {#if execution}
507
+ <Callout
508
+ tone="success"
509
+ title="Verified restore receipt"
510
+ message={`${execution.restoredDomainIds.length} domain(s) restored; safety backup ${execution.safetyBackup.archiveSha256}.`}
511
+ />
512
+ {/if}
513
+ {#if failure}
514
+ <Callout
515
+ tone={failure.terminal === "recoveryRequired" ? "danger" : "warning"}
516
+ title={`Restore terminal: ${failure.terminal}`}
517
+ message={`${failure.stage}: ${failure.detail}`}
518
+ />
519
+ {/if}
520
+ {#if adapterReceipt}
521
+ <Callout
522
+ tone={adapterReceipt.outcome === "recoveryRequired" ? "danger" : "info"}
523
+ title="Adapter restore receipt"
524
+ message={`${adapterReceipt.domainId}: ${adapterReceipt.outcome}`}
525
+ />
526
+ {/if}
527
+ {#if recoveryReceipt}
528
+ <Callout
529
+ tone="success"
530
+ title="Recovery receipt"
531
+ message={`${recoveryReceipt.outcome}; ${recoveryReceipt.domainIds.length} domain(s) considered.`}
532
+ />
533
+ {/if}
534
+ </Stack>
535
+ </div>