@jini-ai/platform 0.7.3-next.2 → 0.7.3-next.3

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 (136) hide show
  1. package/README.md +13 -0
  2. package/dist/download-lock.d.ts +3 -1
  3. package/dist/download-lock.js +4 -4
  4. package/dist/download-maintenance.js +6 -6
  5. package/dist/download-state.js +17 -14
  6. package/dist/download-store.d.ts +34 -10
  7. package/dist/download-store.js +24 -20
  8. package/dist/download-target.d.ts +6 -2
  9. package/dist/download-target.js +7 -7
  10. package/dist/download-transfer.js +18 -12
  11. package/dist/download.js +4 -4
  12. package/dist/fetch-with-timeout.d.ts +0 -53
  13. package/dist/fetch-with-timeout.js +56 -6
  14. package/dist/fs/directory-running-lock.d.ts +4 -0
  15. package/dist/fs/directory-running-lock.js +8 -1
  16. package/dist/fs/directory-workspace.d.ts +2 -1
  17. package/dist/fs/directory-workspace.js +2 -2
  18. package/dist/fs/durable-json.d.ts +3 -16
  19. package/dist/fs/durable-json.js +4 -2
  20. package/dist/fs/guarded-reader.d.ts +10 -0
  21. package/dist/fs/guarded-reader.js +34 -1
  22. package/dist/fs/index.d.ts +4 -0
  23. package/dist/fs/index.js +4 -0
  24. package/dist/fs/leased-directory-move.d.ts +49 -0
  25. package/dist/fs/leased-directory-move.js +31 -0
  26. package/dist/fs/owned-temp-root.d.ts +74 -0
  27. package/dist/fs/owned-temp-root.js +203 -0
  28. package/dist/fs/recent-directories.d.ts +2 -1
  29. package/dist/fs/resolve-directory-target.d.ts +33 -0
  30. package/dist/fs/resolve-directory-target.js +58 -0
  31. package/dist/fs/staged-file.d.ts +40 -0
  32. package/dist/fs/staged-file.js +75 -0
  33. package/dist/fs/strict-containment.d.ts +14 -0
  34. package/dist/fs/strict-containment.js +14 -0
  35. package/dist/image/png-encode.d.ts +41 -0
  36. package/dist/image/png-encode.js +96 -0
  37. package/dist/index.d.ts +3 -1
  38. package/dist/mail/email-template-agent-tools.d.ts +150 -0
  39. package/dist/mail/email-template-agent-tools.js +86 -0
  40. package/dist/mail/email-template-tool-registrations.d.ts +73 -0
  41. package/dist/mail/email-template-tool-registrations.js +66 -0
  42. package/dist/mail/feedback-route.d.ts +50 -0
  43. package/dist/mail/feedback-route.js +46 -0
  44. package/dist/mail/feedback-setup.d.ts +44 -0
  45. package/dist/mail/feedback-setup.js +53 -0
  46. package/dist/mail/feedback-sources.d.ts +67 -0
  47. package/dist/mail/feedback-sources.js +42 -0
  48. package/dist/mail/index.d.ts +10 -1
  49. package/dist/mail/index.js +4 -0
  50. package/dist/mail/mail-status.d.ts +32 -0
  51. package/dist/mail/mail-status.js +2 -0
  52. package/dist/mail/positional-purpose-gate.d.ts +14 -0
  53. package/dist/mail/positional-purpose-gate.js +18 -0
  54. package/dist/mail/purpose-gate-probe.d.ts +18 -0
  55. package/dist/mail/purpose-gate-probe.js +22 -0
  56. package/dist/mail/resolve-mailer.d.ts +13 -1
  57. package/dist/mail/resolve-mailer.js +11 -5
  58. package/dist/mail/sql/activity.repo.d.ts +20 -0
  59. package/dist/mail/sql/activity.repo.js +133 -0
  60. package/dist/mail/sql/attempts.repo.d.ts +17 -0
  61. package/dist/mail/sql/attempts.repo.js +32 -0
  62. package/dist/mail/sql/capture.repo.d.ts +69 -0
  63. package/dist/mail/sql/capture.repo.js +119 -0
  64. package/dist/mail/sql/feedback-inbox.repo.d.ts +12 -0
  65. package/dist/mail/sql/feedback-inbox.repo.js +32 -0
  66. package/dist/mail/sql/index.d.ts +12 -0
  67. package/dist/mail/sql/index.js +12 -0
  68. package/dist/mail/sql/ledger.repo.d.ts +29 -0
  69. package/dist/mail/sql/ledger.repo.js +57 -0
  70. package/dist/mail/sql/retention.d.ts +23 -0
  71. package/dist/mail/sql/retention.js +53 -0
  72. package/dist/mail/sql/site-feedback-route.d.ts +18 -0
  73. package/dist/mail/sql/site-feedback-route.js +22 -0
  74. package/dist/mail/sql/suppression-admin.repo.d.ts +11 -0
  75. package/dist/mail/sql/suppression-admin.repo.js +76 -0
  76. package/dist/mail/sql/suppression.repo.d.ts +10 -0
  77. package/dist/mail/sql/suppression.repo.js +33 -0
  78. package/dist/mail/test-send.d.ts +147 -0
  79. package/dist/mail/test-send.js +201 -0
  80. package/dist/mail/use-readiness.d.ts +104 -0
  81. package/dist/mail/use-readiness.js +140 -0
  82. package/dist/object-store/local-fs.js +34 -1
  83. package/dist/object-store/site/artifact-provider.d.ts +65 -0
  84. package/dist/object-store/site/artifact-provider.js +37 -0
  85. package/dist/object-store/site/registry.d.ts +110 -0
  86. package/dist/object-store/site/registry.js +93 -0
  87. package/dist/object-store/site/setting.d.ts +34 -0
  88. package/dist/object-store/site/setting.js +32 -0
  89. package/dist/process-probes.d.ts +11 -4
  90. package/dist/process-probes.js +3 -3
  91. package/dist/process-top-footprint.d.ts +1 -1
  92. package/dist/process.d.ts +3 -17
  93. package/dist/process.js +3 -2
  94. package/dist/retention/index.d.ts +6 -0
  95. package/dist/retention/index.js +6 -0
  96. package/dist/retention/measure-tree.d.ts +68 -0
  97. package/dist/retention/measure-tree.js +205 -0
  98. package/dist/retention/preview-store.d.ts +10 -0
  99. package/dist/retention/preview-store.js +26 -0
  100. package/dist/retention/routes.d.ts +23 -0
  101. package/dist/retention/routes.js +24 -0
  102. package/dist/retention/runner.d.ts +103 -0
  103. package/dist/retention/runner.js +164 -0
  104. package/dist/secrets/credential-sets/index.d.ts +1 -0
  105. package/dist/secrets/credential-sets/index.js +1 -0
  106. package/dist/secrets/credential-sets/store-vault-guards.d.ts +26 -0
  107. package/dist/secrets/credential-sets/store-vault-guards.js +30 -0
  108. package/dist/secrets/credential-sets/vault.service.d.ts +1 -1
  109. package/dist/secrets/index.d.ts +1 -1
  110. package/dist/secrets/index.js +1 -1
  111. package/dist/secrets/keyring.env.d.ts +1 -1
  112. package/dist/secrets/keyring.env.js +3 -5
  113. package/dist/secrets/keyring.memory.d.ts +4 -1
  114. package/dist/secrets/keyring.memory.js +4 -1
  115. package/dist/secrets/legacy-codecs.d.ts +381 -0
  116. package/dist/secrets/legacy-codecs.js +468 -0
  117. package/dist/secrets/legacy-owner.d.ts +3 -11
  118. package/dist/secrets/root-key/ensure.d.ts +154 -0
  119. package/dist/secrets/root-key/ensure.js +328 -0
  120. package/dist/secrets/root-key/files.d.ts +104 -0
  121. package/dist/secrets/root-key/files.js +166 -0
  122. package/dist/secrets/root-key/material.d.ts +132 -0
  123. package/dist/secrets/root-key/material.js +116 -0
  124. package/dist/secrets/root-key/ordered-keyring.d.ts +157 -0
  125. package/dist/secrets/root-key/ordered-keyring.js +104 -0
  126. package/dist/secrets/root-key/reconcile.d.ts +50 -0
  127. package/dist/secrets/root-key/reconcile.js +147 -0
  128. package/dist/secrets/root-key/site-keyring-errors.d.ts +78 -0
  129. package/dist/secrets/root-key/site-keyring-errors.js +37 -0
  130. package/dist/secrets/root-key/sources.d.ts +79 -0
  131. package/dist/secrets/root-key/sources.js +119 -0
  132. package/dist/secrets/secret-sealer.aesgcm.d.ts +50 -2
  133. package/dist/secrets/secret-sealer.aesgcm.js +107 -19
  134. package/dist/web/tool-registrations.d.ts +67 -0
  135. package/dist/web/tool-registrations.js +44 -0
  136. package/package.json +138 -6
@@ -0,0 +1,381 @@
1
+ import type { UUID } from "@jini-ai/core/primitives";
2
+ import { type VaultRecord, type VaultMeta, type VaultKind, type VaultOptions } from "@jini-ai/core/contracts/vault";
3
+ /** The host vault-policy slice the historical payload normalizer reads. The host keeps its own
4
+ * catalog and token-field rules and passes them in; this module never guesses a vendor. */
5
+ export interface LegacyVaultPolicy {
6
+ /** Workspace registry first, bundled registry second, as in the former publish backfill.
7
+ * Missing plugins leave their legacy records recoverable instead of guessing a vendor. */
8
+ legacyPublishCredential(input: {
9
+ workspaceId: string;
10
+ providerId: string;
11
+ }): {
12
+ vendorId: string;
13
+ tokenField: string;
14
+ } | undefined;
15
+ tokenField(input: {
16
+ kind: VaultKind;
17
+ provider: string | null;
18
+ }): string | undefined;
19
+ }
20
+ /**
21
+ * @file The ONE place `site_assistant_credentials`' AES-GCM additional authenticated data (AAD)
22
+ * string is formatted — same convention as `legacy-codecs.ts` and its siblings:
23
+ * every `seal()`/`open()` call for this table MUST go through this function so sealing and opening
24
+ * can never drift onto two different formats (which would make every row in the table permanently
25
+ * unopenable, since AAD is authenticated but never stored — see
26
+ * `../features/webhooks/secret-sealer.aesgcm.ts`'s file header).
27
+ *
28
+ * Format: `site-assistant-credential:v1:${workspaceId}` — this table is single-row-per-workspace
29
+ * (`workspace_id` is the bare primary key, `db/schema.sqlite.ts`'s `siteAssistantCredentials` doc), so
30
+ * `workspaceId` is the whole row identity there is to bind. That single binding is still
31
+ * load-bearing: without it, an attacker (or a bad migration) with DB write access could copy one
32
+ * workspace's sealed visitor-assistant key onto another workspace's row and have it decrypt
33
+ * cleanly, since the underlying AES key is shared app-wide (`secret-sealer.aesgcm.ts`'s own
34
+ * header).
35
+ *
36
+ * Legacy no-AAD rows remain readable via `site_assistant_credentials.aad_version`; see its schema contract
37
+ * and the owning backfill script. Opening must use the version the row was sealed under.
38
+ */
39
+ /**
40
+ * Builds the AAD string for one `site_assistant_credentials` row. Deterministic — the same
41
+ * `workspaceId` always produces the same string, which is required: opening a sealed value must
42
+ * re-derive the byte-identical value sealing used, with no separate storage of the AAD itself.
43
+ *
44
+ * @complexity O(1) — a fixed-shape string template.
45
+ */
46
+ export declare function buildSiteAssistantCredentialAad(input: {
47
+ workspaceId: UUID;
48
+ }, _options?: VaultOptions): string;
49
+ /**
50
+ * @file The ONE place `admin_execution_credentials`' AES-GCM additional authenticated data (AAD)
51
+ * string is formatted — same convention as `legacy-codecs.ts` and its siblings:
52
+ * every `seal()`/`open()` call for this table MUST go through this function so sealing and opening
53
+ * can never drift onto two different formats (which would make every row in the table permanently
54
+ * unopenable, since AAD is authenticated but never stored — see
55
+ * `../features/webhooks/secret-sealer.aesgcm.ts`'s file header).
56
+ *
57
+ * Format: `admin-execution-credential:v1:${workspaceId}:${principalId}` — this table has no
58
+ * surrogate `id` column (`(workspace_id, principal_id)` IS the row's own primary key, per
59
+ * `db/schema.sqlite.ts`'s `adminExecutionCredentials` doc), so the AAD binds that composite PK directly.
60
+ * Binds both scoping dimensions this table actually has: a ciphertext sealed under one admin's own
61
+ * BYOK key fails auth-tag verification if presented as any other admin's ciphertext, even within
62
+ * the same workspace — which is exactly the property this table's own header requires ("two admins
63
+ * on the same install already carry independent keys").
64
+ *
65
+ * Legacy no-AAD rows remain readable via `admin_execution_credentials.aad_version`; see its schema contract
66
+ * and the owning backfill script. Opening must use the version the row was sealed under.
67
+ */
68
+ /**
69
+ * Builds the AAD string for one `admin_execution_credentials` row. Deterministic — the same
70
+ * `(workspaceId, principalId)` always produces the same string, which is required: opening a
71
+ * sealed value must re-derive the byte-identical value sealing used, with no separate storage of
72
+ * the AAD itself.
73
+ *
74
+ * @complexity O(1) — a fixed-shape string template.
75
+ */
76
+ export declare function buildExecutionCredentialAad(input: {
77
+ workspaceId: UUID;
78
+ principalId: UUID;
79
+ }, _options?: VaultOptions): string;
80
+ /**
81
+ * @file The ONE place `external_mcp_servers`' AES-GCM additional authenticated data (AAD) strings
82
+ * are formatted — same convention as `legacy-codecs.ts` and its siblings: every
83
+ * `seal()`/`open()` call for this table MUST go through these functions so sealing and opening can
84
+ * never drift onto two different formats (which would make every row permanently unopenable, since
85
+ * AAD is authenticated but never stored — see `../features/webhooks/secret-sealer.aesgcm.ts`).
86
+ *
87
+ * ## Why this table needs TWO builders, unlike every sibling
88
+ *
89
+ * `external_mcp_servers` carries **two independent sealed blobs on the same row**:
90
+ *
91
+ * - `sealed_*` — the static env block (`{NAME: value}`) handed to a stdio child process.
92
+ * - `oauth_sealed_*` — `{ clientSecret?, tokens? }` for an OAuth-authorized connection.
93
+ *
94
+ * They are different secret classes with different lifecycles: an env block is operator-entered and
95
+ * changes when the operator edits it, while the OAuth blob is rotated by a refresh flow. Sealing
96
+ * both under one AAD would make them interchangeable *within a row* — an attacker able to move
97
+ * column values could present the env blob in the OAuth slot and vice versa. The distinct
98
+ * `external-mcp-env:` / `external-mcp-oauth:` prefixes are domain separation, and they are why this
99
+ * table also carries two independent version discriminators rather than one.
100
+ *
101
+ * Format: `external-mcp-{env,oauth}:v1:${workspaceId}:${serverId}`. This table has no surrogate
102
+ * `id` column — `(workspace_id, server_id)` IS the primary key (`db/schema.sqlite.ts`'s
103
+ * `externalMcpServers`) — so the AAD binds that composite PK directly. A ciphertext sealed for one
104
+ * server fails auth-tag verification if presented as any other server's, in the same workspace or
105
+ * any other.
106
+ *
107
+ * Legacy no-AAD blobs remain readable through `aad_version`/`oauth_aad_version`; see the schema
108
+ * contract and the external MCP AAD backfill. The discriminators must retain
109
+ * each blob's sealing mode.
110
+ */
111
+ /** The composite primary key an `external_mcp_servers` AAD binds. */
112
+ export interface ExternalMcpAadIdentity {
113
+ readonly workspaceId: string;
114
+ readonly serverId: string;
115
+ }
116
+ /**
117
+ * The current AAD version for newly sealed blobs. Rows still at `0` were sealed before AAD existed
118
+ * and are opened through the legacy no-AAD path — see the store's `open*` helpers.
119
+ */
120
+ export declare const EXTERNAL_MCP_AAD_VERSION = 1;
121
+ /**
122
+ * Builds the AAD for a row's sealed **env block** (`sealed_*`).
123
+ *
124
+ * @complexity O(1) — a fixed-shape string template.
125
+ */
126
+ export declare function buildExternalMcpEnvAad(input: ExternalMcpAadIdentity, _options?: VaultOptions): string;
127
+ /**
128
+ * Builds the AAD for a row's sealed **OAuth blob** (`oauth_sealed_*`, holding `clientSecret` and
129
+ * `tokens`). Deliberately a different string from {@link buildExternalMcpEnvAad} for the same row.
130
+ *
131
+ * @complexity O(1) — a fixed-shape string template.
132
+ */
133
+ export declare function buildExternalMcpOAuthAad(input: ExternalMcpAadIdentity, _options?: VaultOptions): string;
134
+ /**
135
+ * @file The ONE place `media_provider_credentials`' AES-GCM additional authenticated data (AAD)
136
+ * string is formatted — mirrors `legacy-codecs.ts`/`features/custom-credentials/
137
+ * aad.ts`/`legacy-codecs.ts`/`legacy-codecs.ts`
138
+ * exactly, all four of whose file headers this one repeats verbatim: every `seal()`/`open()` call
139
+ * for this table MUST go through this function so sealing and opening can never drift onto two
140
+ * different formats (which would make every row in the table permanently unopenable, since AAD is
141
+ * authenticated but never stored — see `webhooks/secret-sealer.aesgcm.ts`'s file header).
142
+ *
143
+ * Format: `media-provider-credential:v1:${workspaceId}:${providerId}` — this table has no surrogate
144
+ * `id` column (`(workspace_id, provider_id)` IS the row's own primary key, per `db/schema.sqlite.ts`'s
145
+ * `mediaProviderCredentials` doc), so the AAD binds that composite PK directly rather than a third
146
+ * `id` component the row does not have. Binds both scoping dimensions this table actually has: a
147
+ * ciphertext sealed under one provider's AAD fails auth-tag verification if presented as any other
148
+ * provider's ciphertext, even within the same workspace.
149
+ *
150
+ * This table's rows predate AAD entirely (2026-09-02 gap closure) — see `media_provider_
151
+ * credentials.aad_version`'s own doc in `db/schema.sqlite.ts` and the media provider credential AAD
152
+ * backfill for how existing rows are migrated without becoming unreadable.
153
+ */
154
+ /**
155
+ * Builds the AAD string for one `media_provider_credentials` row. Deterministic — the same
156
+ * `(workspaceId, providerId)` always produces the same string, which is required: opening a sealed
157
+ * value must re-derive the byte-identical value sealing used, with no separate storage of the AAD
158
+ * itself.
159
+ *
160
+ * @complexity O(1) — a fixed-shape string template.
161
+ */
162
+ export declare function buildMediaProviderCredentialAad(input: {
163
+ workspaceId: UUID;
164
+ providerId: string;
165
+ }, _options?: VaultOptions): string;
166
+ /**
167
+ * @file The ONE place `custom_credential_sets`' AES-GCM additional authenticated data (AAD) string
168
+ * is formatted — mirrors `legacy-codecs.ts` exactly. Every `seal()`/`open()` call for
169
+ * this table MUST go through this function so sealing and opening can never drift onto two
170
+ * different formats (which would make every row in the table permanently unopenable, since AAD is
171
+ * authenticated but never stored — see `Jini packages/platform/src/secrets/secret-sealer.aesgcm.ts`'s file header).
172
+ *
173
+ * Format: `custom-credential-set:v1:${workspaceId}:${id}` — versioned (`v1`), and bound to both
174
+ * scoping dimensions this table actually has (no `providerId` — see `types.ts`'s own header for
175
+ * why this table has none to bind).
176
+ */
177
+ /**
178
+ * Builds the AAD string for one `custom_credential_sets` row. Deterministic — the same
179
+ * `(workspaceId, id)` always produces the same string, which is required: opening a sealed value
180
+ * must re-derive the byte-identical value sealing used, with no separate storage of the AAD itself.
181
+ *
182
+ * @complexity O(1) — a fixed-shape string template.
183
+ */
184
+ export declare function buildCustomCredentialAad(input: {
185
+ workspaceId: UUID;
186
+ id: UUID;
187
+ }, _options?: VaultOptions): string;
188
+ /**
189
+ * @file The ONE place `source_control_credential_sets`' AES-GCM additional authenticated data
190
+ * (AAD) string is formatted — mirrors `legacy-codecs.ts` exactly.
191
+ * Every `seal()`/`open()` call for this table MUST go through this function so sealing and opening
192
+ * can never drift onto two different formats (which would make every row in the table permanently
193
+ * unopenable, since AAD is authenticated but never stored — see
194
+ * `Jini packages/platform/src/secrets/secret-sealer.aesgcm.ts`'s file header).
195
+ *
196
+ * Format: `source-control-credential-set:v1:${workspaceId}:${providerId}:${id}` — versioned (`v1`)
197
+ * so a future format change is an explicit, reviewed migration path rather than a silent
198
+ * redefinition that breaks every existing row without warning. Binds all three scoping dimensions:
199
+ * a ciphertext sealed under one credential set's AAD fails auth-tag verification if presented as
200
+ * any other credential set's ciphertext, even within the same workspace/provider.
201
+ */
202
+ /**
203
+ * Builds the AAD string for one `source_control_credential_sets` row. Deterministic — the same
204
+ * `(workspaceId, providerId, id)` always produces the same string, which is required: opening a
205
+ * sealed value must re-derive the byte-identical value sealing used, with no separate storage of
206
+ * the AAD itself.
207
+ *
208
+ * @complexity O(1) — a fixed-shape string template.
209
+ */
210
+ export declare function buildSourceControlCredentialAad(input: {
211
+ workspaceId: UUID;
212
+ providerId: string;
213
+ id: UUID;
214
+ }, _options?: VaultOptions): string;
215
+ /**
216
+ * @file The ONE place `vendor_credential_sets`' AES-GCM additional authenticated data (AAD) string
217
+ * is formatted — mirrors `legacy-codecs.ts` and
218
+ * `legacy-codecs.ts` exactly, both of whose file headers this one repeats verbatim:
219
+ * every `seal()`/`open()` call for this table MUST go through this function so sealing and opening
220
+ * can never drift onto two different formats (which would make every row in the table permanently
221
+ * unopenable, since AAD is authenticated but never stored — see
222
+ * `Jini packages/platform/src/secrets/secret-sealer.aesgcm.ts`'s file header).
223
+ *
224
+ * Format: `vendor-credential-set:v1:${workspaceId}:${vendorId}:${id}` — a FRESH `v1`, not a `v2` of
225
+ * either predecessor table's own format. This table is a new table with its own AAD lineage, not a
226
+ * versioned continuation of `publish-credential-set:v1:...`/`source-control-credential-set:v1:...`
227
+ * (those formats stay exactly as they are, still governing whatever rows remain in the two
228
+ * predecessor tables until they are cut over and dropped — see `../../db/schema.sqlite.ts`'s
229
+ * `vendorCredentialSets` doc). Binds all three scoping dimensions the predecessor tables' own AAD
230
+ * already bound, with `vendorId` standing in for `providerId`: a ciphertext sealed under one
231
+ * credential set's AAD fails auth-tag verification if presented as any other credential set's
232
+ * ciphertext, even within the same workspace/vendor.
233
+ */
234
+ /**
235
+ * Builds the AAD string for one `vendor_credential_sets` row. Deterministic — the same
236
+ * `(workspaceId, vendorId, id)` always produces the same string, which is required: opening a
237
+ * sealed value must re-derive the byte-identical value sealing used, with no separate storage of
238
+ * the AAD itself.
239
+ *
240
+ * @complexity O(1) — a fixed-shape string template.
241
+ */
242
+ export declare function buildVendorCredentialAad(input: {
243
+ workspaceId: UUID;
244
+ vendorId: string;
245
+ id: UUID;
246
+ }, _options?: VaultOptions): string;
247
+ /**
248
+ * @file Task 10 of the publish-content (Publish Content) feature —
249
+ * `ADS-memory/reports/2026-09-18-publish-feature-implementation-plan.md` §4 task 10.
250
+ *
251
+ * The ONE place `publish_content_peers`' AES-GCM additional authenticated data (AAD) string is
252
+ * formatted — every `seal()`/`open()` call for this table MUST go through this function, exactly as
253
+ * `legacy-codecs.ts` does for `publish_credential_sets`. AAD is
254
+ * authenticated but never stored, so if sealing and opening ever drift onto two different formats
255
+ * every row in the table becomes permanently unopenable.
256
+ *
257
+ * Format: `publish-content-peer:v1:${workspaceId}:${id}` — binds both scoping dimensions this table
258
+ * has (there is no `providerId` analogue here: a peer is identified by URL + credential, never by a
259
+ * platform identifier, per plan §0b's vendor-neutrality constraint). A ciphertext sealed under one
260
+ * peer's AAD fails auth-tag verification if presented as any other peer's ciphertext, even within
261
+ * the same workspace.
262
+ *
263
+ * Unlike the `publish_credential_sets` precedent, the version is ALSO persisted, in the table's own
264
+ * `aad_version` integer column — {@link PUBLISH_CONTENT_PEER_AAD_VERSION} is what a write stamps
265
+ * there. That makes a future `v2` a readable, row-by-row migration ("re-seal every row whose
266
+ * `aad_version` is 1") rather than a flag day, which is why the column exists.
267
+ */
268
+ /** The AAD format version every row written by this feature is stamped with (`aad_version`). */
269
+ export declare const PUBLISH_CONTENT_PEER_AAD_VERSION = 1;
270
+ /**
271
+ * Builds the AAD string for one `publish_content_peers` row. Deterministic — the same
272
+ * `(workspaceId, id)` always produces the same string, which is required: `open()` must re-derive
273
+ * the byte-identical value `seal()` used, with no separate storage of the AAD itself.
274
+ *
275
+ * @param input.aadVersion - The version stamped on the row being opened; defaults to the current
276
+ * {@link PUBLISH_CONTENT_PEER_AAD_VERSION} for a fresh seal. Passing the row's OWN stored value is
277
+ * what lets a future `v2` writer coexist with `v1` rows that have not been re-sealed yet.
278
+ * @complexity O(1) — a fixed-shape string template.
279
+ */
280
+ export declare function buildPublishContentPeerAad(input: {
281
+ workspaceId: UUID;
282
+ id: UUID;
283
+ aadVersion?: number;
284
+ }, _options?: VaultOptions): string;
285
+ /**
286
+ * @file The ONE place `database_transfer_destinations`' AES-GCM additional authenticated data (AAD) is
287
+ * formatted; sealing and opening both call it, so they can never drift apart (AAD is authenticated
288
+ * but never stored — `features/webhooks/secret-sealer.aesgcm.ts`'s header). It binds the sealed
289
+ * address to its workspace: a row copied onto another workspace does not open.
290
+ */
291
+ /** Every row is sealed under this version (the table was born with AAD). */
292
+ export declare const DATABASE_DESTINATION_AAD_VERSION = 1;
293
+ /** @complexity O(1). */
294
+ export declare function buildDatabaseDestinationAad(input: {
295
+ workspaceId: string;
296
+ }, _options?: VaultOptions): string;
297
+ /**
298
+ * @file The ONE place `publish_credential_sets`' AES-GCM additional authenticated data (AAD) string
299
+ * is formatted — every `seal()`/`open()` call for this table MUST go through this function so sealing
300
+ * and opening can never drift onto two different formats (which would make every row in the table
301
+ * permanently unopenable, since AAD is authenticated but never stored — see
302
+ * `Jini packages/platform/src/secrets/secret-sealer.aesgcm.ts`'s file header).
303
+ *
304
+ * Format: `publish-credential-set:v1:${workspaceId}:${providerId}:${id}` — versioned (`v1`) so a
305
+ * future format change is an explicit, reviewed migration path (bump to `v2`, re-seal every row under
306
+ * the new AAD) rather than a silent redefinition that breaks every existing row without warning.
307
+ * Binds all three scoping dimensions Terra's finding named: workspace, provider, and the specific
308
+ * credential-set row — a ciphertext sealed under one credential set's AAD fails auth-tag verification
309
+ * if presented as any other credential set's ciphertext, even within the same workspace/provider.
310
+ */
311
+ /**
312
+ * Builds the AAD string for one `publish_credential_sets` row. Deterministic — the same
313
+ * `(workspaceId, providerId, id)` always produces the same string, which is required: `open()` must
314
+ * re-derive the byte-identical value `seal()` used, with no separate storage of the AAD itself.
315
+ *
316
+ * @complexity O(1) — a fixed-shape string template.
317
+ */
318
+ export declare function buildPublishCredentialAad(input: {
319
+ workspaceId: UUID;
320
+ providerId: string;
321
+ id: UUID;
322
+ }, _options?: VaultOptions): string;
323
+ /** Migration-pinned original identity; collisions change the vault ID, never this AAD context. */
324
+ export interface VaultLegacyContext {
325
+ table: string;
326
+ workspaceId: string;
327
+ id: string;
328
+ principalId: string | null;
329
+ provider: string | null;
330
+ serverId: string | null;
331
+ aadVersion: number;
332
+ }
333
+ /** Decode only known historical lineages; unknown versions fail closed instead of trying AADs.
334
+ * @complexity O(1); no crypto or I/O.
335
+ */
336
+ export declare function legacyVaultAad({ record, legacy, formerCustomOwnerKey }: {
337
+ record: VaultRecord;
338
+ legacy: VaultLegacyContext;
339
+ /** The host's own vault owner key, under which the former custom vault (`secrets_vault_custom_v1`) sealed. */
340
+ formerCustomOwnerKey: string;
341
+ }, _options?: VaultOptions): string | undefined;
342
+ /** Resolve the target provider and legacy token field from the host catalog without crypto.
343
+ * Callers pass publish_credential_sets rows only.
344
+ * @throws Error("VAULT_CATALOG_UNAVAILABLE") when the legacy publish catalog has no spec.
345
+ * @complexity O(1) time/space plus one injected catalog lookup for publish rows; no I/O.
346
+ * @example const { provider } = legacyTargetProvider({ record, legacy, policy });
347
+ */
348
+ export declare function legacyTargetProvider({ record, legacy, policy }: {
349
+ record: VaultRecord;
350
+ legacy: VaultLegacyContext;
351
+ policy: LegacyVaultPolicy;
352
+ }, _options?: VaultOptions): {
353
+ provider: string | null;
354
+ tokenField?: string;
355
+ };
356
+ /** Host-specific historical payload shapes. Plain tokens become sealed JSON; secrets remain sealed.
357
+ * Custom username is classified plain metadata; source-control's paired username stays sealed.
358
+ * Targets no hosting plugin declares are blocked, as the former backfill did; never guess a vendor.
359
+ * @throws On unsupported payloads or unavailable catalogs; boot flags the original row.
360
+ * @complexity O(payload size); no per-vendor branches, I/O or new crypto.
361
+ */
362
+ export declare function normalizeLegacyVaultPayload({ record, legacy, plaintext, policy }: {
363
+ record: VaultRecord;
364
+ legacy: VaultLegacyContext;
365
+ plaintext: string | null;
366
+ policy: LegacyVaultPolicy;
367
+ }, _options?: VaultOptions): {
368
+ payload: VaultMeta | null;
369
+ meta: VaultMeta;
370
+ provider: string | null;
371
+ hintToken?: string;
372
+ };
373
+ /**
374
+ * Builds the AAD string for one `publish_credential_sets` row. Deterministic — the same
375
+ * `(workspaceId, providerId, id)` always produces the same string, which is required: `open()` must
376
+ * re-derive the byte-identical value `seal()` used, with no separate storage of the AAD itself.
377
+ *
378
+ * @complexity O(1) — a fixed-shape string template.
379
+ * @overallScore 100
380
+ */
381
+ //# sourceMappingURL=legacy-codecs.d.ts.map