@ai-ecoverse/slicc-vault 1.5.0 → 1.7.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/README.md CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  The separate-origin vault at `vault.sliccy.ai`. It holds the sealed secrets, OAuth tokens, and model and MCP credentials of SLICC seven, so that no value ever reaches the model provider. The design is `secrets-tokens-design.md` (revision 4) in slicc-agent-plan. This README is the spec of what is built.
4
4
 
5
- - **Built:** the key store, records, origin namespacing, auto-unlock with an optional passkey or passphrase lock, the embedding API with its `page` and `agent` roles, the page's `put`, `seal`, `remove`, `restore`, `cancel` and `lock`, the scrub state, the lock button and its popup, the attested policy (rules, `[exec]`, `[exits]`, `[limits]`), the injector and `forward` with the response scrub (S1), the agent's `redact`, `redactStream` and `endpoints` (S3), the model and MCP refusal, exec tickets (`materialize` and `materializeConsume`), and the vault side of the `/dev/sealed` ops `seal`, `placeholder`, `list`, `test`, `request`, `status`, `cancel` and `materialize`.
6
- - **Not built yet:** `import` and `export`, and the agent's `model`, `mcp`, `records`, `grant` and `refresh`. They answer as described below.
5
+ - **Built:** the key store, records, origin namespacing, auto-unlock with an optional passkey or passphrase lock, the embedding API with its `page` and `agent` roles, the page's `put`, `seal`, `remove`, `restore`, `cancel` and `lock`, the scrub state, the lock button and its popup, the attested policy (rules, `[exec]`, `[exits]`, `[limits]`), the injector and `forward` with the response scrub (S1), the agent's `redact`, `redactStream` and `endpoints` (S3), the model and MCP refusal, exec tickets (`materialize` and `materializeConsume`), `import` (backups, KeePass, six's `secrets.env`) and `export`, sign-in tokens with their grants and refresh through `egress`, and the vault side of the `/dev/sealed` ops `seal`, `placeholder`, `list`, `test`, `request`, `status`, `cancel` and `materialize`.
6
+ - **Not built yet:** the agent's `model`, `mcp`, `records`, `grant` and `refresh`. They answer as described below.
7
7
  - **The vault has no network stack.** It never fetches anything but its own `config.json` and `embedders.json`: bios sends every request the vault prepares.
8
8
 
9
9
  ## Documents and hosting
@@ -18,7 +18,7 @@ The build (`npm run build`) writes a flat static tree to `dist/site/`:
18
18
  | `vault.css`, `fonts/` | Spectrum 2 from the CSS-only `@spectrum-css` packages, and Adobe Clean |
19
19
  | `config.json` | `{ version, embedders }`. `embedders` is the fallback list, `["https://seven.sliccy.ai"]` |
20
20
 
21
- There is no third-party JavaScript: the bundles hold only this repo's code. The sliccy-ai Worker serves the tree from the network on every load, never from OPFS, with:
21
+ The bundles hold this repo's code and `@ai-ecoverse/slicc-scrub`. The only third-party code is for KeePass imports: `kdbxweb` (with `@xmldom/xmldom` and `fflate`) and `hash-wasm`'s argon2, exact-pinned and bundled into a separate chunk under `chunks/` that the core frame loads only when a KeePass import starts; its wasm is inlined, never fetched. The sliccy-ai Worker serves the tree from the network on every load, never from OPFS, with:
22
22
  - `Content-Security-Policy` with `script-src 'self'`, no inline scripts or styles, and `frame-ancestors` listing the seven origins;
23
23
  - `Cross-Origin-Embedder-Policy: require-corp`, `Cross-Origin-Resource-Policy: same-site`, `Cross-Origin-Opener-Policy: same-origin`;
24
24
  - `Origin-Agent-Cluster: ?1`, `nosniff`, `Referrer-Policy: no-referrer`, `no-cache` with an ETag.
@@ -71,7 +71,7 @@ Everything lives in the vault origin's IndexedDB, database `slicc-vault`, versio
71
71
 
72
72
  ## Backup reminder
73
73
 
74
- `status.exportedAt` is the time of the namespace's last successful `export`, or `null` if it never exported. `status.backupReminder` is `due` once the namespace holds a `secret` record and has never exported, `dismissed` after `dismissBackupReminder`, and `null` otherwise (no secrets yet, or exported). `export` arrives with VAULT-1e; until then `exportedAt` stays `null`.
74
+ `status.exportedAt` is the time of the namespace's last successful `export`, or `null` if it never exported. `status.backupReminder` is `due` once the namespace holds a `secret` record and has never exported, `dismissed` after `dismissBackupReminder`, and `null` otherwise (no secrets yet, or exported).
75
75
 
76
76
  ## Policy
77
77
 
@@ -153,14 +153,14 @@ Every record, request, audit entry and scrub version belongs to the origin that
153
153
  The embedder (bios) loads `https://vault.sliccy.ai/` in an iframe and, after `load`, posts a hello carrying a port:
154
154
 
155
155
  ```js
156
- iframe.contentWindow.postMessage({ type: 'slicc-vault', v: 1, op: 'hello', role: 'page' }, 'https://vault.sliccy.ai', [port2]);
156
+ iframe.contentWindow.postMessage({ type: 'slicc-vault', v: 1, op: 'hello', role: 'page', sudoGid }, 'https://vault.sliccy.ai', [port2]);
157
157
  ```
158
158
 
159
159
  - The frame answers only when the message comes from its own parent window, from an allowed origin, matching `location.ancestorOrigins[0]` when the browser exposes it. Anything else gets no answer at all.
160
160
  - On `port2` it answers `{ v: 1, op: 'welcome', role, status }`, or `{ v: 1, op: 'refused', error }` for another protocol version or an unknown role.
161
161
  - Everything after that goes over the port. The namespace and the role are fixed by the hello. Requests are `{ v: 1, id, op, ...fields }`; replies are `{ v: 1, id, op, ...fields }` or `{ v: 1, id, error: { code, message } }`. Each port is answered in order (FIFO).
162
162
  - **Roles:** `page` (the default) is bios and spectrum. bios may hand spectrum a page port of its own, or relay; the messages are the same. `agent` is the port bios hands the agent worker: it may use only `redact`, `redactStream`, `push`, `idle`, `end`, `drop`, `endpoints`, `model`, `mcp`, `records`, `grant` and `refresh` (the last five `ENOTSUP` in this version), and anything else is `EACCES`. The agent port gets no events. Its ops are below (The agent's ops).
163
- - **Values:** only `forward` (inside the head it returns, where an accepted rule allows it) and `materializeConsume` (for an `[exec]` grant) put a value into the page. No other op, event or reply carries one, and nothing on the agent port ever does.
163
+ - **Values:** only `forward` (inside the head it returns, where an accepted rule allows it), `materializeConsume` (for an `[exec]` grant) and `egress` (a refresh request) put a value into the page. No other op, event or reply carries one, and nothing on the agent port ever does.
164
164
 
165
165
  | op (page role) | fields | reply |
166
166
  |---|---|---|
@@ -170,7 +170,9 @@ iframe.contentWindow.postMessage({ type: 'slicc-vault', v: 1, op: 'hello', role:
170
170
  | `list` | — | `{ list: { secrets, refused, audit, auditMore, exits } }` for Settings › Secrets |
171
171
  | `audit` | `before?` (a `seq`), `limit?` (1–1000, default 100) | `{ audit, more, next? }`, newest first; pass `next` as `before` for the next page |
172
172
  | `put` | `name`, `value`, `request?` | `{ name, placeholder, state }`. A value typed in Settings, with source `settings`; on an existing name it's a rotation that keeps the placeholder. With `request`, it answers that value request, which must still be pending and ask for `name` (else `EINVAL`, and nothing is stored), so its `/dev/sealed` `status` becomes `done` |
173
- | `seal` | `name`, `value`, `source`, `kind?` (default `secret`), `expiresAt?`, `refresh?` | `{ name, placeholder, state }`. bios's, for J1 leases and sign-in tokens |
173
+ | `seal` | `name`, `value`, `source`, `kind?` (default `secret`), `expiresAt?`, `refresh?`, `oauth?`, `request?`, `jerk?` | `{ name, placeholder, state }`. bios's, for J1 leases and sign-in tokens, below (Tokens and refresh) |
174
+ | `answer` | `request`, `state` (`progress` or `done`), `progress?` (≤ 200), `exit?`, `user?`, `scopes?`, `message?` (≤ 500), `rows?`, `placeholder?` | `{ state }`. The answer to a `jerk` or `unseal` request (or a sign-in that failed: for `oauth` and `jerk-seal`, `done` needs a nonzero `exit`, since only `seal` completes them); fields merge into the request, and `status` returns them. `rows` (for `jop: "list"`) are `{ provider, name?, env, device?, signedIn?, user?, scopes? }`, with any other field dropped, so no token can pass. For a `jop: "status"` answered `done` with `exit` 0, the vault adds the placeholder of the provider's own `oauth:<provider>` or `jerk:<provider>@…` record; a `placeholder` given by bios must be one of those records of the provider |
175
+ | `refresh` | `name` | `{ state: 'refreshed', expiresAt? }` or `{ state: 'requested' }`, below |
174
176
  | `remove`, `restore` | `name`, `kind?` (default `secret`) | `{ name, placeholder, state }`. A record removed more than 30 days ago can't be restored (`ENOENT`) |
175
177
  | `cancel` | `request` | `{ state }`; the request's `/dev/sealed` `status` becomes `cancelled` |
176
178
  | `lock` | — | `{}`; drops the key everywhere when the lock is on |
@@ -178,14 +180,18 @@ iframe.contentWindow.postMessage({ type: 'slicc-vault', v: 1, op: 'hello', role:
178
180
  | `policy` | `files` | the attested policy files, below (Policy) |
179
181
  | `forward` | `head`, `body?`, `owner`, `exit`, `rawTraits`, with a `MessagePort` transferred alongside | the injected head, below (Forward) |
180
182
  | `materializeConsume` | `ticket`, `stamp`, `path`, `argv`, `cwd`, `interpreters`, `trusted` | the values for the child's environment, below (Exec) |
181
- | `import`, `export`, anything else | | `ENOTSUP` |
183
+ | `import` | `kind`, `bytes`, `password?`, `pick?` | below (Import and export) |
184
+ | `export` | `passphrase` | `{ bundle, count }`, below |
185
+ | anything else | | `ENOTSUP` |
182
186
 
183
187
  `put` and `seal` need the vault unlocked. They answer `EACCES` with a message starting `vault is locked` otherwise.
184
188
 
185
189
  **Events** on page ports:
186
190
  - `{ v: 1, event: 'status', status }` whenever requests, records, the scrub state or the lock change;
187
191
  - `{ v: 1, event: 'placeholders', placeholders, scrub }` whenever either changes;
188
- - `{ v: 1, event: 'changed', parts }`, with `parts` among `secrets`, `audit` and `exits`, so a view knows what to reload.
192
+ - `{ v: 1, event: 'changed', parts }`, with `parts` among `secrets`, `audit` and `exits`, so a view knows what to reload;
193
+ - `{ v: 1, event: 'refresh', name, source, expiresAt }`, when a J1 lease is due (below);
194
+ - `{ v: 1, event: 'egress', request }`, with a `MessagePort`, when the vault needs bios to send a request it built (below).
189
195
 
190
196
  **Errors** use errno names: `EINVAL`, `ENOENT`, `EACCES`, `EEXIST`, `EAGAIN`, `ETIMEDOUT`, `ENOTCONN`, and `ENOTSUP` for ops this version doesn't have.
191
197
 
@@ -202,12 +208,55 @@ bios relays each kernel request unchanged as the `sealed` op, with the kernel's
202
208
  | `request` | `kind: "value"`, `name`, `prompt?` (≤ 200 characters) | `{ state: "pending", id }` |
203
209
  | `request` | `kind: "oauth"`, `provider`, `oauth` (an object) | the same |
204
210
  | `request` | `kind: "jerk-seal"`, `provider` | the same |
205
- | `status` | `id` | `{ state }`, with `placeholder` and `record` once a value request is `done` |
211
+ | `request` | `kind: "jerk"`, `jop` (`list`, `status`, `create`), `provider?` (needed but for `list`), `scope?`, `params?` (an object) | the same, or `{ state: 'done', id, exit: 2, message }` for a J2 refusal |
212
+ | `request` | `kind: "unseal"`, `provider` | the same, or the J2 refusal |
213
+ | `status` | `id` | `{ state }`, with `placeholder` and `record` once the request is `done`, `jerk` for a sign-in or lease that reported it, and the latest `answer` fields (`progress`, `exit`, `user`, `scopes`, `message`, `rows`, `placeholder`) |
206
214
  | `cancel` | `id` | `{ state }`: `cancelled`, or the state it had already reached |
207
215
  | `materialize` | `names` (or `shellGrants: true`), `path`, `argv`, `cwd`, `interpreter?` | `{ ticket, expiresAt, real: { NAME: true \| false } }`, below (Exec) |
208
216
 
209
- - **Requests** expire 300 s after they're made. Each uid has at most one pending request per namespace; a second one is `EAGAIN`. `status` and `cancel` see only the caller's own requests (uid 0 sees all), and others get `ENOENT`.
210
- - A value request shows up in `status.waiting` and is answered by the page's `put` with its `request` id, or ended by `cancel`. `oauth` and `jerk-seal` requests can only be cancelled in this version.
217
+ - **Requests** expire 300 s after they're made. Each uid has at most one pending request per namespace that waits for a human (`value`, `oauth`, `jerk-seal`, and `jerk` with `jop: "create"`); a second one is `EAGAIN`. `status` and `cancel` see only the caller's own requests (uid 0 sees all), and others get `ENOENT`. Only requests that wait for a human show in `status.waiting`.
218
+ - A value request is answered by the page's `put` with its `request` id. A sign-in or lease (`oauth`, `jerk-seal`) is answered by `seal` with `request` (Tokens and refresh). Every other kind is answered by the page's `answer`. `cancel` ends any of them and pushes `{ v: 1, event: 'cancelled', request, kind }` to the page, which passes it on to J1 where it can.
219
+ - **J-8's jerk requests** (§3.7.1): the vault only keeps their state; bios learns of them from the relay and answers. `jop: "create"` and `unseal` are for root and cones only (J2): the kernel stamp must have `users: 'enforce'`, and either uid 0 or the `sudo` group among its `groups`. bios names that group's gid as `sudoGid` in its hello; a page hello without it clears the namespace's gid. A stamp without `groups`, a vault without `sudoGid`, or any other mode refuses: the request is `done` with `exit: 2` at once, before bios sees anything. The tag is kept for audit and display only.
220
+
221
+ ## Tokens and refresh
222
+
223
+ The vault has no network stack, so sign-ins run in seven's page (route (b), §3.11) and the vault keeps only the results.
224
+ - **A sign-in's tokens:** bios runs the sign-in, does the code exchange, and hands the results to `seal`, keeping no copy:
225
+ - the refresh token as `{ kind: 'grant', name, value, source: 'oauth:<provider>', oauth: { tokenUrl, clientId, scope?, resource? } }`. A grant is never injected and never exported; `tokenUrl` must be `https:`;
226
+ - the access token as `{ name, value, source: 'oauth:<provider>', expiresAt, refresh: '<grant name>' }`. A grant name needs an `oauth:` source and `jerk-seal` a `jerk:` one (`EINVAL`), and a refresh uses the grant only when its source is the token's own (else the grant is missing).
227
+ - With `request` (only for a `secret`; the id of a pending `oauth` request for the same provider as `oauth:<provider>`, or a `jerk-seal` request for the provider of `jerk:<provider>@…`) and `jerk` (`{ exit, user?, scopes?, expires_at? }`), `seal` also answers that request, in the same transaction that stores the record (a request that ended meanwhile refuses with `EINVAL`, and nothing is stored): its `/dev/sealed` `status` becomes `done`, with `jerk`, the record's `placeholder` and `record` state.
228
+ - **A J1 lease:** `{ name, value, source: 'jerk:<provider>@<device>', expiresAt, refresh: 'jerk-seal' }`.
229
+ - **When a token is due** (5 minutes before `expiresAt`): the core frame checks once a minute, for every connected namespace, and `refresh { name }` asks for it at once. Vault frames of the same storage (several tabs) take a Web Lock per refresh source, so one grant is sent to its IdP by one frame at a time; a frame that finds the token changed while it waited (refreshed or sealed again) sends nothing and answers with the stored token's `{ state: 'refreshed', expiresAt? }`.
230
+ - A `jerk-seal` token is announced once per `expiresAt` (kept in IndexedDB, so across frames), and again every 10 minutes while it stays unsealed, in case no live page heard it, with the `refresh` event, and bios runs J1 `seal` again (`{ state: 'requested' }`).
231
+ - An OAuth token is refreshed in the vault: it builds `POST tokenUrl` with `grant_type=refresh_token`, the refresh token, `client_id` and any `scope` and `resource` (form-encoded), and sends it through bios with the `egress` event. bios sends the request through its exits and posts `{ status, headers, body }` (or `{ error }`) on the event's port within 30 s. The event goes to the page port of the namespace that connected last. A port that doesn't answer in time (`ETIMEDOUT`), closed or not, keeps its ops and events but gets no more `egress`, and the next refresh goes to the page port before it. The vault reads `access_token`, `expires_in` and any new `refresh_token`, checks them as values, and rotates the records in one transaction with the `refresh` audit entry (their placeholders stay; if the token or its grant was changed, removed or restored during the round trip, nothing is written and it answers `EAGAIN`). An `expires_in` of 0 makes the token due at once, and one that isn't a non-negative finite number is `EACCES: refresh failed: the IdP returned an invalid expires_in` (likewise a `refresh_token` that is present but not a string, and a `token_type` other than `Bearer`); a response carrying `error` fails even with a token; a response without `expires_in` leaves the new token without an expiry, so it isn't refreshed again until a new one is sealed. It answers `{ state: 'refreshed', expiresAt? }`, without `expiresAt` when the token has none. A failed refresh is `EACCES: refresh failed: <the IdP's error code>`, scrubbed. Without a connected page it's `ENOTCONN`.
232
+ - `egress` carries the refresh token to the page, in transit only; the response goes back to the vault, never to the kernel.
233
+
234
+ ## Import and export
235
+
236
+ Spectrum's Settings › Secrets reads the file and the password, and bios hands them over. Both need the vault unlocked. Like every page op, `export` trusts the page: under rev 4 seven's page is trusted with values in transit (§8), and a compromised seven origin is out of scope.
237
+
238
+ **`export { passphrase }`** returns `{ bundle: Uint8Array, count }`, a backup of the namespace's records of kind `secret`, `model` and `mcp` that aren't removed. Grants aren't included, because they need a fresh sign-in. The passphrase needs at least 12 characters. The bundle is UTF-8 JSON:
239
+
240
+ ```json
241
+ { "format": "slicc-vault-bundle", "v": 1,
242
+ "kdf": { "name": "PBKDF2", "hash": "SHA-256", "iterations": 600000, "salt": "<base64url>" },
243
+ "cipher": { "name": "AES-GCM", "iv": "<base64url>" },
244
+ "data": "<base64url>" }
245
+ ```
246
+
247
+ `data` is AES-GCM 256 (additional data `slicc-vault-bundle`) over `{ "records": [{ name, kind, value, placeholder, source, createdAt, expiresAt? }] }`. A successful export sets `status.exportedAt`.
248
+
249
+ **`import { kind, bytes, password?, pick? }`** runs in two steps:
250
+ - Without `pick` it answers `{ stage: 'pick', candidates: [{ name, kind, exists, suggestedRules?, refused? }] }`, for the human to choose from. `refused` says why a candidate can't be imported.
251
+ - With `pick` it seals the candidates picked, each given as `{ name, kind }` or, for kind `secret`, as just its name, and answers `{ stage: 'done', imported: [{ name, placeholder, state }], skipped }`. `skipped` lists picked names that were refused or not in the file, and `reasons` maps each to a short reason ("not a valid name", "values shorter than 8 bytes can't be protected from the model", "it isn't in the file", …), never a value or part of one. `outcomes` lists every picked candidate as `{ name, kind?, imported, reason? }`, which tells two candidates of the same name and different kinds apart (`kind` is absent only for a picked name that isn't in the file). Each record is stored in its own transaction, which also reserves a bundle's placeholder, so a record either lands whole or not at all; one that can't be stored (its placeholder was taken meanwhile, the vault was re-keyed) is listed in `skipped`, and the rest still import.
252
+
253
+ | `kind` | `password` | what becomes a candidate |
254
+ |---|---|---|
255
+ | `bundle` | the export passphrase | each record, with its kind, source (`import:bundle` when it isn't a valid source), expiry and **placeholder**, so the policy files still match. A placeholder used by another record of the namespace, or by another embedder of this vault, is refused ("this app already has this secret under another name", "another app that uses this vault already has this secret; use it there, or add it here by hand"), as is a name whose record here has another placeholder ("this app already has a different secret with this name") |
256
+ | `keepass` | the master password (KDBX 3 or 4, as kdbxweb reads them; Argon2 through hash-wasm) | each entry with a password, named after its title (upper-cased, other characters as `_`, a leading digit prefixed with `_`; a name already taken by an earlier entry gets `_2`, `_3`, …), source `import:keepass` |
257
+ | `six` | — | each `NAME=value` line of six's `secrets.env` (`export` and quotes allowed), source `import:six`. `NAME_DOMAINS` becomes `suggestedRules`: a `[[proxy.rules]]` stanza per exact domain, for the human to add with `sudo`, and a note for each wildcard, which isn't carried over |
258
+
259
+ Values are checked as at `put` (at least 8 bytes, no CR, LF or NUL, no placeholder). An existing name is rotated, keeping its placeholder. A wrong password or passphrase is `EACCES`.
211
260
 
212
261
  ## Exec
213
262
 
@@ -343,6 +392,7 @@ The npm package `@ai-ecoverse/slicc-vault` holds only TypeScript types, built fr
343
392
  - **`exec`**: `false` means the value is never revealed to a program; `any`, `argv` (with `execArgv`, the allowed argv prefixes) and `shell` are the `[exec]` modes under which `fnox exec` may hand it to a program.
344
393
  - **`exits`** is present only when `/etc/slicc/secrets-policy.toml` restricts that secret; absent means every exit (`page`, `proxy`, `tailscale`, `device:<id>`).
345
394
  - **`kind`**: `secret` (a credential programs use through rules), **`grant`** (a sign-in's refresh token, never injected; show it as "Sign-in"), `model` (a model provider key), `mcp` (an MCP server credential). `provider` and `account` name the service and the signed-in account where one is known.
395
+ - **Who did it:** `uid` and `tag` are the kernel stamp for entries a program or the agent caused (`/dev/sealed` seals, `forward`, `mcp`, `materialize`). Every entry from a page-role op (`put`, `seal`, `remove`, `restore`, `import`, `policy`) and from the vault itself (`refresh`) has `uid: null, tag: null`, older entries included. Spectrum shows page ops as "by you", `refresh` as "automatically", and `policy` entries with no "by …".
346
396
  - **`AuditEntry`**: `forward` is a use of a value in a request, with the exit that carried it; `mcp` a kernel program's call to a registered MCP server; **`materialize` is shown as "Revealed to a program"**; `seal`, `remove`, `restore` and `policy` (with its `changes`) record changes. Every entry has a `seq` for paging.
347
397
  - **`VaultList.refused`** lists rules the vault dropped because they name a model or MCP endpoint.
348
398
  - **`PendingRequest.prompt`** is untrusted, agent-written text of at most 200 characters.
@@ -6,7 +6,7 @@ export type RecordKind = 'secret' | 'grant' | 'model' | 'mcp';
6
6
  export type RecordState = 'active' | 'inert' | 'removed';
7
7
  export type RecordSource = 'settings' | 'process' | `jerk:${string}@${DeviceId}` | `oauth:${string}` | `import:${string}`;
8
8
  export type LockMode = 'auto' | 'passkey' | 'passphrase';
9
- export type RequestKind = 'value' | 'oauth' | 'jerk-seal';
9
+ export type RequestKind = 'value' | 'oauth' | 'jerk-seal' | 'jerk' | 'unseal';
10
10
  export type RequestState = 'pending' | 'done' | 'cancelled' | 'expired';
11
11
  export type ErrorCode = 'EINVAL' | 'ENOENT' | 'EACCES' | 'EEXIST' | 'EAGAIN' | 'ETIMEDOUT' | 'ENOTCONN' | 'ENOTSUP';
12
12
  export type ExitName = 'page' | 'proxy' | 'tailscale' | `device:${DeviceId}`;
@@ -18,6 +18,8 @@ export interface Stamp {
18
18
  uid: number;
19
19
  gid: number;
20
20
  tag: string | null;
21
+ users?: string;
22
+ groups?: number[];
21
23
  }
22
24
  export interface VaultError {
23
25
  code: ErrorCode;
@@ -154,13 +156,19 @@ export interface PolicyEntry {
154
156
  seq: number;
155
157
  id: string;
156
158
  at: EpochMs;
159
+ uid: null;
160
+ tag: null;
157
161
  file: PolicyFile;
158
162
  sha256: string;
159
163
  accepted: boolean;
160
164
  changes: PolicyChange[];
161
165
  warning?: string;
162
166
  }
163
- export type AuditEntry = ForwardEntry | McpEntry | RevealEntry | SealEntry | RemoveEntry | PolicyEntry;
167
+ export type AuditEntry = ForwardEntry | McpEntry | RevealEntry | SealEntry | RemoveEntry | RefreshEntry | PolicyEntry;
168
+ export interface RefreshEntry extends AuditBase {
169
+ type: 'refresh';
170
+ grant: string;
171
+ }
164
172
  export interface RequestHead {
165
173
  method: string;
166
174
  url: string;
@@ -265,8 +273,10 @@ export interface SealResult {
265
273
  export type ImportKind = 'bundle' | 'keepass' | 'six';
266
274
  export interface ImportCandidate {
267
275
  name: string;
276
+ kind: RecordKind;
268
277
  exists: boolean;
269
278
  suggestedRules?: string;
279
+ refused?: string;
270
280
  }
271
281
  export type ImportResult = {
272
282
  stage: 'pick';
@@ -275,7 +285,15 @@ export type ImportResult = {
275
285
  stage: 'done';
276
286
  imported: SealResult[];
277
287
  skipped: string[];
288
+ reasons?: Record<string, string>;
289
+ outcomes?: ImportOutcome[];
278
290
  };
291
+ export interface ImportOutcome {
292
+ name: string;
293
+ kind?: RecordKind;
294
+ imported: boolean;
295
+ reason?: string;
296
+ }
279
297
  export type PopupIntent = {
280
298
  kind: 'unlock';
281
299
  } | {
@@ -340,12 +358,25 @@ export type Op = {
340
358
  kind?: RecordKind;
341
359
  expiresAt?: EpochMs;
342
360
  refresh?: string;
361
+ oauth?: OAuthConfig;
362
+ request?: string;
363
+ jerk?: JerkResult;
343
364
  } | {
365
+ op: 'refresh';
366
+ name: string;
367
+ } | ({
368
+ op: 'answer';
369
+ request: string;
370
+ state: 'progress' | 'done';
371
+ } & RequestAnswer) | {
344
372
  op: 'import';
345
373
  kind: ImportKind;
346
374
  bytes: Uint8Array;
347
375
  password?: string;
348
- pick?: string[];
376
+ pick?: (string | {
377
+ name: string;
378
+ kind: RecordKind;
379
+ })[];
349
380
  } | {
350
381
  op: 'export';
351
382
  passphrase: string;
@@ -445,6 +476,7 @@ export type OpReply = {
445
476
  } & ImportResult) | {
446
477
  op: 'export';
447
478
  bundle: Uint8Array;
479
+ count: number;
448
480
  } | {
449
481
  op: 'lock';
450
482
  } | {
@@ -452,7 +484,14 @@ export type OpReply = {
452
484
  backupReminder: BackupReminder;
453
485
  } | ({
454
486
  op: 'policy';
455
- } & PolicyResult) | ({
487
+ } & PolicyResult) | {
488
+ op: 'refresh';
489
+ state: 'refreshed' | 'requested';
490
+ expiresAt?: EpochMs;
491
+ } | {
492
+ op: 'answer';
493
+ state: RequestState;
494
+ } | ({
456
495
  op: 'forward';
457
496
  } & ForwardResult) | {
458
497
  op: 'materializeConsume';
@@ -485,12 +524,71 @@ export type VaultEvent = {
485
524
  v: Protocol;
486
525
  event: 'changed';
487
526
  parts: ChangedPart[];
527
+ } | {
528
+ v: Protocol;
529
+ event: 'refresh';
530
+ name: string;
531
+ source: RecordSource;
532
+ expiresAt: EpochMs;
533
+ } | {
534
+ v: Protocol;
535
+ event: 'egress';
536
+ request: EgressRequest;
537
+ } | {
538
+ v: Protocol;
539
+ event: 'cancelled';
540
+ request: string;
541
+ kind: RequestKind;
542
+ };
543
+ export interface JerkRow {
544
+ provider: string;
545
+ name?: string;
546
+ env: string[];
547
+ device?: string;
548
+ signedIn?: boolean;
549
+ user?: string;
550
+ scopes?: string[];
551
+ }
552
+ export interface RequestAnswer {
553
+ progress?: string;
554
+ exit?: number;
555
+ user?: string;
556
+ scopes?: string[];
557
+ message?: string;
558
+ rows?: JerkRow[];
559
+ placeholder?: string;
560
+ }
561
+ export interface EgressRequest {
562
+ method: string;
563
+ url: string;
564
+ headers: [string, string][];
565
+ body: string;
566
+ }
567
+ export type EgressAnswer = {
568
+ status: number;
569
+ headers: [string, string][];
570
+ body: Uint8Array | string;
571
+ } | {
572
+ error: string;
488
573
  };
574
+ export interface OAuthConfig {
575
+ tokenUrl: string;
576
+ clientId: string;
577
+ scope?: string;
578
+ resource?: string;
579
+ }
580
+ export interface JerkResult {
581
+ exit: number;
582
+ user?: string;
583
+ scopes?: string[];
584
+ expires_at?: string;
585
+ }
489
586
  export interface Hello {
490
587
  type: MessageType;
491
588
  v: Protocol;
492
589
  op: 'hello';
493
590
  role?: Role;
591
+ sudoGid?: number;
494
592
  }
495
593
  export type Greeting = {
496
594
  v: Protocol;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-vault",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "description": "The separate-origin vault at vault.sliccy.ai: sealed secrets, OAuth tokens, and model and MCP credentials for SLICC seven, used only by its injector",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -57,6 +57,8 @@
57
57
  "esbuild": "0.28.2",
58
58
  "fake-indexeddb": "6.2.5",
59
59
  "happy-dom": "20.14.5",
60
+ "hash-wasm": "4.12.0",
61
+ "kdbxweb": "2.1.1",
60
62
  "lefthook": "2.1.17",
61
63
  "monocart-coverage-reports": "2.13.0",
62
64
  "playwright-core": "1.63.0",