@rudderhq/cli 0.2.0-canary.2 → 0.2.0-canary.20
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 +842 -692
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -122,7 +122,7 @@ var init_constants = __esm({
|
|
|
122
122
|
"routing_suggestion",
|
|
123
123
|
"system_event"
|
|
124
124
|
];
|
|
125
|
-
CHAT_MESSAGE_STATUSES = ["completed", "stopped", "failed"];
|
|
125
|
+
CHAT_MESSAGE_STATUSES = ["streaming", "completed", "stopped", "failed", "interrupted"];
|
|
126
126
|
CHAT_CONTEXT_ENTITY_TYPES = ["issue", "project", "agent"];
|
|
127
127
|
GOAL_LEVELS = ["organization", "team", "agent", "task"];
|
|
128
128
|
GOAL_STATUSES = ["planned", "active", "achieved", "cancelled"];
|
|
@@ -495,302 +495,170 @@ var init_budget = __esm({
|
|
|
495
495
|
}
|
|
496
496
|
});
|
|
497
497
|
|
|
498
|
-
// ../packages/shared/src/validators/secret.ts
|
|
499
|
-
import { z as z3 } from "zod";
|
|
500
|
-
var envBindingPlainSchema, envBindingSecretRefSchema, envBindingSchema, envConfigSchema, createSecretSchema, rotateSecretSchema, updateSecretSchema;
|
|
501
|
-
var init_secret = __esm({
|
|
502
|
-
"../packages/shared/src/validators/secret.ts"() {
|
|
503
|
-
"use strict";
|
|
504
|
-
init_constants();
|
|
505
|
-
envBindingPlainSchema = z3.object({
|
|
506
|
-
type: z3.literal("plain"),
|
|
507
|
-
value: z3.string()
|
|
508
|
-
});
|
|
509
|
-
envBindingSecretRefSchema = z3.object({
|
|
510
|
-
type: z3.literal("secret_ref"),
|
|
511
|
-
secretId: z3.string().uuid(),
|
|
512
|
-
version: z3.union([z3.literal("latest"), z3.number().int().positive()]).optional()
|
|
513
|
-
});
|
|
514
|
-
envBindingSchema = z3.union([
|
|
515
|
-
z3.string(),
|
|
516
|
-
envBindingPlainSchema,
|
|
517
|
-
envBindingSecretRefSchema
|
|
518
|
-
]);
|
|
519
|
-
envConfigSchema = z3.record(envBindingSchema);
|
|
520
|
-
createSecretSchema = z3.object({
|
|
521
|
-
name: z3.string().min(1),
|
|
522
|
-
provider: z3.enum(SECRET_PROVIDERS).optional(),
|
|
523
|
-
value: z3.string().min(1),
|
|
524
|
-
description: z3.string().optional().nullable(),
|
|
525
|
-
externalRef: z3.string().optional().nullable()
|
|
526
|
-
});
|
|
527
|
-
rotateSecretSchema = z3.object({
|
|
528
|
-
value: z3.string().min(1),
|
|
529
|
-
externalRef: z3.string().optional().nullable()
|
|
530
|
-
});
|
|
531
|
-
updateSecretSchema = z3.object({
|
|
532
|
-
name: z3.string().min(1).optional(),
|
|
533
|
-
description: z3.string().optional().nullable(),
|
|
534
|
-
externalRef: z3.string().optional().nullable()
|
|
535
|
-
});
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
// ../packages/shared/src/validators/model-fallbacks.ts
|
|
540
|
-
import { z as z4 } from "zod";
|
|
541
|
-
function isRecord(value) {
|
|
542
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
543
|
-
}
|
|
544
|
-
function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
545
|
-
const fallbackModels = value.modelFallbacks;
|
|
546
|
-
if (fallbackModels === void 0) return;
|
|
547
|
-
if (!Array.isArray(fallbackModels)) {
|
|
548
|
-
ctx.addIssue({
|
|
549
|
-
code: z4.ZodIssueCode.custom,
|
|
550
|
-
message: "modelFallbacks must be an array",
|
|
551
|
-
path: [...pathPrefix, "modelFallbacks"]
|
|
552
|
-
});
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
fallbackModels.forEach((fallback, index66) => {
|
|
556
|
-
if (typeof fallback === "string") {
|
|
557
|
-
if (fallback.trim().length === 0) {
|
|
558
|
-
ctx.addIssue({
|
|
559
|
-
code: z4.ZodIssueCode.custom,
|
|
560
|
-
message: "modelFallbacks string entries must be non-empty",
|
|
561
|
-
path: [...pathPrefix, "modelFallbacks", index66]
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
if (!isRecord(fallback)) {
|
|
567
|
-
ctx.addIssue({
|
|
568
|
-
code: z4.ZodIssueCode.custom,
|
|
569
|
-
message: "modelFallbacks entries must be strings or runtime/model objects",
|
|
570
|
-
path: [...pathPrefix, "modelFallbacks", index66]
|
|
571
|
-
});
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
if (typeof fallback.agentRuntimeType !== "string" || fallback.agentRuntimeType.trim().length === 0) {
|
|
575
|
-
ctx.addIssue({
|
|
576
|
-
code: z4.ZodIssueCode.custom,
|
|
577
|
-
message: "modelFallbacks entries must include agentRuntimeType",
|
|
578
|
-
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
579
|
-
});
|
|
580
|
-
} else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
|
|
581
|
-
ctx.addIssue({
|
|
582
|
-
code: z4.ZodIssueCode.custom,
|
|
583
|
-
message: "modelFallbacks entries must include a valid agentRuntimeType",
|
|
584
|
-
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
|
|
588
|
-
ctx.addIssue({
|
|
589
|
-
code: z4.ZodIssueCode.custom,
|
|
590
|
-
message: "modelFallbacks entries must include model",
|
|
591
|
-
path: [...pathPrefix, "modelFallbacks", index66, "model"]
|
|
592
|
-
});
|
|
593
|
-
}
|
|
594
|
-
if (fallback.config !== void 0 && !isRecord(fallback.config)) {
|
|
595
|
-
ctx.addIssue({
|
|
596
|
-
code: z4.ZodIssueCode.custom,
|
|
597
|
-
message: "modelFallbacks entry config must be an object",
|
|
598
|
-
path: [...pathPrefix, "modelFallbacks", index66, "config"]
|
|
599
|
-
});
|
|
600
|
-
} else if (isRecord(fallback.config) && fallback.config.env !== void 0) {
|
|
601
|
-
const parsed = envConfigSchema.safeParse(fallback.config.env);
|
|
602
|
-
if (!parsed.success) {
|
|
603
|
-
ctx.addIssue({
|
|
604
|
-
code: z4.ZodIssueCode.custom,
|
|
605
|
-
message: "modelFallbacks entry config.env must be a map of valid env bindings",
|
|
606
|
-
path: [...pathPrefix, "modelFallbacks", index66, "config", "env"]
|
|
607
|
-
});
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
var agentRuntimeTypes;
|
|
613
|
-
var init_model_fallbacks = __esm({
|
|
614
|
-
"../packages/shared/src/validators/model-fallbacks.ts"() {
|
|
615
|
-
"use strict";
|
|
616
|
-
init_constants();
|
|
617
|
-
init_secret();
|
|
618
|
-
agentRuntimeTypes = new Set(AGENT_RUNTIME_TYPES);
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
|
|
622
498
|
// ../packages/shared/src/validators/organization.ts
|
|
623
|
-
import { z as
|
|
624
|
-
var logoAssetIdSchema, brandColorSchema,
|
|
499
|
+
import { z as z3 } from "zod";
|
|
500
|
+
var logoAssetIdSchema, brandColorSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
|
|
625
501
|
var init_organization = __esm({
|
|
626
502
|
"../packages/shared/src/validators/organization.ts"() {
|
|
627
503
|
"use strict";
|
|
628
504
|
init_constants();
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
name: z5.string().min(1),
|
|
637
|
-
description: z5.string().optional().nullable(),
|
|
638
|
-
budgetMonthlyCents: z5.number().int().nonnegative().optional().default(0),
|
|
639
|
-
defaultChatIssueCreationMode: z5.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
|
|
640
|
-
defaultChatAgentRuntimeType: z5.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
641
|
-
defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
|
|
505
|
+
logoAssetIdSchema = z3.string().uuid().nullable().optional();
|
|
506
|
+
brandColorSchema = z3.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
507
|
+
createOrganizationSchema = z3.object({
|
|
508
|
+
name: z3.string().min(1),
|
|
509
|
+
description: z3.string().optional().nullable(),
|
|
510
|
+
budgetMonthlyCents: z3.number().int().nonnegative().optional().default(0),
|
|
511
|
+
defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
|
|
642
512
|
brandColor: brandColorSchema,
|
|
643
|
-
requireBoardApprovalForNewAgents:
|
|
513
|
+
requireBoardApprovalForNewAgents: z3.boolean().optional()
|
|
644
514
|
});
|
|
645
515
|
updateOrganizationSchema = createOrganizationSchema.partial().extend({
|
|
646
|
-
status:
|
|
647
|
-
spentMonthlyCents:
|
|
648
|
-
requireBoardApprovalForNewAgents:
|
|
649
|
-
defaultChatIssueCreationMode:
|
|
650
|
-
defaultChatAgentRuntimeType: z5.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
651
|
-
defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
|
|
516
|
+
status: z3.enum(ORGANIZATION_STATUSES).optional(),
|
|
517
|
+
spentMonthlyCents: z3.number().int().nonnegative().optional(),
|
|
518
|
+
requireBoardApprovalForNewAgents: z3.boolean().optional(),
|
|
519
|
+
defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional(),
|
|
652
520
|
brandColor: brandColorSchema,
|
|
653
521
|
logoAssetId: logoAssetIdSchema
|
|
654
522
|
});
|
|
655
|
-
updateOrganizationBrandingSchema =
|
|
656
|
-
name:
|
|
657
|
-
description:
|
|
523
|
+
updateOrganizationBrandingSchema = z3.object({
|
|
524
|
+
name: z3.string().min(1).optional(),
|
|
525
|
+
description: z3.string().nullable().optional(),
|
|
658
526
|
brandColor: brandColorSchema,
|
|
659
527
|
logoAssetId: logoAssetIdSchema
|
|
660
528
|
}).strict().refine(
|
|
661
529
|
(value) => value.name !== void 0 || value.description !== void 0 || value.brandColor !== void 0 || value.logoAssetId !== void 0,
|
|
662
530
|
"At least one branding field must be provided"
|
|
663
531
|
);
|
|
664
|
-
updateOrganizationWorkspaceFileSchema =
|
|
665
|
-
content:
|
|
532
|
+
updateOrganizationWorkspaceFileSchema = z3.object({
|
|
533
|
+
content: z3.string()
|
|
666
534
|
});
|
|
667
535
|
}
|
|
668
536
|
});
|
|
669
537
|
|
|
670
538
|
// ../packages/shared/src/validators/resource.ts
|
|
671
|
-
import { z as
|
|
539
|
+
import { z as z4 } from "zod";
|
|
672
540
|
var organizationResourceKindSchema, projectResourceAttachmentRoleSchema, createOrganizationResourceSchema, updateOrganizationResourceSchema, projectResourceAttachmentInputSchema, updateProjectResourceAttachmentSchema, createProjectInlineResourceSchema;
|
|
673
541
|
var init_resource = __esm({
|
|
674
542
|
"../packages/shared/src/validators/resource.ts"() {
|
|
675
543
|
"use strict";
|
|
676
544
|
init_constants();
|
|
677
|
-
organizationResourceKindSchema =
|
|
678
|
-
projectResourceAttachmentRoleSchema =
|
|
679
|
-
createOrganizationResourceSchema =
|
|
680
|
-
name:
|
|
545
|
+
organizationResourceKindSchema = z4.enum(ORGANIZATION_RESOURCE_KINDS);
|
|
546
|
+
projectResourceAttachmentRoleSchema = z4.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
|
|
547
|
+
createOrganizationResourceSchema = z4.object({
|
|
548
|
+
name: z4.string().min(1),
|
|
681
549
|
kind: organizationResourceKindSchema,
|
|
682
|
-
locator:
|
|
683
|
-
description:
|
|
684
|
-
metadata:
|
|
550
|
+
locator: z4.string().min(1),
|
|
551
|
+
description: z4.string().optional().nullable(),
|
|
552
|
+
metadata: z4.record(z4.unknown()).optional().nullable()
|
|
685
553
|
});
|
|
686
|
-
updateOrganizationResourceSchema =
|
|
687
|
-
name:
|
|
554
|
+
updateOrganizationResourceSchema = z4.object({
|
|
555
|
+
name: z4.string().min(1).optional(),
|
|
688
556
|
kind: organizationResourceKindSchema.optional(),
|
|
689
|
-
locator:
|
|
690
|
-
description:
|
|
691
|
-
metadata:
|
|
557
|
+
locator: z4.string().min(1).optional(),
|
|
558
|
+
description: z4.string().optional().nullable(),
|
|
559
|
+
metadata: z4.record(z4.unknown()).optional().nullable()
|
|
692
560
|
}).strict();
|
|
693
|
-
projectResourceAttachmentInputSchema =
|
|
694
|
-
resourceId:
|
|
561
|
+
projectResourceAttachmentInputSchema = z4.object({
|
|
562
|
+
resourceId: z4.string().uuid(),
|
|
695
563
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
696
|
-
note:
|
|
697
|
-
sortOrder:
|
|
564
|
+
note: z4.string().optional().nullable(),
|
|
565
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
698
566
|
}).strict();
|
|
699
|
-
updateProjectResourceAttachmentSchema =
|
|
567
|
+
updateProjectResourceAttachmentSchema = z4.object({
|
|
700
568
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
701
|
-
note:
|
|
702
|
-
sortOrder:
|
|
569
|
+
note: z4.string().optional().nullable(),
|
|
570
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
703
571
|
}).strict();
|
|
704
572
|
createProjectInlineResourceSchema = createOrganizationResourceSchema.extend({
|
|
705
573
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
706
|
-
note:
|
|
707
|
-
sortOrder:
|
|
574
|
+
note: z4.string().optional().nullable(),
|
|
575
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
708
576
|
}).strict();
|
|
709
577
|
}
|
|
710
578
|
});
|
|
711
579
|
|
|
712
580
|
// ../packages/shared/src/validators/chat.ts
|
|
713
|
-
import { z as
|
|
581
|
+
import { z as z5 } from "zod";
|
|
714
582
|
var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
|
|
715
583
|
var init_chat = __esm({
|
|
716
584
|
"../packages/shared/src/validators/chat.ts"() {
|
|
717
585
|
"use strict";
|
|
718
586
|
init_constants();
|
|
719
|
-
chatConversationStatusSchema =
|
|
720
|
-
chatIssueCreationModeSchema =
|
|
721
|
-
chatMessageRoleSchema =
|
|
722
|
-
chatMessageKindSchema =
|
|
723
|
-
chatMessageStatusSchema =
|
|
724
|
-
chatContextEntityTypeSchema =
|
|
725
|
-
createChatContextLinkSchema =
|
|
587
|
+
chatConversationStatusSchema = z5.enum(CHAT_CONVERSATION_STATUSES);
|
|
588
|
+
chatIssueCreationModeSchema = z5.enum(CHAT_ISSUE_CREATION_MODES);
|
|
589
|
+
chatMessageRoleSchema = z5.enum(CHAT_MESSAGE_ROLES);
|
|
590
|
+
chatMessageKindSchema = z5.enum(CHAT_MESSAGE_KINDS);
|
|
591
|
+
chatMessageStatusSchema = z5.enum(CHAT_MESSAGE_STATUSES);
|
|
592
|
+
chatContextEntityTypeSchema = z5.enum(CHAT_CONTEXT_ENTITY_TYPES);
|
|
593
|
+
createChatContextLinkSchema = z5.object({
|
|
726
594
|
entityType: chatContextEntityTypeSchema,
|
|
727
|
-
entityId:
|
|
728
|
-
metadata:
|
|
595
|
+
entityId: z5.string().min(1),
|
|
596
|
+
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
729
597
|
});
|
|
730
|
-
createChatConversationSchema =
|
|
731
|
-
title:
|
|
732
|
-
summary:
|
|
733
|
-
preferredAgentId:
|
|
598
|
+
createChatConversationSchema = z5.object({
|
|
599
|
+
title: z5.string().trim().min(1).max(200).optional(),
|
|
600
|
+
summary: z5.string().trim().max(5e3).optional().nullable(),
|
|
601
|
+
preferredAgentId: z5.string().uuid().optional().nullable(),
|
|
734
602
|
issueCreationMode: chatIssueCreationModeSchema.optional(),
|
|
735
|
-
planMode:
|
|
736
|
-
contextLinks:
|
|
603
|
+
planMode: z5.boolean().optional(),
|
|
604
|
+
contextLinks: z5.array(createChatContextLinkSchema).optional().default([])
|
|
737
605
|
});
|
|
738
|
-
setChatProjectContextSchema =
|
|
739
|
-
projectId:
|
|
606
|
+
setChatProjectContextSchema = z5.object({
|
|
607
|
+
projectId: z5.string().uuid().optional().nullable()
|
|
740
608
|
});
|
|
741
609
|
updateChatConversationSchema = createChatConversationSchema.partial().extend({
|
|
742
610
|
status: chatConversationStatusSchema.optional(),
|
|
743
|
-
routedAgentId:
|
|
744
|
-
primaryIssueId:
|
|
745
|
-
resolvedAt:
|
|
611
|
+
routedAgentId: z5.string().uuid().optional().nullable(),
|
|
612
|
+
primaryIssueId: z5.string().uuid().optional().nullable(),
|
|
613
|
+
resolvedAt: z5.string().datetime().optional().nullable()
|
|
746
614
|
});
|
|
747
|
-
addChatMessageSchema =
|
|
748
|
-
body:
|
|
749
|
-
editUserMessageId:
|
|
615
|
+
addChatMessageSchema = z5.object({
|
|
616
|
+
body: z5.string().trim().min(1).max(2e4),
|
|
617
|
+
editUserMessageId: z5.string().uuid().optional().nullable()
|
|
750
618
|
});
|
|
751
|
-
createChatAttachmentMetadataSchema =
|
|
752
|
-
messageId:
|
|
619
|
+
createChatAttachmentMetadataSchema = z5.object({
|
|
620
|
+
messageId: z5.string().uuid()
|
|
753
621
|
});
|
|
754
|
-
chatIssueProposalSchema =
|
|
755
|
-
title:
|
|
756
|
-
description:
|
|
757
|
-
priority:
|
|
758
|
-
projectId:
|
|
759
|
-
goalId:
|
|
760
|
-
parentId:
|
|
761
|
-
assigneeAgentId:
|
|
762
|
-
assigneeUserId:
|
|
622
|
+
chatIssueProposalSchema = z5.object({
|
|
623
|
+
title: z5.string().trim().min(1).max(200),
|
|
624
|
+
description: z5.string().trim().min(1).max(2e4),
|
|
625
|
+
priority: z5.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
626
|
+
projectId: z5.string().uuid().optional().nullable(),
|
|
627
|
+
goalId: z5.string().uuid().optional().nullable(),
|
|
628
|
+
parentId: z5.string().uuid().optional().nullable(),
|
|
629
|
+
assigneeAgentId: z5.string().uuid().optional().nullable(),
|
|
630
|
+
assigneeUserId: z5.string().trim().optional().nullable()
|
|
763
631
|
});
|
|
764
|
-
convertChatToIssueSchema =
|
|
765
|
-
messageId:
|
|
632
|
+
convertChatToIssueSchema = z5.object({
|
|
633
|
+
messageId: z5.string().uuid().optional().nullable(),
|
|
766
634
|
proposal: chatIssueProposalSchema.optional()
|
|
767
635
|
});
|
|
768
|
-
chatOperationProposalSchema =
|
|
769
|
-
targetType:
|
|
770
|
-
targetId:
|
|
771
|
-
summary:
|
|
772
|
-
patch:
|
|
636
|
+
chatOperationProposalSchema = z5.object({
|
|
637
|
+
targetType: z5.enum(["organization", "agent"]),
|
|
638
|
+
targetId: z5.string().min(1),
|
|
639
|
+
summary: z5.string().trim().min(1).max(500),
|
|
640
|
+
patch: z5.record(z5.unknown())
|
|
773
641
|
});
|
|
774
|
-
resolveChatOperationProposalSchema =
|
|
775
|
-
action:
|
|
776
|
-
decisionNote:
|
|
642
|
+
resolveChatOperationProposalSchema = z5.object({
|
|
643
|
+
action: z5.enum(["approve", "reject", "requestRevision"]),
|
|
644
|
+
decisionNote: z5.string().trim().max(5e3).optional().nullable()
|
|
777
645
|
});
|
|
778
|
-
updateChatConversationUserStateSchema =
|
|
779
|
-
pinned:
|
|
646
|
+
updateChatConversationUserStateSchema = z5.object({
|
|
647
|
+
pinned: z5.boolean().optional()
|
|
780
648
|
});
|
|
781
649
|
}
|
|
782
650
|
});
|
|
783
651
|
|
|
784
652
|
// ../packages/shared/src/validators/organization-skill.ts
|
|
785
|
-
import { z as
|
|
653
|
+
import { z as z6 } from "zod";
|
|
786
654
|
var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
|
|
787
655
|
var init_organization_skill = __esm({
|
|
788
656
|
"../packages/shared/src/validators/organization-skill.ts"() {
|
|
789
657
|
"use strict";
|
|
790
|
-
organizationSkillSourceTypeSchema =
|
|
791
|
-
organizationSkillTrustLevelSchema =
|
|
792
|
-
organizationSkillCompatibilitySchema =
|
|
793
|
-
organizationSkillSourceBadgeSchema =
|
|
658
|
+
organizationSkillSourceTypeSchema = z6.enum(["local_path", "github", "url", "catalog", "skills_sh"]);
|
|
659
|
+
organizationSkillTrustLevelSchema = z6.enum(["markdown_only", "assets", "scripts_executables"]);
|
|
660
|
+
organizationSkillCompatibilitySchema = z6.enum(["compatible", "unknown", "invalid"]);
|
|
661
|
+
organizationSkillSourceBadgeSchema = z6.enum([
|
|
794
662
|
"rudder",
|
|
795
663
|
"community",
|
|
796
664
|
"github",
|
|
@@ -799,157 +667,157 @@ var init_organization_skill = __esm({
|
|
|
799
667
|
"catalog",
|
|
800
668
|
"skills_sh"
|
|
801
669
|
]);
|
|
802
|
-
organizationSkillFileInventoryEntrySchema =
|
|
803
|
-
path:
|
|
804
|
-
kind:
|
|
670
|
+
organizationSkillFileInventoryEntrySchema = z6.object({
|
|
671
|
+
path: z6.string().min(1),
|
|
672
|
+
kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"])
|
|
805
673
|
});
|
|
806
|
-
organizationSkillSchema =
|
|
807
|
-
id:
|
|
808
|
-
orgId:
|
|
809
|
-
key:
|
|
810
|
-
slug:
|
|
811
|
-
name:
|
|
812
|
-
description:
|
|
813
|
-
markdown:
|
|
674
|
+
organizationSkillSchema = z6.object({
|
|
675
|
+
id: z6.string().uuid(),
|
|
676
|
+
orgId: z6.string().uuid(),
|
|
677
|
+
key: z6.string().min(1),
|
|
678
|
+
slug: z6.string().min(1),
|
|
679
|
+
name: z6.string().min(1),
|
|
680
|
+
description: z6.string().nullable(),
|
|
681
|
+
markdown: z6.string(),
|
|
814
682
|
sourceType: organizationSkillSourceTypeSchema,
|
|
815
|
-
sourceLocator:
|
|
816
|
-
sourceRef:
|
|
683
|
+
sourceLocator: z6.string().nullable(),
|
|
684
|
+
sourceRef: z6.string().nullable(),
|
|
817
685
|
trustLevel: organizationSkillTrustLevelSchema,
|
|
818
686
|
compatibility: organizationSkillCompatibilitySchema,
|
|
819
|
-
fileInventory:
|
|
820
|
-
metadata:
|
|
821
|
-
createdAt:
|
|
822
|
-
updatedAt:
|
|
687
|
+
fileInventory: z6.array(organizationSkillFileInventoryEntrySchema).default([]),
|
|
688
|
+
metadata: z6.record(z6.unknown()).nullable(),
|
|
689
|
+
createdAt: z6.coerce.date(),
|
|
690
|
+
updatedAt: z6.coerce.date()
|
|
823
691
|
});
|
|
824
692
|
organizationSkillListItemSchema = organizationSkillSchema.extend({
|
|
825
|
-
attachedAgentCount:
|
|
826
|
-
editable:
|
|
827
|
-
editableReason:
|
|
828
|
-
sourceLabel:
|
|
693
|
+
attachedAgentCount: z6.number().int().nonnegative(),
|
|
694
|
+
editable: z6.boolean(),
|
|
695
|
+
editableReason: z6.string().nullable(),
|
|
696
|
+
sourceLabel: z6.string().nullable(),
|
|
829
697
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
830
|
-
sourcePath:
|
|
831
|
-
workspaceEditPath:
|
|
698
|
+
sourcePath: z6.string().nullable(),
|
|
699
|
+
workspaceEditPath: z6.string().nullable()
|
|
832
700
|
});
|
|
833
|
-
organizationSkillUsageAgentSchema =
|
|
834
|
-
id:
|
|
835
|
-
name:
|
|
836
|
-
urlKey:
|
|
837
|
-
agentRuntimeType:
|
|
838
|
-
desired:
|
|
839
|
-
actualState:
|
|
701
|
+
organizationSkillUsageAgentSchema = z6.object({
|
|
702
|
+
id: z6.string().uuid(),
|
|
703
|
+
name: z6.string().min(1),
|
|
704
|
+
urlKey: z6.string().min(1),
|
|
705
|
+
agentRuntimeType: z6.string().min(1),
|
|
706
|
+
desired: z6.boolean(),
|
|
707
|
+
actualState: z6.string().nullable()
|
|
840
708
|
});
|
|
841
709
|
organizationSkillDetailSchema = organizationSkillSchema.extend({
|
|
842
|
-
attachedAgentCount:
|
|
843
|
-
usedByAgents:
|
|
844
|
-
editable:
|
|
845
|
-
editableReason:
|
|
846
|
-
sourceLabel:
|
|
710
|
+
attachedAgentCount: z6.number().int().nonnegative(),
|
|
711
|
+
usedByAgents: z6.array(organizationSkillUsageAgentSchema).default([]),
|
|
712
|
+
editable: z6.boolean(),
|
|
713
|
+
editableReason: z6.string().nullable(),
|
|
714
|
+
sourceLabel: z6.string().nullable(),
|
|
847
715
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
848
|
-
sourcePath:
|
|
849
|
-
workspaceEditPath:
|
|
716
|
+
sourcePath: z6.string().nullable(),
|
|
717
|
+
workspaceEditPath: z6.string().nullable()
|
|
850
718
|
});
|
|
851
|
-
organizationSkillUpdateStatusSchema =
|
|
852
|
-
supported:
|
|
853
|
-
reason:
|
|
854
|
-
trackingRef:
|
|
855
|
-
currentRef:
|
|
856
|
-
latestRef:
|
|
857
|
-
hasUpdate:
|
|
719
|
+
organizationSkillUpdateStatusSchema = z6.object({
|
|
720
|
+
supported: z6.boolean(),
|
|
721
|
+
reason: z6.string().nullable(),
|
|
722
|
+
trackingRef: z6.string().nullable(),
|
|
723
|
+
currentRef: z6.string().nullable(),
|
|
724
|
+
latestRef: z6.string().nullable(),
|
|
725
|
+
hasUpdate: z6.boolean()
|
|
858
726
|
});
|
|
859
|
-
organizationSkillImportSchema =
|
|
860
|
-
source:
|
|
727
|
+
organizationSkillImportSchema = z6.object({
|
|
728
|
+
source: z6.string().min(1)
|
|
861
729
|
});
|
|
862
|
-
organizationSkillProjectScanRequestSchema =
|
|
863
|
-
projectIds:
|
|
864
|
-
workspaceIds:
|
|
730
|
+
organizationSkillProjectScanRequestSchema = z6.object({
|
|
731
|
+
projectIds: z6.array(z6.string().uuid()).optional(),
|
|
732
|
+
workspaceIds: z6.array(z6.string().uuid()).optional()
|
|
865
733
|
});
|
|
866
|
-
organizationSkillProjectScanSkippedSchema =
|
|
867
|
-
projectId:
|
|
868
|
-
projectName:
|
|
869
|
-
workspaceId:
|
|
870
|
-
workspaceName:
|
|
871
|
-
path:
|
|
872
|
-
reason:
|
|
734
|
+
organizationSkillProjectScanSkippedSchema = z6.object({
|
|
735
|
+
projectId: z6.string().uuid(),
|
|
736
|
+
projectName: z6.string().min(1),
|
|
737
|
+
workspaceId: z6.string().uuid().nullable(),
|
|
738
|
+
workspaceName: z6.string().nullable(),
|
|
739
|
+
path: z6.string().nullable(),
|
|
740
|
+
reason: z6.string().min(1)
|
|
873
741
|
});
|
|
874
|
-
organizationSkillProjectScanConflictSchema =
|
|
875
|
-
slug:
|
|
876
|
-
key:
|
|
877
|
-
projectId:
|
|
878
|
-
projectName:
|
|
879
|
-
workspaceId:
|
|
880
|
-
workspaceName:
|
|
881
|
-
path:
|
|
882
|
-
existingSkillId:
|
|
883
|
-
existingSkillKey:
|
|
884
|
-
existingSourceLocator:
|
|
885
|
-
reason:
|
|
742
|
+
organizationSkillProjectScanConflictSchema = z6.object({
|
|
743
|
+
slug: z6.string().min(1),
|
|
744
|
+
key: z6.string().min(1),
|
|
745
|
+
projectId: z6.string().uuid(),
|
|
746
|
+
projectName: z6.string().min(1),
|
|
747
|
+
workspaceId: z6.string().uuid(),
|
|
748
|
+
workspaceName: z6.string().min(1),
|
|
749
|
+
path: z6.string().min(1),
|
|
750
|
+
existingSkillId: z6.string().uuid(),
|
|
751
|
+
existingSkillKey: z6.string().min(1),
|
|
752
|
+
existingSourceLocator: z6.string().nullable(),
|
|
753
|
+
reason: z6.string().min(1)
|
|
886
754
|
});
|
|
887
|
-
organizationSkillProjectScanResultSchema =
|
|
888
|
-
scannedProjects:
|
|
889
|
-
scannedWorkspaces:
|
|
890
|
-
discovered:
|
|
891
|
-
imported:
|
|
892
|
-
updated:
|
|
893
|
-
skipped:
|
|
894
|
-
conflicts:
|
|
895
|
-
warnings:
|
|
755
|
+
organizationSkillProjectScanResultSchema = z6.object({
|
|
756
|
+
scannedProjects: z6.number().int().nonnegative(),
|
|
757
|
+
scannedWorkspaces: z6.number().int().nonnegative(),
|
|
758
|
+
discovered: z6.number().int().nonnegative(),
|
|
759
|
+
imported: z6.array(organizationSkillSchema),
|
|
760
|
+
updated: z6.array(organizationSkillSchema),
|
|
761
|
+
skipped: z6.array(organizationSkillProjectScanSkippedSchema),
|
|
762
|
+
conflicts: z6.array(organizationSkillProjectScanConflictSchema),
|
|
763
|
+
warnings: z6.array(z6.string())
|
|
896
764
|
});
|
|
897
|
-
organizationSkillLocalScanRequestSchema =
|
|
898
|
-
roots:
|
|
765
|
+
organizationSkillLocalScanRequestSchema = z6.object({
|
|
766
|
+
roots: z6.array(z6.string().min(1)).optional()
|
|
899
767
|
});
|
|
900
|
-
organizationSkillLocalScanSkippedSchema =
|
|
901
|
-
root:
|
|
902
|
-
path:
|
|
903
|
-
reason:
|
|
768
|
+
organizationSkillLocalScanSkippedSchema = z6.object({
|
|
769
|
+
root: z6.string().min(1),
|
|
770
|
+
path: z6.string().nullable(),
|
|
771
|
+
reason: z6.string().min(1)
|
|
904
772
|
});
|
|
905
|
-
organizationSkillLocalScanConflictSchema =
|
|
906
|
-
root:
|
|
907
|
-
path:
|
|
908
|
-
slug:
|
|
909
|
-
key:
|
|
910
|
-
existingSkillId:
|
|
911
|
-
existingSkillKey:
|
|
912
|
-
existingSourceLocator:
|
|
913
|
-
reason:
|
|
773
|
+
organizationSkillLocalScanConflictSchema = z6.object({
|
|
774
|
+
root: z6.string().min(1),
|
|
775
|
+
path: z6.string().min(1),
|
|
776
|
+
slug: z6.string().min(1),
|
|
777
|
+
key: z6.string().min(1),
|
|
778
|
+
existingSkillId: z6.string().uuid(),
|
|
779
|
+
existingSkillKey: z6.string().min(1),
|
|
780
|
+
existingSourceLocator: z6.string().nullable(),
|
|
781
|
+
reason: z6.string().min(1)
|
|
914
782
|
});
|
|
915
|
-
organizationSkillLocalScanResultSchema =
|
|
916
|
-
scannedRoots:
|
|
917
|
-
discovered:
|
|
918
|
-
imported:
|
|
919
|
-
updated:
|
|
920
|
-
skipped:
|
|
921
|
-
conflicts:
|
|
922
|
-
warnings:
|
|
783
|
+
organizationSkillLocalScanResultSchema = z6.object({
|
|
784
|
+
scannedRoots: z6.number().int().nonnegative(),
|
|
785
|
+
discovered: z6.number().int().nonnegative(),
|
|
786
|
+
imported: z6.array(organizationSkillSchema),
|
|
787
|
+
updated: z6.array(organizationSkillSchema),
|
|
788
|
+
skipped: z6.array(organizationSkillLocalScanSkippedSchema),
|
|
789
|
+
conflicts: z6.array(organizationSkillLocalScanConflictSchema),
|
|
790
|
+
warnings: z6.array(z6.string())
|
|
923
791
|
});
|
|
924
|
-
organizationSkillCreateSchema =
|
|
925
|
-
name:
|
|
926
|
-
slug:
|
|
927
|
-
description:
|
|
928
|
-
markdown:
|
|
792
|
+
organizationSkillCreateSchema = z6.object({
|
|
793
|
+
name: z6.string().min(1),
|
|
794
|
+
slug: z6.string().min(1).nullable().optional(),
|
|
795
|
+
description: z6.string().nullable().optional(),
|
|
796
|
+
markdown: z6.string().nullable().optional()
|
|
929
797
|
});
|
|
930
|
-
organizationSkillFileDetailSchema =
|
|
931
|
-
skillId:
|
|
932
|
-
path:
|
|
933
|
-
kind:
|
|
934
|
-
content:
|
|
935
|
-
language:
|
|
936
|
-
markdown:
|
|
937
|
-
editable:
|
|
798
|
+
organizationSkillFileDetailSchema = z6.object({
|
|
799
|
+
skillId: z6.string().uuid(),
|
|
800
|
+
path: z6.string().min(1),
|
|
801
|
+
kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
|
|
802
|
+
content: z6.string(),
|
|
803
|
+
language: z6.string().nullable(),
|
|
804
|
+
markdown: z6.boolean(),
|
|
805
|
+
editable: z6.boolean()
|
|
938
806
|
});
|
|
939
|
-
organizationSkillFileUpdateSchema =
|
|
940
|
-
path:
|
|
941
|
-
content:
|
|
807
|
+
organizationSkillFileUpdateSchema = z6.object({
|
|
808
|
+
path: z6.string().min(1),
|
|
809
|
+
content: z6.string()
|
|
942
810
|
});
|
|
943
811
|
}
|
|
944
812
|
});
|
|
945
813
|
|
|
946
814
|
// ../packages/shared/src/validators/adapter-skills.ts
|
|
947
|
-
import { z as
|
|
815
|
+
import { z as z7 } from "zod";
|
|
948
816
|
var agentSkillStateSchema, agentSkillOriginSchema, agentSkillSourceClassSchema, agentSkillSyncModeSchema, agentSkillEntrySchema, agentSkillSnapshotSchema, agentSkillSyncSchema;
|
|
949
817
|
var init_adapter_skills = __esm({
|
|
950
818
|
"../packages/shared/src/validators/adapter-skills.ts"() {
|
|
951
819
|
"use strict";
|
|
952
|
-
agentSkillStateSchema =
|
|
820
|
+
agentSkillStateSchema = z7.enum([
|
|
953
821
|
"available",
|
|
954
822
|
"configured",
|
|
955
823
|
"installed",
|
|
@@ -957,274 +825,398 @@ var init_adapter_skills = __esm({
|
|
|
957
825
|
"stale",
|
|
958
826
|
"external"
|
|
959
827
|
]);
|
|
960
|
-
agentSkillOriginSchema =
|
|
828
|
+
agentSkillOriginSchema = z7.preprocess((value) => {
|
|
961
829
|
if (value === "company_managed") return "organization_managed";
|
|
962
830
|
return value;
|
|
963
|
-
},
|
|
831
|
+
}, z7.enum([
|
|
964
832
|
"organization_managed",
|
|
965
833
|
"user_installed",
|
|
966
834
|
"external_unknown"
|
|
967
835
|
]));
|
|
968
|
-
agentSkillSourceClassSchema =
|
|
836
|
+
agentSkillSourceClassSchema = z7.enum([
|
|
969
837
|
"bundled",
|
|
970
838
|
"organization",
|
|
971
839
|
"agent_home",
|
|
972
840
|
"global",
|
|
973
841
|
"adapter_home"
|
|
974
842
|
]);
|
|
975
|
-
agentSkillSyncModeSchema =
|
|
843
|
+
agentSkillSyncModeSchema = z7.enum([
|
|
976
844
|
"unsupported",
|
|
977
845
|
"persistent",
|
|
978
846
|
"ephemeral"
|
|
979
847
|
]);
|
|
980
|
-
agentSkillEntrySchema =
|
|
981
|
-
key:
|
|
982
|
-
selectionKey:
|
|
983
|
-
runtimeName:
|
|
984
|
-
description:
|
|
985
|
-
desired:
|
|
986
|
-
configurable:
|
|
987
|
-
alwaysEnabled:
|
|
988
|
-
managed:
|
|
848
|
+
agentSkillEntrySchema = z7.object({
|
|
849
|
+
key: z7.string().min(1),
|
|
850
|
+
selectionKey: z7.string().min(1),
|
|
851
|
+
runtimeName: z7.string().min(1).nullable(),
|
|
852
|
+
description: z7.string().nullable().optional(),
|
|
853
|
+
desired: z7.boolean(),
|
|
854
|
+
configurable: z7.boolean(),
|
|
855
|
+
alwaysEnabled: z7.boolean(),
|
|
856
|
+
managed: z7.boolean(),
|
|
989
857
|
state: agentSkillStateSchema,
|
|
990
858
|
sourceClass: agentSkillSourceClassSchema,
|
|
991
859
|
origin: agentSkillOriginSchema.optional(),
|
|
992
|
-
originLabel:
|
|
993
|
-
locationLabel:
|
|
994
|
-
readOnly:
|
|
995
|
-
sourcePath:
|
|
996
|
-
targetPath:
|
|
997
|
-
workspaceEditPath:
|
|
998
|
-
detail:
|
|
860
|
+
originLabel: z7.string().nullable().optional(),
|
|
861
|
+
locationLabel: z7.string().nullable().optional(),
|
|
862
|
+
readOnly: z7.boolean().optional(),
|
|
863
|
+
sourcePath: z7.string().nullable().optional(),
|
|
864
|
+
targetPath: z7.string().nullable().optional(),
|
|
865
|
+
workspaceEditPath: z7.string().nullable().optional(),
|
|
866
|
+
detail: z7.string().nullable().optional()
|
|
999
867
|
});
|
|
1000
|
-
agentSkillSnapshotSchema =
|
|
1001
|
-
agentRuntimeType:
|
|
1002
|
-
supported:
|
|
868
|
+
agentSkillSnapshotSchema = z7.object({
|
|
869
|
+
agentRuntimeType: z7.string().min(1),
|
|
870
|
+
supported: z7.boolean(),
|
|
1003
871
|
mode: agentSkillSyncModeSchema,
|
|
1004
|
-
desiredSkills:
|
|
1005
|
-
entries:
|
|
1006
|
-
warnings:
|
|
872
|
+
desiredSkills: z7.array(z7.string().min(1)),
|
|
873
|
+
entries: z7.array(agentSkillEntrySchema),
|
|
874
|
+
warnings: z7.array(z7.string())
|
|
1007
875
|
});
|
|
1008
|
-
agentSkillSyncSchema =
|
|
1009
|
-
desiredSkills:
|
|
876
|
+
agentSkillSyncSchema = z7.object({
|
|
877
|
+
desiredSkills: z7.array(z7.string().min(1))
|
|
1010
878
|
});
|
|
1011
879
|
}
|
|
1012
880
|
});
|
|
1013
881
|
|
|
1014
882
|
// ../packages/shared/src/validators/organization-portability.ts
|
|
1015
|
-
import { z as
|
|
883
|
+
import { z as z8 } from "zod";
|
|
1016
884
|
var portabilityIncludeSchema, portabilityEnvInputSchema, portabilityFileEntrySchema, portabilityOrganizationManifestEntrySchema, portabilitySidebarOrderSchema, portabilityAgentManifestEntrySchema, portabilitySkillManifestEntrySchema, portabilityProjectManifestEntrySchema, portabilityIssueAutomationTriggerManifestEntrySchema, portabilityIssueAutomationManifestEntrySchema, portabilityIssueManifestEntrySchema, portabilityManifestSchema, portabilitySourceSchema, portabilityTargetSchema, portabilityAgentSelectionSchema, portabilityCollisionStrategySchema, organizationPortabilityExportSchema, organizationPortabilityPreviewSchema, portabilityAdapterOverrideSchema, organizationPortabilityImportSchema;
|
|
1017
885
|
var init_organization_portability = __esm({
|
|
1018
886
|
"../packages/shared/src/validators/organization-portability.ts"() {
|
|
1019
887
|
"use strict";
|
|
1020
|
-
portabilityIncludeSchema =
|
|
1021
|
-
organization:
|
|
1022
|
-
agents:
|
|
1023
|
-
projects:
|
|
1024
|
-
issues:
|
|
1025
|
-
skills:
|
|
888
|
+
portabilityIncludeSchema = z8.object({
|
|
889
|
+
organization: z8.boolean().optional(),
|
|
890
|
+
agents: z8.boolean().optional(),
|
|
891
|
+
projects: z8.boolean().optional(),
|
|
892
|
+
issues: z8.boolean().optional(),
|
|
893
|
+
skills: z8.boolean().optional()
|
|
1026
894
|
}).partial();
|
|
1027
|
-
portabilityEnvInputSchema =
|
|
1028
|
-
key:
|
|
1029
|
-
description:
|
|
1030
|
-
agentSlug:
|
|
1031
|
-
kind:
|
|
1032
|
-
requirement:
|
|
1033
|
-
defaultValue:
|
|
1034
|
-
portability:
|
|
895
|
+
portabilityEnvInputSchema = z8.object({
|
|
896
|
+
key: z8.string().min(1),
|
|
897
|
+
description: z8.string().nullable(),
|
|
898
|
+
agentSlug: z8.string().min(1).nullable(),
|
|
899
|
+
kind: z8.enum(["secret", "plain"]),
|
|
900
|
+
requirement: z8.enum(["required", "optional"]),
|
|
901
|
+
defaultValue: z8.string().nullable(),
|
|
902
|
+
portability: z8.enum(["portable", "system_dependent"])
|
|
1035
903
|
});
|
|
1036
|
-
portabilityFileEntrySchema =
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
encoding:
|
|
1040
|
-
data:
|
|
1041
|
-
contentType:
|
|
904
|
+
portabilityFileEntrySchema = z8.union([
|
|
905
|
+
z8.string(),
|
|
906
|
+
z8.object({
|
|
907
|
+
encoding: z8.literal("base64"),
|
|
908
|
+
data: z8.string(),
|
|
909
|
+
contentType: z8.string().min(1).optional().nullable()
|
|
1042
910
|
})
|
|
1043
911
|
]);
|
|
1044
|
-
portabilityOrganizationManifestEntrySchema =
|
|
1045
|
-
path:
|
|
1046
|
-
name:
|
|
1047
|
-
description:
|
|
1048
|
-
brandColor:
|
|
1049
|
-
logoPath:
|
|
1050
|
-
requireBoardApprovalForNewAgents:
|
|
912
|
+
portabilityOrganizationManifestEntrySchema = z8.object({
|
|
913
|
+
path: z8.string().min(1),
|
|
914
|
+
name: z8.string().min(1),
|
|
915
|
+
description: z8.string().nullable(),
|
|
916
|
+
brandColor: z8.string().nullable(),
|
|
917
|
+
logoPath: z8.string().nullable(),
|
|
918
|
+
requireBoardApprovalForNewAgents: z8.boolean()
|
|
1051
919
|
});
|
|
1052
|
-
portabilitySidebarOrderSchema =
|
|
1053
|
-
agents:
|
|
1054
|
-
projects:
|
|
920
|
+
portabilitySidebarOrderSchema = z8.object({
|
|
921
|
+
agents: z8.array(z8.string().min(1)).default([]),
|
|
922
|
+
projects: z8.array(z8.string().min(1)).default([])
|
|
1055
923
|
});
|
|
1056
|
-
portabilityAgentManifestEntrySchema =
|
|
1057
|
-
slug:
|
|
1058
|
-
name:
|
|
1059
|
-
path:
|
|
1060
|
-
skills:
|
|
1061
|
-
role:
|
|
1062
|
-
title:
|
|
1063
|
-
icon:
|
|
1064
|
-
capabilities:
|
|
1065
|
-
reportsToSlug:
|
|
1066
|
-
agentRuntimeType:
|
|
1067
|
-
agentRuntimeConfig:
|
|
1068
|
-
runtimeConfig:
|
|
1069
|
-
permissions:
|
|
1070
|
-
budgetMonthlyCents:
|
|
1071
|
-
metadata:
|
|
924
|
+
portabilityAgentManifestEntrySchema = z8.object({
|
|
925
|
+
slug: z8.string().min(1),
|
|
926
|
+
name: z8.string().min(1),
|
|
927
|
+
path: z8.string().min(1),
|
|
928
|
+
skills: z8.array(z8.string().min(1)).default([]),
|
|
929
|
+
role: z8.string().min(1),
|
|
930
|
+
title: z8.string().nullable(),
|
|
931
|
+
icon: z8.string().nullable(),
|
|
932
|
+
capabilities: z8.string().nullable(),
|
|
933
|
+
reportsToSlug: z8.string().min(1).nullable(),
|
|
934
|
+
agentRuntimeType: z8.string().min(1),
|
|
935
|
+
agentRuntimeConfig: z8.record(z8.unknown()),
|
|
936
|
+
runtimeConfig: z8.record(z8.unknown()),
|
|
937
|
+
permissions: z8.record(z8.unknown()),
|
|
938
|
+
budgetMonthlyCents: z8.number().int().nonnegative(),
|
|
939
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1072
940
|
});
|
|
1073
|
-
portabilitySkillManifestEntrySchema =
|
|
1074
|
-
key:
|
|
1075
|
-
slug:
|
|
1076
|
-
name:
|
|
1077
|
-
path:
|
|
1078
|
-
description:
|
|
1079
|
-
sourceType:
|
|
1080
|
-
sourceLocator:
|
|
1081
|
-
sourceRef:
|
|
1082
|
-
trustLevel:
|
|
1083
|
-
compatibility:
|
|
1084
|
-
metadata:
|
|
1085
|
-
fileInventory:
|
|
1086
|
-
path:
|
|
1087
|
-
kind:
|
|
941
|
+
portabilitySkillManifestEntrySchema = z8.object({
|
|
942
|
+
key: z8.string().min(1),
|
|
943
|
+
slug: z8.string().min(1),
|
|
944
|
+
name: z8.string().min(1),
|
|
945
|
+
path: z8.string().min(1),
|
|
946
|
+
description: z8.string().nullable(),
|
|
947
|
+
sourceType: z8.string().min(1),
|
|
948
|
+
sourceLocator: z8.string().nullable(),
|
|
949
|
+
sourceRef: z8.string().nullable(),
|
|
950
|
+
trustLevel: z8.string().nullable(),
|
|
951
|
+
compatibility: z8.string().nullable(),
|
|
952
|
+
metadata: z8.record(z8.unknown()).nullable(),
|
|
953
|
+
fileInventory: z8.array(z8.object({
|
|
954
|
+
path: z8.string().min(1),
|
|
955
|
+
kind: z8.string().min(1)
|
|
1088
956
|
})).default([])
|
|
1089
957
|
});
|
|
1090
|
-
portabilityProjectManifestEntrySchema =
|
|
1091
|
-
slug:
|
|
1092
|
-
name:
|
|
1093
|
-
path:
|
|
1094
|
-
description:
|
|
1095
|
-
ownerAgentSlug:
|
|
1096
|
-
leadAgentSlug:
|
|
1097
|
-
targetDate:
|
|
1098
|
-
color:
|
|
1099
|
-
status:
|
|
1100
|
-
executionWorkspacePolicy:
|
|
1101
|
-
workspaces:
|
|
1102
|
-
key:
|
|
1103
|
-
name:
|
|
1104
|
-
sourceType:
|
|
1105
|
-
repoUrl:
|
|
1106
|
-
repoRef:
|
|
1107
|
-
defaultRef:
|
|
1108
|
-
visibility:
|
|
1109
|
-
setupCommand:
|
|
1110
|
-
cleanupCommand:
|
|
1111
|
-
metadata:
|
|
1112
|
-
isPrimary:
|
|
958
|
+
portabilityProjectManifestEntrySchema = z8.object({
|
|
959
|
+
slug: z8.string().min(1),
|
|
960
|
+
name: z8.string().min(1),
|
|
961
|
+
path: z8.string().min(1),
|
|
962
|
+
description: z8.string().nullable(),
|
|
963
|
+
ownerAgentSlug: z8.string().min(1).nullable(),
|
|
964
|
+
leadAgentSlug: z8.string().min(1).nullable(),
|
|
965
|
+
targetDate: z8.string().nullable(),
|
|
966
|
+
color: z8.string().nullable(),
|
|
967
|
+
status: z8.string().nullable(),
|
|
968
|
+
executionWorkspacePolicy: z8.record(z8.unknown()).nullable(),
|
|
969
|
+
workspaces: z8.array(z8.object({
|
|
970
|
+
key: z8.string().min(1),
|
|
971
|
+
name: z8.string().min(1),
|
|
972
|
+
sourceType: z8.string().nullable(),
|
|
973
|
+
repoUrl: z8.string().nullable(),
|
|
974
|
+
repoRef: z8.string().nullable(),
|
|
975
|
+
defaultRef: z8.string().nullable(),
|
|
976
|
+
visibility: z8.string().nullable(),
|
|
977
|
+
setupCommand: z8.string().nullable(),
|
|
978
|
+
cleanupCommand: z8.string().nullable(),
|
|
979
|
+
metadata: z8.record(z8.unknown()).nullable(),
|
|
980
|
+
isPrimary: z8.boolean()
|
|
1113
981
|
})).default([]),
|
|
1114
|
-
metadata:
|
|
982
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1115
983
|
});
|
|
1116
|
-
portabilityIssueAutomationTriggerManifestEntrySchema =
|
|
1117
|
-
kind:
|
|
1118
|
-
label:
|
|
1119
|
-
enabled:
|
|
1120
|
-
cronExpression:
|
|
1121
|
-
timezone:
|
|
1122
|
-
signingMode:
|
|
1123
|
-
replayWindowSec:
|
|
984
|
+
portabilityIssueAutomationTriggerManifestEntrySchema = z8.object({
|
|
985
|
+
kind: z8.string().min(1),
|
|
986
|
+
label: z8.string().nullable(),
|
|
987
|
+
enabled: z8.boolean(),
|
|
988
|
+
cronExpression: z8.string().nullable(),
|
|
989
|
+
timezone: z8.string().nullable(),
|
|
990
|
+
signingMode: z8.string().nullable(),
|
|
991
|
+
replayWindowSec: z8.number().int().nullable()
|
|
1124
992
|
});
|
|
1125
|
-
portabilityIssueAutomationManifestEntrySchema =
|
|
1126
|
-
concurrencyPolicy:
|
|
1127
|
-
catchUpPolicy:
|
|
1128
|
-
triggers:
|
|
993
|
+
portabilityIssueAutomationManifestEntrySchema = z8.object({
|
|
994
|
+
concurrencyPolicy: z8.string().nullable(),
|
|
995
|
+
catchUpPolicy: z8.string().nullable(),
|
|
996
|
+
triggers: z8.array(portabilityIssueAutomationTriggerManifestEntrySchema).default([])
|
|
1129
997
|
});
|
|
1130
|
-
portabilityIssueManifestEntrySchema =
|
|
1131
|
-
slug:
|
|
1132
|
-
identifier:
|
|
1133
|
-
title:
|
|
1134
|
-
path:
|
|
1135
|
-
projectSlug:
|
|
1136
|
-
projectWorkspaceKey:
|
|
1137
|
-
assigneeAgentSlug:
|
|
1138
|
-
description:
|
|
1139
|
-
recurring:
|
|
998
|
+
portabilityIssueManifestEntrySchema = z8.object({
|
|
999
|
+
slug: z8.string().min(1),
|
|
1000
|
+
identifier: z8.string().min(1).nullable(),
|
|
1001
|
+
title: z8.string().min(1),
|
|
1002
|
+
path: z8.string().min(1),
|
|
1003
|
+
projectSlug: z8.string().min(1).nullable(),
|
|
1004
|
+
projectWorkspaceKey: z8.string().min(1).nullable(),
|
|
1005
|
+
assigneeAgentSlug: z8.string().min(1).nullable(),
|
|
1006
|
+
description: z8.string().nullable(),
|
|
1007
|
+
recurring: z8.boolean().default(false),
|
|
1140
1008
|
automation: portabilityIssueAutomationManifestEntrySchema.nullable(),
|
|
1141
|
-
legacyRecurrence:
|
|
1142
|
-
status:
|
|
1143
|
-
priority:
|
|
1144
|
-
labelIds:
|
|
1145
|
-
billingCode:
|
|
1146
|
-
executionWorkspaceSettings:
|
|
1147
|
-
assigneeAgentRuntimeOverrides:
|
|
1148
|
-
metadata:
|
|
1009
|
+
legacyRecurrence: z8.record(z8.unknown()).nullable(),
|
|
1010
|
+
status: z8.string().nullable(),
|
|
1011
|
+
priority: z8.string().nullable(),
|
|
1012
|
+
labelIds: z8.array(z8.string().min(1)).default([]),
|
|
1013
|
+
billingCode: z8.string().nullable(),
|
|
1014
|
+
executionWorkspaceSettings: z8.record(z8.unknown()).nullable(),
|
|
1015
|
+
assigneeAgentRuntimeOverrides: z8.record(z8.unknown()).nullable(),
|
|
1016
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1149
1017
|
});
|
|
1150
|
-
portabilityManifestSchema =
|
|
1151
|
-
schemaVersion:
|
|
1152
|
-
generatedAt:
|
|
1153
|
-
source:
|
|
1154
|
-
orgId:
|
|
1155
|
-
organizationName:
|
|
1018
|
+
portabilityManifestSchema = z8.object({
|
|
1019
|
+
schemaVersion: z8.number().int().positive(),
|
|
1020
|
+
generatedAt: z8.string().datetime(),
|
|
1021
|
+
source: z8.object({
|
|
1022
|
+
orgId: z8.string().uuid(),
|
|
1023
|
+
organizationName: z8.string().min(1)
|
|
1156
1024
|
}).nullable(),
|
|
1157
|
-
includes:
|
|
1158
|
-
organization:
|
|
1159
|
-
agents:
|
|
1160
|
-
projects:
|
|
1161
|
-
issues:
|
|
1162
|
-
skills:
|
|
1025
|
+
includes: z8.object({
|
|
1026
|
+
organization: z8.boolean(),
|
|
1027
|
+
agents: z8.boolean(),
|
|
1028
|
+
projects: z8.boolean(),
|
|
1029
|
+
issues: z8.boolean(),
|
|
1030
|
+
skills: z8.boolean()
|
|
1163
1031
|
}),
|
|
1164
1032
|
organization: portabilityOrganizationManifestEntrySchema.nullable(),
|
|
1165
1033
|
sidebar: portabilitySidebarOrderSchema.nullable(),
|
|
1166
|
-
agents:
|
|
1167
|
-
skills:
|
|
1168
|
-
projects:
|
|
1169
|
-
issues:
|
|
1170
|
-
envInputs:
|
|
1034
|
+
agents: z8.array(portabilityAgentManifestEntrySchema),
|
|
1035
|
+
skills: z8.array(portabilitySkillManifestEntrySchema).default([]),
|
|
1036
|
+
projects: z8.array(portabilityProjectManifestEntrySchema).default([]),
|
|
1037
|
+
issues: z8.array(portabilityIssueManifestEntrySchema).default([]),
|
|
1038
|
+
envInputs: z8.array(portabilityEnvInputSchema).default([])
|
|
1171
1039
|
});
|
|
1172
|
-
portabilitySourceSchema =
|
|
1173
|
-
|
|
1174
|
-
type:
|
|
1175
|
-
rootPath:
|
|
1176
|
-
files:
|
|
1040
|
+
portabilitySourceSchema = z8.discriminatedUnion("type", [
|
|
1041
|
+
z8.object({
|
|
1042
|
+
type: z8.literal("inline"),
|
|
1043
|
+
rootPath: z8.string().min(1).optional().nullable(),
|
|
1044
|
+
files: z8.record(portabilityFileEntrySchema)
|
|
1177
1045
|
}),
|
|
1178
|
-
|
|
1179
|
-
type:
|
|
1180
|
-
url:
|
|
1046
|
+
z8.object({
|
|
1047
|
+
type: z8.literal("github"),
|
|
1048
|
+
url: z8.string().url()
|
|
1181
1049
|
})
|
|
1182
1050
|
]);
|
|
1183
|
-
portabilityTargetSchema =
|
|
1184
|
-
|
|
1185
|
-
mode:
|
|
1186
|
-
newOrganizationName:
|
|
1051
|
+
portabilityTargetSchema = z8.discriminatedUnion("mode", [
|
|
1052
|
+
z8.object({
|
|
1053
|
+
mode: z8.literal("new_organization"),
|
|
1054
|
+
newOrganizationName: z8.string().min(1).optional().nullable()
|
|
1187
1055
|
}),
|
|
1188
|
-
|
|
1189
|
-
mode:
|
|
1190
|
-
orgId:
|
|
1056
|
+
z8.object({
|
|
1057
|
+
mode: z8.literal("existing_organization"),
|
|
1058
|
+
orgId: z8.string().uuid()
|
|
1191
1059
|
})
|
|
1192
1060
|
]);
|
|
1193
|
-
portabilityAgentSelectionSchema =
|
|
1194
|
-
|
|
1195
|
-
|
|
1061
|
+
portabilityAgentSelectionSchema = z8.union([
|
|
1062
|
+
z8.literal("all"),
|
|
1063
|
+
z8.array(z8.string().min(1))
|
|
1196
1064
|
]);
|
|
1197
|
-
portabilityCollisionStrategySchema =
|
|
1198
|
-
organizationPortabilityExportSchema =
|
|
1065
|
+
portabilityCollisionStrategySchema = z8.enum(["rename", "skip", "replace"]);
|
|
1066
|
+
organizationPortabilityExportSchema = z8.object({
|
|
1199
1067
|
include: portabilityIncludeSchema.optional(),
|
|
1200
|
-
agents:
|
|
1201
|
-
skills:
|
|
1202
|
-
projects:
|
|
1203
|
-
issues:
|
|
1204
|
-
projectIssues:
|
|
1205
|
-
selectedFiles:
|
|
1206
|
-
expandReferencedSkills:
|
|
1068
|
+
agents: z8.array(z8.string().min(1)).optional(),
|
|
1069
|
+
skills: z8.array(z8.string().min(1)).optional(),
|
|
1070
|
+
projects: z8.array(z8.string().min(1)).optional(),
|
|
1071
|
+
issues: z8.array(z8.string().min(1)).optional(),
|
|
1072
|
+
projectIssues: z8.array(z8.string().min(1)).optional(),
|
|
1073
|
+
selectedFiles: z8.array(z8.string().min(1)).optional(),
|
|
1074
|
+
expandReferencedSkills: z8.boolean().optional(),
|
|
1207
1075
|
sidebarOrder: portabilitySidebarOrderSchema.partial().optional()
|
|
1208
1076
|
});
|
|
1209
|
-
organizationPortabilityPreviewSchema =
|
|
1077
|
+
organizationPortabilityPreviewSchema = z8.object({
|
|
1210
1078
|
source: portabilitySourceSchema,
|
|
1211
1079
|
include: portabilityIncludeSchema.optional(),
|
|
1212
1080
|
target: portabilityTargetSchema,
|
|
1213
1081
|
agents: portabilityAgentSelectionSchema.optional(),
|
|
1214
1082
|
collisionStrategy: portabilityCollisionStrategySchema.optional(),
|
|
1215
|
-
nameOverrides:
|
|
1216
|
-
selectedFiles:
|
|
1083
|
+
nameOverrides: z8.record(z8.string().min(1), z8.string().min(1)).optional(),
|
|
1084
|
+
selectedFiles: z8.array(z8.string().min(1)).optional()
|
|
1217
1085
|
});
|
|
1218
|
-
portabilityAdapterOverrideSchema =
|
|
1219
|
-
agentRuntimeType:
|
|
1220
|
-
agentRuntimeConfig:
|
|
1086
|
+
portabilityAdapterOverrideSchema = z8.object({
|
|
1087
|
+
agentRuntimeType: z8.string().min(1),
|
|
1088
|
+
agentRuntimeConfig: z8.record(z8.unknown()).optional()
|
|
1221
1089
|
});
|
|
1222
1090
|
organizationPortabilityImportSchema = organizationPortabilityPreviewSchema.extend({
|
|
1223
|
-
agentRuntimeOverrides:
|
|
1091
|
+
agentRuntimeOverrides: z8.record(z8.string().min(1), portabilityAdapterOverrideSchema).optional()
|
|
1224
1092
|
});
|
|
1225
1093
|
}
|
|
1226
1094
|
});
|
|
1227
1095
|
|
|
1096
|
+
// ../packages/shared/src/validators/secret.ts
|
|
1097
|
+
import { z as z9 } from "zod";
|
|
1098
|
+
var envBindingPlainSchema, envBindingSecretRefSchema, envBindingSchema, envConfigSchema, createSecretSchema, rotateSecretSchema, updateSecretSchema;
|
|
1099
|
+
var init_secret = __esm({
|
|
1100
|
+
"../packages/shared/src/validators/secret.ts"() {
|
|
1101
|
+
"use strict";
|
|
1102
|
+
init_constants();
|
|
1103
|
+
envBindingPlainSchema = z9.object({
|
|
1104
|
+
type: z9.literal("plain"),
|
|
1105
|
+
value: z9.string()
|
|
1106
|
+
});
|
|
1107
|
+
envBindingSecretRefSchema = z9.object({
|
|
1108
|
+
type: z9.literal("secret_ref"),
|
|
1109
|
+
secretId: z9.string().uuid(),
|
|
1110
|
+
version: z9.union([z9.literal("latest"), z9.number().int().positive()]).optional()
|
|
1111
|
+
});
|
|
1112
|
+
envBindingSchema = z9.union([
|
|
1113
|
+
z9.string(),
|
|
1114
|
+
envBindingPlainSchema,
|
|
1115
|
+
envBindingSecretRefSchema
|
|
1116
|
+
]);
|
|
1117
|
+
envConfigSchema = z9.record(envBindingSchema);
|
|
1118
|
+
createSecretSchema = z9.object({
|
|
1119
|
+
name: z9.string().min(1),
|
|
1120
|
+
provider: z9.enum(SECRET_PROVIDERS).optional(),
|
|
1121
|
+
value: z9.string().min(1),
|
|
1122
|
+
description: z9.string().optional().nullable(),
|
|
1123
|
+
externalRef: z9.string().optional().nullable()
|
|
1124
|
+
});
|
|
1125
|
+
rotateSecretSchema = z9.object({
|
|
1126
|
+
value: z9.string().min(1),
|
|
1127
|
+
externalRef: z9.string().optional().nullable()
|
|
1128
|
+
});
|
|
1129
|
+
updateSecretSchema = z9.object({
|
|
1130
|
+
name: z9.string().min(1).optional(),
|
|
1131
|
+
description: z9.string().optional().nullable(),
|
|
1132
|
+
externalRef: z9.string().optional().nullable()
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
// ../packages/shared/src/validators/model-fallbacks.ts
|
|
1138
|
+
import { z as z10 } from "zod";
|
|
1139
|
+
function isRecord(value) {
|
|
1140
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1141
|
+
}
|
|
1142
|
+
function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
1143
|
+
const fallbackModels = value.modelFallbacks;
|
|
1144
|
+
if (fallbackModels === void 0) return;
|
|
1145
|
+
if (!Array.isArray(fallbackModels)) {
|
|
1146
|
+
ctx.addIssue({
|
|
1147
|
+
code: z10.ZodIssueCode.custom,
|
|
1148
|
+
message: "modelFallbacks must be an array",
|
|
1149
|
+
path: [...pathPrefix, "modelFallbacks"]
|
|
1150
|
+
});
|
|
1151
|
+
return;
|
|
1152
|
+
}
|
|
1153
|
+
fallbackModels.forEach((fallback, index66) => {
|
|
1154
|
+
if (typeof fallback === "string") {
|
|
1155
|
+
if (fallback.trim().length === 0) {
|
|
1156
|
+
ctx.addIssue({
|
|
1157
|
+
code: z10.ZodIssueCode.custom,
|
|
1158
|
+
message: "modelFallbacks string entries must be non-empty",
|
|
1159
|
+
path: [...pathPrefix, "modelFallbacks", index66]
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
return;
|
|
1163
|
+
}
|
|
1164
|
+
if (!isRecord(fallback)) {
|
|
1165
|
+
ctx.addIssue({
|
|
1166
|
+
code: z10.ZodIssueCode.custom,
|
|
1167
|
+
message: "modelFallbacks entries must be strings or runtime/model objects",
|
|
1168
|
+
path: [...pathPrefix, "modelFallbacks", index66]
|
|
1169
|
+
});
|
|
1170
|
+
return;
|
|
1171
|
+
}
|
|
1172
|
+
if (typeof fallback.agentRuntimeType !== "string" || fallback.agentRuntimeType.trim().length === 0) {
|
|
1173
|
+
ctx.addIssue({
|
|
1174
|
+
code: z10.ZodIssueCode.custom,
|
|
1175
|
+
message: "modelFallbacks entries must include agentRuntimeType",
|
|
1176
|
+
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
1177
|
+
});
|
|
1178
|
+
} else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
|
|
1179
|
+
ctx.addIssue({
|
|
1180
|
+
code: z10.ZodIssueCode.custom,
|
|
1181
|
+
message: "modelFallbacks entries must include a valid agentRuntimeType",
|
|
1182
|
+
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
|
|
1186
|
+
ctx.addIssue({
|
|
1187
|
+
code: z10.ZodIssueCode.custom,
|
|
1188
|
+
message: "modelFallbacks entries must include model",
|
|
1189
|
+
path: [...pathPrefix, "modelFallbacks", index66, "model"]
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
if (fallback.config !== void 0 && !isRecord(fallback.config)) {
|
|
1193
|
+
ctx.addIssue({
|
|
1194
|
+
code: z10.ZodIssueCode.custom,
|
|
1195
|
+
message: "modelFallbacks entry config must be an object",
|
|
1196
|
+
path: [...pathPrefix, "modelFallbacks", index66, "config"]
|
|
1197
|
+
});
|
|
1198
|
+
} else if (isRecord(fallback.config) && fallback.config.env !== void 0) {
|
|
1199
|
+
const parsed = envConfigSchema.safeParse(fallback.config.env);
|
|
1200
|
+
if (!parsed.success) {
|
|
1201
|
+
ctx.addIssue({
|
|
1202
|
+
code: z10.ZodIssueCode.custom,
|
|
1203
|
+
message: "modelFallbacks entry config.env must be a map of valid env bindings",
|
|
1204
|
+
path: [...pathPrefix, "modelFallbacks", index66, "config", "env"]
|
|
1205
|
+
});
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
var agentRuntimeTypes;
|
|
1211
|
+
var init_model_fallbacks = __esm({
|
|
1212
|
+
"../packages/shared/src/validators/model-fallbacks.ts"() {
|
|
1213
|
+
"use strict";
|
|
1214
|
+
init_constants();
|
|
1215
|
+
init_secret();
|
|
1216
|
+
agentRuntimeTypes = new Set(AGENT_RUNTIME_TYPES);
|
|
1217
|
+
}
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1228
1220
|
// ../packages/shared/src/validators/agent.ts
|
|
1229
1221
|
import { z as z11 } from "zod";
|
|
1230
1222
|
var agentPermissionsSchema, agentInstructionsBundleModeSchema, updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, agentRuntimeConfigSchema, optionalAgentNameSchema, uploadedAgentIconSchema, customAgentIconSchema, agentIconSchema, createAgentSchema, createAgentHireSchema, updateAgentSchema, updateAgentInstructionsPathSchema, createAgentKeySchema, wakeAgentSchema, resetAgentSessionSchema, testAgentRuntimeEnvironmentSchema, updateAgentPermissionsSchema;
|
|
@@ -1321,7 +1313,7 @@ var init_agent = __esm({
|
|
|
1321
1313
|
name: z11.string().min(1).default("default")
|
|
1322
1314
|
});
|
|
1323
1315
|
wakeAgentSchema = z11.object({
|
|
1324
|
-
source: z11.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
|
|
1316
|
+
source: z11.enum(["timer", "assignment", "review", "on_demand", "automation"]).optional().default("on_demand"),
|
|
1325
1317
|
triggerDetail: z11.enum(["manual", "ping", "callback", "system"]).optional(),
|
|
1326
1318
|
reason: z11.string().optional().nullable(),
|
|
1327
1319
|
payload: z11.record(z11.unknown()).optional().nullable(),
|
|
@@ -1450,7 +1442,7 @@ var init_project = __esm({
|
|
|
1450
1442
|
|
|
1451
1443
|
// ../packages/shared/src/validators/issue.ts
|
|
1452
1444
|
import { z as z13 } from "zod";
|
|
1453
|
-
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
|
|
1445
|
+
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
|
|
1454
1446
|
var init_issue = __esm({
|
|
1455
1447
|
"../packages/shared/src/validators/issue.ts"() {
|
|
1456
1448
|
"use strict";
|
|
@@ -1483,6 +1475,8 @@ var init_issue = __esm({
|
|
|
1483
1475
|
priority: z13.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
|
1484
1476
|
assigneeAgentId: z13.string().uuid().optional().nullable(),
|
|
1485
1477
|
assigneeUserId: z13.string().optional().nullable(),
|
|
1478
|
+
reviewerAgentId: z13.string().uuid().optional().nullable(),
|
|
1479
|
+
reviewerUserId: z13.string().optional().nullable(),
|
|
1486
1480
|
requestDepth: z13.number().int().nonnegative().optional().default(0),
|
|
1487
1481
|
billingCode: z13.string().optional().nullable(),
|
|
1488
1482
|
assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
|
|
@@ -1511,7 +1505,8 @@ var init_issue = __esm({
|
|
|
1511
1505
|
updateIssueSchema = createIssueSchema.partial().extend({
|
|
1512
1506
|
comment: z13.string().min(1).optional(),
|
|
1513
1507
|
reopen: z13.boolean().optional(),
|
|
1514
|
-
hiddenAt: z13.string().datetime().nullable().optional()
|
|
1508
|
+
hiddenAt: z13.string().datetime().nullable().optional(),
|
|
1509
|
+
reviewDecision: z13.enum(["approve", "request_changes", "needs_followup", "blocked"]).optional()
|
|
1515
1510
|
});
|
|
1516
1511
|
reorderIssueSchema = z13.object({
|
|
1517
1512
|
issueId: z13.string().uuid(),
|
|
@@ -1541,6 +1536,9 @@ var init_issue = __esm({
|
|
|
1541
1536
|
issueCommentId: z13.string().uuid().optional().nullable(),
|
|
1542
1537
|
usage: z13.enum(["issue", "description_inline", "document_inline", "comment_inline", "comment_attachment"]).optional()
|
|
1543
1538
|
});
|
|
1539
|
+
createIssueWorkspaceAttachmentSchema = z13.object({
|
|
1540
|
+
path: z13.string().trim().min(1).max(2048)
|
|
1541
|
+
});
|
|
1544
1542
|
ISSUE_DOCUMENT_FORMATS = ["markdown"];
|
|
1545
1543
|
issueDocumentFormatSchema = z13.enum(ISSUE_DOCUMENT_FORMATS);
|
|
1546
1544
|
issueDocumentKeySchema = z13.string().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/, "Document key must be lowercase letters, numbers, _ or -");
|
|
@@ -3674,8 +3672,6 @@ var init_organizations = __esm({
|
|
|
3674
3672
|
spentMonthlyCents: integer("spent_monthly_cents").notNull().default(0),
|
|
3675
3673
|
requireBoardApprovalForNewAgents: boolean("require_board_approval_for_new_agents").notNull().default(true),
|
|
3676
3674
|
defaultChatIssueCreationMode: text6("default_chat_issue_creation_mode").notNull().default("manual_approval"),
|
|
3677
|
-
defaultChatAgentRuntimeType: text6("default_chat_agent_runtime_type"),
|
|
3678
|
-
defaultChatAgentRuntimeConfig: jsonb("default_chat_agent_runtime_config").$type(),
|
|
3679
3675
|
workspaceConfig: jsonb("workspace_config").$type(),
|
|
3680
3676
|
brandColor: text6("brand_color"),
|
|
3681
3677
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -4777,6 +4773,8 @@ var init_issues = __esm({
|
|
|
4777
4773
|
boardOrder: integer9("board_order").notNull().default(0),
|
|
4778
4774
|
assigneeAgentId: uuid28("assignee_agent_id").references(() => agents.id),
|
|
4779
4775
|
assigneeUserId: text34("assignee_user_id"),
|
|
4776
|
+
reviewerAgentId: uuid28("reviewer_agent_id").references(() => agents.id),
|
|
4777
|
+
reviewerUserId: text34("reviewer_user_id"),
|
|
4780
4778
|
checkoutRunId: uuid28("checkout_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
4781
4779
|
executionRunId: uuid28("execution_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
4782
4780
|
executionAgentNameKey: text34("execution_agent_name_key"),
|
|
@@ -4818,6 +4816,16 @@ var init_issues = __esm({
|
|
|
4818
4816
|
table.assigneeUserId,
|
|
4819
4817
|
table.status
|
|
4820
4818
|
),
|
|
4819
|
+
reviewerAgentStatusIdx: index25("issues_company_reviewer_agent_status_idx").on(
|
|
4820
|
+
table.orgId,
|
|
4821
|
+
table.reviewerAgentId,
|
|
4822
|
+
table.status
|
|
4823
|
+
),
|
|
4824
|
+
reviewerUserStatusIdx: index25("issues_company_reviewer_user_status_idx").on(
|
|
4825
|
+
table.orgId,
|
|
4826
|
+
table.reviewerUserId,
|
|
4827
|
+
table.status
|
|
4828
|
+
),
|
|
4821
4829
|
parentIdx: index25("issues_company_parent_idx").on(table.orgId, table.parentId),
|
|
4822
4830
|
projectIdx: index25("issues_company_project_idx").on(table.orgId, table.projectId),
|
|
4823
4831
|
originIdx: index25("issues_company_origin_idx").on(table.orgId, table.originKind, table.originId),
|
|
@@ -7688,8 +7696,8 @@ function pruneOldBackups(backupDir, retentionDays, filenamePrefix) {
|
|
|
7688
7696
|
for (const name of readdirSync(backupDir)) {
|
|
7689
7697
|
if (!name.startsWith(`${filenamePrefix}-`) || !name.endsWith(".sql")) continue;
|
|
7690
7698
|
const fullPath = resolve2(backupDir, name);
|
|
7691
|
-
const
|
|
7692
|
-
if (
|
|
7699
|
+
const stat3 = statSync(fullPath);
|
|
7700
|
+
if (stat3.mtimeMs < cutoff) {
|
|
7693
7701
|
unlinkSync(fullPath);
|
|
7694
7702
|
pruned++;
|
|
7695
7703
|
}
|
|
@@ -10898,10 +10906,17 @@ async function removePathWithRetry(targetPath, attempts = 5) {
|
|
|
10898
10906
|
}
|
|
10899
10907
|
return false;
|
|
10900
10908
|
}
|
|
10901
|
-
async function prepareForDesktopReplace(paths, target) {
|
|
10909
|
+
async function prepareForDesktopReplace(paths, target, options = {}) {
|
|
10902
10910
|
const hasManagedExecutable = await pathExists(paths.executablePath);
|
|
10903
10911
|
if (hasManagedExecutable) {
|
|
10904
|
-
|
|
10912
|
+
let quitResponse = await requestDesktopQuit(paths.executablePath, target);
|
|
10913
|
+
while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns) {
|
|
10914
|
+
p13.log.warn(
|
|
10915
|
+
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}; waiting before replacing Desktop.`
|
|
10916
|
+
);
|
|
10917
|
+
await delay(options.activeRunPollIntervalMs ?? 15e3);
|
|
10918
|
+
quitResponse = await requestDesktopQuit(paths.executablePath, target);
|
|
10919
|
+
}
|
|
10905
10920
|
if (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs") {
|
|
10906
10921
|
throw new Error(
|
|
10907
10922
|
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}. Stop active work, then rerun start.`
|
|
@@ -11044,7 +11059,7 @@ async function startCommand(opts) {
|
|
|
11044
11059
|
const installCli = opts.cli !== false;
|
|
11045
11060
|
const installDesktop = opts.desktop !== false;
|
|
11046
11061
|
const repo = opts.repo?.trim() || DEFAULT_DESKTOP_RELEASE_REPO;
|
|
11047
|
-
const version = opts.version?.trim() || resolveCurrentCliVersion();
|
|
11062
|
+
const version = opts.targetVersion?.trim() || opts.version?.trim() || resolveCurrentCliVersion();
|
|
11048
11063
|
const dryRun = opts.dryRun === true;
|
|
11049
11064
|
if (!installCli && !installDesktop) {
|
|
11050
11065
|
throw new Error("Nothing to start. Remove --no-cli or --no-desktop.");
|
|
@@ -11136,7 +11151,7 @@ async function startCommand(opts) {
|
|
|
11136
11151
|
await runStartPhase(
|
|
11137
11152
|
"Replacing existing Rudder Desktop if needed...",
|
|
11138
11153
|
"Existing Desktop install is ready for replacement.",
|
|
11139
|
-
() => prepareForDesktopReplace(installPaths, target)
|
|
11154
|
+
() => prepareForDesktopReplace(installPaths, target, { waitForActiveRuns: opts.waitForActiveRuns === true })
|
|
11140
11155
|
);
|
|
11141
11156
|
await runStartPhase(
|
|
11142
11157
|
"Installing portable Desktop app...",
|
|
@@ -11376,8 +11391,8 @@ function printItemCompleted(item) {
|
|
|
11376
11391
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
11377
11392
|
const entries = changes.map((changeRaw) => asRecord(changeRaw)).filter((change) => Boolean(change)).map((change) => {
|
|
11378
11393
|
const kind = asString(change.kind, "update");
|
|
11379
|
-
const
|
|
11380
|
-
return `${kind} ${
|
|
11394
|
+
const path24 = asString(change.path, "unknown");
|
|
11395
|
+
return `${kind} ${path24}`;
|
|
11381
11396
|
});
|
|
11382
11397
|
const preview = entries.length > 0 ? entries.slice(0, 6).join(", ") : "none";
|
|
11383
11398
|
const more = entries.length > 6 ? ` (+${entries.length - 6} more)` : "";
|
|
@@ -12558,40 +12573,46 @@ var RudderApiClient = class {
|
|
|
12558
12573
|
this.runId = opts.runId?.trim() || void 0;
|
|
12559
12574
|
this.recoverAuth = opts.recoverAuth;
|
|
12560
12575
|
}
|
|
12561
|
-
get(
|
|
12562
|
-
return this.request(
|
|
12576
|
+
get(path24, opts) {
|
|
12577
|
+
return this.request(path24, { method: "GET" }, opts);
|
|
12563
12578
|
}
|
|
12564
|
-
post(
|
|
12565
|
-
return this.request(
|
|
12579
|
+
post(path24, body, opts) {
|
|
12580
|
+
return this.request(path24, {
|
|
12566
12581
|
method: "POST",
|
|
12567
12582
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12568
12583
|
}, opts);
|
|
12569
12584
|
}
|
|
12570
|
-
|
|
12571
|
-
return this.request(
|
|
12585
|
+
postForm(path24, form, opts) {
|
|
12586
|
+
return this.request(path24, {
|
|
12587
|
+
method: "POST",
|
|
12588
|
+
body: form
|
|
12589
|
+
}, opts);
|
|
12590
|
+
}
|
|
12591
|
+
patch(path24, body, opts) {
|
|
12592
|
+
return this.request(path24, {
|
|
12572
12593
|
method: "PATCH",
|
|
12573
12594
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12574
12595
|
}, opts);
|
|
12575
12596
|
}
|
|
12576
|
-
put(
|
|
12577
|
-
return this.request(
|
|
12597
|
+
put(path24, body, opts) {
|
|
12598
|
+
return this.request(path24, {
|
|
12578
12599
|
method: "PUT",
|
|
12579
12600
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12580
12601
|
}, opts);
|
|
12581
12602
|
}
|
|
12582
|
-
delete(
|
|
12583
|
-
return this.request(
|
|
12603
|
+
delete(path24, opts) {
|
|
12604
|
+
return this.request(path24, { method: "DELETE" }, opts);
|
|
12584
12605
|
}
|
|
12585
12606
|
setApiKey(apiKey) {
|
|
12586
12607
|
this.apiKey = apiKey?.trim() || void 0;
|
|
12587
12608
|
}
|
|
12588
|
-
async request(
|
|
12589
|
-
const url = buildUrl(this.apiBase,
|
|
12609
|
+
async request(path24, init, opts, hasRetriedAuth = false) {
|
|
12610
|
+
const url = buildUrl(this.apiBase, path24);
|
|
12590
12611
|
const headers = {
|
|
12591
12612
|
accept: "application/json",
|
|
12592
12613
|
...toStringRecord(init.headers)
|
|
12593
12614
|
};
|
|
12594
|
-
if (init.body
|
|
12615
|
+
if (typeof init.body === "string") {
|
|
12595
12616
|
headers["content-type"] = headers["content-type"] ?? "application/json";
|
|
12596
12617
|
}
|
|
12597
12618
|
if (this.apiKey) {
|
|
@@ -12611,13 +12632,13 @@ var RudderApiClient = class {
|
|
|
12611
12632
|
const apiError = await toApiError(response);
|
|
12612
12633
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
12613
12634
|
const recoveredToken = await this.recoverAuth({
|
|
12614
|
-
path:
|
|
12635
|
+
path: path24,
|
|
12615
12636
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
12616
12637
|
error: apiError
|
|
12617
12638
|
});
|
|
12618
12639
|
if (recoveredToken) {
|
|
12619
12640
|
this.setApiKey(recoveredToken);
|
|
12620
|
-
return this.request(
|
|
12641
|
+
return this.request(path24, init, opts, true);
|
|
12621
12642
|
}
|
|
12622
12643
|
}
|
|
12623
12644
|
throw apiError;
|
|
@@ -12636,8 +12657,8 @@ function shouldAttachRunId(method) {
|
|
|
12636
12657
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
12637
12658
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
12638
12659
|
}
|
|
12639
|
-
function buildUrl(apiBase,
|
|
12640
|
-
const normalizedPath =
|
|
12660
|
+
function buildUrl(apiBase, path24) {
|
|
12661
|
+
const normalizedPath = path24.startsWith("/") ? path24 : `/${path24}`;
|
|
12641
12662
|
const [pathname, query] = normalizedPath.split("?");
|
|
12642
12663
|
const url = new URL2(apiBase);
|
|
12643
12664
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -14484,6 +14505,8 @@ ${organizationUrl}`);
|
|
|
14484
14505
|
|
|
14485
14506
|
// src/commands/client/issue.ts
|
|
14486
14507
|
init_src();
|
|
14508
|
+
import { readFile as readFile5, stat as stat2 } from "node:fs/promises";
|
|
14509
|
+
import path16 from "node:path";
|
|
14487
14510
|
|
|
14488
14511
|
// src/agent-v1-registry.ts
|
|
14489
14512
|
var AGENT_CLI_CAPABILITIES = [
|
|
@@ -14503,7 +14526,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14503
14526
|
id: "agent.inbox",
|
|
14504
14527
|
command: "rudder agent inbox",
|
|
14505
14528
|
category: "agent",
|
|
14506
|
-
description: "List the compact
|
|
14529
|
+
description: "List the compact assignee and reviewer work inbox for the authenticated agent.",
|
|
14507
14530
|
mutating: false,
|
|
14508
14531
|
contract: "agent-v1",
|
|
14509
14532
|
requiresOrgId: false,
|
|
@@ -14669,9 +14692,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14669
14692
|
},
|
|
14670
14693
|
{
|
|
14671
14694
|
id: "issue.comment",
|
|
14672
|
-
command: "rudder issue comment <issue> --body <text>",
|
|
14695
|
+
command: "rudder issue comment <issue> --body <text> [--image <path>]",
|
|
14673
14696
|
category: "issue",
|
|
14674
|
-
description: "Add a comment to an issue.",
|
|
14697
|
+
description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
|
|
14675
14698
|
mutating: true,
|
|
14676
14699
|
contract: "agent-v1",
|
|
14677
14700
|
requiresOrgId: false,
|
|
@@ -14705,9 +14728,21 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14705
14728
|
},
|
|
14706
14729
|
{
|
|
14707
14730
|
id: "issue.update",
|
|
14708
|
-
command: "rudder issue update <issue> ...",
|
|
14731
|
+
command: "rudder issue update <issue> ... [--image <path>]",
|
|
14732
|
+
category: "issue",
|
|
14733
|
+
description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
|
|
14734
|
+
mutating: true,
|
|
14735
|
+
contract: "agent-v1",
|
|
14736
|
+
requiresOrgId: false,
|
|
14737
|
+
requiresAgentId: false,
|
|
14738
|
+
requiresRunId: false,
|
|
14739
|
+
attachesRunIdWhenAvailable: true
|
|
14740
|
+
},
|
|
14741
|
+
{
|
|
14742
|
+
id: "issue.review",
|
|
14743
|
+
command: "rudder issue review <issue> --decision <decision> --comment <text>",
|
|
14709
14744
|
category: "issue",
|
|
14710
|
-
description: "
|
|
14745
|
+
description: "Record a structured reviewer decision with a required comment.",
|
|
14711
14746
|
mutating: true,
|
|
14712
14747
|
contract: "agent-v1",
|
|
14713
14748
|
requiresOrgId: false,
|
|
@@ -14717,9 +14752,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14717
14752
|
},
|
|
14718
14753
|
{
|
|
14719
14754
|
id: "issue.done",
|
|
14720
|
-
command: "rudder issue done <issue> --comment <text>",
|
|
14755
|
+
command: "rudder issue done <issue> --comment <text> [--image <path>]",
|
|
14721
14756
|
category: "issue",
|
|
14722
|
-
description: "Mark an issue done with a required completion comment.",
|
|
14757
|
+
description: "Mark an issue done with a required completion comment, optionally uploading images.",
|
|
14723
14758
|
mutating: true,
|
|
14724
14759
|
contract: "agent-v1",
|
|
14725
14760
|
requiresOrgId: false,
|
|
@@ -14729,9 +14764,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14729
14764
|
},
|
|
14730
14765
|
{
|
|
14731
14766
|
id: "issue.block",
|
|
14732
|
-
command: "rudder issue block <issue> --comment <text>",
|
|
14767
|
+
command: "rudder issue block <issue> --comment <text> [--image <path>]",
|
|
14733
14768
|
category: "issue",
|
|
14734
|
-
description: "Mark an issue blocked with a required blocker comment.",
|
|
14769
|
+
description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
|
|
14735
14770
|
mutating: true,
|
|
14736
14771
|
contract: "agent-v1",
|
|
14737
14772
|
requiresOrgId: false,
|
|
@@ -15010,8 +15045,8 @@ function registerIssueCommands(program) {
|
|
|
15010
15045
|
if (opts.assigneeAgentId) params.set("assigneeAgentId", opts.assigneeAgentId);
|
|
15011
15046
|
if (opts.projectId) params.set("projectId", opts.projectId);
|
|
15012
15047
|
const query = params.toString();
|
|
15013
|
-
const
|
|
15014
|
-
const rows = await ctx.api.get(
|
|
15048
|
+
const path24 = `/api/orgs/${ctx.orgId}/issues${query ? `?${query}` : ""}`;
|
|
15049
|
+
const rows = await ctx.api.get(path24) ?? [];
|
|
15015
15050
|
const filtered = filterIssueRows(rows, opts.match);
|
|
15016
15051
|
if (ctx.json) {
|
|
15017
15052
|
printOutput(filtered, { json: true });
|
|
@@ -15092,9 +15127,10 @@ function registerIssueCommands(program) {
|
|
|
15092
15127
|
{ includeCompany: false }
|
|
15093
15128
|
);
|
|
15094
15129
|
addCommonClientOptions(
|
|
15095
|
-
issue.command("update").description(getAgentCliCapabilityById("issue.update").description).argument("<issueId>", "Issue ID").option("--title <title>", "Issue title").option("--description <text>", "Issue description").option("--status <status>", "Issue status").option("--priority <priority>", "Issue priority").option("--assignee-agent-id <id>", "Assignee agent ID").option("--project-id <id>", "Project ID").option("--goal-id <id>", "Goal ID").option("--parent-id <id>", "Parent issue ID").option("--request-depth <n>", "Request depth integer").option("--billing-code <code>", "Billing code").option("--comment <text>", "Optional comment to add with update").option("--hidden-at <iso8601|null>", "Set hiddenAt timestamp or literal 'null'").action(async (issueId, opts) => {
|
|
15130
|
+
issue.command("update").description(getAgentCliCapabilityById("issue.update").description).argument("<issueId>", "Issue ID").option("--title <title>", "Issue title").option("--description <text>", "Issue description").option("--status <status>", "Issue status").option("--priority <priority>", "Issue priority").option("--assignee-agent-id <id>", "Assignee agent ID").option("--project-id <id>", "Project ID").option("--goal-id <id>", "Goal ID").option("--parent-id <id>", "Parent issue ID").option("--request-depth <n>", "Request depth integer").option("--billing-code <code>", "Billing code").option("--comment <text>", "Optional comment to add with update").option("--image <path>", "Image file to upload and append to the update comment; may be repeated", collectImagePath, []).option("--hidden-at <iso8601|null>", "Set hiddenAt timestamp or literal 'null'").action(async (issueId, opts) => {
|
|
15096
15131
|
try {
|
|
15097
15132
|
const ctx = resolveCommandContext(opts);
|
|
15133
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15098
15134
|
const payload = updateIssueSchema.parse({
|
|
15099
15135
|
title: opts.title,
|
|
15100
15136
|
description: opts.description,
|
|
@@ -15106,7 +15142,7 @@ function registerIssueCommands(program) {
|
|
|
15106
15142
|
parentId: opts.parentId,
|
|
15107
15143
|
requestDepth: parseOptionalInt(opts.requestDepth),
|
|
15108
15144
|
billingCode: opts.billingCode,
|
|
15109
|
-
comment
|
|
15145
|
+
comment,
|
|
15110
15146
|
hiddenAt: parseHiddenAt(opts.hiddenAt)
|
|
15111
15147
|
});
|
|
15112
15148
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, payload);
|
|
@@ -15117,11 +15153,12 @@ function registerIssueCommands(program) {
|
|
|
15117
15153
|
})
|
|
15118
15154
|
);
|
|
15119
15155
|
addCommonClientOptions(
|
|
15120
|
-
issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").requiredOption("--body <text>", "Comment body").option("--reopen", "Reopen if issue is done/cancelled").action(async (issueId, opts) => {
|
|
15156
|
+
issue.command("comment").description(getAgentCliCapabilityById("issue.comment").description).argument("<issueId>", "Issue ID").requiredOption("--body <text>", "Comment body").option("--image <path>", "Image file to upload and append to the comment; may be repeated", collectImagePath, []).option("--reopen", "Reopen if issue is done/cancelled").action(async (issueId, opts) => {
|
|
15121
15157
|
try {
|
|
15122
15158
|
const ctx = resolveCommandContext(opts);
|
|
15159
|
+
const body = await appendUploadedIssueImages(ctx, issueId, opts.body, opts.image);
|
|
15123
15160
|
const payload = addIssueCommentSchema.parse({
|
|
15124
|
-
body
|
|
15161
|
+
body,
|
|
15125
15162
|
reopen: opts.reopen
|
|
15126
15163
|
});
|
|
15127
15164
|
const comment = await ctx.api.post(`/api/issues/${issueId}/comments`, payload);
|
|
@@ -15132,11 +15169,15 @@ function registerIssueCommands(program) {
|
|
|
15132
15169
|
})
|
|
15133
15170
|
);
|
|
15134
15171
|
addCommonClientOptions(
|
|
15135
|
-
issue.command("
|
|
15172
|
+
issue.command("review").description(getAgentCliCapabilityById("issue.review").description).argument("<issueId>", "Issue ID").requiredOption(
|
|
15173
|
+
"--decision <decision>",
|
|
15174
|
+
"Review decision: approve, request_changes, needs_followup, or blocked"
|
|
15175
|
+
).requiredOption("--comment <text>", "Required review comment").action(async (issueId, opts) => {
|
|
15136
15176
|
try {
|
|
15137
15177
|
const ctx = resolveCommandContext(opts);
|
|
15178
|
+
const decision = parseReviewDecision(opts.decision);
|
|
15138
15179
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15139
|
-
|
|
15180
|
+
reviewDecision: decision,
|
|
15140
15181
|
comment: opts.comment
|
|
15141
15182
|
});
|
|
15142
15183
|
printOutput(updated, { json: ctx.json });
|
|
@@ -15146,12 +15187,28 @@ function registerIssueCommands(program) {
|
|
|
15146
15187
|
})
|
|
15147
15188
|
);
|
|
15148
15189
|
addCommonClientOptions(
|
|
15149
|
-
issue.command("
|
|
15190
|
+
issue.command("done").description(getAgentCliCapabilityById("issue.done").description).argument("<issueId>", "Issue ID").requiredOption("--comment <text>", "Required completion comment").option("--image <path>", "Image file to upload and append to the completion comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
|
|
15150
15191
|
try {
|
|
15151
15192
|
const ctx = resolveCommandContext(opts);
|
|
15193
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15194
|
+
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15195
|
+
status: "done",
|
|
15196
|
+
comment
|
|
15197
|
+
});
|
|
15198
|
+
printOutput(updated, { json: ctx.json });
|
|
15199
|
+
} catch (err) {
|
|
15200
|
+
handleCommandError(err);
|
|
15201
|
+
}
|
|
15202
|
+
})
|
|
15203
|
+
);
|
|
15204
|
+
addCommonClientOptions(
|
|
15205
|
+
issue.command("block").description(getAgentCliCapabilityById("issue.block").description).argument("<issueId>", "Issue ID").requiredOption("--comment <text>", "Required blocker comment").option("--image <path>", "Image file to upload and append to the blocker comment; may be repeated", collectImagePath, []).action(async (issueId, opts) => {
|
|
15206
|
+
try {
|
|
15207
|
+
const ctx = resolveCommandContext(opts);
|
|
15208
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15152
15209
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15153
15210
|
status: "blocked",
|
|
15154
|
-
comment
|
|
15211
|
+
comment
|
|
15155
15212
|
});
|
|
15156
15213
|
printOutput(updated, { json: ctx.json });
|
|
15157
15214
|
} catch (err) {
|
|
@@ -15275,6 +15332,80 @@ function registerIssueCommands(program) {
|
|
|
15275
15332
|
})
|
|
15276
15333
|
);
|
|
15277
15334
|
}
|
|
15335
|
+
function collectImagePath(value, previous) {
|
|
15336
|
+
const trimmed = value.trim();
|
|
15337
|
+
if (!trimmed) {
|
|
15338
|
+
throw new Error("--image path cannot be empty");
|
|
15339
|
+
}
|
|
15340
|
+
return [...previous, trimmed];
|
|
15341
|
+
}
|
|
15342
|
+
async function appendUploadedIssueImages(ctx, issueId, body, imagePaths) {
|
|
15343
|
+
const paths = imagePaths ?? [];
|
|
15344
|
+
if (paths.length === 0) return body;
|
|
15345
|
+
const issue = await ctx.api.get(`/api/issues/${issueId}`);
|
|
15346
|
+
if (!issue) {
|
|
15347
|
+
throw new Error("Issue not found");
|
|
15348
|
+
}
|
|
15349
|
+
const links = [];
|
|
15350
|
+
for (const imagePath of paths) {
|
|
15351
|
+
const attachment = await uploadIssueCommentImage(ctx, issue, imagePath);
|
|
15352
|
+
links.push(formatAttachmentMarkdown(attachment));
|
|
15353
|
+
}
|
|
15354
|
+
const base = body?.trimEnd() ?? "";
|
|
15355
|
+
const imageBlock = links.join("\n");
|
|
15356
|
+
return base ? `${base}
|
|
15357
|
+
|
|
15358
|
+
${imageBlock}` : imageBlock;
|
|
15359
|
+
}
|
|
15360
|
+
async function uploadIssueCommentImage(ctx, issue, imagePath) {
|
|
15361
|
+
const resolvedPath = path16.resolve(process.cwd(), imagePath);
|
|
15362
|
+
const stats = await stat2(resolvedPath).catch((err) => {
|
|
15363
|
+
throw new Error(`Unable to read image ${imagePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
15364
|
+
});
|
|
15365
|
+
if (!stats.isFile()) {
|
|
15366
|
+
throw new Error(`Image path must be a file: ${imagePath}`);
|
|
15367
|
+
}
|
|
15368
|
+
const filename = path16.basename(resolvedPath);
|
|
15369
|
+
const contentType = inferCommentImageContentType(filename);
|
|
15370
|
+
const buffer = await readFile5(resolvedPath);
|
|
15371
|
+
if (buffer.length <= 0) {
|
|
15372
|
+
throw new Error(`Image is empty: ${imagePath}`);
|
|
15373
|
+
}
|
|
15374
|
+
const form = new FormData();
|
|
15375
|
+
form.set("usage", "comment_inline");
|
|
15376
|
+
form.set("file", new Blob([buffer], { type: contentType }), filename);
|
|
15377
|
+
const attachment = await ctx.api.postForm(
|
|
15378
|
+
`/api/orgs/${issue.orgId}/issues/${issue.id}/attachments`,
|
|
15379
|
+
form
|
|
15380
|
+
);
|
|
15381
|
+
if (!attachment) {
|
|
15382
|
+
throw new Error(`Image upload returned no attachment: ${imagePath}`);
|
|
15383
|
+
}
|
|
15384
|
+
return attachment;
|
|
15385
|
+
}
|
|
15386
|
+
function inferCommentImageContentType(filename) {
|
|
15387
|
+
const ext = path16.extname(filename).toLowerCase();
|
|
15388
|
+
switch (ext) {
|
|
15389
|
+
case ".png":
|
|
15390
|
+
return "image/png";
|
|
15391
|
+
case ".jpg":
|
|
15392
|
+
case ".jpeg":
|
|
15393
|
+
return "image/jpeg";
|
|
15394
|
+
case ".webp":
|
|
15395
|
+
return "image/webp";
|
|
15396
|
+
case ".gif":
|
|
15397
|
+
return "image/gif";
|
|
15398
|
+
default:
|
|
15399
|
+
throw new Error(`Unsupported comment image type: ${filename}. Use PNG, JPEG, WebP, or GIF.`);
|
|
15400
|
+
}
|
|
15401
|
+
}
|
|
15402
|
+
function formatAttachmentMarkdown(attachment) {
|
|
15403
|
+
const alt = escapeMarkdownAltText(attachment.originalFilename ?? "image");
|
|
15404
|
+
return ``;
|
|
15405
|
+
}
|
|
15406
|
+
function escapeMarkdownAltText(value) {
|
|
15407
|
+
return value.replaceAll("\\", "\\\\").replaceAll("]", "\\]");
|
|
15408
|
+
}
|
|
15278
15409
|
function parseCsv(value) {
|
|
15279
15410
|
if (!value) return [];
|
|
15280
15411
|
return value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
@@ -15292,6 +15423,13 @@ function parseHiddenAt(value) {
|
|
|
15292
15423
|
if (value.trim().toLowerCase() === "null") return null;
|
|
15293
15424
|
return value;
|
|
15294
15425
|
}
|
|
15426
|
+
function parseReviewDecision(value) {
|
|
15427
|
+
const normalized = value.trim();
|
|
15428
|
+
if (normalized === "approve" || normalized === "request_changes" || normalized === "needs_followup" || normalized === "blocked") {
|
|
15429
|
+
return normalized;
|
|
15430
|
+
}
|
|
15431
|
+
throw new Error("Invalid review decision. Use approve, request_changes, needs_followup, or blocked.");
|
|
15432
|
+
}
|
|
15295
15433
|
function filterIssueRows(rows, match) {
|
|
15296
15434
|
if (!match?.trim()) return rows;
|
|
15297
15435
|
const needle = match.trim().toLowerCase();
|
|
@@ -15306,7 +15444,7 @@ init_src();
|
|
|
15306
15444
|
|
|
15307
15445
|
// ../packages/agent-runtime-utils/src/server-utils.ts
|
|
15308
15446
|
import { constants as fsConstants2, promises as fs12 } from "node:fs";
|
|
15309
|
-
import
|
|
15447
|
+
import path17 from "node:path";
|
|
15310
15448
|
var MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
|
|
15311
15449
|
var MAX_EXCERPT_BYTES = 32 * 1024;
|
|
15312
15450
|
var RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES = [
|
|
@@ -15354,8 +15492,8 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
15354
15492
|
].join("\n");
|
|
15355
15493
|
async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
|
|
15356
15494
|
const candidates = [
|
|
15357
|
-
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) =>
|
|
15358
|
-
...additionalCandidates.map((candidate) =>
|
|
15495
|
+
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path17.resolve(moduleDir, relativePath)),
|
|
15496
|
+
...additionalCandidates.map((candidate) => path17.resolve(candidate))
|
|
15359
15497
|
];
|
|
15360
15498
|
const seenRoots = /* @__PURE__ */ new Set();
|
|
15361
15499
|
for (const root of candidates) {
|
|
@@ -15373,12 +15511,12 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
15373
15511
|
const removed = [];
|
|
15374
15512
|
for (const entry of entries) {
|
|
15375
15513
|
if (allowed.has(entry.name)) continue;
|
|
15376
|
-
const target =
|
|
15514
|
+
const target = path17.join(skillsHome, entry.name);
|
|
15377
15515
|
const existing = await fs12.lstat(target).catch(() => null);
|
|
15378
15516
|
if (!existing?.isSymbolicLink()) continue;
|
|
15379
15517
|
const linkedPath = await fs12.readlink(target).catch(() => null);
|
|
15380
15518
|
if (!linkedPath) continue;
|
|
15381
|
-
const resolvedLinkedPath =
|
|
15519
|
+
const resolvedLinkedPath = path17.isAbsolute(linkedPath) ? linkedPath : path17.resolve(path17.dirname(target), linkedPath);
|
|
15382
15520
|
if (!isMaintainerOnlySkillTarget(linkedPath) && !isMaintainerOnlySkillTarget(resolvedLinkedPath)) {
|
|
15383
15521
|
continue;
|
|
15384
15522
|
}
|
|
@@ -15394,18 +15532,18 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
15394
15532
|
// src/commands/client/agent.ts
|
|
15395
15533
|
import fs13 from "node:fs/promises";
|
|
15396
15534
|
import os2 from "node:os";
|
|
15397
|
-
import
|
|
15535
|
+
import path18 from "node:path";
|
|
15398
15536
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
15399
|
-
var __moduleDir =
|
|
15537
|
+
var __moduleDir = path18.dirname(fileURLToPath4(import.meta.url));
|
|
15400
15538
|
function codexSkillsHome() {
|
|
15401
15539
|
const fromEnv = process.env.CODEX_HOME?.trim();
|
|
15402
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
15403
|
-
return
|
|
15540
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path18.join(os2.homedir(), ".codex");
|
|
15541
|
+
return path18.join(base, "skills");
|
|
15404
15542
|
}
|
|
15405
15543
|
function claudeSkillsHome() {
|
|
15406
15544
|
const fromEnv = process.env.CLAUDE_HOME?.trim();
|
|
15407
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
15408
|
-
return
|
|
15545
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path18.join(os2.homedir(), ".claude");
|
|
15546
|
+
return path18.join(base, "skills");
|
|
15409
15547
|
}
|
|
15410
15548
|
async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
15411
15549
|
const summary = {
|
|
@@ -15424,8 +15562,8 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
15424
15562
|
);
|
|
15425
15563
|
for (const entry of entries) {
|
|
15426
15564
|
if (!entry.isDirectory()) continue;
|
|
15427
|
-
const source =
|
|
15428
|
-
const target =
|
|
15565
|
+
const source = path18.join(sourceSkillsDir, entry.name);
|
|
15566
|
+
const target = path18.join(targetSkillsDir, entry.name);
|
|
15429
15567
|
const existing = await fs13.lstat(target).catch(() => null);
|
|
15430
15568
|
if (existing) {
|
|
15431
15569
|
if (existing.isSymbolicLink()) {
|
|
@@ -15446,7 +15584,7 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
15446
15584
|
continue;
|
|
15447
15585
|
}
|
|
15448
15586
|
}
|
|
15449
|
-
const resolvedLinkedPath =
|
|
15587
|
+
const resolvedLinkedPath = path18.isAbsolute(linkedPath) ? linkedPath : path18.resolve(path18.dirname(target), linkedPath);
|
|
15450
15588
|
const linkedTargetExists = await fs13.stat(resolvedLinkedPath).then(() => true).catch(() => false);
|
|
15451
15589
|
if (!linkedTargetExists) {
|
|
15452
15590
|
await fs13.unlink(target);
|
|
@@ -15512,6 +15650,7 @@ function registerAgentCommands(program) {
|
|
|
15512
15650
|
formatInlineRecord({
|
|
15513
15651
|
identifier: row.identifier,
|
|
15514
15652
|
id: row.id,
|
|
15653
|
+
relationship: row.relationship ?? "assignee",
|
|
15515
15654
|
status: row.status,
|
|
15516
15655
|
priority: row.priority,
|
|
15517
15656
|
title: row.title,
|
|
@@ -15726,7 +15865,7 @@ function registerAgentCommands(program) {
|
|
|
15726
15865
|
}
|
|
15727
15866
|
const installSummaries = [];
|
|
15728
15867
|
if (opts.installSkills !== false) {
|
|
15729
|
-
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [
|
|
15868
|
+
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path18.resolve(process.cwd(), "skills")]);
|
|
15730
15869
|
if (!skillsDir) {
|
|
15731
15870
|
throw new Error(
|
|
15732
15871
|
"Could not locate local Rudder skills directory. Expected ./skills in the repo checkout."
|
|
@@ -15983,8 +16122,8 @@ function registerActivityCommands(program) {
|
|
|
15983
16122
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
15984
16123
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
15985
16124
|
const query = params.toString();
|
|
15986
|
-
const
|
|
15987
|
-
const rows = await ctx.api.get(
|
|
16125
|
+
const path24 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
16126
|
+
const rows = await ctx.api.get(path24) ?? [];
|
|
15988
16127
|
if (ctx.json) {
|
|
15989
16128
|
printOutput(rows, { json: true });
|
|
15990
16129
|
return;
|
|
@@ -16153,11 +16292,11 @@ function parseCsv4(value) {
|
|
|
16153
16292
|
|
|
16154
16293
|
// src/config/data-dir.ts
|
|
16155
16294
|
init_home();
|
|
16156
|
-
import
|
|
16295
|
+
import path19 from "node:path";
|
|
16157
16296
|
function applyDataDirOverride(options, support = {}) {
|
|
16158
16297
|
const rawDataDir = options.dataDir?.trim();
|
|
16159
16298
|
if (!rawDataDir) return null;
|
|
16160
|
-
const resolvedDataDir =
|
|
16299
|
+
const resolvedDataDir = path19.resolve(expandHomePrefix(rawDataDir));
|
|
16161
16300
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
16162
16301
|
if (support.hasConfigOption) {
|
|
16163
16302
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -16202,7 +16341,7 @@ import {
|
|
|
16202
16341
|
writeFileSync
|
|
16203
16342
|
} from "node:fs";
|
|
16204
16343
|
import os3 from "node:os";
|
|
16205
|
-
import
|
|
16344
|
+
import path21 from "node:path";
|
|
16206
16345
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
16207
16346
|
import { createServer } from "node:net";
|
|
16208
16347
|
import { Readable as Readable2 } from "node:stream";
|
|
@@ -16213,7 +16352,7 @@ import { and as and2, eq as eq2, inArray, sql as sql3 } from "drizzle-orm";
|
|
|
16213
16352
|
// src/commands/worktree-lib.ts
|
|
16214
16353
|
init_home();
|
|
16215
16354
|
import { randomInt } from "node:crypto";
|
|
16216
|
-
import
|
|
16355
|
+
import path20 from "node:path";
|
|
16217
16356
|
var DEFAULT_WORKTREE_HOME = "~/.rudder-worktrees";
|
|
16218
16357
|
var WORKTREE_SEED_MODES = ["minimal", "full"];
|
|
16219
16358
|
var MINIMAL_WORKTREE_EXCLUDED_TABLES = [
|
|
@@ -16261,7 +16400,7 @@ function sanitizeWorktreeInstanceId(rawValue) {
|
|
|
16261
16400
|
return normalized || "worktree";
|
|
16262
16401
|
}
|
|
16263
16402
|
function resolveSuggestedWorktreeName(cwd, explicitName) {
|
|
16264
|
-
return nonEmpty(explicitName) ??
|
|
16403
|
+
return nonEmpty(explicitName) ?? path20.basename(path20.resolve(cwd));
|
|
16265
16404
|
}
|
|
16266
16405
|
function hslComponentToHex(n) {
|
|
16267
16406
|
return Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
|
|
@@ -16301,24 +16440,24 @@ function generateWorktreeColor() {
|
|
|
16301
16440
|
return hslToHex(randomInt(0, 360), 68, 56);
|
|
16302
16441
|
}
|
|
16303
16442
|
function resolveWorktreeLocalPaths(opts) {
|
|
16304
|
-
const cwd =
|
|
16305
|
-
const homeDir =
|
|
16306
|
-
const instanceRoot =
|
|
16307
|
-
const repoConfigDir =
|
|
16443
|
+
const cwd = path20.resolve(opts.cwd);
|
|
16444
|
+
const homeDir = path20.resolve(expandHomePrefix(opts.homeDir ?? DEFAULT_WORKTREE_HOME));
|
|
16445
|
+
const instanceRoot = path20.resolve(homeDir, "instances", opts.instanceId);
|
|
16446
|
+
const repoConfigDir = path20.resolve(cwd, ".rudder");
|
|
16308
16447
|
return {
|
|
16309
16448
|
cwd,
|
|
16310
16449
|
repoConfigDir,
|
|
16311
|
-
configPath:
|
|
16312
|
-
envPath:
|
|
16450
|
+
configPath: path20.resolve(repoConfigDir, "config.json"),
|
|
16451
|
+
envPath: path20.resolve(repoConfigDir, ".env"),
|
|
16313
16452
|
homeDir,
|
|
16314
16453
|
instanceId: opts.instanceId,
|
|
16315
16454
|
instanceRoot,
|
|
16316
|
-
contextPath:
|
|
16317
|
-
embeddedPostgresDataDir:
|
|
16318
|
-
backupDir:
|
|
16319
|
-
logDir:
|
|
16320
|
-
secretsKeyFilePath:
|
|
16321
|
-
storageDir:
|
|
16455
|
+
contextPath: path20.resolve(homeDir, "context.json"),
|
|
16456
|
+
embeddedPostgresDataDir: path20.resolve(instanceRoot, "db"),
|
|
16457
|
+
backupDir: path20.resolve(instanceRoot, "data", "backups"),
|
|
16458
|
+
logDir: path20.resolve(instanceRoot, "logs"),
|
|
16459
|
+
secretsKeyFilePath: path20.resolve(instanceRoot, "secrets", "master.key"),
|
|
16460
|
+
storageDir: path20.resolve(instanceRoot, "data", "storage")
|
|
16322
16461
|
};
|
|
16323
16462
|
}
|
|
16324
16463
|
function rewriteLocalUrlPort(rawUrl, port) {
|
|
@@ -16842,7 +16981,7 @@ function isCurrentSourceConfigPath(sourceConfigPath) {
|
|
|
16842
16981
|
if (!currentConfigPath || currentConfigPath.trim().length === 0) {
|
|
16843
16982
|
return false;
|
|
16844
16983
|
}
|
|
16845
|
-
return
|
|
16984
|
+
return path21.resolve(currentConfigPath) === path21.resolve(sourceConfigPath);
|
|
16846
16985
|
}
|
|
16847
16986
|
var WORKTREE_NAME_PREFIX = "rudder-";
|
|
16848
16987
|
function resolveWorktreeMakeName(name) {
|
|
@@ -16880,9 +17019,9 @@ function normalizeStorageObjectKey(objectKey) {
|
|
|
16880
17019
|
return parts.join("/");
|
|
16881
17020
|
}
|
|
16882
17021
|
function resolveLocalStoragePath(baseDir, objectKey) {
|
|
16883
|
-
const resolved =
|
|
16884
|
-
const root =
|
|
16885
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
17022
|
+
const resolved = path21.resolve(baseDir, normalizeStorageObjectKey(objectKey));
|
|
17023
|
+
const root = path21.resolve(baseDir);
|
|
17024
|
+
if (resolved !== root && !resolved.startsWith(`${root}${path21.sep}`)) {
|
|
16886
17025
|
throw new Error("Invalid object key path.");
|
|
16887
17026
|
}
|
|
16888
17027
|
return resolved;
|
|
@@ -16933,7 +17072,7 @@ function createConfiguredStorageFromRudderConfig(config) {
|
|
|
16933
17072
|
async putObject(orgId, objectKey, body) {
|
|
16934
17073
|
assertStorageCompanyPrefix(orgId, objectKey);
|
|
16935
17074
|
const filePath = resolveLocalStoragePath(baseDir, objectKey);
|
|
16936
|
-
await fsPromises.mkdir(
|
|
17075
|
+
await fsPromises.mkdir(path21.dirname(filePath), { recursive: true });
|
|
16937
17076
|
await fsPromises.writeFile(filePath, body);
|
|
16938
17077
|
}
|
|
16939
17078
|
};
|
|
@@ -17017,7 +17156,7 @@ async function readSourceAttachmentBody(sourceStorages, orgId, objectKey) {
|
|
|
17017
17156
|
return null;
|
|
17018
17157
|
}
|
|
17019
17158
|
function resolveWorktreeMakeTargetPath(name) {
|
|
17020
|
-
return
|
|
17159
|
+
return path21.resolve(os3.homedir(), resolveWorktreeMakeName(name));
|
|
17021
17160
|
}
|
|
17022
17161
|
function extractExecSyncErrorMessage(error) {
|
|
17023
17162
|
if (!error || typeof error !== "object") {
|
|
@@ -17123,10 +17262,10 @@ function detectGitWorkspaceInfo(cwd) {
|
|
|
17123
17262
|
stdio: ["ignore", "pipe", "ignore"]
|
|
17124
17263
|
}).trim();
|
|
17125
17264
|
return {
|
|
17126
|
-
root:
|
|
17127
|
-
commonDir:
|
|
17128
|
-
gitDir:
|
|
17129
|
-
hooksPath:
|
|
17265
|
+
root: path21.resolve(root),
|
|
17266
|
+
commonDir: path21.resolve(root, commonDirRaw),
|
|
17267
|
+
gitDir: path21.resolve(root, gitDirRaw),
|
|
17268
|
+
hooksPath: path21.resolve(root, hooksPathRaw)
|
|
17130
17269
|
};
|
|
17131
17270
|
} catch {
|
|
17132
17271
|
return null;
|
|
@@ -17139,8 +17278,8 @@ function copyDirectoryContents(sourceDir, targetDir) {
|
|
|
17139
17278
|
mkdirSync3(targetDir, { recursive: true });
|
|
17140
17279
|
let copied = false;
|
|
17141
17280
|
for (const entry of entries) {
|
|
17142
|
-
const sourcePath =
|
|
17143
|
-
const targetPath =
|
|
17281
|
+
const sourcePath = path21.resolve(sourceDir, entry.name);
|
|
17282
|
+
const targetPath = path21.resolve(targetDir, entry.name);
|
|
17144
17283
|
if (entry.isDirectory()) {
|
|
17145
17284
|
mkdirSync3(targetPath, { recursive: true });
|
|
17146
17285
|
copyDirectoryContents(sourcePath, targetPath);
|
|
@@ -17166,7 +17305,7 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
17166
17305
|
const workspace = detectGitWorkspaceInfo(cwd);
|
|
17167
17306
|
if (!workspace) return null;
|
|
17168
17307
|
const sourceHooksPath = workspace.hooksPath;
|
|
17169
|
-
const targetHooksPath =
|
|
17308
|
+
const targetHooksPath = path21.resolve(workspace.gitDir, "hooks");
|
|
17170
17309
|
if (sourceHooksPath === targetHooksPath) {
|
|
17171
17310
|
return {
|
|
17172
17311
|
sourceHooksPath,
|
|
@@ -17181,17 +17320,17 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
17181
17320
|
};
|
|
17182
17321
|
}
|
|
17183
17322
|
function rebindWorkspaceCwd(input) {
|
|
17184
|
-
const sourceRepoRoot =
|
|
17185
|
-
const targetRepoRoot =
|
|
17186
|
-
const workspaceCwd =
|
|
17187
|
-
const relative =
|
|
17323
|
+
const sourceRepoRoot = path21.resolve(input.sourceRepoRoot);
|
|
17324
|
+
const targetRepoRoot = path21.resolve(input.targetRepoRoot);
|
|
17325
|
+
const workspaceCwd = path21.resolve(input.workspaceCwd);
|
|
17326
|
+
const relative = path21.relative(sourceRepoRoot, workspaceCwd);
|
|
17188
17327
|
if (!relative || relative === "") {
|
|
17189
17328
|
return targetRepoRoot;
|
|
17190
17329
|
}
|
|
17191
|
-
if (relative.startsWith("..") ||
|
|
17330
|
+
if (relative.startsWith("..") || path21.isAbsolute(relative)) {
|
|
17192
17331
|
return null;
|
|
17193
17332
|
}
|
|
17194
|
-
return
|
|
17333
|
+
return path21.resolve(targetRepoRoot, relative);
|
|
17195
17334
|
}
|
|
17196
17335
|
async function rebindSeededProjectWorkspaces(input) {
|
|
17197
17336
|
const targetRepo = detectGitWorkspaceInfo(input.currentCwd);
|
|
@@ -17217,7 +17356,7 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
17217
17356
|
workspaceCwd
|
|
17218
17357
|
});
|
|
17219
17358
|
if (!reboundCwd) continue;
|
|
17220
|
-
const normalizedCurrent =
|
|
17359
|
+
const normalizedCurrent = path21.resolve(workspaceCwd);
|
|
17221
17360
|
if (reboundCwd === normalizedCurrent) continue;
|
|
17222
17361
|
if (!existsSync3(reboundCwd)) continue;
|
|
17223
17362
|
await db.update(projectWorkspaces).set({
|
|
@@ -17236,14 +17375,14 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
17236
17375
|
}
|
|
17237
17376
|
}
|
|
17238
17377
|
function resolveSourceConfigPath(opts) {
|
|
17239
|
-
if (opts.sourceConfigPathOverride) return
|
|
17240
|
-
if (opts.fromConfig) return
|
|
17378
|
+
if (opts.sourceConfigPathOverride) return path21.resolve(opts.sourceConfigPathOverride);
|
|
17379
|
+
if (opts.fromConfig) return path21.resolve(opts.fromConfig);
|
|
17241
17380
|
if (!opts.fromDataDir && !opts.fromInstance) {
|
|
17242
17381
|
return resolveConfigPath();
|
|
17243
17382
|
}
|
|
17244
|
-
const sourceHome =
|
|
17383
|
+
const sourceHome = path21.resolve(expandHomePrefix(opts.fromDataDir ?? "~/.rudder"));
|
|
17245
17384
|
const sourceInstanceId = sanitizeWorktreeInstanceId(opts.fromInstance ?? "default");
|
|
17246
|
-
return
|
|
17385
|
+
return path21.resolve(sourceHome, "instances", sourceInstanceId, "config.json");
|
|
17247
17386
|
}
|
|
17248
17387
|
function resolveSourceConnectionString(config, envEntries, portOverride) {
|
|
17249
17388
|
if (config.database.mode === "postgres") {
|
|
@@ -17262,7 +17401,7 @@ function copySeededSecretsKey(input) {
|
|
|
17262
17401
|
if (input.sourceConfig.secrets.provider !== "local_encrypted") {
|
|
17263
17402
|
return;
|
|
17264
17403
|
}
|
|
17265
|
-
mkdirSync3(
|
|
17404
|
+
mkdirSync3(path21.dirname(input.targetKeyFilePath), { recursive: true });
|
|
17266
17405
|
const allowProcessEnvFallback = isCurrentSourceConfigPath(input.sourceConfigPath);
|
|
17267
17406
|
const sourceInlineMasterKey = nonEmpty2(input.sourceEnvEntries.RUDDER_SECRETS_MASTER_KEY) ?? (allowProcessEnvFallback ? nonEmpty2(process.env.RUDDER_SECRETS_MASTER_KEY) : null);
|
|
17268
17407
|
if (sourceInlineMasterKey) {
|
|
@@ -17301,7 +17440,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
17301
17440
|
"Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again."
|
|
17302
17441
|
);
|
|
17303
17442
|
}
|
|
17304
|
-
const postmasterPidFile =
|
|
17443
|
+
const postmasterPidFile = path21.resolve(dataDir, "postmaster.pid");
|
|
17305
17444
|
const runningPid = readRunningPostmasterPid(postmasterPidFile);
|
|
17306
17445
|
if (runningPid) {
|
|
17307
17446
|
return {
|
|
@@ -17324,7 +17463,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
17324
17463
|
onError: () => {
|
|
17325
17464
|
}
|
|
17326
17465
|
});
|
|
17327
|
-
if (!existsSync3(
|
|
17466
|
+
if (!existsSync3(path21.resolve(dataDir, "PG_VERSION"))) {
|
|
17328
17467
|
await instance.initialise();
|
|
17329
17468
|
}
|
|
17330
17469
|
if (existsSync3(postmasterPidFile)) {
|
|
@@ -17365,7 +17504,7 @@ async function seedWorktreeDatabase(input) {
|
|
|
17365
17504
|
);
|
|
17366
17505
|
const backup = await runDatabaseBackup({
|
|
17367
17506
|
connectionString: sourceConnectionString,
|
|
17368
|
-
backupDir:
|
|
17507
|
+
backupDir: path21.resolve(input.targetPaths.backupDir, "seed"),
|
|
17369
17508
|
retentionDays: 7,
|
|
17370
17509
|
filenamePrefix: `${input.instanceId}-seed`,
|
|
17371
17510
|
includeMigrationJournal: true,
|
|
@@ -17524,7 +17663,7 @@ async function worktreeMakeCommand(nameArg, opts) {
|
|
|
17524
17663
|
if (existsSync3(targetPath)) {
|
|
17525
17664
|
throw new Error(`Target path already exists: ${targetPath}`);
|
|
17526
17665
|
}
|
|
17527
|
-
mkdirSync3(
|
|
17666
|
+
mkdirSync3(path21.dirname(targetPath), { recursive: true });
|
|
17528
17667
|
if (startPoint) {
|
|
17529
17668
|
const [remote] = startPoint.split("/", 1);
|
|
17530
17669
|
try {
|
|
@@ -17620,15 +17759,15 @@ function parseGitWorktreeList(cwd) {
|
|
|
17620
17759
|
return entries;
|
|
17621
17760
|
}
|
|
17622
17761
|
function toMergeSourceChoices(cwd) {
|
|
17623
|
-
const currentCwd =
|
|
17762
|
+
const currentCwd = path21.resolve(cwd);
|
|
17624
17763
|
return parseGitWorktreeList(cwd).map((entry) => {
|
|
17625
17764
|
const branchLabel = entry.branch?.replace(/^refs\/heads\//, "") ?? "(detached)";
|
|
17626
|
-
const worktreePath =
|
|
17765
|
+
const worktreePath = path21.resolve(entry.worktree);
|
|
17627
17766
|
return {
|
|
17628
17767
|
worktree: worktreePath,
|
|
17629
17768
|
branch: entry.branch,
|
|
17630
17769
|
branchLabel,
|
|
17631
|
-
hasRudderConfig: existsSync3(
|
|
17770
|
+
hasRudderConfig: existsSync3(path21.resolve(worktreePath, ".rudder", "config.json")),
|
|
17632
17771
|
isCurrent: worktreePath === currentCwd
|
|
17633
17772
|
};
|
|
17634
17773
|
});
|
|
@@ -17676,14 +17815,14 @@ async function worktreeCleanupCommand(nameArg, opts) {
|
|
|
17676
17815
|
const sourceCwd = process.cwd();
|
|
17677
17816
|
const targetPath = resolveWorktreeMakeTargetPath(name);
|
|
17678
17817
|
const instanceId = sanitizeWorktreeInstanceId(opts.instance ?? name);
|
|
17679
|
-
const homeDir =
|
|
17680
|
-
const instanceRoot =
|
|
17818
|
+
const homeDir = path21.resolve(expandHomePrefix(resolveWorktreeHome(opts.home)));
|
|
17819
|
+
const instanceRoot = path21.resolve(homeDir, "instances", instanceId);
|
|
17681
17820
|
const hasBranch = localBranchExists(sourceCwd, name);
|
|
17682
17821
|
const hasTargetDir = existsSync3(targetPath);
|
|
17683
17822
|
const hasInstanceData = existsSync3(instanceRoot);
|
|
17684
17823
|
const worktrees = parseGitWorktreeList(sourceCwd);
|
|
17685
17824
|
const linkedWorktree = worktrees.find(
|
|
17686
|
-
(wt) => wt.branch === `refs/heads/${name}` ||
|
|
17825
|
+
(wt) => wt.branch === `refs/heads/${name}` || path21.resolve(wt.worktree) === path21.resolve(targetPath)
|
|
17687
17826
|
);
|
|
17688
17827
|
if (!hasBranch && !hasTargetDir && !hasInstanceData && !linkedWorktree) {
|
|
17689
17828
|
p17.log.info("Nothing to clean up \u2014 no branch, worktree directory, or instance data found.");
|
|
@@ -17801,7 +17940,7 @@ async function closeDb(db) {
|
|
|
17801
17940
|
}
|
|
17802
17941
|
function resolveCurrentEndpoint() {
|
|
17803
17942
|
return {
|
|
17804
|
-
rootPath:
|
|
17943
|
+
rootPath: path21.resolve(process.cwd()),
|
|
17805
17944
|
configPath: resolveConfigPath(),
|
|
17806
17945
|
label: "current",
|
|
17807
17946
|
isCurrent: true
|
|
@@ -17812,12 +17951,12 @@ function resolveAttachmentLookupStorages(input) {
|
|
|
17812
17951
|
input.sourceEndpoint.configPath,
|
|
17813
17952
|
resolveCurrentEndpoint().configPath,
|
|
17814
17953
|
input.targetEndpoint.configPath,
|
|
17815
|
-
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) =>
|
|
17954
|
+
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) => path21.resolve(choice.worktree, ".rudder", "config.json"))
|
|
17816
17955
|
];
|
|
17817
17956
|
const seen = /* @__PURE__ */ new Set();
|
|
17818
17957
|
const storages = [];
|
|
17819
17958
|
for (const configPath of orderedConfigPaths) {
|
|
17820
|
-
const resolved =
|
|
17959
|
+
const resolved = path21.resolve(configPath);
|
|
17821
17960
|
if (seen.has(resolved) || !existsSync3(resolved)) continue;
|
|
17822
17961
|
seen.add(resolved);
|
|
17823
17962
|
storages.push(openConfiguredStorage(resolved));
|
|
@@ -18236,7 +18375,7 @@ function resolveEndpointFromChoice(choice) {
|
|
|
18236
18375
|
}
|
|
18237
18376
|
return {
|
|
18238
18377
|
rootPath: choice.worktree,
|
|
18239
|
-
configPath:
|
|
18378
|
+
configPath: path21.resolve(choice.worktree, ".rudder", "config.json"),
|
|
18240
18379
|
label: choice.branchLabel,
|
|
18241
18380
|
isCurrent: false
|
|
18242
18381
|
};
|
|
@@ -18252,24 +18391,24 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
18252
18391
|
return currentEndpoint;
|
|
18253
18392
|
}
|
|
18254
18393
|
const choices = toMergeSourceChoices(process.cwd());
|
|
18255
|
-
const directPath =
|
|
18394
|
+
const directPath = path21.resolve(trimmed);
|
|
18256
18395
|
if (existsSync3(directPath)) {
|
|
18257
18396
|
if (allowCurrent && directPath === currentEndpoint.rootPath) {
|
|
18258
18397
|
return currentEndpoint;
|
|
18259
18398
|
}
|
|
18260
|
-
const configPath =
|
|
18399
|
+
const configPath = path21.resolve(directPath, ".rudder", "config.json");
|
|
18261
18400
|
if (!existsSync3(configPath)) {
|
|
18262
18401
|
throw new Error(`Resolved worktree path ${directPath} does not contain .rudder/config.json.`);
|
|
18263
18402
|
}
|
|
18264
18403
|
return {
|
|
18265
18404
|
rootPath: directPath,
|
|
18266
18405
|
configPath,
|
|
18267
|
-
label:
|
|
18406
|
+
label: path21.basename(directPath),
|
|
18268
18407
|
isCurrent: false
|
|
18269
18408
|
};
|
|
18270
18409
|
}
|
|
18271
18410
|
const matched = choices.find(
|
|
18272
|
-
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath ||
|
|
18411
|
+
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath || path21.basename(choice.worktree) === trimmed || choice.branchLabel === trimmed)
|
|
18273
18412
|
);
|
|
18274
18413
|
if (!matched) {
|
|
18275
18414
|
throw new Error(
|
|
@@ -18282,9 +18421,9 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
18282
18421
|
return resolveEndpointFromChoice(matched);
|
|
18283
18422
|
}
|
|
18284
18423
|
async function promptForSourceEndpoint(excludeWorktreePath) {
|
|
18285
|
-
const excluded = excludeWorktreePath ?
|
|
18424
|
+
const excluded = excludeWorktreePath ? path21.resolve(excludeWorktreePath) : null;
|
|
18286
18425
|
const currentEndpoint = resolveCurrentEndpoint();
|
|
18287
|
-
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) =>
|
|
18426
|
+
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) => path21.resolve(choice.worktree) !== excluded).map((choice) => ({
|
|
18288
18427
|
value: choice.isCurrent ? "__current__" : choice.worktree,
|
|
18289
18428
|
label: choice.branchLabel,
|
|
18290
18429
|
hint: `${choice.worktree}${choice.isCurrent ? " (current)" : ""}`
|
|
@@ -18608,7 +18747,7 @@ async function worktreeMergeHistoryCommand(sourceArg, opts) {
|
|
|
18608
18747
|
}
|
|
18609
18748
|
const targetEndpoint = opts.to ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true }) : resolveCurrentEndpoint();
|
|
18610
18749
|
const sourceEndpoint = opts.from ? resolveWorktreeEndpointFromSelector(opts.from, { allowCurrent: true }) : sourceArg ? resolveWorktreeEndpointFromSelector(sourceArg, { allowCurrent: true }) : await promptForSourceEndpoint(targetEndpoint.rootPath);
|
|
18611
|
-
if (
|
|
18750
|
+
if (path21.resolve(sourceEndpoint.configPath) === path21.resolve(targetEndpoint.configPath)) {
|
|
18612
18751
|
throw new Error("Source and target Rudder configs are the same. Choose different --from/--to worktrees.");
|
|
18613
18752
|
}
|
|
18614
18753
|
const scopes = parseWorktreeMergeScopes(opts.scope);
|
|
@@ -18697,16 +18836,16 @@ function registerWorktreeCommands(program) {
|
|
|
18697
18836
|
}
|
|
18698
18837
|
|
|
18699
18838
|
// src/commands/client/plugin.ts
|
|
18700
|
-
import
|
|
18839
|
+
import path22 from "node:path";
|
|
18701
18840
|
import pc24 from "picocolors";
|
|
18702
18841
|
function resolvePackageArg(packageArg, isLocal) {
|
|
18703
18842
|
if (!isLocal) return packageArg;
|
|
18704
|
-
if (
|
|
18843
|
+
if (path22.isAbsolute(packageArg)) return packageArg;
|
|
18705
18844
|
if (packageArg.startsWith("~")) {
|
|
18706
18845
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
18707
|
-
return
|
|
18846
|
+
return path22.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
18708
18847
|
}
|
|
18709
|
-
return
|
|
18848
|
+
return path22.resolve(process.cwd(), packageArg);
|
|
18710
18849
|
}
|
|
18711
18850
|
function formatPlugin(p18) {
|
|
18712
18851
|
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);
|
|
@@ -18978,7 +19117,7 @@ function registerClientAuthCommands(auth) {
|
|
|
18978
19117
|
|
|
18979
19118
|
// src/commands/benchmark-create-agent.ts
|
|
18980
19119
|
import fs14 from "node:fs/promises";
|
|
18981
|
-
import
|
|
19120
|
+
import path23 from "node:path";
|
|
18982
19121
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
18983
19122
|
import { LangfuseClient } from "@langfuse/client";
|
|
18984
19123
|
|
|
@@ -19004,6 +19143,13 @@ function formatJson(value) {
|
|
|
19004
19143
|
return String(value);
|
|
19005
19144
|
}
|
|
19006
19145
|
}
|
|
19146
|
+
function formatTodoList(entry) {
|
|
19147
|
+
return entry.items.map((item) => `${item.status === "completed" ? "[x]" : item.status === "in_progress" ? "[~]" : "[ ]"} ${item.text}`).join("\n");
|
|
19148
|
+
}
|
|
19149
|
+
function summarizeTodoList(entry) {
|
|
19150
|
+
const completed = entry.items.filter((item) => item.status === "completed").length;
|
|
19151
|
+
return `Todo list updated: ${completed}/${entry.items.length} complete`;
|
|
19152
|
+
}
|
|
19007
19153
|
function isModelTranscriptEntry(entry) {
|
|
19008
19154
|
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "result";
|
|
19009
19155
|
}
|
|
@@ -19013,6 +19159,7 @@ function isPayloadTranscriptEntry(entry) {
|
|
|
19013
19159
|
function detailTextForTranscriptEntry(entry) {
|
|
19014
19160
|
if (entry.kind === "tool_call") return formatJson(entry.input);
|
|
19015
19161
|
if (entry.kind === "tool_result") return entry.content || "";
|
|
19162
|
+
if (entry.kind === "todo_list") return formatTodoList(entry);
|
|
19016
19163
|
if (entry.kind === "result") {
|
|
19017
19164
|
return [
|
|
19018
19165
|
entry.text || "",
|
|
@@ -19032,6 +19179,9 @@ function previewTextForTranscriptEntry(entry, maxLength = 180) {
|
|
|
19032
19179
|
const detail = detailTextForTranscriptEntry(entry);
|
|
19033
19180
|
return truncate(firstMeaningfulLine(detail) || entry.toolName || "(empty tool result)", maxLength);
|
|
19034
19181
|
}
|
|
19182
|
+
if (entry.kind === "todo_list") {
|
|
19183
|
+
return truncate(summarizeTodoList(entry), maxLength);
|
|
19184
|
+
}
|
|
19035
19185
|
if (entry.kind === "result") {
|
|
19036
19186
|
const summary = entry.text ? firstMeaningfulLine(entry.text) : "";
|
|
19037
19187
|
if (summary) return truncate(summary, maxLength);
|
|
@@ -19046,7 +19196,7 @@ function previewTextForTranscriptEntry(entry, maxLength = 180) {
|
|
|
19046
19196
|
return "";
|
|
19047
19197
|
}
|
|
19048
19198
|
function isTurnScopedEntry(entry) {
|
|
19049
|
-
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "tool_call" || entry.kind === "tool_result" || entry.kind === "result";
|
|
19199
|
+
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "todo_list" || entry.kind === "tool_call" || entry.kind === "tool_result" || entry.kind === "result";
|
|
19050
19200
|
}
|
|
19051
19201
|
function isErrorTranscriptEntry(entry) {
|
|
19052
19202
|
return entry.kind === "stderr" || entry.kind === "tool_result" && entry.isError || entry.kind === "result" && entry.isError;
|
|
@@ -19527,11 +19677,11 @@ function createAgentEvalCheckToScoreValue(check) {
|
|
|
19527
19677
|
}
|
|
19528
19678
|
|
|
19529
19679
|
// src/commands/benchmark-create-agent.ts
|
|
19530
|
-
var __moduleDir2 =
|
|
19531
|
-
var repoRoot =
|
|
19532
|
-
var defaultCasesDir =
|
|
19533
|
-
var defaultSetsDir =
|
|
19534
|
-
var defaultArtifactsDir =
|
|
19680
|
+
var __moduleDir2 = path23.dirname(fileURLToPath5(import.meta.url));
|
|
19681
|
+
var repoRoot = path23.resolve(__moduleDir2, "../../..");
|
|
19682
|
+
var defaultCasesDir = path23.join(repoRoot, "benchmark", "create-agent", "cases");
|
|
19683
|
+
var defaultSetsDir = path23.join(repoRoot, "benchmark", "create-agent", "sets");
|
|
19684
|
+
var defaultArtifactsDir = path23.join(repoRoot, ".artifacts", "create-agent-benchmark");
|
|
19535
19685
|
var TERMINAL_RUN_STATUSES2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
19536
19686
|
var DEFAULT_JUDGE_PROMPT_NAME = "judge-create-agent";
|
|
19537
19687
|
var DEFAULT_JUDGE_MODEL = "gpt-5-mini";
|
|
@@ -19581,16 +19731,16 @@ async function readJsonFile(filePath) {
|
|
|
19581
19731
|
return JSON.parse(content);
|
|
19582
19732
|
}
|
|
19583
19733
|
async function writeJsonFile(filePath, value) {
|
|
19584
|
-
await fs14.mkdir(
|
|
19734
|
+
await fs14.mkdir(path23.dirname(filePath), { recursive: true });
|
|
19585
19735
|
await fs14.writeFile(filePath, `${JSON.stringify(value, null, 2)}
|
|
19586
19736
|
`, "utf8");
|
|
19587
19737
|
}
|
|
19588
19738
|
async function loadCaseById(caseId, casesDir) {
|
|
19589
|
-
const filePath =
|
|
19739
|
+
const filePath = path23.join(casesDir, `${caseId}.json`);
|
|
19590
19740
|
return parseCreateAgentCase(await readJsonFile(filePath));
|
|
19591
19741
|
}
|
|
19592
19742
|
async function loadSet(setName, setsDir) {
|
|
19593
|
-
const filePath =
|
|
19743
|
+
const filePath = path23.join(setsDir, `${setName}.json`);
|
|
19594
19744
|
const raw = await readJsonFile(filePath);
|
|
19595
19745
|
if (!Array.isArray(raw) || raw.some((item) => typeof item !== "string")) {
|
|
19596
19746
|
throw new Error(`Benchmark set ${setName} must be a JSON array of case IDs.`);
|
|
@@ -19678,13 +19828,13 @@ async function captureCreatedApprovals(api, approvals2) {
|
|
|
19678
19828
|
);
|
|
19679
19829
|
}
|
|
19680
19830
|
function resultRunDir(artifactsDir, testCase, runId) {
|
|
19681
|
-
return
|
|
19831
|
+
return path23.join(artifactsDir, "runs", `${testCase.id}-${runId}`);
|
|
19682
19832
|
}
|
|
19683
19833
|
function resultJsonPath(artifactsDir, testCase, runId) {
|
|
19684
|
-
return
|
|
19834
|
+
return path23.join(resultRunDir(artifactsDir, testCase, runId), "result.json");
|
|
19685
19835
|
}
|
|
19686
19836
|
function reportMarkdownPath(artifactsDir, testCase, runId) {
|
|
19687
|
-
return
|
|
19837
|
+
return path23.join(resultRunDir(artifactsDir, testCase, runId), "report.md");
|
|
19688
19838
|
}
|
|
19689
19839
|
function averageJudgeScore(judge) {
|
|
19690
19840
|
if (!judge || judge.status !== "completed") return null;
|
|
@@ -20093,7 +20243,7 @@ async function executeBenchmarkCase(caseId, opts) {
|
|
|
20093
20243
|
const jsonPath = resultJsonPath(artifactsDir, testCase, runDetail.run.id);
|
|
20094
20244
|
const markdownPath = reportMarkdownPath(artifactsDir, testCase, runDetail.run.id);
|
|
20095
20245
|
await writeJsonFile(jsonPath, provisionalResult);
|
|
20096
|
-
await fs14.mkdir(
|
|
20246
|
+
await fs14.mkdir(path23.dirname(markdownPath), { recursive: true });
|
|
20097
20247
|
await fs14.writeFile(markdownPath, buildMarkdownReport(provisionalResult), "utf8");
|
|
20098
20248
|
return provisionalResult;
|
|
20099
20249
|
}
|
|
@@ -20116,7 +20266,7 @@ async function rescoreStoredResult(resultPath, opts) {
|
|
|
20116
20266
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
20117
20267
|
}
|
|
20118
20268
|
await writeJsonFile(resultPath, result);
|
|
20119
|
-
await fs14.writeFile(
|
|
20269
|
+
await fs14.writeFile(path23.join(path23.dirname(resultPath), "report.md"), buildMarkdownReport(result), "utf8");
|
|
20120
20270
|
return result;
|
|
20121
20271
|
}
|
|
20122
20272
|
function printBenchmarkSummary(result, json = false) {
|
|
@@ -20185,7 +20335,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20185
20335
|
addCommonClientOptions(
|
|
20186
20336
|
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) => {
|
|
20187
20337
|
try {
|
|
20188
|
-
const result = await rescoreStoredResult(
|
|
20338
|
+
const result = await rescoreStoredResult(path23.resolve(resultPath), opts);
|
|
20189
20339
|
printBenchmarkSummary(result, Boolean(opts.json));
|
|
20190
20340
|
} catch (error) {
|
|
20191
20341
|
handleCommandError(error);
|
|
@@ -20195,11 +20345,11 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20195
20345
|
addCommonClientOptions(
|
|
20196
20346
|
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) => {
|
|
20197
20347
|
try {
|
|
20198
|
-
const result = await readJsonFile(
|
|
20348
|
+
const result = await readJsonFile(path23.resolve(resultPath));
|
|
20199
20349
|
const sync = await syncResultToLangfuse(result, { queueId: asString6(opts.queueId) });
|
|
20200
20350
|
result.langfuse.scoreSync = sync.scoreSync;
|
|
20201
20351
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
20202
|
-
await writeJsonFile(
|
|
20352
|
+
await writeJsonFile(path23.resolve(resultPath), result);
|
|
20203
20353
|
printOutput({
|
|
20204
20354
|
caseId: result.case.id,
|
|
20205
20355
|
runId: result.runDetail.run.id,
|
|
@@ -20215,7 +20365,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20215
20365
|
addCommonClientOptions(
|
|
20216
20366
|
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) => {
|
|
20217
20367
|
try {
|
|
20218
|
-
const result = await readJsonFile(
|
|
20368
|
+
const result = await readJsonFile(path23.resolve(resultPath));
|
|
20219
20369
|
if (opts.markdown) {
|
|
20220
20370
|
process.stdout.write(buildMarkdownReport(result));
|
|
20221
20371
|
return;
|
|
@@ -20249,7 +20399,7 @@ function createProgram() {
|
|
|
20249
20399
|
});
|
|
20250
20400
|
loadRudderEnvFile(options.config);
|
|
20251
20401
|
});
|
|
20252
|
-
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);
|
|
20402
|
+
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("--target-version <version>", "Rudder version to start; avoids the root CLI version flag").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("--wait-for-active-runs", "Wait for active Rudder runs to finish before replacing Desktop", false).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);
|
|
20253
20403
|
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);
|
|
20254
20404
|
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) => {
|
|
20255
20405
|
await doctor(opts);
|