sealkeep 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +163 -14
- package/CHANGELOG.md +223 -1
- package/CONTROL_PLANE.md +2 -2
- package/LICENSE +1 -1
- package/README.md +108 -22
- package/THIRD_PARTY.md +2 -2
- package/THREAT_MODEL.md +23 -4
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/chunk-access.d.ts +26 -4
- package/dist/packages/sealkeep-crypto/src/chunk-access.js +219 -0
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/envelope.d.ts +11 -1
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/envelope.js +58 -21
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/format.d.ts +2 -2
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/index.d.ts +1 -0
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/index.js +1 -0
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/recipients.js +4 -4
- package/dist/packages/sealkeep-crypto/src/squeeze.d.ts +6 -0
- package/dist/packages/sealkeep-crypto/src/squeeze.js +39 -0
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/stream.d.ts +36 -3
- package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/stream.js +196 -37
- package/dist/site/index.html +1808 -1904
- package/dist/site/llms.txt +67 -0
- package/dist/site/trust/architecture-data-flow.html +53 -0
- package/dist/site/trust/audit-roadmap.html +37 -0
- package/dist/site/trust/deployment-responsibility.html +11 -0
- package/dist/site/trust/dpa-sample.html +30 -0
- package/dist/site/trust/release-provenance.html +21 -0
- package/dist/site/trust/subprocessors.html +15 -0
- package/dist/site/trust/threat-model.html +34 -0
- package/dist/site/trust/toms.html +41 -0
- package/dist/site/trust-document.css +32 -0
- package/dist/site/trust.html +73 -0
- package/dist/site/visual/assets/index-8Nxnkc7o.js +207 -0
- package/dist/site/visual/assets/index-oxLy1bpy.css +1 -0
- package/dist/site/visual/index.html +18 -0
- package/dist/site.zip +0 -0
- package/dist/src/activity.d.ts +9 -0
- package/dist/src/activity.js +90 -1
- package/dist/src/adapters.d.ts +175 -5
- package/dist/src/adapters.js +961 -73
- package/dist/src/agent-context.d.ts +135 -0
- package/dist/src/agent-context.js +1059 -0
- package/dist/src/archive-copies.d.ts +47 -0
- package/dist/src/archive-copies.js +179 -0
- package/dist/src/audit.d.ts +1 -1
- package/dist/src/audit.js +29 -4
- package/dist/src/autopilot.d.ts +52 -7
- package/dist/src/autopilot.js +143 -25
- package/dist/src/background-bandwidth.d.ts +46 -0
- package/dist/src/background-bandwidth.js +301 -0
- package/dist/src/background-cpu.d.ts +82 -0
- package/dist/src/background-cpu.js +212 -0
- package/dist/src/background-worker-error.d.ts +12 -0
- package/dist/src/background-worker-error.js +18 -0
- package/dist/src/branding.d.ts +24 -1
- package/dist/src/branding.js +31 -1
- package/dist/src/bridge.d.ts +233 -0
- package/dist/src/bridge.js +604 -0
- package/dist/src/byte-stream.d.ts +91 -0
- package/dist/src/byte-stream.js +385 -0
- package/dist/src/chunk-store.d.ts +41 -8
- package/dist/src/chunk-store.js +161 -65
- package/dist/src/cli.js +1698 -163
- package/dist/src/cloud.d.ts +841 -31
- package/dist/src/cloud.js +3196 -277
- package/dist/src/context-background.d.ts +37 -0
- package/dist/src/context-background.js +309 -0
- package/dist/src/context-drain-child.d.ts +1 -0
- package/dist/src/context-drain-child.js +98 -0
- package/dist/src/context-reader.d.ts +118 -0
- package/dist/src/context-reader.js +447 -0
- package/dist/src/control-plane/auth.d.ts +32 -4
- package/dist/src/control-plane/auth.js +85 -24
- package/dist/src/control-plane/server.js +19 -6
- package/dist/src/control-plane.d.ts +17 -1
- package/dist/src/control-plane.js +32 -6
- package/dist/src/crypto.d.ts +1 -1
- package/dist/src/crypto.js +5 -5
- package/dist/src/daemon-lease.d.ts +70 -0
- package/dist/src/daemon-lease.js +420 -0
- package/dist/src/daemon.d.ts +94 -1
- package/dist/src/daemon.js +1082 -105
- package/dist/src/darwin-service-policy.d.ts +41 -0
- package/dist/src/darwin-service-policy.js +60 -0
- package/dist/src/dashboard-cli.js +15 -15
- package/dist/src/device-authorization.d.ts +37 -0
- package/dist/src/device-authorization.js +199 -0
- package/dist/src/device-enrollment.d.ts +91 -0
- package/dist/src/device-enrollment.js +349 -0
- package/dist/src/disk.d.ts +17 -12
- package/dist/src/disk.js +43 -17
- package/dist/src/doctor.d.ts +35 -1
- package/dist/src/doctor.js +316 -41
- package/dist/src/durable-ticket-lock.d.ts +24 -0
- package/dist/src/durable-ticket-lock.js +232 -0
- package/dist/src/enroll.d.ts +1 -1
- package/dist/src/enroll.js +13 -7
- package/dist/src/env.d.ts +10 -1
- package/dist/src/env.js +11 -3
- package/dist/src/errors.d.ts +8 -8
- package/dist/src/errors.js +6 -6
- package/dist/src/flush.d.ts +12 -0
- package/dist/src/flush.js +37 -0
- package/dist/src/heartbeat.d.ts +86 -12
- package/dist/src/heartbeat.js +415 -29
- package/dist/src/index-background-watchdog.d.ts +1 -0
- package/dist/src/index-background-watchdog.js +94 -0
- package/dist/src/index-background-work.d.ts +21 -0
- package/dist/src/index-background-work.js +25 -0
- package/dist/src/index-background.d.ts +64 -0
- package/dist/src/index-background.js +394 -0
- package/dist/src/index-build-child.d.ts +1 -0
- package/dist/src/index-build-child.js +109 -0
- package/dist/src/index-manifest.d.ts +52 -0
- package/dist/src/index-manifest.js +444 -0
- package/dist/src/index-publication-proof.d.ts +84 -0
- package/dist/src/index-publication-proof.js +380 -0
- package/dist/src/index-publication-state.d.ts +149 -0
- package/dist/src/index-publication-state.js +696 -0
- package/dist/src/index-publication-verifier.d.ts +89 -0
- package/dist/src/index-publication-verifier.js +341 -0
- package/dist/src/index-publish.d.ts +62 -0
- package/dist/src/index-publish.js +540 -0
- package/dist/src/index-scratch-cleanup.d.ts +19 -0
- package/dist/src/index-scratch-cleanup.js +166 -0
- package/dist/src/index-segment-types.d.ts +132 -0
- package/dist/src/index-segment-types.js +21 -0
- package/dist/src/index-segments.d.ts +9 -0
- package/dist/src/index-segments.js +516 -0
- package/dist/src/index-store.d.ts +123 -0
- package/dist/src/index-store.js +495 -0
- package/dist/src/index-sync.d.ts +91 -15
- package/dist/src/index-sync.js +286 -53
- package/dist/src/index-upgrade-publication.d.ts +30 -0
- package/dist/src/index-upgrade-publication.js +179 -0
- package/dist/src/integration-manager.d.ts +32 -0
- package/dist/src/integration-manager.js +394 -0
- package/dist/src/leakscan.js +1 -1
- package/dist/src/local-api.d.ts +56 -15
- package/dist/src/local-api.js +4979 -541
- package/dist/src/machine-settings.d.ts +51 -0
- package/dist/src/machine-settings.js +166 -0
- package/dist/src/managed-chunks.d.ts +5 -2
- package/dist/src/managed-chunks.js +14 -14
- package/dist/src/mcp-install.d.ts +11 -9
- package/dist/src/mcp-install.js +73 -28
- package/dist/src/mcp-workspace.d.ts +18 -0
- package/dist/src/mcp-workspace.js +50 -0
- package/dist/src/mcp.js +294 -25
- package/dist/src/migrate.js +27 -21
- package/dist/src/notify.d.ts +1 -1
- package/dist/src/notify.js +5 -5
- package/dist/src/offload.d.ts +201 -14
- package/dist/src/offload.js +1848 -140
- package/dist/src/onboarding.d.ts +8 -1
- package/dist/src/onboarding.js +4 -4
- package/dist/src/packages.d.ts +2 -2
- package/dist/src/packages.js +10 -2
- package/dist/src/passkey.d.ts +0 -1
- package/dist/src/passkey.js +2 -7
- package/dist/src/password-lock.d.ts +2 -2
- package/dist/src/password-lock.js +6 -6
- package/dist/src/paths.d.ts +2 -0
- package/dist/src/paths.js +2 -0
- package/dist/src/presence.d.ts +86 -0
- package/dist/src/presence.js +240 -0
- package/dist/src/progress-deadline.d.ts +21 -0
- package/dist/src/progress-deadline.js +91 -0
- package/dist/src/project-repair.d.ts +55 -0
- package/dist/src/project-repair.js +131 -0
- package/dist/src/providers/gcs.d.ts +28 -7
- package/dist/src/providers/gcs.js +35 -24
- package/dist/src/providers/gdrive.d.ts +71 -8
- package/dist/src/providers/gdrive.js +223 -50
- package/dist/src/providers/index.d.ts +11 -3
- package/dist/src/providers/index.js +30 -10
- package/dist/src/providers/s3.d.ts +30 -8
- package/dist/src/providers/s3.js +41 -30
- package/dist/src/providers/safe-storage-fetch.d.ts +12 -0
- package/dist/src/providers/safe-storage-fetch.js +72 -0
- package/dist/src/queue.d.ts +136 -19
- package/dist/src/queue.js +862 -96
- package/dist/src/reclaim-transaction.d.ts +156 -0
- package/dist/src/reclaim-transaction.js +1027 -0
- package/dist/src/recovery-codes.d.ts +32 -0
- package/dist/src/recovery-codes.js +338 -0
- package/dist/src/recovery.js +12 -9
- package/dist/src/rehydrate.d.ts +25 -22
- package/dist/src/rehydrate.js +319 -23
- package/dist/src/restore.d.ts +57 -4
- package/dist/src/restore.js +272 -36
- package/dist/src/resume-stub.d.ts +92 -0
- package/dist/src/resume-stub.js +417 -0
- package/dist/src/retention.d.ts +98 -7
- package/dist/src/retention.js +1066 -62
- package/dist/src/rotate.js +3 -3
- package/dist/src/search.d.ts +566 -8
- package/dist/src/search.js +5897 -290
- package/dist/src/secrets.d.ts +51 -7
- package/dist/src/secrets.js +316 -24
- package/dist/src/service.d.ts +49 -11
- package/dist/src/service.js +776 -35
- package/dist/src/share.js +3 -3
- package/dist/src/shared-spaces.d.ts +98 -0
- package/dist/src/shared-spaces.js +214 -0
- package/dist/src/source-reader.d.ts +73 -0
- package/dist/src/source-reader.js +715 -0
- package/dist/src/spool.d.ts +1 -1
- package/dist/src/spool.js +1 -1
- package/dist/src/start-tui.js +2 -1
- package/dist/src/start.js +2 -2
- package/dist/src/storage-endpoint.d.ts +21 -0
- package/dist/src/storage-endpoint.js +122 -0
- package/dist/src/storage-setup.js +12 -12
- package/dist/src/storage-targets.d.ts +109 -6
- package/dist/src/storage-targets.js +975 -67
- package/dist/src/stream-to-cloud.d.ts +5 -1
- package/dist/src/stream-to-cloud.js +34 -14
- package/dist/src/sync-rules.d.ts +31 -6
- package/dist/src/sync-rules.js +153 -14
- package/dist/src/team-backfill-scheduling.d.ts +8 -0
- package/dist/src/team-backfill-scheduling.js +33 -0
- package/dist/src/team-backfill.d.ts +116 -0
- package/dist/src/team-backfill.js +1429 -0
- package/dist/src/team-index-cache.d.ts +16 -0
- package/dist/src/team-index-cache.js +152 -0
- package/dist/src/team-offboarding.d.ts +38 -0
- package/dist/src/team-offboarding.js +1043 -0
- package/dist/src/team-presence.d.ts +127 -0
- package/dist/src/team-presence.js +904 -0
- package/dist/src/team-publication-policy.d.ts +20 -0
- package/dist/src/team-publication-policy.js +140 -0
- package/dist/src/team-realtime.d.ts +68 -0
- package/dist/src/team-realtime.js +816 -0
- package/dist/src/team-source-facts-cache.d.ts +23 -0
- package/dist/src/team-source-facts-cache.js +255 -0
- package/dist/src/trash.d.ts +1 -1
- package/dist/src/trash.js +2 -2
- package/dist/src/tui.js +11 -12
- package/dist/src/types.d.ts +173 -7
- package/dist/src/types.js +20 -0
- package/dist/src/ui-server.d.ts +163 -35
- package/dist/src/ui-server.js +712 -72
- package/dist/src/ui.d.ts +1 -2
- package/dist/src/ui.js +1 -2
- package/dist/src/upload.d.ts +27 -0
- package/dist/src/upload.js +383 -43
- package/dist/src/vault.d.ts +226 -30
- package/dist/src/vault.js +1776 -192
- package/dist/src/watcher.d.ts +7 -1
- package/dist/src/watcher.js +198 -55
- package/dist/src/worker.d.ts +27 -3
- package/dist/src/worker.js +274 -55
- package/package.json +33 -12
- package/scripts/native-reboot-rehearsal.mjs +90 -0
- package/web/app.js +6032 -343
- package/web/bootstrap.js +17 -0
- package/web/index.html +255 -57
- package/web/rail.js +317 -40
- package/web/retention.html +2 -2
- package/web/rules-view.js +188 -16
- package/web/sessions-view.js +485 -62
- package/web/sessions.html +2 -2
- package/web/setup-api.js +152 -29
- package/web/setup-logic.js +68 -9
- package/web/setup.html +113 -44
- package/web/setup.js +604 -71
- package/web/style.css +513 -98
- package/dist/packages/vaultline-crypto/src/chunk-access.js +0 -93
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/aead.d.ts +0 -0
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/aead.js +0 -0
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/format.js +0 -0
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/recipients.d.ts +0 -0
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/sha256-stream.d.ts +0 -0
- /package/dist/packages/{vaultline-crypto → sealkeep-crypto}/src/sha256-stream.js +0 -0
package/dist/src/offload.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type ArchiveRecord } from "./types.js";
|
|
2
|
-
import { createActiveLease } from "./providers/index.js";
|
|
1
|
+
import { type ArchiveRecord, type ArchiveRecordV2, type RemoteObject } from "./types.js";
|
|
2
|
+
import { createActiveLease, type EndpointOverrides } from "./providers/index.js";
|
|
3
|
+
import { type ByteStream } from "./byte-stream.js";
|
|
3
4
|
/**
|
|
4
5
|
* Removing the local copy of an archive that lives in a bucket.
|
|
5
6
|
*
|
|
@@ -11,12 +12,15 @@ import { createActiveLease } from "./providers/index.js";
|
|
|
11
12
|
*
|
|
12
13
|
* Offloading finishes the job: once the bucket has a verified copy, the local
|
|
13
14
|
* one is redundant, and restoring downloads it back. Nothing is lost — but the
|
|
14
|
-
* archive stops being reachable while offline, which is a real trade
|
|
15
|
-
*
|
|
15
|
+
* archive stops being reachable while offline, which is a real trade. The
|
|
16
|
+
* daemon runs it automatically once an upload VERIFIES — freeing the disk is
|
|
17
|
+
* that loop's whole purpose — so the safety here is the verification gate,
|
|
18
|
+
* not an opt-in. (This comment used to claim "never automatic" while
|
|
19
|
+
* heartbeat.ts called it on every successful upload.)
|
|
16
20
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* the
|
|
21
|
+
* Removing either a local archive or a native source requires a genuine,
|
|
22
|
+
* verified remote copy. Source reclaim is an explicit/opt-in permanent purge;
|
|
23
|
+
* the encrypted archive remains the recovery copy after local bytes are freed.
|
|
20
24
|
*/
|
|
21
25
|
/**
|
|
22
26
|
* Just enough of a provider client to read an archive back. Injectable for the
|
|
@@ -24,7 +28,12 @@ import { createActiveLease } from "./providers/index.js";
|
|
|
24
28
|
* offloaded archive can be recovered has to be testable without a bucket.
|
|
25
29
|
*/
|
|
26
30
|
export type FetchClient = {
|
|
27
|
-
download?: (lease: ReturnType<typeof createActiveLease
|
|
31
|
+
download?: (lease: ReturnType<typeof createActiveLease>, options?: {
|
|
32
|
+
signal?: AbortSignal;
|
|
33
|
+
}) => Promise<Buffer>;
|
|
34
|
+
downloadStream?: (lease: ReturnType<typeof createActiveLease>, options?: {
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}) => Promise<ByteStream>;
|
|
28
37
|
};
|
|
29
38
|
export type OffloadCandidate = {
|
|
30
39
|
id: string;
|
|
@@ -32,19 +41,93 @@ export type OffloadCandidate = {
|
|
|
32
41
|
path: string;
|
|
33
42
|
/** What removing the local copy would give back. */
|
|
34
43
|
localBytes: number;
|
|
44
|
+
/** Filesystem blocks released when this is the inode's final named link. */
|
|
45
|
+
allocatedBytes: number;
|
|
35
46
|
provider: string;
|
|
36
47
|
bucket: string;
|
|
37
48
|
objectKey: string;
|
|
49
|
+
/** Exact verified copy selected as the restore source. */
|
|
50
|
+
copyId?: string;
|
|
38
51
|
};
|
|
39
52
|
export type OffloadBlocked = {
|
|
40
53
|
id: string;
|
|
41
54
|
reason: string;
|
|
42
55
|
};
|
|
43
|
-
export
|
|
56
|
+
export type OffloadOptions = {
|
|
57
|
+
/** Narrow a sweep to records at least this many days old. */
|
|
58
|
+
olderThanDays?: number;
|
|
59
|
+
/** Clock used by the age policy; injectable for deterministic previews/tests. */
|
|
60
|
+
now?: number;
|
|
61
|
+
/** Narrow a sweep to these archive ids. */
|
|
62
|
+
only?: ReadonlySet<string>;
|
|
63
|
+
/** Lets the daemon stop a long read-back proof without deleting anything. */
|
|
64
|
+
signal?: AbortSignal;
|
|
65
|
+
/** Aggregate ceiling used only by automatic/background read-back proofs. */
|
|
66
|
+
maxBytesPerSecond?: number;
|
|
67
|
+
/** Deterministic transaction seams; production callers never provide them. */
|
|
68
|
+
operations?: {
|
|
69
|
+
afterJournal?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
70
|
+
afterLinked?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
71
|
+
afterRemoteVerified?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
72
|
+
afterMetadata?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
73
|
+
afterSourceUnlinked?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
74
|
+
afterPurgeAuthorized?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
75
|
+
beforeStagingUnlink?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
76
|
+
afterStagingPurged?: (transaction: OffloadTransaction) => void | Promise<void>;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* The local-cache clock starts only after both facts are true: the archive
|
|
81
|
+
* exists and an off-machine copy has been verified. An old archive uploaded
|
|
82
|
+
* today therefore receives the same complete cache period as a new one.
|
|
83
|
+
*/
|
|
84
|
+
export declare function archiveCacheReferenceTime(record: ArchiveRecord): number;
|
|
85
|
+
export declare function offloadable(dataDir: string, options?: OffloadOptions): Promise<{
|
|
44
86
|
candidates: OffloadCandidate[];
|
|
45
87
|
blocked: OffloadBlocked[];
|
|
46
88
|
freeableBytes: number;
|
|
47
89
|
}>;
|
|
90
|
+
type OffloadStage = "prepared" | "linked" | "remote-verified" | "metadata-committed" | "source-unlinked" | "purge-authorized";
|
|
91
|
+
type OffloadFileIdentity = {
|
|
92
|
+
bytes: number;
|
|
93
|
+
allocatedBytes: number;
|
|
94
|
+
links: number;
|
|
95
|
+
dev: string;
|
|
96
|
+
ino: string;
|
|
97
|
+
};
|
|
98
|
+
/** Durable intent for removing one immutable local encrypted archive. */
|
|
99
|
+
export type OffloadTransaction = {
|
|
100
|
+
version: 1;
|
|
101
|
+
id: string;
|
|
102
|
+
archiveId: string;
|
|
103
|
+
objectPath: string;
|
|
104
|
+
stagingPath: string;
|
|
105
|
+
createdAt: string;
|
|
106
|
+
updatedAt: string;
|
|
107
|
+
stage: OffloadStage;
|
|
108
|
+
original: OffloadFileIdentity;
|
|
109
|
+
/** Exact final inode state authorised for the staged-name unlink. */
|
|
110
|
+
purgeSnapshot?: OffloadFileIdentity;
|
|
111
|
+
remote: {
|
|
112
|
+
copyId?: string;
|
|
113
|
+
destinationKey?: string;
|
|
114
|
+
provider: string;
|
|
115
|
+
bucket: string;
|
|
116
|
+
objectKey: string;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
export declare function offloadJournalPath(dataDir: string, id: string): string;
|
|
120
|
+
export declare function reconcileOffloadTransactions(dataDir: string, options?: OffloadOptions & {
|
|
121
|
+
client?: FetchClient;
|
|
122
|
+
overrides?: EndpointOverrides;
|
|
123
|
+
}): Promise<{
|
|
124
|
+
completed: OffloadCandidate[];
|
|
125
|
+
failed: {
|
|
126
|
+
id: string;
|
|
127
|
+
error: string;
|
|
128
|
+
}[];
|
|
129
|
+
freedBytes: number;
|
|
130
|
+
}>;
|
|
48
131
|
/**
|
|
49
132
|
* Removes local archives that a bucket has a verified copy of.
|
|
50
133
|
*
|
|
@@ -52,10 +135,10 @@ export declare function offloadable(dataDir: string): Promise<{
|
|
|
52
135
|
* accepted from a caller, so a page held open since yesterday cannot ask for
|
|
53
136
|
* the deletion of something that has since become the only copy.
|
|
54
137
|
*/
|
|
55
|
-
export declare function offloadArchives(dataDir: string, options?: {
|
|
138
|
+
export declare function offloadArchives(dataDir: string, options?: OffloadOptions & {
|
|
56
139
|
confirm?: boolean;
|
|
57
140
|
client?: FetchClient;
|
|
58
|
-
|
|
141
|
+
overrides?: EndpointOverrides;
|
|
59
142
|
freshlyVerified?: ReadonlySet<string>;
|
|
60
143
|
}): Promise<{
|
|
61
144
|
mode: "preview";
|
|
@@ -75,13 +158,23 @@ export declare function offloadArchives(dataDir: string, options?: {
|
|
|
75
158
|
freedBytes: number;
|
|
76
159
|
wouldOffload?: undefined;
|
|
77
160
|
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Downloads an archive's ciphertext from the bucket it was offloaded to.
|
|
163
|
+
*
|
|
164
|
+
* SEALKEEP_ENABLE_SIGNER gates *uploading*, and it is off unless the installed
|
|
165
|
+
* service turns it on. Reading back an archive in order to restore it is not
|
|
166
|
+
* uploading, and refusing it on that flag would mean an offloaded archive could
|
|
167
|
+
* not be recovered by the person who owns it — which would turn a space-saving
|
|
168
|
+
* feature into data loss. The flag is set for this call only.
|
|
169
|
+
*/
|
|
170
|
+
export declare function fetchCiphertextStream(dataDir: string, record: ArchiveRecordV2, client?: FetchClient, selectedCopy?: RemoteObject, overrides?: EndpointOverrides, signal?: AbortSignal, idleMs?: number, maxBytesPerSecond?: number): Promise<ByteStream>;
|
|
78
171
|
/**
|
|
79
172
|
* Asks the storage, right now, whether it still holds this archive.
|
|
80
173
|
*
|
|
81
174
|
* `remote.verifiedAt` says the copy was proven once; between then and now is
|
|
82
175
|
* exactly where a bucket lifecycle rule or a fat-fingered console delete
|
|
83
176
|
* lives. This is the question a person asks before trusting the cloud copy
|
|
84
|
-
* enough to
|
|
177
|
+
* enough to reclaim the original — so it goes to the provider, not to our own
|
|
85
178
|
* records, and it compares the size the provider reports against the size we
|
|
86
179
|
* recorded. It does not re-download the object: the byte-level proof already
|
|
87
180
|
* ran when the copy was verified, and runs again on any restore (AEAD refuses
|
|
@@ -94,7 +187,7 @@ export type CopyCheck = {
|
|
|
94
187
|
checkedAt: string;
|
|
95
188
|
detail: string;
|
|
96
189
|
};
|
|
97
|
-
export declare function checkRemoteCopy(dataDir: string, archiveId: string, client?: FetchClient): Promise<CopyCheck>;
|
|
190
|
+
export declare function checkRemoteCopy(dataDir: string, archiveId: string, client?: FetchClient, copyId?: string): Promise<CopyCheck>;
|
|
98
191
|
/**
|
|
99
192
|
* The bulk form of `checkRemoteCopy`. Managed rows share ONE control-plane
|
|
100
193
|
* listing instead of asking per archive — checking a 53-row vault is one call
|
|
@@ -105,6 +198,99 @@ export type Materialised = {
|
|
|
105
198
|
path: string;
|
|
106
199
|
release: () => Promise<void>;
|
|
107
200
|
};
|
|
201
|
+
export type MaterialiseOptions = {
|
|
202
|
+
/** Fetch this exact stored copy rather than whichever copy is primary. */
|
|
203
|
+
copyId?: string;
|
|
204
|
+
overrides?: EndpointOverrides;
|
|
205
|
+
/**
|
|
206
|
+
* Caller-owned scratch pathname. The transfer journal uses this so a
|
|
207
|
+
* restart knows exactly which temporary bytes it owns and may remove.
|
|
208
|
+
*/
|
|
209
|
+
path?: string;
|
|
210
|
+
/** Cancels a queued or active scratch fetch. Historical indexing uses this
|
|
211
|
+
* when its owning daemon stops, so the partial is removed before the child
|
|
212
|
+
* exits whenever the provider is still making progress. */
|
|
213
|
+
signal?: AbortSignal;
|
|
214
|
+
/** Cumulative verified staging bytes, for the caller's idle deadline. */
|
|
215
|
+
onProgress?: (bytes: number) => void;
|
|
216
|
+
/** Background callers share the vault-wide transfer bucket; manual restores
|
|
217
|
+
* remain explicitly unpaced unless their caller requests this ceiling. */
|
|
218
|
+
maxBytesPerSecond?: number;
|
|
219
|
+
/** Cooperative CPU checkpoint while hashing/staging a remote body. */
|
|
220
|
+
onYield?: () => void | Promise<void>;
|
|
221
|
+
/** Test/embedding seam. Ordinary callers use the operating-system temp
|
|
222
|
+
* directory; the chosen directory must already exist. */
|
|
223
|
+
scratchRoot?: string;
|
|
224
|
+
/** Maximum time to wait for another process that owns archive-sized scratch
|
|
225
|
+
* space. The default is deliberately short enough for an interactive action
|
|
226
|
+
* to finish with a retryable answer instead of looking permanently stuck. */
|
|
227
|
+
scratchWaitMs?: number;
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* Processes from different vaults can still spend the same filesystem's free
|
|
231
|
+
* bytes. Key the well-known lease by the scratch directory's device id in a
|
|
232
|
+
* per-user temp namespace; fall back to this vault's trusted runtime directory
|
|
233
|
+
* only on platforms where that identity cannot be established.
|
|
234
|
+
*/
|
|
235
|
+
export declare function ensurePrivateScratchCoordination(baseDir: string, user: string, expectedUid?: number | undefined): Promise<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Restores the sealed archive blob itself to this machine without decrypting
|
|
238
|
+
* the session. This is the safe first half of a remote-to-remote move: once a
|
|
239
|
+
* verified local blob exists, the ordinary target upload can copy it anywhere
|
|
240
|
+
* without buffering two providers through the browser or risking the source.
|
|
241
|
+
*/
|
|
242
|
+
export declare function restoreArchiveLocal(dataDir: string, archiveId: string, options?: {
|
|
243
|
+
copyId?: string;
|
|
244
|
+
client?: FetchClient;
|
|
245
|
+
overrides?: EndpointOverrides;
|
|
246
|
+
signal?: AbortSignal;
|
|
247
|
+
onProgress?: (bytes: number) => void;
|
|
248
|
+
}): Promise<{
|
|
249
|
+
restored: boolean;
|
|
250
|
+
alreadyPresent: boolean;
|
|
251
|
+
bytes: number;
|
|
252
|
+
path: string;
|
|
253
|
+
}>;
|
|
254
|
+
export type RestoreArchiveChainLocalResult = {
|
|
255
|
+
/** True when at least one encrypted chain link was downloaded. */
|
|
256
|
+
restored: boolean;
|
|
257
|
+
/** True only when every required link was already present and verified. */
|
|
258
|
+
alreadyPresent: boolean;
|
|
259
|
+
/** Total encrypted bytes the complete local chain occupies. */
|
|
260
|
+
bytes: number;
|
|
261
|
+
/** Encrypted bytes downloaded by this call. */
|
|
262
|
+
restoredBytes: number;
|
|
263
|
+
/** Canonical local path of the selected head. */
|
|
264
|
+
path: string;
|
|
265
|
+
/** Oldest complete base first, selected head last. */
|
|
266
|
+
chain: string[];
|
|
267
|
+
restoredArchiveIds: string[];
|
|
268
|
+
alreadyPresentArchiveIds: string[];
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Restore one logical session's complete encrypted delta chain.
|
|
272
|
+
*
|
|
273
|
+
* Every missing link is downloaded into a private sibling temporary file and
|
|
274
|
+
* checked against its authenticated ciphertext length and digest first. Only
|
|
275
|
+
* after the *whole* chain passes are the files hard-linked into their canonical
|
|
276
|
+
* paths. A hard link gives us an exclusive publish operation: another process
|
|
277
|
+
* cannot race this restore into overwriting an existing archive. If any publish
|
|
278
|
+
* fails, every path published by this call is removed again, while all remote
|
|
279
|
+
* copies and archive records remain untouched.
|
|
280
|
+
*
|
|
281
|
+
* Metadata is changed only after every required local file exists. A metadata
|
|
282
|
+
* write failure deliberately keeps the complete verified local chain as an
|
|
283
|
+
* extra safe copy and leaves all remote copies in place; it can never expose a
|
|
284
|
+
* head without its base or authorize a provider delete.
|
|
285
|
+
*/
|
|
286
|
+
export declare function restoreArchiveChainLocal(dataDir: string, archiveId: string, options?: {
|
|
287
|
+
/** Exact source for the selected head. */
|
|
288
|
+
copyId?: string;
|
|
289
|
+
/** Exact sources selected by the caller for individual chain links. */
|
|
290
|
+
copyIds?: Readonly<Record<string, string>>;
|
|
291
|
+
client?: FetchClient;
|
|
292
|
+
overrides?: EndpointOverrides;
|
|
293
|
+
}): Promise<RestoreArchiveChainLocalResult>;
|
|
108
294
|
/**
|
|
109
295
|
* Gives back a local path holding this archive's ciphertext, fetching it first
|
|
110
296
|
* if the local copy was offloaded.
|
|
@@ -114,4 +300,5 @@ export type Materialised = {
|
|
|
114
300
|
* one and removed afterwards, which keeps the disk saving intact: the bytes are
|
|
115
301
|
* on this machine only for as long as the restore takes.
|
|
116
302
|
*/
|
|
117
|
-
export declare function materialiseArchive(dataDir: string, record: ArchiveRecord, client?: FetchClient): Promise<Materialised>;
|
|
303
|
+
export declare function materialiseArchive(dataDir: string, record: ArchiveRecord, client?: FetchClient, options?: MaterialiseOptions): Promise<Materialised>;
|
|
304
|
+
export {};
|