@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.
Files changed (38) hide show
  1. package/README.md +34 -29
  2. package/dist/clients/agent/client.d.ts +12 -2
  3. package/dist/clients/agent/client.js +37 -3
  4. package/dist/clients/agent/client.js.map +1 -1
  5. package/dist/clients/agent/contracts.d.ts +1 -20
  6. package/dist/clients/agent/index.d.ts +1 -1
  7. package/dist/clients/owner/client.d.ts +12 -4
  8. package/dist/clients/owner/client.js +90 -4
  9. package/dist/clients/owner/client.js.map +1 -1
  10. package/dist/clients/owner/contracts.d.ts +10 -0
  11. package/dist/clients/owner/index.d.ts +2 -2
  12. package/dist/runtime/bootstrap.js +8 -2
  13. package/dist/runtime/bootstrap.js.map +1 -1
  14. package/dist/runtime/index.d.ts +6 -11
  15. package/dist/runtime/index.js +4 -9
  16. package/dist/runtime/index.js.map +1 -1
  17. package/dist/runtime/private-vault.js +1 -1
  18. package/dist/runtime/private-vault.js.map +1 -1
  19. package/dist/storage/prefix.d.ts +14 -0
  20. package/dist/storage/prefix.js +42 -0
  21. package/dist/storage/prefix.js.map +1 -0
  22. package/dist/vault-core/contracts.d.ts +12 -1
  23. package/dist/vault-core/core.d.ts +2 -1
  24. package/dist/vault-core/core.js +37 -1
  25. package/dist/vault-core/core.js.map +1 -1
  26. package/dist/vault-core/defaults.d.ts +2 -0
  27. package/dist/vault-core/defaults.js +41 -1
  28. package/dist/vault-core/defaults.js.map +1 -1
  29. package/dist/vault-core/index.d.ts +1 -1
  30. package/dist/vault-core/ports.d.ts +4 -1
  31. package/dist/vault-ingress/defaults.d.ts +1 -2
  32. package/dist/vault-ingress/defaults.js +2 -4
  33. package/dist/vault-ingress/defaults.js.map +1 -1
  34. package/dist/vault-ingress/index.d.ts +1 -0
  35. package/dist/vault-ingress/index.js +3 -0
  36. package/dist/vault-ingress/index.js.map +1 -1
  37. package/docs/REFERENCE.md +45 -49
  38. 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 modules are:
9
+ The current top-level surface centers on:
10
10
 
11
- - `vault-core`
12
- - `vault-ingress`
13
- - `clients/owner`
14
- - `clients/agent`
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
- Lower-level custody helpers:
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 private-vault namespace. The private vault stores identity-level files such as:
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` currently implements the public vault-management client surface for the identity currently bound to the vault's single admin role.
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({ identityId: ownerIdentity.identityId }, vault, ownerSigner, clock);
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: 'api-token',
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: 'agent-1',
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: 'agent-1',
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-ai-company/cbio-node-runtime",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Node.js runtime for cbio identity and credential vault. Library only, no CLI or TUI.",
5
5
  "type": "module",
6
6
  "main": "./dist/runtime/index.js",