@the-ai-company/cbio-node-runtime 1.68.0 → 1.70.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.
Files changed (160) hide show
  1. package/README.md +40 -6
  2. package/dist/clients/owner/client.js +11 -2
  3. package/dist/clients/owner/client.js.map +1 -1
  4. package/dist/clients/owner/contracts.d.ts +4 -2
  5. package/dist/public-types.d.ts +2 -1
  6. package/dist/public-types.js.map +1 -1
  7. package/dist/runtime/index.d.ts +4 -2
  8. package/dist/runtime/index.js +1 -1
  9. package/dist/runtime/index.js.map +1 -1
  10. package/dist/vault-core/contracts.d.ts +49 -29
  11. package/dist/vault-core/contracts.js +0 -6
  12. package/dist/vault-core/contracts.js.map +1 -1
  13. package/dist/vault-core/core.d.ts +4 -5
  14. package/dist/vault-core/core.js +65 -37
  15. package/dist/vault-core/core.js.map +1 -1
  16. package/dist/vault-core/defaults.d.ts +8 -6
  17. package/dist/vault-core/defaults.js +98 -16
  18. package/dist/vault-core/defaults.js.map +1 -1
  19. package/dist/vault-core/index.d.ts +3 -3
  20. package/dist/vault-core/index.js +1 -1
  21. package/dist/vault-core/index.js.map +1 -1
  22. package/dist/vault-core/persistence.d.ts +34 -36
  23. package/dist/vault-core/persistence.js +268 -333
  24. package/dist/vault-core/persistence.js.map +1 -1
  25. package/dist/vault-core/ports.d.ts +5 -3
  26. package/dist/vault-ingress/defaults.d.ts +1 -1
  27. package/dist/vault-ingress/index.d.ts +2 -1
  28. package/dist/vault-ingress/index.js +5 -2
  29. package/dist/vault-ingress/index.js.map +1 -1
  30. package/dist/vault-ingress/server-utils.d.ts +30 -0
  31. package/dist/vault-ingress/server-utils.js +151 -0
  32. package/dist/vault-ingress/server-utils.js.map +1 -1
  33. package/docs/REFERENCE.md +4 -0
  34. package/docs/api/README.md +9 -3
  35. package/docs/api/classes/IdentityError.md +1 -1
  36. package/docs/api/classes/OwnerClientError.md +1 -1
  37. package/docs/api/classes/PersistentVaultAgentIdentityRegistry.md +5 -5
  38. package/docs/api/classes/PersistentVaultAgentSecretGrantRegistry.md +5 -5
  39. package/docs/api/classes/PersistentVaultAuditLog.md +29 -5
  40. package/docs/api/classes/PersistentVaultSecretCustody.md +5 -5
  41. package/docs/api/classes/PersistentVaultSecretDestinationGrantRegistry.md +5 -5
  42. package/docs/api/classes/PersistentVaultSecretRepository.md +5 -5
  43. package/docs/api/classes/VaultCore.md +10 -10
  44. package/docs/api/classes/VaultCoreError.md +1 -1
  45. package/docs/api/enumerations/AuditOperation.md +1 -37
  46. package/docs/api/enumerations/DispatchStatus.md +1 -1
  47. package/docs/api/enumerations/IdentityErrorCode.md +1 -1
  48. package/docs/api/enumerations/OwnerClientErrorCode.md +1 -1
  49. package/docs/api/functions/createAgentClient.md +1 -1
  50. package/docs/api/functions/createIdentity.md +1 -1
  51. package/docs/api/functions/createOwnerClient.md +1 -1
  52. package/docs/api/functions/createPersistentVaultCoreDependencies.md +1 -1
  53. package/docs/api/functions/createVault.md +1 -1
  54. package/docs/api/functions/createVaultCore.md +1 -1
  55. package/docs/api/functions/createVaultCoreDependencies.md +1 -1
  56. package/docs/api/functions/createVaultService.md +1 -1
  57. package/docs/api/functions/createWorkspaceStorage.md +1 -1
  58. package/docs/api/functions/deriveRootAgentId.md +1 -1
  59. package/docs/api/functions/deriveVaultWorkingKeyFromPassword.md +1 -1
  60. package/docs/api/functions/getDefaultWorkspaceDir.md +1 -1
  61. package/docs/api/functions/handleVaultAgentControlHttp.md +1 -1
  62. package/docs/api/functions/handleVaultAuditSse.md +30 -0
  63. package/docs/api/functions/handleVaultHttpDispatch.md +1 -1
  64. package/docs/api/functions/handleVaultPendingDispatchSse.md +30 -0
  65. package/docs/api/functions/initializeVaultCustody.md +1 -1
  66. package/docs/api/functions/listVaults.md +1 -1
  67. package/docs/api/functions/openOwnerSession.md +1 -1
  68. package/docs/api/functions/readVaultProfile.md +1 -1
  69. package/docs/api/functions/recoverVault.md +1 -1
  70. package/docs/api/functions/recoverVaultWorkingKey.md +1 -1
  71. package/docs/api/functions/restoreIdentity.md +1 -1
  72. package/docs/api/functions/updateVaultMetadata.md +1 -1
  73. package/docs/api/functions/writeVaultProfile.md +1 -1
  74. package/docs/api/interfaces/AgentClient.md +3 -3
  75. package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
  76. package/docs/api/interfaces/AgentDispatchTransport.md +3 -3
  77. package/docs/api/interfaces/AgentIdentity.md +1 -1
  78. package/docs/api/interfaces/AgentIdentityRecord.md +1 -1
  79. package/docs/api/interfaces/AgentRequestRecord.md +83 -0
  80. package/docs/api/interfaces/AgentRuntimeManifest.md +1 -1
  81. package/docs/api/interfaces/AgentSecretGrant.md +1 -1
  82. package/docs/api/interfaces/AgentSigner.md +1 -1
  83. package/docs/api/interfaces/AgentVisibleRequestRecord.md +1 -1
  84. package/docs/api/interfaces/AgentVisibleSecretRecord.md +1 -1
  85. package/docs/api/interfaces/AuditEntry.md +1 -1
  86. package/docs/api/interfaces/CbioRuntime.md +59 -1
  87. package/docs/api/interfaces/CreateAgentClientOptions.md +1 -1
  88. package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
  89. package/docs/api/interfaces/CreateOwnerClientOptions.md +1 -1
  90. package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
  91. package/docs/api/interfaces/CreateVaultOptions.md +1 -1
  92. package/docs/api/interfaces/CreatedVault.md +1 -1
  93. package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -23
  94. package/docs/api/interfaces/DispatchAuthorization.md +1 -1
  95. package/docs/api/interfaces/DispatchInstruction.md +1 -1
  96. package/docs/api/interfaces/DispatchRequest.md +1 -1
  97. package/docs/api/interfaces/DispatchResult.md +7 -1
  98. package/docs/api/interfaces/IStorageProvider.md +1 -1
  99. package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
  100. package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
  101. package/docs/api/interfaces/OpenOwnerSessionOptions.md +1 -1
  102. package/docs/api/interfaces/OwnerAgentProvisionResult.md +1 -1
  103. package/docs/api/interfaces/OwnerAuditSubscription.md +45 -0
  104. package/docs/api/interfaces/OwnerClient.md +20 -4
  105. package/docs/api/interfaces/OwnerCreateSecretInput.md +1 -1
  106. package/docs/api/interfaces/OwnerPendingDispatchSubscription.md +27 -0
  107. package/docs/api/interfaces/OwnerRemoveSecretInput.md +1 -1
  108. package/docs/api/interfaces/OwnerRequestRecord.md +7 -1
  109. package/docs/api/interfaces/OwnerSensitiveActionConfirmation.md +1 -1
  110. package/docs/api/interfaces/OwnerSensitiveActionContext.md +1 -1
  111. package/docs/api/interfaces/OwnerSession.md +1 -1
  112. package/docs/api/interfaces/OwnerUpdateSecretInput.md +9 -3
  113. package/docs/api/interfaces/OwnerVisibleRequestRecord.md +1 -1
  114. package/docs/api/interfaces/PendingDispatchEvent.md +23 -0
  115. package/docs/api/interfaces/RecoverVaultOptions.md +1 -1
  116. package/docs/api/interfaces/RecoveredVault.md +1 -1
  117. package/docs/api/interfaces/RequestRecord.md +21 -1
  118. package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
  119. package/docs/api/interfaces/SecretAlias.md +1 -1
  120. package/docs/api/interfaces/SecretDestinationGrant.md +1 -1
  121. package/docs/api/interfaces/SecretId.md +1 -1
  122. package/docs/api/interfaces/SecretRecord.md +1 -1
  123. package/docs/api/interfaces/Signer.md +1 -1
  124. package/docs/api/interfaces/VaultApproveDispatchInput.md +1 -1
  125. package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
  126. package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
  127. package/docs/api/interfaces/VaultCreateAgentInput.md +1 -1
  128. package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
  129. package/docs/api/interfaces/VaultGetRequestInput.md +1 -1
  130. package/docs/api/interfaces/VaultGrantAgentSecretInput.md +1 -1
  131. package/docs/api/interfaces/VaultGrantSecretDestinationInput.md +1 -1
  132. package/docs/api/interfaces/VaultId.md +1 -1
  133. package/docs/api/interfaces/VaultImportAgentInput.md +1 -1
  134. package/docs/api/interfaces/VaultIssueSessionTokenInput.md +1 -1
  135. package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
  136. package/docs/api/interfaces/VaultListGrantsInput.md +1 -1
  137. package/docs/api/interfaces/VaultListRequestsInput.md +1 -1
  138. package/docs/api/interfaces/VaultListSecretsInput.md +1 -1
  139. package/docs/api/interfaces/VaultMetadata.md +1 -1
  140. package/docs/api/interfaces/VaultObject.md +1 -1
  141. package/docs/api/interfaces/VaultPrincipal.md +1 -1
  142. package/docs/api/interfaces/VaultProfile.md +1 -1
  143. package/docs/api/interfaces/VaultReadAgentPrivateKeyInput.md +1 -1
  144. package/docs/api/interfaces/VaultReadSecretPlaintextInput.md +1 -1
  145. package/docs/api/interfaces/VaultRevokeAgentSecretInput.md +1 -1
  146. package/docs/api/interfaces/VaultRevokeSecretDestinationInput.md +1 -1
  147. package/docs/api/interfaces/VaultRevokeSessionTokenInput.md +1 -1
  148. package/docs/api/interfaces/VaultService.md +22 -6
  149. package/docs/api/interfaces/VaultUpdateAgentInput.md +1 -1
  150. package/docs/api/type-aliases/AgentId.md +1 -1
  151. package/docs/api/type-aliases/AgentRequestResult.md +7 -0
  152. package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
  153. package/docs/api/type-aliases/DispatchApprovalDecision.md +1 -1
  154. package/docs/api/type-aliases/GrantStatus.md +1 -1
  155. package/docs/api/type-aliases/SecretLifecycleStatus.md +1 -1
  156. package/docs/api/type-aliases/VaultPrincipalKind.md +2 -2
  157. package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
  158. package/docs/zh/README.md +11 -3
  159. package/package.json +5 -3
  160. package/docs/api/interfaces/AgentRequestResult.md +0 -35
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -30,7 +30,7 @@
30
30
 
31
31
  ### agentGetRequest()
32
32
 
33
- > **agentGetRequest**(`request`): `Promise`\<[`AgentRequestResult`](AgentRequestResult.md)\>
33
+ > **agentGetRequest**(`request`): `Promise`\<[`AgentRequestRecord`](AgentRequestRecord.md)\>
34
34
 
35
35
  #### Parameters
36
36
 
@@ -40,7 +40,7 @@
40
40
 
41
41
  #### Returns
42
42
 
43
- `Promise`\<[`AgentRequestResult`](AgentRequestResult.md)\>
43
+ `Promise`\<[`AgentRequestRecord`](AgentRequestRecord.md)\>
44
44
 
45
45
  ***
46
46
 
@@ -342,15 +342,31 @@
342
342
 
343
343
  ***
344
344
 
345
+ ### ownerOnAudit()
346
+
347
+ > **ownerOnAudit**(`subscription`): () => `void`
348
+
349
+ #### Parameters
350
+
351
+ ##### subscription
352
+
353
+ [`OwnerAuditSubscription`](OwnerAuditSubscription.md)
354
+
355
+ #### Returns
356
+
357
+ () => `void`
358
+
359
+ ***
360
+
345
361
  ### ownerOnPendingDispatch()
346
362
 
347
- > **ownerOnPendingDispatch**(`callback`): () => `void`
363
+ > **ownerOnPendingDispatch**(`subscription`): () => `void`
348
364
 
349
365
  #### Parameters
350
366
 
351
- ##### callback
367
+ ##### subscription
352
368
 
353
- (`record`) => `void`
369
+ [`OwnerPendingDispatchSubscription`](OwnerPendingDispatchSubscription.md)
354
370
 
355
371
  #### Returns
356
372
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -0,0 +1,7 @@
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
+
3
+ ***
4
+
5
+ # Type Alias: AgentRequestResult
6
+
7
+ > **AgentRequestResult** = [`AgentRequestRecord`](../interfaces/AgentRequestRecord.md)
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
@@ -1,7 +1,7 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
5
5
  # Type Alias: VaultPrincipalKind
6
6
 
7
- > **VaultPrincipalKind** = `"owner"` \| `"trusted_issuer"` \| `"agent"` \| `"trusted_executor"`
7
+ > **VaultPrincipalKind** = `"owner"` \| `"agent"`
@@ -1,4 +1,4 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
1
+ [**CBIO Node Runtime Agent API v1.70.1**](../README.md)
2
2
 
3
3
  ***
4
4
 
package/docs/zh/README.md CHANGED
@@ -153,15 +153,23 @@ console.log(manifest.grants.agentSecrets); // 已获得的机密授权
153
153
  如果 Agent 尝试的请求未获授权,`agentDispatch` 会返回 `AWAITING_APPROVAL` 状态,进入人工审批流。
154
154
 
155
155
  ```ts
156
+ const unsubscribe = client.ownerOnPendingDispatch({
157
+ onEvent: (event) => {
158
+ console.log("pending dispatch", event.event_id, event.record.request_id);
159
+ },
160
+ });
161
+
156
162
  // 审批待处理的请求
157
- const pending = await client.ownerListRequests({ rootAgentId });
163
+ const pending = await client.ownerListRequests({ root_agent_id: rootAgentId });
158
164
  if (pending.length > 0) {
159
165
  await client.ownerApproveDispatch({
160
- requestId: pending[0].requestId,
161
- decision: 'allow_and_grant' // 允许执行并自动补齐缺少的授权
166
+ request_id: pending[0].request_id,
167
+ decision: "allow_and_grant", // 允许执行并自动补齐缺少的授权
162
168
  });
163
169
  }
164
170
 
171
+ unsubscribe();
172
+
165
173
  // 查看语义化审计日志
166
174
  const logs = await client.ownerReadAudit({
167
175
  action: 'APPROVE_DISPATCH' // 使用业务感知的语义化动作进行查询
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-ai-company/cbio-node-runtime",
3
- "version": "1.68.0",
3
+ "version": "1.70.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,7 +23,8 @@
23
23
  }
24
24
  },
25
25
  "dependencies": {
26
- "@the-ai-company/cbio-protocol": "^1.0.3"
26
+ "@the-ai-company/cbio-protocol": "^1.0.5",
27
+ "better-sqlite3": "^11.0.0"
27
28
  },
28
29
  "scripts": {
29
30
  "build": "tsc",
@@ -32,7 +33,7 @@
32
33
  "prepare": "npm run build && npm run build:docs",
33
34
  "test": "npm run build && npm run test:types && npm run test:acceptance",
34
35
  "test:types": "tsc -p tsconfig.type-tests.json --noEmit",
35
- "test:acceptance": "node tests/smoke/runtime-surface.js && node tests/smoke/policy-and-persistence.js && node tests/smoke/persistent-runtime-security.js && node tests/smoke/replay-guard.js && node tests/smoke/security-guards.js && node tests/smoke/audit-root-agent-activity.js"
36
+ "test:acceptance": "node tests/smoke/runtime-surface.js && node tests/smoke/policy-and-persistence.js && node tests/smoke/persistent-runtime-security.js && node tests/smoke/replay-guard.js && node tests/smoke/security-guards.js && node tests/smoke/audit-root-agent-activity.js && node tests/smoke/pending-dispatch-subscription.js && node tests/smoke/pending-dispatch-sse.js && node tests/smoke/audit-stream-sse.js"
36
37
  },
37
38
  "keywords": [
38
39
  "claw-biometric",
@@ -46,6 +47,7 @@
46
47
  "license": "MIT",
47
48
  "repository": "https://github.com/TheAICompany/cbio-node-runtime",
48
49
  "devDependencies": {
50
+ "@types/better-sqlite3": "^7.6.10",
49
51
  "@types/node": "^20.0.0",
50
52
  "standard-version": "^9.5.0",
51
53
  "typedoc": "^0.28.18",
@@ -1,35 +0,0 @@
1
- [**CBIO Node Runtime Agent API v1.68.0**](../README.md)
2
-
3
- ***
4
-
5
- # Interface: AgentRequestResult
6
-
7
- ## Properties
8
-
9
- ### error?
10
-
11
- > `optional` **error?**: `string`
12
-
13
- ***
14
-
15
- ### execution\_status
16
-
17
- > **execution\_status**: [`DispatchStatus`](../enumerations/DispatchStatus.md)
18
-
19
- ***
20
-
21
- ### request\_id
22
-
23
- > **request\_id**: `string`
24
-
25
- ***
26
-
27
- ### response\_body?
28
-
29
- > `optional` **response\_body?**: `string`
30
-
31
- ***
32
-
33
- ### response\_status?
34
-
35
- > `optional` **response\_status?**: `number`