@cef-ai/vault-sdk 4.4.0 → 5.2.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 (72) hide show
  1. package/README.md +35 -19
  2. package/dist/agreements/payload.d.ts +15 -1
  3. package/dist/agreements/payload.d.ts.map +1 -1
  4. package/dist/agreements/payload.js +13 -1
  5. package/dist/agreements/payload.js.map +1 -1
  6. package/dist/agreements/sign.d.ts +16 -3
  7. package/dist/agreements/sign.d.ts.map +1 -1
  8. package/dist/agreements/sign.js +16 -1
  9. package/dist/agreements/sign.js.map +1 -1
  10. package/dist/client.d.ts +54 -52
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/client.js +95 -98
  13. package/dist/client.js.map +1 -1
  14. package/dist/core/connect-scopes.d.ts +18 -0
  15. package/dist/core/connect-scopes.d.ts.map +1 -0
  16. package/dist/core/connect-scopes.js +72 -0
  17. package/dist/core/connect-scopes.js.map +1 -0
  18. package/dist/core/endpoints.d.ts +28 -1
  19. package/dist/core/endpoints.d.ts.map +1 -1
  20. package/dist/core/endpoints.js +31 -1
  21. package/dist/core/endpoints.js.map +1 -1
  22. package/dist/core/errors.d.ts +13 -1
  23. package/dist/core/errors.d.ts.map +1 -1
  24. package/dist/core/errors.js +14 -2
  25. package/dist/core/errors.js.map +1 -1
  26. package/dist/core/types.d.ts +70 -3
  27. package/dist/core/types.d.ts.map +1 -1
  28. package/dist/fluent/agent-connection.d.ts +16 -1
  29. package/dist/fluent/agent-connection.d.ts.map +1 -1
  30. package/dist/fluent/agent-connection.js +20 -0
  31. package/dist/fluent/agent-connection.js.map +1 -1
  32. package/dist/fluent/service.d.ts +34 -0
  33. package/dist/fluent/service.d.ts.map +1 -0
  34. package/dist/fluent/service.js +41 -0
  35. package/dist/fluent/service.js.map +1 -0
  36. package/dist/fluent/vault.d.ts +75 -8
  37. package/dist/fluent/vault.d.ts.map +1 -1
  38. package/dist/fluent/vault.js +82 -6
  39. package/dist/fluent/vault.js.map +1 -1
  40. package/dist/index.d.ts +3 -3
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +7 -10
  43. package/dist/index.js.map +1 -1
  44. package/dist/internal/agents.d.ts +54 -7
  45. package/dist/internal/agents.d.ts.map +1 -1
  46. package/dist/internal/agents.js +110 -8
  47. package/dist/internal/agents.js.map +1 -1
  48. package/dist/internal/connectors.d.ts +161 -0
  49. package/dist/internal/connectors.d.ts.map +1 -0
  50. package/dist/internal/connectors.js +66 -0
  51. package/dist/internal/connectors.js.map +1 -0
  52. package/dist/internal/cubbies.d.ts +33 -0
  53. package/dist/internal/cubbies.d.ts.map +1 -1
  54. package/dist/internal/cubbies.js +39 -0
  55. package/dist/internal/cubbies.js.map +1 -1
  56. package/dist/internal/memory.d.ts +79 -5
  57. package/dist/internal/memory.d.ts.map +1 -1
  58. package/dist/internal/memory.js +53 -9
  59. package/dist/internal/memory.js.map +1 -1
  60. package/dist/internal/vaults.d.ts +8 -5
  61. package/dist/internal/vaults.d.ts.map +1 -1
  62. package/dist/internal/vaults.js +0 -10
  63. package/dist/internal/vaults.js.map +1 -1
  64. package/dist/internal-exports.d.ts +1 -0
  65. package/dist/internal-exports.d.ts.map +1 -1
  66. package/dist/internal-exports.js +1 -0
  67. package/dist/internal-exports.js.map +1 -1
  68. package/package.json +3 -3
  69. package/dist/internal/gateway-info.d.ts +0 -16
  70. package/dist/internal/gateway-info.d.ts.map +0 -1
  71. package/dist/internal/gateway-info.js +0 -34
  72. package/dist/internal/gateway-info.js.map +0 -1
@@ -35,15 +35,46 @@ export interface Scope {
35
35
  createdAt: string;
36
36
  }
37
37
  export type AgentConnectionStatus = "provisioning" | "active" | "revoking" | "revoked";
38
+ /**
39
+ * Per-connection spend ceiling. The orchestrator refuses a new Task once the
40
+ * connection's cumulative spend on an axis reaches that axis's ceiling.
41
+ *
42
+ * The two axes are deliberately separate and never summed:
43
+ * - `gpuUnits` — compute units the platform itself METERED (a bill).
44
+ * - `a2aTokens` — tokens an external agent SELF-REPORTED over A2A (a stop
45
+ * signal, not a bill; the platform cannot verify it). Always an integer.
46
+ *
47
+ * An absent axis, or `0`, means "no ceiling on that axis". vault-api omits the
48
+ * whole `ceiling` key from an {@link AgentConnection} when neither axis is set.
49
+ */
50
+ export interface ConnectionCeiling {
51
+ /** Ceiling on platform-METERED compute units. Absent or 0 = no ceiling. */
52
+ gpuUnits?: number;
53
+ /** Ceiling on agent-SELF-REPORTED A2A tokens (integer). Absent or 0 = no ceiling. */
54
+ a2aTokens?: number;
55
+ }
38
56
  export interface AgentConnection {
39
57
  vaultId: string;
40
58
  agentId: string;
41
59
  scope: string;
60
+ /**
61
+ * The full set of vault scopes this connection declared, when the server
62
+ * reports it. Optional and additive: an older vault-api that predates the
63
+ * scope set omits this field entirely, so callers must not assume it is
64
+ * present — fall back to the singular `scope` (always present) when it's
65
+ * absent.
66
+ */
67
+ scopes?: string[];
42
68
  version: string;
43
69
  asPubKey: string;
44
70
  cubbyAliases: string[];
45
71
  status: AgentConnectionStatus;
46
72
  manifest?: unknown;
73
+ /**
74
+ * Spend ceiling for this connection. Absent (the key is omitted by
75
+ * vault-api) = no ceiling on either axis. See {@link ConnectionCeiling}.
76
+ */
77
+ ceiling?: ConnectionCeiling;
47
78
  createdAt: string;
48
79
  updatedAt: string;
49
80
  }
@@ -182,17 +213,53 @@ export interface CubbyExecResponse {
182
213
  lastInsertId?: number | string;
183
214
  [key: string]: unknown;
184
215
  }
216
+ /**
217
+ * Exactly one of `scope` (singular, pre-scope-set callers) or `scopes` (a
218
+ * set) may be supplied on a connect request/input — never both, never
219
+ * neither. The `?: never` on each arm's sibling turns "both" into a compile
220
+ * error for an object literal passed directly at the call site — a plain
221
+ * (non-exclusive) union of `{ scope: string }` and `{ scopes: string[] }`
222
+ * would NOT catch this: TypeScript's excess-property check only flags a
223
+ * property unknown to every constituent, and `scope`/`scopes` are each known
224
+ * to one constituent, so it would wave a literal naming both straight
225
+ * through. `?: never` on the sibling closes that gap. A value assembled
226
+ * dynamically (spread, external data, `any`) can still bypass this — see
227
+ * `resolveConnectScopes` in `./connect-scopes.js` for the runtime backstop.
228
+ */
229
+ export type ScopeSelector = {
230
+ scope: string;
231
+ scopes?: never;
232
+ } | {
233
+ scopes: string[];
234
+ scope?: never;
235
+ };
185
236
  /**
186
237
  * Body of vault-api `POST /api/v1/vaults/:v/agents`. Card-only: the vault-api
187
238
  * re-fetches the manifest from the DDC registry itself and ignores any
188
239
  * client-sent `version`/`manifestCid`, so neither is sent.
240
+ *
241
+ * `scopes` carries a set of vault scopes for the connection; `scope` is the
242
+ * pre-existing singular form, kept for callers that predate the set. Send
243
+ * whichever field the caller supplied — the SDK must not derive one from the
244
+ * other here. See {@link ScopeSelector} for why exactly one is required.
189
245
  */
190
- export interface ConnectAgentRequest {
246
+ export type ConnectAgentRequest = ScopeSelector & {
191
247
  agentId: string;
192
- scope: string;
193
248
  settings?: Record<string, unknown>;
194
249
  agreementSignature?: string;
195
- }
250
+ /**
251
+ * Optional spend ceiling, written atomically with the connection row —
252
+ * same fields and semantics as the `PUT …/agents/:a/ceiling` body
253
+ * (`{ gpuUnits, a2aTokens }`, absent axis or `0` = no ceiling on that
254
+ * axis). Set it here to avoid a window where the connection exists with no
255
+ * ceiling; use `setCeiling` to change it later.
256
+ *
257
+ * Validated client-side exactly like `Agents.setCeiling` before any
258
+ * request is sent; when present, both axes go on the wire (an absent axis
259
+ * as `0`). Omitted from the body entirely when `undefined`.
260
+ */
261
+ ceiling?: ConnectionCeiling;
262
+ };
196
263
  /**
197
264
  * ADR-002 object storage (company-memory-bank
198
265
  * 04-cef/user-vault/decisions/ADR-002-vault-object-storage.md).
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD,MAAM,MAAM,qBAAqB,GAAG,QAAQ,GAAG,YAAY,GAAG,cAAc,CAAC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AW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAC;IACZ,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,WAAW,EAAE,CAAC;CACvB"}
@@ -1,6 +1,6 @@
1
1
  import type { VaultHttpClient } from "../core/http.js";
2
2
  import { type ListJobsOptions } from "../internal/browse.js";
3
- import type { AgentConnection, AgentConnectionStatus, JobsPage } from "../core/types.js";
3
+ import type { AgentConnection, AgentConnectionStatus, ConnectionCeiling, JobsPage } from "../core/types.js";
4
4
  import { CubbyHandle } from "./cubby.js";
5
5
  export declare class AgentConnectionHandle implements AgentConnection {
6
6
  private readonly http;
@@ -8,11 +8,20 @@ export declare class AgentConnectionHandle implements AgentConnection {
8
8
  readonly vaultId: string;
9
9
  readonly agentId: string;
10
10
  readonly scope: string;
11
+ /**
12
+ * The full set of vault scopes this connection declared, when the server
13
+ * reports it. See {@link AgentConnection.scopes}. `this.scope` stays the
14
+ * single scope `cubby()` addresses — a cubby is keyed by one scope, and
15
+ * that remains correct even when the connection spans several.
16
+ */
17
+ readonly scopes?: string[];
11
18
  readonly version: string;
12
19
  readonly asPubKey: string;
13
20
  readonly cubbyAliases: string[];
14
21
  readonly status: AgentConnectionStatus;
15
22
  readonly manifest?: unknown;
23
+ /** Spend ceiling; absent = no ceiling on either axis. See {@link ConnectionCeiling}. */
24
+ readonly ceiling?: ConnectionCeiling;
16
25
  readonly createdAt: string;
17
26
  readonly updatedAt: string;
18
27
  private readonly api;
@@ -20,6 +29,12 @@ export declare class AgentConnectionHandle implements AgentConnection {
20
29
  constructor(http: VaultHttpClient, vaultIdRoot: string, record: AgentConnection);
21
30
  cubby(alias: string): CubbyHandle;
22
31
  update(settings: Record<string, unknown>): Promise<AgentConnectionHandle>;
32
+ /**
33
+ * Replace this connection's spend ceiling (`PUT …/ceiling`) and return a
34
+ * fresh handle. Absent axis = 0 = no ceiling; `{}` clears both. See
35
+ * `Agents.setCeiling` for validation.
36
+ */
37
+ setCeiling(ceiling: ConnectionCeiling): Promise<AgentConnectionHandle>;
23
38
  disconnect(): Promise<void>;
24
39
  jobs: {
25
40
  list: (o?: ListJobsOptions) => Promise<JobsPage>;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-connection.d.ts","sourceRoot":"","sources":["../../src/fluent/agent-connection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAU,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,qBAAa,qBAAsB,YAAW,eAAe;IAgBzD,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAhB9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,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C,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,wFAAwF;IACxF,QAAQ,CAAC,OAAO,CAAC,EAAE,iBAAiB,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAGb,IAAI,EAAE,eAAe,EACrB,WAAW,EAAE,MAAM,EACpC,MAAM,EAAE,eAAe;IAkBzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IAS3B,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK/E;;;;OAIG;IACG,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK5E,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3B,IAAI;mBACQ,eAAe,KAAQ,OAAO,CAAC,QAAQ,CAAC;MAElD;CACH"}
@@ -7,11 +7,20 @@ export class AgentConnectionHandle {
7
7
  vaultId;
8
8
  agentId;
9
9
  scope;
10
+ /**
11
+ * The full set of vault scopes this connection declared, when the server
12
+ * reports it. See {@link AgentConnection.scopes}. `this.scope` stays the
13
+ * single scope `cubby()` addresses — a cubby is keyed by one scope, and
14
+ * that remains correct even when the connection spans several.
15
+ */
16
+ scopes;
10
17
  version;
11
18
  asPubKey;
12
19
  cubbyAliases;
13
20
  status;
14
21
  manifest;
22
+ /** Spend ceiling; absent = no ceiling on either axis. See {@link ConnectionCeiling}. */
23
+ ceiling;
15
24
  createdAt;
16
25
  updatedAt;
17
26
  api;
@@ -22,11 +31,13 @@ export class AgentConnectionHandle {
22
31
  this.vaultId = record.vaultId;
23
32
  this.agentId = record.agentId;
24
33
  this.scope = record.scope;
34
+ this.scopes = record.scopes;
25
35
  this.version = record.version;
26
36
  this.asPubKey = record.asPubKey;
27
37
  this.cubbyAliases = record.cubbyAliases;
28
38
  this.status = record.status;
29
39
  this.manifest = record.manifest;
40
+ this.ceiling = record.ceiling;
30
41
  this.createdAt = record.createdAt;
31
42
  this.updatedAt = record.updatedAt;
32
43
  this.api = new Agents(http);
@@ -42,6 +53,15 @@ export class AgentConnectionHandle {
42
53
  const updated = await this.api.update(this.vaultIdRoot, this.agentId, settings);
43
54
  return new AgentConnectionHandle(this.http, this.vaultIdRoot, updated);
44
55
  }
56
+ /**
57
+ * Replace this connection's spend ceiling (`PUT …/ceiling`) and return a
58
+ * fresh handle. Absent axis = 0 = no ceiling; `{}` clears both. See
59
+ * `Agents.setCeiling` for validation.
60
+ */
61
+ async setCeiling(ceiling) {
62
+ const updated = await this.api.setCeiling(this.vaultIdRoot, this.agentId, ceiling);
63
+ return new AgentConnectionHandle(this.http, this.vaultIdRoot, updated);
64
+ }
45
65
  disconnect() {
46
66
  return this.api.disconnect(this.vaultIdRoot, this.agentId);
47
67
  }
@@ -1 +1 @@
1
- {"version":3,"file":"agent-connection.js","sourceRoot":"","sources":["../../src/fluent/agent-connection.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAwB,MAAM,uBAAuB,CAAC;AAErE,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ACH"}
@@ -0,0 +1,34 @@
1
+ import type { VaultHttpClient } from "../core/http.js";
2
+ import type { CubbyQueryResponse, CubbyExecResponse } from "../core/types.js";
3
+ import { type CubbyMigration, type ServiceCubby } from "../internal/cubbies.js";
4
+ /**
5
+ * One agent service's cubbies, in one vault.
6
+ *
7
+ * NO SCOPE. A scope is a compartment of a vault, and a cubby addressed inside
8
+ * one forks the state of whatever owns it — a service connected to `eng` and to
9
+ * `sales` would have two databases under one alias, remembering different things
10
+ * depending on which one triggered it. A service's cubbies are global within the
11
+ * vault, which is why this hangs off the vault rather than off a scope.
12
+ *
13
+ * The four things a console does with them: see what exists, read one, write to
14
+ * one, and create or remove one. Reads need a reader grant; everything else
15
+ * needs member level, which is not a relaxation — a member can already bring a
16
+ * cubby into being by writing into an alias that does not exist yet, so gating
17
+ * the deliberate version harder would only push people to the path with no
18
+ * schema in it.
19
+ */
20
+ export declare class ServiceHandle {
21
+ private readonly vaultId;
22
+ readonly asPubKey: string;
23
+ private readonly cubbies;
24
+ constructor(http: VaultHttpClient, vaultId: string, asPubKey: string);
25
+ /** Every cubby this service holds in this vault. The registry is the list. */
26
+ list(): Promise<ServiceCubby[]>;
27
+ cubby(alias: string): {
28
+ query<Row = unknown[]>(sql: string, params?: unknown[]): Promise<CubbyQueryResponse<Row>>;
29
+ exec(sql: string, params?: unknown[]): Promise<CubbyExecResponse>;
30
+ provision(migrations: CubbyMigration[]): Promise<void>;
31
+ delete(): Promise<void>;
32
+ };
33
+ }
34
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/fluent/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAW,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,aAAa;IAKtB,OAAO,CAAC,QAAQ,CAAC,OAAO;aACR,QAAQ,EAAE,MAAM;IALlC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAGhC,IAAI,EAAE,eAAe,EACJ,OAAO,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM;IAKlC,8EAA8E;IAC9E,IAAI,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAI/B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG;QACpB,KAAK,CAAC,GAAG,GAAG,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1F,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAClE,SAAS,CAAC,UAAU,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACvD,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;KACzB;CAYF"}
@@ -0,0 +1,41 @@
1
+ import { Cubbies } from "../internal/cubbies.js";
2
+ /**
3
+ * One agent service's cubbies, in one vault.
4
+ *
5
+ * NO SCOPE. A scope is a compartment of a vault, and a cubby addressed inside
6
+ * one forks the state of whatever owns it — a service connected to `eng` and to
7
+ * `sales` would have two databases under one alias, remembering different things
8
+ * depending on which one triggered it. A service's cubbies are global within the
9
+ * vault, which is why this hangs off the vault rather than off a scope.
10
+ *
11
+ * The four things a console does with them: see what exists, read one, write to
12
+ * one, and create or remove one. Reads need a reader grant; everything else
13
+ * needs member level, which is not a relaxation — a member can already bring a
14
+ * cubby into being by writing into an alias that does not exist yet, so gating
15
+ * the deliberate version harder would only push people to the path with no
16
+ * schema in it.
17
+ */
18
+ export class ServiceHandle {
19
+ vaultId;
20
+ asPubKey;
21
+ cubbies;
22
+ constructor(http, vaultId, asPubKey) {
23
+ this.vaultId = vaultId;
24
+ this.asPubKey = asPubKey;
25
+ this.cubbies = new Cubbies(http);
26
+ }
27
+ /** Every cubby this service holds in this vault. The registry is the list. */
28
+ list() {
29
+ return this.cubbies.serviceList(this.vaultId, this.asPubKey);
30
+ }
31
+ cubby(alias) {
32
+ const { vaultId, asPubKey, cubbies } = this;
33
+ return {
34
+ query: (sql, params = []) => cubbies.serviceQuery(vaultId, asPubKey, alias, sql, params),
35
+ exec: (sql, params = []) => cubbies.serviceExec(vaultId, asPubKey, alias, sql, params),
36
+ provision: (migrations) => cubbies.serviceProvision(vaultId, asPubKey, alias, migrations),
37
+ delete: () => cubbies.serviceDelete(vaultId, asPubKey, alias),
38
+ };
39
+ }
40
+ }
41
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/fluent/service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAA0C,MAAM,wBAAwB,CAAC;AAEzF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,aAAa;IAKL;IACD;IALD,OAAO,CAAU;IAElC,YACE,IAAqB,EACJ,OAAe,EAChB,QAAgB;QADf,YAAO,GAAP,OAAO,CAAQ;QAChB,aAAQ,GAAR,QAAQ,CAAQ;QAEhC,IAAI,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,8EAA8E;IAC9E,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK,CAAC,KAAa;QAMjB,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC5C,OAAO;YACL,KAAK,EAAE,CAAkB,GAAW,EAAE,SAAoB,EAAE,EAAE,EAAE,CAC9D,OAAO,CAAC,YAAY,CAAM,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC;YAClE,IAAI,EAAE,CAAC,GAAW,EAAE,SAAoB,EAAE,EAAE,EAAE,CAC5C,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC;YAC5D,SAAS,EAAE,CAAC,UAA4B,EAAE,EAAE,CAC1C,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC;YAChE,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;CACF"}
@@ -1,8 +1,10 @@
1
1
  import type { VaultHttpClient } from "../core/http.js";
2
2
  import { type CreateScopeRequest, type UpdateScopeRequest } from "../internal/scopes.js";
3
3
  import { Memory } from "../internal/memory.js";
4
- import type { JobsPage, Scope, VaultCredentialStatus, VaultRecord } from "../core/types.js";
4
+ import { Connections, type AgentAccess, type ConnectorDescriptor, type SetAgentAccessRequest } from "../internal/connectors.js";
5
+ import type { ConnectionCeiling, JobsPage, Scope, ScopeSelector, VaultCredentialStatus, VaultRecord } from "../core/types.js";
5
6
  import { ScopeHandle } from "./scope.js";
7
+ import { ServiceHandle } from "./service.js";
6
8
  import { AgentConnectionHandle } from "./agent-connection.js";
7
9
  import { JobHandle } from "./job.js";
8
10
  import type { Signer } from "@cef-ai/signer";
@@ -13,14 +15,16 @@ export interface VaultDeps {
13
15
  /** Signer — required for high-level `agents.connect`. */
14
16
  signer?: Signer;
15
17
  }
16
- /** Input for the high-level `vault.agents.connect` flow. */
17
- export interface ConnectAgentInput {
18
+ /**
19
+ * Input for the high-level `vault.agents.connect` flow. Exactly one of
20
+ * `scope`/`scopes` is required — see {@link ScopeSelector}.
21
+ */
22
+ export type ConnectAgentInput = ScopeSelector & {
18
23
  /**
19
24
  * Marketplace agent id, formatted `<agentServicePubkey>:<alias>`. The AS
20
25
  * pubkey is derived from the prefix unless `agentServicePubkey` is passed.
21
26
  */
22
27
  agentId: string;
23
- scope: string;
24
28
  settings?: Record<string, unknown>;
25
29
  /**
26
30
  * Explicit agent-service pubkey. Overrides the value derived from the
@@ -28,7 +32,19 @@ export interface ConnectAgentInput {
28
32
  * `<pubkey>:<alias>` form.
29
33
  */
30
34
  agentServicePubkey?: string;
31
- }
35
+ /**
36
+ * Optional spend ceiling (`{ gpuUnits?, a2aTokens? }`, absent axis or `0` =
37
+ * no ceiling on that axis), written atomically with the connection row.
38
+ * Set it here to avoid a window where the connection exists with no
39
+ * ceiling; use `setCeiling` to change it later.
40
+ *
41
+ * Validated like `AgentConnectionHandle.setCeiling` BEFORE the GAR
42
+ * agreement is signed or any request is sent — an invalid ceiling rejects
43
+ * with `VaultRequestError(status 0, "BAD_REQUEST")` and costs no wallet
44
+ * ceremony.
45
+ */
46
+ ceiling?: ConnectionCeiling;
47
+ };
32
48
  export declare class Vault {
33
49
  readonly id: string;
34
50
  readonly bucketId: string;
@@ -54,6 +70,13 @@ export declare class Vault {
54
70
  * agent-side (`ctx.memory` in `@cef-ai/agent-sdk`).
55
71
  */
56
72
  readonly memory: Memory;
73
+ /**
74
+ * This vault's connections: configured accounts of a connector (Slack,
75
+ * email, Telegram). Secrets go in on `create`/`update` and never come back
76
+ * out. An agent's access to one is under `vault.agents`.
77
+ */
78
+ readonly connections: Connections;
79
+ private readonly _access;
57
80
  private readonly _gar?;
58
81
  private readonly _signer?;
59
82
  private readonly _userPubKey;
@@ -66,21 +89,65 @@ export declare class Vault {
66
89
  delete: (n: string) => Promise<void>;
67
90
  };
68
91
  scope(name: string): ScopeHandle;
92
+ /**
93
+ * The cubbies an agent SERVICE owns in this vault.
94
+ *
95
+ * Off the VAULT, not off a scope. A scope is a compartment of a vault, and a
96
+ * cubby addressed inside one forks the state of whatever owns it — a service
97
+ * connected to two of them would remember different things depending on which
98
+ * one triggered it. A service's cubbies are global within the vault.
99
+ *
100
+ * `asPubKey` is the service's public key: the half of an agent id before the
101
+ * colon. It is named here rather than derived because the caller is a person
102
+ * or a console, not an agent — an agent reaches its own service through
103
+ * `ctx.cubby` and cannot name another.
104
+ */
105
+ service(asPubKey: string): ServiceHandle;
106
+ /** The connectors vault-api supports (Slack, email, Telegram): the public catalogue. */
107
+ connectors(): Promise<ConnectorDescriptor[]>;
69
108
  /** True when vault-api reports its S3 credential can no longer be refreshed. */
70
109
  isDisconnected(): boolean;
71
110
  agents: {
72
111
  /**
73
- * Connect an agent. Builds and signs the GAR consent agreement
74
- * internally, POSTs it to the configured GAR endpoint, then calls
75
- * vault-api `POST /agents` with the resulting bare-hex signature.
112
+ * Connect an agent. Builds and signs ONE GAR consent agreement covering
113
+ * the whole requested scope set, POSTs it to the configured GAR
114
+ * endpoint, then calls vault-api `POST /agents` with the resulting
115
+ * bare-hex signature.
76
116
  *
77
117
  * Requires both `garEndpoint` and a `signer` on `VaultSDKConfig`.
78
118
  * For the low-level surface (pre-signed `agreementSignature`), use
79
119
  * `Agents.connect` from `@cef-ai/vault-sdk/internal`.
120
+ *
121
+ * Pass `ceiling` to set the connection's spend ceiling in the same
122
+ * atomic write as the connection row: set it here to avoid a window
123
+ * where the connection exists with no ceiling; use `setCeiling` to
124
+ * change it later. It is validated before anything is signed or sent.
125
+ *
126
+ * One agreement, not one per scope: the vault-api's connect precheck
127
+ * (`Agreement.CheckScopeGrant` in the vault repo) keys consent on
128
+ * (agent-service pubkey, user pubkey) only and explicitly discards the
129
+ * `scope` argument it's passed — `internal/compute/vault/agreement/
130
+ * client.go`'s signature names that parameter `_ /* scope *\/`, and its
131
+ * doc says plainly that GAR's scope list is "opaque" to the vault and
132
+ * that "scope membership is the user's call at consent time — encoded in
133
+ * the agreement they sign." Signing N agreements for the same (AS, user)
134
+ * pair would just answer that one cached check N times — no additional
135
+ * gate cleared — while costing N wallet ceremonies and N POSTs to the
136
+ * same GAR key. So `agreementSignature`'s single agreement carries
137
+ * `metadata.scopes` = the whole effective set, honestly recording what
138
+ * the user actually consented to.
80
139
  */
81
140
  connect: (input: ConnectAgentInput) => Promise<AgentConnectionHandle>;
82
141
  list: () => Promise<AgentConnectionHandle[]>;
83
142
  get: (a: string) => Promise<AgentConnectionHandle>;
143
+ /** The agent's access to this vault's connections. */
144
+ connections: (agentId: string) => Promise<AgentAccess[]>;
145
+ /**
146
+ * Sets what the agent may do with a connection, in the agent connection's
147
+ * own scope. Both lists empty deletes the access and resolves `undefined`.
148
+ */
149
+ setConnection: (agentId: string, connectionId: string, body: SetAgentAccessRequest) => Promise<AgentAccess | undefined>;
150
+ removeConnection: (agentId: string, connectionId: string) => Promise<void>;
84
151
  };
85
152
  jobs: {
86
153
  list: (o?: {
@@ -1 +1 @@
1
- {"version":3,"file":"vault.d.ts","sourceRoot":"","sources":["../../src/fluent/vault.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,EAEV,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI7D,MAAM,WAAW,SAAS;IACxB,uEAAuE;IACvE,GAAG,CAAC,E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SAAS,CAAC;oCACP,MAAM,gBAAgB,MAAM,KAAG,OAAO,CAAC,IAAI,CAAC;MAExE;IAEF,IAAI;mBAEG;YAAE,KAAK,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,KACrD,OAAO,CAAC,QAAQ,CAAC;qBACP,MAAM,KAAG,SAAS;MAE/B;CACH"}
@@ -1,8 +1,11 @@
1
1
  import { Scopes, } from "../internal/scopes.js";
2
- import { Agents } from "../internal/agents.js";
2
+ import { Agents, validateCeiling } from "../internal/agents.js";
3
3
  import { Browse } from "../internal/browse.js";
4
4
  import { Memory } from "../internal/memory.js";
5
+ import { AgentConnectionAccess, Connections, listConnectors, } from "../internal/connectors.js";
6
+ import { resolveConnectScopes } from "../core/connect-scopes.js";
5
7
  import { ScopeHandle } from "./scope.js";
8
+ import { ServiceHandle } from "./service.js";
6
9
  import { AgentConnectionHandle } from "./agent-connection.js";
7
10
  import { JobHandle } from "./job.js";
8
11
  import { signAndSubmitAgreement } from "../agreements/sign.js";
@@ -32,6 +35,13 @@ export class Vault {
32
35
  * agent-side (`ctx.memory` in `@cef-ai/agent-sdk`).
33
36
  */
34
37
  memory;
38
+ /**
39
+ * This vault's connections: configured accounts of a connector (Slack,
40
+ * email, Telegram). Secrets go in on `create`/`update` and never come back
41
+ * out. An agent's access to one is under `vault.agents`.
42
+ */
43
+ connections;
44
+ _access;
35
45
  _gar;
36
46
  _signer;
37
47
  _userPubKey;
@@ -49,6 +59,8 @@ export class Vault {
49
59
  this._agents = new Agents(http);
50
60
  this._browse = new Browse(http);
51
61
  this.memory = new Memory(this._http, this.id);
62
+ this.connections = new Connections(this._http, this.id);
63
+ this._access = new AgentConnectionAccess(this._http, this.id);
52
64
  this._gar = deps.gar;
53
65
  this._signer = deps.signer;
54
66
  // Prefer the live signer pubkey (the user's actual key) over whatever the
@@ -68,17 +80,57 @@ export class Vault {
68
80
  scope(name) {
69
81
  return new ScopeHandle(this._http, this.id, name);
70
82
  }
83
+ /**
84
+ * The cubbies an agent SERVICE owns in this vault.
85
+ *
86
+ * Off the VAULT, not off a scope. A scope is a compartment of a vault, and a
87
+ * cubby addressed inside one forks the state of whatever owns it — a service
88
+ * connected to two of them would remember different things depending on which
89
+ * one triggered it. A service's cubbies are global within the vault.
90
+ *
91
+ * `asPubKey` is the service's public key: the half of an agent id before the
92
+ * colon. It is named here rather than derived because the caller is a person
93
+ * or a console, not an agent — an agent reaches its own service through
94
+ * `ctx.cubby` and cannot name another.
95
+ */
96
+ service(asPubKey) {
97
+ return new ServiceHandle(this._http, this.id, asPubKey);
98
+ }
99
+ /** The connectors vault-api supports (Slack, email, Telegram): the public catalogue. */
100
+ connectors() {
101
+ return listConnectors(this._http);
102
+ }
71
103
  /** True when vault-api reports its S3 credential can no longer be refreshed. */
72
104
  isDisconnected() { return this.status === "disconnected"; }
73
105
  agents = {
74
106
  /**
75
- * Connect an agent. Builds and signs the GAR consent agreement
76
- * internally, POSTs it to the configured GAR endpoint, then calls
77
- * vault-api `POST /agents` with the resulting bare-hex signature.
107
+ * Connect an agent. Builds and signs ONE GAR consent agreement covering
108
+ * the whole requested scope set, POSTs it to the configured GAR
109
+ * endpoint, then calls vault-api `POST /agents` with the resulting
110
+ * bare-hex signature.
78
111
  *
79
112
  * Requires both `garEndpoint` and a `signer` on `VaultSDKConfig`.
80
113
  * For the low-level surface (pre-signed `agreementSignature`), use
81
114
  * `Agents.connect` from `@cef-ai/vault-sdk/internal`.
115
+ *
116
+ * Pass `ceiling` to set the connection's spend ceiling in the same
117
+ * atomic write as the connection row: set it here to avoid a window
118
+ * where the connection exists with no ceiling; use `setCeiling` to
119
+ * change it later. It is validated before anything is signed or sent.
120
+ *
121
+ * One agreement, not one per scope: the vault-api's connect precheck
122
+ * (`Agreement.CheckScopeGrant` in the vault repo) keys consent on
123
+ * (agent-service pubkey, user pubkey) only and explicitly discards the
124
+ * `scope` argument it's passed — `internal/compute/vault/agreement/
125
+ * client.go`'s signature names that parameter `_ /* scope *\/`, and its
126
+ * doc says plainly that GAR's scope list is "opaque" to the vault and
127
+ * that "scope membership is the user's call at consent time — encoded in
128
+ * the agreement they sign." Signing N agreements for the same (AS, user)
129
+ * pair would just answer that one cached check N times — no additional
130
+ * gate cleared — while costing N wallet ceremonies and N POSTs to the
131
+ * same GAR key. So `agreementSignature`'s single agreement carries
132
+ * `metadata.scopes` = the whole effective set, honestly recording what
133
+ * the user actually consented to.
82
134
  */
83
135
  connect: async (input) => {
84
136
  if (!this._gar) {
@@ -98,18 +150,34 @@ export class Vault {
98
150
  `'${input.agentId}' (expected '<pubkey>:<alias>'); pass ` +
99
151
  `agentServicePubkey explicitly`);
100
152
  }
153
+ // Effective scope set, resolved once — also the runtime backstop for
154
+ // a dynamically-built `input` naming both `scope` and `scopes` (or
155
+ // neither), bypassing ScopeSelector's compile-time guarantee for an
156
+ // object literal. Used only to decide what the single GAR agreement's
157
+ // `metadata.scopes` contains; the wire body below still sends exactly
158
+ // whichever field the caller supplied, untouched.
159
+ const effectiveScopes = resolveConnectScopes(input, "vault.agents.connect");
160
+ // Validate the ceiling before the wallet ceremony and the GAR POST:
161
+ // a bad ceiling must not cost a signature (Agents.connect re-validates
162
+ // the same value — it is the low-level surface's own guard).
163
+ if (input.ceiling !== undefined)
164
+ validateCeiling(input.ceiling);
101
165
  const { agreementSignature } = await signAndSubmitAgreement({
102
166
  signer: this._signer,
103
167
  vault: { id: this.id, userPubKey: this._userPubKey },
104
168
  agent: { agentId: input.agentId, agentServicePubkey },
105
- scope: input.scope,
169
+ scopes: effectiveScopes,
106
170
  gar: this._gar,
107
171
  });
172
+ const scopeFields = input.scope !== undefined
173
+ ? { scope: input.scope }
174
+ : { scopes: input.scopes };
108
175
  const req = {
109
176
  agentId: input.agentId,
110
- scope: input.scope,
177
+ ...scopeFields,
111
178
  settings: input.settings ?? {},
112
179
  agreementSignature,
180
+ ...(input.ceiling !== undefined ? { ceiling: input.ceiling } : {}),
113
181
  };
114
182
  const conn = await this._agents.connect(this.id, req);
115
183
  return new AgentConnectionHandle(this._http, this.id, conn);
@@ -122,6 +190,14 @@ export class Vault {
122
190
  const conn = await this._agents.get(this.id, a);
123
191
  return new AgentConnectionHandle(this._http, this.id, conn);
124
192
  },
193
+ /** The agent's access to this vault's connections. */
194
+ connections: (agentId) => this._access.list(agentId),
195
+ /**
196
+ * Sets what the agent may do with a connection, in the agent connection's
197
+ * own scope. Both lists empty deletes the access and resolves `undefined`.
198
+ */
199
+ setConnection: (agentId, connectionId, body) => this._access.set(agentId, connectionId, body),
200
+ removeConnection: (agentId, connectionId) => this._access.remove(agentId, connectionId),
125
201
  };
126
202
  jobs = {
127
203
  list: (o = {}) => this._browse.listJobs(this.id, o),