@contractspec/integration.providers-impls 2.10.0 → 3.1.1
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 +66 -10
- package/dist/impls/async-event-queue.d.ts +8 -0
- package/dist/impls/async-event-queue.js +49 -0
- package/dist/impls/composio-fallback-resolver.d.ts +34 -0
- package/dist/impls/composio-fallback-resolver.js +580 -0
- package/dist/impls/composio-mcp.d.ts +22 -0
- package/dist/impls/composio-mcp.js +164 -0
- package/dist/impls/composio-proxies.d.ts +60 -0
- package/dist/impls/composio-proxies.js +311 -0
- package/dist/impls/composio-sdk.d.ts +25 -0
- package/dist/impls/composio-sdk.js +78 -0
- package/dist/impls/composio-types.d.ts +43 -0
- package/dist/impls/composio-types.js +54 -0
- package/dist/impls/elevenlabs-voice.js +2 -0
- package/dist/impls/fal-voice.js +2 -0
- package/dist/impls/fathom-meeting-recorder.js +2 -0
- package/dist/impls/fathom-meeting-recorder.mapper.js +2 -0
- package/dist/impls/fathom-meeting-recorder.utils.js +2 -0
- package/dist/impls/fathom-meeting-recorder.webhooks.js +2 -0
- package/dist/impls/fireflies-meeting-recorder.js +2 -0
- package/dist/impls/fireflies-meeting-recorder.queries.js +2 -0
- package/dist/impls/fireflies-meeting-recorder.utils.js +2 -0
- package/dist/impls/gcs-storage.js +2 -0
- package/dist/impls/gmail-inbound.js +2 -0
- package/dist/impls/gmail-outbound.js +2 -0
- package/dist/impls/google-calendar.js +2 -0
- package/dist/impls/gradium-voice.js +2 -0
- package/dist/impls/granola-meeting-recorder.js +2 -0
- package/dist/impls/granola-meeting-recorder.mcp.js +2 -0
- package/dist/impls/health/base-health-provider.d.ts +64 -13
- package/dist/impls/health/base-health-provider.js +508 -156
- package/dist/impls/health/hybrid-health-providers.d.ts +34 -0
- package/dist/impls/health/hybrid-health-providers.js +1090 -0
- package/dist/impls/health/official-health-providers.d.ts +78 -0
- package/dist/impls/health/official-health-providers.js +970 -0
- package/dist/impls/health/provider-normalizers.d.ts +28 -0
- package/dist/impls/health/provider-normalizers.js +289 -0
- package/dist/impls/health/providers.d.ts +2 -39
- package/dist/impls/health/providers.js +897 -184
- package/dist/impls/health-provider-factory.js +1011 -196
- package/dist/impls/index.d.ts +11 -0
- package/dist/impls/index.js +2588 -259
- package/dist/impls/jira.js +2 -0
- package/dist/impls/linear.js +2 -0
- package/dist/impls/messaging-github.d.ts +17 -0
- package/dist/impls/messaging-github.js +112 -0
- package/dist/impls/messaging-slack.d.ts +14 -0
- package/dist/impls/messaging-slack.js +82 -0
- package/dist/impls/messaging-whatsapp-meta.d.ts +13 -0
- package/dist/impls/messaging-whatsapp-meta.js +54 -0
- package/dist/impls/messaging-whatsapp-twilio.d.ts +13 -0
- package/dist/impls/messaging-whatsapp-twilio.js +84 -0
- package/dist/impls/mistral-conversational.d.ts +23 -0
- package/dist/impls/mistral-conversational.js +478 -0
- package/dist/impls/mistral-conversational.session.d.ts +32 -0
- package/dist/impls/mistral-conversational.session.js +208 -0
- package/dist/impls/mistral-embedding.js +2 -0
- package/dist/impls/mistral-llm.js +2 -0
- package/dist/impls/mistral-stt.d.ts +17 -0
- package/dist/impls/mistral-stt.js +169 -0
- package/dist/impls/notion.js +2 -0
- package/dist/impls/posthog-reader.js +2 -0
- package/dist/impls/posthog-utils.js +2 -0
- package/dist/impls/posthog.js +2 -0
- package/dist/impls/postmark-email.js +2 -0
- package/dist/impls/powens-client.js +2 -0
- package/dist/impls/powens-openbanking.js +2 -0
- package/dist/impls/provider-factory.d.ts +29 -1
- package/dist/impls/provider-factory.js +1985 -249
- package/dist/impls/qdrant-vector.js +2 -0
- package/dist/impls/stripe-payments.js +3 -1
- package/dist/impls/supabase-psql.js +2 -0
- package/dist/impls/supabase-vector.js +2 -0
- package/dist/impls/tldv-meeting-recorder.js +2 -0
- package/dist/impls/twilio-sms.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2615 -283
- package/dist/messaging.d.ts +1 -0
- package/dist/messaging.js +3 -0
- package/dist/node/impls/async-event-queue.js +49 -0
- package/dist/node/impls/composio-fallback-resolver.js +580 -0
- package/dist/node/impls/composio-mcp.js +164 -0
- package/dist/node/impls/composio-proxies.js +311 -0
- package/dist/node/impls/composio-sdk.js +78 -0
- package/dist/node/impls/composio-types.js +54 -0
- package/dist/node/impls/elevenlabs-voice.js +3 -0
- package/dist/node/impls/fal-voice.js +3 -0
- package/dist/node/impls/fathom-meeting-recorder.js +3 -0
- package/dist/node/impls/fathom-meeting-recorder.mapper.js +3 -0
- package/dist/node/impls/fathom-meeting-recorder.utils.js +3 -0
- package/dist/node/impls/fathom-meeting-recorder.webhooks.js +3 -0
- package/dist/node/impls/fireflies-meeting-recorder.js +3 -0
- package/dist/node/impls/fireflies-meeting-recorder.queries.js +3 -0
- package/dist/node/impls/fireflies-meeting-recorder.utils.js +3 -0
- package/dist/node/impls/gcs-storage.js +3 -0
- package/dist/node/impls/gmail-inbound.js +3 -0
- package/dist/node/impls/gmail-outbound.js +3 -0
- package/dist/node/impls/google-calendar.js +3 -0
- package/dist/node/impls/gradium-voice.js +3 -0
- package/dist/node/impls/granola-meeting-recorder.js +3 -0
- package/dist/node/impls/granola-meeting-recorder.mcp.js +3 -0
- package/dist/node/impls/health/base-health-provider.js +509 -156
- package/dist/node/impls/health/hybrid-health-providers.js +1090 -0
- package/dist/node/impls/health/official-health-providers.js +970 -0
- package/dist/node/impls/health/provider-normalizers.js +289 -0
- package/dist/node/impls/health/providers.js +898 -184
- package/dist/node/impls/health-provider-factory.js +1012 -196
- package/dist/node/impls/index.js +2589 -259
- package/dist/node/impls/jira.js +3 -0
- package/dist/node/impls/linear.js +3 -0
- package/dist/node/impls/messaging-github.js +112 -0
- package/dist/node/impls/messaging-slack.js +82 -0
- package/dist/node/impls/messaging-whatsapp-meta.js +54 -0
- package/dist/node/impls/messaging-whatsapp-twilio.js +84 -0
- package/dist/node/impls/mistral-conversational.js +478 -0
- package/dist/node/impls/mistral-conversational.session.js +208 -0
- package/dist/node/impls/mistral-embedding.js +3 -0
- package/dist/node/impls/mistral-llm.js +3 -0
- package/dist/node/impls/mistral-stt.js +169 -0
- package/dist/node/impls/notion.js +3 -0
- package/dist/node/impls/posthog-reader.js +3 -0
- package/dist/node/impls/posthog-utils.js +3 -0
- package/dist/node/impls/posthog.js +3 -0
- package/dist/node/impls/postmark-email.js +3 -0
- package/dist/node/impls/powens-client.js +3 -0
- package/dist/node/impls/powens-openbanking.js +3 -0
- package/dist/node/impls/provider-factory.js +1986 -249
- package/dist/node/impls/qdrant-vector.js +3 -0
- package/dist/node/impls/stripe-payments.js +4 -1
- package/dist/node/impls/supabase-psql.js +3 -0
- package/dist/node/impls/supabase-vector.js +3 -0
- package/dist/node/impls/tldv-meeting-recorder.js +3 -0
- package/dist/node/impls/twilio-sms.js +3 -0
- package/dist/node/index.js +2616 -283
- package/dist/node/messaging.js +2 -0
- package/dist/node/secrets/provider.js +3 -0
- package/dist/secrets/provider.js +2 -0
- package/package.json +219 -14
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ Secret payload example (`secretRef` target value):
|
|
|
37
37
|
Factory usage:
|
|
38
38
|
|
|
39
39
|
```ts
|
|
40
|
-
import { IntegrationProviderFactory } from
|
|
40
|
+
import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
|
|
41
41
|
|
|
42
42
|
const factory = new IntegrationProviderFactory();
|
|
43
43
|
const analytics = await factory.createAnalyticsProvider(context); // key: analytics.posthog
|
|
@@ -54,7 +54,7 @@ This package ships health/wearables providers routed by a transport strategy:
|
|
|
54
54
|
Factory usage:
|
|
55
55
|
|
|
56
56
|
```ts
|
|
57
|
-
import { IntegrationProviderFactory } from
|
|
57
|
+
import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
|
|
58
58
|
|
|
59
59
|
const factory = new IntegrationProviderFactory();
|
|
60
60
|
const healthProvider = await factory.createHealthProvider(context); // key: health.*
|
|
@@ -75,7 +75,8 @@ Connection config example:
|
|
|
75
75
|
"allowUnofficial": false,
|
|
76
76
|
"unofficialAllowList": ["health.peloton"],
|
|
77
77
|
"apiBaseUrl": "https://api.provider.example",
|
|
78
|
-
"mcpUrl": "https://mcp.provider.example"
|
|
78
|
+
"mcpUrl": "https://mcp.provider.example",
|
|
79
|
+
"oauthTokenUrl": "https://api.provider.example/oauth/token"
|
|
79
80
|
}
|
|
80
81
|
```
|
|
81
82
|
|
|
@@ -85,6 +86,10 @@ Secret payload example (`secretRef` target value):
|
|
|
85
86
|
{
|
|
86
87
|
"apiKey": "provider-api-key",
|
|
87
88
|
"accessToken": "oauth-access-token",
|
|
89
|
+
"refreshToken": "oauth-refresh-token",
|
|
90
|
+
"clientId": "oauth-client-id",
|
|
91
|
+
"clientSecret": "oauth-client-secret",
|
|
92
|
+
"tokenExpiresAt": "2026-02-01T00:00:00.000Z",
|
|
88
93
|
"mcpAccessToken": "mcp-access-token",
|
|
89
94
|
"webhookSecret": "webhook-signature-secret"
|
|
90
95
|
}
|
|
@@ -94,6 +99,7 @@ Notes:
|
|
|
94
99
|
|
|
95
100
|
- Unofficial routing is disabled unless `allowUnofficial: true`.
|
|
96
101
|
- When `unofficialAllowList` is provided, only listed `health.*` keys can use unofficial routing.
|
|
102
|
+
- Unofficial routing expects MCP transport (`mcpUrl`) plus either `mcpAccessToken` or automation credentials.
|
|
97
103
|
- If a selected strategy is unavailable, the resolver falls through `strategyOrder`.
|
|
98
104
|
|
|
99
105
|
## Supabase integrations
|
|
@@ -152,7 +158,7 @@ Secret payload example (`secretRef` target value):
|
|
|
152
158
|
### 2) Factory usage
|
|
153
159
|
|
|
154
160
|
```ts
|
|
155
|
-
import { IntegrationProviderFactory } from
|
|
161
|
+
import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
|
|
156
162
|
|
|
157
163
|
const factory = new IntegrationProviderFactory();
|
|
158
164
|
|
|
@@ -163,20 +169,20 @@ const dbProvider = await factory.createDatabaseProvider(databaseContext); // key
|
|
|
163
169
|
### 3) Direct provider usage
|
|
164
170
|
|
|
165
171
|
```ts
|
|
166
|
-
import { SupabaseVectorProvider } from
|
|
167
|
-
import { SupabasePostgresProvider } from
|
|
172
|
+
import { SupabaseVectorProvider } from '@contractspec/integration.providers-impls/impls/supabase-vector';
|
|
173
|
+
import { SupabasePostgresProvider } from '@contractspec/integration.providers-impls/impls/supabase-psql';
|
|
168
174
|
|
|
169
175
|
const vector = new SupabaseVectorProvider({
|
|
170
176
|
connectionString: process.env.SUPABASE_DATABASE_URL,
|
|
171
|
-
schema:
|
|
172
|
-
table:
|
|
173
|
-
distanceMetric:
|
|
177
|
+
schema: 'public',
|
|
178
|
+
table: 'contractspec_vectors',
|
|
179
|
+
distanceMetric: 'cosine',
|
|
174
180
|
});
|
|
175
181
|
|
|
176
182
|
const database = new SupabasePostgresProvider({
|
|
177
183
|
connectionString: process.env.SUPABASE_DATABASE_URL,
|
|
178
184
|
maxConnections: 10,
|
|
179
|
-
sslMode:
|
|
185
|
+
sslMode: 'require',
|
|
180
186
|
});
|
|
181
187
|
```
|
|
182
188
|
|
|
@@ -185,3 +191,53 @@ const database = new SupabasePostgresProvider({
|
|
|
185
191
|
- `SupabaseVectorProvider` creates `vector` extension/table/indexes automatically when `createTableIfMissing=true`.
|
|
186
192
|
- `SupabaseVectorProvider` maps scores from pgvector distances (`cosine`, `l2`, `inner_product`) to `VectorSearchResult.score`.
|
|
187
193
|
- `SupabasePostgresProvider` supports `$1`, `$2`, ... placeholders, transactions, and clean connection shutdown through `close()`.
|
|
194
|
+
|
|
195
|
+
## Composio universal fallback
|
|
196
|
+
|
|
197
|
+
When an integration key has no native implementation, the factory can delegate to [Composio](https://composio.dev/) -- a platform providing 850+ toolkits (Slack, GitHub, Gmail, Jira, Salesforce, etc.) via MCP or native SDK.
|
|
198
|
+
|
|
199
|
+
### Enabling the fallback
|
|
200
|
+
|
|
201
|
+
Pass a `ComposioFallbackResolver` when constructing the factory:
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import { IntegrationProviderFactory } from '@contractspec/integration.providers-impls/impls/provider-factory';
|
|
205
|
+
import { ComposioFallbackResolver } from '@contractspec/integration.providers-impls/impls/composio-fallback-resolver';
|
|
206
|
+
|
|
207
|
+
const resolver = new ComposioFallbackResolver({
|
|
208
|
+
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
209
|
+
preferredTransport: 'mcp', // "mcp" (default) or "sdk"
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const factory = new IntegrationProviderFactory({ composioFallback: resolver });
|
|
213
|
+
|
|
214
|
+
// Now any unsupported key falls through to Composio:
|
|
215
|
+
const messaging = await factory.createMessagingProvider(discordContext);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Transport modes
|
|
219
|
+
|
|
220
|
+
| Mode | When to use | How it works |
|
|
221
|
+
| ----------------- | ------------------ | --------------------------------------------------------------- |
|
|
222
|
+
| **MCP** (default) | Standard fallback | Creates a Composio session, connects via MCP protocol |
|
|
223
|
+
| **SDK** | Advanced use cases | Uses `@composio/core` directly for tool search, auth management |
|
|
224
|
+
|
|
225
|
+
### Domain proxy adapters
|
|
226
|
+
|
|
227
|
+
For typed domains (messaging, email, payments, project management, calendar), the resolver returns proxy adapters that implement the ContractSpec interface and translate method calls to Composio tool executions. For untyped domains, a `ComposioGenericProxy` provides raw `executeTool()` access.
|
|
228
|
+
|
|
229
|
+
### Runtime configuration
|
|
230
|
+
|
|
231
|
+
Add `composio` to your `IntegrationRuntimeConfig`:
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
const runtimeConfig: IntegrationRuntimeConfig = {
|
|
235
|
+
secretProvider: mySecretProvider,
|
|
236
|
+
composio: {
|
|
237
|
+
apiKey: process.env.COMPOSIO_API_KEY!,
|
|
238
|
+
preferredTransport: 'mcp',
|
|
239
|
+
},
|
|
240
|
+
};
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
See `docs/tech/integrations/composio-fallback.md` for the full architecture.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
var __require = import.meta.require;
|
|
3
|
+
|
|
4
|
+
// src/impls/async-event-queue.ts
|
|
5
|
+
class AsyncEventQueue {
|
|
6
|
+
values = [];
|
|
7
|
+
waiters = [];
|
|
8
|
+
done = false;
|
|
9
|
+
push(value) {
|
|
10
|
+
if (this.done) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const waiter = this.waiters.shift();
|
|
14
|
+
if (waiter) {
|
|
15
|
+
waiter({ value, done: false });
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
this.values.push(value);
|
|
19
|
+
}
|
|
20
|
+
close() {
|
|
21
|
+
if (this.done) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.done = true;
|
|
25
|
+
for (const waiter of this.waiters) {
|
|
26
|
+
waiter({ value: undefined, done: true });
|
|
27
|
+
}
|
|
28
|
+
this.waiters.length = 0;
|
|
29
|
+
}
|
|
30
|
+
[Symbol.asyncIterator]() {
|
|
31
|
+
return {
|
|
32
|
+
next: async () => {
|
|
33
|
+
const value = this.values.shift();
|
|
34
|
+
if (value != null) {
|
|
35
|
+
return { value, done: false };
|
|
36
|
+
}
|
|
37
|
+
if (this.done) {
|
|
38
|
+
return { value: undefined, done: true };
|
|
39
|
+
}
|
|
40
|
+
return new Promise((resolve) => {
|
|
41
|
+
this.waiters.push(resolve);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
AsyncEventQueue
|
|
49
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IntegrationContext } from '@contractspec/integration.runtime/runtime';
|
|
2
|
+
import type { ComposioConfig } from './composio-types';
|
|
3
|
+
import { ComposioGenericProxy } from './composio-proxies';
|
|
4
|
+
import type { MessagingProvider } from '../messaging';
|
|
5
|
+
import type { EmailOutboundProvider } from '../email';
|
|
6
|
+
import type { PaymentsProvider } from '../payments';
|
|
7
|
+
import type { ProjectManagementProvider } from '../project-management';
|
|
8
|
+
import type { CalendarProvider } from '../calendar';
|
|
9
|
+
/**
|
|
10
|
+
* Resolves unsupported integration keys to Composio-backed proxy providers.
|
|
11
|
+
*
|
|
12
|
+
* When IntegrationProviderFactory encounters an unknown key, it delegates
|
|
13
|
+
* to this resolver. The resolver maps the key to a Composio toolkit and
|
|
14
|
+
* returns a domain-typed proxy that translates method calls into Composio
|
|
15
|
+
* tool executions.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ComposioFallbackResolver {
|
|
18
|
+
private readonly mcpProvider;
|
|
19
|
+
private readonly sdkProvider;
|
|
20
|
+
private readonly preferredTransport;
|
|
21
|
+
constructor(config: ComposioConfig);
|
|
22
|
+
/**
|
|
23
|
+
* Returns true for any integration key -- Composio is a universal fallback.
|
|
24
|
+
* The actual availability of the toolkit is checked at execution time.
|
|
25
|
+
*/
|
|
26
|
+
canHandle(_integrationKey: string): boolean;
|
|
27
|
+
createMessagingProxy(context: IntegrationContext): MessagingProvider;
|
|
28
|
+
createEmailProxy(context: IntegrationContext): EmailOutboundProvider;
|
|
29
|
+
createPaymentsProxy(context: IntegrationContext): PaymentsProvider;
|
|
30
|
+
createProjectManagementProxy(context: IntegrationContext): ProjectManagementProvider;
|
|
31
|
+
createCalendarProxy(context: IntegrationContext): CalendarProvider;
|
|
32
|
+
createGenericProxy(context: IntegrationContext): ComposioGenericProxy;
|
|
33
|
+
private getProxy;
|
|
34
|
+
}
|