@jami-studio/registry-schema 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.
package/LICENSE ADDED
@@ -0,0 +1,182 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the
13
+ copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other
16
+ entities that control, are controlled by, or are under common control with
17
+ that entity. For the purposes of this definition, "control" means (i) the
18
+ power, direct or indirect, to cause the direction or management of such
19
+ entity, whether by contract or otherwise, or (ii) ownership of fifty percent
20
+ or more of the outstanding shares, or (iii) beneficial ownership of such
21
+ entity.
22
+
23
+ "You" or "Your" shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source, and
28
+ configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation or
31
+ translation of a Source form, including but not limited to compiled object
32
+ code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work.
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form,
39
+ that is based on or derived from the Work and for which the editorial
40
+ revisions, annotations, elaborations, or other modifications represent, as a
41
+ whole, an original work of authorship. For the purposes of this License,
42
+ Derivative Works shall not include works that remain separable from, or
43
+ merely link or bind by name to the interfaces of, the Work and Derivative
44
+ Works thereof.
45
+
46
+ "Contribution" shall mean any work of authorship, including the original
47
+ version of the Work and any modifications or additions to that Work or
48
+ Derivative Works thereof, that is intentionally submitted to Licensor for
49
+ inclusion in the Work by the copyright owner or by an individual or Legal
50
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
51
+ of this definition, "submitted" means any form of electronic, verbal, or
52
+ written communication sent to the Licensor or its representatives, including
53
+ but not limited to communication on electronic mailing lists, source code
54
+ control systems, and issue tracking systems that are managed by, or on behalf
55
+ of, the Licensor for the purpose of discussing and improving the Work, but
56
+ excluding communication that is conspicuously marked or otherwise designated
57
+ in writing by the copyright owner as "Not a Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
60
+ behalf of whom a Contribution has been received by Licensor and subsequently
61
+ incorporated within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
64
+ License, each Contributor hereby grants to You a perpetual, worldwide,
65
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
66
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
67
+ sublicense, and distribute the Work and such Derivative Works in Source or
68
+ Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of this
71
+ License, each Contributor hereby grants to You a perpetual, worldwide,
72
+ non-exclusive, no-charge, royalty-free, irrevocable patent license to make,
73
+ have made, use, offer to sell, sell, import, and otherwise transfer the Work,
74
+ where such license applies only to those patent claims licensable by such
75
+ Contributor that are necessarily infringed by their Contribution alone or by
76
+ combination of their Contribution with the Work to which such Contribution was
77
+ submitted. If You institute patent litigation against any entity alleging that
78
+ the Work or a Contribution incorporated within the Work constitutes direct or
79
+ contributory patent infringement, then any patent licenses granted to You
80
+ under this License for that Work shall terminate as of the date such
81
+ litigation is filed.
82
+
83
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
84
+ Derivative Works thereof in any medium, with or without modifications, and in
85
+ Source or Object form, provided that You meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or Derivative Works a copy
88
+ of this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices stating that
91
+ You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works that You
94
+ distribute, all copyright, patent, trademark, and attribution notices from the
95
+ Source form of the Work, excluding those notices that do not pertain to any
96
+ part of the Derivative Works; and
97
+
98
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
99
+ any Derivative Works that You distribute must include a readable copy of the
100
+ attribution notices contained within such NOTICE file, excluding those notices
101
+ that do not pertain to any part of the Derivative Works, in at least one of
102
+ the following places: within a NOTICE text file distributed as part of the
103
+ Derivative Works; within the Source form or documentation, if provided along
104
+ with the Derivative Works; or within a display generated by the Derivative
105
+ Works, if and wherever such third-party notices normally appear. The contents
106
+ of the NOTICE file are for informational purposes only and do not modify the
107
+ License. You may add Your own attribution notices within Derivative Works that
108
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
+ provided that such additional attribution notices cannot be construed as
110
+ modifying the License.
111
+
112
+ You may add Your own copyright statement to Your modifications and may provide
113
+ additional or different license terms and conditions for use, reproduction, or
114
+ distribution of Your modifications, or for any such Derivative Works as a
115
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
116
+ complies with the conditions stated in this License.
117
+
118
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
119
+ Contribution intentionally submitted for inclusion in the Work by You to the
120
+ Licensor shall be under the terms and conditions of this License, without any
121
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
122
+ supersede or modify the terms of any separate license agreement you may have
123
+ executed with Licensor regarding such Contributions.
124
+
125
+ 6. Trademarks. This License does not grant permission to use the trade names,
126
+ trademarks, service marks, or product names of the Licensor, except as
127
+ required for reasonable and customary use in describing the origin of the Work
128
+ and reproducing the content of the NOTICE file.
129
+
130
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
131
+ writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR
132
+ CONDITIONS OF ANY KIND, either express or implied, including, without
133
+ limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
134
+ MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
135
+ responsible for determining the appropriateness of using or redistributing the
136
+ Work and assume any risks associated with Your exercise of permissions under
137
+ this License.
138
+
139
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
140
+ tort, contract, or otherwise, unless required by applicable law or agreed to in
141
+ writing, shall any Contributor be liable to You for damages, including any
142
+ direct, indirect, special, incidental, or consequential damages of any
143
+ character arising as a result of this License or out of the use or inability
144
+ to use the Work, including but not limited to damages for loss of goodwill,
145
+ work stoppage, computer failure or malfunction, or any and all other
146
+ commercial damages or losses, even if such Contributor has been advised of the
147
+ possibility of such damages.
148
+
149
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
150
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
151
+ acceptance of support, warranty, indemnity, or other liability obligations
152
+ and/or rights consistent with this License. However, in accepting such
153
+ obligations, You may act only on Your own behalf and on Your sole
154
+ responsibility, not on behalf of any other Contributor, and only if You agree
155
+ to indemnify, defend, and hold each Contributor harmless for any liability
156
+ incurred by, or claims asserted against, such Contributor by reason of your
157
+ accepting any such warranty or additional liability.
158
+
159
+ END OF TERMS AND CONDITIONS
160
+
161
+ APPENDIX: How to apply the Apache License to your work.
162
+
163
+ To apply the Apache License to your work, attach the following boilerplate
164
+ notice, with the fields enclosed by brackets "[]" replaced with your own
165
+ identifying information. (Don't include the brackets!) The text should be
166
+ enclosed in the appropriate comment syntax for the file format. We also
167
+ recommend that a file or class name and description of purpose be included on
168
+ the same "printed page" as the copyright notice for easier identification
169
+ within third-party archives.
170
+
171
+ Copyright 2026 Jami.Studio
172
+
173
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
174
+ this file except in compliance with the License. You may obtain a copy of the
175
+ License at
176
+
177
+ http://www.apache.org/licenses/LICENSE-2.0
178
+
179
+ Unless required by applicable law or agreed to in writing, software distributed
180
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
181
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
182
+ specific language governing permissions and limitations under the License.
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@jami-studio/registry-schema",
3
+ "version": "0.1.0",
4
+ "description": "Single source of truth for the Studio UI registry contract: registry item, registryRef handshake, item graph, and workspace/theme reference schemas as JSON Schema 2020-12 with AJV-strict validation utilities and TypeScript types.",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/studio-jami/studio-ui.git",
9
+ "directory": "packages/registry-schema"
10
+ },
11
+ "type": "module",
12
+ "main": "./src/index.mjs",
13
+ "types": "./src/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./src/index.d.ts",
17
+ "default": "./src/index.mjs"
18
+ },
19
+ "./json-source": "./src/json-source.mjs",
20
+ "./schemas/*": "./src/schemas/*"
21
+ },
22
+ "files": [
23
+ "src",
24
+ "package.json"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public",
28
+ "registry": "https://registry.npmjs.org/"
29
+ },
30
+ "jamiRelease": {
31
+ "publishable": true
32
+ },
33
+ "dependencies": {
34
+ "ajv": "^8.17.1",
35
+ "ajv-formats": "^3.0.1"
36
+ },
37
+ "scripts": {
38
+ "build": "node scripts/build.mjs",
39
+ "test": "node --test test/registry-schema.test.mjs"
40
+ }
41
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,296 @@
1
+ // Type definitions for @jami-studio/registry-schema.
2
+
3
+ export interface RegistryRef {
4
+ registryId: string;
5
+ namespace: string;
6
+ name: string;
7
+ version: string;
8
+ }
9
+
10
+ export type AgentManifestComponentName =
11
+ | "accordion"
12
+ | "agent-panel"
13
+ | "button"
14
+ | "calendar"
15
+ | "chart"
16
+ | "data-list"
17
+ | "date-control"
18
+ | "dialog"
19
+ | "docs-source-panel"
20
+ | "dropdown-menu"
21
+ | "media-grid"
22
+ | "panel"
23
+ | "popover"
24
+ | "select"
25
+ | "tabs"
26
+ | "text-field"
27
+ | "tooltip";
28
+
29
+ export interface AgentManifest {
30
+ $schema: "https://jami.studio/schemas/registry/agent-manifest.schema.json";
31
+ schemaVersion: "2026-06-23.agent-manifest";
32
+ manifestId: string;
33
+ component: {
34
+ namespace: "@jami-studio/ui";
35
+ name: AgentManifestComponentName;
36
+ version: string;
37
+ };
38
+ propContract: {
39
+ schemaVersion: string;
40
+ additionalProperties: false;
41
+ required: string[];
42
+ properties: Record<string, Record<string, unknown>>;
43
+ };
44
+ actionSlots: AgentManifestActionSlot[];
45
+ runtimeBinding: {
46
+ renderer: "resident-renderer";
47
+ bindingMode: "resident-component";
48
+ payloadSchemaVersion: "2026-06-09";
49
+ vocabularyHandshakeVersion: "2026-06-09.vocabulary-handshake";
50
+ execution: "display-only-data-never-code";
51
+ };
52
+ residentRenderer: {
53
+ allowlistMode: "default-allowlist";
54
+ allowedComponents: AgentManifestComponentName[];
55
+ unknownComponentState: "unsupported";
56
+ unsafePayloadState: "invalid";
57
+ };
58
+ }
59
+
60
+ export interface AgentManifestActionSlot {
61
+ slotId: string;
62
+ name: string;
63
+ label: string;
64
+ harnessRoute: string;
65
+ risk: "read" | "write" | "destructive" | "external" | "secret_adjacent";
66
+ policyScope: string;
67
+ confirmationMode: "none" | "confirm" | "approval_required" | "owner_required";
68
+ inputSchema: Record<string, unknown>;
69
+ outputSchema: Record<string, unknown>;
70
+ safetyConstraints: Array<
71
+ | "policy-required"
72
+ | "audit-required"
73
+ | "evidence-required"
74
+ | "no-inline-secret-values"
75
+ | "no-model-provided-code"
76
+ | "schema-validated-input"
77
+ | "schema-validated-output"
78
+ >;
79
+ }
80
+
81
+ export interface RegistryItemLifecycle {
82
+ id: string;
83
+ version: string;
84
+ schemaVersion: string;
85
+ sourceHash: string;
86
+ migrationNotes: string;
87
+ [key: string]: unknown;
88
+ }
89
+
90
+ export interface RegistryItemProvenance {
91
+ source: string;
92
+ license: string;
93
+ reviewedAt: string;
94
+ copiedSource: boolean;
95
+ [key: string]: unknown;
96
+ }
97
+
98
+ export interface RegistryItemCompatibility {
99
+ shadcn: string;
100
+ tailwind: string;
101
+ react: string;
102
+ [key: string]: unknown;
103
+ }
104
+
105
+ export interface RegistryItemFile {
106
+ path: string;
107
+ target: string;
108
+ kind: string;
109
+ [key: string]: unknown;
110
+ }
111
+
112
+ export type RegistryItemType =
113
+ | "primitive"
114
+ | "component"
115
+ | "block"
116
+ | "page"
117
+ | "theme"
118
+ | "font"
119
+ | "app"
120
+ | "workspace";
121
+
122
+ export interface RegistryItem {
123
+ $schema: "https://jami.studio/schemas/registry/registry-item.schema.json";
124
+ name: string;
125
+ type: RegistryItemType;
126
+ title: string;
127
+ description?: string;
128
+ workspace?: "solo" | "business-ops" | "mixed-media" | "research-writing";
129
+ registryRef?: RegistryRef;
130
+ agentManifest?: AgentManifest;
131
+ lifecycle: RegistryItemLifecycle;
132
+ provenance: RegistryItemProvenance;
133
+ compatibility: RegistryItemCompatibility;
134
+ tokenRequirements: string[];
135
+ dependencies: string[];
136
+ registryDependencies?: string[];
137
+ files: RegistryItemFile[];
138
+ [key: string]: unknown;
139
+ }
140
+
141
+ export type ItemGraphNodeType =
142
+ | "registry:ui"
143
+ | "registry:component"
144
+ | "registry:block"
145
+ | "registry:page"
146
+ | "registry:theme"
147
+ | "registry:font"
148
+ | "registry:app"
149
+ | "registry:workspace"
150
+ | "registry:item";
151
+
152
+ export interface ItemGraphNode {
153
+ name: string;
154
+ type: ItemGraphNodeType;
155
+ level: number;
156
+ registryDependencies: string[];
157
+ }
158
+
159
+ export interface ItemGraphEdge {
160
+ from: string;
161
+ to: string;
162
+ }
163
+
164
+ export interface ItemGraph {
165
+ root: string;
166
+ nodes: ItemGraphNode[];
167
+ edges: ItemGraphEdge[];
168
+ }
169
+
170
+ export interface WorkspaceRef {
171
+ workspaceId: string;
172
+ audience?: "workspace" | "docs" | "operations" | "governance" | "custom";
173
+ registryRef: RegistryRef;
174
+ installedItems: RegistryRef[];
175
+ registryState?: "current" | "missing_dependency" | "unsupported_workspace_version" | "stale_registry_item";
176
+ }
177
+
178
+ export interface ThemeRef {
179
+ themeId: string;
180
+ tokenSchemaVersion?: string;
181
+ registryRef: RegistryRef;
182
+ kind: "factory" | "custom" | "default";
183
+ state?:
184
+ | "current"
185
+ | "deprecated"
186
+ | "missing_token"
187
+ | "invalid_alias"
188
+ | "contrast_failure"
189
+ | "migration_needed"
190
+ | "unsupported_family";
191
+ }
192
+
193
+ export interface WorkbenchStateDraft {
194
+ target: string;
195
+ themeName: string;
196
+ presetName: string;
197
+ controls: {
198
+ accent: string;
199
+ focusRing: string;
200
+ radius: string;
201
+ spacing: string;
202
+ density: string;
203
+ motion: string;
204
+ dockWidth: string;
205
+ fontSize: string;
206
+ [control: string]: string;
207
+ };
208
+ }
209
+
210
+ export interface WorkbenchState {
211
+ schemaVersion: "2026-06-23.workbench-state";
212
+ revision?: string | null;
213
+ saved: WorkbenchStateDraft;
214
+ }
215
+
216
+ export type ContractName =
217
+ | "registryRef"
218
+ | "agentManifest"
219
+ | "registryItem"
220
+ | "itemGraph"
221
+ | "workspaceRef"
222
+ | "themeRef"
223
+ | "workbenchState";
224
+
225
+ export interface ValidationResult {
226
+ ok: boolean;
227
+ errors: unknown[];
228
+ messages: string[];
229
+ }
230
+
231
+ export interface ValidateFunction {
232
+ (data: unknown): boolean;
233
+ errors?: unknown[] | null;
234
+ }
235
+
236
+ export declare const registryRefSchema: Record<string, unknown>;
237
+ export declare const agentManifestSchema: Record<string, unknown>;
238
+ export declare const registryItemSchema: Record<string, unknown>;
239
+ export declare const itemGraphSchema: Record<string, unknown>;
240
+ export declare const workspaceRefSchema: Record<string, unknown>;
241
+ export declare const themeRefSchema: Record<string, unknown>;
242
+ export declare const workbenchStateSchema: Record<string, unknown>;
243
+ export declare const schemas: Record<ContractName, Record<string, unknown>>;
244
+ export declare const contractNames: ContractName[];
245
+ export declare const agentManifestAllowedComponents: readonly AgentManifestComponentName[];
246
+
247
+ export declare function createAjv(options?: Record<string, unknown>): unknown;
248
+ export declare function getValidator(name: ContractName): ValidateFunction;
249
+ export declare function validate(name: ContractName, data: unknown): ValidationResult;
250
+ export declare function assertValid<T = unknown>(name: ContractName, data: T, label?: string): T;
251
+ export declare function formatErrors(errors: unknown[]): string[];
252
+ export interface DuplicateJsonObjectKey {
253
+ key: string;
254
+ first: { line: number; column: number };
255
+ duplicate: { line: number; column: number };
256
+ }
257
+ export declare function findDuplicateJsonObjectKeys(source: string): DuplicateJsonObjectKey[];
258
+ export declare function formatDuplicateJsonObjectKeys(duplicates: DuplicateJsonObjectKey[]): string[];
259
+
260
+ export declare const validateRegistryRef: ValidateFunction;
261
+ export declare const validateAgentManifest: ValidateFunction;
262
+ export declare const validateRegistryItem: ValidateFunction;
263
+ export declare const validateItemGraph: ValidateFunction;
264
+ export declare const validateWorkspaceRef: ValidateFunction;
265
+ export declare const validateThemeRef: ValidateFunction;
266
+ export declare const validateWorkbenchState: ValidateFunction;
267
+
268
+ export type ShadcnRegistryItemType =
269
+ | "registry:lib"
270
+ | "registry:block"
271
+ | "registry:component"
272
+ | "registry:ui"
273
+ | "registry:hook"
274
+ | "registry:theme"
275
+ | "registry:page"
276
+ | "registry:file"
277
+ | "registry:style"
278
+ | "registry:base"
279
+ | "registry:font"
280
+ | "registry:item";
281
+
282
+ export interface ShadcnRegistryItem {
283
+ name: string;
284
+ type: ShadcnRegistryItemType;
285
+ files?: Array<{ path: string; type: string; target?: string; content?: string }>;
286
+ [key: string]: unknown;
287
+ }
288
+
289
+ export declare const shadcnRegistryItemSchema: Record<string, unknown>;
290
+ export declare const shadcnItemTypes: ReadonlySet<string>;
291
+ export declare const shadcnFileTypes: ReadonlySet<string>;
292
+ export declare const validateShadcnRegistryItem: ValidateFunction;
293
+ export declare function validateShadcn(item: unknown): ValidationResult;
294
+ export declare function toShadcnItemType(type: string): string;
295
+ export declare function toShadcnFileType(type: string): string;
296
+ export declare function toShadcnRegistryItem<T extends { type: string; files?: unknown[] }>(item: T): T;