@rudderhq/cli 0.2.0-canary.2 → 0.2.0-canary.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +874 -695
- 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"];
|
|
@@ -411,16 +411,45 @@ var init_workspace_backup = __esm({
|
|
|
411
411
|
|
|
412
412
|
// ../packages/shared/src/validators/instance.ts
|
|
413
413
|
import { z } from "zod";
|
|
414
|
-
var instanceLocaleSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, instanceLangfuseSettingsSchema, patchInstanceLangfuseSettingsSchema, OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
|
|
414
|
+
var instanceLocaleSchema, instanceGitIdentitySourceSchema, instanceGitIdentitySettingsSchema, instanceDetectedGitIdentitySchema, instanceGitIdentityStatusSchema, instanceGitIdentityStateSchema, patchInstanceGitIdentitySettingsSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, instanceLangfuseSettingsSchema, patchInstanceLangfuseSettingsSchema, OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
|
|
415
415
|
var init_instance = __esm({
|
|
416
416
|
"../packages/shared/src/validators/instance.ts"() {
|
|
417
417
|
"use strict";
|
|
418
418
|
instanceLocaleSchema = z.enum(["en", "zh-CN"]);
|
|
419
|
+
instanceGitIdentitySourceSchema = z.enum(["detected_global", "override"]);
|
|
420
|
+
instanceGitIdentitySettingsSchema = z.object({
|
|
421
|
+
name: z.string().trim().min(1),
|
|
422
|
+
email: z.string().trim().min(1),
|
|
423
|
+
confirmed: z.boolean().default(true),
|
|
424
|
+
source: instanceGitIdentitySourceSchema,
|
|
425
|
+
lastDetectedAt: z.string().datetime().nullable().default(null)
|
|
426
|
+
}).strict();
|
|
427
|
+
instanceDetectedGitIdentitySchema = z.object({
|
|
428
|
+
name: z.string(),
|
|
429
|
+
email: z.string(),
|
|
430
|
+
source: z.literal("host_global"),
|
|
431
|
+
unsafe: z.boolean()
|
|
432
|
+
}).strict();
|
|
433
|
+
instanceGitIdentityStatusSchema = z.enum(["confirmed", "detected", "missing", "unsafe"]);
|
|
434
|
+
instanceGitIdentityStateSchema = z.object({
|
|
435
|
+
saved: instanceGitIdentitySettingsSchema.nullable(),
|
|
436
|
+
detected: instanceDetectedGitIdentitySchema.nullable(),
|
|
437
|
+
effective: z.union([instanceGitIdentitySettingsSchema, instanceDetectedGitIdentitySchema]).nullable(),
|
|
438
|
+
status: instanceGitIdentityStatusSchema,
|
|
439
|
+
warning: z.string().nullable()
|
|
440
|
+
}).strict();
|
|
441
|
+
patchInstanceGitIdentitySettingsSchema = z.object({
|
|
442
|
+
name: z.string().optional(),
|
|
443
|
+
email: z.string().optional(),
|
|
444
|
+
confirmDetected: z.boolean().optional(),
|
|
445
|
+
clear: z.boolean().optional()
|
|
446
|
+
}).strict();
|
|
419
447
|
instanceGeneralSettingsSchema = z.object({
|
|
420
448
|
censorUsernameInLogs: z.boolean().default(false),
|
|
421
|
-
locale: instanceLocaleSchema.default("en")
|
|
449
|
+
locale: instanceLocaleSchema.default("en"),
|
|
450
|
+
gitIdentity: instanceGitIdentitySettingsSchema.nullable().default(null)
|
|
422
451
|
}).strict();
|
|
423
|
-
patchInstanceGeneralSettingsSchema = instanceGeneralSettingsSchema.partial();
|
|
452
|
+
patchInstanceGeneralSettingsSchema = instanceGeneralSettingsSchema.omit({ gitIdentity: true }).partial();
|
|
424
453
|
instanceNotificationSettingsSchema = z.object({
|
|
425
454
|
desktopInboxNotifications: z.boolean().default(true),
|
|
426
455
|
desktopDockBadge: z.boolean().default(true),
|
|
@@ -495,302 +524,170 @@ var init_budget = __esm({
|
|
|
495
524
|
}
|
|
496
525
|
});
|
|
497
526
|
|
|
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
527
|
// ../packages/shared/src/validators/organization.ts
|
|
623
|
-
import { z as
|
|
624
|
-
var logoAssetIdSchema, brandColorSchema,
|
|
528
|
+
import { z as z3 } from "zod";
|
|
529
|
+
var logoAssetIdSchema, brandColorSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
|
|
625
530
|
var init_organization = __esm({
|
|
626
531
|
"../packages/shared/src/validators/organization.ts"() {
|
|
627
532
|
"use strict";
|
|
628
533
|
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(),
|
|
534
|
+
logoAssetIdSchema = z3.string().uuid().nullable().optional();
|
|
535
|
+
brandColorSchema = z3.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
536
|
+
createOrganizationSchema = z3.object({
|
|
537
|
+
name: z3.string().min(1),
|
|
538
|
+
description: z3.string().optional().nullable(),
|
|
539
|
+
budgetMonthlyCents: z3.number().int().nonnegative().optional().default(0),
|
|
540
|
+
defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
|
|
642
541
|
brandColor: brandColorSchema,
|
|
643
|
-
requireBoardApprovalForNewAgents:
|
|
542
|
+
requireBoardApprovalForNewAgents: z3.boolean().optional()
|
|
644
543
|
});
|
|
645
544
|
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(),
|
|
545
|
+
status: z3.enum(ORGANIZATION_STATUSES).optional(),
|
|
546
|
+
spentMonthlyCents: z3.number().int().nonnegative().optional(),
|
|
547
|
+
requireBoardApprovalForNewAgents: z3.boolean().optional(),
|
|
548
|
+
defaultChatIssueCreationMode: z3.enum(CHAT_ISSUE_CREATION_MODES).optional(),
|
|
652
549
|
brandColor: brandColorSchema,
|
|
653
550
|
logoAssetId: logoAssetIdSchema
|
|
654
551
|
});
|
|
655
|
-
updateOrganizationBrandingSchema =
|
|
656
|
-
name:
|
|
657
|
-
description:
|
|
552
|
+
updateOrganizationBrandingSchema = z3.object({
|
|
553
|
+
name: z3.string().min(1).optional(),
|
|
554
|
+
description: z3.string().nullable().optional(),
|
|
658
555
|
brandColor: brandColorSchema,
|
|
659
556
|
logoAssetId: logoAssetIdSchema
|
|
660
557
|
}).strict().refine(
|
|
661
558
|
(value) => value.name !== void 0 || value.description !== void 0 || value.brandColor !== void 0 || value.logoAssetId !== void 0,
|
|
662
559
|
"At least one branding field must be provided"
|
|
663
560
|
);
|
|
664
|
-
updateOrganizationWorkspaceFileSchema =
|
|
665
|
-
content:
|
|
561
|
+
updateOrganizationWorkspaceFileSchema = z3.object({
|
|
562
|
+
content: z3.string()
|
|
666
563
|
});
|
|
667
564
|
}
|
|
668
565
|
});
|
|
669
566
|
|
|
670
567
|
// ../packages/shared/src/validators/resource.ts
|
|
671
|
-
import { z as
|
|
568
|
+
import { z as z4 } from "zod";
|
|
672
569
|
var organizationResourceKindSchema, projectResourceAttachmentRoleSchema, createOrganizationResourceSchema, updateOrganizationResourceSchema, projectResourceAttachmentInputSchema, updateProjectResourceAttachmentSchema, createProjectInlineResourceSchema;
|
|
673
570
|
var init_resource = __esm({
|
|
674
571
|
"../packages/shared/src/validators/resource.ts"() {
|
|
675
572
|
"use strict";
|
|
676
573
|
init_constants();
|
|
677
|
-
organizationResourceKindSchema =
|
|
678
|
-
projectResourceAttachmentRoleSchema =
|
|
679
|
-
createOrganizationResourceSchema =
|
|
680
|
-
name:
|
|
574
|
+
organizationResourceKindSchema = z4.enum(ORGANIZATION_RESOURCE_KINDS);
|
|
575
|
+
projectResourceAttachmentRoleSchema = z4.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
|
|
576
|
+
createOrganizationResourceSchema = z4.object({
|
|
577
|
+
name: z4.string().min(1),
|
|
681
578
|
kind: organizationResourceKindSchema,
|
|
682
|
-
locator:
|
|
683
|
-
description:
|
|
684
|
-
metadata:
|
|
579
|
+
locator: z4.string().min(1),
|
|
580
|
+
description: z4.string().optional().nullable(),
|
|
581
|
+
metadata: z4.record(z4.unknown()).optional().nullable()
|
|
685
582
|
});
|
|
686
|
-
updateOrganizationResourceSchema =
|
|
687
|
-
name:
|
|
583
|
+
updateOrganizationResourceSchema = z4.object({
|
|
584
|
+
name: z4.string().min(1).optional(),
|
|
688
585
|
kind: organizationResourceKindSchema.optional(),
|
|
689
|
-
locator:
|
|
690
|
-
description:
|
|
691
|
-
metadata:
|
|
586
|
+
locator: z4.string().min(1).optional(),
|
|
587
|
+
description: z4.string().optional().nullable(),
|
|
588
|
+
metadata: z4.record(z4.unknown()).optional().nullable()
|
|
692
589
|
}).strict();
|
|
693
|
-
projectResourceAttachmentInputSchema =
|
|
694
|
-
resourceId:
|
|
590
|
+
projectResourceAttachmentInputSchema = z4.object({
|
|
591
|
+
resourceId: z4.string().uuid(),
|
|
695
592
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
696
|
-
note:
|
|
697
|
-
sortOrder:
|
|
593
|
+
note: z4.string().optional().nullable(),
|
|
594
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
698
595
|
}).strict();
|
|
699
|
-
updateProjectResourceAttachmentSchema =
|
|
596
|
+
updateProjectResourceAttachmentSchema = z4.object({
|
|
700
597
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
701
|
-
note:
|
|
702
|
-
sortOrder:
|
|
598
|
+
note: z4.string().optional().nullable(),
|
|
599
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
703
600
|
}).strict();
|
|
704
601
|
createProjectInlineResourceSchema = createOrganizationResourceSchema.extend({
|
|
705
602
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
706
|
-
note:
|
|
707
|
-
sortOrder:
|
|
603
|
+
note: z4.string().optional().nullable(),
|
|
604
|
+
sortOrder: z4.number().int().nonnegative().optional()
|
|
708
605
|
}).strict();
|
|
709
606
|
}
|
|
710
607
|
});
|
|
711
608
|
|
|
712
609
|
// ../packages/shared/src/validators/chat.ts
|
|
713
|
-
import { z as
|
|
610
|
+
import { z as z5 } from "zod";
|
|
714
611
|
var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
|
|
715
612
|
var init_chat = __esm({
|
|
716
613
|
"../packages/shared/src/validators/chat.ts"() {
|
|
717
614
|
"use strict";
|
|
718
615
|
init_constants();
|
|
719
|
-
chatConversationStatusSchema =
|
|
720
|
-
chatIssueCreationModeSchema =
|
|
721
|
-
chatMessageRoleSchema =
|
|
722
|
-
chatMessageKindSchema =
|
|
723
|
-
chatMessageStatusSchema =
|
|
724
|
-
chatContextEntityTypeSchema =
|
|
725
|
-
createChatContextLinkSchema =
|
|
616
|
+
chatConversationStatusSchema = z5.enum(CHAT_CONVERSATION_STATUSES);
|
|
617
|
+
chatIssueCreationModeSchema = z5.enum(CHAT_ISSUE_CREATION_MODES);
|
|
618
|
+
chatMessageRoleSchema = z5.enum(CHAT_MESSAGE_ROLES);
|
|
619
|
+
chatMessageKindSchema = z5.enum(CHAT_MESSAGE_KINDS);
|
|
620
|
+
chatMessageStatusSchema = z5.enum(CHAT_MESSAGE_STATUSES);
|
|
621
|
+
chatContextEntityTypeSchema = z5.enum(CHAT_CONTEXT_ENTITY_TYPES);
|
|
622
|
+
createChatContextLinkSchema = z5.object({
|
|
726
623
|
entityType: chatContextEntityTypeSchema,
|
|
727
|
-
entityId:
|
|
728
|
-
metadata:
|
|
624
|
+
entityId: z5.string().min(1),
|
|
625
|
+
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
729
626
|
});
|
|
730
|
-
createChatConversationSchema =
|
|
731
|
-
title:
|
|
732
|
-
summary:
|
|
733
|
-
preferredAgentId:
|
|
627
|
+
createChatConversationSchema = z5.object({
|
|
628
|
+
title: z5.string().trim().min(1).max(200).optional(),
|
|
629
|
+
summary: z5.string().trim().max(5e3).optional().nullable(),
|
|
630
|
+
preferredAgentId: z5.string().uuid().optional().nullable(),
|
|
734
631
|
issueCreationMode: chatIssueCreationModeSchema.optional(),
|
|
735
|
-
planMode:
|
|
736
|
-
contextLinks:
|
|
632
|
+
planMode: z5.boolean().optional(),
|
|
633
|
+
contextLinks: z5.array(createChatContextLinkSchema).optional().default([])
|
|
737
634
|
});
|
|
738
|
-
setChatProjectContextSchema =
|
|
739
|
-
projectId:
|
|
635
|
+
setChatProjectContextSchema = z5.object({
|
|
636
|
+
projectId: z5.string().uuid().optional().nullable()
|
|
740
637
|
});
|
|
741
638
|
updateChatConversationSchema = createChatConversationSchema.partial().extend({
|
|
742
639
|
status: chatConversationStatusSchema.optional(),
|
|
743
|
-
routedAgentId:
|
|
744
|
-
primaryIssueId:
|
|
745
|
-
resolvedAt:
|
|
640
|
+
routedAgentId: z5.string().uuid().optional().nullable(),
|
|
641
|
+
primaryIssueId: z5.string().uuid().optional().nullable(),
|
|
642
|
+
resolvedAt: z5.string().datetime().optional().nullable()
|
|
746
643
|
});
|
|
747
|
-
addChatMessageSchema =
|
|
748
|
-
body:
|
|
749
|
-
editUserMessageId:
|
|
644
|
+
addChatMessageSchema = z5.object({
|
|
645
|
+
body: z5.string().trim().min(1).max(2e4),
|
|
646
|
+
editUserMessageId: z5.string().uuid().optional().nullable()
|
|
750
647
|
});
|
|
751
|
-
createChatAttachmentMetadataSchema =
|
|
752
|
-
messageId:
|
|
648
|
+
createChatAttachmentMetadataSchema = z5.object({
|
|
649
|
+
messageId: z5.string().uuid()
|
|
753
650
|
});
|
|
754
|
-
chatIssueProposalSchema =
|
|
755
|
-
title:
|
|
756
|
-
description:
|
|
757
|
-
priority:
|
|
758
|
-
projectId:
|
|
759
|
-
goalId:
|
|
760
|
-
parentId:
|
|
761
|
-
assigneeAgentId:
|
|
762
|
-
assigneeUserId:
|
|
651
|
+
chatIssueProposalSchema = z5.object({
|
|
652
|
+
title: z5.string().trim().min(1).max(200),
|
|
653
|
+
description: z5.string().trim().min(1).max(2e4),
|
|
654
|
+
priority: z5.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
655
|
+
projectId: z5.string().uuid().optional().nullable(),
|
|
656
|
+
goalId: z5.string().uuid().optional().nullable(),
|
|
657
|
+
parentId: z5.string().uuid().optional().nullable(),
|
|
658
|
+
assigneeAgentId: z5.string().uuid().optional().nullable(),
|
|
659
|
+
assigneeUserId: z5.string().trim().optional().nullable()
|
|
763
660
|
});
|
|
764
|
-
convertChatToIssueSchema =
|
|
765
|
-
messageId:
|
|
661
|
+
convertChatToIssueSchema = z5.object({
|
|
662
|
+
messageId: z5.string().uuid().optional().nullable(),
|
|
766
663
|
proposal: chatIssueProposalSchema.optional()
|
|
767
664
|
});
|
|
768
|
-
chatOperationProposalSchema =
|
|
769
|
-
targetType:
|
|
770
|
-
targetId:
|
|
771
|
-
summary:
|
|
772
|
-
patch:
|
|
665
|
+
chatOperationProposalSchema = z5.object({
|
|
666
|
+
targetType: z5.enum(["organization", "agent"]),
|
|
667
|
+
targetId: z5.string().min(1),
|
|
668
|
+
summary: z5.string().trim().min(1).max(500),
|
|
669
|
+
patch: z5.record(z5.unknown())
|
|
773
670
|
});
|
|
774
|
-
resolveChatOperationProposalSchema =
|
|
775
|
-
action:
|
|
776
|
-
decisionNote:
|
|
671
|
+
resolveChatOperationProposalSchema = z5.object({
|
|
672
|
+
action: z5.enum(["approve", "reject", "requestRevision"]),
|
|
673
|
+
decisionNote: z5.string().trim().max(5e3).optional().nullable()
|
|
777
674
|
});
|
|
778
|
-
updateChatConversationUserStateSchema =
|
|
779
|
-
pinned:
|
|
675
|
+
updateChatConversationUserStateSchema = z5.object({
|
|
676
|
+
pinned: z5.boolean().optional()
|
|
780
677
|
});
|
|
781
678
|
}
|
|
782
679
|
});
|
|
783
680
|
|
|
784
681
|
// ../packages/shared/src/validators/organization-skill.ts
|
|
785
|
-
import { z as
|
|
682
|
+
import { z as z6 } from "zod";
|
|
786
683
|
var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
|
|
787
684
|
var init_organization_skill = __esm({
|
|
788
685
|
"../packages/shared/src/validators/organization-skill.ts"() {
|
|
789
686
|
"use strict";
|
|
790
|
-
organizationSkillSourceTypeSchema =
|
|
791
|
-
organizationSkillTrustLevelSchema =
|
|
792
|
-
organizationSkillCompatibilitySchema =
|
|
793
|
-
organizationSkillSourceBadgeSchema =
|
|
687
|
+
organizationSkillSourceTypeSchema = z6.enum(["local_path", "github", "url", "catalog", "skills_sh"]);
|
|
688
|
+
organizationSkillTrustLevelSchema = z6.enum(["markdown_only", "assets", "scripts_executables"]);
|
|
689
|
+
organizationSkillCompatibilitySchema = z6.enum(["compatible", "unknown", "invalid"]);
|
|
690
|
+
organizationSkillSourceBadgeSchema = z6.enum([
|
|
794
691
|
"rudder",
|
|
795
692
|
"community",
|
|
796
693
|
"github",
|
|
@@ -799,157 +696,157 @@ var init_organization_skill = __esm({
|
|
|
799
696
|
"catalog",
|
|
800
697
|
"skills_sh"
|
|
801
698
|
]);
|
|
802
|
-
organizationSkillFileInventoryEntrySchema =
|
|
803
|
-
path:
|
|
804
|
-
kind:
|
|
699
|
+
organizationSkillFileInventoryEntrySchema = z6.object({
|
|
700
|
+
path: z6.string().min(1),
|
|
701
|
+
kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"])
|
|
805
702
|
});
|
|
806
|
-
organizationSkillSchema =
|
|
807
|
-
id:
|
|
808
|
-
orgId:
|
|
809
|
-
key:
|
|
810
|
-
slug:
|
|
811
|
-
name:
|
|
812
|
-
description:
|
|
813
|
-
markdown:
|
|
703
|
+
organizationSkillSchema = z6.object({
|
|
704
|
+
id: z6.string().uuid(),
|
|
705
|
+
orgId: z6.string().uuid(),
|
|
706
|
+
key: z6.string().min(1),
|
|
707
|
+
slug: z6.string().min(1),
|
|
708
|
+
name: z6.string().min(1),
|
|
709
|
+
description: z6.string().nullable(),
|
|
710
|
+
markdown: z6.string(),
|
|
814
711
|
sourceType: organizationSkillSourceTypeSchema,
|
|
815
|
-
sourceLocator:
|
|
816
|
-
sourceRef:
|
|
712
|
+
sourceLocator: z6.string().nullable(),
|
|
713
|
+
sourceRef: z6.string().nullable(),
|
|
817
714
|
trustLevel: organizationSkillTrustLevelSchema,
|
|
818
715
|
compatibility: organizationSkillCompatibilitySchema,
|
|
819
|
-
fileInventory:
|
|
820
|
-
metadata:
|
|
821
|
-
createdAt:
|
|
822
|
-
updatedAt:
|
|
716
|
+
fileInventory: z6.array(organizationSkillFileInventoryEntrySchema).default([]),
|
|
717
|
+
metadata: z6.record(z6.unknown()).nullable(),
|
|
718
|
+
createdAt: z6.coerce.date(),
|
|
719
|
+
updatedAt: z6.coerce.date()
|
|
823
720
|
});
|
|
824
721
|
organizationSkillListItemSchema = organizationSkillSchema.extend({
|
|
825
|
-
attachedAgentCount:
|
|
826
|
-
editable:
|
|
827
|
-
editableReason:
|
|
828
|
-
sourceLabel:
|
|
722
|
+
attachedAgentCount: z6.number().int().nonnegative(),
|
|
723
|
+
editable: z6.boolean(),
|
|
724
|
+
editableReason: z6.string().nullable(),
|
|
725
|
+
sourceLabel: z6.string().nullable(),
|
|
829
726
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
830
|
-
sourcePath:
|
|
831
|
-
workspaceEditPath:
|
|
727
|
+
sourcePath: z6.string().nullable(),
|
|
728
|
+
workspaceEditPath: z6.string().nullable()
|
|
832
729
|
});
|
|
833
|
-
organizationSkillUsageAgentSchema =
|
|
834
|
-
id:
|
|
835
|
-
name:
|
|
836
|
-
urlKey:
|
|
837
|
-
agentRuntimeType:
|
|
838
|
-
desired:
|
|
839
|
-
actualState:
|
|
730
|
+
organizationSkillUsageAgentSchema = z6.object({
|
|
731
|
+
id: z6.string().uuid(),
|
|
732
|
+
name: z6.string().min(1),
|
|
733
|
+
urlKey: z6.string().min(1),
|
|
734
|
+
agentRuntimeType: z6.string().min(1),
|
|
735
|
+
desired: z6.boolean(),
|
|
736
|
+
actualState: z6.string().nullable()
|
|
840
737
|
});
|
|
841
738
|
organizationSkillDetailSchema = organizationSkillSchema.extend({
|
|
842
|
-
attachedAgentCount:
|
|
843
|
-
usedByAgents:
|
|
844
|
-
editable:
|
|
845
|
-
editableReason:
|
|
846
|
-
sourceLabel:
|
|
739
|
+
attachedAgentCount: z6.number().int().nonnegative(),
|
|
740
|
+
usedByAgents: z6.array(organizationSkillUsageAgentSchema).default([]),
|
|
741
|
+
editable: z6.boolean(),
|
|
742
|
+
editableReason: z6.string().nullable(),
|
|
743
|
+
sourceLabel: z6.string().nullable(),
|
|
847
744
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
848
|
-
sourcePath:
|
|
849
|
-
workspaceEditPath:
|
|
745
|
+
sourcePath: z6.string().nullable(),
|
|
746
|
+
workspaceEditPath: z6.string().nullable()
|
|
850
747
|
});
|
|
851
|
-
organizationSkillUpdateStatusSchema =
|
|
852
|
-
supported:
|
|
853
|
-
reason:
|
|
854
|
-
trackingRef:
|
|
855
|
-
currentRef:
|
|
856
|
-
latestRef:
|
|
857
|
-
hasUpdate:
|
|
748
|
+
organizationSkillUpdateStatusSchema = z6.object({
|
|
749
|
+
supported: z6.boolean(),
|
|
750
|
+
reason: z6.string().nullable(),
|
|
751
|
+
trackingRef: z6.string().nullable(),
|
|
752
|
+
currentRef: z6.string().nullable(),
|
|
753
|
+
latestRef: z6.string().nullable(),
|
|
754
|
+
hasUpdate: z6.boolean()
|
|
858
755
|
});
|
|
859
|
-
organizationSkillImportSchema =
|
|
860
|
-
source:
|
|
756
|
+
organizationSkillImportSchema = z6.object({
|
|
757
|
+
source: z6.string().min(1)
|
|
861
758
|
});
|
|
862
|
-
organizationSkillProjectScanRequestSchema =
|
|
863
|
-
projectIds:
|
|
864
|
-
workspaceIds:
|
|
759
|
+
organizationSkillProjectScanRequestSchema = z6.object({
|
|
760
|
+
projectIds: z6.array(z6.string().uuid()).optional(),
|
|
761
|
+
workspaceIds: z6.array(z6.string().uuid()).optional()
|
|
865
762
|
});
|
|
866
|
-
organizationSkillProjectScanSkippedSchema =
|
|
867
|
-
projectId:
|
|
868
|
-
projectName:
|
|
869
|
-
workspaceId:
|
|
870
|
-
workspaceName:
|
|
871
|
-
path:
|
|
872
|
-
reason:
|
|
763
|
+
organizationSkillProjectScanSkippedSchema = z6.object({
|
|
764
|
+
projectId: z6.string().uuid(),
|
|
765
|
+
projectName: z6.string().min(1),
|
|
766
|
+
workspaceId: z6.string().uuid().nullable(),
|
|
767
|
+
workspaceName: z6.string().nullable(),
|
|
768
|
+
path: z6.string().nullable(),
|
|
769
|
+
reason: z6.string().min(1)
|
|
873
770
|
});
|
|
874
|
-
organizationSkillProjectScanConflictSchema =
|
|
875
|
-
slug:
|
|
876
|
-
key:
|
|
877
|
-
projectId:
|
|
878
|
-
projectName:
|
|
879
|
-
workspaceId:
|
|
880
|
-
workspaceName:
|
|
881
|
-
path:
|
|
882
|
-
existingSkillId:
|
|
883
|
-
existingSkillKey:
|
|
884
|
-
existingSourceLocator:
|
|
885
|
-
reason:
|
|
771
|
+
organizationSkillProjectScanConflictSchema = z6.object({
|
|
772
|
+
slug: z6.string().min(1),
|
|
773
|
+
key: z6.string().min(1),
|
|
774
|
+
projectId: z6.string().uuid(),
|
|
775
|
+
projectName: z6.string().min(1),
|
|
776
|
+
workspaceId: z6.string().uuid(),
|
|
777
|
+
workspaceName: z6.string().min(1),
|
|
778
|
+
path: z6.string().min(1),
|
|
779
|
+
existingSkillId: z6.string().uuid(),
|
|
780
|
+
existingSkillKey: z6.string().min(1),
|
|
781
|
+
existingSourceLocator: z6.string().nullable(),
|
|
782
|
+
reason: z6.string().min(1)
|
|
886
783
|
});
|
|
887
|
-
organizationSkillProjectScanResultSchema =
|
|
888
|
-
scannedProjects:
|
|
889
|
-
scannedWorkspaces:
|
|
890
|
-
discovered:
|
|
891
|
-
imported:
|
|
892
|
-
updated:
|
|
893
|
-
skipped:
|
|
894
|
-
conflicts:
|
|
895
|
-
warnings:
|
|
784
|
+
organizationSkillProjectScanResultSchema = z6.object({
|
|
785
|
+
scannedProjects: z6.number().int().nonnegative(),
|
|
786
|
+
scannedWorkspaces: z6.number().int().nonnegative(),
|
|
787
|
+
discovered: z6.number().int().nonnegative(),
|
|
788
|
+
imported: z6.array(organizationSkillSchema),
|
|
789
|
+
updated: z6.array(organizationSkillSchema),
|
|
790
|
+
skipped: z6.array(organizationSkillProjectScanSkippedSchema),
|
|
791
|
+
conflicts: z6.array(organizationSkillProjectScanConflictSchema),
|
|
792
|
+
warnings: z6.array(z6.string())
|
|
896
793
|
});
|
|
897
|
-
organizationSkillLocalScanRequestSchema =
|
|
898
|
-
roots:
|
|
794
|
+
organizationSkillLocalScanRequestSchema = z6.object({
|
|
795
|
+
roots: z6.array(z6.string().min(1)).optional()
|
|
899
796
|
});
|
|
900
|
-
organizationSkillLocalScanSkippedSchema =
|
|
901
|
-
root:
|
|
902
|
-
path:
|
|
903
|
-
reason:
|
|
797
|
+
organizationSkillLocalScanSkippedSchema = z6.object({
|
|
798
|
+
root: z6.string().min(1),
|
|
799
|
+
path: z6.string().nullable(),
|
|
800
|
+
reason: z6.string().min(1)
|
|
904
801
|
});
|
|
905
|
-
organizationSkillLocalScanConflictSchema =
|
|
906
|
-
root:
|
|
907
|
-
path:
|
|
908
|
-
slug:
|
|
909
|
-
key:
|
|
910
|
-
existingSkillId:
|
|
911
|
-
existingSkillKey:
|
|
912
|
-
existingSourceLocator:
|
|
913
|
-
reason:
|
|
802
|
+
organizationSkillLocalScanConflictSchema = z6.object({
|
|
803
|
+
root: z6.string().min(1),
|
|
804
|
+
path: z6.string().min(1),
|
|
805
|
+
slug: z6.string().min(1),
|
|
806
|
+
key: z6.string().min(1),
|
|
807
|
+
existingSkillId: z6.string().uuid(),
|
|
808
|
+
existingSkillKey: z6.string().min(1),
|
|
809
|
+
existingSourceLocator: z6.string().nullable(),
|
|
810
|
+
reason: z6.string().min(1)
|
|
914
811
|
});
|
|
915
|
-
organizationSkillLocalScanResultSchema =
|
|
916
|
-
scannedRoots:
|
|
917
|
-
discovered:
|
|
918
|
-
imported:
|
|
919
|
-
updated:
|
|
920
|
-
skipped:
|
|
921
|
-
conflicts:
|
|
922
|
-
warnings:
|
|
812
|
+
organizationSkillLocalScanResultSchema = z6.object({
|
|
813
|
+
scannedRoots: z6.number().int().nonnegative(),
|
|
814
|
+
discovered: z6.number().int().nonnegative(),
|
|
815
|
+
imported: z6.array(organizationSkillSchema),
|
|
816
|
+
updated: z6.array(organizationSkillSchema),
|
|
817
|
+
skipped: z6.array(organizationSkillLocalScanSkippedSchema),
|
|
818
|
+
conflicts: z6.array(organizationSkillLocalScanConflictSchema),
|
|
819
|
+
warnings: z6.array(z6.string())
|
|
923
820
|
});
|
|
924
|
-
organizationSkillCreateSchema =
|
|
925
|
-
name:
|
|
926
|
-
slug:
|
|
927
|
-
description:
|
|
928
|
-
markdown:
|
|
821
|
+
organizationSkillCreateSchema = z6.object({
|
|
822
|
+
name: z6.string().min(1),
|
|
823
|
+
slug: z6.string().min(1).nullable().optional(),
|
|
824
|
+
description: z6.string().nullable().optional(),
|
|
825
|
+
markdown: z6.string().nullable().optional()
|
|
929
826
|
});
|
|
930
|
-
organizationSkillFileDetailSchema =
|
|
931
|
-
skillId:
|
|
932
|
-
path:
|
|
933
|
-
kind:
|
|
934
|
-
content:
|
|
935
|
-
language:
|
|
936
|
-
markdown:
|
|
937
|
-
editable:
|
|
827
|
+
organizationSkillFileDetailSchema = z6.object({
|
|
828
|
+
skillId: z6.string().uuid(),
|
|
829
|
+
path: z6.string().min(1),
|
|
830
|
+
kind: z6.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
|
|
831
|
+
content: z6.string(),
|
|
832
|
+
language: z6.string().nullable(),
|
|
833
|
+
markdown: z6.boolean(),
|
|
834
|
+
editable: z6.boolean()
|
|
938
835
|
});
|
|
939
|
-
organizationSkillFileUpdateSchema =
|
|
940
|
-
path:
|
|
941
|
-
content:
|
|
836
|
+
organizationSkillFileUpdateSchema = z6.object({
|
|
837
|
+
path: z6.string().min(1),
|
|
838
|
+
content: z6.string()
|
|
942
839
|
});
|
|
943
840
|
}
|
|
944
841
|
});
|
|
945
842
|
|
|
946
843
|
// ../packages/shared/src/validators/adapter-skills.ts
|
|
947
|
-
import { z as
|
|
844
|
+
import { z as z7 } from "zod";
|
|
948
845
|
var agentSkillStateSchema, agentSkillOriginSchema, agentSkillSourceClassSchema, agentSkillSyncModeSchema, agentSkillEntrySchema, agentSkillSnapshotSchema, agentSkillSyncSchema;
|
|
949
846
|
var init_adapter_skills = __esm({
|
|
950
847
|
"../packages/shared/src/validators/adapter-skills.ts"() {
|
|
951
848
|
"use strict";
|
|
952
|
-
agentSkillStateSchema =
|
|
849
|
+
agentSkillStateSchema = z7.enum([
|
|
953
850
|
"available",
|
|
954
851
|
"configured",
|
|
955
852
|
"installed",
|
|
@@ -957,274 +854,398 @@ var init_adapter_skills = __esm({
|
|
|
957
854
|
"stale",
|
|
958
855
|
"external"
|
|
959
856
|
]);
|
|
960
|
-
agentSkillOriginSchema =
|
|
857
|
+
agentSkillOriginSchema = z7.preprocess((value) => {
|
|
961
858
|
if (value === "company_managed") return "organization_managed";
|
|
962
859
|
return value;
|
|
963
|
-
},
|
|
860
|
+
}, z7.enum([
|
|
964
861
|
"organization_managed",
|
|
965
862
|
"user_installed",
|
|
966
863
|
"external_unknown"
|
|
967
864
|
]));
|
|
968
|
-
agentSkillSourceClassSchema =
|
|
865
|
+
agentSkillSourceClassSchema = z7.enum([
|
|
969
866
|
"bundled",
|
|
970
867
|
"organization",
|
|
971
868
|
"agent_home",
|
|
972
869
|
"global",
|
|
973
870
|
"adapter_home"
|
|
974
871
|
]);
|
|
975
|
-
agentSkillSyncModeSchema =
|
|
872
|
+
agentSkillSyncModeSchema = z7.enum([
|
|
976
873
|
"unsupported",
|
|
977
874
|
"persistent",
|
|
978
875
|
"ephemeral"
|
|
979
876
|
]);
|
|
980
|
-
agentSkillEntrySchema =
|
|
981
|
-
key:
|
|
982
|
-
selectionKey:
|
|
983
|
-
runtimeName:
|
|
984
|
-
description:
|
|
985
|
-
desired:
|
|
986
|
-
configurable:
|
|
987
|
-
alwaysEnabled:
|
|
988
|
-
managed:
|
|
877
|
+
agentSkillEntrySchema = z7.object({
|
|
878
|
+
key: z7.string().min(1),
|
|
879
|
+
selectionKey: z7.string().min(1),
|
|
880
|
+
runtimeName: z7.string().min(1).nullable(),
|
|
881
|
+
description: z7.string().nullable().optional(),
|
|
882
|
+
desired: z7.boolean(),
|
|
883
|
+
configurable: z7.boolean(),
|
|
884
|
+
alwaysEnabled: z7.boolean(),
|
|
885
|
+
managed: z7.boolean(),
|
|
989
886
|
state: agentSkillStateSchema,
|
|
990
887
|
sourceClass: agentSkillSourceClassSchema,
|
|
991
888
|
origin: agentSkillOriginSchema.optional(),
|
|
992
|
-
originLabel:
|
|
993
|
-
locationLabel:
|
|
994
|
-
readOnly:
|
|
995
|
-
sourcePath:
|
|
996
|
-
targetPath:
|
|
997
|
-
workspaceEditPath:
|
|
998
|
-
detail:
|
|
889
|
+
originLabel: z7.string().nullable().optional(),
|
|
890
|
+
locationLabel: z7.string().nullable().optional(),
|
|
891
|
+
readOnly: z7.boolean().optional(),
|
|
892
|
+
sourcePath: z7.string().nullable().optional(),
|
|
893
|
+
targetPath: z7.string().nullable().optional(),
|
|
894
|
+
workspaceEditPath: z7.string().nullable().optional(),
|
|
895
|
+
detail: z7.string().nullable().optional()
|
|
999
896
|
});
|
|
1000
|
-
agentSkillSnapshotSchema =
|
|
1001
|
-
agentRuntimeType:
|
|
1002
|
-
supported:
|
|
897
|
+
agentSkillSnapshotSchema = z7.object({
|
|
898
|
+
agentRuntimeType: z7.string().min(1),
|
|
899
|
+
supported: z7.boolean(),
|
|
1003
900
|
mode: agentSkillSyncModeSchema,
|
|
1004
|
-
desiredSkills:
|
|
1005
|
-
entries:
|
|
1006
|
-
warnings:
|
|
901
|
+
desiredSkills: z7.array(z7.string().min(1)),
|
|
902
|
+
entries: z7.array(agentSkillEntrySchema),
|
|
903
|
+
warnings: z7.array(z7.string())
|
|
1007
904
|
});
|
|
1008
|
-
agentSkillSyncSchema =
|
|
1009
|
-
desiredSkills:
|
|
905
|
+
agentSkillSyncSchema = z7.object({
|
|
906
|
+
desiredSkills: z7.array(z7.string().min(1))
|
|
1010
907
|
});
|
|
1011
908
|
}
|
|
1012
909
|
});
|
|
1013
910
|
|
|
1014
911
|
// ../packages/shared/src/validators/organization-portability.ts
|
|
1015
|
-
import { z as
|
|
912
|
+
import { z as z8 } from "zod";
|
|
1016
913
|
var portabilityIncludeSchema, portabilityEnvInputSchema, portabilityFileEntrySchema, portabilityOrganizationManifestEntrySchema, portabilitySidebarOrderSchema, portabilityAgentManifestEntrySchema, portabilitySkillManifestEntrySchema, portabilityProjectManifestEntrySchema, portabilityIssueAutomationTriggerManifestEntrySchema, portabilityIssueAutomationManifestEntrySchema, portabilityIssueManifestEntrySchema, portabilityManifestSchema, portabilitySourceSchema, portabilityTargetSchema, portabilityAgentSelectionSchema, portabilityCollisionStrategySchema, organizationPortabilityExportSchema, organizationPortabilityPreviewSchema, portabilityAdapterOverrideSchema, organizationPortabilityImportSchema;
|
|
1017
914
|
var init_organization_portability = __esm({
|
|
1018
915
|
"../packages/shared/src/validators/organization-portability.ts"() {
|
|
1019
916
|
"use strict";
|
|
1020
|
-
portabilityIncludeSchema =
|
|
1021
|
-
organization:
|
|
1022
|
-
agents:
|
|
1023
|
-
projects:
|
|
1024
|
-
issues:
|
|
1025
|
-
skills:
|
|
917
|
+
portabilityIncludeSchema = z8.object({
|
|
918
|
+
organization: z8.boolean().optional(),
|
|
919
|
+
agents: z8.boolean().optional(),
|
|
920
|
+
projects: z8.boolean().optional(),
|
|
921
|
+
issues: z8.boolean().optional(),
|
|
922
|
+
skills: z8.boolean().optional()
|
|
1026
923
|
}).partial();
|
|
1027
|
-
portabilityEnvInputSchema =
|
|
1028
|
-
key:
|
|
1029
|
-
description:
|
|
1030
|
-
agentSlug:
|
|
1031
|
-
kind:
|
|
1032
|
-
requirement:
|
|
1033
|
-
defaultValue:
|
|
1034
|
-
portability:
|
|
924
|
+
portabilityEnvInputSchema = z8.object({
|
|
925
|
+
key: z8.string().min(1),
|
|
926
|
+
description: z8.string().nullable(),
|
|
927
|
+
agentSlug: z8.string().min(1).nullable(),
|
|
928
|
+
kind: z8.enum(["secret", "plain"]),
|
|
929
|
+
requirement: z8.enum(["required", "optional"]),
|
|
930
|
+
defaultValue: z8.string().nullable(),
|
|
931
|
+
portability: z8.enum(["portable", "system_dependent"])
|
|
1035
932
|
});
|
|
1036
|
-
portabilityFileEntrySchema =
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
encoding:
|
|
1040
|
-
data:
|
|
1041
|
-
contentType:
|
|
933
|
+
portabilityFileEntrySchema = z8.union([
|
|
934
|
+
z8.string(),
|
|
935
|
+
z8.object({
|
|
936
|
+
encoding: z8.literal("base64"),
|
|
937
|
+
data: z8.string(),
|
|
938
|
+
contentType: z8.string().min(1).optional().nullable()
|
|
1042
939
|
})
|
|
1043
940
|
]);
|
|
1044
|
-
portabilityOrganizationManifestEntrySchema =
|
|
1045
|
-
path:
|
|
1046
|
-
name:
|
|
1047
|
-
description:
|
|
1048
|
-
brandColor:
|
|
1049
|
-
logoPath:
|
|
1050
|
-
requireBoardApprovalForNewAgents:
|
|
941
|
+
portabilityOrganizationManifestEntrySchema = z8.object({
|
|
942
|
+
path: z8.string().min(1),
|
|
943
|
+
name: z8.string().min(1),
|
|
944
|
+
description: z8.string().nullable(),
|
|
945
|
+
brandColor: z8.string().nullable(),
|
|
946
|
+
logoPath: z8.string().nullable(),
|
|
947
|
+
requireBoardApprovalForNewAgents: z8.boolean()
|
|
1051
948
|
});
|
|
1052
|
-
portabilitySidebarOrderSchema =
|
|
1053
|
-
agents:
|
|
1054
|
-
projects:
|
|
949
|
+
portabilitySidebarOrderSchema = z8.object({
|
|
950
|
+
agents: z8.array(z8.string().min(1)).default([]),
|
|
951
|
+
projects: z8.array(z8.string().min(1)).default([])
|
|
1055
952
|
});
|
|
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:
|
|
953
|
+
portabilityAgentManifestEntrySchema = z8.object({
|
|
954
|
+
slug: z8.string().min(1),
|
|
955
|
+
name: z8.string().min(1),
|
|
956
|
+
path: z8.string().min(1),
|
|
957
|
+
skills: z8.array(z8.string().min(1)).default([]),
|
|
958
|
+
role: z8.string().min(1),
|
|
959
|
+
title: z8.string().nullable(),
|
|
960
|
+
icon: z8.string().nullable(),
|
|
961
|
+
capabilities: z8.string().nullable(),
|
|
962
|
+
reportsToSlug: z8.string().min(1).nullable(),
|
|
963
|
+
agentRuntimeType: z8.string().min(1),
|
|
964
|
+
agentRuntimeConfig: z8.record(z8.unknown()),
|
|
965
|
+
runtimeConfig: z8.record(z8.unknown()),
|
|
966
|
+
permissions: z8.record(z8.unknown()),
|
|
967
|
+
budgetMonthlyCents: z8.number().int().nonnegative(),
|
|
968
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1072
969
|
});
|
|
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:
|
|
970
|
+
portabilitySkillManifestEntrySchema = z8.object({
|
|
971
|
+
key: z8.string().min(1),
|
|
972
|
+
slug: z8.string().min(1),
|
|
973
|
+
name: z8.string().min(1),
|
|
974
|
+
path: z8.string().min(1),
|
|
975
|
+
description: z8.string().nullable(),
|
|
976
|
+
sourceType: z8.string().min(1),
|
|
977
|
+
sourceLocator: z8.string().nullable(),
|
|
978
|
+
sourceRef: z8.string().nullable(),
|
|
979
|
+
trustLevel: z8.string().nullable(),
|
|
980
|
+
compatibility: z8.string().nullable(),
|
|
981
|
+
metadata: z8.record(z8.unknown()).nullable(),
|
|
982
|
+
fileInventory: z8.array(z8.object({
|
|
983
|
+
path: z8.string().min(1),
|
|
984
|
+
kind: z8.string().min(1)
|
|
1088
985
|
})).default([])
|
|
1089
986
|
});
|
|
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:
|
|
987
|
+
portabilityProjectManifestEntrySchema = z8.object({
|
|
988
|
+
slug: z8.string().min(1),
|
|
989
|
+
name: z8.string().min(1),
|
|
990
|
+
path: z8.string().min(1),
|
|
991
|
+
description: z8.string().nullable(),
|
|
992
|
+
ownerAgentSlug: z8.string().min(1).nullable(),
|
|
993
|
+
leadAgentSlug: z8.string().min(1).nullable(),
|
|
994
|
+
targetDate: z8.string().nullable(),
|
|
995
|
+
color: z8.string().nullable(),
|
|
996
|
+
status: z8.string().nullable(),
|
|
997
|
+
executionWorkspacePolicy: z8.record(z8.unknown()).nullable(),
|
|
998
|
+
workspaces: z8.array(z8.object({
|
|
999
|
+
key: z8.string().min(1),
|
|
1000
|
+
name: z8.string().min(1),
|
|
1001
|
+
sourceType: z8.string().nullable(),
|
|
1002
|
+
repoUrl: z8.string().nullable(),
|
|
1003
|
+
repoRef: z8.string().nullable(),
|
|
1004
|
+
defaultRef: z8.string().nullable(),
|
|
1005
|
+
visibility: z8.string().nullable(),
|
|
1006
|
+
setupCommand: z8.string().nullable(),
|
|
1007
|
+
cleanupCommand: z8.string().nullable(),
|
|
1008
|
+
metadata: z8.record(z8.unknown()).nullable(),
|
|
1009
|
+
isPrimary: z8.boolean()
|
|
1113
1010
|
})).default([]),
|
|
1114
|
-
metadata:
|
|
1011
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1115
1012
|
});
|
|
1116
|
-
portabilityIssueAutomationTriggerManifestEntrySchema =
|
|
1117
|
-
kind:
|
|
1118
|
-
label:
|
|
1119
|
-
enabled:
|
|
1120
|
-
cronExpression:
|
|
1121
|
-
timezone:
|
|
1122
|
-
signingMode:
|
|
1123
|
-
replayWindowSec:
|
|
1013
|
+
portabilityIssueAutomationTriggerManifestEntrySchema = z8.object({
|
|
1014
|
+
kind: z8.string().min(1),
|
|
1015
|
+
label: z8.string().nullable(),
|
|
1016
|
+
enabled: z8.boolean(),
|
|
1017
|
+
cronExpression: z8.string().nullable(),
|
|
1018
|
+
timezone: z8.string().nullable(),
|
|
1019
|
+
signingMode: z8.string().nullable(),
|
|
1020
|
+
replayWindowSec: z8.number().int().nullable()
|
|
1124
1021
|
});
|
|
1125
|
-
portabilityIssueAutomationManifestEntrySchema =
|
|
1126
|
-
concurrencyPolicy:
|
|
1127
|
-
catchUpPolicy:
|
|
1128
|
-
triggers:
|
|
1022
|
+
portabilityIssueAutomationManifestEntrySchema = z8.object({
|
|
1023
|
+
concurrencyPolicy: z8.string().nullable(),
|
|
1024
|
+
catchUpPolicy: z8.string().nullable(),
|
|
1025
|
+
triggers: z8.array(portabilityIssueAutomationTriggerManifestEntrySchema).default([])
|
|
1129
1026
|
});
|
|
1130
|
-
portabilityIssueManifestEntrySchema =
|
|
1131
|
-
slug:
|
|
1132
|
-
identifier:
|
|
1133
|
-
title:
|
|
1134
|
-
path:
|
|
1135
|
-
projectSlug:
|
|
1136
|
-
projectWorkspaceKey:
|
|
1137
|
-
assigneeAgentSlug:
|
|
1138
|
-
description:
|
|
1139
|
-
recurring:
|
|
1027
|
+
portabilityIssueManifestEntrySchema = z8.object({
|
|
1028
|
+
slug: z8.string().min(1),
|
|
1029
|
+
identifier: z8.string().min(1).nullable(),
|
|
1030
|
+
title: z8.string().min(1),
|
|
1031
|
+
path: z8.string().min(1),
|
|
1032
|
+
projectSlug: z8.string().min(1).nullable(),
|
|
1033
|
+
projectWorkspaceKey: z8.string().min(1).nullable(),
|
|
1034
|
+
assigneeAgentSlug: z8.string().min(1).nullable(),
|
|
1035
|
+
description: z8.string().nullable(),
|
|
1036
|
+
recurring: z8.boolean().default(false),
|
|
1140
1037
|
automation: portabilityIssueAutomationManifestEntrySchema.nullable(),
|
|
1141
|
-
legacyRecurrence:
|
|
1142
|
-
status:
|
|
1143
|
-
priority:
|
|
1144
|
-
labelIds:
|
|
1145
|
-
billingCode:
|
|
1146
|
-
executionWorkspaceSettings:
|
|
1147
|
-
assigneeAgentRuntimeOverrides:
|
|
1148
|
-
metadata:
|
|
1038
|
+
legacyRecurrence: z8.record(z8.unknown()).nullable(),
|
|
1039
|
+
status: z8.string().nullable(),
|
|
1040
|
+
priority: z8.string().nullable(),
|
|
1041
|
+
labelIds: z8.array(z8.string().min(1)).default([]),
|
|
1042
|
+
billingCode: z8.string().nullable(),
|
|
1043
|
+
executionWorkspaceSettings: z8.record(z8.unknown()).nullable(),
|
|
1044
|
+
assigneeAgentRuntimeOverrides: z8.record(z8.unknown()).nullable(),
|
|
1045
|
+
metadata: z8.record(z8.unknown()).nullable()
|
|
1149
1046
|
});
|
|
1150
|
-
portabilityManifestSchema =
|
|
1151
|
-
schemaVersion:
|
|
1152
|
-
generatedAt:
|
|
1153
|
-
source:
|
|
1154
|
-
orgId:
|
|
1155
|
-
organizationName:
|
|
1047
|
+
portabilityManifestSchema = z8.object({
|
|
1048
|
+
schemaVersion: z8.number().int().positive(),
|
|
1049
|
+
generatedAt: z8.string().datetime(),
|
|
1050
|
+
source: z8.object({
|
|
1051
|
+
orgId: z8.string().uuid(),
|
|
1052
|
+
organizationName: z8.string().min(1)
|
|
1156
1053
|
}).nullable(),
|
|
1157
|
-
includes:
|
|
1158
|
-
organization:
|
|
1159
|
-
agents:
|
|
1160
|
-
projects:
|
|
1161
|
-
issues:
|
|
1162
|
-
skills:
|
|
1054
|
+
includes: z8.object({
|
|
1055
|
+
organization: z8.boolean(),
|
|
1056
|
+
agents: z8.boolean(),
|
|
1057
|
+
projects: z8.boolean(),
|
|
1058
|
+
issues: z8.boolean(),
|
|
1059
|
+
skills: z8.boolean()
|
|
1163
1060
|
}),
|
|
1164
1061
|
organization: portabilityOrganizationManifestEntrySchema.nullable(),
|
|
1165
1062
|
sidebar: portabilitySidebarOrderSchema.nullable(),
|
|
1166
|
-
agents:
|
|
1167
|
-
skills:
|
|
1168
|
-
projects:
|
|
1169
|
-
issues:
|
|
1170
|
-
envInputs:
|
|
1063
|
+
agents: z8.array(portabilityAgentManifestEntrySchema),
|
|
1064
|
+
skills: z8.array(portabilitySkillManifestEntrySchema).default([]),
|
|
1065
|
+
projects: z8.array(portabilityProjectManifestEntrySchema).default([]),
|
|
1066
|
+
issues: z8.array(portabilityIssueManifestEntrySchema).default([]),
|
|
1067
|
+
envInputs: z8.array(portabilityEnvInputSchema).default([])
|
|
1171
1068
|
});
|
|
1172
|
-
portabilitySourceSchema =
|
|
1173
|
-
|
|
1174
|
-
type:
|
|
1175
|
-
rootPath:
|
|
1176
|
-
files:
|
|
1069
|
+
portabilitySourceSchema = z8.discriminatedUnion("type", [
|
|
1070
|
+
z8.object({
|
|
1071
|
+
type: z8.literal("inline"),
|
|
1072
|
+
rootPath: z8.string().min(1).optional().nullable(),
|
|
1073
|
+
files: z8.record(portabilityFileEntrySchema)
|
|
1177
1074
|
}),
|
|
1178
|
-
|
|
1179
|
-
type:
|
|
1180
|
-
url:
|
|
1075
|
+
z8.object({
|
|
1076
|
+
type: z8.literal("github"),
|
|
1077
|
+
url: z8.string().url()
|
|
1181
1078
|
})
|
|
1182
1079
|
]);
|
|
1183
|
-
portabilityTargetSchema =
|
|
1184
|
-
|
|
1185
|
-
mode:
|
|
1186
|
-
newOrganizationName:
|
|
1080
|
+
portabilityTargetSchema = z8.discriminatedUnion("mode", [
|
|
1081
|
+
z8.object({
|
|
1082
|
+
mode: z8.literal("new_organization"),
|
|
1083
|
+
newOrganizationName: z8.string().min(1).optional().nullable()
|
|
1187
1084
|
}),
|
|
1188
|
-
|
|
1189
|
-
mode:
|
|
1190
|
-
orgId:
|
|
1085
|
+
z8.object({
|
|
1086
|
+
mode: z8.literal("existing_organization"),
|
|
1087
|
+
orgId: z8.string().uuid()
|
|
1191
1088
|
})
|
|
1192
1089
|
]);
|
|
1193
|
-
portabilityAgentSelectionSchema =
|
|
1194
|
-
|
|
1195
|
-
|
|
1090
|
+
portabilityAgentSelectionSchema = z8.union([
|
|
1091
|
+
z8.literal("all"),
|
|
1092
|
+
z8.array(z8.string().min(1))
|
|
1196
1093
|
]);
|
|
1197
|
-
portabilityCollisionStrategySchema =
|
|
1198
|
-
organizationPortabilityExportSchema =
|
|
1094
|
+
portabilityCollisionStrategySchema = z8.enum(["rename", "skip", "replace"]);
|
|
1095
|
+
organizationPortabilityExportSchema = z8.object({
|
|
1199
1096
|
include: portabilityIncludeSchema.optional(),
|
|
1200
|
-
agents:
|
|
1201
|
-
skills:
|
|
1202
|
-
projects:
|
|
1203
|
-
issues:
|
|
1204
|
-
projectIssues:
|
|
1205
|
-
selectedFiles:
|
|
1206
|
-
expandReferencedSkills:
|
|
1097
|
+
agents: z8.array(z8.string().min(1)).optional(),
|
|
1098
|
+
skills: z8.array(z8.string().min(1)).optional(),
|
|
1099
|
+
projects: z8.array(z8.string().min(1)).optional(),
|
|
1100
|
+
issues: z8.array(z8.string().min(1)).optional(),
|
|
1101
|
+
projectIssues: z8.array(z8.string().min(1)).optional(),
|
|
1102
|
+
selectedFiles: z8.array(z8.string().min(1)).optional(),
|
|
1103
|
+
expandReferencedSkills: z8.boolean().optional(),
|
|
1207
1104
|
sidebarOrder: portabilitySidebarOrderSchema.partial().optional()
|
|
1208
1105
|
});
|
|
1209
|
-
organizationPortabilityPreviewSchema =
|
|
1106
|
+
organizationPortabilityPreviewSchema = z8.object({
|
|
1210
1107
|
source: portabilitySourceSchema,
|
|
1211
1108
|
include: portabilityIncludeSchema.optional(),
|
|
1212
1109
|
target: portabilityTargetSchema,
|
|
1213
1110
|
agents: portabilityAgentSelectionSchema.optional(),
|
|
1214
1111
|
collisionStrategy: portabilityCollisionStrategySchema.optional(),
|
|
1215
|
-
nameOverrides:
|
|
1216
|
-
selectedFiles:
|
|
1112
|
+
nameOverrides: z8.record(z8.string().min(1), z8.string().min(1)).optional(),
|
|
1113
|
+
selectedFiles: z8.array(z8.string().min(1)).optional()
|
|
1217
1114
|
});
|
|
1218
|
-
portabilityAdapterOverrideSchema =
|
|
1219
|
-
agentRuntimeType:
|
|
1220
|
-
agentRuntimeConfig:
|
|
1115
|
+
portabilityAdapterOverrideSchema = z8.object({
|
|
1116
|
+
agentRuntimeType: z8.string().min(1),
|
|
1117
|
+
agentRuntimeConfig: z8.record(z8.unknown()).optional()
|
|
1221
1118
|
});
|
|
1222
1119
|
organizationPortabilityImportSchema = organizationPortabilityPreviewSchema.extend({
|
|
1223
|
-
agentRuntimeOverrides:
|
|
1120
|
+
agentRuntimeOverrides: z8.record(z8.string().min(1), portabilityAdapterOverrideSchema).optional()
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
// ../packages/shared/src/validators/secret.ts
|
|
1126
|
+
import { z as z9 } from "zod";
|
|
1127
|
+
var envBindingPlainSchema, envBindingSecretRefSchema, envBindingSchema, envConfigSchema, createSecretSchema, rotateSecretSchema, updateSecretSchema;
|
|
1128
|
+
var init_secret = __esm({
|
|
1129
|
+
"../packages/shared/src/validators/secret.ts"() {
|
|
1130
|
+
"use strict";
|
|
1131
|
+
init_constants();
|
|
1132
|
+
envBindingPlainSchema = z9.object({
|
|
1133
|
+
type: z9.literal("plain"),
|
|
1134
|
+
value: z9.string()
|
|
1135
|
+
});
|
|
1136
|
+
envBindingSecretRefSchema = z9.object({
|
|
1137
|
+
type: z9.literal("secret_ref"),
|
|
1138
|
+
secretId: z9.string().uuid(),
|
|
1139
|
+
version: z9.union([z9.literal("latest"), z9.number().int().positive()]).optional()
|
|
1140
|
+
});
|
|
1141
|
+
envBindingSchema = z9.union([
|
|
1142
|
+
z9.string(),
|
|
1143
|
+
envBindingPlainSchema,
|
|
1144
|
+
envBindingSecretRefSchema
|
|
1145
|
+
]);
|
|
1146
|
+
envConfigSchema = z9.record(envBindingSchema);
|
|
1147
|
+
createSecretSchema = z9.object({
|
|
1148
|
+
name: z9.string().min(1),
|
|
1149
|
+
provider: z9.enum(SECRET_PROVIDERS).optional(),
|
|
1150
|
+
value: z9.string().min(1),
|
|
1151
|
+
description: z9.string().optional().nullable(),
|
|
1152
|
+
externalRef: z9.string().optional().nullable()
|
|
1153
|
+
});
|
|
1154
|
+
rotateSecretSchema = z9.object({
|
|
1155
|
+
value: z9.string().min(1),
|
|
1156
|
+
externalRef: z9.string().optional().nullable()
|
|
1157
|
+
});
|
|
1158
|
+
updateSecretSchema = z9.object({
|
|
1159
|
+
name: z9.string().min(1).optional(),
|
|
1160
|
+
description: z9.string().optional().nullable(),
|
|
1161
|
+
externalRef: z9.string().optional().nullable()
|
|
1224
1162
|
});
|
|
1225
1163
|
}
|
|
1226
1164
|
});
|
|
1227
1165
|
|
|
1166
|
+
// ../packages/shared/src/validators/model-fallbacks.ts
|
|
1167
|
+
import { z as z10 } from "zod";
|
|
1168
|
+
function isRecord(value) {
|
|
1169
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1170
|
+
}
|
|
1171
|
+
function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
1172
|
+
const fallbackModels = value.modelFallbacks;
|
|
1173
|
+
if (fallbackModels === void 0) return;
|
|
1174
|
+
if (!Array.isArray(fallbackModels)) {
|
|
1175
|
+
ctx.addIssue({
|
|
1176
|
+
code: z10.ZodIssueCode.custom,
|
|
1177
|
+
message: "modelFallbacks must be an array",
|
|
1178
|
+
path: [...pathPrefix, "modelFallbacks"]
|
|
1179
|
+
});
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
fallbackModels.forEach((fallback, index66) => {
|
|
1183
|
+
if (typeof fallback === "string") {
|
|
1184
|
+
if (fallback.trim().length === 0) {
|
|
1185
|
+
ctx.addIssue({
|
|
1186
|
+
code: z10.ZodIssueCode.custom,
|
|
1187
|
+
message: "modelFallbacks string entries must be non-empty",
|
|
1188
|
+
path: [...pathPrefix, "modelFallbacks", index66]
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
if (!isRecord(fallback)) {
|
|
1194
|
+
ctx.addIssue({
|
|
1195
|
+
code: z10.ZodIssueCode.custom,
|
|
1196
|
+
message: "modelFallbacks entries must be strings or runtime/model objects",
|
|
1197
|
+
path: [...pathPrefix, "modelFallbacks", index66]
|
|
1198
|
+
});
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
if (typeof fallback.agentRuntimeType !== "string" || fallback.agentRuntimeType.trim().length === 0) {
|
|
1202
|
+
ctx.addIssue({
|
|
1203
|
+
code: z10.ZodIssueCode.custom,
|
|
1204
|
+
message: "modelFallbacks entries must include agentRuntimeType",
|
|
1205
|
+
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
1206
|
+
});
|
|
1207
|
+
} else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
|
|
1208
|
+
ctx.addIssue({
|
|
1209
|
+
code: z10.ZodIssueCode.custom,
|
|
1210
|
+
message: "modelFallbacks entries must include a valid agentRuntimeType",
|
|
1211
|
+
path: [...pathPrefix, "modelFallbacks", index66, "agentRuntimeType"]
|
|
1212
|
+
});
|
|
1213
|
+
}
|
|
1214
|
+
if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
|
|
1215
|
+
ctx.addIssue({
|
|
1216
|
+
code: z10.ZodIssueCode.custom,
|
|
1217
|
+
message: "modelFallbacks entries must include model",
|
|
1218
|
+
path: [...pathPrefix, "modelFallbacks", index66, "model"]
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
if (fallback.config !== void 0 && !isRecord(fallback.config)) {
|
|
1222
|
+
ctx.addIssue({
|
|
1223
|
+
code: z10.ZodIssueCode.custom,
|
|
1224
|
+
message: "modelFallbacks entry config must be an object",
|
|
1225
|
+
path: [...pathPrefix, "modelFallbacks", index66, "config"]
|
|
1226
|
+
});
|
|
1227
|
+
} else if (isRecord(fallback.config) && fallback.config.env !== void 0) {
|
|
1228
|
+
const parsed = envConfigSchema.safeParse(fallback.config.env);
|
|
1229
|
+
if (!parsed.success) {
|
|
1230
|
+
ctx.addIssue({
|
|
1231
|
+
code: z10.ZodIssueCode.custom,
|
|
1232
|
+
message: "modelFallbacks entry config.env must be a map of valid env bindings",
|
|
1233
|
+
path: [...pathPrefix, "modelFallbacks", index66, "config", "env"]
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
var agentRuntimeTypes;
|
|
1240
|
+
var init_model_fallbacks = __esm({
|
|
1241
|
+
"../packages/shared/src/validators/model-fallbacks.ts"() {
|
|
1242
|
+
"use strict";
|
|
1243
|
+
init_constants();
|
|
1244
|
+
init_secret();
|
|
1245
|
+
agentRuntimeTypes = new Set(AGENT_RUNTIME_TYPES);
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1228
1249
|
// ../packages/shared/src/validators/agent.ts
|
|
1229
1250
|
import { z as z11 } from "zod";
|
|
1230
1251
|
var agentPermissionsSchema, agentInstructionsBundleModeSchema, updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, agentRuntimeConfigSchema, optionalAgentNameSchema, uploadedAgentIconSchema, customAgentIconSchema, agentIconSchema, createAgentSchema, createAgentHireSchema, updateAgentSchema, updateAgentInstructionsPathSchema, createAgentKeySchema, wakeAgentSchema, resetAgentSessionSchema, testAgentRuntimeEnvironmentSchema, updateAgentPermissionsSchema;
|
|
@@ -1321,7 +1342,7 @@ var init_agent = __esm({
|
|
|
1321
1342
|
name: z11.string().min(1).default("default")
|
|
1322
1343
|
});
|
|
1323
1344
|
wakeAgentSchema = z11.object({
|
|
1324
|
-
source: z11.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
|
|
1345
|
+
source: z11.enum(["timer", "assignment", "review", "on_demand", "automation"]).optional().default("on_demand"),
|
|
1325
1346
|
triggerDetail: z11.enum(["manual", "ping", "callback", "system"]).optional(),
|
|
1326
1347
|
reason: z11.string().optional().nullable(),
|
|
1327
1348
|
payload: z11.record(z11.unknown()).optional().nullable(),
|
|
@@ -1450,7 +1471,7 @@ var init_project = __esm({
|
|
|
1450
1471
|
|
|
1451
1472
|
// ../packages/shared/src/validators/issue.ts
|
|
1452
1473
|
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;
|
|
1474
|
+
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, reorderIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, createIssueWorkspaceAttachmentSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
|
|
1454
1475
|
var init_issue = __esm({
|
|
1455
1476
|
"../packages/shared/src/validators/issue.ts"() {
|
|
1456
1477
|
"use strict";
|
|
@@ -1483,6 +1504,8 @@ var init_issue = __esm({
|
|
|
1483
1504
|
priority: z13.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
|
1484
1505
|
assigneeAgentId: z13.string().uuid().optional().nullable(),
|
|
1485
1506
|
assigneeUserId: z13.string().optional().nullable(),
|
|
1507
|
+
reviewerAgentId: z13.string().uuid().optional().nullable(),
|
|
1508
|
+
reviewerUserId: z13.string().optional().nullable(),
|
|
1486
1509
|
requestDepth: z13.number().int().nonnegative().optional().default(0),
|
|
1487
1510
|
billingCode: z13.string().optional().nullable(),
|
|
1488
1511
|
assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
|
|
@@ -1511,7 +1534,8 @@ var init_issue = __esm({
|
|
|
1511
1534
|
updateIssueSchema = createIssueSchema.partial().extend({
|
|
1512
1535
|
comment: z13.string().min(1).optional(),
|
|
1513
1536
|
reopen: z13.boolean().optional(),
|
|
1514
|
-
hiddenAt: z13.string().datetime().nullable().optional()
|
|
1537
|
+
hiddenAt: z13.string().datetime().nullable().optional(),
|
|
1538
|
+
reviewDecision: z13.enum(["approve", "request_changes", "needs_followup", "blocked"]).optional()
|
|
1515
1539
|
});
|
|
1516
1540
|
reorderIssueSchema = z13.object({
|
|
1517
1541
|
issueId: z13.string().uuid(),
|
|
@@ -1541,6 +1565,9 @@ var init_issue = __esm({
|
|
|
1541
1565
|
issueCommentId: z13.string().uuid().optional().nullable(),
|
|
1542
1566
|
usage: z13.enum(["issue", "description_inline", "document_inline", "comment_inline", "comment_attachment"]).optional()
|
|
1543
1567
|
});
|
|
1568
|
+
createIssueWorkspaceAttachmentSchema = z13.object({
|
|
1569
|
+
path: z13.string().trim().min(1).max(2048)
|
|
1570
|
+
});
|
|
1544
1571
|
ISSUE_DOCUMENT_FORMATS = ["markdown"];
|
|
1545
1572
|
issueDocumentFormatSchema = z13.enum(ISSUE_DOCUMENT_FORMATS);
|
|
1546
1573
|
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 +3701,6 @@ var init_organizations = __esm({
|
|
|
3674
3701
|
spentMonthlyCents: integer("spent_monthly_cents").notNull().default(0),
|
|
3675
3702
|
requireBoardApprovalForNewAgents: boolean("require_board_approval_for_new_agents").notNull().default(true),
|
|
3676
3703
|
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
3704
|
workspaceConfig: jsonb("workspace_config").$type(),
|
|
3680
3705
|
brandColor: text6("brand_color"),
|
|
3681
3706
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -4777,6 +4802,8 @@ var init_issues = __esm({
|
|
|
4777
4802
|
boardOrder: integer9("board_order").notNull().default(0),
|
|
4778
4803
|
assigneeAgentId: uuid28("assignee_agent_id").references(() => agents.id),
|
|
4779
4804
|
assigneeUserId: text34("assignee_user_id"),
|
|
4805
|
+
reviewerAgentId: uuid28("reviewer_agent_id").references(() => agents.id),
|
|
4806
|
+
reviewerUserId: text34("reviewer_user_id"),
|
|
4780
4807
|
checkoutRunId: uuid28("checkout_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
4781
4808
|
executionRunId: uuid28("execution_run_id").references(() => heartbeatRuns.id, { onDelete: "set null" }),
|
|
4782
4809
|
executionAgentNameKey: text34("execution_agent_name_key"),
|
|
@@ -4818,6 +4845,16 @@ var init_issues = __esm({
|
|
|
4818
4845
|
table.assigneeUserId,
|
|
4819
4846
|
table.status
|
|
4820
4847
|
),
|
|
4848
|
+
reviewerAgentStatusIdx: index25("issues_company_reviewer_agent_status_idx").on(
|
|
4849
|
+
table.orgId,
|
|
4850
|
+
table.reviewerAgentId,
|
|
4851
|
+
table.status
|
|
4852
|
+
),
|
|
4853
|
+
reviewerUserStatusIdx: index25("issues_company_reviewer_user_status_idx").on(
|
|
4854
|
+
table.orgId,
|
|
4855
|
+
table.reviewerUserId,
|
|
4856
|
+
table.status
|
|
4857
|
+
),
|
|
4821
4858
|
parentIdx: index25("issues_company_parent_idx").on(table.orgId, table.parentId),
|
|
4822
4859
|
projectIdx: index25("issues_company_project_idx").on(table.orgId, table.projectId),
|
|
4823
4860
|
originIdx: index25("issues_company_origin_idx").on(table.orgId, table.originKind, table.originId),
|
|
@@ -7688,8 +7725,8 @@ function pruneOldBackups(backupDir, retentionDays, filenamePrefix) {
|
|
|
7688
7725
|
for (const name of readdirSync(backupDir)) {
|
|
7689
7726
|
if (!name.startsWith(`${filenamePrefix}-`) || !name.endsWith(".sql")) continue;
|
|
7690
7727
|
const fullPath = resolve2(backupDir, name);
|
|
7691
|
-
const
|
|
7692
|
-
if (
|
|
7728
|
+
const stat3 = statSync(fullPath);
|
|
7729
|
+
if (stat3.mtimeMs < cutoff) {
|
|
7693
7730
|
unlinkSync(fullPath);
|
|
7694
7731
|
pruned++;
|
|
7695
7732
|
}
|
|
@@ -10898,10 +10935,17 @@ async function removePathWithRetry(targetPath, attempts = 5) {
|
|
|
10898
10935
|
}
|
|
10899
10936
|
return false;
|
|
10900
10937
|
}
|
|
10901
|
-
async function prepareForDesktopReplace(paths, target) {
|
|
10938
|
+
async function prepareForDesktopReplace(paths, target, options = {}) {
|
|
10902
10939
|
const hasManagedExecutable = await pathExists(paths.executablePath);
|
|
10903
10940
|
if (hasManagedExecutable) {
|
|
10904
|
-
|
|
10941
|
+
let quitResponse = await requestDesktopQuit(paths.executablePath, target);
|
|
10942
|
+
while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns) {
|
|
10943
|
+
p13.log.warn(
|
|
10944
|
+
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}; waiting before replacing Desktop.`
|
|
10945
|
+
);
|
|
10946
|
+
await delay(options.activeRunPollIntervalMs ?? 15e3);
|
|
10947
|
+
quitResponse = await requestDesktopQuit(paths.executablePath, target);
|
|
10948
|
+
}
|
|
10905
10949
|
if (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs") {
|
|
10906
10950
|
throw new Error(
|
|
10907
10951
|
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}. Stop active work, then rerun start.`
|
|
@@ -11044,7 +11088,7 @@ async function startCommand(opts) {
|
|
|
11044
11088
|
const installCli = opts.cli !== false;
|
|
11045
11089
|
const installDesktop = opts.desktop !== false;
|
|
11046
11090
|
const repo = opts.repo?.trim() || DEFAULT_DESKTOP_RELEASE_REPO;
|
|
11047
|
-
const version = opts.version?.trim() || resolveCurrentCliVersion();
|
|
11091
|
+
const version = opts.targetVersion?.trim() || opts.version?.trim() || resolveCurrentCliVersion();
|
|
11048
11092
|
const dryRun = opts.dryRun === true;
|
|
11049
11093
|
if (!installCli && !installDesktop) {
|
|
11050
11094
|
throw new Error("Nothing to start. Remove --no-cli or --no-desktop.");
|
|
@@ -11136,7 +11180,7 @@ async function startCommand(opts) {
|
|
|
11136
11180
|
await runStartPhase(
|
|
11137
11181
|
"Replacing existing Rudder Desktop if needed...",
|
|
11138
11182
|
"Existing Desktop install is ready for replacement.",
|
|
11139
|
-
() => prepareForDesktopReplace(installPaths, target)
|
|
11183
|
+
() => prepareForDesktopReplace(installPaths, target, { waitForActiveRuns: opts.waitForActiveRuns === true })
|
|
11140
11184
|
);
|
|
11141
11185
|
await runStartPhase(
|
|
11142
11186
|
"Installing portable Desktop app...",
|
|
@@ -11376,8 +11420,8 @@ function printItemCompleted(item) {
|
|
|
11376
11420
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
11377
11421
|
const entries = changes.map((changeRaw) => asRecord(changeRaw)).filter((change) => Boolean(change)).map((change) => {
|
|
11378
11422
|
const kind = asString(change.kind, "update");
|
|
11379
|
-
const
|
|
11380
|
-
return `${kind} ${
|
|
11423
|
+
const path24 = asString(change.path, "unknown");
|
|
11424
|
+
return `${kind} ${path24}`;
|
|
11381
11425
|
});
|
|
11382
11426
|
const preview = entries.length > 0 ? entries.slice(0, 6).join(", ") : "none";
|
|
11383
11427
|
const more = entries.length > 6 ? ` (+${entries.length - 6} more)` : "";
|
|
@@ -12558,40 +12602,46 @@ var RudderApiClient = class {
|
|
|
12558
12602
|
this.runId = opts.runId?.trim() || void 0;
|
|
12559
12603
|
this.recoverAuth = opts.recoverAuth;
|
|
12560
12604
|
}
|
|
12561
|
-
get(
|
|
12562
|
-
return this.request(
|
|
12605
|
+
get(path24, opts) {
|
|
12606
|
+
return this.request(path24, { method: "GET" }, opts);
|
|
12563
12607
|
}
|
|
12564
|
-
post(
|
|
12565
|
-
return this.request(
|
|
12608
|
+
post(path24, body, opts) {
|
|
12609
|
+
return this.request(path24, {
|
|
12566
12610
|
method: "POST",
|
|
12567
12611
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12568
12612
|
}, opts);
|
|
12569
12613
|
}
|
|
12570
|
-
|
|
12571
|
-
return this.request(
|
|
12614
|
+
postForm(path24, form, opts) {
|
|
12615
|
+
return this.request(path24, {
|
|
12616
|
+
method: "POST",
|
|
12617
|
+
body: form
|
|
12618
|
+
}, opts);
|
|
12619
|
+
}
|
|
12620
|
+
patch(path24, body, opts) {
|
|
12621
|
+
return this.request(path24, {
|
|
12572
12622
|
method: "PATCH",
|
|
12573
12623
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12574
12624
|
}, opts);
|
|
12575
12625
|
}
|
|
12576
|
-
put(
|
|
12577
|
-
return this.request(
|
|
12626
|
+
put(path24, body, opts) {
|
|
12627
|
+
return this.request(path24, {
|
|
12578
12628
|
method: "PUT",
|
|
12579
12629
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
12580
12630
|
}, opts);
|
|
12581
12631
|
}
|
|
12582
|
-
delete(
|
|
12583
|
-
return this.request(
|
|
12632
|
+
delete(path24, opts) {
|
|
12633
|
+
return this.request(path24, { method: "DELETE" }, opts);
|
|
12584
12634
|
}
|
|
12585
12635
|
setApiKey(apiKey) {
|
|
12586
12636
|
this.apiKey = apiKey?.trim() || void 0;
|
|
12587
12637
|
}
|
|
12588
|
-
async request(
|
|
12589
|
-
const url = buildUrl(this.apiBase,
|
|
12638
|
+
async request(path24, init, opts, hasRetriedAuth = false) {
|
|
12639
|
+
const url = buildUrl(this.apiBase, path24);
|
|
12590
12640
|
const headers = {
|
|
12591
12641
|
accept: "application/json",
|
|
12592
12642
|
...toStringRecord(init.headers)
|
|
12593
12643
|
};
|
|
12594
|
-
if (init.body
|
|
12644
|
+
if (typeof init.body === "string") {
|
|
12595
12645
|
headers["content-type"] = headers["content-type"] ?? "application/json";
|
|
12596
12646
|
}
|
|
12597
12647
|
if (this.apiKey) {
|
|
@@ -12611,13 +12661,13 @@ var RudderApiClient = class {
|
|
|
12611
12661
|
const apiError = await toApiError(response);
|
|
12612
12662
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
12613
12663
|
const recoveredToken = await this.recoverAuth({
|
|
12614
|
-
path:
|
|
12664
|
+
path: path24,
|
|
12615
12665
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
12616
12666
|
error: apiError
|
|
12617
12667
|
});
|
|
12618
12668
|
if (recoveredToken) {
|
|
12619
12669
|
this.setApiKey(recoveredToken);
|
|
12620
|
-
return this.request(
|
|
12670
|
+
return this.request(path24, init, opts, true);
|
|
12621
12671
|
}
|
|
12622
12672
|
}
|
|
12623
12673
|
throw apiError;
|
|
@@ -12636,8 +12686,8 @@ function shouldAttachRunId(method) {
|
|
|
12636
12686
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
12637
12687
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
12638
12688
|
}
|
|
12639
|
-
function buildUrl(apiBase,
|
|
12640
|
-
const normalizedPath =
|
|
12689
|
+
function buildUrl(apiBase, path24) {
|
|
12690
|
+
const normalizedPath = path24.startsWith("/") ? path24 : `/${path24}`;
|
|
12641
12691
|
const [pathname, query] = normalizedPath.split("?");
|
|
12642
12692
|
const url = new URL2(apiBase);
|
|
12643
12693
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -14484,6 +14534,8 @@ ${organizationUrl}`);
|
|
|
14484
14534
|
|
|
14485
14535
|
// src/commands/client/issue.ts
|
|
14486
14536
|
init_src();
|
|
14537
|
+
import { readFile as readFile5, stat as stat2 } from "node:fs/promises";
|
|
14538
|
+
import path16 from "node:path";
|
|
14487
14539
|
|
|
14488
14540
|
// src/agent-v1-registry.ts
|
|
14489
14541
|
var AGENT_CLI_CAPABILITIES = [
|
|
@@ -14503,7 +14555,7 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14503
14555
|
id: "agent.inbox",
|
|
14504
14556
|
command: "rudder agent inbox",
|
|
14505
14557
|
category: "agent",
|
|
14506
|
-
description: "List the compact
|
|
14558
|
+
description: "List the compact assignee and reviewer work inbox for the authenticated agent.",
|
|
14507
14559
|
mutating: false,
|
|
14508
14560
|
contract: "agent-v1",
|
|
14509
14561
|
requiresOrgId: false,
|
|
@@ -14669,9 +14721,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14669
14721
|
},
|
|
14670
14722
|
{
|
|
14671
14723
|
id: "issue.comment",
|
|
14672
|
-
command: "rudder issue comment <issue> --body <text>",
|
|
14724
|
+
command: "rudder issue comment <issue> --body <text> [--image <path>]",
|
|
14673
14725
|
category: "issue",
|
|
14674
|
-
description: "Add a comment to an issue.",
|
|
14726
|
+
description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
|
|
14675
14727
|
mutating: true,
|
|
14676
14728
|
contract: "agent-v1",
|
|
14677
14729
|
requiresOrgId: false,
|
|
@@ -14705,9 +14757,21 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14705
14757
|
},
|
|
14706
14758
|
{
|
|
14707
14759
|
id: "issue.update",
|
|
14708
|
-
command: "rudder issue update <issue> ...",
|
|
14760
|
+
command: "rudder issue update <issue> ... [--image <path>]",
|
|
14761
|
+
category: "issue",
|
|
14762
|
+
description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
|
|
14763
|
+
mutating: true,
|
|
14764
|
+
contract: "agent-v1",
|
|
14765
|
+
requiresOrgId: false,
|
|
14766
|
+
requiresAgentId: false,
|
|
14767
|
+
requiresRunId: false,
|
|
14768
|
+
attachesRunIdWhenAvailable: true
|
|
14769
|
+
},
|
|
14770
|
+
{
|
|
14771
|
+
id: "issue.review",
|
|
14772
|
+
command: "rudder issue review <issue> --decision <decision> --comment <text>",
|
|
14709
14773
|
category: "issue",
|
|
14710
|
-
description: "
|
|
14774
|
+
description: "Record a structured reviewer decision with a required comment.",
|
|
14711
14775
|
mutating: true,
|
|
14712
14776
|
contract: "agent-v1",
|
|
14713
14777
|
requiresOrgId: false,
|
|
@@ -14717,9 +14781,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14717
14781
|
},
|
|
14718
14782
|
{
|
|
14719
14783
|
id: "issue.done",
|
|
14720
|
-
command: "rudder issue done <issue> --comment <text>",
|
|
14784
|
+
command: "rudder issue done <issue> --comment <text> [--image <path>]",
|
|
14721
14785
|
category: "issue",
|
|
14722
|
-
description: "Mark an issue done with a required completion comment.",
|
|
14786
|
+
description: "Mark an issue done with a required completion comment, optionally uploading images.",
|
|
14723
14787
|
mutating: true,
|
|
14724
14788
|
contract: "agent-v1",
|
|
14725
14789
|
requiresOrgId: false,
|
|
@@ -14729,9 +14793,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
14729
14793
|
},
|
|
14730
14794
|
{
|
|
14731
14795
|
id: "issue.block",
|
|
14732
|
-
command: "rudder issue block <issue> --comment <text>",
|
|
14796
|
+
command: "rudder issue block <issue> --comment <text> [--image <path>]",
|
|
14733
14797
|
category: "issue",
|
|
14734
|
-
description: "Mark an issue blocked with a required blocker comment.",
|
|
14798
|
+
description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
|
|
14735
14799
|
mutating: true,
|
|
14736
14800
|
contract: "agent-v1",
|
|
14737
14801
|
requiresOrgId: false,
|
|
@@ -15010,8 +15074,8 @@ function registerIssueCommands(program) {
|
|
|
15010
15074
|
if (opts.assigneeAgentId) params.set("assigneeAgentId", opts.assigneeAgentId);
|
|
15011
15075
|
if (opts.projectId) params.set("projectId", opts.projectId);
|
|
15012
15076
|
const query = params.toString();
|
|
15013
|
-
const
|
|
15014
|
-
const rows = await ctx.api.get(
|
|
15077
|
+
const path24 = `/api/orgs/${ctx.orgId}/issues${query ? `?${query}` : ""}`;
|
|
15078
|
+
const rows = await ctx.api.get(path24) ?? [];
|
|
15015
15079
|
const filtered = filterIssueRows(rows, opts.match);
|
|
15016
15080
|
if (ctx.json) {
|
|
15017
15081
|
printOutput(filtered, { json: true });
|
|
@@ -15092,9 +15156,10 @@ function registerIssueCommands(program) {
|
|
|
15092
15156
|
{ includeCompany: false }
|
|
15093
15157
|
);
|
|
15094
15158
|
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) => {
|
|
15159
|
+
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
15160
|
try {
|
|
15097
15161
|
const ctx = resolveCommandContext(opts);
|
|
15162
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15098
15163
|
const payload = updateIssueSchema.parse({
|
|
15099
15164
|
title: opts.title,
|
|
15100
15165
|
description: opts.description,
|
|
@@ -15106,7 +15171,7 @@ function registerIssueCommands(program) {
|
|
|
15106
15171
|
parentId: opts.parentId,
|
|
15107
15172
|
requestDepth: parseOptionalInt(opts.requestDepth),
|
|
15108
15173
|
billingCode: opts.billingCode,
|
|
15109
|
-
comment
|
|
15174
|
+
comment,
|
|
15110
15175
|
hiddenAt: parseHiddenAt(opts.hiddenAt)
|
|
15111
15176
|
});
|
|
15112
15177
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, payload);
|
|
@@ -15117,11 +15182,12 @@ function registerIssueCommands(program) {
|
|
|
15117
15182
|
})
|
|
15118
15183
|
);
|
|
15119
15184
|
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) => {
|
|
15185
|
+
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
15186
|
try {
|
|
15122
15187
|
const ctx = resolveCommandContext(opts);
|
|
15188
|
+
const body = await appendUploadedIssueImages(ctx, issueId, opts.body, opts.image);
|
|
15123
15189
|
const payload = addIssueCommentSchema.parse({
|
|
15124
|
-
body
|
|
15190
|
+
body,
|
|
15125
15191
|
reopen: opts.reopen
|
|
15126
15192
|
});
|
|
15127
15193
|
const comment = await ctx.api.post(`/api/issues/${issueId}/comments`, payload);
|
|
@@ -15132,11 +15198,15 @@ function registerIssueCommands(program) {
|
|
|
15132
15198
|
})
|
|
15133
15199
|
);
|
|
15134
15200
|
addCommonClientOptions(
|
|
15135
|
-
issue.command("
|
|
15201
|
+
issue.command("review").description(getAgentCliCapabilityById("issue.review").description).argument("<issueId>", "Issue ID").requiredOption(
|
|
15202
|
+
"--decision <decision>",
|
|
15203
|
+
"Review decision: approve, request_changes, needs_followup, or blocked"
|
|
15204
|
+
).requiredOption("--comment <text>", "Required review comment").action(async (issueId, opts) => {
|
|
15136
15205
|
try {
|
|
15137
15206
|
const ctx = resolveCommandContext(opts);
|
|
15207
|
+
const decision = parseReviewDecision(opts.decision);
|
|
15138
15208
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15139
|
-
|
|
15209
|
+
reviewDecision: decision,
|
|
15140
15210
|
comment: opts.comment
|
|
15141
15211
|
});
|
|
15142
15212
|
printOutput(updated, { json: ctx.json });
|
|
@@ -15146,12 +15216,28 @@ function registerIssueCommands(program) {
|
|
|
15146
15216
|
})
|
|
15147
15217
|
);
|
|
15148
15218
|
addCommonClientOptions(
|
|
15149
|
-
issue.command("
|
|
15219
|
+
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) => {
|
|
15220
|
+
try {
|
|
15221
|
+
const ctx = resolveCommandContext(opts);
|
|
15222
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15223
|
+
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15224
|
+
status: "done",
|
|
15225
|
+
comment
|
|
15226
|
+
});
|
|
15227
|
+
printOutput(updated, { json: ctx.json });
|
|
15228
|
+
} catch (err) {
|
|
15229
|
+
handleCommandError(err);
|
|
15230
|
+
}
|
|
15231
|
+
})
|
|
15232
|
+
);
|
|
15233
|
+
addCommonClientOptions(
|
|
15234
|
+
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) => {
|
|
15150
15235
|
try {
|
|
15151
15236
|
const ctx = resolveCommandContext(opts);
|
|
15237
|
+
const comment = await appendUploadedIssueImages(ctx, issueId, opts.comment, opts.image);
|
|
15152
15238
|
const updated = await ctx.api.patch(`/api/issues/${issueId}`, {
|
|
15153
15239
|
status: "blocked",
|
|
15154
|
-
comment
|
|
15240
|
+
comment
|
|
15155
15241
|
});
|
|
15156
15242
|
printOutput(updated, { json: ctx.json });
|
|
15157
15243
|
} catch (err) {
|
|
@@ -15275,6 +15361,80 @@ function registerIssueCommands(program) {
|
|
|
15275
15361
|
})
|
|
15276
15362
|
);
|
|
15277
15363
|
}
|
|
15364
|
+
function collectImagePath(value, previous) {
|
|
15365
|
+
const trimmed = value.trim();
|
|
15366
|
+
if (!trimmed) {
|
|
15367
|
+
throw new Error("--image path cannot be empty");
|
|
15368
|
+
}
|
|
15369
|
+
return [...previous, trimmed];
|
|
15370
|
+
}
|
|
15371
|
+
async function appendUploadedIssueImages(ctx, issueId, body, imagePaths) {
|
|
15372
|
+
const paths = imagePaths ?? [];
|
|
15373
|
+
if (paths.length === 0) return body;
|
|
15374
|
+
const issue = await ctx.api.get(`/api/issues/${issueId}`);
|
|
15375
|
+
if (!issue) {
|
|
15376
|
+
throw new Error("Issue not found");
|
|
15377
|
+
}
|
|
15378
|
+
const links = [];
|
|
15379
|
+
for (const imagePath of paths) {
|
|
15380
|
+
const attachment = await uploadIssueCommentImage(ctx, issue, imagePath);
|
|
15381
|
+
links.push(formatAttachmentMarkdown(attachment));
|
|
15382
|
+
}
|
|
15383
|
+
const base = body?.trimEnd() ?? "";
|
|
15384
|
+
const imageBlock = links.join("\n");
|
|
15385
|
+
return base ? `${base}
|
|
15386
|
+
|
|
15387
|
+
${imageBlock}` : imageBlock;
|
|
15388
|
+
}
|
|
15389
|
+
async function uploadIssueCommentImage(ctx, issue, imagePath) {
|
|
15390
|
+
const resolvedPath = path16.resolve(process.cwd(), imagePath);
|
|
15391
|
+
const stats = await stat2(resolvedPath).catch((err) => {
|
|
15392
|
+
throw new Error(`Unable to read image ${imagePath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
15393
|
+
});
|
|
15394
|
+
if (!stats.isFile()) {
|
|
15395
|
+
throw new Error(`Image path must be a file: ${imagePath}`);
|
|
15396
|
+
}
|
|
15397
|
+
const filename = path16.basename(resolvedPath);
|
|
15398
|
+
const contentType = inferCommentImageContentType(filename);
|
|
15399
|
+
const buffer = await readFile5(resolvedPath);
|
|
15400
|
+
if (buffer.length <= 0) {
|
|
15401
|
+
throw new Error(`Image is empty: ${imagePath}`);
|
|
15402
|
+
}
|
|
15403
|
+
const form = new FormData();
|
|
15404
|
+
form.set("usage", "comment_inline");
|
|
15405
|
+
form.set("file", new Blob([buffer], { type: contentType }), filename);
|
|
15406
|
+
const attachment = await ctx.api.postForm(
|
|
15407
|
+
`/api/orgs/${issue.orgId}/issues/${issue.id}/attachments`,
|
|
15408
|
+
form
|
|
15409
|
+
);
|
|
15410
|
+
if (!attachment) {
|
|
15411
|
+
throw new Error(`Image upload returned no attachment: ${imagePath}`);
|
|
15412
|
+
}
|
|
15413
|
+
return attachment;
|
|
15414
|
+
}
|
|
15415
|
+
function inferCommentImageContentType(filename) {
|
|
15416
|
+
const ext = path16.extname(filename).toLowerCase();
|
|
15417
|
+
switch (ext) {
|
|
15418
|
+
case ".png":
|
|
15419
|
+
return "image/png";
|
|
15420
|
+
case ".jpg":
|
|
15421
|
+
case ".jpeg":
|
|
15422
|
+
return "image/jpeg";
|
|
15423
|
+
case ".webp":
|
|
15424
|
+
return "image/webp";
|
|
15425
|
+
case ".gif":
|
|
15426
|
+
return "image/gif";
|
|
15427
|
+
default:
|
|
15428
|
+
throw new Error(`Unsupported comment image type: ${filename}. Use PNG, JPEG, WebP, or GIF.`);
|
|
15429
|
+
}
|
|
15430
|
+
}
|
|
15431
|
+
function formatAttachmentMarkdown(attachment) {
|
|
15432
|
+
const alt = escapeMarkdownAltText(attachment.originalFilename ?? "image");
|
|
15433
|
+
return ``;
|
|
15434
|
+
}
|
|
15435
|
+
function escapeMarkdownAltText(value) {
|
|
15436
|
+
return value.replaceAll("\\", "\\\\").replaceAll("]", "\\]");
|
|
15437
|
+
}
|
|
15278
15438
|
function parseCsv(value) {
|
|
15279
15439
|
if (!value) return [];
|
|
15280
15440
|
return value.split(",").map((v) => v.trim()).filter(Boolean);
|
|
@@ -15292,6 +15452,13 @@ function parseHiddenAt(value) {
|
|
|
15292
15452
|
if (value.trim().toLowerCase() === "null") return null;
|
|
15293
15453
|
return value;
|
|
15294
15454
|
}
|
|
15455
|
+
function parseReviewDecision(value) {
|
|
15456
|
+
const normalized = value.trim();
|
|
15457
|
+
if (normalized === "approve" || normalized === "request_changes" || normalized === "needs_followup" || normalized === "blocked") {
|
|
15458
|
+
return normalized;
|
|
15459
|
+
}
|
|
15460
|
+
throw new Error("Invalid review decision. Use approve, request_changes, needs_followup, or blocked.");
|
|
15461
|
+
}
|
|
15295
15462
|
function filterIssueRows(rows, match) {
|
|
15296
15463
|
if (!match?.trim()) return rows;
|
|
15297
15464
|
const needle = match.trim().toLowerCase();
|
|
@@ -15306,7 +15473,7 @@ init_src();
|
|
|
15306
15473
|
|
|
15307
15474
|
// ../packages/agent-runtime-utils/src/server-utils.ts
|
|
15308
15475
|
import { constants as fsConstants2, promises as fs12 } from "node:fs";
|
|
15309
|
-
import
|
|
15476
|
+
import path17 from "node:path";
|
|
15310
15477
|
var MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
|
|
15311
15478
|
var MAX_EXCERPT_BYTES = 32 * 1024;
|
|
15312
15479
|
var RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES = [
|
|
@@ -15354,8 +15521,8 @@ var RUDDER_AGENT_OPERATING_CONTRACT = [
|
|
|
15354
15521
|
].join("\n");
|
|
15355
15522
|
async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
|
|
15356
15523
|
const candidates = [
|
|
15357
|
-
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) =>
|
|
15358
|
-
...additionalCandidates.map((candidate) =>
|
|
15524
|
+
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path17.resolve(moduleDir, relativePath)),
|
|
15525
|
+
...additionalCandidates.map((candidate) => path17.resolve(candidate))
|
|
15359
15526
|
];
|
|
15360
15527
|
const seenRoots = /* @__PURE__ */ new Set();
|
|
15361
15528
|
for (const root of candidates) {
|
|
@@ -15373,12 +15540,12 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
15373
15540
|
const removed = [];
|
|
15374
15541
|
for (const entry of entries) {
|
|
15375
15542
|
if (allowed.has(entry.name)) continue;
|
|
15376
|
-
const target =
|
|
15543
|
+
const target = path17.join(skillsHome, entry.name);
|
|
15377
15544
|
const existing = await fs12.lstat(target).catch(() => null);
|
|
15378
15545
|
if (!existing?.isSymbolicLink()) continue;
|
|
15379
15546
|
const linkedPath = await fs12.readlink(target).catch(() => null);
|
|
15380
15547
|
if (!linkedPath) continue;
|
|
15381
|
-
const resolvedLinkedPath =
|
|
15548
|
+
const resolvedLinkedPath = path17.isAbsolute(linkedPath) ? linkedPath : path17.resolve(path17.dirname(target), linkedPath);
|
|
15382
15549
|
if (!isMaintainerOnlySkillTarget(linkedPath) && !isMaintainerOnlySkillTarget(resolvedLinkedPath)) {
|
|
15383
15550
|
continue;
|
|
15384
15551
|
}
|
|
@@ -15394,18 +15561,18 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
15394
15561
|
// src/commands/client/agent.ts
|
|
15395
15562
|
import fs13 from "node:fs/promises";
|
|
15396
15563
|
import os2 from "node:os";
|
|
15397
|
-
import
|
|
15564
|
+
import path18 from "node:path";
|
|
15398
15565
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
15399
|
-
var __moduleDir =
|
|
15566
|
+
var __moduleDir = path18.dirname(fileURLToPath4(import.meta.url));
|
|
15400
15567
|
function codexSkillsHome() {
|
|
15401
15568
|
const fromEnv = process.env.CODEX_HOME?.trim();
|
|
15402
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
15403
|
-
return
|
|
15569
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path18.join(os2.homedir(), ".codex");
|
|
15570
|
+
return path18.join(base, "skills");
|
|
15404
15571
|
}
|
|
15405
15572
|
function claudeSkillsHome() {
|
|
15406
15573
|
const fromEnv = process.env.CLAUDE_HOME?.trim();
|
|
15407
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
15408
|
-
return
|
|
15574
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path18.join(os2.homedir(), ".claude");
|
|
15575
|
+
return path18.join(base, "skills");
|
|
15409
15576
|
}
|
|
15410
15577
|
async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
15411
15578
|
const summary = {
|
|
@@ -15424,8 +15591,8 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
15424
15591
|
);
|
|
15425
15592
|
for (const entry of entries) {
|
|
15426
15593
|
if (!entry.isDirectory()) continue;
|
|
15427
|
-
const source =
|
|
15428
|
-
const target =
|
|
15594
|
+
const source = path18.join(sourceSkillsDir, entry.name);
|
|
15595
|
+
const target = path18.join(targetSkillsDir, entry.name);
|
|
15429
15596
|
const existing = await fs13.lstat(target).catch(() => null);
|
|
15430
15597
|
if (existing) {
|
|
15431
15598
|
if (existing.isSymbolicLink()) {
|
|
@@ -15446,7 +15613,7 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
15446
15613
|
continue;
|
|
15447
15614
|
}
|
|
15448
15615
|
}
|
|
15449
|
-
const resolvedLinkedPath =
|
|
15616
|
+
const resolvedLinkedPath = path18.isAbsolute(linkedPath) ? linkedPath : path18.resolve(path18.dirname(target), linkedPath);
|
|
15450
15617
|
const linkedTargetExists = await fs13.stat(resolvedLinkedPath).then(() => true).catch(() => false);
|
|
15451
15618
|
if (!linkedTargetExists) {
|
|
15452
15619
|
await fs13.unlink(target);
|
|
@@ -15512,6 +15679,7 @@ function registerAgentCommands(program) {
|
|
|
15512
15679
|
formatInlineRecord({
|
|
15513
15680
|
identifier: row.identifier,
|
|
15514
15681
|
id: row.id,
|
|
15682
|
+
relationship: row.relationship ?? "assignee",
|
|
15515
15683
|
status: row.status,
|
|
15516
15684
|
priority: row.priority,
|
|
15517
15685
|
title: row.title,
|
|
@@ -15726,7 +15894,7 @@ function registerAgentCommands(program) {
|
|
|
15726
15894
|
}
|
|
15727
15895
|
const installSummaries = [];
|
|
15728
15896
|
if (opts.installSkills !== false) {
|
|
15729
|
-
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [
|
|
15897
|
+
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path18.resolve(process.cwd(), "skills")]);
|
|
15730
15898
|
if (!skillsDir) {
|
|
15731
15899
|
throw new Error(
|
|
15732
15900
|
"Could not locate local Rudder skills directory. Expected ./skills in the repo checkout."
|
|
@@ -15983,8 +16151,8 @@ function registerActivityCommands(program) {
|
|
|
15983
16151
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
15984
16152
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
15985
16153
|
const query = params.toString();
|
|
15986
|
-
const
|
|
15987
|
-
const rows = await ctx.api.get(
|
|
16154
|
+
const path24 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
16155
|
+
const rows = await ctx.api.get(path24) ?? [];
|
|
15988
16156
|
if (ctx.json) {
|
|
15989
16157
|
printOutput(rows, { json: true });
|
|
15990
16158
|
return;
|
|
@@ -16153,11 +16321,11 @@ function parseCsv4(value) {
|
|
|
16153
16321
|
|
|
16154
16322
|
// src/config/data-dir.ts
|
|
16155
16323
|
init_home();
|
|
16156
|
-
import
|
|
16324
|
+
import path19 from "node:path";
|
|
16157
16325
|
function applyDataDirOverride(options, support = {}) {
|
|
16158
16326
|
const rawDataDir = options.dataDir?.trim();
|
|
16159
16327
|
if (!rawDataDir) return null;
|
|
16160
|
-
const resolvedDataDir =
|
|
16328
|
+
const resolvedDataDir = path19.resolve(expandHomePrefix(rawDataDir));
|
|
16161
16329
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
16162
16330
|
if (support.hasConfigOption) {
|
|
16163
16331
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -16202,7 +16370,7 @@ import {
|
|
|
16202
16370
|
writeFileSync
|
|
16203
16371
|
} from "node:fs";
|
|
16204
16372
|
import os3 from "node:os";
|
|
16205
|
-
import
|
|
16373
|
+
import path21 from "node:path";
|
|
16206
16374
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
16207
16375
|
import { createServer } from "node:net";
|
|
16208
16376
|
import { Readable as Readable2 } from "node:stream";
|
|
@@ -16213,7 +16381,7 @@ import { and as and2, eq as eq2, inArray, sql as sql3 } from "drizzle-orm";
|
|
|
16213
16381
|
// src/commands/worktree-lib.ts
|
|
16214
16382
|
init_home();
|
|
16215
16383
|
import { randomInt } from "node:crypto";
|
|
16216
|
-
import
|
|
16384
|
+
import path20 from "node:path";
|
|
16217
16385
|
var DEFAULT_WORKTREE_HOME = "~/.rudder-worktrees";
|
|
16218
16386
|
var WORKTREE_SEED_MODES = ["minimal", "full"];
|
|
16219
16387
|
var MINIMAL_WORKTREE_EXCLUDED_TABLES = [
|
|
@@ -16261,7 +16429,7 @@ function sanitizeWorktreeInstanceId(rawValue) {
|
|
|
16261
16429
|
return normalized || "worktree";
|
|
16262
16430
|
}
|
|
16263
16431
|
function resolveSuggestedWorktreeName(cwd, explicitName) {
|
|
16264
|
-
return nonEmpty(explicitName) ??
|
|
16432
|
+
return nonEmpty(explicitName) ?? path20.basename(path20.resolve(cwd));
|
|
16265
16433
|
}
|
|
16266
16434
|
function hslComponentToHex(n) {
|
|
16267
16435
|
return Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
|
|
@@ -16301,24 +16469,24 @@ function generateWorktreeColor() {
|
|
|
16301
16469
|
return hslToHex(randomInt(0, 360), 68, 56);
|
|
16302
16470
|
}
|
|
16303
16471
|
function resolveWorktreeLocalPaths(opts) {
|
|
16304
|
-
const cwd =
|
|
16305
|
-
const homeDir =
|
|
16306
|
-
const instanceRoot =
|
|
16307
|
-
const repoConfigDir =
|
|
16472
|
+
const cwd = path20.resolve(opts.cwd);
|
|
16473
|
+
const homeDir = path20.resolve(expandHomePrefix(opts.homeDir ?? DEFAULT_WORKTREE_HOME));
|
|
16474
|
+
const instanceRoot = path20.resolve(homeDir, "instances", opts.instanceId);
|
|
16475
|
+
const repoConfigDir = path20.resolve(cwd, ".rudder");
|
|
16308
16476
|
return {
|
|
16309
16477
|
cwd,
|
|
16310
16478
|
repoConfigDir,
|
|
16311
|
-
configPath:
|
|
16312
|
-
envPath:
|
|
16479
|
+
configPath: path20.resolve(repoConfigDir, "config.json"),
|
|
16480
|
+
envPath: path20.resolve(repoConfigDir, ".env"),
|
|
16313
16481
|
homeDir,
|
|
16314
16482
|
instanceId: opts.instanceId,
|
|
16315
16483
|
instanceRoot,
|
|
16316
|
-
contextPath:
|
|
16317
|
-
embeddedPostgresDataDir:
|
|
16318
|
-
backupDir:
|
|
16319
|
-
logDir:
|
|
16320
|
-
secretsKeyFilePath:
|
|
16321
|
-
storageDir:
|
|
16484
|
+
contextPath: path20.resolve(homeDir, "context.json"),
|
|
16485
|
+
embeddedPostgresDataDir: path20.resolve(instanceRoot, "db"),
|
|
16486
|
+
backupDir: path20.resolve(instanceRoot, "data", "backups"),
|
|
16487
|
+
logDir: path20.resolve(instanceRoot, "logs"),
|
|
16488
|
+
secretsKeyFilePath: path20.resolve(instanceRoot, "secrets", "master.key"),
|
|
16489
|
+
storageDir: path20.resolve(instanceRoot, "data", "storage")
|
|
16322
16490
|
};
|
|
16323
16491
|
}
|
|
16324
16492
|
function rewriteLocalUrlPort(rawUrl, port) {
|
|
@@ -16842,7 +17010,7 @@ function isCurrentSourceConfigPath(sourceConfigPath) {
|
|
|
16842
17010
|
if (!currentConfigPath || currentConfigPath.trim().length === 0) {
|
|
16843
17011
|
return false;
|
|
16844
17012
|
}
|
|
16845
|
-
return
|
|
17013
|
+
return path21.resolve(currentConfigPath) === path21.resolve(sourceConfigPath);
|
|
16846
17014
|
}
|
|
16847
17015
|
var WORKTREE_NAME_PREFIX = "rudder-";
|
|
16848
17016
|
function resolveWorktreeMakeName(name) {
|
|
@@ -16880,9 +17048,9 @@ function normalizeStorageObjectKey(objectKey) {
|
|
|
16880
17048
|
return parts.join("/");
|
|
16881
17049
|
}
|
|
16882
17050
|
function resolveLocalStoragePath(baseDir, objectKey) {
|
|
16883
|
-
const resolved =
|
|
16884
|
-
const root =
|
|
16885
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
17051
|
+
const resolved = path21.resolve(baseDir, normalizeStorageObjectKey(objectKey));
|
|
17052
|
+
const root = path21.resolve(baseDir);
|
|
17053
|
+
if (resolved !== root && !resolved.startsWith(`${root}${path21.sep}`)) {
|
|
16886
17054
|
throw new Error("Invalid object key path.");
|
|
16887
17055
|
}
|
|
16888
17056
|
return resolved;
|
|
@@ -16933,7 +17101,7 @@ function createConfiguredStorageFromRudderConfig(config) {
|
|
|
16933
17101
|
async putObject(orgId, objectKey, body) {
|
|
16934
17102
|
assertStorageCompanyPrefix(orgId, objectKey);
|
|
16935
17103
|
const filePath = resolveLocalStoragePath(baseDir, objectKey);
|
|
16936
|
-
await fsPromises.mkdir(
|
|
17104
|
+
await fsPromises.mkdir(path21.dirname(filePath), { recursive: true });
|
|
16937
17105
|
await fsPromises.writeFile(filePath, body);
|
|
16938
17106
|
}
|
|
16939
17107
|
};
|
|
@@ -17017,7 +17185,7 @@ async function readSourceAttachmentBody(sourceStorages, orgId, objectKey) {
|
|
|
17017
17185
|
return null;
|
|
17018
17186
|
}
|
|
17019
17187
|
function resolveWorktreeMakeTargetPath(name) {
|
|
17020
|
-
return
|
|
17188
|
+
return path21.resolve(os3.homedir(), resolveWorktreeMakeName(name));
|
|
17021
17189
|
}
|
|
17022
17190
|
function extractExecSyncErrorMessage(error) {
|
|
17023
17191
|
if (!error || typeof error !== "object") {
|
|
@@ -17123,10 +17291,10 @@ function detectGitWorkspaceInfo(cwd) {
|
|
|
17123
17291
|
stdio: ["ignore", "pipe", "ignore"]
|
|
17124
17292
|
}).trim();
|
|
17125
17293
|
return {
|
|
17126
|
-
root:
|
|
17127
|
-
commonDir:
|
|
17128
|
-
gitDir:
|
|
17129
|
-
hooksPath:
|
|
17294
|
+
root: path21.resolve(root),
|
|
17295
|
+
commonDir: path21.resolve(root, commonDirRaw),
|
|
17296
|
+
gitDir: path21.resolve(root, gitDirRaw),
|
|
17297
|
+
hooksPath: path21.resolve(root, hooksPathRaw)
|
|
17130
17298
|
};
|
|
17131
17299
|
} catch {
|
|
17132
17300
|
return null;
|
|
@@ -17139,8 +17307,8 @@ function copyDirectoryContents(sourceDir, targetDir) {
|
|
|
17139
17307
|
mkdirSync3(targetDir, { recursive: true });
|
|
17140
17308
|
let copied = false;
|
|
17141
17309
|
for (const entry of entries) {
|
|
17142
|
-
const sourcePath =
|
|
17143
|
-
const targetPath =
|
|
17310
|
+
const sourcePath = path21.resolve(sourceDir, entry.name);
|
|
17311
|
+
const targetPath = path21.resolve(targetDir, entry.name);
|
|
17144
17312
|
if (entry.isDirectory()) {
|
|
17145
17313
|
mkdirSync3(targetPath, { recursive: true });
|
|
17146
17314
|
copyDirectoryContents(sourcePath, targetPath);
|
|
@@ -17166,7 +17334,7 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
17166
17334
|
const workspace = detectGitWorkspaceInfo(cwd);
|
|
17167
17335
|
if (!workspace) return null;
|
|
17168
17336
|
const sourceHooksPath = workspace.hooksPath;
|
|
17169
|
-
const targetHooksPath =
|
|
17337
|
+
const targetHooksPath = path21.resolve(workspace.gitDir, "hooks");
|
|
17170
17338
|
if (sourceHooksPath === targetHooksPath) {
|
|
17171
17339
|
return {
|
|
17172
17340
|
sourceHooksPath,
|
|
@@ -17181,17 +17349,17 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
17181
17349
|
};
|
|
17182
17350
|
}
|
|
17183
17351
|
function rebindWorkspaceCwd(input) {
|
|
17184
|
-
const sourceRepoRoot =
|
|
17185
|
-
const targetRepoRoot =
|
|
17186
|
-
const workspaceCwd =
|
|
17187
|
-
const relative =
|
|
17352
|
+
const sourceRepoRoot = path21.resolve(input.sourceRepoRoot);
|
|
17353
|
+
const targetRepoRoot = path21.resolve(input.targetRepoRoot);
|
|
17354
|
+
const workspaceCwd = path21.resolve(input.workspaceCwd);
|
|
17355
|
+
const relative = path21.relative(sourceRepoRoot, workspaceCwd);
|
|
17188
17356
|
if (!relative || relative === "") {
|
|
17189
17357
|
return targetRepoRoot;
|
|
17190
17358
|
}
|
|
17191
|
-
if (relative.startsWith("..") ||
|
|
17359
|
+
if (relative.startsWith("..") || path21.isAbsolute(relative)) {
|
|
17192
17360
|
return null;
|
|
17193
17361
|
}
|
|
17194
|
-
return
|
|
17362
|
+
return path21.resolve(targetRepoRoot, relative);
|
|
17195
17363
|
}
|
|
17196
17364
|
async function rebindSeededProjectWorkspaces(input) {
|
|
17197
17365
|
const targetRepo = detectGitWorkspaceInfo(input.currentCwd);
|
|
@@ -17217,7 +17385,7 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
17217
17385
|
workspaceCwd
|
|
17218
17386
|
});
|
|
17219
17387
|
if (!reboundCwd) continue;
|
|
17220
|
-
const normalizedCurrent =
|
|
17388
|
+
const normalizedCurrent = path21.resolve(workspaceCwd);
|
|
17221
17389
|
if (reboundCwd === normalizedCurrent) continue;
|
|
17222
17390
|
if (!existsSync3(reboundCwd)) continue;
|
|
17223
17391
|
await db.update(projectWorkspaces).set({
|
|
@@ -17236,14 +17404,14 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
17236
17404
|
}
|
|
17237
17405
|
}
|
|
17238
17406
|
function resolveSourceConfigPath(opts) {
|
|
17239
|
-
if (opts.sourceConfigPathOverride) return
|
|
17240
|
-
if (opts.fromConfig) return
|
|
17407
|
+
if (opts.sourceConfigPathOverride) return path21.resolve(opts.sourceConfigPathOverride);
|
|
17408
|
+
if (opts.fromConfig) return path21.resolve(opts.fromConfig);
|
|
17241
17409
|
if (!opts.fromDataDir && !opts.fromInstance) {
|
|
17242
17410
|
return resolveConfigPath();
|
|
17243
17411
|
}
|
|
17244
|
-
const sourceHome =
|
|
17412
|
+
const sourceHome = path21.resolve(expandHomePrefix(opts.fromDataDir ?? "~/.rudder"));
|
|
17245
17413
|
const sourceInstanceId = sanitizeWorktreeInstanceId(opts.fromInstance ?? "default");
|
|
17246
|
-
return
|
|
17414
|
+
return path21.resolve(sourceHome, "instances", sourceInstanceId, "config.json");
|
|
17247
17415
|
}
|
|
17248
17416
|
function resolveSourceConnectionString(config, envEntries, portOverride) {
|
|
17249
17417
|
if (config.database.mode === "postgres") {
|
|
@@ -17262,7 +17430,7 @@ function copySeededSecretsKey(input) {
|
|
|
17262
17430
|
if (input.sourceConfig.secrets.provider !== "local_encrypted") {
|
|
17263
17431
|
return;
|
|
17264
17432
|
}
|
|
17265
|
-
mkdirSync3(
|
|
17433
|
+
mkdirSync3(path21.dirname(input.targetKeyFilePath), { recursive: true });
|
|
17266
17434
|
const allowProcessEnvFallback = isCurrentSourceConfigPath(input.sourceConfigPath);
|
|
17267
17435
|
const sourceInlineMasterKey = nonEmpty2(input.sourceEnvEntries.RUDDER_SECRETS_MASTER_KEY) ?? (allowProcessEnvFallback ? nonEmpty2(process.env.RUDDER_SECRETS_MASTER_KEY) : null);
|
|
17268
17436
|
if (sourceInlineMasterKey) {
|
|
@@ -17301,7 +17469,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
17301
17469
|
"Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again."
|
|
17302
17470
|
);
|
|
17303
17471
|
}
|
|
17304
|
-
const postmasterPidFile =
|
|
17472
|
+
const postmasterPidFile = path21.resolve(dataDir, "postmaster.pid");
|
|
17305
17473
|
const runningPid = readRunningPostmasterPid(postmasterPidFile);
|
|
17306
17474
|
if (runningPid) {
|
|
17307
17475
|
return {
|
|
@@ -17324,7 +17492,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
17324
17492
|
onError: () => {
|
|
17325
17493
|
}
|
|
17326
17494
|
});
|
|
17327
|
-
if (!existsSync3(
|
|
17495
|
+
if (!existsSync3(path21.resolve(dataDir, "PG_VERSION"))) {
|
|
17328
17496
|
await instance.initialise();
|
|
17329
17497
|
}
|
|
17330
17498
|
if (existsSync3(postmasterPidFile)) {
|
|
@@ -17365,7 +17533,7 @@ async function seedWorktreeDatabase(input) {
|
|
|
17365
17533
|
);
|
|
17366
17534
|
const backup = await runDatabaseBackup({
|
|
17367
17535
|
connectionString: sourceConnectionString,
|
|
17368
|
-
backupDir:
|
|
17536
|
+
backupDir: path21.resolve(input.targetPaths.backupDir, "seed"),
|
|
17369
17537
|
retentionDays: 7,
|
|
17370
17538
|
filenamePrefix: `${input.instanceId}-seed`,
|
|
17371
17539
|
includeMigrationJournal: true,
|
|
@@ -17524,7 +17692,7 @@ async function worktreeMakeCommand(nameArg, opts) {
|
|
|
17524
17692
|
if (existsSync3(targetPath)) {
|
|
17525
17693
|
throw new Error(`Target path already exists: ${targetPath}`);
|
|
17526
17694
|
}
|
|
17527
|
-
mkdirSync3(
|
|
17695
|
+
mkdirSync3(path21.dirname(targetPath), { recursive: true });
|
|
17528
17696
|
if (startPoint) {
|
|
17529
17697
|
const [remote] = startPoint.split("/", 1);
|
|
17530
17698
|
try {
|
|
@@ -17620,15 +17788,15 @@ function parseGitWorktreeList(cwd) {
|
|
|
17620
17788
|
return entries;
|
|
17621
17789
|
}
|
|
17622
17790
|
function toMergeSourceChoices(cwd) {
|
|
17623
|
-
const currentCwd =
|
|
17791
|
+
const currentCwd = path21.resolve(cwd);
|
|
17624
17792
|
return parseGitWorktreeList(cwd).map((entry) => {
|
|
17625
17793
|
const branchLabel = entry.branch?.replace(/^refs\/heads\//, "") ?? "(detached)";
|
|
17626
|
-
const worktreePath =
|
|
17794
|
+
const worktreePath = path21.resolve(entry.worktree);
|
|
17627
17795
|
return {
|
|
17628
17796
|
worktree: worktreePath,
|
|
17629
17797
|
branch: entry.branch,
|
|
17630
17798
|
branchLabel,
|
|
17631
|
-
hasRudderConfig: existsSync3(
|
|
17799
|
+
hasRudderConfig: existsSync3(path21.resolve(worktreePath, ".rudder", "config.json")),
|
|
17632
17800
|
isCurrent: worktreePath === currentCwd
|
|
17633
17801
|
};
|
|
17634
17802
|
});
|
|
@@ -17676,14 +17844,14 @@ async function worktreeCleanupCommand(nameArg, opts) {
|
|
|
17676
17844
|
const sourceCwd = process.cwd();
|
|
17677
17845
|
const targetPath = resolveWorktreeMakeTargetPath(name);
|
|
17678
17846
|
const instanceId = sanitizeWorktreeInstanceId(opts.instance ?? name);
|
|
17679
|
-
const homeDir =
|
|
17680
|
-
const instanceRoot =
|
|
17847
|
+
const homeDir = path21.resolve(expandHomePrefix(resolveWorktreeHome(opts.home)));
|
|
17848
|
+
const instanceRoot = path21.resolve(homeDir, "instances", instanceId);
|
|
17681
17849
|
const hasBranch = localBranchExists(sourceCwd, name);
|
|
17682
17850
|
const hasTargetDir = existsSync3(targetPath);
|
|
17683
17851
|
const hasInstanceData = existsSync3(instanceRoot);
|
|
17684
17852
|
const worktrees = parseGitWorktreeList(sourceCwd);
|
|
17685
17853
|
const linkedWorktree = worktrees.find(
|
|
17686
|
-
(wt) => wt.branch === `refs/heads/${name}` ||
|
|
17854
|
+
(wt) => wt.branch === `refs/heads/${name}` || path21.resolve(wt.worktree) === path21.resolve(targetPath)
|
|
17687
17855
|
);
|
|
17688
17856
|
if (!hasBranch && !hasTargetDir && !hasInstanceData && !linkedWorktree) {
|
|
17689
17857
|
p17.log.info("Nothing to clean up \u2014 no branch, worktree directory, or instance data found.");
|
|
@@ -17801,7 +17969,7 @@ async function closeDb(db) {
|
|
|
17801
17969
|
}
|
|
17802
17970
|
function resolveCurrentEndpoint() {
|
|
17803
17971
|
return {
|
|
17804
|
-
rootPath:
|
|
17972
|
+
rootPath: path21.resolve(process.cwd()),
|
|
17805
17973
|
configPath: resolveConfigPath(),
|
|
17806
17974
|
label: "current",
|
|
17807
17975
|
isCurrent: true
|
|
@@ -17812,12 +17980,12 @@ function resolveAttachmentLookupStorages(input) {
|
|
|
17812
17980
|
input.sourceEndpoint.configPath,
|
|
17813
17981
|
resolveCurrentEndpoint().configPath,
|
|
17814
17982
|
input.targetEndpoint.configPath,
|
|
17815
|
-
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) =>
|
|
17983
|
+
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) => path21.resolve(choice.worktree, ".rudder", "config.json"))
|
|
17816
17984
|
];
|
|
17817
17985
|
const seen = /* @__PURE__ */ new Set();
|
|
17818
17986
|
const storages = [];
|
|
17819
17987
|
for (const configPath of orderedConfigPaths) {
|
|
17820
|
-
const resolved =
|
|
17988
|
+
const resolved = path21.resolve(configPath);
|
|
17821
17989
|
if (seen.has(resolved) || !existsSync3(resolved)) continue;
|
|
17822
17990
|
seen.add(resolved);
|
|
17823
17991
|
storages.push(openConfiguredStorage(resolved));
|
|
@@ -18236,7 +18404,7 @@ function resolveEndpointFromChoice(choice) {
|
|
|
18236
18404
|
}
|
|
18237
18405
|
return {
|
|
18238
18406
|
rootPath: choice.worktree,
|
|
18239
|
-
configPath:
|
|
18407
|
+
configPath: path21.resolve(choice.worktree, ".rudder", "config.json"),
|
|
18240
18408
|
label: choice.branchLabel,
|
|
18241
18409
|
isCurrent: false
|
|
18242
18410
|
};
|
|
@@ -18252,24 +18420,24 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
18252
18420
|
return currentEndpoint;
|
|
18253
18421
|
}
|
|
18254
18422
|
const choices = toMergeSourceChoices(process.cwd());
|
|
18255
|
-
const directPath =
|
|
18423
|
+
const directPath = path21.resolve(trimmed);
|
|
18256
18424
|
if (existsSync3(directPath)) {
|
|
18257
18425
|
if (allowCurrent && directPath === currentEndpoint.rootPath) {
|
|
18258
18426
|
return currentEndpoint;
|
|
18259
18427
|
}
|
|
18260
|
-
const configPath =
|
|
18428
|
+
const configPath = path21.resolve(directPath, ".rudder", "config.json");
|
|
18261
18429
|
if (!existsSync3(configPath)) {
|
|
18262
18430
|
throw new Error(`Resolved worktree path ${directPath} does not contain .rudder/config.json.`);
|
|
18263
18431
|
}
|
|
18264
18432
|
return {
|
|
18265
18433
|
rootPath: directPath,
|
|
18266
18434
|
configPath,
|
|
18267
|
-
label:
|
|
18435
|
+
label: path21.basename(directPath),
|
|
18268
18436
|
isCurrent: false
|
|
18269
18437
|
};
|
|
18270
18438
|
}
|
|
18271
18439
|
const matched = choices.find(
|
|
18272
|
-
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath ||
|
|
18440
|
+
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath || path21.basename(choice.worktree) === trimmed || choice.branchLabel === trimmed)
|
|
18273
18441
|
);
|
|
18274
18442
|
if (!matched) {
|
|
18275
18443
|
throw new Error(
|
|
@@ -18282,9 +18450,9 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
18282
18450
|
return resolveEndpointFromChoice(matched);
|
|
18283
18451
|
}
|
|
18284
18452
|
async function promptForSourceEndpoint(excludeWorktreePath) {
|
|
18285
|
-
const excluded = excludeWorktreePath ?
|
|
18453
|
+
const excluded = excludeWorktreePath ? path21.resolve(excludeWorktreePath) : null;
|
|
18286
18454
|
const currentEndpoint = resolveCurrentEndpoint();
|
|
18287
|
-
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) =>
|
|
18455
|
+
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) => path21.resolve(choice.worktree) !== excluded).map((choice) => ({
|
|
18288
18456
|
value: choice.isCurrent ? "__current__" : choice.worktree,
|
|
18289
18457
|
label: choice.branchLabel,
|
|
18290
18458
|
hint: `${choice.worktree}${choice.isCurrent ? " (current)" : ""}`
|
|
@@ -18608,7 +18776,7 @@ async function worktreeMergeHistoryCommand(sourceArg, opts) {
|
|
|
18608
18776
|
}
|
|
18609
18777
|
const targetEndpoint = opts.to ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true }) : resolveCurrentEndpoint();
|
|
18610
18778
|
const sourceEndpoint = opts.from ? resolveWorktreeEndpointFromSelector(opts.from, { allowCurrent: true }) : sourceArg ? resolveWorktreeEndpointFromSelector(sourceArg, { allowCurrent: true }) : await promptForSourceEndpoint(targetEndpoint.rootPath);
|
|
18611
|
-
if (
|
|
18779
|
+
if (path21.resolve(sourceEndpoint.configPath) === path21.resolve(targetEndpoint.configPath)) {
|
|
18612
18780
|
throw new Error("Source and target Rudder configs are the same. Choose different --from/--to worktrees.");
|
|
18613
18781
|
}
|
|
18614
18782
|
const scopes = parseWorktreeMergeScopes(opts.scope);
|
|
@@ -18697,16 +18865,16 @@ function registerWorktreeCommands(program) {
|
|
|
18697
18865
|
}
|
|
18698
18866
|
|
|
18699
18867
|
// src/commands/client/plugin.ts
|
|
18700
|
-
import
|
|
18868
|
+
import path22 from "node:path";
|
|
18701
18869
|
import pc24 from "picocolors";
|
|
18702
18870
|
function resolvePackageArg(packageArg, isLocal) {
|
|
18703
18871
|
if (!isLocal) return packageArg;
|
|
18704
|
-
if (
|
|
18872
|
+
if (path22.isAbsolute(packageArg)) return packageArg;
|
|
18705
18873
|
if (packageArg.startsWith("~")) {
|
|
18706
18874
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
18707
|
-
return
|
|
18875
|
+
return path22.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
18708
18876
|
}
|
|
18709
|
-
return
|
|
18877
|
+
return path22.resolve(process.cwd(), packageArg);
|
|
18710
18878
|
}
|
|
18711
18879
|
function formatPlugin(p18) {
|
|
18712
18880
|
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 +19146,7 @@ function registerClientAuthCommands(auth) {
|
|
|
18978
19146
|
|
|
18979
19147
|
// src/commands/benchmark-create-agent.ts
|
|
18980
19148
|
import fs14 from "node:fs/promises";
|
|
18981
|
-
import
|
|
19149
|
+
import path23 from "node:path";
|
|
18982
19150
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
18983
19151
|
import { LangfuseClient } from "@langfuse/client";
|
|
18984
19152
|
|
|
@@ -19004,6 +19172,13 @@ function formatJson(value) {
|
|
|
19004
19172
|
return String(value);
|
|
19005
19173
|
}
|
|
19006
19174
|
}
|
|
19175
|
+
function formatTodoList(entry) {
|
|
19176
|
+
return entry.items.map((item) => `${item.status === "completed" ? "[x]" : item.status === "in_progress" ? "[~]" : "[ ]"} ${item.text}`).join("\n");
|
|
19177
|
+
}
|
|
19178
|
+
function summarizeTodoList(entry) {
|
|
19179
|
+
const completed = entry.items.filter((item) => item.status === "completed").length;
|
|
19180
|
+
return `Todo list updated: ${completed}/${entry.items.length} complete`;
|
|
19181
|
+
}
|
|
19007
19182
|
function isModelTranscriptEntry(entry) {
|
|
19008
19183
|
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "result";
|
|
19009
19184
|
}
|
|
@@ -19013,6 +19188,7 @@ function isPayloadTranscriptEntry(entry) {
|
|
|
19013
19188
|
function detailTextForTranscriptEntry(entry) {
|
|
19014
19189
|
if (entry.kind === "tool_call") return formatJson(entry.input);
|
|
19015
19190
|
if (entry.kind === "tool_result") return entry.content || "";
|
|
19191
|
+
if (entry.kind === "todo_list") return formatTodoList(entry);
|
|
19016
19192
|
if (entry.kind === "result") {
|
|
19017
19193
|
return [
|
|
19018
19194
|
entry.text || "",
|
|
@@ -19032,6 +19208,9 @@ function previewTextForTranscriptEntry(entry, maxLength = 180) {
|
|
|
19032
19208
|
const detail = detailTextForTranscriptEntry(entry);
|
|
19033
19209
|
return truncate(firstMeaningfulLine(detail) || entry.toolName || "(empty tool result)", maxLength);
|
|
19034
19210
|
}
|
|
19211
|
+
if (entry.kind === "todo_list") {
|
|
19212
|
+
return truncate(summarizeTodoList(entry), maxLength);
|
|
19213
|
+
}
|
|
19035
19214
|
if (entry.kind === "result") {
|
|
19036
19215
|
const summary = entry.text ? firstMeaningfulLine(entry.text) : "";
|
|
19037
19216
|
if (summary) return truncate(summary, maxLength);
|
|
@@ -19046,7 +19225,7 @@ function previewTextForTranscriptEntry(entry, maxLength = 180) {
|
|
|
19046
19225
|
return "";
|
|
19047
19226
|
}
|
|
19048
19227
|
function isTurnScopedEntry(entry) {
|
|
19049
|
-
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "tool_call" || entry.kind === "tool_result" || entry.kind === "result";
|
|
19228
|
+
return entry.kind === "assistant" || entry.kind === "thinking" || entry.kind === "todo_list" || entry.kind === "tool_call" || entry.kind === "tool_result" || entry.kind === "result";
|
|
19050
19229
|
}
|
|
19051
19230
|
function isErrorTranscriptEntry(entry) {
|
|
19052
19231
|
return entry.kind === "stderr" || entry.kind === "tool_result" && entry.isError || entry.kind === "result" && entry.isError;
|
|
@@ -19527,11 +19706,11 @@ function createAgentEvalCheckToScoreValue(check) {
|
|
|
19527
19706
|
}
|
|
19528
19707
|
|
|
19529
19708
|
// src/commands/benchmark-create-agent.ts
|
|
19530
|
-
var __moduleDir2 =
|
|
19531
|
-
var repoRoot =
|
|
19532
|
-
var defaultCasesDir =
|
|
19533
|
-
var defaultSetsDir =
|
|
19534
|
-
var defaultArtifactsDir =
|
|
19709
|
+
var __moduleDir2 = path23.dirname(fileURLToPath5(import.meta.url));
|
|
19710
|
+
var repoRoot = path23.resolve(__moduleDir2, "../../..");
|
|
19711
|
+
var defaultCasesDir = path23.join(repoRoot, "benchmark", "create-agent", "cases");
|
|
19712
|
+
var defaultSetsDir = path23.join(repoRoot, "benchmark", "create-agent", "sets");
|
|
19713
|
+
var defaultArtifactsDir = path23.join(repoRoot, ".artifacts", "create-agent-benchmark");
|
|
19535
19714
|
var TERMINAL_RUN_STATUSES2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
19536
19715
|
var DEFAULT_JUDGE_PROMPT_NAME = "judge-create-agent";
|
|
19537
19716
|
var DEFAULT_JUDGE_MODEL = "gpt-5-mini";
|
|
@@ -19581,16 +19760,16 @@ async function readJsonFile(filePath) {
|
|
|
19581
19760
|
return JSON.parse(content);
|
|
19582
19761
|
}
|
|
19583
19762
|
async function writeJsonFile(filePath, value) {
|
|
19584
|
-
await fs14.mkdir(
|
|
19763
|
+
await fs14.mkdir(path23.dirname(filePath), { recursive: true });
|
|
19585
19764
|
await fs14.writeFile(filePath, `${JSON.stringify(value, null, 2)}
|
|
19586
19765
|
`, "utf8");
|
|
19587
19766
|
}
|
|
19588
19767
|
async function loadCaseById(caseId, casesDir) {
|
|
19589
|
-
const filePath =
|
|
19768
|
+
const filePath = path23.join(casesDir, `${caseId}.json`);
|
|
19590
19769
|
return parseCreateAgentCase(await readJsonFile(filePath));
|
|
19591
19770
|
}
|
|
19592
19771
|
async function loadSet(setName, setsDir) {
|
|
19593
|
-
const filePath =
|
|
19772
|
+
const filePath = path23.join(setsDir, `${setName}.json`);
|
|
19594
19773
|
const raw = await readJsonFile(filePath);
|
|
19595
19774
|
if (!Array.isArray(raw) || raw.some((item) => typeof item !== "string")) {
|
|
19596
19775
|
throw new Error(`Benchmark set ${setName} must be a JSON array of case IDs.`);
|
|
@@ -19678,13 +19857,13 @@ async function captureCreatedApprovals(api, approvals2) {
|
|
|
19678
19857
|
);
|
|
19679
19858
|
}
|
|
19680
19859
|
function resultRunDir(artifactsDir, testCase, runId) {
|
|
19681
|
-
return
|
|
19860
|
+
return path23.join(artifactsDir, "runs", `${testCase.id}-${runId}`);
|
|
19682
19861
|
}
|
|
19683
19862
|
function resultJsonPath(artifactsDir, testCase, runId) {
|
|
19684
|
-
return
|
|
19863
|
+
return path23.join(resultRunDir(artifactsDir, testCase, runId), "result.json");
|
|
19685
19864
|
}
|
|
19686
19865
|
function reportMarkdownPath(artifactsDir, testCase, runId) {
|
|
19687
|
-
return
|
|
19866
|
+
return path23.join(resultRunDir(artifactsDir, testCase, runId), "report.md");
|
|
19688
19867
|
}
|
|
19689
19868
|
function averageJudgeScore(judge) {
|
|
19690
19869
|
if (!judge || judge.status !== "completed") return null;
|
|
@@ -20093,7 +20272,7 @@ async function executeBenchmarkCase(caseId, opts) {
|
|
|
20093
20272
|
const jsonPath = resultJsonPath(artifactsDir, testCase, runDetail.run.id);
|
|
20094
20273
|
const markdownPath = reportMarkdownPath(artifactsDir, testCase, runDetail.run.id);
|
|
20095
20274
|
await writeJsonFile(jsonPath, provisionalResult);
|
|
20096
|
-
await fs14.mkdir(
|
|
20275
|
+
await fs14.mkdir(path23.dirname(markdownPath), { recursive: true });
|
|
20097
20276
|
await fs14.writeFile(markdownPath, buildMarkdownReport(provisionalResult), "utf8");
|
|
20098
20277
|
return provisionalResult;
|
|
20099
20278
|
}
|
|
@@ -20116,7 +20295,7 @@ async function rescoreStoredResult(resultPath, opts) {
|
|
|
20116
20295
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
20117
20296
|
}
|
|
20118
20297
|
await writeJsonFile(resultPath, result);
|
|
20119
|
-
await fs14.writeFile(
|
|
20298
|
+
await fs14.writeFile(path23.join(path23.dirname(resultPath), "report.md"), buildMarkdownReport(result), "utf8");
|
|
20120
20299
|
return result;
|
|
20121
20300
|
}
|
|
20122
20301
|
function printBenchmarkSummary(result, json = false) {
|
|
@@ -20185,7 +20364,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20185
20364
|
addCommonClientOptions(
|
|
20186
20365
|
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
20366
|
try {
|
|
20188
|
-
const result = await rescoreStoredResult(
|
|
20367
|
+
const result = await rescoreStoredResult(path23.resolve(resultPath), opts);
|
|
20189
20368
|
printBenchmarkSummary(result, Boolean(opts.json));
|
|
20190
20369
|
} catch (error) {
|
|
20191
20370
|
handleCommandError(error);
|
|
@@ -20195,11 +20374,11 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20195
20374
|
addCommonClientOptions(
|
|
20196
20375
|
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
20376
|
try {
|
|
20198
|
-
const result = await readJsonFile(
|
|
20377
|
+
const result = await readJsonFile(path23.resolve(resultPath));
|
|
20199
20378
|
const sync = await syncResultToLangfuse(result, { queueId: asString6(opts.queueId) });
|
|
20200
20379
|
result.langfuse.scoreSync = sync.scoreSync;
|
|
20201
20380
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
20202
|
-
await writeJsonFile(
|
|
20381
|
+
await writeJsonFile(path23.resolve(resultPath), result);
|
|
20203
20382
|
printOutput({
|
|
20204
20383
|
caseId: result.case.id,
|
|
20205
20384
|
runId: result.runDetail.run.id,
|
|
@@ -20215,7 +20394,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
20215
20394
|
addCommonClientOptions(
|
|
20216
20395
|
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
20396
|
try {
|
|
20218
|
-
const result = await readJsonFile(
|
|
20397
|
+
const result = await readJsonFile(path23.resolve(resultPath));
|
|
20219
20398
|
if (opts.markdown) {
|
|
20220
20399
|
process.stdout.write(buildMarkdownReport(result));
|
|
20221
20400
|
return;
|
|
@@ -20249,7 +20428,7 @@ function createProgram() {
|
|
|
20249
20428
|
});
|
|
20250
20429
|
loadRudderEnvFile(options.config);
|
|
20251
20430
|
});
|
|
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);
|
|
20431
|
+
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
20432
|
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
20433
|
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
20434
|
await doctor(opts);
|