@keystrokehq/cli 0.0.137 → 0.0.139
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/{discovery-XqwkB9H_-C2XdYbG2.mjs → discovery-DV7FkTRA-BFmtZG9u.mjs} +432 -6
- package/dist/discovery-DV7FkTRA-BFmtZG9u.mjs.map +1 -0
- package/dist/dist-B27Z3YpE.mjs +1737 -0
- package/dist/dist-B27Z3YpE.mjs.map +1 -0
- package/dist/{dist-uZuvgIVp.mjs → dist-CSolAKQe.mjs} +25 -29
- package/dist/dist-CSolAKQe.mjs.map +1 -0
- package/dist/dist-Efdscyea.mjs +676 -0
- package/dist/dist-Efdscyea.mjs.map +1 -0
- package/dist/index.mjs +338 -2473
- package/dist/index.mjs.map +1 -1
- package/dist/walk-project-171B4cvO-DJy3qZKd.mjs +102 -0
- package/dist/walk-project-171B4cvO-DJy3qZKd.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/discovery-XqwkB9H_-C2XdYbG2.mjs.map +0 -1
- package/dist/dist-uZuvgIVp.mjs.map +0 -1
|
@@ -0,0 +1,1737 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { S as _coercedNumber, _ as string, a as ZodNumber, b as url, d as custom, f as discriminatedUnion, g as record, h as object, l as array, m as number$1, o as ZodType, p as literal, s as _enum, u as boolean, v as union, y as unknown } from "./discovery-DV7FkTRA-BFmtZG9u.mjs";
|
|
3
|
+
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
|
|
4
|
+
function number(params) {
|
|
5
|
+
return _coercedNumber(ZodNumber, params);
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region ../../packages/shared/dist/index.mjs
|
|
9
|
+
const ACTIVE_ORG_HEADER = "x-keystroke-org-id";
|
|
10
|
+
/** Auth, session, and account-entry URL segments. */
|
|
11
|
+
const AUTH_ACCOUNT_SLUGS = [
|
|
12
|
+
"2fa",
|
|
13
|
+
"accept-invite",
|
|
14
|
+
"auth",
|
|
15
|
+
"authorize",
|
|
16
|
+
"callback",
|
|
17
|
+
"callbacks",
|
|
18
|
+
"confirm-email",
|
|
19
|
+
"confirmation",
|
|
20
|
+
"connect",
|
|
21
|
+
"device",
|
|
22
|
+
"email-verification",
|
|
23
|
+
"forgot-password",
|
|
24
|
+
"invite",
|
|
25
|
+
"invites",
|
|
26
|
+
"login",
|
|
27
|
+
"logout",
|
|
28
|
+
"magic-link",
|
|
29
|
+
"mfa",
|
|
30
|
+
"oauth",
|
|
31
|
+
"onboarding",
|
|
32
|
+
"password",
|
|
33
|
+
"recovery",
|
|
34
|
+
"register",
|
|
35
|
+
"reset-password",
|
|
36
|
+
"saml",
|
|
37
|
+
"session",
|
|
38
|
+
"sessions",
|
|
39
|
+
"sign-in",
|
|
40
|
+
"sign-up",
|
|
41
|
+
"signin",
|
|
42
|
+
"signout",
|
|
43
|
+
"signup",
|
|
44
|
+
"sso",
|
|
45
|
+
"token",
|
|
46
|
+
"tokens",
|
|
47
|
+
"unlink",
|
|
48
|
+
"verify",
|
|
49
|
+
"verify-email"
|
|
50
|
+
];
|
|
51
|
+
/** Org, workspace, billing, and account-management URL segments. */
|
|
52
|
+
const ORG_ACCOUNT_SLUGS = [
|
|
53
|
+
"account",
|
|
54
|
+
"accounts",
|
|
55
|
+
"billing",
|
|
56
|
+
"console",
|
|
57
|
+
"invoice",
|
|
58
|
+
"invoices",
|
|
59
|
+
"member",
|
|
60
|
+
"members",
|
|
61
|
+
"me",
|
|
62
|
+
"org",
|
|
63
|
+
"organization",
|
|
64
|
+
"organizations",
|
|
65
|
+
"orgs",
|
|
66
|
+
"payment",
|
|
67
|
+
"payments",
|
|
68
|
+
"plan",
|
|
69
|
+
"plans",
|
|
70
|
+
"portal",
|
|
71
|
+
"preferences",
|
|
72
|
+
"profile",
|
|
73
|
+
"settings",
|
|
74
|
+
"subscription",
|
|
75
|
+
"subscriptions",
|
|
76
|
+
"team",
|
|
77
|
+
"teams",
|
|
78
|
+
"upgrade",
|
|
79
|
+
"usage",
|
|
80
|
+
"user",
|
|
81
|
+
"users",
|
|
82
|
+
"workspace",
|
|
83
|
+
"workspaces"
|
|
84
|
+
];
|
|
85
|
+
/** Product surfaces, resource types, and in-app navigation segments. */
|
|
86
|
+
const PRODUCT_SLUGS = [
|
|
87
|
+
"action",
|
|
88
|
+
"actions",
|
|
89
|
+
"activity",
|
|
90
|
+
"agent",
|
|
91
|
+
"agents",
|
|
92
|
+
"analytics",
|
|
93
|
+
"app",
|
|
94
|
+
"apps",
|
|
95
|
+
"artifact",
|
|
96
|
+
"artifacts",
|
|
97
|
+
"assistant",
|
|
98
|
+
"assistants",
|
|
99
|
+
"audit",
|
|
100
|
+
"audit-log",
|
|
101
|
+
"automation",
|
|
102
|
+
"automations",
|
|
103
|
+
"branch",
|
|
104
|
+
"branches",
|
|
105
|
+
"canvas",
|
|
106
|
+
"chat",
|
|
107
|
+
"chats",
|
|
108
|
+
"connection",
|
|
109
|
+
"connections",
|
|
110
|
+
"create",
|
|
111
|
+
"credential",
|
|
112
|
+
"credentials",
|
|
113
|
+
"dashboard",
|
|
114
|
+
"deployment",
|
|
115
|
+
"deployments",
|
|
116
|
+
"examples",
|
|
117
|
+
"execute",
|
|
118
|
+
"execution",
|
|
119
|
+
"executions",
|
|
120
|
+
"explore",
|
|
121
|
+
"get-started",
|
|
122
|
+
"history",
|
|
123
|
+
"inbox",
|
|
124
|
+
"inspector",
|
|
125
|
+
"integration",
|
|
126
|
+
"integrations",
|
|
127
|
+
"library",
|
|
128
|
+
"logs",
|
|
129
|
+
"marketplace",
|
|
130
|
+
"mcp",
|
|
131
|
+
"mcps",
|
|
132
|
+
"new",
|
|
133
|
+
"notifications",
|
|
134
|
+
"observe",
|
|
135
|
+
"plugin",
|
|
136
|
+
"plugins",
|
|
137
|
+
"primitive",
|
|
138
|
+
"primitives",
|
|
139
|
+
"project",
|
|
140
|
+
"projects",
|
|
141
|
+
"recents",
|
|
142
|
+
"registry",
|
|
143
|
+
"reports",
|
|
144
|
+
"run",
|
|
145
|
+
"runs",
|
|
146
|
+
"runtime",
|
|
147
|
+
"runtimes",
|
|
148
|
+
"sandbox",
|
|
149
|
+
"sandboxes",
|
|
150
|
+
"search",
|
|
151
|
+
"skill",
|
|
152
|
+
"skills",
|
|
153
|
+
"templates",
|
|
154
|
+
"thread",
|
|
155
|
+
"threads",
|
|
156
|
+
"trigger",
|
|
157
|
+
"triggers",
|
|
158
|
+
"version",
|
|
159
|
+
"versions",
|
|
160
|
+
"workflow",
|
|
161
|
+
"workflows"
|
|
162
|
+
];
|
|
163
|
+
/** Marketing, docs, company, and go-to-market URL segments. */
|
|
164
|
+
const MARKETING_SITE_SLUGS = [
|
|
165
|
+
"about",
|
|
166
|
+
"affiliates",
|
|
167
|
+
"ai",
|
|
168
|
+
"announcements",
|
|
169
|
+
"anthropic",
|
|
170
|
+
"blog",
|
|
171
|
+
"book-demo",
|
|
172
|
+
"brand",
|
|
173
|
+
"campaigns",
|
|
174
|
+
"career",
|
|
175
|
+
"careers",
|
|
176
|
+
"case-studies",
|
|
177
|
+
"casestudies",
|
|
178
|
+
"changelog",
|
|
179
|
+
"chatgpt",
|
|
180
|
+
"chrome-extension",
|
|
181
|
+
"claude",
|
|
182
|
+
"codex",
|
|
183
|
+
"community",
|
|
184
|
+
"company",
|
|
185
|
+
"compare",
|
|
186
|
+
"contact",
|
|
187
|
+
"contribute",
|
|
188
|
+
"creators",
|
|
189
|
+
"customers",
|
|
190
|
+
"demo",
|
|
191
|
+
"demos",
|
|
192
|
+
"discord",
|
|
193
|
+
"docs",
|
|
194
|
+
"documentation",
|
|
195
|
+
"download",
|
|
196
|
+
"downloads",
|
|
197
|
+
"dust",
|
|
198
|
+
"emerging-talent",
|
|
199
|
+
"engineering-blog",
|
|
200
|
+
"enterprise",
|
|
201
|
+
"events",
|
|
202
|
+
"experts",
|
|
203
|
+
"extension",
|
|
204
|
+
"faq",
|
|
205
|
+
"faqs",
|
|
206
|
+
"features",
|
|
207
|
+
"forum",
|
|
208
|
+
"glean",
|
|
209
|
+
"grok",
|
|
210
|
+
"guide",
|
|
211
|
+
"guides",
|
|
212
|
+
"gumloop",
|
|
213
|
+
"handbook",
|
|
214
|
+
"help",
|
|
215
|
+
"help-center",
|
|
216
|
+
"home",
|
|
217
|
+
"how-it-works",
|
|
218
|
+
"howitworks",
|
|
219
|
+
"inspo",
|
|
220
|
+
"intern",
|
|
221
|
+
"investors",
|
|
222
|
+
"jobs",
|
|
223
|
+
"legal",
|
|
224
|
+
"lindy",
|
|
225
|
+
"llm",
|
|
226
|
+
"llms",
|
|
227
|
+
"love",
|
|
228
|
+
"make",
|
|
229
|
+
"manifesto",
|
|
230
|
+
"media",
|
|
231
|
+
"merch",
|
|
232
|
+
"mission",
|
|
233
|
+
"mobile",
|
|
234
|
+
"models",
|
|
235
|
+
"n8n",
|
|
236
|
+
"news",
|
|
237
|
+
"newsroom",
|
|
238
|
+
"open",
|
|
239
|
+
"open-claw",
|
|
240
|
+
"open-source",
|
|
241
|
+
"openai",
|
|
242
|
+
"our-story",
|
|
243
|
+
"overview",
|
|
244
|
+
"partners",
|
|
245
|
+
"pi",
|
|
246
|
+
"pipedream",
|
|
247
|
+
"platform",
|
|
248
|
+
"press",
|
|
249
|
+
"press-kit",
|
|
250
|
+
"pricing",
|
|
251
|
+
"privacy",
|
|
252
|
+
"product",
|
|
253
|
+
"products",
|
|
254
|
+
"provider",
|
|
255
|
+
"providers",
|
|
256
|
+
"quick-start",
|
|
257
|
+
"quickstart",
|
|
258
|
+
"refer",
|
|
259
|
+
"relay",
|
|
260
|
+
"relay-app",
|
|
261
|
+
"reporting",
|
|
262
|
+
"request-demo",
|
|
263
|
+
"resources",
|
|
264
|
+
"roadmap",
|
|
265
|
+
"schedule-demo",
|
|
266
|
+
"security",
|
|
267
|
+
"solutions",
|
|
268
|
+
"stack-ai",
|
|
269
|
+
"stackai",
|
|
270
|
+
"startup",
|
|
271
|
+
"startups",
|
|
272
|
+
"status",
|
|
273
|
+
"stories",
|
|
274
|
+
"story",
|
|
275
|
+
"students",
|
|
276
|
+
"support",
|
|
277
|
+
"swag",
|
|
278
|
+
"switch",
|
|
279
|
+
"talent",
|
|
280
|
+
"terms",
|
|
281
|
+
"testimonials",
|
|
282
|
+
"thesis",
|
|
283
|
+
"tines",
|
|
284
|
+
"trust",
|
|
285
|
+
"tutorials",
|
|
286
|
+
"university",
|
|
287
|
+
"use-case",
|
|
288
|
+
"use-cases",
|
|
289
|
+
"usecases",
|
|
290
|
+
"versus",
|
|
291
|
+
"vellum",
|
|
292
|
+
"vs",
|
|
293
|
+
"webinars",
|
|
294
|
+
"workato",
|
|
295
|
+
"xai",
|
|
296
|
+
"yc",
|
|
297
|
+
"zapier"
|
|
298
|
+
];
|
|
299
|
+
/** Integrations, competitors, and partner brand slugs (marketing / integration pages). */
|
|
300
|
+
const INTEGRATION_BRAND_SLUGS = [
|
|
301
|
+
"airtable",
|
|
302
|
+
"asana",
|
|
303
|
+
"aws",
|
|
304
|
+
"azure",
|
|
305
|
+
"bun",
|
|
306
|
+
"confluence",
|
|
307
|
+
"copilot",
|
|
308
|
+
"cursor",
|
|
309
|
+
"databricks",
|
|
310
|
+
"figma",
|
|
311
|
+
"firebase",
|
|
312
|
+
"fly",
|
|
313
|
+
"gcp",
|
|
314
|
+
"gemini",
|
|
315
|
+
"github",
|
|
316
|
+
"gitlab",
|
|
317
|
+
"gmail",
|
|
318
|
+
"heroku",
|
|
319
|
+
"hubspot",
|
|
320
|
+
"huggingface",
|
|
321
|
+
"jira",
|
|
322
|
+
"linear",
|
|
323
|
+
"mailchimp",
|
|
324
|
+
"meta",
|
|
325
|
+
"mistral",
|
|
326
|
+
"mixmax",
|
|
327
|
+
"monday",
|
|
328
|
+
"netlify",
|
|
329
|
+
"neon",
|
|
330
|
+
"notion",
|
|
331
|
+
"npm",
|
|
332
|
+
"outlook",
|
|
333
|
+
"outreach",
|
|
334
|
+
"perplexity",
|
|
335
|
+
"planetscale",
|
|
336
|
+
"pnpm",
|
|
337
|
+
"postmark",
|
|
338
|
+
"ramp",
|
|
339
|
+
"railway",
|
|
340
|
+
"render",
|
|
341
|
+
"resend",
|
|
342
|
+
"salesforce",
|
|
343
|
+
"segment",
|
|
344
|
+
"sendgrid",
|
|
345
|
+
"shopify",
|
|
346
|
+
"slack",
|
|
347
|
+
"snowflake",
|
|
348
|
+
"stripe",
|
|
349
|
+
"supabase",
|
|
350
|
+
"terraform",
|
|
351
|
+
"trello",
|
|
352
|
+
"turso",
|
|
353
|
+
"twilio",
|
|
354
|
+
"typeform",
|
|
355
|
+
"vercel",
|
|
356
|
+
"vscode",
|
|
357
|
+
"windsurf",
|
|
358
|
+
"yarn"
|
|
359
|
+
];
|
|
360
|
+
/** Company, team, and department landing-page segments. */
|
|
361
|
+
const COMPANY_TEAM_SLUGS = [
|
|
362
|
+
"engineers",
|
|
363
|
+
"engineering",
|
|
364
|
+
"executives",
|
|
365
|
+
"hc",
|
|
366
|
+
"intern",
|
|
367
|
+
"it",
|
|
368
|
+
"leadership",
|
|
369
|
+
"marketing",
|
|
370
|
+
"ops",
|
|
371
|
+
"revops",
|
|
372
|
+
"sales",
|
|
373
|
+
"services",
|
|
374
|
+
"tech"
|
|
375
|
+
];
|
|
376
|
+
/** Legal, trust, compliance, and policy URL segments. */
|
|
377
|
+
const LEGAL_TRUST_SLUGS = [
|
|
378
|
+
"accessibility",
|
|
379
|
+
"agreement",
|
|
380
|
+
"a11y",
|
|
381
|
+
"bug-bounty",
|
|
382
|
+
"compliance",
|
|
383
|
+
"cookie-policy",
|
|
384
|
+
"cookies",
|
|
385
|
+
"disclose",
|
|
386
|
+
"dpa",
|
|
387
|
+
"eula",
|
|
388
|
+
"gdpr",
|
|
389
|
+
"hipaa",
|
|
390
|
+
"iso",
|
|
391
|
+
"msa",
|
|
392
|
+
"pci",
|
|
393
|
+
"responsible-disclosure",
|
|
394
|
+
"sla",
|
|
395
|
+
"soc2",
|
|
396
|
+
"tos",
|
|
397
|
+
"trust-center",
|
|
398
|
+
"trustcenter",
|
|
399
|
+
"vulnerability"
|
|
400
|
+
];
|
|
401
|
+
/** Developer, API, CLI, and technical URL segments. */
|
|
402
|
+
const DEVELOPER_TECH_SLUGS = [
|
|
403
|
+
"api",
|
|
404
|
+
"api-docs",
|
|
405
|
+
"cli",
|
|
406
|
+
"code",
|
|
407
|
+
"config",
|
|
408
|
+
"developer",
|
|
409
|
+
"developer-tools",
|
|
410
|
+
"developers",
|
|
411
|
+
"dev-tools",
|
|
412
|
+
"devtools",
|
|
413
|
+
"dev",
|
|
414
|
+
"dev-states",
|
|
415
|
+
"graphql",
|
|
416
|
+
"graphql-playground",
|
|
417
|
+
"mcp-server",
|
|
418
|
+
"mcp-servers",
|
|
419
|
+
"openapi",
|
|
420
|
+
"sdk",
|
|
421
|
+
"swagger"
|
|
422
|
+
];
|
|
423
|
+
/** Infra, ops, static assets, and system URL segments. */
|
|
424
|
+
const INFRA_SYSTEM_SLUGS = [
|
|
425
|
+
"acme-challenge",
|
|
426
|
+
"admin",
|
|
427
|
+
"apple-app-site-association",
|
|
428
|
+
"assets",
|
|
429
|
+
"batch",
|
|
430
|
+
"cache",
|
|
431
|
+
"cdn",
|
|
432
|
+
"cron",
|
|
433
|
+
"debug",
|
|
434
|
+
"error",
|
|
435
|
+
"errors",
|
|
436
|
+
"favicon",
|
|
437
|
+
"feed",
|
|
438
|
+
"files",
|
|
439
|
+
"health",
|
|
440
|
+
"healthcheck",
|
|
441
|
+
"healthz",
|
|
442
|
+
"hooks",
|
|
443
|
+
"internal",
|
|
444
|
+
"item",
|
|
445
|
+
"manifest",
|
|
446
|
+
"metrics",
|
|
447
|
+
"null",
|
|
448
|
+
"ping",
|
|
449
|
+
"prod",
|
|
450
|
+
"public",
|
|
451
|
+
"redirect",
|
|
452
|
+
"robots",
|
|
453
|
+
"rpc",
|
|
454
|
+
"rss",
|
|
455
|
+
"sharer",
|
|
456
|
+
"sitemap",
|
|
457
|
+
"staging",
|
|
458
|
+
"static",
|
|
459
|
+
"storage",
|
|
460
|
+
"test",
|
|
461
|
+
"undefined",
|
|
462
|
+
"universal",
|
|
463
|
+
"webhooks",
|
|
464
|
+
"well-known",
|
|
465
|
+
"www"
|
|
466
|
+
];
|
|
467
|
+
/** Reserved slugs that are valid org names in theory but blocked for routing safety. */
|
|
468
|
+
const ROUTING_SAFETY_SLUGS = [
|
|
469
|
+
"alpha",
|
|
470
|
+
"anonymous",
|
|
471
|
+
"archive",
|
|
472
|
+
"archived",
|
|
473
|
+
"beta",
|
|
474
|
+
"clone",
|
|
475
|
+
"copy",
|
|
476
|
+
"default",
|
|
477
|
+
"deleted",
|
|
478
|
+
"demo-org",
|
|
479
|
+
"draft",
|
|
480
|
+
"drafts",
|
|
481
|
+
"duplicate",
|
|
482
|
+
"early-access",
|
|
483
|
+
"embed",
|
|
484
|
+
"embedded",
|
|
485
|
+
"export",
|
|
486
|
+
"fork",
|
|
487
|
+
"free",
|
|
488
|
+
"guest",
|
|
489
|
+
"import",
|
|
490
|
+
"index",
|
|
491
|
+
"list",
|
|
492
|
+
"manage",
|
|
493
|
+
"moderator",
|
|
494
|
+
"newsletter",
|
|
495
|
+
"owner",
|
|
496
|
+
"preview",
|
|
497
|
+
"previews",
|
|
498
|
+
"private",
|
|
499
|
+
"pro",
|
|
500
|
+
"public-api",
|
|
501
|
+
"publish",
|
|
502
|
+
"published",
|
|
503
|
+
"queue",
|
|
504
|
+
"remove",
|
|
505
|
+
"root",
|
|
506
|
+
"sample",
|
|
507
|
+
"samples",
|
|
508
|
+
"selection",
|
|
509
|
+
"share",
|
|
510
|
+
"shared",
|
|
511
|
+
"sponsor",
|
|
512
|
+
"sponsors",
|
|
513
|
+
"sponsorship",
|
|
514
|
+
"subscribe",
|
|
515
|
+
"super",
|
|
516
|
+
"superuser",
|
|
517
|
+
"system",
|
|
518
|
+
"sys",
|
|
519
|
+
"test-org",
|
|
520
|
+
"trash",
|
|
521
|
+
"unpublish",
|
|
522
|
+
"unsubscribe",
|
|
523
|
+
"upload",
|
|
524
|
+
"uploads",
|
|
525
|
+
"waitlist",
|
|
526
|
+
"widget",
|
|
527
|
+
"widgets",
|
|
528
|
+
"worker",
|
|
529
|
+
"workers"
|
|
530
|
+
];
|
|
531
|
+
/**
|
|
532
|
+
* URL segments reserved for global (non-org) routes — cannot be used as an org slug.
|
|
533
|
+
* Prefer adding new entries to the category arrays above; the Set is the enforcement surface.
|
|
534
|
+
*/
|
|
535
|
+
const RESERVED_ORGANIZATION_SLUGS = new Set([
|
|
536
|
+
...AUTH_ACCOUNT_SLUGS,
|
|
537
|
+
...ORG_ACCOUNT_SLUGS,
|
|
538
|
+
...PRODUCT_SLUGS,
|
|
539
|
+
...MARKETING_SITE_SLUGS,
|
|
540
|
+
...INTEGRATION_BRAND_SLUGS,
|
|
541
|
+
...COMPANY_TEAM_SLUGS,
|
|
542
|
+
...LEGAL_TRUST_SLUGS,
|
|
543
|
+
...DEVELOPER_TECH_SLUGS,
|
|
544
|
+
...INFRA_SYSTEM_SLUGS,
|
|
545
|
+
...ROUTING_SAFETY_SLUGS
|
|
546
|
+
]);
|
|
547
|
+
/**
|
|
548
|
+
* Base slug format: lowercase, 2-64 chars, alphanumeric + dashes.
|
|
549
|
+
*
|
|
550
|
+
* IMPORTANT: this is the schema for *reading* slugs (persisted rows, API
|
|
551
|
+
* responses). It intentionally does NOT enforce the reserved-name list — an org
|
|
552
|
+
* created before a name became reserved must still parse on read. Use
|
|
553
|
+
* `ClaimableOrganizationSlugSchema` to validate slugs a user is trying to claim.
|
|
554
|
+
*/
|
|
555
|
+
const OrganizationSlugSchema = string().trim().toLowerCase().min(2, "Slug must be at least 2 characters").max(64, "Slug must be at most 64 characters").regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "Use lowercase letters, numbers, and dashes only");
|
|
556
|
+
/**
|
|
557
|
+
* Slug validation for *claiming* a slug (organization create/rename). Adds the
|
|
558
|
+
* reserved-name check on top of the base format. Never use this to parse
|
|
559
|
+
* existing org data, or pre-existing orgs whose slug later became reserved would
|
|
560
|
+
* fail to load.
|
|
561
|
+
*/
|
|
562
|
+
const ClaimableOrganizationSlugSchema = OrganizationSlugSchema.refine((slug) => !RESERVED_ORGANIZATION_SLUGS.has(slug), "This slug is reserved");
|
|
563
|
+
/** Same format as organization slugs — org-scoped, no global reserved list. */
|
|
564
|
+
const ProjectSlugSchema = OrganizationSlugSchema;
|
|
565
|
+
/** Browser→platform request budget (ping + small platform overhead). */
|
|
566
|
+
const PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS = 17e3;
|
|
567
|
+
/** Normalize a public origin URL (no trailing slash). */
|
|
568
|
+
function originFromPublicUrl(value, fallback) {
|
|
569
|
+
const trimmed = value?.trim();
|
|
570
|
+
if (!trimmed) return fallback.replace(/\/+$/, "");
|
|
571
|
+
return trimmed.replace(/\/+$/, "");
|
|
572
|
+
}
|
|
573
|
+
/** TCP port to bind for a local server, derived from a public URL. */
|
|
574
|
+
function listenPortFromUrl(url, fallback) {
|
|
575
|
+
const parsed = new URL(url);
|
|
576
|
+
if (parsed.port) {
|
|
577
|
+
const port = Number(parsed.port);
|
|
578
|
+
if (Number.isFinite(port) && port > 0) return port;
|
|
579
|
+
}
|
|
580
|
+
if (parsed.protocol === "https:") return 443;
|
|
581
|
+
if (parsed.protocol === "http:") return 80;
|
|
582
|
+
return fallback;
|
|
583
|
+
}
|
|
584
|
+
/** Shorthand: listen port from `PUBLIC_*_URL` or fallback. */
|
|
585
|
+
function listenPortFromPublicUrl(value, fallback) {
|
|
586
|
+
const trimmed = value?.trim();
|
|
587
|
+
if (!trimmed) return fallback;
|
|
588
|
+
try {
|
|
589
|
+
return listenPortFromUrl(trimmed, fallback);
|
|
590
|
+
} catch {
|
|
591
|
+
return fallback;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
/** On-disk path under the project root (packed in deploy artifacts when present). */
|
|
595
|
+
const ROUTE_MANIFEST_REL_PATH = "dist/.keystroke/route-manifest.json";
|
|
596
|
+
const StoredRouteManifestSkillSchema = object({
|
|
597
|
+
slug: string(),
|
|
598
|
+
name: string().optional(),
|
|
599
|
+
description: string().optional(),
|
|
600
|
+
moduleFile: string()
|
|
601
|
+
});
|
|
602
|
+
const serializedRouteManifestEntrySchema = discriminatedUnion("kind", [
|
|
603
|
+
object({
|
|
604
|
+
kind: literal("health"),
|
|
605
|
+
method: literal("GET"),
|
|
606
|
+
path: literal("/health")
|
|
607
|
+
}),
|
|
608
|
+
object({
|
|
609
|
+
kind: literal("agent"),
|
|
610
|
+
method: literal("POST"),
|
|
611
|
+
path: string(),
|
|
612
|
+
agentSlug: string(),
|
|
613
|
+
moduleFile: string(),
|
|
614
|
+
name: string().optional(),
|
|
615
|
+
description: string().optional(),
|
|
616
|
+
model: string(),
|
|
617
|
+
systemPrompt: string(),
|
|
618
|
+
toolCount: number$1().int().nonnegative(),
|
|
619
|
+
credentialCount: number$1().int().nonnegative(),
|
|
620
|
+
requestSchema: record(string(), unknown()),
|
|
621
|
+
responseSchema: record(string(), unknown())
|
|
622
|
+
}),
|
|
623
|
+
object({
|
|
624
|
+
kind: literal("agent-sessions-list"),
|
|
625
|
+
method: literal("GET"),
|
|
626
|
+
path: string(),
|
|
627
|
+
agentSlug: string(),
|
|
628
|
+
moduleFile: string()
|
|
629
|
+
}),
|
|
630
|
+
object({
|
|
631
|
+
kind: literal("agent-session-detail"),
|
|
632
|
+
method: literal("GET"),
|
|
633
|
+
path: string(),
|
|
634
|
+
agentSlug: string(),
|
|
635
|
+
moduleFile: string()
|
|
636
|
+
}),
|
|
637
|
+
object({
|
|
638
|
+
kind: literal("workflow"),
|
|
639
|
+
method: literal("POST"),
|
|
640
|
+
path: string(),
|
|
641
|
+
workflowSlug: string(),
|
|
642
|
+
workflowName: string().optional(),
|
|
643
|
+
description: string().optional(),
|
|
644
|
+
subscribable: boolean(),
|
|
645
|
+
moduleFile: string(),
|
|
646
|
+
requestSchema: record(string(), unknown()),
|
|
647
|
+
responseSchema: record(string(), unknown())
|
|
648
|
+
}),
|
|
649
|
+
object({
|
|
650
|
+
kind: literal("workflow-runs-list"),
|
|
651
|
+
method: literal("GET"),
|
|
652
|
+
path: string(),
|
|
653
|
+
workflowSlug: string(),
|
|
654
|
+
workflowName: string().optional(),
|
|
655
|
+
moduleFile: string()
|
|
656
|
+
}),
|
|
657
|
+
object({
|
|
658
|
+
kind: literal("workflow-run-detail"),
|
|
659
|
+
method: literal("GET"),
|
|
660
|
+
path: string(),
|
|
661
|
+
workflowSlug: string(),
|
|
662
|
+
workflowName: string().optional(),
|
|
663
|
+
moduleFile: string()
|
|
664
|
+
}),
|
|
665
|
+
object({
|
|
666
|
+
kind: literal("trigger-webhook"),
|
|
667
|
+
method: literal("POST"),
|
|
668
|
+
path: string(),
|
|
669
|
+
attachmentIds: array(string()),
|
|
670
|
+
moduleFile: string(),
|
|
671
|
+
requestSchema: record(string(), unknown()),
|
|
672
|
+
attachmentSchemas: record(string(), object({
|
|
673
|
+
requestSchema: record(string(), unknown()),
|
|
674
|
+
filterSchema: record(string(), unknown()).optional()
|
|
675
|
+
})),
|
|
676
|
+
responseSchema: record(string(), unknown())
|
|
677
|
+
}),
|
|
678
|
+
object({
|
|
679
|
+
kind: literal("trigger-poll"),
|
|
680
|
+
method: literal("POST"),
|
|
681
|
+
path: string(),
|
|
682
|
+
attachmentId: string(),
|
|
683
|
+
moduleFile: string(),
|
|
684
|
+
schedule: string(),
|
|
685
|
+
responseSchema: record(string(), unknown())
|
|
686
|
+
}),
|
|
687
|
+
object({
|
|
688
|
+
kind: literal("trigger-poll-group"),
|
|
689
|
+
method: literal("POST"),
|
|
690
|
+
path: string(),
|
|
691
|
+
pollId: string(),
|
|
692
|
+
attachmentIds: array(string()),
|
|
693
|
+
moduleFile: string(),
|
|
694
|
+
schedule: string(),
|
|
695
|
+
responseSchema: record(string(), unknown())
|
|
696
|
+
}),
|
|
697
|
+
object({
|
|
698
|
+
kind: literal("trigger-runs-list"),
|
|
699
|
+
method: literal("GET"),
|
|
700
|
+
path: string(),
|
|
701
|
+
attachmentId: string(),
|
|
702
|
+
moduleFile: string()
|
|
703
|
+
}),
|
|
704
|
+
object({
|
|
705
|
+
kind: literal("trigger-run-detail"),
|
|
706
|
+
method: literal("GET"),
|
|
707
|
+
path: string(),
|
|
708
|
+
attachmentId: string(),
|
|
709
|
+
moduleFile: string()
|
|
710
|
+
}),
|
|
711
|
+
object({
|
|
712
|
+
kind: literal("cron-schedule"),
|
|
713
|
+
attachmentId: string(),
|
|
714
|
+
moduleFile: string(),
|
|
715
|
+
schedule: string()
|
|
716
|
+
}),
|
|
717
|
+
object({
|
|
718
|
+
kind: literal("plugin"),
|
|
719
|
+
method: _enum([
|
|
720
|
+
"GET",
|
|
721
|
+
"POST",
|
|
722
|
+
"PUT",
|
|
723
|
+
"PATCH",
|
|
724
|
+
"DELETE"
|
|
725
|
+
]),
|
|
726
|
+
path: string(),
|
|
727
|
+
plugin: string()
|
|
728
|
+
})
|
|
729
|
+
]);
|
|
730
|
+
object({
|
|
731
|
+
version: literal(1),
|
|
732
|
+
entries: array(serializedRouteManifestEntrySchema),
|
|
733
|
+
skills: array(StoredRouteManifestSkillSchema).default([]),
|
|
734
|
+
integrations: array(string()).optional()
|
|
735
|
+
});
|
|
736
|
+
/** How a credential instance is stored (`credential_instances.auth_kind`). */
|
|
737
|
+
const CredentialAuthKindSchema = _enum(["api_key", "oauth_managed"]);
|
|
738
|
+
/** Where a credential instance is stored (`credential_instances.scope_type`). */
|
|
739
|
+
const CredentialScopeTypeSchema = _enum([
|
|
740
|
+
"global",
|
|
741
|
+
"organization",
|
|
742
|
+
"project",
|
|
743
|
+
"user"
|
|
744
|
+
]);
|
|
745
|
+
/**
|
|
746
|
+
* Resolution chain step when an action/tool looks up credentials.
|
|
747
|
+
* `selection` uses explicit instance ids; other levels map to {@link CredentialScopeType}.
|
|
748
|
+
*/
|
|
749
|
+
const CredentialScopeLevelSchema = _enum([
|
|
750
|
+
"selection",
|
|
751
|
+
"organization",
|
|
752
|
+
"project",
|
|
753
|
+
"user"
|
|
754
|
+
]);
|
|
755
|
+
CredentialAuthKindSchema.options;
|
|
756
|
+
CredentialScopeTypeSchema.options;
|
|
757
|
+
CredentialScopeLevelSchema.options;
|
|
758
|
+
/** Default chain when `credential.static(...).scope()` is called with no args. */
|
|
759
|
+
const DEFAULT_CREDENTIAL_RESOLUTION_CHAIN = ["organization", "project"];
|
|
760
|
+
function isCredentialInput(value) {
|
|
761
|
+
if (typeof value !== "object" || value === null) return false;
|
|
762
|
+
const candidate = value;
|
|
763
|
+
return typeof candidate.key === "string" && CredentialAuthKindSchema.safeParse(candidate.kind).success && candidate.schema instanceof ZodType;
|
|
764
|
+
}
|
|
765
|
+
custom((value) => isCredentialInput(value), "must be a credential requirement");
|
|
766
|
+
function normalizeCredentialList(list) {
|
|
767
|
+
return list.map((item) => toCredentialRequirement(item));
|
|
768
|
+
}
|
|
769
|
+
function isCredentialRequirement(item) {
|
|
770
|
+
return "chain" in item;
|
|
771
|
+
}
|
|
772
|
+
function toCredentialRequirement(item) {
|
|
773
|
+
if (isCredentialRequirement(item)) return item;
|
|
774
|
+
return {
|
|
775
|
+
key: item.key,
|
|
776
|
+
kind: item.kind,
|
|
777
|
+
schema: item.schema,
|
|
778
|
+
chain: DEFAULT_CREDENTIAL_RESOLUTION_CHAIN,
|
|
779
|
+
...item.tokenField !== void 0 ? { tokenField: item.tokenField } : {}
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
const OrganizationSlugErrorCodeSchema = _enum([
|
|
783
|
+
"slug_taken",
|
|
784
|
+
"slug_reserved",
|
|
785
|
+
"slug_invalid"
|
|
786
|
+
]);
|
|
787
|
+
const SlugAvailabilityReasonSchema = _enum([
|
|
788
|
+
"taken",
|
|
789
|
+
"reserved",
|
|
790
|
+
"invalid"
|
|
791
|
+
]);
|
|
792
|
+
const SlugAvailabilityResponseSchema = object({
|
|
793
|
+
slug: string(),
|
|
794
|
+
available: boolean(),
|
|
795
|
+
reason: SlugAvailabilityReasonSchema.optional(),
|
|
796
|
+
suggestion: OrganizationSlugSchema.optional()
|
|
797
|
+
});
|
|
798
|
+
object({
|
|
799
|
+
slug: string().trim().min(1),
|
|
800
|
+
excludeOrganizationId: string().min(1).optional()
|
|
801
|
+
});
|
|
802
|
+
const ProjectSlugAvailabilityReasonSchema = _enum(["taken", "invalid"]);
|
|
803
|
+
const ProjectSlugAvailabilityResponseSchema = object({
|
|
804
|
+
slug: string(),
|
|
805
|
+
available: boolean(),
|
|
806
|
+
reason: ProjectSlugAvailabilityReasonSchema.optional(),
|
|
807
|
+
suggestion: ProjectSlugSchema.optional()
|
|
808
|
+
});
|
|
809
|
+
object({
|
|
810
|
+
slug: string().trim().min(1),
|
|
811
|
+
excludeProjectId: string().min(1).optional()
|
|
812
|
+
});
|
|
813
|
+
const ProjectStatusSchema = _enum([
|
|
814
|
+
"inactive",
|
|
815
|
+
"starting",
|
|
816
|
+
"active",
|
|
817
|
+
"failed"
|
|
818
|
+
]);
|
|
819
|
+
const OrganizationUserRoleSchema = _enum([
|
|
820
|
+
"owner",
|
|
821
|
+
"admin",
|
|
822
|
+
"builder"
|
|
823
|
+
]);
|
|
824
|
+
const isoDateTime$3 = string().datetime();
|
|
825
|
+
const OrganizationSchema = object({
|
|
826
|
+
id: string(),
|
|
827
|
+
name: string(),
|
|
828
|
+
slug: OrganizationSlugSchema,
|
|
829
|
+
createdAt: isoDateTime$3,
|
|
830
|
+
updatedAt: isoDateTime$3
|
|
831
|
+
});
|
|
832
|
+
const ProjectSchema = object({
|
|
833
|
+
id: string(),
|
|
834
|
+
organizationId: string(),
|
|
835
|
+
name: string(),
|
|
836
|
+
slug: ProjectSlugSchema,
|
|
837
|
+
description: string().nullable(),
|
|
838
|
+
status: ProjectStatusSchema,
|
|
839
|
+
baseUrl: string().nullable(),
|
|
840
|
+
runtimeId: string().nullable(),
|
|
841
|
+
lastError: string().nullable(),
|
|
842
|
+
createdAt: isoDateTime$3,
|
|
843
|
+
updatedAt: isoDateTime$3
|
|
844
|
+
});
|
|
845
|
+
const UserOrganizationSchema = object({
|
|
846
|
+
organization: OrganizationSchema,
|
|
847
|
+
role: OrganizationUserRoleSchema
|
|
848
|
+
});
|
|
849
|
+
const ActiveOrganizationResponseSchema = object({ organization: UserOrganizationSchema.nullable() });
|
|
850
|
+
const ListOrganizationsResponseSchema = object({ organizations: array(UserOrganizationSchema) });
|
|
851
|
+
const CreateOrganizationRequestSchema = object({
|
|
852
|
+
name: string().trim().min(1),
|
|
853
|
+
/** Format-only at the wire boundary; reserved-name checks run in platform-database. */
|
|
854
|
+
slug: OrganizationSlugSchema.optional()
|
|
855
|
+
});
|
|
856
|
+
const UpdateOrganizationRequestSchema = object({
|
|
857
|
+
name: string().trim().min(1).optional(),
|
|
858
|
+
slug: ClaimableOrganizationSlugSchema.optional()
|
|
859
|
+
}).refine((data) => data.name !== void 0 || data.slug !== void 0, { message: "At least one field is required" });
|
|
860
|
+
const CreateOrganizationResponseSchema = object({ organization: UserOrganizationSchema });
|
|
861
|
+
const ListProjectsResponseSchema = object({ projects: array(ProjectSchema) });
|
|
862
|
+
const ProjectListMetricsSchema = object({
|
|
863
|
+
agentCount: number$1(),
|
|
864
|
+
workflowCount: number$1(),
|
|
865
|
+
skillCount: number$1(),
|
|
866
|
+
credentialCount: number$1(),
|
|
867
|
+
lastDeploymentAt: isoDateTime$3.nullable()
|
|
868
|
+
});
|
|
869
|
+
const ListProjectMetricsResponseSchema = object({ metrics: record(string(), ProjectListMetricsSchema) });
|
|
870
|
+
const CreateProjectRequestSchema = object({
|
|
871
|
+
name: string().trim().min(1),
|
|
872
|
+
description: string().trim().min(1).optional()
|
|
873
|
+
});
|
|
874
|
+
const UpdateProjectRequestSchema = object({
|
|
875
|
+
name: string().trim().min(1).optional(),
|
|
876
|
+
description: string().trim().optional(),
|
|
877
|
+
slug: ProjectSlugSchema.optional()
|
|
878
|
+
}).refine((data) => data.name !== void 0 || data.description !== void 0 || data.slug !== void 0, { message: "At least one field is required" });
|
|
879
|
+
const CreateProjectResponseSchema = object({ project: ProjectSchema });
|
|
880
|
+
const ProjectResponseSchema = object({ project: ProjectSchema });
|
|
881
|
+
const ProjectReachabilityResponseSchema = object({ reachable: boolean() });
|
|
882
|
+
const ValidationErrorDetailSchema = object({
|
|
883
|
+
path: string(),
|
|
884
|
+
message: string()
|
|
885
|
+
});
|
|
886
|
+
/** Machine-readable codes returned in standard API error bodies. */
|
|
887
|
+
const ErrorResponseCodeSchema = OrganizationSlugErrorCodeSchema.or(_enum(["needs_org_selection"]));
|
|
888
|
+
/** Standard JSON error body returned by the HTTP API. */
|
|
889
|
+
const ErrorResponseSchema = object({
|
|
890
|
+
error: string(),
|
|
891
|
+
code: ErrorResponseCodeSchema.optional(),
|
|
892
|
+
message: string().optional(),
|
|
893
|
+
details: array(ValidationErrorDetailSchema).optional()
|
|
894
|
+
});
|
|
895
|
+
const MessageOnlyErrorBodySchema = object({ message: string() });
|
|
896
|
+
/** Parse a JSON error body from the API. */
|
|
897
|
+
function parseErrorResponse(body) {
|
|
898
|
+
const parsed = ErrorResponseSchema.safeParse(body);
|
|
899
|
+
if (parsed.success) return parsed.data;
|
|
900
|
+
const messageOnly = MessageOnlyErrorBodySchema.safeParse(body);
|
|
901
|
+
if (messageOnly.success) return {
|
|
902
|
+
error: messageOnly.data.message,
|
|
903
|
+
message: messageOnly.data.message
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
const CredentialRunContextSchema = object({
|
|
907
|
+
orgId: string().min(1).optional(),
|
|
908
|
+
projectId: string().min(1).optional(),
|
|
909
|
+
userId: string().min(1).optional(),
|
|
910
|
+
userIds: record(string(), string()).optional(),
|
|
911
|
+
selection: record(string(), string()).optional()
|
|
912
|
+
});
|
|
913
|
+
const ThinkingLevelSchema = _enum([
|
|
914
|
+
"off",
|
|
915
|
+
"minimal",
|
|
916
|
+
"low",
|
|
917
|
+
"medium",
|
|
918
|
+
"high",
|
|
919
|
+
"xhigh"
|
|
920
|
+
]);
|
|
921
|
+
const PromptInputSchema = object({
|
|
922
|
+
message: string().min(1),
|
|
923
|
+
sessionId: string().min(1).optional(),
|
|
924
|
+
subscriptionId: string().min(1).optional(),
|
|
925
|
+
context: CredentialRunContextSchema.optional(),
|
|
926
|
+
thinkingLevel: ThinkingLevelSchema.optional()
|
|
927
|
+
});
|
|
928
|
+
const PromptResponseSchema = object({
|
|
929
|
+
sessionId: string(),
|
|
930
|
+
messages: array(record(string(), unknown())),
|
|
931
|
+
error: string().nullable()
|
|
932
|
+
});
|
|
933
|
+
const SkipResponseSchema = object({
|
|
934
|
+
ok: literal(true),
|
|
935
|
+
skipped: literal(true)
|
|
936
|
+
});
|
|
937
|
+
const HealthResponseSchema = object({ ok: literal(true) });
|
|
938
|
+
object({ service: string() });
|
|
939
|
+
const ConnectProvidersResponseSchema = object({ providers: array(object({
|
|
940
|
+
key: string(),
|
|
941
|
+
mode: _enum(["authorize-url", "browser-redirect"]),
|
|
942
|
+
path: string(),
|
|
943
|
+
requiresAuth: boolean()
|
|
944
|
+
})) });
|
|
945
|
+
const ConnectAuthorizeUrlResponseSchema = object({ url: string() });
|
|
946
|
+
const QueuedRunResponseSchema = object({ runId: string() });
|
|
947
|
+
const QueuedAgentPromptResponseSchema = object({ sessionId: string() });
|
|
948
|
+
object({
|
|
949
|
+
workflows: array(string().min(1)).optional(),
|
|
950
|
+
attachments: array(string().min(1)).optional()
|
|
951
|
+
});
|
|
952
|
+
const PollRunMultiResponseSchema = object({ results: array(object({
|
|
953
|
+
attachmentKey: string(),
|
|
954
|
+
workflowKey: string(),
|
|
955
|
+
runId: string().optional(),
|
|
956
|
+
body: unknown().optional(),
|
|
957
|
+
queued: boolean(),
|
|
958
|
+
skipped: boolean().optional()
|
|
959
|
+
})) });
|
|
960
|
+
const PollRunResponseSchema = union([
|
|
961
|
+
record(string(), unknown()),
|
|
962
|
+
PollRunMultiResponseSchema,
|
|
963
|
+
SkipResponseSchema,
|
|
964
|
+
object({ runId: string() })
|
|
965
|
+
]);
|
|
966
|
+
const RunSourceKindSchema = _enum([
|
|
967
|
+
"api",
|
|
968
|
+
"trigger",
|
|
969
|
+
"gateway",
|
|
970
|
+
"workflow",
|
|
971
|
+
"agent"
|
|
972
|
+
]);
|
|
973
|
+
object({
|
|
974
|
+
kind: RunSourceKindSchema,
|
|
975
|
+
id: string().nullable()
|
|
976
|
+
});
|
|
977
|
+
const WorkflowRunStatusSchema = _enum([
|
|
978
|
+
"pending",
|
|
979
|
+
"running",
|
|
980
|
+
"sleeping",
|
|
981
|
+
"waiting_hook",
|
|
982
|
+
"completed",
|
|
983
|
+
"failed",
|
|
984
|
+
"canceled"
|
|
985
|
+
]);
|
|
986
|
+
const WorkflowRunTriggerSchema = _enum([
|
|
987
|
+
"api",
|
|
988
|
+
"cron",
|
|
989
|
+
"webhook",
|
|
990
|
+
"poll",
|
|
991
|
+
"retry"
|
|
992
|
+
]);
|
|
993
|
+
_enum([
|
|
994
|
+
"run_started",
|
|
995
|
+
"step_completed",
|
|
996
|
+
"step_failed",
|
|
997
|
+
"step_retrying",
|
|
998
|
+
"sleep_scheduled",
|
|
999
|
+
"sleep_completed",
|
|
1000
|
+
"hook_created",
|
|
1001
|
+
"hook_resumed",
|
|
1002
|
+
"run_completed",
|
|
1003
|
+
"run_failed"
|
|
1004
|
+
]);
|
|
1005
|
+
const WorkflowRunSummarySchema = object({
|
|
1006
|
+
id: string(),
|
|
1007
|
+
status: WorkflowRunStatusSchema,
|
|
1008
|
+
trigger: WorkflowRunTriggerSchema,
|
|
1009
|
+
triggeredAt: string(),
|
|
1010
|
+
startedAt: string().nullable(),
|
|
1011
|
+
finishedAt: string().nullable(),
|
|
1012
|
+
sourceKind: RunSourceKindSchema,
|
|
1013
|
+
sourceId: string().nullable(),
|
|
1014
|
+
triggerRunId: string().nullable(),
|
|
1015
|
+
attachmentId: string().nullable()
|
|
1016
|
+
});
|
|
1017
|
+
const WorkflowRunRecordSchema = object({
|
|
1018
|
+
id: string(),
|
|
1019
|
+
workflowSlug: string(),
|
|
1020
|
+
status: WorkflowRunStatusSchema,
|
|
1021
|
+
trigger: WorkflowRunTriggerSchema,
|
|
1022
|
+
triggeredAt: string(),
|
|
1023
|
+
startedAt: string().nullable(),
|
|
1024
|
+
finishedAt: string().nullable(),
|
|
1025
|
+
sourceKind: RunSourceKindSchema,
|
|
1026
|
+
sourceId: string().nullable(),
|
|
1027
|
+
triggerRunId: string().nullable(),
|
|
1028
|
+
attachmentId: string().nullable(),
|
|
1029
|
+
parentWorkflowRunId: string().nullable(),
|
|
1030
|
+
parentSpanId: string().nullable(),
|
|
1031
|
+
input: unknown().nullable(),
|
|
1032
|
+
output: unknown().nullable(),
|
|
1033
|
+
error: unknown().nullable()
|
|
1034
|
+
});
|
|
1035
|
+
object({
|
|
1036
|
+
limit: number().int().min(1).max(100).optional().default(20),
|
|
1037
|
+
cursor: string().min(1).optional(),
|
|
1038
|
+
status: WorkflowRunStatusSchema.optional(),
|
|
1039
|
+
trigger: WorkflowRunTriggerSchema.optional()
|
|
1040
|
+
});
|
|
1041
|
+
const WorkflowRunListResponseSchema = object({
|
|
1042
|
+
items: array(WorkflowRunSummarySchema),
|
|
1043
|
+
nextCursor: string().nullable()
|
|
1044
|
+
});
|
|
1045
|
+
_enum([
|
|
1046
|
+
"trigger",
|
|
1047
|
+
"steps",
|
|
1048
|
+
"trace"
|
|
1049
|
+
]);
|
|
1050
|
+
object({ include: string().optional() });
|
|
1051
|
+
const TriggerRunDetailSchema = object({
|
|
1052
|
+
id: string(),
|
|
1053
|
+
attachmentId: string(),
|
|
1054
|
+
attachmentSlug: string().nullable(),
|
|
1055
|
+
triggerType: _enum([
|
|
1056
|
+
"cron",
|
|
1057
|
+
"webhook",
|
|
1058
|
+
"poll"
|
|
1059
|
+
]),
|
|
1060
|
+
sourcePath: string().nullable(),
|
|
1061
|
+
payload: unknown().nullable(),
|
|
1062
|
+
triggeredAt: string()
|
|
1063
|
+
});
|
|
1064
|
+
const WorkflowStepRunSchema = object({
|
|
1065
|
+
id: string(),
|
|
1066
|
+
actionKey: string(),
|
|
1067
|
+
output: unknown(),
|
|
1068
|
+
completedAt: string()
|
|
1069
|
+
});
|
|
1070
|
+
const TraceTriggerSummarySchema = object({
|
|
1071
|
+
triggerType: string(),
|
|
1072
|
+
triggerRunId: string(),
|
|
1073
|
+
workflowSlug: string().optional(),
|
|
1074
|
+
agentSlug: string().optional(),
|
|
1075
|
+
attachmentId: string().nullable().optional(),
|
|
1076
|
+
attachmentSlug: string().nullable().optional(),
|
|
1077
|
+
route: string().optional(),
|
|
1078
|
+
sourcePath: string().nullable().optional()
|
|
1079
|
+
}).nullable();
|
|
1080
|
+
const TraceGatewaySummarySchema = object({
|
|
1081
|
+
gatewayAttachmentId: string(),
|
|
1082
|
+
gatewayAttachmentKey: string(),
|
|
1083
|
+
threadId: string().optional(),
|
|
1084
|
+
channelId: string().optional(),
|
|
1085
|
+
mode: string().optional()
|
|
1086
|
+
}).nullable();
|
|
1087
|
+
const TraceSpanSchema = object({
|
|
1088
|
+
id: string(),
|
|
1089
|
+
traceId: string(),
|
|
1090
|
+
parentSpanId: string().nullable(),
|
|
1091
|
+
kind: string(),
|
|
1092
|
+
refId: string(),
|
|
1093
|
+
name: string(),
|
|
1094
|
+
status: string(),
|
|
1095
|
+
startedAt: string(),
|
|
1096
|
+
finishedAt: string().nullable(),
|
|
1097
|
+
metadata: unknown().nullable(),
|
|
1098
|
+
error: unknown().nullable()
|
|
1099
|
+
});
|
|
1100
|
+
const TraceLogSchema = object({
|
|
1101
|
+
id: string(),
|
|
1102
|
+
traceId: string(),
|
|
1103
|
+
spanId: string(),
|
|
1104
|
+
seq: number$1(),
|
|
1105
|
+
level: string(),
|
|
1106
|
+
message: string(),
|
|
1107
|
+
data: unknown().nullable(),
|
|
1108
|
+
source: string(),
|
|
1109
|
+
createdAt: string()
|
|
1110
|
+
});
|
|
1111
|
+
const TraceResponseSchema = object({
|
|
1112
|
+
traceId: string(),
|
|
1113
|
+
trigger: TraceTriggerSummarySchema,
|
|
1114
|
+
gateway: TraceGatewaySummarySchema,
|
|
1115
|
+
spans: array(TraceSpanSchema),
|
|
1116
|
+
logs: array(TraceLogSchema)
|
|
1117
|
+
});
|
|
1118
|
+
const WorkflowRunDetailResponseSchema = object({
|
|
1119
|
+
run: WorkflowRunRecordSchema,
|
|
1120
|
+
trigger: TriggerRunDetailSchema.nullable(),
|
|
1121
|
+
steps: array(WorkflowStepRunSchema),
|
|
1122
|
+
trace: TraceResponseSchema.nullable()
|
|
1123
|
+
});
|
|
1124
|
+
const AgentSessionStatusSchema = _enum([
|
|
1125
|
+
"running",
|
|
1126
|
+
"completed",
|
|
1127
|
+
"failed"
|
|
1128
|
+
]);
|
|
1129
|
+
const AgentSessionSummarySchema = object({
|
|
1130
|
+
id: string(),
|
|
1131
|
+
status: AgentSessionStatusSchema,
|
|
1132
|
+
source: RunSourceKindSchema,
|
|
1133
|
+
sourceId: string().nullable(),
|
|
1134
|
+
createdAt: string(),
|
|
1135
|
+
updatedAt: string(),
|
|
1136
|
+
messageCount: number$1()
|
|
1137
|
+
});
|
|
1138
|
+
const AgentSessionRecordSchema = object({
|
|
1139
|
+
id: string(),
|
|
1140
|
+
agentSlug: string(),
|
|
1141
|
+
status: AgentSessionStatusSchema,
|
|
1142
|
+
source: RunSourceKindSchema,
|
|
1143
|
+
sourceId: string().nullable(),
|
|
1144
|
+
createdAt: string(),
|
|
1145
|
+
updatedAt: string(),
|
|
1146
|
+
parentSpanId: string().nullable(),
|
|
1147
|
+
messageCount: number$1(),
|
|
1148
|
+
error: unknown().nullable()
|
|
1149
|
+
});
|
|
1150
|
+
object({
|
|
1151
|
+
limit: number().int().min(1).max(100).optional().default(20),
|
|
1152
|
+
cursor: string().min(1).optional(),
|
|
1153
|
+
status: AgentSessionStatusSchema.optional(),
|
|
1154
|
+
source: RunSourceKindSchema.optional()
|
|
1155
|
+
});
|
|
1156
|
+
const AgentSessionListResponseSchema = object({
|
|
1157
|
+
items: array(AgentSessionSummarySchema),
|
|
1158
|
+
nextCursor: string().nullable()
|
|
1159
|
+
});
|
|
1160
|
+
_enum([
|
|
1161
|
+
"gateway",
|
|
1162
|
+
"messages",
|
|
1163
|
+
"events",
|
|
1164
|
+
"trace"
|
|
1165
|
+
]);
|
|
1166
|
+
object({ include: string().optional() });
|
|
1167
|
+
const GatewaySessionDetailSchema = object({
|
|
1168
|
+
threadId: string(),
|
|
1169
|
+
attachmentId: string(),
|
|
1170
|
+
attachmentSlug: string().nullable()
|
|
1171
|
+
});
|
|
1172
|
+
const AgentEventSchema = object({
|
|
1173
|
+
id: string(),
|
|
1174
|
+
sessionId: string(),
|
|
1175
|
+
seq: number$1(),
|
|
1176
|
+
eventType: string(),
|
|
1177
|
+
payload: unknown(),
|
|
1178
|
+
createdAt: string()
|
|
1179
|
+
});
|
|
1180
|
+
const AgentSessionDetailResponseSchema = object({
|
|
1181
|
+
session: AgentSessionRecordSchema,
|
|
1182
|
+
gateway: GatewaySessionDetailSchema.nullable(),
|
|
1183
|
+
messages: array(record(string(), unknown())),
|
|
1184
|
+
events: array(AgentEventSchema),
|
|
1185
|
+
trace: TraceResponseSchema.nullable()
|
|
1186
|
+
});
|
|
1187
|
+
const SlackGatewayModeSchema = _enum([
|
|
1188
|
+
"mention",
|
|
1189
|
+
"channel",
|
|
1190
|
+
"dm"
|
|
1191
|
+
]);
|
|
1192
|
+
const GatewayAttachmentSourceSchema = object({
|
|
1193
|
+
kind: literal("slack"),
|
|
1194
|
+
mode: SlackGatewayModeSchema,
|
|
1195
|
+
credentialKey: string(),
|
|
1196
|
+
channelIds: array(string()).optional(),
|
|
1197
|
+
subscribeOnMention: boolean()
|
|
1198
|
+
});
|
|
1199
|
+
const GatewayAttachmentRecordSchema = object({
|
|
1200
|
+
id: string(),
|
|
1201
|
+
key: string(),
|
|
1202
|
+
agentKey: string(),
|
|
1203
|
+
channelId: string(),
|
|
1204
|
+
teamId: string().nullable().optional(),
|
|
1205
|
+
platform: string(),
|
|
1206
|
+
source: GatewayAttachmentSourceSchema,
|
|
1207
|
+
registeredAt: string(),
|
|
1208
|
+
updatedAt: string()
|
|
1209
|
+
});
|
|
1210
|
+
object({ attachments: array(GatewayAttachmentRecordSchema) });
|
|
1211
|
+
const UpsertGatewayAttachmentBodySchema = object({
|
|
1212
|
+
agentKey: string().min(1),
|
|
1213
|
+
teamId: string().min(1).optional(),
|
|
1214
|
+
mode: SlackGatewayModeSchema.optional(),
|
|
1215
|
+
subscribeOnMention: boolean().optional()
|
|
1216
|
+
});
|
|
1217
|
+
const AgentListResponseSchema = object({ agents: array(object({
|
|
1218
|
+
key: string(),
|
|
1219
|
+
name: string().optional(),
|
|
1220
|
+
route: string()
|
|
1221
|
+
})) });
|
|
1222
|
+
const HistoryRunKindSchema = _enum(["workflow", "agent"]);
|
|
1223
|
+
const HistoryRunStatusSchema = _enum([
|
|
1224
|
+
"pending",
|
|
1225
|
+
"running",
|
|
1226
|
+
"sleeping",
|
|
1227
|
+
"waiting_hook",
|
|
1228
|
+
"completed",
|
|
1229
|
+
"failed",
|
|
1230
|
+
"canceled"
|
|
1231
|
+
]);
|
|
1232
|
+
const HistoryRunActorSchema = object({
|
|
1233
|
+
userId: string(),
|
|
1234
|
+
name: string(),
|
|
1235
|
+
avatarUrl: string().nullable().optional()
|
|
1236
|
+
});
|
|
1237
|
+
const HistoryRunUsageLineItemSchema = object({
|
|
1238
|
+
id: string(),
|
|
1239
|
+
label: string(),
|
|
1240
|
+
amountUsd: number$1()
|
|
1241
|
+
});
|
|
1242
|
+
const HistoryRunUsageSchema = object({
|
|
1243
|
+
runDurationMs: number$1().nullable(),
|
|
1244
|
+
lineItems: array(HistoryRunUsageLineItemSchema),
|
|
1245
|
+
totalExcludingDurationUsd: number$1().nullable()
|
|
1246
|
+
});
|
|
1247
|
+
const HistoryRunSchema = object({
|
|
1248
|
+
id: string(),
|
|
1249
|
+
kind: HistoryRunKindSchema,
|
|
1250
|
+
traceId: string().nullable(),
|
|
1251
|
+
projectId: string(),
|
|
1252
|
+
projectName: string(),
|
|
1253
|
+
resourceKey: string(),
|
|
1254
|
+
resourceId: string(),
|
|
1255
|
+
resourceName: string(),
|
|
1256
|
+
status: HistoryRunStatusSchema,
|
|
1257
|
+
triggeredAt: string(),
|
|
1258
|
+
timeInQueueMs: number$1().nullable(),
|
|
1259
|
+
startedAt: string(),
|
|
1260
|
+
finishedAt: string().nullable(),
|
|
1261
|
+
durationMs: number$1().nullable(),
|
|
1262
|
+
triggerLabel: string(),
|
|
1263
|
+
triggerRaw: string(),
|
|
1264
|
+
ranAs: HistoryRunActorSchema.nullable(),
|
|
1265
|
+
modelsUsed: array(string()),
|
|
1266
|
+
otherServicesUsed: array(string()),
|
|
1267
|
+
totalCostUsd: number$1().nullable(),
|
|
1268
|
+
messageCount: number$1().optional(),
|
|
1269
|
+
stepCount: number$1().optional()
|
|
1270
|
+
});
|
|
1271
|
+
const HistoryTraceSpanSchema = object({
|
|
1272
|
+
id: string(),
|
|
1273
|
+
traceId: string(),
|
|
1274
|
+
parentSpanId: string().nullable(),
|
|
1275
|
+
kind: string(),
|
|
1276
|
+
refId: string(),
|
|
1277
|
+
name: string(),
|
|
1278
|
+
status: string(),
|
|
1279
|
+
startedAt: string(),
|
|
1280
|
+
finishedAt: string().nullable(),
|
|
1281
|
+
metadata: unknown().nullable(),
|
|
1282
|
+
error: unknown().nullable()
|
|
1283
|
+
});
|
|
1284
|
+
const HistoryTraceLogSchema = object({
|
|
1285
|
+
id: string(),
|
|
1286
|
+
traceId: string(),
|
|
1287
|
+
spanId: string(),
|
|
1288
|
+
seq: number$1(),
|
|
1289
|
+
level: string(),
|
|
1290
|
+
message: string(),
|
|
1291
|
+
data: unknown().nullable(),
|
|
1292
|
+
source: string(),
|
|
1293
|
+
createdAt: string()
|
|
1294
|
+
});
|
|
1295
|
+
const HistoryTraceTriggerSchema = object({
|
|
1296
|
+
triggerType: string(),
|
|
1297
|
+
triggerRunId: string(),
|
|
1298
|
+
workflowKey: string().optional(),
|
|
1299
|
+
agentKey: string().optional(),
|
|
1300
|
+
attachmentId: string().nullable().optional(),
|
|
1301
|
+
attachmentKey: string().nullable().optional(),
|
|
1302
|
+
route: string().optional(),
|
|
1303
|
+
sourcePath: string().nullable().optional()
|
|
1304
|
+
}).nullable();
|
|
1305
|
+
const HistoryTraceGatewaySchema = object({
|
|
1306
|
+
gatewayAttachmentId: string(),
|
|
1307
|
+
gatewayAttachmentKey: string(),
|
|
1308
|
+
threadId: string().optional(),
|
|
1309
|
+
channelId: string().optional(),
|
|
1310
|
+
mode: string().optional()
|
|
1311
|
+
}).nullable();
|
|
1312
|
+
const HistoryTraceSchema = object({
|
|
1313
|
+
traceId: string(),
|
|
1314
|
+
trigger: HistoryTraceTriggerSchema,
|
|
1315
|
+
gateway: HistoryTraceGatewaySchema,
|
|
1316
|
+
spans: array(HistoryTraceSpanSchema),
|
|
1317
|
+
logs: array(HistoryTraceLogSchema)
|
|
1318
|
+
});
|
|
1319
|
+
const HistoryWorkflowStepSchema = object({
|
|
1320
|
+
id: string(),
|
|
1321
|
+
actionKey: string(),
|
|
1322
|
+
output: unknown(),
|
|
1323
|
+
completedAt: string()
|
|
1324
|
+
});
|
|
1325
|
+
const HistoryRunDetailSchema = discriminatedUnion("kind", [object({
|
|
1326
|
+
kind: literal("workflow"),
|
|
1327
|
+
run: object({
|
|
1328
|
+
id: string(),
|
|
1329
|
+
workflowKey: string(),
|
|
1330
|
+
status: HistoryRunStatusSchema,
|
|
1331
|
+
trigger: string(),
|
|
1332
|
+
triggeredAt: string(),
|
|
1333
|
+
startedAt: string().nullable(),
|
|
1334
|
+
finishedAt: string().nullable(),
|
|
1335
|
+
input: unknown().nullable(),
|
|
1336
|
+
output: unknown().nullable(),
|
|
1337
|
+
error: unknown().nullable()
|
|
1338
|
+
}),
|
|
1339
|
+
trigger: object({
|
|
1340
|
+
id: string(),
|
|
1341
|
+
attachmentKey: string().nullable(),
|
|
1342
|
+
triggerType: string(),
|
|
1343
|
+
sourcePath: string().nullable(),
|
|
1344
|
+
payload: unknown().nullable(),
|
|
1345
|
+
triggeredAt: string()
|
|
1346
|
+
}).nullable(),
|
|
1347
|
+
steps: array(HistoryWorkflowStepSchema),
|
|
1348
|
+
trace: HistoryTraceSchema.nullable(),
|
|
1349
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
1350
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
1351
|
+
}), object({
|
|
1352
|
+
kind: literal("agent"),
|
|
1353
|
+
session: object({
|
|
1354
|
+
id: string(),
|
|
1355
|
+
agentKey: string(),
|
|
1356
|
+
status: HistoryRunStatusSchema,
|
|
1357
|
+
source: _enum([
|
|
1358
|
+
"api",
|
|
1359
|
+
"gateway",
|
|
1360
|
+
"trigger",
|
|
1361
|
+
"workflow",
|
|
1362
|
+
"agent"
|
|
1363
|
+
]),
|
|
1364
|
+
sourceId: string().nullable(),
|
|
1365
|
+
createdAt: string(),
|
|
1366
|
+
updatedAt: string(),
|
|
1367
|
+
messageCount: number$1(),
|
|
1368
|
+
error: unknown().nullable()
|
|
1369
|
+
}),
|
|
1370
|
+
gateway: object({
|
|
1371
|
+
threadId: string(),
|
|
1372
|
+
attachmentKey: string().nullable()
|
|
1373
|
+
}).nullable(),
|
|
1374
|
+
messages: array(record(string(), unknown())),
|
|
1375
|
+
trace: HistoryTraceSchema.nullable(),
|
|
1376
|
+
ranAs: HistoryRunActorSchema.nullable().optional(),
|
|
1377
|
+
usage: HistoryRunUsageSchema.nullable().optional()
|
|
1378
|
+
})]);
|
|
1379
|
+
const HistoryRunListQuerySchema = object({
|
|
1380
|
+
project: string().min(1).optional(),
|
|
1381
|
+
status: HistoryRunStatusSchema.optional(),
|
|
1382
|
+
kind: HistoryRunKindSchema.optional()
|
|
1383
|
+
});
|
|
1384
|
+
const HistoryRunListResponseSchema = array(HistoryRunSchema);
|
|
1385
|
+
const HistoryRunDetailResponseSchema = HistoryRunDetailSchema.nullable();
|
|
1386
|
+
const HistoryRunCancelResponseSchema = HistoryRunSchema.nullable();
|
|
1387
|
+
object({ subscriptions: array(object({
|
|
1388
|
+
id: string(),
|
|
1389
|
+
workflowKey: string(),
|
|
1390
|
+
userId: string(),
|
|
1391
|
+
enabled: boolean(),
|
|
1392
|
+
createdAt: string(),
|
|
1393
|
+
updatedAt: string()
|
|
1394
|
+
})) });
|
|
1395
|
+
object({
|
|
1396
|
+
userId: string().min(1).optional(),
|
|
1397
|
+
enabled: boolean().optional()
|
|
1398
|
+
});
|
|
1399
|
+
const CredentialInstanceRecordSchema = object({
|
|
1400
|
+
id: string(),
|
|
1401
|
+
key: string(),
|
|
1402
|
+
scopeType: CredentialScopeTypeSchema,
|
|
1403
|
+
scopeId: string().nullable(),
|
|
1404
|
+
label: string().nullable(),
|
|
1405
|
+
isDefault: boolean(),
|
|
1406
|
+
authKind: CredentialAuthKindSchema
|
|
1407
|
+
});
|
|
1408
|
+
const CredentialInstanceListResponseSchema = object({ instances: array(CredentialInstanceRecordSchema) });
|
|
1409
|
+
const CreateCredentialInstanceBodySchema = object({
|
|
1410
|
+
key: string().min(1),
|
|
1411
|
+
scopeType: CredentialScopeTypeSchema,
|
|
1412
|
+
scopeId: string().nullable().optional(),
|
|
1413
|
+
label: string().nullable().optional(),
|
|
1414
|
+
isDefault: boolean().optional(),
|
|
1415
|
+
value: record(string(), unknown()).refine((value) => Object.keys(value).length > 0, { message: "value must be a non-empty object" })
|
|
1416
|
+
});
|
|
1417
|
+
const UpdateCredentialInstanceBodySchema = object({
|
|
1418
|
+
label: string().nullable().optional(),
|
|
1419
|
+
isDefault: boolean().optional(),
|
|
1420
|
+
value: record(string(), unknown()).refine((value) => Object.keys(value).length > 0, { message: "value must be a non-empty object" }).optional()
|
|
1421
|
+
});
|
|
1422
|
+
const TriggerRunTypeSchema = _enum([
|
|
1423
|
+
"cron",
|
|
1424
|
+
"webhook",
|
|
1425
|
+
"poll"
|
|
1426
|
+
]);
|
|
1427
|
+
const TriggerRunWorkflowSummarySchema = object({
|
|
1428
|
+
id: string(),
|
|
1429
|
+
status: WorkflowRunStatusSchema,
|
|
1430
|
+
workflowSlug: string()
|
|
1431
|
+
});
|
|
1432
|
+
const TriggerRunAgentSessionSummarySchema = object({
|
|
1433
|
+
id: string(),
|
|
1434
|
+
agentSlug: string()
|
|
1435
|
+
});
|
|
1436
|
+
const TriggerRunSummarySchema = object({
|
|
1437
|
+
id: string(),
|
|
1438
|
+
triggerType: TriggerRunTypeSchema,
|
|
1439
|
+
triggeredAt: string(),
|
|
1440
|
+
sourcePath: string().nullable(),
|
|
1441
|
+
workflowRun: TriggerRunWorkflowSummarySchema.nullable(),
|
|
1442
|
+
agentSession: TriggerRunAgentSessionSummarySchema.nullable()
|
|
1443
|
+
});
|
|
1444
|
+
const TriggerRunRecordSchema = object({
|
|
1445
|
+
id: string(),
|
|
1446
|
+
attachmentId: string(),
|
|
1447
|
+
attachmentSlug: string(),
|
|
1448
|
+
triggerType: TriggerRunTypeSchema,
|
|
1449
|
+
sourcePath: string().nullable(),
|
|
1450
|
+
payload: unknown().nullable(),
|
|
1451
|
+
triggeredAt: string()
|
|
1452
|
+
});
|
|
1453
|
+
object({
|
|
1454
|
+
limit: number().int().min(1).max(100).optional().default(20),
|
|
1455
|
+
cursor: string().min(1).optional(),
|
|
1456
|
+
triggerType: TriggerRunTypeSchema.optional()
|
|
1457
|
+
});
|
|
1458
|
+
const TriggerRunListResponseSchema = object({
|
|
1459
|
+
items: array(TriggerRunSummarySchema),
|
|
1460
|
+
nextCursor: string().nullable()
|
|
1461
|
+
});
|
|
1462
|
+
_enum([
|
|
1463
|
+
"workflows",
|
|
1464
|
+
"agents",
|
|
1465
|
+
"trace"
|
|
1466
|
+
]);
|
|
1467
|
+
object({ include: string().optional() });
|
|
1468
|
+
const TriggerRunAgentSessionDetailSchema = object({
|
|
1469
|
+
id: string(),
|
|
1470
|
+
agentSlug: string()
|
|
1471
|
+
});
|
|
1472
|
+
const TriggerRunDetailResponseSchema = object({
|
|
1473
|
+
run: TriggerRunRecordSchema,
|
|
1474
|
+
workflowRuns: array(WorkflowRunSummarySchema),
|
|
1475
|
+
agentSessions: array(TriggerRunAgentSessionDetailSchema),
|
|
1476
|
+
trace: TraceResponseSchema.nullable()
|
|
1477
|
+
});
|
|
1478
|
+
const TriggerTypeSchema = _enum([
|
|
1479
|
+
"webhook",
|
|
1480
|
+
"poll",
|
|
1481
|
+
"cron"
|
|
1482
|
+
]);
|
|
1483
|
+
const TriggerTargetKindSchema = _enum(["workflow", "agent"]);
|
|
1484
|
+
const TriggerListItemSchema = object({
|
|
1485
|
+
key: string(),
|
|
1486
|
+
type: TriggerTypeSchema,
|
|
1487
|
+
route: string().optional(),
|
|
1488
|
+
webhookUrl: string().url().optional(),
|
|
1489
|
+
targetKind: TriggerTargetKindSchema,
|
|
1490
|
+
workflowKey: string().optional(),
|
|
1491
|
+
agentKey: string().optional()
|
|
1492
|
+
});
|
|
1493
|
+
const TriggerListResponseSchema = object({ triggers: array(TriggerListItemSchema) });
|
|
1494
|
+
object({ endpoint: string().min(1).optional() });
|
|
1495
|
+
const TriggerDetailResponseSchema = TriggerListItemSchema;
|
|
1496
|
+
const OrganizationMemberRoleSchema = _enum([
|
|
1497
|
+
"owner",
|
|
1498
|
+
"admin",
|
|
1499
|
+
"builder"
|
|
1500
|
+
]);
|
|
1501
|
+
const OrganizationMemberStatusSchema = _enum([
|
|
1502
|
+
"invited",
|
|
1503
|
+
"active",
|
|
1504
|
+
"rejected",
|
|
1505
|
+
"suspended"
|
|
1506
|
+
]);
|
|
1507
|
+
const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
|
|
1508
|
+
const isoDateTime$2 = string().datetime();
|
|
1509
|
+
const OrganizationMemberSchema = object({
|
|
1510
|
+
id: string(),
|
|
1511
|
+
name: string(),
|
|
1512
|
+
email: string().email(),
|
|
1513
|
+
role: OrganizationMemberRoleSchema,
|
|
1514
|
+
status: OrganizationMemberStatusSchema,
|
|
1515
|
+
avatarUrl: string().optional(),
|
|
1516
|
+
joinedAt: isoDateTime$2.optional(),
|
|
1517
|
+
lastActiveAt: isoDateTime$2.nullable().optional()
|
|
1518
|
+
});
|
|
1519
|
+
const ListOrganizationMembersResponseSchema = object({ members: array(OrganizationMemberSchema) });
|
|
1520
|
+
const InviteOrganizationMembersRequestSchema = object({
|
|
1521
|
+
emails: array(string().trim().email()).min(1),
|
|
1522
|
+
role: InvitableOrganizationMemberRoleSchema
|
|
1523
|
+
});
|
|
1524
|
+
const InviteOrganizationMemberResultStatusSchema = _enum([
|
|
1525
|
+
"sent",
|
|
1526
|
+
"already_member",
|
|
1527
|
+
"pending",
|
|
1528
|
+
"invalid"
|
|
1529
|
+
]);
|
|
1530
|
+
const InviteOrganizationMembersResponseSchema = object({ results: array(object({
|
|
1531
|
+
email: string(),
|
|
1532
|
+
status: InviteOrganizationMemberResultStatusSchema,
|
|
1533
|
+
invitationId: string().optional()
|
|
1534
|
+
})) });
|
|
1535
|
+
const UpdateOrganizationMemberRequestSchema = object({ role: InvitableOrganizationMemberRoleSchema });
|
|
1536
|
+
const UpdateOrganizationMemberResponseSchema = object({ member: OrganizationMemberSchema });
|
|
1537
|
+
const ListOrganizationInvitationsResponseSchema = object({ invitations: array(object({
|
|
1538
|
+
id: string(),
|
|
1539
|
+
organizationName: string(),
|
|
1540
|
+
organizationSlug: OrganizationSlugSchema,
|
|
1541
|
+
invitedByName: string().optional(),
|
|
1542
|
+
invitedByEmail: string().email().optional(),
|
|
1543
|
+
role: OrganizationMemberRoleSchema
|
|
1544
|
+
})) });
|
|
1545
|
+
const AcceptOrganizationInvitationResponseSchema = object({ organization: UserOrganizationSchema });
|
|
1546
|
+
const DeclineOrganizationInvitationResponseSchema = object({ success: literal(true) });
|
|
1547
|
+
/** Custom avatar override; null means fall back to OAuth `users.image`. */
|
|
1548
|
+
const UserAvatarSchema = object({ url: url().nullable() });
|
|
1549
|
+
const UserAvatarPatchSchema = object({
|
|
1550
|
+
/** Storage key returned from presign; null removes the custom override. */
|
|
1551
|
+
storageKey: string().min(1).nullable() });
|
|
1552
|
+
const PresignUserAvatarRequestSchema = object({ contentType: string().trim().min(1) });
|
|
1553
|
+
const PresignUserAvatarResponseSchema = object({
|
|
1554
|
+
uploadUrl: url(),
|
|
1555
|
+
storageKey: string().min(1)
|
|
1556
|
+
});
|
|
1557
|
+
const OrganizationLogoVariantSchema = _enum(["light", "dark"]);
|
|
1558
|
+
const OrganizationSidebarBrandingSchema = object({
|
|
1559
|
+
customLogoEnabled: boolean(),
|
|
1560
|
+
customLogoExplicitlyDisabled: boolean(),
|
|
1561
|
+
logoLightUrl: url().nullable(),
|
|
1562
|
+
logoDarkUrl: url().nullable(),
|
|
1563
|
+
logoHeightPx: number$1().int().min(14).max(32)
|
|
1564
|
+
});
|
|
1565
|
+
const OrganizationSidebarBrandingPatchSchema = object({
|
|
1566
|
+
customLogoEnabled: boolean().optional(),
|
|
1567
|
+
customLogoExplicitlyDisabled: boolean().optional(),
|
|
1568
|
+
logoLightStorageKey: string().min(1).nullable().optional(),
|
|
1569
|
+
logoDarkStorageKey: string().min(1).nullable().optional(),
|
|
1570
|
+
logoHeightPx: number$1().int().min(14).max(32).optional()
|
|
1571
|
+
}).refine((value) => value.customLogoEnabled !== void 0 || value.customLogoExplicitlyDisabled !== void 0 || value.logoLightStorageKey !== void 0 || value.logoDarkStorageKey !== void 0 || value.logoHeightPx !== void 0, { message: "At least one branding field is required" });
|
|
1572
|
+
const PresignOrgLogoRequestSchema = object({
|
|
1573
|
+
variant: OrganizationLogoVariantSchema,
|
|
1574
|
+
contentType: string().trim().min(1)
|
|
1575
|
+
});
|
|
1576
|
+
const PresignOrgLogoResponseSchema = object({
|
|
1577
|
+
uploadUrl: url(),
|
|
1578
|
+
storageKey: string().min(1)
|
|
1579
|
+
});
|
|
1580
|
+
const ProjectArtifactStatusSchema = _enum(["pending", "ready"]);
|
|
1581
|
+
const isoDateTime$1 = string().datetime();
|
|
1582
|
+
const ProjectArtifactSchema = object({
|
|
1583
|
+
id: string(),
|
|
1584
|
+
projectId: string(),
|
|
1585
|
+
storageKey: string(),
|
|
1586
|
+
status: ProjectArtifactStatusSchema,
|
|
1587
|
+
createdAt: isoDateTime$1,
|
|
1588
|
+
updatedAt: isoDateTime$1
|
|
1589
|
+
});
|
|
1590
|
+
const CreateProjectArtifactResponseSchema = object({
|
|
1591
|
+
artifact: ProjectArtifactSchema,
|
|
1592
|
+
uploadUrl: string().url(),
|
|
1593
|
+
expiresInSeconds: number$1().int().positive()
|
|
1594
|
+
});
|
|
1595
|
+
const CompleteProjectArtifactResponseSchema = object({
|
|
1596
|
+
artifact: ProjectArtifactSchema,
|
|
1597
|
+
project: ProjectSchema
|
|
1598
|
+
});
|
|
1599
|
+
const ListProjectDeploymentsResponseSchema = object({ deployments: array(object({
|
|
1600
|
+
id: string(),
|
|
1601
|
+
projectId: string(),
|
|
1602
|
+
version: number$1().int().positive(),
|
|
1603
|
+
deployedBy: string().nullable(),
|
|
1604
|
+
deployedByEmail: string().optional(),
|
|
1605
|
+
deployedByAvatarUrl: string().optional(),
|
|
1606
|
+
createdAt: isoDateTime$1,
|
|
1607
|
+
active: boolean()
|
|
1608
|
+
})) });
|
|
1609
|
+
const optionalCount = number$1().int().nonnegative().nullable().optional();
|
|
1610
|
+
const optionalTimestamp = string().nullable().optional();
|
|
1611
|
+
const AgentSummarySchema = object({
|
|
1612
|
+
id: string().min(1),
|
|
1613
|
+
slug: string().min(1),
|
|
1614
|
+
name: string().min(1),
|
|
1615
|
+
projectId: string().min(1),
|
|
1616
|
+
updatedAt: string().min(1),
|
|
1617
|
+
description: string().optional(),
|
|
1618
|
+
sourcePath: string().min(1).optional(),
|
|
1619
|
+
model: string().optional(),
|
|
1620
|
+
toolCount: optionalCount,
|
|
1621
|
+
credentialCount: optionalCount,
|
|
1622
|
+
lastRunAt: optionalTimestamp
|
|
1623
|
+
});
|
|
1624
|
+
const WorkflowSummarySchema = object({
|
|
1625
|
+
id: string().min(1),
|
|
1626
|
+
slug: string().min(1),
|
|
1627
|
+
name: string().min(1),
|
|
1628
|
+
projectId: string().min(1),
|
|
1629
|
+
updatedAt: string().min(1),
|
|
1630
|
+
description: string().optional(),
|
|
1631
|
+
sourcePath: string().min(1).optional(),
|
|
1632
|
+
lastRunAt: optionalTimestamp
|
|
1633
|
+
});
|
|
1634
|
+
const SkillSummarySchema = object({
|
|
1635
|
+
id: string().min(1),
|
|
1636
|
+
slug: string().min(1),
|
|
1637
|
+
name: string().min(1),
|
|
1638
|
+
projectId: string().min(1),
|
|
1639
|
+
updatedAt: string().min(1),
|
|
1640
|
+
description: string().optional(),
|
|
1641
|
+
sourcePath: string().min(1).optional()
|
|
1642
|
+
});
|
|
1643
|
+
const AgentSummaryListResponseSchema = array(AgentSummarySchema);
|
|
1644
|
+
const AgentSummaryDetailResponseSchema = AgentSummarySchema.nullable();
|
|
1645
|
+
const WorkflowSummaryListResponseSchema = array(WorkflowSummarySchema);
|
|
1646
|
+
const WorkflowSummaryDetailResponseSchema = WorkflowSummarySchema.nullable();
|
|
1647
|
+
const SkillSummaryListResponseSchema = array(SkillSummarySchema);
|
|
1648
|
+
const SkillSummaryDetailResponseSchema = SkillSummarySchema.nullable();
|
|
1649
|
+
const RecentResourceKindSchema = _enum([
|
|
1650
|
+
"agent",
|
|
1651
|
+
"workflow",
|
|
1652
|
+
"skill"
|
|
1653
|
+
]);
|
|
1654
|
+
const RecentResourceSourceSchema = _enum(["owned", "shared"]);
|
|
1655
|
+
const RecentResourceListResponseSchema = array(object({
|
|
1656
|
+
id: string().min(1),
|
|
1657
|
+
resourceKind: RecentResourceKindSchema,
|
|
1658
|
+
resourceId: string().min(1),
|
|
1659
|
+
name: string().min(1),
|
|
1660
|
+
description: string().optional(),
|
|
1661
|
+
projectId: string().min(1),
|
|
1662
|
+
projectName: string().min(1),
|
|
1663
|
+
sourcePath: string().min(1).optional(),
|
|
1664
|
+
source: RecentResourceSourceSchema,
|
|
1665
|
+
lastOpenedAt: string().min(1),
|
|
1666
|
+
lastModifiedAt: string().min(1)
|
|
1667
|
+
}));
|
|
1668
|
+
const isoDateTime = string().datetime();
|
|
1669
|
+
const sha256Hex = string().regex(/^[a-f0-9]{64}$/, "Expected a lowercase hex sha256 digest");
|
|
1670
|
+
/**
|
|
1671
|
+
* A single entry in a deploy's file tree, as served to the dashboard. Carries
|
|
1672
|
+
* no contents: `id` is a stable, path-derived handle used for selection and
|
|
1673
|
+
* `?file=` deep links; `hash` is the content address used to fetch the bytes
|
|
1674
|
+
* lazily and to cache them immutably in the browser.
|
|
1675
|
+
*/
|
|
1676
|
+
const ProjectFileSummarySchema = object({
|
|
1677
|
+
id: string(),
|
|
1678
|
+
path: string().min(1),
|
|
1679
|
+
hash: sha256Hex
|
|
1680
|
+
});
|
|
1681
|
+
/** Maps a runtime resource slug (agent/workflow/skill) to its source file path. */
|
|
1682
|
+
const ProjectSourceResourceRefSchema = object({
|
|
1683
|
+
slug: string().min(1),
|
|
1684
|
+
path: string().min(1)
|
|
1685
|
+
});
|
|
1686
|
+
const ProjectSourceResourcesSchema = object({
|
|
1687
|
+
agents: array(ProjectSourceResourceRefSchema).default([]),
|
|
1688
|
+
workflows: array(ProjectSourceResourceRefSchema).default([]),
|
|
1689
|
+
skills: array(ProjectSourceResourceRefSchema).default([])
|
|
1690
|
+
});
|
|
1691
|
+
const emptyResources = () => ({
|
|
1692
|
+
agents: [],
|
|
1693
|
+
workflows: [],
|
|
1694
|
+
skills: []
|
|
1695
|
+
});
|
|
1696
|
+
/** Response for the file-tree listing of a project's active deploy. */
|
|
1697
|
+
const ListProjectFilesResponseSchema = object({
|
|
1698
|
+
artifactId: string().nullable(),
|
|
1699
|
+
files: array(ProjectFileSummarySchema),
|
|
1700
|
+
resources: ProjectSourceResourcesSchema.default(emptyResources())
|
|
1701
|
+
});
|
|
1702
|
+
object({
|
|
1703
|
+
path: string().min(1),
|
|
1704
|
+
contents: string(),
|
|
1705
|
+
hash: sha256Hex
|
|
1706
|
+
});
|
|
1707
|
+
/** Request: ask the platform which blobs are missing and get presigned PUTs. */
|
|
1708
|
+
const PresignProjectSourceRequestSchema = object({ blobs: array(object({
|
|
1709
|
+
hash: sha256Hex,
|
|
1710
|
+
size: number$1().int().nonnegative()
|
|
1711
|
+
})) });
|
|
1712
|
+
/** Response: presigned PUTs for the subset of blobs not already stored. */
|
|
1713
|
+
const PresignProjectSourceResponseSchema = object({ uploads: array(object({
|
|
1714
|
+
hash: sha256Hex,
|
|
1715
|
+
url: string().url()
|
|
1716
|
+
})) });
|
|
1717
|
+
/** Request body the CLI sends to finalize a deploy's source manifest. */
|
|
1718
|
+
const UploadProjectSourceManifestRequestSchema = object({ files: array(object({
|
|
1719
|
+
path: string().min(1),
|
|
1720
|
+
hash: sha256Hex
|
|
1721
|
+
})) });
|
|
1722
|
+
const UploadProjectSourceResponseSchema = object({
|
|
1723
|
+
ok: literal(true),
|
|
1724
|
+
fileCount: number$1().int().nonnegative()
|
|
1725
|
+
});
|
|
1726
|
+
object({
|
|
1727
|
+
files: array(object({
|
|
1728
|
+
id: string(),
|
|
1729
|
+
path: string().min(1),
|
|
1730
|
+
hash: sha256Hex
|
|
1731
|
+
})),
|
|
1732
|
+
generatedAt: isoDateTime
|
|
1733
|
+
});
|
|
1734
|
+
//#endregion
|
|
1735
|
+
export { QueuedRunResponseSchema as $, ListOrganizationInvitationsResponseSchema as A, PollRunResponseSchema as B, HealthResponseSchema as C, listenPortFromPublicUrl as Ct, HistoryRunListResponseSchema as D, HistoryRunListQuerySchema as E, parseErrorResponse as Et, ListProjectMetricsResponseSchema as F, PresignUserAvatarRequestSchema as G, PresignOrgLogoResponseSchema as H, ListProjectsResponseSchema as I, ProjectResponseSchema as J, PresignUserAvatarResponseSchema as K, OrganizationSidebarBrandingPatchSchema as L, ListOrganizationsResponseSchema as M, ListProjectDeploymentsResponseSchema as N, InviteOrganizationMembersRequestSchema as O, ListProjectFilesResponseSchema as P, QueuedAgentPromptResponseSchema as Q, OrganizationSidebarBrandingSchema as R, GatewayAttachmentRecordSchema as S, WorkflowSummaryListResponseSchema as St, HistoryRunDetailResponseSchema as T, originFromPublicUrl as Tt, PresignProjectSourceRequestSchema as U, PresignOrgLogoRequestSchema as V, PresignProjectSourceResponseSchema as W, PromptInputSchema as X, ProjectSlugAvailabilityResponseSchema as Y, PromptResponseSchema as Z, CreateProjectResponseSchema as _, UserAvatarPatchSchema as _t, AgentSessionDetailResponseSchema as a, TriggerDetailResponseSchema as at, DeclineOrganizationInvitationResponseSchema as b, WorkflowRunListResponseSchema as bt, AgentSummaryListResponseSchema as c, TriggerRunListResponseSchema as ct, ConnectProvidersResponseSchema as d, UpdateOrganizationMemberResponseSchema as dt, ROUTE_MANIFEST_REL_PATH as et, CreateCredentialInstanceBodySchema as f, UpdateOrganizationRequestSchema as ft, CreateProjectRequestSchema as g, UpsertGatewayAttachmentBodySchema as gt, CreateProjectArtifactResponseSchema as h, UploadProjectSourceResponseSchema as ht, AgentListResponseSchema as i, SlugAvailabilityResponseSchema as it, ListOrganizationMembersResponseSchema as j, InviteOrganizationMembersResponseSchema as k, CompleteProjectArtifactResponseSchema as l, UpdateCredentialInstanceBodySchema as lt, CreateOrganizationResponseSchema as m, UploadProjectSourceManifestRequestSchema as mt, AcceptOrganizationInvitationResponseSchema as n, SkillSummaryDetailResponseSchema as nt, AgentSessionListResponseSchema as o, TriggerListResponseSchema as ot, CreateOrganizationRequestSchema as p, UpdateProjectRequestSchema as pt, ProjectReachabilityResponseSchema as q, ActiveOrganizationResponseSchema as r, SkillSummaryListResponseSchema as rt, AgentSummaryDetailResponseSchema as s, TriggerRunDetailResponseSchema as st, ACTIVE_ORG_HEADER as t, RecentResourceListResponseSchema as tt, ConnectAuthorizeUrlResponseSchema as u, UpdateOrganizationMemberRequestSchema as ut, CredentialInstanceListResponseSchema as v, UserAvatarSchema as vt, HistoryRunCancelResponseSchema as w, normalizeCredentialList as wt, ErrorResponseSchema as x, WorkflowSummaryDetailResponseSchema as xt, CredentialInstanceRecordSchema as y, WorkflowRunDetailResponseSchema as yt, PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS as z };
|
|
1736
|
+
|
|
1737
|
+
//# sourceMappingURL=dist-B27Z3YpE.mjs.map
|