@the-ai-company/cbio-node-runtime 1.58.0 → 1.59.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 +51 -22
- package/dist/clients/agent/client.d.ts +3 -1
- package/dist/clients/agent/client.js +41 -11
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/agent/contracts.d.ts +5 -2
- package/dist/clients/owner/client.d.ts +6 -4
- package/dist/clients/owner/client.js +43 -19
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +11 -11
- package/dist/vault-core/contracts.d.ts +120 -24
- package/dist/vault-core/contracts.js +4 -2
- package/dist/vault-core/contracts.js.map +1 -1
- package/dist/vault-core/core.d.ts +10 -4
- package/dist/vault-core/core.js +302 -101
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +8 -2
- package/dist/vault-core/defaults.js +33 -10
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/index.d.ts +1 -1
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.d.ts +11 -2
- package/dist/vault-core/persistence.js +37 -1
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +7 -1
- package/dist/vault-core/tool-metadata.js +25 -8
- package/dist/vault-core/tool-metadata.js.map +1 -1
- package/dist/vault-ingress/defaults.d.ts +2 -0
- package/dist/vault-ingress/defaults.js +6 -0
- package/dist/vault-ingress/defaults.js.map +1 -1
- package/dist/vault-ingress/index.d.ts +39 -9
- package/dist/vault-ingress/index.js +140 -45
- package/dist/vault-ingress/index.js.map +1 -1
- package/dist/vault-ingress/remote-transport.d.ts +2 -0
- package/dist/vault-ingress/remote-transport.js +33 -4
- package/dist/vault-ingress/remote-transport.js.map +1 -1
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/REFERENCE.md +36 -27
- package/docs/WORKS_WITH_CUSTOM_FETCH.md +2 -2
- package/docs/api/README.md +2 -2
- package/docs/api/classes/IdentityError.md +1 -1
- package/docs/api/classes/OwnerClientError.md +1 -1
- package/docs/api/classes/VaultCore.md +92 -28
- package/docs/api/classes/VaultCoreError.md +1 -1
- package/docs/api/enumerations/IdentityErrorCode.md +1 -1
- package/docs/api/enumerations/OwnerClientErrorCode.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/createOwnerSession.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/handleVaultAgentControlHttp.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 +27 -1
- package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
- package/docs/api/interfaces/AgentDispatchTransport.md +33 -1
- package/docs/api/interfaces/AgentIdentity.md +1 -1
- package/docs/api/interfaces/AgentSigner.md +1 -1
- package/docs/api/interfaces/AgentSubmitCapabilityRequestInput.md +9 -9
- package/docs/api/interfaces/CbioRuntime.md +1 -1
- package/docs/api/interfaces/CreateAgentClientOptions.md +1 -1
- package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
- package/docs/api/interfaces/CreateOwnerSessionOptions.md +1 -1
- package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
- package/docs/api/interfaces/CreateVaultClientOptions.md +1 -1
- package/docs/api/interfaces/CreateVaultOptions.md +1 -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/OwnerAgentProvisionResult.md +1 -1
- package/docs/api/interfaces/OwnerSensitiveActionConfirmation.md +1 -1
- package/docs/api/interfaces/OwnerSensitiveActionContext.md +1 -1
- package/docs/api/interfaces/OwnerSession.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 +1 -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/VaultApproveCapabilityRequestInput.md +1 -1
- package/docs/api/interfaces/VaultApproveDispatchInput.md +1 -1
- package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
- package/docs/api/interfaces/VaultClient.md +69 -37
- package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -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 +9 -21
- package/docs/api/interfaces/VaultGrantCapabilityRequest.md +1 -1
- package/docs/api/interfaces/VaultIdentity.md +1 -1
- package/docs/api/interfaces/VaultImportAgentInput.md +1 -1
- package/docs/api/interfaces/VaultIssueSessionTokenInput.md +1 -1
- package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
- package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
- package/docs/api/interfaces/VaultListSecretsInput.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/VaultReadAgentPrivateKeyInput.md +1 -1
- package/docs/api/interfaces/VaultReadSecretPlaintextInput.md +1 -1
- package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeSessionTokenInput.md +1 -1
- package/docs/api/interfaces/VaultSigner.md +1 -1
- package/docs/api/interfaces/VaultSubmitCapabilityRequestInput.md +11 -17
- package/docs/api/interfaces/VaultUpdateAgentInput.md +1 -1
- package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
- package/docs/api/type-aliases/AgentVisibleSecretRecord.md +1 -1
- package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
- package/docs/api/type-aliases/OwnerGrantCapabilityInput.md +1 -1
- package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
- package/docs/zh/README.md +25 -9
- package/examples/process-isolation.ts +6 -4
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**CBIO Node Runtime Agent API v1.
|
|
1
|
+
[**CBIO Node Runtime Agent API v1.59.1**](../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -36,12 +36,6 @@
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### methods
|
|
40
|
-
|
|
41
|
-
> **methods**: readonly `string`[]
|
|
42
|
-
|
|
43
|
-
***
|
|
44
|
-
|
|
45
39
|
### operation?
|
|
46
40
|
|
|
47
41
|
> `optional` **operation?**: `string`
|
|
@@ -62,30 +56,24 @@
|
|
|
62
56
|
|
|
63
57
|
***
|
|
64
58
|
|
|
65
|
-
###
|
|
66
|
-
|
|
67
|
-
> `optional` **requestedAt?**: `string`
|
|
68
|
-
|
|
69
|
-
***
|
|
70
|
-
|
|
71
|
-
### scope
|
|
59
|
+
### read
|
|
72
60
|
|
|
73
|
-
> **
|
|
61
|
+
> **read**: `CapabilityReadPolicy`
|
|
74
62
|
|
|
75
63
|
***
|
|
76
64
|
|
|
77
|
-
###
|
|
65
|
+
### requestedAt?
|
|
78
66
|
|
|
79
|
-
> `optional` **
|
|
67
|
+
> `optional` **requestedAt?**: `string`
|
|
80
68
|
|
|
81
69
|
***
|
|
82
70
|
|
|
83
|
-
###
|
|
71
|
+
### skipAudit?
|
|
84
72
|
|
|
85
|
-
> `optional` **
|
|
73
|
+
> `optional` **skipAudit?**: `boolean`
|
|
86
74
|
|
|
87
75
|
***
|
|
88
76
|
|
|
89
|
-
###
|
|
77
|
+
### write
|
|
90
78
|
|
|
91
|
-
>
|
|
79
|
+
> **write**: `CapabilityWritePolicy`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[**CBIO Node Runtime Agent API v1.
|
|
1
|
+
[**CBIO Node Runtime Agent API v1.59.1**](../README.md)
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
***
|
|
26
26
|
|
|
27
|
-
### methods
|
|
28
|
-
|
|
29
|
-
> **methods**: readonly `string`[]
|
|
30
|
-
|
|
31
|
-
***
|
|
32
|
-
|
|
33
27
|
### operation?
|
|
34
28
|
|
|
35
29
|
> `optional` **operation?**: `string`
|
|
@@ -50,30 +44,30 @@
|
|
|
50
44
|
|
|
51
45
|
***
|
|
52
46
|
|
|
53
|
-
###
|
|
47
|
+
### read
|
|
54
48
|
|
|
55
|
-
>
|
|
49
|
+
> **read**: `CapabilityReadPolicy`
|
|
56
50
|
|
|
57
51
|
***
|
|
58
52
|
|
|
59
|
-
###
|
|
53
|
+
### requestedAt?
|
|
60
54
|
|
|
61
|
-
> **
|
|
55
|
+
> `optional` **requestedAt?**: `string`
|
|
62
56
|
|
|
63
57
|
***
|
|
64
58
|
|
|
65
|
-
###
|
|
59
|
+
### requester
|
|
66
60
|
|
|
67
|
-
> **
|
|
61
|
+
> **requester**: `VaultPrincipal`
|
|
68
62
|
|
|
69
63
|
***
|
|
70
64
|
|
|
71
|
-
###
|
|
65
|
+
### skipAudit?
|
|
72
66
|
|
|
73
|
-
> `optional` **
|
|
67
|
+
> `optional` **skipAudit?**: `boolean`
|
|
74
68
|
|
|
75
69
|
***
|
|
76
70
|
|
|
77
|
-
###
|
|
71
|
+
### write
|
|
78
72
|
|
|
79
|
-
>
|
|
73
|
+
> **write**: `CapabilityWritePolicy`
|
package/docs/zh/README.md
CHANGED
|
@@ -101,9 +101,12 @@ const record = await client.ownerWriteSecret({
|
|
|
101
101
|
|
|
102
102
|
await client.ownerGrantCapability({
|
|
103
103
|
agentId,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
write: {
|
|
105
|
+
secretIds: [record.secretId.value],
|
|
106
|
+
scope: 'https://api.example.com/*',
|
|
107
|
+
methods: ['POST']
|
|
108
|
+
},
|
|
109
|
+
read: { mode: 'full' }
|
|
107
110
|
});
|
|
108
111
|
```
|
|
109
112
|
|
|
@@ -120,24 +123,31 @@ const agent = createAgentClient({
|
|
|
120
123
|
});
|
|
121
124
|
|
|
122
125
|
const result = await agent.agentDispatch({ ... });
|
|
126
|
+
const requests = await agent.agentListRequests();
|
|
127
|
+
const request = await agent.agentGetRequest(result.requestId);
|
|
123
128
|
```
|
|
124
129
|
|
|
125
130
|
Agent 进程不会直接使用原始私钥执行请求。即使 Agent 拥有身份材料,也应先换取 session token,再进行 dispatch。
|
|
126
131
|
|
|
132
|
+
给 LLM 的直白规则:
|
|
133
|
+
- `agentDispatch(...)` = 立刻尝试执行真实任务
|
|
134
|
+
- `agentSubmitCapabilityRequest(...)` = 只申请权限,不会执行任务
|
|
135
|
+
- `agentListRequests()` / `agentGetRequest(...)` = 在请求执行后查看异步结果
|
|
136
|
+
|
|
127
137
|
```ts
|
|
128
138
|
const manifest = await agent.agentIntrospect();
|
|
129
139
|
|
|
130
140
|
console.log(manifest.agent.agentId);
|
|
131
141
|
console.log(manifest.agent.identityId);
|
|
132
142
|
console.log(manifest.agent.nickname);
|
|
133
|
-
console.log(manifest.capabilities); //
|
|
143
|
+
console.log(manifest.capabilities); // 同一组能力载体里包含 write/read 动作状态
|
|
134
144
|
```
|
|
135
145
|
|
|
136
|
-
`agentListCapabilities()`
|
|
146
|
+
`agentListCapabilities()` 返回能力载体视图,`agentListRequests()` / `agentGetRequest()` 则负责暴露请求历史和按权限裁剪后的结果。
|
|
137
147
|
|
|
138
148
|
### 7. 人机协同(HITL)工作流
|
|
139
149
|
|
|
140
|
-
|
|
150
|
+
如果 Agent 尝试执行的动作不在白名单内,dispatch 会返回 `PENDING`,同时运行时会写入一条能力载体记录,其 `write` 动作等待 Owner 审批。
|
|
141
151
|
|
|
142
152
|
```ts
|
|
143
153
|
const result = await agent.agentDispatch({ ... });
|
|
@@ -146,14 +156,20 @@ if (result.status === 'PENDING') {
|
|
|
146
156
|
}
|
|
147
157
|
|
|
148
158
|
client.ownerOnCapabilityState((state) => {
|
|
149
|
-
if (state.status === 'PENDING') {
|
|
159
|
+
if (state.actions.write.status === 'PENDING') {
|
|
150
160
|
console.log('收到新的待审批能力状态:', state.requestId);
|
|
151
161
|
}
|
|
152
162
|
});
|
|
153
163
|
|
|
154
|
-
const pending = await client.ownerListCapabilityStates({
|
|
164
|
+
const pending = await client.ownerListCapabilityStates({ writeStatus: 'PENDING' });
|
|
155
165
|
if (pending.length > 0) {
|
|
156
|
-
await client.
|
|
166
|
+
await client.ownerApproveCapabilityWrite({
|
|
167
|
+
requestId: pending[0].requestId
|
|
168
|
+
});
|
|
169
|
+
await client.ownerAllowAlways({
|
|
170
|
+
requestId: pending[0].requestId
|
|
171
|
+
});
|
|
172
|
+
await client.ownerApproveCapabilityRead({
|
|
157
173
|
requestId: pending[0].requestId
|
|
158
174
|
});
|
|
159
175
|
}
|
|
@@ -128,11 +128,13 @@ async function main() {
|
|
|
128
128
|
vaultId: vault.vaultId,
|
|
129
129
|
capabilityId: "cap-llm-1",
|
|
130
130
|
agentId: agentIdentity.identityId,
|
|
131
|
-
secretIds: [secret.secretId.value],
|
|
132
|
-
secretAliases: ["api-token"],
|
|
133
131
|
operation: "dispatch_http" as const,
|
|
134
|
-
|
|
135
|
-
|
|
132
|
+
write: {
|
|
133
|
+
secretIds: [secret.secretId.value],
|
|
134
|
+
scope: "https://httpbin.org/post",
|
|
135
|
+
methods: ["POST"],
|
|
136
|
+
},
|
|
137
|
+
read: { mode: "full" },
|
|
136
138
|
issuedAt: new Date().toISOString(),
|
|
137
139
|
};
|
|
138
140
|
|