sealkeep 0.8.1 → 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 +244 -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 +1746 -166
- 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.d.ts +1 -0
- package/dist/src/migrate.js +33 -5
- 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 +235 -29
- package/dist/src/vault.js +1783 -190
- 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/branding.d.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* literals where they live:
|
|
13
13
|
* - the npm package name ("vaultline") — republish + deprecate
|
|
14
14
|
* - the data directory (~/.vaultline) and archive/file extensions
|
|
15
|
-
* (.
|
|
15
|
+
* (.skarchive, .skmeta, .vlshare, .skindex)
|
|
16
16
|
* - keystore service ids ("vaultline-cloud", provider credential refs)
|
|
17
17
|
* - managed cloud object paths (vaultline/<account>/…) and the plane URL
|
|
18
18
|
* - wire markers (VLA1 frame magic, AAD strings, HKDF info strings) —
|
|
@@ -29,3 +29,26 @@ export declare const PRODUCT_ORG = "SPALA AI";
|
|
|
29
29
|
export declare const PRODUCT_URL = "https://sealkeep.spala.ai";
|
|
30
30
|
/** The visible folder a personal Drive keeps sealed archives in. */
|
|
31
31
|
export declare const DRIVE_FOLDER_DEFAULT = "Sealkeep";
|
|
32
|
+
/**
|
|
33
|
+
* The folder NEW archives land in inside a bring-your-own bucket.
|
|
34
|
+
*
|
|
35
|
+
* This was written out by hand in nine places, so renaming the product moved
|
|
36
|
+
* some of them and left the rest — the web wizard would write `sealkeep/` while
|
|
37
|
+
* the CLI still wrote `vaultline/` into the same bucket. It is one constant now.
|
|
38
|
+
* The read path in offload.ts deliberately does NOT use it: that one derives the
|
|
39
|
+
* prefix from the object key it is fetching, which is the only correct answer
|
|
40
|
+
* for an archive already written.
|
|
41
|
+
*/
|
|
42
|
+
export declare const STORAGE_PREFIX_DEFAULT = "sealkeep";
|
|
43
|
+
/**
|
|
44
|
+
* What each storage provider is CALLED, as distinct from what it is keyed by.
|
|
45
|
+
*
|
|
46
|
+
* The ids are frozen — they sit inside every archive record and cross the wire
|
|
47
|
+
* to the control plane, so "vaultline" stays "vaultline" for as long as those
|
|
48
|
+
* archives exist. That is a fact about storage, not a thing to show a person.
|
|
49
|
+
* The panel already understood this and rendered a label; the CLI printed the
|
|
50
|
+
* raw id, which is the only place the old brand still surfaced to a reader.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PROVIDER_LABEL: Record<string, string>;
|
|
53
|
+
/** The provider's display name, falling back to its id for anything unlisted. */
|
|
54
|
+
export declare const providerLabel: (id: string) => string;
|
package/dist/src/branding.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* literals where they live:
|
|
13
13
|
* - the npm package name ("vaultline") — republish + deprecate
|
|
14
14
|
* - the data directory (~/.vaultline) and archive/file extensions
|
|
15
|
-
* (.
|
|
15
|
+
* (.skarchive, .skmeta, .vlshare, .skindex)
|
|
16
16
|
* - keystore service ids ("vaultline-cloud", provider credential refs)
|
|
17
17
|
* - managed cloud object paths (vaultline/<account>/…) and the plane URL
|
|
18
18
|
* - wire markers (VLA1 frame magic, AAD strings, HKDF info strings) —
|
|
@@ -29,3 +29,33 @@ export const PRODUCT_ORG = "SPALA AI";
|
|
|
29
29
|
export const PRODUCT_URL = "https://sealkeep.spala.ai";
|
|
30
30
|
/** The visible folder a personal Drive keeps sealed archives in. */
|
|
31
31
|
export const DRIVE_FOLDER_DEFAULT = PRODUCT_NAME;
|
|
32
|
+
/**
|
|
33
|
+
* The folder NEW archives land in inside a bring-your-own bucket.
|
|
34
|
+
*
|
|
35
|
+
* This was written out by hand in nine places, so renaming the product moved
|
|
36
|
+
* some of them and left the rest — the web wizard would write `sealkeep/` while
|
|
37
|
+
* the CLI still wrote `vaultline/` into the same bucket. It is one constant now.
|
|
38
|
+
* The read path in offload.ts deliberately does NOT use it: that one derives the
|
|
39
|
+
* prefix from the object key it is fetching, which is the only correct answer
|
|
40
|
+
* for an archive already written.
|
|
41
|
+
*/
|
|
42
|
+
export const STORAGE_PREFIX_DEFAULT = PRODUCT_SLUG;
|
|
43
|
+
/**
|
|
44
|
+
* What each storage provider is CALLED, as distinct from what it is keyed by.
|
|
45
|
+
*
|
|
46
|
+
* The ids are frozen — they sit inside every archive record and cross the wire
|
|
47
|
+
* to the control plane, so "vaultline" stays "vaultline" for as long as those
|
|
48
|
+
* archives exist. That is a fact about storage, not a thing to show a person.
|
|
49
|
+
* The panel already understood this and rendered a label; the CLI printed the
|
|
50
|
+
* raw id, which is the only place the old brand still surfaced to a reader.
|
|
51
|
+
*/
|
|
52
|
+
export const PROVIDER_LABEL = {
|
|
53
|
+
vaultline: `${PRODUCT_NAME} managed`,
|
|
54
|
+
s3: "Amazon S3",
|
|
55
|
+
r2: "Cloudflare R2",
|
|
56
|
+
b2: "Backblaze B2",
|
|
57
|
+
gcs: "Google Cloud",
|
|
58
|
+
gdrive: "Google Drive"
|
|
59
|
+
};
|
|
60
|
+
/** The provider's display name, falling back to its id for anything unlisted. */
|
|
61
|
+
export const providerLabel = (id) => PROVIDER_LABEL[id] ?? id;
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Realtime Bridge — Watch-P0.
|
|
3
|
+
*
|
|
4
|
+
* Live, read-only sharing of one ongoing agent session, built on the archive
|
|
5
|
+
* pipeline instead of beside it. A driver's machine tails the session file and,
|
|
6
|
+
* every few seconds, seals the bytes that have appeared since the last delta
|
|
7
|
+
* into a tiny object and pushes it to managed storage under a per-channel
|
|
8
|
+
* prefix. Members poll that prefix, pull each delta, unseal it, and append it
|
|
9
|
+
* to a local **mirror** file their own agent can read — so two or three people
|
|
10
|
+
* can follow one session live.
|
|
11
|
+
*
|
|
12
|
+
* What this module deliberately is NOT (documented rungs, not yet built):
|
|
13
|
+
* - no write/inject path — a member cannot drive the agent (see
|
|
14
|
+
* docs/realtime-bridge.md; injection needs a spike and signed identity);
|
|
15
|
+
* - no cross-account key exchange — P0 shares within one account's own
|
|
16
|
+
* devices/members, which reuse the vault phrase to unseal, exactly as the
|
|
17
|
+
* open path already does. Cross-account is rung 4.
|
|
18
|
+
*
|
|
19
|
+
* The one promise the archive pipeline makes is kept here unchanged: every
|
|
20
|
+
* delta is sealed on the driver's machine before a byte leaves it, and the
|
|
21
|
+
* plane relays ciphertext only. A bridge is the seal loop running continuously.
|
|
22
|
+
*
|
|
23
|
+
* Integrity: each delta carries the sha256 of the whole session prefix up to
|
|
24
|
+
* its start. A member applies a delta only if that hash matches the mirror it
|
|
25
|
+
* has so far — so a missed, duplicated, or out-of-order delta is caught, and a
|
|
26
|
+
* transcript that was rewritten (compaction, resume) trips the check and asks
|
|
27
|
+
* for a fresh full snapshot rather than silently corrupting the mirror.
|
|
28
|
+
*/
|
|
29
|
+
import type { BackendName } from "./secrets.js";
|
|
30
|
+
/** The vault_ref a delta is stored under. Ordered by zero-padded seq so a plain string sort is a seq sort. */
|
|
31
|
+
export declare function deltaRef(channel: string, seq: number): string;
|
|
32
|
+
/** Pull the seq back out of a delta ref, or null if it is not one of this channel's. */
|
|
33
|
+
export declare function seqOf(channel: string, vaultRef: string): number | null;
|
|
34
|
+
/**
|
|
35
|
+
* The metadata a delta announces about itself, sealed inside the object next to
|
|
36
|
+
* the ciphertext so the plane never sees it. `prefixSha` is the hash of the
|
|
37
|
+
* session up to `start`; `prefixBytes` is `start`. A member checks both before
|
|
38
|
+
* appending.
|
|
39
|
+
*/
|
|
40
|
+
export type DeltaMeta = {
|
|
41
|
+
channel: string;
|
|
42
|
+
seq: number;
|
|
43
|
+
start: number;
|
|
44
|
+
end: number;
|
|
45
|
+
prefixSha: string;
|
|
46
|
+
prefixBytes: number;
|
|
47
|
+
at: string;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Seal one byte-range as a bridge delta and push it. The range's bytes are the
|
|
51
|
+
* plaintext; the DeltaMeta rides in the envelope's adapter slot so it is sealed
|
|
52
|
+
* too. Returns the ref it was stored under.
|
|
53
|
+
*/
|
|
54
|
+
export declare function publishDelta(dataDir: string, input: {
|
|
55
|
+
channel: string;
|
|
56
|
+
seq: number;
|
|
57
|
+
bytes: Buffer;
|
|
58
|
+
start: number;
|
|
59
|
+
prefixSha: string;
|
|
60
|
+
}, phrase: string, preferred?: BackendName): Promise<{
|
|
61
|
+
ref: string;
|
|
62
|
+
storedBytes: number;
|
|
63
|
+
}>;
|
|
64
|
+
/** A delta as a member sees it after pulling and unsealing: its meta and its plaintext bytes. */
|
|
65
|
+
export type OpenedDelta = {
|
|
66
|
+
meta: DeltaMeta;
|
|
67
|
+
bytes: Buffer;
|
|
68
|
+
};
|
|
69
|
+
/** Pull one delta by ref, unseal it, and recover its meta. */
|
|
70
|
+
export declare function openDelta(dataDir: string, ref: string, phrase: string, preferred?: BackendName): Promise<OpenedDelta>;
|
|
71
|
+
/**
|
|
72
|
+
* Advance a member's mirror file by applying a delta, refusing anything the
|
|
73
|
+
* hash chain does not vouch for. Returns what happened so a caller (CLI, MCP,
|
|
74
|
+
* dashboard) can react: `applied` grew the mirror; `stale` is an already-seen
|
|
75
|
+
* delta (idempotent, safe to skip); `gap` means an earlier delta is missing;
|
|
76
|
+
* `reset` means the session was rewritten upstream and the mirror must be
|
|
77
|
+
* rebuilt from a fresh snapshot.
|
|
78
|
+
*/
|
|
79
|
+
export declare function applyDeltaToMirror(mirrorPath: string, delta: OpenedDelta): Promise<"applied" | "stale" | "gap" | "reset">;
|
|
80
|
+
/**
|
|
81
|
+
* One publisher pass: read the session file, and if it has grown since `fromByte`,
|
|
82
|
+
* seal the new bytes as the next delta. Returns the new high-water mark and the
|
|
83
|
+
* ref, or null when nothing changed. Caller owns the loop and the seq counter.
|
|
84
|
+
*/
|
|
85
|
+
export declare function publishOnce(dataDir: string, input: {
|
|
86
|
+
channel: string;
|
|
87
|
+
seq: number;
|
|
88
|
+
sessionPath: string;
|
|
89
|
+
fromByte: number;
|
|
90
|
+
}, phrase: string, preferred?: BackendName): Promise<{
|
|
91
|
+
ref: string;
|
|
92
|
+
seq: number;
|
|
93
|
+
newHighWater: number;
|
|
94
|
+
prefixSha: string;
|
|
95
|
+
} | null>;
|
|
96
|
+
/**
|
|
97
|
+
* One member pass: list the channel's delta refs the account holds, and apply
|
|
98
|
+
* every one at or after `fromSeq` in order. Returns the seqs applied and the
|
|
99
|
+
* next seq to ask for. Missing/rewritten deltas surface as `gaps`/`needsReset`
|
|
100
|
+
* rather than a corrupted mirror.
|
|
101
|
+
*/
|
|
102
|
+
export declare function watchOnce(dataDir: string, input: {
|
|
103
|
+
channel: string;
|
|
104
|
+
fromSeq: number;
|
|
105
|
+
mirrorPath: string;
|
|
106
|
+
}, phrase: string, preferred?: BackendName): Promise<{
|
|
107
|
+
applied: number[];
|
|
108
|
+
nextSeq: number;
|
|
109
|
+
gaps: boolean;
|
|
110
|
+
needsReset: boolean;
|
|
111
|
+
}>;
|
|
112
|
+
export type BridgeMessageKind = "suggest" | "note" | "handoff";
|
|
113
|
+
export type BridgeMessage = {
|
|
114
|
+
channel: string;
|
|
115
|
+
/** Stable per-vault-per-machine sender id (8 hex chars), never reused across senders. */
|
|
116
|
+
sender: string;
|
|
117
|
+
/** Human label for the sender, e.g. a hostname or a name the sender chose. */
|
|
118
|
+
from: string;
|
|
119
|
+
seq: number;
|
|
120
|
+
kind: BridgeMessageKind;
|
|
121
|
+
text: string;
|
|
122
|
+
at: string;
|
|
123
|
+
/** Set when the driver approved this with edited text — the injection says so. */
|
|
124
|
+
reworded?: boolean;
|
|
125
|
+
};
|
|
126
|
+
export declare function messageRef(channel: string, sender: string, seq: number): string;
|
|
127
|
+
/** Parse a message ref back into its sender and seq, or null if it is not this channel's. */
|
|
128
|
+
export declare function messageRefOf(channel: string, vaultRef: string): {
|
|
129
|
+
sender: string;
|
|
130
|
+
seq: number;
|
|
131
|
+
} | null;
|
|
132
|
+
type SenderState = {
|
|
133
|
+
id: string;
|
|
134
|
+
label: string;
|
|
135
|
+
outSeq: Record<string, number>;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* This machine's bridge identity: minted once, kept next to the mirrors. The
|
|
139
|
+
* label defaults to the hostname and is what teammates see; the id is what
|
|
140
|
+
* keeps two machines' refs from colliding.
|
|
141
|
+
*/
|
|
142
|
+
export declare function bridgeSender(dataDir: string): Promise<SenderState>;
|
|
143
|
+
/** Seal one message for a channel. Pure of transport, so tests need no cloud. */
|
|
144
|
+
export declare function sealBridgeMessage(message: BridgeMessage, phrase: string): {
|
|
145
|
+
ref: string;
|
|
146
|
+
blob: Buffer;
|
|
147
|
+
};
|
|
148
|
+
/** Open a pulled message blob back into the message, meta and text both verified by the seal. */
|
|
149
|
+
export declare function openBridgeMessageBlob(blob: Buffer, phrase: string): BridgeMessage;
|
|
150
|
+
/** A tiny mutex around sender.json, so two pushes in two terminals cannot mint one seq. */
|
|
151
|
+
export declare function withSenderLock<T>(dataDir: string, work: () => Promise<T>): Promise<T>;
|
|
152
|
+
/** The hard ceiling a single message may carry into a prompt. Enforced at push, re-enforced at injection. */
|
|
153
|
+
export declare const MESSAGE_TEXT_MAX = 4000;
|
|
154
|
+
/**
|
|
155
|
+
* Push one message into a channel. The seq is RESERVED under a lock before the
|
|
156
|
+
* upload starts, so concurrent pushes from one machine mint distinct refs; a
|
|
157
|
+
* failed upload rolls the reservation back when nothing newer claimed it.
|
|
158
|
+
*/
|
|
159
|
+
export declare function publishBridgeMessage(dataDir: string, input: {
|
|
160
|
+
channel: string;
|
|
161
|
+
kind: BridgeMessageKind;
|
|
162
|
+
text: string;
|
|
163
|
+
from?: string;
|
|
164
|
+
}, phrase: string, preferred?: BackendName): Promise<{
|
|
165
|
+
ref: string;
|
|
166
|
+
message: BridgeMessage;
|
|
167
|
+
}>;
|
|
168
|
+
/** Where a channel's inbox (every teammate message, decrypted, as JSONL) lives. */
|
|
169
|
+
export declare function defaultInboxPath(dataDir: string, channel: string): string;
|
|
170
|
+
/** Where the not-yet-delivered queue lives — what the prompt hook drains. */
|
|
171
|
+
export declare function pendingPath(dataDir: string, channel: string): string;
|
|
172
|
+
/**
|
|
173
|
+
* One pull pass: list the channel's message refs, open the unseen ones, append
|
|
174
|
+
* them to the inbox log AND the pending queue, and remember what was seen — so
|
|
175
|
+
* a message is delivered exactly once no matter how many loops poll.
|
|
176
|
+
*/
|
|
177
|
+
export declare function pullBridgeMessages(dataDir: string, channel: string, phrase: string, preferred?: BackendName): Promise<{
|
|
178
|
+
fresh: BridgeMessage[];
|
|
179
|
+
mode: CooperationMode;
|
|
180
|
+
}>;
|
|
181
|
+
export declare function heldPath(dataDir: string, channel: string): string;
|
|
182
|
+
/**
|
|
183
|
+
* Cooperation mode — the channel owner's choice of how far teammates' words
|
|
184
|
+
* spread: `observe` = humans see them in the loop, the agent never does;
|
|
185
|
+
* `suggest` = held for the driver's yes/no/reword; `open` = delivered straight
|
|
186
|
+
* into the agent's next turn. `approval: true` is the older spelling of
|
|
187
|
+
* `suggest` and still honoured.
|
|
188
|
+
*/
|
|
189
|
+
export type CooperationMode = "observe" | "suggest" | "open";
|
|
190
|
+
type ChannelSettings = {
|
|
191
|
+
approval?: boolean;
|
|
192
|
+
mode?: CooperationMode;
|
|
193
|
+
};
|
|
194
|
+
export declare function cooperationModeOf(settings: ChannelSettings): CooperationMode;
|
|
195
|
+
export declare function channelSettings(dataDir: string, channel: string): Promise<ChannelSettings>;
|
|
196
|
+
export declare function setChannelMode(dataDir: string, channel: string, mode: CooperationMode): Promise<void>;
|
|
197
|
+
export declare function listHeld(dataDir: string, channel: string): Promise<BridgeMessage[]>;
|
|
198
|
+
/**
|
|
199
|
+
* The driver's verdict on held messages. `index` is 1-based into the held list
|
|
200
|
+
* (or "all"); approving moves messages to pending — with `reword`, the text is
|
|
201
|
+
* replaced and the message is marked reworded, so the injection says so and a
|
|
202
|
+
* teammate is never quoted on words the driver wrote. Rejecting drops from the
|
|
203
|
+
* queue; the inbox log keeps what was actually said either way.
|
|
204
|
+
*/
|
|
205
|
+
export declare function resolveHeld(dataDir: string, channel: string, verdict: {
|
|
206
|
+
approve: boolean;
|
|
207
|
+
index: number | "all";
|
|
208
|
+
reword?: string;
|
|
209
|
+
}): Promise<{
|
|
210
|
+
resolved: BridgeMessage[];
|
|
211
|
+
remaining: number;
|
|
212
|
+
}>;
|
|
213
|
+
/**
|
|
214
|
+
* Drain the pending queue: return its messages and truncate it. The caller is
|
|
215
|
+
* whatever hands teammates' words to the agent — the UserPromptSubmit hook on
|
|
216
|
+
* the driver's machine, or the `sealkeep_bridge_inbox` MCP tool when the agent
|
|
217
|
+
* pulls for itself (Codex has no prompt hook; polling a tool is its pull).
|
|
218
|
+
*/
|
|
219
|
+
export declare function drainPending(dataDir: string, channel: string, limit?: number): Promise<BridgeMessage[]>;
|
|
220
|
+
/** How many messages still wait in pending — the overflow note the hook appends. */
|
|
221
|
+
export declare function pendingCount(dataDir: string, channel: string): Promise<number>;
|
|
222
|
+
export declare function promptInjection(messages: BridgeMessage[], stillWaiting?: number): string;
|
|
223
|
+
/** Everything this machine knows about its channels — the bare `sealkeep bridge` status view. */
|
|
224
|
+
export declare function listChannelStatus(dataDir: string): Promise<Array<{
|
|
225
|
+
channel: string;
|
|
226
|
+
mode: CooperationMode;
|
|
227
|
+
mirrorBytes: number;
|
|
228
|
+
pending: number;
|
|
229
|
+
held: number;
|
|
230
|
+
}>>;
|
|
231
|
+
/** Where a member's mirror of a channel lives by default. */
|
|
232
|
+
export declare function defaultMirrorPath(dataDir: string, channel: string): string;
|
|
233
|
+
export {};
|