managed-deepagents 0.6.2-dev.29 → 0.6.2-dev.30
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 +9 -12
- package/dist/agent-auth.d.ts +3 -28
- package/dist/agent-auth.d.ts.map +1 -1
- package/dist/agent-auth.js +12 -181
- package/dist/agent-auth.js.map +1 -1
- package/dist/channels/manifest.d.ts +2 -4
- package/dist/channels/manifest.d.ts.map +1 -1
- package/dist/channels/trigger/http.js +1 -1
- package/dist/channels/trigger/http.js.map +1 -1
- package/dist/connectors/mcp/index.d.ts +5 -5
- package/dist/connectors/mcp/index.d.ts.map +1 -1
- package/dist/connectors/mcp/index.js +44 -60
- package/dist/connectors/mcp/index.js.map +1 -1
- package/dist/connectors/mcp/schema.d.ts.map +1 -1
- package/dist/connectors/mcp/schema.js +3 -5
- package/dist/connectors/mcp/schema.js.map +1 -1
- package/dist/connectors/mcp/types.d.ts +8 -8
- package/dist/connectors/mcp/types.d.ts.map +1 -1
- package/dist/credential-gate.d.ts +12 -13
- package/dist/credential-gate.d.ts.map +1 -1
- package/dist/credential-gate.js +31 -49
- package/dist/credential-gate.js.map +1 -1
- package/dist/credentials.d.ts +95 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/{connections.js → credentials.js} +100 -92
- package/dist/credentials.js.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/dist/connections.d.ts +0 -74
- package/dist/connections.d.ts.map +0 -1
- package/dist/connections.js.map +0 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `credentials.get(...)` — read a managed credential from a tool.
|
|
3
|
+
*
|
|
4
|
+
* `owner` is the scope the credential resolves under, and names the same axis as
|
|
5
|
+
* Agent Auth's `owner_type` / `owner_id`. `{ type: "agent" }` is the deployment,
|
|
6
|
+
* so every caller resolves the same static secret. `{ type: "user" }` is the
|
|
7
|
+
* current caller, always backed by an OAuth grant. Resolution reads Agent Auth
|
|
8
|
+
* on every await and never caches.
|
|
9
|
+
*
|
|
10
|
+
* `mda dev` runs without a deployment, so it substitutes local values instead:
|
|
11
|
+
* `{ type: "agent" }` reads a normalized `MDA_DEV_*` environment variable, and
|
|
12
|
+
* `{ type: "user" }` has no local stand-in for an OAuth grant, so it fails with
|
|
13
|
+
* an actionable error. Both scopes work normally against a deployment.
|
|
14
|
+
*/
|
|
15
|
+
import type { RuntimeIdentity } from "./identity/index.js";
|
|
16
|
+
import { type AgentAuthContext } from "./agent-auth.js";
|
|
17
|
+
export { AGENT_AUTH_TIMEOUT_MS, AgentAuthUnknownProviderError, CredentialAuthorizationRequiredError, CredentialStoreError, } from "./agent-auth.js";
|
|
18
|
+
export type { AgentAuthContext, PendingAuthorization } from "./agent-auth.js";
|
|
19
|
+
export type AgentCredentialOwner = {
|
|
20
|
+
type: "agent";
|
|
21
|
+
};
|
|
22
|
+
export type UserCredentialOwner = {
|
|
23
|
+
type: "user";
|
|
24
|
+
id?: string;
|
|
25
|
+
};
|
|
26
|
+
export type CredentialOwner = AgentCredentialOwner | UserCredentialOwner;
|
|
27
|
+
export interface CredentialRequest {
|
|
28
|
+
slug: string;
|
|
29
|
+
owner: CredentialOwner;
|
|
30
|
+
identity?: RuntimeIdentity;
|
|
31
|
+
}
|
|
32
|
+
declare const CREDENTIAL_REFERENCE: unique symbol;
|
|
33
|
+
export declare class CredentialNotFoundError extends Error {
|
|
34
|
+
readonly slug: string;
|
|
35
|
+
readonly ownerType: CredentialOwner["type"];
|
|
36
|
+
constructor(slug: string, ownerType: CredentialOwner["type"]);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A declarative credential handle. Connector declarations inspect its owner;
|
|
40
|
+
* awaiting the same handle inside a tool resolves fresh material every time.
|
|
41
|
+
*/
|
|
42
|
+
export declare class CredentialReference implements PromiseLike<string> {
|
|
43
|
+
readonly slug: string;
|
|
44
|
+
readonly owner: CredentialOwner;
|
|
45
|
+
private readonly accessor;
|
|
46
|
+
readonly [CREDENTIAL_REFERENCE] = true;
|
|
47
|
+
constructor(slug: string, owner: CredentialOwner, accessor: Credentials);
|
|
48
|
+
then<TResult1 = string, TResult2 = never>(onfulfilled?: ((value: string) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null): PromiseLike<TResult1 | TResult2>;
|
|
49
|
+
}
|
|
50
|
+
export declare function isCredentialReference(value: unknown): value is CredentialReference;
|
|
51
|
+
export declare class AgentAuthCredentialStore {
|
|
52
|
+
private readonly env;
|
|
53
|
+
private readonly fetchImpl;
|
|
54
|
+
private readonly timeoutMs;
|
|
55
|
+
constructor(env?: NodeJS.ProcessEnv, fetchImpl?: typeof fetch, timeoutMs?: number);
|
|
56
|
+
fetch(request: CredentialRequest): Promise<string | undefined>;
|
|
57
|
+
}
|
|
58
|
+
export declare class Credentials {
|
|
59
|
+
private readonly store;
|
|
60
|
+
constructor(store?: AgentAuthCredentialStore);
|
|
61
|
+
get(slug: string, owner: CredentialOwner): CredentialReference;
|
|
62
|
+
resolve(slug: string, owner: CredentialOwner): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Read an agent-owned secret outside a run.
|
|
65
|
+
*
|
|
66
|
+
* Connector declarations are loaded once per deployment, before any caller
|
|
67
|
+
* exists. An agent-owned secret is deployment-scoped, so it is the one lookup
|
|
68
|
+
* that carries no caller and can be resolved there.
|
|
69
|
+
*/
|
|
70
|
+
resolveDeploymentSecret(slug: string): Promise<string>;
|
|
71
|
+
}
|
|
72
|
+
/** Environment variable used for one agent-owned development credential. */
|
|
73
|
+
export declare function agentCredentialEnvKey(slug: string): string;
|
|
74
|
+
/**
|
|
75
|
+
* The `owner_id` a lookup is keyed by: the caller for a user, else the
|
|
76
|
+
* deployment. Shared with the credential gate so a declared owner is checked
|
|
77
|
+
* the same way wherever it is resolved.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveOwnerId(owner: CredentialOwner, identity: RuntimeIdentity | undefined, deploymentId: string | undefined): string;
|
|
80
|
+
/**
|
|
81
|
+
* The Agent Auth binding for one caller.
|
|
82
|
+
*
|
|
83
|
+
* `credentials.get` and the pre-run credential gate both resolve their owner id
|
|
84
|
+
* here, so a slug addresses the same Agent Auth row on either path.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveAgentAuthContext(identity: RuntimeIdentity | undefined, env?: NodeJS.ProcessEnv): AgentAuthContext;
|
|
87
|
+
/**
|
|
88
|
+
* Agent Auth is served by the LangSmith API.
|
|
89
|
+
*
|
|
90
|
+
* Rejects a URL that carries a path, query, or userinfo, so a misconfigured
|
|
91
|
+
* endpoint cannot send the API key at a different service.
|
|
92
|
+
*/
|
|
93
|
+
export declare function resolveAgentAuthBaseUrl(env?: NodeJS.ProcessEnv): string;
|
|
94
|
+
export declare const credentials: Credentials;
|
|
95
|
+
//# sourceMappingURL=credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,oCAAoC,EACpC,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE9E,MAAM,MAAM,oBAAoB,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AACrD,MAAM,MAAM,mBAAmB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAChE,MAAM,MA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+
* `credentials.get(...)` — read a managed credential from a tool.
|
|
3
3
|
*
|
|
4
|
-
* `
|
|
5
|
-
* `{ type: "
|
|
6
|
-
*
|
|
4
|
+
* `owner` is the scope the credential resolves under, and names the same axis as
|
|
5
|
+
* Agent Auth's `owner_type` / `owner_id`. `{ type: "agent" }` is the deployment,
|
|
6
|
+
* so every caller resolves the same static secret. `{ type: "user" }` is the
|
|
7
|
+
* current caller, always backed by an OAuth grant. Resolution reads Agent Auth
|
|
8
|
+
* on every await and never caches.
|
|
7
9
|
*
|
|
8
|
-
* `mda dev`
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* `mda dev` runs without a deployment, so it substitutes local values instead:
|
|
11
|
+
* `{ type: "agent" }` reads a normalized `MDA_DEV_*` environment variable, and
|
|
12
|
+
* `{ type: "user" }` has no local stand-in for an OAuth grant, so it fails with
|
|
13
|
+
* an actionable error. Both scopes work normally against a deployment.
|
|
11
14
|
*/
|
|
12
15
|
import { AGENT_AUTH_TIMEOUT_MS, AgentAuth, CredentialAuthorizationRequiredError, CredentialStoreError, } from "./agent-auth.js";
|
|
13
16
|
import { buildRuntimeIdentity, resolveRuntimeConfigurable, } from "./runtime/identity-runtime.js";
|
|
14
17
|
export { AGENT_AUTH_TIMEOUT_MS, AgentAuthUnknownProviderError, CredentialAuthorizationRequiredError, CredentialStoreError, } from "./agent-auth.js";
|
|
15
|
-
const
|
|
18
|
+
const CREDENTIAL_REFERENCE = Symbol("managed-deepagents.credential");
|
|
16
19
|
const SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
17
20
|
const MAX_SLUG_LENGTH = 64;
|
|
18
21
|
const DEFAULT_LANGSMITH_ENDPOINT = "https://api.smith.langchain.com";
|
|
19
22
|
const DEV_CREDENTIAL_PREFIX = "MDA_DEV_";
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A user-owned credential is an OAuth grant held per caller against the
|
|
25
|
+
* deployment, and `mda dev` has no deployment to hold one.
|
|
26
|
+
*/
|
|
27
|
+
function localUserCredentialUnsupported(slug) {
|
|
21
28
|
const localHint = slug
|
|
22
|
-
? `set ${
|
|
29
|
+
? `set ${agentCredentialEnvKey(slug)}`
|
|
23
30
|
: "set the corresponding MDA_DEV_<slug> variable";
|
|
24
|
-
return ("user-
|
|
25
|
-
"deploy with `mda deploy` to exercise this
|
|
31
|
+
return ("user-scoped credentials need a deployment, so they do not resolve in `mda dev`: " +
|
|
32
|
+
"deploy with `mda deploy` to exercise this credential, or declare it as " +
|
|
26
33
|
`{ type: "agent" } and ${localHint} for local runs`);
|
|
27
34
|
}
|
|
28
|
-
|
|
35
|
+
/** Agent Auth credential kinds, one per owner type. */
|
|
36
|
+
const CREDENTIAL_KIND = { agent: "secret", user: "oauth2" };
|
|
37
|
+
export class CredentialNotFoundError extends Error {
|
|
29
38
|
slug;
|
|
30
39
|
ownerType;
|
|
31
40
|
constructor(slug, ownerType) {
|
|
32
|
-
super(`no ${ownerType}
|
|
33
|
-
this.name = "
|
|
41
|
+
super(`no ${ownerType} credential is set for slug ${JSON.stringify(slug)}`);
|
|
42
|
+
this.name = "CredentialNotFoundError";
|
|
34
43
|
this.slug = slug;
|
|
35
44
|
this.ownerType = ownerType;
|
|
36
45
|
}
|
|
37
46
|
}
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export class ConnectionReference {
|
|
47
|
+
/**
|
|
48
|
+
* A declarative credential handle. Connector declarations inspect its owner;
|
|
49
|
+
* awaiting the same handle inside a tool resolves fresh material every time.
|
|
50
|
+
*/
|
|
51
|
+
export class CredentialReference {
|
|
46
52
|
slug;
|
|
47
53
|
owner;
|
|
48
54
|
accessor;
|
|
49
|
-
[
|
|
55
|
+
[CREDENTIAL_REFERENCE] = true;
|
|
50
56
|
constructor(slug, owner, accessor) {
|
|
51
57
|
this.slug = slug;
|
|
52
58
|
this.owner = owner;
|
|
@@ -58,13 +64,13 @@ export class ConnectionReference {
|
|
|
58
64
|
.then(onfulfilled, onrejected);
|
|
59
65
|
}
|
|
60
66
|
}
|
|
61
|
-
export function
|
|
62
|
-
return (value instanceof
|
|
67
|
+
export function isCredentialReference(value) {
|
|
68
|
+
return (value instanceof CredentialReference ||
|
|
63
69
|
(typeof value === "object" &&
|
|
64
70
|
value !== null &&
|
|
65
|
-
|
|
71
|
+
CREDENTIAL_REFERENCE in value));
|
|
66
72
|
}
|
|
67
|
-
export class
|
|
73
|
+
export class AgentAuthCredentialStore {
|
|
68
74
|
env;
|
|
69
75
|
fetchImpl;
|
|
70
76
|
timeoutMs;
|
|
@@ -74,16 +80,18 @@ export class AgentAuthConnectionStore {
|
|
|
74
80
|
this.timeoutMs = timeoutMs;
|
|
75
81
|
}
|
|
76
82
|
async fetch(request) {
|
|
83
|
+
// `mda dev` has no deployment to resolve against, so local values stand in
|
|
84
|
+
// for agent secrets and a user grant has nothing to stand in for.
|
|
77
85
|
if (this.env.MDA_LOCAL_DEV === "1") {
|
|
78
86
|
if (request.owner.type === "user") {
|
|
79
|
-
throw new CredentialStoreError(
|
|
87
|
+
throw new CredentialStoreError(localUserCredentialUnsupported(request.slug));
|
|
80
88
|
}
|
|
81
|
-
const value = this.env[
|
|
89
|
+
const value = this.env[agentCredentialEnvKey(request.slug)];
|
|
82
90
|
if (value !== undefined && value.trim()) {
|
|
83
91
|
return value;
|
|
84
92
|
}
|
|
85
|
-
throw new CredentialStoreError(`local agent
|
|
86
|
-
`set ${
|
|
93
|
+
throw new CredentialStoreError(`local agent credential ${JSON.stringify(request.slug)} is not configured; ` +
|
|
94
|
+
`set ${agentCredentialEnvKey(request.slug)}`);
|
|
87
95
|
}
|
|
88
96
|
const config = resolveAgentAuthConfig(this.env);
|
|
89
97
|
const ownerId = resolveOwnerId(request.owner, request.identity, config.deploymentId);
|
|
@@ -93,46 +101,33 @@ export class AgentAuthConnectionStore {
|
|
|
93
101
|
principalId: ownerId,
|
|
94
102
|
apiKey: config.apiKey,
|
|
95
103
|
workspaceId: config.workspaceId,
|
|
96
|
-
serviceKey: config.serviceKey,
|
|
97
104
|
}, this.fetchImpl, this.timeoutMs);
|
|
98
|
-
const row = await client.findWorkspaceConnection(request.slug);
|
|
99
|
-
if (!row) {
|
|
100
|
-
return undefined;
|
|
101
|
-
}
|
|
102
105
|
if (request.owner.type === "user") {
|
|
103
|
-
|
|
104
|
-
return await client.readUserSecret(request.slug);
|
|
105
|
-
}
|
|
106
|
-
if (row.kind === "oauth2") {
|
|
107
|
-
return await client.readUserAccessToken(request.slug);
|
|
108
|
-
}
|
|
109
|
-
return undefined;
|
|
106
|
+
return await client.readUserAccessToken(request.slug);
|
|
110
107
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
108
|
+
const credentialId = await client.findCredentialId({
|
|
109
|
+
ownerType: "agent",
|
|
110
|
+
ownerId,
|
|
111
|
+
kind: CREDENTIAL_KIND.agent,
|
|
112
|
+
slug: request.slug,
|
|
113
|
+
});
|
|
114
|
+
if (!credentialId)
|
|
115
|
+
return undefined;
|
|
116
|
+
return await client.readSecret(credentialId);
|
|
122
117
|
}
|
|
123
118
|
}
|
|
124
|
-
export class
|
|
119
|
+
export class Credentials {
|
|
125
120
|
store;
|
|
126
|
-
constructor(store = new
|
|
121
|
+
constructor(store = new AgentAuthCredentialStore()) {
|
|
127
122
|
this.store = store;
|
|
128
123
|
}
|
|
129
124
|
get(slug, owner) {
|
|
130
|
-
return new
|
|
125
|
+
return new CredentialReference(normalizeSlug(slug), normalizeOwner(owner), this);
|
|
131
126
|
}
|
|
132
127
|
async resolve(slug, owner) {
|
|
133
128
|
const configurable = resolveRuntimeConfigurable(undefined);
|
|
134
129
|
if (!configurable) {
|
|
135
|
-
throw new Error("
|
|
130
|
+
throw new Error("credentials.get(...) must be awaited inside a run: resolve a credential in a tool or middleware, not at import time");
|
|
136
131
|
}
|
|
137
132
|
const value = await this.store.fetch({
|
|
138
133
|
slug,
|
|
@@ -142,49 +137,57 @@ export class Connections {
|
|
|
142
137
|
if (value === undefined) {
|
|
143
138
|
throw owner.type === "user"
|
|
144
139
|
? new CredentialAuthorizationRequiredError([slug])
|
|
145
|
-
: new
|
|
140
|
+
: new CredentialNotFoundError(slug, owner.type);
|
|
146
141
|
}
|
|
147
142
|
return value;
|
|
148
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Read an agent-owned secret outside a run.
|
|
146
|
+
*
|
|
147
|
+
* Connector declarations are loaded once per deployment, before any caller
|
|
148
|
+
* exists. An agent-owned secret is deployment-scoped, so it is the one lookup
|
|
149
|
+
* that carries no caller and can be resolved there.
|
|
150
|
+
*/
|
|
149
151
|
async resolveDeploymentSecret(slug) {
|
|
150
152
|
const value = await this.store.fetch({
|
|
151
153
|
slug,
|
|
152
154
|
owner: { type: "agent" },
|
|
153
155
|
});
|
|
154
156
|
if (value === undefined) {
|
|
155
|
-
throw new
|
|
157
|
+
throw new CredentialNotFoundError(slug, "agent");
|
|
156
158
|
}
|
|
157
159
|
return value;
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
|
-
|
|
162
|
+
/** Environment variable used for one agent-owned development credential. */
|
|
163
|
+
export function agentCredentialEnvKey(slug) {
|
|
161
164
|
return `${DEV_CREDENTIAL_PREFIX}${normalizeSlug(slug)
|
|
162
165
|
.toUpperCase()
|
|
163
166
|
.replaceAll("-", "_")}`;
|
|
164
167
|
}
|
|
165
168
|
function normalizeSlug(slug) {
|
|
166
169
|
if (typeof slug !== "string") {
|
|
167
|
-
throw new TypeError("
|
|
170
|
+
throw new TypeError("credential slug must be a string");
|
|
168
171
|
}
|
|
169
172
|
const canonical = slug.trim();
|
|
170
173
|
if (!canonical ||
|
|
171
174
|
canonical.length > MAX_SLUG_LENGTH ||
|
|
172
175
|
!SLUG_PATTERN.test(canonical)) {
|
|
173
|
-
throw new TypeError(`
|
|
176
|
+
throw new TypeError(`credential slug ${JSON.stringify(slug)} is invalid: use lowercase letters, digits, and single hyphens, at most ${MAX_SLUG_LENGTH} characters`);
|
|
174
177
|
}
|
|
175
178
|
return canonical;
|
|
176
179
|
}
|
|
177
180
|
function normalizeOwner(owner) {
|
|
178
181
|
if (!owner || typeof owner !== "object") {
|
|
179
|
-
throw new TypeError('
|
|
182
|
+
throw new TypeError('credential owner is required: pass { type: "agent" } or { type: "user" }');
|
|
180
183
|
}
|
|
181
184
|
const keys = Object.keys(owner);
|
|
182
185
|
if (keys.some((key) => key !== "type" && key !== "id")) {
|
|
183
|
-
throw new TypeError("
|
|
186
|
+
throw new TypeError("credential owner has an unknown key");
|
|
184
187
|
}
|
|
185
188
|
if (owner.type === "agent") {
|
|
186
189
|
if ("id" in owner) {
|
|
187
|
-
throw new TypeError('
|
|
190
|
+
throw new TypeError('credential owner "id" is not accepted for { type: "agent" }');
|
|
188
191
|
}
|
|
189
192
|
return { type: "agent" };
|
|
190
193
|
}
|
|
@@ -192,35 +195,48 @@ function normalizeOwner(owner) {
|
|
|
192
195
|
if (owner.id === undefined)
|
|
193
196
|
return { type: "user" };
|
|
194
197
|
if (typeof owner.id !== "string" || !owner.id.trim()) {
|
|
195
|
-
throw new TypeError('
|
|
198
|
+
throw new TypeError('credential owner "id" must be a non-empty string');
|
|
196
199
|
}
|
|
197
200
|
return { type: "user", id: owner.id.trim() };
|
|
198
201
|
}
|
|
199
|
-
throw new TypeError("
|
|
202
|
+
throw new TypeError("credential owner type is not supported");
|
|
200
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* The `owner_id` a lookup is keyed by: the caller for a user, else the
|
|
206
|
+
* deployment. Shared with the credential gate so a declared owner is checked
|
|
207
|
+
* the same way wherever it is resolved.
|
|
208
|
+
*/
|
|
201
209
|
export function resolveOwnerId(owner, identity, deploymentId) {
|
|
202
210
|
if (owner.type === "user") {
|
|
203
211
|
const authenticated = identity?.user.id;
|
|
204
212
|
if (!authenticated) {
|
|
205
|
-
throw new CredentialStoreError("user
|
|
213
|
+
throw new CredentialStoreError("user credentials require an authenticated user principal");
|
|
206
214
|
}
|
|
207
215
|
if (owner.id !== undefined && owner.id !== authenticated) {
|
|
208
|
-
throw new CredentialStoreError("user
|
|
216
|
+
throw new CredentialStoreError("user credential owner id must match the authenticated principal");
|
|
209
217
|
}
|
|
210
218
|
return authenticated;
|
|
211
219
|
}
|
|
212
220
|
if (!deploymentId) {
|
|
213
|
-
throw new CredentialStoreError("
|
|
221
|
+
throw new CredentialStoreError("credentials are not configured: LANGSMITH_HOST_PROJECT_ID is not set");
|
|
214
222
|
}
|
|
215
223
|
return deploymentId;
|
|
216
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* The Agent Auth binding for one caller.
|
|
227
|
+
*
|
|
228
|
+
* `credentials.get` and the pre-run credential gate both resolve their owner id
|
|
229
|
+
* here, so a slug addresses the same Agent Auth row on either path.
|
|
230
|
+
*/
|
|
217
231
|
export function resolveAgentAuthContext(identity, env = process.env) {
|
|
232
|
+
// Only the user-credential gate resolves a context, so a local run can say
|
|
233
|
+
// why rather than reporting a missing deployment variable.
|
|
218
234
|
if (env.MDA_LOCAL_DEV === "1") {
|
|
219
|
-
throw new CredentialStoreError(
|
|
235
|
+
throw new CredentialStoreError(localUserCredentialUnsupported());
|
|
220
236
|
}
|
|
221
237
|
const config = resolveAgentAuthConfig(env);
|
|
222
238
|
if (!config.deploymentId) {
|
|
223
|
-
throw new CredentialStoreError("
|
|
239
|
+
throw new CredentialStoreError("credentials are not configured: LANGSMITH_HOST_PROJECT_ID is not set");
|
|
224
240
|
}
|
|
225
241
|
return {
|
|
226
242
|
baseUrl: config.baseUrl,
|
|
@@ -228,42 +244,34 @@ export function resolveAgentAuthContext(identity, env = process.env) {
|
|
|
228
244
|
principalId: resolveOwnerId({ type: "user" }, identity, config.deploymentId),
|
|
229
245
|
apiKey: config.apiKey,
|
|
230
246
|
workspaceId: config.workspaceId,
|
|
231
|
-
serviceKey: config.serviceKey,
|
|
232
247
|
};
|
|
233
248
|
}
|
|
234
249
|
function resolveAgentAuthConfig(env) {
|
|
235
250
|
const apiKey = env.LANGSMITH_API_KEY?.trim();
|
|
236
251
|
if (!apiKey) {
|
|
237
|
-
throw new CredentialStoreError("
|
|
238
|
-
}
|
|
239
|
-
const workspaceId = env.LANGSMITH_WORKSPACE_ID?.trim();
|
|
240
|
-
if (!workspaceId) {
|
|
241
|
-
throw new CredentialStoreError("connections are not configured: LANGSMITH_WORKSPACE_ID is not set");
|
|
252
|
+
throw new CredentialStoreError("credentials are not configured: LANGSMITH_API_KEY is not set");
|
|
242
253
|
}
|
|
243
254
|
return {
|
|
244
255
|
baseUrl: resolveAgentAuthBaseUrl(env),
|
|
245
256
|
apiKey,
|
|
246
257
|
deploymentId: env.LANGSMITH_HOST_PROJECT_ID?.trim() || undefined,
|
|
247
|
-
workspaceId,
|
|
248
|
-
serviceKey: env.MDA_AGENT_AUTH_SERVICE_KEY?.trim() || undefined,
|
|
258
|
+
workspaceId: env.LANGSMITH_WORKSPACE_ID?.trim() || undefined,
|
|
249
259
|
};
|
|
250
260
|
}
|
|
251
261
|
/**
|
|
252
|
-
*
|
|
262
|
+
* Agent Auth is served by the LangSmith API.
|
|
253
263
|
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
264
|
+
* Rejects a URL that carries a path, query, or userinfo, so a misconfigured
|
|
265
|
+
* endpoint cannot send the API key at a different service.
|
|
256
266
|
*/
|
|
257
267
|
export function resolveAgentAuthBaseUrl(env = process.env) {
|
|
258
|
-
const raw = env.LANGSMITH_ENDPOINT?.trim() ||
|
|
259
|
-
env.LANGCHAIN_ENDPOINT?.trim() ||
|
|
260
|
-
DEFAULT_LANGSMITH_ENDPOINT;
|
|
268
|
+
const raw = env.LANGSMITH_ENDPOINT?.trim() || DEFAULT_LANGSMITH_ENDPOINT;
|
|
261
269
|
let parsed;
|
|
262
270
|
try {
|
|
263
271
|
parsed = new URL(raw);
|
|
264
272
|
}
|
|
265
273
|
catch {
|
|
266
|
-
throw new
|
|
274
|
+
throw new CredentialStoreError("LANGSMITH_ENDPOINT is not a valid URL");
|
|
267
275
|
}
|
|
268
276
|
if (!["http:", "https:"].includes(parsed.protocol) ||
|
|
269
277
|
!parsed.hostname ||
|
|
@@ -272,9 +280,9 @@ export function resolveAgentAuthBaseUrl(env = process.env) {
|
|
|
272
280
|
(parsed.pathname !== "/" && parsed.pathname !== "") ||
|
|
273
281
|
parsed.search ||
|
|
274
282
|
parsed.hash) {
|
|
275
|
-
throw new
|
|
283
|
+
throw new CredentialStoreError("LANGSMITH_ENDPOINT is not a valid URL");
|
|
276
284
|
}
|
|
277
285
|
return parsed.origin;
|
|
278
286
|
}
|
|
279
|
-
export const
|
|
280
|
-
//# sourceMappingURL=
|
|
287
|
+
export const credentials = new Credentials();
|
|
288
|
+
//# sourceMappingURL=credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,oCAAoC,EACpC,oBAAoB,GAErB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,0BAA0B,GAC3B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,oCAAoC,EACpC,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAazB,MAAM,oBAAoB,GAAG,MAAM,CAAC,+BAA+B,CAAC,CAAC;AACrE,MAAM,YAAY,GAAG,4BAA4B,CAAC;AAClD,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,0BAA0B,GAAG,iCAAiC,CAAC;AACrE,MAAM,qBAAqB,GAAG,UAAU,CAAC;AACzC;;;GAGG;AACH,SAAS,8BAA8B,CAAC,IAAa;IACnD,MAA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;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { defineSchedule } from "./schedules.js";
|
|
|
3
3
|
export { defineIdentity } from "./identity/index.js";
|
|
4
4
|
export { defineMemory } from "./memory/index.js";
|
|
5
5
|
export { auth, channels } from "./namespaces.js";
|
|
6
|
-
export {
|
|
6
|
+
export { credentials, CredentialAuthorizationRequiredError, CredentialNotFoundError, CredentialStoreError, } from "./credentials.js";
|
|
7
7
|
export { defineSandbox } from "./sandbox.js";
|
|
8
8
|
export type { Channels } from "./namespaces.js";
|
|
9
9
|
import { mcpConnector } from "./connectors/mcp/index.js";
|
|
@@ -14,7 +14,7 @@ export interface Connectors {
|
|
|
14
14
|
/**
|
|
15
15
|
* Declare remote MCP servers (HTTP/SSE) whose tools load at agent-graph
|
|
16
16
|
* construction. Stdio servers are not supported. A server may name a
|
|
17
|
-
*
|
|
17
|
+
* credential; in `mda dev`, an agent-owned one resolves from a normalized
|
|
18
18
|
* `MDA_DEV_*` environment variable instead of the deployment's Agent Auth
|
|
19
19
|
* secret.
|
|
20
20
|
*
|
|
@@ -25,7 +25,7 @@ export interface Connectors {
|
|
|
25
25
|
* docs: {
|
|
26
26
|
* transport: "http",
|
|
27
27
|
* url: "https://docs.example.com/mcp",
|
|
28
|
-
*
|
|
28
|
+
* credential: credentials.get("docs-token", { type: "agent" }),
|
|
29
29
|
* },
|
|
30
30
|
* },
|
|
31
31
|
* });
|
|
@@ -37,12 +37,12 @@ export interface Connectors {
|
|
|
37
37
|
}
|
|
38
38
|
/** Public connectors namespace — MCP only for this release. */
|
|
39
39
|
export declare const connectors: Connectors;
|
|
40
|
-
export type {
|
|
40
|
+
export type { AgentCredentialOwner, CredentialOwner, CredentialRequest, UserCredentialOwner, } from "./credentials.js";
|
|
41
41
|
export type { DeepAgentDefinition, DefineDeepAgentConfig, ManagedDeepAgentKey, } from "./types.js";
|
|
42
42
|
export type { ScheduleConfig, ScheduleDefinition, ScheduleDeliveryTarget, ScheduleThreadConfig, } from "./schedules.js";
|
|
43
43
|
export type { ClaimMapping, CredentialScope, HttpIngress, IdentityAuth, IdentityConfig, IdentityDefinition, IdentityOptions, IdentitySource, LangSmithApiKeyIngress, Link, LinkStatus, Principal, PrincipalClaims, PrincipalEnvelope, PrincipalKind, RuntimeIdentity, Subject, SubjectAuthority, ValidatedTokenIngress, ValidatedTokenProvider, } from "./identity/index.js";
|
|
44
44
|
export type { MemoryConfig, MemoryDefinition, MemoryOptions, MemoryScope, MemoryScopeInput, MemorySliceInput, MemorySliceKind, ResolvedMemorySlice, } from "./memory/index.js";
|
|
45
|
-
export type { HttpMcpServerConfig,
|
|
45
|
+
export type { HttpMcpServerConfig, McpServersConfig, McpServersDefinition, McpServerCredential, McpToolSelectionConfig, RemoteMcpServerBaseConfig, RemoteMcpServerConfig, SseMcpServerConfig, } from "./connectors/mcp/index.js";
|
|
46
46
|
export type { CredentialAuthorizationRequiredInterrupt, PendingCredential, } from "./credential-gate.js";
|
|
47
47
|
export type { ChannelManifest } from "./channels/manifest.js";
|
|
48
48
|
export type { RequiredTriggerSlackChannelConfig, SlackChannel, SlackChannelConfig, } from "./channels/slack/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,o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B,EACjB,aAAa,EACb,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAE3B,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AAEnC,YAAY,EACV,wCAAwC,EACxC,iBAAiB,GAClB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,iCAAiC,EACjC,YAAY,EACZ,kBAAkB,GACnB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEtE,YAAY,EACV,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,4BAA4B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { defineSchedule } from "./schedules.js";
|
|
|
3
3
|
export { defineIdentity } from "./identity/index.js";
|
|
4
4
|
export { defineMemory } from "./memory/index.js";
|
|
5
5
|
export { auth, channels } from "./namespaces.js";
|
|
6
|
-
export {
|
|
6
|
+
export { credentials, CredentialAuthorizationRequiredError, CredentialNotFoundError, CredentialStoreError, } from "./credentials.js";
|
|
7
7
|
export { defineSandbox } from "./sandbox.js";
|
|
8
8
|
import { mcpConnector } from "./connectors/mcp/index.js";
|
|
9
9
|
/** Public connectors namespace — MCP only for this release. */
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,oCAAoC,EACpC,uBAAuB,EACvB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,WAAW,EACX,oCAAoC,EACpC,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AA+BzD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,UAAU,GAAe;IACpC,GAAG,EAAE,YAAY;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "managed-deepagents",
|
|
3
|
-
"version": "0.6.2-dev.
|
|
3
|
+
"version": "0.6.2-dev.30",
|
|
4
4
|
"description": "Managed Deep Agents — the `defineDeepAgent` authoring interface plus the CLI that compiles and deploys a code-first Deep Agent repository to a managed LangGraph runtime.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"langchain",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"zod": "^4.4.3"
|
|
67
67
|
},
|
|
68
68
|
"optionalDependencies": {
|
|
69
|
-
"@langchain/managed-deepagents-darwin-arm64": "0.6.2-dev.
|
|
70
|
-
"@langchain/managed-deepagents-darwin-x64": "0.6.2-dev.
|
|
71
|
-
"@langchain/managed-deepagents-linux-arm64": "0.6.2-dev.
|
|
72
|
-
"@langchain/managed-deepagents-linux-x64": "0.6.2-dev.
|
|
73
|
-
"@langchain/managed-deepagents-win32-arm64": "0.6.2-dev.
|
|
74
|
-
"@langchain/managed-deepagents-win32-x64": "0.6.2-dev.
|
|
69
|
+
"@langchain/managed-deepagents-darwin-arm64": "0.6.2-dev.30",
|
|
70
|
+
"@langchain/managed-deepagents-darwin-x64": "0.6.2-dev.30",
|
|
71
|
+
"@langchain/managed-deepagents-linux-arm64": "0.6.2-dev.30",
|
|
72
|
+
"@langchain/managed-deepagents-linux-x64": "0.6.2-dev.30",
|
|
73
|
+
"@langchain/managed-deepagents-win32-arm64": "0.6.2-dev.30",
|
|
74
|
+
"@langchain/managed-deepagents-win32-x64": "0.6.2-dev.30"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/node": "^26.1.1",
|