@the-ai-company/cbio-node-runtime 1.15.0 → 1.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -29
- package/dist/clients/agent/client.d.ts +12 -2
- package/dist/clients/agent/client.js +37 -3
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/agent/contracts.d.ts +1 -20
- package/dist/clients/agent/index.d.ts +1 -1
- package/dist/clients/owner/client.d.ts +12 -4
- package/dist/clients/owner/client.js +90 -4
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +10 -0
- package/dist/clients/owner/index.d.ts +2 -2
- package/dist/runtime/bootstrap.js +8 -2
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/index.d.ts +6 -11
- package/dist/runtime/index.js +4 -9
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/private-vault.js +1 -1
- package/dist/runtime/private-vault.js.map +1 -1
- package/dist/storage/prefix.d.ts +14 -0
- package/dist/storage/prefix.js +42 -0
- package/dist/storage/prefix.js.map +1 -0
- package/dist/vault-core/contracts.d.ts +12 -1
- package/dist/vault-core/core.d.ts +2 -1
- package/dist/vault-core/core.js +37 -1
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +2 -0
- package/dist/vault-core/defaults.js +41 -1
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/index.d.ts +1 -1
- package/dist/vault-core/ports.d.ts +4 -1
- package/dist/vault-ingress/defaults.d.ts +1 -2
- package/dist/vault-ingress/defaults.js +2 -4
- package/dist/vault-ingress/defaults.js.map +1 -1
- package/dist/vault-ingress/index.d.ts +1 -0
- package/dist/vault-ingress/index.js +3 -0
- package/dist/vault-ingress/index.js.map +1 -1
- package/docs/REFERENCE.md +45 -49
- package/package.json +1 -1
package/docs/REFERENCE.md
CHANGED
|
@@ -6,17 +6,15 @@ This file is intentionally narrower: it documents what the shipped API does toda
|
|
|
6
6
|
|
|
7
7
|
## Public Surface
|
|
8
8
|
|
|
9
|
-
The current top-level
|
|
9
|
+
The current top-level surface centers on:
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
- identity creation and recovery
|
|
12
|
+
- persistent vault bootstrap and recovery
|
|
13
|
+
- owner and agent clients
|
|
14
|
+
- owner flow-boundary helpers
|
|
15
15
|
|
|
16
16
|
The main constructors are:
|
|
17
17
|
|
|
18
|
-
- `createVaultCore(...)`
|
|
19
|
-
- `createVaultService(...)`
|
|
20
18
|
- `createIdentity(...)`
|
|
21
19
|
- `createChildIdentity(...)`
|
|
22
20
|
- `deriveChildIdentity(...)`
|
|
@@ -26,7 +24,6 @@ The main constructors are:
|
|
|
26
24
|
- `recoverVault(...)`
|
|
27
25
|
- `createVaultClient(...)`
|
|
28
26
|
- `createAgentClient(...)`
|
|
29
|
-
- `LocalVaultTransport`
|
|
30
27
|
|
|
31
28
|
Related design note:
|
|
32
29
|
|
|
@@ -37,12 +34,7 @@ Recommended persistent-vault entrypoints:
|
|
|
37
34
|
- `createVault(...)`
|
|
38
35
|
- `recoverVault(...)`
|
|
39
36
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
- `initializeVaultCustody(...)`
|
|
43
|
-
- `recoverVaultWorkingKey(...)`
|
|
44
|
-
|
|
45
|
-
`createVault({ ownerIdentity, nickname })` creates a vault in the default workspace and persists `nickname` into `vault/profile.json`.
|
|
37
|
+
`createVault({ ownerIdentity, nickname })` creates a vault in the default workspace and persists `nickname` into `vaults/<vaultId>/vault/profile.json`.
|
|
46
38
|
|
|
47
39
|
`createVault(storage, { ownerIdentity, nickname })` overrides the workspace storage explicitly.
|
|
48
40
|
|
|
@@ -84,7 +76,7 @@ Role rules:
|
|
|
84
76
|
|
|
85
77
|
`deriveChildIdentity(parentIdentity, childIndex, { nickname })` deterministically reconstructs a child identity for a known `childIndex`.
|
|
86
78
|
|
|
87
|
-
`ensurePrivateVault(storage, identity)` creates or refreshes the identity's fixed
|
|
79
|
+
`ensurePrivateVault(storage, identity)` creates or refreshes the identity's fixed namespace under `identities/<identityId>/...`. That namespace stores identity-level files such as:
|
|
88
80
|
|
|
89
81
|
- `profile.json`
|
|
90
82
|
- `children.json`
|
|
@@ -116,41 +108,14 @@ The runtime does not claim to understand arbitrary network protocols. The API co
|
|
|
116
108
|
- unsupported: mixed bidirectional-secret flows as a first-class surface
|
|
117
109
|
- unsupported: no-secret operations as a first-class vault primitive
|
|
118
110
|
|
|
119
|
-
## Vault Service
|
|
120
|
-
|
|
121
|
-
`vault-ingress` is the request-shaped boundary around the vault kernel.
|
|
122
|
-
|
|
123
|
-
Important methods:
|
|
124
|
-
|
|
125
|
-
- `bootstrapOwnerIdentity(...)`
|
|
126
|
-
- `registerAgent(...)`
|
|
127
|
-
- `writeSecret(...)`
|
|
128
|
-
- `exportSecret(...)`
|
|
129
|
-
- `acquireSecret(...)`
|
|
130
|
-
- `dispatch(...)`
|
|
131
|
-
- `handleAgentDispatch(...)`
|
|
132
|
-
- `readAudit(...)`
|
|
133
|
-
|
|
134
|
-
### Owner Bootstrap
|
|
135
|
-
|
|
136
|
-
The very first owner is bootstrapped explicitly:
|
|
137
|
-
|
|
138
|
-
```ts
|
|
139
|
-
await vault.bootstrapOwnerIdentity({
|
|
140
|
-
vaultId: vault.vaultId,
|
|
141
|
-
ownerId: 'owner-1',
|
|
142
|
-
publicKey: ownerPublicKey,
|
|
143
|
-
});
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
The runtime treats this first owner as the single vault admin. Additional principals should be modeled as agents plus capabilities rather than extra owners.
|
|
147
|
-
|
|
148
111
|
## Vault Client
|
|
149
112
|
|
|
150
|
-
`clients/owner`
|
|
113
|
+
`clients/owner` implements the public vault-management client surface for the identity currently bound to the vault's single admin role.
|
|
151
114
|
|
|
152
115
|
Current management operations:
|
|
153
116
|
|
|
117
|
+
- `storeSecret(...)`
|
|
118
|
+
- `defineSecretTargets(...)`
|
|
154
119
|
- `writeSecret(...)`
|
|
155
120
|
- `exportSecret(...)`
|
|
156
121
|
- `readAudit(...)`
|
|
@@ -161,7 +126,24 @@ Current management operations:
|
|
|
161
126
|
Example:
|
|
162
127
|
|
|
163
128
|
```ts
|
|
164
|
-
const client = createVaultClient({
|
|
129
|
+
const client = createVaultClient({ ownerIdentity, vault });
|
|
130
|
+
|
|
131
|
+
const storedSecret = await client.storeSecret({
|
|
132
|
+
alias: 'api-token',
|
|
133
|
+
plaintext: 'secret-value',
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await client.defineSecretTargets({
|
|
137
|
+
alias: storedSecret.alias.value,
|
|
138
|
+
targetBindings: [
|
|
139
|
+
{
|
|
140
|
+
kind: 'site',
|
|
141
|
+
targetId: 'api.example.com',
|
|
142
|
+
targetUrl: 'https://api.example.com/endpoint',
|
|
143
|
+
methods: ['POST'],
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
});
|
|
165
147
|
|
|
166
148
|
await client.registerAgent({
|
|
167
149
|
agentId: 'agent-1',
|
|
@@ -177,7 +159,7 @@ await client.registerFlow({
|
|
|
177
159
|
});
|
|
178
160
|
|
|
179
161
|
await client.writeSecret({
|
|
180
|
-
alias: '
|
|
162
|
+
alias: 'secondary-token',
|
|
181
163
|
plaintext: 'secret-value',
|
|
182
164
|
targetBindings: [
|
|
183
165
|
{
|
|
@@ -194,6 +176,8 @@ const exportedSecret = await client.exportSecret({
|
|
|
194
176
|
});
|
|
195
177
|
```
|
|
196
178
|
|
|
179
|
+
`writeSecret(...)` is the one-step variant and requires `targetBindings`.
|
|
180
|
+
|
|
197
181
|
## Agent Client
|
|
198
182
|
|
|
199
183
|
`clients/agent` creates signed dispatch requests for an identity currently bound to an agent role in that vault. It never receives plaintext secrets.
|
|
@@ -220,7 +204,7 @@ Example:
|
|
|
220
204
|
const capability = {
|
|
221
205
|
vaultId: vault.vaultId,
|
|
222
206
|
capabilityId: 'cap-1',
|
|
223
|
-
agentId:
|
|
207
|
+
agentId: agentIdentity.identityId,
|
|
224
208
|
secretAliases: ['api-token'],
|
|
225
209
|
operation: 'dispatch_http',
|
|
226
210
|
allowedTargets: ['https://api.example.com/endpoint'],
|
|
@@ -231,13 +215,15 @@ const capability = {
|
|
|
231
215
|
await client.grantCapability({ capability });
|
|
232
216
|
```
|
|
233
217
|
|
|
218
|
+
The public agent capability type is the same shape as core `AgentCapability`, so `custom_http` capabilities are valid here too.
|
|
219
|
+
|
|
234
220
|
Custom capability example:
|
|
235
221
|
|
|
236
222
|
```ts
|
|
237
223
|
const customCapability = {
|
|
238
224
|
vaultId: vault.vaultId,
|
|
239
225
|
capabilityId: 'cap-custom',
|
|
240
|
-
agentId:
|
|
226
|
+
agentId: agentIdentity.identityId,
|
|
241
227
|
customFlowId: 'custom-status-read',
|
|
242
228
|
secretAliases: ['api-token'],
|
|
243
229
|
operation: 'custom_http',
|
|
@@ -249,6 +235,16 @@ const customCapability = {
|
|
|
249
235
|
await client.grantCapability({ capability: customCapability });
|
|
250
236
|
```
|
|
251
237
|
|
|
238
|
+
Recommended agent client shape:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
const agent = createAgentClient({
|
|
242
|
+
agentIdentity,
|
|
243
|
+
capability,
|
|
244
|
+
vault,
|
|
245
|
+
});
|
|
246
|
+
```
|
|
247
|
+
|
|
252
248
|
## Acquisition Result Shape
|
|
253
249
|
|
|
254
250
|
`acquireSecret(...)` is the explicit acquisition operation.
|
package/package.json
CHANGED