managed-deepagents 0.6.2-dev.5 → 0.6.2-dev.50

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 (90) hide show
  1. package/README.md +19 -3
  2. package/dist/agent-auth.d.ts +150 -0
  3. package/dist/agent-auth.d.ts.map +1 -0
  4. package/dist/agent-auth.js +441 -0
  5. package/dist/agent-auth.js.map +1 -0
  6. package/dist/channels/manifest.d.ts +4 -0
  7. package/dist/channels/manifest.d.ts.map +1 -1
  8. package/dist/channels/schedule-delivery.d.ts +2 -0
  9. package/dist/channels/schedule-delivery.d.ts.map +1 -1
  10. package/dist/channels/schedule-delivery.js +40 -4
  11. package/dist/channels/schedule-delivery.js.map +1 -1
  12. package/dist/channels/trigger/client.d.ts +1 -0
  13. package/dist/channels/trigger/client.d.ts.map +1 -1
  14. package/dist/channels/trigger/client.js +19 -8
  15. package/dist/channels/trigger/client.js.map +1 -1
  16. package/dist/channels/trigger/http.d.ts +8 -0
  17. package/dist/channels/trigger/http.d.ts.map +1 -1
  18. package/dist/channels/trigger/http.js +56 -6
  19. package/dist/channels/trigger/http.js.map +1 -1
  20. package/dist/channels/trigger/identity-context.d.ts +47 -0
  21. package/dist/channels/trigger/identity-context.d.ts.map +1 -0
  22. package/dist/channels/trigger/identity-context.js +171 -0
  23. package/dist/channels/trigger/identity-context.js.map +1 -0
  24. package/dist/channels/trigger/types.d.ts +11 -1
  25. package/dist/channels/trigger/types.d.ts.map +1 -1
  26. package/dist/channels/trigger/types.js +5 -0
  27. package/dist/channels/trigger/types.js.map +1 -1
  28. package/dist/connections.d.ts +74 -0
  29. package/dist/connections.d.ts.map +1 -0
  30. package/dist/connections.js +277 -0
  31. package/dist/connections.js.map +1 -0
  32. package/dist/connectors/mcp/index.d.ts +29 -89
  33. package/dist/connectors/mcp/index.d.ts.map +1 -1
  34. package/dist/connectors/mcp/index.js +258 -50
  35. package/dist/connectors/mcp/index.js.map +1 -1
  36. package/dist/connectors/mcp/schema.d.ts +12 -0
  37. package/dist/connectors/mcp/schema.d.ts.map +1 -0
  38. package/dist/connectors/mcp/schema.js +57 -0
  39. package/dist/connectors/mcp/schema.js.map +1 -0
  40. package/dist/connectors/mcp/types.d.ts +62 -0
  41. package/dist/connectors/mcp/types.d.ts.map +1 -0
  42. package/dist/connectors/mcp/types.js +2 -0
  43. package/dist/connectors/mcp/types.js.map +1 -0
  44. package/dist/connectors/tool-selection.d.ts +9 -18
  45. package/dist/connectors/tool-selection.d.ts.map +1 -1
  46. package/dist/connectors/tool-selection.js +32 -58
  47. package/dist/connectors/tool-selection.js.map +1 -1
  48. package/dist/credential-gate.d.ts +40 -0
  49. package/dist/credential-gate.d.ts.map +1 -0
  50. package/dist/credential-gate.js +227 -0
  51. package/dist/credential-gate.js.map +1 -0
  52. package/dist/identity/index.d.ts +1 -1
  53. package/dist/identity/index.d.ts.map +1 -1
  54. package/dist/identity/index.js.map +1 -1
  55. package/dist/identity/types.d.ts +79 -5
  56. package/dist/identity/types.d.ts.map +1 -1
  57. package/dist/index.d.ts +11 -6
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +1 -0
  60. package/dist/index.js.map +1 -1
  61. package/dist/ingress/index.d.ts +10 -2
  62. package/dist/ingress/index.d.ts.map +1 -1
  63. package/dist/ingress/index.js +17 -9
  64. package/dist/ingress/index.js.map +1 -1
  65. package/dist/runtime/auth.d.ts +49 -5
  66. package/dist/runtime/auth.d.ts.map +1 -1
  67. package/dist/runtime/auth.js +100 -5
  68. package/dist/runtime/auth.js.map +1 -1
  69. package/dist/runtime/http.d.ts +1 -1
  70. package/dist/runtime/http.d.ts.map +1 -1
  71. package/dist/runtime/http.js.map +1 -1
  72. package/dist/runtime/identity-runtime.d.ts +65 -5
  73. package/dist/runtime/identity-runtime.d.ts.map +1 -1
  74. package/dist/runtime/identity-runtime.js +148 -0
  75. package/dist/runtime/identity-runtime.js.map +1 -1
  76. package/dist/runtime/index.d.ts.map +1 -1
  77. package/dist/runtime/index.js +12 -7
  78. package/dist/runtime/index.js.map +1 -1
  79. package/dist/runtime/managed-middleware.d.ts +2 -2
  80. package/dist/runtime/managed-middleware.js +6 -6
  81. package/dist/runtime/managed-tools.d.ts +19 -15
  82. package/dist/runtime/managed-tools.d.ts.map +1 -1
  83. package/dist/runtime/managed-tools.js +14 -13
  84. package/dist/runtime/managed-tools.js.map +1 -1
  85. package/dist/runtime/types.d.ts +2 -2
  86. package/package.json +8 -8
  87. package/dist/connectors/mcp/load.d.ts +0 -12
  88. package/dist/connectors/mcp/load.d.ts.map +0 -1
  89. package/dist/connectors/mcp/load.js +0 -122
  90. package/dist/connectors/mcp/load.js.map +0 -1
package/README.md CHANGED
@@ -245,11 +245,12 @@ used only to reconcile the registry and never enters the build or snapshot.
245
245
 
246
246
  Add `connectors/mcp.ts` to attach MCP servers. The file must export a named
247
247
  `connector`. By default, MDA exposes every tool loaded from each declared
248
- server. Supply your own auth via static `headers` when the server requires
249
- credentials:
248
+ server. In `mda dev`, an agent-owned connection reads from
249
+ `MDA_DEV_<SLUG>` with the slug uppercased and hyphens changed to underscores.
250
+ Hosted deployments resolve workspace connections from Agent Auth:
250
251
 
251
252
  ```ts
252
- import { connectors } from "managed-deepagents";
253
+ import { connectors, connections } from "managed-deepagents";
253
254
 
254
255
  export const connector = connectors.mcp({
255
256
  mcpServers: {
@@ -257,11 +258,26 @@ export const connector = connectors.mcp({
257
258
  transport: "http",
258
259
  url: "https://docs.langchain.com/mcp",
259
260
  includeTools: ["search", "fetch"],
261
+ connection: connections.get("docs-token", { type: "agent" }),
260
262
  },
261
263
  },
262
264
  });
263
265
  ```
264
266
 
267
+ For this example, set `MDA_DEV_DOCS_TOKEN`.
268
+
269
+ A user-owned connection — `connections.get(slug, { type: "user" })` — resolves
270
+ per caller via OAuth. The pre-run credential gate interrupts the run
271
+ when a grant is missing. `mda dev` has no deployment to hold user grants, so
272
+ a user-owned connection fails there with an actionable error; deploy the agent
273
+ to exercise one.
274
+
275
+ Deploy the project first, then provision its connections with
276
+ `mda connections create`. Agent-owned opaque secrets are scoped to that
277
+ deployment, so the command refuses to create one before `mda deploy`.
278
+ `mda deploy` fails when a slug a project declares is missing from the
279
+ workspace.
280
+
265
281
  Use `includeTools` or `excludeTools` inside a server config to select a subset.
266
282
  Tool names are raw MCP tool names before the managed `{server}__` prefix is
267
283
  applied, so `includeTools: ["search"]` on server `langchainDocs` exposes
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Agent Auth client used by `credentials.get` and the pre-run credential gate.
3
+ *
4
+ * Talks to the shipped Agent Auth APIs (credentials + oauth-authorization-sessions),
5
+ * not the aspirational `credentials/mint` endpoint.
6
+ */
7
+ export declare const AGENT_AUTH_TIMEOUT_MS = 10000;
8
+ export declare const AGENT_AUTH_PROVIDER_PAGE_SIZE = 100;
9
+ export declare const AGENT_AUTH_MAX_PROVIDER_PAGES = 20;
10
+ export interface AgentAuthHttpConfig {
11
+ apiKey?: string;
12
+ workspaceId?: string;
13
+ }
14
+ /** Query string for listing credentials filtered by owner and kind. */
15
+ export declare function agentAuthCredentialQuery(options: {
16
+ ownerType: string;
17
+ ownerId: string;
18
+ kind: string;
19
+ pageSize?: number;
20
+ cursor?: string;
21
+ }): string;
22
+ export declare function agentAuthHeaders(config: AgentAuthHttpConfig): Record<string, string>;
23
+ /** One Agent Auth HTTP call: no redirects, bounded timeout, JSON body. */
24
+ export declare function requestAgentAuthJson(options: {
25
+ url: string;
26
+ init?: Omit<RequestInit, "headers" | "signal">;
27
+ config: AgentAuthHttpConfig;
28
+ timeoutMs: number;
29
+ fetchImpl: typeof fetch;
30
+ }): Promise<{
31
+ ok: boolean;
32
+ status: number;
33
+ body: Record<string, unknown>;
34
+ }>;
35
+ export interface AgentAuthContext {
36
+ baseUrl: string;
37
+ /** Deployment id, passed to oauth-authorization-sessions as `agent_id`. */
38
+ agentId: string;
39
+ /** Authenticated caller, used as `owner_id` for user credentials. */
40
+ principalId: string;
41
+ apiKey?: string;
42
+ workspaceId?: string;
43
+ }
44
+ /** One credential slug the caller has not granted, with its connect URL. */
45
+ export interface PendingAuthorization {
46
+ slug: string;
47
+ connectUrl: string;
48
+ authId: string;
49
+ }
50
+ export declare class CredentialAuthorizationRequiredError extends Error {
51
+ readonly slugs: readonly string[];
52
+ readonly name = "CredentialAuthorizationRequiredError";
53
+ constructor(slugs: readonly string[]);
54
+ }
55
+ export declare class AgentAuthUnknownProviderError extends Error {
56
+ readonly slug: string;
57
+ readonly name = "AgentAuthUnknownProviderError";
58
+ constructor(slug: string);
59
+ }
60
+ export declare const AGENT_AUTH_PROBLEM_HINT_MAX_CHARS = 200;
61
+ /**
62
+ * The problem+json fields Agent Auth reserves for the caller: `detail` names
63
+ * the failure and `remedy` names the fix. Nothing else from a response body is
64
+ * read, because the rest can quote secret material.
65
+ *
66
+ * Both are collapsed to one line and truncated so a long or multi-line body
67
+ * cannot reshape an error message.
68
+ */
69
+ export declare function agentAuthProblemHint(body: Record<string, unknown> | undefined): string | undefined;
70
+ /**
71
+ * Agent Auth could not answer. Callers pass a fixed message; the only part of
72
+ * a response body that reaches it is the allow-listed problem+json hint, since
73
+ * an arbitrary body can quote secret material.
74
+ */
75
+ export declare class CredentialStoreError extends Error {
76
+ readonly status?: number | undefined;
77
+ readonly name: string;
78
+ constructor(message: string, status?: number | undefined, problem?: Record<string, unknown>);
79
+ }
80
+ /** The error for a declared slug that has no workspace connection row. */
81
+ export declare function missingWorkspaceConnectionError(slug: string): CredentialStoreError;
82
+ /**
83
+ * Read the slug back out of a missing-connection message.
84
+ *
85
+ * A run that fails in the gate reaches a channel as a plain string, so this is
86
+ * the only way back to the slug. It must move with the message it parses.
87
+ */
88
+ export declare function missingWorkspaceConnectionSlug(text: string): string | undefined;
89
+ export interface WorkspaceConnection {
90
+ connectionId: string;
91
+ kind: string;
92
+ ownerPolicy: string;
93
+ }
94
+ /**
95
+ * Bound Agent Auth HTTP client. One instance per caller/run; headers, origin,
96
+ * and the request timeout stay on the instance rather than each call site.
97
+ */
98
+ export declare class AgentAuth {
99
+ #private;
100
+ readonly context: AgentAuthContext;
101
+ constructor(context: AgentAuthContext, fetchImpl?: typeof fetch, timeoutMs?: number);
102
+ /** List workspace connections and return the row for `slug`, if any. */
103
+ findWorkspaceConnection(slug: string): Promise<WorkspaceConnection | undefined>;
104
+ /** Workspace credential id for an agent-owned opaque secret grant. */
105
+ findWorkspaceCredentialId(slug: string): Promise<string | undefined>;
106
+ /**
107
+ * Resolve the credential id for a secret connection row.
108
+ *
109
+ * Agent-owned connection declarations scope the credential to this
110
+ * deployment. Workspace-owned credentials are deliberately not visible to
111
+ * deployments.
112
+ */
113
+ findSecretCredentialId(connection: WorkspaceConnection, slug: string): Promise<string | undefined>;
114
+ /** Read a caller-owned opaque secret grant for a workspace connection slug. */
115
+ readUserSecret(slug: string): Promise<string | undefined>;
116
+ /** Read a caller-owned opaque secret when the connection row is already loaded. */
117
+ readUserSecretForConnection(connection: WorkspaceConnection): Promise<string | undefined>;
118
+ /** Read an OAuth access token stored on a workspace connection row. */
119
+ readConnectionAccessToken(connectionId: string): Promise<string | undefined>;
120
+ /**
121
+ * Read the caller's OAuth access token for a slug without starting a session.
122
+ *
123
+ * Reads never mint, so a caller can be probed repeatedly — on every replay of
124
+ * an interrupted node, for instance — without leaving authorization sessions
125
+ * behind.
126
+ *
127
+ * @returns The access token, or `undefined` when the caller must connect.
128
+ */
129
+ readUserAccessToken(slug: string): Promise<string | undefined>;
130
+ /** Read a caller OAuth token when the connection row is already loaded. */
131
+ readUserAccessTokenForConnection(connection: WorkspaceConnection): Promise<string | undefined>;
132
+ /**
133
+ * Start an OAuth authorization session for a slug the caller has not granted.
134
+ *
135
+ * @returns The pending session, including the user-facing connect URL.
136
+ */
137
+ startAuthorizationSession(slug: string): Promise<PendingAuthorization>;
138
+ /** oauth-providers has no slug filter, so the match is made across pages. */
139
+ resolveOAuthProviderId(slug: string): Promise<string>;
140
+ /** The credential key is `credential_id`, never `id`. */
141
+ findCredentialId(options: {
142
+ ownerType: string;
143
+ ownerId: string;
144
+ kind: string;
145
+ slug: string;
146
+ }): Promise<string | undefined>;
147
+ /** @returns The secret, or `undefined` when Agent Auth has no value (404). */
148
+ readSecret(credentialId: string): Promise<string | undefined>;
149
+ }
150
+ //# sourceMappingURL=agent-auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-auth.d.ts","sourceRoot":"","sources":["../src/agent-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,qBAAqB,QAAS,CAAC;AAC5C,eAAO,MAAM,6BAA6B,MAAM,CAAC;AACjD,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,uEAAuE;AACvE,wBAAgB,wBAAwB,CAAC,OAAO,EAAE;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,CAaT;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,mBAAmB,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAexB;AAED,0EAA0E;AAC1E,wBAAsB,oBAAoB,CAAC,OAAO,EAAE;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;IAC/C,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,KAAK,CAAC;CACzB,GAAG,OAAO,CAAC;IACV,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAA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B,GAC9B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAW7B;IAED;;;;OAIG;IACG,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAoC3E;IAED,6EAA6E;IACvE,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAqC1D;IAED,yDAAyD;IACnD,gBAAgB,CAAC,OAAO,EAAE;QAC9B,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAwC9B;IAED,8EAA8E;IACxE,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAiBlE;CAyCF"}
@@ -0,0 +1,441 @@
1
+ /**
2
+ * Agent Auth client used by `credentials.get` and the pre-run credential gate.
3
+ *
4
+ * Talks to the shipped Agent Auth APIs (credentials + oauth-authorization-sessions),
5
+ * not the aspirational `credentials/mint` endpoint.
6
+ */
7
+ import { fetchWithTimeout } from "./runtime/http.js";
8
+ export const AGENT_AUTH_TIMEOUT_MS = 10_000;
9
+ export const AGENT_AUTH_PROVIDER_PAGE_SIZE = 100;
10
+ export const AGENT_AUTH_MAX_PROVIDER_PAGES = 20;
11
+ /** Query string for listing credentials filtered by owner and kind. */
12
+ export function agentAuthCredentialQuery(options) {
13
+ const params = new URLSearchParams({
14
+ owner_type: options.ownerType,
15
+ owner_id: options.ownerId,
16
+ kind: options.kind,
17
+ });
18
+ if (options.pageSize !== undefined) {
19
+ params.set("page_size", String(options.pageSize));
20
+ }
21
+ if (options.cursor) {
22
+ params.set("cursor", options.cursor);
23
+ }
24
+ return params.toString();
25
+ }
26
+ export function agentAuthHeaders(config) {
27
+ const headers = {
28
+ accept: "application/json",
29
+ "content-type": "application/json",
30
+ "x-langsmith-product": "mda",
31
+ };
32
+ const apiKey = config.apiKey?.trim();
33
+ if (apiKey) {
34
+ headers["x-api-key"] = apiKey;
35
+ }
36
+ const workspaceId = config.workspaceId?.trim();
37
+ if (workspaceId) {
38
+ headers["x-tenant-id"] = workspaceId;
39
+ }
40
+ return headers;
41
+ }
42
+ /** One Agent Auth HTTP call: no redirects, bounded timeout, JSON body. */
43
+ export async function requestAgentAuthJson(options) {
44
+ const response = await fetchWithTimeout(options.url, {
45
+ ...options.init,
46
+ redirect: "error",
47
+ headers: agentAuthHeaders(options.config),
48
+ }, options.timeoutMs, options.fetchImpl);
49
+ const decoded = await response.json().catch(() => ({}));
50
+ return {
51
+ ok: response.ok,
52
+ status: response.status,
53
+ body: decoded && typeof decoded === "object"
54
+ ? decoded
55
+ : {},
56
+ };
57
+ }
58
+ export class CredentialAuthorizationRequiredError extends Error {
59
+ slugs;
60
+ name = "CredentialAuthorizationRequiredError";
61
+ constructor(slugs) {
62
+ super(`the caller has not connected: ${slugs.join(", ")}. ` +
63
+ "Declare the credential on a connector so the pre-run gate can request it.");
64
+ this.slugs = slugs;
65
+ }
66
+ }
67
+ export class AgentAuthUnknownProviderError extends Error {
68
+ slug;
69
+ name = "AgentAuthUnknownProviderError";
70
+ constructor(slug) {
71
+ super(`Agent Auth has no OAuth provider registered for slug "${slug}". ` +
72
+ "Register the provider or fix the credential slug.");
73
+ this.slug = slug;
74
+ }
75
+ }
76
+ export const AGENT_AUTH_PROBLEM_HINT_MAX_CHARS = 200;
77
+ /**
78
+ * The problem+json fields Agent Auth reserves for the caller: `detail` names
79
+ * the failure and `remedy` names the fix. Nothing else from a response body is
80
+ * read, because the rest can quote secret material.
81
+ *
82
+ * Both are collapsed to one line and truncated so a long or multi-line body
83
+ * cannot reshape an error message.
84
+ */
85
+ export function agentAuthProblemHint(body) {
86
+ const seen = new Set();
87
+ for (const field of ["detail", "remedy"]) {
88
+ const value = body?.[field];
89
+ if (typeof value !== "string")
90
+ continue;
91
+ const text = value.replace(/\s+/gu, " ").trim();
92
+ if (text)
93
+ seen.add(text);
94
+ }
95
+ if (seen.size === 0)
96
+ return undefined;
97
+ const hint = [...seen].join(" ");
98
+ const chars = [...hint];
99
+ return chars.length > AGENT_AUTH_PROBLEM_HINT_MAX_CHARS
100
+ ? `${chars.slice(0, AGENT_AUTH_PROBLEM_HINT_MAX_CHARS).join("")}...`
101
+ : hint;
102
+ }
103
+ /**
104
+ * Agent Auth could not answer. Callers pass a fixed message; the only part of
105
+ * a response body that reaches it is the allow-listed problem+json hint, since
106
+ * an arbitrary body can quote secret material.
107
+ */
108
+ export class CredentialStoreError extends Error {
109
+ status;
110
+ name = "CredentialStoreError";
111
+ constructor(message, status, problem) {
112
+ const withStatus = status === undefined ? message : `${message} (status ${status})`;
113
+ const hint = agentAuthProblemHint(problem);
114
+ super(hint === undefined ? withStatus : `${withStatus}: ${hint}`);
115
+ this.status = status;
116
+ }
117
+ }
118
+ /** Each runtime quotes the slug its own way: `JSON.stringify` here, `repr()` in PyPI. */
119
+ const MISSING_WORKSPACE_CONNECTION = /workspace connection ['"]([A-Za-z0-9][A-Za-z0-9._-]*)['"] is not configured/u;
120
+ /** The error for a declared slug that has no workspace connection row. */
121
+ export function missingWorkspaceConnectionError(slug) {
122
+ return new CredentialStoreError(`workspace connection ${JSON.stringify(slug)} is not configured`);
123
+ }
124
+ /**
125
+ * Read the slug back out of a missing-connection message.
126
+ *
127
+ * A run that fails in the gate reaches a channel as a plain string, so this is
128
+ * the only way back to the slug. It must move with the message it parses.
129
+ */
130
+ export function missingWorkspaceConnectionSlug(text) {
131
+ return MISSING_WORKSPACE_CONNECTION.exec(text)?.[1];
132
+ }
133
+ /**
134
+ * Bound Agent Auth HTTP client. One instance per caller/run; headers, origin,
135
+ * and the request timeout stay on the instance rather than each call site.
136
+ */
137
+ export class AgentAuth {
138
+ context;
139
+ #fetchImpl;
140
+ #timeoutMs;
141
+ constructor(context, fetchImpl = fetch, timeoutMs = AGENT_AUTH_TIMEOUT_MS) {
142
+ this.context = context;
143
+ this.#fetchImpl = fetchImpl;
144
+ this.#timeoutMs = timeoutMs;
145
+ }
146
+ /** List workspace connections and return the row for `slug`, if any. */
147
+ async findWorkspaceConnection(slug) {
148
+ if (!this.context.workspaceId?.trim()) {
149
+ throw new CredentialStoreError("connections are not configured: LANGSMITH_WORKSPACE_ID is not set");
150
+ }
151
+ let cursor;
152
+ for (let page = 0; page < AGENT_AUTH_MAX_PROVIDER_PAGES; page += 1) {
153
+ const params = new URLSearchParams({
154
+ page_size: String(AGENT_AUTH_PROVIDER_PAGE_SIZE),
155
+ });
156
+ if (cursor) {
157
+ params.set("cursor", cursor);
158
+ }
159
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/connections?${params.toString()}`, { method: "GET" });
160
+ if (!ok) {
161
+ throw new CredentialStoreError("Agent Auth list connections failed", status, body);
162
+ }
163
+ const items = Array.isArray(body.items) ? body.items : [];
164
+ const match = items.find((item) => !!item &&
165
+ typeof item === "object" &&
166
+ String(item.slug) === slug);
167
+ if (match) {
168
+ const connectionId = String(match.id ?? match.connection_id ?? match.credential_id ?? "");
169
+ const kind = connectionCredentialKind(match);
170
+ const ownerPolicy = typeof match.owner_policy === "string" ? match.owner_policy : "";
171
+ if (!connectionId || !kind) {
172
+ throw new CredentialStoreError("Agent Auth connection row missing id or kind");
173
+ }
174
+ return { connectionId, kind, ownerPolicy };
175
+ }
176
+ const next = body.next_cursor;
177
+ if (typeof next !== "string" || !next || next === cursor) {
178
+ return undefined;
179
+ }
180
+ cursor = next;
181
+ }
182
+ throw new CredentialStoreError("Agent Auth connection list returned too many pages");
183
+ }
184
+ /** Workspace credential id for an agent-owned opaque secret grant. */
185
+ async findWorkspaceCredentialId(slug) {
186
+ const connection = await this.findWorkspaceConnection(slug);
187
+ if (!connection) {
188
+ return undefined;
189
+ }
190
+ return await this.findSecretCredentialId(connection, slug);
191
+ }
192
+ /**
193
+ * Resolve the credential id for a secret connection row.
194
+ *
195
+ * Agent-owned connection declarations scope the credential to this
196
+ * deployment. Workspace-owned credentials are deliberately not visible to
197
+ * deployments.
198
+ */
199
+ async findSecretCredentialId(connection, slug) {
200
+ if (connection.kind !== "secret") {
201
+ return undefined;
202
+ }
203
+ const fromAgent = await this.#credentialIdForOwner(connection.connectionId, "agent", this.context.agentId);
204
+ if (fromAgent) {
205
+ return fromAgent;
206
+ }
207
+ const listedAgent = await this.findCredentialId({
208
+ ownerType: "agent",
209
+ ownerId: this.context.agentId,
210
+ kind: "secret",
211
+ slug,
212
+ });
213
+ return listedAgent;
214
+ }
215
+ /**
216
+ * Read credential_id from GET /connections/{id}?credential_owner_*.
217
+ *
218
+ * Deployments authenticate with `LANGSMITH_API_KEY` (the minted
219
+ * service-account key). User and workspace owners additionally require
220
+ * workspace management permission.
221
+ */
222
+ async #credentialIdForOwner(connectionId, ownerType, ownerId) {
223
+ const params = new URLSearchParams({
224
+ credential_owner_type: ownerType,
225
+ credential_owner_id: ownerId,
226
+ });
227
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/connections/${encodeURIComponent(connectionId)}?${params.toString()}`, { method: "GET" });
228
+ if (status === 404) {
229
+ return undefined;
230
+ }
231
+ if (!ok) {
232
+ throw new CredentialStoreError(status === 403
233
+ ? "Agent Auth get connection for owner failed (forbidden)"
234
+ : "Agent Auth get connection for owner failed", status, body);
235
+ }
236
+ return connectionCredentialId(body);
237
+ }
238
+ /** Read a caller-owned opaque secret grant for a workspace connection slug. */
239
+ async readUserSecret(slug) {
240
+ const connection = await this.findWorkspaceConnection(slug);
241
+ if (!connection) {
242
+ return undefined;
243
+ }
244
+ return await this.readUserSecretForConnection(connection);
245
+ }
246
+ /** Read a caller-owned opaque secret when the connection row is already loaded. */
247
+ async readUserSecretForConnection(connection) {
248
+ if (connection.kind !== "secret") {
249
+ return undefined;
250
+ }
251
+ const credentialId = await this.#credentialIdForOwner(connection.connectionId, "user", this.context.principalId);
252
+ if (!credentialId) {
253
+ return undefined;
254
+ }
255
+ return await this.readSecret(credentialId);
256
+ }
257
+ /** Read an OAuth access token stored on a workspace connection row. */
258
+ async readConnectionAccessToken(connectionId) {
259
+ return await this.#fetchAccessToken(connectionId);
260
+ }
261
+ /**
262
+ * Read the caller's OAuth access token for a slug without starting a session.
263
+ *
264
+ * Reads never mint, so a caller can be probed repeatedly — on every replay of
265
+ * an interrupted node, for instance — without leaving authorization sessions
266
+ * behind.
267
+ *
268
+ * @returns The access token, or `undefined` when the caller must connect.
269
+ */
270
+ async readUserAccessToken(slug) {
271
+ const connection = await this.findWorkspaceConnection(slug);
272
+ if (!connection) {
273
+ return undefined;
274
+ }
275
+ return await this.readUserAccessTokenForConnection(connection);
276
+ }
277
+ /** Read a caller OAuth token when the connection row is already loaded. */
278
+ async readUserAccessTokenForConnection(connection) {
279
+ if (connection.kind !== "oauth2") {
280
+ return undefined;
281
+ }
282
+ const credentialId = await this.#credentialIdForOwner(connection.connectionId, "user", this.context.principalId);
283
+ if (!credentialId)
284
+ return undefined;
285
+ return await this.#fetchAccessToken(credentialId);
286
+ }
287
+ /**
288
+ * Start an OAuth authorization session for a slug the caller has not granted.
289
+ *
290
+ * @returns The pending session, including the user-facing connect URL.
291
+ */
292
+ async startAuthorizationSession(slug) {
293
+ const connection = await this.findWorkspaceConnection(slug);
294
+ if (!connection) {
295
+ throw missingWorkspaceConnectionError(slug);
296
+ }
297
+ if (connection.kind !== "oauth2") {
298
+ throw new CredentialStoreError(`connection ${JSON.stringify(slug)} is not an OAuth connection`);
299
+ }
300
+ const { ok, status, body } = await this.#request("/v1/agent-auth/oauth-authorization-sessions", {
301
+ method: "POST",
302
+ body: JSON.stringify({
303
+ connection_id: connection.connectionId,
304
+ principal_id: this.context.principalId,
305
+ agent_id: this.context.agentId,
306
+ }),
307
+ });
308
+ if (!ok) {
309
+ throw new CredentialStoreError("Agent Auth create oauth-authorization-session failed", status, body);
310
+ }
311
+ const authId = String(body.id ?? "");
312
+ const connectUrl = String(body.verification_url ?? "");
313
+ if (!authId || !connectUrl) {
314
+ throw new CredentialStoreError("Agent Auth oauth-authorization-session missing id or verification_url");
315
+ }
316
+ return { slug, connectUrl, authId };
317
+ }
318
+ /** oauth-providers has no slug filter, so the match is made across pages. */
319
+ async resolveOAuthProviderId(slug) {
320
+ let cursor;
321
+ for (let page = 0; page < AGENT_AUTH_MAX_PROVIDER_PAGES; page += 1) {
322
+ const params = new URLSearchParams({
323
+ page_size: String(AGENT_AUTH_PROVIDER_PAGE_SIZE),
324
+ });
325
+ if (cursor)
326
+ params.set("cursor", cursor);
327
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/oauth-providers?${params.toString()}`, { method: "GET" });
328
+ if (!ok) {
329
+ throw new CredentialStoreError("Agent Auth list oauth-providers failed", status, body);
330
+ }
331
+ const items = Array.isArray(body.items) ? body.items : [];
332
+ const match = items.find((item) => !!item &&
333
+ typeof item === "object" &&
334
+ String(item.slug) === slug);
335
+ if (match?.id) {
336
+ return String(match.id);
337
+ }
338
+ const next = body.next_cursor;
339
+ if (typeof next !== "string" || !next || next === cursor) {
340
+ throw new AgentAuthUnknownProviderError(slug);
341
+ }
342
+ cursor = next;
343
+ }
344
+ throw new CredentialStoreError("Agent Auth oauth-provider list returned too many pages");
345
+ }
346
+ /** The credential key is `credential_id`, never `id`. */
347
+ async findCredentialId(options) {
348
+ let cursor;
349
+ for (let page = 0; page < AGENT_AUTH_MAX_PROVIDER_PAGES; page += 1) {
350
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/credentials?${agentAuthCredentialQuery({
351
+ ownerType: options.ownerType,
352
+ ownerId: options.ownerId,
353
+ kind: options.kind,
354
+ pageSize: AGENT_AUTH_PROVIDER_PAGE_SIZE,
355
+ cursor,
356
+ })}`, { method: "GET" });
357
+ if (!ok) {
358
+ throw new CredentialStoreError("Agent Auth list credentials failed", status, body);
359
+ }
360
+ const items = Array.isArray(body.items) ? body.items : [];
361
+ const match = items.find((item) => !!item &&
362
+ typeof item === "object" &&
363
+ String(item.slug) === options.slug);
364
+ const id = match?.credential_id;
365
+ if (typeof id === "string" && id) {
366
+ return id;
367
+ }
368
+ const next = body.next_cursor;
369
+ if (typeof next !== "string" || !next || next === cursor) {
370
+ return undefined;
371
+ }
372
+ cursor = next;
373
+ }
374
+ throw new CredentialStoreError("Agent Auth credential list returned too many pages");
375
+ }
376
+ /** @returns The secret, or `undefined` when Agent Auth has no value (404). */
377
+ async readSecret(credentialId) {
378
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/credentials/${encodeURIComponent(credentialId)}/secret`, { method: "GET" });
379
+ if (status === 404) {
380
+ return undefined;
381
+ }
382
+ if (!ok) {
383
+ throw new CredentialStoreError("Agent Auth get secret failed", status, body);
384
+ }
385
+ const secret = body.secret;
386
+ return typeof secret === "string" && secret.length > 0 ? secret : undefined;
387
+ }
388
+ async #fetchAccessToken(credentialId) {
389
+ const { ok, status, body } = await this.#request(`/v1/agent-auth/credentials/${encodeURIComponent(credentialId)}/oauth2`, { method: "GET" });
390
+ if (isAuthorizationRequired(status, body)) {
391
+ return undefined;
392
+ }
393
+ if (!ok) {
394
+ throw new CredentialStoreError("Agent Auth get oauth2 failed", status, body);
395
+ }
396
+ const oauth2 = body.oauth2 && typeof body.oauth2 === "object"
397
+ ? body.oauth2
398
+ : body;
399
+ const token = oauth2.access_token;
400
+ return typeof token === "string" && token ? token : undefined;
401
+ }
402
+ async #request(path, init = {}) {
403
+ return await requestAgentAuthJson({
404
+ url: `${this.context.baseUrl}${path}`,
405
+ init,
406
+ config: this.context,
407
+ timeoutMs: this.#timeoutMs,
408
+ fetchImpl: this.#fetchImpl,
409
+ });
410
+ }
411
+ }
412
+ /** Agent Auth answers 409 when a stored grant has lapsed and needs re-auth. */
413
+ function isAuthorizationRequired(status, body) {
414
+ if (status !== 409) {
415
+ return false;
416
+ }
417
+ const detail = String(body.detail ?? body.title ?? body.error ?? "").toLowerCase();
418
+ return (body.error === "authorization_required" ||
419
+ detail.includes("authorization is required") ||
420
+ detail.includes("oauth authorization"));
421
+ }
422
+ /** Prefer nested `credential.kind`; accept legacy top-level `kind`. */
423
+ function connectionCredentialKind(item) {
424
+ const credential = item.credential;
425
+ if (credential && typeof credential === "object") {
426
+ const kind = credential.kind;
427
+ if (typeof kind === "string" && kind) {
428
+ return kind;
429
+ }
430
+ }
431
+ return typeof item.kind === "string" ? item.kind : "";
432
+ }
433
+ function connectionCredentialId(body) {
434
+ const credential = body.credential;
435
+ if (!credential || typeof credential !== "object") {
436
+ return undefined;
437
+ }
438
+ const id = credential.credential_id;
439
+ return typeof id === "string" && id ? id : undefined;
440
+ }
441
+ //# sourceMappingURL=agent-auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-auth.js","sourceRoot":"","sources":["../src/agent-auth.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,MAAM,CAAC,MAAM,6BAA6B,GAAG,GAAG,CAAC;AACjD,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,CAAC;AAOhD,uEAAuE;AACvE,MAAM,UAAU,wBAAwB,CAAC,OAMxC;IACC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;QACjC,UAAU,EAAE,OAAO,CAAC,SAAS;QAC7B,QAAQ,EAAE,OAAO,CAAC,OAAO;QACzB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;QACnC,MAAM,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC,QAAQ,EA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