@openenvelope/schema 1.0.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,53 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://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 distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship made available under the License, as indicated by a copyright notice that is included in or attached to the work.
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other transformations represent, as a whole, an original work of authorship.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works of the Work, that is intentionally submitted to the Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
26
+
27
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of whom a Contribution has been received by the Licensor and included within the Work.
28
+
29
+ 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
30
+
31
+ 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work.
32
+
33
+ 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
34
+
35
+ (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
36
+
37
+ (b) You must cause any modified files to carry prominent notices stating that You changed the files; and
38
+
39
+ (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work; and
40
+
41
+ (d) If the Work includes a "NOTICE" text file, you must include a readable copy of the attribution notices contained within such NOTICE file.
42
+
43
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions.
44
+
45
+ 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor.
46
+
47
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
48
+
49
+ 8. Limitation of Liability. In no event and under no legal theory shall any Contributor be liable for damages arising out of this License or use of the Work.
50
+
51
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work, You may offer acceptance of warranty or liability obligations. However, in accepting such obligations, You may act only on Your own behalf.
52
+
53
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # @openenvelope/schema
2
+
3
+ JSON Schema and TypeScript types for the [Envelope Team Definition](https://schema.openenvelope.org/team/v1.json) — the open standard for defining AI agent teams.
4
+
5
+ ## What is this?
6
+
7
+ Envelope teams are defined in `.envelope.json` files — a single versioned document that declares which agents exist, their roles, what tools they can use, access policies, and orchestration pipelines.
8
+
9
+ This package gives you:
10
+ - The **JSON Schema** file (for validation and IDE autocomplete)
11
+ - **TypeScript types** (`TeamDefinition`, `AgentDefinition`, `Gate`, `Schedule`, and all sub-types)
12
+ - A **`validate()` helper** that returns structured errors
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @openenvelope/schema
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### TypeScript types
23
+
24
+ ```typescript
25
+ import type { TeamDefinition, AgentDefinition } from '@openenvelope/schema';
26
+
27
+ const team: TeamDefinition = {
28
+ name: 'Support Triage',
29
+ slug: 'support-triage',
30
+ version: '1.0.0',
31
+ agents: [
32
+ {
33
+ key: 'classifier',
34
+ name: 'Ticket Classifier',
35
+ role: 'Classifies incoming support tickets by urgency and category.',
36
+ adapterType: 'claude_local',
37
+ model: 'anthropic:claude-opus-4-5',
38
+ prompt: 'You are a support ticket classifier...',
39
+ }
40
+ ]
41
+ };
42
+ ```
43
+
44
+ ### Validation
45
+
46
+ ```typescript
47
+ import { validate } from '@openenvelope/schema';
48
+
49
+ const result = validate(myTeamDefinition);
50
+
51
+ if (result.valid) {
52
+ console.log('Team definition is valid');
53
+ } else {
54
+ console.error('Validation errors:', result.errors);
55
+ }
56
+ ```
57
+
58
+ ### Import the raw schema
59
+
60
+ ```typescript
61
+ import schema from '@openenvelope/schema/schema.json';
62
+
63
+ // Use with any JSON Schema validator (Ajv, etc.)
64
+ import Ajv from 'ajv';
65
+ const ajv = new Ajv();
66
+ const validate = ajv.compile(schema);
67
+ ```
68
+
69
+ ### `$schema` field
70
+
71
+ Add this to your `.envelope.json` files for automatic IDE autocomplete without installing anything:
72
+
73
+ ```json
74
+ {
75
+ "$schema": "https://schema.openenvelope.org/team/v1.json"
76
+ }
77
+ ```
78
+
79
+ VS Code, JetBrains, and any editor using the JSON Language Server will automatically offer autocomplete and validation once the `$schema` field is present — no extension required.
80
+
81
+ ## Versioning
82
+
83
+ This package follows the schema version. `1.x.x` covers all v1 schema releases. Patch versions contain type or validator fixes; no breaking changes within `1.x`.
84
+
85
+ ## Schema registry
86
+
87
+ The canonical schema URL is registered with [SchemaStore](https://www.schemastore.org) — which means `.envelope.json` files get IDE support automatically, even without the `$schema` field, once your editor has the SchemaStore catalog.
88
+
89
+ - **Canonical URL:** https://schema.openenvelope.org/team/v1.json
90
+ - **GitHub:** https://github.com/openenvelope/schema
91
+ - **SchemaStore PR:** https://github.com/SchemaStore/schemastore/pull/5645
92
+
93
+ ## RFC process
94
+
95
+ The schema is an open standard. Proposed changes go through a public RFC process documented in [RFC_PROCESS.md](./RFC_PROCESS.md). Within v1, the schema is additive only — no fields are removed or renamed.
96
+
97
+ ## License
98
+
99
+ Apache 2.0