@lssm/example.analytics-dashboard 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217073102

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 (95) hide show
  1. package/dist/dashboard/dashboard.contracts.d.ts +131 -131
  2. package/dist/dashboard/dashboard.contracts.js +5 -5
  3. package/dist/dashboard/dashboard.enum.d.ts +4 -4
  4. package/dist/dashboard/dashboard.enum.js +4 -4
  5. package/dist/dashboard/dashboard.schema.d.ts +79 -79
  6. package/dist/dashboard/dashboard.schema.js +43 -43
  7. package/dist/docs/analytics-dashboard.docblock.js +2 -2
  8. package/dist/events.d.ts +40 -40
  9. package/dist/events.js +25 -25
  10. package/dist/libs/contracts/dist/capabilities/openbanking.js +53 -49
  11. package/dist/libs/contracts/dist/client/index.js +1 -1
  12. package/dist/libs/contracts/dist/client/react/index.js +1 -1
  13. package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
  14. package/dist/libs/contracts/dist/contract-registry/schemas.js +52 -49
  15. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +11 -86
  16. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +11 -360
  17. package/dist/libs/contracts/dist/docs/index.js +2 -2
  18. package/dist/libs/contracts/dist/docs/presentations.js +48 -44
  19. package/dist/libs/contracts/dist/docs/registry.js +27 -25
  20. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +11 -393
  21. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +11 -78
  22. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +11 -150
  23. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +11 -96
  24. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +10 -10
  25. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +15 -15
  26. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +12 -12
  27. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +11 -223
  28. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +44 -44
  29. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +30 -14
  30. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +10 -10
  31. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +13 -274
  32. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +41 -15
  33. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +15 -15
  34. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +14 -14
  35. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +16 -28
  36. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +60 -15
  37. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +13 -13
  38. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +31 -48
  39. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +40 -15
  40. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +14 -14
  41. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +22 -22
  42. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +12 -12
  43. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +22 -22
  44. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +11 -11
  45. package/dist/libs/contracts/dist/events.js +4 -3
  46. package/dist/libs/contracts/dist/index.js +14 -14
  47. package/dist/libs/contracts/dist/integrations/contracts.js +205 -199
  48. package/dist/libs/contracts/dist/integrations/index.js +5 -5
  49. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +133 -130
  50. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +95 -93
  51. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -3
  52. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +120 -118
  53. package/dist/libs/contracts/dist/integrations/openbanking/models.js +122 -120
  54. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +9 -20
  55. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +25 -25
  56. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +36 -36
  57. package/dist/libs/contracts/dist/integrations/providers/gmail.js +40 -40
  58. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +31 -31
  59. package/dist/libs/contracts/dist/integrations/providers/mistral.js +31 -31
  60. package/dist/libs/contracts/dist/integrations/providers/postmark.js +31 -31
  61. package/dist/libs/contracts/dist/integrations/providers/powens.js +51 -51
  62. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +31 -31
  63. package/dist/libs/contracts/dist/integrations/providers/stripe.js +35 -35
  64. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +28 -28
  65. package/dist/libs/contracts/dist/jsonschema.js +1 -1
  66. package/dist/libs/contracts/dist/knowledge/contracts.js +170 -163
  67. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +17 -17
  68. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +17 -17
  69. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +19 -19
  70. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +17 -17
  71. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +17 -17
  72. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +17 -17
  73. package/dist/libs/contracts/dist/llm/exporters.js +13 -12
  74. package/dist/libs/contracts/dist/onboarding-base.js +116 -99
  75. package/dist/libs/contracts/dist/ownership.js +18 -33
  76. package/dist/libs/contracts/dist/presentations.js +1 -1
  77. package/dist/libs/contracts/dist/presentations.v2.js +6 -2
  78. package/dist/libs/contracts/dist/regenerator/service.js +5 -0
  79. package/dist/libs/contracts/dist/registry.js +1 -1
  80. package/dist/libs/contracts/dist/schema/dist/FieldType.js +24 -14
  81. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +180 -166
  82. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +20 -9
  83. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
  84. package/dist/libs/contracts/dist/spec.js +22 -13
  85. package/dist/libs/schema/dist/EnumType.js +25 -9
  86. package/dist/libs/schema/dist/FieldType.js +24 -14
  87. package/dist/libs/schema/dist/ScalarTypeEnum.js +180 -166
  88. package/dist/libs/schema/dist/SchemaModel.js +25 -10
  89. package/dist/libs/schema/dist/index.js +4 -4
  90. package/dist/query/query.contracts.js +3 -3
  91. package/dist/query/query.enum.d.ts +2 -2
  92. package/dist/query/query.enum.js +2 -2
  93. package/dist/query/query.schema.d.ts +34 -34
  94. package/dist/query/query.schema.js +33 -33
  95. package/package.json +10 -10
@@ -1,155 +1,16 @@
1
- import { a } from "../registry.js";
1
+ import { registerDocBlocks } from "../registry.js";
2
2
 
3
3
  //#region ../../libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js
4
- const t = [{
5
- id: `docs.tech.PHASE_3_AUTO_EVOLUTION`,
6
- title: `Phase 3: Auto-Evolution Technical Notes`,
7
- summary: `**Status**: In progress`,
8
- kind: `reference`,
9
- visibility: `public`,
10
- route: `/docs/tech/PHASE_3_AUTO_EVOLUTION`,
11
- tags: [`tech`, `PHASE_3_AUTO_EVOLUTION`],
12
- body: `# Phase 3: Auto-Evolution Technical Notes
13
-
14
- **Status**: In progress
15
- **Last updated**: 2025-11-21
16
-
17
- Phase 3 introduces self-learning capabilities that analyze production telemetry, suggest new specs, safely roll out variants, and generate golden tests from real traffic. This document captures the main building blocks delivered in this iteration.
18
-
19
- ---
20
-
21
- ## 1. Libraries
22
-
23
- ### @lssm/lib.evolution
24
-
25
- - \`SpecAnalyzer\` converts raw telemetry samples into usage stats + anomalies.
26
- - \`SpecGenerator\` produces \`SpecSuggestion\` objects and validates confidence thresholds.
27
- - \`SpecSuggestionOrchestrator\` routes proposals through the AI approval workflow and writes approved specs to \`packages/libs/contracts/src/generated\`.
28
- - Storage adapters:
29
- - \`InMemorySpecSuggestionRepository\` for tests.
30
- - \`PrismaSpecSuggestionRepository\` persists to the new Prisma model (see §4).
31
- - \`FileSystemSuggestionWriter\` emits JSON envelopes for git review.
32
-
33
- ### @lssm/lib.observability
34
-
35
- - Added intent detection modules:
36
- - \`IntentAggregator\` batches telemetry into rolling windows.
37
- - \`IntentDetector\` surfaces latency/error/throughput regressions and sequential intents.
38
- - \`EvolutionPipeline\` orchestrates aggregation → detection → intent events and exposes hooks for downstream orchestrators.
39
- - \`createTracingMiddleware\` now accepts \`resolveOperation\`/\`onSample\` hooks to feed telemetry samples into the pipeline.
40
-
41
- ### @lssm/lib.growth
42
-
43
- - New \`spec-experiments\` module:
44
- - \`SpecExperimentRegistry\`, \`SpecExperimentRunner\`, \`SpecExperimentAdapter\`.
45
- - \`SpecExperimentAnalyzer\` + \`SpecExperimentController\` handle guardrails and staged rollouts.
46
- - Helper \`createSpecVariantResolver\` plugs directly into \`HandlerCtx.specVariantResolver\`.
47
- - \`SpecVariantResolver\` is now a first-class concept in \`@lssm/lib.contracts\`. The runtime will attempt to execute variant specs before falling back to the registered handler.
48
-
49
- ### @lssm/lib.testing
50
-
51
- - \`TrafficRecorder\` + \`TrafficStore\` capture production requests with sampling and sanitization hooks.
52
- - \`GoldenTestGenerator\` converts \`TrafficSnapshot\`s into Vitest/Jest suites.
53
- - \`generateVitestSuite\` / \`generateJestSuite\` output self-contained test files, and \`runGoldenTests\` offers a programmatic harness for CI pipelines.
54
-
55
- ---
56
-
57
- ## 2. Telemetry → Intent → Spec Pipeline
58
-
59
- 1. \`createTracingMiddleware({ onSample })\` emits \`TelemetrySample\`s for every HTTP request.
60
- 2. \`IntentAggregator\` groups samples into statistical windows (default 15 minutes).
61
- 3. \`IntentDetector\` raises signals for:
62
- - Error spikes
63
- - Latency regressions
64
- - Throughput drops
65
- - Sequential workflows that hint at missing specs
66
- 4. \`EvolutionPipeline\` emits \`intent.detected\` events and hands them to \`SpecGenerator\`.
67
- 5. \`SpecSuggestionOrchestrator\` persists suggestions, triggers approval workflows, and—upon approval—writes JSON envelopes to \`packages/.../contracts/src/generated\`.
68
-
69
- ---
70
-
71
- ## 3. Spec Experiments & Rollouts
72
-
73
- 1. Register spec experiments in \`SpecExperimentRegistry\` with control + variant bindings.
74
- 2. Expose bucketed specs by attaching \`createSpecVariantResolver\` to \`HandlerCtx.specVariantResolver\` inside adapters.
75
- 3. Record outcomes via \`SpecExperimentAdapter.trackOutcome()\` (latency + error metrics).
76
- 4. \`SpecExperimentController\` uses guardrails from config and \`SpecExperimentAnalyzer\` to:
77
- - Auto-rollback on error/latency breaches.
78
- - Advance rollout stages (1% → 10% → 50% → 100%) when metrics stay green.
79
-
80
- ---
81
-
82
- ## 4. Data Models (Prisma)
83
-
84
- File: \`packages/libs/database/prisma/schema.prisma\`
85
-
86
- - \`SpecSuggestion\` – stores serialized suggestion payloads + statuses.
87
- - \`IntentSnapshot\` – captured detector output for auditing/training.
88
- - \`TrafficSnapshot\` – persisted production traffic (input/output/error blobs).
89
- - \`SpecExperiment\` / \`SpecExperimentMetric\` – rollout state + metrics for each variant.
90
-
91
- > Run \`bun database generate\` after pulling to refresh the Prisma client.
92
-
93
- ---
94
-
95
- ## 5. Golden Test Workflow
96
-
97
- 1. Capture traffic via middleware or direct \`TrafficRecorder.record\`.
98
- 2. Use the new CLI command to materialize suites:
99
-
100
- \`\`\`bash
101
- contractspec test generate \\
102
- --operation billing.createInvoice \\
103
- --output tests/billing.createInvoice.golden.test.ts \\
104
- --runner-import ./tests/run-operation \\
105
- --runner-fn runBillingCommand \\
106
- --from-production \\
107
- --days 7 \\
108
- --sample-rate 0.05
109
- \`\`\`
110
-
111
- 3. Generated files import your runner and assert against recorded outputs (or expected errors for negative paths).
112
-
113
- ---
114
-
115
- ## 6. Operational Notes
116
-
117
- - **Approvals**: By default, every suggestion still requires human approval. \`EvolutionConfig.autoApproveThreshold\` can be tuned per environment but should remain conservative (<0.3) until OverlaySpec tooling lands.
118
- - **Sampling**: Keep \`TrafficRecorder.sampleRate\` ≤ 0.05 in production to avoid sensitive payload storage; scrub PII through the \`sanitize\` callback before persistence.
119
- - **Rollouts**: Guardrails default to 5% error-rate and 750ms P99 latency. Override per experiment to match SLOs.
120
-
121
- ---
122
-
123
- ## 7. Next Steps
124
-
125
- 1. Wire \`SpecExperimentAdapter.trackOutcome\` into adapters (REST, GraphQL, Workers) so every execution logs metrics automatically.
126
- 2. Add a UI for reviewing \`SpecSuggestion\` objects alongside approval status.
127
- 3. Expand \`TrafficRecorder\` to ship directly to the Prisma-backed store (currently in-memory by default).
128
- 4. Integrate \`EvolutionPipeline\` events with the Regenerator to close the loop (auto-open proposals + attach evidence).
129
-
130
-
131
-
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
-
149
-
150
-
151
- `
4
+ const tech_PHASE_3_AUTO_EVOLUTION_DocBlocks = [{
5
+ id: "docs.tech.PHASE_3_AUTO_EVOLUTION",
6
+ title: "Phase 3: Auto-Evolution Technical Notes",
7
+ summary: "**Status**: In progress",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/PHASE_3_AUTO_EVOLUTION",
11
+ tags: ["tech", "PHASE_3_AUTO_EVOLUTION"],
12
+ body: "# Phase 3: Auto-Evolution Technical Notes\n\n**Status**: In progress \n**Last updated**: 2025-11-21 \n\nPhase 3 introduces self-learning capabilities that analyze production telemetry, suggest new specs, safely roll out variants, and generate golden tests from real traffic. This document captures the main building blocks delivered in this iteration.\n\n---\n\n## 1. Libraries\n\n### @lssm/lib.evolution\n\n- `SpecAnalyzer` converts raw telemetry samples into usage stats + anomalies.\n- `SpecGenerator` produces `SpecSuggestion` objects and validates confidence thresholds.\n- `SpecSuggestionOrchestrator` routes proposals through the AI approval workflow and writes approved specs to `packages/libs/contracts/src/generated`.\n- Storage adapters:\n - `InMemorySpecSuggestionRepository` for tests.\n - `PrismaSpecSuggestionRepository` persists to the new Prisma model (see §4).\n - `FileSystemSuggestionWriter` emits JSON envelopes for git review.\n\n### @lssm/lib.observability\n\n- Added intent detection modules:\n - `IntentAggregator` batches telemetry into rolling windows.\n - `IntentDetector` surfaces latency/error/throughput regressions and sequential intents.\n- `EvolutionPipeline` orchestrates aggregation → detection → intent events and exposes hooks for downstream orchestrators.\n- `createTracingMiddleware` now accepts `resolveOperation`/`onSample` hooks to feed telemetry samples into the pipeline.\n\n### @lssm/lib.growth\n\n- New `spec-experiments` module:\n - `SpecExperimentRegistry`, `SpecExperimentRunner`, `SpecExperimentAdapter`.\n - `SpecExperimentAnalyzer` + `SpecExperimentController` handle guardrails and staged rollouts.\n - Helper `createSpecVariantResolver` plugs directly into `HandlerCtx.specVariantResolver`.\n- `SpecVariantResolver` is now a first-class concept in `@lssm/lib.contracts`. The runtime will attempt to execute variant specs before falling back to the registered handler.\n\n### @lssm/lib.testing\n\n- `TrafficRecorder` + `TrafficStore` capture production requests with sampling and sanitization hooks.\n- `GoldenTestGenerator` converts `TrafficSnapshot`s into Vitest/Jest suites.\n- `generateVitestSuite` / `generateJestSuite` output self-contained test files, and `runGoldenTests` offers a programmatic harness for CI pipelines.\n\n---\n\n## 2. Telemetry → Intent → Spec Pipeline\n\n1. `createTracingMiddleware({ onSample })` emits `TelemetrySample`s for every HTTP request.\n2. `IntentAggregator` groups samples into statistical windows (default 15 minutes).\n3. `IntentDetector` raises signals for:\n - Error spikes\n - Latency regressions\n - Throughput drops\n - Sequential workflows that hint at missing specs\n4. `EvolutionPipeline` emits `intent.detected` events and hands them to `SpecGenerator`.\n5. `SpecSuggestionOrchestrator` persists suggestions, triggers approval workflows, and—upon approval—writes JSON envelopes to `packages/.../contracts/src/generated`.\n\n---\n\n## 3. Spec Experiments & Rollouts\n\n1. Register spec experiments in `SpecExperimentRegistry` with control + variant bindings.\n2. Expose bucketed specs by attaching `createSpecVariantResolver` to `HandlerCtx.specVariantResolver` inside adapters.\n3. Record outcomes via `SpecExperimentAdapter.trackOutcome()` (latency + error metrics).\n4. `SpecExperimentController` uses guardrails from config and `SpecExperimentAnalyzer` to:\n - Auto-rollback on error/latency breaches.\n - Advance rollout stages (1% → 10% → 50% → 100%) when metrics stay green.\n\n---\n\n## 4. Data Models (Prisma)\n\nFile: `packages/libs/database/prisma/schema.prisma`\n\n- `SpecSuggestion` – stores serialized suggestion payloads + statuses.\n- `IntentSnapshot` – captured detector output for auditing/training.\n- `TrafficSnapshot` – persisted production traffic (input/output/error blobs).\n- `SpecExperiment` / `SpecExperimentMetric` – rollout state + metrics for each variant.\n\n> Run `bun database generate` after pulling to refresh the Prisma client.\n\n---\n\n## 5. Golden Test Workflow\n\n1. Capture traffic via middleware or direct `TrafficRecorder.record`.\n2. Use the new CLI command to materialize suites:\n\n```bash\ncontractspec test generate \\\n --operation billing.createInvoice \\\n --output tests/billing.createInvoice.golden.test.ts \\\n --runner-import ./tests/run-operation \\\n --runner-fn runBillingCommand \\\n --from-production \\\n --days 7 \\\n --sample-rate 0.05\n```\n\n3. Generated files import your runner and assert against recorded outputs (or expected errors for negative paths).\n\n---\n\n## 6. Operational Notes\n\n- **Approvals**: By default, every suggestion still requires human approval. `EvolutionConfig.autoApproveThreshold` can be tuned per environment but should remain conservative (<0.3) until OverlaySpec tooling lands.\n- **Sampling**: Keep `TrafficRecorder.sampleRate` ≤ 0.05 in production to avoid sensitive payload storage; scrub PII through the `sanitize` callback before persistence.\n- **Rollouts**: Guardrails default to 5% error-rate and 750ms P99 latency. Override per experiment to match SLOs.\n\n---\n\n## 7. Next Steps\n\n1. Wire `SpecExperimentAdapter.trackOutcome` into adapters (REST, GraphQL, Workers) so every execution logs metrics automatically.\n2. Add a UI for reviewing `SpecSuggestion` objects alongside approval status.\n3. Expand `TrafficRecorder` to ship directly to the Prisma-backed store (currently in-memory by default).\n4. Integrate `EvolutionPipeline` events with the Regenerator to close the loop (auto-open proposals + attach evidence).\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
152
13
  }];
153
- a(t);
14
+ registerDocBlocks(tech_PHASE_3_AUTO_EVOLUTION_DocBlocks);
154
15
 
155
16
  //#endregion
@@ -1,101 +1,16 @@
1
- import { a } from "../registry.js";
1
+ import { registerDocBlocks } from "../registry.js";
2
2
 
3
3
  //#region ../../libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js
4
- const t = [{
5
- id: `docs.tech.PHASE_4_PERSONALIZATION_ENGINE`,
6
- title: `Phase 4: Personalization Engine`,
7
- summary: `**Status**: Complete`,
8
- kind: `reference`,
9
- visibility: `public`,
10
- route: `/docs/tech/PHASE_4_PERSONALIZATION_ENGINE`,
11
- tags: [`tech`, `PHASE_4_PERSONALIZATION_ENGINE`],
12
- body: `# Phase 4: Personalization Engine
13
-
14
- **Status**: Complete
15
- **Last updated**: 2025-11-21
16
-
17
- Phase 4 unlocks tenant-scoped personalization with zero bespoke code. We shipped three new libraries, a signing-aware Overlay editor, and the persistence layer required to observe usage and apply overlays safely.
18
-
19
- ---
20
-
21
- ## 1. Libraries
22
-
23
- ### @lssm/lib.overlay-engine
24
-
25
- - OverlaySpec types + validator mirror the public spec.
26
- - Cryptographic signer (\`ed25519\`, \`rsa-pss-sha256\`) with canonical JSON serialization.
27
- - Registry that merges tenant/role/user/device overlays with predictable specificity.
28
- - React hooks (\`useOverlay\`, \`useOverlayFields\`) for client-side rendering.
29
- - Runtime engine audits every applied overlay for traceability.
30
-
31
- ### @lssm/lib.personalization
32
-
33
- - Behavior tracker buffers field/feature/workflow events and exports OTel metrics.
34
- - Analyzer summarizes field usage and workflow drop-offs into actionable insights.
35
- - Adapter translates insights into overlay suggestions or workflow tweaks.
36
- - In-memory store implementation + interface for plugging Prisma/ClickHouse later.
37
-
38
- ### @lssm/lib.workflow-composer
39
-
40
- - \`WorkflowComposer\` merges base workflows with tenant/role/device extensions.
41
- - Step injection utilities keep transitions intact and validate anchor steps.
42
- - Template helpers for common tenant review/approval, plus merge helpers for multi-scope extensions.
43
-
44
- ---
45
-
46
- ## 2. Overlay Editor App
47
-
48
- Path: \`packages/apps/overlay-editor\`
49
-
50
- - Next.js App Router UI for toggling field visibility, renaming labels, and reordering lists.
51
- - Live JSON preview powered by \`defineOverlay\`.
52
- - Server action that signs overlays via PEM private keys (Ed25519 by default) using the overlay engine signer.
53
-
54
- ---
55
-
56
- ## 3. Persistence
57
-
58
- Added Prisma models (see \`packages/libs/database/prisma/schema.prisma\`):
59
-
60
- - \`UserBehaviorEvent\` – field/feature/workflow telemetry.
61
- - \`OverlaySigningKey\` – tenant managed signing keys with revocation timestamps.
62
- - \`Overlay\` – stored overlays (tenant/user/role/device scope) plus signature metadata.
63
-
64
- ---
65
-
66
- ## 4. Integration Steps
67
-
68
- 1. Track usage inside apps via \`createBehaviorTracker\`.
69
- 2. Periodically run \`BehaviorAnalyzer.analyze\` to generate insights.
70
- 3. Convert insights into OverlaySpecs or Workflow extensions.
71
- 4. Register tenant overlays in \`OverlayRegistry\` and serve via presentation runtimes.
72
- 5. Compose workflows per tenant using \`WorkflowComposer\`.
73
-
74
- See the \`docs/tech/personalization/*\` guides for concrete examples.
75
-
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
-
96
-
97
- `
4
+ const tech_PHASE_4_PERSONALIZATION_ENGINE_DocBlocks = [{
5
+ id: "docs.tech.PHASE_4_PERSONALIZATION_ENGINE",
6
+ title: "Phase 4: Personalization Engine",
7
+ summary: "**Status**: Complete",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/PHASE_4_PERSONALIZATION_ENGINE",
11
+ tags: ["tech", "PHASE_4_PERSONALIZATION_ENGINE"],
12
+ body: "# Phase 4: Personalization Engine\n\n**Status**: Complete \n**Last updated**: 2025-11-21\n\nPhase 4 unlocks tenant-scoped personalization with zero bespoke code. We shipped three new libraries, a signing-aware Overlay editor, and the persistence layer required to observe usage and apply overlays safely.\n\n---\n\n## 1. Libraries\n\n### @lssm/lib.overlay-engine\n\n- OverlaySpec types + validator mirror the public spec.\n- Cryptographic signer (`ed25519`, `rsa-pss-sha256`) with canonical JSON serialization.\n- Registry that merges tenant/role/user/device overlays with predictable specificity.\n- React hooks (`useOverlay`, `useOverlayFields`) for client-side rendering.\n- Runtime engine audits every applied overlay for traceability.\n\n### @lssm/lib.personalization\n\n- Behavior tracker buffers field/feature/workflow events and exports OTel metrics.\n- Analyzer summarizes field usage and workflow drop-offs into actionable insights.\n- Adapter translates insights into overlay suggestions or workflow tweaks.\n- In-memory store implementation + interface for plugging Prisma/ClickHouse later.\n\n### @lssm/lib.workflow-composer\n\n- `WorkflowComposer` merges base workflows with tenant/role/device extensions.\n- Step injection utilities keep transitions intact and validate anchor steps.\n- Template helpers for common tenant review/approval, plus merge helpers for multi-scope extensions.\n\n---\n\n## 2. Overlay Editor App\n\nPath: `packages/apps/overlay-editor`\n\n- Next.js App Router UI for toggling field visibility, renaming labels, and reordering lists.\n- Live JSON preview powered by `defineOverlay`.\n- Server action that signs overlays via PEM private keys (Ed25519 by default) using the overlay engine signer.\n\n---\n\n## 3. Persistence\n\nAdded Prisma models (see `packages/libs/database/prisma/schema.prisma`):\n\n- `UserBehaviorEvent` – field/feature/workflow telemetry.\n- `OverlaySigningKey` – tenant managed signing keys with revocation timestamps.\n- `Overlay` – stored overlays (tenant/user/role/device scope) plus signature metadata.\n\n---\n\n## 4. Integration Steps\n\n1. Track usage inside apps via `createBehaviorTracker`.\n2. Periodically run `BehaviorAnalyzer.analyze` to generate insights.\n3. Convert insights into OverlaySpecs or Workflow extensions.\n4. Register tenant overlays in `OverlayRegistry` and serve via presentation runtimes.\n5. Compose workflows per tenant using `WorkflowComposer`.\n\nSee the `docs/tech/personalization/*` guides for concrete examples.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
98
13
  }];
99
- a(t);
14
+ registerDocBlocks(tech_PHASE_4_PERSONALIZATION_ENGINE_DocBlocks);
100
15
 
101
16
  //#endregion
@@ -1,16 +1,16 @@
1
- import { a } from "../registry.js";
1
+ import { registerDocBlocks } from "../registry.js";
2
2
 
3
3
  //#region ../../libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js
4
- const t = [{
5
- id: `docs.tech.PHASE_5_ZERO_TOUCH_OPERATIONS`,
6
- title: `Phase 5: Zero-Touch Operations`,
7
- summary: `**Status**: In progress`,
8
- kind: `reference`,
9
- visibility: `public`,
10
- route: `/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS`,
11
- tags: [`tech`, `PHASE_5_ZERO_TOUCH_OPERATIONS`],
4
+ const tech_PHASE_5_ZERO_TOUCH_OPERATIONS_DocBlocks = [{
5
+ id: "docs.tech.PHASE_5_ZERO_TOUCH_OPERATIONS",
6
+ title: "Phase 5: Zero-Touch Operations",
7
+ summary: "**Status**: In progress",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS",
11
+ tags: ["tech", "PHASE_5_ZERO_TOUCH_OPERATIONS"],
12
12
  body: "# Phase 5: Zero-Touch Operations\n\n**Status**: In progress \n**Last updated**: 2025-11-21\n\nPhase 5 delivers progressive delivery, SLO intelligence, cost attribution, and anomaly-driven remediation so the platform can deploy continuously without pager rotations.\n\n---\n\n## 1. New Libraries\n\n### @lssm/lib.progressive-delivery\n- `DeploymentStrategy` types capture canary vs blue-green rollouts.\n- `CanaryController` + `CanaryAnalyzer` orchestrate stage evaluation against telemetry thresholds.\n- `TrafficShifter` keeps stable/candidate splits in sync with feature-flag or router state.\n- `DeploymentCoordinator` drives stage progression, emits events, and triggers rollbacks.\n- `RollbackManager` encapsulates safe revert hooks (spec version revert, traffic shift, etc.).\n\n### @lssm/lib.slo\n- Declarative `SLODefinition` with latency + availability targets per capability/spec.\n- `SLOTracker` stores rolling snapshots + error budget positions.\n- `BurnRateCalculator` implements multi-window burn computations (fast vs slow burn).\n- `SLOMonitor` pushes incidents to Ops tooling automatically when burn exceeds thresholds.\n\n### @lssm/lib.cost-tracking\n- `CostTracker` normalizes DB/API/compute metrics into per-operation cost totals.\n- `BudgetAlertManager` raises tenant budget warnings (80% default) with contextual payloads.\n- `OptimizationRecommender` suggests batching, caching, or contract tweaks to cut spend.\n\n### Observability Anomaly Toolkit\n- `BaselineCalculator` establishes rolling intent metrics (latency, error rate, throughput).\n- `AnomalyDetector` flags spikes/drops via relative deltas after 10+ samples.\n- `RootCauseAnalyzer` correlates anomalies with recent deployments.\n- `AlertManager` deduplicates notifications and feeds MCP/SRE transports.\n\n---\n\n## 2. Data Model Additions\n\nFile: `packages/libs/database/prisma/schema.prisma`\n\n| Model | Purpose |\n| --- | --- |\n| `SLODefinition`, `SLOSnapshot`, `ErrorBudget`, `SLOIncident` | Persist definitions, rolling windows, and incidents. |\n| `OperationCost`, `TenantBudget`, `CostAlert`, `OptimizationSuggestion` | Track per-operation costs, budgets, and generated recommendations. |\n| `Deployment`, `DeploymentStage`, `RollbackEvent` | Audit progressive delivery runs and automated rollbacks. |\n| `MetricBaseline`, `AnomalyEvent` | Store computed baselines and anomaly evidence for training/analytics. |\n\nRun `bun database generate` after pulling to refresh the Prisma client.\n\n---\n\n## 3. Operational Flow\n\n1. **Deploy**: Define a `DeploymentStrategy` and feed telemetry via `@lssm/lib.observability`. Canary stages run automatically.\n2. **Protect**: `CanaryAnalyzer` evaluates error rate + latency thresholds. Failures trigger `RollbackManager`.\n3. **Observe**: `SLOMonitor` consumes snapshots and opens incidents when burn rate exceeds thresholds.\n4. **Optimize**: `CostTracker` aggregates spend per tenant + capability, while `OptimizationRecommender` surfaces fixes.\n5. **Detect**: Anomaly signals route to `RootCauseAnalyzer`, which links them to specific deployments for auto-rollback.\n\n---\n\n## 4. Integration Checklist\n\n1. Instrument adapters with `createTracingMiddleware({ onSample })` to feed metric points into `AnomalyDetector`.\n2. Register SLOs per critical operation (`billing.charge`, `knowledge.search`) and wire monitors to Ops notifications.\n3. Attach `CostTracker.recordSample` to workflow runners (DB instrumentation + external call wrappers).\n4. Store deployment metadata using the new Prisma models for auditing + UI surfacing.\n5. Update `@lssm/app.ops-console` (next iteration) to list deployments, SLO status, costs, and anomalies in one timeline.\n\n---\n\n## 5. Next Steps\n\n- Wire `DeploymentCoordinator` into the Contracts CLI so `contractspec deploy` can run staged rollouts.\n- Add UI for SLO dashboards (burn rate sparkline + incident feed).\n- Ship budget suggestions into Growth Agent for automated cost optimizations.\n- Connect `AnomalyEvent` stream to MCP agents for root-cause playbooks.\n"
13
13
  }];
14
- a(t);
14
+ registerDocBlocks(tech_PHASE_5_ZERO_TOUCH_OPERATIONS_DocBlocks);
15
15
 
16
16
  //#endregion
@@ -1,20 +1,20 @@
1
- import { a } from "../../registry.js";
1
+ import { registerDocBlocks } from "../../registry.js";
2
2
 
3
3
  //#region ../../libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js
4
- const t = [{
5
- id: `docs.tech.auth.better-auth-nextjs`,
6
- title: `Better Auth + Next.js integration (ContractSpec)`,
7
- summary: `How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).`,
8
- kind: `reference`,
9
- visibility: `public`,
10
- route: `/docs/tech/auth/better-auth-nextjs`,
4
+ const tech_auth_better_auth_nextjs_DocBlocks = [{
5
+ id: "docs.tech.auth.better-auth-nextjs",
6
+ title: "Better Auth + Next.js integration (ContractSpec)",
7
+ summary: "How ContractSpec wires Better Auth into Next.js (server config, client singleton, and proxy cookie-only redirects).",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/auth/better-auth-nextjs",
11
11
  tags: [
12
- `auth`,
13
- `better-auth`,
14
- `nextjs`,
15
- `cookies`,
16
- `proxy`,
17
- `hmr`
12
+ "auth",
13
+ "better-auth",
14
+ "nextjs",
15
+ "cookies",
16
+ "proxy",
17
+ "hmr"
18
18
  ],
19
19
  body: `# Better Auth + Next.js integration (ContractSpec)
20
20
 
@@ -75,6 +75,6 @@ The Next.js proxy/middleware is used for **redirect decisions only**. It must no
75
75
  These checks are intentionally optimistic and should only gate routing. Full authorization must still be enforced on server-side actions/routes and GraphQL resolvers.
76
76
  `
77
77
  }];
78
- a(t);
78
+ registerDocBlocks(tech_auth_better_auth_nextjs_DocBlocks);
79
79
 
80
80
  //#endregion
@@ -1,17 +1,17 @@
1
- import { a } from "../../registry.js";
1
+ import { registerDocBlocks } from "../../registry.js";
2
2
 
3
3
  //#region ../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js
4
- const t = [{
5
- id: `docs.tech.contracts.openapi-export`,
6
- title: `OpenAPI export (OpenAPI 3.1) from SpecRegistry`,
7
- summary: `Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.`,
8
- kind: `reference`,
9
- visibility: `public`,
10
- route: `/docs/tech/contracts/openapi-export`,
4
+ const tech_contracts_openapi_export_DocBlocks = [{
5
+ id: "docs.tech.contracts.openapi-export",
6
+ title: "OpenAPI export (OpenAPI 3.1) from SpecRegistry",
7
+ summary: "Generate a deterministic OpenAPI document from a SpecRegistry using jsonSchemaForSpec + REST transport metadata.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/tech/contracts/openapi-export",
11
11
  tags: [
12
- `contracts`,
13
- `openapi`,
14
- `rest`
12
+ "contracts",
13
+ "openapi",
14
+ "rest"
15
15
  ],
16
16
  body: `## OpenAPI export (OpenAPI 3.1) from SpecRegistry
17
17
 
@@ -52,6 +52,6 @@ The registry module must export one of:
52
52
  - Query (GET) inputs are currently represented as a JSON request body when an input schema exists.
53
53
  - Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`
54
54
  }];
55
- a(t);
55
+ registerDocBlocks(tech_contracts_openapi_export_DocBlocks);
56
56
 
57
57
  //#endregion