@agentvalet/client 0.1.1 → 0.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.
package/README.md CHANGED
@@ -46,6 +46,20 @@ const result = await av.call({
46
46
  });
47
47
  ```
48
48
 
49
+ `call()` resolves to the broker's envelope — the upstream SaaS body under
50
+ `data`, with `_meta` describing the call itself:
51
+
52
+ ```typescript
53
+ {
54
+ data: { ok: true, ts: "1723800000.000100" }, // exactly what Slack returned
55
+ _meta: { capability: "agent.action", timestamp: "…", next_actions: […], docs: "…" }
56
+ }
57
+ ```
58
+
59
+ So it's `result.data.ok`, not `result.ok`. The split is deliberate: `data` is the
60
+ upstream payload byte-for-byte, so anything the broker adds about the call stays
61
+ outside it.
62
+
49
63
  `fromEnv()` reads `AGENTVALET_AGENT_ID` / `AGENTVALET_OWNER_ID` (or the bare
50
64
  `AGENT_ID` / `OWNER_ID` the CLI writes) and finds the key via
51
65
  `AGENT_PRIVATE_KEY_B64`, `AGENT_PRIVATE_KEY_PATH`, `AGENT_PRIVATE_KEY`, or
@@ -135,6 +149,88 @@ await av.evaluate("stripe", "charge"); // dry-run the decision, no side effe
135
149
  `evaluate()` is worth a call before anything destructive — it tells you whether
136
150
  the action would be allowed without performing it.
137
151
 
152
+ ## Which connection served the call
153
+
154
+ When a platform has several connections and you don't pin one, the broker uses
155
+ the default. That's the quiet failure behind a lot of confused agents: you ask
156
+ for a repo, the default GitHub account doesn't have it, you get a 404, and you
157
+ conclude the repo doesn't exist rather than that you're on the wrong account.
158
+
159
+ When there was more than one connection you could have used, the response says
160
+ so. On success it rides `_meta`, leaving `data` untouched:
161
+
162
+ ```typescript
163
+ res._meta.connection;
164
+ // {
165
+ // used: "o-github", label: "Acme", defaulted: true,
166
+ // others: [{ connection_id: "o-github-9f1c", label: "Personal" }],
167
+ // hint: "…the target may live on another connection — retry with connection_id…"
168
+ // }
169
+ ```
170
+
171
+ On an upstream error there's no envelope — the body is exactly what the platform
172
+ sent — so the same information arrives as one namespaced key, carried on
173
+ `ProxyError.body`:
174
+
175
+ ```json
176
+ {
177
+ "message": "Not Found",
178
+ "_agentvalet": { "connection": { "used": "o-github", "defaulted": true, "others": [], "hint": "…" } }
179
+ }
180
+ ```
181
+
182
+ The upstream keys stay where they were, so existing error handling is unaffected.
183
+ It's absent when there's nothing to act on — a connection you pinned, a platform
184
+ with one connection, or a lookup that failed — so treat its absence as "no
185
+ alternatives", never as "this is definitely the right account".
186
+
187
+ ## One identity per subagent
188
+
189
+ If your orchestrator fans work out to subagents, don't hand them your key. Mint
190
+ each one a child identity: a bearer token that is scope-attenuated, time-boxed,
191
+ independently revocable, and audited under its own agent id.
192
+
193
+ ```typescript
194
+ const child = await av.issueChild(
195
+ [{ platform: "github", scopes: ["github:issues.read"] }],
196
+ { name: "triage-worker", ttlSeconds: 600 },
197
+ );
198
+
199
+ // Hand the subagent the token and nothing else.
200
+ const sub = child.client(); // or AgentValet.fromBearer(child.bearerToken)
201
+ await sub.call({ platform: "github", endpoint: "/issues", scope: "github:issues.read" });
202
+ ```
203
+
204
+ The proxy attenuates every grant against what *you* currently hold — you cannot
205
+ delegate more than you have — and refuses the whole call if the intersection is
206
+ empty. `child.granted` is what it actually issued, which is not necessarily what
207
+ you asked for. Revoking or suspending the parent contains every child on its
208
+ next call.
209
+
210
+ Bounds that are enforced server-side, and that you should design around rather
211
+ than discover:
212
+
213
+ | | |
214
+ |---|---|
215
+ | Delegation depth | 1 — a child cannot mint children. `issueChild()` on a bearer client throws `ConfigError` locally. |
216
+ | TTL | 60–3600s, default 900. **No refresh endpoint** — a longer run must re-mint from the parent. |
217
+ | Live children | 25 per parent. |
218
+ | Grants per call | 25. |
219
+
220
+ ## Tagging a run
221
+
222
+ `sessionId` tags everything a client does, so an audit reader can group one run —
223
+ or tell a parent's calls from its children's.
224
+
225
+ ```typescript
226
+ const av = AgentValet.fromEnv({ sessionId: `run:${runId}` });
227
+ ```
228
+
229
+ It rides the signed assertion as a `session_id` claim, or `X-AV-Session` in
230
+ bearer mode, and also reads from `AGENTVALET_SESSION_ID`. **Attribution only** —
231
+ the proxy never branches an authorization decision on it, and it is not verified
232
+ to belong to the calling agent. Don't treat it as a security boundary.
233
+
138
234
  ## Self-hosting
139
235
 
140
236
  Point `proxyUrl` at your own deployment. Everything else is identical.
@@ -0,0 +1,51 @@
1
+ import type { AgentValet } from "./client.js";
2
+ /** One platform's worth of authority to hand down. Attenuated server-side
3
+ * against what the parent itself currently holds — you cannot delegate more
4
+ * than you have, and the proxy rejects the whole call if the intersection is
5
+ * empty (`no_scopes_after_attenuation`). */
6
+ export interface ChildGrant {
7
+ platform: string;
8
+ scopes: string[];
9
+ /** Pin the child to one connection when the platform has several. Omitted
10
+ * from the wire entirely when absent — the proxy's per-connection rows win
11
+ * over the platform-wide row, so a stray null would change the selection. */
12
+ connectionId?: string;
13
+ }
14
+ /** What the proxy actually granted, after attenuation. Not necessarily what
15
+ * was asked for — always the intersection with the parent's live grants. */
16
+ export interface GrantedScope {
17
+ platform: string;
18
+ scopes: string[];
19
+ require_approval: boolean;
20
+ }
21
+ /**
22
+ * A time-boxed, scope-attenuated bearer identity for a subagent.
23
+ *
24
+ * Hand `bearerToken` to the subagent and nothing else — not this client, not
25
+ * your private key. The token IS the identity: already attenuated, already
26
+ * expiring, independently revocable, and audited under its own agent id.
27
+ *
28
+ * Server-side bounds worth knowing before you design around this:
29
+ * - delegation depth is capped at 1, so a child cannot mint children;
30
+ * - the TTL is 60..3600s and there is NO refresh endpoint — a run longer
31
+ * than the TTL must re-mint from the parent;
32
+ * - a parent may hold at most 25 live children at once.
33
+ */
34
+ export declare class ChildIdentity {
35
+ readonly childAgentId: string;
36
+ readonly bearerToken: string;
37
+ /** ISO-8601. After this the token is dead and cannot be renewed. */
38
+ readonly expiresAt: string;
39
+ readonly granted: GrantedScope[];
40
+ private readonly buildClient;
41
+ constructor(childAgentId: string, bearerToken: string,
42
+ /** ISO-8601. After this the token is dead and cannot be renewed. */
43
+ expiresAt: string, granted: GrantedScope[], buildClient: (bearerToken: string) => AgentValet);
44
+ /**
45
+ * A bearer-mode client for this child. Inherits the issuing client's
46
+ * proxyUrl, fetch and timeouts — a child pointed at a different host than
47
+ * the parent that minted it would simply 401.
48
+ */
49
+ client(): AgentValet;
50
+ }
51
+ //# sourceMappingURL=child.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child.d.ts","sourceRoot":"","sources":["../src/child.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;6CAG6C;AAC7C,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB;;kFAE8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;6EAC6E;AAC7E,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAa;IAEtB,QAAQ,CAAC,YAAY,EAAE,MAAM;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM;IAC5B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE;IAChC,OAAO,CAAC,QAAQ,CAAC,WAAW;gBALnB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM;IAC5B,oEAAoE;IAC3D,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EAAE,EACf,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,UAAU;IAGnE;;;;OAIG;IACH,MAAM,IAAI,UAAU;CAGrB"}
package/dist/child.js ADDED
@@ -0,0 +1,48 @@
1
+ // packages/client/src/child.ts
2
+ //
3
+ // Child identities minted via AgentValet.issueChild().
4
+ //
5
+ // Mirrors packages/python-client/src/agentvalet/child.py, including the reason
6
+ // it is a separate module: client.ts needs ChildIdentity as a return type and
7
+ // ChildIdentity needs AgentValet for .client(). Python breaks that cycle with a
8
+ // deferred import; ESM lets us do the same with a dynamic import, but a plain
9
+ // factory injected at construction time is cheaper and keeps the type graph
10
+ // acyclic — so the client hands ChildIdentity the builder it should use.
11
+ /**
12
+ * A time-boxed, scope-attenuated bearer identity for a subagent.
13
+ *
14
+ * Hand `bearerToken` to the subagent and nothing else — not this client, not
15
+ * your private key. The token IS the identity: already attenuated, already
16
+ * expiring, independently revocable, and audited under its own agent id.
17
+ *
18
+ * Server-side bounds worth knowing before you design around this:
19
+ * - delegation depth is capped at 1, so a child cannot mint children;
20
+ * - the TTL is 60..3600s and there is NO refresh endpoint — a run longer
21
+ * than the TTL must re-mint from the parent;
22
+ * - a parent may hold at most 25 live children at once.
23
+ */
24
+ export class ChildIdentity {
25
+ childAgentId;
26
+ bearerToken;
27
+ expiresAt;
28
+ granted;
29
+ buildClient;
30
+ constructor(childAgentId, bearerToken,
31
+ /** ISO-8601. After this the token is dead and cannot be renewed. */
32
+ expiresAt, granted, buildClient) {
33
+ this.childAgentId = childAgentId;
34
+ this.bearerToken = bearerToken;
35
+ this.expiresAt = expiresAt;
36
+ this.granted = granted;
37
+ this.buildClient = buildClient;
38
+ }
39
+ /**
40
+ * A bearer-mode client for this child. Inherits the issuing client's
41
+ * proxyUrl, fetch and timeouts — a child pointed at a different host than
42
+ * the parent that minted it would simply 401.
43
+ */
44
+ client() {
45
+ return this.buildClient(this.bearerToken);
46
+ }
47
+ }
48
+ //# sourceMappingURL=child.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"child.js","sourceRoot":"","sources":["../src/child.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,uDAAuD;AACvD,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,gFAAgF;AAChF,8EAA8E;AAC9E,4EAA4E;AAC5E,yEAAyE;AAyBzE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IAEb;IACA;IAEA;IACA;IACQ;IANnB,YACW,YAAoB,EACpB,WAAmB;IAC5B,oEAAoE;IAC3D,SAAiB,EACjB,OAAuB,EACf,WAAgD;QALxD,iBAAY,GAAZ,YAAY,CAAQ;QACpB,gBAAW,GAAX,WAAW,CAAQ;QAEnB,cAAS,GAAT,SAAS,CAAQ;QACjB,YAAO,GAAP,OAAO,CAAgB;QACf,gBAAW,GAAX,WAAW,CAAqC;IAChE,CAAC;IAEJ;;;;OAIG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5C,CAAC;CACF"}
package/dist/client.d.ts CHANGED
@@ -1,9 +1,20 @@
1
1
  import { type FetchLike } from "./http.js";
2
+ import { ChildIdentity, type ChildGrant } from "./child.js";
2
3
  export interface AgentValetOptions {
3
4
  agentId: string;
4
5
  ownerId: string;
5
6
  /** RS256 private key, PEM (PKCS#8). */
6
7
  privateKey: string;
8
+ /**
9
+ * Forensic attribution tag for everything this client does. Rides the signed
10
+ * assertion as a `session_id` claim, or the `X-AV-Session` header in bearer
11
+ * mode. Free text, `[A-Za-z0-9._:-]{1,128}`.
12
+ *
13
+ * Attribution ONLY. The proxy never branches an authorization decision on
14
+ * it, and it is not verified to belong to the calling agent — do not treat
15
+ * it as a security boundary.
16
+ */
17
+ sessionId?: string;
7
18
  /** Defaults to https://api.agentvalet.ai. */
8
19
  proxyUrl?: string;
9
20
  /** Per-request network timeout. Default 15s. */
@@ -27,6 +38,9 @@ export interface AgentValetOptions {
27
38
  endpoint: string;
28
39
  }) => void;
29
40
  }
41
+ /** Options for a bearer-mode client. It has no keypair: the token carries the
42
+ * identity, so agentId/ownerId/privateKey are neither needed nor accepted. */
43
+ export type BearerOptions = Omit<Partial<AgentValetOptions>, "privateKey">;
30
44
  export interface CallRequest {
31
45
  platform: string;
32
46
  endpoint: string;
@@ -44,19 +58,38 @@ export declare class AgentValet {
44
58
  readonly agentId: string;
45
59
  readonly ownerId: string;
46
60
  readonly proxyUrl: string;
61
+ /** Forensic tag sent with every request, or undefined if unset. */
62
+ readonly sessionId: string | undefined;
47
63
  private readonly privateKeyPem;
64
+ /** Set only in bearer mode (a child identity). Mutually exclusive with a key. */
65
+ private readonly bearerToken;
48
66
  private readonly timeoutMs;
49
67
  private readonly approvalTimeoutMs;
50
68
  private readonly approvalPollMs;
51
69
  private readonly doFetch;
52
70
  private readonly onApprovalPending?;
53
71
  private importedKey;
54
- constructor(opts: AgentValetOptions);
72
+ constructor(opts: AgentValetOptions & {
73
+ bearerToken?: string;
74
+ });
55
75
  /**
56
76
  * Builds a client from the environment. Works out of the box on a machine
57
77
  * that has run `npx @agentvalet/register`. See env.ts for the accepted names.
58
78
  */
59
79
  static fromEnv(overrides?: Partial<AgentValetOptions>): AgentValet;
80
+ /**
81
+ * Builds a client authenticated with a pre-issued bearer token.
82
+ *
83
+ * This is how a subagent uses the token from `issueChild()`: no agentId,
84
+ * ownerId, or private key — the token itself carries the (already
85
+ * attenuated, already time-boxed) identity, and it is sent verbatim as
86
+ * `Authorization: Bearer <token>` on every call instead of being signed
87
+ * fresh per request. Everything else behaves identically.
88
+ *
89
+ * A bearer-mode client cannot call `issueChild()` — the server caps
90
+ * delegation depth at 1.
91
+ */
92
+ static fromBearer(bearerToken: string, overrides?: BearerOptions): AgentValet;
60
93
  /**
61
94
  * Calls an approved platform through the broker. Returns the upstream SaaS
62
95
  * response body, parsed.
@@ -103,7 +136,34 @@ export declare class AgentValet {
103
136
  status: "approved" | "denied" | "pending";
104
137
  requestToken: string;
105
138
  }>;
106
- /** Signs a short-lived (60s) RS256 assertion of this agent's identity. */
139
+ /**
140
+ * Mints a time-boxed, scope-attenuated bearer identity for a subagent.
141
+ *
142
+ * The proxy attenuates every grant against what THIS agent currently holds —
143
+ * you cannot hand out more than you have — and refuses outright if the
144
+ * intersection is empty (`no_scopes_after_attenuation`). Revoking or
145
+ * suspending this agent contains every child it minted on their next call.
146
+ *
147
+ * Give `bearerToken` to the subagent and nothing else: not this client, not
148
+ * your private key. Build its client with `child.client()` or
149
+ * `AgentValet.fromBearer(child.bearerToken)`.
150
+ *
151
+ * @throws ConfigError on a bearer-mode client (depth cap is 1, so this fails
152
+ * locally before any network call), or on locally-invalid grants/TTL.
153
+ * @throws ProxyError if the proxy refused — `.status` and `.body` carry the
154
+ * code (`agent_not_active`, `delegation_depth_exceeded`, the 25-live-child
155
+ * cap, `as_signing_unavailable`, ...).
156
+ */
157
+ issueChild(grants: ChildGrant[], opts?: {
158
+ name?: string;
159
+ ttlSeconds?: number;
160
+ }): Promise<ChildIdentity>;
161
+ /**
162
+ * Signs a short-lived (60s) RS256 assertion of this agent's identity.
163
+ *
164
+ * Not available in bearer mode — a child has no key to sign with; it sends
165
+ * its pre-issued token as-is on every request.
166
+ */
107
167
  signJWT(): Promise<string>;
108
168
  private authedFetch;
109
169
  private getJson;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAwBA,OAAO,EAA+D,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAcxG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,0CAA0C;IAC1C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QACzB,UAAU,EAAE,MAAM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AK,OAAO,CAAC,CAAC,CAAC;IAI9C,yEAAyE;IACnE,cAAc,CAAC,CAAC,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC;IAI/C;;;OAGG;IACG,QAAQ,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAcxE;;;;OAIG;IACG,aAAa,CACjB,GAAG,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7E,OAAO,CAAC;QAAE,MAAM,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;IA8B/E;;;;;;;;;;;;;;;;;OAiBG;IACG,UAAU,CACd,MAAM,EAAE,UAAU,EAAE,EACpB,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAO,GAChD,OAAO,CAAC,aAAa,CAAC;IA6BzB;;;;;OAKG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;YA8BlB,WAAW;YAkCX,OAAO;CAMtB"}
package/dist/client.js CHANGED
@@ -13,7 +13,8 @@
13
13
  import { SignJWT, importPKCS8 } from "jose";
14
14
  import { AccessDeniedError, ApprovalDeniedError, ApprovalExpiredError, ApprovalTimeoutError, ConfigError, ProxyError, UpstreamError, } from "./errors.js";
15
15
  import { diagnoseNetworkError, fetchWithTimeout, sleep, tryParseJson } from "./http.js";
16
- import { DEFAULT_PROXY_URL, agentIdFromEnv, ownerIdFromEnv, privateKeyFromEnv, proxyUrlFromEnv, } from "./env.js";
16
+ import { CHILD_TTL_DEFAULT_S, buildIssueChildBody, identityFromBearer, interpretIssueChildResponse, validateSessionId, } from "./protocol.js";
17
+ import { DEFAULT_PROXY_URL, agentIdFromEnv, ownerIdFromEnv, privateKeyFromEnv, proxyUrlFromEnv, sessionIdFromEnv, } from "./env.js";
17
18
  /** Matches the mcp-server's budget: under Claude Desktop's 60s tool timeout. */
18
19
  const DEFAULT_APPROVAL_TIMEOUT_MS = 50_000;
19
20
  const DEFAULT_APPROVAL_POLL_MS = 2_000;
@@ -22,7 +23,11 @@ export class AgentValet {
22
23
  agentId;
23
24
  ownerId;
24
25
  proxyUrl;
26
+ /** Forensic tag sent with every request, or undefined if unset. */
27
+ sessionId;
25
28
  privateKeyPem;
29
+ /** Set only in bearer mode (a child identity). Mutually exclusive with a key. */
30
+ bearerToken;
26
31
  timeoutMs;
27
32
  approvalTimeoutMs;
28
33
  approvalPollMs;
@@ -30,15 +35,21 @@ export class AgentValet {
30
35
  onApprovalPending;
31
36
  importedKey = null;
32
37
  constructor(opts) {
33
- if (!opts.agentId)
34
- throw new ConfigError("agentId is required");
35
- if (!opts.ownerId)
36
- throw new ConfigError("ownerId is required");
37
- if (!opts.privateKey)
38
- throw new ConfigError("privateKey is required");
38
+ // Bearer mode skips the keypair checks — the token IS the identity, and
39
+ // ids are recovered from its payload rather than supplied by the caller.
40
+ if (!opts.bearerToken) {
41
+ if (!opts.agentId)
42
+ throw new ConfigError("agentId is required");
43
+ if (!opts.ownerId)
44
+ throw new ConfigError("ownerId is required");
45
+ if (!opts.privateKey)
46
+ throw new ConfigError("privateKey is required");
47
+ }
48
+ this.bearerToken = opts.bearerToken ?? null;
39
49
  this.agentId = opts.agentId;
40
50
  this.ownerId = opts.ownerId;
41
51
  this.privateKeyPem = opts.privateKey;
52
+ this.sessionId = validateSessionId(opts.sessionId);
42
53
  this.proxyUrl = (opts.proxyUrl ?? DEFAULT_PROXY_URL).replace(/\/$/, "");
43
54
  this.timeoutMs = opts.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
44
55
  this.approvalTimeoutMs = opts.approvalTimeoutMs ?? DEFAULT_APPROVAL_TIMEOUT_MS;
@@ -63,6 +74,34 @@ export class AgentValet {
63
74
  ownerId,
64
75
  privateKey: overrides.privateKey ?? privateKeyFromEnv(),
65
76
  proxyUrl: overrides.proxyUrl ?? proxyUrlFromEnv(),
77
+ sessionId: overrides.sessionId ?? sessionIdFromEnv() ?? undefined,
78
+ });
79
+ }
80
+ /**
81
+ * Builds a client authenticated with a pre-issued bearer token.
82
+ *
83
+ * This is how a subagent uses the token from `issueChild()`: no agentId,
84
+ * ownerId, or private key — the token itself carries the (already
85
+ * attenuated, already time-boxed) identity, and it is sent verbatim as
86
+ * `Authorization: Bearer <token>` on every call instead of being signed
87
+ * fresh per request. Everything else behaves identically.
88
+ *
89
+ * A bearer-mode client cannot call `issueChild()` — the server caps
90
+ * delegation depth at 1.
91
+ */
92
+ static fromBearer(bearerToken, overrides = {}) {
93
+ if (!bearerToken)
94
+ throw new ConfigError("bearerToken is required");
95
+ // The token already names its own subject. Recover it so anything that has
96
+ // to identify the caller (evaluate(), logging) works in bearer mode too;
97
+ // an explicit override always wins.
98
+ const derived = identityFromBearer(bearerToken);
99
+ return new AgentValet({
100
+ ...overrides,
101
+ bearerToken,
102
+ agentId: overrides.agentId ?? derived.agentId ?? "",
103
+ ownerId: overrides.ownerId ?? derived.ownerId ?? "",
104
+ privateKey: "",
66
105
  });
67
106
  }
68
107
  // ---- core ---------------------------------------------------------------
@@ -222,9 +261,58 @@ export class AgentValet {
222
261
  }
223
262
  return { status: "pending", requestToken: token };
224
263
  }
264
+ // ---- delegation ---------------------------------------------------------
265
+ /**
266
+ * Mints a time-boxed, scope-attenuated bearer identity for a subagent.
267
+ *
268
+ * The proxy attenuates every grant against what THIS agent currently holds —
269
+ * you cannot hand out more than you have — and refuses outright if the
270
+ * intersection is empty (`no_scopes_after_attenuation`). Revoking or
271
+ * suspending this agent contains every child it minted on their next call.
272
+ *
273
+ * Give `bearerToken` to the subagent and nothing else: not this client, not
274
+ * your private key. Build its client with `child.client()` or
275
+ * `AgentValet.fromBearer(child.bearerToken)`.
276
+ *
277
+ * @throws ConfigError on a bearer-mode client (depth cap is 1, so this fails
278
+ * locally before any network call), or on locally-invalid grants/TTL.
279
+ * @throws ProxyError if the proxy refused — `.status` and `.body` carry the
280
+ * code (`agent_not_active`, `delegation_depth_exceeded`, the 25-live-child
281
+ * cap, `as_signing_unavailable`, ...).
282
+ */
283
+ async issueChild(grants, opts = {}) {
284
+ if (this.bearerToken !== null) {
285
+ throw new ConfigError("issueChild cannot be called on a bearer-mode client — the server enforces delegation " +
286
+ "depth 1, so a child identity cannot itself mint children. Call issueChild from the " +
287
+ "keypair-authenticated parent agent instead.");
288
+ }
289
+ const body = buildIssueChildBody(grants, opts.name, opts.ttlSeconds ?? CHILD_TTL_DEFAULT_S);
290
+ const res = await this.authedFetch("/v1/agents/children", {
291
+ method: "POST",
292
+ body: JSON.stringify(body),
293
+ });
294
+ return interpretIssueChildResponse(res.status, await res.text(), (token) => AgentValet.fromBearer(token, {
295
+ proxyUrl: this.proxyUrl,
296
+ timeoutMs: this.timeoutMs,
297
+ approvalTimeoutMs: this.approvalTimeoutMs,
298
+ approvalPollMs: this.approvalPollMs,
299
+ fetch: this.doFetch,
300
+ onApprovalPending: this.onApprovalPending,
301
+ sessionId: this.sessionId,
302
+ }));
303
+ }
225
304
  // ---- transport ----------------------------------------------------------
226
- /** Signs a short-lived (60s) RS256 assertion of this agent's identity. */
305
+ /**
306
+ * Signs a short-lived (60s) RS256 assertion of this agent's identity.
307
+ *
308
+ * Not available in bearer mode — a child has no key to sign with; it sends
309
+ * its pre-issued token as-is on every request.
310
+ */
227
311
  async signJWT() {
312
+ if (this.bearerToken !== null) {
313
+ throw new ConfigError("signJWT() is not available on a bearer-mode client — it authenticates with a " +
314
+ "pre-issued bearer token, not a signed assertion.");
315
+ }
228
316
  if (!this.importedKey) {
229
317
  try {
230
318
  this.importedKey = await importPKCS8(this.privateKeyPem, "RS256");
@@ -233,7 +321,14 @@ export class AgentValet {
233
321
  throw new ConfigError(`Private key is not a valid PKCS#8 RS256 PEM: ${err instanceof Error ? err.message : err}`);
234
322
  }
235
323
  }
236
- return new SignJWT({ agent_id: this.agentId, owner_id: this.ownerId })
324
+ return new SignJWT({
325
+ agent_id: this.agentId,
326
+ owner_id: this.ownerId,
327
+ // Omitted entirely when unset. A present-but-invalid claim resolves to
328
+ // null server-side WITHOUT falling back to the header, so sending an
329
+ // empty string here would silently cost the attribution.
330
+ ...(this.sessionId ? { session_id: this.sessionId } : {}),
331
+ })
237
332
  .setProtectedHeader({ alg: "RS256" })
238
333
  .setIssuedAt()
239
334
  .setExpirationTime("60s")
@@ -242,11 +337,18 @@ export class AgentValet {
242
337
  async authedFetch(path, init) {
243
338
  const url = `${this.proxyUrl}${path}`;
244
339
  const once = async () => {
245
- const token = await this.signJWT();
340
+ // Bearer mode has nothing to re-sign: the child token is fixed for its
341
+ // whole 60..3600s life. Its session tag rides a header instead of a claim.
342
+ const token = this.bearerToken ?? (await this.signJWT());
246
343
  try {
247
344
  return await fetchWithTimeout(this.doFetch, url, {
248
345
  ...init,
249
- headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json", ...init.headers },
346
+ headers: {
347
+ Authorization: `Bearer ${token}`,
348
+ "Content-Type": "application/json",
349
+ ...(this.bearerToken && this.sessionId ? { "X-AV-Session": this.sessionId } : {}),
350
+ ...init.headers,
351
+ },
250
352
  }, this.timeoutMs);
251
353
  }
252
354
  catch (err) {
@@ -255,8 +357,11 @@ export class AgentValet {
255
357
  };
256
358
  const res = await once();
257
359
  // Retry once on 401 — the JWT may have been minted either side of a clock
258
- // skew boundary. Same one-shot retry the mcp-server does.
259
- return res.status === 401 ? once() : res;
360
+ // skew boundary. Same one-shot retry the mcp-server does. Pointless in
361
+ // bearer mode (the token is fixed), so don't burn a second round trip.
362
+ if (res.status !== 401 || this.bearerToken !== null)
363
+ return res;
364
+ return once();
260
365
  }
261
366
  async getJson(path) {
262
367
  const res = await this.authedFetch(path, { method: "GET" });
@@ -1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QACzB,0EAA0E;QAC1E,uEAAuE;QACvE,uEAAuE;QACvE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,WAAW,KAAK,IAAI;YAAE,OAAO,GAAG,CAAC;QAChE,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,IAAY;QACnC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,GAAG,CAAC,EAAE;YAAE,MAAM,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACpD,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,IAAI,CAAM,CAAC;IAC3C,CAAC;CACF"}
package/dist/env.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  export declare const DEFAULT_PROXY_URL = "https://api.agentvalet.ai";
2
2
  export declare function agentIdFromEnv(): string | null;
3
3
  export declare function ownerIdFromEnv(): string | null;
4
+ /** Optional forensic attribution tag — AGENTVALET_SESSION_ID / SESSION_ID.
5
+ * Matches the Python client, so a mixed-language fleet tags one run alike. */
6
+ export declare function sessionIdFromEnv(): string | null;
4
7
  export declare function proxyUrlFromEnv(): string;
5
8
  /**
6
9
  * Resolves the RS256 private key PEM, in precedence order:
package/dist/env.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAmB7D,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAiC1C"}
1
+ {"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,iBAAiB,8BAA8B,CAAC;AAmB7D,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CAE9C;AAED;+EAC+E;AAC/E,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAEhD;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAiC1C"}
package/dist/env.js CHANGED
@@ -37,6 +37,11 @@ export function agentIdFromEnv() {
37
37
  export function ownerIdFromEnv() {
38
38
  return readEither("OWNER_ID");
39
39
  }
40
+ /** Optional forensic attribution tag — AGENTVALET_SESSION_ID / SESSION_ID.
41
+ * Matches the Python client, so a mixed-language fleet tags one run alike. */
42
+ export function sessionIdFromEnv() {
43
+ return readEither("SESSION_ID");
44
+ }
40
45
  export function proxyUrlFromEnv() {
41
46
  return (readEither("PROXY_URL") ?? DEFAULT_PROXY_URL).replace(/\/$/, "");
42
47
  }
package/dist/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,EAAE;AACF,mDAAmD;AACnD,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,mEAAmE;AACnE,4EAA4E;AAC5E,6EAA6E;AAC7E,gDAAgD;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,CAAC,MAAM,iB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B,IAAI,CAAC;QACH,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export { AgentValet } from "./client.js";
2
- export type { AgentValetOptions, CallRequest } from "./client.js";
2
+ export type { AgentValetOptions, BearerOptions, CallRequest } from "./client.js";
3
+ export { ChildIdentity } from "./child.js";
4
+ export type { ChildGrant, GrantedScope } from "./child.js";
5
+ export { CHILD_MAX_GRANTS, CHILD_TTL_DEFAULT_S, CHILD_TTL_MAX_S, CHILD_TTL_MIN_S, } from "./protocol.js";
3
6
  export { AgentValetError, AccessDeniedError, ApprovalDeniedError, ApprovalExpiredError, ApprovalTimeoutError, ConfigError, NetworkError, ProxyError, UpstreamError, } from "./errors.js";
4
7
  export { DEFAULT_PROXY_URL } from "./env.js";
5
8
  export type { FetchLike } from "./http.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAGjF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC7C,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -6,6 +6,9 @@
6
6
  // @agentvalet/mcp-server instead and call use_platform. This package is for
7
7
  // agents that aren't MCP: LangChain tools, cron jobs, plain Node services.
8
8
  export { AgentValet } from "./client.js";
9
+ // Delegation — mint a scope-attenuated, time-boxed identity per subagent.
10
+ export { ChildIdentity } from "./child.js";
11
+ export { CHILD_MAX_GRANTS, CHILD_TTL_DEFAULT_S, CHILD_TTL_MAX_S, CHILD_TTL_MIN_S, } from "./protocol.js";
9
12
  export { AgentValetError, AccessDeniedError, ApprovalDeniedError, ApprovalExpiredError, ApprovalTimeoutError, ConfigError, NetworkError, ProxyError, UpstreamError, } from "./errors.js";
10
13
  export { DEFAULT_PROXY_URL } from "./env.js";
11
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,EAAE;AACF,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,0EAA0E;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,eAAe,GAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { ChildIdentity, type ChildGrant } from "./child.js";
2
+ import type { AgentValet } from "./client.js";
3
+ /** The proxy's own bound (apps/proxy/src/routes/agent-children.ts). Checked
4
+ * client-side too so a typo costs a local throw, not a round trip and a 400. */
5
+ export declare const CHILD_TTL_MIN_S = 60;
6
+ export declare const CHILD_TTL_MAX_S = 3600;
7
+ export declare const CHILD_TTL_DEFAULT_S = 900;
8
+ /** Each grant costs the proxy a permissions query; it rejects >25. */
9
+ export declare const CHILD_MAX_GRANTS = 25;
10
+ /**
11
+ * Rejects an out-of-charset session id before it ever reaches the wire.
12
+ *
13
+ * This has to fail loud. The proxy resolves the session as
14
+ * `jwtSessionId ?? header` — a claim that is PRESENT but invalid resolves to
15
+ * null and does NOT fall back to a valid header, so a malformed id silently
16
+ * costs you the attribution you thought you had.
17
+ */
18
+ export declare function validateSessionId(sessionId: string | undefined): string | undefined;
19
+ export interface IssueChildBody {
20
+ ttl_seconds: number;
21
+ grants: Array<{
22
+ platform: string;
23
+ scopes: string[];
24
+ connection_id?: string;
25
+ }>;
26
+ name?: string;
27
+ }
28
+ /** Wire body for POST /v1/agents/children. Optional fields are omitted rather
29
+ * than sent as null — the route distinguishes absent from null. */
30
+ export declare function buildIssueChildBody(grants: ChildGrant[], name: string | undefined, ttlSeconds: number): IssueChildBody;
31
+ /**
32
+ * Turns a /v1/agents/children reply into a ChildIdentity.
33
+ *
34
+ * The route's non-2xx bodies (`no_scopes_after_attenuation`, `agent_not_active`,
35
+ * `delegation_depth_exceeded`, `as_signing_unavailable`, the child cap) describe
36
+ * an issuance outcome, not the grant-check/owner-decision outcomes the specific
37
+ * error types model. There is nothing endpoint-specific to attach, so this
38
+ * reuses ProxyError — `.status` and `.body` carry the code to branch on.
39
+ */
40
+ export declare function interpretIssueChildResponse(status: number, text: string, buildClient: (bearerToken: string) => AgentValet): ChildIdentity;
41
+ /**
42
+ * Reads the agent/owner id out of a bearer token's payload.
43
+ *
44
+ * A child bearer is a JWT carrying its own agent_id (and sub, and owner_id).
45
+ * Without this the client has no idea who it is, which breaks anything that
46
+ * has to name the subject — evaluate() would send an empty subject.id and the
47
+ * proxy answers 400.
48
+ *
49
+ * **This is not a security check.** The signature is not verified and must not
50
+ * be trusted; the server is the sole authority on whether a token is valid.
51
+ * Anything unparseable yields {} rather than throwing: failing locally would
52
+ * replace a clear 401 from the server with a confusing client-side crash.
53
+ */
54
+ export declare function identityFromBearer(token: string): {
55
+ agentId?: string;
56
+ ownerId?: string;
57
+ };
58
+ //# sourceMappingURL=protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"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 // Mirrors packages/python-client/src/agentvalet/_protocol.py. Keeping the
6
+ // decisions here (rather than inline in client.ts) is what makes the two SDKs
7
+ // auditable against each other: if a branch exists in one and not the other,
8
+ // this is the file where the difference shows up.
9
+ import { ChildIdentity } from "./child.js";
10
+ import { ConfigError, ProxyError } from "./errors.js";
11
+ import { tryParseJson } from "./http.js";
12
+ /** The proxy's own bound (apps/proxy/src/routes/agent-children.ts). Checked
13
+ * client-side too so a typo costs a local throw, not a round trip and a 400. */
14
+ export const CHILD_TTL_MIN_S = 60;
15
+ export const CHILD_TTL_MAX_S = 3600;
16
+ export const CHILD_TTL_DEFAULT_S = 900;
17
+ /** Each grant costs the proxy a permissions query; it rejects >25. */
18
+ export const CHILD_MAX_GRANTS = 25;
19
+ /**
20
+ * Matches the Python client. Deliberately loose (dots, colons, underscores,
21
+ * hyphens) so it accepts both a bare UUID and a namespaced trace id like
22
+ * `run:2026-08-21:abcd`.
23
+ */
24
+ const SESSION_ID_RE = /^[A-Za-z0-9._:-]{1,128}$/;
25
+ /**
26
+ * Rejects an out-of-charset session id before it ever reaches the wire.
27
+ *
28
+ * This has to fail loud. The proxy resolves the session as
29
+ * `jwtSessionId ?? header` — a claim that is PRESENT but invalid resolves to
30
+ * null and does NOT fall back to a valid header, so a malformed id silently
31
+ * costs you the attribution you thought you had.
32
+ */
33
+ export function validateSessionId(sessionId) {
34
+ if (sessionId === undefined)
35
+ return undefined;
36
+ if (!SESSION_ID_RE.test(sessionId)) {
37
+ throw new ConfigError(`sessionId ${JSON.stringify(sessionId)} is invalid — must match [A-Za-z0-9._:-]{1,128}.`);
38
+ }
39
+ return sessionId;
40
+ }
41
+ /** Wire body for POST /v1/agents/children. Optional fields are omitted rather
42
+ * than sent as null — the route distinguishes absent from null. */
43
+ export function buildIssueChildBody(grants, name, ttlSeconds) {
44
+ if (!Array.isArray(grants) || grants.length === 0) {
45
+ throw new ConfigError("issueChild requires at least one grant.");
46
+ }
47
+ if (grants.length > CHILD_MAX_GRANTS) {
48
+ throw new ConfigError(`issueChild accepts at most ${CHILD_MAX_GRANTS} grants (got ${grants.length}).`);
49
+ }
50
+ if (!Number.isInteger(ttlSeconds) || ttlSeconds < CHILD_TTL_MIN_S || ttlSeconds > CHILD_TTL_MAX_S) {
51
+ throw new ConfigError(`ttlSeconds must be an integer ${CHILD_TTL_MIN_S}..${CHILD_TTL_MAX_S} (got ${ttlSeconds}). ` +
52
+ "There is no refresh endpoint — a longer run must re-mint from the parent.");
53
+ }
54
+ const body = {
55
+ ttl_seconds: ttlSeconds,
56
+ grants: grants.map((g) => ({
57
+ platform: g.platform,
58
+ scopes: g.scopes,
59
+ ...(g.connectionId ? { connection_id: g.connectionId } : {}),
60
+ })),
61
+ };
62
+ if (name)
63
+ body.name = name;
64
+ return body;
65
+ }
66
+ /**
67
+ * Turns a /v1/agents/children reply into a ChildIdentity.
68
+ *
69
+ * The route's non-2xx bodies (`no_scopes_after_attenuation`, `agent_not_active`,
70
+ * `delegation_depth_exceeded`, `as_signing_unavailable`, the child cap) describe
71
+ * an issuance outcome, not the grant-check/owner-decision outcomes the specific
72
+ * error types model. There is nothing endpoint-specific to attach, so this
73
+ * reuses ProxyError — `.status` and `.body` carry the code to branch on.
74
+ */
75
+ export function interpretIssueChildResponse(status, text, buildClient) {
76
+ if (status < 200 || status >= 300)
77
+ throw new ProxyError(status, text);
78
+ const payload = tryParseJson(text);
79
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
80
+ throw new ProxyError(status, text);
81
+ }
82
+ const p = payload;
83
+ return new ChildIdentity(String(p.child_agent_id ?? ""), String(p.bearer_token ?? ""), String(p.expires_at ?? ""), Array.isArray(p.granted) ? p.granted : [], buildClient);
84
+ }
85
+ /**
86
+ * Reads the agent/owner id out of a bearer token's payload.
87
+ *
88
+ * A child bearer is a JWT carrying its own agent_id (and sub, and owner_id).
89
+ * Without this the client has no idea who it is, which breaks anything that
90
+ * has to name the subject — evaluate() would send an empty subject.id and the
91
+ * proxy answers 400.
92
+ *
93
+ * **This is not a security check.** The signature is not verified and must not
94
+ * be trusted; the server is the sole authority on whether a token is valid.
95
+ * Anything unparseable yields {} rather than throwing: failing locally would
96
+ * replace a clear 401 from the server with a confusing client-side crash.
97
+ */
98
+ export function identityFromBearer(token) {
99
+ let claims;
100
+ try {
101
+ const parts = token.split(".");
102
+ if (parts.length !== 3)
103
+ return {};
104
+ const decoded = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf-8"));
105
+ if (typeof decoded !== "object" || decoded === null || Array.isArray(decoded))
106
+ return {};
107
+ claims = decoded;
108
+ }
109
+ catch {
110
+ return {};
111
+ }
112
+ const out = {};
113
+ const agentId = claims.agent_id ?? claims.av_agent_id ?? claims.sub;
114
+ const ownerId = claims.owner_id ?? claims.av_owner_id;
115
+ if (typeof agentId === "string" && agentId)
116
+ out.agentId = agentId;
117
+ if (typeof ownerId === "string" && ownerId)
118
+ out.ownerId = ownerId;
119
+ return out;
120
+ }
121
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,kDAAkD;AAElD,OAAO,EAAE,aAAa,EAAsC,MAAM,YAAY,CAAC;AAE/E,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC;iFACiF;AACjF,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC;AACpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,sEAAsE;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;;;GAIG;AACH,MAAM,aAAa,G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AE,OAAO,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACjF,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YAAE,OAAO,EAAE,CAAC;QACzF,MAAM,GAAG,OAAkC,CAAC;IAC9C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,GAAG,GAA2C,EAAE,CAAC;IACvD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,GAAG,CAAC;IACpE,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW,CAAC;IACtD,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAClE,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;IAClE,OAAO,GAAG,CAAC;AACb,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agentvalet/client",
3
- "version": "0.1.1",
4
- "description": "AgentValet client SDK — call approved SaaS platforms from any Node agent. Signs the agent JWT, brokers through the AgentValet proxy, and waits out owner approvals.",
3
+ "version": "0.2.0",
4
+ "description": "AgentValet client SDK \u2014 call approved SaaS platforms from any Node agent. Signs the agent JWT, brokers through the AgentValet proxy, and waits out owner approvals.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -12,6 +12,13 @@
12
12
  "dist",
13
13
  "README.md"
14
14
  ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "dev": "tsc --watch",
18
+ "typecheck": "tsc --noEmit",
19
+ "test": "vitest run",
20
+ "prepublishOnly": "node ../../scripts/no-secrets.mjs && pnpm run build && node ../../scripts/no-workspace-protocol.mjs"
21
+ },
15
22
  "dependencies": {
16
23
  "jose": "^5.10.0"
17
24
  },
@@ -37,11 +44,5 @@
37
44
  "sdk"
38
45
  ],
39
46
  "license": "MIT",
40
- "homepage": "https://github.com/AgentValet/AgentValet#readme",
41
- "scripts": {
42
- "build": "tsc",
43
- "dev": "tsc --watch",
44
- "typecheck": "tsc --noEmit",
45
- "test": "vitest run"
46
- }
47
- }
47
+ "homepage": "https://github.com/AgentValet/AgentValet#readme"
48
+ }