@tangle-network/agent-integrations 0.30.0 → 0.32.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/bin/tangle-catalog-runtime.js +6 -6
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +6 -6
- package/dist/{chunk-5ASL5XNX.js → chunk-CDY2ETYT.js} +2 -2
- package/dist/{chunk-M2RFFAMB.js → chunk-DN6DNPPH.js} +176 -3
- package/dist/chunk-DN6DNPPH.js.map +1 -0
- package/dist/chunk-F4YILONK.js +96875 -0
- package/dist/chunk-F4YILONK.js.map +1 -0
- package/dist/{chunk-DACSERTI.js → chunk-JCHD6L3B.js} +2 -2
- package/dist/{chunk-Y6O3MIBW.js → chunk-Q5X3QNHR.js} +1 -1
- package/dist/chunk-Q5X3QNHR.js.map +1 -0
- package/dist/{chunk-FDZIQVK7.js → chunk-S2MVWQYL.js} +2 -2
- package/dist/connect/index.d.ts +1 -1
- package/dist/connect/index.js +2 -2
- package/dist/connectors/adapters/index.d.ts +3933 -3
- package/dist/connectors/adapters/index.js +940 -4
- package/dist/connectors/index.d.ts +2 -2
- package/dist/connectors/index.js +940 -4
- package/dist/consumer.d.ts +1 -1
- package/dist/consumer.js +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +944 -8
- package/dist/middleware/index.d.ts +1 -1
- package/dist/middleware/index.js +2 -2
- package/dist/registry.d.ts +21 -4
- package/dist/registry.js +6 -6
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.js +6 -6
- package/dist/specs.d.ts +1 -1
- package/dist/tangle-catalog-runtime.d.ts +1 -1
- package/dist/tangle-catalog-runtime.js +6 -6
- package/dist/{tangle-id-C6s2NT2r.d.ts → tangle-id-Dj0ipP4E.d.ts} +1 -1
- package/package.json +10 -12
- package/dist/chunk-JOILC44P.js +0 -4266
- package/dist/chunk-JOILC44P.js.map +0 -1
- package/dist/chunk-M2RFFAMB.js.map +0 -1
- package/dist/chunk-Y6O3MIBW.js.map +0 -1
- /package/dist/{chunk-5ASL5XNX.js.map → chunk-CDY2ETYT.js.map} +0 -0
- /package/dist/{chunk-DACSERTI.js.map → chunk-JCHD6L3B.js.map} +0 -0
- /package/dist/{chunk-FDZIQVK7.js.map → chunk-S2MVWQYL.js.map} +0 -0
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
buildTangleCatalogRuntimePackageManifest,
|
|
5
5
|
renderTangleCatalogRuntimePnpmAddCommand,
|
|
6
6
|
startTangleCatalogRuntimeNodeServer
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-DN6DNPPH.js";
|
|
8
|
+
import "../chunk-JCHD6L3B.js";
|
|
9
|
+
import "../chunk-CDY2ETYT.js";
|
|
10
10
|
import "../chunk-H4XYLS7T.js";
|
|
11
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-S2MVWQYL.js";
|
|
12
12
|
import "../chunk-VVC7U7W7.js";
|
|
13
13
|
import "../chunk-376UBTNB.js";
|
|
14
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-F4YILONK.js";
|
|
15
15
|
import "../chunk-2TW2QKGZ.js";
|
|
16
|
-
import "../chunk-
|
|
16
|
+
import "../chunk-Q5X3QNHR.js";
|
|
17
17
|
|
|
18
18
|
// src/bin/tangle-catalog-runtime.ts
|
|
19
19
|
var args = new Set(process.argv.slice(2));
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { I as IntegrationCatalogView, a as IntegrationToolDefinition, b as IntegrationToolSearchFilters, c as IntegrationToolSearchResult, M as McpToolDefinition, d as buildIntegrationCatalogView, e as buildIntegrationToolCatalog, f as describeIntegrationTool, g as flattenIntegrationToolDefinition, i as integrationToolName, p as parseIntegrationToolName, s as searchIntegrationTools, t as toMcpTools } from './registry.js';
|
|
2
|
-
import './tangle-id-
|
|
2
|
+
import './tangle-id-Dj0ipP4E.js';
|
|
3
3
|
import './errors-Bg3_rxnQ.js';
|
|
4
4
|
import './connect/index.js';
|
|
5
5
|
import './middleware/index.js';
|
package/dist/catalog.js
CHANGED
|
@@ -7,16 +7,16 @@ import {
|
|
|
7
7
|
parseIntegrationToolName,
|
|
8
8
|
searchIntegrationTools,
|
|
9
9
|
toMcpTools
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-DN6DNPPH.js";
|
|
11
|
+
import "./chunk-JCHD6L3B.js";
|
|
12
|
+
import "./chunk-CDY2ETYT.js";
|
|
13
13
|
import "./chunk-H4XYLS7T.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-S2MVWQYL.js";
|
|
15
15
|
import "./chunk-VVC7U7W7.js";
|
|
16
16
|
import "./chunk-376UBTNB.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-F4YILONK.js";
|
|
18
18
|
import "./chunk-2TW2QKGZ.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-Q5X3QNHR.js";
|
|
20
20
|
export {
|
|
21
21
|
buildIntegrationCatalogView,
|
|
22
22
|
buildIntegrationToolCatalog,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TangleIdentityUnreachableError,
|
|
3
3
|
createTangleIdentityClient
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q5X3QNHR.js";
|
|
5
5
|
|
|
6
6
|
// src/middleware/index.ts
|
|
7
7
|
async function requireTangleAuth(request, opts = {}) {
|
|
@@ -126,4 +126,4 @@ export {
|
|
|
126
126
|
honoTangleAuthMiddleware,
|
|
127
127
|
expressTangleAuthMiddleware
|
|
128
128
|
};
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-CDY2ETYT.js.map
|
|
@@ -205,6 +205,7 @@ import { createHmac as createHmac2, randomUUID as randomUUID5, timingSafeEqual a
|
|
|
205
205
|
function createConnectorAdapterProvider(options) {
|
|
206
206
|
const providerId = options.id ?? "first-party";
|
|
207
207
|
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
208
|
+
const fetchImpl = options.fetchImpl ?? globalThis.fetch?.bind(globalThis);
|
|
208
209
|
const adapters = /* @__PURE__ */ new Map();
|
|
209
210
|
for (const adapter of options.adapters) {
|
|
210
211
|
adapters.set(adapter.manifest.kind, adapter);
|
|
@@ -213,6 +214,159 @@ function createConnectorAdapterProvider(options) {
|
|
|
213
214
|
id: providerId,
|
|
214
215
|
kind: options.kind ?? "first_party",
|
|
215
216
|
listConnectors: () => [...adapters.values()].map((adapter) => manifestToConnector(providerId, adapter)),
|
|
217
|
+
async startAuth(request) {
|
|
218
|
+
const adapter = adapters.get(request.connectorId);
|
|
219
|
+
if (!adapter) {
|
|
220
|
+
throw new IntegrationError(
|
|
221
|
+
`Connector adapter ${request.connectorId} not found.`,
|
|
222
|
+
"connector_not_found"
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
const auth = adapter.manifest.auth;
|
|
226
|
+
if (auth.kind !== "oauth2") {
|
|
227
|
+
throw new IntegrationError(
|
|
228
|
+
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${auth.kind}).`,
|
|
229
|
+
"auth_not_supported"
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
if (!options.resolveOAuthClient) {
|
|
233
|
+
throw new IntegrationError(
|
|
234
|
+
`OAuth client resolver missing on adapter provider; cannot start auth for ${request.connectorId}.`,
|
|
235
|
+
"config_missing"
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
const client = await options.resolveOAuthClient({ connectorId: request.connectorId });
|
|
239
|
+
if (!client || !client.clientId || !client.clientSecret) {
|
|
240
|
+
throw new IntegrationError(
|
|
241
|
+
`OAuth client credentials unavailable for ${request.connectorId}.`,
|
|
242
|
+
"config_missing"
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
const scopes = request.requestedScopes && request.requestedScopes.length > 0 ? request.requestedScopes : auth.scopes;
|
|
246
|
+
const url = new URL(auth.authorizationUrl);
|
|
247
|
+
url.searchParams.set("response_type", "code");
|
|
248
|
+
url.searchParams.set("client_id", client.clientId);
|
|
249
|
+
url.searchParams.set("redirect_uri", request.redirectUri);
|
|
250
|
+
if (scopes.length > 0) {
|
|
251
|
+
url.searchParams.set("scope", scopes.join(" "));
|
|
252
|
+
}
|
|
253
|
+
const state = request.state ?? randomState();
|
|
254
|
+
url.searchParams.set("state", state);
|
|
255
|
+
if (auth.extraAuthParams) {
|
|
256
|
+
for (const [key, value] of Object.entries(auth.extraAuthParams)) {
|
|
257
|
+
url.searchParams.set(key, value);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
providerId,
|
|
262
|
+
connectorId: request.connectorId,
|
|
263
|
+
authUrl: url.toString(),
|
|
264
|
+
state,
|
|
265
|
+
metadata: request.metadata
|
|
266
|
+
};
|
|
267
|
+
},
|
|
268
|
+
async completeAuth(request) {
|
|
269
|
+
const adapter = adapters.get(request.connectorId);
|
|
270
|
+
if (!adapter) {
|
|
271
|
+
throw new IntegrationError(
|
|
272
|
+
`Connector adapter ${request.connectorId} not found.`,
|
|
273
|
+
"connector_not_found"
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
const auth = adapter.manifest.auth;
|
|
277
|
+
if (auth.kind !== "oauth2") {
|
|
278
|
+
throw new IntegrationError(
|
|
279
|
+
`Connector ${request.connectorId} does not support OAuth2 authorization (auth kind: ${auth.kind}).`,
|
|
280
|
+
"auth_not_supported"
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (!request.code) {
|
|
284
|
+
throw new IntegrationError(
|
|
285
|
+
`Authorization code missing on completeAuth for ${request.connectorId}.`,
|
|
286
|
+
"config_missing"
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
if (!options.resolveOAuthClient) {
|
|
290
|
+
throw new IntegrationError(
|
|
291
|
+
`OAuth client resolver missing on adapter provider; cannot complete auth for ${request.connectorId}.`,
|
|
292
|
+
"config_missing"
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
const client = await options.resolveOAuthClient({ connectorId: request.connectorId });
|
|
296
|
+
if (!client || !client.clientId || !client.clientSecret) {
|
|
297
|
+
throw new IntegrationError(
|
|
298
|
+
`OAuth client credentials unavailable for ${request.connectorId}.`,
|
|
299
|
+
"config_missing"
|
|
300
|
+
);
|
|
301
|
+
}
|
|
302
|
+
if (!fetchImpl) {
|
|
303
|
+
throw new IntegrationError(
|
|
304
|
+
"No fetch implementation available; inject fetchImpl into createConnectorAdapterProvider.",
|
|
305
|
+
"config_missing"
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
const body = new URLSearchParams({
|
|
309
|
+
grant_type: "authorization_code",
|
|
310
|
+
code: request.code,
|
|
311
|
+
client_id: client.clientId,
|
|
312
|
+
client_secret: client.clientSecret,
|
|
313
|
+
redirect_uri: request.redirectUri
|
|
314
|
+
});
|
|
315
|
+
let res;
|
|
316
|
+
try {
|
|
317
|
+
res = await fetchImpl(auth.tokenUrl, {
|
|
318
|
+
method: "POST",
|
|
319
|
+
headers: {
|
|
320
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
321
|
+
accept: "application/json"
|
|
322
|
+
},
|
|
323
|
+
body
|
|
324
|
+
});
|
|
325
|
+
} catch (cause) {
|
|
326
|
+
throw new IntegrationError(
|
|
327
|
+
`OAuth token exchange transport error for ${request.connectorId}: ${cause?.message ?? "unknown"}`,
|
|
328
|
+
"provider_failure"
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
if (!res.ok) {
|
|
332
|
+
const text = await res.text().catch(() => "");
|
|
333
|
+
throw new IntegrationError(
|
|
334
|
+
`OAuth token exchange failed for ${request.connectorId}: ${res.status} ${res.statusText} \u2014 ${text.slice(0, 200)}`,
|
|
335
|
+
"provider_failure"
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
let json;
|
|
339
|
+
try {
|
|
340
|
+
json = await res.json();
|
|
341
|
+
} catch {
|
|
342
|
+
throw new IntegrationError(
|
|
343
|
+
`OAuth token exchange returned non-JSON body for ${request.connectorId}.`,
|
|
344
|
+
"provider_failure"
|
|
345
|
+
);
|
|
346
|
+
}
|
|
347
|
+
if (!json.access_token) {
|
|
348
|
+
throw new IntegrationError(
|
|
349
|
+
`OAuth token exchange returned no access_token for ${request.connectorId}.`,
|
|
350
|
+
"provider_failure"
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
const grantedScopes = typeof json.scope === "string" && json.scope.length > 0 ? json.scope.split(/[\s,]+/).filter(Boolean) : [];
|
|
354
|
+
const issued = now();
|
|
355
|
+
const issuedIso = issued.toISOString();
|
|
356
|
+
const expiresAt = typeof json.expires_in === "number" && json.expires_in > 0 ? new Date(issued.getTime() + json.expires_in * 1e3).toISOString() : void 0;
|
|
357
|
+
return {
|
|
358
|
+
id: randomConnectionId(),
|
|
359
|
+
owner: request.owner,
|
|
360
|
+
providerId,
|
|
361
|
+
connectorId: request.connectorId,
|
|
362
|
+
status: "active",
|
|
363
|
+
grantedScopes,
|
|
364
|
+
createdAt: issuedIso,
|
|
365
|
+
updatedAt: issuedIso,
|
|
366
|
+
expiresAt,
|
|
367
|
+
metadata: request.metadata
|
|
368
|
+
};
|
|
369
|
+
},
|
|
216
370
|
async invokeAction(connection, request) {
|
|
217
371
|
const adapter = adapters.get(connection.connectorId);
|
|
218
372
|
if (!adapter) {
|
|
@@ -368,6 +522,25 @@ function toRecord(input) {
|
|
|
368
522
|
if (input && typeof input === "object" && !Array.isArray(input)) return input;
|
|
369
523
|
return {};
|
|
370
524
|
}
|
|
525
|
+
function randomState() {
|
|
526
|
+
const bytes = new Uint8Array(24);
|
|
527
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
528
|
+
return base64UrlEncode(bytes);
|
|
529
|
+
}
|
|
530
|
+
function randomConnectionId() {
|
|
531
|
+
if (typeof globalThis.crypto?.randomUUID === "function") {
|
|
532
|
+
return `conn_${globalThis.crypto.randomUUID().replace(/-/g, "")}`;
|
|
533
|
+
}
|
|
534
|
+
const bytes = new Uint8Array(16);
|
|
535
|
+
globalThis.crypto.getRandomValues(bytes);
|
|
536
|
+
return `conn_${base64UrlEncode(bytes)}`;
|
|
537
|
+
}
|
|
538
|
+
function base64UrlEncode(bytes) {
|
|
539
|
+
let bin = "";
|
|
540
|
+
for (const b of bytes) bin += String.fromCharCode(b);
|
|
541
|
+
const b64 = typeof btoa === "function" ? btoa(bin) : Buffer.from(bin, "binary").toString("base64");
|
|
542
|
+
return b64.replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
543
|
+
}
|
|
371
544
|
|
|
372
545
|
// src/credentials.ts
|
|
373
546
|
var InMemoryIntegrationSecretStore = class {
|
|
@@ -3735,7 +3908,7 @@ function createHttpIntegrationProvider(options) {
|
|
|
3735
3908
|
};
|
|
3736
3909
|
}
|
|
3737
3910
|
function signCapability(capability, secret) {
|
|
3738
|
-
const payload =
|
|
3911
|
+
const payload = base64UrlEncode2(JSON.stringify(capability));
|
|
3739
3912
|
const signature = hmac(payload, secret);
|
|
3740
3913
|
return `${payload}.${signature}`;
|
|
3741
3914
|
}
|
|
@@ -3779,7 +3952,7 @@ function constantTimeEqual(a, b) {
|
|
|
3779
3952
|
const right = Buffer.from(b);
|
|
3780
3953
|
return left.length === right.length && timingSafeEqual2(left, right);
|
|
3781
3954
|
}
|
|
3782
|
-
function
|
|
3955
|
+
function base64UrlEncode2(value) {
|
|
3783
3956
|
return Buffer.from(value, "utf8").toString("base64url");
|
|
3784
3957
|
}
|
|
3785
3958
|
function base64UrlDecode(value) {
|
|
@@ -4632,4 +4805,4 @@ export {
|
|
|
4632
4805
|
signCapability,
|
|
4633
4806
|
verifyCapabilityToken
|
|
4634
4807
|
};
|
|
4635
|
-
//# sourceMappingURL=chunk-
|
|
4808
|
+
//# sourceMappingURL=chunk-DN6DNPPH.js.map
|