@the-ai-company/cbio-node-runtime 1.46.0 → 1.47.2

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 (115) hide show
  1. package/README.md +85 -239
  2. package/dist/clients/agent/client.d.ts +1 -0
  3. package/dist/clients/agent/client.js +25 -9
  4. package/dist/clients/agent/client.js.map +1 -1
  5. package/dist/clients/owner/client.d.ts +6 -4
  6. package/dist/clients/owner/client.js +41 -0
  7. package/dist/clients/owner/client.js.map +1 -1
  8. package/dist/clients/owner/contracts.d.ts +36 -0
  9. package/dist/clients/owner/index.d.ts +1 -1
  10. package/dist/runtime/bootstrap.d.ts +7 -7
  11. package/dist/runtime/bootstrap.js +2 -2
  12. package/dist/runtime/index.d.ts +3 -3
  13. package/dist/runtime/index.js +1 -1
  14. package/dist/runtime/index.js.map +1 -1
  15. package/dist/runtime/vault-metadata.js +1 -1
  16. package/dist/runtime/vault-metadata.js.map +1 -1
  17. package/dist/vault-core/contracts.d.ts +28 -2
  18. package/dist/vault-core/contracts.js +2 -0
  19. package/dist/vault-core/contracts.js.map +1 -1
  20. package/dist/vault-core/core.d.ts +10 -2
  21. package/dist/vault-core/core.js +24 -0
  22. package/dist/vault-core/core.js.map +1 -1
  23. package/dist/vault-core/defaults.d.ts +15 -3
  24. package/dist/vault-core/defaults.js +53 -14
  25. package/dist/vault-core/defaults.js.map +1 -1
  26. package/dist/vault-core/index.d.ts +1 -1
  27. package/dist/vault-core/index.js.map +1 -1
  28. package/dist/vault-core/persistence.js +5 -2
  29. package/dist/vault-core/persistence.js.map +1 -1
  30. package/dist/vault-core/ports.d.ts +6 -0
  31. package/dist/vault-ingress/index.d.ts +11 -2
  32. package/dist/vault-ingress/index.js +8 -0
  33. package/dist/vault-ingress/index.js.map +1 -1
  34. package/dist/vault-ingress/remote-transport.js +4 -1
  35. package/dist/vault-ingress/remote-transport.js.map +1 -1
  36. package/docs/ARCHITECTURE.md +34 -107
  37. package/docs/CUSTODY_MODEL.md +27 -129
  38. package/docs/IDENTITY_MODEL.md +34 -112
  39. package/docs/REFERENCE.md +57 -404
  40. package/docs/api/README.md +4 -3
  41. package/docs/api/classes/IdentityError.md +2 -2
  42. package/docs/api/classes/VaultCore.md +43 -1
  43. package/docs/api/classes/VaultCoreError.md +1 -1
  44. package/docs/api/enumerations/IdentityErrorCode.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/createPersistentVaultCoreDependencies.md +1 -1
  49. package/docs/api/functions/createStandardAcquireBoundary.md +1 -1
  50. package/docs/api/functions/createStandardDispatchBoundary.md +1 -1
  51. package/docs/api/functions/createVault.md +3 -3
  52. package/docs/api/functions/createVaultClient.md +1 -1
  53. package/docs/api/functions/createVaultCore.md +1 -1
  54. package/docs/api/functions/createVaultCoreDependencies.md +1 -1
  55. package/docs/api/functions/createVaultService.md +1 -1
  56. package/docs/api/functions/createWorkspaceStorage.md +1 -1
  57. package/docs/api/functions/deriveIdentityId.md +1 -1
  58. package/docs/api/functions/deriveVaultWorkingKeyFromPassword.md +1 -1
  59. package/docs/api/functions/getDefaultWorkspaceDir.md +1 -1
  60. package/docs/api/functions/handleVaultHttpDispatch.md +1 -1
  61. package/docs/api/functions/initializeVaultCustody.md +1 -1
  62. package/docs/api/functions/listVaults.md +3 -3
  63. package/docs/api/functions/readVaultProfile.md +1 -1
  64. package/docs/api/functions/recoverVault.md +4 -4
  65. package/docs/api/functions/recoverVaultWorkingKey.md +1 -1
  66. package/docs/api/functions/restoreIdentity.md +1 -1
  67. package/docs/api/functions/updateVaultMetadata.md +1 -1
  68. package/docs/api/functions/wrapVaultCoreAsVaultService.md +1 -1
  69. package/docs/api/functions/writeVaultProfile.md +1 -1
  70. package/docs/api/interfaces/AgentClient.md +1 -1
  71. package/docs/api/interfaces/AgentDispatchIntent.md +1 -1
  72. package/docs/api/interfaces/AgentDispatchTransport.md +1 -1
  73. package/docs/api/interfaces/AgentIdentity.md +1 -1
  74. package/docs/api/interfaces/AgentSigner.md +1 -1
  75. package/docs/api/interfaces/CbioRuntime.md +8 -8
  76. package/docs/api/interfaces/CreateAgentClientOptions.md +7 -1
  77. package/docs/api/interfaces/CreateIdentityOptions.md +1 -1
  78. package/docs/api/interfaces/CreatePersistentVaultCoreDependenciesOptions.md +1 -1
  79. package/docs/api/interfaces/CreateVaultClientOptions.md +1 -1
  80. package/docs/api/interfaces/CreateVaultOptions.md +1 -1
  81. package/docs/api/interfaces/CreatedVault.md +1 -1
  82. package/docs/api/interfaces/DefaultPolicyEngineOptions.md +1 -1
  83. package/docs/api/interfaces/IStorageProvider.md +1 -1
  84. package/docs/api/interfaces/InitializeVaultCustodyOptions.md +1 -1
  85. package/docs/api/interfaces/InitializedVaultCustody.md +1 -1
  86. package/docs/api/interfaces/OwnerDefineSecretTargetsInput.md +1 -1
  87. package/docs/api/interfaces/OwnerSecretTargetBinding.md +1 -1
  88. package/docs/api/interfaces/OwnerStoreSecretInput.md +1 -1
  89. package/docs/api/interfaces/OwnerWriteSecretInput.md +1 -1
  90. package/docs/api/interfaces/RecoverVaultOptions.md +1 -1
  91. package/docs/api/interfaces/RecoveredVault.md +1 -1
  92. package/docs/api/interfaces/RestoreIdentityOptions.md +1 -1
  93. package/docs/api/interfaces/Signer.md +1 -1
  94. package/docs/api/interfaces/VaultAuditQueryInput.md +1 -1
  95. package/docs/api/interfaces/VaultClient.md +20 -3
  96. package/docs/api/interfaces/VaultCoreDependenciesOptions.md +1 -1
  97. package/docs/api/interfaces/VaultCreateAgentInput.md +29 -0
  98. package/docs/api/interfaces/VaultDeleteSecretInput.md +1 -1
  99. package/docs/api/interfaces/VaultExportSecretInput.md +1 -1
  100. package/docs/api/interfaces/VaultGrantCapabilityInput.md +1 -1
  101. package/docs/api/interfaces/VaultIdentity.md +1 -1
  102. package/docs/api/interfaces/VaultListAgentsInput.md +1 -1
  103. package/docs/api/interfaces/VaultListCapabilitiesInput.md +1 -1
  104. package/docs/api/interfaces/{VaultPublicMetadata.md → VaultMetadata.md} +2 -2
  105. package/docs/api/interfaces/VaultObject.md +1 -1
  106. package/docs/api/interfaces/VaultProfile.md +1 -1
  107. package/docs/api/interfaces/VaultRegisterAgentInput.md +19 -1
  108. package/docs/api/interfaces/VaultRegisterFlowInput.md +1 -1
  109. package/docs/api/interfaces/VaultRevokeCapabilityInput.md +1 -1
  110. package/docs/api/interfaces/VaultSigner.md +1 -1
  111. package/docs/api/type-aliases/AgentCapabilityEnvelope.md +1 -1
  112. package/docs/api/type-aliases/CbioRuntimeModule.md +1 -1
  113. package/docs/api/variables/DEFAULT_VAULT_KEY_CUSTODY_BLOB_KEY.md +1 -1
  114. package/docs/zh/README.md +64 -39
  115. package/package.json +1 -1
@@ -1,148 +1,46 @@
1
- # Custody Model
1
+ # Custody Model (v1.47.0)
2
2
 
3
- This document defines the intended key and custody model for the local vault runtime.
4
-
5
- It exists to remove ambiguity around `owner` identity, secret recovery, and the vault's working-key model.
3
+ This document defines the **Sovereign Vault** custody model for the local vault runtime.
6
4
 
7
5
  ## Scope
8
6
 
9
- This runtime is a local vault / password-safe style infrastructure layer.
10
-
11
- It is not primarily a cloud secret manager.
12
- It is not a browser extension.
13
- It is not a CLI.
14
-
15
- The runtime is responsible for:
16
-
17
- - storing secret material safely at rest
18
- - using stored secret material during trusted vault operations
19
- - supporting explicit owner export / reveal operations
20
- - providing a stable custody model for higher-level products built on top
21
-
22
- ## Design Goal
23
-
24
- The runtime must satisfy all of the following:
25
-
26
- 1. Normal vault operation must not depend on repeated owner intervention.
27
- 2. Owner must retain explicit recovery and export authority.
28
- 3. Identity proof and secret-material control must not be collapsed into one key by default.
29
- 4. The runtime must not treat a raw process-level string as the final product model.
30
-
31
- ## Core Terms
32
-
33
- ### `ownerPrivateKey`
34
-
35
- The owner's identity-signing key.
36
-
37
- In the current product model, this owner is the single vault admin.
38
- Other principals should be modeled as agents with capabilities rather than additional owners.
7
+ The runtime is an authority-centric "password safe" style infrastructure. It is responsible for:
8
+ - Storing secret material safely at rest.
9
+ - Providing a **Managed Custody** home for agent identities.
10
+ - Centering all administrative authority on a master password.
39
11
 
40
- Purpose:
12
+ ## Design Goals
41
13
 
42
- - prove "this request came from the owner"
43
- - authorize owner-scoped operations
44
- - bind audit-visible actions to the owner identity
14
+ 1. **Authority via Proof of Knowledge**: Access to the vault's root secrets depends on knowing the master password.
15
+ 2. **Managed Agency**: The vault can generate and store private keys for its agents, removing the need for external key management by delegated actors.
16
+ 3. **Internalized Identity**: Administrative "Ownership" is a byproduct of unlocking the vault, not a pre-registered cryptographic identity.
45
17
 
46
- Non-purpose:
18
+ ## Core Keys
47
19
 
48
- - not the vault's secret-material root
49
- - not the working encryption key for stored secrets
50
- - not the recovery key for vault custody
20
+ ### Master Password
21
+ The root of all authority. Used to derive the `vaultWorkingKey`.
51
22
 
52
23
  ### `vaultWorkingKey`
24
+ The runtime's internal encryption key for all stored material (secrets and registries).
25
+ - **Derivation**: Derived from the Master Password + `vaultId` using `scrypt` (KDF).
26
+ - **Purpose**: Protects the vault profile, secret custody, and agent registries at rest.
53
27
 
54
- The runtime's working secret-material key.
55
-
56
- Purpose:
57
-
58
- - protect secret material at rest
59
- - support runtime secret use after the vault is in an operational state
60
- - back vault-side secret load / decrypt operations
61
-
62
- Non-purpose:
63
-
64
- - not an owner identity key
65
- - not a user-facing day-to-day API credential
66
- - not the preferred recovery artifact presented to the owner
67
-
68
- ## Current Runtime Surface
69
-
70
- The persistent runtime surface uses `vaultWorkingKey` as the runtime material-control key.
71
- The working key is now derived from the owner's private key plus `vaultId` in the high-level runtime path.
28
+ ### Managed Agent Keys
29
+ Standard Ed25519 private keys generated and stored *inside* the vault.
30
+ - **Purpose**: Allow agents to sign requests for dispatch without the agent process ever needing to persist its own identity material.
72
31
 
73
32
  ## Required Separation
74
33
 
75
- The runtime separates two concerns in the high-level path:
76
-
77
- 1. Identity authority
78
- `ownerPrivateKey`
79
-
80
- 2. Runtime material control
81
- `vaultWorkingKey`
82
-
83
- This separation is deliberate.
84
-
85
- The runtime should not default to a model where one owner signing key directly acts as the encryption root for all stored secret material.
86
-
87
- ## Owner Relationship To Custody
88
-
89
- Owner is the authorization authority for the vault.
90
-
91
- Owner is not defined as the same thing as the runtime working key.
92
-
93
- Instead:
94
-
95
- - owner authorizes actions
96
- - runtime custody performs storage / load / export work
97
- - owner retains ultimate recovery and export authority through explicit product mechanisms
98
-
99
- In practical terms:
100
-
101
- - owner must be able to export secret plaintext through a formal audited interface
102
- - owner must be able to recover the vault through the owner identity path
103
- - owner does not need to directly hold the working key during normal runtime operation
34
+ The runtime enforces a hard process boundary (A/B Architecture):
35
+ 1. **Security Process (A)**: Holds the Master Password and performs all crypto operations on the `vaultWorkingKey`.
36
+ 2. **Agent Process (B)**: Receives a "Managed Identity" (provided by A) to perform authorized dispatches.
104
37
 
105
38
  ## Export / Reveal Policy
106
39
 
107
- For this runtime family, export is a first-class password-safe capability, not an exception.
108
-
109
- That means:
110
-
111
- - `exportSecret(...)` is valid product behavior
112
- - export must be explicit
113
- - export must be owner-scoped
114
- - export must be audited
115
-
116
- Future hardening such as MFA/TOTP may be added on top of this model, but it does not replace the need to define custody clearly.
117
-
118
- ## Already Added
119
-
120
- The runtime now includes:
121
-
122
- 1. formal vault creation through `createVault(...)`
123
- 2. owner-identity based re-entry through `recoverVault(...)`
124
- 3. explicit `vaultWorkingKey` terminology in the persistent dependency surface
125
- 4. continued support for explicit owner export through `exportSecret(...)`
126
-
127
- ## Next
128
-
129
- The remaining intended direction is:
130
-
131
- 1. continue tightening recovery and migration flows
132
- 2. continue reducing low-level helper use in favor of high-level lifecycle entrypoints
133
- 3. keep the custody terminology stable across docs and APIs
134
-
135
- ## What This Runtime Should Remove
136
-
137
- The runtime should move away from these ambiguous product meanings:
138
-
139
- - "owner cannot read secrets back"
140
- - "owner signing key and vault secret-material key are the same by default"
141
-
142
- ## Non-Goals
143
-
144
- This document does not require the runtime to become a cloud KMS product.
40
+ Exporting secret plaintext is a first-class capability of the Sovereign Vault.
41
+ - `exportSecret(...)` is a valid, audited administrative operation.
42
+ - Requires the vault to be in an unlocked (operational) state.
145
43
 
146
- This document also does not require browser, CLI, or MCP concerns to be handled inside the runtime itself.
44
+ ## Conclusion
147
45
 
148
- Those layers may consume this runtime, but they do not define the runtime's custody model.
46
+ The Sovereign Vault model prioritizes **Ease of Use** and **Security through Isolation**. By moving away from complex external identity hierarchies, it provides a stable, "password-manager" style experience for automated agency.
@@ -1,128 +1,50 @@
1
- # Identity Model
1
+ # Identity Model (v1.47.0)
2
2
 
3
- This document defines the runtime's current identity model.
3
+ This document defines the identity model for the **Sovereign Vault**.
4
4
 
5
- Its purpose is to separate three things that are easy to confuse:
5
+ ## Principle: Authority, Not Identity
6
6
 
7
- - cryptographic identity
8
- - human-readable naming
9
- - vault-local role assignment
7
+ The Sovereign Vault model simplifies the relationship between actors and the vault:
10
8
 
11
- ## Core Rule
9
+ 1. **Administrator (Owner)**: Authority is rooted in **knowledge of the master password**. There is no pre-registered `OwnerIdentity`. If you can unlock the vault, you are the master.
10
+ 2. **Delegates (Agents)**: Identities authorized by the master to perform specific tasks.
12
11
 
13
- Outside the vault, there are only identities.
12
+ ## Identity Types
14
13
 
15
- Inside a specific vault, identities may be bound to roles such as `owner` or `agent`.
14
+ ### 1. External Identity
15
+ A principal represented by a public/private keypair managed *outside* the vault. These are registered by providing a public key.
16
16
 
17
- This means:
17
+ ### 2. Managed Identity (New in v1.47.0)
18
+ An identity whose public/private keypair is generated and stored **inside** the vault.
19
+ - The vault acts as the custodian of the private key.
20
+ - This is the preferred model for preventing lost keys in isolated agent processes.
18
21
 
19
- - `owner` is not a different species of identity
20
- - `agent` is not a different species of identity
21
- - role comes from vault-local authorization state, not from the keypair itself
22
+ ## Identifying Principals
22
23
 
23
- ## Identity
24
+ ### Identity ID
25
+ A stable, public-key-derived identifier (via `deriveIdentityId(...)`).
26
+ - Used for internal registries, capability assignment, and audit logs.
27
+ - Decoupled from human-readable labels.
24
28
 
25
- An `identity` is an external principal represented by a public/private keypair.
29
+ ### Nicknames
30
+ Human-friendly labels (e.g., "Main Worker", "Auth Service").
31
+ - Stored as metadata within the registry.
32
+ - Purely for display and audit traceability.
26
33
 
27
- Properties:
34
+ ## Vault Role: "vault-master"
28
35
 
29
- - root identities are independent
30
- - child identities may be deterministically derived from a parent identity private key plus a path
31
- - no built-in inheritance
32
- - no built-in "owner creates agent identity" relationship
36
+ All administrative operations performed by the password-holder are recorded under the special principal **`vault-master`**.
33
37
 
34
- An identity may participate in multiple vaults, and may hold different roles in different vaults.
38
+ ## What was Removed
35
39
 
36
- Example:
40
+ To achieve the Sovereign Vault's simplicity, the following legacy concepts were removed:
41
+ - **Child Identities**: Deterministic derivation of keys from a parent identity is no longer supported. Use **Managed Identities** instead.
42
+ - **Identity-Private Vaults**: Every identity used to have its own encrypted "mini-vault". This has been replaced by the unified storage of the Sovereign Vault.
37
43
 
38
- - the same identity may be `owner` in vault A
39
- - and `agent` in vault B
44
+ ## Relationship Summary
40
45
 
41
- ## Identity Material
42
-
43
- The runtime treats public/private keys as the cryptographic identity material.
44
-
45
- - `publicKey`
46
- used for verification and binding
47
- - `privateKey`
48
- held outside the vault by the identity holder
49
-
50
- The vault should not treat a display label as the root identity truth.
51
-
52
- ## Stable Identity ID
53
-
54
- The runtime already has a stable public-key-derived identity primitive available through `deriveIdentityId(...)`.
55
-
56
- That derived value is useful for:
57
-
58
- - stable machine identity
59
- - local naming
60
- - deterministic display-independent references
61
-
62
- It should not, by itself, determine vault-local role.
63
-
64
- ## Labels And Human-Readable Names
65
-
66
- Human-friendly names are still useful.
67
-
68
- Examples:
69
-
70
- - `owner-1`
71
- - `agent-prod`
72
- - `crawler`
73
- - `alice`
74
-
75
- These should be treated as labels, aliases, or local names rather than the deepest identity truth.
76
-
77
- The runtime now exposes this concept directly as optional `nickname` on `createIdentity(...)`.
78
-
79
- For existing private keys, the runtime exposes `restoreIdentity(...)`, which reconstructs the same identity shape from the private key alone.
80
-
81
- For child identities, the runtime exposes `createChildIdentity(storage, parentIdentity, { nickname })` for user-facing creation, and `deriveChildIdentity(parentIdentity, childIndex, { nickname })` for deterministic reconstruction when the stored `childIndex` is known. `nickname` remains display-only.
82
-
83
- Identity-private state is stored under `vault/private/identities/<identityId>/...` and encrypted with a key derived from that identity's private key. To inspect those records, callers use `readIdentityPrivateVaultProfile(...)` and `readIdentityPrivateVaultChildrenState(...)` with the identity object or private key.
84
-
85
- In other words:
86
-
87
- - public key or a stable derived id answers "who is this cryptographically"
88
- - label answers "what do humans call this identity here"
89
-
90
- ## Vault Roles
91
-
92
- Vault roles are authorization bindings applied to identities inside a specific vault.
93
-
94
- Current role model:
95
-
96
- - `owner`
97
- the single admin role for one vault
98
- - `agent`
99
- a delegated role registered and authorized by the owner
100
-
101
- These roles are vault-local.
102
-
103
- So:
104
-
105
- - an identity does not become globally `owner`
106
- - an identity does not become globally `agent`
107
- - the same identity may appear with different roles in different vaults
108
-
109
- ## Current Runtime Reality
110
-
111
- Today the runtime API still uses fields such as:
112
-
113
- - `ownerId`
114
- - `agentId`
115
-
116
- In practice, these currently behave closer to role-bound local identifiers or labels than to the deepest cryptographic identity root.
117
-
118
- The long-term intended direction is:
119
-
120
- 1. keep cryptographic identity separate from labels
121
- 2. keep vault-local role separate from both
122
- 3. avoid treating naming conventions such as prefixes as identity truth
123
-
124
- ## Non-Goals
125
-
126
- This model does not require every current API field to be renamed immediately.
127
-
128
- Its purpose is to define the correct semantics first, so later API changes can converge on one stable interpretation.
46
+ | Actor | Source of Authority | Registry |
47
+ | :--- | :--- | :--- |
48
+ | **Owner** | Master Password | Implicit (via Unlock) |
49
+ | **Managed Agent** | Vault Registry (Internal Key) | `agentIdentities` registry |
50
+ | **External Agent** | External Signer (Public Key) | `agentIdentities` registry |