@keystrokehq/cli 0.0.137 → 0.0.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1569 @@
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
+ "completed",
981
+ "failed"
982
+ ]);
983
+ const WorkflowRunTriggerSchema = _enum([
984
+ "api",
985
+ "cron",
986
+ "webhook",
987
+ "poll",
988
+ "retry"
989
+ ]);
990
+ _enum([
991
+ "run_started",
992
+ "step_completed",
993
+ "step_failed",
994
+ "step_retrying",
995
+ "sleep_scheduled",
996
+ "sleep_completed",
997
+ "hook_created",
998
+ "hook_resumed",
999
+ "run_completed",
1000
+ "run_failed"
1001
+ ]);
1002
+ const WorkflowRunSummarySchema = object({
1003
+ id: string(),
1004
+ status: WorkflowRunStatusSchema,
1005
+ trigger: WorkflowRunTriggerSchema,
1006
+ triggeredAt: string(),
1007
+ startedAt: string().nullable(),
1008
+ finishedAt: string().nullable(),
1009
+ sourceKind: RunSourceKindSchema,
1010
+ sourceId: string().nullable(),
1011
+ triggerRunId: string().nullable(),
1012
+ attachmentId: string().nullable()
1013
+ });
1014
+ const WorkflowRunRecordSchema = object({
1015
+ id: string(),
1016
+ workflowSlug: string(),
1017
+ status: WorkflowRunStatusSchema,
1018
+ trigger: WorkflowRunTriggerSchema,
1019
+ triggeredAt: string(),
1020
+ startedAt: string().nullable(),
1021
+ finishedAt: string().nullable(),
1022
+ sourceKind: RunSourceKindSchema,
1023
+ sourceId: string().nullable(),
1024
+ triggerRunId: string().nullable(),
1025
+ attachmentId: string().nullable(),
1026
+ parentWorkflowRunId: string().nullable(),
1027
+ parentSpanId: string().nullable(),
1028
+ input: unknown().nullable(),
1029
+ output: unknown().nullable(),
1030
+ error: unknown().nullable()
1031
+ });
1032
+ object({
1033
+ limit: number().int().min(1).max(100).optional().default(20),
1034
+ cursor: string().min(1).optional(),
1035
+ status: WorkflowRunStatusSchema.optional(),
1036
+ trigger: WorkflowRunTriggerSchema.optional()
1037
+ });
1038
+ const WorkflowRunListResponseSchema = object({
1039
+ items: array(WorkflowRunSummarySchema),
1040
+ nextCursor: string().nullable()
1041
+ });
1042
+ _enum([
1043
+ "trigger",
1044
+ "steps",
1045
+ "trace"
1046
+ ]);
1047
+ object({ include: string().optional() });
1048
+ const TriggerRunDetailSchema = object({
1049
+ id: string(),
1050
+ attachmentId: string(),
1051
+ attachmentSlug: string().nullable(),
1052
+ triggerType: _enum([
1053
+ "cron",
1054
+ "webhook",
1055
+ "poll"
1056
+ ]),
1057
+ sourcePath: string().nullable(),
1058
+ payload: unknown().nullable(),
1059
+ triggeredAt: string()
1060
+ });
1061
+ const WorkflowStepRunSchema = object({
1062
+ id: string(),
1063
+ actionKey: string(),
1064
+ output: unknown(),
1065
+ completedAt: string()
1066
+ });
1067
+ const TraceTriggerSummarySchema = object({
1068
+ triggerType: string(),
1069
+ triggerRunId: string(),
1070
+ workflowSlug: string().optional(),
1071
+ agentSlug: string().optional(),
1072
+ attachmentId: string().nullable().optional(),
1073
+ attachmentSlug: string().nullable().optional(),
1074
+ route: string().optional(),
1075
+ sourcePath: string().nullable().optional()
1076
+ }).nullable();
1077
+ const TraceGatewaySummarySchema = object({
1078
+ gatewayAttachmentId: string(),
1079
+ gatewayAttachmentKey: string(),
1080
+ threadId: string().optional(),
1081
+ channelId: string().optional(),
1082
+ mode: string().optional()
1083
+ }).nullable();
1084
+ const TraceSpanSchema = object({
1085
+ id: string(),
1086
+ traceId: string(),
1087
+ parentSpanId: string().nullable(),
1088
+ kind: string(),
1089
+ refId: string(),
1090
+ name: string(),
1091
+ status: string(),
1092
+ startedAt: string(),
1093
+ finishedAt: string().nullable(),
1094
+ metadata: unknown().nullable(),
1095
+ error: unknown().nullable()
1096
+ });
1097
+ const TraceLogSchema = object({
1098
+ id: string(),
1099
+ traceId: string(),
1100
+ spanId: string(),
1101
+ seq: number$1(),
1102
+ level: string(),
1103
+ message: string(),
1104
+ data: unknown().nullable(),
1105
+ source: string(),
1106
+ createdAt: string()
1107
+ });
1108
+ const TraceResponseSchema = object({
1109
+ traceId: string(),
1110
+ trigger: TraceTriggerSummarySchema,
1111
+ gateway: TraceGatewaySummarySchema,
1112
+ spans: array(TraceSpanSchema),
1113
+ logs: array(TraceLogSchema)
1114
+ });
1115
+ const WorkflowRunDetailResponseSchema = object({
1116
+ run: WorkflowRunRecordSchema,
1117
+ trigger: TriggerRunDetailSchema.nullable(),
1118
+ steps: array(WorkflowStepRunSchema),
1119
+ trace: TraceResponseSchema.nullable()
1120
+ });
1121
+ const AgentSessionStatusSchema = _enum([
1122
+ "running",
1123
+ "completed",
1124
+ "failed"
1125
+ ]);
1126
+ const AgentSessionSummarySchema = object({
1127
+ id: string(),
1128
+ status: AgentSessionStatusSchema,
1129
+ source: RunSourceKindSchema,
1130
+ sourceId: string().nullable(),
1131
+ createdAt: string(),
1132
+ updatedAt: string(),
1133
+ messageCount: number$1()
1134
+ });
1135
+ const AgentSessionRecordSchema = object({
1136
+ id: string(),
1137
+ agentSlug: string(),
1138
+ status: AgentSessionStatusSchema,
1139
+ source: RunSourceKindSchema,
1140
+ sourceId: string().nullable(),
1141
+ createdAt: string(),
1142
+ updatedAt: string(),
1143
+ parentSpanId: string().nullable(),
1144
+ messageCount: number$1(),
1145
+ error: unknown().nullable()
1146
+ });
1147
+ object({
1148
+ limit: number().int().min(1).max(100).optional().default(20),
1149
+ cursor: string().min(1).optional(),
1150
+ status: AgentSessionStatusSchema.optional(),
1151
+ source: RunSourceKindSchema.optional()
1152
+ });
1153
+ const AgentSessionListResponseSchema = object({
1154
+ items: array(AgentSessionSummarySchema),
1155
+ nextCursor: string().nullable()
1156
+ });
1157
+ _enum([
1158
+ "gateway",
1159
+ "messages",
1160
+ "events",
1161
+ "trace"
1162
+ ]);
1163
+ object({ include: string().optional() });
1164
+ const GatewaySessionDetailSchema = object({
1165
+ threadId: string(),
1166
+ attachmentId: string(),
1167
+ attachmentSlug: string().nullable()
1168
+ });
1169
+ const AgentEventSchema = object({
1170
+ id: string(),
1171
+ sessionId: string(),
1172
+ seq: number$1(),
1173
+ eventType: string(),
1174
+ payload: unknown(),
1175
+ createdAt: string()
1176
+ });
1177
+ const AgentSessionDetailResponseSchema = object({
1178
+ session: AgentSessionRecordSchema,
1179
+ gateway: GatewaySessionDetailSchema.nullable(),
1180
+ messages: array(record(string(), unknown())),
1181
+ events: array(AgentEventSchema),
1182
+ trace: TraceResponseSchema.nullable()
1183
+ });
1184
+ const SlackGatewayModeSchema = _enum([
1185
+ "mention",
1186
+ "channel",
1187
+ "dm"
1188
+ ]);
1189
+ const GatewayAttachmentSourceSchema = object({
1190
+ kind: literal("slack"),
1191
+ mode: SlackGatewayModeSchema,
1192
+ credentialKey: string(),
1193
+ channelIds: array(string()).optional(),
1194
+ subscribeOnMention: boolean()
1195
+ });
1196
+ const GatewayAttachmentRecordSchema = object({
1197
+ id: string(),
1198
+ key: string(),
1199
+ agentKey: string(),
1200
+ channelId: string(),
1201
+ teamId: string().nullable().optional(),
1202
+ platform: string(),
1203
+ source: GatewayAttachmentSourceSchema,
1204
+ registeredAt: string(),
1205
+ updatedAt: string()
1206
+ });
1207
+ object({ attachments: array(GatewayAttachmentRecordSchema) });
1208
+ const UpsertGatewayAttachmentBodySchema = object({
1209
+ agentKey: string().min(1),
1210
+ teamId: string().min(1).optional(),
1211
+ mode: SlackGatewayModeSchema.optional(),
1212
+ subscribeOnMention: boolean().optional()
1213
+ });
1214
+ const AgentListResponseSchema = object({ agents: array(object({
1215
+ key: string(),
1216
+ name: string().optional(),
1217
+ route: string()
1218
+ })) });
1219
+ object({ subscriptions: array(object({
1220
+ id: string(),
1221
+ workflowKey: string(),
1222
+ userId: string(),
1223
+ enabled: boolean(),
1224
+ createdAt: string(),
1225
+ updatedAt: string()
1226
+ })) });
1227
+ object({
1228
+ userId: string().min(1).optional(),
1229
+ enabled: boolean().optional()
1230
+ });
1231
+ const CredentialInstanceRecordSchema = object({
1232
+ id: string(),
1233
+ key: string(),
1234
+ scopeType: CredentialScopeTypeSchema,
1235
+ scopeId: string().nullable(),
1236
+ label: string().nullable(),
1237
+ isDefault: boolean(),
1238
+ authKind: CredentialAuthKindSchema
1239
+ });
1240
+ const CredentialInstanceListResponseSchema = object({ instances: array(CredentialInstanceRecordSchema) });
1241
+ const CreateCredentialInstanceBodySchema = object({
1242
+ key: string().min(1),
1243
+ scopeType: CredentialScopeTypeSchema,
1244
+ scopeId: string().nullable().optional(),
1245
+ label: string().nullable().optional(),
1246
+ isDefault: boolean().optional(),
1247
+ value: record(string(), unknown()).refine((value) => Object.keys(value).length > 0, { message: "value must be a non-empty object" })
1248
+ });
1249
+ const UpdateCredentialInstanceBodySchema = object({
1250
+ label: string().nullable().optional(),
1251
+ isDefault: boolean().optional(),
1252
+ value: record(string(), unknown()).refine((value) => Object.keys(value).length > 0, { message: "value must be a non-empty object" }).optional()
1253
+ });
1254
+ const TriggerRunTypeSchema = _enum([
1255
+ "cron",
1256
+ "webhook",
1257
+ "poll"
1258
+ ]);
1259
+ const TriggerRunWorkflowSummarySchema = object({
1260
+ id: string(),
1261
+ status: WorkflowRunStatusSchema,
1262
+ workflowSlug: string()
1263
+ });
1264
+ const TriggerRunAgentSessionSummarySchema = object({
1265
+ id: string(),
1266
+ agentSlug: string()
1267
+ });
1268
+ const TriggerRunSummarySchema = object({
1269
+ id: string(),
1270
+ triggerType: TriggerRunTypeSchema,
1271
+ triggeredAt: string(),
1272
+ sourcePath: string().nullable(),
1273
+ workflowRun: TriggerRunWorkflowSummarySchema.nullable(),
1274
+ agentSession: TriggerRunAgentSessionSummarySchema.nullable()
1275
+ });
1276
+ const TriggerRunRecordSchema = object({
1277
+ id: string(),
1278
+ attachmentId: string(),
1279
+ attachmentSlug: string(),
1280
+ triggerType: TriggerRunTypeSchema,
1281
+ sourcePath: string().nullable(),
1282
+ payload: unknown().nullable(),
1283
+ triggeredAt: string()
1284
+ });
1285
+ object({
1286
+ limit: number().int().min(1).max(100).optional().default(20),
1287
+ cursor: string().min(1).optional(),
1288
+ triggerType: TriggerRunTypeSchema.optional()
1289
+ });
1290
+ const TriggerRunListResponseSchema = object({
1291
+ items: array(TriggerRunSummarySchema),
1292
+ nextCursor: string().nullable()
1293
+ });
1294
+ _enum([
1295
+ "workflows",
1296
+ "agents",
1297
+ "trace"
1298
+ ]);
1299
+ object({ include: string().optional() });
1300
+ const TriggerRunAgentSessionDetailSchema = object({
1301
+ id: string(),
1302
+ agentSlug: string()
1303
+ });
1304
+ const TriggerRunDetailResponseSchema = object({
1305
+ run: TriggerRunRecordSchema,
1306
+ workflowRuns: array(WorkflowRunSummarySchema),
1307
+ agentSessions: array(TriggerRunAgentSessionDetailSchema),
1308
+ trace: TraceResponseSchema.nullable()
1309
+ });
1310
+ const TriggerTypeSchema = _enum([
1311
+ "webhook",
1312
+ "poll",
1313
+ "cron"
1314
+ ]);
1315
+ const TriggerTargetKindSchema = _enum(["workflow", "agent"]);
1316
+ const TriggerListItemSchema = object({
1317
+ key: string(),
1318
+ type: TriggerTypeSchema,
1319
+ route: string().optional(),
1320
+ webhookUrl: string().url().optional(),
1321
+ targetKind: TriggerTargetKindSchema,
1322
+ workflowKey: string().optional(),
1323
+ agentKey: string().optional()
1324
+ });
1325
+ const TriggerListResponseSchema = object({ triggers: array(TriggerListItemSchema) });
1326
+ object({ endpoint: string().min(1).optional() });
1327
+ const TriggerDetailResponseSchema = TriggerListItemSchema;
1328
+ const OrganizationMemberRoleSchema = _enum([
1329
+ "owner",
1330
+ "admin",
1331
+ "builder"
1332
+ ]);
1333
+ const OrganizationMemberStatusSchema = _enum([
1334
+ "invited",
1335
+ "active",
1336
+ "rejected",
1337
+ "suspended"
1338
+ ]);
1339
+ const InvitableOrganizationMemberRoleSchema = _enum(["admin", "builder"]);
1340
+ const isoDateTime$2 = string().datetime();
1341
+ const OrganizationMemberSchema = object({
1342
+ id: string(),
1343
+ name: string(),
1344
+ email: string().email(),
1345
+ role: OrganizationMemberRoleSchema,
1346
+ status: OrganizationMemberStatusSchema,
1347
+ avatarUrl: string().optional(),
1348
+ joinedAt: isoDateTime$2.optional(),
1349
+ lastActiveAt: isoDateTime$2.nullable().optional()
1350
+ });
1351
+ const ListOrganizationMembersResponseSchema = object({ members: array(OrganizationMemberSchema) });
1352
+ const InviteOrganizationMembersRequestSchema = object({
1353
+ emails: array(string().trim().email()).min(1),
1354
+ role: InvitableOrganizationMemberRoleSchema
1355
+ });
1356
+ const InviteOrganizationMemberResultStatusSchema = _enum([
1357
+ "sent",
1358
+ "already_member",
1359
+ "pending",
1360
+ "invalid"
1361
+ ]);
1362
+ const InviteOrganizationMembersResponseSchema = object({ results: array(object({
1363
+ email: string(),
1364
+ status: InviteOrganizationMemberResultStatusSchema,
1365
+ invitationId: string().optional()
1366
+ })) });
1367
+ const UpdateOrganizationMemberRequestSchema = object({ role: InvitableOrganizationMemberRoleSchema });
1368
+ const UpdateOrganizationMemberResponseSchema = object({ member: OrganizationMemberSchema });
1369
+ const ListOrganizationInvitationsResponseSchema = object({ invitations: array(object({
1370
+ id: string(),
1371
+ organizationName: string(),
1372
+ organizationSlug: OrganizationSlugSchema,
1373
+ invitedByName: string().optional(),
1374
+ invitedByEmail: string().email().optional(),
1375
+ role: OrganizationMemberRoleSchema
1376
+ })) });
1377
+ const AcceptOrganizationInvitationResponseSchema = object({ organization: UserOrganizationSchema });
1378
+ const DeclineOrganizationInvitationResponseSchema = object({ success: literal(true) });
1379
+ /** Custom avatar override; null means fall back to OAuth `users.image`. */
1380
+ const UserAvatarSchema = object({ url: url().nullable() });
1381
+ const UserAvatarPatchSchema = object({
1382
+ /** Storage key returned from presign; null removes the custom override. */
1383
+ storageKey: string().min(1).nullable() });
1384
+ const PresignUserAvatarRequestSchema = object({ contentType: string().trim().min(1) });
1385
+ const PresignUserAvatarResponseSchema = object({
1386
+ uploadUrl: url(),
1387
+ storageKey: string().min(1)
1388
+ });
1389
+ const OrganizationLogoVariantSchema = _enum(["light", "dark"]);
1390
+ const OrganizationSidebarBrandingSchema = object({
1391
+ customLogoEnabled: boolean(),
1392
+ customLogoExplicitlyDisabled: boolean(),
1393
+ logoLightUrl: url().nullable(),
1394
+ logoDarkUrl: url().nullable(),
1395
+ logoHeightPx: number$1().int().min(14).max(32)
1396
+ });
1397
+ const OrganizationSidebarBrandingPatchSchema = object({
1398
+ customLogoEnabled: boolean().optional(),
1399
+ customLogoExplicitlyDisabled: boolean().optional(),
1400
+ logoLightStorageKey: string().min(1).nullable().optional(),
1401
+ logoDarkStorageKey: string().min(1).nullable().optional(),
1402
+ logoHeightPx: number$1().int().min(14).max(32).optional()
1403
+ }).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" });
1404
+ const PresignOrgLogoRequestSchema = object({
1405
+ variant: OrganizationLogoVariantSchema,
1406
+ contentType: string().trim().min(1)
1407
+ });
1408
+ const PresignOrgLogoResponseSchema = object({
1409
+ uploadUrl: url(),
1410
+ storageKey: string().min(1)
1411
+ });
1412
+ const ProjectArtifactStatusSchema = _enum(["pending", "ready"]);
1413
+ const isoDateTime$1 = string().datetime();
1414
+ const ProjectArtifactSchema = object({
1415
+ id: string(),
1416
+ projectId: string(),
1417
+ storageKey: string(),
1418
+ status: ProjectArtifactStatusSchema,
1419
+ createdAt: isoDateTime$1,
1420
+ updatedAt: isoDateTime$1
1421
+ });
1422
+ const CreateProjectArtifactResponseSchema = object({
1423
+ artifact: ProjectArtifactSchema,
1424
+ uploadUrl: string().url(),
1425
+ expiresInSeconds: number$1().int().positive()
1426
+ });
1427
+ const CompleteProjectArtifactResponseSchema = object({
1428
+ artifact: ProjectArtifactSchema,
1429
+ project: ProjectSchema
1430
+ });
1431
+ const ListProjectDeploymentsResponseSchema = object({ deployments: array(object({
1432
+ id: string(),
1433
+ projectId: string(),
1434
+ version: number$1().int().positive(),
1435
+ deployedBy: string().nullable(),
1436
+ deployedByEmail: string().optional(),
1437
+ deployedByAvatarUrl: string().optional(),
1438
+ createdAt: isoDateTime$1,
1439
+ active: boolean()
1440
+ })) });
1441
+ const optionalCount = number$1().int().nonnegative().nullable().optional();
1442
+ const optionalTimestamp = string().nullable().optional();
1443
+ const AgentSummarySchema = object({
1444
+ id: string().min(1),
1445
+ slug: string().min(1),
1446
+ name: string().min(1),
1447
+ projectId: string().min(1),
1448
+ updatedAt: string().min(1),
1449
+ description: string().optional(),
1450
+ sourcePath: string().min(1).optional(),
1451
+ model: string().optional(),
1452
+ toolCount: optionalCount,
1453
+ credentialCount: optionalCount,
1454
+ lastRunAt: optionalTimestamp
1455
+ });
1456
+ const WorkflowSummarySchema = object({
1457
+ id: string().min(1),
1458
+ slug: string().min(1),
1459
+ name: string().min(1),
1460
+ projectId: string().min(1),
1461
+ updatedAt: string().min(1),
1462
+ description: string().optional(),
1463
+ sourcePath: string().min(1).optional(),
1464
+ lastRunAt: optionalTimestamp
1465
+ });
1466
+ const SkillSummarySchema = object({
1467
+ id: string().min(1),
1468
+ slug: string().min(1),
1469
+ name: string().min(1),
1470
+ projectId: string().min(1),
1471
+ updatedAt: string().min(1),
1472
+ description: string().optional(),
1473
+ sourcePath: string().min(1).optional()
1474
+ });
1475
+ const AgentSummaryListResponseSchema = array(AgentSummarySchema);
1476
+ const AgentSummaryDetailResponseSchema = AgentSummarySchema.nullable();
1477
+ const WorkflowSummaryListResponseSchema = array(WorkflowSummarySchema);
1478
+ const WorkflowSummaryDetailResponseSchema = WorkflowSummarySchema.nullable();
1479
+ const SkillSummaryListResponseSchema = array(SkillSummarySchema);
1480
+ const SkillSummaryDetailResponseSchema = SkillSummarySchema.nullable();
1481
+ const RecentResourceKindSchema = _enum([
1482
+ "agent",
1483
+ "workflow",
1484
+ "skill"
1485
+ ]);
1486
+ const RecentResourceSourceSchema = _enum(["owned", "shared"]);
1487
+ const RecentResourceListResponseSchema = array(object({
1488
+ id: string().min(1),
1489
+ resourceKind: RecentResourceKindSchema,
1490
+ resourceId: string().min(1),
1491
+ name: string().min(1),
1492
+ description: string().optional(),
1493
+ projectId: string().min(1),
1494
+ projectName: string().min(1),
1495
+ sourcePath: string().min(1).optional(),
1496
+ source: RecentResourceSourceSchema,
1497
+ lastOpenedAt: string().min(1),
1498
+ lastModifiedAt: string().min(1)
1499
+ }));
1500
+ const isoDateTime = string().datetime();
1501
+ const sha256Hex = string().regex(/^[a-f0-9]{64}$/, "Expected a lowercase hex sha256 digest");
1502
+ /**
1503
+ * A single entry in a deploy's file tree, as served to the dashboard. Carries
1504
+ * no contents: `id` is a stable, path-derived handle used for selection and
1505
+ * `?file=` deep links; `hash` is the content address used to fetch the bytes
1506
+ * lazily and to cache them immutably in the browser.
1507
+ */
1508
+ const ProjectFileSummarySchema = object({
1509
+ id: string(),
1510
+ path: string().min(1),
1511
+ hash: sha256Hex
1512
+ });
1513
+ /** Maps a runtime resource slug (agent/workflow/skill) to its source file path. */
1514
+ const ProjectSourceResourceRefSchema = object({
1515
+ slug: string().min(1),
1516
+ path: string().min(1)
1517
+ });
1518
+ const ProjectSourceResourcesSchema = object({
1519
+ agents: array(ProjectSourceResourceRefSchema).default([]),
1520
+ workflows: array(ProjectSourceResourceRefSchema).default([]),
1521
+ skills: array(ProjectSourceResourceRefSchema).default([])
1522
+ });
1523
+ const emptyResources = () => ({
1524
+ agents: [],
1525
+ workflows: [],
1526
+ skills: []
1527
+ });
1528
+ /** Response for the file-tree listing of a project's active deploy. */
1529
+ const ListProjectFilesResponseSchema = object({
1530
+ artifactId: string().nullable(),
1531
+ files: array(ProjectFileSummarySchema),
1532
+ resources: ProjectSourceResourcesSchema.default(emptyResources())
1533
+ });
1534
+ object({
1535
+ path: string().min(1),
1536
+ contents: string(),
1537
+ hash: sha256Hex
1538
+ });
1539
+ /** Request: ask the platform which blobs are missing and get presigned PUTs. */
1540
+ const PresignProjectSourceRequestSchema = object({ blobs: array(object({
1541
+ hash: sha256Hex,
1542
+ size: number$1().int().nonnegative()
1543
+ })) });
1544
+ /** Response: presigned PUTs for the subset of blobs not already stored. */
1545
+ const PresignProjectSourceResponseSchema = object({ uploads: array(object({
1546
+ hash: sha256Hex,
1547
+ url: string().url()
1548
+ })) });
1549
+ /** Request body the CLI sends to finalize a deploy's source manifest. */
1550
+ const UploadProjectSourceManifestRequestSchema = object({ files: array(object({
1551
+ path: string().min(1),
1552
+ hash: sha256Hex
1553
+ })) });
1554
+ const UploadProjectSourceResponseSchema = object({
1555
+ ok: literal(true),
1556
+ fileCount: number$1().int().nonnegative()
1557
+ });
1558
+ object({
1559
+ files: array(object({
1560
+ id: string(),
1561
+ path: string().min(1),
1562
+ hash: sha256Hex
1563
+ })),
1564
+ generatedAt: isoDateTime
1565
+ });
1566
+ //#endregion
1567
+ export { SkillSummaryListResponseSchema as $, ListProjectFilesResponseSchema as A, PresignProjectSourceResponseSchema as B, HealthResponseSchema as C, ListOrganizationMembersResponseSchema as D, ListOrganizationInvitationsResponseSchema as E, PROJECT_REACHABILITY_REQUEST_TIMEOUT_MS as F, ProjectSlugAvailabilityResponseSchema as G, PresignUserAvatarResponseSchema as H, PollRunResponseSchema as I, QueuedAgentPromptResponseSchema as J, PromptInputSchema as K, PresignOrgLogoRequestSchema as L, ListProjectsResponseSchema as M, OrganizationSidebarBrandingPatchSchema as N, ListOrganizationsResponseSchema as O, OrganizationSidebarBrandingSchema as P, SkillSummaryDetailResponseSchema as Q, PresignOrgLogoResponseSchema as R, GatewayAttachmentRecordSchema as S, parseErrorResponse as St, InviteOrganizationMembersResponseSchema as T, ProjectReachabilityResponseSchema as U, PresignUserAvatarRequestSchema as V, ProjectResponseSchema as W, ROUTE_MANIFEST_REL_PATH as X, QueuedRunResponseSchema as Y, RecentResourceListResponseSchema as Z, CreateProjectResponseSchema as _, WorkflowSummaryDetailResponseSchema as _t, AgentSessionDetailResponseSchema as a, UpdateCredentialInstanceBodySchema as at, DeclineOrganizationInvitationResponseSchema as b, normalizeCredentialList as bt, AgentSummaryListResponseSchema as c, UpdateOrganizationRequestSchema as ct, ConnectProvidersResponseSchema as d, UploadProjectSourceResponseSchema as dt, SlugAvailabilityResponseSchema as et, CreateCredentialInstanceBodySchema as f, UpsertGatewayAttachmentBodySchema as ft, CreateProjectRequestSchema as g, WorkflowRunListResponseSchema as gt, CreateProjectArtifactResponseSchema as h, WorkflowRunDetailResponseSchema as ht, AgentListResponseSchema as i, TriggerRunListResponseSchema as it, ListProjectMetricsResponseSchema as j, ListProjectDeploymentsResponseSchema as k, CompleteProjectArtifactResponseSchema as l, UpdateProjectRequestSchema as lt, CreateOrganizationResponseSchema as m, UserAvatarSchema as mt, AcceptOrganizationInvitationResponseSchema as n, TriggerListResponseSchema as nt, AgentSessionListResponseSchema as o, UpdateOrganizationMemberRequestSchema as ot, CreateOrganizationRequestSchema as p, UserAvatarPatchSchema as pt, PromptResponseSchema as q, ActiveOrganizationResponseSchema as r, TriggerRunDetailResponseSchema as rt, AgentSummaryDetailResponseSchema as s, UpdateOrganizationMemberResponseSchema as st, ACTIVE_ORG_HEADER as t, TriggerDetailResponseSchema as tt, ConnectAuthorizeUrlResponseSchema as u, UploadProjectSourceManifestRequestSchema as ut, CredentialInstanceListResponseSchema as v, WorkflowSummaryListResponseSchema as vt, InviteOrganizationMembersRequestSchema as w, ErrorResponseSchema as x, originFromPublicUrl as xt, CredentialInstanceRecordSchema as y, listenPortFromPublicUrl as yt, PresignProjectSourceRequestSchema as z };
1568
+
1569
+ //# sourceMappingURL=dist-CqVk9JsS.mjs.map