@the-ai-company/cbio-node-runtime 1.63.5 → 1.63.6

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 (155) hide show
  1. package/dist/clients/owner/client.js +3 -37
  2. package/dist/clients/owner/client.js.map +1 -1
  3. package/dist/clients/owner/contracts.d.ts +2 -7
  4. package/dist/clients/owner/index.d.ts +1 -1
  5. package/dist/public-types.d.ts +1 -1
  6. package/dist/runtime/bootstrap.d.ts +1 -3
  7. package/dist/runtime/index.d.ts +3 -3
  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 +8 -42
  11. package/dist/vault-core/contracts.js +3 -3
  12. package/dist/vault-core/contracts.js.map +1 -1
  13. package/dist/vault-core/core.d.ts +4 -12
  14. package/dist/vault-core/core.js +60 -40
  15. package/dist/vault-core/core.js.map +1 -1
  16. package/dist/vault-core/defaults.d.ts +4 -10
  17. package/dist/vault-core/defaults.js +8 -21
  18. package/dist/vault-core/defaults.js.map +1 -1
  19. package/dist/vault-core/errors.d.ts +1 -1
  20. package/dist/vault-core/errors.js.map +1 -1
  21. package/dist/vault-core/index.d.ts +4 -4
  22. package/dist/vault-core/index.js +2 -2
  23. package/dist/vault-core/index.js.map +1 -1
  24. package/dist/vault-core/persistence.d.ts +4 -11
  25. package/dist/vault-core/persistence.js +7 -32
  26. package/dist/vault-core/persistence.js.map +1 -1
  27. package/dist/vault-core/ports.d.ts +3 -9
  28. package/dist/vault-ingress/index.d.ts +1 -7
  29. package/dist/vault-ingress/index.js +2 -5
  30. package/dist/vault-ingress/index.js.map +1 -1
  31. package/docs/MIGRATION-1.65.md +28 -2
  32. package/docs/api/README.md +2 -5
  33. package/docs/api/classes/IdentityError.md +1 -1
  34. package/docs/api/classes/OwnerClientError.md +1 -1
  35. package/docs/api/classes/PersistentVaultAgentIdentityRegistry.md +1 -1
  36. package/docs/api/classes/PersistentVaultAgentSecretGrantRegistry.md +1 -1
  37. package/docs/api/classes/PersistentVaultAuditLog.md +1 -1
  38. package/docs/api/classes/PersistentVaultSecretCustody.md +1 -1
  39. package/docs/api/classes/PersistentVaultSecretDestinationGrantRegistry.md +5 -5
  40. package/docs/api/classes/PersistentVaultSecretRepository.md +1 -1
  41. package/docs/api/classes/VaultCore.md +7 -65
  42. package/docs/api/classes/VaultCoreError.md +1 -1
  43. package/docs/api/enumerations/AuditAction.md +19 -19
  44. package/docs/api/enumerations/AuditOutcome.md +1 -1
  45. package/docs/api/enumerations/DispatchStatus.md +1 -1
  46. package/docs/api/enumerations/IdentityErrorCode.md +1 -1
  47. package/docs/api/enumerations/OwnerClientErrorCode.md +1 -1
  48. package/docs/api/functions/createAgentClient.md +1 -1
  49. package/docs/api/functions/createIdentity.md +1 -1
  50. package/docs/api/functions/createOwnerClient.md +1 -1
  51. package/docs/api/functions/createOwnerSession.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 -5
  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/handleVaultHttpDispatch.md +1 -1
  63. package/docs/api/functions/initializeVaultCustody.md +1 -1
  64. package/docs/api/functions/listVaults.md +1 -1
  65. package/docs/api/functions/readVaultProfile.md +1 -1
  66. package/docs/api/functions/recoverVault.md +1 -1
  67. package/docs/api/functions/recoverVaultWorkingKey.md +1 -1
  68. package/docs/api/functions/restoreIdentity.md +1 -1
  69. package/docs/api/functions/updateVaultMetadata.md +1 -1
  70. package/docs/api/functions/writeVaultProfile.md +1 -1
  71. package/docs/api/interfaces/AgentClient.md +1 -1
  72. package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
  73. package/docs/api/interfaces/AgentDispatchTransport.md +1 -1
  74. package/docs/api/interfaces/AgentIdentity.md +1 -1
  75. package/docs/api/interfaces/AgentIdentityRecord.md +1 -1
  76. package/docs/api/interfaces/AgentRequestResult.md +1 -1
  77. package/docs/api/interfaces/AgentRuntimeManifest.md +1 -1
  78. package/docs/api/interfaces/AgentSecretGrant.md +1 -1
  79. package/docs/api/interfaces/AgentSigner.md +1 -1
  80. package/docs/api/interfaces/AgentVisibleRequestRecord.md +1 -1
  81. package/docs/api/interfaces/AgentVisibleSecretRecord.md +1 -1
  82. package/docs/api/interfaces/AuditEntry.md +7 -7
  83. package/docs/api/interfaces/CbioRuntime.md +1 -5
  84. package/docs/api/interfaces/CreateAgentClientOptions.md +1 -1
  85. package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
  86. package/docs/api/interfaces/CreateOwnerClientOptions.md +1 -1
  87. package/docs/api/interfaces/CreateOwnerSessionOptions.md +1 -5
  88. package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
  89. package/docs/api/interfaces/CreateVaultOptions.md +1 -5
  90. package/docs/api/interfaces/CreatedVault.md +1 -1
  91. package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -1
  92. package/docs/api/interfaces/DispatchAuthorization.md +1 -1
  93. package/docs/api/interfaces/DispatchInstruction.md +1 -1
  94. package/docs/api/interfaces/DispatchRequest.md +1 -1
  95. package/docs/api/interfaces/DispatchResult.md +1 -1
  96. package/docs/api/interfaces/IStorageProvider.md +1 -1
  97. package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
  98. package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
  99. package/docs/api/interfaces/OwnerAgentProvisionResult.md +1 -1
  100. package/docs/api/interfaces/OwnerClient.md +1 -17
  101. package/docs/api/interfaces/OwnerCreateSecretInput.md +1 -1
  102. package/docs/api/interfaces/OwnerRemoveSecretInput.md +1 -1
  103. package/docs/api/interfaces/OwnerRequestRecord.md +1 -1
  104. package/docs/api/interfaces/OwnerSensitiveActionConfirmation.md +1 -1
  105. package/docs/api/interfaces/OwnerSensitiveActionContext.md +1 -1
  106. package/docs/api/interfaces/OwnerSession.md +1 -1
  107. package/docs/api/interfaces/OwnerUpdateSecretInput.md +1 -1
  108. package/docs/api/interfaces/OwnerVisibleRequestRecord.md +1 -1
  109. package/docs/api/interfaces/RecoverVaultOptions.md +1 -5
  110. package/docs/api/interfaces/RecoveredVault.md +1 -1
  111. package/docs/api/interfaces/RequestRecord.md +1 -1
  112. package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
  113. package/docs/api/interfaces/SecretAlias.md +1 -1
  114. package/docs/api/interfaces/SecretDestinationGrant.md +7 -7
  115. package/docs/api/interfaces/SecretId.md +1 -1
  116. package/docs/api/interfaces/SecretRecord.md +1 -1
  117. package/docs/api/interfaces/Signer.md +1 -1
  118. package/docs/api/interfaces/VaultApproveDispatchInput.md +1 -1
  119. package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
  120. package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
  121. package/docs/api/interfaces/VaultCreateAgentInput.md +1 -1
  122. package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
  123. package/docs/api/interfaces/VaultGetRequestInput.md +1 -1
  124. package/docs/api/interfaces/VaultGrantAgentSecretInput.md +1 -1
  125. package/docs/api/interfaces/VaultGrantSecretDestinationInput.md +7 -7
  126. package/docs/api/interfaces/VaultId.md +1 -1
  127. package/docs/api/interfaces/VaultImportAgentInput.md +1 -1
  128. package/docs/api/interfaces/VaultIssueSessionTokenInput.md +1 -1
  129. package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
  130. package/docs/api/interfaces/VaultListGrantsInput.md +1 -1
  131. package/docs/api/interfaces/VaultListRequestsInput.md +1 -1
  132. package/docs/api/interfaces/VaultListSecretsInput.md +1 -1
  133. package/docs/api/interfaces/VaultMetadata.md +1 -1
  134. package/docs/api/interfaces/VaultObject.md +1 -1
  135. package/docs/api/interfaces/VaultPrincipal.md +1 -1
  136. package/docs/api/interfaces/VaultProfile.md +1 -1
  137. package/docs/api/interfaces/VaultReadAgentPrivateKeyInput.md +1 -1
  138. package/docs/api/interfaces/VaultReadSecretPlaintextInput.md +1 -1
  139. package/docs/api/interfaces/VaultRevokeAgentSecretInput.md +1 -1
  140. package/docs/api/interfaces/VaultRevokeSecretDestinationInput.md +7 -7
  141. package/docs/api/interfaces/VaultRevokeSessionTokenInput.md +1 -1
  142. package/docs/api/interfaces/VaultService.md +1 -37
  143. package/docs/api/interfaces/VaultUpdateAgentInput.md +1 -1
  144. package/docs/api/type-aliases/AgentId.md +1 -1
  145. package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
  146. package/docs/api/type-aliases/DispatchApprovalDecision.md +1 -1
  147. package/docs/api/type-aliases/GrantStatus.md +1 -1
  148. package/docs/api/type-aliases/SecretLifecycleStatus.md +1 -1
  149. package/docs/api/type-aliases/VaultPrincipalKind.md +1 -1
  150. package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
  151. package/docs/zh/README.md +31 -46
  152. package/package.json +1 -1
  153. package/docs/api/classes/PersistentVaultCustomHttpFlowRegistry.md +0 -69
  154. package/docs/api/interfaces/CustomHttpFlowDefinition.md +0 -71
  155. package/docs/api/interfaces/VaultRegisterFlowInput.md +0 -77
package/docs/zh/README.md CHANGED
@@ -92,26 +92,33 @@ const rootAgentId = createdAgent.agent.rootAgentId;
92
92
  const sessionToken = createdAgent.sessionToken;
93
93
  ```
94
94
 
95
- ### 5. 机密管理
95
+ ### 5. 机密与授权管理(Grant Model)
96
+
97
+ v1.65+ 采用了简化的 **Grant(授权)** 模型,通过白名单控制访问:
96
98
 
97
99
  ```ts
100
+ // 1. 创建机密
98
101
  const record = await client.ownerCreateSecret({
99
102
  alias: 'api-token',
100
103
  plaintext: 'secret-value'
101
104
  });
102
105
 
106
+ // 2. 授权 Agent 使用该机密
103
107
  await client.ownerGrantAgentSecret({
104
108
  rootAgentId,
105
109
  secretAlias: 'api-token',
106
110
  });
107
111
 
112
+ // 3. 授权该机密可发送至的目标域名
108
113
  await client.ownerGrantSecretDestination({
109
114
  secretAlias: 'api-token',
110
115
  domain: 'api.example.com',
111
116
  });
112
117
  ```
113
118
 
114
- ### 6. Agent 消费机密
119
+ ### 6. Agent 消费机密与自省
120
+
121
+ Agent 使用 `AgentClient` 进行操作,支持 **零配置(Zero-Configuration)** 自省:
115
122
 
116
123
  ```ts
117
124
  import { createAgentClient } from '@the-ai-company/cbio-node-runtime';
@@ -122,66 +129,44 @@ const agent = createAgentClient({
122
129
  vault: vault.vault
123
130
  });
124
131
 
125
- const result = await agent.agentDispatch({ ... });
126
- const requests = await agent.agentListRequests();
127
- const request = await agent.agentGetRequest(result.requestId);
128
- const ownerView = await client.ownerGetRequest({ requestId: result.requestId });
129
- ```
130
-
131
- Agent 进程不会直接使用原始私钥执行请求。即使 Agent 拥有身份材料,也应先换取 session token,再进行 dispatch。
132
-
133
- 给 LLM 的直白规则:
134
- - `agentDispatch(...)` = 立刻尝试执行真实任务
135
- - `agentDispatch(...)` 必须带一条给 owner 看的 `reason`,说明为什么要发这个请求
136
- - `agentSubmitGrantRequest(...)` = 只申请权限,不会执行任务
137
- - `agentSubmitGrantRequest(...)` 也必须带 `reason`,说明为什么需要这项权限
138
- - `agentListRequests()` / `agentGetRequest(...)` = 在请求执行后查看异步结果
139
- - `ownerListRequests()` / `ownerGetRequest(...)` = owner 查看完整请求记录,用于决定是否放行 read
140
- - `read.paths` 只控制哪些响应值可见;响应结构始终可见,`['$']` 表示整个 body 都可见
141
-
142
- ```ts
143
- const manifest = await agent.agentIntrospect();
132
+ // 执行机密驱动的请求
133
+ const result = await agent.agentDispatch({
134
+ targetUrl: 'https://api.example.com/data',
135
+ method: 'POST',
136
+ reason: '同步业务数据'
137
+ });
144
138
 
145
- console.log(manifest.agent.rootAgentId);
146
- console.log(manifest.agent.rootAgentId);
139
+ // 自省:查看自己的身份、权限和可用工具
140
+ const manifest = await agent.agentGetRuntimeManifest();
147
141
  console.log(manifest.agent.nickname);
148
- console.log(manifest.capabilities); // 同一组能力载体里包含 write/read 动作状态
142
+ console.log(manifest.grants.agentSecrets); // 已获得的机密授权
149
143
  ```
150
144
 
151
- `agentListCapabilities()` 返回能力载体视图,`agentListRequests()` / `agentGetRequest()` 则负责暴露请求历史和按权限裁剪后的结果。
145
+ ### 7. 人机协同(HITL)与语义化审计
152
146
 
153
- ### 7. 人机协同(HITL)工作流
154
-
155
- 如果 Agent 尝试执行的动作不在白名单内,dispatch 会返回 `PENDING`,同时运行时会写入一条能力载体记录,其 `write` 动作等待 Owner 审批。
147
+ 如果 Agent 尝试的请求未获授权,`agentDispatch` 会返回 `PENDING` 状态,进入人工审批流。
156
148
 
157
149
  ```ts
158
- const result = await agent.agentDispatch({ ... });
159
- if (result.status === 'PENDING') {
160
- console.log('触发发现流程:等待所有者审批...');
161
- }
162
-
163
- client.ownerOnGrantState((state) => {
164
- if (state.writeGrant === null) {
165
- console.log('收到新的待审批能力状态:', state.requestId);
166
- }
167
- });
168
-
169
- const pending = await client.ownerListGrantStates({ writeGranted: false });
150
+ // 审批待处理的请求
151
+ const pending = await client.ownerListRequests({ rootAgentId });
170
152
  if (pending.length > 0) {
171
- await client.ownerAllowAlways({
172
- requestId: pending[0].requestId
173
- });
174
- await client.ownerApproveGrantRead({
153
+ await client.ownerApproveDispatch({
175
154
  requestId: pending[0].requestId,
176
- read: { paths: ['data.id', 'data.status'] }
155
+ decision: 'allow_and_grant' // 允许执行并自动补齐缺少的授权
177
156
  });
178
157
  }
158
+
159
+ // 查看语义化审计日志
160
+ const logs = await client.ownerReadAudit({
161
+ action: 'APPROVE_DISPATCH' // 使用业务感知的语义化动作进行查询
162
+ });
179
163
  ```
180
164
 
181
165
  ---
182
166
 
183
167
  ## 详细文档
184
168
 
169
+ - [迁移指南 (v1.4 -> v1.65)](../MIGRATION-1.65.md)
185
170
  - [进程隔离(A/B 架构)](../PROCESS_ISOLATION.md)
186
171
  - [根目录 README(英文)](../../README.md)
187
172
 
@@ -189,5 +174,5 @@ if (pending.length > 0) {
189
174
 
190
175
  1. **机密隔离**:机密明文绝不离开安全进程。
191
176
  2. **密码即权限**:主密码是唯一的管理授权来源。
192
- 3. **可审计性**:所有管理动作均记录为 `vault-master` 或对应的 Agent 身份。
177
+ 3. **语义化审计**:所有操作均记录为具有业务含义的动作(如 `APPROVE_DISPATCH`),而非底层技术术语。
193
178
  4. **二元状态**:保险箱要么被解锁并可见,要么只是磁盘上一组加密碎片。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-ai-company/cbio-node-runtime",
3
- "version": "1.63.5",
3
+ "version": "1.63.6",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,69 +0,0 @@
1
- [**CBIO Node Runtime Agent API v1.63.5**](../README.md)
2
-
3
- ***
4
-
5
- # Class: PersistentVaultCustomHttpFlowRegistry
6
-
7
- ## Implements
8
-
9
- - `CustomHttpFlowRegistry`
10
-
11
- ## Constructors
12
-
13
- ### Constructor
14
-
15
- > **new PersistentVaultCustomHttpFlowRegistry**(`baseDir`): `FileCustomHttpFlowRegistry`
16
-
17
- #### Parameters
18
-
19
- ##### baseDir
20
-
21
- `string`
22
-
23
- #### Returns
24
-
25
- `FileCustomHttpFlowRegistry`
26
-
27
- ## Methods
28
-
29
- ### get()
30
-
31
- > **get**(`vaultId`, `flowId`): `Promise`\<[`CustomHttpFlowDefinition`](../interfaces/CustomHttpFlowDefinition.md) \| `null`\>
32
-
33
- #### Parameters
34
-
35
- ##### vaultId
36
-
37
- [`VaultId`](../interfaces/VaultId.md)
38
-
39
- ##### flowId
40
-
41
- `string`
42
-
43
- #### Returns
44
-
45
- `Promise`\<[`CustomHttpFlowDefinition`](../interfaces/CustomHttpFlowDefinition.md) \| `null`\>
46
-
47
- #### Implementation of
48
-
49
- `CustomHttpFlowRegistry.get`
50
-
51
- ***
52
-
53
- ### register()
54
-
55
- > **register**(`flow`): `Promise`\<`void`\>
56
-
57
- #### Parameters
58
-
59
- ##### flow
60
-
61
- [`CustomHttpFlowDefinition`](../interfaces/CustomHttpFlowDefinition.md)
62
-
63
- #### Returns
64
-
65
- `Promise`\<`void`\>
66
-
67
- #### Implementation of
68
-
69
- `CustomHttpFlowRegistry.register`
@@ -1,71 +0,0 @@
1
- [**CBIO Node Runtime Agent API v1.63.5**](../README.md)
2
-
3
- ***
4
-
5
- # Interface: CustomHttpFlowDefinition
6
-
7
- ## Properties
8
-
9
- ### createdAt
10
-
11
- > **createdAt**: `string`
12
-
13
- ***
14
-
15
- ### flowId
16
-
17
- > **flowId**: `string`
18
-
19
- ***
20
-
21
- ### method
22
-
23
- > **method**: `string`
24
-
25
- ***
26
-
27
- ### mode
28
-
29
- > **mode**: `"acquire_secret"` \| `"send_secret"` \| `"bidirectional_secret"`
30
-
31
- ***
32
-
33
- ### ownerId
34
-
35
- > **ownerId**: `string`
36
-
37
- ***
38
-
39
- ### responseSecret?
40
-
41
- > `optional` **responseSecret?**: `object`
42
-
43
- #### field
44
-
45
- > **field**: `string`
46
-
47
- #### kind
48
-
49
- > **kind**: `"json_field"`
50
-
51
- #### storeAlias
52
-
53
- > **storeAlias**: `string`
54
-
55
- ***
56
-
57
- ### responseVisibility
58
-
59
- > **responseVisibility**: `"passthrough"` \| `"shape_only"`
60
-
61
- ***
62
-
63
- ### targetUrl
64
-
65
- > **targetUrl**: `string`
66
-
67
- ***
68
-
69
- ### vaultId
70
-
71
- > **vaultId**: [`VaultId`](VaultId.md)
@@ -1,77 +0,0 @@
1
- [**CBIO Node Runtime Agent API v1.63.5**](../README.md)
2
-
3
- ***
4
-
5
- # Interface: VaultRegisterFlowInput
6
-
7
- ## Extends
8
-
9
- - `OwnerHttpFlowBoundary`
10
-
11
- ## Properties
12
-
13
- ### method
14
-
15
- > **method**: `string`
16
-
17
- #### Inherited from
18
-
19
- `OwnerHttpFlowBoundary.method`
20
-
21
- ***
22
-
23
- ### mode
24
-
25
- > **mode**: `"acquire_secret"` \| `"send_secret"` \| `"bidirectional_secret"`
26
-
27
- #### Inherited from
28
-
29
- `OwnerHttpFlowBoundary.mode`
30
-
31
- ***
32
-
33
- ### requestedAt?
34
-
35
- > `optional` **requestedAt?**: `string`
36
-
37
- ***
38
-
39
- ### responseSecret?
40
-
41
- > `optional` **responseSecret?**: `object`
42
-
43
- #### field
44
-
45
- > **field**: `string`
46
-
47
- #### kind
48
-
49
- > **kind**: `"json_field"`
50
-
51
- #### storeAlias
52
-
53
- > **storeAlias**: `string`
54
-
55
- #### Inherited from
56
-
57
- `OwnerHttpFlowBoundary.responseSecret`
58
-
59
- ***
60
-
61
- ### responseVisibility
62
-
63
- > **responseVisibility**: `"passthrough"` \| `"shape_only"`
64
-
65
- #### Inherited from
66
-
67
- `OwnerHttpFlowBoundary.responseVisibility`
68
-
69
- ***
70
-
71
- ### targetUrl
72
-
73
- > **targetUrl**: `string`
74
-
75
- #### Inherited from
76
-
77
- `OwnerHttpFlowBoundary.targetUrl`