managed-deepagents 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connectors/langsmith.d.ts +385 -0
- package/dist/connectors/langsmith.d.ts.map +1 -0
- package/dist/connectors/langsmith.js +431 -0
- package/dist/connectors/langsmith.js.map +1 -0
- package/dist/connectors.d.ts +7 -2
- package/dist/connectors.d.ts.map +1 -1
- package/dist/connectors.js +18 -1
- package/dist/connectors.js.map +1 -1
- package/dist/identity/index.d.ts +88 -0
- package/dist/identity/index.d.ts.map +1 -0
- package/dist/identity/index.js +303 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/supabase.d.ts +48 -0
- package/dist/identity/supabase.d.ts.map +1 -0
- package/dist/identity/supabase.js +139 -0
- package/dist/identity/supabase.js.map +1 -0
- package/dist/identity/types.d.ts +185 -0
- package/dist/identity/types.d.ts.map +1 -0
- package/dist/identity/types.js +8 -0
- package/dist/identity/types.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime/auth.d.ts +56 -0
- package/dist/runtime/auth.d.ts.map +1 -0
- package/dist/runtime/auth.js +204 -0
- package/dist/runtime/auth.js.map +1 -0
- package/dist/runtime/connector.d.ts +138 -0
- package/dist/runtime/connector.d.ts.map +1 -0
- package/dist/runtime/connector.js +82 -0
- package/dist/runtime/connector.js.map +1 -0
- package/dist/runtime/credentials.d.ts +68 -0
- package/dist/runtime/credentials.d.ts.map +1 -0
- package/dist/runtime/credentials.js +212 -0
- package/dist/runtime/credentials.js.map +1 -0
- package/dist/runtime/identity-http.d.ts +27 -0
- package/dist/runtime/identity-http.d.ts.map +1 -0
- package/dist/runtime/identity-http.js +159 -0
- package/dist/runtime/identity-http.js.map +1 -0
- package/dist/runtime/identity-runtime.d.ts +54 -0
- package/dist/runtime/identity-runtime.d.ts.map +1 -0
- package/dist/runtime/identity-runtime.js +151 -0
- package/dist/runtime/identity-runtime.js.map +1 -0
- package/dist/runtime/index.d.ts +14 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +114 -68
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/langsmith-connector.d.ts +247 -0
- package/dist/runtime/langsmith-connector.d.ts.map +1 -0
- package/dist/runtime/langsmith-connector.js +1175 -0
- package/dist/runtime/langsmith-connector.js.map +1 -0
- package/dist/runtime/managed-middleware.d.ts +25 -0
- package/dist/runtime/managed-middleware.d.ts.map +1 -0
- package/dist/runtime/managed-middleware.js +76 -0
- package/dist/runtime/managed-middleware.js.map +1 -0
- package/dist/runtime/managed-tools.d.ts +61 -0
- package/dist/runtime/managed-tools.d.ts.map +1 -0
- package/dist/runtime/managed-tools.js +102 -0
- package/dist/runtime/managed-tools.js.map +1 -0
- package/dist/runtime/sandbox-manager.d.ts +3 -2
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/setup-script.d.ts +4 -7
- package/dist/runtime/setup-script.d.ts.map +1 -1
- package/dist/runtime/setup-script.js.map +1 -1
- package/dist/runtime/types.d.ts +23 -21
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/validated-token.d.ts +53 -0
- package/dist/runtime/validated-token.d.ts.map +1 -0
- package/dist/runtime/validated-token.js +411 -0
- package/dist/runtime/validated-token.js.map +1 -0
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +12 -8
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared identity authoring types.
|
|
3
|
+
*
|
|
4
|
+
* Kept separate from provider helpers so modules like `supabase.ts` can import
|
|
5
|
+
* types without circular dependencies on the public barrel.
|
|
6
|
+
*/
|
|
7
|
+
/** How MDA learns who is calling on the HTTP ingress path. */
|
|
8
|
+
export type HttpIngress = "trusted_backend" | ValidatedTokenIngress;
|
|
9
|
+
/**
|
|
10
|
+
* Browser-direct ingress: MDA verifies the caller's own IdP token server-side
|
|
11
|
+
* and derives identity from its claims.
|
|
12
|
+
*/
|
|
13
|
+
export interface ValidatedTokenIngress {
|
|
14
|
+
mode: "validated_token";
|
|
15
|
+
/**
|
|
16
|
+
* The token families this deployment accepts (non-empty). MDA selects a
|
|
17
|
+
* provider per request by the token issuer (`iss`). Use one entry for a single
|
|
18
|
+
* IdP; `id` is required once there is more than one entry.
|
|
19
|
+
*/
|
|
20
|
+
providers: ValidatedTokenProvider[];
|
|
21
|
+
}
|
|
22
|
+
/** A single token family MDA knows how to verify. */
|
|
23
|
+
export interface ValidatedTokenProvider {
|
|
24
|
+
/** Label used for routing; required only when there is more than one provider. */
|
|
25
|
+
id?: string;
|
|
26
|
+
/** Expected token issuer (`iss`) — the routing/verification key for real IdP tokens. */
|
|
27
|
+
issuer?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Additional accepted `iss` values (e.g. multi-region Supabase projects on one
|
|
30
|
+
* introspect provider).
|
|
31
|
+
*/
|
|
32
|
+
issuers?: string[];
|
|
33
|
+
/** Expected audience (`aud`), so tokens minted for other apps are rejected. */
|
|
34
|
+
audience?: string;
|
|
35
|
+
/** Accepted signing algorithms, e.g. `["RS256"]`. */
|
|
36
|
+
algorithms?: string[];
|
|
37
|
+
/**
|
|
38
|
+
* URL of the IdP's public keys (JWKS). MDA verifies the signature locally —
|
|
39
|
+
* the recommended path for most OAuth/OIDC providers.
|
|
40
|
+
*/
|
|
41
|
+
jwks?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Resolve `jwks`/endpoints from `issuer/.well-known/openid-configuration`
|
|
44
|
+
* instead of a literal `jwks` URL (what `providers.oidc` sets).
|
|
45
|
+
*/
|
|
46
|
+
discover?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Auth API root used to resolve the real JWT `issuer` + `jwks` via OIDC
|
|
49
|
+
* discovery (custom Supabase domains). Materialized at request time before
|
|
50
|
+
* provider selection so vanity hosts are not mistaken for token `iss`.
|
|
51
|
+
*/
|
|
52
|
+
discoveryUrl?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Only for opaque tokens: verify by calling the IdP once per request
|
|
55
|
+
* (e.g. Supabase `/auth/v1/user`).
|
|
56
|
+
*/
|
|
57
|
+
introspect?: {
|
|
58
|
+
/** Single introspection endpoint (the common case). */
|
|
59
|
+
url?: string;
|
|
60
|
+
/** Provider-specific endpoint selection by a client header (e.g. Supabase region). */
|
|
61
|
+
regionHeader?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Region value → introspection endpoint. A bare string is the URL (using the
|
|
64
|
+
* shared `headers` below); an object also carries region-specific headers
|
|
65
|
+
* (e.g. a per-region Supabase `apikey`), which override the shared ones.
|
|
66
|
+
*/
|
|
67
|
+
regions?: Record<string, string | {
|
|
68
|
+
url: string;
|
|
69
|
+
headers?: Record<string, string>;
|
|
70
|
+
}>;
|
|
71
|
+
/** Static headers sent with the introspection call (e.g. Supabase `apikey`). */
|
|
72
|
+
headers?: Record<string, string>;
|
|
73
|
+
/** Where MDA puts the user's token when calling the endpoint. Default: "authorization". */
|
|
74
|
+
tokenIn?: "authorization" | "header";
|
|
75
|
+
/** Custom header name when `tokenIn` is "header". */
|
|
76
|
+
header?: string;
|
|
77
|
+
};
|
|
78
|
+
/** MDA issues + verifies short-lived signed tokens for anonymous/guest users. */
|
|
79
|
+
guest?: {
|
|
80
|
+
/** Enable an issue/reissue path for this provider. */
|
|
81
|
+
issue: boolean;
|
|
82
|
+
/** Token lifetime, e.g. "24h". */
|
|
83
|
+
ttl?: string;
|
|
84
|
+
/** Prefix applied to the generated actor id, e.g. "guest:". */
|
|
85
|
+
actorPrefix?: string;
|
|
86
|
+
};
|
|
87
|
+
/** Maps verified token claims → identity envelope fields. */
|
|
88
|
+
claims: {
|
|
89
|
+
/** Claim used as `runtime.identity.actor.id` (e.g. "sub", "email"). */
|
|
90
|
+
actor: string;
|
|
91
|
+
/** Claim used as `runtime.identity.tenant.id` (e.g. "org_id"). */
|
|
92
|
+
tenant?: string;
|
|
93
|
+
/** Claim used as `runtime.identity.actor.email`. */
|
|
94
|
+
email?: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Which downstream call needs a credential right now. */
|
|
98
|
+
export interface CredentialTarget {
|
|
99
|
+
/** What is being called. */
|
|
100
|
+
kind: "subagent" | "mcp" | "connection" | "langsmith";
|
|
101
|
+
/** The configured name, e.g. "code-reviewer" | "docs" | "github". */
|
|
102
|
+
name: string;
|
|
103
|
+
/** Optional read/write hint so the resolver can mint different tokens. */
|
|
104
|
+
intent?: "read" | "write";
|
|
105
|
+
/** Current thread, when the credential is thread-specific. */
|
|
106
|
+
threadId?: string;
|
|
107
|
+
/** Free-form context (e.g. `{ repo, installationId }`); part of the cache key. */
|
|
108
|
+
metadata?: Record<string, unknown>;
|
|
109
|
+
}
|
|
110
|
+
/** What a credential resolver returns. */
|
|
111
|
+
export interface ResolvedCredential {
|
|
112
|
+
/** Headers MDA attaches to the downstream call (usually Authorization). */
|
|
113
|
+
headers: Record<string, string>;
|
|
114
|
+
/** ISO expiry; MDA caches per (actor, tenant, target) until then. */
|
|
115
|
+
expiresAt?: string;
|
|
116
|
+
}
|
|
117
|
+
/** The frozen identity envelope tools and middleware see. */
|
|
118
|
+
export interface RuntimeIdentity {
|
|
119
|
+
actor: {
|
|
120
|
+
type: "user" | "service";
|
|
121
|
+
id: string;
|
|
122
|
+
email?: string;
|
|
123
|
+
};
|
|
124
|
+
tenant?: {
|
|
125
|
+
id: string;
|
|
126
|
+
};
|
|
127
|
+
source: {
|
|
128
|
+
provider: "http" | "slack" | "schedule" | "cli" | "studio";
|
|
129
|
+
threadId?: string;
|
|
130
|
+
};
|
|
131
|
+
claims?: Record<string, unknown>;
|
|
132
|
+
}
|
|
133
|
+
/** An in-process resolver callback. */
|
|
134
|
+
export type CredentialResolver = (args: {
|
|
135
|
+
identity: RuntimeIdentity;
|
|
136
|
+
target: CredentialTarget;
|
|
137
|
+
}) => Promise<ResolvedCredential>;
|
|
138
|
+
/**
|
|
139
|
+
* Provide this (with `scoping.credentials: "custom"`) to mint your own
|
|
140
|
+
* downstream credentials per actor: an in-process callback or a hosted
|
|
141
|
+
* token-exchange endpoint.
|
|
142
|
+
*/
|
|
143
|
+
export type CredentialResolverConfig = {
|
|
144
|
+
resolve: CredentialResolver;
|
|
145
|
+
} | {
|
|
146
|
+
endpoint: {
|
|
147
|
+
url: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
/** The tenant boundary. */
|
|
151
|
+
export type Tenancy = "single" | "multi";
|
|
152
|
+
/** Who can open/resume the conversation. */
|
|
153
|
+
export type ThreadScope = "actor" | "channel" | "tenant";
|
|
154
|
+
/** The durable Store namespace prefix. */
|
|
155
|
+
export type MemoryScope = "actor" | "tenant" | "agent" | "none";
|
|
156
|
+
/** Whose token downstream calls carry. */
|
|
157
|
+
export type CredentialScope = "agent" | "actor" | "none" | "custom";
|
|
158
|
+
/** The whole identity config surface. */
|
|
159
|
+
export interface IdentityConfig {
|
|
160
|
+
/** How MDA learns who is calling. */
|
|
161
|
+
ingress: {
|
|
162
|
+
http: HttpIngress;
|
|
163
|
+
};
|
|
164
|
+
/** The tenant boundary. */
|
|
165
|
+
tenancy: Tenancy;
|
|
166
|
+
/** The three scoping axes. */
|
|
167
|
+
scoping: {
|
|
168
|
+
/** Who can open/resume the conversation. */
|
|
169
|
+
threads?: ThreadScope;
|
|
170
|
+
/** Durable Store namespace prefix. */
|
|
171
|
+
memory: MemoryScope;
|
|
172
|
+
/** Managed mode, or "custom" when a resolver/endpoint is provided below. */
|
|
173
|
+
credentials?: CredentialScope;
|
|
174
|
+
};
|
|
175
|
+
/** Present when `scoping.credentials` is "custom" (or a resolver is set). */
|
|
176
|
+
credentials?: CredentialResolverConfig;
|
|
177
|
+
}
|
|
178
|
+
/** The object exported from the project's root `identity.ts`. */
|
|
179
|
+
export interface IdentityDefinition {
|
|
180
|
+
readonly kind: "identity";
|
|
181
|
+
readonly config: IdentityConfig;
|
|
182
|
+
}
|
|
183
|
+
/** The archetype presets that expand to a full {@link IdentityConfig}. */
|
|
184
|
+
export type IdentityPresetName = "private-assistant" | "multi-tenant-saas" | "shared-bot" | "internal-tool" | "service";
|
|
185
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8DAA8D;AAC9D,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,qBAAqB,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,iBAAiB,CAAC;IACxB;;;;OAIG;IACH,SAAS,EAAE,sBAAsB,EAAE,CAAC;CACrC;AAED,qDAAqD;AACrD,MAAM,WAAW,sBAAsB;IACrC,kFAAkF;IAClF,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE;QACX,uDAAuD;QACvD,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,sFAAsF;QACtF,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB;;;;WAIG;QACH,OAAO,CAAC,EAAE,MAAM,CACd,MAAM,EACN,MAAM,GAAG;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC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CAAC;KACnB,CAAC;IACF,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,OAAO,EAAE;QACP,4CAA4C;QAC5C,OAAO,CAAC,EAAE,WAAW,CAAC;QACtB,sCAAsC;QACtC,MAAM,EAAE,WAAW,CAAC;QACpB,4EAA4E;QAC5E,WAAW,CAAC,EAAE,eAAe,CAAC;KAC/B,CAAC;IACF,6EAA6E;IAC7E,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACxC;AAED,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;CACjC;AAED,0EAA0E;AAC1E,MAAM,MAAM,kBAAkB,GAC1B,mBAAmB,GACnB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export { defineDeepAgent } from "./define-deep-agent.js";
|
|
2
2
|
export { defineMcpServers } from "./connectors.js";
|
|
3
|
+
export * as langsmith from "./connectors/langsmith.js";
|
|
4
|
+
export type { LangSmithCapability, LangSmithCallerSurface, LangSmithCapabilityScope, LangSmithConnector, LangSmithConnectorConfig, LangSmithResource, LangSmithResponseShape, } from "./connectors/langsmith.js";
|
|
3
5
|
export { defineSchedule } from "./schedules.js";
|
|
4
6
|
export { defineSandbox } from "./sandbox.js";
|
|
7
|
+
export { defineIdentity, providers, validateIdentity, } from "./identity/index.js";
|
|
8
|
+
export type { CredentialResolver, CredentialResolverConfig, CredentialScope, CredentialTarget, DefineIdentity, HttpIngress, IdentityConfig, IdentityDefinition, IdentityPresetName, MemoryScope, ResolvedCredential, RuntimeIdentity, Tenancy, ThreadScope, ValidatedTokenIngress, ValidatedTokenProvider, } from "./identity/index.js";
|
|
5
9
|
export type { HttpMcpServerConfig, McpServersConfig, McpServersDefinition, McpToolSelectionConfig, RemoteMcpServerBaseConfig, RemoteMcpServerConfig, SseMcpServerConfig, } from "./connectors.js";
|
|
6
10
|
export type { ScheduleConfig, ScheduleDefinition, ScheduleDeliveryTarget, ScheduleThreadConfig, } from "./schedules.js";
|
|
7
11
|
export type { ChannelAttachment, ChannelDestination, ChannelEvent, ChannelMessage, ChannelPostOptions, DeepAgentDefinition, DefineDeepAgentConfig, ManagedDeepAgentKey, PostedChannelMessage, Runtime, RuntimeChannel, } from "./types.js";
|
|
12
|
+
export type { ManagedDeepAgentRuntime, ManagedRuntimeExtras, } from "./runtime/managed-tools.js";
|
|
8
13
|
export type { DefineSandboxOptions, ManagedSandboxOptionKey, SandboxDefinition, SandboxProviderClass, SandboxProviderOptions, SandboxScope, } from "./sandbox.js";
|
|
9
14
|
//# sourceMappingURL=index.d.ts.map
|
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,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;
|
|
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,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AACvD,YAAY,EACV,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,WAAW,EACX,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,YAAY,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,iBAAiB,EACjB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AAEpC,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,GACb,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { defineDeepAgent } from "./define-deep-agent.js";
|
|
2
2
|
export { defineMcpServers } from "./connectors.js";
|
|
3
|
+
export * as langsmith from "./connectors/langsmith.js";
|
|
3
4
|
export { defineSchedule } from "./schedules.js";
|
|
4
5
|
export { defineSandbox } from "./sandbox.js";
|
|
6
|
+
export { defineIdentity, providers, validateIdentity, } from "./identity/index.js";
|
|
5
7
|
//# 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,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,SAAS,MAAM,2BAA2B,CAAC;AAUvD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EACL,cAAc,EACd,SAAS,EACT,gBAAgB,GACjB,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Auth } from "@langchain/langgraph-sdk/auth";
|
|
2
|
+
import type { IdentityConfig, IdentityDefinition, RuntimeIdentity } from "../identity/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* The user object `@auth.authenticate` returns. `identity`/`permissions` satisfy
|
|
5
|
+
* the LangGraph base shape; the `mda_*` fields carry the identity envelope into
|
|
6
|
+
* `config.configurable.langgraph_auth_user` for the runtime seam.
|
|
7
|
+
*/
|
|
8
|
+
export interface ManagedUser {
|
|
9
|
+
identity: string;
|
|
10
|
+
permissions: string[];
|
|
11
|
+
mda_actor_id: string;
|
|
12
|
+
mda_tenant_id?: string;
|
|
13
|
+
mda_actor_email?: string;
|
|
14
|
+
mda_claims?: Record<string, unknown>;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Build the managed LangGraph custom-auth handler from a declared identity.
|
|
19
|
+
*
|
|
20
|
+
* Handles both ingress modes: `trusted_backend` (reserved headers behind a
|
|
21
|
+
* shared ingress secret) and `validated_token` (browser-direct IdP tokens
|
|
22
|
+
* verified via JWKS / introspection / MDA-signed guest). Also registers thread
|
|
23
|
+
* and store scoping with a studio bypass.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildManagedAuth(identity: IdentityDefinition): Auth;
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the caller's frozen {@link RuntimeIdentity} from a raw HTTP request,
|
|
28
|
+
* using the same ingress logic (`trusted_backend` headers / `validated_token`
|
|
29
|
+
* verification) as the managed auth handler. Throws an {@link HTTPException}
|
|
30
|
+
* (401) when the caller is unauthenticated or unresolvable.
|
|
31
|
+
*
|
|
32
|
+
* This is the resolver that backs default-secure connector HTTP routes: a
|
|
33
|
+
* connector route runs behind identity by default, and this is what enforces it.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveRequestIdentity(cfg: IdentityConfig, request: Request): Promise<RuntimeIdentity>;
|
|
36
|
+
/**
|
|
37
|
+
* Fail-closed (403) unless the store `namespace` contains the identity segments
|
|
38
|
+
* the memory scope requires as a contiguous ordered prefix (typically after the
|
|
39
|
+
* deployment id). `agent`/`none` scopes carry no per-identity restriction.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assertStoreAccess(cfg: IdentityConfig, user: ManagedUser, value: unknown): void;
|
|
42
|
+
/** True when `required` appears as a contiguous ordered subsequence of `namespace`. */
|
|
43
|
+
export declare function namespaceHasOrderedSegments(namespace: string[], required: string[]): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Resolve the caller identity for `trusted_backend`: validate the shared ingress
|
|
46
|
+
* secret, then trust the reserved actor/tenant headers. Fail-closed (401) on a
|
|
47
|
+
* missing/invalid secret, a missing actor, or a missing tenant under multi.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resolveTrustedBackendUser(cfg: IdentityConfig, request: Request): ManagedUser;
|
|
50
|
+
/** Derive the owner value `@auth.on.threads` filters on, per the `threads` axis. */
|
|
51
|
+
export declare function threadOwnerKey(cfg: IdentityConfig, user: ManagedUser): string;
|
|
52
|
+
/** True when this deployment exposes guest issuance and the request targets it. */
|
|
53
|
+
export declare function isGuestIssuanceRequest(request: Request, cfg: IdentityConfig): boolean;
|
|
54
|
+
/** Placeholder identity so LangGraph auth middleware allows tokenless issuance. */
|
|
55
|
+
export declare function guestIssuanceBypassUser(): ManagedUser;
|
|
56
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/runtime/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAGL,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AA0B9B;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAsCnE;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,eAAe,CAAC,CAc1B;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,OAAO,GACb,IAAI,CAqBN;AAED,uFAAuF;AACvF,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAeT;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,GAAG,EAAE,cAAc,EACnB,OAAO,EAAE,OAAO,GACf,WAAW,CAgBb;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,GAAG,MAAM,CAY7E;AAuBD,mFAAmF;AACnF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,cAAc,GAClB,OAAO,CAaT;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,IAAI,WAAW,CAMrD"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { Auth, HTTPException, isStudioUser, } from "@langchain/langgraph-sdk/auth";
|
|
2
|
+
import { buildRuntimeIdentity, memoryIdentitySegments, } from "./identity-runtime.js";
|
|
3
|
+
import { resolveValidatedTokenUser } from "./validated-token.js";
|
|
4
|
+
/**
|
|
5
|
+
* Reserved transport for the trusted-backend ingress mode. Actor/tenant travel
|
|
6
|
+
* as reserved headers (mapped into `config.configurable` by the generated
|
|
7
|
+
* `langgraph.json` allowlist); the ingress secret is validated here and is
|
|
8
|
+
* deliberately **not** allowlisted, so it never reaches `config.configurable`.
|
|
9
|
+
*/
|
|
10
|
+
const ACTOR_HEADER = "x-mda-actor-id";
|
|
11
|
+
const TENANT_HEADER = "x-mda-tenant-id";
|
|
12
|
+
const INGRESS_SECRET_HEADER = "x-mda-ingress-secret";
|
|
13
|
+
/** Deployment env var carrying the shared secret the trusted backend presents. */
|
|
14
|
+
const INGRESS_SECRET_ENV = "MDA_INGRESS_SECRET";
|
|
15
|
+
/** Path MDA exposes for anonymous guest token issuance (must stay public). */
|
|
16
|
+
const GUEST_ISSUANCE_PATH = "/identity/guest";
|
|
17
|
+
/** Synthetic actor used only to satisfy auth middleware on the issuance route. */
|
|
18
|
+
const GUEST_ISSUER_ACTOR = "mda:guest-issuer";
|
|
19
|
+
/**
|
|
20
|
+
* Build the managed LangGraph custom-auth handler from a declared identity.
|
|
21
|
+
*
|
|
22
|
+
* Handles both ingress modes: `trusted_backend` (reserved headers behind a
|
|
23
|
+
* shared ingress secret) and `validated_token` (browser-direct IdP tokens
|
|
24
|
+
* verified via JWKS / introspection / MDA-signed guest). Also registers thread
|
|
25
|
+
* and store scoping with a studio bypass.
|
|
26
|
+
*/
|
|
27
|
+
export function buildManagedAuth(identity) {
|
|
28
|
+
const cfg = identity.config;
|
|
29
|
+
const http = cfg.ingress.http;
|
|
30
|
+
const auth = new Auth();
|
|
31
|
+
auth.authenticate(async (request) => {
|
|
32
|
+
if (isGuestIssuanceRequest(request, cfg)) {
|
|
33
|
+
return guestIssuanceBypassUser();
|
|
34
|
+
}
|
|
35
|
+
if (http === "trusted_backend") {
|
|
36
|
+
return resolveTrustedBackendUser(cfg, request);
|
|
37
|
+
}
|
|
38
|
+
return resolveValidatedTokenUser(cfg, http, request);
|
|
39
|
+
});
|
|
40
|
+
auth.on("threads", ({ user, value }) => {
|
|
41
|
+
if (isStudioUser(user)) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const key = threadOwnerKey(cfg, user);
|
|
45
|
+
if (value && typeof value === "object") {
|
|
46
|
+
const container = value;
|
|
47
|
+
container.metadata = { ...(container.metadata ?? {}), owner: key };
|
|
48
|
+
}
|
|
49
|
+
return { owner: key };
|
|
50
|
+
});
|
|
51
|
+
// Mirror the memory namespace so raw store ops can't cross the identity
|
|
52
|
+
// boundary a run is scoped to.
|
|
53
|
+
auth.on("store", ({ user, value }) => {
|
|
54
|
+
if (isStudioUser(user)) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
assertStoreAccess(cfg, user, value);
|
|
58
|
+
return true;
|
|
59
|
+
});
|
|
60
|
+
return auth;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resolve the caller's frozen {@link RuntimeIdentity} from a raw HTTP request,
|
|
64
|
+
* using the same ingress logic (`trusted_backend` headers / `validated_token`
|
|
65
|
+
* verification) as the managed auth handler. Throws an {@link HTTPException}
|
|
66
|
+
* (401) when the caller is unauthenticated or unresolvable.
|
|
67
|
+
*
|
|
68
|
+
* This is the resolver that backs default-secure connector HTTP routes: a
|
|
69
|
+
* connector route runs behind identity by default, and this is what enforces it.
|
|
70
|
+
*/
|
|
71
|
+
export async function resolveRequestIdentity(cfg, request) {
|
|
72
|
+
const http = cfg.ingress.http;
|
|
73
|
+
const user = http === "trusted_backend"
|
|
74
|
+
? resolveTrustedBackendUser(cfg, request)
|
|
75
|
+
: await resolveValidatedTokenUser(cfg, http, request);
|
|
76
|
+
const identity = buildRuntimeIdentity({
|
|
77
|
+
langgraph_auth_user: user,
|
|
78
|
+
mda_source_provider: "http",
|
|
79
|
+
});
|
|
80
|
+
if (!identity) {
|
|
81
|
+
throw new HTTPException(401, { message: "unauthenticated" });
|
|
82
|
+
}
|
|
83
|
+
return identity;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fail-closed (403) unless the store `namespace` contains the identity segments
|
|
87
|
+
* the memory scope requires as a contiguous ordered prefix (typically after the
|
|
88
|
+
* deployment id). `agent`/`none` scopes carry no per-identity restriction.
|
|
89
|
+
*/
|
|
90
|
+
export function assertStoreAccess(cfg, user, value) {
|
|
91
|
+
const required = memoryIdentitySegments(cfg.scoping.memory, cfg.tenancy, user.mda_actor_id ? String(user.mda_actor_id) : undefined, user.mda_tenant_id ? String(user.mda_tenant_id) : undefined);
|
|
92
|
+
if (required.length === 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const namespace = value &&
|
|
96
|
+
typeof value === "object" &&
|
|
97
|
+
Array.isArray(value.namespace)
|
|
98
|
+
? value.namespace.map(String)
|
|
99
|
+
: [];
|
|
100
|
+
if (!namespaceHasOrderedSegments(namespace, required)) {
|
|
101
|
+
throw new HTTPException(403, {
|
|
102
|
+
message: "store namespace is outside the caller's identity boundary",
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** True when `required` appears as a contiguous ordered subsequence of `namespace`. */
|
|
107
|
+
export function namespaceHasOrderedSegments(namespace, required) {
|
|
108
|
+
if (required.length === 0) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
if (namespace.length < required.length) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
for (let start = 0; start <= namespace.length - required.length; start += 1) {
|
|
115
|
+
if (required.every((segment, index) => namespace[start + index] === segment)) {
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Resolve the caller identity for `trusted_backend`: validate the shared ingress
|
|
123
|
+
* secret, then trust the reserved actor/tenant headers. Fail-closed (401) on a
|
|
124
|
+
* missing/invalid secret, a missing actor, or a missing tenant under multi.
|
|
125
|
+
*/
|
|
126
|
+
export function resolveTrustedBackendUser(cfg, request) {
|
|
127
|
+
requireIngressSecret(request);
|
|
128
|
+
const actor = request.headers.get(ACTOR_HEADER);
|
|
129
|
+
if (!actor) {
|
|
130
|
+
throw new HTTPException(401, { message: `missing ${ACTOR_HEADER}` });
|
|
131
|
+
}
|
|
132
|
+
const tenant = request.headers.get(TENANT_HEADER) ?? undefined;
|
|
133
|
+
assertTenantPresentIfMulti(cfg, tenant);
|
|
134
|
+
return {
|
|
135
|
+
identity: actor,
|
|
136
|
+
permissions: [],
|
|
137
|
+
mda_actor_id: actor,
|
|
138
|
+
...(tenant ? { mda_tenant_id: tenant } : {}),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Derive the owner value `@auth.on.threads` filters on, per the `threads` axis. */
|
|
142
|
+
export function threadOwnerKey(cfg, user) {
|
|
143
|
+
const scope = cfg.scoping.threads ?? "actor";
|
|
144
|
+
const actor = String(user.mda_actor_id ?? "");
|
|
145
|
+
const tenant = user.mda_tenant_id ? String(user.mda_tenant_id) : undefined;
|
|
146
|
+
if (scope === "tenant") {
|
|
147
|
+
return tenant ?? actor;
|
|
148
|
+
}
|
|
149
|
+
if (scope === "channel") {
|
|
150
|
+
const channel = user.mda_source_thread_id;
|
|
151
|
+
return channel ? String(channel) : actor;
|
|
152
|
+
}
|
|
153
|
+
return actor;
|
|
154
|
+
}
|
|
155
|
+
function requireIngressSecret(request) {
|
|
156
|
+
const expected = process.env[INGRESS_SECRET_ENV];
|
|
157
|
+
const provided = request.headers.get(INGRESS_SECRET_HEADER);
|
|
158
|
+
if (!expected || !provided || !constantTimeEquals(expected, provided)) {
|
|
159
|
+
throw new HTTPException(401, {
|
|
160
|
+
message: "invalid or missing ingress secret",
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function assertTenantPresentIfMulti(cfg, tenant) {
|
|
165
|
+
if (cfg.tenancy === "multi" && !tenant) {
|
|
166
|
+
throw new HTTPException(401, {
|
|
167
|
+
message: "missing tenant for multi-tenant deployment",
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/** True when this deployment exposes guest issuance and the request targets it. */
|
|
172
|
+
export function isGuestIssuanceRequest(request, cfg) {
|
|
173
|
+
if (request.method !== "POST") {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
const { pathname } = new URL(request.url);
|
|
177
|
+
if (pathname !== GUEST_ISSUANCE_PATH) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
const http = cfg.ingress.http;
|
|
181
|
+
if (http === "trusted_backend") {
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
return http.providers.some((provider) => provider.guest?.issue);
|
|
185
|
+
}
|
|
186
|
+
/** Placeholder identity so LangGraph auth middleware allows tokenless issuance. */
|
|
187
|
+
export function guestIssuanceBypassUser() {
|
|
188
|
+
return {
|
|
189
|
+
identity: GUEST_ISSUER_ACTOR,
|
|
190
|
+
permissions: [],
|
|
191
|
+
mda_actor_id: GUEST_ISSUER_ACTOR,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
function constantTimeEquals(a, b) {
|
|
195
|
+
if (a.length !== b.length) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
let mismatch = 0;
|
|
199
|
+
for (let i = 0; i < a.length; i += 1) {
|
|
200
|
+
mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i);
|
|
201
|
+
}
|
|
202
|
+
return mismatch === 0;
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/runtime/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,aAAa,EACb,YAAY,GACb,MAAM,+BAA+B,CAAC;AAOvC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,YAAY,GAAG,gBAAgB,CAAC;AACtC,MAAM,aAAa,GAAG,iBAAiB,CAAC;AACxC,MAAM,qBAAqB,GAAG,sBAAsB,CAAC;AAErD,kFAAkF;AAClF,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;AAE9C,kFAAkF;AAClF,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AA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