@harnesys/sdk 0.0.0-stage → 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 +21 -0
- package/README.md +80 -2
- package/dist/addon-context-factory.d.ts +6 -0
- package/dist/addon-context-factory.js +160 -0
- package/dist/addon-context.d.ts +346 -0
- package/dist/addon-context.js +0 -0
- package/dist/define-addon.d.ts +57 -0
- package/dist/define-addon.js +53 -0
- package/dist/families/config.d.ts +14 -0
- package/dist/families/config.js +16 -0
- package/dist/families/content.d.ts +28 -0
- package/dist/families/content.js +19 -0
- package/dist/families/field-spec.d.ts +100 -0
- package/dist/families/field-spec.js +85 -0
- package/dist/families/hook.d.ts +37 -0
- package/dist/families/hook.js +25 -0
- package/dist/families/job.d.ts +45 -0
- package/dist/families/job.js +26 -0
- package/dist/families/json-schema.d.ts +36 -0
- package/dist/families/json-schema.js +101 -0
- package/dist/families/lsp.d.ts +18 -0
- package/dist/families/lsp.js +18 -0
- package/dist/families/mcp.d.ts +18 -0
- package/dist/families/mcp.js +18 -0
- package/dist/families/registry.d.ts +9 -0
- package/dist/families/registry.js +34 -0
- package/dist/families/route.d.ts +38 -0
- package/dist/families/route.js +37 -0
- package/dist/families/source-kind.d.ts +24 -0
- package/dist/families/source-kind.js +21 -0
- package/dist/families/tool-pack.d.ts +68 -0
- package/dist/families/tool-pack.js +57 -0
- package/dist/families/transport.d.ts +52 -0
- package/dist/families/transport.js +29 -0
- package/dist/families/trigger.d.ts +97 -0
- package/dist/families/trigger.js +46 -0
- package/dist/families/view.d.ts +255 -0
- package/dist/families/view.js +87 -0
- package/dist/families/viewer.d.ts +31 -0
- package/dist/families/viewer.js +26 -0
- package/dist/families/worker.d.ts +23 -0
- package/dist/families/worker.js +19 -0
- package/dist/host-client.d.ts +11 -0
- package/dist/host-client.js +30 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +35 -0
- package/dist/manifest/branding.d.ts +14 -0
- package/dist/manifest/branding.js +18 -0
- package/dist/manifest/connections.d.ts +21 -0
- package/dist/manifest/connections.js +10 -0
- package/dist/manifest/json-schema.d.ts +2 -0
- package/dist/manifest/json-schema.js +13 -0
- package/dist/manifest/l10n.d.ts +9 -0
- package/dist/manifest/l10n.js +28 -0
- package/dist/manifest/manifest.d.ts +112 -0
- package/dist/manifest/manifest.js +45 -0
- package/dist/manifest/validate.d.ts +14 -0
- package/dist/manifest/validate.js +144 -0
- package/dist/permissions/permissions.d.ts +31 -0
- package/dist/permissions/permissions.js +53 -0
- package/dist/process-entry.d.ts +26 -0
- package/dist/process-entry.js +146 -0
- package/dist/protocol/envelope.d.ts +115 -0
- package/dist/protocol/envelope.js +72 -0
- package/dist/protocol/error.d.ts +67 -0
- package/dist/protocol/error.js +61 -0
- package/dist/protocol/handshake.d.ts +55 -0
- package/dist/protocol/handshake.js +26 -0
- package/dist/protocol/map.d.ts +1090 -0
- package/dist/protocol/map.js +127 -0
- package/dist/protocol/meta.d.ts +31 -0
- package/dist/protocol/meta.js +14 -0
- package/dist/protocol/method-spec.d.ts +13 -0
- package/dist/protocol/method-spec.js +9 -0
- package/dist/protocol/org-service-methods.d.ts +135 -0
- package/dist/protocol/org-service-methods.js +106 -0
- package/dist/protocol/shared.d.ts +389 -0
- package/dist/protocol/shared.js +231 -0
- package/dist/protocol/source-methods.d.ts +218 -0
- package/dist/protocol/source-methods.js +18 -0
- package/dist/protocol/thread-service-methods.d.ts +50 -0
- package/dist/protocol/thread-service-methods.js +32 -0
- package/dist/runtime.d.ts +25 -0
- package/dist/runtime.js +229 -0
- package/dist/testing/fake-db.d.ts +15 -0
- package/dist/testing/fake-db.js +120 -0
- package/dist/testing/fake-files.d.ts +9 -0
- package/dist/testing/fake-files.js +87 -0
- package/dist/testing/fake-host.d.ts +115 -0
- package/dist/testing/fake-host.js +152 -0
- package/dist/testing/fake-services.d.ts +63 -0
- package/dist/testing/fake-services.js +277 -0
- package/dist/testing/fixtures.d.ts +4 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/index.d.ts +4 -0
- package/dist/testing/index.js +2 -0
- package/package.json +66 -4
- package/src/addon-context-factory.ts +236 -0
- package/src/addon-context.ts +313 -0
- package/src/define-addon.ts +178 -0
- package/src/families/config.ts +24 -0
- package/src/families/content.ts +35 -0
- package/src/families/field-spec.ts +175 -0
- package/src/families/hook.ts +34 -0
- package/src/families/job.ts +41 -0
- package/src/families/json-schema.ts +167 -0
- package/src/families/lsp.ts +28 -0
- package/src/families/mcp.ts +28 -0
- package/src/families/registry.ts +44 -0
- package/src/families/route.ts +52 -0
- package/src/families/source-kind.ts +34 -0
- package/src/families/tool-pack.ts +92 -0
- package/src/families/transport.ts +52 -0
- package/src/families/trigger.ts +92 -0
- package/src/families/view.ts +144 -0
- package/src/families/viewer.ts +43 -0
- package/src/families/worker.ts +30 -0
- package/src/host-client.ts +52 -0
- package/src/index.ts +341 -0
- package/src/manifest/branding.ts +24 -0
- package/src/manifest/connections.ts +21 -0
- package/src/manifest/json-schema.ts +24 -0
- package/src/manifest/l10n.ts +39 -0
- package/src/manifest/manifest.ts +94 -0
- package/src/manifest/validate.ts +200 -0
- package/src/permissions/permissions.ts +79 -0
- package/src/process-entry.ts +205 -0
- package/src/protocol/envelope.ts +126 -0
- package/src/protocol/error.ts +81 -0
- package/src/protocol/handshake.ts +43 -0
- package/src/protocol/map.ts +339 -0
- package/src/protocol/meta.ts +26 -0
- package/src/protocol/method-spec.ts +40 -0
- package/src/protocol/org-service-methods.ts +148 -0
- package/src/protocol/shared.ts +345 -0
- package/src/protocol/source-methods.ts +61 -0
- package/src/protocol/thread-service-methods.ts +50 -0
- package/src/runtime.ts +332 -0
- package/src/testing/fake-db.ts +140 -0
- package/src/testing/fake-files.ts +114 -0
- package/src/testing/fake-host.ts +261 -0
- package/src/testing/fake-services.ts +345 -0
- package/src/testing/fixtures.ts +88 -0
- package/src/testing/index.ts +12 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
import type { FieldSpec } from './field-spec.ts';
|
|
4
|
+
export declare const VIEW_SCHEMA_VERSION = 1;
|
|
5
|
+
export interface RouteRef {
|
|
6
|
+
route: string;
|
|
7
|
+
params?: Record<string, string>;
|
|
8
|
+
}
|
|
9
|
+
export interface Column {
|
|
10
|
+
key: string;
|
|
11
|
+
label: L10n;
|
|
12
|
+
format: 'text' | 'datetime' | 'number' | 'badge' | 'link' | 'copy';
|
|
13
|
+
}
|
|
14
|
+
export interface Action {
|
|
15
|
+
id: string;
|
|
16
|
+
label: L10n;
|
|
17
|
+
route: RouteRef;
|
|
18
|
+
confirm?: L10n;
|
|
19
|
+
destructive?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export type ViewSection = {
|
|
22
|
+
type: 'status';
|
|
23
|
+
} | {
|
|
24
|
+
type: 'capabilities';
|
|
25
|
+
} | {
|
|
26
|
+
type: 'permissions';
|
|
27
|
+
} | {
|
|
28
|
+
type: 'config';
|
|
29
|
+
fields?: string[];
|
|
30
|
+
} | {
|
|
31
|
+
type: 'connections';
|
|
32
|
+
connections?: string[];
|
|
33
|
+
} | {
|
|
34
|
+
type: 'automations';
|
|
35
|
+
triggers?: string[];
|
|
36
|
+
} | {
|
|
37
|
+
type: 'jobs';
|
|
38
|
+
} | {
|
|
39
|
+
type: 'table';
|
|
40
|
+
title: L10n;
|
|
41
|
+
source: RouteRef;
|
|
42
|
+
columns: Column[];
|
|
43
|
+
rowActions?: Action[];
|
|
44
|
+
pageSize?: number;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'form';
|
|
47
|
+
title: L10n;
|
|
48
|
+
fields: FieldSpec[];
|
|
49
|
+
submit: RouteRef;
|
|
50
|
+
confirm?: L10n;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'actions';
|
|
53
|
+
actions: Action[];
|
|
54
|
+
} | {
|
|
55
|
+
type: 'markdown';
|
|
56
|
+
body: L10n;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'frame';
|
|
59
|
+
route: string;
|
|
60
|
+
height?: number;
|
|
61
|
+
};
|
|
62
|
+
export interface ViewDescriptor {
|
|
63
|
+
id: string;
|
|
64
|
+
title: L10n;
|
|
65
|
+
icon?: string;
|
|
66
|
+
sections: ViewSection[];
|
|
67
|
+
}
|
|
68
|
+
export declare const RouteRefSchema: z.ZodObject<{
|
|
69
|
+
route: z.ZodString;
|
|
70
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export declare const ColumnSchema: z.ZodObject<{
|
|
73
|
+
key: z.ZodString;
|
|
74
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
75
|
+
format: z.ZodEnum<{
|
|
76
|
+
number: "number";
|
|
77
|
+
text: "text";
|
|
78
|
+
link: "link";
|
|
79
|
+
datetime: "datetime";
|
|
80
|
+
badge: "badge";
|
|
81
|
+
copy: "copy";
|
|
82
|
+
}>;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
export declare const ActionSchema: z.ZodObject<{
|
|
85
|
+
id: z.ZodString;
|
|
86
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
87
|
+
route: z.ZodObject<{
|
|
88
|
+
route: z.ZodString;
|
|
89
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
92
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export declare const ViewSectionSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"status">;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"capabilities">;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"permissions">;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"config">;
|
|
102
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"connections">;
|
|
105
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"automations">;
|
|
108
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
type: z.ZodLiteral<"jobs">;
|
|
111
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
112
|
+
type: z.ZodLiteral<"table">;
|
|
113
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
114
|
+
source: z.ZodObject<{
|
|
115
|
+
route: z.ZodString;
|
|
116
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
119
|
+
key: z.ZodString;
|
|
120
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
121
|
+
format: z.ZodEnum<{
|
|
122
|
+
number: "number";
|
|
123
|
+
text: "text";
|
|
124
|
+
link: "link";
|
|
125
|
+
datetime: "datetime";
|
|
126
|
+
badge: "badge";
|
|
127
|
+
copy: "copy";
|
|
128
|
+
}>;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
rowActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
133
|
+
route: z.ZodObject<{
|
|
134
|
+
route: z.ZodString;
|
|
135
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
136
|
+
}, z.core.$strip>;
|
|
137
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
138
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
}, z.core.$strip>>>;
|
|
140
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"form">;
|
|
143
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
144
|
+
fields: z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
145
|
+
submit: z.ZodObject<{
|
|
146
|
+
route: z.ZodString;
|
|
147
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"actions">;
|
|
152
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
153
|
+
id: z.ZodString;
|
|
154
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
155
|
+
route: z.ZodObject<{
|
|
156
|
+
route: z.ZodString;
|
|
157
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
158
|
+
}, z.core.$strip>;
|
|
159
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
160
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
type: z.ZodLiteral<"markdown">;
|
|
164
|
+
body: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"frame">;
|
|
167
|
+
route: z.ZodString;
|
|
168
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
169
|
+
}, z.core.$strip>]>;
|
|
170
|
+
export declare const ViewDescriptorSchema: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
173
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
174
|
+
sections: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
175
|
+
type: z.ZodLiteral<"status">;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"capabilities">;
|
|
178
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
179
|
+
type: z.ZodLiteral<"permissions">;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"config">;
|
|
182
|
+
fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
type: z.ZodLiteral<"connections">;
|
|
185
|
+
connections: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
186
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"automations">;
|
|
188
|
+
triggers: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"jobs">;
|
|
191
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"table">;
|
|
193
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
194
|
+
source: z.ZodObject<{
|
|
195
|
+
route: z.ZodString;
|
|
196
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
columns: z.ZodArray<z.ZodObject<{
|
|
199
|
+
key: z.ZodString;
|
|
200
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
201
|
+
format: z.ZodEnum<{
|
|
202
|
+
number: "number";
|
|
203
|
+
text: "text";
|
|
204
|
+
link: "link";
|
|
205
|
+
datetime: "datetime";
|
|
206
|
+
badge: "badge";
|
|
207
|
+
copy: "copy";
|
|
208
|
+
}>;
|
|
209
|
+
}, z.core.$strip>>;
|
|
210
|
+
rowActions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
213
|
+
route: z.ZodObject<{
|
|
214
|
+
route: z.ZodString;
|
|
215
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
218
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
}, z.core.$strip>>>;
|
|
220
|
+
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
type: z.ZodLiteral<"form">;
|
|
223
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
224
|
+
fields: z.ZodArray<z.ZodType<FieldSpec, unknown, z.core.$ZodTypeInternals<FieldSpec, unknown>>>;
|
|
225
|
+
submit: z.ZodObject<{
|
|
226
|
+
route: z.ZodString;
|
|
227
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
228
|
+
}, z.core.$strip>;
|
|
229
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
230
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
231
|
+
type: z.ZodLiteral<"actions">;
|
|
232
|
+
actions: z.ZodArray<z.ZodObject<{
|
|
233
|
+
id: z.ZodString;
|
|
234
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
235
|
+
route: z.ZodObject<{
|
|
236
|
+
route: z.ZodString;
|
|
237
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
confirm: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
|
|
240
|
+
destructive: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
243
|
+
type: z.ZodLiteral<"markdown">;
|
|
244
|
+
body: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
245
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
246
|
+
type: z.ZodLiteral<"frame">;
|
|
247
|
+
route: z.ZodString;
|
|
248
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
249
|
+
}, z.core.$strip>]>>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
export declare const viewFamily: {
|
|
252
|
+
family: string;
|
|
253
|
+
versions: number[];
|
|
254
|
+
schema: (v: number) => z.ZodType;
|
|
255
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
import { FieldSpecSchema } from "./field-spec.js";
|
|
4
|
+
export const VIEW_SCHEMA_VERSION = 1;
|
|
5
|
+
export const RouteRefSchema = z.object({
|
|
6
|
+
route: z.string().min(1),
|
|
7
|
+
params: z.record(z.string(), z.string()).optional(),
|
|
8
|
+
});
|
|
9
|
+
export const ColumnSchema = z.object({
|
|
10
|
+
key: z.string().min(1),
|
|
11
|
+
label: L10nSchema,
|
|
12
|
+
format: z.enum(['text', 'datetime', 'number', 'badge', 'link', 'copy']),
|
|
13
|
+
});
|
|
14
|
+
export const ActionSchema = z.object({
|
|
15
|
+
id: z.string().min(1),
|
|
16
|
+
label: L10nSchema,
|
|
17
|
+
route: RouteRefSchema,
|
|
18
|
+
confirm: L10nSchema.optional(),
|
|
19
|
+
destructive: z.boolean().optional(),
|
|
20
|
+
});
|
|
21
|
+
const baseSections = {
|
|
22
|
+
status: z.object({ type: z.literal('status') }),
|
|
23
|
+
capabilities: z.object({ type: z.literal('capabilities') }),
|
|
24
|
+
permissions: z.object({ type: z.literal('permissions') }),
|
|
25
|
+
config: z.object({ type: z.literal('config'), fields: z.array(z.string()).optional() }),
|
|
26
|
+
connections: z.object({
|
|
27
|
+
type: z.literal('connections'),
|
|
28
|
+
connections: z.array(z.string()).optional(),
|
|
29
|
+
}),
|
|
30
|
+
automations: z.object({
|
|
31
|
+
type: z.literal('automations'),
|
|
32
|
+
triggers: z.array(z.string()).optional(),
|
|
33
|
+
}),
|
|
34
|
+
jobs: z.object({ type: z.literal('jobs') }),
|
|
35
|
+
table: z.object({
|
|
36
|
+
type: z.literal('table'),
|
|
37
|
+
title: L10nSchema,
|
|
38
|
+
source: RouteRefSchema,
|
|
39
|
+
columns: z.array(ColumnSchema).min(1),
|
|
40
|
+
rowActions: z.array(ActionSchema).optional(),
|
|
41
|
+
pageSize: z.number().int().positive().optional(),
|
|
42
|
+
}),
|
|
43
|
+
form: z.object({
|
|
44
|
+
type: z.literal('form'),
|
|
45
|
+
title: L10nSchema,
|
|
46
|
+
fields: z.array(FieldSpecSchema).min(1),
|
|
47
|
+
submit: RouteRefSchema,
|
|
48
|
+
confirm: L10nSchema.optional(),
|
|
49
|
+
}),
|
|
50
|
+
actions: z.object({ type: z.literal('actions'), actions: z.array(ActionSchema).min(1) }),
|
|
51
|
+
markdown: z.object({ type: z.literal('markdown'), body: L10nSchema }),
|
|
52
|
+
frame: z.object({
|
|
53
|
+
type: z.literal('frame'),
|
|
54
|
+
route: z.string().min(1),
|
|
55
|
+
height: z.number().int().positive().optional(),
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
export const ViewSectionSchema = z.union([
|
|
59
|
+
baseSections.status,
|
|
60
|
+
baseSections.capabilities,
|
|
61
|
+
baseSections.permissions,
|
|
62
|
+
baseSections.config,
|
|
63
|
+
baseSections.connections,
|
|
64
|
+
baseSections.automations,
|
|
65
|
+
baseSections.jobs,
|
|
66
|
+
baseSections.table,
|
|
67
|
+
baseSections.form,
|
|
68
|
+
baseSections.actions,
|
|
69
|
+
baseSections.markdown,
|
|
70
|
+
baseSections.frame,
|
|
71
|
+
]);
|
|
72
|
+
export const ViewDescriptorSchema = z.object({
|
|
73
|
+
id: z.string().min(1),
|
|
74
|
+
title: L10nSchema,
|
|
75
|
+
icon: z.string().optional(),
|
|
76
|
+
sections: z.array(ViewSectionSchema).min(1),
|
|
77
|
+
});
|
|
78
|
+
export const viewFamily = {
|
|
79
|
+
family: 'view',
|
|
80
|
+
versions: [VIEW_SCHEMA_VERSION],
|
|
81
|
+
schema: (v) => {
|
|
82
|
+
if (v !== VIEW_SCHEMA_VERSION) {
|
|
83
|
+
throw new Error(`view descriptor schema version ${v} is not supported`);
|
|
84
|
+
}
|
|
85
|
+
return ViewDescriptorSchema;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
export declare const VIEWER_SCHEMA_VERSION = 1;
|
|
4
|
+
export interface ViewerDescriptor {
|
|
5
|
+
id: string;
|
|
6
|
+
title: L10n;
|
|
7
|
+
/** Dot-prefixed file extensions this viewer handles, lowercase, e.g. ['.drawio']. */
|
|
8
|
+
extensions: string[];
|
|
9
|
+
/** Add-on route (GET) that serves the editor/preview HTML document. */
|
|
10
|
+
route: string;
|
|
11
|
+
mode: 'view' | 'edit';
|
|
12
|
+
/** Host offers "New <title> file" in the sources tree when true. */
|
|
13
|
+
create?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare const ViewerExtensionSchema: z.ZodString;
|
|
16
|
+
export declare const ViewerDescriptorSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
19
|
+
extensions: z.ZodArray<z.ZodString>;
|
|
20
|
+
route: z.ZodString;
|
|
21
|
+
mode: z.ZodEnum<{
|
|
22
|
+
edit: "edit";
|
|
23
|
+
view: "view";
|
|
24
|
+
}>;
|
|
25
|
+
create: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export declare const viewerFamily: {
|
|
28
|
+
readonly family: "viewer";
|
|
29
|
+
readonly versions: readonly [1];
|
|
30
|
+
readonly schema: (v: number) => z.ZodType;
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
export const VIEWER_SCHEMA_VERSION = 1;
|
|
4
|
+
export const ViewerExtensionSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.regex(/^\.[A-Za-z0-9][A-Za-z0-9_.-]*$/, 'extension must be a dot-prefixed file extension');
|
|
7
|
+
export const ViewerDescriptorSchema = z.object({
|
|
8
|
+
id: z.string().min(1),
|
|
9
|
+
title: L10nSchema,
|
|
10
|
+
extensions: z.array(ViewerExtensionSchema).min(1),
|
|
11
|
+
route: z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^\/[A-Za-z0-9/_:.-]*$/, 'route must start with / and use :param segments'),
|
|
14
|
+
mode: z.enum(['view', 'edit']),
|
|
15
|
+
create: z.boolean().optional(),
|
|
16
|
+
});
|
|
17
|
+
export const viewerFamily = {
|
|
18
|
+
family: 'viewer',
|
|
19
|
+
versions: [VIEWER_SCHEMA_VERSION],
|
|
20
|
+
schema: (v) => {
|
|
21
|
+
if (v !== VIEWER_SCHEMA_VERSION) {
|
|
22
|
+
throw new Error(`viewer descriptor schema version ${v} is not supported`);
|
|
23
|
+
}
|
|
24
|
+
return ViewerDescriptorSchema;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from '../manifest/l10n.ts';
|
|
3
|
+
export declare const WORKER_SCHEMA_VERSION = 1;
|
|
4
|
+
export interface WorkerDescriptor {
|
|
5
|
+
id: string;
|
|
6
|
+
title: L10n;
|
|
7
|
+
autostart: boolean;
|
|
8
|
+
restart: 'on-failure' | 'never';
|
|
9
|
+
}
|
|
10
|
+
export declare const WorkerDescriptorSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
title: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
13
|
+
autostart: z.ZodBoolean;
|
|
14
|
+
restart: z.ZodEnum<{
|
|
15
|
+
never: "never";
|
|
16
|
+
"on-failure": "on-failure";
|
|
17
|
+
}>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare const workerFamily: {
|
|
20
|
+
family: string;
|
|
21
|
+
versions: number[];
|
|
22
|
+
schema: (v: number) => z.ZodType;
|
|
23
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "../manifest/l10n.js";
|
|
3
|
+
export const WORKER_SCHEMA_VERSION = 1;
|
|
4
|
+
export const WorkerDescriptorSchema = z.object({
|
|
5
|
+
id: z.string().min(1),
|
|
6
|
+
title: L10nSchema,
|
|
7
|
+
autostart: z.boolean(),
|
|
8
|
+
restart: z.enum(['on-failure', 'never']),
|
|
9
|
+
});
|
|
10
|
+
export const workerFamily = {
|
|
11
|
+
family: 'worker',
|
|
12
|
+
versions: [WORKER_SCHEMA_VERSION],
|
|
13
|
+
schema: (v) => {
|
|
14
|
+
if (v !== WORKER_SCHEMA_VERSION) {
|
|
15
|
+
throw new Error(`worker descriptor schema version ${v} is not supported`);
|
|
16
|
+
}
|
|
17
|
+
return WorkerDescriptorSchema;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AddonContext } from './addon-context-factory.ts';
|
|
2
|
+
import { type HostServiceClient } from './protocol/map.ts';
|
|
3
|
+
import { type CallMeta } from './protocol/meta.ts';
|
|
4
|
+
export interface HostChannel {
|
|
5
|
+
request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown>;
|
|
6
|
+
notify(method: string, params: unknown): void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createHostClient(channel: HostChannel, getMeta: () => CallMeta): HostServiceClient;
|
|
9
|
+
export declare function parseCallMeta(raw: unknown): CallMeta;
|
|
10
|
+
export declare function createAddonContextFor(channel: HostChannel, meta: CallMeta, signal: AbortSignal): AddonContext;
|
|
11
|
+
export type { AddonContext } from './addon-context.ts';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createAddonContext } from "./addon-context-factory.js";
|
|
2
|
+
import { methodSpec, protocolEntries } from "./protocol/map.js";
|
|
3
|
+
import { CallMetaSchema } from "./protocol/meta.js";
|
|
4
|
+
export function createHostClient(channel, getMeta) {
|
|
5
|
+
const client = {};
|
|
6
|
+
for (const entry of protocolEntries()) {
|
|
7
|
+
if (entry.spec.direction !== 'addon-to-host') {
|
|
8
|
+
continue;
|
|
9
|
+
}
|
|
10
|
+
client[entry.method] = async (params, options) => {
|
|
11
|
+
const spec = methodSpec(entry.method);
|
|
12
|
+
if (!spec) {
|
|
13
|
+
throw new Error(`method '${entry.method}' is not in the protocol map`);
|
|
14
|
+
}
|
|
15
|
+
const parsedParams = spec.params.parse({
|
|
16
|
+
...params,
|
|
17
|
+
_meta: getMeta(),
|
|
18
|
+
});
|
|
19
|
+
const raw = await channel.request(entry.method, parsedParams, options?.signal);
|
|
20
|
+
return spec.result ? spec.result.parse(raw) : raw;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return client;
|
|
24
|
+
}
|
|
25
|
+
export function parseCallMeta(raw) {
|
|
26
|
+
return CallMetaSchema.parse(raw);
|
|
27
|
+
}
|
|
28
|
+
export function createAddonContextFor(channel, meta, signal) {
|
|
29
|
+
return createAddonContext(createHostClient(channel, () => meta), meta, signal, (method, params) => channel.notify(method, params));
|
|
30
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { type AddonAccounts, type AddonBridge, type AddonConfig, type AddonContext, type AddonDb, type AddonEvents, type AddonFileChunk, type AddonFileStat, type AddonFiles, type AddonFileWriteResult, type AddonHttp, type AddonLog, type AddonLogLevel, type AddonProgress, type AddonRuns, type AddonSecrets, type AddonSkills, type AddonThreads, type AddonTriggerField, type AddonTriggers, type AddonTriggerTarget, type AddonUsage, type AddonWorkers, createAddonContext, type DbRow, type DbStatement, type DbWriteResult, type SqlParam, } from './addon-context-factory.ts';
|
|
2
|
+
export { type AddonDefinition, defineAddon, deriveHandlers, type HookHandler, type JobHandler, type LifecycleHandlers, type NotificationHandlers, type ResolvedAddonDefinition, type RouteHandler, type SourceBackendHandlers, type ToolHandler, type TransportHandlers, type TriggerPair, type WorkerPair, } from './define-addon.ts';
|
|
3
|
+
export { CONFIG_SCHEMA_VERSION, type ConfigDescriptor, ConfigDescriptorSchema, configFamily, } from './families/config.ts';
|
|
4
|
+
export { CONTENT_SCHEMA_VERSION, type ContentDescriptor, ContentDescriptorSchema, contentFamily, } from './families/content.ts';
|
|
5
|
+
export { defaultConfigValues, type FieldOption, FieldOptionSchema, type FieldOptionsFrom, FieldOptionsFromSchema, type FieldSpec, FieldSpecSchema, type FieldType, FieldTypeSchema, type FieldValue, FieldValueSchema, type FieldVisibleWhen, FieldVisibleWhenSchema, type FieldWidget, FieldWidgetSchema, } from './families/field-spec.ts';
|
|
6
|
+
export { HOOK_SCHEMA_VERSION, type HookDescriptor, HookDescriptorSchema, HookOnSchema, hookFamily, } from './families/hook.ts';
|
|
7
|
+
export { JOB_SCHEMA_VERSION, type JobDescriptor, JobDescriptorSchema, JobScheduleSchema, jobFamily, } from './families/job.ts';
|
|
8
|
+
export { INPUT_SCHEMA_MAX_BYTES, INPUT_SCHEMA_MAX_DEPTH, type JsonSchemaSubset, JsonSchemaSubsetSchema, type SchemaViolation, validateInputSchema, } from './families/json-schema.ts';
|
|
9
|
+
export { LSP_SCHEMA_VERSION, type LspDescriptor, LspDescriptorSchema, lspFamily, } from './families/lsp.ts';
|
|
10
|
+
export { MCP_SCHEMA_VERSION, type McpDescriptor, McpDescriptorSchema, mcpFamily, } from './families/mcp.ts';
|
|
11
|
+
export { FAMILY_NAMES, type FamilyDefinition, familyDefinition, familyRegistry, } from './families/registry.ts';
|
|
12
|
+
export { ROUTE_SCHEMA_VERSION, type RouteDescriptor, RouteDescriptorSchema, type RouteMethod, routeFamily, } from './families/route.ts';
|
|
13
|
+
export { SOURCE_KIND_SCHEMA_VERSION, type SourceKindDescriptor, SourceKindDescriptorSchema, sourceKindFamily, } from './families/source-kind.ts';
|
|
14
|
+
export { TOOL_PACK_SCHEMA_VERSION, type ToolDescriptor, ToolDescriptorSchema, type ToolEffect, type ToolPackDescriptor, ToolPackDescriptorSchema, toolPackFamily, } from './families/tool-pack.ts';
|
|
15
|
+
export { TRANSPORT_SCHEMA_VERSION, type TransportCapabilities, TransportCapabilitiesSchema, type TransportDescriptor, TransportDescriptorSchema, transportFamily, } from './families/transport.ts';
|
|
16
|
+
export { TRIGGER_SCHEMA_VERSION, type TriggerDescriptor, TriggerDescriptorSchema, type TriggerLimits, triggerFamily, } from './families/trigger.ts';
|
|
17
|
+
export { type Action, ActionSchema, type Column, ColumnSchema, type RouteRef, RouteRefSchema, VIEW_SCHEMA_VERSION, type ViewDescriptor, ViewDescriptorSchema, type ViewSection, ViewSectionSchema, viewFamily, } from './families/view.ts';
|
|
18
|
+
export { VIEWER_SCHEMA_VERSION, type ViewerDescriptor, ViewerDescriptorSchema, ViewerExtensionSchema, viewerFamily, } from './families/viewer.ts';
|
|
19
|
+
export { WORKER_SCHEMA_VERSION, type WorkerDescriptor, WorkerDescriptorSchema, workerFamily, } from './families/worker.ts';
|
|
20
|
+
export { createHostClient, type HostChannel } from './host-client.ts';
|
|
21
|
+
export { AddonIconRefSchema, HexColorSchema, LucideIconNameSchema } from './manifest/branding.ts';
|
|
22
|
+
export { type ConnectionRequirement, ConnectionRequirementSchema } from './manifest/connections.ts';
|
|
23
|
+
export { contributionDescriptorJsonSchema, manifestJsonSchema } from './manifest/json-schema.ts';
|
|
24
|
+
export { type L10n, L10nSchema, l10nKeys, resolveL10n } from './manifest/l10n.ts';
|
|
25
|
+
export { type AddonDataSpec, AddonDataSpecSchema, AddonIdSchema, type AddonManifest, AddonManifestSchema, type AddonRuntimeSpec, AddonRuntimeSpecSchema, type Contribution, ContributionIdSchema, ContributionSchema, parseAddonManifest, } from './manifest/manifest.ts';
|
|
26
|
+
export { type ManifestValidation, type Violation, validateManifest } from './manifest/validate.ts';
|
|
27
|
+
export { BASELINE_PERMISSION_IDS, type BaselinePermissionId, type EffectivePermission, EffectivePermissionSchema, isBaselinePermissionId, isKnownPermissionId, type JsonObject, JsonObjectSchema, KNOWN_PERMISSION_IDS, type KnownPermissionId, type PermissionRequest, PermissionRequestSchema, type PermissionScope, } from './permissions/permissions.ts';
|
|
28
|
+
export { createStdioChannel, PROTOCOL_PLATFORM, type StartAddonProcessOptions, type StdioWiring, startAddonProcess, } from './process-entry.ts';
|
|
29
|
+
export { type CancelNotification, CancelNotificationSchema, decodeMessage, encodeMessage, errorResponse, JSONRPC_VERSION, type JsonRpcError, JsonRpcErrorSchema, JsonRpcIdSchema, type JsonRpcNotification, JsonRpcNotificationSchema, type JsonRpcRequest, JsonRpcRequestSchema, type JsonRpcResponse, JsonRpcResponseSchema, MAX_MESSAGE_BYTES, notification, type ProgressNotification, ProgressNotificationSchema, request, response, } from './protocol/envelope.ts';
|
|
30
|
+
export { AddonError, type AddonErrorData, AddonErrorDataSchema, type AddonErrorReason, AddonErrorReasonSchema, isAddonError, } from './protocol/error.ts';
|
|
31
|
+
export { type InitializeParams, InitializeParamsSchema, type InitializeResult, InitializeResultSchema, } from './protocol/handshake.ts';
|
|
32
|
+
export { type AddonDispatcher, type AddonHandlerOf, type AddonNotify, type AddonToHostMethods, addonMethod, type HostNotify, type HostRequestName, type HostRequestParams, type HostRequestResult, type HostServiceClient, type HostServiceName, type HostServiceParams, type HostServiceResult, type HostToAddonMethods, hostMethod, type MethodDirection, type MethodSpec, type MethodsOf, methodSpec, type NotificationMethods, type NotificationName, type NotificationSender, notificationSpec, type ParamsOf, PROTOCOL_METHODS, type ProtocolEntry, type ProtocolMethodMap, protocolEntries, protocolMap, type ResultOf, stripMeta, } from './protocol/map.ts';
|
|
33
|
+
export { type CallMeta, CallMetaSchema } from './protocol/meta.ts';
|
|
34
|
+
export { AccountSummarySchema, type AppCredentials, AppCredentialsSchema, type BridgeInboundOutcome, BridgeInboundOutcomeSchema, CloudRemoteEntrySchema, type CloudRemoteEntryWire, CloudRemoteExportSchema, type CloudRemoteExportWire, FileReadParamsSchema, FileReadResultSchema, FileStatParamsSchema, FileStatResultSchema, FileWriteParamsSchema, FileWriteResultSchema, HttpAuthSchema, HttpFetchParamsSchema, HttpFetchResultSchema, type InboundAttachment, InboundAttachmentSchema, InboundMessageSchema, type LogLevel, LogLevelSchema, LogWriteParamsSchema, type MessageFormat, type RouteHandleResult, RouteHandleResultSchema, type RouteRequest, RouteRequestSchema, SourceBytesResultSchema, SourceExportParamsSchema, SourceListParamsSchema, SourceListResultSchema, SourceMkdirParamsSchema, SourceMkdirResultSchema, SourceReadParamsSchema, SourceRemoveParamsSchema, SourceStatParamsSchema, SourceStatResultSchema, SourceUploadParamsSchema, SourceUploadResultSchema, type TransportAttachment, type TransportBindingSummary, TransportBindingSummarySchema, type TransportMessage, TransportMessageSchema, TriggerFireOutcomeSchema, } from './protocol/shared.ts';
|
|
35
|
+
export { type AddonRuntime, type AddonRuntimeOptions, createAddonRuntime } from './runtime.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export { createAddonContext, } from "./addon-context-factory.js";
|
|
2
|
+
export { defineAddon, deriveHandlers, } from "./define-addon.js";
|
|
3
|
+
export { CONFIG_SCHEMA_VERSION, ConfigDescriptorSchema, configFamily, } from "./families/config.js";
|
|
4
|
+
export { CONTENT_SCHEMA_VERSION, ContentDescriptorSchema, contentFamily, } from "./families/content.js";
|
|
5
|
+
export { defaultConfigValues, FieldOptionSchema, FieldOptionsFromSchema, FieldSpecSchema, FieldTypeSchema, FieldValueSchema, FieldVisibleWhenSchema, FieldWidgetSchema, } from "./families/field-spec.js";
|
|
6
|
+
export { HOOK_SCHEMA_VERSION, HookDescriptorSchema, HookOnSchema, hookFamily, } from "./families/hook.js";
|
|
7
|
+
export { JOB_SCHEMA_VERSION, JobDescriptorSchema, JobScheduleSchema, jobFamily, } from "./families/job.js";
|
|
8
|
+
export { INPUT_SCHEMA_MAX_BYTES, INPUT_SCHEMA_MAX_DEPTH, JsonSchemaSubsetSchema, validateInputSchema, } from "./families/json-schema.js";
|
|
9
|
+
export { LSP_SCHEMA_VERSION, LspDescriptorSchema, lspFamily, } from "./families/lsp.js";
|
|
10
|
+
export { MCP_SCHEMA_VERSION, McpDescriptorSchema, mcpFamily, } from "./families/mcp.js";
|
|
11
|
+
export { FAMILY_NAMES, familyDefinition, familyRegistry, } from "./families/registry.js";
|
|
12
|
+
export { ROUTE_SCHEMA_VERSION, RouteDescriptorSchema, routeFamily, } from "./families/route.js";
|
|
13
|
+
export { SOURCE_KIND_SCHEMA_VERSION, SourceKindDescriptorSchema, sourceKindFamily, } from "./families/source-kind.js";
|
|
14
|
+
export { TOOL_PACK_SCHEMA_VERSION, ToolDescriptorSchema, ToolPackDescriptorSchema, toolPackFamily, } from "./families/tool-pack.js";
|
|
15
|
+
export { TRANSPORT_SCHEMA_VERSION, TransportCapabilitiesSchema, TransportDescriptorSchema, transportFamily, } from "./families/transport.js";
|
|
16
|
+
export { TRIGGER_SCHEMA_VERSION, TriggerDescriptorSchema, triggerFamily, } from "./families/trigger.js";
|
|
17
|
+
export { ActionSchema, ColumnSchema, RouteRefSchema, VIEW_SCHEMA_VERSION, ViewDescriptorSchema, ViewSectionSchema, viewFamily, } from "./families/view.js";
|
|
18
|
+
export { VIEWER_SCHEMA_VERSION, ViewerDescriptorSchema, ViewerExtensionSchema, viewerFamily, } from "./families/viewer.js";
|
|
19
|
+
export { WORKER_SCHEMA_VERSION, WorkerDescriptorSchema, workerFamily, } from "./families/worker.js";
|
|
20
|
+
export { createHostClient } from "./host-client.js";
|
|
21
|
+
export { AddonIconRefSchema, HexColorSchema, LucideIconNameSchema } from "./manifest/branding.js";
|
|
22
|
+
export { ConnectionRequirementSchema } from "./manifest/connections.js";
|
|
23
|
+
export { contributionDescriptorJsonSchema, manifestJsonSchema } from "./manifest/json-schema.js";
|
|
24
|
+
export { L10nSchema, l10nKeys, resolveL10n } from "./manifest/l10n.js";
|
|
25
|
+
export { AddonDataSpecSchema, AddonIdSchema, AddonManifestSchema, AddonRuntimeSpecSchema, ContributionIdSchema, ContributionSchema, parseAddonManifest, } from "./manifest/manifest.js";
|
|
26
|
+
export { validateManifest } from "./manifest/validate.js";
|
|
27
|
+
export { BASELINE_PERMISSION_IDS, EffectivePermissionSchema, isBaselinePermissionId, isKnownPermissionId, JsonObjectSchema, KNOWN_PERMISSION_IDS, PermissionRequestSchema, } from "./permissions/permissions.js";
|
|
28
|
+
export { createStdioChannel, PROTOCOL_PLATFORM, startAddonProcess, } from "./process-entry.js";
|
|
29
|
+
export { CancelNotificationSchema, decodeMessage, encodeMessage, errorResponse, JSONRPC_VERSION, JsonRpcErrorSchema, JsonRpcIdSchema, JsonRpcNotificationSchema, JsonRpcRequestSchema, JsonRpcResponseSchema, MAX_MESSAGE_BYTES, notification, ProgressNotificationSchema, request, response, } from "./protocol/envelope.js";
|
|
30
|
+
export { AddonError, AddonErrorDataSchema, AddonErrorReasonSchema, isAddonError, } from "./protocol/error.js";
|
|
31
|
+
export { InitializeParamsSchema, InitializeResultSchema, } from "./protocol/handshake.js";
|
|
32
|
+
export { addonMethod, hostMethod, methodSpec, notificationSpec, PROTOCOL_METHODS, protocolEntries, protocolMap, stripMeta, } from "./protocol/map.js";
|
|
33
|
+
export { CallMetaSchema } from "./protocol/meta.js";
|
|
34
|
+
export { AccountSummarySchema, AppCredentialsSchema, BridgeInboundOutcomeSchema, CloudRemoteEntrySchema, CloudRemoteExportSchema, FileReadParamsSchema, FileReadResultSchema, FileStatParamsSchema, FileStatResultSchema, FileWriteParamsSchema, FileWriteResultSchema, HttpAuthSchema, HttpFetchParamsSchema, HttpFetchResultSchema, InboundAttachmentSchema, InboundMessageSchema, LogLevelSchema, LogWriteParamsSchema, RouteHandleResultSchema, RouteRequestSchema, SourceBytesResultSchema, SourceExportParamsSchema, SourceListParamsSchema, SourceListResultSchema, SourceMkdirParamsSchema, SourceMkdirResultSchema, SourceReadParamsSchema, SourceRemoveParamsSchema, SourceStatParamsSchema, SourceStatResultSchema, SourceUploadParamsSchema, SourceUploadResultSchema, TransportBindingSummarySchema, TransportMessageSchema, TriggerFireOutcomeSchema, } from "./protocol/shared.js";
|
|
35
|
+
export { createAddonRuntime } from "./runtime.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Lucide icon name in kebab-case (`'webhook'`, `'calendar-clock'`). Resolved by
|
|
4
|
+
* the web UI against `lucide-react/dynamic`; unknown names fall back to a
|
|
5
|
+
* default icon instead of failing.
|
|
6
|
+
*/
|
|
7
|
+
export declare const LucideIconNameSchema: z.ZodString;
|
|
8
|
+
/**
|
|
9
|
+
* Addon-level icon: either a lucide icon name or an SVG shipped with the
|
|
10
|
+
* package (`'assets/icon.svg'`).
|
|
11
|
+
*/
|
|
12
|
+
export declare const AddonIconRefSchema: z.ZodString;
|
|
13
|
+
/** Brand color as a 6-digit hex literal (`'#229ED9'`). */
|
|
14
|
+
export declare const HexColorSchema: z.ZodString;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Lucide icon name in kebab-case (`'webhook'`, `'calendar-clock'`). Resolved by
|
|
4
|
+
* the web UI against `lucide-react/dynamic`; unknown names fall back to a
|
|
5
|
+
* default icon instead of failing.
|
|
6
|
+
*/
|
|
7
|
+
export const LucideIconNameSchema = z
|
|
8
|
+
.string()
|
|
9
|
+
.regex(/^[a-z][a-z0-9-]*$/, 'icon must be a lucide icon name in kebab-case');
|
|
10
|
+
/**
|
|
11
|
+
* Addon-level icon: either a lucide icon name or an SVG shipped with the
|
|
12
|
+
* package (`'assets/icon.svg'`).
|
|
13
|
+
*/
|
|
14
|
+
export const AddonIconRefSchema = z
|
|
15
|
+
.string()
|
|
16
|
+
.regex(/^(assets\/[a-z0-9][a-z0-9._/-]*\.svg|[a-z][a-z0-9-]*)$/, "icon must be a lucide icon name or an 'assets/*.svg' path");
|
|
17
|
+
/** Brand color as a 6-digit hex literal (`'#229ED9'`). */
|
|
18
|
+
export const HexColorSchema = z.string().regex(/^#[0-9a-fA-F]{6}$/, 'color must be #RRGGBB');
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { L10n } from './l10n.ts';
|
|
3
|
+
export interface ConnectionRequirement {
|
|
4
|
+
id: string;
|
|
5
|
+
label: L10n;
|
|
6
|
+
accountKinds: string[];
|
|
7
|
+
scopes?: string[];
|
|
8
|
+
cardinality: 'one' | 'many';
|
|
9
|
+
optional?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const ConnectionRequirementSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
label: z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>;
|
|
14
|
+
accountKinds: z.ZodArray<z.ZodString>;
|
|
15
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
cardinality: z.ZodEnum<{
|
|
17
|
+
one: "one";
|
|
18
|
+
many: "many";
|
|
19
|
+
}>;
|
|
20
|
+
optional: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { L10nSchema } from "./l10n.js";
|
|
3
|
+
export const ConnectionRequirementSchema = z.object({
|
|
4
|
+
id: z.string().min(1),
|
|
5
|
+
label: L10nSchema,
|
|
6
|
+
accountKinds: z.array(z.string().min(1)).min(1),
|
|
7
|
+
scopes: z.array(z.string().min(1)).optional(),
|
|
8
|
+
cardinality: z.enum(['one', 'many']),
|
|
9
|
+
optional: z.boolean().optional(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { familyRegistry } from "../families/registry.js";
|
|
3
|
+
import { AddonManifestSchema } from "./manifest.js";
|
|
4
|
+
export function manifestJsonSchema() {
|
|
5
|
+
return z.toJSONSchema(AddonManifestSchema, { io: 'input', unrepresentable: 'any' });
|
|
6
|
+
}
|
|
7
|
+
export function contributionDescriptorJsonSchema(family, v) {
|
|
8
|
+
const module = familyRegistry[family];
|
|
9
|
+
if (!module) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return z.toJSONSchema(module.schema(v ?? 1), { io: 'input', unrepresentable: 'any' });
|
|
13
|
+
}
|