@rudderhq/cli 0.4.6-canary.11 → 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 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/instance.js
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 = z2.object({
628
- enabled: z2.boolean().default(DEFAULT_INSTANCE_BROWSER_SETTINGS.enabled),
629
- openLinksIn: z2.enum(["built_in", "default_browser"]).default(DEFAULT_INSTANCE_BROWSER_SETTINGS.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 = z2.object({
632
- enabled: z2.boolean().optional(),
633
- openLinksIn: z2.enum(["built_in", "default_browser"]).optional()
1050
+ patchInstanceBrowserSettingsSchema = z3.object({
1051
+ enabled: z3.boolean().optional(),
1052
+ openLinksIn: z3.enum(["built_in", "default_browser"]).optional()
634
1053
  }).strict();
635
- instanceLocaleSchema = z2.enum(["en", "zh-CN"]);
636
- instanceGeneralSettingsSchema = z2.object({
637
- censorUsernameInLogs: z2.boolean().default(false),
638
- showDeveloperDiagnostics: z2.boolean().default(false),
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 = z2.object({
643
- desktopInboxNotifications: z2.boolean().default(true),
644
- desktopDockBadge: z2.boolean().default(true),
645
- desktopIssueNotifications: z2.boolean().default(true),
646
- desktopChatNotifications: z2.boolean().default(true)
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 = z2.object({
651
- nickname: z2.string().max(80).default(""),
652
- moreAboutYou: z2.string().max(OPERATOR_PROFILE_MORE_ABOUT_YOU_MAX_LENGTH).default("")
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 = z2.enum(KEYBOARD_SHORTCUT_ACTION_IDS);
664
- keyboardShortcutBindingSchema = z2.object({
665
- key: z2.string().trim().min(1).max(64),
666
- code: z2.string().trim().min(1).max(80).optional(),
667
- metaKey: z2.boolean().optional(),
668
- ctrlKey: z2.boolean().optional(),
669
- altKey: z2.boolean().optional(),
670
- shiftKey: z2.boolean().optional()
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 = z2.object({
1091
+ keyboardShortcutPreferenceSchema = z3.object({
673
1092
  actionId: keyboardShortcutActionIdSchema,
674
- bindings: z2.array(keyboardShortcutBindingSchema).max(4).optional(),
675
- disabled: z2.boolean().optional()
1093
+ bindings: z3.array(keyboardShortcutBindingSchema).max(4).optional(),
1094
+ disabled: z3.boolean().optional()
676
1095
  }).strict();
677
- keyboardShortcutSettingsSchema = z2.object({
678
- shortcuts: z2.array(keyboardShortcutPreferenceSchema).max(KEYBOARD_SHORTCUT_ACTION_IDS.length).default([])
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: z2.ZodIssueCode.custom,
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 = z2.enum(["file", "directory"]);
694
- instancePathPickerRequestSchema = z2.object({
1112
+ instancePathPickerSelectionTypeSchema = z3.enum(["file", "directory"]);
1113
+ instancePathPickerRequestSchema = z3.object({
695
1114
  selectionType: instancePathPickerSelectionTypeSchema
696
1115
  }).strict();
697
- instancePathPickerResultSchema = z2.object({
698
- path: z2.string().nullable(),
699
- cancelled: z2.boolean()
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 z3 } from "zod";
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 = z3.object({
712
- scopeType: z3.enum(BUDGET_SCOPE_TYPES),
713
- scopeId: z3.string().uuid(),
714
- metric: z3.enum(BUDGET_METRICS).optional().default("billed_cents"),
715
- windowKind: z3.enum(BUDGET_WINDOW_KINDS).optional().default("calendar_month_utc"),
716
- amount: z3.number().int().nonnegative(),
717
- warnPercent: z3.number().int().min(1).max(99).optional().default(80),
718
- hardStopEnabled: z3.boolean().optional().default(true),
719
- notifyEnabled: z3.boolean().optional().default(true),
720
- isActive: z3.boolean().optional().default(true)
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 = z3.object({
723
- action: z3.enum(BUDGET_INCIDENT_RESOLUTION_ACTIONS),
724
- amount: z3.number().int().nonnegative().optional(),
725
- decisionNote: z3.string().optional().nullable()
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: z3.ZodIssueCode.custom,
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 z4 } from "zod";
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 = z4.enum([
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 = z4.preprocess((value) => {
1171
+ agentSkillOriginSchema = z5.preprocess((value) => {
753
1172
  if (value === "company_managed")
754
1173
  return "organization_managed";
755
1174
  return value;
756
- }, z4.enum([
1175
+ }, z5.enum([
757
1176
  "organization_managed",
758
1177
  "user_installed",
759
1178
  "external_unknown"
760
1179
  ]));
761
- agentSkillSourceClassSchema = z4.enum([
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 = z4.enum([
1187
+ agentSkillSyncModeSchema = z5.enum([
769
1188
  "unsupported",
770
1189
  "persistent",
771
1190
  "ephemeral"
772
1191
  ]);
773
- agentSkillEntrySchema = z4.object({
774
- key: z4.string().min(1),
775
- selectionKey: z4.string().min(1),
776
- runtimeName: z4.string().min(1).nullable(),
777
- description: z4.string().nullable().optional(),
778
- desired: z4.boolean(),
779
- configurable: z4.boolean(),
780
- alwaysEnabled: z4.boolean(),
781
- managed: z4.boolean(),
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: z4.string().nullable().optional(),
786
- locationLabel: z4.string().nullable().optional(),
787
- readOnly: z4.boolean().optional(),
788
- sourcePath: z4.string().nullable().optional(),
789
- targetPath: z4.string().nullable().optional(),
790
- workspaceEditPath: z4.string().nullable().optional(),
791
- detail: z4.string().nullable().optional()
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 = z4.object({
794
- agentRuntimeType: z4.string().min(1),
795
- supported: z4.boolean(),
1212
+ agentSkillSnapshotSchema = z5.object({
1213
+ agentRuntimeType: z5.string().min(1),
1214
+ supported: z5.boolean(),
796
1215
  mode: agentSkillSyncModeSchema,
797
- desiredSkills: z4.array(z4.string().min(1)),
798
- entries: z4.array(agentSkillEntrySchema),
799
- warnings: z4.array(z4.string())
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
- updateChatConversationUserStateSchema = z5.object({
1019
- pinned: z5.boolean().optional(),
1020
- unread: z5.boolean().optional()
1220
+ agentSkillSyncSchema = z5.object({
1221
+ desiredSkills: z5.array(z5.string().min(1))
1021
1222
  });
1022
- updateMessengerThreadUserStateSchema = z5.object({
1023
- pinned: z5.boolean().optional()
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 path2 from "node:path";
3620
+ import path3 from "node:path";
3394
3621
  function resolveRudderHomeDir() {
3395
3622
  const envHome = process.env.RUDDER_HOME?.trim();
3396
- if (envHome) return path2.resolve(expandHomePrefix(envHome));
3397
- return path2.resolve(os2.homedir(), ".rudder");
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 path2.resolve(resolveRudderHomeDir(), "instances", id);
3637
+ return path3.resolve(resolveRudderHomeDir(), "instances", id);
3411
3638
  }
3412
3639
  function resolveDefaultConfigPath(instanceId) {
3413
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "config.json");
3640
+ return path3.resolve(resolveRudderInstanceRoot(instanceId), "config.json");
3414
3641
  }
3415
3642
  function resolveDefaultContextPath() {
3416
- return path2.resolve(resolveRudderHomeDir(), "context.json");
3643
+ return path3.resolve(resolveRudderHomeDir(), "context.json");
3417
3644
  }
3418
3645
  function resolveDefaultCliAuthPath() {
3419
- return path2.resolve(resolveRudderHomeDir(), "auth.json");
3646
+ return path3.resolve(resolveRudderHomeDir(), "auth.json");
3420
3647
  }
3421
3648
  function resolveDefaultEmbeddedPostgresDir(instanceId) {
3422
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "db");
3649
+ return path3.resolve(resolveRudderInstanceRoot(instanceId), "db");
3423
3650
  }
3424
3651
  function resolveDefaultLogsDir(instanceId) {
3425
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "logs");
3652
+ return path3.resolve(resolveRudderInstanceRoot(instanceId), "logs");
3426
3653
  }
3427
3654
  function resolveDefaultSecretsKeyFilePath(instanceId) {
3428
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "secrets", "master.key");
3655
+ return path3.resolve(resolveRudderInstanceRoot(instanceId), "secrets", "master.key");
3429
3656
  }
3430
3657
  function resolveDefaultStorageDir(instanceId) {
3431
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "data", "storage");
3658
+ return path3.resolve(resolveRudderInstanceRoot(instanceId), "data", "storage");
3432
3659
  }
3433
3660
  function resolveDefaultBackupDir(instanceId) {
3434
- return path2.resolve(resolveRudderInstanceRoot(instanceId), "data", "backups");
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 path2.resolve(os2.homedir(), value.slice(2));
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 path3 from "node:path";
3702
+ import path4 from "node:path";
3476
3703
  function findConfigFileFromAncestors(startDir) {
3477
- const absoluteStartDir = path3.resolve(startDir);
3704
+ const absoluteStartDir = path4.resolve(startDir);
3478
3705
  let currentDir = absoluteStartDir;
3479
3706
  while (true) {
3480
- const candidate = path3.resolve(currentDir, ".rudder", DEFAULT_CONFIG_BASENAME);
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 = path3.resolve(currentDir, "..");
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 path3.resolve(overridePath);
3492
- if (process.env.RUDDER_CONFIG) return path3.resolve(process.env.RUDDER_CONFIG);
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 = path3.dirname(filePath);
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 path4 from "node:path";
3802
+ import path5 from "node:path";
3576
3803
  function resolveEnvFilePath(configPath) {
3577
- return path4.resolve(path4.dirname(resolveConfigPath(configPath)), ".env");
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 = path4.dirname(filePath);
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 path5 from "node:path";
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 path5.join(homeDir, "runtimes", sanitizeRuntimeCacheSegment(resolveRuntimePackageVersion(version)));
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(path5.join(cacheDir, RUNTIME_METADATA_FILE), "utf8");
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(path5.join(cacheDir, RUNTIME_METADATA_FILE), `${JSON.stringify(metadata, null, 2)}
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(path5.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json"), "utf8");
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 = path5.join(options.cacheDir, "node_modules", ...packageName.split("/"), "package.json");
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 cacheDir = resolveRuntimeCacheDir(packageVersion, options.homeDir);
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(path5.join(cacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
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(path5.join(fallbackCacheDir, "package.json"), `${JSON.stringify(RUNTIME_CACHE_PACKAGE_JSON, null, 2)}
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 path5.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR, runtimePostgresPlatformSegment(platform, arch), "bin");
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(path5.join(cacheDir, "package.json")).resolve(packageName);
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 ${path5.join(cacheDir, "node_modules")}`;
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 path5.join(cacheDir, "node_modules", ...packageName.split("/"), "package.json");
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 = path5.join(cacheDir, `.platform-repair-${process.pid}-${Date.now()}`);
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 = path5.join(stagingDir, packFilename);
4002
- const targetDir = path5.dirname(runtimePackageJsonPath(cacheDir, packageName));
4003
- await mkdir(path5.dirname(targetDir), { recursive: true });
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(path5.join(cacheDir, "package-lock.json"), { force: true }),
4055
- rm(path5.join(cacheDir, "node_modules", ".package-lock.json"), { force: true })
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 = path5.resolve(binDir);
4080
- const parts = normalized.split(path5.sep);
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(path5.sep) || path5.sep;
4087
- return path5.join(prefix, "share", "postgresql", version);
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
- path5.join(binDir, "..", "share", "postgresql", "postgres.bki"),
4092
- path5.join(binDir, "..", "share", "postgres.bki")
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 path5.dirname(candidatePath);
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(path5.join(debianSharedir, "postgres.bki"));
4342
+ await stat(path6.join(debianSharedir, "postgres.bki"));
4104
4343
  return debianSharedir;
4105
4344
  } catch {
4106
4345
  }
4107
4346
  }
4108
- const pgConfigPath = path5.join(binDir, process.platform === "win32" ? "pg_config.exe" : "pg_config");
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 = path5.join(sharedir, "postgres.bki");
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 = path5.join(binDir, runtimePostgresExecutableName(binary));
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 = path5.join(binDir, "..", "share", "postgresql", "postgres.bki");
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 = path5.join(binDir, runtimePostgresExecutableName("postgres"));
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 = path5.join(cacheDir, RUNTIME_POSTGRES_PAYLOAD_DIR);
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 = path5.dirname(targetBinDir);
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 sourceBinDir = process.env[RUDDER_POSTGRES_BIN_DIR_ENV]?.trim();
4163
- if (!sourceBinDir) return { output: "" };
4164
- const resolvedSourceBinDir = path5.resolve(sourceBinDir);
4165
- await assertRuntimePostgresBinDirComplete(cacheDir, resolvedSourceBinDir);
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 = path5.join(resolvedSourceBinDir, runtimePostgresExecutableName("postgres"));
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(path5.dirname(targetBinDir), { recursive: true });
4183
- await cp(path5.resolve(resolvedSourceBinDir, ".."), targetRuntimeDir, { recursive: true });
4184
- const targetShareDir = path5.join(targetRuntimeDir, "share");
4185
- const targetTemplateDir = path5.join(targetShareDir, "postgresql");
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(path5.dirname(targetTemplateDir), { recursive: true });
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 = path5.join(homeDir, "runtimes");
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 = path5.join(runtimesDir, dirent.name);
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 = path5.join(targetPath, dirent.name);
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 = path5.join(homeDir, "instances");
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 = path5.join(instancesDir, dirent.name, "runtime", "server.json");
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 path6 from "node:path";
4462
- import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
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 = path6.resolve(path6.dirname(fileURLToPath2(import.meta.url)), "../../..");
4484
- return path6.resolve(projectRoot, "server/src/index.ts");
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";
@@ -6900,1131 +7102,707 @@ var init_onboard = __esm({
6900
7102
  // src/program.ts
6901
7103
  import { Command, CommanderError } from "commander";
6902
7104
 
6903
- // src/agent-v1-mcp-server.ts
6904
- init_dist();
6905
- import { spawn, spawnSync } from "node:child_process";
6906
- import { existsSync } from "node:fs";
6907
- import fs from "node:fs/promises";
6908
- import os from "node:os";
6909
- import path from "node:path";
6910
- import { fileURLToPath } from "node:url";
6911
-
6912
- // src/agent-v1-registry.ts
6913
- var AGENT_CLI_CAPABILITIES = [
7105
+ // ../packages/agent-runtime-utils/dist/rudder-mcp-tool-descriptors.generated.js
7106
+ var RUDDER_MCP_TOOL_DESCRIPTORS = [
6914
7107
  {
6915
- id: "agent.me",
6916
- command: "rudder agent me",
6917
- category: "agent",
6918
- description: "Show the authenticated agent identity, budget, and chain of command.",
6919
- mutating: false,
6920
- contract: "agent-v1",
6921
- requiresOrgId: false,
6922
- requiresAgentId: false,
6923
- requiresRunId: false,
6924
- attachesRunIdWhenAvailable: false
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
6925
7115
  },
6926
7116
  {
6927
- id: "agent.inbox",
6928
- command: "rudder agent inbox",
6929
- category: "agent",
6930
- description: "List the compact assignee and reviewer work inbox for the authenticated agent.",
6931
- mutating: false,
6932
- contract: "agent-v1",
6933
- requiresOrgId: false,
6934
- requiresAgentId: false,
6935
- requiresRunId: false,
6936
- attachesRunIdWhenAvailable: false
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
6937
7124
  },
6938
7125
  {
6939
- id: "agent.capabilities",
6940
- command: "rudder agent capabilities",
6941
- category: "agent",
6942
- description: "List the stable Rudder agent command contract.",
6943
- mutating: false,
6944
- contract: "agent-v1",
6945
- requiresOrgId: false,
6946
- requiresAgentId: false,
6947
- requiresRunId: false,
6948
- attachesRunIdWhenAvailable: false
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
6949
7133
  },
6950
7134
  {
6951
- id: "agent.list",
6952
- command: "rudder agent list --org-id <id>",
6953
- category: "agent",
6954
- description: "List agents for an organization.",
6955
- mutating: false,
6956
- contract: "compat",
6957
- requiresOrgId: true,
6958
- requiresAgentId: false,
6959
- requiresRunId: false,
6960
- attachesRunIdWhenAvailable: false
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
6961
7142
  },
6962
7143
  {
6963
- id: "agent.get",
6964
- command: "rudder agent get <agent-id-or-shortname-or-agt-ref>",
6965
- category: "agent",
6966
- description: "Read one agent by id, shortname, or agt_<uuid-prefix> short ref.",
6967
- mutating: false,
6968
- contract: "compat",
6969
- requiresOrgId: false,
6970
- requiresAgentId: false,
6971
- requiresRunId: false,
6972
- attachesRunIdWhenAvailable: false
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
6973
7151
  },
6974
7152
  {
6975
- id: "agent.update",
6976
- command: "rudder agent update [agent-id] [--title <title>] [--description <text>]",
6977
- category: "agent",
6978
- description: "Update an agent's control-plane identity fields; defaults to the authenticated agent.",
6979
- mutating: true,
6980
- contract: "agent-v1",
6981
- requiresOrgId: false,
6982
- requiresAgentId: false,
6983
- requiresRunId: false,
6984
- attachesRunIdWhenAvailable: true
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
6985
7160
  },
6986
7161
  {
6987
- id: "agent.skills.create",
6988
- command: "rudder agent skills create [agent-id] --name <name> [--enable]",
6989
- category: "agent",
6990
- description: "Create an agent-private skill package under AGENT_HOME/skills.",
6991
- mutating: true,
6992
- contract: "agent-v1",
6993
- requiresOrgId: false,
6994
- requiresAgentId: false,
6995
- requiresRunId: false,
6996
- attachesRunIdWhenAvailable: true
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
6997
7169
  },
6998
7170
  {
6999
- id: "agent.skills.enable",
7000
- command: "rudder agent skills enable <agent-id> <selection-ref...>",
7001
- category: "agent",
7002
- description: "Add skill selections to an agent without replacing existing enabled skills.",
7003
- mutating: true,
7004
- contract: "agent-v1",
7005
- requiresOrgId: false,
7006
- requiresAgentId: false,
7007
- requiresRunId: false,
7008
- attachesRunIdWhenAvailable: true
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
7009
7178
  },
7010
7179
  {
7011
- id: "agent.skills.sync",
7012
- command: "rudder agent skills sync <agent-id>",
7013
- category: "agent",
7014
- description: "Sync the desired enabled skill set for an agent.",
7015
- mutating: true,
7016
- contract: "agent-v1",
7017
- requiresOrgId: false,
7018
- requiresAgentId: false,
7019
- requiresRunId: false,
7020
- attachesRunIdWhenAvailable: true
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
7021
7187
  },
7022
7188
  {
7023
- id: "agent.hire",
7024
- command: "rudder agent hire --org-id <id> --payload <json>",
7025
- category: "agent",
7026
- description: "Create a new hire using the canonical hire workflow.",
7027
- mutating: true,
7028
- contract: "compat",
7029
- requiresOrgId: true,
7030
- requiresAgentId: false,
7031
- requiresRunId: false,
7032
- attachesRunIdWhenAvailable: true
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
7033
7196
  },
7034
7197
  {
7035
- id: "agent.config.index",
7036
- command: "rudder agent config index",
7037
- category: "agent",
7038
- description: "Read the installed agent runtime configuration index.",
7039
- mutating: false,
7040
- contract: "compat",
7041
- requiresOrgId: false,
7042
- requiresAgentId: false,
7043
- requiresRunId: false,
7044
- attachesRunIdWhenAvailable: false
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
7045
7205
  },
7046
7206
  {
7047
- id: "agent.config.doc",
7048
- command: "rudder agent config doc <agent-runtime-type>",
7049
- category: "agent",
7050
- description: "Read adapter-specific configuration guidance for one runtime.",
7051
- mutating: false,
7052
- contract: "compat",
7053
- requiresOrgId: false,
7054
- requiresAgentId: false,
7055
- requiresRunId: false,
7056
- attachesRunIdWhenAvailable: false
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
7057
7214
  },
7058
7215
  {
7059
- id: "agent.config.list",
7060
- command: "rudder agent config list --org-id <id>",
7061
- category: "agent",
7062
- description: "List redacted agent configuration snapshots for an organization.",
7063
- mutating: false,
7064
- contract: "compat",
7065
- requiresOrgId: true,
7066
- requiresAgentId: false,
7067
- requiresRunId: false,
7068
- attachesRunIdWhenAvailable: false
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
7069
7223
  },
7070
7224
  {
7071
- id: "agent.config.get",
7072
- command: "rudder agent config get <agent-id-or-shortname>",
7073
- category: "agent",
7074
- description: "Read one redacted agent configuration snapshot by id or shortname.",
7075
- mutating: false,
7076
- contract: "compat",
7077
- requiresOrgId: false,
7078
- requiresAgentId: false,
7079
- requiresRunId: false,
7080
- attachesRunIdWhenAvailable: false
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
7081
7232
  },
7082
7233
  {
7083
- id: "agent.icons",
7084
- command: "rudder agent icons",
7085
- category: "agent",
7086
- description: "List legacy named agent icons for compatibility/debugging; normal create and hire payloads should omit icon.",
7087
- mutating: false,
7088
- contract: "compat",
7089
- requiresOrgId: false,
7090
- requiresAgentId: false,
7091
- requiresRunId: false,
7092
- attachesRunIdWhenAvailable: false
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
7093
7241
  },
7094
7242
  {
7095
- id: "issue.get",
7096
- command: "rudder issue get <issue>",
7097
- category: "issue",
7098
- description: "Read a full issue by UUID or identifier.",
7099
- mutating: false,
7100
- contract: "agent-v1",
7101
- requiresOrgId: false,
7102
- requiresAgentId: false,
7103
- requiresRunId: false,
7104
- attachesRunIdWhenAvailable: false
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
7105
7250
  },
7106
7251
  {
7107
- id: "issue.search",
7108
- command: "rudder issue search <query> [--org-id <id>]",
7109
- category: "issue",
7110
- description: "Search issues with the server-side issue index across title, identifier, description, and comments.",
7111
- mutating: false,
7112
- contract: "agent-v1",
7113
- requiresOrgId: true,
7114
- requiresAgentId: false,
7115
- requiresRunId: false,
7116
- attachesRunIdWhenAvailable: false
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
7117
7259
  },
7118
7260
  {
7119
- id: "issue.context",
7120
- command: "rudder issue context <issue> [--wake-comment-id <comment-id-or-cmt-ref>]",
7121
- category: "issue",
7122
- description: "Read the compact heartbeat context for an issue; wake comments may be addressed by full id or cmt_<uuid-prefix>.",
7123
- mutating: false,
7124
- contract: "agent-v1",
7125
- requiresOrgId: false,
7126
- requiresAgentId: false,
7127
- requiresRunId: false,
7128
- attachesRunIdWhenAvailable: false
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
7129
7268
  },
7130
7269
  {
7131
- id: "issue.checkout",
7132
- command: "rudder issue checkout <issue>",
7133
- category: "issue",
7134
- description: "Atomically checkout an issue for the current or specified agent.",
7135
- mutating: true,
7136
- contract: "agent-v1",
7137
- requiresOrgId: false,
7138
- requiresAgentId: true,
7139
- requiresRunId: false,
7140
- attachesRunIdWhenAvailable: true
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
7141
7277
  },
7142
7278
  {
7143
- id: "issue.comment",
7144
- command: "rudder issue comment <issue> --body-file <path> [--image <path>]",
7145
- category: "issue",
7146
- description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
7147
- mutating: true,
7148
- contract: "agent-v1",
7149
- requiresOrgId: false,
7150
- requiresAgentId: false,
7151
- requiresRunId: false,
7152
- attachesRunIdWhenAvailable: true
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
7153
7286
  },
7154
7287
  {
7155
- id: "issue.comments.list",
7156
- command: "rudder issue comments list <issue> [--after <comment-id-or-cmt-ref>]",
7157
- category: "issue",
7158
- description: "List issue comments, optionally only newer comments after a full comment id or cmt_<uuid-prefix> with --after.",
7159
- mutating: false,
7160
- contract: "agent-v1",
7161
- requiresOrgId: false,
7162
- requiresAgentId: false,
7163
- requiresRunId: false,
7164
- attachesRunIdWhenAvailable: false
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
7165
7295
  },
7166
7296
  {
7167
- id: "issue.comments.get",
7168
- command: "rudder issue comments get <issue> <comment-id-or-cmt-ref>",
7169
- category: "issue",
7170
- description: "Read one issue comment by full id or cmt_<uuid-prefix> scoped to the issue.",
7171
- mutating: false,
7172
- contract: "agent-v1",
7173
- requiresOrgId: false,
7174
- requiresAgentId: false,
7175
- requiresRunId: false,
7176
- attachesRunIdWhenAvailable: false
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
7177
7304
  },
7178
7305
  {
7179
- id: "issue.update",
7180
- command: "rudder issue update <issue> ... [--comment-file <path>] [--image <path>]",
7181
- category: "issue",
7182
- description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
7183
- mutating: true,
7184
- contract: "agent-v1",
7185
- requiresOrgId: false,
7186
- requiresAgentId: false,
7187
- requiresRunId: false,
7188
- attachesRunIdWhenAvailable: true
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
7189
7313
  },
7190
7314
  {
7191
- id: "issue.review",
7192
- command: "rudder issue review <issue> --decision <decision> --comment-file <path>",
7193
- category: "issue",
7194
- description: "Record a structured reviewer decision with a required comment.",
7195
- mutating: true,
7196
- contract: "agent-v1",
7197
- requiresOrgId: false,
7198
- requiresAgentId: false,
7199
- requiresRunId: false,
7200
- attachesRunIdWhenAvailable: true
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
7201
7322
  },
7202
7323
  {
7203
- id: "issue.commit",
7204
- command: "rudder issue commit <issue> --sha <sha> --message <subject>",
7205
- category: "issue",
7206
- description: "Report a code commit created during issue work as structured issue activity.",
7207
- mutating: true,
7208
- contract: "agent-v1",
7209
- requiresOrgId: false,
7210
- requiresAgentId: false,
7211
- requiresRunId: false,
7212
- attachesRunIdWhenAvailable: true
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
7213
7331
  },
7214
7332
  {
7215
- id: "issue.done",
7216
- command: "rudder issue done <issue> --comment-file <path> [--image <path>]",
7217
- category: "issue",
7218
- description: "Mark an issue done with a required completion comment, optionally uploading images.",
7219
- mutating: true,
7220
- contract: "agent-v1",
7221
- requiresOrgId: false,
7222
- requiresAgentId: false,
7223
- requiresRunId: false,
7224
- attachesRunIdWhenAvailable: true
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
7225
7340
  },
7226
7341
  {
7227
- id: "issue.block",
7228
- command: "rudder issue block <issue> --comment-file <path> [--image <path>]",
7229
- category: "issue",
7230
- description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
7231
- mutating: true,
7232
- contract: "agent-v1",
7233
- requiresOrgId: false,
7234
- requiresAgentId: false,
7235
- requiresRunId: false,
7236
- attachesRunIdWhenAvailable: true
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
7237
7349
  },
7238
7350
  {
7239
- id: "project.list",
7240
- command: "rudder project list --org-id <id>",
7241
- category: "project",
7242
- description: "List projects in an organization.",
7243
- mutating: false,
7244
- contract: "agent-v1",
7245
- requiresOrgId: true,
7246
- requiresAgentId: false,
7247
- requiresRunId: false,
7248
- attachesRunIdWhenAvailable: false
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
7249
7358
  },
7250
7359
  {
7251
- id: "project.get",
7252
- command: "rudder project get <project-id-or-shortname> [--org-id <id>]",
7253
- category: "project",
7254
- description: "Read one project by ID or shortname.",
7255
- mutating: false,
7256
- contract: "agent-v1",
7257
- requiresOrgId: false,
7258
- requiresAgentId: false,
7259
- requiresRunId: false,
7260
- attachesRunIdWhenAvailable: false
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
7261
7367
  },
7262
7368
  {
7263
- id: "project.create",
7264
- command: "rudder project create --org-id <id> --name <name>",
7265
- category: "project",
7266
- description: "Create a project in the organization.",
7267
- mutating: true,
7268
- contract: "agent-v1",
7269
- requiresOrgId: true,
7270
- requiresAgentId: false,
7271
- requiresRunId: false,
7272
- attachesRunIdWhenAvailable: true
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
7273
7376
  },
7274
7377
  {
7275
- id: "project.update",
7276
- command: "rudder project update <project-id-or-shortname> [--org-id <id>]",
7277
- category: "project",
7278
- description: "Update mutable project fields such as name, description, status, goals, lead agent, target date, color, or archivedAt.",
7279
- mutating: true,
7280
- contract: "agent-v1",
7281
- requiresOrgId: false,
7282
- requiresAgentId: false,
7283
- requiresRunId: false,
7284
- attachesRunIdWhenAvailable: true
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
7285
7385
  },
7286
7386
  {
7287
- id: "user.activity",
7288
- command: "rudder user activity --user me --since today --json",
7289
- category: "user",
7290
- description: "Read a user-centered activity ledger with safe excerpts and provenance across chats, issue comments, approval comments, and user actor activity.",
7291
- mutating: false,
7292
- contract: "agent-v1",
7293
- requiresOrgId: true,
7294
- requiresAgentId: false,
7295
- requiresRunId: false,
7296
- attachesRunIdWhenAvailable: false
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
7297
7394
  },
7298
7395
  {
7299
- id: "library.file.list",
7300
- command: "rudder library file list [directory]",
7301
- category: "library",
7302
- description: "List Library files and folders; file rows include `libraryEntryId` when a strong reference can be generated.",
7303
- mutating: false,
7304
- contract: "agent-v1",
7305
- requiresOrgId: true,
7306
- requiresAgentId: false,
7307
- requiresRunId: false,
7308
- attachesRunIdWhenAvailable: false
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
7309
7403
  },
7310
7404
  {
7311
- id: "library.file.get",
7312
- command: "rudder library file get <path>",
7313
- category: "library",
7314
- description: "Fallback read when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
7315
- mutating: false,
7316
- contract: "agent-v1",
7317
- requiresOrgId: true,
7318
- requiresAgentId: false,
7319
- requiresRunId: false,
7320
- attachesRunIdWhenAvailable: false
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
7321
7412
  },
7322
7413
  {
7323
- id: "library.file.ref",
7324
- command: "rudder library file ref <path>",
7325
- category: "library",
7326
- description: "Return the stable Markdown reference for one Library file without printing file content.",
7327
- mutating: false,
7328
- contract: "agent-v1",
7329
- requiresOrgId: true,
7330
- requiresAgentId: false,
7331
- requiresRunId: false,
7332
- attachesRunIdWhenAvailable: false
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
7333
7421
  },
7334
7422
  {
7335
- id: "library.file.link",
7336
- command: "rudder library file link <path>",
7337
- category: "library",
7338
- description: "Compatibility alias for `rudder library file ref <path>`.",
7339
- mutating: false,
7340
- contract: "agent-v1",
7341
- requiresOrgId: true,
7342
- requiresAgentId: false,
7343
- requiresRunId: false,
7344
- attachesRunIdWhenAvailable: false
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
7345
7430
  },
7346
7431
  {
7347
- id: "library.file.put",
7348
- command: "rudder library file put <path> --body-file <path>",
7349
- category: "library",
7350
- description: "Fallback create/update when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
7351
- mutating: true,
7352
- contract: "agent-v1",
7353
- requiresOrgId: true,
7354
- requiresAgentId: false,
7355
- requiresRunId: false,
7356
- attachesRunIdWhenAvailable: true
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
7357
7439
  },
7358
7440
  {
7359
- id: "issue.create",
7360
- command: "rudder issue create --org-id <id> ... [--label-id <id> ...] [--label <name> ...]",
7361
- category: "issue",
7362
- description: "Create a new issue or subtask with the generic issue surface; agent-created issues default to the creating agent when no assignee is supplied.",
7363
- mutating: true,
7364
- contract: "compat",
7365
- requiresOrgId: true,
7366
- requiresAgentId: false,
7367
- requiresRunId: false,
7368
- attachesRunIdWhenAvailable: true
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
7369
7448
  },
7370
7449
  {
7371
- id: "issue.labels.list",
7372
- command: "rudder issue labels list --org-id <id>",
7373
- category: "issue",
7374
- description: "List organization issue labels available for issue creation.",
7375
- mutating: false,
7376
- contract: "compat",
7377
- requiresOrgId: true,
7378
- requiresAgentId: false,
7379
- requiresRunId: false,
7380
- attachesRunIdWhenAvailable: false
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
7381
7457
  },
7382
7458
  {
7383
- id: "approval.get",
7384
- command: "rudder approval get <approval-id>",
7385
- category: "approval",
7386
- description: "Read one approval request.",
7387
- mutating: false,
7388
- contract: "agent-v1",
7389
- requiresOrgId: false,
7390
- requiresAgentId: false,
7391
- requiresRunId: false,
7392
- attachesRunIdWhenAvailable: false
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
7393
7466
  },
7394
7467
  {
7395
- id: "approval.create",
7396
- command: "rudder approval create --org-id <id> --type <type> --payload <json>",
7397
- category: "approval",
7398
- description: "Create a new approval request.",
7399
- mutating: true,
7400
- contract: "compat",
7401
- requiresOrgId: true,
7402
- requiresAgentId: false,
7403
- requiresRunId: false,
7404
- attachesRunIdWhenAvailable: true
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
7405
7475
  },
7406
7476
  {
7407
- id: "approval.issues",
7408
- command: "rudder approval issues <approval-id>",
7409
- category: "approval",
7410
- description: "List the issues linked to an approval.",
7411
- mutating: false,
7412
- contract: "agent-v1",
7413
- requiresOrgId: false,
7414
- requiresAgentId: false,
7415
- requiresRunId: false,
7416
- attachesRunIdWhenAvailable: false
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
7417
7484
  },
7418
7485
  {
7419
- id: "approval.comment",
7420
- command: "rudder approval comment <approval-id> --body-file <path>",
7421
- category: "approval",
7422
- description: "Add a comment to an approval.",
7423
- mutating: true,
7424
- contract: "agent-v1",
7425
- requiresOrgId: false,
7426
- requiresAgentId: false,
7427
- requiresRunId: false,
7428
- attachesRunIdWhenAvailable: true
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
7429
7493
  },
7430
7494
  {
7431
- id: "approval.resubmit",
7432
- command: "rudder approval resubmit <approval-id> [--payload <json>]",
7433
- category: "approval",
7434
- description: "Resubmit a revision-requested approval, optionally with updated payload.",
7435
- mutating: true,
7436
- contract: "compat",
7437
- requiresOrgId: false,
7438
- requiresAgentId: false,
7439
- requiresRunId: false,
7440
- attachesRunIdWhenAvailable: true
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
7441
7502
  },
7442
7503
  {
7443
- id: "skill.list",
7444
- command: "rudder skill list --org-id <id>",
7445
- category: "skill",
7446
- description: "List organization-visible skills.",
7447
- mutating: false,
7448
- contract: "agent-v1",
7449
- requiresOrgId: true,
7450
- requiresAgentId: false,
7451
- requiresRunId: false,
7452
- attachesRunIdWhenAvailable: false
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
7453
7511
  },
7454
7512
  {
7455
- id: "skill.get",
7456
- command: "rudder skill get <skill-id> --org-id <id>",
7457
- category: "skill",
7458
- description: "Read one organization skill detail.",
7459
- mutating: false,
7460
- contract: "agent-v1",
7461
- requiresOrgId: true,
7462
- requiresAgentId: false,
7463
- requiresRunId: false,
7464
- attachesRunIdWhenAvailable: false
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
7465
7520
  },
7466
7521
  {
7467
- id: "skill.file",
7468
- command: "rudder skill file <skill-id> --org-id <id> [--path SKILL.md]",
7469
- category: "skill",
7470
- description: "Read one file from an organization skill package.",
7471
- mutating: false,
7472
- contract: "agent-v1",
7473
- requiresOrgId: true,
7474
- requiresAgentId: false,
7475
- requiresRunId: false,
7476
- attachesRunIdWhenAvailable: false
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
7477
7529
  },
7478
7530
  {
7479
- id: "skill.import",
7480
- command: "rudder skill import --org-id <id> --source <source>",
7481
- category: "skill",
7482
- description: "Import a skill package into the organization skill library.",
7483
- mutating: true,
7484
- contract: "agent-v1",
7485
- requiresOrgId: true,
7486
- requiresAgentId: false,
7487
- requiresRunId: false,
7488
- attachesRunIdWhenAvailable: true
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
7489
7538
  },
7490
7539
  {
7491
- id: "skill.scan-local",
7492
- command: "rudder skill scan-local --org-id <id> [--roots <csv>]",
7493
- category: "skill",
7494
- description: "Scan local roots for skill packages and import new ones.",
7495
- mutating: true,
7496
- contract: "agent-v1",
7497
- requiresOrgId: true,
7498
- requiresAgentId: false,
7499
- requiresRunId: false,
7500
- attachesRunIdWhenAvailable: true
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
7501
7547
  },
7502
7548
  {
7503
- id: "skill.scan-projects",
7504
- command: "rudder skill scan-projects --org-id <id> [--project-ids <csv>] [--workspace-ids <csv>]",
7505
- category: "skill",
7506
- description: "Scan the org workspace and any legacy project workspace records for skill packages and import new ones.",
7507
- mutating: true,
7508
- contract: "agent-v1",
7509
- requiresOrgId: true,
7510
- requiresAgentId: false,
7511
- requiresRunId: false,
7512
- attachesRunIdWhenAvailable: true
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
7513
7556
  },
7514
7557
  {
7515
- id: "browser.tabs",
7516
- command: "rudder browser tabs",
7517
- category: "browser",
7518
- description: "List Browser tabs owned by the current Rudder agent run.",
7519
- mutating: false,
7520
- contract: "agent-v1",
7521
- requiresOrgId: true,
7522
- requiresAgentId: true,
7523
- requiresRunId: true,
7524
- attachesRunIdWhenAvailable: false
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
7525
7565
  },
7526
7566
  {
7527
- id: "browser.open",
7528
- command: "rudder browser open <url>",
7529
- category: "browser",
7530
- description: "Open a run-owned tab in the Rudder Browser.",
7531
- mutating: true,
7532
- contract: "agent-v1",
7533
- requiresOrgId: true,
7534
- requiresAgentId: true,
7535
- requiresRunId: true,
7536
- attachesRunIdWhenAvailable: true
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
7537
7574
  },
7538
7575
  {
7539
- id: "browser.navigate",
7540
- command: "rudder browser navigate <tab-id> <url>",
7541
- category: "browser",
7542
- description: "Navigate a run-owned Rudder Browser tab.",
7543
- mutating: true,
7544
- contract: "agent-v1",
7545
- requiresOrgId: true,
7546
- requiresAgentId: true,
7547
- requiresRunId: true,
7548
- attachesRunIdWhenAvailable: true
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
7549
7583
  },
7550
7584
  {
7551
- id: "browser.read",
7552
- command: "rudder browser read <tab-id>",
7553
- category: "browser",
7554
- description: "Read a structured snapshot from a run-owned Rudder Browser tab.",
7555
- mutating: false,
7556
- contract: "agent-v1",
7557
- requiresOrgId: true,
7558
- requiresAgentId: true,
7559
- requiresRunId: true,
7560
- attachesRunIdWhenAvailable: false
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
7561
7592
  },
7562
7593
  {
7563
- id: "browser.click",
7564
- command: "rudder browser click <tab-id> <ref>",
7565
- category: "browser",
7566
- description: "Click an element reference returned by Rudder Browser read.",
7567
- mutating: true,
7568
- contract: "agent-v1",
7569
- requiresOrgId: true,
7570
- requiresAgentId: true,
7571
- requiresRunId: true,
7572
- attachesRunIdWhenAvailable: true
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
7573
7601
  },
7574
7602
  {
7575
- id: "browser.type",
7576
- command: "rudder browser type <tab-id> <ref> --text <text>",
7577
- category: "browser",
7578
- description: "Type into an element reference in a run-owned Rudder Browser tab.",
7579
- mutating: true,
7580
- contract: "agent-v1",
7581
- requiresOrgId: true,
7582
- requiresAgentId: true,
7583
- requiresRunId: true,
7584
- attachesRunIdWhenAvailable: true
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
7585
7610
  },
7586
7611
  {
7587
- id: "browser.screenshot",
7588
- command: "rudder browser screenshot <tab-id>",
7589
- category: "browser",
7590
- description: "Capture a screenshot of a run-owned Rudder Browser tab.",
7591
- mutating: false,
7592
- contract: "agent-v1",
7593
- requiresOrgId: true,
7594
- requiresAgentId: true,
7595
- requiresRunId: true,
7596
- attachesRunIdWhenAvailable: false
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
7597
7619
  },
7598
7620
  {
7599
- id: "browser.close",
7600
- command: "rudder browser close <tab-id>",
7601
- category: "browser",
7602
- description: "Close a run-owned Rudder Browser tab.",
7603
- mutating: true,
7604
- contract: "agent-v1",
7605
- requiresOrgId: true,
7606
- requiresAgentId: true,
7607
- requiresRunId: true,
7608
- attachesRunIdWhenAvailable: true
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
7609
7628
  },
7610
7629
  {
7611
- id: "automation.list",
7612
- command: "rudder automation list --org-id <id>",
7613
- category: "automation",
7614
- description: "List automations for an organization with compact local filters.",
7615
- mutating: false,
7616
- contract: "agent-v1",
7617
- requiresOrgId: true,
7618
- requiresAgentId: false,
7619
- requiresRunId: false,
7620
- attachesRunIdWhenAvailable: false
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
7621
7637
  },
7622
7638
  {
7623
- id: "automation.get",
7624
- command: "rudder automation get <automation-id>",
7625
- category: "automation",
7626
- description: "Read one automation detail including triggers and recent runs.",
7627
- mutating: false,
7628
- contract: "agent-v1",
7629
- requiresOrgId: false,
7630
- requiresAgentId: false,
7631
- requiresRunId: false,
7632
- attachesRunIdWhenAvailable: false
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
7633
7646
  },
7634
7647
  {
7635
- id: "automation.runs",
7636
- command: "rudder automation runs <automation-id>",
7637
- category: "automation",
7638
- description: "List recent runs for one automation.",
7639
- mutating: false,
7640
- contract: "agent-v1",
7641
- requiresOrgId: false,
7642
- requiresAgentId: false,
7643
- requiresRunId: false,
7644
- attachesRunIdWhenAvailable: false
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
7645
7655
  },
7646
7656
  {
7647
- id: "automation.triggers.list",
7648
- command: "rudder automation triggers list <automation-id>",
7649
- category: "automation",
7650
- description: "List triggers configured for one automation.",
7651
- mutating: false,
7652
- contract: "agent-v1",
7653
- requiresOrgId: false,
7654
- requiresAgentId: false,
7655
- requiresRunId: false,
7656
- attachesRunIdWhenAvailable: false
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
7657
7664
  },
7658
7665
  {
7659
- id: "automation.triggers.create",
7660
- command: "rudder automation triggers create <automation-id> --kind <kind>",
7661
- category: "automation",
7662
- description: "Create a schedule, webhook, or API trigger through the governed automation API.",
7663
- mutating: true,
7664
- contract: "agent-v1",
7665
- requiresOrgId: false,
7666
- requiresAgentId: false,
7667
- requiresRunId: false,
7668
- attachesRunIdWhenAvailable: true
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
7669
7673
  },
7670
7674
  {
7671
- id: "automation.triggers.update",
7672
- command: "rudder automation triggers update <trigger-id>",
7673
- category: "automation",
7674
- description: "Update an automation trigger through the governed automation API.",
7675
- mutating: true,
7676
- contract: "agent-v1",
7677
- requiresOrgId: false,
7678
- requiresAgentId: false,
7679
- requiresRunId: false,
7680
- attachesRunIdWhenAvailable: true
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
7681
7682
  },
7682
7683
  {
7683
- id: "automation.triggers.delete",
7684
- command: "rudder automation triggers delete <trigger-id>",
7685
- category: "automation",
7686
- description: "Delete an automation trigger through the governed automation API.",
7687
- mutating: true,
7688
- contract: "agent-v1",
7689
- requiresOrgId: false,
7690
- requiresAgentId: false,
7691
- requiresRunId: false,
7692
- attachesRunIdWhenAvailable: true
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
7693
7691
  },
7694
7692
  {
7695
- id: "automation.triggers.rotate-secret",
7696
- command: "rudder automation triggers rotate-secret <trigger-id>",
7697
- category: "automation",
7698
- description: "Rotate an automation webhook trigger secret through the governed automation API.",
7699
- mutating: true,
7700
- contract: "agent-v1",
7701
- requiresOrgId: false,
7702
- requiresAgentId: false,
7703
- requiresRunId: false,
7704
- attachesRunIdWhenAvailable: true
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
7705
7700
  },
7706
7701
  {
7707
- id: "automation.create",
7708
- command: "rudder automation create --org-id <id> --title <title> --assignee-agent-id <id>",
7709
- category: "automation",
7710
- description: "Create an automation through the governed automation API.",
7711
- mutating: true,
7712
- contract: "agent-v1",
7713
- requiresOrgId: true,
7714
- requiresAgentId: false,
7715
- requiresRunId: false,
7716
- attachesRunIdWhenAvailable: true
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
7717
7709
  },
7718
7710
  {
7719
- id: "automation.update",
7720
- command: "rudder automation update <automation-id>",
7721
- category: "automation",
7722
- description: "Update automation fields through the governed automation API.",
7723
- mutating: true,
7724
- contract: "agent-v1",
7725
- requiresOrgId: false,
7726
- requiresAgentId: false,
7727
- requiresRunId: false,
7728
- attachesRunIdWhenAvailable: true
7729
- },
7730
- {
7731
- id: "automation.enable",
7732
- command: "rudder automation enable <automation-id>",
7733
- category: "automation",
7734
- description: "Enable an automation by setting status to active.",
7735
- mutating: true,
7736
- contract: "agent-v1",
7737
- requiresOrgId: false,
7738
- requiresAgentId: false,
7739
- requiresRunId: false,
7740
- attachesRunIdWhenAvailable: true
7741
- },
7742
- {
7743
- id: "automation.disable",
7744
- command: "rudder automation disable <automation-id>",
7745
- category: "automation",
7746
- description: "Disable an automation by setting status to paused.",
7747
- mutating: true,
7748
- contract: "agent-v1",
7749
- requiresOrgId: false,
7750
- requiresAgentId: false,
7751
- requiresRunId: false,
7752
- attachesRunIdWhenAvailable: true
7753
- },
7754
- {
7755
- id: "automation.run",
7756
- command: "rudder automation run <automation-id>",
7757
- category: "automation",
7758
- description: "Trigger a manual automation run.",
7759
- mutating: true,
7760
- contract: "agent-v1",
7761
- requiresOrgId: false,
7762
- requiresAgentId: false,
7763
- requiresRunId: false,
7764
- attachesRunIdWhenAvailable: true
7765
- },
7766
- {
7767
- id: "chat.list",
7768
- command: "rudder chat list --org-id <id>",
7769
- category: "chat",
7770
- description: "List chat conversations without dumping full message history.",
7771
- mutating: false,
7772
- contract: "agent-v1",
7773
- requiresOrgId: true,
7774
- requiresAgentId: false,
7775
- requiresRunId: false,
7776
- attachesRunIdWhenAvailable: false
7777
- },
7778
- {
7779
- id: "chat.search",
7780
- command: "rudder chat search <query> --org-id <id>",
7781
- category: "chat",
7782
- description: "Search chats with bounded snippets and optional scope filtering.",
7783
- mutating: false,
7784
- contract: "agent-v1",
7785
- requiresOrgId: true,
7786
- requiresAgentId: false,
7787
- requiresRunId: false,
7788
- attachesRunIdWhenAvailable: false
7789
- },
7790
- {
7791
- id: "chat.get",
7792
- command: "rudder chat get <chat-id>",
7793
- category: "chat",
7794
- description: "Read one chat conversation record.",
7795
- mutating: false,
7796
- contract: "agent-v1",
7797
- requiresOrgId: false,
7798
- requiresAgentId: false,
7799
- requiresRunId: false,
7800
- attachesRunIdWhenAvailable: false
7801
- },
7802
- {
7803
- id: "chat.messages",
7804
- command: "rudder chat messages <chat-id> [--limit <n>] [--cursor <cursor>] [--include-transcript]",
7805
- category: "chat",
7806
- description: "Read bounded chat messages with page cursors; transcript output is omitted unless requested.",
7807
- mutating: false,
7808
- contract: "agent-v1",
7809
- requiresOrgId: false,
7810
- requiresAgentId: false,
7811
- requiresRunId: false,
7812
- attachesRunIdWhenAvailable: false
7813
- },
7814
- {
7815
- id: "chat.transcript",
7816
- command: "rudder chat transcript <chat-id> [--limit <n>] [--cursor <cursor>] [--max-output-chars <n>]",
7817
- category: "chat",
7818
- description: "Read paginated chat messages with assistant transcript entries clipped in human output.",
7819
- mutating: false,
7820
- contract: "agent-v1",
7821
- requiresOrgId: false,
7822
- requiresAgentId: false,
7823
- requiresRunId: false,
7824
- attachesRunIdWhenAvailable: false
7825
- },
7826
- {
7827
- id: "chat.read",
7828
- command: "rudder chat read <chat-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output]",
7829
- category: "chat",
7830
- description: "Read a bounded recent-message snapshot for one chat with page cursors.",
7831
- mutating: false,
7832
- contract: "agent-v1",
7833
- requiresOrgId: false,
7834
- requiresAgentId: false,
7835
- requiresRunId: false,
7836
- attachesRunIdWhenAvailable: false
7837
- },
7838
- {
7839
- id: "chat.create",
7840
- command: "rudder chat create --org-id <id>",
7841
- category: "chat",
7842
- description: "Create a chat conversation.",
7843
- mutating: true,
7844
- contract: "agent-v1",
7845
- requiresOrgId: true,
7846
- requiresAgentId: false,
7847
- requiresRunId: false,
7848
- attachesRunIdWhenAvailable: true
7849
- },
7850
- {
7851
- id: "chat.send",
7852
- command: "rudder chat send <chat-id> --body <text>",
7853
- category: "chat",
7854
- description: "Send an agent-authored message directly to the operator in a chat.",
7855
- mutating: true,
7856
- contract: "agent-v1",
7857
- requiresOrgId: false,
7858
- requiresAgentId: true,
7859
- requiresRunId: false,
7860
- attachesRunIdWhenAvailable: true
7861
- },
7862
- {
7863
- id: "chat.archive",
7864
- command: "rudder chat archive <chat-id>",
7865
- category: "chat",
7866
- description: "Archive a chat conversation without deleting it.",
7867
- mutating: true,
7868
- contract: "agent-v1",
7869
- requiresOrgId: false,
7870
- requiresAgentId: false,
7871
- requiresRunId: false,
7872
- attachesRunIdWhenAvailable: true
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
7873
7718
  },
7874
7719
  {
7875
- id: "runs.list",
7876
- command: "rudder runs list --org-id <id> [--used-skill <skill>] [--loaded-skill <skill>] [--cursor <cursor>] [--full]",
7877
- category: "runs",
7878
- description: "List lightweight run summaries with stable pagination and filters; use --full only for legacy full-row compatibility.",
7879
- mutating: false,
7880
- contract: "agent-v1",
7881
- requiresOrgId: true,
7882
- requiresAgentId: false,
7883
- requiresRunId: false,
7884
- attachesRunIdWhenAvailable: false
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
7885
7727
  },
7886
7728
  {
7887
- id: "runs.by-skill",
7888
- command: "rudder runs by-skill <skill> --org-id <id> [--evidence <used-or-loaded>] [--cursor <cursor>] [--full]",
7889
- category: "runs",
7890
- description: "Build a paginated skill evidence packet from lightweight run summaries; use --full only for legacy full-row compatibility.",
7891
- mutating: false,
7892
- contract: "agent-v1",
7893
- requiresOrgId: true,
7894
- requiresAgentId: false,
7895
- requiresRunId: false,
7896
- attachesRunIdWhenAvailable: false
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
7897
7736
  },
7898
7737
  {
7899
- id: "runs.get",
7900
- command: "rudder runs get <run-id> [--full]",
7901
- category: "runs",
7902
- description: "Read one bounded run summary; use --full only from a direct trusted CLI for raw detail.",
7903
- mutating: false,
7904
- contract: "agent-v1",
7905
- requiresOrgId: false,
7906
- requiresAgentId: false,
7907
- requiresRunId: false,
7908
- attachesRunIdWhenAvailable: false
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
7909
7745
  },
7910
7746
  {
7911
- id: "runs.events",
7912
- command: "rudder runs events <run-id> [--cursor <cursor>] [--after-seq <n>] [--limit <n>] [--full]",
7913
- category: "runs",
7914
- description: "List a bounded page of persisted run events with a lossless opaque cursor and clipped payload previews.",
7915
- mutating: false,
7916
- contract: "agent-v1",
7917
- requiresOrgId: false,
7918
- requiresAgentId: false,
7919
- requiresRunId: false,
7920
- attachesRunIdWhenAvailable: false
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
7921
7754
  },
7922
7755
  {
7923
- id: "runs.log",
7924
- command: "rudder runs log <run-id> [--offset <bytes>] [--limit-bytes <n>]",
7925
- category: "runs",
7926
- description: "Read a bounded byte range of stored run log content.",
7927
- mutating: false,
7928
- contract: "agent-v1",
7929
- requiresOrgId: false,
7930
- requiresAgentId: false,
7931
- requiresRunId: false,
7932
- attachesRunIdWhenAvailable: false
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
7933
7763
  },
7934
7764
  {
7935
- id: "runs.transcript",
7936
- command: "rudder runs transcript <run-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output] [--full]",
7937
- category: "runs",
7938
- description: "Read a compact server-normalized transcript; --json changes encoding only and --full is direct-CLI-only raw access.",
7939
- mutating: false,
7940
- contract: "agent-v1",
7941
- requiresOrgId: false,
7942
- requiresAgentId: false,
7943
- requiresRunId: false,
7944
- attachesRunIdWhenAvailable: false
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
7945
7772
  },
7946
7773
  {
7947
- id: "runs.errors",
7948
- command: "rudder runs errors <run-id>",
7949
- category: "runs",
7950
- description: "List failed tool calls, stderr, runtime failures, and jump-to-context commands.",
7951
- mutating: false,
7952
- contract: "agent-v1",
7953
- requiresOrgId: false,
7954
- requiresAgentId: false,
7955
- requiresRunId: false,
7956
- attachesRunIdWhenAvailable: false
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
7957
7781
  },
7958
7782
  {
7959
- id: "runs.cancel",
7960
- command: "rudder runs cancel <run-id>",
7961
- category: "runs",
7962
- description: "Cancel a heartbeat run through the governed server route.",
7963
- mutating: true,
7964
- contract: "agent-v1",
7965
- requiresOrgId: false,
7966
- requiresAgentId: false,
7967
- requiresRunId: false,
7968
- attachesRunIdWhenAvailable: true
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
7969
7790
  },
7970
7791
  {
7971
- id: "runs.retry",
7972
- command: "rudder runs retry <run-id>",
7973
- category: "runs",
7974
- description: "Retry a failed, timed out, or cancelled run through the governed server route.",
7975
- mutating: true,
7976
- contract: "agent-v1",
7977
- requiresOrgId: false,
7978
- requiresAgentId: false,
7979
- requiresRunId: false,
7980
- attachesRunIdWhenAvailable: true
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
7981
7799
  }
7982
7800
  ];
7983
- var CATEGORY_TITLES = {
7984
- agent: "Agent",
7985
- issue: "Issue",
7986
- project: "Project",
7987
- automation: "Automation",
7988
- chat: "Chat",
7989
- runs: "Runs",
7990
- approval: "Approval",
7991
- skill: "Skill",
7992
- browser: "Browser",
7993
- user: "User",
7994
- library: "Library"
7995
- };
7996
- function getAgentCliCapabilities() {
7997
- return AGENT_CLI_CAPABILITIES.map((entry) => ({ ...entry }));
7998
- }
7999
- function getAgentCliCapabilityById(id) {
8000
- const entry = AGENT_CLI_CAPABILITIES.find((capability) => capability.id === id);
8001
- if (!entry) {
8002
- throw new Error(`Unknown agent CLI capability: ${id}`);
8003
- }
8004
- return entry;
8005
- }
8006
- function buildAgentCliCapabilitiesManifest(contract = "agent-v1") {
8007
- const capabilities = AGENT_CLI_CAPABILITIES.filter((entry) => contract === "all" || entry.contract === contract).map((entry) => ({
8008
- ...entry,
8009
- agentV1: entry.contract === "agent-v1"
8010
- }));
8011
- return {
8012
- schema: "rudder.agent-capabilities/v1",
8013
- contract,
8014
- defaults: {
8015
- orgIdEnvVar: "RUDDER_ORG_ID",
8016
- agentIdEnvVar: "RUDDER_AGENT_ID",
8017
- runIdEnvVar: "RUDDER_RUN_ID",
8018
- jsonErrors: "stderr-error-envelope"
8019
- },
8020
- capabilities
8021
- };
8022
- }
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 };
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 };
8028
7806
  }
8029
7807
  function mcpBoolean(description) {
8030
7808
  return { type: "boolean", description };
@@ -8035,7 +7813,7 @@ function mcpNumber(description) {
8035
7813
  function mcpStringArray(description) {
8036
7814
  return { type: "array", items: { type: "string" }, description };
8037
7815
  }
8038
- function mcpInputSchemaForCapability(id) {
7816
+ function rudderMcpInputSchemaForCapability(id) {
8039
7817
  const properties = {};
8040
7818
  const add = (key, value) => {
8041
7819
  properties[key] = value;
@@ -8103,11 +7881,7 @@ function mcpInputSchemaForCapability(id) {
8103
7881
  addString("run", "Run id or short run id.");
8104
7882
  break;
8105
7883
  }
8106
- return {
8107
- type: "object",
8108
- additionalProperties: false,
8109
- properties
8110
- };
7884
+ return { type: "object", additionalProperties: false, properties };
8111
7885
  }
8112
7886
  if (id.startsWith("issue.")) {
8113
7887
  add("issue", mcpString("Issue UUID, identifier, or short reference."));
@@ -8115,7 +7889,8 @@ function mcpInputSchemaForCapability(id) {
8115
7889
  add("comment", mcpString("Direct Markdown review, blocker, or completion comment."));
8116
7890
  add("images", { type: "array", items: { type: "string" }, description: "Local image paths to attach when supported." });
8117
7891
  }
8118
- if (id.startsWith("project.")) add("project", mcpString("Project UUID or shortname."));
7892
+ if (id.startsWith("project."))
7893
+ add("project", mcpString("Project UUID or shortname."));
8119
7894
  if (id.startsWith("library.file.")) {
8120
7895
  add("path", mcpString("Library-relative file or directory path."));
8121
7896
  if (id === "library.file.list") {
@@ -8254,28 +8029,1196 @@ function mcpInputSchemaForCapability(id) {
8254
8029
  })) {
8255
8030
  add(key, mcpStringArray(description));
8256
8031
  }
8257
- for (const key of ["clearTitle", "clearCapabilities", "clearDescription", "clearReportsTo", "enable", "enabled", "disabled", "reopen", "planMode", "includeTranscript", "includeOutput", "includeOutputs", "notifyOnIssueCreated", "errorsOnly", "chronological", "narrative", "submit", "full"]) {
8258
- add(key, mcpBoolean(`Boolean option ${key}.`));
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
+ }
8078
+
8079
+ // src/agent-v1-mcp-server.ts
8080
+ init_dist();
8081
+ import { spawn, spawnSync } from "node:child_process";
8082
+ import { existsSync as existsSync2 } from "node:fs";
8083
+ import fs from "node:fs/promises";
8084
+ import os from "node:os";
8085
+ import path2 from "node:path";
8086
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
8087
+
8088
+ // src/agent-v1-registry.ts
8089
+ var AGENT_CLI_CAPABILITIES = [
8090
+ {
8091
+ id: "agent.me",
8092
+ command: "rudder agent me",
8093
+ category: "agent",
8094
+ description: "Show the authenticated agent identity, budget, and chain of command.",
8095
+ mutating: false,
8096
+ contract: "agent-v1",
8097
+ requiresOrgId: false,
8098
+ requiresAgentId: false,
8099
+ requiresRunId: false,
8100
+ attachesRunIdWhenAvailable: false
8101
+ },
8102
+ {
8103
+ id: "agent.inbox",
8104
+ command: "rudder agent inbox",
8105
+ category: "agent",
8106
+ description: "List the compact assignee and reviewer work inbox for the authenticated agent.",
8107
+ mutating: false,
8108
+ contract: "agent-v1",
8109
+ requiresOrgId: false,
8110
+ requiresAgentId: false,
8111
+ requiresRunId: false,
8112
+ attachesRunIdWhenAvailable: false
8113
+ },
8114
+ {
8115
+ id: "agent.capabilities",
8116
+ command: "rudder agent capabilities",
8117
+ category: "agent",
8118
+ description: "List the stable Rudder agent command contract.",
8119
+ mutating: false,
8120
+ contract: "agent-v1",
8121
+ requiresOrgId: false,
8122
+ requiresAgentId: false,
8123
+ requiresRunId: false,
8124
+ attachesRunIdWhenAvailable: false
8125
+ },
8126
+ {
8127
+ id: "agent.list",
8128
+ command: "rudder agent list --org-id <id>",
8129
+ category: "agent",
8130
+ description: "List agents for an organization.",
8131
+ mutating: false,
8132
+ contract: "compat",
8133
+ requiresOrgId: true,
8134
+ requiresAgentId: false,
8135
+ requiresRunId: false,
8136
+ attachesRunIdWhenAvailable: false
8137
+ },
8138
+ {
8139
+ id: "agent.get",
8140
+ command: "rudder agent get <agent-id-or-shortname-or-agt-ref>",
8141
+ category: "agent",
8142
+ description: "Read one agent by id, shortname, or agt_<uuid-prefix> short ref.",
8143
+ mutating: false,
8144
+ contract: "compat",
8145
+ requiresOrgId: false,
8146
+ requiresAgentId: false,
8147
+ requiresRunId: false,
8148
+ attachesRunIdWhenAvailable: false
8149
+ },
8150
+ {
8151
+ id: "agent.update",
8152
+ command: "rudder agent update [agent-id] [--title <title>] [--description <text>]",
8153
+ category: "agent",
8154
+ description: "Update an agent's control-plane identity fields; defaults to the authenticated agent.",
8155
+ mutating: true,
8156
+ contract: "agent-v1",
8157
+ requiresOrgId: false,
8158
+ requiresAgentId: false,
8159
+ requiresRunId: false,
8160
+ attachesRunIdWhenAvailable: true
8161
+ },
8162
+ {
8163
+ id: "agent.skills.create",
8164
+ command: "rudder agent skills create [agent-id] --name <name> [--enable]",
8165
+ category: "agent",
8166
+ description: "Create an agent-private skill package under AGENT_HOME/skills.",
8167
+ mutating: true,
8168
+ contract: "agent-v1",
8169
+ requiresOrgId: false,
8170
+ requiresAgentId: false,
8171
+ requiresRunId: false,
8172
+ attachesRunIdWhenAvailable: true
8173
+ },
8174
+ {
8175
+ id: "agent.skills.enable",
8176
+ command: "rudder agent skills enable <agent-id> <selection-ref...>",
8177
+ category: "agent",
8178
+ description: "Add skill selections to an agent without replacing existing enabled skills.",
8179
+ mutating: true,
8180
+ contract: "agent-v1",
8181
+ requiresOrgId: false,
8182
+ requiresAgentId: false,
8183
+ requiresRunId: false,
8184
+ attachesRunIdWhenAvailable: true
8185
+ },
8186
+ {
8187
+ id: "agent.skills.sync",
8188
+ command: "rudder agent skills sync <agent-id>",
8189
+ category: "agent",
8190
+ description: "Sync the desired enabled skill set for an agent.",
8191
+ mutating: true,
8192
+ contract: "agent-v1",
8193
+ requiresOrgId: false,
8194
+ requiresAgentId: false,
8195
+ requiresRunId: false,
8196
+ attachesRunIdWhenAvailable: true
8197
+ },
8198
+ {
8199
+ id: "agent.hire",
8200
+ command: "rudder agent hire --org-id <id> --payload <json>",
8201
+ category: "agent",
8202
+ description: "Create a new hire using the canonical hire workflow.",
8203
+ mutating: true,
8204
+ contract: "compat",
8205
+ requiresOrgId: true,
8206
+ requiresAgentId: false,
8207
+ requiresRunId: false,
8208
+ attachesRunIdWhenAvailable: true
8209
+ },
8210
+ {
8211
+ id: "agent.config.index",
8212
+ command: "rudder agent config index",
8213
+ category: "agent",
8214
+ description: "Read the installed agent runtime configuration index.",
8215
+ mutating: false,
8216
+ contract: "compat",
8217
+ requiresOrgId: false,
8218
+ requiresAgentId: false,
8219
+ requiresRunId: false,
8220
+ attachesRunIdWhenAvailable: false
8221
+ },
8222
+ {
8223
+ id: "agent.config.doc",
8224
+ command: "rudder agent config doc <agent-runtime-type>",
8225
+ category: "agent",
8226
+ description: "Read adapter-specific configuration guidance for one runtime.",
8227
+ mutating: false,
8228
+ contract: "compat",
8229
+ requiresOrgId: false,
8230
+ requiresAgentId: false,
8231
+ requiresRunId: false,
8232
+ attachesRunIdWhenAvailable: false
8233
+ },
8234
+ {
8235
+ id: "agent.config.list",
8236
+ command: "rudder agent config list --org-id <id>",
8237
+ category: "agent",
8238
+ description: "List redacted agent configuration snapshots for an organization.",
8239
+ mutating: false,
8240
+ contract: "compat",
8241
+ requiresOrgId: true,
8242
+ requiresAgentId: false,
8243
+ requiresRunId: false,
8244
+ attachesRunIdWhenAvailable: false
8245
+ },
8246
+ {
8247
+ id: "agent.config.get",
8248
+ command: "rudder agent config get <agent-id-or-shortname>",
8249
+ category: "agent",
8250
+ description: "Read one redacted agent configuration snapshot by id or shortname.",
8251
+ mutating: false,
8252
+ contract: "compat",
8253
+ requiresOrgId: false,
8254
+ requiresAgentId: false,
8255
+ requiresRunId: false,
8256
+ attachesRunIdWhenAvailable: false
8257
+ },
8258
+ {
8259
+ id: "agent.icons",
8260
+ command: "rudder agent icons",
8261
+ category: "agent",
8262
+ description: "List legacy named agent icons for compatibility/debugging; normal create and hire payloads should omit icon.",
8263
+ mutating: false,
8264
+ contract: "compat",
8265
+ requiresOrgId: false,
8266
+ requiresAgentId: false,
8267
+ requiresRunId: false,
8268
+ attachesRunIdWhenAvailable: false
8269
+ },
8270
+ {
8271
+ id: "issue.get",
8272
+ command: "rudder issue get <issue>",
8273
+ category: "issue",
8274
+ description: "Read a full issue by UUID or identifier.",
8275
+ mutating: false,
8276
+ contract: "agent-v1",
8277
+ requiresOrgId: false,
8278
+ requiresAgentId: false,
8279
+ requiresRunId: false,
8280
+ attachesRunIdWhenAvailable: false
8281
+ },
8282
+ {
8283
+ id: "issue.search",
8284
+ command: "rudder issue search <query> [--org-id <id>]",
8285
+ category: "issue",
8286
+ description: "Search issues with the server-side issue index across title, identifier, description, and comments.",
8287
+ mutating: false,
8288
+ contract: "agent-v1",
8289
+ requiresOrgId: true,
8290
+ requiresAgentId: false,
8291
+ requiresRunId: false,
8292
+ attachesRunIdWhenAvailable: false
8293
+ },
8294
+ {
8295
+ id: "issue.context",
8296
+ command: "rudder issue context <issue> [--wake-comment-id <comment-id-or-cmt-ref>]",
8297
+ category: "issue",
8298
+ description: "Read the compact heartbeat context for an issue; wake comments may be addressed by full id or cmt_<uuid-prefix>.",
8299
+ mutating: false,
8300
+ contract: "agent-v1",
8301
+ requiresOrgId: false,
8302
+ requiresAgentId: false,
8303
+ requiresRunId: false,
8304
+ attachesRunIdWhenAvailable: false
8305
+ },
8306
+ {
8307
+ id: "issue.checkout",
8308
+ command: "rudder issue checkout <issue>",
8309
+ category: "issue",
8310
+ description: "Atomically checkout an issue for the current or specified agent.",
8311
+ mutating: true,
8312
+ contract: "agent-v1",
8313
+ requiresOrgId: false,
8314
+ requiresAgentId: true,
8315
+ requiresRunId: false,
8316
+ attachesRunIdWhenAvailable: true
8317
+ },
8318
+ {
8319
+ id: "issue.comment",
8320
+ command: "rudder issue comment <issue> --body-file <path> [--image <path>]",
8321
+ category: "issue",
8322
+ description: "Add a comment to an issue, optionally uploading images and appending Markdown image links.",
8323
+ mutating: true,
8324
+ contract: "agent-v1",
8325
+ requiresOrgId: false,
8326
+ requiresAgentId: false,
8327
+ requiresRunId: false,
8328
+ attachesRunIdWhenAvailable: true
8329
+ },
8330
+ {
8331
+ id: "issue.comments.list",
8332
+ command: "rudder issue comments list <issue> [--after <comment-id-or-cmt-ref>]",
8333
+ category: "issue",
8334
+ description: "List issue comments, optionally only newer comments after a full comment id or cmt_<uuid-prefix> with --after.",
8335
+ mutating: false,
8336
+ contract: "agent-v1",
8337
+ requiresOrgId: false,
8338
+ requiresAgentId: false,
8339
+ requiresRunId: false,
8340
+ attachesRunIdWhenAvailable: false
8341
+ },
8342
+ {
8343
+ id: "issue.comments.get",
8344
+ command: "rudder issue comments get <issue> <comment-id-or-cmt-ref>",
8345
+ category: "issue",
8346
+ description: "Read one issue comment by full id or cmt_<uuid-prefix> scoped to the issue.",
8347
+ mutating: false,
8348
+ contract: "agent-v1",
8349
+ requiresOrgId: false,
8350
+ requiresAgentId: false,
8351
+ requiresRunId: false,
8352
+ attachesRunIdWhenAvailable: false
8353
+ },
8354
+ {
8355
+ id: "issue.update",
8356
+ command: "rudder issue update <issue> ... [--comment-file <path>] [--image <path>]",
8357
+ category: "issue",
8358
+ description: "Apply generic issue updates when workflow commands are not enough, optionally uploading images for the update comment.",
8359
+ mutating: true,
8360
+ contract: "agent-v1",
8361
+ requiresOrgId: false,
8362
+ requiresAgentId: false,
8363
+ requiresRunId: false,
8364
+ attachesRunIdWhenAvailable: true
8365
+ },
8366
+ {
8367
+ id: "issue.review",
8368
+ command: "rudder issue review <issue> --decision <decision> --comment-file <path>",
8369
+ category: "issue",
8370
+ description: "Record a structured reviewer decision with a required comment.",
8371
+ mutating: true,
8372
+ contract: "agent-v1",
8373
+ requiresOrgId: false,
8374
+ requiresAgentId: false,
8375
+ requiresRunId: false,
8376
+ attachesRunIdWhenAvailable: true
8377
+ },
8378
+ {
8379
+ id: "issue.commit",
8380
+ command: "rudder issue commit <issue> --sha <sha> --message <subject>",
8381
+ category: "issue",
8382
+ description: "Report a code commit created during issue work as structured issue activity.",
8383
+ mutating: true,
8384
+ contract: "agent-v1",
8385
+ requiresOrgId: false,
8386
+ requiresAgentId: false,
8387
+ requiresRunId: false,
8388
+ attachesRunIdWhenAvailable: true
8389
+ },
8390
+ {
8391
+ id: "issue.done",
8392
+ command: "rudder issue done <issue> --comment-file <path> [--image <path>]",
8393
+ category: "issue",
8394
+ description: "Mark an issue done with a required completion comment, optionally uploading images.",
8395
+ mutating: true,
8396
+ contract: "agent-v1",
8397
+ requiresOrgId: false,
8398
+ requiresAgentId: false,
8399
+ requiresRunId: false,
8400
+ attachesRunIdWhenAvailable: true
8401
+ },
8402
+ {
8403
+ id: "issue.block",
8404
+ command: "rudder issue block <issue> --comment-file <path> [--image <path>]",
8405
+ category: "issue",
8406
+ description: "Mark an issue blocked with a required blocker comment, optionally uploading images.",
8407
+ mutating: true,
8408
+ contract: "agent-v1",
8409
+ requiresOrgId: false,
8410
+ requiresAgentId: false,
8411
+ requiresRunId: false,
8412
+ attachesRunIdWhenAvailable: true
8413
+ },
8414
+ {
8415
+ id: "project.list",
8416
+ command: "rudder project list --org-id <id>",
8417
+ category: "project",
8418
+ description: "List projects in an organization.",
8419
+ mutating: false,
8420
+ contract: "agent-v1",
8421
+ requiresOrgId: true,
8422
+ requiresAgentId: false,
8423
+ requiresRunId: false,
8424
+ attachesRunIdWhenAvailable: false
8425
+ },
8426
+ {
8427
+ id: "project.get",
8428
+ command: "rudder project get <project-id-or-shortname> [--org-id <id>]",
8429
+ category: "project",
8430
+ description: "Read one project by ID or shortname.",
8431
+ mutating: false,
8432
+ contract: "agent-v1",
8433
+ requiresOrgId: false,
8434
+ requiresAgentId: false,
8435
+ requiresRunId: false,
8436
+ attachesRunIdWhenAvailable: false
8437
+ },
8438
+ {
8439
+ id: "project.create",
8440
+ command: "rudder project create --org-id <id> --name <name>",
8441
+ category: "project",
8442
+ description: "Create a project in the organization.",
8443
+ mutating: true,
8444
+ contract: "agent-v1",
8445
+ requiresOrgId: true,
8446
+ requiresAgentId: false,
8447
+ requiresRunId: false,
8448
+ attachesRunIdWhenAvailable: true
8449
+ },
8450
+ {
8451
+ id: "project.update",
8452
+ command: "rudder project update <project-id-or-shortname> [--org-id <id>]",
8453
+ category: "project",
8454
+ description: "Update mutable project fields such as name, description, status, goals, lead agent, target date, color, or archivedAt.",
8455
+ mutating: true,
8456
+ contract: "agent-v1",
8457
+ requiresOrgId: false,
8458
+ requiresAgentId: false,
8459
+ requiresRunId: false,
8460
+ attachesRunIdWhenAvailable: true
8461
+ },
8462
+ {
8463
+ id: "user.activity",
8464
+ command: "rudder user activity --user me --since today --json",
8465
+ category: "user",
8466
+ description: "Read a user-centered activity ledger with safe excerpts and provenance across chats, issue comments, approval comments, and user actor activity.",
8467
+ mutating: false,
8468
+ contract: "agent-v1",
8469
+ requiresOrgId: true,
8470
+ requiresAgentId: false,
8471
+ requiresRunId: false,
8472
+ attachesRunIdWhenAvailable: false
8473
+ },
8474
+ {
8475
+ id: "library.file.list",
8476
+ command: "rudder library file list [directory]",
8477
+ category: "library",
8478
+ description: "List Library files and folders; file rows include `libraryEntryId` when a strong reference can be generated.",
8479
+ mutating: false,
8480
+ contract: "agent-v1",
8481
+ requiresOrgId: true,
8482
+ requiresAgentId: false,
8483
+ requiresRunId: false,
8484
+ attachesRunIdWhenAvailable: false
8485
+ },
8486
+ {
8487
+ id: "library.file.get",
8488
+ command: "rudder library file get <path>",
8489
+ category: "library",
8490
+ description: "Fallback read when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
8491
+ mutating: false,
8492
+ contract: "agent-v1",
8493
+ requiresOrgId: true,
8494
+ requiresAgentId: false,
8495
+ requiresRunId: false,
8496
+ attachesRunIdWhenAvailable: false
8497
+ },
8498
+ {
8499
+ id: "library.file.ref",
8500
+ command: "rudder library file ref <path>",
8501
+ category: "library",
8502
+ description: "Return the stable Markdown reference for one Library file without printing file content.",
8503
+ mutating: false,
8504
+ contract: "agent-v1",
8505
+ requiresOrgId: true,
8506
+ requiresAgentId: false,
8507
+ requiresRunId: false,
8508
+ attachesRunIdWhenAvailable: false
8509
+ },
8510
+ {
8511
+ id: "library.file.link",
8512
+ command: "rudder library file link <path>",
8513
+ category: "library",
8514
+ description: "Compatibility alias for `rudder library file ref <path>`.",
8515
+ mutating: false,
8516
+ contract: "agent-v1",
8517
+ requiresOrgId: true,
8518
+ requiresAgentId: false,
8519
+ requiresRunId: false,
8520
+ attachesRunIdWhenAvailable: false
8521
+ },
8522
+ {
8523
+ id: "library.file.put",
8524
+ command: "rudder library file put <path> --body-file <path>",
8525
+ category: "library",
8526
+ description: "Fallback create/update when local filesystem access is unavailable; JSON includes `mentionHref` and `markdownLink`.",
8527
+ mutating: true,
8528
+ contract: "agent-v1",
8529
+ requiresOrgId: true,
8530
+ requiresAgentId: false,
8531
+ requiresRunId: false,
8532
+ attachesRunIdWhenAvailable: true
8533
+ },
8534
+ {
8535
+ id: "issue.create",
8536
+ command: "rudder issue create --org-id <id> ... [--label-id <id> ...] [--label <name> ...]",
8537
+ category: "issue",
8538
+ description: "Create a new issue or subtask with the generic issue surface; agent-created issues default to the creating agent when no assignee is supplied.",
8539
+ mutating: true,
8540
+ contract: "compat",
8541
+ requiresOrgId: true,
8542
+ requiresAgentId: false,
8543
+ requiresRunId: false,
8544
+ attachesRunIdWhenAvailable: true
8545
+ },
8546
+ {
8547
+ id: "issue.labels.list",
8548
+ command: "rudder issue labels list --org-id <id>",
8549
+ category: "issue",
8550
+ description: "List organization issue labels available for issue creation.",
8551
+ mutating: false,
8552
+ contract: "compat",
8553
+ requiresOrgId: true,
8554
+ requiresAgentId: false,
8555
+ requiresRunId: false,
8556
+ attachesRunIdWhenAvailable: false
8557
+ },
8558
+ {
8559
+ id: "approval.get",
8560
+ command: "rudder approval get <approval-id>",
8561
+ category: "approval",
8562
+ description: "Read one approval request.",
8563
+ mutating: false,
8564
+ contract: "agent-v1",
8565
+ requiresOrgId: false,
8566
+ requiresAgentId: false,
8567
+ requiresRunId: false,
8568
+ attachesRunIdWhenAvailable: false
8569
+ },
8570
+ {
8571
+ id: "approval.create",
8572
+ command: "rudder approval create --org-id <id> --type <type> --payload <json>",
8573
+ category: "approval",
8574
+ description: "Create a new approval request.",
8575
+ mutating: true,
8576
+ contract: "compat",
8577
+ requiresOrgId: true,
8578
+ requiresAgentId: false,
8579
+ requiresRunId: false,
8580
+ attachesRunIdWhenAvailable: true
8581
+ },
8582
+ {
8583
+ id: "approval.issues",
8584
+ command: "rudder approval issues <approval-id>",
8585
+ category: "approval",
8586
+ description: "List the issues linked to an approval.",
8587
+ mutating: false,
8588
+ contract: "agent-v1",
8589
+ requiresOrgId: false,
8590
+ requiresAgentId: false,
8591
+ requiresRunId: false,
8592
+ attachesRunIdWhenAvailable: false
8593
+ },
8594
+ {
8595
+ id: "approval.comment",
8596
+ command: "rudder approval comment <approval-id> --body-file <path>",
8597
+ category: "approval",
8598
+ description: "Add a comment to an approval.",
8599
+ mutating: true,
8600
+ contract: "agent-v1",
8601
+ requiresOrgId: false,
8602
+ requiresAgentId: false,
8603
+ requiresRunId: false,
8604
+ attachesRunIdWhenAvailable: true
8605
+ },
8606
+ {
8607
+ id: "approval.resubmit",
8608
+ command: "rudder approval resubmit <approval-id> [--payload <json>]",
8609
+ category: "approval",
8610
+ description: "Resubmit a revision-requested approval, optionally with updated payload.",
8611
+ mutating: true,
8612
+ contract: "compat",
8613
+ requiresOrgId: false,
8614
+ requiresAgentId: false,
8615
+ requiresRunId: false,
8616
+ attachesRunIdWhenAvailable: true
8617
+ },
8618
+ {
8619
+ id: "skill.list",
8620
+ command: "rudder skill list --org-id <id>",
8621
+ category: "skill",
8622
+ description: "List organization-visible skills.",
8623
+ mutating: false,
8624
+ contract: "agent-v1",
8625
+ requiresOrgId: true,
8626
+ requiresAgentId: false,
8627
+ requiresRunId: false,
8628
+ attachesRunIdWhenAvailable: false
8629
+ },
8630
+ {
8631
+ id: "skill.get",
8632
+ command: "rudder skill get <skill-id> --org-id <id>",
8633
+ category: "skill",
8634
+ description: "Read one organization skill detail.",
8635
+ mutating: false,
8636
+ contract: "agent-v1",
8637
+ requiresOrgId: true,
8638
+ requiresAgentId: false,
8639
+ requiresRunId: false,
8640
+ attachesRunIdWhenAvailable: false
8641
+ },
8642
+ {
8643
+ id: "skill.file",
8644
+ command: "rudder skill file <skill-id> --org-id <id> [--path SKILL.md]",
8645
+ category: "skill",
8646
+ description: "Read one file from an organization skill package.",
8647
+ mutating: false,
8648
+ contract: "agent-v1",
8649
+ requiresOrgId: true,
8650
+ requiresAgentId: false,
8651
+ requiresRunId: false,
8652
+ attachesRunIdWhenAvailable: false
8653
+ },
8654
+ {
8655
+ id: "skill.import",
8656
+ command: "rudder skill import --org-id <id> --source <source>",
8657
+ category: "skill",
8658
+ description: "Import a skill package into the organization skill library.",
8659
+ mutating: true,
8660
+ contract: "agent-v1",
8661
+ requiresOrgId: true,
8662
+ requiresAgentId: false,
8663
+ requiresRunId: false,
8664
+ attachesRunIdWhenAvailable: true
8665
+ },
8666
+ {
8667
+ id: "skill.scan-local",
8668
+ command: "rudder skill scan-local --org-id <id> [--roots <csv>]",
8669
+ category: "skill",
8670
+ description: "Scan local roots for skill packages and import new ones.",
8671
+ mutating: true,
8672
+ contract: "agent-v1",
8673
+ requiresOrgId: true,
8674
+ requiresAgentId: false,
8675
+ requiresRunId: false,
8676
+ attachesRunIdWhenAvailable: true
8677
+ },
8678
+ {
8679
+ id: "skill.scan-projects",
8680
+ command: "rudder skill scan-projects --org-id <id> [--project-ids <csv>] [--workspace-ids <csv>]",
8681
+ category: "skill",
8682
+ description: "Scan the org workspace and any legacy project workspace records for skill packages and import new ones.",
8683
+ mutating: true,
8684
+ contract: "agent-v1",
8685
+ requiresOrgId: true,
8686
+ requiresAgentId: false,
8687
+ requiresRunId: false,
8688
+ attachesRunIdWhenAvailable: true
8689
+ },
8690
+ {
8691
+ id: "browser.tabs",
8692
+ command: "rudder browser tabs",
8693
+ category: "browser",
8694
+ description: "List Browser tabs owned by the current Rudder agent run.",
8695
+ mutating: false,
8696
+ contract: "agent-v1",
8697
+ requiresOrgId: true,
8698
+ requiresAgentId: true,
8699
+ requiresRunId: true,
8700
+ attachesRunIdWhenAvailable: false
8701
+ },
8702
+ {
8703
+ id: "browser.open",
8704
+ command: "rudder browser open <url>",
8705
+ category: "browser",
8706
+ description: "Open a run-owned tab in the Rudder Browser.",
8707
+ mutating: true,
8708
+ contract: "agent-v1",
8709
+ requiresOrgId: true,
8710
+ requiresAgentId: true,
8711
+ requiresRunId: true,
8712
+ attachesRunIdWhenAvailable: true
8713
+ },
8714
+ {
8715
+ id: "browser.navigate",
8716
+ command: "rudder browser navigate <tab-id> <url>",
8717
+ category: "browser",
8718
+ description: "Navigate a run-owned Rudder Browser tab.",
8719
+ mutating: true,
8720
+ contract: "agent-v1",
8721
+ requiresOrgId: true,
8722
+ requiresAgentId: true,
8723
+ requiresRunId: true,
8724
+ attachesRunIdWhenAvailable: true
8725
+ },
8726
+ {
8727
+ id: "browser.read",
8728
+ command: "rudder browser read <tab-id>",
8729
+ category: "browser",
8730
+ description: "Read a structured snapshot from a run-owned Rudder Browser tab.",
8731
+ mutating: false,
8732
+ contract: "agent-v1",
8733
+ requiresOrgId: true,
8734
+ requiresAgentId: true,
8735
+ requiresRunId: true,
8736
+ attachesRunIdWhenAvailable: false
8737
+ },
8738
+ {
8739
+ id: "browser.click",
8740
+ command: "rudder browser click <tab-id> <ref>",
8741
+ category: "browser",
8742
+ description: "Click an element reference returned by Rudder Browser read.",
8743
+ mutating: true,
8744
+ contract: "agent-v1",
8745
+ requiresOrgId: true,
8746
+ requiresAgentId: true,
8747
+ requiresRunId: true,
8748
+ attachesRunIdWhenAvailable: true
8749
+ },
8750
+ {
8751
+ id: "browser.type",
8752
+ command: "rudder browser type <tab-id> <ref> --text <text>",
8753
+ category: "browser",
8754
+ description: "Type into an element reference in a run-owned Rudder Browser tab.",
8755
+ mutating: true,
8756
+ contract: "agent-v1",
8757
+ requiresOrgId: true,
8758
+ requiresAgentId: true,
8759
+ requiresRunId: true,
8760
+ attachesRunIdWhenAvailable: true
8761
+ },
8762
+ {
8763
+ id: "browser.screenshot",
8764
+ command: "rudder browser screenshot <tab-id>",
8765
+ category: "browser",
8766
+ description: "Capture a screenshot of a run-owned Rudder Browser tab.",
8767
+ mutating: false,
8768
+ contract: "agent-v1",
8769
+ requiresOrgId: true,
8770
+ requiresAgentId: true,
8771
+ requiresRunId: true,
8772
+ attachesRunIdWhenAvailable: false
8773
+ },
8774
+ {
8775
+ id: "browser.close",
8776
+ command: "rudder browser close <tab-id>",
8777
+ category: "browser",
8778
+ description: "Close a run-owned Rudder Browser tab.",
8779
+ mutating: true,
8780
+ contract: "agent-v1",
8781
+ requiresOrgId: true,
8782
+ requiresAgentId: true,
8783
+ requiresRunId: true,
8784
+ attachesRunIdWhenAvailable: true
8785
+ },
8786
+ {
8787
+ id: "automation.list",
8788
+ command: "rudder automation list --org-id <id>",
8789
+ category: "automation",
8790
+ description: "List automations for an organization with compact local filters.",
8791
+ mutating: false,
8792
+ contract: "agent-v1",
8793
+ requiresOrgId: true,
8794
+ requiresAgentId: false,
8795
+ requiresRunId: false,
8796
+ attachesRunIdWhenAvailable: false
8797
+ },
8798
+ {
8799
+ id: "automation.get",
8800
+ command: "rudder automation get <automation-id>",
8801
+ category: "automation",
8802
+ description: "Read one automation detail including triggers and recent runs.",
8803
+ mutating: false,
8804
+ contract: "agent-v1",
8805
+ requiresOrgId: false,
8806
+ requiresAgentId: false,
8807
+ requiresRunId: false,
8808
+ attachesRunIdWhenAvailable: false
8809
+ },
8810
+ {
8811
+ id: "automation.runs",
8812
+ command: "rudder automation runs <automation-id>",
8813
+ category: "automation",
8814
+ description: "List recent runs for one automation.",
8815
+ mutating: false,
8816
+ contract: "agent-v1",
8817
+ requiresOrgId: false,
8818
+ requiresAgentId: false,
8819
+ requiresRunId: false,
8820
+ attachesRunIdWhenAvailable: false
8821
+ },
8822
+ {
8823
+ id: "automation.triggers.list",
8824
+ command: "rudder automation triggers list <automation-id>",
8825
+ category: "automation",
8826
+ description: "List triggers configured for one automation.",
8827
+ mutating: false,
8828
+ contract: "agent-v1",
8829
+ requiresOrgId: false,
8830
+ requiresAgentId: false,
8831
+ requiresRunId: false,
8832
+ attachesRunIdWhenAvailable: false
8833
+ },
8834
+ {
8835
+ id: "automation.triggers.create",
8836
+ command: "rudder automation triggers create <automation-id> --kind <kind>",
8837
+ category: "automation",
8838
+ description: "Create a schedule, webhook, or API trigger through the governed automation API.",
8839
+ mutating: true,
8840
+ contract: "agent-v1",
8841
+ requiresOrgId: false,
8842
+ requiresAgentId: false,
8843
+ requiresRunId: false,
8844
+ attachesRunIdWhenAvailable: true
8845
+ },
8846
+ {
8847
+ id: "automation.triggers.update",
8848
+ command: "rudder automation triggers update <trigger-id>",
8849
+ category: "automation",
8850
+ description: "Update an automation trigger through the governed automation API.",
8851
+ mutating: true,
8852
+ contract: "agent-v1",
8853
+ requiresOrgId: false,
8854
+ requiresAgentId: false,
8855
+ requiresRunId: false,
8856
+ attachesRunIdWhenAvailable: true
8857
+ },
8858
+ {
8859
+ id: "automation.triggers.delete",
8860
+ command: "rudder automation triggers delete <trigger-id>",
8861
+ category: "automation",
8862
+ description: "Delete an automation trigger through the governed automation API.",
8863
+ mutating: true,
8864
+ contract: "agent-v1",
8865
+ requiresOrgId: false,
8866
+ requiresAgentId: false,
8867
+ requiresRunId: false,
8868
+ attachesRunIdWhenAvailable: true
8869
+ },
8870
+ {
8871
+ id: "automation.triggers.rotate-secret",
8872
+ command: "rudder automation triggers rotate-secret <trigger-id>",
8873
+ category: "automation",
8874
+ description: "Rotate an automation webhook trigger secret through the governed automation API.",
8875
+ mutating: true,
8876
+ contract: "agent-v1",
8877
+ requiresOrgId: false,
8878
+ requiresAgentId: false,
8879
+ requiresRunId: false,
8880
+ attachesRunIdWhenAvailable: true
8881
+ },
8882
+ {
8883
+ id: "automation.create",
8884
+ command: "rudder automation create --org-id <id> --title <title> --assignee-agent-id <id>",
8885
+ category: "automation",
8886
+ description: "Create an automation through the governed automation API.",
8887
+ mutating: true,
8888
+ contract: "agent-v1",
8889
+ requiresOrgId: true,
8890
+ requiresAgentId: false,
8891
+ requiresRunId: false,
8892
+ attachesRunIdWhenAvailable: true
8893
+ },
8894
+ {
8895
+ id: "automation.update",
8896
+ command: "rudder automation update <automation-id>",
8897
+ category: "automation",
8898
+ description: "Update automation fields through the governed automation API.",
8899
+ mutating: true,
8900
+ contract: "agent-v1",
8901
+ requiresOrgId: false,
8902
+ requiresAgentId: false,
8903
+ requiresRunId: false,
8904
+ attachesRunIdWhenAvailable: true
8905
+ },
8906
+ {
8907
+ id: "automation.enable",
8908
+ command: "rudder automation enable <automation-id>",
8909
+ category: "automation",
8910
+ description: "Enable an automation by setting status to active.",
8911
+ mutating: true,
8912
+ contract: "agent-v1",
8913
+ requiresOrgId: false,
8914
+ requiresAgentId: false,
8915
+ requiresRunId: false,
8916
+ attachesRunIdWhenAvailable: true
8917
+ },
8918
+ {
8919
+ id: "automation.disable",
8920
+ command: "rudder automation disable <automation-id>",
8921
+ category: "automation",
8922
+ description: "Disable an automation by setting status to paused.",
8923
+ mutating: true,
8924
+ contract: "agent-v1",
8925
+ requiresOrgId: false,
8926
+ requiresAgentId: false,
8927
+ requiresRunId: false,
8928
+ attachesRunIdWhenAvailable: true
8929
+ },
8930
+ {
8931
+ id: "automation.run",
8932
+ command: "rudder automation run <automation-id>",
8933
+ category: "automation",
8934
+ description: "Trigger a manual automation run.",
8935
+ mutating: true,
8936
+ contract: "agent-v1",
8937
+ requiresOrgId: false,
8938
+ requiresAgentId: false,
8939
+ requiresRunId: false,
8940
+ attachesRunIdWhenAvailable: true
8941
+ },
8942
+ {
8943
+ id: "chat.list",
8944
+ command: "rudder chat list --org-id <id>",
8945
+ category: "chat",
8946
+ description: "List chat conversations without dumping full message history.",
8947
+ mutating: false,
8948
+ contract: "agent-v1",
8949
+ requiresOrgId: true,
8950
+ requiresAgentId: false,
8951
+ requiresRunId: false,
8952
+ attachesRunIdWhenAvailable: false
8953
+ },
8954
+ {
8955
+ id: "chat.search",
8956
+ command: "rudder chat search <query> --org-id <id>",
8957
+ category: "chat",
8958
+ description: "Search chats with bounded snippets and optional scope filtering.",
8959
+ mutating: false,
8960
+ contract: "agent-v1",
8961
+ requiresOrgId: true,
8962
+ requiresAgentId: false,
8963
+ requiresRunId: false,
8964
+ attachesRunIdWhenAvailable: false
8965
+ },
8966
+ {
8967
+ id: "chat.get",
8968
+ command: "rudder chat get <chat-id>",
8969
+ category: "chat",
8970
+ description: "Read one chat conversation record.",
8971
+ mutating: false,
8972
+ contract: "agent-v1",
8973
+ requiresOrgId: false,
8974
+ requiresAgentId: false,
8975
+ requiresRunId: false,
8976
+ attachesRunIdWhenAvailable: false
8977
+ },
8978
+ {
8979
+ id: "chat.messages",
8980
+ command: "rudder chat messages <chat-id> [--limit <n>] [--cursor <cursor>] [--include-transcript]",
8981
+ category: "chat",
8982
+ description: "Read bounded chat messages with page cursors; transcript output is omitted unless requested.",
8983
+ mutating: false,
8984
+ contract: "agent-v1",
8985
+ requiresOrgId: false,
8986
+ requiresAgentId: false,
8987
+ requiresRunId: false,
8988
+ attachesRunIdWhenAvailable: false
8989
+ },
8990
+ {
8991
+ id: "chat.transcript",
8992
+ command: "rudder chat transcript <chat-id> [--limit <n>] [--cursor <cursor>] [--max-output-chars <n>]",
8993
+ category: "chat",
8994
+ description: "Read paginated chat messages with assistant transcript entries clipped in human output.",
8995
+ mutating: false,
8996
+ contract: "agent-v1",
8997
+ requiresOrgId: false,
8998
+ requiresAgentId: false,
8999
+ requiresRunId: false,
9000
+ attachesRunIdWhenAvailable: false
9001
+ },
9002
+ {
9003
+ id: "chat.read",
9004
+ command: "rudder chat read <chat-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output]",
9005
+ category: "chat",
9006
+ description: "Read a bounded recent-message snapshot for one chat with page cursors.",
9007
+ mutating: false,
9008
+ contract: "agent-v1",
9009
+ requiresOrgId: false,
9010
+ requiresAgentId: false,
9011
+ requiresRunId: false,
9012
+ attachesRunIdWhenAvailable: false
9013
+ },
9014
+ {
9015
+ id: "chat.create",
9016
+ command: "rudder chat create --org-id <id>",
9017
+ category: "chat",
9018
+ description: "Create a chat conversation.",
9019
+ mutating: true,
9020
+ contract: "agent-v1",
9021
+ requiresOrgId: true,
9022
+ requiresAgentId: false,
9023
+ requiresRunId: false,
9024
+ attachesRunIdWhenAvailable: true
9025
+ },
9026
+ {
9027
+ id: "chat.send",
9028
+ command: "rudder chat send <chat-id> --body <text>",
9029
+ category: "chat",
9030
+ description: "Send an agent-authored message directly to the operator in a chat.",
9031
+ mutating: true,
9032
+ contract: "agent-v1",
9033
+ requiresOrgId: false,
9034
+ requiresAgentId: true,
9035
+ requiresRunId: false,
9036
+ attachesRunIdWhenAvailable: true
9037
+ },
9038
+ {
9039
+ id: "chat.archive",
9040
+ command: "rudder chat archive <chat-id>",
9041
+ category: "chat",
9042
+ description: "Archive a chat conversation without deleting it.",
9043
+ mutating: true,
9044
+ contract: "agent-v1",
9045
+ requiresOrgId: false,
9046
+ requiresAgentId: false,
9047
+ requiresRunId: false,
9048
+ attachesRunIdWhenAvailable: true
9049
+ },
9050
+ {
9051
+ id: "runs.list",
9052
+ command: "rudder runs list --org-id <id> [--used-skill <skill>] [--loaded-skill <skill>] [--cursor <cursor>] [--full]",
9053
+ category: "runs",
9054
+ description: "List lightweight run summaries with stable pagination and filters; use --full only for legacy full-row compatibility.",
9055
+ mutating: false,
9056
+ contract: "agent-v1",
9057
+ requiresOrgId: true,
9058
+ requiresAgentId: false,
9059
+ requiresRunId: false,
9060
+ attachesRunIdWhenAvailable: false
9061
+ },
9062
+ {
9063
+ id: "runs.by-skill",
9064
+ command: "rudder runs by-skill <skill> --org-id <id> [--evidence <used-or-loaded>] [--cursor <cursor>] [--full]",
9065
+ category: "runs",
9066
+ description: "Build a paginated skill evidence packet from lightweight run summaries; use --full only for legacy full-row compatibility.",
9067
+ mutating: false,
9068
+ contract: "agent-v1",
9069
+ requiresOrgId: true,
9070
+ requiresAgentId: false,
9071
+ requiresRunId: false,
9072
+ attachesRunIdWhenAvailable: false
9073
+ },
9074
+ {
9075
+ id: "runs.get",
9076
+ command: "rudder runs get <run-id> [--full]",
9077
+ category: "runs",
9078
+ description: "Read one bounded run summary; use --full only from a direct trusted CLI for raw detail.",
9079
+ mutating: false,
9080
+ contract: "agent-v1",
9081
+ requiresOrgId: false,
9082
+ requiresAgentId: false,
9083
+ requiresRunId: false,
9084
+ attachesRunIdWhenAvailable: false
9085
+ },
9086
+ {
9087
+ id: "runs.events",
9088
+ command: "rudder runs events <run-id> [--cursor <cursor>] [--after-seq <n>] [--limit <n>] [--full]",
9089
+ category: "runs",
9090
+ description: "List a bounded page of persisted run events with a lossless opaque cursor and clipped payload previews.",
9091
+ mutating: false,
9092
+ contract: "agent-v1",
9093
+ requiresOrgId: false,
9094
+ requiresAgentId: false,
9095
+ requiresRunId: false,
9096
+ attachesRunIdWhenAvailable: false
9097
+ },
9098
+ {
9099
+ id: "runs.log",
9100
+ command: "rudder runs log <run-id> [--offset <bytes>] [--limit-bytes <n>]",
9101
+ category: "runs",
9102
+ description: "Read a bounded byte range of stored run log content.",
9103
+ mutating: false,
9104
+ contract: "agent-v1",
9105
+ requiresOrgId: false,
9106
+ requiresAgentId: false,
9107
+ requiresRunId: false,
9108
+ attachesRunIdWhenAvailable: false
9109
+ },
9110
+ {
9111
+ id: "runs.transcript",
9112
+ command: "rudder runs transcript <run-id> [--turn-limit <n>] [--cursor <cursor>] [--include-output] [--full]",
9113
+ category: "runs",
9114
+ description: "Read a compact server-normalized transcript; --json changes encoding only and --full is direct-CLI-only raw access.",
9115
+ mutating: false,
9116
+ contract: "agent-v1",
9117
+ requiresOrgId: false,
9118
+ requiresAgentId: false,
9119
+ requiresRunId: false,
9120
+ attachesRunIdWhenAvailable: false
9121
+ },
9122
+ {
9123
+ id: "runs.errors",
9124
+ command: "rudder runs errors <run-id>",
9125
+ category: "runs",
9126
+ description: "List failed tool calls, stderr, runtime failures, and jump-to-context commands.",
9127
+ mutating: false,
9128
+ contract: "agent-v1",
9129
+ requiresOrgId: false,
9130
+ requiresAgentId: false,
9131
+ requiresRunId: false,
9132
+ attachesRunIdWhenAvailable: false
9133
+ },
9134
+ {
9135
+ id: "runs.cancel",
9136
+ command: "rudder runs cancel <run-id>",
9137
+ category: "runs",
9138
+ description: "Cancel a heartbeat run through the governed server route.",
9139
+ mutating: true,
9140
+ contract: "agent-v1",
9141
+ requiresOrgId: false,
9142
+ requiresAgentId: false,
9143
+ requiresRunId: false,
9144
+ attachesRunIdWhenAvailable: true
9145
+ },
9146
+ {
9147
+ id: "runs.retry",
9148
+ command: "rudder runs retry <run-id>",
9149
+ category: "runs",
9150
+ description: "Retry a failed, timed out, or cancelled run through the governed server route.",
9151
+ mutating: true,
9152
+ contract: "agent-v1",
9153
+ requiresOrgId: false,
9154
+ requiresAgentId: false,
9155
+ requiresRunId: false,
9156
+ attachesRunIdWhenAvailable: true
9157
+ }
9158
+ ];
9159
+ var CATEGORY_TITLES = {
9160
+ agent: "Agent",
9161
+ issue: "Issue",
9162
+ project: "Project",
9163
+ automation: "Automation",
9164
+ chat: "Chat",
9165
+ runs: "Runs",
9166
+ approval: "Approval",
9167
+ skill: "Skill",
9168
+ browser: "Browser",
9169
+ user: "User",
9170
+ library: "Library"
9171
+ };
9172
+ function getAgentCliCapabilities() {
9173
+ return AGENT_CLI_CAPABILITIES.map((entry) => ({ ...entry }));
9174
+ }
9175
+ function getAgentCliCapabilityById(id) {
9176
+ const entry = AGENT_CLI_CAPABILITIES.find((capability) => capability.id === id);
9177
+ if (!entry) {
9178
+ throw new Error(`Unknown agent CLI capability: ${id}`);
8259
9179
  }
9180
+ return entry;
9181
+ }
9182
+ function buildAgentCliCapabilitiesManifest(contract = "agent-v1") {
9183
+ const capabilities = AGENT_CLI_CAPABILITIES.filter((entry) => contract === "all" || entry.contract === contract).map((entry) => ({
9184
+ ...entry,
9185
+ agentV1: entry.contract === "agent-v1"
9186
+ }));
8260
9187
  return {
8261
- type: "object",
8262
- additionalProperties: false,
8263
- properties
9188
+ schema: "rudder.agent-capabilities/v1",
9189
+ contract,
9190
+ defaults: {
9191
+ orgIdEnvVar: "RUDDER_ORG_ID",
9192
+ agentIdEnvVar: "RUDDER_AGENT_ID",
9193
+ runIdEnvVar: "RUDDER_RUN_ID",
9194
+ jsonErrors: "stderr-error-envelope"
9195
+ },
9196
+ capabilities
8264
9197
  };
8265
9198
  }
8266
9199
  function buildAgentV1McpToolsManifest(contract = "agent-v1", options = {}) {
8267
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
+ );
8268
9204
  return {
8269
9205
  schema: "rudder.agent-mcp-tools/v1",
8270
9206
  contract,
8271
9207
  serverName: "rudder-control-plane",
8272
- tools: capabilities.map((entry) => ({
8273
- ...entry,
8274
- capabilityId: entry.id,
8275
- name: agentCliCapabilityIdToMcpToolName(entry.id),
8276
- inputSchema: mcpInputSchemaForCapability(entry.id),
8277
- outputMode: "json"
8278
- }))
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
+ })
8279
9222
  };
8280
9223
  }
8281
9224
  function formatAgentCliCapabilitiesHumanReadable(capabilities = getAgentCliCapabilities()) {
@@ -8462,7 +9405,7 @@ function toStringRecord(headers) {
8462
9405
  }
8463
9406
 
8464
9407
  // src/agent-v1-mcp-server.ts
8465
- var RUDDER_MCP_SERVER_NAME = "rudder-control-plane";
9408
+ init_version();
8466
9409
  var RUDDER_MCP_MAX_TOOL_RESULT_BYTES = 1e6;
8467
9410
  var RUDDER_MCP_MAX_INLINE_TEXT_BYTES = 32e3;
8468
9411
  var RESERVED_MODEL_ARGUMENTS = /* @__PURE__ */ new Set([
@@ -8541,10 +9484,26 @@ async function runAgentV1McpJsonRpcMessage(message, env = buildMcpServerEnv()) {
8541
9484
  case "notifications/initialized":
8542
9485
  return isNotification ? null : rpcResult(id, {});
8543
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
+ );
8544
9494
  return rpcResult(id, {
8545
9495
  protocolVersion: requestedProtocolVersion(message.params) ?? "2024-11-05",
8546
- capabilities: { tools: {} },
8547
- serverInfo: { name: RUDDER_MCP_SERVER_NAME, version: "1.0.0" }
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() }
8548
9507
  });
8549
9508
  case "tools/list":
8550
9509
  return rpcResult(id, {
@@ -8652,12 +9611,12 @@ async function callTool(params, env) {
8652
9611
  const plan = buildAgentV1ToolCallPlan(toolName, args, env);
8653
9612
  const directResult = await callToolDirectlyIfSupported(toolName, args, env);
8654
9613
  if (directResult) return directResult;
8655
- const tempDir = plan.tempFiles.length > 0 ? await fs.mkdtemp(path.join(os.tmpdir(), "rudder-mcp-")) : null;
9614
+ const tempDir = plan.tempFiles.length > 0 ? await fs.mkdtemp(path2.join(os.tmpdir(), "rudder-mcp-")) : null;
8656
9615
  const materializedArgs = [...plan.args];
8657
9616
  try {
8658
9617
  if (tempDir) {
8659
9618
  for (const tempFile of plan.tempFiles) {
8660
- const tempPath = path.join(tempDir, `${tempFile.flag.replace(/^-+/, "")}.md`);
9619
+ const tempPath = path2.join(tempDir, `${tempFile.flag.replace(/^-+/, "")}.md`);
8661
9620
  await fs.writeFile(tempPath, tempFile.contents, "utf8");
8662
9621
  const index = materializedArgs.indexOf(tempFile.flag);
8663
9622
  if (index >= 0) materializedArgs[index + 1] = tempPath;
@@ -9285,11 +10244,7 @@ function cliArgsForCapability(capabilityId, input, tempFiles, env) {
9285
10244
  }
9286
10245
  }
9287
10246
  function toMcpToolListEntry(tool) {
9288
- return {
9289
- name: tool.name,
9290
- 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"}.`,
9291
- inputSchema: tool.inputSchema
9292
- };
10247
+ return rudderMcpSemanticToolContract(tool);
9293
10248
  }
9294
10249
  function requestedProtocolVersion(params) {
9295
10250
  if (!isRecord2(params)) return null;
@@ -9440,8 +10395,8 @@ function resolveRudderCliInvocation(args, env) {
9440
10395
  if (env.RUDDER_MCP_RUDDER_BIN) {
9441
10396
  return { command: env.RUDDER_MCP_RUDDER_BIN, args };
9442
10397
  }
9443
- const modulePath = fileURLToPath(new URL("./index.js", import.meta.url));
9444
- if (existsSync(modulePath)) {
10398
+ const modulePath = fileURLToPath2(new URL("./index.js", import.meta.url));
10399
+ if (existsSync2(modulePath)) {
9445
10400
  return { command: process.execPath, args: [modulePath, ...args] };
9446
10401
  }
9447
10402
  if (hasRunnableRudderOnPath(env)) {
@@ -15707,7 +16662,7 @@ init_install2();
15707
16662
  init_install();
15708
16663
  import * as p15 from "@clack/prompts";
15709
16664
  import { spawn as spawn3, spawnSync as spawnSync4 } from "node:child_process";
15710
- import { createHash, randomUUID } from "node:crypto";
16665
+ import { createHash as createHash2, randomUUID } from "node:crypto";
15711
16666
  import { createWriteStream, constants as fsConstants, mkdirSync, readFileSync as readFileSync2 } from "node:fs";
15712
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";
15713
16668
  import { homedir, tmpdir } from "node:os";
@@ -15910,43 +16865,88 @@ function createDesktopProgressFactory() {
15910
16865
  };
15911
16866
  };
15912
16867
  }
15913
- async function waitForDesktopApplySignal() {
16868
+ function createDesktopApplySignalController() {
15914
16869
  process.stdin.setEncoding("utf8");
15915
16870
  process.stdin.resume();
15916
- return await new Promise((resolve, reject) => {
15917
- let buffer = "";
15918
- const cleanup = () => {
15919
- process.stdin.off("data", onData);
15920
- process.stdin.off("end", onEnd);
15921
- process.stdin.off("error", onError);
15922
- };
15923
- const onData = (chunk) => {
15924
- buffer += chunk;
15925
- const lines = buffer.split(/\r?\n/);
15926
- buffer = lines.pop() ?? "";
15927
- const commands = lines.map((line) => line.trim());
15928
- if (commands.includes("force-apply")) {
15929
- cleanup();
15930
- resolve({ force: true });
15931
- return;
15932
- }
15933
- if (commands.includes("apply")) {
15934
- cleanup();
15935
- resolve({ force: false });
15936
- }
15937
- };
15938
- const onEnd = () => {
15939
- cleanup();
15940
- reject(new Error("Desktop update apply signal ended before confirmation."));
15941
- };
15942
- const onError = (error) => {
15943
- cleanup();
15944
- reject(error);
15945
- };
15946
- process.stdin.on("data", onData);
15947
- process.stdin.on("end", onEnd);
15948
- 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;
15949
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
+ };
15950
16950
  }
15951
16951
  function resolveCurrentCliVersion(env = process.env) {
15952
16952
  const version = resolveCliVersion(import.meta.url, env);
@@ -16005,7 +17005,7 @@ function isExactRuntimePackageSpec(version, packageSpec) {
16005
17005
  return version !== "latest" && packageSpec === resolveRuntimePackageSpec(version);
16006
17006
  }
16007
17007
  function runtimeSupportsDesktopShellAssets(version, runtime) {
16008
- return isExactRuntimePackageSpec(version, runtime.packageSpec);
17008
+ return isExactRuntimePackageSpec(version, runtime.packageSpec) && Boolean(runtime.postgresPayloadBinDir);
16009
17009
  }
16010
17010
  function resolveDesktopAssetTarget(platform = process.platform, arch = process.arch) {
16011
17011
  if (platform === "darwin") {
@@ -16272,7 +17272,7 @@ async function downloadAsset(asset, outputDir, progressFactory = createByteProgr
16272
17272
  return outputPath;
16273
17273
  }
16274
17274
  function checksumForFile(filePath) {
16275
- const hash = createHash("sha256");
17275
+ const hash = createHash2("sha256");
16276
17276
  hash.update(readFileSync2(filePath));
16277
17277
  return hash.digest("hex");
16278
17278
  }
@@ -16499,7 +17499,7 @@ async function pathExists2(targetPath) {
16499
17499
  }
16500
17500
  }
16501
17501
  function resolveDesktopInstallLockPath(paths) {
16502
- const installRootHash = createHash("sha256").update(path22.resolve(paths.installRoot)).digest("hex").slice(0, 16);
17502
+ const installRootHash = createHash2("sha256").update(path22.resolve(paths.installRoot)).digest("hex").slice(0, 16);
16503
17503
  return path22.join(path22.dirname(paths.appPath), `.rudder-desktop-install-${installRootHash}.lock`);
16504
17504
  }
16505
17505
  async function readDesktopInstallLock(lockPath) {
@@ -16784,20 +17784,23 @@ async function prepareForDesktopReplace(paths, target, options = {}) {
16784
17784
  const hasManagedExecutable = await pathExists2(paths.executablePath);
16785
17785
  if (hasManagedExecutable) {
16786
17786
  managedExecutablePids = findPids(paths.executablePath, target);
17787
+ let forceUpdate = options.forceUpdate === true;
16787
17788
  const requestQuit = () => requestDesktopQuit(paths.executablePath, target, {
16788
- forceUpdate: options.forceUpdate,
17789
+ forceUpdate,
16789
17790
  responseTimeoutMs: options.updateQuitResponseTimeoutMs
16790
17791
  });
16791
17792
  let quitResponse = await requestQuit();
16792
- while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns && !options.forceUpdate) {
17793
+ while (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs" && options.waitForActiveRuns && !forceUpdate) {
16793
17794
  p15.log.warn(
16794
17795
  `Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}; waiting before replacing Desktop.`
16795
17796
  );
16796
- await delay2(options.activeRunPollIntervalMs ?? 15e3);
17797
+ options.onActiveRunsWaiting?.(quitResponse.totalRuns);
17798
+ const pollIntervalMs = options.activeRunPollIntervalMs ?? 15e3;
17799
+ forceUpdate = options.waitForForceUpdate ? await options.waitForForceUpdate(pollIntervalMs) : (await delay2(pollIntervalMs), false);
16797
17800
  quitResponse = await requestQuit();
16798
17801
  }
16799
17802
  if (quitResponse && !quitResponse.ok && quitResponse.status === "active_runs") {
16800
- if (!options.forceUpdate) {
17803
+ if (!forceUpdate) {
16801
17804
  throw new Error(
16802
17805
  `Rudder Desktop has ${quitResponse.totalRuns} active run${quitResponse.totalRuns === 1 ? "" : "s"}. Stop active work, then rerun start.`
16803
17806
  );
@@ -17188,27 +18191,39 @@ async function startCommand(opts) {
17188
18191
  desktopProgressJson ? "verifying_checksum" : null
17189
18192
  );
17190
18193
  let applySignal = null;
18194
+ let applySignalController = null;
17191
18195
  if (desktopProgressJson && opts.desktopWaitForApply === true) {
17192
18196
  writeDesktopProgress({
17193
18197
  phase: "ready_to_install",
17194
18198
  message: "Desktop update is downloaded and verified.",
17195
18199
  percent: 100
17196
18200
  });
17197
- applySignal = await waitForDesktopApplySignal();
18201
+ applySignalController = createDesktopApplySignalController();
18202
+ applySignal = await applySignalController.waitForInitialSignal();
17198
18203
  writeDesktopProgress({
17199
18204
  phase: "preparing_restart",
17200
18205
  message: applySignal.force ? "Applying Desktop update and quitting active runs..." : "Applying Desktop update..."
17201
18206
  });
17202
18207
  }
17203
- await runStartPhase(
17204
- "Replacing existing Rudder Desktop if needed...",
17205
- "Existing Desktop install is ready for replacement.",
17206
- () => prepareForDesktopReplace(installPaths, target, {
17207
- waitForActiveRuns: opts.waitForActiveRuns === true,
17208
- forceUpdate: applySignal?.force === true
17209
- }),
17210
- desktopProgressJson ? opts.waitForActiveRuns === true ? "waiting_for_active_runs" : "preparing_restart" : null
17211
- );
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
+ }
17212
18227
  await runStartPhase(
17213
18228
  "Installing portable Desktop app...",
17214
18229
  `Installed Rudder Desktop to ${pc15.cyan(installPaths.appPath)}.`,