@octonodes/cli 0.2.26 → 0.2.38

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.
@@ -839,7 +839,7 @@ var require_constants = __commonJS({
839
839
  "packages/schema/dist/constants.js"(exports2) {
840
840
  "use strict";
841
841
  Object.defineProperty(exports2, "__esModule", { value: true });
842
- exports2.PLUGIN_PUBLISH_MAX_BYTES = exports2.PLUGIN_CONFIG_MAX_BYTES = exports2.PLUGIN_PUBLISH_AUDIENCE = exports2.PLUGIN_RELEASE_FILES = exports2.CAPABILITY_UNAVAILABLE_REASONS = exports2.CAPABILITY_MODES = exports2.PLATFORM_CAPABILITIES = exports2.SOURCE_CONTROL_REGION_KINDS = exports2.TASK_RELEASE_STATES = exports2.TASK_SPRINT_STATES = exports2.TASK_LINK_TYPES = exports2.TASK_VIEW_SORTS = exports2.TASK_VIEW_GROUPS = exports2.TASK_VIEW_LAYOUTS = exports2.TASK_FIELD_TYPES = exports2.WORK_ITEM_PRIORITIES = exports2.BUILTIN_WORK_ITEM_TYPES = exports2.WORK_ITEM_LEVELS = exports2.TASK_STATUS_CATEGORIES = exports2.TASK_SPACE_TEMPLATES = exports2.COLLABORATION_ACTIONS = exports2.AGENT_TOOL_RISKS = exports2.AGENT_ERROR_CODES = exports2.AGENT_RUN_STATUSES = exports2.WORKSPACE_ACTIONS = exports2.SETTINGS_SECTIONS = exports2.SETTINGS_API_VERSION = exports2.MARKETPLACE_SCOPES = exports2.PLUGIN_DEFINITION_FILENAMES = exports2.PLUGIN_MANIFEST_FILENAME = exports2.COMMUNITY_MEDIA_TYPES = exports2.COMMUNITY_MEDIA_BODY_BYTES = exports2.COMMUNITY_MEDIA_VIDEO_BYTES = exports2.COMMUNITY_MEDIA_IMAGE_BYTES = exports2.PROJECT_JOB_PROTOCOL = exports2.PLUGIN_DEFAULT_LICENSE = exports2.PLUGIN_SCHEMA_VERSION = void 0;
842
+ exports2.PLUGIN_PUBLISH_MAX_BYTES = exports2.PLUGIN_CONFIG_MAX_BYTES = exports2.PLUGIN_PUBLISH_AUDIENCE = exports2.PLUGIN_RELEASE_FILES = exports2.CAPABILITY_UNAVAILABLE_REASONS = exports2.CAPABILITY_MODES = exports2.PLATFORM_CAPABILITIES = exports2.SOURCE_CONTROL_REGION_KINDS = exports2.TASK_ATTACHMENT_MIME_TYPES = exports2.TASK_ATTACHMENT_INLINE_MIME_TYPES = exports2.TASK_ATTACHMENT_WORKSPACE_QUOTA_BYTES = exports2.TASK_ATTACHMENT_ITEM_LIMIT = exports2.TASK_ATTACHMENT_MAX_BYTES = exports2.TASK_FIELD_OPTION_LIMIT = exports2.TASK_FIELD_LIMIT = exports2.WORK_ITEM_TYPE_LIMIT = exports2.TASK_STATUS_LIMIT = exports2.WORK_ITEM_TREE_LIMIT = exports2.WORK_ITEM_BULK_LIMIT = exports2.TASK_RELEASE_STATES = exports2.TASK_SPRINT_STATES = exports2.TASK_LINK_TYPES = exports2.TASK_VIEW_SORTS = exports2.TASK_VIEW_GROUPS = exports2.TASK_VIEW_LAYOUTS = exports2.TASK_FIELD_TYPES = exports2.WORK_ITEM_PRIORITIES = exports2.BUILTIN_WORK_ITEM_TYPES = exports2.WORK_ITEM_LEVELS = exports2.TASK_STATUS_CATEGORIES = exports2.TASK_SPACE_TEMPLATES = exports2.COLLABORATION_ACTIONS = exports2.AGENT_TOOL_RISKS = exports2.AGENT_ERROR_CODES = exports2.AGENT_RUN_STATUSES = exports2.WORKSPACE_ACTIONS = exports2.SETTINGS_SECTIONS = exports2.SETTINGS_API_VERSION = exports2.MARKETPLACE_SCOPES = exports2.PLUGIN_DEFINITION_FILENAMES = exports2.PLUGIN_MANIFEST_FILENAME = exports2.COMMUNITY_MEDIA_TYPES = exports2.COMMUNITY_MEDIA_BODY_BYTES = exports2.COMMUNITY_MEDIA_VIDEO_BYTES = exports2.COMMUNITY_MEDIA_IMAGE_BYTES = exports2.PROJECT_JOB_PROTOCOL = exports2.PLUGIN_DEFAULT_LICENSE = exports2.PLUGIN_SCHEMA_VERSION = void 0;
843
843
  exports2.PLUGIN_SCHEMA_VERSION = "1";
844
844
  exports2.PLUGIN_DEFAULT_LICENSE = "MIT";
845
845
  exports2.PROJECT_JOB_PROTOCOL = "octonode.project-job.v1";
@@ -906,7 +906,22 @@ var require_constants = __commonJS({
906
906
  "content:read",
907
907
  "content:write",
908
908
  "content:publish",
909
- "content:moderate"
909
+ "content:moderate",
910
+ "apps:read",
911
+ "apps:use",
912
+ "apps:manage",
913
+ "tokens:create",
914
+ "tokens:use",
915
+ "tokens:delegate",
916
+ "tokens:manage",
917
+ "policy:read",
918
+ "policy:manage",
919
+ "usage:read",
920
+ "usage:manage",
921
+ "remote:enroll",
922
+ "remote:connect",
923
+ "remote:execute",
924
+ "remote:manage"
910
925
  ];
911
926
  exports2.AGENT_RUN_STATUSES = [
912
927
  "queued",
@@ -929,6 +944,7 @@ var require_constants = __commonJS({
929
944
  "tool_failed",
930
945
  "step_limit",
931
946
  "token_limit",
947
+ "usage_limit",
932
948
  "permission_denied",
933
949
  "approval_denied",
934
950
  "conflict",
@@ -987,6 +1003,36 @@ var require_constants = __commonJS({
987
1003
  exports2.TASK_LINK_TYPES = ["blocks", "duplicates", "relates"];
988
1004
  exports2.TASK_SPRINT_STATES = ["future", "active", "completed"];
989
1005
  exports2.TASK_RELEASE_STATES = ["unreleased", "released", "archived"];
1006
+ exports2.WORK_ITEM_BULK_LIMIT = 100;
1007
+ exports2.WORK_ITEM_TREE_LIMIT = 1e3;
1008
+ exports2.TASK_STATUS_LIMIT = 20;
1009
+ exports2.WORK_ITEM_TYPE_LIMIT = 50;
1010
+ exports2.TASK_FIELD_LIMIT = 50;
1011
+ exports2.TASK_FIELD_OPTION_LIMIT = 100;
1012
+ exports2.TASK_ATTACHMENT_MAX_BYTES = 50 * 1024 * 1024;
1013
+ exports2.TASK_ATTACHMENT_ITEM_LIMIT = 50;
1014
+ exports2.TASK_ATTACHMENT_WORKSPACE_QUOTA_BYTES = 5 * 1024 * 1024 * 1024;
1015
+ exports2.TASK_ATTACHMENT_INLINE_MIME_TYPES = [
1016
+ "image/png",
1017
+ "image/jpeg",
1018
+ "image/gif",
1019
+ "image/webp",
1020
+ "image/avif",
1021
+ "video/mp4",
1022
+ "video/webm",
1023
+ "application/pdf"
1024
+ ];
1025
+ exports2.TASK_ATTACHMENT_MIME_TYPES = [
1026
+ ...exports2.TASK_ATTACHMENT_INLINE_MIME_TYPES,
1027
+ "text/plain",
1028
+ "text/markdown",
1029
+ "text/csv",
1030
+ "application/json",
1031
+ "application/zip",
1032
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
1033
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
1034
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation"
1035
+ ];
990
1036
  exports2.SOURCE_CONTROL_REGION_KINDS = [
991
1037
  "if",
992
1038
  "switch",
@@ -2593,12 +2639,13 @@ var require_data = __commonJS({
2593
2639
  return zod_1.z.null();
2594
2640
  if (schema.type === "array") {
2595
2641
  const prefix = (schema.prefixItems ?? []).map(nested);
2596
- let validator2 = zod_1.z.array(nested(schema.items ?? {}));
2642
+ const rest = schema.items === false ? zod_1.z.never() : nested(schema.items ?? {});
2643
+ let validator2 = zod_1.z.array(zod_1.z.unknown());
2597
2644
  if (typeof schema.minItems === "number")
2598
2645
  validator2 = validator2.min(schema.minItems);
2599
2646
  if (typeof schema.maxItems === "number")
2600
2647
  validator2 = validator2.max(schema.maxItems);
2601
- return validator2.refine((value) => value.every((item, index) => !prefix[index] || prefix[index].safeParse(item).success));
2648
+ return validator2.refine((value) => value.every((item, index) => (prefix[index] ?? rest).safeParse(item).success));
2602
2649
  }
2603
2650
  if (schema.type !== "object")
2604
2651
  return zod_1.z.unknown();
@@ -2649,13 +2696,237 @@ var require_layout2 = __commonJS({
2649
2696
  }
2650
2697
  });
2651
2698
 
2699
+ // packages/schema/dist/attachments/constants.js
2700
+ var require_constants2 = __commonJS({
2701
+ "packages/schema/dist/attachments/constants.js"(exports2) {
2702
+ "use strict";
2703
+ Object.defineProperty(exports2, "__esModule", { value: true });
2704
+ exports2.ATTACHMENT_ERRORS = exports2.ATTACHMENT_MIME_TYPES = exports2.ATTACHMENT_STATES = exports2.ATTACHMENT_LIMITS = void 0;
2705
+ exports2.ATTACHMENT_LIMITS = {
2706
+ workspaceFiles: 1e5,
2707
+ dailyReservations: 1e3,
2708
+ scanAttempts: 8,
2709
+ scanMs: 12e4,
2710
+ recoveryMs: 3e5,
2711
+ cleanupMs: 864e5,
2712
+ imageBytes: 10 * 1024 * 1024,
2713
+ fileBytes: 25 * 1024 * 1024,
2714
+ messageBytes: 50 * 1024 * 1024,
2715
+ messageFiles: 10,
2716
+ workspaceBytes: 1024 * 1024 * 1024,
2717
+ userUploads: 4,
2718
+ draftMs: 60 * 60 * 1e3,
2719
+ uploadMs: 5 * 60 * 1e3,
2720
+ processingBytes: 16 * 1024 * 1024,
2721
+ mediaBytes: 4 * 1024 * 1024,
2722
+ modelFiles: 10,
2723
+ modelImages: 10,
2724
+ modelPdfPages: 20,
2725
+ modelTextBytes: 64 * 1024,
2726
+ modelFileTextBytes: 32 * 1024,
2727
+ metadataBytes: 16 * 1024,
2728
+ textBytes: 128 * 1024,
2729
+ pdfPages: 100,
2730
+ imagePixels: 4e7
2731
+ };
2732
+ exports2.ATTACHMENT_STATES = [
2733
+ "reserved",
2734
+ "uploading",
2735
+ "scanning",
2736
+ "ready",
2737
+ "attached",
2738
+ "rejected",
2739
+ "expired",
2740
+ "deleted"
2741
+ ];
2742
+ exports2.ATTACHMENT_MIME_TYPES = [
2743
+ "image/jpeg",
2744
+ "image/png",
2745
+ "image/webp",
2746
+ "image/gif",
2747
+ "application/pdf",
2748
+ "text/plain",
2749
+ "text/markdown",
2750
+ "text/csv",
2751
+ "application/json",
2752
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
2753
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation",
2754
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
2755
+ ];
2756
+ exports2.ATTACHMENT_ERRORS = [
2757
+ "unsupported_type",
2758
+ "too_large",
2759
+ "quota_exceeded",
2760
+ "upload_expired",
2761
+ "scan_unavailable",
2762
+ "unsafe_file",
2763
+ "invalid_file",
2764
+ "processing_failed",
2765
+ "model_incompatible"
2766
+ ];
2767
+ }
2768
+ });
2769
+
2770
+ // packages/schema/dist/attachments/models.js
2771
+ var require_models = __commonJS({
2772
+ "packages/schema/dist/attachments/models.js"(exports2) {
2773
+ "use strict";
2774
+ Object.defineProperty(exports2, "__esModule", { value: true });
2775
+ exports2.attachmentModelCapabilities = attachmentModelCapabilities;
2776
+ function attachmentModelCapabilities(model) {
2777
+ const images = model.provider === "anthropic" && /^(sonnet|opus|haiku|claude-(?:3|haiku-4|sonnet-4|opus-4))/.test(model.model) || model.provider === "openai" && /^gpt-(?:4o|4\.1|5(?:\.\d+)?)(?:-|$)/.test(model.model) || model.provider === "google" && /^gemini-(?:2\.5|3)(?:-|\.)/.test(model.model);
2778
+ return { images, pdf: images, text: true };
2779
+ }
2780
+ }
2781
+ });
2782
+
2783
+ // packages/schema/dist/attachments/index.js
2784
+ var require_attachments = __commonJS({
2785
+ "packages/schema/dist/attachments/index.js"(exports2) {
2786
+ "use strict";
2787
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
2788
+ if (k2 === void 0) k2 = k;
2789
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2790
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2791
+ desc = { enumerable: true, get: function() {
2792
+ return m[k];
2793
+ } };
2794
+ }
2795
+ Object.defineProperty(o, k2, desc);
2796
+ }) : (function(o, m, k, k2) {
2797
+ if (k2 === void 0) k2 = k;
2798
+ o[k2] = m[k];
2799
+ }));
2800
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
2801
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
2802
+ };
2803
+ Object.defineProperty(exports2, "__esModule", { value: true });
2804
+ exports2.attachmentPolicySchema = exports2.attachmentModelMessagesSchema = exports2.attachmentModelBlockSchema = exports2.attachmentPdfPreviewSchema = exports2.attachmentProcessingSchema = exports2.attachmentPageSchema = exports2.attachmentStoredSchema = exports2.attachmentDerivativeSchema = exports2.attachmentManifestSchema = exports2.attachmentSummarySchema = exports2.attachmentUploadSchema = exports2.attachmentIdListSchema = exports2.attachmentMimeSchema = exports2.attachmentDomainSchema = void 0;
2805
+ var zod_1 = require("zod");
2806
+ var constants_js_1 = require_constants2();
2807
+ __exportStar(require_constants2(), exports2);
2808
+ __exportStar(require_models(), exports2);
2809
+ exports2.attachmentDomainSchema = zod_1.z.enum(["chat", "assistant", "support"]);
2810
+ exports2.attachmentMimeSchema = zod_1.z.enum(constants_js_1.ATTACHMENT_MIME_TYPES);
2811
+ exports2.attachmentIdListSchema = zod_1.z.array(zod_1.z.string().uuid()).max(constants_js_1.ATTACHMENT_LIMITS.messageFiles).refine((ids) => new Set(ids).size === ids.length, "Attachment IDs must be unique");
2812
+ exports2.attachmentUploadSchema = zod_1.z.object({
2813
+ name: zod_1.z.string().trim().min(1).max(240).refine((name) => !Array.from(name).some((char) => char.charCodeAt(0) < 32 || char.charCodeAt(0) === 127 || char === "/" || char === "\\"), "Invalid filename"),
2814
+ mime: exports2.attachmentMimeSchema,
2815
+ size: zod_1.z.number().int().positive().max(constants_js_1.ATTACHMENT_LIMITS.fileBytes)
2816
+ }).strict().refine(({ name }) => !/\.(?:html?|svg|exe|dll|bat|cmd|scr|com|msi|zip|rar|7z|xlsm|docm|pptm)$/i.test(name), "Unsupported filename extension").refine(({ mime, size }) => !mime.startsWith("image/") || size <= constants_js_1.ATTACHMENT_LIMITS.imageBytes, "Image exceeds size limit");
2817
+ exports2.attachmentSummarySchema = zod_1.z.object({
2818
+ id: zod_1.z.string().uuid(),
2819
+ conversationId: zod_1.z.string().uuid(),
2820
+ domain: exports2.attachmentDomainSchema,
2821
+ name: zod_1.z.string().min(1).max(240),
2822
+ mime: exports2.attachmentMimeSchema,
2823
+ size: zod_1.z.number().int().nonnegative(),
2824
+ state: zod_1.z.enum(constants_js_1.ATTACHMENT_STATES),
2825
+ version: zod_1.z.number().int().positive(),
2826
+ createdAt: zod_1.z.number().int().nonnegative(),
2827
+ expiresAt: zod_1.z.number().int().nonnegative(),
2828
+ errorCode: zod_1.z.enum(constants_js_1.ATTACHMENT_ERRORS).nullable(),
2829
+ width: zod_1.z.number().int().positive().nullable(),
2830
+ height: zod_1.z.number().int().positive().nullable(),
2831
+ pages: zod_1.z.number().int().positive().nullable(),
2832
+ previews: zod_1.z.array(zod_1.z.enum(["thumbnail", "image", "text", "pdf"])),
2833
+ messageId: zod_1.z.string().uuid().nullable()
2834
+ }).strict();
2835
+ exports2.attachmentManifestSchema = zod_1.z.object({
2836
+ id: zod_1.z.string().uuid(),
2837
+ name: zod_1.z.string().max(240),
2838
+ mime: exports2.attachmentMimeSchema,
2839
+ size: zod_1.z.number().int().positive().max(constants_js_1.ATTACHMENT_LIMITS.fileBytes),
2840
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
2841
+ pages: zod_1.z.array(zod_1.z.number().int().positive()).max(constants_js_1.ATTACHMENT_LIMITS.pdfPages).optional()
2842
+ }).strict();
2843
+ exports2.attachmentDerivativeSchema = zod_1.z.object({
2844
+ kind: zod_1.z.enum(["thumbnail", "image", "text", "pdf"]),
2845
+ key: zod_1.z.string().min(1).max(1024),
2846
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
2847
+ size: zod_1.z.number().int().nonnegative().max(constants_js_1.ATTACHMENT_LIMITS.fileBytes),
2848
+ mime: zod_1.z.string().max(128)
2849
+ }).strict();
2850
+ exports2.attachmentStoredSchema = zod_1.z.object({
2851
+ summary: exports2.attachmentSummarySchema,
2852
+ uploaderId: zod_1.z.string().min(1).max(128),
2853
+ attemptId: zod_1.z.string().uuid().nullable(),
2854
+ objectKey: zod_1.z.string().max(1024).nullable(),
2855
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/).nullable(),
2856
+ derivatives: zod_1.z.array(exports2.attachmentDerivativeSchema).max(4)
2857
+ }).strict();
2858
+ exports2.attachmentPageSchema = zod_1.z.object({
2859
+ items: zod_1.z.array(exports2.attachmentSummarySchema),
2860
+ nextCursor: zod_1.z.string().nullable()
2861
+ });
2862
+ exports2.attachmentProcessingSchema = zod_1.z.object({
2863
+ mime: exports2.attachmentMimeSchema,
2864
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
2865
+ width: zod_1.z.number().int().positive().max(4e4).nullable(),
2866
+ height: zod_1.z.number().int().positive().max(4e4).nullable(),
2867
+ pages: zod_1.z.number().int().positive().max(constants_js_1.ATTACHMENT_LIMITS.pdfPages).nullable(),
2868
+ scannerVersion: zod_1.z.string().min(1).max(128),
2869
+ derivatives: zod_1.z.array(zod_1.z.object({
2870
+ kind: zod_1.z.enum(["thumbnail", "image", "text", "pdf"]),
2871
+ mime: zod_1.z.string().max(128),
2872
+ data: zod_1.z.string().max(24 * 1024 * 1024)
2873
+ }).strict()).max(4)
2874
+ }).strict();
2875
+ exports2.attachmentPdfPreviewSchema = zod_1.z.object({
2876
+ totalPages: zod_1.z.number().int().positive().max(1e4),
2877
+ pages: zod_1.z.array(zod_1.z.object({
2878
+ page: zod_1.z.number().int().positive(),
2879
+ data: zod_1.z.string().regex(/^[A-Za-z0-9+/]*={0,2}$/).max(2 * 1024 * 1024)
2880
+ }).strict()).min(1).max(100)
2881
+ }).strict();
2882
+ exports2.attachmentModelBlockSchema = zod_1.z.discriminatedUnion("type", [
2883
+ zod_1.z.object({ type: zod_1.z.literal("text"), text: zod_1.z.string().max(constants_js_1.ATTACHMENT_LIMITS.textBytes + 1024) }).strict(),
2884
+ zod_1.z.object({
2885
+ type: zod_1.z.literal("image"),
2886
+ mime: zod_1.z.enum(["image/jpeg", "image/png", "image/webp"]),
2887
+ data: zod_1.z.string().max(24 * 1024 * 1024)
2888
+ }).strict(),
2889
+ zod_1.z.object({
2890
+ type: zod_1.z.literal("document"),
2891
+ mime: zod_1.z.literal("application/pdf"),
2892
+ data: zod_1.z.string().max(24 * 1024 * 1024),
2893
+ name: zod_1.z.string().max(240),
2894
+ textBytes: zod_1.z.number().int().nonnegative().max(constants_js_1.ATTACHMENT_LIMITS.modelFileTextBytes).optional()
2895
+ }).strict()
2896
+ ]);
2897
+ exports2.attachmentModelMessagesSchema = zod_1.z.array(zod_1.z.object({
2898
+ messageId: zod_1.z.string().uuid(),
2899
+ blocks: zod_1.z.array(exports2.attachmentModelBlockSchema).max(constants_js_1.ATTACHMENT_LIMITS.messageFiles * (constants_js_1.ATTACHMENT_LIMITS.pdfPages * 2 + 2))
2900
+ }).strict()).max(100);
2901
+ exports2.attachmentPolicySchema = zod_1.z.object({
2902
+ uploadsEnabled: zod_1.z.boolean(),
2903
+ modelInputEnabled: zod_1.z.boolean(),
2904
+ types: zod_1.z.array(exports2.attachmentMimeSchema),
2905
+ limits: zod_1.z.object({
2906
+ imageBytes: zod_1.z.number().int().positive(),
2907
+ fileBytes: zod_1.z.number().int().positive(),
2908
+ messageBytes: zod_1.z.number().int().positive(),
2909
+ messageFiles: zod_1.z.number().int().positive(),
2910
+ pdfPages: zod_1.z.number().int().positive(),
2911
+ modelFiles: zod_1.z.number().int().positive(),
2912
+ modelImages: zod_1.z.number().int().positive(),
2913
+ modelPdfPages: zod_1.z.number().int().positive(),
2914
+ modelEncodedBytes: zod_1.z.number().int().positive(),
2915
+ modelTextBytes: zod_1.z.number().int().positive(),
2916
+ modelFileTextBytes: zod_1.z.number().int().positive()
2917
+ }).strict()
2918
+ }).strict();
2919
+ }
2920
+ });
2921
+
2652
2922
  // packages/schema/dist/collaboration.js
2653
2923
  var require_collaboration = __commonJS({
2654
2924
  "packages/schema/dist/collaboration.js"(exports2) {
2655
2925
  "use strict";
2656
2926
  Object.defineProperty(exports2, "__esModule", { value: true });
2657
- exports2.collaborationErrorSchema = exports2.realtimeInvalidationSchema = exports2.githubPublicationStateSchema = exports2.notificationSchema = exports2.reviewSuggestionSchema = exports2.suggestionCreateSchema = exports2.reviewCommentSchema = exports2.reviewThreadCreateSchema = exports2.reviewThreadSchema = exports2.reviewAnchorSchema = exports2.reviewFragmentSchema = exports2.reviewContextSchema = exports2.pullRequestStateSchema = exports2.messageUpdateSchema = exports2.messageCreateSchema = exports2.messageSchema = exports2.assistantSessionListQuerySchema = exports2.assistantSessionOrderSchema = exports2.assistantSessionSortSchema = exports2.assistantSessionCreateSchema = exports2.conversationCreateSchema = exports2.conversationSchema = exports2.conversationKindSchema = exports2.workspaceAgentCreateSchema = exports2.workspaceAgentSchema = exports2.profileUpdateSchema = exports2.profileSchema = exports2.pageSchema = exports2.revisionSchema = exports2.sha256Schema = exports2.gitShaSchema = exports2.entityIdSchema = exports2.idempotencyKeySchema = exports2.opaqueCursorSchema = exports2.principalSchema = exports2.agentScopeSchema = exports2.collaborationActionSchema = exports2.workspaceRefSchema = exports2.workspaceKindSchema = void 0;
2927
+ exports2.collaborationErrorSchema = exports2.realtimeInvalidationSchema = exports2.githubPublicationStateSchema = exports2.notificationSchema = exports2.reviewSuggestionSchema = exports2.suggestionCreateSchema = exports2.reviewCommentSchema = exports2.reviewThreadCreateSchema = exports2.reviewThreadSchema = exports2.reviewAnchorSchema = exports2.reviewFragmentSchema = exports2.reviewContextSchema = exports2.pullRequestStateSchema = exports2.messageUpdateSchema = exports2.messageCreateSchema = exports2.messageSchema = exports2.assistantSessionListQuerySchema = exports2.assistantSessionOrderSchema = exports2.assistantSessionSortSchema = exports2.assistantSessionCreateSchema = exports2.conversationCreateSchema = exports2.conversationSchema = exports2.conversationKindSchema = exports2.workspaceAgentListQuerySchema = exports2.workspaceAgentCreateSchema = exports2.workspaceAgentSchema = exports2.profileUpdateSchema = exports2.profileSchema = exports2.pageSchema = exports2.revisionSchema = exports2.sha256Schema = exports2.gitShaSchema = exports2.entityIdSchema = exports2.idempotencyKeySchema = exports2.opaqueCursorSchema = exports2.principalSchema = exports2.agentScopeSchema = exports2.collaborationActionSchema = exports2.workspaceRefSchema = exports2.workspaceKindSchema = void 0;
2658
2928
  var zod_1 = require("zod");
2929
+ var index_js_1 = require_attachments();
2659
2930
  var constants_1 = require_constants();
2660
2931
  exports2.workspaceKindSchema = zod_1.z.enum(["user", "org", "team"]);
2661
2932
  exports2.workspaceRefSchema = zod_1.z.object({
@@ -2716,6 +2987,7 @@ var require_collaboration = __commonJS({
2716
2987
  projectId: zod_1.z.string().min(1).max(128).nullable().optional(),
2717
2988
  expiresAt: zod_1.z.number().int().positive().nullable().optional()
2718
2989
  }).strict();
2990
+ exports2.workspaceAgentListQuerySchema = zod_1.z.object({ projectId: zod_1.z.string().min(1).max(128).optional() });
2719
2991
  exports2.conversationKindSchema = zod_1.z.enum(["workspace", "group", "direct", "assistant"]);
2720
2992
  exports2.conversationSchema = zod_1.z.object({
2721
2993
  id: exports2.entityIdSchema,
@@ -2770,6 +3042,7 @@ var require_collaboration = __commonJS({
2770
3042
  origin: zod_1.z.enum(["octonode", "slack"]),
2771
3043
  replyToId: exports2.entityIdSchema.nullable(),
2772
3044
  body: zod_1.z.string().max(16384),
3045
+ attachments: zod_1.z.array(index_js_1.attachmentSummarySchema).max(10).optional(),
2773
3046
  version: exports2.revisionSchema,
2774
3047
  createdAt: zod_1.z.number().int().nonnegative(),
2775
3048
  editedAt: zod_1.z.number().int().positive().nullable(),
@@ -2778,12 +3051,14 @@ var require_collaboration = __commonJS({
2778
3051
  viewerReactions: zod_1.z.array(zod_1.z.string().max(32)).max(100)
2779
3052
  }).strict();
2780
3053
  exports2.messageCreateSchema = zod_1.z.object({
2781
- body: zod_1.z.string().min(1).max(16384),
3054
+ body: zod_1.z.string().max(16384),
3055
+ attachmentIds: index_js_1.attachmentIdListSchema.optional(),
2782
3056
  replyToId: exports2.entityIdSchema.nullable().optional(),
2783
3057
  clientMutationId: exports2.idempotencyKeySchema
2784
- }).strict();
3058
+ }).strict().refine(({ body, attachmentIds }) => !!body.trim() || !!attachmentIds?.length, "Message requires text or attachments");
2785
3059
  exports2.messageUpdateSchema = zod_1.z.object({
2786
- body: zod_1.z.string().min(1).max(16384),
3060
+ body: zod_1.z.string().max(16384),
3061
+ attachmentIds: index_js_1.attachmentIdListSchema.optional(),
2787
3062
  expectedVersion: exports2.revisionSchema
2788
3063
  }).strict();
2789
3064
  exports2.pullRequestStateSchema = zod_1.z.enum(["open", "closed", "merged"]);
@@ -2942,6 +3217,378 @@ var require_collaboration = __commonJS({
2942
3217
  }
2943
3218
  });
2944
3219
 
3220
+ // packages/schema/dist/support/constants.js
3221
+ var require_constants3 = __commonJS({
3222
+ "packages/schema/dist/support/constants.js"(exports2) {
3223
+ "use strict";
3224
+ Object.defineProperty(exports2, "__esModule", { value: true });
3225
+ exports2.SUPPORT_LIMITS = exports2.SUPPORT_QUEUES = exports2.SUPPORT_STATUSES = exports2.SUPPORT_ISSUE_TYPES = exports2.PLATFORM_SCOPES = void 0;
3226
+ exports2.PLATFORM_SCOPES = ["app-support"];
3227
+ exports2.SUPPORT_ISSUE_TYPES = [
3228
+ "app_not_working",
3229
+ "bug_report",
3230
+ "payment_issue",
3231
+ "account_access",
3232
+ "how_to",
3233
+ "other"
3234
+ ];
3235
+ exports2.SUPPORT_STATUSES = ["queued", "open", "waiting_customer", "waiting_internal", "closed"];
3236
+ exports2.SUPPORT_QUEUES = [
3237
+ "active",
3238
+ "unassigned",
3239
+ "mine",
3240
+ "needs_response",
3241
+ "overdue",
3242
+ "waiting",
3243
+ "closed",
3244
+ "all"
3245
+ ];
3246
+ exports2.SUPPORT_LIMITS = {
3247
+ page: 50,
3248
+ maxPage: 100,
3249
+ dailyRequests: 20,
3250
+ activeRequests: 10,
3251
+ realtimeTtlMs: 3e4,
3252
+ sessionMs: 3e5,
3253
+ socketLimit: 200,
3254
+ uploadBytes: 1e7
3255
+ };
3256
+ }
3257
+ });
3258
+
3259
+ // packages/schema/dist/support/schema.js
3260
+ var require_schema2 = __commonJS({
3261
+ "packages/schema/dist/support/schema.js"(exports2) {
3262
+ "use strict";
3263
+ Object.defineProperty(exports2, "__esModule", { value: true });
3264
+ exports2.supportUserProfileSchema = exports2.supportLabelsInputSchema = exports2.supportLabelsSchema = exports2.supportUnreadSchema = exports2.supportNotificationPageSchema = exports2.supportNotificationSchema = exports2.supportSettingsInputSchema = exports2.supportSettingsSchema = exports2.supportTemplateInputSchema = exports2.supportTemplateSchema = exports2.supportReportSchema = exports2.supportReadSchema = exports2.supportRealtimeTicketSchema = exports2.supportRealtimeRequestSchema = exports2.supportAccessSchema = exports2.supportGrantSchema = exports2.supportAgentSchema = exports2.supportNoteViewSchema = exports2.supportActivitySchema = exports2.supportMessagePageSchema = exports2.supportTicketPageSchema = exports2.supportTicketSchema = exports2.supportListQuerySchema = exports2.supportNoteSchema = exports2.supportTakeSchema = exports2.supportStateSchema = exports2.supportCloseSchema = exports2.supportTransferSchema = exports2.supportReplySchema = exports2.supportCreateSchema = exports2.supportMutationSchema = exports2.supportStatusSchema = exports2.supportIssueTypeSchema = exports2.platformScopeSchema = void 0;
3265
+ var zod_1 = require("zod");
3266
+ var index_js_1 = require_attachments();
3267
+ var collaboration_js_1 = require_collaboration();
3268
+ var constants_js_1 = require_constants3();
3269
+ exports2.platformScopeSchema = zod_1.z.enum(constants_js_1.PLATFORM_SCOPES);
3270
+ exports2.supportIssueTypeSchema = zod_1.z.enum(constants_js_1.SUPPORT_ISSUE_TYPES);
3271
+ exports2.supportStatusSchema = zod_1.z.enum(constants_js_1.SUPPORT_STATUSES);
3272
+ exports2.supportMutationSchema = zod_1.z.object({ clientMutationId: zod_1.z.string().uuid(), expectedVersion: zod_1.z.number().int().positive() }).strict();
3273
+ exports2.supportCreateSchema = zod_1.z.object({
3274
+ clientMutationId: zod_1.z.string().uuid(),
3275
+ issueType: exports2.supportIssueTypeSchema,
3276
+ subject: zod_1.z.string().trim().min(1).max(200),
3277
+ description: zod_1.z.string().trim().min(1).max(16384),
3278
+ intakeId: zod_1.z.string().uuid().optional(),
3279
+ attachmentIds: index_js_1.attachmentIdListSchema.optional(),
3280
+ source: zod_1.z.enum(["studio", "landing"]).default("studio"),
3281
+ followUpOfTicketId: zod_1.z.string().uuid().optional()
3282
+ }).strict();
3283
+ exports2.supportReplySchema = exports2.supportMutationSchema.extend({
3284
+ body: zod_1.z.string().trim().max(16384),
3285
+ attachmentIds: index_js_1.attachmentIdListSchema.optional()
3286
+ });
3287
+ exports2.supportTransferSchema = exports2.supportMutationSchema.extend({
3288
+ assigneeId: zod_1.z.string().uuid(),
3289
+ reason: zod_1.z.string().trim().min(1).max(2e3)
3290
+ });
3291
+ exports2.supportCloseSchema = exports2.supportMutationSchema.extend({ summary: zod_1.z.string().trim().min(1).max(4e3) });
3292
+ exports2.supportStateSchema = exports2.supportMutationSchema.extend({
3293
+ status: zod_1.z.enum(["open", "waiting_customer", "waiting_internal"])
3294
+ });
3295
+ exports2.supportTakeSchema = exports2.supportMutationSchema.extend({
3296
+ reason: zod_1.z.string().trim().min(1).max(2e3).optional()
3297
+ });
3298
+ exports2.supportNoteSchema = exports2.supportMutationSchema.extend({ body: zod_1.z.string().trim().min(1).max(16384) });
3299
+ exports2.supportListQuerySchema = zod_1.z.object({
3300
+ view: zod_1.z.enum(constants_js_1.SUPPORT_QUEUES).default("active"),
3301
+ cursor: zod_1.z.string().max(2048).optional(),
3302
+ issueType: exports2.supportIssueTypeSchema.optional(),
3303
+ assigneeId: zod_1.z.string().uuid().optional(),
3304
+ priority: zod_1.z.enum(["low", "normal", "high", "urgent"]).optional(),
3305
+ tag: zod_1.z.string().trim().min(1).max(40).optional(),
3306
+ sort: zod_1.z.enum(["recent", "oldest"]).optional(),
3307
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(50),
3308
+ q: zod_1.z.string().trim().max(200).default("")
3309
+ });
3310
+ exports2.supportTicketSchema = zod_1.z.object({
3311
+ id: zod_1.z.string().uuid(),
3312
+ number: zod_1.z.number().int().positive(),
3313
+ conversationId: zod_1.z.string().uuid(),
3314
+ requesterId: zod_1.z.string().uuid(),
3315
+ issueType: exports2.supportIssueTypeSchema,
3316
+ subject: zod_1.z.string(),
3317
+ status: exports2.supportStatusSchema,
3318
+ source: zod_1.z.enum(["studio", "landing"]),
3319
+ assigneeId: zod_1.z.string().uuid().nullable(),
3320
+ acceptedBy: zod_1.z.string().uuid().nullable(),
3321
+ acceptedAt: zod_1.z.number().nullable(),
3322
+ closedBy: zod_1.z.string().uuid().nullable(),
3323
+ closedAt: zod_1.z.number().nullable(),
3324
+ closeSummary: zod_1.z.string().nullable(),
3325
+ followUpOfTicketId: zod_1.z.string().uuid().nullable(),
3326
+ version: zod_1.z.number().int().positive(),
3327
+ createdAt: zod_1.z.number(),
3328
+ updatedAt: zod_1.z.number(),
3329
+ firstResponseAt: zod_1.z.number().nullable(),
3330
+ lastMessageAt: zod_1.z.number(),
3331
+ unread: zod_1.z.number().int().nonnegative()
3332
+ });
3333
+ exports2.supportTicketPageSchema = zod_1.z.object({
3334
+ items: exports2.supportTicketSchema.array(),
3335
+ nextCursor: zod_1.z.string().nullable()
3336
+ });
3337
+ exports2.supportMessagePageSchema = zod_1.z.object({ items: collaboration_js_1.messageSchema.array(), nextCursor: zod_1.z.string().nullable() });
3338
+ exports2.supportActivitySchema = zod_1.z.object({
3339
+ id: zod_1.z.string().uuid(),
3340
+ seq: zod_1.z.number(),
3341
+ ticketId: zod_1.z.string().uuid(),
3342
+ actorId: zod_1.z.string().uuid(),
3343
+ kind: zod_1.z.string(),
3344
+ previousAssigneeId: zod_1.z.string().uuid().nullable(),
3345
+ assigneeId: zod_1.z.string().uuid().nullable(),
3346
+ reason: zod_1.z.string().nullable(),
3347
+ status: exports2.supportStatusSchema,
3348
+ version: zod_1.z.number(),
3349
+ createdAt: zod_1.z.number()
3350
+ });
3351
+ exports2.supportNoteViewSchema = zod_1.z.object({
3352
+ id: zod_1.z.string().uuid(),
3353
+ seq: zod_1.z.number(),
3354
+ actorId: zod_1.z.string().uuid(),
3355
+ body: zod_1.z.string(),
3356
+ createdAt: zod_1.z.number()
3357
+ });
3358
+ exports2.supportAgentSchema = zod_1.z.object({
3359
+ userId: zod_1.z.string().uuid(),
3360
+ email: zod_1.z.string().nullable(),
3361
+ version: zod_1.z.number(),
3362
+ grantedAt: zod_1.z.number(),
3363
+ grantedBy: zod_1.z.string().uuid()
3364
+ });
3365
+ exports2.supportGrantSchema = zod_1.z.object({
3366
+ enabled: zod_1.z.boolean(),
3367
+ expectedVersion: zod_1.z.number().int().nonnegative(),
3368
+ reason: zod_1.z.string().trim().min(1).max(2e3),
3369
+ clientMutationId: zod_1.z.string().uuid()
3370
+ }).strict();
3371
+ exports2.supportAccessSchema = zod_1.z.object({
3372
+ uploads: zod_1.z.boolean(),
3373
+ available: zod_1.z.boolean(),
3374
+ staff: zod_1.z.boolean(),
3375
+ canManageAgents: zod_1.z.boolean(),
3376
+ userId: zod_1.z.string().uuid()
3377
+ });
3378
+ exports2.supportRealtimeRequestSchema = zod_1.z.object({ ticketId: zod_1.z.string().uuid().optional(), staff: zod_1.z.boolean().default(false) }).strict();
3379
+ exports2.supportRealtimeTicketSchema = zod_1.z.object({ ticket: zod_1.z.string(), expiresAt: zod_1.z.number(), path: zod_1.z.string() });
3380
+ exports2.supportReadSchema = zod_1.z.object({ sequence: zod_1.z.number().int().nonnegative() }).strict();
3381
+ exports2.supportReportSchema = zod_1.z.object({
3382
+ queued: zod_1.z.number(),
3383
+ active: zod_1.z.number(),
3384
+ closed: zod_1.z.number(),
3385
+ overdue: zod_1.z.number(),
3386
+ transfers: zod_1.z.number(),
3387
+ meanAcceptanceMs: zod_1.z.number().nullable(),
3388
+ meanResponseMs: zod_1.z.number().nullable(),
3389
+ meanResolutionMs: zod_1.z.number().nullable()
3390
+ });
3391
+ exports2.supportTemplateSchema = zod_1.z.object({
3392
+ id: zod_1.z.string().uuid(),
3393
+ title: zod_1.z.string().trim().min(1).max(100),
3394
+ body: zod_1.z.string().trim().min(1).max(16384),
3395
+ version: zod_1.z.number().int().positive()
3396
+ });
3397
+ exports2.supportTemplateInputSchema = exports2.supportTemplateSchema.pick({ title: true, body: true }).extend({ expectedVersion: zod_1.z.number().int().nonnegative() }).strict();
3398
+ exports2.supportSettingsSchema = zod_1.z.object({
3399
+ version: zod_1.z.number().int().positive(),
3400
+ responseTargetMinutes: zod_1.z.number().int().min(1).max(43200).nullable(),
3401
+ retentionDays: zod_1.z.number().int().min(1).max(3650).nullable()
3402
+ });
3403
+ exports2.supportSettingsInputSchema = exports2.supportSettingsSchema.omit({ version: true }).extend({ expectedVersion: zod_1.z.number().int().positive() }).strict();
3404
+ exports2.supportNotificationSchema = zod_1.z.object({
3405
+ id: zod_1.z.string().uuid(),
3406
+ seq: zod_1.z.number(),
3407
+ ticketId: zod_1.z.string().uuid(),
3408
+ kind: zod_1.z.string(),
3409
+ createdAt: zod_1.z.number(),
3410
+ readAt: zod_1.z.number().nullable()
3411
+ });
3412
+ exports2.supportNotificationPageSchema = zod_1.z.object({
3413
+ items: exports2.supportNotificationSchema.array(),
3414
+ nextCursor: zod_1.z.string().nullable()
3415
+ });
3416
+ exports2.supportUnreadSchema = zod_1.z.object({
3417
+ unread: zod_1.z.number().int().nonnegative(),
3418
+ liveTickets: zod_1.z.number().int().nonnegative()
3419
+ });
3420
+ exports2.supportLabelsSchema = zod_1.z.object({
3421
+ priority: zod_1.z.enum(["low", "normal", "high", "urgent"]),
3422
+ tags: zod_1.z.array(zod_1.z.string().trim().min(1).max(40)).max(10).refine((tags) => new Set(tags).size === tags.length, "Tags must be unique")
3423
+ }).strict();
3424
+ exports2.supportLabelsInputSchema = exports2.supportLabelsSchema.extend({
3425
+ clientMutationId: zod_1.z.string().uuid(),
3426
+ expectedVersion: zod_1.z.number().int().positive()
3427
+ });
3428
+ exports2.supportUserProfileSchema = zod_1.z.object({
3429
+ userId: zod_1.z.string().uuid(),
3430
+ email: zod_1.z.string().nullable(),
3431
+ displayName: zod_1.z.string().nullable(),
3432
+ createdAt: zod_1.z.number()
3433
+ });
3434
+ }
3435
+ });
3436
+
3437
+ // packages/schema/dist/support/types.js
3438
+ var require_types = __commonJS({
3439
+ "packages/schema/dist/support/types.js"(exports2) {
3440
+ "use strict";
3441
+ Object.defineProperty(exports2, "__esModule", { value: true });
3442
+ }
3443
+ });
3444
+
3445
+ // packages/schema/dist/support/recovery/constants.js
3446
+ var require_constants4 = __commonJS({
3447
+ "packages/schema/dist/support/recovery/constants.js"(exports2) {
3448
+ "use strict";
3449
+ Object.defineProperty(exports2, "__esModule", { value: true });
3450
+ exports2.SUPPORT_ARCHIVE_MAX_BYTES = exports2.SUPPORT_ARCHIVE_PAGE_SIZE = exports2.SUPPORT_ARCHIVE_TABLES = exports2.SUPPORT_ARCHIVE_VERSION = void 0;
3451
+ exports2.SUPPORT_ARCHIVE_VERSION = 1;
3452
+ exports2.SUPPORT_ARCHIVE_TABLES = [
3453
+ "conversations",
3454
+ "conversation_members",
3455
+ "messages",
3456
+ "message_reactions",
3457
+ "attachments",
3458
+ "message_attachments",
3459
+ "support_tickets",
3460
+ "support_intakes",
3461
+ "support_activity",
3462
+ "support_labels",
3463
+ "support_notes",
3464
+ "support_reads",
3465
+ "support_replays",
3466
+ "support_templates",
3467
+ "support_notifications",
3468
+ "support_settings",
3469
+ "support_admin_events",
3470
+ "support_deadline_alerts",
3471
+ "support_erased_users",
3472
+ "support_erased_tickets"
3473
+ ];
3474
+ exports2.SUPPORT_ARCHIVE_PAGE_SIZE = 25;
3475
+ exports2.SUPPORT_ARCHIVE_MAX_BYTES = 1048576;
3476
+ }
3477
+ });
3478
+
3479
+ // packages/schema/dist/support/recovery/schema.js
3480
+ var require_schema3 = __commonJS({
3481
+ "packages/schema/dist/support/recovery/schema.js"(exports2) {
3482
+ "use strict";
3483
+ Object.defineProperty(exports2, "__esModule", { value: true });
3484
+ exports2.supportMaintenanceViewSchema = exports2.supportArchiveManifestSchema = exports2.supportArchivePageSchema = exports2.supportMaintenanceInputSchema = void 0;
3485
+ var zod_1 = require("zod");
3486
+ var constants_js_1 = require_constants4();
3487
+ exports2.supportMaintenanceInputSchema = zod_1.z.object({
3488
+ clientMutationId: zod_1.z.string().uuid(),
3489
+ expectedEpoch: zod_1.z.number().int().positive(),
3490
+ kind: zod_1.z.enum(["backup", "restore", "erase"]),
3491
+ backupId: zod_1.z.string().uuid().optional(),
3492
+ userId: zod_1.z.string().uuid().optional(),
3493
+ ticketId: zod_1.z.string().uuid().optional(),
3494
+ reason: zod_1.z.string().trim().min(1).max(2e3)
3495
+ }).strict().superRefine((input, ctx) => {
3496
+ if (input.kind === "restore" && !input.backupId)
3497
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: "backupId required" });
3498
+ if (input.kind === "erase" && Number(!!input.userId) + Number(!!input.ticketId) !== 1)
3499
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: "exactly one erasure target required" });
3500
+ if (input.kind !== "erase" && (input.userId || input.ticketId) || input.kind !== "restore" && input.backupId)
3501
+ ctx.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: "unexpected target" });
3502
+ });
3503
+ exports2.supportArchivePageSchema = zod_1.z.object({
3504
+ table: zod_1.z.enum(constants_js_1.SUPPORT_ARCHIVE_TABLES),
3505
+ rows: zod_1.z.record(zod_1.z.union([zod_1.z.string(), zod_1.z.number().finite(), zod_1.z.null()])).array().max(constants_js_1.SUPPORT_ARCHIVE_PAGE_SIZE)
3506
+ }).strict();
3507
+ exports2.supportArchiveManifestSchema = zod_1.z.object({
3508
+ version: zod_1.z.literal(constants_js_1.SUPPORT_ARCHIVE_VERSION),
3509
+ desk: zod_1.z.literal("octonode"),
3510
+ id: zod_1.z.string().uuid(),
3511
+ generation: zod_1.z.number().int().positive(),
3512
+ pages: zod_1.z.number().int().nonnegative(),
3513
+ chain: zod_1.z.string().regex(/^[0-9a-f]{64}$/),
3514
+ counts: zod_1.z.record(zod_1.z.number().int().nonnegative()),
3515
+ createdAt: zod_1.z.number().int()
3516
+ }).strict();
3517
+ exports2.supportMaintenanceViewSchema = zod_1.z.object({
3518
+ id: zod_1.z.string().uuid(),
3519
+ kind: zod_1.z.enum(["backup", "restore", "erase"]),
3520
+ status: zod_1.z.enum(["running", "failed", "complete", "cancelled"]),
3521
+ phase: zod_1.z.string(),
3522
+ createdAt: zod_1.z.number(),
3523
+ updatedAt: zod_1.z.number(),
3524
+ error: zod_1.z.string().nullable()
3525
+ });
3526
+ }
3527
+ });
3528
+
3529
+ // packages/schema/dist/support/recovery/types.js
3530
+ var require_types2 = __commonJS({
3531
+ "packages/schema/dist/support/recovery/types.js"(exports2) {
3532
+ "use strict";
3533
+ Object.defineProperty(exports2, "__esModule", { value: true });
3534
+ }
3535
+ });
3536
+
3537
+ // packages/schema/dist/support/recovery/index.js
3538
+ var require_recovery = __commonJS({
3539
+ "packages/schema/dist/support/recovery/index.js"(exports2) {
3540
+ "use strict";
3541
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
3542
+ if (k2 === void 0) k2 = k;
3543
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3544
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3545
+ desc = { enumerable: true, get: function() {
3546
+ return m[k];
3547
+ } };
3548
+ }
3549
+ Object.defineProperty(o, k2, desc);
3550
+ }) : (function(o, m, k, k2) {
3551
+ if (k2 === void 0) k2 = k;
3552
+ o[k2] = m[k];
3553
+ }));
3554
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
3555
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
3556
+ };
3557
+ Object.defineProperty(exports2, "__esModule", { value: true });
3558
+ __exportStar(require_constants4(), exports2);
3559
+ __exportStar(require_schema3(), exports2);
3560
+ __exportStar(require_types2(), exports2);
3561
+ }
3562
+ });
3563
+
3564
+ // packages/schema/dist/support/index.js
3565
+ var require_support = __commonJS({
3566
+ "packages/schema/dist/support/index.js"(exports2) {
3567
+ "use strict";
3568
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
3569
+ if (k2 === void 0) k2 = k;
3570
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3571
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
3572
+ desc = { enumerable: true, get: function() {
3573
+ return m[k];
3574
+ } };
3575
+ }
3576
+ Object.defineProperty(o, k2, desc);
3577
+ }) : (function(o, m, k, k2) {
3578
+ if (k2 === void 0) k2 = k;
3579
+ o[k2] = m[k];
3580
+ }));
3581
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
3582
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
3583
+ };
3584
+ Object.defineProperty(exports2, "__esModule", { value: true });
3585
+ __exportStar(require_constants3(), exports2);
3586
+ __exportStar(require_schema2(), exports2);
3587
+ __exportStar(require_types(), exports2);
3588
+ __exportStar(require_recovery(), exports2);
3589
+ }
3590
+ });
3591
+
2945
3592
  // packages/schema/dist/task-management/common.js
2946
3593
  var require_common = __commonJS({
2947
3594
  "packages/schema/dist/task-management/common.js"(exports2) {
@@ -2971,6 +3618,10 @@ var require_common = __commonJS({
2971
3618
  name: exports2.taskNameSchema,
2972
3619
  description: exports2.taskDescriptionSchema,
2973
3620
  sprintsEnabled: zod_1.z.boolean(),
3621
+ /** Finishing an item needs every open child finished first. */
3622
+ blockDoneWithOpenChildren: zod_1.z.boolean(),
3623
+ /** Finishing the last open child finishes its parent. */
3624
+ autoCloseParent: zod_1.z.boolean(),
2974
3625
  version: collaboration_1.revisionSchema,
2975
3626
  createdAt: exports2.taskTimestampSchema,
2976
3627
  updatedAt: exports2.taskTimestampSchema,
@@ -2987,6 +3638,8 @@ var require_common = __commonJS({
2987
3638
  name: exports2.taskNameSchema.optional(),
2988
3639
  description: exports2.taskDescriptionSchema.optional(),
2989
3640
  sprintsEnabled: zod_1.z.boolean().optional(),
3641
+ blockDoneWithOpenChildren: zod_1.z.boolean().optional(),
3642
+ autoCloseParent: zod_1.z.boolean().optional(),
2990
3643
  expectedVersion: collaboration_1.revisionSchema
2991
3644
  }).strict().refine((changes) => Object.keys(changes).length > 1, "at least one task space change is required");
2992
3645
  exports2.taskStatusSchema = zod_1.z.object({
@@ -3264,7 +3917,7 @@ var require_items = __commonJS({
3264
3917
  "packages/schema/dist/task-management/work/items.js"(exports2) {
3265
3918
  "use strict";
3266
3919
  Object.defineProperty(exports2, "__esModule", { value: true });
3267
- exports2.workItemLinkMutationSchema = exports2.workItemMoveSchema = exports2.workItemUpdateSchema = exports2.workItemCreateSchema = exports2.workItemSchema = exports2.workItemPullRequestLinkSchema = exports2.workItemWorkflowLinkSchema = exports2.workItemLinkSchema = exports2.taskLinkTypeSchema = void 0;
3920
+ exports2.workItemMineQuerySchema = exports2.workItemLinkMutationSchema = exports2.workItemMoveSchema = exports2.workItemBulkSchema = exports2.workItemUpdateSchema = exports2.workItemCreateSchema = exports2.workItemSchema = exports2.workItemDesignDocLinkSchema = exports2.workItemPullRequestLinkSchema = exports2.workItemWorkflowLinkSchema = exports2.workItemLinkSchema = exports2.taskLinkTypeSchema = void 0;
3268
3921
  var zod_1 = require("zod");
3269
3922
  var constants_1 = require_constants();
3270
3923
  var collaboration_1 = require_collaboration();
@@ -3292,6 +3945,12 @@ var require_items = __commonJS({
3292
3945
  createdBy: common_1.taskUserIdSchema,
3293
3946
  createdAt: common_1.taskTimestampSchema
3294
3947
  }).strict();
3948
+ exports2.workItemDesignDocLinkSchema = zod_1.z.object({
3949
+ itemId: collaboration_1.entityIdSchema,
3950
+ documentId: collaboration_1.entityIdSchema,
3951
+ createdBy: common_1.taskUserIdSchema,
3952
+ createdAt: common_1.taskTimestampSchema
3953
+ }).strict();
3295
3954
  exports2.workItemSchema = zod_1.z.object({
3296
3955
  id: collaboration_1.entityIdSchema,
3297
3956
  key: common_1.workItemKeySchema,
@@ -3315,7 +3974,8 @@ var require_items = __commonJS({
3315
3974
  links: zod_1.z.object({
3316
3975
  items: zod_1.z.array(exports2.workItemLinkSchema).max(100),
3317
3976
  workflows: zod_1.z.array(exports2.workItemWorkflowLinkSchema).max(100),
3318
- pullRequests: zod_1.z.array(exports2.workItemPullRequestLinkSchema).max(100)
3977
+ pullRequests: zod_1.z.array(exports2.workItemPullRequestLinkSchema).max(100),
3978
+ designDocs: zod_1.z.array(exports2.workItemDesignDocLinkSchema).max(100)
3319
3979
  }).strict(),
3320
3980
  version: collaboration_1.revisionSchema,
3321
3981
  createdAt: common_1.taskTimestampSchema,
@@ -3355,7 +4015,7 @@ var require_items = __commonJS({
3355
4015
  releaseIds: workItemMutationShape.releaseIds.optional(),
3356
4016
  clientMutationId: collaboration_1.idempotencyKeySchema
3357
4017
  }).strict();
3358
- exports2.workItemUpdateSchema = zod_1.z.object({
4018
+ var workItemChangesShape = {
3359
4019
  typeId: workItemMutationShape.typeId.optional(),
3360
4020
  title: workItemMutationShape.title.optional(),
3361
4021
  description: workItemMutationShape.description.optional(),
@@ -3369,9 +4029,29 @@ var require_items = __commonJS({
3369
4029
  dueAt: workItemMutationShape.dueAt.optional(),
3370
4030
  fieldValues: workItemMutationShape.fieldValues.optional(),
3371
4031
  tagIds: workItemMutationShape.tagIds.optional(),
3372
- releaseIds: workItemMutationShape.releaseIds.optional(),
3373
- expectedVersion: collaboration_1.revisionSchema
3374
- }).strict().refine((changes) => Object.keys(changes).length > 1, "at least one work item change is required");
4032
+ releaseIds: workItemMutationShape.releaseIds.optional()
4033
+ };
4034
+ exports2.workItemUpdateSchema = zod_1.z.object({ ...workItemChangesShape, expectedVersion: collaboration_1.revisionSchema }).strict().refine((changes) => Object.keys(changes).length > 1, "at least one work item change is required");
4035
+ var workItemVersionedRefSchema = zod_1.z.object({ itemId: collaboration_1.entityIdSchema, expectedVersion: collaboration_1.revisionSchema }).strict();
4036
+ exports2.workItemBulkSchema = zod_1.z.object({
4037
+ create: zod_1.z.array(exports2.workItemCreateSchema.omit({ clientMutationId: true })).max(constants_1.WORK_ITEM_BULK_LIMIT).default([]),
4038
+ update: zod_1.z.array(workItemVersionedRefSchema.extend({
4039
+ changes: zod_1.z.object(workItemChangesShape).strict().refine((changes) => Object.keys(changes).length > 0, "at least one work item change is required")
4040
+ }).strict()).max(constants_1.WORK_ITEM_BULK_LIMIT).default([]),
4041
+ archive: zod_1.z.array(workItemVersionedRefSchema).max(constants_1.WORK_ITEM_BULK_LIMIT).default([]),
4042
+ restore: zod_1.z.array(workItemVersionedRefSchema).max(constants_1.WORK_ITEM_BULK_LIMIT).default([]),
4043
+ clientMutationId: collaboration_1.idempotencyKeySchema
4044
+ }).strict().superRefine((bulk, context) => {
4045
+ const total = bulk.create.length + bulk.update.length + bulk.archive.length + bulk.restore.length;
4046
+ if (total === 0 || total > constants_1.WORK_ITEM_BULK_LIMIT)
4047
+ context.addIssue({
4048
+ code: zod_1.z.ZodIssueCode.custom,
4049
+ message: `a bulk request needs 1-${constants_1.WORK_ITEM_BULK_LIMIT} operations`
4050
+ });
4051
+ const ids = [...bulk.update, ...bulk.archive, ...bulk.restore].map(({ itemId }) => itemId);
4052
+ if (new Set(ids).size !== ids.length)
4053
+ context.addIssue({ code: zod_1.z.ZodIssueCode.custom, message: "each work item may appear once per bulk request" });
4054
+ });
3375
4055
  exports2.workItemMoveSchema = zod_1.z.object({
3376
4056
  statusId: collaboration_1.entityIdSchema,
3377
4057
  beforeItemId: collaboration_1.entityIdSchema.nullable().optional(),
@@ -3390,8 +4070,17 @@ var require_items = __commonJS({
3390
4070
  kind: zod_1.z.literal("pull_request"),
3391
4071
  repositoryId: zod_1.z.number().int().positive(),
3392
4072
  pullNumber: zod_1.z.number().int().positive()
4073
+ }).strict(),
4074
+ zod_1.z.object({
4075
+ kind: zod_1.z.literal("design_doc"),
4076
+ documentId: collaboration_1.entityIdSchema
3393
4077
  }).strict()
3394
4078
  ]);
4079
+ exports2.workItemMineQuerySchema = zod_1.z.object({
4080
+ role: zod_1.z.enum(["assigned", "reported"]).default("assigned"),
4081
+ includeDone: zod_1.z.boolean().default(false),
4082
+ limit: zod_1.z.number().int().min(1).max(100).default(50)
4083
+ }).strict();
3395
4084
  }
3396
4085
  });
3397
4086
 
@@ -3415,11 +4104,15 @@ var require_views = __commonJS({
3415
4104
  }).strict();
3416
4105
  exports2.taskViewFilterSchema = zod_1.z.object({
3417
4106
  query: zod_1.z.string().trim().max(200).optional(),
4107
+ focus: zod_1.z.enum(["all", "open", "unassigned", "overdue"]).optional(),
4108
+ layout: zod_1.z.enum(["board", "list", "calendar", "timeline", "backlog", "sprint", "releases"]).optional(),
4109
+ sort: exports2.taskViewSortSchema.optional(),
3418
4110
  typeIds: zod_1.z.array(collaboration_1.entityIdSchema).max(50).optional(),
3419
4111
  statusIds: zod_1.z.array(collaboration_1.entityIdSchema).max(20).optional(),
3420
4112
  priorities: zod_1.z.array(common_1.workItemPrioritySchema).max(constants_1.WORK_ITEM_PRIORITIES.length).optional(),
3421
4113
  assigneeIds: zod_1.z.array(common_1.taskUserIdSchema).max(100).optional(),
3422
4114
  tagIds: zod_1.z.array(collaboration_1.entityIdSchema).max(500).optional(),
4115
+ archived: zod_1.z.boolean().optional(),
3423
4116
  sprintIds: zod_1.z.array(collaboration_1.entityIdSchema).max(100).optional(),
3424
4117
  releaseIds: zod_1.z.array(collaboration_1.entityIdSchema).max(100).optional(),
3425
4118
  parentId: collaboration_1.entityIdSchema.optional(),
@@ -3513,7 +4206,7 @@ var require_activity = __commonJS({
3513
4206
  "packages/schema/dist/task-management/activity.js"(exports2) {
3514
4207
  "use strict";
3515
4208
  Object.defineProperty(exports2, "__esModule", { value: true });
3516
- exports2.workItemActivityPageSchema = exports2.workItemCommentPageSchema = exports2.taskReleasePageSchema = exports2.taskSprintPageSchema = exports2.workItemPageSchema = exports2.taskSpacePageSchema = exports2.taskErrorSchema = exports2.workItemActivitySchema = exports2.workItemCommentCreateSchema = exports2.workItemCommentSchema = void 0;
4209
+ exports2.workItemActivityPageSchema = exports2.workItemCommentPageSchema = exports2.taskReleasePageSchema = exports2.taskSprintPageSchema = exports2.workItemPageSchema = exports2.taskItemSummarySchema = exports2.taskItemTotalsSchema = exports2.taskSpacePageSchema = exports2.taskErrorSchema = exports2.workItemActivitySchema = exports2.workItemCommentCreateSchema = exports2.workItemCommentSchema = void 0;
3517
4210
  var zod_1 = require("zod");
3518
4211
  var collaboration_1 = require_collaboration();
3519
4212
  var common_1 = require_common();
@@ -3546,10 +4239,14 @@ var require_activity = __commonJS({
3546
4239
  "created",
3547
4240
  "updated",
3548
4241
  "moved",
4242
+ "auto_closed",
4243
+ "reopened",
3549
4244
  "archived",
3550
4245
  "commented",
3551
4246
  "linked",
3552
4247
  "unlinked",
4248
+ "attached",
4249
+ "detached",
3553
4250
  "sprint_planned",
3554
4251
  "sprint_started",
3555
4252
  "sprint_completed",
@@ -3574,7 +4271,19 @@ var require_activity = __commonJS({
3574
4271
  currentVersion: collaboration_1.revisionSchema.optional()
3575
4272
  }).strict();
3576
4273
  exports2.taskSpacePageSchema = (0, collaboration_1.pageSchema)(common_1.taskSpaceSchema);
3577
- exports2.workItemPageSchema = (0, collaboration_1.pageSchema)(items_1.workItemSchema);
4274
+ exports2.taskItemTotalsSchema = zod_1.z.object({
4275
+ total: zod_1.z.number().int().nonnegative(),
4276
+ done: zod_1.z.number().int().nonnegative(),
4277
+ storyPoints: zod_1.z.number().nonnegative()
4278
+ });
4279
+ exports2.taskItemSummarySchema = exports2.taskItemTotalsSchema.extend({
4280
+ startAt: common_1.nullableTaskTimestampSchema,
4281
+ endAt: common_1.nullableTaskTimestampSchema,
4282
+ statuses: zod_1.z.record(exports2.taskItemTotalsSchema),
4283
+ sprints: zod_1.z.record(exports2.taskItemTotalsSchema),
4284
+ releases: zod_1.z.record(exports2.taskItemTotalsSchema)
4285
+ });
4286
+ exports2.workItemPageSchema = (0, collaboration_1.pageSchema)(items_1.workItemSchema).extend({ summary: exports2.taskItemSummarySchema });
3578
4287
  exports2.taskSprintPageSchema = (0, collaboration_1.pageSchema)(planning_1.taskSprintSchema);
3579
4288
  exports2.taskReleasePageSchema = (0, collaboration_1.pageSchema)(planning_1.taskReleaseSchema);
3580
4289
  exports2.workItemCommentPageSchema = (0, collaboration_1.pageSchema)(exports2.workItemCommentSchema);
@@ -3582,6 +4291,123 @@ var require_activity = __commonJS({
3582
4291
  }
3583
4292
  });
3584
4293
 
4294
+ // packages/schema/dist/task-management/attachments.js
4295
+ var require_attachments2 = __commonJS({
4296
+ "packages/schema/dist/task-management/attachments.js"(exports2) {
4297
+ "use strict";
4298
+ Object.defineProperty(exports2, "__esModule", { value: true });
4299
+ exports2.taskAttachmentRecordSchema = exports2.taskAttachmentUploadQuerySchema = exports2.taskAttachmentListSchema = exports2.taskAttachmentSchema = exports2.taskAttachmentNameSchema = exports2.isInlineTaskAttachment = exports2.taskAttachmentMimeSchema = void 0;
4300
+ exports2.taskAttachmentKind = taskAttachmentKind;
4301
+ exports2.attachmentSignatureMatches = attachmentSignatureMatches;
4302
+ var zod_1 = require("zod");
4303
+ var constants_1 = require_constants();
4304
+ var collaboration_1 = require_collaboration();
4305
+ var common_1 = require_common();
4306
+ exports2.taskAttachmentMimeSchema = zod_1.z.enum(constants_1.TASK_ATTACHMENT_MIME_TYPES);
4307
+ function taskAttachmentKind(mime) {
4308
+ if (mime.startsWith("image/"))
4309
+ return "image";
4310
+ if (mime.startsWith("video/"))
4311
+ return "video";
4312
+ return "document";
4313
+ }
4314
+ var isInlineTaskAttachment = (mime) => constants_1.TASK_ATTACHMENT_INLINE_MIME_TYPES.includes(mime);
4315
+ exports2.isInlineTaskAttachment = isInlineTaskAttachment;
4316
+ exports2.taskAttachmentNameSchema = zod_1.z.string().trim().min(1).max(200).regex(/^[^/\\\p{Cc}]+$/u);
4317
+ exports2.taskAttachmentSchema = zod_1.z.object({
4318
+ id: collaboration_1.entityIdSchema,
4319
+ itemId: collaboration_1.entityIdSchema,
4320
+ name: exports2.taskAttachmentNameSchema,
4321
+ mime: exports2.taskAttachmentMimeSchema,
4322
+ size: zod_1.z.number().int().positive().max(constants_1.TASK_ATTACHMENT_MAX_BYTES),
4323
+ checksum: zod_1.z.string().max(128),
4324
+ createdBy: common_1.taskUserIdSchema,
4325
+ createdAt: common_1.taskTimestampSchema
4326
+ }).strict();
4327
+ exports2.taskAttachmentListSchema = zod_1.z.object({ items: zod_1.z.array(exports2.taskAttachmentSchema).max(100) }).strict();
4328
+ exports2.taskAttachmentUploadQuerySchema = zod_1.z.object({ name: exports2.taskAttachmentNameSchema }).strict();
4329
+ exports2.taskAttachmentRecordSchema = zod_1.z.object({
4330
+ id: collaboration_1.entityIdSchema,
4331
+ name: exports2.taskAttachmentNameSchema,
4332
+ mime: exports2.taskAttachmentMimeSchema,
4333
+ size: zod_1.z.number().int().positive().max(constants_1.TASK_ATTACHMENT_MAX_BYTES),
4334
+ checksum: zod_1.z.string().max(128),
4335
+ objectKey: zod_1.z.string().min(1).max(512),
4336
+ clientMutationId: collaboration_1.idempotencyKeySchema
4337
+ }).strict();
4338
+ var startsWith = (head, bytes, offset = 0) => bytes.every((byte, index) => head[offset + index] === byte);
4339
+ var ascii = (text) => [...text].map((char) => char.charCodeAt(0));
4340
+ function attachmentSignatureMatches(mime, head) {
4341
+ switch (mime) {
4342
+ case "image/png":
4343
+ return startsWith(head, [137, ...ascii("PNG"), 13, 10, 26, 10]);
4344
+ case "image/jpeg":
4345
+ return startsWith(head, [255, 216, 255]);
4346
+ case "image/gif":
4347
+ return startsWith(head, ascii("GIF8"));
4348
+ case "image/webp":
4349
+ return startsWith(head, ascii("RIFF")) && startsWith(head, ascii("WEBP"), 8);
4350
+ case "image/avif":
4351
+ case "video/mp4":
4352
+ return startsWith(head, ascii("ftyp"), 4);
4353
+ case "video/webm":
4354
+ return startsWith(head, [26, 69, 223, 163]);
4355
+ case "application/pdf":
4356
+ return startsWith(head, ascii("%PDF"));
4357
+ case "application/zip":
4358
+ return startsWith(head, [80, 75, 3, 4]);
4359
+ default:
4360
+ return mime.startsWith("application/vnd.openxmlformats-officedocument.") ? startsWith(head, [80, 75, 3, 4]) : !head.includes(0);
4361
+ }
4362
+ }
4363
+ }
4364
+ });
4365
+
4366
+ // packages/schema/dist/task-management/hierarchy.js
4367
+ var require_hierarchy = __commonJS({
4368
+ "packages/schema/dist/task-management/hierarchy.js"(exports2) {
4369
+ "use strict";
4370
+ Object.defineProperty(exports2, "__esModule", { value: true });
4371
+ exports2.workItemSummaryListSchema = exports2.workItemSummarySchema = exports2.taskSpaceTreeSchema = exports2.workItemTreeSchema = exports2.workItemTreeNodeSchema = void 0;
4372
+ var zod_1 = require("zod");
4373
+ var constants_1 = require_constants();
4374
+ var collaboration_1 = require_collaboration();
4375
+ var common_1 = require_common();
4376
+ exports2.workItemTreeNodeSchema = zod_1.z.object({
4377
+ id: collaboration_1.entityIdSchema,
4378
+ key: common_1.workItemKeySchema,
4379
+ spaceId: collaboration_1.entityIdSchema,
4380
+ parentId: collaboration_1.entityIdSchema.nullable(),
4381
+ depth: zod_1.z.number().int().nonnegative(),
4382
+ title: zod_1.z.string(),
4383
+ level: common_1.workItemLevelSchema,
4384
+ typeName: zod_1.z.string(),
4385
+ typeColor: common_1.taskColorSchema,
4386
+ statusName: zod_1.z.string(),
4387
+ statusColor: common_1.taskColorSchema,
4388
+ statusCategory: common_1.taskStatusCategorySchema,
4389
+ assigneeId: common_1.taskUserIdSchema.nullable(),
4390
+ storyPoints: zod_1.z.number().nullable(),
4391
+ startAt: common_1.nullableTaskTimestampSchema,
4392
+ dueAt: common_1.nullableTaskTimestampSchema
4393
+ }).strict();
4394
+ exports2.workItemTreeSchema = zod_1.z.object({
4395
+ nodes: zod_1.z.array(exports2.workItemTreeNodeSchema).max(constants_1.WORK_ITEM_TREE_LIMIT),
4396
+ truncated: zod_1.z.boolean()
4397
+ }).strict();
4398
+ exports2.taskSpaceTreeSchema = exports2.workItemTreeSchema.omit({ truncated: true }).extend({
4399
+ nextCursor: zod_1.z.string().nullable()
4400
+ });
4401
+ exports2.workItemSummarySchema = exports2.workItemTreeNodeSchema.omit({
4402
+ parentId: true,
4403
+ depth: true,
4404
+ level: true,
4405
+ typeName: true
4406
+ });
4407
+ exports2.workItemSummaryListSchema = zod_1.z.object({ items: zod_1.z.array(exports2.workItemSummarySchema).max(100) }).strict();
4408
+ }
4409
+ });
4410
+
3585
4411
  // packages/schema/dist/task-management/index.js
3586
4412
  var require_task_management = __commonJS({
3587
4413
  "packages/schema/dist/task-management/index.js"(exports2) {
@@ -3608,6 +4434,8 @@ var require_task_management = __commonJS({
3608
4434
  __exportStar(require_items(), exports2);
3609
4435
  __exportStar(require_views(), exports2);
3610
4436
  __exportStar(require_activity(), exports2);
4437
+ __exportStar(require_attachments2(), exports2);
4438
+ __exportStar(require_hierarchy(), exports2);
3611
4439
  }
3612
4440
  });
3613
4441
 
@@ -3945,8 +4773,196 @@ var require_capabilities = __commonJS({
3945
4773
  }
3946
4774
  });
3947
4775
 
4776
+ // packages/schema/dist/remote/constants.js
4777
+ var require_constants5 = __commonJS({
4778
+ "packages/schema/dist/remote/constants.js"(exports2) {
4779
+ "use strict";
4780
+ Object.defineProperty(exports2, "__esModule", { value: true });
4781
+ exports2.REMOTE_RESPONSE_HEADERS = exports2.REMOTE_REQUEST_HEADERS = exports2.REMOTE_FILE_CHUNK_BYTES = exports2.REMOTE_FILE_BYTES = exports2.REMOTE_RECOVERY_KEY = exports2.REMOTE_MAX_HOSTS = exports2.REMOTE_PAIRING_MS = exports2.REMOTE_RESPONSE_BYTES = exports2.REMOTE_MAX_STREAMS = exports2.REMOTE_FRAME_BYTES = exports2.REMOTE_BODY_BYTES = exports2.REMOTE_CHUNK_BYTES = exports2.REMOTE_LEASE_MS = exports2.REMOTE_PROTOCOL = void 0;
4782
+ exports2.REMOTE_PROTOCOL = "octonode.remote.v1";
4783
+ exports2.REMOTE_LEASE_MS = 3e4;
4784
+ exports2.REMOTE_CHUNK_BYTES = 48 * 1024;
4785
+ exports2.REMOTE_BODY_BYTES = 4 * 1024 * 1024;
4786
+ exports2.REMOTE_FRAME_BYTES = 128 * 1024;
4787
+ exports2.REMOTE_MAX_STREAMS = 32;
4788
+ exports2.REMOTE_RESPONSE_BYTES = 50 * 1024 * 1024;
4789
+ exports2.REMOTE_PAIRING_MS = 10 * 6e4;
4790
+ exports2.REMOTE_MAX_HOSTS = 10;
4791
+ exports2.REMOTE_RECOVERY_KEY = "remote-credentials/v1/recovery";
4792
+ exports2.REMOTE_FILE_BYTES = 128 * 1024 * 1024;
4793
+ exports2.REMOTE_FILE_CHUNK_BYTES = 512 * 1024;
4794
+ exports2.REMOTE_REQUEST_HEADERS = [
4795
+ "content-type",
4796
+ "accept",
4797
+ "if-match",
4798
+ "if-none-match",
4799
+ "idempotency-key",
4800
+ "x-octonode-worktree",
4801
+ "x-octonode-autocommit"
4802
+ ];
4803
+ exports2.REMOTE_RESPONSE_HEADERS = ["content-type", "etag", "retry-after", "x-octonode-git-commit"];
4804
+ }
4805
+ });
4806
+
4807
+ // packages/schema/dist/remote/schema.js
4808
+ var require_schema4 = __commonJS({
4809
+ "packages/schema/dist/remote/schema.js"(exports2) {
4810
+ "use strict";
4811
+ Object.defineProperty(exports2, "__esModule", { value: true });
4812
+ exports2.remoteFrameSchema = exports2.remoteGrantSchema = exports2.remoteGrantInputSchema = exports2.remoteCommandSchema = exports2.remoteCommandInputSchema = exports2.remoteTerminalQuerySchema = exports2.remoteTerminalSchema = exports2.remoteConnectionSchema = exports2.remoteDeviceSchema = exports2.remoteHostEnrollmentSchema = exports2.remoteHostSchema = exports2.remoteCredentialFenceSchema = exports2.remoteRecoveryCommandSchema = exports2.remoteRecoverySchema = exports2.remotePairSchema = exports2.remoteFileTransferSchema = exports2.remoteFileTransferInputSchema = exports2.remoteFileDownloadSchema = exports2.remoteFileChunkSchema = exports2.remoteFileMetadataSchema = exports2.remoteFileRevisionSchema = exports2.remotePreviewSchema = exports2.remotePreviewInputSchema = exports2.remotePreviewPortsSchema = exports2.remoteHostCreateSchema = exports2.remoteTargetSchema = exports2.remoteHostIdSchema = void 0;
4813
+ var zod_1 = require("zod");
4814
+ var constants_js_1 = require_constants5();
4815
+ exports2.remoteHostIdSchema = zod_1.z.string().uuid();
4816
+ exports2.remoteTargetSchema = zod_1.z.object({ computerId: exports2.remoteHostIdSchema, checkoutId: zod_1.z.string().uuid() }).strict();
4817
+ exports2.remoteHostCreateSchema = zod_1.z.object({ name: zod_1.z.string().trim().min(1).max(80) }).strict();
4818
+ exports2.remotePreviewPortsSchema = zod_1.z.array(zod_1.z.number().int().min(1024).max(65535)).max(8);
4819
+ exports2.remotePreviewInputSchema = zod_1.z.object({
4820
+ checkoutId: zod_1.z.string().uuid(),
4821
+ projectId: zod_1.z.string().min(1).max(128).regex(/^[a-zA-Z0-9._-]+$/),
4822
+ port: zod_1.z.number().int().min(1024).max(65535),
4823
+ worktree: zod_1.z.string().uuid().optional()
4824
+ }).strict();
4825
+ exports2.remotePreviewSchema = zod_1.z.object({ url: zod_1.z.string().url(), expiresAt: zod_1.z.number() });
4826
+ exports2.remoteFileRevisionSchema = zod_1.z.string().regex(/^[a-f0-9]{64}$/);
4827
+ exports2.remoteFileMetadataSchema = zod_1.z.object({
4828
+ path: zod_1.z.string(),
4829
+ size: zod_1.z.number(),
4830
+ revision: exports2.remoteFileRevisionSchema,
4831
+ maxBytes: zod_1.z.number(),
4832
+ chunkBytes: zod_1.z.number()
4833
+ });
4834
+ exports2.remoteFileChunkSchema = zod_1.z.object({ offset: zod_1.z.number().int().nonnegative(), data: zod_1.z.string().max(4 * Math.ceil(constants_js_1.REMOTE_FILE_CHUNK_BYTES / 3)) }).strict();
4835
+ exports2.remoteFileDownloadSchema = exports2.remoteFileChunkSchema.extend({
4836
+ revision: exports2.remoteFileRevisionSchema,
4837
+ size: zod_1.z.number(),
4838
+ nextOffset: zod_1.z.number()
4839
+ });
4840
+ exports2.remoteFileTransferInputSchema = zod_1.z.object({
4841
+ id: zod_1.z.string().uuid(),
4842
+ path: zod_1.z.string().min(1).max(2048),
4843
+ size: zod_1.z.number().int().min(0).max(constants_js_1.REMOTE_FILE_BYTES),
4844
+ revision: exports2.remoteFileRevisionSchema.nullable(),
4845
+ sha256: exports2.remoteFileRevisionSchema
4846
+ }).strict();
4847
+ exports2.remoteFileTransferSchema = exports2.remoteFileTransferInputSchema.extend({
4848
+ nextOffset: zod_1.z.number(),
4849
+ state: zod_1.z.enum(["uploading", "committing", "completed", "expired"]),
4850
+ createdAt: zod_1.z.number(),
4851
+ project: zod_1.z.string(),
4852
+ worktree: zod_1.z.string().nullable()
4853
+ });
4854
+ exports2.remotePairSchema = zod_1.z.object({ checkoutId: zod_1.z.string().uuid(), isolation: zod_1.z.enum(["native", "container"]).default("native") }).strict();
4855
+ exports2.remoteRecoverySchema = zod_1.z.object({ epoch: zod_1.z.string().uuid(), state: zod_1.z.enum(["paused", "ready"]), cursor: zod_1.z.string().uuid().optional() }).strict();
4856
+ exports2.remoteRecoveryCommandSchema = zod_1.z.discriminatedUnion("action", [
4857
+ zod_1.z.object({ action: zod_1.z.literal("begin"), epoch: zod_1.z.string().uuid(), previousEpoch: zod_1.z.string().uuid().nullable() }).strict(),
4858
+ zod_1.z.object({ action: zod_1.z.literal("finish"), epoch: zod_1.z.string().uuid() }).strict()
4859
+ ]);
4860
+ exports2.remoteCredentialFenceSchema = zod_1.z.object({ ownerHash: zod_1.z.string().regex(/^[a-f0-9]{64}$/), epoch: zod_1.z.string().uuid() }).strict();
4861
+ exports2.remoteHostSchema = zod_1.z.object({
4862
+ id: exports2.remoteHostIdSchema,
4863
+ name: zod_1.z.string(),
4864
+ workspace: zod_1.z.string(),
4865
+ createdAt: zod_1.z.number(),
4866
+ connectedAt: zod_1.z.number().nullable(),
4867
+ checkoutId: zod_1.z.string().uuid().nullable(),
4868
+ online: zod_1.z.boolean(),
4869
+ isolation: zod_1.z.enum(["native", "container"]).default("native"),
4870
+ canManage: zod_1.z.boolean().default(false)
4871
+ });
4872
+ exports2.remoteHostEnrollmentSchema = zod_1.z.object({
4873
+ host: exports2.remoteHostSchema,
4874
+ token: zod_1.z.string(),
4875
+ expiresAt: zod_1.z.number()
4876
+ });
4877
+ exports2.remoteDeviceSchema = zod_1.z.object({
4878
+ id: exports2.remoteHostIdSchema,
4879
+ workspace: zod_1.z.string(),
4880
+ ownerId: zod_1.z.string(),
4881
+ checkoutId: zod_1.z.string().uuid().nullable(),
4882
+ executionPolicy: zod_1.z.string().regex(/^[a-f0-9]{64}$/).optional()
4883
+ });
4884
+ exports2.remoteConnectionSchema = zod_1.z.object({
4885
+ id: exports2.remoteHostIdSchema,
4886
+ gateway: zod_1.z.string().url(),
4887
+ token: zod_1.z.string().regex(/^octo_host_[a-f0-9]{64}$/),
4888
+ paired: zod_1.z.boolean().default(false),
4889
+ checkoutId: zod_1.z.string().uuid().optional(),
4890
+ rootIdentity: zod_1.z.string().regex(/^[a-f0-9]{64}$/).optional(),
4891
+ containerImage: zod_1.z.string().regex(/^(?:sha256:[a-f0-9]{64}|[a-zA-Z0-9./:_-]+@sha256:[a-f0-9]{64})$/).optional(),
4892
+ previewPorts: exports2.remotePreviewPortsSchema.default([])
4893
+ }).strict();
4894
+ exports2.remoteTerminalSchema = zod_1.z.object({
4895
+ id: zod_1.z.string().uuid(),
4896
+ project: zod_1.z.string(),
4897
+ worktree: zod_1.z.string().nullable(),
4898
+ createdAt: zod_1.z.number()
4899
+ });
4900
+ exports2.remoteTerminalQuerySchema = zod_1.z.object({
4901
+ project: zod_1.z.string().min(1).max(240),
4902
+ worktree: zod_1.z.string().uuid().optional()
4903
+ });
4904
+ exports2.remoteCommandInputSchema = zod_1.z.object({
4905
+ id: zod_1.z.string().uuid(),
4906
+ command: zod_1.z.string().min(1).max(8192),
4907
+ timeoutMs: zod_1.z.number().int().min(100).max(3e5).default(6e4)
4908
+ }).strict();
4909
+ exports2.remoteCommandSchema = zod_1.z.object({
4910
+ id: zod_1.z.string().uuid(),
4911
+ project: zod_1.z.string(),
4912
+ worktree: zod_1.z.string().nullable(),
4913
+ state: zod_1.z.enum(["running", "completed", "cancelled", "interrupted", "failed"]),
4914
+ output: zod_1.z.string(),
4915
+ truncated: zod_1.z.boolean(),
4916
+ exitCode: zod_1.z.number().int().nullable(),
4917
+ createdAt: zod_1.z.number(),
4918
+ finishedAt: zod_1.z.number().nullable()
4919
+ });
4920
+ exports2.remoteGrantInputSchema = zod_1.z.object({
4921
+ checkoutId: zod_1.z.string().uuid(),
4922
+ read: zod_1.z.boolean(),
4923
+ write: zod_1.z.boolean(),
4924
+ execute: zod_1.z.boolean(),
4925
+ terminal: zod_1.z.boolean(),
4926
+ revision: zod_1.z.number().int().positive().nullable()
4927
+ }).strict();
4928
+ exports2.remoteGrantSchema = exports2.remoteGrantInputSchema.extend({
4929
+ userId: zod_1.z.string(),
4930
+ id: zod_1.z.string().uuid(),
4931
+ revision: zod_1.z.number().int().positive()
4932
+ });
4933
+ exports2.remoteFrameSchema = zod_1.z.discriminatedUnion("type", [
4934
+ zod_1.z.object({ type: zod_1.z.literal("policy"), value: zod_1.z.string().regex(/^[a-f0-9]{64}$/) }).strict(),
4935
+ zod_1.z.object({ type: zod_1.z.literal("dial"), ticket: zod_1.z.string().uuid() }).strict(),
4936
+ zod_1.z.object({ type: zod_1.z.literal("ping") }).strict(),
4937
+ zod_1.z.object({ type: zod_1.z.literal("pong") }).strict(),
4938
+ zod_1.z.object({
4939
+ type: zod_1.z.literal("request"),
4940
+ method: zod_1.z.string().max(10),
4941
+ path: zod_1.z.string().max(4096),
4942
+ headers: zod_1.z.record(zod_1.z.string().max(8192)),
4943
+ websocket: zod_1.z.boolean()
4944
+ }).strict(),
4945
+ zod_1.z.object({
4946
+ type: zod_1.z.literal("response"),
4947
+ status: zod_1.z.number().int().min(100).max(599),
4948
+ headers: zod_1.z.record(zod_1.z.string().max(8192))
4949
+ }).strict(),
4950
+ zod_1.z.object({
4951
+ type: zod_1.z.literal("data"),
4952
+ data: zod_1.z.string().max(constants_js_1.REMOTE_FRAME_BYTES),
4953
+ binary: zod_1.z.boolean().optional(),
4954
+ final: zod_1.z.boolean().optional()
4955
+ }).strict(),
4956
+ zod_1.z.object({ type: zod_1.z.literal("end") }).strict(),
4957
+ zod_1.z.object({ type: zod_1.z.literal("ack") }).strict(),
4958
+ zod_1.z.object({ type: zod_1.z.literal("cancel") }).strict(),
4959
+ zod_1.z.object({ type: zod_1.z.literal("error"), message: zod_1.z.string().max(200) }).strict()
4960
+ ]);
4961
+ }
4962
+ });
4963
+
3948
4964
  // packages/schema/dist/assistant/models.js
3949
- var require_models = __commonJS({
4965
+ var require_models2 = __commonJS({
3950
4966
  "packages/schema/dist/assistant/models.js"(exports2) {
3951
4967
  "use strict";
3952
4968
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -4070,7 +5086,9 @@ var require_chat = __commonJS({
4070
5086
  Object.defineProperty(exports2, "__esModule", { value: true });
4071
5087
  exports2.canTransitionAgentRun = exports2.claudeSandboxRequestSchema = exports2.agentServiceRunRequestSchema = exports2.agentToolAuditSchema = exports2.agentStreamEventSchema = exports2.agentRunSchema = exports2.agentUsageSchema = exports2.assistantConversationUpdateSchema = exports2.assistantConversationConfigSchema = exports2.assistantSettingsSchema = exports2.agentToolRiskSchema = exports2.agentErrorCodeSchema = exports2.agentRunStatusSchema = void 0;
4072
5088
  var zod_1 = require("zod");
4073
- var models_js_1 = require_models();
5089
+ var schema_js_1 = require_schema4();
5090
+ var index_js_1 = require_attachments();
5091
+ var models_js_1 = require_models2();
4074
5092
  var artifacts_js_1 = require_artifacts();
4075
5093
  var constants_1 = require_constants();
4076
5094
  var collaboration_1 = require_collaboration();
@@ -4105,6 +5123,7 @@ var require_chat = __commonJS({
4105
5123
  }).strict()).max(16).refine((skills) => new Set(skills.map(({ name }) => name)).size === skills.length && skills.reduce((size, skill) => size + new TextEncoder().encode(skill.instructions).length, 0) <= 128e3, "Skills exceed the session limit or repeat names")
4106
5124
  }).strict();
4107
5125
  exports2.assistantConversationConfigSchema = zod_1.z.object({
5126
+ remoteTarget: schema_js_1.remoteTargetSchema.nullable().optional(),
4108
5127
  conversationId: collaboration_1.entityIdSchema,
4109
5128
  projectId: projectIdSchema,
4110
5129
  projectIds: projectIdsSchema,
@@ -4135,6 +5154,7 @@ var require_chat = __commonJS({
4135
5154
  modelCalls: zod_1.z.number().int().positive().max(100)
4136
5155
  }).strict().refine(({ inputTokens, outputTokens, totalTokens }) => inputTokens + outputTokens === totalTokens, "totalTokens must equal inputTokens plus outputTokens");
4137
5156
  var agentRunBaseSchema = zod_1.z.object({
5157
+ remoteTarget: schema_js_1.remoteTargetSchema.nullable().optional(),
4138
5158
  id: collaboration_1.entityIdSchema,
4139
5159
  conversationId: collaboration_1.entityIdSchema,
4140
5160
  userMessageId: collaboration_1.entityIdSchema,
@@ -4267,6 +5287,7 @@ var require_chat = __commonJS({
4267
5287
  }
4268
5288
  });
4269
5289
  exports2.agentServiceRunRequestSchema = zod_1.z.object({
5290
+ remoteTarget: schema_js_1.remoteTargetSchema.nullable().optional(),
4270
5291
  projectInstructions: zod_1.z.string().max(17e3).optional(),
4271
5292
  version: zod_1.z.literal(1),
4272
5293
  requestId: collaboration_1.entityIdSchema,
@@ -4284,8 +5305,9 @@ var require_chat = __commonJS({
4284
5305
  messages: zod_1.z.array(zod_1.z.object({
4285
5306
  id: collaboration_1.entityIdSchema,
4286
5307
  role: zod_1.z.enum(["user", "assistant"]),
4287
- content: zod_1.z.string().min(1).max(16384)
4288
- }).strict()).min(1).max(100),
5308
+ content: zod_1.z.string().max(16384),
5309
+ attachments: zod_1.z.array(index_js_1.attachmentManifestSchema).max(10).optional()
5310
+ }).strict().refine(({ content, attachments }) => !!content.trim() || !!attachments?.length, "Message requires text or attachments")).min(1).max(100),
4289
5311
  limits: zod_1.z.object({
4290
5312
  maxOutputTokens: zod_1.z.number().int().min(1).max(32768),
4291
5313
  maxToolSteps: zod_1.z.number().int().min(1).max(32),
@@ -4318,6 +5340,22 @@ var require_chat = __commonJS({
4318
5340
  }
4319
5341
  });
4320
5342
 
5343
+ // packages/schema/dist/agent/constants.js
5344
+ var require_constants6 = __commonJS({
5345
+ "packages/schema/dist/agent/constants.js"(exports2) {
5346
+ "use strict";
5347
+ Object.defineProperty(exports2, "__esModule", { value: true });
5348
+ exports2.ASSISTANT_MODEL_LIMITS = exports2.ASSISTANT_WORKERS_AI_MODEL = void 0;
5349
+ exports2.ASSISTANT_WORKERS_AI_MODEL = "@cf/google/gemma-4-26b-a4b-it";
5350
+ exports2.ASSISTANT_MODEL_LIMITS = {
5351
+ inputTextBytes: 64 * 1024,
5352
+ inputTokens: 128e3,
5353
+ modelCalls: 8,
5354
+ claudeBudgetUsd: 1
5355
+ };
5356
+ }
5357
+ });
5358
+
4321
5359
  // packages/schema/dist/knowledge.js
4322
5360
  var require_knowledge = __commonJS({
4323
5361
  "packages/schema/dist/knowledge.js"(exports2) {
@@ -4364,10 +5402,11 @@ var require_architecture = __commonJS({
4364
5402
  "packages/schema/dist/architecture.js"(exports2) {
4365
5403
  "use strict";
4366
5404
  Object.defineProperty(exports2, "__esModule", { value: true });
4367
- exports2.ArchitectureProjection = exports2.ArchitectureSeed = exports2.ArchitectureEdge = exports2.ArchitectureNode = exports2.ArchitectureScope = exports2.ArchitectureEntityKind = exports2.ArchitectureMode = void 0;
5405
+ exports2.ArchitectureProjection = exports2.ArchitectureSeed = exports2.ArchitectureEdge = exports2.ArchitectureNode = exports2.ArchitectureScope = exports2.ArchitectureEntityKind = exports2.ArchitectureLevel = exports2.ArchitectureMode = void 0;
4368
5406
  var zod_1 = require("zod");
4369
5407
  var architectureId = zod_1.z.string().min(1).max(1024);
4370
5408
  exports2.ArchitectureMode = zod_1.z.enum(["inclusive", "exclusive"]);
5409
+ exports2.ArchitectureLevel = zod_1.z.enum(["system", "components", "overview", "implementation"]);
4371
5410
  exports2.ArchitectureEntityKind = zod_1.z.enum([
4372
5411
  "repository",
4373
5412
  "package",
@@ -4394,7 +5433,8 @@ var require_architecture = __commonJS({
4394
5433
  status: zod_1.z.enum(["available", "unavailable", "reference", "boundary"]),
4395
5434
  scope: exports2.ArchitectureScope,
4396
5435
  ownerIds: zod_1.z.array(architectureId).max(100),
4397
- boundaryOf: architectureId.optional()
5436
+ boundaryOf: architectureId.optional(),
5437
+ source: zod_1.z.object({ projectId: architectureId, path: zod_1.z.string().min(1).max(1024) }).strict().optional()
4398
5438
  }).strict();
4399
5439
  exports2.ArchitectureEdge = zod_1.z.object({
4400
5440
  id: architectureId,
@@ -4427,6 +5467,15 @@ var require_architecture = __commonJS({
4427
5467
  architectureId,
4428
5468
  name: zod_1.z.string().min(1).max(240),
4429
5469
  truncated: zod_1.z.boolean(),
5470
+ summary: zod_1.z.object({
5471
+ nodeCount: zod_1.z.number().int().nonnegative(),
5472
+ edgeCount: zod_1.z.number().int().nonnegative(),
5473
+ omittedNodes: zod_1.z.number().int().nonnegative(),
5474
+ omittedEdges: zod_1.z.number().int().nonnegative(),
5475
+ hiddenByView: zod_1.z.number().int().nonnegative(),
5476
+ matchedNodes: zod_1.z.number().int().nonnegative().optional()
5477
+ }).strict().optional(),
5478
+ matches: zod_1.z.array(architectureId).max(5e3).optional(),
4430
5479
  diagnostics: zod_1.z.array(zod_1.z.object({
4431
5480
  code: zod_1.z.string().min(1).max(120),
4432
5481
  message: zod_1.z.string().min(1).max(512)
@@ -4435,6 +5484,101 @@ var require_architecture = __commonJS({
4435
5484
  }
4436
5485
  });
4437
5486
 
5487
+ // packages/schema/dist/architecture/draft.js
5488
+ var require_draft = __commonJS({
5489
+ "packages/schema/dist/architecture/draft.js"(exports2) {
5490
+ "use strict";
5491
+ Object.defineProperty(exports2, "__esModule", { value: true });
5492
+ exports2.ApplyArchitectureDraft = exports2.ArchitectureDraftReview = exports2.SaveArchitectureDraft = exports2.ArchitectureDraftResult = exports2.ArchitectureDraft = exports2.ArchitectureDraftItem = void 0;
5493
+ var zod_1 = require("zod");
5494
+ var architecture_js_1 = require_architecture();
5495
+ var draftId = zod_1.z.string().regex(/^draft:[a-zA-Z0-9_-]+$/).max(100);
5496
+ var revision = zod_1.z.string().regex(/^[a-f0-9]{64}$/);
5497
+ exports2.ArchitectureDraftItem = zod_1.z.object({
5498
+ id: draftId,
5499
+ type: zod_1.z.enum(["component", "group", "note"]),
5500
+ kind: architecture_js_1.ArchitectureEntityKind.exclude(["repository", "boundary"]),
5501
+ label: zod_1.z.string().trim().min(1).max(120),
5502
+ description: zod_1.z.string().max(2e3),
5503
+ groupId: draftId.optional(),
5504
+ creation: zod_1.z.object({
5505
+ template: zod_1.z.enum(["project", "package", "workflow", "data-table"]),
5506
+ path: zod_1.z.string().min(1).max(512).regex(/^(?:[a-zA-Z0-9_-]+\/)*[a-zA-Z0-9_-]+$/).optional(),
5507
+ projectId: zod_1.z.string().min(1).max(512).optional(),
5508
+ packageName: zod_1.z.string().regex(/^(?:@[a-z0-9._-]+\/)?[a-z0-9][a-z0-9._-]*$/).max(214).optional()
5509
+ }).strict().optional(),
5510
+ implementation: zod_1.z.string().max(512).optional(),
5511
+ position: zod_1.z.object({ x: zod_1.z.number().finite().min(-1e5).max(1e5), y: zod_1.z.number().finite().min(-1e5).max(1e5) }).strict().optional()
5512
+ }).strict();
5513
+ exports2.ArchitectureDraft = zod_1.z.object({
5514
+ version: zod_1.z.literal(1),
5515
+ name: zod_1.z.string().trim().min(1).max(120),
5516
+ baseRevision: revision,
5517
+ items: zod_1.z.array(exports2.ArchitectureDraftItem).max(200),
5518
+ connections: zod_1.z.array(architecture_js_1.ArchitectureEdge.pick({ from: true, to: true, relation: true }).extend({ id: draftId }).strict()).max(500)
5519
+ }).strict();
5520
+ exports2.ArchitectureDraftResult = zod_1.z.object({ draft: exports2.ArchitectureDraft.nullable(), revision: revision.nullable(), pendingToken: revision.optional() }).strict();
5521
+ exports2.SaveArchitectureDraft = zod_1.z.object({ draft: exports2.ArchitectureDraft, revision: revision.nullable() }).strict();
5522
+ exports2.ArchitectureDraftReview = zod_1.z.object({
5523
+ token: revision,
5524
+ currentRevision: revision,
5525
+ baseChanged: zod_1.z.boolean(),
5526
+ applicableConnections: zod_1.z.array(zod_1.z.string()),
5527
+ plannedItems: zod_1.z.number().int().nonnegative(),
5528
+ plannedConnections: zod_1.z.number().int().nonnegative(),
5529
+ issues: zod_1.z.array(zod_1.z.object({
5530
+ code: zod_1.z.enum([
5531
+ "duplicate_id",
5532
+ "missing_endpoint",
5533
+ "invalid_group",
5534
+ "self_dependency",
5535
+ "cycle",
5536
+ "partial_projection",
5537
+ "unavailable_project",
5538
+ "invalid_creation",
5539
+ "creation_conflict"
5540
+ ]),
5541
+ entityId: zod_1.z.string().optional()
5542
+ }).strict()),
5543
+ changes: zod_1.z.array(zod_1.z.object({ projectId: zod_1.z.string(), path: zod_1.z.string(), before: zod_1.z.string(), after: zod_1.z.string() }).strict()),
5544
+ resources: zod_1.z.array(zod_1.z.object({
5545
+ itemId: draftId,
5546
+ template: zod_1.z.enum(["workflow", "data-table"]),
5547
+ projectId: zod_1.z.string(),
5548
+ id: zod_1.z.string(),
5549
+ name: zod_1.z.string(),
5550
+ description: zod_1.z.string()
5551
+ }).strict()).default([])
5552
+ }).strict();
5553
+ exports2.ApplyArchitectureDraft = zod_1.z.object({ token: revision, cancel: zod_1.z.boolean().optional() }).strict();
5554
+ }
5555
+ });
5556
+
5557
+ // packages/schema/dist/architecture/index.js
5558
+ var require_architecture2 = __commonJS({
5559
+ "packages/schema/dist/architecture/index.js"(exports2) {
5560
+ "use strict";
5561
+ var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
5562
+ if (k2 === void 0) k2 = k;
5563
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5564
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5565
+ desc = { enumerable: true, get: function() {
5566
+ return m[k];
5567
+ } };
5568
+ }
5569
+ Object.defineProperty(o, k2, desc);
5570
+ }) : (function(o, m, k, k2) {
5571
+ if (k2 === void 0) k2 = k;
5572
+ o[k2] = m[k];
5573
+ }));
5574
+ var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
5575
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
5576
+ };
5577
+ Object.defineProperty(exports2, "__esModule", { value: true });
5578
+ __exportStar(require_draft(), exports2);
5579
+ }
5580
+ });
5581
+
4438
5582
  // packages/schema/dist/repository/registry.js
4439
5583
  var require_registry = __commonJS({
4440
5584
  "packages/schema/dist/repository/registry.js"(exports2) {
@@ -5312,7 +6456,7 @@ var require_definitions = __commonJS({
5312
6456
  });
5313
6457
 
5314
6458
  // packages/schema/dist/json/schema.js
5315
- var require_schema2 = __commonJS({
6459
+ var require_schema5 = __commonJS({
5316
6460
  "packages/schema/dist/json/schema.js"(exports2) {
5317
6461
  "use strict";
5318
6462
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -11997,52 +13141,792 @@ var require_settings = __commonJS({
11997
13141
  });
11998
13142
  }
11999
13143
  }
12000
- view.canvas?.collapseLayers?.forEach((layerId, index) => {
12001
- if (!Object.hasOwn(settings.layers ?? {}, layerId))
12002
- ctx.addIssue({
12003
- code: "custom",
12004
- path: ["views", viewId, "canvas", "collapseLayers", index],
12005
- message: `unknown layer "${layerId}"`
12006
- });
12007
- });
13144
+ view.canvas?.collapseLayers?.forEach((layerId, index) => {
13145
+ if (!Object.hasOwn(settings.layers ?? {}, layerId))
13146
+ ctx.addIssue({
13147
+ code: "custom",
13148
+ path: ["views", viewId, "canvas", "collapseLayers", index],
13149
+ message: `unknown layer "${layerId}"`
13150
+ });
13151
+ });
13152
+ }
13153
+ });
13154
+ }
13155
+ });
13156
+
13157
+ // packages/schema/dist/access/tokens.js
13158
+ var require_tokens = __commonJS({
13159
+ "packages/schema/dist/access/tokens.js"(exports2) {
13160
+ "use strict";
13161
+ Object.defineProperty(exports2, "__esModule", { value: true });
13162
+ exports2.accessTokenUpdateSchema = exports2.accessTokenCreateSchema = exports2.accessTokenOriginSchema = exports2.accessTokenListQuerySchema = void 0;
13163
+ var zod_1 = require("zod");
13164
+ var constants_1 = require_constants();
13165
+ exports2.accessTokenListQuerySchema = zod_1.z.object({
13166
+ type: zod_1.z.enum(["personal", "service", "public"]).optional(),
13167
+ search: zod_1.z.string().trim().max(200).default(""),
13168
+ sort: zod_1.z.enum(["name", "createdAt", "lastUsedAt"]).default("createdAt"),
13169
+ order: zod_1.z.enum(["asc", "desc"]).default("desc"),
13170
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(25),
13171
+ offset: zod_1.z.coerce.number().int().min(0).max(1e6).default(0)
13172
+ });
13173
+ exports2.accessTokenOriginSchema = zod_1.z.string().max(2048).refine((value) => {
13174
+ try {
13175
+ const url = new URL(value);
13176
+ return url.protocol === "https:" && url.origin === value && !url.hostname.includes("*");
13177
+ } catch {
13178
+ return false;
13179
+ }
13180
+ }, "Expected an exact HTTPS origin");
13181
+ exports2.accessTokenCreateSchema = zod_1.z.object({
13182
+ name: zod_1.z.string().trim().min(1).max(128),
13183
+ type: zod_1.z.enum(["personal", "service", "public"]).default("personal"),
13184
+ workspaceId: zod_1.z.string().regex(/^(user|org|team):[^:]+$/).max(256).optional(),
13185
+ scopes: zod_1.z.array(zod_1.z.enum(["*", ...constants_1.WORKSPACE_ACTIONS])).min(1).max(constants_1.WORKSPACE_ACTIONS.length).optional(),
13186
+ allowedOrigins: zod_1.z.array(exports2.accessTokenOriginSchema).max(32).optional(),
13187
+ expiresAt: zod_1.z.string().datetime().optional()
13188
+ }).strict();
13189
+ exports2.accessTokenUpdateSchema = exports2.accessTokenCreateSchema.pick({ name: true, scopes: true, allowedOrigins: true }).partial().strict();
13190
+ }
13191
+ });
13192
+
13193
+ // packages/schema/dist/access/constants.js
13194
+ var require_constants7 = __commonJS({
13195
+ "packages/schema/dist/access/constants.js"(exports2) {
13196
+ "use strict";
13197
+ Object.defineProperty(exports2, "__esModule", { value: true });
13198
+ exports2.ACCESS_INSPECTION_RESOURCES = exports2.ACCESS_RUN_ACTIONS = exports2.ACCESS_RUN_FEATURES = exports2.OWNER_RECOVERY_ACTIONS = exports2.ACTION_FEATURE = exports2.ACCESS_FEATURE_METERS = exports2.ACCESS_METER_UNITS = exports2.ACCESS_PROFILE_TEMPLATES = exports2.ACCESS_ENFORCED_METERS = exports2.LEGACY_WILDCARD_ACTIONS = exports2.NON_DELEGABLE_ACTIONS = exports2.MAX_CREDENTIAL_LIFETIME_SECONDS = exports2.ACCESS_CAPACITY_METERS = exports2.ACCESS_TOKEN_TYPES = exports2.ACCESS_METERS = exports2.ACCESS_FEATURES = exports2.ACCESS_TIERS = void 0;
13199
+ exports2.ACCESS_TIERS = ["free", "pro", "max", "legacy"];
13200
+ exports2.ACCESS_FEATURES = [
13201
+ "projects",
13202
+ "workflows",
13203
+ "otto",
13204
+ "apps",
13205
+ "tasks",
13206
+ "data",
13207
+ "api_tokens",
13208
+ "remote",
13209
+ "members",
13210
+ "teams",
13211
+ "plugins",
13212
+ "social",
13213
+ "reviews",
13214
+ "github",
13215
+ "agents",
13216
+ "billing",
13217
+ "integrations",
13218
+ "design",
13219
+ "previews",
13220
+ "terminal",
13221
+ "content",
13222
+ "administration"
13223
+ ];
13224
+ exports2.ACCESS_METERS = [
13225
+ "executions",
13226
+ "ai_credits",
13227
+ "apps",
13228
+ "api_tokens",
13229
+ "tasks",
13230
+ "data_rows",
13231
+ "storage_bytes",
13232
+ "remote_hosts",
13233
+ "concurrent_runs"
13234
+ ];
13235
+ exports2.ACCESS_TOKEN_TYPES = ["personal", "service", "public", "agent", "assistant"];
13236
+ exports2.ACCESS_CAPACITY_METERS = ["tasks", "data_rows", "storage_bytes", "concurrent_runs"];
13237
+ exports2.MAX_CREDENTIAL_LIFETIME_SECONDS = 31536e4;
13238
+ exports2.NON_DELEGABLE_ACTIONS = [
13239
+ "tokens:create",
13240
+ "tokens:delegate",
13241
+ "tokens:manage",
13242
+ "agents:manage",
13243
+ "policy:read",
13244
+ "policy:manage",
13245
+ "usage:manage",
13246
+ "org:settings",
13247
+ "members:invite",
13248
+ "members:manage",
13249
+ "teams:manage",
13250
+ "billing:read",
13251
+ "billing:manage",
13252
+ "workspace:delete"
13253
+ ];
13254
+ exports2.LEGACY_WILDCARD_ACTIONS = [
13255
+ "projects:read",
13256
+ "projects:write",
13257
+ "workflows:run",
13258
+ "data:read",
13259
+ "data:write",
13260
+ "tables:manage",
13261
+ "members:invite",
13262
+ "members:manage",
13263
+ "teams:manage",
13264
+ "plugins:publish",
13265
+ "plugins:install",
13266
+ "org:settings",
13267
+ "social:read",
13268
+ "social:write",
13269
+ "social:moderate",
13270
+ "tasks:read",
13271
+ "tasks:write",
13272
+ "tasks:manage",
13273
+ "reviews:write",
13274
+ "github:connect",
13275
+ "github:publish",
13276
+ "agents:manage",
13277
+ "billing:read",
13278
+ "billing:manage",
13279
+ "integrations:read",
13280
+ "integrations:manage",
13281
+ "design:read",
13282
+ "design:review",
13283
+ "previews:read",
13284
+ "previews:manage",
13285
+ "terminal:use",
13286
+ "workflow-agents:run",
13287
+ "workflow-agents:manage",
13288
+ "agent-operations:read",
13289
+ "agent-operations:manage",
13290
+ "data:export",
13291
+ "data:restore",
13292
+ "workspace:delete",
13293
+ "content:read",
13294
+ "content:write",
13295
+ "content:publish",
13296
+ "content:moderate",
13297
+ "apps:read",
13298
+ "apps:use"
13299
+ ];
13300
+ exports2.ACCESS_ENFORCED_METERS = [
13301
+ "executions",
13302
+ "ai_credits",
13303
+ "apps",
13304
+ "api_tokens",
13305
+ "remote_hosts",
13306
+ "tasks",
13307
+ "data_rows",
13308
+ "storage_bytes",
13309
+ "concurrent_runs"
13310
+ ];
13311
+ exports2.ACCESS_PROFILE_TEMPLATES = [
13312
+ {
13313
+ version: 1,
13314
+ tier: "free",
13315
+ policy: {
13316
+ deniedFeatures: ["remote"],
13317
+ deniedActions: [],
13318
+ limits: { apps: 1, api_tokens: 2, remote_hosts: 0 },
13319
+ credentials: { deniedTypes: ["service", "public"], deniedScopes: [], maxLifetimeSeconds: 2592e3 }
13320
+ }
13321
+ },
13322
+ {
13323
+ version: 1,
13324
+ tier: "pro",
13325
+ policy: {
13326
+ deniedFeatures: ["remote"],
13327
+ deniedActions: [],
13328
+ limits: { apps: 10, api_tokens: 20, remote_hosts: 0 },
13329
+ credentials: { deniedTypes: ["public"], deniedScopes: [], maxLifetimeSeconds: 7776e3 }
13330
+ }
13331
+ },
13332
+ {
13333
+ version: 1,
13334
+ tier: "max",
13335
+ policy: {
13336
+ deniedFeatures: [],
13337
+ deniedActions: [],
13338
+ limits: { apps: 50, api_tokens: 100, remote_hosts: 3 },
13339
+ credentials: { deniedTypes: ["public"], deniedScopes: [], maxLifetimeSeconds: 7776e3 }
13340
+ }
13341
+ }
13342
+ ];
13343
+ exports2.ACCESS_METER_UNITS = {
13344
+ executions: "per_month",
13345
+ ai_credits: "per_month",
13346
+ apps: "resident",
13347
+ api_tokens: "resident",
13348
+ tasks: "resident",
13349
+ data_rows: "resident",
13350
+ storage_bytes: "bytes",
13351
+ remote_hosts: "resident",
13352
+ concurrent_runs: "concurrent"
13353
+ };
13354
+ exports2.ACCESS_FEATURE_METERS = {
13355
+ projects: [],
13356
+ workflows: ["executions", "concurrent_runs"],
13357
+ otto: ["ai_credits", "concurrent_runs"],
13358
+ apps: ["apps"],
13359
+ tasks: ["tasks"],
13360
+ data: ["data_rows", "storage_bytes"],
13361
+ api_tokens: ["api_tokens"],
13362
+ remote: ["remote_hosts", "concurrent_runs"],
13363
+ members: [],
13364
+ teams: [],
13365
+ plugins: [],
13366
+ social: ["storage_bytes"],
13367
+ reviews: [],
13368
+ github: [],
13369
+ agents: ["api_tokens"],
13370
+ billing: [],
13371
+ integrations: [],
13372
+ design: [],
13373
+ previews: [],
13374
+ terminal: ["concurrent_runs"],
13375
+ content: [],
13376
+ administration: []
13377
+ };
13378
+ exports2.ACTION_FEATURE = {
13379
+ "projects:read": "projects",
13380
+ "projects:write": "projects",
13381
+ "workflows:run": "workflows",
13382
+ "data:read": "data",
13383
+ "data:write": "data",
13384
+ "tables:manage": "data",
13385
+ "members:invite": "members",
13386
+ "members:manage": "members",
13387
+ "teams:manage": "teams",
13388
+ "plugins:publish": "plugins",
13389
+ "plugins:install": "plugins",
13390
+ "org:settings": "administration",
13391
+ "social:read": "social",
13392
+ "social:write": "social",
13393
+ "social:moderate": "social",
13394
+ "tasks:read": "tasks",
13395
+ "tasks:write": "tasks",
13396
+ "tasks:manage": "tasks",
13397
+ "reviews:write": "reviews",
13398
+ "github:connect": "github",
13399
+ "github:publish": "github",
13400
+ "agents:manage": "agents",
13401
+ "billing:read": "billing",
13402
+ "billing:manage": "billing",
13403
+ "integrations:read": "integrations",
13404
+ "integrations:manage": "integrations",
13405
+ "design:read": "design",
13406
+ "design:review": "design",
13407
+ "previews:read": "previews",
13408
+ "previews:manage": "previews",
13409
+ "terminal:use": "terminal",
13410
+ "workflow-agents:run": "otto",
13411
+ "workflow-agents:manage": "otto",
13412
+ "agent-operations:read": "otto",
13413
+ "agent-operations:manage": "otto",
13414
+ "data:export": "data",
13415
+ "data:restore": "data",
13416
+ "workspace:delete": null,
13417
+ "content:read": "content",
13418
+ "content:write": "content",
13419
+ "content:publish": "content",
13420
+ "content:moderate": "content",
13421
+ "apps:read": "apps",
13422
+ "apps:use": "apps",
13423
+ "apps:manage": "apps",
13424
+ "tokens:create": "api_tokens",
13425
+ "tokens:use": "api_tokens",
13426
+ "tokens:delegate": "api_tokens",
13427
+ "tokens:manage": null,
13428
+ "policy:read": "administration",
13429
+ "policy:manage": "administration",
13430
+ "usage:read": "administration",
13431
+ "usage:manage": "administration",
13432
+ "remote:enroll": "remote",
13433
+ "remote:connect": "remote",
13434
+ "remote:execute": "remote",
13435
+ "remote:manage": null
13436
+ };
13437
+ exports2.OWNER_RECOVERY_ACTIONS = [
13438
+ "policy:read",
13439
+ "policy:manage",
13440
+ "usage:read",
13441
+ "usage:manage",
13442
+ "tokens:manage",
13443
+ "agents:manage",
13444
+ "members:manage",
13445
+ "billing:read",
13446
+ "billing:manage",
13447
+ "org:settings",
13448
+ "workspace:delete",
13449
+ "remote:manage"
13450
+ ];
13451
+ exports2.ACCESS_RUN_FEATURES = ["workflows", "otto", "remote", "terminal"];
13452
+ exports2.ACCESS_RUN_ACTIONS = {
13453
+ workflows: "workflows:run",
13454
+ otto: "workflow-agents:run",
13455
+ remote: "remote:execute",
13456
+ terminal: "terminal:use"
13457
+ };
13458
+ exports2.ACCESS_INSPECTION_RESOURCES = ["project", "table", "app", "task", "remote_host"];
13459
+ }
13460
+ });
13461
+
13462
+ // packages/schema/dist/access/policy.js
13463
+ var require_policy = __commonJS({
13464
+ "packages/schema/dist/access/policy.js"(exports2) {
13465
+ "use strict";
13466
+ Object.defineProperty(exports2, "__esModule", { value: true });
13467
+ exports2.accessCredentialRevokeSchema = exports2.accessCredentialsSchema = exports2.accessCredentialSchema = exports2.accessCredentialsQuerySchema = exports2.accessUsageSchema = exports2.accessScopesSchema = exports2.accessScopesQuerySchema = exports2.accessCatalogSchema = exports2.accessPolicyHistorySchema = exports2.accessImpactResultSchema = exports2.accessImpactSchema = exports2.accessInspectionResultSchema = exports2.accessInspectionSchema = exports2.accessCredentialRefSchema = exports2.accessEffectiveQuerySchema = exports2.accessPolicyQuerySchema = exports2.effectiveAccessSchema = exports2.accessDecisionSchema = exports2.accessReasonSchema = exports2.accessPolicyHeadSchema = exports2.accessPolicyRecordSchema = exports2.accessPolicyWriteSchema = exports2.accessPolicyTargetSchema = exports2.accessProfileSchema = exports2.accessPolicySchema = exports2.credentialPolicySchema = exports2.accessLimitsSchema = exports2.accessLimitSchema = exports2.accessMeterSchema = exports2.accessFeatureSchema = void 0;
13468
+ var constants_js_1 = require_constants7();
13469
+ var zod_1 = require("zod");
13470
+ var constants_js_2 = require_constants();
13471
+ var constants_js_3 = require_constants7();
13472
+ exports2.accessFeatureSchema = zod_1.z.enum(constants_js_3.ACCESS_FEATURES);
13473
+ exports2.accessMeterSchema = zod_1.z.enum(constants_js_3.ACCESS_METERS);
13474
+ exports2.accessLimitSchema = zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).nullable();
13475
+ exports2.accessLimitsSchema = zod_1.z.object({
13476
+ executions: exports2.accessLimitSchema.optional(),
13477
+ ai_credits: exports2.accessLimitSchema.optional(),
13478
+ apps: exports2.accessLimitSchema.optional(),
13479
+ api_tokens: exports2.accessLimitSchema.optional(),
13480
+ tasks: exports2.accessLimitSchema.optional(),
13481
+ data_rows: exports2.accessLimitSchema.optional(),
13482
+ storage_bytes: exports2.accessLimitSchema.optional(),
13483
+ remote_hosts: exports2.accessLimitSchema.optional(),
13484
+ concurrent_runs: exports2.accessLimitSchema.optional()
13485
+ }).strict().superRefine((limits, ctx) => {
13486
+ for (const meter of constants_js_3.ACCESS_METERS)
13487
+ if (typeof limits[meter] === "number" && !constants_js_3.ACCESS_ENFORCED_METERS.includes(meter))
13488
+ ctx.addIssue({ code: "custom", path: [meter], message: "This meter is not available for hard limits yet" });
13489
+ });
13490
+ exports2.credentialPolicySchema = zod_1.z.object({
13491
+ deniedTypes: zod_1.z.array(zod_1.z.enum(constants_js_3.ACCESS_TOKEN_TYPES)).max(constants_js_3.ACCESS_TOKEN_TYPES.length).default([]),
13492
+ deniedScopes: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)).max(constants_js_2.WORKSPACE_ACTIONS.length).default([]),
13493
+ maxLifetimeSeconds: zod_1.z.number().int().positive().max(constants_js_3.MAX_CREDENTIAL_LIFETIME_SECONDS).nullable().default(null)
13494
+ }).strict();
13495
+ exports2.accessPolicySchema = zod_1.z.object({
13496
+ deniedFeatures: zod_1.z.array(exports2.accessFeatureSchema).max(constants_js_3.ACCESS_FEATURES.length).default([]),
13497
+ deniedActions: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)).max(constants_js_2.WORKSPACE_ACTIONS.length).default([]),
13498
+ limits: exports2.accessLimitsSchema.default({}),
13499
+ credentials: exports2.credentialPolicySchema.default({})
13500
+ }).strict();
13501
+ exports2.accessProfileSchema = zod_1.z.object({
13502
+ version: zod_1.z.literal(1),
13503
+ tier: zod_1.z.enum(constants_js_3.ACCESS_TIERS),
13504
+ policy: exports2.accessPolicySchema
13505
+ }).strict();
13506
+ exports2.accessPolicyTargetSchema = zod_1.z.object({
13507
+ kind: zod_1.z.enum(["platform", "tier", "user", "org", "team"]),
13508
+ id: zod_1.z.string().min(1).max(128),
13509
+ memberId: zod_1.z.string().min(1).max(128).nullable().default(null)
13510
+ }).strict().superRefine((target, ctx) => {
13511
+ if (target.kind === "platform" && (target.id !== "platform" || target.memberId))
13512
+ ctx.addIssue({ code: "custom", message: "Platform policies have a single platform target" });
13513
+ if (target.kind === "tier" && (!constants_js_3.ACCESS_TIERS.some((tier) => tier === target.id) || target.memberId))
13514
+ ctx.addIssue({ code: "custom", message: "Tier policies require a known tier and no member" });
13515
+ if (target.kind === "user" && target.memberId)
13516
+ ctx.addIssue({ code: "custom", message: "Personal policies cannot target another member" });
13517
+ });
13518
+ exports2.accessPolicyWriteSchema = zod_1.z.object({
13519
+ target: exports2.accessPolicyTargetSchema,
13520
+ revision: zod_1.z.number().int().nonnegative(),
13521
+ policy: exports2.accessPolicySchema,
13522
+ reason: zod_1.z.string().trim().min(3).max(1e3)
13523
+ }).strict();
13524
+ exports2.accessPolicyRecordSchema = exports2.accessPolicyWriteSchema.extend({
13525
+ updatedBy: zod_1.z.string(),
13526
+ updatedAt: zod_1.z.number().int().nonnegative()
13527
+ });
13528
+ var accessPolicyHeadBaseSchema = exports2.accessPolicyRecordSchema.extend({
13529
+ canManage: zod_1.z.boolean(),
13530
+ canManageCredentials: zod_1.z.boolean(),
13531
+ canReadUsage: zod_1.z.boolean(),
13532
+ canManageUsage: zod_1.z.boolean()
13533
+ });
13534
+ exports2.accessPolicyHeadSchema = zod_1.z.union([
13535
+ accessPolicyHeadBaseSchema.extend({ revision: zod_1.z.number().int().positive() }),
13536
+ accessPolicyHeadBaseSchema.extend({
13537
+ revision: zod_1.z.literal(0),
13538
+ reason: zod_1.z.literal(""),
13539
+ updatedBy: zod_1.z.literal(""),
13540
+ updatedAt: zod_1.z.literal(0)
13541
+ })
13542
+ ]);
13543
+ exports2.accessReasonSchema = zod_1.z.enum([
13544
+ "allowed",
13545
+ "role_denied",
13546
+ "plan_denied",
13547
+ "policy_denied",
13548
+ "credential_denied",
13549
+ "resource_denied",
13550
+ "not_released"
13551
+ ]);
13552
+ exports2.accessDecisionSchema = zod_1.z.object({
13553
+ action: zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS),
13554
+ allowed: zod_1.z.boolean(),
13555
+ reason: exports2.accessReasonSchema,
13556
+ source: zod_1.z.string().nullable()
13557
+ });
13558
+ exports2.effectiveAccessSchema = zod_1.z.object({
13559
+ workspace: zod_1.z.object({ kind: zod_1.z.enum(["user", "org", "team"]), id: zod_1.z.string() }),
13560
+ tier: zod_1.z.enum(constants_js_3.ACCESS_TIERS),
13561
+ fundingWorkspace: zod_1.z.object({ kind: zod_1.z.enum(["user", "org", "team"]), id: zod_1.z.string() }),
13562
+ decisions: zod_1.z.array(exports2.accessDecisionSchema),
13563
+ deniedFeatures: zod_1.z.array(exports2.accessFeatureSchema).default([]),
13564
+ limits: exports2.accessLimitsSchema,
13565
+ credentials: exports2.credentialPolicySchema,
13566
+ revisions: zod_1.z.array(zod_1.z.object({ source: zod_1.z.string(), revision: zod_1.z.number().int().nonnegative() }))
13567
+ });
13568
+ exports2.accessPolicyQuerySchema = zod_1.z.object({
13569
+ kind: zod_1.z.enum(["platform", "tier", "user", "org", "team"]),
13570
+ id: zod_1.z.string().min(1).max(128),
13571
+ memberId: zod_1.z.string().min(1).max(128).optional(),
13572
+ before: zod_1.z.coerce.number().int().positive().default(Number.MAX_SAFE_INTEGER),
13573
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(25)
13574
+ });
13575
+ exports2.accessEffectiveQuerySchema = zod_1.z.object({
13576
+ workspace: zod_1.z.string().regex(/^(user|org|team):[^:]+$/).max(256)
13577
+ });
13578
+ exports2.accessCredentialRefSchema = zod_1.z.object({ store: zod_1.z.enum(["api", "agent"]), id: zod_1.z.string().min(1).max(128) }).strict();
13579
+ exports2.accessInspectionSchema = zod_1.z.object({
13580
+ workspace: zod_1.z.object({ kind: zod_1.z.enum(["user", "org", "team"]), id: zod_1.z.string().min(1).max(128) }),
13581
+ userId: zod_1.z.string().min(1).max(128),
13582
+ draft: exports2.accessPolicyWriteSchema.optional(),
13583
+ credential: exports2.accessCredentialRefSchema.optional(),
13584
+ projectId: zod_1.z.string().min(1).max(128).optional(),
13585
+ resource: zod_1.z.object({ kind: zod_1.z.enum(constants_js_1.ACCESS_INSPECTION_RESOURCES), id: zod_1.z.string().min(1).max(128) }).strict().optional()
13586
+ }).strict();
13587
+ exports2.accessInspectionResultSchema = zod_1.z.object({
13588
+ current: exports2.effectiveAccessSchema,
13589
+ proposed: exports2.effectiveAccessSchema,
13590
+ changedActions: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)),
13591
+ changedFeatures: zod_1.z.array(exports2.accessFeatureSchema).default([]),
13592
+ changedLimits: zod_1.z.array(exports2.accessMeterSchema).default([]),
13593
+ credentialsChanged: zod_1.z.boolean().default(false),
13594
+ resource: zod_1.z.object({
13595
+ kind: zod_1.z.enum(constants_js_1.ACCESS_INSPECTION_RESOURCES),
13596
+ id: zod_1.z.string(),
13597
+ projectId: zod_1.z.string().nullable(),
13598
+ deniedActions: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)).default([])
13599
+ }).nullable().default(null)
13600
+ });
13601
+ exports2.accessImpactSchema = exports2.accessInspectionSchema.omit({ userId: true, credential: true }).extend({
13602
+ draft: exports2.accessPolicyWriteSchema,
13603
+ cursor: zod_1.z.string().max(500).optional(),
13604
+ limit: zod_1.z.number().int().min(1).max(25).default(10)
13605
+ });
13606
+ exports2.accessImpactResultSchema = zod_1.z.object({
13607
+ items: zod_1.z.array(zod_1.z.object({
13608
+ workspace: exports2.accessInspectionSchema.shape.workspace,
13609
+ userId: zod_1.z.string(),
13610
+ changedActions: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)),
13611
+ changedFeatures: zod_1.z.array(exports2.accessFeatureSchema),
13612
+ changedLimits: zod_1.z.array(exports2.accessMeterSchema),
13613
+ credentialsChanged: zod_1.z.boolean()
13614
+ })),
13615
+ scanned: zod_1.z.number().int().nonnegative(),
13616
+ nextCursor: zod_1.z.string().nullable()
13617
+ });
13618
+ exports2.accessPolicyHistorySchema = zod_1.z.object({
13619
+ items: zod_1.z.array(exports2.accessPolicyRecordSchema),
13620
+ nextCursor: zod_1.z.number().nullable()
13621
+ });
13622
+ exports2.accessCatalogSchema = zod_1.z.object({
13623
+ features: zod_1.z.array(exports2.accessFeatureSchema),
13624
+ actions: zod_1.z.array(zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS)),
13625
+ meters: zod_1.z.array(zod_1.z.object({
13626
+ key: exports2.accessMeterSchema,
13627
+ unit: zod_1.z.enum(["per_month", "resident", "bytes", "concurrent"]),
13628
+ enforced: zod_1.z.boolean()
13629
+ })),
13630
+ tokenTypes: zod_1.z.array(zod_1.z.enum(constants_js_3.ACCESS_TOKEN_TYPES)),
13631
+ templates: zod_1.z.array(exports2.accessProfileSchema)
13632
+ });
13633
+ exports2.accessScopesQuerySchema = zod_1.z.object({
13634
+ kind: zod_1.z.enum(["platform", "user", "org", "team"]),
13635
+ id: zod_1.z.string().min(1).max(128),
13636
+ search: zod_1.z.string().max(100).default(""),
13637
+ cursor: zod_1.z.string().max(400).optional(),
13638
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(25)
13639
+ });
13640
+ exports2.accessScopesSchema = zod_1.z.object({
13641
+ items: zod_1.z.array(zod_1.z.object({ target: exports2.accessPolicyTargetSchema, name: zod_1.z.string(), role: zod_1.z.string().nullable() })),
13642
+ nextCursor: zod_1.z.string().nullable()
13643
+ });
13644
+ exports2.accessUsageSchema = zod_1.z.object({
13645
+ target: exports2.accessPolicyTargetSchema,
13646
+ periodStart: zod_1.z.number(),
13647
+ periodEnd: zod_1.z.number(),
13648
+ meters: zod_1.z.array(zod_1.z.object({
13649
+ key: exports2.accessMeterSchema,
13650
+ used: zod_1.z.number().nonnegative().nullable(),
13651
+ limit: exports2.accessLimitSchema,
13652
+ source: zod_1.z.string(),
13653
+ unit: zod_1.z.enum(["per_month", "resident", "bytes", "concurrent"])
13654
+ }))
13655
+ });
13656
+ exports2.accessCredentialsQuerySchema = exports2.accessScopesQuerySchema.extend({
13657
+ memberId: zod_1.z.string().min(1).max(128).optional(),
13658
+ type: zod_1.z.enum(constants_js_3.ACCESS_TOKEN_TYPES).optional(),
13659
+ status: zod_1.z.enum(["active", "expired", "revoked", "all"]).default("active")
13660
+ });
13661
+ exports2.accessCredentialSchema = exports2.accessCredentialRefSchema.extend({
13662
+ ownerId: zod_1.z.string(),
13663
+ name: zod_1.z.string(),
13664
+ type: zod_1.z.enum(constants_js_3.ACCESS_TOKEN_TYPES),
13665
+ prefix: zod_1.z.string(),
13666
+ workspace: zod_1.z.string(),
13667
+ projectId: zod_1.z.string().nullable(),
13668
+ scopes: zod_1.z.array(zod_1.z.string()),
13669
+ createdAt: zod_1.z.number(),
13670
+ expiresAt: zod_1.z.number().nullable(),
13671
+ lastUsedAt: zod_1.z.number().nullable(),
13672
+ revokedAt: zod_1.z.number().nullable()
13673
+ });
13674
+ exports2.accessCredentialsSchema = zod_1.z.object({
13675
+ items: zod_1.z.array(exports2.accessCredentialSchema),
13676
+ nextCursor: zod_1.z.string().nullable()
13677
+ });
13678
+ exports2.accessCredentialRevokeSchema = exports2.accessCredentialRefSchema.extend({ reason: zod_1.z.string().trim().min(3).max(1e3) }).strict();
13679
+ }
13680
+ });
13681
+
13682
+ // packages/schema/dist/access/types.js
13683
+ var require_types3 = __commonJS({
13684
+ "packages/schema/dist/access/types.js"(exports2) {
13685
+ "use strict";
13686
+ Object.defineProperty(exports2, "__esModule", { value: true });
13687
+ }
13688
+ });
13689
+
13690
+ // packages/schema/dist/access/resolve.js
13691
+ var require_resolve = __commonJS({
13692
+ "packages/schema/dist/access/resolve.js"(exports2) {
13693
+ "use strict";
13694
+ Object.defineProperty(exports2, "__esModule", { value: true });
13695
+ exports2.resolveAccess = resolveAccess;
13696
+ var constants_js_1 = require_constants();
13697
+ var constants_js_2 = require_constants7();
13698
+ function resolveAccess(input) {
13699
+ const limits = {};
13700
+ let credentials = { deniedTypes: [], deniedScopes: [], maxLifetimeSeconds: null };
13701
+ for (const source of input.sources) {
13702
+ for (const meter of constants_js_2.ACCESS_METERS) {
13703
+ const next2 = source.policy.limits[meter];
13704
+ if (next2 === void 0)
13705
+ continue;
13706
+ const previous = limits[meter];
13707
+ limits[meter] = next2 === null ? previous ?? null : previous == null ? next2 : Math.min(previous, next2);
13708
+ }
13709
+ const next = source.policy.credentials;
13710
+ credentials = {
13711
+ deniedTypes: [.../* @__PURE__ */ new Set([...credentials.deniedTypes, ...next.deniedTypes])],
13712
+ deniedScopes: [.../* @__PURE__ */ new Set([...credentials.deniedScopes, ...next.deniedScopes])],
13713
+ maxLifetimeSeconds: next.maxLifetimeSeconds === null ? credentials.maxLifetimeSeconds : credentials.maxLifetimeSeconds === null ? next.maxLifetimeSeconds : Math.min(credentials.maxLifetimeSeconds, next.maxLifetimeSeconds)
13714
+ };
12008
13715
  }
12009
- });
13716
+ const decisions = constants_js_1.WORKSPACE_ACTIONS.map((action) => {
13717
+ if (!input.permissions[action])
13718
+ return { action, allowed: false, reason: "role_denied", source: "role" };
13719
+ const feature = constants_js_2.ACTION_FEATURE[action];
13720
+ if (feature === "remote" && !input.remoteReady)
13721
+ return { action, allowed: false, reason: "not_released", source: "deployment" };
13722
+ for (const source of input.sources) {
13723
+ if (input.owner && source.source !== "platform" && constants_js_2.OWNER_RECOVERY_ACTIONS.includes(action))
13724
+ continue;
13725
+ if (source.policy.deniedActions.includes(action) || feature && source.policy.deniedFeatures.includes(feature))
13726
+ return {
13727
+ action,
13728
+ allowed: false,
13729
+ reason: source.source === "plan" ? "plan_denied" : "policy_denied",
13730
+ source: source.source
13731
+ };
13732
+ }
13733
+ return { action, allowed: true, reason: "allowed", source: null };
13734
+ });
13735
+ return {
13736
+ decisions,
13737
+ limits,
13738
+ credentials,
13739
+ deniedFeatures: [...new Set(input.sources.flatMap((source) => source.policy.deniedFeatures))]
13740
+ };
13741
+ }
12010
13742
  }
12011
13743
  });
12012
13744
 
12013
- // packages/schema/dist/access/tokens.js
12014
- var require_tokens = __commonJS({
12015
- "packages/schema/dist/access/tokens.js"(exports2) {
13745
+ // packages/schema/dist/access/capacity.js
13746
+ var require_capacity = __commonJS({
13747
+ "packages/schema/dist/access/capacity.js"(exports2) {
12016
13748
  "use strict";
12017
13749
  Object.defineProperty(exports2, "__esModule", { value: true });
12018
- exports2.accessTokenUpdateSchema = exports2.accessTokenCreateSchema = exports2.accessTokenOriginSchema = exports2.accessTokenListQuerySchema = void 0;
13750
+ exports2.accessRunReservationSchema = exports2.capacityResponseSchema = exports2.capacityRequestSchema = exports2.capacityPrincipalSchema = exports2.capacityClaimSchema = exports2.capacityOwnerSchema = exports2.capacityUsageSchema = exports2.capacityQuantitiesSchema = void 0;
13751
+ var constants_js_1 = require_constants7();
12019
13752
  var zod_1 = require("zod");
12020
- var constants_1 = require_constants();
12021
- exports2.accessTokenListQuerySchema = zod_1.z.object({
12022
- type: zod_1.z.enum(["personal", "service", "public"]).optional(),
12023
- search: zod_1.z.string().trim().max(200).default(""),
12024
- sort: zod_1.z.enum(["name", "createdAt", "lastUsedAt"]).default("createdAt"),
12025
- order: zod_1.z.enum(["asc", "desc"]).default("desc"),
12026
- limit: zod_1.z.coerce.number().int().min(1).max(100).default(25),
12027
- offset: zod_1.z.coerce.number().int().min(0).max(1e6).default(0)
13753
+ var collaboration_js_1 = require_collaboration();
13754
+ var constants_js_2 = require_constants();
13755
+ exports2.capacityQuantitiesSchema = zod_1.z.object({
13756
+ tasks: zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0),
13757
+ data_rows: zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0),
13758
+ storage_bytes: zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0),
13759
+ concurrent_runs: zod_1.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER).default(0)
13760
+ }).strict();
13761
+ exports2.capacityUsageSchema = zod_1.z.record(zod_1.z.string().max(128), exports2.capacityQuantitiesSchema);
13762
+ exports2.capacityOwnerSchema = zod_1.z.object({
13763
+ id: zod_1.z.string().min(1).max(256),
13764
+ workspace: zod_1.z.object({ kind: zod_1.z.enum(["user", "org", "team"]), id: zod_1.z.string().min(1).max(128) }),
13765
+ category: zod_1.z.enum(["tasks", "tables", "attachments", "runs"]),
13766
+ revision: zod_1.z.number().int().nonnegative(),
13767
+ usage: exports2.capacityUsageSchema
13768
+ }).strict();
13769
+ exports2.capacityClaimSchema = zod_1.z.object({
13770
+ owner: exports2.capacityOwnerSchema,
13771
+ projectId: zod_1.z.string().min(1).max(128).optional(),
13772
+ operationId: zod_1.z.string().uuid(),
13773
+ proposed: exports2.capacityUsageSchema
13774
+ }).strict();
13775
+ exports2.capacityPrincipalSchema = zod_1.z.discriminatedUnion("kind", [
13776
+ zod_1.z.object({ kind: zod_1.z.literal("user"), userId: zod_1.z.string().min(1).max(128), apiTokenId: zod_1.z.string().max(128).optional() }),
13777
+ zod_1.z.object({
13778
+ kind: zod_1.z.literal("agent"),
13779
+ agentId: zod_1.z.string().min(1).max(128),
13780
+ apiTokenOwnerId: zod_1.z.string().max(128).optional(),
13781
+ workspace: collaboration_js_1.workspaceRefSchema,
13782
+ projectId: zod_1.z.string().max(128).nullable(),
13783
+ scopes: zod_1.z.array(collaboration_js_1.agentScopeSchema).max(constants_js_2.WORKSPACE_ACTIONS.length)
13784
+ })
13785
+ ]);
13786
+ exports2.capacityRequestSchema = zod_1.z.discriminatedUnion("operation", [
13787
+ zod_1.z.object({ operation: zod_1.z.literal("recover"), owner: exports2.capacityOwnerSchema }).strict(),
13788
+ zod_1.z.object({
13789
+ operation: zod_1.z.literal("replace"),
13790
+ operationId: zod_1.z.string().uuid(),
13791
+ owners: zod_1.z.array(exports2.capacityOwnerSchema).min(1).max(4),
13792
+ principal: exports2.capacityPrincipalSchema.optional(),
13793
+ projectId: zod_1.z.string().max(128).optional()
13794
+ }).strict(),
13795
+ zod_1.z.object({ operation: zod_1.z.literal("register"), owner: exports2.capacityOwnerSchema }).strict(),
13796
+ zod_1.z.object({
13797
+ operation: zod_1.z.literal("reserve"),
13798
+ principal: exports2.capacityPrincipalSchema,
13799
+ action: zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS),
13800
+ claim: exports2.capacityClaimSchema
13801
+ }).strict(),
13802
+ zod_1.z.object({ operation: zod_1.z.literal("reduce"), claim: exports2.capacityClaimSchema }).strict(),
13803
+ zod_1.z.object({
13804
+ operation: zod_1.z.literal("settle"),
13805
+ owner: exports2.capacityOwnerSchema,
13806
+ operationId: zod_1.z.string().uuid(),
13807
+ committed: zod_1.z.boolean()
13808
+ }).strict(),
13809
+ zod_1.z.object({
13810
+ operation: zod_1.z.literal("check"),
13811
+ principal: exports2.capacityPrincipalSchema,
13812
+ workspace: collaboration_js_1.workspaceRefSchema,
13813
+ projectId: zod_1.z.string().min(1).max(128).optional(),
13814
+ action: zod_1.z.enum(constants_js_2.WORKSPACE_ACTIONS),
13815
+ epoch: zod_1.z.number().int().nonnegative()
13816
+ }).strict()
13817
+ ]);
13818
+ exports2.capacityResponseSchema = zod_1.z.object({
13819
+ owner: exports2.capacityOwnerSchema.optional(),
13820
+ epoch: zod_1.z.number().int().nonnegative().optional(),
13821
+ status: zod_1.z.enum(["reserved", "settled"]).optional(),
13822
+ revisions: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().nonnegative()).optional()
12028
13823
  });
12029
- exports2.accessTokenOriginSchema = zod_1.z.string().max(2048).refine((value) => {
12030
- try {
12031
- const url = new URL(value);
12032
- return url.protocol === "https:" && url.origin === value && !url.hostname.includes("*");
12033
- } catch {
12034
- return false;
12035
- }
12036
- }, "Expected an exact HTTPS origin");
12037
- exports2.accessTokenCreateSchema = zod_1.z.object({
12038
- name: zod_1.z.string().trim().min(1).max(128),
12039
- type: zod_1.z.enum(["personal", "service", "public"]).default("personal"),
12040
- workspaceId: zod_1.z.string().regex(/^(user|org|team):[^:]+$/).max(256).optional(),
12041
- scopes: zod_1.z.array(zod_1.z.enum(["*", ...constants_1.WORKSPACE_ACTIONS])).min(1).max(constants_1.WORKSPACE_ACTIONS.length).optional(),
12042
- allowedOrigins: zod_1.z.array(exports2.accessTokenOriginSchema).max(32).optional(),
12043
- expiresAt: zod_1.z.string().datetime().optional()
13824
+ exports2.accessRunReservationSchema = zod_1.z.object({
13825
+ workspace: collaboration_js_1.workspaceRefSchema,
13826
+ feature: zod_1.z.enum(constants_js_1.ACCESS_RUN_FEATURES),
13827
+ id: zod_1.z.string().min(1).max(100).regex(/^[a-zA-Z0-9_-]+$/),
13828
+ projectId: zod_1.z.string().min(1).max(128).optional()
12044
13829
  }).strict();
12045
- exports2.accessTokenUpdateSchema = exports2.accessTokenCreateSchema.pick({ name: true, scopes: true, allowedOrigins: true }).partial().strict();
13830
+ }
13831
+ });
13832
+
13833
+ // packages/schema/dist/access/routes/constants.js
13834
+ var require_constants8 = __commonJS({
13835
+ "packages/schema/dist/access/routes/constants.js"(exports2) {
13836
+ "use strict";
13837
+ Object.defineProperty(exports2, "__esModule", { value: true });
13838
+ exports2.ACCESS_ROUTE_FEATURES = void 0;
13839
+ exports2.ACCESS_ROUTE_FEATURES = {
13840
+ access: null,
13841
+ auth: null,
13842
+ billing: null,
13843
+ capabilities: null,
13844
+ config: "projects",
13845
+ desktop: "remote",
13846
+ health: null,
13847
+ identity: null,
13848
+ organizations: null,
13849
+ profile: null,
13850
+ profiles: null,
13851
+ registry: "plugins",
13852
+ "super-admin": null,
13853
+ "workspace-admin": null,
13854
+ workspaces: null,
13855
+ ai: "otto",
13856
+ assistant: "otto",
13857
+ apps: "apps",
13858
+ architectures: "reviews",
13859
+ community: "content",
13860
+ customization: "projects",
13861
+ "design-documents": "design",
13862
+ executions: "workflows",
13863
+ folders: "projects",
13864
+ git: "projects",
13865
+ github: "github",
13866
+ gitlab: "integrations",
13867
+ knowledge: "otto",
13868
+ marketplace: "plugins",
13869
+ "native-nodes": "plugins",
13870
+ nodes: "plugins",
13871
+ parser: "projects",
13872
+ plugins: "plugins",
13873
+ "project-jobs": "projects",
13874
+ projects: "projects",
13875
+ "remote-hosts": "remote",
13876
+ "review-comments": "reviews",
13877
+ "review-suggestions": "reviews",
13878
+ "review-threads": "reviews",
13879
+ runs: "workflows",
13880
+ search: "projects",
13881
+ slack: "integrations",
13882
+ support: null,
13883
+ social: "social",
13884
+ "source-repositories": "projects",
13885
+ store: "projects",
13886
+ "task-spaces": "tasks",
13887
+ templates: "workflows",
13888
+ terminal: "terminal",
13889
+ tokens: null,
13890
+ variables: "data",
13891
+ webhooks: "workflows",
13892
+ wf: "workflows",
13893
+ "work-items": "tasks",
13894
+ workflows: "workflows",
13895
+ "workspace-agents": "agents"
13896
+ };
13897
+ }
13898
+ });
13899
+
13900
+ // packages/schema/dist/access/routes/resolve.js
13901
+ var require_resolve2 = __commonJS({
13902
+ "packages/schema/dist/access/routes/resolve.js"(exports2) {
13903
+ "use strict";
13904
+ Object.defineProperty(exports2, "__esModule", { value: true });
13905
+ exports2.routeAccessFeatures = routeAccessFeatures;
13906
+ var constants_js_1 = require_constants8();
13907
+ function routeAccessFeatures(path) {
13908
+ if (path === "/wf/exec")
13909
+ return ["workflows"];
13910
+ const [, api, root] = path.split("/");
13911
+ if (api !== "api" || !Object.hasOwn(constants_js_1.ACCESS_ROUTE_FEATURES, root))
13912
+ return null;
13913
+ if (root === "search")
13914
+ return ["projects", "workflows", "plugins", "data"];
13915
+ if (/\/(?:data-tables|data-table-schema|sql|variables)(?:\/|$)/.test(path))
13916
+ return ["data"];
13917
+ if (root === "marketplace" && /\/apps(?:\/|$)|\/app-development(?:\/|$)|\/app-tunnels(?:\/|$)/.test(path))
13918
+ return ["apps"];
13919
+ if (/\/nodes\/[^/]+\/invoke$/.test(path))
13920
+ return ["workflows"];
13921
+ if (root === "projects" && /\/(?:claude|assistant)(?:\/|$)/.test(path))
13922
+ return ["otto"];
13923
+ if (root === "projects" && path.endsWith("/persist"))
13924
+ return ["terminal"];
13925
+ if (root === "projects" && /\/(?:workflows|test-workflows|runs|executions)(?:\/|$)/.test(path))
13926
+ return ["workflows"];
13927
+ const feature = constants_js_1.ACCESS_ROUTE_FEATURES[root];
13928
+ return feature ? [feature] : [];
13929
+ }
12046
13930
  }
12047
13931
  });
12048
13932
 
@@ -12199,6 +14083,7 @@ var require_installation = __commonJS({
12199
14083
  grants: exports2.appGrantsSchema
12200
14084
  }).strict();
12201
14085
  exports2.appInstallationsQuerySchema = zod_1.z.object({
14086
+ appId: zod_1.z.string().uuid().optional(),
12202
14087
  offset: zod_1.z.coerce.number().int().min(0).max(1e6).default(0),
12203
14088
  q: zod_1.z.string().max(200).optional(),
12204
14089
  sort: zod_1.z.enum(["name", "installed", "updated"]).default("installed"),
@@ -12459,7 +14344,7 @@ var require_publishing = __commonJS({
12459
14344
  "packages/schema/dist/plugin/publishing.js"(exports2) {
12460
14345
  "use strict";
12461
14346
  Object.defineProperty(exports2, "__esModule", { value: true });
12462
- exports2.PluginCloudBuild = exports2.PluginPublisherBuildDetail = exports2.PluginPublisherBuilds = exports2.PluginPublisherBuildQuery = exports2.PluginPublisherListQuery = exports2.PluginPublisherApplied = exports2.PluginPublisherApply = exports2.PluginPublisherReview = exports2.PluginPublisherReviewItem = exports2.PluginPublisherOperation = exports2.PluginPublisherConnections = exports2.PluginPublisherConnection = exports2.PluginPublisherPreview = exports2.PluginPublisherConsent = exports2.PluginPublisherAutomatic = exports2.PluginPublisherRepository = exports2.PluginPublisherInput = exports2.pluginReleaseScope = exports2.PluginReleaseConfig = exports2.PluginConfigPath = void 0;
14347
+ exports2.PluginCloudBuild = exports2.PluginPublisherBuildDetail = exports2.PluginPublisherBuilds = exports2.PluginPublisherBuildQuery = exports2.PluginPublisherListQuery = exports2.PluginPublisherApplied = exports2.PluginPublisherApply = exports2.PluginPublisherReview = exports2.PluginPublisherReviewItem = exports2.PluginPublisherOperation = exports2.PluginPublisherRepositoryPage = exports2.PluginPublisherRepositoryQuery = exports2.PluginPublisherConnections = exports2.PluginPublisherConnection = exports2.PluginPublisherPreview = exports2.PluginPublisherConsent = exports2.PluginPublisherAutomatic = exports2.PluginPublisherRepository = exports2.PluginPublisherInput = exports2.pluginReleaseScope = exports2.PluginReleaseConfig = exports2.PluginConfigPath = void 0;
12463
14348
  var zod_1 = require("zod");
12464
14349
  var icons_1 = require_icons();
12465
14350
  var version_1 = require_version();
@@ -12505,6 +14390,23 @@ var require_publishing = __commonJS({
12505
14390
  lastPublishedAt: zod_1.z.number().nullable()
12506
14391
  });
12507
14392
  exports2.PluginPublisherConnections = zod_1.z.object({ items: zod_1.z.array(exports2.PluginPublisherConnection) });
14393
+ exports2.PluginPublisherRepositoryQuery = zod_1.z.object({
14394
+ search: zod_1.z.string().trim().max(200).default(""),
14395
+ scope: zod_1.z.enum(["all", "user", "team", "organization", "public"]).default("all"),
14396
+ sort: zod_1.z.enum(["name", "-name"]).default("name"),
14397
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(20),
14398
+ offset: zod_1.z.coerce.number().int().min(0).max(1e6).default(0)
14399
+ });
14400
+ exports2.PluginPublisherRepositoryPage = zod_1.z.object({
14401
+ items: zod_1.z.array(zod_1.z.object({
14402
+ repositoryId: zod_1.z.number().int(),
14403
+ repository: zod_1.z.string(),
14404
+ branch: zod_1.z.string(),
14405
+ plugins: zod_1.z.array(zod_1.z.string()),
14406
+ scopes: zod_1.z.array(zod_1.z.enum(["user", "team", "organization", "public"]))
14407
+ })),
14408
+ total: zod_1.z.number().int().nonnegative()
14409
+ });
12508
14410
  exports2.PluginPublisherOperation = zod_1.z.enum(["create", "update", "delete"]);
12509
14411
  exports2.PluginPublisherReviewItem = zod_1.z.object({
12510
14412
  configPath: exports2.PluginConfigPath,
@@ -12921,110 +14823,219 @@ var require_resources = __commonJS({
12921
14823
  }
12922
14824
  });
12923
14825
 
12924
- // packages/schema/dist/remote/constants.js
12925
- var require_constants2 = __commonJS({
12926
- "packages/schema/dist/remote/constants.js"(exports2) {
14826
+ // packages/schema/dist/billing/ai.js
14827
+ var require_ai = __commonJS({
14828
+ "packages/schema/dist/billing/ai.js"(exports2) {
12927
14829
  "use strict";
12928
14830
  Object.defineProperty(exports2, "__esModule", { value: true });
12929
- exports2.REMOTE_RESPONSE_HEADERS = exports2.REMOTE_REQUEST_HEADERS = exports2.REMOTE_MAX_HOSTS = exports2.REMOTE_PAIRING_MS = exports2.REMOTE_RESPONSE_BYTES = exports2.REMOTE_MAX_STREAMS = exports2.REMOTE_FRAME_BYTES = exports2.REMOTE_BODY_BYTES = exports2.REMOTE_CHUNK_BYTES = exports2.REMOTE_LEASE_MS = exports2.REMOTE_PROTOCOL = void 0;
12930
- exports2.REMOTE_PROTOCOL = "octonode.remote.v1";
12931
- exports2.REMOTE_LEASE_MS = 3e4;
12932
- exports2.REMOTE_CHUNK_BYTES = 48 * 1024;
12933
- exports2.REMOTE_BODY_BYTES = 4 * 1024 * 1024;
12934
- exports2.REMOTE_FRAME_BYTES = 128 * 1024;
12935
- exports2.REMOTE_MAX_STREAMS = 32;
12936
- exports2.REMOTE_RESPONSE_BYTES = 50 * 1024 * 1024;
12937
- exports2.REMOTE_PAIRING_MS = 10 * 6e4;
12938
- exports2.REMOTE_MAX_HOSTS = 10;
12939
- exports2.REMOTE_REQUEST_HEADERS = [
12940
- "content-type",
12941
- "accept",
12942
- "if-match",
12943
- "if-none-match",
12944
- "idempotency-key",
12945
- "x-octonode-worktree",
12946
- "x-octonode-autocommit"
12947
- ];
12948
- exports2.REMOTE_RESPONSE_HEADERS = ["content-type", "etag", "retry-after", "x-octonode-git-commit"];
14831
+ exports2.aiBillingPolicySchema = exports2.aiPricedModelSchema = exports2.aiPlanBudgetSchema = exports2.aiBudgetWindowSchema = void 0;
14832
+ var zod_1 = require("zod");
14833
+ var identifier = zod_1.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/);
14834
+ var usdMicros = zod_1.z.number().int().min(0).max(1e12);
14835
+ exports2.aiBudgetWindowSchema = zod_1.z.object({
14836
+ id: identifier,
14837
+ durationSeconds: zod_1.z.number().int().min(60).max(31536e3),
14838
+ budgetUsdMicros: usdMicros
14839
+ }).strict();
14840
+ exports2.aiPlanBudgetSchema = zod_1.z.object({
14841
+ plan: identifier,
14842
+ monthlyBudgetUsdMicros: usdMicros,
14843
+ windows: zod_1.z.array(exports2.aiBudgetWindowSchema).max(12),
14844
+ modelIds: zod_1.z.array(identifier).max(100)
14845
+ }).strict().superRefine((plan, ctx) => {
14846
+ if (new Set(plan.windows.map((window) => window.id)).size !== plan.windows.length)
14847
+ ctx.addIssue({ code: "custom", path: ["windows"], message: "Window IDs must be unique within a plan" });
14848
+ if (new Set(plan.modelIds).size !== plan.modelIds.length)
14849
+ ctx.addIssue({ code: "custom", path: ["modelIds"], message: "Model IDs must be unique" });
14850
+ });
14851
+ exports2.aiPricedModelSchema = zod_1.z.object({
14852
+ id: identifier,
14853
+ name: zod_1.z.string().trim().min(1).max(80),
14854
+ provider: zod_1.z.enum(["workers-ai", "anthropic", "openai", "google"]),
14855
+ model: zod_1.z.string().trim().min(1).max(128).regex(/^[A-Za-z0-9@][A-Za-z0-9._:/@-]*$/),
14856
+ inputUsdMicrosPerMillion: usdMicros,
14857
+ outputUsdMicrosPerMillion: usdMicros,
14858
+ enabled: zod_1.z.boolean()
14859
+ }).strict();
14860
+ exports2.aiBillingPolicySchema = zod_1.z.object({
14861
+ creditsPerUsd: zod_1.z.number().min(1e-6).max(1e6).multipleOf(1e-6),
14862
+ models: zod_1.z.array(exports2.aiPricedModelSchema).max(100),
14863
+ plans: zod_1.z.array(exports2.aiPlanBudgetSchema).max(100)
14864
+ }).strict().superRefine((policy, ctx) => {
14865
+ for (const field of ["models", "plans"]) {
14866
+ const ids = policy[field].map((item) => "id" in item ? item.id : item.plan);
14867
+ if (new Set(ids).size !== ids.length)
14868
+ ctx.addIssue({ code: "custom", path: [field], message: `Duplicate ${field} identifier` });
14869
+ }
14870
+ const identities = policy.models.map((model) => `${model.provider}:${model.model}`);
14871
+ if (new Set(identities).size !== identities.length)
14872
+ ctx.addIssue({ code: "custom", path: ["models"], message: "Provider/model pairs must be unique" });
14873
+ for (const [index, plan] of policy.plans.entries())
14874
+ if (plan.modelIds.some((id) => !policy.models.some((model) => model.id === id)))
14875
+ ctx.addIssue({ code: "custom", path: ["plans", index, "modelIds"], message: "Unknown model ID" });
14876
+ });
12949
14877
  }
12950
14878
  });
12951
14879
 
12952
- // packages/schema/dist/remote/schema.js
12953
- var require_schema3 = __commonJS({
12954
- "packages/schema/dist/remote/schema.js"(exports2) {
14880
+ // packages/schema/dist/billing/usage.js
14881
+ var require_usage = __commonJS({
14882
+ "packages/schema/dist/billing/usage.js"(exports2) {
12955
14883
  "use strict";
12956
14884
  Object.defineProperty(exports2, "__esModule", { value: true });
12957
- exports2.remoteFrameSchema = exports2.remoteTerminalQuerySchema = exports2.remoteTerminalSchema = exports2.remoteConnectionSchema = exports2.remoteDeviceSchema = exports2.remoteHostEnrollmentSchema = exports2.remoteHostSchema = exports2.remoteHostCreateSchema = exports2.remoteHostIdSchema = void 0;
14885
+ exports2.billingAiUserUsageSchema = void 0;
12958
14886
  var zod_1 = require("zod");
12959
- var constants_js_1 = require_constants2();
12960
- exports2.remoteHostIdSchema = zod_1.z.string().uuid();
12961
- exports2.remoteHostCreateSchema = zod_1.z.object({ name: zod_1.z.string().trim().min(1).max(80) }).strict();
12962
- exports2.remoteHostSchema = zod_1.z.object({
12963
- id: exports2.remoteHostIdSchema,
12964
- name: zod_1.z.string(),
12965
- workspace: zod_1.z.string(),
12966
- createdAt: zod_1.z.number(),
12967
- connectedAt: zod_1.z.number().nullable(),
12968
- online: zod_1.z.boolean()
14887
+ exports2.billingAiUserUsageSchema = zod_1.z.object({
14888
+ periodStart: zod_1.z.number().int().nonnegative(),
14889
+ periodEnd: zod_1.z.number().int().nonnegative(),
14890
+ creditsPerUsd: zod_1.z.number().positive().nullable(),
14891
+ totalCredits: zod_1.z.number(),
14892
+ unattributedCredits: zod_1.z.number(),
14893
+ users: zod_1.z.array(zod_1.z.object({
14894
+ userId: zod_1.z.string(),
14895
+ name: zod_1.z.string(),
14896
+ credits: zod_1.z.number()
14897
+ })).max(100),
14898
+ truncated: zod_1.z.boolean()
12969
14899
  });
12970
- exports2.remoteHostEnrollmentSchema = zod_1.z.object({
12971
- host: exports2.remoteHostSchema,
12972
- token: zod_1.z.string(),
12973
- expiresAt: zod_1.z.number()
14900
+ }
14901
+ });
14902
+
14903
+ // packages/schema/dist/billing/index.js
14904
+ var require_billing = __commonJS({
14905
+ "packages/schema/dist/billing/index.js"(exports2) {
14906
+ "use strict";
14907
+ Object.defineProperty(exports2, "__esModule", { value: true });
14908
+ exports2.billingAiUserUsageSchema = exports2.aiPricedModelSchema = exports2.aiPlanBudgetSchema = exports2.aiBudgetWindowSchema = exports2.aiBillingPolicySchema = void 0;
14909
+ var ai_js_1 = require_ai();
14910
+ Object.defineProperty(exports2, "aiBillingPolicySchema", { enumerable: true, get: function() {
14911
+ return ai_js_1.aiBillingPolicySchema;
14912
+ } });
14913
+ Object.defineProperty(exports2, "aiBudgetWindowSchema", { enumerable: true, get: function() {
14914
+ return ai_js_1.aiBudgetWindowSchema;
14915
+ } });
14916
+ Object.defineProperty(exports2, "aiPlanBudgetSchema", { enumerable: true, get: function() {
14917
+ return ai_js_1.aiPlanBudgetSchema;
14918
+ } });
14919
+ Object.defineProperty(exports2, "aiPricedModelSchema", { enumerable: true, get: function() {
14920
+ return ai_js_1.aiPricedModelSchema;
14921
+ } });
14922
+ var usage_js_1 = require_usage();
14923
+ Object.defineProperty(exports2, "billingAiUserUsageSchema", { enumerable: true, get: function() {
14924
+ return usage_js_1.billingAiUserUsageSchema;
14925
+ } });
14926
+ }
14927
+ });
14928
+
14929
+ // packages/schema/dist/billing.js
14930
+ var require_billing2 = __commonJS({
14931
+ "packages/schema/dist/billing.js"(exports2) {
14932
+ "use strict";
14933
+ Object.defineProperty(exports2, "__esModule", { value: true });
14934
+ exports2.billingHierarchySchema = exports2.billingHierarchyInputSchema = exports2.billingChangeSchema = exports2.billingSelectionSchema = exports2.billingCatalogSchema = exports2.billingCreditPackSchema = exports2.billingOfferSchema = void 0;
14935
+ var zod_1 = require("zod");
14936
+ var policy_js_1 = require_policy();
14937
+ var index_js_1 = require_billing();
14938
+ var capacityAddonSchema = zod_1.z.object({
14939
+ addonId: zod_1.z.string().min(1).max(100),
14940
+ units: zod_1.z.number().int().positive().max(1e8),
14941
+ priceCents: zod_1.z.number().int().nonnegative().max(1e8)
14942
+ }).strict();
14943
+ exports2.billingOfferSchema = zod_1.z.object({
14944
+ id: zod_1.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
14945
+ plan: zod_1.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
14946
+ name: zod_1.z.string().trim().min(1).max(80),
14947
+ rank: zod_1.z.number().int().nonnegative().max(1e3),
14948
+ workspaceKind: zod_1.z.enum(["user", "org", "team"]),
14949
+ interval: zod_1.z.enum(["month", "year"]),
14950
+ productId: zod_1.z.string().regex(/^pdt_[A-Za-z0-9_]+$/),
14951
+ currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
14952
+ monthlyPriceCents: zod_1.z.number().int().positive().max(1e8),
14953
+ basePriceCents: zod_1.z.number().int().nonnegative().max(1e8).optional(),
14954
+ organizationId: zod_1.z.string().regex(/^[A-Za-z0-9_-]{1,128}$/).optional(),
14955
+ hostingMode: zod_1.z.enum(["shared", "dedicated", "dedicated_customer_storage"]).optional(),
14956
+ annualDiscountPercent: zod_1.z.number().min(0).max(99),
14957
+ includedExecutions: zod_1.z.number().int().positive().max(1e8),
14958
+ includedAiCredits: zod_1.z.number().int().positive().max(1e8),
14959
+ access: policy_js_1.accessProfileSchema.optional(),
14960
+ seatAddonId: zod_1.z.string().min(1).max(100).nullable(),
14961
+ executionAddon: capacityAddonSchema.nullable(),
14962
+ aiAddon: capacityAddonSchema.nullable(),
14963
+ enabled: zod_1.z.boolean()
14964
+ }).strict().superRefine((offer, ctx) => {
14965
+ if (offer.workspaceKind !== "org" && (offer.organizationId || offer.basePriceCents || offer.hostingMode && offer.hostingMode !== "shared"))
14966
+ ctx.addIssue({ code: "custom", message: "Enterprise agreements and hosting fees require an organization" });
14967
+ if ((offer.basePriceCents || offer.hostingMode && offer.hostingMode !== "shared") && !offer.organizationId)
14968
+ ctx.addIssue({ code: "custom", message: "Hosting agreements must be restricted to an organization" });
14969
+ if (offer.workspaceKind === "user" !== (offer.seatAddonId === null))
14970
+ ctx.addIssue({
14971
+ code: "custom",
14972
+ path: ["seatAddonId"],
14973
+ message: "Organizations and teams require a seat add-on; personal plans cannot have seats"
14974
+ });
14975
+ const ids = [offer.seatAddonId, offer.executionAddon?.addonId, offer.aiAddon?.addonId].filter(Boolean);
14976
+ if (new Set(ids).size !== ids.length)
14977
+ ctx.addIssue({ code: "custom", message: "Add-on IDs must be distinct" });
12974
14978
  });
12975
- exports2.remoteDeviceSchema = zod_1.z.object({
12976
- id: exports2.remoteHostIdSchema,
12977
- workspace: zod_1.z.string(),
12978
- ownerId: zod_1.z.string()
14979
+ exports2.billingCreditPackSchema = zod_1.z.object({
14980
+ id: zod_1.z.string().regex(/^[a-z][a-z0-9_]{0,63}$/),
14981
+ name: zod_1.z.string().trim().min(1).max(80),
14982
+ productId: zod_1.z.string().regex(/^pdt_[A-Za-z0-9_]+$/),
14983
+ meter: zod_1.z.enum(["executions", "ai_credits"]),
14984
+ units: zod_1.z.number().int().positive().max(1e8),
14985
+ priceCents: zod_1.z.number().int().positive().max(1e8),
14986
+ currency: zod_1.z.string().regex(/^[A-Z]{3}$/),
14987
+ enabled: zod_1.z.boolean()
14988
+ }).strict();
14989
+ exports2.billingCatalogSchema = zod_1.z.object({
14990
+ revision: zod_1.z.number().int().nonnegative(),
14991
+ freeExecutions: zod_1.z.number().int().positive().max(1e8),
14992
+ freeAiCredits: zod_1.z.number().int().positive().max(1e8),
14993
+ freeAccess: policy_js_1.accessProfileSchema.optional(),
14994
+ aiPolicy: index_js_1.aiBillingPolicySchema.optional(),
14995
+ offers: zod_1.z.array(exports2.billingOfferSchema).max(100),
14996
+ creditPacks: zod_1.z.array(exports2.billingCreditPackSchema).max(100).default([])
14997
+ }).strict().superRefine((catalog, ctx) => {
14998
+ if (catalog.freeAccess && catalog.freeAccess.tier !== "free")
14999
+ ctx.addIssue({
15000
+ code: "custom",
15001
+ path: ["freeAccess", "tier"],
15002
+ message: "The Free profile must use the free tier"
15003
+ });
15004
+ const products = [...catalog.offers, ...catalog.creditPacks].map((item) => item.productId);
15005
+ if (new Set(products).size !== products.length)
15006
+ ctx.addIssue({ code: "custom", message: "Product IDs must be unique" });
15007
+ if (new Set(catalog.creditPacks.map((pack) => pack.id)).size !== catalog.creditPacks.length)
15008
+ ctx.addIssue({ code: "custom", message: "Duplicate pack ID" });
15009
+ for (const field of ["id", "productId"])
15010
+ if (new Set(catalog.offers.map((offer) => offer[field])).size !== catalog.offers.length)
15011
+ ctx.addIssue({ code: "custom", path: ["offers"], message: `Duplicate ${field}` });
12979
15012
  });
12980
- exports2.remoteConnectionSchema = zod_1.z.object({
12981
- id: exports2.remoteHostIdSchema,
12982
- gateway: zod_1.z.string().url(),
12983
- token: zod_1.z.string().regex(/^octo_host_[a-f0-9]{64}$/),
12984
- paired: zod_1.z.boolean().default(false)
15013
+ exports2.billingSelectionSchema = zod_1.z.object({
15014
+ offerId: zod_1.z.string().min(1).max(64),
15015
+ seats: zod_1.z.number().int().min(1).max(1e4).default(1),
15016
+ executionPacks: zod_1.z.number().int().min(0).max(1e4).default(0),
15017
+ aiPacks: zod_1.z.number().int().min(0).max(1e4).default(0),
15018
+ discountCodes: zod_1.z.array(zod_1.z.string().trim().min(3).max(16)).max(20).optional()
12985
15019
  }).strict();
12986
- exports2.remoteTerminalSchema = zod_1.z.object({
12987
- id: zod_1.z.string().uuid(),
12988
- project: zod_1.z.string(),
12989
- worktree: zod_1.z.string().nullable(),
12990
- createdAt: zod_1.z.number()
15020
+ exports2.billingChangeSchema = exports2.billingSelectionSchema.extend({
15021
+ quoteId: zod_1.z.string().uuid()
12991
15022
  });
12992
- exports2.remoteTerminalQuerySchema = zod_1.z.object({
12993
- project: zod_1.z.string().min(1).max(240),
12994
- worktree: zod_1.z.string().uuid().optional()
15023
+ exports2.billingHierarchyInputSchema = zod_1.z.object({
15024
+ mode: zod_1.z.enum(["separate", "consolidated"]),
15025
+ revision: zod_1.z.number().int().nonnegative()
15026
+ }).strict();
15027
+ exports2.billingHierarchySchema = zod_1.z.object({
15028
+ mode: zod_1.z.enum(["separate", "consolidated"]),
15029
+ revision: zod_1.z.number().int().nonnegative(),
15030
+ organizationId: zod_1.z.string().nullable(),
15031
+ inherited: zod_1.z.boolean(),
15032
+ canManage: zod_1.z.boolean()
12995
15033
  });
12996
- exports2.remoteFrameSchema = zod_1.z.discriminatedUnion("type", [
12997
- zod_1.z.object({ type: zod_1.z.literal("dial"), ticket: zod_1.z.string().uuid() }).strict(),
12998
- zod_1.z.object({ type: zod_1.z.literal("ping") }).strict(),
12999
- zod_1.z.object({ type: zod_1.z.literal("pong") }).strict(),
13000
- zod_1.z.object({
13001
- type: zod_1.z.literal("request"),
13002
- method: zod_1.z.string().max(10),
13003
- path: zod_1.z.string().max(4096),
13004
- headers: zod_1.z.record(zod_1.z.string().max(8192)),
13005
- websocket: zod_1.z.boolean()
13006
- }).strict(),
13007
- zod_1.z.object({
13008
- type: zod_1.z.literal("response"),
13009
- status: zod_1.z.number().int().min(100).max(599),
13010
- headers: zod_1.z.record(zod_1.z.string().max(8192))
13011
- }).strict(),
13012
- zod_1.z.object({
13013
- type: zod_1.z.literal("data"),
13014
- data: zod_1.z.string().max(constants_js_1.REMOTE_FRAME_BYTES),
13015
- binary: zod_1.z.boolean().optional(),
13016
- final: zod_1.z.boolean().optional()
13017
- }).strict(),
13018
- zod_1.z.object({ type: zod_1.z.literal("end") }).strict(),
13019
- zod_1.z.object({ type: zod_1.z.literal("ack") }).strict(),
13020
- zod_1.z.object({ type: zod_1.z.literal("cancel") }).strict(),
13021
- zod_1.z.object({ type: zod_1.z.literal("error"), message: zod_1.z.string().max(200) }).strict()
13022
- ]);
13023
15034
  }
13024
15035
  });
13025
15036
 
13026
15037
  // packages/schema/dist/remote/types.js
13027
- var require_types = __commonJS({
15038
+ var require_types4 = __commonJS({
13028
15039
  "packages/schema/dist/remote/types.js"(exports2) {
13029
15040
  "use strict";
13030
15041
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13032,7 +15043,7 @@ var require_types = __commonJS({
13032
15043
  });
13033
15044
 
13034
15045
  // packages/schema/dist/remote/policy.js
13035
- var require_policy = __commonJS({
15046
+ var require_policy2 = __commonJS({
13036
15047
  "packages/schema/dist/remote/policy.js"(exports2) {
13037
15048
  "use strict";
13038
15049
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13046,11 +15057,13 @@ var require_policy = __commonJS({
13046
15057
  const p = url.pathname;
13047
15058
  if (url.searchParams.get("global") === "true")
13048
15059
  return null;
15060
+ if (/^\/api\/projects\/[a-zA-Z0-9._-]+\/preview\/\d{2,5}(?:\/|$)/.test(p))
15061
+ return ["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"].includes(method) ? "execute" : null;
13049
15062
  if (/\/(?:internal|desktop|claude|frontend|preview|github|gitlab|data-tables|data-table-schema|sql|analytics|triggers|webhooks)(?:\/|$)/.test(p))
13050
15063
  return null;
13051
15064
  if (!["GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "QUERY"].includes(method))
13052
15065
  return null;
13053
- if (!/^\/api\/(?:projects|source-repositories|architectures|workflows|nodes|source|folders|git|config|parser|executions|runs|terminal|capabilities|health|plugins|variables|native|store|search|orchestration)(?:\/|$)/.test(p))
15066
+ if (!/^\/api\/(?:projects|source-repositories|architectures|workflows|nodes|source|folders|git|config|parser|executions|runs|terminal|capabilities|health|plugins|variables|native|native-nodes|store|search|orchestration)(?:\/|$)/.test(p))
13054
15067
  return null;
13055
15068
  if ((p === "/api/source-repositories" || p === "/api/projects") && method !== "GET")
13056
15069
  return null;
@@ -13058,7 +15071,11 @@ var require_policy = __commonJS({
13058
15071
  return null;
13059
15072
  if (/\/(?:import|export|restore|purge|persist|sync)(?:\/|$)/.test(p))
13060
15073
  return null;
13061
- if (p === "/api/terminal" || /\/(?:run|run-all|invoke|executions|cancel|compile|runtime)(?:\/|$)/.test(p))
15074
+ if (/^\/api\/projects\/[^/]+\/files\/transfers(?:\/|$)/.test(p))
15075
+ return ["GET", "HEAD"].includes(method) ? "read" : "write";
15076
+ if (/^\/api\/workflows\/[^/]+\/run$/.test(p))
15077
+ return "execute";
15078
+ if (p === "/api/terminal" || /\/(?:commands|run|run-all|invoke|executions|cancel|compile|runtime)(?:\/|$)/.test(p))
13062
15079
  return method === "GET" && p !== "/api/terminal" ? "read" : "execute";
13063
15080
  return ["GET", "HEAD", "QUERY"].includes(method) ? "read" : "write";
13064
15081
  }
@@ -13074,8 +15091,8 @@ var require_channel = __commonJS({
13074
15091
  exports2.remoteBytes = remoteBytes;
13075
15092
  exports2.remoteBody = remoteBody;
13076
15093
  exports2.remoteSocketMessage = remoteSocketMessage;
13077
- var constants_js_1 = require_constants2();
13078
- var schema_js_1 = require_schema3();
15094
+ var constants_js_1 = require_constants5();
15095
+ var schema_js_1 = require_schema4();
13079
15096
  var RemoteChannel = class {
13080
15097
  constructor(write) {
13081
15098
  this.queue = [];
@@ -13245,16 +15262,64 @@ var require_remote = __commonJS({
13245
15262
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
13246
15263
  };
13247
15264
  Object.defineProperty(exports2, "__esModule", { value: true });
13248
- __exportStar(require_constants2(), exports2);
13249
- __exportStar(require_schema3(), exports2);
13250
- __exportStar(require_types(), exports2);
13251
- __exportStar(require_policy(), exports2);
15265
+ __exportStar(require_constants5(), exports2);
15266
+ __exportStar(require_schema4(), exports2);
15267
+ __exportStar(require_types4(), exports2);
15268
+ __exportStar(require_policy2(), exports2);
13252
15269
  __exportStar(require_channel(), exports2);
13253
15270
  }
13254
15271
  });
13255
15272
 
15273
+ // packages/schema/dist/hosting.js
15274
+ var require_hosting = __commonJS({
15275
+ "packages/schema/dist/hosting.js"(exports2) {
15276
+ "use strict";
15277
+ Object.defineProperty(exports2, "__esModule", { value: true });
15278
+ exports2.archiveUploadResultSchema = exports2.archiveCaptureResultSchema = exports2.objectArchiveSchema = exports2.storageConnectionInputSchema = exports2.storageCredentialSchema = exports2.storageLocationSchema = void 0;
15279
+ var zod_1 = require("zod");
15280
+ exports2.storageLocationSchema = zod_1.z.object({
15281
+ id: zod_1.z.string().uuid(),
15282
+ generation: zod_1.z.number().int().positive(),
15283
+ provider: zod_1.z.enum(["r2", "aws_s3", "s3_compatible"]),
15284
+ endpoint: zod_1.z.string().url(),
15285
+ region: zod_1.z.string().min(1).max(80),
15286
+ bucket: zod_1.z.string().regex(/^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$/),
15287
+ prefix: zod_1.z.string().regex(/^(?:[a-zA-Z0-9_-]+\/)+$/).max(400),
15288
+ forcePathStyle: zod_1.z.boolean().default(false)
15289
+ }).strict();
15290
+ exports2.storageCredentialSchema = zod_1.z.object({
15291
+ accessKeyId: zod_1.z.string().min(1).max(256),
15292
+ secretAccessKey: zod_1.z.string().min(1).max(256),
15293
+ sessionToken: zod_1.z.string().min(1).max(8192).optional(),
15294
+ expiresAt: zod_1.z.number().int().positive().optional()
15295
+ }).strict().refine((value) => !value.sessionToken || Boolean(value.expiresAt), "Session credentials require expiresAt");
15296
+ exports2.storageConnectionInputSchema = zod_1.z.object({
15297
+ location: exports2.storageLocationSchema,
15298
+ credentials: exports2.storageCredentialSchema
15299
+ }).strict();
15300
+ exports2.objectArchiveSchema = zod_1.z.object({
15301
+ format: zod_1.z.literal("octonode-squashfs-v1"),
15302
+ id: zod_1.z.string().uuid(),
15303
+ connectionId: zod_1.z.string().uuid(),
15304
+ generation: zod_1.z.number().int().positive(),
15305
+ workspace: zod_1.z.string().regex(/^(org|team):[A-Za-z0-9_-]+$/),
15306
+ key: zod_1.z.string().min(1).max(1024),
15307
+ dir: zod_1.z.string().startsWith("/workspace"),
15308
+ bytes: zod_1.z.number().int().positive().max(64 * 1024 ** 3),
15309
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/),
15310
+ createdAt: zod_1.z.number().int().positive(),
15311
+ expiresAt: zod_1.z.number().int().positive()
15312
+ }).strict();
15313
+ exports2.archiveCaptureResultSchema = zod_1.z.object({
15314
+ bytes: zod_1.z.number().int().positive().max(64 * 1024 ** 3),
15315
+ sha256: zod_1.z.string().regex(/^[a-f0-9]{64}$/)
15316
+ }).strict();
15317
+ exports2.archiveUploadResultSchema = zod_1.z.object({ etag: zod_1.z.string().min(1).nullable() }).strict();
15318
+ }
15319
+ });
15320
+
13256
15321
  // packages/schema/dist/assistant/instructions/constants.js
13257
- var require_constants3 = __commonJS({
15322
+ var require_constants9 = __commonJS({
13258
15323
  "packages/schema/dist/assistant/instructions/constants.js"(exports2) {
13259
15324
  "use strict";
13260
15325
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13273,7 +15338,7 @@ var require_instructions = __commonJS({
13273
15338
  exports2.assistantProjectInstructionsSchema = void 0;
13274
15339
  exports2.isProjectInstructionPath = isProjectInstructionPath;
13275
15340
  var zod_1 = require("zod");
13276
- var constants_js_1 = require_constants3();
15341
+ var constants_js_1 = require_constants9();
13277
15342
  exports2.assistantProjectInstructionsSchema = zod_1.z.object({
13278
15343
  files: zod_1.z.array(zod_1.z.object({
13279
15344
  path: zod_1.z.string().max(1024),
@@ -13340,7 +15405,7 @@ var require_dist = __commonJS({
13340
15405
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
13341
15406
  };
13342
15407
  Object.defineProperty(exports2, "__esModule", { value: true });
13343
- exports2.ToolkitAction = exports2.schemaVersion = exports2.octonodeJsonSchema = exports2.testDataValidator = void 0;
15408
+ exports2.billingHierarchySchema = exports2.billingHierarchyInputSchema = exports2.ToolkitAction = exports2.schemaVersion = exports2.octonodeJsonSchema = exports2.testDataValidator = void 0;
13344
15409
  __exportStar(require_envelope(), exports2);
13345
15410
  __exportStar(require_config(), exports2);
13346
15411
  __exportStar(require_entry(), exports2);
@@ -13355,21 +15420,25 @@ var require_dist = __commonJS({
13355
15420
  __exportStar(require_source(), exports2);
13356
15421
  __exportStar(require_graph(), exports2);
13357
15422
  __exportStar(require_collaboration(), exports2);
15423
+ __exportStar(require_support(), exports2);
13358
15424
  __exportStar(require_task_management(), exports2);
13359
15425
  __exportStar(require_collaboration2(), exports2);
13360
15426
  __exportStar(require_documents(), exports2);
13361
15427
  __exportStar(require_dashboard(), exports2);
13362
15428
  __exportStar(require_capabilities(), exports2);
13363
15429
  __exportStar(require_chat(), exports2);
15430
+ __exportStar(require_constants6(), exports2);
15431
+ __exportStar(require_attachments(), exports2);
13364
15432
  __exportStar(require_knowledge(), exports2);
13365
15433
  __exportStar(require_architecture(), exports2);
15434
+ __exportStar(require_architecture2(), exports2);
13366
15435
  __exportStar(require_registry(), exports2);
13367
15436
  __exportStar(require_publications(), exports2);
13368
15437
  __exportStar(require_media(), exports2);
13369
15438
  __exportStar(require_media_types(), exports2);
13370
15439
  __exportStar(require_templates(), exports2);
13371
15440
  __exportStar(require_constants(), exports2);
13372
- var schema_1 = require_schema2();
15441
+ var schema_1 = require_schema5();
13373
15442
  Object.defineProperty(exports2, "octonodeJsonSchema", { enumerable: true, get: function() {
13374
15443
  return schema_1.octonodeJsonSchema;
13375
15444
  } });
@@ -13379,6 +15448,12 @@ var require_dist = __commonJS({
13379
15448
  __exportStar(require_icons(), exports2);
13380
15449
  __exportStar(require_settings(), exports2);
13381
15450
  __exportStar(require_tokens(), exports2);
15451
+ __exportStar(require_constants7(), exports2);
15452
+ __exportStar(require_policy(), exports2);
15453
+ __exportStar(require_types3(), exports2);
15454
+ __exportStar(require_resolve(), exports2);
15455
+ __exportStar(require_capacity(), exports2);
15456
+ __exportStar(require_resolve2(), exports2);
13382
15457
  __exportStar(require_plugin(), exports2);
13383
15458
  __exportStar(require_app(), exports2);
13384
15459
  __exportStar(require_contributions(), exports2);
@@ -13406,26 +15481,38 @@ var require_dist = __commonJS({
13406
15481
  __exportStar(require_table_constants(), exports2);
13407
15482
  __exportStar(require_resources(), exports2);
13408
15483
  __exportStar(require_artifacts(), exports2);
13409
- __exportStar(require_models(), exports2);
15484
+ __exportStar(require_models2(), exports2);
15485
+ __exportStar(require_billing2(), exports2);
15486
+ __exportStar(require_billing(), exports2);
15487
+ var billing_js_1 = require_billing2();
15488
+ Object.defineProperty(exports2, "billingHierarchyInputSchema", { enumerable: true, get: function() {
15489
+ return billing_js_1.billingHierarchyInputSchema;
15490
+ } });
15491
+ Object.defineProperty(exports2, "billingHierarchySchema", { enumerable: true, get: function() {
15492
+ return billing_js_1.billingHierarchySchema;
15493
+ } });
13410
15494
  __exportStar(require_remote(), exports2);
15495
+ __exportStar(require_hosting(), exports2);
13411
15496
  __exportStar(require_instructions(), exports2);
13412
- __exportStar(require_constants3(), exports2);
15497
+ __exportStar(require_constants9(), exports2);
13413
15498
  __exportStar(require_catalog(), exports2);
13414
15499
  }
13415
15500
  });
13416
15501
 
13417
15502
  // packages/plugin-runtime/dist/constants.js
13418
- var require_constants4 = __commonJS({
15503
+ var require_constants10 = __commonJS({
13419
15504
  "packages/plugin-runtime/dist/constants.js"(exports2) {
13420
15505
  "use strict";
13421
15506
  Object.defineProperty(exports2, "__esModule", { value: true });
13422
- exports2.LANGUAGE = void 0;
15507
+ exports2.NODE_BUILD_TARGET = exports2.NODE_ENGINE_RANGE = exports2.LANGUAGE = void 0;
13423
15508
  exports2.LANGUAGE = "typescript";
15509
+ exports2.NODE_ENGINE_RANGE = "^20.19.0 || >=22.12.0";
15510
+ exports2.NODE_BUILD_TARGET = "node20.19";
13424
15511
  }
13425
15512
  });
13426
15513
 
13427
15514
  // packages/plugin-runtime/dist/json/schema.js
13428
- var require_schema4 = __commonJS({
15515
+ var require_schema6 = __commonJS({
13429
15516
  "packages/plugin-runtime/dist/json/schema.js"(exports2) {
13430
15517
  "use strict";
13431
15518
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -13473,8 +15560,19 @@ var require_schema4 = __commonJS({
13473
15560
  walk(schema.additionalProperties, value, `${path}.${key}`, errors);
13474
15561
  }
13475
15562
  }
13476
- if (Array.isArray(data) && isPlainObject(schema.items)) {
13477
- data.forEach((item, i) => walk(schema.items, item, `${path}[${i}]`, errors));
15563
+ if (Array.isArray(data)) {
15564
+ if (typeof schema.minItems === "number" && data.length < schema.minItems)
15565
+ errors.push({ path, message: `expected at least ${schema.minItems} items` });
15566
+ if (typeof schema.maxItems === "number" && data.length > schema.maxItems)
15567
+ errors.push({ path, message: `expected at most ${schema.maxItems} items` });
15568
+ const prefix = Array.isArray(schema.prefixItems) ? schema.prefixItems : [];
15569
+ data.forEach((item, i) => {
15570
+ const itemSchema = i < prefix.length ? prefix[i] : schema.items;
15571
+ if (itemSchema === false)
15572
+ errors.push({ path: `${path}[${i}]`, message: "unexpected item" });
15573
+ else if (isPlainObject(itemSchema))
15574
+ walk(itemSchema, item, `${path}[${i}]`, errors);
15575
+ });
13478
15576
  }
13479
15577
  }
13480
15578
  function normalizeTypes(type) {
@@ -13533,8 +15631,8 @@ var require_runner = __commonJS({
13533
15631
  exports2.start = start;
13534
15632
  var node_console_1 = require("node:console");
13535
15633
  var schema_1 = require_dist();
13536
- var constants_js_1 = require_constants4();
13537
- var schema_js_1 = require_schema4();
15634
+ var constants_js_1 = require_constants10();
15635
+ var schema_js_1 = require_schema6();
13538
15636
  var NodeError = class extends Error {
13539
15637
  constructor(message, opts) {
13540
15638
  super(message);
@@ -13849,7 +15947,7 @@ var require_runner = __commonJS({
13849
15947
  });
13850
15948
 
13851
15949
  // packages/common/dist/constants.js
13852
- var require_constants5 = __commonJS({
15950
+ var require_constants11 = __commonJS({
13853
15951
  "packages/common/dist/constants.js"(exports2) {
13854
15952
  "use strict";
13855
15953
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -14207,6 +16305,19 @@ var require_routing = __commonJS({
14207
16305
  exports2.controlPlanePath = controlPlanePath;
14208
16306
  exports2.workspaceRef = workspaceRef;
14209
16307
  function controlPlanePath(url, method = "GET") {
16308
+ if (/^\/api\/access\/(?:effective|catalog|policy|history|inspect|impact|usage|scopes|credentials)(?:\/[^/]+)?$/.test(url.pathname))
16309
+ return `${url.pathname.slice(4)}${url.search}`;
16310
+ if (/^\/api\/support\/(?:access|realtime(?:-ticket)?|(?:staff\/)?tickets(?:\/[^/]+(?:\/(?:messages|read|take|transfer|close|state|notes|activity|labels))?)?|staff\/(?:agents|reports))$/.test(url.pathname) || /^\/api\/super-admin\/support\/agents(?:\/[^/]+)?$/.test(url.pathname))
16311
+ return `${url.pathname.slice(4)}${url.search}`;
16312
+ if (/^\/api\/support\/(?:intakes|files\/[^/]+(?:\/[^/]+(?:\/content)?)?)$/.test(url.pathname))
16313
+ return `${url.pathname.slice(4)}${url.search}`;
16314
+ if (/^\/api\/support\/(?:staff\/)?(?:unread|notifications(?:\/read)?|settings|templates(?:\/[^/]+)?)$/.test(url.pathname))
16315
+ return `${url.pathname.slice(4)}${url.search}`;
16316
+ if (/^\/api\/support\/staff\/maintenance(?:\/[^/]+(?:\/(?:step|cancel))?)?$/.test(url.pathname))
16317
+ return `${url.pathname.slice(4)}${url.search}`;
16318
+ const hosting = url.pathname.match(/^\/api\/organizations\/([^/]+)\/(hosting|storage-connections)(?:\/[^/]+(?:\/(?:validate|rotate|[a-f0-9]{64}))?)?$/);
16319
+ if (hosting)
16320
+ return url.pathname.replace(/^\/api\/organizations\//, "/orgs/") + url.search;
14210
16321
  if (url.pathname === "/api/marketplace/toolkits" && method === "GET" && url.searchParams.get("project"))
14211
16322
  return null;
14212
16323
  if (!["/api/marketplace/toolkits/import", "/api/marketplace/toolkits/inspect"].includes(url.pathname) && /^\/api\/marketplace\/toolkits(?:\/[^/]+(?:\/(?:publish|resolve|members|versions))?)?$/.test(url.pathname))
@@ -14233,10 +16344,10 @@ var require_routing = __commonJS({
14233
16344
  if (/^\/api\/workspace-admin\/(?:overview|members(?:\/[^/]+)?|invites(?:\/[^/]+)?)$/.test(url.pathname)) {
14234
16345
  return `${url.pathname.slice(4)}${url.search}`;
14235
16346
  }
14236
- if (/^\/api\/super-admin\/(?:access|overview|users|plugins(?:\/[^/]+)?|organizations(?:\/[^/]+)?)$/.test(url.pathname)) {
16347
+ if (/^\/api\/super-admin\/(?:access|overview|users|billing\/catalog|billing\/health|plugins(?:\/[^/]+)?|organizations(?:\/[^/]+)?)$/.test(url.pathname)) {
14237
16348
  return `${url.pathname.slice(4)}${url.search}`;
14238
16349
  }
14239
- if (/^\/api\/billing\/(?:summary|checkout|portal|seats|usage-limits\/[^/]+)$/.test(url.pathname)) {
16350
+ if (/^\/api\/billing\/(?:summary|catalog|change|change-preview|credits|cancel-change|checkout|portal|seats|usage-limits\/[^/]+)$/.test(url.pathname)) {
14240
16351
  return `${url.pathname.slice(4)}${url.search}`;
14241
16352
  }
14242
16353
  if (/^\/api\/remote-hosts(?:\/[^/]+)?$/.test(url.pathname))
@@ -14254,7 +16365,7 @@ var require_routing = __commonJS({
14254
16365
  /^\/api\/github\/(?:install|installations\/complete|repositories|jobs\/[^/]+(?:\/retry)?)$/,
14255
16366
  /^\/api\/slack\/(?:install|installations\/complete|connections(?:\/[^/]+)?|bindings(?:\/[^/]+)?)$/,
14256
16367
  /^\/api\/gitlab\/(?:install|installations\/complete|connections|repositories)$/,
14257
- /^\/api\/design-documents(?:\/[^/]+(?:\/(?:share|review-threads))?)?$/,
16368
+ /^\/api\/design-documents(?:\/[^/]+(?:\/(?:share|review-threads|work-items))?)?$/,
14258
16369
  /^\/api\/architectures\/[^/]+\/github(?:\/pull-requests(?:\/\d+(?:\/reviews)?)?)?$/,
14259
16370
  /^\/api\/(?:review-threads\/[^/]+(?:\/(?:comments|resolve|github\/(?:resolve|unresolve)))?|review-comments\/[^/]+(?:\/github)?|review-suggestions\/[^/]+\/reject)$/
14260
16371
  ].some((pattern) => pattern.test(url.pathname));
@@ -14385,7 +16496,7 @@ var require_dist2 = __commonJS({
14385
16496
  };
14386
16497
  Object.defineProperty(exports2, "__esModule", { value: true });
14387
16498
  exports2.compareWorkflowGraphs = exports2.edgeChanges = exports2.graphValues = exports2.graphValue = exports2.workspaceRef = exports2.controlPlanePath = exports2.installedPluginNodesPage = exports2.layeredLayout = exports2.packageCacheEnvironment = void 0;
14388
- __exportStar(require_constants5(), exports2);
16499
+ __exportStar(require_constants11(), exports2);
14389
16500
  __exportStar(require_legal_constants(), exports2);
14390
16501
  var cache_js_1 = require_cache();
14391
16502
  Object.defineProperty(exports2, "packageCacheEnvironment", { enumerable: true, get: function() {
@@ -14546,7 +16657,7 @@ var require_dist3 = __commonJS({
14546
16657
  "packages/plugin-runtime/dist/index.js"(exports2) {
14547
16658
  "use strict";
14548
16659
  Object.defineProperty(exports2, "__esModule", { value: true });
14549
- exports2.PluginConnection = exports2.PluginNode = exports2.PluginManifest = exports2.pluginDefinitionPath = exports2.loadPluginDefinition = exports2.startPlugin = exports2.definePlugin = exports2.validate = exports2.disposeServiceInstances = exports2.NodeError = exports2.start = exports2.runNode = exports2.defineConst = exports2.defineClass = exports2.defineService = exports2.defineNode = void 0;
16660
+ exports2.NODE_BUILD_TARGET = exports2.NODE_ENGINE_RANGE = exports2.PluginConnection = exports2.PluginNode = exports2.PluginManifest = exports2.pluginDefinitionPath = exports2.loadPluginDefinition = exports2.startPlugin = exports2.definePlugin = exports2.validate = exports2.disposeServiceInstances = exports2.NodeError = exports2.start = exports2.runNode = exports2.defineConst = exports2.defineClass = exports2.defineService = exports2.defineNode = void 0;
14550
16661
  var node_js_1 = require_node();
14551
16662
  Object.defineProperty(exports2, "defineNode", { enumerable: true, get: function() {
14552
16663
  return node_js_1.defineNode;
@@ -14573,7 +16684,7 @@ var require_dist3 = __commonJS({
14573
16684
  Object.defineProperty(exports2, "disposeServiceInstances", { enumerable: true, get: function() {
14574
16685
  return runner_js_1.disposeServiceInstances;
14575
16686
  } });
14576
- var schema_js_1 = require_schema4();
16687
+ var schema_js_1 = require_schema6();
14577
16688
  Object.defineProperty(exports2, "validate", { enumerable: true, get: function() {
14578
16689
  return schema_js_1.validate;
14579
16690
  } });
@@ -14601,6 +16712,13 @@ var require_dist3 = __commonJS({
14601
16712
  Object.defineProperty(exports2, "PluginConnection", { enumerable: true, get: function() {
14602
16713
  return schema_1.PluginConnection;
14603
16714
  } });
16715
+ var constants_js_1 = require_constants10();
16716
+ Object.defineProperty(exports2, "NODE_ENGINE_RANGE", { enumerable: true, get: function() {
16717
+ return constants_js_1.NODE_ENGINE_RANGE;
16718
+ } });
16719
+ Object.defineProperty(exports2, "NODE_BUILD_TARGET", { enumerable: true, get: function() {
16720
+ return constants_js_1.NODE_BUILD_TARGET;
16721
+ } });
14604
16722
  }
14605
16723
  });
14606
16724
 
@@ -16256,7 +18374,7 @@ function extractPluginArchive(bytes, stage) {
16256
18374
  var import_tar4 = require("tar");
16257
18375
  var import_node_crypto5 = require("node:crypto");
16258
18376
  var import_schema6 = __toESM(require_dist());
16259
- var RemoteRegistry = class {
18377
+ var RemoteRegistry = class _RemoteRegistry {
16260
18378
  constructor(opts = {}) {
16261
18379
  const baseUrl = opts.baseUrl ?? (0, import_common5.OCTONODE_MARKETPLACE_URL)() ?? import_common5.DEFAULT_MARKETPLACE_URL;
16262
18380
  if (!baseUrl) {
@@ -16271,11 +18389,17 @@ var RemoteRegistry = class {
16271
18389
  this.token = opts.token ?? (0, import_common5.OCTONODE_MARKETPLACE_TOKEN)();
16272
18390
  this.workspace = opts.workspace ?? (0, import_common5.OCTONODE_USER)()?.match(/^workspace:((?:user|org|team):.+)$/)?.[1];
16273
18391
  }
18392
+ forWorkspace(destination) {
18393
+ const workspace = `${destination.kind}:${destination.id}`;
18394
+ if (this.workspace && this.workspace !== workspace)
18395
+ throw new Error("Toolkit destination must match the registry workspace");
18396
+ return this.workspace === workspace ? this : new _RemoteRegistry({ baseUrl: this.baseUrl, token: this.token, workspace });
18397
+ }
16274
18398
  async request(path, init = {}) {
16275
18399
  const headers = new Headers(init.headers);
16276
18400
  if (this.token) headers.set("authorization", `Bearer ${this.token}`);
16277
18401
  const url = new URL(`${this.baseUrl}${path}`);
16278
- if (this.workspace && url.searchParams.get("catalog") !== "public" && (init.method === void 0 || init.method === "GET" || url.pathname.endsWith("/install")))
18402
+ if (this.workspace && url.searchParams.get("catalog") !== "public" && (init.method === void 0 || init.method === "GET" || url.pathname.endsWith("/install") || url.pathname.endsWith("/resolve")))
16279
18403
  url.searchParams.set("workspace", this.workspace);
16280
18404
  const res = await fetch(url.toString(), {
16281
18405
  ...init,
@@ -16362,11 +18486,14 @@ var RemoteRegistry = class {
16362
18486
  return page.items.map((item) => import_schema6.ToolkitResolvedMember.parse(item));
16363
18487
  }
16364
18488
  async resolveToolkit(id, body) {
16365
- const response = await this.request(`/marketplace/toolkits/${encodeURIComponent(id)}/resolve`, {
16366
- method: "POST",
16367
- headers: { "content-type": "application/json" },
16368
- body: JSON.stringify(body)
16369
- });
18489
+ const response = await this.forWorkspace(body.destination).request(
18490
+ `/marketplace/toolkits/${encodeURIComponent(id)}/resolve`,
18491
+ {
18492
+ method: "POST",
18493
+ headers: { "content-type": "application/json" },
18494
+ body: JSON.stringify(body)
18495
+ }
18496
+ );
16370
18497
  return import_schema6.ToolkitRelease.parse(await response.json());
16371
18498
  }
16372
18499
  async saveToolkit(definition, id, revision) {
@@ -16683,14 +18810,11 @@ async function installFromLock(opts = {}) {
16683
18810
  for (const toolkit of Object.values(lock.toolkits ?? {})) {
16684
18811
  try {
16685
18812
  if (opts.offline) throw new Error("Toolkit access must be reauthorized online before restore");
16686
- const resolved = await new RemoteRegistry({ baseUrl: toolkit.registry, token: opts.token }).resolveToolkit(
16687
- toolkit.id,
16688
- {
16689
- version: toolkit.version,
16690
- sha256: toolkit.sha256,
16691
- destination: toolkit.destination
16692
- }
16693
- );
18813
+ const resolved = await new RemoteRegistry({ baseUrl: toolkit.registry, token: opts.token }).forWorkspace(toolkit.destination).resolveToolkit(toolkit.id, {
18814
+ version: toolkit.version,
18815
+ sha256: toolkit.sha256,
18816
+ destination: toolkit.destination
18817
+ });
16694
18818
  const release2 = (0, import_schema7.toolkitForMode)(resolved, toolkit.mode ?? "development");
16695
18819
  if (!(0, import_node_util3.isDeepStrictEqual)(release2.actions ?? [], toolkit.actions ?? []) || release2.plugins.length !== toolkit.plugins.length || release2.plugins.some((member) => {
16696
18820
  const pin = lock.plugins[member.alias];
@@ -16711,11 +18835,13 @@ async function installFromLock(opts = {}) {
16711
18835
  const id = pin.pluginId ?? alias;
16712
18836
  const remoteId = pin.remoteId ?? id;
16713
18837
  const registry = opts.registry ?? pin.registry;
18838
+ const toolkit = Object.values(lock.toolkits ?? {}).find((entry) => entry.plugins.includes(alias));
18839
+ const registryClient = registry ? new RemoteRegistry({ baseUrl: registry, token: opts.token }) : void 0;
18840
+ const remote = toolkit ? registryClient?.forWorkspace(toolkit.destination) : registryClient;
16714
18841
  if (opts.frozen && opts.registry && opts.registry !== pin.registry)
16715
18842
  throw new Error("Frozen restore cannot change the registry");
16716
18843
  if (pin.scope && pin.scope !== "public" && registry) {
16717
18844
  if (opts.offline) throw new Error("Private plugin access must be reauthorized online before restore");
16718
- const remote = new RemoteRegistry({ baseUrl: registry, token: opts.token });
16719
18845
  if (!await remote.matchesLockedRelease(id, pin))
16720
18846
  throw new Error("Locked private release is not authorized or changed");
16721
18847
  }
@@ -16726,7 +18852,7 @@ async function installFromLock(opts = {}) {
16726
18852
  } else {
16727
18853
  if (opts.offline) throw new Error("Plugin " + alias + " is not in the offline cache");
16728
18854
  if (!registry) throw new Error(alias + " has no registry recorded; reinstall this local artifact");
16729
- const downloaded = await new RemoteRegistry({ baseUrl: registry, token: opts.token }).downloadBundle(
18855
+ const downloaded = await remote.downloadBundle(
16730
18856
  remoteId,
16731
18857
  pin.version,
16732
18858
  pin.scope,