@ouispec/contract 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/INTEGRATOR-GUIDE.md +729 -0
  2. package/LICENSE +21 -0
  3. package/README.md +10 -0
  4. package/dist/codegen.d.ts +71 -0
  5. package/dist/codegen.d.ts.map +1 -0
  6. package/dist/codegen.js +195 -0
  7. package/dist/codegen.js.map +1 -0
  8. package/dist/generated/contract.d.ts +1286 -0
  9. package/dist/generated/contract.d.ts.map +1 -0
  10. package/dist/generated/contract.js +14 -0
  11. package/dist/generated/contract.js.map +1 -0
  12. package/dist/generated/schemas.d.ts +111 -0
  13. package/dist/generated/schemas.d.ts.map +1 -0
  14. package/dist/generated/schemas.js +3256 -0
  15. package/dist/generated/schemas.js.map +1 -0
  16. package/dist/index.d.ts +29 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +28 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/render-contract.d.ts +47 -0
  21. package/dist/render-contract.d.ts.map +1 -0
  22. package/dist/render-contract.js +123 -0
  23. package/dist/render-contract.js.map +1 -0
  24. package/dist/render-guide.d.ts +4 -0
  25. package/dist/render-guide.d.ts.map +1 -0
  26. package/dist/render-guide.js +132 -0
  27. package/dist/render-guide.js.map +1 -0
  28. package/dist/schema-document.d.ts +7 -0
  29. package/dist/schema-document.d.ts.map +1 -0
  30. package/dist/schema-document.js +2 -0
  31. package/dist/schema-document.js.map +1 -0
  32. package/dist/validate.d.ts +22 -0
  33. package/dist/validate.d.ts.map +1 -0
  34. package/dist/validate.js +89 -0
  35. package/dist/validate.js.map +1 -0
  36. package/package.json +65 -0
  37. package/schemas/action-effect.json +113 -0
  38. package/schemas/agent-binding.json +58 -0
  39. package/schemas/approvals.json +249 -0
  40. package/schemas/control-kind-registration.json +187 -0
  41. package/schemas/control-table.json +276 -0
  42. package/schemas/event-declarations.json +316 -0
  43. package/schemas/generated-knowledge.json +58 -0
  44. package/schemas/json-schema.json +153 -0
  45. package/schemas/oui-config.json +178 -0
  46. package/schemas/oui-manifest.json +346 -0
  47. package/schemas/room-catalog-data.json +455 -0
  48. package/schemas/tier2-mapping.json +195 -0
@@ -0,0 +1,178 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.closurestudio.ai/oui/v1/oui-config.json",
4
+ "title": "OuiConfigFile",
5
+ "description": "`oui.config.json` at the app's root (ADR-0226 §2.4): where the app keeps its routes, navigation and output, which design systems and mappings its controls come from, where its API is described, and which of its pages are not yet bound. Paths are relative to the file. It is required and explicit: nothing an app depends on has a default, so a misconfigured app fails here, naming the setting, instead of generating an assistant that can do nothing. A setting the generator does not know is an error.",
6
+ "type": "object",
7
+ "properties": {
8
+ "$schema": {
9
+ "description": "This schema's URL, for editors.",
10
+ "type": "string"
11
+ },
12
+ "$comment": {
13
+ "type": "string"
14
+ },
15
+ "tsconfig": {
16
+ "description": "The tsconfig the app's source compiles with.",
17
+ "type": "string",
18
+ "minLength": 1,
19
+ "pattern": "\\S"
20
+ },
21
+ "routes": {
22
+ "description": "The file whose routes decide where the app can go: `<Route>` elements (nested paths are joined to their parent, `index` routes kept, `React.lazy` followed) or a data router (`createBrowserRouter([...])`).",
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "pattern": "\\S"
26
+ },
27
+ "routeWrappers": {
28
+ "description": "Components a route's element is wrapped in that are never the page (`Suspense`, `ErrorBoundary`). Default none.",
29
+ "type": "array",
30
+ "items": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "pattern": "\\S"
34
+ }
35
+ },
36
+ "nav": {
37
+ "description": "Files holding the navigation entries (`{ label, route, group }` object literals). Default none.",
38
+ "type": "array",
39
+ "items": {
40
+ "type": "string",
41
+ "minLength": 1,
42
+ "pattern": "\\S"
43
+ }
44
+ },
45
+ "out": {
46
+ "description": "Where generated output goes.",
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "pattern": "\\S"
50
+ },
51
+ "designSystem": {
52
+ "description": "Design-system packages whose controls carry bindings (tier 1). Each must resolve from the app and name its control table in its `package.json` (`oui.agentControls`). `[]`: every control is tier 2 or in a room.",
53
+ "type": "array",
54
+ "items": {
55
+ "type": "string",
56
+ "minLength": 1,
57
+ "pattern": "\\S"
58
+ }
59
+ },
60
+ "mappings": {
61
+ "description": "Tier 2 mappings (`tier2-mapping.json`), one per third-party design system the app does not own, by path. `oui generate` emits a bound module per mapping into `<out>/bound/` (named after the package: `@mantine/core` → `mantine-core.ts`, with its control table beside it), and reads every use of a bound control as it reads a tier 1 control. On an enforced page, importing a mapped control straight from its package is an error naming the bound import. A package is in `designSystem` or mapped, never both. Default none.",
62
+ "type": "array",
63
+ "items": {
64
+ "type": "string",
65
+ "minLength": 1,
66
+ "pattern": "\\S"
67
+ }
68
+ },
69
+ "apiSpec": {
70
+ "description": "The API's OpenAPI 3 document, by module path, as the installed API client ships it (`@traidr/api-client/openapi.json`) — never a sibling checkout path, so the generator reads exactly the spec of the client version the app installs; or a path inside the app. Every `mutate` effect names one of its `operationId`s. `null`: the app declares no API, and a `mutate` effect is an error.",
71
+ "anyOf": [
72
+ {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "pattern": "\\S"
76
+ },
77
+ {
78
+ "type": "null"
79
+ }
80
+ ]
81
+ },
82
+ "unbound": {
83
+ "description": "Page components whose interactive controls are not all bound yet. It may only get shorter: the generator fails for a listed page that is fully bound, so the list cannot rot. Every other page is enforced. Default none.",
84
+ "type": "array",
85
+ "items": {
86
+ "type": "string",
87
+ "minLength": 1,
88
+ "pattern": "\\S"
89
+ }
90
+ },
91
+ "appCatalogs": {
92
+ "description": "Room catalogs the app itself declares (tier 3, a page's own editor), each loaded through the app's own Vite config so its modules resolve as the app build resolves them: the app needs `vite` among its own dependencies. Only their declarations are read. Default none.",
93
+ "type": "array",
94
+ "items": {
95
+ "$ref": "#/$defs/AppCatalogEntry"
96
+ }
97
+ },
98
+ "shell": {
99
+ "description": "The app's frame: components mounted around the pages rather than by a route (a sidebar, a top bar, a phone tab bar, a toast host). Each becomes a `shell:` surface offered on the routes it frames, and its controls are enforced as a page's are, unless listed in `unbound`. Default none.",
100
+ "type": "array",
101
+ "items": {
102
+ "$ref": "#/$defs/ShellEntry"
103
+ }
104
+ }
105
+ },
106
+ "required": [
107
+ "tsconfig",
108
+ "routes",
109
+ "designSystem",
110
+ "apiSpec",
111
+ "out"
112
+ ],
113
+ "additionalProperties": false,
114
+ "$defs": {
115
+ "ShellEntry": {
116
+ "description": "One part of the app's frame.",
117
+ "type": "object",
118
+ "properties": {
119
+ "module": {
120
+ "description": "The module, relative to the app root.",
121
+ "type": "string",
122
+ "minLength": 1,
123
+ "pattern": "\\S"
124
+ },
125
+ "export": {
126
+ "description": "The export that is the frame's component.",
127
+ "type": "string",
128
+ "minLength": 1,
129
+ "pattern": "\\S"
130
+ },
131
+ "routes": {
132
+ "description": "The route patterns it frames. Default every route (`*`).",
133
+ "type": "array",
134
+ "items": {
135
+ "type": "string"
136
+ }
137
+ }
138
+ },
139
+ "required": [
140
+ "module",
141
+ "export"
142
+ ],
143
+ "additionalProperties": false
144
+ },
145
+ "AppCatalogEntry": {
146
+ "description": "A room catalog the app declares.",
147
+ "type": "object",
148
+ "properties": {
149
+ "module": {
150
+ "description": "The module, relative to the app root.",
151
+ "type": "string",
152
+ "minLength": 1,
153
+ "pattern": "\\S"
154
+ },
155
+ "export": {
156
+ "description": "The export that is the catalog.",
157
+ "type": "string",
158
+ "minLength": 1,
159
+ "pattern": "\\S"
160
+ },
161
+ "hosts": {
162
+ "description": "App components whose use puts the room on a page.",
163
+ "type": "array",
164
+ "items": {
165
+ "type": "string",
166
+ "minLength": 1
167
+ }
168
+ }
169
+ },
170
+ "required": [
171
+ "module",
172
+ "export",
173
+ "hosts"
174
+ ],
175
+ "additionalProperties": false
176
+ }
177
+ }
178
+ }
@@ -0,0 +1,346 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schemas.closurestudio.ai/oui/v1/oui-manifest.json",
4
+ "title": "OuiManifest",
5
+ "description": "What the generator emits for each build (`oui-manifest.json`, ADR-0220 §2.4–2.5): every surface, action and observation the build's UI offers. The runtime (`connectBindings`) offers the intersection of the manifest and the handlers mounted right now, so an action the build declares is a tool only while its control, or its room, is on screen. CI regenerates it and diffs it (`oui generate --check`).",
6
+ "type": "object",
7
+ "properties": {
8
+ "version": {
9
+ "description": "The contract major (`MANIFEST_VERSION`). A breaking change to any of these schemas bumps it.",
10
+ "const": 1
11
+ },
12
+ "buildId": {
13
+ "description": "A hash of everything else in the manifest and the knowledge: the build's identity to the assistant.",
14
+ "type": "string",
15
+ "minLength": 1
16
+ },
17
+ "surfaces": {
18
+ "type": "array",
19
+ "items": {
20
+ "$ref": "#/$defs/ManifestSurface"
21
+ }
22
+ }
23
+ },
24
+ "required": [
25
+ "version",
26
+ "buildId",
27
+ "surfaces"
28
+ ],
29
+ "additionalProperties": false,
30
+ "$defs": {
31
+ "ReachStep": {
32
+ "description": "One step of the way a person reaches a capability.",
33
+ "oneOf": [
34
+ {
35
+ "description": "Go to the page. `nav` is where the sidebar lists it.",
36
+ "type": "object",
37
+ "properties": {
38
+ "kind": {
39
+ "const": "route"
40
+ },
41
+ "path": {
42
+ "type": "string"
43
+ },
44
+ "title": {
45
+ "type": "string"
46
+ },
47
+ "nav": {
48
+ "type": "string"
49
+ }
50
+ },
51
+ "required": [
52
+ "kind",
53
+ "path",
54
+ "title"
55
+ ],
56
+ "additionalProperties": false
57
+ },
58
+ {
59
+ "description": "Select a tab: the tab set's binding (its tool) and the tab's value.",
60
+ "type": "object",
61
+ "properties": {
62
+ "kind": {
63
+ "const": "tab"
64
+ },
65
+ "binding": {
66
+ "type": "string"
67
+ },
68
+ "value": {
69
+ "anyOf": [
70
+ {
71
+ "type": "string"
72
+ },
73
+ {
74
+ "type": "number"
75
+ }
76
+ ]
77
+ },
78
+ "title": {
79
+ "type": "string"
80
+ }
81
+ },
82
+ "required": [
83
+ "kind",
84
+ "binding",
85
+ "value",
86
+ "title"
87
+ ],
88
+ "additionalProperties": false
89
+ },
90
+ {
91
+ "description": "Open a dialog, drawer or popover, with one of the controls that open it.",
92
+ "type": "object",
93
+ "properties": {
94
+ "kind": {
95
+ "const": "dialog"
96
+ },
97
+ "binding": {
98
+ "type": "string"
99
+ },
100
+ "title": {
101
+ "type": "string"
102
+ },
103
+ "openedBy": {
104
+ "type": "array",
105
+ "items": {
106
+ "type": "string"
107
+ }
108
+ }
109
+ },
110
+ "required": [
111
+ "kind",
112
+ "title",
113
+ "openedBy"
114
+ ],
115
+ "additionalProperties": false
116
+ },
117
+ {
118
+ "description": "Show a part of the page that appears once a control sets its state (a detail panel opened by choosing a row).",
119
+ "type": "object",
120
+ "properties": {
121
+ "kind": {
122
+ "const": "panel"
123
+ },
124
+ "title": {
125
+ "type": "string"
126
+ },
127
+ "openedBy": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "string"
131
+ }
132
+ }
133
+ },
134
+ "required": [
135
+ "kind",
136
+ "title",
137
+ "openedBy"
138
+ ],
139
+ "additionalProperties": false
140
+ },
141
+ {
142
+ "description": "Open a menu or toolbar the control is an entry of.",
143
+ "type": "object",
144
+ "properties": {
145
+ "kind": {
146
+ "const": "menu"
147
+ },
148
+ "title": {
149
+ "type": "string"
150
+ }
151
+ },
152
+ "required": [
153
+ "kind",
154
+ "title"
155
+ ],
156
+ "additionalProperties": false
157
+ },
158
+ {
159
+ "description": "A room's own place for it: its tool, panel, section, key or gesture, as the room says.",
160
+ "type": "object",
161
+ "properties": {
162
+ "kind": {
163
+ "const": "room"
164
+ },
165
+ "room": {
166
+ "type": "string"
167
+ },
168
+ "where": {
169
+ "type": "string"
170
+ },
171
+ "selection": {
172
+ "type": "array",
173
+ "items": {
174
+ "type": "string"
175
+ }
176
+ }
177
+ },
178
+ "required": [
179
+ "kind",
180
+ "room",
181
+ "where"
182
+ ],
183
+ "additionalProperties": false
184
+ }
185
+ ]
186
+ },
187
+ "ManifestActionSource": {
188
+ "description": "Where an action comes from: a bound control, a room's catalog entry, or the generated navigation.",
189
+ "enum": [
190
+ "control",
191
+ "room-action",
192
+ "navigation"
193
+ ]
194
+ },
195
+ "ManifestAction": {
196
+ "description": "One action a surface offers: one tool.",
197
+ "type": "object",
198
+ "properties": {
199
+ "name": {
200
+ "description": "The tool name: unique across the build.",
201
+ "type": "string",
202
+ "pattern": "^[a-z0-9_]{1,64}$"
203
+ },
204
+ "id": {
205
+ "description": "The binding id, or `<room>/<kind>/<entry>` for a room's.",
206
+ "type": "string",
207
+ "minLength": 1
208
+ },
209
+ "source": {
210
+ "$ref": "#/$defs/ManifestActionSource"
211
+ },
212
+ "control": {
213
+ "description": "The control kind, for a control: a built-in one, or one its design system registers.",
214
+ "$ref": "control-kind-registration.json#/$defs/AnyControlKind"
215
+ },
216
+ "title": {
217
+ "type": "string"
218
+ },
219
+ "description": {
220
+ "type": "string"
221
+ },
222
+ "input": {
223
+ "description": "The tool's input: one object schema, never a union at its top level.",
224
+ "$ref": "json-schema.json"
225
+ },
226
+ "effect": {
227
+ "description": "What running it does. A `job` or `transaction` settles on its outcome (`JobSettlement`); a `transaction`, or a destructive `write`, runs only on the person's approval of the exact call.",
228
+ "$ref": "action-effect.json"
229
+ },
230
+ "destructive": {
231
+ "type": "boolean"
232
+ },
233
+ "confirm": {
234
+ "description": "It changes what the person is working in (account, project, role): the assistant asks first.",
235
+ "type": "boolean"
236
+ },
237
+ "itemized": {
238
+ "description": "One of a list's rows: the action takes the row as `item`.",
239
+ "type": "boolean"
240
+ },
241
+ "reach": {
242
+ "description": "How a person gets to it, from the page.",
243
+ "type": "array",
244
+ "items": {
245
+ "$ref": "#/$defs/ReachStep"
246
+ }
247
+ },
248
+ "declaredIn": {
249
+ "description": "The source file that declares it, relative to the app.",
250
+ "type": "string"
251
+ }
252
+ },
253
+ "required": [
254
+ "name",
255
+ "id",
256
+ "source",
257
+ "title",
258
+ "description",
259
+ "input",
260
+ "reach"
261
+ ],
262
+ "additionalProperties": false
263
+ },
264
+ "ManifestObservation": {
265
+ "description": "One observation a surface reports: its id, what it means, and its value's schema.",
266
+ "type": "object",
267
+ "properties": {
268
+ "id": {
269
+ "type": "string",
270
+ "minLength": 1
271
+ },
272
+ "description": {
273
+ "type": "string"
274
+ },
275
+ "schema": {
276
+ "$ref": "json-schema.json"
277
+ }
278
+ },
279
+ "required": [
280
+ "id",
281
+ "description",
282
+ "schema"
283
+ ],
284
+ "additionalProperties": false
285
+ },
286
+ "ManifestSurfaceKind": {
287
+ "description": "A page, a room on a page, a component shared by pages, the app's frame around the pages (`shell`, from `oui.config.json`'s `shell` entries), or the app's pages themselves: going to one by address (`navigation`).",
288
+ "enum": [
289
+ "page",
290
+ "room",
291
+ "shared",
292
+ "shell",
293
+ "navigation"
294
+ ]
295
+ },
296
+ "ManifestSurface": {
297
+ "description": "One surface: what it offers, where it can be mounted, and what it reports.",
298
+ "type": "object",
299
+ "properties": {
300
+ "id": {
301
+ "description": "`page:VoicesPage`, `room:vector-studio`, `shared:MoveToProjectModal`, `shell:StudioShell`, `app:navigation`.",
302
+ "type": "string",
303
+ "pattern": "^(page|room|shared|shell|app):.+$"
304
+ },
305
+ "kind": {
306
+ "$ref": "#/$defs/ManifestSurfaceKind"
307
+ },
308
+ "title": {
309
+ "type": "string"
310
+ },
311
+ "description": {
312
+ "type": "string"
313
+ },
314
+ "routes": {
315
+ "description": "The route patterns where it can be mounted.",
316
+ "type": "array",
317
+ "items": {
318
+ "type": "string"
319
+ }
320
+ },
321
+ "actions": {
322
+ "type": "array",
323
+ "items": {
324
+ "$ref": "#/$defs/ManifestAction"
325
+ }
326
+ },
327
+ "observations": {
328
+ "type": "array",
329
+ "items": {
330
+ "$ref": "#/$defs/ManifestObservation"
331
+ }
332
+ }
333
+ },
334
+ "required": [
335
+ "id",
336
+ "kind",
337
+ "title",
338
+ "description",
339
+ "routes",
340
+ "actions",
341
+ "observations"
342
+ ],
343
+ "additionalProperties": false
344
+ }
345
+ }
346
+ }