@tangle-network/agent-integrations 0.27.0 → 0.28.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.
@@ -4,8 +4,9 @@ import {
4
4
  buildTangleCatalogRuntimePackageManifest,
5
5
  renderTangleCatalogRuntimePnpmAddCommand,
6
6
  startTangleCatalogRuntimeNodeServer
7
- } from "../chunk-ICSBYCE2.js";
7
+ } from "../chunk-UWRYFPJW.js";
8
8
  import "../chunk-SVQ4PHDZ.js";
9
+ import "../chunk-H4XYLS7T.js";
9
10
  import "../chunk-4JQ754PA.js";
10
11
  import "../chunk-376UBTNB.js";
11
12
  import "../chunk-JU25UDN2.js";
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/bin/tangle-catalog-runtime.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n buildTangleCatalogRuntimePackageManifest,\n renderTangleCatalogRuntimePnpmAddCommand,\n} from '../tangle-catalog.js'\nimport { auditTangleCatalogRuntimePackages } from '../tangle-catalog-runtime.js'\nimport { startTangleCatalogRuntimeNodeServer } from '../tangle-catalog-runtime-server.js'\n\nconst args = new Set(process.argv.slice(2))\nif (args.has('--print-package-json')) {\n console.log(JSON.stringify(buildTangleCatalogRuntimePackageManifest({\n agentIntegrationsVersion: process.env.TANGLE_AGENT_INTEGRATIONS_VERSION,\n }), null, 2))\n process.exit(0)\n}\n\nif (args.has('--print-pnpm-add')) {\n console.log(renderTangleCatalogRuntimePnpmAddCommand({\n agentIntegrationsVersion: process.env.TANGLE_AGENT_INTEGRATIONS_VERSION,\n }))\n process.exit(0)\n}\n\nif (args.has('--audit-packages')) {\n const connectorIds = process.env.TANGLE_CATALOG_AUDIT_CONNECTORS\n ?.split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n console.log(JSON.stringify(await auditTangleCatalogRuntimePackages({ connectorIds }), null, 2))\n process.exit(0)\n}\n\nconst secret = process.env.TANGLE_CATALOG_RUNTIME_SECRET\nif (!secret || secret.length < 32) {\n console.error('TANGLE_CATALOG_RUNTIME_SECRET must be set to at least 32 characters.')\n process.exit(1)\n}\n\nconst authResolverUrl = process.env.TANGLE_CATALOG_AUTH_RESOLVER_URL\nconst authResolverSecret = process.env.TANGLE_CATALOG_AUTH_RESOLVER_SECRET\nif (Boolean(authResolverUrl) !== Boolean(authResolverSecret)) {\n console.error('TANGLE_CATALOG_AUTH_RESOLVER_URL and TANGLE_CATALOG_AUTH_RESOLVER_SECRET must be set together.')\n process.exit(1)\n}\n\nconst port = Number(process.env.PORT ?? process.env.TANGLE_CATALOG_RUNTIME_PORT ?? 4109)\nif (!Number.isInteger(port) || port < 1 || port > 65_535) {\n console.error('PORT must be an integer between 1 and 65535.')\n process.exit(1)\n}\n\nconst server = await startTangleCatalogRuntimeNodeServer({\n secret,\n host: process.env.HOST ?? process.env.TANGLE_CATALOG_RUNTIME_HOST ?? '0.0.0.0',\n port,\n authResolver: authResolverUrl && authResolverSecret\n ? {\n endpoint: authResolverUrl,\n secret: authResolverSecret,\n }\n : false,\n onLog: (event) => {\n const line = JSON.stringify({\n level: event.level,\n message: event.message,\n ...event.metadata,\n })\n if (event.level === 'error') console.error(line)\n else console.log(line)\n },\n})\n\nconsole.log(JSON.stringify({\n level: 'info',\n message: 'Tangle catalog runtime listening.',\n url: server.url,\n}))\n\nfor (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.once(signal, async () => {\n await server.close()\n process.exit(0)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAM,OAAO,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC1C,IAAI,KAAK,IAAI,sBAAsB,GAAG;AACpC,UAAQ,IAAI,KAAK,UAAU,yCAAyC;AAAA,IAClE,0BAA0B,QAAQ,IAAI;AAAA,EACxC,CAAC,GAAG,MAAM,CAAC,CAAC;AACZ,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAI,KAAK,IAAI,kBAAkB,GAAG;AAChC,UAAQ,IAAI,yCA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AI,MAAM,UAAU,QAAS,SAAQ,MAAM,IAAI;AAAA,QAC1C,SAAQ,IAAI,IAAI;AAAA,EACvB;AACF,CAAC;AAED,QAAQ,IAAI,KAAK,UAAU;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK,OAAO;AACd,CAAC,CAAC;AAEF,WAAW,UAAU,CAAC,UAAU,SAAS,GAAY;AACnD,UAAQ,KAAK,QAAQ,YAAY;AAC/B,UAAM,OAAO,MAAM;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../src/bin/tangle-catalog-runtime.ts"],"sourcesContent":["#!/usr/bin/env node\nimport {\n buildTangleCatalogRuntimePackageManifest,\n renderTangleCatalogRuntimePnpmAddCommand,\n} from '../tangle-catalog.js'\nimport { auditTangleCatalogRuntimePackages } from '../tangle-catalog-runtime.js'\nimport { startTangleCatalogRuntimeNodeServer } from '../tangle-catalog-runtime-server.js'\n\nconst args = new Set(process.argv.slice(2))\nif (args.has('--print-package-json')) {\n console.log(JSON.stringify(buildTangleCatalogRuntimePackageManifest({\n agentIntegrationsVersion: process.env.TANGLE_AGENT_INTEGRATIONS_VERSION,\n }), null, 2))\n process.exit(0)\n}\n\nif (args.has('--print-pnpm-add')) {\n console.log(renderTangleCatalogRuntimePnpmAddCommand({\n agentIntegrationsVersion: process.env.TANGLE_AGENT_INTEGRATIONS_VERSION,\n }))\n process.exit(0)\n}\n\nif (args.has('--audit-packages')) {\n const connectorIds = process.env.TANGLE_CATALOG_AUDIT_CONNECTORS\n ?.split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n console.log(JSON.stringify(await auditTangleCatalogRuntimePackages({ connectorIds }), null, 2))\n process.exit(0)\n}\n\nconst secret = process.env.TANGLE_CATALOG_RUNTIME_SECRET\nif (!secret || secret.length < 32) {\n console.error('TANGLE_CATALOG_RUNTIME_SECRET must be set to at least 32 characters.')\n process.exit(1)\n}\n\nconst authResolverUrl = process.env.TANGLE_CATALOG_AUTH_RESOLVER_URL\nconst authResolverSecret = process.env.TANGLE_CATALOG_AUTH_RESOLVER_SECRET\nif (Boolean(authResolverUrl) !== Boolean(authResolverSecret)) {\n console.error('TANGLE_CATALOG_AUTH_RESOLVER_URL and TANGLE_CATALOG_AUTH_RESOLVER_SECRET must be set together.')\n process.exit(1)\n}\n\nconst port = Number(process.env.PORT ?? process.env.TANGLE_CATALOG_RUNTIME_PORT ?? 4109)\nif (!Number.isInteger(port) || port < 1 || port > 65_535) {\n console.error('PORT must be an integer between 1 and 65535.')\n process.exit(1)\n}\n\nconst server = await startTangleCatalogRuntimeNodeServer({\n secret,\n host: process.env.HOST ?? process.env.TANGLE_CATALOG_RUNTIME_HOST ?? '0.0.0.0',\n port,\n authResolver: authResolverUrl && authResolverSecret\n ? {\n endpoint: authResolverUrl,\n secret: authResolverSecret,\n }\n : false,\n onLog: (event) => {\n const line = JSON.stringify({\n level: event.level,\n message: event.message,\n ...event.metadata,\n })\n if (event.level === 'error') console.error(line)\n else console.log(line)\n },\n})\n\nconsole.log(JSON.stringify({\n level: 'info',\n message: 'Tangle catalog runtime listening.',\n url: server.url,\n}))\n\nfor (const signal of ['SIGINT', 'SIGTERM'] as const) {\n process.once(signal, async () => {\n await server.close()\n process.exit(0)\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAM,OAAO,IAAI,IAAI,QAAQ,KAAK,MAAM,CAAC,CAAC;AAC1C,IAAI,KAAK,IAAI,sBAAsB,GAAG;AACpC,UAAQ,IAAI,KAAK,UAAU,yCAAyC;AAAA,IAClE,0BAA0B,QAAQ,IAAI;AAAA,EACxC,CAAC,GAAG,MAAM,CAAC,CAAC;AACZ,UAAQ,KAAK,CAAC;AAChB;AAEA,IAAI,KAAK,IAAI,kBAAkB,GAAG;AAChC,UAAQ,IAAI,yCAAyC;AAAA,IACnD,0BAA0B,QAAQ,IAAI;AAAA,EACxC,CAAC,CAAC;AACF,UAAQ,KAAK,CAAC;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ACF,CAAC;AAED,QAAQ,IAAI,KAAK,UAAU;AAAA,EACzB,OAAO;AAAA,EACP,SAAS;AAAA,EACT,KAAK,OAAO;AACd,CAAC,CAAC;AAEF,WAAW,UAAU,CAAC,UAAU,SAAS,GAAY;AACnD,UAAQ,KAAK,QAAQ,YAAY;AAC/B,UAAM,OAAO,MAAM;AACnB,YAAQ,KAAK,CAAC;AAAA,EAChB,CAAC;AACH;","names":[]}
package/dist/catalog.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { I as IntegrationCatalogView, a as IntegrationToolDefinition, b as IntegrationToolSearchFilters, c as IntegrationToolSearchResult, M as McpToolDefinition, d as buildIntegrationCatalogView, e as buildIntegrationToolCatalog, i as integrationToolName, p as parseIntegrationToolName, s as searchIntegrationTools, t as toMcpTools } from './registry.js';
2
2
  import './tangle-id-CTU4kGId.js';
3
+ import './errors-Bg3_rxnQ.js';
3
4
  import './connect/index.js';
4
5
  import './middleware/index.js';
5
6
  import './connectors/index.js';
package/dist/catalog.js CHANGED
@@ -5,8 +5,9 @@ import {
5
5
  parseIntegrationToolName,
6
6
  searchIntegrationTools,
7
7
  toMcpTools
8
- } from "./chunk-ICSBYCE2.js";
8
+ } from "./chunk-UWRYFPJW.js";
9
9
  import "./chunk-SVQ4PHDZ.js";
10
+ import "./chunk-H4XYLS7T.js";
10
11
  import "./chunk-4JQ754PA.js";
11
12
  import "./chunk-376UBTNB.js";
12
13
  import "./chunk-JU25UDN2.js";
@@ -0,0 +1,75 @@
1
+ // src/errors.ts
2
+ var IntegrationRuntimeError = class extends Error {
3
+ code;
4
+ status;
5
+ userAction;
6
+ metadata;
7
+ constructor(input) {
8
+ super(input.message);
9
+ this.name = "IntegrationRuntimeError";
10
+ this.code = input.code;
11
+ this.status = input.status ?? statusForCode(input.code);
12
+ this.userAction = input.userAction;
13
+ this.metadata = input.metadata;
14
+ }
15
+ };
16
+ function normalizeIntegrationError(error) {
17
+ if (error instanceof IntegrationRuntimeError) {
18
+ return {
19
+ ok: false,
20
+ code: error.code,
21
+ message: error.message,
22
+ status: error.status,
23
+ userAction: error.userAction,
24
+ metadata: redactUnknown(error.metadata)
25
+ };
26
+ }
27
+ const message = error instanceof Error ? error.message : String(error ?? "Unknown integration error.");
28
+ return {
29
+ ok: false,
30
+ code: inferCode(message),
31
+ message,
32
+ status: 500
33
+ };
34
+ }
35
+ function statusForCode(code) {
36
+ if (code === "missing_connection" || code === "missing_grant") return 409;
37
+ if (code === "approval_required") return 202;
38
+ if (code === "approval_denied") return 403;
39
+ if (code === "connection_revoked" || code === "connection_expired" || code === "provider_auth_failed") return 401;
40
+ if (code === "scope_missing" || code === "action_denied" || code === "passthrough_disabled") return 403;
41
+ if (code === "action_not_found" || code === "trigger_not_found" || code === "manifest_invalid" || code === "input_invalid") return 400;
42
+ if (code === "provider_rate_limited") return 429;
43
+ if (code === "provider_unavailable") return 503;
44
+ if (code === "capability_expired" || code === "capability_invalid") return 401;
45
+ return 500;
46
+ }
47
+ function inferCode(message) {
48
+ if (/approval/i.test(message)) return "approval_required";
49
+ if (/scope/i.test(message)) return "scope_missing";
50
+ if (/expired/i.test(message)) return "connection_expired";
51
+ if (/revoked/i.test(message)) return "connection_revoked";
52
+ if (/rate.?limit|429/i.test(message)) return "provider_rate_limited";
53
+ if (/unauth|forbidden|401|403/i.test(message)) return "provider_auth_failed";
54
+ return "unknown";
55
+ }
56
+ function redactUnknown(value) {
57
+ if (Array.isArray(value)) return value.map(redactUnknown);
58
+ if (!value || typeof value !== "object") return value;
59
+ const out = {};
60
+ for (const [key, child] of Object.entries(value)) {
61
+ if (/token|secret|password|authorization|api[_-]?key|credential|refresh/i.test(key)) {
62
+ out[key] = "[REDACTED]";
63
+ } else {
64
+ out[key] = redactUnknown(child);
65
+ }
66
+ }
67
+ return out;
68
+ }
69
+
70
+ export {
71
+ IntegrationRuntimeError,
72
+ normalizeIntegrationError,
73
+ statusForCode
74
+ };
75
+ //# sourceMappingURL=chunk-H4XYLS7T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts"],"sourcesContent":["export type IntegrationErrorCode =\n | 'missing_connection'\n | 'missing_grant'\n | 'approval_required'\n | 'approval_denied'\n | 'connection_revoked'\n | 'connection_expired'\n | 'scope_missing'\n | 'action_denied'\n | 'action_not_found'\n | 'trigger_not_found'\n | 'provider_rate_limited'\n | 'provider_auth_failed'\n | 'provider_unavailable'\n | 'provider_error'\n | 'capability_expired'\n | 'capability_invalid'\n | 'manifest_invalid'\n | 'passthrough_disabled'\n | 'input_invalid'\n | 'unknown'\n\nexport interface IntegrationUserAction {\n type: 'connect' | 'reconnect' | 'approve' | 'retry' | 'contact_support' | 'change_request'\n label: string\n connectorId?: string\n approvalId?: string\n}\n\nexport class IntegrationRuntimeError extends Error {\n readonly code: IntegrationErrorCode\n readonly status: number\n readonly userAction?: IntegrationUserAction\n readonly metadata?: Record<string, unknown>\n\n constructor(input: {\n code: IntegrationErrorCode\n message: string\n status?: number\n userAction?: IntegrationUserAction\n metadata?: Record<string, unknown>\n }) {\n super(input.message)\n this.name = 'IntegrationRuntimeError'\n this.code = input.code\n this.status = input.status ?? statusForCode(input.code)\n this.userAction = input.userAction\n this.metadata = input.metadata\n }\n}\n\nexport interface NormalizedIntegrationError {\n ok: false\n code: IntegrationErrorCode\n message: string\n status: number\n userAction?: IntegrationUserAction\n metadata?: Record<string, unknown>\n}\n\nexport function normalizeIntegrationError(error: unknown): NormalizedIntegrationError {\n if (error instanceof IntegrationRuntimeError) {\n return {\n ok: false,\n code: error.code,\n message: error.message,\n status: error.status,\n userAction: error.userAction,\n metadata: redactUnknown(error.metadata) as Record<string, unknown> | undefined,\n }\n }\n const message = error instanceof Error ? error.message : String(error ?? 'Unknown integration error.')\n return {\n ok: false,\n code: inferCode(message),\n message,\n status: 500,\n }\n}\n\nexport function statusForCode(code: IntegrationErrorCode): number {\n if (code === 'missing_connection' || code === 'missing_grant') return 409\n if (code === 'approval_required') return 202\n if (code === 'approval_denied') return 403\n if (code === 'connection_revoked' || code === 'connection_expired' || code === 'provider_auth_failed') return 401\n if (code === 'scope_missing' || code === 'action_denied' || code === 'passthrough_disabled') return 403\n if (code === 'action_not_found' || code === 'trigger_not_found' || code === 'manifest_invalid' || code === 'input_invalid') return 400\n if (code === 'provider_rate_limited') return 429\n if (code === 'provider_unavailable') return 503\n if (code === 'capability_expired' || code === 'capability_invalid') return 401\n return 500\n}\n\nfunction inferCode(message: string): IntegrationErrorCode {\n if (/approval/i.test(message)) return 'approval_required'\n if (/scope/i.test(message)) return 'scope_missing'\n if (/expired/i.test(message)) return 'connection_expired'\n if (/revoked/i.test(message)) return 'connection_revoked'\n if (/rate.?limit|429/i.test(message)) return 'provider_rate_limited'\n if (/unauth|forbidden|401|403/i.test(message)) return 'provider_auth_failed'\n return 'unknown'\n}\n\nfunction redactUnknown(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(redactUnknown)\n if (!value || typeof value !== 'object') return value\n const out: Record<string, unknown> = {}\n for (const [key, child] of Object.entries(value)) {\n if (/token|secret|password|authorization|api[_-]?key|credential|refresh/i.test(key)) {\n out[key] = '[REDACTED]'\n } else {\n out[key] = redactUnknown(child)\n }\n }\n return out\n}\n"],"mappings":";AA6BO,IAAM,0BAAN,cAAsC,MAAM;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,OAMT;AACD,UAAM,MAAM,OAAO;AACnB,SAAK,OAAO;AACZ,SAAK,OAAO,MAAM;AAClB,SAAK,SAAS,MAAM,UAAU,cAAc,MAAM,IAAI;AACtD,SAAK,aAAa,MAAM;AACxB,SAAK,WAAW,MAAM;AAAA,EACxB;AACF;AAWO,SAAS,0BAA0B,OAA4C;AACpF,MAAI,iBAAiB,yBAAyB;AAC5C,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,MAAM,MAAM;AAAA,MACZ,SAAS,MAAM;AAAA,MACf,QAAQ,MAAM;AAAA,MACd,YAAY,MAAM;AAAA,MAClB,UAAU,cAAc,M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AG;AACnF,UAAI,GAAG,IAAI;AAAA,IACb,OAAO;AACL,UAAI,GAAG,IAAI,cAAc,KAAK;AAAA,IAChC;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -1,3 +1,7 @@
1
+ import {
2
+ IntegrationRuntimeError,
3
+ normalizeIntegrationError
4
+ } from "./chunk-H4XYLS7T.js";
1
5
  import {
2
6
  integrationSpecToConnector,
3
7
  listIntegrationSpecs
@@ -736,75 +740,6 @@ function assertBridgePayload(value) {
736
740
  if (!Array.isArray(payload.tools)) throw new Error("Invalid integration bridge tools.");
737
741
  }
738
742
 
739
- // src/errors.ts
740
- var IntegrationRuntimeError = class extends Error {
741
- code;
742
- status;
743
- userAction;
744
- metadata;
745
- constructor(input) {
746
- super(input.message);
747
- this.name = "IntegrationRuntimeError";
748
- this.code = input.code;
749
- this.status = input.status ?? statusForCode(input.code);
750
- this.userAction = input.userAction;
751
- this.metadata = input.metadata;
752
- }
753
- };
754
- function normalizeIntegrationError(error) {
755
- if (error instanceof IntegrationRuntimeError) {
756
- return {
757
- ok: false,
758
- code: error.code,
759
- message: error.message,
760
- status: error.status,
761
- userAction: error.userAction,
762
- metadata: redactUnknown2(error.metadata)
763
- };
764
- }
765
- const message = error instanceof Error ? error.message : String(error ?? "Unknown integration error.");
766
- return {
767
- ok: false,
768
- code: inferCode(message),
769
- message,
770
- status: 500
771
- };
772
- }
773
- function statusForCode(code) {
774
- if (code === "missing_connection" || code === "missing_grant") return 409;
775
- if (code === "approval_required") return 202;
776
- if (code === "approval_denied") return 403;
777
- if (code === "connection_revoked" || code === "connection_expired" || code === "provider_auth_failed") return 401;
778
- if (code === "scope_missing" || code === "action_denied" || code === "passthrough_disabled") return 403;
779
- if (code === "action_not_found" || code === "trigger_not_found" || code === "manifest_invalid" || code === "input_invalid") return 400;
780
- if (code === "provider_rate_limited") return 429;
781
- if (code === "provider_unavailable") return 503;
782
- if (code === "capability_expired" || code === "capability_invalid") return 401;
783
- return 500;
784
- }
785
- function inferCode(message) {
786
- if (/approval/i.test(message)) return "approval_required";
787
- if (/scope/i.test(message)) return "scope_missing";
788
- if (/expired/i.test(message)) return "connection_expired";
789
- if (/revoked/i.test(message)) return "connection_revoked";
790
- if (/rate.?limit|429/i.test(message)) return "provider_rate_limited";
791
- if (/unauth|forbidden|401|403/i.test(message)) return "provider_auth_failed";
792
- return "unknown";
793
- }
794
- function redactUnknown2(value) {
795
- if (Array.isArray(value)) return value.map(redactUnknown2);
796
- if (!value || typeof value !== "object") return value;
797
- const out = {};
798
- for (const [key, child] of Object.entries(value)) {
799
- if (/token|secret|password|authorization|api[_-]?key|credential|refresh/i.test(key)) {
800
- out[key] = "[REDACTED]";
801
- } else {
802
- out[key] = redactUnknown2(child);
803
- }
804
- }
805
- return out;
806
- }
807
-
808
743
  // src/client.ts
809
744
  var TangleIntegrationsClient = class {
810
745
  endpoint;
@@ -1854,7 +1789,7 @@ function buildApprovalRequest(ctx, reason, requestedAt) {
1854
1789
  function redactApprovalRequest(request) {
1855
1790
  return {
1856
1791
  ...request,
1857
- inputPreview: redactUnknown3(request.inputPreview)
1792
+ inputPreview: redactUnknown2(request.inputPreview)
1858
1793
  };
1859
1794
  }
1860
1795
  function ruleMatches(rule, ctx) {
@@ -1878,17 +1813,17 @@ function defaultReason2(effect, risk) {
1878
1813
  return `${risk} integration action requires approval by default policy.`;
1879
1814
  }
1880
1815
  function previewInput(input) {
1881
- return redactUnknown3(input);
1816
+ return redactUnknown2(input);
1882
1817
  }
1883
- function redactUnknown3(value) {
1884
- if (Array.isArray(value)) return value.map(redactUnknown3);
1818
+ function redactUnknown2(value) {
1819
+ if (Array.isArray(value)) return value.map(redactUnknown2);
1885
1820
  if (!value || typeof value !== "object") return value;
1886
1821
  const out = {};
1887
1822
  for (const [key, child] of Object.entries(value)) {
1888
1823
  if (/token|secret|password|authorization|api[_-]?key|credential/i.test(key)) {
1889
1824
  out[key] = "[REDACTED]";
1890
1825
  } else {
1891
- out[key] = redactUnknown3(child);
1826
+ out[key] = redactUnknown2(child);
1892
1827
  }
1893
1828
  }
1894
1829
  return out;
@@ -1971,13 +1906,13 @@ function redactInvocationEnvelope(envelope) {
1971
1906
  return {
1972
1907
  ...envelope,
1973
1908
  capabilityToken: "[REDACTED]",
1974
- input: redactUnknown4(envelope.input)
1909
+ input: redactUnknown3(envelope.input)
1975
1910
  };
1976
1911
  }
1977
1912
  function redactCapability(capability) {
1978
1913
  return {
1979
1914
  ...capability,
1980
- metadata: redactUnknown4(capability.metadata)
1915
+ metadata: redactUnknown3(capability.metadata)
1981
1916
  };
1982
1917
  }
1983
1918
  function normalizeIntegrationResult(result) {
@@ -2030,15 +1965,15 @@ var IntegrationSandboxHost = class {
2030
1965
  return dispatchIntegrationInvocation(envelope, this.options);
2031
1966
  }
2032
1967
  };
2033
- function redactUnknown4(value) {
2034
- if (Array.isArray(value)) return value.map(redactUnknown4);
1968
+ function redactUnknown3(value) {
1969
+ if (Array.isArray(value)) return value.map(redactUnknown3);
2035
1970
  if (!value || typeof value !== "object") return value;
2036
1971
  const out = {};
2037
1972
  for (const [key, child] of Object.entries(value)) {
2038
1973
  if (/token|secret|password|authorization|api[_-]?key|credential/i.test(key)) {
2039
1974
  out[key] = "[REDACTED]";
2040
1975
  } else {
2041
- out[key] = redactUnknown4(child);
1976
+ out[key] = redactUnknown3(child);
2042
1977
  }
2043
1978
  }
2044
1979
  return out;
@@ -4476,9 +4411,6 @@ export {
4476
4411
  buildIntegrationBridgeEnvironment,
4477
4412
  parseIntegrationBridgeEnvironment,
4478
4413
  redactIntegrationBridgePayload,
4479
- IntegrationRuntimeError,
4480
- normalizeIntegrationError,
4481
- statusForCode,
4482
4414
  TangleIntegrationsClient,
4483
4415
  createTangleIntegrationsClient,
4484
4416
  renderConsentSummary,
@@ -4552,4 +4484,4 @@ export {
4552
4484
  signCapability,
4553
4485
  verifyCapabilityToken
4554
4486
  };
4555
- //# sourceMappingURL=chunk-ICSBYCE2.js.map
4487
+ //# sourceMappingURL=chunk-UWRYFPJW.js.map