@rudderhq/cli 0.1.0-canary.15 → 0.1.0-canary.16
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 +1290 -1161
- package/dist/index.js.map +4 -4
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var __export = (target, all) => {
|
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
// ../packages/shared/src/constants.ts
|
|
13
|
-
var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
13
|
+
var ORGANIZATION_STATUSES, DEPLOYMENT_MODES, DEPLOYMENT_EXPOSURES, AUTH_BASE_URL_MODES, AGENT_STATUSES, AGENT_RUNTIME_TYPES, AGENT_ROLES, AGENT_ICON_NAMES, ISSUE_STATUSES, ISSUE_PRIORITIES, CHAT_CONVERSATION_STATUSES, CHAT_ISSUE_CREATION_MODES, CHAT_MESSAGE_ROLES, CHAT_MESSAGE_KINDS, CHAT_MESSAGE_STATUSES, CHAT_CONTEXT_ENTITY_TYPES, GOAL_LEVELS, GOAL_STATUSES, PROJECT_STATUSES, ORGANIZATION_RESOURCE_KINDS, PROJECT_RESOURCE_ATTACHMENT_ROLES, AUTOMATION_STATUSES, AUTOMATION_CONCURRENCY_POLICIES, AUTOMATION_CATCH_UP_POLICIES, AUTOMATION_TRIGGER_SIGNING_MODES, PROJECT_COLORS, APPROVAL_TYPES, SECRET_PROVIDERS, STORAGE_PROVIDERS, BILLING_TYPES, FINANCE_EVENT_KINDS, FINANCE_DIRECTIONS, FINANCE_UNITS, BUDGET_SCOPE_TYPES, BUDGET_METRICS, BUDGET_WINDOW_KINDS, BUDGET_INCIDENT_RESOLUTION_ACTIONS, INVITE_JOIN_TYPES, JOIN_REQUEST_TYPES, JOIN_REQUEST_STATUSES, PERMISSION_KEYS, PLUGIN_STATUSES, PLUGIN_CATEGORIES, PLUGIN_CAPABILITIES, PLUGIN_UI_SLOT_TYPES, PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS, PLUGIN_LAUNCHER_PLACEMENT_ZONES, PLUGIN_LAUNCHER_ACTIONS, PLUGIN_LAUNCHER_BOUNDS, PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS, PLUGIN_UI_SLOT_ENTITY_TYPES, PLUGIN_STATE_SCOPE_KINDS;
|
|
14
14
|
var init_constants = __esm({
|
|
15
15
|
"../packages/shared/src/constants.ts"() {
|
|
16
16
|
"use strict";
|
|
@@ -143,6 +143,26 @@ var init_constants = __esm({
|
|
|
143
143
|
AUTOMATION_CONCURRENCY_POLICIES = ["coalesce_if_active", "always_enqueue", "skip_if_active"];
|
|
144
144
|
AUTOMATION_CATCH_UP_POLICIES = ["skip_missed", "enqueue_missed_with_cap"];
|
|
145
145
|
AUTOMATION_TRIGGER_SIGNING_MODES = ["bearer", "hmac_sha256"];
|
|
146
|
+
PROJECT_COLORS = [
|
|
147
|
+
"linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%)",
|
|
148
|
+
"linear-gradient(135deg, #7c3aed 0%, #d946ef 100%)",
|
|
149
|
+
"linear-gradient(135deg, #db2777 0%, #f97316 100%)",
|
|
150
|
+
"linear-gradient(135deg, #ef4444 0%, #f59e0b 100%)",
|
|
151
|
+
"linear-gradient(135deg, #f97316 0%, #facc15 100%)",
|
|
152
|
+
"linear-gradient(135deg, #10b981 0%, #84cc16 100%)",
|
|
153
|
+
"linear-gradient(135deg, #059669 0%, #14b8a6 100%)",
|
|
154
|
+
"linear-gradient(135deg, #0d9488 0%, #06b6d4 100%)",
|
|
155
|
+
"linear-gradient(135deg, #0284c7 0%, #2563eb 100%)",
|
|
156
|
+
"linear-gradient(135deg, #2563eb 0%, #4f46e5 100%)",
|
|
157
|
+
"linear-gradient(135deg, #f43f5e 0%, #ec4899 100%)",
|
|
158
|
+
"linear-gradient(135deg, #be123c 0%, #7c2d12 100%)",
|
|
159
|
+
"linear-gradient(135deg, #a16207 0%, #ca8a04 100%)",
|
|
160
|
+
"linear-gradient(135deg, #16a34a 0%, #0f766e 100%)",
|
|
161
|
+
"linear-gradient(135deg, #0891b2 0%, #4338ca 100%)",
|
|
162
|
+
"linear-gradient(135deg, #6d28d9 0%, #be185d 100%)",
|
|
163
|
+
"linear-gradient(135deg, #475569 0%, #0f766e 100%)",
|
|
164
|
+
"linear-gradient(135deg, #334155 0%, #7c3aed 100%)"
|
|
165
|
+
];
|
|
146
166
|
APPROVAL_TYPES = [
|
|
147
167
|
"hire_agent",
|
|
148
168
|
"approve_ceo_strategy",
|
|
@@ -464,174 +484,251 @@ var init_budget = __esm({
|
|
|
464
484
|
}
|
|
465
485
|
});
|
|
466
486
|
|
|
467
|
-
// ../packages/shared/src/validators/
|
|
487
|
+
// ../packages/shared/src/validators/model-fallbacks.ts
|
|
468
488
|
import { z as z3 } from "zod";
|
|
469
|
-
|
|
489
|
+
function isRecord(value) {
|
|
490
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
491
|
+
}
|
|
492
|
+
function validateModelFallbacksConfig(value, ctx, pathPrefix) {
|
|
493
|
+
const fallbackModels = value.modelFallbacks;
|
|
494
|
+
if (fallbackModels === void 0) return;
|
|
495
|
+
if (!Array.isArray(fallbackModels)) {
|
|
496
|
+
ctx.addIssue({
|
|
497
|
+
code: z3.ZodIssueCode.custom,
|
|
498
|
+
message: "modelFallbacks must be an array",
|
|
499
|
+
path: [...pathPrefix, "modelFallbacks"]
|
|
500
|
+
});
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
fallbackModels.forEach((fallback, index63) => {
|
|
504
|
+
if (typeof fallback === "string") {
|
|
505
|
+
if (fallback.trim().length === 0) {
|
|
506
|
+
ctx.addIssue({
|
|
507
|
+
code: z3.ZodIssueCode.custom,
|
|
508
|
+
message: "modelFallbacks string entries must be non-empty",
|
|
509
|
+
path: [...pathPrefix, "modelFallbacks", index63]
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
if (!isRecord(fallback)) {
|
|
515
|
+
ctx.addIssue({
|
|
516
|
+
code: z3.ZodIssueCode.custom,
|
|
517
|
+
message: "modelFallbacks entries must be strings or runtime/model objects",
|
|
518
|
+
path: [...pathPrefix, "modelFallbacks", index63]
|
|
519
|
+
});
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
if (typeof fallback.agentRuntimeType !== "string" || fallback.agentRuntimeType.trim().length === 0) {
|
|
523
|
+
ctx.addIssue({
|
|
524
|
+
code: z3.ZodIssueCode.custom,
|
|
525
|
+
message: "modelFallbacks entries must include agentRuntimeType",
|
|
526
|
+
path: [...pathPrefix, "modelFallbacks", index63, "agentRuntimeType"]
|
|
527
|
+
});
|
|
528
|
+
} else if (!agentRuntimeTypes.has(fallback.agentRuntimeType)) {
|
|
529
|
+
ctx.addIssue({
|
|
530
|
+
code: z3.ZodIssueCode.custom,
|
|
531
|
+
message: "modelFallbacks entries must include a valid agentRuntimeType",
|
|
532
|
+
path: [...pathPrefix, "modelFallbacks", index63, "agentRuntimeType"]
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
if (typeof fallback.model !== "string" || fallback.model.trim().length === 0) {
|
|
536
|
+
ctx.addIssue({
|
|
537
|
+
code: z3.ZodIssueCode.custom,
|
|
538
|
+
message: "modelFallbacks entries must include model",
|
|
539
|
+
path: [...pathPrefix, "modelFallbacks", index63, "model"]
|
|
540
|
+
});
|
|
541
|
+
}
|
|
542
|
+
if (fallback.config !== void 0 && !isRecord(fallback.config)) {
|
|
543
|
+
ctx.addIssue({
|
|
544
|
+
code: z3.ZodIssueCode.custom,
|
|
545
|
+
message: "modelFallbacks entry config must be an object",
|
|
546
|
+
path: [...pathPrefix, "modelFallbacks", index63, "config"]
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
var agentRuntimeTypes;
|
|
552
|
+
var init_model_fallbacks = __esm({
|
|
553
|
+
"../packages/shared/src/validators/model-fallbacks.ts"() {
|
|
554
|
+
"use strict";
|
|
555
|
+
init_constants();
|
|
556
|
+
agentRuntimeTypes = new Set(AGENT_RUNTIME_TYPES);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// ../packages/shared/src/validators/organization.ts
|
|
561
|
+
import { z as z4 } from "zod";
|
|
562
|
+
var logoAssetIdSchema, brandColorSchema, defaultChatRuntimeConfigSchema, createOrganizationSchema, updateOrganizationSchema, updateOrganizationBrandingSchema, updateOrganizationWorkspaceFileSchema;
|
|
470
563
|
var init_organization = __esm({
|
|
471
564
|
"../packages/shared/src/validators/organization.ts"() {
|
|
472
565
|
"use strict";
|
|
473
566
|
init_constants();
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
567
|
+
init_model_fallbacks();
|
|
568
|
+
logoAssetIdSchema = z4.string().uuid().nullable().optional();
|
|
569
|
+
brandColorSchema = z4.string().regex(/^#[0-9a-fA-F]{6}$/).nullable().optional();
|
|
570
|
+
defaultChatRuntimeConfigSchema = z4.record(z4.unknown()).superRefine((value, ctx) => {
|
|
571
|
+
validateModelFallbacksConfig(value, ctx, []);
|
|
572
|
+
});
|
|
573
|
+
createOrganizationSchema = z4.object({
|
|
574
|
+
name: z4.string().min(1),
|
|
575
|
+
description: z4.string().optional().nullable(),
|
|
576
|
+
budgetMonthlyCents: z4.number().int().nonnegative().optional().default(0),
|
|
577
|
+
defaultChatIssueCreationMode: z4.enum(CHAT_ISSUE_CREATION_MODES).optional().default("manual_approval"),
|
|
578
|
+
defaultChatAgentRuntimeType: z4.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
579
|
+
defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
|
|
483
580
|
brandColor: brandColorSchema,
|
|
484
|
-
requireBoardApprovalForNewAgents:
|
|
581
|
+
requireBoardApprovalForNewAgents: z4.boolean().optional()
|
|
485
582
|
});
|
|
486
583
|
updateOrganizationSchema = createOrganizationSchema.partial().extend({
|
|
487
|
-
status:
|
|
488
|
-
spentMonthlyCents:
|
|
489
|
-
requireBoardApprovalForNewAgents:
|
|
490
|
-
defaultChatIssueCreationMode:
|
|
491
|
-
defaultChatAgentRuntimeType:
|
|
492
|
-
defaultChatAgentRuntimeConfig:
|
|
584
|
+
status: z4.enum(ORGANIZATION_STATUSES).optional(),
|
|
585
|
+
spentMonthlyCents: z4.number().int().nonnegative().optional(),
|
|
586
|
+
requireBoardApprovalForNewAgents: z4.boolean().optional(),
|
|
587
|
+
defaultChatIssueCreationMode: z4.enum(CHAT_ISSUE_CREATION_MODES).optional(),
|
|
588
|
+
defaultChatAgentRuntimeType: z4.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
589
|
+
defaultChatAgentRuntimeConfig: defaultChatRuntimeConfigSchema.optional().nullable(),
|
|
493
590
|
brandColor: brandColorSchema,
|
|
494
591
|
logoAssetId: logoAssetIdSchema
|
|
495
592
|
});
|
|
496
|
-
updateOrganizationBrandingSchema =
|
|
497
|
-
name:
|
|
498
|
-
description:
|
|
593
|
+
updateOrganizationBrandingSchema = z4.object({
|
|
594
|
+
name: z4.string().min(1).optional(),
|
|
595
|
+
description: z4.string().nullable().optional(),
|
|
499
596
|
brandColor: brandColorSchema,
|
|
500
597
|
logoAssetId: logoAssetIdSchema
|
|
501
598
|
}).strict().refine(
|
|
502
599
|
(value) => value.name !== void 0 || value.description !== void 0 || value.brandColor !== void 0 || value.logoAssetId !== void 0,
|
|
503
600
|
"At least one branding field must be provided"
|
|
504
601
|
);
|
|
505
|
-
updateOrganizationWorkspaceFileSchema =
|
|
506
|
-
content:
|
|
602
|
+
updateOrganizationWorkspaceFileSchema = z4.object({
|
|
603
|
+
content: z4.string()
|
|
507
604
|
});
|
|
508
605
|
}
|
|
509
606
|
});
|
|
510
607
|
|
|
511
608
|
// ../packages/shared/src/validators/resource.ts
|
|
512
|
-
import { z as
|
|
609
|
+
import { z as z5 } from "zod";
|
|
513
610
|
var organizationResourceKindSchema, projectResourceAttachmentRoleSchema, createOrganizationResourceSchema, updateOrganizationResourceSchema, projectResourceAttachmentInputSchema, updateProjectResourceAttachmentSchema, createProjectInlineResourceSchema;
|
|
514
611
|
var init_resource = __esm({
|
|
515
612
|
"../packages/shared/src/validators/resource.ts"() {
|
|
516
613
|
"use strict";
|
|
517
614
|
init_constants();
|
|
518
|
-
organizationResourceKindSchema =
|
|
519
|
-
projectResourceAttachmentRoleSchema =
|
|
520
|
-
createOrganizationResourceSchema =
|
|
521
|
-
name:
|
|
615
|
+
organizationResourceKindSchema = z5.enum(ORGANIZATION_RESOURCE_KINDS);
|
|
616
|
+
projectResourceAttachmentRoleSchema = z5.enum(PROJECT_RESOURCE_ATTACHMENT_ROLES);
|
|
617
|
+
createOrganizationResourceSchema = z5.object({
|
|
618
|
+
name: z5.string().min(1),
|
|
522
619
|
kind: organizationResourceKindSchema,
|
|
523
|
-
locator:
|
|
524
|
-
description:
|
|
525
|
-
metadata:
|
|
620
|
+
locator: z5.string().min(1),
|
|
621
|
+
description: z5.string().optional().nullable(),
|
|
622
|
+
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
526
623
|
});
|
|
527
|
-
updateOrganizationResourceSchema =
|
|
528
|
-
name:
|
|
624
|
+
updateOrganizationResourceSchema = z5.object({
|
|
625
|
+
name: z5.string().min(1).optional(),
|
|
529
626
|
kind: organizationResourceKindSchema.optional(),
|
|
530
|
-
locator:
|
|
531
|
-
description:
|
|
532
|
-
metadata:
|
|
627
|
+
locator: z5.string().min(1).optional(),
|
|
628
|
+
description: z5.string().optional().nullable(),
|
|
629
|
+
metadata: z5.record(z5.unknown()).optional().nullable()
|
|
533
630
|
}).strict();
|
|
534
|
-
projectResourceAttachmentInputSchema =
|
|
535
|
-
resourceId:
|
|
631
|
+
projectResourceAttachmentInputSchema = z5.object({
|
|
632
|
+
resourceId: z5.string().uuid(),
|
|
536
633
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
537
|
-
note:
|
|
538
|
-
sortOrder:
|
|
634
|
+
note: z5.string().optional().nullable(),
|
|
635
|
+
sortOrder: z5.number().int().nonnegative().optional()
|
|
539
636
|
}).strict();
|
|
540
|
-
updateProjectResourceAttachmentSchema =
|
|
637
|
+
updateProjectResourceAttachmentSchema = z5.object({
|
|
541
638
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
542
|
-
note:
|
|
543
|
-
sortOrder:
|
|
639
|
+
note: z5.string().optional().nullable(),
|
|
640
|
+
sortOrder: z5.number().int().nonnegative().optional()
|
|
544
641
|
}).strict();
|
|
545
642
|
createProjectInlineResourceSchema = createOrganizationResourceSchema.extend({
|
|
546
643
|
role: projectResourceAttachmentRoleSchema.optional(),
|
|
547
|
-
note:
|
|
548
|
-
sortOrder:
|
|
644
|
+
note: z5.string().optional().nullable(),
|
|
645
|
+
sortOrder: z5.number().int().nonnegative().optional()
|
|
549
646
|
}).strict();
|
|
550
647
|
}
|
|
551
648
|
});
|
|
552
649
|
|
|
553
650
|
// ../packages/shared/src/validators/chat.ts
|
|
554
|
-
import { z as
|
|
651
|
+
import { z as z6 } from "zod";
|
|
555
652
|
var chatConversationStatusSchema, chatIssueCreationModeSchema, chatMessageRoleSchema, chatMessageKindSchema, chatMessageStatusSchema, chatContextEntityTypeSchema, createChatContextLinkSchema, createChatConversationSchema, setChatProjectContextSchema, updateChatConversationSchema, addChatMessageSchema, createChatAttachmentMetadataSchema, chatIssueProposalSchema, convertChatToIssueSchema, chatOperationProposalSchema, resolveChatOperationProposalSchema, updateChatConversationUserStateSchema;
|
|
556
653
|
var init_chat = __esm({
|
|
557
654
|
"../packages/shared/src/validators/chat.ts"() {
|
|
558
655
|
"use strict";
|
|
559
656
|
init_constants();
|
|
560
|
-
chatConversationStatusSchema =
|
|
561
|
-
chatIssueCreationModeSchema =
|
|
562
|
-
chatMessageRoleSchema =
|
|
563
|
-
chatMessageKindSchema =
|
|
564
|
-
chatMessageStatusSchema =
|
|
565
|
-
chatContextEntityTypeSchema =
|
|
566
|
-
createChatContextLinkSchema =
|
|
657
|
+
chatConversationStatusSchema = z6.enum(CHAT_CONVERSATION_STATUSES);
|
|
658
|
+
chatIssueCreationModeSchema = z6.enum(CHAT_ISSUE_CREATION_MODES);
|
|
659
|
+
chatMessageRoleSchema = z6.enum(CHAT_MESSAGE_ROLES);
|
|
660
|
+
chatMessageKindSchema = z6.enum(CHAT_MESSAGE_KINDS);
|
|
661
|
+
chatMessageStatusSchema = z6.enum(CHAT_MESSAGE_STATUSES);
|
|
662
|
+
chatContextEntityTypeSchema = z6.enum(CHAT_CONTEXT_ENTITY_TYPES);
|
|
663
|
+
createChatContextLinkSchema = z6.object({
|
|
567
664
|
entityType: chatContextEntityTypeSchema,
|
|
568
|
-
entityId:
|
|
569
|
-
metadata:
|
|
665
|
+
entityId: z6.string().min(1),
|
|
666
|
+
metadata: z6.record(z6.unknown()).optional().nullable()
|
|
570
667
|
});
|
|
571
|
-
createChatConversationSchema =
|
|
572
|
-
title:
|
|
573
|
-
summary:
|
|
574
|
-
preferredAgentId:
|
|
668
|
+
createChatConversationSchema = z6.object({
|
|
669
|
+
title: z6.string().trim().min(1).max(200).optional(),
|
|
670
|
+
summary: z6.string().trim().max(5e3).optional().nullable(),
|
|
671
|
+
preferredAgentId: z6.string().uuid().optional().nullable(),
|
|
575
672
|
issueCreationMode: chatIssueCreationModeSchema.optional(),
|
|
576
|
-
planMode:
|
|
577
|
-
contextLinks:
|
|
673
|
+
planMode: z6.boolean().optional(),
|
|
674
|
+
contextLinks: z6.array(createChatContextLinkSchema).optional().default([])
|
|
578
675
|
});
|
|
579
|
-
setChatProjectContextSchema =
|
|
580
|
-
projectId:
|
|
676
|
+
setChatProjectContextSchema = z6.object({
|
|
677
|
+
projectId: z6.string().uuid().optional().nullable()
|
|
581
678
|
});
|
|
582
679
|
updateChatConversationSchema = createChatConversationSchema.partial().extend({
|
|
583
680
|
status: chatConversationStatusSchema.optional(),
|
|
584
|
-
routedAgentId:
|
|
585
|
-
primaryIssueId:
|
|
586
|
-
resolvedAt:
|
|
681
|
+
routedAgentId: z6.string().uuid().optional().nullable(),
|
|
682
|
+
primaryIssueId: z6.string().uuid().optional().nullable(),
|
|
683
|
+
resolvedAt: z6.string().datetime().optional().nullable()
|
|
587
684
|
});
|
|
588
|
-
addChatMessageSchema =
|
|
589
|
-
body:
|
|
590
|
-
editUserMessageId:
|
|
685
|
+
addChatMessageSchema = z6.object({
|
|
686
|
+
body: z6.string().trim().min(1).max(2e4),
|
|
687
|
+
editUserMessageId: z6.string().uuid().optional().nullable()
|
|
591
688
|
});
|
|
592
|
-
createChatAttachmentMetadataSchema =
|
|
593
|
-
messageId:
|
|
689
|
+
createChatAttachmentMetadataSchema = z6.object({
|
|
690
|
+
messageId: z6.string().uuid()
|
|
594
691
|
});
|
|
595
|
-
chatIssueProposalSchema =
|
|
596
|
-
title:
|
|
597
|
-
description:
|
|
598
|
-
priority:
|
|
599
|
-
projectId:
|
|
600
|
-
goalId:
|
|
601
|
-
parentId:
|
|
602
|
-
assigneeAgentId:
|
|
603
|
-
assigneeUserId:
|
|
692
|
+
chatIssueProposalSchema = z6.object({
|
|
693
|
+
title: z6.string().trim().min(1).max(200),
|
|
694
|
+
description: z6.string().trim().min(1).max(2e4),
|
|
695
|
+
priority: z6.enum(["critical", "high", "medium", "low"]).optional().default("medium"),
|
|
696
|
+
projectId: z6.string().uuid().optional().nullable(),
|
|
697
|
+
goalId: z6.string().uuid().optional().nullable(),
|
|
698
|
+
parentId: z6.string().uuid().optional().nullable(),
|
|
699
|
+
assigneeAgentId: z6.string().uuid().optional().nullable(),
|
|
700
|
+
assigneeUserId: z6.string().trim().optional().nullable()
|
|
604
701
|
});
|
|
605
|
-
convertChatToIssueSchema =
|
|
606
|
-
messageId:
|
|
702
|
+
convertChatToIssueSchema = z6.object({
|
|
703
|
+
messageId: z6.string().uuid().optional().nullable(),
|
|
607
704
|
proposal: chatIssueProposalSchema.optional()
|
|
608
705
|
});
|
|
609
|
-
chatOperationProposalSchema =
|
|
610
|
-
targetType:
|
|
611
|
-
targetId:
|
|
612
|
-
summary:
|
|
613
|
-
patch:
|
|
706
|
+
chatOperationProposalSchema = z6.object({
|
|
707
|
+
targetType: z6.enum(["organization", "agent"]),
|
|
708
|
+
targetId: z6.string().min(1),
|
|
709
|
+
summary: z6.string().trim().min(1).max(500),
|
|
710
|
+
patch: z6.record(z6.unknown())
|
|
614
711
|
});
|
|
615
|
-
resolveChatOperationProposalSchema =
|
|
616
|
-
action:
|
|
617
|
-
decisionNote:
|
|
712
|
+
resolveChatOperationProposalSchema = z6.object({
|
|
713
|
+
action: z6.enum(["approve", "reject", "requestRevision"]),
|
|
714
|
+
decisionNote: z6.string().trim().max(5e3).optional().nullable()
|
|
618
715
|
});
|
|
619
|
-
updateChatConversationUserStateSchema =
|
|
620
|
-
pinned:
|
|
716
|
+
updateChatConversationUserStateSchema = z6.object({
|
|
717
|
+
pinned: z6.boolean().optional()
|
|
621
718
|
});
|
|
622
719
|
}
|
|
623
720
|
});
|
|
624
721
|
|
|
625
722
|
// ../packages/shared/src/validators/organization-skill.ts
|
|
626
|
-
import { z as
|
|
723
|
+
import { z as z7 } from "zod";
|
|
627
724
|
var organizationSkillSourceTypeSchema, organizationSkillTrustLevelSchema, organizationSkillCompatibilitySchema, organizationSkillSourceBadgeSchema, organizationSkillFileInventoryEntrySchema, organizationSkillSchema, organizationSkillListItemSchema, organizationSkillUsageAgentSchema, organizationSkillDetailSchema, organizationSkillUpdateStatusSchema, organizationSkillImportSchema, organizationSkillProjectScanRequestSchema, organizationSkillProjectScanSkippedSchema, organizationSkillProjectScanConflictSchema, organizationSkillProjectScanResultSchema, organizationSkillLocalScanRequestSchema, organizationSkillLocalScanSkippedSchema, organizationSkillLocalScanConflictSchema, organizationSkillLocalScanResultSchema, organizationSkillCreateSchema, organizationSkillFileDetailSchema, organizationSkillFileUpdateSchema;
|
|
628
725
|
var init_organization_skill = __esm({
|
|
629
726
|
"../packages/shared/src/validators/organization-skill.ts"() {
|
|
630
727
|
"use strict";
|
|
631
|
-
organizationSkillSourceTypeSchema =
|
|
632
|
-
organizationSkillTrustLevelSchema =
|
|
633
|
-
organizationSkillCompatibilitySchema =
|
|
634
|
-
organizationSkillSourceBadgeSchema =
|
|
728
|
+
organizationSkillSourceTypeSchema = z7.enum(["local_path", "github", "url", "catalog", "skills_sh"]);
|
|
729
|
+
organizationSkillTrustLevelSchema = z7.enum(["markdown_only", "assets", "scripts_executables"]);
|
|
730
|
+
organizationSkillCompatibilitySchema = z7.enum(["compatible", "unknown", "invalid"]);
|
|
731
|
+
organizationSkillSourceBadgeSchema = z7.enum([
|
|
635
732
|
"rudder",
|
|
636
733
|
"community",
|
|
637
734
|
"github",
|
|
@@ -640,157 +737,157 @@ var init_organization_skill = __esm({
|
|
|
640
737
|
"catalog",
|
|
641
738
|
"skills_sh"
|
|
642
739
|
]);
|
|
643
|
-
organizationSkillFileInventoryEntrySchema =
|
|
644
|
-
path:
|
|
645
|
-
kind:
|
|
740
|
+
organizationSkillFileInventoryEntrySchema = z7.object({
|
|
741
|
+
path: z7.string().min(1),
|
|
742
|
+
kind: z7.enum(["skill", "markdown", "reference", "script", "asset", "other"])
|
|
646
743
|
});
|
|
647
|
-
organizationSkillSchema =
|
|
648
|
-
id:
|
|
649
|
-
orgId:
|
|
650
|
-
key:
|
|
651
|
-
slug:
|
|
652
|
-
name:
|
|
653
|
-
description:
|
|
654
|
-
markdown:
|
|
744
|
+
organizationSkillSchema = z7.object({
|
|
745
|
+
id: z7.string().uuid(),
|
|
746
|
+
orgId: z7.string().uuid(),
|
|
747
|
+
key: z7.string().min(1),
|
|
748
|
+
slug: z7.string().min(1),
|
|
749
|
+
name: z7.string().min(1),
|
|
750
|
+
description: z7.string().nullable(),
|
|
751
|
+
markdown: z7.string(),
|
|
655
752
|
sourceType: organizationSkillSourceTypeSchema,
|
|
656
|
-
sourceLocator:
|
|
657
|
-
sourceRef:
|
|
753
|
+
sourceLocator: z7.string().nullable(),
|
|
754
|
+
sourceRef: z7.string().nullable(),
|
|
658
755
|
trustLevel: organizationSkillTrustLevelSchema,
|
|
659
756
|
compatibility: organizationSkillCompatibilitySchema,
|
|
660
|
-
fileInventory:
|
|
661
|
-
metadata:
|
|
662
|
-
createdAt:
|
|
663
|
-
updatedAt:
|
|
757
|
+
fileInventory: z7.array(organizationSkillFileInventoryEntrySchema).default([]),
|
|
758
|
+
metadata: z7.record(z7.unknown()).nullable(),
|
|
759
|
+
createdAt: z7.coerce.date(),
|
|
760
|
+
updatedAt: z7.coerce.date()
|
|
664
761
|
});
|
|
665
762
|
organizationSkillListItemSchema = organizationSkillSchema.extend({
|
|
666
|
-
attachedAgentCount:
|
|
667
|
-
editable:
|
|
668
|
-
editableReason:
|
|
669
|
-
sourceLabel:
|
|
763
|
+
attachedAgentCount: z7.number().int().nonnegative(),
|
|
764
|
+
editable: z7.boolean(),
|
|
765
|
+
editableReason: z7.string().nullable(),
|
|
766
|
+
sourceLabel: z7.string().nullable(),
|
|
670
767
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
671
|
-
sourcePath:
|
|
672
|
-
workspaceEditPath:
|
|
768
|
+
sourcePath: z7.string().nullable(),
|
|
769
|
+
workspaceEditPath: z7.string().nullable()
|
|
673
770
|
});
|
|
674
|
-
organizationSkillUsageAgentSchema =
|
|
675
|
-
id:
|
|
676
|
-
name:
|
|
677
|
-
urlKey:
|
|
678
|
-
agentRuntimeType:
|
|
679
|
-
desired:
|
|
680
|
-
actualState:
|
|
771
|
+
organizationSkillUsageAgentSchema = z7.object({
|
|
772
|
+
id: z7.string().uuid(),
|
|
773
|
+
name: z7.string().min(1),
|
|
774
|
+
urlKey: z7.string().min(1),
|
|
775
|
+
agentRuntimeType: z7.string().min(1),
|
|
776
|
+
desired: z7.boolean(),
|
|
777
|
+
actualState: z7.string().nullable()
|
|
681
778
|
});
|
|
682
779
|
organizationSkillDetailSchema = organizationSkillSchema.extend({
|
|
683
|
-
attachedAgentCount:
|
|
684
|
-
usedByAgents:
|
|
685
|
-
editable:
|
|
686
|
-
editableReason:
|
|
687
|
-
sourceLabel:
|
|
780
|
+
attachedAgentCount: z7.number().int().nonnegative(),
|
|
781
|
+
usedByAgents: z7.array(organizationSkillUsageAgentSchema).default([]),
|
|
782
|
+
editable: z7.boolean(),
|
|
783
|
+
editableReason: z7.string().nullable(),
|
|
784
|
+
sourceLabel: z7.string().nullable(),
|
|
688
785
|
sourceBadge: organizationSkillSourceBadgeSchema,
|
|
689
|
-
sourcePath:
|
|
690
|
-
workspaceEditPath:
|
|
786
|
+
sourcePath: z7.string().nullable(),
|
|
787
|
+
workspaceEditPath: z7.string().nullable()
|
|
691
788
|
});
|
|
692
|
-
organizationSkillUpdateStatusSchema =
|
|
693
|
-
supported:
|
|
694
|
-
reason:
|
|
695
|
-
trackingRef:
|
|
696
|
-
currentRef:
|
|
697
|
-
latestRef:
|
|
698
|
-
hasUpdate:
|
|
789
|
+
organizationSkillUpdateStatusSchema = z7.object({
|
|
790
|
+
supported: z7.boolean(),
|
|
791
|
+
reason: z7.string().nullable(),
|
|
792
|
+
trackingRef: z7.string().nullable(),
|
|
793
|
+
currentRef: z7.string().nullable(),
|
|
794
|
+
latestRef: z7.string().nullable(),
|
|
795
|
+
hasUpdate: z7.boolean()
|
|
699
796
|
});
|
|
700
|
-
organizationSkillImportSchema =
|
|
701
|
-
source:
|
|
797
|
+
organizationSkillImportSchema = z7.object({
|
|
798
|
+
source: z7.string().min(1)
|
|
702
799
|
});
|
|
703
|
-
organizationSkillProjectScanRequestSchema =
|
|
704
|
-
projectIds:
|
|
705
|
-
workspaceIds:
|
|
800
|
+
organizationSkillProjectScanRequestSchema = z7.object({
|
|
801
|
+
projectIds: z7.array(z7.string().uuid()).optional(),
|
|
802
|
+
workspaceIds: z7.array(z7.string().uuid()).optional()
|
|
706
803
|
});
|
|
707
|
-
organizationSkillProjectScanSkippedSchema =
|
|
708
|
-
projectId:
|
|
709
|
-
projectName:
|
|
710
|
-
workspaceId:
|
|
711
|
-
workspaceName:
|
|
712
|
-
path:
|
|
713
|
-
reason:
|
|
804
|
+
organizationSkillProjectScanSkippedSchema = z7.object({
|
|
805
|
+
projectId: z7.string().uuid(),
|
|
806
|
+
projectName: z7.string().min(1),
|
|
807
|
+
workspaceId: z7.string().uuid().nullable(),
|
|
808
|
+
workspaceName: z7.string().nullable(),
|
|
809
|
+
path: z7.string().nullable(),
|
|
810
|
+
reason: z7.string().min(1)
|
|
714
811
|
});
|
|
715
|
-
organizationSkillProjectScanConflictSchema =
|
|
716
|
-
slug:
|
|
717
|
-
key:
|
|
718
|
-
projectId:
|
|
719
|
-
projectName:
|
|
720
|
-
workspaceId:
|
|
721
|
-
workspaceName:
|
|
722
|
-
path:
|
|
723
|
-
existingSkillId:
|
|
724
|
-
existingSkillKey:
|
|
725
|
-
existingSourceLocator:
|
|
726
|
-
reason:
|
|
812
|
+
organizationSkillProjectScanConflictSchema = z7.object({
|
|
813
|
+
slug: z7.string().min(1),
|
|
814
|
+
key: z7.string().min(1),
|
|
815
|
+
projectId: z7.string().uuid(),
|
|
816
|
+
projectName: z7.string().min(1),
|
|
817
|
+
workspaceId: z7.string().uuid(),
|
|
818
|
+
workspaceName: z7.string().min(1),
|
|
819
|
+
path: z7.string().min(1),
|
|
820
|
+
existingSkillId: z7.string().uuid(),
|
|
821
|
+
existingSkillKey: z7.string().min(1),
|
|
822
|
+
existingSourceLocator: z7.string().nullable(),
|
|
823
|
+
reason: z7.string().min(1)
|
|
727
824
|
});
|
|
728
|
-
organizationSkillProjectScanResultSchema =
|
|
729
|
-
scannedProjects:
|
|
730
|
-
scannedWorkspaces:
|
|
731
|
-
discovered:
|
|
732
|
-
imported:
|
|
733
|
-
updated:
|
|
734
|
-
skipped:
|
|
735
|
-
conflicts:
|
|
736
|
-
warnings:
|
|
825
|
+
organizationSkillProjectScanResultSchema = z7.object({
|
|
826
|
+
scannedProjects: z7.number().int().nonnegative(),
|
|
827
|
+
scannedWorkspaces: z7.number().int().nonnegative(),
|
|
828
|
+
discovered: z7.number().int().nonnegative(),
|
|
829
|
+
imported: z7.array(organizationSkillSchema),
|
|
830
|
+
updated: z7.array(organizationSkillSchema),
|
|
831
|
+
skipped: z7.array(organizationSkillProjectScanSkippedSchema),
|
|
832
|
+
conflicts: z7.array(organizationSkillProjectScanConflictSchema),
|
|
833
|
+
warnings: z7.array(z7.string())
|
|
737
834
|
});
|
|
738
|
-
organizationSkillLocalScanRequestSchema =
|
|
739
|
-
roots:
|
|
835
|
+
organizationSkillLocalScanRequestSchema = z7.object({
|
|
836
|
+
roots: z7.array(z7.string().min(1)).optional()
|
|
740
837
|
});
|
|
741
|
-
organizationSkillLocalScanSkippedSchema =
|
|
742
|
-
root:
|
|
743
|
-
path:
|
|
744
|
-
reason:
|
|
838
|
+
organizationSkillLocalScanSkippedSchema = z7.object({
|
|
839
|
+
root: z7.string().min(1),
|
|
840
|
+
path: z7.string().nullable(),
|
|
841
|
+
reason: z7.string().min(1)
|
|
745
842
|
});
|
|
746
|
-
organizationSkillLocalScanConflictSchema =
|
|
747
|
-
root:
|
|
748
|
-
path:
|
|
749
|
-
slug:
|
|
750
|
-
key:
|
|
751
|
-
existingSkillId:
|
|
752
|
-
existingSkillKey:
|
|
753
|
-
existingSourceLocator:
|
|
754
|
-
reason:
|
|
843
|
+
organizationSkillLocalScanConflictSchema = z7.object({
|
|
844
|
+
root: z7.string().min(1),
|
|
845
|
+
path: z7.string().min(1),
|
|
846
|
+
slug: z7.string().min(1),
|
|
847
|
+
key: z7.string().min(1),
|
|
848
|
+
existingSkillId: z7.string().uuid(),
|
|
849
|
+
existingSkillKey: z7.string().min(1),
|
|
850
|
+
existingSourceLocator: z7.string().nullable(),
|
|
851
|
+
reason: z7.string().min(1)
|
|
755
852
|
});
|
|
756
|
-
organizationSkillLocalScanResultSchema =
|
|
757
|
-
scannedRoots:
|
|
758
|
-
discovered:
|
|
759
|
-
imported:
|
|
760
|
-
updated:
|
|
761
|
-
skipped:
|
|
762
|
-
conflicts:
|
|
763
|
-
warnings:
|
|
853
|
+
organizationSkillLocalScanResultSchema = z7.object({
|
|
854
|
+
scannedRoots: z7.number().int().nonnegative(),
|
|
855
|
+
discovered: z7.number().int().nonnegative(),
|
|
856
|
+
imported: z7.array(organizationSkillSchema),
|
|
857
|
+
updated: z7.array(organizationSkillSchema),
|
|
858
|
+
skipped: z7.array(organizationSkillLocalScanSkippedSchema),
|
|
859
|
+
conflicts: z7.array(organizationSkillLocalScanConflictSchema),
|
|
860
|
+
warnings: z7.array(z7.string())
|
|
764
861
|
});
|
|
765
|
-
organizationSkillCreateSchema =
|
|
766
|
-
name:
|
|
767
|
-
slug:
|
|
768
|
-
description:
|
|
769
|
-
markdown:
|
|
862
|
+
organizationSkillCreateSchema = z7.object({
|
|
863
|
+
name: z7.string().min(1),
|
|
864
|
+
slug: z7.string().min(1).nullable().optional(),
|
|
865
|
+
description: z7.string().nullable().optional(),
|
|
866
|
+
markdown: z7.string().nullable().optional()
|
|
770
867
|
});
|
|
771
|
-
organizationSkillFileDetailSchema =
|
|
772
|
-
skillId:
|
|
773
|
-
path:
|
|
774
|
-
kind:
|
|
775
|
-
content:
|
|
776
|
-
language:
|
|
777
|
-
markdown:
|
|
778
|
-
editable:
|
|
868
|
+
organizationSkillFileDetailSchema = z7.object({
|
|
869
|
+
skillId: z7.string().uuid(),
|
|
870
|
+
path: z7.string().min(1),
|
|
871
|
+
kind: z7.enum(["skill", "markdown", "reference", "script", "asset", "other"]),
|
|
872
|
+
content: z7.string(),
|
|
873
|
+
language: z7.string().nullable(),
|
|
874
|
+
markdown: z7.boolean(),
|
|
875
|
+
editable: z7.boolean()
|
|
779
876
|
});
|
|
780
|
-
organizationSkillFileUpdateSchema =
|
|
781
|
-
path:
|
|
782
|
-
content:
|
|
877
|
+
organizationSkillFileUpdateSchema = z7.object({
|
|
878
|
+
path: z7.string().min(1),
|
|
879
|
+
content: z7.string()
|
|
783
880
|
});
|
|
784
881
|
}
|
|
785
882
|
});
|
|
786
883
|
|
|
787
884
|
// ../packages/shared/src/validators/adapter-skills.ts
|
|
788
|
-
import { z as
|
|
885
|
+
import { z as z8 } from "zod";
|
|
789
886
|
var agentSkillStateSchema, agentSkillOriginSchema, agentSkillSourceClassSchema, agentSkillSyncModeSchema, agentSkillEntrySchema, agentSkillSnapshotSchema, agentSkillSyncSchema;
|
|
790
887
|
var init_adapter_skills = __esm({
|
|
791
888
|
"../packages/shared/src/validators/adapter-skills.ts"() {
|
|
792
889
|
"use strict";
|
|
793
|
-
agentSkillStateSchema =
|
|
890
|
+
agentSkillStateSchema = z8.enum([
|
|
794
891
|
"available",
|
|
795
892
|
"configured",
|
|
796
893
|
"installed",
|
|
@@ -798,433 +895,436 @@ var init_adapter_skills = __esm({
|
|
|
798
895
|
"stale",
|
|
799
896
|
"external"
|
|
800
897
|
]);
|
|
801
|
-
agentSkillOriginSchema =
|
|
898
|
+
agentSkillOriginSchema = z8.preprocess((value) => {
|
|
802
899
|
if (value === "company_managed") return "organization_managed";
|
|
803
900
|
return value;
|
|
804
|
-
},
|
|
901
|
+
}, z8.enum([
|
|
805
902
|
"organization_managed",
|
|
806
903
|
"user_installed",
|
|
807
904
|
"external_unknown"
|
|
808
905
|
]));
|
|
809
|
-
agentSkillSourceClassSchema =
|
|
906
|
+
agentSkillSourceClassSchema = z8.enum([
|
|
810
907
|
"bundled",
|
|
811
908
|
"organization",
|
|
812
909
|
"agent_home",
|
|
813
910
|
"global",
|
|
814
911
|
"adapter_home"
|
|
815
912
|
]);
|
|
816
|
-
agentSkillSyncModeSchema =
|
|
913
|
+
agentSkillSyncModeSchema = z8.enum([
|
|
817
914
|
"unsupported",
|
|
818
915
|
"persistent",
|
|
819
916
|
"ephemeral"
|
|
820
917
|
]);
|
|
821
|
-
agentSkillEntrySchema =
|
|
822
|
-
key:
|
|
823
|
-
selectionKey:
|
|
824
|
-
runtimeName:
|
|
825
|
-
description:
|
|
826
|
-
desired:
|
|
827
|
-
configurable:
|
|
828
|
-
alwaysEnabled:
|
|
829
|
-
managed:
|
|
918
|
+
agentSkillEntrySchema = z8.object({
|
|
919
|
+
key: z8.string().min(1),
|
|
920
|
+
selectionKey: z8.string().min(1),
|
|
921
|
+
runtimeName: z8.string().min(1).nullable(),
|
|
922
|
+
description: z8.string().nullable().optional(),
|
|
923
|
+
desired: z8.boolean(),
|
|
924
|
+
configurable: z8.boolean(),
|
|
925
|
+
alwaysEnabled: z8.boolean(),
|
|
926
|
+
managed: z8.boolean(),
|
|
830
927
|
state: agentSkillStateSchema,
|
|
831
928
|
sourceClass: agentSkillSourceClassSchema,
|
|
832
929
|
origin: agentSkillOriginSchema.optional(),
|
|
833
|
-
originLabel:
|
|
834
|
-
locationLabel:
|
|
835
|
-
readOnly:
|
|
836
|
-
sourcePath:
|
|
837
|
-
targetPath:
|
|
838
|
-
workspaceEditPath:
|
|
839
|
-
detail:
|
|
930
|
+
originLabel: z8.string().nullable().optional(),
|
|
931
|
+
locationLabel: z8.string().nullable().optional(),
|
|
932
|
+
readOnly: z8.boolean().optional(),
|
|
933
|
+
sourcePath: z8.string().nullable().optional(),
|
|
934
|
+
targetPath: z8.string().nullable().optional(),
|
|
935
|
+
workspaceEditPath: z8.string().nullable().optional(),
|
|
936
|
+
detail: z8.string().nullable().optional()
|
|
840
937
|
});
|
|
841
|
-
agentSkillSnapshotSchema =
|
|
842
|
-
agentRuntimeType:
|
|
843
|
-
supported:
|
|
938
|
+
agentSkillSnapshotSchema = z8.object({
|
|
939
|
+
agentRuntimeType: z8.string().min(1),
|
|
940
|
+
supported: z8.boolean(),
|
|
844
941
|
mode: agentSkillSyncModeSchema,
|
|
845
|
-
desiredSkills:
|
|
846
|
-
entries:
|
|
847
|
-
warnings:
|
|
942
|
+
desiredSkills: z8.array(z8.string().min(1)),
|
|
943
|
+
entries: z8.array(agentSkillEntrySchema),
|
|
944
|
+
warnings: z8.array(z8.string())
|
|
848
945
|
});
|
|
849
|
-
agentSkillSyncSchema =
|
|
850
|
-
desiredSkills:
|
|
946
|
+
agentSkillSyncSchema = z8.object({
|
|
947
|
+
desiredSkills: z8.array(z8.string().min(1))
|
|
851
948
|
});
|
|
852
949
|
}
|
|
853
950
|
});
|
|
854
951
|
|
|
855
952
|
// ../packages/shared/src/validators/organization-portability.ts
|
|
856
|
-
import { z as
|
|
953
|
+
import { z as z9 } from "zod";
|
|
857
954
|
var portabilityIncludeSchema, portabilityEnvInputSchema, portabilityFileEntrySchema, portabilityOrganizationManifestEntrySchema, portabilitySidebarOrderSchema, portabilityAgentManifestEntrySchema, portabilitySkillManifestEntrySchema, portabilityProjectManifestEntrySchema, portabilityIssueAutomationTriggerManifestEntrySchema, portabilityIssueAutomationManifestEntrySchema, portabilityIssueManifestEntrySchema, portabilityManifestSchema, portabilitySourceSchema, portabilityTargetSchema, portabilityAgentSelectionSchema, portabilityCollisionStrategySchema, organizationPortabilityExportSchema, organizationPortabilityPreviewSchema, portabilityAdapterOverrideSchema, organizationPortabilityImportSchema;
|
|
858
955
|
var init_organization_portability = __esm({
|
|
859
956
|
"../packages/shared/src/validators/organization-portability.ts"() {
|
|
860
957
|
"use strict";
|
|
861
|
-
portabilityIncludeSchema =
|
|
862
|
-
organization:
|
|
863
|
-
agents:
|
|
864
|
-
projects:
|
|
865
|
-
issues:
|
|
866
|
-
skills:
|
|
958
|
+
portabilityIncludeSchema = z9.object({
|
|
959
|
+
organization: z9.boolean().optional(),
|
|
960
|
+
agents: z9.boolean().optional(),
|
|
961
|
+
projects: z9.boolean().optional(),
|
|
962
|
+
issues: z9.boolean().optional(),
|
|
963
|
+
skills: z9.boolean().optional()
|
|
867
964
|
}).partial();
|
|
868
|
-
portabilityEnvInputSchema =
|
|
869
|
-
key:
|
|
870
|
-
description:
|
|
871
|
-
agentSlug:
|
|
872
|
-
kind:
|
|
873
|
-
requirement:
|
|
874
|
-
defaultValue:
|
|
875
|
-
portability:
|
|
965
|
+
portabilityEnvInputSchema = z9.object({
|
|
966
|
+
key: z9.string().min(1),
|
|
967
|
+
description: z9.string().nullable(),
|
|
968
|
+
agentSlug: z9.string().min(1).nullable(),
|
|
969
|
+
kind: z9.enum(["secret", "plain"]),
|
|
970
|
+
requirement: z9.enum(["required", "optional"]),
|
|
971
|
+
defaultValue: z9.string().nullable(),
|
|
972
|
+
portability: z9.enum(["portable", "system_dependent"])
|
|
876
973
|
});
|
|
877
|
-
portabilityFileEntrySchema =
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
encoding:
|
|
881
|
-
data:
|
|
882
|
-
contentType:
|
|
974
|
+
portabilityFileEntrySchema = z9.union([
|
|
975
|
+
z9.string(),
|
|
976
|
+
z9.object({
|
|
977
|
+
encoding: z9.literal("base64"),
|
|
978
|
+
data: z9.string(),
|
|
979
|
+
contentType: z9.string().min(1).optional().nullable()
|
|
883
980
|
})
|
|
884
981
|
]);
|
|
885
|
-
portabilityOrganizationManifestEntrySchema =
|
|
886
|
-
path:
|
|
887
|
-
name:
|
|
888
|
-
description:
|
|
889
|
-
brandColor:
|
|
890
|
-
logoPath:
|
|
891
|
-
requireBoardApprovalForNewAgents:
|
|
982
|
+
portabilityOrganizationManifestEntrySchema = z9.object({
|
|
983
|
+
path: z9.string().min(1),
|
|
984
|
+
name: z9.string().min(1),
|
|
985
|
+
description: z9.string().nullable(),
|
|
986
|
+
brandColor: z9.string().nullable(),
|
|
987
|
+
logoPath: z9.string().nullable(),
|
|
988
|
+
requireBoardApprovalForNewAgents: z9.boolean()
|
|
892
989
|
});
|
|
893
|
-
portabilitySidebarOrderSchema =
|
|
894
|
-
agents:
|
|
895
|
-
projects:
|
|
990
|
+
portabilitySidebarOrderSchema = z9.object({
|
|
991
|
+
agents: z9.array(z9.string().min(1)).default([]),
|
|
992
|
+
projects: z9.array(z9.string().min(1)).default([])
|
|
896
993
|
});
|
|
897
|
-
portabilityAgentManifestEntrySchema =
|
|
898
|
-
slug:
|
|
899
|
-
name:
|
|
900
|
-
path:
|
|
901
|
-
skills:
|
|
902
|
-
role:
|
|
903
|
-
title:
|
|
904
|
-
icon:
|
|
905
|
-
capabilities:
|
|
906
|
-
reportsToSlug:
|
|
907
|
-
agentRuntimeType:
|
|
908
|
-
agentRuntimeConfig:
|
|
909
|
-
runtimeConfig:
|
|
910
|
-
permissions:
|
|
911
|
-
budgetMonthlyCents:
|
|
912
|
-
metadata:
|
|
994
|
+
portabilityAgentManifestEntrySchema = z9.object({
|
|
995
|
+
slug: z9.string().min(1),
|
|
996
|
+
name: z9.string().min(1),
|
|
997
|
+
path: z9.string().min(1),
|
|
998
|
+
skills: z9.array(z9.string().min(1)).default([]),
|
|
999
|
+
role: z9.string().min(1),
|
|
1000
|
+
title: z9.string().nullable(),
|
|
1001
|
+
icon: z9.string().nullable(),
|
|
1002
|
+
capabilities: z9.string().nullable(),
|
|
1003
|
+
reportsToSlug: z9.string().min(1).nullable(),
|
|
1004
|
+
agentRuntimeType: z9.string().min(1),
|
|
1005
|
+
agentRuntimeConfig: z9.record(z9.unknown()),
|
|
1006
|
+
runtimeConfig: z9.record(z9.unknown()),
|
|
1007
|
+
permissions: z9.record(z9.unknown()),
|
|
1008
|
+
budgetMonthlyCents: z9.number().int().nonnegative(),
|
|
1009
|
+
metadata: z9.record(z9.unknown()).nullable()
|
|
913
1010
|
});
|
|
914
|
-
portabilitySkillManifestEntrySchema =
|
|
915
|
-
key:
|
|
916
|
-
slug:
|
|
917
|
-
name:
|
|
918
|
-
path:
|
|
919
|
-
description:
|
|
920
|
-
sourceType:
|
|
921
|
-
sourceLocator:
|
|
922
|
-
sourceRef:
|
|
923
|
-
trustLevel:
|
|
924
|
-
compatibility:
|
|
925
|
-
metadata:
|
|
926
|
-
fileInventory:
|
|
927
|
-
path:
|
|
928
|
-
kind:
|
|
1011
|
+
portabilitySkillManifestEntrySchema = z9.object({
|
|
1012
|
+
key: z9.string().min(1),
|
|
1013
|
+
slug: z9.string().min(1),
|
|
1014
|
+
name: z9.string().min(1),
|
|
1015
|
+
path: z9.string().min(1),
|
|
1016
|
+
description: z9.string().nullable(),
|
|
1017
|
+
sourceType: z9.string().min(1),
|
|
1018
|
+
sourceLocator: z9.string().nullable(),
|
|
1019
|
+
sourceRef: z9.string().nullable(),
|
|
1020
|
+
trustLevel: z9.string().nullable(),
|
|
1021
|
+
compatibility: z9.string().nullable(),
|
|
1022
|
+
metadata: z9.record(z9.unknown()).nullable(),
|
|
1023
|
+
fileInventory: z9.array(z9.object({
|
|
1024
|
+
path: z9.string().min(1),
|
|
1025
|
+
kind: z9.string().min(1)
|
|
929
1026
|
})).default([])
|
|
930
1027
|
});
|
|
931
|
-
portabilityProjectManifestEntrySchema =
|
|
932
|
-
slug:
|
|
933
|
-
name:
|
|
934
|
-
path:
|
|
935
|
-
description:
|
|
936
|
-
ownerAgentSlug:
|
|
937
|
-
leadAgentSlug:
|
|
938
|
-
targetDate:
|
|
939
|
-
color:
|
|
940
|
-
status:
|
|
941
|
-
executionWorkspacePolicy:
|
|
942
|
-
workspaces:
|
|
943
|
-
key:
|
|
944
|
-
name:
|
|
945
|
-
sourceType:
|
|
946
|
-
repoUrl:
|
|
947
|
-
repoRef:
|
|
948
|
-
defaultRef:
|
|
949
|
-
visibility:
|
|
950
|
-
setupCommand:
|
|
951
|
-
cleanupCommand:
|
|
952
|
-
metadata:
|
|
953
|
-
isPrimary:
|
|
1028
|
+
portabilityProjectManifestEntrySchema = z9.object({
|
|
1029
|
+
slug: z9.string().min(1),
|
|
1030
|
+
name: z9.string().min(1),
|
|
1031
|
+
path: z9.string().min(1),
|
|
1032
|
+
description: z9.string().nullable(),
|
|
1033
|
+
ownerAgentSlug: z9.string().min(1).nullable(),
|
|
1034
|
+
leadAgentSlug: z9.string().min(1).nullable(),
|
|
1035
|
+
targetDate: z9.string().nullable(),
|
|
1036
|
+
color: z9.string().nullable(),
|
|
1037
|
+
status: z9.string().nullable(),
|
|
1038
|
+
executionWorkspacePolicy: z9.record(z9.unknown()).nullable(),
|
|
1039
|
+
workspaces: z9.array(z9.object({
|
|
1040
|
+
key: z9.string().min(1),
|
|
1041
|
+
name: z9.string().min(1),
|
|
1042
|
+
sourceType: z9.string().nullable(),
|
|
1043
|
+
repoUrl: z9.string().nullable(),
|
|
1044
|
+
repoRef: z9.string().nullable(),
|
|
1045
|
+
defaultRef: z9.string().nullable(),
|
|
1046
|
+
visibility: z9.string().nullable(),
|
|
1047
|
+
setupCommand: z9.string().nullable(),
|
|
1048
|
+
cleanupCommand: z9.string().nullable(),
|
|
1049
|
+
metadata: z9.record(z9.unknown()).nullable(),
|
|
1050
|
+
isPrimary: z9.boolean()
|
|
954
1051
|
})).default([]),
|
|
955
|
-
metadata:
|
|
1052
|
+
metadata: z9.record(z9.unknown()).nullable()
|
|
956
1053
|
});
|
|
957
|
-
portabilityIssueAutomationTriggerManifestEntrySchema =
|
|
958
|
-
kind:
|
|
959
|
-
label:
|
|
960
|
-
enabled:
|
|
961
|
-
cronExpression:
|
|
962
|
-
timezone:
|
|
963
|
-
signingMode:
|
|
964
|
-
replayWindowSec:
|
|
1054
|
+
portabilityIssueAutomationTriggerManifestEntrySchema = z9.object({
|
|
1055
|
+
kind: z9.string().min(1),
|
|
1056
|
+
label: z9.string().nullable(),
|
|
1057
|
+
enabled: z9.boolean(),
|
|
1058
|
+
cronExpression: z9.string().nullable(),
|
|
1059
|
+
timezone: z9.string().nullable(),
|
|
1060
|
+
signingMode: z9.string().nullable(),
|
|
1061
|
+
replayWindowSec: z9.number().int().nullable()
|
|
965
1062
|
});
|
|
966
|
-
portabilityIssueAutomationManifestEntrySchema =
|
|
967
|
-
concurrencyPolicy:
|
|
968
|
-
catchUpPolicy:
|
|
969
|
-
triggers:
|
|
1063
|
+
portabilityIssueAutomationManifestEntrySchema = z9.object({
|
|
1064
|
+
concurrencyPolicy: z9.string().nullable(),
|
|
1065
|
+
catchUpPolicy: z9.string().nullable(),
|
|
1066
|
+
triggers: z9.array(portabilityIssueAutomationTriggerManifestEntrySchema).default([])
|
|
970
1067
|
});
|
|
971
|
-
portabilityIssueManifestEntrySchema =
|
|
972
|
-
slug:
|
|
973
|
-
identifier:
|
|
974
|
-
title:
|
|
975
|
-
path:
|
|
976
|
-
projectSlug:
|
|
977
|
-
projectWorkspaceKey:
|
|
978
|
-
assigneeAgentSlug:
|
|
979
|
-
description:
|
|
980
|
-
recurring:
|
|
1068
|
+
portabilityIssueManifestEntrySchema = z9.object({
|
|
1069
|
+
slug: z9.string().min(1),
|
|
1070
|
+
identifier: z9.string().min(1).nullable(),
|
|
1071
|
+
title: z9.string().min(1),
|
|
1072
|
+
path: z9.string().min(1),
|
|
1073
|
+
projectSlug: z9.string().min(1).nullable(),
|
|
1074
|
+
projectWorkspaceKey: z9.string().min(1).nullable(),
|
|
1075
|
+
assigneeAgentSlug: z9.string().min(1).nullable(),
|
|
1076
|
+
description: z9.string().nullable(),
|
|
1077
|
+
recurring: z9.boolean().default(false),
|
|
981
1078
|
automation: portabilityIssueAutomationManifestEntrySchema.nullable(),
|
|
982
|
-
legacyRecurrence:
|
|
983
|
-
status:
|
|
984
|
-
priority:
|
|
985
|
-
labelIds:
|
|
986
|
-
billingCode:
|
|
987
|
-
executionWorkspaceSettings:
|
|
988
|
-
assigneeAgentRuntimeOverrides:
|
|
989
|
-
metadata:
|
|
1079
|
+
legacyRecurrence: z9.record(z9.unknown()).nullable(),
|
|
1080
|
+
status: z9.string().nullable(),
|
|
1081
|
+
priority: z9.string().nullable(),
|
|
1082
|
+
labelIds: z9.array(z9.string().min(1)).default([]),
|
|
1083
|
+
billingCode: z9.string().nullable(),
|
|
1084
|
+
executionWorkspaceSettings: z9.record(z9.unknown()).nullable(),
|
|
1085
|
+
assigneeAgentRuntimeOverrides: z9.record(z9.unknown()).nullable(),
|
|
1086
|
+
metadata: z9.record(z9.unknown()).nullable()
|
|
990
1087
|
});
|
|
991
|
-
portabilityManifestSchema =
|
|
992
|
-
schemaVersion:
|
|
993
|
-
generatedAt:
|
|
994
|
-
source:
|
|
995
|
-
orgId:
|
|
996
|
-
organizationName:
|
|
1088
|
+
portabilityManifestSchema = z9.object({
|
|
1089
|
+
schemaVersion: z9.number().int().positive(),
|
|
1090
|
+
generatedAt: z9.string().datetime(),
|
|
1091
|
+
source: z9.object({
|
|
1092
|
+
orgId: z9.string().uuid(),
|
|
1093
|
+
organizationName: z9.string().min(1)
|
|
997
1094
|
}).nullable(),
|
|
998
|
-
includes:
|
|
999
|
-
organization:
|
|
1000
|
-
agents:
|
|
1001
|
-
projects:
|
|
1002
|
-
issues:
|
|
1003
|
-
skills:
|
|
1095
|
+
includes: z9.object({
|
|
1096
|
+
organization: z9.boolean(),
|
|
1097
|
+
agents: z9.boolean(),
|
|
1098
|
+
projects: z9.boolean(),
|
|
1099
|
+
issues: z9.boolean(),
|
|
1100
|
+
skills: z9.boolean()
|
|
1004
1101
|
}),
|
|
1005
1102
|
organization: portabilityOrganizationManifestEntrySchema.nullable(),
|
|
1006
1103
|
sidebar: portabilitySidebarOrderSchema.nullable(),
|
|
1007
|
-
agents:
|
|
1008
|
-
skills:
|
|
1009
|
-
projects:
|
|
1010
|
-
issues:
|
|
1011
|
-
envInputs:
|
|
1104
|
+
agents: z9.array(portabilityAgentManifestEntrySchema),
|
|
1105
|
+
skills: z9.array(portabilitySkillManifestEntrySchema).default([]),
|
|
1106
|
+
projects: z9.array(portabilityProjectManifestEntrySchema).default([]),
|
|
1107
|
+
issues: z9.array(portabilityIssueManifestEntrySchema).default([]),
|
|
1108
|
+
envInputs: z9.array(portabilityEnvInputSchema).default([])
|
|
1012
1109
|
});
|
|
1013
|
-
portabilitySourceSchema =
|
|
1014
|
-
|
|
1015
|
-
type:
|
|
1016
|
-
rootPath:
|
|
1017
|
-
files:
|
|
1110
|
+
portabilitySourceSchema = z9.discriminatedUnion("type", [
|
|
1111
|
+
z9.object({
|
|
1112
|
+
type: z9.literal("inline"),
|
|
1113
|
+
rootPath: z9.string().min(1).optional().nullable(),
|
|
1114
|
+
files: z9.record(portabilityFileEntrySchema)
|
|
1018
1115
|
}),
|
|
1019
|
-
|
|
1020
|
-
type:
|
|
1021
|
-
url:
|
|
1116
|
+
z9.object({
|
|
1117
|
+
type: z9.literal("github"),
|
|
1118
|
+
url: z9.string().url()
|
|
1022
1119
|
})
|
|
1023
1120
|
]);
|
|
1024
|
-
portabilityTargetSchema =
|
|
1025
|
-
|
|
1026
|
-
mode:
|
|
1027
|
-
newOrganizationName:
|
|
1121
|
+
portabilityTargetSchema = z9.discriminatedUnion("mode", [
|
|
1122
|
+
z9.object({
|
|
1123
|
+
mode: z9.literal("new_organization"),
|
|
1124
|
+
newOrganizationName: z9.string().min(1).optional().nullable()
|
|
1028
1125
|
}),
|
|
1029
|
-
|
|
1030
|
-
mode:
|
|
1031
|
-
orgId:
|
|
1126
|
+
z9.object({
|
|
1127
|
+
mode: z9.literal("existing_organization"),
|
|
1128
|
+
orgId: z9.string().uuid()
|
|
1032
1129
|
})
|
|
1033
1130
|
]);
|
|
1034
|
-
portabilityAgentSelectionSchema =
|
|
1035
|
-
|
|
1036
|
-
|
|
1131
|
+
portabilityAgentSelectionSchema = z9.union([
|
|
1132
|
+
z9.literal("all"),
|
|
1133
|
+
z9.array(z9.string().min(1))
|
|
1037
1134
|
]);
|
|
1038
|
-
portabilityCollisionStrategySchema =
|
|
1039
|
-
organizationPortabilityExportSchema =
|
|
1135
|
+
portabilityCollisionStrategySchema = z9.enum(["rename", "skip", "replace"]);
|
|
1136
|
+
organizationPortabilityExportSchema = z9.object({
|
|
1040
1137
|
include: portabilityIncludeSchema.optional(),
|
|
1041
|
-
agents:
|
|
1042
|
-
skills:
|
|
1043
|
-
projects:
|
|
1044
|
-
issues:
|
|
1045
|
-
projectIssues:
|
|
1046
|
-
selectedFiles:
|
|
1047
|
-
expandReferencedSkills:
|
|
1138
|
+
agents: z9.array(z9.string().min(1)).optional(),
|
|
1139
|
+
skills: z9.array(z9.string().min(1)).optional(),
|
|
1140
|
+
projects: z9.array(z9.string().min(1)).optional(),
|
|
1141
|
+
issues: z9.array(z9.string().min(1)).optional(),
|
|
1142
|
+
projectIssues: z9.array(z9.string().min(1)).optional(),
|
|
1143
|
+
selectedFiles: z9.array(z9.string().min(1)).optional(),
|
|
1144
|
+
expandReferencedSkills: z9.boolean().optional(),
|
|
1048
1145
|
sidebarOrder: portabilitySidebarOrderSchema.partial().optional()
|
|
1049
1146
|
});
|
|
1050
|
-
organizationPortabilityPreviewSchema =
|
|
1147
|
+
organizationPortabilityPreviewSchema = z9.object({
|
|
1051
1148
|
source: portabilitySourceSchema,
|
|
1052
1149
|
include: portabilityIncludeSchema.optional(),
|
|
1053
1150
|
target: portabilityTargetSchema,
|
|
1054
1151
|
agents: portabilityAgentSelectionSchema.optional(),
|
|
1055
1152
|
collisionStrategy: portabilityCollisionStrategySchema.optional(),
|
|
1056
|
-
nameOverrides:
|
|
1057
|
-
selectedFiles:
|
|
1153
|
+
nameOverrides: z9.record(z9.string().min(1), z9.string().min(1)).optional(),
|
|
1154
|
+
selectedFiles: z9.array(z9.string().min(1)).optional()
|
|
1058
1155
|
});
|
|
1059
|
-
portabilityAdapterOverrideSchema =
|
|
1060
|
-
agentRuntimeType:
|
|
1061
|
-
agentRuntimeConfig:
|
|
1156
|
+
portabilityAdapterOverrideSchema = z9.object({
|
|
1157
|
+
agentRuntimeType: z9.string().min(1),
|
|
1158
|
+
agentRuntimeConfig: z9.record(z9.unknown()).optional()
|
|
1062
1159
|
});
|
|
1063
1160
|
organizationPortabilityImportSchema = organizationPortabilityPreviewSchema.extend({
|
|
1064
|
-
agentRuntimeOverrides:
|
|
1161
|
+
agentRuntimeOverrides: z9.record(z9.string().min(1), portabilityAdapterOverrideSchema).optional()
|
|
1065
1162
|
});
|
|
1066
1163
|
}
|
|
1067
1164
|
});
|
|
1068
1165
|
|
|
1069
1166
|
// ../packages/shared/src/validators/secret.ts
|
|
1070
|
-
import { z as
|
|
1167
|
+
import { z as z10 } from "zod";
|
|
1071
1168
|
var envBindingPlainSchema, envBindingSecretRefSchema, envBindingSchema, envConfigSchema, createSecretSchema, rotateSecretSchema, updateSecretSchema;
|
|
1072
1169
|
var init_secret = __esm({
|
|
1073
1170
|
"../packages/shared/src/validators/secret.ts"() {
|
|
1074
1171
|
"use strict";
|
|
1075
1172
|
init_constants();
|
|
1076
|
-
envBindingPlainSchema =
|
|
1077
|
-
type:
|
|
1078
|
-
value:
|
|
1173
|
+
envBindingPlainSchema = z10.object({
|
|
1174
|
+
type: z10.literal("plain"),
|
|
1175
|
+
value: z10.string()
|
|
1079
1176
|
});
|
|
1080
|
-
envBindingSecretRefSchema =
|
|
1081
|
-
type:
|
|
1082
|
-
secretId:
|
|
1083
|
-
version:
|
|
1177
|
+
envBindingSecretRefSchema = z10.object({
|
|
1178
|
+
type: z10.literal("secret_ref"),
|
|
1179
|
+
secretId: z10.string().uuid(),
|
|
1180
|
+
version: z10.union([z10.literal("latest"), z10.number().int().positive()]).optional()
|
|
1084
1181
|
});
|
|
1085
|
-
envBindingSchema =
|
|
1086
|
-
|
|
1182
|
+
envBindingSchema = z10.union([
|
|
1183
|
+
z10.string(),
|
|
1087
1184
|
envBindingPlainSchema,
|
|
1088
1185
|
envBindingSecretRefSchema
|
|
1089
1186
|
]);
|
|
1090
|
-
envConfigSchema =
|
|
1091
|
-
createSecretSchema =
|
|
1092
|
-
name:
|
|
1093
|
-
provider:
|
|
1094
|
-
value:
|
|
1095
|
-
description:
|
|
1096
|
-
externalRef:
|
|
1187
|
+
envConfigSchema = z10.record(envBindingSchema);
|
|
1188
|
+
createSecretSchema = z10.object({
|
|
1189
|
+
name: z10.string().min(1),
|
|
1190
|
+
provider: z10.enum(SECRET_PROVIDERS).optional(),
|
|
1191
|
+
value: z10.string().min(1),
|
|
1192
|
+
description: z10.string().optional().nullable(),
|
|
1193
|
+
externalRef: z10.string().optional().nullable()
|
|
1097
1194
|
});
|
|
1098
|
-
rotateSecretSchema =
|
|
1099
|
-
value:
|
|
1100
|
-
externalRef:
|
|
1195
|
+
rotateSecretSchema = z10.object({
|
|
1196
|
+
value: z10.string().min(1),
|
|
1197
|
+
externalRef: z10.string().optional().nullable()
|
|
1101
1198
|
});
|
|
1102
|
-
updateSecretSchema =
|
|
1103
|
-
name:
|
|
1104
|
-
description:
|
|
1105
|
-
externalRef:
|
|
1199
|
+
updateSecretSchema = z10.object({
|
|
1200
|
+
name: z10.string().min(1).optional(),
|
|
1201
|
+
description: z10.string().optional().nullable(),
|
|
1202
|
+
externalRef: z10.string().optional().nullable()
|
|
1106
1203
|
});
|
|
1107
1204
|
}
|
|
1108
1205
|
});
|
|
1109
1206
|
|
|
1110
1207
|
// ../packages/shared/src/validators/agent.ts
|
|
1111
|
-
import { z as
|
|
1208
|
+
import { z as z11 } from "zod";
|
|
1112
1209
|
var agentPermissionsSchema, agentInstructionsBundleModeSchema, updateAgentInstructionsBundleSchema, upsertAgentInstructionsFileSchema, agentRuntimeConfigSchema, optionalAgentNameSchema, uploadedAgentIconSchema, customAgentIconSchema, agentIconSchema, createAgentSchema, createAgentHireSchema, updateAgentSchema, updateAgentInstructionsPathSchema, createAgentKeySchema, wakeAgentSchema, resetAgentSessionSchema, testAgentRuntimeEnvironmentSchema, updateAgentPermissionsSchema;
|
|
1113
1210
|
var init_agent = __esm({
|
|
1114
1211
|
"../packages/shared/src/validators/agent.ts"() {
|
|
1115
1212
|
"use strict";
|
|
1116
1213
|
init_constants();
|
|
1117
1214
|
init_secret();
|
|
1118
|
-
|
|
1119
|
-
|
|
1215
|
+
init_model_fallbacks();
|
|
1216
|
+
agentPermissionsSchema = z11.object({
|
|
1217
|
+
canCreateAgents: z11.boolean().optional().default(false)
|
|
1120
1218
|
});
|
|
1121
|
-
agentInstructionsBundleModeSchema =
|
|
1122
|
-
updateAgentInstructionsBundleSchema =
|
|
1219
|
+
agentInstructionsBundleModeSchema = z11.enum(["managed", "external"]);
|
|
1220
|
+
updateAgentInstructionsBundleSchema = z11.object({
|
|
1123
1221
|
mode: agentInstructionsBundleModeSchema.optional(),
|
|
1124
|
-
rootPath:
|
|
1125
|
-
entryFile:
|
|
1126
|
-
clearLegacyPromptTemplate:
|
|
1222
|
+
rootPath: z11.string().trim().min(1).nullable().optional(),
|
|
1223
|
+
entryFile: z11.string().trim().min(1).optional(),
|
|
1224
|
+
clearLegacyPromptTemplate: z11.boolean().optional().default(false)
|
|
1127
1225
|
});
|
|
1128
|
-
upsertAgentInstructionsFileSchema =
|
|
1129
|
-
path:
|
|
1130
|
-
content:
|
|
1131
|
-
clearLegacyPromptTemplate:
|
|
1226
|
+
upsertAgentInstructionsFileSchema = z11.object({
|
|
1227
|
+
path: z11.string().trim().min(1),
|
|
1228
|
+
content: z11.string(),
|
|
1229
|
+
clearLegacyPromptTemplate: z11.boolean().optional().default(false)
|
|
1132
1230
|
});
|
|
1133
|
-
agentRuntimeConfigSchema =
|
|
1231
|
+
agentRuntimeConfigSchema = z11.record(z11.unknown()).superRefine((value, ctx) => {
|
|
1134
1232
|
const envValue = value.env;
|
|
1135
|
-
if (envValue
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1233
|
+
if (envValue !== void 0) {
|
|
1234
|
+
const parsed = envConfigSchema.safeParse(envValue);
|
|
1235
|
+
if (!parsed.success) {
|
|
1236
|
+
ctx.addIssue({
|
|
1237
|
+
code: z11.ZodIssueCode.custom,
|
|
1238
|
+
message: "agentRuntimeConfig.env must be a map of valid env bindings",
|
|
1239
|
+
path: ["env"]
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1143
1242
|
}
|
|
1243
|
+
validateModelFallbacksConfig(value, ctx, []);
|
|
1144
1244
|
});
|
|
1145
|
-
optionalAgentNameSchema =
|
|
1245
|
+
optionalAgentNameSchema = z11.preprocess(
|
|
1146
1246
|
(value) => {
|
|
1147
1247
|
if (typeof value !== "string") return value;
|
|
1148
1248
|
const trimmed = value.trim();
|
|
1149
1249
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
1150
1250
|
},
|
|
1151
|
-
|
|
1251
|
+
z11.string().trim().min(1).optional()
|
|
1152
1252
|
);
|
|
1153
|
-
uploadedAgentIconSchema =
|
|
1253
|
+
uploadedAgentIconSchema = z11.string().regex(
|
|
1154
1254
|
/^asset:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
|
|
1155
1255
|
"Invalid uploaded avatar reference"
|
|
1156
1256
|
);
|
|
1157
|
-
customAgentIconSchema =
|
|
1158
|
-
agentIconSchema =
|
|
1257
|
+
customAgentIconSchema = z11.string().trim().min(1).max(24).refine((value) => !value.toLowerCase().startsWith("asset:"), "Invalid uploaded avatar reference").refine((value) => !/[<>\u0000-\u001f\u007f]/u.test(value), "Icon cannot contain markup or control characters");
|
|
1258
|
+
agentIconSchema = z11.preprocess(
|
|
1159
1259
|
(value) => {
|
|
1160
1260
|
if (typeof value !== "string") return value;
|
|
1161
1261
|
const trimmed = value.trim();
|
|
1162
1262
|
return trimmed.length > 0 ? trimmed : null;
|
|
1163
1263
|
},
|
|
1164
|
-
|
|
1165
|
-
|
|
1264
|
+
z11.union([
|
|
1265
|
+
z11.enum(AGENT_ICON_NAMES),
|
|
1166
1266
|
uploadedAgentIconSchema,
|
|
1167
1267
|
customAgentIconSchema
|
|
1168
1268
|
]).nullable()
|
|
1169
1269
|
);
|
|
1170
|
-
createAgentSchema =
|
|
1270
|
+
createAgentSchema = z11.object({
|
|
1171
1271
|
name: optionalAgentNameSchema,
|
|
1172
|
-
role:
|
|
1173
|
-
title:
|
|
1272
|
+
role: z11.enum(AGENT_ROLES).optional().default("general"),
|
|
1273
|
+
title: z11.string().optional().nullable(),
|
|
1174
1274
|
icon: agentIconSchema.optional(),
|
|
1175
|
-
reportsTo:
|
|
1176
|
-
capabilities:
|
|
1177
|
-
desiredSkills:
|
|
1178
|
-
agentRuntimeType:
|
|
1275
|
+
reportsTo: z11.string().uuid().optional().nullable(),
|
|
1276
|
+
capabilities: z11.string().optional().nullable(),
|
|
1277
|
+
desiredSkills: z11.array(z11.string().min(1)).optional(),
|
|
1278
|
+
agentRuntimeType: z11.enum(AGENT_RUNTIME_TYPES).optional().default("process"),
|
|
1179
1279
|
agentRuntimeConfig: agentRuntimeConfigSchema.optional().default({}),
|
|
1180
|
-
runtimeConfig:
|
|
1181
|
-
budgetMonthlyCents:
|
|
1280
|
+
runtimeConfig: z11.record(z11.unknown()).optional().default({}),
|
|
1281
|
+
budgetMonthlyCents: z11.number().int().nonnegative().optional().default(0),
|
|
1182
1282
|
permissions: agentPermissionsSchema.optional(),
|
|
1183
|
-
metadata:
|
|
1283
|
+
metadata: z11.record(z11.unknown()).optional().nullable()
|
|
1184
1284
|
});
|
|
1185
1285
|
createAgentHireSchema = createAgentSchema.extend({
|
|
1186
|
-
sourceIssueId:
|
|
1187
|
-
sourceIssueIds:
|
|
1286
|
+
sourceIssueId: z11.string().uuid().optional().nullable(),
|
|
1287
|
+
sourceIssueIds: z11.array(z11.string().uuid()).optional()
|
|
1188
1288
|
});
|
|
1189
1289
|
updateAgentSchema = createAgentSchema.omit({ permissions: true }).partial().extend({
|
|
1190
|
-
permissions:
|
|
1191
|
-
replaceAgentRuntimeConfig:
|
|
1192
|
-
status:
|
|
1193
|
-
spentMonthlyCents:
|
|
1290
|
+
permissions: z11.never().optional(),
|
|
1291
|
+
replaceAgentRuntimeConfig: z11.boolean().optional(),
|
|
1292
|
+
status: z11.enum(AGENT_STATUSES).optional(),
|
|
1293
|
+
spentMonthlyCents: z11.number().int().nonnegative().optional()
|
|
1194
1294
|
});
|
|
1195
|
-
updateAgentInstructionsPathSchema =
|
|
1196
|
-
path:
|
|
1197
|
-
agentRuntimeConfigKey:
|
|
1295
|
+
updateAgentInstructionsPathSchema = z11.object({
|
|
1296
|
+
path: z11.string().trim().min(1).nullable(),
|
|
1297
|
+
agentRuntimeConfigKey: z11.string().trim().min(1).optional()
|
|
1198
1298
|
});
|
|
1199
|
-
createAgentKeySchema =
|
|
1200
|
-
name:
|
|
1299
|
+
createAgentKeySchema = z11.object({
|
|
1300
|
+
name: z11.string().min(1).default("default")
|
|
1201
1301
|
});
|
|
1202
|
-
wakeAgentSchema =
|
|
1203
|
-
source:
|
|
1204
|
-
triggerDetail:
|
|
1205
|
-
reason:
|
|
1206
|
-
payload:
|
|
1207
|
-
idempotencyKey:
|
|
1208
|
-
forceFreshSession:
|
|
1302
|
+
wakeAgentSchema = z11.object({
|
|
1303
|
+
source: z11.enum(["timer", "assignment", "on_demand", "automation"]).optional().default("on_demand"),
|
|
1304
|
+
triggerDetail: z11.enum(["manual", "ping", "callback", "system"]).optional(),
|
|
1305
|
+
reason: z11.string().optional().nullable(),
|
|
1306
|
+
payload: z11.record(z11.unknown()).optional().nullable(),
|
|
1307
|
+
idempotencyKey: z11.string().optional().nullable(),
|
|
1308
|
+
forceFreshSession: z11.preprocess(
|
|
1209
1309
|
(value) => value === null ? void 0 : value,
|
|
1210
|
-
|
|
1310
|
+
z11.boolean().optional().default(false)
|
|
1211
1311
|
)
|
|
1212
1312
|
});
|
|
1213
|
-
resetAgentSessionSchema =
|
|
1214
|
-
taskKey:
|
|
1313
|
+
resetAgentSessionSchema = z11.object({
|
|
1314
|
+
taskKey: z11.string().min(1).optional().nullable()
|
|
1215
1315
|
});
|
|
1216
|
-
testAgentRuntimeEnvironmentSchema =
|
|
1316
|
+
testAgentRuntimeEnvironmentSchema = z11.object({
|
|
1217
1317
|
agentRuntimeConfig: agentRuntimeConfigSchema.optional().default({})
|
|
1218
1318
|
});
|
|
1219
|
-
updateAgentPermissionsSchema =
|
|
1220
|
-
canCreateAgents:
|
|
1221
|
-
canAssignTasks:
|
|
1319
|
+
updateAgentPermissionsSchema = z11.object({
|
|
1320
|
+
canCreateAgents: z11.boolean(),
|
|
1321
|
+
canAssignTasks: z11.boolean()
|
|
1222
1322
|
});
|
|
1223
1323
|
}
|
|
1224
1324
|
});
|
|
1225
1325
|
|
|
1226
1326
|
// ../packages/shared/src/validators/project.ts
|
|
1227
|
-
import { z as
|
|
1327
|
+
import { z as z12 } from "zod";
|
|
1228
1328
|
function validateProjectWorkspace(value, ctx) {
|
|
1229
1329
|
const sourceType = value.sourceType ?? "local_path";
|
|
1230
1330
|
const hasCwd = typeof value.cwd === "string" && value.cwd.trim().length > 0;
|
|
@@ -1233,7 +1333,7 @@ function validateProjectWorkspace(value, ctx) {
|
|
|
1233
1333
|
if (sourceType === "remote_managed") {
|
|
1234
1334
|
if (!hasRemoteRef && !hasRepo) {
|
|
1235
1335
|
ctx.addIssue({
|
|
1236
|
-
code:
|
|
1336
|
+
code: z12.ZodIssueCode.custom,
|
|
1237
1337
|
message: "Remote-managed workspace requires remoteWorkspaceRef or repoUrl.",
|
|
1238
1338
|
path: ["remoteWorkspaceRef"]
|
|
1239
1339
|
});
|
|
@@ -1242,125 +1342,131 @@ function validateProjectWorkspace(value, ctx) {
|
|
|
1242
1342
|
}
|
|
1243
1343
|
if (!hasCwd && !hasRepo) {
|
|
1244
1344
|
ctx.addIssue({
|
|
1245
|
-
code:
|
|
1345
|
+
code: z12.ZodIssueCode.custom,
|
|
1246
1346
|
message: "Workspace requires at least one of cwd or repoUrl.",
|
|
1247
1347
|
path: ["cwd"]
|
|
1248
1348
|
});
|
|
1249
1349
|
}
|
|
1250
1350
|
}
|
|
1251
|
-
var executionWorkspaceStrategySchema, projectExecutionWorkspacePolicySchema, projectWorkspaceSourceTypeSchema, projectWorkspaceVisibilitySchema, projectWorkspaceFields, createProjectWorkspaceSchema, updateProjectWorkspaceSchema, projectFields, createProjectSchema, updateProjectSchema;
|
|
1351
|
+
var executionWorkspaceStrategySchema, projectExecutionWorkspacePolicySchema, projectWorkspaceSourceTypeSchema, projectWorkspaceVisibilitySchema, projectWorkspaceFields, projectColorValues, legacyProjectColorSchema, projectColorSchema, createProjectWorkspaceSchema, updateProjectWorkspaceSchema, projectFields, createProjectSchema, updateProjectSchema;
|
|
1252
1352
|
var init_project = __esm({
|
|
1253
1353
|
"../packages/shared/src/validators/project.ts"() {
|
|
1254
1354
|
"use strict";
|
|
1255
1355
|
init_constants();
|
|
1256
1356
|
init_resource();
|
|
1257
|
-
executionWorkspaceStrategySchema =
|
|
1258
|
-
type:
|
|
1259
|
-
baseRef:
|
|
1260
|
-
branchTemplate:
|
|
1261
|
-
worktreeParentDir:
|
|
1262
|
-
provisionCommand:
|
|
1263
|
-
teardownCommand:
|
|
1357
|
+
executionWorkspaceStrategySchema = z12.object({
|
|
1358
|
+
type: z12.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
|
|
1359
|
+
baseRef: z12.string().optional().nullable(),
|
|
1360
|
+
branchTemplate: z12.string().optional().nullable(),
|
|
1361
|
+
worktreeParentDir: z12.string().optional().nullable(),
|
|
1362
|
+
provisionCommand: z12.string().optional().nullable(),
|
|
1363
|
+
teardownCommand: z12.string().optional().nullable()
|
|
1264
1364
|
}).strict();
|
|
1265
|
-
projectExecutionWorkspacePolicySchema =
|
|
1266
|
-
enabled:
|
|
1267
|
-
defaultMode:
|
|
1268
|
-
allowIssueOverride:
|
|
1269
|
-
defaultProjectWorkspaceId:
|
|
1365
|
+
projectExecutionWorkspacePolicySchema = z12.object({
|
|
1366
|
+
enabled: z12.boolean(),
|
|
1367
|
+
defaultMode: z12.enum(["shared_workspace", "isolated_workspace", "operator_branch", "adapter_default"]).optional(),
|
|
1368
|
+
allowIssueOverride: z12.boolean().optional(),
|
|
1369
|
+
defaultProjectWorkspaceId: z12.string().uuid().optional().nullable(),
|
|
1270
1370
|
workspaceStrategy: executionWorkspaceStrategySchema.optional().nullable(),
|
|
1271
|
-
workspaceRuntime:
|
|
1272
|
-
branchPolicy:
|
|
1273
|
-
pullRequestPolicy:
|
|
1274
|
-
runtimePolicy:
|
|
1275
|
-
cleanupPolicy:
|
|
1371
|
+
workspaceRuntime: z12.record(z12.unknown()).optional().nullable(),
|
|
1372
|
+
branchPolicy: z12.record(z12.unknown()).optional().nullable(),
|
|
1373
|
+
pullRequestPolicy: z12.record(z12.unknown()).optional().nullable(),
|
|
1374
|
+
runtimePolicy: z12.record(z12.unknown()).optional().nullable(),
|
|
1375
|
+
cleanupPolicy: z12.record(z12.unknown()).optional().nullable()
|
|
1276
1376
|
}).strict();
|
|
1277
|
-
projectWorkspaceSourceTypeSchema =
|
|
1278
|
-
projectWorkspaceVisibilitySchema =
|
|
1377
|
+
projectWorkspaceSourceTypeSchema = z12.enum(["local_path", "git_repo", "remote_managed", "non_git_path"]);
|
|
1378
|
+
projectWorkspaceVisibilitySchema = z12.enum(["default", "advanced"]);
|
|
1279
1379
|
projectWorkspaceFields = {
|
|
1280
|
-
name:
|
|
1380
|
+
name: z12.string().min(1).optional(),
|
|
1281
1381
|
sourceType: projectWorkspaceSourceTypeSchema.optional(),
|
|
1282
|
-
cwd:
|
|
1283
|
-
repoUrl:
|
|
1284
|
-
repoRef:
|
|
1285
|
-
defaultRef:
|
|
1382
|
+
cwd: z12.string().min(1).optional().nullable(),
|
|
1383
|
+
repoUrl: z12.string().url().optional().nullable(),
|
|
1384
|
+
repoRef: z12.string().optional().nullable(),
|
|
1385
|
+
defaultRef: z12.string().optional().nullable(),
|
|
1286
1386
|
visibility: projectWorkspaceVisibilitySchema.optional(),
|
|
1287
|
-
setupCommand:
|
|
1288
|
-
cleanupCommand:
|
|
1289
|
-
remoteProvider:
|
|
1290
|
-
remoteWorkspaceRef:
|
|
1291
|
-
sharedWorkspaceKey:
|
|
1292
|
-
metadata:
|
|
1387
|
+
setupCommand: z12.string().optional().nullable(),
|
|
1388
|
+
cleanupCommand: z12.string().optional().nullable(),
|
|
1389
|
+
remoteProvider: z12.string().optional().nullable(),
|
|
1390
|
+
remoteWorkspaceRef: z12.string().optional().nullable(),
|
|
1391
|
+
sharedWorkspaceKey: z12.string().optional().nullable(),
|
|
1392
|
+
metadata: z12.record(z12.unknown()).optional().nullable()
|
|
1293
1393
|
};
|
|
1294
|
-
|
|
1394
|
+
projectColorValues = new Set(PROJECT_COLORS);
|
|
1395
|
+
legacyProjectColorSchema = z12.string().regex(/^#[0-9a-fA-F]{6}$/);
|
|
1396
|
+
projectColorSchema = z12.string().refine(
|
|
1397
|
+
(value) => legacyProjectColorSchema.safeParse(value).success || projectColorValues.has(value),
|
|
1398
|
+
"Color must be a 6-digit hex value or a supported project gradient"
|
|
1399
|
+
);
|
|
1400
|
+
createProjectWorkspaceSchema = z12.object({
|
|
1295
1401
|
...projectWorkspaceFields,
|
|
1296
|
-
isPrimary:
|
|
1402
|
+
isPrimary: z12.boolean().optional().default(false)
|
|
1297
1403
|
}).superRefine(validateProjectWorkspace);
|
|
1298
|
-
updateProjectWorkspaceSchema =
|
|
1404
|
+
updateProjectWorkspaceSchema = z12.object({
|
|
1299
1405
|
...projectWorkspaceFields,
|
|
1300
|
-
isPrimary:
|
|
1406
|
+
isPrimary: z12.boolean().optional()
|
|
1301
1407
|
}).partial();
|
|
1302
1408
|
projectFields = {
|
|
1303
1409
|
/** @deprecated Use goalIds instead */
|
|
1304
|
-
goalId:
|
|
1305
|
-
goalIds:
|
|
1306
|
-
name:
|
|
1307
|
-
description:
|
|
1308
|
-
status:
|
|
1309
|
-
leadAgentId:
|
|
1310
|
-
targetDate:
|
|
1311
|
-
color:
|
|
1410
|
+
goalId: z12.string().uuid().optional().nullable(),
|
|
1411
|
+
goalIds: z12.array(z12.string().uuid()).optional(),
|
|
1412
|
+
name: z12.string().min(1),
|
|
1413
|
+
description: z12.string().optional().nullable(),
|
|
1414
|
+
status: z12.enum(PROJECT_STATUSES).optional().default("backlog"),
|
|
1415
|
+
leadAgentId: z12.string().uuid().optional().nullable(),
|
|
1416
|
+
targetDate: z12.string().optional().nullable(),
|
|
1417
|
+
color: projectColorSchema.optional().nullable(),
|
|
1312
1418
|
executionWorkspacePolicy: projectExecutionWorkspacePolicySchema.optional().nullable(),
|
|
1313
|
-
resourceAttachments:
|
|
1314
|
-
newResources:
|
|
1315
|
-
archivedAt:
|
|
1419
|
+
resourceAttachments: z12.array(projectResourceAttachmentInputSchema).optional(),
|
|
1420
|
+
newResources: z12.array(createProjectInlineResourceSchema).optional(),
|
|
1421
|
+
archivedAt: z12.string().datetime().optional().nullable()
|
|
1316
1422
|
};
|
|
1317
|
-
createProjectSchema =
|
|
1423
|
+
createProjectSchema = z12.object({
|
|
1318
1424
|
...projectFields
|
|
1319
1425
|
});
|
|
1320
|
-
updateProjectSchema =
|
|
1426
|
+
updateProjectSchema = z12.object(projectFields).partial();
|
|
1321
1427
|
}
|
|
1322
1428
|
});
|
|
1323
1429
|
|
|
1324
1430
|
// ../packages/shared/src/validators/issue.ts
|
|
1325
|
-
import { z as
|
|
1431
|
+
import { z as z13 } from "zod";
|
|
1326
1432
|
var executionWorkspaceStrategySchema2, issueExecutionWorkspaceSettingsSchema, issueAssigneeAdapterOverridesSchema, createIssueSchema, createIssueLabelSchema, updateIssueLabelSchema, updateIssueSchema, checkoutIssueSchema, addIssueCommentSchema, linkIssueApprovalSchema, createIssueAttachmentMetadataSchema, ISSUE_DOCUMENT_FORMATS, issueDocumentFormatSchema, issueDocumentKeySchema, upsertIssueDocumentSchema;
|
|
1327
1433
|
var init_issue = __esm({
|
|
1328
1434
|
"../packages/shared/src/validators/issue.ts"() {
|
|
1329
1435
|
"use strict";
|
|
1330
1436
|
init_constants();
|
|
1331
|
-
executionWorkspaceStrategySchema2 =
|
|
1332
|
-
type:
|
|
1333
|
-
baseRef:
|
|
1334
|
-
branchTemplate:
|
|
1335
|
-
worktreeParentDir:
|
|
1336
|
-
provisionCommand:
|
|
1337
|
-
teardownCommand:
|
|
1437
|
+
executionWorkspaceStrategySchema2 = z13.object({
|
|
1438
|
+
type: z13.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
|
|
1439
|
+
baseRef: z13.string().optional().nullable(),
|
|
1440
|
+
branchTemplate: z13.string().optional().nullable(),
|
|
1441
|
+
worktreeParentDir: z13.string().optional().nullable(),
|
|
1442
|
+
provisionCommand: z13.string().optional().nullable(),
|
|
1443
|
+
teardownCommand: z13.string().optional().nullable()
|
|
1338
1444
|
}).strict();
|
|
1339
|
-
issueExecutionWorkspaceSettingsSchema =
|
|
1340
|
-
mode:
|
|
1445
|
+
issueExecutionWorkspaceSettingsSchema = z13.object({
|
|
1446
|
+
mode: z13.enum(["inherit", "shared_workspace", "isolated_workspace", "operator_branch", "reuse_existing", "agent_default"]).optional(),
|
|
1341
1447
|
workspaceStrategy: executionWorkspaceStrategySchema2.optional().nullable(),
|
|
1342
|
-
workspaceRuntime:
|
|
1448
|
+
workspaceRuntime: z13.record(z13.unknown()).optional().nullable()
|
|
1343
1449
|
}).strict();
|
|
1344
|
-
issueAssigneeAdapterOverridesSchema =
|
|
1345
|
-
agentRuntimeConfig:
|
|
1346
|
-
useProjectWorkspace:
|
|
1450
|
+
issueAssigneeAdapterOverridesSchema = z13.object({
|
|
1451
|
+
agentRuntimeConfig: z13.record(z13.unknown()).optional(),
|
|
1452
|
+
useProjectWorkspace: z13.boolean().optional()
|
|
1347
1453
|
}).strict();
|
|
1348
|
-
createIssueSchema =
|
|
1349
|
-
projectId:
|
|
1350
|
-
projectWorkspaceId:
|
|
1351
|
-
goalId:
|
|
1352
|
-
parentId:
|
|
1353
|
-
title:
|
|
1354
|
-
description:
|
|
1355
|
-
status:
|
|
1356
|
-
priority:
|
|
1357
|
-
assigneeAgentId:
|
|
1358
|
-
assigneeUserId:
|
|
1359
|
-
requestDepth:
|
|
1360
|
-
billingCode:
|
|
1454
|
+
createIssueSchema = z13.object({
|
|
1455
|
+
projectId: z13.string().uuid().optional().nullable(),
|
|
1456
|
+
projectWorkspaceId: z13.string().uuid().optional().nullable(),
|
|
1457
|
+
goalId: z13.string().uuid().optional().nullable(),
|
|
1458
|
+
parentId: z13.string().uuid().optional().nullable(),
|
|
1459
|
+
title: z13.string().min(1),
|
|
1460
|
+
description: z13.string().optional().nullable(),
|
|
1461
|
+
status: z13.enum(ISSUE_STATUSES).optional().default("backlog"),
|
|
1462
|
+
priority: z13.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
|
1463
|
+
assigneeAgentId: z13.string().uuid().optional().nullable(),
|
|
1464
|
+
assigneeUserId: z13.string().optional().nullable(),
|
|
1465
|
+
requestDepth: z13.number().int().nonnegative().optional().default(0),
|
|
1466
|
+
billingCode: z13.string().optional().nullable(),
|
|
1361
1467
|
assigneeAgentRuntimeOverrides: issueAssigneeAdapterOverridesSchema.optional().nullable(),
|
|
1362
|
-
executionWorkspaceId:
|
|
1363
|
-
executionWorkspacePreference:
|
|
1468
|
+
executionWorkspaceId: z13.string().uuid().optional().nullable(),
|
|
1469
|
+
executionWorkspacePreference: z13.enum([
|
|
1364
1470
|
"inherit",
|
|
1365
1471
|
"shared_workspace",
|
|
1366
1472
|
"isolated_workspace",
|
|
@@ -1369,11 +1475,11 @@ var init_issue = __esm({
|
|
|
1369
1475
|
"agent_default"
|
|
1370
1476
|
]).optional().nullable(),
|
|
1371
1477
|
executionWorkspaceSettings: issueExecutionWorkspaceSettingsSchema.optional().nullable(),
|
|
1372
|
-
labelIds:
|
|
1478
|
+
labelIds: z13.array(z13.string().uuid()).optional()
|
|
1373
1479
|
});
|
|
1374
|
-
createIssueLabelSchema =
|
|
1375
|
-
name:
|
|
1376
|
-
color:
|
|
1480
|
+
createIssueLabelSchema = z13.object({
|
|
1481
|
+
name: z13.string().trim().min(1).max(48),
|
|
1482
|
+
color: z13.string().regex(/^#(?:[0-9a-fA-F]{6})$/, "Color must be a 6-digit hex value")
|
|
1377
1483
|
});
|
|
1378
1484
|
updateIssueLabelSchema = createIssueLabelSchema.partial().refine(
|
|
1379
1485
|
(value) => value.name !== void 0 || value.color !== void 0,
|
|
@@ -1382,45 +1488,45 @@ var init_issue = __esm({
|
|
|
1382
1488
|
}
|
|
1383
1489
|
);
|
|
1384
1490
|
updateIssueSchema = createIssueSchema.partial().extend({
|
|
1385
|
-
comment:
|
|
1386
|
-
reopen:
|
|
1387
|
-
hiddenAt:
|
|
1491
|
+
comment: z13.string().min(1).optional(),
|
|
1492
|
+
reopen: z13.boolean().optional(),
|
|
1493
|
+
hiddenAt: z13.string().datetime().nullable().optional()
|
|
1388
1494
|
});
|
|
1389
|
-
checkoutIssueSchema =
|
|
1390
|
-
agentId:
|
|
1391
|
-
expectedStatuses:
|
|
1495
|
+
checkoutIssueSchema = z13.object({
|
|
1496
|
+
agentId: z13.string().uuid(),
|
|
1497
|
+
expectedStatuses: z13.array(z13.enum(ISSUE_STATUSES)).nonempty()
|
|
1392
1498
|
});
|
|
1393
|
-
addIssueCommentSchema =
|
|
1394
|
-
body:
|
|
1395
|
-
reopen:
|
|
1396
|
-
interrupt:
|
|
1499
|
+
addIssueCommentSchema = z13.object({
|
|
1500
|
+
body: z13.string().min(1),
|
|
1501
|
+
reopen: z13.boolean().optional(),
|
|
1502
|
+
interrupt: z13.boolean().optional()
|
|
1397
1503
|
});
|
|
1398
|
-
linkIssueApprovalSchema =
|
|
1399
|
-
approvalId:
|
|
1504
|
+
linkIssueApprovalSchema = z13.object({
|
|
1505
|
+
approvalId: z13.string().uuid()
|
|
1400
1506
|
});
|
|
1401
|
-
createIssueAttachmentMetadataSchema =
|
|
1402
|
-
issueCommentId:
|
|
1507
|
+
createIssueAttachmentMetadataSchema = z13.object({
|
|
1508
|
+
issueCommentId: z13.string().uuid().optional().nullable()
|
|
1403
1509
|
});
|
|
1404
1510
|
ISSUE_DOCUMENT_FORMATS = ["markdown"];
|
|
1405
|
-
issueDocumentFormatSchema =
|
|
1406
|
-
issueDocumentKeySchema =
|
|
1407
|
-
upsertIssueDocumentSchema =
|
|
1408
|
-
title:
|
|
1511
|
+
issueDocumentFormatSchema = z13.enum(ISSUE_DOCUMENT_FORMATS);
|
|
1512
|
+
issueDocumentKeySchema = z13.string().trim().min(1).max(64).regex(/^[a-z0-9][a-z0-9_-]*$/, "Document key must be lowercase letters, numbers, _ or -");
|
|
1513
|
+
upsertIssueDocumentSchema = z13.object({
|
|
1514
|
+
title: z13.string().trim().max(200).nullable().optional(),
|
|
1409
1515
|
format: issueDocumentFormatSchema,
|
|
1410
|
-
body:
|
|
1411
|
-
changeSummary:
|
|
1412
|
-
baseRevisionId:
|
|
1516
|
+
body: z13.string().max(524288),
|
|
1517
|
+
changeSummary: z13.string().trim().max(500).nullable().optional(),
|
|
1518
|
+
baseRevisionId: z13.string().uuid().nullable().optional()
|
|
1413
1519
|
});
|
|
1414
1520
|
}
|
|
1415
1521
|
});
|
|
1416
1522
|
|
|
1417
1523
|
// ../packages/shared/src/validators/work-product.ts
|
|
1418
|
-
import { z as
|
|
1524
|
+
import { z as z14 } from "zod";
|
|
1419
1525
|
var issueWorkProductTypeSchema, issueWorkProductStatusSchema, issueWorkProductReviewStateSchema, createIssueWorkProductSchema, updateIssueWorkProductSchema;
|
|
1420
1526
|
var init_work_product = __esm({
|
|
1421
1527
|
"../packages/shared/src/validators/work-product.ts"() {
|
|
1422
1528
|
"use strict";
|
|
1423
|
-
issueWorkProductTypeSchema =
|
|
1529
|
+
issueWorkProductTypeSchema = z14.enum([
|
|
1424
1530
|
"preview_url",
|
|
1425
1531
|
"runtime_service",
|
|
1426
1532
|
"pull_request",
|
|
@@ -1429,7 +1535,7 @@ var init_work_product = __esm({
|
|
|
1429
1535
|
"artifact",
|
|
1430
1536
|
"document"
|
|
1431
1537
|
]);
|
|
1432
|
-
issueWorkProductStatusSchema =
|
|
1538
|
+
issueWorkProductStatusSchema = z14.enum([
|
|
1433
1539
|
"active",
|
|
1434
1540
|
"ready_for_review",
|
|
1435
1541
|
"approved",
|
|
@@ -1440,226 +1546,226 @@ var init_work_product = __esm({
|
|
|
1440
1546
|
"archived",
|
|
1441
1547
|
"draft"
|
|
1442
1548
|
]);
|
|
1443
|
-
issueWorkProductReviewStateSchema =
|
|
1549
|
+
issueWorkProductReviewStateSchema = z14.enum([
|
|
1444
1550
|
"none",
|
|
1445
1551
|
"needs_board_review",
|
|
1446
1552
|
"approved",
|
|
1447
1553
|
"changes_requested"
|
|
1448
1554
|
]);
|
|
1449
|
-
createIssueWorkProductSchema =
|
|
1450
|
-
projectId:
|
|
1451
|
-
executionWorkspaceId:
|
|
1452
|
-
runtimeServiceId:
|
|
1555
|
+
createIssueWorkProductSchema = z14.object({
|
|
1556
|
+
projectId: z14.string().uuid().optional().nullable(),
|
|
1557
|
+
executionWorkspaceId: z14.string().uuid().optional().nullable(),
|
|
1558
|
+
runtimeServiceId: z14.string().uuid().optional().nullable(),
|
|
1453
1559
|
type: issueWorkProductTypeSchema,
|
|
1454
|
-
provider:
|
|
1455
|
-
externalId:
|
|
1456
|
-
title:
|
|
1457
|
-
url:
|
|
1560
|
+
provider: z14.string().min(1),
|
|
1561
|
+
externalId: z14.string().optional().nullable(),
|
|
1562
|
+
title: z14.string().min(1),
|
|
1563
|
+
url: z14.string().url().optional().nullable(),
|
|
1458
1564
|
status: issueWorkProductStatusSchema.default("active"),
|
|
1459
1565
|
reviewState: issueWorkProductReviewStateSchema.optional().default("none"),
|
|
1460
|
-
isPrimary:
|
|
1461
|
-
healthStatus:
|
|
1462
|
-
summary:
|
|
1463
|
-
metadata:
|
|
1464
|
-
createdByRunId:
|
|
1566
|
+
isPrimary: z14.boolean().optional().default(false),
|
|
1567
|
+
healthStatus: z14.enum(["unknown", "healthy", "unhealthy"]).optional().default("unknown"),
|
|
1568
|
+
summary: z14.string().optional().nullable(),
|
|
1569
|
+
metadata: z14.record(z14.unknown()).optional().nullable(),
|
|
1570
|
+
createdByRunId: z14.string().uuid().optional().nullable()
|
|
1465
1571
|
});
|
|
1466
1572
|
updateIssueWorkProductSchema = createIssueWorkProductSchema.partial();
|
|
1467
1573
|
}
|
|
1468
1574
|
});
|
|
1469
1575
|
|
|
1470
1576
|
// ../packages/shared/src/validators/execution-workspace.ts
|
|
1471
|
-
import { z as
|
|
1577
|
+
import { z as z15 } from "zod";
|
|
1472
1578
|
var executionWorkspaceStatusSchema, updateExecutionWorkspaceSchema;
|
|
1473
1579
|
var init_execution_workspace = __esm({
|
|
1474
1580
|
"../packages/shared/src/validators/execution-workspace.ts"() {
|
|
1475
1581
|
"use strict";
|
|
1476
|
-
executionWorkspaceStatusSchema =
|
|
1582
|
+
executionWorkspaceStatusSchema = z15.enum([
|
|
1477
1583
|
"active",
|
|
1478
1584
|
"idle",
|
|
1479
1585
|
"in_review",
|
|
1480
1586
|
"archived",
|
|
1481
1587
|
"cleanup_failed"
|
|
1482
1588
|
]);
|
|
1483
|
-
updateExecutionWorkspaceSchema =
|
|
1589
|
+
updateExecutionWorkspaceSchema = z15.object({
|
|
1484
1590
|
status: executionWorkspaceStatusSchema.optional(),
|
|
1485
|
-
cleanupEligibleAt:
|
|
1486
|
-
cleanupReason:
|
|
1487
|
-
metadata:
|
|
1591
|
+
cleanupEligibleAt: z15.string().datetime().optional().nullable(),
|
|
1592
|
+
cleanupReason: z15.string().optional().nullable(),
|
|
1593
|
+
metadata: z15.record(z15.unknown()).optional().nullable()
|
|
1488
1594
|
}).strict();
|
|
1489
1595
|
}
|
|
1490
1596
|
});
|
|
1491
1597
|
|
|
1492
1598
|
// ../packages/shared/src/validators/goal.ts
|
|
1493
|
-
import { z as
|
|
1599
|
+
import { z as z16 } from "zod";
|
|
1494
1600
|
var createGoalSchema, updateGoalSchema;
|
|
1495
1601
|
var init_goal = __esm({
|
|
1496
1602
|
"../packages/shared/src/validators/goal.ts"() {
|
|
1497
1603
|
"use strict";
|
|
1498
1604
|
init_constants();
|
|
1499
|
-
createGoalSchema =
|
|
1500
|
-
title:
|
|
1501
|
-
description:
|
|
1502
|
-
level:
|
|
1503
|
-
status:
|
|
1504
|
-
parentId:
|
|
1505
|
-
ownerAgentId:
|
|
1605
|
+
createGoalSchema = z16.object({
|
|
1606
|
+
title: z16.string().min(1),
|
|
1607
|
+
description: z16.string().optional().nullable(),
|
|
1608
|
+
level: z16.enum(GOAL_LEVELS).optional().default("task"),
|
|
1609
|
+
status: z16.enum(GOAL_STATUSES).optional().default("planned"),
|
|
1610
|
+
parentId: z16.string().uuid().optional().nullable(),
|
|
1611
|
+
ownerAgentId: z16.string().uuid().optional().nullable()
|
|
1506
1612
|
});
|
|
1507
1613
|
updateGoalSchema = createGoalSchema.partial();
|
|
1508
1614
|
}
|
|
1509
1615
|
});
|
|
1510
1616
|
|
|
1511
1617
|
// ../packages/shared/src/validators/approval.ts
|
|
1512
|
-
import { z as
|
|
1618
|
+
import { z as z17 } from "zod";
|
|
1513
1619
|
var createApprovalSchema, resolveApprovalSchema, requestApprovalRevisionSchema, resubmitApprovalSchema, addApprovalCommentSchema;
|
|
1514
1620
|
var init_approval = __esm({
|
|
1515
1621
|
"../packages/shared/src/validators/approval.ts"() {
|
|
1516
1622
|
"use strict";
|
|
1517
1623
|
init_constants();
|
|
1518
|
-
createApprovalSchema =
|
|
1519
|
-
type:
|
|
1520
|
-
requestedByAgentId:
|
|
1521
|
-
payload:
|
|
1522
|
-
issueIds:
|
|
1624
|
+
createApprovalSchema = z17.object({
|
|
1625
|
+
type: z17.enum(APPROVAL_TYPES),
|
|
1626
|
+
requestedByAgentId: z17.string().uuid().optional().nullable(),
|
|
1627
|
+
payload: z17.record(z17.unknown()),
|
|
1628
|
+
issueIds: z17.array(z17.string().uuid()).optional()
|
|
1523
1629
|
});
|
|
1524
|
-
resolveApprovalSchema =
|
|
1525
|
-
decisionNote:
|
|
1526
|
-
decidedByUserId:
|
|
1630
|
+
resolveApprovalSchema = z17.object({
|
|
1631
|
+
decisionNote: z17.string().optional().nullable(),
|
|
1632
|
+
decidedByUserId: z17.string().optional().default("board")
|
|
1527
1633
|
});
|
|
1528
|
-
requestApprovalRevisionSchema =
|
|
1529
|
-
decisionNote:
|
|
1530
|
-
decidedByUserId:
|
|
1634
|
+
requestApprovalRevisionSchema = z17.object({
|
|
1635
|
+
decisionNote: z17.string().optional().nullable(),
|
|
1636
|
+
decidedByUserId: z17.string().optional().default("board")
|
|
1531
1637
|
});
|
|
1532
|
-
resubmitApprovalSchema =
|
|
1533
|
-
payload:
|
|
1638
|
+
resubmitApprovalSchema = z17.object({
|
|
1639
|
+
payload: z17.record(z17.unknown()).optional()
|
|
1534
1640
|
});
|
|
1535
|
-
addApprovalCommentSchema =
|
|
1536
|
-
body:
|
|
1641
|
+
addApprovalCommentSchema = z17.object({
|
|
1642
|
+
body: z17.string().min(1)
|
|
1537
1643
|
});
|
|
1538
1644
|
}
|
|
1539
1645
|
});
|
|
1540
1646
|
|
|
1541
1647
|
// ../packages/shared/src/validators/automation.ts
|
|
1542
|
-
import { z as
|
|
1648
|
+
import { z as z18 } from "zod";
|
|
1543
1649
|
var createAutomationSchema, updateAutomationSchema, baseTriggerSchema, createAutomationTriggerSchema, updateAutomationTriggerSchema, runAutomationSchema, rotateAutomationTriggerSecretSchema;
|
|
1544
1650
|
var init_automation = __esm({
|
|
1545
1651
|
"../packages/shared/src/validators/automation.ts"() {
|
|
1546
1652
|
"use strict";
|
|
1547
1653
|
init_constants();
|
|
1548
|
-
createAutomationSchema =
|
|
1549
|
-
projectId:
|
|
1550
|
-
goalId:
|
|
1551
|
-
parentIssueId:
|
|
1552
|
-
title:
|
|
1553
|
-
description:
|
|
1554
|
-
assigneeAgentId:
|
|
1555
|
-
priority:
|
|
1556
|
-
status:
|
|
1557
|
-
concurrencyPolicy:
|
|
1558
|
-
catchUpPolicy:
|
|
1654
|
+
createAutomationSchema = z18.object({
|
|
1655
|
+
projectId: z18.string().uuid(),
|
|
1656
|
+
goalId: z18.string().uuid().optional().nullable(),
|
|
1657
|
+
parentIssueId: z18.string().uuid().optional().nullable(),
|
|
1658
|
+
title: z18.string().trim().min(1).max(200),
|
|
1659
|
+
description: z18.string().optional().nullable(),
|
|
1660
|
+
assigneeAgentId: z18.string().uuid(),
|
|
1661
|
+
priority: z18.enum(ISSUE_PRIORITIES).optional().default("medium"),
|
|
1662
|
+
status: z18.enum(AUTOMATION_STATUSES).optional().default("active"),
|
|
1663
|
+
concurrencyPolicy: z18.enum(AUTOMATION_CONCURRENCY_POLICIES).optional().default("coalesce_if_active"),
|
|
1664
|
+
catchUpPolicy: z18.enum(AUTOMATION_CATCH_UP_POLICIES).optional().default("skip_missed")
|
|
1559
1665
|
});
|
|
1560
1666
|
updateAutomationSchema = createAutomationSchema.partial();
|
|
1561
|
-
baseTriggerSchema =
|
|
1562
|
-
label:
|
|
1563
|
-
enabled:
|
|
1667
|
+
baseTriggerSchema = z18.object({
|
|
1668
|
+
label: z18.string().trim().max(120).optional().nullable(),
|
|
1669
|
+
enabled: z18.boolean().optional().default(true)
|
|
1564
1670
|
});
|
|
1565
|
-
createAutomationTriggerSchema =
|
|
1671
|
+
createAutomationTriggerSchema = z18.discriminatedUnion("kind", [
|
|
1566
1672
|
baseTriggerSchema.extend({
|
|
1567
|
-
kind:
|
|
1568
|
-
cronExpression:
|
|
1569
|
-
timezone:
|
|
1673
|
+
kind: z18.literal("schedule"),
|
|
1674
|
+
cronExpression: z18.string().trim().min(1),
|
|
1675
|
+
timezone: z18.string().trim().min(1).default("UTC")
|
|
1570
1676
|
}),
|
|
1571
1677
|
baseTriggerSchema.extend({
|
|
1572
|
-
kind:
|
|
1573
|
-
signingMode:
|
|
1574
|
-
replayWindowSec:
|
|
1678
|
+
kind: z18.literal("webhook"),
|
|
1679
|
+
signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().default("bearer"),
|
|
1680
|
+
replayWindowSec: z18.number().int().min(30).max(86400).optional().default(300)
|
|
1575
1681
|
}),
|
|
1576
1682
|
baseTriggerSchema.extend({
|
|
1577
|
-
kind:
|
|
1683
|
+
kind: z18.literal("api")
|
|
1578
1684
|
})
|
|
1579
1685
|
]);
|
|
1580
|
-
updateAutomationTriggerSchema =
|
|
1581
|
-
label:
|
|
1582
|
-
enabled:
|
|
1583
|
-
cronExpression:
|
|
1584
|
-
timezone:
|
|
1585
|
-
signingMode:
|
|
1586
|
-
replayWindowSec:
|
|
1686
|
+
updateAutomationTriggerSchema = z18.object({
|
|
1687
|
+
label: z18.string().trim().max(120).optional().nullable(),
|
|
1688
|
+
enabled: z18.boolean().optional(),
|
|
1689
|
+
cronExpression: z18.string().trim().min(1).optional().nullable(),
|
|
1690
|
+
timezone: z18.string().trim().min(1).optional().nullable(),
|
|
1691
|
+
signingMode: z18.enum(AUTOMATION_TRIGGER_SIGNING_MODES).optional().nullable(),
|
|
1692
|
+
replayWindowSec: z18.number().int().min(30).max(86400).optional().nullable()
|
|
1587
1693
|
});
|
|
1588
|
-
runAutomationSchema =
|
|
1589
|
-
triggerId:
|
|
1590
|
-
payload:
|
|
1591
|
-
idempotencyKey:
|
|
1592
|
-
source:
|
|
1694
|
+
runAutomationSchema = z18.object({
|
|
1695
|
+
triggerId: z18.string().uuid().optional().nullable(),
|
|
1696
|
+
payload: z18.record(z18.unknown()).optional().nullable(),
|
|
1697
|
+
idempotencyKey: z18.string().trim().max(255).optional().nullable(),
|
|
1698
|
+
source: z18.enum(["manual", "api"]).optional().default("manual")
|
|
1593
1699
|
});
|
|
1594
|
-
rotateAutomationTriggerSecretSchema =
|
|
1700
|
+
rotateAutomationTriggerSecretSchema = z18.object({});
|
|
1595
1701
|
}
|
|
1596
1702
|
});
|
|
1597
1703
|
|
|
1598
1704
|
// ../packages/shared/src/validators/cost.ts
|
|
1599
|
-
import { z as
|
|
1705
|
+
import { z as z19 } from "zod";
|
|
1600
1706
|
var createCostEventSchema, updateBudgetSchema;
|
|
1601
1707
|
var init_cost = __esm({
|
|
1602
1708
|
"../packages/shared/src/validators/cost.ts"() {
|
|
1603
1709
|
"use strict";
|
|
1604
1710
|
init_constants();
|
|
1605
|
-
createCostEventSchema =
|
|
1606
|
-
agentId:
|
|
1607
|
-
issueId:
|
|
1608
|
-
projectId:
|
|
1609
|
-
goalId:
|
|
1610
|
-
heartbeatRunId:
|
|
1611
|
-
billingCode:
|
|
1612
|
-
provider:
|
|
1613
|
-
biller:
|
|
1614
|
-
billingType:
|
|
1615
|
-
model:
|
|
1616
|
-
inputTokens:
|
|
1617
|
-
cachedInputTokens:
|
|
1618
|
-
outputTokens:
|
|
1619
|
-
costCents:
|
|
1620
|
-
occurredAt:
|
|
1711
|
+
createCostEventSchema = z19.object({
|
|
1712
|
+
agentId: z19.string().uuid(),
|
|
1713
|
+
issueId: z19.string().uuid().optional().nullable(),
|
|
1714
|
+
projectId: z19.string().uuid().optional().nullable(),
|
|
1715
|
+
goalId: z19.string().uuid().optional().nullable(),
|
|
1716
|
+
heartbeatRunId: z19.string().uuid().optional().nullable(),
|
|
1717
|
+
billingCode: z19.string().optional().nullable(),
|
|
1718
|
+
provider: z19.string().min(1),
|
|
1719
|
+
biller: z19.string().min(1).optional(),
|
|
1720
|
+
billingType: z19.enum(BILLING_TYPES).optional().default("unknown"),
|
|
1721
|
+
model: z19.string().min(1),
|
|
1722
|
+
inputTokens: z19.number().int().nonnegative().optional().default(0),
|
|
1723
|
+
cachedInputTokens: z19.number().int().nonnegative().optional().default(0),
|
|
1724
|
+
outputTokens: z19.number().int().nonnegative().optional().default(0),
|
|
1725
|
+
costCents: z19.number().int().nonnegative(),
|
|
1726
|
+
occurredAt: z19.string().datetime()
|
|
1621
1727
|
}).transform((value) => ({
|
|
1622
1728
|
...value,
|
|
1623
1729
|
biller: value.biller ?? value.provider
|
|
1624
1730
|
}));
|
|
1625
|
-
updateBudgetSchema =
|
|
1626
|
-
budgetMonthlyCents:
|
|
1731
|
+
updateBudgetSchema = z19.object({
|
|
1732
|
+
budgetMonthlyCents: z19.number().int().nonnegative()
|
|
1627
1733
|
});
|
|
1628
1734
|
}
|
|
1629
1735
|
});
|
|
1630
1736
|
|
|
1631
1737
|
// ../packages/shared/src/validators/finance.ts
|
|
1632
|
-
import { z as
|
|
1738
|
+
import { z as z20 } from "zod";
|
|
1633
1739
|
var createFinanceEventSchema;
|
|
1634
1740
|
var init_finance = __esm({
|
|
1635
1741
|
"../packages/shared/src/validators/finance.ts"() {
|
|
1636
1742
|
"use strict";
|
|
1637
1743
|
init_constants();
|
|
1638
|
-
createFinanceEventSchema =
|
|
1639
|
-
agentId:
|
|
1640
|
-
issueId:
|
|
1641
|
-
projectId:
|
|
1642
|
-
goalId:
|
|
1643
|
-
heartbeatRunId:
|
|
1644
|
-
costEventId:
|
|
1645
|
-
billingCode:
|
|
1646
|
-
description:
|
|
1647
|
-
eventKind:
|
|
1648
|
-
direction:
|
|
1649
|
-
biller:
|
|
1650
|
-
provider:
|
|
1651
|
-
executionAgentRuntimeType:
|
|
1652
|
-
pricingTier:
|
|
1653
|
-
region:
|
|
1654
|
-
model:
|
|
1655
|
-
quantity:
|
|
1656
|
-
unit:
|
|
1657
|
-
amountCents:
|
|
1658
|
-
currency:
|
|
1659
|
-
estimated:
|
|
1660
|
-
externalInvoiceId:
|
|
1661
|
-
metadataJson:
|
|
1662
|
-
occurredAt:
|
|
1744
|
+
createFinanceEventSchema = z20.object({
|
|
1745
|
+
agentId: z20.string().uuid().optional().nullable(),
|
|
1746
|
+
issueId: z20.string().uuid().optional().nullable(),
|
|
1747
|
+
projectId: z20.string().uuid().optional().nullable(),
|
|
1748
|
+
goalId: z20.string().uuid().optional().nullable(),
|
|
1749
|
+
heartbeatRunId: z20.string().uuid().optional().nullable(),
|
|
1750
|
+
costEventId: z20.string().uuid().optional().nullable(),
|
|
1751
|
+
billingCode: z20.string().optional().nullable(),
|
|
1752
|
+
description: z20.string().max(500).optional().nullable(),
|
|
1753
|
+
eventKind: z20.enum(FINANCE_EVENT_KINDS),
|
|
1754
|
+
direction: z20.enum(FINANCE_DIRECTIONS).optional().default("debit"),
|
|
1755
|
+
biller: z20.string().min(1),
|
|
1756
|
+
provider: z20.string().min(1).optional().nullable(),
|
|
1757
|
+
executionAgentRuntimeType: z20.enum(AGENT_RUNTIME_TYPES).optional().nullable(),
|
|
1758
|
+
pricingTier: z20.string().min(1).optional().nullable(),
|
|
1759
|
+
region: z20.string().min(1).optional().nullable(),
|
|
1760
|
+
model: z20.string().min(1).optional().nullable(),
|
|
1761
|
+
quantity: z20.number().int().nonnegative().optional().nullable(),
|
|
1762
|
+
unit: z20.enum(FINANCE_UNITS).optional().nullable(),
|
|
1763
|
+
amountCents: z20.number().int().nonnegative(),
|
|
1764
|
+
currency: z20.string().length(3).optional().default("USD"),
|
|
1765
|
+
estimated: z20.boolean().optional().default(false),
|
|
1766
|
+
externalInvoiceId: z20.string().optional().nullable(),
|
|
1767
|
+
metadataJson: z20.record(z20.string(), z20.unknown()).optional().nullable(),
|
|
1768
|
+
occurredAt: z20.string().datetime()
|
|
1663
1769
|
}).transform((value) => ({
|
|
1664
1770
|
...value,
|
|
1665
1771
|
currency: value.currency.toUpperCase()
|
|
@@ -1668,81 +1774,81 @@ var init_finance = __esm({
|
|
|
1668
1774
|
});
|
|
1669
1775
|
|
|
1670
1776
|
// ../packages/shared/src/validators/asset.ts
|
|
1671
|
-
import { z as
|
|
1777
|
+
import { z as z21 } from "zod";
|
|
1672
1778
|
var createAssetImageMetadataSchema;
|
|
1673
1779
|
var init_asset = __esm({
|
|
1674
1780
|
"../packages/shared/src/validators/asset.ts"() {
|
|
1675
1781
|
"use strict";
|
|
1676
|
-
createAssetImageMetadataSchema =
|
|
1677
|
-
namespace:
|
|
1782
|
+
createAssetImageMetadataSchema = z21.object({
|
|
1783
|
+
namespace: z21.string().trim().min(1).max(120).regex(/^[a-zA-Z0-9/_-]+$/).optional()
|
|
1678
1784
|
});
|
|
1679
1785
|
}
|
|
1680
1786
|
});
|
|
1681
1787
|
|
|
1682
1788
|
// ../packages/shared/src/validators/access.ts
|
|
1683
|
-
import { z as
|
|
1789
|
+
import { z as z22 } from "zod";
|
|
1684
1790
|
var createCompanyInviteSchema, createOpenClawInvitePromptSchema, acceptInviteSchema, listJoinRequestsQuerySchema, claimJoinRequestApiKeySchema, boardCliAuthAccessLevelSchema, createCliAuthChallengeSchema, resolveCliAuthChallengeSchema, updateMemberPermissionsSchema, updateUserCompanyAccessSchema;
|
|
1685
1791
|
var init_access = __esm({
|
|
1686
1792
|
"../packages/shared/src/validators/access.ts"() {
|
|
1687
1793
|
"use strict";
|
|
1688
1794
|
init_constants();
|
|
1689
|
-
createCompanyInviteSchema =
|
|
1690
|
-
allowedJoinTypes:
|
|
1691
|
-
defaultsPayload:
|
|
1692
|
-
agentMessage:
|
|
1795
|
+
createCompanyInviteSchema = z22.object({
|
|
1796
|
+
allowedJoinTypes: z22.enum(INVITE_JOIN_TYPES).default("both"),
|
|
1797
|
+
defaultsPayload: z22.record(z22.string(), z22.unknown()).optional().nullable(),
|
|
1798
|
+
agentMessage: z22.string().max(4e3).optional().nullable()
|
|
1693
1799
|
});
|
|
1694
|
-
createOpenClawInvitePromptSchema =
|
|
1695
|
-
agentMessage:
|
|
1800
|
+
createOpenClawInvitePromptSchema = z22.object({
|
|
1801
|
+
agentMessage: z22.string().max(4e3).optional().nullable()
|
|
1696
1802
|
});
|
|
1697
|
-
acceptInviteSchema =
|
|
1698
|
-
requestType:
|
|
1699
|
-
agentName:
|
|
1700
|
-
agentRuntimeType:
|
|
1701
|
-
capabilities:
|
|
1702
|
-
agentDefaultsPayload:
|
|
1803
|
+
acceptInviteSchema = z22.object({
|
|
1804
|
+
requestType: z22.enum(JOIN_REQUEST_TYPES),
|
|
1805
|
+
agentName: z22.string().min(1).max(120).optional(),
|
|
1806
|
+
agentRuntimeType: z22.enum(AGENT_RUNTIME_TYPES).optional(),
|
|
1807
|
+
capabilities: z22.string().max(4e3).optional().nullable(),
|
|
1808
|
+
agentDefaultsPayload: z22.record(z22.string(), z22.unknown()).optional().nullable(),
|
|
1703
1809
|
// OpenClaw join compatibility fields accepted at top level.
|
|
1704
|
-
responsesWebhookUrl:
|
|
1705
|
-
responsesWebhookMethod:
|
|
1706
|
-
responsesWebhookHeaders:
|
|
1707
|
-
rudderApiUrl:
|
|
1708
|
-
webhookAuthHeader:
|
|
1810
|
+
responsesWebhookUrl: z22.string().max(4e3).optional().nullable(),
|
|
1811
|
+
responsesWebhookMethod: z22.string().max(32).optional().nullable(),
|
|
1812
|
+
responsesWebhookHeaders: z22.record(z22.string(), z22.unknown()).optional().nullable(),
|
|
1813
|
+
rudderApiUrl: z22.string().max(4e3).optional().nullable(),
|
|
1814
|
+
webhookAuthHeader: z22.string().max(4e3).optional().nullable()
|
|
1709
1815
|
});
|
|
1710
|
-
listJoinRequestsQuerySchema =
|
|
1711
|
-
status:
|
|
1712
|
-
requestType:
|
|
1816
|
+
listJoinRequestsQuerySchema = z22.object({
|
|
1817
|
+
status: z22.enum(JOIN_REQUEST_STATUSES).optional(),
|
|
1818
|
+
requestType: z22.enum(JOIN_REQUEST_TYPES).optional()
|
|
1713
1819
|
});
|
|
1714
|
-
claimJoinRequestApiKeySchema =
|
|
1715
|
-
claimSecret:
|
|
1820
|
+
claimJoinRequestApiKeySchema = z22.object({
|
|
1821
|
+
claimSecret: z22.string().min(16).max(256)
|
|
1716
1822
|
});
|
|
1717
|
-
boardCliAuthAccessLevelSchema =
|
|
1823
|
+
boardCliAuthAccessLevelSchema = z22.enum([
|
|
1718
1824
|
"board",
|
|
1719
1825
|
"instance_admin_required"
|
|
1720
1826
|
]);
|
|
1721
|
-
createCliAuthChallengeSchema =
|
|
1722
|
-
command:
|
|
1723
|
-
clientName:
|
|
1827
|
+
createCliAuthChallengeSchema = z22.object({
|
|
1828
|
+
command: z22.string().min(1).max(240),
|
|
1829
|
+
clientName: z22.string().max(120).optional().nullable(),
|
|
1724
1830
|
requestedAccess: boardCliAuthAccessLevelSchema.default("board"),
|
|
1725
|
-
requestedCompanyId:
|
|
1831
|
+
requestedCompanyId: z22.string().uuid().optional().nullable()
|
|
1726
1832
|
});
|
|
1727
|
-
resolveCliAuthChallengeSchema =
|
|
1728
|
-
token:
|
|
1833
|
+
resolveCliAuthChallengeSchema = z22.object({
|
|
1834
|
+
token: z22.string().min(16).max(256)
|
|
1729
1835
|
});
|
|
1730
|
-
updateMemberPermissionsSchema =
|
|
1731
|
-
grants:
|
|
1732
|
-
|
|
1733
|
-
permissionKey:
|
|
1734
|
-
scope:
|
|
1836
|
+
updateMemberPermissionsSchema = z22.object({
|
|
1837
|
+
grants: z22.array(
|
|
1838
|
+
z22.object({
|
|
1839
|
+
permissionKey: z22.enum(PERMISSION_KEYS),
|
|
1840
|
+
scope: z22.record(z22.string(), z22.unknown()).optional().nullable()
|
|
1735
1841
|
})
|
|
1736
1842
|
)
|
|
1737
1843
|
});
|
|
1738
|
-
updateUserCompanyAccessSchema =
|
|
1739
|
-
orgIds:
|
|
1844
|
+
updateUserCompanyAccessSchema = z22.object({
|
|
1845
|
+
orgIds: z22.array(z22.string().uuid()).default([])
|
|
1740
1846
|
});
|
|
1741
1847
|
}
|
|
1742
1848
|
});
|
|
1743
1849
|
|
|
1744
1850
|
// ../packages/shared/src/validators/plugin.ts
|
|
1745
|
-
import { z as
|
|
1851
|
+
import { z as z23 } from "zod";
|
|
1746
1852
|
function isValidCronExpression(expression) {
|
|
1747
1853
|
const trimmed = expression.trim();
|
|
1748
1854
|
if (!trimmed) return false;
|
|
@@ -1755,7 +1861,7 @@ var init_plugin = __esm({
|
|
|
1755
1861
|
"../packages/shared/src/validators/plugin.ts"() {
|
|
1756
1862
|
"use strict";
|
|
1757
1863
|
init_constants();
|
|
1758
|
-
jsonSchemaSchema =
|
|
1864
|
+
jsonSchemaSchema = z23.record(z23.unknown()).refine(
|
|
1759
1865
|
(val) => {
|
|
1760
1866
|
if (Object.keys(val).length === 0) return true;
|
|
1761
1867
|
return typeof val.type === "string" || val.$ref !== void 0 || val.oneOf !== void 0 || val.anyOf !== void 0 || val.allOf !== void 0;
|
|
@@ -1763,76 +1869,76 @@ var init_plugin = __esm({
|
|
|
1763
1869
|
{ message: "Must be a valid JSON Schema object (requires at least a 'type', '$ref', or composition keyword)" }
|
|
1764
1870
|
);
|
|
1765
1871
|
CRON_FIELD_PATTERN = /^(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?)(?:,(\*(?:\/[0-9]+)?|[0-9]+(?:-[0-9]+)?(?:\/[0-9]+)?))*$/;
|
|
1766
|
-
pluginJobDeclarationSchema =
|
|
1767
|
-
jobKey:
|
|
1768
|
-
displayName:
|
|
1769
|
-
description:
|
|
1770
|
-
schedule:
|
|
1872
|
+
pluginJobDeclarationSchema = z23.object({
|
|
1873
|
+
jobKey: z23.string().min(1),
|
|
1874
|
+
displayName: z23.string().min(1),
|
|
1875
|
+
description: z23.string().optional(),
|
|
1876
|
+
schedule: z23.string().refine(
|
|
1771
1877
|
(val) => isValidCronExpression(val),
|
|
1772
1878
|
{ message: "schedule must be a valid 5-field cron expression (e.g. '*/15 * * * *')" }
|
|
1773
1879
|
).optional()
|
|
1774
1880
|
});
|
|
1775
|
-
pluginWebhookDeclarationSchema =
|
|
1776
|
-
endpointKey:
|
|
1777
|
-
displayName:
|
|
1778
|
-
description:
|
|
1881
|
+
pluginWebhookDeclarationSchema = z23.object({
|
|
1882
|
+
endpointKey: z23.string().min(1),
|
|
1883
|
+
displayName: z23.string().min(1),
|
|
1884
|
+
description: z23.string().optional()
|
|
1779
1885
|
});
|
|
1780
|
-
pluginToolDeclarationSchema =
|
|
1781
|
-
name:
|
|
1782
|
-
displayName:
|
|
1783
|
-
description:
|
|
1886
|
+
pluginToolDeclarationSchema = z23.object({
|
|
1887
|
+
name: z23.string().min(1),
|
|
1888
|
+
displayName: z23.string().min(1),
|
|
1889
|
+
description: z23.string().min(1),
|
|
1784
1890
|
parametersSchema: jsonSchemaSchema
|
|
1785
1891
|
});
|
|
1786
|
-
pluginUiSlotDeclarationSchema =
|
|
1787
|
-
type:
|
|
1788
|
-
id:
|
|
1789
|
-
displayName:
|
|
1790
|
-
exportName:
|
|
1791
|
-
entityTypes:
|
|
1792
|
-
routePath:
|
|
1892
|
+
pluginUiSlotDeclarationSchema = z23.object({
|
|
1893
|
+
type: z23.enum(PLUGIN_UI_SLOT_TYPES),
|
|
1894
|
+
id: z23.string().min(1),
|
|
1895
|
+
displayName: z23.string().min(1),
|
|
1896
|
+
exportName: z23.string().min(1),
|
|
1897
|
+
entityTypes: z23.array(z23.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
|
|
1898
|
+
routePath: z23.string().regex(/^[a-z0-9][a-z0-9-]*$/, {
|
|
1793
1899
|
message: "routePath must be a lowercase single-segment slug (letters, numbers, hyphens)"
|
|
1794
1900
|
}).optional(),
|
|
1795
|
-
order:
|
|
1901
|
+
order: z23.number().int().optional()
|
|
1796
1902
|
}).superRefine((value, ctx) => {
|
|
1797
1903
|
const entityScopedTypes = ["detailTab", "taskDetailView", "contextMenuItem", "commentAnnotation", "commentContextMenuItem", "projectSidebarItem"];
|
|
1798
1904
|
if (entityScopedTypes.includes(value.type) && (!value.entityTypes || value.entityTypes.length === 0)) {
|
|
1799
1905
|
ctx.addIssue({
|
|
1800
|
-
code:
|
|
1906
|
+
code: z23.ZodIssueCode.custom,
|
|
1801
1907
|
message: `${value.type} slots require at least one entityType`,
|
|
1802
1908
|
path: ["entityTypes"]
|
|
1803
1909
|
});
|
|
1804
1910
|
}
|
|
1805
1911
|
if (value.type === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
|
|
1806
1912
|
ctx.addIssue({
|
|
1807
|
-
code:
|
|
1913
|
+
code: z23.ZodIssueCode.custom,
|
|
1808
1914
|
message: 'projectSidebarItem slots require entityTypes to include "project"',
|
|
1809
1915
|
path: ["entityTypes"]
|
|
1810
1916
|
});
|
|
1811
1917
|
}
|
|
1812
1918
|
if (value.type === "commentAnnotation" && value.entityTypes && !value.entityTypes.includes("comment")) {
|
|
1813
1919
|
ctx.addIssue({
|
|
1814
|
-
code:
|
|
1920
|
+
code: z23.ZodIssueCode.custom,
|
|
1815
1921
|
message: 'commentAnnotation slots require entityTypes to include "comment"',
|
|
1816
1922
|
path: ["entityTypes"]
|
|
1817
1923
|
});
|
|
1818
1924
|
}
|
|
1819
1925
|
if (value.type === "commentContextMenuItem" && value.entityTypes && !value.entityTypes.includes("comment")) {
|
|
1820
1926
|
ctx.addIssue({
|
|
1821
|
-
code:
|
|
1927
|
+
code: z23.ZodIssueCode.custom,
|
|
1822
1928
|
message: 'commentContextMenuItem slots require entityTypes to include "comment"',
|
|
1823
1929
|
path: ["entityTypes"]
|
|
1824
1930
|
});
|
|
1825
1931
|
}
|
|
1826
1932
|
if (value.routePath && value.type !== "page") {
|
|
1827
1933
|
ctx.addIssue({
|
|
1828
|
-
code:
|
|
1934
|
+
code: z23.ZodIssueCode.custom,
|
|
1829
1935
|
message: "routePath is only supported for page slots",
|
|
1830
1936
|
path: ["routePath"]
|
|
1831
1937
|
});
|
|
1832
1938
|
}
|
|
1833
1939
|
if (value.routePath && PLUGIN_RESERVED_COMPANY_ROUTE_SEGMENTS.includes(value.routePath)) {
|
|
1834
1940
|
ctx.addIssue({
|
|
1835
|
-
code:
|
|
1941
|
+
code: z23.ZodIssueCode.custom,
|
|
1836
1942
|
message: `routePath "${value.routePath}" is reserved by the host`,
|
|
1837
1943
|
path: ["routePath"]
|
|
1838
1944
|
});
|
|
@@ -1853,29 +1959,29 @@ var init_plugin = __esm({
|
|
|
1853
1959
|
external: [],
|
|
1854
1960
|
iframe: ["compact", "default", "wide", "full"]
|
|
1855
1961
|
};
|
|
1856
|
-
pluginLauncherActionDeclarationSchema =
|
|
1857
|
-
type:
|
|
1858
|
-
target:
|
|
1859
|
-
params:
|
|
1962
|
+
pluginLauncherActionDeclarationSchema = z23.object({
|
|
1963
|
+
type: z23.enum(PLUGIN_LAUNCHER_ACTIONS),
|
|
1964
|
+
target: z23.string().min(1),
|
|
1965
|
+
params: z23.record(z23.unknown()).optional()
|
|
1860
1966
|
}).superRefine((value, ctx) => {
|
|
1861
1967
|
if (value.type === "performAction" && value.target.includes("/")) {
|
|
1862
1968
|
ctx.addIssue({
|
|
1863
|
-
code:
|
|
1969
|
+
code: z23.ZodIssueCode.custom,
|
|
1864
1970
|
message: "performAction launchers must target an action key, not a route or URL",
|
|
1865
1971
|
path: ["target"]
|
|
1866
1972
|
});
|
|
1867
1973
|
}
|
|
1868
1974
|
if (value.type === "navigate" && /^https?:\/\//.test(value.target)) {
|
|
1869
1975
|
ctx.addIssue({
|
|
1870
|
-
code:
|
|
1976
|
+
code: z23.ZodIssueCode.custom,
|
|
1871
1977
|
message: "navigate launchers must target a host route, not an absolute URL",
|
|
1872
1978
|
path: ["target"]
|
|
1873
1979
|
});
|
|
1874
1980
|
}
|
|
1875
1981
|
});
|
|
1876
|
-
pluginLauncherRenderDeclarationSchema =
|
|
1877
|
-
environment:
|
|
1878
|
-
bounds:
|
|
1982
|
+
pluginLauncherRenderDeclarationSchema = z23.object({
|
|
1983
|
+
environment: z23.enum(PLUGIN_LAUNCHER_RENDER_ENVIRONMENTS),
|
|
1984
|
+
bounds: z23.enum(PLUGIN_LAUNCHER_BOUNDS).optional()
|
|
1879
1985
|
}).superRefine((value, ctx) => {
|
|
1880
1986
|
if (!value.bounds) {
|
|
1881
1987
|
return;
|
|
@@ -1883,122 +1989,122 @@ var init_plugin = __esm({
|
|
|
1883
1989
|
const supportedBounds = launcherBoundsByEnvironment[value.environment];
|
|
1884
1990
|
if (!supportedBounds.includes(value.bounds)) {
|
|
1885
1991
|
ctx.addIssue({
|
|
1886
|
-
code:
|
|
1992
|
+
code: z23.ZodIssueCode.custom,
|
|
1887
1993
|
message: `bounds "${value.bounds}" is not supported for render environment "${value.environment}"`,
|
|
1888
1994
|
path: ["bounds"]
|
|
1889
1995
|
});
|
|
1890
1996
|
}
|
|
1891
1997
|
});
|
|
1892
|
-
pluginLauncherDeclarationSchema =
|
|
1893
|
-
id:
|
|
1894
|
-
displayName:
|
|
1895
|
-
description:
|
|
1896
|
-
placementZone:
|
|
1897
|
-
exportName:
|
|
1898
|
-
entityTypes:
|
|
1899
|
-
order:
|
|
1998
|
+
pluginLauncherDeclarationSchema = z23.object({
|
|
1999
|
+
id: z23.string().min(1),
|
|
2000
|
+
displayName: z23.string().min(1),
|
|
2001
|
+
description: z23.string().optional(),
|
|
2002
|
+
placementZone: z23.enum(PLUGIN_LAUNCHER_PLACEMENT_ZONES),
|
|
2003
|
+
exportName: z23.string().min(1).optional(),
|
|
2004
|
+
entityTypes: z23.array(z23.enum(PLUGIN_UI_SLOT_ENTITY_TYPES)).optional(),
|
|
2005
|
+
order: z23.number().int().optional(),
|
|
1900
2006
|
action: pluginLauncherActionDeclarationSchema,
|
|
1901
2007
|
render: pluginLauncherRenderDeclarationSchema.optional()
|
|
1902
2008
|
}).superRefine((value, ctx) => {
|
|
1903
2009
|
if (entityScopedLauncherPlacementZones.some((zone) => zone === value.placementZone) && (!value.entityTypes || value.entityTypes.length === 0)) {
|
|
1904
2010
|
ctx.addIssue({
|
|
1905
|
-
code:
|
|
2011
|
+
code: z23.ZodIssueCode.custom,
|
|
1906
2012
|
message: `${value.placementZone} launchers require at least one entityType`,
|
|
1907
2013
|
path: ["entityTypes"]
|
|
1908
2014
|
});
|
|
1909
2015
|
}
|
|
1910
2016
|
if (value.placementZone === "projectSidebarItem" && value.entityTypes && !value.entityTypes.includes("project")) {
|
|
1911
2017
|
ctx.addIssue({
|
|
1912
|
-
code:
|
|
2018
|
+
code: z23.ZodIssueCode.custom,
|
|
1913
2019
|
message: 'projectSidebarItem launchers require entityTypes to include "project"',
|
|
1914
2020
|
path: ["entityTypes"]
|
|
1915
2021
|
});
|
|
1916
2022
|
}
|
|
1917
2023
|
if (value.action.type === "performAction" && value.render) {
|
|
1918
2024
|
ctx.addIssue({
|
|
1919
|
-
code:
|
|
2025
|
+
code: z23.ZodIssueCode.custom,
|
|
1920
2026
|
message: "performAction launchers cannot declare render hints",
|
|
1921
2027
|
path: ["render"]
|
|
1922
2028
|
});
|
|
1923
2029
|
}
|
|
1924
2030
|
if (["openModal", "openDrawer", "openPopover"].includes(value.action.type) && !value.render) {
|
|
1925
2031
|
ctx.addIssue({
|
|
1926
|
-
code:
|
|
2032
|
+
code: z23.ZodIssueCode.custom,
|
|
1927
2033
|
message: `${value.action.type} launchers require render metadata`,
|
|
1928
2034
|
path: ["render"]
|
|
1929
2035
|
});
|
|
1930
2036
|
}
|
|
1931
2037
|
if (value.action.type === "openModal" && value.render?.environment === "hostInline") {
|
|
1932
2038
|
ctx.addIssue({
|
|
1933
|
-
code:
|
|
2039
|
+
code: z23.ZodIssueCode.custom,
|
|
1934
2040
|
message: "openModal launchers cannot use the hostInline render environment",
|
|
1935
2041
|
path: ["render", "environment"]
|
|
1936
2042
|
});
|
|
1937
2043
|
}
|
|
1938
2044
|
if (value.action.type === "openDrawer" && value.render && !["hostOverlay", "iframe"].includes(value.render.environment)) {
|
|
1939
2045
|
ctx.addIssue({
|
|
1940
|
-
code:
|
|
2046
|
+
code: z23.ZodIssueCode.custom,
|
|
1941
2047
|
message: "openDrawer launchers must use hostOverlay or iframe render environments",
|
|
1942
2048
|
path: ["render", "environment"]
|
|
1943
2049
|
});
|
|
1944
2050
|
}
|
|
1945
2051
|
if (value.action.type === "openPopover" && value.render?.environment === "hostRoute") {
|
|
1946
2052
|
ctx.addIssue({
|
|
1947
|
-
code:
|
|
2053
|
+
code: z23.ZodIssueCode.custom,
|
|
1948
2054
|
message: "openPopover launchers cannot use the hostRoute render environment",
|
|
1949
2055
|
path: ["render", "environment"]
|
|
1950
2056
|
});
|
|
1951
2057
|
}
|
|
1952
2058
|
});
|
|
1953
|
-
pluginManifestV1Schema =
|
|
1954
|
-
id:
|
|
2059
|
+
pluginManifestV1Schema = z23.object({
|
|
2060
|
+
id: z23.string().min(1).regex(
|
|
1955
2061
|
/^[a-z0-9][a-z0-9._-]*$/,
|
|
1956
2062
|
"Plugin id must start with a lowercase alphanumeric and contain only lowercase letters, digits, dots, hyphens, or underscores"
|
|
1957
2063
|
),
|
|
1958
|
-
apiVersion:
|
|
1959
|
-
version:
|
|
2064
|
+
apiVersion: z23.literal(1),
|
|
2065
|
+
version: z23.string().min(1).regex(
|
|
1960
2066
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
1961
2067
|
"Version must follow semver (e.g. 1.0.0 or 1.0.0-beta.1)"
|
|
1962
2068
|
),
|
|
1963
|
-
displayName:
|
|
1964
|
-
description:
|
|
1965
|
-
author:
|
|
1966
|
-
categories:
|
|
1967
|
-
minimumHostVersion:
|
|
2069
|
+
displayName: z23.string().min(1).max(100),
|
|
2070
|
+
description: z23.string().min(1).max(500),
|
|
2071
|
+
author: z23.string().min(1).max(200),
|
|
2072
|
+
categories: z23.array(z23.enum(PLUGIN_CATEGORIES)).min(1),
|
|
2073
|
+
minimumHostVersion: z23.string().regex(
|
|
1968
2074
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
1969
2075
|
"minimumHostVersion must follow semver (e.g. 1.0.0)"
|
|
1970
2076
|
).optional(),
|
|
1971
|
-
minimumPaperclipVersion:
|
|
2077
|
+
minimumPaperclipVersion: z23.string().regex(
|
|
1972
2078
|
/^\d+\.\d+\.\d+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/,
|
|
1973
2079
|
"minimumPaperclipVersion must follow semver (e.g. 1.0.0)"
|
|
1974
2080
|
).optional(),
|
|
1975
|
-
capabilities:
|
|
1976
|
-
entrypoints:
|
|
1977
|
-
worker:
|
|
1978
|
-
ui:
|
|
2081
|
+
capabilities: z23.array(z23.enum(PLUGIN_CAPABILITIES)).min(1),
|
|
2082
|
+
entrypoints: z23.object({
|
|
2083
|
+
worker: z23.string().min(1),
|
|
2084
|
+
ui: z23.string().min(1).optional()
|
|
1979
2085
|
}),
|
|
1980
2086
|
instanceConfigSchema: jsonSchemaSchema.optional(),
|
|
1981
|
-
jobs:
|
|
1982
|
-
webhooks:
|
|
1983
|
-
tools:
|
|
1984
|
-
launchers:
|
|
1985
|
-
ui:
|
|
1986
|
-
slots:
|
|
1987
|
-
launchers:
|
|
2087
|
+
jobs: z23.array(pluginJobDeclarationSchema).optional(),
|
|
2088
|
+
webhooks: z23.array(pluginWebhookDeclarationSchema).optional(),
|
|
2089
|
+
tools: z23.array(pluginToolDeclarationSchema).optional(),
|
|
2090
|
+
launchers: z23.array(pluginLauncherDeclarationSchema).optional(),
|
|
2091
|
+
ui: z23.object({
|
|
2092
|
+
slots: z23.array(pluginUiSlotDeclarationSchema).min(1).optional(),
|
|
2093
|
+
launchers: z23.array(pluginLauncherDeclarationSchema).optional()
|
|
1988
2094
|
}).optional()
|
|
1989
2095
|
}).superRefine((manifest, ctx) => {
|
|
1990
2096
|
const hasUiSlots = (manifest.ui?.slots?.length ?? 0) > 0;
|
|
1991
2097
|
const hasUiLaunchers = (manifest.ui?.launchers?.length ?? 0) > 0;
|
|
1992
2098
|
if ((hasUiSlots || hasUiLaunchers) && !manifest.entrypoints.ui) {
|
|
1993
2099
|
ctx.addIssue({
|
|
1994
|
-
code:
|
|
2100
|
+
code: z23.ZodIssueCode.custom,
|
|
1995
2101
|
message: "entrypoints.ui is required when ui.slots or ui.launchers are declared",
|
|
1996
2102
|
path: ["entrypoints", "ui"]
|
|
1997
2103
|
});
|
|
1998
2104
|
}
|
|
1999
2105
|
if (manifest.minimumHostVersion && manifest.minimumPaperclipVersion && manifest.minimumHostVersion !== manifest.minimumPaperclipVersion) {
|
|
2000
2106
|
ctx.addIssue({
|
|
2001
|
-
code:
|
|
2107
|
+
code: z23.ZodIssueCode.custom,
|
|
2002
2108
|
message: "minimumHostVersion and minimumPaperclipVersion must match when both are declared",
|
|
2003
2109
|
path: ["minimumHostVersion"]
|
|
2004
2110
|
});
|
|
@@ -2006,7 +2112,7 @@ var init_plugin = __esm({
|
|
|
2006
2112
|
if (manifest.tools && manifest.tools.length > 0) {
|
|
2007
2113
|
if (!manifest.capabilities.includes("agent.tools.register")) {
|
|
2008
2114
|
ctx.addIssue({
|
|
2009
|
-
code:
|
|
2115
|
+
code: z23.ZodIssueCode.custom,
|
|
2010
2116
|
message: "Capability 'agent.tools.register' is required when tools are declared",
|
|
2011
2117
|
path: ["capabilities"]
|
|
2012
2118
|
});
|
|
@@ -2015,7 +2121,7 @@ var init_plugin = __esm({
|
|
|
2015
2121
|
if (manifest.jobs && manifest.jobs.length > 0) {
|
|
2016
2122
|
if (!manifest.capabilities.includes("jobs.schedule")) {
|
|
2017
2123
|
ctx.addIssue({
|
|
2018
|
-
code:
|
|
2124
|
+
code: z23.ZodIssueCode.custom,
|
|
2019
2125
|
message: "Capability 'jobs.schedule' is required when jobs are declared",
|
|
2020
2126
|
path: ["capabilities"]
|
|
2021
2127
|
});
|
|
@@ -2024,7 +2130,7 @@ var init_plugin = __esm({
|
|
|
2024
2130
|
if (manifest.webhooks && manifest.webhooks.length > 0) {
|
|
2025
2131
|
if (!manifest.capabilities.includes("webhooks.receive")) {
|
|
2026
2132
|
ctx.addIssue({
|
|
2027
|
-
code:
|
|
2133
|
+
code: z23.ZodIssueCode.custom,
|
|
2028
2134
|
message: "Capability 'webhooks.receive' is required when webhooks are declared",
|
|
2029
2135
|
path: ["capabilities"]
|
|
2030
2136
|
});
|
|
@@ -2035,7 +2141,7 @@ var init_plugin = __esm({
|
|
|
2035
2141
|
const duplicates = jobKeys.filter((key, i) => jobKeys.indexOf(key) !== i);
|
|
2036
2142
|
if (duplicates.length > 0) {
|
|
2037
2143
|
ctx.addIssue({
|
|
2038
|
-
code:
|
|
2144
|
+
code: z23.ZodIssueCode.custom,
|
|
2039
2145
|
message: `Duplicate job keys: ${[...new Set(duplicates)].join(", ")}`,
|
|
2040
2146
|
path: ["jobs"]
|
|
2041
2147
|
});
|
|
@@ -2046,7 +2152,7 @@ var init_plugin = __esm({
|
|
|
2046
2152
|
const duplicates = endpointKeys.filter((key, i) => endpointKeys.indexOf(key) !== i);
|
|
2047
2153
|
if (duplicates.length > 0) {
|
|
2048
2154
|
ctx.addIssue({
|
|
2049
|
-
code:
|
|
2155
|
+
code: z23.ZodIssueCode.custom,
|
|
2050
2156
|
message: `Duplicate webhook endpoint keys: ${[...new Set(duplicates)].join(", ")}`,
|
|
2051
2157
|
path: ["webhooks"]
|
|
2052
2158
|
});
|
|
@@ -2057,7 +2163,7 @@ var init_plugin = __esm({
|
|
|
2057
2163
|
const duplicates = toolNames.filter((name, i) => toolNames.indexOf(name) !== i);
|
|
2058
2164
|
if (duplicates.length > 0) {
|
|
2059
2165
|
ctx.addIssue({
|
|
2060
|
-
code:
|
|
2166
|
+
code: z23.ZodIssueCode.custom,
|
|
2061
2167
|
message: `Duplicate tool names: ${[...new Set(duplicates)].join(", ")}`,
|
|
2062
2168
|
path: ["tools"]
|
|
2063
2169
|
});
|
|
@@ -2069,7 +2175,7 @@ var init_plugin = __esm({
|
|
|
2069
2175
|
const duplicates = slotIds.filter((id, i) => slotIds.indexOf(id) !== i);
|
|
2070
2176
|
if (duplicates.length > 0) {
|
|
2071
2177
|
ctx.addIssue({
|
|
2072
|
-
code:
|
|
2178
|
+
code: z23.ZodIssueCode.custom,
|
|
2073
2179
|
message: `Duplicate UI slot ids: ${[...new Set(duplicates)].join(", ")}`,
|
|
2074
2180
|
path: ["ui", "slots"]
|
|
2075
2181
|
});
|
|
@@ -2085,50 +2191,50 @@ var init_plugin = __esm({
|
|
|
2085
2191
|
const duplicates = launcherIds.filter((id, i) => launcherIds.indexOf(id) !== i);
|
|
2086
2192
|
if (duplicates.length > 0) {
|
|
2087
2193
|
ctx.addIssue({
|
|
2088
|
-
code:
|
|
2194
|
+
code: z23.ZodIssueCode.custom,
|
|
2089
2195
|
message: `Duplicate launcher ids: ${[...new Set(duplicates)].join(", ")}`,
|
|
2090
2196
|
path: manifest.ui?.launchers ? ["ui", "launchers"] : ["launchers"]
|
|
2091
2197
|
});
|
|
2092
2198
|
}
|
|
2093
2199
|
}
|
|
2094
2200
|
});
|
|
2095
|
-
installPluginSchema =
|
|
2096
|
-
packageName:
|
|
2097
|
-
version:
|
|
2201
|
+
installPluginSchema = z23.object({
|
|
2202
|
+
packageName: z23.string().min(1),
|
|
2203
|
+
version: z23.string().min(1).optional(),
|
|
2098
2204
|
/** Set by loader for local-path installs so the worker can be resolved. */
|
|
2099
|
-
packagePath:
|
|
2205
|
+
packagePath: z23.string().min(1).optional()
|
|
2100
2206
|
});
|
|
2101
|
-
upsertPluginConfigSchema =
|
|
2102
|
-
configJson:
|
|
2207
|
+
upsertPluginConfigSchema = z23.object({
|
|
2208
|
+
configJson: z23.record(z23.unknown())
|
|
2103
2209
|
});
|
|
2104
|
-
patchPluginConfigSchema =
|
|
2105
|
-
configJson:
|
|
2210
|
+
patchPluginConfigSchema = z23.object({
|
|
2211
|
+
configJson: z23.record(z23.unknown())
|
|
2106
2212
|
});
|
|
2107
|
-
updatePluginStatusSchema =
|
|
2108
|
-
status:
|
|
2109
|
-
lastError:
|
|
2213
|
+
updatePluginStatusSchema = z23.object({
|
|
2214
|
+
status: z23.enum(PLUGIN_STATUSES),
|
|
2215
|
+
lastError: z23.string().nullable().optional()
|
|
2110
2216
|
});
|
|
2111
|
-
uninstallPluginSchema =
|
|
2112
|
-
removeData:
|
|
2217
|
+
uninstallPluginSchema = z23.object({
|
|
2218
|
+
removeData: z23.boolean().optional().default(false)
|
|
2113
2219
|
});
|
|
2114
|
-
pluginStateScopeKeySchema =
|
|
2115
|
-
scopeKind:
|
|
2116
|
-
scopeId:
|
|
2117
|
-
namespace:
|
|
2118
|
-
stateKey:
|
|
2220
|
+
pluginStateScopeKeySchema = z23.object({
|
|
2221
|
+
scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS),
|
|
2222
|
+
scopeId: z23.string().min(1).optional(),
|
|
2223
|
+
namespace: z23.string().min(1).optional(),
|
|
2224
|
+
stateKey: z23.string().min(1)
|
|
2119
2225
|
});
|
|
2120
|
-
setPluginStateSchema =
|
|
2121
|
-
scopeKind:
|
|
2122
|
-
scopeId:
|
|
2123
|
-
namespace:
|
|
2124
|
-
stateKey:
|
|
2226
|
+
setPluginStateSchema = z23.object({
|
|
2227
|
+
scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS),
|
|
2228
|
+
scopeId: z23.string().min(1).optional(),
|
|
2229
|
+
namespace: z23.string().min(1).optional(),
|
|
2230
|
+
stateKey: z23.string().min(1),
|
|
2125
2231
|
/** JSON-serializable value to store. */
|
|
2126
|
-
value:
|
|
2232
|
+
value: z23.unknown()
|
|
2127
2233
|
});
|
|
2128
|
-
listPluginStateSchema =
|
|
2129
|
-
scopeKind:
|
|
2130
|
-
scopeId:
|
|
2131
|
-
namespace:
|
|
2234
|
+
listPluginStateSchema = z23.object({
|
|
2235
|
+
scopeKind: z23.enum(PLUGIN_STATE_SCOPE_KINDS).optional(),
|
|
2236
|
+
scopeId: z23.string().min(1).optional(),
|
|
2237
|
+
namespace: z23.string().min(1).optional()
|
|
2132
2238
|
});
|
|
2133
2239
|
}
|
|
2134
2240
|
});
|
|
@@ -2232,39 +2338,42 @@ var init_organization_skill_reference = __esm({
|
|
|
2232
2338
|
});
|
|
2233
2339
|
|
|
2234
2340
|
// ../packages/shared/src/project-mentions.ts
|
|
2341
|
+
var PROJECT_COLOR_VALUES;
|
|
2235
2342
|
var init_project_mentions = __esm({
|
|
2236
2343
|
"../packages/shared/src/project-mentions.ts"() {
|
|
2237
2344
|
"use strict";
|
|
2345
|
+
init_constants();
|
|
2346
|
+
PROJECT_COLOR_VALUES = new Set(PROJECT_COLORS);
|
|
2238
2347
|
}
|
|
2239
2348
|
});
|
|
2240
2349
|
|
|
2241
2350
|
// ../packages/shared/src/config-schema.ts
|
|
2242
|
-
import { z as
|
|
2351
|
+
import { z as z24 } from "zod";
|
|
2243
2352
|
var configMetaSchema, llmConfigSchema, databaseBackupConfigSchema, databaseConfigSchema, loggingConfigSchema, serverConfigSchema, authConfigSchema, storageLocalDiskConfigSchema, storageS3ConfigSchema, storageConfigSchema, secretsLocalEncryptedConfigSchema, secretsConfigSchema, langfuseConfigSchema, rudderConfigSchema;
|
|
2244
2353
|
var init_config_schema = __esm({
|
|
2245
2354
|
"../packages/shared/src/config-schema.ts"() {
|
|
2246
2355
|
"use strict";
|
|
2247
2356
|
init_constants();
|
|
2248
|
-
configMetaSchema =
|
|
2249
|
-
version:
|
|
2250
|
-
updatedAt:
|
|
2251
|
-
source:
|
|
2357
|
+
configMetaSchema = z24.object({
|
|
2358
|
+
version: z24.literal(1),
|
|
2359
|
+
updatedAt: z24.string(),
|
|
2360
|
+
source: z24.enum(["onboard", "configure", "doctor"])
|
|
2252
2361
|
});
|
|
2253
|
-
llmConfigSchema =
|
|
2254
|
-
provider:
|
|
2255
|
-
apiKey:
|
|
2362
|
+
llmConfigSchema = z24.object({
|
|
2363
|
+
provider: z24.enum(["claude", "openai"]),
|
|
2364
|
+
apiKey: z24.string().optional()
|
|
2256
2365
|
});
|
|
2257
|
-
databaseBackupConfigSchema =
|
|
2258
|
-
enabled:
|
|
2259
|
-
intervalMinutes:
|
|
2260
|
-
retentionDays:
|
|
2261
|
-
dir:
|
|
2366
|
+
databaseBackupConfigSchema = z24.object({
|
|
2367
|
+
enabled: z24.boolean().default(true),
|
|
2368
|
+
intervalMinutes: z24.number().int().min(1).max(7 * 24 * 60).default(60),
|
|
2369
|
+
retentionDays: z24.number().int().min(1).max(3650).default(30),
|
|
2370
|
+
dir: z24.string().default("~/.rudder/instances/default/data/backups")
|
|
2262
2371
|
});
|
|
2263
|
-
databaseConfigSchema =
|
|
2264
|
-
mode:
|
|
2265
|
-
connectionString:
|
|
2266
|
-
embeddedPostgresDataDir:
|
|
2267
|
-
embeddedPostgresPort:
|
|
2372
|
+
databaseConfigSchema = z24.object({
|
|
2373
|
+
mode: z24.enum(["embedded-postgres", "postgres"]).default("embedded-postgres"),
|
|
2374
|
+
connectionString: z24.string().optional(),
|
|
2375
|
+
embeddedPostgresDataDir: z24.string().default("~/.rudder/instances/default/db"),
|
|
2376
|
+
embeddedPostgresPort: z24.number().int().min(1).max(65535).default(54329),
|
|
2268
2377
|
backup: databaseBackupConfigSchema.default({
|
|
2269
2378
|
enabled: true,
|
|
2270
2379
|
intervalMinutes: 60,
|
|
@@ -2272,35 +2381,35 @@ var init_config_schema = __esm({
|
|
|
2272
2381
|
dir: "~/.rudder/instances/default/data/backups"
|
|
2273
2382
|
})
|
|
2274
2383
|
});
|
|
2275
|
-
loggingConfigSchema =
|
|
2276
|
-
mode:
|
|
2277
|
-
logDir:
|
|
2384
|
+
loggingConfigSchema = z24.object({
|
|
2385
|
+
mode: z24.enum(["file", "cloud"]),
|
|
2386
|
+
logDir: z24.string().default("~/.rudder/instances/default/logs")
|
|
2278
2387
|
});
|
|
2279
|
-
serverConfigSchema =
|
|
2280
|
-
deploymentMode:
|
|
2281
|
-
exposure:
|
|
2282
|
-
host:
|
|
2283
|
-
port:
|
|
2284
|
-
allowedHostnames:
|
|
2285
|
-
serveUi:
|
|
2388
|
+
serverConfigSchema = z24.object({
|
|
2389
|
+
deploymentMode: z24.enum(DEPLOYMENT_MODES).default("local_trusted"),
|
|
2390
|
+
exposure: z24.enum(DEPLOYMENT_EXPOSURES).default("private"),
|
|
2391
|
+
host: z24.string().default("127.0.0.1"),
|
|
2392
|
+
port: z24.number().int().min(1).max(65535).default(3100),
|
|
2393
|
+
allowedHostnames: z24.array(z24.string().min(1)).default([]),
|
|
2394
|
+
serveUi: z24.boolean().default(true)
|
|
2286
2395
|
});
|
|
2287
|
-
authConfigSchema =
|
|
2288
|
-
baseUrlMode:
|
|
2289
|
-
publicBaseUrl:
|
|
2290
|
-
disableSignUp:
|
|
2396
|
+
authConfigSchema = z24.object({
|
|
2397
|
+
baseUrlMode: z24.enum(AUTH_BASE_URL_MODES).default("auto"),
|
|
2398
|
+
publicBaseUrl: z24.string().url().optional(),
|
|
2399
|
+
disableSignUp: z24.boolean().default(false)
|
|
2291
2400
|
});
|
|
2292
|
-
storageLocalDiskConfigSchema =
|
|
2293
|
-
baseDir:
|
|
2401
|
+
storageLocalDiskConfigSchema = z24.object({
|
|
2402
|
+
baseDir: z24.string().default("~/.rudder/instances/default/data/storage")
|
|
2294
2403
|
});
|
|
2295
|
-
storageS3ConfigSchema =
|
|
2296
|
-
bucket:
|
|
2297
|
-
region:
|
|
2298
|
-
endpoint:
|
|
2299
|
-
prefix:
|
|
2300
|
-
forcePathStyle:
|
|
2404
|
+
storageS3ConfigSchema = z24.object({
|
|
2405
|
+
bucket: z24.string().min(1).default("rudder"),
|
|
2406
|
+
region: z24.string().min(1).default("us-east-1"),
|
|
2407
|
+
endpoint: z24.string().optional(),
|
|
2408
|
+
prefix: z24.string().default(""),
|
|
2409
|
+
forcePathStyle: z24.boolean().default(false)
|
|
2301
2410
|
});
|
|
2302
|
-
storageConfigSchema =
|
|
2303
|
-
provider:
|
|
2411
|
+
storageConfigSchema = z24.object({
|
|
2412
|
+
provider: z24.enum(STORAGE_PROVIDERS).default("local_disk"),
|
|
2304
2413
|
localDisk: storageLocalDiskConfigSchema.default({
|
|
2305
2414
|
baseDir: "~/.rudder/instances/default/data/storage"
|
|
2306
2415
|
}),
|
|
@@ -2311,24 +2420,24 @@ var init_config_schema = __esm({
|
|
|
2311
2420
|
forcePathStyle: false
|
|
2312
2421
|
})
|
|
2313
2422
|
});
|
|
2314
|
-
secretsLocalEncryptedConfigSchema =
|
|
2315
|
-
keyFilePath:
|
|
2423
|
+
secretsLocalEncryptedConfigSchema = z24.object({
|
|
2424
|
+
keyFilePath: z24.string().default("~/.rudder/instances/default/secrets/master.key")
|
|
2316
2425
|
});
|
|
2317
|
-
secretsConfigSchema =
|
|
2318
|
-
provider:
|
|
2319
|
-
strictMode:
|
|
2426
|
+
secretsConfigSchema = z24.object({
|
|
2427
|
+
provider: z24.enum(SECRET_PROVIDERS).default("local_encrypted"),
|
|
2428
|
+
strictMode: z24.boolean().default(false),
|
|
2320
2429
|
localEncrypted: secretsLocalEncryptedConfigSchema.default({
|
|
2321
2430
|
keyFilePath: "~/.rudder/instances/default/secrets/master.key"
|
|
2322
2431
|
})
|
|
2323
2432
|
});
|
|
2324
|
-
langfuseConfigSchema =
|
|
2325
|
-
enabled:
|
|
2326
|
-
baseUrl:
|
|
2327
|
-
publicKey:
|
|
2328
|
-
secretKey:
|
|
2329
|
-
environment:
|
|
2433
|
+
langfuseConfigSchema = z24.object({
|
|
2434
|
+
enabled: z24.boolean().default(false),
|
|
2435
|
+
baseUrl: z24.string().url().default("http://localhost:3000"),
|
|
2436
|
+
publicKey: z24.string().optional(),
|
|
2437
|
+
secretKey: z24.string().optional(),
|
|
2438
|
+
environment: z24.string().optional()
|
|
2330
2439
|
});
|
|
2331
|
-
rudderConfigSchema =
|
|
2440
|
+
rudderConfigSchema = z24.object({
|
|
2332
2441
|
$meta: configMetaSchema,
|
|
2333
2442
|
llm: llmConfigSchema.optional(),
|
|
2334
2443
|
database: databaseConfigSchema,
|
|
@@ -2362,7 +2471,7 @@ var init_config_schema = __esm({
|
|
|
2362
2471
|
if (value.server.deploymentMode === "local_trusted") {
|
|
2363
2472
|
if (value.server.exposure !== "private") {
|
|
2364
2473
|
ctx.addIssue({
|
|
2365
|
-
code:
|
|
2474
|
+
code: z24.ZodIssueCode.custom,
|
|
2366
2475
|
message: "server.exposure must be private when deploymentMode is local_trusted",
|
|
2367
2476
|
path: ["server", "exposure"]
|
|
2368
2477
|
});
|
|
@@ -2371,21 +2480,21 @@ var init_config_schema = __esm({
|
|
|
2371
2480
|
}
|
|
2372
2481
|
if (value.auth.baseUrlMode === "explicit" && !value.auth.publicBaseUrl) {
|
|
2373
2482
|
ctx.addIssue({
|
|
2374
|
-
code:
|
|
2483
|
+
code: z24.ZodIssueCode.custom,
|
|
2375
2484
|
message: "auth.publicBaseUrl is required when auth.baseUrlMode is explicit",
|
|
2376
2485
|
path: ["auth", "publicBaseUrl"]
|
|
2377
2486
|
});
|
|
2378
2487
|
}
|
|
2379
2488
|
if (value.server.exposure === "public" && value.auth.baseUrlMode !== "explicit") {
|
|
2380
2489
|
ctx.addIssue({
|
|
2381
|
-
code:
|
|
2490
|
+
code: z24.ZodIssueCode.custom,
|
|
2382
2491
|
message: "auth.baseUrlMode must be explicit when deploymentMode=authenticated and exposure=public",
|
|
2383
2492
|
path: ["auth", "baseUrlMode"]
|
|
2384
2493
|
});
|
|
2385
2494
|
}
|
|
2386
2495
|
if (value.server.exposure === "public" && !value.auth.publicBaseUrl) {
|
|
2387
2496
|
ctx.addIssue({
|
|
2388
|
-
code:
|
|
2497
|
+
code: z24.ZodIssueCode.custom,
|
|
2389
2498
|
message: "auth.publicBaseUrl is required when deploymentMode=authenticated and exposure=public",
|
|
2390
2499
|
path: ["auth", "publicBaseUrl"]
|
|
2391
2500
|
});
|
|
@@ -9920,16 +10029,51 @@ ${err instanceof Error ? err.message : String(err)}`
|
|
|
9920
10029
|
init_install();
|
|
9921
10030
|
import { spawn, spawnSync as spawnSync2 } from "node:child_process";
|
|
9922
10031
|
import { createHash as createHash3 } from "node:crypto";
|
|
9923
|
-
import { constants as fsConstants, createWriteStream,
|
|
10032
|
+
import { constants as fsConstants, createWriteStream, mkdirSync as mkdirSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
9924
10033
|
import { access, chmod, copyFile, cp, mkdtemp, mkdir, readFile as readFile3, readdir as readdir2, rm, writeFile as writeFile2 } from "node:fs/promises";
|
|
9925
10034
|
import { homedir, tmpdir } from "node:os";
|
|
9926
|
-
import
|
|
10035
|
+
import path10 from "node:path";
|
|
9927
10036
|
import { Readable } from "node:stream";
|
|
9928
10037
|
import { pipeline } from "node:stream/promises";
|
|
9929
10038
|
import { setTimeout as delay } from "node:timers/promises";
|
|
9930
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
9931
10039
|
import * as p13 from "@clack/prompts";
|
|
9932
10040
|
import pc8 from "picocolors";
|
|
10041
|
+
|
|
10042
|
+
// src/version.ts
|
|
10043
|
+
import { existsSync as existsSync2, readFileSync } from "node:fs";
|
|
10044
|
+
import path9 from "node:path";
|
|
10045
|
+
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
10046
|
+
var CLI_PACKAGE_NAME = "@rudderhq/cli";
|
|
10047
|
+
var CLI_VERSION_MANIFEST = "rudder-cli-package.json";
|
|
10048
|
+
function readPackageVersion(packagePath, expectedName) {
|
|
10049
|
+
if (!existsSync2(packagePath)) return null;
|
|
10050
|
+
try {
|
|
10051
|
+
const parsed = JSON.parse(readFileSync(packagePath, "utf8"));
|
|
10052
|
+
if (parsed.name === expectedName && parsed.version) return parsed.version;
|
|
10053
|
+
} catch {
|
|
10054
|
+
return null;
|
|
10055
|
+
}
|
|
10056
|
+
return null;
|
|
10057
|
+
}
|
|
10058
|
+
function resolveCliVersion(moduleUrl = import.meta.url, env = process.env) {
|
|
10059
|
+
if (env.npm_package_name === CLI_PACKAGE_NAME && env.npm_package_version) {
|
|
10060
|
+
return env.npm_package_version;
|
|
10061
|
+
}
|
|
10062
|
+
const moduleDir = path9.dirname(fileURLToPath3(moduleUrl));
|
|
10063
|
+
const candidates = [
|
|
10064
|
+
path9.resolve(moduleDir, CLI_VERSION_MANIFEST),
|
|
10065
|
+
path9.resolve(moduleDir, "package.json"),
|
|
10066
|
+
path9.resolve(moduleDir, "../package.json"),
|
|
10067
|
+
path9.resolve(moduleDir, "../../package.json")
|
|
10068
|
+
];
|
|
10069
|
+
for (const candidate of candidates) {
|
|
10070
|
+
const version = readPackageVersion(candidate, CLI_PACKAGE_NAME);
|
|
10071
|
+
if (version) return version;
|
|
10072
|
+
}
|
|
10073
|
+
return "0.0.0";
|
|
10074
|
+
}
|
|
10075
|
+
|
|
10076
|
+
// src/commands/start.ts
|
|
9933
10077
|
var DEFAULT_DESKTOP_RELEASE_REPO = "Undertone0809/rudder";
|
|
9934
10078
|
var DESKTOP_UPDATE_QUIT_ARG = "--rudder-update-quit";
|
|
9935
10079
|
var STABLE_SEMVER_RE = /^[0-9]+\.[0-9]+\.[0-9]+$/;
|
|
@@ -9939,23 +10083,8 @@ var DESKTOP_APP_NAME = "Rudder";
|
|
|
9939
10083
|
var DESKTOP_METADATA_FILE = ".rudder-desktop-install.json";
|
|
9940
10084
|
var DESKTOP_CHECKSUM_ASSET_NAME = "SHASUMS256.txt";
|
|
9941
10085
|
function resolveCurrentCliVersion(env = process.env) {
|
|
9942
|
-
const
|
|
9943
|
-
|
|
9944
|
-
if (envPackageName === CLI_NPM_PACKAGE_NAME && envPackageVersion) return envPackageVersion;
|
|
9945
|
-
const moduleDir = path9.dirname(fileURLToPath3(import.meta.url));
|
|
9946
|
-
const candidates = [
|
|
9947
|
-
path9.resolve(moduleDir, "../package.json"),
|
|
9948
|
-
path9.resolve(moduleDir, "../../package.json")
|
|
9949
|
-
];
|
|
9950
|
-
for (const candidate of candidates) {
|
|
9951
|
-
if (!existsSync2(candidate)) continue;
|
|
9952
|
-
try {
|
|
9953
|
-
const parsed = JSON.parse(readFileSync(candidate, "utf8"));
|
|
9954
|
-
if (parsed.name === CLI_NPM_PACKAGE_NAME && parsed.version) return parsed.version;
|
|
9955
|
-
} catch {
|
|
9956
|
-
}
|
|
9957
|
-
}
|
|
9958
|
-
return "latest";
|
|
10086
|
+
const version = resolveCliVersion(import.meta.url, env);
|
|
10087
|
+
return version === "0.0.0" ? "latest" : version;
|
|
9959
10088
|
}
|
|
9960
10089
|
function resolveCliInstallSpec(version, env = process.env) {
|
|
9961
10090
|
if (version && version !== "latest") return `${CLI_NPM_PACKAGE_NAME}@${version}`;
|
|
@@ -10023,38 +10152,38 @@ function resolveDesktopAssetTarget(platform = process.platform, arch = process.a
|
|
|
10023
10152
|
throw new Error(`Rudder Desktop does not publish portable assets for ${platform}.`);
|
|
10024
10153
|
}
|
|
10025
10154
|
function resolveDefaultDesktopInstallRoot(target, env = process.env, homeDir = homedir()) {
|
|
10026
|
-
if (target.platform === "macos") return
|
|
10155
|
+
if (target.platform === "macos") return path10.join(homeDir, "Applications");
|
|
10027
10156
|
if (target.platform === "windows") {
|
|
10028
|
-
const localAppData = env.LOCALAPPDATA?.trim() ||
|
|
10029
|
-
return
|
|
10157
|
+
const localAppData = env.LOCALAPPDATA?.trim() || path10.join(homeDir, "AppData", "Local");
|
|
10158
|
+
return path10.join(localAppData, "Programs", DESKTOP_APP_NAME);
|
|
10030
10159
|
}
|
|
10031
|
-
return
|
|
10160
|
+
return path10.join(homeDir, ".local", "share", "rudder");
|
|
10032
10161
|
}
|
|
10033
10162
|
function resolveDesktopInstallPaths(target, installRoot) {
|
|
10034
|
-
const root =
|
|
10163
|
+
const root = path10.resolve(installRoot);
|
|
10035
10164
|
if (target.platform === "macos") {
|
|
10036
|
-
const appPath2 =
|
|
10165
|
+
const appPath2 = path10.join(root, `${DESKTOP_APP_NAME}.app`);
|
|
10037
10166
|
return {
|
|
10038
10167
|
installRoot: root,
|
|
10039
10168
|
appPath: appPath2,
|
|
10040
|
-
executablePath:
|
|
10041
|
-
metadataPath:
|
|
10169
|
+
executablePath: path10.join(appPath2, "Contents", "MacOS", DESKTOP_APP_NAME),
|
|
10170
|
+
metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
|
|
10042
10171
|
};
|
|
10043
10172
|
}
|
|
10044
10173
|
if (target.platform === "windows") {
|
|
10045
10174
|
return {
|
|
10046
10175
|
installRoot: root,
|
|
10047
10176
|
appPath: root,
|
|
10048
|
-
executablePath:
|
|
10049
|
-
metadataPath:
|
|
10177
|
+
executablePath: path10.join(root, `${DESKTOP_APP_NAME}.exe`),
|
|
10178
|
+
metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
|
|
10050
10179
|
};
|
|
10051
10180
|
}
|
|
10052
|
-
const appPath =
|
|
10181
|
+
const appPath = path10.join(root, `${DESKTOP_APP_NAME}.AppImage`);
|
|
10053
10182
|
return {
|
|
10054
10183
|
installRoot: root,
|
|
10055
10184
|
appPath,
|
|
10056
10185
|
executablePath: appPath,
|
|
10057
|
-
metadataPath:
|
|
10186
|
+
metadataPath: path10.join(root, DESKTOP_METADATA_FILE)
|
|
10058
10187
|
};
|
|
10059
10188
|
}
|
|
10060
10189
|
function normalizeAssetName(name) {
|
|
@@ -10136,7 +10265,7 @@ function buildGithubReleaseAsset(repo, tag, assetName) {
|
|
|
10136
10265
|
}
|
|
10137
10266
|
async function downloadAsset(asset, outputDir) {
|
|
10138
10267
|
mkdirSync2(outputDir, { recursive: true });
|
|
10139
|
-
const outputPath =
|
|
10268
|
+
const outputPath = path10.join(outputDir, path10.basename(asset.name));
|
|
10140
10269
|
const response = await fetch(asset.browser_download_url, {
|
|
10141
10270
|
headers: { "User-Agent": "rudder-cli-installer" }
|
|
10142
10271
|
});
|
|
@@ -10148,7 +10277,7 @@ async function downloadAsset(asset, outputDir) {
|
|
|
10148
10277
|
}
|
|
10149
10278
|
function checksumForFile(filePath) {
|
|
10150
10279
|
const hash = createHash3("sha256");
|
|
10151
|
-
hash.update(
|
|
10280
|
+
hash.update(readFileSync2(filePath));
|
|
10152
10281
|
return hash.digest("hex");
|
|
10153
10282
|
}
|
|
10154
10283
|
function parseChecksumFile(contents) {
|
|
@@ -10161,16 +10290,16 @@ function parseChecksumFile(contents) {
|
|
|
10161
10290
|
return checksums;
|
|
10162
10291
|
}
|
|
10163
10292
|
function resolveAssetChecksum(checksums, assetName) {
|
|
10164
|
-
const expected = checksums.get(
|
|
10293
|
+
const expected = checksums.get(path10.basename(assetName));
|
|
10165
10294
|
if (!expected) {
|
|
10166
|
-
throw new Error(`Desktop release checksums do not include ${
|
|
10295
|
+
throw new Error(`Desktop release checksums do not include ${path10.basename(assetName)}.`);
|
|
10167
10296
|
}
|
|
10168
10297
|
return expected;
|
|
10169
10298
|
}
|
|
10170
10299
|
function assertChecksumMatch(filePath, expected) {
|
|
10171
10300
|
const actual = checksumForFile(filePath);
|
|
10172
10301
|
if (actual !== expected.toLowerCase()) {
|
|
10173
|
-
throw new Error(`Checksum mismatch for ${
|
|
10302
|
+
throw new Error(`Checksum mismatch for ${path10.basename(filePath)}.`);
|
|
10174
10303
|
}
|
|
10175
10304
|
return actual;
|
|
10176
10305
|
}
|
|
@@ -10179,7 +10308,7 @@ async function downloadChecksums(checksumAsset, outputDir) {
|
|
|
10179
10308
|
throw new Error("Desktop release is missing SHASUMS256.txt.");
|
|
10180
10309
|
}
|
|
10181
10310
|
const checksumPath = await downloadAsset(checksumAsset, outputDir);
|
|
10182
|
-
return parseChecksumFile(
|
|
10311
|
+
return parseChecksumFile(readFileSync2(checksumPath, "utf8"));
|
|
10183
10312
|
}
|
|
10184
10313
|
async function pathExists(targetPath) {
|
|
10185
10314
|
try {
|
|
@@ -10225,7 +10354,7 @@ async function findPath(root, predicate, maxDepth = 5) {
|
|
|
10225
10354
|
async function visit(dir, depth) {
|
|
10226
10355
|
const entries = await readdir2(dir, { withFileTypes: true });
|
|
10227
10356
|
for (const entry of entries) {
|
|
10228
|
-
const fullPath =
|
|
10357
|
+
const fullPath = path10.join(dir, entry.name);
|
|
10229
10358
|
if (predicate(fullPath, entry.isDirectory())) return fullPath;
|
|
10230
10359
|
if (entry.isDirectory() && depth < maxDepth) {
|
|
10231
10360
|
const nested = await visit(fullPath, depth + 1);
|
|
@@ -10237,18 +10366,18 @@ async function findPath(root, predicate, maxDepth = 5) {
|
|
|
10237
10366
|
return await visit(root, 0);
|
|
10238
10367
|
}
|
|
10239
10368
|
async function findMacApp(extractDir) {
|
|
10240
|
-
const direct =
|
|
10369
|
+
const direct = path10.join(extractDir, `${DESKTOP_APP_NAME}.app`);
|
|
10241
10370
|
if (await pathExists(direct)) return direct;
|
|
10242
|
-
const found = await findPath(extractDir, (filePath, isDirectory) => isDirectory &&
|
|
10371
|
+
const found = await findPath(extractDir, (filePath, isDirectory) => isDirectory && path10.basename(filePath) === `${DESKTOP_APP_NAME}.app`);
|
|
10243
10372
|
if (!found) throw new Error(`Portable macOS archive did not contain ${DESKTOP_APP_NAME}.app.`);
|
|
10244
10373
|
return found;
|
|
10245
10374
|
}
|
|
10246
10375
|
async function findWindowsAppDir(extractDir) {
|
|
10247
|
-
const direct =
|
|
10376
|
+
const direct = path10.join(extractDir, `${DESKTOP_APP_NAME}.exe`);
|
|
10248
10377
|
if (await pathExists(direct)) return extractDir;
|
|
10249
|
-
const executable = await findPath(extractDir, (filePath, isDirectory) => !isDirectory &&
|
|
10378
|
+
const executable = await findPath(extractDir, (filePath, isDirectory) => !isDirectory && path10.basename(filePath).toLowerCase() === `${DESKTOP_APP_NAME.toLowerCase()}.exe`);
|
|
10250
10379
|
if (!executable) throw new Error(`Portable Windows archive did not contain ${DESKTOP_APP_NAME}.exe.`);
|
|
10251
|
-
return
|
|
10380
|
+
return path10.dirname(executable);
|
|
10252
10381
|
}
|
|
10253
10382
|
async function readInstallMetadata(metadataPath) {
|
|
10254
10383
|
try {
|
|
@@ -10273,7 +10402,7 @@ function forceQuitDesktopProcesses(target) {
|
|
|
10273
10402
|
spawnSync2(command.command, command.args, { stdio: "ignore" });
|
|
10274
10403
|
}
|
|
10275
10404
|
function isRunningInsideDesktopExecutable() {
|
|
10276
|
-
return
|
|
10405
|
+
return path10.basename(process.execPath).toLowerCase().startsWith(DESKTOP_APP_NAME.toLowerCase());
|
|
10277
10406
|
}
|
|
10278
10407
|
async function waitForUpdateQuitResponse(responsePath, timeoutMs = 8e3) {
|
|
10279
10408
|
const startedAt = Date.now();
|
|
@@ -10287,7 +10416,7 @@ async function waitForUpdateQuitResponse(responsePath, timeoutMs = 8e3) {
|
|
|
10287
10416
|
}
|
|
10288
10417
|
async function requestDesktopQuit(executablePath, target) {
|
|
10289
10418
|
if (!await pathExists(executablePath)) return { ok: true, status: "not_running" };
|
|
10290
|
-
const responsePath =
|
|
10419
|
+
const responsePath = path10.join(tmpdir(), `rudder-update-quit-${process.pid}-${Date.now()}.json`);
|
|
10291
10420
|
const result = spawnSync2(executablePath, [`${DESKTOP_UPDATE_QUIT_ARG}=${responsePath}`], {
|
|
10292
10421
|
stdio: "ignore",
|
|
10293
10422
|
timeout: 5e3
|
|
@@ -10339,7 +10468,7 @@ async function installPortableDesktop(installerPath, paths, target) {
|
|
|
10339
10468
|
await chmod(paths.appPath, 493);
|
|
10340
10469
|
return;
|
|
10341
10470
|
}
|
|
10342
|
-
const extractDir = await mkdtemp(
|
|
10471
|
+
const extractDir = await mkdtemp(path10.join(tmpdir(), "rudder-desktop-extract."));
|
|
10343
10472
|
try {
|
|
10344
10473
|
await extractZip(installerPath, extractDir, target);
|
|
10345
10474
|
if (target.platform === "macos") {
|
|
@@ -10348,7 +10477,7 @@ async function installPortableDesktop(installerPath, paths, target) {
|
|
|
10348
10477
|
return;
|
|
10349
10478
|
}
|
|
10350
10479
|
const appSource = await findWindowsAppDir(extractDir);
|
|
10351
|
-
await mkdir(
|
|
10480
|
+
await mkdir(path10.dirname(paths.installRoot), { recursive: true });
|
|
10352
10481
|
await copyPortableAppBundle(appSource, paths.installRoot);
|
|
10353
10482
|
} finally {
|
|
10354
10483
|
await rm(extractDir, { recursive: true, force: true });
|
|
@@ -10379,12 +10508,12 @@ function buildLinuxDesktopEntry(executablePath) {
|
|
|
10379
10508
|
].join("\n");
|
|
10380
10509
|
}
|
|
10381
10510
|
async function writeLinuxLaunchers(paths) {
|
|
10382
|
-
const desktopDir =
|
|
10511
|
+
const desktopDir = path10.join(homedir(), ".local", "share", "applications");
|
|
10383
10512
|
await mkdir(desktopDir, { recursive: true });
|
|
10384
|
-
await writeFile2(
|
|
10385
|
-
const binDir =
|
|
10513
|
+
await writeFile2(path10.join(desktopDir, "rudder.desktop"), buildLinuxDesktopEntry(paths.executablePath), "utf8");
|
|
10514
|
+
const binDir = path10.join(homedir(), ".local", "bin");
|
|
10386
10515
|
await mkdir(binDir, { recursive: true });
|
|
10387
|
-
const wrapperPath =
|
|
10516
|
+
const wrapperPath = path10.join(binDir, "rudder-desktop");
|
|
10388
10517
|
const escaped = paths.executablePath.replaceAll("'", `'"'"'`);
|
|
10389
10518
|
await writeFile2(wrapperPath, `#!/bin/sh
|
|
10390
10519
|
exec '${escaped}' "$@"
|
|
@@ -10392,13 +10521,13 @@ exec '${escaped}' "$@"
|
|
|
10392
10521
|
await chmod(wrapperPath, 493);
|
|
10393
10522
|
}
|
|
10394
10523
|
function buildWindowsShortcutScript(executablePath) {
|
|
10395
|
-
const appData = process.env.APPDATA?.trim() ||
|
|
10396
|
-
const shortcutPath =
|
|
10524
|
+
const appData = process.env.APPDATA?.trim() || path10.join(homedir(), "AppData", "Roaming");
|
|
10525
|
+
const shortcutPath = path10.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Rudder.lnk");
|
|
10397
10526
|
return [
|
|
10398
10527
|
"$shell = New-Object -ComObject WScript.Shell",
|
|
10399
10528
|
`$shortcut = $shell.CreateShortcut(${powershellQuote(shortcutPath)})`,
|
|
10400
10529
|
`$shortcut.TargetPath = ${powershellQuote(executablePath)}`,
|
|
10401
|
-
`$shortcut.WorkingDirectory = ${powershellQuote(
|
|
10530
|
+
`$shortcut.WorkingDirectory = ${powershellQuote(path10.dirname(executablePath))}`,
|
|
10402
10531
|
"$shortcut.Save()"
|
|
10403
10532
|
].join("; ");
|
|
10404
10533
|
}
|
|
@@ -10430,7 +10559,7 @@ function launchDesktop(paths, target) {
|
|
|
10430
10559
|
spawn(paths.executablePath, [], { detached: true, stdio: "ignore" }).unref();
|
|
10431
10560
|
}
|
|
10432
10561
|
async function writeInstallMetadata(paths, releaseTag, assetName, assetChecksum) {
|
|
10433
|
-
mkdirSync2(
|
|
10562
|
+
mkdirSync2(path10.dirname(paths.metadataPath), { recursive: true });
|
|
10434
10563
|
const metadata = {
|
|
10435
10564
|
version: 1,
|
|
10436
10565
|
releaseTag,
|
|
@@ -10478,9 +10607,9 @@ async function startCommand(opts) {
|
|
|
10478
10607
|
if (installDesktop) {
|
|
10479
10608
|
const target = resolveDesktopAssetTarget();
|
|
10480
10609
|
const tag = resolveDesktopReleaseTag(version);
|
|
10481
|
-
const installRoot = opts.desktopInstallDir ?
|
|
10610
|
+
const installRoot = opts.desktopInstallDir ? path10.resolve(opts.desktopInstallDir) : resolveDefaultDesktopInstallRoot(target);
|
|
10482
10611
|
const installPaths = resolveDesktopInstallPaths(target, installRoot);
|
|
10483
|
-
const outputDir = opts.outputDir ?
|
|
10612
|
+
const outputDir = opts.outputDir ? path10.resolve(opts.outputDir) : await mkdtemp(path10.join(tmpdir(), "rudder-desktop-installer."));
|
|
10484
10613
|
p13.log.step("Installing desktop app");
|
|
10485
10614
|
p13.log.message(`Release: ${pc8.cyan(`${repo}@${tag}`)}`);
|
|
10486
10615
|
p13.log.message(`Target: ${pc8.cyan(`${target.platform}/${target.arch}`)}`);
|
|
@@ -10511,7 +10640,7 @@ async function startCommand(opts) {
|
|
|
10511
10640
|
} else {
|
|
10512
10641
|
const installerPath = await downloadAsset(asset, outputDir);
|
|
10513
10642
|
const checksum = assertChecksumMatch(installerPath, expectedChecksum);
|
|
10514
|
-
p13.log.success(`Downloaded and verified ${pc8.cyan(
|
|
10643
|
+
p13.log.success(`Downloaded and verified ${pc8.cyan(path10.basename(installerPath))}`);
|
|
10515
10644
|
p13.log.message("Replacing existing Rudder Desktop if needed.");
|
|
10516
10645
|
await prepareForDesktopReplace(installPaths, target);
|
|
10517
10646
|
await installPortableDesktop(installerPath, installPaths, target);
|
|
@@ -10740,8 +10869,8 @@ function printItemCompleted(item) {
|
|
|
10740
10869
|
const changes = Array.isArray(item.changes) ? item.changes : [];
|
|
10741
10870
|
const entries = changes.map((changeRaw) => asRecord(changeRaw)).filter((change) => Boolean(change)).map((change) => {
|
|
10742
10871
|
const kind = asString(change.kind, "update");
|
|
10743
|
-
const
|
|
10744
|
-
return `${kind} ${
|
|
10872
|
+
const path23 = asString(change.path, "unknown");
|
|
10873
|
+
return `${kind} ${path23}`;
|
|
10745
10874
|
});
|
|
10746
10875
|
const preview = entries.length > 0 ? entries.slice(0, 6).join(", ") : "none";
|
|
10747
10876
|
const more = entries.length > 6 ? ` (+${entries.length - 6} more)` : "";
|
|
@@ -11559,7 +11688,7 @@ import pc18 from "picocolors";
|
|
|
11559
11688
|
// src/client/board-auth.ts
|
|
11560
11689
|
import { spawn as spawn2 } from "node:child_process";
|
|
11561
11690
|
import fs10 from "node:fs";
|
|
11562
|
-
import
|
|
11691
|
+
import path11 from "node:path";
|
|
11563
11692
|
import pc17 from "picocolors";
|
|
11564
11693
|
|
|
11565
11694
|
// src/client/command-label.ts
|
|
@@ -11583,8 +11712,8 @@ function normalizeApiBase(apiBase) {
|
|
|
11583
11712
|
return apiBase.trim().replace(/\/+$/, "");
|
|
11584
11713
|
}
|
|
11585
11714
|
function resolveBoardAuthStorePath(overridePath) {
|
|
11586
|
-
if (overridePath?.trim()) return
|
|
11587
|
-
if (process.env.RUDDER_AUTH_STORE?.trim()) return
|
|
11715
|
+
if (overridePath?.trim()) return path11.resolve(overridePath.trim());
|
|
11716
|
+
if (process.env.RUDDER_AUTH_STORE?.trim()) return path11.resolve(process.env.RUDDER_AUTH_STORE.trim());
|
|
11588
11717
|
return resolveDefaultCliAuthPath();
|
|
11589
11718
|
}
|
|
11590
11719
|
function readBoardAuthStore(storePath) {
|
|
@@ -11616,7 +11745,7 @@ function readBoardAuthStore(storePath) {
|
|
|
11616
11745
|
}
|
|
11617
11746
|
function writeBoardAuthStore(store, storePath) {
|
|
11618
11747
|
const filePath = resolveBoardAuthStorePath(storePath);
|
|
11619
|
-
fs10.mkdirSync(
|
|
11748
|
+
fs10.mkdirSync(path11.dirname(filePath), { recursive: true });
|
|
11620
11749
|
fs10.writeFileSync(filePath, `${JSON.stringify(store, null, 2)}
|
|
11621
11750
|
`, { mode: 384 });
|
|
11622
11751
|
}
|
|
@@ -11767,26 +11896,26 @@ init_store();
|
|
|
11767
11896
|
// src/client/context.ts
|
|
11768
11897
|
init_home();
|
|
11769
11898
|
import fs11 from "node:fs";
|
|
11770
|
-
import
|
|
11899
|
+
import path12 from "node:path";
|
|
11771
11900
|
var DEFAULT_CONTEXT_BASENAME = "context.json";
|
|
11772
11901
|
var DEFAULT_PROFILE = "default";
|
|
11773
11902
|
function findContextFileFromAncestors(startDir) {
|
|
11774
|
-
const absoluteStartDir =
|
|
11903
|
+
const absoluteStartDir = path12.resolve(startDir);
|
|
11775
11904
|
let currentDir = absoluteStartDir;
|
|
11776
11905
|
while (true) {
|
|
11777
|
-
const candidate =
|
|
11906
|
+
const candidate = path12.resolve(currentDir, ".rudder", DEFAULT_CONTEXT_BASENAME);
|
|
11778
11907
|
if (fs11.existsSync(candidate)) {
|
|
11779
11908
|
return candidate;
|
|
11780
11909
|
}
|
|
11781
|
-
const nextDir =
|
|
11910
|
+
const nextDir = path12.resolve(currentDir, "..");
|
|
11782
11911
|
if (nextDir === currentDir) break;
|
|
11783
11912
|
currentDir = nextDir;
|
|
11784
11913
|
}
|
|
11785
11914
|
return null;
|
|
11786
11915
|
}
|
|
11787
11916
|
function resolveContextPath(overridePath) {
|
|
11788
|
-
if (overridePath) return
|
|
11789
|
-
if (process.env.RUDDER_CONTEXT) return
|
|
11917
|
+
if (overridePath) return path12.resolve(overridePath);
|
|
11918
|
+
if (process.env.RUDDER_CONTEXT) return path12.resolve(process.env.RUDDER_CONTEXT);
|
|
11790
11919
|
return findContextFileFromAncestors(process.cwd()) ?? resolveDefaultContextPath();
|
|
11791
11920
|
}
|
|
11792
11921
|
function defaultClientContext() {
|
|
@@ -11854,7 +11983,7 @@ function readContext(contextPath) {
|
|
|
11854
11983
|
}
|
|
11855
11984
|
function writeContext(context, contextPath) {
|
|
11856
11985
|
const filePath = resolveContextPath(contextPath);
|
|
11857
|
-
const dir =
|
|
11986
|
+
const dir = path12.dirname(filePath);
|
|
11858
11987
|
fs11.mkdirSync(dir, { recursive: true });
|
|
11859
11988
|
const normalized = normalizeContext(context);
|
|
11860
11989
|
fs11.writeFileSync(filePath, `${JSON.stringify(normalized, null, 2)}
|
|
@@ -11922,35 +12051,35 @@ var RudderApiClient = class {
|
|
|
11922
12051
|
this.runId = opts.runId?.trim() || void 0;
|
|
11923
12052
|
this.recoverAuth = opts.recoverAuth;
|
|
11924
12053
|
}
|
|
11925
|
-
get(
|
|
11926
|
-
return this.request(
|
|
12054
|
+
get(path23, opts) {
|
|
12055
|
+
return this.request(path23, { method: "GET" }, opts);
|
|
11927
12056
|
}
|
|
11928
|
-
post(
|
|
11929
|
-
return this.request(
|
|
12057
|
+
post(path23, body, opts) {
|
|
12058
|
+
return this.request(path23, {
|
|
11930
12059
|
method: "POST",
|
|
11931
12060
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11932
12061
|
}, opts);
|
|
11933
12062
|
}
|
|
11934
|
-
patch(
|
|
11935
|
-
return this.request(
|
|
12063
|
+
patch(path23, body, opts) {
|
|
12064
|
+
return this.request(path23, {
|
|
11936
12065
|
method: "PATCH",
|
|
11937
12066
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11938
12067
|
}, opts);
|
|
11939
12068
|
}
|
|
11940
|
-
put(
|
|
11941
|
-
return this.request(
|
|
12069
|
+
put(path23, body, opts) {
|
|
12070
|
+
return this.request(path23, {
|
|
11942
12071
|
method: "PUT",
|
|
11943
12072
|
body: body === void 0 ? void 0 : JSON.stringify(body)
|
|
11944
12073
|
}, opts);
|
|
11945
12074
|
}
|
|
11946
|
-
delete(
|
|
11947
|
-
return this.request(
|
|
12075
|
+
delete(path23, opts) {
|
|
12076
|
+
return this.request(path23, { method: "DELETE" }, opts);
|
|
11948
12077
|
}
|
|
11949
12078
|
setApiKey(apiKey) {
|
|
11950
12079
|
this.apiKey = apiKey?.trim() || void 0;
|
|
11951
12080
|
}
|
|
11952
|
-
async request(
|
|
11953
|
-
const url = buildUrl(this.apiBase,
|
|
12081
|
+
async request(path23, init, opts, hasRetriedAuth = false) {
|
|
12082
|
+
const url = buildUrl(this.apiBase, path23);
|
|
11954
12083
|
const headers = {
|
|
11955
12084
|
accept: "application/json",
|
|
11956
12085
|
...toStringRecord(init.headers)
|
|
@@ -11975,13 +12104,13 @@ var RudderApiClient = class {
|
|
|
11975
12104
|
const apiError = await toApiError(response);
|
|
11976
12105
|
if (!hasRetriedAuth && this.recoverAuth) {
|
|
11977
12106
|
const recoveredToken = await this.recoverAuth({
|
|
11978
|
-
path:
|
|
12107
|
+
path: path23,
|
|
11979
12108
|
method: String(init.method ?? "GET").toUpperCase(),
|
|
11980
12109
|
error: apiError
|
|
11981
12110
|
});
|
|
11982
12111
|
if (recoveredToken) {
|
|
11983
12112
|
this.setApiKey(recoveredToken);
|
|
11984
|
-
return this.request(
|
|
12113
|
+
return this.request(path23, init, opts, true);
|
|
11985
12114
|
}
|
|
11986
12115
|
}
|
|
11987
12116
|
throw apiError;
|
|
@@ -12000,8 +12129,8 @@ function shouldAttachRunId(method) {
|
|
|
12000
12129
|
const normalized = String(method ?? "GET").toUpperCase();
|
|
12001
12130
|
return normalized !== "GET" && normalized !== "HEAD";
|
|
12002
12131
|
}
|
|
12003
|
-
function buildUrl(apiBase,
|
|
12004
|
-
const normalizedPath =
|
|
12132
|
+
function buildUrl(apiBase, path23) {
|
|
12133
|
+
const normalizedPath = path23.startsWith("/") ? path23 : `/${path23}`;
|
|
12005
12134
|
const [pathname, query] = normalizedPath.split("?");
|
|
12006
12135
|
const url = new URL2(apiBase);
|
|
12007
12136
|
url.pathname = `${url.pathname.replace(/\/+$/, "")}${pathname}`;
|
|
@@ -12484,7 +12613,7 @@ init_src2();
|
|
|
12484
12613
|
init_home();
|
|
12485
12614
|
init_store();
|
|
12486
12615
|
init_banner();
|
|
12487
|
-
import
|
|
12616
|
+
import path13 from "node:path";
|
|
12488
12617
|
import * as p15 from "@clack/prompts";
|
|
12489
12618
|
import pc20 from "picocolors";
|
|
12490
12619
|
function resolveConnectionString(configPath) {
|
|
@@ -12508,7 +12637,7 @@ function normalizeRetentionDays(value, fallback) {
|
|
|
12508
12637
|
return candidate;
|
|
12509
12638
|
}
|
|
12510
12639
|
function resolveBackupDir(raw) {
|
|
12511
|
-
return
|
|
12640
|
+
return path13.resolve(expandHomePrefix(raw.trim()));
|
|
12512
12641
|
}
|
|
12513
12642
|
async function dbBackupCommand(opts) {
|
|
12514
12643
|
printRudderCliBanner();
|
|
@@ -12628,13 +12757,13 @@ function registerContextCommands(program) {
|
|
|
12628
12757
|
|
|
12629
12758
|
// src/commands/client/company.ts
|
|
12630
12759
|
import { mkdir as mkdir2, readdir as readdir3, readFile as readFile4, stat, writeFile as writeFile3 } from "node:fs/promises";
|
|
12631
|
-
import
|
|
12760
|
+
import path15 from "node:path";
|
|
12632
12761
|
import * as p16 from "@clack/prompts";
|
|
12633
12762
|
import pc22 from "picocolors";
|
|
12634
12763
|
|
|
12635
12764
|
// src/commands/client/zip.ts
|
|
12636
12765
|
import { inflateRawSync } from "node:zlib";
|
|
12637
|
-
import
|
|
12766
|
+
import path14 from "node:path";
|
|
12638
12767
|
var textDecoder = new TextDecoder();
|
|
12639
12768
|
var binaryContentTypeByExtension = {
|
|
12640
12769
|
".gif": "image/gif",
|
|
@@ -12661,7 +12790,7 @@ function sharedArchiveRoot(paths) {
|
|
|
12661
12790
|
return firstSegments.every((parts) => parts.length > 1 && parts[0] === candidate) ? candidate : null;
|
|
12662
12791
|
}
|
|
12663
12792
|
function bytesToPortableFileEntry(pathValue, bytes) {
|
|
12664
|
-
const contentType = binaryContentTypeByExtension[
|
|
12793
|
+
const contentType = binaryContentTypeByExtension[path14.extname(pathValue).toLowerCase()];
|
|
12665
12794
|
if (!contentType) return textDecoder.decode(bytes);
|
|
12666
12795
|
return {
|
|
12667
12796
|
encoding: "base64",
|
|
@@ -12749,7 +12878,7 @@ var IMPORT_INCLUDE_OPTIONS = [
|
|
|
12749
12878
|
];
|
|
12750
12879
|
var IMPORT_PREVIEW_SAMPLE_LIMIT = 6;
|
|
12751
12880
|
function readPortableFileEntry(filePath, contents) {
|
|
12752
|
-
const contentType = binaryContentTypeByExtension[
|
|
12881
|
+
const contentType = binaryContentTypeByExtension[path15.extname(filePath).toLowerCase()];
|
|
12753
12882
|
if (!contentType) return contents.toString("utf8");
|
|
12754
12883
|
return {
|
|
12755
12884
|
encoding: "base64",
|
|
@@ -12804,10 +12933,10 @@ function normalizePortablePath(filePath) {
|
|
|
12804
12933
|
return filePath.replace(/\\/g, "/");
|
|
12805
12934
|
}
|
|
12806
12935
|
function shouldIncludePortableFile(filePath) {
|
|
12807
|
-
const baseName =
|
|
12936
|
+
const baseName = path15.basename(filePath);
|
|
12808
12937
|
const isMarkdown = baseName.endsWith(".md");
|
|
12809
12938
|
const isPaperclipYaml = baseName === ".rudder.yaml" || baseName === ".rudder.yml";
|
|
12810
|
-
const contentType = binaryContentTypeByExtension[
|
|
12939
|
+
const contentType = binaryContentTypeByExtension[path15.extname(baseName).toLowerCase()];
|
|
12811
12940
|
return isMarkdown || isPaperclipYaml || Boolean(contentType);
|
|
12812
12941
|
}
|
|
12813
12942
|
function findPortableExtensionPath(files) {
|
|
@@ -12955,10 +13084,10 @@ function buildDefaultImportAdapterOverrides(preview) {
|
|
|
12955
13084
|
}
|
|
12956
13085
|
function buildDefaultImportAdapterMessages(overrides) {
|
|
12957
13086
|
if (!overrides) return [];
|
|
12958
|
-
const
|
|
13087
|
+
const agentRuntimeTypes2 = Array.from(new Set(Object.values(overrides).map((override) => override.agentRuntimeType))).map((agentRuntimeType) => agentRuntimeType.replace(/_/g, "-"));
|
|
12959
13088
|
const agentCount = Object.keys(overrides).length;
|
|
12960
13089
|
return [
|
|
12961
|
-
`Using ${
|
|
13090
|
+
`Using ${agentRuntimeTypes2.join(", ")} adapter${agentRuntimeTypes2.length === 1 ? "" : "s"} for ${agentCount} imported ${pluralize(agentCount, "agent")} without an explicit adapter.`
|
|
12962
13091
|
];
|
|
12963
13092
|
}
|
|
12964
13093
|
async function promptForImportSelection(preview) {
|
|
@@ -13362,7 +13491,7 @@ function normalizeGithubImportSource(input, refOverride) {
|
|
|
13362
13491
|
}
|
|
13363
13492
|
async function pathExists2(inputPath) {
|
|
13364
13493
|
try {
|
|
13365
|
-
await stat(
|
|
13494
|
+
await stat(path15.resolve(inputPath));
|
|
13366
13495
|
return true;
|
|
13367
13496
|
} catch {
|
|
13368
13497
|
return false;
|
|
@@ -13372,45 +13501,45 @@ async function collectPackageFiles(root, current, files) {
|
|
|
13372
13501
|
const entries = await readdir3(current, { withFileTypes: true });
|
|
13373
13502
|
for (const entry of entries) {
|
|
13374
13503
|
if (entry.name.startsWith(".git")) continue;
|
|
13375
|
-
const absolutePath =
|
|
13504
|
+
const absolutePath = path15.join(current, entry.name);
|
|
13376
13505
|
if (entry.isDirectory()) {
|
|
13377
13506
|
await collectPackageFiles(root, absolutePath, files);
|
|
13378
13507
|
continue;
|
|
13379
13508
|
}
|
|
13380
13509
|
if (!entry.isFile()) continue;
|
|
13381
|
-
const relativePath =
|
|
13510
|
+
const relativePath = path15.relative(root, absolutePath).replace(/\\/g, "/");
|
|
13382
13511
|
if (!shouldIncludePortableFile(relativePath)) continue;
|
|
13383
13512
|
files[relativePath] = readPortableFileEntry(relativePath, await readFile4(absolutePath));
|
|
13384
13513
|
}
|
|
13385
13514
|
}
|
|
13386
13515
|
async function resolveInlineSourceFromPath(inputPath) {
|
|
13387
|
-
const resolved =
|
|
13516
|
+
const resolved = path15.resolve(inputPath);
|
|
13388
13517
|
const resolvedStat = await stat(resolved);
|
|
13389
|
-
if (resolvedStat.isFile() &&
|
|
13518
|
+
if (resolvedStat.isFile() && path15.extname(resolved).toLowerCase() === ".zip") {
|
|
13390
13519
|
const archive = await readZipArchive(await readFile4(resolved));
|
|
13391
13520
|
const filteredFiles = Object.fromEntries(
|
|
13392
13521
|
Object.entries(archive.files).filter(([relativePath]) => shouldIncludePortableFile(relativePath))
|
|
13393
13522
|
);
|
|
13394
13523
|
return {
|
|
13395
|
-
rootPath: archive.rootPath ??
|
|
13524
|
+
rootPath: archive.rootPath ?? path15.basename(resolved, ".zip"),
|
|
13396
13525
|
files: filteredFiles
|
|
13397
13526
|
};
|
|
13398
13527
|
}
|
|
13399
|
-
const rootDir = resolvedStat.isDirectory() ? resolved :
|
|
13528
|
+
const rootDir = resolvedStat.isDirectory() ? resolved : path15.dirname(resolved);
|
|
13400
13529
|
const files = {};
|
|
13401
13530
|
await collectPackageFiles(rootDir, rootDir, files);
|
|
13402
13531
|
return {
|
|
13403
|
-
rootPath:
|
|
13532
|
+
rootPath: path15.basename(rootDir),
|
|
13404
13533
|
files
|
|
13405
13534
|
};
|
|
13406
13535
|
}
|
|
13407
13536
|
async function writeExportToFolder(outDir, exported) {
|
|
13408
|
-
const root =
|
|
13537
|
+
const root = path15.resolve(outDir);
|
|
13409
13538
|
await mkdir2(root, { recursive: true });
|
|
13410
13539
|
for (const [relativePath, content] of Object.entries(exported.files)) {
|
|
13411
13540
|
const normalized = relativePath.replace(/\\/g, "/");
|
|
13412
|
-
const filePath =
|
|
13413
|
-
await mkdir2(
|
|
13541
|
+
const filePath = path15.join(root, normalized);
|
|
13542
|
+
await mkdir2(path15.dirname(filePath), { recursive: true });
|
|
13414
13543
|
const writeValue = portableFileEntryToWriteValue(content);
|
|
13415
13544
|
if (typeof writeValue === "string") {
|
|
13416
13545
|
await writeFile3(filePath, writeValue, "utf8");
|
|
@@ -13420,7 +13549,7 @@ async function writeExportToFolder(outDir, exported) {
|
|
|
13420
13549
|
}
|
|
13421
13550
|
}
|
|
13422
13551
|
async function confirmOverwriteExportDirectory(outDir) {
|
|
13423
|
-
const root =
|
|
13552
|
+
const root = path15.resolve(outDir);
|
|
13424
13553
|
const stats = await stat(root).catch(() => null);
|
|
13425
13554
|
if (!stats) return;
|
|
13426
13555
|
if (!stats.isDirectory()) {
|
|
@@ -13570,7 +13699,7 @@ function registerCompanyCommands(program) {
|
|
|
13570
13699
|
printOutput(
|
|
13571
13700
|
{
|
|
13572
13701
|
ok: true,
|
|
13573
|
-
out:
|
|
13702
|
+
out: path15.resolve(opts.out),
|
|
13574
13703
|
rootPath: exported.rootPath,
|
|
13575
13704
|
filesWritten: Object.keys(exported.files).length,
|
|
13576
13705
|
rudderExtensionPath: exported.rudderExtensionPath,
|
|
@@ -14374,8 +14503,8 @@ function registerIssueCommands(program) {
|
|
|
14374
14503
|
if (opts.assigneeAgentId) params.set("assigneeAgentId", opts.assigneeAgentId);
|
|
14375
14504
|
if (opts.projectId) params.set("projectId", opts.projectId);
|
|
14376
14505
|
const query = params.toString();
|
|
14377
|
-
const
|
|
14378
|
-
const rows = await ctx.api.get(
|
|
14506
|
+
const path23 = `/api/orgs/${ctx.orgId}/issues${query ? `?${query}` : ""}`;
|
|
14507
|
+
const rows = await ctx.api.get(path23) ?? [];
|
|
14379
14508
|
const filtered = filterIssueRows(rows, opts.match);
|
|
14380
14509
|
if (ctx.json) {
|
|
14381
14510
|
printOutput(filtered, { json: true });
|
|
@@ -14670,7 +14799,7 @@ init_src();
|
|
|
14670
14799
|
|
|
14671
14800
|
// ../packages/agent-runtime-utils/src/server-utils.ts
|
|
14672
14801
|
import { constants as fsConstants2, promises as fs12 } from "node:fs";
|
|
14673
|
-
import
|
|
14802
|
+
import path16 from "node:path";
|
|
14674
14803
|
var MAX_CAPTURE_BYTES = 4 * 1024 * 1024;
|
|
14675
14804
|
var MAX_EXCERPT_BYTES = 32 * 1024;
|
|
14676
14805
|
var RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES = [
|
|
@@ -14687,8 +14816,8 @@ function isMaintainerOnlySkillTarget(candidate) {
|
|
|
14687
14816
|
}
|
|
14688
14817
|
async function resolveRudderSkillsDir(moduleDir, additionalCandidates = []) {
|
|
14689
14818
|
const candidates = [
|
|
14690
|
-
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) =>
|
|
14691
|
-
...additionalCandidates.map((candidate) =>
|
|
14819
|
+
...RUDDER_SKILL_ROOT_RELATIVE_CANDIDATES.map((relativePath) => path16.resolve(moduleDir, relativePath)),
|
|
14820
|
+
...additionalCandidates.map((candidate) => path16.resolve(candidate))
|
|
14692
14821
|
];
|
|
14693
14822
|
const seenRoots = /* @__PURE__ */ new Set();
|
|
14694
14823
|
for (const root of candidates) {
|
|
@@ -14706,12 +14835,12 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
14706
14835
|
const removed = [];
|
|
14707
14836
|
for (const entry of entries) {
|
|
14708
14837
|
if (allowed.has(entry.name)) continue;
|
|
14709
|
-
const target =
|
|
14838
|
+
const target = path16.join(skillsHome, entry.name);
|
|
14710
14839
|
const existing = await fs12.lstat(target).catch(() => null);
|
|
14711
14840
|
if (!existing?.isSymbolicLink()) continue;
|
|
14712
14841
|
const linkedPath = await fs12.readlink(target).catch(() => null);
|
|
14713
14842
|
if (!linkedPath) continue;
|
|
14714
|
-
const resolvedLinkedPath =
|
|
14843
|
+
const resolvedLinkedPath = path16.isAbsolute(linkedPath) ? linkedPath : path16.resolve(path16.dirname(target), linkedPath);
|
|
14715
14844
|
if (!isMaintainerOnlySkillTarget(linkedPath) && !isMaintainerOnlySkillTarget(resolvedLinkedPath)) {
|
|
14716
14845
|
continue;
|
|
14717
14846
|
}
|
|
@@ -14727,18 +14856,18 @@ async function removeMaintainerOnlySkillSymlinks(skillsHome, allowedSkillNames)
|
|
|
14727
14856
|
// src/commands/client/agent.ts
|
|
14728
14857
|
import fs13 from "node:fs/promises";
|
|
14729
14858
|
import os2 from "node:os";
|
|
14730
|
-
import
|
|
14859
|
+
import path17 from "node:path";
|
|
14731
14860
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
14732
|
-
var __moduleDir =
|
|
14861
|
+
var __moduleDir = path17.dirname(fileURLToPath4(import.meta.url));
|
|
14733
14862
|
function codexSkillsHome() {
|
|
14734
14863
|
const fromEnv = process.env.CODEX_HOME?.trim();
|
|
14735
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
14736
|
-
return
|
|
14864
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path17.join(os2.homedir(), ".codex");
|
|
14865
|
+
return path17.join(base, "skills");
|
|
14737
14866
|
}
|
|
14738
14867
|
function claudeSkillsHome() {
|
|
14739
14868
|
const fromEnv = process.env.CLAUDE_HOME?.trim();
|
|
14740
|
-
const base = fromEnv && fromEnv.length > 0 ? fromEnv :
|
|
14741
|
-
return
|
|
14869
|
+
const base = fromEnv && fromEnv.length > 0 ? fromEnv : path17.join(os2.homedir(), ".claude");
|
|
14870
|
+
return path17.join(base, "skills");
|
|
14742
14871
|
}
|
|
14743
14872
|
async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
14744
14873
|
const summary = {
|
|
@@ -14757,8 +14886,8 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
14757
14886
|
);
|
|
14758
14887
|
for (const entry of entries) {
|
|
14759
14888
|
if (!entry.isDirectory()) continue;
|
|
14760
|
-
const source =
|
|
14761
|
-
const target =
|
|
14889
|
+
const source = path17.join(sourceSkillsDir, entry.name);
|
|
14890
|
+
const target = path17.join(targetSkillsDir, entry.name);
|
|
14762
14891
|
const existing = await fs13.lstat(target).catch(() => null);
|
|
14763
14892
|
if (existing) {
|
|
14764
14893
|
if (existing.isSymbolicLink()) {
|
|
@@ -14779,7 +14908,7 @@ async function installSkillsForTarget(sourceSkillsDir, targetSkillsDir, tool) {
|
|
|
14779
14908
|
continue;
|
|
14780
14909
|
}
|
|
14781
14910
|
}
|
|
14782
|
-
const resolvedLinkedPath =
|
|
14911
|
+
const resolvedLinkedPath = path17.isAbsolute(linkedPath) ? linkedPath : path17.resolve(path17.dirname(target), linkedPath);
|
|
14783
14912
|
const linkedTargetExists = await fs13.stat(resolvedLinkedPath).then(() => true).catch(() => false);
|
|
14784
14913
|
if (!linkedTargetExists) {
|
|
14785
14914
|
await fs13.unlink(target);
|
|
@@ -15059,7 +15188,7 @@ function registerAgentCommands(program) {
|
|
|
15059
15188
|
}
|
|
15060
15189
|
const installSummaries = [];
|
|
15061
15190
|
if (opts.installSkills !== false) {
|
|
15062
|
-
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [
|
|
15191
|
+
const skillsDir = await resolveRudderSkillsDir(__moduleDir, [path17.resolve(process.cwd(), "skills")]);
|
|
15063
15192
|
if (!skillsDir) {
|
|
15064
15193
|
throw new Error(
|
|
15065
15194
|
"Could not locate local Rudder skills directory. Expected ./skills in the repo checkout."
|
|
@@ -15316,8 +15445,8 @@ function registerActivityCommands(program) {
|
|
|
15316
15445
|
if (opts.entityType) params.set("entityType", opts.entityType);
|
|
15317
15446
|
if (opts.entityId) params.set("entityId", opts.entityId);
|
|
15318
15447
|
const query = params.toString();
|
|
15319
|
-
const
|
|
15320
|
-
const rows = await ctx.api.get(
|
|
15448
|
+
const path23 = `/api/orgs/${ctx.orgId}/activity${query ? `?${query}` : ""}`;
|
|
15449
|
+
const rows = await ctx.api.get(path23) ?? [];
|
|
15321
15450
|
if (ctx.json) {
|
|
15322
15451
|
printOutput(rows, { json: true });
|
|
15323
15452
|
return;
|
|
@@ -15486,11 +15615,11 @@ function parseCsv4(value) {
|
|
|
15486
15615
|
|
|
15487
15616
|
// src/config/data-dir.ts
|
|
15488
15617
|
init_home();
|
|
15489
|
-
import
|
|
15618
|
+
import path18 from "node:path";
|
|
15490
15619
|
function applyDataDirOverride(options, support = {}) {
|
|
15491
15620
|
const rawDataDir = options.dataDir?.trim();
|
|
15492
15621
|
if (!rawDataDir) return null;
|
|
15493
|
-
const resolvedDataDir =
|
|
15622
|
+
const resolvedDataDir = path18.resolve(expandHomePrefix(rawDataDir));
|
|
15494
15623
|
process.env.RUDDER_HOME = resolvedDataDir;
|
|
15495
15624
|
if (support.hasConfigOption) {
|
|
15496
15625
|
const hasConfigOverride = Boolean(options.config?.trim()) || Boolean(process.env.RUDDER_CONFIG?.trim());
|
|
@@ -15527,7 +15656,7 @@ import {
|
|
|
15527
15656
|
mkdirSync as mkdirSync3,
|
|
15528
15657
|
promises as fsPromises,
|
|
15529
15658
|
readdirSync as readdirSync2,
|
|
15530
|
-
readFileSync as
|
|
15659
|
+
readFileSync as readFileSync3,
|
|
15531
15660
|
readlinkSync,
|
|
15532
15661
|
rmSync,
|
|
15533
15662
|
statSync as statSync2,
|
|
@@ -15535,7 +15664,7 @@ import {
|
|
|
15535
15664
|
writeFileSync
|
|
15536
15665
|
} from "node:fs";
|
|
15537
15666
|
import os3 from "node:os";
|
|
15538
|
-
import
|
|
15667
|
+
import path20 from "node:path";
|
|
15539
15668
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
15540
15669
|
import { createServer } from "node:net";
|
|
15541
15670
|
import { Readable as Readable2 } from "node:stream";
|
|
@@ -15546,7 +15675,7 @@ import { and as and2, eq as eq2, inArray, sql as sql3 } from "drizzle-orm";
|
|
|
15546
15675
|
// src/commands/worktree-lib.ts
|
|
15547
15676
|
init_home();
|
|
15548
15677
|
import { randomInt } from "node:crypto";
|
|
15549
|
-
import
|
|
15678
|
+
import path19 from "node:path";
|
|
15550
15679
|
var DEFAULT_WORKTREE_HOME = "~/.rudder-worktrees";
|
|
15551
15680
|
var WORKTREE_SEED_MODES = ["minimal", "full"];
|
|
15552
15681
|
var MINIMAL_WORKTREE_EXCLUDED_TABLES = [
|
|
@@ -15594,7 +15723,7 @@ function sanitizeWorktreeInstanceId(rawValue) {
|
|
|
15594
15723
|
return normalized || "worktree";
|
|
15595
15724
|
}
|
|
15596
15725
|
function resolveSuggestedWorktreeName(cwd, explicitName) {
|
|
15597
|
-
return nonEmpty(explicitName) ??
|
|
15726
|
+
return nonEmpty(explicitName) ?? path19.basename(path19.resolve(cwd));
|
|
15598
15727
|
}
|
|
15599
15728
|
function hslComponentToHex(n) {
|
|
15600
15729
|
return Math.round(Math.max(0, Math.min(255, n))).toString(16).padStart(2, "0");
|
|
@@ -15634,24 +15763,24 @@ function generateWorktreeColor() {
|
|
|
15634
15763
|
return hslToHex(randomInt(0, 360), 68, 56);
|
|
15635
15764
|
}
|
|
15636
15765
|
function resolveWorktreeLocalPaths(opts) {
|
|
15637
|
-
const cwd =
|
|
15638
|
-
const homeDir =
|
|
15639
|
-
const instanceRoot =
|
|
15640
|
-
const repoConfigDir =
|
|
15766
|
+
const cwd = path19.resolve(opts.cwd);
|
|
15767
|
+
const homeDir = path19.resolve(expandHomePrefix(opts.homeDir ?? DEFAULT_WORKTREE_HOME));
|
|
15768
|
+
const instanceRoot = path19.resolve(homeDir, "instances", opts.instanceId);
|
|
15769
|
+
const repoConfigDir = path19.resolve(cwd, ".rudder");
|
|
15641
15770
|
return {
|
|
15642
15771
|
cwd,
|
|
15643
15772
|
repoConfigDir,
|
|
15644
|
-
configPath:
|
|
15645
|
-
envPath:
|
|
15773
|
+
configPath: path19.resolve(repoConfigDir, "config.json"),
|
|
15774
|
+
envPath: path19.resolve(repoConfigDir, ".env"),
|
|
15646
15775
|
homeDir,
|
|
15647
15776
|
instanceId: opts.instanceId,
|
|
15648
15777
|
instanceRoot,
|
|
15649
|
-
contextPath:
|
|
15650
|
-
embeddedPostgresDataDir:
|
|
15651
|
-
backupDir:
|
|
15652
|
-
logDir:
|
|
15653
|
-
secretsKeyFilePath:
|
|
15654
|
-
storageDir:
|
|
15778
|
+
contextPath: path19.resolve(homeDir, "context.json"),
|
|
15779
|
+
embeddedPostgresDataDir: path19.resolve(instanceRoot, "db"),
|
|
15780
|
+
backupDir: path19.resolve(instanceRoot, "data", "backups"),
|
|
15781
|
+
logDir: path19.resolve(instanceRoot, "logs"),
|
|
15782
|
+
secretsKeyFilePath: path19.resolve(instanceRoot, "secrets", "master.key"),
|
|
15783
|
+
storageDir: path19.resolve(instanceRoot, "data", "storage")
|
|
15655
15784
|
};
|
|
15656
15785
|
}
|
|
15657
15786
|
function rewriteLocalUrlPort(rawUrl, port) {
|
|
@@ -16175,7 +16304,7 @@ function isCurrentSourceConfigPath(sourceConfigPath) {
|
|
|
16175
16304
|
if (!currentConfigPath || currentConfigPath.trim().length === 0) {
|
|
16176
16305
|
return false;
|
|
16177
16306
|
}
|
|
16178
|
-
return
|
|
16307
|
+
return path20.resolve(currentConfigPath) === path20.resolve(sourceConfigPath);
|
|
16179
16308
|
}
|
|
16180
16309
|
var WORKTREE_NAME_PREFIX = "rudder-";
|
|
16181
16310
|
function resolveWorktreeMakeName(name) {
|
|
@@ -16213,9 +16342,9 @@ function normalizeStorageObjectKey(objectKey) {
|
|
|
16213
16342
|
return parts.join("/");
|
|
16214
16343
|
}
|
|
16215
16344
|
function resolveLocalStoragePath(baseDir, objectKey) {
|
|
16216
|
-
const resolved =
|
|
16217
|
-
const root =
|
|
16218
|
-
if (resolved !== root && !resolved.startsWith(`${root}${
|
|
16345
|
+
const resolved = path20.resolve(baseDir, normalizeStorageObjectKey(objectKey));
|
|
16346
|
+
const root = path20.resolve(baseDir);
|
|
16347
|
+
if (resolved !== root && !resolved.startsWith(`${root}${path20.sep}`)) {
|
|
16219
16348
|
throw new Error("Invalid object key path.");
|
|
16220
16349
|
}
|
|
16221
16350
|
return resolved;
|
|
@@ -16266,7 +16395,7 @@ function createConfiguredStorageFromRudderConfig(config) {
|
|
|
16266
16395
|
async putObject(orgId, objectKey, body) {
|
|
16267
16396
|
assertStorageCompanyPrefix(orgId, objectKey);
|
|
16268
16397
|
const filePath = resolveLocalStoragePath(baseDir, objectKey);
|
|
16269
|
-
await fsPromises.mkdir(
|
|
16398
|
+
await fsPromises.mkdir(path20.dirname(filePath), { recursive: true });
|
|
16270
16399
|
await fsPromises.writeFile(filePath, body);
|
|
16271
16400
|
}
|
|
16272
16401
|
};
|
|
@@ -16350,7 +16479,7 @@ async function readSourceAttachmentBody(sourceStorages, orgId, objectKey) {
|
|
|
16350
16479
|
return null;
|
|
16351
16480
|
}
|
|
16352
16481
|
function resolveWorktreeMakeTargetPath(name) {
|
|
16353
|
-
return
|
|
16482
|
+
return path20.resolve(os3.homedir(), resolveWorktreeMakeName(name));
|
|
16354
16483
|
}
|
|
16355
16484
|
function extractExecSyncErrorMessage(error) {
|
|
16356
16485
|
if (!error || typeof error !== "object") {
|
|
@@ -16386,7 +16515,7 @@ function resolveGitWorktreeAddArgs(input) {
|
|
|
16386
16515
|
function readPidFilePort(postmasterPidFile) {
|
|
16387
16516
|
if (!existsSync3(postmasterPidFile)) return null;
|
|
16388
16517
|
try {
|
|
16389
|
-
const lines =
|
|
16518
|
+
const lines = readFileSync3(postmasterPidFile, "utf8").split("\n");
|
|
16390
16519
|
const port = Number(lines[3]?.trim());
|
|
16391
16520
|
return Number.isInteger(port) && port > 0 ? port : null;
|
|
16392
16521
|
} catch {
|
|
@@ -16396,7 +16525,7 @@ function readPidFilePort(postmasterPidFile) {
|
|
|
16396
16525
|
function readRunningPostmasterPid(postmasterPidFile) {
|
|
16397
16526
|
if (!existsSync3(postmasterPidFile)) return null;
|
|
16398
16527
|
try {
|
|
16399
|
-
const pid = Number(
|
|
16528
|
+
const pid = Number(readFileSync3(postmasterPidFile, "utf8").split("\n")[0]?.trim());
|
|
16400
16529
|
if (!Number.isInteger(pid) || pid <= 0) return null;
|
|
16401
16530
|
process.kill(pid, 0);
|
|
16402
16531
|
return pid;
|
|
@@ -16456,10 +16585,10 @@ function detectGitWorkspaceInfo(cwd) {
|
|
|
16456
16585
|
stdio: ["ignore", "pipe", "ignore"]
|
|
16457
16586
|
}).trim();
|
|
16458
16587
|
return {
|
|
16459
|
-
root:
|
|
16460
|
-
commonDir:
|
|
16461
|
-
gitDir:
|
|
16462
|
-
hooksPath:
|
|
16588
|
+
root: path20.resolve(root),
|
|
16589
|
+
commonDir: path20.resolve(root, commonDirRaw),
|
|
16590
|
+
gitDir: path20.resolve(root, gitDirRaw),
|
|
16591
|
+
hooksPath: path20.resolve(root, hooksPathRaw)
|
|
16463
16592
|
};
|
|
16464
16593
|
} catch {
|
|
16465
16594
|
return null;
|
|
@@ -16472,8 +16601,8 @@ function copyDirectoryContents(sourceDir, targetDir) {
|
|
|
16472
16601
|
mkdirSync3(targetDir, { recursive: true });
|
|
16473
16602
|
let copied = false;
|
|
16474
16603
|
for (const entry of entries) {
|
|
16475
|
-
const sourcePath =
|
|
16476
|
-
const targetPath =
|
|
16604
|
+
const sourcePath = path20.resolve(sourceDir, entry.name);
|
|
16605
|
+
const targetPath = path20.resolve(targetDir, entry.name);
|
|
16477
16606
|
if (entry.isDirectory()) {
|
|
16478
16607
|
mkdirSync3(targetPath, { recursive: true });
|
|
16479
16608
|
copyDirectoryContents(sourcePath, targetPath);
|
|
@@ -16499,7 +16628,7 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
16499
16628
|
const workspace = detectGitWorkspaceInfo(cwd);
|
|
16500
16629
|
if (!workspace) return null;
|
|
16501
16630
|
const sourceHooksPath = workspace.hooksPath;
|
|
16502
|
-
const targetHooksPath =
|
|
16631
|
+
const targetHooksPath = path20.resolve(workspace.gitDir, "hooks");
|
|
16503
16632
|
if (sourceHooksPath === targetHooksPath) {
|
|
16504
16633
|
return {
|
|
16505
16634
|
sourceHooksPath,
|
|
@@ -16514,17 +16643,17 @@ function copyGitHooksToWorktreeGitDir(cwd) {
|
|
|
16514
16643
|
};
|
|
16515
16644
|
}
|
|
16516
16645
|
function rebindWorkspaceCwd(input) {
|
|
16517
|
-
const sourceRepoRoot =
|
|
16518
|
-
const targetRepoRoot =
|
|
16519
|
-
const workspaceCwd =
|
|
16520
|
-
const relative =
|
|
16646
|
+
const sourceRepoRoot = path20.resolve(input.sourceRepoRoot);
|
|
16647
|
+
const targetRepoRoot = path20.resolve(input.targetRepoRoot);
|
|
16648
|
+
const workspaceCwd = path20.resolve(input.workspaceCwd);
|
|
16649
|
+
const relative = path20.relative(sourceRepoRoot, workspaceCwd);
|
|
16521
16650
|
if (!relative || relative === "") {
|
|
16522
16651
|
return targetRepoRoot;
|
|
16523
16652
|
}
|
|
16524
|
-
if (relative.startsWith("..") ||
|
|
16653
|
+
if (relative.startsWith("..") || path20.isAbsolute(relative)) {
|
|
16525
16654
|
return null;
|
|
16526
16655
|
}
|
|
16527
|
-
return
|
|
16656
|
+
return path20.resolve(targetRepoRoot, relative);
|
|
16528
16657
|
}
|
|
16529
16658
|
async function rebindSeededProjectWorkspaces(input) {
|
|
16530
16659
|
const targetRepo = detectGitWorkspaceInfo(input.currentCwd);
|
|
@@ -16550,7 +16679,7 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
16550
16679
|
workspaceCwd
|
|
16551
16680
|
});
|
|
16552
16681
|
if (!reboundCwd) continue;
|
|
16553
|
-
const normalizedCurrent =
|
|
16682
|
+
const normalizedCurrent = path20.resolve(workspaceCwd);
|
|
16554
16683
|
if (reboundCwd === normalizedCurrent) continue;
|
|
16555
16684
|
if (!existsSync3(reboundCwd)) continue;
|
|
16556
16685
|
await db.update(projectWorkspaces).set({
|
|
@@ -16569,14 +16698,14 @@ async function rebindSeededProjectWorkspaces(input) {
|
|
|
16569
16698
|
}
|
|
16570
16699
|
}
|
|
16571
16700
|
function resolveSourceConfigPath(opts) {
|
|
16572
|
-
if (opts.sourceConfigPathOverride) return
|
|
16573
|
-
if (opts.fromConfig) return
|
|
16701
|
+
if (opts.sourceConfigPathOverride) return path20.resolve(opts.sourceConfigPathOverride);
|
|
16702
|
+
if (opts.fromConfig) return path20.resolve(opts.fromConfig);
|
|
16574
16703
|
if (!opts.fromDataDir && !opts.fromInstance) {
|
|
16575
16704
|
return resolveConfigPath();
|
|
16576
16705
|
}
|
|
16577
|
-
const sourceHome =
|
|
16706
|
+
const sourceHome = path20.resolve(expandHomePrefix(opts.fromDataDir ?? "~/.rudder"));
|
|
16578
16707
|
const sourceInstanceId = sanitizeWorktreeInstanceId(opts.fromInstance ?? "default");
|
|
16579
|
-
return
|
|
16708
|
+
return path20.resolve(sourceHome, "instances", sourceInstanceId, "config.json");
|
|
16580
16709
|
}
|
|
16581
16710
|
function resolveSourceConnectionString(config, envEntries, portOverride) {
|
|
16582
16711
|
if (config.database.mode === "postgres") {
|
|
@@ -16595,7 +16724,7 @@ function copySeededSecretsKey(input) {
|
|
|
16595
16724
|
if (input.sourceConfig.secrets.provider !== "local_encrypted") {
|
|
16596
16725
|
return;
|
|
16597
16726
|
}
|
|
16598
|
-
mkdirSync3(
|
|
16727
|
+
mkdirSync3(path20.dirname(input.targetKeyFilePath), { recursive: true });
|
|
16599
16728
|
const allowProcessEnvFallback = isCurrentSourceConfigPath(input.sourceConfigPath);
|
|
16600
16729
|
const sourceInlineMasterKey = nonEmpty2(input.sourceEnvEntries.RUDDER_SECRETS_MASTER_KEY) ?? (allowProcessEnvFallback ? nonEmpty2(process.env.RUDDER_SECRETS_MASTER_KEY) : null);
|
|
16601
16730
|
if (sourceInlineMasterKey) {
|
|
@@ -16634,7 +16763,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
16634
16763
|
"Embedded PostgreSQL support requires dependency `embedded-postgres`. Reinstall dependencies and try again."
|
|
16635
16764
|
);
|
|
16636
16765
|
}
|
|
16637
|
-
const postmasterPidFile =
|
|
16766
|
+
const postmasterPidFile = path20.resolve(dataDir, "postmaster.pid");
|
|
16638
16767
|
const runningPid = readRunningPostmasterPid(postmasterPidFile);
|
|
16639
16768
|
if (runningPid) {
|
|
16640
16769
|
return {
|
|
@@ -16657,7 +16786,7 @@ async function ensureEmbeddedPostgres(dataDir, preferredPort) {
|
|
|
16657
16786
|
onError: () => {
|
|
16658
16787
|
}
|
|
16659
16788
|
});
|
|
16660
|
-
if (!existsSync3(
|
|
16789
|
+
if (!existsSync3(path20.resolve(dataDir, "PG_VERSION"))) {
|
|
16661
16790
|
await instance.initialise();
|
|
16662
16791
|
}
|
|
16663
16792
|
if (existsSync3(postmasterPidFile)) {
|
|
@@ -16698,7 +16827,7 @@ async function seedWorktreeDatabase(input) {
|
|
|
16698
16827
|
);
|
|
16699
16828
|
const backup = await runDatabaseBackup({
|
|
16700
16829
|
connectionString: sourceConnectionString,
|
|
16701
|
-
backupDir:
|
|
16830
|
+
backupDir: path20.resolve(input.targetPaths.backupDir, "seed"),
|
|
16702
16831
|
retentionDays: 7,
|
|
16703
16832
|
filenamePrefix: `${input.instanceId}-seed`,
|
|
16704
16833
|
includeMigrationJournal: true,
|
|
@@ -16857,7 +16986,7 @@ async function worktreeMakeCommand(nameArg, opts) {
|
|
|
16857
16986
|
if (existsSync3(targetPath)) {
|
|
16858
16987
|
throw new Error(`Target path already exists: ${targetPath}`);
|
|
16859
16988
|
}
|
|
16860
|
-
mkdirSync3(
|
|
16989
|
+
mkdirSync3(path20.dirname(targetPath), { recursive: true });
|
|
16861
16990
|
if (startPoint) {
|
|
16862
16991
|
const [remote] = startPoint.split("/", 1);
|
|
16863
16992
|
try {
|
|
@@ -16953,15 +17082,15 @@ function parseGitWorktreeList(cwd) {
|
|
|
16953
17082
|
return entries;
|
|
16954
17083
|
}
|
|
16955
17084
|
function toMergeSourceChoices(cwd) {
|
|
16956
|
-
const currentCwd =
|
|
17085
|
+
const currentCwd = path20.resolve(cwd);
|
|
16957
17086
|
return parseGitWorktreeList(cwd).map((entry) => {
|
|
16958
17087
|
const branchLabel = entry.branch?.replace(/^refs\/heads\//, "") ?? "(detached)";
|
|
16959
|
-
const worktreePath =
|
|
17088
|
+
const worktreePath = path20.resolve(entry.worktree);
|
|
16960
17089
|
return {
|
|
16961
17090
|
worktree: worktreePath,
|
|
16962
17091
|
branch: entry.branch,
|
|
16963
17092
|
branchLabel,
|
|
16964
|
-
hasRudderConfig: existsSync3(
|
|
17093
|
+
hasRudderConfig: existsSync3(path20.resolve(worktreePath, ".rudder", "config.json")),
|
|
16965
17094
|
isCurrent: worktreePath === currentCwd
|
|
16966
17095
|
};
|
|
16967
17096
|
});
|
|
@@ -17009,14 +17138,14 @@ async function worktreeCleanupCommand(nameArg, opts) {
|
|
|
17009
17138
|
const sourceCwd = process.cwd();
|
|
17010
17139
|
const targetPath = resolveWorktreeMakeTargetPath(name);
|
|
17011
17140
|
const instanceId = sanitizeWorktreeInstanceId(opts.instance ?? name);
|
|
17012
|
-
const homeDir =
|
|
17013
|
-
const instanceRoot =
|
|
17141
|
+
const homeDir = path20.resolve(expandHomePrefix(resolveWorktreeHome(opts.home)));
|
|
17142
|
+
const instanceRoot = path20.resolve(homeDir, "instances", instanceId);
|
|
17014
17143
|
const hasBranch = localBranchExists(sourceCwd, name);
|
|
17015
17144
|
const hasTargetDir = existsSync3(targetPath);
|
|
17016
17145
|
const hasInstanceData = existsSync3(instanceRoot);
|
|
17017
17146
|
const worktrees = parseGitWorktreeList(sourceCwd);
|
|
17018
17147
|
const linkedWorktree = worktrees.find(
|
|
17019
|
-
(wt) => wt.branch === `refs/heads/${name}` ||
|
|
17148
|
+
(wt) => wt.branch === `refs/heads/${name}` || path20.resolve(wt.worktree) === path20.resolve(targetPath)
|
|
17020
17149
|
);
|
|
17021
17150
|
if (!hasBranch && !hasTargetDir && !hasInstanceData && !linkedWorktree) {
|
|
17022
17151
|
p17.log.info("Nothing to clean up \u2014 no branch, worktree directory, or instance data found.");
|
|
@@ -17134,7 +17263,7 @@ async function closeDb(db) {
|
|
|
17134
17263
|
}
|
|
17135
17264
|
function resolveCurrentEndpoint() {
|
|
17136
17265
|
return {
|
|
17137
|
-
rootPath:
|
|
17266
|
+
rootPath: path20.resolve(process.cwd()),
|
|
17138
17267
|
configPath: resolveConfigPath(),
|
|
17139
17268
|
label: "current",
|
|
17140
17269
|
isCurrent: true
|
|
@@ -17145,12 +17274,12 @@ function resolveAttachmentLookupStorages(input) {
|
|
|
17145
17274
|
input.sourceEndpoint.configPath,
|
|
17146
17275
|
resolveCurrentEndpoint().configPath,
|
|
17147
17276
|
input.targetEndpoint.configPath,
|
|
17148
|
-
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) =>
|
|
17277
|
+
...toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig).map((choice) => path20.resolve(choice.worktree, ".rudder", "config.json"))
|
|
17149
17278
|
];
|
|
17150
17279
|
const seen = /* @__PURE__ */ new Set();
|
|
17151
17280
|
const storages = [];
|
|
17152
17281
|
for (const configPath of orderedConfigPaths) {
|
|
17153
|
-
const resolved =
|
|
17282
|
+
const resolved = path20.resolve(configPath);
|
|
17154
17283
|
if (seen.has(resolved) || !existsSync3(resolved)) continue;
|
|
17155
17284
|
seen.add(resolved);
|
|
17156
17285
|
storages.push(openConfiguredStorage(resolved));
|
|
@@ -17569,7 +17698,7 @@ function resolveEndpointFromChoice(choice) {
|
|
|
17569
17698
|
}
|
|
17570
17699
|
return {
|
|
17571
17700
|
rootPath: choice.worktree,
|
|
17572
|
-
configPath:
|
|
17701
|
+
configPath: path20.resolve(choice.worktree, ".rudder", "config.json"),
|
|
17573
17702
|
label: choice.branchLabel,
|
|
17574
17703
|
isCurrent: false
|
|
17575
17704
|
};
|
|
@@ -17585,24 +17714,24 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
17585
17714
|
return currentEndpoint;
|
|
17586
17715
|
}
|
|
17587
17716
|
const choices = toMergeSourceChoices(process.cwd());
|
|
17588
|
-
const directPath =
|
|
17717
|
+
const directPath = path20.resolve(trimmed);
|
|
17589
17718
|
if (existsSync3(directPath)) {
|
|
17590
17719
|
if (allowCurrent && directPath === currentEndpoint.rootPath) {
|
|
17591
17720
|
return currentEndpoint;
|
|
17592
17721
|
}
|
|
17593
|
-
const configPath =
|
|
17722
|
+
const configPath = path20.resolve(directPath, ".rudder", "config.json");
|
|
17594
17723
|
if (!existsSync3(configPath)) {
|
|
17595
17724
|
throw new Error(`Resolved worktree path ${directPath} does not contain .rudder/config.json.`);
|
|
17596
17725
|
}
|
|
17597
17726
|
return {
|
|
17598
17727
|
rootPath: directPath,
|
|
17599
17728
|
configPath,
|
|
17600
|
-
label:
|
|
17729
|
+
label: path20.basename(directPath),
|
|
17601
17730
|
isCurrent: false
|
|
17602
17731
|
};
|
|
17603
17732
|
}
|
|
17604
17733
|
const matched = choices.find(
|
|
17605
|
-
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath ||
|
|
17734
|
+
(choice) => (allowCurrent || !choice.isCurrent) && (choice.worktree === directPath || path20.basename(choice.worktree) === trimmed || choice.branchLabel === trimmed)
|
|
17606
17735
|
);
|
|
17607
17736
|
if (!matched) {
|
|
17608
17737
|
throw new Error(
|
|
@@ -17615,9 +17744,9 @@ function resolveWorktreeEndpointFromSelector(selector, opts) {
|
|
|
17615
17744
|
return resolveEndpointFromChoice(matched);
|
|
17616
17745
|
}
|
|
17617
17746
|
async function promptForSourceEndpoint(excludeWorktreePath) {
|
|
17618
|
-
const excluded = excludeWorktreePath ?
|
|
17747
|
+
const excluded = excludeWorktreePath ? path20.resolve(excludeWorktreePath) : null;
|
|
17619
17748
|
const currentEndpoint = resolveCurrentEndpoint();
|
|
17620
|
-
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) =>
|
|
17749
|
+
const choices = toMergeSourceChoices(process.cwd()).filter((choice) => choice.hasRudderConfig || choice.isCurrent).filter((choice) => path20.resolve(choice.worktree) !== excluded).map((choice) => ({
|
|
17621
17750
|
value: choice.isCurrent ? "__current__" : choice.worktree,
|
|
17622
17751
|
label: choice.branchLabel,
|
|
17623
17752
|
hint: `${choice.worktree}${choice.isCurrent ? " (current)" : ""}`
|
|
@@ -17941,7 +18070,7 @@ async function worktreeMergeHistoryCommand(sourceArg, opts) {
|
|
|
17941
18070
|
}
|
|
17942
18071
|
const targetEndpoint = opts.to ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true }) : resolveCurrentEndpoint();
|
|
17943
18072
|
const sourceEndpoint = opts.from ? resolveWorktreeEndpointFromSelector(opts.from, { allowCurrent: true }) : sourceArg ? resolveWorktreeEndpointFromSelector(sourceArg, { allowCurrent: true }) : await promptForSourceEndpoint(targetEndpoint.rootPath);
|
|
17944
|
-
if (
|
|
18073
|
+
if (path20.resolve(sourceEndpoint.configPath) === path20.resolve(targetEndpoint.configPath)) {
|
|
17945
18074
|
throw new Error("Source and target Rudder configs are the same. Choose different --from/--to worktrees.");
|
|
17946
18075
|
}
|
|
17947
18076
|
const scopes = parseWorktreeMergeScopes(opts.scope);
|
|
@@ -18030,16 +18159,16 @@ function registerWorktreeCommands(program) {
|
|
|
18030
18159
|
}
|
|
18031
18160
|
|
|
18032
18161
|
// src/commands/client/plugin.ts
|
|
18033
|
-
import
|
|
18162
|
+
import path21 from "node:path";
|
|
18034
18163
|
import pc24 from "picocolors";
|
|
18035
18164
|
function resolvePackageArg(packageArg, isLocal) {
|
|
18036
18165
|
if (!isLocal) return packageArg;
|
|
18037
|
-
if (
|
|
18166
|
+
if (path21.isAbsolute(packageArg)) return packageArg;
|
|
18038
18167
|
if (packageArg.startsWith("~")) {
|
|
18039
18168
|
const home = process.env.HOME ?? process.env.USERPROFILE ?? "";
|
|
18040
|
-
return
|
|
18169
|
+
return path21.resolve(home, packageArg.slice(1).replace(/^[\\/]/, ""));
|
|
18041
18170
|
}
|
|
18042
|
-
return
|
|
18171
|
+
return path21.resolve(process.cwd(), packageArg);
|
|
18043
18172
|
}
|
|
18044
18173
|
function formatPlugin(p18) {
|
|
18045
18174
|
const statusColor = p18.status === "ready" ? pc24.green(p18.status) : p18.status === "error" ? pc24.red(p18.status) : p18.status === "disabled" ? pc24.dim(p18.status) : pc24.yellow(p18.status);
|
|
@@ -18311,7 +18440,7 @@ function registerClientAuthCommands(auth) {
|
|
|
18311
18440
|
|
|
18312
18441
|
// src/commands/benchmark-create-agent.ts
|
|
18313
18442
|
import fs14 from "node:fs/promises";
|
|
18314
|
-
import
|
|
18443
|
+
import path22 from "node:path";
|
|
18315
18444
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
18316
18445
|
import { LangfuseClient } from "@langfuse/client";
|
|
18317
18446
|
|
|
@@ -18860,11 +18989,11 @@ function createAgentEvalCheckToScoreValue(check) {
|
|
|
18860
18989
|
}
|
|
18861
18990
|
|
|
18862
18991
|
// src/commands/benchmark-create-agent.ts
|
|
18863
|
-
var __moduleDir2 =
|
|
18864
|
-
var repoRoot =
|
|
18865
|
-
var defaultCasesDir =
|
|
18866
|
-
var defaultSetsDir =
|
|
18867
|
-
var defaultArtifactsDir =
|
|
18992
|
+
var __moduleDir2 = path22.dirname(fileURLToPath5(import.meta.url));
|
|
18993
|
+
var repoRoot = path22.resolve(__moduleDir2, "../../..");
|
|
18994
|
+
var defaultCasesDir = path22.join(repoRoot, "benchmark", "create-agent", "cases");
|
|
18995
|
+
var defaultSetsDir = path22.join(repoRoot, "benchmark", "create-agent", "sets");
|
|
18996
|
+
var defaultArtifactsDir = path22.join(repoRoot, ".artifacts", "create-agent-benchmark");
|
|
18868
18997
|
var TERMINAL_RUN_STATUSES2 = /* @__PURE__ */ new Set(["succeeded", "failed", "cancelled", "timed_out"]);
|
|
18869
18998
|
var DEFAULT_JUDGE_PROMPT_NAME = "judge-create-agent";
|
|
18870
18999
|
var DEFAULT_JUDGE_MODEL = "gpt-5-mini";
|
|
@@ -18914,16 +19043,16 @@ async function readJsonFile(filePath) {
|
|
|
18914
19043
|
return JSON.parse(content);
|
|
18915
19044
|
}
|
|
18916
19045
|
async function writeJsonFile(filePath, value) {
|
|
18917
|
-
await fs14.mkdir(
|
|
19046
|
+
await fs14.mkdir(path22.dirname(filePath), { recursive: true });
|
|
18918
19047
|
await fs14.writeFile(filePath, `${JSON.stringify(value, null, 2)}
|
|
18919
19048
|
`, "utf8");
|
|
18920
19049
|
}
|
|
18921
19050
|
async function loadCaseById(caseId, casesDir) {
|
|
18922
|
-
const filePath =
|
|
19051
|
+
const filePath = path22.join(casesDir, `${caseId}.json`);
|
|
18923
19052
|
return parseCreateAgentCase(await readJsonFile(filePath));
|
|
18924
19053
|
}
|
|
18925
19054
|
async function loadSet(setName, setsDir) {
|
|
18926
|
-
const filePath =
|
|
19055
|
+
const filePath = path22.join(setsDir, `${setName}.json`);
|
|
18927
19056
|
const raw = await readJsonFile(filePath);
|
|
18928
19057
|
if (!Array.isArray(raw) || raw.some((item) => typeof item !== "string")) {
|
|
18929
19058
|
throw new Error(`Benchmark set ${setName} must be a JSON array of case IDs.`);
|
|
@@ -19011,13 +19140,13 @@ async function captureCreatedApprovals(api, approvals2) {
|
|
|
19011
19140
|
);
|
|
19012
19141
|
}
|
|
19013
19142
|
function resultRunDir(artifactsDir, testCase, runId) {
|
|
19014
|
-
return
|
|
19143
|
+
return path22.join(artifactsDir, "runs", `${testCase.id}-${runId}`);
|
|
19015
19144
|
}
|
|
19016
19145
|
function resultJsonPath(artifactsDir, testCase, runId) {
|
|
19017
|
-
return
|
|
19146
|
+
return path22.join(resultRunDir(artifactsDir, testCase, runId), "result.json");
|
|
19018
19147
|
}
|
|
19019
19148
|
function reportMarkdownPath(artifactsDir, testCase, runId) {
|
|
19020
|
-
return
|
|
19149
|
+
return path22.join(resultRunDir(artifactsDir, testCase, runId), "report.md");
|
|
19021
19150
|
}
|
|
19022
19151
|
function averageJudgeScore(judge) {
|
|
19023
19152
|
if (!judge || judge.status !== "completed") return null;
|
|
@@ -19426,7 +19555,7 @@ async function executeBenchmarkCase(caseId, opts) {
|
|
|
19426
19555
|
const jsonPath = resultJsonPath(artifactsDir, testCase, runDetail.run.id);
|
|
19427
19556
|
const markdownPath = reportMarkdownPath(artifactsDir, testCase, runDetail.run.id);
|
|
19428
19557
|
await writeJsonFile(jsonPath, provisionalResult);
|
|
19429
|
-
await fs14.mkdir(
|
|
19558
|
+
await fs14.mkdir(path22.dirname(markdownPath), { recursive: true });
|
|
19430
19559
|
await fs14.writeFile(markdownPath, buildMarkdownReport(provisionalResult), "utf8");
|
|
19431
19560
|
return provisionalResult;
|
|
19432
19561
|
}
|
|
@@ -19449,7 +19578,7 @@ async function rescoreStoredResult(resultPath, opts) {
|
|
|
19449
19578
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
19450
19579
|
}
|
|
19451
19580
|
await writeJsonFile(resultPath, result);
|
|
19452
|
-
await fs14.writeFile(
|
|
19581
|
+
await fs14.writeFile(path22.join(path22.dirname(resultPath), "report.md"), buildMarkdownReport(result), "utf8");
|
|
19453
19582
|
return result;
|
|
19454
19583
|
}
|
|
19455
19584
|
function printBenchmarkSummary(result, json = false) {
|
|
@@ -19518,7 +19647,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
19518
19647
|
addCommonClientOptions(
|
|
19519
19648
|
createAgent.command("rescore").description("Re-run deterministic scoring and optional judge for an existing result.json").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--queue-id <id>", "Langfuse annotation queue id for low-quality runs").option("--judge-model <model>", "Override the judge model").option("--no-sync-langfuse", "Skip Langfuse score sync").option("--no-judge", "Skip optional quality judge").action(async (resultPath, opts) => {
|
|
19520
19649
|
try {
|
|
19521
|
-
const result = await rescoreStoredResult(
|
|
19650
|
+
const result = await rescoreStoredResult(path22.resolve(resultPath), opts);
|
|
19522
19651
|
printBenchmarkSummary(result, Boolean(opts.json));
|
|
19523
19652
|
} catch (error) {
|
|
19524
19653
|
handleCommandError(error);
|
|
@@ -19528,11 +19657,11 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
19528
19657
|
addCommonClientOptions(
|
|
19529
19658
|
createAgent.command("sync-langfuse").description("Sync one stored create-agent benchmark result to Langfuse").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--queue-id <id>", "Langfuse annotation queue id for low-quality runs").action(async (resultPath, opts) => {
|
|
19530
19659
|
try {
|
|
19531
|
-
const result = await readJsonFile(
|
|
19660
|
+
const result = await readJsonFile(path22.resolve(resultPath));
|
|
19532
19661
|
const sync = await syncResultToLangfuse(result, { queueId: asString6(opts.queueId) });
|
|
19533
19662
|
result.langfuse.scoreSync = sync.scoreSync;
|
|
19534
19663
|
result.langfuse.scoreSyncError = sync.scoreSyncError;
|
|
19535
|
-
await writeJsonFile(
|
|
19664
|
+
await writeJsonFile(path22.resolve(resultPath), result);
|
|
19536
19665
|
printOutput({
|
|
19537
19666
|
caseId: result.case.id,
|
|
19538
19667
|
runId: result.runDetail.run.id,
|
|
@@ -19548,7 +19677,7 @@ function registerCreateAgentBenchmarkCommands(program) {
|
|
|
19548
19677
|
addCommonClientOptions(
|
|
19549
19678
|
createAgent.command("report").description("Render the markdown summary for an existing result.json").argument("<resultPath>", "Path to a stored create-agent benchmark result.json").option("--markdown", "Print report markdown instead of the parsed result summary", false).action(async (resultPath, opts) => {
|
|
19550
19679
|
try {
|
|
19551
|
-
const result = await readJsonFile(
|
|
19680
|
+
const result = await readJsonFile(path22.resolve(resultPath));
|
|
19552
19681
|
if (opts.markdown) {
|
|
19553
19682
|
process.stdout.write(buildMarkdownReport(result));
|
|
19554
19683
|
return;
|
|
@@ -19570,7 +19699,7 @@ var DATA_DIR_OPTION_HELP = "Rudder data directory root (isolates state from ~/.r
|
|
|
19570
19699
|
var LOCAL_ENV_OPTION_HELP = "Local environment profile (dev, prod_local, e2e)";
|
|
19571
19700
|
function createProgram() {
|
|
19572
19701
|
const program = new Command();
|
|
19573
|
-
program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version(
|
|
19702
|
+
program.name("rudder").description("Rudder CLI \u2014 setup, diagnose, and configure your instance").version(resolveCliVersion());
|
|
19574
19703
|
program.option("--local-env <name>", LOCAL_ENV_OPTION_HELP);
|
|
19575
19704
|
program.hook("preAction", (_thisCommand, actionCommand) => {
|
|
19576
19705
|
const options = actionCommand.optsWithGlobals();
|