@rudderhq/cli 0.1.0-canary.2 → 0.1.0-canary.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ var __export = (target, all) => {
10
10
  };
11
11
 
12
12
  // ../packages/shared/src/constants.ts
13
- var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
13
+ var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
14
14
  var init_constants = __esm({
15
15
  "../packages/shared/src/constants.ts"() {
16
16
  "use strict";
@@ -113,6 +113,7 @@ var init_constants = __esm({
113
113
  "issue_proposal",
114
114
  "operation_proposal",
115
115
  "routing_suggestion",
116
+ "user_input_request",
116
117
  "system_event"
117
118
  ];
118
119
  CHAT_MESSAGE_STATUSES = ["completed", "stopped", "failed"];
@@ -143,6 +144,26 @@ var init_constants = __esm({
143
144
  AUTOMATION_CONCURRENCY_POLICIES = ["coalesce_if_active", "always_enqueue", "skip_if_active"];
144
145
  AUTOMATION_CATCH_UP_POLICIES = ["skip_missed", "enqueue_missed_with_cap"];
145
146
  AUTOMATION_TRIGGER_SIGNING_MODES = ["bearer", "hmac_sha256"];
147
+ PROJECT_COLORS = [
148
+ "linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)",
149
+ "linear-gradient(135deg, #7c3aed 0%, #d946ef 100%)",
150
+ "linear-gradient(135deg, #db2777 0%, #f97316 100%)",
151
+ "linear-gradient(135deg, #ef4444 0%, #f59e0b 100%)",
152
+ "linear-gradient(135deg, #f97316 0%, #facc15 100%)",
153
+ "linear-gradient(135deg, #10b981 0%, #84cc16 100%)",
154
+ "linear-gradient(135deg, #059669 0%, #14b8a6 100%)",
155
+ "linear-gradient(135deg, #0d9488 0%, #06b6d4 100%)",
156
+ "linear-gradient(135deg, #0284c7 0%, #2563eb 100%)",
157
+ "linear-gradient(135deg, #2563eb 0%, #4f46e5 100%)",
158
+ "linear-gradient(135deg, #f43f5e 0%, #ec4899 100%)",
159
+ "linear-gradient(135deg, #be123c 0%, #7c2d12 100%)",
160
+ "linear-gradient(135deg, #a16207 0%, #ca8a04 100%)",
161
+ "linear-gradient(135deg, #16a34a 0%, #0f766e 100%)",
162
+ "linear-gradient(135deg, #0891b2 0%, #4338ca 100%)",
163
+ "linear-gradient(135deg, #6d28d9 0%, #be185d 100%)",
164
+ "linear-gradient(135deg, #475569 0%, #0f766e 100%)",
165
+ "linear-gradient(135deg, #334155 0%, #7c3aed 100%)"
166
+ ];
146
167
  APPROVAL_TYPES = [
147
168
  "hire_agent",
148
169
  "approve_ceo_strategy",
@@ -377,7 +398,7 @@ var init_observability = __esm({
377
398
 
378
399
  // ../packages/shared/src/validators/instance.ts
379
400
  import { z } from "zod";
380
- var instanceLocaleSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, instanceLangfuseSettingsSchema, patchInstanceLangfuseSettingsSchema, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, instanceExperimentalSettingsSchema, patchInstanceExperimentalSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
401
+ var instanceLocaleSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, instanceLangfuseSettingsSchema, patchInstanceLangfuseSettingsSchema, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
381
402
  var init_instance = __esm({
382
403
  "../packages/shared/src/validators/instance.ts"() {
383
404
  "use strict";
@@ -415,10 +436,6 @@ var init_instance = __esm({
415
436
  moreAboutYou: z.string().max(2e3).default("")
416
437
  }).strict();
417
438
  patchOperatorProfileSettingsSchema = operatorProfileSettingsSchema.partial();
418
- instanceExperimentalSettingsSchema = z.object({
419
- autoRestartDevServerWhenIdle: z.boolean().default(false)
420
- }).strict();
421
- patchInstanceExperimentalSettingsSchema = instanceExperimentalSettingsSchema.partial();
422
439
  instancePathPickerSelectionTypeSchema = z.enum(["file", "directory"]);
423
440
  instancePathPickerRequestSchema = z.object({
424
441
  selectionType: instancePathPickerSelectionTypeSchema
@@ -464,174 +481,252 @@ var init_budget = __esm({
464
481
  }
465
482
  });
466
483
 
467
- // ../packages/shared/src/validators/organization.ts
484
+ // ../packages/shared/src/validators/model-fallbacks.ts
468
485
  import { z as z3 } from "zod";
469
- var logoAssetIdSchema, brandColorSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
486
+ function isRecord(value) {
487
+ return typeof value === "object" && value !== null && !Array.isArray(value);
488
+ }
489
+ function validateModelFallbacksConfig(value, ctx, pathPrefix) {
490
+ const fallbackModels = value.modelFallbacks;
491
+ if (fallbackModels === void 0) return;
492
+ if (!Array.isArray(fallbackModels)) {
493
+ ctx.addIssue({
494
+ code: z3.ZodIssueCode.custom,
495
+ message: "modelFallbacks must be an array",
496
+ path: [...pathPrefix, "modelFallbacks"]
497
+ });
498
+ return;
499
+ }
500
+ fallbackModels.forEach((fallback, index63) => {
501
+ if (typeof fallback === "string") {
502
+ if (fallback.trim().length === 0) {
503
+ ctx.addIssue({
504
+ code: z3.ZodIssueCode.custom,
505
+ message: "modelFallbacks string entries must be non-empty",
506
+ path: [...pathPrefix, "modelFallbacks", index63]
507
+ });
508
+ }
509
+ return;
510
+ }
511
+ if (!isRecord(fallback)) {
512
+ ctx.addIssue({
513
+ code: z3.ZodIssueCode.custom,
514
+ message: "modelFallbacks entries must be strings or runtime/model objects",
515
+ path: [...pathPrefix, "modelFallbacks", index63]
516
+ });
517
+ return;
518
+ }
519
+ if (typeof fallback.agentRuntimeType !== "string" || fallback.agentRuntimeType.trim().length === 0) {
520
+ ctx.addIssue({
521
+ code: z3.ZodIssueCode.custom,
522
+ message: "modelFallbacks entries must include agentRuntimeType",
523
+ path: [...pathPrefix, "modelFallbacks", index63, "agentRuntimeType"]
524
+ });
525
+ } else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
526
+ ctx.addIssue({
527
+ code: z3.ZodIssueCode.custom,
528
+ message: "modelFallbacks entries must include a valid agentRuntimeType",
529
+ path: [...pathPrefix, "modelFallbacks", index63, "agentRuntimeType"]
530
+ });
531
+ }
532
+ if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
533
+ ctx.addIssue({
534
+ code: z3.ZodIssueCode.custom,
535
+ message: "modelFallbacks entries must include model",
536
+ path: [...pathPrefix, "modelFallbacks", index63, "model"]
537
+ });
538
+ }
539
+ if (fallback.config !== void 0 && !isRecord(fallback.config)) {
540
+ ctx.addIssue({
541
+ code: z3.ZodIssueCode.custom,
542
+ message: "modelFallbacks entry config must be an object",
543
+ path: [...pathPrefix, "modelFallbacks", index63, "config"]
544
+ });
545
+ }
546
+ });
547
+ }
548
+ var agentRuntimeTypes;
549
+ var init_model_fallbacks = __esm({
550
+ "../packages/shared/src/validators/model-fallbacks.ts"() {
551
+ "use strict";
552
+ init_constants();
553
+ agentRuntimeTypes = new Set(AGENT_RUNTIME_TYPES);
554
+ }
555
+ });
556
+
557
+ // ../packages/shared/src/validators/organization.ts
558
+ import { z as z4 } from "zod";
559
+ var logoAssetIdSchema, brandColorSchema, defaultChatRuntimeConfigSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
470
560
  var init_organization = __esm({
471
561
  "../packages/shared/src/validators/organization.ts"() {
472
562
  "use strict";
473
563
  init_constants();
474
- logoAssetIdSchema = z3.string().uuid().nullable().optional();
475
- brandColorSchema = z3.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
476
- createOrganizationSchema = z3.object({
477
- name: z3.string().min(1),
478
- description: z3.string().optional().nullable(),
479
- budgetMonthlyCents: z3.number().int().nonnegative().optional().default(0),
480
- defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
481
- defaultChatAgentRuntimeType: z3.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
482
- defaultChatAgentRuntimeConfig: z3.record(z3.unknown()).optional().nullable(),
564
+ init_model_fallbacks();
565
+ logoAssetIdSchema = z4.string().uuid().nullable().optional();
566
+ brandColorSchema = z4.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
567
+ defaultChatRuntimeConfigSchema = z4.record(z4.unknown()).superRefine((value, ctx) => {
568
+ validateModelFallbacksConfig(value, ctx, []);
569
+ });
570
+ createOrganizationSchema = z4.object({
571
+ name: z4.string().min(1),
572
+ description: z4.string().optional().nullable(),
573
+ budgetMonthlyCents: z4.number().int().nonnegative().optional().default(0),
574
+ defaultChatIssueCreationMode: z4.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
575
+ defaultChatAgentRuntimeType: z4.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
576
+ defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
483
577
  brandColor: brandColorSchema,
484
- requireBoardApprovalForNewAgents: z3.boolean().optional()
578
+ requireBoardApprovalForNewAgents: z4.boolean().optional()
485
579
  });
486
580
  updateOrganizationSchema = createOrganizationSchema.partial().extend({
487
- status: z3.enum(ORGANIZATION_STATUSES).optional(),
488
- spentMonthlyCents: z3.number().int().nonnegative().optional(),
489
- requireBoardApprovalForNewAgents: z3.boolean().optional(),
490
- defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional(),
491
- defaultChatAgentRuntimeType: z3.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
492
- defaultChatAgentRuntimeConfig: z3.record(z3.unknown()).optional().nullable(),
581
+ status: z4.enum(ORGANIZATION_STATUSES).optional(),
582
+ spentMonthlyCents: z4.number().int().nonnegative().optional(),
583
+ requireBoardApprovalForNewAgents: z4.boolean().optional(),
584
+ defaultChatIssueCreationMode: z4.enum(CHAT_ISSUE_CREATION_MODES).optional(),
585
+ defaultChatAgentRuntimeType: z4.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
586
+ defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
493
587
  brandColor: brandColorSchema,
494
588
  logoAssetId: logoAssetIdSchema
495
589
  });
496
- updateOrganizationBrandingSchema = z3.object({
497
- name: z3.string().min(1).optional(),
498
- description: z3.string().nullable().optional(),
590
+ updateOrganizationBrandingSchema = z4.object({
591
+ name: z4.string().min(1).optional(),
592
+ description: z4.string().nullable().optional(),
499
593
  brandColor: brandColorSchema,
500
594
  logoAssetId: logoAssetIdSchema
501
595
  }).strict().refine(
502
596
  (value) => value.name !== void 0 || value.description !== void 0 || value.brandColor !== void 0 || value.logoAssetId !== void 0,
503
597
  "At least one branding field must be provided"
504
598
  );
505
- updateOrganizationWorkspaceFileSchema = z3.object({
506
- content: z3.string()
599
+ updateOrganizationWorkspaceFileSchema = z4.object({
600
+ content: z4.string()
507
601
  });
508
602
  }
509
603
  });
510
604
 
511
605
  // ../packages/shared/src/validators/resource.ts
512
- import { z as z4 } from "zod";
606
+ import { z as z5 } from "zod";
513
607
  var organizationResourceKindSchema, projectResourceAttachmentRoleSchema, createOrganizationResourceSchema, updateOrganizationResourceSchema, projectResourceAttachmentInputSchema, updateProjectResourceAttachmentSchema, createProjectInlineResourceSchema;
514
608
  var init_resource = __esm({
515
609
  "../packages/shared/src/validators/resource.ts"() {
516
610
  "use strict";
517
611
  init_constants();
518
- organizationResourceKindSchema = z4.enum(ORGANIZATION_RESOURCE_KINDS);
519
- projectResourceAttachmentRoleSchema = z4.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
520
- createOrganizationResourceSchema = z4.object({
521
- name: z4.string().min(1),
612
+ organizationResourceKindSchema = z5.enum(ORGANIZATION_RESOURCE_KINDS);
613
+ projectResourceAttachmentRoleSchema = z5.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
614
+ createOrganizationResourceSchema = z5.object({
615
+ name: z5.string().min(1),
522
616
  kind: organizationResourceKindSchema,
523
- locator: z4.string().min(1),
524
- description: z4.string().optional().nullable(),
525
- metadata: z4.record(z4.unknown()).optional().nullable()
617
+ locator: z5.string().min(1),
618
+ description: z5.string().optional().nullable(),
619
+ metadata: z5.record(z5.unknown()).optional().nullable()
526
620
  });
527
- updateOrganizationResourceSchema = z4.object({
528
- name: z4.string().min(1).optional(),
621
+ updateOrganizationResourceSchema = z5.object({
622
+ name: z5.string().min(1).optional(),
529
623
  kind: organizationResourceKindSchema.optional(),
530
- locator: z4.string().min(1).optional(),
531
- description: z4.string().optional().nullable(),
532
- metadata: z4.record(z4.unknown()).optional().nullable()
624
+ locator: z5.string().min(1).optional(),
625
+ description: z5.string().optional().nullable(),
626
+ metadata: z5.record(z5.unknown()).optional().nullable()
533
627
  }).strict();
534
- projectResourceAttachmentInputSchema = z4.object({
535
- resourceId: z4.string().uuid(),
628
+ projectResourceAttachmentInputSchema = z5.object({
629
+ resourceId: z5.string().uuid(),
536
630
  role: projectResourceAttachmentRoleSchema.optional(),
537
- note: z4.string().optional().nullable(),
538
- sortOrder: z4.number().int().nonnegative().optional()
631
+ note: z5.string().optional().nullable(),
632
+ sortOrder: z5.number().int().nonnegative().optional()
539
633
  }).strict();
540
- updateProjectResourceAttachmentSchema = z4.object({
634
+ updateProjectResourceAttachmentSchema = z5.object({
541
635
  role: projectResourceAttachmentRoleSchema.optional(),
542
- note: z4.string().optional().nullable(),
543
- sortOrder: z4.number().int().nonnegative().optional()
636
+ note: z5.string().optional().nullable(),
637
+ sortOrder: z5.number().int().nonnegative().optional()
544
638
  }).strict();
545
639
  createProjectInlineResourceSchema = createOrganizationResourceSchema.extend({
546
640
  role: projectResourceAttachmentRoleSchema.optional(),
547
- note: z4.string().optional().nullable(),
548
- sortOrder: z4.number().int().nonnegative().optional()
641
+ note: z5.string().optional().nullable(),
642
+ sortOrder: z5.number().int().nonnegative().optional()
549
643
  }).strict();
550
644
  }
551
645
  });
552
646
 
553
647
  // ../packages/shared/src/validators/chat.ts
554
- import { z as z5 } from "zod";
648
+ import { z as z6 } from "zod";
555
649
  var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
556
650
  var init_chat = __esm({
557
651
  "../packages/shared/src/validators/chat.ts"() {
558
652
  "use strict";
559
653
  init_constants();
560
- chatConversationStatusSchema = z5.enum(CHAT_CONVERSATION_STATUSES);
561
- chatIssueCreationModeSchema = z5.enum(CHAT_ISSUE_CREATION_MODES);
562
- chatMessageRoleSchema = z5.enum(CHAT_MESSAGE_ROLES);
563
- chatMessageKindSchema = z5.enum(CHAT_MESSAGE_KINDS);
564
- chatMessageStatusSchema = z5.enum(CHAT_MESSAGE_STATUSES);
565
- chatContextEntityTypeSchema = z5.enum(CHAT_CONTEXT_ENTITY_TYPES);
566
- createChatContextLinkSchema = z5.object({
654
+ chatConversationStatusSchema = z6.enum(CHAT_CONVERSATION_STATUSES);
655
+ chatIssueCreationModeSchema = z6.enum(CHAT_ISSUE_CREATION_MODES);
656
+ chatMessageRoleSchema = z6.enum(CHAT_MESSAGE_ROLES);
657
+ chatMessageKindSchema = z6.enum(CHAT_MESSAGE_KINDS);
658
+ chatMessageStatusSchema = z6.enum(CHAT_MESSAGE_STATUSES);
659
+ chatContextEntityTypeSchema = z6.enum(CHAT_CONTEXT_ENTITY_TYPES);
660
+ createChatContextLinkSchema = z6.object({
567
661
  entityType: chatContextEntityTypeSchema,
568
- entityId: z5.string().min(1),
569
- metadata: z5.record(z5.unknown()).optional().nullable()
662
+ entityId: z6.string().min(1),
663
+ metadata: z6.record(z6.unknown()).optional().nullable()
570
664
  });
571
- createChatConversationSchema = z5.object({
572
- title: z5.string().trim().min(1).max(200).optional(),
573
- summary: z5.string().trim().max(5e3).optional().nullable(),
574
- preferredAgentId: z5.string().uuid().optional().nullable(),
665
+ createChatConversationSchema = z6.object({
666
+ title: z6.string().trim().min(1).max(200).optional(),
667
+ summary: z6.string().trim().max(5e3).optional().nullable(),
668
+ preferredAgentId: z6.string().uuid().optional().nullable(),
575
669
  issueCreationMode: chatIssueCreationModeSchema.optional(),
576
- planMode: z5.boolean().optional(),
577
- contextLinks: z5.array(createChatContextLinkSchema).optional().default([])
670
+ planMode: z6.boolean().optional(),
671
+ contextLinks: z6.array(createChatContextLinkSchema).optional().default([])
578
672
  });
579
- setChatProjectContextSchema = z5.object({
580
- projectId: z5.string().uuid().optional().nullable()
673
+ setChatProjectContextSchema = z6.object({
674
+ projectId: z6.string().uuid().optional().nullable()
581
675
  });
582
676
  updateChatConversationSchema = createChatConversationSchema.partial().extend({
583
677
  status: chatConversationStatusSchema.optional(),
584
- routedAgentId: z5.string().uuid().optional().nullable(),
585
- primaryIssueId: z5.string().uuid().optional().nullable(),
586
- resolvedAt: z5.string().datetime().optional().nullable()
678
+ routedAgentId: z6.string().uuid().optional().nullable(),
679
+ primaryIssueId: z6.string().uuid().optional().nullable(),
680
+ resolvedAt: z6.string().datetime().optional().nullable()
587
681
  });
588
- addChatMessageSchema = z5.object({
589
- body: z5.string().trim().min(1).max(2e4),
590
- editUserMessageId: z5.string().uuid().optional().nullable()
682
+ addChatMessageSchema = z6.object({
683
+ body: z6.string().trim().min(1).max(2e4),
684
+ editUserMessageId: z6.string().uuid().optional().nullable()
591
685
  });
592
- createChatAttachmentMetadataSchema = z5.object({
593
- messageId: z5.string().uuid()
686
+ createChatAttachmentMetadataSchema = z6.object({
687
+ messageId: z6.string().uuid()
594
688
  });
595
- chatIssueProposalSchema = z5.object({
596
- title: z5.string().trim().min(1).max(200),
597
- description: z5.string().trim().min(1).max(2e4),
598
- priority: z5.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
599
- projectId: z5.string().uuid().optional().nullable(),
600
- goalId: z5.string().uuid().optional().nullable(),
601
- parentId: z5.string().uuid().optional().nullable(),
602
- assigneeAgentId: z5.string().uuid().optional().nullable(),
603
- assigneeUserId: z5.string().trim().optional().nullable()
689
+ chatIssueProposalSchema = z6.object({
690
+ title: z6.string().trim().min(1).max(200),
691
+ description: z6.string().trim().min(1).max(2e4),
692
+ priority: z6.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
693
+ status: z6.enum(ISSUE_STATUSES).optional(),
694
+ projectId: z6.string().uuid().optional().nullable(),
695
+ goalId: z6.string().uuid().optional().nullable(),
696
+ parentId: z6.string().uuid().optional().nullable(),
697
+ assigneeAgentId: z6.string().uuid().optional().nullable(),
698
+ assigneeUserId: z6.string().trim().optional().nullable()
604
699
  });
605
- convertChatToIssueSchema = z5.object({
606
- messageId: z5.string().uuid().optional().nullable(),
700
+ convertChatToIssueSchema = z6.object({
701
+ messageId: z6.string().uuid().optional().nullable(),
607
702
  proposal: chatIssueProposalSchema.optional()
608
703
  });
609
- chatOperationProposalSchema = z5.object({
610
- targetType: z5.enum(["organization", "agent"]),
611
- targetId: z5.string().min(1),
612
- summary: z5.string().trim().min(1).max(500),
613
- patch: z5.record(z5.unknown())
704
+ chatOperationProposalSchema = z6.object({
705
+ targetType: z6.enum(["organization", "agent"]),
706
+ targetId: z6.string().min(1),
707
+ summary: z6.string().trim().min(1).max(500),
708
+ patch: z6.record(z6.unknown())
614
709
  });
615
- resolveChatOperationProposalSchema = z5.object({
616
- action: z5.enum(["approve", "reject", "requestRevision"]),
617
- decisionNote: z5.string().trim().max(5e3).optional().nullable()
710
+ resolveChatOperationProposalSchema = z6.object({
711
+ action: z6.enum(["approve", "reject", "requestRevision"]),
712
+ decisionNote: z6.string().trim().max(5e3).optional().nullable()
618
713
  });
619
- updateChatConversationUserStateSchema = z5.object({
620
- pinned: z5.boolean().optional()
714
+ updateChatConversationUserStateSchema = z6.object({
715
+ pinned: z6.boolean().optional()
621
716
  });
622
717
  }
623
718
  });
624
719
 
625
720
  // ../packages/shared/src/validators/organization-skill.ts
626
- import { z as z6 } from "zod";
721
+ import { z as z7 } from "zod";
627
722
  var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
628
723
  var init_organization_skill = __esm({
629
724
  "../packages/shared/src/validators/organization-skill.ts"() {
630
725
  "use strict";
631
- organizationSkillSourceTypeSchema = z6.enum(["local_path", "github", "url", "catalog", "skills_sh"]);
632
- organizationSkillTrustLevelSchema = z6.enum(["markdown_only", "assets", "scripts_executables"]);
633
- organizationSkillCompatibilitySchema = z6.enum(["compatible", "unknown", "invalid"]);
634
- organizationSkillSourceBadgeSchema = z6.enum([
726
+ organizationSkillSourceTypeSchema = z7.enum(["local_path", "github", "url", "catalog", "skills_sh"]);
727
+ organizationSkillTrustLevelSchema = z7.enum(["markdown_only", "assets", "scripts_executables"]);
728
+ organizationSkillCompatibilitySchema = z7.enum(["compatible", "unknown", "invalid"]);
729
+ organizationSkillSourceBadgeSchema = z7.enum([
635
730
  "rudder",
636
731
  "community",
637
732
  "github",
@@ -640,157 +735,157 @@ var init_organization_skill = __esm({
640
735
  "catalog",
641
736
  "skills_sh"
642
737
  ]);
643
- organizationSkillFileInventoryEntrySchema = z6.object({
644
- path: z6.string().min(1),
645
- kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"])
738
+ organizationSkillFileInventoryEntrySchema = z7.object({
739
+ path: z7.string().min(1),
740
+ kind: z7.enum(["skill", "markdown", "reference", "script", "asset", "other"])
646
741
  });
647
- organizationSkillSchema = z6.object({
648
- id: z6.string().uuid(),
649
- orgId: z6.string().uuid(),
650
- key: z6.string().min(1),
651
- slug: z6.string().min(1),
652
- name: z6.string().min(1),
653
- description: z6.string().nullable(),
654
- markdown: z6.string(),
742
+ organizationSkillSchema = z7.object({
743
+ id: z7.string().uuid(),
744
+ orgId: z7.string().uuid(),
745
+ key: z7.string().min(1),
746
+ slug: z7.string().min(1),
747
+ name: z7.string().min(1),
748
+ description: z7.string().nullable(),
749
+ markdown: z7.string(),
655
750
  sourceType: organizationSkillSourceTypeSchema,
656
- sourceLocator: z6.string().nullable(),
657
- sourceRef: z6.string().nullable(),
751
+ sourceLocator: z7.string().nullable(),
752
+ sourceRef: z7.string().nullable(),
658
753
  trustLevel: organizationSkillTrustLevelSchema,
659
754
  compatibility: organizationSkillCompatibilitySchema,
660
- fileInventory: z6.array(organizationSkillFileInventoryEntrySchema).default([]),
661
- metadata: z6.record(z6.unknown()).nullable(),
662
- createdAt: z6.coerce.date(),
663
- updatedAt: z6.coerce.date()
755
+ fileInventory: z7.array(organizationSkillFileInventoryEntrySchema).default([]),
756
+ metadata: z7.record(z7.unknown()).nullable(),
757
+ createdAt: z7.coerce.date(),
758
+ updatedAt: z7.coerce.date()
664
759
  });
665
760
  organizationSkillListItemSchema = organizationSkillSchema.extend({
666
- attachedAgentCount: z6.number().int().nonnegative(),
667
- editable: z6.boolean(),
668
- editableReason: z6.string().nullable(),
669
- sourceLabel: z6.string().nullable(),
761
+ attachedAgentCount: z7.number().int().nonnegative(),
762
+ editable: z7.boolean(),
763
+ editableReason: z7.string().nullable(),
764
+ sourceLabel: z7.string().nullable(),
670
765
  sourceBadge: organizationSkillSourceBadgeSchema,
671
- sourcePath: z6.string().nullable(),
672
- workspaceEditPath: z6.string().nullable()
766
+ sourcePath: z7.string().nullable(),
767
+ workspaceEditPath: z7.string().nullable()
673
768
  });
674
- organizationSkillUsageAgentSchema = z6.object({
675
- id: z6.string().uuid(),
676
- name: z6.string().min(1),
677
- urlKey: z6.string().min(1),
678
- agentRuntimeType: z6.string().min(1),
679
- desired: z6.boolean(),
680
- actualState: z6.string().nullable()
769
+ organizationSkillUsageAgentSchema = z7.object({
770
+ id: z7.string().uuid(),
771
+ name: z7.string().min(1),
772
+ urlKey: z7.string().min(1),
773
+ agentRuntimeType: z7.string().min(1),
774
+ desired: z7.boolean(),
775
+ actualState: z7.string().nullable()
681
776
  });
682
777
  organizationSkillDetailSchema = organizationSkillSchema.extend({
683
- attachedAgentCount: z6.number().int().nonnegative(),
684
- usedByAgents: z6.array(organizationSkillUsageAgentSchema).default([]),
685
- editable: z6.boolean(),
686
- editableReason: z6.string().nullable(),
687
- sourceLabel: z6.string().nullable(),
778
+ attachedAgentCount: z7.number().int().nonnegative(),
779
+ usedByAgents: z7.array(organizationSkillUsageAgentSchema).default([]),
780
+ editable: z7.boolean(),
781
+ editableReason: z7.string().nullable(),
782
+ sourceLabel: z7.string().nullable(),
688
783
  sourceBadge: organizationSkillSourceBadgeSchema,
689
- sourcePath: z6.string().nullable(),
690
- workspaceEditPath: z6.string().nullable()
784
+ sourcePath: z7.string().nullable(),
785
+ workspaceEditPath: z7.string().nullable()
691
786
  });
692
- organizationSkillUpdateStatusSchema = z6.object({
693
- supported: z6.boolean(),
694
- reason: z6.string().nullable(),
695
- trackingRef: z6.string().nullable(),
696
- currentRef: z6.string().nullable(),
697
- latestRef: z6.string().nullable(),
698
- hasUpdate: z6.boolean()
787
+ organizationSkillUpdateStatusSchema = z7.object({
788
+ supported: z7.boolean(),
789
+ reason: z7.string().nullable(),
790
+ trackingRef: z7.string().nullable(),
791
+ currentRef: z7.string().nullable(),
792
+ latestRef: z7.string().nullable(),
793
+ hasUpdate: z7.boolean()
699
794
  });
700
- organizationSkillImportSchema = z6.object({
701
- source: z6.string().min(1)
795
+ organizationSkillImportSchema = z7.object({
796
+ source: z7.string().min(1)
702
797
  });
703
- organizationSkillProjectScanRequestSchema = z6.object({
704
- projectIds: z6.array(z6.string().uuid()).optional(),
705
- workspaceIds: z6.array(z6.string().uuid()).optional()
798
+ organizationSkillProjectScanRequestSchema = z7.object({
799
+ projectIds: z7.array(z7.string().uuid()).optional(),
800
+ workspaceIds: z7.array(z7.string().uuid()).optional()
706
801
  });
707
- organizationSkillProjectScanSkippedSchema = z6.object({
708
- projectId: z6.string().uuid(),
709
- projectName: z6.string().min(1),
710
- workspaceId: z6.string().uuid().nullable(),
711
- workspaceName: z6.string().nullable(),
712
- path: z6.string().nullable(),
713
- reason: z6.string().min(1)
802
+ organizationSkillProjectScanSkippedSchema = z7.object({
803
+ projectId: z7.string().uuid(),
804
+ projectName: z7.string().min(1),
805
+ workspaceId: z7.string().uuid().nullable(),
806
+ workspaceName: z7.string().nullable(),
807
+ path: z7.string().nullable(),
808
+ reason: z7.string().min(1)
714
809
  });
715
- organizationSkillProjectScanConflictSchema = z6.object({
716
- slug: z6.string().min(1),
717
- key: z6.string().min(1),
718
- projectId: z6.string().uuid(),
719
- projectName: z6.string().min(1),
720
- workspaceId: z6.string().uuid(),
721
- workspaceName: z6.string().min(1),
722
- path: z6.string().min(1),
723
- existingSkillId: z6.string().uuid(),
724
- existingSkillKey: z6.string().min(1),
725
- existingSourceLocator: z6.string().nullable(),
726
- reason: z6.string().min(1)
810
+ organizationSkillProjectScanConflictSchema = z7.object({
811
+ slug: z7.string().min(1),
812
+ key: z7.string().min(1),
813
+ projectId: z7.string().uuid(),
814
+ projectName: z7.string().min(1),
815
+ workspaceId: z7.string().uuid(),
816
+ workspaceName: z7.string().min(1),
817
+ path: z7.string().min(1),
818
+ existingSkillId: z7.string().uuid(),
819
+ existingSkillKey: z7.string().min(1),
820
+ existingSourceLocator: z7.string().nullable(),
821
+ reason: z7.string().min(1)
727
822
  });
728
- organizationSkillProjectScanResultSchema = z6.object({
729
- scannedProjects: z6.number().int().nonnegative(),
730
- scannedWorkspaces: z6.number().int().nonnegative(),
731
- discovered: z6.number().int().nonnegative(),
732
- imported: z6.array(organizationSkillSchema),
733
- updated: z6.array(organizationSkillSchema),
734
- skipped: z6.array(organizationSkillProjectScanSkippedSchema),
735
- conflicts: z6.array(organizationSkillProjectScanConflictSchema),
736
- warnings: z6.array(z6.string())
823
+ organizationSkillProjectScanResultSchema = z7.object({
824
+ scannedProjects: z7.number().int().nonnegative(),
825
+ scannedWorkspaces: z7.number().int().nonnegative(),
826
+ discovered: z7.number().int().nonnegative(),
827
+ imported: z7.array(organizationSkillSchema),
828
+ updated: z7.array(organizationSkillSchema),
829
+ skipped: z7.array(organizationSkillProjectScanSkippedSchema),
830
+ conflicts: z7.array(organizationSkillProjectScanConflictSchema),
831
+ warnings: z7.array(z7.string())
737
832
  });
738
- organizationSkillLocalScanRequestSchema = z6.object({
739
- roots: z6.array(z6.string().min(1)).optional()
833
+ organizationSkillLocalScanRequestSchema = z7.object({
834
+ roots: z7.array(z7.string().min(1)).optional()
740
835
  });
741
- organizationSkillLocalScanSkippedSchema = z6.object({
742
- root: z6.string().min(1),
743
- path: z6.string().nullable(),
744
- reason: z6.string().min(1)
836
+ organizationSkillLocalScanSkippedSchema = z7.object({
837
+ root: z7.string().min(1),
838
+ path: z7.string().nullable(),
839
+ reason: z7.string().min(1)
745
840
  });
746
- organizationSkillLocalScanConflictSchema = z6.object({
747
- root: z6.string().min(1),
748
- path: z6.string().min(1),
749
- slug: z6.string().min(1),
750
- key: z6.string().min(1),
751
- existingSkillId: z6.string().uuid(),
752
- existingSkillKey: z6.string().min(1),
753
- existingSourceLocator: z6.string().nullable(),
754
- reason: z6.string().min(1)
841
+ organizationSkillLocalScanConflictSchema = z7.object({
842
+ root: z7.string().min(1),
843
+ path: z7.string().min(1),
844
+ slug: z7.string().min(1),
845
+ key: z7.string().min(1),
846
+ existingSkillId: z7.string().uuid(),
847
+ existingSkillKey: z7.string().min(1),
848
+ existingSourceLocator: z7.string().nullable(),
849
+ reason: z7.string().min(1)
755
850
  });
756
- organizationSkillLocalScanResultSchema = z6.object({
757
- scannedRoots: z6.number().int().nonnegative(),
758
- discovered: z6.number().int().nonnegative(),
759
- imported: z6.array(organizationSkillSchema),
760
- updated: z6.array(organizationSkillSchema),
761
- skipped: z6.array(organizationSkillLocalScanSkippedSchema),
762
- conflicts: z6.array(organizationSkillLocalScanConflictSchema),
763
- warnings: z6.array(z6.string())
851
+ organizationSkillLocalScanResultSchema = z7.object({
852
+ scannedRoots: z7.number().int().nonnegative(),
853
+ discovered: z7.number().int().nonnegative(),
854
+ imported: z7.array(organizationSkillSchema),
855
+ updated: z7.array(organizationSkillSchema),
856
+ skipped: z7.array(organizationSkillLocalScanSkippedSchema),
857
+ conflicts: z7.array(organizationSkillLocalScanConflictSchema),
858
+ warnings: z7.array(z7.string())
764
859
  });
765
- organizationSkillCreateSchema = z6.object({
766
- name: z6.string().min(1),
767
- slug: z6.string().min(1).nullable().optional(),
768
- description: z6.string().nullable().optional(),
769
- markdown: z6.string().nullable().optional()
860
+ organizationSkillCreateSchema = z7.object({
861
+ name: z7.string().min(1),
862
+ slug: z7.string().min(1).nullable().optional(),
863
+ description: z7.string().nullable().optional(),
864
+ markdown: z7.string().nullable().optional()
770
865
  });
771
- organizationSkillFileDetailSchema = z6.object({
772
- skillId: z6.string().uuid(),
773
- path: z6.string().min(1),
774
- kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
775
- content: z6.string(),
776
- language: z6.string().nullable(),
777
- markdown: z6.boolean(),
778
- editable: z6.boolean()
866
+ organizationSkillFileDetailSchema = z7.object({
867
+ skillId: z7.string().uuid(),
868
+ path: z7.string().min(1),
869
+ kind: z7.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
870
+ content: z7.string(),
871
+ language: z7.string().nullable(),
872
+ markdown: z7.boolean(),
873
+ editable: z7.boolean()
779
874
  });
780
- organizationSkillFileUpdateSchema = z6.object({
781
- path: z6.string().min(1),
782
- content: z6.string()
875
+ organizationSkillFileUpdateSchema = z7.object({
876
+ path: z7.string().min(1),
877
+ content: z7.string()
783
878
  });
784
879
  }
785
880
  });
786
881
 
787
882
  // ../packages/shared/src/validators/adapter-skills.ts
788
- import { z as z7 } from "zod";
883
+ import { z as z8 } from "zod";
789
884
  var agentSkillStateSchema, agentSkillOriginSchema, agentSkillSourceClassSchema, agentSkillSyncModeSchema, agentSkillEntrySchema, agentSkillSnapshotSchema, agentSkillSyncSchema;
790
885
  var init_adapter_skills = __esm({
791
886
  "../packages/shared/src/validators/adapter-skills.ts"() {
792
887
  "use strict";
793
- agentSkillStateSchema = z7.enum([
888
+ agentSkillStateSchema = z8.enum([
794
889
  "available",
795
890
  "configured",
796
891
  "installed",
@@ -798,416 +893,436 @@ var init_adapter_skills = __esm({
798
893
  "stale",
799
894
  "external"
800
895
  ]);
801
- agentSkillOriginSchema = z7.preprocess((value) => {
896
+ agentSkillOriginSchema = z8.preprocess((value) => {
802
897
  if (value === "company_managed") return "organization_managed";
803
898
  return value;
804
- }, z7.enum([
899
+ }, z8.enum([
805
900
  "organization_managed",
806
901
  "user_installed",
807
902
  "external_unknown"
808
903
  ]));
809
- agentSkillSourceClassSchema = z7.enum([
904
+ agentSkillSourceClassSchema = z8.enum([
810
905
  "bundled",
811
906
  "organization",
812
907
  "agent_home",
813
908
  "global",
814
909
  "adapter_home"
815
910
  ]);
816
- agentSkillSyncModeSchema = z7.enum([
911
+ agentSkillSyncModeSchema = z8.enum([
817
912
  "unsupported",
818
913
  "persistent",
819
914
  "ephemeral"
820
915
  ]);
821
- agentSkillEntrySchema = z7.object({
822
- key: z7.string().min(1),
823
- selectionKey: z7.string().min(1),
824
- runtimeName: z7.string().min(1).nullable(),
825
- description: z7.string().nullable().optional(),
826
- desired: z7.boolean(),
827
- configurable: z7.boolean(),
828
- alwaysEnabled: z7.boolean(),
829
- managed: z7.boolean(),
916
+ agentSkillEntrySchema = z8.object({
917
+ key: z8.string().min(1),
918
+ selectionKey: z8.string().min(1),
919
+ runtimeName: z8.string().min(1).nullable(),
920
+ description: z8.string().nullable().optional(),
921
+ desired: z8.boolean(),
922
+ configurable: z8.boolean(),
923
+ alwaysEnabled: z8.boolean(),
924
+ managed: z8.boolean(),
830
925
  state: agentSkillStateSchema,
831
926
  sourceClass: agentSkillSourceClassSchema,
832
927
  origin: agentSkillOriginSchema.optional(),
833
- originLabel: z7.string().nullable().optional(),
834
- locationLabel: z7.string().nullable().optional(),
835
- readOnly: z7.boolean().optional(),
836
- sourcePath: z7.string().nullable().optional(),
837
- targetPath: z7.string().nullable().optional(),
838
- workspaceEditPath: z7.string().nullable().optional(),
839
- detail: z7.string().nullable().optional()
928
+ originLabel: z8.string().nullable().optional(),
929
+ locationLabel: z8.string().nullable().optional(),
930
+ readOnly: z8.boolean().optional(),
931
+ sourcePath: z8.string().nullable().optional(),
932
+ targetPath: z8.string().nullable().optional(),
933
+ workspaceEditPath: z8.string().nullable().optional(),
934
+ detail: z8.string().nullable().optional()
840
935
  });
841
- agentSkillSnapshotSchema = z7.object({
842
- agentRuntimeType: z7.string().min(1),
843
- supported: z7.boolean(),
936
+ agentSkillSnapshotSchema = z8.object({
937
+ agentRuntimeType: z8.string().min(1),
938
+ supported: z8.boolean(),
844
939
  mode: agentSkillSyncModeSchema,
845
- desiredSkills: z7.array(z7.string().min(1)),
846
- entries: z7.array(agentSkillEntrySchema),
847
- warnings: z7.array(z7.string())
940
+ desiredSkills: z8.array(z8.string().min(1)),
941
+ entries: z8.array(agentSkillEntrySchema),
942
+ warnings: z8.array(z8.string())
848
943
  });
849
- agentSkillSyncSchema = z7.object({
850
- desiredSkills: z7.array(z7.string().min(1))
944
+ agentSkillSyncSchema = z8.object({
945
+ desiredSkills: z8.array(z8.string().min(1))
851
946
  });
852
947
  }
853
948
  });
854
949
 
855
950
  // ../packages/shared/src/validators/organization-portability.ts
856
- import { z as z8 } from "zod";
951
+ import { z as z9 } from "zod";
857
952
  var portabilityIncludeSchema, portabilityEnvInputSchema, portabilityFileEntrySchema, portabilityOrganizationManifestEntrySchema, portabilitySidebarOrderSchema, portabilityAgentManifestEntrySchema, portabilitySkillManifestEntrySchema, portabilityProjectManifestEntrySchema, portabilityIssueAutomationTriggerManifestEntrySchema, portabilityIssueAutomationManifestEntrySchema, portabilityIssueManifestEntrySchema, portabilityManifestSchema, portabilitySourceSchema, portabilityTargetSchema, portabilityAgentSelectionSchema, portabilityCollisionStrategySchema, organizationPortabilityExportSchema, organizationPortabilityPreviewSchema, portabilityAdapterOverrideSchema, organizationPortabilityImportSchema;
858
953
  var init_organization_portability = __esm({
859
954
  "../packages/shared/src/validators/organization-portability.ts"() {
860
955
  "use strict";
861
- portabilityIncludeSchema = z8.object({
862
- organization: z8.boolean().optional(),
863
- agents: z8.boolean().optional(),
864
- projects: z8.boolean().optional(),
865
- issues: z8.boolean().optional(),
866
- skills: z8.boolean().optional()
956
+ portabilityIncludeSchema = z9.object({
957
+ organization: z9.boolean().optional(),
958
+ agents: z9.boolean().optional(),
959
+ projects: z9.boolean().optional(),
960
+ issues: z9.boolean().optional(),
961
+ skills: z9.boolean().optional()
867
962
  }).partial();
868
- portabilityEnvInputSchema = z8.object({
869
- key: z8.string().min(1),
870
- description: z8.string().nullable(),
871
- agentSlug: z8.string().min(1).nullable(),
872
- kind: z8.enum(["secret", "plain"]),
873
- requirement: z8.enum(["required", "optional"]),
874
- defaultValue: z8.string().nullable(),
875
- portability: z8.enum(["portable", "system_dependent"])
963
+ portabilityEnvInputSchema = z9.object({
964
+ key: z9.string().min(1),
965
+ description: z9.string().nullable(),
966
+ agentSlug: z9.string().min(1).nullable(),
967
+ kind: z9.enum(["secret", "plain"]),
968
+ requirement: z9.enum(["required", "optional"]),
969
+ defaultValue: z9.string().nullable(),
970
+ portability: z9.enum(["portable", "system_dependent"])
876
971
  });
877
- portabilityFileEntrySchema = z8.union([
878
- z8.string(),
879
- z8.object({
880
- encoding: z8.literal("base64"),
881
- data: z8.string(),
882
- contentType: z8.string().min(1).optional().nullable()
972
+ portabilityFileEntrySchema = z9.union([
973
+ z9.string(),
974
+ z9.object({
975
+ encoding: z9.literal("base64"),
976
+ data: z9.string(),
977
+ contentType: z9.string().min(1).optional().nullable()
883
978
  })
884
979
  ]);
885
- portabilityOrganizationManifestEntrySchema = z8.object({
886
- path: z8.string().min(1),
887
- name: z8.string().min(1),
888
- description: z8.string().nullable(),
889
- brandColor: z8.string().nullable(),
890
- logoPath: z8.string().nullable(),
891
- requireBoardApprovalForNewAgents: z8.boolean()
980
+ portabilityOrganizationManifestEntrySchema = z9.object({
981
+ path: z9.string().min(1),
982
+ name: z9.string().min(1),
983
+ description: z9.string().nullable(),
984
+ brandColor: z9.string().nullable(),
985
+ logoPath: z9.string().nullable(),
986
+ requireBoardApprovalForNewAgents: z9.boolean()
892
987
  });
893
- portabilitySidebarOrderSchema = z8.object({
894
- agents: z8.array(z8.string().min(1)).default([]),
895
- projects: z8.array(z8.string().min(1)).default([])
988
+ portabilitySidebarOrderSchema = z9.object({
989
+ agents: z9.array(z9.string().min(1)).default([]),
990
+ projects: z9.array(z9.string().min(1)).default([])
896
991
  });
897
- portabilityAgentManifestEntrySchema = z8.object({
898
- slug: z8.string().min(1),
899
- name: z8.string().min(1),
900
- path: z8.string().min(1),
901
- skills: z8.array(z8.string().min(1)).default([]),
902
- role: z8.string().min(1),
903
- title: z8.string().nullable(),
904
- icon: z8.string().nullable(),
905
- capabilities: z8.string().nullable(),
906
- reportsToSlug: z8.string().min(1).nullable(),
907
- agentRuntimeType: z8.string().min(1),
908
- agentRuntimeConfig: z8.record(z8.unknown()),
909
- runtimeConfig: z8.record(z8.unknown()),
910
- permissions: z8.record(z8.unknown()),
911
- budgetMonthlyCents: z8.number().int().nonnegative(),
912
- metadata: z8.record(z8.unknown()).nullable()
992
+ portabilityAgentManifestEntrySchema = z9.object({
993
+ slug: z9.string().min(1),
994
+ name: z9.string().min(1),
995
+ path: z9.string().min(1),
996
+ skills: z9.array(z9.string().min(1)).default([]),
997
+ role: z9.string().min(1),
998
+ title: z9.string().nullable(),
999
+ icon: z9.string().nullable(),
1000
+ capabilities: z9.string().nullable(),
1001
+ reportsToSlug: z9.string().min(1).nullable(),
1002
+ agentRuntimeType: z9.string().min(1),
1003
+ agentRuntimeConfig: z9.record(z9.unknown()),
1004
+ runtimeConfig: z9.record(z9.unknown()),
1005
+ permissions: z9.record(z9.unknown()),
1006
+ budgetMonthlyCents: z9.number().int().nonnegative(),
1007
+ metadata: z9.record(z9.unknown()).nullable()
913
1008
  });
914
- portabilitySkillManifestEntrySchema = z8.object({
915
- key: z8.string().min(1),
916
- slug: z8.string().min(1),
917
- name: z8.string().min(1),
918
- path: z8.string().min(1),
919
- description: z8.string().nullable(),
920
- sourceType: z8.string().min(1),
921
- sourceLocator: z8.string().nullable(),
922
- sourceRef: z8.string().nullable(),
923
- trustLevel: z8.string().nullable(),
924
- compatibility: z8.string().nullable(),
925
- metadata: z8.record(z8.unknown()).nullable(),
926
- fileInventory: z8.array(z8.object({
927
- path: z8.string().min(1),
928
- kind: z8.string().min(1)
1009
+ portabilitySkillManifestEntrySchema = z9.object({
1010
+ key: z9.string().min(1),
1011
+ slug: z9.string().min(1),
1012
+ name: z9.string().min(1),
1013
+ path: z9.string().min(1),
1014
+ description: z9.string().nullable(),
1015
+ sourceType: z9.string().min(1),
1016
+ sourceLocator: z9.string().nullable(),
1017
+ sourceRef: z9.string().nullable(),
1018
+ trustLevel: z9.string().nullable(),
1019
+ compatibility: z9.string().nullable(),
1020
+ metadata: z9.record(z9.unknown()).nullable(),
1021
+ fileInventory: z9.array(z9.object({
1022
+ path: z9.string().min(1),
1023
+ kind: z9.string().min(1)
929
1024
  })).default([])
930
1025
  });
931
- portabilityProjectManifestEntrySchema = z8.object({
932
- slug: z8.string().min(1),
933
- name: z8.string().min(1),
934
- path: z8.string().min(1),
935
- description: z8.string().nullable(),
936
- ownerAgentSlug: z8.string().min(1).nullable(),
937
- leadAgentSlug: z8.string().min(1).nullable(),
938
- targetDate: z8.string().nullable(),
939
- color: z8.string().nullable(),
940
- status: z8.string().nullable(),
941
- executionWorkspacePolicy: z8.record(z8.unknown()).nullable(),
942
- workspaces: z8.array(z8.object({
943
- key: z8.string().min(1),
944
- name: z8.string().min(1),
945
- sourceType: z8.string().nullable(),
946
- repoUrl: z8.string().nullable(),
947
- repoRef: z8.string().nullable(),
948
- defaultRef: z8.string().nullable(),
949
- visibility: z8.string().nullable(),
950
- setupCommand: z8.string().nullable(),
951
- cleanupCommand: z8.string().nullable(),
952
- metadata: z8.record(z8.unknown()).nullable(),
953
- isPrimary: z8.boolean()
1026
+ portabilityProjectManifestEntrySchema = z9.object({
1027
+ slug: z9.string().min(1),
1028
+ name: z9.string().min(1),
1029
+ path: z9.string().min(1),
1030
+ description: z9.string().nullable(),
1031
+ ownerAgentSlug: z9.string().min(1).nullable(),
1032
+ leadAgentSlug: z9.string().min(1).nullable(),
1033
+ targetDate: z9.string().nullable(),
1034
+ color: z9.string().nullable(),
1035
+ status: z9.string().nullable(),
1036
+ executionWorkspacePolicy: z9.record(z9.unknown()).nullable(),
1037
+ workspaces: z9.array(z9.object({
1038
+ key: z9.string().min(1),
1039
+ name: z9.string().min(1),
1040
+ sourceType: z9.string().nullable(),
1041
+ repoUrl: z9.string().nullable(),
1042
+ repoRef: z9.string().nullable(),
1043
+ defaultRef: z9.string().nullable(),
1044
+ visibility: z9.string().nullable(),
1045
+ setupCommand: z9.string().nullable(),
1046
+ cleanupCommand: z9.string().nullable(),
1047
+ metadata: z9.record(z9.unknown()).nullable(),
1048
+ isPrimary: z9.boolean()
954
1049
  })).default([]),
955
- metadata: z8.record(z8.unknown()).nullable()
1050
+ metadata: z9.record(z9.unknown()).nullable()
956
1051
  });
957
- portabilityIssueAutomationTriggerManifestEntrySchema = z8.object({
958
- kind: z8.string().min(1),
959
- label: z8.string().nullable(),
960
- enabled: z8.boolean(),
961
- cronExpression: z8.string().nullable(),
962
- timezone: z8.string().nullable(),
963
- signingMode: z8.string().nullable(),
964
- replayWindowSec: z8.number().int().nullable()
1052
+ portabilityIssueAutomationTriggerManifestEntrySchema = z9.object({
1053
+ kind: z9.string().min(1),
1054
+ label: z9.string().nullable(),
1055
+ enabled: z9.boolean(),
1056
+ cronExpression: z9.string().nullable(),
1057
+ timezone: z9.string().nullable(),
1058
+ signingMode: z9.string().nullable(),
1059
+ replayWindowSec: z9.number().int().nullable()
965
1060
  });
966
- portabilityIssueAutomationManifestEntrySchema = z8.object({
967
- concurrencyPolicy: z8.string().nullable(),
968
- catchUpPolicy: z8.string().nullable(),
969
- triggers: z8.array(portabilityIssueAutomationTriggerManifestEntrySchema).default([])
1061
+ portabilityIssueAutomationManifestEntrySchema = z9.object({
1062
+ concurrencyPolicy: z9.string().nullable(),
1063
+ catchUpPolicy: z9.string().nullable(),
1064
+ triggers: z9.array(portabilityIssueAutomationTriggerManifestEntrySchema).default([])
970
1065
  });
971
- portabilityIssueManifestEntrySchema = z8.object({
972
- slug: z8.string().min(1),
973
- identifier: z8.string().min(1).nullable(),
974
- title: z8.string().min(1),
975
- path: z8.string().min(1),
976
- projectSlug: z8.string().min(1).nullable(),
977
- projectWorkspaceKey: z8.string().min(1).nullable(),
978
- assigneeAgentSlug: z8.string().min(1).nullable(),
979
- description: z8.string().nullable(),
980
- recurring: z8.boolean().default(false),
1066
+ portabilityIssueManifestEntrySchema = z9.object({
1067
+ slug: z9.string().min(1),
1068
+ identifier: z9.string().min(1).nullable(),
1069
+ title: z9.string().min(1),
1070
+ path: z9.string().min(1),
1071
+ projectSlug: z9.string().min(1).nullable(),
1072
+ projectWorkspaceKey: z9.string().min(1).nullable(),
1073
+ assigneeAgentSlug: z9.string().min(1).nullable(),
1074
+ description: z9.string().nullable(),
1075
+ recurring: z9.boolean().default(false),
981
1076
  automation: portabilityIssueAutomationManifestEntrySchema.nullable(),
982
- legacyRecurrence: z8.record(z8.unknown()).nullable(),
983
- status: z8.string().nullable(),
984
- priority: z8.string().nullable(),
985
- labelIds: z8.array(z8.string().min(1)).default([]),
986
- billingCode: z8.string().nullable(),
987
- executionWorkspaceSettings: z8.record(z8.unknown()).nullable(),
988
- assigneeAgentRuntimeOverrides: z8.record(z8.unknown()).nullable(),
989
- metadata: z8.record(z8.unknown()).nullable()
1077
+ legacyRecurrence: z9.record(z9.unknown()).nullable(),
1078
+ status: z9.string().nullable(),
1079
+ priority: z9.string().nullable(),
1080
+ labelIds: z9.array(z9.string().min(1)).default([]),
1081
+ billingCode: z9.string().nullable(),
1082
+ executionWorkspaceSettings: z9.record(z9.unknown()).nullable(),
1083
+ assigneeAgentRuntimeOverrides: z9.record(z9.unknown()).nullable(),
1084
+ metadata: z9.record(z9.unknown()).nullable()
990
1085
  });
991
- portabilityManifestSchema = z8.object({
992
- schemaVersion: z8.number().int().positive(),
993
- generatedAt: z8.string().datetime(),
994
- source: z8.object({
995
- orgId: z8.string().uuid(),
996
- organizationName: z8.string().min(1)
1086
+ portabilityManifestSchema = z9.object({
1087
+ schemaVersion: z9.number().int().positive(),
1088
+ generatedAt: z9.string().datetime(),
1089
+ source: z9.object({
1090
+ orgId: z9.string().uuid(),
1091
+ organizationName: z9.string().min(1)
997
1092
  }).nullable(),
998
- includes: z8.object({
999
- organization: z8.boolean(),
1000
- agents: z8.boolean(),
1001
- projects: z8.boolean(),
1002
- issues: z8.boolean(),
1003
- skills: z8.boolean()
1093
+ includes: z9.object({
1094
+ organization: z9.boolean(),
1095
+ agents: z9.boolean(),
1096
+ projects: z9.boolean(),
1097
+ issues: z9.boolean(),
1098
+ skills: z9.boolean()
1004
1099
  }),
1005
1100
  organization: portabilityOrganizationManifestEntrySchema.nullable(),
1006
1101
  sidebar: portabilitySidebarOrderSchema.nullable(),
1007
- agents: z8.array(portabilityAgentManifestEntrySchema),
1008
- skills: z8.array(portabilitySkillManifestEntrySchema).default([]),
1009
- projects: z8.array(portabilityProjectManifestEntrySchema).default([]),
1010
- issues: z8.array(portabilityIssueManifestEntrySchema).default([]),
1011
- envInputs: z8.array(portabilityEnvInputSchema).default([])
1102
+ agents: z9.array(portabilityAgentManifestEntrySchema),
1103
+ skills: z9.array(portabilitySkillManifestEntrySchema).default([]),
1104
+ projects: z9.array(portabilityProjectManifestEntrySchema).default([]),
1105
+ issues: z9.array(portabilityIssueManifestEntrySchema).default([]),
1106
+ envInputs: z9.array(portabilityEnvInputSchema).default([])
1012
1107
  });
1013
- portabilitySourceSchema = z8.discriminatedUnion("type", [
1014
- z8.object({
1015
- type: z8.literal("inline"),
1016
- rootPath: z8.string().min(1).optional().nullable(),
1017
- files: z8.record(portabilityFileEntrySchema)
1108
+ portabilitySourceSchema = z9.discriminatedUnion("type", [
1109
+ z9.object({
1110
+ type: z9.literal("inline"),
1111
+ rootPath: z9.string().min(1).optional().nullable(),
1112
+ files: z9.record(portabilityFileEntrySchema)
1018
1113
  }),
1019
- z8.object({
1020
- type: z8.literal("github"),
1021
- url: z8.string().url()
1114
+ z9.object({
1115
+ type: z9.literal("github"),
1116
+ url: z9.string().url()
1022
1117
  })
1023
1118
  ]);
1024
- portabilityTargetSchema = z8.discriminatedUnion("mode", [
1025
- z8.object({
1026
- mode: z8.literal("new_organization"),
1027
- newOrganizationName: z8.string().min(1).optional().nullable()
1119
+ portabilityTargetSchema = z9.discriminatedUnion("mode", [
1120
+ z9.object({
1121
+ mode: z9.literal("new_organization"),
1122
+ newOrganizationName: z9.string().min(1).optional().nullable()
1028
1123
  }),
1029
- z8.object({
1030
- mode: z8.literal("existing_organization"),
1031
- orgId: z8.string().uuid()
1124
+ z9.object({
1125
+ mode: z9.literal("existing_organization"),
1126
+ orgId: z9.string().uuid()
1032
1127
  })
1033
1128
  ]);
1034
- portabilityAgentSelectionSchema = z8.union([
1035
- z8.literal("all"),
1036
- z8.array(z8.string().min(1))
1129
+ portabilityAgentSelectionSchema = z9.union([
1130
+ z9.literal("all"),
1131
+ z9.array(z9.string().min(1))
1037
1132
  ]);
1038
- portabilityCollisionStrategySchema = z8.enum(["rename", "skip", "replace"]);
1039
- organizationPortabilityExportSchema = z8.object({
1133
+ portabilityCollisionStrategySchema = z9.enum(["rename", "skip", "replace"]);
1134
+ organizationPortabilityExportSchema = z9.object({
1040
1135
  include: portabilityIncludeSchema.optional(),
1041
- agents: z8.array(z8.string().min(1)).optional(),
1042
- skills: z8.array(z8.string().min(1)).optional(),
1043
- projects: z8.array(z8.string().min(1)).optional(),
1044
- issues: z8.array(z8.string().min(1)).optional(),
1045
- projectIssues: z8.array(z8.string().min(1)).optional(),
1046
- selectedFiles: z8.array(z8.string().min(1)).optional(),
1047
- expandReferencedSkills: z8.boolean().optional(),
1136
+ agents: z9.array(z9.string().min(1)).optional(),
1137
+ skills: z9.array(z9.string().min(1)).optional(),
1138
+ projects: z9.array(z9.string().min(1)).optional(),
1139
+ issues: z9.array(z9.string().min(1)).optional(),
1140
+ projectIssues: z9.array(z9.string().min(1)).optional(),
1141
+ selectedFiles: z9.array(z9.string().min(1)).optional(),
1142
+ expandReferencedSkills: z9.boolean().optional(),
1048
1143
  sidebarOrder: portabilitySidebarOrderSchema.partial().optional()
1049
1144
  });
1050
- organizationPortabilityPreviewSchema = z8.object({
1145
+ organizationPortabilityPreviewSchema = z9.object({
1051
1146
  source: portabilitySourceSchema,
1052
1147
  include: portabilityIncludeSchema.optional(),
1053
1148
  target: portabilityTargetSchema,
1054
1149
  agents: portabilityAgentSelectionSchema.optional(),
1055
1150
  collisionStrategy: portabilityCollisionStrategySchema.optional(),
1056
- nameOverrides: z8.record(z8.string().min(1), z8.string().min(1)).optional(),
1057
- selectedFiles: z8.array(z8.string().min(1)).optional()
1151
+ nameOverrides: z9.record(z9.string().min(1), z9.string().min(1)).optional(),
1152
+ selectedFiles: z9.array(z9.string().min(1)).optional()
1058
1153
  });
1059
- portabilityAdapterOverrideSchema = z8.object({
1060
- agentRuntimeType: z8.string().min(1),
1061
- agentRuntimeConfig: z8.record(z8.unknown()).optional()
1154
+ portabilityAdapterOverrideSchema = z9.object({
1155
+ agentRuntimeType: z9.string().min(1),
1156
+ agentRuntimeConfig: z9.record(z9.unknown()).optional()
1062
1157
  });
1063
1158
  organizationPortabilityImportSchema = organizationPortabilityPreviewSchema.extend({
1064
- agentRuntimeOverrides: z8.record(z8.string().min(1), portabilityAdapterOverrideSchema).optional()
1159
+ agentRuntimeOverrides: z9.record(z9.string().min(1), portabilityAdapterOverrideSchema).optional()
1065
1160
  });
1066
1161
  }
1067
1162
  });
1068
1163
 
1069
1164
  // ../packages/shared/src/validators/secret.ts
1070
- import { z as z9 } from "zod";
1165
+ import { z as z10 } from "zod";
1071
1166
  var envBindingPlainSchema, envBindingSecretRefSchema, envBindingSchema, envConfigSchema, createSecretSchema, rotateSecretSchema, updateSecretSchema;
1072
1167
  var init_secret = __esm({
1073
1168
  "../packages/shared/src/validators/secret.ts"() {
1074
1169
  "use strict";
1075
1170
  init_constants();
1076
- envBindingPlainSchema = z9.object({
1077
- type: z9.literal("plain"),
1078
- value: z9.string()
1171
+ envBindingPlainSchema = z10.object({
1172
+ type: z10.literal("plain"),
1173
+ value: z10.string()
1079
1174
  });
1080
- envBindingSecretRefSchema = z9.object({
1081
- type: z9.literal("secret_ref"),
1082
- secretId: z9.string().uuid(),
1083
- version: z9.union([z9.literal("latest"), z9.number().int().positive()]).optional()
1175
+ envBindingSecretRefSchema = z10.object({
1176
+ type: z10.literal("secret_ref"),
1177
+ secretId: z10.string().uuid(),
1178
+ version: z10.union([z10.literal("latest"), z10.number().int().positive()]).optional()
1084
1179
  });
1085
- envBindingSchema = z9.union([
1086
- z9.string(),
1180
+ envBindingSchema = z10.union([
1181
+ z10.string(),
1087
1182
  envBindingPlainSchema,
1088
1183
  envBindingSecretRefSchema
1089
1184
  ]);
1090
- envConfigSchema = z9.record(envBindingSchema);
1091
- createSecretSchema = z9.object({
1092
- name: z9.string().min(1),
1093
- provider: z9.enum(SECRET_PROVIDERS).optional(),
1094
- value: z9.string().min(1),
1095
- description: z9.string().optional().nullable(),
1096
- externalRef: z9.string().optional().nullable()
1185
+ envConfigSchema = z10.record(envBindingSchema);
1186
+ createSecretSchema = z10.object({
1187
+ name: z10.string().min(1),
1188
+ provider: z10.enum(SECRET_PROVIDERS).optional(),
1189
+ value: z10.string().min(1),
1190
+ description: z10.string().optional().nullable(),
1191
+ externalRef: z10.string().optional().nullable()
1097
1192
  });
1098
- rotateSecretSchema = z9.object({
1099
- value: z9.string().min(1),
1100
- externalRef: z9.string().optional().nullable()
1193
+ rotateSecretSchema = z10.object({
1194
+ value: z10.string().min(1),
1195
+ externalRef: z10.string().optional().nullable()
1101
1196
  });
1102
- updateSecretSchema = z9.object({
1103
- name: z9.string().min(1).optional(),
1104
- description: z9.string().optional().nullable(),
1105
- externalRef: z9.string().optional().nullable()
1197
+ updateSecretSchema = z10.object({
1198
+ name: z10.string().min(1).optional(),
1199
+ description: z10.string().optional().nullable(),
1200
+ externalRef: z10.string().optional().nullable()
1106
1201
  });
1107
1202
  }
1108
1203
  });
1109
1204
 
1110
1205
  // ../packages/shared/src/validators/agent.ts
1111
- import { z as z10 } from "zod";
1112
- var agentPermissionsSchema, agentInstructionsBundleModeSchema, updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, agentRuntimeConfigSchema, optionalAgentNameSchema, createAgentSchema, createAgentHireSchema, updateAgentSchema, updateAgentInstructionsPathSchema, createAgentKeySchema, wakeAgentSchema, resetAgentSessionSchema, testAgentRuntimeEnvironmentSchema, updateAgentPermissionsSchema;
1206
+ import { z as z11 } from "zod";
1207
+ var agentPermissionsSchema, agentInstructionsBundleModeSchema, updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, agentRuntimeConfigSchema, optionalAgentNameSchema, uploadedAgentIconSchema, customAgentIconSchema, agentIconSchema, createAgentSchema, createAgentHireSchema, updateAgentSchema, updateAgentInstructionsPathSchema, createAgentKeySchema, wakeAgentSchema, resetAgentSessionSchema, testAgentRuntimeEnvironmentSchema, updateAgentPermissionsSchema;
1113
1208
  var init_agent = __esm({
1114
1209
  "../packages/shared/src/validators/agent.ts"() {
1115
1210
  "use strict";
1116
1211
  init_constants();
1117
1212
  init_secret();
1118
- agentPermissionsSchema = z10.object({
1119
- canCreateAgents: z10.boolean().optional().default(false)
1213
+ init_model_fallbacks();
1214
+ agentPermissionsSchema = z11.object({
1215
+ canCreateAgents: z11.boolean().optional().default(false)
1120
1216
  });
1121
- agentInstructionsBundleModeSchema = z10.enum(["managed", "external"]);
1122
- updateAgentInstructionsBundleSchema = z10.object({
1217
+ agentInstructionsBundleModeSchema = z11.enum(["managed", "external"]);
1218
+ updateAgentInstructionsBundleSchema = z11.object({
1123
1219
  mode: agentInstructionsBundleModeSchema.optional(),
1124
- rootPath: z10.string().trim().min(1).nullable().optional(),
1125
- entryFile: z10.string().trim().min(1).optional(),
1126
- clearLegacyPromptTemplate: z10.boolean().optional().default(false)
1220
+ rootPath: z11.string().trim().min(1).nullable().optional(),
1221
+ entryFile: z11.string().trim().min(1).optional(),
1222
+ clearLegacyPromptTemplate: z11.boolean().optional().default(false)
1127
1223
  });
1128
- upsertAgentInstructionsFileSchema = z10.object({
1129
- path: z10.string().trim().min(1),
1130
- content: z10.string(),
1131
- clearLegacyPromptTemplate: z10.boolean().optional().default(false)
1224
+ upsertAgentInstructionsFileSchema = z11.object({
1225
+ path: z11.string().trim().min(1),
1226
+ content: z11.string(),
1227
+ clearLegacyPromptTemplate: z11.boolean().optional().default(false)
1132
1228
  });
1133
- agentRuntimeConfigSchema = z10.record(z10.unknown()).superRefine((value, ctx) => {
1229
+ agentRuntimeConfigSchema = z11.record(z11.unknown()).superRefine((value, ctx) => {
1134
1230
  const envValue = value.env;
1135
- if (envValue === void 0) return;
1136
- const parsed = envConfigSchema.safeParse(envValue);
1137
- if (!parsed.success) {
1138
- ctx.addIssue({
1139
- code: z10.ZodIssueCode.custom,
1140
- message: "agentRuntimeConfig.env must be a map of valid env bindings",
1141
- path: ["env"]
1142
- });
1231
+ if (envValue !== void 0) {
1232
+ const parsed = envConfigSchema.safeParse(envValue);
1233
+ if (!parsed.success) {
1234
+ ctx.addIssue({
1235
+ code: z11.ZodIssueCode.custom,
1236
+ message: "agentRuntimeConfig.env must be a map of valid env bindings",
1237
+ path: ["env"]
1238
+ });
1239
+ }
1143
1240
  }
1241
+ validateModelFallbacksConfig(value, ctx, []);
1144
1242
  });
1145
- optionalAgentNameSchema = z10.preprocess(
1243
+ optionalAgentNameSchema = z11.preprocess(
1146
1244
  (value) => {
1147
1245
  if (typeof value !== "string") return value;
1148
1246
  const trimmed = value.trim();
1149
1247
  return trimmed.length > 0 ? trimmed : void 0;
1150
1248
  },
1151
- z10.string().trim().min(1).optional()
1249
+ z11.string().trim().min(1).optional()
1152
1250
  );
1153
- createAgentSchema = z10.object({
1251
+ uploadedAgentIconSchema = z11.string().regex(
1252
+ /^asset:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
1253
+ "Invalid uploaded avatar reference"
1254
+ );
1255
+ customAgentIconSchema = z11.string().trim().min(1).max(24).refine((value) => !value.toLowerCase().startsWith("asset:"), "Invalid uploaded avatar reference").refine((value) => !/[<>\u0000-\u001f\u007f]/u.test(value), "Icon cannot contain markup or control characters");
1256
+ agentIconSchema = z11.preprocess(
1257
+ (value) => {
1258
+ if (typeof value !== "string") return value;
1259
+ const trimmed = value.trim();
1260
+ return trimmed.length > 0 ? trimmed : null;
1261
+ },
1262
+ z11.union([
1263
+ z11.enum(AGENT_ICON_NAMES),
1264
+ uploadedAgentIconSchema,
1265
+ customAgentIconSchema
1266
+ ]).nullable()
1267
+ );
1268
+ createAgentSchema = z11.object({
1154
1269
  name: optionalAgentNameSchema,
1155
- role: z10.enum(AGENT_ROLES).optional().default("general"),
1156
- title: z10.string().optional().nullable(),
1157
- icon: z10.enum(AGENT_ICON_NAMES).optional().nullable(),
1158
- reportsTo: z10.string().uuid().optional().nullable(),
1159
- capabilities: z10.string().optional().nullable(),
1160
- desiredSkills: z10.array(z10.string().min(1)).optional(),
1161
- agentRuntimeType: z10.enum(AGENT_RUNTIME_TYPES).optional().default("process"),
1270
+ role: z11.enum(AGENT_ROLES).optional().default("general"),
1271
+ title: z11.string().optional().nullable(),
1272
+ icon: agentIconSchema.optional(),
1273
+ reportsTo: z11.string().uuid().optional().nullable(),
1274
+ capabilities: z11.string().optional().nullable(),
1275
+ desiredSkills: z11.array(z11.string().min(1)).optional(),
1276
+ agentRuntimeType: z11.enum(AGENT_RUNTIME_TYPES).optional().default("process"),
1162
1277
  agentRuntimeConfig: agentRuntimeConfigSchema.optional().default({}),
1163
- runtimeConfig: z10.record(z10.unknown()).optional().default({}),
1164
- budgetMonthlyCents: z10.number().int().nonnegative().optional().default(0),
1278
+ runtimeConfig: z11.record(z11.unknown()).optional().default({}),
1279
+ budgetMonthlyCents: z11.number().int().nonnegative().optional().default(0),
1165
1280
  permissions: agentPermissionsSchema.optional(),
1166
- metadata: z10.record(z10.unknown()).optional().nullable()
1281
+ metadata: z11.record(z11.unknown()).optional().nullable()
1167
1282
  });
1168
1283
  createAgentHireSchema = createAgentSchema.extend({
1169
- sourceIssueId: z10.string().uuid().optional().nullable(),
1170
- sourceIssueIds: z10.array(z10.string().uuid()).optional()
1284
+ sourceIssueId: z11.string().uuid().optional().nullable(),
1285
+ sourceIssueIds: z11.array(z11.string().uuid()).optional()
1171
1286
  });
1172
1287
  updateAgentSchema = createAgentSchema.omit({ permissions: true }).partial().extend({
1173
- permissions: z10.never().optional(),
1174
- replaceAgentRuntimeConfig: z10.boolean().optional(),
1175
- status: z10.enum(AGENT_STATUSES).optional(),
1176
- spentMonthlyCents: z10.number().int().nonnegative().optional()
1288
+ permissions: z11.never().optional(),
1289
+ replaceAgentRuntimeConfig: z11.boolean().optional(),
1290
+ status: z11.enum(AGENT_STATUSES).optional(),
1291
+ spentMonthlyCents: z11.number().int().nonnegative().optional()
1177
1292
  });
1178
- updateAgentInstructionsPathSchema = z10.object({
1179
- path: z10.string().trim().min(1).nullable(),
1180
- agentRuntimeConfigKey: z10.string().trim().min(1).optional()
1293
+ updateAgentInstructionsPathSchema = z11.object({
1294
+ path: z11.string().trim().min(1).nullable(),
1295
+ agentRuntimeConfigKey: z11.string().trim().min(1).optional()
1181
1296
  });
1182
- createAgentKeySchema = z10.object({
1183
- name: z10.string().min(1).default("default")
1297
+ createAgentKeySchema = z11.object({
1298
+ name: z11.string().min(1).default("default")
1184
1299
  });
1185
- wakeAgentSchema = z10.object({
1186
- source: z10.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
1187
- triggerDetail: z10.enum(["manual", "ping", "callback", "system"]).optional(),
1188
- reason: z10.string().optional().nullable(),
1189
- payload: z10.record(z10.unknown()).optional().nullable(),
1190
- idempotencyKey: z10.string().optional().nullable(),
1191
- forceFreshSession: z10.preprocess(
1300
+ wakeAgentSchema = z11.object({
1301
+ source: z11.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
1302
+ triggerDetail: z11.enum(["manual", "ping", "callback", "system"]).optional(),
1303
+ reason: z11.string().optional().nullable(),
1304
+ payload: z11.record(z11.unknown()).optional().nullable(),
1305
+ idempotencyKey: z11.string().optional().nullable(),
1306
+ forceFreshSession: z11.preprocess(
1192
1307
  (value) => value === null ? void 0 : value,
1193
- z10.boolean().optional().default(false)
1308
+ z11.boolean().optional().default(false)
1194
1309
  )
1195
1310
  });
1196
- resetAgentSessionSchema = z10.object({
1197
- taskKey: z10.string().min(1).optional().nullable()
1311
+ resetAgentSessionSchema = z11.object({
1312
+ taskKey: z11.string().min(1).optional().nullable()
1198
1313
  });
1199
- testAgentRuntimeEnvironmentSchema = z10.object({
1314
+ testAgentRuntimeEnvironmentSchema = z11.object({
1200
1315
  agentRuntimeConfig: agentRuntimeConfigSchema.optional().default({})
1201
1316
  });
1202
- updateAgentPermissionsSchema = z10.object({
1203
- canCreateAgents: z10.boolean(),
1204
- canAssignTasks: z10.boolean()
1317
+ updateAgentPermissionsSchema = z11.object({
1318
+ canCreateAgents: z11.boolean(),
1319
+ canAssignTasks: z11.boolean()
1205
1320
  });
1206
1321
  }
1207
1322
  });
1208
1323
 
1209
1324
  // ../packages/shared/src/validators/project.ts
1210
- import { z as z11 } from "zod";
1325
+ import { z as z12 } from "zod";
1211
1326
  function validateProjectWorkspace(value, ctx) {
1212
1327
  const sourceType = value.sourceType ?? "local_path";
1213
1328
  const hasCwd = typeof value.cwd === "string" && value.cwd.trim().length > 0;
@@ -1216,7 +1331,7 @@ function validateProjectWorkspace(value, ctx) {
1216
1331
  if (sourceType === "remote_managed") {
1217
1332
  if (!hasRemoteRef && !hasRepo) {
1218
1333
  ctx.addIssue({
1219
- code: z11.ZodIssueCode.custom,
1334
+ code: z12.ZodIssueCode.custom,
1220
1335
  message: "Remote-managed workspace requires remoteWorkspaceRef or repoUrl.",
1221
1336
  path: ["remoteWorkspaceRef"]
1222
1337
  });
@@ -1225,125 +1340,131 @@ function validateProjectWorkspace(value, ctx) {
1225
1340
  }
1226
1341
  if (!hasCwd && !hasRepo) {
1227
1342
  ctx.addIssue({
1228
- code: z11.ZodIssueCode.custom,
1343
+ code: z12.ZodIssueCode.custom,
1229
1344
  message: "Workspace requires at least one of cwd or repoUrl.",
1230
1345
  path: ["cwd"]
1231
1346
  });
1232
1347
  }
1233
1348
  }
1234
- var executionWorkspaceStrategySchema, projectExecutionWorkspacePolicySchema, projectWorkspaceSourceTypeSchema, projectWorkspaceVisibilitySchema, projectWorkspaceFields, createProjectWorkspaceSchema, updateProjectWorkspaceSchema, projectFields, createProjectSchema, updateProjectSchema;
1349
+ var executionWorkspaceStrategySchema, projectExecutionWorkspacePolicySchema, projectWorkspaceSourceTypeSchema, projectWorkspaceVisibilitySchema, projectWorkspaceFields, projectColorValues, legacyProjectColorSchema, projectColorSchema, createProjectWorkspaceSchema, updateProjectWorkspaceSchema, projectFields, createProjectSchema, updateProjectSchema;
1235
1350
  var init_project = __esm({
1236
1351
  "../packages/shared/src/validators/project.ts"() {
1237
1352
  "use strict";
1238
1353
  init_constants();
1239
1354
  init_resource();
1240
- executionWorkspaceStrategySchema = z11.object({
1241
- type: z11.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
1242
- baseRef: z11.string().optional().nullable(),
1243
- branchTemplate: z11.string().optional().nullable(),
1244
- worktreeParentDir: z11.string().optional().nullable(),
1245
- provisionCommand: z11.string().optional().nullable(),
1246
- teardownCommand: z11.string().optional().nullable()
1355
+ executionWorkspaceStrategySchema = z12.object({
1356
+ type: z12.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
1357
+ baseRef: z12.string().optional().nullable(),
1358
+ branchTemplate: z12.string().optional().nullable(),
1359
+ worktreeParentDir: z12.string().optional().nullable(),
1360
+ provisionCommand: z12.string().optional().nullable(),
1361
+ teardownCommand: z12.string().optional().nullable()
1247
1362
  }).strict();
1248
- projectExecutionWorkspacePolicySchema = z11.object({
1249
- enabled: z11.boolean(),
1250
- defaultMode: z11.enum(["shared_workspace", "isolated_workspace", "operator_branch", "adapter_default"]).optional(),
1251
- allowIssueOverride: z11.boolean().optional(),
1252
- defaultProjectWorkspaceId: z11.string().uuid().optional().nullable(),
1363
+ projectExecutionWorkspacePolicySchema = z12.object({
1364
+ enabled: z12.boolean(),
1365
+ defaultMode: z12.enum(["shared_workspace", "isolated_workspace", "operator_branch", "adapter_default"]).optional(),
1366
+ allowIssueOverride: z12.boolean().optional(),
1367
+ defaultProjectWorkspaceId: z12.string().uuid().optional().nullable(),
1253
1368
  workspaceStrategy: executionWorkspaceStrategySchema.optional().nullable(),
1254
- workspaceRuntime: z11.record(z11.unknown()).optional().nullable(),
1255
- branchPolicy: z11.record(z11.unknown()).optional().nullable(),
1256
- pullRequestPolicy: z11.record(z11.unknown()).optional().nullable(),
1257
- runtimePolicy: z11.record(z11.unknown()).optional().nullable(),
1258
- cleanupPolicy: z11.record(z11.unknown()).optional().nullable()
1369
+ workspaceRuntime: z12.record(z12.unknown()).optional().nullable(),
1370
+ branchPolicy: z12.record(z12.unknown()).optional().nullable(),
1371
+ pullRequestPolicy: z12.record(z12.unknown()).optional().nullable(),
1372
+ runtimePolicy: z12.record(z12.unknown()).optional().nullable(),
1373
+ cleanupPolicy: z12.record(z12.unknown()).optional().nullable()
1259
1374
  }).strict();
1260
- projectWorkspaceSourceTypeSchema = z11.enum(["local_path", "git_repo", "remote_managed", "non_git_path"]);
1261
- projectWorkspaceVisibilitySchema = z11.enum(["default", "advanced"]);
1375
+ projectWorkspaceSourceTypeSchema = z12.enum(["local_path", "git_repo", "remote_managed", "non_git_path"]);
1376
+ projectWorkspaceVisibilitySchema = z12.enum(["default", "advanced"]);
1262
1377
  projectWorkspaceFields = {
1263
- name: z11.string().min(1).optional(),
1378
+ name: z12.string().min(1).optional(),
1264
1379
  sourceType: projectWorkspaceSourceTypeSchema.optional(),
1265
- cwd: z11.string().min(1).optional().nullable(),
1266
- repoUrl: z11.string().url().optional().nullable(),
1267
- repoRef: z11.string().optional().nullable(),
1268
- defaultRef: z11.string().optional().nullable(),
1380
+ cwd: z12.string().min(1).optional().nullable(),
1381
+ repoUrl: z12.string().url().optional().nullable(),
1382
+ repoRef: z12.string().optional().nullable(),
1383
+ defaultRef: z12.string().optional().nullable(),
1269
1384
  visibility: projectWorkspaceVisibilitySchema.optional(),
1270
- setupCommand: z11.string().optional().nullable(),
1271
- cleanupCommand: z11.string().optional().nullable(),
1272
- remoteProvider: z11.string().optional().nullable(),
1273
- remoteWorkspaceRef: z11.string().optional().nullable(),
1274
- sharedWorkspaceKey: z11.string().optional().nullable(),
1275
- metadata: z11.record(z11.unknown()).optional().nullable()
1385
+ setupCommand: z12.string().optional().nullable(),
1386
+ cleanupCommand: z12.string().optional().nullable(),
1387
+ remoteProvider: z12.string().optional().nullable(),
1388
+ remoteWorkspaceRef: z12.string().optional().nullable(),
1389
+ sharedWorkspaceKey: z12.string().optional().nullable(),
1390
+ metadata: z12.record(z12.unknown()).optional().nullable()
1276
1391
  };
1277
- createProjectWorkspaceSchema = z11.object({
1392
+ projectColorValues = new Set(PROJECT_COLORS);
1393
+ legacyProjectColorSchema = z12.string().regex(/^#[0-9a-fA-F]{6}$/);
1394
+ projectColorSchema = z12.string().refine(
1395
+ (value) => legacyProjectColorSchema.safeParse(value).success || projectColorValues.has(value),
1396
+ "Color must be a 6-digit hex value or a supported project gradient"
1397
+ );
1398
+ createProjectWorkspaceSchema = z12.object({
1278
1399
  ...projectWorkspaceFields,
1279
- isPrimary: z11.boolean().optional().default(false)
1400
+ isPrimary: z12.boolean().optional().default(false)
1280
1401
  }).superRefine(validateProjectWorkspace);
1281
- updateProjectWorkspaceSchema = z11.object({
1402
+ updateProjectWorkspaceSchema = z12.object({
1282
1403
  ...projectWorkspaceFields,
1283
- isPrimary: z11.boolean().optional()
1404
+ isPrimary: z12.boolean().optional()
1284
1405
  }).partial();
1285
1406
  projectFields = {
1286
1407
  /** @deprecated Use goalIds instead */
1287
- goalId: z11.string().uuid().optional().nullable(),
1288
- goalIds: z11.array(z11.string().uuid()).optional(),
1289
- name: z11.string().min(1),
1290
- description: z11.string().optional().nullable(),
1291
- status: z11.enum(PROJECT_STATUSES).optional().default("backlog"),
1292
- leadAgentId: z11.string().uuid().optional().nullable(),
1293
- targetDate: z11.string().optional().nullable(),
1294
- color: z11.string().optional().nullable(),
1408
+ goalId: z12.string().uuid().optional().nullable(),
1409
+ goalIds: z12.array(z12.string().uuid()).optional(),
1410
+ name: z12.string().min(1),
1411
+ description: z12.string().optional().nullable(),
1412
+ status: z12.enum(PROJECT_STATUSES).optional().default("backlog"),
1413
+ leadAgentId: z12.string().uuid().optional().nullable(),
1414
+ targetDate: z12.string().optional().nullable(),
1415
+ color: projectColorSchema.optional().nullable(),
1295
1416
  executionWorkspacePolicy: projectExecutionWorkspacePolicySchema.optional().nullable(),
1296
- resourceAttachments: z11.array(projectResourceAttachmentInputSchema).optional(),
1297
- newResources: z11.array(createProjectInlineResourceSchema).optional(),
1298
- archivedAt: z11.string().datetime().optional().nullable()
1417
+ resourceAttachments: z12.array(projectResourceAttachmentInputSchema).optional(),
1418
+ newResources: z12.array(createProjectInlineResourceSchema).optional(),
1419
+ archivedAt: z12.string().datetime().optional().nullable()
1299
1420
  };
1300
- createProjectSchema = z11.object({
1421
+ createProjectSchema = z12.object({
1301
1422
  ...projectFields
1302
1423
  });
1303
- updateProjectSchema = z11.object(projectFields).partial();
1424
+ updateProjectSchema = z12.object(projectFields).partial();
1304
1425
  }
1305
1426
  });
1306
1427
 
1307
1428
  // ../packages/shared/src/validators/issue.ts
1308
- import { z as z12 } from "zod";
1429
+ import { z as z13 } from "zod";
1309
1430
  var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
1310
1431
  var init_issue = __esm({
1311
1432
  "../packages/shared/src/validators/issue.ts"() {
1312
1433
  "use strict";
1313
1434
  init_constants();
1314
- executionWorkspaceStrategySchema2 = z12.object({
1315
- type: z12.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
1316
- baseRef: z12.string().optional().nullable(),
1317
- branchTemplate: z12.string().optional().nullable(),
1318
- worktreeParentDir: z12.string().optional().nullable(),
1319
- provisionCommand: z12.string().optional().nullable(),
1320
- teardownCommand: z12.string().optional().nullable()
1435
+ executionWorkspaceStrategySchema2 = z13.object({
1436
+ type: z13.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
1437
+ baseRef: z13.string().optional().nullable(),
1438
+ branchTemplate: z13.string().optional().nullable(),
1439
+ worktreeParentDir: z13.string().optional().nullable(),
1440
+ provisionCommand: z13.string().optional().nullable(),
1441
+ teardownCommand: z13.string().optional().nullable()
1321
1442
  }).strict();
1322
- issueExecutionWorkspaceSettingsSchema = z12.object({
1323
- mode: z12.enum(["inherit", "shared_workspace", "isolated_workspace", "operator_branch", "reuse_existing", "agent_default"]).optional(),
1443
+ issueExecutionWorkspaceSettingsSchema = z13.object({
1444
+ mode: z13.enum(["inherit", "shared_workspace", "isolated_workspace", "operator_branch", "reuse_existing", "agent_default"]).optional(),
1324
1445
  workspaceStrategy: executionWorkspaceStrategySchema2.optional().nullable(),
1325
- workspaceRuntime: z12.record(z12.unknown()).optional().nullable()
1446
+ workspaceRuntime: z13.record(z13.unknown()).optional().nullable()
1326
1447
  }).strict();
1327
- issueAssigneeAdapterOverridesSchema = z12.object({
1328
- agentRuntimeConfig: z12.record(z12.unknown()).optional(),
1329
- useProjectWorkspace: z12.boolean().optional()
1448
+ issueAssigneeAdapterOverridesSchema = z13.object({
1449
+ agentRuntimeConfig: z13.record(z13.unknown()).optional(),
1450
+ useProjectWorkspace: z13.boolean().optional()
1330
1451
  }).strict();
1331
- createIssueSchema = z12.object({
1332
- projectId: z12.string().uuid().optional().nullable(),
1333
- projectWorkspaceId: z12.string().uuid().optional().nullable(),
1334
- goalId: z12.string().uuid().optional().nullable(),
1335
- parentId: z12.string().uuid().optional().nullable(),
1336
- title: z12.string().min(1),
1337
- description: z12.string().optional().nullable(),
1338
- status: z12.enum(ISSUE_STATUSES).optional().default("backlog"),
1339
- priority: z12.enum(ISSUE_PRIORITIES).optional().default("medium"),
1340
- assigneeAgentId: z12.string().uuid().optional().nullable(),
1341
- assigneeUserId: z12.string().optional().nullable(),
1342
- requestDepth: z12.number().int().nonnegative().optional().default(0),
1343
- billingCode: z12.string().optional().nullable(),
1452
+ createIssueSchema = z13.object({
1453
+ projectId: z13.string().uuid().optional().nullable(),
1454
+ projectWorkspaceId: z13.string().uuid().optional().nullable(),
1455
+ goalId: z13.string().uuid().optional().nullable(),
1456
+ parentId: z13.string().uuid().optional().nullable(),
1457
+ title: z13.string().min(1),
1458
+ description: z13.string().optional().nullable(),
1459
+ status: z13.enum(ISSUE_STATUSES).optional().default("backlog"),
1460
+ priority: z13.enum(ISSUE_PRIORITIES).optional().default("medium"),
1461
+ assigneeAgentId: z13.string().uuid().optional().nullable(),
1462
+ assigneeUserId: z13.string().optional().nullable(),
1463
+ requestDepth: z13.number().int().nonnegative().optional().default(0),
1464
+ billingCode: z13.string().optional().nullable(),
1344
1465
  assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
1345
- executionWorkspaceId: z12.string().uuid().optional().nullable(),
1346
- executionWorkspacePreference: z12.enum([
1466
+ executionWorkspaceId: z13.string().uuid().optional().nullable(),
1467
+ executionWorkspacePreference: z13.enum([
1347
1468
  "inherit",
1348
1469
  "shared_workspace",
1349
1470
  "isolated_workspace",
@@ -1352,11 +1473,11 @@ var init_issue = __esm({
1352
1473
  "agent_default"
1353
1474
  ]).optional().nullable(),
1354
1475
  executionWorkspaceSettings: issueExecutionWorkspaceSettingsSchema.optional().nullable(),
1355
- labelIds: z12.array(z12.string().uuid()).optional()
1476
+ labelIds: z13.array(z13.string().uuid()).optional()
1356
1477
  });
1357
- createIssueLabelSchema = z12.object({
1358
- name: z12.string().trim().min(1).max(48),
1359
- color: z12.string().regex(/^#(?:[0-9a-fA-F]{6})$/, "Color must be a 6-digit hex value")
1478
+ createIssueLabelSchema = z13.object({
1479
+ name: z13.string().trim().min(1).max(48),
1480
+ color: z13.string().regex(/^#(?:[0-9a-fA-F]{6})$/, "Color must be a 6-digit hex value")
1360
1481
  });
1361
1482
  updateIssueLabelSchema = createIssueLabelSchema.partial().refine(
1362
1483
  (value) => value.name !== void 0 || value.color !== void 0,
@@ -1365,45 +1486,45 @@ var init_issue = __esm({
1365
1486
  }
1366
1487
  );
1367
1488
  updateIssueSchema = createIssueSchema.partial().extend({
1368
- comment: z12.string().min(1).optional(),
1369
- reopen: z12.boolean().optional(),
1370
- hiddenAt: z12.string().datetime().nullable().optional()
1489
+ comment: z13.string().min(1).optional(),
1490
+ reopen: z13.boolean().optional(),
1491
+ hiddenAt: z13.string().datetime().nullable().optional()
1371
1492
  });
1372
- checkoutIssueSchema = z12.object({
1373
- agentId: z12.string().uuid(),
1374
- expectedStatuses: z12.array(z12.enum(ISSUE_STATUSES)).nonempty()
1493
+ checkoutIssueSchema = z13.object({
1494
+ agentId: z13.string().uuid(),
1495
+ expectedStatuses: z13.array(z13.enum(ISSUE_STATUSES)).nonempty()
1375
1496
  });
1376
- addIssueCommentSchema = z12.object({
1377
- body: z12.string().min(1),
1378
- reopen: z12.boolean().optional(),
1379
- interrupt: z12.boolean().optional()
1497
+ addIssueCommentSchema = z13.object({
1498
+ body: z13.string().min(1),
1499
+ reopen: z13.boolean().optional(),
1500
+ interrupt: z13.boolean().optional()
1380
1501
  });
1381
- linkIssueApprovalSchema = z12.object({
1382
- approvalId: z12.string().uuid()
1502
+ linkIssueApprovalSchema = z13.object({
1503
+ approvalId: z13.string().uuid()
1383
1504
  });
1384
- createIssueAttachmentMetadataSchema = z12.object({
1385
- issueCommentId: z12.string().uuid().optional().nullable()
1505
+ createIssueAttachmentMetadataSchema = z13.object({
1506
+ issueCommentId: z13.string().uuid().optional().nullable()
1386
1507
  });
1387
1508
  ISSUE_DOCUMENT_FORMATS = ["markdown"];
1388
- issueDocumentFormatSchema = z12.enum(ISSUE_DOCUMENT_FORMATS);
1389
- issueDocumentKeySchema = z12.string().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/, "Document key must be lowercase letters, numbers, _ or -");
1390
- upsertIssueDocumentSchema = z12.object({
1391
- title: z12.string().trim().max(200).nullable().optional(),
1509
+ issueDocumentFormatSchema = z13.enum(ISSUE_DOCUMENT_FORMATS);
1510
+ issueDocumentKeySchema = z13.string().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/, "Document key must be lowercase letters, numbers, _ or -");
1511
+ upsertIssueDocumentSchema = z13.object({
1512
+ title: z13.string().trim().max(200).nullable().optional(),
1392
1513
  format: issueDocumentFormatSchema,
1393
- body: z12.string().max(524288),
1394
- changeSummary: z12.string().trim().max(500).nullable().optional(),
1395
- baseRevisionId: z12.string().uuid().nullable().optional()
1514
+ body: z13.string().max(524288),
1515
+ changeSummary: z13.string().trim().max(500).nullable().optional(),
1516
+ baseRevisionId: z13.string().uuid().nullable().optional()
1396
1517
  });
1397
1518
  }
1398
1519
  });
1399
1520
 
1400
1521
  // ../packages/shared/src/validators/work-product.ts
1401
- import { z as z13 } from "zod";
1522
+ import { z as z14 } from "zod";
1402
1523
  var issueWorkProductTypeSchema, issueWorkProductStatusSchema, issueWorkProductReviewStateSchema, createIssueWorkProductSchema, updateIssueWorkProductSchema;
1403
1524
  var init_work_product = __esm({
1404
1525
  "../packages/shared/src/validators/work-product.ts"() {
1405
1526
  "use strict";
1406
- issueWorkProductTypeSchema = z13.enum([
1527
+ issueWorkProductTypeSchema = z14.enum([
1407
1528
  "preview_url",
1408
1529
  "runtime_service",
1409
1530
  "pull_request",
@@ -1412,7 +1533,7 @@ var init_work_product = __esm({
1412
1533
  "artifact",
1413
1534
  "document"
1414
1535
  ]);
1415
- issueWorkProductStatusSchema = z13.enum([
1536
+ issueWorkProductStatusSchema = z14.enum([
1416
1537
  "active",
1417
1538
  "ready_for_review",
1418
1539
  "approved",
@@ -1423,226 +1544,226 @@ var init_work_product = __esm({
1423
1544
  "archived",
1424
1545
  "draft"
1425
1546
  ]);
1426
- issueWorkProductReviewStateSchema = z13.enum([
1547
+ issueWorkProductReviewStateSchema = z14.enum([
1427
1548
  "none",
1428
1549
  "needs_board_review",
1429
1550
  "approved",
1430
1551
  "changes_requested"
1431
1552
  ]);
1432
- createIssueWorkProductSchema = z13.object({
1433
- projectId: z13.string().uuid().optional().nullable(),
1434
- executionWorkspaceId: z13.string().uuid().optional().nullable(),
1435
- runtimeServiceId: z13.string().uuid().optional().nullable(),
1553
+ createIssueWorkProductSchema = z14.object({
1554
+ projectId: z14.string().uuid().optional().nullable(),
1555
+ executionWorkspaceId: z14.string().uuid().optional().nullable(),
1556
+ runtimeServiceId: z14.string().uuid().optional().nullable(),
1436
1557
  type: issueWorkProductTypeSchema,
1437
- provider: z13.string().min(1),
1438
- externalId: z13.string().optional().nullable(),
1439
- title: z13.string().min(1),
1440
- url: z13.string().url().optional().nullable(),
1558
+ provider: z14.string().min(1),
1559
+ externalId: z14.string().optional().nullable(),
1560
+ title: z14.string().min(1),
1561
+ url: z14.string().url().optional().nullable(),
1441
1562
  status: issueWorkProductStatusSchema.default("active"),
1442
1563
  reviewState: issueWorkProductReviewStateSchema.optional().default("none"),
1443
- isPrimary: z13.boolean().optional().default(false),
1444
- healthStatus: z13.enum(["unknown", "healthy", "unhealthy"]).optional().default("unknown"),
1445
- summary: z13.string().optional().nullable(),
1446
- metadata: z13.record(z13.unknown()).optional().nullable(),
1447
- createdByRunId: z13.string().uuid().optional().nullable()
1564
+ isPrimary: z14.boolean().optional().default(false),
1565
+ healthStatus: z14.enum(["unknown", "healthy", "unhealthy"]).optional().default("unknown"),
1566
+ summary: z14.string().optional().nullable(),
1567
+ metadata: z14.record(z14.unknown()).optional().nullable(),
1568
+ createdByRunId: z14.string().uuid().optional().nullable()
1448
1569
  });
1449
1570
  updateIssueWorkProductSchema = createIssueWorkProductSchema.partial();
1450
1571
  }
1451
1572
  });
1452
1573
 
1453
1574
  // ../packages/shared/src/validators/execution-workspace.ts
1454
- import { z as z14 } from "zod";
1575
+ import { z as z15 } from "zod";
1455
1576
  var executionWorkspaceStatusSchema, updateExecutionWorkspaceSchema;
1456
1577
  var init_execution_workspace = __esm({
1457
1578
  "../packages/shared/src/validators/execution-workspace.ts"() {
1458
1579
  "use strict";
1459
- executionWorkspaceStatusSchema = z14.enum([
1580
+ executionWorkspaceStatusSchema = z15.enum([
1460
1581
  "active",
1461
1582
  "idle",
1462
1583
  "in_review",
1463
1584
  "archived",
1464
1585
  "cleanup_failed"
1465
1586
  ]);
1466
- updateExecutionWorkspaceSchema = z14.object({
1587
+ updateExecutionWorkspaceSchema = z15.object({
1467
1588
  status: executionWorkspaceStatusSchema.optional(),
1468
- cleanupEligibleAt: z14.string().datetime().optional().nullable(),
1469
- cleanupReason: z14.string().optional().nullable(),
1470
- metadata: z14.record(z14.unknown()).optional().nullable()
1589
+ cleanupEligibleAt: z15.string().datetime().optional().nullable(),
1590
+ cleanupReason: z15.string().optional().nullable(),
1591
+ metadata: z15.record(z15.unknown()).optional().nullable()
1471
1592
  }).strict();
1472
1593
  }
1473
1594
  });
1474
1595
 
1475
1596
  // ../packages/shared/src/validators/goal.ts
1476
- import { z as z15 } from "zod";
1597
+ import { z as z16 } from "zod";
1477
1598
  var createGoalSchema, updateGoalSchema;
1478
1599
  var init_goal = __esm({
1479
1600
  "../packages/shared/src/validators/goal.ts"() {
1480
1601
  "use strict";
1481
1602
  init_constants();
1482
- createGoalSchema = z15.object({
1483
- title: z15.string().min(1),
1484
- description: z15.string().optional().nullable(),
1485
- level: z15.enum(GOAL_LEVELS).optional().default("task"),
1486
- status: z15.enum(GOAL_STATUSES).optional().default("planned"),
1487
- parentId: z15.string().uuid().optional().nullable(),
1488
- ownerAgentId: z15.string().uuid().optional().nullable()
1603
+ createGoalSchema = z16.object({
1604
+ title: z16.string().min(1),
1605
+ description: z16.string().optional().nullable(),
1606
+ level: z16.enum(GOAL_LEVELS).optional().default("task"),
1607
+ status: z16.enum(GOAL_STATUSES).optional().default("planned"),
1608
+ parentId: z16.string().uuid().optional().nullable(),
1609
+ ownerAgentId: z16.string().uuid().optional().nullable()
1489
1610
  });
1490
1611
  updateGoalSchema = createGoalSchema.partial();
1491
1612
  }
1492
1613
  });
1493
1614
 
1494
1615
  // ../packages/shared/src/validators/approval.ts
1495
- import { z as z16 } from "zod";
1616
+ import { z as z17 } from "zod";
1496
1617
  var createApprovalSchema, resolveApprovalSchema, requestApprovalRevisionSchema, resubmitApprovalSchema, addApprovalCommentSchema;
1497
1618
  var init_approval = __esm({
1498
1619
  "../packages/shared/src/validators/approval.ts"() {
1499
1620
  "use strict";
1500
1621
  init_constants();
1501
- createApprovalSchema = z16.object({
1502
- type: z16.enum(APPROVAL_TYPES),
1503
- requestedByAgentId: z16.string().uuid().optional().nullable(),
1504
- payload: z16.record(z16.unknown()),
1505
- issueIds: z16.array(z16.string().uuid()).optional()
1622
+ createApprovalSchema = z17.object({
1623
+ type: z17.enum(APPROVAL_TYPES),
1624
+ requestedByAgentId: z17.string().uuid().optional().nullable(),
1625
+ payload: z17.record(z17.unknown()),
1626
+ issueIds: z17.array(z17.string().uuid()).optional()
1506
1627
  });
1507
- resolveApprovalSchema = z16.object({
1508
- decisionNote: z16.string().optional().nullable(),
1509
- decidedByUserId: z16.string().optional().default("board")
1628
+ resolveApprovalSchema = z17.object({
1629
+ decisionNote: z17.string().optional().nullable(),
1630
+ decidedByUserId: z17.string().optional().default("board")
1510
1631
  });
1511
- requestApprovalRevisionSchema = z16.object({
1512
- decisionNote: z16.string().optional().nullable(),
1513
- decidedByUserId: z16.string().optional().default("board")
1632
+ requestApprovalRevisionSchema = z17.object({
1633
+ decisionNote: z17.string().optional().nullable(),
1634
+ decidedByUserId: z17.string().optional().default("board")
1514
1635
  });
1515
- resubmitApprovalSchema = z16.object({
1516
- payload: z16.record(z16.unknown()).optional()
1636
+ resubmitApprovalSchema = z17.object({
1637
+ payload: z17.record(z17.unknown()).optional()
1517
1638
  });
1518
- addApprovalCommentSchema = z16.object({
1519
- body: z16.string().min(1)
1639
+ addApprovalCommentSchema = z17.object({
1640
+ body: z17.string().min(1)
1520
1641
  });
1521
1642
  }
1522
1643
  });
1523
1644
 
1524
1645
  // ../packages/shared/src/validators/automation.ts
1525
- import { z as z17 } from "zod";
1646
+ import { z as z18 } from "zod";
1526
1647
  var createAutomationSchema, updateAutomationSchema, baseTriggerSchema, createAutomationTriggerSchema, updateAutomationTriggerSchema, runAutomationSchema, rotateAutomationTriggerSecretSchema;
1527
1648
  var init_automation = __esm({
1528
1649
  "../packages/shared/src/validators/automation.ts"() {
1529
1650
  "use strict";
1530
1651
  init_constants();
1531
- createAutomationSchema = z17.object({
1532
- projectId: z17.string().uuid(),
1533
- goalId: z17.string().uuid().optional().nullable(),
1534
- parentIssueId: z17.string().uuid().optional().nullable(),
1535
- title: z17.string().trim().min(1).max(200),
1536
- description: z17.string().optional().nullable(),
1537
- assigneeAgentId: z17.string().uuid(),
1538
- priority: z17.enum(ISSUE_PRIORITIES).optional().default("medium"),
1539
- status: z17.enum(AUTOMATION_STATUSES).optional().default("active"),
1540
- concurrencyPolicy: z17.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
1541
- catchUpPolicy: z17.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed")
1652
+ createAutomationSchema = z18.object({
1653
+ projectId: z18.string().uuid(),
1654
+ goalId: z18.string().uuid().optional().nullable(),
1655
+ parentIssueId: z18.string().uuid().optional().nullable(),
1656
+ title: z18.string().trim().min(1).max(200),
1657
+ description: z18.string().optional().nullable(),
1658
+ assigneeAgentId: z18.string().uuid(),
1659
+ priority: z18.enum(ISSUE_PRIORITIES).optional().default("medium"),
1660
+ status: z18.enum(AUTOMATION_STATUSES).optional().default("active"),
1661
+ concurrencyPolicy: z18.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
1662
+ catchUpPolicy: z18.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed")
1542
1663
  });
1543
1664
  updateAutomationSchema = createAutomationSchema.partial();
1544
- baseTriggerSchema = z17.object({
1545
- label: z17.string().trim().max(120).optional().nullable(),
1546
- enabled: z17.boolean().optional().default(true)
1665
+ baseTriggerSchema = z18.object({
1666
+ label: z18.string().trim().max(120).optional().nullable(),
1667
+ enabled: z18.boolean().optional().default(true)
1547
1668
  });
1548
- createAutomationTriggerSchema = z17.discriminatedUnion("kind", [
1669
+ createAutomationTriggerSchema = z18.discriminatedUnion("kind", [
1549
1670
  baseTriggerSchema.extend({
1550
- kind: z17.literal("schedule"),
1551
- cronExpression: z17.string().trim().min(1),
1552
- timezone: z17.string().trim().min(1).default("UTC")
1671
+ kind: z18.literal("schedule"),
1672
+ cronExpression: z18.string().trim().min(1),
1673
+ timezone: z18.string().trim().min(1).default("UTC")
1553
1674
  }),
1554
1675
  baseTriggerSchema.extend({
1555
- kind: z17.literal("webhook"),
1556
- signingMode: z17.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
1557
- replayWindowSec: z17.number().int().min(30).max(86400).optional().default(300)
1676
+ kind: z18.literal("webhook"),
1677
+ signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
1678
+ replayWindowSec: z18.number().int().min(30).max(86400).optional().default(300)
1558
1679
  }),
1559
1680
  baseTriggerSchema.extend({
1560
- kind: z17.literal("api")
1681
+ kind: z18.literal("api")
1561
1682
  })
1562
1683
  ]);
1563
- updateAutomationTriggerSchema = z17.object({
1564
- label: z17.string().trim().max(120).optional().nullable(),
1565
- enabled: z17.boolean().optional(),
1566
- cronExpression: z17.string().trim().min(1).optional().nullable(),
1567
- timezone: z17.string().trim().min(1).optional().nullable(),
1568
- signingMode: z17.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
1569
- replayWindowSec: z17.number().int().min(30).max(86400).optional().nullable()
1684
+ updateAutomationTriggerSchema = z18.object({
1685
+ label: z18.string().trim().max(120).optional().nullable(),
1686
+ enabled: z18.boolean().optional(),
1687
+ cronExpression: z18.string().trim().min(1).optional().nullable(),
1688
+ timezone: z18.string().trim().min(1).optional().nullable(),
1689
+ signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
1690
+ replayWindowSec: z18.number().int().min(30).max(86400).optional().nullable()
1570
1691
  });
1571
- runAutomationSchema = z17.object({
1572
- triggerId: z17.string().uuid().optional().nullable(),
1573
- payload: z17.record(z17.unknown()).optional().nullable(),
1574
- idempotencyKey: z17.string().trim().max(255).optional().nullable(),
1575
- source: z17.enum(["manual", "api"]).optional().default("manual")
1692
+ runAutomationSchema = z18.object({
1693
+ triggerId: z18.string().uuid().optional().nullable(),
1694
+ payload: z18.record(z18.unknown()).optional().nullable(),
1695
+ idempotencyKey: z18.string().trim().max(255).optional().nullable(),
1696
+ source: z18.enum(["manual", "api"]).optional().default("manual")
1576
1697
  });
1577
- rotateAutomationTriggerSecretSchema = z17.object({});
1698
+ rotateAutomationTriggerSecretSchema = z18.object({});
1578
1699
  }
1579
1700
  });
1580
1701
 
1581
1702
  // ../packages/shared/src/validators/cost.ts
1582
- import { z as z18 } from "zod";
1703
+ import { z as z19 } from "zod";
1583
1704
  var createCostEventSchema, updateBudgetSchema;
1584
1705
  var init_cost = __esm({
1585
1706
  "../packages/shared/src/validators/cost.ts"() {
1586
1707
  "use strict";
1587
1708
  init_constants();
1588
- createCostEventSchema = z18.object({
1589
- agentId: z18.string().uuid(),
1590
- issueId: z18.string().uuid().optional().nullable(),
1591
- projectId: z18.string().uuid().optional().nullable(),
1592
- goalId: z18.string().uuid().optional().nullable(),
1593
- heartbeatRunId: z18.string().uuid().optional().nullable(),
1594
- billingCode: z18.string().optional().nullable(),
1595
- provider: z18.string().min(1),
1596
- biller: z18.string().min(1).optional(),
1597
- billingType: z18.enum(BILLING_TYPES).optional().default("unknown"),
1598
- model: z18.string().min(1),
1599
- inputTokens: z18.number().int().nonnegative().optional().default(0),
1600
- cachedInputTokens: z18.number().int().nonnegative().optional().default(0),
1601
- outputTokens: z18.number().int().nonnegative().optional().default(0),
1602
- costCents: z18.number().int().nonnegative(),
1603
- occurredAt: z18.string().datetime()
1709
+ createCostEventSchema = z19.object({
1710
+ agentId: z19.string().uuid(),
1711
+ issueId: z19.string().uuid().optional().nullable(),
1712
+ projectId: z19.string().uuid().optional().nullable(),
1713
+ goalId: z19.string().uuid().optional().nullable(),
1714
+ heartbeatRunId: z19.string().uuid().optional().nullable(),
1715
+ billingCode: z19.string().optional().nullable(),
1716
+ provider: z19.string().min(1),
1717
+ biller: z19.string().min(1).optional(),
1718
+ billingType: z19.enum(BILLING_TYPES).optional().default("unknown"),
1719
+ model: z19.string().min(1),
1720
+ inputTokens: z19.number().int().nonnegative().optional().default(0),
1721
+ cachedInputTokens: z19.number().int().nonnegative().optional().default(0),
1722
+ outputTokens: z19.number().int().nonnegative().optional().default(0),
1723
+ costCents: z19.number().int().nonnegative(),
1724
+ occurredAt: z19.string().datetime()
1604
1725
  }).transform((value) => ({
1605
1726
  ...value,
1606
1727
  biller: value.biller ?? value.provider
1607
1728
  }));
1608
- updateBudgetSchema = z18.object({
1609
- budgetMonthlyCents: z18.number().int().nonnegative()
1729
+ updateBudgetSchema = z19.object({
1730
+ budgetMonthlyCents: z19.number().int().nonnegative()
1610
1731
  });
1611
1732
  }
1612
1733
  });
1613
1734
 
1614
1735
  // ../packages/shared/src/validators/finance.ts
1615
- import { z as z19 } from "zod";
1736
+ import { z as z20 } from "zod";
1616
1737
  var createFinanceEventSchema;
1617
1738
  var init_finance = __esm({
1618
1739
  "../packages/shared/src/validators/finance.ts"() {
1619
1740
  "use strict";
1620
1741
  init_constants();
1621
- createFinanceEventSchema = z19.object({
1622
- agentId: z19.string().uuid().optional().nullable(),
1623
- issueId: z19.string().uuid().optional().nullable(),
1624
- projectId: z19.string().uuid().optional().nullable(),
1625
- goalId: z19.string().uuid().optional().nullable(),
1626
- heartbeatRunId: z19.string().uuid().optional().nullable(),
1627
- costEventId: z19.string().uuid().optional().nullable(),
1628
- billingCode: z19.string().optional().nullable(),
1629
- description: z19.string().max(500).optional().nullable(),
1630
- eventKind: z19.enum(FINANCE_EVENT_KINDS),
1631
- direction: z19.enum(FINANCE_DIRECTIONS).optional().default("debit"),
1632
- biller: z19.string().min(1),
1633
- provider: z19.string().min(1).optional().nullable(),
1634
- executionAgentRuntimeType: z19.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
1635
- pricingTier: z19.string().min(1).optional().nullable(),
1636
- region: z19.string().min(1).optional().nullable(),
1637
- model: z19.string().min(1).optional().nullable(),
1638
- quantity: z19.number().int().nonnegative().optional().nullable(),
1639
- unit: z19.enum(FINANCE_UNITS).optional().nullable(),
1640
- amountCents: z19.number().int().nonnegative(),
1641
- currency: z19.string().length(3).optional().default("USD"),
1642
- estimated: z19.boolean().optional().default(false),
1643
- externalInvoiceId: z19.string().optional().nullable(),
1644
- metadataJson: z19.record(z19.string(), z19.unknown()).optional().nullable(),
1645
- occurredAt: z19.string().datetime()
1742
+ createFinanceEventSchema = z20.object({
1743
+ agentId: z20.string().uuid().optional().nullable(),
1744
+ issueId: z20.string().uuid().optional().nullable(),
1745
+ projectId: z20.string().uuid().optional().nullable(),
1746
+ goalId: z20.string().uuid().optional().nullable(),
1747
+ heartbeatRunId: z20.string().uuid().optional().nullable(),
1748
+ costEventId: z20.string().uuid().optional().nullable(),
1749
+ billingCode: z20.string().optional().nullable(),
1750
+ description: z20.string().max(500).optional().nullable(),
1751
+ eventKind: z20.enum(FINANCE_EVENT_KINDS),
1752
+ direction: z20.enum(FINANCE_DIRECTIONS).optional().default("debit"),
1753
+ biller: z20.string().min(1),
1754
+ provider: z20.string().min(1).optional().nullable(),
1755
+ executionAgentRuntimeType: z20.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
1756
+ pricingTier: z20.string().min(1).optional().nullable(),
1757
+ region: z20.string().min(1).optional().nullable(),
1758
+ model: z20.string().min(1).optional().nullable(),
1759
+ quantity: z20.number().int().nonnegative().optional().nullable(),
1760
+ unit: z20.enum(FINANCE_UNITS).optional().nullable(),
1761
+ amountCents: z20.number().int().nonnegative(),
1762
+ currency: z20.string().length(3).optional().default("USD"),
1763
+ estimated: z20.boolean().optional().default(false),
1764
+ externalInvoiceId: z20.string().optional().nullable(),
1765
+ metadataJson: z20.record(z20.string(), z20.unknown()).optional().nullable(),
1766
+ occurredAt: z20.string().datetime()
1646
1767
  }).transform((value) => ({
1647
1768
  ...value,
1648
1769
  currency: value.currency.toUpperCase()
@@ -1651,81 +1772,81 @@ var init_finance = __esm({
1651
1772
  });
1652
1773
 
1653
1774
  // ../packages/shared/src/validators/asset.ts
1654
- import { z as z20 } from "zod";
1775
+ import { z as z21 } from "zod";
1655
1776
  var createAssetImageMetadataSchema;
1656
1777
  var init_asset = __esm({
1657
1778
  "../packages/shared/src/validators/asset.ts"() {
1658
1779
  "use strict";
1659
- createAssetImageMetadataSchema = z20.object({
1660
- namespace: z20.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
1780
+ createAssetImageMetadataSchema = z21.object({
1781
+ namespace: z21.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
1661
1782
  });
1662
1783
  }
1663
1784
  });
1664
1785
 
1665
1786
  // ../packages/shared/src/validators/access.ts
1666
- import { z as z21 } from "zod";
1787
+ import { z as z22 } from "zod";
1667
1788
  var createCompanyInviteSchema, createOpenClawInvitePromptSchema, acceptInviteSchema, listJoinRequestsQuerySchema, claimJoinRequestApiKeySchema, boardCliAuthAccessLevelSchema, createCliAuthChallengeSchema, resolveCliAuthChallengeSchema, updateMemberPermissionsSchema, updateUserCompanyAccessSchema;
1668
1789
  var init_access = __esm({
1669
1790
  "../packages/shared/src/validators/access.ts"() {
1670
1791
  "use strict";
1671
1792
  init_constants();
1672
- createCompanyInviteSchema = z21.object({
1673
- allowedJoinTypes: z21.enum(INVITE_JOIN_TYPES).default("both"),
1674
- defaultsPayload: z21.record(z21.string(), z21.unknown()).optional().nullable(),
1675
- agentMessage: z21.string().max(4e3).optional().nullable()
1793
+ createCompanyInviteSchema = z22.object({
1794
+ allowedJoinTypes: z22.enum(INVITE_JOIN_TYPES).default("both"),
1795
+ defaultsPayload: z22.record(z22.string(), z22.unknown()).optional().nullable(),
1796
+ agentMessage: z22.string().max(4e3).optional().nullable()
1676
1797
  });
1677
- createOpenClawInvitePromptSchema = z21.object({
1678
- agentMessage: z21.string().max(4e3).optional().nullable()
1798
+ createOpenClawInvitePromptSchema = z22.object({
1799
+ agentMessage: z22.string().max(4e3).optional().nullable()
1679
1800
  });
1680
- acceptInviteSchema = z21.object({
1681
- requestType: z21.enum(JOIN_REQUEST_TYPES),
1682
- agentName: z21.string().min(1).max(120).optional(),
1683
- agentRuntimeType: z21.enum(AGENT_RUNTIME_TYPES).optional(),
1684
- capabilities: z21.string().max(4e3).optional().nullable(),
1685
- agentDefaultsPayload: z21.record(z21.string(), z21.unknown()).optional().nullable(),
1801
+ acceptInviteSchema = z22.object({
1802
+ requestType: z22.enum(JOIN_REQUEST_TYPES),
1803
+ agentName: z22.string().min(1).max(120).optional(),
1804
+ agentRuntimeType: z22.enum(AGENT_RUNTIME_TYPES).optional(),
1805
+ capabilities: z22.string().max(4e3).optional().nullable(),
1806
+ agentDefaultsPayload: z22.record(z22.string(), z22.unknown()).optional().nullable(),
1686
1807
  // OpenClaw join compatibility fields accepted at top level.
1687
- responsesWebhookUrl: z21.string().max(4e3).optional().nullable(),
1688
- responsesWebhookMethod: z21.string().max(32).optional().nullable(),
1689
- responsesWebhookHeaders: z21.record(z21.string(), z21.unknown()).optional().nullable(),
1690
- rudderApiUrl: z21.string().max(4e3).optional().nullable(),
1691
- webhookAuthHeader: z21.string().max(4e3).optional().nullable()
1808
+ responsesWebhookUrl: z22.string().max(4e3).optional().nullable(),
1809
+ responsesWebhookMethod: z22.string().max(32).optional().nullable(),
1810
+ responsesWebhookHeaders: z22.record(z22.string(), z22.unknown()).optional().nullable(),
1811
+ rudderApiUrl: z22.string().max(4e3).optional().nullable(),
1812
+ webhookAuthHeader: z22.string().max(4e3).optional().nullable()
1692
1813
  });
1693
- listJoinRequestsQuerySchema = z21.object({
1694
- status: z21.enum(JOIN_REQUEST_STATUSES).optional(),
1695
- requestType: z21.enum(JOIN_REQUEST_TYPES).optional()
1814
+ listJoinRequestsQuerySchema = z22.object({
1815
+ status: z22.enum(JOIN_REQUEST_STATUSES).optional(),
1816
+ requestType: z22.enum(JOIN_REQUEST_TYPES).optional()
1696
1817
  });
1697
- claimJoinRequestApiKeySchema = z21.object({
1698
- claimSecret: z21.string().min(16).max(256)
1818
+ claimJoinRequestApiKeySchema = z22.object({
1819
+ claimSecret: z22.string().min(16).max(256)
1699
1820
  });
1700
- boardCliAuthAccessLevelSchema = z21.enum([
1821
+ boardCliAuthAccessLevelSchema = z22.enum([
1701
1822
  "board",
1702
1823
  "instance_admin_required"
1703
1824
  ]);
1704
- createCliAuthChallengeSchema = z21.object({
1705
- command: z21.string().min(1).max(240),
1706
- clientName: z21.string().max(120).optional().nullable(),
1825
+ createCliAuthChallengeSchema = z22.object({
1826
+ command: z22.string().min(1).max(240),
1827
+ clientName: z22.string().max(120).optional().nullable(),
1707
1828
  requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
1708
- requestedCompanyId: z21.string().uuid().optional().nullable()
1829
+ requestedCompanyId: z22.string().uuid().optional().nullable()
1709
1830
  });
1710
- resolveCliAuthChallengeSchema = z21.object({
1711
- token: z21.string().min(16).max(256)
1831
+ resolveCliAuthChallengeSchema = z22.object({
1832
+ token: z22.string().min(16).max(256)
1712
1833
  });
1713
- updateMemberPermissionsSchema = z21.object({
1714
- grants: z21.array(
1715
- z21.object({
1716
- permissionKey: z21.enum(PERMISSION_KEYS),
1717
- scope: z21.record(z21.string(), z21.unknown()).optional().nullable()
1834
+ updateMemberPermissionsSchema = z22.object({
1835
+ grants: z22.array(
1836
+ z22.object({
1837
+ permissionKey: z22.enum(PERMISSION_KEYS),
1838
+ scope: z22.record(z22.string(), z22.unknown()).optional().nullable()
1718
1839
  })
1719
1840
  )
1720
1841
  });
1721
- updateUserCompanyAccessSchema = z21.object({
1722
- orgIds: z21.array(z21.string().uuid()).default([])
1842
+ updateUserCompanyAccessSchema = z22.object({
1843
+ orgIds: z22.array(z22.string().uuid()).default([])
1723
1844
  });
1724
1845
  }
1725
1846
  });
1726
1847
 
1727
1848
  // ../packages/shared/src/validators/plugin.ts
1728
- import { z as z22 } from "zod";
1849
+ import { z as z23 } from "zod";
1729
1850
  function isValidCronExpression(expression) {
1730
1851
  const trimmed = expression.trim();
1731
1852
  if (!trimmed) return false;
@@ -1738,7 +1859,7 @@ var init_plugin = __esm({
1738
1859
  "../packages/shared/src/validators/plugin.ts"() {
1739
1860
  "use strict";
1740
1861
  init_constants();
1741
- jsonSchemaSchema = z22.record(z22.unknown()).refine(
1862
+ jsonSchemaSchema = z23.record(z23.unknown()).refine(
1742
1863
  (val) => {
1743
1864
  if (Object.keys(val).length === 0) return true;
1744
1865
  return typeof val.type === "string" || val.$ref !== void 0 || val.oneOf !== void 0 || val.anyOf !== void 0 || val.allOf !== void 0;
@@ -1746,76 +1867,76 @@ var init_plugin = __esm({
1746
1867
  { message: "Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)" }
1747
1868
  );
1748
1869
  CRON_FIELD_PATTERN = /^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;
1749
- pluginJobDeclarationSchema = z22.object({
1750
- jobKey: z22.string().min(1),
1751
- displayName: z22.string().min(1),
1752
- description: z22.string().optional(),
1753
- schedule: z22.string().refine(
1870
+ pluginJobDeclarationSchema = z23.object({
1871
+ jobKey: z23.string().min(1),
1872
+ displayName: z23.string().min(1),
1873
+ description: z23.string().optional(),
1874
+ schedule: z23.string().refine(
1754
1875
  (val) => isValidCronExpression(val),
1755
1876
  { message: "schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')" }
1756
1877
  ).optional()
1757
1878
  });
1758
- pluginWebhookDeclarationSchema = z22.object({
1759
- endpointKey: z22.string().min(1),
1760
- displayName: z22.string().min(1),
1761
- description: z22.string().optional()
1879
+ pluginWebhookDeclarationSchema = z23.object({
1880
+ endpointKey: z23.string().min(1),
1881
+ displayName: z23.string().min(1),
1882
+ description: z23.string().optional()
1762
1883
  });
1763
- pluginToolDeclarationSchema = z22.object({
1764
- name: z22.string().min(1),
1765
- displayName: z22.string().min(1),
1766
- description: z22.string().min(1),
1884
+ pluginToolDeclarationSchema = z23.object({
1885
+ name: z23.string().min(1),
1886
+ displayName: z23.string().min(1),
1887
+ description: z23.string().min(1),
1767
1888
  parametersSchema: jsonSchemaSchema
1768
1889
  });
1769
- pluginUiSlotDeclarationSchema = z22.object({
1770
- type: z22.enum(PLUGIN_UI_SLOT_TYPES),
1771
- id: z22.string().min(1),
1772
- displayName: z22.string().min(1),
1773
- exportName: z22.string().min(1),
1774
- entityTypes: z22.array(z22.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
1775
- routePath: z22.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
1890
+ pluginUiSlotDeclarationSchema = z23.object({
1891
+ type: z23.enum(PLUGIN_UI_SLOT_TYPES),
1892
+ id: z23.string().min(1),
1893
+ displayName: z23.string().min(1),
1894
+ exportName: z23.string().min(1),
1895
+ entityTypes: z23.array(z23.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
1896
+ routePath: z23.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
1776
1897
  message: "routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"
1777
1898
  }).optional(),
1778
- order: z22.number().int().optional()
1899
+ order: z23.number().int().optional()
1779
1900
  }).superRefine((value, ctx) => {
1780
1901
  const entityScopedTypes = ["detailTab", "taskDetailView", "contextMenuItem", "commentAnnotation", "commentContextMenuItem", "projectSidebarItem"];
1781
1902
  if (entityScopedTypes.includes(value.type) && (!value.entityTypes || value.entityTypes.length === 0)) {
1782
1903
  ctx.addIssue({
1783
- code: z22.ZodIssueCode.custom,
1904
+ code: z23.ZodIssueCode.custom,
1784
1905
  message: `${value.type} slots require at least one entityType`,
1785
1906
  path: ["entityTypes"]
1786
1907
  });
1787
1908
  }
1788
1909
  if (value.type === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
1789
1910
  ctx.addIssue({
1790
- code: z22.ZodIssueCode.custom,
1911
+ code: z23.ZodIssueCode.custom,
1791
1912
  message: 'projectSidebarItem slots require entityTypes to include "project"',
1792
1913
  path: ["entityTypes"]
1793
1914
  });
1794
1915
  }
1795
1916
  if (value.type === "commentAnnotation" && value.entityTypes && !value.entityTypes.includes("comment")) {
1796
1917
  ctx.addIssue({
1797
- code: z22.ZodIssueCode.custom,
1918
+ code: z23.ZodIssueCode.custom,
1798
1919
  message: 'commentAnnotation slots require entityTypes to include "comment"',
1799
1920
  path: ["entityTypes"]
1800
1921
  });
1801
1922
  }
1802
1923
  if (value.type === "commentContextMenuItem" && value.entityTypes && !value.entityTypes.includes("comment")) {
1803
1924
  ctx.addIssue({
1804
- code: z22.ZodIssueCode.custom,
1925
+ code: z23.ZodIssueCode.custom,
1805
1926
  message: 'commentContextMenuItem slots require entityTypes to include "comment"',
1806
1927
  path: ["entityTypes"]
1807
1928
  });
1808
1929
  }
1809
1930
  if (value.routePath && value.type !== "page") {
1810
1931
  ctx.addIssue({
1811
- code: z22.ZodIssueCode.custom,
1932
+ code: z23.ZodIssueCode.custom,
1812
1933
  message: "routePath is only supported for page slots",
1813
1934
  path: ["routePath"]
1814
1935
  });
1815
1936
  }
1816
1937
  if (value.routePath && PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS.includes(value.routePath)) {
1817
1938
  ctx.addIssue({
1818
- code: z22.ZodIssueCode.custom,
1939
+ code: z23.ZodIssueCode.custom,
1819
1940
  message: `routePath "${value.routePath}" is reserved by the host`,
1820
1941
  path: ["routePath"]
1821
1942
  });
@@ -1836,29 +1957,29 @@ var init_plugin = __esm({
1836
1957
  external: [],
1837
1958
  iframe: ["compact", "default", "wide", "full"]
1838
1959
  };
1839
- pluginLauncherActionDeclarationSchema = z22.object({
1840
- type: z22.enum(PLUGIN_LAUNCHER_ACTIONS),
1841
- target: z22.string().min(1),
1842
- params: z22.record(z22.unknown()).optional()
1960
+ pluginLauncherActionDeclarationSchema = z23.object({
1961
+ type: z23.enum(PLUGIN_LAUNCHER_ACTIONS),
1962
+ target: z23.string().min(1),
1963
+ params: z23.record(z23.unknown()).optional()
1843
1964
  }).superRefine((value, ctx) => {
1844
1965
  if (value.type === "performAction" && value.target.includes("/")) {
1845
1966
  ctx.addIssue({
1846
- code: z22.ZodIssueCode.custom,
1967
+ code: z23.ZodIssueCode.custom,
1847
1968
  message: "performAction launchers must target an action key, not a route or URL",
1848
1969
  path: ["target"]
1849
1970
  });
1850
1971
  }
1851
1972
  if (value.type === "navigate" && /^https?:\/\//.test(value.target)) {
1852
1973
  ctx.addIssue({
1853
- code: z22.ZodIssueCode.custom,
1974
+ code: z23.ZodIssueCode.custom,
1854
1975
  message: "navigate launchers must target a host route, not an absolute URL",
1855
1976
  path: ["target"]
1856
1977
  });
1857
1978
  }
1858
1979
  });
1859
- pluginLauncherRenderDeclarationSchema = z22.object({
1860
- environment: z22.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
1861
- bounds: z22.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
1980
+ pluginLauncherRenderDeclarationSchema = z23.object({
1981
+ environment: z23.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
1982
+ bounds: z23.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
1862
1983
  }).superRefine((value, ctx) => {
1863
1984
  if (!value.bounds) {
1864
1985
  return;
@@ -1866,122 +1987,122 @@ var init_plugin = __esm({
1866
1987
  const supportedBounds = launcherBoundsByEnvironment[value.environment];
1867
1988
  if (!supportedBounds.includes(value.bounds)) {
1868
1989
  ctx.addIssue({
1869
- code: z22.ZodIssueCode.custom,
1990
+ code: z23.ZodIssueCode.custom,
1870
1991
  message: `bounds "${value.bounds}" is not supported for render environment "${value.environment}"`,
1871
1992
  path: ["bounds"]
1872
1993
  });
1873
1994
  }
1874
1995
  });
1875
- pluginLauncherDeclarationSchema = z22.object({
1876
- id: z22.string().min(1),
1877
- displayName: z22.string().min(1),
1878
- description: z22.string().optional(),
1879
- placementZone: z22.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
1880
- exportName: z22.string().min(1).optional(),
1881
- entityTypes: z22.array(z22.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
1882
- order: z22.number().int().optional(),
1996
+ pluginLauncherDeclarationSchema = z23.object({
1997
+ id: z23.string().min(1),
1998
+ displayName: z23.string().min(1),
1999
+ description: z23.string().optional(),
2000
+ placementZone: z23.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
2001
+ exportName: z23.string().min(1).optional(),
2002
+ entityTypes: z23.array(z23.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
2003
+ order: z23.number().int().optional(),
1883
2004
  action: pluginLauncherActionDeclarationSchema,
1884
2005
  render: pluginLauncherRenderDeclarationSchema.optional()
1885
2006
  }).superRefine((value, ctx) => {
1886
2007
  if (entityScopedLauncherPlacementZones.some((zone) => zone === value.placementZone) && (!value.entityTypes || value.entityTypes.length === 0)) {
1887
2008
  ctx.addIssue({
1888
- code: z22.ZodIssueCode.custom,
2009
+ code: z23.ZodIssueCode.custom,
1889
2010
  message: `${value.placementZone} launchers require at least one entityType`,
1890
2011
  path: ["entityTypes"]
1891
2012
  });
1892
2013
  }
1893
2014
  if (value.placementZone === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
1894
2015
  ctx.addIssue({
1895
- code: z22.ZodIssueCode.custom,
2016
+ code: z23.ZodIssueCode.custom,
1896
2017
  message: 'projectSidebarItem launchers require entityTypes to include "project"',
1897
2018
  path: ["entityTypes"]
1898
2019
  });
1899
2020
  }
1900
2021
  if (value.action.type === "performAction" && value.render) {
1901
2022
  ctx.addIssue({
1902
- code: z22.ZodIssueCode.custom,
2023
+ code: z23.ZodIssueCode.custom,
1903
2024
  message: "performAction launchers cannot declare render hints",
1904
2025
  path: ["render"]
1905
2026
  });
1906
2027
  }
1907
2028
  if (["openModal", "openDrawer", "openPopover"].includes(value.action.type) && !value.render) {
1908
2029
  ctx.addIssue({
1909
- code: z22.ZodIssueCode.custom,
2030
+ code: z23.ZodIssueCode.custom,
1910
2031
  message: `${value.action.type} launchers require render metadata`,
1911
2032
  path: ["render"]
1912
2033
  });
1913
2034
  }
1914
2035
  if (value.action.type === "openModal" && value.render?.environment === "hostInline") {
1915
2036
  ctx.addIssue({
1916
- code: z22.ZodIssueCode.custom,
2037
+ code: z23.ZodIssueCode.custom,
1917
2038
  message: "openModal launchers cannot use the hostInline render environment",
1918
2039
  path: ["render", "environment"]
1919
2040
  });
1920
2041
  }
1921
2042
  if (value.action.type === "openDrawer" && value.render && !["hostOverlay", "iframe"].includes(value.render.environment)) {
1922
2043
  ctx.addIssue({
1923
- code: z22.ZodIssueCode.custom,
2044
+ code: z23.ZodIssueCode.custom,
1924
2045
  message: "openDrawer launchers must use hostOverlay or iframe render environments",
1925
2046
  path: ["render", "environment"]
1926
2047
  });
1927
2048
  }
1928
2049
  if (value.action.type === "openPopover" && value.render?.environment === "hostRoute") {
1929
2050
  ctx.addIssue({
1930
- code: z22.ZodIssueCode.custom,
2051
+ code: z23.ZodIssueCode.custom,
1931
2052
  message: "openPopover launchers cannot use the hostRoute render environment",
1932
2053
  path: ["render", "environment"]
1933
2054
  });
1934
2055
  }
1935
2056
  });
1936
- pluginManifestV1Schema = z22.object({
1937
- id: z22.string().min(1).regex(
2057
+ pluginManifestV1Schema = z23.object({
2058
+ id: z23.string().min(1).regex(
1938
2059
  /^[a-z0-9][a-z0-9._-]*$/,
1939
2060
  "Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"
1940
2061
  ),
1941
- apiVersion: z22.literal(1),
1942
- version: z22.string().min(1).regex(
2062
+ apiVersion: z23.literal(1),
2063
+ version: z23.string().min(1).regex(
1943
2064
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
1944
2065
  "Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"
1945
2066
  ),
1946
- displayName: z22.string().min(1).max(100),
1947
- description: z22.string().min(1).max(500),
1948
- author: z22.string().min(1).max(200),
1949
- categories: z22.array(z22.enum(PLUGIN_CATEGORIES)).min(1),
1950
- minimumHostVersion: z22.string().regex(
2067
+ displayName: z23.string().min(1).max(100),
2068
+ description: z23.string().min(1).max(500),
2069
+ author: z23.string().min(1).max(200),
2070
+ categories: z23.array(z23.enum(PLUGIN_CATEGORIES)).min(1),
2071
+ minimumHostVersion: z23.string().regex(
1951
2072
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
1952
2073
  "minimumHostVersion must follow semver (e.g. 1.0.0)"
1953
2074
  ).optional(),
1954
- minimumPaperclipVersion: z22.string().regex(
2075
+ minimumPaperclipVersion: z23.string().regex(
1955
2076
  /^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
1956
2077
  "minimumPaperclipVersion must follow semver (e.g. 1.0.0)"
1957
2078
  ).optional(),
1958
- capabilities: z22.array(z22.enum(PLUGIN_CAPABILITIES)).min(1),
1959
- entrypoints: z22.object({
1960
- worker: z22.string().min(1),
1961
- ui: z22.string().min(1).optional()
2079
+ capabilities: z23.array(z23.enum(PLUGIN_CAPABILITIES)).min(1),
2080
+ entrypoints: z23.object({
2081
+ worker: z23.string().min(1),
2082
+ ui: z23.string().min(1).optional()
1962
2083
  }),
1963
2084
  instanceConfigSchema: jsonSchemaSchema.optional(),
1964
- jobs: z22.array(pluginJobDeclarationSchema).optional(),
1965
- webhooks: z22.array(pluginWebhookDeclarationSchema).optional(),
1966
- tools: z22.array(pluginToolDeclarationSchema).optional(),
1967
- launchers: z22.array(pluginLauncherDeclarationSchema).optional(),
1968
- ui: z22.object({
1969
- slots: z22.array(pluginUiSlotDeclarationSchema).min(1).optional(),
1970
- launchers: z22.array(pluginLauncherDeclarationSchema).optional()
2085
+ jobs: z23.array(pluginJobDeclarationSchema).optional(),
2086
+ webhooks: z23.array(pluginWebhookDeclarationSchema).optional(),
2087
+ tools: z23.array(pluginToolDeclarationSchema).optional(),
2088
+ launchers: z23.array(pluginLauncherDeclarationSchema).optional(),
2089
+ ui: z23.object({
2090
+ slots: z23.array(pluginUiSlotDeclarationSchema).min(1).optional(),
2091
+ launchers: z23.array(pluginLauncherDeclarationSchema).optional()
1971
2092
  }).optional()
1972
2093
  }).superRefine((manifest, ctx) => {
1973
2094
  const hasUiSlots = (manifest.ui?.slots?.length ?? 0) > 0;
1974
2095
  const hasUiLaunchers = (manifest.ui?.launchers?.length ?? 0) > 0;
1975
2096
  if ((hasUiSlots || hasUiLaunchers) && !manifest.entrypoints.ui) {
1976
2097
  ctx.addIssue({
1977
- code: z22.ZodIssueCode.custom,
2098
+ code: z23.ZodIssueCode.custom,
1978
2099
  message: "entrypoints.ui is required when ui.slots or ui.launchers are declared",
1979
2100
  path: ["entrypoints", "ui"]
1980
2101
  });
1981
2102
  }
1982
2103
  if (manifest.minimumHostVersion && manifest.minimumPaperclipVersion && manifest.minimumHostVersion !== manifest.minimumPaperclipVersion) {
1983
2104
  ctx.addIssue({
1984
- code: z22.ZodIssueCode.custom,
2105
+ code: z23.ZodIssueCode.custom,
1985
2106
  message: "minimumHostVersion and minimumPaperclipVersion must match when both are declared",
1986
2107
  path: ["minimumHostVersion"]
1987
2108
  });
@@ -1989,7 +2110,7 @@ var init_plugin = __esm({
1989
2110
  if (manifest.tools && manifest.tools.length > 0) {
1990
2111
  if (!manifest.capabilities.includes("agent.tools.register")) {
1991
2112
  ctx.addIssue({
1992
- code: z22.ZodIssueCode.custom,
2113
+ code: z23.ZodIssueCode.custom,
1993
2114
  message: "Capability 'agent.tools.register' is required when tools are declared",
1994
2115
  path: ["capabilities"]
1995
2116
  });
@@ -1998,7 +2119,7 @@ var init_plugin = __esm({
1998
2119
  if (manifest.jobs && manifest.jobs.length > 0) {
1999
2120
  if (!manifest.capabilities.includes("jobs.schedule")) {
2000
2121
  ctx.addIssue({
2001
- code: z22.ZodIssueCode.custom,
2122
+ code: z23.ZodIssueCode.custom,
2002
2123
  message: "Capability 'jobs.schedule' is required when jobs are declared",
2003
2124
  path: ["capabilities"]
2004
2125
  });
@@ -2007,7 +2128,7 @@ var init_plugin = __esm({
2007
2128
  if (manifest.webhooks && manifest.webhooks.length > 0) {
2008
2129
  if (!manifest.capabilities.includes("webhooks.receive")) {
2009
2130
  ctx.addIssue({
2010
- code: z22.ZodIssueCode.custom,
2131
+ code: z23.ZodIssueCode.custom,
2011
2132
  message: "Capability 'webhooks.receive' is required when webhooks are declared",
2012
2133
  path: ["capabilities"]
2013
2134
  });
@@ -2018,7 +2139,7 @@ var init_plugin = __esm({
2018
2139
  const duplicates = jobKeys.filter((key, i) => jobKeys.indexOf(key) !== i);
2019
2140
  if (duplicates.length > 0) {
2020
2141
  ctx.addIssue({
2021
- code: z22.ZodIssueCode.custom,
2142
+ code: z23.ZodIssueCode.custom,
2022
2143
  message: `Duplicate job keys: ${[...new Set(duplicates)].join(", ")}`,
2023
2144
  path: ["jobs"]
2024
2145
  });
@@ -2029,7 +2150,7 @@ var init_plugin = __esm({
2029
2150
  const duplicates = endpointKeys.filter((key, i) => endpointKeys.indexOf(key) !== i);
2030
2151
  if (duplicates.length > 0) {
2031
2152
  ctx.addIssue({
2032
- code: z22.ZodIssueCode.custom,
2153
+ code: z23.ZodIssueCode.custom,
2033
2154
  message: `Duplicate webhook endpoint keys: ${[...new Set(duplicates)].join(", ")}`,
2034
2155
  path: ["webhooks"]
2035
2156
  });
@@ -2040,7 +2161,7 @@ var init_plugin = __esm({
2040
2161
  const duplicates = toolNames.filter((name, i) => toolNames.indexOf(name) !== i);
2041
2162
  if (duplicates.length > 0) {
2042
2163
  ctx.addIssue({
2043
- code: z22.ZodIssueCode.custom,
2164
+ code: z23.ZodIssueCode.custom,
2044
2165
  message: `Duplicate tool names: ${[...new Set(duplicates)].join(", ")}`,
2045
2166
  path: ["tools"]
2046
2167
  });
@@ -2052,7 +2173,7 @@ var init_plugin = __esm({
2052
2173
  const duplicates = slotIds.filter((id, i) => slotIds.indexOf(id) !== i);
2053
2174
  if (duplicates.length > 0) {
2054
2175
  ctx.addIssue({
2055
- code: z22.ZodIssueCode.custom,
2176
+ code: z23.ZodIssueCode.custom,
2056
2177
  message: `Duplicate UI slot ids: ${[...new Set(duplicates)].join(", ")}`,
2057
2178
  path: ["ui", "slots"]
2058
2179
  });
@@ -2068,50 +2189,50 @@ var init_plugin = __esm({
2068
2189
  const duplicates = launcherIds.filter((id, i) => launcherIds.indexOf(id) !== i);
2069
2190
  if (duplicates.length > 0) {
2070
2191
  ctx.addIssue({
2071
- code: z22.ZodIssueCode.custom,
2192
+ code: z23.ZodIssueCode.custom,
2072
2193
  message: `Duplicate launcher ids: ${[...new Set(duplicates)].join(", ")}`,
2073
2194
  path: manifest.ui?.launchers ? ["ui", "launchers"] : ["launchers"]
2074
2195
  });
2075
2196
  }
2076
2197
  }
2077
2198
  });
2078
- installPluginSchema = z22.object({
2079
- packageName: z22.string().min(1),
2080
- version: z22.string().min(1).optional(),
2199
+ installPluginSchema = z23.object({
2200
+ packageName: z23.string().min(1),
2201
+ version: z23.string().min(1).optional(),
2081
2202
  /** Set by loader for local-path installs so the worker can be resolved. */
2082
- packagePath: z22.string().min(1).optional()
2203
+ packagePath: z23.string().min(1).optional()
2083
2204
  });
2084
- upsertPluginConfigSchema = z22.object({
2085
- configJson: z22.record(z22.unknown())
2205
+ upsertPluginConfigSchema = z23.object({
2206
+ configJson: z23.record(z23.unknown())
2086
2207
  });
2087
- patchPluginConfigSchema = z22.object({
2088
- configJson: z22.record(z22.unknown())
2208
+ patchPluginConfigSchema = z23.object({
2209
+ configJson: z23.record(z23.unknown())
2089
2210
  });
2090
- updatePluginStatusSchema = z22.object({
2091
- status: z22.enum(PLUGIN_STATUSES),
2092
- lastError: z22.string().nullable().optional()
2211
+ updatePluginStatusSchema = z23.object({
2212
+ status: z23.enum(PLUGIN_STATUSES),
2213
+ lastError: z23.string().nullable().optional()
2093
2214
  });
2094
- uninstallPluginSchema = z22.object({
2095
- removeData: z22.boolean().optional().default(false)
2215
+ uninstallPluginSchema = z23.object({
2216
+ removeData: z23.boolean().optional().default(false)
2096
2217
  });
2097
- pluginStateScopeKeySchema = z22.object({
2098
- scopeKind: z22.enum(PLUGIN_STATE_SCOPE_KINDS),
2099
- scopeId: z22.string().min(1).optional(),
2100
- namespace: z22.string().min(1).optional(),
2101
- stateKey: z22.string().min(1)
2218
+ pluginStateScopeKeySchema = z23.object({
2219
+ scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS),
2220
+ scopeId: z23.string().min(1).optional(),
2221
+ namespace: z23.string().min(1).optional(),
2222
+ stateKey: z23.string().min(1)
2102
2223
  });
2103
- setPluginStateSchema = z22.object({
2104
- scopeKind: z22.enum(PLUGIN_STATE_SCOPE_KINDS),
2105
- scopeId: z22.string().min(1).optional(),
2106
- namespace: z22.string().min(1).optional(),
2107
- stateKey: z22.string().min(1),
2224
+ setPluginStateSchema = z23.object({
2225
+ scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS),
2226
+ scopeId: z23.string().min(1).optional(),
2227
+ namespace: z23.string().min(1).optional(),
2228
+ stateKey: z23.string().min(1),
2108
2229
  /** JSON-serializable value to store. */
2109
- value: z22.unknown()
2230
+ value: z23.unknown()
2110
2231
  });
2111
- listPluginStateSchema = z22.object({
2112
- scopeKind: z22.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
2113
- scopeId: z22.string().min(1).optional(),
2114
- namespace: z22.string().min(1).optional()
2232
+ listPluginStateSchema = z23.object({
2233
+ scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
2234
+ scopeId: z23.string().min(1).optional(),
2235
+ namespace: z23.string().min(1).optional()
2115
2236
  });
2116
2237
  }
2117
2238
  });
@@ -2215,39 +2336,42 @@ var init_organization_skill_reference = __esm({
2215
2336
  });
2216
2337
 
2217
2338
  // ../packages/shared/src/project-mentions.ts
2339
+ var PROJECT_COLOR_VALUES;
2218
2340
  var init_project_mentions = __esm({
2219
2341
  "../packages/shared/src/project-mentions.ts"() {
2220
2342
  "use strict";
2343
+ init_constants();
2344
+ PROJECT_COLOR_VALUES = new Set(PROJECT_COLORS);
2221
2345
  }
2222
2346
  });
2223
2347
 
2224
2348
  // ../packages/shared/src/config-schema.ts
2225
- import { z as z23 } from "zod";
2349
+ import { z as z24 } from "zod";
2226
2350
  var configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
2227
2351
  var init_config_schema = __esm({
2228
2352
  "../packages/shared/src/config-schema.ts"() {
2229
2353
  "use strict";
2230
2354
  init_constants();
2231
- configMetaSchema = z23.object({
2232
- version: z23.literal(1),
2233
- updatedAt: z23.string(),
2234
- source: z23.enum(["onboard", "configure", "doctor"])
2355
+ configMetaSchema = z24.object({
2356
+ version: z24.literal(1),
2357
+ updatedAt: z24.string(),
2358
+ source: z24.enum(["onboard", "configure", "doctor"])
2235
2359
  });
2236
- llmConfigSchema = z23.object({
2237
- provider: z23.enum(["claude", "openai"]),
2238
- apiKey: z23.string().optional()
2360
+ llmConfigSchema = z24.object({
2361
+ provider: z24.enum(["claude", "openai"]),
2362
+ apiKey: z24.string().optional()
2239
2363
  });
2240
- databaseBackupConfigSchema = z23.object({
2241
- enabled: z23.boolean().default(true),
2242
- intervalMinutes: z23.number().int().min(1).max(7 * 24 * 60).default(60),
2243
- retentionDays: z23.number().int().min(1).max(3650).default(30),
2244
- dir: z23.string().default("~/.rudder/instances/default/data/backups")
2364
+ databaseBackupConfigSchema = z24.object({
2365
+ enabled: z24.boolean().default(true),
2366
+ intervalMinutes: z24.number().int().min(1).max(7 * 24 * 60).default(60),
2367
+ retentionDays: z24.number().int().min(1).max(3650).default(30),
2368
+ dir: z24.string().default("~/.rudder/instances/default/data/backups")
2245
2369
  });
2246
- databaseConfigSchema = z23.object({
2247
- mode: z23.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
2248
- connectionString: z23.string().optional(),
2249
- embeddedPostgresDataDir: z23.string().default("~/.rudder/instances/default/db"),
2250
- embeddedPostgresPort: z23.number().int().min(1).max(65535).default(54329),
2370
+ databaseConfigSchema = z24.object({
2371
+ mode: z24.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
2372
+ connectionString: z24.string().optional(),
2373
+ embeddedPostgresDataDir: z24.string().default("~/.rudder/instances/default/db"),
2374
+ embeddedPostgresPort: z24.number().int().min(1).max(65535).default(54329),
2251
2375
  backup: databaseBackupConfigSchema.default({
2252
2376
  enabled: true,
2253
2377
  intervalMinutes: 60,
@@ -2255,35 +2379,35 @@ var init_config_schema = __esm({
2255
2379
  dir: "~/.rudder/instances/default/data/backups"
2256
2380
  })
2257
2381
  });
2258
- loggingConfigSchema = z23.object({
2259
- mode: z23.enum(["file", "cloud"]),
2260
- logDir: z23.string().default("~/.rudder/instances/default/logs")
2382
+ loggingConfigSchema = z24.object({
2383
+ mode: z24.enum(["file", "cloud"]),
2384
+ logDir: z24.string().default("~/.rudder/instances/default/logs")
2261
2385
  });
2262
- serverConfigSchema = z23.object({
2263
- deploymentMode: z23.enum(DEPLOYMENT_MODES).default("local_trusted"),
2264
- exposure: z23.enum(DEPLOYMENT_EXPOSURES).default("private"),
2265
- host: z23.string().default("127.0.0.1"),
2266
- port: z23.number().int().min(1).max(65535).default(3100),
2267
- allowedHostnames: z23.array(z23.string().min(1)).default([]),
2268
- serveUi: z23.boolean().default(true)
2386
+ serverConfigSchema = z24.object({
2387
+ deploymentMode: z24.enum(DEPLOYMENT_MODES).default("local_trusted"),
2388
+ exposure: z24.enum(DEPLOYMENT_EXPOSURES).default("private"),
2389
+ host: z24.string().default("127.0.0.1"),
2390
+ port: z24.number().int().min(1).max(65535).default(3100),
2391
+ allowedHostnames: z24.array(z24.string().min(1)).default([]),
2392
+ serveUi: z24.boolean().default(true)
2269
2393
  });
2270
- authConfigSchema = z23.object({
2271
- baseUrlMode: z23.enum(AUTH_BASE_URL_MODES).default("auto"),
2272
- publicBaseUrl: z23.string().url().optional(),
2273
- disableSignUp: z23.boolean().default(false)
2394
+ authConfigSchema = z24.object({
2395
+ baseUrlMode: z24.enum(AUTH_BASE_URL_MODES).default("auto"),
2396
+ publicBaseUrl: z24.string().url().optional(),
2397
+ disableSignUp: z24.boolean().default(false)
2274
2398
  });
2275
- storageLocalDiskConfigSchema = z23.object({
2276
- baseDir: z23.string().default("~/.rudder/instances/default/data/storage")
2399
+ storageLocalDiskConfigSchema = z24.object({
2400
+ baseDir: z24.string().default("~/.rudder/instances/default/data/storage")
2277
2401
  });
2278
- storageS3ConfigSchema = z23.object({
2279
- bucket: z23.string().min(1).default("rudder"),
2280
- region: z23.string().min(1).default("us-east-1"),
2281
- endpoint: z23.string().optional(),
2282
- prefix: z23.string().default(""),
2283
- forcePathStyle: z23.boolean().default(false)
2402
+ storageS3ConfigSchema = z24.object({
2403
+ bucket: z24.string().min(1).default("rudder"),
2404
+ region: z24.string().min(1).default("us-east-1"),
2405
+ endpoint: z24.string().optional(),
2406
+ prefix: z24.string().default(""),
2407
+ forcePathStyle: z24.boolean().default(false)
2284
2408
  });
2285
- storageConfigSchema = z23.object({
2286
- provider: z23.enum(STORAGE_PROVIDERS).default("local_disk"),
2409
+ storageConfigSchema = z24.object({
2410
+ provider: z24.enum(STORAGE_PROVIDERS).default("local_disk"),
2287
2411
  localDisk: storageLocalDiskConfigSchema.default({
2288
2412
  baseDir: "~/.rudder/instances/default/data/storage"
2289
2413
  }),
@@ -2294,24 +2418,24 @@ var init_config_schema = __esm({
2294
2418
  forcePathStyle: false
2295
2419
  })
2296
2420
  });
2297
- secretsLocalEncryptedConfigSchema = z23.object({
2298
- keyFilePath: z23.string().default("~/.rudder/instances/default/secrets/master.key")
2421
+ secretsLocalEncryptedConfigSchema = z24.object({
2422
+ keyFilePath: z24.string().default("~/.rudder/instances/default/secrets/master.key")
2299
2423
  });
2300
- secretsConfigSchema = z23.object({
2301
- provider: z23.enum(SECRET_PROVIDERS).default("local_encrypted"),
2302
- strictMode: z23.boolean().default(false),
2424
+ secretsConfigSchema = z24.object({
2425
+ provider: z24.enum(SECRET_PROVIDERS).default("local_encrypted"),
2426
+ strictMode: z24.boolean().default(false),
2303
2427
  localEncrypted: secretsLocalEncryptedConfigSchema.default({
2304
2428
  keyFilePath: "~/.rudder/instances/default/secrets/master.key"
2305
2429
  })
2306
2430
  });
2307
- langfuseConfigSchema = z23.object({
2308
- enabled: z23.boolean().default(false),
2309
- baseUrl: z23.string().url().default("http://localhost:3000"),
2310
- publicKey: z23.string().optional(),
2311
- secretKey: z23.string().optional(),
2312
- environment: z23.string().optional()
2431
+ langfuseConfigSchema = z24.object({
2432
+ enabled: z24.boolean().default(false),
2433
+ baseUrl: z24.string().url().default("http://localhost:3000"),
2434
+ publicKey: z24.string().optional(),
2435
+ secretKey: z24.string().optional(),
2436
+ environment: z24.string().optional()
2313
2437
  });
2314
- rudderConfigSchema = z23.object({
2438
+ rudderConfigSchema = z24.object({
2315
2439
  $meta: configMetaSchema,
2316
2440
  llm: llmConfigSchema.optional(),
2317
2441
  database: databaseConfigSchema,
@@ -2345,7 +2469,7 @@ var init_config_schema = __esm({
2345
2469
  if (value.server.deploymentMode === "local_trusted") {
2346
2470
  if (value.server.exposure !== "private") {
2347
2471
  ctx.addIssue({
2348
- code: z23.ZodIssueCode.custom,
2472
+ code: z24.ZodIssueCode.custom,
2349
2473
  message: "server.exposure must be private when deploymentMode is local_trusted",
2350
2474
  path: ["server", "exposure"]
2351
2475
  });
@@ -2354,21 +2478,21 @@ var init_config_schema = __esm({
2354
2478
  }
2355
2479
  if (value.auth.baseUrlMode === "explicit" && !value.auth.publicBaseUrl) {
2356
2480
  ctx.addIssue({
2357
- code: z23.ZodIssueCode.custom,
2481
+ code: z24.ZodIssueCode.custom,
2358
2482
  message: "auth.publicBaseUrl is required when auth.baseUrlMode is explicit",
2359
2483
  path: ["auth", "publicBaseUrl"]
2360
2484
  });
2361
2485
  }
2362
2486
  if (value.server.exposure === "public" && value.auth.baseUrlMode !== "explicit") {
2363
2487
  ctx.addIssue({
2364
- code: z23.ZodIssueCode.custom,
2488
+ code: z24.ZodIssueCode.custom,
2365
2489
  message: "auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",
2366
2490
  path: ["auth", "baseUrlMode"]
2367
2491
  });
2368
2492
  }
2369
2493
  if (value.server.exposure === "public" && !value.auth.publicBaseUrl) {
2370
2494
  ctx.addIssue({
2371
- code: z23.ZodIssueCode.custom,
2495
+ code: z24.ZodIssueCode.custom,
2372
2496
  message: "auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",
2373
2497
  path: ["auth", "publicBaseUrl"]
2374
2498
  });
@@ -3619,7 +3743,6 @@ var init_instance_settings = __esm({
3619
3743
  singletonKey: text11("singleton_key").notNull().default("default"),
3620
3744
  general: jsonb4("general").$type().notNull().default({}),
3621
3745
  notifications: jsonb4("notifications").$type().notNull().default({}),
3622
- experimental: jsonb4("experimental").$type().notNull().default({}),
3623
3746
  createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow(),
3624
3747
  updatedAt: timestamp7("updated_at", { withTimezone: true }).notNull().defaultNow()
3625
3748
  },
@@ -7866,6 +7989,9 @@ function isTransientBinaryPath(candidatePath) {
7866
7989
  return normalized.includes("/_npx/");
7867
7990
  }
7868
7991
  function hasGlobalInstalledPackage(packageName, execFileSyncImpl = execFileSync) {
7992
+ return getGlobalInstalledPackageVersion(packageName, execFileSyncImpl) !== null;
7993
+ }
7994
+ function getGlobalInstalledPackageVersion(packageName, execFileSyncImpl = execFileSync) {
7869
7995
  try {
7870
7996
  const output = execFileSyncImpl(
7871
7997
  process.platform === "win32" ? "npm.cmd" : "npm",
@@ -7876,9 +8002,9 @@ function hasGlobalInstalledPackage(packageName, execFileSyncImpl = execFileSync)
7876
8002
  }
7877
8003
  );
7878
8004
  const parsed = JSON.parse(output);
7879
- return Boolean(parsed.dependencies?.[packageName]?.version);
8005
+ return parsed.dependencies?.[packageName]?.version ?? null;
7880
8006
  } catch {
7881
- return false;
8007
+ return null;
7882
8008
  }
7883
8009
  }
7884
8010
  function hasPersistentBinaryOnPath(execFileSyncImpl = execFileSync) {
@@ -7918,16 +8044,36 @@ function detectPersistentCliState(options = {}) {
7918
8044
  function installPersistentCli(options) {
7919
8045
  const spawnSyncImpl = options.spawnSyncImpl ?? spawnSync;
7920
8046
  const command = `npm install --global ${options.installSpec}`;
7921
- const result = spawnSyncImpl(process.platform === "win32" ? "npm.cmd" : "npm", ["install", "--global", options.installSpec], {
8047
+ const initialResult = runNpmGlobalInstall(spawnSyncImpl, ["install", "--global", options.installSpec]);
8048
+ const initialOutput = collectSpawnOutput(initialResult);
8049
+ if (initialResult.status === 0 || !isRudderBinConflict(initialOutput)) {
8050
+ return {
8051
+ ok: initialResult.status === 0,
8052
+ command,
8053
+ output: initialOutput
8054
+ };
8055
+ }
8056
+ const forcedCommand = `npm install --global --force ${options.installSpec}`;
8057
+ const forcedResult = runNpmGlobalInstall(spawnSyncImpl, ["install", "--global", "--force", options.installSpec]);
8058
+ const forcedOutput = collectSpawnOutput(forcedResult);
8059
+ return {
8060
+ ok: forcedResult.status === 0,
8061
+ command: forcedCommand,
8062
+ output: forcedOutput || initialOutput
8063
+ };
8064
+ }
8065
+ function runNpmGlobalInstall(spawnSyncImpl, args) {
8066
+ return spawnSyncImpl(process.platform === "win32" ? "npm.cmd" : "npm", args, {
7922
8067
  encoding: "utf8",
7923
8068
  stdio: ["inherit", "pipe", "pipe"]
7924
8069
  });
7925
- const output = [result.stdout, result.stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
7926
- return {
7927
- ok: result.status === 0,
7928
- command,
7929
- output
7930
- };
8070
+ }
8071
+ function collectSpawnOutput(result) {
8072
+ return [result.stdout, result.stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
8073
+ }
8074
+ function isRudderBinConflict(output) {
8075
+ const normalized = output.toLowerCase().replaceAll("\\", "/");
8076
+ return normalized.includes("eexist") && (normalized.includes(`/${CLI_BIN_NAME}`) || normalized.includes(`/${CLI_BIN_NAME}.cmd`) || normalized.includes(`/${CLI_BIN_NAME}.ps1`));
7931
8077
  }
7932
8078
  var CLI_NPM_PACKAGE_NAME, CLI_BIN_NAME;
7933
8079
  var init_install = __esm({
@@ -9878,44 +10024,179 @@ ${err instanceof Error ? err.message : String(err)}`
9878
10024
 
9879
10025
  // src/commands/start.ts
9880
10026
  init_install();
9881
- import { spawnSync as spawnSync2 } from "node:child_process";
10027
+ import { spawn, spawnSync as spawnSync2 } from "node:child_process";
9882
10028
  import { createHash as createHash3 } from "node:crypto";
9883
- import { createWriteStream, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync } from "node:fs";
9884
- import { chmod, mkdtemp } from "node:fs/promises";
9885
- import { tmpdir } from "node:os";
9886
- import path9 from "node:path";
9887
- import { Readable } from "node:stream";
10029
+ import { constants as fsConstants, createWriteStream, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
10030
+ import { access, chmod, copyFile, cp, mkdtemp, mkdir, readFile as readFile3, readdir as readdir2, rm, writeFile as writeFile2 } from "node:fs/promises";
10031
+ import { homedir, tmpdir } from "node:os";
10032
+ import path10 from "node:path";
10033
+ import { Readable, Transform } from "node:stream";
9888
10034
  import { pipeline } from "node:stream/promises";
9889
- import { fileURLToPath as fileURLToPath3 } from "node:url";
10035
+ import { setTimeout as delay } from "node:timers/promises";
9890
10036
  import * as p13 from "@clack/prompts";
9891
10037
  import pc8 from "picocolors";
9892
- var DEFAULT_DESKTOP_RELEASE_REPO = "Undertone0809/rudder";
9893
- var STABLE_SEMVER_RE = /^[0-9]+\.[0-9]+\.[0-9]+$/;
9894
- var CANARY_SEMVER_RE = /^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9]+$/;
9895
- var CLI_REGISTRY_LATEST_URL = "https://registry.npmjs.org/@rudderhq%2fcli/latest";
9896
- function resolveCurrentCliVersion(env = process.env) {
9897
- const envPackageName = env.npm_package_name?.trim();
9898
- const envPackageVersion = env.npm_package_version?.trim();
9899
- if (envPackageName === CLI_NPM_PACKAGE_NAME && envPackageVersion) return envPackageVersion;
9900
- const moduleDir = path9.dirname(fileURLToPath3(import.meta.url));
10038
+
10039
+ // src/utils/progress.ts
10040
+ var BYTE_UNITS = ["B", "KB", "MB", "GB", "TB"];
10041
+ function formatBytes(bytes) {
10042
+ let value = Math.max(0, bytes);
10043
+ let unitIndex = 0;
10044
+ while (value >= 1024 && unitIndex < BYTE_UNITS.length - 1) {
10045
+ value /= 1024;
10046
+ unitIndex += 1;
10047
+ }
10048
+ if (unitIndex === 0) return `${Math.round(value)} ${BYTE_UNITS[unitIndex]}`;
10049
+ return `${value.toFixed(1)} ${BYTE_UNITS[unitIndex]}`;
10050
+ }
10051
+ function normalizeTotalBytes(totalBytes) {
10052
+ if (typeof totalBytes !== "number" || !Number.isFinite(totalBytes) || totalBytes <= 0) {
10053
+ return null;
10054
+ }
10055
+ return totalBytes;
10056
+ }
10057
+ function formatByteProgress(state) {
10058
+ const width = Math.max(4, state.width ?? 20);
10059
+ const receivedBytes = Math.max(0, state.receivedBytes);
10060
+ const totalBytes = normalizeTotalBytes(state.totalBytes);
10061
+ if (totalBytes === null) {
10062
+ return `[downloaded ${formatBytes(receivedBytes)}]`;
10063
+ }
10064
+ const ratio = Math.max(0, Math.min(1, receivedBytes / totalBytes));
10065
+ const filled = Math.round(ratio * width);
10066
+ const percent = Math.floor(ratio * 100);
10067
+ return `[${"#".repeat(filled)}${"-".repeat(width - filled)}] ${percent}% ${formatBytes(receivedBytes)}/${formatBytes(totalBytes)}`;
10068
+ }
10069
+ function progressSummary(receivedBytes, totalBytes) {
10070
+ const total = normalizeTotalBytes(totalBytes);
10071
+ if (total === null) return formatBytes(receivedBytes);
10072
+ return `${formatBytes(receivedBytes)}/${formatBytes(total)}`;
10073
+ }
10074
+ function createByteProgress(label, options = {}) {
10075
+ const stream = options.stream ?? process.stdout;
10076
+ const isTty = options.isTty ?? Boolean(stream.isTTY);
10077
+ const width = options.width ?? 20;
10078
+ const minIntervalMs = options.minIntervalMs ?? 80;
10079
+ const now = options.now ?? (() => Date.now());
10080
+ let started = false;
10081
+ let finished = false;
10082
+ let lastRenderAt = 0;
10083
+ let lastLineLength = 0;
10084
+ let latestReceivedBytes = 0;
10085
+ let latestTotalBytes = null;
10086
+ function render(receivedBytes, totalBytes, force = false) {
10087
+ if (finished) return;
10088
+ latestReceivedBytes = receivedBytes;
10089
+ latestTotalBytes = totalBytes;
10090
+ if (!isTty) return;
10091
+ const currentTime = now();
10092
+ const total = normalizeTotalBytes(totalBytes);
10093
+ const complete = total !== null && receivedBytes >= total;
10094
+ if (!force && currentTime - lastRenderAt < minIntervalMs && !complete) return;
10095
+ const line = `${label} ${formatByteProgress({ receivedBytes, totalBytes, width })}`;
10096
+ const padding = lastLineLength > line.length ? " ".repeat(lastLineLength - line.length) : "";
10097
+ stream.write(`\r${line}${padding}`);
10098
+ lastLineLength = line.length;
10099
+ lastRenderAt = currentTime;
10100
+ }
10101
+ function start(totalBytes) {
10102
+ if (started || finished) return;
10103
+ started = true;
10104
+ latestTotalBytes = totalBytes;
10105
+ if (isTty) {
10106
+ render(0, totalBytes, true);
10107
+ } else {
10108
+ stream.write(`${label}...
10109
+ `);
10110
+ }
10111
+ }
10112
+ function update(receivedBytes, totalBytes) {
10113
+ if (!started) start(totalBytes);
10114
+ render(receivedBytes, totalBytes, false);
10115
+ }
10116
+ function finish(receivedBytes = latestReceivedBytes, totalBytes = latestTotalBytes) {
10117
+ if (finished) return;
10118
+ if (!started) start(totalBytes);
10119
+ if (isTty) {
10120
+ render(receivedBytes, totalBytes, true);
10121
+ stream.write("\n");
10122
+ } else {
10123
+ stream.write(`${label} complete (${progressSummary(receivedBytes, totalBytes)}).
10124
+ `);
10125
+ }
10126
+ finished = true;
10127
+ }
10128
+ function fail() {
10129
+ if (finished) return;
10130
+ if (isTty && started) {
10131
+ stream.write("\n");
10132
+ } else if (!isTty && started) {
10133
+ stream.write(`${label} failed.
10134
+ `);
10135
+ }
10136
+ finished = true;
10137
+ }
10138
+ return {
10139
+ start,
10140
+ update,
10141
+ finish,
10142
+ fail
10143
+ };
10144
+ }
10145
+
10146
+ // src/version.ts
10147
+ import { existsSync as existsSync2, readFileSync } from "node:fs";
10148
+ import path9 from "node:path";
10149
+ import { fileURLToPath as fileURLToPath3 } from "node:url";
10150
+ var CLI_PACKAGE_NAME = "@rudderhq/cli";
10151
+ var CLI_VERSION_MANIFEST = "rudder-cli-package.json";
10152
+ function readPackageVersion(packagePath, expectedName) {
10153
+ if (!existsSync2(packagePath)) return null;
10154
+ try {
10155
+ const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
10156
+ if (parsed.name === expectedName && parsed.version) return parsed.version;
10157
+ } catch {
10158
+ return null;
10159
+ }
10160
+ return null;
10161
+ }
10162
+ function resolveCliVersion(moduleUrl = import.meta.url, env = process.env) {
10163
+ if (env.npm_package_name === CLI_PACKAGE_NAME && env.npm_package_version) {
10164
+ return env.npm_package_version;
10165
+ }
10166
+ const moduleDir = path9.dirname(fileURLToPath3(moduleUrl));
9901
10167
  const candidates = [
10168
+ path9.resolve(moduleDir, CLI_VERSION_MANIFEST),
10169
+ path9.resolve(moduleDir, "package.json"),
9902
10170
  path9.resolve(moduleDir, "../package.json"),
9903
10171
  path9.resolve(moduleDir, "../../package.json")
9904
10172
  ];
9905
10173
  for (const candidate of candidates) {
9906
- if (!existsSync2(candidate)) continue;
9907
- try {
9908
- const parsed = JSON.parse(readFileSync(candidate, "utf8"));
9909
- if (parsed.name === CLI_NPM_PACKAGE_NAME && parsed.version) return parsed.version;
9910
- } catch {
9911
- }
10174
+ const version = readPackageVersion(candidate, CLI_PACKAGE_NAME);
10175
+ if (version) return version;
9912
10176
  }
9913
- return "latest";
10177
+ return "0.0.0";
10178
+ }
10179
+
10180
+ // src/commands/start.ts
10181
+ var DEFAULT_DESKTOP_RELEASE_REPO = "Undertone0809/rudder";
10182
+ var DESKTOP_UPDATE_QUIT_ARG = "--rudder-update-quit";
10183
+ var STABLE_SEMVER_RE = /^[0-9]+\.[0-9]+\.[0-9]+$/;
10184
+ var CANARY_SEMVER_RE = /^[0-9]+\.[0-9]+\.[0-9]+-canary\.[0-9]+$/;
10185
+ var CLI_REGISTRY_LATEST_URL = "https://registry.npmjs.org/@rudderhq%2fcli/latest";
10186
+ var DESKTOP_APP_NAME = "Rudder";
10187
+ var DESKTOP_METADATA_FILE = ".rudder-desktop-install.json";
10188
+ var DESKTOP_CHECKSUM_ASSET_NAME = "SHASUMS256.txt";
10189
+ function resolveCurrentCliVersion(env = process.env) {
10190
+ const version = resolveCliVersion(import.meta.url, env);
10191
+ return version === "0.0.0" ? "latest" : version;
9914
10192
  }
9915
10193
  function resolveCliInstallSpec(version, env = process.env) {
9916
10194
  if (version && version !== "latest") return `${CLI_NPM_PACKAGE_NAME}@${version}`;
9917
10195
  return resolvePersistentCliInstallSpec(env);
9918
10196
  }
10197
+ function isPersistentCliVersionCurrent(version, installedVersion) {
10198
+ return Boolean(version && version !== "latest" && installedVersion === version);
10199
+ }
9919
10200
  function compareStableSemver(a, b) {
9920
10201
  const aMatch = a.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
9921
10202
  const bMatch = b.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)$/);
@@ -9955,18 +10236,59 @@ function resolveDesktopReleaseTag(version) {
9955
10236
  if (STABLE_SEMVER_RE.test(version)) return `v${version}`;
9956
10237
  if (CANARY_SEMVER_RE.test(version)) return `canary/v${version}`;
9957
10238
  throw new Error(
9958
- `Desktop installer lookup requires a release version like 0.1.0 or 0.1.0-canary.0. Received ${version}.`
10239
+ `Desktop release lookup requires a release version like 0.1.0 or 0.1.0-canary.0. Received ${version}.`
9959
10240
  );
9960
10241
  }
9961
10242
  function resolveDesktopAssetTarget(platform = process.platform, arch = process.arch) {
9962
- const normalizedArch = arch === "x64" || arch === "arm64" ? arch : null;
9963
- if (!normalizedArch) {
9964
- throw new Error(`Rudder Desktop does not publish installers for ${platform}/${arch}.`);
10243
+ if (platform === "darwin") {
10244
+ if (arch !== "x64" && arch !== "arm64") {
10245
+ throw new Error(`Rudder Desktop does not publish portable assets for ${platform}/${arch}.`);
10246
+ }
10247
+ return { platform: "macos", arch, extension: ".zip" };
9965
10248
  }
9966
- if (platform === "darwin") return { platform: "macos", arch: normalizedArch, extension: ".dmg" };
9967
- if (platform === "win32") return { platform: "windows", arch: normalizedArch, extension: ".exe" };
9968
- if (platform === "linux") return { platform: "linux", arch: normalizedArch, extension: ".AppImage" };
9969
- throw new Error(`Rudder Desktop does not publish installers for ${platform}.`);
10249
+ if (platform === "win32") return { platform: "windows", arch: "x64", extension: ".zip" };
10250
+ if (platform === "linux") {
10251
+ if (arch !== "x64") {
10252
+ throw new Error(`Rudder Desktop does not publish portable assets for ${platform}/${arch}.`);
10253
+ }
10254
+ return { platform: "linux", arch: "x64", extension: ".AppImage" };
10255
+ }
10256
+ throw new Error(`Rudder Desktop does not publish portable assets for ${platform}.`);
10257
+ }
10258
+ function resolveDefaultDesktopInstallRoot(target, env = process.env, homeDir = homedir()) {
10259
+ if (target.platform === "macos") return path10.join(homeDir, "Applications");
10260
+ if (target.platform === "windows") {
10261
+ const localAppData = env.LOCALAPPDATA?.trim() || path10.join(homeDir, "AppData", "Local");
10262
+ return path10.join(localAppData, "Programs", DESKTOP_APP_NAME);
10263
+ }
10264
+ return path10.join(homeDir, ".local", "share", "rudder");
10265
+ }
10266
+ function resolveDesktopInstallPaths(target, installRoot) {
10267
+ const root = path10.resolve(installRoot);
10268
+ if (target.platform === "macos") {
10269
+ const appPath2 = path10.join(root, `${DESKTOP_APP_NAME}.app`);
10270
+ return {
10271
+ installRoot: root,
10272
+ appPath: appPath2,
10273
+ executablePath: path10.join(appPath2, "Contents", "MacOS", DESKTOP_APP_NAME),
10274
+ metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
10275
+ };
10276
+ }
10277
+ if (target.platform === "windows") {
10278
+ return {
10279
+ installRoot: root,
10280
+ appPath: root,
10281
+ executablePath: path10.join(root, `${DESKTOP_APP_NAME}.exe`),
10282
+ metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
10283
+ };
10284
+ }
10285
+ const appPath = path10.join(root, `${DESKTOP_APP_NAME}.AppImage`);
10286
+ return {
10287
+ installRoot: root,
10288
+ appPath,
10289
+ executablePath: appPath,
10290
+ metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
10291
+ };
9970
10292
  }
9971
10293
  function normalizeAssetName(name) {
9972
10294
  return name.toLowerCase().replaceAll("_", "-").replaceAll(" ", "-");
@@ -9979,6 +10301,7 @@ function scoreDesktopAsset(asset, target) {
9979
10301
  let score = 1;
9980
10302
  if (normalized.includes("rudder")) score += 2;
9981
10303
  if (normalized.includes(target.platform)) score += 4;
10304
+ if (normalized.includes("portable")) score += 6;
9982
10305
  if (target.platform === "macos" && (normalized.includes("macos") || normalized.includes("darwin") || normalized.includes("mac-"))) {
9983
10306
  score += 4;
9984
10307
  }
@@ -10002,7 +10325,7 @@ function selectDesktopAsset(assets2, target) {
10002
10325
  return exactArch?.asset ?? best.asset;
10003
10326
  }
10004
10327
  function selectChecksumAsset(assets2) {
10005
- return assets2.find((asset) => /^SHASUMS256\.txt$/i.test(asset.name)) ?? null;
10328
+ return assets2.find((asset) => asset.name.toLowerCase() === DESKTOP_CHECKSUM_ASSET_NAME.toLowerCase()) ?? null;
10006
10329
  }
10007
10330
  function githubApiHeaders() {
10008
10331
  return {
@@ -10018,21 +10341,70 @@ async function fetchGithubRelease(repo, tag) {
10018
10341
  }
10019
10342
  return await response.json();
10020
10343
  }
10021
- async function downloadAsset(asset, outputDir) {
10344
+ function resolveDesktopReleaseVersion(tag) {
10345
+ if (!tag || tag === "latest") return null;
10346
+ const name = tag.split("/").pop() ?? tag;
10347
+ if (!name.startsWith("v")) return null;
10348
+ const version = name.slice(1);
10349
+ if (STABLE_SEMVER_RE.test(version) || CANARY_SEMVER_RE.test(version)) return version;
10350
+ return null;
10351
+ }
10352
+ function resolveDesktopAssetName(version, target) {
10353
+ if (target.platform === "macos") return `${DESKTOP_APP_NAME}-${version}-macos-${target.arch}-portable.zip`;
10354
+ if (target.platform === "windows") return `${DESKTOP_APP_NAME}-${version}-windows-x64-portable.zip`;
10355
+ return `${DESKTOP_APP_NAME}-${version}-linux-x64.AppImage`;
10356
+ }
10357
+ function encodeReleaseTagForDownloadUrl(tag) {
10358
+ return tag.split("/").map((segment) => encodeURIComponent(segment)).join("/");
10359
+ }
10360
+ function buildGithubReleaseAssetDownloadUrl(repo, tag, assetName) {
10361
+ const encodedTag = encodeReleaseTagForDownloadUrl(tag);
10362
+ return `https://github.com/${repo}/releases/download/${encodedTag}/${encodeURIComponent(assetName)}`;
10363
+ }
10364
+ function buildGithubReleaseAsset(repo, tag, assetName) {
10365
+ return {
10366
+ name: assetName,
10367
+ browser_download_url: buildGithubReleaseAssetDownloadUrl(repo, tag, assetName)
10368
+ };
10369
+ }
10370
+ function contentLengthFromHeaders(headers) {
10371
+ const raw = headers.get("content-length");
10372
+ if (!raw) return null;
10373
+ const value = Number(raw);
10374
+ return Number.isFinite(value) && value > 0 ? value : null;
10375
+ }
10376
+ async function downloadAsset(asset, outputDir, progressFactory = createByteProgress) {
10022
10377
  mkdirSync2(outputDir, { recursive: true });
10023
- const outputPath = path9.join(outputDir, path9.basename(asset.name));
10378
+ const outputPath = path10.join(outputDir, path10.basename(asset.name));
10024
10379
  const response = await fetch(asset.browser_download_url, {
10025
10380
  headers: { "User-Agent": "rudder-cli-installer" }
10026
10381
  });
10027
10382
  if (!response.ok || !response.body) {
10028
- throw new Error(`Failed to download ${asset.name} (${response.status}).`);
10383
+ throw new Error(`Failed to download ${asset.name} from ${asset.browser_download_url} (${response.status}).`);
10384
+ }
10385
+ const totalBytes = contentLengthFromHeaders(response.headers);
10386
+ const progress = progressFactory(`Downloading ${asset.name}`);
10387
+ let receivedBytes = 0;
10388
+ const monitor = new Transform({
10389
+ transform(chunk, _encoding, callback) {
10390
+ receivedBytes += typeof chunk === "string" ? Buffer.byteLength(chunk) : chunk.length;
10391
+ progress.update(receivedBytes, totalBytes);
10392
+ callback(null, chunk);
10393
+ }
10394
+ });
10395
+ progress.start(totalBytes);
10396
+ try {
10397
+ await pipeline(Readable.fromWeb(response.body), monitor, createWriteStream(outputPath));
10398
+ progress.finish(receivedBytes, totalBytes);
10399
+ } catch (error) {
10400
+ progress.fail();
10401
+ throw error;
10029
10402
  }
10030
- await pipeline(Readable.fromWeb(response.body), createWriteStream(outputPath));
10031
10403
  return outputPath;
10032
10404
  }
10033
10405
  function checksumForFile(filePath) {
10034
10406
  const hash = createHash3("sha256");
10035
- hash.update(readFileSync(filePath));
10407
+ hash.update(readFileSync2(filePath));
10036
10408
  return hash.digest("hex");
10037
10409
  }
10038
10410
  function parseChecksumFile(contents) {
@@ -10044,28 +10416,299 @@ function parseChecksumFile(contents) {
10044
10416
  }
10045
10417
  return checksums;
10046
10418
  }
10047
- async function verifyChecksum(installerPath, checksumAsset, outputDir) {
10048
- if (!checksumAsset) return false;
10049
- const checksumPath = await downloadAsset(checksumAsset, outputDir);
10050
- const checksums = parseChecksumFile(readFileSync(checksumPath, "utf8"));
10051
- const expected = checksums.get(path9.basename(installerPath));
10052
- if (!expected) return false;
10053
- const actual = checksumForFile(installerPath);
10054
- if (actual !== expected) {
10055
- throw new Error(`Checksum mismatch for ${path9.basename(installerPath)}.`);
10419
+ function resolveAssetChecksum(checksums, assetName) {
10420
+ const expected = checksums.get(path10.basename(assetName));
10421
+ if (!expected) {
10422
+ throw new Error(`Desktop release checksums do not include ${path10.basename(assetName)}.`);
10056
10423
  }
10057
- return true;
10424
+ return expected;
10425
+ }
10426
+ function assertChecksumMatch(filePath, expected) {
10427
+ const actual = checksumForFile(filePath);
10428
+ if (actual !== expected.toLowerCase()) {
10429
+ throw new Error(`Checksum mismatch for ${path10.basename(filePath)}.`);
10430
+ }
10431
+ return actual;
10432
+ }
10433
+ async function downloadChecksums(checksumAsset, outputDir, progressFactory = createByteProgress) {
10434
+ if (!checksumAsset) {
10435
+ throw new Error("Desktop release is missing SHASUMS256.txt.");
10436
+ }
10437
+ const checksumPath = await downloadAsset(checksumAsset, outputDir, progressFactory);
10438
+ return parseChecksumFile(readFileSync2(checksumPath, "utf8"));
10439
+ }
10440
+ async function pathExists(targetPath) {
10441
+ try {
10442
+ await access(targetPath, fsConstants.F_OK);
10443
+ return true;
10444
+ } catch {
10445
+ return false;
10446
+ }
10447
+ }
10448
+ function runChecked(command, args, options = {}) {
10449
+ const result = spawnSync2(command, args, {
10450
+ encoding: "utf8",
10451
+ stdio: ["ignore", "pipe", "pipe"],
10452
+ ...options
10453
+ });
10454
+ if (result.status === 0) return;
10455
+ const output = [result.stdout, result.stderr].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
10456
+ throw new Error(`${command} ${args.join(" ")} failed${output ? `: ${output}` : ""}`);
10457
+ }
10458
+ function powershellQuote(value) {
10459
+ return `'${value.replaceAll("'", "''")}'`;
10460
+ }
10461
+ async function extractZip(zipPath, outputDir, target) {
10462
+ await rm(outputDir, { recursive: true, force: true });
10463
+ await mkdir(outputDir, { recursive: true });
10464
+ if (target.platform === "macos") {
10465
+ runChecked("ditto", ["-x", "-k", zipPath, outputDir]);
10466
+ return;
10467
+ }
10468
+ if (target.platform === "windows") {
10469
+ runChecked("powershell.exe", [
10470
+ "-NoProfile",
10471
+ "-ExecutionPolicy",
10472
+ "Bypass",
10473
+ "-Command",
10474
+ `Expand-Archive -LiteralPath ${powershellQuote(zipPath)} -DestinationPath ${powershellQuote(outputDir)} -Force`
10475
+ ]);
10476
+ return;
10477
+ }
10478
+ throw new Error(`Zip assets are not supported for ${target.platform}.`);
10479
+ }
10480
+ async function findPath(root, predicate, maxDepth = 5) {
10481
+ async function visit(dir, depth) {
10482
+ const entries = await readdir2(dir, { withFileTypes: true });
10483
+ for (const entry of entries) {
10484
+ const fullPath = path10.join(dir, entry.name);
10485
+ if (predicate(fullPath, entry.isDirectory())) return fullPath;
10486
+ if (entry.isDirectory() && depth < maxDepth) {
10487
+ const nested = await visit(fullPath, depth + 1);
10488
+ if (nested) return nested;
10489
+ }
10490
+ }
10491
+ return null;
10492
+ }
10493
+ return await visit(root, 0);
10058
10494
  }
10059
- function openInstaller(installerPath, target) {
10495
+ async function findMacApp(extractDir) {
10496
+ const direct = path10.join(extractDir, `${DESKTOP_APP_NAME}.app`);
10497
+ if (await pathExists(direct)) return direct;
10498
+ const found = await findPath(extractDir, (filePath, isDirectory) => isDirectory && path10.basename(filePath) === `${DESKTOP_APP_NAME}.app`);
10499
+ if (!found) throw new Error(`Portable macOS archive did not contain ${DESKTOP_APP_NAME}.app.`);
10500
+ return found;
10501
+ }
10502
+ async function findWindowsAppDir(extractDir) {
10503
+ const direct = path10.join(extractDir, `${DESKTOP_APP_NAME}.exe`);
10504
+ if (await pathExists(direct)) return extractDir;
10505
+ const executable = await findPath(extractDir, (filePath, isDirectory) => !isDirectory && path10.basename(filePath).toLowerCase() === `${DESKTOP_APP_NAME.toLowerCase()}.exe`);
10506
+ if (!executable) throw new Error(`Portable Windows archive did not contain ${DESKTOP_APP_NAME}.exe.`);
10507
+ return path10.dirname(executable);
10508
+ }
10509
+ async function readInstallMetadata(metadataPath) {
10510
+ try {
10511
+ const parsed = JSON.parse(await readFile3(metadataPath, "utf8"));
10512
+ if (parsed.version !== 1) return null;
10513
+ return parsed;
10514
+ } catch {
10515
+ return null;
10516
+ }
10517
+ }
10518
+ function isInstalledDesktopCurrent(metadata, releaseTag, assetName, assetChecksum) {
10519
+ return Boolean(
10520
+ metadata && metadata.releaseTag === releaseTag && metadata.assetName === assetName && metadata.assetChecksum === assetChecksum
10521
+ );
10522
+ }
10523
+ function buildForceQuitCommand(target) {
10524
+ if (target.platform === "windows") return { command: "taskkill.exe", args: ["/IM", `${DESKTOP_APP_NAME}.exe`, "/T", "/F"] };
10525
+ return { command: "pkill", args: ["-x", DESKTOP_APP_NAME] };
10526
+ }
10527
+ function forceQuitDesktopProcesses(target) {
10528
+ const command = buildForceQuitCommand(target);
10529
+ spawnSync2(command.command, command.args, { stdio: "ignore" });
10530
+ }
10531
+ function isRunningInsideDesktopExecutable() {
10532
+ return path10.basename(process.execPath).toLowerCase().startsWith(DESKTOP_APP_NAME.toLowerCase());
10533
+ }
10534
+ async function waitForUpdateQuitResponse(responsePath, timeoutMs = 8e3) {
10535
+ const startedAt = Date.now();
10536
+ while (Date.now() - startedAt < timeoutMs) {
10537
+ if (await pathExists(responsePath)) {
10538
+ return JSON.parse(await readFile3(responsePath, "utf8"));
10539
+ }
10540
+ await delay(200);
10541
+ }
10542
+ return null;
10543
+ }
10544
+ async function requestDesktopQuit(executablePath, target) {
10545
+ if (!await pathExists(executablePath)) return { ok: true, status: "not_running" };
10546
+ const responsePath = path10.join(tmpdir(), `rudder-update-quit-${process.pid}-${Date.now()}.json`);
10547
+ const result = spawnSync2(executablePath, [`${DESKTOP_UPDATE_QUIT_ARG}=${responsePath}`], {
10548
+ stdio: "ignore",
10549
+ timeout: 5e3
10550
+ });
10551
+ if (result.error && target.platform === "windows") {
10552
+ return null;
10553
+ }
10554
+ try {
10555
+ return await waitForUpdateQuitResponse(responsePath);
10556
+ } finally {
10557
+ await rm(responsePath, { force: true });
10558
+ }
10559
+ }
10560
+ async function removePathWithRetry(targetPath, attempts = 5) {
10561
+ for (let attempt = 0; attempt < attempts; attempt += 1) {
10562
+ try {
10563
+ await rm(targetPath, { recursive: true, force: true });
10564
+ if (!await pathExists(targetPath)) return true;
10565
+ } catch {
10566
+ }
10567
+ await delay(500);
10568
+ }
10569
+ return false;
10570
+ }
10571
+ async function prepareForDesktopReplace(paths, target) {
10572
+ const hasManagedExecutable = await pathExists(paths.executablePath);
10573
+ if (hasManagedExecutable) {
10574
+ const quitResponse = await requestDesktopQuit(paths.executablePath, target);
10575
+ if (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs") {
10576
+ throw new Error(
10577
+ `Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}. Stop active work, then rerun start.`
10578
+ );
10579
+ }
10580
+ await delay(1e3);
10581
+ } else if (!isRunningInsideDesktopExecutable()) {
10582
+ forceQuitDesktopProcesses(target);
10583
+ }
10584
+ const replacePath = target.platform === "windows" ? paths.installRoot : paths.appPath;
10585
+ if (await removePathWithRetry(replacePath)) return;
10586
+ forceQuitDesktopProcesses(target);
10587
+ await delay(1e3);
10588
+ if (await removePathWithRetry(replacePath, 6)) return;
10589
+ throw new Error(`Failed to replace existing Rudder Desktop at ${replacePath}. Close Rudder and rerun start.`);
10590
+ }
10591
+ async function installPortableDesktop(installerPath, paths, target) {
10592
+ await mkdir(paths.installRoot, { recursive: true });
10593
+ if (target.platform === "linux") {
10594
+ await copyFile(installerPath, paths.appPath);
10595
+ await chmod(paths.appPath, 493);
10596
+ return;
10597
+ }
10598
+ const extractDir = await mkdtemp(path10.join(tmpdir(), "rudder-desktop-extract."));
10599
+ try {
10600
+ await extractZip(installerPath, extractDir, target);
10601
+ if (target.platform === "macos") {
10602
+ const appSource2 = await findMacApp(extractDir);
10603
+ await copyPortableAppBundle(appSource2, paths.appPath);
10604
+ return;
10605
+ }
10606
+ const appSource = await findWindowsAppDir(extractDir);
10607
+ await mkdir(path10.dirname(paths.installRoot), { recursive: true });
10608
+ await copyPortableAppBundle(appSource, paths.installRoot);
10609
+ } finally {
10610
+ await rm(extractDir, { recursive: true, force: true });
10611
+ }
10612
+ }
10613
+ async function copyPortableAppBundle(sourcePath, destinationPath) {
10614
+ await cp(sourcePath, destinationPath, { recursive: true, verbatimSymlinks: true });
10615
+ }
10616
+ async function removeMacQuarantine(paths, target) {
10617
+ if (target.platform !== "macos") return;
10618
+ const result = spawnSync2("xattr", ["-dr", "com.apple.quarantine", paths.appPath], { stdio: "ignore" });
10619
+ if (result.status !== 0) {
10620
+ p13.log.warn(`Could not remove macOS quarantine attributes from ${paths.appPath}.`);
10621
+ }
10622
+ }
10623
+ function quoteDesktopExec(value) {
10624
+ return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
10625
+ }
10626
+ function buildLinuxDesktopEntry(executablePath) {
10627
+ return [
10628
+ "[Desktop Entry]",
10629
+ "Type=Application",
10630
+ "Name=Rudder",
10631
+ `Exec=${quoteDesktopExec(executablePath)}`,
10632
+ "Terminal=false",
10633
+ "Categories=Development;",
10634
+ ""
10635
+ ].join("\n");
10636
+ }
10637
+ async function writeLinuxLaunchers(paths) {
10638
+ const desktopDir = path10.join(homedir(), ".local", "share", "applications");
10639
+ await mkdir(desktopDir, { recursive: true });
10640
+ await writeFile2(path10.join(desktopDir, "rudder.desktop"), buildLinuxDesktopEntry(paths.executablePath), "utf8");
10641
+ const binDir = path10.join(homedir(), ".local", "bin");
10642
+ await mkdir(binDir, { recursive: true });
10643
+ const wrapperPath = path10.join(binDir, "rudder-desktop");
10644
+ const escaped = paths.executablePath.replaceAll("'", `'"'"'`);
10645
+ await writeFile2(wrapperPath, `#!/bin/sh
10646
+ exec '${escaped}' "$@"
10647
+ `, "utf8");
10648
+ await chmod(wrapperPath, 493);
10649
+ }
10650
+ function buildWindowsShortcutScript(executablePath) {
10651
+ const appData = process.env.APPDATA?.trim() || path10.join(homedir(), "AppData", "Roaming");
10652
+ const shortcutPath = path10.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Rudder.lnk");
10653
+ return [
10654
+ "$shell = New-Object -ComObject WScript.Shell",
10655
+ `$shortcut = $shell.CreateShortcut(${powershellQuote(shortcutPath)})`,
10656
+ `$shortcut.TargetPath = ${powershellQuote(executablePath)}`,
10657
+ `$shortcut.WorkingDirectory = ${powershellQuote(path10.dirname(executablePath))}`,
10658
+ "$shortcut.Save()"
10659
+ ].join("; ");
10660
+ }
10661
+ async function createPlatformLaunchers(paths, target) {
10662
+ if (target.platform === "linux") {
10663
+ await writeLinuxLaunchers(paths);
10664
+ return;
10665
+ }
10666
+ if (target.platform === "windows") {
10667
+ const result = spawnSync2("powershell.exe", [
10668
+ "-NoProfile",
10669
+ "-ExecutionPolicy",
10670
+ "Bypass",
10671
+ "-Command",
10672
+ buildWindowsShortcutScript(paths.executablePath)
10673
+ ], { stdio: "ignore" });
10674
+ if (result.status !== 0) p13.log.warn("Could not create the Windows Start Menu shortcut.");
10675
+ }
10676
+ }
10677
+ function launchDesktop(paths, target) {
10060
10678
  if (target.platform === "macos") {
10061
- spawnSync2("open", [installerPath], { stdio: "inherit" });
10679
+ spawn("open", [paths.appPath], { detached: true, stdio: "ignore" }).unref();
10062
10680
  return;
10063
10681
  }
10064
10682
  if (target.platform === "windows") {
10065
- spawnSync2("cmd.exe", ["/c", "start", "", installerPath], { stdio: "inherit" });
10683
+ spawn("cmd.exe", ["/c", "start", "", paths.executablePath], { detached: true, stdio: "ignore" }).unref();
10066
10684
  return;
10067
10685
  }
10068
- spawnSync2("xdg-open", [installerPath], { stdio: "inherit" });
10686
+ spawn(paths.executablePath, [], { detached: true, stdio: "ignore" }).unref();
10687
+ }
10688
+ async function writeInstallMetadata(paths, releaseTag, assetName, assetChecksum) {
10689
+ mkdirSync2(path10.dirname(paths.metadataPath), { recursive: true });
10690
+ const metadata = {
10691
+ version: 1,
10692
+ releaseTag,
10693
+ assetName,
10694
+ assetChecksum,
10695
+ installedAt: (/* @__PURE__ */ new Date()).toISOString()
10696
+ };
10697
+ mkdirSync2(paths.installRoot, { recursive: true });
10698
+ await writeFile2(paths.metadataPath, `${JSON.stringify(metadata, null, 2)}
10699
+ `, "utf8");
10700
+ }
10701
+ async function runStartPhase(message, successMessage, task) {
10702
+ const spinner5 = p13.spinner();
10703
+ spinner5.start(message);
10704
+ try {
10705
+ const result = await task();
10706
+ spinner5.stop(successMessage);
10707
+ return result;
10708
+ } catch (error) {
10709
+ spinner5.stop(pc8.red(`${message} failed.`));
10710
+ throw error;
10711
+ }
10069
10712
  }
10070
10713
  async function startCommand(opts) {
10071
10714
  const installCli = opts.cli !== false;
@@ -10084,48 +10727,108 @@ async function startCommand(opts) {
10084
10727
  if (installCli) {
10085
10728
  const installSpec = resolveCliInstallSpec(version);
10086
10729
  const command = `npm install --global ${installSpec}`;
10730
+ const installedVersion = getGlobalInstalledPackageVersion(CLI_NPM_PACKAGE_NAME);
10087
10731
  p13.log.step("Preparing persistent CLI");
10088
- if (dryRun) {
10732
+ if (isPersistentCliVersionCurrent(version, installedVersion)) {
10733
+ p13.log.success(`${pc8.cyan("rudder")} CLI ${version} is already installed.`);
10734
+ } else if (dryRun) {
10089
10735
  p13.log.message(`[dry-run] ${command}`);
10090
10736
  } else {
10091
10737
  p13.log.message(pc8.dim(`Running: ${command}`));
10092
- const result = installPersistentCli({ installSpec });
10738
+ const spinner5 = p13.spinner();
10739
+ spinner5.start("Installing persistent CLI...");
10740
+ let result;
10741
+ try {
10742
+ result = installPersistentCli({ installSpec });
10743
+ } catch (error) {
10744
+ spinner5.stop(pc8.red("Persistent CLI installation failed."));
10745
+ throw error;
10746
+ }
10093
10747
  if (!result.ok) {
10748
+ spinner5.stop(pc8.red("Persistent CLI installation failed."));
10094
10749
  if (result.output) p13.log.message(pc8.dim(result.output));
10095
10750
  throw new Error(`Persistent CLI installation failed. Re-run manually: ${result.command}`);
10096
10751
  }
10097
- p13.log.success(`${pc8.cyan("rudder")} CLI installed.`);
10752
+ spinner5.stop(`${pc8.cyan("rudder")} CLI installed.`);
10098
10753
  }
10099
10754
  }
10100
10755
  if (installDesktop) {
10101
10756
  const target = resolveDesktopAssetTarget();
10102
10757
  const tag = resolveDesktopReleaseTag(version);
10103
- const outputDir = opts.outputDir ? path9.resolve(opts.outputDir) : await mkdtemp(path9.join(tmpdir(), "rudder-desktop-installer."));
10104
- p13.log.step("Starting desktop app");
10758
+ const installRoot = opts.desktopInstallDir ? path10.resolve(opts.desktopInstallDir) : resolveDefaultDesktopInstallRoot(target);
10759
+ const installPaths = resolveDesktopInstallPaths(target, installRoot);
10760
+ const outputDir = opts.outputDir ? path10.resolve(opts.outputDir) : await mkdtemp(path10.join(tmpdir(), "rudder-desktop-installer."));
10761
+ p13.log.step("Installing desktop app");
10105
10762
  p13.log.message(`Release: ${pc8.cyan(`${repo}@${tag}`)}`);
10106
10763
  p13.log.message(`Target: ${pc8.cyan(`${target.platform}/${target.arch}`)}`);
10764
+ p13.log.message(`Install: ${pc8.cyan(installPaths.appPath)}`);
10107
10765
  if (dryRun) {
10108
- p13.log.message(`[dry-run] Would resolve and download/open the matching desktop installer to ${outputDir}`);
10766
+ p13.log.message(`[dry-run] Would resolve, download, verify, install, and ${opts.open === false ? "not launch" : "launch"} Rudder Desktop.`);
10109
10767
  p13.outro(pc8.green("Dry run complete."));
10110
10768
  return;
10111
10769
  }
10112
- const release = await fetchGithubRelease(repo, tag);
10113
- const asset = selectDesktopAsset(release.assets ?? [], target);
10114
- if (!asset) {
10115
- throw new Error(`No Rudder Desktop installer found for ${target.platform}/${target.arch} in ${repo}@${release.tag_name}.`);
10770
+ const directReleaseVersion = resolveDesktopReleaseVersion(tag);
10771
+ const progressFactory = createByteProgress;
10772
+ const release = directReleaseVersion ? null : await runStartPhase(
10773
+ "Resolving Desktop release...",
10774
+ "Desktop release resolved.",
10775
+ () => fetchGithubRelease(repo, tag)
10776
+ );
10777
+ const releaseTag = directReleaseVersion ? tag : release?.tag_name;
10778
+ if (!releaseTag) {
10779
+ throw new Error(`Unable to resolve Rudder Desktop release tag for ${repo}@${tag}.`);
10116
10780
  }
10117
- const installerPath = await downloadAsset(asset, outputDir);
10118
- const checksumVerified = await verifyChecksum(installerPath, selectChecksumAsset(release.assets ?? []), outputDir);
10119
- if (target.platform === "linux") {
10120
- await chmod(installerPath, 493);
10781
+ const asset = directReleaseVersion ? buildGithubReleaseAsset(repo, tag, resolveDesktopAssetName(directReleaseVersion, target)) : selectDesktopAsset(release?.assets ?? [], target);
10782
+ if (!asset) {
10783
+ throw new Error(`No Rudder Desktop portable asset found for ${target.platform}/${target.arch} in ${repo}@${releaseTag}.`);
10784
+ }
10785
+ const checksumAsset = directReleaseVersion ? buildGithubReleaseAsset(repo, tag, DESKTOP_CHECKSUM_ASSET_NAME) : selectChecksumAsset(release?.assets ?? []);
10786
+ const checksums = await downloadChecksums(checksumAsset, outputDir, progressFactory);
10787
+ const expectedChecksum = resolveAssetChecksum(checksums, asset.name);
10788
+ const metadata = await readInstallMetadata(installPaths.metadataPath);
10789
+ if (isInstalledDesktopCurrent(metadata, releaseTag, asset.name, expectedChecksum) && await pathExists(installPaths.executablePath)) {
10790
+ p13.log.success(`Rudder Desktop is already installed at ${pc8.cyan(installPaths.appPath)}.`);
10791
+ await runStartPhase(
10792
+ "Refreshing Desktop launchers...",
10793
+ "Desktop launchers ready.",
10794
+ async () => {
10795
+ await removeMacQuarantine(installPaths, target);
10796
+ await createPlatformLaunchers(installPaths, target);
10797
+ }
10798
+ );
10799
+ } else {
10800
+ const installerPath = await downloadAsset(asset, outputDir, progressFactory);
10801
+ const checksum = await runStartPhase(
10802
+ "Verifying Desktop checksum...",
10803
+ `Verified ${pc8.cyan(path10.basename(installerPath))}.`,
10804
+ () => assertChecksumMatch(installerPath, expectedChecksum)
10805
+ );
10806
+ await runStartPhase(
10807
+ "Replacing existing Rudder Desktop if needed...",
10808
+ "Existing Desktop install is ready for replacement.",
10809
+ () => prepareForDesktopReplace(installPaths, target)
10810
+ );
10811
+ await runStartPhase(
10812
+ "Installing portable Desktop app...",
10813
+ `Installed Rudder Desktop to ${pc8.cyan(installPaths.appPath)}.`,
10814
+ () => installPortableDesktop(installerPath, installPaths, target)
10815
+ );
10816
+ await runStartPhase(
10817
+ "Preparing Desktop launchers...",
10818
+ "Desktop launchers ready.",
10819
+ async () => {
10820
+ await removeMacQuarantine(installPaths, target);
10821
+ await createPlatformLaunchers(installPaths, target);
10822
+ }
10823
+ );
10824
+ await writeInstallMetadata(installPaths, releaseTag, asset.name, checksum);
10121
10825
  }
10122
- p13.log.success(`Downloaded ${pc8.cyan(path9.basename(installerPath))}`);
10123
- if (checksumVerified) p13.log.success("Verified SHA-256 checksum.");
10124
10826
  if (opts.open !== false) {
10125
- openInstaller(installerPath, target);
10126
- p13.log.message(`Installer path: ${pc8.cyan(installerPath)}`);
10127
- } else {
10128
- p13.log.message(`Installer path: ${pc8.cyan(installerPath)}`);
10827
+ await runStartPhase(
10828
+ "Launching Rudder Desktop...",
10829
+ "Rudder Desktop launched.",
10830
+ () => launchDesktop(installPaths, target)
10831
+ );
10129
10832
  }
10130
10833
  }
10131
10834
  p13.outro(pc8.green("Rudder start complete."));
@@ -10167,7 +10870,7 @@ async function addAllowedHostname(host, opts) {
10167
10870
  }
10168
10871
 
10169
10872
  // src/commands/heartbeat-run.ts
10170
- import { setTimeout as delay } from "node:timers/promises";
10873
+ import { setTimeout as delay2 } from "node:timers/promises";
10171
10874
  import pc19 from "picocolors";
10172
10875
 
10173
10876
  // ../packages/agent-runtimes/claude-local/src/cli/format-event.ts
@@ -10343,8 +11046,8 @@ function printItemCompleted(item) {
10343
11046
  const changes = Array.isArray(item.changes) ? item.changes : [];
10344
11047
  const entries = changes.map((changeRaw) => asRecord(changeRaw)).filter((change) => Boolean(change)).map((change) => {
10345
11048
  const kind = asString(change.kind, "update");
10346
- const path22 = asString(change.path, "unknown");
10347
- return `${kind} ${path22}`;
11049
+ const path23 = asString(change.path, "unknown");
11050
+ return `${kind} ${path23}`;
10348
11051
  });
10349
11052
  const preview = entries.length > 0 ? entries.slice(0, 6).join(", ") : "none";
10350
11053
  const more = entries.length > 6 ? ` (+${entries.length - 6} more)` : "";
@@ -11160,9 +11863,9 @@ function getCLIAdapter(type) {
11160
11863
  import pc18 from "picocolors";
11161
11864
 
11162
11865
  // src/client/board-auth.ts
11163
- import { spawn } from "node:child_process";
11866
+ import { spawn as spawn2 } from "node:child_process";
11164
11867
  import fs10 from "node:fs";
11165
- import path10 from "node:path";
11868
+ import path11 from "node:path";
11166
11869
  import pc17 from "picocolors";
11167
11870
 
11168
11871
  // src/client/command-label.ts
@@ -11186,8 +11889,8 @@ function normalizeApiBase(apiBase) {
11186
11889
  return apiBase.trim().replace(/\/+$/, "");
11187
11890
  }
11188
11891
  function resolveBoardAuthStorePath(overridePath) {
11189
- if (overridePath?.trim()) return path10.resolve(overridePath.trim());
11190
- if (process.env.RUDDER_AUTH_STORE?.trim()) return path10.resolve(process.env.RUDDER_AUTH_STORE.trim());
11892
+ if (overridePath?.trim()) return path11.resolve(overridePath.trim());
11893
+ if (process.env.RUDDER_AUTH_STORE?.trim()) return path11.resolve(process.env.RUDDER_AUTH_STORE.trim());
11191
11894
  return resolveDefaultCliAuthPath();
11192
11895
  }
11193
11896
  function readBoardAuthStore(storePath) {
@@ -11219,7 +11922,7 @@ function readBoardAuthStore(storePath) {
11219
11922
  }
11220
11923
  function writeBoardAuthStore(store, storePath) {
11221
11924
  const filePath = resolveBoardAuthStorePath(storePath);
11222
- fs10.mkdirSync(path10.dirname(filePath), { recursive: true });
11925
+ fs10.mkdirSync(path11.dirname(filePath), { recursive: true });
11223
11926
  fs10.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}
11224
11927
  `, { mode: 384 });
11225
11928
  }
@@ -11277,16 +11980,16 @@ function openUrl(url) {
11277
11980
  const platform = process.platform;
11278
11981
  try {
11279
11982
  if (platform === "darwin") {
11280
- const child2 = spawn("open", [url], { detached: true, stdio: "ignore" });
11983
+ const child2 = spawn2("open", [url], { detached: true, stdio: "ignore" });
11281
11984
  child2.unref();
11282
11985
  return true;
11283
11986
  }
11284
11987
  if (platform === "win32") {
11285
- const child2 = spawn("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" });
11988
+ const child2 = spawn2("cmd", ["/c", "start", "", url], { detached: true, stdio: "ignore" });
11286
11989
  child2.unref();
11287
11990
  return true;
11288
11991
  }
11289
- const child = spawn("xdg-open", [url], { detached: true, stdio: "ignore" });
11992
+ const child = spawn2("xdg-open", [url], { detached: true, stdio: "ignore" });
11290
11993
  child.unref();
11291
11994
  return true;
11292
11995
  } catch {
@@ -11370,26 +12073,26 @@ init_store();
11370
12073
  // src/client/context.ts
11371
12074
  init_home();
11372
12075
  import fs11 from "node:fs";
11373
- import path11 from "node:path";
12076
+ import path12 from "node:path";
11374
12077
  var DEFAULT_CONTEXT_BASENAME = "context.json";
11375
12078
  var DEFAULT_PROFILE = "default";
11376
12079
  function findContextFileFromAncestors(startDir) {
11377
- const absoluteStartDir = path11.resolve(startDir);
12080
+ const absoluteStartDir = path12.resolve(startDir);
11378
12081
  let currentDir = absoluteStartDir;
11379
12082
  while (true) {
11380
- const candidate = path11.resolve(currentDir, ".rudder", DEFAULT_CONTEXT_BASENAME);
12083
+ const candidate = path12.resolve(currentDir, ".rudder", DEFAULT_CONTEXT_BASENAME);
11381
12084
  if (fs11.existsSync(candidate)) {
11382
12085
  return candidate;
11383
12086
  }
11384
- const nextDir = path11.resolve(currentDir, "..");
12087
+ const nextDir = path12.resolve(currentDir, "..");
11385
12088
  if (nextDir === currentDir) break;
11386
12089
  currentDir = nextDir;
11387
12090
  }
11388
12091
  return null;
11389
12092
  }
11390
12093
  function resolveContextPath(overridePath) {
11391
- if (overridePath) return path11.resolve(overridePath);
11392
- if (process.env.RUDDER_CONTEXT) return path11.resolve(process.env.RUDDER_CONTEXT);
12094
+ if (overridePath) return path12.resolve(overridePath);
12095
+ if (process.env.RUDDER_CONTEXT) return path12.resolve(process.env.RUDDER_CONTEXT);
11393
12096
  return findContextFileFromAncestors(process.cwd()) ?? resolveDefaultContextPath();
11394
12097
  }
11395
12098
  function defaultClientContext() {
@@ -11457,7 +12160,7 @@ function readContext(contextPath) {
11457
12160
  }
11458
12161
  function writeContext(context, contextPath) {
11459
12162
  const filePath = resolveContextPath(contextPath);
11460
- const dir = path11.dirname(filePath);
12163
+ const dir = path12.dirname(filePath);
11461
12164
  fs11.mkdirSync(dir, { recursive: true });
11462
12165
  const normalized = normalizeContext(context);
11463
12166
  fs11.writeFileSync(filePath, `${JSON.stringify(normalized, null, 2)}
@@ -11525,35 +12228,35 @@ var RudderApiClient = class {
11525
12228
  this.runId = opts.runId?.trim() || void 0;
11526
12229
  this.recoverAuth = opts.recoverAuth;
11527
12230
  }
11528
- get(path22, opts) {
11529
- return this.request(path22, { method: "GET" }, opts);
12231
+ get(path23, opts) {
12232
+ return this.request(path23, { method: "GET" }, opts);
11530
12233
  }
11531
- post(path22, body, opts) {
11532
- return this.request(path22, {
12234
+ post(path23, body, opts) {
12235
+ return this.request(path23, {
11533
12236
  method: "POST",
11534
12237
  body: body === void 0 ? void 0 : JSON.stringify(body)
11535
12238
  }, opts);
11536
12239
  }
11537
- patch(path22, body, opts) {
11538
- return this.request(path22, {
12240
+ patch(path23, body, opts) {
12241
+ return this.request(path23, {
11539
12242
  method: "PATCH",
11540
12243
  body: body === void 0 ? void 0 : JSON.stringify(body)
11541
12244
  }, opts);
11542
12245
  }
11543
- put(path22, body, opts) {
11544
- return this.request(path22, {
12246
+ put(path23, body, opts) {
12247
+ return this.request(path23, {
11545
12248
  method: "PUT",
11546
12249
  body: body === void 0 ? void 0 : JSON.stringify(body)
11547
12250
  }, opts);
11548
12251
  }
11549
- delete(path22, opts) {
11550
- return this.request(path22, { method: "DELETE" }, opts);
12252
+ delete(path23, opts) {
12253
+ return this.request(path23, { method: "DELETE" }, opts);
11551
12254
  }
11552
12255
  setApiKey(apiKey) {
11553
12256
  this.apiKey = apiKey?.trim() || void 0;
11554
12257
  }
11555
- async request(path22, init, opts, hasRetriedAuth = false) {
11556
- const url = buildUrl(this.apiBase, path22);
12258
+ async request(path23, init, opts, hasRetriedAuth = false) {
12259
+ const url = buildUrl(this.apiBase, path23);
11557
12260
  const headers = {
11558
12261
  accept: "application/json",
11559
12262
  ...toStringRecord(init.headers)
@@ -11578,13 +12281,13 @@ var RudderApiClient = class {
11578
12281
  const apiError = await toApiError(response);
11579
12282
  if (!hasRetriedAuth && this.recoverAuth) {
11580
12283
  const recoveredToken = await this.recoverAuth({
11581
- path: path22,
12284
+ path: path23,
11582
12285
  method: String(init.method ?? "GET").toUpperCase(),
11583
12286
  error: apiError
11584
12287
  });
11585
12288
  if (recoveredToken) {
11586
12289
  this.setApiKey(recoveredToken);
11587
- return this.request(path22, init, opts, true);
12290
+ return this.request(path23, init, opts, true);
11588
12291
  }
11589
12292
  }
11590
12293
  throw apiError;
@@ -11603,8 +12306,8 @@ function shouldAttachRunId(method) {
11603
12306
  const normalized = String(method ?? "GET").toUpperCase();
11604
12307
  return normalized !== "GET" && normalized !== "HEAD";
11605
12308
  }
11606
- function buildUrl(apiBase, path22) {
11607
- const normalizedPath = path22.startsWith("/") ? path22 : `/${path22}`;
12309
+ function buildUrl(apiBase, path23) {
12310
+ const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
11608
12311
  const [pathname, query] = normalizedPath.split("?");
11609
12312
  const url = new URL2(apiBase);
11610
12313
  url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
@@ -12015,7 +12718,7 @@ async function heartbeatRun(opts) {
12015
12718
  logOffset += Buffer.byteLength(logResult.content, "utf8");
12016
12719
  }
12017
12720
  }
12018
- await delay(POLL_INTERVAL_MS);
12721
+ await delay2(POLL_INTERVAL_MS);
12019
12722
  }
12020
12723
  if (finalStatus) {
12021
12724
  if (!debug && stdoutJsonBuffer.trim()) {
@@ -12087,7 +12790,7 @@ init_src2();
12087
12790
  init_home();
12088
12791
  init_store();
12089
12792
  init_banner();
12090
- import path12 from "node:path";
12793
+ import path13 from "node:path";
12091
12794
  import * as p15 from "@clack/prompts";
12092
12795
  import pc20 from "picocolors";
12093
12796
  function resolveConnectionString(configPath) {
@@ -12111,7 +12814,7 @@ function normalizeRetentionDays(value, fallback) {
12111
12814
  return candidate;
12112
12815
  }
12113
12816
  function resolveBackupDir(raw) {
12114
- return path12.resolve(expandHomePrefix(raw.trim()));
12817
+ return path13.resolve(expandHomePrefix(raw.trim()));
12115
12818
  }
12116
12819
  async function dbBackupCommand(opts) {
12117
12820
  printRudderCliBanner();
@@ -12131,8 +12834,8 @@ async function dbBackupCommand(opts) {
12131
12834
  p15.log.message(pc20.dim(`Connection source: ${connection.source}`));
12132
12835
  p15.log.message(pc20.dim(`Backup dir: ${backupDir}`));
12133
12836
  p15.log.message(pc20.dim(`Retention: ${retentionDays} day(s)`));
12134
- const spinner4 = p15.spinner();
12135
- spinner4.start("Creating database backup...");
12837
+ const spinner5 = p15.spinner();
12838
+ spinner5.start("Creating database backup...");
12136
12839
  try {
12137
12840
  const result = await runDatabaseBackup({
12138
12841
  connectionString: connection.value,
@@ -12140,7 +12843,7 @@ async function dbBackupCommand(opts) {
12140
12843
  retentionDays,
12141
12844
  filenamePrefix
12142
12845
  });
12143
- spinner4.stop(`Backup saved: ${formatDatabaseBackupResult(result)}`);
12846
+ spinner5.stop(`Backup saved: ${formatDatabaseBackupResult(result)}`);
12144
12847
  if (opts.json) {
12145
12848
  console.log(
12146
12849
  JSON.stringify(
@@ -12159,7 +12862,7 @@ async function dbBackupCommand(opts) {
12159
12862
  }
12160
12863
  p15.outro(pc20.green("Backup completed."));
12161
12864
  } catch (err) {
12162
- spinner4.stop(pc20.red("Backup failed."));
12865
+ spinner5.stop(pc20.red("Backup failed."));
12163
12866
  throw err;
12164
12867
  }
12165
12868
  }
@@ -12230,14 +12933,14 @@ function registerContextCommands(program) {
12230
12933
  }
12231
12934
 
12232
12935
  // src/commands/client/company.ts
12233
- import { mkdir, readdir as readdir2, readFile as readFile3, stat, writeFile as writeFile2 } from "node:fs/promises";
12234
- import path14 from "node:path";
12936
+ import { mkdir as mkdir2, readdir as readdir3, readFile as readFile4, stat, writeFile as writeFile3 } from "node:fs/promises";
12937
+ import path15 from "node:path";
12235
12938
  import * as p16 from "@clack/prompts";
12236
12939
  import pc22 from "picocolors";
12237
12940
 
12238
12941
  // src/commands/client/zip.ts
12239
12942
  import { inflateRawSync } from "node:zlib";
12240
- import path13 from "node:path";
12943
+ import path14 from "node:path";
12241
12944
  var textDecoder = new TextDecoder();
12242
12945
  var binaryContentTypeByExtension = {
12243
12946
  ".gif": "image/gif",
@@ -12264,7 +12967,7 @@ function sharedArchiveRoot(paths) {
12264
12967
  return firstSegments.every((parts) => parts.length > 1 && parts[0] === candidate) ? candidate : null;
12265
12968
  }
12266
12969
  function bytesToPortableFileEntry(pathValue, bytes) {
12267
- const contentType = binaryContentTypeByExtension[path13.extname(pathValue).toLowerCase()];
12970
+ const contentType = binaryContentTypeByExtension[path14.extname(pathValue).toLowerCase()];
12268
12971
  if (!contentType) return textDecoder.decode(bytes);
12269
12972
  return {
12270
12973
  encoding: "base64",
@@ -12352,7 +13055,7 @@ var IMPORT_INCLUDE_OPTIONS = [
12352
13055
  ];
12353
13056
  var IMPORT_PREVIEW_SAMPLE_LIMIT = 6;
12354
13057
  function readPortableFileEntry(filePath, contents) {
12355
- const contentType = binaryContentTypeByExtension[path14.extname(filePath).toLowerCase()];
13058
+ const contentType = binaryContentTypeByExtension[path15.extname(filePath).toLowerCase()];
12356
13059
  if (!contentType) return contents.toString("utf8");
12357
13060
  return {
12358
13061
  encoding: "base64",
@@ -12407,10 +13110,10 @@ function normalizePortablePath(filePath) {
12407
13110
  return filePath.replace(/\\/g, "/");
12408
13111
  }
12409
13112
  function shouldIncludePortableFile(filePath) {
12410
- const baseName = path14.basename(filePath);
13113
+ const baseName = path15.basename(filePath);
12411
13114
  const isMarkdown = baseName.endsWith(".md");
12412
13115
  const isPaperclipYaml = baseName === ".rudder.yaml" || baseName === ".rudder.yml";
12413
- const contentType = binaryContentTypeByExtension[path14.extname(baseName).toLowerCase()];
13116
+ const contentType = binaryContentTypeByExtension[path15.extname(baseName).toLowerCase()];
12414
13117
  return isMarkdown || isPaperclipYaml || Boolean(contentType);
12415
13118
  }
12416
13119
  function findPortableExtensionPath(files) {
@@ -12558,10 +13261,10 @@ function buildDefaultImportAdapterOverrides(preview) {
12558
13261
  }
12559
13262
  function buildDefaultImportAdapterMessages(overrides) {
12560
13263
  if (!overrides) return [];
12561
- const agentRuntimeTypes = Array.from(new Set(Object.values(overrides).map((override) => override.agentRuntimeType))).map((agentRuntimeType) => agentRuntimeType.replace(/_/g, "-"));
13264
+ const agentRuntimeTypes2 = Array.from(new Set(Object.values(overrides).map((override) => override.agentRuntimeType))).map((agentRuntimeType) => agentRuntimeType.replace(/_/g, "-"));
12562
13265
  const agentCount = Object.keys(overrides).length;
12563
13266
  return [
12564
- `Using ${agentRuntimeTypes.join(", ")} adapter${agentRuntimeTypes.length === 1 ? "" : "s"} for ${agentCount} imported ${pluralize(agentCount, "agent")} without an explicit adapter.`
13267
+ `Using ${agentRuntimeTypes2.join(", ")} adapter${agentRuntimeTypes2.length === 1 ? "" : "s"} for ${agentCount} imported ${pluralize(agentCount, "agent")} without an explicit adapter.`
12565
13268
  ];
12566
13269
  }
12567
13270
  async function promptForImportSelection(preview) {
@@ -12963,73 +13666,73 @@ function normalizeGithubImportSource(input, refOverride) {
12963
13666
  }
12964
13667
  return buildGithubImportUrl({ owner, repo, ref });
12965
13668
  }
12966
- async function pathExists(inputPath) {
13669
+ async function pathExists2(inputPath) {
12967
13670
  try {
12968
- await stat(path14.resolve(inputPath));
13671
+ await stat(path15.resolve(inputPath));
12969
13672
  return true;
12970
13673
  } catch {
12971
13674
  return false;
12972
13675
  }
12973
13676
  }
12974
13677
  async function collectPackageFiles(root, current, files) {
12975
- const entries = await readdir2(current, { withFileTypes: true });
13678
+ const entries = await readdir3(current, { withFileTypes: true });
12976
13679
  for (const entry of entries) {
12977
13680
  if (entry.name.startsWith(".git")) continue;
12978
- const absolutePath = path14.join(current, entry.name);
13681
+ const absolutePath = path15.join(current, entry.name);
12979
13682
  if (entry.isDirectory()) {
12980
13683
  await collectPackageFiles(root, absolutePath, files);
12981
13684
  continue;
12982
13685
  }
12983
13686
  if (!entry.isFile()) continue;
12984
- const relativePath = path14.relative(root, absolutePath).replace(/\\/g, "/");
13687
+ const relativePath = path15.relative(root, absolutePath).replace(/\\/g, "/");
12985
13688
  if (!shouldIncludePortableFile(relativePath)) continue;
12986
- files[relativePath] = readPortableFileEntry(relativePath, await readFile3(absolutePath));
13689
+ files[relativePath] = readPortableFileEntry(relativePath, await readFile4(absolutePath));
12987
13690
  }
12988
13691
  }
12989
13692
  async function resolveInlineSourceFromPath(inputPath) {
12990
- const resolved = path14.resolve(inputPath);
13693
+ const resolved = path15.resolve(inputPath);
12991
13694
  const resolvedStat = await stat(resolved);
12992
- if (resolvedStat.isFile() && path14.extname(resolved).toLowerCase() === ".zip") {
12993
- const archive = await readZipArchive(await readFile3(resolved));
13695
+ if (resolvedStat.isFile() && path15.extname(resolved).toLowerCase() === ".zip") {
13696
+ const archive = await readZipArchive(await readFile4(resolved));
12994
13697
  const filteredFiles = Object.fromEntries(
12995
13698
  Object.entries(archive.files).filter(([relativePath]) => shouldIncludePortableFile(relativePath))
12996
13699
  );
12997
13700
  return {
12998
- rootPath: archive.rootPath ?? path14.basename(resolved, ".zip"),
13701
+ rootPath: archive.rootPath ?? path15.basename(resolved, ".zip"),
12999
13702
  files: filteredFiles
13000
13703
  };
13001
13704
  }
13002
- const rootDir = resolvedStat.isDirectory() ? resolved : path14.dirname(resolved);
13705
+ const rootDir = resolvedStat.isDirectory() ? resolved : path15.dirname(resolved);
13003
13706
  const files = {};
13004
13707
  await collectPackageFiles(rootDir, rootDir, files);
13005
13708
  return {
13006
- rootPath: path14.basename(rootDir),
13709
+ rootPath: path15.basename(rootDir),
13007
13710
  files
13008
13711
  };
13009
13712
  }
13010
13713
  async function writeExportToFolder(outDir, exported) {
13011
- const root = path14.resolve(outDir);
13012
- await mkdir(root, { recursive: true });
13714
+ const root = path15.resolve(outDir);
13715
+ await mkdir2(root, { recursive: true });
13013
13716
  for (const [relativePath, content] of Object.entries(exported.files)) {
13014
13717
  const normalized = relativePath.replace(/\\/g, "/");
13015
- const filePath = path14.join(root, normalized);
13016
- await mkdir(path14.dirname(filePath), { recursive: true });
13718
+ const filePath = path15.join(root, normalized);
13719
+ await mkdir2(path15.dirname(filePath), { recursive: true });
13017
13720
  const writeValue = portableFileEntryToWriteValue(content);
13018
13721
  if (typeof writeValue === "string") {
13019
- await writeFile2(filePath, writeValue, "utf8");
13722
+ await writeFile3(filePath, writeValue, "utf8");
13020
13723
  } else {
13021
- await writeFile2(filePath, writeValue);
13724
+ await writeFile3(filePath, writeValue);
13022
13725
  }
13023
13726
  }
13024
13727
  }
13025
13728
  async function confirmOverwriteExportDirectory(outDir) {
13026
- const root = path14.resolve(outDir);
13729
+ const root = path15.resolve(outDir);
13027
13730
  const stats = await stat(root).catch(() => null);
13028
13731
  if (!stats) return;
13029
13732
  if (!stats.isDirectory()) {
13030
13733
  throw new Error(`Export output path ${root} exists and is not a directory.`);
13031
13734
  }
13032
- const entries = await readdir2(root);
13735
+ const entries = await readdir3(root);
13033
13736
  if (entries.length === 0) return;
13034
13737
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
13035
13738
  throw new Error(`Export output directory ${root} already contains files. Re-run interactively or choose an empty directory.`);
@@ -13173,7 +13876,7 @@ function registerCompanyCommands(program) {
13173
13876
  printOutput(
13174
13877
  {
13175
13878
  ok: true,
13176
- out: path14.resolve(opts.out),
13879
+ out: path15.resolve(opts.out),
13177
13880
  rootPath: exported.rootPath,
13178
13881
  filesWritten: Object.keys(exported.files).length,
13179
13882
  rudderExtensionPath: exported.rudderExtensionPath,
@@ -13226,7 +13929,7 @@ function registerCompanyCommands(program) {
13226
13929
  throw new Error("Target existing organization requires --org-id (or context default orgId).");
13227
13930
  }
13228
13931
  let sourcePayload;
13229
- const treatAsLocalPath = !isHttpUrl(from) && await pathExists(from);
13932
+ const treatAsLocalPath = !isHttpUrl(from) && await pathExists2(from);
13230
13933
  const isGithubSource = isGithubUrl(from) || isGithubShorthand(from) && !treatAsLocalPath;
13231
13934
  if (isHttpUrl(from) || isGithubSource) {
13232
13935
  if (!isGithubUrl(from) && !isGithubShorthand(from)) {
@@ -13977,8 +14680,8 @@ function registerIssueCommands(program) {
13977
14680
  if (opts.assigneeAgentId) params.set("assigneeAgentId", opts.assigneeAgentId);
13978
14681
  if (opts.projectId) params.set("projectId", opts.projectId);
13979
14682
  const query = params.toString();
13980
- const path22 = `/api/orgs/${ctx.orgId}/issues${query ? `?${query}` : ""}`;
13981
- const rows = await ctx.api.get(path22) ?? [];
14683
+ const path23 = `/api/orgs/${ctx.orgId}/issues${query ? `?${query}` : ""}`;
14684
+ const rows = await ctx.api.get(path23) ?? [];
13982
14685
  const filtered = filterIssueRows(rows, opts.match);
13983
14686
  if (ctx.json) {
13984
14687
  printOutput(filtered, { json: true });
@@ -14272,8 +14975,8 @@ function filterIssueRows(rows, match) {
14272
14975
  init_src();
14273
14976
 
14274
14977
  // ../packages/agent-runtime-utils/src/server-utils.ts
14275
- import { constants as fsConstants, promises as fs12 } from "node:fs";
14276
- import path15 from "node:path";
14978
+ import { constants as fsConstants2, promises as fs12 } from "node:fs";
14979
+ import path16 from "node:path";
14277
14980
  var MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
14278
14981
  var MAX_EXCERPT_BYTES = 32 * 1024;
14279
14982
  var RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES = [
@@ -14290,8 +14993,8 @@ function isMaintainerOnlySkillTarget(candidate) {
14290
14993
  }
14291
14994
  async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
14292
14995
  const candidates = [
14293
- ...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path15.resolve(moduleDir, relativePath)),
14294
- ...additionalCandidates.map((candidate) => path15.resolve(candidate))
14996
+ ...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path16.resolve(moduleDir, relativePath)),
14997
+ ...additionalCandidates.map((candidate) => path16.resolve(candidate))
14295
14998
  ];
14296
14999
  const seenRoots = /* @__PURE__ */ new Set();
14297
15000
  for (const root of candidates) {
@@ -14309,12 +15012,12 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
14309
15012
  const removed = [];
14310
15013
  for (const entry of entries) {
14311
15014
  if (allowed.has(entry.name)) continue;
14312
- const target = path15.join(skillsHome, entry.name);
15015
+ const target = path16.join(skillsHome, entry.name);
14313
15016
  const existing = await fs12.lstat(target).catch(() => null);
14314
15017
  if (!existing?.isSymbolicLink()) continue;
14315
15018
  const linkedPath = await fs12.readlink(target).catch(() => null);
14316
15019
  if (!linkedPath) continue;
14317
- const resolvedLinkedPath = path15.isAbsolute(linkedPath) ? linkedPath : path15.resolve(path15.dirname(target), linkedPath);
15020
+ const resolvedLinkedPath = path16.isAbsolute(linkedPath) ? linkedPath : path16.resolve(path16.dirname(target), linkedPath);
14318
15021
  if (!isMaintainerOnlySkillTarget(linkedPath) && !isMaintainerOnlySkillTarget(resolvedLinkedPath)) {
14319
15022
  continue;
14320
15023
  }
@@ -14330,18 +15033,18 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
14330
15033
  // src/commands/client/agent.ts
14331
15034
  import fs13 from "node:fs/promises";
14332
15035
  import os2 from "node:os";
14333
- import path16 from "node:path";
15036
+ import path17 from "node:path";
14334
15037
  import { fileURLToPath as fileURLToPath4 } from "node:url";
14335
- var __moduleDir = path16.dirname(fileURLToPath4(import.meta.url));
15038
+ var __moduleDir = path17.dirname(fileURLToPath4(import.meta.url));
14336
15039
  function codexSkillsHome() {
14337
15040
  const fromEnv = process.env.CODEX_HOME?.trim();
14338
- const base = fromEnv && fromEnv.length > 0 ? fromEnv : path16.join(os2.homedir(), ".codex");
14339
- return path16.join(base, "skills");
15041
+ const base = fromEnv && fromEnv.length > 0 ? fromEnv : path17.join(os2.homedir(), ".codex");
15042
+ return path17.join(base, "skills");
14340
15043
  }
14341
15044
  function claudeSkillsHome() {
14342
15045
  const fromEnv = process.env.CLAUDE_HOME?.trim();
14343
- const base = fromEnv && fromEnv.length > 0 ? fromEnv : path16.join(os2.homedir(), ".claude");
14344
- return path16.join(base, "skills");
15046
+ const base = fromEnv && fromEnv.length > 0 ? fromEnv : path17.join(os2.homedir(), ".claude");
15047
+ return path17.join(base, "skills");
14345
15048
  }
14346
15049
  async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
14347
15050
  const summary = {
@@ -14360,8 +15063,8 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
14360
15063
  );
14361
15064
  for (const entry of entries) {
14362
15065
  if (!entry.isDirectory()) continue;
14363
- const source = path16.join(sourceSkillsDir, entry.name);
14364
- const target = path16.join(targetSkillsDir, entry.name);
15066
+ const source = path17.join(sourceSkillsDir, entry.name);
15067
+ const target = path17.join(targetSkillsDir, entry.name);
14365
15068
  const existing = await fs13.lstat(target).catch(() => null);
14366
15069
  if (existing) {
14367
15070
  if (existing.isSymbolicLink()) {
@@ -14382,7 +15085,7 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
14382
15085
  continue;
14383
15086
  }
14384
15087
  }
14385
- const resolvedLinkedPath = path16.isAbsolute(linkedPath) ? linkedPath : path16.resolve(path16.dirname(target), linkedPath);
15088
+ const resolvedLinkedPath = path17.isAbsolute(linkedPath) ? linkedPath : path17.resolve(path17.dirname(target), linkedPath);
14386
15089
  const linkedTargetExists = await fs13.stat(resolvedLinkedPath).then(() => true).catch(() => false);
14387
15090
  if (!linkedTargetExists) {
14388
15091
  await fs13.unlink(target);
@@ -14662,7 +15365,7 @@ function registerAgentCommands(program) {
14662
15365
  }
14663
15366
  const installSummaries = [];
14664
15367
  if (opts.installSkills !== false) {
14665
- const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path16.resolve(process.cwd(), "skills")]);
15368
+ const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path17.resolve(process.cwd(), "skills")]);
14666
15369
  if (!skillsDir) {
14667
15370
  throw new Error(
14668
15371
  "Could not locate local Rudder skills directory. Expected ./skills in the repo checkout."
@@ -14919,8 +15622,8 @@ function registerActivityCommands(program) {
14919
15622
  if (opts.entityType) params.set("entityType", opts.entityType);
14920
15623
  if (opts.entityId) params.set("entityId", opts.entityId);
14921
15624
  const query = params.toString();
14922
- const path22 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
14923
- const rows = await ctx.api.get(path22) ?? [];
15625
+ const path23 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
15626
+ const rows = await ctx.api.get(path23) ?? [];
14924
15627
  if (ctx.json) {
14925
15628
  printOutput(rows, { json: true });
14926
15629
  return;
@@ -15089,11 +15792,11 @@ function parseCsv4(value) {
15089
15792
 
15090
15793
  // src/config/data-dir.ts
15091
15794
  init_home();
15092
- import path17 from "node:path";
15795
+ import path18 from "node:path";
15093
15796
  function applyDataDirOverride(options, support = {}) {
15094
15797
  const rawDataDir = options.dataDir?.trim();
15095
15798
  if (!rawDataDir) return null;
15096
- const resolvedDataDir = path17.resolve(expandHomePrefix(rawDataDir));
15799
+ const resolvedDataDir = path18.resolve(expandHomePrefix(rawDataDir));
15097
15800
  process.env.RUDDER_HOME = resolvedDataDir;
15098
15801
  if (support.hasConfigOption) {
15099
15802
  const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
@@ -15130,7 +15833,7 @@ import {
15130
15833
  mkdirSync as mkdirSync3,
15131
15834
  promises as fsPromises,
15132
15835
  readdirSync as readdirSync2,
15133
- readFileSync as readFileSync2,
15836
+ readFileSync as readFileSync3,
15134
15837
  readlinkSync,
15135
15838
  rmSync,
15136
15839
  statSync as statSync2,
@@ -15138,7 +15841,7 @@ import {
15138
15841
  writeFileSync
15139
15842
  } from "node:fs";
15140
15843
  import os3 from "node:os";
15141
- import path19 from "node:path";
15844
+ import path20 from "node:path";
15142
15845
  import { execFileSync as execFileSync2 } from "node:child_process";
15143
15846
  import { createServer } from "node:net";
15144
15847
  import { Readable as Readable2 } from "node:stream";
@@ -15149,7 +15852,7 @@ import { and as and2, eq as eq2, inArray, sql as sql3 } from "drizzle-orm";
15149
15852
  // src/commands/worktree-lib.ts
15150
15853
  init_home();
15151
15854
  import { randomInt } from "node:crypto";
15152
- import path18 from "node:path";
15855
+ import path19 from "node:path";
15153
15856
  var DEFAULT_WORKTREE_HOME = "~/.rudder-worktrees";
15154
15857
  var WORKTREE_SEED_MODES = ["minimal", "full"];
15155
15858
  var MINIMAL_WORKTREE_EXCLUDED_TABLES = [
@@ -15197,7 +15900,7 @@ function sanitizeWorktreeInstanceId(rawValue) {
15197
15900
  return normalized || "worktree";
15198
15901
  }
15199
15902
  function resolveSuggestedWorktreeName(cwd, explicitName) {
15200
- return nonEmpty(explicitName) ?? path18.basename(path18.resolve(cwd));
15903
+ return nonEmpty(explicitName) ?? path19.basename(path19.resolve(cwd));
15201
15904
  }
15202
15905
  function hslComponentToHex(n) {
15203
15906
  return Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
@@ -15237,24 +15940,24 @@ function generateWorktreeColor() {
15237
15940
  return hslToHex(randomInt(0, 360), 68, 56);
15238
15941
  }
15239
15942
  function resolveWorktreeLocalPaths(opts) {
15240
- const cwd = path18.resolve(opts.cwd);
15241
- const homeDir = path18.resolve(expandHomePrefix(opts.homeDir ?? DEFAULT_WORKTREE_HOME));
15242
- const instanceRoot = path18.resolve(homeDir, "instances", opts.instanceId);
15243
- const repoConfigDir = path18.resolve(cwd, ".rudder");
15943
+ const cwd = path19.resolve(opts.cwd);
15944
+ const homeDir = path19.resolve(expandHomePrefix(opts.homeDir ?? DEFAULT_WORKTREE_HOME));
15945
+ const instanceRoot = path19.resolve(homeDir, "instances", opts.instanceId);
15946
+ const repoConfigDir = path19.resolve(cwd, ".rudder");
15244
15947
  return {
15245
15948
  cwd,
15246
15949
  repoConfigDir,
15247
- configPath: path18.resolve(repoConfigDir, "config.json"),
15248
- envPath: path18.resolve(repoConfigDir, ".env"),
15950
+ configPath: path19.resolve(repoConfigDir, "config.json"),
15951
+ envPath: path19.resolve(repoConfigDir, ".env"),
15249
15952
  homeDir,
15250
15953
  instanceId: opts.instanceId,
15251
15954
  instanceRoot,
15252
- contextPath: path18.resolve(homeDir, "context.json"),
15253
- embeddedPostgresDataDir: path18.resolve(instanceRoot, "db"),
15254
- backupDir: path18.resolve(instanceRoot, "data", "backups"),
15255
- logDir: path18.resolve(instanceRoot, "logs"),
15256
- secretsKeyFilePath: path18.resolve(instanceRoot, "secrets", "master.key"),
15257
- storageDir: path18.resolve(instanceRoot, "data", "storage")
15955
+ contextPath: path19.resolve(homeDir, "context.json"),
15956
+ embeddedPostgresDataDir: path19.resolve(instanceRoot, "db"),
15957
+ backupDir: path19.resolve(instanceRoot, "data", "backups"),
15958
+ logDir: path19.resolve(instanceRoot, "logs"),
15959
+ secretsKeyFilePath: path19.resolve(instanceRoot, "secrets", "master.key"),
15960
+ storageDir: path19.resolve(instanceRoot, "data", "storage")
15258
15961
  };
15259
15962
  }
15260
15963
  function rewriteLocalUrlPort(rawUrl, port) {
@@ -15778,7 +16481,7 @@ function isCurrentSourceConfigPath(sourceConfigPath) {
15778
16481
  if (!currentConfigPath || currentConfigPath.trim().length === 0) {
15779
16482
  return false;
15780
16483
  }
15781
- return path19.resolve(currentConfigPath) === path19.resolve(sourceConfigPath);
16484
+ return path20.resolve(currentConfigPath) === path20.resolve(sourceConfigPath);
15782
16485
  }
15783
16486
  var WORKTREE_NAME_PREFIX = "rudder-";
15784
16487
  function resolveWorktreeMakeName(name) {
@@ -15816,9 +16519,9 @@ function normalizeStorageObjectKey(objectKey) {
15816
16519
  return parts.join("/");
15817
16520
  }
15818
16521
  function resolveLocalStoragePath(baseDir, objectKey) {
15819
- const resolved = path19.resolve(baseDir, normalizeStorageObjectKey(objectKey));
15820
- const root = path19.resolve(baseDir);
15821
- if (resolved !== root && !resolved.startsWith(`${root}${path19.sep}`)) {
16522
+ const resolved = path20.resolve(baseDir, normalizeStorageObjectKey(objectKey));
16523
+ const root = path20.resolve(baseDir);
16524
+ if (resolved !== root && !resolved.startsWith(`${root}${path20.sep}`)) {
15822
16525
  throw new Error("Invalid object key path.");
15823
16526
  }
15824
16527
  return resolved;
@@ -15869,7 +16572,7 @@ function createConfiguredStorageFromRudderConfig(config) {
15869
16572
  async putObject(orgId, objectKey, body) {
15870
16573
  assertStorageCompanyPrefix(orgId, objectKey);
15871
16574
  const filePath = resolveLocalStoragePath(baseDir, objectKey);
15872
- await fsPromises.mkdir(path19.dirname(filePath), { recursive: true });
16575
+ await fsPromises.mkdir(path20.dirname(filePath), { recursive: true });
15873
16576
  await fsPromises.writeFile(filePath, body);
15874
16577
  }
15875
16578
  };
@@ -15953,7 +16656,7 @@ async function readSourceAttachmentBody(sourceStorages, orgId, objectKey) {
15953
16656
  return null;
15954
16657
  }
15955
16658
  function resolveWorktreeMakeTargetPath(name) {
15956
- return path19.resolve(os3.homedir(), resolveWorktreeMakeName(name));
16659
+ return path20.resolve(os3.homedir(), resolveWorktreeMakeName(name));
15957
16660
  }
15958
16661
  function extractExecSyncErrorMessage(error) {
15959
16662
  if (!error || typeof error !== "object") {
@@ -15989,7 +16692,7 @@ function resolveGitWorktreeAddArgs(input) {
15989
16692
  function readPidFilePort(postmasterPidFile) {
15990
16693
  if (!existsSync3(postmasterPidFile)) return null;
15991
16694
  try {
15992
- const lines = readFileSync2(postmasterPidFile, "utf8").split("\n");
16695
+ const lines = readFileSync3(postmasterPidFile, "utf8").split("\n");
15993
16696
  const port = Number(lines[3]?.trim());
15994
16697
  return Number.isInteger(port) && port > 0 ? port : null;
15995
16698
  } catch {
@@ -15999,7 +16702,7 @@ function readPidFilePort(postmasterPidFile) {
15999
16702
  function readRunningPostmasterPid(postmasterPidFile) {
16000
16703
  if (!existsSync3(postmasterPidFile)) return null;
16001
16704
  try {
16002
- const pid = Number(readFileSync2(postmasterPidFile, "utf8").split("\n")[0]?.trim());
16705
+ const pid = Number(readFileSync3(postmasterPidFile, "utf8").split("\n")[0]?.trim());
16003
16706
  if (!Number.isInteger(pid) || pid <= 0) return null;
16004
16707
  process.kill(pid, 0);
16005
16708
  return pid;
@@ -16059,10 +16762,10 @@ function detectGitWorkspaceInfo(cwd) {
16059
16762
  stdio: ["ignore", "pipe", "ignore"]
16060
16763
  }).trim();
16061
16764
  return {
16062
- root: path19.resolve(root),
16063
- commonDir: path19.resolve(root, commonDirRaw),
16064
- gitDir: path19.resolve(root, gitDirRaw),
16065
- hooksPath: path19.resolve(root, hooksPathRaw)
16765
+ root: path20.resolve(root),
16766
+ commonDir: path20.resolve(root, commonDirRaw),
16767
+ gitDir: path20.resolve(root, gitDirRaw),
16768
+ hooksPath: path20.resolve(root, hooksPathRaw)
16066
16769
  };
16067
16770
  } catch {
16068
16771
  return null;
@@ -16075,8 +16778,8 @@ function copyDirectoryContents(sourceDir, targetDir) {
16075
16778
  mkdirSync3(targetDir, { recursive: true });
16076
16779
  let copied = false;
16077
16780
  for (const entry of entries) {
16078
- const sourcePath = path19.resolve(sourceDir, entry.name);
16079
- const targetPath = path19.resolve(targetDir, entry.name);
16781
+ const sourcePath = path20.resolve(sourceDir, entry.name);
16782
+ const targetPath = path20.resolve(targetDir, entry.name);
16080
16783
  if (entry.isDirectory()) {
16081
16784
  mkdirSync3(targetPath, { recursive: true });
16082
16785
  copyDirectoryContents(sourcePath, targetPath);
@@ -16102,7 +16805,7 @@ function copyGitHooksToWorktreeGitDir(cwd) {
16102
16805
  const workspace = detectGitWorkspaceInfo(cwd);
16103
16806
  if (!workspace) return null;
16104
16807
  const sourceHooksPath = workspace.hooksPath;
16105
- const targetHooksPath = path19.resolve(workspace.gitDir, "hooks");
16808
+ const targetHooksPath = path20.resolve(workspace.gitDir, "hooks");
16106
16809
  if (sourceHooksPath === targetHooksPath) {
16107
16810
  return {
16108
16811
  sourceHooksPath,
@@ -16117,17 +16820,17 @@ function copyGitHooksToWorktreeGitDir(cwd) {
16117
16820
  };
16118
16821
  }
16119
16822
  function rebindWorkspaceCwd(input) {
16120
- const sourceRepoRoot = path19.resolve(input.sourceRepoRoot);
16121
- const targetRepoRoot = path19.resolve(input.targetRepoRoot);
16122
- const workspaceCwd = path19.resolve(input.workspaceCwd);
16123
- const relative = path19.relative(sourceRepoRoot, workspaceCwd);
16823
+ const sourceRepoRoot = path20.resolve(input.sourceRepoRoot);
16824
+ const targetRepoRoot = path20.resolve(input.targetRepoRoot);
16825
+ const workspaceCwd = path20.resolve(input.workspaceCwd);
16826
+ const relative = path20.relative(sourceRepoRoot, workspaceCwd);
16124
16827
  if (!relative || relative === "") {
16125
16828
  return targetRepoRoot;
16126
16829
  }
16127
- if (relative.startsWith("..") || path19.isAbsolute(relative)) {
16830
+ if (relative.startsWith("..") || path20.isAbsolute(relative)) {
16128
16831
  return null;
16129
16832
  }
16130
- return path19.resolve(targetRepoRoot, relative);
16833
+ return path20.resolve(targetRepoRoot, relative);
16131
16834
  }
16132
16835
  async function rebindSeededProjectWorkspaces(input) {
16133
16836
  const targetRepo = detectGitWorkspaceInfo(input.currentCwd);
@@ -16153,7 +16856,7 @@ async function rebindSeededProjectWorkspaces(input) {
16153
16856
  workspaceCwd
16154
16857
  });
16155
16858
  if (!reboundCwd) continue;
16156
- const normalizedCurrent = path19.resolve(workspaceCwd);
16859
+ const normalizedCurrent = path20.resolve(workspaceCwd);
16157
16860
  if (reboundCwd === normalizedCurrent) continue;
16158
16861
  if (!existsSync3(reboundCwd)) continue;
16159
16862
  await db.update(projectWorkspaces).set({
@@ -16172,14 +16875,14 @@ async function rebindSeededProjectWorkspaces(input) {
16172
16875
  }
16173
16876
  }
16174
16877
  function resolveSourceConfigPath(opts) {
16175
- if (opts.sourceConfigPathOverride) return path19.resolve(opts.sourceConfigPathOverride);
16176
- if (opts.fromConfig) return path19.resolve(opts.fromConfig);
16878
+ if (opts.sourceConfigPathOverride) return path20.resolve(opts.sourceConfigPathOverride);
16879
+ if (opts.fromConfig) return path20.resolve(opts.fromConfig);
16177
16880
  if (!opts.fromDataDir && !opts.fromInstance) {
16178
16881
  return resolveConfigPath();
16179
16882
  }
16180
- const sourceHome = path19.resolve(expandHomePrefix(opts.fromDataDir ?? "~/.rudder"));
16883
+ const sourceHome = path20.resolve(expandHomePrefix(opts.fromDataDir ?? "~/.rudder"));
16181
16884
  const sourceInstanceId = sanitizeWorktreeInstanceId(opts.fromInstance ?? "default");
16182
- return path19.resolve(sourceHome, "instances", sourceInstanceId, "config.json");
16885
+ return path20.resolve(sourceHome, "instances", sourceInstanceId, "config.json");
16183
16886
  }
16184
16887
  function resolveSourceConnectionString(config, envEntries, portOverride) {
16185
16888
  if (config.database.mode === "postgres") {
@@ -16198,7 +16901,7 @@ function copySeededSecretsKey(input) {
16198
16901
  if (input.sourceConfig.secrets.provider !== "local_encrypted") {
16199
16902
  return;
16200
16903
  }
16201
- mkdirSync3(path19.dirname(input.targetKeyFilePath), { recursive: true });
16904
+ mkdirSync3(path20.dirname(input.targetKeyFilePath), { recursive: true });
16202
16905
  const allowProcessEnvFallback = isCurrentSourceConfigPath(input.sourceConfigPath);
16203
16906
  const sourceInlineMasterKey = nonEmpty2(input.sourceEnvEntries.RUDDER_SECRETS_MASTER_KEY) ?? (allowProcessEnvFallback ? nonEmpty2(process.env.RUDDER_SECRETS_MASTER_KEY) : null);
16204
16907
  if (sourceInlineMasterKey) {
@@ -16237,7 +16940,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
16237
16940
  "Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again."
16238
16941
  );
16239
16942
  }
16240
- const postmasterPidFile = path19.resolve(dataDir, "postmaster.pid");
16943
+ const postmasterPidFile = path20.resolve(dataDir, "postmaster.pid");
16241
16944
  const runningPid = readRunningPostmasterPid(postmasterPidFile);
16242
16945
  if (runningPid) {
16243
16946
  return {
@@ -16260,7 +16963,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
16260
16963
  onError: () => {
16261
16964
  }
16262
16965
  });
16263
- if (!existsSync3(path19.resolve(dataDir, "PG_VERSION"))) {
16966
+ if (!existsSync3(path20.resolve(dataDir, "PG_VERSION"))) {
16264
16967
  await instance.initialise();
16265
16968
  }
16266
16969
  if (existsSync3(postmasterPidFile)) {
@@ -16301,7 +17004,7 @@ async function seedWorktreeDatabase(input) {
16301
17004
  );
16302
17005
  const backup = await runDatabaseBackup({
16303
17006
  connectionString: sourceConnectionString,
16304
- backupDir: path19.resolve(input.targetPaths.backupDir, "seed"),
17007
+ backupDir: path20.resolve(input.targetPaths.backupDir, "seed"),
16305
17008
  retentionDays: 7,
16306
17009
  filenamePrefix: `${input.instanceId}-seed`,
16307
17010
  includeMigrationJournal: true,
@@ -16399,8 +17102,8 @@ async function runWorktreeInit(opts) {
16399
17102
  `Cannot seed worktree database because source config was not found at ${sourceConfigPath}. Use --no-seed or provide --from-config.`
16400
17103
  );
16401
17104
  }
16402
- const spinner4 = p17.spinner();
16403
- spinner4.start(`Seeding isolated worktree database from source instance (${seedMode})...`);
17105
+ const spinner5 = p17.spinner();
17106
+ spinner5.start(`Seeding isolated worktree database from source instance (${seedMode})...`);
16404
17107
  try {
16405
17108
  const seeded = await seedWorktreeDatabase({
16406
17109
  sourceConfigPath,
@@ -16412,9 +17115,9 @@ async function runWorktreeInit(opts) {
16412
17115
  });
16413
17116
  seedSummary = seeded.backupSummary;
16414
17117
  reboundWorkspaceSummary = seeded.reboundWorkspaces;
16415
- spinner4.stop(`Seeded isolated worktree database (${seedMode}).`);
17118
+ spinner5.stop(`Seeded isolated worktree database (${seedMode}).`);
16416
17119
  } catch (error) {
16417
- spinner4.stop(pc23.red("Failed to seed worktree database."));
17120
+ spinner5.stop(pc23.red("Failed to seed worktree database."));
16418
17121
  throw error;
16419
17122
  }
16420
17123
  }
@@ -16460,7 +17163,7 @@ async function worktreeMakeCommand(nameArg, opts) {
16460
17163
  if (existsSync3(targetPath)) {
16461
17164
  throw new Error(`Target path already exists: ${targetPath}`);
16462
17165
  }
16463
- mkdirSync3(path19.dirname(targetPath), { recursive: true });
17166
+ mkdirSync3(path20.dirname(targetPath), { recursive: true });
16464
17167
  if (startPoint) {
16465
17168
  const [remote] = startPoint.split("/", 1);
16466
17169
  try {
@@ -16480,16 +17183,16 @@ async function worktreeMakeCommand(nameArg, opts) {
16480
17183
  branchExists: !startPoint && localBranchExists(sourceCwd, name),
16481
17184
  startPoint
16482
17185
  });
16483
- const spinner4 = p17.spinner();
16484
- spinner4.start(`Creating git worktree at ${targetPath}...`);
17186
+ const spinner5 = p17.spinner();
17187
+ spinner5.start(`Creating git worktree at ${targetPath}...`);
16485
17188
  try {
16486
17189
  execFileSync2("git", worktreeArgs, {
16487
17190
  cwd: sourceCwd,
16488
17191
  stdio: ["ignore", "pipe", "pipe"]
16489
17192
  });
16490
- spinner4.stop(`Created git worktree at ${targetPath}.`);
17193
+ spinner5.stop(`Created git worktree at ${targetPath}.`);
16491
17194
  } catch (error) {
16492
- spinner4.stop(pc23.red("Failed to create git worktree."));
17195
+ spinner5.stop(pc23.red("Failed to create git worktree."));
16493
17196
  throw new Error(extractExecSyncErrorMessage(error) ?? String(error));
16494
17197
  }
16495
17198
  const installSpinner = p17.spinner();
@@ -16556,15 +17259,15 @@ function parseGitWorktreeList(cwd) {
16556
17259
  return entries;
16557
17260
  }
16558
17261
  function toMergeSourceChoices(cwd) {
16559
- const currentCwd = path19.resolve(cwd);
17262
+ const currentCwd = path20.resolve(cwd);
16560
17263
  return parseGitWorktreeList(cwd).map((entry) => {
16561
17264
  const branchLabel = entry.branch?.replace(/^refs\/heads\//, "") ?? "(detached)";
16562
- const worktreePath = path19.resolve(entry.worktree);
17265
+ const worktreePath = path20.resolve(entry.worktree);
16563
17266
  return {
16564
17267
  worktree: worktreePath,
16565
17268
  branch: entry.branch,
16566
17269
  branchLabel,
16567
- hasRudderConfig: existsSync3(path19.resolve(worktreePath, ".rudder", "config.json")),
17270
+ hasRudderConfig: existsSync3(path20.resolve(worktreePath, ".rudder", "config.json")),
16568
17271
  isCurrent: worktreePath === currentCwd
16569
17272
  };
16570
17273
  });
@@ -16612,14 +17315,14 @@ async function worktreeCleanupCommand(nameArg, opts) {
16612
17315
  const sourceCwd = process.cwd();
16613
17316
  const targetPath = resolveWorktreeMakeTargetPath(name);
16614
17317
  const instanceId = sanitizeWorktreeInstanceId(opts.instance ?? name);
16615
- const homeDir = path19.resolve(expandHomePrefix(resolveWorktreeHome(opts.home)));
16616
- const instanceRoot = path19.resolve(homeDir, "instances", instanceId);
17318
+ const homeDir = path20.resolve(expandHomePrefix(resolveWorktreeHome(opts.home)));
17319
+ const instanceRoot = path20.resolve(homeDir, "instances", instanceId);
16617
17320
  const hasBranch = localBranchExists(sourceCwd, name);
16618
17321
  const hasTargetDir = existsSync3(targetPath);
16619
17322
  const hasInstanceData = existsSync3(instanceRoot);
16620
17323
  const worktrees = parseGitWorktreeList(sourceCwd);
16621
17324
  const linkedWorktree = worktrees.find(
16622
- (wt) => wt.branch === `refs/heads/${name}` || path19.resolve(wt.worktree) === path19.resolve(targetPath)
17325
+ (wt) => wt.branch === `refs/heads/${name}` || path20.resolve(wt.worktree) === path20.resolve(targetPath)
16623
17326
  );
16624
17327
  if (!hasBranch && !hasTargetDir && !hasInstanceData && !linkedWorktree) {
16625
17328
  p17.log.info("Nothing to clean up \u2014 no branch, worktree directory, or instance data found.");
@@ -16657,9 +17360,9 @@ async function worktreeCleanupCommand(nameArg, opts) {
16657
17360
  }
16658
17361
  if (linkedWorktree) {
16659
17362
  const worktreeDirExists = existsSync3(linkedWorktree.worktree);
16660
- const spinner4 = p17.spinner();
17363
+ const spinner5 = p17.spinner();
16661
17364
  if (worktreeDirExists) {
16662
- spinner4.start(`Removing git worktree at ${linkedWorktree.worktree}...`);
17365
+ spinner5.start(`Removing git worktree at ${linkedWorktree.worktree}...`);
16663
17366
  try {
16664
17367
  const removeArgs = ["worktree", "remove", linkedWorktree.worktree];
16665
17368
  if (opts.force) removeArgs.push("--force");
@@ -16667,18 +17370,18 @@ async function worktreeCleanupCommand(nameArg, opts) {
16667
17370
  cwd: sourceCwd,
16668
17371
  stdio: ["ignore", "pipe", "pipe"]
16669
17372
  });
16670
- spinner4.stop(`Removed git worktree at ${linkedWorktree.worktree}.`);
17373
+ spinner5.stop(`Removed git worktree at ${linkedWorktree.worktree}.`);
16671
17374
  } catch (error) {
16672
- spinner4.stop(pc23.yellow(`Could not remove worktree cleanly, will prune instead.`));
17375
+ spinner5.stop(pc23.yellow(`Could not remove worktree cleanly, will prune instead.`));
16673
17376
  p17.log.warning(extractExecSyncErrorMessage(error) ?? String(error));
16674
17377
  }
16675
17378
  } else {
16676
- spinner4.start("Pruning stale worktree entry...");
17379
+ spinner5.start("Pruning stale worktree entry...");
16677
17380
  execFileSync2("git", ["worktree", "prune"], {
16678
17381
  cwd: sourceCwd,
16679
17382
  stdio: ["ignore", "pipe", "pipe"]
16680
17383
  });
16681
- spinner4.stop("Pruned stale worktree entry.");
17384
+ spinner5.stop("Pruned stale worktree entry.");
16682
17385
  }
16683
17386
  } else {
16684
17387
  execFileSync2("git", ["worktree", "prune"], {
@@ -16687,31 +17390,31 @@ async function worktreeCleanupCommand(nameArg, opts) {
16687
17390
  });
16688
17391
  }
16689
17392
  if (existsSync3(targetPath)) {
16690
- const spinner4 = p17.spinner();
16691
- spinner4.start(`Removing worktree directory ${targetPath}...`);
17393
+ const spinner5 = p17.spinner();
17394
+ spinner5.start(`Removing worktree directory ${targetPath}...`);
16692
17395
  rmSync(targetPath, { recursive: true, force: true });
16693
- spinner4.stop(`Removed worktree directory ${targetPath}.`);
17396
+ spinner5.stop(`Removed worktree directory ${targetPath}.`);
16694
17397
  }
16695
17398
  if (localBranchExists(sourceCwd, name)) {
16696
- const spinner4 = p17.spinner();
16697
- spinner4.start(`Deleting local branch "${name}"...`);
17399
+ const spinner5 = p17.spinner();
17400
+ spinner5.start(`Deleting local branch "${name}"...`);
16698
17401
  try {
16699
17402
  const deleteFlag = opts.force ? "-D" : "-d";
16700
17403
  execFileSync2("git", ["branch", deleteFlag, name], {
16701
17404
  cwd: sourceCwd,
16702
17405
  stdio: ["ignore", "pipe", "pipe"]
16703
17406
  });
16704
- spinner4.stop(`Deleted local branch "${name}".`);
17407
+ spinner5.stop(`Deleted local branch "${name}".`);
16705
17408
  } catch (error) {
16706
- spinner4.stop(pc23.yellow(`Could not delete branch "${name}".`));
17409
+ spinner5.stop(pc23.yellow(`Could not delete branch "${name}".`));
16707
17410
  p17.log.warning(extractExecSyncErrorMessage(error) ?? String(error));
16708
17411
  }
16709
17412
  }
16710
17413
  if (existsSync3(instanceRoot)) {
16711
- const spinner4 = p17.spinner();
16712
- spinner4.start(`Removing instance data at ${instanceRoot}...`);
17414
+ const spinner5 = p17.spinner();
17415
+ spinner5.start(`Removing instance data at ${instanceRoot}...`);
16713
17416
  rmSync(instanceRoot, { recursive: true, force: true });
16714
- spinner4.stop(`Removed instance data at ${instanceRoot}.`);
17417
+ spinner5.stop(`Removed instance data at ${instanceRoot}.`);
16715
17418
  }
16716
17419
  p17.outro(pc23.green("Cleanup complete."));
16717
17420
  }
@@ -16737,7 +17440,7 @@ async function closeDb(db) {
16737
17440
  }
16738
17441
  function resolveCurrentEndpoint() {
16739
17442
  return {
16740
- rootPath: path19.resolve(process.cwd()),
17443
+ rootPath: path20.resolve(process.cwd()),
16741
17444
  configPath: resolveConfigPath(),
16742
17445
  label: "current",
16743
17446
  isCurrent: true
@@ -16748,12 +17451,12 @@ function resolveAttachmentLookupStorages(input) {
16748
17451
  input.sourceEndpoint.configPath,
16749
17452
  resolveCurrentEndpoint().configPath,
16750
17453
  input.targetEndpoint.configPath,
16751
- ...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) => path19.resolve(choice.worktree, ".rudder", "config.json"))
17454
+ ...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) => path20.resolve(choice.worktree, ".rudder", "config.json"))
16752
17455
  ];
16753
17456
  const seen = /* @__PURE__ */ new Set();
16754
17457
  const storages = [];
16755
17458
  for (const configPath of orderedConfigPaths) {
16756
- const resolved = path19.resolve(configPath);
17459
+ const resolved = path20.resolve(configPath);
16757
17460
  if (seen.has(resolved) || !existsSync3(resolved)) continue;
16758
17461
  seen.add(resolved);
16759
17462
  storages.push(openConfiguredStorage(resolved));
@@ -17172,7 +17875,7 @@ function resolveEndpointFromChoice(choice) {
17172
17875
  }
17173
17876
  return {
17174
17877
  rootPath: choice.worktree,
17175
- configPath: path19.resolve(choice.worktree, ".rudder", "config.json"),
17878
+ configPath: path20.resolve(choice.worktree, ".rudder", "config.json"),
17176
17879
  label: choice.branchLabel,
17177
17880
  isCurrent: false
17178
17881
  };
@@ -17188,24 +17891,24 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
17188
17891
  return currentEndpoint;
17189
17892
  }
17190
17893
  const choices = toMergeSourceChoices(process.cwd());
17191
- const directPath = path19.resolve(trimmed);
17894
+ const directPath = path20.resolve(trimmed);
17192
17895
  if (existsSync3(directPath)) {
17193
17896
  if (allowCurrent && directPath === currentEndpoint.rootPath) {
17194
17897
  return currentEndpoint;
17195
17898
  }
17196
- const configPath = path19.resolve(directPath, ".rudder", "config.json");
17899
+ const configPath = path20.resolve(directPath, ".rudder", "config.json");
17197
17900
  if (!existsSync3(configPath)) {
17198
17901
  throw new Error(`Resolved worktree path ${directPath} does not contain .rudder/config.json.`);
17199
17902
  }
17200
17903
  return {
17201
17904
  rootPath: directPath,
17202
17905
  configPath,
17203
- label: path19.basename(directPath),
17906
+ label: path20.basename(directPath),
17204
17907
  isCurrent: false
17205
17908
  };
17206
17909
  }
17207
17910
  const matched = choices.find(
17208
- (choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath || path19.basename(choice.worktree) === trimmed || choice.branchLabel === trimmed)
17911
+ (choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath || path20.basename(choice.worktree) === trimmed || choice.branchLabel === trimmed)
17209
17912
  );
17210
17913
  if (!matched) {
17211
17914
  throw new Error(
@@ -17218,9 +17921,9 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
17218
17921
  return resolveEndpointFromChoice(matched);
17219
17922
  }
17220
17923
  async function promptForSourceEndpoint(excludeWorktreePath) {
17221
- const excluded = excludeWorktreePath ? path19.resolve(excludeWorktreePath) : null;
17924
+ const excluded = excludeWorktreePath ? path20.resolve(excludeWorktreePath) : null;
17222
17925
  const currentEndpoint = resolveCurrentEndpoint();
17223
- const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) => path19.resolve(choice.worktree) !== excluded).map((choice) => ({
17926
+ const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) => path20.resolve(choice.worktree) !== excluded).map((choice) => ({
17224
17927
  value: choice.isCurrent ? "__current__" : choice.worktree,
17225
17928
  label: choice.branchLabel,
17226
17929
  hint: `${choice.worktree}${choice.isCurrent ? " (current)" : ""}`
@@ -17544,7 +18247,7 @@ async function worktreeMergeHistoryCommand(sourceArg, opts) {
17544
18247
  }
17545
18248
  const targetEndpoint = opts.to ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true }) : resolveCurrentEndpoint();
17546
18249
  const sourceEndpoint = opts.from ? resolveWorktreeEndpointFromSelector(opts.from, { allowCurrent: true }) : sourceArg ? resolveWorktreeEndpointFromSelector(sourceArg, { allowCurrent: true }) : await promptForSourceEndpoint(targetEndpoint.rootPath);
17547
- if (path19.resolve(sourceEndpoint.configPath) === path19.resolve(targetEndpoint.configPath)) {
18250
+ if (path20.resolve(sourceEndpoint.configPath) === path20.resolve(targetEndpoint.configPath)) {
17548
18251
  throw new Error("Source and target Rudder configs are the same. Choose different --from/--to worktrees.");
17549
18252
  }
17550
18253
  const scopes = parseWorktreeMergeScopes(opts.scope);
@@ -17633,16 +18336,16 @@ function registerWorktreeCommands(program) {
17633
18336
  }
17634
18337
 
17635
18338
  // src/commands/client/plugin.ts
17636
- import path20 from "node:path";
18339
+ import path21 from "node:path";
17637
18340
  import pc24 from "picocolors";
17638
18341
  function resolvePackageArg(packageArg, isLocal) {
17639
18342
  if (!isLocal) return packageArg;
17640
- if (path20.isAbsolute(packageArg)) return packageArg;
18343
+ if (path21.isAbsolute(packageArg)) return packageArg;
17641
18344
  if (packageArg.startsWith("~")) {
17642
18345
  const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
17643
- return path20.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
18346
+ return path21.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
17644
18347
  }
17645
- return path20.resolve(process.cwd(), packageArg);
18348
+ return path21.resolve(process.cwd(), packageArg);
17646
18349
  }
17647
18350
  function formatPlugin(p18) {
17648
18351
  const statusColor = p18.status === "ready" ? pc24.green(p18.status) : p18.status === "error" ? pc24.red(p18.status) : p18.status === "disabled" ? pc24.dim(p18.status) : pc24.yellow(p18.status);
@@ -17914,7 +18617,7 @@ function registerClientAuthCommands(auth) {
17914
18617
 
17915
18618
  // src/commands/benchmark-create-agent.ts
17916
18619
  import fs14 from "node:fs/promises";
17917
- import path21 from "node:path";
18620
+ import path22 from "node:path";
17918
18621
  import { fileURLToPath as fileURLToPath5 } from "node:url";
17919
18622
  import { LangfuseClient } from "@langfuse/client";
17920
18623
 
@@ -18463,11 +19166,11 @@ function createAgentEvalCheckToScoreValue(check) {
18463
19166
  }
18464
19167
 
18465
19168
  // src/commands/benchmark-create-agent.ts
18466
- var __moduleDir2 = path21.dirname(fileURLToPath5(import.meta.url));
18467
- var repoRoot = path21.resolve(__moduleDir2, "../../..");
18468
- var defaultCasesDir = path21.join(repoRoot, "benchmark", "create-agent", "cases");
18469
- var defaultSetsDir = path21.join(repoRoot, "benchmark", "create-agent", "sets");
18470
- var defaultArtifactsDir = path21.join(repoRoot, ".artifacts", "create-agent-benchmark");
19169
+ var __moduleDir2 = path22.dirname(fileURLToPath5(import.meta.url));
19170
+ var repoRoot = path22.resolve(__moduleDir2, "../../..");
19171
+ var defaultCasesDir = path22.join(repoRoot, "benchmark", "create-agent", "cases");
19172
+ var defaultSetsDir = path22.join(repoRoot, "benchmark", "create-agent", "sets");
19173
+ var defaultArtifactsDir = path22.join(repoRoot, ".artifacts", "create-agent-benchmark");
18471
19174
  var TERMINAL_RUN_STATUSES2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
18472
19175
  var DEFAULT_JUDGE_PROMPT_NAME = "judge-create-agent";
18473
19176
  var DEFAULT_JUDGE_MODEL = "gpt-5-mini";
@@ -18517,16 +19220,16 @@ async function readJsonFile(filePath) {
18517
19220
  return JSON.parse(content);
18518
19221
  }
18519
19222
  async function writeJsonFile(filePath, value) {
18520
- await fs14.mkdir(path21.dirname(filePath), { recursive: true });
19223
+ await fs14.mkdir(path22.dirname(filePath), { recursive: true });
18521
19224
  await fs14.writeFile(filePath, `${JSON.stringify(value, null, 2)}
18522
19225
  `, "utf8");
18523
19226
  }
18524
19227
  async function loadCaseById(caseId, casesDir) {
18525
- const filePath = path21.join(casesDir, `${caseId}.json`);
19228
+ const filePath = path22.join(casesDir, `${caseId}.json`);
18526
19229
  return parseCreateAgentCase(await readJsonFile(filePath));
18527
19230
  }
18528
19231
  async function loadSet(setName, setsDir) {
18529
- const filePath = path21.join(setsDir, `${setName}.json`);
19232
+ const filePath = path22.join(setsDir, `${setName}.json`);
18530
19233
  const raw = await readJsonFile(filePath);
18531
19234
  if (!Array.isArray(raw) || raw.some((item) => typeof item !== "string")) {
18532
19235
  throw new Error(`Benchmark set ${setName} must be a JSON array of case IDs.`);
@@ -18614,13 +19317,13 @@ async function captureCreatedApprovals(api, approvals2) {
18614
19317
  );
18615
19318
  }
18616
19319
  function resultRunDir(artifactsDir, testCase, runId) {
18617
- return path21.join(artifactsDir, "runs", `${testCase.id}-${runId}`);
19320
+ return path22.join(artifactsDir, "runs", `${testCase.id}-${runId}`);
18618
19321
  }
18619
19322
  function resultJsonPath(artifactsDir, testCase, runId) {
18620
- return path21.join(resultRunDir(artifactsDir, testCase, runId), "result.json");
19323
+ return path22.join(resultRunDir(artifactsDir, testCase, runId), "result.json");
18621
19324
  }
18622
19325
  function reportMarkdownPath(artifactsDir, testCase, runId) {
18623
- return path21.join(resultRunDir(artifactsDir, testCase, runId), "report.md");
19326
+ return path22.join(resultRunDir(artifactsDir, testCase, runId), "report.md");
18624
19327
  }
18625
19328
  function averageJudgeScore(judge) {
18626
19329
  if (!judge || judge.status !== "completed") return null;
@@ -19029,7 +19732,7 @@ async function executeBenchmarkCase(caseId, opts) {
19029
19732
  const jsonPath = resultJsonPath(artifactsDir, testCase, runDetail.run.id);
19030
19733
  const markdownPath = reportMarkdownPath(artifactsDir, testCase, runDetail.run.id);
19031
19734
  await writeJsonFile(jsonPath, provisionalResult);
19032
- await fs14.mkdir(path21.dirname(markdownPath), { recursive: true });
19735
+ await fs14.mkdir(path22.dirname(markdownPath), { recursive: true });
19033
19736
  await fs14.writeFile(markdownPath, buildMarkdownReport(provisionalResult), "utf8");
19034
19737
  return provisionalResult;
19035
19738
  }
@@ -19052,7 +19755,7 @@ async function rescoreStoredResult(resultPath, opts) {
19052
19755
  result.langfuse.scoreSyncError = sync.scoreSyncError;
19053
19756
  }
19054
19757
  await writeJsonFile(resultPath, result);
19055
- await fs14.writeFile(path21.join(path21.dirname(resultPath), "report.md"), buildMarkdownReport(result), "utf8");
19758
+ await fs14.writeFile(path22.join(path22.dirname(resultPath), "report.md"), buildMarkdownReport(result), "utf8");
19056
19759
  return result;
19057
19760
  }
19058
19761
  function printBenchmarkSummary(result, json = false) {
@@ -19121,7 +19824,7 @@ function registerCreateAgentBenchmarkCommands(program) {
19121
19824
  addCommonClientOptions(
19122
19825
  createAgent.command("rescore").description("Re-run deterministic scoring and optional judge for an existing result.json").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--queue-id <id>", "Langfuse annotation queue id for low-quality runs").option("--judge-model <model>", "Override the judge model").option("--no-sync-langfuse", "Skip Langfuse score sync").option("--no-judge", "Skip optional quality judge").action(async (resultPath, opts) => {
19123
19826
  try {
19124
- const result = await rescoreStoredResult(path21.resolve(resultPath), opts);
19827
+ const result = await rescoreStoredResult(path22.resolve(resultPath), opts);
19125
19828
  printBenchmarkSummary(result, Boolean(opts.json));
19126
19829
  } catch (error) {
19127
19830
  handleCommandError(error);
@@ -19131,11 +19834,11 @@ function registerCreateAgentBenchmarkCommands(program) {
19131
19834
  addCommonClientOptions(
19132
19835
  createAgent.command("sync-langfuse").description("Sync one stored create-agent benchmark result to Langfuse").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--queue-id <id>", "Langfuse annotation queue id for low-quality runs").action(async (resultPath, opts) => {
19133
19836
  try {
19134
- const result = await readJsonFile(path21.resolve(resultPath));
19837
+ const result = await readJsonFile(path22.resolve(resultPath));
19135
19838
  const sync = await syncResultToLangfuse(result, { queueId: asString6(opts.queueId) });
19136
19839
  result.langfuse.scoreSync = sync.scoreSync;
19137
19840
  result.langfuse.scoreSyncError = sync.scoreSyncError;
19138
- await writeJsonFile(path21.resolve(resultPath), result);
19841
+ await writeJsonFile(path22.resolve(resultPath), result);
19139
19842
  printOutput({
19140
19843
  caseId: result.case.id,
19141
19844
  runId: result.runDetail.run.id,
@@ -19151,7 +19854,7 @@ function registerCreateAgentBenchmarkCommands(program) {
19151
19854
  addCommonClientOptions(
19152
19855
  createAgent.command("report").description("Render the markdown summary for an existing result.json").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--markdown", "Print report markdown instead of the parsed result summary", false).action(async (resultPath, opts) => {
19153
19856
  try {
19154
- const result = await readJsonFile(path21.resolve(resultPath));
19857
+ const result = await readJsonFile(path22.resolve(resultPath));
19155
19858
  if (opts.markdown) {
19156
19859
  process.stdout.write(buildMarkdownReport(result));
19157
19860
  return;
@@ -19173,7 +19876,7 @@ var DATA_DIR_OPTION_HELP = "Rudder data directory root (isolates state from ~/.r
19173
19876
  var LOCAL_ENV_OPTION_HELP = "Local environment profile (dev, prod_local, e2e)";
19174
19877
  function createProgram() {
19175
19878
  const program = new Command();
19176
- program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version("0.1.0-canary.2");
19879
+ program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version(resolveCliVersion());
19177
19880
  program.option("--local-env <name>", LOCAL_ENV_OPTION_HELP);
19178
19881
  program.hook("preAction", (_thisCommand, actionCommand) => {
19179
19882
  const options = actionCommand.optsWithGlobals();
@@ -19185,7 +19888,7 @@ function createProgram() {
19185
19888
  });
19186
19889
  loadRudderEnvFile(options.config);
19187
19890
  });
19188
- program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--no-cli", "Skip persistent CLI installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for the downloaded desktop installer").option("--no-open", "Download the desktop installer without opening it").option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
19891
+ program.command("start").description("Start Rudder Desktop and prepare the matching persistent CLI").option("--no-cli", "Skip persistent CLI installation").option("--no-desktop", "Skip desktop app installation").option("--version <version>", "Rudder version to start (default: current CLI version)").option("--repo <owner/repo>", "GitHub repository that hosts desktop releases").option("--output-dir <path>", "Directory for downloaded desktop release assets").option("--desktop-install-dir <path>", "Directory for the portable Desktop install").option("--no-open", "Install Desktop without launching it").option("--no-version-check", "Skip checking npm for a newer Rudder CLI version").option("--dry-run", "Print the start actions without changing the machine", false).action(startCommand);
19189
19892
  program.command("onboard").description("Interactive first-run setup wizard").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("-y, --yes", "Accept defaults (quickstart + start immediately)", false).option("--run", "Start Rudder immediately after saving config", false).action(onboard);
19190
19893
  program.command("doctor").description("Run diagnostic checks on your Rudder setup").option("-c, --config <path>", "Path to config file").option("-d, --data-dir <path>", DATA_DIR_OPTION_HELP).option("--repair", "Attempt to repair issues automatically").alias("--fix").option("-y, --yes", "Skip repair confirmation prompts").action(async (opts) => {
19191
19894
  await doctor(opts);