@scalar/cli 2.10.0 → 2.12.0

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.
Files changed (99) hide show
  1. package/README.md +84 -1289
  2. package/chunks/action-2OPUQFUY.js +164 -0
  3. package/chunks/{action-4GZI2M5B.js → action-36LZ6XXE.js} +19 -17
  4. package/chunks/{action-KDUFU7TZ.js → action-3XMTJJRT.js} +19 -16
  5. package/chunks/{action-R4PGILN4.js → action-6CLEENBI.js} +47 -36
  6. package/chunks/{action-ZFI77WA5.js → action-7HXYZPOT.js} +10 -10
  7. package/chunks/{action-X7BA7PQQ.js → action-AC5ENU6Z.js} +20 -18
  8. package/chunks/{action-PPTFYZWD.js → action-ADGLTNFC.js} +28 -22
  9. package/chunks/{action-7XOHYWYM.js → action-AOKHLTZ6.js} +25 -21
  10. package/chunks/{action-XOADBXSX.js → action-AVSJ3AJY.js} +17 -16
  11. package/chunks/{action-GFLRD7LO.js → action-D3IVCY24.js} +8 -8
  12. package/chunks/action-EBZJS367.js +130 -0
  13. package/chunks/{action-ZKA3RR3S.js → action-EZXHSAJ2.js} +18 -17
  14. package/chunks/{action-5LF4XYHX.js → action-FDTVHVHF.js} +12 -12
  15. package/chunks/{action-JEYDBB3P.js → action-FUO5F7NV.js} +15 -15
  16. package/chunks/{action-DKDRAIKV.js → action-HA3CMV3P.js} +13 -15
  17. package/chunks/{action-YSVTZVKV.js → action-IG3BK2LF.js} +37 -26
  18. package/chunks/{action-H3RTILLM.js → action-IIQMZVRJ.js} +1 -1
  19. package/chunks/{action-DTEO4YNX.js → action-JT6C472I.js} +13 -11
  20. package/chunks/{action-UUL6SWV4.js → action-KDT6H6ML.js} +12 -14
  21. package/chunks/{action-PAM2EZ22.js → action-KJDIJQ3A.js} +8 -7
  22. package/chunks/{action-HT42NUUX.js → action-NF5E7JKA.js} +40 -38
  23. package/chunks/{action-EAUTQ77U.js → action-NIZBME45.js} +26 -24
  24. package/chunks/{action-CB55NWAU.js → action-O757TFA2.js} +9 -9
  25. package/chunks/{action-XLE37MZL.js → action-ONR7QSN7.js} +23 -22
  26. package/chunks/{action-5RL4NWUZ.js → action-QM2BMMHG.js} +33 -30
  27. package/chunks/{action-GWYYTUTM.js → action-QVTAZCKY.js} +5 -5
  28. package/chunks/action-SLB52XRG.js +65 -0
  29. package/chunks/{action-CABLS46Q.js → action-UTFRCKGE.js} +11 -11
  30. package/chunks/{action-4W5GUGEG.js → action-VESBFIP3.js} +20 -19
  31. package/chunks/{action-657A4K2D.js → action-VGFAIFYE.js} +26 -23
  32. package/chunks/action-WCU5O2VT.js +100 -0
  33. package/chunks/{action-TOBU74JH.js → action-XS5EESHW.js} +51 -27
  34. package/chunks/action-XVNRZ5VX.js +38 -0
  35. package/chunks/action-Y7EBKCUU.js +16 -0
  36. package/chunks/{action-5N3P43MD.js → action-YWQ2OKS3.js} +16 -15
  37. package/chunks/{actions-3SAMH7A5.js → actions-6QG7LH7P.js} +23 -20
  38. package/chunks/{agent-2ESZI7NO.js → agent-ONXROEAE.js} +44 -9
  39. package/chunks/{asyncapi-4HGVM3PR.js → asyncapi-7IFXAIE3.js} +13 -12
  40. package/chunks/{build.action-VBGFGACM.js → build.action-FI4OWY3T.js} +28 -26
  41. package/chunks/{chunk-ZGNDXPLU.js → chunk-26VIHQGL.js} +3 -3
  42. package/chunks/{chunk-JXGF5EHC.js → chunk-3HCEUGOE.js} +42 -13
  43. package/chunks/{chunk-G4HRW2FZ.js → chunk-5TNKTLQP.js} +370 -254
  44. package/chunks/{chunk-XAGJJNQW.js → chunk-BB6WWG25.js} +10 -10
  45. package/chunks/{chunk-K2HIB5BA.js → chunk-BCFUMXMC.js} +3 -3
  46. package/chunks/{action-F2ZJNURT.js → chunk-EBNFCIKS.js} +7 -10
  47. package/chunks/{chunk-MC4EMNOR.js → chunk-EJSGWV2K.js} +7 -6
  48. package/chunks/{chunk-GYRQPDTK.js → chunk-FJCOYEKT.js} +139 -3
  49. package/chunks/{chunk-ZKJPLWRJ.js → chunk-HU47OMI4.js} +4 -4
  50. package/chunks/{chunk-VVRUSQCY.js → chunk-I57ID5K7.js} +13 -0
  51. package/chunks/{chunk-43WALAW3.js → chunk-JLNHOA5Z.js} +64 -115
  52. package/chunks/{chunk-5SMP756H.js → chunk-LCSU43NJ.js} +2 -2
  53. package/chunks/{chunk-KHF2QXBG.js → chunk-N645RGAB.js} +1853 -683
  54. package/chunks/{chunk-3ZJYGGAA.js → chunk-ORCUZITN.js} +1 -1
  55. package/chunks/{chunk-H467HDVV.js → chunk-PERC34BV.js} +1 -1
  56. package/chunks/chunk-Q26DFKTY.js +37 -0
  57. package/chunks/{chunk-MMWSCTDB.js → chunk-QJQTSRU4.js} +19 -19
  58. package/chunks/{chunk-WDIWLXLV.js → chunk-RLBS4HJT.js} +3 -3
  59. package/chunks/{chunk-ATNTXKMS.js → chunk-RNZVZMYC.js} +198 -42
  60. package/chunks/{chunk-IPZP3VRA.js → chunk-RYWXF3LO.js} +12 -21
  61. package/chunks/{chunk-CWVYOXXM.js → chunk-SNOAL2C5.js} +11 -7
  62. package/chunks/{chunk-UDBSV3CK.js → chunk-T3R66THO.js} +6085 -4167
  63. package/chunks/{chunk-VYFGRLVQ.js → chunk-U73OW57G.js} +1 -1
  64. package/chunks/chunk-U764PQUA.js +1034 -0
  65. package/chunks/{chunk-KZNRQVMY.js → chunk-UAFCSWQ6.js} +1 -1
  66. package/chunks/{chunk-WB6PWTMU.js → chunk-UBLFIMUA.js} +1 -1
  67. package/chunks/{chunk-WIEXQUTD.js → chunk-UODTHS76.js} +1 -1
  68. package/chunks/chunk-V3MYP5SQ.js +247 -0
  69. package/chunks/{chunk-36LXIJIZ.js → chunk-V6LUKXBV.js} +1 -16
  70. package/chunks/{chunk-6M7TL2G2.js → chunk-VRZSDUZK.js} +45 -5
  71. package/chunks/{chunk-GLWTVLKM.js → chunk-VUNOOPEG.js} +9 -2
  72. package/chunks/chunk-VUXPDHTQ.js +22 -0
  73. package/chunks/{chunk-DHZW7Q7U.js → chunk-VVQOFG76.js} +2 -4
  74. package/chunks/chunk-XP5UM7SF.js +21 -0
  75. package/chunks/{chunk-ZYBLQ5CT.js → chunk-Y6C3H27E.js} +9 -4
  76. package/chunks/{chunk-35Z7VTJT.js → chunk-YTFFBGNQ.js} +52 -38
  77. package/chunks/{chunk-BIMLCGKS.js → chunk-ZNLMQKDU.js} +1 -1
  78. package/chunks/{create.action-DBNIS665.js → create.action-PPMZEMZL.js} +34 -32
  79. package/chunks/{delete.action-GBOZC45K.js → delete.action-GDOHATRZ.js} +30 -28
  80. package/chunks/{delete.action-K7BLK7DK.js → delete.action-VAHKEHEU.js} +29 -27
  81. package/chunks/{get.action-QHKMYZBK.js → get.action-UXFTGO7W.js} +24 -20
  82. package/chunks/{get.action-N3JOY3OU.js → get.action-XON3EZDT.js} +16 -15
  83. package/chunks/{list.action-TJCS6UEY.js → list.action-24F5WDGR.js} +37 -26
  84. package/chunks/{list.action-6SSO3JVN.js → list.action-OQEAEJ5U.js} +39 -29
  85. package/chunks/{publish.action-T24VHRMR.js → publish.action-G7FPDRBZ.js} +45 -43
  86. package/chunks/{scripts-VIBLGKYG.js → scripts-6CI6U32J.js} +1 -1
  87. package/chunks/{update.action-VOE6PH5F.js → update.action-IFIFXZWA.js} +29 -27
  88. package/chunks/{update.action-OGYNBXRU.js → update.action-MJDHVVR3.js} +30 -28
  89. package/index.js +290 -284
  90. package/package.json +2 -2
  91. package/skills/scalar-cli/SKILL.md +49 -49
  92. package/template.md +68 -252
  93. package/chunks/action-FBRY5JKU.js +0 -37
  94. package/chunks/action-LYCNT3KA.js +0 -73
  95. package/chunks/action-OJ2NK25F.js +0 -121
  96. package/chunks/action-U2L5DCFG.js +0 -91
  97. package/chunks/chunk-MNNGUUKJ.js +0 -405
  98. package/chunks/chunk-ZGVZU6L2.js +0 -422
  99. package/docs.html +0 -6977
@@ -0,0 +1,1034 @@
1
+ import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
2
+ import {
3
+ brandedUid,
4
+ docVersionSchema,
5
+ entitySchema,
6
+ external_exports,
7
+ mintUid,
8
+ namespaceSchema,
9
+ nanoidSchema,
10
+ randomManagedDocSlug,
11
+ scalarSet,
12
+ slugSchema,
13
+ timestampSchema,
14
+ zod_default
15
+ } from "./chunk-I57ID5K7.js";
16
+
17
+ // ../../packages/entities/dist/auth/secret.js
18
+ var SECRET_NAME_PATTERN = "[A-Z0-9_]{1,64}";
19
+ var secretNameSchema = external_exports.string().regex(new RegExp(`^${SECRET_NAME_PATTERN}$`));
20
+ var secretEnvironmentSchema = external_exports.string().regex(/^[a-z0-9-]{1,128}$/);
21
+ var SIGNING_ENVIRONMENT = "_signing";
22
+ var secretUidSchema = external_exports.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
23
+ var secretKindSchema = external_exports.enum(["secret", "var"]);
24
+ var secretMetadataSchema = external_exports.object({
25
+ uid: external_exports.string(),
26
+ environment: external_exports.string(),
27
+ name: external_exports.string(),
28
+ kind: secretKindSchema.default("secret"),
29
+ /** A var's value. A secret never has one here */
30
+ value: external_exports.string().optional(),
31
+ /** The first eight hex characters of a sha256 over the value */
32
+ fingerprint: external_exports.string(),
33
+ /** Unix seconds */
34
+ createdAt: external_exports.number(),
35
+ rotatedAt: external_exports.number().nullable(),
36
+ /**
37
+ * The user who created it; null when a service did, or for a record older
38
+ * than provenance. Defaults to null so a caller parses a store response
39
+ * that does not carry the field yet
40
+ */
41
+ createdBy: external_exports.string().nullable().default(null),
42
+ /** The user who last replaced its value; null when nobody has, or a service did. Defaults as `createdBy` does */
43
+ rotatedBy: external_exports.string().nullable().default(null)
44
+ }).refine((shown) => shown.kind === "var" === (shown.value !== void 0), {
45
+ message: "A var shows its value and a secret never does",
46
+ path: ["value"]
47
+ });
48
+ var storedNameShape = {
49
+ environment: secretEnvironmentSchema,
50
+ name: secretNameSchema
51
+ };
52
+ var writeStampShape = {
53
+ /** The first eight hex characters of a sha256 over the plaintext */
54
+ fingerprint: external_exports.string(),
55
+ /** Unix seconds; null until the value is first replaced */
56
+ rotatedAt: timestampSchema.nullable(),
57
+ /** A user uid; null when a service acted, or for a record copied from the flat collection */
58
+ rotatedBy: external_exports.string().nullable()
59
+ };
60
+ var provenanceShape = {
61
+ ...writeStampShape,
62
+ /** A user uid; null when a service acted, or for a record copied from the flat collection */
63
+ createdBy: external_exports.string().nullable()
64
+ };
65
+ var secretMetadataRecordSchema = entitySchema.extend({
66
+ ...storedNameShape,
67
+ ...provenanceShape
68
+ });
69
+ var secretValueRecordSchema = entitySchema.extend({
70
+ environment: external_exports.union([
71
+ secretEnvironmentSchema,
72
+ external_exports.literal(SIGNING_ENVIRONMENT)
73
+ ]),
74
+ name: external_exports.union([secretNameSchema, secretUidSchema]),
75
+ /** Base64 of the AES-256-GCM output with its tag appended */
76
+ ciphertext: external_exports.string(),
77
+ /** Base64 */
78
+ iv: external_exports.string(),
79
+ ...writeStampShape,
80
+ /**
81
+ * A signing secret's replaced value, sealed at the same address, which
82
+ * keeps signing until `expiresAt` (unix seconds) so a routine roll does not
83
+ * break a receiver still holding it. Null on every other value.
84
+ */
85
+ previous: external_exports.object({ ciphertext: external_exports.string(), iv: external_exports.string(), expiresAt: external_exports.number() }).nullish(),
86
+ /**
87
+ * What a signing secret belongs to, as `<kind>:<uid>` of its holder. Every
88
+ * read, roll and delete names it, so a holder whose reference was set to
89
+ * another secret's uid reaches nothing. Null on every other value.
90
+ */
91
+ owner: external_exports.string().nullish()
92
+ });
93
+ var varRecordSchema = entitySchema.extend({
94
+ ...storedNameShape,
95
+ value: external_exports.string(),
96
+ ...provenanceShape
97
+ });
98
+ var teamKeyRecordSchema = entitySchema.extend({
99
+ teamUid: external_exports.string().min(1),
100
+ /** The team's AES-256 data key wrapped by Cloud KMS, base64 */
101
+ wrappedKey: external_exports.string(),
102
+ /** The KMS key version that wrapped `wrappedKey` */
103
+ kmsKeyVersion: external_exports.string()
104
+ });
105
+
106
+ // ../../packages/entities/dist/mcp-server/environments.js
107
+ var mcpEnvironmentPolicies = ["automatic", "manual"];
108
+ var mcpClientCredentialSchema = external_exports.discriminatedUnion("kind", [
109
+ /** Public, or nothing the exposed operations send asks the client for anything. */
110
+ external_exports.object({ kind: external_exports.literal("none") }),
111
+ /** Scalar-fronted: the client signs in with Scalar. */
112
+ external_exports.object({ kind: external_exports.literal("scalar") }),
113
+ /** OAuth passthrough: the client signs in with the API's own authorization server. */
114
+ external_exports.object({
115
+ kind: external_exports.literal("oauth"),
116
+ authorizationServer: external_exports.string(),
117
+ scopes: external_exports.string().array()
118
+ }),
119
+ /** The install token, `{{ install.API_KEY }}` or `{{ install.ACCESS_TOKEN }}`, sent in this header. */
120
+ external_exports.object({
121
+ kind: external_exports.literal("token"),
122
+ header: external_exports.enum(["x-api-key", "Authorization"])
123
+ }),
124
+ /** A scheme with no reference, its credential forwarded from where the scheme says it travels. */
125
+ external_exports.object({
126
+ kind: external_exports.literal("forwarded"),
127
+ in: external_exports.enum(["header", "query", "cookie"]),
128
+ name: external_exports.string()
129
+ })
130
+ ]);
131
+
132
+ // ../../packages/entities/dist/agent/mcp.js
133
+ var mcpServerVersionChangeSources = [
134
+ "created",
135
+ "migration",
136
+ "user",
137
+ "docs-publish",
138
+ "track-latest",
139
+ "track-current",
140
+ "linked-resource-change"
141
+ ];
142
+ var mcpServerVersionStatuses = ["draft", "approved"];
143
+ var mcpDocumentTrackModes = [
144
+ "pinned",
145
+ "track-latest",
146
+ "track-current"
147
+ ];
148
+ var mcpDocsProjectTrackModes = [
149
+ "pinned",
150
+ "track-active-publish"
151
+ ];
152
+ var scalarExposeObjectSchema = external_exports.object({
153
+ enabled: external_exports.union([
154
+ external_exports.boolean(),
155
+ external_exports.object({ sdk: external_exports.boolean().optional(), mcp: external_exports.boolean().optional() })
156
+ ]).optional(),
157
+ name: external_exports.string().optional(),
158
+ description: external_exports.string().optional(),
159
+ deprecated: external_exports.boolean().optional(),
160
+ deprecationMessage: external_exports.string().optional()
161
+ });
162
+ var scalarExposeSchema = external_exports.union([
163
+ external_exports.boolean().transform((enabled) => ({ enabled })),
164
+ scalarExposeObjectSchema
165
+ ]);
166
+ var mcpToolGroupSchema = external_exports.object({
167
+ kind: external_exports.enum(["document", "tag"]),
168
+ name: external_exports.string(),
169
+ description: external_exports.string().nullable()
170
+ });
171
+ var mcpChannelModes = ["single", "multi"];
172
+ var mcpServerChannelSchema = external_exports.discriminatedUnion("kind", [
173
+ external_exports.object({ kind: external_exports.literal("api"), documentUid: external_exports.string() }),
174
+ external_exports.object({ kind: external_exports.literal("docs"), projectUid: external_exports.string() })
175
+ ]);
176
+ var mcpServerSchema = external_exports.object({
177
+ id: external_exports.string().meta({ examples: ["42"] }),
178
+ teamUid: external_exports.string(),
179
+ name: external_exports.string().meta({ examples: ["Acme API"] }),
180
+ slug: slugSchema,
181
+ uid: external_exports.string().meta({ examples: ["UakgbKJ5m9gl0JDMbcJqL"] }),
182
+ namespace: namespaceSchema,
183
+ // A mirror of the domain on the server's record in core, which owns it.
184
+ // A missing key parses to null, so a dashboard bundle keeps parsing agent
185
+ // responses that predate the column, whichever side deploys first.
186
+ domain: external_exports.string().nullable().default(null).meta({ examples: ["docs.example.com"] }),
187
+ // Missing keys parse to what a row gets before the channel backfill.
188
+ channelMode: external_exports.enum(mcpChannelModes).default("multi").meta({ examples: ["single"] }),
189
+ channels: mcpServerChannelSchema.array().default([]),
190
+ // A missing key parses to null, as for `domain`, whichever side deploys first.
191
+ docsProjectId: external_exports.string().nullable().default(null),
192
+ createdAt: external_exports.string().meta({ examples: ["2025-01-01T00:00:00.000Z"] }),
193
+ updatedAt: external_exports.string().meta({ examples: ["2025-01-01T00:00:00.000Z"] })
194
+ }).meta({ id: "mcp-server" });
195
+ var mcpServerVersionSchema = external_exports.object({
196
+ id: external_exports.string(),
197
+ mcpServerId: external_exports.string(),
198
+ semver: external_exports.string(),
199
+ // Defaulted so a dashboard bundle keeps parsing agent responses that
200
+ // predate these columns, whichever side deploys first.
201
+ environment: external_exports.string().default("production"),
202
+ base: external_exports.string().default(""),
203
+ parentVersionId: external_exports.string().nullable(),
204
+ changeSource: external_exports.enum(mcpServerVersionChangeSources),
205
+ changeNote: external_exports.string().nullable(),
206
+ newToolsSuggestionDismissed: external_exports.boolean(),
207
+ createdByUserId: external_exports.string().nullable(),
208
+ status: external_exports.enum(mcpServerVersionStatuses),
209
+ // Nullish input, null output: a dashboard bundle must keep parsing
210
+ // agent responses that predate these columns, whichever side deploys
211
+ // first — a missing key parses to null instead of failing.
212
+ approvalRequestedByUserId: external_exports.string().nullish().default(null),
213
+ approvalRequestedAt: external_exports.string().nullish().default(null),
214
+ approvedByUserId: external_exports.string().nullable(),
215
+ approvedAt: external_exports.string().nullable(),
216
+ // Nullish for the same reason as the approval request columns above.
217
+ currentBuildId: external_exports.string().nullish().default(null),
218
+ createdAt: external_exports.string()
219
+ }).meta({ id: "mcp-server-version" });
220
+ var mcpServerBuildReasons = [
221
+ "version",
222
+ "settings",
223
+ "document-reupload",
224
+ "backfill"
225
+ ];
226
+ var mcpServerOperationToolSchema = external_exports.object({
227
+ id: external_exports.string(),
228
+ mcpServerId: external_exports.string(),
229
+ mcpServerVersionId: external_exports.string(),
230
+ operationId: external_exports.string(),
231
+ searchToolEnabled: external_exports.boolean(),
232
+ executeRequestToolEnabled: external_exports.boolean(),
233
+ curatedToolEnabled: external_exports.boolean(),
234
+ name: external_exports.string().nullable(),
235
+ description: external_exports.string().nullable(),
236
+ deprecated: external_exports.boolean(),
237
+ deprecationMessage: external_exports.string().nullable(),
238
+ groups: mcpToolGroupSchema.array().default([]),
239
+ createdAt: external_exports.string(),
240
+ updatedAt: external_exports.string()
241
+ }).meta({
242
+ id: "mcp-server-operation-tool"
243
+ });
244
+ var mcpServerDocsPageToolSchema = external_exports.object({
245
+ id: external_exports.string(),
246
+ mcpServerId: external_exports.string(),
247
+ mcpServerVersionId: external_exports.string(),
248
+ docsPageId: external_exports.string(),
249
+ searchToolEnabled: external_exports.boolean(),
250
+ executeRequestToolEnabled: external_exports.boolean(),
251
+ createdAt: external_exports.string(),
252
+ updatedAt: external_exports.string()
253
+ }).meta({
254
+ id: "mcp-server-docs-page-tool"
255
+ });
256
+ var mcpServerDocumentVersionSchema = external_exports.object({
257
+ id: external_exports.string(),
258
+ mcpServerId: external_exports.string(),
259
+ mcpServerVersionId: external_exports.string(),
260
+ versionId: external_exports.string(),
261
+ trackMode: external_exports.enum(mcpDocumentTrackModes),
262
+ createdAt: external_exports.string()
263
+ }).meta({
264
+ id: "mcp-server-document-version"
265
+ });
266
+ var mcpServerDocsPublishSchema = external_exports.object({
267
+ id: external_exports.string(),
268
+ mcpServerId: external_exports.string(),
269
+ mcpServerVersionId: external_exports.string(),
270
+ docsPublishId: external_exports.string(),
271
+ trackMode: external_exports.enum(mcpDocsProjectTrackModes),
272
+ createdAt: external_exports.string()
273
+ }).meta({
274
+ id: "mcp-server-docs-publish"
275
+ });
276
+ var mcpAuthModes = [
277
+ "global",
278
+ "passthrough",
279
+ "identity",
280
+ "oauth"
281
+ ];
282
+ var PASSTHROUGH_NAME_REGEX = /^[A-Za-z0-9!#$%&'*+\-.^_`|~]+$/;
283
+ var PASSTHROUGH_MAX_ENTRIES = 20;
284
+ var PASSTHROUGH_NAME_MAX_LENGTH = 128;
285
+ var PASSTHROUGH_HEADER_DENYLIST = [
286
+ "host",
287
+ "content-length",
288
+ "content-type",
289
+ "accept",
290
+ "accept-encoding",
291
+ "expect",
292
+ "connection",
293
+ "transfer-encoding",
294
+ "te",
295
+ "upgrade",
296
+ "trailer",
297
+ "keep-alive",
298
+ "proxy-authorization",
299
+ "proxy-authenticate",
300
+ "proxy-connection",
301
+ "mcp-session-id",
302
+ "mcp-protocol-version",
303
+ "x-scalar-agent-key",
304
+ "x-scalar-docs-project",
305
+ "x-scalar-sdk-provider",
306
+ "x-scalar-cookie",
307
+ "forwarded",
308
+ "x-forwarded-for",
309
+ "x-forwarded-host",
310
+ "x-forwarded-proto"
311
+ ];
312
+ var PASSTHROUGH_QUERY_DENYLIST = ["env"];
313
+ function deniedPassthroughReason(entry) {
314
+ if (entry.in === "header" && PASSTHROUGH_HEADER_DENYLIST.includes(entry.name.toLowerCase()))
315
+ return `The ${entry.name} header cannot be forwarded`;
316
+ if (entry.in === "query" && PASSTHROUGH_QUERY_DENYLIST.includes(entry.name))
317
+ return `The ${entry.name} query parameter picks the environment and cannot be forwarded`;
318
+ return void 0;
319
+ }
320
+ var passthroughAuthEntrySchema = external_exports.object({
321
+ in: external_exports.enum(["header", "query"]),
322
+ name: external_exports.string().min(1, "Name is required").max(PASSTHROUGH_NAME_MAX_LENGTH, "Name is too long").regex(PASSTHROUGH_NAME_REGEX, "Invalid character in name")
323
+ });
324
+ var passthroughAuthListSchema = external_exports.array(passthroughAuthEntrySchema).max(PASSTHROUGH_MAX_ENTRIES).superRefine((entries, ctx) => {
325
+ const seen = /* @__PURE__ */ new Set();
326
+ entries.forEach((entry, index) => {
327
+ const key = `${entry.in}:${entry.name.toLowerCase()}`;
328
+ if (seen.has(key))
329
+ ctx.addIssue({
330
+ code: "custom",
331
+ message: `"${entry.name}" is already in the list`,
332
+ path: [index, "name"]
333
+ });
334
+ seen.add(key);
335
+ const denied = deniedPassthroughReason(entry);
336
+ if (denied)
337
+ ctx.addIssue({
338
+ code: "custom",
339
+ message: denied,
340
+ path: [index, "name"]
341
+ });
342
+ });
343
+ });
344
+ var OAUTH_SCOPES_MAX_ENTRIES = 50;
345
+ var OAUTH_SCOPE_MAX_LENGTH = 200;
346
+ var mcpOauthPassthroughSchema = external_exports.object({
347
+ /**
348
+ * The issuer MCP clients discover through RFC 8414 metadata and sign in
349
+ * with. Exactly what the protected resource metadata lists, so it is the
350
+ * issuer identifier and not the authorize endpoint.
351
+ */
352
+ authorizationServer: external_exports.url({
353
+ protocol: /^https$/,
354
+ message: "Enter the https URL of the authorization server (its issuer)"
355
+ }),
356
+ /** Advertised as `scopes_supported`, so clients know what to request */
357
+ scopes: external_exports.array(external_exports.string().min(1).max(OAUTH_SCOPE_MAX_LENGTH).regex(/^[\x21\x23-\x5B\x5D-\x7E]+$/, "Invalid character in scope")).max(OAUTH_SCOPES_MAX_ENTRIES).default([])
358
+ });
359
+ var mcpVersionAuthSchema = external_exports.object({
360
+ mode: external_exports.enum(mcpAuthModes).default("global"),
361
+ passthrough: passthroughAuthListSchema.default([]),
362
+ oauth: mcpOauthPassthroughSchema.optional(),
363
+ /**
364
+ * The secret store name that holds this version's stored credential
365
+ * (`global` mode) in the installation's environment. The credential
366
+ * itself lives in the auth service's secret store.
367
+ */
368
+ secret: secretNameSchema.optional()
369
+ }).superRefine((config, ctx) => {
370
+ if (config.mode === "oauth" && !config.oauth)
371
+ ctx.addIssue({
372
+ code: "custom",
373
+ message: "OAuth passthrough needs an authorization server",
374
+ path: ["oauth"]
375
+ });
376
+ });
377
+ var mcpAuthConfigSchema = external_exports.record(external_exports.string(), mcpVersionAuthSchema).superRefine((authConfig, ctx) => {
378
+ const hasIdentity = Object.values(authConfig).some((config) => config.mode === "identity");
379
+ const hasOauth = Object.values(authConfig).some((config) => config.mode === "oauth");
380
+ let issuer;
381
+ for (const [versionId, config] of Object.entries(authConfig)) {
382
+ if (hasOauth && config.mode === "passthrough") {
383
+ const index = config.passthrough.findIndex((entry) => entry.in === "header" && entry.name.toLowerCase() === "authorization");
384
+ if (index !== -1)
385
+ ctx.addIssue({
386
+ code: "custom",
387
+ message: "Authorization is used by OAuth passthrough on this installation, so it cannot also be forwarded",
388
+ path: [versionId, "passthrough", index, "name"]
389
+ });
390
+ }
391
+ if (config.mode !== "oauth" || !config.oauth)
392
+ continue;
393
+ if (hasIdentity)
394
+ ctx.addIssue({
395
+ code: "custom",
396
+ message: "OAuth passthrough cannot be combined with identity mode on one installation",
397
+ path: [versionId, "mode"]
398
+ });
399
+ issuer ??= config.oauth.authorizationServer;
400
+ if (config.oauth.authorizationServer !== issuer)
401
+ ctx.addIssue({
402
+ code: "custom",
403
+ message: "Every API using OAuth passthrough must use the same authorization server",
404
+ path: [versionId, "oauth", "authorizationServer"]
405
+ });
406
+ }
407
+ });
408
+ var mcpInstallationSchema = external_exports.object({
409
+ id: external_exports.string().meta({ examples: ["42"] }),
410
+ mcpServerId: external_exports.string().meta({ examples: ["42"] }),
411
+ name: external_exports.string().meta({ examples: ["Acme API"] }),
412
+ slug: slugSchema,
413
+ isPrivate: external_exports.boolean().meta({ examples: [false] }),
414
+ accessGroups: external_exports.array(external_exports.string()).default([]).meta({ examples: [["UakgbKJ5m9gl0JDMbcJqL"]] }),
415
+ loginPortalUid: external_exports.string().nullable().default(null).meta({ examples: ["LakgbKJ5m9gl0JDMbcJqL"] }),
416
+ mcpVersion: external_exports.string().nullable().default(null).meta({ examples: ["1.2.0"] }),
417
+ piiRedactionEnabled: external_exports.boolean().default(false).meta({ examples: [true] }),
418
+ credentialRedactionEnabled: external_exports.boolean().default(false).meta({ examples: [true] }),
419
+ // Nullish input with a default, so a payload without these columns still parses.
420
+ activeBuildId: external_exports.string().nullish().default(null),
421
+ policy: external_exports.enum(mcpEnvironmentPolicies).default("automatic").meta({ examples: ["automatic"] })
422
+ }).meta({ id: "mcp-installation" });
423
+ var createdMcpServerSchema = external_exports.object({
424
+ server: mcpServerSchema,
425
+ installation: mcpInstallationSchema
426
+ });
427
+
428
+ // ../../packages/entities/dist/registry/instance.js
429
+ var contentShaSchema = external_exports.string().regex(/^[a-f0-9]{64}$/, "Content sha must be a sha-256 hex digest");
430
+ var docInstanceSourceSchema = external_exports.enum(["manual", "cli", "api", "git-sync", "url-sync", "migration"]).meta({ id: "doc-instance-source" });
431
+ var docInstanceOriginSchema = external_exports.discriminatedUnion("type", [
432
+ external_exports.object({ type: external_exports.literal("platform") }),
433
+ external_exports.object({
434
+ type: external_exports.literal("git"),
435
+ /**
436
+ * Commit that carried this content. Null when the content landed but the
437
+ * commit did not — the mirror is best-effort and can be switched off.
438
+ */
439
+ commitSha: external_exports.string().nullable().default(null),
440
+ /** Branch this content was committed on. Null for direct-to-published writes. */
441
+ branch: external_exports.string().nullable().default(null),
442
+ /**
443
+ * A platform edit to a git-sourced document that went out as a pull
444
+ * request. Open while `resolution` is null; the webhook stamps `merged`
445
+ * or `closed` when the pull request settles, so "does this document have
446
+ * an open proposal" is answerable from the log alone. The row itself is
447
+ * append-only history — a merged proposal's content re-enters the log as
448
+ * a fresh instance via the merge push.
449
+ */
450
+ draft: external_exports.object({
451
+ prNumber: external_exports.number(),
452
+ branch: external_exports.string(),
453
+ /** How the pull request settled; null while it is still open. */
454
+ resolution: external_exports.enum(["merged", "closed"]).nullable().default(null)
455
+ }).nullable().default(null)
456
+ }),
457
+ external_exports.object({
458
+ type: external_exports.literal("url"),
459
+ /** Upstream this content was fetched from. */
460
+ url: external_exports.url()
461
+ })
462
+ ]).meta({ id: "doc-instance-origin" });
463
+ var docInstanceSchema = entitySchema.extend({
464
+ /** Own uid, branded so it cannot be confused with another entity's uid */
465
+ uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
466
+ /** Version label the content declared (info.version) or the caller supplied */
467
+ version: docVersionSchema,
468
+ /**
469
+ * SHA-256 hex digest of the serialized JSON — the single content identity.
470
+ * Blob keys for BOTH formats derive from it: `blobs/<jsonSha>.json` and
471
+ * `blobs/<jsonSha>.yaml`.
472
+ */
473
+ jsonSha: contentShaSchema,
474
+ /**
475
+ * SHA-256 hex digest of the serialized YAML twin. Integrity metadata for
476
+ * verifying served YAML bytes — never a storage key.
477
+ */
478
+ yamlSha: contentShaSchema,
479
+ /** User uid or email that produced this content. Null for system syncs. */
480
+ uploadedBy: external_exports.string().nullable().default(null),
481
+ /** The channel that triggered the write */
482
+ source: docInstanceSourceSchema,
483
+ /** Where the bytes came from; platform-native unless a git or url source supplied them */
484
+ origin: docInstanceOriginSchema.default({ type: "platform" }),
485
+ /** Free-form commit-style message supplied by the writer */
486
+ message: external_exports.string().default(""),
487
+ /**
488
+ * Lineage pointers recorded from day one so instances form a DAG. Branch
489
+ * and merge flows build on this; backfilling parents later would be far
490
+ * more expensive than stamping them now.
491
+ */
492
+ parentInstanceUid: brandedUid().nullable().default(null),
493
+ /** Second parent for merge commits */
494
+ mergeParentUid: brandedUid().nullable().default(null),
495
+ /**
496
+ * The instance this one reverts to. Set only by rollback, which appends a
497
+ * new instance carrying the target's content hashes rather than mutating
498
+ * any pointer — so history renders "reverted to X" without diffing hashes,
499
+ * and the chain stays append-only.
500
+ */
501
+ revertOf: brandedUid().nullable().default(null),
502
+ /**
503
+ * Denormalized serving eligibility, stamped false only on draft instances.
504
+ * Exists solely for the chain's unique-parent index: Mongo partial indexes
505
+ * cannot express "origin.draft is null or missing", so eligibility needs a
506
+ * stored equality field. {@link isServingEligibleInstance} (origin-derived)
507
+ * stays the read-side authority; this field is never read by resolvers.
508
+ */
509
+ servable: external_exports.boolean().default(true)
510
+ }).meta({ id: "doc-instance" });
511
+
512
+ // ../../packages/entities/dist/registry/schema.js
513
+ var RegistryAsset;
514
+ (function(RegistryAsset2) {
515
+ RegistryAsset2["Apis"] = "apis";
516
+ RegistryAsset2["Rules"] = "rules";
517
+ RegistryAsset2["Schemas"] = "schemas";
518
+ RegistryAsset2["Sdks"] = "sdks";
519
+ RegistryAsset2["Workspaces"] = "workspaces";
520
+ })(RegistryAsset || (RegistryAsset = {}));
521
+ var RegistryResourceTypes = [
522
+ RegistryAsset.Apis,
523
+ RegistryAsset.Schemas,
524
+ RegistryAsset.Rules,
525
+ RegistryAsset.Sdks,
526
+ RegistryAsset.Workspaces
527
+ ];
528
+ var registryAssetSchema = external_exports.enum(RegistryAsset).meta({ id: "registry-asset" });
529
+ var registryGitExternalSchema = external_exports.discriminatedUnion("provider", [
530
+ external_exports.object({
531
+ provider: external_exports.literal("github"),
532
+ linkedBy: external_exports.string(),
533
+ installationId: external_exports.number().int(),
534
+ id: external_exports.number().int(),
535
+ name: external_exports.string().min(2),
536
+ branch: external_exports.string().default("main"),
537
+ /** Where the canonical file lives inside the linked repo. */
538
+ path: external_exports.string().default(""),
539
+ webhookId: external_exports.string().default("")
540
+ }),
541
+ external_exports.object({
542
+ provider: external_exports.literal("bitbucket"),
543
+ linkedBy: external_exports.string(),
544
+ workspaceUuid: external_exports.string(),
545
+ workspaceSlug: external_exports.string(),
546
+ repoUuid: external_exports.string(),
547
+ repoSlug: external_exports.string(),
548
+ name: external_exports.string().min(2),
549
+ branch: external_exports.string().default("main"),
550
+ webhookUuid: external_exports.string().default("")
551
+ })
552
+ ]).meta({ id: "registry-git-external" });
553
+ var registryGitBindingSchema = external_exports.object({
554
+ forgejo: external_exports.object({
555
+ owner: external_exports.string(),
556
+ repo: external_exports.string(),
557
+ branch: external_exports.string().default("main")
558
+ }),
559
+ /** Publish when a commit lands on the tracked branch. */
560
+ publishOnPush: external_exports.boolean().default(true),
561
+ /** Publish when a pull request is merged. */
562
+ publishOnMerge: external_exports.boolean().default(false),
563
+ trackedBranch: external_exports.string().default("main"),
564
+ /** Forgejo webhook id, so it can be updated or removed. */
565
+ webhookId: external_exports.number().nullable().default(null),
566
+ external: registryGitExternalSchema.nullable().default(null),
567
+ /** The commit currently served as the published state. */
568
+ currentPublishedSha: external_exports.string().nullable().default(null),
569
+ lastPublishedAt: timestampSchema.nullable().default(null)
570
+ }).meta({ id: "registry-git-binding" });
571
+ var docSourceSchema = external_exports.discriminatedUnion("type", [
572
+ external_exports.object({ type: external_exports.literal("platform") }),
573
+ external_exports.object({
574
+ type: external_exports.literal("git"),
575
+ /** The team's linked repository this document sources from. */
576
+ repositoryUid: nanoidSchema.brand(),
577
+ /** Where the canonical file lives inside the repository. */
578
+ path: external_exports.string().min(1),
579
+ /**
580
+ * The branch publishes track and pull requests target. Null follows the
581
+ * repository's default branch.
582
+ */
583
+ branch: external_exports.string().nullable().default(null),
584
+ /** Publish when a commit lands on the tracked branch. */
585
+ publishOnPush: external_exports.boolean().default(true),
586
+ /** Publish when a pull request merges into the tracked branch. */
587
+ publishOnMerge: external_exports.boolean().default(false),
588
+ /**
589
+ * The commit currently served as the published state. Advanced by
590
+ * compare-and-swap so redelivered webhooks and racing publishes cannot
591
+ * interleave the publish log and the pointer.
592
+ */
593
+ currentPublishedSha: external_exports.string().nullable().default(null),
594
+ lastPublishedAt: timestampSchema.nullable().default(null)
595
+ }),
596
+ external_exports.object({
597
+ type: external_exports.literal("url"),
598
+ url: external_exports.url(),
599
+ linkedBy: external_exports.string(),
600
+ /** ETag from the last fetch so refreshes can use If-None-Match */
601
+ etag: external_exports.string().nullable().default(null),
602
+ lastFetchedAt: timestampSchema.nullable().default(null)
603
+ })
604
+ ]).meta({ id: "doc-source" });
605
+ var baseRegistrySchema = entitySchema.extend({
606
+ /** Team namespace - not linked by UID */
607
+ namespace: namespaceSchema.meta({ examples: ["acme"] }),
608
+ /** UI label for registry item */
609
+ title: external_exports.string().max(100).default("").meta({ examples: ["Acme API"] }),
610
+ /** Unique configuration identifier */
611
+ slug: slugSchema.default(randomManagedDocSlug).meta({ default: void 0 }),
612
+ /** Extended description for registry item */
613
+ description: external_exports.string().default("").meta({ examples: ["API for managing Acme products and orders."] }),
614
+ /** Public accessibility */
615
+ isPrivate: external_exports.boolean().default(false).meta({ examples: [false] }),
616
+ /**
617
+ * Surfaced ahead of the rest of the list on the namespace's registry page.
618
+ * A record only ever belongs to one namespace, so this needs no target.
619
+ */
620
+ pinned: external_exports.boolean().default(false),
621
+ /** Grouping/identifier tags */
622
+ tags: scalarSet(external_exports.set(external_exports.string()).max(100)).default([]).meta({ examples: [["products", "orders"]] }),
623
+ /** Access groups for private access permissions */
624
+ accessGroups: scalarSet(external_exports.set(nanoidSchema).max(50)).default([]).meta({ examples: [["UakgbKJ5m9gl0JDMbcJqL"]] }),
625
+ /** The uid of the login portal customization object for private documents */
626
+ loginPortalUid: external_exports.string().optional().meta({ examples: ["LakgbKJ5m9gl0JDMbcJqL"] }),
627
+ /** Whether the content has been scanned and confirmed to not to contain malicious content */
628
+ verifiedContent: external_exports.boolean().optional(),
629
+ /**
630
+ * Where this document's content is authored. Records written before this
631
+ * field existed omit it and read back as platform-native.
632
+ *
633
+ * Kept a plain `.default()` rather than a `.nullish().transform()` that
634
+ * would also absorb a stored `null`: the API framework drops piped fields
635
+ * from generated response types, so a transform here erases `source` from
636
+ * every registry response. Nothing writes `null`, so write it as `undefined`
637
+ * (omit the field) rather than reintroducing the pipe.
638
+ */
639
+ source: docSourceSchema.default({ type: "platform" }),
640
+ /**
641
+ * @deprecated Forgejo registry backing is being retired in favor of
642
+ * content-addressed GCS blobs + the instance log. Use `source` for the
643
+ * external-repo link. Dropped once the backfill is verified.
644
+ */
645
+ git: registryGitBindingSchema.nullable().optional()
646
+ }).meta({ id: "base-registry" });
647
+
648
+ // ../../packages/entities/dist/registry/migration.js
649
+ var registryGitMigrationResourceSchema = external_exports.object({
650
+ asset: registryAssetSchema,
651
+ namespace: namespaceSchema,
652
+ slug: slugSchema,
653
+ resourceUid: nanoidSchema,
654
+ status: external_exports.enum([
655
+ "migrated",
656
+ "already-migrated",
657
+ "partial",
658
+ "would-migrate",
659
+ "error"
660
+ ]),
661
+ versionsImported: external_exports.number().default(0),
662
+ versionsSkipped: external_exports.number().default(0),
663
+ error: external_exports.string().default("")
664
+ });
665
+ var registryGitMigrationStatusSchema = external_exports.enum([
666
+ "running",
667
+ "complete",
668
+ "partial",
669
+ "failed"
670
+ ]);
671
+ var registryGitMigrationSchema = entitySchema.extend({
672
+ teamUid: brandedUid(),
673
+ dryRun: external_exports.boolean().default(false),
674
+ status: registryGitMigrationStatusSchema,
675
+ /**
676
+ * While `running`, the unix time after which the lease is considered
677
+ * abandoned and another run may take over. Renewed as the run progresses, so
678
+ * it only lapses when the run really stopped (a crash, a killed pod) rather
679
+ * than because the work took a while. Zero once the run has finished.
680
+ */
681
+ lockedUntil: external_exports.number().default(0),
682
+ resources: registryGitMigrationResourceSchema.array().default([])
683
+ }).meta({ id: "registry-git-migration" });
684
+
685
+ // ../../packages/entities/dist/registry/publish.js
686
+ var registryPublishSourceSchema = external_exports.enum(["manual", "git-hook", "external-push", "migration"]).meta({ id: "registry-publish-source" });
687
+ var registryPublishAuthorSchema = external_exports.object({
688
+ name: external_exports.string(),
689
+ email: external_exports.string()
690
+ });
691
+ var registryPublishRecordSchema = entitySchema.extend({
692
+ resourceUid: nanoidSchema,
693
+ asset: registryAssetSchema,
694
+ namespace: namespaceSchema,
695
+ slug: slugSchema,
696
+ /** Null for unversioned resources (rules). */
697
+ version: docVersionSchema.nullable().default(null),
698
+ commitSha: external_exports.string(),
699
+ parentSha: external_exports.string().nullable().default(null),
700
+ source: registryPublishSourceSchema,
701
+ message: external_exports.string().default(""),
702
+ author: registryPublishAuthorSchema.nullable().default(null)
703
+ }).meta({ id: "registry-publish" });
704
+
705
+ // ../../packages/entities/dist/agent/embed.js
706
+ var embedStatuses = ["pending", "success", "failed"];
707
+
708
+ // ../../packages/entities/dist/agent/docs.js
709
+ var docsProjectTypes = ["sync", "wysiwyg", "docs"];
710
+ var agentDocsProjectSchema = zod_default.object({
711
+ id: zod_default.string(),
712
+ uid: zod_default.string(),
713
+ name: zod_default.string(),
714
+ teamUid: zod_default.string(),
715
+ isPrivate: zod_default.boolean(),
716
+ type: zod_default.enum(docsProjectTypes),
717
+ activePublishId: zod_default.string().nullable(),
718
+ mcpServerId: zod_default.string().nullable(),
719
+ // Nullish input, null output, so a payload without the column still parses.
720
+ mcpEnvironment: zod_default.string().nullish().default(null),
721
+ agentEnabled: zod_default.boolean(),
722
+ createdAt: zod_default.string(),
723
+ updatedAt: zod_default.string()
724
+ }).meta({ id: "agent-docs-project" });
725
+ var docsPublishSchema = zod_default.object({
726
+ id: zod_default.string(),
727
+ uid: zod_default.string(),
728
+ projectId: zod_default.string(),
729
+ domain: zod_default.string(),
730
+ embedStatus: zod_default.enum(embedStatuses),
731
+ createdAt: zod_default.string(),
732
+ updatedAt: zod_default.string()
733
+ }).meta({ id: "docs-publish" });
734
+ var docsPageSchema = zod_default.object({
735
+ id: zod_default.string(),
736
+ publishId: zod_default.string(),
737
+ title: zod_default.string(),
738
+ description: zod_default.string().nullable(),
739
+ to: zod_default.string(),
740
+ filepath: zod_default.string(),
741
+ contentHash: zod_default.string().nullable(),
742
+ searchToolEnabled: zod_default.boolean(),
743
+ executeRequestToolEnabled: zod_default.boolean(),
744
+ createdAt: zod_default.string()
745
+ }).meta({ id: "docs-page" });
746
+ var docsPageEmbeddingSchema = zod_default.object({
747
+ id: zod_default.string(),
748
+ pageId: zod_default.string(),
749
+ raw: zod_default.instanceof(Uint8Array),
750
+ embedding: zod_default.number().array(),
751
+ metadata: zod_default.record(zod_default.string(), zod_default.unknown()).nullable(),
752
+ createdAt: zod_default.string()
753
+ }).meta({ id: "docs-embedding" });
754
+
755
+ // ../../packages/entities/dist/agent/key.js
756
+ var agentKeySchema = zod_default.object({
757
+ id: zod_default.string(),
758
+ teamUid: zod_default.string(),
759
+ name: zod_default.string().max(50).default("My Agent Key"),
760
+ description: zod_default.string().max(200).default(""),
761
+ revoked: zod_default.boolean(),
762
+ expiresAt: zod_default.string(),
763
+ createdAt: zod_default.string(),
764
+ updatedAt: zod_default.string()
765
+ }).meta({ id: "agent-key" });
766
+ var agentTokenPayloadSchema = zod_default.object({
767
+ uid: zod_default.string(),
768
+ teamUid: nanoidSchema.optional(),
769
+ documentUids: nanoidSchema.array().optional(),
770
+ /** Ephemeral key minted for a registry API reference preview page. */
771
+ registryPreview: zod_default.boolean().optional(),
772
+ exp: zod_default.number().int()
773
+ }).meta({ id: "agent-token-payload" });
774
+ var SCALAR_AGENT_KEY_HEADER = "x-scalar-agent-key";
775
+
776
+ // ../../packages/entities/dist/agent/mcp-history.js
777
+ var mcpServerHistoryBuildSchema = external_exports.object({
778
+ id: external_exports.string(),
779
+ mcpServerVersionId: external_exports.string(),
780
+ /** The label of the version the build belongs to. */
781
+ semver: external_exports.string(),
782
+ hash: external_exports.string(),
783
+ reason: external_exports.enum(mcpServerBuildReasons),
784
+ provenance: external_exports.object({
785
+ documents: external_exports.object({
786
+ documentUid: external_exports.string(),
787
+ label: external_exports.string(),
788
+ jsonSha: external_exports.string()
789
+ }).array(),
790
+ selectionSha: external_exports.string(),
791
+ schemaVersion: external_exports.number()
792
+ }),
793
+ createdByUserId: external_exports.string().nullable(),
794
+ createdAt: external_exports.string(),
795
+ /** The build the environment's pointer is on. */
796
+ active: external_exports.boolean(),
797
+ /** The build an automatic environment would serve: the head version's current build. */
798
+ head: external_exports.boolean()
799
+ }).meta({ id: "mcp-server-history-build" });
800
+ var mcpServerHistorySchema = external_exports.object({
801
+ environment: external_exports.string(),
802
+ policy: external_exports.enum(mcpEnvironmentPolicies),
803
+ activeBuildId: external_exports.string().nullable(),
804
+ headBuildId: external_exports.string().nullable(),
805
+ /** The line's versions, head first. */
806
+ versions: mcpServerVersionSchema.array(),
807
+ /** The builds of the line's versions, newest first. */
808
+ builds: mcpServerHistoryBuildSchema.array(),
809
+ /**
810
+ * Whether the line has more than the ones listed: versions further from
811
+ * the head, or older builds.
812
+ */
813
+ truncated: external_exports.boolean()
814
+ }).meta({ id: "mcp-server-history" });
815
+
816
+ // ../../packages/entities/dist/agent/monthly-usage.js
817
+ var monthlyUsageSchema = zod_default.object({
818
+ identifier: zod_default.string(),
819
+ month: zod_default.date(),
820
+ type: zod_default.enum([
821
+ "public-user",
822
+ "web-team-user",
823
+ "agent-key",
824
+ "docs-project",
825
+ "mcp-installation",
826
+ "mcp-environment",
827
+ "registry-preview"
828
+ ]),
829
+ teamUid: zod_default.string().nullable(),
830
+ inputTokens: zod_default.number(),
831
+ outputTokens: zod_default.number(),
832
+ messages: zod_default.number(),
833
+ toolCalls: zod_default.number(),
834
+ // bigint column: the pg driver returns int8 as a string, so coerce on read.
835
+ microCredits: zod_default.coerce.number()
836
+ }).meta({ id: "monthly-usage" });
837
+
838
+ // ../../packages/entities/dist/agent/document.js
839
+ var documentSchema = zod_default.object({
840
+ id: zod_default.uuid(),
841
+ uid: nanoidSchema,
842
+ slug: slugSchema,
843
+ teamUid: nanoidSchema.nullable(),
844
+ namespace: namespaceSchema,
845
+ isPrivate: zod_default.boolean(),
846
+ title: zod_default.string(),
847
+ description: zod_default.string(),
848
+ logoUrl: zod_default.url().nullable(),
849
+ searchEnabled: zod_default.boolean(),
850
+ currentVersion: docVersionSchema,
851
+ latestVersion: docVersionSchema,
852
+ curated: zod_default.boolean(),
853
+ createdAt: zod_default.date(),
854
+ updatedAt: zod_default.date()
855
+ }).meta({ id: "document" });
856
+
857
+ // ../../packages/entities/dist/agent/key-documents.js
858
+ var keyDocumentSchema = zod_default.object({
859
+ keyId: zod_default.uuid(),
860
+ documentId: zod_default.uuid()
861
+ }).meta({ id: "key-documents" });
862
+
863
+ // ../../node_modules/.pnpm/@scalar+helpers@0.16.1/node_modules/@scalar/helpers/dist/http/http-token.js
864
+ var HTTP_TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
865
+
866
+ // ../../packages/entities/dist/agent/operation.js
867
+ var methodSchema = zod_default.string().regex(HTTP_TOKEN, "Invalid HTTP method").meta({ id: "method" });
868
+ var operationSchema = zod_default.object({
869
+ id: zod_default.uuid(),
870
+ path: zod_default.string(),
871
+ method: methodSchema,
872
+ versionId: zod_default.uuid(),
873
+ embedding: zod_default.number().array(),
874
+ searchToolEnabled: zod_default.boolean(),
875
+ executeRequestToolEnabled: zod_default.boolean(),
876
+ operationId: zod_default.string().nullable(),
877
+ summary: zod_default.string().nullable(),
878
+ description: zod_default.string().nullable()
879
+ }).meta({ id: "operation" });
880
+ var UNEXECUTABLE_HTTP_METHODS = ["connect", "trace", "track"];
881
+ var unexecutableLookup = new Set(UNEXECUTABLE_HTTP_METHODS);
882
+
883
+ // ../../packages/entities/dist/agent/version.js
884
+ var versionSchema = zod_default.object({
885
+ id: zod_default.uuid(),
886
+ uid: nanoidSchema,
887
+ semver: docVersionSchema,
888
+ documentId: zod_default.uuid(),
889
+ raw: zod_default.instanceof(Uint8Array),
890
+ embedStatus: zod_default.enum(embedStatuses),
891
+ environment: zod_default.string(),
892
+ base: zod_default.string().nullable(),
893
+ createdAt: zod_default.date(),
894
+ updatedAt: zod_default.date()
895
+ }).meta({ id: "version" });
896
+
897
+ // ../../packages/entities/dist/registry/version.js
898
+ var docVersionToolSchema = external_exports.object({
899
+ path: external_exports.string().meta({ examples: ["/products"] }),
900
+ method: methodSchema,
901
+ enabledTools: external_exports.enum(["execute-request", "get-mini-openapi-spec"]).array()
902
+ });
903
+ var docEmbedStatusSchema = external_exports.enum(["complete", "failed"]);
904
+ var docVersionRecordSchema = entitySchema.extend({
905
+ /** Own uid, branded so it cannot be confused with another entity's uid */
906
+ uid: brandedUid().default(mintUid).meta({ default: "nanoid()" }),
907
+ version: docVersionSchema,
908
+ /**
909
+ * The tag of the line the version sits on, stamped from the label at mint
910
+ * (`splitLabel`). Unset on records minted before stamping, which read as
911
+ * production through `versionLine` until the environment-tags backfill
912
+ * stamps them.
913
+ */
914
+ environment: external_exports.string().nullish(),
915
+ /** The label without its tag. Versions are ordered on it within a line. */
916
+ base: external_exports.string().nullish(),
917
+ /** OpenAPI version normalized on upload */
918
+ upgraded: external_exports.boolean().default(false),
919
+ /**
920
+ * Endpoints (path + method pairs) counted from the document at ingest.
921
+ * Null when the count is unknown: rows minted before this field existed,
922
+ * heal-path rows created without a fresh parse, and non-OpenAPI documents.
923
+ * Feeds the included-SDK-size display; measure-and-warn only.
924
+ */
925
+ endpointCount: external_exports.number().int().nullable().default(null),
926
+ embedStatus: docEmbedStatusSchema.nullable().default(null),
927
+ tags: external_exports.string().array().default([]),
928
+ /**
929
+ * Null is a legitimate stored state, not just absence: zod keeps optional
930
+ * keys explicitly passed as `undefined`, and a driver without
931
+ * `ignoreUndefined` stores those as BSON null. Records written that way
932
+ * carry `tools: null`, and rejecting it silently drops the whole record
933
+ * from egress — so null parses like "no tools configured".
934
+ */
935
+ tools: docVersionToolSchema.array().nullish()
936
+ }).meta({ id: "doc-version-record" });
937
+
938
+ // ../../packages/entities/dist/registry/pages.js
939
+ var PAGES_SCHEMA_VERSION = 1;
940
+ var pagesNavigationEntrySchema = external_exports.looseObject({
941
+ id: external_exports.string(),
942
+ title: external_exports.string().default(""),
943
+ type: external_exports.string(),
944
+ get children() {
945
+ return external_exports.array(pagesNavigationEntrySchema).optional();
946
+ }
947
+ });
948
+ var pagesEntrySchema = external_exports.object({
949
+ /** The navigation entry's `type`, e.g. `operation`, `webhook`, `model`. */
950
+ type: external_exports.string(),
951
+ method: external_exports.string().optional(),
952
+ path: external_exports.string().optional(),
953
+ /** JSON pointer the entry renders, for the entry types that carry one. */
954
+ ref: external_exports.string().optional()
955
+ }).meta({ id: "pages-entry" });
956
+ var pagesCountsSchema = external_exports.object({
957
+ operations: external_exports.number().int().min(0).default(0),
958
+ webhooks: external_exports.number().int().min(0).default(0),
959
+ models: external_exports.number().int().min(0).default(0),
960
+ tags: external_exports.number().int().min(0).default(0),
961
+ /** Objects written under `chunks/`, which is every entry with a page. */
962
+ chunks: external_exports.number().int().min(0).default(0)
963
+ }).meta({ id: "pages-counts" });
964
+ var pagesManifestSchema = external_exports.object({
965
+ schemaVersion: external_exports.literal(PAGES_SCHEMA_VERSION),
966
+ /** Content identity of the instance this sidecar was derived from. */
967
+ jsonSha: contentShaSchema,
968
+ producedAt: timestampSchema,
969
+ counts: pagesCountsSchema,
970
+ /**
971
+ * The document with its operation-bearing buckets emptied — the base every
972
+ * page starts from, before its own chunk is merged in.
973
+ */
974
+ stripped: external_exports.record(external_exports.string(), external_exports.unknown()),
975
+ /**
976
+ * The navigation tree, with the Models group's children dropped: a large
977
+ * document has thousands of them, and they are served separately by
978
+ * `pagesModels` on first expand.
979
+ */
980
+ navigation: external_exports.array(pagesNavigationEntrySchema),
981
+ /** Navigation id to what it renders, for routing without walking the tree. */
982
+ entries: external_exports.record(external_exports.string(), pagesEntrySchema)
983
+ }).meta({ id: "pages-manifest" });
984
+ var pagesPreparingSchema = external_exports.object({
985
+ jsonSha: contentShaSchema,
986
+ claimedAt: timestampSchema,
987
+ /** Which producer holds the claim, so a stale takeover is attributable. */
988
+ instance: external_exports.string().default("")
989
+ }).meta({ id: "pages-preparing" });
990
+ var pagesFailedSchema = external_exports.object({
991
+ jsonSha: contentShaSchema,
992
+ failedAt: timestampSchema,
993
+ /** Operator-facing reason; surfaced to the client only as a failure. */
994
+ error: external_exports.string().default("")
995
+ }).meta({ id: "pages-failed" });
996
+
997
+ // ../../packages/entities/dist/registry/token.js
998
+ var registryTokenPayloadSchema = external_exports.object({
999
+ /** The team whose registry documents this token may read. */
1000
+ teamUid: nanoidSchema,
1001
+ exp: external_exports.number().int()
1002
+ }).meta({ id: "registry-token-payload" });
1003
+
1004
+ export {
1005
+ contentShaSchema,
1006
+ docInstanceOriginSchema,
1007
+ docInstanceSchema,
1008
+ RegistryResourceTypes,
1009
+ registryGitBindingSchema,
1010
+ docSourceSchema,
1011
+ baseRegistrySchema,
1012
+ registryPublishRecordSchema,
1013
+ embedStatuses,
1014
+ docsProjectTypes,
1015
+ agentDocsProjectSchema,
1016
+ agentKeySchema,
1017
+ SCALAR_AGENT_KEY_HEADER,
1018
+ secretMetadataSchema,
1019
+ mcpEnvironmentPolicies,
1020
+ mcpClientCredentialSchema,
1021
+ mcpDocumentTrackModes,
1022
+ mcpDocsProjectTrackModes,
1023
+ mcpChannelModes,
1024
+ mcpServerChannelSchema,
1025
+ mcpServerSchema,
1026
+ mcpServerVersionSchema,
1027
+ mcpServerDocsPageToolSchema,
1028
+ mcpInstallationSchema,
1029
+ createdMcpServerSchema,
1030
+ mcpServerHistorySchema,
1031
+ monthlyUsageSchema,
1032
+ docVersionToolSchema,
1033
+ docVersionRecordSchema
1034
+ };