@perstack/api-client 0.0.35 → 0.0.36
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 +438 -0
- package/dist/index.js +957 -0
- package/dist/index.js.map +1 -0
- package/package.json +6 -7
- package/dist/v1/index.d.ts +0 -4043
- package/dist/v1/index.js +0 -1701
- package/dist/v1/index.js.map +0 -1
package/dist/v1/index.js
DELETED
|
@@ -1,1701 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { maxOrganizationNameLength, organizationNameRegex, maxSkillNameLength, packageWithVersionRegex, mcpStdioSkillSchema, maxEnvNameLength, envNameRegex, maxSkillToolNameLength, maxSkillRuleLength, maxSkillDescriptionLength, mcpSseSkillSchema, maxSkillEndpointLength, interactiveSkillSchema, urlSafeRegex, maxSkillInputJsonSchemaLength, maxExpertVersionTagLength, tagNameRegex, expertVersionRegex, expertSchema, maxExpertDescriptionLength, maxExpertNameLength, expertNameRegex, maxExpertKeyLength, expertKeyRegex, maxExpertInstructionLength, messagePartSchema, checkpointSchema, usageSchema, toolResultSchema, toolCallSchema, messageSchema, instructionMessageSchema, userMessageSchema, toolMessageSchema, maxCheckpointToolCallIdLength, stepSchema } from '@perstack/core';
|
|
3
|
-
|
|
4
|
-
// v1/api-error.ts
|
|
5
|
-
var ApiError = class extends Error {
|
|
6
|
-
constructor(responseText) {
|
|
7
|
-
let payload = null;
|
|
8
|
-
try {
|
|
9
|
-
payload = JSON.parse(responseText);
|
|
10
|
-
} catch {
|
|
11
|
-
}
|
|
12
|
-
const code = payload?.code ?? 500;
|
|
13
|
-
const error = payload?.error ?? "Unknown error";
|
|
14
|
-
const reason = payload?.reason ?? responseText;
|
|
15
|
-
super(`${code} ${error}: ${reason}`);
|
|
16
|
-
this.name = new.target.name;
|
|
17
|
-
this.code = code;
|
|
18
|
-
this.error = error;
|
|
19
|
-
this.reason = reason;
|
|
20
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
-
if (typeof Error.captureStackTrace === "function") {
|
|
22
|
-
Error.captureStackTrace(this, new.target);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
code;
|
|
26
|
-
error;
|
|
27
|
-
reason;
|
|
28
|
-
};
|
|
29
|
-
var apiOrganizationStatusSchema = z.union([
|
|
30
|
-
z.literal("active"),
|
|
31
|
-
z.literal("inactive"),
|
|
32
|
-
z.literal("deleted")
|
|
33
|
-
]);
|
|
34
|
-
var apiOrganizationTypeSchema = z.union([
|
|
35
|
-
z.literal("personal"),
|
|
36
|
-
z.literal("personalPlus"),
|
|
37
|
-
z.literal("team"),
|
|
38
|
-
z.literal("serviceAdmin")
|
|
39
|
-
]);
|
|
40
|
-
var apiOrganizationSchema = z.object({
|
|
41
|
-
type: z.literal("organization"),
|
|
42
|
-
id: z.cuid2(),
|
|
43
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
44
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
45
|
-
name: z.string().min(1, "Name is required.").max(maxOrganizationNameLength, "Name is too long.").regex(organizationNameRegex, "Invalid name format. (e.g. my-organization)").optional(),
|
|
46
|
-
nameChangedAt: z.date().optional(),
|
|
47
|
-
status: apiOrganizationStatusSchema,
|
|
48
|
-
organizationType: apiOrganizationTypeSchema,
|
|
49
|
-
maxApplications: z.number().min(0),
|
|
50
|
-
maxApiKeys: z.number().min(0),
|
|
51
|
-
maxStudioExperts: z.number().min(0)
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
// v1/schemas/application.ts
|
|
55
|
-
var apiApplicationStatusSchema = z.union([
|
|
56
|
-
z.literal("active"),
|
|
57
|
-
z.literal("inactive"),
|
|
58
|
-
z.literal("deleted")
|
|
59
|
-
]);
|
|
60
|
-
var apiApplicationSchema = z.object({
|
|
61
|
-
type: z.literal("application"),
|
|
62
|
-
id: z.cuid2(),
|
|
63
|
-
organizationId: z.cuid2(),
|
|
64
|
-
organization: apiOrganizationSchema,
|
|
65
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
66
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
67
|
-
name: z.string().min(1).max(255),
|
|
68
|
-
status: apiApplicationStatusSchema
|
|
69
|
-
});
|
|
70
|
-
var apiRuntimeVersionSchema = z.enum(["v1.0"]);
|
|
71
|
-
var apiSkillNameSchema = z.string().min(1, "Skill name is required.").max(maxSkillNameLength, "Skill name is too long.").regex(packageWithVersionRegex, "Invalid package name or version.");
|
|
72
|
-
var apiMcpStdioSkillCommandSchema = z.enum(["npx", "uvx"]);
|
|
73
|
-
var apiMcpStdioSkillSchema = mcpStdioSkillSchema.omit({ name: true, command: true, args: true, packageName: true, lazyInit: true }).extend({
|
|
74
|
-
description: z.string().min(1, "Description is required.").max(maxSkillDescriptionLength, "Description is too long"),
|
|
75
|
-
rule: z.string().max(maxSkillRuleLength, "Rule is too long").optional(),
|
|
76
|
-
pick: z.array(z.string().max(maxSkillToolNameLength, "Tool name is too long")).optional(),
|
|
77
|
-
omit: z.array(z.string().max(maxSkillToolNameLength, "Tool name is too long")).optional(),
|
|
78
|
-
command: apiMcpStdioSkillCommandSchema,
|
|
79
|
-
packageName: z.string().min(1, "Package name is required.").max(maxSkillNameLength, "Package name is too long.").regex(packageWithVersionRegex, "Invalid package name or version."),
|
|
80
|
-
requiredEnv: z.array(
|
|
81
|
-
z.string().max(maxEnvNameLength, "Environment variable name is too long").regex(envNameRegex, "Invalid environment variable name.")
|
|
82
|
-
).optional()
|
|
83
|
-
});
|
|
84
|
-
var apiMcpSseSkillSchema = mcpSseSkillSchema.omit({ name: true }).extend({
|
|
85
|
-
description: z.string().min(1, "Description is required.").max(maxSkillDescriptionLength, "Description is too long"),
|
|
86
|
-
rule: z.string().max(maxSkillRuleLength, "Rule is too long").optional(),
|
|
87
|
-
pick: z.array(z.string().max(maxSkillToolNameLength, "Tool name is too long")).optional(),
|
|
88
|
-
omit: z.array(z.string().max(maxSkillToolNameLength, "Tool name is too long")).optional(),
|
|
89
|
-
endpoint: z.string().min(1, "Endpoint is required.").max(maxSkillEndpointLength, "Endpoint is too long")
|
|
90
|
-
});
|
|
91
|
-
var apiInteractiveSkillSchema = interactiveSkillSchema.omit({ name: true, tools: true }).extend({
|
|
92
|
-
description: z.string().min(1, "Description is required.").max(maxSkillDescriptionLength, "Description is too long"),
|
|
93
|
-
rule: z.string().max(maxSkillRuleLength, "Rule is too long").optional(),
|
|
94
|
-
tools: z.record(
|
|
95
|
-
z.string().min(1, "Tool name is required.").max(maxSkillToolNameLength, "Tool name is too long").regex(urlSafeRegex, "Invalid tool name."),
|
|
96
|
-
z.object({
|
|
97
|
-
description: z.string().min(1, "Description is required.").max(maxSkillDescriptionLength, "Description is too long"),
|
|
98
|
-
inputJsonSchema: z.string().min(1, "Input JSON schema is required.").max(maxSkillInputJsonSchemaLength, "Input JSON schema is too long")
|
|
99
|
-
})
|
|
100
|
-
)
|
|
101
|
-
});
|
|
102
|
-
var apiSkillSchema = z.discriminatedUnion("type", [
|
|
103
|
-
apiMcpStdioSkillSchema,
|
|
104
|
-
apiMcpSseSkillSchema,
|
|
105
|
-
apiInteractiveSkillSchema
|
|
106
|
-
]);
|
|
107
|
-
|
|
108
|
-
// v1/schemas/expert.ts
|
|
109
|
-
var apiTagNameSchema = z.string().pipe(z.string().min(1, "Tag is required.")).pipe(z.string().max(maxExpertVersionTagLength, "Tag is too long.")).pipe(z.string().regex(tagNameRegex, "Invalid tag format. (e.g. latest)"));
|
|
110
|
-
var apiExpertVersionSchema = z.string().pipe(z.string().min(1, "Version is required.")).pipe(z.string().max(maxExpertVersionTagLength, "Version is too long.")).pipe(z.string().regex(expertVersionRegex, "Invalid version format. (e.g. 1.0.0)"));
|
|
111
|
-
var apiMetadataSchema = z.object({
|
|
112
|
-
id: z.cuid2(),
|
|
113
|
-
minRuntimeVersion: apiRuntimeVersionSchema,
|
|
114
|
-
owner: z.object({
|
|
115
|
-
name: apiOrganizationSchema.shape.name,
|
|
116
|
-
organizationId: z.cuid2(),
|
|
117
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date))
|
|
118
|
-
}),
|
|
119
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
120
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date))
|
|
121
|
-
});
|
|
122
|
-
var apiBaseExpertSchema = expertSchema.omit({ skills: true, delegates: true, tags: true, instruction: true }).extend({
|
|
123
|
-
key: z.string().pipe(z.string().min(1, "Key is required.")).pipe(z.string().max(maxExpertKeyLength, "Key is too long.")).pipe(z.string().regex(expertKeyRegex, "Invalid key format. (e.g. my-expert)")),
|
|
124
|
-
name: z.string().pipe(z.string().min(1, "Name is required.")).pipe(z.string().max(maxExpertNameLength, "Name is too long.")).pipe(z.string().regex(expertNameRegex, "Invalid name format. (e.g. my-expert)")),
|
|
125
|
-
description: z.string().min(1, "Description is required").max(maxExpertDescriptionLength, "Description must be less than 2048 characters")
|
|
126
|
-
}).merge(apiMetadataSchema);
|
|
127
|
-
var apiRegistryExpertSchema = apiBaseExpertSchema.extend({
|
|
128
|
-
type: z.literal("registryExpert"),
|
|
129
|
-
version: apiExpertVersionSchema,
|
|
130
|
-
status: z.union([z.literal("available"), z.literal("deprecated"), z.literal("disabled")]),
|
|
131
|
-
instruction: z.string().min(1, "Instruction is required").max(maxExpertInstructionLength, "Instruction must be less than 20480 characters"),
|
|
132
|
-
skills: z.record(apiSkillNameSchema, apiSkillSchema),
|
|
133
|
-
delegates: z.array(apiBaseExpertSchema.shape.key),
|
|
134
|
-
tags: z.array(apiTagNameSchema)
|
|
135
|
-
});
|
|
136
|
-
var apiStudioExpertSchema = apiBaseExpertSchema.extend({
|
|
137
|
-
type: z.literal("studioExpert"),
|
|
138
|
-
instruction: z.string().min(1, "Instruction is required").max(maxExpertInstructionLength, "Instruction must be less than 20480 characters"),
|
|
139
|
-
skills: z.record(apiSkillNameSchema, apiSkillSchema),
|
|
140
|
-
delegates: z.array(apiBaseExpertSchema.shape.key),
|
|
141
|
-
forkFrom: apiBaseExpertSchema.shape.key.optional(),
|
|
142
|
-
application: apiApplicationSchema
|
|
143
|
-
});
|
|
144
|
-
var apiExpertDigestSchema = apiBaseExpertSchema.extend({
|
|
145
|
-
type: z.literal("expertDigest"),
|
|
146
|
-
version: apiExpertVersionSchema.optional(),
|
|
147
|
-
tags: z.array(apiTagNameSchema)
|
|
148
|
-
});
|
|
149
|
-
var apiExpertSchema = z.discriminatedUnion("type", [
|
|
150
|
-
apiExpertDigestSchema,
|
|
151
|
-
apiRegistryExpertSchema,
|
|
152
|
-
apiStudioExpertSchema
|
|
153
|
-
]);
|
|
154
|
-
|
|
155
|
-
// v1/registry/experts.ts
|
|
156
|
-
var createRegistryExpertInput = z.object({
|
|
157
|
-
name: apiRegistryExpertSchema.shape.name,
|
|
158
|
-
version: apiRegistryExpertSchema.shape.version,
|
|
159
|
-
minRuntimeVersion: apiRegistryExpertSchema.shape.minRuntimeVersion,
|
|
160
|
-
description: apiRegistryExpertSchema.shape.description,
|
|
161
|
-
instruction: apiRegistryExpertSchema.shape.instruction,
|
|
162
|
-
skills: apiRegistryExpertSchema.shape.skills,
|
|
163
|
-
delegates: apiRegistryExpertSchema.shape.delegates,
|
|
164
|
-
tags: apiRegistryExpertSchema.shape.tags
|
|
165
|
-
});
|
|
166
|
-
var createRegistryExpertResponseSchema = z.object({
|
|
167
|
-
data: z.object({
|
|
168
|
-
expert: apiRegistryExpertSchema
|
|
169
|
-
})
|
|
170
|
-
});
|
|
171
|
-
async function createRegistryExpert(input, client) {
|
|
172
|
-
const { name, version, minRuntimeVersion, description, instruction, skills, delegates, tags } = createRegistryExpertInput.parse(input);
|
|
173
|
-
const endpoint = "/api/registry/v1/experts";
|
|
174
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
175
|
-
method: "POST",
|
|
176
|
-
headers: {
|
|
177
|
-
"Content-Type": "application/json"
|
|
178
|
-
},
|
|
179
|
-
body: JSON.stringify({
|
|
180
|
-
name,
|
|
181
|
-
version,
|
|
182
|
-
minRuntimeVersion,
|
|
183
|
-
description,
|
|
184
|
-
instruction,
|
|
185
|
-
skills,
|
|
186
|
-
delegates,
|
|
187
|
-
tags
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
const { data } = createRegistryExpertResponseSchema.parse(json);
|
|
191
|
-
return {
|
|
192
|
-
expert: data.expert
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
var getRegistryExpertInput = z.object({
|
|
196
|
-
expertKey: apiRegistryExpertSchema.shape.key
|
|
197
|
-
});
|
|
198
|
-
var getRegistryExpertResponseSchema = z.object({
|
|
199
|
-
data: z.object({
|
|
200
|
-
expert: apiRegistryExpertSchema
|
|
201
|
-
})
|
|
202
|
-
});
|
|
203
|
-
async function getRegistryExpert(input, client) {
|
|
204
|
-
const { expertKey } = getRegistryExpertInput.parse(input);
|
|
205
|
-
const endpoint = `/api/registry/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
206
|
-
const json = await client.request(endpoint, {
|
|
207
|
-
method: "GET",
|
|
208
|
-
headers: {
|
|
209
|
-
"Content-Type": "application/json"
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
const { data } = getRegistryExpertResponseSchema.parse(json);
|
|
213
|
-
return {
|
|
214
|
-
expert: data.expert
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
var getRegistryExpertsInput = z.object({
|
|
218
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
219
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
220
|
-
sort: z.string().optional(),
|
|
221
|
-
order: z.string().optional(),
|
|
222
|
-
filter: z.string().optional(),
|
|
223
|
-
organizationId: z.string().optional()
|
|
224
|
-
});
|
|
225
|
-
var getRegistryExpertsResponseSchema = z.object({
|
|
226
|
-
data: z.object({
|
|
227
|
-
experts: z.array(apiRegistryExpertSchema)
|
|
228
|
-
}),
|
|
229
|
-
meta: z.object({
|
|
230
|
-
total: z.number(),
|
|
231
|
-
take: z.number(),
|
|
232
|
-
skip: z.number()
|
|
233
|
-
})
|
|
234
|
-
});
|
|
235
|
-
async function getRegistryExperts(input, client) {
|
|
236
|
-
const {
|
|
237
|
-
sort,
|
|
238
|
-
order,
|
|
239
|
-
take: takeParam,
|
|
240
|
-
skip: skipParam,
|
|
241
|
-
filter,
|
|
242
|
-
organizationId
|
|
243
|
-
} = getRegistryExpertsInput.parse(input);
|
|
244
|
-
const url = new URL("/api/registry/v1/experts", client.baseUrl);
|
|
245
|
-
if (takeParam) url.searchParams.set("take", takeParam.toString());
|
|
246
|
-
if (skipParam) url.searchParams.set("skip", skipParam.toString());
|
|
247
|
-
if (sort) url.searchParams.set("sort", sort);
|
|
248
|
-
if (order) url.searchParams.set("order", order);
|
|
249
|
-
if (filter) url.searchParams.set("filter", filter);
|
|
250
|
-
if (organizationId) url.searchParams.set("organizationId", organizationId);
|
|
251
|
-
const endpoint = url.toString();
|
|
252
|
-
const json = await client.request(endpoint, {
|
|
253
|
-
method: "GET",
|
|
254
|
-
headers: {
|
|
255
|
-
"Content-Type": "application/json"
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
const { data, meta } = getRegistryExpertsResponseSchema.parse(json);
|
|
259
|
-
return {
|
|
260
|
-
experts: data.experts,
|
|
261
|
-
total: meta.total,
|
|
262
|
-
take: meta.take,
|
|
263
|
-
skip: meta.skip
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
var getRegistryExpertVersionsInput = z.object({
|
|
267
|
-
expertKey: apiRegistryExpertSchema.shape.key
|
|
268
|
-
});
|
|
269
|
-
var getRegistryExpertVersionsResponseSchema = z.object({
|
|
270
|
-
data: z.object({
|
|
271
|
-
versions: z.array(apiExpertDigestSchema),
|
|
272
|
-
latest: z.string()
|
|
273
|
-
}),
|
|
274
|
-
meta: z.object({
|
|
275
|
-
total: z.number()
|
|
276
|
-
})
|
|
277
|
-
});
|
|
278
|
-
async function getRegistryExpertVersions(input, client) {
|
|
279
|
-
const { expertKey } = getRegistryExpertVersionsInput.parse(input);
|
|
280
|
-
const endpoint = `/api/registry/v1/experts/${encodeURIComponent(expertKey)}/versions`;
|
|
281
|
-
const json = await client.request(endpoint, {
|
|
282
|
-
method: "GET",
|
|
283
|
-
headers: {
|
|
284
|
-
"Content-Type": "application/json"
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
const { data, meta } = getRegistryExpertVersionsResponseSchema.parse(json);
|
|
288
|
-
return {
|
|
289
|
-
versions: data.versions,
|
|
290
|
-
latest: data.latest,
|
|
291
|
-
total: meta.total
|
|
292
|
-
};
|
|
293
|
-
}
|
|
294
|
-
var updateRegistryExpertInput = z.object({
|
|
295
|
-
expertKey: apiRegistryExpertSchema.shape.key,
|
|
296
|
-
status: apiRegistryExpertSchema.shape.status.optional(),
|
|
297
|
-
tags: apiRegistryExpertSchema.shape.tags.optional()
|
|
298
|
-
});
|
|
299
|
-
var updateRegistryExpertResponseSchema = z.object({
|
|
300
|
-
data: z.object({
|
|
301
|
-
expert: apiRegistryExpertSchema
|
|
302
|
-
})
|
|
303
|
-
});
|
|
304
|
-
async function updateRegistryExpert(input, client) {
|
|
305
|
-
const { expertKey, status, tags } = updateRegistryExpertInput.parse(input);
|
|
306
|
-
const endpoint = `/api/registry/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
307
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
308
|
-
method: "POST",
|
|
309
|
-
headers: {
|
|
310
|
-
"Content-Type": "application/json"
|
|
311
|
-
},
|
|
312
|
-
body: JSON.stringify({
|
|
313
|
-
status,
|
|
314
|
-
tags
|
|
315
|
-
})
|
|
316
|
-
});
|
|
317
|
-
const { data } = updateRegistryExpertResponseSchema.parse(json);
|
|
318
|
-
return {
|
|
319
|
-
expert: data.expert
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
var deleteRegistryExpertInput = z.object({
|
|
323
|
-
expertKey: apiRegistryExpertSchema.shape.key
|
|
324
|
-
});
|
|
325
|
-
async function deleteRegistryExpert(input, client) {
|
|
326
|
-
const { expertKey } = deleteRegistryExpertInput.parse(input);
|
|
327
|
-
const endpoint = `/api/registry/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
328
|
-
await client.requestAuthenticated(endpoint, {
|
|
329
|
-
method: "DELETE",
|
|
330
|
-
headers: {
|
|
331
|
-
"Content-Type": "application/json"
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
var apiWorkspaceItemOwnerSchema = z.union([z.literal("user"), z.literal("expert")]);
|
|
336
|
-
var apiWorkspaceItemLifecycleSchema = z.union([
|
|
337
|
-
z.literal("application"),
|
|
338
|
-
z.literal("expertJob")
|
|
339
|
-
]);
|
|
340
|
-
var apiWorkspaceItemPermissionSchema = z.union([
|
|
341
|
-
z.literal("readOnly"),
|
|
342
|
-
z.literal("readWrite")
|
|
343
|
-
]);
|
|
344
|
-
var apiBaseWorkspaceItemSchema = z.object({
|
|
345
|
-
id: z.cuid2(),
|
|
346
|
-
owner: apiWorkspaceItemOwnerSchema,
|
|
347
|
-
lifecycle: apiWorkspaceItemLifecycleSchema,
|
|
348
|
-
permission: apiWorkspaceItemPermissionSchema,
|
|
349
|
-
path: z.string().min(1).max(1024),
|
|
350
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
351
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date))
|
|
352
|
-
});
|
|
353
|
-
var apiWorkspaceItemDirectorySchema = apiBaseWorkspaceItemSchema.extend({
|
|
354
|
-
type: z.literal("workspaceItemDirectory")
|
|
355
|
-
});
|
|
356
|
-
var apiWorkspaceItemFileSchema = apiBaseWorkspaceItemSchema.extend({
|
|
357
|
-
type: z.literal("workspaceItemFile"),
|
|
358
|
-
key: z.string().min(1).max(1024),
|
|
359
|
-
mimeType: z.string().max(256),
|
|
360
|
-
size: z.number().min(0)
|
|
361
|
-
});
|
|
362
|
-
var apiWorkspaceItemSchema = z.discriminatedUnion("type", [
|
|
363
|
-
apiWorkspaceItemDirectorySchema,
|
|
364
|
-
apiWorkspaceItemFileSchema
|
|
365
|
-
]);
|
|
366
|
-
|
|
367
|
-
// v1/schemas/checkpoint.ts
|
|
368
|
-
var apiCheckpointStatusSchema = z.union([
|
|
369
|
-
z.literal("init"),
|
|
370
|
-
z.literal("proceeding"),
|
|
371
|
-
z.literal("completed"),
|
|
372
|
-
z.literal("stoppedByInteractiveTool"),
|
|
373
|
-
z.literal("stoppedByDelegate"),
|
|
374
|
-
z.literal("stoppedByExceededMaxSteps"),
|
|
375
|
-
z.literal("stoppedByError")
|
|
376
|
-
]);
|
|
377
|
-
var apiBaseCheckpointActionSchema = z.object({ error: z.string().optional() });
|
|
378
|
-
var apiCheckpointActionRetrySchema = apiBaseCheckpointActionSchema.extend({
|
|
379
|
-
type: z.literal("retry"),
|
|
380
|
-
error: z.string(),
|
|
381
|
-
message: z.string()
|
|
382
|
-
});
|
|
383
|
-
var apiCheckpointActionAttemptCompletionSchema = apiBaseCheckpointActionSchema.extend({
|
|
384
|
-
type: z.literal("attemptCompletion"),
|
|
385
|
-
result: z.string()
|
|
386
|
-
});
|
|
387
|
-
var apiCheckpointActionThinkSchema = apiBaseCheckpointActionSchema.extend({
|
|
388
|
-
type: z.literal("think"),
|
|
389
|
-
thought: z.string()
|
|
390
|
-
});
|
|
391
|
-
var apiCheckpointActionTodoSchema = apiBaseCheckpointActionSchema.extend({
|
|
392
|
-
type: z.literal("todo"),
|
|
393
|
-
newTodos: z.array(z.string()),
|
|
394
|
-
completedTodos: z.array(z.number()),
|
|
395
|
-
todos: z.array(z.object({ id: z.number(), title: z.string(), completed: z.boolean() }))
|
|
396
|
-
});
|
|
397
|
-
var apiCheckpointActionReadImageFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
398
|
-
type: z.literal("readImageFile"),
|
|
399
|
-
path: z.string(),
|
|
400
|
-
mimeType: z.string().optional(),
|
|
401
|
-
size: z.number().optional()
|
|
402
|
-
});
|
|
403
|
-
var apiCheckpointActionReadPdfFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
404
|
-
type: z.literal("readPdfFile"),
|
|
405
|
-
path: z.string(),
|
|
406
|
-
mimeType: z.string().optional(),
|
|
407
|
-
size: z.number().optional()
|
|
408
|
-
});
|
|
409
|
-
var apiCheckpointActionReadTextFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
410
|
-
type: z.literal("readTextFile"),
|
|
411
|
-
path: z.string(),
|
|
412
|
-
content: z.string(),
|
|
413
|
-
from: z.number().optional(),
|
|
414
|
-
to: z.number().optional()
|
|
415
|
-
});
|
|
416
|
-
var apiCheckpointActionEditTextFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
417
|
-
type: z.literal("editTextFile"),
|
|
418
|
-
path: z.string(),
|
|
419
|
-
newText: z.string().optional(),
|
|
420
|
-
oldText: z.string().optional()
|
|
421
|
-
});
|
|
422
|
-
var apiCheckpointActionAppendTextFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
423
|
-
type: z.literal("appendTextFile"),
|
|
424
|
-
path: z.string(),
|
|
425
|
-
text: z.string()
|
|
426
|
-
});
|
|
427
|
-
var apiCheckpointActionDeleteFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
428
|
-
type: z.literal("deleteFile"),
|
|
429
|
-
path: z.string()
|
|
430
|
-
});
|
|
431
|
-
var apiCheckpointActionMoveFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
432
|
-
type: z.literal("moveFile"),
|
|
433
|
-
source: z.string(),
|
|
434
|
-
destination: z.string()
|
|
435
|
-
});
|
|
436
|
-
var apiCheckpointActionGetFileInfoSchema = apiBaseCheckpointActionSchema.extend({
|
|
437
|
-
type: z.literal("getFileInfo"),
|
|
438
|
-
path: z.string(),
|
|
439
|
-
exists: z.boolean(),
|
|
440
|
-
absolutePath: z.string(),
|
|
441
|
-
name: z.string(),
|
|
442
|
-
directory: z.string(),
|
|
443
|
-
extension: z.string().optional(),
|
|
444
|
-
mimeType: z.string().optional(),
|
|
445
|
-
size: z.number(),
|
|
446
|
-
sizeFormatted: z.string(),
|
|
447
|
-
created: z.date(),
|
|
448
|
-
modified: z.date(),
|
|
449
|
-
accessed: z.date(),
|
|
450
|
-
permissions: z.object({ readable: z.boolean(), writable: z.boolean(), executable: z.boolean() }),
|
|
451
|
-
workspaceItem: apiWorkspaceItemSchema.optional()
|
|
452
|
-
});
|
|
453
|
-
var apiCheckpointActionWriteTextFileSchema = apiBaseCheckpointActionSchema.extend({
|
|
454
|
-
type: z.literal("writeTextFile"),
|
|
455
|
-
path: z.string(),
|
|
456
|
-
text: z.string()
|
|
457
|
-
});
|
|
458
|
-
var apiCheckpointActionCreateDirectorySchema = apiBaseCheckpointActionSchema.extend({
|
|
459
|
-
type: z.literal("createDirectory"),
|
|
460
|
-
path: z.string()
|
|
461
|
-
});
|
|
462
|
-
var apiCheckpointActionListDirectorySchema = apiBaseCheckpointActionSchema.extend({
|
|
463
|
-
type: z.literal("listDirectory"),
|
|
464
|
-
path: z.string(),
|
|
465
|
-
items: z.array(
|
|
466
|
-
z.object({
|
|
467
|
-
name: z.string(),
|
|
468
|
-
path: z.string(),
|
|
469
|
-
type: z.union([z.literal("directory"), z.literal("file")]),
|
|
470
|
-
size: z.number(),
|
|
471
|
-
modified: z.date()
|
|
472
|
-
})
|
|
473
|
-
)
|
|
474
|
-
});
|
|
475
|
-
var apiCheckpointActionTestUrlSchema = apiBaseCheckpointActionSchema.extend({
|
|
476
|
-
type: z.literal("testUrl"),
|
|
477
|
-
results: z.array(
|
|
478
|
-
z.object({ url: z.string(), status: z.number(), title: z.string(), description: z.string() })
|
|
479
|
-
)
|
|
480
|
-
});
|
|
481
|
-
var apiCheckpointActionDelegateSchema = apiBaseCheckpointActionSchema.extend({
|
|
482
|
-
type: z.literal("delegate"),
|
|
483
|
-
delegateTo: apiExpertDigestSchema,
|
|
484
|
-
query: z.string()
|
|
485
|
-
});
|
|
486
|
-
var apiCheckpointActionInteractiveTool = apiBaseCheckpointActionSchema.extend({
|
|
487
|
-
type: z.literal("interactiveTool"),
|
|
488
|
-
skillName: z.string().min(1).max(256),
|
|
489
|
-
toolName: z.string().min(1).max(256),
|
|
490
|
-
args: z.record(z.string().min(1).max(256), z.unknown())
|
|
491
|
-
});
|
|
492
|
-
var apiCheckpointActionGeneralToolSchema = apiBaseCheckpointActionSchema.extend({
|
|
493
|
-
type: z.literal("generalTool"),
|
|
494
|
-
skillName: z.string().min(1).max(256),
|
|
495
|
-
toolName: z.string().min(1).max(256),
|
|
496
|
-
args: z.record(z.string().min(1).max(256), z.unknown()),
|
|
497
|
-
result: z.array(messagePartSchema)
|
|
498
|
-
});
|
|
499
|
-
var apiCheckpointActionErrorSchema = apiBaseCheckpointActionSchema.extend({
|
|
500
|
-
type: z.literal("error")
|
|
501
|
-
});
|
|
502
|
-
var apiCheckpointActionSchema = z.discriminatedUnion("type", [
|
|
503
|
-
apiCheckpointActionRetrySchema,
|
|
504
|
-
apiCheckpointActionAttemptCompletionSchema,
|
|
505
|
-
apiCheckpointActionThinkSchema,
|
|
506
|
-
apiCheckpointActionTodoSchema,
|
|
507
|
-
apiCheckpointActionReadImageFileSchema,
|
|
508
|
-
apiCheckpointActionReadPdfFileSchema,
|
|
509
|
-
apiCheckpointActionReadTextFileSchema,
|
|
510
|
-
apiCheckpointActionEditTextFileSchema,
|
|
511
|
-
apiCheckpointActionAppendTextFileSchema,
|
|
512
|
-
apiCheckpointActionDeleteFileSchema,
|
|
513
|
-
apiCheckpointActionMoveFileSchema,
|
|
514
|
-
apiCheckpointActionGetFileInfoSchema,
|
|
515
|
-
apiCheckpointActionWriteTextFileSchema,
|
|
516
|
-
apiCheckpointActionCreateDirectorySchema,
|
|
517
|
-
apiCheckpointActionListDirectorySchema,
|
|
518
|
-
apiCheckpointActionTestUrlSchema,
|
|
519
|
-
apiCheckpointActionDelegateSchema,
|
|
520
|
-
apiCheckpointActionInteractiveTool,
|
|
521
|
-
apiCheckpointActionGeneralToolSchema,
|
|
522
|
-
apiCheckpointActionErrorSchema
|
|
523
|
-
]);
|
|
524
|
-
var apiCheckpointSchema = checkpointSchema.omit({ expert: true }).extend({
|
|
525
|
-
type: z.literal("checkpoint"),
|
|
526
|
-
id: z.cuid2(),
|
|
527
|
-
action: apiCheckpointActionSchema,
|
|
528
|
-
expertJobId: z.cuid2(),
|
|
529
|
-
status: apiCheckpointStatusSchema,
|
|
530
|
-
expert: apiExpertDigestSchema,
|
|
531
|
-
skillName: z.string().min(1).max(maxSkillNameLength).optional(),
|
|
532
|
-
toolName: z.string().min(1).max(maxSkillToolNameLength).optional(),
|
|
533
|
-
delegateTo: z.object({
|
|
534
|
-
expert: apiExpertDigestSchema,
|
|
535
|
-
toolCallId: z.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
536
|
-
toolName: z.string().min(1).max(maxSkillToolNameLength)
|
|
537
|
-
}).optional(),
|
|
538
|
-
delegatedBy: z.object({
|
|
539
|
-
expert: apiExpertDigestSchema,
|
|
540
|
-
toolCallId: z.string().min(1).max(maxCheckpointToolCallIdLength),
|
|
541
|
-
toolName: z.string().min(1).max(maxSkillToolNameLength),
|
|
542
|
-
checkpointId: z.cuid2()
|
|
543
|
-
}).optional(),
|
|
544
|
-
inputMessages: z.array(z.union([instructionMessageSchema, userMessageSchema, toolMessageSchema])).optional(),
|
|
545
|
-
messages: z.array(messageSchema),
|
|
546
|
-
newMessages: z.array(messageSchema),
|
|
547
|
-
toolCall: toolCallSchema.optional(),
|
|
548
|
-
toolResult: toolResultSchema.optional(),
|
|
549
|
-
usage: usageSchema,
|
|
550
|
-
contextWindow: z.number().min(0),
|
|
551
|
-
contextWindowUsage: z.number().min(0),
|
|
552
|
-
startedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
553
|
-
finishedAt: z.iso.datetime().transform((date) => new Date(date)).optional()
|
|
554
|
-
});
|
|
555
|
-
var apiExpertJobStatusSchema = z.union([
|
|
556
|
-
z.literal("queued"),
|
|
557
|
-
z.literal("processing"),
|
|
558
|
-
z.literal("completed"),
|
|
559
|
-
z.literal("requestInteractiveToolResult"),
|
|
560
|
-
z.literal("requestDelegateResult"),
|
|
561
|
-
z.literal("exceededMaxSteps"),
|
|
562
|
-
z.literal("failed"),
|
|
563
|
-
z.literal("canceling"),
|
|
564
|
-
z.literal("canceled"),
|
|
565
|
-
z.literal("expired")
|
|
566
|
-
]);
|
|
567
|
-
var apiExpertJobSchema = z.object({
|
|
568
|
-
type: z.literal("expertJob"),
|
|
569
|
-
id: z.cuid2(),
|
|
570
|
-
status: apiExpertJobStatusSchema,
|
|
571
|
-
runtimeVersion: apiRuntimeVersionSchema,
|
|
572
|
-
expertKey: apiBaseExpertSchema.shape.key,
|
|
573
|
-
query: z.string().min(1).max(1024 * 20).optional(),
|
|
574
|
-
files: z.array(
|
|
575
|
-
z.string().min(1).max(1024 * 20)
|
|
576
|
-
).optional(),
|
|
577
|
-
interactiveToolCallResult: z.boolean().optional(),
|
|
578
|
-
expert: apiExpertSchema,
|
|
579
|
-
model: z.string().min(1).max(256),
|
|
580
|
-
temperature: z.number().min(0).max(1).optional(),
|
|
581
|
-
maxSteps: z.number().min(1).optional(),
|
|
582
|
-
maxRetries: z.number().min(0).optional(),
|
|
583
|
-
currentStep: z.number().min(0).optional(),
|
|
584
|
-
totalSteps: z.number().min(0).optional(),
|
|
585
|
-
totalDuration: z.number().min(0).optional(),
|
|
586
|
-
usage: usageSchema,
|
|
587
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
588
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
589
|
-
applicationId: z.cuid2()
|
|
590
|
-
});
|
|
591
|
-
|
|
592
|
-
// v1/studio/expert-jobs.ts
|
|
593
|
-
var startExpertJobInput = z.object({
|
|
594
|
-
expertKey: apiBaseExpertSchema.shape.key,
|
|
595
|
-
query: apiExpertJobSchema.shape.query,
|
|
596
|
-
files: apiExpertJobSchema.shape.files,
|
|
597
|
-
model: apiExpertJobSchema.shape.model,
|
|
598
|
-
temperature: apiExpertJobSchema.shape.temperature,
|
|
599
|
-
maxSteps: apiExpertJobSchema.shape.maxSteps,
|
|
600
|
-
maxRetries: apiExpertJobSchema.shape.maxRetries
|
|
601
|
-
});
|
|
602
|
-
var startExpertJobResponseSchema = z.object({
|
|
603
|
-
data: z.object({
|
|
604
|
-
expertJob: apiExpertJobSchema
|
|
605
|
-
})
|
|
606
|
-
});
|
|
607
|
-
async function startExpertJob(input, client) {
|
|
608
|
-
const { expertKey, query, files, model, temperature, maxSteps, maxRetries } = startExpertJobInput.parse(input);
|
|
609
|
-
if ((!query || query === "") && (!files || files.length === 0)) {
|
|
610
|
-
throw new Error("Either query or files must be provided");
|
|
611
|
-
}
|
|
612
|
-
const endpoint = "/api/studio/v1/expert_jobs";
|
|
613
|
-
const formData = new FormData();
|
|
614
|
-
formData.append("expertKey", expertKey);
|
|
615
|
-
if (query) formData.append("query", query);
|
|
616
|
-
if (temperature) formData.append("temperature", temperature.toString());
|
|
617
|
-
if (maxSteps) formData.append("maxSteps", maxSteps.toString());
|
|
618
|
-
if (maxRetries) formData.append("maxRetries", maxRetries.toString());
|
|
619
|
-
if (model) formData.append("model", model);
|
|
620
|
-
if (files && files.length > 0) {
|
|
621
|
-
for (const file of files) {
|
|
622
|
-
formData.append("files", file);
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
626
|
-
method: "POST",
|
|
627
|
-
body: formData
|
|
628
|
-
});
|
|
629
|
-
const { data } = startExpertJobResponseSchema.parse(json);
|
|
630
|
-
return {
|
|
631
|
-
expertJob: data.expertJob
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
var continueExpertJobInput = z.object({
|
|
635
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
636
|
-
query: apiExpertJobSchema.shape.query,
|
|
637
|
-
files: apiExpertJobSchema.shape.files,
|
|
638
|
-
interactiveToolCallResult: apiExpertJobSchema.shape.interactiveToolCallResult,
|
|
639
|
-
model: apiExpertJobSchema.shape.model,
|
|
640
|
-
temperature: apiExpertJobSchema.shape.temperature,
|
|
641
|
-
maxSteps: apiExpertJobSchema.shape.maxSteps,
|
|
642
|
-
maxRetries: apiExpertJobSchema.shape.maxRetries
|
|
643
|
-
});
|
|
644
|
-
var continueExpertJobResponseSchema = z.object({
|
|
645
|
-
data: z.object({
|
|
646
|
-
expertJob: apiExpertJobSchema
|
|
647
|
-
})
|
|
648
|
-
});
|
|
649
|
-
async function continueExpertJob(input, client) {
|
|
650
|
-
const {
|
|
651
|
-
expertJobId,
|
|
652
|
-
query,
|
|
653
|
-
files,
|
|
654
|
-
interactiveToolCallResult,
|
|
655
|
-
model,
|
|
656
|
-
temperature,
|
|
657
|
-
maxSteps,
|
|
658
|
-
maxRetries
|
|
659
|
-
} = continueExpertJobInput.parse(input);
|
|
660
|
-
if ((!query || query === "") && (!files || files.length === 0)) {
|
|
661
|
-
throw new Error("Either query or files must be provided");
|
|
662
|
-
}
|
|
663
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/continue`;
|
|
664
|
-
const formData = new FormData();
|
|
665
|
-
if (query) formData.append("query", query);
|
|
666
|
-
if (model) formData.append("model", model);
|
|
667
|
-
if (temperature) formData.append("temperature", temperature.toString());
|
|
668
|
-
if (maxSteps) formData.append("maxSteps", maxSteps.toString());
|
|
669
|
-
if (maxRetries) formData.append("maxRetries", maxRetries.toString());
|
|
670
|
-
if (files) {
|
|
671
|
-
for (const file of files) {
|
|
672
|
-
formData.append("files", file);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
if (interactiveToolCallResult)
|
|
676
|
-
formData.append("interactiveToolCallResult", interactiveToolCallResult.toString());
|
|
677
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
678
|
-
method: "POST",
|
|
679
|
-
body: formData
|
|
680
|
-
});
|
|
681
|
-
const { data } = continueExpertJobResponseSchema.parse(json);
|
|
682
|
-
return {
|
|
683
|
-
expertJob: data.expertJob
|
|
684
|
-
};
|
|
685
|
-
}
|
|
686
|
-
var resumeExpertJobFromCheckpointInput = z.object({
|
|
687
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
688
|
-
checkpointId: apiCheckpointSchema.shape.id,
|
|
689
|
-
query: apiExpertJobSchema.shape.query,
|
|
690
|
-
files: apiExpertJobSchema.shape.files,
|
|
691
|
-
interactiveToolCallResult: apiExpertJobSchema.shape.interactiveToolCallResult,
|
|
692
|
-
model: apiExpertJobSchema.shape.model,
|
|
693
|
-
temperature: apiExpertJobSchema.shape.temperature,
|
|
694
|
-
maxSteps: apiExpertJobSchema.shape.maxSteps,
|
|
695
|
-
maxRetries: apiExpertJobSchema.shape.maxRetries
|
|
696
|
-
});
|
|
697
|
-
var resumeExpertJobFromCheckpointResponseSchema = z.object({
|
|
698
|
-
data: z.object({
|
|
699
|
-
expertJob: apiExpertJobSchema
|
|
700
|
-
})
|
|
701
|
-
});
|
|
702
|
-
async function resumeExpertJobFromCheckpoint(input, client) {
|
|
703
|
-
const {
|
|
704
|
-
expertJobId,
|
|
705
|
-
checkpointId,
|
|
706
|
-
query,
|
|
707
|
-
files,
|
|
708
|
-
interactiveToolCallResult,
|
|
709
|
-
model,
|
|
710
|
-
temperature,
|
|
711
|
-
maxSteps,
|
|
712
|
-
maxRetries
|
|
713
|
-
} = resumeExpertJobFromCheckpointInput.parse(input);
|
|
714
|
-
if ((!query || query === "") && (!files || files.length === 0)) {
|
|
715
|
-
throw new Error("Either query or files must be provided");
|
|
716
|
-
}
|
|
717
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/resume_from`;
|
|
718
|
-
const formData = new FormData();
|
|
719
|
-
formData.append("checkpointId", checkpointId);
|
|
720
|
-
if (query) formData.append("query", query);
|
|
721
|
-
if (model) formData.append("model", model);
|
|
722
|
-
if (temperature) formData.append("temperature", temperature.toString());
|
|
723
|
-
if (maxSteps) formData.append("maxSteps", maxSteps.toString());
|
|
724
|
-
if (maxRetries) formData.append("maxRetries", maxRetries.toString());
|
|
725
|
-
if (files) {
|
|
726
|
-
for (const file of files) {
|
|
727
|
-
formData.append("files", file);
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
if (interactiveToolCallResult)
|
|
731
|
-
formData.append("interactiveToolCallResult", interactiveToolCallResult.toString());
|
|
732
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
733
|
-
method: "POST",
|
|
734
|
-
body: formData
|
|
735
|
-
});
|
|
736
|
-
const { data } = resumeExpertJobFromCheckpointResponseSchema.parse(json);
|
|
737
|
-
return {
|
|
738
|
-
expertJob: data.expertJob
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
var getExpertJobInput = z.object({
|
|
742
|
-
expertJobId: apiExpertJobSchema.shape.id
|
|
743
|
-
});
|
|
744
|
-
var getExpertJobResponseSchema = z.object({
|
|
745
|
-
data: z.object({
|
|
746
|
-
expertJob: apiExpertJobSchema
|
|
747
|
-
})
|
|
748
|
-
});
|
|
749
|
-
async function getExpertJob(input, client) {
|
|
750
|
-
const { expertJobId } = getExpertJobInput.parse(input);
|
|
751
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}`;
|
|
752
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
753
|
-
method: "GET",
|
|
754
|
-
headers: {
|
|
755
|
-
"Content-Type": "application/json"
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
const { data } = getExpertJobResponseSchema.parse(json);
|
|
759
|
-
return {
|
|
760
|
-
expertJob: data.expertJob
|
|
761
|
-
};
|
|
762
|
-
}
|
|
763
|
-
var getExpertJobsInput = z.object({
|
|
764
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
765
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
766
|
-
sort: z.string().optional(),
|
|
767
|
-
order: z.string().optional(),
|
|
768
|
-
filter: z.string().optional()
|
|
769
|
-
});
|
|
770
|
-
var getExpertJobsResponseSchema = z.object({
|
|
771
|
-
data: z.object({
|
|
772
|
-
expertJobs: apiExpertJobSchema.array()
|
|
773
|
-
}),
|
|
774
|
-
meta: z.object({
|
|
775
|
-
total: z.number(),
|
|
776
|
-
take: z.number(),
|
|
777
|
-
skip: z.number()
|
|
778
|
-
})
|
|
779
|
-
});
|
|
780
|
-
async function getExpertJobs(input, client) {
|
|
781
|
-
const { sort, order, take, skip, filter } = getExpertJobsInput.parse(input);
|
|
782
|
-
const url = new URL("/api/studio/v1/expert_jobs", client.baseUrl);
|
|
783
|
-
const searchParams = url.searchParams;
|
|
784
|
-
if (sort) searchParams.set("sort", sort);
|
|
785
|
-
if (order) searchParams.set("order", order);
|
|
786
|
-
if (take) searchParams.set("take", take.toString());
|
|
787
|
-
if (skip) searchParams.set("skip", skip.toString());
|
|
788
|
-
if (filter) searchParams.set("filter", filter);
|
|
789
|
-
const endpoint = url.toString();
|
|
790
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
791
|
-
method: "GET",
|
|
792
|
-
headers: {
|
|
793
|
-
"Content-Type": "application/json"
|
|
794
|
-
}
|
|
795
|
-
});
|
|
796
|
-
const { data, meta } = getExpertJobsResponseSchema.parse(json);
|
|
797
|
-
return {
|
|
798
|
-
expertJobs: data.expertJobs,
|
|
799
|
-
total: meta.total,
|
|
800
|
-
take: meta.take,
|
|
801
|
-
skip: meta.skip
|
|
802
|
-
};
|
|
803
|
-
}
|
|
804
|
-
var updateExpertJobInput = z.object({
|
|
805
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
806
|
-
status: apiExpertJobSchema.shape.status
|
|
807
|
-
});
|
|
808
|
-
var updateExpertJobResponseSchema = z.object({
|
|
809
|
-
data: z.object({
|
|
810
|
-
expertJob: apiExpertJobSchema
|
|
811
|
-
})
|
|
812
|
-
});
|
|
813
|
-
async function updateExpertJob(input, client) {
|
|
814
|
-
const { expertJobId, status } = updateExpertJobInput.parse(input);
|
|
815
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}`;
|
|
816
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
817
|
-
method: "POST",
|
|
818
|
-
headers: {
|
|
819
|
-
"Content-Type": "application/json"
|
|
820
|
-
},
|
|
821
|
-
body: JSON.stringify({
|
|
822
|
-
status
|
|
823
|
-
})
|
|
824
|
-
});
|
|
825
|
-
const { data } = updateExpertJobResponseSchema.parse(json);
|
|
826
|
-
return {
|
|
827
|
-
expertJob: data.expertJob
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
var createCheckpointInput = z.object({
|
|
831
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
832
|
-
checkpoint: checkpointSchema,
|
|
833
|
-
step: stepSchema
|
|
834
|
-
});
|
|
835
|
-
var createCheckpointResponseSchema = z.object({
|
|
836
|
-
data: z.object({
|
|
837
|
-
checkpoint: apiCheckpointSchema
|
|
838
|
-
})
|
|
839
|
-
});
|
|
840
|
-
async function createCheckpoint(input, client) {
|
|
841
|
-
const { expertJobId, checkpoint, step } = createCheckpointInput.parse(input);
|
|
842
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/checkpoints`;
|
|
843
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
844
|
-
method: "POST",
|
|
845
|
-
headers: {
|
|
846
|
-
"Content-Type": "application/json"
|
|
847
|
-
},
|
|
848
|
-
body: JSON.stringify({
|
|
849
|
-
checkpoint,
|
|
850
|
-
step
|
|
851
|
-
})
|
|
852
|
-
});
|
|
853
|
-
const { data } = createCheckpointResponseSchema.parse(json);
|
|
854
|
-
return {
|
|
855
|
-
checkpoint: data.checkpoint
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
var getCheckpointInput = z.object({
|
|
859
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
860
|
-
checkpointId: apiCheckpointSchema.shape.id
|
|
861
|
-
});
|
|
862
|
-
var getCheckpointResponseSchema = z.object({
|
|
863
|
-
data: z.object({
|
|
864
|
-
checkpoint: apiCheckpointSchema
|
|
865
|
-
})
|
|
866
|
-
});
|
|
867
|
-
async function getCheckpoint(input, client) {
|
|
868
|
-
const { expertJobId, checkpointId } = getCheckpointInput.parse(input);
|
|
869
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/checkpoints/${checkpointId}`;
|
|
870
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
871
|
-
method: "GET",
|
|
872
|
-
headers: {
|
|
873
|
-
"Content-Type": "application/json"
|
|
874
|
-
}
|
|
875
|
-
});
|
|
876
|
-
const { data } = getCheckpointResponseSchema.parse(json);
|
|
877
|
-
return {
|
|
878
|
-
checkpoint: data.checkpoint
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
var getCheckpointsInput = z.object({
|
|
882
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
883
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
884
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
885
|
-
sort: z.string().optional(),
|
|
886
|
-
order: z.string().optional(),
|
|
887
|
-
filter: z.string().optional()
|
|
888
|
-
});
|
|
889
|
-
var getCheckpointsResponseSchema = z.object({
|
|
890
|
-
data: z.object({
|
|
891
|
-
checkpoints: apiCheckpointSchema.array()
|
|
892
|
-
}),
|
|
893
|
-
meta: z.object({
|
|
894
|
-
total: z.number(),
|
|
895
|
-
take: z.number(),
|
|
896
|
-
skip: z.number()
|
|
897
|
-
})
|
|
898
|
-
});
|
|
899
|
-
async function getCheckpoints(input, client) {
|
|
900
|
-
const { expertJobId, sort, order, take, skip, filter } = getCheckpointsInput.parse(input);
|
|
901
|
-
const url = new URL(`/api/studio/v1/expert_jobs/${expertJobId}/checkpoints`);
|
|
902
|
-
const searchParams = url.searchParams;
|
|
903
|
-
if (sort) searchParams.set("sort", sort);
|
|
904
|
-
if (order) searchParams.set("order", order);
|
|
905
|
-
if (take) searchParams.set("take", take.toString());
|
|
906
|
-
if (skip) searchParams.set("skip", skip.toString());
|
|
907
|
-
if (filter) searchParams.set("filter", filter);
|
|
908
|
-
const endpoint = url.toString();
|
|
909
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
910
|
-
method: "GET",
|
|
911
|
-
headers: {
|
|
912
|
-
"Content-Type": "application/json"
|
|
913
|
-
}
|
|
914
|
-
});
|
|
915
|
-
const { data, meta } = getCheckpointsResponseSchema.parse(json);
|
|
916
|
-
return {
|
|
917
|
-
checkpoints: data.checkpoints,
|
|
918
|
-
total: meta.total,
|
|
919
|
-
take: meta.take,
|
|
920
|
-
skip: meta.skip
|
|
921
|
-
};
|
|
922
|
-
}
|
|
923
|
-
var createStudioExpertInput = z.object({
|
|
924
|
-
name: apiStudioExpertSchema.shape.name,
|
|
925
|
-
minRuntimeVersion: apiStudioExpertSchema.shape.minRuntimeVersion,
|
|
926
|
-
description: apiStudioExpertSchema.shape.description,
|
|
927
|
-
instruction: apiStudioExpertSchema.shape.instruction,
|
|
928
|
-
delegates: apiStudioExpertSchema.shape.delegates,
|
|
929
|
-
skills: apiStudioExpertSchema.shape.skills,
|
|
930
|
-
forkFrom: apiStudioExpertSchema.shape.forkFrom
|
|
931
|
-
});
|
|
932
|
-
var createStudioExpertResponseSchema = z.object({
|
|
933
|
-
data: z.object({
|
|
934
|
-
expert: apiStudioExpertSchema
|
|
935
|
-
})
|
|
936
|
-
});
|
|
937
|
-
async function createStudioExpert(input, client) {
|
|
938
|
-
const { name, minRuntimeVersion, description, instruction, skills, delegates, forkFrom } = createStudioExpertInput.parse(input);
|
|
939
|
-
const endpoint = "/api/studio/v1/experts";
|
|
940
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
941
|
-
method: "POST",
|
|
942
|
-
headers: {
|
|
943
|
-
"Content-Type": "application/json"
|
|
944
|
-
},
|
|
945
|
-
body: JSON.stringify({
|
|
946
|
-
name,
|
|
947
|
-
minRuntimeVersion,
|
|
948
|
-
description,
|
|
949
|
-
instruction,
|
|
950
|
-
skills,
|
|
951
|
-
delegates,
|
|
952
|
-
forkFrom
|
|
953
|
-
})
|
|
954
|
-
});
|
|
955
|
-
const { data } = createStudioExpertResponseSchema.parse(json);
|
|
956
|
-
return {
|
|
957
|
-
expert: data.expert
|
|
958
|
-
};
|
|
959
|
-
}
|
|
960
|
-
var getStudioExpertInput = z.object({
|
|
961
|
-
expertKey: apiStudioExpertSchema.shape.key
|
|
962
|
-
});
|
|
963
|
-
var getStudioExpertResponseSchema = z.object({
|
|
964
|
-
data: z.object({
|
|
965
|
-
expert: apiStudioExpertSchema
|
|
966
|
-
})
|
|
967
|
-
});
|
|
968
|
-
async function getStudioExpert(input, client) {
|
|
969
|
-
const { expertKey } = getStudioExpertInput.parse(input);
|
|
970
|
-
const endpoint = `/api/studio/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
971
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
972
|
-
method: "GET",
|
|
973
|
-
headers: {
|
|
974
|
-
"Content-Type": "application/json"
|
|
975
|
-
}
|
|
976
|
-
});
|
|
977
|
-
const { data } = getStudioExpertResponseSchema.parse(json);
|
|
978
|
-
return {
|
|
979
|
-
expert: data.expert
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
var getStudioExpertsInput = z.object({
|
|
983
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
984
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
985
|
-
sort: z.string().optional(),
|
|
986
|
-
order: z.string().optional(),
|
|
987
|
-
filter: z.string().optional()
|
|
988
|
-
});
|
|
989
|
-
var getStudioExpertsResponseSchema = z.object({
|
|
990
|
-
data: z.object({
|
|
991
|
-
experts: z.array(apiExpertDigestSchema)
|
|
992
|
-
}),
|
|
993
|
-
meta: z.object({
|
|
994
|
-
total: z.number(),
|
|
995
|
-
take: z.number(),
|
|
996
|
-
skip: z.number()
|
|
997
|
-
})
|
|
998
|
-
});
|
|
999
|
-
async function getStudioExperts(input, client) {
|
|
1000
|
-
const { sort, order, take, skip, filter } = getStudioExpertsInput.parse(input);
|
|
1001
|
-
const url = new URL("/api/studio/v1/experts", client.baseUrl);
|
|
1002
|
-
if (take) url.searchParams.set("take", take.toString());
|
|
1003
|
-
if (skip) url.searchParams.set("skip", skip.toString());
|
|
1004
|
-
if (sort) url.searchParams.set("sort", sort);
|
|
1005
|
-
if (order) url.searchParams.set("order", order);
|
|
1006
|
-
if (filter) url.searchParams.set("filter", filter);
|
|
1007
|
-
const endpoint = url.toString();
|
|
1008
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1009
|
-
method: "GET",
|
|
1010
|
-
headers: {
|
|
1011
|
-
"Content-Type": "application/json"
|
|
1012
|
-
}
|
|
1013
|
-
});
|
|
1014
|
-
const { data, meta } = getStudioExpertsResponseSchema.parse(json);
|
|
1015
|
-
return {
|
|
1016
|
-
experts: data.experts,
|
|
1017
|
-
total: meta.total,
|
|
1018
|
-
take: meta.take,
|
|
1019
|
-
skip: meta.skip
|
|
1020
|
-
};
|
|
1021
|
-
}
|
|
1022
|
-
var updateStudioExpertInput = z.object({
|
|
1023
|
-
expertKey: apiStudioExpertSchema.shape.key,
|
|
1024
|
-
minRuntimeVersion: apiStudioExpertSchema.shape.minRuntimeVersion,
|
|
1025
|
-
description: apiStudioExpertSchema.shape.description,
|
|
1026
|
-
instruction: apiStudioExpertSchema.shape.instruction,
|
|
1027
|
-
delegates: apiStudioExpertSchema.shape.delegates,
|
|
1028
|
-
skills: apiStudioExpertSchema.shape.skills,
|
|
1029
|
-
forkFrom: apiStudioExpertSchema.shape.forkFrom
|
|
1030
|
-
});
|
|
1031
|
-
var updateStudioExpertResponseSchema = z.object({
|
|
1032
|
-
data: z.object({
|
|
1033
|
-
expert: apiStudioExpertSchema
|
|
1034
|
-
})
|
|
1035
|
-
});
|
|
1036
|
-
async function updateStudioExpert(input, client) {
|
|
1037
|
-
const { expertKey, minRuntimeVersion, description, instruction, skills, delegates, forkFrom } = updateStudioExpertInput.parse(input);
|
|
1038
|
-
const endpoint = `/api/studio/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
1039
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1040
|
-
method: "POST",
|
|
1041
|
-
headers: {
|
|
1042
|
-
"Content-Type": "application/json"
|
|
1043
|
-
},
|
|
1044
|
-
body: JSON.stringify({
|
|
1045
|
-
minRuntimeVersion,
|
|
1046
|
-
description,
|
|
1047
|
-
instruction,
|
|
1048
|
-
skills,
|
|
1049
|
-
delegates,
|
|
1050
|
-
forkFrom
|
|
1051
|
-
})
|
|
1052
|
-
});
|
|
1053
|
-
const { data } = updateStudioExpertResponseSchema.parse(json);
|
|
1054
|
-
return {
|
|
1055
|
-
expert: data.expert
|
|
1056
|
-
};
|
|
1057
|
-
}
|
|
1058
|
-
var deleteStudioExpertInput = z.object({
|
|
1059
|
-
expertKey: apiStudioExpertSchema.shape.key
|
|
1060
|
-
});
|
|
1061
|
-
async function deleteStudioExpert(input, client) {
|
|
1062
|
-
const { expertKey } = deleteStudioExpertInput.parse(input);
|
|
1063
|
-
const endpoint = `/api/studio/v1/experts/${encodeURIComponent(expertKey)}`;
|
|
1064
|
-
await client.requestAuthenticated(endpoint, {
|
|
1065
|
-
method: "DELETE",
|
|
1066
|
-
headers: {
|
|
1067
|
-
"Content-Type": "application/json"
|
|
1068
|
-
}
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
var apiWorkspaceSchema = z.object({
|
|
1072
|
-
type: z.literal("workspace"),
|
|
1073
|
-
id: z.cuid2(),
|
|
1074
|
-
applicationId: z.cuid2(),
|
|
1075
|
-
application: apiApplicationSchema,
|
|
1076
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
1077
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
1078
|
-
items: z.array(apiWorkspaceItemSchema),
|
|
1079
|
-
countItems: z.number(),
|
|
1080
|
-
envVariables: z.array(z.string()),
|
|
1081
|
-
envSecrets: z.array(z.string()),
|
|
1082
|
-
countWorkspaceInstances: z.number()
|
|
1083
|
-
});
|
|
1084
|
-
|
|
1085
|
-
// v1/studio/workspace.ts
|
|
1086
|
-
var getWorkspaceResponseSchema = z.object({
|
|
1087
|
-
data: z.object({
|
|
1088
|
-
workspace: apiWorkspaceSchema
|
|
1089
|
-
})
|
|
1090
|
-
});
|
|
1091
|
-
async function getWorkspace(client) {
|
|
1092
|
-
const endpoint = "/api/studio/v1/workspace";
|
|
1093
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1094
|
-
headers: {
|
|
1095
|
-
"Content-Type": "application/json"
|
|
1096
|
-
}
|
|
1097
|
-
});
|
|
1098
|
-
const { data } = getWorkspaceResponseSchema.parse(json);
|
|
1099
|
-
return {
|
|
1100
|
-
workspace: data.workspace
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
var createWorkspaceItemInput = z.discriminatedUnion("type", [
|
|
1104
|
-
z.object({
|
|
1105
|
-
type: z.literal("workspaceItemDirectory"),
|
|
1106
|
-
permission: apiWorkspaceItemPermissionSchema,
|
|
1107
|
-
path: z.string()
|
|
1108
|
-
}),
|
|
1109
|
-
z.object({
|
|
1110
|
-
type: z.literal("workspaceItemFile"),
|
|
1111
|
-
permission: apiWorkspaceItemPermissionSchema,
|
|
1112
|
-
path: z.string(),
|
|
1113
|
-
file: z.instanceof(File)
|
|
1114
|
-
})
|
|
1115
|
-
]);
|
|
1116
|
-
var createWorkspaceItemResponseSchema = z.object({
|
|
1117
|
-
data: z.object({
|
|
1118
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1119
|
-
})
|
|
1120
|
-
});
|
|
1121
|
-
async function createWorkspaceItem(input, client) {
|
|
1122
|
-
const validatedInput = createWorkspaceItemInput.parse(input);
|
|
1123
|
-
const endpoint = "/api/studio/v1/workspace/items";
|
|
1124
|
-
const formData = new FormData();
|
|
1125
|
-
formData.append("type", validatedInput.type);
|
|
1126
|
-
formData.append("permission", validatedInput.permission);
|
|
1127
|
-
formData.append("path", validatedInput.path);
|
|
1128
|
-
if (validatedInput.type === "workspaceItemFile") {
|
|
1129
|
-
formData.append("file", validatedInput.file);
|
|
1130
|
-
}
|
|
1131
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1132
|
-
method: "POST",
|
|
1133
|
-
body: formData
|
|
1134
|
-
});
|
|
1135
|
-
const { data } = createWorkspaceItemResponseSchema.parse(json);
|
|
1136
|
-
return {
|
|
1137
|
-
workspaceItem: data.workspaceItem
|
|
1138
|
-
};
|
|
1139
|
-
}
|
|
1140
|
-
var getWorkspaceItemInput = z.object({
|
|
1141
|
-
itemId: z.string()
|
|
1142
|
-
});
|
|
1143
|
-
var getWorkspaceItemResponseSchema = z.object({
|
|
1144
|
-
data: z.object({
|
|
1145
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1146
|
-
})
|
|
1147
|
-
});
|
|
1148
|
-
async function getWorkspaceItem(input, client) {
|
|
1149
|
-
const { itemId } = getWorkspaceItemInput.parse(input);
|
|
1150
|
-
const endpoint = `/api/studio/v1/workspace/items/${itemId}`;
|
|
1151
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1152
|
-
headers: {
|
|
1153
|
-
"Content-Type": "application/json"
|
|
1154
|
-
}
|
|
1155
|
-
});
|
|
1156
|
-
const { data } = getWorkspaceItemResponseSchema.parse(json);
|
|
1157
|
-
return {
|
|
1158
|
-
workspaceItem: data.workspaceItem
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
var getWorkspaceItemsInput = z.object({
|
|
1162
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
1163
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional()
|
|
1164
|
-
});
|
|
1165
|
-
var getWorkspaceItemsResponseSchema = z.object({
|
|
1166
|
-
data: z.object({
|
|
1167
|
-
workspaceItems: z.array(apiWorkspaceItemSchema)
|
|
1168
|
-
}),
|
|
1169
|
-
meta: z.object({
|
|
1170
|
-
total: z.number(),
|
|
1171
|
-
take: z.number(),
|
|
1172
|
-
skip: z.number()
|
|
1173
|
-
})
|
|
1174
|
-
});
|
|
1175
|
-
async function getWorkspaceItems(input, client) {
|
|
1176
|
-
const { take, skip } = getWorkspaceItemsInput.parse(input);
|
|
1177
|
-
const url = new URL("/api/studio/v1/workspace/items", client.baseUrl);
|
|
1178
|
-
if (take) url.searchParams.set("take", take.toString());
|
|
1179
|
-
if (skip) url.searchParams.set("skip", skip.toString());
|
|
1180
|
-
const endpoint = url.toString();
|
|
1181
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1182
|
-
headers: {
|
|
1183
|
-
"Content-Type": "application/json"
|
|
1184
|
-
}
|
|
1185
|
-
});
|
|
1186
|
-
const { data, meta } = getWorkspaceItemsResponseSchema.parse(json);
|
|
1187
|
-
return {
|
|
1188
|
-
workspaceItems: data.workspaceItems,
|
|
1189
|
-
total: meta.total,
|
|
1190
|
-
take: meta.take,
|
|
1191
|
-
skip: meta.skip
|
|
1192
|
-
};
|
|
1193
|
-
}
|
|
1194
|
-
var downloadWorkspaceItemInput = z.object({
|
|
1195
|
-
itemId: z.string()
|
|
1196
|
-
});
|
|
1197
|
-
async function downloadWorkspaceItem(input, client) {
|
|
1198
|
-
const { itemId } = downloadWorkspaceItemInput.parse(input);
|
|
1199
|
-
const endpoint = `/api/studio/v1/workspace/items/${itemId}/download`;
|
|
1200
|
-
const blob = await client.requestBlobAuthenticated(endpoint, {
|
|
1201
|
-
headers: {
|
|
1202
|
-
"Content-Type": "application/json"
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1205
|
-
return blob;
|
|
1206
|
-
}
|
|
1207
|
-
var updateWorkspaceItemInput = z.object({
|
|
1208
|
-
itemId: z.string(),
|
|
1209
|
-
permission: apiWorkspaceItemPermissionSchema.optional(),
|
|
1210
|
-
path: z.string().min(1).max(1024).optional(),
|
|
1211
|
-
lifecycle: apiWorkspaceItemLifecycleSchema.optional()
|
|
1212
|
-
});
|
|
1213
|
-
var updateWorkspaceItemResponseSchema = z.object({
|
|
1214
|
-
data: z.object({
|
|
1215
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1216
|
-
})
|
|
1217
|
-
});
|
|
1218
|
-
async function updateWorkspaceItem(input, client) {
|
|
1219
|
-
const { itemId, permission, path, lifecycle } = updateWorkspaceItemInput.parse(input);
|
|
1220
|
-
const endpoint = `/api/studio/v1/workspace/items/${itemId}`;
|
|
1221
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1222
|
-
method: "POST",
|
|
1223
|
-
headers: {
|
|
1224
|
-
"Content-Type": "application/json"
|
|
1225
|
-
},
|
|
1226
|
-
body: JSON.stringify({ permission, path, lifecycle })
|
|
1227
|
-
});
|
|
1228
|
-
const { data } = updateWorkspaceItemResponseSchema.parse(json);
|
|
1229
|
-
return {
|
|
1230
|
-
workspaceItem: data.workspaceItem
|
|
1231
|
-
};
|
|
1232
|
-
}
|
|
1233
|
-
var deleteWorkspaceItemInput = z.object({
|
|
1234
|
-
itemId: z.string()
|
|
1235
|
-
});
|
|
1236
|
-
async function deleteWorkspaceItem(input, client) {
|
|
1237
|
-
const { itemId } = deleteWorkspaceItemInput.parse(input);
|
|
1238
|
-
const endpoint = `/api/studio/v1/workspace/items/${itemId}`;
|
|
1239
|
-
await client.requestAuthenticated(endpoint, {
|
|
1240
|
-
method: "DELETE",
|
|
1241
|
-
headers: {
|
|
1242
|
-
"Content-Type": "application/json"
|
|
1243
|
-
}
|
|
1244
|
-
});
|
|
1245
|
-
}
|
|
1246
|
-
var createWorkspaceVariableInput = z.object({
|
|
1247
|
-
name: z.string(),
|
|
1248
|
-
value: z.string()
|
|
1249
|
-
});
|
|
1250
|
-
var createWorkspaceVariableResponseSchema = z.object({
|
|
1251
|
-
data: z.object({
|
|
1252
|
-
workspace: apiWorkspaceSchema
|
|
1253
|
-
})
|
|
1254
|
-
});
|
|
1255
|
-
async function createWorkspaceVariable(input, client) {
|
|
1256
|
-
const { name, value } = createWorkspaceVariableInput.parse(input);
|
|
1257
|
-
const endpoint = "/api/studio/v1/workspace/variables";
|
|
1258
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1259
|
-
method: "POST",
|
|
1260
|
-
headers: {
|
|
1261
|
-
"Content-Type": "application/json"
|
|
1262
|
-
},
|
|
1263
|
-
body: JSON.stringify({ name, value })
|
|
1264
|
-
});
|
|
1265
|
-
const { data } = createWorkspaceVariableResponseSchema.parse(json);
|
|
1266
|
-
return {
|
|
1267
|
-
workspace: data.workspace
|
|
1268
|
-
};
|
|
1269
|
-
}
|
|
1270
|
-
var updateWorkspaceVariableInput = z.object({
|
|
1271
|
-
name: z.string(),
|
|
1272
|
-
value: z.string()
|
|
1273
|
-
});
|
|
1274
|
-
var updateWorkspaceVariableResponseSchema = z.object({
|
|
1275
|
-
data: z.object({
|
|
1276
|
-
workspace: apiWorkspaceSchema
|
|
1277
|
-
})
|
|
1278
|
-
});
|
|
1279
|
-
async function updateWorkspaceVariable(input, client) {
|
|
1280
|
-
const { name, value } = updateWorkspaceVariableInput.parse(input);
|
|
1281
|
-
const endpoint = `/api/studio/v1/workspace/variables/${name}`;
|
|
1282
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1283
|
-
method: "POST",
|
|
1284
|
-
headers: {
|
|
1285
|
-
"Content-Type": "application/json"
|
|
1286
|
-
},
|
|
1287
|
-
body: JSON.stringify({ name, value })
|
|
1288
|
-
});
|
|
1289
|
-
const { data } = updateWorkspaceVariableResponseSchema.parse(json);
|
|
1290
|
-
return {
|
|
1291
|
-
workspace: data.workspace
|
|
1292
|
-
};
|
|
1293
|
-
}
|
|
1294
|
-
var deleteWorkspaceVariableInput = z.object({
|
|
1295
|
-
name: z.string()
|
|
1296
|
-
});
|
|
1297
|
-
async function deleteWorkspaceVariable(input, client) {
|
|
1298
|
-
const { name } = deleteWorkspaceVariableInput.parse(input);
|
|
1299
|
-
const endpoint = `/api/studio/v1/workspace/variables/${name}`;
|
|
1300
|
-
await client.requestAuthenticated(endpoint, {
|
|
1301
|
-
method: "DELETE",
|
|
1302
|
-
headers: {
|
|
1303
|
-
"Content-Type": "application/json"
|
|
1304
|
-
}
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
var createWorkspaceSecretInput = z.object({
|
|
1308
|
-
name: z.string(),
|
|
1309
|
-
value: z.string()
|
|
1310
|
-
});
|
|
1311
|
-
var createWorkspaceSecretResponseSchema = z.object({
|
|
1312
|
-
data: z.object({
|
|
1313
|
-
workspace: apiWorkspaceSchema
|
|
1314
|
-
})
|
|
1315
|
-
});
|
|
1316
|
-
async function createWorkspaceSecret(input, client) {
|
|
1317
|
-
const { name, value } = createWorkspaceSecretInput.parse(input);
|
|
1318
|
-
const endpoint = "/api/studio/v1/workspace/secrets";
|
|
1319
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1320
|
-
method: "POST",
|
|
1321
|
-
headers: {
|
|
1322
|
-
"Content-Type": "application/json"
|
|
1323
|
-
},
|
|
1324
|
-
body: JSON.stringify({ name, value })
|
|
1325
|
-
});
|
|
1326
|
-
const { data } = createWorkspaceSecretResponseSchema.parse(json);
|
|
1327
|
-
return {
|
|
1328
|
-
workspace: data.workspace
|
|
1329
|
-
};
|
|
1330
|
-
}
|
|
1331
|
-
var deleteWorkspaceSecretInput = z.object({
|
|
1332
|
-
name: z.string()
|
|
1333
|
-
});
|
|
1334
|
-
async function deleteWorkspaceSecret(input, client) {
|
|
1335
|
-
const { name } = deleteWorkspaceSecretInput.parse(input);
|
|
1336
|
-
const endpoint = `/api/studio/v1/workspace/secrets/${name}`;
|
|
1337
|
-
await client.requestAuthenticated(endpoint, {
|
|
1338
|
-
method: "DELETE",
|
|
1339
|
-
headers: {
|
|
1340
|
-
"Content-Type": "application/json"
|
|
1341
|
-
}
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
var apiWorkspaceInstanceSchema = z.object({
|
|
1345
|
-
type: z.literal("workspaceInstance"),
|
|
1346
|
-
id: z.cuid2(),
|
|
1347
|
-
applicationId: z.cuid2(),
|
|
1348
|
-
application: apiApplicationSchema,
|
|
1349
|
-
expertJob: apiExpertJobSchema,
|
|
1350
|
-
createdAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
1351
|
-
updatedAt: z.iso.datetime().transform((date) => new Date(date)),
|
|
1352
|
-
items: z.array(apiWorkspaceItemSchema),
|
|
1353
|
-
countItems: z.number(),
|
|
1354
|
-
envVariables: z.array(z.string()),
|
|
1355
|
-
envSecrets: z.array(z.string())
|
|
1356
|
-
});
|
|
1357
|
-
|
|
1358
|
-
// v1/studio/workspace-instance.ts
|
|
1359
|
-
var getWorkspaceInstanceInput = z.object({
|
|
1360
|
-
expertJobId: z.string()
|
|
1361
|
-
});
|
|
1362
|
-
var getWorkspaceInstanceResponseSchema = z.object({
|
|
1363
|
-
data: z.object({
|
|
1364
|
-
workspaceInstance: apiWorkspaceInstanceSchema
|
|
1365
|
-
})
|
|
1366
|
-
});
|
|
1367
|
-
async function getWorkspaceInstance(input, client) {
|
|
1368
|
-
const { expertJobId } = getWorkspaceInstanceInput.parse(input);
|
|
1369
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance`;
|
|
1370
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1371
|
-
headers: {
|
|
1372
|
-
"Content-Type": "application/json"
|
|
1373
|
-
}
|
|
1374
|
-
});
|
|
1375
|
-
const { data } = getWorkspaceInstanceResponseSchema.parse(json);
|
|
1376
|
-
return {
|
|
1377
|
-
workspaceInstance: data.workspaceInstance
|
|
1378
|
-
};
|
|
1379
|
-
}
|
|
1380
|
-
var createWorkspaceInstanceItemInput = z.discriminatedUnion("type", [
|
|
1381
|
-
z.object({
|
|
1382
|
-
type: z.literal("workspaceItemDirectory"),
|
|
1383
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
1384
|
-
permission: apiWorkspaceItemPermissionSchema,
|
|
1385
|
-
path: apiBaseWorkspaceItemSchema.shape.path
|
|
1386
|
-
}),
|
|
1387
|
-
z.object({
|
|
1388
|
-
type: z.literal("workspaceItemFile"),
|
|
1389
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
1390
|
-
permission: apiWorkspaceItemPermissionSchema,
|
|
1391
|
-
path: apiBaseWorkspaceItemSchema.shape.path,
|
|
1392
|
-
file: z.instanceof(File)
|
|
1393
|
-
})
|
|
1394
|
-
]);
|
|
1395
|
-
var createWorkspaceInstanceItemResponseSchema = z.object({
|
|
1396
|
-
data: z.object({
|
|
1397
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1398
|
-
})
|
|
1399
|
-
});
|
|
1400
|
-
async function createWorkspaceInstanceItem(input, client) {
|
|
1401
|
-
const validatedInput = createWorkspaceInstanceItemInput.parse(input);
|
|
1402
|
-
const endpoint = `/api/studio/v1/expert_jobs/${validatedInput.expertJobId}/workspace_instance/items`;
|
|
1403
|
-
const formData = new FormData();
|
|
1404
|
-
formData.append("type", validatedInput.type);
|
|
1405
|
-
formData.append("path", validatedInput.path);
|
|
1406
|
-
formData.append("permission", validatedInput.permission);
|
|
1407
|
-
if (validatedInput.type === "workspaceItemFile") {
|
|
1408
|
-
formData.append("file", validatedInput.file);
|
|
1409
|
-
}
|
|
1410
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1411
|
-
method: "POST",
|
|
1412
|
-
body: formData
|
|
1413
|
-
});
|
|
1414
|
-
const { data } = createWorkspaceInstanceItemResponseSchema.parse(json);
|
|
1415
|
-
return {
|
|
1416
|
-
workspaceItem: data.workspaceItem
|
|
1417
|
-
};
|
|
1418
|
-
}
|
|
1419
|
-
var getWorkspaceInstanceItemInput = z.object({
|
|
1420
|
-
expertJobId: z.string(),
|
|
1421
|
-
itemId: z.string()
|
|
1422
|
-
});
|
|
1423
|
-
var getWorkspaceInstanceItemResponseSchema = z.object({
|
|
1424
|
-
data: z.object({
|
|
1425
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1426
|
-
})
|
|
1427
|
-
});
|
|
1428
|
-
async function getWorkspaceInstanceItem(input, client) {
|
|
1429
|
-
const { expertJobId, itemId } = getWorkspaceInstanceItemInput.parse(input);
|
|
1430
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items/${itemId}`;
|
|
1431
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1432
|
-
headers: {
|
|
1433
|
-
"Content-Type": "application/json"
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
const { data } = getWorkspaceInstanceItemResponseSchema.parse(json);
|
|
1437
|
-
return {
|
|
1438
|
-
workspaceItem: data.workspaceItem
|
|
1439
|
-
};
|
|
1440
|
-
}
|
|
1441
|
-
var getWorkspaceInstanceItemsInput = z.object({
|
|
1442
|
-
expertJobId: z.string(),
|
|
1443
|
-
take: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional(),
|
|
1444
|
-
skip: z.union([z.number(), z.string().transform((value) => Number.parseInt(value, 10))]).optional()
|
|
1445
|
-
});
|
|
1446
|
-
var getWorkspaceInstanceItemsResponseSchema = z.object({
|
|
1447
|
-
data: z.object({
|
|
1448
|
-
workspaceItems: z.array(apiWorkspaceItemSchema)
|
|
1449
|
-
}),
|
|
1450
|
-
meta: z.object({
|
|
1451
|
-
total: z.number(),
|
|
1452
|
-
take: z.number(),
|
|
1453
|
-
skip: z.number()
|
|
1454
|
-
})
|
|
1455
|
-
});
|
|
1456
|
-
async function getWorkspaceInstanceItems(input, client) {
|
|
1457
|
-
const { expertJobId, take, skip } = getWorkspaceInstanceItemsInput.parse(input);
|
|
1458
|
-
const url = new URL(`/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items`);
|
|
1459
|
-
if (take) url.searchParams.set("take", take.toString());
|
|
1460
|
-
if (skip) url.searchParams.set("skip", skip.toString());
|
|
1461
|
-
const endpoint = url.toString();
|
|
1462
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1463
|
-
headers: {
|
|
1464
|
-
"Content-Type": "application/json"
|
|
1465
|
-
}
|
|
1466
|
-
});
|
|
1467
|
-
const { data, meta } = getWorkspaceInstanceItemsResponseSchema.parse(json);
|
|
1468
|
-
return {
|
|
1469
|
-
workspaceItems: data.workspaceItems,
|
|
1470
|
-
total: meta.total,
|
|
1471
|
-
take: meta.take,
|
|
1472
|
-
skip: meta.skip
|
|
1473
|
-
};
|
|
1474
|
-
}
|
|
1475
|
-
var downloadWorkspaceInstanceItemInput = z.object({
|
|
1476
|
-
expertJobId: z.string(),
|
|
1477
|
-
itemId: z.string()
|
|
1478
|
-
});
|
|
1479
|
-
z.object({
|
|
1480
|
-
data: z.object({
|
|
1481
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1482
|
-
})
|
|
1483
|
-
});
|
|
1484
|
-
async function downloadWorkspaceInstanceItem(input, client) {
|
|
1485
|
-
const { expertJobId, itemId } = downloadWorkspaceInstanceItemInput.parse(input);
|
|
1486
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items/${itemId}/download`;
|
|
1487
|
-
const blob = await client.requestBlobAuthenticated(endpoint, {
|
|
1488
|
-
headers: {
|
|
1489
|
-
"Content-Type": "application/json"
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
1492
|
-
return blob;
|
|
1493
|
-
}
|
|
1494
|
-
var updateWorkspaceInstanceItemInput = z.object({
|
|
1495
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
1496
|
-
itemId: z.string(),
|
|
1497
|
-
permission: apiWorkspaceItemPermissionSchema.optional(),
|
|
1498
|
-
path: apiBaseWorkspaceItemSchema.shape.path.optional(),
|
|
1499
|
-
lifecycle: apiWorkspaceItemLifecycleSchema.optional()
|
|
1500
|
-
});
|
|
1501
|
-
var updateWorkspaceInstanceItemResponseSchema = z.object({
|
|
1502
|
-
data: z.object({
|
|
1503
|
-
workspaceItem: apiWorkspaceItemSchema
|
|
1504
|
-
})
|
|
1505
|
-
});
|
|
1506
|
-
async function updateWorkspaceInstanceItem(input, client) {
|
|
1507
|
-
const { expertJobId, itemId, permission, path, lifecycle } = updateWorkspaceInstanceItemInput.parse(input);
|
|
1508
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items/${itemId}`;
|
|
1509
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1510
|
-
method: "POST",
|
|
1511
|
-
headers: {
|
|
1512
|
-
"Content-Type": "application/json"
|
|
1513
|
-
},
|
|
1514
|
-
body: JSON.stringify({ permission, path, lifecycle })
|
|
1515
|
-
});
|
|
1516
|
-
const { data } = updateWorkspaceInstanceItemResponseSchema.parse(json);
|
|
1517
|
-
return {
|
|
1518
|
-
workspaceItem: data.workspaceItem
|
|
1519
|
-
};
|
|
1520
|
-
}
|
|
1521
|
-
var deleteWorkspaceInstanceItemInput = z.object({
|
|
1522
|
-
expertJobId: apiExpertJobSchema.shape.id,
|
|
1523
|
-
itemId: z.string()
|
|
1524
|
-
});
|
|
1525
|
-
async function deleteWorkspaceInstanceItem(input, client) {
|
|
1526
|
-
const { expertJobId, itemId } = deleteWorkspaceInstanceItemInput.parse(input);
|
|
1527
|
-
const endpoint = `/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items/${itemId}`;
|
|
1528
|
-
await client.requestAuthenticated(endpoint, {
|
|
1529
|
-
method: "DELETE",
|
|
1530
|
-
headers: {
|
|
1531
|
-
"Content-Type": "application/json"
|
|
1532
|
-
}
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
var findWorkspaceInstanceItemsInput = z.object({
|
|
1536
|
-
expertJobId: z.string(),
|
|
1537
|
-
path: z.string()
|
|
1538
|
-
});
|
|
1539
|
-
var findWorkspaceInstanceItemsResponseSchema = z.object({
|
|
1540
|
-
data: z.object({
|
|
1541
|
-
workspaceItems: z.array(apiWorkspaceItemSchema)
|
|
1542
|
-
})
|
|
1543
|
-
});
|
|
1544
|
-
async function findWorkspaceInstanceItems(input, client) {
|
|
1545
|
-
const { expertJobId, path } = findWorkspaceInstanceItemsInput.parse(input);
|
|
1546
|
-
const url = new URL(
|
|
1547
|
-
`/api/studio/v1/expert_jobs/${expertJobId}/workspace_instance/items/find`,
|
|
1548
|
-
client.baseUrl
|
|
1549
|
-
);
|
|
1550
|
-
url.searchParams.set("path", path);
|
|
1551
|
-
const endpoint = url.toString();
|
|
1552
|
-
const json = await client.requestAuthenticated(endpoint, {
|
|
1553
|
-
headers: { "Content-Type": "application/json" }
|
|
1554
|
-
});
|
|
1555
|
-
const { data } = findWorkspaceInstanceItemsResponseSchema.parse(json);
|
|
1556
|
-
return { workspaceItems: data.workspaceItems };
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1559
|
-
// v1/client.ts
|
|
1560
|
-
var ApiV1Client = class {
|
|
1561
|
-
baseUrl;
|
|
1562
|
-
apiKey;
|
|
1563
|
-
constructor(config) {
|
|
1564
|
-
if (config?.baseUrl && !config.baseUrl.startsWith("https://")) {
|
|
1565
|
-
throw new Error("API baseUrl must use HTTPS");
|
|
1566
|
-
}
|
|
1567
|
-
this.baseUrl = config?.baseUrl ? config.baseUrl : "https://api.perstack.ai";
|
|
1568
|
-
this.apiKey = config?.apiKey;
|
|
1569
|
-
}
|
|
1570
|
-
async request(endpoint, init, schema) {
|
|
1571
|
-
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
1572
|
-
const endpointUrl = new URL(endpoint);
|
|
1573
|
-
const baseUrlObj = new URL(this.baseUrl);
|
|
1574
|
-
if (endpointUrl.origin !== baseUrlObj.origin) {
|
|
1575
|
-
throw new Error("Endpoint must use the configured baseUrl");
|
|
1576
|
-
}
|
|
1577
|
-
}
|
|
1578
|
-
const url = new URL(endpoint, this.baseUrl);
|
|
1579
|
-
const response = await fetch(url.toString(), init);
|
|
1580
|
-
if (!response.ok) {
|
|
1581
|
-
throw new Error(`Failed to request ${url.toString()}: ${response.statusText}`);
|
|
1582
|
-
}
|
|
1583
|
-
const data = await response.json();
|
|
1584
|
-
if (schema) {
|
|
1585
|
-
return schema.parse(data);
|
|
1586
|
-
}
|
|
1587
|
-
return data;
|
|
1588
|
-
}
|
|
1589
|
-
async requestAuthenticated(endpoint, init, schema) {
|
|
1590
|
-
if (!this.apiKey) {
|
|
1591
|
-
throw new Error("API key is not set");
|
|
1592
|
-
}
|
|
1593
|
-
return this.request(
|
|
1594
|
-
endpoint,
|
|
1595
|
-
{
|
|
1596
|
-
...init,
|
|
1597
|
-
headers: {
|
|
1598
|
-
...init?.headers,
|
|
1599
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
1600
|
-
}
|
|
1601
|
-
},
|
|
1602
|
-
schema
|
|
1603
|
-
);
|
|
1604
|
-
}
|
|
1605
|
-
async requestBlob(endpoint, init) {
|
|
1606
|
-
if (endpoint.startsWith("http://") || endpoint.startsWith("https://")) {
|
|
1607
|
-
const endpointUrl = new URL(endpoint);
|
|
1608
|
-
const baseUrlObj = new URL(this.baseUrl);
|
|
1609
|
-
if (endpointUrl.origin !== baseUrlObj.origin) {
|
|
1610
|
-
throw new Error("Endpoint must use the configured baseUrl");
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
const url = new URL(endpoint, this.baseUrl);
|
|
1614
|
-
const response = await fetch(url.toString(), init);
|
|
1615
|
-
if (!response.ok) {
|
|
1616
|
-
throw new Error(`Failed to request ${url.toString()}: ${response.statusText}`);
|
|
1617
|
-
}
|
|
1618
|
-
return await response.blob();
|
|
1619
|
-
}
|
|
1620
|
-
async requestBlobAuthenticated(endpoint, init) {
|
|
1621
|
-
if (!this.apiKey) {
|
|
1622
|
-
throw new Error("API key is not set");
|
|
1623
|
-
}
|
|
1624
|
-
return this.requestBlob(endpoint, {
|
|
1625
|
-
...init,
|
|
1626
|
-
headers: {
|
|
1627
|
-
...init?.headers,
|
|
1628
|
-
Authorization: `Bearer ${this.apiKey}`
|
|
1629
|
-
// Override
|
|
1630
|
-
}
|
|
1631
|
-
});
|
|
1632
|
-
}
|
|
1633
|
-
registry = {
|
|
1634
|
-
experts: {
|
|
1635
|
-
create: (input) => createRegistryExpert(input, this),
|
|
1636
|
-
get: (input) => getRegistryExpert(input, this),
|
|
1637
|
-
getMany: (input) => getRegistryExperts(input, this),
|
|
1638
|
-
getVersions: (input) => getRegistryExpertVersions(input, this),
|
|
1639
|
-
update: (input) => updateRegistryExpert(input, this),
|
|
1640
|
-
delete: (input) => deleteRegistryExpert(input, this)
|
|
1641
|
-
}
|
|
1642
|
-
};
|
|
1643
|
-
studio = {
|
|
1644
|
-
experts: {
|
|
1645
|
-
create: (input) => createStudioExpert(input, this),
|
|
1646
|
-
get: (input) => getStudioExpert(input, this),
|
|
1647
|
-
getMany: (input) => getStudioExperts(input, this),
|
|
1648
|
-
update: (input) => updateStudioExpert(input, this),
|
|
1649
|
-
delete: (input) => deleteStudioExpert(input, this)
|
|
1650
|
-
},
|
|
1651
|
-
expertJobs: {
|
|
1652
|
-
start: (input) => startExpertJob(input, this),
|
|
1653
|
-
continue: (input) => continueExpertJob(input, this),
|
|
1654
|
-
resumeFromCheckpoint: (input) => resumeExpertJobFromCheckpoint(input, this),
|
|
1655
|
-
get: (input) => getExpertJob(input, this),
|
|
1656
|
-
getMany: (input) => getExpertJobs(input, this),
|
|
1657
|
-
update: (input) => updateExpertJob(input, this),
|
|
1658
|
-
checkpoints: {
|
|
1659
|
-
create: (input) => createCheckpoint(input, this),
|
|
1660
|
-
get: (input) => getCheckpoint(input, this),
|
|
1661
|
-
getMany: (input) => getCheckpoints(input, this)
|
|
1662
|
-
},
|
|
1663
|
-
workspaceInstance: {
|
|
1664
|
-
get: (input) => getWorkspaceInstance(input, this),
|
|
1665
|
-
items: {
|
|
1666
|
-
create: (input) => createWorkspaceInstanceItem(input, this),
|
|
1667
|
-
get: (input) => getWorkspaceInstanceItem(input, this),
|
|
1668
|
-
getMany: (input) => getWorkspaceInstanceItems(input, this),
|
|
1669
|
-
find: (input) => findWorkspaceInstanceItems(input, this),
|
|
1670
|
-
download: (input) => downloadWorkspaceInstanceItem(input, this),
|
|
1671
|
-
update: (input) => updateWorkspaceInstanceItem(input, this),
|
|
1672
|
-
delete: (input) => deleteWorkspaceInstanceItem(input, this)
|
|
1673
|
-
}
|
|
1674
|
-
}
|
|
1675
|
-
},
|
|
1676
|
-
workspace: {
|
|
1677
|
-
get: () => getWorkspace(this),
|
|
1678
|
-
items: {
|
|
1679
|
-
create: (input) => createWorkspaceItem(input, this),
|
|
1680
|
-
get: (input) => getWorkspaceItem(input, this),
|
|
1681
|
-
getMany: (input) => getWorkspaceItems(input, this),
|
|
1682
|
-
download: (input) => downloadWorkspaceItem(input, this),
|
|
1683
|
-
update: (input) => updateWorkspaceItem(input, this),
|
|
1684
|
-
delete: (input) => deleteWorkspaceItem(input, this)
|
|
1685
|
-
},
|
|
1686
|
-
variables: {
|
|
1687
|
-
create: (input) => createWorkspaceVariable(input, this),
|
|
1688
|
-
update: (input) => updateWorkspaceVariable(input, this),
|
|
1689
|
-
delete: (input) => deleteWorkspaceVariable(input, this)
|
|
1690
|
-
},
|
|
1691
|
-
secrets: {
|
|
1692
|
-
create: (input) => createWorkspaceSecret(input, this),
|
|
1693
|
-
delete: (input) => deleteWorkspaceSecret(input, this)
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
};
|
|
1697
|
-
};
|
|
1698
|
-
|
|
1699
|
-
export { ApiError, ApiV1Client, apiApplicationSchema, apiApplicationStatusSchema, apiBaseExpertSchema, apiBaseWorkspaceItemSchema, apiCheckpointActionAppendTextFileSchema, apiCheckpointActionAttemptCompletionSchema, apiCheckpointActionCreateDirectorySchema, apiCheckpointActionDelegateSchema, apiCheckpointActionDeleteFileSchema, apiCheckpointActionEditTextFileSchema, apiCheckpointActionErrorSchema, apiCheckpointActionGeneralToolSchema, apiCheckpointActionGetFileInfoSchema, apiCheckpointActionInteractiveTool, apiCheckpointActionListDirectorySchema, apiCheckpointActionMoveFileSchema, apiCheckpointActionReadImageFileSchema, apiCheckpointActionReadPdfFileSchema, apiCheckpointActionReadTextFileSchema, apiCheckpointActionRetrySchema, apiCheckpointActionSchema, apiCheckpointActionTestUrlSchema, apiCheckpointActionThinkSchema, apiCheckpointActionTodoSchema, apiCheckpointActionWriteTextFileSchema, apiCheckpointSchema, apiCheckpointStatusSchema, apiExpertDigestSchema, apiExpertJobSchema, apiExpertJobStatusSchema, apiExpertSchema, apiInteractiveSkillSchema, apiMcpSseSkillSchema, apiMcpStdioSkillCommandSchema, apiMcpStdioSkillSchema, apiOrganizationSchema, apiOrganizationStatusSchema, apiOrganizationTypeSchema, apiRegistryExpertSchema, apiSkillNameSchema, apiSkillSchema, apiStudioExpertSchema, apiWorkspaceInstanceSchema, apiWorkspaceItemDirectorySchema, apiWorkspaceItemFileSchema, apiWorkspaceItemLifecycleSchema, apiWorkspaceItemOwnerSchema, apiWorkspaceItemPermissionSchema, apiWorkspaceItemSchema, apiWorkspaceSchema, continueExpertJob, createCheckpoint, createRegistryExpert, createStudioExpert, createWorkspaceInstanceItem, createWorkspaceItem, createWorkspaceSecret, createWorkspaceVariable, deleteRegistryExpert, deleteStudioExpert, deleteWorkspaceInstanceItem, deleteWorkspaceItem, deleteWorkspaceSecret, deleteWorkspaceVariable, downloadWorkspaceInstanceItem, downloadWorkspaceItem, findWorkspaceInstanceItems, getCheckpoint, getCheckpoints, getExpertJob, getExpertJobs, getRegistryExpert, getRegistryExpertVersions, getRegistryExperts, getStudioExpert, getStudioExperts, getWorkspace, getWorkspaceInstance, getWorkspaceInstanceItem, getWorkspaceInstanceItems, getWorkspaceItem, getWorkspaceItems, resumeExpertJobFromCheckpoint, startExpertJob, updateExpertJob, updateRegistryExpert, updateStudioExpert, updateWorkspaceInstanceItem, updateWorkspaceItem, updateWorkspaceVariable };
|
|
1700
|
-
//# sourceMappingURL=index.js.map
|
|
1701
|
-
//# sourceMappingURL=index.js.map
|