@the-ai-company/cbio-node-runtime 1.63.3 → 1.63.5
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 +48 -209
- package/dist/clients/agent/client.d.ts +18 -40
- package/dist/clients/agent/client.js +22 -109
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/agent/contracts.d.ts +1 -8
- package/dist/clients/agent/index.d.ts +1 -1
- package/dist/clients/owner/client.d.ts +2 -102
- package/dist/clients/owner/client.js +119 -240
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +37 -70
- package/dist/clients/owner/index.d.ts +2 -4
- package/dist/clients/owner/index.js +1 -2
- package/dist/clients/owner/index.js.map +1 -1
- package/dist/internal/id-factory.d.ts +0 -2
- package/dist/internal/id-factory.js +0 -6
- package/dist/internal/id-factory.js.map +1 -1
- package/dist/protocol/identity.d.ts +1 -1
- package/dist/protocol/identity.js +3 -3
- package/dist/protocol/identity.js.map +1 -1
- package/dist/public-types.d.ts +5 -14
- package/dist/public-types.js +1 -8
- package/dist/public-types.js.map +1 -1
- package/dist/runtime/bootstrap.js.map +1 -1
- package/dist/runtime/identity.d.ts +2 -2
- package/dist/runtime/identity.js +3 -5
- package/dist/runtime/identity.js.map +1 -1
- package/dist/runtime/index.d.ts +10 -12
- package/dist/runtime/index.js +7 -8
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/owner-session.d.ts +7 -6
- package/dist/runtime/owner-session.js +5 -6
- package/dist/runtime/owner-session.js.map +1 -1
- package/dist/storage/fs.d.ts +3 -2
- package/dist/storage/fs.js +8 -5
- package/dist/storage/fs.js.map +1 -1
- package/dist/storage/prefix.d.ts +1 -0
- package/dist/storage/prefix.js +7 -0
- package/dist/storage/prefix.js.map +1 -1
- package/dist/storage/provider.d.ts +2 -0
- package/dist/vault-core/contracts.d.ts +112 -193
- package/dist/vault-core/contracts.js +5 -8
- package/dist/vault-core/contracts.js.map +1 -1
- package/dist/vault-core/core.d.ts +127 -62
- package/dist/vault-core/core.js +500 -1182
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +26 -42
- package/dist/vault-core/defaults.js +73 -229
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/errors.d.ts +3 -2
- package/dist/vault-core/errors.js.map +1 -1
- package/dist/vault-core/index.d.ts +5 -5
- package/dist/vault-core/index.js +2 -2
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.d.ts +78 -118
- package/dist/vault-core/persistence.js +329 -421
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +19 -24
- package/dist/vault-core/read-policy.d.ts +3 -2
- package/dist/vault-core/read-policy.js.map +1 -1
- package/dist/vault-core/tool-metadata.js +2 -2
- package/dist/vault-core/tool-metadata.js.map +1 -1
- package/dist/vault-ingress/defaults.d.ts +4 -2
- package/dist/vault-ingress/defaults.js +14 -8
- package/dist/vault-ingress/defaults.js.map +1 -1
- package/dist/vault-ingress/index.d.ts +43 -117
- package/dist/vault-ingress/index.js +98 -453
- package/dist/vault-ingress/index.js.map +1 -1
- package/dist/vault-ingress/remote-transport.d.ts +5 -3
- package/dist/vault-ingress/remote-transport.js +8 -28
- package/dist/vault-ingress/remote-transport.js.map +1 -1
- package/docs/ARCHITECTURE.md +39 -22
- package/docs/CUSTODY_MODEL.md +1 -1
- package/docs/IDENTITY_MODEL.md +5 -5
- package/docs/MIGRATION-1.51.md +19 -19
- package/docs/MIGRATION-1.65.md +61 -0
- package/docs/PROCESS_ISOLATION.md +2 -2
- package/docs/REFERENCE.md +42 -224
- package/docs/api/README.md +50 -29
- package/docs/api/classes/IdentityError.md +1 -1
- package/docs/api/classes/OwnerClientError.md +1 -1
- package/docs/api/classes/PersistentVaultAgentIdentityRegistry.md +89 -0
- package/docs/api/classes/PersistentVaultAgentSecretGrantRegistry.md +125 -0
- package/docs/api/classes/PersistentVaultAuditLog.md +65 -0
- package/docs/api/classes/PersistentVaultCustomHttpFlowRegistry.md +69 -0
- package/docs/api/classes/PersistentVaultSecretCustody.md +93 -0
- package/docs/api/classes/PersistentVaultSecretDestinationGrantRegistry.md +125 -0
- package/docs/api/classes/PersistentVaultSecretRepository.md +127 -0
- package/docs/api/classes/VaultCore.md +299 -214
- package/docs/api/classes/VaultCoreError.md +3 -3
- package/docs/api/enumerations/AuditAction.md +143 -0
- package/docs/api/enumerations/AuditOutcome.md +35 -0
- package/docs/api/enumerations/DispatchStatus.md +35 -0
- package/docs/api/enumerations/IdentityErrorCode.md +1 -1
- package/docs/api/enumerations/OwnerClientErrorCode.md +1 -1
- package/docs/api/functions/createAgentClient.md +1 -15
- package/docs/api/functions/createIdentity.md +2 -2
- package/docs/api/functions/createOwnerClient.md +17 -0
- package/docs/api/functions/createOwnerSession.md +1 -1
- package/docs/api/functions/createPersistentVaultCoreDependencies.md +4 -4
- package/docs/api/functions/createVault.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 +5 -9
- package/docs/api/functions/createWorkspaceStorage.md +1 -1
- package/docs/api/functions/deriveRootAgentId.md +17 -0
- package/docs/api/functions/deriveVaultWorkingKeyFromPassword.md +1 -1
- package/docs/api/functions/getDefaultWorkspaceDir.md +1 -1
- package/docs/api/functions/handleVaultAgentControlHttp.md +2 -2
- package/docs/api/functions/handleVaultHttpDispatch.md +2 -2
- package/docs/api/functions/initializeVaultCustody.md +7 -3
- 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 +4 -8
- package/docs/api/functions/restoreIdentity.md +1 -1
- package/docs/api/functions/updateVaultMetadata.md +1 -1
- package/docs/api/functions/writeVaultProfile.md +1 -1
- package/docs/api/interfaces/AgentClient.md +20 -59
- package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
- package/docs/api/interfaces/AgentDispatchTransport.md +12 -44
- package/docs/api/interfaces/AgentIdentity.md +3 -3
- package/docs/api/interfaces/AgentIdentityRecord.md +47 -0
- package/docs/api/interfaces/AgentRequestResult.md +35 -0
- package/docs/api/interfaces/AgentRuntimeManifest.md +55 -0
- package/docs/api/interfaces/AgentSecretGrant.md +41 -0
- package/docs/api/interfaces/AgentSigner.md +1 -1
- package/docs/api/interfaces/AgentVisibleRequestRecord.md +53 -0
- package/docs/api/interfaces/AgentVisibleSecretRecord.md +65 -0
- package/docs/api/interfaces/AuditEntry.md +83 -0
- package/docs/api/interfaces/CbioRuntime.md +13 -150
- package/docs/api/interfaces/CreateAgentClientOptions.md +4 -10
- package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
- package/docs/api/interfaces/{CreateVaultClientOptions.md → CreateOwnerClientOptions.md} +9 -11
- package/docs/api/interfaces/CreateOwnerSessionOptions.md +3 -117
- package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +3 -131
- package/docs/api/interfaces/CreateVaultOptions.md +1 -121
- package/docs/api/interfaces/CreatedVault.md +2 -2
- package/docs/api/interfaces/CustomHttpFlowDefinition.md +71 -0
- package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -13
- package/docs/api/interfaces/DispatchAuthorization.md +43 -0
- package/docs/api/interfaces/DispatchInstruction.md +47 -0
- package/docs/api/interfaces/DispatchRequest.md +83 -0
- package/docs/api/interfaces/DispatchResult.md +53 -0
- package/docs/api/interfaces/IStorageProvider.md +13 -1
- package/docs/api/interfaces/InitializeVaultCustodyOptions.md +31 -11
- package/docs/api/interfaces/InitializedVaultCustody.md +1 -7
- package/docs/api/interfaces/OwnerAgentProvisionResult.md +2 -2
- package/docs/api/interfaces/OwnerClient.md +417 -0
- package/docs/api/interfaces/OwnerCreateSecretInput.md +1 -1
- package/docs/api/interfaces/OwnerRemoveSecretInput.md +1 -1
- package/docs/api/interfaces/OwnerRequestRecord.md +97 -0
- package/docs/api/interfaces/OwnerSensitiveActionConfirmation.md +1 -1
- package/docs/api/interfaces/OwnerSensitiveActionContext.md +1 -1
- package/docs/api/interfaces/OwnerSession.md +3 -3
- package/docs/api/interfaces/OwnerUpdateSecretInput.md +1 -1
- package/docs/api/interfaces/OwnerVisibleRequestRecord.md +73 -0
- package/docs/api/interfaces/RecoverVaultOptions.md +1 -121
- package/docs/api/interfaces/RecoveredVault.md +2 -2
- package/docs/api/interfaces/RequestRecord.md +107 -0
- package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
- package/docs/api/interfaces/SecretAlias.md +11 -0
- package/docs/api/interfaces/SecretDestinationGrant.md +41 -0
- package/docs/api/interfaces/SecretId.md +11 -0
- package/docs/api/interfaces/SecretRecord.md +89 -0
- package/docs/api/interfaces/Signer.md +1 -1
- package/docs/api/interfaces/VaultApproveDispatchInput.md +3 -9
- package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
- package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -5
- package/docs/api/interfaces/VaultCreateAgentInput.md +1 -1
- package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
- package/docs/api/interfaces/VaultGetRequestInput.md +17 -0
- package/docs/api/interfaces/VaultGrantAgentSecretInput.md +23 -0
- package/docs/api/interfaces/VaultGrantSecretDestinationInput.md +23 -0
- package/docs/api/interfaces/VaultId.md +11 -0
- package/docs/api/interfaces/VaultImportAgentInput.md +1 -1
- package/docs/api/interfaces/VaultIssueSessionTokenInput.md +5 -5
- package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
- package/docs/api/interfaces/VaultListGrantsInput.md +23 -0
- package/docs/api/interfaces/VaultListRequestsInput.md +17 -0
- package/docs/api/interfaces/VaultListSecretsInput.md +1 -1
- package/docs/api/interfaces/VaultMetadata.md +1 -1
- package/docs/api/interfaces/VaultObject.md +2 -2
- package/docs/api/interfaces/VaultPrincipal.md +17 -0
- package/docs/api/interfaces/VaultProfile.md +1 -1
- package/docs/api/interfaces/VaultReadAgentPrivateKeyInput.md +7 -7
- package/docs/api/interfaces/VaultReadSecretPlaintextInput.md +1 -1
- package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeAgentSecretInput.md +23 -0
- package/docs/api/interfaces/VaultRevokeSecretDestinationInput.md +23 -0
- package/docs/api/interfaces/VaultRevokeSessionTokenInput.md +1 -1
- package/docs/api/interfaces/VaultService.md +547 -0
- package/docs/api/interfaces/VaultUpdateAgentInput.md +7 -7
- package/docs/api/type-aliases/AgentId.md +7 -0
- package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
- package/docs/api/type-aliases/DispatchApprovalDecision.md +7 -0
- package/docs/api/type-aliases/GrantStatus.md +7 -0
- package/docs/api/type-aliases/SecretLifecycleStatus.md +7 -0
- package/docs/api/type-aliases/VaultPrincipalKind.md +7 -0
- package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +2 -2
- package/docs/es/README.md +3 -3
- package/docs/fr/README.md +3 -3
- package/docs/ja/README.md +5 -5
- package/docs/ko/README.md +5 -5
- package/docs/pt/README.md +3 -3
- package/docs/zh/PROCESS_ISOLATION.md +2 -2
- package/docs/zh/README.md +23 -24
- package/examples/process-isolation.ts +26 -35
- package/package.json +1 -1
- package/docs/api/functions/createOwnerHttpFlowBoundary.md +0 -17
- package/docs/api/functions/createStandardAcquireBoundary.md +0 -31
- package/docs/api/functions/createStandardDispatchBoundary.md +0 -23
- package/docs/api/functions/createVaultClient.md +0 -32
- package/docs/api/functions/deriveIdentityId.md +0 -17
- package/docs/api/functions/wrapVaultCoreAsVaultService.md +0 -31
- package/docs/api/interfaces/AgentSubmitCapabilityRequestInput.md +0 -41
- package/docs/api/interfaces/VaultApproveCapabilityRequestInput.md +0 -23
- package/docs/api/interfaces/VaultClient.md +0 -473
- package/docs/api/interfaces/VaultGrantCapabilityInput.md +0 -79
- package/docs/api/interfaces/VaultGrantCapabilityRequest.md +0 -23
- package/docs/api/interfaces/VaultIdentity.md +0 -11
- package/docs/api/interfaces/VaultListCapabilitiesInput.md +0 -17
- package/docs/api/interfaces/VaultRevokeCapabilityInput.md +0 -23
- package/docs/api/interfaces/VaultSigner.md +0 -21
- package/docs/api/interfaces/VaultSubmitCapabilityRequestInput.md +0 -73
- package/docs/api/type-aliases/AgentCapabilityEnvelope.md +0 -7
- package/docs/api/type-aliases/AgentVisibleSecretRecord.md +0 -7
- package/docs/api/type-aliases/CreateOwnerClientOptions.md +0 -7
- package/docs/api/type-aliases/OwnerAgentView.md +0 -7
- package/docs/api/type-aliases/OwnerClient.md +0 -13
- package/docs/api/type-aliases/OwnerGrantCapabilityInput.md +0 -7
- package/docs/api/type-aliases/OwnerPendingApprovalView.md +0 -7
- package/docs/api/type-aliases/OwnerRequestDetailView.md +0 -7
- package/docs/api/type-aliases/OwnerRequestSummaryView.md +0 -7
- package/docs/api/type-aliases/OwnerSecretView.md +0 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# cbio Vault Runtime
|
|
1
|
+
# cbio Vault Runtime (v1.65.1)
|
|
2
2
|
|
|
3
3
|
Node.js vault runtime with a **Sovereign Vault** architecture: authority is rooted in a master password, and agent identities are fully managed within the vault's encrypted storage.
|
|
4
4
|
|
|
@@ -9,12 +9,11 @@ Node.js vault runtime with a **Sovereign Vault** architecture: authority is root
|
|
|
9
9
|
## Key Features
|
|
10
10
|
|
|
11
11
|
- **No CLI / No TUI**: Pure library for integration into Node.js applications.
|
|
12
|
-
- **Authority-centric**: Administrative control is tied to the vault's master password
|
|
12
|
+
- **Authority-centric**: Administrative control is tied to the vault's master password.
|
|
13
|
+
- **Grant-Based Authorization**: Simplified, domain-level white-listing replaced the legacy grant model.
|
|
14
|
+
- **Zero-Configuration Discovery**: Agents can self-introspect to discover their identity, grants, and toolset.
|
|
13
15
|
- **Managed Agent Custody**: Generate and store agent private keys securely inside the vault.
|
|
14
|
-
- **Agent Session Tokens**: Issue revocable, short-lived (or long-lived) tokens for agents to avoid handling raw private keys.
|
|
15
|
-
- **Zero-Configuration Discovery**: Agents can self-introspect to discover their identity, capabilities, and toolset (v1.56.0+).
|
|
16
16
|
- **Process Isolation**: Hard separation between the Security Process (Master) and Agent Processes (Consumers).
|
|
17
|
-
- **Zero-Leak Discovery**: Vault metadata is fully encrypted and hidden until unlocked.
|
|
18
17
|
|
|
19
18
|
## Install
|
|
20
19
|
|
|
@@ -26,257 +25,97 @@ npm install @the-ai-company/cbio-node-runtime
|
|
|
26
25
|
|
|
27
26
|
## Usage
|
|
28
27
|
|
|
29
|
-
### 1. Bootstrap
|
|
30
|
-
|
|
31
|
-
The Sovereign Vault requires only a storage provider and a master password.
|
|
28
|
+
### 1. Bootstrap and Recover
|
|
32
29
|
|
|
33
30
|
```ts
|
|
34
|
-
import {
|
|
35
|
-
createVault,
|
|
36
|
-
FsStorageProvider,
|
|
37
|
-
createWorkspaceStorage
|
|
38
|
-
} from '@the-ai-company/cbio-node-runtime';
|
|
31
|
+
import { createVault, recoverVault, FsStorageProvider } from '@the-ai-company/cbio-node-runtime';
|
|
39
32
|
|
|
40
33
|
const storage = new FsStorageProvider('./my-vaults');
|
|
41
34
|
|
|
35
|
+
// Create
|
|
42
36
|
const myVault = await createVault(storage, {
|
|
43
37
|
password: 'your-secure-password',
|
|
44
38
|
nickname: 'Production Vault'
|
|
45
39
|
});
|
|
46
40
|
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 2. Recover an Existing Vault
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
import { recoverVault, FsStorageProvider } from '@the-ai-company/cbio-node-runtime';
|
|
54
|
-
|
|
41
|
+
// Recover
|
|
55
42
|
const vault = await recoverVault(storage, {
|
|
56
43
|
vaultId: myVault.core.vaultId.value,
|
|
57
44
|
password: 'your-secure-password'
|
|
58
45
|
});
|
|
59
46
|
```
|
|
60
47
|
|
|
61
|
-
###
|
|
62
|
-
|
|
63
|
-
For long-running processes such as GUI apps, keep an `OwnerSession`, not a raw `VaultClient`.
|
|
64
|
-
|
|
65
|
-
`createVaultClient(...)` creates an owner client for the current runtime. It is not intended to be cached across HMR, module reloads, or runtime swaps. `OwnerSession` gives you a stable SDK-managed handle and recreates owner clients on demand.
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
import { createOwnerSession, FsStorageProvider } from '@the-ai-company/cbio-node-runtime';
|
|
69
|
-
|
|
70
|
-
const session = createOwnerSession(storage, {
|
|
71
|
-
vaultId: myVault.core.vaultId.value,
|
|
72
|
-
password: 'your-secure-password',
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const createdAgent = await session.withClient((client) =>
|
|
76
|
-
client.ownerCreateAgent({ nickname: 'Background Worker' })
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
const ownerClient = await session.client();
|
|
80
|
-
const agents = await ownerClient.ownerListAgents();
|
|
81
|
-
|
|
82
|
-
// Invalidate the session when your app unloads or explicitly locks the vault.
|
|
83
|
-
session.invalidate();
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
If you are writing a short-lived script, `recoverVault(...)` plus `createVaultClient(...)` is still fine.
|
|
87
|
-
|
|
88
|
-
### 4. Managed Agent Identities
|
|
89
|
-
|
|
90
|
-
You can generate and register agents directly within the vault. The vault holds the private keys for full custody.
|
|
48
|
+
### 2. Manage Agents and Grants (Owner)
|
|
91
49
|
|
|
92
50
|
```ts
|
|
93
|
-
import {
|
|
51
|
+
import { createOwnerClient } from '@the-ai-company/cbio-node-runtime';
|
|
94
52
|
|
|
95
|
-
const client =
|
|
53
|
+
const client = createOwnerClient({
|
|
96
54
|
vault: vault.vault,
|
|
97
55
|
passwordVerifier: vault.verifyPassword
|
|
98
56
|
});
|
|
99
57
|
|
|
100
|
-
//
|
|
101
|
-
const
|
|
102
|
-
nickname: 'Background Worker'
|
|
103
|
-
});
|
|
58
|
+
// 1. Create an agent
|
|
59
|
+
const { agent, sessionToken } = await client.ownerCreateAgent({ nickname: 'Bot' });
|
|
104
60
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
console.log(`Identity ID: ${createdAgent.agent.identityId}`);
|
|
108
|
-
const session = createdAgent.sessionToken;
|
|
61
|
+
// 2. Create a secret
|
|
62
|
+
const secret = await client.ownerCreateSecret({ alias: 'api-key', plaintext: 'sk-...' });
|
|
109
63
|
|
|
110
|
-
//
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// ownerListAgents() also includes current session tokens for each agent
|
|
114
|
-
const agents = await client.ownerListAgents();
|
|
64
|
+
// 3. Grant access (Whitelist)
|
|
65
|
+
await client.ownerGrantAgentSecret({ rootAgentId: agent.rootAgentId, secretAlias: 'api-key' });
|
|
66
|
+
await client.ownerGrantSecretDestination({ secretAlias: 'api-key', domain: 'api.openai.com' });
|
|
115
67
|
```
|
|
116
68
|
|
|
117
|
-
###
|
|
69
|
+
### 3. Dispatch Secrets (Agent)
|
|
118
70
|
|
|
119
|
-
|
|
120
|
-
// Create a secret. Active aliases must stay unique.
|
|
121
|
-
const record = await client.ownerCreateSecret({
|
|
122
|
-
alias: 'api-token',
|
|
123
|
-
plaintext: 'super-secret-value'
|
|
124
|
-
});
|
|
71
|
+
Agents use a "Zero-Configuration" workflow. They don't need to know their permissions up front; the system guides them.
|
|
125
72
|
|
|
126
|
-
// 4. Grant agent capabilities
|
|
127
|
-
await client.ownerGrantCapability({
|
|
128
|
-
agentId,
|
|
129
|
-
write: {
|
|
130
|
-
secretIds: [record.secretId.value],
|
|
131
|
-
scope: 'https://api.example.com/*',
|
|
132
|
-
methods: ['POST']
|
|
133
|
-
},
|
|
134
|
-
read: { paths: ['$'] }
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 6. Consuming Secrets (Agent)
|
|
139
|
-
|
|
140
|
-
Agents run in isolated processes and communicate with the vault via a transport. Agent execution now requires a **Session Token** issued by the owner.
|
|
141
|
-
|
|
142
|
-
#### Using a Session Token (Stateless/Token-based)
|
|
143
73
|
```ts
|
|
144
74
|
import { createAgentClient } from '@the-ai-company/cbio-node-runtime';
|
|
145
75
|
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
token: session.token,
|
|
76
|
+
const agentClient = createAgentClient({
|
|
77
|
+
rootAgentIdentity: agent,
|
|
78
|
+
token: sessionToken.token,
|
|
150
79
|
vault: vault.vault
|
|
151
80
|
});
|
|
152
81
|
|
|
153
|
-
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
The agent process does not execute directly with its raw private key. If it has an identity key, it still needs to exchange that trust for a session token before dispatching.
|
|
160
|
-
|
|
161
|
-
LLM-facing rule of thumb:
|
|
162
|
-
- `agentDispatch(...)` means "do the task now". It attempts real execution immediately.
|
|
163
|
-
- `agentDispatch(...)` requires a one-sentence `reason` for the owner explaining why this exact request should be sent.
|
|
164
|
-
- `agentSubmitCapabilityRequest(...)` means "ask for permission". It never executes the task by itself.
|
|
165
|
-
- `agentSubmitCapabilityRequest(...)` also requires a one-sentence `reason` so the owner understands why the broader permission is needed.
|
|
166
|
-
- `agentListRequests()` / `agentGetRequest(...)` are how the agent checks asynchronous results after execution.
|
|
167
|
-
- `ownerListRequests()` / `ownerGetRequest(...)` are how the owner reviews the full sealed request record before approving read.
|
|
168
|
-
|
|
169
|
-
### 7. Proactive Capability Requests
|
|
170
|
-
|
|
171
|
-
If an LLM or orchestration layer already knows it needs a broader scope, it can create a capability carrier up front instead of discovering one URL at a time through failed dispatch attempts.
|
|
172
|
-
|
|
173
|
-
```ts
|
|
174
|
-
const request = await client.ownerSubmitCapabilityRequest({
|
|
175
|
-
requester: { kind: 'trusted_executor', id: 'llm-planner' },
|
|
176
|
-
agentId,
|
|
177
|
-
write: {
|
|
178
|
-
secretIds: [record.secretId.value],
|
|
179
|
-
scope: 'https://api.example.com/users/*',
|
|
180
|
-
methods: ['GET']
|
|
181
|
-
},
|
|
182
|
-
read: { paths: ['$'] },
|
|
183
|
-
reason: 'Need collection-level user read access'
|
|
82
|
+
// Dispatch request
|
|
83
|
+
const result = await agentClient.agentDispatch({
|
|
84
|
+
targetUrl: 'https://api.openai.com/v1/chat/completions',
|
|
85
|
+
method: 'POST',
|
|
86
|
+
secretAlias: 'api-key',
|
|
87
|
+
reason: 'Processing user request'
|
|
184
88
|
});
|
|
185
89
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
requestId: pendingRequests[0].requestId
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
await client.ownerApproveCapabilityRead({
|
|
193
|
-
requestId: pendingRequests[0].requestId,
|
|
194
|
-
read: { paths: ['data.id', 'data.status'] }
|
|
195
|
-
});
|
|
90
|
+
if (result.status === 'PENDING') {
|
|
91
|
+
console.log("Stalled for HITL approval. Request ID:", result.requestId);
|
|
92
|
+
}
|
|
196
93
|
```
|
|
197
94
|
|
|
198
|
-
|
|
199
|
-
- `ownerSubmitCapabilityRequest(...)` creates a capability carrier for owner review.
|
|
200
|
-
- `ownerOnCapabilityState(...)` pushes new carrier changes to the owner UI or controller.
|
|
201
|
-
- `ownerAllowAlways(...)` persists the carrier as an active capability. For dispatch discovery it also executes the blocked request; for explicit requests it grants the capability without sending network traffic.
|
|
202
|
-
- `ownerAllowOnce(...)` executes the approved write action once and then deletes the carrier record. This option is only valid for dispatch discovery carriers that already contain a concrete blocked request.
|
|
203
|
-
- `ownerApproveCapabilityRead(...)` approves response release separately on the same carrier record and may replace the pending `read` policy with a narrower `paths` whitelist.
|
|
204
|
-
- Response shape is always visible. `read.paths` only controls which values are revealed, and `['$']` means the full response body is visible.
|
|
205
|
-
- `ownerDeny(...)` rejects the currently pending action on the carrier.
|
|
95
|
+
### 4. Human-in-the-Loop (Owner Approval)
|
|
206
96
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
Instead of hard-coding the agent's capabilities or tools, the agent can self-introspect at runtime. This is the "--help" and "llms.txt" for your agent.
|
|
97
|
+
If a dispatch is blocked (status `PENDING`), the owner reviews the request record:
|
|
210
98
|
|
|
211
99
|
```ts
|
|
212
|
-
|
|
100
|
+
// List pending requests
|
|
101
|
+
const pending = await client.ownerListRequests({ status: 'PENDING' });
|
|
213
102
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
103
|
+
// Approve with the "Allow & Grant" shortcut
|
|
104
|
+
await client.ownerApproveDispatch({
|
|
105
|
+
requestId: pending[0].requestId,
|
|
106
|
+
decision: 'allow_and_grant' // Approves THIS request AND provisions permanent grants
|
|
107
|
+
});
|
|
219
108
|
```
|
|
220
109
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
`
|
|
110
|
+
Decisions can be:
|
|
111
|
+
- `allow_once`: Execute once, no permanent whitelist update.
|
|
112
|
+
- `allow_and_grant`: Execute and add to the permanent whitelist (Zero-Config).
|
|
113
|
+
- `deny`: Reject the request.
|
|
224
114
|
|
|
225
115
|
---
|
|
226
116
|
|
|
227
117
|
## Documentation
|
|
228
118
|
|
|
229
|
-
- [
|
|
230
|
-
- [
|
|
231
|
-
|
|
232
|
-
## Architecture Rules
|
|
233
|
-
|
|
234
|
-
1. **Secret Isolation**: Plane-text secrets never leave the Security Process.
|
|
235
|
-
2. **Authority Root**: The master password is the only source of administrative authority.
|
|
236
|
-
3. **Auditability**: Every administrative and agent action is recorded in the vault's audit log under the `vault-master` or agent principal.
|
|
237
|
-
4. **Binary Discovery**: Either the vault is unlocked and visible, or it is a silent directory of encrypted shards.
|
|
238
|
-
|
|
239
|
-
### Human-in-the-Loop (HITL) Workflow
|
|
240
|
-
|
|
241
|
-
If an agent attempts an action not explicitly in its white-list, the dispatch returns `PENDING` and the runtime records a capability carrier whose `write` action is still pending owner approval:
|
|
242
|
-
|
|
243
|
-
```ts
|
|
244
|
-
// In Agent process
|
|
245
|
-
const result = await agent.agentDispatch({ ... });
|
|
246
|
-
if (result.status === 'PENDING') {
|
|
247
|
-
console.log("Discovery needed: Waiting for owner approval...");
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// OR: Use the observer for real-time push
|
|
251
|
-
client.ownerOnCapabilityState((state) => {
|
|
252
|
-
if (state.writeGrant === null) {
|
|
253
|
-
console.log("New pending capability carrier:", state.requestId);
|
|
254
|
-
}
|
|
255
|
-
});
|
|
256
|
-
|
|
257
|
-
// In Owner process (GUI or Script)
|
|
258
|
-
const pending = await client.ownerListCapabilityStates({ writeGranted: false });
|
|
259
|
-
if (pending.length > 0) {
|
|
260
|
-
await client.ownerAllowAlways({
|
|
261
|
-
requestId: pending[0].requestId
|
|
262
|
-
});
|
|
263
|
-
await client.ownerApproveCapabilityRead({
|
|
264
|
-
requestId: pending[0].requestId
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## Build & Test
|
|
270
|
-
|
|
271
|
-
```bash
|
|
272
|
-
npm run build
|
|
273
|
-
npm test
|
|
274
|
-
```
|
|
275
|
-
```ts
|
|
276
|
-
// 9. Sensitive actions (v1.55.0+)
|
|
277
|
-
// Sensitive reads require the vault password again for verification
|
|
278
|
-
const plaintext = await client.ownerReadSecretPlaintext({
|
|
279
|
-
alias: 'api-token',
|
|
280
|
-
password: 'your-secure-password'
|
|
281
|
-
});
|
|
282
|
-
```
|
|
119
|
+
- [Architecture](docs/ARCHITECTURE.md) - Deep dive into the Sovereign Vault model.
|
|
120
|
+
- [Reference](docs/REFERENCE.md) - API surface and type definitions.
|
|
121
|
+
- [Migration Guide](docs/MIGRATION-1.65.md) - Moving from v1.4x (Capabilities) to v1.65 (Grants).
|
|
@@ -1,52 +1,42 @@
|
|
|
1
|
-
import type { CreatedIdentity } from "../../runtime/identity.js";
|
|
2
1
|
import { type Clock } from "../../vault-core/index.js";
|
|
3
2
|
import type { VaultService } from "../../vault-ingress/index.js";
|
|
4
|
-
import type {
|
|
3
|
+
import type { AgentDispatchIntent, AgentDispatchTransport, AgentVisibleRequestRecord, AgentVisibleSecretRecord } from "./contracts.js";
|
|
5
4
|
export interface AgentIdentity {
|
|
6
|
-
|
|
5
|
+
rootAgentId: string;
|
|
7
6
|
}
|
|
8
7
|
/**
|
|
9
8
|
* A client for agents to perform authorized operations (e.g., dispatch HTTP requests with secrets).
|
|
10
|
-
* This client uses a
|
|
9
|
+
* This client uses a session token managed by the owner.
|
|
11
10
|
* Agents can use secrets and request broader access, but they do not directly manage
|
|
12
|
-
* the secret lifecycle inside the vault.
|
|
13
|
-
* through owner actions or owner-configured vault flows that explicitly capture them.
|
|
11
|
+
* the secret lifecycle inside the vault.
|
|
14
12
|
*/
|
|
15
13
|
export interface AgentClient {
|
|
16
14
|
/**
|
|
17
15
|
* Dispatches a session-token-authenticated request to a target using a vault secret.
|
|
18
|
-
*
|
|
19
|
-
* @param intent - The destination, method, and secret alias to use.
|
|
20
|
-
* @returns The result of the remote operation.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* const result = await agent.agentDispatch({
|
|
25
|
-
* targetUrl: 'https://api.example.com/data',
|
|
26
|
-
* method: 'POST',
|
|
27
|
-
* secretAlias: 'api-token',
|
|
28
|
-
* body: JSON.stringify({ key: 'value' })
|
|
29
|
-
* });
|
|
30
|
-
* ```
|
|
16
|
+
* If the grant is missing, it will return a PENDING status.
|
|
31
17
|
*/
|
|
32
18
|
agentDispatch(intent: AgentDispatchIntent): Promise<import("../../vault-core/index.js").DispatchResult>;
|
|
33
|
-
|
|
19
|
+
/**
|
|
20
|
+
* List secrets the agent can see, including whether they are granted or not.
|
|
21
|
+
*/
|
|
34
22
|
agentListSecrets(): Promise<readonly AgentVisibleSecretRecord[]>;
|
|
23
|
+
/**
|
|
24
|
+
* List previous requests sent by this agent.
|
|
25
|
+
*/
|
|
35
26
|
agentListRequests(): Promise<readonly AgentVisibleRequestRecord[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Get details of a specific request.
|
|
29
|
+
*/
|
|
36
30
|
agentGetRequest(requestId: string): Promise<import("../../vault-core/index.js").AgentRequestResult>;
|
|
37
31
|
/**
|
|
38
|
-
* Introspects the current runtime environment, providing identity,
|
|
39
|
-
* Equivalent to '--help' or 'llms.txt' for the agent.
|
|
40
|
-
* This is the primary place where an agent should learn its operational boundary:
|
|
41
|
-
* it can use existing secrets and request more permission, but it cannot directly
|
|
42
|
-
* create, update, or remove secrets in the vault.
|
|
32
|
+
* Introspects the current runtime environment, providing identity, grants, and a toolbox manifest.
|
|
43
33
|
*/
|
|
44
34
|
agentIntrospect(): Promise<import("../../vault-core/index.js").AgentRuntimeManifest>;
|
|
45
|
-
agentSubmitCapabilityRequest(input: AgentSubmitCapabilityRequestInput): Promise<import("../../vault-core/index.js").CapabilityStateRecord>;
|
|
46
35
|
}
|
|
47
36
|
export interface CreateAgentClientOptions {
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
agentRecord: AgentIdentity | {
|
|
38
|
+
id: string;
|
|
39
|
+
};
|
|
50
40
|
vault?: VaultService;
|
|
51
41
|
transport?: AgentDispatchTransport;
|
|
52
42
|
token: string;
|
|
@@ -54,17 +44,5 @@ export interface CreateAgentClientOptions {
|
|
|
54
44
|
}
|
|
55
45
|
/**
|
|
56
46
|
* Creates an {@link AgentClient} for a delegated identity.
|
|
57
|
-
*
|
|
58
|
-
* @param options - Configuration including agent identity, capability, and transport.
|
|
59
|
-
* @returns An initialized {@link AgentClient}.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* ```ts
|
|
63
|
-
* const agent = createAgentClient({
|
|
64
|
-
* agentIdentity,
|
|
65
|
-
* capability,
|
|
66
|
-
* vault
|
|
67
|
-
* });
|
|
68
|
-
* ```
|
|
69
47
|
*/
|
|
70
48
|
export declare function createAgentClient(options: CreateAgentClientOptions): AgentClient;
|
|
@@ -3,13 +3,11 @@ import { SystemClock } from "../../vault-core/index.js";
|
|
|
3
3
|
import { LocalVaultTransport } from "../../vault-ingress/defaults.js";
|
|
4
4
|
class DefaultAgentClient {
|
|
5
5
|
_identity;
|
|
6
|
-
_capability;
|
|
7
6
|
_transport;
|
|
8
7
|
_clock;
|
|
9
8
|
_token;
|
|
10
|
-
constructor(_identity,
|
|
9
|
+
constructor(_identity, _transport, _clock, _token) {
|
|
11
10
|
this._identity = _identity;
|
|
12
|
-
this._capability = _capability;
|
|
13
11
|
this._transport = _transport;
|
|
14
12
|
this._clock = _clock;
|
|
15
13
|
this._token = _token;
|
|
@@ -22,30 +20,15 @@ class DefaultAgentClient {
|
|
|
22
20
|
throw new Error("agentDispatch requires a non-empty reason for owner review");
|
|
23
21
|
}
|
|
24
22
|
return this._transport.agentDispatch({
|
|
25
|
-
vaultId:
|
|
23
|
+
vaultId: { value: "" }, // Will be filled by transport/vault if needed, or ignored if local
|
|
26
24
|
requestId,
|
|
27
25
|
requestedAt,
|
|
28
26
|
agent: {
|
|
29
27
|
kind: "agent",
|
|
30
|
-
id: this._identity.
|
|
31
|
-
},
|
|
32
|
-
capability: {
|
|
33
|
-
vaultId: this._capability.vaultId,
|
|
34
|
-
capabilityId: this._capability.capabilityId,
|
|
35
|
-
agentId: this._capability.agentId,
|
|
36
|
-
operation: this._capability.operation,
|
|
37
|
-
customFlowId: this._capability.customFlowId,
|
|
38
|
-
write: this._capability.write,
|
|
39
|
-
read: this._capability.read,
|
|
40
|
-
issuedAt: this._capability.issuedAt,
|
|
41
|
-
expiresAt: this._capability.expiresAt,
|
|
42
|
-
revocationVersion: this._capability.revocationVersion,
|
|
43
|
-
rateLimit: this._capability.rateLimit,
|
|
44
|
-
skipAudit: this._capability.skipAudit,
|
|
28
|
+
id: this._identity.rootAgentId,
|
|
45
29
|
},
|
|
46
30
|
proof: {
|
|
47
|
-
|
|
48
|
-
token: this._token,
|
|
31
|
+
rootAgentId: this._identity.rootAgentId,
|
|
49
32
|
requestId,
|
|
50
33
|
requestedAt,
|
|
51
34
|
},
|
|
@@ -57,118 +40,63 @@ class DefaultAgentClient {
|
|
|
57
40
|
body: intent.body,
|
|
58
41
|
});
|
|
59
42
|
}
|
|
60
|
-
async _createProof(requestId, requestedAt
|
|
43
|
+
async _createProof(requestId, requestedAt) {
|
|
61
44
|
return {
|
|
62
|
-
|
|
63
|
-
token: this._token,
|
|
45
|
+
rootAgentId: this._identity.rootAgentId,
|
|
64
46
|
requestId,
|
|
65
47
|
requestedAt,
|
|
66
48
|
};
|
|
67
49
|
}
|
|
68
|
-
async agentListCapabilities() {
|
|
69
|
-
const requestedAt = this._clock.nowIso();
|
|
70
|
-
const requestId = createRequestIdValue("list_capabilities");
|
|
71
|
-
return this._transport.agentListCapabilities({
|
|
72
|
-
vaultId: this._capability.vaultId,
|
|
73
|
-
requestId,
|
|
74
|
-
requestedAt,
|
|
75
|
-
agent: { kind: "agent", id: this._identity.agentId },
|
|
76
|
-
proof: await this._createProof(requestId, requestedAt, "list_capabilities"),
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
50
|
async agentListSecrets() {
|
|
80
51
|
const requestedAt = this._clock.nowIso();
|
|
81
52
|
const requestId = createRequestIdValue("list_secrets");
|
|
82
53
|
return this._transport.agentListSecrets({
|
|
83
|
-
vaultId:
|
|
54
|
+
vaultId: { value: "" },
|
|
84
55
|
requestId,
|
|
85
56
|
requestedAt,
|
|
86
|
-
agent: { kind: "agent", id: this._identity.
|
|
87
|
-
proof: await this._createProof(requestId, requestedAt
|
|
57
|
+
agent: { kind: "agent", id: this._identity.rootAgentId },
|
|
58
|
+
proof: await this._createProof(requestId, requestedAt),
|
|
88
59
|
});
|
|
89
60
|
}
|
|
90
61
|
async agentIntrospect() {
|
|
91
62
|
const requestedAt = this._clock.nowIso();
|
|
92
63
|
const requestId = createRequestIdValue("get_manifest");
|
|
93
64
|
return this._transport.agentGetRuntimeManifest({
|
|
94
|
-
vaultId:
|
|
65
|
+
vaultId: { value: "" },
|
|
95
66
|
requestId,
|
|
96
67
|
requestedAt,
|
|
97
|
-
agent: { kind: "agent", id: this._identity.
|
|
98
|
-
proof: await this._createProof(requestId, requestedAt
|
|
68
|
+
agent: { kind: "agent", id: this._identity.rootAgentId },
|
|
69
|
+
proof: await this._createProof(requestId, requestedAt),
|
|
99
70
|
});
|
|
100
71
|
}
|
|
101
72
|
async agentListRequests() {
|
|
102
73
|
const requestedAt = this._clock.nowIso();
|
|
103
74
|
const requestId = createRequestIdValue("list_requests");
|
|
104
75
|
return this._transport.agentListRequests({
|
|
105
|
-
vaultId:
|
|
76
|
+
vaultId: { value: "" },
|
|
106
77
|
requestId,
|
|
107
78
|
requestedAt,
|
|
108
|
-
agent: { kind: "agent", id: this._identity.
|
|
109
|
-
proof: await this._createProof(requestId, requestedAt
|
|
79
|
+
agent: { kind: "agent", id: this._identity.rootAgentId },
|
|
80
|
+
proof: await this._createProof(requestId, requestedAt),
|
|
110
81
|
});
|
|
111
82
|
}
|
|
112
83
|
async agentGetRequest(targetRequestId) {
|
|
113
84
|
const requestedAt = this._clock.nowIso();
|
|
114
85
|
const requestId = createRequestIdValue("read_request_result");
|
|
115
86
|
return this._transport.agentGetRequest({
|
|
116
|
-
vaultId:
|
|
87
|
+
vaultId: { value: "" },
|
|
117
88
|
requestId,
|
|
118
89
|
requestedAt,
|
|
119
90
|
targetRequestId,
|
|
120
|
-
agent: { kind: "agent", id: this._identity.
|
|
121
|
-
proof: await this._createProof(requestId, requestedAt
|
|
91
|
+
agent: { kind: "agent", id: this._identity.rootAgentId },
|
|
92
|
+
proof: await this._createProof(requestId, requestedAt),
|
|
122
93
|
});
|
|
123
94
|
}
|
|
124
|
-
async agentSubmitCapabilityRequest(input) {
|
|
125
|
-
const requestedAt = input.requestedAt ?? this._clock.nowIso();
|
|
126
|
-
const requestId = createRequestIdValue("submit_capability_request");
|
|
127
|
-
const reason = input.reason.trim();
|
|
128
|
-
if (!reason) {
|
|
129
|
-
throw new Error("agentSubmitCapabilityRequest requires a non-empty reason for owner review");
|
|
130
|
-
}
|
|
131
|
-
const payload = {
|
|
132
|
-
write: {
|
|
133
|
-
...input.write,
|
|
134
|
-
secretAliases: input.secretAliases ?? null,
|
|
135
|
-
},
|
|
136
|
-
read: input.read,
|
|
137
|
-
operation: input.operation ?? "dispatch_http",
|
|
138
|
-
reason,
|
|
139
|
-
};
|
|
140
|
-
return this._transport.agentSubmitCapabilityRequest({
|
|
141
|
-
vaultId: this._capability.vaultId,
|
|
142
|
-
requestId,
|
|
143
|
-
requestedAt,
|
|
144
|
-
agent: { kind: "agent", id: this._identity.agentId },
|
|
145
|
-
proof: await this._createProof(requestId, requestedAt, "submit_capability_request", payload),
|
|
146
|
-
capability: {
|
|
147
|
-
operation: input.operation ?? "dispatch_http",
|
|
148
|
-
write: {
|
|
149
|
-
scope: input.write.scope,
|
|
150
|
-
methods: [...input.write.methods],
|
|
151
|
-
},
|
|
152
|
-
read: { paths: [...input.read.paths] },
|
|
153
|
-
},
|
|
154
|
-
secretAliases: input.secretAliases ? [...input.secretAliases] : undefined,
|
|
155
|
-
reason,
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function isCreateAgentClientOptions(value) {
|
|
160
|
-
return typeof value === "object" && value !== null && "agentIdentity" in value && "capability" in value;
|
|
161
95
|
}
|
|
162
96
|
function resolveAgentIdentity(options) {
|
|
163
|
-
return "
|
|
164
|
-
? options.
|
|
165
|
-
: {
|
|
166
|
-
}
|
|
167
|
-
function resolveAgentToken(options) {
|
|
168
|
-
if (!options.token) {
|
|
169
|
-
throw new Error("createAgentClient() requires a session token; raw private-key execution is not supported");
|
|
170
|
-
}
|
|
171
|
-
return options.token;
|
|
97
|
+
return "rootAgentId" in options.agentRecord
|
|
98
|
+
? options.agentRecord
|
|
99
|
+
: { rootAgentId: options.agentRecord.id };
|
|
172
100
|
}
|
|
173
101
|
function resolveAgentTransport(options) {
|
|
174
102
|
if (options.transport) {
|
|
@@ -181,23 +109,8 @@ function resolveAgentTransport(options) {
|
|
|
181
109
|
}
|
|
182
110
|
/**
|
|
183
111
|
* Creates an {@link AgentClient} for a delegated identity.
|
|
184
|
-
*
|
|
185
|
-
* @param options - Configuration including agent identity, capability, and transport.
|
|
186
|
-
* @returns An initialized {@link AgentClient}.
|
|
187
|
-
*
|
|
188
|
-
* @example
|
|
189
|
-
* ```ts
|
|
190
|
-
* const agent = createAgentClient({
|
|
191
|
-
* agentIdentity,
|
|
192
|
-
* capability,
|
|
193
|
-
* vault
|
|
194
|
-
* });
|
|
195
|
-
* ```
|
|
196
112
|
*/
|
|
197
113
|
export function createAgentClient(options) {
|
|
198
|
-
|
|
199
|
-
throw new Error("createAgentClient() requires a single options object");
|
|
200
|
-
}
|
|
201
|
-
return new DefaultAgentClient(resolveAgentIdentity(options), options.capability, resolveAgentTransport(options), options.clock ?? new SystemClock(), resolveAgentToken(options));
|
|
114
|
+
return new DefaultAgentClient(resolveAgentIdentity(options), resolveAgentTransport(options), options.clock ?? new SystemClock(), options.token);
|
|
202
115
|
}
|
|
203
116
|
//# sourceMappingURL=client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/agent/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/clients/agent/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,WAAW,EAAc,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAuDtE,MAAM,kBAAkB;IAEH;IACA;IACA;IACA;IAJnB,YACmB,SAAwB,EACxB,UAAkC,EAClC,MAAa,EACb,MAAc;QAHd,cAAS,GAAT,SAAS,CAAe;QACxB,eAAU,GAAV,UAAU,CAAwB;QAClC,WAAM,GAAN,MAAM,CAAO;QACb,WAAM,GAAN,MAAM,CAAQ;IAC9B,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,MAA2B;QAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,IAAI,CAAC,MAAM,CAAC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