@mastra/connect 1.1.0-alpha.5 → 1.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +29 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/connect-prompt-tool.d.ts +58 -0
- package/dist/connect-prompt-tool.d.ts.map +1 -0
- package/dist/index.cjs +251 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +251 -38
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +11 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/user-connect-page.d.ts +5 -3
- package/dist/user-connect-page.d.ts.map +1 -1
- package/dist/user-connect-routes.d.ts +8 -4
- package/dist/user-connect-routes.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/tools.d.ts
CHANGED
|
@@ -97,6 +97,17 @@ export interface ToolsOptions {
|
|
|
97
97
|
* resolves global-only.
|
|
98
98
|
*/
|
|
99
99
|
resourceId?: string | ((ctx?: ToolsResolverContext) => string | undefined | Promise<string | undefined>);
|
|
100
|
+
/**
|
|
101
|
+
* Whether resource-scoped resolutions include the built-in
|
|
102
|
+
* `request_connection` tool, which lets the agent prompt the end user to
|
|
103
|
+
* connect a provider account mid-conversation (chat UIs render its
|
|
104
|
+
* structured output as a connect card). The connectable set follows the
|
|
105
|
+
* `providers` allowlist when one was given. Otherwise it uses the project's
|
|
106
|
+
* provider configuration in Mastra Platform, with the full catalog only when
|
|
107
|
+
* that configuration is unset. Default `true`; global-only resolutions never
|
|
108
|
+
* include it (there is no end user to scope a new connection to).
|
|
109
|
+
*/
|
|
110
|
+
connectPrompt?: boolean;
|
|
100
111
|
}
|
|
101
112
|
type ResolvedToolsRecord = Record<string, {
|
|
102
113
|
id: string;
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAA8D,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAA8D,MAAM,aAAa,CAAC;AA0BpH,UAAU,wBAAwB;IAChC,wGAAwG;IACxG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;CACtC;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CACI;IACE;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,GACD;IACE,UAAU,CAAC,EAAE,KAAK,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,CACJ,CAAC;AAEJ,MAAM,WAAW,YAAY;IAC3B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,oBAAoB,CAAC,CAAC;IACtE;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,kFAAkF;IAClF,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IACrC,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,mHAAmH;IACnH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,EAA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E;AAClE,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED,sEAAsE;AACtE,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,IAAI,CAAC,CAIrE;AAmPD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,iBAAsB,GAAG,aAAa,CAyGpE"}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The page only ever talks to the mounted routes on the same origin — it never
|
|
5
5
|
* sees a platform token. OAuth and credential collection happen inside the
|
|
6
|
-
*
|
|
6
|
+
* launch gate (`{basePath}/connections/:id/launch`) in a popup, so no
|
|
7
7
|
* vendor SDK is bundled here. Flow: explicit Connect click → POST sessions →
|
|
8
|
-
* popup to `
|
|
9
|
-
*
|
|
8
|
+
* popup to the session's `launchUrl` (the server verifies the caller owns the
|
|
9
|
+
* pending session, then 302s into the vendor OAuth flow) → poll status every
|
|
10
|
+
* 2s (5 min cap) → redirect to the validated `returnTo` (or show a success
|
|
11
|
+
* state when none was given).
|
|
10
12
|
*/
|
|
11
13
|
export interface ConnectPageProvider {
|
|
12
14
|
id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-connect-page.d.ts","sourceRoot":"","sources":["../src/user-connect-page.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"user-connect-page.d.ts","sourceRoot":"","sources":["../src/user-connect-page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAkCD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAkJnE"}
|
|
@@ -14,11 +14,15 @@ export interface UserConnectIdentityContext {
|
|
|
14
14
|
}
|
|
15
15
|
export interface UserConnectRoutesOptions {
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Code-level allowlist of platform integration ids exposed to end users
|
|
18
|
+
* (e.g. `['linear', 'slack']`). Providers outside the set 404 on every
|
|
19
|
+
* mounted route. This overrides the project's provider configuration in
|
|
20
|
+
* Mastra Platform. Omit it to use that project configuration (`null` means
|
|
21
|
+
* the full catalog; an empty platform list disables all providers). An
|
|
22
|
+
* explicit empty code array is rejected: pass a real allowlist or configure
|
|
23
|
+
* the project in Mastra Platform.
|
|
20
24
|
*/
|
|
21
|
-
providers
|
|
25
|
+
providers?: string[];
|
|
22
26
|
/**
|
|
23
27
|
* Derives the caller's end-user resource key per request. Defaults to the
|
|
24
28
|
* server-derived `MASTRA_RESOURCE_ID_KEY`, which `server.auth.mapUserToResourceId`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-connect-routes.d.ts","sourceRoot":"","sources":["../src/user-connect-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"user-connect-routes.d.ts","sourceRoot":"","sources":["../src/user-connect-routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAYpD,OAAO,KAAK,EAAE,oBAAoB,EAA8D,MAAM,aAAa,CAAC;AAIpH;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IACzC,2FAA2F;IAC3F,cAAc,CAAC,EAAE;QAAE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IAC/C,qGAAqG;IACrG,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACnG,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6FAA6F;IAC7F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qGAAqG;IACrG,MAAM,CAAC,EAAE,oBAAoB,CAAC;IAC9B,QAAQ,CAAC,EAAE;QACT;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,CAAC;CACH;AA4FD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,cAAc,EAAE,MAAM,EAAE,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,CAkCpD;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,QAAQ,EAAE,CA4V/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/connect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0-alpha.0",
|
|
4
4
|
"description": "Use Mastra platform integration connections as agent toolsets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -51,21 +51,21 @@
|
|
|
51
51
|
"hono": "^4.13.7",
|
|
52
52
|
"prettier": "3.9.5",
|
|
53
53
|
"ts-morph": "^27.0.2",
|
|
54
|
-
"tsdown": "0.
|
|
54
|
+
"tsdown": "0.23.1",
|
|
55
55
|
"tsx": "^4.23.1",
|
|
56
56
|
"typescript": "^7.0.2",
|
|
57
57
|
"vitest": "4.1.11",
|
|
58
58
|
"zod": "^4.6.7",
|
|
59
|
-
"@internal/lint": "0.0.
|
|
60
|
-
"@internal/types-builder": "0.0.
|
|
61
|
-
"@mastra/core": "1.
|
|
59
|
+
"@internal/lint": "0.0.145",
|
|
60
|
+
"@internal/types-builder": "0.0.120",
|
|
61
|
+
"@mastra/core": "1.80.0-alpha.0"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@mastra/
|
|
65
|
-
"@mastra/mcp": "^2.
|
|
66
|
-
"@mastra/telegram": "^0.2.3
|
|
67
|
-
"@mastra/
|
|
68
|
-
"@mastra/teams": "^0.1.2
|
|
64
|
+
"@mastra/discord": "^1.3.1",
|
|
65
|
+
"@mastra/mcp": "^2.6.0-alpha.0",
|
|
66
|
+
"@mastra/telegram": "^0.2.3",
|
|
67
|
+
"@mastra/slack": "^1.8.0-alpha.0",
|
|
68
|
+
"@mastra/teams": "^0.1.2"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"add-provider": "tsx scripts/add-provider.ts",
|