@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.
@@ -0,0 +1,139 @@
1
+ import { ErrorObject } from 'ajv';
2
+
3
+ type TeamCategory = 'customer-support' | 'sales' | 'marketing' | 'finance' | 'hr' | 'devops' | 'engineering' | 'data-analysis' | 'legal' | 'research' | 'content' | 'product' | 'security' | 'operations' | 'other';
4
+ type TeamVisibility = 'public' | 'team' | 'private';
5
+ type PricingModel = 'free' | 'per_run' | 'per_k_tokens' | 'subscription';
6
+ interface Pricing {
7
+ model: PricingModel;
8
+ amount?: number;
9
+ currency?: string;
10
+ interval?: 'month' | 'year';
11
+ trialDays?: number;
12
+ }
13
+ interface ForkedFrom {
14
+ ownerSlug: string;
15
+ teamSlug: string;
16
+ version: string;
17
+ }
18
+ interface TeamTimeout {
19
+ runMs?: number;
20
+ agentMs?: number;
21
+ }
22
+ interface IOField {
23
+ type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
24
+ description?: string;
25
+ required?: boolean;
26
+ enum?: string[];
27
+ default?: unknown;
28
+ }
29
+ type AdapterType = 'http' | 'claude_local' | 'openai_local' | 'codex_local' | 'gemini_local' | 'opencode_local' | 'cursor_local';
30
+ type ModelProvider = 'anthropic' | 'openai' | 'google' | 'mistral' | 'openrouter';
31
+ interface ModelConfig {
32
+ provider: ModelProvider;
33
+ model: string;
34
+ temperature?: number;
35
+ maxTokens?: number;
36
+ timeoutMs?: number;
37
+ }
38
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
39
+ type AccessPolicyAction = 'allow' | 'deny' | 'require_approval';
40
+ interface AccessPolicyRule {
41
+ host?: string;
42
+ methods?: HttpMethod[];
43
+ pathPrefix?: string;
44
+ action: AccessPolicyAction;
45
+ reason?: string;
46
+ }
47
+ interface AccessPolicy {
48
+ accessPolicyVersion: '1';
49
+ defaultAction: 'allow' | 'deny';
50
+ rules?: AccessPolicyRule[];
51
+ }
52
+ interface AgentDefinition {
53
+ key: string;
54
+ name: string;
55
+ title: string;
56
+ role: string;
57
+ adapterType?: AdapterType;
58
+ reportsToKey?: string;
59
+ capabilities?: string[];
60
+ prompt?: string;
61
+ model?: string;
62
+ modelConfig?: ModelConfig;
63
+ allowedHosts?: string[];
64
+ accessPolicy?: AccessPolicy;
65
+ metadata?: Record<string, unknown>;
66
+ }
67
+ type GateType = 'decision' | 'content_generation' | 'classification' | 'action';
68
+ type GateTrigger = 'any_approved' | 'all_resolved' | 'threshold' | 'scheduled';
69
+ type GateOnReject = 'skip' | 'rerun' | 'escalate' | 'halt';
70
+ type RecordActionVerb = 'approve' | 'skip' | 'reject' | 'reset';
71
+ type RecordActionStyle = 'primary' | 'secondary' | 'danger';
72
+ interface RecordAction {
73
+ label: string;
74
+ verb: RecordActionVerb;
75
+ endpointTemplate: string;
76
+ style?: RecordActionStyle;
77
+ }
78
+ type GateTimeoutBehaviour = 'escalate' | 'halt' | 'proceed';
79
+ interface GateTimeout {
80
+ after: string;
81
+ behaviour: GateTimeoutBehaviour;
82
+ }
83
+ interface HumanGate {
84
+ name: string;
85
+ type: GateType;
86
+ afterStep: string;
87
+ triggersStep: string;
88
+ fields: string[];
89
+ trigger: GateTrigger;
90
+ thresholdCount?: number;
91
+ onReject: GateOnReject;
92
+ recordActions?: RecordAction[];
93
+ timeout?: GateTimeout;
94
+ }
95
+ type ScheduleType = 'manual' | 'cron';
96
+ interface Schedule {
97
+ type: ScheduleType;
98
+ cron?: string;
99
+ label?: string;
100
+ }
101
+ interface PipelineStep {
102
+ key: string;
103
+ agentKey: string;
104
+ label?: string;
105
+ dependsOn?: string[];
106
+ }
107
+ interface TeamDefinition {
108
+ $schema: 'https://schema.openenvelope.org/team/v1.json';
109
+ name: string;
110
+ slug: string;
111
+ version: string;
112
+ description: string;
113
+ visibility: TeamVisibility;
114
+ agents: AgentDefinition[];
115
+ category?: TeamCategory;
116
+ tags?: string[];
117
+ pricing?: Pricing;
118
+ forkable?: boolean;
119
+ forkedFrom?: ForkedFrom;
120
+ timeout?: TeamTimeout;
121
+ readme?: string;
122
+ icon?: string;
123
+ inputs?: Record<string, IOField>;
124
+ outputs?: Record<string, IOField>;
125
+ requiredSecrets?: string[];
126
+ requiredVariables?: string[];
127
+ changelog?: string;
128
+ gates?: HumanGate[];
129
+ schedule?: Schedule;
130
+ pipeline?: PipelineStep[];
131
+ }
132
+
133
+ interface ValidationResult {
134
+ valid: boolean;
135
+ errors: ErrorObject[] | null;
136
+ }
137
+ declare function validate(definition: unknown): ValidationResult;
138
+
139
+ export { type AccessPolicy, type AccessPolicyAction, type AccessPolicyRule, type AdapterType, type AgentDefinition, type ForkedFrom, type GateOnReject, type GateTimeout, type GateTimeoutBehaviour, type GateTrigger, type GateType, type HttpMethod, type HumanGate, type IOField, type ModelConfig, type ModelProvider, type PipelineStep, type Pricing, type PricingModel, type RecordAction, type RecordActionStyle, type RecordActionVerb, type Schedule, type ScheduleType, type TeamCategory, type TeamDefinition, type TeamTimeout, type TeamVisibility, type ValidationResult, validate };
@@ -0,0 +1,139 @@
1
+ import { ErrorObject } from 'ajv';
2
+
3
+ type TeamCategory = 'customer-support' | 'sales' | 'marketing' | 'finance' | 'hr' | 'devops' | 'engineering' | 'data-analysis' | 'legal' | 'research' | 'content' | 'product' | 'security' | 'operations' | 'other';
4
+ type TeamVisibility = 'public' | 'team' | 'private';
5
+ type PricingModel = 'free' | 'per_run' | 'per_k_tokens' | 'subscription';
6
+ interface Pricing {
7
+ model: PricingModel;
8
+ amount?: number;
9
+ currency?: string;
10
+ interval?: 'month' | 'year';
11
+ trialDays?: number;
12
+ }
13
+ interface ForkedFrom {
14
+ ownerSlug: string;
15
+ teamSlug: string;
16
+ version: string;
17
+ }
18
+ interface TeamTimeout {
19
+ runMs?: number;
20
+ agentMs?: number;
21
+ }
22
+ interface IOField {
23
+ type?: 'string' | 'number' | 'boolean' | 'object' | 'array';
24
+ description?: string;
25
+ required?: boolean;
26
+ enum?: string[];
27
+ default?: unknown;
28
+ }
29
+ type AdapterType = 'http' | 'claude_local' | 'openai_local' | 'codex_local' | 'gemini_local' | 'opencode_local' | 'cursor_local';
30
+ type ModelProvider = 'anthropic' | 'openai' | 'google' | 'mistral' | 'openrouter';
31
+ interface ModelConfig {
32
+ provider: ModelProvider;
33
+ model: string;
34
+ temperature?: number;
35
+ maxTokens?: number;
36
+ timeoutMs?: number;
37
+ }
38
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS';
39
+ type AccessPolicyAction = 'allow' | 'deny' | 'require_approval';
40
+ interface AccessPolicyRule {
41
+ host?: string;
42
+ methods?: HttpMethod[];
43
+ pathPrefix?: string;
44
+ action: AccessPolicyAction;
45
+ reason?: string;
46
+ }
47
+ interface AccessPolicy {
48
+ accessPolicyVersion: '1';
49
+ defaultAction: 'allow' | 'deny';
50
+ rules?: AccessPolicyRule[];
51
+ }
52
+ interface AgentDefinition {
53
+ key: string;
54
+ name: string;
55
+ title: string;
56
+ role: string;
57
+ adapterType?: AdapterType;
58
+ reportsToKey?: string;
59
+ capabilities?: string[];
60
+ prompt?: string;
61
+ model?: string;
62
+ modelConfig?: ModelConfig;
63
+ allowedHosts?: string[];
64
+ accessPolicy?: AccessPolicy;
65
+ metadata?: Record<string, unknown>;
66
+ }
67
+ type GateType = 'decision' | 'content_generation' | 'classification' | 'action';
68
+ type GateTrigger = 'any_approved' | 'all_resolved' | 'threshold' | 'scheduled';
69
+ type GateOnReject = 'skip' | 'rerun' | 'escalate' | 'halt';
70
+ type RecordActionVerb = 'approve' | 'skip' | 'reject' | 'reset';
71
+ type RecordActionStyle = 'primary' | 'secondary' | 'danger';
72
+ interface RecordAction {
73
+ label: string;
74
+ verb: RecordActionVerb;
75
+ endpointTemplate: string;
76
+ style?: RecordActionStyle;
77
+ }
78
+ type GateTimeoutBehaviour = 'escalate' | 'halt' | 'proceed';
79
+ interface GateTimeout {
80
+ after: string;
81
+ behaviour: GateTimeoutBehaviour;
82
+ }
83
+ interface HumanGate {
84
+ name: string;
85
+ type: GateType;
86
+ afterStep: string;
87
+ triggersStep: string;
88
+ fields: string[];
89
+ trigger: GateTrigger;
90
+ thresholdCount?: number;
91
+ onReject: GateOnReject;
92
+ recordActions?: RecordAction[];
93
+ timeout?: GateTimeout;
94
+ }
95
+ type ScheduleType = 'manual' | 'cron';
96
+ interface Schedule {
97
+ type: ScheduleType;
98
+ cron?: string;
99
+ label?: string;
100
+ }
101
+ interface PipelineStep {
102
+ key: string;
103
+ agentKey: string;
104
+ label?: string;
105
+ dependsOn?: string[];
106
+ }
107
+ interface TeamDefinition {
108
+ $schema: 'https://schema.openenvelope.org/team/v1.json';
109
+ name: string;
110
+ slug: string;
111
+ version: string;
112
+ description: string;
113
+ visibility: TeamVisibility;
114
+ agents: AgentDefinition[];
115
+ category?: TeamCategory;
116
+ tags?: string[];
117
+ pricing?: Pricing;
118
+ forkable?: boolean;
119
+ forkedFrom?: ForkedFrom;
120
+ timeout?: TeamTimeout;
121
+ readme?: string;
122
+ icon?: string;
123
+ inputs?: Record<string, IOField>;
124
+ outputs?: Record<string, IOField>;
125
+ requiredSecrets?: string[];
126
+ requiredVariables?: string[];
127
+ changelog?: string;
128
+ gates?: HumanGate[];
129
+ schedule?: Schedule;
130
+ pipeline?: PipelineStep[];
131
+ }
132
+
133
+ interface ValidationResult {
134
+ valid: boolean;
135
+ errors: ErrorObject[] | null;
136
+ }
137
+ declare function validate(definition: unknown): ValidationResult;
138
+
139
+ export { type AccessPolicy, type AccessPolicyAction, type AccessPolicyRule, type AdapterType, type AgentDefinition, type ForkedFrom, type GateOnReject, type GateTimeout, type GateTimeoutBehaviour, type GateTrigger, type GateType, type HttpMethod, type HumanGate, type IOField, type ModelConfig, type ModelProvider, type PipelineStep, type Pricing, type PricingModel, type RecordAction, type RecordActionStyle, type RecordActionVerb, type Schedule, type ScheduleType, type TeamCategory, type TeamDefinition, type TeamTimeout, type TeamVisibility, type ValidationResult, validate };