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