@the-ai-company/cbio-node-runtime 1.48.6 → 1.50.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.
- package/README.md +44 -28
- package/dist/clients/agent/client.d.ts +8 -6
- package/dist/clients/agent/client.js +67 -49
- package/dist/clients/agent/client.js.map +1 -1
- package/dist/clients/agent/contracts.d.ts +13 -1
- package/dist/clients/agent/index.d.ts +1 -1
- package/dist/clients/owner/client.d.ts +20 -14
- package/dist/clients/owner/client.js +144 -52
- package/dist/clients/owner/client.js.map +1 -1
- package/dist/clients/owner/contracts.d.ts +58 -28
- package/dist/clients/owner/index.d.ts +1 -1
- package/dist/runtime/index.d.ts +4 -3
- package/dist/runtime/index.js +5 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/vault-core/contracts.d.ts +91 -3
- package/dist/vault-core/contracts.js +3 -0
- package/dist/vault-core/contracts.js.map +1 -1
- package/dist/vault-core/core.d.ts +44 -25
- package/dist/vault-core/core.js +290 -73
- package/dist/vault-core/core.js.map +1 -1
- package/dist/vault-core/defaults.d.ts +9 -1
- package/dist/vault-core/defaults.js +39 -6
- package/dist/vault-core/defaults.js.map +1 -1
- package/dist/vault-core/index.d.ts +3 -3
- package/dist/vault-core/index.js +1 -1
- package/dist/vault-core/index.js.map +1 -1
- package/dist/vault-core/persistence.d.ts +1 -0
- package/dist/vault-core/persistence.js +7 -1
- package/dist/vault-core/persistence.js.map +1 -1
- package/dist/vault-core/ports.d.ts +8 -0
- package/dist/vault-ingress/defaults.d.ts +4 -1
- package/dist/vault-ingress/defaults.js +12 -3
- package/dist/vault-ingress/defaults.js.map +1 -1
- package/dist/vault-ingress/index.d.ts +137 -21
- package/dist/vault-ingress/index.js +156 -46
- package/dist/vault-ingress/index.js.map +1 -1
- package/dist/vault-ingress/remote-transport.d.ts +7 -2
- package/dist/vault-ingress/remote-transport.js +61 -3
- package/dist/vault-ingress/remote-transport.js.map +1 -1
- package/dist/vault-ingress/server-utils.d.ts +2 -1
- package/dist/vault-ingress/server-utils.js +42 -1
- package/dist/vault-ingress/server-utils.js.map +1 -1
- package/docs/REFERENCE.md +46 -17
- package/docs/api/README.md +10 -3
- package/docs/api/classes/IdentityError.md +1 -1
- package/docs/api/classes/VaultCore.md +258 -102
- package/docs/api/classes/VaultCoreError.md +1 -1
- package/docs/api/enumerations/IdentityErrorCode.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/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 +21 -0
- 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 +41 -5
- package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
- package/docs/api/interfaces/AgentDispatchTransport.md +51 -3
- package/docs/api/interfaces/AgentIdentity.md +1 -1
- package/docs/api/interfaces/AgentSigner.md +1 -1
- package/docs/api/interfaces/AgentSubmitCapabilityRequestInput.md +41 -0
- package/docs/api/interfaces/CbioRuntime.md +21 -1
- package/docs/api/interfaces/CreateAgentClientOptions.md +3 -9
- package/docs/api/interfaces/CreateIdentityOptions.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 +17 -0
- package/docs/api/interfaces/OwnerDefineSecretTargetsInput.md +1 -1
- package/docs/api/interfaces/OwnerSecretTargetBinding.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 +23 -0
- package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
- package/docs/api/interfaces/VaultClient.md +123 -33
- package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
- package/docs/api/interfaces/VaultCreateAgentInput.md +1 -7
- package/docs/api/interfaces/VaultDeleteSecretInput.md +1 -1
- package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
- package/docs/api/interfaces/VaultGrantCapabilityInput.md +13 -19
- package/docs/api/interfaces/VaultIdentity.md +1 -1
- package/docs/api/interfaces/VaultImportAgentInput.md +29 -0
- package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
- package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
- package/docs/api/interfaces/VaultListSecretsInput.md +11 -0
- 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/VaultRegisterFlowInput.md +1 -1
- package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
- package/docs/api/interfaces/VaultSigner.md +1 -1
- package/docs/api/interfaces/VaultSubmitCapabilityRequestInput.md +79 -0
- package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
- package/docs/api/type-aliases/AgentVisibleSecretRecord.md +7 -0
- package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
- package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
- package/examples/process-isolation.ts +24 -15
- package/package.json +1 -1
- package/docs/api/interfaces/VaultRegisterAgentInput.md +0 -41
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
export class AgentDispatchHttpTransport {
|
|
9
9
|
_url;
|
|
10
10
|
_fetchImpl;
|
|
11
|
-
|
|
11
|
+
_controlUrl;
|
|
12
|
+
constructor(_url, _fetchImpl = fetch, _controlUrl = new URL("./agent/control", _url).toString()) {
|
|
12
13
|
this._url = _url;
|
|
13
14
|
this._fetchImpl = _fetchImpl;
|
|
15
|
+
this._controlUrl = _controlUrl;
|
|
14
16
|
}
|
|
15
|
-
async
|
|
17
|
+
async agentDispatch(request) {
|
|
16
18
|
const remoteRequest = {
|
|
17
19
|
vaultId: request.vaultId.value,
|
|
18
20
|
requestId: request.requestId,
|
|
@@ -25,7 +27,6 @@ export class AgentDispatchHttpTransport {
|
|
|
25
27
|
headers: request.headers,
|
|
26
28
|
body: request.body,
|
|
27
29
|
proof: {
|
|
28
|
-
signature: request.proof.signature,
|
|
29
30
|
token: request.proof.token,
|
|
30
31
|
},
|
|
31
32
|
};
|
|
@@ -47,5 +48,62 @@ export class AgentDispatchHttpTransport {
|
|
|
47
48
|
}
|
|
48
49
|
return payload.result;
|
|
49
50
|
}
|
|
51
|
+
async agentListCapabilities(request) {
|
|
52
|
+
const payload = await this._postControl({
|
|
53
|
+
action: "list_capabilities",
|
|
54
|
+
vaultId: request.vaultId.value,
|
|
55
|
+
requestId: request.requestId,
|
|
56
|
+
requestedAt: request.requestedAt,
|
|
57
|
+
agentId: request.agent.id,
|
|
58
|
+
proof: { token: request.proof.token },
|
|
59
|
+
});
|
|
60
|
+
return payload;
|
|
61
|
+
}
|
|
62
|
+
async agentListSecrets(request) {
|
|
63
|
+
const payload = await this._postControl({
|
|
64
|
+
action: "list_secrets",
|
|
65
|
+
vaultId: request.vaultId.value,
|
|
66
|
+
requestId: request.requestId,
|
|
67
|
+
requestedAt: request.requestedAt,
|
|
68
|
+
agentId: request.agent.id,
|
|
69
|
+
proof: { token: request.proof.token },
|
|
70
|
+
});
|
|
71
|
+
return payload;
|
|
72
|
+
}
|
|
73
|
+
async agentSubmitCapabilityRequest(request) {
|
|
74
|
+
const payload = await this._postControl({
|
|
75
|
+
action: "submit_capability_request",
|
|
76
|
+
vaultId: request.vaultId.value,
|
|
77
|
+
requestId: request.requestId,
|
|
78
|
+
requestedAt: request.requestedAt,
|
|
79
|
+
agentId: request.agent.id,
|
|
80
|
+
proof: { token: request.proof.token },
|
|
81
|
+
scope: request.scope.scope,
|
|
82
|
+
methods: [...request.scope.methods],
|
|
83
|
+
operation: request.scope.operation,
|
|
84
|
+
secretAliases: request.scope.secretAliases ? [...request.scope.secretAliases] : [],
|
|
85
|
+
justification: request.justification,
|
|
86
|
+
});
|
|
87
|
+
return payload;
|
|
88
|
+
}
|
|
89
|
+
async _postControl(body) {
|
|
90
|
+
const response = await this._fetchImpl(this._controlUrl, {
|
|
91
|
+
method: "POST",
|
|
92
|
+
headers: {
|
|
93
|
+
"Content-Type": "application/json",
|
|
94
|
+
},
|
|
95
|
+
body: JSON.stringify(body),
|
|
96
|
+
});
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
throw new Error(`VAULT_REMOTE_TRANSPORT_HTTP_ERROR: ${response.status} ${response.statusText}`);
|
|
99
|
+
}
|
|
100
|
+
const payload = await response.json();
|
|
101
|
+
if (!payload.ok) {
|
|
102
|
+
const error = new Error(`${payload.error.code}: ${payload.error.message}`);
|
|
103
|
+
error.code = payload.error.code;
|
|
104
|
+
throw error;
|
|
105
|
+
}
|
|
106
|
+
return payload.result;
|
|
107
|
+
}
|
|
50
108
|
}
|
|
51
109
|
//# sourceMappingURL=remote-transport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-transport.js","sourceRoot":"","sources":["../../src/vault-ingress/remote-transport.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAElB;IACA;
|
|
1
|
+
{"version":3,"file":"remote-transport.js","sourceRoot":"","sources":["../../src/vault-ingress/remote-transport.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAElB;IACA;IACA;IAHnB,YACmB,IAAY,EACZ,aAA2B,KAAK,EAChC,cAAsB,IAAI,GAAG,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC,QAAQ,EAAE;QAFjE,SAAI,GAAJ,IAAI,CAAQ;QACZ,eAAU,GAAV,UAAU,CAAsB;QAChC,gBAAW,GAAX,WAAW,CAAsD;IACjF,CAAC;IAEJ,KAAK,CAAC,aAAa,CAAC,OAAwB;QAC1C,MAAM,aAAa,GAA8B;YAC/C,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK;YAC9B,SAAS,EAAE,OAAO,CAAC,SAAS;YAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,YAAY,EAA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,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE;YAClF,aAAa,EAAE,OAAO,CAAC,aAAa;SACrC,CAAC,CAAC;QACH,OAAO,OAA0E,CAAC;IACpF,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,IAAa;QACtC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE;YACvD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,sCAAsC,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAClG,CAAC;QACD,MAAM,OAAO,GAAyG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC5I,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;YAChB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAC1E,KAAa,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;YACzC,MAAM,KAAK,CAAC;QACd,CAAC;QACD,OAAO,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { VaultService, VaultAgentDispatchResponse, VaultAgentDispatchErrorResponse } from "./index.js";
|
|
1
|
+
import type { VaultService, VaultAgentDispatchResponse, VaultAgentDispatchErrorResponse, VaultAgentControlResponse, VaultAgentControlErrorResponse } from "./index.js";
|
|
2
2
|
/**
|
|
3
3
|
* Standard server-side helper to handle a vault agent dispatch request from an HTTP body.
|
|
4
4
|
* This can be used in any HTTP server framework (Express, Fastify, etc.).
|
|
@@ -8,3 +8,4 @@ import type { VaultService, VaultAgentDispatchResponse, VaultAgentDispatchErrorR
|
|
|
8
8
|
* @returns A JSON-serializable response object.
|
|
9
9
|
*/
|
|
10
10
|
export declare function handleVaultHttpDispatch(service: VaultService, body: unknown): Promise<VaultAgentDispatchResponse | VaultAgentDispatchErrorResponse>;
|
|
11
|
+
export declare function handleVaultAgentControlHttp(service: VaultService, body: unknown): Promise<VaultAgentControlResponse | VaultAgentControlErrorResponse>;
|
|
@@ -13,6 +13,47 @@ export async function handleVaultHttpDispatch(service, body) {
|
|
|
13
13
|
error: { code: "VAULT_INVALID_REQUEST_BODY", message: "Request body must be a JSON object" },
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const request = body;
|
|
17
|
+
if (!request.proof?.token) {
|
|
18
|
+
return {
|
|
19
|
+
ok: false,
|
|
20
|
+
error: { code: "VAULT_REMOTE_TOKEN_REQUIRED", message: "Remote agent dispatch requires a session token" },
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return service.agentHandleDispatch(request);
|
|
17
24
|
}
|
|
25
|
+
export async function handleVaultAgentControlHttp(service, body) {
|
|
26
|
+
if (!body || typeof body !== "object") {
|
|
27
|
+
return {
|
|
28
|
+
ok: false,
|
|
29
|
+
error: { code: "VAULT_INVALID_REQUEST_BODY", message: "Request body must be a JSON object" },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const request = body;
|
|
33
|
+
if (!request.proof?.token) {
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
error: { code: "VAULT_REMOTE_TOKEN_REQUIRED", message: "Remote agent control requires a session token" },
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
return service.agentHandleControl(request);
|
|
40
|
+
}
|
|
41
|
+
/*
|
|
42
|
+
* Owner remote control is intentionally disabled for now.
|
|
43
|
+
* The original wiring is kept here as a commented stub so it can be restored
|
|
44
|
+
* after owner-side remote authentication is designed and implemented.
|
|
45
|
+
*
|
|
46
|
+
* export async function handleVaultOwnerControlHttp(
|
|
47
|
+
* service: VaultService,
|
|
48
|
+
* body: unknown,
|
|
49
|
+
* ): Promise<VaultOwnerControlResponse | VaultOwnerControlErrorResponse> {
|
|
50
|
+
* if (!body || typeof body !== "object") {
|
|
51
|
+
* return {
|
|
52
|
+
* ok: false,
|
|
53
|
+
* error: { code: "VAULT_INVALID_REQUEST_BODY", message: "Request body must be a JSON object" },
|
|
54
|
+
* };
|
|
55
|
+
* }
|
|
56
|
+
* return service.ownerHandleControl(body as VaultOwnerControlRequest);
|
|
57
|
+
* }
|
|
58
|
+
*/
|
|
18
59
|
//# sourceMappingURL=server-utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.js","sourceRoot":"","sources":["../../src/vault-ingress/server-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.js","sourceRoot":"","sources":["../../src/vault-ingress/server-utils.ts"],"names":[],"mappings":"AAUA;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAqB,EACrB,IAAa;IAEb,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,oCAAoC,EAAE;SAC7F,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAA0C,CAAC;IAC3D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;QAC1B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE,gDAAgD,EAAE;SAC1G,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,mBAAmB,CAAC,OAAoC,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAqB,EACrB,IAAa;IAEb,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,4BAA4B,EAAE,OAAO,EAAE,oCAAoC,EAAE;SAC7F,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAG,IAAyC,CAAC;IAC1D,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC;QAC1B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,EAAE,IAAI,EAAE,6BAA6B,EAAE,OAAO,EAAE,+CAA+C,EAAE;SACzG,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,kBAAkB,CAAC,OAAmC,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG"}
|
package/docs/REFERENCE.md
CHANGED
|
@@ -36,42 +36,71 @@ Returns a `string[]` of vault IDs found in the storage.
|
|
|
36
36
|
|
|
37
37
|
### 1. Managed Identity (Recommended)
|
|
38
38
|
Identity material (private keys) generated and stored securely within the vault's own registry.
|
|
39
|
-
- Use `client.
|
|
39
|
+
- Use `client.ownerCreateAgent(...)` to manage these.
|
|
40
40
|
- **Session Tokens**: Owners can issue revocable `sat_...` tokens for managed agents to enable stateless authentication without raw private keys.
|
|
41
41
|
|
|
42
42
|
### 2. External Identity
|
|
43
|
-
Identity material managed
|
|
43
|
+
Identity material already managed elsewhere can be imported into vault custody via `client.ownerImportAgent({ privateKey, ... })`.
|
|
44
44
|
|
|
45
45
|
## Vault Client (Owner/Admin)
|
|
46
46
|
|
|
47
47
|
The `VaultClient` provides the administrative interface for the vault.
|
|
48
48
|
|
|
49
49
|
### Core Operations
|
|
50
|
-
- `
|
|
51
|
-
- `
|
|
52
|
-
- `
|
|
53
|
-
- `
|
|
54
|
-
- `
|
|
55
|
-
- `
|
|
56
|
-
- `
|
|
57
|
-
- `
|
|
58
|
-
- `
|
|
59
|
-
- `
|
|
60
|
-
- `
|
|
61
|
-
- `
|
|
62
|
-
- `
|
|
50
|
+
- `ownerWriteSecret(...)`: Store a secret and bind it to specific targets in one step.
|
|
51
|
+
- `ownerCreateAgent(...)`: Generate and host a new agent identity, then return its public record plus a session token.
|
|
52
|
+
- `ownerImportAgent(...)`: Import an existing private key into vault custody, then return its public record plus a session token.
|
|
53
|
+
- `ownerListAgents()`: Enumerate authorized agents and retrieve managed private keys.
|
|
54
|
+
- `ownerGrantCapability(...)`: Assign specific secret-use permissions to an agent.
|
|
55
|
+
- `ownerSubmitCapabilityRequest(...)`: Submit a broader pending capability request for later owner review.
|
|
56
|
+
- `ownerListPendingCapabilityRequests()`: List proactive capability requests that are waiting for approval.
|
|
57
|
+
- `ownerApproveCapabilityRequest({ requestId, capabilityId })`: Turn a pending capability request into a real stored capability.
|
|
58
|
+
- `ownerRejectCapabilityRequest(requestId)`: Deny a pending capability request.
|
|
59
|
+
- `ownerOnPendingCapabilityRequest(callback)`: Register a real-time observer to receive proactive capability requests.
|
|
60
|
+
- `ownerListPendingDispatches()`: List agent requests awaiting manual approval (HITL).
|
|
61
|
+
- `ownerApproveDispatch({ requestId, permanent, skipAudit })`: Grant a stalled request manual authorization.
|
|
62
|
+
- `ownerOnPendingDispatch(callback)`: Register a real-time observer to receive push notifications for discovery requests.
|
|
63
|
+
- `ownerRejectDispatch(requestId)`: Deny a stalled request.
|
|
64
|
+
- `ownerIssueSessionToken(input)`: Issue a session token for a specific agent.
|
|
65
|
+
- `ownerIssueAllSessionTokens()`: Batch-issue session tokens for ALL registered agents (Automatic during `createVaultClient` warmup).
|
|
66
|
+
- `ownerRevokeSessionToken({ token })`: Invalidate a specific session token.
|
|
67
|
+
- `ownerExportSecret(...)`: Reveal a secret's plaintext (requires active authority).
|
|
68
|
+
- `ownerReadAudit(...)`: Access the append-only record of all vault actions.
|
|
63
69
|
|
|
64
70
|
## Agent Client (Consumer)
|
|
65
71
|
|
|
66
72
|
The `AgentClient` is used by delegated processes (e.g., LLMs or background workers) to perform authorized actions.
|
|
67
73
|
|
|
68
74
|
### Core Operations
|
|
69
|
-
- `
|
|
75
|
+
- `agentDispatch(...)`: Use a granted capability to send a secret to an authorized target.
|
|
70
76
|
- **Status**: Returns `SUCCEEDED`, `FAILED`, or `PENDING`.
|
|
71
77
|
- **Discovery Flow**: If an agent attempts an action not explicitly in its white-list, the request is automatically stalled as `PENDING` for owner review.
|
|
72
|
-
-
|
|
78
|
+
- `agentListCapabilities()`: Read the current capability table granted to that agent.
|
|
79
|
+
- `agentListSecrets()`: Read all secret metadata in the vault, with per-secret authorization markers showing which entries the agent can currently use.
|
|
80
|
+
- `agentSubmitCapabilityRequest(...)`: Ask the owner for a broader `scope + methods` grant before dispatching.
|
|
81
|
+
- **Security**: The agent never handles the vault's master password. Agent execution uses **Session Tokens** rather than raw private-key dispatch.
|
|
73
82
|
- **Auditing**: Dispatches are audited by default. Set `skipAudit: true` in the capability (or during approval) to disable logging for specific actions.
|
|
74
83
|
|
|
84
|
+
## Proactive Capability Approval
|
|
85
|
+
|
|
86
|
+
The runtime now supports a second approval path alongside dispatch discovery:
|
|
87
|
+
|
|
88
|
+
- **Dispatch discovery**: A concrete dispatch misses existing capability coverage and becomes `PENDING`.
|
|
89
|
+
- **Capability request**: An external planner or controller submits a broader capability proposal before any dispatch is attempted.
|
|
90
|
+
|
|
91
|
+
This is useful for LLM-driven planners that can infer the needed scope ahead of time, for example:
|
|
92
|
+
- scope `https://api.example.com/users/*`
|
|
93
|
+
- methods `["GET"]`
|
|
94
|
+
|
|
95
|
+
The request stays pending until the owner approves or rejects it:
|
|
96
|
+
- `ownerSubmitCapabilityRequest(...)` creates the request record.
|
|
97
|
+
- `ownerListPendingCapabilityRequests()` reads the current queue.
|
|
98
|
+
- `ownerApproveCapabilityRequest(...)` persists a real capability.
|
|
99
|
+
- `ownerRejectCapabilityRequest(...)` removes the request without granting access.
|
|
100
|
+
- `ownerOnPendingCapabilityRequest(...)` supports push-style owner interfaces.
|
|
101
|
+
|
|
102
|
+
The proactive request flow does not replace dispatch discovery. It is an additional, explicit path for requesting broader access without generating one pending dispatch per resource ID.
|
|
103
|
+
|
|
75
104
|
## Storage Layout
|
|
76
105
|
|
|
77
106
|
The vault uses a unified encrypted partition:
|
package/docs/api/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
**CBIO Node Runtime Agent API v1.
|
|
1
|
+
**CBIO Node Runtime Agent API v1.50.0**
|
|
2
2
|
|
|
3
3
|
***
|
|
4
4
|
|
|
5
|
-
# CBIO Node Runtime Agent API v1.
|
|
5
|
+
# CBIO Node Runtime Agent API v1.50.0
|
|
6
6
|
|
|
7
7
|
## Enumerations
|
|
8
8
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- [AgentDispatchTransport](interfaces/AgentDispatchTransport.md)
|
|
22
22
|
- [AgentIdentity](interfaces/AgentIdentity.md)
|
|
23
23
|
- [AgentSigner](interfaces/AgentSigner.md)
|
|
24
|
+
- [AgentSubmitCapabilityRequestInput](interfaces/AgentSubmitCapabilityRequestInput.md)
|
|
24
25
|
- [CbioRuntime](interfaces/CbioRuntime.md)
|
|
25
26
|
- [CreateAgentClientOptions](interfaces/CreateAgentClientOptions.md)
|
|
26
27
|
- [CreatedVault](interfaces/CreatedVault.md)
|
|
@@ -32,6 +33,7 @@
|
|
|
32
33
|
- [InitializedVaultCustody](interfaces/InitializedVaultCustody.md)
|
|
33
34
|
- [InitializeVaultCustodyOptions](interfaces/InitializeVaultCustodyOptions.md)
|
|
34
35
|
- [IStorageProvider](interfaces/IStorageProvider.md)
|
|
36
|
+
- [OwnerAgentProvisionResult](interfaces/OwnerAgentProvisionResult.md)
|
|
35
37
|
- [OwnerDefineSecretTargetsInput](interfaces/OwnerDefineSecretTargetsInput.md)
|
|
36
38
|
- [OwnerSecretTargetBinding](interfaces/OwnerSecretTargetBinding.md)
|
|
37
39
|
- [OwnerStoreSecretInput](interfaces/OwnerStoreSecretInput.md)
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
- [RecoverVaultOptions](interfaces/RecoverVaultOptions.md)
|
|
41
43
|
- [RestoreIdentityOptions](interfaces/RestoreIdentityOptions.md)
|
|
42
44
|
- [Signer](interfaces/Signer.md)
|
|
45
|
+
- [VaultApproveCapabilityRequestInput](interfaces/VaultApproveCapabilityRequestInput.md)
|
|
43
46
|
- [VaultAuditQueryInput](interfaces/VaultAuditQueryInput.md)
|
|
44
47
|
- [VaultClient](interfaces/VaultClient.md)
|
|
45
48
|
- [VaultCoreDependenciesOptions](interfaces/VaultCoreDependenciesOptions.md)
|
|
@@ -48,19 +51,22 @@
|
|
|
48
51
|
- [VaultExportSecretInput](interfaces/VaultExportSecretInput.md)
|
|
49
52
|
- [VaultGrantCapabilityInput](interfaces/VaultGrantCapabilityInput.md)
|
|
50
53
|
- [VaultIdentity](interfaces/VaultIdentity.md)
|
|
54
|
+
- [VaultImportAgentInput](interfaces/VaultImportAgentInput.md)
|
|
51
55
|
- [VaultListAgentsInput](interfaces/VaultListAgentsInput.md)
|
|
52
56
|
- [VaultListCapabilitiesInput](interfaces/VaultListCapabilitiesInput.md)
|
|
57
|
+
- [VaultListSecretsInput](interfaces/VaultListSecretsInput.md)
|
|
53
58
|
- [VaultMetadata](interfaces/VaultMetadata.md)
|
|
54
59
|
- [VaultObject](interfaces/VaultObject.md)
|
|
55
60
|
- [VaultProfile](interfaces/VaultProfile.md)
|
|
56
|
-
- [VaultRegisterAgentInput](interfaces/VaultRegisterAgentInput.md)
|
|
57
61
|
- [VaultRegisterFlowInput](interfaces/VaultRegisterFlowInput.md)
|
|
58
62
|
- [VaultRevokeCapabilityInput](interfaces/VaultRevokeCapabilityInput.md)
|
|
59
63
|
- [VaultSigner](interfaces/VaultSigner.md)
|
|
64
|
+
- [VaultSubmitCapabilityRequestInput](interfaces/VaultSubmitCapabilityRequestInput.md)
|
|
60
65
|
|
|
61
66
|
## Type Aliases
|
|
62
67
|
|
|
63
68
|
- [AgentCapabilityEnvelope](type-aliases/AgentCapabilityEnvelope.md)
|
|
69
|
+
- [AgentVisibleSecretRecord](type-aliases/AgentVisibleSecretRecord.md)
|
|
64
70
|
- [CbioRuntimeModule](type-aliases/CbioRuntimeModule.md)
|
|
65
71
|
|
|
66
72
|
## Variables
|
|
@@ -84,6 +90,7 @@
|
|
|
84
90
|
- [deriveIdentityId](functions/deriveIdentityId.md)
|
|
85
91
|
- [deriveVaultWorkingKeyFromPassword](functions/deriveVaultWorkingKeyFromPassword.md)
|
|
86
92
|
- [getDefaultWorkspaceDir](functions/getDefaultWorkspaceDir.md)
|
|
93
|
+
- [handleVaultAgentControlHttp](functions/handleVaultAgentControlHttp.md)
|
|
87
94
|
- [handleVaultHttpDispatch](functions/handleVaultHttpDispatch.md)
|
|
88
95
|
- [initializeVaultCustody](functions/initializeVaultCustody.md)
|
|
89
96
|
- [listVaults](functions/listVaults.md)
|