@contractspec/lib.contracts-integrations 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (240) hide show
  1. package/README.md +3 -0
  2. package/dist/index.d.ts +11 -0
  3. package/dist/index.js +3676 -0
  4. package/dist/integrations/binding.d.ts +14 -0
  5. package/dist/integrations/binding.js +1 -0
  6. package/dist/integrations/connection.d.ts +47 -0
  7. package/dist/integrations/connection.js +1 -0
  8. package/dist/integrations/docs/integrations.docblock.d.ts +2 -0
  9. package/dist/integrations/docs/integrations.docblock.js +110 -0
  10. package/dist/integrations/health.d.ts +17 -0
  11. package/dist/integrations/health.js +73 -0
  12. package/dist/integrations/health.test.d.ts +1 -0
  13. package/dist/integrations/index.d.ts +11 -0
  14. package/dist/integrations/index.js +3264 -0
  15. package/dist/integrations/integrations.capability.d.ts +1 -0
  16. package/dist/integrations/integrations.capability.js +18 -0
  17. package/dist/integrations/integrations.feature.d.ts +5 -0
  18. package/dist/integrations/integrations.feature.js +33 -0
  19. package/dist/integrations/meeting-recorder/contracts/index.d.ts +7 -0
  20. package/dist/integrations/meeting-recorder/contracts/index.js +474 -0
  21. package/dist/integrations/meeting-recorder/contracts/meetings.d.ts +451 -0
  22. package/dist/integrations/meeting-recorder/contracts/meetings.js +219 -0
  23. package/dist/integrations/meeting-recorder/contracts/transcripts.d.ts +166 -0
  24. package/dist/integrations/meeting-recorder/contracts/transcripts.js +287 -0
  25. package/dist/integrations/meeting-recorder/contracts/webhooks.d.ts +85 -0
  26. package/dist/integrations/meeting-recorder/contracts/webhooks.js +172 -0
  27. package/dist/integrations/meeting-recorder/meeting-recorder.capability.d.ts +1 -0
  28. package/dist/integrations/meeting-recorder/meeting-recorder.capability.js +18 -0
  29. package/dist/integrations/meeting-recorder/meeting-recorder.feature.d.ts +5 -0
  30. package/dist/integrations/meeting-recorder/meeting-recorder.feature.js +33 -0
  31. package/dist/integrations/meeting-recorder/models.d.ts +402 -0
  32. package/dist/integrations/meeting-recorder/models.js +122 -0
  33. package/dist/integrations/meeting-recorder/telemetry.d.ts +13 -0
  34. package/dist/integrations/meeting-recorder/telemetry.js +54 -0
  35. package/dist/integrations/openbanking/contracts/accounts.d.ts +282 -0
  36. package/dist/integrations/openbanking/contracts/accounts.js +328 -0
  37. package/dist/integrations/openbanking/contracts/balances.d.ts +158 -0
  38. package/dist/integrations/openbanking/contracts/balances.js +292 -0
  39. package/dist/integrations/openbanking/contracts/index.d.ts +7 -0
  40. package/dist/integrations/openbanking/contracts/index.js +644 -0
  41. package/dist/integrations/openbanking/contracts/transactions.d.ts +206 -0
  42. package/dist/integrations/openbanking/contracts/transactions.js +298 -0
  43. package/dist/integrations/openbanking/guards.d.ts +8 -0
  44. package/dist/integrations/openbanking/guards.js +42 -0
  45. package/dist/integrations/openbanking/guards.test.d.ts +1 -0
  46. package/dist/integrations/openbanking/models.d.ts +223 -0
  47. package/dist/integrations/openbanking/models.js +110 -0
  48. package/dist/integrations/openbanking/openbanking.capability.d.ts +1 -0
  49. package/dist/integrations/openbanking/openbanking.capability.js +18 -0
  50. package/dist/integrations/openbanking/openbanking.feature.d.ts +5 -0
  51. package/dist/integrations/openbanking/openbanking.feature.js +35 -0
  52. package/dist/integrations/openbanking/telemetry.d.ts +12 -0
  53. package/dist/integrations/openbanking/telemetry.js +51 -0
  54. package/dist/integrations/operations.d.ts +430 -0
  55. package/dist/integrations/operations.js +297 -0
  56. package/dist/integrations/operations.test.d.ts +1 -0
  57. package/dist/integrations/providers/analytics-reader.d.ts +103 -0
  58. package/dist/integrations/providers/analytics-reader.js +1 -0
  59. package/dist/integrations/providers/analytics-writer.d.ts +6 -0
  60. package/dist/integrations/providers/analytics-writer.js +1 -0
  61. package/dist/integrations/providers/analytics.d.ts +47 -0
  62. package/dist/integrations/providers/analytics.js +1 -0
  63. package/dist/integrations/providers/calendar.d.ts +75 -0
  64. package/dist/integrations/providers/calendar.js +1 -0
  65. package/dist/integrations/providers/database.d.ts +12 -0
  66. package/dist/integrations/providers/database.js +1 -0
  67. package/dist/integrations/providers/elevenlabs.d.ts +3 -0
  68. package/dist/integrations/providers/elevenlabs.js +86 -0
  69. package/dist/integrations/providers/email.d.ts +83 -0
  70. package/dist/integrations/providers/email.js +1 -0
  71. package/dist/integrations/providers/embedding.d.ts +21 -0
  72. package/dist/integrations/providers/embedding.js +1 -0
  73. package/dist/integrations/providers/fal.d.ts +3 -0
  74. package/dist/integrations/providers/fal.js +112 -0
  75. package/dist/integrations/providers/fathom.d.ts +3 -0
  76. package/dist/integrations/providers/fathom.js +126 -0
  77. package/dist/integrations/providers/fireflies.d.ts +3 -0
  78. package/dist/integrations/providers/fireflies.js +106 -0
  79. package/dist/integrations/providers/gcs-storage.d.ts +3 -0
  80. package/dist/integrations/providers/gcs-storage.js +97 -0
  81. package/dist/integrations/providers/gmail.d.ts +3 -0
  82. package/dist/integrations/providers/gmail.js +109 -0
  83. package/dist/integrations/providers/google-calendar.d.ts +3 -0
  84. package/dist/integrations/providers/google-calendar.js +92 -0
  85. package/dist/integrations/providers/gradium.d.ts +3 -0
  86. package/dist/integrations/providers/gradium.js +110 -0
  87. package/dist/integrations/providers/granola.d.ts +3 -0
  88. package/dist/integrations/providers/granola.js +107 -0
  89. package/dist/integrations/providers/index.d.ts +38 -0
  90. package/dist/integrations/providers/index.js +2094 -0
  91. package/dist/integrations/providers/jira.d.ts +3 -0
  92. package/dist/integrations/providers/jira.js +108 -0
  93. package/dist/integrations/providers/linear.d.ts +3 -0
  94. package/dist/integrations/providers/linear.js +107 -0
  95. package/dist/integrations/providers/llm.d.ts +79 -0
  96. package/dist/integrations/providers/llm.js +1 -0
  97. package/dist/integrations/providers/meeting-recorder.d.ts +129 -0
  98. package/dist/integrations/providers/meeting-recorder.js +1 -0
  99. package/dist/integrations/providers/mistral.d.ts +3 -0
  100. package/dist/integrations/providers/mistral.js +94 -0
  101. package/dist/integrations/providers/notion.d.ts +3 -0
  102. package/dist/integrations/providers/notion.js +113 -0
  103. package/dist/integrations/providers/openbanking.d.ts +125 -0
  104. package/dist/integrations/providers/openbanking.js +1 -0
  105. package/dist/integrations/providers/payments.d.ts +106 -0
  106. package/dist/integrations/providers/payments.js +1 -0
  107. package/dist/integrations/providers/posthog-llm-telemetry.d.ts +51 -0
  108. package/dist/integrations/providers/posthog-llm-telemetry.js +176 -0
  109. package/dist/integrations/providers/posthog.d.ts +3 -0
  110. package/dist/integrations/providers/posthog.js +106 -0
  111. package/dist/integrations/providers/postmark.d.ts +3 -0
  112. package/dist/integrations/providers/postmark.js +98 -0
  113. package/dist/integrations/providers/powens.d.ts +3 -0
  114. package/dist/integrations/providers/powens.js +124 -0
  115. package/dist/integrations/providers/project-management.d.ts +32 -0
  116. package/dist/integrations/providers/project-management.js +1 -0
  117. package/dist/integrations/providers/providers.test.d.ts +1 -0
  118. package/dist/integrations/providers/qdrant.d.ts +3 -0
  119. package/dist/integrations/providers/qdrant.js +101 -0
  120. package/dist/integrations/providers/registry.d.ts +6 -0
  121. package/dist/integrations/providers/registry.js +1878 -0
  122. package/dist/integrations/providers/sms.d.ts +31 -0
  123. package/dist/integrations/providers/sms.js +1 -0
  124. package/dist/integrations/providers/storage.d.ts +57 -0
  125. package/dist/integrations/providers/storage.js +1 -0
  126. package/dist/integrations/providers/stripe.d.ts +3 -0
  127. package/dist/integrations/providers/stripe.js +105 -0
  128. package/dist/integrations/providers/supabase-postgres.d.ts +3 -0
  129. package/dist/integrations/providers/supabase-postgres.js +87 -0
  130. package/dist/integrations/providers/supabase-vector.d.ts +3 -0
  131. package/dist/integrations/providers/supabase-vector.js +107 -0
  132. package/dist/integrations/providers/tldv.d.ts +3 -0
  133. package/dist/integrations/providers/tldv.js +106 -0
  134. package/dist/integrations/providers/twilio-sms.d.ts +3 -0
  135. package/dist/integrations/providers/twilio-sms.js +91 -0
  136. package/dist/integrations/providers/vector-store.d.ts +39 -0
  137. package/dist/integrations/providers/vector-store.js +1 -0
  138. package/dist/integrations/providers/voice.d.ts +31 -0
  139. package/dist/integrations/providers/voice.js +1 -0
  140. package/dist/integrations/runtime.d.ts +95 -0
  141. package/dist/integrations/runtime.js +209 -0
  142. package/dist/integrations/runtime.test.d.ts +1 -0
  143. package/dist/integrations/secrets/aws-secret-manager.d.ts +28 -0
  144. package/dist/integrations/secrets/aws-secret-manager.js +346 -0
  145. package/dist/integrations/secrets/env-secret-provider.d.ts +28 -0
  146. package/dist/integrations/secrets/env-secret-provider.js +159 -0
  147. package/dist/integrations/secrets/gcp-secret-manager.d.ts +29 -0
  148. package/dist/integrations/secrets/gcp-secret-manager.js +347 -0
  149. package/dist/integrations/secrets/index.d.ts +6 -0
  150. package/dist/integrations/secrets/index.js +1129 -0
  151. package/dist/integrations/secrets/manager.d.ts +44 -0
  152. package/dist/integrations/secrets/manager.js +183 -0
  153. package/dist/integrations/secrets/provider.d.ts +49 -0
  154. package/dist/integrations/secrets/provider.js +74 -0
  155. package/dist/integrations/secrets/provider.test.d.ts +1 -0
  156. package/dist/integrations/secrets/scaleway-secret-manager.d.ts +35 -0
  157. package/dist/integrations/secrets/scaleway-secret-manager.js +375 -0
  158. package/dist/integrations/secrets-types.d.ts +14 -0
  159. package/dist/integrations/secrets-types.js +1 -0
  160. package/dist/integrations/spec.d.ts +72 -0
  161. package/dist/integrations/spec.js +22 -0
  162. package/dist/integrations/spec.test.d.ts +1 -0
  163. package/dist/node/index.js +3675 -0
  164. package/dist/node/integrations/binding.js +0 -0
  165. package/dist/node/integrations/connection.js +0 -0
  166. package/dist/node/integrations/docs/integrations.docblock.js +109 -0
  167. package/dist/node/integrations/health.js +72 -0
  168. package/dist/node/integrations/index.js +3263 -0
  169. package/dist/node/integrations/integrations.capability.js +17 -0
  170. package/dist/node/integrations/integrations.feature.js +32 -0
  171. package/dist/node/integrations/meeting-recorder/contracts/index.js +473 -0
  172. package/dist/node/integrations/meeting-recorder/contracts/meetings.js +218 -0
  173. package/dist/node/integrations/meeting-recorder/contracts/transcripts.js +286 -0
  174. package/dist/node/integrations/meeting-recorder/contracts/webhooks.js +171 -0
  175. package/dist/node/integrations/meeting-recorder/meeting-recorder.capability.js +17 -0
  176. package/dist/node/integrations/meeting-recorder/meeting-recorder.feature.js +32 -0
  177. package/dist/node/integrations/meeting-recorder/models.js +121 -0
  178. package/dist/node/integrations/meeting-recorder/telemetry.js +53 -0
  179. package/dist/node/integrations/openbanking/contracts/accounts.js +327 -0
  180. package/dist/node/integrations/openbanking/contracts/balances.js +291 -0
  181. package/dist/node/integrations/openbanking/contracts/index.js +643 -0
  182. package/dist/node/integrations/openbanking/contracts/transactions.js +297 -0
  183. package/dist/node/integrations/openbanking/guards.js +41 -0
  184. package/dist/node/integrations/openbanking/models.js +109 -0
  185. package/dist/node/integrations/openbanking/openbanking.capability.js +17 -0
  186. package/dist/node/integrations/openbanking/openbanking.feature.js +34 -0
  187. package/dist/node/integrations/openbanking/telemetry.js +50 -0
  188. package/dist/node/integrations/operations.js +296 -0
  189. package/dist/node/integrations/providers/analytics-reader.js +0 -0
  190. package/dist/node/integrations/providers/analytics-writer.js +0 -0
  191. package/dist/node/integrations/providers/analytics.js +0 -0
  192. package/dist/node/integrations/providers/calendar.js +0 -0
  193. package/dist/node/integrations/providers/database.js +0 -0
  194. package/dist/node/integrations/providers/elevenlabs.js +85 -0
  195. package/dist/node/integrations/providers/email.js +0 -0
  196. package/dist/node/integrations/providers/embedding.js +0 -0
  197. package/dist/node/integrations/providers/fal.js +111 -0
  198. package/dist/node/integrations/providers/fathom.js +125 -0
  199. package/dist/node/integrations/providers/fireflies.js +105 -0
  200. package/dist/node/integrations/providers/gcs-storage.js +96 -0
  201. package/dist/node/integrations/providers/gmail.js +108 -0
  202. package/dist/node/integrations/providers/google-calendar.js +91 -0
  203. package/dist/node/integrations/providers/gradium.js +109 -0
  204. package/dist/node/integrations/providers/granola.js +106 -0
  205. package/dist/node/integrations/providers/index.js +2093 -0
  206. package/dist/node/integrations/providers/jira.js +107 -0
  207. package/dist/node/integrations/providers/linear.js +106 -0
  208. package/dist/node/integrations/providers/llm.js +0 -0
  209. package/dist/node/integrations/providers/meeting-recorder.js +0 -0
  210. package/dist/node/integrations/providers/mistral.js +93 -0
  211. package/dist/node/integrations/providers/notion.js +112 -0
  212. package/dist/node/integrations/providers/openbanking.js +0 -0
  213. package/dist/node/integrations/providers/payments.js +0 -0
  214. package/dist/node/integrations/providers/posthog-llm-telemetry.js +175 -0
  215. package/dist/node/integrations/providers/posthog.js +105 -0
  216. package/dist/node/integrations/providers/postmark.js +97 -0
  217. package/dist/node/integrations/providers/powens.js +123 -0
  218. package/dist/node/integrations/providers/project-management.js +0 -0
  219. package/dist/node/integrations/providers/qdrant.js +100 -0
  220. package/dist/node/integrations/providers/registry.js +1877 -0
  221. package/dist/node/integrations/providers/sms.js +0 -0
  222. package/dist/node/integrations/providers/storage.js +0 -0
  223. package/dist/node/integrations/providers/stripe.js +104 -0
  224. package/dist/node/integrations/providers/supabase-postgres.js +86 -0
  225. package/dist/node/integrations/providers/supabase-vector.js +106 -0
  226. package/dist/node/integrations/providers/tldv.js +105 -0
  227. package/dist/node/integrations/providers/twilio-sms.js +90 -0
  228. package/dist/node/integrations/providers/vector-store.js +0 -0
  229. package/dist/node/integrations/providers/voice.js +0 -0
  230. package/dist/node/integrations/runtime.js +208 -0
  231. package/dist/node/integrations/secrets/aws-secret-manager.js +345 -0
  232. package/dist/node/integrations/secrets/env-secret-provider.js +158 -0
  233. package/dist/node/integrations/secrets/gcp-secret-manager.js +346 -0
  234. package/dist/node/integrations/secrets/index.js +1128 -0
  235. package/dist/node/integrations/secrets/manager.js +182 -0
  236. package/dist/node/integrations/secrets/provider.js +73 -0
  237. package/dist/node/integrations/secrets/scaleway-secret-manager.js +374 -0
  238. package/dist/node/integrations/secrets-types.js +0 -0
  239. package/dist/node/integrations/spec.js +21 -0
  240. package/package.json +1029 -0
package/dist/index.js ADDED
@@ -0,0 +1,3676 @@
1
+ // @bun
2
+ // src/integrations/spec.ts
3
+ import { SpecContractRegistry } from "@contractspec/lib.contracts-spec/registry";
4
+ var integrationKey = (meta) => `${meta.key}.v${meta.version}`;
5
+
6
+ class IntegrationSpecRegistry extends SpecContractRegistry {
7
+ constructor(items) {
8
+ super("integration", items);
9
+ }
10
+ getByCategory(category) {
11
+ return this.list().filter((spec) => spec.meta.category === category);
12
+ }
13
+ }
14
+ function makeIntegrationSpecKey(meta) {
15
+ return integrationKey(meta);
16
+ }
17
+ var defineIntegration = (spec) => spec;
18
+ // src/integrations/providers/stripe.ts
19
+ import { StabilityEnum } from "@contractspec/lib.contracts-spec/ownership";
20
+ var stripeIntegrationSpec = defineIntegration({
21
+ meta: {
22
+ key: "payments.stripe",
23
+ version: "1.0.0",
24
+ category: "payments",
25
+ title: "Stripe Payments",
26
+ description: "Stripe integration for payment processing, charges, and payouts.",
27
+ domain: "payments",
28
+ owners: ["platform.payments"],
29
+ tags: ["payments", "psp"],
30
+ stability: StabilityEnum.Stable
31
+ },
32
+ supportedModes: ["managed", "byok"],
33
+ capabilities: {
34
+ provides: [{ key: "payments.psp", version: "1.0.0" }],
35
+ requires: [
36
+ {
37
+ key: "platform.webhooks",
38
+ optional: true,
39
+ reason: "Recommended for reliable event ingestion"
40
+ }
41
+ ]
42
+ },
43
+ configSchema: {
44
+ schema: {
45
+ type: "object",
46
+ properties: {
47
+ accountId: {
48
+ type: "string",
49
+ description: "Connected account ID when using Stripe Connect (BYOK)."
50
+ },
51
+ region: {
52
+ type: "string",
53
+ description: "Optional Stripe region or data residency hint."
54
+ }
55
+ }
56
+ },
57
+ example: {
58
+ accountId: "acct_123",
59
+ region: "us-east-1"
60
+ }
61
+ },
62
+ secretSchema: {
63
+ schema: {
64
+ type: "object",
65
+ required: ["apiKey", "webhookSecret"],
66
+ properties: {
67
+ apiKey: {
68
+ type: "string",
69
+ description: "Stripe secret API key (sk_live_... or sk_test_...)."
70
+ },
71
+ webhookSecret: {
72
+ type: "string",
73
+ description: "Signing secret for webhook verification."
74
+ }
75
+ }
76
+ },
77
+ example: {
78
+ apiKey: "sk_live_***",
79
+ webhookSecret: "whsec_***"
80
+ }
81
+ },
82
+ healthCheck: {
83
+ method: "ping",
84
+ timeoutMs: 5000
85
+ },
86
+ docsUrl: "https://stripe.com/docs/api",
87
+ constraints: {
88
+ rateLimit: {
89
+ rpm: 1000,
90
+ rph: 20000
91
+ }
92
+ },
93
+ byokSetup: {
94
+ setupInstructions: "Create a restricted Stripe API key with write access to Charges and provide a webhook signing secret.",
95
+ requiredScopes: ["charges:write", "customers:read"]
96
+ }
97
+ });
98
+ function registerStripeIntegration(registry) {
99
+ return registry.register(stripeIntegrationSpec);
100
+ }
101
+
102
+ // src/integrations/providers/postmark.ts
103
+ import { StabilityEnum as StabilityEnum2 } from "@contractspec/lib.contracts-spec/ownership";
104
+ var postmarkIntegrationSpec = defineIntegration({
105
+ meta: {
106
+ key: "email.postmark",
107
+ version: "1.0.0",
108
+ category: "email",
109
+ title: "Postmark Transactional Email",
110
+ description: "Postmark integration for transactional email delivery.",
111
+ domain: "communications",
112
+ owners: ["platform.messaging"],
113
+ tags: ["email", "transactional"],
114
+ stability: StabilityEnum2.Stable
115
+ },
116
+ supportedModes: ["managed", "byok"],
117
+ capabilities: {
118
+ provides: [{ key: "email.transactional", version: "1.0.0" }],
119
+ requires: [
120
+ {
121
+ key: "platform.webhooks",
122
+ optional: true,
123
+ reason: "Optional for inbound bounce handling"
124
+ }
125
+ ]
126
+ },
127
+ configSchema: {
128
+ schema: {
129
+ type: "object",
130
+ properties: {
131
+ messageStream: {
132
+ type: "string",
133
+ description: "Optional message stream identifier (e.g., transactional)."
134
+ },
135
+ fromEmail: {
136
+ type: "string",
137
+ description: "Default From address used for outbound messages."
138
+ }
139
+ }
140
+ },
141
+ example: {
142
+ messageStream: "outbound",
143
+ fromEmail: "notifications@example.com"
144
+ }
145
+ },
146
+ secretSchema: {
147
+ schema: {
148
+ type: "object",
149
+ required: ["serverToken"],
150
+ properties: {
151
+ serverToken: {
152
+ type: "string",
153
+ description: "Server token for the Postmark account."
154
+ }
155
+ }
156
+ },
157
+ example: {
158
+ serverToken: "server-***"
159
+ }
160
+ },
161
+ healthCheck: {
162
+ method: "ping",
163
+ timeoutMs: 3000
164
+ },
165
+ docsUrl: "https://postmarkapp.com/developer",
166
+ constraints: {
167
+ rateLimit: {
168
+ rpm: 500
169
+ }
170
+ },
171
+ byokSetup: {
172
+ setupInstructions: "Create a Postmark server token with outbound send permissions and configure allowed from addresses."
173
+ }
174
+ });
175
+ function registerPostmarkIntegration(registry) {
176
+ return registry.register(postmarkIntegrationSpec);
177
+ }
178
+
179
+ // src/integrations/providers/qdrant.ts
180
+ import { StabilityEnum as StabilityEnum3 } from "@contractspec/lib.contracts-spec/ownership";
181
+ var qdrantIntegrationSpec = defineIntegration({
182
+ meta: {
183
+ key: "vectordb.qdrant",
184
+ version: "1.0.0",
185
+ category: "vector-db",
186
+ title: "Qdrant Vector Database",
187
+ description: "Qdrant integration for vector search and embeddings storage.",
188
+ domain: "ai",
189
+ owners: ["platform.ai"],
190
+ tags: ["vector-db", "search"],
191
+ stability: StabilityEnum3.Experimental
192
+ },
193
+ supportedModes: ["managed", "byok"],
194
+ capabilities: {
195
+ provides: [
196
+ { key: "vector-db.search", version: "1.0.0" },
197
+ { key: "vector-db.storage", version: "1.0.0" }
198
+ ],
199
+ requires: [
200
+ {
201
+ key: "ai.embeddings",
202
+ optional: true,
203
+ reason: "Required if vectors are generated via hosted embedding services"
204
+ }
205
+ ]
206
+ },
207
+ configSchema: {
208
+ schema: {
209
+ type: "object",
210
+ properties: {
211
+ apiUrl: {
212
+ type: "string",
213
+ description: "Base URL for the Qdrant instance (e.g., https://qdrant.example.com)."
214
+ },
215
+ collectionPrefix: {
216
+ type: "string",
217
+ description: "Prefix applied to all collection names for this tenant."
218
+ }
219
+ }
220
+ },
221
+ example: {
222
+ apiUrl: "https://qdrant.example.com",
223
+ collectionPrefix: "tenant_"
224
+ }
225
+ },
226
+ secretSchema: {
227
+ schema: {
228
+ type: "object",
229
+ properties: {
230
+ apiKey: {
231
+ type: "string",
232
+ description: "API key or token when authentication is enabled."
233
+ }
234
+ }
235
+ },
236
+ example: {
237
+ apiKey: "qdrant-api-key"
238
+ }
239
+ },
240
+ healthCheck: {
241
+ method: "ping",
242
+ timeoutMs: 4000
243
+ },
244
+ docsUrl: "https://qdrant.tech/documentation/quick-start/",
245
+ constraints: {
246
+ quotas: {
247
+ collections: 100,
248
+ pointsPerCollection: 1e6
249
+ }
250
+ },
251
+ byokSetup: {
252
+ setupInstructions: "Provide the HTTPS endpoint of your Qdrant cluster and generate an API key with read/write access to the collections that will be managed."
253
+ }
254
+ });
255
+ function registerQdrantIntegration(registry) {
256
+ return registry.register(qdrantIntegrationSpec);
257
+ }
258
+
259
+ // src/integrations/providers/supabase-vector.ts
260
+ import { StabilityEnum as StabilityEnum4 } from "@contractspec/lib.contracts-spec/ownership";
261
+ var supabaseVectorIntegrationSpec = defineIntegration({
262
+ meta: {
263
+ key: "vectordb.supabase",
264
+ version: "1.0.0",
265
+ category: "vector-db",
266
+ title: "Supabase Vector Database (pgvector)",
267
+ description: "Supabase integration for embedding storage and vector similarity search using pgvector.",
268
+ domain: "ai",
269
+ owners: ["platform.ai"],
270
+ tags: ["vector-db", "supabase", "pgvector"],
271
+ stability: StabilityEnum4.Beta
272
+ },
273
+ supportedModes: ["managed", "byok"],
274
+ capabilities: {
275
+ provides: [
276
+ { key: "vector-db.search", version: "1.0.0" },
277
+ { key: "vector-db.storage", version: "1.0.0" }
278
+ ],
279
+ requires: [
280
+ {
281
+ key: "ai.embeddings",
282
+ optional: true,
283
+ reason: "Required when vectors are generated by a hosted embedding provider."
284
+ }
285
+ ]
286
+ },
287
+ configSchema: {
288
+ schema: {
289
+ type: "object",
290
+ properties: {
291
+ schema: {
292
+ type: "string",
293
+ description: "Schema name containing the pgvector table (default: public)."
294
+ },
295
+ table: {
296
+ type: "string",
297
+ description: "Table used to store vectors and metadata (default: contractspec_vectors)."
298
+ },
299
+ createTableIfMissing: {
300
+ type: "boolean",
301
+ description: "Automatically create pgvector extension and table when first writing vectors."
302
+ },
303
+ distanceMetric: {
304
+ type: "string",
305
+ enum: ["cosine", "l2", "inner_product"],
306
+ description: "Distance metric used for nearest-neighbor search."
307
+ }
308
+ }
309
+ },
310
+ example: {
311
+ schema: "public",
312
+ table: "contractspec_vectors",
313
+ createTableIfMissing: true,
314
+ distanceMetric: "cosine"
315
+ }
316
+ },
317
+ secretSchema: {
318
+ schema: {
319
+ type: "object",
320
+ required: ["databaseUrl"],
321
+ properties: {
322
+ databaseUrl: {
323
+ type: "string",
324
+ description: "Supabase Postgres connection string with privileges to read/write vector rows."
325
+ }
326
+ }
327
+ },
328
+ example: {
329
+ databaseUrl: "postgresql://postgres.[project-ref]:password@aws-0-region.pooler.supabase.com:6543/postgres"
330
+ }
331
+ },
332
+ healthCheck: {
333
+ method: "ping",
334
+ timeoutMs: 5000
335
+ },
336
+ docsUrl: "https://supabase.com/docs/guides/ai/vector-columns",
337
+ byokSetup: {
338
+ setupInstructions: "Create or reuse a Supabase project, enable pgvector, and provide a Postgres connection string with read/write access to the target vector table."
339
+ }
340
+ });
341
+ function registerSupabaseVectorIntegration(registry) {
342
+ return registry.register(supabaseVectorIntegrationSpec);
343
+ }
344
+
345
+ // src/integrations/providers/supabase-postgres.ts
346
+ import { StabilityEnum as StabilityEnum5 } from "@contractspec/lib.contracts-spec/ownership";
347
+ var supabasePostgresIntegrationSpec = defineIntegration({
348
+ meta: {
349
+ key: "database.supabase",
350
+ version: "1.0.0",
351
+ category: "database",
352
+ title: "Supabase Postgres",
353
+ description: "Supabase Postgres integration for SQL query execution and transactional workloads.",
354
+ domain: "infrastructure",
355
+ owners: ["platform.infrastructure"],
356
+ tags: ["database", "postgres", "supabase"],
357
+ stability: StabilityEnum5.Beta
358
+ },
359
+ supportedModes: ["managed", "byok"],
360
+ capabilities: {
361
+ provides: [{ key: "database.sql", version: "1.0.0" }]
362
+ },
363
+ configSchema: {
364
+ schema: {
365
+ type: "object",
366
+ properties: {
367
+ maxConnections: {
368
+ type: "number",
369
+ description: "Optional connection pool size when opening a Postgres client to Supabase."
370
+ },
371
+ sslMode: {
372
+ type: "string",
373
+ enum: ["require", "allow", "prefer"],
374
+ description: "TLS mode used by the Postgres client."
375
+ }
376
+ }
377
+ },
378
+ example: {
379
+ maxConnections: 10,
380
+ sslMode: "require"
381
+ }
382
+ },
383
+ secretSchema: {
384
+ schema: {
385
+ type: "object",
386
+ required: ["databaseUrl"],
387
+ properties: {
388
+ databaseUrl: {
389
+ type: "string",
390
+ description: "Supabase Postgres connection string (transaction or session pooler endpoint)."
391
+ }
392
+ }
393
+ },
394
+ example: {
395
+ databaseUrl: "postgresql://postgres.[project-ref]:password@aws-0-region.pooler.supabase.com:6543/postgres"
396
+ }
397
+ },
398
+ healthCheck: {
399
+ method: "ping",
400
+ timeoutMs: 5000
401
+ },
402
+ docsUrl: "https://supabase.com/docs/guides/database/connecting-to-postgres",
403
+ byokSetup: {
404
+ setupInstructions: "Create or reuse a Supabase project and provide a Postgres connection string with permissions aligned to your workload."
405
+ }
406
+ });
407
+ function registerSupabasePostgresIntegration(registry) {
408
+ return registry.register(supabasePostgresIntegrationSpec);
409
+ }
410
+
411
+ // src/integrations/providers/mistral.ts
412
+ import { StabilityEnum as StabilityEnum6 } from "@contractspec/lib.contracts-spec/ownership";
413
+ var mistralIntegrationSpec = defineIntegration({
414
+ meta: {
415
+ key: "ai-llm.mistral",
416
+ version: "1.0.0",
417
+ category: "ai-llm",
418
+ title: "Mistral Large Language Model",
419
+ description: "Mistral integration providing chat completions and embedding generation.",
420
+ domain: "ai",
421
+ owners: ["platform.ai"],
422
+ tags: ["ai", "llm", "embeddings"],
423
+ stability: StabilityEnum6.Experimental
424
+ },
425
+ supportedModes: ["managed", "byok"],
426
+ capabilities: {
427
+ provides: [
428
+ { key: "ai.chat", version: "1.0.0" },
429
+ { key: "ai.embeddings", version: "1.0.0" }
430
+ ]
431
+ },
432
+ configSchema: {
433
+ schema: {
434
+ type: "object",
435
+ properties: {
436
+ model: {
437
+ type: "string",
438
+ description: "Default chat completion model (e.g., mistral-large-latest)."
439
+ },
440
+ embeddingModel: {
441
+ type: "string",
442
+ description: "Embedding model identifier."
443
+ }
444
+ }
445
+ },
446
+ example: {
447
+ model: "mistral-large-latest",
448
+ embeddingModel: "mistral-embed"
449
+ }
450
+ },
451
+ secretSchema: {
452
+ schema: {
453
+ type: "object",
454
+ required: ["apiKey"],
455
+ properties: {
456
+ apiKey: {
457
+ type: "string",
458
+ description: "Mistral API key with access to chat and embeddings endpoints."
459
+ }
460
+ }
461
+ },
462
+ example: {
463
+ apiKey: "mistral-***"
464
+ }
465
+ },
466
+ healthCheck: {
467
+ method: "custom",
468
+ timeoutMs: 5000
469
+ },
470
+ docsUrl: "https://docs.mistral.ai/platform/endpoints",
471
+ constraints: {
472
+ rateLimit: {
473
+ rpm: 600
474
+ }
475
+ },
476
+ byokSetup: {
477
+ setupInstructions: "Generate an API key within the Mistral console and ensure the selected models are enabled for the account."
478
+ }
479
+ });
480
+ function registerMistralIntegration(registry) {
481
+ return registry.register(mistralIntegrationSpec);
482
+ }
483
+
484
+ // src/integrations/providers/elevenlabs.ts
485
+ import { StabilityEnum as StabilityEnum7 } from "@contractspec/lib.contracts-spec/ownership";
486
+ var elevenLabsIntegrationSpec = defineIntegration({
487
+ meta: {
488
+ key: "ai-voice.elevenlabs",
489
+ version: "1.0.0",
490
+ category: "ai-voice",
491
+ title: "ElevenLabs Text-to-Speech",
492
+ description: "ElevenLabs integration for neural voice synthesis and voice catalog access.",
493
+ domain: "ai",
494
+ owners: ["platform.ai"],
495
+ tags: ["voice", "tts"],
496
+ stability: StabilityEnum7.Beta
497
+ },
498
+ supportedModes: ["managed", "byok"],
499
+ capabilities: {
500
+ provides: [{ key: "ai.voice.synthesis", version: "1.0.0" }]
501
+ },
502
+ configSchema: {
503
+ schema: {
504
+ type: "object",
505
+ properties: {
506
+ defaultVoiceId: {
507
+ type: "string",
508
+ description: "Optional default voice identifier for synthesis requests."
509
+ }
510
+ }
511
+ },
512
+ example: {
513
+ defaultVoiceId: "pNInz6obpgDQGcFmaJgB"
514
+ }
515
+ },
516
+ secretSchema: {
517
+ schema: {
518
+ type: "object",
519
+ required: ["apiKey"],
520
+ properties: {
521
+ apiKey: {
522
+ type: "string",
523
+ description: "ElevenLabs API key with text-to-speech permissions."
524
+ }
525
+ }
526
+ },
527
+ example: {
528
+ apiKey: "eleven-***"
529
+ }
530
+ },
531
+ healthCheck: {
532
+ method: "custom",
533
+ timeoutMs: 4000
534
+ },
535
+ docsUrl: "https://elevenlabs.io/docs/api-reference/text-to-speech",
536
+ constraints: {
537
+ rateLimit: {
538
+ rpm: 120
539
+ }
540
+ },
541
+ byokSetup: {
542
+ setupInstructions: "Create an ElevenLabs API key and ensure the desired voices are accessible to the key scope."
543
+ }
544
+ });
545
+ function registerElevenLabsIntegration(registry) {
546
+ return registry.register(elevenLabsIntegrationSpec);
547
+ }
548
+
549
+ // src/integrations/providers/gradium.ts
550
+ import { StabilityEnum as StabilityEnum8 } from "@contractspec/lib.contracts-spec/ownership";
551
+ var gradiumIntegrationSpec = defineIntegration({
552
+ meta: {
553
+ key: "ai-voice.gradium",
554
+ version: "1.0.0",
555
+ category: "ai-voice",
556
+ title: "Gradium Text-to-Speech",
557
+ description: "Gradium integration for low-latency voice synthesis and voice catalog access.",
558
+ domain: "ai",
559
+ owners: ["platform.ai"],
560
+ tags: ["voice", "tts", "realtime"],
561
+ stability: StabilityEnum8.Experimental
562
+ },
563
+ supportedModes: ["byok"],
564
+ capabilities: {
565
+ provides: [{ key: "ai.voice.synthesis", version: "1.0.0" }]
566
+ },
567
+ configSchema: {
568
+ schema: {
569
+ type: "object",
570
+ properties: {
571
+ defaultVoiceId: {
572
+ type: "string",
573
+ description: "Optional default voice identifier used for synthesis."
574
+ },
575
+ region: {
576
+ type: "string",
577
+ enum: ["eu", "us"],
578
+ description: "Gradium region used by the SDK (eu or us)."
579
+ },
580
+ baseUrl: {
581
+ type: "string",
582
+ description: "Optional API base URL override for private routing or proxies."
583
+ },
584
+ timeoutMs: {
585
+ type: "number",
586
+ description: "Optional request timeout in milliseconds."
587
+ },
588
+ outputFormat: {
589
+ type: "string",
590
+ enum: [
591
+ "wav",
592
+ "pcm",
593
+ "opus",
594
+ "ulaw_8000",
595
+ "alaw_8000",
596
+ "pcm_16000",
597
+ "pcm_24000"
598
+ ],
599
+ description: "Optional default output format used when no format is specified."
600
+ }
601
+ }
602
+ },
603
+ example: {
604
+ defaultVoiceId: "YTpq7expH9539ERJ",
605
+ region: "eu",
606
+ timeoutMs: 15000,
607
+ outputFormat: "wav"
608
+ }
609
+ },
610
+ secretSchema: {
611
+ schema: {
612
+ type: "object",
613
+ required: ["apiKey"],
614
+ properties: {
615
+ apiKey: {
616
+ type: "string",
617
+ description: "Gradium API key with TTS access."
618
+ }
619
+ }
620
+ },
621
+ example: {
622
+ apiKey: "gd_***"
623
+ }
624
+ },
625
+ healthCheck: {
626
+ method: "custom",
627
+ timeoutMs: 5000
628
+ },
629
+ docsUrl: "https://gradium.ai/api_docs.html",
630
+ byokSetup: {
631
+ setupInstructions: "Create a Gradium API key, select the target region, and store credentials in your tenant secret provider."
632
+ }
633
+ });
634
+ function registerGradiumIntegration(registry) {
635
+ return registry.register(gradiumIntegrationSpec);
636
+ }
637
+
638
+ // src/integrations/providers/fal.ts
639
+ import { StabilityEnum as StabilityEnum9 } from "@contractspec/lib.contracts-spec/ownership";
640
+ var falIntegrationSpec = defineIntegration({
641
+ meta: {
642
+ key: "ai-voice.fal",
643
+ version: "1.0.0",
644
+ category: "ai-voice",
645
+ title: "Fal Chatterbox Text-to-Speech",
646
+ description: "Fal integration for voice synthesis using Chatterbox text-to-speech models.",
647
+ domain: "ai",
648
+ owners: ["platform.ai"],
649
+ tags: ["voice", "tts", "chatterbox"],
650
+ stability: StabilityEnum9.Experimental
651
+ },
652
+ supportedModes: ["byok"],
653
+ capabilities: {
654
+ provides: [{ key: "ai.voice.synthesis", version: "1.0.0" }]
655
+ },
656
+ configSchema: {
657
+ schema: {
658
+ type: "object",
659
+ properties: {
660
+ modelId: {
661
+ type: "string",
662
+ description: "Fal model endpoint identifier (e.g. fal-ai/chatterbox/text-to-speech)."
663
+ },
664
+ defaultVoiceUrl: {
665
+ type: "string",
666
+ description: "Optional reference audio URL used as default voice conditioning input."
667
+ },
668
+ defaultExaggeration: {
669
+ type: "number",
670
+ minimum: 0,
671
+ maximum: 1,
672
+ description: "Optional default exaggeration value for speech output."
673
+ },
674
+ defaultTemperature: {
675
+ type: "number",
676
+ minimum: 0.05,
677
+ maximum: 2,
678
+ description: "Optional default temperature for synthesis requests."
679
+ },
680
+ defaultCfg: {
681
+ type: "number",
682
+ minimum: 0.1,
683
+ maximum: 1,
684
+ description: "Optional default cfg value for synthesis requests."
685
+ },
686
+ pollIntervalMs: {
687
+ type: "number",
688
+ description: "Optional queue polling interval in milliseconds."
689
+ }
690
+ }
691
+ },
692
+ example: {
693
+ modelId: "fal-ai/chatterbox/text-to-speech",
694
+ defaultVoiceUrl: "https://storage.googleapis.com/chatterbox-demo-samples/prompts/male_rickmorty.mp3",
695
+ defaultExaggeration: 0.25,
696
+ defaultTemperature: 0.7,
697
+ defaultCfg: 0.5,
698
+ pollIntervalMs: 1000
699
+ }
700
+ },
701
+ secretSchema: {
702
+ schema: {
703
+ type: "object",
704
+ required: ["apiKey"],
705
+ properties: {
706
+ apiKey: {
707
+ type: "string",
708
+ description: "Fal API key (FAL_KEY)."
709
+ }
710
+ }
711
+ },
712
+ example: {
713
+ apiKey: "key-id:key-secret"
714
+ }
715
+ },
716
+ healthCheck: {
717
+ method: "custom",
718
+ timeoutMs: 7000
719
+ },
720
+ docsUrl: "https://fal.ai/models/fal-ai/chatterbox/text-to-speech/api",
721
+ byokSetup: {
722
+ setupInstructions: "Create a Fal API key and configure the desired voice model endpoint before connecting tenants."
723
+ }
724
+ });
725
+ function registerFalIntegration(registry) {
726
+ return registry.register(falIntegrationSpec);
727
+ }
728
+
729
+ // src/integrations/providers/gmail.ts
730
+ import { StabilityEnum as StabilityEnum10 } from "@contractspec/lib.contracts-spec/ownership";
731
+ var gmailIntegrationSpec = defineIntegration({
732
+ meta: {
733
+ key: "email.gmail",
734
+ version: "1.0.0",
735
+ category: "email",
736
+ title: "Google Gmail API",
737
+ description: "Gmail integration supporting inbound thread ingestion and outbound transactional email.",
738
+ domain: "communications",
739
+ owners: ["platform.messaging"],
740
+ tags: ["email", "gmail"],
741
+ stability: StabilityEnum10.Beta
742
+ },
743
+ supportedModes: ["managed", "byok"],
744
+ capabilities: {
745
+ provides: [
746
+ { key: "email.inbound", version: "1.0.0" },
747
+ { key: "email.outbound", version: "1.0.0" }
748
+ ]
749
+ },
750
+ configSchema: {
751
+ schema: {
752
+ type: "object",
753
+ properties: {
754
+ labelIds: {
755
+ type: "array",
756
+ items: { type: "string" },
757
+ description: "Optional list of label IDs to scope inbound sync."
758
+ },
759
+ includeSpamTrash: {
760
+ type: "boolean",
761
+ description: "Whether to include spam or trash messages during sync."
762
+ }
763
+ }
764
+ },
765
+ example: {
766
+ labelIds: ["INBOX"],
767
+ includeSpamTrash: false
768
+ }
769
+ },
770
+ secretSchema: {
771
+ schema: {
772
+ type: "object",
773
+ required: ["clientId", "clientSecret", "refreshToken"],
774
+ properties: {
775
+ clientId: {
776
+ type: "string",
777
+ description: "OAuth client ID for the Google Cloud project."
778
+ },
779
+ clientSecret: {
780
+ type: "string",
781
+ description: "OAuth client secret for the Google Cloud project."
782
+ },
783
+ refreshToken: {
784
+ type: "string",
785
+ description: "OAuth refresh token for delegated Gmail access."
786
+ },
787
+ redirectUri: {
788
+ type: "string",
789
+ description: "Optional redirect URI used when issuing the refresh token."
790
+ }
791
+ }
792
+ },
793
+ example: {
794
+ clientId: "xxx.apps.googleusercontent.com",
795
+ clientSecret: "secret",
796
+ refreshToken: "refresh-token"
797
+ }
798
+ },
799
+ healthCheck: {
800
+ method: "custom",
801
+ timeoutMs: 4000
802
+ },
803
+ docsUrl: "https://developers.google.com/gmail/api",
804
+ constraints: {
805
+ rateLimit: {
806
+ rpm: 600
807
+ }
808
+ },
809
+ byokSetup: {
810
+ setupInstructions: "Create an OAuth consent screen and credentials within Google Cloud Console, then authorize the Gmail scopes and store the resulting refresh token."
811
+ }
812
+ });
813
+ function registerGmailIntegration(registry) {
814
+ return registry.register(gmailIntegrationSpec);
815
+ }
816
+
817
+ // src/integrations/providers/google-calendar.ts
818
+ import { StabilityEnum as StabilityEnum11 } from "@contractspec/lib.contracts-spec/ownership";
819
+ var googleCalendarIntegrationSpec = defineIntegration({
820
+ meta: {
821
+ key: "calendar.google",
822
+ version: "1.0.0",
823
+ category: "calendar",
824
+ title: "Google Calendar API",
825
+ description: "Google Calendar integration for event creation, updates, and scheduling automations.",
826
+ domain: "productivity",
827
+ owners: ["platform.messaging"],
828
+ tags: ["calendar", "google"],
829
+ stability: StabilityEnum11.Beta
830
+ },
831
+ supportedModes: ["managed", "byok"],
832
+ capabilities: {
833
+ provides: [{ key: "calendar.events", version: "1.0.0" }]
834
+ },
835
+ configSchema: {
836
+ schema: {
837
+ type: "object",
838
+ properties: {
839
+ calendarId: {
840
+ type: "string",
841
+ description: "Default calendar identifier (defaults to primary)."
842
+ }
843
+ }
844
+ },
845
+ example: {
846
+ calendarId: "primary"
847
+ }
848
+ },
849
+ secretSchema: {
850
+ schema: {
851
+ type: "object",
852
+ required: ["clientEmail", "privateKey"],
853
+ properties: {
854
+ clientEmail: {
855
+ type: "string",
856
+ description: "Service account client email."
857
+ },
858
+ privateKey: {
859
+ type: "string",
860
+ description: "Service account private key."
861
+ },
862
+ projectId: {
863
+ type: "string",
864
+ description: "Google Cloud project ID."
865
+ }
866
+ }
867
+ },
868
+ example: {
869
+ clientEmail: "svc-calendar@example.iam.gserviceaccount.com",
870
+ privateKey: "-----BEGIN PRIVATE KEY-----...",
871
+ projectId: "calendar-project"
872
+ }
873
+ },
874
+ healthCheck: {
875
+ method: "custom",
876
+ timeoutMs: 4000
877
+ },
878
+ docsUrl: "https://developers.google.com/calendar/api",
879
+ constraints: {},
880
+ byokSetup: {
881
+ setupInstructions: "Create a Google service account with Calendar access and share the target calendars with the service account email."
882
+ }
883
+ });
884
+ function registerGoogleCalendarIntegration(registry) {
885
+ return registry.register(googleCalendarIntegrationSpec);
886
+ }
887
+
888
+ // src/integrations/providers/twilio-sms.ts
889
+ import { StabilityEnum as StabilityEnum12 } from "@contractspec/lib.contracts-spec/ownership";
890
+ var twilioSmsIntegrationSpec = defineIntegration({
891
+ meta: {
892
+ key: "sms.twilio",
893
+ version: "1.0.0",
894
+ category: "sms",
895
+ title: "Twilio Messaging",
896
+ description: "Twilio SMS integration for transactional and notification messaging.",
897
+ domain: "communications",
898
+ owners: ["platform.messaging"],
899
+ tags: ["sms", "messaging"],
900
+ stability: StabilityEnum12.Stable
901
+ },
902
+ supportedModes: ["managed", "byok"],
903
+ capabilities: {
904
+ provides: [{ key: "sms.outbound", version: "1.0.0" }]
905
+ },
906
+ configSchema: {
907
+ schema: {
908
+ type: "object",
909
+ properties: {
910
+ fromNumber: {
911
+ type: "string",
912
+ description: "Default Twilio phone number used as sender."
913
+ }
914
+ }
915
+ },
916
+ example: {
917
+ fromNumber: "+15551234567"
918
+ }
919
+ },
920
+ secretSchema: {
921
+ schema: {
922
+ type: "object",
923
+ required: ["accountSid", "authToken"],
924
+ properties: {
925
+ accountSid: {
926
+ type: "string",
927
+ description: "Twilio Account SID."
928
+ },
929
+ authToken: {
930
+ type: "string",
931
+ description: "Twilio Auth Token."
932
+ }
933
+ }
934
+ },
935
+ example: {
936
+ accountSid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
937
+ authToken: "auth-token"
938
+ }
939
+ },
940
+ healthCheck: {
941
+ method: "custom",
942
+ timeoutMs: 3000
943
+ },
944
+ docsUrl: "https://www.twilio.com/docs/sms/api",
945
+ constraints: {
946
+ rateLimit: {
947
+ rpm: 200
948
+ }
949
+ },
950
+ byokSetup: {
951
+ setupInstructions: "Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration."
952
+ }
953
+ });
954
+ function registerTwilioSmsIntegration(registry) {
955
+ return registry.register(twilioSmsIntegrationSpec);
956
+ }
957
+
958
+ // src/integrations/providers/gcs-storage.ts
959
+ import { StabilityEnum as StabilityEnum13 } from "@contractspec/lib.contracts-spec/ownership";
960
+ var gcsStorageIntegrationSpec = defineIntegration({
961
+ meta: {
962
+ key: "storage.gcs",
963
+ version: "1.0.0",
964
+ category: "storage",
965
+ title: "Google Cloud Storage Buckets",
966
+ description: "Google Cloud Storage integration for object storage and retrieval.",
967
+ domain: "infrastructure",
968
+ owners: ["platform.infrastructure"],
969
+ tags: ["storage", "gcs", "google-cloud"],
970
+ stability: StabilityEnum13.Beta
971
+ },
972
+ supportedModes: ["managed", "byok"],
973
+ capabilities: {
974
+ provides: [{ key: "storage.objects", version: "1.0.0" }]
975
+ },
976
+ configSchema: {
977
+ schema: {
978
+ type: "object",
979
+ required: ["bucket"],
980
+ properties: {
981
+ bucket: {
982
+ type: "string",
983
+ description: "Primary bucket name used for storing objects."
984
+ },
985
+ prefix: {
986
+ type: "string",
987
+ description: "Optional prefix applied to object keys."
988
+ }
989
+ }
990
+ },
991
+ example: {
992
+ bucket: "pfo-tenant-assets",
993
+ prefix: "documents/"
994
+ }
995
+ },
996
+ secretSchema: {
997
+ schema: {
998
+ type: "object",
999
+ properties: {
1000
+ type: {
1001
+ type: "string",
1002
+ description: "Service account type field from Google credentials JSON (if provided)."
1003
+ },
1004
+ client_email: { type: "string" },
1005
+ private_key: { type: "string" },
1006
+ project_id: { type: "string" }
1007
+ }
1008
+ },
1009
+ example: {
1010
+ type: "service_account",
1011
+ client_email: "svc-account@example.iam.gserviceaccount.com",
1012
+ private_key: "-----BEGIN PRIVATE KEY-----...",
1013
+ project_id: "example-project"
1014
+ }
1015
+ },
1016
+ healthCheck: {
1017
+ method: "ping",
1018
+ timeoutMs: 4000
1019
+ },
1020
+ docsUrl: "https://cloud.google.com/storage/docs/apis",
1021
+ constraints: {
1022
+ quotas: {
1023
+ storageGb: 5120
1024
+ }
1025
+ },
1026
+ byokSetup: {
1027
+ setupInstructions: "Create a Google Cloud service account with Storage Object Admin role and upload the JSON credentials to the secret store."
1028
+ }
1029
+ });
1030
+ function registerGcsStorageIntegration(registry) {
1031
+ return registry.register(gcsStorageIntegrationSpec);
1032
+ }
1033
+
1034
+ // src/integrations/providers/powens.ts
1035
+ import { StabilityEnum as StabilityEnum14 } from "@contractspec/lib.contracts-spec/ownership";
1036
+ var powensIntegrationSpec = defineIntegration({
1037
+ meta: {
1038
+ key: "openbanking.powens",
1039
+ version: "1.0.0",
1040
+ category: "open-banking",
1041
+ title: "Powens Open Banking (Read)",
1042
+ description: "Read-only Open Banking integration powered by Powens, exposing accounts, transactions, and balances.",
1043
+ domain: "finance",
1044
+ owners: ["platform.finance"],
1045
+ tags: ["open-banking", "powens", "finance"],
1046
+ stability: StabilityEnum14.Experimental
1047
+ },
1048
+ supportedModes: ["byok"],
1049
+ capabilities: {
1050
+ provides: [
1051
+ { key: "openbanking.accounts.read", version: "1.0.0" },
1052
+ { key: "openbanking.transactions.read", version: "1.0.0" },
1053
+ { key: "openbanking.balances.read", version: "1.0.0" }
1054
+ ]
1055
+ },
1056
+ configSchema: {
1057
+ schema: {
1058
+ type: "object",
1059
+ required: ["environment"],
1060
+ properties: {
1061
+ environment: {
1062
+ type: "string",
1063
+ enum: ["sandbox", "production"],
1064
+ description: "Powens environment to target. Sandbox uses Powens test API base URL, production uses live endpoints."
1065
+ },
1066
+ baseUrl: {
1067
+ type: "string",
1068
+ description: "Optional override for the Powens API base URL. Defaults to Powens environment defaults."
1069
+ },
1070
+ region: {
1071
+ type: "string",
1072
+ description: "Optional Powens region identifier when targeting a specific data residency cluster."
1073
+ },
1074
+ pollingIntervalMs: {
1075
+ type: "number",
1076
+ description: "Optional custom polling interval in milliseconds for background sync jobs (defaults to platform standard)."
1077
+ }
1078
+ }
1079
+ },
1080
+ example: {
1081
+ environment: "sandbox",
1082
+ baseUrl: "https://api-sandbox.powens.com/v2",
1083
+ region: "eu-west-1",
1084
+ pollingIntervalMs: 300000
1085
+ }
1086
+ },
1087
+ secretSchema: {
1088
+ schema: {
1089
+ type: "object",
1090
+ required: ["clientId", "clientSecret"],
1091
+ properties: {
1092
+ clientId: {
1093
+ type: "string",
1094
+ description: "Powens OAuth client identifier obtained from the Powens Console (BYOK project)."
1095
+ },
1096
+ clientSecret: {
1097
+ type: "string",
1098
+ description: "Powens OAuth client secret used to exchange for access tokens."
1099
+ },
1100
+ apiKey: {
1101
+ type: "string",
1102
+ description: "Optional Powens API key (if the tenant project exposes a dedicated API token)."
1103
+ },
1104
+ webhookSecret: {
1105
+ type: "string",
1106
+ description: "Optional webhook signing secret used to verify Powens webhook payloads."
1107
+ }
1108
+ }
1109
+ },
1110
+ example: {
1111
+ clientId: "powens-client-id",
1112
+ clientSecret: "powens-client-secret",
1113
+ apiKey: "powens-api-key",
1114
+ webhookSecret: "powens-webhook-secret"
1115
+ }
1116
+ },
1117
+ healthCheck: {
1118
+ method: "ping",
1119
+ timeoutMs: 8000
1120
+ },
1121
+ docsUrl: "https://docs.powens.com/",
1122
+ constraints: {
1123
+ rateLimit: {
1124
+ rph: 1e4,
1125
+ rpm: 600
1126
+ }
1127
+ },
1128
+ byokSetup: {
1129
+ setupInstructions: "Create a Powens BYOK project, generate OAuth credentials, and optionally configure webhook delivery for account/transaction updates.",
1130
+ requiredScopes: ["accounts:read", "transactions:read", "balances:read"]
1131
+ }
1132
+ });
1133
+ function registerPowensIntegration(registry) {
1134
+ return registry.register(powensIntegrationSpec);
1135
+ }
1136
+
1137
+ // src/integrations/providers/posthog.ts
1138
+ import { StabilityEnum as StabilityEnum15 } from "@contractspec/lib.contracts-spec/ownership";
1139
+ var posthogIntegrationSpec = defineIntegration({
1140
+ meta: {
1141
+ key: "analytics.posthog",
1142
+ version: "1.1.0",
1143
+ category: "analytics",
1144
+ title: "PostHog",
1145
+ description: "PostHog integration for product analytics, feature flags, HogQL queries, and LLM analytics with evaluations.",
1146
+ domain: "analytics",
1147
+ owners: ["@platform.integrations"],
1148
+ tags: ["analytics", "posthog", "llm", "ai"],
1149
+ stability: StabilityEnum15.Beta
1150
+ },
1151
+ supportedModes: ["managed", "byok"],
1152
+ capabilities: {
1153
+ provides: [
1154
+ { key: "analytics.events", version: "1.0.0" },
1155
+ { key: "analytics.feature-flags", version: "1.0.0" },
1156
+ { key: "analytics.query", version: "1.0.0" },
1157
+ { key: "analytics.events.read", version: "1.0.0" },
1158
+ { key: "analytics.persons", version: "1.0.0" },
1159
+ { key: "analytics.insights", version: "1.0.0" },
1160
+ { key: "analytics.cohorts", version: "1.0.0" },
1161
+ { key: "analytics.annotations", version: "1.0.0" },
1162
+ { key: "analytics.llm-tracing", version: "1.0.0" },
1163
+ { key: "analytics.llm-evaluations", version: "1.0.0" }
1164
+ ]
1165
+ },
1166
+ configSchema: {
1167
+ schema: {
1168
+ type: "object",
1169
+ properties: {
1170
+ host: {
1171
+ type: "string",
1172
+ description: "PostHog host (e.g., https://app.posthog.com or self-hosted URL)."
1173
+ },
1174
+ projectId: {
1175
+ type: "string",
1176
+ description: "PostHog project ID for API queries."
1177
+ },
1178
+ mcpUrl: {
1179
+ type: "string",
1180
+ description: "Optional MCP endpoint URL for PostHog tools."
1181
+ }
1182
+ }
1183
+ },
1184
+ example: {
1185
+ host: "https://app.posthog.com",
1186
+ projectId: "12345"
1187
+ }
1188
+ },
1189
+ secretSchema: {
1190
+ schema: {
1191
+ type: "object",
1192
+ required: ["personalApiKey"],
1193
+ properties: {
1194
+ personalApiKey: {
1195
+ type: "string",
1196
+ description: "PostHog personal API key (required for API reads/writes)."
1197
+ },
1198
+ projectApiKey: {
1199
+ type: "string",
1200
+ description: "PostHog project API key (required for capture/ingest events)."
1201
+ }
1202
+ }
1203
+ },
1204
+ example: {
1205
+ personalApiKey: "phx_personal_api_key",
1206
+ projectApiKey: "phc_project_api_key"
1207
+ }
1208
+ },
1209
+ healthCheck: {
1210
+ method: "custom",
1211
+ timeoutMs: 5000
1212
+ },
1213
+ docsUrl: "https://posthog.com/docs",
1214
+ byokSetup: {
1215
+ setupInstructions: "Generate a PostHog personal API key for read/write operations and a project API key for event capture."
1216
+ }
1217
+ });
1218
+ function registerPosthogIntegration(registry) {
1219
+ return registry.register(posthogIntegrationSpec);
1220
+ }
1221
+
1222
+ // src/integrations/providers/posthog-llm-telemetry.ts
1223
+ import { StabilityEnum as StabilityEnum16 } from "@contractspec/lib.contracts-spec/ownership";
1224
+ var posthogLLMTelemetrySpec = {
1225
+ meta: {
1226
+ key: "analytics.posthog.llm",
1227
+ version: "1.0.0",
1228
+ title: "PostHog LLM Analytics Telemetry",
1229
+ description: "Telemetry events for PostHog LLM Analytics: generation tracing, token usage, and evaluation-ready metadata.",
1230
+ domain: "analytics",
1231
+ owners: ["@platform.integrations"],
1232
+ tags: ["analytics", "posthog", "llm", "ai", "telemetry"],
1233
+ stability: StabilityEnum16.Beta
1234
+ },
1235
+ events: [
1236
+ {
1237
+ key: "posthog.llm.generation",
1238
+ version: "1.0.0",
1239
+ semantics: {
1240
+ who: "AI agent or LLM consumer",
1241
+ what: "Captures an LLM generation call with full observability metadata",
1242
+ why: "Enable LLM performance monitoring, cost tracking, and automated quality evaluations via PostHog"
1243
+ },
1244
+ properties: {
1245
+ $ai_model: {
1246
+ type: "string",
1247
+ required: true,
1248
+ description: "The LLM model identifier (e.g., gpt-4o, claude-sonnet-4-20250514)"
1249
+ },
1250
+ $ai_provider: {
1251
+ type: "string",
1252
+ required: true,
1253
+ description: "The LLM provider (e.g., openai, anthropic, contractspec)"
1254
+ },
1255
+ $ai_latency: {
1256
+ type: "number",
1257
+ required: false,
1258
+ description: "LLM call latency in seconds"
1259
+ },
1260
+ $ai_input_tokens: {
1261
+ type: "number",
1262
+ required: false,
1263
+ description: "Number of input/prompt tokens consumed"
1264
+ },
1265
+ $ai_output_tokens: {
1266
+ type: "number",
1267
+ required: false,
1268
+ description: "Number of output/completion tokens generated"
1269
+ },
1270
+ $ai_total_cost_usd: {
1271
+ type: "number",
1272
+ required: false,
1273
+ description: "Total cost in USD (input + output)"
1274
+ },
1275
+ $ai_is_error: {
1276
+ type: "boolean",
1277
+ required: false,
1278
+ description: "Whether the generation resulted in an error"
1279
+ },
1280
+ $ai_trace_id: {
1281
+ type: "string",
1282
+ required: false,
1283
+ description: "Trace ID for grouping related generations"
1284
+ },
1285
+ $ai_stream: {
1286
+ type: "boolean",
1287
+ required: false,
1288
+ description: "Whether the response was streamed"
1289
+ },
1290
+ $ai_time_to_first_token: {
1291
+ type: "number",
1292
+ required: false,
1293
+ description: "Time to first token in seconds (streaming only)"
1294
+ },
1295
+ $ai_tools: {
1296
+ type: "json",
1297
+ required: false,
1298
+ description: "Tools/functions available to the LLM"
1299
+ },
1300
+ $ai_input: {
1301
+ type: "json",
1302
+ required: false,
1303
+ pii: true,
1304
+ redact: true,
1305
+ description: "Messages sent to the LLM (may contain PII)"
1306
+ },
1307
+ $ai_output_choices: {
1308
+ type: "json",
1309
+ required: false,
1310
+ pii: true,
1311
+ redact: true,
1312
+ description: "Response choices from the LLM (may contain PII)"
1313
+ },
1314
+ contractspec_operation: {
1315
+ type: "string",
1316
+ required: false,
1317
+ description: "ContractSpec operation name"
1318
+ },
1319
+ contractspec_version: {
1320
+ type: "string",
1321
+ required: false,
1322
+ description: "ContractSpec operation version"
1323
+ },
1324
+ contractspec_agent_id: {
1325
+ type: "string",
1326
+ required: false,
1327
+ description: "ContractSpec agent identifier"
1328
+ },
1329
+ contractspec_finish_reason: {
1330
+ type: "string",
1331
+ required: false,
1332
+ description: "AI SDK finish reason (stop, tool-calls, error, etc.)"
1333
+ },
1334
+ contractspec_tool_count: {
1335
+ type: "number",
1336
+ required: false,
1337
+ description: "Number of tool calls made in this step"
1338
+ }
1339
+ },
1340
+ privacy: "internal",
1341
+ tags: ["llm", "generation", "posthog"]
1342
+ }
1343
+ ],
1344
+ config: {
1345
+ defaultRetentionDays: 90,
1346
+ defaultSamplingRate: 1,
1347
+ providers: [
1348
+ {
1349
+ type: "posthog",
1350
+ config: {
1351
+ eventName: "$ai_generation",
1352
+ enableEvaluations: true,
1353
+ evaluationTemplates: [
1354
+ "relevance",
1355
+ "helpfulness",
1356
+ "jailbreak",
1357
+ "hallucination",
1358
+ "toxicity"
1359
+ ]
1360
+ }
1361
+ }
1362
+ ]
1363
+ }
1364
+ };
1365
+ var POSTHOG_LLM_PII_FIELDS = [
1366
+ "$ai_input",
1367
+ "$ai_output_choices"
1368
+ ];
1369
+ var POSTHOG_LLM_TELEMETRY_EVENTS = {
1370
+ generation: "$ai_generation",
1371
+ span: "$ai_span",
1372
+ evaluation: "$ai_evaluation"
1373
+ };
1374
+ var POSTHOG_EVALUATION_TEMPLATES = {
1375
+ relevance: "relevance",
1376
+ helpfulness: "helpfulness",
1377
+ jailbreak: "jailbreak",
1378
+ hallucination: "hallucination",
1379
+ toxicity: "toxicity"
1380
+ };
1381
+ function redactPostHogLLMTelemetryPayload(payload) {
1382
+ const redacted = { ...payload };
1383
+ for (const field of POSTHOG_LLM_PII_FIELDS) {
1384
+ if (field in redacted) {
1385
+ redacted[field] = "[REDACTED]";
1386
+ }
1387
+ }
1388
+ return redacted;
1389
+ }
1390
+
1391
+ // src/integrations/providers/linear.ts
1392
+ import { StabilityEnum as StabilityEnum17 } from "@contractspec/lib.contracts-spec/ownership";
1393
+ var linearIntegrationSpec = defineIntegration({
1394
+ meta: {
1395
+ key: "project-management.linear",
1396
+ version: "1.0.0",
1397
+ category: "project-management",
1398
+ title: "Linear",
1399
+ description: "Linear integration for issue tracking and project management workflows.",
1400
+ domain: "productivity",
1401
+ owners: ["@platform.integrations"],
1402
+ tags: ["project-management", "linear"],
1403
+ stability: StabilityEnum17.Beta
1404
+ },
1405
+ supportedModes: ["managed", "byok"],
1406
+ capabilities: {
1407
+ provides: [{ key: "project-management.work-items", version: "1.0.0" }]
1408
+ },
1409
+ configSchema: {
1410
+ schema: {
1411
+ type: "object",
1412
+ required: ["teamId"],
1413
+ properties: {
1414
+ teamId: {
1415
+ type: "string",
1416
+ description: "Linear team ID that owns created issues."
1417
+ },
1418
+ projectId: {
1419
+ type: "string",
1420
+ description: "Optional default project ID for new issues."
1421
+ },
1422
+ stateId: {
1423
+ type: "string",
1424
+ description: "Optional default workflow state ID."
1425
+ },
1426
+ assigneeId: {
1427
+ type: "string",
1428
+ description: "Optional default assignee ID."
1429
+ },
1430
+ labelIds: {
1431
+ type: "array",
1432
+ items: { type: "string" },
1433
+ description: "Optional label IDs applied to each issue."
1434
+ },
1435
+ tagLabelMap: {
1436
+ type: "object",
1437
+ additionalProperties: { type: "string" },
1438
+ description: "Optional mapping of tags to Linear label IDs (tag -> labelId)."
1439
+ }
1440
+ }
1441
+ },
1442
+ example: {
1443
+ teamId: "team_123",
1444
+ projectId: "proj_456",
1445
+ labelIds: ["label_1", "label_2"]
1446
+ }
1447
+ },
1448
+ secretSchema: {
1449
+ schema: {
1450
+ type: "object",
1451
+ required: ["apiKey"],
1452
+ properties: {
1453
+ apiKey: {
1454
+ type: "string",
1455
+ description: "Linear API key (personal or service token)."
1456
+ }
1457
+ }
1458
+ },
1459
+ example: {
1460
+ apiKey: "lin_api_key"
1461
+ }
1462
+ },
1463
+ healthCheck: {
1464
+ method: "custom",
1465
+ timeoutMs: 4000
1466
+ },
1467
+ docsUrl: "https://developers.linear.app",
1468
+ constraints: {},
1469
+ byokSetup: {
1470
+ setupInstructions: "Create a Linear API key with issue:write permission and store it as a secret."
1471
+ }
1472
+ });
1473
+ function registerLinearIntegration(registry) {
1474
+ return registry.register(linearIntegrationSpec);
1475
+ }
1476
+
1477
+ // src/integrations/providers/jira.ts
1478
+ import { StabilityEnum as StabilityEnum18 } from "@contractspec/lib.contracts-spec/ownership";
1479
+ var jiraIntegrationSpec = defineIntegration({
1480
+ meta: {
1481
+ key: "project-management.jira",
1482
+ version: "1.0.0",
1483
+ category: "project-management",
1484
+ title: "Jira Cloud",
1485
+ description: "Jira Cloud integration for creating and tracking work items.",
1486
+ domain: "productivity",
1487
+ owners: ["@platform.integrations"],
1488
+ tags: ["project-management", "jira"],
1489
+ stability: StabilityEnum18.Beta
1490
+ },
1491
+ supportedModes: ["managed", "byok"],
1492
+ capabilities: {
1493
+ provides: [{ key: "project-management.work-items", version: "1.0.0" }]
1494
+ },
1495
+ configSchema: {
1496
+ schema: {
1497
+ type: "object",
1498
+ required: ["siteUrl"],
1499
+ properties: {
1500
+ siteUrl: {
1501
+ type: "string",
1502
+ description: "Jira Cloud site URL (e.g., https://acme.atlassian.net)."
1503
+ },
1504
+ projectKey: {
1505
+ type: "string",
1506
+ description: "Default Jira project key for new issues."
1507
+ },
1508
+ issueType: {
1509
+ type: "string",
1510
+ description: "Default Jira issue type (e.g., Task, Story)."
1511
+ },
1512
+ defaultLabels: {
1513
+ type: "array",
1514
+ items: { type: "string" },
1515
+ description: "Labels applied to each issue by default."
1516
+ },
1517
+ issueTypeMap: {
1518
+ type: "object",
1519
+ additionalProperties: { type: "string" },
1520
+ description: "Optional mapping from work item types to Jira issue types."
1521
+ }
1522
+ }
1523
+ },
1524
+ example: {
1525
+ siteUrl: "https://acme.atlassian.net",
1526
+ projectKey: "PM",
1527
+ issueType: "Task"
1528
+ }
1529
+ },
1530
+ secretSchema: {
1531
+ schema: {
1532
+ type: "object",
1533
+ required: ["email", "apiToken"],
1534
+ properties: {
1535
+ email: {
1536
+ type: "string",
1537
+ description: "Jira account email used for API token auth."
1538
+ },
1539
+ apiToken: {
1540
+ type: "string",
1541
+ description: "Jira Cloud API token for the account."
1542
+ }
1543
+ }
1544
+ },
1545
+ example: {
1546
+ email: "user@acme.com",
1547
+ apiToken: "jira_api_token"
1548
+ }
1549
+ },
1550
+ healthCheck: {
1551
+ method: "custom",
1552
+ timeoutMs: 4000
1553
+ },
1554
+ docsUrl: "https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/",
1555
+ constraints: {},
1556
+ byokSetup: {
1557
+ setupInstructions: "Create a Jira API token and store it with the associated account email."
1558
+ }
1559
+ });
1560
+ function registerJiraIntegration(registry) {
1561
+ return registry.register(jiraIntegrationSpec);
1562
+ }
1563
+
1564
+ // src/integrations/providers/notion.ts
1565
+ import { StabilityEnum as StabilityEnum19 } from "@contractspec/lib.contracts-spec/ownership";
1566
+ var notionIntegrationSpec = defineIntegration({
1567
+ meta: {
1568
+ key: "project-management.notion",
1569
+ version: "1.0.0",
1570
+ category: "project-management",
1571
+ title: "Notion",
1572
+ description: "Notion integration for creating shared project summaries and task entries.",
1573
+ domain: "productivity",
1574
+ owners: ["@platform.integrations"],
1575
+ tags: ["project-management", "notion"],
1576
+ stability: StabilityEnum19.Beta
1577
+ },
1578
+ supportedModes: ["managed", "byok"],
1579
+ capabilities: {
1580
+ provides: [{ key: "project-management.work-items", version: "1.0.0" }]
1581
+ },
1582
+ configSchema: {
1583
+ schema: {
1584
+ type: "object",
1585
+ properties: {
1586
+ databaseId: {
1587
+ type: "string",
1588
+ description: "Optional Notion database ID to store tasks."
1589
+ },
1590
+ summaryParentPageId: {
1591
+ type: "string",
1592
+ description: "Optional parent page ID for summary pages."
1593
+ },
1594
+ titleProperty: {
1595
+ type: "string",
1596
+ description: 'Database title property name (defaults to "Name").'
1597
+ },
1598
+ statusProperty: {
1599
+ type: "string",
1600
+ description: "Database status/select property name."
1601
+ },
1602
+ priorityProperty: {
1603
+ type: "string",
1604
+ description: "Database priority/select property name."
1605
+ },
1606
+ tagsProperty: {
1607
+ type: "string",
1608
+ description: "Database multi-select tags property name."
1609
+ },
1610
+ dueDateProperty: {
1611
+ type: "string",
1612
+ description: "Database date property name for due dates."
1613
+ },
1614
+ descriptionProperty: {
1615
+ type: "string",
1616
+ description: "Database rich-text property for descriptions."
1617
+ }
1618
+ }
1619
+ },
1620
+ example: {
1621
+ databaseId: "xxxxxxxxxxxxxxxx",
1622
+ summaryParentPageId: "yyyyyyyyyyyyyyyy",
1623
+ titleProperty: "Name",
1624
+ statusProperty: "Status"
1625
+ }
1626
+ },
1627
+ secretSchema: {
1628
+ schema: {
1629
+ type: "object",
1630
+ required: ["apiKey"],
1631
+ properties: {
1632
+ apiKey: {
1633
+ type: "string",
1634
+ description: "Notion integration secret token."
1635
+ }
1636
+ }
1637
+ },
1638
+ example: {
1639
+ apiKey: "secret_notion_token"
1640
+ }
1641
+ },
1642
+ healthCheck: {
1643
+ method: "custom",
1644
+ timeoutMs: 4000
1645
+ },
1646
+ docsUrl: "https://developers.notion.com",
1647
+ constraints: {},
1648
+ byokSetup: {
1649
+ setupInstructions: "Create a Notion internal integration, share the target database/page with it, and store the secret token."
1650
+ }
1651
+ });
1652
+ function registerNotionIntegration(registry) {
1653
+ return registry.register(notionIntegrationSpec);
1654
+ }
1655
+
1656
+ // src/integrations/providers/granola.ts
1657
+ import { StabilityEnum as StabilityEnum20 } from "@contractspec/lib.contracts-spec/ownership";
1658
+ var granolaIntegrationSpec = defineIntegration({
1659
+ meta: {
1660
+ key: "meeting-recorder.granola",
1661
+ version: "1.0.0",
1662
+ category: "meeting-recorder",
1663
+ title: "Granola Meeting Notes",
1664
+ description: "Granola meeting notes and transcripts via Enterprise API or MCP transport.",
1665
+ domain: "productivity",
1666
+ owners: ["platform.integrations"],
1667
+ tags: ["meeting-recorder", "granola", "transcripts"],
1668
+ stability: StabilityEnum20.Experimental
1669
+ },
1670
+ supportedModes: ["byok"],
1671
+ capabilities: {
1672
+ provides: [
1673
+ { key: "meeting-recorder.meetings.read", version: "1.0.0" },
1674
+ { key: "meeting-recorder.transcripts.read", version: "1.0.0" }
1675
+ ]
1676
+ },
1677
+ configSchema: {
1678
+ schema: {
1679
+ type: "object",
1680
+ properties: {
1681
+ baseUrl: {
1682
+ type: "string",
1683
+ description: "Optional override for the Granola API base URL. Defaults to https://public-api.granola.ai for API transport."
1684
+ },
1685
+ transport: {
1686
+ type: "string",
1687
+ enum: ["api", "mcp"],
1688
+ description: "Transport mode for Granola integration. Use api for Enterprise API or mcp for broader MCP access."
1689
+ },
1690
+ mcpUrl: {
1691
+ type: "string",
1692
+ description: "Optional override for Granola MCP URL. Defaults to https://mcp.granola.ai/mcp."
1693
+ },
1694
+ mcpHeaders: {
1695
+ type: "object",
1696
+ additionalProperties: { type: "string" },
1697
+ description: "Optional static headers for MCP gateway/proxy setups."
1698
+ },
1699
+ pageSize: {
1700
+ type: "number",
1701
+ description: "Page size for listing notes (maximum 30 per Granola API)."
1702
+ }
1703
+ }
1704
+ },
1705
+ example: {
1706
+ transport: "mcp",
1707
+ mcpUrl: "https://mcp.granola.ai/mcp",
1708
+ pageSize: 10
1709
+ }
1710
+ },
1711
+ secretSchema: {
1712
+ schema: {
1713
+ type: "object",
1714
+ properties: {
1715
+ apiKey: {
1716
+ type: "string",
1717
+ description: "Granola API key used as a Bearer token for Enterprise API requests (transport=api)."
1718
+ },
1719
+ mcpAccessToken: {
1720
+ type: "string",
1721
+ description: "Optional bearer token for MCP proxy/gateway auth (transport=mcp)."
1722
+ }
1723
+ }
1724
+ },
1725
+ example: {
1726
+ mcpAccessToken: "granola-mcp-***"
1727
+ }
1728
+ },
1729
+ healthCheck: {
1730
+ method: "list",
1731
+ timeoutMs: 8000
1732
+ },
1733
+ docsUrl: "https://docs.granola.ai/help-center/sharing/integrations/mcp",
1734
+ byokSetup: {
1735
+ setupInstructions: "Use Granola MCP for browser OAuth access, or configure an Enterprise API key for REST transport."
1736
+ }
1737
+ });
1738
+ function registerGranolaIntegration(registry) {
1739
+ return registry.register(granolaIntegrationSpec);
1740
+ }
1741
+
1742
+ // src/integrations/providers/tldv.ts
1743
+ import { StabilityEnum as StabilityEnum21 } from "@contractspec/lib.contracts-spec/ownership";
1744
+ var tldvIntegrationSpec = defineIntegration({
1745
+ meta: {
1746
+ key: "meeting-recorder.tldv",
1747
+ version: "1.0.0",
1748
+ category: "meeting-recorder",
1749
+ title: "tl;dv Meeting Recorder",
1750
+ description: "tl;dv Public API for meeting recordings, transcripts, and webhook events.",
1751
+ domain: "productivity",
1752
+ owners: ["platform.integrations"],
1753
+ tags: ["meeting-recorder", "tldv", "transcripts"],
1754
+ stability: StabilityEnum21.Experimental
1755
+ },
1756
+ supportedModes: ["byok"],
1757
+ capabilities: {
1758
+ provides: [
1759
+ { key: "meeting-recorder.meetings.read", version: "1.0.0" },
1760
+ { key: "meeting-recorder.transcripts.read", version: "1.0.0" },
1761
+ { key: "meeting-recorder.webhooks", version: "1.0.0" }
1762
+ ]
1763
+ },
1764
+ configSchema: {
1765
+ schema: {
1766
+ type: "object",
1767
+ properties: {
1768
+ baseUrl: {
1769
+ type: "string",
1770
+ description: "Optional override for the tl;dv API base URL. Defaults to https://pasta.tldv.io/v1alpha1."
1771
+ },
1772
+ webhookUrl: {
1773
+ type: "string",
1774
+ description: "Webhook destination URL configured in tl;dv settings (MeetingReady/TranscriptReady)."
1775
+ },
1776
+ webhookEvents: {
1777
+ type: "array",
1778
+ items: { type: "string" },
1779
+ description: "Webhook triggers to enable (MeetingReady, TranscriptReady)."
1780
+ },
1781
+ webhookScope: {
1782
+ type: "string",
1783
+ description: "Webhook scope to configure (user, team, or organization)."
1784
+ }
1785
+ }
1786
+ },
1787
+ example: {
1788
+ baseUrl: "https://pasta.tldv.io/v1alpha1",
1789
+ webhookUrl: "https://example.com/webhooks/tldv",
1790
+ webhookEvents: ["MeetingReady", "TranscriptReady"],
1791
+ webhookScope: "team"
1792
+ }
1793
+ },
1794
+ secretSchema: {
1795
+ schema: {
1796
+ type: "object",
1797
+ required: ["apiKey"],
1798
+ properties: {
1799
+ apiKey: {
1800
+ type: "string",
1801
+ description: "tl;dv API key used in the x-api-key header for API requests."
1802
+ },
1803
+ webhookSecret: {
1804
+ type: "string",
1805
+ description: "Optional shared secret for webhook verification if configured in your environment."
1806
+ }
1807
+ }
1808
+ },
1809
+ example: {
1810
+ apiKey: "tldv-***",
1811
+ webhookSecret: "tldv-webhook-secret"
1812
+ }
1813
+ },
1814
+ healthCheck: {
1815
+ method: "ping",
1816
+ timeoutMs: 6000
1817
+ },
1818
+ docsUrl: "https://doc.tldv.io/index.html",
1819
+ byokSetup: {
1820
+ setupInstructions: "Generate a tl;dv API key and optionally configure MeetingReady/TranscriptReady webhooks."
1821
+ }
1822
+ });
1823
+ function registerTldvIntegration(registry) {
1824
+ return registry.register(tldvIntegrationSpec);
1825
+ }
1826
+
1827
+ // src/integrations/providers/fireflies.ts
1828
+ import { StabilityEnum as StabilityEnum22 } from "@contractspec/lib.contracts-spec/ownership";
1829
+ var firefliesIntegrationSpec = defineIntegration({
1830
+ meta: {
1831
+ key: "meeting-recorder.fireflies",
1832
+ version: "1.0.0",
1833
+ category: "meeting-recorder",
1834
+ title: "Fireflies.ai Meeting Recorder",
1835
+ description: "Fireflies GraphQL API for meeting transcripts, metadata, and webhook events.",
1836
+ domain: "productivity",
1837
+ owners: ["platform.integrations"],
1838
+ tags: ["meeting-recorder", "fireflies", "transcripts"],
1839
+ stability: StabilityEnum22.Experimental
1840
+ },
1841
+ supportedModes: ["byok"],
1842
+ capabilities: {
1843
+ provides: [
1844
+ { key: "meeting-recorder.meetings.read", version: "1.0.0" },
1845
+ { key: "meeting-recorder.transcripts.read", version: "1.0.0" },
1846
+ { key: "meeting-recorder.webhooks", version: "1.0.0" }
1847
+ ]
1848
+ },
1849
+ configSchema: {
1850
+ schema: {
1851
+ type: "object",
1852
+ properties: {
1853
+ baseUrl: {
1854
+ type: "string",
1855
+ description: "Optional override for the Fireflies GraphQL endpoint. Defaults to https://api.fireflies.ai/graphql."
1856
+ },
1857
+ webhookUrl: {
1858
+ type: "string",
1859
+ description: "Webhook destination URL configured in Fireflies developer settings."
1860
+ },
1861
+ webhookEvents: {
1862
+ type: "array",
1863
+ items: { type: "string" },
1864
+ description: "Webhook events to subscribe to (e.g., Transcription completed)."
1865
+ },
1866
+ transcriptsPageSize: {
1867
+ type: "number",
1868
+ description: "Number of transcripts to request per GraphQL query."
1869
+ }
1870
+ }
1871
+ },
1872
+ example: {
1873
+ baseUrl: "https://api.fireflies.ai/graphql",
1874
+ webhookUrl: "https://example.com/webhooks/fireflies",
1875
+ webhookEvents: ["Transcription completed"],
1876
+ transcriptsPageSize: 25
1877
+ }
1878
+ },
1879
+ secretSchema: {
1880
+ schema: {
1881
+ type: "object",
1882
+ required: ["apiKey"],
1883
+ properties: {
1884
+ apiKey: {
1885
+ type: "string",
1886
+ description: "Fireflies API key for GraphQL requests."
1887
+ },
1888
+ webhookSecret: {
1889
+ type: "string",
1890
+ description: "Optional webhook secret used to verify x-hub-signature HMAC payloads."
1891
+ }
1892
+ }
1893
+ },
1894
+ example: {
1895
+ apiKey: "fireflies-***",
1896
+ webhookSecret: "fireflies-webhook-secret"
1897
+ }
1898
+ },
1899
+ healthCheck: {
1900
+ method: "custom",
1901
+ timeoutMs: 6000
1902
+ },
1903
+ docsUrl: "https://docs.fireflies.ai/getting-started/introduction",
1904
+ byokSetup: {
1905
+ setupInstructions: "Create a Fireflies API key and optionally configure webhook settings in Developer Settings."
1906
+ }
1907
+ });
1908
+ function registerFirefliesIntegration(registry) {
1909
+ return registry.register(firefliesIntegrationSpec);
1910
+ }
1911
+
1912
+ // src/integrations/providers/fathom.ts
1913
+ import { StabilityEnum as StabilityEnum23 } from "@contractspec/lib.contracts-spec/ownership";
1914
+ var fathomIntegrationSpec = defineIntegration({
1915
+ meta: {
1916
+ key: "meeting-recorder.fathom",
1917
+ version: "1.0.0",
1918
+ category: "meeting-recorder",
1919
+ title: "Fathom Meeting Recorder",
1920
+ description: "Fathom External API for meetings, transcripts, and webhook events.",
1921
+ domain: "productivity",
1922
+ owners: ["platform.integrations"],
1923
+ tags: ["meeting-recorder", "fathom", "transcripts"],
1924
+ stability: StabilityEnum23.Experimental
1925
+ },
1926
+ supportedModes: ["byok"],
1927
+ capabilities: {
1928
+ provides: [
1929
+ { key: "meeting-recorder.meetings.read", version: "1.0.0" },
1930
+ { key: "meeting-recorder.transcripts.read", version: "1.0.0" },
1931
+ { key: "meeting-recorder.webhooks", version: "1.0.0" }
1932
+ ]
1933
+ },
1934
+ configSchema: {
1935
+ schema: {
1936
+ type: "object",
1937
+ properties: {
1938
+ baseUrl: {
1939
+ type: "string",
1940
+ description: "Optional override for the Fathom API base URL. Defaults to https://api.fathom.ai/external/v1."
1941
+ },
1942
+ webhookUrl: {
1943
+ type: "string",
1944
+ description: "Webhook destination URL used when registering Fathom webhooks."
1945
+ },
1946
+ includeTranscript: {
1947
+ type: "boolean",
1948
+ description: "Include transcript data in Fathom webhook payloads."
1949
+ },
1950
+ includeSummary: {
1951
+ type: "boolean",
1952
+ description: "Include summary data in Fathom webhook payloads."
1953
+ },
1954
+ includeActionItems: {
1955
+ type: "boolean",
1956
+ description: "Include action items in Fathom webhook payloads."
1957
+ },
1958
+ includeCrmMatches: {
1959
+ type: "boolean",
1960
+ description: "Include CRM matches in Fathom webhook payloads."
1961
+ },
1962
+ triggeredFor: {
1963
+ type: "array",
1964
+ items: { type: "string" },
1965
+ description: "Recording scopes to trigger webhooks for (e.g., my_recordings)."
1966
+ }
1967
+ }
1968
+ },
1969
+ example: {
1970
+ baseUrl: "https://api.fathom.ai/external/v1",
1971
+ webhookUrl: "https://example.com/webhooks/fathom",
1972
+ includeTranscript: true,
1973
+ includeSummary: true,
1974
+ includeActionItems: false,
1975
+ includeCrmMatches: false,
1976
+ triggeredFor: ["my_recordings"]
1977
+ }
1978
+ },
1979
+ secretSchema: {
1980
+ schema: {
1981
+ type: "object",
1982
+ required: ["apiKey"],
1983
+ properties: {
1984
+ apiKey: {
1985
+ type: "string",
1986
+ description: "Fathom API key used in the X-Api-Key header."
1987
+ },
1988
+ webhookSecret: {
1989
+ type: "string",
1990
+ description: "Optional webhook secret used to verify Fathom webhook signatures."
1991
+ }
1992
+ }
1993
+ },
1994
+ example: {
1995
+ apiKey: "fathom-***",
1996
+ webhookSecret: "whsec_***"
1997
+ }
1998
+ },
1999
+ healthCheck: {
2000
+ method: "list",
2001
+ timeoutMs: 8000
2002
+ },
2003
+ docsUrl: "https://developers.fathom.ai/",
2004
+ constraints: {
2005
+ rateLimit: {
2006
+ rpm: 60
2007
+ }
2008
+ },
2009
+ byokSetup: {
2010
+ setupInstructions: "Generate an API key in Fathom settings and optionally configure webhooks for meeting content readiness."
2011
+ }
2012
+ });
2013
+ function registerFathomIntegration(registry) {
2014
+ return registry.register(fathomIntegrationSpec);
2015
+ }
2016
+ // src/integrations/providers/registry.ts
2017
+ function createDefaultIntegrationSpecRegistry() {
2018
+ const registry = new IntegrationSpecRegistry;
2019
+ registerStripeIntegration(registry);
2020
+ registerPostmarkIntegration(registry);
2021
+ registerQdrantIntegration(registry);
2022
+ registerSupabaseVectorIntegration(registry);
2023
+ registerSupabasePostgresIntegration(registry);
2024
+ registerMistralIntegration(registry);
2025
+ registerElevenLabsIntegration(registry);
2026
+ registerGradiumIntegration(registry);
2027
+ registerFalIntegration(registry);
2028
+ registerGmailIntegration(registry);
2029
+ registerGoogleCalendarIntegration(registry);
2030
+ registerPosthogIntegration(registry);
2031
+ registerTwilioSmsIntegration(registry);
2032
+ registerGcsStorageIntegration(registry);
2033
+ registerPowensIntegration(registry);
2034
+ registerLinearIntegration(registry);
2035
+ registerJiraIntegration(registry);
2036
+ registerNotionIntegration(registry);
2037
+ registerGranolaIntegration(registry);
2038
+ registerTldvIntegration(registry);
2039
+ registerFirefliesIntegration(registry);
2040
+ registerFathomIntegration(registry);
2041
+ return registry;
2042
+ }
2043
+ // src/integrations/openbanking/models.ts
2044
+ import { ScalarTypeEnum, SchemaModel } from "@contractspec/lib.schema";
2045
+ var BankAccountRecord = new SchemaModel({
2046
+ name: "BankAccountRecord",
2047
+ description: "Canonical representation of a bank account synced from an open banking provider.",
2048
+ fields: {
2049
+ id: { type: ScalarTypeEnum.ID(), isOptional: false },
2050
+ tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },
2051
+ userId: { type: ScalarTypeEnum.ID(), isOptional: false },
2052
+ connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },
2053
+ externalId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2054
+ institutionId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2055
+ institutionName: {
2056
+ type: ScalarTypeEnum.NonEmptyString(),
2057
+ isOptional: false
2058
+ },
2059
+ institutionLogoUrl: { type: ScalarTypeEnum.URL(), isOptional: true },
2060
+ iban: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
2061
+ bic: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
2062
+ accountType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2063
+ currency: { type: ScalarTypeEnum.Currency(), isOptional: false },
2064
+ displayName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2065
+ accountNumberMasked: {
2066
+ type: ScalarTypeEnum.String_unsecure(),
2067
+ isOptional: true
2068
+ },
2069
+ productCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
2070
+ balance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },
2071
+ availableBalance: {
2072
+ type: ScalarTypeEnum.Float_unsecure(),
2073
+ isOptional: true
2074
+ },
2075
+ lastSyncedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2076
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2077
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2078
+ metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
2079
+ }
2080
+ });
2081
+ var BankTransactionRecord = new SchemaModel({
2082
+ name: "BankTransactionRecord",
2083
+ description: "Canonical transaction entry mapped from Powens into the open banking ledger.",
2084
+ fields: {
2085
+ id: { type: ScalarTypeEnum.ID(), isOptional: false },
2086
+ accountId: { type: ScalarTypeEnum.ID(), isOptional: false },
2087
+ tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },
2088
+ connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },
2089
+ externalId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2090
+ amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },
2091
+ currency: { type: ScalarTypeEnum.Currency(), isOptional: false },
2092
+ date: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2093
+ bookingDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
2094
+ valueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },
2095
+ description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
2096
+ counterpartyName: {
2097
+ type: ScalarTypeEnum.String_unsecure(),
2098
+ isOptional: true
2099
+ },
2100
+ counterpartyAccount: {
2101
+ type: ScalarTypeEnum.String_unsecure(),
2102
+ isOptional: true
2103
+ },
2104
+ merchantCategoryCode: {
2105
+ type: ScalarTypeEnum.String_unsecure(),
2106
+ isOptional: true
2107
+ },
2108
+ rawCategory: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
2109
+ standardizedCategory: {
2110
+ type: ScalarTypeEnum.String_unsecure(),
2111
+ isOptional: true
2112
+ },
2113
+ transactionType: {
2114
+ type: ScalarTypeEnum.NonEmptyString(),
2115
+ isOptional: false
2116
+ },
2117
+ status: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2118
+ runningBalance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },
2119
+ metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },
2120
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2121
+ updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
2122
+ }
2123
+ });
2124
+ var AccountBalanceRecord = new SchemaModel({
2125
+ name: "AccountBalanceRecord",
2126
+ description: "Canonical balance snapshot computed from Powens balance payloads.",
2127
+ fields: {
2128
+ id: { type: ScalarTypeEnum.ID(), isOptional: false },
2129
+ accountId: { type: ScalarTypeEnum.ID(), isOptional: false },
2130
+ tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },
2131
+ connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },
2132
+ balanceType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
2133
+ currentBalance: {
2134
+ type: ScalarTypeEnum.Float_unsecure(),
2135
+ isOptional: false
2136
+ },
2137
+ availableBalance: {
2138
+ type: ScalarTypeEnum.Float_unsecure(),
2139
+ isOptional: true
2140
+ },
2141
+ currency: { type: ScalarTypeEnum.Currency(), isOptional: false },
2142
+ lastUpdatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2143
+ createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
2144
+ metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true }
2145
+ }
2146
+ });
2147
+
2148
+ // src/integrations/openbanking/telemetry.ts
2149
+ var OPENBANKING_PII_FIELDS = [
2150
+ "iban",
2151
+ "bic",
2152
+ "accountNumberMasked",
2153
+ "accountNumber",
2154
+ "counterpartyName",
2155
+ "counterpartyAccount",
2156
+ "description",
2157
+ "merchantName",
2158
+ "merchantCategoryCode",
2159
+ "reference"
2160
+ ];
2161
+ var OPENBANKING_TELEMETRY_EVENTS = {
2162
+ accountsSynced: "openbanking.accounts.synced",
2163
+ accountsSyncFailed: "openbanking.accounts.sync_failed",
2164
+ transactionsSynced: "openbanking.transactions.synced",
2165
+ transactionsSyncFailed: "openbanking.transactions.sync_failed",
2166
+ balancesRefreshed: "openbanking.balances.refreshed",
2167
+ balancesRefreshFailed: "openbanking.balances.refresh_failed",
2168
+ overviewGenerated: "openbanking.overview.generated"
2169
+ };
2170
+ function redactOpenBankingTelemetryPayload(payload) {
2171
+ const redacted = {};
2172
+ for (const [key, value] of Object.entries(payload)) {
2173
+ if (OPENBANKING_PII_FIELDS.includes(key)) {
2174
+ redacted[key] = maskValue(value);
2175
+ } else if (Array.isArray(value)) {
2176
+ redacted[key] = value.map((item) => typeof item === "object" && item !== null ? redactOpenBankingTelemetryPayload(item) : item);
2177
+ } else if (typeof value === "object" && value !== null) {
2178
+ redacted[key] = redactOpenBankingTelemetryPayload(value);
2179
+ } else {
2180
+ redacted[key] = value;
2181
+ }
2182
+ }
2183
+ return redacted;
2184
+ }
2185
+ function maskValue(value) {
2186
+ if (value == null)
2187
+ return "";
2188
+ const str = String(value);
2189
+ if (str.length <= 4)
2190
+ return "*".repeat(str.length);
2191
+ return `${"*".repeat(Math.max(str.length - 4, 0))}${str.slice(-4)}`;
2192
+ }
2193
+
2194
+ // src/integrations/openbanking/contracts/accounts.ts
2195
+ import { ScalarTypeEnum as ScalarTypeEnum2, SchemaModel as SchemaModel2 } from "@contractspec/lib.schema";
2196
+ import {
2197
+ defineCommand,
2198
+ defineQuery
2199
+ } from "@contractspec/lib.contracts-spec/operations";
2200
+ var OpenBankingListAccountsInput = new SchemaModel2({
2201
+ name: "OpenBankingListAccountsInput",
2202
+ description: "Parameters for listing bank accounts through the open banking provider.",
2203
+ fields: {
2204
+ tenantId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2205
+ userId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2206
+ connectionId: { type: ScalarTypeEnum2.ID(), isOptional: true },
2207
+ includeBalances: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
2208
+ institutionId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
2209
+ cursor: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
2210
+ pageSize: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true }
2211
+ }
2212
+ });
2213
+ var OpenBankingListAccountsOutput = new SchemaModel2({
2214
+ name: "OpenBankingListAccountsOutput",
2215
+ description: "Paginated list of bank accounts available to the tenant and user.",
2216
+ fields: {
2217
+ accounts: {
2218
+ type: BankAccountRecord,
2219
+ isOptional: false,
2220
+ isArray: true
2221
+ },
2222
+ nextCursor: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
2223
+ hasMore: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
2224
+ }
2225
+ });
2226
+ var OpenBankingGetAccountInput = new SchemaModel2({
2227
+ name: "OpenBankingGetAccountInput",
2228
+ description: "Parameters for retrieving a specific bank account.",
2229
+ fields: {
2230
+ tenantId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2231
+ accountId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2232
+ includeBalances: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
2233
+ includeLatestTransactions: {
2234
+ type: ScalarTypeEnum2.Boolean(),
2235
+ isOptional: true
2236
+ }
2237
+ }
2238
+ });
2239
+ var OpenBankingSyncAccountsInput = new SchemaModel2({
2240
+ name: "OpenBankingSyncAccountsInput",
2241
+ description: "Command payload to trigger an account synchronisation against the open banking provider.",
2242
+ fields: {
2243
+ tenantId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2244
+ userId: { type: ScalarTypeEnum2.ID(), isOptional: true },
2245
+ connectionId: { type: ScalarTypeEnum2.ID(), isOptional: false },
2246
+ accountIds: {
2247
+ type: ScalarTypeEnum2.ID(),
2248
+ isArray: true,
2249
+ isOptional: true
2250
+ },
2251
+ forceFullRefresh: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
2252
+ triggerWorkflows: { type: ScalarTypeEnum2.Boolean(), isOptional: true }
2253
+ }
2254
+ });
2255
+ var OpenBankingSyncAccountsOutput = new SchemaModel2({
2256
+ name: "OpenBankingSyncAccountsOutput",
2257
+ description: "Result of a bank account synchronisation run.",
2258
+ fields: {
2259
+ synced: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
2260
+ failed: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
2261
+ errors: {
2262
+ type: ScalarTypeEnum2.String_unsecure(),
2263
+ isArray: true,
2264
+ isOptional: true
2265
+ },
2266
+ nextSyncSuggestedAt: {
2267
+ type: ScalarTypeEnum2.DateTime(),
2268
+ isOptional: true
2269
+ }
2270
+ }
2271
+ });
2272
+ var OpenBankingListAccounts = defineQuery({
2273
+ meta: {
2274
+ key: "openbanking.accounts.list",
2275
+ version: "1.0.0",
2276
+ description: "List bank accounts available to a tenant/user via Powens Open Banking.",
2277
+ goal: "Provide downstream workflows with the set of accounts accessible via the configured open banking connection.",
2278
+ context: "Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.",
2279
+ owners: ["@platform.finance"],
2280
+ tags: ["open-banking", "powens", "accounts"],
2281
+ stability: "experimental"
2282
+ },
2283
+ io: {
2284
+ input: OpenBankingListAccountsInput,
2285
+ output: OpenBankingListAccountsOutput
2286
+ },
2287
+ policy: {
2288
+ auth: "user"
2289
+ }
2290
+ });
2291
+ var OpenBankingGetAccount = defineQuery({
2292
+ meta: {
2293
+ key: "openbanking.accounts.get",
2294
+ version: "1.0.0",
2295
+ description: "Retrieve the canonical bank account record for the given account identifier.",
2296
+ goal: "Allow user-facing experiences and automations to display up-to-date account metadata.",
2297
+ context: "Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.",
2298
+ owners: ["@platform.finance"],
2299
+ tags: ["open-banking", "powens", "accounts"],
2300
+ stability: "experimental"
2301
+ },
2302
+ io: {
2303
+ input: OpenBankingGetAccountInput,
2304
+ output: BankAccountRecord
2305
+ },
2306
+ policy: {
2307
+ auth: "user"
2308
+ }
2309
+ });
2310
+ var OpenBankingSyncAccounts = defineCommand({
2311
+ meta: {
2312
+ key: "openbanking.accounts.sync",
2313
+ version: "1.0.0",
2314
+ description: "Initiate a synchronisation run to refresh bank account metadata from Powens.",
2315
+ goal: "Keep canonical bank account records aligned with the external open banking provider.",
2316
+ context: "Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.",
2317
+ owners: ["@platform.finance"],
2318
+ tags: ["open-banking", "powens", "accounts"],
2319
+ stability: "experimental"
2320
+ },
2321
+ io: {
2322
+ input: OpenBankingSyncAccountsInput,
2323
+ output: OpenBankingSyncAccountsOutput
2324
+ },
2325
+ policy: {
2326
+ auth: "admin"
2327
+ },
2328
+ telemetry: {
2329
+ success: {
2330
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.accountsSynced },
2331
+ properties: ({ input, output }) => {
2332
+ const payload = input;
2333
+ const result = output;
2334
+ return {
2335
+ tenantId: payload?.tenantId,
2336
+ connectionId: payload?.connectionId,
2337
+ synced: result?.synced,
2338
+ failed: result?.failed
2339
+ };
2340
+ }
2341
+ },
2342
+ failure: {
2343
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.accountsSyncFailed },
2344
+ properties: ({ input, error }) => {
2345
+ const payload = input;
2346
+ return {
2347
+ tenantId: payload?.tenantId,
2348
+ connectionId: payload?.connectionId,
2349
+ error: error instanceof Error ? error.message : String(error ?? "unknown")
2350
+ };
2351
+ }
2352
+ }
2353
+ }
2354
+ });
2355
+ var openBankingAccountContracts = {
2356
+ OpenBankingListAccounts,
2357
+ OpenBankingGetAccount,
2358
+ OpenBankingSyncAccounts
2359
+ };
2360
+ function registerOpenBankingAccountContracts(registry2) {
2361
+ return registry2.register(OpenBankingListAccounts).register(OpenBankingGetAccount).register(OpenBankingSyncAccounts);
2362
+ }
2363
+
2364
+ // src/integrations/openbanking/contracts/transactions.ts
2365
+ import { ScalarTypeEnum as ScalarTypeEnum3, SchemaModel as SchemaModel3 } from "@contractspec/lib.schema";
2366
+ import {
2367
+ defineCommand as defineCommand2,
2368
+ defineQuery as defineQuery2
2369
+ } from "@contractspec/lib.contracts-spec/operations";
2370
+ var OpenBankingListTransactionsInput = new SchemaModel3({
2371
+ name: "OpenBankingListTransactionsInput",
2372
+ description: "Parameters for listing bank transactions from the canonical ledger.",
2373
+ fields: {
2374
+ tenantId: { type: ScalarTypeEnum3.ID(), isOptional: false },
2375
+ accountId: { type: ScalarTypeEnum3.ID(), isOptional: false },
2376
+ from: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2377
+ to: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2378
+ cursor: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
2379
+ pageSize: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: true },
2380
+ direction: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
2381
+ minimumAmount: { type: ScalarTypeEnum3.Float_unsecure(), isOptional: true },
2382
+ maximumAmount: { type: ScalarTypeEnum3.Float_unsecure(), isOptional: true },
2383
+ category: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true }
2384
+ }
2385
+ });
2386
+ var OpenBankingListTransactionsOutput = new SchemaModel3({
2387
+ name: "OpenBankingListTransactionsOutput",
2388
+ description: "Paginated list of transactions for a bank account.",
2389
+ fields: {
2390
+ transactions: {
2391
+ type: BankTransactionRecord,
2392
+ isOptional: false,
2393
+ isArray: true
2394
+ },
2395
+ nextCursor: { type: ScalarTypeEnum3.String_unsecure(), isOptional: true },
2396
+ hasMore: { type: ScalarTypeEnum3.Boolean(), isOptional: true }
2397
+ }
2398
+ });
2399
+ var OpenBankingSyncTransactionsInput = new SchemaModel3({
2400
+ name: "OpenBankingSyncTransactionsInput",
2401
+ description: "Command payload to synchronise transactions from the open banking provider into the canonical ledger.",
2402
+ fields: {
2403
+ tenantId: { type: ScalarTypeEnum3.ID(), isOptional: false },
2404
+ accountId: { type: ScalarTypeEnum3.ID(), isOptional: false },
2405
+ from: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2406
+ to: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2407
+ connectionId: { type: ScalarTypeEnum3.ID(), isOptional: true },
2408
+ includePending: { type: ScalarTypeEnum3.Boolean(), isOptional: true },
2409
+ backfillDays: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: true }
2410
+ }
2411
+ });
2412
+ var OpenBankingSyncTransactionsOutput = new SchemaModel3({
2413
+ name: "OpenBankingSyncTransactionsOutput",
2414
+ description: "Result of a transaction synchronisation run.",
2415
+ fields: {
2416
+ synced: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
2417
+ failed: { type: ScalarTypeEnum3.Int_unsecure(), isOptional: false },
2418
+ earliestSyncedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2419
+ latestSyncedAt: { type: ScalarTypeEnum3.DateTime(), isOptional: true },
2420
+ nextSinceToken: {
2421
+ type: ScalarTypeEnum3.String_unsecure(),
2422
+ isOptional: true
2423
+ },
2424
+ errors: {
2425
+ type: ScalarTypeEnum3.String_unsecure(),
2426
+ isArray: true,
2427
+ isOptional: true
2428
+ }
2429
+ }
2430
+ });
2431
+ var OpenBankingListTransactions = defineQuery2({
2432
+ meta: {
2433
+ key: "openbanking.transactions.list",
2434
+ version: "1.0.0",
2435
+ description: "List bank transactions that have been normalised into the canonical ledger.",
2436
+ goal: "Allow downstream analytics and UI surfaces to page through canonical bank transactions.",
2437
+ context: "Used by Pocket Family Office dashboards, reconciliation workflows, and analytics data views.",
2438
+ owners: ["@platform.finance"],
2439
+ tags: ["open-banking", "powens", "transactions"],
2440
+ stability: "experimental"
2441
+ },
2442
+ io: {
2443
+ input: OpenBankingListTransactionsInput,
2444
+ output: OpenBankingListTransactionsOutput
2445
+ },
2446
+ policy: {
2447
+ auth: "user"
2448
+ }
2449
+ });
2450
+ var OpenBankingSyncTransactions = defineCommand2({
2451
+ meta: {
2452
+ key: "openbanking.transactions.sync",
2453
+ version: "1.0.0",
2454
+ description: "Synchronise transactions for a bank account by calling the configured open banking provider.",
2455
+ goal: "Ensure the canonical transaction ledger stays aligned with the external provider.",
2456
+ context: "Triggered by scheduled workflows or on-demand actions when activity is expected on an account.",
2457
+ owners: ["@platform.finance"],
2458
+ tags: ["open-banking", "powens", "transactions"],
2459
+ stability: "experimental"
2460
+ },
2461
+ io: {
2462
+ input: OpenBankingSyncTransactionsInput,
2463
+ output: OpenBankingSyncTransactionsOutput
2464
+ },
2465
+ policy: {
2466
+ auth: "admin"
2467
+ },
2468
+ telemetry: {
2469
+ success: {
2470
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.transactionsSynced },
2471
+ properties: ({ input, output }) => {
2472
+ const payload = input;
2473
+ const result = output;
2474
+ return {
2475
+ tenantId: payload?.tenantId,
2476
+ accountId: payload?.accountId,
2477
+ synced: result?.synced,
2478
+ failed: result?.failed,
2479
+ earliestSyncedAt: result?.earliestSyncedAt,
2480
+ latestSyncedAt: result?.latestSyncedAt
2481
+ };
2482
+ }
2483
+ },
2484
+ failure: {
2485
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.transactionsSyncFailed },
2486
+ properties: ({ input, error }) => {
2487
+ const payload = input;
2488
+ return {
2489
+ tenantId: payload?.tenantId,
2490
+ accountId: payload?.accountId,
2491
+ error: error instanceof Error ? error.message : String(error ?? "unknown")
2492
+ };
2493
+ }
2494
+ }
2495
+ }
2496
+ });
2497
+ var openBankingTransactionContracts = {
2498
+ OpenBankingListTransactions,
2499
+ OpenBankingSyncTransactions
2500
+ };
2501
+ function registerOpenBankingTransactionContracts(registry2) {
2502
+ return registry2.register(OpenBankingListTransactions).register(OpenBankingSyncTransactions);
2503
+ }
2504
+
2505
+ // src/integrations/openbanking/contracts/balances.ts
2506
+ import { ScalarTypeEnum as ScalarTypeEnum4, SchemaModel as SchemaModel4 } from "@contractspec/lib.schema";
2507
+ import {
2508
+ defineCommand as defineCommand3,
2509
+ defineQuery as defineQuery3
2510
+ } from "@contractspec/lib.contracts-spec/operations";
2511
+ var OpenBankingGetBalancesInput = new SchemaModel4({
2512
+ name: "OpenBankingGetBalancesInput",
2513
+ description: "Parameters for retrieving bank account balances from the canonical ledger.",
2514
+ fields: {
2515
+ tenantId: { type: ScalarTypeEnum4.ID(), isOptional: false },
2516
+ accountId: { type: ScalarTypeEnum4.ID(), isOptional: false },
2517
+ balanceTypes: {
2518
+ type: ScalarTypeEnum4.String_unsecure(),
2519
+ isArray: true,
2520
+ isOptional: true
2521
+ }
2522
+ }
2523
+ });
2524
+ var OpenBankingGetBalancesOutput = new SchemaModel4({
2525
+ name: "OpenBankingGetBalancesOutput",
2526
+ description: "Canonical balances for a bank account.",
2527
+ fields: {
2528
+ balances: {
2529
+ type: AccountBalanceRecord,
2530
+ isOptional: false,
2531
+ isArray: true
2532
+ },
2533
+ asOf: { type: ScalarTypeEnum4.DateTime(), isOptional: true }
2534
+ }
2535
+ });
2536
+ var OpenBankingRefreshBalancesInput = new SchemaModel4({
2537
+ name: "OpenBankingRefreshBalancesInput",
2538
+ description: "Command payload to refresh balances for a bank account via the open banking provider.",
2539
+ fields: {
2540
+ tenantId: { type: ScalarTypeEnum4.ID(), isOptional: false },
2541
+ accountId: { type: ScalarTypeEnum4.ID(), isOptional: false },
2542
+ connectionId: { type: ScalarTypeEnum4.ID(), isOptional: true },
2543
+ balanceTypes: {
2544
+ type: ScalarTypeEnum4.String_unsecure(),
2545
+ isArray: true,
2546
+ isOptional: true
2547
+ },
2548
+ forceRefresh: { type: ScalarTypeEnum4.Boolean(), isOptional: true }
2549
+ }
2550
+ });
2551
+ var OpenBankingRefreshBalancesOutput = new SchemaModel4({
2552
+ name: "OpenBankingRefreshBalancesOutput",
2553
+ description: "Result of a balance refresh against the open banking provider.",
2554
+ fields: {
2555
+ balances: {
2556
+ type: AccountBalanceRecord,
2557
+ isOptional: false,
2558
+ isArray: true
2559
+ },
2560
+ refreshedAt: { type: ScalarTypeEnum4.DateTime(), isOptional: false },
2561
+ errors: {
2562
+ type: ScalarTypeEnum4.String_unsecure(),
2563
+ isArray: true,
2564
+ isOptional: true
2565
+ }
2566
+ }
2567
+ });
2568
+ var OpenBankingGetBalances = defineQuery3({
2569
+ meta: {
2570
+ key: "openbanking.balances.get",
2571
+ version: "1.0.0",
2572
+ description: "Retrieve the latest cached balances for a bank account.",
2573
+ goal: "Expose current and available balances required by dashboards and analytics.",
2574
+ context: "Used by Pocket Family Office UI surfaces and automation steps that require balance totals prior to generating summaries.",
2575
+ owners: ["@platform.finance"],
2576
+ tags: ["open-banking", "powens", "balances"],
2577
+ stability: "experimental"
2578
+ },
2579
+ io: {
2580
+ input: OpenBankingGetBalancesInput,
2581
+ output: OpenBankingGetBalancesOutput
2582
+ },
2583
+ policy: {
2584
+ auth: "user"
2585
+ }
2586
+ });
2587
+ var OpenBankingRefreshBalances = defineCommand3({
2588
+ meta: {
2589
+ key: "openbanking.balances.refresh",
2590
+ version: "1.0.0",
2591
+ description: "Refresh balances for a bank account via the configured open banking provider.",
2592
+ goal: "Ensure canonical balance records reflect the latest values from Powens.",
2593
+ context: "Triggered by scheduled workflows before generating summaries or forecasting cashflow.",
2594
+ owners: ["@platform.finance"],
2595
+ tags: ["open-banking", "powens", "balances"],
2596
+ stability: "experimental"
2597
+ },
2598
+ io: {
2599
+ input: OpenBankingRefreshBalancesInput,
2600
+ output: OpenBankingRefreshBalancesOutput
2601
+ },
2602
+ policy: {
2603
+ auth: "admin"
2604
+ },
2605
+ telemetry: {
2606
+ success: {
2607
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.balancesRefreshed },
2608
+ properties: ({ input, output }) => {
2609
+ const payload = input;
2610
+ const result = output;
2611
+ return {
2612
+ tenantId: payload?.tenantId,
2613
+ accountId: payload?.accountId,
2614
+ refreshedAt: result?.refreshedAt,
2615
+ balanceCount: Array.isArray(result?.balances) ? result?.balances.length : undefined
2616
+ };
2617
+ }
2618
+ },
2619
+ failure: {
2620
+ event: { key: OPENBANKING_TELEMETRY_EVENTS.balancesRefreshFailed },
2621
+ properties: ({ input, error }) => {
2622
+ const payload = input;
2623
+ return {
2624
+ tenantId: payload?.tenantId,
2625
+ accountId: payload?.accountId,
2626
+ error: error instanceof Error ? error.message : String(error ?? "unknown")
2627
+ };
2628
+ }
2629
+ }
2630
+ }
2631
+ });
2632
+ var openBankingBalanceContracts = {
2633
+ OpenBankingGetBalances,
2634
+ OpenBankingRefreshBalances
2635
+ };
2636
+ function registerOpenBankingBalanceContracts(registry2) {
2637
+ return registry2.register(OpenBankingGetBalances).register(OpenBankingRefreshBalances);
2638
+ }
2639
+
2640
+ // src/integrations/openbanking/openbanking.feature.ts
2641
+ import { defineFeature } from "@contractspec/lib.contracts-spec/features";
2642
+ var OpenBankingFeature = defineFeature({
2643
+ meta: {
2644
+ key: "openbanking",
2645
+ version: "1.0.0",
2646
+ title: "Open Banking Integration",
2647
+ description: "Open banking account sync, balance refresh, and transaction synchronization",
2648
+ domain: "integrations",
2649
+ owners: ["@platform.finance"],
2650
+ tags: ["open-banking", "powens", "finance", "banking"],
2651
+ stability: "experimental"
2652
+ },
2653
+ operations: [
2654
+ { key: "openbanking.accounts.sync", version: "1.0.0" },
2655
+ { key: "openbanking.accounts.list", version: "1.0.0" },
2656
+ { key: "openbanking.accounts.get", version: "1.0.0" },
2657
+ { key: "openbanking.balances.refresh", version: "1.0.0" },
2658
+ { key: "openbanking.balances.get", version: "1.0.0" },
2659
+ { key: "openbanking.transactions.sync", version: "1.0.0" },
2660
+ { key: "openbanking.transactions.list", version: "1.0.0" }
2661
+ ],
2662
+ events: [],
2663
+ presentations: [],
2664
+ opToPresentation: [],
2665
+ presentationsTargets: [],
2666
+ capabilities: {
2667
+ provides: [{ key: "openbanking", version: "1.0.0" }],
2668
+ requires: [{ key: "identity", version: "1.0.0" }]
2669
+ }
2670
+ });
2671
+ // src/integrations/openbanking/contracts/index.ts
2672
+ function registerOpenBankingContracts(registry2) {
2673
+ return registerOpenBankingBalanceContracts(registerOpenBankingTransactionContracts(registerOpenBankingAccountContracts(registry2)));
2674
+ }
2675
+
2676
+ // src/integrations/openbanking/guards.ts
2677
+ var PRIMARY_SLOT_ID = "primaryOpenBanking";
2678
+ function ensurePrimaryOpenBankingIntegration(config) {
2679
+ const integration = config.integrations.find((item) => item.slot.slotId === PRIMARY_SLOT_ID);
2680
+ if (!integration) {
2681
+ return {
2682
+ ok: false,
2683
+ error: "primaryOpenBanking slot is not bound in the resolved app config."
2684
+ };
2685
+ }
2686
+ const status = integration.connection.status;
2687
+ if (status === "error" || status === "disconnected") {
2688
+ return {
2689
+ ok: false,
2690
+ integration,
2691
+ error: `primaryOpenBanking connection is in status "${status}".`
2692
+ };
2693
+ }
2694
+ if (status === "unknown") {
2695
+ return {
2696
+ ok: false,
2697
+ integration,
2698
+ error: "primaryOpenBanking connection health is unknown."
2699
+ };
2700
+ }
2701
+ return { ok: true, integration };
2702
+ }
2703
+ function assertPrimaryOpenBankingReady(config) {
2704
+ const result = ensurePrimaryOpenBankingIntegration(config);
2705
+ if (!result.ok) {
2706
+ throw new Error(result.error ?? "Open banking integration not available.");
2707
+ }
2708
+ if (!result.integration) {
2709
+ throw new Error(result.error ?? "Open banking integration not available.");
2710
+ }
2711
+ return result.integration;
2712
+ }
2713
+
2714
+ // src/integrations/meeting-recorder/models.ts
2715
+ import { ScalarTypeEnum as ScalarTypeEnum5, SchemaModel as SchemaModel5 } from "@contractspec/lib.schema";
2716
+ var MeetingParticipantRecord = new SchemaModel5({
2717
+ name: "MeetingParticipantRecord",
2718
+ description: "Canonical participant entry for meetings and transcripts from recorder providers.",
2719
+ fields: {
2720
+ id: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2721
+ externalId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2722
+ name: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2723
+ email: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2724
+ role: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2725
+ isExternal: { type: ScalarTypeEnum5.Boolean(), isOptional: true },
2726
+ metadata: { type: ScalarTypeEnum5.JSONObject(), isOptional: true }
2727
+ }
2728
+ });
2729
+ var MeetingTranscriptSegmentRecord = new SchemaModel5({
2730
+ name: "MeetingTranscriptSegmentRecord",
2731
+ description: "A single transcript segment with speaker attribution.",
2732
+ fields: {
2733
+ index: { type: ScalarTypeEnum5.Int_unsecure(), isOptional: true },
2734
+ speakerId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2735
+ speakerName: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2736
+ speakerEmail: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2737
+ text: { type: ScalarTypeEnum5.String_unsecure(), isOptional: false },
2738
+ startTimeMs: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: true },
2739
+ endTimeMs: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: true },
2740
+ startTime: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2741
+ endTime: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2742
+ confidence: { type: ScalarTypeEnum5.Float_unsecure(), isOptional: true },
2743
+ metadata: { type: ScalarTypeEnum5.JSONObject(), isOptional: true }
2744
+ }
2745
+ });
2746
+ var MeetingRecord = new SchemaModel5({
2747
+ name: "MeetingRecord",
2748
+ description: "Canonical meeting metadata synced from meeting recorder providers.",
2749
+ fields: {
2750
+ id: { type: ScalarTypeEnum5.ID(), isOptional: false },
2751
+ tenantId: { type: ScalarTypeEnum5.ID(), isOptional: false },
2752
+ connectionId: { type: ScalarTypeEnum5.ID(), isOptional: false },
2753
+ externalId: { type: ScalarTypeEnum5.NonEmptyString(), isOptional: false },
2754
+ title: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2755
+ summary: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2756
+ organizer: { type: MeetingParticipantRecord, isOptional: true },
2757
+ invitees: {
2758
+ type: MeetingParticipantRecord,
2759
+ isArray: true,
2760
+ isOptional: true
2761
+ },
2762
+ participants: {
2763
+ type: MeetingParticipantRecord,
2764
+ isArray: true,
2765
+ isOptional: true
2766
+ },
2767
+ scheduledStartAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2768
+ scheduledEndAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2769
+ recordingStartAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2770
+ recordingEndAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2771
+ durationSeconds: {
2772
+ type: ScalarTypeEnum5.Float_unsecure(),
2773
+ isOptional: true
2774
+ },
2775
+ meetingUrl: { type: ScalarTypeEnum5.URL(), isOptional: true },
2776
+ recordingUrl: { type: ScalarTypeEnum5.URL(), isOptional: true },
2777
+ shareUrl: { type: ScalarTypeEnum5.URL(), isOptional: true },
2778
+ sourcePlatform: {
2779
+ type: ScalarTypeEnum5.String_unsecure(),
2780
+ isOptional: true
2781
+ },
2782
+ language: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2783
+ transcriptAvailable: { type: ScalarTypeEnum5.Boolean(), isOptional: true },
2784
+ createdAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2785
+ updatedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2786
+ metadata: { type: ScalarTypeEnum5.JSONObject(), isOptional: true }
2787
+ }
2788
+ });
2789
+ var MeetingTranscriptRecord = new SchemaModel5({
2790
+ name: "MeetingTranscriptRecord",
2791
+ description: "Canonical transcript payload for a recorded meeting.",
2792
+ fields: {
2793
+ id: { type: ScalarTypeEnum5.ID(), isOptional: false },
2794
+ meetingId: { type: ScalarTypeEnum5.ID(), isOptional: false },
2795
+ tenantId: { type: ScalarTypeEnum5.ID(), isOptional: false },
2796
+ connectionId: { type: ScalarTypeEnum5.ID(), isOptional: false },
2797
+ externalId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2798
+ format: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2799
+ text: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2800
+ segments: {
2801
+ type: MeetingTranscriptSegmentRecord,
2802
+ isArray: true,
2803
+ isOptional: true
2804
+ },
2805
+ language: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2806
+ sourceUrl: { type: ScalarTypeEnum5.URL(), isOptional: true },
2807
+ generatedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2808
+ metadata: { type: ScalarTypeEnum5.JSONObject(), isOptional: true },
2809
+ raw: { type: ScalarTypeEnum5.JSON(), isOptional: true }
2810
+ }
2811
+ });
2812
+ var MeetingRecorderWebhookEventRecord = new SchemaModel5({
2813
+ name: "MeetingRecorderWebhookEventRecord",
2814
+ description: "Normalized webhook event from a meeting recorder provider.",
2815
+ fields: {
2816
+ id: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2817
+ providerKey: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2818
+ eventType: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2819
+ meetingId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2820
+ transcriptId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2821
+ recordingId: { type: ScalarTypeEnum5.String_unsecure(), isOptional: true },
2822
+ receivedAt: { type: ScalarTypeEnum5.DateTime(), isOptional: true },
2823
+ verified: { type: ScalarTypeEnum5.Boolean(), isOptional: true },
2824
+ payload: { type: ScalarTypeEnum5.JSON(), isOptional: true },
2825
+ metadata: { type: ScalarTypeEnum5.JSONObject(), isOptional: true }
2826
+ }
2827
+ });
2828
+
2829
+ // src/integrations/meeting-recorder/contracts/meetings.ts
2830
+ import { ScalarTypeEnum as ScalarTypeEnum6, SchemaModel as SchemaModel6 } from "@contractspec/lib.schema";
2831
+ import {
2832
+ defineQuery as defineQuery4
2833
+ } from "@contractspec/lib.contracts-spec/operations";
2834
+ var MeetingRecorderListMeetingsInput = new SchemaModel6({
2835
+ name: "MeetingRecorderListMeetingsInput",
2836
+ description: "Parameters for listing meetings from a meeting recorder provider.",
2837
+ fields: {
2838
+ tenantId: { type: ScalarTypeEnum6.ID(), isOptional: false },
2839
+ connectionId: { type: ScalarTypeEnum6.ID(), isOptional: true },
2840
+ from: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
2841
+ to: { type: ScalarTypeEnum6.DateTime(), isOptional: true },
2842
+ cursor: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
2843
+ pageSize: { type: ScalarTypeEnum6.Int_unsecure(), isOptional: true },
2844
+ query: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
2845
+ organizerEmail: {
2846
+ type: ScalarTypeEnum6.String_unsecure(),
2847
+ isOptional: true
2848
+ },
2849
+ participantEmail: {
2850
+ type: ScalarTypeEnum6.String_unsecure(),
2851
+ isOptional: true
2852
+ },
2853
+ includeTranscript: { type: ScalarTypeEnum6.Boolean(), isOptional: true },
2854
+ includeSummary: { type: ScalarTypeEnum6.Boolean(), isOptional: true }
2855
+ }
2856
+ });
2857
+ var MeetingRecorderListMeetingsOutput = new SchemaModel6({
2858
+ name: "MeetingRecorderListMeetingsOutput",
2859
+ description: "Paginated list of meetings for a recorder provider.",
2860
+ fields: {
2861
+ meetings: {
2862
+ type: MeetingRecord,
2863
+ isOptional: false,
2864
+ isArray: true
2865
+ },
2866
+ nextCursor: { type: ScalarTypeEnum6.String_unsecure(), isOptional: true },
2867
+ hasMore: { type: ScalarTypeEnum6.Boolean(), isOptional: true }
2868
+ }
2869
+ });
2870
+ var MeetingRecorderGetMeetingInput = new SchemaModel6({
2871
+ name: "MeetingRecorderGetMeetingInput",
2872
+ description: "Parameters for retrieving a single meeting record.",
2873
+ fields: {
2874
+ tenantId: { type: ScalarTypeEnum6.ID(), isOptional: false },
2875
+ meetingId: { type: ScalarTypeEnum6.ID(), isOptional: false },
2876
+ connectionId: { type: ScalarTypeEnum6.ID(), isOptional: true },
2877
+ includeTranscript: { type: ScalarTypeEnum6.Boolean(), isOptional: true },
2878
+ includeSummary: { type: ScalarTypeEnum6.Boolean(), isOptional: true }
2879
+ }
2880
+ });
2881
+ var MeetingRecorderListMeetings = defineQuery4({
2882
+ meta: {
2883
+ key: "meeting-recorder.meetings.list",
2884
+ version: "1.0.0",
2885
+ description: "List meetings recorded by the configured meeting provider.",
2886
+ goal: "Provide downstream workflows with recent meetings and metadata.",
2887
+ context: "Used by integration hubs and sync workflows to enumerate meetings before pulling transcripts.",
2888
+ owners: ["@platform.integrations"],
2889
+ tags: ["meeting-recorder", "meetings", "transcripts"],
2890
+ stability: "experimental"
2891
+ },
2892
+ io: {
2893
+ input: MeetingRecorderListMeetingsInput,
2894
+ output: MeetingRecorderListMeetingsOutput
2895
+ },
2896
+ policy: {
2897
+ auth: "user"
2898
+ }
2899
+ });
2900
+ var MeetingRecorderGetMeeting = defineQuery4({
2901
+ meta: {
2902
+ key: "meeting-recorder.meetings.get",
2903
+ version: "1.0.0",
2904
+ description: "Retrieve metadata for a single meeting recording.",
2905
+ goal: "Allow downstream experiences to display detailed meeting metadata.",
2906
+ context: "Used when drilling into a specific meeting from a transcript or integration dashboard.",
2907
+ owners: ["@platform.integrations"],
2908
+ tags: ["meeting-recorder", "meetings"],
2909
+ stability: "experimental"
2910
+ },
2911
+ io: {
2912
+ input: MeetingRecorderGetMeetingInput,
2913
+ output: MeetingRecord
2914
+ },
2915
+ policy: {
2916
+ auth: "user"
2917
+ }
2918
+ });
2919
+ var meetingRecorderMeetingContracts = {
2920
+ MeetingRecorderListMeetings,
2921
+ MeetingRecorderGetMeeting
2922
+ };
2923
+ function registerMeetingRecorderMeetingContracts(registry2) {
2924
+ return registry2.register(MeetingRecorderListMeetings).register(MeetingRecorderGetMeeting);
2925
+ }
2926
+
2927
+ // src/integrations/meeting-recorder/telemetry.ts
2928
+ var MEETING_RECORDER_PII_FIELDS = [
2929
+ "email",
2930
+ "organizerEmail",
2931
+ "participantEmail",
2932
+ "participants",
2933
+ "invitees",
2934
+ "attendees",
2935
+ "speakerName",
2936
+ "speakerEmail",
2937
+ "name",
2938
+ "phone",
2939
+ "phoneNumber",
2940
+ "displayName"
2941
+ ];
2942
+ var MEETING_RECORDER_TELEMETRY_EVENTS = {
2943
+ meetingsSynced: "meeting-recorder.meetings.synced",
2944
+ meetingsSyncFailed: "meeting-recorder.meetings.sync_failed",
2945
+ transcriptsFetched: "meeting-recorder.transcripts.fetched",
2946
+ transcriptsFetchFailed: "meeting-recorder.transcripts.fetch_failed",
2947
+ transcriptsSynced: "meeting-recorder.transcripts.synced",
2948
+ transcriptsSyncFailed: "meeting-recorder.transcripts.sync_failed",
2949
+ webhookReceived: "meeting-recorder.webhooks.received",
2950
+ webhookRejected: "meeting-recorder.webhooks.rejected"
2951
+ };
2952
+ function redactMeetingRecorderTelemetryPayload(payload) {
2953
+ const redacted = {};
2954
+ for (const [key, value] of Object.entries(payload)) {
2955
+ if (MEETING_RECORDER_PII_FIELDS.includes(key)) {
2956
+ redacted[key] = maskValue2(value);
2957
+ } else if (Array.isArray(value)) {
2958
+ redacted[key] = value.map((item) => typeof item === "object" && item !== null ? redactMeetingRecorderTelemetryPayload(item) : item);
2959
+ } else if (typeof value === "object" && value !== null) {
2960
+ redacted[key] = redactMeetingRecorderTelemetryPayload(value);
2961
+ } else {
2962
+ redacted[key] = value;
2963
+ }
2964
+ }
2965
+ return redacted;
2966
+ }
2967
+ function maskValue2(value) {
2968
+ if (value == null)
2969
+ return "";
2970
+ const str = String(value);
2971
+ if (str.length <= 4)
2972
+ return "*".repeat(str.length);
2973
+ return `${"*".repeat(Math.max(str.length - 4, 0))}${str.slice(-4)}`;
2974
+ }
2975
+
2976
+ // src/integrations/meeting-recorder/contracts/transcripts.ts
2977
+ import { ScalarTypeEnum as ScalarTypeEnum7, SchemaModel as SchemaModel7 } from "@contractspec/lib.schema";
2978
+ import {
2979
+ defineCommand as defineCommand4,
2980
+ defineQuery as defineQuery5
2981
+ } from "@contractspec/lib.contracts-spec/operations";
2982
+ var MeetingRecorderGetTranscriptInput = new SchemaModel7({
2983
+ name: "MeetingRecorderGetTranscriptInput",
2984
+ description: "Parameters for fetching a meeting transcript.",
2985
+ fields: {
2986
+ tenantId: { type: ScalarTypeEnum7.ID(), isOptional: false },
2987
+ meetingId: { type: ScalarTypeEnum7.ID(), isOptional: false },
2988
+ connectionId: { type: ScalarTypeEnum7.ID(), isOptional: true },
2989
+ includeSegments: { type: ScalarTypeEnum7.Boolean(), isOptional: true },
2990
+ format: { type: ScalarTypeEnum7.String_unsecure(), isOptional: true }
2991
+ }
2992
+ });
2993
+ var MeetingRecorderSyncTranscriptInput = new SchemaModel7({
2994
+ name: "MeetingRecorderSyncTranscriptInput",
2995
+ description: "Command payload to synchronise meeting transcripts.",
2996
+ fields: {
2997
+ tenantId: { type: ScalarTypeEnum7.ID(), isOptional: false },
2998
+ meetingId: { type: ScalarTypeEnum7.ID(), isOptional: false },
2999
+ connectionId: { type: ScalarTypeEnum7.ID(), isOptional: true },
3000
+ forceRefresh: { type: ScalarTypeEnum7.Boolean(), isOptional: true },
3001
+ triggerWebhooks: { type: ScalarTypeEnum7.Boolean(), isOptional: true }
3002
+ }
3003
+ });
3004
+ var MeetingRecorderSyncTranscriptOutput = new SchemaModel7({
3005
+ name: "MeetingRecorderSyncTranscriptOutput",
3006
+ description: "Result of a transcript synchronisation run.",
3007
+ fields: {
3008
+ synced: { type: ScalarTypeEnum7.Int_unsecure(), isOptional: false },
3009
+ failed: { type: ScalarTypeEnum7.Int_unsecure(), isOptional: false },
3010
+ errors: {
3011
+ type: ScalarTypeEnum7.String_unsecure(),
3012
+ isArray: true,
3013
+ isOptional: true
3014
+ },
3015
+ nextSyncSuggestedAt: {
3016
+ type: ScalarTypeEnum7.DateTime(),
3017
+ isOptional: true
3018
+ }
3019
+ }
3020
+ });
3021
+ var MeetingRecorderGetTranscript = defineQuery5({
3022
+ meta: {
3023
+ key: "meeting-recorder.transcripts.get",
3024
+ version: "1.0.0",
3025
+ description: "Fetch the transcript for a specific meeting recording.",
3026
+ goal: "Expose meeting transcripts for downstream knowledge and analytics flows.",
3027
+ context: "Used by agents and dashboards to access the transcript for a selected meeting.",
3028
+ owners: ["@platform.integrations"],
3029
+ tags: ["meeting-recorder", "transcripts"],
3030
+ stability: "experimental"
3031
+ },
3032
+ io: {
3033
+ input: MeetingRecorderGetTranscriptInput,
3034
+ output: MeetingTranscriptRecord
3035
+ },
3036
+ policy: {
3037
+ auth: "user"
3038
+ }
3039
+ });
3040
+ var MeetingRecorderSyncTranscript = defineCommand4({
3041
+ meta: {
3042
+ key: "meeting-recorder.transcripts.sync",
3043
+ version: "1.0.0",
3044
+ description: "Trigger a transcript sync from the meeting recorder provider.",
3045
+ goal: "Keep canonical transcripts aligned with external meeting providers.",
3046
+ context: "Invoked by scheduled jobs or webhooks when new transcripts are ready.",
3047
+ owners: ["@platform.integrations"],
3048
+ tags: ["meeting-recorder", "transcripts", "sync"],
3049
+ stability: "experimental"
3050
+ },
3051
+ io: {
3052
+ input: MeetingRecorderSyncTranscriptInput,
3053
+ output: MeetingRecorderSyncTranscriptOutput
3054
+ },
3055
+ policy: {
3056
+ auth: "admin"
3057
+ },
3058
+ telemetry: {
3059
+ success: {
3060
+ event: { key: MEETING_RECORDER_TELEMETRY_EVENTS.transcriptsSynced },
3061
+ properties: ({ input, output }) => {
3062
+ const payload = input;
3063
+ const result = output;
3064
+ return {
3065
+ tenantId: payload?.tenantId,
3066
+ meetingId: payload?.meetingId,
3067
+ synced: result?.synced,
3068
+ failed: result?.failed
3069
+ };
3070
+ }
3071
+ },
3072
+ failure: {
3073
+ event: { key: MEETING_RECORDER_TELEMETRY_EVENTS.transcriptsSyncFailed },
3074
+ properties: ({ input, error }) => {
3075
+ const payload = input;
3076
+ return {
3077
+ tenantId: payload?.tenantId,
3078
+ meetingId: payload?.meetingId,
3079
+ error: error instanceof Error ? error.message : String(error ?? "unknown")
3080
+ };
3081
+ }
3082
+ }
3083
+ }
3084
+ });
3085
+ var meetingRecorderTranscriptContracts = {
3086
+ MeetingRecorderGetTranscript,
3087
+ MeetingRecorderSyncTranscript
3088
+ };
3089
+ function registerMeetingRecorderTranscriptContracts(registry2) {
3090
+ return registry2.register(MeetingRecorderGetTranscript).register(MeetingRecorderSyncTranscript);
3091
+ }
3092
+
3093
+ // src/integrations/meeting-recorder/contracts/webhooks.ts
3094
+ import { ScalarTypeEnum as ScalarTypeEnum8, SchemaModel as SchemaModel8 } from "@contractspec/lib.schema";
3095
+ import {
3096
+ defineCommand as defineCommand5
3097
+ } from "@contractspec/lib.contracts-spec/operations";
3098
+ var MeetingRecorderWebhookIngestInput = new SchemaModel8({
3099
+ name: "MeetingRecorderWebhookIngestInput",
3100
+ description: "Payload for ingesting a meeting recorder webhook event.",
3101
+ fields: {
3102
+ tenantId: { type: ScalarTypeEnum8.ID(), isOptional: false },
3103
+ providerKey: { type: ScalarTypeEnum8.String_unsecure(), isOptional: false },
3104
+ connectionId: { type: ScalarTypeEnum8.ID(), isOptional: true },
3105
+ webhookId: { type: ScalarTypeEnum8.String_unsecure(), isOptional: true },
3106
+ headers: { type: ScalarTypeEnum8.JSON(), isOptional: true },
3107
+ payload: { type: ScalarTypeEnum8.JSON(), isOptional: false },
3108
+ receivedAt: { type: ScalarTypeEnum8.DateTime(), isOptional: true }
3109
+ }
3110
+ });
3111
+ var MeetingRecorderWebhookIngestOutput = new SchemaModel8({
3112
+ name: "MeetingRecorderWebhookIngestOutput",
3113
+ description: "Result of processing a meeting recorder webhook.",
3114
+ fields: {
3115
+ accepted: { type: ScalarTypeEnum8.Boolean(), isOptional: false },
3116
+ event: { type: MeetingRecorderWebhookEventRecord, isOptional: true }
3117
+ }
3118
+ });
3119
+ var MeetingRecorderWebhookIngest = defineCommand5({
3120
+ meta: {
3121
+ key: "meeting-recorder.webhooks.ingest",
3122
+ version: "1.0.0",
3123
+ description: "Ingest a webhook from a meeting recorder provider.",
3124
+ goal: "Trigger transcript syncs or downstream workflows without polling.",
3125
+ context: "Used by webhook handlers to validate and normalize provider webhook events.",
3126
+ owners: ["@platform.integrations"],
3127
+ tags: ["meeting-recorder", "webhooks", "transcripts"],
3128
+ stability: "experimental"
3129
+ },
3130
+ io: {
3131
+ input: MeetingRecorderWebhookIngestInput,
3132
+ output: MeetingRecorderWebhookIngestOutput
3133
+ },
3134
+ policy: {
3135
+ auth: "admin"
3136
+ }
3137
+ });
3138
+ var meetingRecorderWebhookContracts = {
3139
+ MeetingRecorderWebhookIngest
3140
+ };
3141
+ function registerMeetingRecorderWebhookContracts(registry2) {
3142
+ return registry2.register(MeetingRecorderWebhookIngest);
3143
+ }
3144
+
3145
+ // src/integrations/meeting-recorder/meeting-recorder.feature.ts
3146
+ import { defineFeature as defineFeature2 } from "@contractspec/lib.contracts-spec/features";
3147
+ var MeetingRecorderFeature = defineFeature2({
3148
+ meta: {
3149
+ key: "meeting-recorder",
3150
+ version: "1.0.0",
3151
+ title: "Meeting Recorder Integration",
3152
+ description: "Meeting metadata, transcript retrieval, and webhook ingestion for meeting recorder providers.",
3153
+ domain: "integrations",
3154
+ owners: ["@platform.integrations"],
3155
+ tags: ["meeting-recorder", "transcripts", "integrations"],
3156
+ stability: "experimental"
3157
+ },
3158
+ operations: [
3159
+ { key: "meeting-recorder.meetings.list", version: "1.0.0" },
3160
+ { key: "meeting-recorder.meetings.get", version: "1.0.0" },
3161
+ { key: "meeting-recorder.transcripts.get", version: "1.0.0" },
3162
+ { key: "meeting-recorder.transcripts.sync", version: "1.0.0" },
3163
+ { key: "meeting-recorder.webhooks.ingest", version: "1.0.0" }
3164
+ ],
3165
+ events: [],
3166
+ presentations: [],
3167
+ opToPresentation: [],
3168
+ presentationsTargets: [],
3169
+ capabilities: {
3170
+ provides: [{ key: "meeting-recorder", version: "1.0.0" }],
3171
+ requires: [{ key: "identity", version: "1.0.0" }]
3172
+ }
3173
+ });
3174
+ // src/integrations/meeting-recorder/contracts/index.ts
3175
+ function registerMeetingRecorderContracts(registry2) {
3176
+ return registerMeetingRecorderWebhookContracts(registerMeetingRecorderTranscriptContracts(registerMeetingRecorderMeetingContracts(registry2)));
3177
+ }
3178
+ // src/integrations/health.ts
3179
+ class IntegrationHealthService {
3180
+ telemetry;
3181
+ nowFn;
3182
+ constructor(options = {}) {
3183
+ this.telemetry = options.telemetry;
3184
+ this.nowFn = options.now ?? (() => new Date);
3185
+ }
3186
+ async check(context, executor) {
3187
+ const start = this.nowFn();
3188
+ try {
3189
+ await executor(context);
3190
+ const end = this.nowFn();
3191
+ const result = {
3192
+ status: "connected",
3193
+ checkedAt: end,
3194
+ latencyMs: end.getTime() - start.getTime()
3195
+ };
3196
+ this.emitTelemetry(context, result, "success");
3197
+ return result;
3198
+ } catch (error) {
3199
+ const end = this.nowFn();
3200
+ const message = error instanceof Error ? error.message : "Unknown error";
3201
+ const code = extractErrorCode(error);
3202
+ const result = {
3203
+ status: "error",
3204
+ checkedAt: end,
3205
+ latencyMs: end.getTime() - start.getTime(),
3206
+ errorMessage: message,
3207
+ errorCode: code
3208
+ };
3209
+ this.emitTelemetry(context, result, "error", code, message);
3210
+ return result;
3211
+ }
3212
+ }
3213
+ emitTelemetry(context, result, status, errorCode, errorMessage) {
3214
+ if (!this.telemetry)
3215
+ return;
3216
+ this.telemetry.record({
3217
+ tenantId: context.tenantId,
3218
+ appId: context.appId,
3219
+ environment: context.environment,
3220
+ slotId: context.slotId,
3221
+ integrationKey: context.spec.meta.key,
3222
+ integrationVersion: context.spec.meta.version,
3223
+ connectionId: context.connection.meta.id,
3224
+ status,
3225
+ durationMs: result.latencyMs,
3226
+ errorCode,
3227
+ errorMessage,
3228
+ occurredAt: result.checkedAt ?? this.nowFn(),
3229
+ metadata: {
3230
+ ...context.trace ? {
3231
+ blueprint: `${context.trace.blueprintName}.v${context.trace.blueprintVersion}`,
3232
+ configVersion: context.trace.configVersion
3233
+ } : {},
3234
+ status: result.status
3235
+ }
3236
+ });
3237
+ }
3238
+ }
3239
+ function extractErrorCode(error) {
3240
+ if (!error || typeof error !== "object")
3241
+ return;
3242
+ const candidate = error;
3243
+ if (candidate.code == null)
3244
+ return;
3245
+ return String(candidate.code);
3246
+ }
3247
+
3248
+ // src/integrations/integrations.capability.ts
3249
+ import { defineCapability } from "@contractspec/lib.contracts-spec/capabilities";
3250
+ import { StabilityEnum as StabilityEnum24 } from "@contractspec/lib.contracts-spec/ownership";
3251
+ var IntegrationsCapability = defineCapability({
3252
+ meta: {
3253
+ key: "integrations",
3254
+ version: "1.0.0",
3255
+ kind: "integration",
3256
+ stability: StabilityEnum24.Experimental,
3257
+ description: "Core integrations capability for third-party connections",
3258
+ owners: ["@platform.core"],
3259
+ tags: ["integrations", "platform"]
3260
+ }
3261
+ });
3262
+
3263
+ // src/integrations/integrations.feature.ts
3264
+ import { defineFeature as defineFeature3 } from "@contractspec/lib.contracts-spec/features";
3265
+ var IntegrationsFeature = defineFeature3({
3266
+ meta: {
3267
+ key: "platform.integrations",
3268
+ version: "1.0.0",
3269
+ title: "Platform Integrations",
3270
+ description: "Manage integration connections to external providers (e.g., Stripe, Qdrant)",
3271
+ domain: "platform",
3272
+ owners: ["@platform.integrations"],
3273
+ tags: ["integrations", "connections", "platform"],
3274
+ stability: "experimental"
3275
+ },
3276
+ operations: [
3277
+ { key: "integrations.connection.create", version: "1.0.0" },
3278
+ { key: "integrations.connection.update", version: "1.0.0" },
3279
+ { key: "integrations.connection.delete", version: "1.0.0" },
3280
+ { key: "integrations.connection.list", version: "1.0.0" },
3281
+ { key: "integrations.connection.test", version: "1.0.0" }
3282
+ ],
3283
+ events: [],
3284
+ presentations: [],
3285
+ opToPresentation: [],
3286
+ presentationsTargets: [],
3287
+ capabilities: {
3288
+ provides: [{ key: "integrations", version: "1.0.0" }],
3289
+ requires: [{ key: "identity", version: "1.0.0" }]
3290
+ }
3291
+ });
3292
+
3293
+ // src/integrations/operations.ts
3294
+ import { ScalarTypeEnum as ScalarTypeEnum9, SchemaModel as SchemaModel9 } from "@contractspec/lib.schema";
3295
+ import {
3296
+ defineCommand as defineCommand6,
3297
+ defineQuery as defineQuery6
3298
+ } from "@contractspec/lib.contracts-spec/operations";
3299
+ var IntegrationConnectionRecord = new SchemaModel9({
3300
+ name: "IntegrationConnectionRecord",
3301
+ fields: {
3302
+ id: { type: ScalarTypeEnum9.ID(), isOptional: false },
3303
+ tenantId: { type: ScalarTypeEnum9.ID(), isOptional: false },
3304
+ integrationKey: {
3305
+ type: ScalarTypeEnum9.NonEmptyString(),
3306
+ isOptional: false
3307
+ },
3308
+ integrationVersion: {
3309
+ type: ScalarTypeEnum9.Int_unsecure(),
3310
+ isOptional: false
3311
+ },
3312
+ label: { type: ScalarTypeEnum9.String_unsecure(), isOptional: false },
3313
+ ownershipMode: {
3314
+ type: ScalarTypeEnum9.String_unsecure(),
3315
+ isOptional: false
3316
+ },
3317
+ externalAccountId: {
3318
+ type: ScalarTypeEnum9.String_unsecure(),
3319
+ isOptional: true
3320
+ },
3321
+ secretProvider: {
3322
+ type: ScalarTypeEnum9.String_unsecure(),
3323
+ isOptional: false
3324
+ },
3325
+ secretRef: { type: ScalarTypeEnum9.String_unsecure(), isOptional: false },
3326
+ status: { type: ScalarTypeEnum9.String_unsecure(), isOptional: false },
3327
+ environment: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3328
+ healthStatus: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3329
+ healthCheckedAt: { type: ScalarTypeEnum9.DateTime(), isOptional: true },
3330
+ healthLatencyMs: {
3331
+ type: ScalarTypeEnum9.Float_unsecure(),
3332
+ isOptional: true
3333
+ },
3334
+ healthErrorCode: {
3335
+ type: ScalarTypeEnum9.String_unsecure(),
3336
+ isOptional: true
3337
+ },
3338
+ healthErrorMessage: {
3339
+ type: ScalarTypeEnum9.String_unsecure(),
3340
+ isOptional: true
3341
+ },
3342
+ usageRequestCount: {
3343
+ type: ScalarTypeEnum9.Int_unsecure(),
3344
+ isOptional: true
3345
+ },
3346
+ usageSuccessCount: {
3347
+ type: ScalarTypeEnum9.Int_unsecure(),
3348
+ isOptional: true
3349
+ },
3350
+ usageErrorCount: {
3351
+ type: ScalarTypeEnum9.Int_unsecure(),
3352
+ isOptional: true
3353
+ },
3354
+ usageLastUsedAt: {
3355
+ type: ScalarTypeEnum9.DateTime(),
3356
+ isOptional: true
3357
+ },
3358
+ usageLastErrorAt: {
3359
+ type: ScalarTypeEnum9.DateTime(),
3360
+ isOptional: true
3361
+ },
3362
+ usageLastErrorCode: {
3363
+ type: ScalarTypeEnum9.String_unsecure(),
3364
+ isOptional: true
3365
+ },
3366
+ createdAt: { type: ScalarTypeEnum9.DateTime(), isOptional: true },
3367
+ updatedAt: { type: ScalarTypeEnum9.DateTime(), isOptional: true }
3368
+ }
3369
+ });
3370
+ var CreateIntegrationConnectionInput = new SchemaModel9({
3371
+ name: "CreateIntegrationConnectionInput",
3372
+ fields: {
3373
+ tenantId: { type: ScalarTypeEnum9.ID(), isOptional: false },
3374
+ integrationKey: {
3375
+ type: ScalarTypeEnum9.NonEmptyString(),
3376
+ isOptional: false
3377
+ },
3378
+ integrationVersion: {
3379
+ type: ScalarTypeEnum9.Int_unsecure(),
3380
+ isOptional: false
3381
+ },
3382
+ label: { type: ScalarTypeEnum9.String_unsecure(), isOptional: false },
3383
+ ownershipMode: {
3384
+ type: ScalarTypeEnum9.String_unsecure(),
3385
+ isOptional: false
3386
+ },
3387
+ externalAccountId: {
3388
+ type: ScalarTypeEnum9.String_unsecure(),
3389
+ isOptional: true
3390
+ },
3391
+ secretProvider: {
3392
+ type: ScalarTypeEnum9.String_unsecure(),
3393
+ isOptional: false
3394
+ },
3395
+ secretRef: { type: ScalarTypeEnum9.String_unsecure(), isOptional: false },
3396
+ environment: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3397
+ config: { type: ScalarTypeEnum9.JSONObject(), isOptional: false }
3398
+ }
3399
+ });
3400
+ var UpdateIntegrationConnectionInput = new SchemaModel9({
3401
+ name: "UpdateIntegrationConnectionInput",
3402
+ fields: {
3403
+ connectionId: { type: ScalarTypeEnum9.ID(), isOptional: false },
3404
+ label: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3405
+ status: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3406
+ ownershipMode: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3407
+ externalAccountId: {
3408
+ type: ScalarTypeEnum9.String_unsecure(),
3409
+ isOptional: true
3410
+ },
3411
+ secretProvider: {
3412
+ type: ScalarTypeEnum9.String_unsecure(),
3413
+ isOptional: true
3414
+ },
3415
+ secretRef: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3416
+ config: { type: ScalarTypeEnum9.JSONObject(), isOptional: true }
3417
+ }
3418
+ });
3419
+ var DeleteIntegrationConnectionInput = new SchemaModel9({
3420
+ name: "DeleteIntegrationConnectionInput",
3421
+ fields: {
3422
+ connectionId: { type: ScalarTypeEnum9.ID(), isOptional: false }
3423
+ }
3424
+ });
3425
+ var ListIntegrationConnectionsInput = new SchemaModel9({
3426
+ name: "ListIntegrationConnectionsInput",
3427
+ fields: {
3428
+ tenantId: { type: ScalarTypeEnum9.ID(), isOptional: false },
3429
+ category: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3430
+ status: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true }
3431
+ }
3432
+ });
3433
+ var ListIntegrationConnectionsOutput = new SchemaModel9({
3434
+ name: "ListIntegrationConnectionsOutput",
3435
+ fields: {
3436
+ connections: {
3437
+ type: IntegrationConnectionRecord,
3438
+ isOptional: false,
3439
+ isArray: true
3440
+ }
3441
+ }
3442
+ });
3443
+ var TestIntegrationConnectionInput = new SchemaModel9({
3444
+ name: "TestIntegrationConnectionInput",
3445
+ fields: {
3446
+ connectionId: { type: ScalarTypeEnum9.ID(), isOptional: false }
3447
+ }
3448
+ });
3449
+ var TestIntegrationConnectionOutput = new SchemaModel9({
3450
+ name: "TestIntegrationConnectionOutput",
3451
+ fields: {
3452
+ success: { type: ScalarTypeEnum9.Boolean(), isOptional: false },
3453
+ status: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3454
+ latencyMs: { type: ScalarTypeEnum9.Float_unsecure(), isOptional: true },
3455
+ error: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true },
3456
+ errorCode: { type: ScalarTypeEnum9.String_unsecure(), isOptional: true }
3457
+ }
3458
+ });
3459
+ var DeleteIntegrationConnectionOutput = new SchemaModel9({
3460
+ name: "DeleteIntegrationConnectionOutput",
3461
+ fields: {
3462
+ success: { type: ScalarTypeEnum9.Boolean(), isOptional: false }
3463
+ }
3464
+ });
3465
+ var CreateIntegrationConnection = defineCommand6({
3466
+ meta: {
3467
+ key: "integrations.connection.create",
3468
+ title: "Create Integration Connection",
3469
+ version: "1.0.0",
3470
+ description: "Create a new integration connection for a tenant.",
3471
+ goal: "Provision a tenant-scoped connection to an external provider.",
3472
+ context: "Used by Ops or the App Studio to configure external integrations such as Stripe or Qdrant.",
3473
+ owners: ["@platform.integrations"],
3474
+ tags: ["integration", "connections"],
3475
+ stability: "experimental"
3476
+ },
3477
+ io: {
3478
+ input: CreateIntegrationConnectionInput,
3479
+ output: IntegrationConnectionRecord
3480
+ },
3481
+ policy: {
3482
+ auth: "admin",
3483
+ policies: [{ key: "platform.integration.manage", version: "1.0.0" }]
3484
+ }
3485
+ });
3486
+ var UpdateIntegrationConnection = defineCommand6({
3487
+ meta: {
3488
+ key: "integrations.connection.update",
3489
+ title: "Update Integration Connection",
3490
+ version: "1.0.0",
3491
+ description: "Update metadata or credentials for an integration connection.",
3492
+ goal: "Allow secure rotation of credentials and metadata adjustments.",
3493
+ context: "Supports rotating API keys, toggling status, or updating labels for tenant integrations.",
3494
+ owners: ["@platform.integrations"],
3495
+ tags: ["integration", "connections"],
3496
+ stability: "experimental"
3497
+ },
3498
+ io: {
3499
+ input: UpdateIntegrationConnectionInput,
3500
+ output: IntegrationConnectionRecord
3501
+ },
3502
+ policy: {
3503
+ auth: "admin",
3504
+ policies: [{ key: "platform.integration.manage", version: "1.0.0" }]
3505
+ }
3506
+ });
3507
+ var DeleteIntegrationConnection = defineCommand6({
3508
+ meta: {
3509
+ key: "integrations.connection.delete",
3510
+ title: "Delete Integration Connection",
3511
+ version: "1.0.0",
3512
+ description: "Delete an integration connection for a tenant.",
3513
+ goal: "Safely remove credentials and disable connector usage.",
3514
+ context: "Ensures connections are de-provisioned when no longer needed or breached.",
3515
+ owners: ["@platform.integrations"],
3516
+ tags: ["integration", "connections"],
3517
+ stability: "experimental"
3518
+ },
3519
+ io: {
3520
+ input: DeleteIntegrationConnectionInput,
3521
+ output: DeleteIntegrationConnectionOutput
3522
+ },
3523
+ policy: {
3524
+ auth: "admin",
3525
+ policies: [{ key: "platform.integration.manage", version: "1.0.0" }]
3526
+ }
3527
+ });
3528
+ var ListIntegrationConnections = defineQuery6({
3529
+ meta: {
3530
+ key: "integrations.connection.list",
3531
+ title: "List Integration Connections",
3532
+ version: "1.0.0",
3533
+ description: "List integration connections for a tenant.",
3534
+ goal: "Provide visibility into configured integrations and their status.",
3535
+ context: "Used by the App Studio and Ops flows to show bindings and health.",
3536
+ owners: ["@platform.integrations"],
3537
+ tags: ["integration", "connections"],
3538
+ stability: "experimental"
3539
+ },
3540
+ io: {
3541
+ input: ListIntegrationConnectionsInput,
3542
+ output: ListIntegrationConnectionsOutput
3543
+ },
3544
+ policy: {
3545
+ auth: "admin",
3546
+ policies: [{ key: "platform.integration.read", version: "1.0.0" }]
3547
+ }
3548
+ });
3549
+ var TestIntegrationConnection = defineCommand6({
3550
+ meta: {
3551
+ key: "integrations.connection.test",
3552
+ title: "Test Integration Connection",
3553
+ version: "1.0.0",
3554
+ description: "Run a health check against a configured integration connection.",
3555
+ goal: "Validate credentials and connectivity for external providers.",
3556
+ context: "Triggered manually or by background monitors to confirm provider availability.",
3557
+ owners: ["@platform.integrations"],
3558
+ tags: ["integration", "connections"],
3559
+ stability: "experimental"
3560
+ },
3561
+ io: {
3562
+ input: TestIntegrationConnectionInput,
3563
+ output: TestIntegrationConnectionOutput
3564
+ },
3565
+ policy: {
3566
+ auth: "admin",
3567
+ policies: [{ key: "platform.integration.manage", version: "1.0.0" }]
3568
+ }
3569
+ });
3570
+ var integrationContracts = {
3571
+ CreateIntegrationConnection,
3572
+ UpdateIntegrationConnection,
3573
+ DeleteIntegrationConnection,
3574
+ ListIntegrationConnections,
3575
+ TestIntegrationConnection
3576
+ };
3577
+ function registerIntegrationContracts(registry2) {
3578
+ return registry2.register(CreateIntegrationConnection).register(UpdateIntegrationConnection).register(DeleteIntegrationConnection).register(ListIntegrationConnections).register(TestIntegrationConnection);
3579
+ }
3580
+ export {
3581
+ twilioSmsIntegrationSpec,
3582
+ tldvIntegrationSpec,
3583
+ supabaseVectorIntegrationSpec,
3584
+ supabasePostgresIntegrationSpec,
3585
+ stripeIntegrationSpec,
3586
+ registerTwilioSmsIntegration,
3587
+ registerTldvIntegration,
3588
+ registerSupabaseVectorIntegration,
3589
+ registerSupabasePostgresIntegration,
3590
+ registerStripeIntegration,
3591
+ registerQdrantIntegration,
3592
+ registerPowensIntegration,
3593
+ registerPostmarkIntegration,
3594
+ registerPosthogIntegration,
3595
+ registerOpenBankingContracts,
3596
+ registerNotionIntegration,
3597
+ registerMistralIntegration,
3598
+ registerMeetingRecorderContracts,
3599
+ registerLinearIntegration,
3600
+ registerJiraIntegration,
3601
+ registerIntegrationContracts,
3602
+ registerGranolaIntegration,
3603
+ registerGradiumIntegration,
3604
+ registerGoogleCalendarIntegration,
3605
+ registerGmailIntegration,
3606
+ registerGcsStorageIntegration,
3607
+ registerFirefliesIntegration,
3608
+ registerFathomIntegration,
3609
+ registerFalIntegration,
3610
+ registerElevenLabsIntegration,
3611
+ redactPostHogLLMTelemetryPayload,
3612
+ redactOpenBankingTelemetryPayload,
3613
+ redactMeetingRecorderTelemetryPayload,
3614
+ qdrantIntegrationSpec,
3615
+ powensIntegrationSpec,
3616
+ postmarkIntegrationSpec,
3617
+ posthogLLMTelemetrySpec,
3618
+ posthogIntegrationSpec,
3619
+ notionIntegrationSpec,
3620
+ mistralIntegrationSpec,
3621
+ makeIntegrationSpecKey,
3622
+ linearIntegrationSpec,
3623
+ jiraIntegrationSpec,
3624
+ integrationContracts,
3625
+ granolaIntegrationSpec,
3626
+ gradiumIntegrationSpec,
3627
+ googleCalendarIntegrationSpec,
3628
+ gmailIntegrationSpec,
3629
+ gcsStorageIntegrationSpec,
3630
+ firefliesIntegrationSpec,
3631
+ fathomIntegrationSpec,
3632
+ falIntegrationSpec,
3633
+ ensurePrimaryOpenBankingIntegration,
3634
+ elevenLabsIntegrationSpec,
3635
+ defineIntegration,
3636
+ createDefaultIntegrationSpecRegistry,
3637
+ assertPrimaryOpenBankingReady,
3638
+ UpdateIntegrationConnection,
3639
+ TestIntegrationConnection,
3640
+ POSTHOG_LLM_TELEMETRY_EVENTS,
3641
+ POSTHOG_LLM_PII_FIELDS,
3642
+ POSTHOG_EVALUATION_TEMPLATES,
3643
+ OpenBankingSyncTransactions,
3644
+ OpenBankingSyncAccounts,
3645
+ OpenBankingRefreshBalances,
3646
+ OpenBankingListTransactions,
3647
+ OpenBankingListAccounts,
3648
+ OpenBankingGetBalances,
3649
+ OpenBankingGetAccount,
3650
+ OpenBankingFeature,
3651
+ OPENBANKING_TELEMETRY_EVENTS,
3652
+ OPENBANKING_PII_FIELDS,
3653
+ MeetingTranscriptSegmentRecord,
3654
+ MeetingTranscriptRecord as MeetingTranscriptRecordModel,
3655
+ MeetingRecorderWebhookIngest,
3656
+ MeetingRecorderWebhookEventRecord,
3657
+ MeetingRecorderSyncTranscript,
3658
+ MeetingRecorderListMeetings,
3659
+ MeetingRecorderGetTranscript,
3660
+ MeetingRecorderGetMeeting,
3661
+ MeetingRecorderFeature,
3662
+ MeetingRecord as MeetingRecordModel,
3663
+ MeetingParticipantRecord,
3664
+ MEETING_RECORDER_TELEMETRY_EVENTS,
3665
+ MEETING_RECORDER_PII_FIELDS,
3666
+ ListIntegrationConnections,
3667
+ IntegrationsFeature,
3668
+ IntegrationsCapability,
3669
+ IntegrationSpecRegistry,
3670
+ IntegrationHealthService,
3671
+ DeleteIntegrationConnection,
3672
+ CreateIntegrationConnection,
3673
+ BankTransactionRecord,
3674
+ BankAccountRecord,
3675
+ AccountBalanceRecord
3676
+ };