@the-ai-company/cbio-node-runtime 1.55.1 → 1.57.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.
Files changed (140) hide show
  1. package/README.md +53 -29
  2. package/dist/clients/agent/client.d.ts +2 -2
  3. package/dist/clients/agent/contracts.d.ts +3 -2
  4. package/dist/clients/owner/client.d.ts +8 -11
  5. package/dist/clients/owner/client.js +61 -43
  6. package/dist/clients/owner/client.js.map +1 -1
  7. package/dist/clients/owner/contracts.d.ts +23 -10
  8. package/dist/clients/owner/index.d.ts +1 -1
  9. package/dist/runtime/index.d.ts +3 -1
  10. package/dist/runtime/index.js +1 -0
  11. package/dist/runtime/index.js.map +1 -1
  12. package/dist/runtime/owner-session.d.ts +26 -0
  13. package/dist/runtime/owner-session.js +89 -0
  14. package/dist/runtime/owner-session.js.map +1 -0
  15. package/dist/vault-core/contracts.d.ts +48 -35
  16. package/dist/vault-core/contracts.js.map +1 -1
  17. package/dist/vault-core/core.d.ts +16 -21
  18. package/dist/vault-core/core.js +278 -159
  19. package/dist/vault-core/core.js.map +1 -1
  20. package/dist/vault-core/defaults.d.ts +8 -20
  21. package/dist/vault-core/defaults.js +14 -37
  22. package/dist/vault-core/defaults.js.map +1 -1
  23. package/dist/vault-core/index.d.ts +3 -3
  24. package/dist/vault-core/index.js +1 -1
  25. package/dist/vault-core/index.js.map +1 -1
  26. package/dist/vault-core/persistence.d.ts +8 -6
  27. package/dist/vault-core/persistence.js +17 -9
  28. package/dist/vault-core/persistence.js.map +1 -1
  29. package/dist/vault-core/ports.d.ts +8 -20
  30. package/dist/vault-ingress/defaults.d.ts +2 -2
  31. package/dist/vault-ingress/index.d.ts +14 -33
  32. package/dist/vault-ingress/index.js +18 -31
  33. package/dist/vault-ingress/index.js.map +1 -1
  34. package/dist/vault-ingress/remote-transport.d.ts +2 -2
  35. package/dist/vault-ingress/remote-transport.js.map +1 -1
  36. package/docs/MIGRATION-1.51.md +4 -1
  37. package/docs/REFERENCE.md +44 -30
  38. package/docs/api/README.md +7 -2
  39. package/docs/api/classes/IdentityError.md +1 -1
  40. package/docs/api/classes/OwnerClientError.md +1 -1
  41. package/docs/api/classes/VaultCore.md +34 -94
  42. package/docs/api/classes/VaultCoreError.md +1 -1
  43. package/docs/api/enumerations/IdentityErrorCode.md +1 -1
  44. package/docs/api/enumerations/OwnerClientErrorCode.md +1 -1
  45. package/docs/api/functions/createAgentClient.md +1 -1
  46. package/docs/api/functions/createIdentity.md +1 -1
  47. package/docs/api/functions/createOwnerHttpFlowBoundary.md +1 -1
  48. package/docs/api/functions/createOwnerSession.md +37 -0
  49. package/docs/api/functions/createPersistentVaultCoreDependencies.md +1 -1
  50. package/docs/api/functions/createStandardAcquireBoundary.md +1 -1
  51. package/docs/api/functions/createStandardDispatchBoundary.md +1 -1
  52. package/docs/api/functions/createVault.md +1 -1
  53. package/docs/api/functions/createVaultClient.md +1 -1
  54. package/docs/api/functions/createVaultCore.md +1 -1
  55. package/docs/api/functions/createVaultCoreDependencies.md +1 -1
  56. package/docs/api/functions/createVaultService.md +1 -1
  57. package/docs/api/functions/createWorkspaceStorage.md +1 -1
  58. package/docs/api/functions/deriveIdentityId.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/wrapVaultCoreAsVaultService.md +1 -1
  71. package/docs/api/functions/writeVaultProfile.md +1 -1
  72. package/docs/api/interfaces/AgentClient.md +5 -5
  73. package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
  74. package/docs/api/interfaces/AgentDispatchTransport.md +5 -5
  75. package/docs/api/interfaces/AgentIdentity.md +1 -1
  76. package/docs/api/interfaces/AgentSigner.md +1 -1
  77. package/docs/api/interfaces/AgentSubmitCapabilityRequestInput.md +1 -1
  78. package/docs/api/interfaces/CbioRuntime.md +39 -1
  79. package/docs/api/interfaces/CreateAgentClientOptions.md +1 -1
  80. package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
  81. package/docs/api/interfaces/CreateOwnerSessionOptions.md +245 -0
  82. package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
  83. package/docs/api/interfaces/CreateVaultClientOptions.md +1 -1
  84. package/docs/api/interfaces/CreateVaultOptions.md +1 -1
  85. package/docs/api/interfaces/CreatedVault.md +1 -1
  86. package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -1
  87. package/docs/api/interfaces/IStorageProvider.md +1 -1
  88. package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
  89. package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
  90. package/docs/api/interfaces/OwnerAgentProvisionResult.md +1 -1
  91. package/docs/api/interfaces/OwnerDefineSecretTargetsInput.md +1 -1
  92. package/docs/api/interfaces/OwnerSecretTargetBinding.md +1 -1
  93. package/docs/api/interfaces/OwnerSensitiveActionConfirmation.md +1 -1
  94. package/docs/api/interfaces/OwnerSensitiveActionContext.md +1 -1
  95. package/docs/api/interfaces/OwnerSession.md +95 -0
  96. package/docs/api/interfaces/OwnerStoreSecretInput.md +1 -1
  97. package/docs/api/interfaces/OwnerWriteSecretInput.md +1 -1
  98. package/docs/api/interfaces/RecoverVaultOptions.md +5 -1
  99. package/docs/api/interfaces/RecoveredVault.md +1 -1
  100. package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
  101. package/docs/api/interfaces/Signer.md +1 -1
  102. package/docs/api/interfaces/VaultApproveCapabilityRequestInput.md +1 -1
  103. package/docs/api/interfaces/VaultApproveDispatchInput.md +1 -1
  104. package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
  105. package/docs/api/interfaces/VaultClient.md +41 -77
  106. package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
  107. package/docs/api/interfaces/VaultCreateAgentInput.md +1 -1
  108. package/docs/api/interfaces/VaultDeleteSecretInput.md +1 -1
  109. package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
  110. package/docs/api/interfaces/VaultGrantCapabilityInput.md +25 -1
  111. package/docs/api/interfaces/VaultGrantCapabilityRequest.md +23 -0
  112. package/docs/api/interfaces/VaultIdentity.md +1 -1
  113. package/docs/api/interfaces/VaultImportAgentInput.md +1 -1
  114. package/docs/api/interfaces/VaultIssueSessionTokenInput.md +1 -1
  115. package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
  116. package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
  117. package/docs/api/interfaces/VaultListSecretsInput.md +1 -1
  118. package/docs/api/interfaces/VaultMetadata.md +1 -1
  119. package/docs/api/interfaces/VaultObject.md +1 -1
  120. package/docs/api/interfaces/VaultProfile.md +1 -1
  121. package/docs/api/interfaces/VaultReadAgentPrivateKeyInput.md +1 -1
  122. package/docs/api/interfaces/VaultReadSecretPlaintextInput.md +1 -1
  123. package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
  124. package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
  125. package/docs/api/interfaces/VaultRevokeSessionTokenInput.md +1 -1
  126. package/docs/api/interfaces/VaultSigner.md +1 -1
  127. package/docs/api/interfaces/VaultSubmitCapabilityRequestInput.md +1 -1
  128. package/docs/api/interfaces/VaultUpdateAgentInput.md +1 -1
  129. package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
  130. package/docs/api/type-aliases/AgentVisibleSecretRecord.md +1 -1
  131. package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
  132. package/docs/api/type-aliases/OwnerGrantCapabilityInput.md +7 -0
  133. package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
  134. package/docs/es/README.md +6 -9
  135. package/docs/fr/README.md +6 -10
  136. package/docs/ja/README.md +6 -9
  137. package/docs/ko/README.md +6 -9
  138. package/docs/pt/README.md +6 -9
  139. package/docs/zh/README.md +101 -42
  140. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ import { createVaultClient } from "../clients/owner/client.js";
2
+ import { FsStorageProvider } from "../storage/fs.js";
3
+ import { recoverVault } from "./bootstrap.js";
4
+ import { createWorkspaceStorage } from "./workspace-storage.js";
5
+ class DefaultOwnerSession {
6
+ storage;
7
+ _options;
8
+ _invalidated = false;
9
+ _cachedVaultPromise;
10
+ _nickname;
11
+ constructor(storage, _options) {
12
+ this.storage = storage;
13
+ this._options = _options;
14
+ }
15
+ get vaultId() {
16
+ return this._options.vaultId;
17
+ }
18
+ get nickname() {
19
+ return this._nickname;
20
+ }
21
+ isValid() {
22
+ return !this._invalidated;
23
+ }
24
+ invalidate() {
25
+ this._invalidated = true;
26
+ this._cachedVaultPromise = undefined;
27
+ }
28
+ async refresh() {
29
+ this._assertValid();
30
+ this._cachedVaultPromise = undefined;
31
+ return this.vault();
32
+ }
33
+ async vault() {
34
+ this._assertValid();
35
+ if (!this._cachedVaultPromise) {
36
+ this._cachedVaultPromise = recoverVault(this.storage, this._options).then((vault) => {
37
+ this._nickname = vault.nickname;
38
+ return vault;
39
+ });
40
+ }
41
+ return this._cachedVaultPromise;
42
+ }
43
+ async client() {
44
+ const vault = await this.vault();
45
+ this._assertValid();
46
+ return this._createClient(vault);
47
+ }
48
+ async withClient(callback) {
49
+ const vault = await this.vault();
50
+ this._assertValid();
51
+ return callback(this._createClient(vault), vault);
52
+ }
53
+ _assertValid() {
54
+ if (this._invalidated) {
55
+ throw new Error(`OwnerSession for vault '${this._options.vaultId}' has been invalidated`);
56
+ }
57
+ }
58
+ _createClient(vault) {
59
+ const clientOptions = {
60
+ vault: vault.vault,
61
+ ownerIdentity: this._options.ownerIdentity,
62
+ signer: this._options.signer,
63
+ clock: this._options.clock,
64
+ skipWarmup: this._options.skipWarmup,
65
+ passwordVerifier: vault.verifyPassword,
66
+ sensitiveActionVerifier: this._options.sensitiveActionVerifier,
67
+ };
68
+ return createVaultClient(clientOptions);
69
+ }
70
+ }
71
+ function resolveOwnerSessionStorage(storageOrOptions, maybeOptions) {
72
+ if (maybeOptions) {
73
+ return {
74
+ storage: typeof storageOrOptions === "string"
75
+ ? new FsStorageProvider(storageOrOptions)
76
+ : storageOrOptions,
77
+ options: maybeOptions,
78
+ };
79
+ }
80
+ return {
81
+ storage: createWorkspaceStorage(),
82
+ options: storageOrOptions,
83
+ };
84
+ }
85
+ export function createOwnerSession(storageOrOptions, maybeOptions) {
86
+ const { storage, options } = resolveOwnerSessionStorage(storageOrOptions, maybeOptions);
87
+ return new DefaultOwnerSession(storage, options);
88
+ }
89
+ //# sourceMappingURL=owner-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"owner-session.js","sourceRoot":"","sources":["../../src/runtime/owner-session.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,YAAY,EAAiD,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAyBhE,MAAM,mBAAmB;IAMZ;IACQ;IANX,YAAY,GAAG,KAAK,CAAC;IACrB,mBAAmB,CAAsC;IACzD,SAAS,CAAqB;IAEtC,YACW,OAAyB,EACjB,QAAmC;QAD3C,YAAO,GAAP,OAAO,CAAkB;QACjB,aAAQ,GAAR,QAAQ,CAA2B;IACnD,CAAC;IAEJ,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,OAA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 @@ export interface AgentGetRuntimeManifestCommand {
209
209
  };
210
210
  requestedAt: string;
211
211
  }
212
+ export interface AgentSelfContext {
213
+ agentId: string;
214
+ identityId: string;
215
+ publicKey: string;
216
+ nickname?: string;
217
+ metadata?: Record<string, any>;
218
+ }
219
+ export type AgentCapabilityStateStatus = "GRANTED" | "PENDING" | "REJECTED";
220
+ export type AgentCapabilityStateSource = "owner_grant" | "explicit_request" | "dispatch_discovery";
221
+ export interface AgentCapabilityState {
222
+ status: AgentCapabilityStateStatus;
223
+ source: AgentCapabilityStateSource;
224
+ agentId: string;
225
+ requestId?: string;
226
+ capabilityId?: string;
227
+ operation: "dispatch_http" | "custom_http";
228
+ secretIds?: readonly string[];
229
+ secretAliases?: readonly string[];
230
+ customFlowId?: string;
231
+ scope: string;
232
+ methods: readonly string[];
233
+ issuedAt?: string;
234
+ requestedAt: string;
235
+ expiresAt?: string;
236
+ rateLimit?: {
237
+ maxRequests: number;
238
+ windowMs: number;
239
+ };
240
+ skipAudit?: boolean;
241
+ justification?: string;
242
+ secretAlias?: string;
243
+ targetUrl?: string;
244
+ }
245
+ export interface CapabilityStateRecord extends AgentCapabilityState {
246
+ vaultId: VaultId;
247
+ proof?: AgentProof;
248
+ headers?: Record<string, string>;
249
+ body?: string;
250
+ decidedAt?: string;
251
+ }
212
252
  export interface AgentRuntimeManifest {
213
253
  agentId: string;
214
254
  vaultId: string;
215
255
  vaultNickname?: string;
216
256
  issuedAt: string;
217
- capabilities: readonly AgentCapability[];
257
+ agent: AgentSelfContext;
258
+ capabilities: readonly AgentCapabilityState[];
218
259
  tools: readonly VaultToolDefinition[];
219
260
  }
220
261
  export interface VaultToolDefinition {
@@ -251,30 +292,6 @@ export interface AgentSubmitCapabilityRequestCommand {
251
292
  scope: CapabilityRequestScope;
252
293
  justification?: string;
253
294
  }
254
- export interface PendingDispatchRecord {
255
- requestId: string;
256
- agentId: string;
257
- capabilityId?: string;
258
- secretAlias: string;
259
- targetUrl: string;
260
- method: string;
261
- headers?: Record<string, string>;
262
- body?: string;
263
- requestedAt: string;
264
- proof: AgentProof;
265
- }
266
- export interface OwnerApproveDispatchCommand {
267
- vaultId: VaultId;
268
- requestId: string;
269
- owner: VaultPrincipal;
270
- permanent?: boolean;
271
- skipAudit?: boolean;
272
- }
273
- export interface OwnerRejectDispatchCommand {
274
- vaultId: VaultId;
275
- requestId: string;
276
- owner: VaultPrincipal;
277
- }
278
295
  export interface CapabilityRequestScope {
279
296
  operation: "dispatch_http" | "custom_http";
280
297
  secretAliases?: readonly string[];
@@ -296,22 +313,18 @@ export interface SubmitCapabilityRequestCommand {
296
313
  justification?: string;
297
314
  requestedAt: string;
298
315
  }
299
- export interface PendingCapabilityRequestRecord {
316
+ export interface OwnerListCapabilityStatesRequest {
300
317
  vaultId: VaultId;
301
- requestId: string;
302
- requester: VaultPrincipal;
303
- agentId: string;
304
- scope: CapabilityRequestScope;
305
- justification?: string;
306
- requestedAt: string;
318
+ owner: VaultPrincipal;
319
+ agentId?: string;
320
+ status?: AgentCapabilityStateStatus;
307
321
  }
308
- export interface OwnerApproveCapabilityRequestCommand {
322
+ export interface OwnerExecuteCapabilityStateCommand {
309
323
  vaultId: VaultId;
310
324
  requestId: string;
311
325
  owner: VaultPrincipal;
312
- capabilityId?: string;
313
326
  }
314
- export interface OwnerRejectCapabilityRequestCommand {
327
+ export interface OwnerRejectCapabilityStateCommand {
315
328
  vaultId: VaultId;
316
329
  requestId: string;
317
330
  owner: VaultPrincipal;
@@ -1 +1 @@
1
- {"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../src/vault-core/contracts.ts"],"names":[],"mappings":"AAiXA,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;IACjB,qCAAmB,CAAA;IACnB,qCAAmB,CAAA;AACrB,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAoBD,MAAM,CAAN,IAAY,WAwBX;AAxBD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B,CAAA;IAC7B,8DAA+C,CAAA;IAC/C,8CAA+B,CAAA;IAC/B,gDAAiC,CAAA;IACjC,8CAA+B,CAAA;IAC/B,wDAAyC,CAAA;IACzC,kDAAmC,CAAA;IACnC,0CAA2B,CAAA;IAC3B,sDAAuC,CAAA;IACvC,wCAAyB,CAAA;IACzB,0DAA2C,CAAA;IAC3C,4DAA6C,CAAA;IAC7C,oDAAqC,CAAA;IACrC,kDAAmC,CAAA;IACnC,gDAAiC,CAAA;AACnC,CAAC,EAxBW,WAAW,KAAX,WAAW,QAwBtB;AAED,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,mCAAmB,CAAA;IACnB,iCAAiB,CAAA;IACjB,uCAAuB,CAAA;IACvB,iCAAiB,CAAA;IACjB,mCAAmB,CAAA;AACrB,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB"}
@@ -1,4 +1,4 @@
1
- import type { AgentListCapabilitiesRequest, AgentListSecretsRequest, AgentGetRuntimeManifestCommand, AgentRuntimeManifest, AgentSubmitCapabilityRequestCommand, AgentVisibleSecretRecord, AuditEntry, AuditQuery, CustomHttpFlowDefinition, DispatchAuthorization, DispatchRequest, DispatchResult, OwnerApproveCapabilityRequestCommand, OwnerDefineSecretTargetsCommand, OwnerIssueSessionTokenRequest, OwnerRejectCapabilityRequestCommand, OwnerDeleteSecretCommand, OwnerExportSecretRequest, OwnerRegisterAgentIdentityCommand, OwnerUpdateAgentIdentityCommand, OwnerRegisterCapabilityCommand, OwnerRegisterCustomHttpFlowCommand, OwnerRevokeCapabilityCommand, OwnerListAgentsRequest, OwnerListCapabilitiesRequest, OwnerSecretExport, OwnerSessionToken, PendingCapabilityRequestRecord, SecretRecord, SubmitCapabilityRequestCommand, VaultId, VaultPrincipal, VaultWriteSecretCommand, AgentIdentityRecord, AgentCapability } from "./contracts.js";
1
+ import type { AgentListCapabilitiesRequest, AgentListSecretsRequest, AgentGetRuntimeManifestRequest, AgentRuntimeManifest, AgentSubmitCapabilityRequestCommand, AgentVisibleSecretRecord, AuditEntry, AuditQuery, CustomHttpFlowDefinition, DispatchAuthorization, DispatchRequest, DispatchResult, OwnerExecuteCapabilityStateCommand, OwnerDefineSecretTargetsCommand, OwnerIssueSessionTokenRequest, OwnerRejectCapabilityStateCommand, OwnerDeleteSecretCommand, OwnerExportSecretRequest, OwnerRegisterAgentIdentityCommand, OwnerUpdateAgentIdentityCommand, OwnerRegisterCapabilityCommand, OwnerRegisterCustomHttpFlowCommand, OwnerRevokeCapabilityCommand, OwnerListAgentsRequest, OwnerListCapabilitiesRequest, OwnerListCapabilityStatesRequest, OwnerSecretExport, OwnerSessionToken, SecretRecord, SubmitCapabilityRequestCommand, VaultId, VaultPrincipal, VaultWriteSecretCommand, AgentIdentityRecord, AgentCapability, CapabilityStateRecord } from "./contracts.js";
2
2
  import type { VaultCoreDependencies } from "./ports.js";
3
3
  /**
4
4
  * The Sovereign Vault Core.
@@ -6,20 +6,23 @@ import type { VaultCoreDependencies } from "./ports.js";
6
6
  */
7
7
  export declare class VaultCore {
8
8
  private readonly _deps;
9
- private readonly _pendingObservers;
10
- private readonly _pendingCapabilityObservers;
9
+ private readonly _capabilityStateObservers;
11
10
  constructor(_deps: VaultCoreDependencies);
11
+ private _assertOwnerPrincipal;
12
+ private _stateToGrantedCapability;
13
+ private _buildAgentCapabilityStates;
14
+ private _isExecutablePendingState;
15
+ private _executePendingCapabilityState;
12
16
  get vaultId(): VaultId;
13
17
  private _appendAudit;
14
18
  private _appendDecisionAudit;
15
19
  private _verifyAgentControlProof;
16
20
  private _listVisibleSecretsForAgent;
17
- ownerOnPendingDispatch(callback: (record: import("./contracts.js").PendingDispatchRecord) => void): () => void;
18
- ownerOnPendingCapabilityRequest(callback: (record: PendingCapabilityRequestRecord) => void): () => void;
21
+ ownerOnCapabilityState(callback: (record: CapabilityStateRecord) => void): () => void;
19
22
  ownerRegisterAgentIdentity(command: OwnerRegisterAgentIdentityCommand): Promise<void>;
20
23
  ownerUpdateAgentIdentity(command: OwnerUpdateAgentIdentityCommand): Promise<AgentIdentityRecord>;
21
24
  ownerRegisterCapability(command: OwnerRegisterCapabilityCommand): Promise<void>;
22
- ownerSubmitCapabilityRequest(command: SubmitCapabilityRequestCommand): Promise<PendingCapabilityRequestRecord>;
25
+ ownerSubmitCapabilityRequest(command: SubmitCapabilityRequestCommand): Promise<CapabilityStateRecord>;
23
26
  _getCapability(vaultId: import("./contracts.js").VaultId, agentId: string, capabilityId: string): Promise<AgentCapability | null>;
24
27
  ownerRegisterCustomFlow(command: OwnerRegisterCustomHttpFlowCommand): Promise<void>;
25
28
  _storeCustomFlowSecret(flow: CustomHttpFlowDefinition, alias: string, plaintext: string): Promise<SecretRecord>;
@@ -46,10 +49,10 @@ export declare class VaultCore {
46
49
  }, request?: {
47
50
  requestId?: string;
48
51
  }): Promise<readonly AgentVisibleSecretRecord[]>;
49
- agentListCapabilities(request: AgentListCapabilitiesRequest): Promise<readonly AgentCapability[]>;
52
+ agentListCapabilities(request: AgentListCapabilitiesRequest): Promise<readonly import("./contracts.js").AgentCapabilityState[]>;
50
53
  agentListSecrets(request: AgentListSecretsRequest): Promise<readonly AgentVisibleSecretRecord[]>;
51
- agentGetRuntimeManifest(command: AgentGetRuntimeManifestCommand): Promise<AgentRuntimeManifest>;
52
- agentSubmitCapabilityRequest(command: AgentSubmitCapabilityRequestCommand): Promise<PendingCapabilityRequestRecord>;
54
+ agentGetRuntimeManifest(command: AgentGetRuntimeManifestRequest): Promise<AgentRuntimeManifest>;
55
+ agentSubmitCapabilityRequest(command: AgentSubmitCapabilityRequestCommand): Promise<CapabilityStateRecord>;
53
56
  ownerRevokeCapability(command: OwnerRevokeCapabilityCommand): Promise<void>;
54
57
  ownerIssueSessionToken(request: OwnerIssueSessionTokenRequest): Promise<OwnerSessionToken>;
55
58
  ownerIssueAllAgentSessionTokens(actor: VaultPrincipal & {
@@ -62,17 +65,9 @@ export declare class VaultCore {
62
65
  };
63
66
  token: string;
64
67
  }): Promise<void>;
65
- ownerListPendingDispatches(command: {
66
- vaultId: VaultId;
67
- owner: VaultPrincipal;
68
- }): Promise<readonly import("./contracts.js").PendingDispatchRecord[]>;
69
- ownerListPendingCapabilityRequests(command: {
70
- vaultId: VaultId;
71
- owner: VaultPrincipal;
72
- }): Promise<readonly PendingCapabilityRequestRecord[]>;
73
- ownerApproveCapabilityRequest(command: OwnerApproveCapabilityRequestCommand): Promise<AgentCapability>;
74
- ownerRejectCapabilityRequest(command: OwnerRejectCapabilityRequestCommand): Promise<void>;
75
- ownerApproveDispatch(command: import("./contracts.js").OwnerApproveDispatchCommand): Promise<DispatchResult>;
76
- ownerRejectDispatch(command: import("./contracts.js").OwnerRejectDispatchCommand): Promise<void>;
68
+ ownerListCapabilityStates(command: OwnerListCapabilityStatesRequest): Promise<readonly CapabilityStateRecord[]>;
69
+ ownerExecuteCapabilityStateOnce(command: OwnerExecuteCapabilityStateCommand): Promise<DispatchResult>;
70
+ ownerExecuteCapabilityStateAndGrant(command: OwnerExecuteCapabilityStateCommand): Promise<DispatchResult>;
71
+ ownerRejectCapabilityState(command: OwnerRejectCapabilityStateCommand): Promise<CapabilityStateRecord>;
77
72
  }
78
73
  export declare function createVaultCore(deps: VaultCoreDependencies): VaultCore;