@lssm/lib.contracts 1.11.1 → 1.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +1 -1
  2. package/dist/_virtual/rolldown_runtime.js +1 -0
  3. package/dist/app-config/app-config.feature.js +1 -0
  4. package/dist/app-config/contracts.js +1 -1
  5. package/dist/app-config/docs/app-config.docblock.js +220 -0
  6. package/dist/app-config/events.js +1 -1
  7. package/dist/app-config/index.js +1 -1
  8. package/dist/app-config/lifecycle-contracts.js +1 -1
  9. package/dist/capabilities/docs/capabilities.docblock.js +1 -0
  10. package/dist/contract-registry/index.js +1 -0
  11. package/dist/contract-registry/schemas.js +1 -0
  12. package/dist/contract-registry/types.js +0 -0
  13. package/dist/data-views/docs/data-views.docblock.js +1 -0
  14. package/dist/docs/PUBLISHING.docblock.js +76 -0
  15. package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +350 -0
  16. package/dist/docs/index.js +1 -0
  17. package/dist/docs/meta.docs.js +13 -0
  18. package/dist/docs/presentations.js +1 -0
  19. package/dist/docs/registry.js +1 -0
  20. package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +383 -0
  21. package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +68 -0
  22. package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +140 -0
  23. package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +86 -0
  24. package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +1 -0
  25. package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +58 -0
  26. package/dist/docs/tech/contracts/README.docblock.js +1 -0
  27. package/dist/docs/tech/contracts/create-subscription.docblock.js +1 -0
  28. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +180 -0
  29. package/dist/docs/tech/contracts/migrations.docblock.js +1 -0
  30. package/dist/docs/tech/contracts/openapi-export.docblock.js +38 -0
  31. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +62 -0
  32. package/dist/docs/tech/contracts/overlays.docblock.js +68 -0
  33. package/dist/docs/tech/contracts/tests.docblock.js +132 -0
  34. package/dist/docs/tech/contracts/themes.docblock.js +1 -0
  35. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -0
  36. package/dist/docs/tech/lifecycle-stage-system.docblock.js +213 -0
  37. package/dist/docs/tech/llm/llm-integration.docblock.js +289 -0
  38. package/dist/docs/tech/mcp-endpoints.docblock.js +1 -0
  39. package/dist/docs/tech/presentation-runtime.docblock.js +1 -0
  40. package/dist/docs/tech/schema/README.docblock.js +262 -0
  41. package/dist/docs/tech/studio/learning-events.docblock.js +1 -0
  42. package/dist/docs/tech/studio/learning-journeys.docblock.js +57 -0
  43. package/dist/docs/tech/studio/platform-admin-panel.docblock.js +63 -0
  44. package/dist/docs/tech/studio/project-access-teams.docblock.js +36 -0
  45. package/dist/docs/tech/studio/project-routing.docblock.js +1 -0
  46. package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
  47. package/dist/docs/tech/studio/team-invitations.docblock.js +65 -0
  48. package/dist/docs/tech/studio/workspace-ops.docblock.js +1 -0
  49. package/dist/docs/tech/studio/workspaces.docblock.js +41 -0
  50. package/dist/docs/tech/telemetry-ingest.docblock.js +122 -0
  51. package/dist/docs/tech/templates/runtime.docblock.js +1 -0
  52. package/dist/docs/tech/vscode-extension.docblock.js +68 -0
  53. package/dist/docs/tech/workflows/overview.docblock.js +1 -0
  54. package/dist/docs/tech-contracts.docs.js +76 -0
  55. package/dist/docs/types.js +0 -0
  56. package/dist/events.js +1 -1
  57. package/dist/experiments/docs/experiments.docblock.js +128 -0
  58. package/dist/forms/docs/forms.docblock.js +1 -0
  59. package/dist/index.js +1 -1
  60. package/dist/install.js +1 -1
  61. package/dist/integrations/contracts.js +1 -1
  62. package/dist/integrations/docs/integrations.docblock.js +1 -0
  63. package/dist/integrations/index.js +1 -1
  64. package/dist/integrations/openbanking/contracts/accounts.js +1 -1
  65. package/dist/integrations/openbanking/contracts/balances.js +1 -1
  66. package/dist/integrations/openbanking/contracts/index.js +1 -1
  67. package/dist/integrations/openbanking/contracts/transactions.js +1 -1
  68. package/dist/integrations/openbanking/models.js +1 -1
  69. package/dist/integrations/openbanking/openbanking.feature.js +1 -0
  70. package/dist/integrations/providers/impls/index.js +1 -1
  71. package/dist/integrations/providers/impls/provider-factory.js +1 -1
  72. package/dist/integrations/providers/index.js +1 -1
  73. package/dist/integrations/providers/registry.js +1 -0
  74. package/dist/integrations/secrets/aws-secret-manager.js +1 -0
  75. package/dist/integrations/secrets/gcp-secret-manager.js +1 -1
  76. package/dist/integrations/secrets/index.js +1 -1
  77. package/dist/integrations/secrets/scaleway-secret-manager.js +1 -0
  78. package/dist/jobs/define-job.js +1 -0
  79. package/dist/jobs/gcp-cloud-tasks.js +1 -1
  80. package/dist/jobs/gcp-pubsub.js +1 -1
  81. package/dist/jobs/handlers/index.js +1 -1
  82. package/dist/jobs/handlers/ping-handler.js +1 -0
  83. package/dist/jobs/index.js +1 -1
  84. package/dist/jobs/memory-queue.js +1 -1
  85. package/dist/jobs/queue.js +1 -0
  86. package/dist/jobs/scaleway-sqs-queue.js +1 -0
  87. package/dist/knowledge/contracts.js +1 -1
  88. package/dist/knowledge/docs/knowledge.docblock.js +138 -0
  89. package/dist/llm/exporters.js +8 -0
  90. package/dist/llm/index.js +1 -0
  91. package/dist/llm/prompts.js +220 -0
  92. package/dist/llm/types.js +0 -0
  93. package/dist/onboarding-base.js +1 -1
  94. package/dist/openapi.js +1 -0
  95. package/dist/openbanking/docs/openbanking.docblock.js +109 -0
  96. package/dist/policy/docs/policy.docblock.js +1 -0
  97. package/dist/presentations/docs/presentations-conventions.docblock.js +8 -0
  98. package/dist/presentations.js +1 -1
  99. package/dist/presentations.v2.js +7 -1
  100. package/dist/prompt.js +1 -1
  101. package/dist/promptRegistry.js +1 -1
  102. package/dist/regenerator/docs/regenerator.docblock.js +184 -0
  103. package/dist/registry.js +1 -1
  104. package/dist/resources.js +1 -1
  105. package/dist/schema-to-markdown.js +10 -0
  106. package/dist/server/graphql-pothos.js +1 -1
  107. package/dist/server/index.js +1 -1
  108. package/dist/server/mcp/createMcpServer.js +1 -0
  109. package/dist/server/mcp/mcpTypes.js +0 -0
  110. package/dist/server/mcp/registerPresentations.js +1 -0
  111. package/dist/server/mcp/registerPrompts.js +3 -0
  112. package/dist/server/mcp/registerResources.js +1 -0
  113. package/dist/server/mcp/registerTools.js +1 -0
  114. package/dist/server/provider-mcp.js +1 -1
  115. package/dist/telemetry/docs/telemetry.docblock.js +139 -0
  116. package/package.json +354 -193
  117. package/dist/app-config/branding.d.ts +0 -55
  118. package/dist/app-config/contracts.d.ts +0 -244
  119. package/dist/app-config/events.d.ts +0 -122
  120. package/dist/app-config/index.d.ts +0 -8
  121. package/dist/app-config/lifecycle-contracts.d.ts +0 -382
  122. package/dist/app-config/lifecycle.d.ts +0 -27
  123. package/dist/app-config/runtime.d.ts +0 -114
  124. package/dist/app-config/spec.d.ts +0 -175
  125. package/dist/app-config/validation.d.ts +0 -47
  126. package/dist/capabilities/openbanking.d.ts +0 -9
  127. package/dist/capabilities.d.ts +0 -45
  128. package/dist/client/index.d.ts +0 -6
  129. package/dist/client/react/drivers/rn-reusables.d.ts +0 -22
  130. package/dist/client/react/drivers/shadcn.d.ts +0 -12
  131. package/dist/client/react/feature-render.d.ts +0 -20
  132. package/dist/client/react/form-render.d.ts +0 -91
  133. package/dist/client/react/index.d.ts +0 -5
  134. package/dist/contracts-adapter-hydration.d.ts +0 -15
  135. package/dist/contracts-adapter-input.d.ts +0 -10
  136. package/dist/data-views/query-generator.d.ts +0 -39
  137. package/dist/data-views/runtime.d.ts +0 -26
  138. package/dist/data-views.d.ts +0 -131
  139. package/dist/events.d.ts +0 -44
  140. package/dist/experiments/evaluator.d.ts +0 -37
  141. package/dist/experiments/spec-resolver.d.ts +0 -16
  142. package/dist/experiments/spec.d.ts +0 -89
  143. package/dist/features.d.ts +0 -87
  144. package/dist/forms.d.ts +0 -258
  145. package/dist/graphql-federation/dist/index.js +0 -1
  146. package/dist/index.d.ts +0 -130
  147. package/dist/install.d.ts +0 -76
  148. package/dist/integrations/binding.d.ts +0 -17
  149. package/dist/integrations/connection.d.ts +0 -51
  150. package/dist/integrations/contracts.d.ts +0 -435
  151. package/dist/integrations/health.d.ts +0 -21
  152. package/dist/integrations/index.d.ts +0 -53
  153. package/dist/integrations/openbanking/contracts/accounts.d.ts +0 -287
  154. package/dist/integrations/openbanking/contracts/balances.d.ts +0 -163
  155. package/dist/integrations/openbanking/contracts/index.d.ts +0 -9
  156. package/dist/integrations/openbanking/contracts/transactions.d.ts +0 -211
  157. package/dist/integrations/openbanking/guards.d.ts +0 -12
  158. package/dist/integrations/openbanking/models.d.ts +0 -228
  159. package/dist/integrations/openbanking/telemetry.d.ts +0 -15
  160. package/dist/integrations/providers/calendar.d.ts +0 -78
  161. package/dist/integrations/providers/elevenlabs.d.ts +0 -7
  162. package/dist/integrations/providers/email.d.ts +0 -86
  163. package/dist/integrations/providers/embedding.d.ts +0 -24
  164. package/dist/integrations/providers/gcs-storage.d.ts +0 -7
  165. package/dist/integrations/providers/gmail.d.ts +0 -7
  166. package/dist/integrations/providers/google-calendar.d.ts +0 -7
  167. package/dist/integrations/providers/impls/elevenlabs-voice.d.ts +0 -20
  168. package/dist/integrations/providers/impls/gcs-storage.d.ts +0 -24
  169. package/dist/integrations/providers/impls/gmail-inbound.d.ts +0 -26
  170. package/dist/integrations/providers/impls/gmail-outbound.d.ts +0 -18
  171. package/dist/integrations/providers/impls/google-calendar.d.ts +0 -23
  172. package/dist/integrations/providers/impls/index.d.ts +0 -15
  173. package/dist/integrations/providers/impls/mistral-embedding.d.ts +0 -23
  174. package/dist/integrations/providers/impls/mistral-llm.d.ts +0 -31
  175. package/dist/integrations/providers/impls/postmark-email.d.ts +0 -19
  176. package/dist/integrations/providers/impls/powens-client.d.ts +0 -124
  177. package/dist/integrations/providers/impls/powens-openbanking.d.ts +0 -27
  178. package/dist/integrations/providers/impls/provider-factory.d.ts +0 -26
  179. package/dist/integrations/providers/impls/qdrant-vector.d.ts +0 -24
  180. package/dist/integrations/providers/impls/stripe-payments.d.ts +0 -28
  181. package/dist/integrations/providers/impls/twilio-sms.d.ts +0 -20
  182. package/dist/integrations/providers/index.d.ts +0 -36
  183. package/dist/integrations/providers/llm.d.ts +0 -82
  184. package/dist/integrations/providers/mistral.d.ts +0 -7
  185. package/dist/integrations/providers/openbanking.d.ts +0 -128
  186. package/dist/integrations/providers/payments.d.ts +0 -109
  187. package/dist/integrations/providers/postmark.d.ts +0 -7
  188. package/dist/integrations/providers/powens.d.ts +0 -7
  189. package/dist/integrations/providers/qdrant.d.ts +0 -7
  190. package/dist/integrations/providers/sms.d.ts +0 -34
  191. package/dist/integrations/providers/storage.d.ts +0 -60
  192. package/dist/integrations/providers/stripe.d.ts +0 -7
  193. package/dist/integrations/providers/twilio-sms.d.ts +0 -7
  194. package/dist/integrations/providers/vector-store.d.ts +0 -43
  195. package/dist/integrations/providers/voice.d.ts +0 -34
  196. package/dist/integrations/runtime.d.ts +0 -99
  197. package/dist/integrations/secrets/env-secret-provider.d.ts +0 -31
  198. package/dist/integrations/secrets/gcp-secret-manager.d.ts +0 -32
  199. package/dist/integrations/secrets/index.d.ts +0 -5
  200. package/dist/integrations/secrets/manager.d.ts +0 -47
  201. package/dist/integrations/secrets/provider.d.ts +0 -52
  202. package/dist/integrations/spec.d.ts +0 -79
  203. package/dist/jobs/gcp-cloud-tasks.d.ts +0 -41
  204. package/dist/jobs/gcp-pubsub.d.ts +0 -25
  205. package/dist/jobs/handlers/gmail-sync-handler.d.ts +0 -9
  206. package/dist/jobs/handlers/index.d.ts +0 -3
  207. package/dist/jobs/handlers/storage-document-handler.d.ts +0 -12
  208. package/dist/jobs/index.d.ts +0 -7
  209. package/dist/jobs/memory-queue.d.ts +0 -18
  210. package/dist/jobs/queue.d.ts +0 -26
  211. package/dist/jsonschema.d.ts +0 -26
  212. package/dist/knowledge/binding.d.ts +0 -25
  213. package/dist/knowledge/contracts.d.ts +0 -316
  214. package/dist/knowledge/index.d.ts +0 -10
  215. package/dist/knowledge/ingestion/document-processor.d.ts +0 -24
  216. package/dist/knowledge/ingestion/embedding-service.d.ts +0 -12
  217. package/dist/knowledge/ingestion/gmail-adapter.d.ts +0 -18
  218. package/dist/knowledge/ingestion/index.d.ts +0 -6
  219. package/dist/knowledge/ingestion/storage-adapter.d.ts +0 -15
  220. package/dist/knowledge/ingestion/vector-indexer.d.ts +0 -18
  221. package/dist/knowledge/query/index.d.ts +0 -2
  222. package/dist/knowledge/query/service.d.ts +0 -29
  223. package/dist/knowledge/runtime.d.ts +0 -32
  224. package/dist/knowledge/source.d.ts +0 -32
  225. package/dist/knowledge/spaces/email-threads.d.ts +0 -7
  226. package/dist/knowledge/spaces/financial-docs.d.ts +0 -7
  227. package/dist/knowledge/spaces/financial-overview.d.ts +0 -7
  228. package/dist/knowledge/spaces/index.d.ts +0 -7
  229. package/dist/knowledge/spaces/product-canon.d.ts +0 -7
  230. package/dist/knowledge/spaces/support-faq.d.ts +0 -7
  231. package/dist/knowledge/spaces/uploaded-docs.d.ts +0 -7
  232. package/dist/knowledge/spec.d.ts +0 -52
  233. package/dist/markdown.d.ts +0 -21
  234. package/dist/migrations.d.ts +0 -52
  235. package/dist/onboarding-base.d.ts +0 -137
  236. package/dist/ownership.d.ts +0 -75
  237. package/dist/policy/engine.d.ts +0 -39
  238. package/dist/policy/opa-adapter.d.ts +0 -45
  239. package/dist/policy/spec.d.ts +0 -114
  240. package/dist/presentations.backcompat.d.ts +0 -7
  241. package/dist/presentations.d.ts +0 -96
  242. package/dist/presentations.v2.d.ts +0 -95
  243. package/dist/prompt.d.ts +0 -60
  244. package/dist/promptRegistry.d.ts +0 -15
  245. package/dist/regenerator/adapters.d.ts +0 -19
  246. package/dist/regenerator/executor.d.ts +0 -70
  247. package/dist/regenerator/index.d.ts +0 -7
  248. package/dist/regenerator/service.d.ts +0 -33
  249. package/dist/regenerator/sinks.d.ts +0 -26
  250. package/dist/regenerator/types.d.ts +0 -107
  251. package/dist/regenerator/utils.d.ts +0 -9
  252. package/dist/registry.d.ts +0 -72
  253. package/dist/resources.d.ts +0 -64
  254. package/dist/schema/dist/EnumType.js +0 -1
  255. package/dist/schema/dist/FieldType.js +0 -1
  256. package/dist/schema/dist/ScalarTypeEnum.js +0 -1
  257. package/dist/schema/dist/SchemaModel.js +0 -1
  258. package/dist/schema/dist/index.js +0 -1
  259. package/dist/server/graphql-pothos.d.ts +0 -31
  260. package/dist/server/graphql-schema-export.d.ts +0 -6
  261. package/dist/server/graphql-schema-export.js +0 -1
  262. package/dist/server/index.d.ts +0 -9
  263. package/dist/server/provider-mcp.d.ts +0 -51
  264. package/dist/server/rest-elysia.d.ts +0 -40
  265. package/dist/server/rest-express.d.ts +0 -16
  266. package/dist/server/rest-generic.d.ts +0 -32
  267. package/dist/server/rest-next-app.d.ts +0 -35
  268. package/dist/server/rest-next-mcp.d.ts +0 -11
  269. package/dist/server/rest-next-pages.d.ts +0 -9
  270. package/dist/spec.d.ts +0 -171
  271. package/dist/telemetry/anomaly.d.ts +0 -27
  272. package/dist/telemetry/index.d.ts +0 -4
  273. package/dist/telemetry/spec.d.ts +0 -98
  274. package/dist/telemetry/tracker.d.ts +0 -51
  275. package/dist/tests/index.d.ts +0 -3
  276. package/dist/tests/runner.d.ts +0 -43
  277. package/dist/tests/spec.d.ts +0 -89
  278. package/dist/themes.d.ts +0 -55
  279. package/dist/translations/catalog.d.ts +0 -28
  280. package/dist/translations/tenant.d.ts +0 -15
  281. package/dist/types/all.d.ts +0 -60
  282. package/dist/types.d.ts +0 -88
  283. package/dist/workflow/adapters/db-adapter.d.ts +0 -34
  284. package/dist/workflow/adapters/file-adapter.d.ts +0 -14
  285. package/dist/workflow/adapters/index.d.ts +0 -4
  286. package/dist/workflow/adapters/memory-store.d.ts +0 -18
  287. package/dist/workflow/expression.d.ts +0 -9
  288. package/dist/workflow/index.d.ts +0 -10
  289. package/dist/workflow/runner.d.ts +0 -74
  290. package/dist/workflow/sla-monitor.d.ts +0 -20
  291. package/dist/workflow/spec.d.ts +0 -99
  292. package/dist/workflow/state.d.ts +0 -35
  293. package/dist/workflow/validation.d.ts +0 -28
@@ -0,0 +1,122 @@
1
+ import{registerDocBlocks as e}from"../registry.js";const t=[{id:`docs.tech.telemetry.ingest`,title:`Telemetry Ingest Endpoint`,summary:`Server-side telemetry ingestion for ContractSpec clients (VS Code extension, CLI, etc.).`,kind:`reference`,visibility:`internal`,route:`/docs/tech/telemetry/ingest`,tags:[`telemetry`,`api`,`posthog`,`analytics`],body:`# Telemetry Ingest Endpoint
2
+
3
+ The ContractSpec API provides a telemetry ingest endpoint for clients to send product analytics events.
4
+
5
+ ## Endpoint
6
+
7
+ \`\`\`
8
+ POST /api/telemetry/ingest
9
+ \`\`\`
10
+
11
+ ## Request
12
+
13
+ \`\`\`json
14
+ {
15
+ "event": "contractspec.vscode.command_run",
16
+ "distinct_id": "client-uuid",
17
+ "properties": {
18
+ "command": "validate"
19
+ },
20
+ "timestamp": "2024-01-15T10:30:00.000Z"
21
+ }
22
+ \`\`\`
23
+
24
+ ### Headers
25
+
26
+ | Header | Description |
27
+ |--------|-------------|
28
+ | \`x-contractspec-client-id\` | Optional client identifier (used as fallback for distinct_id) |
29
+ | \`Content-Type\` | Must be \`application/json\` |
30
+
31
+ ### Body
32
+
33
+ | Field | Type | Required | Description |
34
+ |-------|------|----------|-------------|
35
+ | \`event\` | string | Yes | Event name (e.g., \`contractspec.vscode.activated\`) |
36
+ | \`distinct_id\` | string | Yes | Anonymous client identifier |
37
+ | \`properties\` | object | No | Event properties |
38
+ | \`timestamp\` | string | No | ISO 8601 timestamp |
39
+
40
+ ## Response
41
+
42
+ \`\`\`json
43
+ {
44
+ "success": true
45
+ }
46
+ \`\`\`
47
+
48
+ ## Configuration
49
+
50
+ The endpoint requires \`POSTHOG_PROJECT_KEY\` environment variable to be set. If not configured, events are accepted but not forwarded.
51
+
52
+ | Environment Variable | Description | Default |
53
+ |---------------------|-------------|---------|
54
+ | \`POSTHOG_HOST\` | PostHog host URL | \`https://eu.posthog.com\` |
55
+ | \`POSTHOG_PROJECT_KEY\` | PostHog project API key | (required) |
56
+
57
+ ## Privacy
58
+
59
+ - No PII is collected or stored
60
+ - \`distinct_id\` is an anonymous client-generated UUID
61
+ - File paths and source code are never included in events
62
+ - Respects VS Code telemetry settings on the client side
63
+
64
+ ## Events
65
+
66
+ ### Extension Events
67
+
68
+ | Event | Description | Properties |
69
+ |-------|-------------|------------|
70
+ | \`contractspec.vscode.activated\` | Extension activated | \`version\` |
71
+ | \`contractspec.vscode.command_run\` | Command executed | \`command\` |
72
+ | \`contractspec.vscode.mcp_call\` | MCP call made | \`endpoint\`, \`tool\` |
73
+
74
+ ### API Events
75
+
76
+ | Event | Description | Properties |
77
+ |-------|-------------|------------|
78
+ | \`contractspec.api.mcp_request\` | MCP request processed | \`endpoint\`, \`method\`, \`success\`, \`duration_ms\` |
79
+ `},{id:`docs.tech.telemetry.hybrid`,title:`Hybrid Telemetry Model`,summary:`How ContractSpec clients choose between direct PostHog and API-routed telemetry.`,kind:`usage`,visibility:`internal`,route:`/docs/tech/telemetry/hybrid`,tags:[`telemetry`,`architecture`,`posthog`],body:`# Hybrid Telemetry Model
80
+
81
+ ContractSpec uses a hybrid telemetry model where clients can send events either directly to PostHog or via the API server.
82
+
83
+ ## Decision Flow
84
+
85
+ \`\`\`
86
+ Is contractspec.api.baseUrl configured?
87
+ ├── Yes → Send via /api/telemetry/ingest
88
+ └── No → Is posthogProjectKey configured?
89
+ ├── Yes → Send directly to PostHog
90
+ └── No → Telemetry disabled
91
+ \`\`\`
92
+
93
+ ## Benefits
94
+
95
+ ### Direct PostHog
96
+ - No server dependency
97
+ - Works offline (with batching)
98
+ - Lower latency
99
+
100
+ ### Via API
101
+ - Centralized key management (no client-side keys)
102
+ - Server-side enrichment and validation
103
+ - Rate limiting and abuse prevention
104
+ - Easier migration to other providers
105
+
106
+ ## Recommendation
107
+
108
+ - **Development**: Use direct PostHog with a dev project key
109
+ - **Production**: Route via API for better governance
110
+
111
+ ## Future: OpenTelemetry
112
+
113
+ The current PostHog implementation is behind a simple interface that can be swapped for OpenTelemetry:
114
+
115
+ \`\`\`typescript
116
+ interface TelemetryClient {
117
+ send(event: TelemetryEvent): Promise<void>;
118
+ }
119
+ \`\`\`
120
+
121
+ This allows future migration without changing client code.
122
+ `}];e(t);export{t as tech_telemetry_ingest_DocBlocks};
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.templates.runtime`,title:`ContractSpec Template Runtime (Phase 9)`,summary:`Phase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.`,kind:`reference`,visibility:`public`,route:`/docs/tech/templates/runtime`,tags:[`tech`,`templates`,`runtime`],body:"## ContractSpec Template Runtime (Phase 9)\n\nPhase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.\n\n### Building Blocks\n\n- **Local database** – `@lssm/lib.runtime-local` wraps `sql.js` (SQLite WASM) and `IndexedDB` so we can seed demo data, run migrations, and persist state between sessions. Tests point the runtime to `node_modules/sql.js/dist` so CI doesn’t need a browser.\n- **Local GraphQL** – `LocalGraphQLClient` wires Apollo Client + SchemaLink to resolvers for tasks, messaging, and i18n recipes. All `/templates`, `/studio`, and `/sandbox` previews use those resolvers so we never call remote APIs during demos.\n- **Template registry + installer** – `.../templates/registry.ts` stores the catalog (todos, messaging, recipes). `TemplateInstaller` can seed the runtime (`install`) or export a base64 snapshot via the new `saveTemplateToStudio` mutation.\n- **TemplateShell** – Shared UI wrapper that creates a `TemplateRuntimeProvider`, shows `LocalDataIndicator`, and (optionally) surfaces the new `SaveToStudioButton`.\n\n### Runtime Flows\n\n1. `/templates` now opens a modal that renders `TemplateShell` for each template. Users can explore without leaving the marketing site.\n2. `/studio` switches to a tabbed mini-app (Projects, Canvas, Specs, Deploy) to showcase Studio surfaces with mock data. Visitors see a **preview** shell, while authenticated users (Better Auth via Sigil) unlock full persistence, versioning, and deployment controls.\n3. `/sandbox` lets visitors pick a template and mode (Playground, Spec Editor, Visual Builder). The console at the bottom streams runtime events for transparency.\n\n### GraphQL Mutations\n\n- `saveTemplateToStudio(input: SaveTemplateInput!): SaveTemplateResult!` writes a placeholder project + spec so that templates installed from the sandbox appear in Studio. The mutation is intentionally simple right now: it records which template was imported, stores metadata, and returns `{ projectId, status: 'QUEUED' }` for the UI.\n- `saveCanvasDraft(input: SaveCanvasDraftInput!): CanvasVersion!` snapshots the current Visual Builder nodes to a draft version tied to a canvas overlay. Inputs include `canvasId`, arbitrary `nodes` JSON, and an optional `label`. The resolver enforces org/org access before calling `CanvasVersionManager`.\n- `deployCanvasVersion(input: DeployCanvasVersionInput!): CanvasVersion!` promotes a previously saved draft (`versionId`) to the deployed state. The returned object includes `status`, `nodes`, `createdAt`, and `createdBy` for UI timelines.\n- `undoCanvasVersion(input: UndoCanvasInput!): CanvasVersion` rewinds the visual builder to the prior snapshot (returns `null` when history is empty) so Studio’s toolbar can surface “Undo” without shelling out to local storage.\n\n### Studio GraphQL endpoint\n\n- The landing app exposes the Studio schema at `/api/studio/graphql` via Yoga so React Query hooks (`useStudioProjects`, `useCreateStudioProject`, `useDeployStudioProject`, etc.) can talk to the bundle without spinning up a separate server.\n\n### Spec Editor typing\n\n- Studio’s spec editor now preloads Monaco with ambient declarations for `@lssm/lib.contracts` and `zod`, so snippets receive autocomplete and inline errors even before the spec ships to the backend. The helper lives in `presentation/components/studio/organisms/monaco-spec-types.ts` and registers the extra libs once per browser session via `monaco.languages.typescript.typescriptDefaults.addExtraLib`.\n- Compiler options are aligned with our frontend toolchain (ES2020 + React JSX) which means drafts written in the editor behave like the compiled artifacts that flow through Studio pipelines.\n\n### Spec templates\n\n- Selecting a spec type now injects a ready-to-edit scaffold (capability, workflow, policy, dataview, component) so authors start from a canonical layout instead of a blank file. Templates live alongside `SpecEditor.tsx`, and we only overwrite the content when the previous value is empty or when the author explicitly switches types via the dropdown.\n\n### Spec preview\n\n- The validation side panel now embeds a `SpecPreview` widget that shows validation errors alongside transport artifacts (GraphQL schema, REST endpoints, component summaries) once a preview run completes. Tabs let authors toggle between “Validation” and “Artifacts,” mirroring the UX described in the Studio plan.\n\n### Testing\n\n- `src/templates/__tests__/runtime.test.ts` covers todos CRUD, messaging delivery, and recipe locale switching through the local GraphQL API.\n- Studio infrastructure tests live in `src/__tests__/e2e/project-lifecycle.test.ts` and continue to exercise project creation + deploy flows.\n\n### Next Steps\n\nFuture templates can register their React components via `registerTemplateComponents(templateId, components)` so TemplateShell can render them automatically. When new templates are added, remember to:\n\n1. Update the registry entry (schema + tags).\n2. Register components inside `presentation/components/templates`.\n3. Document the template under `docs/templates/`.\n\n\n\n\n\n"}];e(t);export{t as tech_templates_runtime_DocBlocks};
@@ -0,0 +1,68 @@
1
+ import{registerDocBlocks as e}from"../registry.js";const t=[{id:`docs.tech.vscode.extension`,title:`ContractSpec VS Code Extension`,summary:`VS Code extension for spec-first development with validation, scaffolding, and MCP integration.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/extension`,tags:[`vscode`,`extension`,`tooling`,`dx`],body:`# ContractSpec VS Code Extension
2
+
3
+ The ContractSpec VS Code extension provides spec-first development tooling directly in your editor.
4
+
5
+ ## Features
6
+
7
+ - **Real-time Validation**: Get instant feedback on spec errors and warnings as you save files
8
+ - **Build/Scaffold**: Generate handler and component skeletons from specs (no AI required)
9
+ - **Spec Explorer**: List and navigate all specs in your workspace
10
+ - **Dependency Analysis**: Visualize spec dependencies and detect cycles
11
+ - **MCP Integration**: Search ContractSpec documentation via Model Context Protocol
12
+ - **Snippets**: Code snippets for common ContractSpec patterns
13
+
14
+ ## Commands
15
+
16
+ | Command | Description |
17
+ |---------|-------------|
18
+ | \`ContractSpec: Validate Current Spec\` | Validate the currently open spec file |
19
+ | \`ContractSpec: Validate All Specs\` | Validate all spec files in the workspace |
20
+ | \`ContractSpec: Build/Scaffold\` | Generate handler/component from the current spec |
21
+ | \`ContractSpec: List All Specs\` | Show all specs in the workspace |
22
+ | \`ContractSpec: Analyze Dependencies\` | Analyze and visualize spec dependencies |
23
+ | \`ContractSpec: Search Docs (MCP)\` | Search documentation via MCP |
24
+
25
+ ## Configuration
26
+
27
+ | Setting | Description | Default |
28
+ |---------|-------------|---------|
29
+ | \`contractspec.api.baseUrl\` | Base URL for ContractSpec API (enables MCP + remote telemetry) | \`""\` |
30
+ | \`contractspec.telemetry.posthogHost\` | PostHog host URL for direct telemetry | \`"https://eu.posthog.com"\` |
31
+ | \`contractspec.telemetry.posthogProjectKey\` | PostHog project key for direct telemetry | \`""\` |
32
+ | \`contractspec.validation.onSave\` | Run validation on save | \`true\` |
33
+ | \`contractspec.validation.onOpen\` | Run validation on open | \`true\` |
34
+
35
+ ## Architecture
36
+
37
+ The extension uses:
38
+ - \`@lssm/module.contractspec-workspace\` for pure analysis + templates
39
+ - \`@lssm/bundle.contractspec-workspace\` for workspace services + adapters
40
+
41
+ This allows the extension to work without requiring the CLI to be installed.
42
+
43
+ ## Telemetry
44
+
45
+ The extension uses a hybrid telemetry approach:
46
+ 1. If \`contractspec.api.baseUrl\` is configured → send to API \`/api/telemetry/ingest\`
47
+ 2. Otherwise → send directly to PostHog (if project key configured)
48
+
49
+ Telemetry respects VS Code's telemetry settings. No file paths, source code, or PII is collected.
50
+ `},{id:`docs.tech.vscode.snippets`,title:`ContractSpec Snippets`,summary:`Code snippets for common ContractSpec patterns in VS Code.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/snippets`,tags:[`vscode`,`snippets`,`dx`],body:`# ContractSpec Snippets
51
+
52
+ The VS Code extension includes snippets for common ContractSpec patterns.
53
+
54
+ ## Available Snippets
55
+
56
+ | Prefix | Description |
57
+ |--------|-------------|
58
+ | \`contractspec-command\` | Create a new command (write operation) |
59
+ | \`contractspec-query\` | Create a new query (read-only operation) |
60
+ | \`contractspec-event\` | Create a new event |
61
+ | \`contractspec-docblock\` | Create a new DocBlock |
62
+ | \`contractspec-telemetry\` | Create a new TelemetrySpec |
63
+ | \`contractspec-presentation\` | Create a new Presentation |
64
+
65
+ ## Usage
66
+
67
+ Type the prefix in a TypeScript file and press Tab to expand the snippet. Tab through the placeholders to fill in your values.
68
+ `}];e(t);export{t as tech_vscode_extension_DocBlocks};
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../registry.js";const t=[{id:`docs.tech.workflows.overview`,title:`WorkflowSpec Overview`,summary:"WorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@lssm/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.",kind:`reference`,visibility:`public`,route:`/docs/tech/workflows/overview`,tags:[`tech`,`workflows`,`overview`],body:"# WorkflowSpec Overview\n\n## Purpose\n\nWorkflowSpec provides a declarative, versioned format for long-running flows that mix automation and human review. Specs stay inside `@lssm/lib.contracts` (`src/workflow/spec.ts`) so the same definition powers runtime execution, documentation, and future generation.\n\n## Core Types\n\n- `WorkflowMeta`: ownership metadata (`title`, `domain`, `owners`, `tags`, `stability`) plus `name` and `version`.\n- `WorkflowDefinition`:\n - `entryStepId?`: optional explicit entry point (defaults to first step).\n - `steps[]`: ordered list of `Step` descriptors.\n - `transitions[]`: directed edges between steps with optional expressions.\n - `sla?`: aggregated timing hints for the overall flow or per-step budgets.\n - `compensation?`: fallback operations executed when a workflow is rolled back or fails.\n- `Step`:\n - `type`: `human`, `automation`, or `decision`.\n - `action`: references either a `ContractSpec` (`operation`) or `FormSpec` (`form`).\n - Optional `guard`, `timeoutMs`, and retry policy (`maxAttempts`, `backoff`, `delayMs`, `maxDelayMs?`).\n - `requiredIntegrations?`: integration slot ids that must be bound before the step may execute.\n - `requiredCapabilities?`: `CapabilityRef[]` that must be enabled in the resolved app config.\n- `Transition`: `from` → `to` with optional `condition` string (simple data expressions).\n\n## Registry & Validation\n\n- `WorkflowRegistry` (`src/workflow/spec.ts`) stores specs by key `<name>.v<version>` and exposes `register`, `list`, and `get`.\n- `validateWorkflowSpec()` (`src/workflow/validation.ts`) checks:\n - Duplicate step IDs.\n - Unknown `from`/`to` transitions.\n - Empty guards/conditions.\n - Reachability from the entry step.\n - Cycles in the graph.\n - Operation/Form references against provided registries.\n- `assertWorkflowSpecValid()` wraps validation and throws `WorkflowValidationError` when errors remain.\n\n## Runtime\n\n- `WorkflowRunner` (`src/workflow/runner.ts`) executes workflows and coordinates steps.\n - `start(name, version?, initialData?)` returns a `workflowId`.\n - `executeStep(workflowId, input?)` runs the current step (automation or human).\n - `getState(workflowId)` retrieves the latest state snapshot.\n - `cancel(workflowId)` marks the workflow as cancelled.\n - `preFlightCheck(name, version?, resolvedConfig?)` evaluates integration/capability requirements before the workflow starts.\n - Throws `WorkflowPreFlightError` if required integration slots are unbound or required capabilities are disabled.\n- `StateStore` (`src/workflow/state.ts`) abstracts persistence. V1 ships with:\n - `InMemoryStateStore` (`src/workflow/adapters/memory-store.ts`) for tests/dev.\n - Placeholder factories for file/database adapters (`adapters/file-adapter.ts`, `adapters/db-adapter.ts`).\n- Guard evaluation: expression guards run through `evaluateExpression()` (`src/workflow/expression.ts`); custom policy guards can be provided via `guardEvaluator`.\n- Events: the runner emits `workflow.started`, `workflow.step_completed`, `workflow.step_failed`, and `workflow.cancelled` through the optional `eventEmitter`.\n- React bindings (`@lssm/lib.presentation-runtime-react`):\n - `useWorkflow` hook (polls state, exposes `executeStep`, `cancel`, `refresh`).\n - `WorkflowStepper` progress indicator using design-system Stepper.\n - `WorkflowStepRenderer` helper to render human/automation/decision steps with sensible fallbacks.\n\n## Authoring Checklist\n\n1. Reuse existing operations/forms; create new specs when missing.\n2. Prefer explicit `entryStepId` for clarity (especially with decision branches).\n3. Give automation steps an `operation` and human steps a `form` (warnings surface otherwise).\n4. Use short, meaningful step IDs (`submit`, `review`, `finalize`) to simplify analytics.\n5. Keep guard expressions deterministic; complex policy logic should move to PolicySpec (Phase 2).\n\n## Testing\n\n- Add unit tests for new workflows via `assertWorkflowSpecValid`.\n- Use the new Vitest suites (`validation.test.ts`, `expression.test.ts`, `runner.test.ts`) as examples.\n- CLI support will arrive in Phase 1 PR 3 (`contractspec create --type workflow`).\n\n## Tooling\n\n- `contractspec create --type workflow` scaffolds a WorkflowSpec with interactive prompts.\n- `contractspec build <spec.workflow.ts>` generates a runner scaffold (`.runner.ts`) wired to `WorkflowRunner` and the in-memory store.\n- `contractspec validate` understands `.workflow.ts` files and checks core structure (meta, steps, transitions).\n\n## Next Steps (Non-MVP)\n\n- Persistence adapters (database/file) for workflow state (Phase 2).\n- React bindings (`useWorkflow`, `WorkflowStepper`) and presentation-runtime integration (PR 3).\n- Policy engine integration (`guard.type === 'policy'` validated against PolicySpec).\n- Telemetry hooks for step execution metrics.\n\n"}];e(t);export{t as tech_workflows_overview_DocBlocks};
@@ -0,0 +1,76 @@
1
+ const e=[{id:`docs.tech.contracts.presentations-v2`,title:`Presentations V2 — Unified Descriptor & Transform Engine`,summary:`How PresentationDescriptorV2 and TransformEngine keep docs/renderers consistent.`,visibility:`public`,route:`/docs/tech/contracts/presentations-v2`,kind:`reference`,tags:[`presentations`,`docs`,`mcp`],body:`## Presentations V2 — Unified Descriptor & Transform Engine
2
+
3
+ ### Purpose
4
+
5
+ Unify presentations into one descriptor (\`PresentationDescriptorV2\`) that declares a single source (React component key or BlockNote doc) and a list of output targets (react, markdown, application/json, application/xml). A pluggable \`TransformEngine\` renders any target and applies PII redaction.
6
+
7
+ ### Types
8
+
9
+ \`\`\`ts
10
+ type PresentationTarget =
11
+ | 'react'
12
+ | 'markdown'
13
+ | 'application/json'
14
+ | 'application/xml';
15
+
16
+ type PresentationSource =
17
+ | {
18
+ type: 'component';
19
+ framework: 'react';
20
+ componentKey: string;
21
+ props?: AnySchemaModel;
22
+ }
23
+ | { type: 'blocknotejs'; docJson: unknown; blockConfig?: unknown };
24
+
25
+ interface PresentationDescriptorV2 {
26
+ meta: PresentationV2Meta; // includes partial OwnerShipMeta + description
27
+ policy?: { flags?: string[]; pii?: string[] };
28
+ source: PresentationSource;
29
+ targets: PresentationTarget[];
30
+ }
31
+
32
+ // Shared ownership schema (source of truth in @lssm/lib.contracts/src/ownership.ts)
33
+ interface OwnerShipMeta {
34
+ title: string;
35
+ description: string;
36
+ domain: string;
37
+ owners: Owner[];
38
+ tags: Tag[];
39
+ stability: Stability;
40
+ }
41
+
42
+ type Stability = 'experimental' | 'beta' | 'stable' | 'deprecated';
43
+ type Owner = string; // curated list available in code (e.g., '@sigil-team', 'team-strit')
44
+ type Tag = string; // curated list available in code (e.g., 'auth', 'spots')
45
+
46
+ // For V2 presentations, meta is a Partial<OwnerShipMeta> plus description, name, version
47
+ interface PresentationV2Meta extends Partial<OwnerShipMeta> {
48
+ name: string;
49
+ version: number;
50
+ description?: string;
51
+ }
52
+ \`\`\`
53
+
54
+ ### Engine
55
+
56
+ Use \`createDefaultTransformEngine()\` and register custom renderers as needed (e.g., high-fidelity BlockNote → Markdown). The default engine supports markdown/json/xml; a React renderer returns a serializable descriptor the host app renders via a \`componentMap\` or a BlockNote renderer. The canonical source type string is \`blocknotejs\` (not \`blocknote\`).
57
+
58
+ PII paths (JSON-like) are redacted from rendered outputs.
59
+
60
+ ### MCP Integration
61
+
62
+ \`createMcpServer\` accepts \`presentationsV2\`. Each descriptor is exposed under \`presentation://<name>/v<version>\` and negotiated variants (\`.md/.json/.xml\`) are rendered by the engine.
63
+
64
+ ### Migration
65
+
66
+ - V1 \`PresentationSpec\` remains supported; a back-compat helper converts V1 → V2 when convenient.
67
+ - Prefer V2 for new work.
68
+
69
+ ### Examples (Sigil)
70
+
71
+ - \`sigil.auth.webauth_tabs_v2\`: component source (\`componentKey: 'sigil.webauth.tabs'\`), targets \`react/json/xml\`.
72
+ - \`sigil.signup.guide_v2\`: BlockNote doc source, targets \`react/markdown/json/xml\`.
73
+
74
+ ### React Rendering
75
+
76
+ Host apps use a \`componentMap\` (e.g., \`'sigil.webauth.tabs' → WebAuthTabs\`) and a BlockNote renderer to turn the React render descriptor into elements.`}];export{e as techContractsDocs};
File without changes
package/dist/events.js CHANGED
@@ -1 +1 @@
1
- import"./schema/dist/index.js";function e(e){return e}const t=(e,t)=>`${e}.v${t}`;export{e as defineEvent,t as eventKey};
1
+ import"@lssm/lib.schema";function e(e){return e}const t=(e,t)=>`${e}.v${t}`;export{e as defineEvent,t as eventKey};
@@ -0,0 +1,128 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.experiments`,title:`ExperimentSpec & ExperimentEvaluator`,summary:`Use experiments to test alternative workflows, data views, or themes with controlled allocations and measurable outcomes.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/experiments`,tags:[`tech`,`contracts`,`experiments`],body:`# ExperimentSpec & ExperimentEvaluator
2
+
3
+ Use experiments to test alternative workflows, data views, or themes with controlled allocations and measurable outcomes.
4
+
5
+ - Types & registry: \`packages/libs/contracts/src/experiments/spec.ts\`
6
+ - Runtime evaluator: \`packages/libs/contracts/src/experiments/evaluator.ts\`
7
+ - CLI wizard/template: \`contractspec create experiment\`
8
+
9
+ ## Structure
10
+
11
+ \`\`\`ts
12
+ export interface ExperimentSpec {
13
+ meta: ExperimentMeta;
14
+ controlVariant: string;
15
+ variants: ExperimentVariant[];
16
+ allocation: AllocationStrategy;
17
+ successMetrics?: SuccessMetric[];
18
+ }
19
+ \`\`\`
20
+
21
+ - \`variants\`: define UI/behavior overrides (data views, workflows, themes, policies)
22
+ - \`allocation\`:
23
+ - \`random\`: 50/50 or weighted via \`weight\`
24
+ - \`sticky\`: deterministic hash on user/organization/session
25
+ - \`targeted\`: rule-based (policy + expression + optional percentage)
26
+ - \`successMetrics\`: telemetry events + aggregation (count/avg/p95) to track outcomes
27
+
28
+ ### Example
29
+
30
+ \`\`\`ts
31
+ export const OnboardingSplitFormExperiment: ExperimentSpec = {
32
+ meta: {
33
+ name: 'sigil.onboarding.split_form',
34
+ version: 1,
35
+ title: 'Split onboarding form',
36
+ description: 'Compare single vs multi-step onboarding',
37
+ domain: 'onboarding',
38
+ owners: ['@team.onboarding'],
39
+ tags: ['experiment'],
40
+ stability: StabilityEnum.Experimental,
41
+ },
42
+ controlVariant: 'control',
43
+ variants: [
44
+ { id: 'control', name: 'Single-step form' },
45
+ {
46
+ id: 'multi_step',
47
+ name: 'Multi-step form',
48
+ overrides: [
49
+ { type: 'workflow', target: 'sigil.onboarding.workflow.multi_step' },
50
+ ],
51
+ },
52
+ ],
53
+ allocation: {
54
+ type: 'targeted',
55
+ rules: [
56
+ {
57
+ variantId: 'multi_step',
58
+ expression: "context.attributes?.segment === 'vip'",
59
+ },
60
+ ],
61
+ fallback: 'random',
62
+ },
63
+ successMetrics: [
64
+ {
65
+ name: 'Completion rate',
66
+ telemetryEvent: { name: 'sigil.telemetry.onboarding_completed', version: 1 },
67
+ aggregation: 'count',
68
+ },
69
+ ],
70
+ };
71
+ \`\`\`
72
+
73
+ ## Variant evaluation
74
+
75
+ \`\`\`ts
76
+ const evaluator = new ExperimentEvaluator({
77
+ registry: experimentRegistry,
78
+ policyChecker: (policyRef, context) =>
79
+ policyEngine.decide({
80
+ action: 'experiment_targeting',
81
+ subject: { roles: context.flags },
82
+ resource: { type: 'experiment', attributes: { name: context.experiment } },
83
+ policies: [policyRef],
84
+ }).effect === 'allow',
85
+ });
86
+
87
+ const assignment = await evaluator.chooseVariant({
88
+ experiment: 'sigil.onboarding.split_form',
89
+ userId: ctx.userId,
90
+ organizationId: ctx.organizationId,
91
+ attributes: ctx.attributes,
92
+ });
93
+
94
+ if (assignment) {
95
+ // Apply overrides for the chosen variant
96
+ applyExperimentOverrides(assignment.variant);
97
+ }
98
+ \`\`\`
99
+
100
+ - \`random\` uses deterministic hashing (\`salt\` optional) for stable splits
101
+ - \`sticky\` hashes a specified attribute (userId/orgId/sessionId)
102
+ - \`targeted\` evaluates rules in order; each rule can reference a PolicySpec and simple JS expressions (\`context\` input)
103
+
104
+ ## Integrations
105
+
106
+ - **Feature modules**: \`FeatureModuleSpec.experiments\` references experiments owned by a module
107
+ - **DataViewSpec / WorkflowSpec**: \`experiments?: ExperimentRef[]\` indicate which experiments modify the spec
108
+ - **Telemetry**: success metrics reference \`TelemetrySpec\` events to ensure compliant tracking
109
+ - **Policy**: targeting rules call into \`PolicyEngine\` via the evaluator callback to respect privacy/security
110
+
111
+ ## CLI workflow
112
+
113
+ \`\`\`
114
+ contractspec create experiment
115
+ \`\`\`
116
+
117
+ - Prompts for control/variants, allocation strategy, targeting rules, success metrics
118
+ - Outputs a typed \`ExperimentSpec\` file alongside your contracts
119
+
120
+ ## Best practices
121
+
122
+ 1. Keep experiments short-lived; increment \`meta.version\` when changing allocation or variants.
123
+ 2. Always declare a control variant and ensure overrides are reversible.
124
+ 3. Tie success metrics to privacy-reviewed telemetry events.
125
+ 4. Use targeting rules sparingly; combine with PolicySpec to avoid exposing experiments to unauthorized users.
126
+ 5. When an experiment wins, promote the variant to the canonical spec and retire the experiment.
127
+
128
+ `}];e(t);export{t as tech_contracts_experiments_DocBlocks};
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.forms`,title:`Contracts: FormSpec`,summary:`This document defines the canonical contracts for declarative forms.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/forms`,tags:[`tech`,`contracts`,`forms`],body:"# Contracts: FormSpec\n\nThis document defines the canonical contracts for declarative forms.\n\n## Overview\n\n- `FormSpec` (in `@lssm/lib.contracts/forms`) declares:\n - `meta` (extends `OwnerShipMeta`) + `key`/`version` for stability.\n - `model` (`@lssm/lib.schema` `SchemaModel`) as the single source of truth.\n - `fields` built from `FieldSpec` kinds: `text`, `textarea`, `select`, `checkbox`, `radio`, `switch`, `group`, `array`.\n - Optional `actions`, `policy.flags`, `constraints` and `renderHints`.\n- Relations DSL provides `visibleWhen`, `enabledWhen`, `requiredWhen` based on predicates.\n- `buildZodWithRelations(spec)` augments the base zod with conditional rules and constraints.\n- React adapter renders with React Hook Form + driver API for UI components (shadcn driver provided).\n\n## Driver API (UI-agnostic)\n\nHost apps supply a driver mapping slots → components:\n\n- Required: `Field`, `FieldLabel`, `FieldDescription`, `FieldError`, `Input`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `Button`.\n- Optional: `FieldGroup`, `FieldSet`, `FieldLegend` and input group helpers.\n\nUse `createFormRenderer({ driver })` to obtain a `render(spec)` function.\n\n## Arrays and Groups\n\n- `array` items are rendered with `useFieldArray`, honoring `min`/`max` and add/remove controls.\n- `group` composes nested fields and provides optional legend/description.\n\n## Feature Flags\n\n- Declare `policy.flags` on forms to signal gating. Gate usage at host boundary; avoid scattering flags across individual fields.\n\n## Example\n\nSee `packages/hcircle/apps/web-coliving/src/forms/bug-report.spec.ts` for a concrete form spec and `components/forms/BugReportFormDemo.tsx` for rendering with a minimal shadcn driver mapping.\n"}];e(t);export{t as tech_contracts_forms_DocBlocks};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{CapabilityRegistry as e,capabilityKey as t,defineCapability as n}from"./capabilities.js";import{DataViewRegistry as r,dataViewKey as i}from"./data-views.js";import{defineEvent as a,eventKey as o}from"./events.js";import{FeatureRegistry as s,installFeature as c,validateFeatureTargetsV2 as l}from"./features.js";import{FormRegistry as u,buildZodWithRelations as d,defineFormSpec as f,evalPredicate as p}from"./forms.js";import{TransformEngine as m,createDefaultTransformEngine as h,registerBasicValidation as g,registerDefaultReactRenderer as _}from"./presentations.v2.js";import{createEngineWithDefaults as v,createFeatureModule as y,registerFeature as b,renderFeaturePresentation as x}from"./client/react/feature-render.js";import{createFormRenderer as S}from"./client/react/form-render.js";import{shadcnDriver as C}from"./client/react/drivers/shadcn.js";import{rnReusablesDriver as w}from"./client/react/drivers/rn-reusables.js";import"./client/index.js";import{defaultGqlField as T,defaultMcpTool as E,defaultRestPath as D,jsonSchemaForSpec as O}from"./jsonschema.js";import{registerContractsOnBuilder as k}from"./server/graphql-pothos.js";import{exportContractsToGraphQLSchema as A}from"./server/graphql-schema-export.js";import{PresentationRegistry as j,jsonSchemaForPresentation as M}from"./presentations.js";import{createMcpServer as N}from"./server/provider-mcp.js";import{createFetchHandler as P}from"./server/rest-generic.js";import{elysiaPlugin as F}from"./server/rest-elysia.js";import{expressRouter as I}from"./server/rest-express.js";import{makeNextAppHandler as L}from"./server/rest-next-app.js";import{makeNextPagesHandler as R}from"./server/rest-next-pages.js";import"./server/index.js";import{defineCommand as z,defineQuery as B,isEmitDeclRef as V}from"./spec.js";import{SpecRegistry as H,opKey as U}from"./registry.js";import{installOp as W,makeEmit as G,op as K}from"./install.js";import{definePrompt as q}from"./prompt.js";import{PromptRegistry as J}from"./promptRegistry.js";import{ResourceRegistry as Y,defineResourceTemplate as X,isResourceRef as Z,resourceRef as Q}from"./resources.js";import{toV2FromV1 as $}from"./presentations.backcompat.js";import{Owners as ee,OwnersEnum as te,StabilityEnum as ne,Tags as re,TagsEnum as ie}from"./ownership.js";import{CompleteOnboardingBaseInput as ae,CompleteOnboardingBaseOutput as oe,CompleteOnboardingBaseSpec as se,DeleteOnboardingDraftBaseSpec as ce,DeleteOnboardingDraftOutput as le,GetOnboardingDraftBaseSpec as ue,GetOnboardingDraftOutput as de,SaveOnboardingDraftBaseSpec as fe,SaveOnboardingDraftInput as pe,SaveOnboardingDraftOutput as me}from"./onboarding-base.js";import{openBankingAccountsReadCapability as he,openBankingBalancesReadCapability as ge,openBankingTransactionsReadCapability as _e,registerOpenBankingCapabilities as ve}from"./capabilities/openbanking.js";import{PolicyRegistry as ye,makePolicyKey as be}from"./policy/spec.js";import{PolicyEngine as xe}from"./policy/engine.js";import{OPAPolicyAdapter as Se,buildOPAInput as Ce}from"./policy/opa-adapter.js";import{ThemeRegistry as we,makeThemeRef as Te}from"./themes.js";import{MigrationRegistry as Ee}from"./migrations.js";import{TelemetryRegistry as De,makeTelemetryKey as Oe}from"./telemetry/spec.js";import{TelemetryTracker as ke}from"./telemetry/tracker.js";import{TelemetryAnomalyMonitor as Ae}from"./telemetry/anomaly.js";import"./telemetry/index.js";import{TestRegistry as je,makeTestKey as Me}from"./tests/spec.js";import{TestRunner as Ne}from"./tests/runner.js";import"./tests/index.js";import{ExperimentRegistry as Pe,makeExperimentKey as Fe}from"./experiments/spec.js";import{ExperimentEvaluator as Ie}from"./experiments/evaluator.js";import{AppBlueprintRegistry as Le,makeAppBlueprintKey as Re}from"./app-config/spec.js";import{composeAppConfig as ze,resolveAppConfig as Be}from"./app-config/runtime.js";import{IntegrationSpecRegistry as Ve,makeIntegrationSpecKey as He}from"./integrations/spec.js";import{registerStripeIntegration as Ue,stripeIntegrationSpec as We}from"./integrations/providers/stripe.js";import{postmarkIntegrationSpec as Ge,registerPostmarkIntegration as Ke}from"./integrations/providers/postmark.js";import{qdrantIntegrationSpec as qe,registerQdrantIntegration as Je}from"./integrations/providers/qdrant.js";import{mistralIntegrationSpec as Ye,registerMistralIntegration as Xe}from"./integrations/providers/mistral.js";import{elevenLabsIntegrationSpec as Ze,registerElevenLabsIntegration as Qe}from"./integrations/providers/elevenlabs.js";import{gmailIntegrationSpec as $e,registerGmailIntegration as et}from"./integrations/providers/gmail.js";import{googleCalendarIntegrationSpec as tt,registerGoogleCalendarIntegration as nt}from"./integrations/providers/google-calendar.js";import{registerTwilioSmsIntegration as rt,twilioSmsIntegrationSpec as it}from"./integrations/providers/twilio-sms.js";import{gcsStorageIntegrationSpec as at,registerGcsStorageIntegration as ot}from"./integrations/providers/gcs-storage.js";import{powensIntegrationSpec as st,registerPowensIntegration as ct}from"./integrations/providers/powens.js";import{MistralLLMProvider as lt}from"./integrations/providers/impls/mistral-llm.js";import{MistralEmbeddingProvider as ut}from"./integrations/providers/impls/mistral-embedding.js";import{QdrantVectorProvider as dt}from"./integrations/providers/impls/qdrant-vector.js";import{GmailInboundProvider as ft}from"./integrations/providers/impls/gmail-inbound.js";import{GmailOutboundProvider as pt}from"./integrations/providers/impls/gmail-outbound.js";import{GoogleCalendarProvider as mt}from"./integrations/providers/impls/google-calendar.js";import{ElevenLabsVoiceProvider as ht}from"./integrations/providers/impls/elevenlabs-voice.js";import{GoogleCloudStorageProvider as gt}from"./integrations/providers/impls/gcs-storage.js";import{StripePaymentsProvider as _t}from"./integrations/providers/impls/stripe-payments.js";import{PostmarkEmailProvider as vt}from"./integrations/providers/impls/postmark-email.js";import{TwilioSmsProvider as yt}from"./integrations/providers/impls/twilio-sms.js";import{PowensClient as bt,PowensClientError as xt}from"./integrations/providers/impls/powens-client.js";import{PowensOpenBankingProvider as St}from"./integrations/providers/impls/powens-openbanking.js";import{IntegrationProviderFactory as Ct}from"./integrations/providers/impls/provider-factory.js";import{SecretProviderError as wt,normalizeSecretPayload as Tt,parseSecretUri as Et}from"./integrations/secrets/provider.js";import{GcpSecretManagerProvider as Dt}from"./integrations/secrets/gcp-secret-manager.js";import{EnvSecretProvider as Ot}from"./integrations/secrets/env-secret-provider.js";import{SecretProviderManager as kt}from"./integrations/secrets/manager.js";import{IntegrationCallGuard as At,connectionStatusLabel as jt,ensureConnectionReady as Mt}from"./integrations/runtime.js";import{IntegrationHealthService as Nt}from"./integrations/health.js";import{AccountBalanceRecord as Pt,BankAccountRecord as Ft,BankTransactionRecord as It}from"./integrations/openbanking/models.js";import{OPENBANKING_PII_FIELDS as Lt,OPENBANKING_TELEMETRY_EVENTS as Rt,redactOpenBankingTelemetryPayload as zt}from"./integrations/openbanking/telemetry.js";import{OpenBankingGetAccount as Bt,OpenBankingListAccounts as Vt,OpenBankingSyncAccounts as Ht}from"./integrations/openbanking/contracts/accounts.js";import{OpenBankingListTransactions as Ut,OpenBankingSyncTransactions as Wt}from"./integrations/openbanking/contracts/transactions.js";import{OpenBankingGetBalances as Gt,OpenBankingRefreshBalances as Kt}from"./integrations/openbanking/contracts/balances.js";import{registerOpenBankingContracts as qt}from"./integrations/openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as Jt,ensurePrimaryOpenBankingIntegration as Yt}from"./integrations/openbanking/guards.js";import"./integrations/index.js";import{KnowledgeSpaceRegistry as Xt,makeKnowledgeSpaceKey as Zt}from"./knowledge/spec.js";import{productCanonKnowledgeSpace as Qt,registerProductCanonKnowledgeSpace as $t}from"./knowledge/spaces/product-canon.js";import{registerSupportFaqKnowledgeSpace as en,supportFaqKnowledgeSpace as tn}from"./knowledge/spaces/support-faq.js";import{emailThreadsKnowledgeSpace as nn,registerEmailThreadsKnowledgeSpace as rn}from"./knowledge/spaces/email-threads.js";import{registerUploadedDocsKnowledgeSpace as an,uploadedDocsKnowledgeSpace as on}from"./knowledge/spaces/uploaded-docs.js";import{financialDocsKnowledgeSpace as sn,registerFinancialDocsKnowledgeSpace as cn}from"./knowledge/spaces/financial-docs.js";import{financialOverviewKnowledgeSpace as ln,registerFinancialOverviewKnowledgeSpace as un}from"./knowledge/spaces/financial-overview.js";import"./knowledge/index.js";import{CreateIntegrationConnection as dn,DeleteIntegrationConnection as fn,ListIntegrationConnections as pn,TestIntegrationConnection as mn,UpdateIntegrationConnection as hn,integrationContracts as gn,registerIntegrationContracts as _n}from"./integrations/contracts.js";import{CreateKnowledgeSource as vn,DeleteKnowledgeSource as yn,ListKnowledgeSources as bn,TriggerKnowledgeSourceSync as xn,UpdateKnowledgeSource as Sn,knowledgeContracts as Cn,registerKnowledgeContracts as wn}from"./knowledge/contracts.js";import{behaviorToEnvelope as Tn,errorToEnvelope as En,telemetryToEnvelope as Dn}from"./regenerator/utils.js";import{RegeneratorService as On}from"./regenerator/service.js";import{ProposalExecutor as kn}from"./regenerator/executor.js";import{ExecutorProposalSink as An}from"./regenerator/sinks.js";import"./regenerator/index.js";import{WorkflowRegistry as jn}from"./workflow/spec.js";import{WorkflowValidationError as Mn,assertWorkflowSpecValid as Nn,validateWorkflowSpec as Pn}from"./workflow/validation.js";import{evaluateExpression as Fn}from"./workflow/expression.js";import{WorkflowPreFlightError as In,WorkflowRunner as Ln}from"./workflow/runner.js";import{InMemoryStateStore as Rn}from"./workflow/adapters/memory-store.js";import{PrismaStateStore as zn}from"./workflow/adapters/db-adapter.js";import{createFileStateStore as Bn}from"./workflow/adapters/file-adapter.js";import"./workflow/index.js";export{Pt as AccountBalanceRecord,Le as AppBlueprintRegistry,Ft as BankAccountRecord,It as BankTransactionRecord,e as CapabilityRegistry,ae as CompleteOnboardingBaseInput,oe as CompleteOnboardingBaseOutput,se as CompleteOnboardingBaseSpec,dn as CreateIntegrationConnection,vn as CreateKnowledgeSource,r as DataViewRegistry,fn as DeleteIntegrationConnection,yn as DeleteKnowledgeSource,ce as DeleteOnboardingDraftBaseSpec,le as DeleteOnboardingDraftOutput,ht as ElevenLabsVoiceProvider,Ot as EnvSecretProvider,An as ExecutorProposalSink,Ie as ExperimentEvaluator,Pe as ExperimentRegistry,s as FeatureRegistry,u as FormRegistry,Dt as GcpSecretManagerProvider,ue as GetOnboardingDraftBaseSpec,de as GetOnboardingDraftOutput,ft as GmailInboundProvider,pt as GmailOutboundProvider,mt as GoogleCalendarProvider,gt as GoogleCloudStorageProvider,Rn as InMemoryStateStore,At as IntegrationCallGuard,Nt as IntegrationHealthService,Ct as IntegrationProviderFactory,Ve as IntegrationSpecRegistry,Xt as KnowledgeSpaceRegistry,pn as ListIntegrationConnections,bn as ListKnowledgeSources,Ee as MigrationRegistry,ut as MistralEmbeddingProvider,lt as MistralLLMProvider,Se as OPAPolicyAdapter,Lt as OPENBANKING_PII_FIELDS,Rt as OPENBANKING_TELEMETRY_EVENTS,Bt as OpenBankingGetAccount,Gt as OpenBankingGetBalances,Vt as OpenBankingListAccounts,Ut as OpenBankingListTransactions,Kt as OpenBankingRefreshBalances,Ht as OpenBankingSyncAccounts,Wt as OpenBankingSyncTransactions,ee as Owners,te as OwnersEnum,xe as PolicyEngine,ye as PolicyRegistry,vt as PostmarkEmailProvider,bt as PowensClient,xt as PowensClientError,St as PowensOpenBankingProvider,j as PresentationRegistry,zn as PrismaStateStore,J as PromptRegistry,kn as ProposalExecutor,dt as QdrantVectorProvider,On as RegeneratorService,Y as ResourceRegistry,fe as SaveOnboardingDraftBaseSpec,pe as SaveOnboardingDraftInput,me as SaveOnboardingDraftOutput,wt as SecretProviderError,kt as SecretProviderManager,H as SpecRegistry,ne as StabilityEnum,_t as StripePaymentsProvider,re as Tags,ie as TagsEnum,Ae as TelemetryAnomalyMonitor,De as TelemetryRegistry,ke as TelemetryTracker,mn as TestIntegrationConnection,je as TestRegistry,Ne as TestRunner,we as ThemeRegistry,m as TransformEngine,xn as TriggerKnowledgeSourceSync,yt as TwilioSmsProvider,hn as UpdateIntegrationConnection,Sn as UpdateKnowledgeSource,In as WorkflowPreFlightError,jn as WorkflowRegistry,Ln as WorkflowRunner,Mn as WorkflowValidationError,Jt as assertPrimaryOpenBankingReady,Nn as assertWorkflowSpecValid,Tn as behaviorToEnvelope,Ce as buildOPAInput,d as buildZodWithRelations,t as capabilityKey,ze as composeAppConfig,jt as connectionStatusLabel,h as createDefaultTransformEngine,v as createEngineWithDefaults,y as createFeatureModule,P as createFetchHandler,Bn as createFileStateStore,S as createFormRenderer,N as createMcpServer,i as dataViewKey,T as defaultGqlField,E as defaultMcpTool,D as defaultRestPath,n as defineCapability,z as defineCommand,a as defineEvent,f as defineFormSpec,q as definePrompt,B as defineQuery,X as defineResourceTemplate,Ze as elevenLabsIntegrationSpec,F as elysiaPlugin,nn as emailThreadsKnowledgeSpace,Mt as ensureConnectionReady,Yt as ensurePrimaryOpenBankingIntegration,En as errorToEnvelope,p as evalPredicate,Fn as evaluateExpression,o as eventKey,A as exportContractsToGraphQLSchema,I as expressRouter,sn as financialDocsKnowledgeSpace,ln as financialOverviewKnowledgeSpace,at as gcsStorageIntegrationSpec,$e as gmailIntegrationSpec,tt as googleCalendarIntegrationSpec,c as installFeature,W as installOp,gn as integrationContracts,V as isEmitDeclRef,Z as isResourceRef,M as jsonSchemaForPresentation,O as jsonSchemaForSpec,Cn as knowledgeContracts,Re as makeAppBlueprintKey,G as makeEmit,Fe as makeExperimentKey,He as makeIntegrationSpecKey,Zt as makeKnowledgeSpaceKey,L as makeNextAppHandler,R as makeNextPagesHandler,be as makePolicyKey,Oe as makeTelemetryKey,Me as makeTestKey,Te as makeThemeRef,Ye as mistralIntegrationSpec,Tt as normalizeSecretPayload,K as op,U as opKey,he as openBankingAccountsReadCapability,ge as openBankingBalancesReadCapability,_e as openBankingTransactionsReadCapability,Et as parseSecretUri,Ge as postmarkIntegrationSpec,st as powensIntegrationSpec,Qt as productCanonKnowledgeSpace,qe as qdrantIntegrationSpec,zt as redactOpenBankingTelemetryPayload,g as registerBasicValidation,k as registerContractsOnBuilder,_ as registerDefaultReactRenderer,Qe as registerElevenLabsIntegration,rn as registerEmailThreadsKnowledgeSpace,b as registerFeature,cn as registerFinancialDocsKnowledgeSpace,un as registerFinancialOverviewKnowledgeSpace,ot as registerGcsStorageIntegration,et as registerGmailIntegration,nt as registerGoogleCalendarIntegration,_n as registerIntegrationContracts,wn as registerKnowledgeContracts,Xe as registerMistralIntegration,ve as registerOpenBankingCapabilities,qt as registerOpenBankingContracts,Ke as registerPostmarkIntegration,ct as registerPowensIntegration,$t as registerProductCanonKnowledgeSpace,Je as registerQdrantIntegration,Ue as registerStripeIntegration,en as registerSupportFaqKnowledgeSpace,rt as registerTwilioSmsIntegration,an as registerUploadedDocsKnowledgeSpace,x as renderFeaturePresentation,Be as resolveAppConfig,Q as resourceRef,w as rnReusablesDriver,C as shadcnDriver,We as stripeIntegrationSpec,tn as supportFaqKnowledgeSpace,Dn as telemetryToEnvelope,$ as toV2FromV1,it as twilioSmsIntegrationSpec,on as uploadedDocsKnowledgeSpace,l as validateFeatureTargetsV2,Pn as validateWorkflowSpec};
1
+ import{CapabilityRegistry as e,capabilityKey as t,defineCapability as n}from"./capabilities.js";import{DataViewRegistry as r,dataViewKey as i}from"./data-views.js";import{defineEvent as a,eventKey as o}from"./events.js";import{FeatureRegistry as s,installFeature as c,validateFeatureTargetsV2 as l}from"./features.js";import{FormRegistry as u,buildZodWithRelations as d,defineFormSpec as f,evalPredicate as p}from"./forms.js";import{schemaToMarkdown as m,schemaToMarkdownDetail as h,schemaToMarkdownList as g,schemaToMarkdownSummary as _,schemaToMarkdownTable as v}from"./schema-to-markdown.js";import{TransformEngine as y,createDefaultTransformEngine as b,registerBasicValidation as x,registerDefaultReactRenderer as S,registerReactToMarkdownRenderer as C}from"./presentations.v2.js";import{createEngineWithDefaults as w,createFeatureModule as T,registerFeature as E,renderFeaturePresentation as D}from"./client/react/feature-render.js";import{createFormRenderer as O}from"./client/react/form-render.js";import{shadcnDriver as k}from"./client/react/drivers/shadcn.js";import{rnReusablesDriver as A}from"./client/react/drivers/rn-reusables.js";import"./client/index.js";import{defaultGqlField as j,defaultMcpTool as M,defaultRestPath as N,jsonSchemaForSpec as P}from"./jsonschema.js";import{registerContractsOnBuilder as F}from"./server/graphql-pothos.js";import{PresentationRegistry as I,jsonSchemaForPresentation as L}from"./presentations.js";import{createMcpServer as R}from"./server/mcp/createMcpServer.js";import{createFetchHandler as z}from"./server/rest-generic.js";import{elysiaPlugin as B}from"./server/rest-elysia.js";import{expressRouter as V}from"./server/rest-express.js";import{makeNextAppHandler as H}from"./server/rest-next-app.js";import{makeNextPagesHandler as U}from"./server/rest-next-pages.js";import"./server/index.js";import{defineCommand as W,defineQuery as G,isEmitDeclRef as K}from"./spec.js";import{docBlockToPresentationSpec as q,docBlockToPresentationV2 as J,docBlocksToPresentationRoutes as Y,docBlocksToPresentationSpecs as X,mapDocRoutes as Z}from"./docs/presentations.js";import{DocRegistry as Q,defaultDocRegistry as $,docId as ee,listRegisteredDocBlocks as te,registerDocBlocks as ne}from"./docs/registry.js";import{SpecRegistry as re,opKey as ie}from"./registry.js";import{Owners as ae,OwnersEnum as oe,StabilityEnum as se,Tags as ce,TagsEnum as le}from"./ownership.js";import{ContractRegistryFileSchema as ue,ContractRegistryItemSchema as de,ContractRegistryItemTypeSchema as fe,ContractRegistryManifestSchema as pe}from"./contract-registry/schemas.js";import"./contract-registry/index.js";import{installOp as me,makeEmit as he,op as ge}from"./install.js";import{openApiForRegistry as _e}from"./openapi.js";import{definePrompt as ve}from"./prompt.js";import{PromptRegistry as ye}from"./promptRegistry.js";import{ResourceRegistry as be,defineResourceTemplate as xe,isResourceRef as Se,resourceRef as Ce}from"./resources.js";import{toV2FromV1 as we}from"./presentations.backcompat.js";import{CompleteOnboardingBaseInput as Te,CompleteOnboardingBaseOutput as Ee,CompleteOnboardingBaseSpec as De,DeleteOnboardingDraftBaseSpec as Oe,DeleteOnboardingDraftOutput as ke,GetOnboardingDraftBaseSpec as Ae,GetOnboardingDraftOutput as je,SaveOnboardingDraftBaseSpec as Me,SaveOnboardingDraftInput as Ne,SaveOnboardingDraftOutput as Pe}from"./onboarding-base.js";import{openBankingAccountsReadCapability as Fe,openBankingBalancesReadCapability as Ie,openBankingTransactionsReadCapability as Le,registerOpenBankingCapabilities as Re}from"./capabilities/openbanking.js";import{PolicyRegistry as ze,makePolicyKey as Be}from"./policy/spec.js";import{PolicyEngine as Ve}from"./policy/engine.js";import{OPAPolicyAdapter as He,buildOPAInput as Ue}from"./policy/opa-adapter.js";import{ThemeRegistry as We,makeThemeRef as Ge}from"./themes.js";import{MigrationRegistry as Ke}from"./migrations.js";import{TelemetryRegistry as qe,makeTelemetryKey as Je}from"./telemetry/spec.js";import{TelemetryTracker as Ye}from"./telemetry/tracker.js";import{TelemetryAnomalyMonitor as Xe}from"./telemetry/anomaly.js";import"./telemetry/index.js";import{TestRegistry as Ze,makeTestKey as Qe}from"./tests/spec.js";import{TestRunner as $e}from"./tests/runner.js";import"./tests/index.js";import{ExperimentRegistry as et,makeExperimentKey as tt}from"./experiments/spec.js";import{ExperimentEvaluator as nt}from"./experiments/evaluator.js";import{AppBlueprintRegistry as rt,makeAppBlueprintKey as it}from"./app-config/spec.js";import{composeAppConfig as at,resolveAppConfig as ot}from"./app-config/runtime.js";import{IntegrationSpecRegistry as st,makeIntegrationSpecKey as ct}from"./integrations/spec.js";import{registerStripeIntegration as lt,stripeIntegrationSpec as ut}from"./integrations/providers/stripe.js";import{postmarkIntegrationSpec as dt,registerPostmarkIntegration as ft}from"./integrations/providers/postmark.js";import{qdrantIntegrationSpec as pt,registerQdrantIntegration as mt}from"./integrations/providers/qdrant.js";import{mistralIntegrationSpec as ht,registerMistralIntegration as gt}from"./integrations/providers/mistral.js";import{elevenLabsIntegrationSpec as _t,registerElevenLabsIntegration as vt}from"./integrations/providers/elevenlabs.js";import{gmailIntegrationSpec as yt,registerGmailIntegration as bt}from"./integrations/providers/gmail.js";import{googleCalendarIntegrationSpec as xt,registerGoogleCalendarIntegration as St}from"./integrations/providers/google-calendar.js";import{registerTwilioSmsIntegration as Ct,twilioSmsIntegrationSpec as wt}from"./integrations/providers/twilio-sms.js";import{gcsStorageIntegrationSpec as Tt,registerGcsStorageIntegration as Et}from"./integrations/providers/gcs-storage.js";import{powensIntegrationSpec as Dt,registerPowensIntegration as Ot}from"./integrations/providers/powens.js";import{createDefaultIntegrationSpecRegistry as kt}from"./integrations/providers/registry.js";import{AccountBalanceRecord as At,BankAccountRecord as jt,BankTransactionRecord as Mt}from"./integrations/openbanking/models.js";import{OPENBANKING_PII_FIELDS as Nt,OPENBANKING_TELEMETRY_EVENTS as Pt,redactOpenBankingTelemetryPayload as Ft}from"./integrations/openbanking/telemetry.js";import{OpenBankingGetAccount as It,OpenBankingListAccounts as Lt,OpenBankingSyncAccounts as Rt}from"./integrations/openbanking/contracts/accounts.js";import{OpenBankingListTransactions as zt,OpenBankingSyncTransactions as Bt}from"./integrations/openbanking/contracts/transactions.js";import{OpenBankingGetBalances as Vt,OpenBankingRefreshBalances as Ht}from"./integrations/openbanking/contracts/balances.js";import{OpenBankingFeature as Ut}from"./integrations/openbanking/openbanking.feature.js";import{registerOpenBankingContracts as Wt}from"./integrations/openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as Gt,ensurePrimaryOpenBankingIntegration as Kt}from"./integrations/openbanking/guards.js";import"./integrations/index.js";import{KnowledgeSpaceRegistry as qt,makeKnowledgeSpaceKey as Jt}from"./knowledge/spec.js";import{productCanonKnowledgeSpace as Yt,registerProductCanonKnowledgeSpace as Xt}from"./knowledge/spaces/product-canon.js";import{registerSupportFaqKnowledgeSpace as Zt,supportFaqKnowledgeSpace as Qt}from"./knowledge/spaces/support-faq.js";import{emailThreadsKnowledgeSpace as $t,registerEmailThreadsKnowledgeSpace as en}from"./knowledge/spaces/email-threads.js";import{registerUploadedDocsKnowledgeSpace as tn,uploadedDocsKnowledgeSpace as nn}from"./knowledge/spaces/uploaded-docs.js";import{financialDocsKnowledgeSpace as rn,registerFinancialDocsKnowledgeSpace as an}from"./knowledge/spaces/financial-docs.js";import{financialOverviewKnowledgeSpace as on,registerFinancialOverviewKnowledgeSpace as sn}from"./knowledge/spaces/financial-overview.js";import"./knowledge/index.js";import{CreateIntegrationConnection as cn,DeleteIntegrationConnection as ln,ListIntegrationConnections as un,TestIntegrationConnection as dn,UpdateIntegrationConnection as fn,integrationContracts as pn,registerIntegrationContracts as mn}from"./integrations/contracts.js";import{CreateKnowledgeSource as hn,DeleteKnowledgeSource as gn,ListKnowledgeSources as _n,TriggerKnowledgeSourceSync as vn,UpdateKnowledgeSource as yn,knowledgeContracts as bn,registerKnowledgeContracts as xn}from"./knowledge/contracts.js";import{behaviorToEnvelope as Sn,errorToEnvelope as Cn,telemetryToEnvelope as wn}from"./regenerator/utils.js";import{RegeneratorService as Tn}from"./regenerator/service.js";import{ProposalExecutor as En}from"./regenerator/executor.js";import{ExecutorProposalSink as Dn}from"./regenerator/sinks.js";import"./regenerator/index.js";import{WorkflowRegistry as On}from"./workflow/spec.js";import{WorkflowValidationError as kn,assertWorkflowSpecValid as An,validateWorkflowSpec as jn}from"./workflow/validation.js";import{evaluateExpression as Mn}from"./workflow/expression.js";import{WorkflowPreFlightError as Nn,WorkflowRunner as Pn}from"./workflow/runner.js";import{InMemoryStateStore as Fn}from"./workflow/adapters/memory-store.js";import{PrismaStateStore as In}from"./workflow/adapters/db-adapter.js";import{createFileStateStore as Ln}from"./workflow/adapters/file-adapter.js";import"./workflow/index.js";import{techContractsDocs as Rn}from"./docs/tech-contracts.docs.js";import{metaDocs as zn}from"./docs/meta.docs.js";import"./docs/index.js";import{docBlockToMarkdown as Bn,eventToMarkdown as Vn,exportFeature as Hn,exportSpec as Un,featureToMarkdown as Wn,presentationToMarkdown as Gn,specToAgentPrompt as Kn,specToContextMarkdown as qn,specToFullMarkdown as Jn}from"./llm/exporters.js";import{AGENT_SYSTEM_PROMPTS as Yn,formatPlanForAgent as Xn,generateFixViolationsPrompt as Zn,generateImplementationPlan as Qn,generateImplementationPrompt as $n,generateReviewPrompt as er,generateTestPrompt as tr,generateVerificationPrompt as nr}from"./llm/prompts.js";import"./llm/index.js";import{defineSchemaModel as rr}from"@lssm/lib.schema";export{Yn as AGENT_SYSTEM_PROMPTS,At as AccountBalanceRecord,rt as AppBlueprintRegistry,jt as BankAccountRecord,Mt as BankTransactionRecord,e as CapabilityRegistry,Te as CompleteOnboardingBaseInput,Ee as CompleteOnboardingBaseOutput,De as CompleteOnboardingBaseSpec,ue as ContractRegistryFileSchema,de as ContractRegistryItemSchema,fe as ContractRegistryItemTypeSchema,pe as ContractRegistryManifestSchema,cn as CreateIntegrationConnection,hn as CreateKnowledgeSource,r as DataViewRegistry,ln as DeleteIntegrationConnection,gn as DeleteKnowledgeSource,Oe as DeleteOnboardingDraftBaseSpec,ke as DeleteOnboardingDraftOutput,Q as DocRegistry,Dn as ExecutorProposalSink,nt as ExperimentEvaluator,et as ExperimentRegistry,s as FeatureRegistry,u as FormRegistry,Ae as GetOnboardingDraftBaseSpec,je as GetOnboardingDraftOutput,Fn as InMemoryStateStore,st as IntegrationSpecRegistry,qt as KnowledgeSpaceRegistry,un as ListIntegrationConnections,_n as ListKnowledgeSources,Ke as MigrationRegistry,He as OPAPolicyAdapter,Nt as OPENBANKING_PII_FIELDS,Pt as OPENBANKING_TELEMETRY_EVENTS,Ut as OpenBankingFeature,It as OpenBankingGetAccount,Vt as OpenBankingGetBalances,Lt as OpenBankingListAccounts,zt as OpenBankingListTransactions,Ht as OpenBankingRefreshBalances,Rt as OpenBankingSyncAccounts,Bt as OpenBankingSyncTransactions,ae as Owners,oe as OwnersEnum,Ve as PolicyEngine,ze as PolicyRegistry,I as PresentationRegistry,In as PrismaStateStore,ye as PromptRegistry,En as ProposalExecutor,Tn as RegeneratorService,be as ResourceRegistry,Me as SaveOnboardingDraftBaseSpec,Ne as SaveOnboardingDraftInput,Pe as SaveOnboardingDraftOutput,re as SpecRegistry,se as StabilityEnum,ce as Tags,le as TagsEnum,Xe as TelemetryAnomalyMonitor,qe as TelemetryRegistry,Ye as TelemetryTracker,dn as TestIntegrationConnection,Ze as TestRegistry,$e as TestRunner,We as ThemeRegistry,y as TransformEngine,vn as TriggerKnowledgeSourceSync,fn as UpdateIntegrationConnection,yn as UpdateKnowledgeSource,Nn as WorkflowPreFlightError,On as WorkflowRegistry,Pn as WorkflowRunner,kn as WorkflowValidationError,Gt as assertPrimaryOpenBankingReady,An as assertWorkflowSpecValid,Sn as behaviorToEnvelope,Ue as buildOPAInput,d as buildZodWithRelations,t as capabilityKey,at as composeAppConfig,kt as createDefaultIntegrationSpecRegistry,b as createDefaultTransformEngine,w as createEngineWithDefaults,T as createFeatureModule,z as createFetchHandler,Ln as createFileStateStore,O as createFormRenderer,R as createMcpServer,i as dataViewKey,$ as defaultDocRegistry,j as defaultGqlField,M as defaultMcpTool,N as defaultRestPath,n as defineCapability,W as defineCommand,a as defineEvent,f as defineFormSpec,ve as definePrompt,G as defineQuery,xe as defineResourceTemplate,rr as defineSchemaModel,Bn as docBlockToMarkdown,q as docBlockToPresentationSpec,J as docBlockToPresentationV2,Y as docBlocksToPresentationRoutes,X as docBlocksToPresentationSpecs,ee as docId,_t as elevenLabsIntegrationSpec,B as elysiaPlugin,$t as emailThreadsKnowledgeSpace,Kt as ensurePrimaryOpenBankingIntegration,Cn as errorToEnvelope,p as evalPredicate,Mn as evaluateExpression,o as eventKey,Vn as eventToMarkdown,Hn as exportFeature,Un as exportSpec,V as expressRouter,Wn as featureToMarkdown,rn as financialDocsKnowledgeSpace,on as financialOverviewKnowledgeSpace,Xn as formatPlanForAgent,Tt as gcsStorageIntegrationSpec,Zn as generateFixViolationsPrompt,Qn as generateImplementationPlan,$n as generateImplementationPrompt,er as generateReviewPrompt,tr as generateTestPrompt,nr as generateVerificationPrompt,yt as gmailIntegrationSpec,xt as googleCalendarIntegrationSpec,c as installFeature,me as installOp,pn as integrationContracts,K as isEmitDeclRef,Se as isResourceRef,L as jsonSchemaForPresentation,P as jsonSchemaForSpec,bn as knowledgeContracts,te as listRegisteredDocBlocks,it as makeAppBlueprintKey,he as makeEmit,tt as makeExperimentKey,ct as makeIntegrationSpecKey,Jt as makeKnowledgeSpaceKey,H as makeNextAppHandler,U as makeNextPagesHandler,Be as makePolicyKey,Je as makeTelemetryKey,Qe as makeTestKey,Ge as makeThemeRef,Z as mapDocRoutes,zn as metaDocs,ht as mistralIntegrationSpec,ge as op,ie as opKey,_e as openApiForRegistry,Fe as openBankingAccountsReadCapability,Ie as openBankingBalancesReadCapability,Le as openBankingTransactionsReadCapability,dt as postmarkIntegrationSpec,Dt as powensIntegrationSpec,Gn as presentationToMarkdown,Yt as productCanonKnowledgeSpace,pt as qdrantIntegrationSpec,Ft as redactOpenBankingTelemetryPayload,x as registerBasicValidation,F as registerContractsOnBuilder,S as registerDefaultReactRenderer,ne as registerDocBlocks,vt as registerElevenLabsIntegration,en as registerEmailThreadsKnowledgeSpace,E as registerFeature,an as registerFinancialDocsKnowledgeSpace,sn as registerFinancialOverviewKnowledgeSpace,Et as registerGcsStorageIntegration,bt as registerGmailIntegration,St as registerGoogleCalendarIntegration,mn as registerIntegrationContracts,xn as registerKnowledgeContracts,gt as registerMistralIntegration,Re as registerOpenBankingCapabilities,Wt as registerOpenBankingContracts,ft as registerPostmarkIntegration,Ot as registerPowensIntegration,Xt as registerProductCanonKnowledgeSpace,mt as registerQdrantIntegration,C as registerReactToMarkdownRenderer,lt as registerStripeIntegration,Zt as registerSupportFaqKnowledgeSpace,Ct as registerTwilioSmsIntegration,tn as registerUploadedDocsKnowledgeSpace,D as renderFeaturePresentation,ot as resolveAppConfig,Ce as resourceRef,A as rnReusablesDriver,m as schemaToMarkdown,h as schemaToMarkdownDetail,g as schemaToMarkdownList,_ as schemaToMarkdownSummary,v as schemaToMarkdownTable,k as shadcnDriver,Kn as specToAgentPrompt,qn as specToContextMarkdown,Jn as specToFullMarkdown,ut as stripeIntegrationSpec,Qt as supportFaqKnowledgeSpace,Rn as techContractsDocs,wn as telemetryToEnvelope,we as toV2FromV1,wt as twilioSmsIntegrationSpec,nn as uploadedDocsKnowledgeSpace,l as validateFeatureTargetsV2,jn as validateWorkflowSpec};
package/dist/install.js CHANGED
@@ -1 +1 @@
1
- import"./registry.js";import{z as e}from"zod";function t(e,t){return{ref:async(e,n)=>{await t.__emitGuard__?.(e.name,e.version,n)},named:async(e,n,r)=>{await t.__emitGuard__?.(e,n,r)},object:async e=>{await t.__emitGuard__?.(e.name,e.version,e.payload)}}}function n(e,t,n){return e.register(t).bind(t,n)}function r(e,t){return{spec:e,handler:t,install:r=>n(r,e,t)}}export{n as installOp,t as makeEmit,r as op};
1
+ import"./registry.js";import"zod";function e(e,t){return{ref:async(e,n)=>{await t.__emitGuard__?.(e.name,e.version,n)},named:async(e,n,r)=>{await t.__emitGuard__?.(e,n,r)},object:async e=>{await t.__emitGuard__?.(e.name,e.version,e.payload)}}}function t(e,t,n){return e.register(t).bind(t,n)}function n(e,n){return{spec:e,handler:n,install:r=>t(r,e,n)}}export{t as installOp,e as makeEmit,n as op};
@@ -1 +1 @@
1
- import{l as e}from"../schema/dist/ScalarTypeEnum.js";import{t}from"../schema/dist/SchemaModel.js";import"../schema/dist/index.js";import{defineCommand as n,defineQuery as r}from"../spec.js";const i=new t({name:`IntegrationConnectionRecord`,fields:{id:{type:e.ID(),isOptional:!1},tenantId:{type:e.ID(),isOptional:!1},integrationKey:{type:e.NonEmptyString(),isOptional:!1},integrationVersion:{type:e.Int_unsecure(),isOptional:!1},label:{type:e.String_unsecure(),isOptional:!1},ownershipMode:{type:e.String_unsecure(),isOptional:!1},externalAccountId:{type:e.String_unsecure(),isOptional:!0},secretProvider:{type:e.String_unsecure(),isOptional:!1},secretRef:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},environment:{type:e.String_unsecure(),isOptional:!0},healthStatus:{type:e.String_unsecure(),isOptional:!0},healthCheckedAt:{type:e.DateTime(),isOptional:!0},healthLatencyMs:{type:e.Float_unsecure(),isOptional:!0},healthErrorCode:{type:e.String_unsecure(),isOptional:!0},healthErrorMessage:{type:e.String_unsecure(),isOptional:!0},usageRequestCount:{type:e.Int_unsecure(),isOptional:!0},usageSuccessCount:{type:e.Int_unsecure(),isOptional:!0},usageErrorCount:{type:e.Int_unsecure(),isOptional:!0},usageLastUsedAt:{type:e.DateTime(),isOptional:!0},usageLastErrorAt:{type:e.DateTime(),isOptional:!0},usageLastErrorCode:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!0},updatedAt:{type:e.DateTime(),isOptional:!0}}}),a=new t({name:`CreateIntegrationConnectionInput`,fields:{tenantId:{type:e.ID(),isOptional:!1},integrationKey:{type:e.NonEmptyString(),isOptional:!1},integrationVersion:{type:e.Int_unsecure(),isOptional:!1},label:{type:e.String_unsecure(),isOptional:!1},ownershipMode:{type:e.String_unsecure(),isOptional:!1},externalAccountId:{type:e.String_unsecure(),isOptional:!0},secretProvider:{type:e.String_unsecure(),isOptional:!1},secretRef:{type:e.String_unsecure(),isOptional:!1},environment:{type:e.String_unsecure(),isOptional:!0},config:{type:e.JSONObject(),isOptional:!1}}}),o=new t({name:`UpdateIntegrationConnectionInput`,fields:{connectionId:{type:e.ID(),isOptional:!1},label:{type:e.String_unsecure(),isOptional:!0},status:{type:e.String_unsecure(),isOptional:!0},ownershipMode:{type:e.String_unsecure(),isOptional:!0},externalAccountId:{type:e.String_unsecure(),isOptional:!0},secretProvider:{type:e.String_unsecure(),isOptional:!0},secretRef:{type:e.String_unsecure(),isOptional:!0},config:{type:e.JSONObject(),isOptional:!0}}}),s=new t({name:`DeleteIntegrationConnectionInput`,fields:{connectionId:{type:e.ID(),isOptional:!1}}}),c=new t({name:`ListIntegrationConnectionsInput`,fields:{tenantId:{type:e.ID(),isOptional:!1},category:{type:e.String_unsecure(),isOptional:!0},status:{type:e.String_unsecure(),isOptional:!0}}}),l=new t({name:`ListIntegrationConnectionsOutput`,fields:{connections:{type:i,isOptional:!1,isArray:!0}}}),u=new t({name:`TestIntegrationConnectionInput`,fields:{connectionId:{type:e.ID(),isOptional:!1}}}),d=new t({name:`TestIntegrationConnectionOutput`,fields:{success:{type:e.Boolean(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!0},latencyMs:{type:e.Float_unsecure(),isOptional:!0},error:{type:e.String_unsecure(),isOptional:!0},errorCode:{type:e.String_unsecure(),isOptional:!0}}}),f=new t({name:`DeleteIntegrationConnectionOutput`,fields:{success:{type:e.Boolean(),isOptional:!1}}}),p=n({meta:{name:`integrations.connection.create`,version:1,description:`Create a new integration connection for a tenant.`,goal:`Provision a tenant-scoped connection to an external provider.`,context:`Used by Ops or the App Studio to configure external integrations such as Stripe or Qdrant.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:a,output:i},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),m=n({meta:{name:`integrations.connection.update`,version:1,description:`Update metadata or credentials for an integration connection.`,goal:`Allow secure rotation of credentials and metadata adjustments.`,context:`Supports rotating API keys, toggling status, or updating labels for tenant integrations.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:o,output:i},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),h=n({meta:{name:`integrations.connection.delete`,version:1,description:`Delete an integration connection for a tenant.`,goal:`Safely remove credentials and disable connector usage.`,context:`Ensures connections are de-provisioned when no longer needed or breached.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:s,output:f},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),g=r({meta:{name:`integrations.connection.list`,version:1,description:`List integration connections for a tenant.`,goal:`Provide visibility into configured integrations and their status.`,context:`Used by the App Studio and Ops flows to show bindings and health.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:c,output:l},policy:{auth:`admin`,policies:[{name:`platform.integration.read`,version:1}]}}),_=n({meta:{name:`integrations.connection.test`,version:1,description:`Run a health check against a configured integration connection.`,goal:`Validate credentials and connectivity for external providers.`,context:`Triggered manually or by background monitors to confirm provider availability.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:u,output:d},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),v={CreateIntegrationConnection:p,UpdateIntegrationConnection:m,DeleteIntegrationConnection:h,ListIntegrationConnections:g,TestIntegrationConnection:_};function y(e){return e.register(p).register(m).register(h).register(g).register(_)}export{p as CreateIntegrationConnection,h as DeleteIntegrationConnection,g as ListIntegrationConnections,_ as TestIntegrationConnection,m as UpdateIntegrationConnection,v as integrationContracts,y as registerIntegrationContracts};
1
+ import{defineCommand as e,defineQuery as t}from"../spec.js";import{ScalarTypeEnum as n,SchemaModel as r}from"@lssm/lib.schema";const i=new r({name:`IntegrationConnectionRecord`,fields:{id:{type:n.ID(),isOptional:!1},tenantId:{type:n.ID(),isOptional:!1},integrationKey:{type:n.NonEmptyString(),isOptional:!1},integrationVersion:{type:n.Int_unsecure(),isOptional:!1},label:{type:n.String_unsecure(),isOptional:!1},ownershipMode:{type:n.String_unsecure(),isOptional:!1},externalAccountId:{type:n.String_unsecure(),isOptional:!0},secretProvider:{type:n.String_unsecure(),isOptional:!1},secretRef:{type:n.String_unsecure(),isOptional:!1},status:{type:n.String_unsecure(),isOptional:!1},environment:{type:n.String_unsecure(),isOptional:!0},healthStatus:{type:n.String_unsecure(),isOptional:!0},healthCheckedAt:{type:n.DateTime(),isOptional:!0},healthLatencyMs:{type:n.Float_unsecure(),isOptional:!0},healthErrorCode:{type:n.String_unsecure(),isOptional:!0},healthErrorMessage:{type:n.String_unsecure(),isOptional:!0},usageRequestCount:{type:n.Int_unsecure(),isOptional:!0},usageSuccessCount:{type:n.Int_unsecure(),isOptional:!0},usageErrorCount:{type:n.Int_unsecure(),isOptional:!0},usageLastUsedAt:{type:n.DateTime(),isOptional:!0},usageLastErrorAt:{type:n.DateTime(),isOptional:!0},usageLastErrorCode:{type:n.String_unsecure(),isOptional:!0},createdAt:{type:n.DateTime(),isOptional:!0},updatedAt:{type:n.DateTime(),isOptional:!0}}}),a=new r({name:`CreateIntegrationConnectionInput`,fields:{tenantId:{type:n.ID(),isOptional:!1},integrationKey:{type:n.NonEmptyString(),isOptional:!1},integrationVersion:{type:n.Int_unsecure(),isOptional:!1},label:{type:n.String_unsecure(),isOptional:!1},ownershipMode:{type:n.String_unsecure(),isOptional:!1},externalAccountId:{type:n.String_unsecure(),isOptional:!0},secretProvider:{type:n.String_unsecure(),isOptional:!1},secretRef:{type:n.String_unsecure(),isOptional:!1},environment:{type:n.String_unsecure(),isOptional:!0},config:{type:n.JSONObject(),isOptional:!1}}}),o=new r({name:`UpdateIntegrationConnectionInput`,fields:{connectionId:{type:n.ID(),isOptional:!1},label:{type:n.String_unsecure(),isOptional:!0},status:{type:n.String_unsecure(),isOptional:!0},ownershipMode:{type:n.String_unsecure(),isOptional:!0},externalAccountId:{type:n.String_unsecure(),isOptional:!0},secretProvider:{type:n.String_unsecure(),isOptional:!0},secretRef:{type:n.String_unsecure(),isOptional:!0},config:{type:n.JSONObject(),isOptional:!0}}}),s=new r({name:`DeleteIntegrationConnectionInput`,fields:{connectionId:{type:n.ID(),isOptional:!1}}}),c=new r({name:`ListIntegrationConnectionsInput`,fields:{tenantId:{type:n.ID(),isOptional:!1},category:{type:n.String_unsecure(),isOptional:!0},status:{type:n.String_unsecure(),isOptional:!0}}}),l=new r({name:`ListIntegrationConnectionsOutput`,fields:{connections:{type:i,isOptional:!1,isArray:!0}}}),u=new r({name:`TestIntegrationConnectionInput`,fields:{connectionId:{type:n.ID(),isOptional:!1}}}),d=new r({name:`TestIntegrationConnectionOutput`,fields:{success:{type:n.Boolean(),isOptional:!1},status:{type:n.String_unsecure(),isOptional:!0},latencyMs:{type:n.Float_unsecure(),isOptional:!0},error:{type:n.String_unsecure(),isOptional:!0},errorCode:{type:n.String_unsecure(),isOptional:!0}}}),f=new r({name:`DeleteIntegrationConnectionOutput`,fields:{success:{type:n.Boolean(),isOptional:!1}}}),p=e({meta:{name:`integrations.connection.create`,version:1,description:`Create a new integration connection for a tenant.`,goal:`Provision a tenant-scoped connection to an external provider.`,context:`Used by Ops or the App Studio to configure external integrations such as Stripe or Qdrant.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:a,output:i},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),m=e({meta:{name:`integrations.connection.update`,version:1,description:`Update metadata or credentials for an integration connection.`,goal:`Allow secure rotation of credentials and metadata adjustments.`,context:`Supports rotating API keys, toggling status, or updating labels for tenant integrations.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:o,output:i},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),h=e({meta:{name:`integrations.connection.delete`,version:1,description:`Delete an integration connection for a tenant.`,goal:`Safely remove credentials and disable connector usage.`,context:`Ensures connections are de-provisioned when no longer needed or breached.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:s,output:f},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),g=t({meta:{name:`integrations.connection.list`,version:1,description:`List integration connections for a tenant.`,goal:`Provide visibility into configured integrations and their status.`,context:`Used by the App Studio and Ops flows to show bindings and health.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:c,output:l},policy:{auth:`admin`,policies:[{name:`platform.integration.read`,version:1}]}}),_=e({meta:{name:`integrations.connection.test`,version:1,description:`Run a health check against a configured integration connection.`,goal:`Validate credentials and connectivity for external providers.`,context:`Triggered manually or by background monitors to confirm provider availability.`,owners:[`platform.integrations`],tags:[`integration`,`connections`],stability:`experimental`},io:{input:u,output:d},policy:{auth:`admin`,policies:[{name:`platform.integration.manage`,version:1}]}}),v={CreateIntegrationConnection:p,UpdateIntegrationConnection:m,DeleteIntegrationConnection:h,ListIntegrationConnections:g,TestIntegrationConnection:_};function y(e){return e.register(p).register(m).register(h).register(g).register(_)}export{p as CreateIntegrationConnection,h as DeleteIntegrationConnection,g as ListIntegrationConnections,_ as TestIntegrationConnection,m as UpdateIntegrationConnection,v as integrationContracts,y as registerIntegrationContracts};
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.integrations`,title:`ContractSpec Integrations`,summary:`Provider-agnostic integration contracts: specs, connections, secrets, health checks, and runtime guards.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/integrations`,tags:[`tech`,`contracts`,`integrations`],body:"# ContractSpec Integrations\n\nThis document describes the integration architecture that powers ContractSpec-based apps. It focuses on provider-agnostic contracts, secret management, health checks, and runtime guards.\n\n## Core Concepts\n\n- **IntegrationSpec** – declarative description of a provider that lists supported ownership modes, capability mappings, configuration schema, secret schema, health check policy, and documentation metadata.\n- **IntegrationConnection** – tenant/environment binding to a provider (`meta` + ownership mode + config + `secretRef`). Secrets are never embedded in specs or configs.\n- **AppIntegrationSlot** – blueprint-level requirement that declares which integration categories/capabilities must be satisfied at runtime (e.g. `primaryLLM`, `primaryVectorDb`).\n- **AppIntegrationBinding** – tenant-level slot → connection mapping.\n- **ResolvedIntegration** – runtime view containing slot metadata, connection details, and the resolved IntegrationSpec.\n\n## Registered Providers\n\nThe contracts library ships ten priority providers in `packages/libs/contracts/src/integrations/providers`:\n\n| Category | Provider | Key | Notes |\n| ------------- | ---------------- | --------------------------- | ------------------------------------------------- |\n| payments | Stripe | `payments.stripe` | Card + invoice flows, managed or BYOK credentials |\n| email (out) | Postmark | `email.postmark` | Transactional email delivery |\n| email (in) | Gmail API | `email.gmail` | Thread ingestion (OAuth BYOK or service account) |\n| calendar | Google Calendar | `calendar.google` | Event scheduling via service account |\n| vector-db | Qdrant | `vectordb.qdrant` | Embedding storage & search |\n| storage | Google Cloud | `storage.gcs` | Object storage |\n| ai-llm | Mistral | `ai-llm.mistral` | Primary chat + embedding provider |\n| ai-voice | ElevenLabs | `ai-voice.elevenlabs` | Text-to-speech synthesis |\n| sms | Twilio SMS | `sms.twilio` | Urgent and fallback reminders |\n| open-banking | Powens | `openbanking.powens` | Read-only account, transaction, and balance sync |\n\nEach provider ships with:\n\n- Strongly typed adapter interfaces (`payments.ts`, `llm.ts`, etc.)\n- A concrete SDK-backed implementation under `providers/impls`\n- Unit tests validating adapter behaviour and health checks\n\n### Canonical registry builder\n\nTo list all shipped specs at runtime, use:\n\n- `createDefaultIntegrationSpecRegistry()` from `@lssm/lib.contracts/integrations/providers/registry`\n\n## Secret Management\n\nAll integrations rely on the `SecretProvider` abstraction defined in `integrations/secrets`. Providers ship with the contracts library and are orchestrated by the `SecretProviderManager` composite:\n\n- **EnvSecretProvider** (`env-secret-provider.ts`) – high-priority, read-only overrides backed by environment variables.\n - Supports the `env://VARIABLE_NAME` scheme\n - Supports overrides for other schemes via `?env=ALIAS` or derived uppercase keys\n- **GcpSecretManagerProvider** (`gcp-secret-manager.ts`) – versioned secrets stored in Google Cloud Secret Manager.\n - Example: `gcp://projects/demo/secrets/stripe-key/versions/latest`\n- **AwsSecretsManagerProvider** (`aws-secret-manager.ts`) – AWS Secrets Manager backend.\n - Example: `aws://secretsmanager/eu-west-1/my-secret?version=AWSCURRENT`\n - Region may be in the reference or provided via `AWS_REGION` / `AWS_DEFAULT_REGION`\n- **ScalewaySecretManagerProvider** (`scaleway-secret-manager.ts`) – Scaleway Secret Manager backend.\n - Example (id): `scw://secret-manager/fr-par/1234...-uuid?version=latest`\n - Example (name, create+write): `scw://secret-manager/fr-par/my-secret-name`\n - Requires `SCW_SECRET_KEY` (token) and `SCW_DEFAULT_PROJECT_ID` when creating secrets by name\n\nThe manager attempts providers in priority order (environment first, then cloud providers). Key points:\n\n- `secretRef` is a URI-like reference; raw secrets are never returned.\n- `IntegrationCallGuard` fetches and parses secrets before executing a provider adapter.\n- Local development can rely on `.env` files, while staging/production reference cloud secret stores.\n\n## Health Checks & Telemetry\n\n- Each IntegrationSpec optionally declares `healthCheck.method` and timeouts.\n- `IntegrationCallGuard` enforces connection status, wraps retries with exponential back-off, and emits telemetry events tagged with tenant/app/slot metadata.\n- Validation rules (`app-config/validation.ts`) surface issues at publish time (slot mismatch, unsupported ownership modes, missing capabilities, etc.).\n\n## Studio persistence (ContractSpec Studio)\n\nContractSpec Studio persists tenant `IntegrationConnection` records in Postgres (Prisma model `IntegrationConnection` in `@lssm/lib.database-contractspec-studio`) and exposes a platform-admin management surface (see the Studio platform admin panel).\n"}];e(t);export{t as tech_contracts_integrations_DocBlocks};
@@ -1 +1 @@
1
- import{IntegrationSpecRegistry as e,makeIntegrationSpecKey as t}from"./spec.js";import{registerStripeIntegration as n,stripeIntegrationSpec as r}from"./providers/stripe.js";import{postmarkIntegrationSpec as i,registerPostmarkIntegration as a}from"./providers/postmark.js";import{qdrantIntegrationSpec as o,registerQdrantIntegration as s}from"./providers/qdrant.js";import{mistralIntegrationSpec as c,registerMistralIntegration as l}from"./providers/mistral.js";import{elevenLabsIntegrationSpec as u,registerElevenLabsIntegration as d}from"./providers/elevenlabs.js";import{gmailIntegrationSpec as f,registerGmailIntegration as p}from"./providers/gmail.js";import{googleCalendarIntegrationSpec as m,registerGoogleCalendarIntegration as h}from"./providers/google-calendar.js";import{registerTwilioSmsIntegration as g,twilioSmsIntegrationSpec as _}from"./providers/twilio-sms.js";import{gcsStorageIntegrationSpec as v,registerGcsStorageIntegration as y}from"./providers/gcs-storage.js";import{powensIntegrationSpec as b,registerPowensIntegration as x}from"./providers/powens.js";import{MistralLLMProvider as S}from"./providers/impls/mistral-llm.js";import{MistralEmbeddingProvider as C}from"./providers/impls/mistral-embedding.js";import{QdrantVectorProvider as w}from"./providers/impls/qdrant-vector.js";import{GmailInboundProvider as T}from"./providers/impls/gmail-inbound.js";import{GmailOutboundProvider as E}from"./providers/impls/gmail-outbound.js";import{GoogleCalendarProvider as D}from"./providers/impls/google-calendar.js";import{ElevenLabsVoiceProvider as O}from"./providers/impls/elevenlabs-voice.js";import{GoogleCloudStorageProvider as k}from"./providers/impls/gcs-storage.js";import{StripePaymentsProvider as A}from"./providers/impls/stripe-payments.js";import{PostmarkEmailProvider as j}from"./providers/impls/postmark-email.js";import{TwilioSmsProvider as M}from"./providers/impls/twilio-sms.js";import{PowensClient as N,PowensClientError as P}from"./providers/impls/powens-client.js";import{PowensOpenBankingProvider as F}from"./providers/impls/powens-openbanking.js";import{IntegrationProviderFactory as I}from"./providers/impls/provider-factory.js";import"./providers/index.js";import{SecretProviderError as L,normalizeSecretPayload as R,parseSecretUri as z}from"./secrets/provider.js";import{GcpSecretManagerProvider as B}from"./secrets/gcp-secret-manager.js";import{EnvSecretProvider as V}from"./secrets/env-secret-provider.js";import{SecretProviderManager as H}from"./secrets/manager.js";import"./secrets/index.js";import{IntegrationCallGuard as U,connectionStatusLabel as W,ensureConnectionReady as G}from"./runtime.js";import{IntegrationHealthService as K}from"./health.js";import{AccountBalanceRecord as q,BankAccountRecord as J,BankTransactionRecord as Y}from"./openbanking/models.js";import{OPENBANKING_PII_FIELDS as X,OPENBANKING_TELEMETRY_EVENTS as Z,redactOpenBankingTelemetryPayload as Q}from"./openbanking/telemetry.js";import{OpenBankingGetAccount as $,OpenBankingListAccounts as ee,OpenBankingSyncAccounts as te}from"./openbanking/contracts/accounts.js";import{OpenBankingListTransactions as ne,OpenBankingSyncTransactions as re}from"./openbanking/contracts/transactions.js";import{OpenBankingGetBalances as ie,OpenBankingRefreshBalances as ae}from"./openbanking/contracts/balances.js";import{registerOpenBankingContracts as oe}from"./openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as se,ensurePrimaryOpenBankingIntegration as ce}from"./openbanking/guards.js";export{q as AccountBalanceRecord,J as BankAccountRecord,Y as BankTransactionRecord,O as ElevenLabsVoiceProvider,V as EnvSecretProvider,B as GcpSecretManagerProvider,T as GmailInboundProvider,E as GmailOutboundProvider,D as GoogleCalendarProvider,k as GoogleCloudStorageProvider,U as IntegrationCallGuard,K as IntegrationHealthService,I as IntegrationProviderFactory,e as IntegrationSpecRegistry,C as MistralEmbeddingProvider,S as MistralLLMProvider,X as OPENBANKING_PII_FIELDS,Z as OPENBANKING_TELEMETRY_EVENTS,$ as OpenBankingGetAccount,ie as OpenBankingGetBalances,ee as OpenBankingListAccounts,ne as OpenBankingListTransactions,ae as OpenBankingRefreshBalances,te as OpenBankingSyncAccounts,re as OpenBankingSyncTransactions,j as PostmarkEmailProvider,N as PowensClient,P as PowensClientError,F as PowensOpenBankingProvider,w as QdrantVectorProvider,L as SecretProviderError,H as SecretProviderManager,A as StripePaymentsProvider,M as TwilioSmsProvider,se as assertPrimaryOpenBankingReady,W as connectionStatusLabel,u as elevenLabsIntegrationSpec,G as ensureConnectionReady,ce as ensurePrimaryOpenBankingIntegration,v as gcsStorageIntegrationSpec,f as gmailIntegrationSpec,m as googleCalendarIntegrationSpec,t as makeIntegrationSpecKey,c as mistralIntegrationSpec,R as normalizeSecretPayload,z as parseSecretUri,i as postmarkIntegrationSpec,b as powensIntegrationSpec,o as qdrantIntegrationSpec,Q as redactOpenBankingTelemetryPayload,d as registerElevenLabsIntegration,y as registerGcsStorageIntegration,p as registerGmailIntegration,h as registerGoogleCalendarIntegration,l as registerMistralIntegration,oe as registerOpenBankingContracts,a as registerPostmarkIntegration,x as registerPowensIntegration,s as registerQdrantIntegration,n as registerStripeIntegration,g as registerTwilioSmsIntegration,r as stripeIntegrationSpec,_ as twilioSmsIntegrationSpec};
1
+ import{IntegrationSpecRegistry as e,makeIntegrationSpecKey as t}from"./spec.js";import{registerStripeIntegration as n,stripeIntegrationSpec as r}from"./providers/stripe.js";import{postmarkIntegrationSpec as i,registerPostmarkIntegration as a}from"./providers/postmark.js";import{qdrantIntegrationSpec as o,registerQdrantIntegration as s}from"./providers/qdrant.js";import{mistralIntegrationSpec as c,registerMistralIntegration as l}from"./providers/mistral.js";import{elevenLabsIntegrationSpec as u,registerElevenLabsIntegration as d}from"./providers/elevenlabs.js";import{gmailIntegrationSpec as f,registerGmailIntegration as p}from"./providers/gmail.js";import{googleCalendarIntegrationSpec as m,registerGoogleCalendarIntegration as h}from"./providers/google-calendar.js";import{registerTwilioSmsIntegration as g,twilioSmsIntegrationSpec as _}from"./providers/twilio-sms.js";import{gcsStorageIntegrationSpec as v,registerGcsStorageIntegration as y}from"./providers/gcs-storage.js";import{powensIntegrationSpec as b,registerPowensIntegration as x}from"./providers/powens.js";import{createDefaultIntegrationSpecRegistry as S}from"./providers/registry.js";import"./providers/index.js";import{AccountBalanceRecord as C,BankAccountRecord as w,BankTransactionRecord as T}from"./openbanking/models.js";import{OPENBANKING_PII_FIELDS as E,OPENBANKING_TELEMETRY_EVENTS as D,redactOpenBankingTelemetryPayload as O}from"./openbanking/telemetry.js";import{OpenBankingGetAccount as k,OpenBankingListAccounts as A,OpenBankingSyncAccounts as j}from"./openbanking/contracts/accounts.js";import{OpenBankingListTransactions as M,OpenBankingSyncTransactions as N}from"./openbanking/contracts/transactions.js";import{OpenBankingGetBalances as P,OpenBankingRefreshBalances as F}from"./openbanking/contracts/balances.js";import{OpenBankingFeature as I}from"./openbanking/openbanking.feature.js";import{registerOpenBankingContracts as L}from"./openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as R,ensurePrimaryOpenBankingIntegration as z}from"./openbanking/guards.js";export{C as AccountBalanceRecord,w as BankAccountRecord,T as BankTransactionRecord,e as IntegrationSpecRegistry,E as OPENBANKING_PII_FIELDS,D as OPENBANKING_TELEMETRY_EVENTS,I as OpenBankingFeature,k as OpenBankingGetAccount,P as OpenBankingGetBalances,A as OpenBankingListAccounts,M as OpenBankingListTransactions,F as OpenBankingRefreshBalances,j as OpenBankingSyncAccounts,N as OpenBankingSyncTransactions,R as assertPrimaryOpenBankingReady,S as createDefaultIntegrationSpecRegistry,u as elevenLabsIntegrationSpec,z as ensurePrimaryOpenBankingIntegration,v as gcsStorageIntegrationSpec,f as gmailIntegrationSpec,m as googleCalendarIntegrationSpec,t as makeIntegrationSpecKey,c as mistralIntegrationSpec,i as postmarkIntegrationSpec,b as powensIntegrationSpec,o as qdrantIntegrationSpec,O as redactOpenBankingTelemetryPayload,d as registerElevenLabsIntegration,y as registerGcsStorageIntegration,p as registerGmailIntegration,h as registerGoogleCalendarIntegration,l as registerMistralIntegration,L as registerOpenBankingContracts,a as registerPostmarkIntegration,x as registerPowensIntegration,s as registerQdrantIntegration,n as registerStripeIntegration,g as registerTwilioSmsIntegration,r as stripeIntegrationSpec,_ as twilioSmsIntegrationSpec};
@@ -1 +1 @@
1
- import{l as e}from"../../../schema/dist/ScalarTypeEnum.js";import{t}from"../../../schema/dist/SchemaModel.js";import"../../../schema/dist/index.js";import{defineCommand as n,defineQuery as r}from"../../../spec.js";import{BankAccountRecord as i}from"../models.js";import{OPENBANKING_TELEMETRY_EVENTS as a}from"../telemetry.js";const o=new t({name:`OpenBankingListAccountsInput`,description:`Parameters for listing bank accounts through the open banking provider.`,fields:{tenantId:{type:e.ID(),isOptional:!1},userId:{type:e.ID(),isOptional:!1},connectionId:{type:e.ID(),isOptional:!0},includeBalances:{type:e.Boolean(),isOptional:!0},institutionId:{type:e.String_unsecure(),isOptional:!0},cursor:{type:e.String_unsecure(),isOptional:!0},pageSize:{type:e.Int_unsecure(),isOptional:!0}}}),s=new t({name:`OpenBankingListAccountsOutput`,description:`Paginated list of bank accounts available to the tenant and user.`,fields:{accounts:{type:i,isOptional:!1,isArray:!0},nextCursor:{type:e.String_unsecure(),isOptional:!0},hasMore:{type:e.Boolean(),isOptional:!0}}}),c=new t({name:`OpenBankingGetAccountInput`,description:`Parameters for retrieving a specific bank account.`,fields:{tenantId:{type:e.ID(),isOptional:!1},accountId:{type:e.ID(),isOptional:!1},includeBalances:{type:e.Boolean(),isOptional:!0},includeLatestTransactions:{type:e.Boolean(),isOptional:!0}}}),l=new t({name:`OpenBankingSyncAccountsInput`,description:`Command payload to trigger an account synchronisation against the open banking provider.`,fields:{tenantId:{type:e.ID(),isOptional:!1},userId:{type:e.ID(),isOptional:!0},connectionId:{type:e.ID(),isOptional:!1},accountIds:{type:e.ID(),isArray:!0,isOptional:!0},forceFullRefresh:{type:e.Boolean(),isOptional:!0},triggerWorkflows:{type:e.Boolean(),isOptional:!0}}}),u=new t({name:`OpenBankingSyncAccountsOutput`,description:`Result of a bank account synchronisation run.`,fields:{synced:{type:e.Int_unsecure(),isOptional:!1},failed:{type:e.Int_unsecure(),isOptional:!1},errors:{type:e.String_unsecure(),isArray:!0,isOptional:!0},nextSyncSuggestedAt:{type:e.DateTime(),isOptional:!0}}}),d=r({meta:{name:`openbanking.accounts.list`,version:1,description:`List bank accounts available to a tenant/user via Powens Open Banking.`,goal:`Provide downstream workflows with the set of accounts accessible via the configured open banking connection.`,context:`Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:o,output:s},policy:{auth:`user`}}),f=r({meta:{name:`openbanking.accounts.get`,version:1,description:`Retrieve the canonical bank account record for the given account identifier.`,goal:`Allow user-facing experiences and automations to display up-to-date account metadata.`,context:`Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:c,output:i},policy:{auth:`user`}}),p=n({meta:{name:`openbanking.accounts.sync`,version:1,description:`Initiate a synchronisation run to refresh bank account metadata from Powens.`,goal:`Keep canonical bank account records aligned with the external open banking provider.`,context:`Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:l,output:u},policy:{auth:`admin`},telemetry:{success:{event:{name:a.accountsSynced},properties:({input:e,output:t})=>{let n=e,r=t;return{tenantId:n?.tenantId,connectionId:n?.connectionId,synced:r?.synced,failed:r?.failed}}},failure:{event:{name:a.accountsSyncFailed},properties:({input:e,error:t})=>{let n=e;return{tenantId:n?.tenantId,connectionId:n?.connectionId,error:t instanceof Error?t.message:String(t??`unknown`)}}}}}),m={OpenBankingListAccounts:d,OpenBankingGetAccount:f,OpenBankingSyncAccounts:p};function h(e){return e.register(d).register(f).register(p)}export{f as OpenBankingGetAccount,d as OpenBankingListAccounts,p as OpenBankingSyncAccounts,m as openBankingAccountContracts,h as registerOpenBankingAccountContracts};
1
+ import{defineCommand as e,defineQuery as t}from"../../../spec.js";import{BankAccountRecord as n}from"../models.js";import{OPENBANKING_TELEMETRY_EVENTS as r}from"../telemetry.js";import{ScalarTypeEnum as i,SchemaModel as a}from"@lssm/lib.schema";const o=new a({name:`OpenBankingListAccountsInput`,description:`Parameters for listing bank accounts through the open banking provider.`,fields:{tenantId:{type:i.ID(),isOptional:!1},userId:{type:i.ID(),isOptional:!1},connectionId:{type:i.ID(),isOptional:!0},includeBalances:{type:i.Boolean(),isOptional:!0},institutionId:{type:i.String_unsecure(),isOptional:!0},cursor:{type:i.String_unsecure(),isOptional:!0},pageSize:{type:i.Int_unsecure(),isOptional:!0}}}),s=new a({name:`OpenBankingListAccountsOutput`,description:`Paginated list of bank accounts available to the tenant and user.`,fields:{accounts:{type:n,isOptional:!1,isArray:!0},nextCursor:{type:i.String_unsecure(),isOptional:!0},hasMore:{type:i.Boolean(),isOptional:!0}}}),c=new a({name:`OpenBankingGetAccountInput`,description:`Parameters for retrieving a specific bank account.`,fields:{tenantId:{type:i.ID(),isOptional:!1},accountId:{type:i.ID(),isOptional:!1},includeBalances:{type:i.Boolean(),isOptional:!0},includeLatestTransactions:{type:i.Boolean(),isOptional:!0}}}),l=new a({name:`OpenBankingSyncAccountsInput`,description:`Command payload to trigger an account synchronisation against the open banking provider.`,fields:{tenantId:{type:i.ID(),isOptional:!1},userId:{type:i.ID(),isOptional:!0},connectionId:{type:i.ID(),isOptional:!1},accountIds:{type:i.ID(),isArray:!0,isOptional:!0},forceFullRefresh:{type:i.Boolean(),isOptional:!0},triggerWorkflows:{type:i.Boolean(),isOptional:!0}}}),u=new a({name:`OpenBankingSyncAccountsOutput`,description:`Result of a bank account synchronisation run.`,fields:{synced:{type:i.Int_unsecure(),isOptional:!1},failed:{type:i.Int_unsecure(),isOptional:!1},errors:{type:i.String_unsecure(),isArray:!0,isOptional:!0},nextSyncSuggestedAt:{type:i.DateTime(),isOptional:!0}}}),d=t({meta:{name:`openbanking.accounts.list`,version:1,description:`List bank accounts available to a tenant/user via Powens Open Banking.`,goal:`Provide downstream workflows with the set of accounts accessible via the configured open banking connection.`,context:`Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:o,output:s},policy:{auth:`user`}}),f=t({meta:{name:`openbanking.accounts.get`,version:1,description:`Retrieve the canonical bank account record for the given account identifier.`,goal:`Allow user-facing experiences and automations to display up-to-date account metadata.`,context:`Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:c,output:n},policy:{auth:`user`}}),p=e({meta:{name:`openbanking.accounts.sync`,version:1,description:`Initiate a synchronisation run to refresh bank account metadata from Powens.`,goal:`Keep canonical bank account records aligned with the external open banking provider.`,context:`Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.`,owners:[`platform.finance`],tags:[`open-banking`,`powens`,`accounts`],stability:`experimental`},io:{input:l,output:u},policy:{auth:`admin`},telemetry:{success:{event:{name:r.accountsSynced},properties:({input:e,output:t})=>{let n=e,r=t;return{tenantId:n?.tenantId,connectionId:n?.connectionId,synced:r?.synced,failed:r?.failed}}},failure:{event:{name:r.accountsSyncFailed},properties:({input:e,error:t})=>{let n=e;return{tenantId:n?.tenantId,connectionId:n?.connectionId,error:t instanceof Error?t.message:String(t??`unknown`)}}}}}),m={OpenBankingListAccounts:d,OpenBankingGetAccount:f,OpenBankingSyncAccounts:p};function h(e){return e.register(d).register(f).register(p)}export{f as OpenBankingGetAccount,d as OpenBankingListAccounts,p as OpenBankingSyncAccounts,m as openBankingAccountContracts,h as registerOpenBankingAccountContracts};