managed-deepagents 0.5.3-dev.111 → 0.5.3-dev.113

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. package/README.md +20 -17
  2. package/dist/channels/manifest.d.ts +0 -2
  3. package/dist/channels/manifest.d.ts.map +1 -1
  4. package/dist/channels/slack/http.d.ts.map +1 -1
  5. package/dist/channels/slack/http.js +3 -48
  6. package/dist/channels/slack/http.js.map +1 -1
  7. package/dist/channels/slack/index.d.ts +2 -3
  8. package/dist/channels/slack/index.d.ts.map +1 -1
  9. package/dist/channels/slack/index.js +2 -3
  10. package/dist/channels/slack/index.js.map +1 -1
  11. package/dist/connectors/mcp/index.d.ts.map +1 -1
  12. package/dist/connectors/mcp/index.js +5 -1
  13. package/dist/connectors/mcp/index.js.map +1 -1
  14. package/dist/connectors/mcp/load.js +3 -0
  15. package/dist/connectors/mcp/load.js.map +1 -1
  16. package/dist/connectors/tool-selection.d.ts +13 -18
  17. package/dist/connectors/tool-selection.d.ts.map +1 -1
  18. package/dist/connectors/tool-selection.js +10 -13
  19. package/dist/connectors/tool-selection.js.map +1 -1
  20. package/dist/extension.d.ts +5 -5
  21. package/dist/extension.js +5 -5
  22. package/dist/identity/index.d.ts +2 -11
  23. package/dist/identity/index.d.ts.map +1 -1
  24. package/dist/identity/index.js +8 -66
  25. package/dist/identity/index.js.map +1 -1
  26. package/dist/identity/options.d.ts +3 -3
  27. package/dist/identity/options.js +7 -8
  28. package/dist/identity/options.js.map +1 -1
  29. package/dist/identity/slack/links.d.ts +1 -2
  30. package/dist/identity/slack/links.d.ts.map +1 -1
  31. package/dist/identity/slack/links.js +1 -2
  32. package/dist/identity/slack/links.js.map +1 -1
  33. package/dist/identity/supabase.d.ts.map +1 -1
  34. package/dist/identity/supabase.js +2 -0
  35. package/dist/identity/supabase.js.map +1 -1
  36. package/dist/identity/types.d.ts +8 -81
  37. package/dist/identity/types.d.ts.map +1 -1
  38. package/dist/index.d.ts +2 -5
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/namespaces.d.ts +5 -183
  43. package/dist/namespaces.d.ts.map +1 -1
  44. package/dist/namespaces.js +1 -63
  45. package/dist/namespaces.js.map +1 -1
  46. package/dist/runtime/auth.d.ts +11 -14
  47. package/dist/runtime/auth.d.ts.map +1 -1
  48. package/dist/runtime/auth.js +15 -54
  49. package/dist/runtime/auth.js.map +1 -1
  50. package/dist/runtime/cors.d.ts +5 -4
  51. package/dist/runtime/cors.d.ts.map +1 -1
  52. package/dist/runtime/cors.js +5 -9
  53. package/dist/runtime/cors.js.map +1 -1
  54. package/dist/runtime/identity-http.d.ts.map +1 -1
  55. package/dist/runtime/identity-http.js +0 -69
  56. package/dist/runtime/identity-http.js.map +1 -1
  57. package/dist/runtime/identity-runtime.d.ts +2 -10
  58. package/dist/runtime/identity-runtime.d.ts.map +1 -1
  59. package/dist/runtime/identity-runtime.js +2 -38
  60. package/dist/runtime/identity-runtime.js.map +1 -1
  61. package/dist/runtime/index.d.ts +15 -11
  62. package/dist/runtime/index.d.ts.map +1 -1
  63. package/dist/runtime/index.js +8 -44
  64. package/dist/runtime/index.js.map +1 -1
  65. package/dist/runtime/managed-middleware.d.ts +2 -3
  66. package/dist/runtime/managed-middleware.d.ts.map +1 -1
  67. package/dist/runtime/managed-middleware.js +12 -12
  68. package/dist/runtime/managed-middleware.js.map +1 -1
  69. package/dist/runtime/managed-tools.d.ts +4 -11
  70. package/dist/runtime/managed-tools.d.ts.map +1 -1
  71. package/dist/runtime/managed-tools.js +11 -18
  72. package/dist/runtime/managed-tools.js.map +1 -1
  73. package/dist/runtime/memory/context-io.d.ts +0 -1
  74. package/dist/runtime/memory/context-io.d.ts.map +1 -1
  75. package/dist/runtime/memory/context-io.js +0 -10
  76. package/dist/runtime/memory/context-io.js.map +1 -1
  77. package/dist/runtime/memory/mounts.d.ts.map +1 -1
  78. package/dist/runtime/memory/mounts.js +0 -10
  79. package/dist/runtime/memory/mounts.js.map +1 -1
  80. package/dist/runtime/validated-token.d.ts.map +1 -1
  81. package/dist/runtime/validated-token.js +7 -1
  82. package/dist/runtime/validated-token.js.map +1 -1
  83. package/package.json +10 -11
  84. package/dist/channels/index.d.ts +0 -25
  85. package/dist/channels/index.d.ts.map +0 -1
  86. package/dist/channels/index.js +0 -18
  87. package/dist/channels/index.js.map +0 -1
  88. package/dist/connectors/marketplace/catalog.d.ts +0 -96
  89. package/dist/connectors/marketplace/catalog.d.ts.map +0 -1
  90. package/dist/connectors/marketplace/catalog.js +0 -213
  91. package/dist/connectors/marketplace/catalog.js.map +0 -1
  92. package/dist/connectors/marketplace/fleet-mcp.d.ts +0 -62
  93. package/dist/connectors/marketplace/fleet-mcp.d.ts.map +0 -1
  94. package/dist/connectors/marketplace/fleet-mcp.js +0 -215
  95. package/dist/connectors/marketplace/fleet-mcp.js.map +0 -1
  96. package/dist/connectors/marketplace/index.d.ts +0 -31
  97. package/dist/connectors/marketplace/index.d.ts.map +0 -1
  98. package/dist/connectors/marketplace/index.js +0 -39
  99. package/dist/connectors/marketplace/index.js.map +0 -1
  100. package/dist/connectors/marketplace/load.d.ts +0 -14
  101. package/dist/connectors/marketplace/load.d.ts.map +0 -1
  102. package/dist/connectors/marketplace/load.js +0 -206
  103. package/dist/connectors/marketplace/load.js.map +0 -1
  104. package/dist/connectors/slack/index.d.ts +0 -24
  105. package/dist/connectors/slack/index.d.ts.map +0 -1
  106. package/dist/connectors/slack/index.js +0 -64
  107. package/dist/connectors/slack/index.js.map +0 -1
  108. package/dist/connectors/toolserver/catalog.d.ts +0 -326
  109. package/dist/connectors/toolserver/catalog.d.ts.map +0 -1
  110. package/dist/connectors/toolserver/catalog.js +0 -415
  111. package/dist/connectors/toolserver/catalog.js.map +0 -1
  112. package/dist/connectors/toolserver/connectors.d.ts +0 -698
  113. package/dist/connectors/toolserver/connectors.d.ts.map +0 -1
  114. package/dist/connectors/toolserver/connectors.js +0 -13
  115. package/dist/connectors/toolserver/connectors.js.map +0 -1
  116. package/dist/connectors/toolserver/index.d.ts +0 -142
  117. package/dist/connectors/toolserver/index.d.ts.map +0 -1
  118. package/dist/connectors/toolserver/index.js +0 -105
  119. package/dist/connectors/toolserver/index.js.map +0 -1
  120. package/dist/connectors/toolserver/integrations.d.ts +0 -103
  121. package/dist/connectors/toolserver/integrations.d.ts.map +0 -1
  122. package/dist/connectors/toolserver/integrations.js +0 -288
  123. package/dist/connectors/toolserver/integrations.js.map +0 -1
  124. package/dist/connectors/toolserver/load.d.ts +0 -55
  125. package/dist/connectors/toolserver/load.d.ts.map +0 -1
  126. package/dist/connectors/toolserver/load.js +0 -289
  127. package/dist/connectors/toolserver/load.js.map +0 -1
  128. package/dist/identity/actor-subject.d.ts +0 -60
  129. package/dist/identity/actor-subject.d.ts.map +0 -1
  130. package/dist/identity/actor-subject.js +0 -107
  131. package/dist/identity/actor-subject.js.map +0 -1
  132. package/dist/identity/byo-oauth.d.ts +0 -105
  133. package/dist/identity/byo-oauth.d.ts.map +0 -1
  134. package/dist/identity/byo-oauth.js +0 -190
  135. package/dist/identity/byo-oauth.js.map +0 -1
  136. package/dist/identity/connect-inference.d.ts +0 -37
  137. package/dist/identity/connect-inference.d.ts.map +0 -1
  138. package/dist/identity/connect-inference.js +0 -53
  139. package/dist/identity/connect-inference.js.map +0 -1
  140. package/dist/identity/connect-paths.d.ts +0 -8
  141. package/dist/identity/connect-paths.d.ts.map +0 -1
  142. package/dist/identity/connect-paths.js +0 -11
  143. package/dist/identity/connect-paths.js.map +0 -1
  144. package/dist/identity/connect-provider-types.d.ts +0 -97
  145. package/dist/identity/connect-provider-types.d.ts.map +0 -1
  146. package/dist/identity/connect-provider-types.js +0 -10
  147. package/dist/identity/connect-provider-types.js.map +0 -1
  148. package/dist/identity/connect-provider.d.ts +0 -35
  149. package/dist/identity/connect-provider.d.ts.map +0 -1
  150. package/dist/identity/connect-provider.js +0 -148
  151. package/dist/identity/connect-provider.js.map +0 -1
  152. package/dist/identity/credential-resolvers.d.ts +0 -33
  153. package/dist/identity/credential-resolvers.d.ts.map +0 -1
  154. package/dist/identity/credential-resolvers.js +0 -62
  155. package/dist/identity/credential-resolvers.js.map +0 -1
  156. package/dist/identity/define-fleet-connect.d.ts +0 -53
  157. package/dist/identity/define-fleet-connect.d.ts.map +0 -1
  158. package/dist/identity/define-fleet-connect.js +0 -76
  159. package/dist/identity/define-fleet-connect.js.map +0 -1
  160. package/dist/identity/fleet-connect-hint.d.ts +0 -41
  161. package/dist/identity/fleet-connect-hint.d.ts.map +0 -1
  162. package/dist/identity/fleet-connect-hint.js +0 -190
  163. package/dist/identity/fleet-connect-hint.js.map +0 -1
  164. package/dist/identity/fleet-connect.d.ts +0 -93
  165. package/dist/identity/fleet-connect.d.ts.map +0 -1
  166. package/dist/identity/fleet-connect.js +0 -256
  167. package/dist/identity/fleet-connect.js.map +0 -1
  168. package/dist/identity/fleet-integration-connect.d.ts +0 -32
  169. package/dist/identity/fleet-integration-connect.d.ts.map +0 -1
  170. package/dist/identity/fleet-integration-connect.js +0 -35
  171. package/dist/identity/fleet-integration-connect.js.map +0 -1
  172. package/dist/identity/fleet.d.ts +0 -56
  173. package/dist/identity/fleet.d.ts.map +0 -1
  174. package/dist/identity/fleet.js +0 -131
  175. package/dist/identity/fleet.js.map +0 -1
  176. package/dist/identity/github/connect-http.d.ts +0 -37
  177. package/dist/identity/github/connect-http.d.ts.map +0 -1
  178. package/dist/identity/github/connect-http.js +0 -128
  179. package/dist/identity/github/connect-http.js.map +0 -1
  180. package/dist/identity/github/credentials-store.d.ts +0 -76
  181. package/dist/identity/github/credentials-store.d.ts.map +0 -1
  182. package/dist/identity/github/credentials-store.js +0 -270
  183. package/dist/identity/github/credentials-store.js.map +0 -1
  184. package/dist/identity/github/credentials.d.ts +0 -87
  185. package/dist/identity/github/credentials.d.ts.map +0 -1
  186. package/dist/identity/github/credentials.js +0 -201
  187. package/dist/identity/github/credentials.js.map +0 -1
  188. package/dist/identity/github/index.d.ts +0 -7
  189. package/dist/identity/github/index.d.ts.map +0 -1
  190. package/dist/identity/github/index.js +0 -6
  191. package/dist/identity/github/index.js.map +0 -1
  192. package/dist/identity/github/oauth.d.ts +0 -47
  193. package/dist/identity/github/oauth.d.ts.map +0 -1
  194. package/dist/identity/github/oauth.js +0 -124
  195. package/dist/identity/github/oauth.js.map +0 -1
  196. package/dist/identity/google/connect-http.d.ts +0 -37
  197. package/dist/identity/google/connect-http.d.ts.map +0 -1
  198. package/dist/identity/google/connect-http.js +0 -42
  199. package/dist/identity/google/connect-http.js.map +0 -1
  200. package/dist/identity/google/index.d.ts +0 -7
  201. package/dist/identity/google/index.d.ts.map +0 -1
  202. package/dist/identity/google/index.js +0 -6
  203. package/dist/identity/google/index.js.map +0 -1
  204. package/dist/identity/google/oauth.d.ts +0 -22
  205. package/dist/identity/google/oauth.d.ts.map +0 -1
  206. package/dist/identity/google/oauth.js +0 -48
  207. package/dist/identity/google/oauth.js.map +0 -1
  208. package/dist/identity/linkedin/connect-http.d.ts +0 -37
  209. package/dist/identity/linkedin/connect-http.d.ts.map +0 -1
  210. package/dist/identity/linkedin/connect-http.js +0 -41
  211. package/dist/identity/linkedin/connect-http.js.map +0 -1
  212. package/dist/identity/linkedin/index.d.ts +0 -7
  213. package/dist/identity/linkedin/index.d.ts.map +0 -1
  214. package/dist/identity/linkedin/index.js +0 -6
  215. package/dist/identity/linkedin/index.js.map +0 -1
  216. package/dist/identity/linkedin/oauth.d.ts +0 -22
  217. package/dist/identity/linkedin/oauth.d.ts.map +0 -1
  218. package/dist/identity/linkedin/oauth.js +0 -47
  219. package/dist/identity/linkedin/oauth.js.map +0 -1
  220. package/dist/identity/marketplace/connect-hint.d.ts +0 -31
  221. package/dist/identity/marketplace/connect-hint.d.ts.map +0 -1
  222. package/dist/identity/marketplace/connect-hint.js +0 -59
  223. package/dist/identity/marketplace/connect-hint.js.map +0 -1
  224. package/dist/identity/marketplace/connect.d.ts +0 -51
  225. package/dist/identity/marketplace/connect.d.ts.map +0 -1
  226. package/dist/identity/marketplace/connect.js +0 -88
  227. package/dist/identity/marketplace/connect.js.map +0 -1
  228. package/dist/identity/marketplace/index.d.ts +0 -9
  229. package/dist/identity/marketplace/index.d.ts.map +0 -1
  230. package/dist/identity/marketplace/index.js +0 -9
  231. package/dist/identity/marketplace/index.js.map +0 -1
  232. package/dist/identity/microsoft/connect-http.d.ts +0 -38
  233. package/dist/identity/microsoft/connect-http.d.ts.map +0 -1
  234. package/dist/identity/microsoft/connect-http.js +0 -42
  235. package/dist/identity/microsoft/connect-http.js.map +0 -1
  236. package/dist/identity/microsoft/index.d.ts +0 -7
  237. package/dist/identity/microsoft/index.d.ts.map +0 -1
  238. package/dist/identity/microsoft/index.js +0 -6
  239. package/dist/identity/microsoft/index.js.map +0 -1
  240. package/dist/identity/microsoft/oauth.d.ts +0 -24
  241. package/dist/identity/microsoft/oauth.d.ts.map +0 -1
  242. package/dist/identity/microsoft/oauth.js +0 -65
  243. package/dist/identity/microsoft/oauth.js.map +0 -1
  244. package/dist/identity/oauth-env.d.ts +0 -43
  245. package/dist/identity/oauth-env.d.ts.map +0 -1
  246. package/dist/identity/oauth-env.js +0 -66
  247. package/dist/identity/oauth-env.js.map +0 -1
  248. package/dist/identity/oauth-tickets.d.ts +0 -37
  249. package/dist/identity/oauth-tickets.d.ts.map +0 -1
  250. package/dist/identity/oauth-tickets.js +0 -114
  251. package/dist/identity/oauth-tickets.js.map +0 -1
  252. package/dist/identity/slack/connect-http.d.ts +0 -35
  253. package/dist/identity/slack/connect-http.d.ts.map +0 -1
  254. package/dist/identity/slack/connect-http.js +0 -115
  255. package/dist/identity/slack/connect-http.js.map +0 -1
  256. package/dist/identity/slack/index.d.ts +0 -8
  257. package/dist/identity/slack/index.d.ts.map +0 -1
  258. package/dist/identity/slack/index.js +0 -7
  259. package/dist/identity/slack/index.js.map +0 -1
  260. package/dist/identity/slack/oauth.d.ts +0 -28
  261. package/dist/identity/slack/oauth.d.ts.map +0 -1
  262. package/dist/identity/slack/oauth.js +0 -87
  263. package/dist/identity/slack/oauth.js.map +0 -1
  264. package/dist/identity/x/connect-http.d.ts +0 -38
  265. package/dist/identity/x/connect-http.d.ts.map +0 -1
  266. package/dist/identity/x/connect-http.js +0 -41
  267. package/dist/identity/x/connect-http.js.map +0 -1
  268. package/dist/identity/x/index.d.ts +0 -6
  269. package/dist/identity/x/index.d.ts.map +0 -1
  270. package/dist/identity/x/index.js +0 -5
  271. package/dist/identity/x/index.js.map +0 -1
  272. package/dist/runtime/credentials.d.ts +0 -68
  273. package/dist/runtime/credentials.d.ts.map +0 -1
  274. package/dist/runtime/credentials.js +0 -235
  275. package/dist/runtime/credentials.js.map +0 -1
@@ -1,60 +0,0 @@
1
- /**
2
- * Deterministic LangSmith agent_id for an MDA actor's Fleet vault subject.
3
- *
4
- * Tokens imported via Connect-with-X and toolserver `?agent_id=` must use the
5
- * same derivation so each caller reaches their own vault connections. One
6
- * actor has one agent_id; multiple Fleet OAuth integrations attach as distinct
7
- * `provider_id`s on that subject.
8
- */
9
- import { type FleetOAuthIntegration } from "../connectors/toolserver/integrations.js";
10
- import type { IdentityConnectMountContext } from "./connect-provider-types.js";
11
- /**
12
- * Fixed namespace for MDA actor vault subjects (UUID form).
13
- * Stable across releases so reconnects hit the same vault row.
14
- */
15
- export declare const NAMESPACE_MDA_ACTOR = "c0ffee00-0da0-4111-8111-000000000001";
16
- export interface AgentIdFromActorOptions {
17
- /**
18
- * Workspace discriminator so ids do not collide across workspaces.
19
- * Defaults to {@link resolveActorDeploymentId} (`LANGSMITH_WORKSPACE_ID`).
20
- */
21
- deploymentId?: string;
22
- /** Override process env (tests). */
23
- env?: NodeJS.ProcessEnv;
24
- /** Override the UUID namespace (tests). */
25
- namespace?: string;
26
- }
27
- /**
28
- * Resolve the workspace slice for {@link agentIdFromActor}.
29
- *
30
- * Uses `LANGSMITH_WORKSPACE_ID`, else `"local"`.
31
- */
32
- export declare function resolveActorDeploymentId(env?: NodeJS.ProcessEnv): string;
33
- /**
34
- * Derive the vault `agent_id` for an authenticated MDA actor.
35
- *
36
- * `uuidv5(`${workspaceId}:${userId}`, NAMESPACE_MDA_ACTOR)`.
37
- */
38
- export declare function agentIdFromActor(userId: string, options?: AgentIdFromActorOptions): string;
39
- /** Enable actor-subject routing for a Fleet OAuth integration. */
40
- export declare function enableActorSubjectIntegration(integrationId: string): void;
41
- /** True when actor-subject routing is on for `integrationId`. */
42
- export declare function isActorSubjectIntegrationEnabled(integrationId: string): boolean;
43
- /**
44
- * True when `slug` belongs to an enabled Fleet OAuth integration (per-actor
45
- * `?agent_id=` routing).
46
- */
47
- export declare function isActorSubjectSlugEnabled(slug: string | undefined): boolean;
48
- /** Enabled integration ids (for connect-hint middleware, etc.). */
49
- export declare function enabledActorSubjectIntegrations(): readonly string[];
50
- /**
51
- * Enable actor-subject mode for every Fleet integration implied by connectors on a
52
- * user-scoped deployment. Agent-scoped deployments keep the shared
53
- * `MDA_TOOLSERVER_AGENT_ID` subject.
54
- */
55
- export declare function enableActorSubjectIntegrationsFromConnectors(connectorKinds: readonly (string | undefined)[] | undefined, scope?: IdentityConnectMountContext["scope"]): void;
56
- /** Enable a specific integration when connectors imply it (user-scoped only). */
57
- export declare function enableActorSubjectIntegrationFromConnectors(integration: FleetOAuthIntegration, connectorKinds: readonly (string | undefined)[] | undefined, scope?: IdentityConnectMountContext["scope"]): void;
58
- /** Test-only reset. */
59
- export declare function resetActorSubjectEnabledForTests(): void;
60
- //# sourceMappingURL=actor-subject.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"actor-subject.d.ts","sourceRoot":"","sources":["../../src/identity/actor-subject.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAY/E;;;GAGG;AACH,eAAO,MAAM,mB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leet vault subject.
3
- *
4
- * Tokens imported via Connect-with-X and toolserver `?agent_id=` must use the
5
- * same derivation so each caller reaches their own vault connections. One
6
- * actor has one agent_id; multiple Fleet OAuth integrations attach as distinct
7
- * `provider_id`s on that subject.
8
- */
9
- import { v5 as uuidv5 } from "uuid";
10
- import { MARKETPLACE_MCP_INTEGRATIONS, hasMarketplaceConnector, } from "../connectors/marketplace/catalog.js";
11
- import { FLEET_OAUTH_INTEGRATIONS, integrationForSlug, hasIntegrationToolServerConnector, } from "../connectors/toolserver/integrations.js";
12
- function isUserScoped(scope) {
13
- if (!scope) {
14
- return false;
15
- }
16
- // Per-caller Connect / actor-subject vault ownership. Memory is unrelated.
17
- return scope.credentials === "user" || scope.credentials === "custom";
18
- }
19
- /**
20
- * Fixed namespace for MDA actor vault subjects (UUID form).
21
- * Stable across releases so reconnects hit the same vault row.
22
- */
23
- export const NAMESPACE_MDA_ACTOR = "c0ffee00-0da0-4111-8111-000000000001";
24
- /**
25
- * Resolve the workspace slice for {@link agentIdFromActor}.
26
- *
27
- * Uses `LANGSMITH_WORKSPACE_ID`, else `"local"`.
28
- */
29
- export function resolveActorDeploymentId(env = process.env) {
30
- return trimmed(env.LANGSMITH_WORKSPACE_ID) ?? "local";
31
- }
32
- /**
33
- * Derive the vault `agent_id` for an authenticated MDA actor.
34
- *
35
- * `uuidv5(`${workspaceId}:${userId}`, NAMESPACE_MDA_ACTOR)`.
36
- */
37
- export function agentIdFromActor(userId, options = {}) {
38
- const id = userId.trim();
39
- if (!id) {
40
- throw new Error("agentIdFromActor requires a non-empty userId");
41
- }
42
- const deploymentId = options.deploymentId?.trim() ||
43
- resolveActorDeploymentId(options.env ?? process.env);
44
- const namespace = options.namespace ?? NAMESPACE_MDA_ACTOR;
45
- return uuidv5(`${deploymentId}:${id}`, namespace);
46
- }
47
- /** Integrations with per-actor toolserver subject routing enabled in this process. */
48
- const enabledIntegrations = new Set();
49
- /** Enable actor-subject routing for a Fleet OAuth integration. */
50
- export function enableActorSubjectIntegration(integrationId) {
51
- const id = integrationId.trim();
52
- if (id) {
53
- enabledIntegrations.add(id);
54
- }
55
- }
56
- /** True when actor-subject routing is on for `integrationId`. */
57
- export function isActorSubjectIntegrationEnabled(integrationId) {
58
- return enabledIntegrations.has(integrationId);
59
- }
60
- /**
61
- * True when `slug` belongs to an enabled Fleet OAuth integration (per-actor
62
- * `?agent_id=` routing).
63
- */
64
- export function isActorSubjectSlugEnabled(slug) {
65
- const integration = integrationForSlug(slug);
66
- return integration != null && enabledIntegrations.has(integration.id);
67
- }
68
- /** Enabled integration ids (for connect-hint middleware, etc.). */
69
- export function enabledActorSubjectIntegrations() {
70
- return [...enabledIntegrations];
71
- }
72
- /**
73
- * Enable actor-subject mode for every Fleet integration implied by connectors on a
74
- * user-scoped deployment. Agent-scoped deployments keep the shared
75
- * `MDA_TOOLSERVER_AGENT_ID` subject.
76
- */
77
- export function enableActorSubjectIntegrationsFromConnectors(connectorKinds, scope) {
78
- if (!isUserScoped(scope)) {
79
- return;
80
- }
81
- for (const integration of FLEET_OAUTH_INTEGRATIONS) {
82
- if (hasIntegrationToolServerConnector(integration, connectorKinds)) {
83
- enableActorSubjectIntegration(integration.id);
84
- }
85
- }
86
- for (const integration of MARKETPLACE_MCP_INTEGRATIONS) {
87
- if (hasMarketplaceConnector(integration.id, connectorKinds)) {
88
- enableActorSubjectIntegration(integration.id);
89
- }
90
- }
91
- }
92
- /** Enable a specific integration when connectors imply it (user-scoped only). */
93
- export function enableActorSubjectIntegrationFromConnectors(integration, connectorKinds, scope) {
94
- if (hasIntegrationToolServerConnector(integration, connectorKinds) &&
95
- isUserScoped(scope)) {
96
- enableActorSubjectIntegration(integration.id);
97
- }
98
- }
99
- /** Test-only reset. */
100
- export function resetActorSubjectEnabledForTests() {
101
- enabledIntegrations.clear();
102
- }
103
- function trimmed(value) {
104
- const v = value?.trim();
105
- return v ? v : undefined;
106
- }
107
- //# sourceMappingURL=actor-subject.js.map
@@ -1 +0,0 @@
1
- {"version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AAC,CAAC;QAChD,CAAC;IACH,CAAC;AACH,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,2CAA2C,CACzD,WAAkC,EAClC,cAA2D,EAC3D,KAA4C;IAE5C,IACE,iCAAiC,CAAC,WAAW,EAAE,cAAc,CAAC;QAC9D,YAAY,CAAC,KAAK,CAAC,EACnB,CAAC;QACD,6BAA6B,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC;AACH,CAAC;AAED,uBAAuB;AACvB,MAAM,UAAU,gCAAgC;IAC9C,mBAAmB,CAAC,KAAK,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IACxB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3B,CAAC"}
@@ -1,105 +0,0 @@
1
- /**
2
- * Factory for optional BYO (bring-your-own) OAuth clients used when Fleet
3
- * auth-sessions are unavailable.
4
- *
5
- * Vendor modules supply endpoints, authorize extras, and userinfo parsing;
6
- * this module owns config env reading, authorize URL construction, token
7
- * exchange, and the {@link FleetVaultByoOauth} adapter.
8
- */
9
- import type { FleetVaultByoOauth, FleetVaultByoTokenResult } from "./fleet-connect.js";
10
- import { type OauthTickets } from "./oauth-tickets.js";
11
- import { resolveOauthRedirectBase } from "./oauth-env.js";
12
- export { MDA_PUBLIC_API_URL_ENV, MDA_PUBLIC_APP_URL_ENV, OAUTH_STATE_SIGNING_KEY_ENV, readOauthStateSigningKey, resolveOauthRedirectBase, resolveSlackOauthRedirectBase, } from "./oauth-env.js";
13
- /** Shared BYO OAuth client configuration. */
14
- export interface ByoOauthConfig {
15
- clientId: string;
16
- clientSecret: string;
17
- publicAppUrl: string;
18
- scopes: string;
19
- authUrl: string;
20
- tokenUrl: string;
21
- userInfoUrl: string;
22
- }
23
- export interface ByoOauthEndpoints {
24
- authUrl: string;
25
- tokenUrl: string;
26
- userInfoUrl: string;
27
- /** Space-separated default scopes when env override is absent. */
28
- defaultScopes: string;
29
- }
30
- export interface ByoOauthUserInfo {
31
- email?: string;
32
- subject?: string;
33
- /** Extra vault / provider metadata merged with {@link CreateByoOauthClientOptions.subjectMetadataKey}. */
34
- metadata?: Record<string, unknown>;
35
- }
36
- export interface CreateByoOauthClientOptions {
37
- /** Connect / ticket provider id, e.g. `"google"`. */
38
- providerId: string;
39
- /** Human label for error messages ("Google", "Microsoft"). */
40
- displayName: string;
41
- /**
42
- * Env prefix without trailing underscore, e.g. `"GOOGLE_OAUTH"`.
43
- * Reads `${prefix}_CLIENT_ID`, `_CLIENT_SECRET`, `_SCOPES`, `_AUTH_URL`,
44
- * `_TOKEN_URL`, `_USERINFO_URL` unless overridden by {@link envKeys}.
45
- */
46
- envPrefix: string;
47
- /** Override individual env key names after prefix derivation (e.g. GitHub). */
48
- envKeys?: Partial<ByoOauthEnvKeys>;
49
- /** Default endpoints + scopes (may read extra env, e.g. tenant). */
50
- defaultEndpoints: (env: NodeJS.ProcessEnv) => ByoOauthEndpoints;
51
- /**
52
- * Extra authorize query params merged after the shared OAuth code-grant
53
- * fields. Defaults include `prompt=consent` unless {@link defaultPrompt} is
54
- * `false`.
55
- */
56
- authorizeParams?: Record<string, string>;
57
- /**
58
- * Default authorize `prompt` value. Set `false` to omit (GitHub).
59
- * @default "consent"
60
- */
61
- defaultPrompt?: string | false;
62
- /**
63
- * Token exchange request shape. GitHub needs JSON + `Accept: application/json`;
64
- * most IdPs use form-urlencoded.
65
- */
66
- tokenRequest?: {
67
- format?: "form" | "json";
68
- headers?: Record<string, string>;
69
- };
70
- /** UserInfo /profile request options. */
71
- userInfoRequest?: {
72
- headers?: Record<string, string>;
73
- /** When true, a failed or incomplete userinfo response throws. */
74
- required?: boolean;
75
- };
76
- /** Map a userinfo /me JSON body to email + subject (+ optional metadata). */
77
- parseUserInfo: (json: Record<string, unknown>) => ByoOauthUserInfo;
78
- /** Vault metadata key for the IdP subject (e.g. `google_sub`). */
79
- subjectMetadataKey: string;
80
- }
81
- export interface ByoOauthEnvKeys {
82
- clientId: string;
83
- clientSecret: string;
84
- scopes: string;
85
- authUrl: string;
86
- tokenUrl: string;
87
- userInfoUrl: string;
88
- }
89
- /** BYO OAuth client produced by {@link createByoOauthClient}. */
90
- export interface ByoOauthClient {
91
- providerId: string;
92
- displayName: string;
93
- env: ByoOauthEnvKeys;
94
- tickets: OauthTickets;
95
- resolveRedirectBase: typeof resolveOauthRedirectBase;
96
- readConfig(env?: NodeJS.ProcessEnv): ByoOauthConfig | null;
97
- buildAuthorizeUrl(config: ByoOauthConfig, state: string, redirectUri: string, scopes?: string): string;
98
- exchangeCode(config: ByoOauthConfig, code: string, redirectUri: string, fetchImpl?: typeof fetch): Promise<FleetVaultByoTokenResult>;
99
- /** Ready for `createFleetVaultConnectProvider({ byo })`. */
100
- byo: FleetVaultByoOauth;
101
- resolvePublicAppUrl(env?: NodeJS.ProcessEnv): string | undefined;
102
- }
103
- /** Build a BYO OAuth client for one Fleet vault Connect integration. */
104
- export declare function createByoOauthClient(options: CreateByoOauthClientOptions): ByoOauthClient;
105
- //# sourceMappingURL=byo-oauth.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"byo-oauth.d.ts","sourceRoot":"","sources":["../../src/identity/byo-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAGL,wBAAwB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AAExB,6CAA6C;AAC7C,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,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oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,cAAc,CA2NhB"}
@@ -1,190 +0,0 @@
1
- /**
2
- * Factory for optional BYO (bring-your-own) OAuth clients used when Fleet
3
- * auth-sessions are unavailable.
4
- *
5
- * Vendor modules supply endpoints, authorize extras, and userinfo parsing;
6
- * this module owns config env reading, authorize URL construction, token
7
- * exchange, and the {@link FleetVaultByoOauth} adapter.
8
- */
9
- import { fetchWithTimeout, PROVIDER_HTTP_TIMEOUT_MS } from "../runtime/http.js";
10
- import { oauthTicketsFor } from "./oauth-tickets.js";
11
- import { MDA_PUBLIC_API_URL_ENV, MDA_PUBLIC_APP_URL_ENV, resolveOauthRedirectBase, } from "./oauth-env.js";
12
- export { MDA_PUBLIC_API_URL_ENV, MDA_PUBLIC_APP_URL_ENV, OAUTH_STATE_SIGNING_KEY_ENV, readOauthStateSigningKey, resolveOauthRedirectBase, resolveSlackOauthRedirectBase, } from "./oauth-env.js";
13
- function stripSlash(value) {
14
- return value.replace(/\/$/, "");
15
- }
16
- function envKeysFromPrefix(prefix) {
17
- return {
18
- clientId: `${prefix}_CLIENT_ID`,
19
- clientSecret: `${prefix}_CLIENT_SECRET`,
20
- scopes: `${prefix}_SCOPES`,
21
- authUrl: `${prefix}_AUTH_URL`,
22
- tokenUrl: `${prefix}_TOKEN_URL`,
23
- userInfoUrl: `${prefix}_USERINFO_URL`,
24
- };
25
- }
26
- /** Build a BYO OAuth client for one Fleet vault Connect integration. */
27
- export function createByoOauthClient(options) {
28
- const keys = { ...envKeysFromPrefix(options.envPrefix), ...options.envKeys };
29
- const tickets = oauthTicketsFor(options.providerId);
30
- const authorizeExtras = {
31
- ...(options.defaultPrompt === false
32
- ? {}
33
- : { prompt: options.defaultPrompt ?? "consent" }),
34
- ...options.authorizeParams,
35
- };
36
- const tokenFormat = options.tokenRequest?.format ?? "form";
37
- const tokenHeaders = options.tokenRequest?.headers;
38
- const userInfoHeaders = options.userInfoRequest?.headers;
39
- const requireUserInfo = options.userInfoRequest?.required ?? false;
40
- function readConfig(env = process.env) {
41
- const clientId = env[keys.clientId]?.trim();
42
- const clientSecret = env[keys.clientSecret]?.trim();
43
- const publicAppUrl = env[MDA_PUBLIC_APP_URL_ENV]?.trim() ||
44
- env[MDA_PUBLIC_API_URL_ENV]?.trim();
45
- if (!clientId || !clientSecret || !publicAppUrl) {
46
- return null;
47
- }
48
- const defaults = options.defaultEndpoints(env);
49
- return {
50
- clientId,
51
- clientSecret,
52
- publicAppUrl: stripSlash(publicAppUrl),
53
- scopes: env[keys.scopes]?.trim() || defaults.defaultScopes,
54
- authUrl: stripSlash(env[keys.authUrl]?.trim() || defaults.authUrl),
55
- tokenUrl: stripSlash(env[keys.tokenUrl]?.trim() || defaults.tokenUrl),
56
- userInfoUrl: stripSlash(env[keys.userInfoUrl]?.trim() || defaults.userInfoUrl),
57
- };
58
- }
59
- function buildAuthorizeUrl(config, state, redirectUri, scopes) {
60
- const url = new URL(config.authUrl);
61
- url.searchParams.set("client_id", config.clientId);
62
- url.searchParams.set("redirect_uri", redirectUri);
63
- url.searchParams.set("response_type", "code");
64
- url.searchParams.set("scope", scopes?.trim() || config.scopes);
65
- url.searchParams.set("state", state);
66
- for (const [key, value] of Object.entries(authorizeExtras)) {
67
- url.searchParams.set(key, value);
68
- }
69
- return url.toString();
70
- }
71
- async function exchangeCode(config, code, redirectUri, fetchImpl = fetch) {
72
- const tokenInit = tokenFormat === "json"
73
- ? {
74
- method: "POST",
75
- headers: {
76
- "Content-Type": "application/json",
77
- ...tokenHeaders,
78
- },
79
- body: JSON.stringify({
80
- client_id: config.clientId,
81
- client_secret: config.clientSecret,
82
- code,
83
- redirect_uri: redirectUri,
84
- }),
85
- }
86
- : {
87
- method: "POST",
88
- headers: {
89
- "Content-Type": "application/x-www-form-urlencoded",
90
- ...tokenHeaders,
91
- },
92
- body: new URLSearchParams({
93
- code,
94
- client_id: config.clientId,
95
- client_secret: config.clientSecret,
96
- redirect_uri: redirectUri,
97
- grant_type: "authorization_code",
98
- }),
99
- };
100
- const tokenResponse = await fetchWithTimeout(config.tokenUrl, tokenInit, PROVIDER_HTTP_TIMEOUT_MS, fetchImpl);
101
- const tokenJson = (await tokenResponse.json());
102
- if (!tokenResponse.ok || !tokenJson.access_token) {
103
- throw new Error(tokenJson.error_description ??
104
- tokenJson.error ??
105
- `${options.displayName} OAuth token exchange failed`);
106
- }
107
- let accountLabel;
108
- let subject;
109
- let extraMetadata;
110
- try {
111
- const userResponse = await fetchWithTimeout(config.userInfoUrl, {
112
- headers: {
113
- Authorization: `Bearer ${tokenJson.access_token}`,
114
- ...userInfoHeaders,
115
- },
116
- }, PROVIDER_HTTP_TIMEOUT_MS, fetchImpl);
117
- if (!userResponse.ok) {
118
- if (requireUserInfo) {
119
- const errJson = (await userResponse.json().catch(() => ({})));
120
- throw new Error(errJson.message ?? `${options.displayName} userinfo lookup failed`);
121
- }
122
- }
123
- else {
124
- const userJson = (await userResponse.json());
125
- const parsed = options.parseUserInfo(userJson);
126
- if (parsed.email) {
127
- accountLabel = parsed.email;
128
- }
129
- if (parsed.subject) {
130
- subject = parsed.subject;
131
- }
132
- if (parsed.metadata) {
133
- extraMetadata = parsed.metadata;
134
- }
135
- if (requireUserInfo && !subject) {
136
- throw new Error(`${options.displayName} userinfo missing subject`);
137
- }
138
- }
139
- }
140
- catch (error) {
141
- if (requireUserInfo) {
142
- throw error;
143
- }
144
- // Account label is optional for vault import.
145
- }
146
- const metadata = {
147
- ...extraMetadata,
148
- ...(subject ? { [options.subjectMetadataKey]: subject } : {}),
149
- };
150
- return {
151
- accessToken: tokenJson.access_token,
152
- ...(tokenJson.refresh_token
153
- ? { refreshToken: tokenJson.refresh_token }
154
- : {}),
155
- ...(typeof tokenJson.expires_in === "number"
156
- ? { expiresInSeconds: tokenJson.expires_in }
157
- : {}),
158
- ...(tokenJson.scope ? { scope: tokenJson.scope } : {}),
159
- ...(tokenJson.token_type ? { tokenType: tokenJson.token_type } : {}),
160
- ...(accountLabel ? { accountLabel } : {}),
161
- ...(Object.keys(metadata).length > 0 ? { metadata } : {}),
162
- };
163
- }
164
- const byo = {
165
- readConfig,
166
- buildAuthorizeUrl(config, state, redirectUri, scopes) {
167
- return buildAuthorizeUrl(config, state, redirectUri, scopes);
168
- },
169
- exchangeCode(config, code, redirectUri) {
170
- return exchangeCode(config, code, redirectUri);
171
- },
172
- };
173
- function resolvePublicAppUrl(env = process.env) {
174
- return (readConfig(env)?.publicAppUrl ??
175
- env[MDA_PUBLIC_APP_URL_ENV]?.trim().replace(/\/$/, ""));
176
- }
177
- return {
178
- providerId: options.providerId,
179
- displayName: options.displayName,
180
- env: keys,
181
- tickets,
182
- resolveRedirectBase: resolveOauthRedirectBase,
183
- readConfig,
184
- buildAuthorizeUrl,
185
- exchangeCode,
186
- byo,
187
- resolvePublicAppUrl,
188
- };
189
- }
190
- //# sourceMappingURL=byo-oauth.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"byo-oauth.js","sourceRoot":"","sources":["../../src/identity/byo-oauth.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAKhF,OAAO,EAAE,eAAe,EAAqB,MAAM,oBAAoB,CAAC;AACxE,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,wBAAwB,EACxB,6BAA6B,GAC9B,MAAM,gBAAgB,CAAC;AA4GxB,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,OAAO;QACL,QAAQ,EAAE,GAAG,MAAM,YAAY;QAC/B,YAAY,EAAE,GAAG,MAAM,gBAAgB;QACvC,MAA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AAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1D,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAuB;QAC9B,UAAU;QACV,iBAAiB,CAAC,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM;YAClD,OAAO,iBAAiB,CACtB,MAAwB,EACxB,KAAK,EACL,WAAW,EACX,MAAM,CACP,CAAC;QACJ,CAAC;QACD,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW;YACpC,OAAO,YAAY,CAAC,MAAwB,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QACnE,CAAC;KACF,CAAC;IAEF,SAAS,mBAAmB,CAC1B,GAAG,GAAsB,OAAO,CAAC,GAAG;QAEpC,OAAO,CACL,UAAU,CAAC,GAAG,CAAC,EAAE,YAAY;YAC7B,GAAG,CAAC,sBAAsB,CAAC,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACvD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,GAAG,EAAE,IAAI;QACT,OAAO;QACP,mBAAmB,EAAE,wBAAwB;QAC7C,UAAU;QACV,iBAAiB;QACjB,YAAY;QACZ,GAAG;QACH,mBAAmB;KACpB,CAAC;AACJ,CAAC"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Predicates the built-in Connect-with-X providers use to decide whether a
3
- * deployment needs their OAuth routes.
4
- *
5
- * Authors should not have to list a connect provider that the rest of their
6
- * identity already implies — a credential chain that reads user GitHub tokens
7
- * on a user-scoped deployment needs Connect-with-GitHub, and a Slack channel on
8
- * a per-user deployment needs somewhere to link Slack accounts.
9
- */
10
- import type { IdentityConnectMountContext } from "./connect-provider-types.js";
11
- export { FLEET_OAUTH_INTEGRATIONS, GOOGLE_TOOLSERVER_SLUGS, LINKEDIN_TOOLSERVER_SLUGS, MICROSOFT_TOOLSERVER_SLUGS, integrationConnectorKinds, integrationById, integrationForSlug, googleConnectorKinds, googleScopesForConnectorKinds, hasIntegrationToolServerConnector, hasGoogleToolServerConnector, hasLinkedInToolServerConnector, hasMicrosoftToolServerConnector, isFleetOAuthSlug, isGoogleToolServerSlug, isLinkedInToolServerSlug, isMicrosoftToolServerSlug, linkedinConnectorKinds, linkedinScopesForConnectorKinds, microsoftConnectorKinds, microsoftScopesForConnectorKinds, scopesForIntegrationConnectorKinds, type FleetOAuthIntegration, type GoogleToolServerSlug, type LinkedInToolServerSlug, type MicrosoftToolServerSlug, } from "../connectors/toolserver/integrations.js";
12
- /**
13
- * True when the deployment keys anything durable on the individual caller.
14
- *
15
- * This is the condition under which a per-user OAuth link is meaningful: an
16
- * `agent`-scoped deployment has no per-caller slice to attach a linked account
17
- * to, so it never grows connect routes by inference.
18
- */
19
- export declare function isUserScopedDeployment(scope: IdentityConnectMountContext["scope"]): boolean;
20
- /** True when a channel of `provider` is declared (e.g. a Slack channel). */
21
- export declare function hasChannelForProvider(channels: IdentityConnectMountContext["channels"], provider: string): boolean;
22
- /**
23
- * True when the deployment declares a connector whose kind is `"github"`.
24
- *
25
- * Retained for Connect-with-GitHub inference if a future surface reintroduces a
26
- * GitHub connector kind; today Connect mounts from `credentials.github` instead.
27
- */
28
- export declare function hasGithubConnector(connectorKinds: IdentityConnectMountContext["connectorKinds"]): boolean;
29
- /**
30
- * Connect provider ids the deployment's credential resolvers depend on.
31
- *
32
- * Unions across a per-target map, so a multi-platform deployment is treated the
33
- * same as a single-platform one.
34
- */
35
- export declare function credentialConnectIds(credentials: IdentityConnectMountContext["credentials"]): Set<string>;
36
- export declare function isGoogleConnectorKind(kind: string | undefined): boolean;
37
- //# sourceMappingURL=connect-inference.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-inference.d.ts","sourceRoot":"","sources":["../../src/identity/connect-inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAG/E,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,EAC7B,iCAAiC,EACjC,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,GAC7B,MAAM,0CAA0C,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,2BAA2B,CAAC,OAAO,CAAC,GAC1C,OAAO,CAOT;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,2BAA2B,CAAC,UAAU,CAAC,EACjD,QAAQ,EAAE,MAAM,GACf,OAAO,CAIT;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,2BAA2B,CAAC,gBAAgB,CAAC,GAC5D,OAAO,CAET;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,2BAA2B,CAAC,aAAa,CAAC,GACtD,GAAG,CAAC,MAAM,CAAC,CAIb;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAEvE"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Predicates the built-in Connect-with-X providers use to decide whether a
3
- * deployment needs their OAuth routes.
4
- *
5
- * Authors should not have to list a connect provider that the rest of their
6
- * identity already implies — a credential chain that reads user GitHub tokens
7
- * on a user-scoped deployment needs Connect-with-GitHub, and a Slack channel on
8
- * a per-user deployment needs somewhere to link Slack accounts.
9
- */
10
- import { isGoogleToolServerSlug } from "../connectors/toolserver/integrations.js";
11
- import { credentialConnectProviders } from "./credential-resolvers.js";
12
- export { FLEET_OAUTH_INTEGRATIONS, GOOGLE_TOOLSERVER_SLUGS, LINKEDIN_TOOLSERVER_SLUGS, MICROSOFT_TOOLSERVER_SLUGS, integrationConnectorKinds, integrationById, integrationForSlug, googleConnectorKinds, googleScopesForConnectorKinds, hasIntegrationToolServerConnector, hasGoogleToolServerConnector, hasLinkedInToolServerConnector, hasMicrosoftToolServerConnector, isFleetOAuthSlug, isGoogleToolServerSlug, isLinkedInToolServerSlug, isMicrosoftToolServerSlug, linkedinConnectorKinds, linkedinScopesForConnectorKinds, microsoftConnectorKinds, microsoftScopesForConnectorKinds, scopesForIntegrationConnectorKinds, } from "../connectors/toolserver/integrations.js";
13
- /**
14
- * True when the deployment keys anything durable on the individual caller.
15
- *
16
- * This is the condition under which a per-user OAuth link is meaningful: an
17
- * `agent`-scoped deployment has no per-caller slice to attach a linked account
18
- * to, so it never grows connect routes by inference.
19
- */
20
- export function isUserScopedDeployment(scope) {
21
- if (!scope) {
22
- return false;
23
- }
24
- // Per-caller Connect is meaningful when credentials are owned by the caller
25
- // (`"user"`) or a custom resolver. Memory isolation is a separate axis.
26
- return scope.credentials === "user" || scope.credentials === "custom";
27
- }
28
- /** True when a channel of `provider` is declared (e.g. a Slack channel). */
29
- export function hasChannelForProvider(channels, provider) {
30
- return Object.values(channels ?? {}).some((manifest) => manifest?.provider === provider);
31
- }
32
- /**
33
- * True when the deployment declares a connector whose kind is `"github"`.
34
- *
35
- * Retained for Connect-with-GitHub inference if a future surface reintroduces a
36
- * GitHub connector kind; today Connect mounts from `credentials.github` instead.
37
- */
38
- export function hasGithubConnector(connectorKinds) {
39
- return (connectorKinds ?? []).some((kind) => kind === "github");
40
- }
41
- /**
42
- * Connect provider ids the deployment's credential resolvers depend on.
43
- *
44
- * Unions across a per-target map, so a multi-platform deployment is treated the
45
- * same as a single-platform one.
46
- */
47
- export function credentialConnectIds(credentials) {
48
- return new Set(credentialConnectProviders(credentials).map((provider) => provider.id));
49
- }
50
- export function isGoogleConnectorKind(kind) {
51
- return isGoogleToolServerSlug(kind);
52
- }
53
- //# sourceMappingURL=connect-inference.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-inference.js","sourceRoot":"","sources":["../../src/identity/connect-inference.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAElF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAEvE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,0BAA0B,EAC1B,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,6BAA6B,EAC7B,iCAAiC,EACjC,4BAA4B,EAC5B,8BAA8B,EAC9B,+BAA+B,EAC/B,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,yBAAyB,EACzB,sBAAsB,EACtB,+BAA+B,EAC/B,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,GAKnC,MAAM,0CAA0C,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAA2C;IAE3C,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,4EAA4E;IAC5E,wEAAwE;IACxE,OAAO,KAAK,CAAC,WAAW,KAAK,MAAM,IAAI,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC;AACxE,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,qBAAqB,CACnC,QAAiD,EACjD,QAAgB;IAEhB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,CACvC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,cAA6D;IAE7D,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,WAAuD;IAEvD,OAAO,IAAI,GAAG,CACZ,0BAA0B,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CACvE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAwB;IAC5D,OAAO,sBAAsB,CAAC,IAAI,CAAC,CAAC;AACtC,CAAC"}
@@ -1,8 +0,0 @@
1
- /** Path helpers for Connect-with-X providers under `/identity/{id}/…`. */
2
- export declare function identityConnectPaths(id: string): {
3
- status: string;
4
- connect: string;
5
- callback: string;
6
- link: string;
7
- };
8
- //# sourceMappingURL=connect-paths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-paths.d.ts","sourceRoot":"","sources":["../../src/identity/connect-paths.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd,CAQA"}
@@ -1,11 +0,0 @@
1
- /** Path helpers for Connect-with-X providers under `/identity/{id}/…`. */
2
- export function identityConnectPaths(id) {
3
- const base = `/identity/${id}`;
4
- return {
5
- status: `${base}/status`,
6
- connect: `${base}/connect`,
7
- callback: `${base}/callback`,
8
- link: `${base}/link`,
9
- };
10
- }
11
- //# sourceMappingURL=connect-paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-paths.js","sourceRoot":"","sources":["../../src/identity/connect-paths.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAE1E,MAAM,UAAU,oBAAoB,CAAC,EAAU;IAM7C,MAAM,IAAI,GAAG,aAAa,EAAE,EAAE,CAAC;IAC/B,OAAO;QACL,MAAM,EAAE,GAAG,IAAI,SAAS;QACxB,OAAO,EAAE,GAAG,IAAI,UAAU;QAC1B,QAAQ,EAAE,GAAG,IAAI,WAAW;QAC5B,IAAI,EAAE,GAAG,IAAI,OAAO;KACrB,CAAC;AACJ,CAAC"}