@rudderhq/cli 0.4.6-canary.10 → 0.4.6-canary.12
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 +1865 -729
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9,6 +9,20 @@ var __export = (target, all) => {
|
|
|
9
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
+
// ../packages/shared/dist/browser-shortcuts.js
|
|
13
|
+
var init_browser_shortcuts = __esm({
|
|
14
|
+
"../packages/shared/dist/browser-shortcuts.js"() {
|
|
15
|
+
"use strict";
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
// ../packages/shared/dist/chat-inline-visuals.js
|
|
20
|
+
var init_chat_inline_visuals = __esm({
|
|
21
|
+
"../packages/shared/dist/chat-inline-visuals.js"() {
|
|
22
|
+
"use strict";
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
12
26
|
// ../packages/shared/dist/project-mentions.js
|
|
13
27
|
var init_project_mentions = __esm({
|
|
14
28
|
"../packages/shared/dist/project-mentions.js"() {
|
|
@@ -614,8 +628,413 @@ var init_custom_integration = __esm({
|
|
|
614
628
|
}
|
|
615
629
|
});
|
|
616
630
|
|
|
617
|
-
// ../packages/shared/dist/validators/
|
|
631
|
+
// ../packages/shared/dist/validators/chat.js
|
|
618
632
|
import { z as z2 } from "zod";
|
|
633
|
+
var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, chatGenerationStatusSchema, chatGenerationControlStateSchema, chatQueueDeliveryIntentSchema, chatControlDispositionSchema, chatProviderControlDispositionSchema, chatControlActionKindSchema, chatGenerationEventKindSchema, chatTerminalOutboxStatusSchema, chatQueuedMessageStatusSchema, chatControlActionIdSchema, chatBodyHashSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, forkChatConversationSchema, addChatMessageSchema, chatQueuedMessagePayloadSchema, createChatQueuedMessageSchema, updateChatQueuedMessageSchema, cancelChatQueuedMessageSchema, steerChatQueuedMessageSchema, stopChatGenerationSchema, chatClientCheckpointSchema, appendChatGenerationEventSchema, chatRichReferenceDisplaySchema, chatIssueIdentifierSchema, chatAskUserIdentifierSchema, chatAskUserOptionSchema, chatAskUserQuestionSchema, chatAskUserRequestSchema, chatIssueRichReferenceSchema, chatIssueCommentRichReferenceSchema, chatRichReferenceSchema, chatRichReferencesSchema, chatAutomationCreateSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema, updateMessengerThreadUserStateSchema, createMessengerCustomGroupSchema, createMessengerCustomGroupWithEntriesSchema, updateMessengerCustomGroupSchema, reorderMessengerCustomGroupsSchema, assignMessengerCustomGroupEntrySchema, reorderMessengerCustomGroupEntriesSchema;
|
|
634
|
+
var init_chat = __esm({
|
|
635
|
+
"../packages/shared/dist/validators/chat.js"() {
|
|
636
|
+
"use strict";
|
|
637
|
+
init_constants();
|
|
638
|
+
chatConversationStatusSchema = z2.enum(CHAT_CONVERSATION_STATUSES);
|
|
639
|
+
chatIssueCreationModeSchema = z2.enum(CHAT_ISSUE_CREATION_MODES);
|
|
640
|
+
chatMessageRoleSchema = z2.enum(CHAT_MESSAGE_ROLES);
|
|
641
|
+
chatMessageKindSchema = z2.enum(CHAT_MESSAGE_KINDS);
|
|
642
|
+
chatMessageStatusSchema = z2.enum(CHAT_MESSAGE_STATUSES);
|
|
643
|
+
chatContextEntityTypeSchema = z2.enum(CHAT_CONTEXT_ENTITY_TYPES);
|
|
644
|
+
chatGenerationStatusSchema = z2.enum([
|
|
645
|
+
"starting",
|
|
646
|
+
"active",
|
|
647
|
+
"running",
|
|
648
|
+
"tool_busy",
|
|
649
|
+
"closing",
|
|
650
|
+
"stop_requested",
|
|
651
|
+
"stopping",
|
|
652
|
+
"completed",
|
|
653
|
+
"failed",
|
|
654
|
+
"stopped",
|
|
655
|
+
"aborted",
|
|
656
|
+
"interrupted_unverified",
|
|
657
|
+
"control_lost"
|
|
658
|
+
]);
|
|
659
|
+
chatGenerationControlStateSchema = z2.enum([
|
|
660
|
+
"unregistered",
|
|
661
|
+
"ready",
|
|
662
|
+
"stopping",
|
|
663
|
+
"terminal",
|
|
664
|
+
"control_lost"
|
|
665
|
+
]);
|
|
666
|
+
chatQueueDeliveryIntentSchema = z2.enum(["queue", "steer"]);
|
|
667
|
+
chatControlDispositionSchema = z2.enum([
|
|
668
|
+
"pending",
|
|
669
|
+
"accepted_current",
|
|
670
|
+
"acceptance_unknown",
|
|
671
|
+
"reconciled_current",
|
|
672
|
+
"continuation_pending",
|
|
673
|
+
"waiting_safe_boundary",
|
|
674
|
+
"running_next",
|
|
675
|
+
"delivered",
|
|
676
|
+
"stop_requested",
|
|
677
|
+
"stopping",
|
|
678
|
+
"stopped",
|
|
679
|
+
"interrupted_unverified",
|
|
680
|
+
"cancellation_unverified",
|
|
681
|
+
"control_lost",
|
|
682
|
+
"failed_actionable",
|
|
683
|
+
"cancelled"
|
|
684
|
+
]);
|
|
685
|
+
chatProviderControlDispositionSchema = z2.enum([
|
|
686
|
+
"not_sent",
|
|
687
|
+
"sent",
|
|
688
|
+
"acknowledged",
|
|
689
|
+
"rejected",
|
|
690
|
+
"timed_out",
|
|
691
|
+
"connection_lost",
|
|
692
|
+
"waiting_safe_boundary",
|
|
693
|
+
"unverified"
|
|
694
|
+
]);
|
|
695
|
+
chatControlActionKindSchema = z2.enum(["stop", "steer"]);
|
|
696
|
+
chatGenerationEventKindSchema = z2.enum([
|
|
697
|
+
"generation_started",
|
|
698
|
+
"runtime_output",
|
|
699
|
+
"assistant_delta",
|
|
700
|
+
"transcript",
|
|
701
|
+
"client_checkpoint",
|
|
702
|
+
"steer_requested",
|
|
703
|
+
"steer_provider_sent",
|
|
704
|
+
"steer_acknowledged",
|
|
705
|
+
"continuation_scheduled",
|
|
706
|
+
"stop_requested",
|
|
707
|
+
"output_cutoff",
|
|
708
|
+
"runtime_terminal",
|
|
709
|
+
"late_output_dropped",
|
|
710
|
+
"terminal_projection_requested",
|
|
711
|
+
"terminal_projected"
|
|
712
|
+
]);
|
|
713
|
+
chatTerminalOutboxStatusSchema = z2.enum([
|
|
714
|
+
"pending",
|
|
715
|
+
"claimed",
|
|
716
|
+
"retry_wait",
|
|
717
|
+
"projected",
|
|
718
|
+
"failed_actionable"
|
|
719
|
+
]);
|
|
720
|
+
chatQueuedMessageStatusSchema = z2.enum([
|
|
721
|
+
"queued",
|
|
722
|
+
"steer_pending",
|
|
723
|
+
"accepted_current",
|
|
724
|
+
"acceptance_unknown",
|
|
725
|
+
"reconciled_current",
|
|
726
|
+
"continuation_pending",
|
|
727
|
+
"running_next",
|
|
728
|
+
"delivered",
|
|
729
|
+
"failed_actionable",
|
|
730
|
+
"steered",
|
|
731
|
+
"dequeue_claimed",
|
|
732
|
+
"running",
|
|
733
|
+
"completed",
|
|
734
|
+
"cancelled",
|
|
735
|
+
"failed"
|
|
736
|
+
]);
|
|
737
|
+
chatControlActionIdSchema = z2.string().uuid();
|
|
738
|
+
chatBodyHashSchema = z2.string().regex(/^[a-f0-9]{64}$/i, "Expected a SHA-256 body hash");
|
|
739
|
+
createChatContextLinkSchema = z2.object({
|
|
740
|
+
entityType: chatContextEntityTypeSchema,
|
|
741
|
+
entityId: z2.string().min(1),
|
|
742
|
+
metadata: z2.record(z2.unknown()).optional().nullable()
|
|
743
|
+
});
|
|
744
|
+
createChatConversationSchema = z2.object({
|
|
745
|
+
title: z2.string().trim().min(1).max(200).optional(),
|
|
746
|
+
summary: z2.string().trim().max(5e3).optional().nullable(),
|
|
747
|
+
preferredAgentId: z2.string().uuid().optional().nullable(),
|
|
748
|
+
issueCreationMode: chatIssueCreationModeSchema.optional(),
|
|
749
|
+
planMode: z2.boolean().optional(),
|
|
750
|
+
contextLinks: z2.array(createChatContextLinkSchema).optional().default([])
|
|
751
|
+
});
|
|
752
|
+
setChatProjectContextSchema = z2.object({
|
|
753
|
+
projectId: z2.string().uuid().optional().nullable()
|
|
754
|
+
});
|
|
755
|
+
updateChatConversationSchema = createChatConversationSchema.partial().extend({
|
|
756
|
+
status: chatConversationStatusSchema.optional(),
|
|
757
|
+
routedAgentId: z2.string().uuid().optional().nullable(),
|
|
758
|
+
primaryIssueId: z2.string().uuid().optional().nullable(),
|
|
759
|
+
resolvedAt: z2.string().datetime().optional().nullable()
|
|
760
|
+
});
|
|
761
|
+
forkChatConversationSchema = z2.object({
|
|
762
|
+
sourceMessageId: z2.string().uuid().optional().nullable(),
|
|
763
|
+
title: z2.string().trim().min(1).max(200).optional()
|
|
764
|
+
});
|
|
765
|
+
addChatMessageSchema = z2.object({
|
|
766
|
+
body: z2.string().trim().min(1).max(2e4),
|
|
767
|
+
editUserMessageId: z2.string().uuid().optional().nullable(),
|
|
768
|
+
queuedMessageId: z2.string().uuid().optional().nullable()
|
|
769
|
+
});
|
|
770
|
+
chatQueuedMessagePayloadSchema = z2.object({
|
|
771
|
+
body: z2.string().trim().min(1).max(2e4),
|
|
772
|
+
attachmentIds: z2.array(z2.string().uuid()).optional().default([]),
|
|
773
|
+
projectId: z2.string().uuid().optional().nullable(),
|
|
774
|
+
skillRefs: z2.array(z2.string().trim().min(1).max(240)).optional().default([]),
|
|
775
|
+
accessMode: z2.string().trim().min(1).max(120).optional().nullable(),
|
|
776
|
+
model: z2.string().trim().min(1).max(120).optional().nullable(),
|
|
777
|
+
effort: z2.string().trim().min(1).max(120).optional().nullable(),
|
|
778
|
+
metadata: z2.record(z2.unknown()).optional().nullable()
|
|
779
|
+
});
|
|
780
|
+
createChatQueuedMessageSchema = z2.object({
|
|
781
|
+
clientMutationId: z2.string().trim().min(1).max(120),
|
|
782
|
+
expectedGenerationId: z2.string().uuid().optional().nullable(),
|
|
783
|
+
payload: chatQueuedMessagePayloadSchema
|
|
784
|
+
});
|
|
785
|
+
updateChatQueuedMessageSchema = z2.object({
|
|
786
|
+
version: z2.number().int().positive(),
|
|
787
|
+
payload: chatQueuedMessagePayloadSchema
|
|
788
|
+
});
|
|
789
|
+
cancelChatQueuedMessageSchema = z2.object({
|
|
790
|
+
version: z2.number().int().positive().optional()
|
|
791
|
+
});
|
|
792
|
+
steerChatQueuedMessageSchema = z2.object({
|
|
793
|
+
expectedActiveGenerationId: z2.string().uuid().optional().nullable(),
|
|
794
|
+
controlActionId: chatControlActionIdSchema.optional(),
|
|
795
|
+
expectedAttemptEpoch: z2.number().int().nonnegative().optional(),
|
|
796
|
+
expectedControlVersion: z2.number().int().nonnegative().optional(),
|
|
797
|
+
lastCommittedRenderSeq: z2.number().int().nonnegative().optional(),
|
|
798
|
+
renderedBodyHash: chatBodyHashSchema.optional()
|
|
799
|
+
}).superRefine((value, ctx) => {
|
|
800
|
+
const hasGenerationTarget = Boolean(value.expectedActiveGenerationId);
|
|
801
|
+
const hasFenceVersion = value.expectedAttemptEpoch !== void 0 || value.expectedControlVersion !== void 0;
|
|
802
|
+
if (value.lastCommittedRenderSeq === void 0 !== (value.renderedBodyHash === void 0)) {
|
|
803
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["renderedBodyHash"], message: "Steer render sequence and body hash must be supplied together" });
|
|
804
|
+
}
|
|
805
|
+
if (!hasFenceVersion && (!value.controlActionId || !hasGenerationTarget))
|
|
806
|
+
return;
|
|
807
|
+
if (!value.controlActionId) {
|
|
808
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["controlActionId"], message: "Required for durable Steer control" });
|
|
809
|
+
}
|
|
810
|
+
if (!value.expectedActiveGenerationId) {
|
|
811
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedActiveGenerationId"], message: "Required for durable Steer control" });
|
|
812
|
+
}
|
|
813
|
+
if (value.expectedAttemptEpoch === void 0) {
|
|
814
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedAttemptEpoch"], message: "Required for durable Steer control" });
|
|
815
|
+
}
|
|
816
|
+
if (value.expectedControlVersion === void 0) {
|
|
817
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedControlVersion"], message: "Required for durable Steer control" });
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
stopChatGenerationSchema = z2.object({
|
|
821
|
+
controlActionId: chatControlActionIdSchema.optional(),
|
|
822
|
+
expectedGenerationId: z2.string().uuid().optional(),
|
|
823
|
+
expectedAttemptEpoch: z2.number().int().nonnegative().optional(),
|
|
824
|
+
expectedControlVersion: z2.number().int().nonnegative().optional(),
|
|
825
|
+
lastCommittedRenderSeq: z2.number().int().nonnegative().optional(),
|
|
826
|
+
renderedBodyHash: chatBodyHashSchema.optional()
|
|
827
|
+
}).superRefine((value, ctx) => {
|
|
828
|
+
const generationFenceStarted = value.expectedGenerationId !== void 0 || value.expectedAttemptEpoch !== void 0 || value.expectedControlVersion !== void 0;
|
|
829
|
+
if (generationFenceStarted) {
|
|
830
|
+
if (!value.expectedGenerationId) {
|
|
831
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedGenerationId"], message: "Required for fenced Stop control" });
|
|
832
|
+
}
|
|
833
|
+
if (value.expectedAttemptEpoch === void 0) {
|
|
834
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedAttemptEpoch"], message: "Required for fenced Stop control" });
|
|
835
|
+
}
|
|
836
|
+
if (value.expectedControlVersion === void 0) {
|
|
837
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["expectedControlVersion"], message: "Required for fenced Stop control" });
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
if (value.lastCommittedRenderSeq === void 0 !== (value.renderedBodyHash === void 0)) {
|
|
841
|
+
ctx.addIssue({ code: z2.ZodIssueCode.custom, path: ["renderedBodyHash"], message: "Stop render sequence and body hash must be supplied together" });
|
|
842
|
+
}
|
|
843
|
+
});
|
|
844
|
+
chatClientCheckpointSchema = z2.object({
|
|
845
|
+
generationId: z2.string().uuid(),
|
|
846
|
+
attemptEpoch: z2.number().int().positive(),
|
|
847
|
+
generationSeq: z2.number().int().nonnegative(),
|
|
848
|
+
renderedBodyHash: chatBodyHashSchema
|
|
849
|
+
});
|
|
850
|
+
appendChatGenerationEventSchema = z2.object({
|
|
851
|
+
generationId: z2.string().uuid(),
|
|
852
|
+
generationSeq: z2.number().int().nonnegative(),
|
|
853
|
+
attemptEpoch: z2.number().int().positive(),
|
|
854
|
+
eventKind: chatGenerationEventKindSchema,
|
|
855
|
+
payload: z2.record(z2.unknown()).default({}),
|
|
856
|
+
bodyOffset: z2.number().int().nonnegative().optional().nullable(),
|
|
857
|
+
bodyLength: z2.number().int().nonnegative().optional().nullable(),
|
|
858
|
+
assistantMessageId: z2.string().uuid().optional().nullable(),
|
|
859
|
+
runId: z2.string().uuid().optional().nullable(),
|
|
860
|
+
controlActionId: chatControlActionIdSchema.optional().nullable(),
|
|
861
|
+
queueItemId: z2.string().uuid().optional().nullable()
|
|
862
|
+
});
|
|
863
|
+
chatRichReferenceDisplaySchema = z2.enum(["card", "inline"]);
|
|
864
|
+
chatIssueIdentifierSchema = z2.string().trim().min(1).max(64).regex(/^[A-Z0-9][A-Z0-9-]*$/i);
|
|
865
|
+
chatAskUserIdentifierSchema = z2.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/);
|
|
866
|
+
chatAskUserOptionSchema = z2.object({
|
|
867
|
+
id: chatAskUserIdentifierSchema,
|
|
868
|
+
label: z2.string().trim().min(1).max(80),
|
|
869
|
+
description: z2.string().trim().min(1).max(220).optional(),
|
|
870
|
+
recommended: z2.boolean().optional()
|
|
871
|
+
});
|
|
872
|
+
chatAskUserQuestionSchema = z2.object({
|
|
873
|
+
id: chatAskUserIdentifierSchema,
|
|
874
|
+
header: z2.string().trim().min(1).max(32).optional(),
|
|
875
|
+
question: z2.string().trim().min(1).max(240),
|
|
876
|
+
options: z2.array(chatAskUserOptionSchema).min(2).max(3),
|
|
877
|
+
selectionMode: z2.enum(["single", "multiple"]).optional(),
|
|
878
|
+
allowFreeform: z2.boolean().optional()
|
|
879
|
+
}).superRefine((question, ctx) => {
|
|
880
|
+
const optionIds = /* @__PURE__ */ new Set();
|
|
881
|
+
question.options.forEach((option, index) => {
|
|
882
|
+
if (optionIds.has(option.id)) {
|
|
883
|
+
ctx.addIssue({
|
|
884
|
+
code: z2.ZodIssueCode.custom,
|
|
885
|
+
message: "Option ids must be unique within each question",
|
|
886
|
+
path: ["options", index, "id"]
|
|
887
|
+
});
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
optionIds.add(option.id);
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
chatAskUserRequestSchema = z2.object({
|
|
894
|
+
questions: z2.array(chatAskUserQuestionSchema).min(1).max(3)
|
|
895
|
+
}).superRefine((request, ctx) => {
|
|
896
|
+
const questionIds = /* @__PURE__ */ new Set();
|
|
897
|
+
request.questions.forEach((question, index) => {
|
|
898
|
+
if (questionIds.has(question.id)) {
|
|
899
|
+
ctx.addIssue({
|
|
900
|
+
code: z2.ZodIssueCode.custom,
|
|
901
|
+
message: "Question ids must be unique within requestUserInput",
|
|
902
|
+
path: ["questions", index, "id"]
|
|
903
|
+
});
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
questionIds.add(question.id);
|
|
907
|
+
});
|
|
908
|
+
});
|
|
909
|
+
chatIssueRichReferenceSchema = z2.object({
|
|
910
|
+
type: z2.literal("issue"),
|
|
911
|
+
issueId: z2.string().uuid().optional(),
|
|
912
|
+
identifier: chatIssueIdentifierSchema.optional(),
|
|
913
|
+
display: chatRichReferenceDisplaySchema.optional()
|
|
914
|
+
}).refine((value) => Boolean(value.issueId || value.identifier), {
|
|
915
|
+
message: "issueId or identifier is required"
|
|
916
|
+
});
|
|
917
|
+
chatIssueCommentRichReferenceSchema = z2.object({
|
|
918
|
+
type: z2.literal("issue_comment"),
|
|
919
|
+
issueId: z2.string().uuid().optional(),
|
|
920
|
+
identifier: chatIssueIdentifierSchema.optional(),
|
|
921
|
+
commentId: z2.string().uuid(),
|
|
922
|
+
display: chatRichReferenceDisplaySchema.optional()
|
|
923
|
+
}).refine((value) => Boolean(value.issueId || value.identifier), {
|
|
924
|
+
message: "issueId or identifier is required"
|
|
925
|
+
});
|
|
926
|
+
chatRichReferenceSchema = z2.union([
|
|
927
|
+
chatIssueRichReferenceSchema,
|
|
928
|
+
chatIssueCommentRichReferenceSchema
|
|
929
|
+
]);
|
|
930
|
+
chatRichReferencesSchema = z2.array(chatRichReferenceSchema).max(5);
|
|
931
|
+
chatAutomationCreateSchema = z2.object({
|
|
932
|
+
title: z2.string().trim().min(1).max(200),
|
|
933
|
+
instructions: z2.string().trim().max(2e4).optional().nullable(),
|
|
934
|
+
description: z2.string().trim().max(2e4).optional().nullable(),
|
|
935
|
+
projectId: z2.string().uuid().optional().nullable(),
|
|
936
|
+
goalId: z2.string().uuid().optional().nullable(),
|
|
937
|
+
parentIssueId: z2.string().uuid().optional().nullable(),
|
|
938
|
+
priority: z2.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
939
|
+
status: z2.enum(AUTOMATION_STATUSES).optional().default("active"),
|
|
940
|
+
concurrencyPolicy: z2.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
|
|
941
|
+
catchUpPolicy: z2.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed"),
|
|
942
|
+
outputMode: z2.enum(AUTOMATION_OUTPUT_MODES).optional().default("track_issue"),
|
|
943
|
+
schedule: z2.object({
|
|
944
|
+
cronExpression: z2.string().trim().min(1),
|
|
945
|
+
timezone: z2.string().trim().min(1),
|
|
946
|
+
label: z2.string().trim().max(120).optional().nullable(),
|
|
947
|
+
enabled: z2.boolean().optional().default(true)
|
|
948
|
+
})
|
|
949
|
+
}).transform(({ description, instructions, ...value }) => ({
|
|
950
|
+
...value,
|
|
951
|
+
instructions: instructions === void 0 ? description : instructions
|
|
952
|
+
}));
|
|
953
|
+
createChatAttachmentMetadataSchema = z2.object({
|
|
954
|
+
messageId: z2.string().uuid()
|
|
955
|
+
});
|
|
956
|
+
chatIssueProposalSchema = z2.object({
|
|
957
|
+
title: z2.string().trim().min(1).max(200),
|
|
958
|
+
description: z2.string().trim().min(1).max(2e4),
|
|
959
|
+
status: z2.enum(ISSUE_STATUSES).optional().default("todo"),
|
|
960
|
+
priority: z2.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
961
|
+
projectId: z2.string().uuid().optional().nullable(),
|
|
962
|
+
goalId: z2.string().uuid().optional().nullable(),
|
|
963
|
+
parentId: z2.string().uuid().optional().nullable(),
|
|
964
|
+
assigneeAgentId: z2.string().uuid().optional().nullable(),
|
|
965
|
+
assigneeUserId: z2.string().trim().optional().nullable(),
|
|
966
|
+
assigneeUnassignedReason: z2.string().trim().min(1).max(500).optional().nullable(),
|
|
967
|
+
reviewerAgentId: z2.string().uuid().optional().nullable(),
|
|
968
|
+
reviewerUserId: z2.string().trim().optional().nullable(),
|
|
969
|
+
labelIds: z2.array(z2.string().uuid()).optional()
|
|
970
|
+
}).superRefine((proposal, ctx) => {
|
|
971
|
+
const hasAssignee = Boolean(proposal.assigneeAgentId || proposal.assigneeUserId);
|
|
972
|
+
const hasUnassignedReason = Boolean(proposal.assigneeUnassignedReason?.trim());
|
|
973
|
+
if (hasAssignee && hasUnassignedReason) {
|
|
974
|
+
ctx.addIssue({
|
|
975
|
+
code: z2.ZodIssueCode.custom,
|
|
976
|
+
message: "Issue proposals with an assignee must not also declare an unassigned reason",
|
|
977
|
+
path: ["assigneeUnassignedReason"]
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
if (!hasAssignee && !hasUnassignedReason) {
|
|
981
|
+
ctx.addIssue({
|
|
982
|
+
code: z2.ZodIssueCode.custom,
|
|
983
|
+
message: "Issue proposals without an owner must include assigneeUnassignedReason",
|
|
984
|
+
path: ["assigneeUnassignedReason"]
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
convertChatToIssueSchema = z2.object({
|
|
989
|
+
messageId: z2.string().uuid().optional().nullable(),
|
|
990
|
+
proposal: chatIssueProposalSchema.optional()
|
|
991
|
+
});
|
|
992
|
+
chatOperationProposalSchema = z2.object({
|
|
993
|
+
targetType: z2.enum(["organization", "agent"]),
|
|
994
|
+
targetId: z2.string().min(1),
|
|
995
|
+
summary: z2.string().trim().min(1).max(500),
|
|
996
|
+
patch: z2.record(z2.unknown())
|
|
997
|
+
});
|
|
998
|
+
resolveChatOperationProposalSchema = z2.object({
|
|
999
|
+
action: z2.enum(["approve", "reject", "requestRevision"]),
|
|
1000
|
+
decisionNote: z2.string().trim().max(5e3).optional().nullable()
|
|
1001
|
+
});
|
|
1002
|
+
updateChatConversationUserStateSchema = z2.object({
|
|
1003
|
+
pinned: z2.boolean().optional(),
|
|
1004
|
+
unread: z2.boolean().optional()
|
|
1005
|
+
});
|
|
1006
|
+
updateMessengerThreadUserStateSchema = z2.object({
|
|
1007
|
+
pinned: z2.boolean().optional()
|
|
1008
|
+
});
|
|
1009
|
+
createMessengerCustomGroupSchema = z2.object({
|
|
1010
|
+
name: z2.string().trim().min(1).max(80),
|
|
1011
|
+
icon: z2.string().trim().min(1).max(24).optional().nullable()
|
|
1012
|
+
});
|
|
1013
|
+
createMessengerCustomGroupWithEntriesSchema = createMessengerCustomGroupSchema.extend({
|
|
1014
|
+
threadKeys: z2.array(z2.string().trim().min(1).max(240)).min(1).max(50),
|
|
1015
|
+
autoGenerateName: z2.boolean().optional()
|
|
1016
|
+
});
|
|
1017
|
+
updateMessengerCustomGroupSchema = z2.object({
|
|
1018
|
+
name: z2.string().trim().min(1).max(80).optional(),
|
|
1019
|
+
icon: z2.string().trim().min(1).max(24).optional().nullable(),
|
|
1020
|
+
collapsed: z2.boolean().optional(),
|
|
1021
|
+
pinned: z2.boolean().optional(),
|
|
1022
|
+
sortOrder: z2.number().int().min(0).optional()
|
|
1023
|
+
});
|
|
1024
|
+
reorderMessengerCustomGroupsSchema = z2.object({
|
|
1025
|
+
groupIds: z2.array(z2.string().uuid()).max(200)
|
|
1026
|
+
});
|
|
1027
|
+
assignMessengerCustomGroupEntrySchema = z2.object({
|
|
1028
|
+
threadKey: z2.string().trim().min(1).max(240)
|
|
1029
|
+
});
|
|
1030
|
+
reorderMessengerCustomGroupEntriesSchema = z2.object({
|
|
1031
|
+
threadKeys: z2.array(z2.string().trim().min(1).max(240)).max(500)
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
});
|
|
1035
|
+
|
|
1036
|
+
// ../packages/shared/dist/validators/instance.js
|
|
1037
|
+
import { z as z3 } from "zod";
|
|
619
1038
|
var DEFAULT_INSTANCE_BROWSER_SETTINGS, instanceBrowserSettingsSchema, patchInstanceBrowserSettingsSchema, instanceLocaleSchema, instanceGeneralSettingsSchema, patchInstanceGeneralSettingsSchema, instanceNotificationSettingsSchema, patchInstanceNotificationSettingsSchema, OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH, operatorProfileSettingsSchema, patchOperatorProfileSettingsSchema, KEYBOARD_SHORTCUT_ACTION_IDS, keyboardShortcutActionIdSchema, keyboardShortcutBindingSchema, keyboardShortcutPreferenceSchema, keyboardShortcutSettingsSchema, instancePathPickerSelectionTypeSchema, instancePathPickerRequestSchema, instancePathPickerResultSchema;
|
|
620
1039
|
var init_instance = __esm({
|
|
621
1040
|
"../packages/shared/dist/validators/instance.js"() {
|
|
@@ -624,32 +1043,32 @@ var init_instance = __esm({
|
|
|
624
1043
|
enabled: true,
|
|
625
1044
|
openLinksIn: "built_in"
|
|
626
1045
|
};
|
|
627
|
-
instanceBrowserSettingsSchema =
|
|
628
|
-
enabled:
|
|
629
|
-
openLinksIn:
|
|
1046
|
+
instanceBrowserSettingsSchema = z3.object({
|
|
1047
|
+
enabled: z3.boolean().default(DEFAULT_INSTANCE_BROWSER_SETTINGS.enabled),
|
|
1048
|
+
openLinksIn: z3.enum(["built_in", "default_browser"]).default(DEFAULT_INSTANCE_BROWSER_SETTINGS.openLinksIn)
|
|
630
1049
|
}).strict();
|
|
631
|
-
patchInstanceBrowserSettingsSchema =
|
|
632
|
-
enabled:
|
|
633
|
-
openLinksIn:
|
|
1050
|
+
patchInstanceBrowserSettingsSchema = z3.object({
|
|
1051
|
+
enabled: z3.boolean().optional(),
|
|
1052
|
+
openLinksIn: z3.enum(["built_in", "default_browser"]).optional()
|
|
634
1053
|
}).strict();
|
|
635
|
-
instanceLocaleSchema =
|
|
636
|
-
instanceGeneralSettingsSchema =
|
|
637
|
-
censorUsernameInLogs:
|
|
638
|
-
showDeveloperDiagnostics:
|
|
1054
|
+
instanceLocaleSchema = z3.enum(["en", "zh-CN"]);
|
|
1055
|
+
instanceGeneralSettingsSchema = z3.object({
|
|
1056
|
+
censorUsernameInLogs: z3.boolean().default(false),
|
|
1057
|
+
showDeveloperDiagnostics: z3.boolean().default(false),
|
|
639
1058
|
locale: instanceLocaleSchema.default("en")
|
|
640
1059
|
}).strict();
|
|
641
1060
|
patchInstanceGeneralSettingsSchema = instanceGeneralSettingsSchema.partial();
|
|
642
|
-
instanceNotificationSettingsSchema =
|
|
643
|
-
desktopInboxNotifications:
|
|
644
|
-
desktopDockBadge:
|
|
645
|
-
desktopIssueNotifications:
|
|
646
|
-
desktopChatNotifications:
|
|
1061
|
+
instanceNotificationSettingsSchema = z3.object({
|
|
1062
|
+
desktopInboxNotifications: z3.boolean().default(true),
|
|
1063
|
+
desktopDockBadge: z3.boolean().default(true),
|
|
1064
|
+
desktopIssueNotifications: z3.boolean().default(true),
|
|
1065
|
+
desktopChatNotifications: z3.boolean().default(true)
|
|
647
1066
|
}).strict();
|
|
648
1067
|
patchInstanceNotificationSettingsSchema = instanceNotificationSettingsSchema.partial();
|
|
649
1068
|
OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH = 8e3;
|
|
650
|
-
operatorProfileSettingsSchema =
|
|
651
|
-
nickname:
|
|
652
|
-
moreAboutYou:
|
|
1069
|
+
operatorProfileSettingsSchema = z3.object({
|
|
1070
|
+
nickname: z3.string().max(80).default(""),
|
|
1071
|
+
moreAboutYou: z3.string().max(OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH).default("")
|
|
653
1072
|
}).strict();
|
|
654
1073
|
patchOperatorProfileSettingsSchema = operatorProfileSettingsSchema.partial();
|
|
655
1074
|
KEYBOARD_SHORTCUT_ACTION_IDS = [
|
|
@@ -660,28 +1079,28 @@ var init_instance = __esm({
|
|
|
660
1079
|
"sidebar.toggle",
|
|
661
1080
|
"panel.toggle"
|
|
662
1081
|
];
|
|
663
|
-
keyboardShortcutActionIdSchema =
|
|
664
|
-
keyboardShortcutBindingSchema =
|
|
665
|
-
key:
|
|
666
|
-
code:
|
|
667
|
-
metaKey:
|
|
668
|
-
ctrlKey:
|
|
669
|
-
altKey:
|
|
670
|
-
shiftKey:
|
|
1082
|
+
keyboardShortcutActionIdSchema = z3.enum(KEYBOARD_SHORTCUT_ACTION_IDS);
|
|
1083
|
+
keyboardShortcutBindingSchema = z3.object({
|
|
1084
|
+
key: z3.string().trim().min(1).max(64),
|
|
1085
|
+
code: z3.string().trim().min(1).max(80).optional(),
|
|
1086
|
+
metaKey: z3.boolean().optional(),
|
|
1087
|
+
ctrlKey: z3.boolean().optional(),
|
|
1088
|
+
altKey: z3.boolean().optional(),
|
|
1089
|
+
shiftKey: z3.boolean().optional()
|
|
671
1090
|
}).strict();
|
|
672
|
-
keyboardShortcutPreferenceSchema =
|
|
1091
|
+
keyboardShortcutPreferenceSchema = z3.object({
|
|
673
1092
|
actionId: keyboardShortcutActionIdSchema,
|
|
674
|
-
bindings:
|
|
675
|
-
disabled:
|
|
1093
|
+
bindings: z3.array(keyboardShortcutBindingSchema).max(4).optional(),
|
|
1094
|
+
disabled: z3.boolean().optional()
|
|
676
1095
|
}).strict();
|
|
677
|
-
keyboardShortcutSettingsSchema =
|
|
678
|
-
shortcuts:
|
|
1096
|
+
keyboardShortcutSettingsSchema = z3.object({
|
|
1097
|
+
shortcuts: z3.array(keyboardShortcutPreferenceSchema).max(KEYBOARD_SHORTCUT_ACTION_IDS.length).default([])
|
|
679
1098
|
}).strict().superRefine((value, ctx) => {
|
|
680
1099
|
const seen = /* @__PURE__ */ new Set();
|
|
681
1100
|
value.shortcuts.forEach((shortcut, index) => {
|
|
682
1101
|
if (seen.has(shortcut.actionId)) {
|
|
683
1102
|
ctx.addIssue({
|
|
684
|
-
code:
|
|
1103
|
+
code: z3.ZodIssueCode.custom,
|
|
685
1104
|
message: `Duplicate shortcut action id: ${shortcut.actionId}`,
|
|
686
1105
|
path: ["shortcuts", index, "actionId"]
|
|
687
1106
|
});
|
|
@@ -690,43 +1109,43 @@ var init_instance = __esm({
|
|
|
690
1109
|
seen.add(shortcut.actionId);
|
|
691
1110
|
});
|
|
692
1111
|
});
|
|
693
|
-
instancePathPickerSelectionTypeSchema =
|
|
694
|
-
instancePathPickerRequestSchema =
|
|
1112
|
+
instancePathPickerSelectionTypeSchema = z3.enum(["file", "directory"]);
|
|
1113
|
+
instancePathPickerRequestSchema = z3.object({
|
|
695
1114
|
selectionType: instancePathPickerSelectionTypeSchema
|
|
696
1115
|
}).strict();
|
|
697
|
-
instancePathPickerResultSchema =
|
|
698
|
-
path:
|
|
699
|
-
cancelled:
|
|
1116
|
+
instancePathPickerResultSchema = z3.object({
|
|
1117
|
+
path: z3.string().nullable(),
|
|
1118
|
+
cancelled: z3.boolean()
|
|
700
1119
|
}).strict();
|
|
701
1120
|
}
|
|
702
1121
|
});
|
|
703
1122
|
|
|
704
1123
|
// ../packages/shared/dist/validators/budget.js
|
|
705
|
-
import { z as
|
|
1124
|
+
import { z as z4 } from "zod";
|
|
706
1125
|
var upsertBudgetPolicySchema, resolveBudgetIncidentSchema;
|
|
707
1126
|
var init_budget = __esm({
|
|
708
1127
|
"../packages/shared/dist/validators/budget.js"() {
|
|
709
1128
|
"use strict";
|
|
710
1129
|
init_constants();
|
|
711
|
-
upsertBudgetPolicySchema =
|
|
712
|
-
scopeType:
|
|
713
|
-
scopeId:
|
|
714
|
-
metric:
|
|
715
|
-
windowKind:
|
|
716
|
-
amount:
|
|
717
|
-
warnPercent:
|
|
718
|
-
hardStopEnabled:
|
|
719
|
-
notifyEnabled:
|
|
720
|
-
isActive:
|
|
1130
|
+
upsertBudgetPolicySchema = z4.object({
|
|
1131
|
+
scopeType: z4.enum(BUDGET_SCOPE_TYPES),
|
|
1132
|
+
scopeId: z4.string().uuid(),
|
|
1133
|
+
metric: z4.enum(BUDGET_METRICS).optional().default("billed_cents"),
|
|
1134
|
+
windowKind: z4.enum(BUDGET_WINDOW_KINDS).optional().default("calendar_month_utc"),
|
|
1135
|
+
amount: z4.number().int().nonnegative(),
|
|
1136
|
+
warnPercent: z4.number().int().min(1).max(99).optional().default(80),
|
|
1137
|
+
hardStopEnabled: z4.boolean().optional().default(true),
|
|
1138
|
+
notifyEnabled: z4.boolean().optional().default(true),
|
|
1139
|
+
isActive: z4.boolean().optional().default(true)
|
|
721
1140
|
});
|
|
722
|
-
resolveBudgetIncidentSchema =
|
|
723
|
-
action:
|
|
724
|
-
amount:
|
|
725
|
-
decisionNote:
|
|
1141
|
+
resolveBudgetIncidentSchema = z4.object({
|
|
1142
|
+
action: z4.enum(BUDGET_INCIDENT_RESOLUTION_ACTIONS),
|
|
1143
|
+
amount: z4.number().int().nonnegative().optional(),
|
|
1144
|
+
decisionNote: z4.string().optional().nullable()
|
|
726
1145
|
}).superRefine((value, ctx) => {
|
|
727
1146
|
if (value.action === "raise_budget_and_resume" && typeof value.amount !== "number") {
|
|
728
1147
|
ctx.addIssue({
|
|
729
|
-
code:
|
|
1148
|
+
code: z4.ZodIssueCode.custom,
|
|
730
1149
|
message: "amount is required when raising a budget",
|
|
731
1150
|
path: ["amount"]
|
|
732
1151
|
});
|
|
@@ -736,12 +1155,12 @@ var init_budget = __esm({
|
|
|
736
1155
|
});
|
|
737
1156
|
|
|
738
1157
|
// ../packages/shared/dist/validators/adapter-skills.js
|
|
739
|
-
import { z as
|
|
1158
|
+
import { z as z5 } from "zod";
|
|
740
1159
|
var agentSkillStateSchema, agentSkillOriginSchema, agentSkillSourceClassSchema, agentSkillSyncModeSchema, agentSkillEntrySchema, agentSkillSnapshotSchema, agentSkillSyncSchema, agentSkillEnableSchema;
|
|
741
1160
|
var init_adapter_skills = __esm({
|
|
742
1161
|
"../packages/shared/dist/validators/adapter-skills.js"() {
|
|
743
1162
|
"use strict";
|
|
744
|
-
agentSkillStateSchema =
|
|
1163
|
+
agentSkillStateSchema = z5.enum([
|
|
745
1164
|
"available",
|
|
746
1165
|
"configured",
|
|
747
1166
|
"installed",
|
|
@@ -749,302 +1168,60 @@ var init_adapter_skills = __esm({
|
|
|
749
1168
|
"stale",
|
|
750
1169
|
"external"
|
|
751
1170
|
]);
|
|
752
|
-
agentSkillOriginSchema =
|
|
1171
|
+
agentSkillOriginSchema = z5.preprocess((value) => {
|
|
753
1172
|
if (value === "company_managed")
|
|
754
1173
|
return "organization_managed";
|
|
755
1174
|
return value;
|
|
756
|
-
},
|
|
1175
|
+
}, z5.enum([
|
|
757
1176
|
"organization_managed",
|
|
758
1177
|
"user_installed",
|
|
759
1178
|
"external_unknown"
|
|
760
1179
|
]));
|
|
761
|
-
agentSkillSourceClassSchema =
|
|
1180
|
+
agentSkillSourceClassSchema = z5.enum([
|
|
762
1181
|
"bundled",
|
|
763
1182
|
"organization",
|
|
764
1183
|
"agent_home",
|
|
765
1184
|
"global",
|
|
766
1185
|
"adapter_home"
|
|
767
1186
|
]);
|
|
768
|
-
agentSkillSyncModeSchema =
|
|
1187
|
+
agentSkillSyncModeSchema = z5.enum([
|
|
769
1188
|
"unsupported",
|
|
770
1189
|
"persistent",
|
|
771
1190
|
"ephemeral"
|
|
772
1191
|
]);
|
|
773
|
-
agentSkillEntrySchema =
|
|
774
|
-
key:
|
|
775
|
-
selectionKey:
|
|
776
|
-
runtimeName:
|
|
777
|
-
description:
|
|
778
|
-
desired:
|
|
779
|
-
configurable:
|
|
780
|
-
alwaysEnabled:
|
|
781
|
-
managed:
|
|
1192
|
+
agentSkillEntrySchema = z5.object({
|
|
1193
|
+
key: z5.string().min(1),
|
|
1194
|
+
selectionKey: z5.string().min(1),
|
|
1195
|
+
runtimeName: z5.string().min(1).nullable(),
|
|
1196
|
+
description: z5.string().nullable().optional(),
|
|
1197
|
+
desired: z5.boolean(),
|
|
1198
|
+
configurable: z5.boolean(),
|
|
1199
|
+
alwaysEnabled: z5.boolean(),
|
|
1200
|
+
managed: z5.boolean(),
|
|
782
1201
|
state: agentSkillStateSchema,
|
|
783
1202
|
sourceClass: agentSkillSourceClassSchema,
|
|
784
1203
|
origin: agentSkillOriginSchema.optional(),
|
|
785
|
-
originLabel:
|
|
786
|
-
locationLabel:
|
|
787
|
-
readOnly:
|
|
788
|
-
sourcePath:
|
|
789
|
-
targetPath:
|
|
790
|
-
workspaceEditPath:
|
|
791
|
-
detail:
|
|
1204
|
+
originLabel: z5.string().nullable().optional(),
|
|
1205
|
+
locationLabel: z5.string().nullable().optional(),
|
|
1206
|
+
readOnly: z5.boolean().optional(),
|
|
1207
|
+
sourcePath: z5.string().nullable().optional(),
|
|
1208
|
+
targetPath: z5.string().nullable().optional(),
|
|
1209
|
+
workspaceEditPath: z5.string().nullable().optional(),
|
|
1210
|
+
detail: z5.string().nullable().optional()
|
|
792
1211
|
});
|
|
793
|
-
agentSkillSnapshotSchema =
|
|
794
|
-
agentRuntimeType:
|
|
795
|
-
supported:
|
|
1212
|
+
agentSkillSnapshotSchema = z5.object({
|
|
1213
|
+
agentRuntimeType: z5.string().min(1),
|
|
1214
|
+
supported: z5.boolean(),
|
|
796
1215
|
mode: agentSkillSyncModeSchema,
|
|
797
|
-
desiredSkills:
|
|
798
|
-
entries:
|
|
799
|
-
warnings:
|
|
800
|
-
});
|
|
801
|
-
agentSkillSyncSchema = z4.object({
|
|
802
|
-
desiredSkills: z4.array(z4.string().min(1))
|
|
803
|
-
});
|
|
804
|
-
agentSkillEnableSchema = z4.object({
|
|
805
|
-
skills: z4.array(z4.string().min(1)).min(1)
|
|
806
|
-
});
|
|
807
|
-
}
|
|
808
|
-
});
|
|
809
|
-
|
|
810
|
-
// ../packages/shared/dist/validators/chat.js
|
|
811
|
-
import { z as z5 } from "zod";
|
|
812
|
-
var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, forkChatConversationSchema, addChatMessageSchema, chatQueuedMessagePayloadSchema, createChatQueuedMessageSchema, updateChatQueuedMessageSchema, cancelChatQueuedMessageSchema, steerChatQueuedMessageSchema, chatRichReferenceDisplaySchema, chatIssueIdentifierSchema, chatAskUserIdentifierSchema, chatAskUserOptionSchema, chatAskUserQuestionSchema, chatAskUserRequestSchema, chatIssueRichReferenceSchema, chatIssueCommentRichReferenceSchema, chatRichReferenceSchema, chatRichReferencesSchema, chatAutomationCreateSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema, updateMessengerThreadUserStateSchema, createMessengerCustomGroupSchema, createMessengerCustomGroupWithEntriesSchema, updateMessengerCustomGroupSchema, reorderMessengerCustomGroupsSchema, assignMessengerCustomGroupEntrySchema, reorderMessengerCustomGroupEntriesSchema;
|
|
813
|
-
var init_chat = __esm({
|
|
814
|
-
"../packages/shared/dist/validators/chat.js"() {
|
|
815
|
-
"use strict";
|
|
816
|
-
init_constants();
|
|
817
|
-
chatConversationStatusSchema = z5.enum(CHAT_CONVERSATION_STATUSES);
|
|
818
|
-
chatIssueCreationModeSchema = z5.enum(CHAT_ISSUE_CREATION_MODES);
|
|
819
|
-
chatMessageRoleSchema = z5.enum(CHAT_MESSAGE_ROLES);
|
|
820
|
-
chatMessageKindSchema = z5.enum(CHAT_MESSAGE_KINDS);
|
|
821
|
-
chatMessageStatusSchema = z5.enum(CHAT_MESSAGE_STATUSES);
|
|
822
|
-
chatContextEntityTypeSchema = z5.enum(CHAT_CONTEXT_ENTITY_TYPES);
|
|
823
|
-
createChatContextLinkSchema = z5.object({
|
|
824
|
-
entityType: chatContextEntityTypeSchema,
|
|
825
|
-
entityId: z5.string().min(1),
|
|
826
|
-
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
827
|
-
});
|
|
828
|
-
createChatConversationSchema = z5.object({
|
|
829
|
-
title: z5.string().trim().min(1).max(200).optional(),
|
|
830
|
-
summary: z5.string().trim().max(5e3).optional().nullable(),
|
|
831
|
-
preferredAgentId: z5.string().uuid().optional().nullable(),
|
|
832
|
-
issueCreationMode: chatIssueCreationModeSchema.optional(),
|
|
833
|
-
planMode: z5.boolean().optional(),
|
|
834
|
-
contextLinks: z5.array(createChatContextLinkSchema).optional().default([])
|
|
835
|
-
});
|
|
836
|
-
setChatProjectContextSchema = z5.object({
|
|
837
|
-
projectId: z5.string().uuid().optional().nullable()
|
|
838
|
-
});
|
|
839
|
-
updateChatConversationSchema = createChatConversationSchema.partial().extend({
|
|
840
|
-
status: chatConversationStatusSchema.optional(),
|
|
841
|
-
routedAgentId: z5.string().uuid().optional().nullable(),
|
|
842
|
-
primaryIssueId: z5.string().uuid().optional().nullable(),
|
|
843
|
-
resolvedAt: z5.string().datetime().optional().nullable()
|
|
844
|
-
});
|
|
845
|
-
forkChatConversationSchema = z5.object({
|
|
846
|
-
sourceMessageId: z5.string().uuid().optional().nullable(),
|
|
847
|
-
title: z5.string().trim().min(1).max(200).optional()
|
|
848
|
-
});
|
|
849
|
-
addChatMessageSchema = z5.object({
|
|
850
|
-
body: z5.string().trim().min(1).max(2e4),
|
|
851
|
-
editUserMessageId: z5.string().uuid().optional().nullable(),
|
|
852
|
-
queuedMessageId: z5.string().uuid().optional().nullable()
|
|
853
|
-
});
|
|
854
|
-
chatQueuedMessagePayloadSchema = z5.object({
|
|
855
|
-
body: z5.string().trim().min(1).max(2e4),
|
|
856
|
-
attachmentIds: z5.array(z5.string().uuid()).optional().default([]),
|
|
857
|
-
projectId: z5.string().uuid().optional().nullable(),
|
|
858
|
-
skillRefs: z5.array(z5.string().trim().min(1).max(240)).optional().default([]),
|
|
859
|
-
accessMode: z5.string().trim().min(1).max(120).optional().nullable(),
|
|
860
|
-
model: z5.string().trim().min(1).max(120).optional().nullable(),
|
|
861
|
-
effort: z5.string().trim().min(1).max(120).optional().nullable(),
|
|
862
|
-
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
863
|
-
});
|
|
864
|
-
createChatQueuedMessageSchema = z5.object({
|
|
865
|
-
clientMutationId: z5.string().trim().min(1).max(120),
|
|
866
|
-
expectedGenerationId: z5.string().uuid().optional().nullable(),
|
|
867
|
-
payload: chatQueuedMessagePayloadSchema
|
|
868
|
-
});
|
|
869
|
-
updateChatQueuedMessageSchema = z5.object({
|
|
870
|
-
version: z5.number().int().positive(),
|
|
871
|
-
payload: chatQueuedMessagePayloadSchema
|
|
872
|
-
});
|
|
873
|
-
cancelChatQueuedMessageSchema = z5.object({
|
|
874
|
-
version: z5.number().int().positive().optional()
|
|
875
|
-
});
|
|
876
|
-
steerChatQueuedMessageSchema = z5.object({
|
|
877
|
-
expectedActiveGenerationId: z5.string().uuid().optional().nullable()
|
|
878
|
-
});
|
|
879
|
-
chatRichReferenceDisplaySchema = z5.enum(["card", "inline"]);
|
|
880
|
-
chatIssueIdentifierSchema = z5.string().trim().min(1).max(64).regex(/^[A-Z0-9][A-Z0-9-]*$/i);
|
|
881
|
-
chatAskUserIdentifierSchema = z5.string().trim().min(1).max(64).regex(/^[a-zA-Z0-9_-]+$/);
|
|
882
|
-
chatAskUserOptionSchema = z5.object({
|
|
883
|
-
id: chatAskUserIdentifierSchema,
|
|
884
|
-
label: z5.string().trim().min(1).max(80),
|
|
885
|
-
description: z5.string().trim().min(1).max(220).optional(),
|
|
886
|
-
recommended: z5.boolean().optional()
|
|
887
|
-
});
|
|
888
|
-
chatAskUserQuestionSchema = z5.object({
|
|
889
|
-
id: chatAskUserIdentifierSchema,
|
|
890
|
-
header: z5.string().trim().min(1).max(32).optional(),
|
|
891
|
-
question: z5.string().trim().min(1).max(240),
|
|
892
|
-
options: z5.array(chatAskUserOptionSchema).min(2).max(3),
|
|
893
|
-
selectionMode: z5.enum(["single", "multiple"]).optional(),
|
|
894
|
-
allowFreeform: z5.boolean().optional()
|
|
895
|
-
}).superRefine((question, ctx) => {
|
|
896
|
-
const optionIds = /* @__PURE__ */ new Set();
|
|
897
|
-
question.options.forEach((option, index) => {
|
|
898
|
-
if (optionIds.has(option.id)) {
|
|
899
|
-
ctx.addIssue({
|
|
900
|
-
code: z5.ZodIssueCode.custom,
|
|
901
|
-
message: "Option ids must be unique within each question",
|
|
902
|
-
path: ["options", index, "id"]
|
|
903
|
-
});
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
optionIds.add(option.id);
|
|
907
|
-
});
|
|
908
|
-
});
|
|
909
|
-
chatAskUserRequestSchema = z5.object({
|
|
910
|
-
questions: z5.array(chatAskUserQuestionSchema).min(1).max(3)
|
|
911
|
-
}).superRefine((request, ctx) => {
|
|
912
|
-
const questionIds = /* @__PURE__ */ new Set();
|
|
913
|
-
request.questions.forEach((question, index) => {
|
|
914
|
-
if (questionIds.has(question.id)) {
|
|
915
|
-
ctx.addIssue({
|
|
916
|
-
code: z5.ZodIssueCode.custom,
|
|
917
|
-
message: "Question ids must be unique within requestUserInput",
|
|
918
|
-
path: ["questions", index, "id"]
|
|
919
|
-
});
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
922
|
-
questionIds.add(question.id);
|
|
923
|
-
});
|
|
924
|
-
});
|
|
925
|
-
chatIssueRichReferenceSchema = z5.object({
|
|
926
|
-
type: z5.literal("issue"),
|
|
927
|
-
issueId: z5.string().uuid().optional(),
|
|
928
|
-
identifier: chatIssueIdentifierSchema.optional(),
|
|
929
|
-
display: chatRichReferenceDisplaySchema.optional()
|
|
930
|
-
}).refine((value) => Boolean(value.issueId || value.identifier), {
|
|
931
|
-
message: "issueId or identifier is required"
|
|
932
|
-
});
|
|
933
|
-
chatIssueCommentRichReferenceSchema = z5.object({
|
|
934
|
-
type: z5.literal("issue_comment"),
|
|
935
|
-
issueId: z5.string().uuid().optional(),
|
|
936
|
-
identifier: chatIssueIdentifierSchema.optional(),
|
|
937
|
-
commentId: z5.string().uuid(),
|
|
938
|
-
display: chatRichReferenceDisplaySchema.optional()
|
|
939
|
-
}).refine((value) => Boolean(value.issueId || value.identifier), {
|
|
940
|
-
message: "issueId or identifier is required"
|
|
941
|
-
});
|
|
942
|
-
chatRichReferenceSchema = z5.union([
|
|
943
|
-
chatIssueRichReferenceSchema,
|
|
944
|
-
chatIssueCommentRichReferenceSchema
|
|
945
|
-
]);
|
|
946
|
-
chatRichReferencesSchema = z5.array(chatRichReferenceSchema).max(5);
|
|
947
|
-
chatAutomationCreateSchema = z5.object({
|
|
948
|
-
title: z5.string().trim().min(1).max(200),
|
|
949
|
-
instructions: z5.string().trim().max(2e4).optional().nullable(),
|
|
950
|
-
description: z5.string().trim().max(2e4).optional().nullable(),
|
|
951
|
-
projectId: z5.string().uuid().optional().nullable(),
|
|
952
|
-
goalId: z5.string().uuid().optional().nullable(),
|
|
953
|
-
parentIssueId: z5.string().uuid().optional().nullable(),
|
|
954
|
-
priority: z5.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
955
|
-
status: z5.enum(AUTOMATION_STATUSES).optional().default("active"),
|
|
956
|
-
concurrencyPolicy: z5.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
|
|
957
|
-
catchUpPolicy: z5.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed"),
|
|
958
|
-
outputMode: z5.enum(AUTOMATION_OUTPUT_MODES).optional().default("track_issue"),
|
|
959
|
-
schedule: z5.object({
|
|
960
|
-
cronExpression: z5.string().trim().min(1),
|
|
961
|
-
timezone: z5.string().trim().min(1),
|
|
962
|
-
label: z5.string().trim().max(120).optional().nullable(),
|
|
963
|
-
enabled: z5.boolean().optional().default(true)
|
|
964
|
-
})
|
|
965
|
-
}).transform(({ description, instructions, ...value }) => ({
|
|
966
|
-
...value,
|
|
967
|
-
instructions: instructions === void 0 ? description : instructions
|
|
968
|
-
}));
|
|
969
|
-
createChatAttachmentMetadataSchema = z5.object({
|
|
970
|
-
messageId: z5.string().uuid()
|
|
971
|
-
});
|
|
972
|
-
chatIssueProposalSchema = z5.object({
|
|
973
|
-
title: z5.string().trim().min(1).max(200),
|
|
974
|
-
description: z5.string().trim().min(1).max(2e4),
|
|
975
|
-
status: z5.enum(ISSUE_STATUSES).optional().default("todo"),
|
|
976
|
-
priority: z5.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
977
|
-
projectId: z5.string().uuid().optional().nullable(),
|
|
978
|
-
goalId: z5.string().uuid().optional().nullable(),
|
|
979
|
-
parentId: z5.string().uuid().optional().nullable(),
|
|
980
|
-
assigneeAgentId: z5.string().uuid().optional().nullable(),
|
|
981
|
-
assigneeUserId: z5.string().trim().optional().nullable(),
|
|
982
|
-
assigneeUnassignedReason: z5.string().trim().min(1).max(500).optional().nullable(),
|
|
983
|
-
reviewerAgentId: z5.string().uuid().optional().nullable(),
|
|
984
|
-
reviewerUserId: z5.string().trim().optional().nullable(),
|
|
985
|
-
labelIds: z5.array(z5.string().uuid()).optional()
|
|
986
|
-
}).superRefine((proposal, ctx) => {
|
|
987
|
-
const hasAssignee = Boolean(proposal.assigneeAgentId || proposal.assigneeUserId);
|
|
988
|
-
const hasUnassignedReason = Boolean(proposal.assigneeUnassignedReason?.trim());
|
|
989
|
-
if (hasAssignee && hasUnassignedReason) {
|
|
990
|
-
ctx.addIssue({
|
|
991
|
-
code: z5.ZodIssueCode.custom,
|
|
992
|
-
message: "Issue proposals with an assignee must not also declare an unassigned reason",
|
|
993
|
-
path: ["assigneeUnassignedReason"]
|
|
994
|
-
});
|
|
995
|
-
}
|
|
996
|
-
if (!hasAssignee && !hasUnassignedReason) {
|
|
997
|
-
ctx.addIssue({
|
|
998
|
-
code: z5.ZodIssueCode.custom,
|
|
999
|
-
message: "Issue proposals without an owner must include assigneeUnassignedReason",
|
|
1000
|
-
path: ["assigneeUnassignedReason"]
|
|
1001
|
-
});
|
|
1002
|
-
}
|
|
1003
|
-
});
|
|
1004
|
-
convertChatToIssueSchema = z5.object({
|
|
1005
|
-
messageId: z5.string().uuid().optional().nullable(),
|
|
1006
|
-
proposal: chatIssueProposalSchema.optional()
|
|
1007
|
-
});
|
|
1008
|
-
chatOperationProposalSchema = z5.object({
|
|
1009
|
-
targetType: z5.enum(["organization", "agent"]),
|
|
1010
|
-
targetId: z5.string().min(1),
|
|
1011
|
-
summary: z5.string().trim().min(1).max(500),
|
|
1012
|
-
patch: z5.record(z5.unknown())
|
|
1013
|
-
});
|
|
1014
|
-
resolveChatOperationProposalSchema = z5.object({
|
|
1015
|
-
action: z5.enum(["approve", "reject", "requestRevision"]),
|
|
1016
|
-
decisionNote: z5.string().trim().max(5e3).optional().nullable()
|
|
1216
|
+
desiredSkills: z5.array(z5.string().min(1)),
|
|
1217
|
+
entries: z5.array(agentSkillEntrySchema),
|
|
1218
|
+
warnings: z5.array(z5.string())
|
|
1017
1219
|
});
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
unread: z5.boolean().optional()
|
|
1220
|
+
agentSkillSyncSchema = z5.object({
|
|
1221
|
+
desiredSkills: z5.array(z5.string().min(1))
|
|
1021
1222
|
});
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
});
|
|
1025
|
-
createMessengerCustomGroupSchema = z5.object({
|
|
1026
|
-
name: z5.string().trim().min(1).max(80),
|
|
1027
|
-
icon: z5.string().trim().min(1).max(24).optional().nullable()
|
|
1028
|
-
});
|
|
1029
|
-
createMessengerCustomGroupWithEntriesSchema = createMessengerCustomGroupSchema.extend({
|
|
1030
|
-
threadKeys: z5.array(z5.string().trim().min(1).max(240)).min(1).max(50),
|
|
1031
|
-
autoGenerateName: z5.boolean().optional()
|
|
1032
|
-
});
|
|
1033
|
-
updateMessengerCustomGroupSchema = z5.object({
|
|
1034
|
-
name: z5.string().trim().min(1).max(80).optional(),
|
|
1035
|
-
icon: z5.string().trim().min(1).max(24).optional().nullable(),
|
|
1036
|
-
collapsed: z5.boolean().optional(),
|
|
1037
|
-
pinned: z5.boolean().optional(),
|
|
1038
|
-
sortOrder: z5.number().int().min(0).optional()
|
|
1039
|
-
});
|
|
1040
|
-
reorderMessengerCustomGroupsSchema = z5.object({
|
|
1041
|
-
groupIds: z5.array(z5.string().uuid()).max(200)
|
|
1042
|
-
});
|
|
1043
|
-
assignMessengerCustomGroupEntrySchema = z5.object({
|
|
1044
|
-
threadKey: z5.string().trim().min(1).max(240)
|
|
1045
|
-
});
|
|
1046
|
-
reorderMessengerCustomGroupEntriesSchema = z5.object({
|
|
1047
|
-
threadKeys: z5.array(z5.string().trim().min(1).max(240)).max(500)
|
|
1223
|
+
agentSkillEnableSchema = z5.object({
|
|
1224
|
+
skills: z5.array(z5.string().min(1)).min(1)
|
|
1048
1225
|
});
|
|
1049
1226
|
}
|
|
1050
1227
|
});
|
|
@@ -1219,7 +1396,7 @@ var init_organization_issue_key = __esm({
|
|
|
1219
1396
|
|
|
1220
1397
|
// ../packages/shared/dist/validators/organization.js
|
|
1221
1398
|
import { z as z9 } from "zod";
|
|
1222
|
-
var logoAssetIdSchema, brandColorSchema, organizationIssueKeySchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema, createOrganizationWorkspaceFileSchema, createOrganizationWorkspaceDirectorySchema, renameOrganizationWorkspaceEntrySchema, moveOrganizationWorkspaceEntrySchema, copyOrganizationWorkspaceEntrySchema;
|
|
1399
|
+
var logoAssetIdSchema, brandColorSchema, organizationIssueKeySchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema, workspaceWebPreviewNetworkModeSchema, createOrganizationWorkspaceWebPreviewSessionSchema, createOrganizationWorkspaceFileSchema, createOrganizationWorkspaceDirectorySchema, renameOrganizationWorkspaceEntrySchema, moveOrganizationWorkspaceEntrySchema, copyOrganizationWorkspaceEntrySchema;
|
|
1223
1400
|
var init_organization = __esm({
|
|
1224
1401
|
"../packages/shared/dist/validators/organization.js"() {
|
|
1225
1402
|
"use strict";
|
|
@@ -1257,6 +1434,12 @@ var init_organization = __esm({
|
|
|
1257
1434
|
content: z9.string(),
|
|
1258
1435
|
expectedContent: z9.string().optional()
|
|
1259
1436
|
});
|
|
1437
|
+
workspaceWebPreviewNetworkModeSchema = z9.enum(["offline", "connected"]);
|
|
1438
|
+
createOrganizationWorkspaceWebPreviewSessionSchema = z9.object({
|
|
1439
|
+
entryPath: z9.string().trim().min(1).max(1e3),
|
|
1440
|
+
networkMode: workspaceWebPreviewNetworkModeSchema,
|
|
1441
|
+
htmlContent: z9.string().optional()
|
|
1442
|
+
});
|
|
1260
1443
|
createOrganizationWorkspaceFileSchema = z9.object({
|
|
1261
1444
|
filePath: z9.string().trim().min(1).max(1e3),
|
|
1262
1445
|
content: z9.string().optional().default("")
|
|
@@ -3114,6 +3297,7 @@ var init_organization_skill_reference = __esm({
|
|
|
3114
3297
|
"rudder-create-agent",
|
|
3115
3298
|
"rudder-create-plugin",
|
|
3116
3299
|
"skill-creator",
|
|
3300
|
+
"visualize",
|
|
3117
3301
|
"browser"
|
|
3118
3302
|
];
|
|
3119
3303
|
RUDDER_BUNDLED_SKILL_KEYS = new Set(RUDDER_BUNDLED_SKILL_SLUGS.map((slug) => `rudder/${slug}`));
|
|
@@ -3335,12 +3519,15 @@ var init_config_schema = __esm({
|
|
|
3335
3519
|
var init_dist = __esm({
|
|
3336
3520
|
"../packages/shared/dist/index.js"() {
|
|
3337
3521
|
"use strict";
|
|
3522
|
+
init_browser_shortcuts();
|
|
3523
|
+
init_chat_inline_visuals();
|
|
3338
3524
|
init_chat_work_manifest();
|
|
3339
3525
|
init_constants();
|
|
3340
3526
|
init_agent_run();
|
|
3341
3527
|
init_workspace_backup();
|
|
3342
3528
|
init_website_icons();
|
|
3343
3529
|
init_custom_integration();
|
|
3530
|
+
init_chat();
|
|
3344
3531
|
init_validators();
|
|
3345
3532
|
init_validators();
|
|
3346
3533
|
init_agent_url_key();
|
|
@@ -3358,6 +3545,46 @@ var init_dist = __esm({
|
|
|
3358
3545
|
}
|
|
3359
3546
|
});
|
|
3360
3547
|
|
|
3548
|
+
// src/version.ts
|
|
3549
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3550
|
+
import path from "node:path";
|
|
3551
|
+
import { fileURLToPath } from "node:url";
|
|
3552
|
+
function readPackageVersion(packagePath, expectedName) {
|
|
3553
|
+
if (!existsSync(packagePath)) return null;
|
|
3554
|
+
try {
|
|
3555
|
+
const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
|
|
3556
|
+
if (parsed.name === expectedName && parsed.version) return parsed.version;
|
|
3557
|
+
} catch {
|
|
3558
|
+
return null;
|
|
3559
|
+
}
|
|
3560
|
+
return null;
|
|
3561
|
+
}
|
|
3562
|
+
function resolveCliVersion(moduleUrl = import.meta.url, env = process.env) {
|
|
3563
|
+
if (env.npm_package_name === CLI_PACKAGE_NAME && env.npm_package_version) {
|
|
3564
|
+
return env.npm_package_version;
|
|
3565
|
+
}
|
|
3566
|
+
const moduleDir = path.dirname(fileURLToPath(moduleUrl));
|
|
3567
|
+
const candidates = [
|
|
3568
|
+
path.resolve(moduleDir, CLI_VERSION_MANIFEST),
|
|
3569
|
+
path.resolve(moduleDir, "package.json"),
|
|
3570
|
+
path.resolve(moduleDir, "../package.json"),
|
|
3571
|
+
path.resolve(moduleDir, "../../package.json")
|
|
3572
|
+
];
|
|
3573
|
+
for (const candidate of candidates) {
|
|
3574
|
+
const version = readPackageVersion(candidate, CLI_PACKAGE_NAME);
|
|
3575
|
+
if (version) return version;
|
|
3576
|
+
}
|
|
3577
|
+
return "0.0.0";
|
|
3578
|
+
}
|
|
3579
|
+
var CLI_PACKAGE_NAME, CLI_VERSION_MANIFEST;
|
|
3580
|
+
var init_version = __esm({
|
|
3581
|
+
"src/version.ts"() {
|
|
3582
|
+
"use strict";
|
|
3583
|
+
CLI_PACKAGE_NAME = "@rudderhq/cli";
|
|
3584
|
+
CLI_VERSION_MANIFEST = "rudder-cli-package.json";
|
|
3585
|
+
}
|
|
3586
|
+
});
|
|
3587
|
+
|
|
3361
3588
|
// src/config/hostnames.ts
|
|
3362
3589
|
function normalizeHostnameInput(raw) {
|
|
3363
3590
|
const input = raw.trim();
|
|
@@ -3390,11 +3617,11 @@ var init_hostnames = __esm({
|
|
|
3390
3617
|
|
|
3391
3618
|
// src/config/home.ts
|
|
3392
3619
|
import os2 from "node:os";
|
|
3393
|
-
import
|
|
3620
|
+
import path3 from "node:path";
|
|
3394
3621
|
function resolveRudderHomeDir() {
|
|
3395
3622
|
const envHome = process.env.RUDDER_HOME?.trim();
|
|
3396
|
-
if (envHome) return
|
|
3397
|
-
return
|
|
3623
|
+
if (envHome) return path3.resolve(expandHomePrefix(envHome));
|
|
3624
|
+
return path3.resolve(os2.homedir(), ".rudder");
|
|
3398
3625
|
}
|
|
3399
3626
|
function resolveRudderInstanceId(override) {
|
|
3400
3627
|
const raw = override?.trim() || process.env.RUDDER_INSTANCE_ID?.trim() || DEFAULT_INSTANCE_ID;
|
|
@@ -3407,35 +3634,35 @@ function resolveRudderInstanceId(override) {
|
|
|
3407
3634
|
}
|
|
3408
3635
|
function resolveRudderInstanceRoot(instanceId) {
|
|
3409
3636
|
const id = resolveRudderInstanceId(instanceId);
|
|
3410
|
-
return
|
|
3637
|
+
return path3.resolve(resolveRudderHomeDir(), "instances", id);
|
|
3411
3638
|
}
|
|
3412
3639
|
function resolveDefaultConfigPath(instanceId) {
|
|
3413
|
-
return
|
|
3640
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "config.json");
|
|
3414
3641
|
}
|
|
3415
3642
|
function resolveDefaultContextPath() {
|
|
3416
|
-
return
|
|
3643
|
+
return path3.resolve(resolveRudderHomeDir(), "context.json");
|
|
3417
3644
|
}
|
|
3418
3645
|
function resolveDefaultCliAuthPath() {
|
|
3419
|
-
return
|
|
3646
|
+
return path3.resolve(resolveRudderHomeDir(), "auth.json");
|
|
3420
3647
|
}
|
|
3421
3648
|
function resolveDefaultEmbeddedPostgresDir(instanceId) {
|
|
3422
|
-
return
|
|
3649
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "db");
|
|
3423
3650
|
}
|
|
3424
3651
|
function resolveDefaultLogsDir(instanceId) {
|
|
3425
|
-
return
|
|
3652
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "logs");
|
|
3426
3653
|
}
|
|
3427
3654
|
function resolveDefaultSecretsKeyFilePath(instanceId) {
|
|
3428
|
-
return
|
|
3655
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "secrets", "master.key");
|
|
3429
3656
|
}
|
|
3430
3657
|
function resolveDefaultStorageDir(instanceId) {
|
|
3431
|
-
return
|
|
3658
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "data", "storage");
|
|
3432
3659
|
}
|
|
3433
3660
|
function resolveDefaultBackupDir(instanceId) {
|
|
3434
|
-
return
|
|
3661
|
+
return path3.resolve(resolveRudderInstanceRoot(instanceId), "data", "backups");
|
|
3435
3662
|
}
|
|
3436
3663
|
function expandHomePrefix(value) {
|
|
3437
3664
|
if (value === "~") return os2.homedir();
|
|
3438
|
-
if (value.startsWith("~/")) return
|
|
3665
|
+
if (value.startsWith("~/")) return path3.resolve(os2.homedir(), value.slice(2));
|
|
3439
3666
|
return value;
|
|
3440
3667
|
}
|
|
3441
3668
|
function describeLocalInstancePaths(instanceId) {
|
|
@@ -3472,24 +3699,24 @@ var init_schema = __esm({
|
|
|
3472
3699
|
|
|
3473
3700
|
// src/config/store.ts
|
|
3474
3701
|
import fs2 from "node:fs";
|
|
3475
|
-
import
|
|
3702
|
+
import path4 from "node:path";
|
|
3476
3703
|
function findConfigFileFromAncestors(startDir) {
|
|
3477
|
-
const absoluteStartDir =
|
|
3704
|
+
const absoluteStartDir = path4.resolve(startDir);
|
|
3478
3705
|
let currentDir = absoluteStartDir;
|
|
3479
3706
|
while (true) {
|
|
3480
|
-
const candidate =
|
|
3707
|
+
const candidate = path4.resolve(currentDir, ".rudder", DEFAULT_CONFIG_BASENAME);
|
|
3481
3708
|
if (fs2.existsSync(candidate)) {
|
|
3482
3709
|
return candidate;
|
|
3483
3710
|
}
|
|
3484
|
-
const nextDir =
|
|
3711
|
+
const nextDir = path4.resolve(currentDir, "..");
|
|
3485
3712
|
if (nextDir === currentDir) break;
|
|
3486
3713
|
currentDir = nextDir;
|
|
3487
3714
|
}
|
|
3488
3715
|
return null;
|
|
3489
3716
|
}
|
|
3490
3717
|
function resolveConfigPath(overridePath) {
|
|
3491
|
-
if (overridePath) return
|
|
3492
|
-
if (process.env.RUDDER_CONFIG) return
|
|
3718
|
+
if (overridePath) return path4.resolve(overridePath);
|
|
3719
|
+
if (process.env.RUDDER_CONFIG) return path4.resolve(process.env.RUDDER_CONFIG);
|
|
3493
3720
|
return findConfigFileFromAncestors(process.cwd()) ?? resolveDefaultConfigPath(resolveRudderInstanceId());
|
|
3494
3721
|
}
|
|
3495
3722
|
function parseJson(filePath) {
|
|
@@ -3544,7 +3771,7 @@ function readConfig(configPath) {
|
|
|
3544
3771
|
}
|
|
3545
3772
|
function writeConfig(config, configPath) {
|
|
3546
3773
|
const filePath = resolveConfigPath(configPath);
|
|
3547
|
-
const dir =
|
|
3774
|
+
const dir = path4.dirname(filePath);
|
|
3548
3775
|
fs2.mkdirSync(dir, { recursive: true });
|
|
3549
3776
|
if (fs2.existsSync(filePath)) {
|
|
3550
3777
|
const backupPath = filePath + ".backup";
|
|
@@ -3572,9 +3799,9 @@ var init_store = __esm({
|
|
|
3572
3799
|
import { config as loadDotenv, parse as parseEnvFileContents } from "dotenv";
|
|
3573
3800
|
import { randomBytes } from "node:crypto";
|
|
3574
3801
|
import fs3 from "node:fs";
|
|
3575
|
-
import
|
|
3802
|
+
import path5 from "node:path";
|
|
3576
3803
|
function resolveEnvFilePath(configPath) {
|
|
3577
|
-
return
|
|
3804
|
+
return path5.resolve(path5.dirname(resolveConfigPath(configPath)), ".env");
|
|
3578
3805
|
}
|
|
3579
3806
|
function isNonEmpty(value) {
|
|
3580
3807
|
return typeof value === "string" && value.trim().length > 0;
|
|
@@ -3647,7 +3874,7 @@ function readPaperclipEnvEntries(filePath = resolveEnvFilePath()) {
|
|
|
3647
3874
|
return parseEnvFile(fs3.readFileSync(filePath, "utf-8"));
|
|
3648
3875
|
}
|
|
3649
3876
|
function writePaperclipEnvEntries(entries, filePath = resolveEnvFilePath()) {
|
|
3650
|
-
const dir =
|
|
3877
|
+
const dir = path5.dirname(filePath);
|
|
3651
3878
|
fs3.mkdirSync(dir, { recursive: true });
|
|
3652
3879
|
fs3.writeFileSync(filePath, renderEnvFile(entries), {
|
|
3653
3880
|
mode: 384
|
|
@@ -3678,7 +3905,7 @@ var init_env = __esm({
|
|
|
3678
3905
|
import { execFileSync, spawnSync as spawnSync2 } from "node:child_process";
|
|
3679
3906
|
import { cp, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
3680
3907
|
import { createRequire } from "node:module";
|
|
3681
|
-
import
|
|
3908
|
+
import path6 from "node:path";
|
|
3682
3909
|
import { pathToFileURL } from "node:url";
|
|
3683
3910
|
function sanitizeRuntimeCacheSegment(value) {
|
|
3684
3911
|
return encodeURIComponent(value.trim() || "latest").replaceAll("%", "_");
|
|
@@ -3688,7 +3915,7 @@ function resolveRuntimePackageVersion(version) {
|
|
|
3688
3915
|
return normalized.length > 0 ? normalized : "latest";
|
|
3689
3916
|
}
|
|
3690
3917
|
function resolveRuntimeCacheDir(version, homeDir = resolveRudderHomeDir()) {
|
|
3691
|
-
return
|
|
3918
|
+
return path6.join(homeDir, "runtimes", sanitizeRuntimeCacheSegment(resolveRuntimePackageVersion(version)));
|
|
3692
3919
|
}
|
|
3693
3920
|
function resolveRuntimePackageSpec(version, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
3694
3921
|
const packageVersion = resolveRuntimePackageVersion(version);
|
|
@@ -3696,7 +3923,7 @@ function resolveRuntimePackageSpec(version, packageName = RUNTIME_NPM_PACKAGE_NA
|
|
|
3696
3923
|
}
|
|
3697
3924
|
async function readRuntimeInstallMetadata(cacheDir) {
|
|
3698
3925
|
try {
|
|
3699
|
-
const raw = await readFile(
|
|
3926
|
+
const raw = await readFile(path6.join(cacheDir, RUNTIME_METADATA_FILE), "utf8");
|
|
3700
3927
|
const parsed = JSON.parse(raw);
|
|
3701
3928
|
if (parsed.version !== 1) return null;
|
|
3702
3929
|
if (typeof parsed.packageName !== "string" || typeof parsed.packageVersion !== "string") return null;
|
|
@@ -3706,7 +3933,7 @@ async function readRuntimeInstallMetadata(cacheDir) {
|
|
|
3706
3933
|
}
|
|
3707
3934
|
}
|
|
3708
3935
|
async function writeRuntimeInstallMetadata(cacheDir, metadata) {
|
|
3709
|
-
await writeFile(
|
|
3936
|
+
await writeFile(path6.join(cacheDir, RUNTIME_METADATA_FILE), `${JSON.stringify(metadata, null, 2)}
|
|
3710
3937
|
`, "utf8");
|
|
3711
3938
|
}
|
|
3712
3939
|
async function touchRuntimeInstallMetadata(cacheDir) {
|
|
@@ -3733,7 +3960,7 @@ function resolveEmbeddedPostgresPlatformPackage(platform = process.platform, arc
|
|
|
3733
3960
|
}
|
|
3734
3961
|
async function canResolveRuntimePackage(cacheDir, packageName) {
|
|
3735
3962
|
try {
|
|
3736
|
-
await readFile(
|
|
3963
|
+
await readFile(path6.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json"), "utf8");
|
|
3737
3964
|
return true;
|
|
3738
3965
|
} catch {
|
|
3739
3966
|
return false;
|
|
@@ -3753,7 +3980,7 @@ async function isRuntimeCacheHit(options) {
|
|
|
3753
3980
|
return false;
|
|
3754
3981
|
}
|
|
3755
3982
|
try {
|
|
3756
|
-
const packageJsonPath =
|
|
3983
|
+
const packageJsonPath = path6.join(options.cacheDir, "node_modules", ...packageName.split("/"), "package.json");
|
|
3757
3984
|
const packageJson = JSON.parse(await readFile(packageJsonPath, "utf8"));
|
|
3758
3985
|
const packageVersionMatches = packageVersion === "latest" || packageJson.version === packageVersion;
|
|
3759
3986
|
return packageVersionMatches && await hasRequiredRuntimePlatformDependencies(options.cacheDir);
|
|
@@ -3764,13 +3991,14 @@ async function isRuntimeCacheHit(options) {
|
|
|
3764
3991
|
async function ensureRuntimeInstalled(options) {
|
|
3765
3992
|
const packageName = options.packageName ?? RUNTIME_NPM_PACKAGE_NAME;
|
|
3766
3993
|
const packageVersion = resolveRuntimePackageVersion(options.version);
|
|
3767
|
-
const
|
|
3994
|
+
const homeDir = options.homeDir ?? resolveRudderHomeDir();
|
|
3995
|
+
const cacheDir = resolveRuntimeCacheDir(packageVersion, homeDir);
|
|
3768
3996
|
const packageSpec = resolveRuntimePackageSpec(packageVersion, packageName);
|
|
3769
3997
|
const command = formatRuntimeInstallCommand(cacheDir, packageSpec);
|
|
3770
3998
|
const preparePostgresPayload = options.preparePostgresPayload === true;
|
|
3771
3999
|
const postgresVersionProbe = options.postgresVersionProbe ?? readPostgresVersion;
|
|
3772
4000
|
if (await isRuntimeCacheHit({ cacheDir, version: packageVersion, packageName })) {
|
|
3773
|
-
const postgresPayload2 = await stageRuntimePostgresPayload(cacheDir, preparePostgresPayload, postgresVersionProbe);
|
|
4001
|
+
const postgresPayload2 = await stageRuntimePostgresPayload(cacheDir, homeDir, preparePostgresPayload, postgresVersionProbe);
|
|
3774
4002
|
await touchRuntimeInstallMetadata(cacheDir);
|
|
3775
4003
|
const prune2 = await maybePruneRuntimeCache({
|
|
3776
4004
|
homeDir: options.homeDir,
|
|
@@ -3791,7 +4019,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3791
4019
|
packageVersion
|
|
3792
4020
|
});
|
|
3793
4021
|
if (existingRuntimeOutput !== null) {
|
|
3794
|
-
const postgresPayload2 = await stageRuntimePostgresPayload(cacheDir, preparePostgresPayload, postgresVersionProbe);
|
|
4022
|
+
const postgresPayload2 = await stageRuntimePostgresPayload(cacheDir, homeDir, preparePostgresPayload, postgresVersionProbe);
|
|
3795
4023
|
const metadata2 = {
|
|
3796
4024
|
version: 1,
|
|
3797
4025
|
packageName,
|
|
@@ -3813,7 +4041,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3813
4041
|
}
|
|
3814
4042
|
await rm(cacheDir, { recursive: true, force: true });
|
|
3815
4043
|
await mkdir(cacheDir, { recursive: true });
|
|
3816
|
-
await writeFile(
|
|
4044
|
+
await writeFile(path6.join(cacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
|
|
3817
4045
|
`, "utf8");
|
|
3818
4046
|
const result = runNpmRuntimeInstall(spawnSyncImpl, cacheDir, packageSpec);
|
|
3819
4047
|
let output = collectSpawnOutput(result);
|
|
@@ -3824,6 +4052,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3824
4052
|
if (await isRuntimeCacheHit({ cacheDir: fallbackCacheDir, version: fallbackVersion, packageName })) {
|
|
3825
4053
|
const fallbackPostgresPayload = await stageRuntimePostgresPayload(
|
|
3826
4054
|
fallbackCacheDir,
|
|
4055
|
+
homeDir,
|
|
3827
4056
|
preparePostgresPayload,
|
|
3828
4057
|
postgresVersionProbe
|
|
3829
4058
|
);
|
|
@@ -3841,7 +4070,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3841
4070
|
}
|
|
3842
4071
|
await rm(fallbackCacheDir, { recursive: true, force: true });
|
|
3843
4072
|
await mkdir(fallbackCacheDir, { recursive: true });
|
|
3844
|
-
await writeFile(
|
|
4073
|
+
await writeFile(path6.join(fallbackCacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
|
|
3845
4074
|
`, "utf8");
|
|
3846
4075
|
const fallbackResult = runNpmRuntimeInstall(spawnSyncImpl, fallbackCacheDir, fallbackSpec);
|
|
3847
4076
|
let fallbackOutput = collectSpawnOutput(fallbackResult);
|
|
@@ -3852,6 +4081,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3852
4081
|
);
|
|
3853
4082
|
const postgresPayload2 = await stageRuntimePostgresPayload(
|
|
3854
4083
|
fallbackCacheDir,
|
|
4084
|
+
homeDir,
|
|
3855
4085
|
preparePostgresPayload,
|
|
3856
4086
|
postgresVersionProbe
|
|
3857
4087
|
);
|
|
@@ -3885,7 +4115,7 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3885
4115
|
output,
|
|
3886
4116
|
await ensureRequiredEmbeddedPostgresPlatformPackage(spawnSyncImpl, cacheDir)
|
|
3887
4117
|
);
|
|
3888
|
-
const postgresPayload = await stageRuntimePostgresPayload(cacheDir, preparePostgresPayload, postgresVersionProbe);
|
|
4118
|
+
const postgresPayload = await stageRuntimePostgresPayload(cacheDir, homeDir, preparePostgresPayload, postgresVersionProbe);
|
|
3889
4119
|
const metadata = {
|
|
3890
4120
|
version: 1,
|
|
3891
4121
|
packageName,
|
|
@@ -3906,10 +4136,19 @@ async function ensureRuntimeInstalled(options) {
|
|
|
3906
4136
|
);
|
|
3907
4137
|
}
|
|
3908
4138
|
function resolveRuntimePostgresPayloadBinDir(cacheDir, platform = process.platform, arch = process.arch) {
|
|
3909
|
-
return
|
|
4139
|
+
return path6.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR, runtimePostgresPlatformSegment(platform, arch), "bin");
|
|
4140
|
+
}
|
|
4141
|
+
function resolveSharedRuntimePostgresPayloadBinDir(homeDir = resolveRudderHomeDir(), platform = process.platform, arch = process.arch) {
|
|
4142
|
+
return path6.join(
|
|
4143
|
+
homeDir,
|
|
4144
|
+
"runtime-payloads",
|
|
4145
|
+
RUNTIME_POSTGRES_PAYLOAD_DIR,
|
|
4146
|
+
runtimePostgresPlatformSegment(platform, arch),
|
|
4147
|
+
"bin"
|
|
4148
|
+
);
|
|
3910
4149
|
}
|
|
3911
4150
|
function resolveRuntimeServerEntrypoint(cacheDir, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
3912
|
-
return createRequire(
|
|
4151
|
+
return createRequire(path6.join(cacheDir, "package.json")).resolve(packageName);
|
|
3913
4152
|
}
|
|
3914
4153
|
async function importRuntimeServerModule(cacheDir, packageName = RUNTIME_NPM_PACKAGE_NAME) {
|
|
3915
4154
|
const entrypoint = resolveRuntimeServerEntrypoint(cacheDir, packageName);
|
|
@@ -3930,7 +4169,7 @@ function formatRuntimeInstallCommand(cacheDir, packageSpec) {
|
|
|
3930
4169
|
return `npm install --prefix ${cacheDir} ${RUNTIME_NPM_INSTALL_FLAGS.join(" ")} ${packageSpec}`;
|
|
3931
4170
|
}
|
|
3932
4171
|
function formatRuntimePlatformRepairCommand(cacheDir, packageSpec) {
|
|
3933
|
-
return `npm pack ${packageSpec} --registry=${NPM_PUBLIC_REGISTRY_URL} --silent, then extract it into ${
|
|
4172
|
+
return `npm pack ${packageSpec} --registry=${NPM_PUBLIC_REGISTRY_URL} --silent, then extract it into ${path6.join(cacheDir, "node_modules")}`;
|
|
3934
4173
|
}
|
|
3935
4174
|
function collectSpawnOutput(result) {
|
|
3936
4175
|
return [result.stdout, result.stderr, result.error instanceof Error ? result.error.message : null].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
|
|
@@ -3946,7 +4185,7 @@ function withPostgresPayload(result, postgresPayload) {
|
|
|
3946
4185
|
};
|
|
3947
4186
|
}
|
|
3948
4187
|
function runtimePackageJsonPath(cacheDir, packageName) {
|
|
3949
|
-
return
|
|
4188
|
+
return path6.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json");
|
|
3950
4189
|
}
|
|
3951
4190
|
async function readRuntimePackageJson(cacheDir, packageName) {
|
|
3952
4191
|
try {
|
|
@@ -3989,7 +4228,7 @@ async function ensureRequiredEmbeddedPostgresPlatformPackage(spawnSyncImpl, cach
|
|
|
3989
4228
|
);
|
|
3990
4229
|
}
|
|
3991
4230
|
async function installRuntimePackageInStaging(spawnSyncImpl, cacheDir, packageSpec, packageName) {
|
|
3992
|
-
const stagingDir =
|
|
4231
|
+
const stagingDir = path6.join(cacheDir, `.platform-repair-${process.pid}-${Date.now()}`);
|
|
3993
4232
|
await mkdir(stagingDir, { recursive: true });
|
|
3994
4233
|
try {
|
|
3995
4234
|
const packResult = runNpmPack(spawnSyncImpl, packageSpec, stagingDir);
|
|
@@ -3998,9 +4237,9 @@ async function installRuntimePackageInStaging(spawnSyncImpl, cacheDir, packageSp
|
|
|
3998
4237
|
if (!packFilename) {
|
|
3999
4238
|
return createSyntheticSpawnResult(1, "", `Unable to parse npm pack output for ${packageSpec}.`);
|
|
4000
4239
|
}
|
|
4001
|
-
const archivePath =
|
|
4002
|
-
const targetDir =
|
|
4003
|
-
await mkdir(
|
|
4240
|
+
const archivePath = path6.join(stagingDir, packFilename);
|
|
4241
|
+
const targetDir = path6.dirname(runtimePackageJsonPath(cacheDir, packageName));
|
|
4242
|
+
await mkdir(path6.dirname(targetDir), { recursive: true });
|
|
4004
4243
|
await rm(targetDir, { recursive: true, force: true });
|
|
4005
4244
|
await mkdir(targetDir, { recursive: true });
|
|
4006
4245
|
const extractResult = runTarExtract(spawnSyncImpl, archivePath, targetDir);
|
|
@@ -4051,8 +4290,8 @@ function combineSpawnResults(...results) {
|
|
|
4051
4290
|
}
|
|
4052
4291
|
async function removeRuntimeInstallLocks(cacheDir) {
|
|
4053
4292
|
await Promise.all([
|
|
4054
|
-
rm(
|
|
4055
|
-
rm(
|
|
4293
|
+
rm(path6.join(cacheDir, "package-lock.json"), { force: true }),
|
|
4294
|
+
rm(path6.join(cacheDir, "node_modules", ".package-lock.json"), { force: true })
|
|
4056
4295
|
]);
|
|
4057
4296
|
}
|
|
4058
4297
|
function packageNameFromSpec(packageSpec) {
|
|
@@ -4076,41 +4315,41 @@ function runtimePostgresExecutableName(baseName) {
|
|
|
4076
4315
|
return process.platform === "win32" ? `${baseName}.exe` : baseName;
|
|
4077
4316
|
}
|
|
4078
4317
|
function debianSharedirCandidate(binDir) {
|
|
4079
|
-
const normalized =
|
|
4080
|
-
const parts = normalized.split(
|
|
4318
|
+
const normalized = path6.resolve(binDir);
|
|
4319
|
+
const parts = normalized.split(path6.sep);
|
|
4081
4320
|
const libIndex = parts.lastIndexOf("lib");
|
|
4082
4321
|
if (libIndex < 0) return null;
|
|
4083
4322
|
if (parts[libIndex + 1] !== "postgresql") return null;
|
|
4084
4323
|
const version = parts[libIndex + 2];
|
|
4085
4324
|
if (!version || parts[libIndex + 3] !== "bin") return null;
|
|
4086
|
-
const prefix = parts.slice(0, libIndex).join(
|
|
4087
|
-
return
|
|
4325
|
+
const prefix = parts.slice(0, libIndex).join(path6.sep) || path6.sep;
|
|
4326
|
+
return path6.join(prefix, "share", "postgresql", version);
|
|
4088
4327
|
}
|
|
4089
4328
|
async function resolveRuntimePostgresTemplateDir(binDir) {
|
|
4090
4329
|
for (const candidatePath of [
|
|
4091
|
-
|
|
4092
|
-
|
|
4330
|
+
path6.join(binDir, "..", "share", "postgresql", "postgres.bki"),
|
|
4331
|
+
path6.join(binDir, "..", "share", "postgres.bki")
|
|
4093
4332
|
]) {
|
|
4094
4333
|
try {
|
|
4095
4334
|
await stat(candidatePath);
|
|
4096
|
-
return
|
|
4335
|
+
return path6.dirname(candidatePath);
|
|
4097
4336
|
} catch {
|
|
4098
4337
|
}
|
|
4099
4338
|
}
|
|
4100
4339
|
const debianSharedir = debianSharedirCandidate(binDir);
|
|
4101
4340
|
if (debianSharedir) {
|
|
4102
4341
|
try {
|
|
4103
|
-
await stat(
|
|
4342
|
+
await stat(path6.join(debianSharedir, "postgres.bki"));
|
|
4104
4343
|
return debianSharedir;
|
|
4105
4344
|
} catch {
|
|
4106
4345
|
}
|
|
4107
4346
|
}
|
|
4108
|
-
const pgConfigPath =
|
|
4347
|
+
const pgConfigPath = path6.join(binDir, process.platform === "win32" ? "pg_config.exe" : "pg_config");
|
|
4109
4348
|
try {
|
|
4110
4349
|
await stat(pgConfigPath);
|
|
4111
4350
|
const sharedir = execFileSync(pgConfigPath, ["--sharedir"], { encoding: "utf8" }).trim();
|
|
4112
4351
|
if (!sharedir) return null;
|
|
4113
|
-
const candidatePath =
|
|
4352
|
+
const candidatePath = path6.join(sharedir, "postgres.bki");
|
|
4114
4353
|
await stat(candidatePath);
|
|
4115
4354
|
return sharedir;
|
|
4116
4355
|
} catch {
|
|
@@ -4121,14 +4360,14 @@ async function assertRuntimePostgresBinDirComplete(cacheDir, binDir) {
|
|
|
4121
4360
|
const requiredBinaries = ["initdb", "pg_ctl", "postgres"];
|
|
4122
4361
|
const missing = [];
|
|
4123
4362
|
for (const binary of requiredBinaries) {
|
|
4124
|
-
const binaryPath =
|
|
4363
|
+
const binaryPath = path6.join(binDir, runtimePostgresExecutableName(binary));
|
|
4125
4364
|
try {
|
|
4126
4365
|
await stat(binaryPath);
|
|
4127
4366
|
} catch {
|
|
4128
4367
|
missing.push(binaryPath);
|
|
4129
4368
|
}
|
|
4130
4369
|
}
|
|
4131
|
-
const expectedTemplatePath =
|
|
4370
|
+
const expectedTemplatePath = path6.join(binDir, "..", "share", "postgresql", "postgres.bki");
|
|
4132
4371
|
const templateDir = await resolveRuntimePostgresTemplateDir(binDir);
|
|
4133
4372
|
if (!templateDir) missing.push(expectedTemplatePath);
|
|
4134
4373
|
if (missing.length > 0) {
|
|
@@ -4144,25 +4383,28 @@ function readPostgresVersion(postgresBinary) {
|
|
|
4144
4383
|
async function isRuntimePostgresPayloadUsable(cacheDir, binDir, postgresVersionProbe) {
|
|
4145
4384
|
try {
|
|
4146
4385
|
await assertRuntimePostgresBinDirComplete(cacheDir, binDir);
|
|
4147
|
-
const postgresBinary =
|
|
4386
|
+
const postgresBinary = path6.join(binDir, runtimePostgresExecutableName("postgres"));
|
|
4148
4387
|
const result = postgresVersionProbe(postgresBinary);
|
|
4149
4388
|
return /\bPostgreSQL\)?\s+18\.4\b/i.test(result);
|
|
4150
4389
|
} catch {
|
|
4151
4390
|
return false;
|
|
4152
4391
|
}
|
|
4153
4392
|
}
|
|
4154
|
-
async function stageRuntimePostgresPayload(cacheDir, enabled, postgresVersionProbe) {
|
|
4155
|
-
const targetPayloadRoot =
|
|
4393
|
+
async function stageRuntimePostgresPayload(cacheDir, homeDir, enabled, postgresVersionProbe) {
|
|
4394
|
+
const targetPayloadRoot = path6.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR);
|
|
4156
4395
|
const targetBinDir = resolveRuntimePostgresPayloadBinDir(cacheDir);
|
|
4157
|
-
const targetRuntimeDir =
|
|
4396
|
+
const targetRuntimeDir = path6.dirname(targetBinDir);
|
|
4158
4397
|
if (await isRuntimePostgresPayloadUsable(cacheDir, targetBinDir, postgresVersionProbe)) {
|
|
4159
4398
|
return { output: "", binDir: targetBinDir };
|
|
4160
4399
|
}
|
|
4161
4400
|
if (!enabled) return { output: "" };
|
|
4162
|
-
const
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4401
|
+
const explicitSourceBinDir = process.env[RUDDER_POSTGRES_BIN_DIR_ENV]?.trim();
|
|
4402
|
+
const resolvedSourceBinDir = explicitSourceBinDir ? path6.resolve(explicitSourceBinDir) : resolveSharedRuntimePostgresPayloadBinDir(homeDir);
|
|
4403
|
+
if (explicitSourceBinDir) {
|
|
4404
|
+
await assertRuntimePostgresBinDirComplete(cacheDir, resolvedSourceBinDir);
|
|
4405
|
+
} else if (!await isRuntimePostgresPayloadUsable(cacheDir, resolvedSourceBinDir, postgresVersionProbe)) {
|
|
4406
|
+
return { output: "" };
|
|
4407
|
+
}
|
|
4166
4408
|
const sourceTemplateDir = await resolveRuntimePostgresTemplateDir(resolvedSourceBinDir);
|
|
4167
4409
|
if (!sourceTemplateDir) {
|
|
4168
4410
|
throw new RuntimeInstallError(
|
|
@@ -4170,7 +4412,7 @@ async function stageRuntimePostgresPayload(cacheDir, enabled, postgresVersionPro
|
|
|
4170
4412
|
{ cacheDir, command: "validate PostgreSQL 18.4 runtime payload", output: "" }
|
|
4171
4413
|
);
|
|
4172
4414
|
}
|
|
4173
|
-
const postgresBinary =
|
|
4415
|
+
const postgresBinary = path6.join(resolvedSourceBinDir, runtimePostgresExecutableName("postgres"));
|
|
4174
4416
|
const result = postgresVersionProbe(postgresBinary);
|
|
4175
4417
|
if (!/\bPostgreSQL\)?\s+18\.4\b/i.test(result)) {
|
|
4176
4418
|
throw new RuntimeInstallError(
|
|
@@ -4179,12 +4421,12 @@ async function stageRuntimePostgresPayload(cacheDir, enabled, postgresVersionPro
|
|
|
4179
4421
|
);
|
|
4180
4422
|
}
|
|
4181
4423
|
await rm(targetPayloadRoot, { recursive: true, force: true });
|
|
4182
|
-
await mkdir(
|
|
4183
|
-
await cp(
|
|
4184
|
-
const targetShareDir =
|
|
4185
|
-
const targetTemplateDir =
|
|
4424
|
+
await mkdir(path6.dirname(targetBinDir), { recursive: true });
|
|
4425
|
+
await cp(path6.resolve(resolvedSourceBinDir, ".."), targetRuntimeDir, { recursive: true });
|
|
4426
|
+
const targetShareDir = path6.join(targetRuntimeDir, "share");
|
|
4427
|
+
const targetTemplateDir = path6.join(targetShareDir, "postgresql");
|
|
4186
4428
|
await rm(targetShareDir, { recursive: true, force: true });
|
|
4187
|
-
await mkdir(
|
|
4429
|
+
await mkdir(path6.dirname(targetTemplateDir), { recursive: true });
|
|
4188
4430
|
await cp(sourceTemplateDir, targetTemplateDir, { recursive: true });
|
|
4189
4431
|
return { output: `staged PostgreSQL 18.4 runtime payload at ${targetBinDir}`, binDir: targetBinDir };
|
|
4190
4432
|
}
|
|
@@ -4246,13 +4488,13 @@ async function pruneRuntimeCache(options = {}) {
|
|
|
4246
4488
|
};
|
|
4247
4489
|
}
|
|
4248
4490
|
async function scanRuntimeCacheEntries(homeDir) {
|
|
4249
|
-
const runtimesDir =
|
|
4491
|
+
const runtimesDir = path6.join(homeDir, "runtimes");
|
|
4250
4492
|
const dirents = await readdir(runtimesDir, { withFileTypes: true }).catch(() => null);
|
|
4251
4493
|
if (!dirents) return [];
|
|
4252
4494
|
const entries = [];
|
|
4253
4495
|
for (const dirent of dirents) {
|
|
4254
4496
|
if (!dirent.isDirectory()) continue;
|
|
4255
|
-
const cacheDir =
|
|
4497
|
+
const cacheDir = path6.join(runtimesDir, dirent.name);
|
|
4256
4498
|
const metadata = await readRuntimeInstallMetadata(cacheDir);
|
|
4257
4499
|
if (!metadata) continue;
|
|
4258
4500
|
const fallbackStat = await safeStat(cacheDir);
|
|
@@ -4285,7 +4527,7 @@ async function directorySizeBytes(targetPath) {
|
|
|
4285
4527
|
if (!dirents) return 0;
|
|
4286
4528
|
let total = 0;
|
|
4287
4529
|
for (const dirent of dirents) {
|
|
4288
|
-
const entryPath =
|
|
4530
|
+
const entryPath = path6.join(targetPath, dirent.name);
|
|
4289
4531
|
if (dirent.isSymbolicLink()) continue;
|
|
4290
4532
|
if (dirent.isDirectory()) {
|
|
4291
4533
|
total += await directorySizeBytes(entryPath);
|
|
@@ -4297,14 +4539,14 @@ async function directorySizeBytes(targetPath) {
|
|
|
4297
4539
|
return total;
|
|
4298
4540
|
}
|
|
4299
4541
|
async function readActiveRuntimeVersions(homeDir) {
|
|
4300
|
-
const instancesDir =
|
|
4542
|
+
const instancesDir = path6.join(homeDir, "instances");
|
|
4301
4543
|
const dirents = await readdir(instancesDir, { withFileTypes: true }).catch(() => null);
|
|
4302
4544
|
if (!dirents) return [];
|
|
4303
4545
|
const versions = /* @__PURE__ */ new Set();
|
|
4304
4546
|
for (const dirent of dirents) {
|
|
4305
4547
|
if (!dirent.isDirectory()) continue;
|
|
4306
4548
|
try {
|
|
4307
|
-
const descriptorPath =
|
|
4549
|
+
const descriptorPath = path6.join(instancesDir, dirent.name, "runtime", "server.json");
|
|
4308
4550
|
const parsed = JSON.parse(await readFile(descriptorPath, "utf8"));
|
|
4309
4551
|
if (typeof parsed.version !== "string") continue;
|
|
4310
4552
|
if (typeof parsed.pid === "number" && Number.isInteger(parsed.pid) && parsed.pid > 0 && isPidRunning(parsed.pid)) {
|
|
@@ -4458,8 +4700,8 @@ var init_install = __esm({
|
|
|
4458
4700
|
|
|
4459
4701
|
// src/runtime/server-entry.ts
|
|
4460
4702
|
import fs4 from "node:fs";
|
|
4461
|
-
import
|
|
4462
|
-
import { fileURLToPath as
|
|
4703
|
+
import path7 from "node:path";
|
|
4704
|
+
import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
4463
4705
|
function formatError(err) {
|
|
4464
4706
|
if (err instanceof Error) {
|
|
4465
4707
|
if (err.message && err.message.trim().length > 0) return err.message;
|
|
@@ -4480,8 +4722,8 @@ function maybeEnableUiDevMiddleware(entrypoint) {
|
|
|
4480
4722
|
}
|
|
4481
4723
|
}
|
|
4482
4724
|
function resolveDevServerEntry() {
|
|
4483
|
-
const projectRoot =
|
|
4484
|
-
return
|
|
4725
|
+
const projectRoot = path7.resolve(path7.dirname(fileURLToPath3(import.meta.url)), "../../..");
|
|
4726
|
+
return path7.resolve(projectRoot, "server/src/index.ts");
|
|
4485
4727
|
}
|
|
4486
4728
|
async function loadServerRuntimeModule(options) {
|
|
4487
4729
|
const devEntry = resolveDevServerEntry();
|
|
@@ -4531,46 +4773,6 @@ var init_server_entry = __esm({
|
|
|
4531
4773
|
}
|
|
4532
4774
|
});
|
|
4533
4775
|
|
|
4534
|
-
// src/version.ts
|
|
4535
|
-
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
4536
|
-
import path7 from "node:path";
|
|
4537
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
4538
|
-
function readPackageVersion(packagePath, expectedName) {
|
|
4539
|
-
if (!existsSync2(packagePath)) return null;
|
|
4540
|
-
try {
|
|
4541
|
-
const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
|
|
4542
|
-
if (parsed.name === expectedName && parsed.version) return parsed.version;
|
|
4543
|
-
} catch {
|
|
4544
|
-
return null;
|
|
4545
|
-
}
|
|
4546
|
-
return null;
|
|
4547
|
-
}
|
|
4548
|
-
function resolveCliVersion(moduleUrl = import.meta.url, env = process.env) {
|
|
4549
|
-
if (env.npm_package_name === CLI_PACKAGE_NAME && env.npm_package_version) {
|
|
4550
|
-
return env.npm_package_version;
|
|
4551
|
-
}
|
|
4552
|
-
const moduleDir = path7.dirname(fileURLToPath3(moduleUrl));
|
|
4553
|
-
const candidates = [
|
|
4554
|
-
path7.resolve(moduleDir, CLI_VERSION_MANIFEST),
|
|
4555
|
-
path7.resolve(moduleDir, "package.json"),
|
|
4556
|
-
path7.resolve(moduleDir, "../package.json"),
|
|
4557
|
-
path7.resolve(moduleDir, "../../package.json")
|
|
4558
|
-
];
|
|
4559
|
-
for (const candidate of candidates) {
|
|
4560
|
-
const version = readPackageVersion(candidate, CLI_PACKAGE_NAME);
|
|
4561
|
-
if (version) return version;
|
|
4562
|
-
}
|
|
4563
|
-
return "0.0.0";
|
|
4564
|
-
}
|
|
4565
|
-
var CLI_PACKAGE_NAME, CLI_VERSION_MANIFEST;
|
|
4566
|
-
var init_version = __esm({
|
|
4567
|
-
"src/version.ts"() {
|
|
4568
|
-
"use strict";
|
|
4569
|
-
CLI_PACKAGE_NAME = "@rudderhq/cli";
|
|
4570
|
-
CLI_VERSION_MANIFEST = "rudder-cli-package.json";
|
|
4571
|
-
}
|
|
4572
|
-
});
|
|
4573
|
-
|
|
4574
4776
|
// src/commands/auth-bootstrap-ceo.ts
|
|
4575
4777
|
import * as p2 from "@clack/prompts";
|
|
4576
4778
|
import pc2 from "picocolors";
|
|
@@ -6897,17 +7099,991 @@ var init_onboard = __esm({
|
|
|
6897
7099
|
}
|
|
6898
7100
|
});
|
|
6899
7101
|
|
|
6900
|
-
// src/program.ts
|
|
6901
|
-
import { Command, CommanderError } from "commander";
|
|
7102
|
+
// src/program.ts
|
|
7103
|
+
import { Command, CommanderError } from "commander";
|
|
7104
|
+
|
|
7105
|
+
// ../packages/agent-runtime-utils/dist/rudder-mcp-tool-descriptors.generated.js
|
|
7106
|
+
var RUDDER_MCP_TOOL_DESCRIPTORS = [
|
|
7107
|
+
{
|
|
7108
|
+
"capabilityId": "agent.me",
|
|
7109
|
+
"name": "rudder_agent_me",
|
|
7110
|
+
"description": "Show the authenticated agent identity, budget, and chain of command.",
|
|
7111
|
+
"mutating": false,
|
|
7112
|
+
"requiresOrgId": false,
|
|
7113
|
+
"requiresAgentId": false,
|
|
7114
|
+
"attachesRunIdWhenAvailable": false
|
|
7115
|
+
},
|
|
7116
|
+
{
|
|
7117
|
+
"capabilityId": "agent.inbox",
|
|
7118
|
+
"name": "rudder_agent_inbox",
|
|
7119
|
+
"description": "List the compact assignee and reviewer work inbox for the authenticated agent.",
|
|
7120
|
+
"mutating": false,
|
|
7121
|
+
"requiresOrgId": false,
|
|
7122
|
+
"requiresAgentId": false,
|
|
7123
|
+
"attachesRunIdWhenAvailable": false
|
|
7124
|
+
},
|
|
7125
|
+
{
|
|
7126
|
+
"capabilityId": "agent.capabilities",
|
|
7127
|
+
"name": "rudder_agent_capabilities",
|
|
7128
|
+
"description": "List the stable Rudder agent command contract.",
|
|
7129
|
+
"mutating": false,
|
|
7130
|
+
"requiresOrgId": false,
|
|
7131
|
+
"requiresAgentId": false,
|
|
7132
|
+
"attachesRunIdWhenAvailable": false
|
|
7133
|
+
},
|
|
7134
|
+
{
|
|
7135
|
+
"capabilityId": "agent.update",
|
|
7136
|
+
"name": "rudder_agent_update",
|
|
7137
|
+
"description": "Update an agent's control-plane identity fields; defaults to the authenticated agent.",
|
|
7138
|
+
"mutating": true,
|
|
7139
|
+
"requiresOrgId": false,
|
|
7140
|
+
"requiresAgentId": false,
|
|
7141
|
+
"attachesRunIdWhenAvailable": true
|
|
7142
|
+
},
|
|
7143
|
+
{
|
|
7144
|
+
"capabilityId": "agent.skills.create",
|
|
7145
|
+
"name": "rudder_agent_skills_create",
|
|
7146
|
+
"description": "Create an agent-private skill package under AGENT_HOME/skills.",
|
|
7147
|
+
"mutating": true,
|
|
7148
|
+
"requiresOrgId": false,
|
|
7149
|
+
"requiresAgentId": false,
|
|
7150
|
+
"attachesRunIdWhenAvailable": true
|
|
7151
|
+
},
|
|
7152
|
+
{
|
|
7153
|
+
"capabilityId": "agent.skills.enable",
|
|
7154
|
+
"name": "rudder_agent_skills_enable",
|
|
7155
|
+
"description": "Add skill selections to an agent without replacing existing enabled skills.",
|
|
7156
|
+
"mutating": true,
|
|
7157
|
+
"requiresOrgId": false,
|
|
7158
|
+
"requiresAgentId": false,
|
|
7159
|
+
"attachesRunIdWhenAvailable": true
|
|
7160
|
+
},
|
|
7161
|
+
{
|
|
7162
|
+
"capabilityId": "agent.skills.sync",
|
|
7163
|
+
"name": "rudder_agent_skills_sync",
|
|
7164
|
+
"description": "Sync the desired enabled skill set for an agent.",
|
|
7165
|
+
"mutating": true,
|
|
7166
|
+
"requiresOrgId": false,
|
|
7167
|
+
"requiresAgentId": false,
|
|
7168
|
+
"attachesRunIdWhenAvailable": true
|
|
7169
|
+
},
|
|
7170
|
+
{
|
|
7171
|
+
"capabilityId": "issue.get",
|
|
7172
|
+
"name": "rudder_issue_get",
|
|
7173
|
+
"description": "Read a full issue by UUID or identifier.",
|
|
7174
|
+
"mutating": false,
|
|
7175
|
+
"requiresOrgId": false,
|
|
7176
|
+
"requiresAgentId": false,
|
|
7177
|
+
"attachesRunIdWhenAvailable": false
|
|
7178
|
+
},
|
|
7179
|
+
{
|
|
7180
|
+
"capabilityId": "issue.search",
|
|
7181
|
+
"name": "rudder_issue_search",
|
|
7182
|
+
"description": "Search issues with the server-side issue index across title, identifier, description, and comments.",
|
|
7183
|
+
"mutating": false,
|
|
7184
|
+
"requiresOrgId": true,
|
|
7185
|
+
"requiresAgentId": false,
|
|
7186
|
+
"attachesRunIdWhenAvailable": false
|
|
7187
|
+
},
|
|
7188
|
+
{
|
|
7189
|
+
"capabilityId": "issue.context",
|
|
7190
|
+
"name": "rudder_issue_context",
|
|
7191
|
+
"description": "Read the compact heartbeat context for an issue; wake comments may be addressed by full id or cmt_<uuid-prefix>.",
|
|
7192
|
+
"mutating": false,
|
|
7193
|
+
"requiresOrgId": false,
|
|
7194
|
+
"requiresAgentId": false,
|
|
7195
|
+
"attachesRunIdWhenAvailable": false
|
|
7196
|
+
},
|
|
7197
|
+
{
|
|
7198
|
+
"capabilityId": "issue.checkout",
|
|
7199
|
+
"name": "rudder_issue_checkout",
|
|
7200
|
+
"description": "Atomically checkout an issue for the current or specified agent.",
|
|
7201
|
+
"mutating": true,
|
|
7202
|
+
"requiresOrgId": false,
|
|
7203
|
+
"requiresAgentId": true,
|
|
7204
|
+
"attachesRunIdWhenAvailable": true
|
|
7205
|
+
},
|
|
7206
|
+
{
|
|
7207
|
+
"capabilityId": "issue.comment",
|
|
7208
|
+
"name": "rudder_issue_comment",
|
|
7209
|
+
"description": "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
|
|
7210
|
+
"mutating": true,
|
|
7211
|
+
"requiresOrgId": false,
|
|
7212
|
+
"requiresAgentId": false,
|
|
7213
|
+
"attachesRunIdWhenAvailable": true
|
|
7214
|
+
},
|
|
7215
|
+
{
|
|
7216
|
+
"capabilityId": "issue.comments.list",
|
|
7217
|
+
"name": "rudder_issue_comments_list",
|
|
7218
|
+
"description": "List issue comments, optionally only newer comments after a full comment id or cmt_<uuid-prefix> with --after.",
|
|
7219
|
+
"mutating": false,
|
|
7220
|
+
"requiresOrgId": false,
|
|
7221
|
+
"requiresAgentId": false,
|
|
7222
|
+
"attachesRunIdWhenAvailable": false
|
|
7223
|
+
},
|
|
7224
|
+
{
|
|
7225
|
+
"capabilityId": "issue.comments.get",
|
|
7226
|
+
"name": "rudder_issue_comments_get",
|
|
7227
|
+
"description": "Read one issue comment by full id or cmt_<uuid-prefix> scoped to the issue.",
|
|
7228
|
+
"mutating": false,
|
|
7229
|
+
"requiresOrgId": false,
|
|
7230
|
+
"requiresAgentId": false,
|
|
7231
|
+
"attachesRunIdWhenAvailable": false
|
|
7232
|
+
},
|
|
7233
|
+
{
|
|
7234
|
+
"capabilityId": "issue.update",
|
|
7235
|
+
"name": "rudder_issue_update",
|
|
7236
|
+
"description": "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
|
|
7237
|
+
"mutating": true,
|
|
7238
|
+
"requiresOrgId": false,
|
|
7239
|
+
"requiresAgentId": false,
|
|
7240
|
+
"attachesRunIdWhenAvailable": true
|
|
7241
|
+
},
|
|
7242
|
+
{
|
|
7243
|
+
"capabilityId": "issue.review",
|
|
7244
|
+
"name": "rudder_issue_review",
|
|
7245
|
+
"description": "Record a structured reviewer decision with a required comment.",
|
|
7246
|
+
"mutating": true,
|
|
7247
|
+
"requiresOrgId": false,
|
|
7248
|
+
"requiresAgentId": false,
|
|
7249
|
+
"attachesRunIdWhenAvailable": true
|
|
7250
|
+
},
|
|
7251
|
+
{
|
|
7252
|
+
"capabilityId": "issue.commit",
|
|
7253
|
+
"name": "rudder_issue_commit",
|
|
7254
|
+
"description": "Report a code commit created during issue work as structured issue activity.",
|
|
7255
|
+
"mutating": true,
|
|
7256
|
+
"requiresOrgId": false,
|
|
7257
|
+
"requiresAgentId": false,
|
|
7258
|
+
"attachesRunIdWhenAvailable": true
|
|
7259
|
+
},
|
|
7260
|
+
{
|
|
7261
|
+
"capabilityId": "issue.done",
|
|
7262
|
+
"name": "rudder_issue_done",
|
|
7263
|
+
"description": "Mark an issue done with a required completion comment, optionally uploading images.",
|
|
7264
|
+
"mutating": true,
|
|
7265
|
+
"requiresOrgId": false,
|
|
7266
|
+
"requiresAgentId": false,
|
|
7267
|
+
"attachesRunIdWhenAvailable": true
|
|
7268
|
+
},
|
|
7269
|
+
{
|
|
7270
|
+
"capabilityId": "issue.block",
|
|
7271
|
+
"name": "rudder_issue_block",
|
|
7272
|
+
"description": "Mark an issue blocked with a required blocker comment, optionally uploading images.",
|
|
7273
|
+
"mutating": true,
|
|
7274
|
+
"requiresOrgId": false,
|
|
7275
|
+
"requiresAgentId": false,
|
|
7276
|
+
"attachesRunIdWhenAvailable": true
|
|
7277
|
+
},
|
|
7278
|
+
{
|
|
7279
|
+
"capabilityId": "project.list",
|
|
7280
|
+
"name": "rudder_project_list",
|
|
7281
|
+
"description": "List projects in an organization.",
|
|
7282
|
+
"mutating": false,
|
|
7283
|
+
"requiresOrgId": true,
|
|
7284
|
+
"requiresAgentId": false,
|
|
7285
|
+
"attachesRunIdWhenAvailable": false
|
|
7286
|
+
},
|
|
7287
|
+
{
|
|
7288
|
+
"capabilityId": "project.get",
|
|
7289
|
+
"name": "rudder_project_get",
|
|
7290
|
+
"description": "Read one project by ID or shortname.",
|
|
7291
|
+
"mutating": false,
|
|
7292
|
+
"requiresOrgId": false,
|
|
7293
|
+
"requiresAgentId": false,
|
|
7294
|
+
"attachesRunIdWhenAvailable": false
|
|
7295
|
+
},
|
|
7296
|
+
{
|
|
7297
|
+
"capabilityId": "project.create",
|
|
7298
|
+
"name": "rudder_project_create",
|
|
7299
|
+
"description": "Create a project in the organization.",
|
|
7300
|
+
"mutating": true,
|
|
7301
|
+
"requiresOrgId": true,
|
|
7302
|
+
"requiresAgentId": false,
|
|
7303
|
+
"attachesRunIdWhenAvailable": true
|
|
7304
|
+
},
|
|
7305
|
+
{
|
|
7306
|
+
"capabilityId": "project.update",
|
|
7307
|
+
"name": "rudder_project_update",
|
|
7308
|
+
"description": "Update mutable project fields such as name, description, status, goals, lead agent, target date, color, or archivedAt.",
|
|
7309
|
+
"mutating": true,
|
|
7310
|
+
"requiresOrgId": false,
|
|
7311
|
+
"requiresAgentId": false,
|
|
7312
|
+
"attachesRunIdWhenAvailable": true
|
|
7313
|
+
},
|
|
7314
|
+
{
|
|
7315
|
+
"capabilityId": "user.activity",
|
|
7316
|
+
"name": "rudder_user_activity",
|
|
7317
|
+
"description": "Read a user-centered activity ledger with safe excerpts and provenance across chats, issue comments, approval comments, and user actor activity.",
|
|
7318
|
+
"mutating": false,
|
|
7319
|
+
"requiresOrgId": true,
|
|
7320
|
+
"requiresAgentId": false,
|
|
7321
|
+
"attachesRunIdWhenAvailable": false
|
|
7322
|
+
},
|
|
7323
|
+
{
|
|
7324
|
+
"capabilityId": "library.file.list",
|
|
7325
|
+
"name": "rudder_library_file_list",
|
|
7326
|
+
"description": "List Library files and folders; file rows include `libraryEntryId` when a strong reference can be generated.",
|
|
7327
|
+
"mutating": false,
|
|
7328
|
+
"requiresOrgId": true,
|
|
7329
|
+
"requiresAgentId": false,
|
|
7330
|
+
"attachesRunIdWhenAvailable": false
|
|
7331
|
+
},
|
|
7332
|
+
{
|
|
7333
|
+
"capabilityId": "library.file.get",
|
|
7334
|
+
"name": "rudder_library_file_get",
|
|
7335
|
+
"description": "Fallback read when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
|
|
7336
|
+
"mutating": false,
|
|
7337
|
+
"requiresOrgId": true,
|
|
7338
|
+
"requiresAgentId": false,
|
|
7339
|
+
"attachesRunIdWhenAvailable": false
|
|
7340
|
+
},
|
|
7341
|
+
{
|
|
7342
|
+
"capabilityId": "library.file.ref",
|
|
7343
|
+
"name": "rudder_library_file_ref",
|
|
7344
|
+
"description": "Return the stable Markdown reference for one Library file without printing file content.",
|
|
7345
|
+
"mutating": false,
|
|
7346
|
+
"requiresOrgId": true,
|
|
7347
|
+
"requiresAgentId": false,
|
|
7348
|
+
"attachesRunIdWhenAvailable": false
|
|
7349
|
+
},
|
|
7350
|
+
{
|
|
7351
|
+
"capabilityId": "library.file.link",
|
|
7352
|
+
"name": "rudder_library_file_link",
|
|
7353
|
+
"description": "Compatibility alias for `rudder library file ref <path>`.",
|
|
7354
|
+
"mutating": false,
|
|
7355
|
+
"requiresOrgId": true,
|
|
7356
|
+
"requiresAgentId": false,
|
|
7357
|
+
"attachesRunIdWhenAvailable": false
|
|
7358
|
+
},
|
|
7359
|
+
{
|
|
7360
|
+
"capabilityId": "library.file.put",
|
|
7361
|
+
"name": "rudder_library_file_put",
|
|
7362
|
+
"description": "Fallback create/update when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
|
|
7363
|
+
"mutating": true,
|
|
7364
|
+
"requiresOrgId": true,
|
|
7365
|
+
"requiresAgentId": false,
|
|
7366
|
+
"attachesRunIdWhenAvailable": true
|
|
7367
|
+
},
|
|
7368
|
+
{
|
|
7369
|
+
"capabilityId": "approval.get",
|
|
7370
|
+
"name": "rudder_approval_get",
|
|
7371
|
+
"description": "Read one approval request.",
|
|
7372
|
+
"mutating": false,
|
|
7373
|
+
"requiresOrgId": false,
|
|
7374
|
+
"requiresAgentId": false,
|
|
7375
|
+
"attachesRunIdWhenAvailable": false
|
|
7376
|
+
},
|
|
7377
|
+
{
|
|
7378
|
+
"capabilityId": "approval.issues",
|
|
7379
|
+
"name": "rudder_approval_issues",
|
|
7380
|
+
"description": "List the issues linked to an approval.",
|
|
7381
|
+
"mutating": false,
|
|
7382
|
+
"requiresOrgId": false,
|
|
7383
|
+
"requiresAgentId": false,
|
|
7384
|
+
"attachesRunIdWhenAvailable": false
|
|
7385
|
+
},
|
|
7386
|
+
{
|
|
7387
|
+
"capabilityId": "approval.comment",
|
|
7388
|
+
"name": "rudder_approval_comment",
|
|
7389
|
+
"description": "Add a comment to an approval.",
|
|
7390
|
+
"mutating": true,
|
|
7391
|
+
"requiresOrgId": false,
|
|
7392
|
+
"requiresAgentId": false,
|
|
7393
|
+
"attachesRunIdWhenAvailable": true
|
|
7394
|
+
},
|
|
7395
|
+
{
|
|
7396
|
+
"capabilityId": "skill.list",
|
|
7397
|
+
"name": "rudder_skill_list",
|
|
7398
|
+
"description": "List organization-visible skills.",
|
|
7399
|
+
"mutating": false,
|
|
7400
|
+
"requiresOrgId": true,
|
|
7401
|
+
"requiresAgentId": false,
|
|
7402
|
+
"attachesRunIdWhenAvailable": false
|
|
7403
|
+
},
|
|
7404
|
+
{
|
|
7405
|
+
"capabilityId": "skill.get",
|
|
7406
|
+
"name": "rudder_skill_get",
|
|
7407
|
+
"description": "Read one organization skill detail.",
|
|
7408
|
+
"mutating": false,
|
|
7409
|
+
"requiresOrgId": true,
|
|
7410
|
+
"requiresAgentId": false,
|
|
7411
|
+
"attachesRunIdWhenAvailable": false
|
|
7412
|
+
},
|
|
7413
|
+
{
|
|
7414
|
+
"capabilityId": "skill.file",
|
|
7415
|
+
"name": "rudder_skill_file",
|
|
7416
|
+
"description": "Read one file from an organization skill package.",
|
|
7417
|
+
"mutating": false,
|
|
7418
|
+
"requiresOrgId": true,
|
|
7419
|
+
"requiresAgentId": false,
|
|
7420
|
+
"attachesRunIdWhenAvailable": false
|
|
7421
|
+
},
|
|
7422
|
+
{
|
|
7423
|
+
"capabilityId": "skill.import",
|
|
7424
|
+
"name": "rudder_skill_import",
|
|
7425
|
+
"description": "Import a skill package into the organization skill library.",
|
|
7426
|
+
"mutating": true,
|
|
7427
|
+
"requiresOrgId": true,
|
|
7428
|
+
"requiresAgentId": false,
|
|
7429
|
+
"attachesRunIdWhenAvailable": true
|
|
7430
|
+
},
|
|
7431
|
+
{
|
|
7432
|
+
"capabilityId": "skill.scan-local",
|
|
7433
|
+
"name": "rudder_skill_scan_local",
|
|
7434
|
+
"description": "Scan local roots for skill packages and import new ones.",
|
|
7435
|
+
"mutating": true,
|
|
7436
|
+
"requiresOrgId": true,
|
|
7437
|
+
"requiresAgentId": false,
|
|
7438
|
+
"attachesRunIdWhenAvailable": true
|
|
7439
|
+
},
|
|
7440
|
+
{
|
|
7441
|
+
"capabilityId": "skill.scan-projects",
|
|
7442
|
+
"name": "rudder_skill_scan_projects",
|
|
7443
|
+
"description": "Scan the org workspace and any legacy project workspace records for skill packages and import new ones.",
|
|
7444
|
+
"mutating": true,
|
|
7445
|
+
"requiresOrgId": true,
|
|
7446
|
+
"requiresAgentId": false,
|
|
7447
|
+
"attachesRunIdWhenAvailable": true
|
|
7448
|
+
},
|
|
7449
|
+
{
|
|
7450
|
+
"capabilityId": "browser.tabs",
|
|
7451
|
+
"name": "rudder_browser_tabs",
|
|
7452
|
+
"description": "List Browser tabs owned by the current Rudder agent run.",
|
|
7453
|
+
"mutating": false,
|
|
7454
|
+
"requiresOrgId": true,
|
|
7455
|
+
"requiresAgentId": true,
|
|
7456
|
+
"attachesRunIdWhenAvailable": false
|
|
7457
|
+
},
|
|
7458
|
+
{
|
|
7459
|
+
"capabilityId": "browser.open",
|
|
7460
|
+
"name": "rudder_browser_open",
|
|
7461
|
+
"description": "Open a run-owned tab in the Rudder Browser.",
|
|
7462
|
+
"mutating": true,
|
|
7463
|
+
"requiresOrgId": true,
|
|
7464
|
+
"requiresAgentId": true,
|
|
7465
|
+
"attachesRunIdWhenAvailable": true
|
|
7466
|
+
},
|
|
7467
|
+
{
|
|
7468
|
+
"capabilityId": "browser.navigate",
|
|
7469
|
+
"name": "rudder_browser_navigate",
|
|
7470
|
+
"description": "Navigate a run-owned Rudder Browser tab.",
|
|
7471
|
+
"mutating": true,
|
|
7472
|
+
"requiresOrgId": true,
|
|
7473
|
+
"requiresAgentId": true,
|
|
7474
|
+
"attachesRunIdWhenAvailable": true
|
|
7475
|
+
},
|
|
7476
|
+
{
|
|
7477
|
+
"capabilityId": "browser.read",
|
|
7478
|
+
"name": "rudder_browser_read",
|
|
7479
|
+
"description": "Read a structured snapshot from a run-owned Rudder Browser tab.",
|
|
7480
|
+
"mutating": false,
|
|
7481
|
+
"requiresOrgId": true,
|
|
7482
|
+
"requiresAgentId": true,
|
|
7483
|
+
"attachesRunIdWhenAvailable": false
|
|
7484
|
+
},
|
|
7485
|
+
{
|
|
7486
|
+
"capabilityId": "browser.click",
|
|
7487
|
+
"name": "rudder_browser_click",
|
|
7488
|
+
"description": "Click an element reference returned by Rudder Browser read.",
|
|
7489
|
+
"mutating": true,
|
|
7490
|
+
"requiresOrgId": true,
|
|
7491
|
+
"requiresAgentId": true,
|
|
7492
|
+
"attachesRunIdWhenAvailable": true
|
|
7493
|
+
},
|
|
7494
|
+
{
|
|
7495
|
+
"capabilityId": "browser.type",
|
|
7496
|
+
"name": "rudder_browser_type",
|
|
7497
|
+
"description": "Type into an element reference in a run-owned Rudder Browser tab.",
|
|
7498
|
+
"mutating": true,
|
|
7499
|
+
"requiresOrgId": true,
|
|
7500
|
+
"requiresAgentId": true,
|
|
7501
|
+
"attachesRunIdWhenAvailable": true
|
|
7502
|
+
},
|
|
7503
|
+
{
|
|
7504
|
+
"capabilityId": "browser.screenshot",
|
|
7505
|
+
"name": "rudder_browser_screenshot",
|
|
7506
|
+
"description": "Capture a screenshot of a run-owned Rudder Browser tab.",
|
|
7507
|
+
"mutating": false,
|
|
7508
|
+
"requiresOrgId": true,
|
|
7509
|
+
"requiresAgentId": true,
|
|
7510
|
+
"attachesRunIdWhenAvailable": false
|
|
7511
|
+
},
|
|
7512
|
+
{
|
|
7513
|
+
"capabilityId": "browser.close",
|
|
7514
|
+
"name": "rudder_browser_close",
|
|
7515
|
+
"description": "Close a run-owned Rudder Browser tab.",
|
|
7516
|
+
"mutating": true,
|
|
7517
|
+
"requiresOrgId": true,
|
|
7518
|
+
"requiresAgentId": true,
|
|
7519
|
+
"attachesRunIdWhenAvailable": true
|
|
7520
|
+
},
|
|
7521
|
+
{
|
|
7522
|
+
"capabilityId": "automation.list",
|
|
7523
|
+
"name": "rudder_automation_list",
|
|
7524
|
+
"description": "List automations for an organization with compact local filters.",
|
|
7525
|
+
"mutating": false,
|
|
7526
|
+
"requiresOrgId": true,
|
|
7527
|
+
"requiresAgentId": false,
|
|
7528
|
+
"attachesRunIdWhenAvailable": false
|
|
7529
|
+
},
|
|
7530
|
+
{
|
|
7531
|
+
"capabilityId": "automation.get",
|
|
7532
|
+
"name": "rudder_automation_get",
|
|
7533
|
+
"description": "Read one automation detail including triggers and recent runs.",
|
|
7534
|
+
"mutating": false,
|
|
7535
|
+
"requiresOrgId": false,
|
|
7536
|
+
"requiresAgentId": false,
|
|
7537
|
+
"attachesRunIdWhenAvailable": false
|
|
7538
|
+
},
|
|
7539
|
+
{
|
|
7540
|
+
"capabilityId": "automation.runs",
|
|
7541
|
+
"name": "rudder_automation_runs",
|
|
7542
|
+
"description": "List recent runs for one automation.",
|
|
7543
|
+
"mutating": false,
|
|
7544
|
+
"requiresOrgId": false,
|
|
7545
|
+
"requiresAgentId": false,
|
|
7546
|
+
"attachesRunIdWhenAvailable": false
|
|
7547
|
+
},
|
|
7548
|
+
{
|
|
7549
|
+
"capabilityId": "automation.triggers.list",
|
|
7550
|
+
"name": "rudder_automation_triggers_list",
|
|
7551
|
+
"description": "List triggers configured for one automation.",
|
|
7552
|
+
"mutating": false,
|
|
7553
|
+
"requiresOrgId": false,
|
|
7554
|
+
"requiresAgentId": false,
|
|
7555
|
+
"attachesRunIdWhenAvailable": false
|
|
7556
|
+
},
|
|
7557
|
+
{
|
|
7558
|
+
"capabilityId": "automation.triggers.create",
|
|
7559
|
+
"name": "rudder_automation_triggers_create",
|
|
7560
|
+
"description": "Create a schedule, webhook, or API trigger through the governed automation API.",
|
|
7561
|
+
"mutating": true,
|
|
7562
|
+
"requiresOrgId": false,
|
|
7563
|
+
"requiresAgentId": false,
|
|
7564
|
+
"attachesRunIdWhenAvailable": true
|
|
7565
|
+
},
|
|
7566
|
+
{
|
|
7567
|
+
"capabilityId": "automation.triggers.update",
|
|
7568
|
+
"name": "rudder_automation_triggers_update",
|
|
7569
|
+
"description": "Update an automation trigger through the governed automation API.",
|
|
7570
|
+
"mutating": true,
|
|
7571
|
+
"requiresOrgId": false,
|
|
7572
|
+
"requiresAgentId": false,
|
|
7573
|
+
"attachesRunIdWhenAvailable": true
|
|
7574
|
+
},
|
|
7575
|
+
{
|
|
7576
|
+
"capabilityId": "automation.triggers.delete",
|
|
7577
|
+
"name": "rudder_automation_triggers_delete",
|
|
7578
|
+
"description": "Delete an automation trigger through the governed automation API.",
|
|
7579
|
+
"mutating": true,
|
|
7580
|
+
"requiresOrgId": false,
|
|
7581
|
+
"requiresAgentId": false,
|
|
7582
|
+
"attachesRunIdWhenAvailable": true
|
|
7583
|
+
},
|
|
7584
|
+
{
|
|
7585
|
+
"capabilityId": "automation.triggers.rotate-secret",
|
|
7586
|
+
"name": "rudder_automation_triggers_rotate_secret",
|
|
7587
|
+
"description": "Rotate an automation webhook trigger secret through the governed automation API.",
|
|
7588
|
+
"mutating": true,
|
|
7589
|
+
"requiresOrgId": false,
|
|
7590
|
+
"requiresAgentId": false,
|
|
7591
|
+
"attachesRunIdWhenAvailable": true
|
|
7592
|
+
},
|
|
7593
|
+
{
|
|
7594
|
+
"capabilityId": "automation.create",
|
|
7595
|
+
"name": "rudder_automation_create",
|
|
7596
|
+
"description": "Create an automation through the governed automation API.",
|
|
7597
|
+
"mutating": true,
|
|
7598
|
+
"requiresOrgId": true,
|
|
7599
|
+
"requiresAgentId": false,
|
|
7600
|
+
"attachesRunIdWhenAvailable": true
|
|
7601
|
+
},
|
|
7602
|
+
{
|
|
7603
|
+
"capabilityId": "automation.update",
|
|
7604
|
+
"name": "rudder_automation_update",
|
|
7605
|
+
"description": "Update automation fields through the governed automation API.",
|
|
7606
|
+
"mutating": true,
|
|
7607
|
+
"requiresOrgId": false,
|
|
7608
|
+
"requiresAgentId": false,
|
|
7609
|
+
"attachesRunIdWhenAvailable": true
|
|
7610
|
+
},
|
|
7611
|
+
{
|
|
7612
|
+
"capabilityId": "automation.enable",
|
|
7613
|
+
"name": "rudder_automation_enable",
|
|
7614
|
+
"description": "Enable an automation by setting status to active.",
|
|
7615
|
+
"mutating": true,
|
|
7616
|
+
"requiresOrgId": false,
|
|
7617
|
+
"requiresAgentId": false,
|
|
7618
|
+
"attachesRunIdWhenAvailable": true
|
|
7619
|
+
},
|
|
7620
|
+
{
|
|
7621
|
+
"capabilityId": "automation.disable",
|
|
7622
|
+
"name": "rudder_automation_disable",
|
|
7623
|
+
"description": "Disable an automation by setting status to paused.",
|
|
7624
|
+
"mutating": true,
|
|
7625
|
+
"requiresOrgId": false,
|
|
7626
|
+
"requiresAgentId": false,
|
|
7627
|
+
"attachesRunIdWhenAvailable": true
|
|
7628
|
+
},
|
|
7629
|
+
{
|
|
7630
|
+
"capabilityId": "automation.run",
|
|
7631
|
+
"name": "rudder_automation_run",
|
|
7632
|
+
"description": "Trigger a manual automation run.",
|
|
7633
|
+
"mutating": true,
|
|
7634
|
+
"requiresOrgId": false,
|
|
7635
|
+
"requiresAgentId": false,
|
|
7636
|
+
"attachesRunIdWhenAvailable": true
|
|
7637
|
+
},
|
|
7638
|
+
{
|
|
7639
|
+
"capabilityId": "chat.list",
|
|
7640
|
+
"name": "rudder_chat_list",
|
|
7641
|
+
"description": "List chat conversations without dumping full message history.",
|
|
7642
|
+
"mutating": false,
|
|
7643
|
+
"requiresOrgId": true,
|
|
7644
|
+
"requiresAgentId": false,
|
|
7645
|
+
"attachesRunIdWhenAvailable": false
|
|
7646
|
+
},
|
|
7647
|
+
{
|
|
7648
|
+
"capabilityId": "chat.search",
|
|
7649
|
+
"name": "rudder_chat_search",
|
|
7650
|
+
"description": "Search chats with bounded snippets and optional scope filtering.",
|
|
7651
|
+
"mutating": false,
|
|
7652
|
+
"requiresOrgId": true,
|
|
7653
|
+
"requiresAgentId": false,
|
|
7654
|
+
"attachesRunIdWhenAvailable": false
|
|
7655
|
+
},
|
|
7656
|
+
{
|
|
7657
|
+
"capabilityId": "chat.get",
|
|
7658
|
+
"name": "rudder_chat_get",
|
|
7659
|
+
"description": "Read one chat conversation record.",
|
|
7660
|
+
"mutating": false,
|
|
7661
|
+
"requiresOrgId": false,
|
|
7662
|
+
"requiresAgentId": false,
|
|
7663
|
+
"attachesRunIdWhenAvailable": false
|
|
7664
|
+
},
|
|
7665
|
+
{
|
|
7666
|
+
"capabilityId": "chat.messages",
|
|
7667
|
+
"name": "rudder_chat_messages",
|
|
7668
|
+
"description": "Read bounded chat messages with page cursors; transcript output is omitted unless requested.",
|
|
7669
|
+
"mutating": false,
|
|
7670
|
+
"requiresOrgId": false,
|
|
7671
|
+
"requiresAgentId": false,
|
|
7672
|
+
"attachesRunIdWhenAvailable": false
|
|
7673
|
+
},
|
|
7674
|
+
{
|
|
7675
|
+
"capabilityId": "chat.transcript",
|
|
7676
|
+
"name": "rudder_chat_transcript",
|
|
7677
|
+
"description": "Read paginated chat messages with assistant transcript entries clipped in human output.",
|
|
7678
|
+
"mutating": false,
|
|
7679
|
+
"requiresOrgId": false,
|
|
7680
|
+
"requiresAgentId": false,
|
|
7681
|
+
"attachesRunIdWhenAvailable": false
|
|
7682
|
+
},
|
|
7683
|
+
{
|
|
7684
|
+
"capabilityId": "chat.read",
|
|
7685
|
+
"name": "rudder_chat_read",
|
|
7686
|
+
"description": "Read a bounded recent-message snapshot for one chat with page cursors.",
|
|
7687
|
+
"mutating": false,
|
|
7688
|
+
"requiresOrgId": false,
|
|
7689
|
+
"requiresAgentId": false,
|
|
7690
|
+
"attachesRunIdWhenAvailable": false
|
|
7691
|
+
},
|
|
7692
|
+
{
|
|
7693
|
+
"capabilityId": "chat.create",
|
|
7694
|
+
"name": "rudder_chat_create",
|
|
7695
|
+
"description": "Create a chat conversation.",
|
|
7696
|
+
"mutating": true,
|
|
7697
|
+
"requiresOrgId": true,
|
|
7698
|
+
"requiresAgentId": false,
|
|
7699
|
+
"attachesRunIdWhenAvailable": true
|
|
7700
|
+
},
|
|
7701
|
+
{
|
|
7702
|
+
"capabilityId": "chat.send",
|
|
7703
|
+
"name": "rudder_chat_send",
|
|
7704
|
+
"description": "Send an agent-authored message directly to the operator in a chat.",
|
|
7705
|
+
"mutating": true,
|
|
7706
|
+
"requiresOrgId": false,
|
|
7707
|
+
"requiresAgentId": true,
|
|
7708
|
+
"attachesRunIdWhenAvailable": true
|
|
7709
|
+
},
|
|
7710
|
+
{
|
|
7711
|
+
"capabilityId": "chat.archive",
|
|
7712
|
+
"name": "rudder_chat_archive",
|
|
7713
|
+
"description": "Archive a chat conversation without deleting it.",
|
|
7714
|
+
"mutating": true,
|
|
7715
|
+
"requiresOrgId": false,
|
|
7716
|
+
"requiresAgentId": false,
|
|
7717
|
+
"attachesRunIdWhenAvailable": true
|
|
7718
|
+
},
|
|
7719
|
+
{
|
|
7720
|
+
"capabilityId": "runs.list",
|
|
7721
|
+
"name": "rudder_runs_list",
|
|
7722
|
+
"description": "List lightweight run summaries with stable pagination and filters; use --full only for legacy full-row compatibility.",
|
|
7723
|
+
"mutating": false,
|
|
7724
|
+
"requiresOrgId": true,
|
|
7725
|
+
"requiresAgentId": false,
|
|
7726
|
+
"attachesRunIdWhenAvailable": false
|
|
7727
|
+
},
|
|
7728
|
+
{
|
|
7729
|
+
"capabilityId": "runs.by-skill",
|
|
7730
|
+
"name": "rudder_runs_by_skill",
|
|
7731
|
+
"description": "Build a paginated skill evidence packet from lightweight run summaries; use --full only for legacy full-row compatibility.",
|
|
7732
|
+
"mutating": false,
|
|
7733
|
+
"requiresOrgId": true,
|
|
7734
|
+
"requiresAgentId": false,
|
|
7735
|
+
"attachesRunIdWhenAvailable": false
|
|
7736
|
+
},
|
|
7737
|
+
{
|
|
7738
|
+
"capabilityId": "runs.get",
|
|
7739
|
+
"name": "rudder_runs_get",
|
|
7740
|
+
"description": "Read one bounded run summary; use --full only from a direct trusted CLI for raw detail.",
|
|
7741
|
+
"mutating": false,
|
|
7742
|
+
"requiresOrgId": false,
|
|
7743
|
+
"requiresAgentId": false,
|
|
7744
|
+
"attachesRunIdWhenAvailable": false
|
|
7745
|
+
},
|
|
7746
|
+
{
|
|
7747
|
+
"capabilityId": "runs.events",
|
|
7748
|
+
"name": "rudder_runs_events",
|
|
7749
|
+
"description": "List a bounded page of persisted run events with a lossless opaque cursor and clipped payload previews.",
|
|
7750
|
+
"mutating": false,
|
|
7751
|
+
"requiresOrgId": false,
|
|
7752
|
+
"requiresAgentId": false,
|
|
7753
|
+
"attachesRunIdWhenAvailable": false
|
|
7754
|
+
},
|
|
7755
|
+
{
|
|
7756
|
+
"capabilityId": "runs.log",
|
|
7757
|
+
"name": "rudder_runs_log",
|
|
7758
|
+
"description": "Read a bounded byte range of stored run log content.",
|
|
7759
|
+
"mutating": false,
|
|
7760
|
+
"requiresOrgId": false,
|
|
7761
|
+
"requiresAgentId": false,
|
|
7762
|
+
"attachesRunIdWhenAvailable": false
|
|
7763
|
+
},
|
|
7764
|
+
{
|
|
7765
|
+
"capabilityId": "runs.transcript",
|
|
7766
|
+
"name": "rudder_runs_transcript",
|
|
7767
|
+
"description": "Read a compact server-normalized transcript; --json changes encoding only and --full is direct-CLI-only raw access.",
|
|
7768
|
+
"mutating": false,
|
|
7769
|
+
"requiresOrgId": false,
|
|
7770
|
+
"requiresAgentId": false,
|
|
7771
|
+
"attachesRunIdWhenAvailable": false
|
|
7772
|
+
},
|
|
7773
|
+
{
|
|
7774
|
+
"capabilityId": "runs.errors",
|
|
7775
|
+
"name": "rudder_runs_errors",
|
|
7776
|
+
"description": "List failed tool calls, stderr, runtime failures, and jump-to-context commands.",
|
|
7777
|
+
"mutating": false,
|
|
7778
|
+
"requiresOrgId": false,
|
|
7779
|
+
"requiresAgentId": false,
|
|
7780
|
+
"attachesRunIdWhenAvailable": false
|
|
7781
|
+
},
|
|
7782
|
+
{
|
|
7783
|
+
"capabilityId": "runs.cancel",
|
|
7784
|
+
"name": "rudder_runs_cancel",
|
|
7785
|
+
"description": "Cancel a heartbeat run through the governed server route.",
|
|
7786
|
+
"mutating": true,
|
|
7787
|
+
"requiresOrgId": false,
|
|
7788
|
+
"requiresAgentId": false,
|
|
7789
|
+
"attachesRunIdWhenAvailable": true
|
|
7790
|
+
},
|
|
7791
|
+
{
|
|
7792
|
+
"capabilityId": "runs.retry",
|
|
7793
|
+
"name": "rudder_runs_retry",
|
|
7794
|
+
"description": "Retry a failed, timed out, or cancelled run through the governed server route.",
|
|
7795
|
+
"mutating": true,
|
|
7796
|
+
"requiresOrgId": false,
|
|
7797
|
+
"requiresAgentId": false,
|
|
7798
|
+
"attachesRunIdWhenAvailable": true
|
|
7799
|
+
}
|
|
7800
|
+
];
|
|
7801
|
+
|
|
7802
|
+
// ../packages/agent-runtime-utils/dist/rudder-mcp-contract.js
|
|
7803
|
+
var RUDDER_MCP_CONTRACT_VERSION = "rudder.agent-mcp-tools/v1";
|
|
7804
|
+
function mcpString(description) {
|
|
7805
|
+
return { type: "string", description };
|
|
7806
|
+
}
|
|
7807
|
+
function mcpBoolean(description) {
|
|
7808
|
+
return { type: "boolean", description };
|
|
7809
|
+
}
|
|
7810
|
+
function mcpNumber(description) {
|
|
7811
|
+
return { type: "number", description };
|
|
7812
|
+
}
|
|
7813
|
+
function mcpStringArray(description) {
|
|
7814
|
+
return { type: "array", items: { type: "string" }, description };
|
|
7815
|
+
}
|
|
7816
|
+
function rudderMcpInputSchemaForCapability(id) {
|
|
7817
|
+
const properties = {};
|
|
7818
|
+
const add = (key, value) => {
|
|
7819
|
+
properties[key] = value;
|
|
7820
|
+
};
|
|
7821
|
+
if (id.startsWith("runs.")) {
|
|
7822
|
+
const addString = (key, description) => add(key, mcpString(description));
|
|
7823
|
+
const addNumber = (key, description) => add(key, mcpNumber(description));
|
|
7824
|
+
const addBoolean = (key, description) => add(key, mcpBoolean(description));
|
|
7825
|
+
switch (id) {
|
|
7826
|
+
case "runs.list":
|
|
7827
|
+
addString("updatedAfter", "Only runs updated after this timestamp.");
|
|
7828
|
+
addString("runIdPrefix", "Run id prefix filter.");
|
|
7829
|
+
addString("relatedAgentId", "Agent id filter.");
|
|
7830
|
+
addString("status", "Run status filter.");
|
|
7831
|
+
addString("runtime", "Runtime type filter.");
|
|
7832
|
+
addString("issueId", "Linked issue id filter.");
|
|
7833
|
+
addString("usedSkill", "Used skill filter.");
|
|
7834
|
+
addString("loadedSkill", "Loaded skill filter.");
|
|
7835
|
+
addString("createdBefore", "Only runs created before this timestamp.");
|
|
7836
|
+
addString("cursor", "Stable summary cursor.");
|
|
7837
|
+
addNumber("limit", "Summary page size, capped by the server.");
|
|
7838
|
+
break;
|
|
7839
|
+
case "runs.by-skill":
|
|
7840
|
+
addString("skill", "Skill key or display name.");
|
|
7841
|
+
addString("evidence", "Evidence type: used or loaded.");
|
|
7842
|
+
addString("relatedAgentId", "Agent id filter.");
|
|
7843
|
+
addString("status", "Run status filter.");
|
|
7844
|
+
addString("runtime", "Runtime type filter.");
|
|
7845
|
+
addString("issueId", "Linked issue id filter.");
|
|
7846
|
+
addString("createdBefore", "Only runs created before this timestamp.");
|
|
7847
|
+
addString("cursor", "Stable summary cursor.");
|
|
7848
|
+
addNumber("limit", "Summary page size, capped by the server.");
|
|
7849
|
+
break;
|
|
7850
|
+
case "runs.events":
|
|
7851
|
+
addString("run", "Run id or short run id.");
|
|
7852
|
+
addString("cursor", "Opaque total-order event cursor.");
|
|
7853
|
+
addNumber("afterSeq", "Legacy sequence-only cursor.");
|
|
7854
|
+
addNumber("limit", "Event page size, capped by the server.");
|
|
7855
|
+
addNumber("maxChars", "Maximum payload preview characters per event.");
|
|
7856
|
+
break;
|
|
7857
|
+
case "runs.log":
|
|
7858
|
+
addString("run", "Run id or short run id.");
|
|
7859
|
+
addNumber("maxChars", "Maximum log characters for display.");
|
|
7860
|
+
addNumber("offset", "Byte offset for the ranged read.");
|
|
7861
|
+
addNumber("limitBytes", "Maximum bytes for the ranged read.");
|
|
7862
|
+
break;
|
|
7863
|
+
case "runs.transcript":
|
|
7864
|
+
addString("run", "Run id or short run id.");
|
|
7865
|
+
addBoolean("errorsOnly", "Return only error rows.");
|
|
7866
|
+
addString("aroundError", "Transcript error step id.");
|
|
7867
|
+
addNumber("contextTurns", "Turns around the selected error.");
|
|
7868
|
+
addString("cursor", "Stable transcript cursor.");
|
|
7869
|
+
addNumber("turnLimit", "Maximum turns to return.");
|
|
7870
|
+
addBoolean("chronological", "Return oldest-first rows.");
|
|
7871
|
+
addBoolean("narrative", "Use narrative row formatting.");
|
|
7872
|
+
addNumber("maxChars", "Maximum output characters per row.");
|
|
7873
|
+
addBoolean("includeOutput", "Include clipped row output.");
|
|
7874
|
+
break;
|
|
7875
|
+
case "runs.errors":
|
|
7876
|
+
addString("run", "Run id or short run id.");
|
|
7877
|
+
addString("cursor", "Error page cursor.");
|
|
7878
|
+
addNumber("maxChars", "Maximum output characters per error.");
|
|
7879
|
+
break;
|
|
7880
|
+
default:
|
|
7881
|
+
addString("run", "Run id or short run id.");
|
|
7882
|
+
break;
|
|
7883
|
+
}
|
|
7884
|
+
return { type: "object", additionalProperties: false, properties };
|
|
7885
|
+
}
|
|
7886
|
+
if (id.startsWith("issue.")) {
|
|
7887
|
+
add("issue", mcpString("Issue UUID, identifier, or short reference."));
|
|
7888
|
+
add("body", mcpString("Direct Markdown body for issue comments or close-out notes."));
|
|
7889
|
+
add("comment", mcpString("Direct Markdown review, blocker, or completion comment."));
|
|
7890
|
+
add("images", { type: "array", items: { type: "string" }, description: "Local image paths to attach when supported." });
|
|
7891
|
+
}
|
|
7892
|
+
if (id.startsWith("project."))
|
|
7893
|
+
add("project", mcpString("Project UUID or shortname."));
|
|
7894
|
+
if (id.startsWith("library.file.")) {
|
|
7895
|
+
add("path", mcpString("Library-relative file or directory path."));
|
|
7896
|
+
if (id === "library.file.list") {
|
|
7897
|
+
add("directory", mcpString("Library-relative directory path. Defaults to the run's project Library path when available."));
|
|
7898
|
+
}
|
|
7899
|
+
add("body", mcpString("Direct file content for put operations."));
|
|
7900
|
+
}
|
|
7901
|
+
if (id.startsWith("approval.")) {
|
|
7902
|
+
add("approval", mcpString("Approval UUID or short reference."));
|
|
7903
|
+
add("body", mcpString("Direct Markdown approval comment body."));
|
|
7904
|
+
}
|
|
7905
|
+
if (id.startsWith("skill.")) {
|
|
7906
|
+
add("skill", mcpString("Organization skill id."));
|
|
7907
|
+
add("path", mcpString("Skill package file path, such as SKILL.md."));
|
|
7908
|
+
}
|
|
7909
|
+
if (id.startsWith("browser.")) {
|
|
7910
|
+
add("url", mcpString("HTTP or HTTPS URL."));
|
|
7911
|
+
add("tabId", mcpString("Run-owned Rudder Browser tab id."));
|
|
7912
|
+
add("ref", mcpString("Element reference returned by rudder_browser_read."));
|
|
7913
|
+
add("text", mcpString("Text to enter into the referenced element."));
|
|
7914
|
+
}
|
|
7915
|
+
if (id.startsWith("automation.")) {
|
|
7916
|
+
add("automation", mcpString("Automation id."));
|
|
7917
|
+
add("trigger", mcpString("Automation trigger id."));
|
|
7918
|
+
add("payload", { type: ["object", "string"], description: "JSON payload object or JSON string." });
|
|
7919
|
+
}
|
|
7920
|
+
if (id.startsWith("chat.")) {
|
|
7921
|
+
add("chat", mcpString("Chat conversation id."));
|
|
7922
|
+
add("body", mcpString("Agent-authored chat message body."));
|
|
7923
|
+
}
|
|
7924
|
+
if (id.startsWith("agent.skills.")) {
|
|
7925
|
+
add("selectionRefs", { type: "array", items: { type: "string" }, description: "Skill selection refs." });
|
|
7926
|
+
add("skills", { type: "array", items: { type: "string" }, description: "Skill selection refs alias." });
|
|
7927
|
+
add("desiredSkills", mcpString("Comma-separated desired skill refs for sync."));
|
|
7928
|
+
}
|
|
7929
|
+
for (const [key, description] of Object.entries({
|
|
7930
|
+
query: "Search query.",
|
|
7931
|
+
decision: "Structured review decision.",
|
|
7932
|
+
title: "Title.",
|
|
7933
|
+
name: "Name.",
|
|
7934
|
+
description: "Description or summary text.",
|
|
7935
|
+
status: "Status filter or new status.",
|
|
7936
|
+
cursor: "Pagination cursor.",
|
|
7937
|
+
source: "Source path or source label.",
|
|
7938
|
+
kind: "Trigger kind.",
|
|
7939
|
+
label: "Trigger label.",
|
|
7940
|
+
skill: "Skill key, id, or display name.",
|
|
7941
|
+
slug: "Slug.",
|
|
7942
|
+
markdown: "Direct Markdown content.",
|
|
7943
|
+
role: "Agent role.",
|
|
7944
|
+
reportsTo: "Manager or reporting agent reference.",
|
|
7945
|
+
capabilities: "Agent capability summary.",
|
|
7946
|
+
wakeCommentId: "Issue comment id that triggered the wake.",
|
|
7947
|
+
expectedStatuses: "Comma-separated checkout precondition statuses.",
|
|
7948
|
+
after: "Pagination anchor or lower bound.",
|
|
7949
|
+
order: "Sort order.",
|
|
7950
|
+
priority: "Issue or automation priority.",
|
|
7951
|
+
assigneeAgentId: "Target assignee agent id or reference.",
|
|
7952
|
+
projectId: "Project id or reference.",
|
|
7953
|
+
goalId: "Goal id or reference.",
|
|
7954
|
+
parentId: "Parent issue id or reference.",
|
|
7955
|
+
parentIssueId: "Parent issue id or reference.",
|
|
7956
|
+
requestDepth: "Requested issue depth.",
|
|
7957
|
+
billingCode: "Billing code.",
|
|
7958
|
+
hiddenAt: "Hidden timestamp.",
|
|
7959
|
+
archivedAt: "Archived timestamp.",
|
|
7960
|
+
targetDate: "Target date.",
|
|
7961
|
+
color: "Display color.",
|
|
7962
|
+
scope: "Search or visibility scope.",
|
|
7963
|
+
sha: "Git commit SHA.",
|
|
7964
|
+
message: "Commit or status message.",
|
|
7965
|
+
branch: "Git branch name.",
|
|
7966
|
+
repoPath: "Repository path.",
|
|
7967
|
+
workspacePath: "Workspace path.",
|
|
7968
|
+
relatedAgentId: "Agent id used as a filter or related principal.",
|
|
7969
|
+
leadAgentId: "Lead agent id or reference.",
|
|
7970
|
+
approvalId: "Approval id or short approval id alias.",
|
|
7971
|
+
automationId: "Automation id alias.",
|
|
7972
|
+
chatId: "Chat conversation id alias.",
|
|
7973
|
+
commentId: "Issue comment id alias.",
|
|
7974
|
+
skillId: "Skill id alias.",
|
|
7975
|
+
user: "User id, reference, or self.",
|
|
7976
|
+
since: "Activity start timestamp.",
|
|
7977
|
+
until: "Activity end timestamp.",
|
|
7978
|
+
include: "Comma-separated optional data sections.",
|
|
7979
|
+
content: "Direct content alias for body.",
|
|
7980
|
+
roots: "Comma-separated local roots.",
|
|
7981
|
+
projectIds: "Comma-separated project ids.",
|
|
7982
|
+
workspaceIds: "Comma-separated workspace ids.",
|
|
7983
|
+
cronExpression: "Cron expression.",
|
|
7984
|
+
timezone: "Timezone.",
|
|
7985
|
+
signingMode: "Webhook signing mode.",
|
|
7986
|
+
replayWindowSec: "Webhook replay window in seconds.",
|
|
7987
|
+
instructions: "Automation instructions.",
|
|
7988
|
+
outputMode: "Automation output mode.",
|
|
7989
|
+
concurrencyPolicy: "Automation concurrency policy.",
|
|
7990
|
+
catchUpPolicy: "Automation catch-up policy.",
|
|
7991
|
+
triggerId: "Automation trigger id.",
|
|
7992
|
+
idempotencyKey: "Idempotency key.",
|
|
7993
|
+
summary: "Chat summary.",
|
|
7994
|
+
preferredAgentId: "Preferred responding agent id or reference.",
|
|
7995
|
+
issueCreationMode: "Chat issue creation mode.",
|
|
7996
|
+
editUserMessageId: "User message id to edit.",
|
|
7997
|
+
updatedAfter: "Run updated-after timestamp.",
|
|
7998
|
+
runIdPrefix: "Run id prefix filter.",
|
|
7999
|
+
runtime: "Runtime type filter.",
|
|
8000
|
+
issueId: "Issue id filter.",
|
|
8001
|
+
usedSkill: "Used skill filter.",
|
|
8002
|
+
loadedSkill: "Loaded skill filter.",
|
|
8003
|
+
createdBefore: "Created-before timestamp.",
|
|
8004
|
+
evidence: "Skill evidence type.",
|
|
8005
|
+
aroundError: "Transcript error step id.",
|
|
8006
|
+
maxOutputChars: "Maximum output characters."
|
|
8007
|
+
})) {
|
|
8008
|
+
add(key, mcpString(description));
|
|
8009
|
+
}
|
|
8010
|
+
for (const [key, description] of Object.entries({
|
|
8011
|
+
limit: "Page size or result limit.",
|
|
8012
|
+
count: "Count represented by a report.",
|
|
8013
|
+
turnLimit: "Maximum turns to return.",
|
|
8014
|
+
contextTurns: "Number of context turns.",
|
|
8015
|
+
maxChars: "Maximum characters.",
|
|
8016
|
+
snippetChars: "Maximum snippet characters.",
|
|
8017
|
+
afterSeq: "Return events after this sequence number.",
|
|
8018
|
+
offset: "Byte offset for ranged reads.",
|
|
8019
|
+
limitBytes: "Maximum bytes for ranged reads."
|
|
8020
|
+
})) {
|
|
8021
|
+
add(key, mcpNumber(description));
|
|
8022
|
+
}
|
|
8023
|
+
for (const [key, description] of Object.entries({
|
|
8024
|
+
selectionRefs: "Skill selection refs.",
|
|
8025
|
+
selections: "Skill selection refs alias.",
|
|
8026
|
+
skills: "Skill selection refs alias.",
|
|
8027
|
+
images: "Local image paths to attach when supported.",
|
|
8028
|
+
goalIds: "Goal ids."
|
|
8029
|
+
})) {
|
|
8030
|
+
add(key, mcpStringArray(description));
|
|
8031
|
+
}
|
|
8032
|
+
for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit", "full"]) {
|
|
8033
|
+
add(key, mcpBoolean(`Boolean option ${key}.`));
|
|
8034
|
+
}
|
|
8035
|
+
return { type: "object", additionalProperties: false, properties };
|
|
8036
|
+
}
|
|
8037
|
+
var RUDDER_MCP_CANONICAL_TOOL_DEFINITIONS = RUDDER_MCP_TOOL_DESCRIPTORS.map((tool) => ({
|
|
8038
|
+
...tool,
|
|
8039
|
+
inputSchema: rudderMcpInputSchemaForCapability(tool.capabilityId)
|
|
8040
|
+
}));
|
|
8041
|
+
function rudderMcpSemanticToolContract(tool) {
|
|
8042
|
+
return {
|
|
8043
|
+
name: tool.name,
|
|
8044
|
+
description: `${tool.description} Mutating: ${tool.mutating ? "yes" : "no"}. Runtime identity and authorization are injected by the Rudder-managed MCP server and are not accepted as tool input. Org context: ${tool.requiresOrgId ? "required from runtime env" : "not required by this tool"}. Agent context: ${tool.requiresAgentId ? "required from runtime env" : "runtime env when available"}. Run attribution: ${tool.attachesRunIdWhenAvailable ? "attached from runtime env when available" : "not attached"}.`,
|
|
8045
|
+
inputSchema: tool.inputSchema
|
|
8046
|
+
};
|
|
8047
|
+
}
|
|
8048
|
+
var RUDDER_MCP_CANONICAL_TOOL_CONTRACTS = RUDDER_MCP_CANONICAL_TOOL_DEFINITIONS.map(rudderMcpSemanticToolContract);
|
|
8049
|
+
var RUDDER_CORE_MCP_TOOL_CONTRACTS = RUDDER_MCP_CANONICAL_TOOL_CONTRACTS.filter((tool) => !tool.name.startsWith("rudder_browser_"));
|
|
8050
|
+
var RUDDER_BROWSER_MCP_TOOL_CONTRACTS = RUDDER_MCP_CANONICAL_TOOL_CONTRACTS.filter((tool) => tool.name.startsWith("rudder_browser_"));
|
|
8051
|
+
var RUDDER_CORE_MCP_TOOL_NAMES = RUDDER_CORE_MCP_TOOL_CONTRACTS.map((tool) => tool.name);
|
|
8052
|
+
var RUDDER_BROWSER_MCP_TOOL_NAMES = RUDDER_BROWSER_MCP_TOOL_CONTRACTS.map((tool) => tool.name);
|
|
8053
|
+
|
|
8054
|
+
// ../packages/agent-runtime-utils/dist/rudder-mcp.js
|
|
8055
|
+
var RUDDER_MCP_SERVER_NAME = "rudder-control-plane";
|
|
8056
|
+
var RUDDER_MCP_TOOL_COUNT = RUDDER_CORE_MCP_TOOL_NAMES.length;
|
|
8057
|
+
var RUDDER_BROWSER_MCP_TOOL_COUNT = RUDDER_BROWSER_MCP_TOOL_NAMES.length;
|
|
8058
|
+
|
|
8059
|
+
// ../packages/agent-runtime-utils/dist/rudder-mcp-fingerprint.js
|
|
8060
|
+
import { createHash } from "node:crypto";
|
|
8061
|
+
function stableJsonValue(value) {
|
|
8062
|
+
if (Array.isArray(value))
|
|
8063
|
+
return value.map(stableJsonValue);
|
|
8064
|
+
if (typeof value !== "object" || value === null)
|
|
8065
|
+
return value;
|
|
8066
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left < right ? -1 : left > right ? 1 : 0).map(([key, entry]) => [key, stableJsonValue(entry)]));
|
|
8067
|
+
}
|
|
8068
|
+
function stableRudderMcpContractJson(value) {
|
|
8069
|
+
return JSON.stringify(stableJsonValue(value));
|
|
8070
|
+
}
|
|
8071
|
+
function fingerprintRudderMcpToolManifest(tools) {
|
|
8072
|
+
return createHash("sha256").update(stableRudderMcpContractJson(tools.map((tool) => ({
|
|
8073
|
+
name: tool.name,
|
|
8074
|
+
description: tool.description,
|
|
8075
|
+
inputSchema: tool.inputSchema
|
|
8076
|
+
})))).digest("hex");
|
|
8077
|
+
}
|
|
6902
8078
|
|
|
6903
8079
|
// src/agent-v1-mcp-server.ts
|
|
6904
8080
|
init_dist();
|
|
6905
8081
|
import { spawn, spawnSync } from "node:child_process";
|
|
6906
|
-
import { existsSync } from "node:fs";
|
|
8082
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
6907
8083
|
import fs from "node:fs/promises";
|
|
6908
8084
|
import os from "node:os";
|
|
6909
|
-
import
|
|
6910
|
-
import { fileURLToPath } from "node:url";
|
|
8085
|
+
import path2 from "node:path";
|
|
8086
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6911
8087
|
|
|
6912
8088
|
// src/agent-v1-registry.ts
|
|
6913
8089
|
var AGENT_CLI_CAPABILITIES = [
|
|
@@ -7897,9 +9073,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7897
9073
|
},
|
|
7898
9074
|
{
|
|
7899
9075
|
id: "runs.get",
|
|
7900
|
-
command: "rudder runs get <run-id>",
|
|
9076
|
+
command: "rudder runs get <run-id> [--full]",
|
|
7901
9077
|
category: "runs",
|
|
7902
|
-
description: "Read one
|
|
9078
|
+
description: "Read one bounded run summary; use --full only from a direct trusted CLI for raw detail.",
|
|
7903
9079
|
mutating: false,
|
|
7904
9080
|
contract: "agent-v1",
|
|
7905
9081
|
requiresOrgId: false,
|
|
@@ -7909,9 +9085,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7909
9085
|
},
|
|
7910
9086
|
{
|
|
7911
9087
|
id: "runs.events",
|
|
7912
|
-
command: "rudder runs events <run-id> [--after-seq <n>] [--limit <n>]",
|
|
9088
|
+
command: "rudder runs events <run-id> [--cursor <cursor>] [--after-seq <n>] [--limit <n>] [--full]",
|
|
7913
9089
|
category: "runs",
|
|
7914
|
-
description: "List a bounded page of persisted run events with a
|
|
9090
|
+
description: "List a bounded page of persisted run events with a lossless opaque cursor and clipped payload previews.",
|
|
7915
9091
|
mutating: false,
|
|
7916
9092
|
contract: "agent-v1",
|
|
7917
9093
|
requiresOrgId: false,
|
|
@@ -7933,9 +9109,9 @@ var AGENT_CLI_CAPABILITIES = [
|
|
|
7933
9109
|
},
|
|
7934
9110
|
{
|
|
7935
9111
|
id: "runs.transcript",
|
|
7936
|
-
command: "rudder runs transcript <run-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output]",
|
|
9112
|
+
command: "rudder runs transcript <run-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output] [--full]",
|
|
7937
9113
|
category: "runs",
|
|
7938
|
-
description: "Read
|
|
9114
|
+
description: "Read a compact server-normalized transcript; --json changes encoding only and --full is direct-CLI-only raw access.",
|
|
7939
9115
|
mutating: false,
|
|
7940
9116
|
contract: "agent-v1",
|
|
7941
9117
|
requiresOrgId: false,
|
|
@@ -8020,194 +9196,29 @@ function buildAgentCliCapabilitiesManifest(contract = "agent-v1") {
|
|
|
8020
9196
|
capabilities
|
|
8021
9197
|
};
|
|
8022
9198
|
}
|
|
8023
|
-
function agentCliCapabilityIdToMcpToolName(id) {
|
|
8024
|
-
return `rudder_${id.replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "")}`;
|
|
8025
|
-
}
|
|
8026
|
-
function mcpString(description) {
|
|
8027
|
-
return { type: "string", description };
|
|
8028
|
-
}
|
|
8029
|
-
function mcpBoolean(description) {
|
|
8030
|
-
return { type: "boolean", description };
|
|
8031
|
-
}
|
|
8032
|
-
function mcpNumber(description) {
|
|
8033
|
-
return { type: "number", description };
|
|
8034
|
-
}
|
|
8035
|
-
function mcpStringArray(description) {
|
|
8036
|
-
return { type: "array", items: { type: "string" }, description };
|
|
8037
|
-
}
|
|
8038
|
-
function mcpInputSchemaForCapability(id) {
|
|
8039
|
-
const properties = {};
|
|
8040
|
-
const add = (key, value) => {
|
|
8041
|
-
properties[key] = value;
|
|
8042
|
-
};
|
|
8043
|
-
if (id.startsWith("issue.")) {
|
|
8044
|
-
add("issue", mcpString("Issue UUID, identifier, or short reference."));
|
|
8045
|
-
add("body", mcpString("Direct Markdown body for issue comments or close-out notes."));
|
|
8046
|
-
add("comment", mcpString("Direct Markdown review, blocker, or completion comment."));
|
|
8047
|
-
add("images", { type: "array", items: { type: "string" }, description: "Local image paths to attach when supported." });
|
|
8048
|
-
}
|
|
8049
|
-
if (id.startsWith("project.")) add("project", mcpString("Project UUID or shortname."));
|
|
8050
|
-
if (id.startsWith("library.file.")) {
|
|
8051
|
-
add("path", mcpString("Library-relative file or directory path."));
|
|
8052
|
-
if (id === "library.file.list") {
|
|
8053
|
-
add("directory", mcpString("Library-relative directory path. Defaults to the run's project Library path when available."));
|
|
8054
|
-
}
|
|
8055
|
-
add("body", mcpString("Direct file content for put operations."));
|
|
8056
|
-
}
|
|
8057
|
-
if (id.startsWith("approval.")) {
|
|
8058
|
-
add("approval", mcpString("Approval UUID or short reference."));
|
|
8059
|
-
add("body", mcpString("Direct Markdown approval comment body."));
|
|
8060
|
-
}
|
|
8061
|
-
if (id.startsWith("skill.")) {
|
|
8062
|
-
add("skill", mcpString("Organization skill id."));
|
|
8063
|
-
add("path", mcpString("Skill package file path, such as SKILL.md."));
|
|
8064
|
-
}
|
|
8065
|
-
if (id.startsWith("browser.")) {
|
|
8066
|
-
add("url", mcpString("HTTP or HTTPS URL."));
|
|
8067
|
-
add("tabId", mcpString("Run-owned Rudder Browser tab id."));
|
|
8068
|
-
add("ref", mcpString("Element reference returned by rudder_browser_read."));
|
|
8069
|
-
add("text", mcpString("Text to enter into the referenced element."));
|
|
8070
|
-
}
|
|
8071
|
-
if (id.startsWith("automation.")) {
|
|
8072
|
-
add("automation", mcpString("Automation id."));
|
|
8073
|
-
add("trigger", mcpString("Automation trigger id."));
|
|
8074
|
-
add("payload", { type: ["object", "string"], description: "JSON payload object or JSON string." });
|
|
8075
|
-
}
|
|
8076
|
-
if (id.startsWith("chat.")) {
|
|
8077
|
-
add("chat", mcpString("Chat conversation id."));
|
|
8078
|
-
add("body", mcpString("Agent-authored chat message body."));
|
|
8079
|
-
}
|
|
8080
|
-
if (id.startsWith("runs.")) add("run", mcpString("Run id or short run id."));
|
|
8081
|
-
if (id.startsWith("agent.skills.")) {
|
|
8082
|
-
add("selectionRefs", { type: "array", items: { type: "string" }, description: "Skill selection refs." });
|
|
8083
|
-
add("skills", { type: "array", items: { type: "string" }, description: "Skill selection refs alias." });
|
|
8084
|
-
add("desiredSkills", mcpString("Comma-separated desired skill refs for sync."));
|
|
8085
|
-
}
|
|
8086
|
-
for (const [key, description] of Object.entries({
|
|
8087
|
-
query: "Search query.",
|
|
8088
|
-
decision: "Structured review decision.",
|
|
8089
|
-
title: "Title.",
|
|
8090
|
-
name: "Name.",
|
|
8091
|
-
description: "Description or summary text.",
|
|
8092
|
-
status: "Status filter or new status.",
|
|
8093
|
-
cursor: "Pagination cursor.",
|
|
8094
|
-
source: "Source path or source label.",
|
|
8095
|
-
kind: "Trigger kind.",
|
|
8096
|
-
label: "Trigger label.",
|
|
8097
|
-
skill: "Skill key, id, or display name.",
|
|
8098
|
-
slug: "Slug.",
|
|
8099
|
-
markdown: "Direct Markdown content.",
|
|
8100
|
-
role: "Agent role.",
|
|
8101
|
-
reportsTo: "Manager or reporting agent reference.",
|
|
8102
|
-
capabilities: "Agent capability summary.",
|
|
8103
|
-
wakeCommentId: "Issue comment id that triggered the wake.",
|
|
8104
|
-
expectedStatuses: "Comma-separated checkout precondition statuses.",
|
|
8105
|
-
after: "Pagination anchor or lower bound.",
|
|
8106
|
-
order: "Sort order.",
|
|
8107
|
-
priority: "Issue or automation priority.",
|
|
8108
|
-
assigneeAgentId: "Target assignee agent id or reference.",
|
|
8109
|
-
projectId: "Project id or reference.",
|
|
8110
|
-
goalId: "Goal id or reference.",
|
|
8111
|
-
parentId: "Parent issue id or reference.",
|
|
8112
|
-
parentIssueId: "Parent issue id or reference.",
|
|
8113
|
-
requestDepth: "Requested issue depth.",
|
|
8114
|
-
billingCode: "Billing code.",
|
|
8115
|
-
hiddenAt: "Hidden timestamp.",
|
|
8116
|
-
archivedAt: "Archived timestamp.",
|
|
8117
|
-
targetDate: "Target date.",
|
|
8118
|
-
color: "Display color.",
|
|
8119
|
-
scope: "Search or visibility scope.",
|
|
8120
|
-
sha: "Git commit SHA.",
|
|
8121
|
-
message: "Commit or status message.",
|
|
8122
|
-
branch: "Git branch name.",
|
|
8123
|
-
repoPath: "Repository path.",
|
|
8124
|
-
workspacePath: "Workspace path.",
|
|
8125
|
-
relatedAgentId: "Agent id used as a filter or related principal.",
|
|
8126
|
-
leadAgentId: "Lead agent id or reference.",
|
|
8127
|
-
approvalId: "Approval id or short approval id alias.",
|
|
8128
|
-
automationId: "Automation id alias.",
|
|
8129
|
-
chatId: "Chat conversation id alias.",
|
|
8130
|
-
commentId: "Issue comment id alias.",
|
|
8131
|
-
skillId: "Skill id alias.",
|
|
8132
|
-
user: "User id, reference, or self.",
|
|
8133
|
-
since: "Activity start timestamp.",
|
|
8134
|
-
until: "Activity end timestamp.",
|
|
8135
|
-
include: "Comma-separated optional data sections.",
|
|
8136
|
-
content: "Direct content alias for body.",
|
|
8137
|
-
roots: "Comma-separated local roots.",
|
|
8138
|
-
projectIds: "Comma-separated project ids.",
|
|
8139
|
-
workspaceIds: "Comma-separated workspace ids.",
|
|
8140
|
-
cronExpression: "Cron expression.",
|
|
8141
|
-
timezone: "Timezone.",
|
|
8142
|
-
signingMode: "Webhook signing mode.",
|
|
8143
|
-
replayWindowSec: "Webhook replay window in seconds.",
|
|
8144
|
-
instructions: "Automation instructions.",
|
|
8145
|
-
outputMode: "Automation output mode.",
|
|
8146
|
-
concurrencyPolicy: "Automation concurrency policy.",
|
|
8147
|
-
catchUpPolicy: "Automation catch-up policy.",
|
|
8148
|
-
triggerId: "Automation trigger id.",
|
|
8149
|
-
idempotencyKey: "Idempotency key.",
|
|
8150
|
-
summary: "Chat summary.",
|
|
8151
|
-
preferredAgentId: "Preferred responding agent id or reference.",
|
|
8152
|
-
issueCreationMode: "Chat issue creation mode.",
|
|
8153
|
-
editUserMessageId: "User message id to edit.",
|
|
8154
|
-
updatedAfter: "Run updated-after timestamp.",
|
|
8155
|
-
runIdPrefix: "Run id prefix filter.",
|
|
8156
|
-
runtime: "Runtime type filter.",
|
|
8157
|
-
issueId: "Issue id filter.",
|
|
8158
|
-
usedSkill: "Used skill filter.",
|
|
8159
|
-
loadedSkill: "Loaded skill filter.",
|
|
8160
|
-
createdBefore: "Created-before timestamp.",
|
|
8161
|
-
evidence: "Skill evidence type.",
|
|
8162
|
-
aroundError: "Transcript error step id.",
|
|
8163
|
-
maxOutputChars: "Maximum output characters."
|
|
8164
|
-
})) {
|
|
8165
|
-
add(key, mcpString(description));
|
|
8166
|
-
}
|
|
8167
|
-
for (const [key, description] of Object.entries({
|
|
8168
|
-
limit: "Page size or result limit.",
|
|
8169
|
-
count: "Count represented by a report.",
|
|
8170
|
-
turnLimit: "Maximum turns to return.",
|
|
8171
|
-
contextTurns: "Number of context turns.",
|
|
8172
|
-
maxChars: "Maximum characters.",
|
|
8173
|
-
snippetChars: "Maximum snippet characters.",
|
|
8174
|
-
afterSeq: "Return events after this sequence number.",
|
|
8175
|
-
offset: "Byte offset for ranged reads.",
|
|
8176
|
-
limitBytes: "Maximum bytes for ranged reads."
|
|
8177
|
-
})) {
|
|
8178
|
-
add(key, mcpNumber(description));
|
|
8179
|
-
}
|
|
8180
|
-
for (const [key, description] of Object.entries({
|
|
8181
|
-
selectionRefs: "Skill selection refs.",
|
|
8182
|
-
selections: "Skill selection refs alias.",
|
|
8183
|
-
skills: "Skill selection refs alias.",
|
|
8184
|
-
images: "Local image paths to attach when supported.",
|
|
8185
|
-
goalIds: "Goal ids."
|
|
8186
|
-
})) {
|
|
8187
|
-
add(key, mcpStringArray(description));
|
|
8188
|
-
}
|
|
8189
|
-
for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit", "full"]) {
|
|
8190
|
-
add(key, mcpBoolean(`Boolean option ${key}.`));
|
|
8191
|
-
}
|
|
8192
|
-
return {
|
|
8193
|
-
type: "object",
|
|
8194
|
-
additionalProperties: false,
|
|
8195
|
-
properties
|
|
8196
|
-
};
|
|
8197
|
-
}
|
|
8198
9199
|
function buildAgentV1McpToolsManifest(contract = "agent-v1", options = {}) {
|
|
8199
9200
|
const capabilities = buildAgentCliCapabilitiesManifest(contract).capabilities.filter((entry) => options.browserEnabled !== false || entry.category !== "browser");
|
|
9201
|
+
const semanticContractByCapability = new Map(
|
|
9202
|
+
RUDDER_MCP_CANONICAL_TOOL_DEFINITIONS.map((tool) => [tool.capabilityId, tool])
|
|
9203
|
+
);
|
|
8200
9204
|
return {
|
|
8201
9205
|
schema: "rudder.agent-mcp-tools/v1",
|
|
8202
9206
|
contract,
|
|
8203
9207
|
serverName: "rudder-control-plane",
|
|
8204
|
-
tools: capabilities.map((entry) =>
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
9208
|
+
tools: capabilities.map((entry) => {
|
|
9209
|
+
const semanticContract = semanticContractByCapability.get(entry.id);
|
|
9210
|
+
if (!semanticContract) {
|
|
9211
|
+
throw new Error(`Missing canonical Rudder MCP contract for capability: ${entry.id}`);
|
|
9212
|
+
}
|
|
9213
|
+
return {
|
|
9214
|
+
...entry,
|
|
9215
|
+
description: semanticContract.description,
|
|
9216
|
+
capabilityId: entry.id,
|
|
9217
|
+
name: semanticContract.name,
|
|
9218
|
+
inputSchema: semanticContract.inputSchema,
|
|
9219
|
+
outputMode: "json"
|
|
9220
|
+
};
|
|
9221
|
+
})
|
|
8211
9222
|
};
|
|
8212
9223
|
}
|
|
8213
9224
|
function formatAgentCliCapabilitiesHumanReadable(capabilities = getAgentCliCapabilities()) {
|
|
@@ -8394,7 +9405,9 @@ function toStringRecord(headers) {
|
|
|
8394
9405
|
}
|
|
8395
9406
|
|
|
8396
9407
|
// src/agent-v1-mcp-server.ts
|
|
8397
|
-
|
|
9408
|
+
init_version();
|
|
9409
|
+
var RUDDER_MCP_MAX_TOOL_RESULT_BYTES = 1e6;
|
|
9410
|
+
var RUDDER_MCP_MAX_INLINE_TEXT_BYTES = 32e3;
|
|
8398
9411
|
var RESERVED_MODEL_ARGUMENTS = /* @__PURE__ */ new Set([
|
|
8399
9412
|
"orgId",
|
|
8400
9413
|
"org_id",
|
|
@@ -8441,6 +9454,7 @@ function buildAgentV1ToolCallPlan(toolName, rawArgs, env = buildMcpServerEnv())
|
|
|
8441
9454
|
}
|
|
8442
9455
|
const capability = getAgentCliCapabilityById(capabilityId);
|
|
8443
9456
|
rejectModelProvidedRuntimeIdentity(input);
|
|
9457
|
+
rejectUnsupportedToolArguments(toolName, input);
|
|
8444
9458
|
assertBrowserCapabilityEnabled(capabilityId, env);
|
|
8445
9459
|
assertRuntimeMcpContext(capability, env);
|
|
8446
9460
|
const tempFiles = [];
|
|
@@ -8470,10 +9484,26 @@ async function runAgentV1McpJsonRpcMessage(message, env = buildMcpServerEnv()) {
|
|
|
8470
9484
|
case "notifications/initialized":
|
|
8471
9485
|
return isNotification ? null : rpcResult(id, {});
|
|
8472
9486
|
case "initialize":
|
|
9487
|
+
const contractManifest = buildAgentV1McpToolsManifest("agent-v1").tools.map(rudderMcpSemanticToolContract);
|
|
9488
|
+
const coreContractHash = fingerprintRudderMcpToolManifest(
|
|
9489
|
+
contractManifest.filter((tool) => !tool.name.startsWith("rudder_browser_"))
|
|
9490
|
+
);
|
|
9491
|
+
const browserContractHash = fingerprintRudderMcpToolManifest(
|
|
9492
|
+
contractManifest.filter((tool) => tool.name.startsWith("rudder_browser_"))
|
|
9493
|
+
);
|
|
8473
9494
|
return rpcResult(id, {
|
|
8474
9495
|
protocolVersion: requestedProtocolVersion(message.params) ?? "2024-11-05",
|
|
8475
|
-
capabilities: {
|
|
8476
|
-
|
|
9496
|
+
capabilities: {
|
|
9497
|
+
tools: {},
|
|
9498
|
+
experimental: {
|
|
9499
|
+
rudder: {
|
|
9500
|
+
contractVersion: RUDDER_MCP_CONTRACT_VERSION,
|
|
9501
|
+
coreContractHash,
|
|
9502
|
+
browserContractHash
|
|
9503
|
+
}
|
|
9504
|
+
}
|
|
9505
|
+
},
|
|
9506
|
+
serverInfo: { name: RUDDER_MCP_SERVER_NAME, version: resolveCliVersion() }
|
|
8477
9507
|
});
|
|
8478
9508
|
case "tools/list":
|
|
8479
9509
|
return rpcResult(id, {
|
|
@@ -8482,7 +9512,7 @@ async function runAgentV1McpJsonRpcMessage(message, env = buildMcpServerEnv()) {
|
|
|
8482
9512
|
}).tools.map(toMcpToolListEntry)
|
|
8483
9513
|
});
|
|
8484
9514
|
case "tools/call":
|
|
8485
|
-
return
|
|
9515
|
+
return boundedToolCallRpcResponse(id, await callToolSafely(message.params, env));
|
|
8486
9516
|
default:
|
|
8487
9517
|
if (isNotification) return null;
|
|
8488
9518
|
return rpcError(id, -32601, `Unsupported JSON-RPC method: ${String(message.method ?? "")}`);
|
|
@@ -8581,12 +9611,12 @@ async function callTool(params, env) {
|
|
|
8581
9611
|
const plan = buildAgentV1ToolCallPlan(toolName, args, env);
|
|
8582
9612
|
const directResult = await callToolDirectlyIfSupported(toolName, args, env);
|
|
8583
9613
|
if (directResult) return directResult;
|
|
8584
|
-
const tempDir = plan.tempFiles.length > 0 ? await fs.mkdtemp(
|
|
9614
|
+
const tempDir = plan.tempFiles.length > 0 ? await fs.mkdtemp(path2.join(os.tmpdir(), "rudder-mcp-")) : null;
|
|
8585
9615
|
const materializedArgs = [...plan.args];
|
|
8586
9616
|
try {
|
|
8587
9617
|
if (tempDir) {
|
|
8588
9618
|
for (const tempFile of plan.tempFiles) {
|
|
8589
|
-
const tempPath =
|
|
9619
|
+
const tempPath = path2.join(tempDir, `${tempFile.flag.replace(/^-+/, "")}.md`);
|
|
8590
9620
|
await fs.writeFile(tempPath, tempFile.contents, "utf8");
|
|
8591
9621
|
const index = materializedArgs.indexOf(tempFile.flag);
|
|
8592
9622
|
if (index >= 0) materializedArgs[index + 1] = tempPath;
|
|
@@ -8595,11 +9625,7 @@ async function callTool(params, env) {
|
|
|
8595
9625
|
const result = await runRudderCli(materializedArgs, plan.env);
|
|
8596
9626
|
if (result.exitCode === 0) {
|
|
8597
9627
|
const text6 = result.stdout.trim() || "{}";
|
|
8598
|
-
return
|
|
8599
|
-
content: [{ type: "text", text: text6 }],
|
|
8600
|
-
...structuredContentFromJsonText(text6),
|
|
8601
|
-
isError: false
|
|
8602
|
-
};
|
|
9628
|
+
return mcpSuccessFromJsonText(text6);
|
|
8603
9629
|
}
|
|
8604
9630
|
const payload = {
|
|
8605
9631
|
status: "error",
|
|
@@ -8722,12 +9748,47 @@ function mcpApiClient(env) {
|
|
|
8722
9748
|
});
|
|
8723
9749
|
}
|
|
8724
9750
|
function mcpSuccess(data) {
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
9751
|
+
return mcpSuccessFromJsonText(JSON.stringify(data ?? {}));
|
|
9752
|
+
}
|
|
9753
|
+
function mcpSuccessFromJsonText(text6) {
|
|
9754
|
+
const structured = structuredContentFromJsonText(text6);
|
|
9755
|
+
const textBytes = Buffer.byteLength(text6, "utf8");
|
|
9756
|
+
const inlineText = textBytes <= RUDDER_MCP_MAX_INLINE_TEXT_BYTES ? text6 : JSON.stringify({
|
|
9757
|
+
status: "ok",
|
|
9758
|
+
output: "structuredContent",
|
|
9759
|
+
originalLength: text6.length,
|
|
9760
|
+
originalBytes: textBytes
|
|
9761
|
+
});
|
|
9762
|
+
const result = {
|
|
9763
|
+
content: [{ type: "text", text: inlineText }],
|
|
9764
|
+
...structured,
|
|
8729
9765
|
isError: false
|
|
8730
9766
|
};
|
|
9767
|
+
const resultBytes = Buffer.byteLength(JSON.stringify(result), "utf8");
|
|
9768
|
+
if (resultBytes <= RUDDER_MCP_MAX_TOOL_RESULT_BYTES) return result;
|
|
9769
|
+
return mcpResponseTooLarge(resultBytes);
|
|
9770
|
+
}
|
|
9771
|
+
function boundedToolCallRpcResponse(id, result) {
|
|
9772
|
+
const response = rpcResult(id, result);
|
|
9773
|
+
const responseBytes = Buffer.byteLength(JSON.stringify(response), "utf8");
|
|
9774
|
+
if (responseBytes <= RUDDER_MCP_MAX_TOOL_RESULT_BYTES) return response;
|
|
9775
|
+
return rpcResult(id, mcpResponseTooLarge(responseBytes));
|
|
9776
|
+
}
|
|
9777
|
+
function mcpResponseTooLarge(responseBytes) {
|
|
9778
|
+
const payload = {
|
|
9779
|
+
status: "error",
|
|
9780
|
+
code: "rudder_mcp_response_too_large",
|
|
9781
|
+
message: "Rudder MCP response exceeded the bounded tool-result budget. Use pagination or a ranged log read.",
|
|
9782
|
+
details: {
|
|
9783
|
+
maxBytes: RUDDER_MCP_MAX_TOOL_RESULT_BYTES,
|
|
9784
|
+
responseBytes
|
|
9785
|
+
}
|
|
9786
|
+
};
|
|
9787
|
+
return {
|
|
9788
|
+
content: [{ type: "text", text: JSON.stringify(payload) }],
|
|
9789
|
+
structuredContent: payload,
|
|
9790
|
+
isError: true
|
|
9791
|
+
};
|
|
8731
9792
|
}
|
|
8732
9793
|
function parseCsvInput(value, fallback) {
|
|
8733
9794
|
const source = Array.isArray(value) ? value.map((entry) => optionalString(entry)).filter(Boolean).join(",") : optionalString(value) || fallback;
|
|
@@ -9124,7 +10185,6 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9124
10185
|
pushOptional(args, "--created-before", input.createdBefore);
|
|
9125
10186
|
pushOptional(args, "--cursor", input.cursor);
|
|
9126
10187
|
pushOptional(args, "--limit", input.limit);
|
|
9127
|
-
pushBoolean(args, "--full", input.full);
|
|
9128
10188
|
return args;
|
|
9129
10189
|
}
|
|
9130
10190
|
case "runs.by-skill": {
|
|
@@ -9137,15 +10197,16 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9137
10197
|
pushOptional(args, "--created-before", input.createdBefore);
|
|
9138
10198
|
pushOptional(args, "--cursor", input.cursor);
|
|
9139
10199
|
pushOptional(args, "--limit", input.limit);
|
|
9140
|
-
pushBoolean(args, "--full", input.full);
|
|
9141
10200
|
return args;
|
|
9142
10201
|
}
|
|
9143
10202
|
case "runs.get":
|
|
9144
10203
|
return ["runs", "get", requiredString(input, "run")];
|
|
9145
10204
|
case "runs.events": {
|
|
9146
10205
|
const args = ["runs", "events", requiredString(input, "run")];
|
|
10206
|
+
pushOptional(args, "--cursor", input.cursor);
|
|
9147
10207
|
pushOptional(args, "--after-seq", input.afterSeq);
|
|
9148
10208
|
pushOptional(args, "--limit", input.limit);
|
|
10209
|
+
pushOptional(args, "--max-chars", input.maxChars);
|
|
9149
10210
|
return args;
|
|
9150
10211
|
}
|
|
9151
10212
|
case "runs.log": {
|
|
@@ -9171,6 +10232,7 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9171
10232
|
case "runs.errors": {
|
|
9172
10233
|
const args = ["runs", "errors", requiredString(input, "run")];
|
|
9173
10234
|
pushOptional(args, "--max-chars", input.maxChars);
|
|
10235
|
+
pushOptional(args, "--cursor", input.cursor);
|
|
9174
10236
|
return args;
|
|
9175
10237
|
}
|
|
9176
10238
|
case "runs.cancel":
|
|
@@ -9182,11 +10244,7 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
|
|
|
9182
10244
|
}
|
|
9183
10245
|
}
|
|
9184
10246
|
function toMcpToolListEntry(tool) {
|
|
9185
|
-
return
|
|
9186
|
-
name: tool.name,
|
|
9187
|
-
description: `${tool.description} Mutating: ${tool.mutating ? "yes" : "no"}. Runtime identity and authorization are injected by the Rudder-managed MCP server and are not accepted as tool input. Org context: ${tool.requiresOrgId ? "required from runtime env" : "not required by this tool"}. Agent context: ${tool.requiresAgentId ? "required from runtime env" : "runtime env when available"}. Run attribution: ${tool.attachesRunIdWhenAvailable ? "attached from runtime env when available" : "not attached"}.`,
|
|
9188
|
-
inputSchema: tool.inputSchema
|
|
9189
|
-
};
|
|
10247
|
+
return rudderMcpSemanticToolContract(tool);
|
|
9190
10248
|
}
|
|
9191
10249
|
function requestedProtocolVersion(params) {
|
|
9192
10250
|
if (!isRecord2(params)) return null;
|
|
@@ -9270,6 +10328,16 @@ function rejectModelProvidedRuntimeIdentity(input) {
|
|
|
9270
10328
|
err.code = "rudder_mcp_reserved_identity_argument";
|
|
9271
10329
|
throw err;
|
|
9272
10330
|
}
|
|
10331
|
+
function rejectUnsupportedToolArguments(toolName, input) {
|
|
10332
|
+
const tool = buildAgentV1McpToolsManifest("agent-v1").tools.find((entry) => entry.name === toolName);
|
|
10333
|
+
if (!tool) return;
|
|
10334
|
+
const supported = new Set(Object.keys(tool.inputSchema.properties));
|
|
10335
|
+
const unsupported = Object.keys(input).filter((key) => !supported.has(key)).sort();
|
|
10336
|
+
if (unsupported.length === 0) return;
|
|
10337
|
+
const err = new Error(`Unsupported argument${unsupported.length === 1 ? "" : "s"} for ${toolName}: ${unsupported.join(", ")}`);
|
|
10338
|
+
err.code = "rudder_mcp_invalid_arguments";
|
|
10339
|
+
throw err;
|
|
10340
|
+
}
|
|
9273
10341
|
function normalizeRuntimeIdentityKey(key) {
|
|
9274
10342
|
return key.replace(/[^a-z0-9]/giu, "").toLowerCase();
|
|
9275
10343
|
}
|
|
@@ -9327,8 +10395,8 @@ function resolveRudderCliInvocation(args, env) {
|
|
|
9327
10395
|
if (env.RUDDER_MCP_RUDDER_BIN) {
|
|
9328
10396
|
return { command: env.RUDDER_MCP_RUDDER_BIN, args };
|
|
9329
10397
|
}
|
|
9330
|
-
const modulePath =
|
|
9331
|
-
if (
|
|
10398
|
+
const modulePath = fileURLToPath2(new URL("./index.js", import.meta.url));
|
|
10399
|
+
if (existsSync2(modulePath)) {
|
|
9332
10400
|
return { command: process.execPath, args: [modulePath, ...args] };
|
|
9333
10401
|
}
|
|
9334
10402
|
if (hasRunnableRudderOnPath(env)) {
|
|
@@ -14208,10 +15276,13 @@ function registerRunsCommands(program) {
|
|
|
14208
15276
|
{ includeCompany: false }
|
|
14209
15277
|
);
|
|
14210
15278
|
addCommonClientOptions(
|
|
14211
|
-
runs.command("get").description(getAgentCliCapabilityById("runs.get").description).argument("<runId>", "Run ID or short run ID").action(async (runId, opts) => {
|
|
15279
|
+
runs.command("get").description(getAgentCliCapabilityById("runs.get").description).argument("<runId>", "Run ID or short run ID").option("--full", "Include raw run result, context, excerpts, and session fields").action(async (runId, opts) => {
|
|
14212
15280
|
try {
|
|
14213
15281
|
const ctx = resolveCommandContext(opts);
|
|
14214
|
-
const
|
|
15282
|
+
const projection = opts.full ? "full" : "summary";
|
|
15283
|
+
const row = await ctx.api.get(
|
|
15284
|
+
`/api/run-intelligence/runs/${encodeURIComponent(runId)}?projection=${projection}`
|
|
15285
|
+
);
|
|
14215
15286
|
printOutput(row, { json: ctx.json });
|
|
14216
15287
|
} catch (err) {
|
|
14217
15288
|
handleCommandError(err);
|
|
@@ -14219,13 +15290,16 @@ function registerRunsCommands(program) {
|
|
|
14219
15290
|
})
|
|
14220
15291
|
);
|
|
14221
15292
|
addCommonClientOptions(
|
|
14222
|
-
runs.command("events").description(getAgentCliCapabilityById("runs.events").description).argument("<runId>", "Run ID or short run ID").option("--after-seq <n>", "
|
|
15293
|
+
runs.command("events").description(getAgentCliCapabilityById("runs.events").description).argument("<runId>", "Run ID or short run ID").option("--cursor <cursor>", "Opaque total-order cursor returned in page.nextCursor").option("--after-seq <n>", "Legacy sequence-only cursor; prefer --cursor", "0").option("--limit <n>", "Maximum events to return", "200").option("--max-chars <n>", "Maximum payload preview characters per event", "1200").option("--full", "Include raw event payloads; unavailable through MCP").action(async (runId, opts) => {
|
|
14223
15294
|
try {
|
|
14224
15295
|
const ctx = resolveCommandContext(opts);
|
|
14225
15296
|
const params = new URLSearchParams({
|
|
14226
15297
|
afterSeq: String(parseNonNegativeInteger(opts.afterSeq, 0)),
|
|
14227
|
-
limit: String(parseLimit2(opts.limit, 200))
|
|
15298
|
+
limit: String(parseLimit2(opts.limit, 200)),
|
|
15299
|
+
maxChars: String(parseLimit2(opts.maxChars, 1200)),
|
|
15300
|
+
projection: opts.full ? "full" : "compact"
|
|
14228
15301
|
});
|
|
15302
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
14229
15303
|
const page = await ctx.api.get(
|
|
14230
15304
|
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/events?${params}`
|
|
14231
15305
|
);
|
|
@@ -14257,7 +15331,7 @@ function registerRunsCommands(program) {
|
|
|
14257
15331
|
})
|
|
14258
15332
|
);
|
|
14259
15333
|
addCommonClientOptions(
|
|
14260
|
-
runs.command("transcript").description(getAgentCliCapabilityById("runs.transcript").description).argument("<runId>", "Run ID or short run ID").option("--errors-only", "Show only error transcript rows").option("--around-error <id>", "Show context around a run error id such as step-12").option("--context-turns <n>", "Turns around --around-error", "1").option("--cursor <cursor>", "Stable transcript cursor returned in page.nextCursor").option("--turn-limit <n>", "Maximum turns to return", "20").option("--chronological", "Show oldest-first instead of default newest-first").option("--narrative", "Use a narrative human layout").option("--max-chars <n>", "Maximum output characters per row", "1200").option("--max-output-chars <n>", "Alias for --max-chars").option("--include-output", "Include row output in compact human transcript rows").option("--include-outputs", "Alias for --include-output").addHelpText("after", formatExamplesAndCautions({
|
|
15334
|
+
runs.command("transcript").description(getAgentCliCapabilityById("runs.transcript").description).argument("<runId>", "Run ID or short run ID").option("--errors-only", "Show only error transcript rows").option("--around-error <id>", "Show context around a run error id such as step-12").option("--context-turns <n>", "Turns around --around-error", "1").option("--cursor <cursor>", "Stable transcript cursor returned in page.nextCursor").option("--turn-limit <n>", "Maximum turns to return", "20").option("--chronological", "Show oldest-first instead of default newest-first").option("--narrative", "Use a narrative human layout").option("--max-chars <n>", "Maximum output characters per row", "1200").option("--max-output-chars <n>", "Alias for --max-chars").option("--include-output", "Include row output in compact human transcript rows").option("--include-outputs", "Alias for --include-output").option("--full", "Return raw lossless transcript entries; unavailable through MCP").addHelpText("after", formatExamplesAndCautions({
|
|
14261
15335
|
examples: [
|
|
14262
15336
|
{
|
|
14263
15337
|
description: "Inspect the neighborhood around a failing step:",
|
|
@@ -14269,14 +15343,15 @@ function registerRunsCommands(program) {
|
|
|
14269
15343
|
}
|
|
14270
15344
|
],
|
|
14271
15345
|
cautions: [
|
|
14272
|
-
"Human output
|
|
15346
|
+
"Human and JSON output use the same compact projection; --json changes encoding only.",
|
|
15347
|
+
"Use --full only from a direct trusted CLI when lossless provider entries are required.",
|
|
14273
15348
|
"Use --around-error from runs errors when investigating a failure instead of reading the entire run first."
|
|
14274
15349
|
]
|
|
14275
15350
|
})).action(async (runId, opts) => {
|
|
14276
15351
|
try {
|
|
14277
15352
|
const ctx = resolveCommandContext(opts);
|
|
14278
15353
|
const payload = await ctx.api.get(
|
|
14279
|
-
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/transcript?${buildTranscriptQuery(opts
|
|
15354
|
+
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/transcript?${buildTranscriptQuery(opts)}`
|
|
14280
15355
|
);
|
|
14281
15356
|
if (ctx.json) {
|
|
14282
15357
|
printOutput(payload, { json: true });
|
|
@@ -14291,7 +15366,7 @@ function registerRunsCommands(program) {
|
|
|
14291
15366
|
})
|
|
14292
15367
|
);
|
|
14293
15368
|
addCommonClientOptions(
|
|
14294
|
-
runs.command("errors").description(getAgentCliCapabilityById("runs.errors").description).argument("<runId>", "Run ID or short run ID").option("--max-chars <n>", "Maximum output characters per error", "1200").addHelpText("after", formatExamplesAndCautions({
|
|
15369
|
+
runs.command("errors").description(getAgentCliCapabilityById("runs.errors").description).argument("<runId>", "Run ID or short run ID").option("--max-chars <n>", "Maximum output characters per error", "1200").option("--cursor <cursor>", "Cursor returned in page.nextCursor").addHelpText("after", formatExamplesAndCautions({
|
|
14295
15370
|
examples: [
|
|
14296
15371
|
{
|
|
14297
15372
|
description: "Start failed-run investigation with error summaries:",
|
|
@@ -14311,6 +15386,7 @@ function registerRunsCommands(program) {
|
|
|
14311
15386
|
const ctx = resolveCommandContext(opts);
|
|
14312
15387
|
const params = new URLSearchParams();
|
|
14313
15388
|
params.set("maxChars", String(parseLimit2(opts.maxChars, 1200)));
|
|
15389
|
+
if (opts.cursor) params.set("cursor", opts.cursor);
|
|
14314
15390
|
const payload = await ctx.api.get(
|
|
14315
15391
|
`/api/run-intelligence/runs/${encodeURIComponent(runId)}/errors?${params.toString()}`
|
|
14316
15392
|
);
|
|
@@ -14382,7 +15458,7 @@ function parseSkillEvidenceType(value) {
|
|
|
14382
15458
|
if (normalized === "used" || normalized === "loaded") return normalized;
|
|
14383
15459
|
throw new Error("--evidence must be either 'used' or 'loaded'.");
|
|
14384
15460
|
}
|
|
14385
|
-
function buildTranscriptQuery(opts
|
|
15461
|
+
function buildTranscriptQuery(opts) {
|
|
14386
15462
|
const params = new URLSearchParams();
|
|
14387
15463
|
if (opts.errorsOnly) params.set("errorsOnly", "true");
|
|
14388
15464
|
if (opts.aroundError) params.set("aroundError", opts.aroundError);
|
|
@@ -14390,8 +15466,8 @@ function buildTranscriptQuery(opts, output) {
|
|
|
14390
15466
|
if (opts.turnLimit) params.set("turnLimit", String(parseLimit2(opts.turnLimit, 20)));
|
|
14391
15467
|
params.set("contextTurns", String(parseLimit2(opts.contextTurns, 1)));
|
|
14392
15468
|
params.set("order", opts.chronological || opts.narrative ? "oldest" : "newest");
|
|
14393
|
-
params.set("output",
|
|
14394
|
-
const includeOutputs =
|
|
15469
|
+
params.set("output", opts.full ? "full" : "compact");
|
|
15470
|
+
const includeOutputs = Boolean(opts.full || opts.includeOutput || opts.includeOutputs || opts.narrative);
|
|
14395
15471
|
params.set("includeOutputs", includeOutputs ? "true" : "false");
|
|
14396
15472
|
params.set("maxChars", String(parseLimit2(opts.maxOutputChars ?? opts.maxChars, 1200)));
|
|
14397
15473
|
return params.toString();
|
|
@@ -15586,7 +16662,7 @@ init_install2();
|
|
|
15586
16662
|
init_install();
|
|
15587
16663
|
import * as p15 from "@clack/prompts";
|
|
15588
16664
|
import { spawn as spawn3, spawnSync as spawnSync4 } from "node:child_process";
|
|
15589
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
16665
|
+
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
15590
16666
|
import { createWriteStream, constants as fsConstants, mkdirSync, readFileSync as readFileSync2 } from "node:fs";
|
|
15591
16667
|
import { access, chmod, copyFile, cp as cp2, mkdir as mkdir3, mkdtemp, readdir as readdir3, readFile as readFile6, rm as rm2, stat as stat4, utimes, writeFile as writeFile3 } from "node:fs/promises";
|
|
15592
16668
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -15789,43 +16865,88 @@ function createDesktopProgressFactory() {
|
|
|
15789
16865
|
};
|
|
15790
16866
|
};
|
|
15791
16867
|
}
|
|
15792
|
-
|
|
16868
|
+
function createDesktopApplySignalController() {
|
|
15793
16869
|
process.stdin.setEncoding("utf8");
|
|
15794
16870
|
process.stdin.resume();
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
buffer = lines.pop() ?? "";
|
|
15806
|
-
const commands = lines.map((line) => line.trim());
|
|
15807
|
-
if (commands.includes("force-apply")) {
|
|
15808
|
-
cleanup();
|
|
15809
|
-
resolve({ force: true });
|
|
15810
|
-
return;
|
|
15811
|
-
}
|
|
15812
|
-
if (commands.includes("apply")) {
|
|
15813
|
-
cleanup();
|
|
15814
|
-
resolve({ force: false });
|
|
15815
|
-
}
|
|
15816
|
-
};
|
|
15817
|
-
const onEnd = () => {
|
|
15818
|
-
cleanup();
|
|
15819
|
-
reject(new Error("Desktop update apply signal ended before confirmation."));
|
|
15820
|
-
};
|
|
15821
|
-
const onError = (error) => {
|
|
15822
|
-
cleanup();
|
|
15823
|
-
reject(error);
|
|
15824
|
-
};
|
|
15825
|
-
process.stdin.on("data", onData);
|
|
15826
|
-
process.stdin.on("end", onEnd);
|
|
15827
|
-
process.stdin.on("error", onError);
|
|
16871
|
+
let buffer = "";
|
|
16872
|
+
let closed = false;
|
|
16873
|
+
let initialSettled = false;
|
|
16874
|
+
let forceRequested = false;
|
|
16875
|
+
let resolveInitial;
|
|
16876
|
+
let rejectInitial;
|
|
16877
|
+
const forceWaiters = /* @__PURE__ */ new Set();
|
|
16878
|
+
const initialSignal = new Promise((resolve, reject) => {
|
|
16879
|
+
resolveInitial = resolve;
|
|
16880
|
+
rejectInitial = reject;
|
|
15828
16881
|
});
|
|
16882
|
+
const settleForceWaiters = (force) => {
|
|
16883
|
+
for (const resolve of forceWaiters) resolve(force);
|
|
16884
|
+
forceWaiters.clear();
|
|
16885
|
+
};
|
|
16886
|
+
const cleanup = () => {
|
|
16887
|
+
if (closed) return;
|
|
16888
|
+
closed = true;
|
|
16889
|
+
process.stdin.off("data", onData);
|
|
16890
|
+
process.stdin.off("end", onEnd);
|
|
16891
|
+
process.stdin.off("error", onError);
|
|
16892
|
+
settleForceWaiters(false);
|
|
16893
|
+
};
|
|
16894
|
+
const onData = (chunk) => {
|
|
16895
|
+
buffer += chunk;
|
|
16896
|
+
const lines = buffer.split(/\r?\n/);
|
|
16897
|
+
buffer = lines.pop() ?? "";
|
|
16898
|
+
for (const command of lines.map((line) => line.trim())) {
|
|
16899
|
+
if (command === "force-apply") {
|
|
16900
|
+
forceRequested = true;
|
|
16901
|
+
if (!initialSettled) {
|
|
16902
|
+
initialSettled = true;
|
|
16903
|
+
resolveInitial({ force: true });
|
|
16904
|
+
}
|
|
16905
|
+
settleForceWaiters(true);
|
|
16906
|
+
} else if (command === "apply" && !initialSettled) {
|
|
16907
|
+
initialSettled = true;
|
|
16908
|
+
resolveInitial({ force: false });
|
|
16909
|
+
}
|
|
16910
|
+
}
|
|
16911
|
+
};
|
|
16912
|
+
const onEnd = () => {
|
|
16913
|
+
if (!initialSettled) {
|
|
16914
|
+
initialSettled = true;
|
|
16915
|
+
rejectInitial(new Error("Desktop update apply signal ended before confirmation."));
|
|
16916
|
+
}
|
|
16917
|
+
cleanup();
|
|
16918
|
+
};
|
|
16919
|
+
const onError = (error) => {
|
|
16920
|
+
if (!initialSettled) {
|
|
16921
|
+
initialSettled = true;
|
|
16922
|
+
rejectInitial(error);
|
|
16923
|
+
}
|
|
16924
|
+
cleanup();
|
|
16925
|
+
};
|
|
16926
|
+
process.stdin.on("data", onData);
|
|
16927
|
+
process.stdin.on("end", onEnd);
|
|
16928
|
+
process.stdin.on("error", onError);
|
|
16929
|
+
return {
|
|
16930
|
+
waitForInitialSignal: () => initialSignal,
|
|
16931
|
+
waitForForceRequest: async (timeoutMs) => {
|
|
16932
|
+
if (forceRequested) return true;
|
|
16933
|
+
if (closed) return false;
|
|
16934
|
+
return await new Promise((resolve) => {
|
|
16935
|
+
let settled = false;
|
|
16936
|
+
const finish = (force) => {
|
|
16937
|
+
if (settled) return;
|
|
16938
|
+
settled = true;
|
|
16939
|
+
forceWaiters.delete(finish);
|
|
16940
|
+
clearTimeout2(timer);
|
|
16941
|
+
resolve(force);
|
|
16942
|
+
};
|
|
16943
|
+
const timer = setTimeout2(() => finish(false), timeoutMs);
|
|
16944
|
+
timer.unref?.();
|
|
16945
|
+
forceWaiters.add(finish);
|
|
16946
|
+
});
|
|
16947
|
+
},
|
|
16948
|
+
close: cleanup
|
|
16949
|
+
};
|
|
15829
16950
|
}
|
|
15830
16951
|
function resolveCurrentCliVersion(env = process.env) {
|
|
15831
16952
|
const version = resolveCliVersion(import.meta.url, env);
|
|
@@ -15884,7 +17005,7 @@ function isExactRuntimePackageSpec(version, packageSpec) {
|
|
|
15884
17005
|
return version !== "latest" && packageSpec === resolveRuntimePackageSpec(version);
|
|
15885
17006
|
}
|
|
15886
17007
|
function runtimeSupportsDesktopShellAssets(version, runtime) {
|
|
15887
|
-
return isExactRuntimePackageSpec(version, runtime.packageSpec);
|
|
17008
|
+
return isExactRuntimePackageSpec(version, runtime.packageSpec) && Boolean(runtime.postgresPayloadBinDir);
|
|
15888
17009
|
}
|
|
15889
17010
|
function resolveDesktopAssetTarget(platform = process.platform, arch = process.arch) {
|
|
15890
17011
|
if (platform === "darwin") {
|
|
@@ -16151,7 +17272,7 @@ async function downloadAsset(asset, outputDir, progressFactory = createByteProgr
|
|
|
16151
17272
|
return outputPath;
|
|
16152
17273
|
}
|
|
16153
17274
|
function checksumForFile(filePath) {
|
|
16154
|
-
const hash =
|
|
17275
|
+
const hash = createHash2("sha256");
|
|
16155
17276
|
hash.update(readFileSync2(filePath));
|
|
16156
17277
|
return hash.digest("hex");
|
|
16157
17278
|
}
|
|
@@ -16378,7 +17499,7 @@ async function pathExists2(targetPath) {
|
|
|
16378
17499
|
}
|
|
16379
17500
|
}
|
|
16380
17501
|
function resolveDesktopInstallLockPath(paths) {
|
|
16381
|
-
const installRootHash =
|
|
17502
|
+
const installRootHash = createHash2("sha256").update(path22.resolve(paths.installRoot)).digest("hex").slice(0, 16);
|
|
16382
17503
|
return path22.join(path22.dirname(paths.appPath), `.rudder-desktop-install-${installRootHash}.lock`);
|
|
16383
17504
|
}
|
|
16384
17505
|
async function readDesktopInstallLock(lockPath) {
|
|
@@ -16663,20 +17784,23 @@ async function prepareForDesktopReplace(paths, target, options = {}) {
|
|
|
16663
17784
|
const hasManagedExecutable = await pathExists2(paths.executablePath);
|
|
16664
17785
|
if (hasManagedExecutable) {
|
|
16665
17786
|
managedExecutablePids = findPids(paths.executablePath, target);
|
|
17787
|
+
let forceUpdate = options.forceUpdate === true;
|
|
16666
17788
|
const requestQuit = () => requestDesktopQuit(paths.executablePath, target, {
|
|
16667
|
-
forceUpdate
|
|
17789
|
+
forceUpdate,
|
|
16668
17790
|
responseTimeoutMs: options.updateQuitResponseTimeoutMs
|
|
16669
17791
|
});
|
|
16670
17792
|
let quitResponse = await requestQuit();
|
|
16671
|
-
while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns && !
|
|
17793
|
+
while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns && !forceUpdate) {
|
|
16672
17794
|
p15.log.warn(
|
|
16673
17795
|
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}; waiting before replacing Desktop.`
|
|
16674
17796
|
);
|
|
16675
|
-
|
|
17797
|
+
options.onActiveRunsWaiting?.(quitResponse.totalRuns);
|
|
17798
|
+
const pollIntervalMs = options.activeRunPollIntervalMs ?? 15e3;
|
|
17799
|
+
forceUpdate = options.waitForForceUpdate ? await options.waitForForceUpdate(pollIntervalMs) : (await delay2(pollIntervalMs), false);
|
|
16676
17800
|
quitResponse = await requestQuit();
|
|
16677
17801
|
}
|
|
16678
17802
|
if (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs") {
|
|
16679
|
-
if (!
|
|
17803
|
+
if (!forceUpdate) {
|
|
16680
17804
|
throw new Error(
|
|
16681
17805
|
`Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}. Stop active work, then rerun start.`
|
|
16682
17806
|
);
|
|
@@ -17067,27 +18191,39 @@ async function startCommand(opts) {
|
|
|
17067
18191
|
desktopProgressJson ? "verifying_checksum" : null
|
|
17068
18192
|
);
|
|
17069
18193
|
let applySignal = null;
|
|
18194
|
+
let applySignalController = null;
|
|
17070
18195
|
if (desktopProgressJson && opts.desktopWaitForApply === true) {
|
|
17071
18196
|
writeDesktopProgress({
|
|
17072
18197
|
phase: "ready_to_install",
|
|
17073
18198
|
message: "Desktop update is downloaded and verified.",
|
|
17074
18199
|
percent: 100
|
|
17075
18200
|
});
|
|
17076
|
-
|
|
18201
|
+
applySignalController = createDesktopApplySignalController();
|
|
18202
|
+
applySignal = await applySignalController.waitForInitialSignal();
|
|
17077
18203
|
writeDesktopProgress({
|
|
17078
18204
|
phase: "preparing_restart",
|
|
17079
18205
|
message: applySignal.force ? "Applying Desktop update and quitting active runs..." : "Applying Desktop update..."
|
|
17080
18206
|
});
|
|
17081
18207
|
}
|
|
17082
|
-
|
|
17083
|
-
|
|
17084
|
-
|
|
17085
|
-
|
|
17086
|
-
|
|
17087
|
-
|
|
17088
|
-
|
|
17089
|
-
|
|
17090
|
-
|
|
18208
|
+
try {
|
|
18209
|
+
await runStartPhase(
|
|
18210
|
+
"Replacing existing Rudder Desktop if needed...",
|
|
18211
|
+
"Existing Desktop install is ready for replacement.",
|
|
18212
|
+
() => prepareForDesktopReplace(installPaths, target, {
|
|
18213
|
+
waitForActiveRuns: opts.waitForActiveRuns === true,
|
|
18214
|
+
forceUpdate: applySignal?.force === true,
|
|
18215
|
+
waitForForceUpdate: applySignalController?.waitForForceRequest,
|
|
18216
|
+
onActiveRunsWaiting: desktopProgressJson ? (totalRuns) => writeDesktopProgress({
|
|
18217
|
+
phase: "waiting_for_active_runs",
|
|
18218
|
+
message: `Waiting for ${totalRuns} running agent run${totalRuns === 1 ? "" : "s"} before replacing Desktop.`,
|
|
18219
|
+
totalRuns
|
|
18220
|
+
}) : void 0
|
|
18221
|
+
}),
|
|
18222
|
+
desktopProgressJson ? opts.waitForActiveRuns === true ? "waiting_for_active_runs" : "preparing_restart" : null
|
|
18223
|
+
);
|
|
18224
|
+
} finally {
|
|
18225
|
+
applySignalController?.close();
|
|
18226
|
+
}
|
|
17091
18227
|
await runStartPhase(
|
|
17092
18228
|
"Installing portable Desktop app...",
|
|
17093
18229
|
`Installed Rudder Desktop to ${pc15.cyan(installPaths.appPath)}.`,
|