@the-ai-company/cbio-node-runtime 1.47.0 → 1.48.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/README.md +104 -231
- package/dist/clients/agent/client.d.ts +1 -0
- package/dist/clients/agent/client.js +26 -9
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/owner/client.js +57 -2
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +44 -1
- package/dist/vault-core/contracts.d.ts +58 -5
- package/dist/vault-core/contracts.js +8 -0
- package/dist/vault-core/contracts.js.map +1 -1
- package/dist/vault-core/core.d.ts +16 -2
- package/dist/vault-core/core.js +115 -1
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +25 -3
- package/dist/vault-core/defaults.js +71 -16
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/errors.d.ts +2 -2
- package/dist/vault-core/errors.js.map +1 -1
- package/dist/vault-core/index.d.ts +3 -3
- package/dist/vault-core/index.js +1 -1
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.js +7 -2
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +13 -0
- package/dist/vault-ingress/index.d.ts +17 -2
- package/dist/vault-ingress/index.js +17 -0
- package/dist/vault-ingress/index.js.map +1 -1
- package/dist/vault-ingress/remote-transport.js +4 -1
- package/dist/vault-ingress/remote-transport.js.map +1 -1
- package/docs/ARCHITECTURE.md +34 -107
- package/docs/CUSTODY_MODEL.md +27 -129
- package/docs/IDENTITY_MODEL.md +35 -112
- package/docs/REFERENCE.md +60 -404
- package/docs/api/README.md +2 -2
- package/docs/api/classes/IdentityError.md +1 -1
- package/docs/api/classes/VaultCore.md +97 -1
- package/docs/api/classes/VaultCoreError.md +3 -3
- package/docs/api/enumerations/IdentityErrorCode.md +1 -1
- package/docs/api/functions/createAgentClient.md +1 -1
- package/docs/api/functions/createIdentity.md +1 -1
- package/docs/api/functions/createOwnerHttpFlowBoundary.md +1 -1
- package/docs/api/functions/createPersistentVaultCoreDependencies.md +1 -1
- package/docs/api/functions/createStandardAcquireBoundary.md +1 -1
- package/docs/api/functions/createStandardDispatchBoundary.md +1 -1
- package/docs/api/functions/createVault.md +1 -1
- package/docs/api/functions/createVaultClient.md +1 -1
- package/docs/api/functions/createVaultCore.md +1 -1
- package/docs/api/functions/createVaultCoreDependencies.md +1 -1
- package/docs/api/functions/createVaultService.md +1 -1
- package/docs/api/functions/createWorkspaceStorage.md +1 -1
- package/docs/api/functions/deriveIdentityId.md +1 -1
- package/docs/api/functions/deriveVaultWorkingKeyFromPassword.md +1 -1
- package/docs/api/functions/getDefaultWorkspaceDir.md +1 -1
- package/docs/api/functions/handleVaultHttpDispatch.md +1 -1
- package/docs/api/functions/initializeVaultCustody.md +1 -1
- package/docs/api/functions/listVaults.md +1 -1
- package/docs/api/functions/readVaultProfile.md +1 -1
- package/docs/api/functions/recoverVault.md +1 -1
- package/docs/api/functions/recoverVaultWorkingKey.md +1 -1
- package/docs/api/functions/restoreIdentity.md +1 -1
- package/docs/api/functions/updateVaultMetadata.md +1 -1
- package/docs/api/functions/wrapVaultCoreAsVaultService.md +1 -1
- package/docs/api/functions/writeVaultProfile.md +1 -1
- package/docs/api/interfaces/AgentClient.md +1 -1
- package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
- package/docs/api/interfaces/AgentDispatchTransport.md +1 -1
- package/docs/api/interfaces/AgentIdentity.md +1 -1
- package/docs/api/interfaces/AgentSigner.md +1 -1
- package/docs/api/interfaces/CbioRuntime.md +1 -1
- package/docs/api/interfaces/CreateAgentClientOptions.md +7 -1
- package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
- package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +31 -1
- package/docs/api/interfaces/CreateVaultClientOptions.md +1 -1
- package/docs/api/interfaces/CreateVaultOptions.md +31 -1
- package/docs/api/interfaces/CreatedVault.md +1 -1
- package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -1
- package/docs/api/interfaces/IStorageProvider.md +1 -1
- package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
- package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
- package/docs/api/interfaces/OwnerDefineSecretTargetsInput.md +1 -1
- package/docs/api/interfaces/OwnerSecretTargetBinding.md +1 -1
- package/docs/api/interfaces/OwnerStoreSecretInput.md +1 -1
- package/docs/api/interfaces/OwnerWriteSecretInput.md +1 -1
- package/docs/api/interfaces/RecoverVaultOptions.md +31 -1
- package/docs/api/interfaces/RecoveredVault.md +1 -1
- package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
- package/docs/api/interfaces/Signer.md +1 -1
- package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
- package/docs/api/interfaces/VaultClient.md +1 -1
- package/docs/api/interfaces/VaultCoreDependenciesOptions.md +19 -1
- package/docs/api/interfaces/VaultCreateAgentInput.md +1 -1
- package/docs/api/interfaces/VaultDeleteSecretInput.md +1 -1
- package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
- package/docs/api/interfaces/VaultGrantCapabilityInput.md +71 -3
- package/docs/api/interfaces/VaultIdentity.md +1 -1
- package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
- package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
- package/docs/api/interfaces/VaultMetadata.md +1 -1
- package/docs/api/interfaces/VaultObject.md +1 -1
- package/docs/api/interfaces/VaultProfile.md +1 -1
- package/docs/api/interfaces/VaultRegisterAgentInput.md +1 -1
- package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
- package/docs/api/interfaces/VaultSigner.md +1 -1
- package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
- package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
- package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
- package/docs/zh/README.md +64 -39
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,19 @@
|
|
|
1
1
|
# cbio Vault Runtime
|
|
2
2
|
|
|
3
|
-
Node.js vault runtime with a
|
|
3
|
+
Node.js vault runtime with a **Sovereign Vault** architecture: authority is rooted in a master password, and agent identities are fully managed within the vault's encrypted storage.
|
|
4
4
|
|
|
5
5
|
**Source:** [https://github.com/TheAICompany/cbio-node-runtime](https://github.com/TheAICompany/cbio-node-runtime)
|
|
6
6
|
|
|
7
|
-
## Documentation / 文档 / ドキュメント / 문서 / Docs
|
|
8
|
-
|
|
9
|
-
- [English](README.md)
|
|
10
|
-
- [Custody Model](docs/CUSTODY_MODEL.md)
|
|
11
|
-
- [Identity Model](docs/IDENTITY_MODEL.md)
|
|
12
|
-
- [Process Isolation (A/B Architecture)](docs/PROCESS_ISOLATION.md)
|
|
13
|
-
- [中文](docs/zh/README.md)
|
|
14
|
-
- [日本語](docs/ja/README.md)
|
|
15
|
-
- [한국어](docs/ko/README.md)
|
|
16
|
-
- [Español](docs/es/README.md)
|
|
17
|
-
- [Português](docs/pt/README.md)
|
|
18
|
-
- [Français](docs/fr/README.md)
|
|
19
|
-
|
|
20
7
|
---
|
|
21
8
|
|
|
22
|
-
|
|
23
|
-
- No TUI
|
|
9
|
+
## Key Features
|
|
24
10
|
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
11
|
+
- **No CLI / No TUI**: Pure library for integration into Node.js applications.
|
|
12
|
+
- **Authority-centric**: Administrative control is tied to the vault's master password, not an external identity.
|
|
13
|
+
- **Managed Agent Custody**: Generate and store agent private keys securely inside the vault.
|
|
14
|
+
- **Agent Session Tokens**: Issue revocable, short-lived (or long-lived) tokens for agents to avoid handling raw private keys.
|
|
15
|
+
- **Process Isolation**: Hard separation between the Security Process (Master) and Agent Processes (Consumers).
|
|
16
|
+
- **Zero-Leak Discovery**: Vault metadata is fully encrypted and hidden until unlocked.
|
|
30
17
|
|
|
31
18
|
## Install
|
|
32
19
|
|
|
@@ -38,267 +25,153 @@ npm install @the-ai-company/cbio-node-runtime
|
|
|
38
25
|
|
|
39
26
|
## Usage
|
|
40
27
|
|
|
41
|
-
|
|
42
|
-
import {
|
|
43
|
-
createChildIdentity,
|
|
44
|
-
createIdentity,
|
|
45
|
-
createWorkspaceStorage,
|
|
46
|
-
ensureIdentityPrivateVault,
|
|
47
|
-
readIdentityPrivateVaultProfile,
|
|
48
|
-
readIdentityPrivateVaultChildrenState,
|
|
49
|
-
restoreIdentity,
|
|
50
|
-
createVault,
|
|
51
|
-
recoverVault,
|
|
52
|
-
createOwnerHttpFlowBoundary,
|
|
53
|
-
createStandardAcquireBoundary,
|
|
54
|
-
createVaultClient,
|
|
55
|
-
createAgentClient,
|
|
56
|
-
FsStorageProvider,
|
|
57
|
-
} from '@the-ai-company/cbio-node-runtime';
|
|
58
|
-
```
|
|
28
|
+
### 1. Bootstrap a New Vault
|
|
59
29
|
|
|
60
|
-
|
|
30
|
+
The Sovereign Vault requires only a storage provider and a master password.
|
|
61
31
|
|
|
62
32
|
```ts
|
|
63
|
-
|
|
64
|
-
|
|
33
|
+
import {
|
|
34
|
+
createVault,
|
|
35
|
+
FsStorageProvider,
|
|
36
|
+
createWorkspaceStorage
|
|
37
|
+
} from '@the-ai-company/cbio-node-runtime';
|
|
65
38
|
|
|
66
|
-
|
|
39
|
+
const storage = new FsStorageProvider('./my-vaults');
|
|
67
40
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
nickname: 'worker-1',
|
|
41
|
+
const myVault = await createVault(storage, {
|
|
42
|
+
vaultId: 'main-vault',
|
|
43
|
+
password: 'your-secure-password',
|
|
44
|
+
nickname: 'Production Vault'
|
|
73
45
|
});
|
|
74
46
|
|
|
75
|
-
|
|
76
|
-
const identities = await listIdentities(storage);
|
|
77
|
-
const vaults = await listVaults(storage);
|
|
78
|
-
|
|
79
|
-
const profile = await readIdentityMetadata(storage, identities[0].identityId); // Public Discovery
|
|
80
|
-
const fullProfile = await readIdentityMetadata(storage, rootIdentity.identityId, rootIdentity.privateKey); // Full Authorized Profile
|
|
81
|
-
const children = await readIdentityPrivateVaultChildrenState(storage, rootIdentity.privateKey);
|
|
47
|
+
console.log(`Vault created: ${myVault.nickname}`);
|
|
82
48
|
```
|
|
83
49
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
import { type VaultPublicMetadata } from '@the-ai-company/cbio-node-runtime';
|
|
88
|
-
|
|
89
|
-
const publicMetadata: VaultPublicMetadata = {
|
|
90
|
-
displayName: 'Primary Vault',
|
|
91
|
-
tags: ['production', 'main'],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const createdVault = await createVault({
|
|
95
|
-
ownerIdentity: rootIdentity,
|
|
96
|
-
nickname: 'main-vault',
|
|
97
|
-
publicMetadata,
|
|
98
|
-
});
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
If you want to override the default workspace directory:
|
|
50
|
+
### 2. Recover an Existing Vault
|
|
102
51
|
|
|
103
52
|
```ts
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
53
|
+
import { recoverVault, FsStorageProvider } from '@the-ai-company/cbio-node-runtime';
|
|
54
|
+
|
|
55
|
+
const vault = await recoverVault(storage, {
|
|
56
|
+
vaultId: 'main-vault',
|
|
57
|
+
password: 'your-secure-password'
|
|
108
58
|
});
|
|
109
59
|
```
|
|
110
60
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
By default, the SDK uses a local directory (e.g., `~/cbio/`) as the **Workspace Root**.
|
|
114
|
-
- `createVault({ ... })`: Automatically creates a sub-directory `vaults/<vault-id>/` and returns a **Prefixed Storage** anchored to that sub-directory.
|
|
115
|
-
- **Important**: When you receive a `storage` object from `createVault`, it is already pointing *inside* the vault's own space. Subsequent calls to `recoverVault` or other high-level APIs using this storage will resolve paths correctly relative to this anchor.
|
|
116
|
-
|
|
117
|
-
### CRUD & Metadata
|
|
118
|
-
The SDK provides a complete lifecycle for vaults and secrets:
|
|
119
|
-
1. **Creation**: `createVault`
|
|
120
|
-
2. **Discovery/Read**: `listVaults`, `recoverVault`
|
|
121
|
-
3. **Update**: `updateVaultMetadata` (e.g., for nicknames)
|
|
122
|
-
4. **Management**: `listAgents`, `listCapabilities`, `revokeCapability` (via Client)
|
|
123
|
-
5. **Deletion**: `deleteSecret` (via Client) or manual storage cleanup for entire vaults.
|
|
124
|
-
|
|
125
|
-
and `vault/public/` (signed discovery).
|
|
126
|
-
|
|
127
|
-
Every identity also has its own private namespace for encrypted metadata, and a companion discovery area for public information.
|
|
128
|
-
|
|
129
|
-
## Architecture
|
|
130
|
-
|
|
131
|
-
Core terms:
|
|
132
|
-
|
|
133
|
-
- `identity`
|
|
134
|
-
An external principal represented by a public/private keypair.
|
|
135
|
-
- `owner`
|
|
136
|
-
The single admin role that a vault binds to one identity.
|
|
137
|
-
- `agent`
|
|
138
|
-
A delegated role that a vault binds to an identity registered by the owner.
|
|
139
|
-
|
|
140
|
-
Important role rule:
|
|
141
|
-
|
|
142
|
-
- outside the vault there are only identities
|
|
143
|
-
- inside a specific vault, those identities may be bound to roles such as `owner` or `agent`
|
|
144
|
-
- root identities are independent
|
|
145
|
-
- child identities may be deterministically derived from a parent identity
|
|
146
|
-
|
|
147
|
-
The public runtime surface follows four hard rules:
|
|
148
|
-
|
|
149
|
-
1. Secret plaintext lives only in vault core.
|
|
150
|
-
2. Only owner and vault-trusted acquisition paths may write secrets.
|
|
151
|
-
3. Secrets are dispatched only to owner-approved or issuer-bound targets.
|
|
152
|
-
4. Vault validates and audits everything.
|
|
153
|
-
|
|
154
|
-
The current HTTP-facing interface distinguishes two supported secret-flow classes:
|
|
155
|
-
|
|
156
|
-
- `A` / `acquire_secret`
|
|
157
|
-
No secret leaves the vault. A secret is extracted from the response and stored into the vault. Agent-visible output includes only protocol metadata plus a redacted response shape.
|
|
158
|
-
- `B` / `send_secret`
|
|
159
|
-
A stored secret is sent to an owner-approved target. The response is treated as normal business output and may be returned to the agent.
|
|
61
|
+
### 3. Managed Agent Identities
|
|
160
62
|
|
|
161
|
-
|
|
63
|
+
You can generate and register agents directly within the vault. The vault holds the private keys for full custody.
|
|
162
64
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
The vault does not attempt to second-guess every remote protocol. If a target returns sensitive data during a normal dispatch flow, that is part of the target contract and the owner's authorization decision.
|
|
167
|
-
|
|
168
|
-
The runtime does not claim to understand arbitrary remote protocols. The API boundary makes clear what is supported:
|
|
169
|
-
|
|
170
|
-
- acquisition is explicit and redacted
|
|
171
|
-
- secret-backed dispatch is explicit and capability-gated
|
|
172
|
-
- unsupported `C` / `D` style flows are not part of the current surface
|
|
173
|
-
|
|
174
|
-
Owner-defined HTTP boundaries share one factory layer:
|
|
175
|
-
|
|
176
|
-
- `createOwnerHttpFlowBoundary(...)`
|
|
177
|
-
- `createStandardAcquireBoundary(...)`
|
|
178
|
-
- `createStandardDispatchBoundary(...)`
|
|
179
|
-
|
|
180
|
-
An owner-defined exception path also exists for non-standard but intentional integrations:
|
|
181
|
-
|
|
182
|
-
- owner may register a `custom_http` flow
|
|
183
|
-
- the flow fixes mode, target, method, and response visibility inside the vault
|
|
184
|
-
- agent may only invoke the registered `customFlowId`
|
|
185
|
-
- this is an explicit escape hatch, not the default path
|
|
65
|
+
```ts
|
|
66
|
+
import { createVaultClient } from '@the-ai-company/cbio-node-runtime';
|
|
186
67
|
|
|
187
|
-
|
|
68
|
+
const client = createVaultClient({ vault: vault.vault });
|
|
188
69
|
|
|
189
|
-
|
|
190
|
-
|
|
70
|
+
// Generate and register a new agent in one step
|
|
71
|
+
const [agentRecord, agentPrivateKey] = await client.createAgent({
|
|
72
|
+
agentId: 'worker-1',
|
|
73
|
+
nickname: 'Background Worker'
|
|
74
|
+
});
|
|
191
75
|
|
|
192
|
-
|
|
76
|
+
console.log(`Agent public key: ${agentRecord.publicKey}`);
|
|
77
|
+
// Private key is returned during creation and stored securely in the vault.
|
|
193
78
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
const client = createVaultClient({ ownerIdentity, vault: createdVault.vault });
|
|
199
|
-
const agent = createAgentClient({ agentIdentity, capability, vault: createdVault.vault });
|
|
79
|
+
// 4. Issue a Session Token (Optional but Recommended)
|
|
80
|
+
// Avoid passing the raw private key to agent processes.
|
|
81
|
+
const session = await client.issueSessionToken({ agentId: 'worker-1' });
|
|
82
|
+
console.log(`Session Token: ${session.token}`);
|
|
200
83
|
```
|
|
201
84
|
|
|
202
|
-
|
|
85
|
+
### 5. Secret Management (Owner)
|
|
203
86
|
|
|
204
87
|
```ts
|
|
205
|
-
|
|
88
|
+
// Write a secret and bind it to a target site
|
|
89
|
+
const record = await client.writeSecret({
|
|
206
90
|
alias: 'api-token',
|
|
207
|
-
plaintext: 'secret-value',
|
|
91
|
+
plaintext: 'super-secret-value',
|
|
92
|
+
targetBindings: [{
|
|
93
|
+
kind: 'site',
|
|
94
|
+
targetId: 'my-api',
|
|
95
|
+
targetUrl: 'https://api.example.com/endpoint',
|
|
96
|
+
methods: ['POST']
|
|
97
|
+
}]
|
|
208
98
|
});
|
|
209
99
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
targetUrl: 'https://api.example.com/endpoint',
|
|
217
|
-
methods: ['POST'],
|
|
218
|
-
},
|
|
219
|
-
],
|
|
100
|
+
// 4. Grant agent capabilities (Simplified Flattened API)
|
|
101
|
+
await client.grantCapability({
|
|
102
|
+
agentId: 'worker-1',
|
|
103
|
+
secretAliases: ['api-token'],
|
|
104
|
+
allowedTargets: ['https://api.example.com/*'],
|
|
105
|
+
requiresApproval: true // Enable Human-in-the-Loop
|
|
220
106
|
});
|
|
221
107
|
```
|
|
222
108
|
|
|
223
|
-
|
|
109
|
+
### 6. Consuming Secrets (Agent)
|
|
224
110
|
|
|
225
|
-
|
|
111
|
+
Agents run in isolated processes and communicate with the vault via a transport. They can use either a **Session Token** (recommended) or a **Signature** (raw private key).
|
|
226
112
|
|
|
113
|
+
#### Using a Session Token (Stateless/Token-based)
|
|
227
114
|
```ts
|
|
228
|
-
|
|
229
|
-
vaultId: vault.vaultId,
|
|
230
|
-
capabilityId: 'cap-1',
|
|
231
|
-
agentId: agentIdentity.identityId,
|
|
232
|
-
secretAliases: ['api-token'],
|
|
233
|
-
operation: 'dispatch_http',
|
|
234
|
-
allowedTargets: ['https://api.example.com/endpoint'],
|
|
235
|
-
allowedMethods: ['POST'],
|
|
236
|
-
issuedAt: new Date().toISOString(),
|
|
237
|
-
};
|
|
115
|
+
import { createAgentClient } from '@the-ai-company/cbio-node-runtime';
|
|
238
116
|
|
|
239
|
-
|
|
240
|
-
|
|
117
|
+
const agent = createAgentClient({
|
|
118
|
+
agentIdentity: { agentId: 'worker-1' },
|
|
119
|
+
capability: myCapability,
|
|
120
|
+
token: session.token, // Issued by the owner
|
|
121
|
+
vault: vault.vault
|
|
122
|
+
});
|
|
241
123
|
|
|
242
|
-
|
|
124
|
+
const result = await agent.dispatch({ ... });
|
|
125
|
+
```
|
|
243
126
|
|
|
127
|
+
#### Using a Signature (Stateful/Key-based)
|
|
244
128
|
```ts
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
}),
|
|
129
|
+
import { createAgentClient, LocalSigner } from '@the-ai-company/cbio-node-runtime';
|
|
130
|
+
|
|
131
|
+
const agent = createAgentClient({
|
|
132
|
+
agentIdentity: { agentId: 'worker-1' },
|
|
133
|
+
capability: myCapability,
|
|
134
|
+
signer: new LocalSigner({ privateKey: agentPrivateKey }),
|
|
135
|
+
vault: vault.vault
|
|
253
136
|
});
|
|
254
137
|
```
|
|
255
138
|
|
|
256
|
-
|
|
139
|
+
---
|
|
257
140
|
|
|
258
|
-
|
|
259
|
-
const acquireBoundary = createStandardAcquireBoundary({
|
|
260
|
-
targetUrl: 'https://issuer.example.com/token',
|
|
261
|
-
responseField: 'access_token',
|
|
262
|
-
storeAlias: 'issuer-token',
|
|
263
|
-
});
|
|
141
|
+
## Documentation
|
|
264
142
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
issuerId: 'issuer-1',
|
|
268
|
-
url: acquireBoundary.targetUrl,
|
|
269
|
-
flow: 'oauth_token_response.access_token',
|
|
270
|
-
method: acquireBoundary.method,
|
|
271
|
-
});
|
|
143
|
+
- [Custody Model](docs/CUSTODY_MODEL.md) - Understanding managed agency and key storage.
|
|
144
|
+
- [Process Isolation](docs/PROCESS_ISOLATION.md) - Guidelines for A/B architecture.
|
|
272
145
|
|
|
273
|
-
|
|
274
|
-
// { token_type: 'Bearer', expires_in: 3600, scope: 'read write' }
|
|
146
|
+
## Architecture Rules
|
|
275
147
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
148
|
+
1. **Secret Isolation**: Plane-text secrets never leave the Security Process.
|
|
149
|
+
2. **Authority Root**: The master password is the only source of administrative authority.
|
|
150
|
+
3. **Auditability**: Every administrative and agent action is recorded in the vault's audit log under the `vault-master` or agent principal.
|
|
151
|
+
4. **Binary Discovery**: Either the vault is unlocked and visible, or it is a silent directory of encrypted shards.
|
|
279
152
|
|
|
280
|
-
|
|
281
|
-
```
|
|
153
|
+
### Human-in-the-Loop (HITL) Workflow
|
|
282
154
|
|
|
283
|
-
|
|
155
|
+
If a capability is granted with `requiresApproval: true`, the agent's dispatch will be paused until an owner approves it:
|
|
284
156
|
|
|
285
157
|
```ts
|
|
286
|
-
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
158
|
+
// In Agent process
|
|
159
|
+
const result = await agent.dispatch({ ... });
|
|
160
|
+
if (result.status === 'PENDING') {
|
|
161
|
+
console.log("Waiting for owner approval...");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// In Owner process (GUI or Script)
|
|
165
|
+
const pending = await client.listPendingDispatches();
|
|
166
|
+
if (pending.length > 0) {
|
|
167
|
+
// Inspect and approve the request
|
|
168
|
+
await client.approveDispatch(pending[0].requestId);
|
|
169
|
+
}
|
|
297
170
|
```
|
|
298
171
|
|
|
299
|
-
## Build
|
|
172
|
+
## Build & Test
|
|
300
173
|
|
|
301
174
|
```bash
|
|
302
175
|
npm run build
|
|
303
|
-
npm
|
|
176
|
+
npm test
|
|
304
177
|
```
|
|
@@ -19,17 +19,29 @@ class DefaultAgentClient {
|
|
|
19
19
|
_signer;
|
|
20
20
|
_transport;
|
|
21
21
|
_clock;
|
|
22
|
-
|
|
22
|
+
_token;
|
|
23
|
+
constructor(_identity, _capability, _signer, _transport, _clock, _token) {
|
|
23
24
|
this._identity = _identity;
|
|
24
25
|
this._capability = _capability;
|
|
25
26
|
this._signer = _signer;
|
|
26
27
|
this._transport = _transport;
|
|
27
28
|
this._clock = _clock;
|
|
29
|
+
this._token = _token;
|
|
28
30
|
}
|
|
29
31
|
async dispatch(intent) {
|
|
30
32
|
const requestedAt = intent.requestedAt ?? this._clock.nowIso();
|
|
31
33
|
const requestId = `${this._identity.agentId}:${requestedAt}:${intent.secretAlias ?? "no-secret"}:${intent.method}`;
|
|
32
|
-
|
|
34
|
+
let signature;
|
|
35
|
+
if (this._token) {
|
|
36
|
+
// Use token-based authentication
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
// Use signature-based authentication
|
|
40
|
+
if (!this._signer) {
|
|
41
|
+
throw new Error("AgentClient: signer required for signature-based authentication when no token is provided");
|
|
42
|
+
}
|
|
43
|
+
signature = await this._signer.sign(createDispatchBinding(requestId, requestedAt, this._identity.agentId, this._capability.capabilityId, intent.secretAlias, intent.targetUrl, intent.method, intent.body));
|
|
44
|
+
}
|
|
33
45
|
return this._transport.dispatch({
|
|
34
46
|
vaultId: this._capability.vaultId,
|
|
35
47
|
requestId,
|
|
@@ -53,10 +65,12 @@ class DefaultAgentClient {
|
|
|
53
65
|
revocationVersion: this._capability.revocationVersion,
|
|
54
66
|
rateLimit: this._capability.rateLimit,
|
|
55
67
|
auditRequired: this._capability.auditRequired,
|
|
68
|
+
requiresApproval: this._capability.requiresApproval,
|
|
56
69
|
},
|
|
57
70
|
proof: {
|
|
58
71
|
agentId: this._identity.agentId,
|
|
59
72
|
signature,
|
|
73
|
+
token: this._token,
|
|
60
74
|
requestId,
|
|
61
75
|
requestedAt,
|
|
62
76
|
},
|
|
@@ -74,14 +88,17 @@ function isCreateAgentClientOptions(value) {
|
|
|
74
88
|
function isCreatedIdentity(value) {
|
|
75
89
|
return "privateKey" in value && "publicKey" in value;
|
|
76
90
|
}
|
|
77
|
-
function resolveAgentSigner(
|
|
78
|
-
if (signer) {
|
|
79
|
-
return signer;
|
|
91
|
+
function resolveAgentSigner(options) {
|
|
92
|
+
if (options.signer) {
|
|
93
|
+
return options.signer;
|
|
80
94
|
}
|
|
81
|
-
if (isCreatedIdentity(
|
|
82
|
-
return new LocalSigner(
|
|
95
|
+
if (isCreatedIdentity(options.agentIdentity)) {
|
|
96
|
+
return new LocalSigner(options.agentIdentity);
|
|
83
97
|
}
|
|
84
|
-
|
|
98
|
+
if (options.token) {
|
|
99
|
+
return undefined; // No signer needed if token is present
|
|
100
|
+
}
|
|
101
|
+
throw new Error("createAgentClient() requires signer or private key when no session token is provided");
|
|
85
102
|
}
|
|
86
103
|
function resolveAgentIdentity(options) {
|
|
87
104
|
return "agentId" in options.agentIdentity
|
|
@@ -116,6 +133,6 @@ export function createAgentClient(options) {
|
|
|
116
133
|
if (!isCreateAgentClientOptions(options)) {
|
|
117
134
|
throw new Error("createAgentClient() requires a single options object");
|
|
118
135
|
}
|
|
119
|
-
return new DefaultAgentClient(resolveAgentIdentity(options), options.capability, resolveAgentSigner(options
|
|
136
|
+
return new DefaultAgentClient(resolveAgentIdentity(options), options.capability, resolveAgentSigner(options), resolveAgentTransport(options), options.clock ?? new SystemClock(), options.token);
|
|
120
137
|
}
|
|
121
138
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/agent/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/agent/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AA+CtE,SAAS,qBAAqB,CAC5B,SAAiB,EACjB,WAAmB,EACnB,OAAe,EACf,YAAoB,EACpB,WAA+B,EAC/B,SAAiB,EACjB,MAAc,EACd,IAAa;IAEb,OAAO,IAAI,CAAC,SAAS,CAAC;QACpB,SAAS;QACT,WAAW;QACX,OAAO;QACP,YAAY;QACZ,WAAW,EAAE,WAAW,IAAI,IAAI;QAChC,SAAS;QACT,MAAM;QACN,IAAI,EAAE,IAAI,IAAI,IAAI;KACnB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,kBAAkB;IAEH;IACA;IACA;IACA;IACA;IACA;IANnB,YACmB,SAAwB,EACxB,WAAoC,EACpC,OAAgC,EAChC,UAAkC,EAClC,MAAa,EACb,MAAe;QALf,cAAS,GAAT,SAAS,CAAe;QACxB,gBAAW,GAAX,WAAW,CAAyB;QACpC,YAAO,GAAP,OAAO,CAAyB;QAChC,eAAU,GAAV,UAAU,CAAwB;QAClC,WAAM,GAAN,MA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C3B,qBAAqB,CAAC,OAAO,CAAC,EAC9B,OAAO,CAAC,KAAK,IAAI,IAAI,WAAW,EAAE,EAClC,OAAO,CAAC,KAAK,CACd,CAAC;AACJ,CAAC"}
|
|
@@ -131,10 +131,21 @@ class DefaultVaultClient {
|
|
|
131
131
|
}
|
|
132
132
|
async grantCapability(input) {
|
|
133
133
|
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
134
|
-
const
|
|
134
|
+
const capabilityId = input.capabilityId ?? `cap_${crypto.randomUUID()}`;
|
|
135
|
+
const requestId = `${this._identityId}:${requestedAt}:${capabilityId}:register_capability`;
|
|
135
136
|
const capability = {
|
|
136
|
-
...input.capability,
|
|
137
137
|
vaultId: this._vault.vaultId,
|
|
138
|
+
agentId: input.agentId,
|
|
139
|
+
capabilityId,
|
|
140
|
+
operation: input.operation ?? "dispatch_http",
|
|
141
|
+
secretAliases: input.secretAliases ? [...input.secretAliases] : [],
|
|
142
|
+
allowedTargets: input.allowedTargets ? [...input.allowedTargets] : [],
|
|
143
|
+
allowedMethods: input.allowedMethods ? [...input.allowedMethods] : [],
|
|
144
|
+
allowedPaths: input.allowedPaths ? [...input.allowedPaths] : [],
|
|
145
|
+
rateLimit: input.rateLimit,
|
|
146
|
+
auditRequired: input.auditRequired,
|
|
147
|
+
requiresApproval: input.requiresApproval,
|
|
148
|
+
issuedAt: requestedAt,
|
|
138
149
|
};
|
|
139
150
|
await this._vault.registerCapability({
|
|
140
151
|
vaultId: this._vault.vaultId,
|
|
@@ -225,6 +236,50 @@ class DefaultVaultClient {
|
|
|
225
236
|
capabilityId: input.capabilityId,
|
|
226
237
|
});
|
|
227
238
|
}
|
|
239
|
+
async issueSessionToken(input) {
|
|
240
|
+
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
241
|
+
const requestId = `${this._identityId}:${requestedAt}:issue_session_token`;
|
|
242
|
+
return this._vault.issueSessionToken({
|
|
243
|
+
vaultId: this._vault.vaultId,
|
|
244
|
+
actor: {
|
|
245
|
+
kind: "owner",
|
|
246
|
+
id: this._identityId,
|
|
247
|
+
},
|
|
248
|
+
agentId: input.agentId,
|
|
249
|
+
requestId,
|
|
250
|
+
requestedAt,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
async revokeSessionToken(input) {
|
|
254
|
+
return this._vault.revokeSessionToken({
|
|
255
|
+
vaultId: this._vault.vaultId,
|
|
256
|
+
actor: {
|
|
257
|
+
kind: "owner",
|
|
258
|
+
id: this._identityId,
|
|
259
|
+
},
|
|
260
|
+
token: input.token,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
async listPendingDispatches() {
|
|
264
|
+
return this._vault.listPendingDispatches({
|
|
265
|
+
vaultId: this._vault.vaultId,
|
|
266
|
+
owner: { kind: "owner", id: this._identityId },
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
async approveDispatch(requestId) {
|
|
270
|
+
return this._vault.approveDispatch({
|
|
271
|
+
vaultId: this._vault.vaultId,
|
|
272
|
+
requestId,
|
|
273
|
+
owner: { kind: "owner", id: this._identityId },
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
async rejectDispatch(requestId) {
|
|
277
|
+
return this._vault.rejectDispatch({
|
|
278
|
+
vaultId: this._vault.vaultId,
|
|
279
|
+
requestId,
|
|
280
|
+
owner: { kind: "owner", id: this._identityId },
|
|
281
|
+
});
|
|
282
|
+
}
|
|
228
283
|
}
|
|
229
284
|
function isCreateVaultClientOptions(value) {
|
|
230
285
|
return typeof value === "object" && value !== null && "vault" in value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/owner/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAwB,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"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