@mastra/connect 1.0.0-alpha.2 → 1.0.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/README.md +47 -42
- package/dist/channels.d.ts +38 -22
- package/dist/channels.d.ts.map +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/index.cjs +454 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -281
- package/dist/index.js.map +1 -1
- package/dist/instrumentation.d.ts +48 -0
- package/dist/instrumentation.d.ts.map +1 -0
- package/dist/multi-connection.d.ts.map +1 -1
- package/dist/providers/jira/tools/get-create-issue-metadata.d.ts +42 -0
- package/dist/providers/jira/tools/get-create-issue-metadata.d.ts.map +1 -1
- package/dist/providers/jira/tools/list-issue-types.d.ts +6 -2
- package/dist/providers/jira/tools/list-issue-types.d.ts.map +1 -1
- package/dist/registry.d.ts +1 -8
- package/dist/registry.d.ts.map +1 -1
- package/dist/resolution.d.ts +3 -11
- package/dist/resolution.d.ts.map +1 -1
- package/dist/tools.d.ts +85 -29
- package/dist/tools.d.ts.map +1 -1
- package/dist/toolset.d.ts +39 -13
- package/dist/toolset.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/connect.d.ts +0 -22
- package/dist/connect.d.ts.map +0 -1
- package/dist/environment.d.ts +0 -48
- package/dist/environment.d.ts.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { SpanType } from '@mastra/core/observability';
|
|
2
|
+
import type { Span } from '@mastra/core/observability';
|
|
3
|
+
/**
|
|
4
|
+
* Observability for outbound connect HTTP: every platform API call and every
|
|
5
|
+
* vendor call routed through the connection proxy gets a GENERIC child span
|
|
6
|
+
* under the ambient current span (the TOOL_CALL span during tool execution,
|
|
7
|
+
* or whatever span is active during resolver refreshes).
|
|
8
|
+
*
|
|
9
|
+
* Resolution uses core's browser-safe `resolveCurrentSpan`, which returns
|
|
10
|
+
* `undefined` until the Mastra constructor initializes context storage — so
|
|
11
|
+
* apps without observability configured pay nothing and nothing throws.
|
|
12
|
+
*
|
|
13
|
+
* Privacy invariant: spans carry method, a safe route template, connection id,
|
|
14
|
+
* and response status only. Never record query strings, headers, request
|
|
15
|
+
* bodies, response bodies, or vendor path segments — proxy paths are built by
|
|
16
|
+
* generated templates and can embed credentials or resource identifiers (e.g.
|
|
17
|
+
* HubSpot's whoami interpolates the access token into its endpoint path).
|
|
18
|
+
*/
|
|
19
|
+
export interface PlatformCallDescriptor {
|
|
20
|
+
method: string;
|
|
21
|
+
/**
|
|
22
|
+
* Safe route template: connection/project ids replaced with placeholders
|
|
23
|
+
* and everything after `/proxy/` collapsed to `*` so vendor-controlled
|
|
24
|
+
* path segments (which may embed secrets or PII) never enter spans.
|
|
25
|
+
*/
|
|
26
|
+
route: string;
|
|
27
|
+
isProxy: boolean;
|
|
28
|
+
connectionId?: string;
|
|
29
|
+
projectId?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Describes a platform request for span naming without leaking query params, ids, or vendor path segments. */
|
|
32
|
+
export declare function describePlatformCall(method: string, rawPath: string): PlatformCallDescriptor;
|
|
33
|
+
/**
|
|
34
|
+
* Starts a GENERIC child span for an outbound connect HTTP call, or returns
|
|
35
|
+
* `undefined` when no ambient span is active. Span creation failures are
|
|
36
|
+
* swallowed: instrumentation must never break a request.
|
|
37
|
+
*/
|
|
38
|
+
export declare function startPlatformCallSpan(descriptor: PlatformCallDescriptor): Span<SpanType.GENERIC> | undefined;
|
|
39
|
+
/** Ends a platform-call span with the response status. Never throws. */
|
|
40
|
+
export declare function endPlatformCallSpan(span: Span<SpanType.GENERIC> | undefined, status: number): void;
|
|
41
|
+
/**
|
|
42
|
+
* Records a transport-level failure on a platform-call span. Nothing from the
|
|
43
|
+
* original error is recorded — fetch failures can embed the request URL in
|
|
44
|
+
* both `message` and `name`, which may carry secret query params — so the
|
|
45
|
+
* span gets a fixed, constant error. Never throws.
|
|
46
|
+
*/
|
|
47
|
+
export declare function errorPlatformCallSpan(span: Span<SpanType.GENERIC> | undefined, _error: unknown): void;
|
|
48
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../src/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AASD,+GAA+G;AAC/G,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAqB5F;AAUD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,sBAAsB,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,CAkB5G;AAED,wEAAwE;AACxE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAOlG;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,SAAS,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAOrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multi-connection.d.ts","sourceRoot":"","sources":["../src/multi-connection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAA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AAE,yBAAyB,CAAC;IACxC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B,GAAG,UAAU,CAyCb;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,YAAY,EAAE,uBAAuB,CAAC;IACtC,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAC;IACrC,MAAM,EAAE,cAAc,CAAC;IACvB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IAC5F,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,UAAU,CAAC,CAyHtB"}
|
|
@@ -13,6 +13,27 @@ export declare const getCreateIssueMetadataOutputSchema: z.ZodObject<{
|
|
|
13
13
|
name: z.ZodString;
|
|
14
14
|
self: z.ZodOptional<z.ZodString>;
|
|
15
15
|
avatarUrls: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
16
|
+
issuetypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
self: z.ZodOptional<z.ZodString>;
|
|
20
|
+
description: z.ZodOptional<z.ZodString>;
|
|
21
|
+
iconUrl: z.ZodOptional<z.ZodString>;
|
|
22
|
+
avatarId: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
subtask: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
hierarchyLevel: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
fields: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
26
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
27
|
+
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
28
|
+
name: z.ZodOptional<z.ZodString>;
|
|
29
|
+
key: z.ZodOptional<z.ZodString>;
|
|
30
|
+
hasDefaultValue: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
operations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
32
|
+
allowedValues: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
33
|
+
defaultValue: z.ZodOptional<z.ZodUnknown>;
|
|
34
|
+
autoCompleteUrl: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>>>;
|
|
36
|
+
}, z.core.$strip>>>;
|
|
16
37
|
}, z.core.$strip>>>;
|
|
17
38
|
}, z.core.$strip>;
|
|
18
39
|
export declare function getCreateIssueMetadataTool(proxy: PlatformProxy): import("@mastra/core/tools").Tool<{
|
|
@@ -27,6 +48,27 @@ export declare function getCreateIssueMetadataTool(proxy: PlatformProxy): import
|
|
|
27
48
|
name: string;
|
|
28
49
|
self?: string | undefined;
|
|
29
50
|
avatarUrls?: Record<string, string> | undefined;
|
|
51
|
+
issuetypes?: {
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
self?: string | undefined;
|
|
55
|
+
description?: string | undefined;
|
|
56
|
+
iconUrl?: string | undefined;
|
|
57
|
+
avatarId?: number | undefined;
|
|
58
|
+
subtask?: boolean | undefined;
|
|
59
|
+
hierarchyLevel?: number | undefined;
|
|
60
|
+
fields?: Record<string, {
|
|
61
|
+
required?: boolean | undefined;
|
|
62
|
+
schema?: Record<string, unknown> | undefined;
|
|
63
|
+
name?: string | undefined;
|
|
64
|
+
key?: string | undefined;
|
|
65
|
+
hasDefaultValue?: boolean | undefined;
|
|
66
|
+
operations?: string[] | undefined;
|
|
67
|
+
allowedValues?: unknown[] | undefined;
|
|
68
|
+
defaultValue?: unknown;
|
|
69
|
+
autoCompleteUrl?: string | undefined;
|
|
70
|
+
}> | undefined;
|
|
71
|
+
}[] | undefined;
|
|
30
72
|
}[] | undefined;
|
|
31
73
|
}, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, "jira_get_create_issue_metadata", unknown>;
|
|
32
74
|
//# sourceMappingURL=get-create-issue-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-create-issue-metadata.d.ts","sourceRoot":"","sources":["../../../../src/providers/jira/tools/get-create-issue-metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,eAAO,MAAM,iCAAiC;;;;;iBAa5C,CAAC;
|
|
1
|
+
{"version":3,"file":"get-create-issue-metadata.d.ts","sourceRoot":"","sources":["../../../../src/providers/jira/tools/get-create-issue-metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAExE,eAAO,MAAM,iCAAiC;;;;;iBAa5C,CAAC;AAuCH,eAAO,MAAM,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAE7C,CAAC;AAEH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8IA8D9D"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { PlatformProxy } from '../../../runtime/platform-proxy.js';
|
|
3
|
-
export declare const listIssueTypesInputSchema: z.ZodObject<{
|
|
3
|
+
export declare const listIssueTypesInputSchema: z.ZodObject<{
|
|
4
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}, z.core.$strip>;
|
|
4
6
|
export declare const listIssueTypesOutputSchema: z.ZodObject<{
|
|
5
7
|
issueTypes: z.ZodArray<z.ZodObject<{
|
|
6
8
|
id: z.ZodString;
|
|
@@ -12,7 +14,9 @@ export declare const listIssueTypesOutputSchema: z.ZodObject<{
|
|
|
12
14
|
hierarchyLevel: z.ZodOptional<z.ZodNumber>;
|
|
13
15
|
}, z.core.$strip>>;
|
|
14
16
|
}, z.core.$strip>;
|
|
15
|
-
export declare function listIssueTypesTool(proxy: PlatformProxy): import("@mastra/core/tools").Tool<
|
|
17
|
+
export declare function listIssueTypesTool(proxy: PlatformProxy): import("@mastra/core/tools").Tool<{
|
|
18
|
+
projectId?: string | undefined;
|
|
19
|
+
}, {
|
|
16
20
|
issueTypes: {
|
|
17
21
|
id: string;
|
|
18
22
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-issue-types.d.ts","sourceRoot":"","sources":["../../../../src/providers/jira/tools/list-issue-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,oCAAoC,CAAC;AAO9F,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"list-issue-types.d.ts","sourceRoot":"","sources":["../../../../src/providers/jira/tools/list-issue-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,oCAAoC,CAAC;AAO9F,eAAO,MAAM,yBAAyB;;iBAEpC,CAAC;AAYH,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAYrC,CAAC;AAUH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,aAAa;;;;;;;;;;;;qIAsGtD"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ProviderToolsOptions } from './toolset.js';
|
|
|
4
4
|
interface ProviderRegistrationBase {
|
|
5
5
|
/** Platform catalog id used to match project connections. */
|
|
6
6
|
integrationId: string;
|
|
7
|
-
/**
|
|
7
|
+
/** Legacy connection-id env fallback; kept working but intentionally undocumented. */
|
|
8
8
|
envVar: string;
|
|
9
9
|
}
|
|
10
10
|
/** A provider whose checked-in tools call the Platform HTTP proxy. */
|
|
@@ -21,19 +21,12 @@ export type ProviderRegistration = ProxyProviderRegistration | McpProviderRegist
|
|
|
21
21
|
* Providers with checked-in HTTP toolsets. MCP-backed providers are discovered
|
|
22
22
|
* from the Platform integration catalog at runtime.
|
|
23
23
|
*/
|
|
24
|
-
export declare const TOOLS: readonly ProviderRegistration[];
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use `TOOLS`. This alias is retained for one release cycle so
|
|
27
|
-
* downstream consumers keep working; it will be removed in the next minor.
|
|
28
|
-
*/
|
|
29
24
|
export declare const PROVIDERS: readonly ProviderRegistration[];
|
|
30
|
-
export declare function findRegistration(integrationId: string): ProviderRegistration | undefined;
|
|
31
25
|
/**
|
|
32
26
|
* Channel-capable providers with a hand-maintained `channels()` registration.
|
|
33
27
|
* The launch ships three (Slack, Telegram, Discord); the provider generator
|
|
34
28
|
* grows to cover new entries when a fourth lands.
|
|
35
29
|
*/
|
|
36
30
|
export declare const CHANNELS: readonly ChannelProviderRegistration[];
|
|
37
|
-
export declare function findChannelRegistration(integrationId: string): ChannelProviderRegistration | undefined;
|
|
38
31
|
export {};
|
|
39
32
|
//# sourceMappingURL=registry.d.ts.map
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAGnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,wBAAwB;IAChC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAGnF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEzD,UAAU,wBAAwB;IAChC,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,sEAAsE;AACtE,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACzE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,oBAAoB,KAAK,UAAU,CAAC;CAC7D;AAED,iFAAiF;AACjF,MAAM,WAAW,uBAAwB,SAAQ,wBAAwB;IACvE,SAAS,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,oBAAoB,GAAG,yBAAyB,GAAG,uBAAuB,CAAC;AAEvF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,SAAS,oBAAoB,EAAwB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,2BAA2B,EAAkB,CAAC"}
|
package/dist/resolution.d.ts
CHANGED
|
@@ -3,22 +3,14 @@ import type { NamedConnection } from './multi-connection.js';
|
|
|
3
3
|
/** Identifies one provider's connection-resolution inputs. */
|
|
4
4
|
export interface ConnectionRequest {
|
|
5
5
|
integrationId: string;
|
|
6
|
-
/**
|
|
6
|
+
/** Legacy connection-id env fallback; kept working but intentionally undocumented. */
|
|
7
7
|
envVar: string;
|
|
8
8
|
/** Pinned connection id from per-integration options. */
|
|
9
9
|
connectionId?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function validateProviderIds(providers: Record<string, unknown> | undefined): void;
|
|
12
12
|
export declare function connectionIdEnvVar(integrationId: string): string;
|
|
13
13
|
export declare function groupByIntegrationId(connections: ProjectConnection[]): Map<string, ProjectConnection[]>;
|
|
14
|
-
/**
|
|
15
|
-
* Resolves the connection to use for one provider, per the contract:
|
|
16
|
-
* option/env var wins; else a single active connection; anything else
|
|
17
|
-
* (ambiguity, needs_reauth, no usable candidate) warns and skips so one bad
|
|
18
|
-
* integration never takes down the whole resolution. A needs_reauth
|
|
19
|
-
* connection is never silently mapped.
|
|
20
|
-
*/
|
|
21
|
-
export declare function resolveConnection(request: ConnectionRequest, candidates: ProjectConnection[]): string | undefined;
|
|
22
14
|
/**
|
|
23
15
|
* Discriminated resolution of one provider request against its candidate
|
|
24
16
|
* connections. `single` maps to unwrapped tools with the connection id baked
|
|
@@ -36,7 +28,7 @@ export type ProviderResolution = {
|
|
|
36
28
|
};
|
|
37
29
|
/**
|
|
38
30
|
* Resolves how to configure one provider given its candidate connections:
|
|
39
|
-
* - An explicit pin (
|
|
31
|
+
* - An explicit pin (`connectionId`) forces `single` at that id.
|
|
40
32
|
* - Exactly one active connection → `single`.
|
|
41
33
|
* - Two or more active connections → `multi`; the caller wraps tools with
|
|
42
34
|
* `connection_name` so the agent chooses per call at execute time.
|
package/dist/resolution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../src/resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB
|
|
1
|
+
{"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../src/resolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAG7D,8DAA8D;AAC9D,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAID,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CASxF;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,iBAAiB,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAQvG;AAED;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,eAAe,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAErB;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,iBAAiB,EAC1B,UAAU,EAAE,iBAAiB,EAAE,GAC9B,kBAAkB,CAmCpB"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConnectClientOptions } from './client.js';
|
|
2
|
-
interface
|
|
2
|
+
interface ToolsProviderOptionsBase {
|
|
3
3
|
/** Pin a specific connection id (bypasses env-var fallback and single-active-connection resolution). */
|
|
4
4
|
connectionId?: string;
|
|
5
5
|
/**
|
|
@@ -7,13 +7,13 @@ interface ToolsIntegrationOptionsBase {
|
|
|
7
7
|
* and checked-in HTTP tools alike. Tools do not require approval by
|
|
8
8
|
* default, matching `@mastra/mcp`'s own default. Pass `true` to require
|
|
9
9
|
* approval for every tool on this provider, or an array of tool keys to
|
|
10
|
-
* require approval only for those tools
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* require approval only for those tools; entries containing `*` are globs
|
|
11
|
+
* (e.g. `'linear_delete_*'`). Unknown names and globs that match nothing
|
|
12
|
+
* fail resolution with an `invalid_options` error so a typo never
|
|
13
|
+
* silently widens access. (Explicit `false` is equivalent to omitting the
|
|
14
|
+
* option.)
|
|
13
15
|
*/
|
|
14
16
|
requireApproval?: boolean | string[];
|
|
15
|
-
/** Exclude this provider entirely, even if a connection exists. */
|
|
16
|
-
disabled?: boolean;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Per-provider overrides. `allowTools` and `disallowTools` are mutually
|
|
@@ -21,30 +21,65 @@ interface ToolsIntegrationOptionsBase {
|
|
|
21
21
|
* accidental co-occurrence in typed object literals; `tools()` also
|
|
22
22
|
* validates at build time so loosely typed callers get a clear error.
|
|
23
23
|
*/
|
|
24
|
-
export type
|
|
25
|
-
/**
|
|
24
|
+
export type ToolsProviderOptions = ToolsProviderOptionsBase & ({
|
|
25
|
+
/**
|
|
26
|
+
* Restrict the returned toolset to these tool keys. Entries containing
|
|
27
|
+
* `*` are globs (e.g. `'linear_get_*'`). Unknown names and globs that
|
|
28
|
+
* match nothing throw at build time.
|
|
29
|
+
*/
|
|
26
30
|
allowTools?: string[];
|
|
27
31
|
disallowTools?: never;
|
|
28
32
|
} | {
|
|
29
33
|
allowTools?: never;
|
|
30
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* Remove these tool keys from the returned toolset. Entries containing
|
|
36
|
+
* `*` are globs (e.g. `'linear_delete_*'`). Unknown names and globs
|
|
37
|
+
* that match nothing throw at build time.
|
|
38
|
+
*/
|
|
31
39
|
disallowTools?: string[];
|
|
32
40
|
});
|
|
33
41
|
export interface ToolsOptions {
|
|
34
42
|
/** Platform project whose connections to discover. Falls back to MASTRA_PROJECT_ID. */
|
|
35
43
|
projectId?: string;
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
38
|
-
* - `["linear", "github"]` —
|
|
39
|
-
* with
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
45
|
+
* Which providers to resolve, in one of two shapes:
|
|
46
|
+
* - `["linear", "github"]` — an allowlist: only the listed providers
|
|
47
|
+
* resolve, with default options. Anything else connected to the project
|
|
48
|
+
* is ignored.
|
|
49
|
+
* - `{ linear: true, github: { allowTools: [...] }, notion: false }` —
|
|
50
|
+
* per-provider configuration. Every connected provider still resolves
|
|
51
|
+
* unless excluded: `true` (or `{}`) enables with defaults, `false`
|
|
52
|
+
* excludes, and an options object configures tool filters, approval
|
|
53
|
+
* policy, or a pinned connection. Each provider may set at most one of
|
|
54
|
+
* `allowTools` and `disallowTools`; supplying both throws.
|
|
43
55
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
56
|
+
* Omit the option entirely to resolve every provider the project has a
|
|
57
|
+
* connection for.
|
|
58
|
+
*/
|
|
59
|
+
providers?: string[] | Record<string, boolean | ToolsProviderOptions>;
|
|
60
|
+
/**
|
|
61
|
+
* Default tool filter applied to every provider that does not set its own
|
|
62
|
+
* `allowTools`/`disallowTools`. Entries containing `*` are globs. Unlike
|
|
63
|
+
* the per-provider filters, defaults apply leniently: an entry that
|
|
64
|
+
* matches nothing on a given provider simply does not apply there (the
|
|
65
|
+
* provider set is live, so a default like `['*_get_*']` must tolerate
|
|
66
|
+
* providers without matching tools). An entry that matches nothing across
|
|
67
|
+
* the whole resolution logs a warning. Mutually exclusive with
|
|
68
|
+
* `disallowTools`. A provider that sets either filter option opts out of
|
|
69
|
+
* both defaults.
|
|
70
|
+
*/
|
|
71
|
+
allowTools?: string[];
|
|
72
|
+
/** Default disallow filter; see {@link ToolsOptions.allowTools} for semantics. */
|
|
73
|
+
disallowTools?: string[];
|
|
74
|
+
/**
|
|
75
|
+
* Default tool-approval policy applied to every provider that does not set
|
|
76
|
+
* its own `requireApproval`. `true` gates every tool (except the synthetic
|
|
77
|
+
* `<provider>__list_connections` wrappers); an array gates matching keys,
|
|
78
|
+
* with the same lenient glob semantics as the default filters. A provider
|
|
79
|
+
* can opt out of a global `requireApproval: true` with
|
|
80
|
+
* `requireApproval: false`.
|
|
46
81
|
*/
|
|
47
|
-
|
|
82
|
+
requireApproval?: boolean | string[];
|
|
48
83
|
client?: ConnectClientOptions;
|
|
49
84
|
/** How long a resolved snapshot stays fresh, in milliseconds. Default 30_000. `0` revalidates every resolution. */
|
|
50
85
|
ttlMs?: number;
|
|
@@ -52,33 +87,54 @@ export interface ToolsOptions {
|
|
|
52
87
|
type ResolvedToolsRecord = Record<string, {
|
|
53
88
|
id: string;
|
|
54
89
|
}>;
|
|
90
|
+
/** Context Mastra passes when invoking the resolver as a dynamic `tools` argument. */
|
|
91
|
+
export interface ToolsResolverContext {
|
|
92
|
+
requestContext?: unknown;
|
|
93
|
+
mastra?: unknown;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Tools accepted by {@link ToolsResolver.with}: a static tool record (e.g.
|
|
97
|
+
* `createTool()` outputs) or a function — sync or async, optionally reading
|
|
98
|
+
* the per-request context — returning one.
|
|
99
|
+
*/
|
|
100
|
+
export type ToolsWithInput = Record<string, {
|
|
101
|
+
id: string;
|
|
102
|
+
}> | ((ctx?: ToolsResolverContext) => Record<string, {
|
|
103
|
+
id: string;
|
|
104
|
+
}> | Promise<Record<string, {
|
|
105
|
+
id: string;
|
|
106
|
+
}>>);
|
|
55
107
|
/**
|
|
56
108
|
* Live tool resolver returned by `tools()`. Pass it straight to an agent's
|
|
57
|
-
* dynamic `tools` argument: Mastra calls it per generate/stream, so
|
|
58
|
-
*
|
|
109
|
+
* dynamic `tools` argument: Mastra calls it per generate/stream, so providers
|
|
110
|
+
* connected or disconnected on the platform are reflected without
|
|
59
111
|
* restarting the server. Call it directly (`await tools()`) when you need the
|
|
60
112
|
* current flat tool record.
|
|
61
113
|
*/
|
|
62
114
|
export interface ToolsResolver {
|
|
63
|
-
(ctx?:
|
|
64
|
-
requestContext?: unknown;
|
|
65
|
-
mastra?: unknown;
|
|
66
|
-
}): Promise<ResolvedToolsRecord>;
|
|
67
|
-
/** Drops the cached snapshot; the next resolution fetches fresh from the platform. */
|
|
68
|
-
invalidate(): void;
|
|
115
|
+
(ctx?: ToolsResolverContext): Promise<ResolvedToolsRecord>;
|
|
69
116
|
/** Fetches tools from the platform now and updates the cache. Rejects if the platform fetch fails. */
|
|
70
117
|
refresh(): Promise<ResolvedToolsRecord>;
|
|
71
118
|
/** Closes MCP transports owned by this resolver and clears its cached snapshot. */
|
|
72
119
|
disconnect(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Returns a new resolver that merges `extra` tools into every resolution,
|
|
122
|
+
* so an agent can combine its own tools with connect tools in one
|
|
123
|
+
* expression: `tools: connectTools.with({ weatherTool })`. On a key
|
|
124
|
+
* collision the extra tools win — connect keys are provider-prefixed, so
|
|
125
|
+
* collisions only happen deliberately. The cache handles (`refresh`,
|
|
126
|
+
* `disconnect`) delegate to the base resolver, and `.with()` calls chain.
|
|
127
|
+
*/
|
|
128
|
+
with(extra: ToolsWithInput): ToolsResolver;
|
|
73
129
|
}
|
|
74
130
|
/**
|
|
75
131
|
* Returns a live toolset resolver over the project's Platform connections.
|
|
76
|
-
* HTTP providers are loaded from the shipped `
|
|
132
|
+
* HTTP providers are loaded from the shipped `PROVIDERS` registry. MCP providers
|
|
77
133
|
* are discovered from the Platform integration catalog. Tools from every supported
|
|
78
134
|
* provider with a matching project connection are merged into one flat record
|
|
79
135
|
* (matched by `integrationId`). The resolver serves a cached snapshot,
|
|
80
|
-
* revalidating from the platform every `ttlMs`, so
|
|
81
|
-
* to (or
|
|
136
|
+
* revalidating from the platform every `ttlMs`, so providers connected
|
|
137
|
+
* to (or disconnected from) the project are picked up (or dropped) without a
|
|
82
138
|
* restart.
|
|
83
139
|
*
|
|
84
140
|
* Configuration errors (missing project id, bad ttlMs, malformed integration id,
|
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;AAkBpH,UAAU,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAA8D,MAAM,aAAa,CAAC;AAkBpH,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;CAChB;AAID,KAAK,mBAAmB,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1D,sFAAsF;AACtF,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GACtB,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9B,CAAC,CAAC,GAAG,CAAC,EAAE,oBAAoB,KAAK,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC,CAAC;AAE/G;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,CAAC,GAAG,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAC3D,sGAAsG;IACtG,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACxC,mFAAmF;IACnF,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B;;;;;;;OAOG;IACH,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,CAAC;CAC5C;AAYD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,aAAa,CA4J/D"}
|
package/dist/toolset.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { z } from 'zod';
|
|
|
3
3
|
import type { ConnectClientOptions, ProxyRequestOptions } from './client.js';
|
|
4
4
|
interface ProviderToolsOptionsBase {
|
|
5
5
|
/**
|
|
6
|
-
* Connection to use. `
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Connection to use. `tools()` always supplies one; direct
|
|
7
|
+
* `create<Provider>Tools` callers must pass it or tool calls fail with
|
|
8
|
+
* `missing_connection_id`.
|
|
9
9
|
*/
|
|
10
10
|
connectionId?: string;
|
|
11
11
|
client?: ConnectClientOptions;
|
|
@@ -17,15 +17,23 @@ interface ProviderToolsOptionsBase {
|
|
|
17
17
|
* callers still get a clear error instead of silent surprising behavior.
|
|
18
18
|
*/
|
|
19
19
|
export type ProviderToolsOptions = ProviderToolsOptionsBase & ({
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Restrict the returned toolset to these tool keys. Entries containing
|
|
22
|
+
* `*` are globs (e.g. `'linear_get_*'`). Unknown names and globs that
|
|
23
|
+
* match nothing throw immediately.
|
|
24
|
+
*/
|
|
21
25
|
allowTools?: string[];
|
|
22
26
|
disallowTools?: never;
|
|
23
27
|
} | {
|
|
24
28
|
allowTools?: never;
|
|
25
|
-
/**
|
|
29
|
+
/**
|
|
30
|
+
* Remove these tool keys from the returned toolset. Entries containing
|
|
31
|
+
* `*` are globs (e.g. `'linear_delete_*'`). Unknown names and globs
|
|
32
|
+
* that match nothing throw immediately.
|
|
33
|
+
*/
|
|
26
34
|
disallowTools?: string[];
|
|
27
35
|
});
|
|
28
|
-
/** Resolves a connection id lazily at execute time: option
|
|
36
|
+
/** Resolves a connection id lazily at execute time: explicit option first, then a legacy env fallback. */
|
|
29
37
|
export declare function resolveConnectionId(envVar: string, connectionId?: string): string;
|
|
30
38
|
export interface ProxyToolConfig<TIn, TOut> {
|
|
31
39
|
id: string;
|
|
@@ -48,16 +56,34 @@ export interface ProxyToolContext {
|
|
|
48
56
|
*/
|
|
49
57
|
export declare function defineProxyTool<TIn, TOut>(context: ProxyToolContext, config: ProxyToolConfig<TIn, TOut>): import("@mastra/core/tools").Tool<TIn, TOut, unknown, unknown, import("@mastra/core/tools").ToolExecutionContext<unknown, unknown, unknown>, string, unknown>;
|
|
50
58
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
59
|
+
* Returns a predicate testing tool keys against filter `entries`, where an
|
|
60
|
+
* entry containing `*` is a glob and anything else matches literally. Used
|
|
61
|
+
* where keys are only known later (MCP approval predicates); list-shaped
|
|
62
|
+
* call sites expand eagerly with {@link expandToolPatterns} instead.
|
|
63
|
+
*/
|
|
64
|
+
export declare function compileToolMatcher(entries: string[]): (toolKey: string) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Expands `*` glob entries against the known tool keys, preserving order and
|
|
67
|
+
* de-duplicating. Literal entries pass through untouched (callers validate
|
|
68
|
+
* those against their own key sets). A glob that matches nothing throws:
|
|
69
|
+
* like an unknown literal name, a dead pattern in access-limiting config is
|
|
70
|
+
* a typo that must surface instead of silently filtering nothing.
|
|
71
|
+
*/
|
|
72
|
+
export declare function expandToolPatterns(entries: string[], knownKeys: string[], label: string): string[];
|
|
73
|
+
/**
|
|
74
|
+
* Filters a toolset by tool key. Entries containing `*` are globs expanded
|
|
75
|
+
* against the toolset's keys. Throws at build time on unknown names and on
|
|
76
|
+
* globs that match nothing, so typos in access-limiting config surface
|
|
77
|
+
* immediately.
|
|
53
78
|
*/
|
|
54
|
-
export declare function applyAllowTools<T extends ToolsInput>(tools: T,
|
|
79
|
+
export declare function applyAllowTools<T extends ToolsInput>(tools: T, allowToolsInput?: string[]): ToolsInput;
|
|
55
80
|
/**
|
|
56
|
-
* Removes tool keys from a toolset.
|
|
57
|
-
*
|
|
58
|
-
*
|
|
81
|
+
* Removes tool keys from a toolset. Entries containing `*` are globs
|
|
82
|
+
* expanded against the toolset's keys. Throws at build time on unknown names
|
|
83
|
+
* and on globs that match nothing, so typos in access-limiting config
|
|
84
|
+
* surface immediately instead of silently removing nothing.
|
|
59
85
|
*/
|
|
60
|
-
export declare function applyDisallowTools<T extends ToolsInput>(tools: T,
|
|
86
|
+
export declare function applyDisallowTools<T extends ToolsInput>(tools: T, disallowToolsInput?: string[]): ToolsInput;
|
|
61
87
|
/**
|
|
62
88
|
* Applies whichever of `allowTools` or `disallowTools` was configured on a
|
|
63
89
|
* provider. Rejects at build time when both are set so a caller who bypasses
|
package/dist/toolset.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolset.d.ts","sourceRoot":"","sources":["../src/toolset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAI7E,UAAU,wBAAwB;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,wBAAwB,GACzD,CACI;IACE
|
|
1
|
+
{"version":3,"file":"toolset.d.ts","sourceRoot":"","sources":["../src/toolset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAI7E,UAAU,wBAAwB;IAChC;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;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,KA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AAM,EAAE,GAAG,UAAU,CAatG;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,kBAAkB,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAe5G;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,EAClD,KAAK,EAAE,CAAC,EACR,MAAM,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAC1D,UAAU,CAYZ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/connect",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Use Mastra platform integration connections as agent toolsets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -56,16 +56,16 @@
|
|
|
56
56
|
"typescript": "^7.0.2",
|
|
57
57
|
"vitest": "4.1.11",
|
|
58
58
|
"zod": "^4.6.4",
|
|
59
|
-
"@internal/
|
|
60
|
-
"@
|
|
61
|
-
"@
|
|
59
|
+
"@internal/types-builder": "0.0.116",
|
|
60
|
+
"@mastra/core": "1.75.0",
|
|
61
|
+
"@internal/lint": "0.0.141"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@mastra/mcp": "^2.2.0
|
|
65
|
-
"@mastra/
|
|
66
|
-
"@mastra/
|
|
67
|
-
"@mastra/
|
|
68
|
-
"@mastra/
|
|
64
|
+
"@mastra/mcp": "^2.2.0",
|
|
65
|
+
"@mastra/slack": "^1.7.2",
|
|
66
|
+
"@mastra/telegram": "^0.2.2",
|
|
67
|
+
"@mastra/teams": "^0.1.1",
|
|
68
|
+
"@mastra/discord": "^1.3.0"
|
|
69
69
|
},
|
|
70
70
|
"scripts": {
|
|
71
71
|
"add-provider": "tsx scripts/add-provider.ts",
|
package/dist/connect.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ToolsIntegrationOptions, ToolsOptions, ToolsResolver } from './tools.js';
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated Renamed to {@link ToolsIntegrationOptions}.
|
|
4
|
-
*/
|
|
5
|
-
export type ConnectIntegrationOptions = ToolsIntegrationOptions;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Renamed to {@link ToolsOptions}.
|
|
8
|
-
*/
|
|
9
|
-
export type ConnectOptions = ToolsOptions;
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Renamed to {@link ToolsResolver}.
|
|
12
|
-
*/
|
|
13
|
-
export type ConnectTools = ToolsResolver;
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Renamed to {@link tools}.
|
|
16
|
-
*
|
|
17
|
-
* `connect(options)` is a drop-in alias for `tools(options)`. Prefer `tools`
|
|
18
|
-
* from `@mastra/connect` in new code; this export will be removed in the next
|
|
19
|
-
* minor version.
|
|
20
|
-
*/
|
|
21
|
-
export declare function connect(options?: ConnectOptions): ConnectTools;
|
|
22
|
-
//# sourceMappingURL=connect.d.ts.map
|
package/dist/connect.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../src/connect.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEvF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,aAAa,CAAC;AAEzC;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,YAAY,CAElE"}
|
package/dist/environment.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { SandboxStartHook } from '@mastra/core/workspace';
|
|
2
|
-
import type { ConnectClientOptions } from './client.js';
|
|
3
|
-
export interface EnvironmentIntegrationOptions {
|
|
4
|
-
/** Pin a specific connection id (bypasses env-var fallback and single-active-connection resolution). */
|
|
5
|
-
connectionId?: string;
|
|
6
|
-
/** Exclude this provider entirely, even if a connection exists. */
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface EnvironmentOptions {
|
|
10
|
-
/** Platform project whose connections to discover. Falls back to MASTRA_PROJECT_ID. */
|
|
11
|
-
projectId?: string;
|
|
12
|
-
/** Optional per-provider overrides keyed by integrationId. */
|
|
13
|
-
integrations?: Record<string, EnvironmentIntegrationOptions>;
|
|
14
|
-
client?: ConnectClientOptions;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Sandbox credentials materialized from the project's Platform connections.
|
|
18
|
-
* Pass `env` into the sandbox's environment and `onStart` as (or inside) its
|
|
19
|
-
* start hook so CLI tooling in the sandbox is authenticated out of the box.
|
|
20
|
-
*/
|
|
21
|
-
export interface ConnectEnvironment {
|
|
22
|
-
/** Environment variables to inject into the sandbox (e.g. GH_TOKEN). Never log these. */
|
|
23
|
-
env: Record<string, string | undefined>;
|
|
24
|
-
/** Runs provider setup inside the sandbox (e.g. git credential wiring). Safe no-op when nothing to do. */
|
|
25
|
-
onStart: SandboxStartHook;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Resolves the project's Platform connections into sandbox credentials:
|
|
29
|
-
* environment variables plus a start hook that finishes in-sandbox setup.
|
|
30
|
-
* Currently GitHub-aware (`GH_TOKEN`/`GITHUB_TOKEN` + git credential helper);
|
|
31
|
-
* more providers plug in over time.
|
|
32
|
-
*
|
|
33
|
-
* Connection resolution matches `connect()`: a per-integration `connectionId`
|
|
34
|
-
* or the provider's `MASTRA_*_CONNECTION_ID` env var wins, else a single
|
|
35
|
-
* active connection; ambiguity, needs_reauth, and credential-fetch failures
|
|
36
|
-
* warn and skip that provider. Configuration errors (missing project id,
|
|
37
|
-
* malformed integration id) throw here so they surface at startup.
|
|
38
|
-
*
|
|
39
|
-
* The returned `env` is a snapshot: call `environment()` again for a fresh
|
|
40
|
-
* token when starting new sandboxes.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* const { env, onStart } = await environment({ projectId });
|
|
44
|
-
* const sandbox = new E2BSandbox({ env, onStart });
|
|
45
|
-
* // in the sandbox: `gh pr list`, `git clone https://github.com/org/repo` just work
|
|
46
|
-
*/
|
|
47
|
-
export declare function environment(options?: EnvironmentOptions): Promise<ConnectEnvironment>;
|
|
48
|
-
//# sourceMappingURL=environment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../src/environment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAwB,MAAM,aAAa,CAAC;AAK9E,MAAM,WAAW,6BAA6B;IAC5C,wGAAwG;IACxG,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IAC7D,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACxC,0GAA0G;IAC1G,OAAO,EAAE,gBAAgB,CAAC;CAC3B;AAyDD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAuD/F"}
|