@xiaolikt/ai-vault 0.9.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/Cargo.lock +1 -1
- package/README.md +395 -243
- package/README.zh.md +417 -0
- package/crates/ai-vault/Cargo.toml +1 -1
- package/crates/ai-vault/src/cli.rs +300 -88
- package/crates/ai-vault/src/dialog.rs +14 -7
- package/crates/ai-vault/src/i18n.rs +56 -0
- package/crates/ai-vault/src/import.rs +85 -48
- package/crates/ai-vault/src/main.rs +1 -0
- package/crates/ai-vault/src/store.rs +237 -5
- package/package.json +5 -5
- package/packages/pi-ai-vault/README.md +40 -45
- package/packages/pi-ai-vault/README.zh.md +84 -0
- package/packages/pi-ai-vault/package.json +5 -4
- package/packages/pi-ai-vault/src/bitwarden.ts +41 -25
- package/packages/pi-ai-vault/src/cli.ts +11 -4
- package/packages/pi-ai-vault/src/ente.ts +4 -3
- package/packages/pi-ai-vault/src/i18n.ts +31 -0
- package/packages/pi-ai-vault/src/import-map.ts +166 -58
- package/packages/pi-ai-vault/src/index.ts +194 -114
- package/packages/pi-ai-vault/src/prompt.ts +3 -2
- package/packages/pi-ai-vault/src/types.ts +52 -0
- package/test/cli.sh +44 -0
- package/tests/bitwarden-tools.test.mjs +2 -2
- package/tests/import-map.test.mjs +75 -38
- package/tests/mocks/bin/bw +5 -1
- package/tests/mocks/bin/zenity +7 -2
- package/tests/vault-cli.test.mjs +56 -0
package/README.md
CHANGED
|
@@ -1,79 +1,89 @@
|
|
|
1
1
|
# ai-vault
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[中文版](README.zh.md)
|
|
4
|
+
|
|
5
|
+
One encrypted secret store per machine. `ai-vault` is a Rust CLI that owns the
|
|
6
|
+
store, the cryptography and the desktop dialogs; the pi/omp extension is only a
|
|
7
|
+
client of it, so agents no longer keep a copy each.
|
|
4
8
|
|
|
5
9
|
```
|
|
6
|
-
~/.ai-vault/store.json ChaCha20-Poly1305 + scrypt
|
|
7
|
-
~/.ai-vault/audit.log
|
|
8
|
-
~/.ai-vault/store.lock
|
|
9
|
-
$XDG_RUNTIME_DIR/ai-vault/sessions/<token>.json
|
|
10
|
+
~/.ai-vault/store.json ChaCha20-Poly1305 + scrypt, 0600
|
|
11
|
+
~/.ai-vault/audit.log who read what and when; never a value
|
|
12
|
+
~/.ai-vault/store.lock file lock for read-modify-write across processes
|
|
13
|
+
$XDG_RUNTIME_DIR/ai-vault/sessions/<token>.json unlock tokens (0600, tmpfs)
|
|
10
14
|
```
|
|
11
15
|
|
|
12
|
-
|
|
16
|
+
Because the location is fixed and owned by the CLI, pi, omp, scripts and any
|
|
17
|
+
other agent on the machine see the same imported passwords. No more "this agent
|
|
18
|
+
imported it, that one didn't".
|
|
19
|
+
|
|
20
|
+
## Why a CLI plus an extension
|
|
13
21
|
|
|
14
|
-
|
|
22
|
+
- **One implementation of the cryptography** (Rust). The extension holds no key,
|
|
23
|
+
no crypto code and no second store.
|
|
24
|
+
- **Sessions do not live in the agent process.** `ai-vault unlock` derives the
|
|
25
|
+
key and writes a short token file; the extension only holds the token id. If
|
|
26
|
+
the agent crashes, reloads or switches session, the key expires with the token.
|
|
27
|
+
- **One dialog implementation.** With a desktop the CLI opens its own window;
|
|
28
|
+
without one it exits with code `3` and only then does the extension use its
|
|
29
|
+
host's prompt. Two windows never compete for input.
|
|
30
|
+
- **Easy to add a host.** Any new agent, in any language, uses the same store if
|
|
31
|
+
it can run `ai-vault get <name> --json`.
|
|
15
32
|
|
|
16
|
-
|
|
17
|
-
- **会话不在 agent 进程里**:`ai-vault unlock` 派生 key 后写一个短命令牌文件,插件只持有令牌 id。agent 崩了、被 reload、换会话,key 都跟着令牌一起过期。
|
|
18
|
-
- **弹窗只有一份逻辑**:有桌面时 CLI 自己开 zenity;没有桌面时返回退出码 `3`,插件才用自己的输入框,绝不出现两个窗口抢输入。
|
|
19
|
-
- **换宿主很容易**:任何语言写的新 agent 只要会跑 `ai-vault get <名字> --json` 就能用同一个库。
|
|
33
|
+
## Language
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
Documentation is English by default; [README.zh.md](README.zh.md) is the Chinese
|
|
36
|
+
edition. The CLI and the extension show English in dialogs, prompts and
|
|
37
|
+
messages unless `AI_VAULT_LANG=zh` is set (or the locale is `zh_*`); the
|
|
38
|
+
extension passes the language down to the CLI so both halves agree. Texts a
|
|
39
|
+
host parses — exit codes, `needs-ui:`, error patterns — never change.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
22
42
|
|
|
23
43
|
### npm
|
|
24
44
|
|
|
25
|
-
|
|
45
|
+
Three packages:
|
|
26
46
|
|
|
27
|
-
|
|
|
47
|
+
| Package | Contents | Who installs it |
|
|
28
48
|
|---|---|---|
|
|
29
|
-
| `@xiaolikt/ai-vault` | `bin/ai-vault.cjs`
|
|
30
|
-
| `@xiaolikt/ai-vault
|
|
31
|
-
| **`pi-ai-vault`** | pi/omp
|
|
49
|
+
| `@xiaolikt/ai-vault` | the `bin/ai-vault.cjs` dispatcher + Rust sources | anyone who wants just the CLI |
|
|
50
|
+
| `@xiaolikt/ai-vault-<os>-<arch>` | the prebuilt binary, `os`/`cpu` gated | pulled in by the above |
|
|
51
|
+
| **`pi-ai-vault`** | the pi/omp extension (`vault_*` + `bw_*` + `ente_*` tools) | pi or omp; depends on the above |
|
|
32
52
|
|
|
33
53
|
```bash
|
|
34
|
-
npm i -g @xiaolikt/ai-vault #
|
|
35
|
-
pi install npm:pi-ai-vault #
|
|
54
|
+
npm i -g @xiaolikt/ai-vault # just the CLI
|
|
55
|
+
pi install npm:pi-ai-vault # the extension (brings the CLI along)
|
|
36
56
|
omp plugin install npm:pi-ai-vault
|
|
37
57
|
```
|
|
38
58
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
发布(需要 `npm login`):
|
|
44
|
-
|
|
45
|
-
```bash
|
|
46
|
-
./scripts/stage-npm.sh # 编译并staging到 npm/linux-x64
|
|
47
|
-
npm publish npm/linux-x64 --access public
|
|
48
|
-
npm publish --access public
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
邮箱 OTP 2FA 的账号不能直接用 `--otp` 发布(npm 会回 `E403 ... granular access token with bypass 2fa enabled is required`)。做法:网页 Settings → Access Tokens → **Granular Access Token**,勾上 *Bypass 2FA*、权限 *Read and write (publish and stage)*,把令牌写进 `~/.npmrc`:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
printf '//registry.npmjs.org/:_authToken=%s\n' "<token>" > ~/.npmrc && chmod 600 ~/.npmrc
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
这类令牌 npm 会在 2027 年 1 月起逐步作废,届时改用 trusted publishing 或 TOTP 2FA。
|
|
59
|
+
The extension is a pi extension manifest; omp is a pi-compatible fork, so
|
|
60
|
+
**one package serves both hosts**: omp gets `bw_run`, pi additionally gets
|
|
61
|
+
`bw_inject`. The only differences are feature-detected at runtime in `src/host.ts`.
|
|
58
62
|
|
|
59
|
-
|
|
63
|
+
The bare name `ai-vault` is taken on npm (3.5.1), hence the scope. `bin/ai-vault.cjs`
|
|
64
|
+
is only a forwarder: it finds the real binary in `@xiaolikt/ai-vault-<os>-<arch>`
|
|
65
|
+
and hands over argv, stdio and **the exit code** (3/4/5 are the host contract and
|
|
66
|
+
must not be rewritten).
|
|
60
67
|
|
|
61
|
-
###
|
|
68
|
+
### Platforms
|
|
62
69
|
|
|
63
|
-
|
|
|
70
|
+
| Platform | Status |
|
|
64
71
|
|---|---|
|
|
65
|
-
| Linux x64 / arm64 | ✅
|
|
66
|
-
| Windows x64 | ✅
|
|
67
|
-
| macOS arm64 / x64 | 🔧
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
| Linux x64 / arm64 | ✅ published (`@xiaolikt/ai-vault-linux-x64` / `-linux-arm64`) |
|
|
73
|
+
| Windows x64 | ✅ published (`@xiaolikt/ai-vault-win32-x64`); dialogs via PowerShell/WinForms |
|
|
74
|
+
| macOS arm64 / x64 | 🔧 compiles (`cargo check --target aarch64-apple-darwin` passes); the binary needs the Apple SDK, so `.github/workflows/build.yml` builds it on a macOS runner |
|
|
75
|
+
|
|
76
|
+
What is portable:
|
|
77
|
+
- **Crypto/storage**: pure Rust (chacha20poly1305, scrypt, hmac, sha2, base64, zeroize)
|
|
78
|
+
- **File locks**: `fs4` (flock on Linux/macOS, LockFileEx on Windows)
|
|
79
|
+
- **Permissions**: 0600/0700 on Unix; Windows has no mode bits and relies on the
|
|
80
|
+
`%USERPROFILE%\.ai-vault` ACL
|
|
81
|
+
- **Session directory**: `$XDG_RUNTIME_DIR` (Linux), `$TMPDIR` (macOS), `%TEMP%`
|
|
82
|
+
(Windows) — per-user, OS-cleaned
|
|
83
|
+
- **Dialogs**: zenity / osascript / PowerShell+WinForms behind one `Answer`
|
|
84
|
+
contract (`NoUi` is what falls back to the host prompt)
|
|
85
|
+
|
|
86
|
+
Cross-compile yourself (no Mac or Windows machine needed):
|
|
77
87
|
|
|
78
88
|
```bash
|
|
79
89
|
cargo install cargo-zigbuild
|
|
@@ -84,293 +94,435 @@ cargo zigbuild --release --target x86_64-pc-windows-gnu
|
|
|
84
94
|
./scripts/stage-npm.sh win32-x64 --from target/x86_64-pc-windows-gnu/release/ai-vault.exe
|
|
85
95
|
```
|
|
86
96
|
|
|
87
|
-
`stage-npm.sh`
|
|
97
|
+
`stage-npm.sh` accepts either an npm platform name (`darwin-arm64`) or a Rust
|
|
98
|
+
triple (`aarch64-apple-darwin`). macOS binaries can only be linked with the
|
|
99
|
+
Apple SDK, so CI does that (build + publish on a `v*` tag).
|
|
88
100
|
|
|
89
|
-
###
|
|
101
|
+
### From source / git
|
|
90
102
|
|
|
91
103
|
```bash
|
|
92
|
-
# 1.
|
|
104
|
+
# 1. Build the CLI and put it on PATH (~/.local/bin/ai-vault)
|
|
93
105
|
./install.sh
|
|
94
106
|
|
|
95
|
-
# 2.
|
|
107
|
+
# 2. The extension (the repo root has a pi manifest pointing at
|
|
108
|
+
# packages/pi-ai-vault, so git installs keep working)
|
|
96
109
|
pi install git:github.com/xiaolikt/ai-vault
|
|
97
110
|
omp plugin install git+ssh://git@github.com/xiaolikt/ai-vault.git
|
|
98
111
|
|
|
99
|
-
# 3.
|
|
112
|
+
# 3. Create the store (a dialog asks for the master password, twice)
|
|
100
113
|
/vault init
|
|
101
114
|
```
|
|
102
115
|
|
|
103
|
-
|
|
116
|
+
Requires Rust (`cargo`) to build; at runtime `zenity` for dialogs (the host
|
|
117
|
+
prompt is the fallback).
|
|
104
118
|
|
|
105
|
-
|
|
119
|
+
**Do not install `omp-vault` or `pi-bitwarden` alongside ai-vault**: they
|
|
120
|
+
register the same `vault_*` / `bw_*` tools and you get duplicates. Both are
|
|
121
|
+
archived; see *Migrating*.
|
|
106
122
|
|
|
107
|
-
###
|
|
123
|
+
### Migrating
|
|
108
124
|
|
|
109
|
-
|
|
125
|
+
- **From `omp-vault`** (the TypeScript predecessor): the first time `ai-vault`
|
|
126
|
+
runs and `~/.ai-vault/store.json` is absent while `~/.omp/vault/store.json`
|
|
127
|
+
exists, the CLI **copies** (never deletes) the store and audit log across.
|
|
128
|
+
The master password is unchanged — the file format is the same, only the
|
|
129
|
+
location moved. The old files stay for as long as you want a way back.
|
|
130
|
+
- **From `pi-bitwarden`** (archived): every tool it had is here under the same
|
|
131
|
+
name. `pi remove git:github.com/xiaolikt/pi-bitwarden` first, then install
|
|
132
|
+
`pi-ai-vault`.
|
|
110
133
|
|
|
111
134
|
## CLI
|
|
112
135
|
|
|
113
136
|
```text
|
|
114
|
-
ai-vault [--dir DIR] [--json]
|
|
137
|
+
ai-vault [--dir DIR] [--json] <command>
|
|
115
138
|
```
|
|
116
139
|
|
|
117
|
-
|
|
|
140
|
+
| Command | What it does |
|
|
118
141
|
|---|---|
|
|
119
|
-
| `path` |
|
|
120
|
-
| `doctor` |
|
|
121
|
-
| `init [--password-stdin]` |
|
|
122
|
-
| `unlock [--password-stdin] [--requester ID]` |
|
|
123
|
-
| `mode [get]` / `mode set never\|time\|session [--hours N]` |
|
|
124
|
-
| `settings [
|
|
125
|
-
| `bw-session get\|put\|clear` |
|
|
126
|
-
| `ente-session get\|put\|clear` | Ente
|
|
127
|
-
| `rekey` |
|
|
128
|
-
| `status --token T` |
|
|
129
|
-
| `lock --token T \| --all` |
|
|
130
|
-
| `list --token T` |
|
|
131
|
-
| `get
|
|
132
|
-
| `add --name N [--username U] [--uri U] [--notes N] [--password-stdin] [--yes]` |
|
|
133
|
-
| `save --yes [--file F]` |
|
|
134
|
-
| `remove
|
|
135
|
-
| `grant
|
|
136
|
-
| `audit [n]` |
|
|
137
|
-
| `import <bitwarden.json> [--yes]` |
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
| `path` | print the store and session locations |
|
|
143
|
+
| `doctor` | paths, whether initialised, desktop/zenity availability, KDF, version |
|
|
144
|
+
| `init [--password-stdin]` | create the store (a dialog sets the password twice); prints a token |
|
|
145
|
+
| `unlock [--password-stdin] [--requester ID]` | unlock under the current policy; prints a token |
|
|
146
|
+
| `mode [get]` / `mode set never\|time\|session [--hours N]` | show / switch the unlock policy (switching needs the master password) |
|
|
147
|
+
| `settings [key] [value]` | every setting: `vault.*` `bitwarden.*` `ente.*` |
|
|
148
|
+
| `bw-session get\|put\|clear` | the persisted `bw` session key (used when `bitwarden.unlock != session`; sealed at rest) |
|
|
149
|
+
| `ente-session get\|put\|clear` | Ente's `ENTE_CLI_VAULT_KEY` (used when `ente.unlock != session`; sealed the same way) |
|
|
150
|
+
| `rekey` | raise an old store's scrypt parameters to the current default (needs the master password) |
|
|
151
|
+
| `status --token T` | item count, expiry, live read grants |
|
|
152
|
+
| `lock --token T \| --all` | drop a token (`--all` ends every session on the machine) |
|
|
153
|
+
| `list --token T` | entry metadata (name/username/URI); no passwords |
|
|
154
|
+
| `get <name> [--reason R] [--answer-stdin]` | read one entry; a confirm window opens unless a grant is live |
|
|
155
|
+
| `add --name N [--type TYPE] [--field NAME[=VALUE]]… [--secret NAME=VALUE]… [--username U] [--uri U] [--notes N] [--password-stdin] [--yes]` | create/update any type; a hidden field left out is typed in a dialog (`--secret` is for a host that already asked) |
|
|
156
|
+
| `save --yes [--file F]` | read an array of entries as JSON and write them (the import path) |
|
|
157
|
+
| `remove <name> [--yes]` | delete (quote names with spaces) |
|
|
158
|
+
| `grant <name> [--minutes N]` / `revoke <name\|--all>` | a standing read grant (default 5 min, max 60); `grant` costs the master password |
|
|
159
|
+
| `audit [n]` | the last n audit lines (default 30) |
|
|
160
|
+
| `import <bitwarden.json> [--yes]` | import an unencrypted Bitwarden export, every item type |
|
|
161
|
+
|
|
162
|
+
The token can also come from `AI_VAULT_TOKEN`. The store directory is `--dir`,
|
|
163
|
+
then `AI_VAULT_DIR`, then `~/.ai-vault`.
|
|
164
|
+
|
|
165
|
+
### Exit codes (the host contract)
|
|
166
|
+
|
|
167
|
+
| Code | Meaning | What a host does |
|
|
144
168
|
|---|---|---|
|
|
145
|
-
| 0 |
|
|
146
|
-
| 1 |
|
|
147
|
-
| 2 |
|
|
148
|
-
| 3 |
|
|
149
|
-
| 4 |
|
|
150
|
-
| 5 |
|
|
169
|
+
| 0 | success | stdout is the result (JSON with `--json`) |
|
|
170
|
+
| 1 | error | show the first stderr line to the user |
|
|
171
|
+
| 2 | usage error | same |
|
|
172
|
+
| 3 | needs UI | stderr says `needs-ui: password\|text\|confirm`; the host prompts itself and sends the value back on stdin with the matching flag |
|
|
173
|
+
| 4 | user denied / cancelled | **do not retry**; ask the user |
|
|
174
|
+
| 5 | locked / wrong password | `unlock` again, or report the wrong password |
|
|
151
175
|
|
|
152
|
-
|
|
176
|
+
So a headless machine works too: `unlock --password-stdin`, `add --password-stdin --yes`
|
|
177
|
+
and `save --yes` need no window at all.
|
|
153
178
|
|
|
154
|
-
|
|
179
|
+
**Relaying a confirmation is a host privilege** and needs all three of:
|
|
155
180
|
|
|
156
181
|
```bash
|
|
157
182
|
AI_VAULT_HOST=1 \
|
|
158
|
-
AI_VAULT_HOST_SECRET=<
|
|
159
|
-
ai-vault get
|
|
160
|
-
# approval = HMAC-SHA256(hostSecret, "allow:<T
|
|
183
|
+
AI_VAULT_HOST_SECRET=<the secret the host minted> \
|
|
184
|
+
ai-vault get <entry> --token <T> --answer-stdin --approval <hex> <<< 'y'
|
|
185
|
+
# approval = HMAC-SHA256(hostSecret, "allow:<T>:<entry lowercased>:y")
|
|
161
186
|
```
|
|
162
187
|
|
|
163
|
-
`unlock`/`init`
|
|
188
|
+
`unlock`/`init` only echo a `hostSecret` back to a caller that already presented
|
|
189
|
+
one. It exists only in the host process's memory; the CLI signs session files
|
|
190
|
+
with it and checks relays against it. Missing any one of the three, `--answer-stdin`
|
|
191
|
+
is exit code 2. That is why the model's `bash`, even with a token in hand,
|
|
192
|
+
cannot sign an "allow".
|
|
164
193
|
|
|
165
|
-
##
|
|
194
|
+
## Extension tools
|
|
166
195
|
|
|
167
|
-
|
|
|
196
|
+
| Tool | What it does | Tier | Model sees the secret? |
|
|
197
|
+
|---|---|---|---|
|
|
198
|
+
| `vault_list` | local store metadata | read | no |
|
|
199
|
+
| `vault_get` | read one, any type: **local store first, Bitwarden second**; a Bitwarden hit follows `bitwarden.import` (ask / import / read once) | exec | yes, user-approved on the spot |
|
|
200
|
+
| `vault_add` | store one, any type; secret fields are typed in a dialog | write | no |
|
|
201
|
+
| `vault_import` | copy Bitwarden items of every type into the local store, field for field (asks first) | write | no |
|
|
202
|
+
| `bw_list` | live Bitwarden metadata | read | no |
|
|
203
|
+
| `bw_run` | run one command with `$VAULT_SECRET` in its env; output scrubbed | exec | no |
|
|
204
|
+
| `bw_inject` | inject into the bash env (**pi only**) | exec | no |
|
|
205
|
+
| `bw_clipboard` | copy to the clipboard, cleared after a delay | write | no |
|
|
206
|
+
| `bw_reveal` | plain text (off by default, confirmed per call) | exec | yes, user-approved on the spot |
|
|
207
|
+
| `ente_list` | Ente Auth entry metadata (name/issuer/account/type) | read | no |
|
|
208
|
+
| `ente_code` | one current TOTP/Steam code, confirmed per call | write | yes, user-approved on the spot |
|
|
209
|
+
|
|
210
|
+
Ente's login is managed by `ente` itself (once); `ente.unlock` only decides
|
|
211
|
+
whether ai-vault keeps `ENTE_CLI_VAULT_KEY` sealed for it.
|
|
212
|
+
|
|
213
|
+
Field selector: `password` (default) · `totp` (seed) · `code` (rotating code) ·
|
|
214
|
+
`notes` · `field:<custom field name>`.
|
|
215
|
+
|
|
216
|
+
### Item types
|
|
217
|
+
|
|
218
|
+
ai-vault stores the same item types Bitwarden does, with the same field names,
|
|
219
|
+
so an import is a copy and a manual entry is the same shape:
|
|
220
|
+
|
|
221
|
+
| Type | `--type` | Its own fields (`data`) | Secret field |
|
|
168
222
|
|---|---|---|---|
|
|
169
|
-
| `
|
|
170
|
-
|
|
|
171
|
-
| `
|
|
172
|
-
| `
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
| `
|
|
176
|
-
| `
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
223
|
+
| Login | `login` (default) | `username`, `password`, `totp` + `uris` | `password` |
|
|
224
|
+
| Secure note | `note` | none — the content is `notes` | — |
|
|
225
|
+
| Card | `card` | `cardholderName`, `brand`, `number`, `expMonth`, `expYear`, `code` | `number`, `code` |
|
|
226
|
+
| Identity | `identity` | `title`, `firstName`, `middleName`, `lastName`, `address1–3`, `city`, `state`, `postalCode`, `country`, `company`, `email`, `phone`, `ssn`, `username`, `passportNumber`, `licenseNumber` | `ssn`, document numbers |
|
|
227
|
+
| SSH key | `sshkey` | `privateKey`, `publicKey`, `keyFingerprint` | `privateKey` |
|
|
228
|
+
| Bank account | `bankaccount` | `bankName`, `nameOnAccount`, `accountType`, `accountNumber`, `routingNumber`, `branchNumber`, `pin`, `swiftCode`, `iban`, `bankContactPhone` | `accountNumber`, `routingNumber`, `pin` |
|
|
229
|
+
| Driver's licence | `driverslicense` | `firstName`, `middleName`, `lastName`, `dateOfBirth`, `licenseNumber`, `issuingCountry`, `issuingState`, `issueDate`, `expirationDate`, `issuingAuthority`, `licenseClass` | `licenseNumber` |
|
|
230
|
+
| Passport | `passport` | `surname`, `givenName`, `dateOfBirth`, `sex`, `birthPlace`, `nationality`, `issuingCountry`, `passportNumber`, `passportType`, `nationalIdentificationNumber`, `issuingAuthority`, `issueDate`, `expirationDate` | `passportNumber`, `nationalIdentificationNumber` |
|
|
231
|
+
|
|
232
|
+
The last three are behind Bitwarden's "new item types" flag; the CLI stores
|
|
233
|
+
them the same way. Every type also carries `notes` and custom `fields[]`
|
|
234
|
+
(`type`: 0 text · 1 hidden · 2 boolean · 3 linked, as in Bitwarden). A hidden
|
|
235
|
+
custom field is treated as a secret everywhere.
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
# by hand: non-secret fields on the line, the secret typed in a window
|
|
239
|
+
ai-vault add --name Visa --type card --field cardholderName="Li Jun" --field brand=Visa --field expYear=2029
|
|
240
|
+
ai-vault add --name "Wifi" --type note --notes "guest network: …"
|
|
241
|
+
ai-vault add --name server --type sshkey --field publicKey="ssh-ed25519 AAAA" # private key typed
|
|
242
|
+
```
|
|
180
243
|
|
|
181
|
-
|
|
244
|
+
`list` shows the type and the non-secret fields (cardholder, brand, expiry,
|
|
245
|
+
a person's name, the key's fingerprint…); it never shows a password, card
|
|
246
|
+
number or code, private key, PIN, account or document number, a hidden custom
|
|
247
|
+
field, a TOTP seed, or a secure note's body. `get` returns the whole entry.
|
|
182
248
|
|
|
183
|
-
|
|
249
|
+
The `vault_add` tool takes `type` and `fields` the same way. A secret field the
|
|
250
|
+
model fills in itself is refused: those are typed by the user in a dialog, one
|
|
251
|
+
window per field.
|
|
184
252
|
|
|
185
|
-
###
|
|
253
|
+
### Lookup order: local first, Bitwarden as fallback
|
|
186
254
|
|
|
187
|
-
`vault_get`
|
|
255
|
+
`vault_get` asks `ai-vault` (the store this machine shares) first and only
|
|
256
|
+
searches Bitwarden on a miss:
|
|
188
257
|
|
|
189
258
|
```
|
|
190
259
|
vault_get "github"
|
|
191
|
-
|
|
192
|
-
└─ ai-vault
|
|
193
|
-
├─
|
|
194
|
-
└─
|
|
195
|
-
|
|
260
|
+
├─ in ai-vault → returned (the unlock policy decides whether a window opens)
|
|
261
|
+
└─ not in ai-vault → search Bitwarden
|
|
262
|
+
├─ no hit → "not local, not in Bitwarden"
|
|
263
|
+
└─ hit → ① show you the entry (name/user), ask whether to read it
|
|
264
|
+
② after reading, ask: import into ai-vault, or use once?
|
|
196
265
|
```
|
|
197
266
|
|
|
198
|
-
|
|
267
|
+
That keeps the two apart: **only the passwords you approve for import ever
|
|
268
|
+
enter ai-vault**, and ai-vault is the set "the agent may use freely". Everything
|
|
269
|
+
else stays in Bitwarden and asks every time.
|
|
199
270
|
|
|
200
|
-
###
|
|
271
|
+
### Unlock policies
|
|
201
272
|
|
|
202
|
-
`ai-vault`
|
|
273
|
+
When `ai-vault` asks for its master password is a per-machine setting
|
|
274
|
+
(`~/.ai-vault/config.json`):
|
|
203
275
|
|
|
204
|
-
|
|
|
276
|
+
| Mode | Behaviour | For |
|
|
205
277
|
|---|---|---|
|
|
206
|
-
| `never` |
|
|
207
|
-
| `time` |
|
|
208
|
-
| `session` |
|
|
278
|
+
| `never` | never asks. The key lives in `~/.ai-vault/agent.session.json` (0600) and **reads open no window either** | handing the agent a set of "use freely" passwords |
|
|
279
|
+
| `time` | asks again N hours after the unlock (default 8, `--hours`) | long bounded tasks |
|
|
280
|
+
| `session` | once per session; dies with it (default) | everyday |
|
|
209
281
|
|
|
210
282
|
```bash
|
|
211
|
-
ai-vault mode #
|
|
212
|
-
ai-vault mode set never #
|
|
283
|
+
ai-vault mode # show
|
|
284
|
+
ai-vault mode set never # switching needs the master password
|
|
213
285
|
ai-vault mode set time --hours 4
|
|
214
286
|
ai-vault mode set session
|
|
215
287
|
```
|
|
216
|
-
|
|
288
|
+
In the extension: `/vault mode`, `/vault mode time 4`. **Switching always costs
|
|
289
|
+
the master password** — especially into `never`, because that writes the key to disk.
|
|
217
290
|
|
|
218
|
-
`never`
|
|
291
|
+
`never` is not "a bit safer"; it is explicitly giving up this layer: any process
|
|
292
|
+
that can read your home directory can read every password in the store. Its point
|
|
293
|
+
is to separate "the AI may use these" from "ask me every time".
|
|
219
294
|
|
|
220
|
-
### Bitwarden
|
|
295
|
+
### Bitwarden has the same three modes (set separately)
|
|
221
296
|
|
|
222
|
-
|
|
|
297
|
+
| Setting | Value | Behaviour |
|
|
223
298
|
|---|---|---|
|
|
224
|
-
| `bitwarden.unlock` | `never` | `bw`
|
|
225
|
-
| | `time` |
|
|
226
|
-
| | `session` |
|
|
227
|
-
| `bitwarden.import` | `ask` |
|
|
228
|
-
| | `always` |
|
|
229
|
-
| | `never` |
|
|
299
|
+
| `bitwarden.unlock` | `never` | the `bw` session key is kept on disk (`~/.ai-vault/bitwarden.session.json`, 0600, sealed); **no Bitwarden master password is asked** |
|
|
300
|
+
| | `time` | the same, but it expires after `bitwarden.hours` and the password is asked again |
|
|
301
|
+
| | `session` | the key stays in the agent's memory; asked once per session (default) |
|
|
302
|
+
| `bitwarden.import` | `ask` | local miss → show the Bitwarden hit → read once → ask whether to import (default) |
|
|
303
|
+
| | `always` | import on a hit and return it, **no window at all** (fully automatic; use with care) |
|
|
304
|
+
| | `never` | read once, ask once, never write to the local store |
|
|
230
305
|
|
|
231
306
|
```bash
|
|
232
|
-
ai-vault settings #
|
|
307
|
+
ai-vault settings # everything
|
|
233
308
|
ai-vault settings bitwarden.unlock never
|
|
234
309
|
ai-vault settings bitwarden.import always
|
|
235
310
|
ai-vault settings bitwarden.hours 24
|
|
236
311
|
```
|
|
237
|
-
|
|
312
|
+
In the extension: `/vault settings`, `/vault settings bitwarden.import always`.
|
|
238
313
|
|
|
239
|
-
> `bitwarden.import = always`
|
|
314
|
+
> `bitwarden.import = always` together with `bitwarden.unlock = never` means
|
|
315
|
+
> "anything in Bitwarden that gets asked for is imported automatically and read
|
|
316
|
+
> without a password from then on". Fastest and least guarded combination; only
|
|
317
|
+
> with an agent you fully trust.
|
|
240
318
|
|
|
241
|
-
`bw-session put/get/clear`
|
|
319
|
+
`bw-session put/get/clear` is the handle for that persisted key: the extension
|
|
320
|
+
writes it after a successful master-password unlock, it is cleared when the
|
|
321
|
+
policy goes back to `session`, and `/bw lock` clears it too.
|
|
242
322
|
|
|
243
|
-
##
|
|
323
|
+
## Extension commands
|
|
244
324
|
|
|
245
325
|
```
|
|
246
|
-
/vault init
|
|
247
|
-
/vault
|
|
248
|
-
/vault
|
|
249
|
-
/vault
|
|
250
|
-
/vault
|
|
251
|
-
/vault
|
|
252
|
-
/vault
|
|
253
|
-
/vault
|
|
254
|
-
/vault
|
|
255
|
-
/vault
|
|
256
|
-
/vault
|
|
257
|
-
/vault
|
|
258
|
-
/vault
|
|
259
|
-
/
|
|
326
|
+
/vault init create the local store (dialog sets the master password)
|
|
327
|
+
/vault add card:Visa brand=Visa code type:name, fields on the line, a bare field typed in a dialog
|
|
328
|
+
/vault unlock | lock unlock / lock this session
|
|
329
|
+
/vault mode [never|time|session] show / switch the unlock policy (switching needs the password)
|
|
330
|
+
/vault settings [key value] show / change settings (bitwarden.*, ente.*)
|
|
331
|
+
/vault ente-key save Ente's ENTE_CLI_VAULT_KEY (no keychain, no login)
|
|
332
|
+
/vault status state, expiry, grants left
|
|
333
|
+
/vault list entry metadata
|
|
334
|
+
/vault add [type:]name [field=value|field]… add any type; a bare field is typed in a dialog
|
|
335
|
+
/vault remove <name> delete (quote names like "GitHub (2)")
|
|
336
|
+
/vault grant <name> [minutes] a standing read grant (needs the master password)
|
|
337
|
+
/vault revoke <name|all> revoke grants
|
|
338
|
+
/vault audit [n] the last n audit lines
|
|
339
|
+
/vault import <bitwarden.json> import an unencrypted export
|
|
340
|
+
/vault import-bw [search] import logins straight from bw
|
|
341
|
+
/bw status|unlock|lock|clear the live Bitwarden session
|
|
260
342
|
```
|
|
261
343
|
|
|
262
|
-
##
|
|
344
|
+
## Sessions and isolation
|
|
263
345
|
|
|
264
|
-
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
-
|
|
346
|
+
- Every binding (a session, or a subagent) runs its own `ai-vault unlock` on
|
|
347
|
+
first use and gets **its own token**. A subagent cannot inherit the parent's
|
|
348
|
+
unlock or grants; the confirm window says "requester: subagent 0-Explore".
|
|
349
|
+
- Token lifetime follows the unlock policy (above): `session` up to 24 hours,
|
|
350
|
+
`time` until N hours, `never` never. `/new`, `/fork` and quitting make the
|
|
351
|
+
extension drop its own token; `/resume` keeps it. Expired, tampered or
|
|
352
|
+
old-store token files are swept on **every** CLI call.
|
|
353
|
+
- Read grants live in the token, so they are isolated per requester by
|
|
354
|
+
construction; `/vault grant` and `/vault revoke` change exactly that.
|
|
355
|
+
- The store file itself is shared: read-modify-write holds a file lock, so two
|
|
356
|
+
agents writing at once do not lose updates.
|
|
268
357
|
|
|
269
358
|
## Bitwarden
|
|
270
359
|
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
-
|
|
275
|
-
|
|
276
|
-
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
360
|
+
Requires `bw` (run `bw login` first). The first use asks for the master password
|
|
361
|
+
in a window; after that each call only needs "allow" in the confirm window.
|
|
362
|
+
|
|
363
|
+
- To run a command without the secret entering the conversation: `bw_run`. The
|
|
364
|
+
value is in the child's environment and gone when the command ends; the raw
|
|
365
|
+
value and its base64/base64url/URL/hex forms (including `base64`'s 76-column
|
|
366
|
+
wrapping and `xxd`'s spaced hex) are replaced in stdout/stderr with
|
|
367
|
+
`[BW_SCRUBBED:VAR]`. Output is capped at 8 MiB; the excess is dropped and marked.
|
|
368
|
+
- On pi, `bw_inject` puts it in the bash environment for several commands.
|
|
369
|
+
- Values copied by `bw_clipboard` join the scrub list too: reading the
|
|
370
|
+
clipboard back with `pbpaste` / `xclip -o` / `wl-paste` is scrubbed as well.
|
|
371
|
+
- The confirm window shows the **entry actually matched** (name + username), not
|
|
372
|
+
the reference the model gave.
|
|
373
|
+
- `/bw lock` only drops the current binding's session key; a global `bw lock`
|
|
374
|
+
runs only when the last binding in the process releases its key.
|
|
375
|
+
- The Bitwarden session key lives in the agent process's memory only, unless
|
|
376
|
+
`bitwarden.unlock` is `never`/`time`, in which case it is sealed at rest
|
|
377
|
+
(see *Security*).
|
|
378
|
+
|
|
379
|
+
## Ente (Auth codes)
|
|
380
|
+
|
|
381
|
+
`ente` is Ente's official terminal client (0.4+). It **logs in once**:
|
|
283
382
|
|
|
284
383
|
```bash
|
|
285
|
-
ente account login --app auth #
|
|
286
|
-
ente auth code list #
|
|
384
|
+
ente account login --app auth # email + password (+ a 2FA code)
|
|
385
|
+
ente auth code list # never asks for the password again
|
|
287
386
|
```
|
|
288
387
|
|
|
289
|
-
|
|
388
|
+
The session lives in `$XDG_DATA_HOME/ente-cli` (`~/.local/share/ente-cli` on
|
|
389
|
+
Linux) and the database key in the OS keychain by default. For a machine
|
|
390
|
+
without a desktop or keychain:
|
|
290
391
|
|
|
291
392
|
```bash
|
|
292
|
-
ente vault key generate #
|
|
293
|
-
|
|
393
|
+
ente vault key generate # prints a key; generate it once
|
|
394
|
+
/vault ente-key # paste it into the dialog; ai-vault seals it
|
|
395
|
+
/vault settings ente.unlock never # ente children get it automatically
|
|
294
396
|
```
|
|
295
397
|
|
|
296
|
-
|
|
398
|
+
So in the everyday `session` form, **looking up a code never asks for your
|
|
399
|
+
password** — at most one keychain unlock.
|
|
297
400
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
ente
|
|
302
|
-
|
|
303
|
-
/vault settings ente.unlock never # 之后 ente 子进程自动带上它
|
|
304
|
-
```
|
|
305
|
-
`ente.unlock` 和 `bitwarden.unlock` 是同一套三档(`never`/`time`/`session`),`ente-session get|put|clear` 是它的 CLI 入口;密钥用库目录的 wrap key 封存(0600),单独拷走 `ente.session.json` 解不开。插件永远不会把你 shell 里导出的 `ENTE_CLI_VAULT_KEY` 传给子进程——只有它自己封存的那把会。
|
|
401
|
+
`ente.unlock` is the same three-way switch as `bitwarden.unlock`
|
|
402
|
+
(`never`/`time`/`session`); `ente-session get|put|clear` is its CLI handle. The
|
|
403
|
+
key is sealed under the store directory's wrap key (0600); copying
|
|
404
|
+
`ente.session.json` away yields nothing. The extension never passes an
|
|
405
|
+
`ENTE_CLI_VAULT_KEY` exported in your shell to a child — only its own sealed copy.
|
|
306
406
|
|
|
307
|
-
pi-ai-vault
|
|
407
|
+
pi-ai-vault is only a client of that CLI and keeps no Ente key of its own:
|
|
308
408
|
|
|
309
|
-
|
|
|
409
|
+
| Tool | What it does |
|
|
310
410
|
|---|---|
|
|
311
|
-
| `ente_list` |
|
|
312
|
-
| `ente_code
|
|
411
|
+
| `ente_list` | list entries (name / issuer / accountName / type); **no codes** |
|
|
412
|
+
| `ente_code <name>` | show the entry actually matched in a window; on allow, return the current code and its expiry |
|
|
313
413
|
|
|
314
|
-
|
|
414
|
+
Same rules as `bw_*`: listing is metadata only; reading a code is confirmed
|
|
415
|
+
every time; a deny is final; both outcomes are audited (`~/.bw/pi-extension/audit.log`,
|
|
416
|
+
`ente.code` events, never the code itself); names and issuers are flattened to one
|
|
417
|
+
line before they reach a window.
|
|
315
418
|
|
|
316
|
-
|
|
419
|
+
The bash the extension starts strips `ENTE_CLI_VAULT_KEY` / `ENTE_CLI_PASSWORD`,
|
|
420
|
+
so an unattended key you exported does not leak into the model's own commands.
|
|
421
|
+
**Note**: the `ente` binary is on PATH, so the model running `ente auth code view`
|
|
422
|
+
directly still bypasses this extension's confirm window. Tightening that means
|
|
423
|
+
`ENTE_CLI_VAULT_KEY` plus pointing the model's `ENTE_CLI_HOME` elsewhere — or not
|
|
424
|
+
giving the agent a shell.
|
|
317
425
|
|
|
318
|
-
##
|
|
426
|
+
## Security
|
|
319
427
|
|
|
320
|
-
###
|
|
428
|
+
### Threat model: who can do what
|
|
321
429
|
|
|
322
|
-
|
|
430
|
+
Everything runs as **your user**, so the boundary is not "you vs other users" but
|
|
431
|
+
**you (the human) vs the agents running under your account**. The goal: the agent
|
|
432
|
+
may *use* passwords but cannot *get around you* to take them.
|
|
323
433
|
|
|
324
|
-
|
|
|
434
|
+
| Role | Can | Cannot |
|
|
325
435
|
|---|---|---|
|
|
326
|
-
|
|
|
327
|
-
|
|
|
328
|
-
| **agent
|
|
329
|
-
|
|
|
330
|
-
|
|
331
|
-
###
|
|
332
|
-
|
|
333
|
-
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
- **
|
|
340
|
-
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
- `
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
-
|
|
350
|
-
|
|
351
|
-
-
|
|
352
|
-
|
|
353
|
-
|
|
436
|
+
| **You** (typing `ai-vault` in a terminal) | everything | — |
|
|
437
|
+
| **The host** (the pi/omp extension process; `AI_VAULT_HOST=1` + a secret in memory) | relay your confirmations (signed), change settings | learn the master password unless you type it |
|
|
438
|
+
| **The agent** (the model's `bash`, same user, can read `~/.ai-vault`) | read a token file (but a session the extension opened is useless without the secret — first use voids it) | **forge a read confirmation, mint a grant on a token, change the requester shown in a window, `list` an extension session, get the Bitwarden master password** |
|
|
439
|
+
| **Another user / someone with the files offline** | read ciphertext | decrypt (scrypt + ChaCha20-Poly1305) |
|
|
440
|
+
|
|
441
|
+
### How
|
|
442
|
+
|
|
443
|
+
- **The confirm window cannot be bypassed.** `vault_get`'s confirmation is
|
|
444
|
+
either the CLI's own window or an answer relayed by the host. A relayed
|
|
445
|
+
answer must carry `--approval`: an HMAC under the **host process's in-memory
|
|
446
|
+
secret** over `allow:<token>:<entry>:<y|n>`. The model's bash can find the
|
|
447
|
+
token file but not the secret, so it cannot sign; a signature for another
|
|
448
|
+
entry, or with `n` flipped to `y`, does not match.
|
|
449
|
+
- **Token files cannot be edited.** Every session file carries an HMAC (host
|
|
450
|
+
sessions under the host secret, hand-typed CLI sessions under the store's wrap
|
|
451
|
+
key). Change `grants`, change `requester`, change one byte: the CLI reports
|
|
452
|
+
`session file was modified outside ai-vault` and deletes the file.
|
|
453
|
+
- **`grant` is no longer free.** "No window for N minutes" on an entry is a
|
|
454
|
+
standing approval and now costs the master password, like a policy change.
|
|
455
|
+
- **`never` mode is giving up the above on purpose.** The key is written to
|
|
456
|
+
`~/.ai-vault/agent.session.json` and reads open no window. Its point is to
|
|
457
|
+
separate "the AI may use these" from "ask me every time". Turning it on means
|
|
458
|
+
trusting the agent's output channel, not just the agent.
|
|
459
|
+
- **Sealed Bitwarden session.** With `bitwarden.unlock = never|time` the `bw`
|
|
460
|
+
session key is sealed with ChaCha20-Poly1305 under `~/.ai-vault/.wrap` (0600)
|
|
461
|
+
into `~/.ai-vault/bitwarden.session.json`. Copying that file alone opens
|
|
462
|
+
nothing. A `bw unlock --raw` session key is read access to your **entire**
|
|
463
|
+
Bitwarden vault, so that file is at least as sensitive as the store itself.
|
|
464
|
+
Ente's vault key gets the same treatment.
|
|
465
|
+
- **The text in a confirm window is not written by the model.** Entry names,
|
|
466
|
+
reasons, usernames and URIs are flattened to one line, control characters
|
|
467
|
+
removed, truncated to 80–120 characters before they reach a window, so a
|
|
468
|
+
newline in a name cannot forge a second "approved" block.
|
|
469
|
+
- **KDF.** New stores use scrypt `N=2^17` (128 MiB); the parameters travel in the
|
|
470
|
+
file header, so an old store (`N=2^15`) opens unchanged and `ai-vault rekey`
|
|
471
|
+
upgrades it. Anything below `2^15` is refused as a downgrade.
|
|
472
|
+
- **The master password** only passes through a dialog or the host prompt; the
|
|
473
|
+
key `unlock` derives only goes into the token file (0600, tmpfs when there is
|
|
474
|
+
one). `BW_*` is stripped from every child environment.
|
|
475
|
+
- **Audit**: `~/.ai-vault/audit.log` records sessions, entries, allow/deny with
|
|
476
|
+
the reason, and attempts such as `unsigned-relay`, `bad-approval`,
|
|
477
|
+
`modified-outside`; never a value. Rotated at 1 MiB.
|
|
478
|
+
- **Atomic writes + file lock**: temp file (0600) → fsync → rename → directory
|
|
479
|
+
fsync; a file lock around read-modify-write. Expired, tampered and old-store
|
|
480
|
+
token files are swept on every call.
|
|
481
|
+
- `bw_reveal` is off by default; the scrubber only engages for values ≥ 6
|
|
482
|
+
characters and cannot stop exfiltration over the network or one-way hashes —
|
|
483
|
+
`bw_run` / `bw_inject` are about keeping values out of the conversation, not
|
|
484
|
+
about stopping an agent that has been injected.
|
|
485
|
+
- `notes` appear only in `get` (after approval); `list` never prints them.
|
|
486
|
+
|
|
487
|
+
### Known limits
|
|
488
|
+
|
|
489
|
+
- In `session` mode the model's bash **can** read a token file, but it does it
|
|
490
|
+
no good: a session the extension opened is signed under the host's in-memory
|
|
491
|
+
secret, and without that secret the first use is judged "modified" and voided
|
|
492
|
+
(no `list` either; the file is deleted). Only a session **you** opened by
|
|
493
|
+
typing `ai-vault unlock` in a terminal (signed under the wrap key) can be
|
|
494
|
+
`list`ed by a same-user process — that session had no window to bypass in
|
|
495
|
+
the first place. This is the inherent exposure of "same user"; really
|
|
496
|
+
tightening it needs a different user or a container.
|
|
497
|
+
- A caller with `AI_VAULT_HOST=1` but no secret is treated as a human: it gets
|
|
498
|
+
no secret and cannot relay.
|
|
499
|
+
- `bitwarden.import = always` + `bitwarden.unlock = never` means "anything in
|
|
500
|
+
Bitwarden that gets asked for is imported automatically". Not recommended; it
|
|
501
|
+
can be turned on.
|
|
502
|
+
- The title bar of a zenity window belongs to the window manager; a full-screen
|
|
503
|
+
fake window is out of scope.
|
|
504
|
+
|
|
505
|
+
## Developing
|
|
354
506
|
|
|
355
507
|
```bash
|
|
356
|
-
cargo test # Rust
|
|
357
|
-
npm test #
|
|
358
|
-
npm run test:npm #
|
|
359
|
-
npm run test:cli #
|
|
508
|
+
cargo test # Rust unit tests (store, crypto format, import mapping)
|
|
509
|
+
npm test # builds the CLI, then runs the extension tests (real CLI + mock zenity/ente)
|
|
510
|
+
npm run test:npm # pack tarballs, install into a throwaway prefix, run the shim and exit codes
|
|
511
|
+
npm run test:cli # the binary alone: headless exit-code contract, encryption at rest, audit
|
|
360
512
|
npm run typecheck
|
|
361
|
-
bash test/smoke.sh pi #
|
|
513
|
+
bash test/smoke.sh pi # smoke on a real host (needs model credentials)
|
|
362
514
|
```
|
|
363
515
|
|
|
364
|
-
|
|
516
|
+
Layout:
|
|
365
517
|
|
|
366
518
|
```
|
|
367
|
-
crates/ai-vault/src/ main.rs cli.rs crypto.rs store.rs session.rs dialog.rs import.rs audit.rs paths.rs
|
|
368
|
-
bin/ai-vault.cjs npm
|
|
369
|
-
scripts/stage-npm.sh
|
|
370
|
-
packages/pi-ai-vault/ npm
|
|
371
|
-
bitwarden.ts prompt.ts host.ts import-map.ts scrub.ts
|
|
372
|
-
test/cli.sh
|
|
373
|
-
test/npm.sh npm
|
|
519
|
+
crates/ai-vault/src/ main.rs cli.rs crypto.rs store.rs session.rs sealed.rs dialog.rs import.rs audit.rs paths.rs perms.rs config.rs
|
|
520
|
+
bin/ai-vault.cjs npm entry: find the platform package, forward argv/stdio/exit code
|
|
521
|
+
scripts/stage-npm.sh turn a release binary into an npm platform package
|
|
522
|
+
packages/pi-ai-vault/ the npm package pi-ai-vault: src/ = index.ts (tools/commands) cli.ts (CLI client)
|
|
523
|
+
settings.ts ente.ts bitwarden.ts prompt.ts host.ts import-map.ts scrub.ts
|
|
524
|
+
test/cli.sh binary-level integration tests
|
|
525
|
+
test/npm.sh npm pack/install/forwarding tests
|
|
374
526
|
```
|
|
375
527
|
|
|
376
528
|
## License
|