@myagentroam/protocol 0.1.6 → 0.1.8
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/dist/index.d.ts +139 -138
- package/dist/index.js +23 -1
- package/dist/skill.d.ts +370 -0
- package/dist/skill.js +175 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export * from './enterprise.js';
|
|
3
|
+
export * from './skill.js';
|
|
3
4
|
export const healthStatusSchema = z.object({
|
|
4
5
|
status: z.literal('ok')
|
|
5
6
|
});
|
|
@@ -754,7 +755,15 @@ export const workbenchNodeOperationSchema = z.enum([
|
|
|
754
755
|
'terminal.close',
|
|
755
756
|
'terminal.attach.authorize',
|
|
756
757
|
'node.upgrade.request',
|
|
757
|
-
'node.upgrade.cancel'
|
|
758
|
+
'node.upgrade.cancel',
|
|
759
|
+
'node.skills.inspect',
|
|
760
|
+
'node.skills.install',
|
|
761
|
+
'node.skills.remove',
|
|
762
|
+
'workspace.skills.inspect',
|
|
763
|
+
'workspace.skills.install',
|
|
764
|
+
'workspace.skills.remove',
|
|
765
|
+
'workspace.skills.git-exclude-repair',
|
|
766
|
+
'skill.install.job.get'
|
|
758
767
|
]);
|
|
759
768
|
/**
|
|
760
769
|
* A small, explicit envelope keeps WebSocket messages independently parseable
|
|
@@ -806,6 +815,19 @@ export const nodeErrorSchema = z.object({
|
|
|
806
815
|
'TERMINAL_ATTACH_CONFLICT',
|
|
807
816
|
'TERMINAL_REPLAY_GAP',
|
|
808
817
|
'TERMINAL_DATA_CHANNEL_UNAVAILABLE',
|
|
818
|
+
'SKILL_TARGET_OFFLINE',
|
|
819
|
+
'SKILL_TARGET_LIMIT_EXCEEDED',
|
|
820
|
+
'SKILL_NAME_CONFLICT',
|
|
821
|
+
'SKILL_PATH_UNSAFE',
|
|
822
|
+
'SKILL_CONTENT_INVALID',
|
|
823
|
+
'SKILL_INSTALL_PARTIAL',
|
|
824
|
+
'SKILL_INSTALL_FAILED',
|
|
825
|
+
'SKILL_INSTALL_VERSION_UNKNOWN',
|
|
826
|
+
'SKILL_INSTALL_RECOVERY_REQUIRED',
|
|
827
|
+
'SKILL_INSTALL_INVALID_LINK',
|
|
828
|
+
'NODE_SKILL_LINK_UNAVAILABLE',
|
|
829
|
+
'WORKSPACE_SKILL_GIT_EXCLUDE_FAILED',
|
|
830
|
+
'WORKSPACE_SKILL_TRACKED_CONFIRM_REQUIRED',
|
|
809
831
|
'INTERNAL_ERROR'
|
|
810
832
|
])
|
|
811
833
|
});
|
package/dist/skill.d.ts
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const skillScopeSchema: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
|
|
3
|
+
export declare const skillSourceKindSchema: z.ZodEnum<["SKILLS_SH", "REPOSITORY"]>;
|
|
4
|
+
export declare const skillSourceInputSchema: z.ZodEffects<z.ZodObject<{
|
|
5
|
+
kind: z.ZodEnum<["SKILLS_SH", "REPOSITORY"]>;
|
|
6
|
+
scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
|
|
7
|
+
organizationId: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
locator: z.ZodUnion<[z.ZodLiteral<"skills.sh">, z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
|
|
10
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
name: string;
|
|
13
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
14
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
15
|
+
locator: string;
|
|
16
|
+
organizationId?: number | undefined;
|
|
17
|
+
enabled?: boolean | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
name: string;
|
|
20
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
21
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
22
|
+
locator: string;
|
|
23
|
+
organizationId?: number | undefined;
|
|
24
|
+
enabled?: boolean | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
name: string;
|
|
27
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
28
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
29
|
+
locator: string;
|
|
30
|
+
organizationId?: number | undefined;
|
|
31
|
+
enabled?: boolean | undefined;
|
|
32
|
+
}, {
|
|
33
|
+
name: string;
|
|
34
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
35
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
36
|
+
locator: string;
|
|
37
|
+
organizationId?: number | undefined;
|
|
38
|
+
enabled?: boolean | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export type SkillSourceInput = z.infer<typeof skillSourceInputSchema>;
|
|
41
|
+
export declare const skillSourceSchema: z.ZodIntersection<z.ZodEffects<z.ZodObject<{
|
|
42
|
+
kind: z.ZodEnum<["SKILLS_SH", "REPOSITORY"]>;
|
|
43
|
+
scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
|
|
44
|
+
organizationId: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
name: z.ZodString;
|
|
46
|
+
locator: z.ZodUnion<[z.ZodLiteral<"skills.sh">, z.ZodEffects<z.ZodString, string, string>, z.ZodString]>;
|
|
47
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
48
|
+
}, "strict", z.ZodTypeAny, {
|
|
49
|
+
name: string;
|
|
50
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
51
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
52
|
+
locator: string;
|
|
53
|
+
organizationId?: number | undefined;
|
|
54
|
+
enabled?: boolean | undefined;
|
|
55
|
+
}, {
|
|
56
|
+
name: string;
|
|
57
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
58
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
59
|
+
locator: string;
|
|
60
|
+
organizationId?: number | undefined;
|
|
61
|
+
enabled?: boolean | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
name: string;
|
|
64
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
65
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
66
|
+
locator: string;
|
|
67
|
+
organizationId?: number | undefined;
|
|
68
|
+
enabled?: boolean | undefined;
|
|
69
|
+
}, {
|
|
70
|
+
name: string;
|
|
71
|
+
kind: "SKILLS_SH" | "REPOSITORY";
|
|
72
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
73
|
+
locator: string;
|
|
74
|
+
organizationId?: number | undefined;
|
|
75
|
+
enabled?: boolean | undefined;
|
|
76
|
+
}>, z.ZodObject<{
|
|
77
|
+
id: z.ZodString;
|
|
78
|
+
ownerUserId: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
builtIn: z.ZodBoolean;
|
|
80
|
+
status: z.ZodEnum<["READY", "DEGRADED", "DISABLED"]>;
|
|
81
|
+
lastErrorCode: z.ZodNullable<z.ZodString>;
|
|
82
|
+
createdAt: z.ZodNumber;
|
|
83
|
+
updatedAt: z.ZodNumber;
|
|
84
|
+
}, "strict", z.ZodTypeAny, {
|
|
85
|
+
status: "DISABLED" | "READY" | "DEGRADED";
|
|
86
|
+
id: string;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
updatedAt: number;
|
|
89
|
+
builtIn: boolean;
|
|
90
|
+
lastErrorCode: string | null;
|
|
91
|
+
ownerUserId?: number | undefined;
|
|
92
|
+
}, {
|
|
93
|
+
status: "DISABLED" | "READY" | "DEGRADED";
|
|
94
|
+
id: string;
|
|
95
|
+
createdAt: number;
|
|
96
|
+
updatedAt: number;
|
|
97
|
+
builtIn: boolean;
|
|
98
|
+
lastErrorCode: string | null;
|
|
99
|
+
ownerUserId?: number | undefined;
|
|
100
|
+
}>>;
|
|
101
|
+
export declare const skillVersionSummarySchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
commitSha: z.ZodString;
|
|
104
|
+
contentHash: z.ZodString;
|
|
105
|
+
createdAt: z.ZodNumber;
|
|
106
|
+
}, "strict", z.ZodTypeAny, {
|
|
107
|
+
id: string;
|
|
108
|
+
createdAt: number;
|
|
109
|
+
commitSha: string;
|
|
110
|
+
contentHash: string;
|
|
111
|
+
}, {
|
|
112
|
+
id: string;
|
|
113
|
+
createdAt: number;
|
|
114
|
+
commitSha: string;
|
|
115
|
+
contentHash: string;
|
|
116
|
+
}>;
|
|
117
|
+
export declare const skillFavoriteSchema: z.ZodEffects<z.ZodObject<{
|
|
118
|
+
id: z.ZodString;
|
|
119
|
+
sourceId: z.ZodString;
|
|
120
|
+
scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
|
|
121
|
+
ownerOrganizationId: z.ZodOptional<z.ZodNumber>;
|
|
122
|
+
ownerUserId: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
repositoryIdentity: z.ZodString;
|
|
124
|
+
skillPath: z.ZodUnion<[z.ZodLiteral<".">, z.ZodString]>;
|
|
125
|
+
normalizedName: z.ZodString;
|
|
126
|
+
featured: z.ZodBoolean;
|
|
127
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
128
|
+
currentVersion: z.ZodObject<{
|
|
129
|
+
id: z.ZodString;
|
|
130
|
+
commitSha: z.ZodString;
|
|
131
|
+
contentHash: z.ZodString;
|
|
132
|
+
createdAt: z.ZodNumber;
|
|
133
|
+
}, "strict", z.ZodTypeAny, {
|
|
134
|
+
id: string;
|
|
135
|
+
createdAt: number;
|
|
136
|
+
commitSha: string;
|
|
137
|
+
contentHash: string;
|
|
138
|
+
}, {
|
|
139
|
+
id: string;
|
|
140
|
+
createdAt: number;
|
|
141
|
+
commitSha: string;
|
|
142
|
+
contentHash: string;
|
|
143
|
+
}>;
|
|
144
|
+
createdAt: z.ZodNumber;
|
|
145
|
+
updatedAt: z.ZodNumber;
|
|
146
|
+
}, "strict", z.ZodTypeAny, {
|
|
147
|
+
id: string;
|
|
148
|
+
createdAt: number;
|
|
149
|
+
updatedAt: number;
|
|
150
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
151
|
+
sourceId: string;
|
|
152
|
+
repositoryIdentity: string;
|
|
153
|
+
skillPath: string;
|
|
154
|
+
normalizedName: string;
|
|
155
|
+
featured: boolean;
|
|
156
|
+
tags: string[];
|
|
157
|
+
currentVersion: {
|
|
158
|
+
id: string;
|
|
159
|
+
createdAt: number;
|
|
160
|
+
commitSha: string;
|
|
161
|
+
contentHash: string;
|
|
162
|
+
};
|
|
163
|
+
ownerUserId?: number | undefined;
|
|
164
|
+
ownerOrganizationId?: number | undefined;
|
|
165
|
+
}, {
|
|
166
|
+
id: string;
|
|
167
|
+
createdAt: number;
|
|
168
|
+
updatedAt: number;
|
|
169
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
170
|
+
sourceId: string;
|
|
171
|
+
repositoryIdentity: string;
|
|
172
|
+
skillPath: string;
|
|
173
|
+
normalizedName: string;
|
|
174
|
+
featured: boolean;
|
|
175
|
+
tags: string[];
|
|
176
|
+
currentVersion: {
|
|
177
|
+
id: string;
|
|
178
|
+
createdAt: number;
|
|
179
|
+
commitSha: string;
|
|
180
|
+
contentHash: string;
|
|
181
|
+
};
|
|
182
|
+
ownerUserId?: number | undefined;
|
|
183
|
+
ownerOrganizationId?: number | undefined;
|
|
184
|
+
}>, {
|
|
185
|
+
id: string;
|
|
186
|
+
createdAt: number;
|
|
187
|
+
updatedAt: number;
|
|
188
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
189
|
+
sourceId: string;
|
|
190
|
+
repositoryIdentity: string;
|
|
191
|
+
skillPath: string;
|
|
192
|
+
normalizedName: string;
|
|
193
|
+
featured: boolean;
|
|
194
|
+
tags: string[];
|
|
195
|
+
currentVersion: {
|
|
196
|
+
id: string;
|
|
197
|
+
createdAt: number;
|
|
198
|
+
commitSha: string;
|
|
199
|
+
contentHash: string;
|
|
200
|
+
};
|
|
201
|
+
ownerUserId?: number | undefined;
|
|
202
|
+
ownerOrganizationId?: number | undefined;
|
|
203
|
+
}, {
|
|
204
|
+
id: string;
|
|
205
|
+
createdAt: number;
|
|
206
|
+
updatedAt: number;
|
|
207
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
208
|
+
sourceId: string;
|
|
209
|
+
repositoryIdentity: string;
|
|
210
|
+
skillPath: string;
|
|
211
|
+
normalizedName: string;
|
|
212
|
+
featured: boolean;
|
|
213
|
+
tags: string[];
|
|
214
|
+
currentVersion: {
|
|
215
|
+
id: string;
|
|
216
|
+
createdAt: number;
|
|
217
|
+
commitSha: string;
|
|
218
|
+
contentHash: string;
|
|
219
|
+
};
|
|
220
|
+
ownerUserId?: number | undefined;
|
|
221
|
+
ownerOrganizationId?: number | undefined;
|
|
222
|
+
}>;
|
|
223
|
+
export type SkillFavorite = z.infer<typeof skillFavoriteSchema>;
|
|
224
|
+
export declare const skillFavoriteCreateInputSchema: z.ZodEffects<z.ZodObject<{
|
|
225
|
+
sourceId: z.ZodString;
|
|
226
|
+
candidateId: z.ZodString;
|
|
227
|
+
skillPath: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<".">, z.ZodString]>>;
|
|
228
|
+
scope: z.ZodEnum<["ENTERPRISE", "ORGANIZATION", "PERSONAL"]>;
|
|
229
|
+
organizationId: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
featured: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
232
|
+
}, "strict", z.ZodTypeAny, {
|
|
233
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
234
|
+
sourceId: string;
|
|
235
|
+
candidateId: string;
|
|
236
|
+
organizationId?: number | undefined;
|
|
237
|
+
skillPath?: string | undefined;
|
|
238
|
+
featured?: boolean | undefined;
|
|
239
|
+
tags?: string[] | undefined;
|
|
240
|
+
}, {
|
|
241
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
242
|
+
sourceId: string;
|
|
243
|
+
candidateId: string;
|
|
244
|
+
organizationId?: number | undefined;
|
|
245
|
+
skillPath?: string | undefined;
|
|
246
|
+
featured?: boolean | undefined;
|
|
247
|
+
tags?: string[] | undefined;
|
|
248
|
+
}>, {
|
|
249
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
250
|
+
sourceId: string;
|
|
251
|
+
candidateId: string;
|
|
252
|
+
organizationId?: number | undefined;
|
|
253
|
+
skillPath?: string | undefined;
|
|
254
|
+
featured?: boolean | undefined;
|
|
255
|
+
tags?: string[] | undefined;
|
|
256
|
+
}, {
|
|
257
|
+
scope: "PERSONAL" | "ENTERPRISE" | "ORGANIZATION";
|
|
258
|
+
sourceId: string;
|
|
259
|
+
candidateId: string;
|
|
260
|
+
organizationId?: number | undefined;
|
|
261
|
+
skillPath?: string | undefined;
|
|
262
|
+
featured?: boolean | undefined;
|
|
263
|
+
tags?: string[] | undefined;
|
|
264
|
+
}>;
|
|
265
|
+
export type SkillFavoriteCreateInput = z.infer<typeof skillFavoriteCreateInputSchema>;
|
|
266
|
+
export declare const skillFavoritePresentationInputSchema: z.ZodEffects<z.ZodObject<{
|
|
267
|
+
featured: z.ZodBoolean;
|
|
268
|
+
tags: z.ZodArray<z.ZodString, "many">;
|
|
269
|
+
}, "strict", z.ZodTypeAny, {
|
|
270
|
+
featured: boolean;
|
|
271
|
+
tags: string[];
|
|
272
|
+
}, {
|
|
273
|
+
featured: boolean;
|
|
274
|
+
tags: string[];
|
|
275
|
+
}>, {
|
|
276
|
+
featured: boolean;
|
|
277
|
+
tags: string[];
|
|
278
|
+
}, {
|
|
279
|
+
featured: boolean;
|
|
280
|
+
tags: string[];
|
|
281
|
+
}>;
|
|
282
|
+
export type SkillFavoritePresentationInput = z.infer<typeof skillFavoritePresentationInputSchema>;
|
|
283
|
+
export declare const skillInstallMetadataSchema: z.ZodObject<{
|
|
284
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
285
|
+
favoriteId: z.ZodString;
|
|
286
|
+
versionId: z.ZodString;
|
|
287
|
+
commitSha: z.ZodString;
|
|
288
|
+
contentHash: z.ZodString;
|
|
289
|
+
installedAt: z.ZodNumber;
|
|
290
|
+
}, "strict", z.ZodTypeAny, {
|
|
291
|
+
commitSha: string;
|
|
292
|
+
contentHash: string;
|
|
293
|
+
schemaVersion: 1;
|
|
294
|
+
favoriteId: string;
|
|
295
|
+
versionId: string;
|
|
296
|
+
installedAt: number;
|
|
297
|
+
}, {
|
|
298
|
+
commitSha: string;
|
|
299
|
+
contentHash: string;
|
|
300
|
+
schemaVersion: 1;
|
|
301
|
+
favoriteId: string;
|
|
302
|
+
versionId: string;
|
|
303
|
+
installedAt: number;
|
|
304
|
+
}>;
|
|
305
|
+
export type SkillInstallMetadata = z.infer<typeof skillInstallMetadataSchema>;
|
|
306
|
+
export declare const skillInstallStatusSchema: z.ZodEnum<["CURRENT", "UPDATE_AVAILABLE", "UNKNOWN_VERSION", "PARTIAL", "INVALID", "GIT_EXCLUDE_BROKEN", "INVALID_LINK"]>;
|
|
307
|
+
export declare const skillCompatibilityModeSchema: z.ZodEnum<["SYMLINK", "JUNCTION", "MANAGED_COPY", "UNAVAILABLE"]>;
|
|
308
|
+
export declare const installedSkillSchema: z.ZodObject<{
|
|
309
|
+
name: z.ZodString;
|
|
310
|
+
description: z.ZodString;
|
|
311
|
+
status: z.ZodEnum<["CURRENT", "UPDATE_AVAILABLE", "UNKNOWN_VERSION", "PARTIAL", "INVALID", "GIT_EXCLUDE_BROKEN", "INVALID_LINK"]>;
|
|
312
|
+
installedCommitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
313
|
+
favoriteCurrentCommitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
314
|
+
}, "strict", z.ZodTypeAny, {
|
|
315
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
316
|
+
name: string;
|
|
317
|
+
description: string;
|
|
318
|
+
installedCommitSha?: string | null | undefined;
|
|
319
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
320
|
+
}, {
|
|
321
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
322
|
+
name: string;
|
|
323
|
+
description: string;
|
|
324
|
+
installedCommitSha?: string | null | undefined;
|
|
325
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
326
|
+
}>;
|
|
327
|
+
export declare const skillTargetInspectionSchema: z.ZodObject<{
|
|
328
|
+
targetKind: z.ZodEnum<["NODE", "WORKSPACE"]>;
|
|
329
|
+
compatibilityMode: z.ZodEnum<["SYMLINK", "JUNCTION", "MANAGED_COPY", "UNAVAILABLE"]>;
|
|
330
|
+
skills: z.ZodArray<z.ZodObject<{
|
|
331
|
+
name: z.ZodString;
|
|
332
|
+
description: z.ZodString;
|
|
333
|
+
status: z.ZodEnum<["CURRENT", "UPDATE_AVAILABLE", "UNKNOWN_VERSION", "PARTIAL", "INVALID", "GIT_EXCLUDE_BROKEN", "INVALID_LINK"]>;
|
|
334
|
+
installedCommitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
335
|
+
favoriteCurrentCommitSha: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
336
|
+
}, "strict", z.ZodTypeAny, {
|
|
337
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
338
|
+
name: string;
|
|
339
|
+
description: string;
|
|
340
|
+
installedCommitSha?: string | null | undefined;
|
|
341
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
342
|
+
}, {
|
|
343
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
344
|
+
name: string;
|
|
345
|
+
description: string;
|
|
346
|
+
installedCommitSha?: string | null | undefined;
|
|
347
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
348
|
+
}>, "many">;
|
|
349
|
+
}, "strict", z.ZodTypeAny, {
|
|
350
|
+
targetKind: "NODE" | "WORKSPACE";
|
|
351
|
+
compatibilityMode: "SYMLINK" | "JUNCTION" | "MANAGED_COPY" | "UNAVAILABLE";
|
|
352
|
+
skills: {
|
|
353
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
354
|
+
name: string;
|
|
355
|
+
description: string;
|
|
356
|
+
installedCommitSha?: string | null | undefined;
|
|
357
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
358
|
+
}[];
|
|
359
|
+
}, {
|
|
360
|
+
targetKind: "NODE" | "WORKSPACE";
|
|
361
|
+
compatibilityMode: "SYMLINK" | "JUNCTION" | "MANAGED_COPY" | "UNAVAILABLE";
|
|
362
|
+
skills: {
|
|
363
|
+
status: "CURRENT" | "UPDATE_AVAILABLE" | "UNKNOWN_VERSION" | "PARTIAL" | "INVALID" | "GIT_EXCLUDE_BROKEN" | "INVALID_LINK";
|
|
364
|
+
name: string;
|
|
365
|
+
description: string;
|
|
366
|
+
installedCommitSha?: string | null | undefined;
|
|
367
|
+
favoriteCurrentCommitSha?: string | null | undefined;
|
|
368
|
+
}[];
|
|
369
|
+
}>;
|
|
370
|
+
export type SkillTargetInspection = z.infer<typeof skillTargetInspectionSchema>;
|
package/dist/skill.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const skillScopeSchema = z.enum(['ENTERPRISE', 'ORGANIZATION', 'PERSONAL']);
|
|
3
|
+
export const skillSourceKindSchema = z.enum(['SKILLS_SH', 'REPOSITORY']);
|
|
4
|
+
const httpsLocatorSchema = z
|
|
5
|
+
.string()
|
|
6
|
+
.min(1)
|
|
7
|
+
.max(2048)
|
|
8
|
+
.refine((value) => {
|
|
9
|
+
try {
|
|
10
|
+
const url = new URL(value);
|
|
11
|
+
return url.protocol === 'https:' && url.username === '' && url.password === '';
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}, 'locator must be an HTTPS URL without userinfo');
|
|
17
|
+
const sshGitLocatorSchema = z
|
|
18
|
+
.string()
|
|
19
|
+
.min(1)
|
|
20
|
+
.max(2048)
|
|
21
|
+
.regex(/^git@[A-Za-z0-9.-]+:[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)+(?:\.git)?$/u, 'locator must be an HTTPS URL or git@ SSH repository');
|
|
22
|
+
export const skillSourceInputSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
kind: skillSourceKindSchema,
|
|
25
|
+
scope: skillScopeSchema,
|
|
26
|
+
organizationId: z.number().int().positive().optional(),
|
|
27
|
+
name: z.string().trim().min(1).max(128),
|
|
28
|
+
locator: z.union([z.literal('skills.sh'), httpsLocatorSchema, sshGitLocatorSchema]),
|
|
29
|
+
enabled: z.boolean().optional()
|
|
30
|
+
})
|
|
31
|
+
.strict()
|
|
32
|
+
.superRefine((source, context) => {
|
|
33
|
+
if ((source.scope === 'ORGANIZATION') !== (source.organizationId !== undefined))
|
|
34
|
+
context.addIssue({ code: 'custom', message: 'organizationId must match scope' });
|
|
35
|
+
if (source.kind === 'SKILLS_SH' && source.locator !== 'skills.sh')
|
|
36
|
+
context.addIssue({ code: 'custom', message: 'skills.sh source locator is fixed' });
|
|
37
|
+
if (source.kind === 'REPOSITORY' && source.locator === 'skills.sh')
|
|
38
|
+
context.addIssue({
|
|
39
|
+
code: 'custom',
|
|
40
|
+
message: 'repository source requires repository locator'
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
export const skillSourceSchema = skillSourceInputSchema.and(z
|
|
44
|
+
.object({
|
|
45
|
+
id: z.string().min(1).max(128),
|
|
46
|
+
ownerUserId: z.number().int().positive().optional(),
|
|
47
|
+
builtIn: z.boolean(),
|
|
48
|
+
status: z.enum(['READY', 'DEGRADED', 'DISABLED']),
|
|
49
|
+
lastErrorCode: z.string().min(1).max(80).nullable(),
|
|
50
|
+
createdAt: z.number().int().nonnegative(),
|
|
51
|
+
updatedAt: z.number().int().nonnegative()
|
|
52
|
+
})
|
|
53
|
+
.strict());
|
|
54
|
+
export const skillVersionSummarySchema = z
|
|
55
|
+
.object({
|
|
56
|
+
id: z.string().min(1).max(128),
|
|
57
|
+
commitSha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
58
|
+
contentHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
59
|
+
createdAt: z.number().int().nonnegative()
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
const normalizedSkillNameSchema = z
|
|
63
|
+
.string()
|
|
64
|
+
.min(1)
|
|
65
|
+
.max(128)
|
|
66
|
+
.regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
|
|
67
|
+
const skillTagSchema = z.string().trim().min(1).max(32);
|
|
68
|
+
const skillPathSchema = z.union([
|
|
69
|
+
z.literal('.'),
|
|
70
|
+
z
|
|
71
|
+
.string()
|
|
72
|
+
.min(1)
|
|
73
|
+
.max(1024)
|
|
74
|
+
.regex(/^(?!\/)(?!.*(?:^|\/)\.\.?(?:\/|$))[^\\\0]+$/)
|
|
75
|
+
]);
|
|
76
|
+
export const skillFavoriteSchema = z
|
|
77
|
+
.object({
|
|
78
|
+
id: z.string().min(1).max(128),
|
|
79
|
+
sourceId: z.string().min(1).max(128),
|
|
80
|
+
scope: skillScopeSchema,
|
|
81
|
+
ownerOrganizationId: z.number().int().positive().optional(),
|
|
82
|
+
ownerUserId: z.number().int().positive().optional(),
|
|
83
|
+
repositoryIdentity: z.string().min(1).max(512),
|
|
84
|
+
skillPath: skillPathSchema,
|
|
85
|
+
normalizedName: normalizedSkillNameSchema,
|
|
86
|
+
featured: z.boolean(),
|
|
87
|
+
tags: z.array(skillTagSchema).max(10),
|
|
88
|
+
currentVersion: skillVersionSummarySchema,
|
|
89
|
+
createdAt: z.number().int().nonnegative(),
|
|
90
|
+
updatedAt: z.number().int().nonnegative()
|
|
91
|
+
})
|
|
92
|
+
.strict()
|
|
93
|
+
.superRefine((favorite, context) => {
|
|
94
|
+
if ((favorite.scope === 'ORGANIZATION') !== (favorite.ownerOrganizationId !== undefined))
|
|
95
|
+
context.addIssue({ code: 'custom', message: 'organization owner must match scope' });
|
|
96
|
+
if ((favorite.scope === 'PERSONAL') !== (favorite.ownerUserId !== undefined))
|
|
97
|
+
context.addIssue({ code: 'custom', message: 'user owner must match scope' });
|
|
98
|
+
});
|
|
99
|
+
export const skillFavoriteCreateInputSchema = z
|
|
100
|
+
.object({
|
|
101
|
+
sourceId: z.string().min(1).max(128),
|
|
102
|
+
candidateId: z.string().min(1).max(1024),
|
|
103
|
+
skillPath: skillPathSchema.optional(),
|
|
104
|
+
scope: skillScopeSchema,
|
|
105
|
+
organizationId: z.number().int().positive().optional(),
|
|
106
|
+
featured: z.boolean().optional(),
|
|
107
|
+
tags: z.array(skillTagSchema).max(10).optional()
|
|
108
|
+
})
|
|
109
|
+
.strict()
|
|
110
|
+
.superRefine((favorite, context) => {
|
|
111
|
+
if ((favorite.scope === 'ORGANIZATION') !== (favorite.organizationId !== undefined))
|
|
112
|
+
context.addIssue({ code: 'custom', message: 'organizationId must match scope' });
|
|
113
|
+
const tags = favorite.tags ?? [];
|
|
114
|
+
if (new Set(tags.map((tag) => tag.toLocaleLowerCase())).size !== tags.length)
|
|
115
|
+
context.addIssue({ code: 'custom', message: 'tags must be unique' });
|
|
116
|
+
});
|
|
117
|
+
export const skillFavoritePresentationInputSchema = z
|
|
118
|
+
.object({
|
|
119
|
+
featured: z.boolean(),
|
|
120
|
+
tags: z.array(skillTagSchema).max(10)
|
|
121
|
+
})
|
|
122
|
+
.strict()
|
|
123
|
+
.superRefine((favorite, context) => {
|
|
124
|
+
if (new Set(favorite.tags.map((tag) => tag.toLocaleLowerCase())).size !== favorite.tags.length)
|
|
125
|
+
context.addIssue({ code: 'custom', message: 'tags must be unique' });
|
|
126
|
+
});
|
|
127
|
+
export const skillInstallMetadataSchema = z
|
|
128
|
+
.object({
|
|
129
|
+
schemaVersion: z.literal(1),
|
|
130
|
+
favoriteId: z.string().min(1).max(128),
|
|
131
|
+
versionId: z.string().min(1).max(128),
|
|
132
|
+
commitSha: z.string().regex(/^[0-9a-f]{40}$/),
|
|
133
|
+
contentHash: z.string().regex(/^[0-9a-f]{64}$/),
|
|
134
|
+
installedAt: z.number().int().nonnegative()
|
|
135
|
+
})
|
|
136
|
+
.strict();
|
|
137
|
+
export const skillInstallStatusSchema = z.enum([
|
|
138
|
+
'CURRENT',
|
|
139
|
+
'UPDATE_AVAILABLE',
|
|
140
|
+
'UNKNOWN_VERSION',
|
|
141
|
+
'PARTIAL',
|
|
142
|
+
'INVALID',
|
|
143
|
+
'GIT_EXCLUDE_BROKEN',
|
|
144
|
+
'INVALID_LINK'
|
|
145
|
+
]);
|
|
146
|
+
export const skillCompatibilityModeSchema = z.enum([
|
|
147
|
+
'SYMLINK',
|
|
148
|
+
'JUNCTION',
|
|
149
|
+
'MANAGED_COPY',
|
|
150
|
+
'UNAVAILABLE'
|
|
151
|
+
]);
|
|
152
|
+
export const installedSkillSchema = z
|
|
153
|
+
.object({
|
|
154
|
+
name: normalizedSkillNameSchema,
|
|
155
|
+
description: z.string().max(4096),
|
|
156
|
+
status: skillInstallStatusSchema,
|
|
157
|
+
installedCommitSha: z
|
|
158
|
+
.string()
|
|
159
|
+
.regex(/^[0-9a-f]{40}$/)
|
|
160
|
+
.nullable()
|
|
161
|
+
.optional(),
|
|
162
|
+
favoriteCurrentCommitSha: z
|
|
163
|
+
.string()
|
|
164
|
+
.regex(/^[0-9a-f]{40}$/)
|
|
165
|
+
.nullable()
|
|
166
|
+
.optional()
|
|
167
|
+
})
|
|
168
|
+
.strict();
|
|
169
|
+
export const skillTargetInspectionSchema = z
|
|
170
|
+
.object({
|
|
171
|
+
targetKind: z.enum(['NODE', 'WORKSPACE']),
|
|
172
|
+
compatibilityMode: skillCompatibilityModeSchema,
|
|
173
|
+
skills: z.array(installedSkillSchema).max(1000)
|
|
174
|
+
})
|
|
175
|
+
.strict();
|