@lssm/lib.contracts 0.0.0-canary-20251220030446 → 0.0.0-canary-20251221114240

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 (64) hide show
  1. package/README.md +4 -4
  2. package/dist/app-config/contracts.d.ts +60 -60
  3. package/dist/app-config/contracts.js +1 -1
  4. package/dist/app-config/events.d.ts +27 -27
  5. package/dist/app-config/lifecycle-contracts.d.ts +10 -10
  6. package/dist/app-config/lifecycle-contracts.js +1 -1
  7. package/dist/docs/tech/contracts/README.docblock.js +2 -2
  8. package/dist/docs/tech/contracts/openapi-export.docblock.js +6 -6
  9. package/dist/docs/tech/contracts/ops-to-presentation-linking.docblock.js +2 -2
  10. package/dist/docs/tech/contracts/tests.docblock.js +2 -2
  11. package/dist/experiments/spec-resolver.d.ts +2 -2
  12. package/dist/features.d.ts +5 -5
  13. package/dist/index.d.ts +6 -4
  14. package/dist/index.js +5 -3
  15. package/dist/install.d.ts +16 -16
  16. package/dist/integrations/contracts.d.ts +9 -9
  17. package/dist/integrations/contracts.js +1 -1
  18. package/dist/integrations/openbanking/contracts/accounts.d.ts +73 -73
  19. package/dist/integrations/openbanking/contracts/accounts.js +1 -1
  20. package/dist/integrations/openbanking/contracts/balances.d.ts +40 -40
  21. package/dist/integrations/openbanking/contracts/balances.js +1 -1
  22. package/dist/integrations/openbanking/contracts/index.d.ts +2 -2
  23. package/dist/integrations/openbanking/contracts/transactions.d.ts +54 -54
  24. package/dist/integrations/openbanking/contracts/transactions.js +1 -1
  25. package/dist/jsonschema.d.ts +5 -5
  26. package/dist/knowledge/contracts.d.ts +9 -9
  27. package/dist/knowledge/contracts.js +1 -1
  28. package/dist/llm/exporters.d.ts +8 -8
  29. package/dist/llm/exporters.js +1 -1
  30. package/dist/llm/prompts.d.ts +7 -7
  31. package/dist/llm/types.d.ts +3 -3
  32. package/dist/markdown.d.ts +3 -3
  33. package/dist/markdown.js +1 -1
  34. package/dist/onboarding-base.d.ts +32 -32
  35. package/dist/onboarding-base.js +1 -1
  36. package/dist/openapi.d.ts +2 -2
  37. package/dist/{spec.d.ts → operation.d.ts} +12 -12
  38. package/dist/{spec.js → operation.js} +1 -1
  39. package/dist/policy/docs/policy.docblock.js +1 -1
  40. package/dist/presentations.d.ts +3 -3
  41. package/dist/registry.d.ts +13 -14
  42. package/dist/registry.js +5 -5
  43. package/dist/server/graphql-pothos.d.ts +6 -6
  44. package/dist/server/graphql-pothos.js +4 -4
  45. package/dist/server/mcp/createMcpServer.d.ts +3 -3
  46. package/dist/server/mcp/createMcpServer.js +1 -1
  47. package/dist/server/mcp/registerTools.d.ts +2 -2
  48. package/dist/server/rest-elysia.d.ts +2 -2
  49. package/dist/server/rest-express.d.ts +2 -2
  50. package/dist/server/rest-generic.d.ts +3 -3
  51. package/dist/server/rest-generic.js +1 -1
  52. package/dist/server/rest-next-app.d.ts +4 -4
  53. package/dist/server/rest-next-app.js +2 -2
  54. package/dist/server/rest-next-mcp.d.ts +2 -2
  55. package/dist/server/rest-next-pages.d.ts +2 -2
  56. package/dist/telemetry/docs/telemetry.docblock.js +1 -1
  57. package/dist/tests/runner.d.ts +2 -2
  58. package/dist/types/all.d.ts +2 -2
  59. package/dist/workflow/validation.d.ts +2 -2
  60. package/dist/workspace-config/contractsrc-schema.d.ts +188 -0
  61. package/dist/workspace-config/contractsrc-schema.js +114 -0
  62. package/dist/workspace-config/index.d.ts +2 -0
  63. package/dist/workspace-config/index.js +3 -0
  64. package/package.json +13 -11
package/README.md CHANGED
@@ -19,14 +19,14 @@ bun add @lssm/lib.contracts @lssm/lib.schema
19
19
  ## Key Concepts
20
20
 
21
21
  - **Spec-First, TypeScript-First**: Define operations in pure TypeScript (no YAML).
22
- - **Runtime Adapters**: The `SpecRegistry` is passed to adapters (e.g., `makeNextAppHandler`) to serve APIs dynamically. There is no intermediate "compile" step to generate code; the spec _is_ the code.
22
+ - **Runtime Adapters**: The `OperationSpecRegistry` is passed to adapters (e.g., `makeNextAppHandler`) to serve APIs dynamically. There is no intermediate "compile" step to generate code; the spec _is_ the code.
23
23
  - **Capabilities**: `defineCommand` (writes) and `defineQuery` (reads) with Zod-backed I/O.
24
24
  - **Events**: `defineEvent` for type-safe side effects.
25
25
  - **Presentations**: (V2) Describe how data is rendered (Web Components, Markdown, Data) for automated UI generation.
26
26
 
27
27
  ## Exports
28
28
 
29
- - **Core**: `SpecRegistry`, `defineCommand`, `defineQuery`, `defineEvent`.
29
+ - **Core**: `OperationSpecRegistry`, `defineCommand`, `defineQuery`, `defineEvent`.
30
30
  - **Adapters**:
31
31
  - `server/rest-next-app`: Next.js App Router adapter.
32
32
  - `server/provider-mcp`: Model Context Protocol (MCP) adapter for AI agents.
@@ -78,9 +78,9 @@ export const CreateUser = defineCommand({
78
78
  ### 2. Register and Implement
79
79
 
80
80
  ```ts
81
- import { SpecRegistry, installOp } from '@lssm/lib.contracts';
81
+ import { OperationSpecRegistry, installOp } from '@lssm/lib.contracts';
82
82
 
83
- const reg = new SpecRegistry();
83
+ const reg = new OperationSpecRegistry();
84
84
 
85
85
  installOp(reg, CreateUser, async (ctx, input) => {
86
86
  // Implementation logic here
@@ -1,38 +1,38 @@
1
- import { ContractSpec } from "../spec.js";
2
- import { SpecRegistry } from "../registry.js";
3
- import * as _lssm_lib_schema206 from "@lssm/lib.schema";
1
+ import { OperationSpec } from "../operation.js";
2
+ import { OperationSpecRegistry } from "../registry.js";
3
+ import * as _lssm_lib_schema242 from "@lssm/lib.schema";
4
4
  import { SchemaModel } from "@lssm/lib.schema";
5
5
 
6
6
  //#region src/app-config/contracts.d.ts
7
- declare const UpdateTenantBrandingCommand: ContractSpec<SchemaModel<{
7
+ declare const UpdateTenantBrandingCommand: OperationSpec<SchemaModel<{
8
8
  tenantId: {
9
- type: _lssm_lib_schema206.FieldType<string, string>;
9
+ type: _lssm_lib_schema242.FieldType<string, string>;
10
10
  isOptional: false;
11
11
  };
12
12
  appId: {
13
- type: _lssm_lib_schema206.FieldType<string, string>;
13
+ type: _lssm_lib_schema242.FieldType<string, string>;
14
14
  isOptional: false;
15
15
  };
16
16
  environment: {
17
- type: _lssm_lib_schema206.FieldType<string, string>;
17
+ type: _lssm_lib_schema242.FieldType<string, string>;
18
18
  isOptional: true;
19
19
  };
20
20
  appName: {
21
- type: _lssm_lib_schema206.FieldType<Record<string, unknown>, Record<string, unknown>>;
21
+ type: _lssm_lib_schema242.FieldType<Record<string, unknown>, Record<string, unknown>>;
22
22
  isOptional: true;
23
23
  };
24
24
  assets: {
25
25
  type: SchemaModel<{
26
26
  type: {
27
- type: _lssm_lib_schema206.FieldType<string, string>;
27
+ type: _lssm_lib_schema242.FieldType<string, string>;
28
28
  isOptional: false;
29
29
  };
30
30
  url: {
31
- type: _lssm_lib_schema206.FieldType<string, string>;
31
+ type: _lssm_lib_schema242.FieldType<string, string>;
32
32
  isOptional: false;
33
33
  };
34
34
  mimeType: {
35
- type: _lssm_lib_schema206.FieldType<string, string>;
35
+ type: _lssm_lib_schema242.FieldType<string, string>;
36
36
  isOptional: true;
37
37
  };
38
38
  }>;
@@ -40,92 +40,92 @@ declare const UpdateTenantBrandingCommand: ContractSpec<SchemaModel<{
40
40
  isArray: true;
41
41
  };
42
42
  colors: {
43
- type: _lssm_lib_schema206.FieldType<Record<string, unknown>, Record<string, unknown>>;
43
+ type: _lssm_lib_schema242.FieldType<Record<string, unknown>, Record<string, unknown>>;
44
44
  isOptional: true;
45
45
  };
46
46
  customDomain: {
47
- type: _lssm_lib_schema206.FieldType<string, string>;
47
+ type: _lssm_lib_schema242.FieldType<string, string>;
48
48
  isOptional: true;
49
49
  };
50
50
  subdomain: {
51
- type: _lssm_lib_schema206.FieldType<string, string>;
51
+ type: _lssm_lib_schema242.FieldType<string, string>;
52
52
  isOptional: true;
53
53
  };
54
54
  }>, SchemaModel<{
55
55
  success: {
56
- type: _lssm_lib_schema206.FieldType<boolean, boolean>;
56
+ type: _lssm_lib_schema242.FieldType<boolean, boolean>;
57
57
  isOptional: false;
58
58
  };
59
59
  updatedAt: {
60
- type: _lssm_lib_schema206.FieldType<Date, string>;
60
+ type: _lssm_lib_schema242.FieldType<Date, string>;
61
61
  isOptional: false;
62
62
  };
63
63
  }>, undefined>;
64
- declare const VerifyCustomDomainCommand: ContractSpec<SchemaModel<{
64
+ declare const VerifyCustomDomainCommand: OperationSpec<SchemaModel<{
65
65
  tenantId: {
66
- type: _lssm_lib_schema206.FieldType<string, string>;
66
+ type: _lssm_lib_schema242.FieldType<string, string>;
67
67
  isOptional: false;
68
68
  };
69
69
  appId: {
70
- type: _lssm_lib_schema206.FieldType<string, string>;
70
+ type: _lssm_lib_schema242.FieldType<string, string>;
71
71
  isOptional: false;
72
72
  };
73
73
  domain: {
74
- type: _lssm_lib_schema206.FieldType<string, string>;
74
+ type: _lssm_lib_schema242.FieldType<string, string>;
75
75
  isOptional: false;
76
76
  };
77
77
  }>, SchemaModel<{
78
78
  status: {
79
- type: _lssm_lib_schema206.FieldType<string, string>;
79
+ type: _lssm_lib_schema242.FieldType<string, string>;
80
80
  isOptional: false;
81
81
  };
82
82
  message: {
83
- type: _lssm_lib_schema206.FieldType<string, string>;
83
+ type: _lssm_lib_schema242.FieldType<string, string>;
84
84
  isOptional: true;
85
85
  };
86
86
  }>, undefined>;
87
- declare const UpdateBlueprintTranslationCatalogCommand: ContractSpec<SchemaModel<{
87
+ declare const UpdateBlueprintTranslationCatalogCommand: OperationSpec<SchemaModel<{
88
88
  blueprintName: {
89
- type: _lssm_lib_schema206.FieldType<string, string>;
89
+ type: _lssm_lib_schema242.FieldType<string, string>;
90
90
  isOptional: false;
91
91
  };
92
92
  blueprintVersion: {
93
- type: _lssm_lib_schema206.FieldType<number, number>;
93
+ type: _lssm_lib_schema242.FieldType<number, number>;
94
94
  isOptional: false;
95
95
  };
96
96
  catalogName: {
97
- type: _lssm_lib_schema206.FieldType<string, string>;
97
+ type: _lssm_lib_schema242.FieldType<string, string>;
98
98
  isOptional: false;
99
99
  };
100
100
  catalogVersion: {
101
- type: _lssm_lib_schema206.FieldType<number, number>;
101
+ type: _lssm_lib_schema242.FieldType<number, number>;
102
102
  isOptional: false;
103
103
  };
104
104
  defaultLocale: {
105
- type: _lssm_lib_schema206.FieldType<string, string>;
105
+ type: _lssm_lib_schema242.FieldType<string, string>;
106
106
  isOptional: false;
107
107
  };
108
108
  supportedLocales: {
109
- type: _lssm_lib_schema206.FieldType<string, string>;
109
+ type: _lssm_lib_schema242.FieldType<string, string>;
110
110
  isOptional: false;
111
111
  isArray: true;
112
112
  };
113
113
  entries: {
114
114
  type: SchemaModel<{
115
115
  key: {
116
- type: _lssm_lib_schema206.FieldType<string, string>;
116
+ type: _lssm_lib_schema242.FieldType<string, string>;
117
117
  isOptional: false;
118
118
  };
119
119
  locale: {
120
- type: _lssm_lib_schema206.FieldType<string, string>;
120
+ type: _lssm_lib_schema242.FieldType<string, string>;
121
121
  isOptional: false;
122
122
  };
123
123
  value: {
124
- type: _lssm_lib_schema206.FieldType<string, string>;
124
+ type: _lssm_lib_schema242.FieldType<string, string>;
125
125
  isOptional: false;
126
126
  };
127
127
  context: {
128
- type: _lssm_lib_schema206.FieldType<string, string>;
128
+ type: _lssm_lib_schema242.FieldType<string, string>;
129
129
  isOptional: true;
130
130
  };
131
131
  }>;
@@ -134,39 +134,39 @@ declare const UpdateBlueprintTranslationCatalogCommand: ContractSpec<SchemaModel
134
134
  };
135
135
  }>, SchemaModel<{
136
136
  success: {
137
- type: _lssm_lib_schema206.FieldType<boolean, boolean>;
137
+ type: _lssm_lib_schema242.FieldType<boolean, boolean>;
138
138
  isOptional: false;
139
139
  };
140
140
  updatedAt: {
141
- type: _lssm_lib_schema206.FieldType<Date, string>;
141
+ type: _lssm_lib_schema242.FieldType<Date, string>;
142
142
  isOptional: false;
143
143
  };
144
144
  }>, undefined>;
145
- declare const UpdateTenantTranslationOverridesCommand: ContractSpec<SchemaModel<{
145
+ declare const UpdateTenantTranslationOverridesCommand: OperationSpec<SchemaModel<{
146
146
  tenantId: {
147
- type: _lssm_lib_schema206.FieldType<string, string>;
147
+ type: _lssm_lib_schema242.FieldType<string, string>;
148
148
  isOptional: false;
149
149
  };
150
150
  appId: {
151
- type: _lssm_lib_schema206.FieldType<string, string>;
151
+ type: _lssm_lib_schema242.FieldType<string, string>;
152
152
  isOptional: false;
153
153
  };
154
154
  entries: {
155
155
  type: SchemaModel<{
156
156
  key: {
157
- type: _lssm_lib_schema206.FieldType<string, string>;
157
+ type: _lssm_lib_schema242.FieldType<string, string>;
158
158
  isOptional: false;
159
159
  };
160
160
  locale: {
161
- type: _lssm_lib_schema206.FieldType<string, string>;
161
+ type: _lssm_lib_schema242.FieldType<string, string>;
162
162
  isOptional: false;
163
163
  };
164
164
  value: {
165
- type: _lssm_lib_schema206.FieldType<string, string>;
165
+ type: _lssm_lib_schema242.FieldType<string, string>;
166
166
  isOptional: false;
167
167
  };
168
168
  context: {
169
- type: _lssm_lib_schema206.FieldType<string, string>;
169
+ type: _lssm_lib_schema242.FieldType<string, string>;
170
170
  isOptional: true;
171
171
  };
172
172
  }>;
@@ -174,71 +174,71 @@ declare const UpdateTenantTranslationOverridesCommand: ContractSpec<SchemaModel<
174
174
  isArray: true;
175
175
  };
176
176
  defaultLocale: {
177
- type: _lssm_lib_schema206.FieldType<string, string>;
177
+ type: _lssm_lib_schema242.FieldType<string, string>;
178
178
  isOptional: true;
179
179
  };
180
180
  enabledLocales: {
181
- type: _lssm_lib_schema206.FieldType<string, string>;
181
+ type: _lssm_lib_schema242.FieldType<string, string>;
182
182
  isOptional: true;
183
183
  isArray: true;
184
184
  };
185
185
  }>, SchemaModel<{
186
186
  success: {
187
- type: _lssm_lib_schema206.FieldType<boolean, boolean>;
187
+ type: _lssm_lib_schema242.FieldType<boolean, boolean>;
188
188
  isOptional: false;
189
189
  };
190
190
  updatedAt: {
191
- type: _lssm_lib_schema206.FieldType<Date, string>;
191
+ type: _lssm_lib_schema242.FieldType<Date, string>;
192
192
  isOptional: false;
193
193
  };
194
194
  }>, undefined>;
195
- declare const GetResolvedBrandingQuery: ContractSpec<SchemaModel<{
195
+ declare const GetResolvedBrandingQuery: OperationSpec<SchemaModel<{
196
196
  tenantId: {
197
- type: _lssm_lib_schema206.FieldType<string, string>;
197
+ type: _lssm_lib_schema242.FieldType<string, string>;
198
198
  isOptional: false;
199
199
  };
200
200
  appId: {
201
- type: _lssm_lib_schema206.FieldType<string, string>;
201
+ type: _lssm_lib_schema242.FieldType<string, string>;
202
202
  isOptional: false;
203
203
  };
204
204
  environment: {
205
- type: _lssm_lib_schema206.FieldType<string, string>;
205
+ type: _lssm_lib_schema242.FieldType<string, string>;
206
206
  isOptional: true;
207
207
  };
208
208
  }>, SchemaModel<{
209
209
  branding: {
210
- type: _lssm_lib_schema206.FieldType<Record<string, unknown>, Record<string, unknown>>;
210
+ type: _lssm_lib_schema242.FieldType<Record<string, unknown>, Record<string, unknown>>;
211
211
  isOptional: false;
212
212
  };
213
213
  }>, undefined>;
214
- declare const ResolveMessageQuery: ContractSpec<SchemaModel<{
214
+ declare const ResolveMessageQuery: OperationSpec<SchemaModel<{
215
215
  tenantId: {
216
- type: _lssm_lib_schema206.FieldType<string, string>;
216
+ type: _lssm_lib_schema242.FieldType<string, string>;
217
217
  isOptional: false;
218
218
  };
219
219
  appId: {
220
- type: _lssm_lib_schema206.FieldType<string, string>;
220
+ type: _lssm_lib_schema242.FieldType<string, string>;
221
221
  isOptional: false;
222
222
  };
223
223
  locale: {
224
- type: _lssm_lib_schema206.FieldType<string, string>;
224
+ type: _lssm_lib_schema242.FieldType<string, string>;
225
225
  isOptional: false;
226
226
  };
227
227
  key: {
228
- type: _lssm_lib_schema206.FieldType<string, string>;
228
+ type: _lssm_lib_schema242.FieldType<string, string>;
229
229
  isOptional: false;
230
230
  };
231
231
  }>, SchemaModel<{
232
232
  value: {
233
- type: _lssm_lib_schema206.FieldType<string, string>;
233
+ type: _lssm_lib_schema242.FieldType<string, string>;
234
234
  isOptional: true;
235
235
  };
236
236
  source: {
237
- type: _lssm_lib_schema206.FieldType<string, string>;
237
+ type: _lssm_lib_schema242.FieldType<string, string>;
238
238
  isOptional: true;
239
239
  };
240
240
  }>, undefined>;
241
- declare const appConfigContracts: Record<string, ContractSpec<any, any>>;
242
- declare function registerAppConfigContracts(registry: SpecRegistry): SpecRegistry;
241
+ declare const appConfigContracts: Record<string, OperationSpec<any, any>>;
242
+ declare function registerAppConfigContracts(registry: OperationSpecRegistry): OperationSpecRegistry;
243
243
  //#endregion
244
244
  export { GetResolvedBrandingQuery, ResolveMessageQuery, UpdateBlueprintTranslationCatalogCommand, UpdateTenantBrandingCommand, UpdateTenantTranslationOverridesCommand, VerifyCustomDomainCommand, appConfigContracts, registerAppConfigContracts };
@@ -1,5 +1,5 @@
1
1
  import { E5, x8 } from "../schema/dist/index.js";
2
- import { defineCommand, defineQuery } from "../spec.js";
2
+ import { defineCommand, defineQuery } from "../operation.js";
3
3
  import { OwnersEnum, StabilityEnum, TagsEnum } from "../ownership.js";
4
4
 
5
5
  //#region src/app-config/contracts.ts
@@ -1,120 +1,120 @@
1
1
  import { EventSpec } from "../events.js";
2
2
  import "../index.js";
3
- import * as _lssm_lib_schema263 from "@lssm/lib.schema";
3
+ import * as _lssm_lib_schema291 from "@lssm/lib.schema";
4
4
  import { SchemaModel } from "@lssm/lib.schema";
5
5
 
6
6
  //#region src/app-config/events.d.ts
7
7
  declare const ConfigDraftCreatedEvent: EventSpec<SchemaModel<{
8
8
  tenantId: {
9
- type: _lssm_lib_schema263.FieldType<string, string>;
9
+ type: _lssm_lib_schema291.FieldType<string, string>;
10
10
  isOptional: false;
11
11
  };
12
12
  appId: {
13
- type: _lssm_lib_schema263.FieldType<string, string>;
13
+ type: _lssm_lib_schema291.FieldType<string, string>;
14
14
  isOptional: false;
15
15
  };
16
16
  version: {
17
- type: _lssm_lib_schema263.FieldType<number, number>;
17
+ type: _lssm_lib_schema291.FieldType<number, number>;
18
18
  isOptional: false;
19
19
  };
20
20
  blueprintName: {
21
- type: _lssm_lib_schema263.FieldType<string, string>;
21
+ type: _lssm_lib_schema291.FieldType<string, string>;
22
22
  isOptional: false;
23
23
  };
24
24
  blueprintVersion: {
25
- type: _lssm_lib_schema263.FieldType<number, number>;
25
+ type: _lssm_lib_schema291.FieldType<number, number>;
26
26
  isOptional: false;
27
27
  };
28
28
  createdBy: {
29
- type: _lssm_lib_schema263.FieldType<string, string>;
29
+ type: _lssm_lib_schema291.FieldType<string, string>;
30
30
  isOptional: false;
31
31
  };
32
32
  clonedFrom: {
33
- type: _lssm_lib_schema263.FieldType<number, number>;
33
+ type: _lssm_lib_schema291.FieldType<number, number>;
34
34
  isOptional: true;
35
35
  };
36
36
  }>>;
37
37
  declare const ConfigPromotedToPreviewEvent: EventSpec<SchemaModel<{
38
38
  tenantId: {
39
- type: _lssm_lib_schema263.FieldType<string, string>;
39
+ type: _lssm_lib_schema291.FieldType<string, string>;
40
40
  isOptional: false;
41
41
  };
42
42
  appId: {
43
- type: _lssm_lib_schema263.FieldType<string, string>;
43
+ type: _lssm_lib_schema291.FieldType<string, string>;
44
44
  isOptional: false;
45
45
  };
46
46
  version: {
47
- type: _lssm_lib_schema263.FieldType<number, number>;
47
+ type: _lssm_lib_schema291.FieldType<number, number>;
48
48
  isOptional: false;
49
49
  };
50
50
  promotedBy: {
51
- type: _lssm_lib_schema263.FieldType<string, string>;
51
+ type: _lssm_lib_schema291.FieldType<string, string>;
52
52
  isOptional: false;
53
53
  };
54
54
  warnings: {
55
- type: _lssm_lib_schema263.FieldType<string, string>;
55
+ type: _lssm_lib_schema291.FieldType<string, string>;
56
56
  isOptional: true;
57
57
  isArray: true;
58
58
  };
59
59
  }>>;
60
60
  declare const ConfigPublishedEvent: EventSpec<SchemaModel<{
61
61
  tenantId: {
62
- type: _lssm_lib_schema263.FieldType<string, string>;
62
+ type: _lssm_lib_schema291.FieldType<string, string>;
63
63
  isOptional: false;
64
64
  };
65
65
  appId: {
66
- type: _lssm_lib_schema263.FieldType<string, string>;
66
+ type: _lssm_lib_schema291.FieldType<string, string>;
67
67
  isOptional: false;
68
68
  };
69
69
  version: {
70
- type: _lssm_lib_schema263.FieldType<number, number>;
70
+ type: _lssm_lib_schema291.FieldType<number, number>;
71
71
  isOptional: false;
72
72
  };
73
73
  previousVersion: {
74
- type: _lssm_lib_schema263.FieldType<number, number>;
74
+ type: _lssm_lib_schema291.FieldType<number, number>;
75
75
  isOptional: true;
76
76
  };
77
77
  publishedBy: {
78
- type: _lssm_lib_schema263.FieldType<string, string>;
78
+ type: _lssm_lib_schema291.FieldType<string, string>;
79
79
  isOptional: false;
80
80
  };
81
81
  changeSummary: {
82
- type: _lssm_lib_schema263.FieldType<string, string>;
82
+ type: _lssm_lib_schema291.FieldType<string, string>;
83
83
  isOptional: true;
84
84
  };
85
85
  changedSections: {
86
- type: _lssm_lib_schema263.FieldType<string, string>;
86
+ type: _lssm_lib_schema291.FieldType<string, string>;
87
87
  isOptional: true;
88
88
  isArray: true;
89
89
  };
90
90
  }>>;
91
91
  declare const ConfigRolledBackEvent: EventSpec<SchemaModel<{
92
92
  tenantId: {
93
- type: _lssm_lib_schema263.FieldType<string, string>;
93
+ type: _lssm_lib_schema291.FieldType<string, string>;
94
94
  isOptional: false;
95
95
  };
96
96
  appId: {
97
- type: _lssm_lib_schema263.FieldType<string, string>;
97
+ type: _lssm_lib_schema291.FieldType<string, string>;
98
98
  isOptional: false;
99
99
  };
100
100
  newVersion: {
101
- type: _lssm_lib_schema263.FieldType<number, number>;
101
+ type: _lssm_lib_schema291.FieldType<number, number>;
102
102
  isOptional: false;
103
103
  };
104
104
  rolledBackFrom: {
105
- type: _lssm_lib_schema263.FieldType<number, number>;
105
+ type: _lssm_lib_schema291.FieldType<number, number>;
106
106
  isOptional: false;
107
107
  };
108
108
  rolledBackTo: {
109
- type: _lssm_lib_schema263.FieldType<number, number>;
109
+ type: _lssm_lib_schema291.FieldType<number, number>;
110
110
  isOptional: false;
111
111
  };
112
112
  rolledBackBy: {
113
- type: _lssm_lib_schema263.FieldType<string, string>;
113
+ type: _lssm_lib_schema291.FieldType<string, string>;
114
114
  isOptional: false;
115
115
  };
116
116
  reason: {
117
- type: _lssm_lib_schema263.FieldType<string, string>;
117
+ type: _lssm_lib_schema291.FieldType<string, string>;
118
118
  isOptional: false;
119
119
  };
120
120
  }>>;
@@ -1,12 +1,12 @@
1
1
  import { EventSpec } from "../events.js";
2
- import { ContractSpec } from "../spec.js";
3
- import { SpecRegistry } from "../registry.js";
2
+ import { OperationSpec } from "../operation.js";
3
+ import { OperationSpecRegistry } from "../registry.js";
4
4
  import "../index.js";
5
5
  import * as _lssm_lib_schema317 from "@lssm/lib.schema";
6
6
  import { SchemaModel } from "@lssm/lib.schema";
7
7
 
8
8
  //#region src/app-config/lifecycle-contracts.d.ts
9
- declare const CreateTenantConfigDraftCommand: ContractSpec<SchemaModel<{
9
+ declare const CreateTenantConfigDraftCommand: OperationSpec<SchemaModel<{
10
10
  tenantId: {
11
11
  type: _lssm_lib_schema317.FieldType<string, string>;
12
12
  isOptional: false;
@@ -81,7 +81,7 @@ declare const CreateTenantConfigDraftCommand: ContractSpec<SchemaModel<{
81
81
  }>>;
82
82
  when: string;
83
83
  }[]>;
84
- declare const PromoteTenantConfigToPreviewCommand: ContractSpec<SchemaModel<{
84
+ declare const PromoteTenantConfigToPreviewCommand: OperationSpec<SchemaModel<{
85
85
  tenantId: {
86
86
  type: _lssm_lib_schema317.FieldType<string, string>;
87
87
  isOptional: false;
@@ -138,7 +138,7 @@ declare const PromoteTenantConfigToPreviewCommand: ContractSpec<SchemaModel<{
138
138
  }>>;
139
139
  when: string;
140
140
  }[]>;
141
- declare const PublishTenantConfigCommand: ContractSpec<SchemaModel<{
141
+ declare const PublishTenantConfigCommand: OperationSpec<SchemaModel<{
142
142
  tenantId: {
143
143
  type: _lssm_lib_schema317.FieldType<string, string>;
144
144
  isOptional: false;
@@ -214,7 +214,7 @@ declare const PublishTenantConfigCommand: ContractSpec<SchemaModel<{
214
214
  }>>;
215
215
  when: string;
216
216
  }[]>;
217
- declare const RollbackTenantConfigCommand: ContractSpec<SchemaModel<{
217
+ declare const RollbackTenantConfigCommand: OperationSpec<SchemaModel<{
218
218
  tenantId: {
219
219
  type: _lssm_lib_schema317.FieldType<string, string>;
220
220
  isOptional: false;
@@ -285,7 +285,7 @@ declare const RollbackTenantConfigCommand: ContractSpec<SchemaModel<{
285
285
  }>>;
286
286
  when: string;
287
287
  }[]>;
288
- declare const ListTenantConfigVersionsQuery: ContractSpec<SchemaModel<{
288
+ declare const ListTenantConfigVersionsQuery: OperationSpec<SchemaModel<{
289
289
  tenantId: {
290
290
  type: _lssm_lib_schema317.FieldType<string, string>;
291
291
  isOptional: false;
@@ -348,7 +348,7 @@ declare const ListTenantConfigVersionsQuery: ContractSpec<SchemaModel<{
348
348
  isArray: true;
349
349
  };
350
350
  }>, undefined>;
351
- declare const GetTenantConfigVersionQuery: ContractSpec<SchemaModel<{
351
+ declare const GetTenantConfigVersionQuery: OperationSpec<SchemaModel<{
352
352
  tenantId: {
353
353
  type: _lssm_lib_schema317.FieldType<string, string>;
354
354
  isOptional: false;
@@ -376,7 +376,7 @@ declare const GetTenantConfigVersionQuery: ContractSpec<SchemaModel<{
376
376
  isOptional: false;
377
377
  };
378
378
  }>, undefined>;
379
- declare const lifecycleContracts: Record<string, ContractSpec<any, any>>;
380
- declare function registerAppConfigLifecycleContracts(registry: SpecRegistry): SpecRegistry;
379
+ declare const lifecycleContracts: Record<string, OperationSpec<any, any>>;
380
+ declare function registerAppConfigLifecycleContracts(registry: OperationSpecRegistry): OperationSpecRegistry;
381
381
  //#endregion
382
382
  export { CreateTenantConfigDraftCommand, GetTenantConfigVersionQuery, ListTenantConfigVersionsQuery, PromoteTenantConfigToPreviewCommand, PublishTenantConfigCommand, RollbackTenantConfigCommand, lifecycleContracts, registerAppConfigLifecycleContracts };
@@ -1,5 +1,5 @@
1
1
  import { E5, x8 } from "../schema/dist/index.js";
2
- import { defineCommand, defineQuery } from "../spec.js";
2
+ import { defineCommand, defineQuery } from "../operation.js";
3
3
  import { OwnersEnum, StabilityEnum, TagsEnum } from "../ownership.js";
4
4
  import { ConfigDraftCreatedEvent, ConfigPromotedToPreviewEvent, ConfigPublishedEvent, ConfigRolledBackEvent } from "./events.js";
5
5
 
@@ -4,7 +4,7 @@ import { registerDocBlocks } from "../../registry.js";
4
4
  const tech_contracts_README_DocBlocks = [{
5
5
  id: "docs.tech.contracts.README",
6
6
  title: "Contracts: Specs, Registry, Handlers, Adapters",
7
- summary: "- `packages/lssm/libs/contracts` defines the contracts core (SpecRegistry, ContractSpec, install helpers, REST/MCP adapters).",
7
+ summary: "- `packages/lssm/libs/contracts` defines the contracts core (OperationSpecRegistry, OperationSpec, PresentationSpec, install helpers, REST/MCP adapters, ...).",
8
8
  kind: "reference",
9
9
  visibility: "public",
10
10
  route: "/docs/tech/contracts/README",
@@ -13,7 +13,7 @@ const tech_contracts_README_DocBlocks = [{
13
13
  "contracts",
14
14
  "README"
15
15
  ],
16
- body: "## Contracts: Specs, Registry, Handlers, Adapters\n\n### What lives where\n\n- `packages/lssm/libs/contracts` defines the contracts core (SpecRegistry, ContractSpec, install helpers, REST/MCP adapters).\n- `packages/lssm/libs/schema` defines the schema dictionary (`SchemaModel`, `FieldType`) used to describe I/O once and map to multiple targets (zod, GraphQL, JSON Schema).\n- App adapters (e.g. GraphQL) live close to the app. Example: `packages/hcircle/apps/api-coliving/src/graphql/contracts-adapter.ts`.\n\n### npm distribution\n\n- `@lssm/lib.contracts` (root) keeps the legacy \\\"everything\\\" surface for backward compatibility.\n- `@lssm/lib.contracts/client` exposes only browser-safe helpers (React renderers, client SDK, drivers). Import from this entry when bundling for the web or React Native to avoid dragging server adapters.\n- `@lssm/lib.contracts/server` covers HTTP/MCP adapters, registries, integrations, and other Node-only helpers.\n- `@lssm/lib.contracts/types` exports the runtime handler context utilities, while `@lssm/lib.contracts/types/all` re-exports every type alias/interface across the package via `export type` so consumers can import a single module for typings without shipping runtime code.\n- `@lssm/lib.schema`, `@lssm/lib.design-system`, `@lssm/lib.ui-kit`, `@lssm/lib.ui-kit-web`, `@lssm/lib.accessibility`, and the presentation runtime packages are published to npm alongside contracts; prefer the scoped packages to keep tree-shaking intact.\n- Bundlers with conditional exports should resolve subpaths first; keep root imports for server-only code paths.\n\n### Core concepts\n\n- **ContractSpec**: immutable description of an operation.\n - `meta`: `{ name, version, kind: 'query' | 'command' }`\n - `io`: `{ input: SchemaModel | zod schema, output: SchemaModel | zod schema }`\n - `policy`: `{ auth?: {...}, rateLimit?: {...}, flags?: string[] }`\n - `transport.gql.field?`: explicit GraphQL field name (otherwise derived via `defaultGqlField`).\n- **SpecRegistry**: registry of specs + handlers. Use `installOp(reg, spec, handler)` to attach a handler.\n- **Handler**: `(ctx, input) => Promise<output>` implementing the operation.\n- **CapabilitySpec**: canonical capability declaration stored in `src/capabilities.ts`. Tracks `meta` (`{ key, version, kind, title, description, domain, owners, tags, stability }`), `provides` surfaces (`operation`, `event`, `workflow`, `presentation`, `resource`), and `requires` which other capabilities must be present. Enforced during `installFeature`.\n- **PolicySpec**: declarative policy rules (`src/policy/spec.ts`) covering ABAC/ReBAC, consent + rate limit requirements, field-level controls, and PII guidance. `PolicyEngine` evaluates refs, while `OPAPolicyAdapter` lets OPA override/augment runtime decisions.\n- **TelemetrySpec**: analytics definitions (`src/telemetry/spec.ts`) describing event semantics, privacy level, retention, sampling, and anomaly detection. `TelemetryTracker` handles redaction/sampling, `TelemetryAnomalyMonitor` raises alerts, and specs integrate with contracts/workflows via `ctx.telemetry`.\n- **TestSpec**: declarative scenario definitions in `src/tests/spec.ts`. `TestRunner` executes fixtures/actions/assertions against a `SpecRegistry`, and the CLI (`contractspec test`) wraps the runner for automation.\n- **ExperimentSpec**: experiment definitions (`src/experiments/spec.ts`) describing variants, allocation strategies, and success metrics. `ExperimentEvaluator` assigns variants (random/sticky/targeted) and integrates with Policy/Telemetry for safe experimentation.\n- **AppBlueprintSpec / TenantAppConfig**: global blueprints and per-tenant overrides (`src/app-config/spec.ts`). `resolveAppConfig()` merges the two into a `ResolvedAppConfig`, while `composeAppConfig()` hydrates the merged view against registries and reports missing references for safe rollout.\n- **RegeneratorService**: background daemon (`src/regenerator/service.ts`) that consumes telemetry/error/behavior signals, evaluates regeneration rules, and produces `SpecChangeProposal`s for Studio review.\n- **DataViewSpec**: declarative data presentation layer in `src/data-views.ts`. Describes entity projections (`fields`, `filters`, `actions`) with `view.kind` (`list`, `table`, `detail`, `grid`), ties to query operations via `source.primary`, and exposes optional presentation-based empty/error states.\n- **ThemeSpec**: design token + component variant definitions in `src/themes.ts`. Supports inheritance (`extends`), tenant/user overrides, and component-specific variant metadata for the design system.\n- **MigrationSpec**: schema/data migration descriptors (`src/migrations.ts`) with ordered step plans, dependency tracking, and pre/post checks to support automated database/content migrations.\n- **WorkflowSpec**: typed definition of multi-step workflows living in `src/workflow/spec.ts`. `WorkflowRegistry` stores versioned specs, and `validateWorkflowSpec()` (in `src/workflow/validation.ts`) checks graph integrity, step references, and reachability.\n\n### Lifecycle\n\n1. Define the spec (I/O via `SchemaModel` or zod) in a vertical lib (e.g. `contracts-coliving`).\n2. Register it: `installOp(registry, spec, handler)` within the app/service.\n3. Expose it via an adapter (REST, GraphQL, MCP). Each adapter maps the I/O to its transport and enforces policy.\n4. Validate at runtime: parse `input` before executing, parse `output` before returning.\n\n### Adapters\n\n- **REST**: see `packages/lssm/libs/contracts/src/server/rest-*`. Binds routes, validates request/response, maps errors/policies.\n- **MCP**: see `packages/lssm/libs/contracts/src/server/provider-mcp.ts` (standalone MCP server) and `packages/lssm/libs/contracts/src/server/rest-next-mcp.ts` (MCP over Next.js route). Provides tools/resources/prompts.\n - Tools + resources are registered from Zod schemas.\n - Resource templates are keyed by full `ResourceMeta.uriTemplate` (e.g. `docs://list`, `docs://doc/{id}`), so multiple templates can share a scheme (`docs://*`) without collisions.\n- **GraphQL (Pothos)**: see `packages/lssm/libs/contracts/src/server/graphql-pothos.ts`. Adds Query/Mutation fields by transforming contract I/O to GraphQL types.\n\n### GraphQL adapter behaviour (summary)\n\n- Field naming: `spec.transport.gql.field` or `<name_with_dots>_v<version>`.\n- Input/Output types from `SchemaModel` (preferred) or fallback zod introspection.\n- Scalars: String/Int/Float/Boolean/Date/JSON; Objects/Arrays/Enums; unions for outputs; input unions => JSON.\n- Policy: auth gate checks GraphQL context; optional feature flag gating.\n- Complexity & tracing: attaches hints and records timings; log includes `{ specName, version }`.\n\n#### Returns mapping and hydration\n\n- `spec.transport.gql.returns` can declare the GraphQL return wrapper: e.g. `\"Spot\"` or `[Spot]`. If omitted, the adapter infers from `io.output` (SchemaModel) or `resourceRef.graphQLType`.\n- Resource outputs: when `io.output` is a `resourceRef(...)` or `transport.gql.resource` is set, the adapter will optionally hydrate via a `ResourceRegistry` using `contracts-adapter-hydration.ts`:\n - Grammar is parsed with `parseReturns()`.\n - Entities are resolved via `hydrateResourceIfNeeded(resources, result, { template, varName, returns })` after handler execution.\n\n### Resource outputs\n\n- Declare resource outputs using `resourceRef(uriTemplate, opts)`.\n- `opts.varName` (default `id`) selects the identifier field returned by the handler for URI substitution.\n- `opts.graphQLType` is the GraphQL return type name (e.g., `Spot`) or list form (e.g., `[Spot]`).\n- `opts.many: true` indicates the handler returns an array of resources. The handler type becomes an array of items that include the identifier field.\n\nExample:\n\n```ts\nio: {\n input: ListThingsInput,\n output: resourceRef('myapp://thing/{id}', { graphQLType: '[Thing]', many: true }),\n}\n```\n\nHandler return (simplified): `{ id: string | number }[]`.\n\n### Errors\n\n- Validation errors → transport 400/GraphQL UserInputError.\n- Policy/auth errors → 401/403 or GraphQL ForbiddenError.\n- Handler errors → mapped to transport error with safe message.\n\n### Versioning & naming\n\n- Keep `meta.version` monotonic. Clients should pin to a versioned field/key.\n- Avoid renaming existing fields; add new fields with new versions.\n\n### Ownership metadata (OwnerShipMeta)\n\nAll contracts, events, features, and presentations reference a shared ownership schema (source of truth in `packages/lssm/libs/contracts/src/ownership.ts`).\n\n- Required fields: `title`, `description`, `domain`, `owners[]`, `tags[]`, `stability`.\n- Curated enums: the library exports suggested constants for owners and tags; free-form strings are still allowed for forward-compatibility.\n- Operations (`spec.ts`): `meta` requires `stability`, `owners`, and `tags` alongside `name`, `version`, `kind`, `description`, `goal`, and `context`.\n- Presentations V2: `meta` is a partial of ownership plus `description`.\n- Events: may specify `ownership` (recommended) for discoverability and docs.\n\n### Quick start\n\n```ts\n// app bootstrap\nconst reg = new SpecRegistry();\ninstallOp(reg, BeginSignupSpec, beginSignupHandler);\nregisterContractsOnBuilder(gqlSchemaBuilder, reg); // GraphQL\n// or: createRestRouter(reg) // REST\n```\n"
16
+ body: "## Contracts: Specs, Registry, Handlers, Adapters\n\n### What lives where\n\n- `packages/lssm/libs/contracts` defines the contracts core (OperationSpecRegistry, OperationSpec, PresentationSpec, install helpers, REST/MCP adapters).\n- `packages/lssm/libs/schema` defines the schema dictionary (`SchemaModel`, `FieldType`) used to describe I/O once and map to multiple targets (zod, GraphQL, JSON Schema).\n- App adapters (e.g. GraphQL) live close to the app. Example: `packages/hcircle/apps/api-coliving/src/graphql/contracts-adapter.ts`.\n\n### npm distribution\n\n- `@lssm/lib.contracts` (root) keeps the legacy \\\"everything\\\" surface for backward compatibility.\n- `@lssm/lib.contracts/client` exposes only browser-safe helpers (React renderers, client SDK, drivers). Import from this entry when bundling for the web or React Native to avoid dragging server adapters.\n- `@lssm/lib.contracts/server` covers HTTP/MCP adapters, registries, integrations, and other Node-only helpers.\n- `@lssm/lib.contracts/types` exports the runtime handler context utilities, while `@lssm/lib.contracts/types/all` re-exports every type alias/interface across the package via `export type` so consumers can import a single module for typings without shipping runtime code.\n- `@lssm/lib.schema`, `@lssm/lib.design-system`, `@lssm/lib.ui-kit`, `@lssm/lib.ui-kit-web`, `@lssm/lib.accessibility`, and the presentation runtime packages are published to npm alongside contracts; prefer the scoped packages to keep tree-shaking intact.\n- Bundlers with conditional exports should resolve subpaths first; keep root imports for server-only code paths.\n\n### Core concepts\n\n- **OperationSpec**: immutable description of an operation.\n - `meta`: `{ name, version, kind: 'query' | 'command' }`\n - `io`: `{ input: SchemaModel | zod schema, output: SchemaModel | zod schema }`\n - `policy`: `{ auth?: {...}, rateLimit?: {...}, flags?: string[] }`\n - `transport.gql.field?`: explicit GraphQL field name (otherwise derived via `defaultGqlField`).\n- **OperationSpecRegistry**: registry of specs + handlers. Use `installOp(reg, spec, handler)` to attach a handler.\n- **Handler**: `(ctx, input) => Promise<output>` implementing the operation.\n- **CapabilitySpec**: canonical capability declaration stored in `src/capabilities.ts`. Tracks `meta` (`{ key, version, kind, title, description, domain, owners, tags, stability }`), `provides` surfaces (`operation`, `event`, `workflow`, `presentation`, `resource`), and `requires` which other capabilities must be present. Enforced during `installFeature`.\n- **PolicySpec**: declarative policy rules (`src/policy/spec.ts`) covering ABAC/ReBAC, consent + rate limit requirements, field-level controls, and PII guidance. `PolicyEngine` evaluates refs, while `OPAPolicyAdapter` lets OPA override/augment runtime decisions.\n- **TelemetrySpec**: analytics definitions (`src/telemetry/spec.ts`) describing event semantics, privacy level, retention, sampling, and anomaly detection. `TelemetryTracker` handles redaction/sampling, `TelemetryAnomalyMonitor` raises alerts, and specs integrate with contracts/workflows via `ctx.telemetry`.\n- **TestSpec**: declarative scenario definitions in `src/tests/spec.ts`. `TestRunner` executes fixtures/actions/assertions against a `OperationSpecRegistry`, and the CLI (`contractspec test`) wraps the runner for automation.\n- **ExperimentSpec**: experiment definitions (`src/experiments/spec.ts`) describing variants, allocation strategies, and success metrics. `ExperimentEvaluator` assigns variants (random/sticky/targeted) and integrates with Policy/Telemetry for safe experimentation.\n- **AppBlueprintSpec / TenantAppConfig**: global blueprints and per-tenant overrides (`src/app-config/spec.ts`). `resolveAppConfig()` merges the two into a `ResolvedAppConfig`, while `composeAppConfig()` hydrates the merged view against registries and reports missing references for safe rollout.\n- **RegeneratorService**: background daemon (`src/regenerator/service.ts`) that consumes telemetry/error/behavior signals, evaluates regeneration rules, and produces `SpecChangeProposal`s for Studio review.\n- **DataViewSpec**: declarative data presentation layer in `src/data-views.ts`. Describes entity projections (`fields`, `filters`, `actions`) with `view.kind` (`list`, `table`, `detail`, `grid`), ties to query operations via `source.primary`, and exposes optional presentation-based empty/error states.\n- **ThemeSpec**: design token + component variant definitions in `src/themes.ts`. Supports inheritance (`extends`), tenant/user overrides, and component-specific variant metadata for the design system.\n- **MigrationSpec**: schema/data migration descriptors (`src/migrations.ts`) with ordered step plans, dependency tracking, and pre/post checks to support automated database/content migrations.\n- **WorkflowSpec**: typed definition of multi-step workflows living in `src/workflow/spec.ts`. `WorkflowRegistry` stores versioned specs, and `validateWorkflowSpec()` (in `src/workflow/validation.ts`) checks graph integrity, step references, and reachability.\n\n### Lifecycle\n\n1. Define the spec (I/O via `SchemaModel` or zod) in a vertical lib (e.g. `contracts-coliving`).\n2. Register it: `installOp(registry, spec, handler)` within the app/service.\n3. Expose it via an adapter (REST, GraphQL, MCP). Each adapter maps the I/O to its transport and enforces policy.\n4. Validate at runtime: parse `input` before executing, parse `output` before returning.\n\n### Adapters\n\n- **REST**: see `packages/lssm/libs/contracts/src/server/rest-*`. Binds routes, validates request/response, maps errors/policies.\n- **MCP**: see `packages/lssm/libs/contracts/src/server/provider-mcp.ts` (standalone MCP server) and `packages/lssm/libs/contracts/src/server/rest-next-mcp.ts` (MCP over Next.js route). Provides tools/resources/prompts.\n - Tools + resources are registered from Zod schemas.\n - Resource templates are keyed by full `ResourceMeta.uriTemplate` (e.g. `docs://list`, `docs://doc/{id}`), so multiple templates can share a scheme (`docs://*`) without collisions.\n- **GraphQL (Pothos)**: see `packages/lssm/libs/contracts/src/server/graphql-pothos.ts`. Adds Query/Mutation fields by transforming contract I/O to GraphQL types.\n\n### GraphQL adapter behaviour (summary)\n\n- Field naming: `spec.transport.gql.field` or `<name_with_dots>_v<version>`.\n- Input/Output types from `SchemaModel` (preferred) or fallback zod introspection.\n- Scalars: String/Int/Float/Boolean/Date/JSON; Objects/Arrays/Enums; unions for outputs; input unions => JSON.\n- Policy: auth gate checks GraphQL context; optional feature flag gating.\n- Complexity & tracing: attaches hints and records timings; log includes `{ specName, version }`.\n\n#### Returns mapping and hydration\n\n- `spec.transport.gql.returns` can declare the GraphQL return wrapper: e.g. `\"Spot\"` or `[Spot]`. If omitted, the adapter infers from `io.output` (SchemaModel) or `resourceRef.graphQLType`.\n- Resource outputs: when `io.output` is a `resourceRef(...)` or `transport.gql.resource` is set, the adapter will optionally hydrate via a `ResourceRegistry` using `contracts-adapter-hydration.ts`:\n - Grammar is parsed with `parseReturns()`.\n - Entities are resolved via `hydrateResourceIfNeeded(resources, result, { template, varName, returns })` after handler execution.\n\n### Resource outputs\n\n- Declare resource outputs using `resourceRef(uriTemplate, opts)`.\n- `opts.varName` (default `id`) selects the identifier field returned by the handler for URI substitution.\n- `opts.graphQLType` is the GraphQL return type name (e.g., `Spot`) or list form (e.g., `[Spot]`).\n- `opts.many: true` indicates the handler returns an array of resources. The handler type becomes an array of items that include the identifier field.\n\nExample:\n\n```ts\nio: {\n input: ListThingsInput,\n output: resourceRef('myapp://thing/{id}', { graphQLType: '[Thing]', many: true }),\n}\n```\n\nHandler return (simplified): `{ id: string | number }[]`.\n\n### Errors\n\n- Validation errors → transport 400/GraphQL UserInputError.\n- Policy/auth errors → 401/403 or GraphQL ForbiddenError.\n- Handler errors → mapped to transport error with safe message.\n\n### Versioning & naming\n\n- Keep `meta.version` monotonic. Clients should pin to a versioned field/key.\n- Avoid renaming existing fields; add new fields with new versions.\n\n### Ownership metadata (OwnerShipMeta)\n\nAll contracts, events, features, and presentations reference a shared ownership schema (source of truth in `packages/lssm/libs/contracts/src/ownership.ts`).\n\n- Required fields: `title`, `description`, `domain`, `owners[]`, `tags[]`, `stability`.\n- Curated enums: the library exports suggested constants for owners and tags; free-form strings are still allowed for forward-compatibility.\n- Operations (`spec.ts`): `meta` requires `stability`, `owners`, and `tags` alongside `name`, `version`, `kind`, `description`, `goal`, and `context`.\n- Presentations V2: `meta` is a partial of ownership plus `description`.\n- Events: may specify `ownership` (recommended) for discoverability and docs.\n\n### Quick start\n\n```ts\n// app bootstrap\nconst reg = new OperationSpecRegistry();\ninstallOp(reg, BeginSignupSpec, beginSignupHandler);\nregisterContractsOnBuilder(gqlSchemaBuilder, reg); // GraphQL\n// or: createRestRouter(reg) // REST\n```\n"
17
17
  }];
18
18
  registerDocBlocks(tech_contracts_README_DocBlocks);
19
19