managed-deepagents 0.5.0-dev.78 → 0.5.0-dev.80
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 +50 -8
- package/dist/channels/assistant-text.js +1 -1
- package/dist/channels/assistant-text.js.map +1 -1
- package/dist/channels/binding.d.ts.map +1 -1
- package/dist/channels/binding.js +3 -1
- package/dist/channels/binding.js.map +1 -1
- package/dist/channels/index.d.ts +6 -8
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +5 -5
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/manifest.d.ts +36 -3
- package/dist/channels/manifest.d.ts.map +1 -1
- package/dist/channels/messaging-registry.d.ts +17 -0
- package/dist/channels/messaging-registry.d.ts.map +1 -0
- package/dist/channels/messaging-registry.js +44 -0
- package/dist/channels/messaging-registry.js.map +1 -0
- package/dist/channels/registry.d.ts +4 -3
- package/dist/channels/registry.d.ts.map +1 -1
- package/dist/channels/registry.js +6 -5
- package/dist/channels/registry.js.map +1 -1
- package/dist/channels/schedule-delivery.d.ts +4 -1
- package/dist/channels/schedule-delivery.d.ts.map +1 -1
- package/dist/channels/schedule-delivery.js +4 -2
- package/dist/channels/schedule-delivery.js.map +1 -1
- package/dist/connectors/github/adapter-core.d.ts +15 -0
- package/dist/connectors/github/adapter-core.d.ts.map +1 -0
- package/dist/connectors/github/adapter-core.js +52 -0
- package/dist/connectors/github/adapter-core.js.map +1 -0
- package/dist/{channels → connectors}/github/define.d.ts +28 -58
- package/dist/connectors/github/define.d.ts.map +1 -0
- package/dist/connectors/github/define.js +72 -0
- package/dist/connectors/github/define.js.map +1 -0
- package/dist/{channels → connectors}/github/http.d.ts +4 -4
- package/dist/connectors/github/http.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/http.js +13 -24
- package/dist/connectors/github/http.js.map +1 -0
- package/dist/connectors/github/index.d.ts +59 -16
- package/dist/connectors/github/index.d.ts.map +1 -1
- package/dist/connectors/github/index.js +159 -73
- package/dist/connectors/github/index.js.map +1 -1
- package/dist/connectors/github/match.d.ts +20 -0
- package/dist/connectors/github/match.d.ts.map +1 -0
- package/dist/connectors/github/match.js +41 -0
- package/dist/connectors/github/match.js.map +1 -0
- package/dist/{channels → connectors}/github/normalize.d.ts +1 -1
- package/dist/connectors/github/normalize.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/normalize.js +2 -2
- package/dist/connectors/github/normalize.js.map +1 -0
- package/dist/connectors/github/sandbox.d.ts.map +1 -1
- package/dist/connectors/github/sandbox.js +30 -23
- package/dist/connectors/github/sandbox.js.map +1 -1
- package/dist/connectors/github/source-thread.d.ts.map +1 -0
- package/dist/connectors/github/source-thread.js.map +1 -0
- package/dist/{channels → connectors}/github/transport.d.ts +7 -1
- package/dist/connectors/github/transport.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/transport.js +18 -4
- package/dist/connectors/github/transport.js.map +1 -0
- package/dist/connectors/langsmith/index.d.ts +29 -17
- package/dist/connectors/langsmith/index.d.ts.map +1 -1
- package/dist/connectors/langsmith/index.js +34 -29
- package/dist/connectors/langsmith/index.js.map +1 -1
- package/dist/connectors/langsmith/routes.d.ts +4 -15
- package/dist/connectors/langsmith/routes.d.ts.map +1 -1
- package/dist/connectors/langsmith/routes.js +63 -72
- package/dist/connectors/langsmith/routes.js.map +1 -1
- package/dist/connectors/mcp/index.d.ts +13 -20
- package/dist/connectors/mcp/index.d.ts.map +1 -1
- package/dist/connectors/mcp/index.js +92 -112
- package/dist/connectors/mcp/index.js.map +1 -1
- package/dist/connectors/mcp/load.d.ts.map +1 -1
- package/dist/connectors/mcp/load.js +16 -40
- package/dist/connectors/mcp/load.js.map +1 -1
- package/dist/{channels → connectors}/slack/adapter-core.d.ts +1 -1
- package/dist/connectors/slack/adapter-core.d.ts.map +1 -0
- package/dist/connectors/slack/adapter-core.js.map +1 -0
- package/dist/{channels → connectors}/slack/adapter.d.ts +3 -4
- package/dist/connectors/slack/adapter.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/adapter.js +1 -1
- package/dist/connectors/slack/adapter.js.map +1 -0
- package/dist/{channels → connectors}/slack/http.d.ts +6 -40
- package/dist/connectors/slack/http.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/http.js +22 -125
- package/dist/connectors/slack/http.js.map +1 -0
- package/dist/connectors/slack/index.d.ts +108 -0
- package/dist/connectors/slack/index.d.ts.map +1 -0
- package/dist/connectors/slack/index.js +191 -0
- package/dist/connectors/slack/index.js.map +1 -0
- package/dist/{channels → connectors}/slack/normalize.d.ts +5 -5
- package/dist/connectors/slack/normalize.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/normalize.js +21 -20
- package/dist/connectors/slack/normalize.js.map +1 -0
- package/dist/connectors/slack/source-thread.d.ts.map +1 -0
- package/dist/connectors/slack/source-thread.js.map +1 -0
- package/dist/{channels → connectors}/slack/transport.d.ts +1 -1
- package/dist/connectors/slack/transport.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/transport.js +4 -3
- package/dist/connectors/slack/transport.js.map +1 -0
- package/dist/connectors/tool-selection.d.ts +31 -0
- package/dist/connectors/tool-selection.d.ts.map +1 -0
- package/dist/connectors/tool-selection.js +54 -0
- package/dist/connectors/tool-selection.js.map +1 -0
- package/dist/connectors/toolserver/catalog.d.ts +134 -0
- package/dist/connectors/toolserver/catalog.d.ts.map +1 -0
- package/dist/connectors/toolserver/catalog.js +74 -0
- package/dist/connectors/toolserver/catalog.js.map +1 -0
- package/dist/connectors/toolserver/index.d.ts +119 -0
- package/dist/connectors/toolserver/index.d.ts.map +1 -0
- package/dist/connectors/toolserver/index.js +150 -0
- package/dist/connectors/toolserver/index.js.map +1 -0
- package/dist/connectors/toolserver/load.d.ts +55 -0
- package/dist/connectors/toolserver/load.d.ts.map +1 -0
- package/dist/connectors/toolserver/load.js +162 -0
- package/dist/connectors/toolserver/load.js.map +1 -0
- package/dist/extension.d.ts +77 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +127 -0
- package/dist/extension.js.map +1 -0
- package/dist/identity/claims.d.ts +18 -0
- package/dist/identity/claims.d.ts.map +1 -0
- package/dist/identity/claims.js +37 -0
- package/dist/identity/claims.js.map +1 -0
- package/dist/identity/connect-inference.d.ts +28 -0
- package/dist/identity/connect-inference.d.ts.map +1 -0
- package/dist/identity/connect-inference.js +39 -0
- package/dist/identity/connect-inference.js.map +1 -0
- package/dist/identity/connect-provider-types.d.ts +23 -6
- package/dist/identity/connect-provider-types.d.ts.map +1 -1
- package/dist/identity/connect-provider-types.js +3 -1
- package/dist/identity/connect-provider-types.js.map +1 -1
- package/dist/identity/connect-provider.d.ts +9 -4
- package/dist/identity/connect-provider.d.ts.map +1 -1
- package/dist/identity/connect-provider.js +19 -9
- package/dist/identity/connect-provider.js.map +1 -1
- package/dist/identity/credential-resolvers.d.ts +33 -0
- package/dist/identity/credential-resolvers.d.ts.map +1 -0
- package/dist/identity/credential-resolvers.js +62 -0
- package/dist/identity/credential-resolvers.js.map +1 -0
- package/dist/identity/github/connect-http.d.ts +3 -3
- package/dist/identity/github/connect-http.d.ts.map +1 -1
- package/dist/identity/github/connect-http.js +21 -13
- package/dist/identity/github/connect-http.js.map +1 -1
- package/dist/identity/github/credentials-store.d.ts +10 -10
- package/dist/identity/github/credentials-store.d.ts.map +1 -1
- package/dist/identity/github/credentials-store.js +40 -43
- package/dist/identity/github/credentials-store.js.map +1 -1
- package/dist/identity/github/credentials.d.ts +16 -13
- package/dist/identity/github/credentials.d.ts.map +1 -1
- package/dist/identity/github/credentials.js +43 -23
- package/dist/identity/github/credentials.js.map +1 -1
- package/dist/identity/github/index.d.ts +2 -3
- package/dist/identity/github/index.d.ts.map +1 -1
- package/dist/identity/github/index.js +1 -2
- package/dist/identity/github/index.js.map +1 -1
- package/dist/identity/github/oauth.d.ts +3 -3
- package/dist/identity/github/oauth.d.ts.map +1 -1
- package/dist/identity/github/oauth.js +10 -9
- package/dist/identity/github/oauth.js.map +1 -1
- package/dist/identity/index.d.ts +35 -29
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +98 -131
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/loopback.d.ts +27 -2
- package/dist/identity/loopback.d.ts.map +1 -1
- package/dist/identity/loopback.js +61 -8
- package/dist/identity/loopback.js.map +1 -1
- package/dist/identity/options.d.ts +90 -0
- package/dist/identity/options.d.ts.map +1 -0
- package/dist/identity/options.js +171 -0
- package/dist/identity/options.js.map +1 -0
- package/dist/identity/slack/connect-http.d.ts +3 -3
- package/dist/identity/slack/connect-http.d.ts.map +1 -1
- package/dist/identity/slack/connect-http.js +22 -14
- package/dist/identity/slack/connect-http.js.map +1 -1
- package/dist/identity/slack/index.d.ts +1 -2
- package/dist/identity/slack/index.d.ts.map +1 -1
- package/dist/identity/slack/index.js +1 -2
- package/dist/identity/slack/index.js.map +1 -1
- package/dist/identity/slack/links.d.ts +15 -15
- package/dist/identity/slack/links.d.ts.map +1 -1
- package/dist/identity/slack/links.js +50 -53
- package/dist/identity/slack/links.js.map +1 -1
- package/dist/identity/slack/oauth.d.ts +2 -2
- package/dist/identity/slack/oauth.d.ts.map +1 -1
- package/dist/identity/slack/oauth.js +9 -24
- package/dist/identity/slack/oauth.js.map +1 -1
- package/dist/identity/supabase.js +9 -9
- package/dist/identity/supabase.js.map +1 -1
- package/dist/identity/types.d.ts +82 -36
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/index.d.ts +11 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -12
- package/dist/index.js.map +1 -1
- package/dist/ingress/index.d.ts +54 -0
- package/dist/ingress/index.d.ts.map +1 -0
- package/dist/ingress/index.js +128 -0
- package/dist/ingress/index.js.map +1 -0
- package/dist/namespaces.d.ts +76 -0
- package/dist/namespaces.d.ts.map +1 -0
- package/dist/namespaces.js +94 -0
- package/dist/namespaces.js.map +1 -0
- package/dist/runtime/auth.d.ts +18 -14
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +88 -68
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/backend.d.ts +1 -1
- package/dist/runtime/backend.d.ts.map +1 -1
- package/dist/runtime/connector.d.ts +66 -23
- package/dist/runtime/connector.d.ts.map +1 -1
- package/dist/runtime/connector.js +63 -27
- package/dist/runtime/connector.js.map +1 -1
- package/dist/runtime/cors.d.ts +2 -3
- package/dist/runtime/cors.d.ts.map +1 -1
- package/dist/runtime/cors.js +2 -7
- package/dist/runtime/cors.js.map +1 -1
- package/dist/runtime/credentials.d.ts.map +1 -1
- package/dist/runtime/credentials.js +39 -14
- package/dist/runtime/credentials.js.map +1 -1
- package/dist/runtime/http.d.ts +47 -0
- package/dist/runtime/http.d.ts.map +1 -0
- package/dist/runtime/http.js +54 -0
- package/dist/runtime/http.js.map +1 -0
- package/dist/runtime/identity-http.d.ts +6 -16
- package/dist/runtime/identity-http.d.ts.map +1 -1
- package/dist/runtime/identity-http.js +71 -54
- package/dist/runtime/identity-http.js.map +1 -1
- package/dist/runtime/identity-runtime.d.ts +18 -17
- package/dist/runtime/identity-runtime.d.ts.map +1 -1
- package/dist/runtime/identity-runtime.js +55 -39
- package/dist/runtime/identity-runtime.js.map +1 -1
- package/dist/runtime/index.d.ts +77 -104
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +36 -35
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/memory/index.d.ts +1 -0
- package/dist/runtime/memory/index.d.ts.map +1 -1
- package/dist/runtime/memory/index.js +1 -0
- package/dist/runtime/memory/index.js.map +1 -1
- package/dist/runtime/memory/lazy-context-backend.d.ts +66 -0
- package/dist/runtime/memory/lazy-context-backend.d.ts.map +1 -0
- package/dist/runtime/memory/lazy-context-backend.js +154 -0
- package/dist/runtime/memory/lazy-context-backend.js.map +1 -0
- package/dist/runtime/memory/user-repo.js +3 -3
- package/dist/runtime/memory/user-repo.js.map +1 -1
- package/dist/runtime/sandbox-manager.d.ts +33 -0
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js +173 -9
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/sandbox-stream-retry.d.ts +16 -0
- package/dist/runtime/sandbox-stream-retry.d.ts.map +1 -0
- package/dist/runtime/sandbox-stream-retry.js +61 -0
- package/dist/runtime/sandbox-stream-retry.js.map +1 -0
- package/dist/runtime/setup-script.d.ts.map +1 -1
- package/dist/runtime/setup-script.js +4 -2
- package/dist/runtime/setup-script.js.map +1 -1
- package/dist/runtime/validated-token.d.ts +1 -1
- package/dist/runtime/validated-token.d.ts.map +1 -1
- package/dist/runtime/validated-token.js +75 -33
- package/dist/runtime/validated-token.js.map +1 -1
- package/dist/sandbox.d.ts +19 -22
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +20 -34
- package/dist/sandbox.js.map +1 -1
- package/dist/schedules.js +8 -9
- package/dist/schedules.js.map +1 -1
- package/package.json +18 -28
- package/dist/channels/collect.d.ts +0 -26
- package/dist/channels/collect.d.ts.map +0 -1
- package/dist/channels/collect.js +0 -42
- package/dist/channels/collect.js.map +0 -1
- package/dist/channels/github/adapter-core.d.ts +0 -6
- package/dist/channels/github/adapter-core.d.ts.map +0 -1
- package/dist/channels/github/adapter-core.js +0 -27
- package/dist/channels/github/adapter-core.js.map +0 -1
- package/dist/channels/github/adapter.d.ts +0 -16
- package/dist/channels/github/adapter.d.ts.map +0 -1
- package/dist/channels/github/adapter.js +0 -52
- package/dist/channels/github/adapter.js.map +0 -1
- package/dist/channels/github/define.d.ts.map +0 -1
- package/dist/channels/github/define.js +0 -166
- package/dist/channels/github/define.js.map +0 -1
- package/dist/channels/github/http.d.ts.map +0 -1
- package/dist/channels/github/http.js.map +0 -1
- package/dist/channels/github/index.d.ts +0 -12
- package/dist/channels/github/index.d.ts.map +0 -1
- package/dist/channels/github/index.js +0 -10
- package/dist/channels/github/index.js.map +0 -1
- package/dist/channels/github/normalize.d.ts.map +0 -1
- package/dist/channels/github/normalize.js.map +0 -1
- package/dist/channels/github/source-thread.d.ts.map +0 -1
- package/dist/channels/github/source-thread.js.map +0 -1
- package/dist/channels/github/transport.d.ts.map +0 -1
- package/dist/channels/github/transport.js.map +0 -1
- package/dist/channels/plugin.d.ts +0 -61
- package/dist/channels/plugin.d.ts.map +0 -1
- package/dist/channels/plugin.js +0 -80
- package/dist/channels/plugin.js.map +0 -1
- package/dist/channels/slack/adapter-core.d.ts.map +0 -1
- package/dist/channels/slack/adapter-core.js.map +0 -1
- package/dist/channels/slack/adapter.d.ts.map +0 -1
- package/dist/channels/slack/adapter.js.map +0 -1
- package/dist/channels/slack/define.d.ts +0 -74
- package/dist/channels/slack/define.d.ts.map +0 -1
- package/dist/channels/slack/define.js +0 -160
- package/dist/channels/slack/define.js.map +0 -1
- package/dist/channels/slack/http.d.ts.map +0 -1
- package/dist/channels/slack/http.js.map +0 -1
- package/dist/channels/slack/index.d.ts +0 -18
- package/dist/channels/slack/index.d.ts.map +0 -1
- package/dist/channels/slack/index.js +0 -13
- package/dist/channels/slack/index.js.map +0 -1
- package/dist/channels/slack/normalize.d.ts.map +0 -1
- package/dist/channels/slack/normalize.js.map +0 -1
- package/dist/channels/slack/source-thread.d.ts.map +0 -1
- package/dist/channels/slack/source-thread.js.map +0 -1
- package/dist/channels/slack/transport.d.ts.map +0 -1
- package/dist/channels/slack/transport.js.map +0 -1
- /package/dist/{channels → connectors}/github/source-thread.d.ts +0 -0
- /package/dist/{channels → connectors}/github/source-thread.js +0 -0
- /package/dist/{channels → connectors}/slack/adapter-core.js +0 -0
- /package/dist/{channels → connectors}/slack/source-thread.d.ts +0 -0
- /package/dist/{channels → connectors}/slack/source-thread.js +0 -0
|
@@ -1,8 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolve the local Agent Server URL for trusted loopback clients.
|
|
3
3
|
*
|
|
4
|
-
* Prefers `explicit`, then `MDA_CHANNEL_API_URL` / `LANGGRAPH_API_URL
|
|
5
|
-
* `
|
|
4
|
+
* Prefers `explicit`, then `MDA_CHANNEL_API_URL` / `LANGGRAPH_API_URL`, else
|
|
5
|
+
* `http://127.0.0.1:{PORT|8000}`. `LANGSMITH_ENDPOINT` is deliberately not
|
|
6
|
+
* consulted: it is the tracing/API endpoint (LangSmith SaaS by default), not
|
|
7
|
+
* this server's origin.
|
|
6
8
|
*/
|
|
7
9
|
export declare function resolveLoopbackApiUrl(explicit?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* API key for trusted loopback LangGraph SDK clients.
|
|
12
|
+
*
|
|
13
|
+
* Prefers `explicit`, then `LANGSMITH_API_KEY`, else `"local"` (in-process /
|
|
14
|
+
* unit-test clients that do not authenticate against Host).
|
|
15
|
+
*/
|
|
16
|
+
export declare function resolveLoopbackApiKey(explicit?: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether `value` addresses this host.
|
|
19
|
+
*
|
|
20
|
+
* Server-local trust (the ingress secret, which lets its holder assert any
|
|
21
|
+
* actor id) must never travel to an off-host origin, so callers gate it on
|
|
22
|
+
* this predicate.
|
|
23
|
+
*
|
|
24
|
+
* @param value - Absolute URL, or a host with an optional port.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isLoopbackUrl(value: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a `Host`-style value (optional port, optional brackets) is loopback.
|
|
29
|
+
*
|
|
30
|
+
* @param host - Host value such as `localhost:8000`, `127.0.0.1`, or `[::1]:80`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function isLoopbackHost(host: string): boolean;
|
|
8
33
|
//# sourceMappingURL=loopback.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loopback.d.ts","sourceRoot":"","sources":["../../src/identity/loopback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"loopback.d.ts","sourceRoot":"","sources":["../../src/identity/loopback.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAW/D;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOpD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAepD"}
|
|
@@ -1,18 +1,71 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Resolve the local Agent Server URL for trusted loopback clients.
|
|
3
3
|
*
|
|
4
|
-
* Prefers `explicit`, then `MDA_CHANNEL_API_URL` / `LANGGRAPH_API_URL
|
|
5
|
-
* `
|
|
4
|
+
* Prefers `explicit`, then `MDA_CHANNEL_API_URL` / `LANGGRAPH_API_URL`, else
|
|
5
|
+
* `http://127.0.0.1:{PORT|8000}`. `LANGSMITH_ENDPOINT` is deliberately not
|
|
6
|
+
* consulted: it is the tracing/API endpoint (LangSmith SaaS by default), not
|
|
7
|
+
* this server's origin.
|
|
6
8
|
*/
|
|
7
9
|
export function resolveLoopbackApiUrl(explicit) {
|
|
8
|
-
const fromEnv =
|
|
9
|
-
|
|
10
|
-
process.env.
|
|
11
|
-
process.env.
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const fromEnv = [
|
|
11
|
+
explicit,
|
|
12
|
+
process.env.MDA_CHANNEL_API_URL,
|
|
13
|
+
process.env.LANGGRAPH_API_URL,
|
|
14
|
+
].find((value) => value && value.trim().length > 0);
|
|
15
|
+
if (fromEnv) {
|
|
16
|
+
return fromEnv.trim().replace(/\/$/, "");
|
|
14
17
|
}
|
|
15
18
|
const port = process.env.PORT ?? "8000";
|
|
16
19
|
return `http://127.0.0.1:${port}`;
|
|
17
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* API key for trusted loopback LangGraph SDK clients.
|
|
23
|
+
*
|
|
24
|
+
* Prefers `explicit`, then `LANGSMITH_API_KEY`, else `"local"` (in-process /
|
|
25
|
+
* unit-test clients that do not authenticate against Host).
|
|
26
|
+
*/
|
|
27
|
+
export function resolveLoopbackApiKey(explicit) {
|
|
28
|
+
const key = (explicit ?? process.env.LANGSMITH_API_KEY)?.trim();
|
|
29
|
+
return key && key.length > 0 ? key : "local";
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Whether `value` addresses this host.
|
|
33
|
+
*
|
|
34
|
+
* Server-local trust (the ingress secret, which lets its holder assert any
|
|
35
|
+
* actor id) must never travel to an off-host origin, so callers gate it on
|
|
36
|
+
* this predicate.
|
|
37
|
+
*
|
|
38
|
+
* @param value - Absolute URL, or a host with an optional port.
|
|
39
|
+
*/
|
|
40
|
+
export function isLoopbackUrl(value) {
|
|
41
|
+
try {
|
|
42
|
+
const url = new URL(value.includes("://") ? value : `http://${value}`);
|
|
43
|
+
return isLoopbackHost(url.hostname);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether a `Host`-style value (optional port, optional brackets) is loopback.
|
|
51
|
+
*
|
|
52
|
+
* @param host - Host value such as `localhost:8000`, `127.0.0.1`, or `[::1]:80`.
|
|
53
|
+
*/
|
|
54
|
+
export function isLoopbackHost(host) {
|
|
55
|
+
let hostname = host.trim().toLowerCase();
|
|
56
|
+
const bracketed = /^\[(?<inner>[^\]]+)\](?::\d+)?$/.exec(hostname);
|
|
57
|
+
if (bracketed?.groups) {
|
|
58
|
+
hostname = bracketed.groups.inner;
|
|
59
|
+
}
|
|
60
|
+
else if ((hostname.match(/:/g) ?? []).length === 1) {
|
|
61
|
+
hostname = hostname.split(":")[0];
|
|
62
|
+
}
|
|
63
|
+
if (hostname === "localhost") {
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
if (/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(hostname)) {
|
|
67
|
+
return hostname.split(".").every((part) => Number(part) <= 255);
|
|
68
|
+
}
|
|
69
|
+
return hostname === "::1" || hostname === "0:0:0:0:0:0:0:1";
|
|
70
|
+
}
|
|
18
71
|
//# sourceMappingURL=loopback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loopback.js","sourceRoot":"","sources":["../../src/identity/loopback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"loopback.js","sourceRoot":"","sources":["../../src/identity/loopback.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAiB;IACrD,MAAM,OAAO,GAAG;QACd,QAAQ;QACR,OAAO,CAAC,GAAG,CAAC,mBAAmB;QAC/B,OAAO,CAAC,GAAG,CAAC,iBAAiB;KAC9B,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,CAAC;IACxC,OAAO,oBAAoB,IAAI,EAAE,CAAC;AACpC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAAiB;IACrD,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,EAAE,IAAI,EAAE,CAAC;IAChE,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC;AAC/C,CAAC;A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
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `defineIdentity(...)` input, and its normalization into the resolved
|
|
3
|
+
* {@link IdentityConfig}.
|
|
4
|
+
*
|
|
5
|
+
* Authors describe *what they want* — how callers authenticate, and what the
|
|
6
|
+
* isolation boundary is — in two keys. Everything else the runtime needs is
|
|
7
|
+
* derived here, so the resolved contract stays free to grow axes without the
|
|
8
|
+
* authoring surface growing a knob per axis.
|
|
9
|
+
*
|
|
10
|
+
* See `docs/design/identity-model-review.md` for the rationale.
|
|
11
|
+
*/
|
|
12
|
+
import type { IdentityConnectProvider } from "./connect-provider-types.js";
|
|
13
|
+
import type { CredentialResolverConfig, CredentialResolvers, CredentialScope, IdentityConfig, MemoryScope, OrganizationRequirement, ThreadScope, ValidatedTokenProvider } from "./types.js";
|
|
14
|
+
/**
|
|
15
|
+
* How MDA learns who is calling.
|
|
16
|
+
*
|
|
17
|
+
* - `"backend"` — a backend you operate has already authenticated the caller and
|
|
18
|
+
* asserts the user id over the reserved ingress headers.
|
|
19
|
+
* - one or more `providers.*` entries — MDA verifies the caller's own token
|
|
20
|
+
* server-side (browser-direct).
|
|
21
|
+
*/
|
|
22
|
+
export type IdentityAuth = "backend" | ValidatedTokenProvider | ValidatedTokenProvider[];
|
|
23
|
+
/**
|
|
24
|
+
* The isolation boundary for the deployment — the one decision most projects
|
|
25
|
+
* make about identity.
|
|
26
|
+
*
|
|
27
|
+
* - `"user"` (default) — every caller gets private threads, private memory, and
|
|
28
|
+
* acts as themselves downstream.
|
|
29
|
+
* - `"organization"` — callers belong to customer organizations; memory is
|
|
30
|
+
* shared within an organization and callers must present one.
|
|
31
|
+
* - `"agent"` — no per-caller isolation; one shared memory slice, the agent acts
|
|
32
|
+
* as itself. Machine-to-machine deployments.
|
|
33
|
+
* - `"none"` — no durable memory and no downstream credentials.
|
|
34
|
+
*/
|
|
35
|
+
export type IdentityScope = "user" | "organization" | "agent" | "none";
|
|
36
|
+
/**
|
|
37
|
+
* Per-axis overrides for authors whose deployment does not fit a single
|
|
38
|
+
* {@link IdentityScope}. Anything left unset follows `default`.
|
|
39
|
+
*/
|
|
40
|
+
export interface IdentityScopeOverrides {
|
|
41
|
+
/** Base scope the unset axes follow. Defaults to `"user"`. */
|
|
42
|
+
default?: IdentityScope;
|
|
43
|
+
/** Who can open or resume a conversation. */
|
|
44
|
+
threads?: ThreadScope;
|
|
45
|
+
/** Which memory slice a run may use. */
|
|
46
|
+
memory?: MemoryScope;
|
|
47
|
+
/** Whose credentials downstream calls carry. `"custom"` is implied by `credentials`. */
|
|
48
|
+
credentials?: CredentialScope;
|
|
49
|
+
}
|
|
50
|
+
/** The identity declaration. Every key is optional. */
|
|
51
|
+
export interface IdentityOptions {
|
|
52
|
+
/** How callers authenticate. Defaults to `"backend"`. */
|
|
53
|
+
auth?: IdentityAuth;
|
|
54
|
+
/** The isolation boundary, or per-axis overrides. Defaults to `"user"`. */
|
|
55
|
+
scope?: IdentityScope | IdentityScopeOverrides;
|
|
56
|
+
/** Whether callers must present an organization. Inferred from `scope`. */
|
|
57
|
+
organizations?: OrganizationRequirement;
|
|
58
|
+
/**
|
|
59
|
+
* Mint your own downstream credentials per caller. Providing this puts the
|
|
60
|
+
* credentials axis in custom mode — there is no separate flag to set.
|
|
61
|
+
*
|
|
62
|
+
* Pass one resolver, or a map keyed by target name when the agent integrates
|
|
63
|
+
* several platforms:
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* credentials: {
|
|
67
|
+
* github: credentials.github({ read: ["user", "pat"] }),
|
|
68
|
+
* jira: { resolve: mintJiraToken },
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
credentials?: CredentialResolverConfig | CredentialResolvers;
|
|
73
|
+
/**
|
|
74
|
+
* Extra Connect-with-X providers to mount under `/identity/{id}/…`.
|
|
75
|
+
*
|
|
76
|
+
* Providers the deployment already implies are added automatically (a
|
|
77
|
+
* `credentials.github(...)` chain that reads user tokens brings
|
|
78
|
+
* Connect-with-GitHub with it), so this is only needed for custom providers.
|
|
79
|
+
*/
|
|
80
|
+
connect?: IdentityConnectProvider[];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Derive the resolved {@link IdentityConfig} from the declared options.
|
|
84
|
+
*
|
|
85
|
+
* Pure and total: every reachable option combination produces a config that
|
|
86
|
+
* `validateIdentity` accepts, so the errors that exist only to police two
|
|
87
|
+
* fields agreeing with each other are unreachable from this path.
|
|
88
|
+
*/
|
|
89
|
+
export declare function normalizeIdentity(options?: IdentityOptions): IdentityConfig;
|
|
90
|
+
//# sourceMappingURL=options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/identity/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAE3E,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,WAAW,EACX,uBAAuB,EACvB,WAAW,EACX,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAEpB;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,sBAAsB,GACtB,sBAAsB,EAAE,CAAC;AAE7B;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAEvE;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,8DAA8D;IAC9D,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,6CAA6C;IAC7C,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,wCAAwC;IACxC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,wFAAwF;IACxF,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,yDAAyD;IACzD,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,aAAa,GAAG,sBAAsB,CAAC;IAC/C,2EAA2E;IAC3E,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC;;;;;;;;;;;;;OAaG;IACH,WAAW,CAAC,EAAE,wBAAwB,GAAG,mBAAmB,CAAC;IAC7D;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,uBAAuB,EAAE,CAAC;CACrC;AAgCD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,eAAoB,GAC5B,cAAc,CAsBhB"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `defineIdentity(...)` input, and its normalization into the resolved
|
|
3
|
+
* {@link IdentityConfig}.
|
|
4
|
+
*
|
|
5
|
+
* Authors describe *what they want* — how callers authenticate, and what the
|
|
6
|
+
* isolation boundary is — in two keys. Everything else the runtime needs is
|
|
7
|
+
* derived here, so the resolved contract stays free to grow axes without the
|
|
8
|
+
* authoring surface growing a knob per axis.
|
|
9
|
+
*
|
|
10
|
+
* See `docs/design/identity-model-review.md` for the rationale.
|
|
11
|
+
*/
|
|
12
|
+
import { credentialConnectProviders } from "./credential-resolvers.js";
|
|
13
|
+
/** Axis defaults per {@link IdentityScope}. */
|
|
14
|
+
const SCOPE_AXES = {
|
|
15
|
+
user: { threads: "user", memory: "user", credentials: "user" },
|
|
16
|
+
organization: {
|
|
17
|
+
threads: "user",
|
|
18
|
+
memory: "organization",
|
|
19
|
+
credentials: "agent",
|
|
20
|
+
},
|
|
21
|
+
agent: { threads: "user", memory: "agent", credentials: "agent" },
|
|
22
|
+
none: { threads: "user", memory: "none", credentials: "none" },
|
|
23
|
+
};
|
|
24
|
+
const THREAD_SCOPES = [
|
|
25
|
+
"user",
|
|
26
|
+
"conversation",
|
|
27
|
+
"organization",
|
|
28
|
+
];
|
|
29
|
+
const MEMORY_SCOPES = [
|
|
30
|
+
"user",
|
|
31
|
+
"organization",
|
|
32
|
+
"agent",
|
|
33
|
+
"none",
|
|
34
|
+
];
|
|
35
|
+
const CREDENTIAL_SCOPES = [
|
|
36
|
+
"user",
|
|
37
|
+
"agent",
|
|
38
|
+
"none",
|
|
39
|
+
"custom",
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* Derive the resolved {@link IdentityConfig} from the declared options.
|
|
43
|
+
*
|
|
44
|
+
* Pure and total: every reachable option combination produces a config that
|
|
45
|
+
* `validateIdentity` accepts, so the errors that exist only to police two
|
|
46
|
+
* fields agreeing with each other are unreachable from this path.
|
|
47
|
+
*/
|
|
48
|
+
export function normalizeIdentity(options = {}) {
|
|
49
|
+
assertOptionKeys(options);
|
|
50
|
+
const scope = resolveScope(options);
|
|
51
|
+
const organizations = options.organizations ?? inferOrganizationRequirement(scope);
|
|
52
|
+
assertOrganizationRequirement(options.organizations, scope, organizations);
|
|
53
|
+
const config = {
|
|
54
|
+
ingress: { http: resolveIngress(options.auth) },
|
|
55
|
+
organizations,
|
|
56
|
+
scope,
|
|
57
|
+
};
|
|
58
|
+
if (options.credentials !== undefined) {
|
|
59
|
+
config.credentials = options.credentials;
|
|
60
|
+
}
|
|
61
|
+
const connect = resolveConnect(options);
|
|
62
|
+
if (connect.length > 0) {
|
|
63
|
+
config.connect = connect;
|
|
64
|
+
}
|
|
65
|
+
return config;
|
|
66
|
+
}
|
|
67
|
+
function resolveIngress(auth) {
|
|
68
|
+
if (auth === undefined || auth === "backend") {
|
|
69
|
+
return "backend";
|
|
70
|
+
}
|
|
71
|
+
if (typeof auth === "string") {
|
|
72
|
+
throw new Error(`defineIdentity(...) unknown \`auth\` value "${auth}". Use "backend" or one or more providers.* entries.`);
|
|
73
|
+
}
|
|
74
|
+
const providers = Array.isArray(auth) ? auth : [auth];
|
|
75
|
+
return { mode: "validated_token", providers };
|
|
76
|
+
}
|
|
77
|
+
function resolveScope(options) {
|
|
78
|
+
const scope = options.scope ?? "user";
|
|
79
|
+
const overrides = typeof scope === "string" ? { default: scope } : scope;
|
|
80
|
+
const base = SCOPE_AXES[overrides.default ?? "user"];
|
|
81
|
+
if (base === undefined) {
|
|
82
|
+
throw new Error(`defineIdentity(...) unknown \`scope\` "${String(overrides.default)}". ` +
|
|
83
|
+
`Valid scopes: ${Object.keys(SCOPE_AXES).join(", ")}.`);
|
|
84
|
+
}
|
|
85
|
+
const threads = assertAxis("threads", overrides.threads, THREAD_SCOPES) ?? base.threads;
|
|
86
|
+
const memory = assertAxis("memory", overrides.memory, MEMORY_SCOPES) ?? base.memory;
|
|
87
|
+
// A resolver is the declaration of custom mode; the axis follows from it.
|
|
88
|
+
const credentials = options.credentials !== undefined
|
|
89
|
+
? requireCustomCompatible(overrides.credentials)
|
|
90
|
+
: (assertAxis("credentials", overrides.credentials, CREDENTIAL_SCOPES) ??
|
|
91
|
+
base.credentials);
|
|
92
|
+
return { threads, memory, credentials };
|
|
93
|
+
}
|
|
94
|
+
function assertAxis(axis, value, allowed) {
|
|
95
|
+
if (value === undefined) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
if (!allowed.includes(value)) {
|
|
99
|
+
throw new Error(`defineIdentity(...) unknown \`scope.${axis}\` value "${String(value)}". ` +
|
|
100
|
+
`Valid values: ${allowed.join(", ")}.`);
|
|
101
|
+
}
|
|
102
|
+
return value;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* A resolver plus an explicitly managed credentials owner is a genuine conflict
|
|
106
|
+
* of intent (unlike a redundant `"custom"` sentinel), so it fails.
|
|
107
|
+
*/
|
|
108
|
+
function requireCustomCompatible(declared) {
|
|
109
|
+
if (declared !== undefined && declared !== "custom") {
|
|
110
|
+
throw new Error(`defineIdentity(...) provides a \`credentials\` resolver but \`scope.credentials\` is "${declared}". ` +
|
|
111
|
+
"Drop `scope.credentials` (the resolver implies custom mode) or remove the resolver.");
|
|
112
|
+
}
|
|
113
|
+
return "custom";
|
|
114
|
+
}
|
|
115
|
+
/** Organization-scoped axes are what make an organization mandatory. */
|
|
116
|
+
function inferOrganizationRequirement(scope) {
|
|
117
|
+
const axes = [scope.threads, scope.memory, scope.credentials];
|
|
118
|
+
return axes.includes("organization") ? "required" : "optional";
|
|
119
|
+
}
|
|
120
|
+
function assertOrganizationRequirement(declared, scope, resolved) {
|
|
121
|
+
if (declared !== undefined &&
|
|
122
|
+
declared !== "optional" &&
|
|
123
|
+
declared !== "required") {
|
|
124
|
+
throw new Error(`defineIdentity(...) \`organizations\` must be "optional" or "required" (received "${String(declared)}").`);
|
|
125
|
+
}
|
|
126
|
+
if (resolved === "optional" &&
|
|
127
|
+
inferOrganizationRequirement(scope) === "required") {
|
|
128
|
+
throw new Error('defineIdentity(...) organization-scoped isolation requires `organizations: "required"`.');
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Connect providers the deployment declared, plus the ones its credential
|
|
133
|
+
* resolvers depend on. A resolver that reads per-user OAuth tokens needs a place
|
|
134
|
+
* for the user to grant them, so the routes follow from the resolver rather than
|
|
135
|
+
* from a second opt-in that has to agree with it.
|
|
136
|
+
*
|
|
137
|
+
* For a per-target map this unions across every entry, so a multi-platform
|
|
138
|
+
* deployment gets each platform's routes without repeating any of them.
|
|
139
|
+
*/
|
|
140
|
+
function resolveConnect(options) {
|
|
141
|
+
const declared = options.connect ?? [];
|
|
142
|
+
const required = credentialConnectProviders(options.credentials);
|
|
143
|
+
const out = [...declared];
|
|
144
|
+
for (const provider of required) {
|
|
145
|
+
if (!out.some((existing) => existing.id === provider.id)) {
|
|
146
|
+
out.push(provider);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
const KNOWN_OPTION_KEYS = new Set([
|
|
152
|
+
"auth",
|
|
153
|
+
"scope",
|
|
154
|
+
"organizations",
|
|
155
|
+
"credentials",
|
|
156
|
+
"connect",
|
|
157
|
+
]);
|
|
158
|
+
/**
|
|
159
|
+
* Reject unknown keys so a typo fails loudly instead of being silently ignored.
|
|
160
|
+
*/
|
|
161
|
+
function assertOptionKeys(options) {
|
|
162
|
+
if (options === null || typeof options !== "object") {
|
|
163
|
+
throw new Error("defineIdentity(...) accepts an options object ({ auth, scope, … }) or no arguments.");
|
|
164
|
+
}
|
|
165
|
+
const unknown = Object.keys(options).filter((key) => !KNOWN_OPTION_KEYS.has(key));
|
|
166
|
+
if (unknown.length > 0) {
|
|
167
|
+
throw new Error(`defineIdentity(...) unknown option(s): ${unknown.join(", ")}. ` +
|
|
168
|
+
`Valid options: ${[...KNOWN_OPTION_KEYS].join(", ")}.`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/identity/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAuFvE,+CAA+C;AAC/C,MAAM,UAAU,GAAmD;IACjE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAC9D,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM;QACf,MAAM,EAAE,cAAc;QACtB,WAAW,EAAE,OAAO;KACrB;IACD,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE;IACjE,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;CAC/D,CAAC;AAEF,MAAM,aAAa,GAA2B;IAC5C,MAAM;IACN,cAAc;IACd,cAAc;CACf,CAAC;AACF,MAAM,aAAa,GAA2B;IAC5C,MAAM;IACN,cAAc;IACd,OAAO;IACP,MAAM;CACP,CAAC;AAC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;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -22,10 +22,10 @@ export declare const slackIdentityConnectProvider: IdentityConnectProvider;
|
|
|
22
22
|
*
|
|
23
23
|
* @example
|
|
24
24
|
* ```ts
|
|
25
|
-
* import {
|
|
25
|
+
* import { connect, defineIdentity } from "managed-deepagents";
|
|
26
26
|
*
|
|
27
|
-
* export const identity = defineIdentity
|
|
28
|
-
* connect: [slack
|
|
27
|
+
* export const identity = defineIdentity({
|
|
28
|
+
* connect: [connect.slack()],
|
|
29
29
|
* });
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-http.d.ts","sourceRoot":"","sources":["../../../src/identity/slack/connect-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAKV,uBAAuB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-http.d.ts","sourceRoot":"","sources":["../../../src/identity/slack/connect-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAKV,uBAAuB,EAExB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAoBpB,eAAO,MAAM,yBAAyB,QAAe,CAAC;AACtD,eAAO,MAAM,wBAAwB,QAAgB,CAAC;AACtD,eAAO,MAAM,2BAA2B,QAAiB,CAAC;AAC1D,eAAO,MAAM,uBAAuB,QAAa,CAAC;AAElD,8DAA8D;AAC9D,MAAM,WAAW,mCAAmC;IAClD,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED,mEAAmE;AACnE,wBAAgB,kCAAkC,CAChD,OAAO,GAAE,mCAAwC,GAChD,uBAAuB,CA6FzB;AAED,4EAA4E;AAC5E,eAAO,MAAM,4BAA4B,EAAE,uBACL,CAAC;AAEvC;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CACrB,OAAO,CAAC,EAAE,mCAAmC,GAC5C,uBAAuB,CAIzB"}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
import { buildIdentityLinkRecord, getIdentityLinkStore, } from "./links.js";
|
|
7
7
|
import { buildSlackAuthorizeUrl, createSlackOauthState, exchangeSlackOidcCode, MDA_PUBLIC_APP_URL_ENV, OAUTH_STATE_SIGNING_KEY_ENV, readOauthStateSigningKey, readSlackOidcConfig, resolveSlackOauthRedirectBase, verifySlackOauthState, } from "./oauth.js";
|
|
8
8
|
import { identityConnectPaths } from "../connect-paths.js";
|
|
9
|
+
import { hasChannelForProvider, isUserScopedDeployment, } from "../connect-inference.js";
|
|
9
10
|
const PATHS = identityConnectPaths("slack");
|
|
10
11
|
export const SLACK_CONNECT_STATUS_PATH = PATHS.status;
|
|
11
12
|
export const SLACK_CONNECT_START_PATH = PATHS.connect;
|
|
@@ -17,23 +18,30 @@ export function createSlackIdentityConnectProvider(options = {}) {
|
|
|
17
18
|
return {
|
|
18
19
|
id: "slack",
|
|
19
20
|
shouldMount(ctx) {
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
if (!ctx.hasIdentity) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
// Listed on `identity.connect` — the author already opted in. Otherwise
|
|
25
|
+
// mount only when a Slack channel routes into a per-user deployment,
|
|
26
|
+
// which is exactly when there is a Slack account worth linking.
|
|
27
|
+
return (ctx.declared !== false ||
|
|
28
|
+
(hasChannelForProvider(ctx.channels, "slack") &&
|
|
29
|
+
isUserScopedDeployment(ctx.scope)));
|
|
22
30
|
},
|
|
23
|
-
async status(
|
|
24
|
-
const link = await store().
|
|
31
|
+
async status(userId) {
|
|
32
|
+
const link = await store().getByUserId(userId);
|
|
25
33
|
return {
|
|
26
34
|
linked: Boolean(link),
|
|
27
35
|
...(link
|
|
28
36
|
? {
|
|
29
37
|
slackUserId: link.slackUserId,
|
|
30
|
-
|
|
38
|
+
slackKey: link.slackKey,
|
|
31
39
|
linkedAt: link.linkedAt,
|
|
32
40
|
}
|
|
33
41
|
: {}),
|
|
34
42
|
};
|
|
35
43
|
},
|
|
36
|
-
async startAuthorize(
|
|
44
|
+
async startAuthorize(userId, redirectUri) {
|
|
37
45
|
const oauth = readSlackOidcConfig();
|
|
38
46
|
const stateKey = readOauthStateSigningKey();
|
|
39
47
|
if (!oauth || !stateKey) {
|
|
@@ -42,7 +50,7 @@ export function createSlackIdentityConnectProvider(options = {}) {
|
|
|
42
50
|
error: `Slack connect is not configured (set SLACK_CLIENT_ID, SLACK_CLIENT_SECRET, MDA_PUBLIC_APP_URL, ${OAUTH_STATE_SIGNING_KEY_ENV})`,
|
|
43
51
|
};
|
|
44
52
|
}
|
|
45
|
-
const state = await createSlackOauthState(
|
|
53
|
+
const state = await createSlackOauthState(userId, stateKey);
|
|
46
54
|
return {
|
|
47
55
|
authorizeUrl: buildSlackAuthorizeUrl(oauth, state, redirectUri),
|
|
48
56
|
};
|
|
@@ -56,11 +64,11 @@ export function createSlackIdentityConnectProvider(options = {}) {
|
|
|
56
64
|
if (!stateKey) {
|
|
57
65
|
throw new Error(`${OAUTH_STATE_SIGNING_KEY_ENV} is not configured`);
|
|
58
66
|
}
|
|
59
|
-
const {
|
|
67
|
+
const { userId } = await verifySlackOauthState(state, stateKey);
|
|
60
68
|
const slackIdentity = await exchangeSlackOidcCode(oauth, code, redirectUri);
|
|
61
69
|
const teamId = slackIdentity.teamId ?? oauth.teamId;
|
|
62
70
|
const record = buildIdentityLinkRecord({
|
|
63
|
-
|
|
71
|
+
userId,
|
|
64
72
|
slackUserId: slackIdentity.userId,
|
|
65
73
|
...(teamId ? { slackTeamId: teamId } : {}),
|
|
66
74
|
...(slackIdentity.email ? { email: slackIdentity.email } : {}),
|
|
@@ -70,8 +78,8 @@ export function createSlackIdentityConnectProvider(options = {}) {
|
|
|
70
78
|
successRedirect: `${oauth.publicAppUrl}/settings?slack=connected`,
|
|
71
79
|
};
|
|
72
80
|
},
|
|
73
|
-
async unlink(
|
|
74
|
-
await store().
|
|
81
|
+
async unlink(userId) {
|
|
82
|
+
await store().removeByUserId(userId);
|
|
75
83
|
},
|
|
76
84
|
resolveRedirectBase(options) {
|
|
77
85
|
return resolveSlackOauthRedirectBase(options);
|
|
@@ -90,10 +98,10 @@ export const slackIdentityConnectProvider = createSlackIdentityConnectProvider()
|
|
|
90
98
|
*
|
|
91
99
|
* @example
|
|
92
100
|
* ```ts
|
|
93
|
-
* import {
|
|
101
|
+
* import { connect, defineIdentity } from "managed-deepagents";
|
|
94
102
|
*
|
|
95
|
-
* export const identity = defineIdentity
|
|
96
|
-
* connect: [slack
|
|
103
|
+
* export const identity = defineIdentity({
|
|
104
|
+
* connect: [connect.slack()],
|
|
97
105
|
* });
|
|
98
106
|
* ```
|
|
99
107
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-http.js","sourceRoot":"","sources":["../../../src/identity/slack/connect-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"connect-http.js","sourceRoot":"","sources":["../../../src/identity/slack/connect-http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,mBAAmB,EACnB,6BAA6B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ity helpers — Connect-with-Slack opt-in for `defineIdentity`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* (`defineSlackChannel`).
|
|
4
|
+
* Slack Events / messaging authoring lives on `connectors.slack`.
|
|
6
5
|
*/
|
|
7
6
|
export { connect, createSlackIdentityConnectProvider, slackIdentityConnectProvider, SLACK_CONNECT_CALLBACK_PATH, SLACK_CONNECT_LINK_PATH, SLACK_CONNECT_START_PATH, SLACK_CONNECT_STATUS_PATH, } from "./connect-http.js";
|
|
8
7
|
export type { SlackIdentityConnectProviderOptions } from "./connect-http.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/slack/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identity/slack/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,OAAO,EACP,kCAAkC,EAClC,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,mCAAmC,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Slack identity helpers — Connect-with-Slack opt-in for `defineIdentity`.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* (`defineSlackChannel`).
|
|
4
|
+
* Slack Events / messaging authoring lives on `connectors.slack`.
|
|
6
5
|
*/
|
|
7
6
|
export { connect, createSlackIdentityConnectProvider, slackIdentityConnectProvider, SLACK_CONNECT_CALLBACK_PATH, SLACK_CONNECT_LINK_PATH, SLACK_CONNECT_START_PATH, SLACK_CONNECT_STATUS_PATH, } from "./connect-http.js";
|
|
8
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity/slack/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/identity/slack/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,OAAO,EACP,kCAAkC,EAClC,4BAA4B,EAC5B,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC"}
|
|
@@ -8,38 +8,38 @@
|
|
|
8
8
|
import { Client } from "@langchain/langgraph-sdk";
|
|
9
9
|
export declare const IDENTITY_LINKS_NAMESPACE: readonly ["mda_identity_links"];
|
|
10
10
|
export interface IdentityLinkRecord {
|
|
11
|
-
|
|
11
|
+
userId: string;
|
|
12
12
|
slackUserId: string;
|
|
13
13
|
slackTeamId?: string;
|
|
14
|
-
/** Fully-qualified Slack
|
|
15
|
-
|
|
14
|
+
/** Fully-qualified Slack user key, e.g. `slack:T123:U456`. */
|
|
15
|
+
slackKey: string;
|
|
16
16
|
email?: string;
|
|
17
17
|
linkedAt: string;
|
|
18
18
|
source: "slack_oauth";
|
|
19
19
|
}
|
|
20
20
|
export interface IdentityLinkStore {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
getBySlackKey(slackKey: string): Promise<IdentityLinkRecord | null>;
|
|
22
|
+
getByUserId(userId: string): Promise<IdentityLinkRecord | null>;
|
|
23
23
|
upsert(record: IdentityLinkRecord): Promise<void>;
|
|
24
|
-
|
|
24
|
+
removeByUserId(userId: string): Promise<void>;
|
|
25
25
|
}
|
|
26
26
|
/** In-memory store for tests (and as a process-local cache layer). */
|
|
27
27
|
export declare class InMemoryIdentityLinkStore implements IdentityLinkStore {
|
|
28
28
|
private readonly bySlack;
|
|
29
|
-
private readonly
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
private readonly byUser;
|
|
30
|
+
getBySlackKey(slackKey: string): Promise<IdentityLinkRecord | null>;
|
|
31
|
+
getByUserId(userId: string): Promise<IdentityLinkRecord | null>;
|
|
32
32
|
upsert(record: IdentityLinkRecord): Promise<void>;
|
|
33
|
-
|
|
33
|
+
removeByUserId(userId: string): Promise<void>;
|
|
34
34
|
}
|
|
35
35
|
/** LangGraph Store–backed identity links. */
|
|
36
36
|
export declare class LangGraphIdentityLinkStore implements IdentityLinkStore {
|
|
37
37
|
private readonly client;
|
|
38
38
|
constructor(client: Client);
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
getBySlackKey(slackKey: string): Promise<IdentityLinkRecord | null>;
|
|
40
|
+
getByUserId(userId: string): Promise<IdentityLinkRecord | null>;
|
|
41
41
|
upsert(record: IdentityLinkRecord): Promise<void>;
|
|
42
|
-
|
|
42
|
+
removeByUserId(userId: string): Promise<void>;
|
|
43
43
|
private getItem;
|
|
44
44
|
}
|
|
45
45
|
/** Override the process-default link store (tests). */
|
|
@@ -52,9 +52,9 @@ export declare function createLangGraphIdentityLinkStore(options?: {
|
|
|
52
52
|
apiKey?: string;
|
|
53
53
|
ingressSecret?: string;
|
|
54
54
|
}): LangGraphIdentityLinkStore | null;
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function slackKeyFromParts(teamId: string, userId: string): string;
|
|
56
56
|
export declare function buildIdentityLinkRecord(input: {
|
|
57
|
-
|
|
57
|
+
userId: string;
|
|
58
58
|
slackUserId: string;
|
|
59
59
|
slackTeamId?: string;
|
|
60
60
|
email?: string;
|