@tangle-network/agent-integrations 1.0.2 → 1.0.4

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.
Files changed (115) hide show
  1. package/README.md +31 -30
  2. package/data/bundled-adapter-manifests.json +1 -1
  3. package/dist/{adapters-DbYKxFVp.js → adapters-x5V_2d6D.js} +447 -678
  4. package/dist/{adapters-DbYKxFVp.js.map → adapters-x5V_2d6D.js.map} +1 -1
  5. package/dist/{billing-access-policy-CtvuHvM8.d.ts → billing-access-policy-Ce3WWxG5.d.ts} +2 -3
  6. package/dist/billing-access-policy-Ce3WWxG5.d.ts.map +1 -0
  7. package/dist/billing-access-policy-DJ63AxZ5.js.map +1 -1
  8. package/dist/{bundled-manifest-data-CgUuwak6.js → bundled-manifest-data-DLzwtr7z.js} +89 -1
  9. package/dist/{bundled-manifest-data-CgUuwak6.js.map → bundled-manifest-data-DLzwtr7z.js.map} +1 -1
  10. package/dist/{bundled-manifest-runtime-EpjLQKA9.d.ts → bundled-manifest-runtime-nc86Eowo.d.ts} +2 -2
  11. package/dist/{bundled-manifest-runtime-EpjLQKA9.d.ts.map → bundled-manifest-runtime-nc86Eowo.d.ts.map} +1 -1
  12. package/dist/{catalog-CFvKzwVj.js → catalog-DEbD4Cn3.js} +6 -10
  13. package/dist/catalog-DEbD4Cn3.js.map +1 -0
  14. package/dist/{catalog-z4zNeXVL.d.ts → catalog-VQlC1Ew0.d.ts} +8 -12
  15. package/dist/{catalog-z4zNeXVL.d.ts.map → catalog-VQlC1Ew0.d.ts.map} +1 -1
  16. package/dist/catalog.d.ts +1 -1
  17. package/dist/catalog.js +1 -1
  18. package/dist/connect/index.d.ts +1 -1
  19. package/dist/connectors/adapters/index.d.ts +3 -2
  20. package/dist/connectors/adapters/index.js +1 -1
  21. package/dist/connectors/index.d.ts +7 -7
  22. package/dist/connectors/index.js +2 -2
  23. package/dist/connectors/oauth.d.ts +1 -1
  24. package/dist/{consumer-PHOoRorX.d.ts → consumer-BMWxApGG.d.ts} +10 -122
  25. package/dist/consumer-BMWxApGG.d.ts.map +1 -0
  26. package/dist/consumer.d.ts +1 -1
  27. package/dist/{types-Bq85dJDW.d.ts → core-types-ZuEjjJAr.d.ts} +546 -14
  28. package/dist/core-types-ZuEjjJAr.d.ts.map +1 -0
  29. package/dist/{coverage-catalog-5LheuThC.d.ts → coverage-catalog-CsJmShn5.d.ts} +3 -4
  30. package/dist/{coverage-catalog-5LheuThC.d.ts.map → coverage-catalog-CsJmShn5.d.ts.map} +1 -1
  31. package/dist/coverage-catalog.d.ts +2 -2
  32. package/dist/coverage-catalog.js +1 -22
  33. package/dist/coverage-catalog.js.map +1 -1
  34. package/dist/{errors-8ePwEZRM.d.ts → errors-CvjrGB5r.d.ts} +4 -1
  35. package/dist/errors-CvjrGB5r.d.ts.map +1 -0
  36. package/dist/{errors-CvO_y8JO.js → errors-DSdeYms8.js} +16 -3
  37. package/dist/errors-DSdeYms8.js.map +1 -0
  38. package/dist/{hub-DkiKVWJX.d.ts → hub-CRteFmOR.d.ts} +3 -3
  39. package/dist/{hub-DkiKVWJX.d.ts.map → hub-CRteFmOR.d.ts.map} +1 -1
  40. package/dist/{hub-Du6wsA1o.js → hub-DnPkr4xn.js} +2 -1
  41. package/dist/hub-DnPkr4xn.js.map +1 -0
  42. package/dist/hub.d.ts +1 -1
  43. package/dist/hub.js +1 -1
  44. package/dist/{index-BFK-G6g1.d.ts → index-BAI3O7bc.d.ts} +2 -2
  45. package/dist/{index-BFK-G6g1.d.ts.map → index-BAI3O7bc.d.ts.map} +1 -1
  46. package/dist/{index-poLalSQ6.d.ts → index-BbluAb0U.d.ts} +3 -12
  47. package/dist/index-BbluAb0U.d.ts.map +1 -0
  48. package/dist/{index-HBXVPkSs.d.ts → index-C5W0VfzQ.d.ts} +19 -194
  49. package/dist/index-C5W0VfzQ.d.ts.map +1 -0
  50. package/dist/{index-CkCYzn8f.d.ts → index-CezgaMuD.d.ts} +3 -3
  51. package/dist/{index-CkCYzn8f.d.ts.map → index-CezgaMuD.d.ts.map} +1 -1
  52. package/dist/{index-DoJFdW9K.d.ts → index-Dev4r3_u.d.ts} +3 -3
  53. package/dist/{index-DoJFdW9K.d.ts.map → index-Dev4r3_u.d.ts.map} +1 -1
  54. package/dist/index.d.ts +19 -20
  55. package/dist/index.js +11 -11
  56. package/dist/internal/bundled-manifest-runtime.d.ts +1 -1
  57. package/dist/internal/bundled-manifest-runtime.js +1 -1
  58. package/dist/mcp.d.ts +2 -2
  59. package/dist/mcp.js +2 -2
  60. package/dist/middleware/index.d.ts +1 -1
  61. package/dist/{oauth-DoUCpYU_.d.ts → oauth-Br5r5Ms0.d.ts} +2 -2
  62. package/dist/{oauth-DoUCpYU_.d.ts.map → oauth-Br5r5Ms0.d.ts.map} +1 -1
  63. package/dist/{policy-C8jynxf9.d.ts → policy-BH4ZAZ4s.d.ts} +3 -14
  64. package/dist/policy-BH4ZAZ4s.d.ts.map +1 -0
  65. package/dist/{policy-UOPcZqdE.js → policy-C0XpcajG.js} +5 -30
  66. package/dist/policy-C0XpcajG.js.map +1 -0
  67. package/dist/{redaction-B6R-ZeWT.js → redaction-dXj4op-I.js} +16 -2
  68. package/dist/redaction-dXj4op-I.js.map +1 -0
  69. package/dist/{registry-0xWMSBUu.d.ts → registry-CJFl46d3.d.ts} +3 -3
  70. package/dist/{registry-0xWMSBUu.d.ts.map → registry-CJFl46d3.d.ts.map} +1 -1
  71. package/dist/{registry-core-B1ApiG47.d.ts → registry-core-_BnkpeSe.d.ts} +2 -2
  72. package/dist/{registry-core-B1ApiG47.d.ts.map → registry-core-_BnkpeSe.d.ts.map} +1 -1
  73. package/dist/registry.d.ts +2 -2
  74. package/dist/registry.js +1 -1
  75. package/dist/runtime.d.ts +1 -1
  76. package/dist/runtime.js +1 -1
  77. package/dist/sandbox.d.ts +2 -2
  78. package/dist/sandbox.js +5 -20
  79. package/dist/sandbox.js.map +1 -1
  80. package/dist/{specs-amTqWDjy.js → specs-BQHb_KgP.js} +4 -23
  81. package/dist/specs-BQHb_KgP.js.map +1 -0
  82. package/dist/specs.d.ts +2 -2
  83. package/dist/specs.js +2 -2
  84. package/dist/{src-DsEhuVEx.js → src-BZmlzQzN.js} +8 -186
  85. package/dist/src-BZmlzQzN.js.map +1 -0
  86. package/dist/stripe/index.d.ts +3 -79
  87. package/dist/stripe/index.d.ts.map +1 -1
  88. package/dist/stripe/index.js +5 -52
  89. package/dist/stripe/index.js.map +1 -1
  90. package/dist/{tangle-id-BW5dTiGi.d.ts → tangle-id-BnzGOA_W.d.ts} +2 -2
  91. package/dist/{tangle-id-BW5dTiGi.d.ts.map → tangle-id-BnzGOA_W.d.ts.map} +1 -1
  92. package/dist/types-CjrugGcd.js.map +1 -1
  93. package/dist/worker.d.ts +3 -3
  94. package/dist/worker.js +2 -2
  95. package/docs/external-product-integration.md +14 -5
  96. package/docs/integration-coverage-checklist.md +1 -12
  97. package/docs/private-audio-transcription.md +1 -1
  98. package/package.json +2 -1
  99. package/dist/billing-access-policy-CtvuHvM8.d.ts.map +0 -1
  100. package/dist/catalog-CFvKzwVj.js.map +0 -1
  101. package/dist/consumer-PHOoRorX.d.ts.map +0 -1
  102. package/dist/core-types-0BenSoZJ.d.ts +0 -365
  103. package/dist/core-types-0BenSoZJ.d.ts.map +0 -1
  104. package/dist/errors-8ePwEZRM.d.ts.map +0 -1
  105. package/dist/errors-CvO_y8JO.js.map +0 -1
  106. package/dist/hub-Du6wsA1o.js.map +0 -1
  107. package/dist/index-HBXVPkSs.d.ts.map +0 -1
  108. package/dist/index-poLalSQ6.d.ts.map +0 -1
  109. package/dist/policy-C8jynxf9.d.ts.map +0 -1
  110. package/dist/policy-UOPcZqdE.js.map +0 -1
  111. package/dist/redaction-B6R-ZeWT.js.map +0 -1
  112. package/dist/specs-amTqWDjy.js.map +0 -1
  113. package/dist/src-DsEhuVEx.js.map +0 -1
  114. package/dist/types-Bq85dJDW.d.ts.map +0 -1
  115. package/docs/generated-integration-coverage-checklist.md +0 -156
@@ -1,4 +1,4 @@
1
- import { M as TokenMetadataSource, S as OAuth2TokenClientAuthMethod } from "./types-Bq85dJDW.js";
1
+ import { at as OAuth2TokenClientAuthMethod, ht as TokenMetadataSource } from "./core-types-ZuEjjJAr.js";
2
2
  //#region src/connectors/oauth-protocol.d.ts
3
3
  type OAuthPkceMode = 'required' | 'supported' | 'unsupported';
4
4
  /** Shared by stateful flows and hosts that persist their own state. Reserved
@@ -154,4 +154,4 @@ declare function consumePendingFlow(state: string, store?: OAuthFlowStore): Prom
154
154
  declare function _resetPendingFlowsForTests(): void;
155
155
  //#endregion
156
156
  export { exchangeAuthorizationCode as _, StartOAuthOutput as a, redactOAuthSensitiveText as b, startOAuthFlow as c, OAuthTokens as d, RefreshInput as f, createOAuthTokenRequestHeaders as g, createOAuthBasicAuthorizationHeader as h, StartOAuthInput as i, ExchangeCodeInput as l, captureOAuthTokenMetadata as m, OAuthFlowStore as n, _resetPendingFlowsForTests as o, buildOAuthAuthorizationUrl as p, PendingOAuthFlow as r, consumePendingFlow as s, InMemoryOAuthFlowStore as t, OAuthPkceMode as u, formEncodeOAuthClientCredential as v, refreshAccessToken as x, oauthClientCredentialRedactionValues as y };
157
- //# sourceMappingURL=oauth-DoUCpYU_.d.ts.map
157
+ //# sourceMappingURL=oauth-Br5r5Ms0.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-DoUCpYU_.d.ts","names":[],"sources":["../src/connectors/oauth-protocol.ts","../src/connectors/oauth.ts"],"mappings":";;KAEY;;;iBAII,2BAA2B;EACzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB,SAAS;;UAkBZ;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;EACA,gBAAgB,eAAe;;EAE/B;;EAEA,OAAO;EACP;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;;;;EAIA;;EAEA,WAAW;;;;;iBAMS,0BAA0B,OAAO,oBAAoB,QAAQ;UAclE;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;;;iBAKW,mBAAmB,OAAO,eAAe,QAAQ;iBA2CvD,0BACd,eAAe,eAAe,kCAC9B,MAAM,0BACL;;;iBA2Ba,+BACd,aAAa,SAAS,0BACrB;iBAQa,gCAAgC;iBAIhC,oCACd,kBACA,sBACA,gBAAe;iBAiBD,qCACd,kBACA,uBACA;iBAgBc,yBACd,cACA;;;UCrNe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA;;UAKe;EACf,IAAI,eAAe,MAAM,mBAAmB;EAC5C,QAAQ,gBAAgB,QAAQ,gCAAgC;EAChE,OAAO,cAAc;EACrB,UAAU;;cAGC,kCAAkC;mBAC5B;EAEjB,IAAI,eAAe,MAAM;EAIzB,QAAQ,gBAAgB;EAOxB,MAAM;EAMN;;UAOe;EACf;EACA;EACA;EACA;EACA;;EAEA;EACA;;;EAGA;;EAEA,OAAO;EACP;;;EAGA,kBAAkB;;;EAGlB,QAAQ;;EAER;;UAGe;;EAEf;;;EAGA;;;;;iBAMc,eAAe,OAAO,kBAAkB;;;iBA6BlC,mBAAmB,eAAe,QAAO,iBAAoC,QAAQ;;iBAc3F"}
1
+ {"version":3,"file":"oauth-Br5r5Ms0.d.ts","names":[],"sources":["../src/connectors/oauth-protocol.ts","../src/connectors/oauth.ts"],"mappings":";;KAEY;;;iBAII,2BAA2B;EACzC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,kBAAkB,SAAS;;UAkBZ;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;EACA,gBAAgB,eAAe;;EAE/B;;EAEA,OAAO;EACP;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;UAGM;EACf;EACA;EACA;EACA;EACA;;;;EAIA;;EAEA,WAAW;;;;;iBAMS,0BAA0B,OAAO,oBAAoB,QAAQ;UAclE;EACf;EACA;;EAEA;;EAEA,wBAAwB;EACxB;EACA;EACA;;EAEA,sBAAsB,SAAS;EAC/B,mBAAmB;EACnB,SAAS;;;;iBAKW,mBAAmB,OAAO,eAAe,QAAQ;iBA2CvD,0BACd,eAAe,eAAe,kCAC9B,MAAM,0BACL;;;iBA2Ba,+BACd,aAAa,SAAS,0BACrB;iBAQa,gCAAgC;iBAIhC,oCACd,kBACA,sBACA,gBAAe;iBAiBD,qCACd,kBACA,uBACA;iBAgBc,yBACd,cACA;;;UCrNe;;EAEf;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;EAGA;;UAKe;EACf,IAAI,eAAe,MAAM,mBAAmB;EAC5C,QAAQ,gBAAgB,QAAQ,gCAAgC;EAChE,OAAO,cAAc;EACrB,UAAU;;cAGC,kCAAkC;mBAC5B;EAEjB,IAAI,eAAe,MAAM;EAIzB,QAAQ,gBAAgB;EAOxB,MAAM;EAMN;;UAOe;EACf;EACA;EACA;EACA;EACA;;EAEA;EACA;;;EAGA;;EAEA,OAAO;EACP;;;EAGA,kBAAkB;;;EAGlB,QAAQ;;EAER;;UAGe;;EAEf;;;EAGA;;;;;iBAMc,eAAe,OAAO,kBAAkB;;;iBA6BlC,mBAAmB,eAAe,QAAO,iBAAoC,QAAQ;;iBAc3F"}
@@ -1,4 +1,4 @@
1
- import { D as IntegrationPolicyEngine, E as IntegrationPolicyDecision, b as IntegrationDataClass, c as IntegrationActor, f as IntegrationConnection, g as IntegrationConnectorAction, i as IntegrationActionGuard, l as IntegrationApprovalRequest, o as IntegrationActionResult, s as IntegrationActionRisk, x as IntegrationGuardContext } from "./core-types-0BenSoZJ.js";
1
+ import { D as IntegrationPolicyDecision, O as IntegrationPolicyEngine, b as IntegrationDataClass, c as IntegrationActor, g as IntegrationConnectorAction, i as IntegrationActionGuard, l as IntegrationApprovalRequest, o as IntegrationActionResult, s as IntegrationActionRisk, x as IntegrationGuardContext } from "./core-types-ZuEjjJAr.js";
2
2
  //#region src/audit.d.ts
3
3
  type IntegrationAuditEventType = 'connection.created' | 'connection.updated' | 'connection.revoked' | 'grant.created' | 'grant.revoked' | 'capability.issued' | 'action.invoked' | 'action.failed' | 'trigger.subscribed' | 'trigger.received' | 'workflow.installed' | 'approval.requested' | 'approval.resolved' | 'healthcheck.completed';
4
4
  interface IntegrationAuditEvent {
@@ -46,7 +46,6 @@ declare function createAuditingActionGuard(options: {
46
46
  now?: () => Date;
47
47
  includeInputPreview?: boolean;
48
48
  }): IntegrationActionGuard;
49
- declare function sanitizeAuditConnection(connection: IntegrationConnection): Record<string, unknown>;
50
49
  //#endregion
51
50
  //#region src/guard.d.ts
52
51
  interface IntegrationIdempotencyRecord {
@@ -88,7 +87,6 @@ declare class DefaultIntegrationActionGuard implements IntegrationActionGuard {
88
87
  invokeAction(ctx: IntegrationGuardContext, proceed: () => Promise<IntegrationActionResult>): Promise<IntegrationActionResult>;
89
88
  private writeIdempotency;
90
89
  }
91
- declare function createDefaultIntegrationActionGuard(options?: ConstructorParameters<typeof DefaultIntegrationActionGuard>[0]): DefaultIntegrationActionGuard;
92
90
  //#endregion
93
91
  //#region src/policy.d.ts
94
92
  type IntegrationPolicyEffect = 'allow' | 'require_approval' | 'deny';
@@ -110,14 +108,6 @@ interface StaticIntegrationPolicyOptions {
110
108
  defaultDestructiveEffect?: IntegrationPolicyEffect;
111
109
  now?: () => Date;
112
110
  }
113
- interface IntegrationApprovalResolution {
114
- approvalId: string;
115
- approved: boolean;
116
- resolvedBy: string;
117
- resolvedAt: string;
118
- reason?: string;
119
- metadata?: Record<string, unknown>;
120
- }
121
111
  declare class StaticIntegrationPolicyEngine implements IntegrationPolicyEngine {
122
112
  private readonly rules;
123
113
  private readonly defaultReadEffect;
@@ -140,7 +130,6 @@ declare function buildApprovalRequest(ctx: IntegrationGuardContext & {
140
130
  id: string;
141
131
  };
142
132
  }, reason: string, requestedAt: Date): IntegrationApprovalRequest;
143
- declare function redactApprovalRequest(request: IntegrationApprovalRequest): IntegrationApprovalRequest;
144
133
  //#endregion
145
- export { createIntegrationAuditEvent as C, createAuditingActionGuard as S, IntegrationAuditEvent as _, StaticIntegrationPolicyOptions as a, IntegrationAuditSink as b, redactApprovalRequest as c, IntegrationIdempotencyRecord as d, IntegrationIdempotencyStore as f, InMemoryIntegrationAuditStore as g, createDefaultIntegrationActionGuard as h, StaticIntegrationPolicyEngine as i, DefaultIntegrationActionGuard as l, IntegrationRateLimiter as m, IntegrationPolicyEffect as n, buildApprovalRequest as o, IntegrationRateLimitDecision as p, IntegrationPolicyRule as r, createDefaultIntegrationPolicyEngine as s, IntegrationApprovalResolution as t, InMemoryIntegrationIdempotencyStore as u, IntegrationAuditEventType as v, sanitizeAuditConnection as w, IntegrationAuditStore as x, IntegrationAuditFilter as y };
146
- //# sourceMappingURL=policy-C8jynxf9.d.ts.map
134
+ export { IntegrationAuditSink as _, buildApprovalRequest as a, createIntegrationAuditEvent as b, InMemoryIntegrationIdempotencyStore as c, IntegrationRateLimitDecision as d, IntegrationRateLimiter as f, IntegrationAuditFilter as g, IntegrationAuditEventType as h, StaticIntegrationPolicyOptions as i, IntegrationIdempotencyRecord as l, IntegrationAuditEvent as m, IntegrationPolicyRule as n, createDefaultIntegrationPolicyEngine as o, InMemoryIntegrationAuditStore as p, StaticIntegrationPolicyEngine as r, DefaultIntegrationActionGuard as s, IntegrationPolicyEffect as t, IntegrationIdempotencyStore as u, IntegrationAuditStore as v, createAuditingActionGuard as y };
135
+ //# sourceMappingURL=policy-BH4ZAZ4s.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-BH4ZAZ4s.d.ts","names":[],"sources":["../src/audit.ts","../src/guard.ts","../src/policy.ts"],"mappings":";;KAaY;UAgBK;EACf;EACA,MAAM;EACN;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA,OAAO;EACP,YAAY;EACZ;EACA;EACA,WAAW;;UAGI;EACf,OAAO,OAAO,wBAAwB;;UAGvB,8BAA8B;EAC7C,KAAK,SAAS,yBAAyB,QAAQ,2BAA2B;;UAG3D;EACf,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;;cAGW,yCAAyC;mBACnC;EAEjB,OAAO,OAAO;EAId,KAAK,SAAQ,yBAA8B;;iBAK7B,4BAA4B,OAAO,KAAK;EACtD;EACA,sBAAsB;EACtB,YAAY;IACV;iBAYY,0BAA0B;EACxC,MAAM;EACN,UAAU;EACV,YAAY;EACZ;IACE;;;UCtFa;EACf;EACA;EACA,QAAQ;EACR;;UAGe;EACf,IAAI,cAAc,QAAQ,4CAA4C;EACtE,IAAI,QAAQ,+BAA+B;;UAG5B;EACf;EACA;EACA;;UAGe;EACf,MAAM,KAAK,0BAA0B,QAAQ,gCAAgC;;cAGlE,+CAA+C;mBACzC;EAEjB,IAAI,cAAc;EAIlB,IAAI,QAAQ;;cAKD,yCAAyC;mBACnC;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY;IACV,cAAc;IACd,QAAQ;IACR,cAAc;IACd;IACA,YAAY;;EASR,aAAa,KAAK,yBAAyB,eAAe,QAAQ,2BAA2B,QAAQ;UAwF7F;;;;KC7IJ;UAEK;EACf;EACA,QAAQ;EACR;EACA;EACA;EACA;EACA,UAAU;EACV,OAAO;EACP,YAAY;;UAGG;EACf,QAAQ;EACR,oBAAoB;EACpB,qBAAqB;EACrB,2BAA2B;EAC3B,YAAY;;cAGD,yCAAyC;mBACnC;mBACA;mBACA;mBACA;mBACA;EAEjB,YAAY,UAAS;EAQrB,OAAO,KAAK;IAA4B;MAAW;MAAc;;MAAiB;UAgB1E;;iBAOM,qCAAqC,UAAS,KAAK,2CAAgD;iBAInG,qBACd,KAAK;EAA4B;IAAW;IAAc;;GAC1D,gBACA,aAAa,OACZ"}
@@ -1,4 +1,4 @@
1
- import { t as redactUnknown } from "./redaction-B6R-ZeWT.js";
1
+ import { n as redactUnknown, t as projectInputPreview } from "./redaction-dXj4op-I.js";
2
2
  //#region src/web-crypto.ts
3
3
  const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
4
4
  async function sha256Base64Url(value) {
@@ -90,22 +90,6 @@ function createAuditingActionGuard(options) {
90
90
  }
91
91
  } };
92
92
  }
93
- function sanitizeAuditConnection(connection) {
94
- return {
95
- id: connection.id,
96
- owner: connection.owner,
97
- providerId: connection.providerId,
98
- connectorId: connection.connectorId,
99
- status: connection.status,
100
- grantedScopes: connection.grantedScopes,
101
- account: connection.account,
102
- hasSecretRef: Boolean(connection.secretRef),
103
- createdAt: connection.createdAt,
104
- updatedAt: connection.updatedAt,
105
- expiresAt: connection.expiresAt,
106
- lastUsedAt: connection.lastUsedAt
107
- };
108
- }
109
93
  function actionEvent(input) {
110
94
  return createIntegrationAuditEvent({
111
95
  type: input.type,
@@ -124,7 +108,7 @@ function actionEvent(input) {
124
108
  dryRun: input.request.dryRun,
125
109
  externalId: input.result?.externalId,
126
110
  warnings: input.result?.warnings,
127
- inputPreview: input.includeInputPreview ? redactUnknown(input.request.input) : void 0
111
+ inputPreview: input.includeInputPreview ? projectInputPreview(input.ctx.action?.inputPreview, input.request.input) : void 0
128
112
  }
129
113
  });
130
114
  }
@@ -261,9 +245,6 @@ var DefaultIntegrationActionGuard = class {
261
245
  });
262
246
  }
263
247
  };
264
- function createDefaultIntegrationActionGuard(options = {}) {
265
- return new DefaultIntegrationActionGuard(options);
266
- }
267
248
  async function hashRequest(ctx) {
268
249
  return sha256Base64Url(JSON.stringify({
269
250
  connectionId: ctx.connection.id,
@@ -338,13 +319,7 @@ function buildApprovalRequest(ctx, reason, requestedAt) {
338
319
  dataClass: ctx.action.dataClass,
339
320
  reason,
340
321
  requestedAt: requestedAt.toISOString(),
341
- inputPreview: redactUnknown(ctx.request.input)
342
- };
343
- }
344
- function redactApprovalRequest(request) {
345
- return {
346
- ...request,
347
- inputPreview: redactUnknown(request.inputPreview)
322
+ inputPreview: projectInputPreview(ctx.action.inputPreview, ctx.request.input)
348
323
  };
349
324
  }
350
325
  function ruleMatches(rule, ctx) {
@@ -368,6 +343,6 @@ function defaultReason(effect, risk) {
368
343
  return `${risk} integration action requires approval by default policy.`;
369
344
  }
370
345
  //#endregion
371
- export { DefaultIntegrationActionGuard as a, InMemoryIntegrationAuditStore as c, sanitizeAuditConnection as d, redactApprovalRequest as i, createAuditingActionGuard as l, buildApprovalRequest as n, InMemoryIntegrationIdempotencyStore as o, createDefaultIntegrationPolicyEngine as r, createDefaultIntegrationActionGuard as s, StaticIntegrationPolicyEngine as t, createIntegrationAuditEvent as u };
346
+ export { InMemoryIntegrationIdempotencyStore as a, createIntegrationAuditEvent as c, DefaultIntegrationActionGuard as i, buildApprovalRequest as n, InMemoryIntegrationAuditStore as o, createDefaultIntegrationPolicyEngine as r, createAuditingActionGuard as s, StaticIntegrationPolicyEngine as t };
372
347
 
373
- //# sourceMappingURL=policy-UOPcZqdE.js.map
348
+ //# sourceMappingURL=policy-C0XpcajG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"policy-C0XpcajG.js","names":[],"sources":["../src/web-crypto.ts","../src/audit.ts","../src/guard.ts","../src/policy.ts"],"sourcesContent":["const BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n\nexport async function sha256Base64Url(value: string): Promise<string> {\n const crypto = requireWebCrypto()\n const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(value))\n return bytesToBase64Url(new Uint8Array(digest))\n}\n\nexport function createWebCryptoUuid(): string {\n const crypto = requireWebCrypto()\n if (typeof crypto.randomUUID === 'function') return crypto.randomUUID()\n\n const bytes = new Uint8Array(16)\n crypto.getRandomValues(bytes)\n bytes[6] = (bytes[6]! & 0x0f) | 0x40\n bytes[8] = (bytes[8]! & 0x3f) | 0x80\n return [...bytes]\n .map((byte, index) => {\n const value = byte.toString(16).padStart(2, '0')\n return [4, 6, 8, 10].includes(index) ? `-${value}` : value\n })\n .join('')\n}\n\nfunction requireWebCrypto(): Crypto {\n const crypto = globalThis.crypto\n if (!crypto || !crypto.subtle || typeof crypto.getRandomValues !== 'function') {\n throw new Error('The Web Crypto API is required for integration security operations.')\n }\n return crypto\n}\n\nfunction bytesToBase64Url(bytes: Uint8Array): string {\n let encoded = ''\n for (let index = 0; index < bytes.length; index += 3) {\n const first = bytes[index]!\n const second = bytes[index + 1]\n const third = bytes[index + 2]\n encoded += BASE64_ALPHABET[first >> 2]\n encoded += BASE64_ALPHABET[((first & 0x03) << 4) | (second === undefined ? 0 : second >> 4)]\n encoded += second === undefined\n ? '='\n : BASE64_ALPHABET[((second & 0x0f) << 2) | (third === undefined ? 0 : third >> 6)]\n encoded += third === undefined ? '=' : BASE64_ALPHABET[third & 0x3f]\n }\n return encoded.replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/g, '')\n}\n","import type {\n IntegrationActionGuard,\n IntegrationActionRequest,\n IntegrationActionResult,\n IntegrationActor,\n IntegrationConnection,\n IntegrationConnectorAction,\n IntegrationDataClass,\n IntegrationGuardContext,\n} from './core-types.js'\nimport { createWebCryptoUuid } from './web-crypto.js'\nimport { projectInputPreview, redactUnknown } from './redaction.js'\n\nexport type IntegrationAuditEventType =\n | 'connection.created'\n | 'connection.updated'\n | 'connection.revoked'\n | 'grant.created'\n | 'grant.revoked'\n | 'capability.issued'\n | 'action.invoked'\n | 'action.failed'\n | 'trigger.subscribed'\n | 'trigger.received'\n | 'workflow.installed'\n | 'approval.requested'\n | 'approval.resolved'\n | 'healthcheck.completed'\n\nexport interface IntegrationAuditEvent {\n id: string\n type: IntegrationAuditEventType\n occurredAt: string\n actor?: IntegrationActor\n connectionId?: string\n providerId?: string\n connectorId?: string\n action?: string\n risk?: IntegrationConnectorAction['risk']\n dataClass?: IntegrationDataClass\n ok?: boolean\n message?: string\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationAuditSink {\n record(event: IntegrationAuditEvent): Promise<void> | void\n}\n\nexport interface IntegrationAuditStore extends IntegrationAuditSink {\n list(filter?: IntegrationAuditFilter): Promise<IntegrationAuditEvent[]> | IntegrationAuditEvent[]\n}\n\nexport interface IntegrationAuditFilter {\n type?: IntegrationAuditEventType\n actor?: IntegrationActor\n connectionId?: string\n providerId?: string\n connectorId?: string\n action?: string\n}\n\nexport class InMemoryIntegrationAuditStore implements IntegrationAuditStore {\n private readonly events: IntegrationAuditEvent[] = []\n\n record(event: IntegrationAuditEvent): void {\n this.events.push(event)\n }\n\n list(filter: IntegrationAuditFilter = {}): IntegrationAuditEvent[] {\n return this.events.filter((event) => matchesFilter(event, filter))\n }\n}\n\nexport function createIntegrationAuditEvent(input: Omit<IntegrationAuditEvent, 'id' | 'occurredAt'> & {\n id?: string\n occurredAt?: string | Date\n now?: () => Date\n}): IntegrationAuditEvent {\n const occurredAt = input.occurredAt instanceof Date\n ? input.occurredAt.toISOString()\n : input.occurredAt ?? (input.now?.() ?? new Date()).toISOString()\n return {\n ...input,\n id: input.id ?? `audit_${createWebCryptoUuid()}`,\n occurredAt,\n metadata: input.metadata ? redactUnknown(input.metadata) as Record<string, unknown> : undefined,\n }\n}\n\nexport function createAuditingActionGuard(options: {\n sink: IntegrationAuditSink\n subject?: IntegrationActor\n now?: () => Date\n includeInputPreview?: boolean\n}): IntegrationActionGuard {\n const now = options.now ?? (() => new Date())\n return {\n async invokeAction(ctx: IntegrationGuardContext, proceed: () => Promise<IntegrationActionResult>): Promise<IntegrationActionResult> {\n const startedAt = now()\n try {\n const result = await proceed()\n await options.sink.record(actionEvent({\n ctx,\n request: ctx.request,\n result,\n type: result.ok ? 'action.invoked' : 'action.failed',\n subject: options.subject,\n occurredAt: startedAt,\n includeInputPreview: options.includeInputPreview,\n }))\n return result\n } catch (error) {\n await options.sink.record(actionEvent({\n ctx,\n request: ctx.request,\n type: 'action.failed',\n subject: options.subject,\n occurredAt: startedAt,\n includeInputPreview: options.includeInputPreview,\n message: error instanceof Error ? error.message : 'Integration action failed.',\n }))\n throw error\n }\n },\n }\n}\n\nfunction actionEvent(input: {\n ctx: IntegrationGuardContext\n request: IntegrationActionRequest\n result?: IntegrationActionResult\n type: 'action.invoked' | 'action.failed'\n subject?: IntegrationActor\n occurredAt: Date\n includeInputPreview?: boolean\n message?: string\n}): IntegrationAuditEvent {\n return createIntegrationAuditEvent({\n type: input.type,\n occurredAt: input.occurredAt,\n actor: input.subject ?? input.ctx.connection.owner,\n connectionId: input.ctx.connection.id,\n providerId: input.ctx.connection.providerId,\n connectorId: input.ctx.connection.connectorId,\n action: input.request.action,\n risk: input.ctx.action?.risk,\n dataClass: input.ctx.action?.dataClass,\n ok: input.result?.ok ?? false,\n message: input.message,\n metadata: {\n idempotencyKey: input.request.idempotencyKey,\n dryRun: input.request.dryRun,\n externalId: input.result?.externalId,\n warnings: input.result?.warnings,\n inputPreview: input.includeInputPreview\n ? projectInputPreview(input.ctx.action?.inputPreview, input.request.input)\n : undefined,\n },\n })\n}\n\nfunction matchesFilter(event: IntegrationAuditEvent, filter: IntegrationAuditFilter): boolean {\n if (filter.type && event.type !== filter.type) return false\n if (filter.actor && (!event.actor || event.actor.type !== filter.actor.type || event.actor.id !== filter.actor.id)) return false\n if (filter.connectionId && event.connectionId !== filter.connectionId) return false\n if (filter.providerId && event.providerId !== filter.providerId) return false\n if (filter.connectorId && event.connectorId !== filter.connectorId) return false\n if (filter.action && event.action !== filter.action) return false\n return true\n}\n","import type {\n IntegrationActionGuard,\n IntegrationActionResult,\n IntegrationGuardContext,\n} from './core-types.js'\nimport type { IntegrationAuditSink } from './audit.js'\nimport { createIntegrationAuditEvent } from './audit.js'\nimport { sha256Base64Url } from './web-crypto.js'\n\nexport interface IntegrationIdempotencyRecord {\n key: string\n requestHash: string\n result: IntegrationActionResult\n createdAt: string\n}\n\nexport interface IntegrationIdempotencyStore {\n get(key: string): Promise<IntegrationIdempotencyRecord | undefined> | IntegrationIdempotencyRecord | undefined\n put(record: IntegrationIdempotencyRecord): Promise<void> | void\n}\n\nexport interface IntegrationRateLimitDecision {\n allowed: boolean\n retryAfterMs?: number\n reason?: string\n}\n\nexport interface IntegrationRateLimiter {\n check(ctx: IntegrationGuardContext): Promise<IntegrationRateLimitDecision> | IntegrationRateLimitDecision\n}\n\nexport class InMemoryIntegrationIdempotencyStore implements IntegrationIdempotencyStore {\n private readonly records = new Map<string, IntegrationIdempotencyRecord>()\n\n get(key: string): IntegrationIdempotencyRecord | undefined {\n return this.records.get(key)\n }\n\n put(record: IntegrationIdempotencyRecord): void {\n this.records.set(record.key, record)\n }\n}\n\nexport class DefaultIntegrationActionGuard implements IntegrationActionGuard {\n private readonly idempotency: IntegrationIdempotencyStore | undefined\n private readonly audit: IntegrationAuditSink | undefined\n private readonly rateLimiter: IntegrationRateLimiter | undefined\n private readonly requireIdempotencyForMutations: boolean\n private readonly now: () => Date\n\n constructor(options: {\n idempotency?: IntegrationIdempotencyStore\n audit?: IntegrationAuditSink\n rateLimiter?: IntegrationRateLimiter\n requireIdempotencyForMutations?: boolean\n now?: () => Date\n } = {}) {\n this.idempotency = options.idempotency\n this.audit = options.audit\n this.rateLimiter = options.rateLimiter\n this.requireIdempotencyForMutations = options.requireIdempotencyForMutations ?? false\n this.now = options.now ?? (() => new Date())\n }\n\n async invokeAction(ctx: IntegrationGuardContext, proceed: () => Promise<IntegrationActionResult>): Promise<IntegrationActionResult> {\n const idempotencyKey = ctx.request.idempotencyKey\n if (this.requireIdempotencyForMutations && ctx.action?.risk !== 'read' && !idempotencyKey) {\n return {\n ok: false,\n action: ctx.request.action,\n output: {\n idempotencyRequired: true,\n message: 'State-changing integration actions require an idempotency key.',\n },\n }\n }\n const requestHash = idempotencyKey && this.idempotency ? await hashRequest(ctx) : undefined\n if (idempotencyKey && this.idempotency && requestHash) {\n const existing = await this.idempotency.get(idempotencyKey)\n if (existing) {\n if (existing.requestHash !== requestHash) {\n return {\n ok: false,\n action: ctx.request.action,\n output: { idempotencyConflict: true, message: 'Idempotency key was reused with different integration input.' },\n }\n }\n return {\n ...existing.result,\n metadata: { ...(existing.result.metadata ?? {}), idempotentReplay: true },\n }\n }\n }\n\n if (ctx.request.dryRun && ctx.action?.risk !== 'read') {\n const result: IntegrationActionResult = {\n ok: true,\n action: ctx.request.action,\n output: { dryRun: true },\n metadata: { dryRun: true },\n }\n await this.writeIdempotency(idempotencyKey, requestHash, result)\n return result\n }\n\n const rateLimit = await this.rateLimiter?.check(ctx)\n if (rateLimit && !rateLimit.allowed) {\n return {\n ok: false,\n action: ctx.request.action,\n output: { rateLimited: true, retryAfterMs: rateLimit.retryAfterMs, message: rateLimit.reason ?? 'Integration rate limit exceeded.' },\n }\n }\n\n try {\n const result = await proceed()\n if (result.ok) {\n await this.writeIdempotency(idempotencyKey, requestHash, result)\n }\n await this.audit?.record(createIntegrationAuditEvent({\n type: result.ok ? 'action.invoked' : 'action.failed',\n actor: ctx.connection.owner,\n connectionId: ctx.connection.id,\n providerId: ctx.connection.providerId,\n connectorId: ctx.connection.connectorId,\n action: ctx.request.action,\n risk: ctx.action?.risk,\n dataClass: ctx.action?.dataClass,\n ok: result.ok,\n metadata: { idempotencyKey, externalId: result.externalId, warnings: result.warnings },\n now: this.now,\n }))\n return result\n } catch (error) {\n await this.audit?.record(createIntegrationAuditEvent({\n type: 'action.failed',\n actor: ctx.connection.owner,\n connectionId: ctx.connection.id,\n providerId: ctx.connection.providerId,\n connectorId: ctx.connection.connectorId,\n action: ctx.request.action,\n risk: ctx.action?.risk,\n dataClass: ctx.action?.dataClass,\n ok: false,\n message: error instanceof Error ? error.message : 'Integration action failed.',\n metadata: { idempotencyKey },\n now: this.now,\n }))\n throw error\n }\n }\n\n private async writeIdempotency(key: string | undefined, requestHash: string | undefined, result: IntegrationActionResult): Promise<void> {\n if (!key || !this.idempotency || !requestHash) return\n await this.idempotency.put({\n key,\n requestHash,\n result,\n createdAt: this.now().toISOString(),\n })\n }\n}\n\nasync function hashRequest(ctx: IntegrationGuardContext): Promise<string> {\n return sha256Base64Url(JSON.stringify({\n connectionId: ctx.connection.id,\n action: ctx.request.action,\n input: ctx.request.input ?? null,\n dryRun: ctx.request.dryRun ?? false,\n }))\n}\n","import type {\n IntegrationActionRisk,\n IntegrationApprovalRequest,\n IntegrationDataClass,\n IntegrationGuardContext,\n IntegrationPolicyDecision,\n IntegrationPolicyEngine,\n} from './core-types.js'\nimport { createWebCryptoUuid } from './web-crypto.js'\nimport { projectInputPreview } from './redaction.js'\n\nexport type IntegrationPolicyEffect = 'allow' | 'require_approval' | 'deny'\n\nexport interface IntegrationPolicyRule {\n id: string\n effect: IntegrationPolicyEffect\n reason: string\n providerId?: string\n connectorId?: string\n action?: string\n maxRisk?: IntegrationActionRisk\n risk?: IntegrationActionRisk\n dataClass?: IntegrationDataClass\n}\n\nexport interface StaticIntegrationPolicyOptions {\n rules?: IntegrationPolicyRule[]\n defaultReadEffect?: IntegrationPolicyEffect\n defaultWriteEffect?: IntegrationPolicyEffect\n defaultDestructiveEffect?: IntegrationPolicyEffect\n now?: () => Date\n}\n\nexport class StaticIntegrationPolicyEngine implements IntegrationPolicyEngine {\n private readonly rules: IntegrationPolicyRule[]\n private readonly defaultReadEffect: IntegrationPolicyEffect\n private readonly defaultWriteEffect: IntegrationPolicyEffect\n private readonly defaultDestructiveEffect: IntegrationPolicyEffect\n private readonly now: () => Date\n\n constructor(options: StaticIntegrationPolicyOptions = {}) {\n this.rules = options.rules ?? []\n this.defaultReadEffect = options.defaultReadEffect ?? 'allow'\n this.defaultWriteEffect = options.defaultWriteEffect ?? 'require_approval'\n this.defaultDestructiveEffect = options.defaultDestructiveEffect ?? 'deny'\n this.now = options.now ?? (() => new Date())\n }\n\n decide(ctx: IntegrationGuardContext & { subject: { type: string; id: string } }): IntegrationPolicyDecision {\n const action = ctx.action\n if (!action) return { decision: 'deny', reason: 'Integration action is missing from connector catalog.' }\n const matched = this.rules.find((rule) => ruleMatches(rule, ctx))\n const effect = matched?.effect ?? this.defaultEffect(action.risk)\n const reason = matched?.reason ?? defaultReason(effect, action.risk)\n if (effect === 'allow') return { decision: 'allow', reason, metadata: matched ? { ruleId: matched.id } : undefined }\n if (effect === 'deny') return { decision: 'deny', reason, metadata: matched ? { ruleId: matched.id } : undefined }\n return {\n decision: 'require_approval',\n reason,\n approval: buildApprovalRequest(ctx, reason, this.now()),\n metadata: matched ? { ruleId: matched.id } : undefined,\n }\n }\n\n private defaultEffect(risk: IntegrationActionRisk): IntegrationPolicyEffect {\n if (risk === 'read') return this.defaultReadEffect\n if (risk === 'write') return this.defaultWriteEffect\n return this.defaultDestructiveEffect\n }\n}\n\nexport function createDefaultIntegrationPolicyEngine(options: Omit<StaticIntegrationPolicyOptions, 'rules'> = {}): StaticIntegrationPolicyEngine {\n return new StaticIntegrationPolicyEngine(options)\n}\n\nexport function buildApprovalRequest(\n ctx: IntegrationGuardContext & { subject: { type: string; id: string } },\n reason: string,\n requestedAt: Date,\n): IntegrationApprovalRequest {\n if (!ctx.action) {\n throw new Error('Cannot build approval request without an action descriptor.')\n }\n return {\n id: `approval_${createWebCryptoUuid()}`,\n connectionId: ctx.connection.id,\n providerId: ctx.connection.providerId,\n connectorId: ctx.connection.connectorId,\n action: ctx.request.action,\n actor: { type: ctx.subject.type as never, id: ctx.subject.id },\n risk: ctx.action.risk,\n dataClass: ctx.action.dataClass,\n reason,\n requestedAt: requestedAt.toISOString(),\n inputPreview: projectInputPreview(ctx.action.inputPreview, ctx.request.input),\n }\n}\n\nfunction ruleMatches(rule: IntegrationPolicyRule, ctx: IntegrationGuardContext): boolean {\n if (!ctx.action) return false\n if (rule.providerId && rule.providerId !== ctx.connection.providerId) return false\n if (rule.connectorId && rule.connectorId !== ctx.connection.connectorId) return false\n if (rule.action && rule.action !== ctx.request.action) return false\n if (rule.risk && rule.risk !== ctx.action.risk) return false\n if (rule.maxRisk && riskRank(ctx.action.risk) > riskRank(rule.maxRisk)) return false\n if (rule.dataClass && rule.dataClass !== ctx.action.dataClass) return false\n return true\n}\n\nfunction riskRank(risk: IntegrationActionRisk): number {\n if (risk === 'read') return 0\n if (risk === 'write') return 1\n return 2\n}\n\nfunction defaultReason(effect: IntegrationPolicyEffect, risk: IntegrationActionRisk): string {\n if (effect === 'allow') return `${risk} integration action allowed by default policy.`\n if (effect === 'deny') return `${risk} integration action denied by default policy.`\n return `${risk} integration action requires approval by default policy.`\n}\n"],"mappings":";;AAAA,MAAM,kBAAkB;AAExB,eAAsB,gBAAgB,OAAgC;CAEpE,MAAM,SAAS,MADA,iBACW,CAAC,CAAC,OAAO,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK,CAAC;CACpF,OAAO,iBAAiB,IAAI,WAAW,MAAM,CAAC;AAChD;AAEA,SAAgB,sBAA8B;CAC5C,MAAM,SAAS,iBAAiB;CAChC,IAAI,OAAO,OAAO,eAAe,YAAY,OAAO,OAAO,WAAW;CAEtE,MAAM,wBAAQ,IAAI,WAAW,EAAE;CAC/B,OAAO,gBAAgB,KAAK;CAC5B,MAAM,KAAM,MAAM,KAAM,KAAQ;CAChC,MAAM,KAAM,MAAM,KAAM,KAAQ;CAChC,OAAO,CAAC,GAAG,KAAK,CAAC,CACd,KAAK,MAAM,UAAU;EACpB,MAAM,QAAQ,KAAK,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG;EAC/C,OAAO;GAAC;GAAG;GAAG;GAAG;EAAE,CAAC,CAAC,SAAS,KAAK,IAAI,IAAI,UAAU;CACvD,CAAC,CAAC,CACD,KAAK,EAAE;AACZ;AAEA,SAAS,mBAA2B;CAClC,MAAM,SAAS,WAAW;CAC1B,IAAI,CAAC,UAAU,CAAC,OAAO,UAAU,OAAO,OAAO,oBAAoB,YACjE,MAAM,IAAI,MAAM,qEAAqE;CAEvF,OAAO;AACT;AAEA,SAAS,iBAAiB,OAA2B;CACnD,IAAI,UAAU;CACd,KAAK,IAAI,QAAQ,GAAG,QAAQ,MAAM,QAAQ,SAAS,GAAG;EACpD,MAAM,QAAQ,MAAM;EACpB,MAAM,SAAS,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WAAW,OAAO;CACtE,OAAO;AACT;AAEA,SAAS,SAAS,MAAqC;CACrD,IAAI,SAAS,QAAQ,OAAO;CAC5B,IAAI,SAAS,SAAS,OAAO;CAC7B,OAAO;AACT;AAEA,SAAS,cAAc,QAAiC,MAAqC;CAC3F,IAAI,WAAW,SAAS,OAAO,GAAG,KAAK;CACvC,IAAI,WAAW,QAAQ,OAAO,GAAG,KAAK;CACtC,OAAO,GAAG,KAAK;AACjB"}
@@ -66,7 +66,21 @@ function redactUnknown(value) {
66
66
  for (const [key, child] of Object.entries(value)) out[key] = SENSITIVE_INPUT_KEY.test(key) ? "[REDACTED]" : redactUnknown(child);
67
67
  return out;
68
68
  }
69
+ /** Apply an action's preview policy before a preview is stored or returned:
70
+ * `'none'` yields no preview at all, an include-list keeps only the named
71
+ * top-level args (each still redacted), unset falls back to redactUnknown. */
72
+ function projectInputPreview(policy, value) {
73
+ if (policy === "none") return void 0;
74
+ if (policy) {
75
+ if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
76
+ const source = value;
77
+ const picked = {};
78
+ for (const key of policy.include) if (key in source) picked[key] = source[key];
79
+ return redactUnknown(picked);
80
+ }
81
+ return redactUnknown(value);
82
+ }
69
83
  //#endregion
70
- export { redactUnknown as t };
84
+ export { redactUnknown as n, projectInputPreview as t };
71
85
 
72
- //# sourceMappingURL=redaction-B6R-ZeWT.js.map
86
+ //# sourceMappingURL=redaction-dXj4op-I.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redaction-dXj4op-I.js","names":[],"sources":["../src/redaction.ts"],"sourcesContent":["import type { IntegrationInputPreview } from './core-types.js'\n\nconst SENSITIVE_INPUT_KEY = /token|secret|password|authorization|api[_-]?key|credential|refresh|base64|bytes|binary|audio|attachment|media|payload/i\nconst MIN_OPAQUE_PREVIEW_VALUE_LENGTH = 16\nconst MAX_DATA_URL_HEADER_LENGTH = 256\nconst MAX_EDGE_WHITESPACE_LENGTH = 64\n\nfunction isEncodedPrivatePayload(value: string): boolean {\n // Treat every data URL as private, including folded or oversized headers, without parsing its body.\n if (/^data:/i.test(value.slice(0, MAX_DATA_URL_HEADER_LENGTH).trimStart())) return true\n // Below 16 characters, ordinary values and encoded bytes are indistinguishable; sensitive field names still redact them.\n if (value.length < MIN_OPAQUE_PREVIEW_VALUE_LENGTH) return false\n let start = 0\n let end = value.length\n while (start < end && (value.charCodeAt(start) === 32 || value.charCodeAt(start) === 9)) {\n if (++start > MAX_EDGE_WHITESPACE_LENGTH) return true\n }\n while (end > start && (value.charCodeAt(end - 1) === 32 || value.charCodeAt(end - 1) === 9)) {\n if (value.length - --end > MAX_EDGE_WHITESPACE_LENGTH) return true\n }\n if (end - start < MIN_OPAQUE_PREVIEW_VALUE_LENGTH) return false\n let encodedLength = 0\n let paddingLength = 0\n let groupLength = 0\n let horizontalLength = 0\n let horizontalHasTab = false\n let spacedGroups = false\n let atLineStart = false\n for (let i = start; i < end; i++) {\n const code = value.charCodeAt(i)\n if (code === 10 || code === 13) {\n horizontalLength = 0\n horizontalHasTab = false\n atLineStart = true\n continue\n }\n if (code === 32 || code === 9) {\n if (atLineStart) continue\n horizontalLength++\n if (code === 9) horizontalHasTab = true\n continue\n }\n if (horizontalLength) {\n // MIME-style chunks have long, aligned groups; an ordinary single space stays visible.\n if (groupLength < MIN_OPAQUE_PREVIEW_VALUE_LENGTH || groupLength % 4 !== 0 ||\n (horizontalLength < 2 && !horizontalHasTab)) return false\n spacedGroups = true\n groupLength = 0\n horizontalLength = 0\n horizontalHasTab = false\n }\n atLineStart = false\n if (code === 61) {\n if (++paddingLength > 2) return false\n groupLength++\n continue\n }\n if (paddingLength) return false\n if ((code >= 65 && code <= 90) || (code >= 97 && code <= 122) ||\n (code >= 48 && code <= 57) || code === 43 || code === 47 ||\n code === 45 || code === 95) {\n encodedLength++\n groupLength++\n continue\n }\n return false\n }\n if (horizontalLength || (spacedGroups && groupLength < 4)) return false\n return encodedLength >= MIN_OPAQUE_PREVIEW_VALUE_LENGTH\n}\n\n/** Keep private payloads out of approval, audit, sandbox, and error previews. */\nexport function redactUnknown(value: unknown): unknown {\n if (typeof value === 'string' && isEncodedPrivatePayload(value)) return '[REDACTED]'\n if (ArrayBuffer.isView(value) || value instanceof ArrayBuffer) return '[REDACTED]'\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 out[key] = SENSITIVE_INPUT_KEY.test(key) ? '[REDACTED]' : redactUnknown(child)\n }\n return out\n}\n\n/** Apply an action's preview policy before a preview is stored or returned:\n * `'none'` yields no preview at all, an include-list keeps only the named\n * top-level args (each still redacted), unset falls back to redactUnknown. */\nexport function projectInputPreview(policy: IntegrationInputPreview | undefined, value: unknown): unknown {\n if (policy === 'none') return undefined\n if (policy) {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return undefined\n const source = value as Record<string, unknown>\n const picked: Record<string, unknown> = {}\n for (const key of policy.include) if (key in source) picked[key] = source[key]\n return redactUnknown(picked)\n }\n return redactUnknown(value)\n}\n"],"mappings":";AAEA,MAAM,sBAAsB;AAC5B,MAAM,kCAAkC;AACxC,MAAM,6BAA6B;AACnC,MAAM,6BAA6B;AAEnC,SAAS,wBAAwB,OAAwB;CAEvD,IAAI,UAAU,KAAK,MAAM,MAAM,GAAG,0BAA0B,CAAC,CAAC,UAAU,CAAC,GAAG,OAAO;CAEnF,IAAI,MAAM,SAAS,iCAAiC,OAAO;CAC3D,IAAI,QAAQ;CACZ,IAAI,MAAM,MAAM;CAChB,OAAO,QAAQ,QAAQ,MAAM,WAAW,KAAK,MAAM,MAAM,MAAM,WAAW,KAAK,MAAM,IACnF,IAAI,EAAE,QAAQ,4BAA4B,OAAO;CAEnD,OAAO,MAAM,UAAU,MAAM,WAAW,MAAM,CAAC,MAAM,MAAM,MAAM,WAAW,MAAM,CAAC,MAAM,IACvF,IAAI,MAAM,SAAS,EAAE,MAAM,4BAA4B,OAAO;CAEhE,IAAI,MAAM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tC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAC7C,IAAI,OAAO,oBAAoB,KAAK,GAAG,IAAI,eAAe,cAAc,KAAK;CAE/E,OAAO;AACT;;;;AAKA,SAAgB,oBAAoB,QAA6C,OAAyB;CACxG,IAAI,WAAW,QAAQ,OAAO,KAAA;CAC9B,IAAI,QAAQ;EACV,IAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,KAAK,GAAG,OAAO,KAAA;EACxE,MAAM,SAAS;EACf,MAAM,SAAkC,CAAC;EACzC,KAAK,MAAM,OAAO,OAAO,SAAS,IAAI,OAAO,QAAQ,OAAO,OAAO,OAAO;EAC1E,OAAO,cAAc,MAAM;CAC7B;CACA,OAAO,cAAc,KAAK;AAC5B"}
@@ -1,5 +1,5 @@
1
- import { h as IntegrationConnector } from "./core-types-0BenSoZJ.js";
2
- import { n as IntegrationRegistry, s as IntegrationSupportTier } from "./registry-core-B1ApiG47.js";
1
+ import { h as IntegrationConnector } from "./core-types-ZuEjjJAr.js";
2
+ import { n as IntegrationRegistry, s as IntegrationSupportTier } from "./registry-core-_BnkpeSe.js";
3
3
  //#region src/registry.d.ts
4
4
  declare function buildDefaultIntegrationRegistry(options?: {
5
5
  includeSpecs?: boolean;
@@ -31,4 +31,4 @@ interface IntegrationCatalogExecutability {
31
31
  declare function classifyIntegrationCatalogExecutability(registry?: IntegrationRegistry): IntegrationCatalogExecutability[];
32
32
  //#endregion
33
33
  export { buildDefaultIntegrationRegistry as n, classifyIntegrationCatalogExecutability as r, IntegrationCatalogExecutability as t };
34
- //# sourceMappingURL=registry-0xWMSBUu.d.ts.map
34
+ //# sourceMappingURL=registry-CJFl46d3.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry-0xWMSBUu.d.ts","names":[],"sources":["../src/registry.ts"],"mappings":";;;iBA6BgB,gCAAgC;EAC9C;EACA;EACA;;EAEA;IACO;;;;UAgDQ;EACf;;;;EAIA;EACA,aAAa;EACb,UAAU;;;;EAIV;EACA;EACA;;;;iBAKc,wCACd,WAAU,sBACT"}
1
+ {"version":3,"file":"registry-CJFl46d3.d.ts","names":[],"sources":["../src/registry.ts"],"mappings":";;;iBA6BgB,gCAAgC;EAC9C;EACA;EACA;;EAEA;IACO;;;;UAgDQ;EACf;;;;EAIA;EACA,aAAa;EACb,UAAU;;;;EAIV;EACA;EACA;;;;iBAKc,wCACd,WAAU,sBACT"}
@@ -1,4 +1,4 @@
1
- import { d as IntegrationCatalogSource, h as IntegrationConnector } from "./core-types-0BenSoZJ.js";
1
+ import { d as IntegrationCatalogSource, h as IntegrationConnector } from "./core-types-ZuEjjJAr.js";
2
2
  //#region src/registry-core.d.ts
3
3
  type IntegrationSupportTier = 'catalogOnly' | 'setupReady' | 'gatewayExecutable' | 'firstPartyExecutable' | 'sandboxExecutable';
4
4
  interface IntegrationRegistrySourceRef {
@@ -47,4 +47,4 @@ declare function canonicalConnectorId(id: string, aliases?: Record<string, strin
47
47
  declare function inferIntegrationSupportTier(connector: IntegrationConnector): IntegrationSupportTier;
48
48
  //#endregion
49
49
  export { IntegrationRegistrySourceRef as a, canonicalConnectorId as c, summarizeIntegrationRegistry as d, IntegrationRegistryEntry as i, composeIntegrationRegistry as l, IntegrationRegistry as n, IntegrationRegistrySummary as o, IntegrationRegistryConflict as r, IntegrationSupportTier as s, ComposeIntegrationRegistryOptions as t, inferIntegrationSupportTier as u };
50
- //# sourceMappingURL=registry-core-B1ApiG47.d.ts.map
50
+ //# sourceMappingURL=registry-core-_BnkpeSe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry-core-B1ApiG47.d.ts","names":[],"sources":["../src/registry-core.ts"],"mappings":";;KAQY;UAOK;EACf;EACA;EACA;EACA,aAAa;EACb;EACA;;UAGe;EACf;EACA,QAAQ;IACN;IACA;IACA;;;UAIa;EACf;EACA,WAAW;EACX;EACA,aAAa;EACb,SAAS;EACT,WAAW;;UAGI;EACf,SAAS;EACT,YAAY;EACZ,MAAM,YAAY;;UAGH;EACf;EACA;EACA;EACA;EACA,eAAe,OAAO;;UAGP;EACf,UAAU;EACV,mBAAmB;;iBAsBL,2BACd,SAAS,4BACT,UAAS,oCACR;iBAiCa,6BAA6B,UAAU,sBAAsB;iBAkB7D,qBAAqB,YAAY,UAAS;iBAW1C,4BAA4B,WAAW,uBAAuB"}
1
+ {"version":3,"file":"registry-core-_BnkpeSe.d.ts","names":[],"sources":["../src/registry-core.ts"],"mappings":";;KAQY;UAOK;EACf;EACA;EACA;EACA,aAAa;EACb;EACA;;UAGe;EACf;EACA,QAAQ;IACN;IACA;IACA;;;UAIa;EACf;EACA,WAAW;EACX;EACA,aAAa;EACb,SAAS;EACT,WAAW;;UAGI;EACf,SAAS;EACT,YAAY;EACZ,MAAM,YAAY;;UAGH;EACf;EACA;EACA;EACA;EACA,eAAe,OAAO;;UAGP;EACf,UAAU;EACV,mBAAmB;;iBAsBL,2BACd,SAAS,4BACT,UAAS,oCACR;iBAiCa,6BAA6B,UAAU,sBAAsB;iBAkB7D,qBAAqB,YAAY,UAAS;iBAW1C,4BAA4B,WAAW,uBAAuB"}
@@ -1,3 +1,3 @@
1
- import { a as IntegrationRegistrySourceRef, c as canonicalConnectorId, d as summarizeIntegrationRegistry, i as IntegrationRegistryEntry, l as composeIntegrationRegistry, n as IntegrationRegistry, o as IntegrationRegistrySummary, r as IntegrationRegistryConflict, s as IntegrationSupportTier, t as ComposeIntegrationRegistryOptions, u as inferIntegrationSupportTier } from "./registry-core-B1ApiG47.js";
2
- import { n as buildDefaultIntegrationRegistry, r as classifyIntegrationCatalogExecutability, t as IntegrationCatalogExecutability } from "./registry-0xWMSBUu.js";
1
+ import { a as IntegrationRegistrySourceRef, c as canonicalConnectorId, d as summarizeIntegrationRegistry, i as IntegrationRegistryEntry, l as composeIntegrationRegistry, n as IntegrationRegistry, o as IntegrationRegistrySummary, r as IntegrationRegistryConflict, s as IntegrationSupportTier, t as ComposeIntegrationRegistryOptions, u as inferIntegrationSupportTier } from "./registry-core-_BnkpeSe.js";
2
+ import { n as buildDefaultIntegrationRegistry, r as classifyIntegrationCatalogExecutability, t as IntegrationCatalogExecutability } from "./registry-CJFl46d3.js";
3
3
  export { type ComposeIntegrationRegistryOptions, IntegrationCatalogExecutability, type IntegrationRegistry, type IntegrationRegistryConflict, type IntegrationRegistryEntry, type IntegrationRegistrySourceRef, type IntegrationRegistrySummary, type IntegrationSupportTier, buildDefaultIntegrationRegistry, canonicalConnectorId, classifyIntegrationCatalogExecutability, composeIntegrationRegistry, inferIntegrationSupportTier, summarizeIntegrationRegistry };
package/dist/registry.js CHANGED
@@ -1,3 +1,3 @@
1
- import { C as buildDefaultIntegrationRegistry, w as classifyIntegrationCatalogExecutability } from "./src-DsEhuVEx.js";
1
+ import { b as buildDefaultIntegrationRegistry, x as classifyIntegrationCatalogExecutability } from "./src-BZmlzQzN.js";
2
2
  import { i as summarizeIntegrationRegistry, n as composeIntegrationRegistry, r as inferIntegrationSupportTier, t as canonicalConnectorId } from "./registry-core-BZo69C37.js";
3
3
  export { buildDefaultIntegrationRegistry, canonicalConnectorId, classifyIntegrationCatalogExecutability, composeIntegrationRegistry, inferIntegrationSupportTier, summarizeIntegrationRegistry };
package/dist/runtime.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { Cr as IntegrationRuntimeHub, Er as createIntegrationRuntime, Sr as IntegrationRuntime, Tr as IntegrationSandboxBundle, _r as IntegrationManifestResolution, br as IntegrationRequirementResolution, fr as InMemoryIntegrationGrantStore, gr as IntegrationManifest, hr as IntegrationGrantStore, mr as IntegrationGrant, pr as IntegrationCapabilityBinding, vr as IntegrationRequirement, wr as IntegrationRuntimeOptions, xr as IntegrationRequirementStatus, yr as IntegrationRequirementMode } from "./consumer-PHOoRorX.js";
1
+ import { $n as IntegrationGrantStore, Qn as IntegrationGrant, Xn as InMemoryIntegrationGrantStore, Zn as IntegrationCapabilityBinding, ar as IntegrationRequirementStatus, cr as IntegrationRuntimeOptions, er as IntegrationManifest, ir as IntegrationRequirementResolution, lr as IntegrationSandboxBundle, nr as IntegrationRequirement, or as IntegrationRuntime, rr as IntegrationRequirementMode, sr as IntegrationRuntimeHub, tr as IntegrationManifestResolution, ur as createIntegrationRuntime } from "./consumer-BMWxApGG.js";
2
2
  export { InMemoryIntegrationGrantStore, IntegrationCapabilityBinding, IntegrationGrant, IntegrationGrantStore, IntegrationManifest, IntegrationManifestResolution, IntegrationRequirement, IntegrationRequirementMode, IntegrationRequirementResolution, IntegrationRequirementStatus, IntegrationRuntime, IntegrationRuntimeHub, IntegrationRuntimeOptions, IntegrationSandboxBundle, createIntegrationRuntime };
package/dist/runtime.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as buildIntegrationToolCatalog } from "./catalog-CFvKzwVj.js";
1
+ import { n as buildIntegrationToolCatalog } from "./catalog-DEbD4Cn3.js";
2
2
  //#region src/runtime.ts
3
3
  var InMemoryIntegrationGrantStore = class {
4
4
  grants = /* @__PURE__ */ new Map();
package/dist/sandbox.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { At as redactInvocationEnvelope, Ct as IntegrationSandboxHostOptions, Dt as invocationRequestFromEnvelope, Et as dispatchIntegrationInvocation, Ot as normalizeIntegrationResult, St as IntegrationSandboxHostHub, Tt as buildIntegrationInvocationEnvelope, bt as IntegrationInvocationEnvelopeValidationOptions, jt as validateIntegrationInvocationEnvelope, kt as redactCapability, wt as NormalizedIntegrationResult, xt as IntegrationSandboxHost, yt as IntegrationInvocationEnvelope } from "./consumer-PHOoRorX.js";
2
- export { IntegrationInvocationEnvelope, IntegrationInvocationEnvelopeValidationOptions, IntegrationSandboxHost, IntegrationSandboxHostHub, IntegrationSandboxHostOptions, NormalizedIntegrationResult, buildIntegrationInvocationEnvelope, dispatchIntegrationInvocation, invocationRequestFromEnvelope, normalizeIntegrationResult, redactCapability, redactInvocationEnvelope, validateIntegrationInvocationEnvelope };
1
+ import { St as validateIntegrationInvocationEnvelope, _t as buildIntegrationInvocationEnvelope, bt as normalizeIntegrationResult, ft as IntegrationInvocationEnvelope, gt as NormalizedIntegrationResult, ht as IntegrationSandboxHostOptions, mt as IntegrationSandboxHostHub, pt as IntegrationInvocationEnvelopeValidationOptions, vt as dispatchIntegrationInvocation, xt as redactInvocationEnvelope, yt as invocationRequestFromEnvelope } from "./consumer-BMWxApGG.js";
2
+ export { IntegrationInvocationEnvelope, IntegrationInvocationEnvelopeValidationOptions, IntegrationSandboxHostHub, IntegrationSandboxHostOptions, NormalizedIntegrationResult, buildIntegrationInvocationEnvelope, dispatchIntegrationInvocation, invocationRequestFromEnvelope, normalizeIntegrationResult, redactInvocationEnvelope, validateIntegrationInvocationEnvelope };
package/dist/sandbox.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as redactUnknown } from "./redaction-B6R-ZeWT.js";
2
- import { o as parseIntegrationToolName } from "./catalog-CFvKzwVj.js";
1
+ import { n as redactUnknown, t as projectInputPreview } from "./redaction-dXj4op-I.js";
2
+ import { o as parseIntegrationToolName } from "./catalog-DEbD4Cn3.js";
3
3
  //#region src/sandbox.ts
4
4
  function buildIntegrationInvocationEnvelope(input) {
5
5
  const parsed = parseIntegrationToolName(input.toolName);
@@ -46,20 +46,14 @@ function validateIntegrationInvocationEnvelope(envelope, options = {}) {
46
46
  if (!connector || !action) throw new Error(`Unknown integration tool ${envelope.toolName}.`);
47
47
  }
48
48
  }
49
- function redactInvocationEnvelope(envelope) {
49
+ function redactInvocationEnvelope(envelope, action) {
50
50
  return {
51
51
  ...envelope,
52
52
  capabilityToken: "[REDACTED]",
53
- input: redactUnknown(envelope.input),
53
+ input: projectInputPreview(action?.inputPreview, envelope.input),
54
54
  metadata: redactUnknown(envelope.metadata)
55
55
  };
56
56
  }
57
- function redactCapability(capability) {
58
- return {
59
- ...capability,
60
- metadata: redactUnknown(capability.metadata)
61
- };
62
- }
63
57
  function normalizeIntegrationResult(result) {
64
58
  const output = result.output;
65
59
  if (!result.ok && output?.approvalRequired === true && output.approval) return {
@@ -93,15 +87,6 @@ async function dispatchIntegrationInvocation(envelope, options) {
93
87
  };
94
88
  }
95
89
  }
96
- var IntegrationSandboxHost = class {
97
- options;
98
- constructor(options) {
99
- this.options = options;
100
- }
101
- dispatch(envelope) {
102
- return dispatchIntegrationInvocation(envelope, this.options);
103
- }
104
- };
105
90
  function isNonEmptyString(value) {
106
91
  return typeof value === "string" && value.trim().length > 0;
107
92
  }
@@ -109,6 +94,6 @@ function isPlainRecord(value) {
109
94
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
110
95
  }
111
96
  //#endregion
112
- export { IntegrationSandboxHost, buildIntegrationInvocationEnvelope, dispatchIntegrationInvocation, invocationRequestFromEnvelope, normalizeIntegrationResult, redactCapability, redactInvocationEnvelope, validateIntegrationInvocationEnvelope };
97
+ export { buildIntegrationInvocationEnvelope, dispatchIntegrationInvocation, invocationRequestFromEnvelope, normalizeIntegrationResult, redactInvocationEnvelope, validateIntegrationInvocationEnvelope };
113
98
 
114
99
  //# sourceMappingURL=sandbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox.js","names":[],"sources":["../src/sandbox.ts"],"sourcesContent":["import type {\n IntegrationActionResult,\n IntegrationApprovalRequest,\n IntegrationCapability,\n IntegrationConnector,\n InvokeWithCapabilityRequest,\n} from './index.js'\nimport { parseIntegrationToolName } from './catalog.js'\nimport { redactUnknown } from './redaction.js'\n\nexport interface IntegrationInvocationEnvelope {\n kind: 'integration.invocation'\n capabilityToken: string\n toolName: string\n action: string\n input?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationInvocationEnvelopeValidationOptions {\n connectors?: IntegrationConnector[]\n maxInputBytes?: number\n requireKnownTool?: boolean\n}\n\nexport type NormalizedIntegrationResult =\n | { status: 'ok'; action: string; output?: unknown; metadata?: Record<string, unknown> }\n | { status: 'approval_required'; action: string; approval: IntegrationApprovalRequest; metadata?: Record<string, unknown> }\n | { status: 'failed'; action: string; error: string; metadata?: Record<string, unknown> }\n\nexport interface IntegrationSandboxHostHub {\n invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> | IntegrationActionResult\n}\n\nexport interface IntegrationSandboxHostOptions extends IntegrationInvocationEnvelopeValidationOptions {\n hub: IntegrationSandboxHostHub\n}\n\nexport function buildIntegrationInvocationEnvelope(input: {\n capabilityToken: string\n toolName: string\n args?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n maxInputBytes?: number\n}): IntegrationInvocationEnvelope {\n const parsed = parseIntegrationToolName(input.toolName)\n const envelope: IntegrationInvocationEnvelope = {\n kind: 'integration.invocation',\n capabilityToken: input.capabilityToken,\n toolName: input.toolName,\n action: parsed.actionId,\n input: input.args,\n idempotencyKey: input.idempotencyKey,\n dryRun: input.dryRun,\n metadata: input.metadata,\n }\n validateIntegrationInvocationEnvelope(envelope, { maxInputBytes: input.maxInputBytes })\n return envelope\n}\n\nexport function invocationRequestFromEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): InvokeWithCapabilityRequest {\n validateIntegrationInvocationEnvelope(envelope, options)\n return {\n action: envelope.action,\n input: envelope.input,\n idempotencyKey: envelope.idempotencyKey,\n dryRun: envelope.dryRun,\n metadata: envelope.metadata,\n }\n}\n\nexport function validateIntegrationInvocationEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): void {\n if (!envelope || typeof envelope !== 'object') throw new Error('Integration invocation envelope is required.')\n if (envelope.kind !== 'integration.invocation') throw new Error('Invalid integration invocation envelope kind.')\n if (!isNonEmptyString(envelope.capabilityToken)) throw new Error('Integration invocation envelope is missing capabilityToken.')\n if (!isNonEmptyString(envelope.toolName)) throw new Error('Integration invocation envelope is missing toolName.')\n if (!isNonEmptyString(envelope.action)) throw new Error('Integration invocation envelope is missing action.')\n if (!isNonEmptyString(envelope.idempotencyKey)) throw new Error('Integration invocation envelope is missing idempotencyKey.')\n if (envelope.metadata !== undefined && !isPlainRecord(envelope.metadata)) {\n throw new Error('Integration invocation envelope metadata must be an object.')\n }\n const parsed = parseIntegrationToolName(envelope.toolName)\n if (parsed.actionId !== envelope.action) {\n throw new Error(`Integration invocation action ${envelope.action} does not match tool ${parsed.actionId}.`)\n }\n const inputBytes = Buffer.byteLength(JSON.stringify(envelope.input ?? null), 'utf8')\n const maxInputBytes = options.maxInputBytes ?? 256 * 1024\n if (inputBytes > maxInputBytes) {\n throw new Error(`Integration invocation input exceeds ${maxInputBytes} bytes.`)\n }\n if (options.requireKnownTool || options.connectors) {\n if (!options.connectors) throw new Error('connectors are required when requireKnownTool is true.')\n const connector = options.connectors.find((candidate) =>\n candidate.providerId === parsed.providerId && candidate.id === parsed.connectorId\n )\n const action = connector?.actions.find((candidate) => candidate.id === parsed.actionId)\n if (!connector || !action) throw new Error(`Unknown integration tool ${envelope.toolName}.`)\n }\n}\n\nexport function redactInvocationEnvelope(envelope: IntegrationInvocationEnvelope): Omit<IntegrationInvocationEnvelope, 'capabilityToken'> & { capabilityToken: '[REDACTED]' } {\n return {\n ...envelope,\n capabilityToken: '[REDACTED]',\n input: redactUnknown(envelope.input),\n metadata: redactUnknown(envelope.metadata) as Record<string, unknown> | undefined,\n }\n}\n\nexport function redactCapability(capability: IntegrationCapability): IntegrationCapability {\n return {\n ...capability,\n metadata: redactUnknown(capability.metadata) as Record<string, unknown> | undefined,\n }\n}\n\nexport function normalizeIntegrationResult(result: IntegrationActionResult): NormalizedIntegrationResult {\n const output = result.output as { approvalRequired?: unknown; approval?: IntegrationApprovalRequest } | undefined\n if (!result.ok && output?.approvalRequired === true && output.approval) {\n return {\n status: 'approval_required',\n action: result.action,\n approval: output.approval,\n metadata: result.metadata,\n }\n }\n if (!result.ok) {\n return {\n status: 'failed',\n action: result.action,\n error: String(result.output ?? result.warnings?.[0] ?? 'integration action failed'),\n metadata: result.metadata,\n }\n }\n return {\n status: 'ok',\n action: result.action,\n output: result.output,\n metadata: result.metadata,\n }\n}\n\nexport async function dispatchIntegrationInvocation(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationSandboxHostOptions,\n): Promise<NormalizedIntegrationResult> {\n try {\n validateIntegrationInvocationEnvelope(envelope, options)\n const result = await options.hub.invokeWithCapability(\n envelope.capabilityToken,\n invocationRequestFromEnvelope(envelope, options),\n )\n return normalizeIntegrationResult(result)\n } catch (error) {\n return {\n status: 'failed',\n action: typeof envelope?.action === 'string' ? envelope.action : 'unknown',\n error: error instanceof Error ? error.message : 'Integration invocation failed.',\n }\n }\n}\n\nexport class IntegrationSandboxHost {\n private readonly options: IntegrationSandboxHostOptions\n\n constructor(options: IntegrationSandboxHostOptions) {\n this.options = options\n }\n\n dispatch(envelope: IntegrationInvocationEnvelope): Promise<NormalizedIntegrationResult> {\n return dispatchIntegrationInvocation(envelope, this.options)\n }\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value)\n}\n"],"mappings":";;;AAwCA,SAAgB,mCAAmC,OAQjB;CAChC,MAAM,SAAS,yBAAyB,MAAM,QAAQ;CACtD,MAAM,WAA0C;EAC9C,MAAM;EACN,iBAAiB,MAAM;EACvB,UAAU,MAAM;EAChB,QAAQ,OAAO;EACf,OAAO,MAAM;EACb,gBAAgB,MAAM;EACtB,QAAQ,MAAM;EACd,UAAU,MAAM;CAClB;CACA,sCAAsC,UAAU,EAAE,eAAe,MAAM,cAAc,CAAC;CACtF,OAAO;AACT;AAEA,SAAgB,8BACd,UACA,UAA0D,CAAC,GAC9B;CAC7B,sCAAsC,UAAU,OAAO;CACvD,OAAO;EACL,QAAQ,SAAS;EACjB,OAAO,SAAS;EAChB,gBAAgB,SAAS;EACzB,QAAQ,SAAS;EACjB,UAAU,SAAS;CACrB;AACF;AAEA,SAAgB,sCACd,UACA,UAA0D,CA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AAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E"}
1
+ {"version":3,"file":"sandbox.js","names":[],"sources":["../src/sandbox.ts"],"sourcesContent":["import type {\n IntegrationActionResult,\n IntegrationApprovalRequest,\n IntegrationCapability,\n IntegrationConnector,\n IntegrationConnectorAction,\n InvokeWithCapabilityRequest,\n} from './index.js'\nimport { parseIntegrationToolName } from './catalog.js'\nimport { projectInputPreview, redactUnknown } from './redaction.js'\n\nexport interface IntegrationInvocationEnvelope {\n kind: 'integration.invocation'\n capabilityToken: string\n toolName: string\n action: string\n input?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n}\n\nexport interface IntegrationInvocationEnvelopeValidationOptions {\n connectors?: IntegrationConnector[]\n maxInputBytes?: number\n requireKnownTool?: boolean\n}\n\nexport type NormalizedIntegrationResult =\n | { status: 'ok'; action: string; output?: unknown; metadata?: Record<string, unknown> }\n | { status: 'approval_required'; action: string; approval: IntegrationApprovalRequest; metadata?: Record<string, unknown> }\n | { status: 'failed'; action: string; error: string; metadata?: Record<string, unknown> }\n\nexport interface IntegrationSandboxHostHub {\n invokeWithCapability(token: string, request: InvokeWithCapabilityRequest): Promise<IntegrationActionResult> | IntegrationActionResult\n}\n\nexport interface IntegrationSandboxHostOptions extends IntegrationInvocationEnvelopeValidationOptions {\n hub: IntegrationSandboxHostHub\n}\n\nexport function buildIntegrationInvocationEnvelope(input: {\n capabilityToken: string\n toolName: string\n args?: unknown\n idempotencyKey: string\n dryRun?: boolean\n metadata?: Record<string, unknown>\n maxInputBytes?: number\n}): IntegrationInvocationEnvelope {\n const parsed = parseIntegrationToolName(input.toolName)\n const envelope: IntegrationInvocationEnvelope = {\n kind: 'integration.invocation',\n capabilityToken: input.capabilityToken,\n toolName: input.toolName,\n action: parsed.actionId,\n input: input.args,\n idempotencyKey: input.idempotencyKey,\n dryRun: input.dryRun,\n metadata: input.metadata,\n }\n validateIntegrationInvocationEnvelope(envelope, { maxInputBytes: input.maxInputBytes })\n return envelope\n}\n\nexport function invocationRequestFromEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): InvokeWithCapabilityRequest {\n validateIntegrationInvocationEnvelope(envelope, options)\n return {\n action: envelope.action,\n input: envelope.input,\n idempotencyKey: envelope.idempotencyKey,\n dryRun: envelope.dryRun,\n metadata: envelope.metadata,\n }\n}\n\nexport function validateIntegrationInvocationEnvelope(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationInvocationEnvelopeValidationOptions = {},\n): void {\n if (!envelope || typeof envelope !== 'object') throw new Error('Integration invocation envelope is required.')\n if (envelope.kind !== 'integration.invocation') throw new Error('Invalid integration invocation envelope kind.')\n if (!isNonEmptyString(envelope.capabilityToken)) throw new Error('Integration invocation envelope is missing capabilityToken.')\n if (!isNonEmptyString(envelope.toolName)) throw new Error('Integration invocation envelope is missing toolName.')\n if (!isNonEmptyString(envelope.action)) throw new Error('Integration invocation envelope is missing action.')\n if (!isNonEmptyString(envelope.idempotencyKey)) throw new Error('Integration invocation envelope is missing idempotencyKey.')\n if (envelope.metadata !== undefined && !isPlainRecord(envelope.metadata)) {\n throw new Error('Integration invocation envelope metadata must be an object.')\n }\n const parsed = parseIntegrationToolName(envelope.toolName)\n if (parsed.actionId !== envelope.action) {\n throw new Error(`Integration invocation action ${envelope.action} does not match tool ${parsed.actionId}.`)\n }\n const inputBytes = Buffer.byteLength(JSON.stringify(envelope.input ?? null), 'utf8')\n const maxInputBytes = options.maxInputBytes ?? 256 * 1024\n if (inputBytes > maxInputBytes) {\n throw new Error(`Integration invocation input exceeds ${maxInputBytes} bytes.`)\n }\n if (options.requireKnownTool || options.connectors) {\n if (!options.connectors) throw new Error('connectors are required when requireKnownTool is true.')\n const connector = options.connectors.find((candidate) =>\n candidate.providerId === parsed.providerId && candidate.id === parsed.connectorId\n )\n const action = connector?.actions.find((candidate) => candidate.id === parsed.actionId)\n if (!connector || !action) throw new Error(`Unknown integration tool ${envelope.toolName}.`)\n }\n}\n\nexport function redactInvocationEnvelope(\n envelope: IntegrationInvocationEnvelope,\n action?: Pick<IntegrationConnectorAction, 'inputPreview'>,\n): Omit<IntegrationInvocationEnvelope, 'capabilityToken'> & { capabilityToken: '[REDACTED]' } {\n return {\n ...envelope,\n capabilityToken: '[REDACTED]',\n input: projectInputPreview(action?.inputPreview, envelope.input),\n metadata: redactUnknown(envelope.metadata) as Record<string, unknown> | undefined,\n }\n}\n\nexport function normalizeIntegrationResult(result: IntegrationActionResult): NormalizedIntegrationResult {\n const output = result.output as { approvalRequired?: unknown; approval?: IntegrationApprovalRequest } | undefined\n if (!result.ok && output?.approvalRequired === true && output.approval) {\n return {\n status: 'approval_required',\n action: result.action,\n approval: output.approval,\n metadata: result.metadata,\n }\n }\n if (!result.ok) {\n return {\n status: 'failed',\n action: result.action,\n error: String(result.output ?? result.warnings?.[0] ?? 'integration action failed'),\n metadata: result.metadata,\n }\n }\n return {\n status: 'ok',\n action: result.action,\n output: result.output,\n metadata: result.metadata,\n }\n}\n\nexport async function dispatchIntegrationInvocation(\n envelope: IntegrationInvocationEnvelope,\n options: IntegrationSandboxHostOptions,\n): Promise<NormalizedIntegrationResult> {\n try {\n validateIntegrationInvocationEnvelope(envelope, options)\n const result = await options.hub.invokeWithCapability(\n envelope.capabilityToken,\n invocationRequestFromEnvelope(envelope, options),\n )\n return normalizeIntegrationResult(result)\n } catch (error) {\n return {\n status: 'failed',\n action: typeof envelope?.action === 'string' ? envelope.action : 'unknown',\n error: error instanceof Error ? error.message : 'Integration invocation failed.',\n }\n }\n}\n\nfunction isNonEmptyString(value: unknown): value is string {\n return typeof value === 'string' && value.trim().length > 0\n}\n\nfunction isPlainRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && typeof value === 'object' && !Array.isArray(value)\n}\n"],"mappings":";;;AAyCA,SAAgB,mCAAmC,OAQjB;CAChC,MAAM,SAAS,yBAAyB,MAAM,QAAQ;CACtD,MAAM,WAA0C;EAC9C,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,OAAO,iBAAiB,QAAQ,MAAM,UAAU;EAClD;CACF;AACF;AAEA,SAAS,iBAAiB,OAAiC;CACzD,OAAO,OAAO,UAAU,YAAY,MAAM,KAAK,CAAC,CAAC,SAAS;AAC5D;AAEA,SAAS,cAAc,OAAkD;CACvE,OAAO,QAAQ,KAAK,KAAK,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAC5E"}
@@ -1,5 +1,5 @@
1
1
  import { n as canonicalIntegrationKind } from "./integration-kind-aliases-DeUJgBWP.js";
2
- import { a as getBundledAdapterManifest, i as bundledOAuth2AuthContract, n as bundledAuthMode, t as bundledApiKeyHint } from "./bundled-manifest-data-CgUuwak6.js";
2
+ import { a as getBundledAdapterManifest, i as bundledOAuth2AuthContract, n as bundledAuthMode, t as bundledApiKeyHint } from "./bundled-manifest-data-DLzwtr7z.js";
3
3
  import { buildIntegrationCoverageConnectors, listIntegrationCoverageSpecs } from "./coverage-catalog.js";
4
4
  //#region src/specs/families.ts
5
5
  const INTEGRATION_FAMILIES = {
@@ -2030,6 +2030,7 @@ function actionsFromManifest(manifest, fallbackDataClass) {
2030
2030
  ...capability.consistencyModel ? { consistencyModel: capability.consistencyModel } : {},
2031
2031
  description: capability.description,
2032
2032
  approvalRequired: mutation ? capability.externalEffect : void 0,
2033
+ ...capability.inputPreview ? { inputPreview: capability.inputPreview } : {},
2033
2034
  inputSchema: capability.parameters
2034
2035
  };
2035
2036
  });
@@ -2257,14 +2258,6 @@ function extraAuthParamsFor(family) {
2257
2258
  if (family === "notion") return { owner: "user" };
2258
2259
  }
2259
2260
  //#endregion
2260
- //#region src/specs/types.ts
2261
- function specAuthToConnectorAuth(auth) {
2262
- if (auth.mode === "api_key") return "api_key";
2263
- if (auth.mode === "oauth2") return "oauth2";
2264
- if (auth.mode === "none") return "none";
2265
- return "custom";
2266
- }
2267
- //#endregion
2268
2261
  //#region src/specs/renderers.ts
2269
2262
  function renderConsoleSteps(spec, options) {
2270
2263
  const redirectUri = renderRedirectUri(spec, options);
@@ -2328,9 +2321,6 @@ function renderTemplate(template, spec, options, redirectUri) {
2328
2321
  function renderRedirectUri(spec, options) {
2329
2322
  return (options.callbackPath ?? spec.setup.redirectUriTemplate ?? "").replaceAll("{host}", options.host).replaceAll("{kind}", spec.kind);
2330
2323
  }
2331
- function consoleStepsToText(steps) {
2332
- return steps.map((step, index) => `${index + 1}. ${step.title}: ${step.detail}`).join("\n");
2333
- }
2334
2324
  //#endregion
2335
2325
  //#region src/specs/validation.ts
2336
2326
  function validateIntegrationSpec(spec) {
@@ -2378,10 +2368,6 @@ function validateIntegrationSpec(spec) {
2378
2368
  issues
2379
2369
  };
2380
2370
  }
2381
- function assertValidIntegrationSpec(spec) {
2382
- const result = validateIntegrationSpec(spec);
2383
- if (!result.ok) throw new Error(`Invalid integration spec ${spec.kind}: ${result.issues.map((i) => `${i.path}: ${i.message}`).join("; ")}`);
2384
- }
2385
2371
  function validateCredentialFormat(field, value) {
2386
2372
  if (!value.trim()) return {
2387
2373
  ok: false,
@@ -2398,12 +2384,7 @@ function validateCredentialFormat(field, value) {
2398
2384
  field: field.label
2399
2385
  };
2400
2386
  }
2401
- function validateCredentialSet(spec, values) {
2402
- return spec.setup.credentialFields.map((field) => {
2403
- return validateCredentialFormat(field, values[field.env ?? field.label] ?? "");
2404
- });
2405
- }
2406
2387
  //#endregion
2407
- export { getIntegrationFamily as _, buildHealthcheckPlan as a, renderConsoleSteps as c, getIntegrationSpec as d, integrationSpecToConnector as f, INTEGRATION_FAMILIES as g, resolveConnectorAuthSpec as h, validateIntegrationSpec as i, renderRunbookMarkdown as l, listIntegrationSpecs as m, validateCredentialFormat as n, consoleStepsToText as o, listExecutableIntegrationSpecs as p, validateCredentialSet as r, renderAgentToolDescription as s, assertValidIntegrationSpec as t, specAuthToConnectorAuth as u };
2388
+ export { renderConsoleSteps as a, integrationSpecToConnector as c, resolveConnectorAuthSpec as d, INTEGRATION_FAMILIES as f, renderAgentToolDescription as i, listExecutableIntegrationSpecs as l, validateIntegrationSpec as n, renderRunbookMarkdown as o, getIntegrationFamily as p, buildHealthcheckPlan as r, getIntegrationSpec as s, validateCredentialFormat as t, listIntegrationSpecs as u };
2408
2389
 
2409
- //# sourceMappingURL=specs-amTqWDjy.js.map
2390
+ //# sourceMappingURL=specs-BQHb_KgP.js.map