@vess-id/vess 0.2.0-alpha.1
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/LICENSE +64 -0
- package/README.md +223 -0
- package/bin/vess.js +2 -0
- package/dist/__mocks__/@napi-rs/keyring.d.ts +9 -0
- package/dist/__mocks__/@napi-rs/keyring.d.ts.map +1 -0
- package/dist/__mocks__/@napi-rs/keyring.js +33 -0
- package/dist/__mocks__/@napi-rs/keyring.js.map +1 -0
- package/dist/__mocks__/node-mac-auth.d.ts +8 -0
- package/dist/__mocks__/node-mac-auth.d.ts.map +1 -0
- package/dist/__mocks__/node-mac-auth.js +29 -0
- package/dist/__mocks__/node-mac-auth.js.map +1 -0
- package/dist/adapter/mcp/http-transport.d.ts +34 -0
- package/dist/adapter/mcp/http-transport.d.ts.map +1 -0
- package/dist/adapter/mcp/http-transport.js +158 -0
- package/dist/adapter/mcp/http-transport.js.map +1 -0
- package/dist/adapter/mcp/mcp-adapter.d.ts +37 -0
- package/dist/adapter/mcp/mcp-adapter.d.ts.map +1 -0
- package/dist/adapter/mcp/mcp-adapter.js +48 -0
- package/dist/adapter/mcp/mcp-adapter.js.map +1 -0
- package/dist/adapter/mcp/mcp-server.factory.d.ts +35 -0
- package/dist/adapter/mcp/mcp-server.factory.d.ts.map +1 -0
- package/dist/adapter/mcp/mcp-server.factory.js +114 -0
- package/dist/adapter/mcp/mcp-server.factory.js.map +1 -0
- package/dist/adapter/mcp/stdio-transport.d.ts +7 -0
- package/dist/adapter/mcp/stdio-transport.d.ts.map +1 -0
- package/dist/adapter/mcp/stdio-transport.js +13 -0
- package/dist/adapter/mcp/stdio-transport.js.map +1 -0
- package/dist/adapter/mcp/transport.d.ts +10 -0
- package/dist/adapter/mcp/transport.d.ts.map +1 -0
- package/dist/adapter/mcp/transport.js +14 -0
- package/dist/adapter/mcp/transport.js.map +1 -0
- package/dist/approval/approval-token.d.ts +23 -0
- package/dist/approval/approval-token.d.ts.map +1 -0
- package/dist/approval/approval-token.js +81 -0
- package/dist/approval/approval-token.js.map +1 -0
- package/dist/audit/audit-dto-mapper.d.ts +29 -0
- package/dist/audit/audit-dto-mapper.d.ts.map +1 -0
- package/dist/audit/audit-dto-mapper.js +61 -0
- package/dist/audit/audit-dto-mapper.js.map +1 -0
- package/dist/audit/audit-logger.d.ts +35 -0
- package/dist/audit/audit-logger.d.ts.map +1 -0
- package/dist/audit/audit-logger.js +67 -0
- package/dist/audit/audit-logger.js.map +1 -0
- package/dist/audit/audit-sync.d.ts +12 -0
- package/dist/audit/audit-sync.d.ts.map +1 -0
- package/dist/audit/audit-sync.js +65 -0
- package/dist/audit/audit-sync.js.map +1 -0
- package/dist/auth/user-authenticator.d.ts +51 -0
- package/dist/auth/user-authenticator.d.ts.map +1 -0
- package/dist/auth/user-authenticator.js +155 -0
- package/dist/auth/user-authenticator.js.map +1 -0
- package/dist/cli/cli-db.d.ts +12 -0
- package/dist/cli/cli-db.d.ts.map +1 -0
- package/dist/cli/cli-db.js +20 -0
- package/dist/cli/cli-db.js.map +1 -0
- package/dist/cli/cli-utils.d.ts +14 -0
- package/dist/cli/cli-utils.d.ts.map +1 -0
- package/dist/cli/cli-utils.js +57 -0
- package/dist/cli/cli-utils.js.map +1 -0
- package/dist/cli/daemon-utils.d.ts +30 -0
- package/dist/cli/daemon-utils.d.ts.map +1 -0
- package/dist/cli/daemon-utils.js +131 -0
- package/dist/cli/daemon-utils.js.map +1 -0
- package/dist/cli/daemon.d.ts +13 -0
- package/dist/cli/daemon.d.ts.map +1 -0
- package/dist/cli/daemon.js +207 -0
- package/dist/cli/daemon.js.map +1 -0
- package/dist/cli/doctor.d.ts +2 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +135 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/env-delete.d.ts +6 -0
- package/dist/cli/env-delete.d.ts.map +1 -0
- package/dist/cli/env-delete.js +80 -0
- package/dist/cli/env-delete.js.map +1 -0
- package/dist/cli/env-list.d.ts +5 -0
- package/dist/cli/env-list.d.ts.map +1 -0
- package/dist/cli/env-list.js +42 -0
- package/dist/cli/env-list.js.map +1 -0
- package/dist/cli/env-post-integration.d.ts +21 -0
- package/dist/cli/env-post-integration.d.ts.map +1 -0
- package/dist/cli/env-post-integration.js +300 -0
- package/dist/cli/env-post-integration.js.map +1 -0
- package/dist/cli/env-restore.d.ts +15 -0
- package/dist/cli/env-restore.d.ts.map +1 -0
- package/dist/cli/env-restore.js +130 -0
- package/dist/cli/env-restore.js.map +1 -0
- package/dist/cli/env.d.ts +14 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +182 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/error-handlers.d.ts +13 -0
- package/dist/cli/error-handlers.d.ts.map +1 -0
- package/dist/cli/error-handlers.js +32 -0
- package/dist/cli/error-handlers.js.map +1 -0
- package/dist/cli/hook-check-env.d.ts +12 -0
- package/dist/cli/hook-check-env.d.ts.map +1 -0
- package/dist/cli/hook-check-env.js +117 -0
- package/dist/cli/hook-check-env.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +294 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-guard.d.ts +13 -0
- package/dist/cli/init-guard.d.ts.map +1 -0
- package/dist/cli/init-guard.js +62 -0
- package/dist/cli/init-guard.js.map +1 -0
- package/dist/cli/init.d.ts +19 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +440 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/install.d.ts +14 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +186 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/login.d.ts +6 -0
- package/dist/cli/login.d.ts.map +1 -0
- package/dist/cli/login.js +76 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/logs.d.ts +32 -0
- package/dist/cli/logs.d.ts.map +1 -0
- package/dist/cli/logs.js +147 -0
- package/dist/cli/logs.js.map +1 -0
- package/dist/cli/project.d.ts +8 -0
- package/dist/cli/project.d.ts.map +1 -0
- package/dist/cli/project.js +102 -0
- package/dist/cli/project.js.map +1 -0
- package/dist/cli/reset.d.ts +8 -0
- package/dist/cli/reset.d.ts.map +1 -0
- package/dist/cli/reset.js +137 -0
- package/dist/cli/reset.js.map +1 -0
- package/dist/cli/run.d.ts +22 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +103 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +29 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/cli/status.d.ts +12 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +131 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/uninstall.d.ts +8 -0
- package/dist/cli/uninstall.d.ts.map +1 -0
- package/dist/cli/uninstall.js +111 -0
- package/dist/cli/uninstall.js.map +1 -0
- package/dist/config/config.d.ts +10 -0
- package/dist/config/config.d.ts.map +1 -0
- package/dist/config/config.js +64 -0
- package/dist/config/config.js.map +1 -0
- package/dist/config/constants.d.ts +3 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +6 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/paths.d.ts +9 -0
- package/dist/config/paths.d.ts.map +1 -0
- package/dist/config/paths.js +58 -0
- package/dist/config/paths.js.map +1 -0
- package/dist/core/execution-engine.d.ts +119 -0
- package/dist/core/execution-engine.d.ts.map +1 -0
- package/dist/core/execution-engine.js +1291 -0
- package/dist/core/execution-engine.js.map +1 -0
- package/dist/core/runtime.d.ts +43 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +143 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/sync-scheduler.d.ts +42 -0
- package/dist/core/sync-scheduler.d.ts.map +1 -0
- package/dist/core/sync-scheduler.js +131 -0
- package/dist/core/sync-scheduler.js.map +1 -0
- package/dist/core/types.d.ts +77 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +7 -0
- package/dist/core/types.js.map +1 -0
- package/dist/daemon/service-manager.d.ts +68 -0
- package/dist/daemon/service-manager.d.ts.map +1 -0
- package/dist/daemon/service-manager.js +303 -0
- package/dist/daemon/service-manager.js.map +1 -0
- package/dist/env/env-classifier.d.ts +14 -0
- package/dist/env/env-classifier.d.ts.map +1 -0
- package/dist/env/env-classifier.js +94 -0
- package/dist/env/env-classifier.js.map +1 -0
- package/dist/env/env-parser.d.ts +13 -0
- package/dist/env/env-parser.d.ts.map +1 -0
- package/dist/env/env-parser.js +33 -0
- package/dist/env/env-parser.js.map +1 -0
- package/dist/env/env-profile-store.d.ts +15 -0
- package/dist/env/env-profile-store.d.ts.map +1 -0
- package/dist/env/env-profile-store.js +35 -0
- package/dist/env/env-profile-store.js.map +1 -0
- package/dist/env/env-reference.d.ts +10 -0
- package/dist/env/env-reference.d.ts.map +1 -0
- package/dist/env/env-reference.js +33 -0
- package/dist/env/env-reference.js.map +1 -0
- package/dist/env/env-resolver.d.ts +18 -0
- package/dist/env/env-resolver.d.ts.map +1 -0
- package/dist/env/env-resolver.js +48 -0
- package/dist/env/env-resolver.js.map +1 -0
- package/dist/env/fs-utils.d.ts +9 -0
- package/dist/env/fs-utils.d.ts.map +1 -0
- package/dist/env/fs-utils.js +59 -0
- package/dist/env/fs-utils.js.map +1 -0
- package/dist/env/secret-backend.d.ts +15 -0
- package/dist/env/secret-backend.d.ts.map +1 -0
- package/dist/env/secret-backend.js +24 -0
- package/dist/env/secret-backend.js.map +1 -0
- package/dist/executor/executor-registry.d.ts +22 -0
- package/dist/executor/executor-registry.d.ts.map +1 -0
- package/dist/executor/executor-registry.js +42 -0
- package/dist/executor/executor-registry.js.map +1 -0
- package/dist/executor/process-launcher.d.ts +26 -0
- package/dist/executor/process-launcher.d.ts.map +1 -0
- package/dist/executor/process-launcher.js +98 -0
- package/dist/executor/process-launcher.js.map +1 -0
- package/dist/executor/secret-file.d.ts +28 -0
- package/dist/executor/secret-file.d.ts.map +1 -0
- package/dist/executor/secret-file.js +127 -0
- package/dist/executor/secret-file.js.map +1 -0
- package/dist/gateway/auth.d.ts +26 -0
- package/dist/gateway/auth.d.ts.map +1 -0
- package/dist/gateway/auth.js +66 -0
- package/dist/gateway/auth.js.map +1 -0
- package/dist/gateway/gateway-client.d.ts +298 -0
- package/dist/gateway/gateway-client.d.ts.map +1 -0
- package/dist/gateway/gateway-client.js +501 -0
- package/dist/gateway/gateway-client.js.map +1 -0
- package/dist/identity/agent-identity.d.ts +29 -0
- package/dist/identity/agent-identity.d.ts.map +1 -0
- package/dist/identity/agent-identity.js +54 -0
- package/dist/identity/agent-identity.js.map +1 -0
- package/dist/identity/did-manager.d.ts +17 -0
- package/dist/identity/did-manager.d.ts.map +1 -0
- package/dist/identity/did-manager.js +29 -0
- package/dist/identity/did-manager.js.map +1 -0
- package/dist/identity/key-manager.d.ts +18 -0
- package/dist/identity/key-manager.d.ts.map +1 -0
- package/dist/identity/key-manager.js +101 -0
- package/dist/identity/key-manager.js.map +1 -0
- package/dist/identity/session-key.d.ts +13 -0
- package/dist/identity/session-key.d.ts.map +1 -0
- package/dist/identity/session-key.js +17 -0
- package/dist/identity/session-key.js.map +1 -0
- package/dist/policy/policy-evaluator.d.ts +63 -0
- package/dist/policy/policy-evaluator.d.ts.map +1 -0
- package/dist/policy/policy-evaluator.js +266 -0
- package/dist/policy/policy-evaluator.js.map +1 -0
- package/dist/policy/policy-loader.d.ts +10 -0
- package/dist/policy/policy-loader.d.ts.map +1 -0
- package/dist/policy/policy-loader.js +71 -0
- package/dist/policy/policy-loader.js.map +1 -0
- package/dist/policy/types.d.ts +21 -0
- package/dist/policy/types.d.ts.map +1 -0
- package/dist/policy/types.js +3 -0
- package/dist/policy/types.js.map +1 -0
- package/dist/utils/credential-errors.d.ts +3 -0
- package/dist/utils/credential-errors.d.ts.map +1 -0
- package/dist/utils/credential-errors.js +23 -0
- package/dist/utils/credential-errors.js.map +1 -0
- package/dist/utils/resource-canonicalizer.d.ts +19 -0
- package/dist/utils/resource-canonicalizer.d.ts.map +1 -0
- package/dist/utils/resource-canonicalizer.js +100 -0
- package/dist/utils/resource-canonicalizer.js.map +1 -0
- package/dist/utils/vc-utils.d.ts +23 -0
- package/dist/utils/vc-utils.d.ts.map +1 -0
- package/dist/utils/vc-utils.js +53 -0
- package/dist/utils/vc-utils.js.map +1 -0
- package/dist/wallet/sqlite.d.ts +4 -0
- package/dist/wallet/sqlite.d.ts.map +1 -0
- package/dist/wallet/sqlite.js +158 -0
- package/dist/wallet/sqlite.js.map +1 -0
- package/dist/wallet/vp-builder.d.ts +18 -0
- package/dist/wallet/vp-builder.d.ts.map +1 -0
- package/dist/wallet/vp-builder.js +46 -0
- package/dist/wallet/vp-builder.js.map +1 -0
- package/dist/wallet/wallet.d.ts +58 -0
- package/dist/wallet/wallet.d.ts.map +1 -0
- package/dist/wallet/wallet.js +170 -0
- package/dist/wallet/wallet.js.map +1 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: VESS Labs
|
|
6
|
+
Licensed Work: @vess-id/vess v0.1.0
|
|
7
|
+
The Licensed Work is (c) 2025 VESS Labs.
|
|
8
|
+
Additional Use Grant: You may use the Licensed Work for any purpose,
|
|
9
|
+
including production use, as a command-line tool
|
|
10
|
+
installed via npm. You may not use the Licensed Work
|
|
11
|
+
to provide a managed service or hosted offering that
|
|
12
|
+
competes with the Licensed Work or any other product
|
|
13
|
+
or service offered by the Licensor.
|
|
14
|
+
Change Date: 2030-03-23
|
|
15
|
+
Change License: Apache License, Version 2.0
|
|
16
|
+
|
|
17
|
+
For information about alternative licensing arrangements for the Licensed
|
|
18
|
+
Work, please contact info@vess.id.
|
|
19
|
+
|
|
20
|
+
Notice
|
|
21
|
+
|
|
22
|
+
Business Source License 1.1
|
|
23
|
+
|
|
24
|
+
Terms
|
|
25
|
+
|
|
26
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
27
|
+
works, redistribute, and make non-production use of the Licensed Work. The
|
|
28
|
+
Licensor may make an Additional Use Grant, above, permitting limited
|
|
29
|
+
production use.
|
|
30
|
+
|
|
31
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
32
|
+
available distribution of a specific version of the Licensed Work under this
|
|
33
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
34
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
35
|
+
above terminate.
|
|
36
|
+
|
|
37
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
38
|
+
currently in effect as described in this License, you must purchase a
|
|
39
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
40
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
41
|
+
|
|
42
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
43
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
44
|
+
separately for each version of the Licensed Work and the Change Date may vary
|
|
45
|
+
for each version of the Licensed Work released by Licensor.
|
|
46
|
+
|
|
47
|
+
You must conspicuously display this License on each original or modified copy
|
|
48
|
+
of the Licensed Work. If you receive the Licensed Work in original or
|
|
49
|
+
modified form from a third party, the terms and conditions set forth in this
|
|
50
|
+
License apply to your use of that work.
|
|
51
|
+
|
|
52
|
+
Any use of the Licensed Work in violation of this License will automatically
|
|
53
|
+
terminate your rights under this License for the current and all other
|
|
54
|
+
versions of the Licensed Work.
|
|
55
|
+
|
|
56
|
+
This License does not grant you any right in any trademark or logo of
|
|
57
|
+
Licensor or its affiliates (provided that you may use a trademark or logo of
|
|
58
|
+
Licensor as expressly required by this License).
|
|
59
|
+
|
|
60
|
+
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
|
|
61
|
+
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
|
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
|
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
|
|
64
|
+
TITLE.
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @vess-id/vess
|
|
2
|
+
|
|
3
|
+
> Local AI agent runtime — manages identity, permissions, and execution boundaries for AI coding agents.
|
|
4
|
+
|
|
5
|
+
## What is VESS?
|
|
6
|
+
|
|
7
|
+
VESS (Verifiable Execution Sandbox for Software agents) is a local runtime that gives your AI coding agent a cryptographic identity and enforces security boundaries on your machine.
|
|
8
|
+
|
|
9
|
+
- **Creates a DID-based cryptographic identity** for your development machine, stored securely in the OS Keychain
|
|
10
|
+
- **Registers as an MCP (Model Context Protocol) server** in Claude Code, so the agent operates within VESS-managed boundaries
|
|
11
|
+
- **Enforces policies** to protect sensitive files (`.ssh`, `.aws`, `.gnupg`) from unintended access
|
|
12
|
+
- **Manages environment variable secrets** via OS Keychain with Touch ID protection — secrets never sit in plaintext on disk
|
|
13
|
+
- **Connects to the VESS gateway** for project management and credential issuance
|
|
14
|
+
|
|
15
|
+
## Beta Status
|
|
16
|
+
|
|
17
|
+
This is a **beta release** (v0.1.0).
|
|
18
|
+
|
|
19
|
+
| Platform | Status |
|
|
20
|
+
|----------|--------|
|
|
21
|
+
| **macOS + Claude Code** | Primary target, fully supported |
|
|
22
|
+
| **Linux** | Daemon/service support exists but not fully tested |
|
|
23
|
+
| **Windows** | Not supported |
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
- **Node.js 22** or later
|
|
28
|
+
- **macOS** (primary) or Linux
|
|
29
|
+
- **Claude Code** — [installation guide](https://docs.anthropic.com/en/docs/claude-code)
|
|
30
|
+
- **A VESS account** — sign up at [app.vess.id](https://app.vess.id)
|
|
31
|
+
|
|
32
|
+
## Getting Started
|
|
33
|
+
|
|
34
|
+
### Step 1: Sign Up
|
|
35
|
+
|
|
36
|
+
1. Create an account at [https://app.vess.id](https://app.vess.id)
|
|
37
|
+
2. Create a project
|
|
38
|
+
3. (Optional) Connect integrations: Slack, Google Calendar, Jira
|
|
39
|
+
|
|
40
|
+
### Step 2: Install & Initialize
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g @vess-id/vess
|
|
44
|
+
vess init
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
This single command will:
|
|
48
|
+
|
|
49
|
+
- Generate a cryptographic identity (DID) for your device
|
|
50
|
+
- Open a browser for device verification
|
|
51
|
+
- Install a background daemon (auto-starts on login, localhost only)
|
|
52
|
+
- Register VESS as an MCP server in Claude Code
|
|
53
|
+
|
|
54
|
+
### Step 3: Verify
|
|
55
|
+
|
|
56
|
+
Restart Claude Code, then:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
vess status
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Commands
|
|
63
|
+
|
|
64
|
+
### Core
|
|
65
|
+
|
|
66
|
+
| Command | Description |
|
|
67
|
+
|---------|-------------|
|
|
68
|
+
| `vess init` | Initialize device + daemon + MCP registration (all-in-one) |
|
|
69
|
+
| `vess init --no-daemon` | Initialize without daemon (stdio mode only) |
|
|
70
|
+
| `vess init --no-install` | Initialize without Claude Code MCP registration |
|
|
71
|
+
| `vess init --force` | Force re-initialization even if already set up |
|
|
72
|
+
| `vess login` | Re-authenticate after session expiry |
|
|
73
|
+
| `vess status` | Show runtime status (auth, daemon, wallet) |
|
|
74
|
+
| `vess doctor` | Diagnose setup issues |
|
|
75
|
+
| `vess uninstall` | Completely remove VESS (MCP, daemon, config, keychain) |
|
|
76
|
+
|
|
77
|
+
### MCP Registration
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| `vess mcp register` | Register VESS as an MCP server in Claude Code |
|
|
82
|
+
|
|
83
|
+
> Tip: `vess init` runs this automatically. Use `vess mcp register` only if you skipped MCP registration during init or need to re-register after manual removal.
|
|
84
|
+
|
|
85
|
+
### Daemon
|
|
86
|
+
|
|
87
|
+
| Command | Description |
|
|
88
|
+
|---------|-------------|
|
|
89
|
+
| `vess daemon start` | Start the daemon (default: `127.0.0.1:3100`) |
|
|
90
|
+
| `vess daemon start --foreground` | Run in foreground (no daemonization) |
|
|
91
|
+
| `vess daemon stop` | Stop the running daemon |
|
|
92
|
+
| `vess daemon enable` | Enable auto-start on login (installs OS service) |
|
|
93
|
+
| `vess daemon disable` | Disable auto-start (removes OS service) |
|
|
94
|
+
|
|
95
|
+
### Logs
|
|
96
|
+
|
|
97
|
+
| Command | Description |
|
|
98
|
+
|---------|-------------|
|
|
99
|
+
| `vess logs` | Show recent daemon output (default: 50 lines) |
|
|
100
|
+
| `vess logs --follow` | Stream logs in real-time |
|
|
101
|
+
| `vess logs --lines 100` | Show last 100 lines |
|
|
102
|
+
|
|
103
|
+
### Projects
|
|
104
|
+
|
|
105
|
+
| Command | Description |
|
|
106
|
+
|---------|-------------|
|
|
107
|
+
| `vess project list` | List available projects |
|
|
108
|
+
| `vess project use <id>` | Switch active project |
|
|
109
|
+
| `vess project sync` | Re-fetch projects from gateway |
|
|
110
|
+
|
|
111
|
+
### Environment Secrets
|
|
112
|
+
|
|
113
|
+
| Command | Description |
|
|
114
|
+
|---------|-------------|
|
|
115
|
+
| `vess env import <file> --profile <name>` | Import .env into a secure profile |
|
|
116
|
+
| `vess env list` | List profiles and stored keys |
|
|
117
|
+
| `vess env list --profile <name>` | Show keys for a specific profile |
|
|
118
|
+
| `vess env delete --profile <name>` | Remove secrets from keychain |
|
|
119
|
+
| `vess env delete --profile <name> --keys <k1,k2>` | Remove specific keys only |
|
|
120
|
+
| `vess env restore --profile <name>` | Decrypt and restore .env (requires Touch ID) |
|
|
121
|
+
| `vess env restore --profile <name> --output <path>` | Write restored .env to a file |
|
|
122
|
+
| `vess run -- <command>` | Run command with decrypted env injection |
|
|
123
|
+
|
|
124
|
+
**`env import` options:**
|
|
125
|
+
|
|
126
|
+
| Flag | Description |
|
|
127
|
+
|------|-------------|
|
|
128
|
+
| `--interactive` | Classify each variable interactively |
|
|
129
|
+
| `--all-secret` | Treat all variables as secrets |
|
|
130
|
+
| `--keys <k1,k2>` | Specify which keys are secrets (rest are plaintext) |
|
|
131
|
+
| `--plaintext-keys <k1,k2>` | Specify additional plaintext keys (used with default mode) |
|
|
132
|
+
| `--dry-run` | Preview classification without making changes |
|
|
133
|
+
| `--skip-integration` | Skip post-import integration steps (package.json, CLAUDE.md, hooks) |
|
|
134
|
+
|
|
135
|
+
> Note: `--interactive`, `--all-secret`, and `--keys` are mutually exclusive.
|
|
136
|
+
|
|
137
|
+
**`run` options:**
|
|
138
|
+
|
|
139
|
+
| Flag | Description |
|
|
140
|
+
|------|-------------|
|
|
141
|
+
| `--profile <name>` | Env profile name (for logging) |
|
|
142
|
+
| `--cwd <dir>` | Working directory |
|
|
143
|
+
| `--timeout <seconds>` | Timeout in seconds |
|
|
144
|
+
|
|
145
|
+
## What Works in Beta
|
|
146
|
+
|
|
147
|
+
- Device identity creation (DID key pair, OS Keychain storage)
|
|
148
|
+
- Device enrollment via browser-based verification
|
|
149
|
+
- MCP server registration in Claude Code (stdio + HTTP daemon)
|
|
150
|
+
- Environment variable management with OS Keychain-backed secrets
|
|
151
|
+
- Touch ID-gated secret access (macOS)
|
|
152
|
+
- Policy enforcement (deny rules for `~/.ssh`, `~/.aws`, `~/.gnupg`)
|
|
153
|
+
- Project management (list, switch, sync)
|
|
154
|
+
- Audit logging
|
|
155
|
+
- OS service integration (launchd on macOS, systemd on Linux)
|
|
156
|
+
|
|
157
|
+
## Known Limitations
|
|
158
|
+
|
|
159
|
+
- Web dashboard signup and project creation required before CLI use
|
|
160
|
+
- No team/org-level policy sharing yet
|
|
161
|
+
- No automatic credential rotation
|
|
162
|
+
- Session tokens expire — run `vess login` to re-authenticate
|
|
163
|
+
- `vess env import --interactive` mode is experimental
|
|
164
|
+
- Daemon auto-start is set up during `vess init`; run `vess daemon enable` to re-enable if disabled
|
|
165
|
+
|
|
166
|
+
## How It Works
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
┌─────────────┐ MCP Protocol ┌──────────────┐
|
|
170
|
+
│ Claude Code │ <──────────────────> │ VESS agentd │
|
|
171
|
+
└─────────────┘ (stdio or HTTP) └──────┬───────┘
|
|
172
|
+
│
|
|
173
|
+
┌────────┼────────┐
|
|
174
|
+
│ │ │
|
|
175
|
+
┌────▼──┐ ┌──▼───┐ ┌──▼────┐
|
|
176
|
+
│Policy │ │Wallet│ │Keychain│
|
|
177
|
+
│Engine │ │ (DB) │ │ (OS) │
|
|
178
|
+
└───────┘ └──┬───┘ └───────┘
|
|
179
|
+
│
|
|
180
|
+
┌──────▼──────┐
|
|
181
|
+
│VESS Gateway │
|
|
182
|
+
│(api.vess.id)│
|
|
183
|
+
└─────────────┘
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Data Storage
|
|
187
|
+
|
|
188
|
+
All data stored under `~/.vess/`:
|
|
189
|
+
|
|
190
|
+
| File | Purpose |
|
|
191
|
+
|------|---------|
|
|
192
|
+
| `config.json` | Gateway URL, root DID, default project |
|
|
193
|
+
| `policy.json` | Local deny rules |
|
|
194
|
+
| `wallet.db` | SQLite — credentials, projects, audit logs |
|
|
195
|
+
| `logs/` | Audit log directory |
|
|
196
|
+
|
|
197
|
+
Secrets (root key, session token, env values) are stored in the **OS Keychain**, not on disk.
|
|
198
|
+
|
|
199
|
+
## Troubleshooting
|
|
200
|
+
|
|
201
|
+
| Issue | Solution |
|
|
202
|
+
|-------|----------|
|
|
203
|
+
| "Not initialized" | Run `vess init` |
|
|
204
|
+
| "No projects found" | Create one at [app.vess.id/projects](https://app.vess.id/projects), then `vess project sync` |
|
|
205
|
+
| Session expired | Run `vess login` |
|
|
206
|
+
| Claude Code doesn't see VESS | Run `vess mcp register`, restart Claude Code |
|
|
207
|
+
| Daemon not starting | Check `vess logs`, try `vess daemon start --foreground` |
|
|
208
|
+
| Need a fresh start | Run `vess uninstall`, then `vess init` |
|
|
209
|
+
| Diagnose issues | Run `vess doctor` |
|
|
210
|
+
|
|
211
|
+
## Links
|
|
212
|
+
|
|
213
|
+
- **Web Dashboard:** [https://app.vess.id](https://app.vess.id)
|
|
214
|
+
- **Documentation:** [https://vess.id/docs](https://vess.id/docs)
|
|
215
|
+
- **GitHub:** [https://github.com/cvoxelprotocol/aidentity](https://github.com/cvoxelprotocol/aidentity)
|
|
216
|
+
|
|
217
|
+
## Support
|
|
218
|
+
|
|
219
|
+
For bug reports, feature requests, or questions, please contact us at info@vess.id
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
Business Source License 1.1 — see [LICENSE](./LICENSE) for details.
|
package/bin/vess.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function _clearStore(): void;
|
|
2
|
+
export declare class Entry {
|
|
3
|
+
private readonly key;
|
|
4
|
+
constructor(service: string, name: string);
|
|
5
|
+
setPassword(password: string): void;
|
|
6
|
+
getPassword(): string;
|
|
7
|
+
deletePassword(): void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=keyring.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring.d.ts","sourceRoot":"","sources":["../../../src/__mocks__/@napi-rs/keyring.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;gBAEhB,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAIzC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,WAAW,IAAI,MAAM;IAQrB,cAAc,IAAI,IAAI;CAMvB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Entry = void 0;
|
|
4
|
+
exports._clearStore = _clearStore;
|
|
5
|
+
// Manual mock for @napi-rs/keyring — used in tests without OS keychain access
|
|
6
|
+
const store = new Map();
|
|
7
|
+
function _clearStore() {
|
|
8
|
+
store.clear();
|
|
9
|
+
}
|
|
10
|
+
class Entry {
|
|
11
|
+
key;
|
|
12
|
+
constructor(service, name) {
|
|
13
|
+
this.key = `${service}:${name}`;
|
|
14
|
+
}
|
|
15
|
+
setPassword(password) {
|
|
16
|
+
store.set(this.key, password);
|
|
17
|
+
}
|
|
18
|
+
getPassword() {
|
|
19
|
+
const val = store.get(this.key);
|
|
20
|
+
if (val === undefined) {
|
|
21
|
+
throw new Error('No password found');
|
|
22
|
+
}
|
|
23
|
+
return val;
|
|
24
|
+
}
|
|
25
|
+
deletePassword() {
|
|
26
|
+
if (!store.has(this.key)) {
|
|
27
|
+
throw new Error('No password found');
|
|
28
|
+
}
|
|
29
|
+
store.delete(this.key);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.Entry = Entry;
|
|
33
|
+
//# sourceMappingURL=keyring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyring.js","sourceRoot":"","sources":["../../../src/__mocks__/@napi-rs/keyring.ts"],"names":[],"mappings":";;;AAGA,kCAEC;AALD,8EAA8E;AAC9E,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAA;AAEvC,SAAgB,WAAW;IACzB,KAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC;AAED,MAAa,KAAK;IACC,GAAG,CAAQ;IAE5B,YAAY,OAAe,EAAE,IAAY;QACvC,IAAI,CAAC,GAAG,GAAG,GAAG,OAAO,IAAI,IAAI,EAAE,CAAA;IACjC,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC/B,CAAC;IAED,WAAW;QACT,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QAC/B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACtC,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAA;QACtC,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IACxB,CAAC;CACF;AAzBD,sBAyBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function _setAvailable(val: boolean): void;
|
|
2
|
+
export declare function _setShouldReject(val: boolean): void;
|
|
3
|
+
export declare function _reset(): void;
|
|
4
|
+
export declare function canPromptTouchID(): boolean;
|
|
5
|
+
export declare function promptTouchID(_opts: {
|
|
6
|
+
reason: string;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
//# sourceMappingURL=node-mac-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-mac-auth.d.ts","sourceRoot":"","sources":["../../src/__mocks__/node-mac-auth.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAEhD;AAED,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAEnD;AAED,wBAAgB,MAAM,IAAI,IAAI,CAG7B;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGtE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports._setAvailable = _setAvailable;
|
|
4
|
+
exports._setShouldReject = _setShouldReject;
|
|
5
|
+
exports._reset = _reset;
|
|
6
|
+
exports.canPromptTouchID = canPromptTouchID;
|
|
7
|
+
exports.promptTouchID = promptTouchID;
|
|
8
|
+
// Manual mock for node-mac-auth — used in tests without Touch ID hardware
|
|
9
|
+
let available = true;
|
|
10
|
+
let shouldReject = false;
|
|
11
|
+
function _setAvailable(val) {
|
|
12
|
+
available = val;
|
|
13
|
+
}
|
|
14
|
+
function _setShouldReject(val) {
|
|
15
|
+
shouldReject = val;
|
|
16
|
+
}
|
|
17
|
+
function _reset() {
|
|
18
|
+
available = true;
|
|
19
|
+
shouldReject = false;
|
|
20
|
+
}
|
|
21
|
+
function canPromptTouchID() {
|
|
22
|
+
return available;
|
|
23
|
+
}
|
|
24
|
+
function promptTouchID(_opts) {
|
|
25
|
+
if (shouldReject)
|
|
26
|
+
return Promise.reject(new Error('User cancelled'));
|
|
27
|
+
return Promise.resolve();
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=node-mac-auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-mac-auth.js","sourceRoot":"","sources":["../../src/__mocks__/node-mac-auth.ts"],"names":[],"mappings":";;AAIA,sCAEC;AAED,4CAEC;AAED,wBAGC;AAED,4CAEC;AAED,sCAGC;AAxBD,0EAA0E;AAC1E,IAAI,SAAS,GAAG,IAAI,CAAA;AACpB,IAAI,YAAY,GAAG,KAAK,CAAA;AAExB,SAAgB,aAAa,CAAC,GAAY;IACxC,SAAS,GAAG,GAAG,CAAA;AACjB,CAAC;AAED,SAAgB,gBAAgB,CAAC,GAAY;IAC3C,YAAY,GAAG,GAAG,CAAA;AACpB,CAAC;AAED,SAAgB,MAAM;IACpB,SAAS,GAAG,IAAI,CAAA;IAChB,YAAY,GAAG,KAAK,CAAA;AACtB,CAAC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAgB,aAAa,CAAC,KAAyB;IACrD,IAAI,YAAY;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACpE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
export interface HealthStatus {
|
|
3
|
+
auth: boolean;
|
|
4
|
+
db: boolean;
|
|
5
|
+
lastSync: string | null;
|
|
6
|
+
uptime: number;
|
|
7
|
+
}
|
|
8
|
+
export interface HttpTransportHandle {
|
|
9
|
+
close: () => Promise<void>;
|
|
10
|
+
port: number;
|
|
11
|
+
host: string;
|
|
12
|
+
sessionCount: () => number;
|
|
13
|
+
}
|
|
14
|
+
/** Factory result: McpServer + optional callback for client info from MCP initialize handshake */
|
|
15
|
+
export interface McpServerFactoryResult {
|
|
16
|
+
server: McpServer;
|
|
17
|
+
onClientInfo?: (info: {
|
|
18
|
+
name: string;
|
|
19
|
+
version: string;
|
|
20
|
+
}) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Start HTTP transport for daemon mode.
|
|
24
|
+
*
|
|
25
|
+
* @param createMcpServerFn Factory that creates a new McpServer per session.
|
|
26
|
+
* Can return just an McpServer (backward compat) or { server, onClientInfo }.
|
|
27
|
+
* @param port Port to bind to (default: 3100)
|
|
28
|
+
* @param host Host to bind to (default: 127.0.0.1, localhost only for security)
|
|
29
|
+
* @returns Handle with close() for graceful shutdown
|
|
30
|
+
*/
|
|
31
|
+
export declare function startHttpTransport(createMcpServerFn: () => McpServer | McpServerFactoryResult | Promise<McpServer | McpServerFactoryResult>, port?: number, host?: string, options?: {
|
|
32
|
+
healthCheck?: () => Promise<HealthStatus> | HealthStatus;
|
|
33
|
+
}): Promise<HttpTransportHandle>;
|
|
34
|
+
//# sourceMappingURL=http-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../../src/adapter/mcp/http-transport.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAKnE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAA;IACb,EAAE,EAAE,OAAO,CAAA;IACX,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,MAAM,MAAM,CAAA;CAC3B;AAED,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,SAAS,CAAA;IACjB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACjE;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,iBAAiB,EAAE,MAAM,SAAS,GAAG,sBAAsB,GAAG,OAAO,CAAC,SAAS,GAAG,sBAAsB,CAAC,EACzG,IAAI,GAAE,MAA4B,EAClC,IAAI,GAAE,MAAoB,EAC1B,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAA;CAAE,GACrE,OAAO,CAAC,mBAAmB,CAAC,CAqI9B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.startHttpTransport = startHttpTransport;
|
|
4
|
+
/**
|
|
5
|
+
* Multi-client HTTP transport for daemon mode.
|
|
6
|
+
*
|
|
7
|
+
* Uses MCP SDK's StreamableHTTPServerTransport. Each client connection gets
|
|
8
|
+
* its own transport + McpServer instance — a single transport does NOT
|
|
9
|
+
* support concurrent clients.
|
|
10
|
+
*
|
|
11
|
+
* Security: binds to 127.0.0.1 only (localhost). No authentication on HTTP
|
|
12
|
+
* endpoint — same trust model as stdio (any local process can connect).
|
|
13
|
+
*/
|
|
14
|
+
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
15
|
+
const node_http_1 = require("node:http");
|
|
16
|
+
const node_crypto_1 = require("node:crypto");
|
|
17
|
+
const constants_1 = require("../../config/constants");
|
|
18
|
+
/**
|
|
19
|
+
* Start HTTP transport for daemon mode.
|
|
20
|
+
*
|
|
21
|
+
* @param createMcpServerFn Factory that creates a new McpServer per session.
|
|
22
|
+
* Can return just an McpServer (backward compat) or { server, onClientInfo }.
|
|
23
|
+
* @param port Port to bind to (default: 3100)
|
|
24
|
+
* @param host Host to bind to (default: 127.0.0.1, localhost only for security)
|
|
25
|
+
* @returns Handle with close() for graceful shutdown
|
|
26
|
+
*/
|
|
27
|
+
async function startHttpTransport(createMcpServerFn, port = constants_1.DEFAULT_DAEMON_PORT, host = '127.0.0.1', options) {
|
|
28
|
+
const sessions = new Map();
|
|
29
|
+
const httpServer = (0, node_http_1.createServer)(async (req, res) => {
|
|
30
|
+
// Health endpoint
|
|
31
|
+
if (req.method === 'GET' && req.url === '/health') {
|
|
32
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
33
|
+
if (options?.healthCheck) {
|
|
34
|
+
try {
|
|
35
|
+
const extra = await options.healthCheck();
|
|
36
|
+
const allOk = extra.auth && extra.db;
|
|
37
|
+
res.end(JSON.stringify({ status: allOk ? 'ok' : 'degraded', sessions: sessions.size, ...extra }));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
res.end(JSON.stringify({ status: 'degraded', sessions: sessions.size, error: 'health check failed' }));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
res.end(JSON.stringify({ status: 'ok', sessions: sessions.size }));
|
|
45
|
+
}
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Only /mcp endpoint for MCP protocol
|
|
49
|
+
if (req.url !== '/mcp') {
|
|
50
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
51
|
+
res.end(JSON.stringify({ error: 'Not found' }));
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
// Extract session ID from header (MCP protocol)
|
|
55
|
+
const sessionId = req.headers['mcp-session-id'];
|
|
56
|
+
if (sessionId && sessions.has(sessionId)) {
|
|
57
|
+
// Existing session — route to its transport
|
|
58
|
+
const session = sessions.get(sessionId);
|
|
59
|
+
await session.transport.handleRequest(req, res);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
// New session — create transport + server instance
|
|
63
|
+
let transport;
|
|
64
|
+
try {
|
|
65
|
+
transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
66
|
+
sessionIdGenerator: () => (0, node_crypto_1.randomUUID)(),
|
|
67
|
+
});
|
|
68
|
+
const factoryResult = await Promise.resolve(createMcpServerFn());
|
|
69
|
+
// Unwrap factory result: support both plain McpServer and { server, onClientInfo }.
|
|
70
|
+
// Use duck-typing: a plain McpServer has .connect() directly; McpServerFactoryResult
|
|
71
|
+
// wraps it in .server. This works with both real instances and jest mock instances.
|
|
72
|
+
let mcpServer;
|
|
73
|
+
let onClientInfo;
|
|
74
|
+
if (typeof factoryResult.connect === 'function') {
|
|
75
|
+
mcpServer = factoryResult;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
mcpServer = factoryResult.server;
|
|
79
|
+
onClientInfo = factoryResult.onClientInfo;
|
|
80
|
+
}
|
|
81
|
+
// Track session cleanup
|
|
82
|
+
const t = transport;
|
|
83
|
+
t.onclose = () => {
|
|
84
|
+
const sid = t.sessionId;
|
|
85
|
+
if (sid)
|
|
86
|
+
sessions.delete(sid);
|
|
87
|
+
};
|
|
88
|
+
// Set up oninitialized BEFORE connect to capture clientInfo from MCP handshake
|
|
89
|
+
if (onClientInfo) {
|
|
90
|
+
mcpServer.server.oninitialized = () => {
|
|
91
|
+
const clientVersion = mcpServer.server.getClientVersion();
|
|
92
|
+
if (clientVersion) {
|
|
93
|
+
onClientInfo({ name: clientVersion.name, version: clientVersion.version });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
// Connect server to transport
|
|
98
|
+
await mcpServer.connect(transport);
|
|
99
|
+
// Handle the request (sessionId is set during handleRequest for POST init)
|
|
100
|
+
await transport.handleRequest(req, res);
|
|
101
|
+
// Store session after handleRequest (sessionId becomes available)
|
|
102
|
+
if (transport.sessionId) {
|
|
103
|
+
sessions.set(transport.sessionId, { transport, server: mcpServer });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
108
|
+
process.stderr.write(`[ERROR] Failed to create MCP session: ${message}\n`);
|
|
109
|
+
// Clean up transport if it was created before the error
|
|
110
|
+
if (transport) {
|
|
111
|
+
try {
|
|
112
|
+
transport.close?.();
|
|
113
|
+
}
|
|
114
|
+
catch { /* best-effort cleanup */ }
|
|
115
|
+
}
|
|
116
|
+
if (!res.headersSent) {
|
|
117
|
+
res.writeHead(500, { 'Content-Type': 'application/json' });
|
|
118
|
+
res.end(JSON.stringify({ error: 'Failed to create session' }));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
// Port conflict detection with clear error message
|
|
124
|
+
await new Promise((resolve, reject) => {
|
|
125
|
+
httpServer.on('error', (err) => {
|
|
126
|
+
if (err.code === 'EADDRINUSE') {
|
|
127
|
+
reject(new Error(`Port ${port} is already in use. Is another vess daemon running?`));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
reject(err);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
httpServer.listen(port, host, resolve);
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
port,
|
|
137
|
+
host,
|
|
138
|
+
sessionCount: () => sessions.size,
|
|
139
|
+
close: () => {
|
|
140
|
+
// Graceful shutdown: close all sessions first
|
|
141
|
+
for (const [, session] of sessions) {
|
|
142
|
+
session.transport.close?.();
|
|
143
|
+
}
|
|
144
|
+
sessions.clear();
|
|
145
|
+
// Force-close all keep-alive connections (Node 18.2+)
|
|
146
|
+
httpServer.closeAllConnections();
|
|
147
|
+
return new Promise((resolve, reject) => {
|
|
148
|
+
httpServer.close((err) => {
|
|
149
|
+
if (err)
|
|
150
|
+
reject(err);
|
|
151
|
+
else
|
|
152
|
+
resolve();
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=http-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.js","sourceRoot":"","sources":["../../../src/adapter/mcp/http-transport.ts"],"names":[],"mappings":";;AA6CA,gDA0IC;AAvLD;;;;;;;;;GASG;AACH,0FAAkG;AAElG,yCAAyE;AACzE,6CAAwC;AACxC,sDAA4D;AAsB5D;;;;;;;;GAQG;AACI,KAAK,UAAU,kBAAkB,CACtC,iBAAyG,EACzG,OAAe,+BAAmB,EAClC,OAAe,WAAW,EAC1B,OAAsE;IAEtE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAGpB,CAAA;IAEJ,MAAM,UAAU,GAAG,IAAA,wBAAY,EAAC,KAAK,EAAE,GAAoB,EAAE,GAAmB,EAAE,EAAE;QAClF,kBAAkB;QAClB,IAAI,GAAG,CAAC,MAAM,KAAK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AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ExecutionEngine } from '../../core/execution-engine';
|
|
2
|
+
import { MCPToolHandler } from './mcp-server.factory';
|
|
3
|
+
export declare class McpAdapter implements MCPToolHandler {
|
|
4
|
+
private readonly engine;
|
|
5
|
+
constructor(engine: ExecutionEngine);
|
|
6
|
+
callTool(args: {
|
|
7
|
+
tool: string;
|
|
8
|
+
action: string;
|
|
9
|
+
parameters?: Record<string, any>;
|
|
10
|
+
approval?: {
|
|
11
|
+
token: string;
|
|
12
|
+
choice: string;
|
|
13
|
+
vcTTLMinutes?: number;
|
|
14
|
+
};
|
|
15
|
+
pendingRequestId?: string;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
success: boolean;
|
|
18
|
+
data?: any;
|
|
19
|
+
error?: string;
|
|
20
|
+
approvalRequired?: any;
|
|
21
|
+
waitingForApproval?: any;
|
|
22
|
+
}>;
|
|
23
|
+
issueToolPermission(args: {
|
|
24
|
+
tool: string;
|
|
25
|
+
actions: string[];
|
|
26
|
+
}): Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
data?: any;
|
|
29
|
+
error?: string;
|
|
30
|
+
}>;
|
|
31
|
+
listAvailableTools(): Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
data?: any;
|
|
34
|
+
error?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=mcp-adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapter/mcp/mcp-adapter.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAGrD,qBAAa,UAAW,YAAW,cAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE9C,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