@cef-ai/vault-sdk 5.1.0 → 5.3.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 +2 -0
- package/dist/client.d.ts +45 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +57 -1
- package/dist/client.js.map +1 -1
- package/dist/core/auth-token.d.ts +27 -0
- package/dist/core/auth-token.d.ts.map +1 -0
- package/dist/core/auth-token.js +101 -0
- package/dist/core/auth-token.js.map +1 -0
- package/dist/core/delegation-tokens.d.ts +47 -0
- package/dist/core/delegation-tokens.d.ts.map +1 -0
- package/dist/core/delegation-tokens.js +113 -0
- package/dist/core/delegation-tokens.js.map +1 -0
- package/dist/core/endpoints.d.ts +7 -0
- package/dist/core/endpoints.d.ts.map +1 -1
- package/dist/core/endpoints.js +10 -0
- package/dist/core/endpoints.js.map +1 -1
- package/dist/core/errors.d.ts +55 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +92 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/types.d.ts +54 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/fluent/agent-connection.d.ts +3 -1
- package/dist/fluent/agent-connection.d.ts.map +1 -1
- package/dist/fluent/agent-connection.js +3 -0
- package/dist/fluent/agent-connection.js.map +1 -1
- package/dist/fluent/vault.d.ts +32 -0
- package/dist/fluent/vault.d.ts.map +1 -1
- package/dist/fluent/vault.js +29 -0
- package/dist/fluent/vault.js.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/agents.d.ts +6 -0
- package/dist/internal/agents.d.ts.map +1 -1
- package/dist/internal/agents.js +6 -0
- package/dist/internal/agents.js.map +1 -1
- package/dist/internal/connectors.d.ts +161 -0
- package/dist/internal/connectors.d.ts.map +1 -0
- package/dist/internal/connectors.js +66 -0
- package/dist/internal/connectors.js.map +1 -0
- package/dist/internal/memberships.d.ts +90 -17
- package/dist/internal/memberships.d.ts.map +1 -1
- package/dist/internal/memberships.js +133 -29
- package/dist/internal/memberships.js.map +1 -1
- package/dist/internal/vaults.d.ts +8 -1
- package/dist/internal/vaults.d.ts.map +1 -1
- package/dist/internal/vaults.js +9 -0
- package/dist/internal/vaults.js.map +1 -1
- package/dist/internal-exports.d.ts +2 -1
- package/dist/internal-exports.d.ts.map +1 -1
- package/dist/internal-exports.js +1 -0
- package/dist/internal-exports.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
// re-exported here; import them via `@cef-ai/vault-sdk/internal` if you
|
|
3
3
|
// genuinely need the lower level.
|
|
4
4
|
export { VaultSDK } from "./client.js";
|
|
5
|
+
// The owner's delegation-ceremony tokens, for callers that mint them apart
|
|
6
|
+
// from `sdk.vault.delegations.grant` (e.g. with a signer the SDK was not built with).
|
|
7
|
+
export { mintDelegationTokens, MAX_DELEGATION_TTL_MS, DEFAULT_DELEGATION_TTL_MS, VAULT_DELEGATION_OPERATIONS, REGISTRY_DELEGATION_OPERATIONS, } from "./core/delegation-tokens.js";
|
|
8
|
+
export { AUTH_TOKEN_OPERATION } from "./core/auth-token.js";
|
|
5
9
|
export { OnboardingRequiredError, OnboardingTimeoutError, } from "./internal/onboarding.js";
|
|
6
10
|
export { Vault } from "./fluent/vault.js";
|
|
7
11
|
export { ScopeHandle } from "./fluent/scope.js";
|
|
@@ -15,7 +19,7 @@ export { NoAuth } from "./auth/no-auth.js";
|
|
|
15
19
|
export { WalletAuthProvider } from "./auth/wallet.js";
|
|
16
20
|
export { DelegationAuthProvider } from "./auth/delegation.js";
|
|
17
21
|
export { GarClient, signAndSubmitAgreement, getAsPubkey, } from "./agreements/index.js";
|
|
18
|
-
export { VaultRequestError, VaultNotImplementedError, VaultSignerRequiredError, } from "./core/errors.js";
|
|
22
|
+
export { VaultRequestError, VaultNotImplementedError, VaultSignerRequiredError, BundleChangedError, ReconsentRequiredError, CeilingUnknownError, } from "./core/errors.js";
|
|
19
23
|
// The signed roster's verification half. Exported from the ROOT, not from
|
|
20
24
|
// `/internal`, because a consumer that cannot reach it easily will read
|
|
21
25
|
// `SignedGrant.role`/`.scopes` instead and end up with a signature it checked
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,wEAAwE;AACxE,kCAAkC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQvC,2EAA2E;AAC3E,sFAAsF;AACtF,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAG5D,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQhD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAS9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AA+B9D,OAAO,EACL,SAAS,EACT,sBAAsB,EACtB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAE1B,0EAA0E;AAC1E,wEAAwE;AACxE,8EAA8E;AAC9E,sBAAsB;AACtB,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,sBAAsB,EACtB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,8BAA8B,EAC9B,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,UAAU,EACV,WAAW,EACX,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AA+C7B,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,iDAAiD;AACjD,+CAA+C;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -28,6 +28,12 @@ export declare class Agents {
|
|
|
28
28
|
* when `undefined` the `ceiling` key is omitted from the body. The resolved
|
|
29
29
|
* connection's `ceiling` reports what the server stored (absent when
|
|
30
30
|
* neither axis is set).
|
|
31
|
+
*
|
|
32
|
+
* `bundleCid` (optional) names the agent bundle the person consented to
|
|
33
|
+
* run and is sent as given. The resolved connection's `bundle` is the pin
|
|
34
|
+
* vault-api stored. A 409 rejects with `BundleChangedError` (the manifest
|
|
35
|
+
* now carries another bundle) or `ReconsentRequiredError` (a reconnect to
|
|
36
|
+
* changed code that named none).
|
|
31
37
|
*/
|
|
32
38
|
connect(v: string, req: ConnectAgentRequest): Promise<AgentConnection>;
|
|
33
39
|
list(v: string, opts?: ListAgentsOptions): Promise<AgentConnection[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/internal/agents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIvH,MAAM,WAAW,iBAAiB;IAAG,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAAE;AAErE,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,eAAe;IAElD
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/internal/agents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIvH,MAAM,WAAW,iBAAiB;IAAG,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAAE;AAErE,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,eAAe;IAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,eAAe,CAAC;IAkBtE,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAK/E,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAGnD,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC;IAGzF;;;;;;;;;;;;;;;;;;;OAmBG;IACG,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;IAK5F,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGhD;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,iBAAiB,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAiC7F"}
|
package/dist/internal/agents.js
CHANGED
|
@@ -28,6 +28,12 @@ export class Agents {
|
|
|
28
28
|
* when `undefined` the `ceiling` key is omitted from the body. The resolved
|
|
29
29
|
* connection's `ceiling` reports what the server stored (absent when
|
|
30
30
|
* neither axis is set).
|
|
31
|
+
*
|
|
32
|
+
* `bundleCid` (optional) names the agent bundle the person consented to
|
|
33
|
+
* run and is sent as given. The resolved connection's `bundle` is the pin
|
|
34
|
+
* vault-api stored. A 409 rejects with `BundleChangedError` (the manifest
|
|
35
|
+
* now carries another bundle) or `ReconsentRequiredError` (a reconnect to
|
|
36
|
+
* changed code that named none).
|
|
31
37
|
*/
|
|
32
38
|
async connect(v, req) {
|
|
33
39
|
// The ceiling is validated (and normalised to the two-axis wire body)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/internal/agents.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EAAE,iBA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AW,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,MAAM,cAAc,CAAC,qCAAqC,SAAS,GAAG,CAAC,CAAC;IAC1E,CAAC;IACD,wEAAwE;IACxE,+DAA+D;IAC/D,IAAI,SAAS,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC;QACxC,MAAM,cAAc,CAAC,qDAAqD,SAAS,GAAG,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import type { VaultHttpClient } from "../core/http.js";
|
|
2
|
+
/**
|
|
3
|
+
* One field of a connector's config, secrets, action input/output, event
|
|
4
|
+
* payload or event filter.
|
|
5
|
+
*
|
|
6
|
+
* `list` is an array of strings (a list input also accepts a comma-separated
|
|
7
|
+
* string, which the vault splits); `json` is any JSON object or array.
|
|
8
|
+
*/
|
|
9
|
+
export interface ConnectorField {
|
|
10
|
+
key: string;
|
|
11
|
+
label: string;
|
|
12
|
+
type: "string" | "text" | "number" | "boolean" | "url" | "email" | "secret" | "options" | "list" | "json";
|
|
13
|
+
required?: boolean;
|
|
14
|
+
options?: string[];
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
help?: string;
|
|
17
|
+
/** Filled by the connector (e.g. Slack's bot user id); never sent by a client. */
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** How a connector's credential is held; copied onto each connection. */
|
|
21
|
+
export type ConnectorCredentialKind = "bot_token" | "api_key" | "smtp" | "oauth_user";
|
|
22
|
+
/** Something a workflow step can ask the connector to do (`send_message`). */
|
|
23
|
+
export interface ConnectorAction {
|
|
24
|
+
name: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
/** Whether the action only reads from the external system or changes it. */
|
|
28
|
+
access: "read" | "write";
|
|
29
|
+
/** Provider permission scopes the credential must hold (`chat:write`). */
|
|
30
|
+
scopes: string[];
|
|
31
|
+
input: ConnectorField[];
|
|
32
|
+
output: ConnectorField[];
|
|
33
|
+
}
|
|
34
|
+
/** Something the connector can start a workflow with (`message.received`). */
|
|
35
|
+
export interface ConnectorEvent {
|
|
36
|
+
name: string;
|
|
37
|
+
displayName: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
payload: ConnectorField[];
|
|
40
|
+
filter: ConnectorField[];
|
|
41
|
+
}
|
|
42
|
+
/** A connector, as the vault's catalogue describes it — enough to render its forms and nodes. */
|
|
43
|
+
export interface ConnectorDescriptor {
|
|
44
|
+
name: string;
|
|
45
|
+
displayName: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
credentialKind: ConnectorCredentialKind;
|
|
48
|
+
config: ConnectorField[];
|
|
49
|
+
secrets: ConnectorField[];
|
|
50
|
+
actions: ConnectorAction[];
|
|
51
|
+
events: ConnectorEvent[];
|
|
52
|
+
ingress: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The actions are discovered per connection (an MCP server's tools), not
|
|
55
|
+
* listed here: read them with `connections.actions(connectionId)`.
|
|
56
|
+
*/
|
|
57
|
+
dynamicActions?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* `initialManifest` creates the external app before the connection exists
|
|
60
|
+
* (no webhook); `appManifest` is applied after and may contain
|
|
61
|
+
* `{{webhookUrl}}`.
|
|
62
|
+
*/
|
|
63
|
+
setup: {
|
|
64
|
+
instructions: string;
|
|
65
|
+
initialManifest?: string;
|
|
66
|
+
appManifest?: string;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Who a connection belongs to. Only `workspace` can be created today; the
|
|
71
|
+
* vault answers 400 for a `member` (personal) connection.
|
|
72
|
+
*/
|
|
73
|
+
export type ConnectionOwner = {
|
|
74
|
+
kind: "workspace";
|
|
75
|
+
} | {
|
|
76
|
+
kind: "member";
|
|
77
|
+
pubkey: string;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* One configured account of a connector in a vault. Secrets are write-only:
|
|
81
|
+
* sent on `create`/`update` and never returned. Non-admin readers get no
|
|
82
|
+
* `config`.
|
|
83
|
+
*/
|
|
84
|
+
export interface Connection {
|
|
85
|
+
id: string;
|
|
86
|
+
vaultId: string;
|
|
87
|
+
connector: string;
|
|
88
|
+
name: string;
|
|
89
|
+
scopes: string[];
|
|
90
|
+
owner: ConnectionOwner;
|
|
91
|
+
credentialKind: ConnectorCredentialKind;
|
|
92
|
+
config?: Record<string, unknown>;
|
|
93
|
+
status: "active" | "revoked";
|
|
94
|
+
createdBy: string;
|
|
95
|
+
createdAt: string;
|
|
96
|
+
updatedAt: string;
|
|
97
|
+
/** Where the external system posts webhooks, for connectors with ingress. */
|
|
98
|
+
webhookUrl?: string;
|
|
99
|
+
}
|
|
100
|
+
/** What one agent may do with one connection, in the agent connection's scope. */
|
|
101
|
+
export interface AgentAccess {
|
|
102
|
+
connectionId: string;
|
|
103
|
+
agentId: string;
|
|
104
|
+
scope: string;
|
|
105
|
+
actions: string[];
|
|
106
|
+
events: string[];
|
|
107
|
+
filter: Record<string, unknown>;
|
|
108
|
+
grantedBy: string;
|
|
109
|
+
updatedAt: string;
|
|
110
|
+
}
|
|
111
|
+
export interface CreateConnectionRequest {
|
|
112
|
+
connector: string;
|
|
113
|
+
name: string;
|
|
114
|
+
scopes: string[];
|
|
115
|
+
/** Defaults to the workspace. */
|
|
116
|
+
owner?: ConnectionOwner;
|
|
117
|
+
config: Record<string, unknown>;
|
|
118
|
+
secrets: Record<string, unknown>;
|
|
119
|
+
}
|
|
120
|
+
/** Omitted keys are unchanged; `secrets` omitted keeps the sealed ones. */
|
|
121
|
+
export interface UpdateConnectionRequest {
|
|
122
|
+
name?: string;
|
|
123
|
+
scopes?: string[];
|
|
124
|
+
config?: Record<string, unknown>;
|
|
125
|
+
secrets?: Record<string, unknown>;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* An agent's access to a connection. The scope is not sent: it is the agent
|
|
129
|
+
* connection's own. Both lists empty deletes the access.
|
|
130
|
+
*/
|
|
131
|
+
export interface SetAgentAccessRequest {
|
|
132
|
+
actions: string[];
|
|
133
|
+
events: string[];
|
|
134
|
+
filter?: Record<string, unknown>;
|
|
135
|
+
}
|
|
136
|
+
/** The connectors vault-api supports (public, vault-less). */
|
|
137
|
+
export declare function listConnectors(http: VaultHttpClient): Promise<ConnectorDescriptor[]>;
|
|
138
|
+
/** This vault's connections: create, edit and revoke them. */
|
|
139
|
+
export declare class Connections {
|
|
140
|
+
private readonly http;
|
|
141
|
+
private readonly vaultId;
|
|
142
|
+
constructor(http: VaultHttpClient, vaultId: string);
|
|
143
|
+
list(): Promise<Connection[]>;
|
|
144
|
+
create(body: CreateConnectionRequest): Promise<Connection>;
|
|
145
|
+
update(connectionId: string, body: UpdateConnectionRequest): Promise<Connection>;
|
|
146
|
+
/** Revokes the connection and every agent's access to it. */
|
|
147
|
+
revoke(connectionId: string): Promise<void>;
|
|
148
|
+
/** A connection's actions as its connector reports them now (an MCP server's tools). */
|
|
149
|
+
actions(connectionId: string): Promise<ConnectorAction[]>;
|
|
150
|
+
}
|
|
151
|
+
/** Agents' access to this vault's connections (`/agents/:agentId/connections`). */
|
|
152
|
+
export declare class AgentConnectionAccess {
|
|
153
|
+
private readonly http;
|
|
154
|
+
private readonly vaultId;
|
|
155
|
+
constructor(http: VaultHttpClient, vaultId: string);
|
|
156
|
+
list(agentId: string): Promise<AgentAccess[]>;
|
|
157
|
+
/** Resolves `undefined` when both lists are empty and the vault deleted the access (204). */
|
|
158
|
+
set(agentId: string, connectionId: string, body: SetAgentAccessRequest): Promise<AgentAccess | undefined>;
|
|
159
|
+
remove(agentId: string, connectionId: string): Promise<void>;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=connectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.d.ts","sourceRoot":"","sources":["../../src/internal/conn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EAAE,MAAM;IAG5B,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAInC,MAAM,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IAI1D,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IAIhF,6DAA6D;IACvD,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,wFAAwF;IAClF,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAIhE;AAED,mFAAmF;AACnF,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM;IAG5B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAKnD,6FAA6F;IAC7F,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC;IAMnG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { endpoints } from "../core/endpoints.js";
|
|
2
|
+
/** The connectors vault-api supports (public, vault-less). */
|
|
3
|
+
export async function listConnectors(http) {
|
|
4
|
+
return listOf(await http.send("GET", endpoints.connectors()), "connectors");
|
|
5
|
+
}
|
|
6
|
+
/** This vault's connections: create, edit and revoke them. */
|
|
7
|
+
export class Connections {
|
|
8
|
+
http;
|
|
9
|
+
vaultId;
|
|
10
|
+
constructor(http, vaultId) {
|
|
11
|
+
this.http = http;
|
|
12
|
+
this.vaultId = vaultId;
|
|
13
|
+
}
|
|
14
|
+
async list() {
|
|
15
|
+
return listOf(await this.http.send("GET", endpoints.connections(this.vaultId)), "connections");
|
|
16
|
+
}
|
|
17
|
+
create(body) {
|
|
18
|
+
return this.http.send("POST", endpoints.connections(this.vaultId), { body: defined(body) });
|
|
19
|
+
}
|
|
20
|
+
update(connectionId, body) {
|
|
21
|
+
return this.http.send("PATCH", endpoints.connection(this.vaultId, connectionId), { body: defined(body) });
|
|
22
|
+
}
|
|
23
|
+
/** Revokes the connection and every agent's access to it. */
|
|
24
|
+
async revoke(connectionId) {
|
|
25
|
+
await this.http.send("DELETE", endpoints.connection(this.vaultId, connectionId), { body: {} });
|
|
26
|
+
}
|
|
27
|
+
/** A connection's actions as its connector reports them now (an MCP server's tools). */
|
|
28
|
+
async actions(connectionId) {
|
|
29
|
+
return listOf(await this.http.send("GET", endpoints.connectionActions(this.vaultId, connectionId)), "actions");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Agents' access to this vault's connections (`/agents/:agentId/connections`). */
|
|
33
|
+
export class AgentConnectionAccess {
|
|
34
|
+
http;
|
|
35
|
+
vaultId;
|
|
36
|
+
constructor(http, vaultId) {
|
|
37
|
+
this.http = http;
|
|
38
|
+
this.vaultId = vaultId;
|
|
39
|
+
}
|
|
40
|
+
async list(agentId) {
|
|
41
|
+
return listOf(await this.http.send("GET", endpoints.agentConnections(this.vaultId, agentId)), "connections");
|
|
42
|
+
}
|
|
43
|
+
/** Resolves `undefined` when both lists are empty and the vault deleted the access (204). */
|
|
44
|
+
set(agentId, connectionId, body) {
|
|
45
|
+
return this.http.send("PUT", endpoints.agentConnection(this.vaultId, agentId, connectionId), {
|
|
46
|
+
body: { actions: body.actions, events: body.events, filter: body.filter ?? {} },
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async remove(agentId, connectionId) {
|
|
50
|
+
await this.http.send("DELETE", endpoints.agentConnection(this.vaultId, agentId, connectionId), { body: {} });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/** `body` without its undefined keys: an absent key means "unchanged" / "default". */
|
|
54
|
+
function defined(body) {
|
|
55
|
+
const out = {};
|
|
56
|
+
for (const [k, v] of Object.entries(body))
|
|
57
|
+
if (v !== undefined)
|
|
58
|
+
out[k] = v;
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
/** A list response: `{<key>: [...]}` as vault-api wraps it. */
|
|
62
|
+
function listOf(r, key) {
|
|
63
|
+
const v = r && typeof r === "object" ? r[key] : undefined;
|
|
64
|
+
return Array.isArray(v) ? v : [];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=connectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectors.js","sourceRoot":"","sources":["../../src/internal/connectors.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AA8IjD,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAqB;IACxD,OAAO,MAAM,CAAsB,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC;AACnG,CAAC;AAED,8DAA8D;AAC9D,MAAM,OAAO,WAAW;IAEH;IACA;IAFnB,YACmB,IAAqB,EACrB,OAAe;QADf,SAAI,GAAJ,IAAI,CAAiB;QACrB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,IAAI;QACR,OAAO,MAAM,CAAa,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,aAAa,CAAC,CAAC;IAC7G,CAAC;IAED,MAAM,CAAC,IAA6B;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,IAAI,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er";
|
|
2
2
|
import type { VaultHttpClient } from "../core/http.js";
|
|
3
|
-
import type { PrivacyCeilingName } from "../core/grant-doc.js";
|
|
3
|
+
import type { PrivacyCeiling, PrivacyCeilingName } from "../core/grant-doc.js";
|
|
4
4
|
import type { Member, MemberRole, MembershipSummary, ScopeGrants, SignedRoster } from "../core/types.js";
|
|
5
5
|
/**
|
|
6
6
|
* What the caller already knows about the membership's OTHER half, so the
|
|
@@ -28,11 +28,37 @@ export interface PutMemberOptions {
|
|
|
28
28
|
*/
|
|
29
29
|
privacyCeiling?: PrivacyCeilingName;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* What `putScopes` signs besides the new scopes: the standing this member
|
|
33
|
+
* ALREADY has, which that route does not change.
|
|
34
|
+
*/
|
|
35
|
+
export interface HeldStanding {
|
|
36
|
+
role: MemberRole;
|
|
37
|
+
/** Absent: the membership has no expiry. */
|
|
38
|
+
expiresAt?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The privacy ceiling the member holds, or `NO_PRIVACY_CEILING` when they
|
|
41
|
+
* hold none. Absent: read it off the verified signed roster — absence here
|
|
42
|
+
* means "not known", never "none".
|
|
43
|
+
*
|
|
44
|
+
* vault-api rebuilds the document from the STORED ceiling, so a member who
|
|
45
|
+
* holds one is signed a `cere.vault.grant.v2` document and a member who
|
|
46
|
+
* holds none a v1 one. Passing the wrong value is refused with a 400; it
|
|
47
|
+
* cannot change the stored ceiling, which this route never writes.
|
|
48
|
+
*/
|
|
49
|
+
privacyCeiling?: PrivacyCeiling;
|
|
50
|
+
}
|
|
31
51
|
/** @see PutMemberOptions */
|
|
32
52
|
export interface PutScopesOptions {
|
|
33
53
|
/**
|
|
34
|
-
* The standing this member ALREADY has —
|
|
35
|
-
*
|
|
54
|
+
* The standing this member ALREADY has — the role, the expiry and the
|
|
55
|
+
* privacy ceiling, none of which this route sets. Default: the role and
|
|
56
|
+
* expiry are read off the roster (`list()`) in one GET, and the ceiling off
|
|
57
|
+
* the verified signed roster (`signedRoster()`) in another.
|
|
58
|
+
*
|
|
59
|
+
* Given without `privacyCeiling`, the role and expiry are signed as given
|
|
60
|
+
* and the ceiling is still read from the signed roster. Given with it, no
|
|
61
|
+
* read is made at all.
|
|
36
62
|
*
|
|
37
63
|
* ONE OPTION CARRYING TWO FIELDS, replacing the former `role?`. The grant
|
|
38
64
|
* document covers the role AND the expiry, and this route changes neither,
|
|
@@ -46,10 +72,7 @@ export interface PutScopesOptions {
|
|
|
46
72
|
* instant is accepted, because the server compares instants (it cannot
|
|
47
73
|
* render the signer's original string back out of a timestamp column).
|
|
48
74
|
*/
|
|
49
|
-
standing?:
|
|
50
|
-
role: MemberRole;
|
|
51
|
-
expiresAt?: string;
|
|
52
|
-
};
|
|
75
|
+
standing?: HeldStanding;
|
|
53
76
|
}
|
|
54
77
|
/**
|
|
55
78
|
* Who belongs to a vault, in what role, holding which scope grants — and,
|
|
@@ -106,9 +129,11 @@ export interface PutScopesOptions {
|
|
|
106
129
|
*
|
|
107
130
|
* `PutMember` builds its document from the role in the body and the scopes
|
|
108
131
|
* ALREADY IN THE STORE; `PutScopes` builds its own from the scopes in the
|
|
109
|
-
* body and the role already in the store. So each
|
|
110
|
-
* back before signing — one extra GET
|
|
111
|
-
*
|
|
132
|
+
* body and the role, expiry and privacy ceiling already in the store. So each
|
|
133
|
+
* method reads the other half back before signing — one extra GET for `put`,
|
|
134
|
+
* two for `putScopes` (the ceiling comes from the signed roster) — unless the
|
|
135
|
+
* caller supplies it
|
|
136
|
+
* (`PutMemberOptions.scopes` / `PutScopesOptions.standing`). Signing the same
|
|
112
137
|
* bytes for both calls is refused by the second.
|
|
113
138
|
*
|
|
114
139
|
* ### AN ADMIN WHO IS NOT THE OWNER CANNOT SIGN
|
|
@@ -308,12 +333,35 @@ export declare class Memberships {
|
|
|
308
333
|
* a currently-suspended membership.
|
|
309
334
|
*
|
|
310
335
|
* CARRIES THE OWNER'S `X-Grant-Signature` over
|
|
311
|
-
* `{vaultId, memberPubkey, role, scopes, issuedAt, expiresAt}
|
|
312
|
-
*
|
|
313
|
-
* the
|
|
314
|
-
*
|
|
336
|
+
* `{vaultId, memberPubkey, role, scopes, issuedAt, expiresAt}`, plus
|
|
337
|
+
* `privacyCeiling` when the member holds one — see the class doc comment.
|
|
338
|
+
* The role, the expiry and the ceiling in that document are the ones the
|
|
339
|
+
* member ALREADY HOLDS, because this route sets the scopes only. The role
|
|
340
|
+
* and expiry are read off the roster (`list()`) in one GET, which is why a
|
|
315
341
|
* `memberPubkey` with no row fails here rather than as the server's 404.
|
|
316
|
-
*
|
|
342
|
+
*
|
|
343
|
+
* THE CEILING DECIDES THE DOCUMENT'S VERSION. vault-api rebuilds this
|
|
344
|
+
* route's document from the stored ceiling, so a member who holds one needs
|
|
345
|
+
* the `cere.vault.grant.v2` document and a member who holds none the v1
|
|
346
|
+
* one, byte for byte as before. The ceiling is read from the SIGNED roster
|
|
347
|
+
* (`signedRoster()`, checked with `verifySignedRoster` against this vault
|
|
348
|
+
* id), because that is a document the vault owner signed and the plain
|
|
349
|
+
* roster does not carry it. A member whose grant there fails verification
|
|
350
|
+
* is refused with `GrantVerificationError`.
|
|
351
|
+
*
|
|
352
|
+
* A MEMBER THE SIGNED ROSTER DOES NOT SERVE IS SIGNED V1. It serves live
|
|
353
|
+
* memberships with a stored grant document only, so a suspended member or
|
|
354
|
+
* a legacy row is absent from it, and vault-api still lets an admin edit
|
|
355
|
+
* such a membership's scopes (its check is that the row exists, not that
|
|
356
|
+
* it is live). Most such members hold no ceiling and the v1 write succeeds
|
|
357
|
+
* as it always did. One who does hold a ceiling makes vault-api rebuild a
|
|
358
|
+
* v2 document, which the v1 signature does not cover: the server answers
|
|
359
|
+
* 400 naming the v2 document, writes nothing, and this method throws
|
|
360
|
+
* `CeilingUnknownError`. Retry with the ceiling passed in `standing`.
|
|
361
|
+
*
|
|
362
|
+
* Pass `{ standing: { role, expiresAt, privacyCeiling } }` to skip both
|
|
363
|
+
* reads — `NO_PRIVACY_CEILING` for a member who holds none. A `standing`
|
|
364
|
+
* without `privacyCeiling` skips the role read only.
|
|
317
365
|
*
|
|
318
366
|
* THE EXPIRY IS ALSO SENT IN THE BODY, and that is the one place this route
|
|
319
367
|
* differs from `put`. vault-api holds the expiry as a timestamp and the
|
|
@@ -345,10 +393,35 @@ export declare class Memberships {
|
|
|
345
393
|
* the one field whose absence is a document VERSION: unset builds the v1
|
|
346
394
|
* bytes exactly as before this option existed, set appends the ceiling and
|
|
347
395
|
* flips the schema string. An invalid value never gets this far — `put()`
|
|
348
|
-
*
|
|
349
|
-
* a typo cannot become a stored grant on any
|
|
396
|
+
* and `putScopes()` vet it before their read-backs — and the encoder
|
|
397
|
+
* re-checks regardless, so a typo cannot become a stored grant on any
|
|
398
|
+
* path in.
|
|
350
399
|
*/
|
|
351
400
|
private grantHeader;
|
|
401
|
+
/**
|
|
402
|
+
* The configured grant signer, or the reason there is none that vault-api
|
|
403
|
+
* would accept. `grantHeader` needs it to sign; `putScopes` also checks it
|
|
404
|
+
* up front, so a missing signer costs none of its read-backs.
|
|
405
|
+
*/
|
|
406
|
+
private grantSigner;
|
|
407
|
+
/**
|
|
408
|
+
* The privacy ceiling this member holds RIGHT NOW — `NO_PRIVACY_CEILING`
|
|
409
|
+
* when their grant is v1 — read out of the signed roster after verifying
|
|
410
|
+
* it against `vaultId`. `undefined` when the signed roster does not serve
|
|
411
|
+
* this member at all.
|
|
412
|
+
*
|
|
413
|
+
* The plain roster (`list()`) does not carry the ceiling, and the signed
|
|
414
|
+
* roster's is a value the vault owner signed rather than one vault-api
|
|
415
|
+
* rendered, so a verified document is the only source this trusts.
|
|
416
|
+
*
|
|
417
|
+
* An entry that fails verification is refused: the member is there and
|
|
418
|
+
* the value cannot be trusted. An ABSENT member is not refused, because
|
|
419
|
+
* the signed roster leaves out suspended members and rows with no stored
|
|
420
|
+
* grant document, both of which vault-api still lets an admin re-scope;
|
|
421
|
+
* `putScopes` signs v1 for them and turns the server's refusal, if the
|
|
422
|
+
* member does hold a ceiling, into `CeilingUnknownError`.
|
|
423
|
+
*/
|
|
424
|
+
private heldCeiling;
|
|
352
425
|
/**
|
|
353
426
|
* The scope grants this member holds RIGHT NOW — the half of `put`'s
|
|
354
427
|
* document that route reads from the store rather than from its body.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/internal/memberships.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"memberships.d.ts","sourceRoot":"","sources":["../../src/internal/memberships.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAmBvD,OAAO,KAAK,EAAe,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAM5F,OAAO,KAAK,EACV,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,YAAY,EACb,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,kBAAkB,CAAC;CACrC;AAED;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,UAAU,CAAC;IACjB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,4BAA4B;AAC5B,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,CAAC,EAAE,YAAY,CAAC;CACzB;AAED;;;;;;;;;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