agent-vault-cli 0.1.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.
Files changed (87) hide show
  1. package/.cursor/skills/npm-publish/SKILL.md +58 -0
  2. package/.github/workflows/ci.yml +67 -0
  3. package/README.md +164 -0
  4. package/ROADMAP.md +986 -0
  5. package/dist/commands/config.d.ts +8 -0
  6. package/dist/commands/config.d.ts.map +1 -0
  7. package/dist/commands/config.js +67 -0
  8. package/dist/commands/config.js.map +1 -0
  9. package/dist/commands/delete.d.ts +7 -0
  10. package/dist/commands/delete.d.ts.map +1 -0
  11. package/dist/commands/delete.js +30 -0
  12. package/dist/commands/delete.js.map +1 -0
  13. package/dist/commands/login.d.ts +7 -0
  14. package/dist/commands/login.d.ts.map +1 -0
  15. package/dist/commands/login.js +37 -0
  16. package/dist/commands/login.js.map +1 -0
  17. package/dist/commands/register.d.ts +13 -0
  18. package/dist/commands/register.d.ts.map +1 -0
  19. package/dist/commands/register.js +160 -0
  20. package/dist/commands/register.js.map +1 -0
  21. package/dist/core/audit.d.ts +15 -0
  22. package/dist/core/audit.d.ts.map +1 -0
  23. package/dist/core/audit.js +36 -0
  24. package/dist/core/audit.js.map +1 -0
  25. package/dist/core/browser.d.ts +7 -0
  26. package/dist/core/browser.d.ts.map +1 -0
  27. package/dist/core/browser.js +104 -0
  28. package/dist/core/browser.js.map +1 -0
  29. package/dist/core/config.d.ts +9 -0
  30. package/dist/core/config.d.ts.map +1 -0
  31. package/dist/core/config.js +80 -0
  32. package/dist/core/config.js.map +1 -0
  33. package/dist/core/crypto.d.ts +17 -0
  34. package/dist/core/crypto.d.ts.map +1 -0
  35. package/dist/core/crypto.js +90 -0
  36. package/dist/core/crypto.js.map +1 -0
  37. package/dist/core/fields.d.ts +5 -0
  38. package/dist/core/fields.d.ts.map +1 -0
  39. package/dist/core/fields.js +54 -0
  40. package/dist/core/fields.js.map +1 -0
  41. package/dist/core/keychain.d.ts +5 -0
  42. package/dist/core/keychain.d.ts.map +1 -0
  43. package/dist/core/keychain.js +97 -0
  44. package/dist/core/keychain.js.map +1 -0
  45. package/dist/core/origin.d.ts +25 -0
  46. package/dist/core/origin.d.ts.map +1 -0
  47. package/dist/core/origin.js +73 -0
  48. package/dist/core/origin.js.map +1 -0
  49. package/dist/core/ratelimit.d.ts +10 -0
  50. package/dist/core/ratelimit.d.ts.map +1 -0
  51. package/dist/core/ratelimit.js +70 -0
  52. package/dist/core/ratelimit.js.map +1 -0
  53. package/dist/core/secure-memory.d.ts +39 -0
  54. package/dist/core/secure-memory.d.ts.map +1 -0
  55. package/dist/core/secure-memory.js +68 -0
  56. package/dist/core/secure-memory.js.map +1 -0
  57. package/dist/index.d.ts +3 -0
  58. package/dist/index.d.ts.map +1 -0
  59. package/dist/index.js +129 -0
  60. package/dist/index.js.map +1 -0
  61. package/dist/types/index.d.ts +27 -0
  62. package/dist/types/index.d.ts.map +1 -0
  63. package/dist/types/index.js +2 -0
  64. package/dist/types/index.js.map +1 -0
  65. package/package.json +58 -0
  66. package/src/commands/config.ts +84 -0
  67. package/src/commands/delete.ts +39 -0
  68. package/src/commands/login.ts +49 -0
  69. package/src/commands/register.ts +188 -0
  70. package/src/core/audit.ts +59 -0
  71. package/src/core/browser.ts +131 -0
  72. package/src/core/config.ts +91 -0
  73. package/src/core/crypto.ts +106 -0
  74. package/src/core/fields.ts +59 -0
  75. package/src/core/keychain.ts +110 -0
  76. package/src/core/origin.ts +90 -0
  77. package/src/core/ratelimit.ts +89 -0
  78. package/src/core/secure-memory.ts +78 -0
  79. package/src/index.ts +133 -0
  80. package/src/types/index.ts +31 -0
  81. package/tests/browser-password-manager.test.ts +1023 -0
  82. package/tests/crypto.test.ts +140 -0
  83. package/tests/e2e.test.ts +565 -0
  84. package/tests/fixtures/server.ts +59 -0
  85. package/tests/security.test.ts +113 -0
  86. package/tsconfig.json +20 -0
  87. package/vitest.config.ts +17 -0
@@ -0,0 +1,58 @@
1
+ ---
2
+ name: npm-publish
3
+ description: Guide for bumping package versions and publishing to npm via CI/CD. Use when the user asks about publishing, releasing, version bumping, or deploying to npm.
4
+ ---
5
+
6
+ # NPM Publish Workflow
7
+
8
+ This project uses GitHub Actions CI/CD to automatically publish to npm when a version tag is pushed.
9
+
10
+ ## Quick Publish
11
+
12
+ ```bash
13
+ # 1. Bump the version (updates package.json and creates a git tag)
14
+ npm version patch # 0.1.0 -> 0.1.1
15
+ npm version minor # 0.1.0 -> 0.2.0
16
+ npm version major # 0.1.0 -> 1.0.0
17
+
18
+ # 2. Push to trigger CI/CD
19
+ git push && git push --tags
20
+ ```
21
+
22
+ The CI pipeline will automatically:
23
+ - Run tests on multiple platforms (Ubuntu, macOS) and Node versions (18, 20)
24
+ - Build the project
25
+ - Publish to npm if all tests pass
26
+
27
+ ## Version Types
28
+
29
+ | Command | Use When | Example |
30
+ |---------|----------|---------|
31
+ | `npm version patch` | Bug fixes, small updates | 0.1.0 → 0.1.1 |
32
+ | `npm version minor` | New features, backwards compatible | 0.1.0 → 0.2.0 |
33
+ | `npm version major` | Breaking changes | 0.1.0 → 1.0.0 |
34
+
35
+ ## Pre-release Versions
36
+
37
+ ```bash
38
+ npm version prerelease --preid=alpha # 0.1.0 -> 0.1.1-alpha.0
39
+ npm version prerelease --preid=beta # 0.1.0 -> 0.1.1-beta.0
40
+ npm version prerelease --preid=rc # 0.1.0 -> 0.1.1-rc.0
41
+ ```
42
+
43
+ ## Setup (One-time)
44
+
45
+ Add `NPM_TOKEN` to GitHub repository secrets:
46
+ 1. Generate token at https://www.npmjs.com/settings/[username]/tokens
47
+ 2. Add to GitHub repo: Settings → Secrets and variables → Actions → New repository secret
48
+ 3. Name: `NPM_TOKEN`, Value: [your token]
49
+
50
+ ## Troubleshooting
51
+
52
+ **CI fails to publish?**
53
+ - Verify `NPM_TOKEN` is set in GitHub secrets
54
+ - Check if version already exists on npm
55
+ - Review GitHub Actions logs
56
+
57
+ **Need to skip CI tests?**
58
+ - Not recommended, but you can manually publish: `npm publish --access public`
@@ -0,0 +1,67 @@
1
+ name: CI/CD
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ tags:
8
+ - 'v*'
9
+ pull_request:
10
+ branches:
11
+ - main
12
+
13
+ jobs:
14
+ test:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Setup Node.js
22
+ uses: actions/setup-node@v4
23
+ with:
24
+ node-version: '20.x'
25
+
26
+ - name: Install system dependencies for keytar
27
+ run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev
28
+
29
+ - name: Install dependencies with yarn
30
+ run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --frozen-lockfile || PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install
31
+ timeout-minutes: 10
32
+
33
+ - name: Build
34
+ run: yarn build
35
+
36
+ - name: Run unit tests only
37
+ run: yarn test --run tests/crypto.test.ts tests/security.test.ts
38
+
39
+ publish:
40
+ needs: test
41
+ runs-on: ubuntu-latest
42
+ if: startsWith(github.ref, 'refs/tags/v')
43
+
44
+ steps:
45
+ - name: Checkout code
46
+ uses: actions/checkout@v4
47
+
48
+ - name: Setup Node.js
49
+ uses: actions/setup-node@v4
50
+ with:
51
+ node-version: '20.x'
52
+ registry-url: 'https://registry.npmjs.org'
53
+
54
+ - name: Install system dependencies for keytar
55
+ run: sudo apt-get update && sudo apt-get install -y libsecret-1-dev
56
+
57
+ - name: Install dependencies with yarn
58
+ run: PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --frozen-lockfile || PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install
59
+ timeout-minutes: 10
60
+
61
+ - name: Build
62
+ run: yarn build
63
+
64
+ - name: Publish to npm
65
+ run: npm publish --access public
66
+ env:
67
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
package/README.md ADDED
@@ -0,0 +1,164 @@
1
+ # Agent Vault CLI
2
+
3
+ **Your AI agent can log into websites. Your credentials never touch the LLM.**
4
+
5
+ Whether you're using personal accounts or dedicated agent credentials, they go straight from your keychain to the browser — never through the agent, never to the API.
6
+
7
+ ```
8
+ Without Agent Vault:
9
+ User → "login with alice@example.com / MySecret123" → Agent → LLM API
10
+
11
+ Credentials in:
12
+ • API logs
13
+ • Conversation history
14
+ • Training data (maybe)
15
+
16
+ With Agent Vault:
17
+ Agent → "log in" → Vault → Browser
18
+
19
+ Agent sees: "success" or "failed"
20
+ Credentials: never leave your keychain
21
+ ```
22
+
23
+ > ⚠️ **Early development** — API may change. Feedback welcome.
24
+
25
+ ## Demo Video
26
+
27
+ > 🎬 **Want to see it in action?** Check out our [demo video creation guide](./demo/QUICKSTART.md) to record your own!
28
+
29
+ <!-- Add your demo video/gif here after recording -->
30
+
31
+ ## Quick Start
32
+
33
+ ```bash
34
+ npm install -g @agent-vault/cli
35
+ ```
36
+
37
+ **1. Register credentials** (you do this once, interactively):
38
+
39
+ ```bash
40
+ vault register --cdp "ws://localhost:9222" \
41
+ --username-selector "#email" \
42
+ --password-selector "#password"
43
+ ```
44
+
45
+ **2. Let your agent log in** (credentials never exposed):
46
+
47
+ ```bash
48
+ vault login --cdp "ws://localhost:9222"
49
+ ```
50
+
51
+ That's it. The agent calls `vault login`, gets back "success" or "failed", and continues with an authenticated session.
52
+
53
+ ---
54
+
55
+ ## How It Works
56
+
57
+ The agent provides a browser (CDP endpoint). The vault:
58
+
59
+ 1. Connects directly to the browser
60
+ 2. Reads the current origin from the page (not from the agent)
61
+ 3. Looks up credentials for that origin in your OS keychain
62
+ 4. Fills the form and submits
63
+
64
+ The agent never handles, sees, or transmits credentials.
65
+
66
+ ---
67
+
68
+ ## Why Not Use Existing Tools?
69
+
70
+ **MCP credential tools** (1Password MCP, authenticator_mcp, etc.) return credentials to the agent:
71
+
72
+ ```
73
+ Vault → MCP Server → Returns credential → Agent has credential → LLM context
74
+ ```
75
+
76
+ They solve "don't commit secrets to git." They don't solve "don't expose secrets to the LLM."
77
+
78
+ **Password manager extensions** keep credentials out of the LLM, but don't work in headless browsers — and that's where most production agents run.
79
+
80
+ Agent Vault works in headless. Credentials go directly from keychain to browser, no extension UI required.
81
+
82
+ ---
83
+
84
+ ## What This Does (and Doesn't) Prevent
85
+
86
+ | Threat | Prevented? |
87
+ |--------|------------|
88
+ | Credentials slip into prompt/context | ✅ Yes |
89
+ | Credentials in LLM API logs | ✅ Yes |
90
+ | Credentials in conversation history | ✅ Yes |
91
+ | Credentials in error messages | ✅ Yes |
92
+ | Malicious agent inspects DOM/network | ❌ No |
93
+
94
+ This solves the 95% case: **credentials shouldn't be in prompts, logs, or API calls by default.**
95
+
96
+ The 5% case (active interception by a malicious agent) requires intentional attack code and leaves traces. Different threat model, different mitigations.
97
+
98
+ ---
99
+
100
+ ## Commands
101
+
102
+ | Command | What it does |
103
+ |---------|--------------|
104
+ | `vault register` | Save credentials for a site (interactive) |
105
+ | `vault login` | Fill credentials for current page |
106
+ | `vault list` | Show registered sites |
107
+ | `vault delete --origin <url>` | Remove credentials |
108
+ | `vault config set/get/list/unset` | Manage defaults |
109
+
110
+ Config stored in `~/.agent-vault/config.json`.
111
+
112
+ ---
113
+
114
+ ## Agent Integration Example
115
+
116
+ ```python
117
+ # Your agent code
118
+ browser_navigate("https://github.com/login")
119
+ shell("vault login --cdp ws://localhost:9222") # Returns success/failure
120
+ # Continue with authenticated session
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Security Model
126
+
127
+ | Action | Agent provides | Agent sees credentials? |
128
+ |--------|----------------|------------------------|
129
+ | Register | CDP endpoint + selectors | Never (you enter them) |
130
+ | Login | CDP endpoint only | Never (vault reads keychain) |
131
+
132
+ ---
133
+
134
+ ## Development
135
+
136
+ ```bash
137
+ npm install
138
+ npm run build
139
+ npm run dev # watch mode
140
+ npm test
141
+ ```
142
+
143
+ ### Creating Demo Videos
144
+
145
+ Want to create a demo video? We have scripts for that!
146
+
147
+ ```bash
148
+ # Interactive guided demo (recommended)
149
+ npm run demo:interactive
150
+
151
+ # Automated demo
152
+ npm run demo:auto
153
+
154
+ # Create video with Remotion
155
+ npm run demo:video
156
+ ```
157
+
158
+ See [demo/GUIDE.md](./demo/GUIDE.md) for complete instructions.
159
+
160
+ ---
161
+
162
+ ## License
163
+
164
+ MIT