@lssm/lib.contracts 0.0.0-canary-20251209233744 → 0.0.0-canary-20251210075714

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 (45) hide show
  1. package/dist/app-config/docs/app-config.docblock.js +220 -0
  2. package/dist/capabilities/docs/capabilities.docblock.js +1 -0
  3. package/dist/data-views/docs/data-views.docblock.js +1 -0
  4. package/dist/docs/PUBLISHING.docblock.js +76 -0
  5. package/dist/docs/accessibility_wcag_compliance_specs.docblock.js +350 -0
  6. package/dist/docs/index.js +1 -0
  7. package/dist/docs/meta.docs.js +13 -0
  8. package/dist/docs/presentations.js +1 -0
  9. package/dist/docs/registry.js +1 -0
  10. package/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +383 -0
  11. package/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +68 -0
  12. package/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +140 -0
  13. package/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +86 -0
  14. package/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +1 -0
  15. package/dist/docs/tech/contracts/README.docblock.js +1 -0
  16. package/dist/docs/tech/contracts/create-subscription.docblock.js +1 -0
  17. package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +180 -0
  18. package/dist/docs/tech/contracts/migrations.docblock.js +1 -0
  19. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +62 -0
  20. package/dist/docs/tech/contracts/overlays.docblock.js +68 -0
  21. package/dist/docs/tech/contracts/tests.docblock.js +132 -0
  22. package/dist/docs/tech/contracts/themes.docblock.js +1 -0
  23. package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -0
  24. package/dist/docs/tech/lifecycle-stage-system.docblock.js +213 -0
  25. package/dist/docs/tech/mcp-endpoints.docblock.js +1 -0
  26. package/dist/docs/tech/presentation-runtime.docblock.js +1 -0
  27. package/dist/docs/tech/schema/README.docblock.js +262 -0
  28. package/dist/docs/tech/templates/runtime.docblock.js +1 -0
  29. package/dist/docs/tech/workflows/overview.docblock.js +1 -0
  30. package/dist/docs/tech-contracts.docs.js +76 -0
  31. package/dist/docs/types.js +0 -0
  32. package/dist/experiments/docs/experiments.docblock.js +128 -0
  33. package/dist/forms/docs/forms.docblock.js +1 -0
  34. package/dist/index.js +1 -1
  35. package/dist/integrations/docs/integrations.docblock.js +101 -0
  36. package/dist/knowledge/docs/knowledge.docblock.js +138 -0
  37. package/dist/openbanking/docs/openbanking.docblock.js +109 -0
  38. package/dist/policy/docs/policy.docblock.js +1 -0
  39. package/dist/presentations/docs/presentations-conventions.docblock.js +8 -0
  40. package/dist/regenerator/docs/regenerator.docblock.js +184 -0
  41. package/dist/registry.js +1 -1
  42. package/dist/server/index.js +1 -1
  43. package/dist/telemetry/docs/telemetry.docblock.js +139 -0
  44. package/package.json +81 -4
  45. package/dist/server/graphql-schema-export.js +0 -1
@@ -0,0 +1 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.policy`,title:`PolicySpec & PolicyEngine`,summary:"`PolicySpec` gives a declarative, typed home for access-control logic covering:",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/policy`,tags:[`tech`,`contracts`,`policy`],body:"# PolicySpec & PolicyEngine\n\n## Purpose\n\n`PolicySpec` gives a declarative, typed home for access-control logic covering:\n- **Who** can perform an action (ABAC/ReBAC style rules)\n- **What** they can access (resources + optional field-level overrides)\n- **When** special conditions apply (contextual expressions)\n- **How** PII should be handled (consent/retention hints)\n\n`PolicyEngine` evaluates one or more policies and returns an `allow`/`deny` decision, field-level outcomes, and PII metadata suitable for downstream enforcement (`SpecRegistry` → `ctx.decide`).\n\n## Location\n\n- Types & registry: `packages/libs/contracts/src/policy/spec.ts`\n- Runtime evaluation: `packages/libs/contracts/src/policy/engine.ts`\n- Tests: `packages/.../policy/engine.test.ts`\n\n## `PolicySpec`\n\n```ts\nexport interface PolicySpec {\n meta: PolicyMeta; // ownership metadata + { name, version, scope? }\n rules: PolicyRule[]; // allow/deny rules for actions\n fieldPolicies?: FieldPolicyRule[];\n pii?: { fields: string[]; consentRequired?: boolean; retentionDays?: number };\n relationships?: RelationshipDefinition[];\n consents?: ConsentDefinition[];\n rateLimits?: RateLimitDefinition[];\n opa?: { package: string; decision?: string };\n}\n```\n\n- `PolicyRule`\n - `effect`: `'allow' | 'deny'`\n - `actions`: e.g., `['read', 'write', 'delete']` (string namespace is flexible)\n - `subject`: `{ roles?: string[]; attributes?: { attr: matcher } }`\n - `resource`: `{ type: string; fields?: string[]; attributes?: {...} }`\n - `relationships`: `{ relation, objectId?, objectType? }[]` → ReBAC checks (use `objectId: '$resource'` to target the current resource)\n - `requiresConsent`: `['consent_id']` → references spec-level consent definitions\n - `flags`: feature flags that must be enabled (`DecisionContext.flags`)\n - `rateLimit`: string reference to `rateLimits` entry or inline object `{ rpm, key?, windowSeconds?, burst? }`\n - `escalate`: `'human_review' | null` to indicate manual approval\n - `conditions`: optional expression snippets evaluated against `{ subject, resource, context }`\n- `FieldPolicyRule`\n - `field`: dot-path string (e.g., `contact.email`)\n - `actions`: subset of `['read', 'write']`\n - Same `subject` / `resource` / `conditions` shape\n - Useful for redacting specific fields, even when the global action is allowed\n- `RelationshipDefinition`\n - Canonical tuples for relationship graph (`subjectType`, `relation`, `objectType`, `transitive?`)\n- `ConsentDefinition`\n - `{ id, scope, purpose, lawfulBasis?, expiresInDays?, required? }`\n- `RateLimitDefinition`\n - `{ id, rpm, key?, windowSeconds?, burst? }`\n- `PolicyRef`\n - `{ name: string; version: number }` → attach to contract specs / workflows\n\n## Registry\n\n```ts\nconst registry = new PolicyRegistry();\nregistry.register(CorePolicySpec);\nconst spec = registry.get('core.default', 1);\n```\n\nGuarantees uniqueness per `(name, version)` and exposes helpers to resolve highest versions.\n\n## Engine\n\n```ts\nconst engine = new PolicyEngine(policyRegistry);\n\nconst decision = engine.decide({\n action: 'read',\n subject: { roles: ['admin'] },\n resource: { type: 'resident', fields: ['contact.email'] },\n policies: [{ name: 'core.default', version: 1 }],\n});\n/*\n{\n effect: 'allow',\n reason: 'core.default',\n fieldDecisions: [{ field: 'contact.email', effect: 'allow' }],\n pii: { fields: ['contact.email'], consentRequired: true }\n}\n*/\n```\n\n- First matching **deny** wins; otherwise the first **allow** is returned.\n- Field policies are aggregated across referenced policies:\n - Later denies override earlier allows for a given field.\n - Returned as `fieldDecisions` to simplify downstream masking.\n- PII metadata is surfaced when defined to help adapt logging/telemetry.\n\n### Expression Support\n\nConditions accept small JS snippets (e.g., `subject.attributes.orgId === context.orgId`). The engine runs them in a constrained scope (`subject`, `resource`, `context`) without access to global state.\n\n### ReBAC & Relationships\n\n- Provide relationship tuples via `PolicySpec.relationships` for documentation/validation.\n- Reference them inside rules with `relationships: [{ relation: 'manager_of', objectType: 'resident', objectId: '$resource' }]`.\n- The execution context must populate `subject.relationships` (`[{ relation, object, objectType }]`) for the engine to evaluate ReBAC guards.\n\n### Consent & Rate Limits\n\n- Declare reusable consent definitions under `consents`. Rules list the IDs they require; if a user session lacks the consent (`DecisionContext.consents`), the engine returns `effect: 'deny'` with `reason: 'consent_required'` and enumerates missing consents.\n- Attach rate limits either inline or via `rateLimits` references. When a rule matches, the engine surfaces `{ rpm, key, windowSeconds?, burst? }` so callers can feed it to shared limiters.\n\n### OPA Adapter\n\n- `OPAPolicyAdapter` bridges engine decisions to Open Policy Agent (OPA). It forwards the evaluation context + policies to OPA and merges any override result (`effect`, `reason`, `fieldDecisions`, `requiredConsents`).\n- Use when migrating to OPA policies or running defense-in-depth: call `engine.decide()`, then pass the preliminary decision to `adapter.evaluate(...)`. The adapter marks merged decisions with `evaluatedBy: 'opa'`.\n- OPA inputs include meta, rules, relationships, rate limits, and consent catalogs to simplify policy authoring on the OPA side.\n\n## Contract Integration\n\n`ContractSpec.policy` now supports:\n\n```ts\npolicy: {\n auth: 'anonymous' | 'user' | 'admin';\n ...\n policies?: PolicyRef[]; // policies evaluated before execution\n fieldPolicies?: { // field hints (read/write) per policy\n field: string;\n actions: ('read' | 'write')[];\n policy?: PolicyRef;\n }[];\n}\n```\n\nAdapters can resolve refs through a shared `PolicyEngine` and populate `ctx.decide` so `SpecRegistry.execute` benefits from centralized enforcement.\n\n## Authoring Guidelines\n\n1. Prefer **allow-by-default** policies but explicitly deny sensitive flows (defense-in-depth).\n2. Keep rule scopes narrow (per feature/operation) and compose multiple `PolicyRef`s when necessary.\n3. Store PII field lists here to avoid duplication across logs/telemetry.\n4. Use explicit rule reasons for auditability and better developer feedback.\n5. Treat versioning seriously; bump `meta.version` whenever behavior changes.\n\n## Future Enhancements\n\n- Richer expression language (composable predicates, time-based conditions).\n- Multi-tenant relationship graph services (store/resolve relationships at scale).\n- Tooling that auto-generates docs/tests for policies referenced in specs.\n\n"}];e(t);export{t as tech_contracts_policy_DocBlocks};
@@ -0,0 +1,8 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.presentations-conventions`,title:`Presentations Conventions (A11y & i18n)`,summary:"- Always provide `meta.description` (≥ 3 chars) — used by a11y/docs/agents.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/presentations-conventions`,tags:[`tech`,`contracts`,`presentations-conventions`],body:`## Presentations Conventions (A11y & i18n)
2
+
3
+ - Always provide \`meta.description\` (≥ 3 chars) — used by a11y/docs/agents.
4
+ - Prefer source = BlockNote for rich guides; use component key for interactive flows.
5
+ - i18n strings belong in host apps; descriptors carry keys/defaults only.
6
+ - Target selection: include only what you intend to support to avoid drift.
7
+ - PII: declare JSON-like paths under \`policy.pii\`; engine redacts in outputs.
8
+ `}];e(t);export{t as tech_contracts_presentations_conventions_DocBlocks};
@@ -0,0 +1,184 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.regenerator`,title:`Regenerator Service`,summary:`The Regenerator daemon observes telemetry, error, and behavior streams, then suggests spec-level changes (not code patches) that can be reviewed and applied through the App Studio.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/regenerator`,tags:[`tech`,`contracts`,`regenerator`],body:`## Regenerator Service
2
+
3
+ The Regenerator daemon observes telemetry, error, and behavior streams, then suggests spec-level changes (not code patches) that can be reviewed and applied through the App Studio.
4
+
5
+ - Runtime entrypoint: \`packages/libs/contracts/src/regenerator/service.ts\`
6
+ - Types/interfaces: \`packages/libs/contracts/src/regenerator/types.ts\`
7
+ - Signal adapters: \`packages/libs/contracts/src/regenerator/adapters.ts\`
8
+
9
+ ### Architecture
10
+
11
+ \`\`\`text
12
+ Signal Adapters ──► RegeneratorService ──► Rules ──► ProposalSink
13
+ ▲ │
14
+ │ ▼
15
+ Telemetry / Errors / Behavior Spec change proposals
16
+ \`\`\`
17
+
18
+ 1. **Signal adapters** pull batches of telemetry, error logs, or behavior metrics for each \`RegenerationContext\`.
19
+ 2. \`RegeneratorService\` schedules polling (\`resolveAppConfig\` + \`composeAppConfig\` provide context).
20
+ 3. **Rules** implement domain heuristics and emit \`SpecChangeProposal\` objects.
21
+ 4. **Proposal sinks** persist or forward proposals for human review.
22
+
23
+ ### Key types
24
+
25
+ \`\`\`ts
26
+ export interface RegenerationContext {
27
+ id: string;
28
+ blueprint: AppBlueprintSpec;
29
+ tenantConfig: TenantAppConfig;
30
+ resolved: ResolvedAppConfig;
31
+ }
32
+
33
+ export interface RegeneratorRule {
34
+ id: string;
35
+ description: string;
36
+ evaluate(
37
+ context: RegenerationContext,
38
+ signals: RegeneratorSignal[]
39
+ ): Promise<SpecChangeProposal[]>;
40
+ }
41
+
42
+ export interface SpecChangeProposal {
43
+ id: string;
44
+ title: string;
45
+ summary: string;
46
+ confidence: 'low' | 'medium' | 'high';
47
+ target: ProposalTarget;
48
+ actions: ProposalAction[];
49
+ blockers?: ProposalBlocker[];
50
+ signalIds: string[];
51
+ createdAt: Date;
52
+ }
53
+ \`\`\`
54
+
55
+ - Signals are normalized envelopes: telemetry (\`count\`, anomaly score), errors, and behavior trends.
56
+ - Proposals reference blueprint or tenant specs via \`ProposalTarget\`.
57
+ - Actions encode what the automation should perform (update blueprint, run tests/migrations, trigger regeneration).
58
+
59
+ ### Providing signals
60
+
61
+ Implement \`TelemetrySignalProvider\`, \`ErrorSignalProvider\`, or \`BehaviorSignalProvider\`:
62
+
63
+ \`\`\`ts
64
+ const service = new RegeneratorService({
65
+ contexts,
66
+ adapters: {
67
+ telemetry: new PosthogTelemetryAdapter(),
68
+ errors: new SentryErrorAdapter(),
69
+ },
70
+ rules: [new WorkflowFailureRule(), new DataViewUsageRule()],
71
+ sink: new ProposalQueueSink(),
72
+ pollIntervalMs: 60_000,
73
+ });
74
+ \`\`\`
75
+
76
+ Adapters receive the full \`RegenerationContext\`, making it easy to scope queries per tenant/app.
77
+
78
+ ### Authoring rules
79
+
80
+ Rules focus on signals → proposals:
81
+
82
+ \`\`\`ts
83
+ class WorkflowFailureRule implements RegeneratorRule {
84
+ id = 'workflow-failure';
85
+ description = 'Suggest splitting workflows that exceed failure thresholds';
86
+
87
+ async evaluate(context, signals) {
88
+ const failures = signals.filter(
89
+ (signal) =>
90
+ signal.type === 'telemetry' &&
91
+ signal.signal.eventName === 'workflow.failure' &&
92
+ signal.signal.count >= 10
93
+ );
94
+
95
+ if (failures.length === 0) return [];
96
+
97
+ return [
98
+ {
99
+ id: \`\${this.id}-\${context.id}\`,
100
+ title: 'Split onboarding workflow',
101
+ summary: 'Step 3 fails consistently; propose dedicated remediation branch.',
102
+ confidence: 'medium',
103
+ rationale: ['Failure count ≥ 10 within last window'],
104
+ target: {
105
+ specType: 'workflow',
106
+ reference: { name: 'onboarding.workflow', version: 1 },
107
+ tenantScoped: true,
108
+ },
109
+ actions: [
110
+ { kind: 'update_tenant_config', summary: 'Add alternate fallback path' },
111
+ { kind: 'run_tests', tests: ['workflows/onboarding.spec.ts'] },
112
+ ],
113
+ signalIds: failures.map((f) => f.signal.eventName),
114
+ createdAt: new Date(),
115
+ },
116
+ ];
117
+ }
118
+ }
119
+ \`\`\`
120
+
121
+ ### Reviewing proposals
122
+
123
+ Proposals flow to a \`ProposalSink\` (queue, DB, messaging bus). The Studio will surface:
124
+
125
+ 1. Signal evidence (telemetry counts, error metadata)
126
+ 2. Proposed spec diffs and required actions (tests/migrations)
127
+ 3. Approval workflow (approve → write spec diff → run automation)
128
+
129
+ ### CLI driver
130
+
131
+ Run the regenerator daemon from the CLI:
132
+
133
+ \`\`\`bash
134
+ bunx contracts regenerator ./app.blueprint.ts ./tenant.config.ts ./regenerator.rules.ts auto \\
135
+ --executor ./regenerator.executor.ts \\
136
+ --poll-interval 60000 \\
137
+ --batch-duration 300000 \\
138
+ --dry-run
139
+ \`\`\`
140
+
141
+ - Expects modules exporting default \`AppBlueprintSpec\`, \`TenantAppConfig\`, and one or more \`RegenerationRule\`s.
142
+ - Pass a sink module path, or use the special \`auto\` value with \`--executor <module>\` to instantiate an \`ExecutorProposalSink\`.
143
+ - Executor modules can export a \`ProposalExecutor\` instance, a factory, or a plain dependency object for the executor constructor. Optional exports: \`sinkOptions\`, \`logger\`, \`onResult\`, \`dryRun\`.
144
+ - Optionally provide \`--contexts ./contexts.ts\` to load custom context arrays (advanced multi-tenant scenarios).
145
+ - Use \`--dry-run\` to preview actions without mutating specs/configs, and \`--once\` for CI smoke tests.
146
+
147
+ ### Proposal executor
148
+
149
+ \`ProposalExecutor\` + \`ExecutorProposalSink\` orchestrate follow-up actions once a proposal is approved:
150
+
151
+ - Interfaces for applying blueprint or tenant-config updates (\`BlueprintUpdater\`, \`TenantConfigUpdater\`).
152
+ - Hooks for running contract tests and migrations (\`TestExecutor\`, \`MigrationExecutor\`).
153
+ - Optional trigger to recompose the runtime (\`RegenerationTrigger\`).
154
+ - Built-in \`dryRun\` mode to preview outcomes.
155
+ - Pluggable result logging/forwarding via \`ExecutorSinkOptions\`.
156
+
157
+ \`\`\`ts
158
+ import {
159
+ ProposalExecutor,
160
+ ExecutorProposalSink,
161
+ } from '@lssm/lib.contracts/regenerator';
162
+
163
+ const executor = new ProposalExecutor({
164
+ tenantConfigUpdater,
165
+ testExecutor,
166
+ migrationExecutor,
167
+ regenerationTrigger,
168
+ });
169
+
170
+ const sink = new ExecutorProposalSink(executor, {
171
+ dryRun: false,
172
+ onResult: ({ result }) => console.log(result.status),
173
+ });
174
+ \`\`\`
175
+
176
+ Execution results include per-action status (\`success\`, \`skipped\`, \`failed\`) plus aggregated proposal status (\`success\`, \`partial\`, \`failed\`). Missing dependencies mark actions as \`skipped\`, making it easy to plug into partial automation flows today and extend later.
177
+
178
+ ### Next steps
179
+
180
+ - Build adapters for existing telemetry/error providers.
181
+ - Encode canonical rules (workflow failure, feature under-use, high latency).
182
+ - Integrate with App Studio proposal inbox and automate acceptance (write spec diff, run tests, queue migrations).
183
+
184
+ `}];e(t);export{t as tech_contracts_regenerator_DocBlocks};
package/dist/registry.js CHANGED
@@ -1 +1 @@
1
- import{eventKey as e}from"./events.js";import{isEmitDeclRef as t}from"./spec.js";function n(e,t){return`${e}.v${t}`}var r=class{specs=new Map;handlers=new Map;register(e){let t=n(e.meta.name,e.meta.version);if(this.specs.has(t))throw Error(`Duplicate spec ${t}`);return this.specs.set(t,e),this}bind(e,t){let r=n(e.meta.name,e.meta.version);if(!this.specs.has(r))throw Error(`Cannot bind; spec not found: ${r}`);if(this.handlers.has(r))throw Error(`Handler already bound for ${r}`);return this.handlers.set(r,t),this}getSpec(e,t){if(t!=null)return this.specs.get(n(e,t));let r,i=-1/0;for(let[t,n]of this.specs.entries())t.startsWith(`${e}.v`)&&n.meta.version>i&&(i=n.meta.version,r=n);return r}getHandler(e,t){let r=this.getSpec(e,t);if(r)return this.handlers.get(n(r.meta.name,r.meta.version))}listSpecs(){return[...this.specs.values()]}listBound(){let e=[];for(let[t,n]of this.specs.entries()){let r=this.handlers.get(t);r&&e.push({spec:n,handler:r})}return e}async execute(r,i,a,o){let s=this.getSpec(r,i);if(!s)throw Error(`Spec not found for ${r}${i?`.v${i}`:``}`);let c=await o.specVariantResolver?.resolve({name:s.meta.name,version:s.meta.version,kind:s.meta.kind},o)??s,l=n(c.meta.name,c.meta.version),u=this.handlers.get(l);if(!u){let e=n(s.meta.name,s.meta.version);u=this.handlers.get(e),l=e}if(!u)throw Error(`No handler bound for ${l}`);let d=c.io.input?.getZod().parse(a);if(o.decide){let[e,t]=c.meta.name.split(`.`),n=await o.decide({service:e,command:t,version:c.meta.version,actor:o.actor??`anonymous`,channel:o.channel,roles:o.roles,organizationId:o.organizationId,userId:o.userId,flags:[]});if(n.effect===`deny`)throw Error(`PolicyDenied: ${c.meta.name}.v${c.meta.version}`);if(n.rateLimit&&o.rateLimit){let e=n.rateLimit.key??`default`,t=n.rateLimit.rpm??60;await o.rateLimit(e,1,t)}}let f=new Map;if(c.sideEffects?.emits)for(let e of c.sideEffects.emits)t(e)?f.set(`${e.ref.name}.v${e.ref.version}`,e.ref.payload):f.set(`${e.name}.v${e.version}`,e.payload);let p=async(t,r,i)=>{let a=e(t,r),s=f.get(a);if(!s)throw Error(`UndeclaredEvent: ${a} not allowed by ${n(c.meta.name,c.meta.version)}`);let l=s.getZod().parse(i);await o.eventPublisher?.({name:t,version:r,payload:l,traceId:o.traceId})};o.appConfig&&(o.branding||=o.appConfig.branding,o.translation?o.translation.config||(o.translation={...o.translation,config:o.appConfig.translation}):o.translation={config:o.appConfig.translation});let m=o.telemetry,h=async(e,t)=>{if(!(!m||!e?.event))try{let n=e.properties?.(t)??{};await m.track(e.event.name,e.event.version??1,n,{tenantId:o.organizationId??void 0,organizationId:o.organizationId,userId:o.userId,actor:o.actor,channel:o.channel,metadata:o.traceId?{traceId:o.traceId}:void 0})}catch{}},g;try{g=await u(d,{...o,__emitGuard__:p})}catch(e){throw c.telemetry?.failure&&await h(c.telemetry.failure,{input:d??a,error:e}),e}c.telemetry?.success&&await h(c.telemetry.success,{input:d??a,output:g});let _=c.io.output;return _?.getZod?_.getZod().parse(g):g}};export{r as SpecRegistry,n as opKey};
1
+ import{eventKey as e}from"./events.js";import{isEmitDeclRef as t}from"./spec.js";import{defaultDocRegistry as n,docId as r,registerDocBlocks as i}from"./docs/registry.js";function a(e,t){return`${e}.v${t}`}var o=class{specs=new Map;handlers=new Map;register(e){let t=a(e.meta.name,e.meta.version);if(this.specs.has(t))throw Error(`Duplicate spec ${t}`);return this.specs.set(t,e),this}bind(e,t){let n=a(e.meta.name,e.meta.version);if(!this.specs.has(n))throw Error(`Cannot bind; spec not found: ${n}`);if(this.handlers.has(n))throw Error(`Handler already bound for ${n}`);return this.handlers.set(n,t),this}getSpec(e,t){if(t!=null)return this.specs.get(a(e,t));let n,r=-1/0;for(let[t,i]of this.specs.entries())t.startsWith(`${e}.v`)&&i.meta.version>r&&(r=i.meta.version,n=i);return n}getHandler(e,t){let n=this.getSpec(e,t);if(n)return this.handlers.get(a(n.meta.name,n.meta.version))}listSpecs(){return[...this.specs.values()]}listBound(){let e=[];for(let[t,n]of this.specs.entries()){let r=this.handlers.get(t);r&&e.push({spec:n,handler:r})}return e}async execute(n,r,i,o){let s=this.getSpec(n,r);if(!s)throw Error(`Spec not found for ${n}${r?`.v${r}`:``}`);let c=await o.specVariantResolver?.resolve({name:s.meta.name,version:s.meta.version,kind:s.meta.kind},o)??s,l=a(c.meta.name,c.meta.version),u=this.handlers.get(l);if(!u){let e=a(s.meta.name,s.meta.version);u=this.handlers.get(e),l=e}if(!u)throw Error(`No handler bound for ${l}`);let d=c.io.input?.getZod().parse(i);if(o.decide){let[e,t]=c.meta.name.split(`.`),n=await o.decide({service:e,command:t,version:c.meta.version,actor:o.actor??`anonymous`,channel:o.channel,roles:o.roles,organizationId:o.organizationId,userId:o.userId,flags:[]});if(n.effect===`deny`)throw Error(`PolicyDenied: ${c.meta.name}.v${c.meta.version}`);if(n.rateLimit&&o.rateLimit){let e=n.rateLimit.key??`default`,t=n.rateLimit.rpm??60;await o.rateLimit(e,1,t)}}let f=new Map;if(c.sideEffects?.emits)for(let e of c.sideEffects.emits)t(e)?f.set(`${e.ref.name}.v${e.ref.version}`,e.ref.payload):f.set(`${e.name}.v${e.version}`,e.payload);let p=async(t,n,r)=>{let i=e(t,n),s=f.get(i);if(!s)throw Error(`UndeclaredEvent: ${i} not allowed by ${a(c.meta.name,c.meta.version)}`);let l=s.getZod().parse(r);await o.eventPublisher?.({name:t,version:n,payload:l,traceId:o.traceId})};o.appConfig&&(o.branding||=o.appConfig.branding,o.translation?o.translation.config||(o.translation={...o.translation,config:o.appConfig.translation}):o.translation={config:o.appConfig.translation});let m=o.telemetry,h=async(e,t)=>{if(!(!m||!e?.event))try{let n=e.properties?.(t)??{};await m.track(e.event.name,e.event.version??1,n,{tenantId:o.organizationId??void 0,organizationId:o.organizationId,userId:o.userId,actor:o.actor,channel:o.channel,metadata:o.traceId?{traceId:o.traceId}:void 0})}catch{}},g;try{g=await u(d,{...o,__emitGuard__:p})}catch(e){throw c.telemetry?.failure&&await h(c.telemetry.failure,{input:d??i,error:e}),e}c.telemetry?.success&&await h(c.telemetry.success,{input:d??i,output:g});let _=c.io.output;return _?.getZod?_.getZod().parse(g):g}};export{o as SpecRegistry,n as defaultDocRegistry,r as docId,a as opKey,i as registerDocBlocks};
@@ -1 +1 @@
1
- import{registerContractsOnBuilder as e}from"./graphql-pothos.js";import{exportContractsToGraphQLSchema as t}from"./graphql-schema-export.js";import{createMcpServer as n}from"./provider-mcp.js";import{createFetchHandler as r}from"./rest-generic.js";import{elysiaPlugin as i}from"./rest-elysia.js";import{expressRouter as a}from"./rest-express.js";import{makeNextAppHandler as o}from"./rest-next-app.js";import{makeNextPagesHandler as s}from"./rest-next-pages.js";export{r as createFetchHandler,n as createMcpServer,i as elysiaPlugin,t as exportContractsToGraphQLSchema,a as expressRouter,o as makeNextAppHandler,s as makeNextPagesHandler,e as registerContractsOnBuilder};
1
+ import{registerContractsOnBuilder as e}from"./graphql-pothos.js";import{createMcpServer as t}from"./provider-mcp.js";import{createFetchHandler as n}from"./rest-generic.js";import{elysiaPlugin as r}from"./rest-elysia.js";import{expressRouter as i}from"./rest-express.js";import{makeNextAppHandler as a}from"./rest-next-app.js";import{makeNextPagesHandler as o}from"./rest-next-pages.js";export{n as createFetchHandler,t as createMcpServer,r as elysiaPlugin,i as expressRouter,a as makeNextAppHandler,o as makeNextPagesHandler,e as registerContractsOnBuilder};
@@ -0,0 +1,139 @@
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.telemetry`,title:`TelemetrySpec`,summary:"Telemetry specs describe product analytics in a durable, type-safe way. They reference existing `EventSpec`s (same name/version) but layer on privacy classification, retention, sampling, and anomaly detection so instrumentation stays compliant and observable.",kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/telemetry`,tags:[`tech`,`contracts`,`telemetry`],body:`## TelemetrySpec
2
+
3
+ Telemetry specs describe product analytics in a durable, type-safe way. They reference existing \`EventSpec\`s (same name/version) but layer on privacy classification, retention, sampling, and anomaly detection so instrumentation stays compliant and observable.
4
+
5
+ - **File location**: \`packages/libs/contracts/src/telemetry/spec.ts\`
6
+ - **Runtime tracker**: \`packages/libs/contracts/src/telemetry/tracker.ts\`
7
+ - **Anomaly monitor**: \`packages/libs/contracts/src/telemetry/anomaly.ts\`
8
+
9
+ ### Core concepts
10
+
11
+ \`\`\`ts
12
+ export interface TelemetrySpec {
13
+ meta: TelemetryMeta;
14
+ events: TelemetryEventDef[];
15
+ config?: TelemetryConfig;
16
+ }
17
+ \`\`\`
18
+
19
+ - \`meta\`: ownership + identifiers (\`name\`, \`version\`, \`domain\`)
20
+ - \`events\`: per-event semantics, property definitions, privacy level, retention, sampling, anomaly rules
21
+ - \`config\`: defaults and provider configuration
22
+ - \`TelemetryRegistry\`: registers specs, resolves latest version, finds event definitions by name/version
23
+
24
+ ### An example
25
+
26
+ \`\`\`ts
27
+ export const SigilTelemetry: TelemetrySpec = {
28
+ meta: {
29
+ name: 'sigil.telemetry',
30
+ version: 1,
31
+ title: 'Sigil telemetry',
32
+ description: 'Core Sigil product telemetry',
33
+ domain: 'sigil',
34
+ owners: ['@team.analytics'],
35
+ tags: ['telemetry'],
36
+ stability: StabilityEnum.Experimental,
37
+ },
38
+ config: {
39
+ defaultRetentionDays: 30,
40
+ defaultSamplingRate: 1,
41
+ providers: [
42
+ { type: 'posthog', config: { projectApiKey: process.env.POSTHOG_KEY } },
43
+ ],
44
+ },
45
+ events: [
46
+ {
47
+ name: 'sigil.telemetry.workflow_step',
48
+ version: 1,
49
+ semantics: {
50
+ what: 'Workflow step executed',
51
+ who: 'Actor executing the workflow',
52
+ },
53
+ privacy: 'internal',
54
+ properties: {
55
+ workflow: { type: 'string', required: true },
56
+ step: { type: 'string', required: true },
57
+ durationMs: { type: 'number' },
58
+ userId: { type: 'string', pii: true, redact: true },
59
+ },
60
+ anomalyDetection: {
61
+ enabled: true,
62
+ minimumSample: 10,
63
+ thresholds: [
64
+ { metric: 'durationMs', max: 1500 },
65
+ ],
66
+ actions: ['alert', 'trigger_regen'],
67
+ },
68
+ },
69
+ ],
70
+ };
71
+ \`\`\`
72
+
73
+ ### Tracking events at runtime
74
+
75
+ \`TelemetryTracker\` performs sampling, PII redaction, provider dispatch, and anomaly detection.
76
+
77
+ \`\`\`ts
78
+ const tracker = new TelemetryTracker({
79
+ registry: telemetryRegistry,
80
+ providers: [
81
+ {
82
+ id: 'posthog',
83
+ async send(dispatch) {
84
+ posthog.capture({
85
+ event: dispatch.name,
86
+ properties: dispatch.properties,
87
+ distinctId: dispatch.context.userId ?? dispatch.context.sessionId,
88
+ });
89
+ },
90
+ },
91
+ ],
92
+ anomalyMonitor: new TelemetryAnomalyMonitor({
93
+ onAnomaly(event) {
94
+ console.warn('Telemetry anomaly detected', event);
95
+ },
96
+ }),
97
+ });
98
+
99
+ await tracker.track('sigil.telemetry.workflow_step', 1, {
100
+ workflow: 'onboarding',
101
+ step: 'verify_email',
102
+ durationMs: 2100,
103
+ userId: 'user-123',
104
+ });
105
+ \`\`\`
106
+
107
+ - Sampling obeys the event-specific rate (fallback to spec defaults)
108
+ - Properties flagged with \`pii\` or \`redact\` are masked before dispatch
109
+ - Anomaly monitor evaluates thresholds and triggers actions (e.g., log, alert, regeneration)
110
+
111
+ ### Spec integration
112
+
113
+ - \`ContractSpec.telemetry\` allows operations to emit success/failure events automatically
114
+ - \`SpecRegistry.execute()\` uses the tracker when \`ctx.telemetry\` is provided
115
+ - \`WorkflowRunner\` (Phase 4 follow-up) will emit telemetry during step transitions
116
+ - \`TelemetrySpec\` events should reuse \`EventSpec\` names/versions to keep analytics/contract parity
117
+
118
+ ### CLI workflow
119
+
120
+ \`\`\`
121
+ contracts-cli create telemetry
122
+ \`\`\`
123
+
124
+ - Interactive wizard prompts for meta, providers, events, properties, retention, anomaly rules
125
+ - Output: \`*.telemetry.ts\` file using \`TelemetrySpec\`
126
+
127
+ ### Best practices
128
+
129
+ - Prefer \`internal\` privacy for non-PII; mark PII properties explicitly with \`pii\` + \`redact\`
130
+ - Keep sampling ≥0.05 except for high-volume events
131
+ - Configure anomaly detection on key metrics (duration, error count, conversion)
132
+ - Check telemetry into source control alongside contracts; regenerate via CLI when specs change
133
+
134
+ ### Next steps
135
+
136
+ - Phase 5: Regenerator monitors telemetry anomalies to propose spec improvements
137
+ - Phase 6: Studio surfaces telemetry controls per tenant via \`TenantAppConfig\`
138
+
139
+ `}];e(t);export{t as tech_contracts_telemetry_DocBlocks};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.contracts",
3
- "version": "0.0.0-canary-20251209233744",
3
+ "version": "0.0.0-canary-20251210075714",
4
4
  "scripts": {
5
5
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
6
6
  "build": "bun build:bundle && bun build:types",
@@ -26,7 +26,6 @@
26
26
  "@elevenlabs/elevenlabs-js": "^2.26.0",
27
27
  "@google-cloud/secret-manager": "^6.1.1",
28
28
  "@google-cloud/storage": "^7.18.0",
29
- "@lssm/lib.graphql-federation": "workspace:*",
30
29
  "@lssm/lib.schema": "workspace:*",
31
30
  "@mistralai/mistralai": "^1.2.3",
32
31
  "@modelcontextprotocol/sdk": "^1.24.3",
@@ -66,6 +65,7 @@
66
65
  "./app-config": "./src/app-config/index.ts",
67
66
  "./app-config/branding": "./src/app-config/branding.ts",
68
67
  "./app-config/contracts": "./src/app-config/contracts.ts",
68
+ "./app-config/docs/app-config.docblock": "./src/app-config/docs/app-config.docblock.ts",
69
69
  "./app-config/events": "./src/app-config/events.ts",
70
70
  "./app-config/lifecycle": "./src/app-config/lifecycle.ts",
71
71
  "./app-config/lifecycle-contracts": "./src/app-config/lifecycle-contracts.ts",
@@ -73,6 +73,7 @@
73
73
  "./app-config/spec": "./src/app-config/spec.ts",
74
74
  "./app-config/validation": "./src/app-config/validation.ts",
75
75
  "./capabilities": "./src/capabilities.ts",
76
+ "./capabilities/docs/capabilities.docblock": "./src/capabilities/docs/capabilities.docblock.ts",
76
77
  "./capabilities/openbanking": "./src/capabilities/openbanking.ts",
77
78
  "./client": "./src/client/index.ts",
78
79
  "./client/react": "./src/client/react/index.ts",
@@ -83,19 +84,51 @@
83
84
  "./contracts-adapter-hydration": "./src/contracts-adapter-hydration.ts",
84
85
  "./contracts-adapter-input": "./src/contracts-adapter-input.ts",
85
86
  "./data-views": "./src/data-views.ts",
87
+ "./data-views/docs/data-views.docblock": "./src/data-views/docs/data-views.docblock.ts",
86
88
  "./data-views/query-generator": "./src/data-views/query-generator.ts",
87
89
  "./data-views/runtime": "./src/data-views/runtime.ts",
90
+ "./docs": "./src/docs/index.ts",
91
+ "./docs/accessibility_wcag_compliance_specs.docblock": "./src/docs/accessibility_wcag_compliance_specs.docblock.ts",
92
+ "./docs/meta.docs": "./src/docs/meta.docs.ts",
93
+ "./docs/presentations": "./src/docs/presentations.ts",
94
+ "./docs/PUBLISHING.docblock": "./src/docs/PUBLISHING.docblock.ts",
95
+ "./docs/registry": "./src/docs/registry.ts",
96
+ "./docs/tech-contracts.docs": "./src/docs/tech-contracts.docs.ts",
97
+ "./docs/tech/contracts/create-subscription.docblock": "./src/docs/tech/contracts/create-subscription.docblock.ts",
98
+ "./docs/tech/contracts/graphql-typed-outputs.docblock": "./src/docs/tech/contracts/graphql-typed-outputs.docblock.ts",
99
+ "./docs/tech/contracts/migrations.docblock": "./src/docs/tech/contracts/migrations.docblock.ts",
100
+ "./docs/tech/contracts/ops-to-presentation-linking.docblock": "./src/docs/tech/contracts/ops-to-presentation-linking.docblock.ts",
101
+ "./docs/tech/contracts/overlays.docblock": "./src/docs/tech/contracts/overlays.docblock.ts",
102
+ "./docs/tech/contracts/README.docblock": "./src/docs/tech/contracts/README.docblock.ts",
103
+ "./docs/tech/contracts/tests.docblock": "./src/docs/tech/contracts/tests.docblock.ts",
104
+ "./docs/tech/contracts/themes.docblock": "./src/docs/tech/contracts/themes.docblock.ts",
105
+ "./docs/tech/contracts/vertical-pocket-family-office.docblock": "./src/docs/tech/contracts/vertical-pocket-family-office.docblock.ts",
106
+ "./docs/tech/lifecycle-stage-system.docblock": "./src/docs/tech/lifecycle-stage-system.docblock.ts",
107
+ "./docs/tech/mcp-endpoints.docblock": "./src/docs/tech/mcp-endpoints.docblock.ts",
108
+ "./docs/tech/PHASE_1_QUICKSTART.docblock": "./src/docs/tech/PHASE_1_QUICKSTART.docblock.ts",
109
+ "./docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock": "./src/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.ts",
110
+ "./docs/tech/PHASE_3_AUTO_EVOLUTION.docblock": "./src/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.ts",
111
+ "./docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock": "./src/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.ts",
112
+ "./docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock": "./src/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.ts",
113
+ "./docs/tech/presentation-runtime.docblock": "./src/docs/tech/presentation-runtime.docblock.ts",
114
+ "./docs/tech/schema/README.docblock": "./src/docs/tech/schema/README.docblock.ts",
115
+ "./docs/tech/templates/runtime.docblock": "./src/docs/tech/templates/runtime.docblock.ts",
116
+ "./docs/tech/workflows/overview.docblock": "./src/docs/tech/workflows/overview.docblock.ts",
117
+ "./docs/types": "./src/docs/types.ts",
88
118
  "./events": "./src/events.ts",
119
+ "./experiments/docs/experiments.docblock": "./src/experiments/docs/experiments.docblock.ts",
89
120
  "./experiments/evaluator": "./src/experiments/evaluator.ts",
90
121
  "./experiments/spec": "./src/experiments/spec.ts",
91
122
  "./experiments/spec-resolver": "./src/experiments/spec-resolver.ts",
92
123
  "./features": "./src/features.ts",
93
124
  "./forms": "./src/forms.ts",
125
+ "./forms/docs/forms.docblock": "./src/forms/docs/forms.docblock.ts",
94
126
  "./install": "./src/install.ts",
95
127
  "./integrations": "./src/integrations/index.ts",
96
128
  "./integrations/binding": "./src/integrations/binding.ts",
97
129
  "./integrations/connection": "./src/integrations/connection.ts",
98
130
  "./integrations/contracts": "./src/integrations/contracts.ts",
131
+ "./integrations/docs/integrations.docblock": "./src/integrations/docs/integrations.docblock.ts",
99
132
  "./integrations/health": "./src/integrations/health.ts",
100
133
  "./integrations/openbanking/contracts": "./src/integrations/openbanking/contracts/index.ts",
101
134
  "./integrations/openbanking/contracts/accounts": "./src/integrations/openbanking/contracts/accounts.ts",
@@ -162,6 +195,7 @@
162
195
  "./knowledge": "./src/knowledge/index.ts",
163
196
  "./knowledge/binding": "./src/knowledge/binding.ts",
164
197
  "./knowledge/contracts": "./src/knowledge/contracts.ts",
198
+ "./knowledge/docs/knowledge.docblock": "./src/knowledge/docs/knowledge.docblock.ts",
165
199
  "./knowledge/ingestion": "./src/knowledge/ingestion/index.ts",
166
200
  "./knowledge/ingestion/document-processor": "./src/knowledge/ingestion/document-processor.ts",
167
201
  "./knowledge/ingestion/embedding-service": "./src/knowledge/ingestion/embedding-service.ts",
@@ -183,17 +217,21 @@
183
217
  "./markdown": "./src/markdown.ts",
184
218
  "./migrations": "./src/migrations.ts",
185
219
  "./onboarding-base": "./src/onboarding-base.ts",
220
+ "./openbanking/docs/openbanking.docblock": "./src/openbanking/docs/openbanking.docblock.ts",
186
221
  "./ownership": "./src/ownership.ts",
222
+ "./policy/docs/policy.docblock": "./src/policy/docs/policy.docblock.ts",
187
223
  "./policy/engine": "./src/policy/engine.ts",
188
224
  "./policy/opa-adapter": "./src/policy/opa-adapter.ts",
189
225
  "./policy/spec": "./src/policy/spec.ts",
190
226
  "./presentations": "./src/presentations.ts",
191
227
  "./presentations.backcompat": "./src/presentations.backcompat.ts",
192
228
  "./presentations.v2": "./src/presentations.v2.ts",
229
+ "./presentations/docs/presentations-conventions.docblock": "./src/presentations/docs/presentations-conventions.docblock.ts",
193
230
  "./prompt": "./src/prompt.ts",
194
231
  "./promptRegistry": "./src/promptRegistry.ts",
195
232
  "./regenerator": "./src/regenerator/index.ts",
196
233
  "./regenerator/adapters": "./src/regenerator/adapters.ts",
234
+ "./regenerator/docs/regenerator.docblock": "./src/regenerator/docs/regenerator.docblock.ts",
197
235
  "./regenerator/executor": "./src/regenerator/executor.ts",
198
236
  "./regenerator/service": "./src/regenerator/service.ts",
199
237
  "./regenerator/sinks": "./src/regenerator/sinks.ts",
@@ -204,7 +242,6 @@
204
242
  "./schema-to-markdown": "./src/schema-to-markdown.ts",
205
243
  "./server": "./src/server/index.ts",
206
244
  "./server/graphql-pothos": "./src/server/graphql-pothos.ts",
207
- "./server/graphql-schema-export": "./src/server/graphql-schema-export.ts",
208
245
  "./server/provider-mcp": "./src/server/provider-mcp.ts",
209
246
  "./server/rest-elysia": "./src/server/rest-elysia.ts",
210
247
  "./server/rest-express": "./src/server/rest-express.ts",
@@ -215,6 +252,7 @@
215
252
  "./spec": "./src/spec.ts",
216
253
  "./telemetry": "./src/telemetry/index.ts",
217
254
  "./telemetry/anomaly": "./src/telemetry/anomaly.ts",
255
+ "./telemetry/docs/telemetry.docblock": "./src/telemetry/docs/telemetry.docblock.ts",
218
256
  "./telemetry/spec": "./src/telemetry/spec.ts",
219
257
  "./telemetry/tracker": "./src/telemetry/tracker.ts",
220
258
  "./tests": "./src/tests/index.ts",
@@ -245,6 +283,7 @@
245
283
  "./app-config": "./dist/app-config/index.js",
246
284
  "./app-config/branding": "./dist/app-config/branding.js",
247
285
  "./app-config/contracts": "./dist/app-config/contracts.js",
286
+ "./app-config/docs/app-config.docblock": "./dist/app-config/docs/app-config.docblock.js",
248
287
  "./app-config/events": "./dist/app-config/events.js",
249
288
  "./app-config/lifecycle": "./dist/app-config/lifecycle.js",
250
289
  "./app-config/lifecycle-contracts": "./dist/app-config/lifecycle-contracts.js",
@@ -252,6 +291,7 @@
252
291
  "./app-config/spec": "./dist/app-config/spec.js",
253
292
  "./app-config/validation": "./dist/app-config/validation.js",
254
293
  "./capabilities": "./dist/capabilities.js",
294
+ "./capabilities/docs/capabilities.docblock": "./dist/capabilities/docs/capabilities.docblock.js",
255
295
  "./capabilities/openbanking": "./dist/capabilities/openbanking.js",
256
296
  "./client": "./dist/client/index.js",
257
297
  "./client/react": "./dist/client/react/index.js",
@@ -262,19 +302,51 @@
262
302
  "./contracts-adapter-hydration": "./dist/contracts-adapter-hydration.js",
263
303
  "./contracts-adapter-input": "./dist/contracts-adapter-input.js",
264
304
  "./data-views": "./dist/data-views.js",
305
+ "./data-views/docs/data-views.docblock": "./dist/data-views/docs/data-views.docblock.js",
265
306
  "./data-views/query-generator": "./dist/data-views/query-generator.js",
266
307
  "./data-views/runtime": "./dist/data-views/runtime.js",
308
+ "./docs": "./dist/docs/index.js",
309
+ "./docs/accessibility_wcag_compliance_specs.docblock": "./dist/docs/accessibility_wcag_compliance_specs.docblock.js",
310
+ "./docs/meta.docs": "./dist/docs/meta.docs.js",
311
+ "./docs/presentations": "./dist/docs/presentations.js",
312
+ "./docs/PUBLISHING.docblock": "./dist/docs/PUBLISHING.docblock.js",
313
+ "./docs/registry": "./dist/docs/registry.js",
314
+ "./docs/tech-contracts.docs": "./dist/docs/tech-contracts.docs.js",
315
+ "./docs/tech/contracts/create-subscription.docblock": "./dist/docs/tech/contracts/create-subscription.docblock.js",
316
+ "./docs/tech/contracts/graphql-typed-outputs.docblock": "./dist/docs/tech/contracts/graphql-typed-outputs.docblock.js",
317
+ "./docs/tech/contracts/migrations.docblock": "./dist/docs/tech/contracts/migrations.docblock.js",
318
+ "./docs/tech/contracts/ops-to-presentation-linking.docblock": "./dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js",
319
+ "./docs/tech/contracts/overlays.docblock": "./dist/docs/tech/contracts/overlays.docblock.js",
320
+ "./docs/tech/contracts/README.docblock": "./dist/docs/tech/contracts/README.docblock.js",
321
+ "./docs/tech/contracts/tests.docblock": "./dist/docs/tech/contracts/tests.docblock.js",
322
+ "./docs/tech/contracts/themes.docblock": "./dist/docs/tech/contracts/themes.docblock.js",
323
+ "./docs/tech/contracts/vertical-pocket-family-office.docblock": "./dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js",
324
+ "./docs/tech/lifecycle-stage-system.docblock": "./dist/docs/tech/lifecycle-stage-system.docblock.js",
325
+ "./docs/tech/mcp-endpoints.docblock": "./dist/docs/tech/mcp-endpoints.docblock.js",
326
+ "./docs/tech/PHASE_1_QUICKSTART.docblock": "./dist/docs/tech/PHASE_1_QUICKSTART.docblock.js",
327
+ "./docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock": "./dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js",
328
+ "./docs/tech/PHASE_3_AUTO_EVOLUTION.docblock": "./dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js",
329
+ "./docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock": "./dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js",
330
+ "./docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock": "./dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js",
331
+ "./docs/tech/presentation-runtime.docblock": "./dist/docs/tech/presentation-runtime.docblock.js",
332
+ "./docs/tech/schema/README.docblock": "./dist/docs/tech/schema/README.docblock.js",
333
+ "./docs/tech/templates/runtime.docblock": "./dist/docs/tech/templates/runtime.docblock.js",
334
+ "./docs/tech/workflows/overview.docblock": "./dist/docs/tech/workflows/overview.docblock.js",
335
+ "./docs/types": "./dist/docs/types.js",
267
336
  "./events": "./dist/events.js",
337
+ "./experiments/docs/experiments.docblock": "./dist/experiments/docs/experiments.docblock.js",
268
338
  "./experiments/evaluator": "./dist/experiments/evaluator.js",
269
339
  "./experiments/spec": "./dist/experiments/spec.js",
270
340
  "./experiments/spec-resolver": "./dist/experiments/spec-resolver.js",
271
341
  "./features": "./dist/features.js",
272
342
  "./forms": "./dist/forms.js",
343
+ "./forms/docs/forms.docblock": "./dist/forms/docs/forms.docblock.js",
273
344
  "./install": "./dist/install.js",
274
345
  "./integrations": "./dist/integrations/index.js",
275
346
  "./integrations/binding": "./dist/integrations/binding.js",
276
347
  "./integrations/connection": "./dist/integrations/connection.js",
277
348
  "./integrations/contracts": "./dist/integrations/contracts.js",
349
+ "./integrations/docs/integrations.docblock": "./dist/integrations/docs/integrations.docblock.js",
278
350
  "./integrations/health": "./dist/integrations/health.js",
279
351
  "./integrations/openbanking/contracts": "./dist/integrations/openbanking/contracts/index.js",
280
352
  "./integrations/openbanking/contracts/accounts": "./dist/integrations/openbanking/contracts/accounts.js",
@@ -341,6 +413,7 @@
341
413
  "./knowledge": "./dist/knowledge/index.js",
342
414
  "./knowledge/binding": "./dist/knowledge/binding.js",
343
415
  "./knowledge/contracts": "./dist/knowledge/contracts.js",
416
+ "./knowledge/docs/knowledge.docblock": "./dist/knowledge/docs/knowledge.docblock.js",
344
417
  "./knowledge/ingestion": "./dist/knowledge/ingestion/index.js",
345
418
  "./knowledge/ingestion/document-processor": "./dist/knowledge/ingestion/document-processor.js",
346
419
  "./knowledge/ingestion/embedding-service": "./dist/knowledge/ingestion/embedding-service.js",
@@ -362,17 +435,21 @@
362
435
  "./markdown": "./dist/markdown.js",
363
436
  "./migrations": "./dist/migrations.js",
364
437
  "./onboarding-base": "./dist/onboarding-base.js",
438
+ "./openbanking/docs/openbanking.docblock": "./dist/openbanking/docs/openbanking.docblock.js",
365
439
  "./ownership": "./dist/ownership.js",
440
+ "./policy/docs/policy.docblock": "./dist/policy/docs/policy.docblock.js",
366
441
  "./policy/engine": "./dist/policy/engine.js",
367
442
  "./policy/opa-adapter": "./dist/policy/opa-adapter.js",
368
443
  "./policy/spec": "./dist/policy/spec.js",
369
444
  "./presentations": "./dist/presentations.js",
370
445
  "./presentations.backcompat": "./dist/presentations.backcompat.js",
371
446
  "./presentations.v2": "./dist/presentations.v2.js",
447
+ "./presentations/docs/presentations-conventions.docblock": "./dist/presentations/docs/presentations-conventions.docblock.js",
372
448
  "./prompt": "./dist/prompt.js",
373
449
  "./promptRegistry": "./dist/promptRegistry.js",
374
450
  "./regenerator": "./dist/regenerator/index.js",
375
451
  "./regenerator/adapters": "./dist/regenerator/adapters.js",
452
+ "./regenerator/docs/regenerator.docblock": "./dist/regenerator/docs/regenerator.docblock.js",
376
453
  "./regenerator/executor": "./dist/regenerator/executor.js",
377
454
  "./regenerator/service": "./dist/regenerator/service.js",
378
455
  "./regenerator/sinks": "./dist/regenerator/sinks.js",
@@ -383,7 +460,6 @@
383
460
  "./schema-to-markdown": "./dist/schema-to-markdown.js",
384
461
  "./server": "./dist/server/index.js",
385
462
  "./server/graphql-pothos": "./dist/server/graphql-pothos.js",
386
- "./server/graphql-schema-export": "./dist/server/graphql-schema-export.js",
387
463
  "./server/provider-mcp": "./dist/server/provider-mcp.js",
388
464
  "./server/rest-elysia": "./dist/server/rest-elysia.js",
389
465
  "./server/rest-express": "./dist/server/rest-express.js",
@@ -394,6 +470,7 @@
394
470
  "./spec": "./dist/spec.js",
395
471
  "./telemetry": "./dist/telemetry/index.js",
396
472
  "./telemetry/anomaly": "./dist/telemetry/anomaly.js",
473
+ "./telemetry/docs/telemetry.docblock": "./dist/telemetry/docs/telemetry.docblock.js",
397
474
  "./telemetry/spec": "./dist/telemetry/spec.js",
398
475
  "./telemetry/tracker": "./dist/telemetry/tracker.js",
399
476
  "./tests": "./dist/tests/index.js",
@@ -1 +0,0 @@
1
- "use server";import{require_graphql as e}from"../node_modules/graphql/index.js";import{toSubgraphSDL as t}from"@lssm/lib.graphql-federation";var n=e();const r=async(e,r)=>{let i=await import(`fs`),a=await import(`path`),o=(0,n.printSchema)(e),s=t(e),c=a.join(r,`../schema.graphql`),l=a.join(r,`../schema.subgraph.graphql`);i.writeFileSync(c,o),console.log(`Schema exported to ${c}`),i.writeFileSync(l,s),console.log(`Subgraph exported to ${l}`)};export{r as exportContractsToGraphQLSchema};