@sanity/cli 8.31.0 → 8.32.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 (49) hide show
  1. package/README.md +179 -103
  2. package/bin/run.js +1 -1
  3. package/dist/actions/context/waitForSourceSync.js +1 -1
  4. package/dist/actions/context/waitForSourceSync.js.map +1 -1
  5. package/dist/actions/cors/filterAndValidateOrigin.js +1 -1
  6. package/dist/actions/cors/filterAndValidateOrigin.js.map +1 -1
  7. package/dist/actions/deploy/deployStudioSchemasAndManifestsWorker.js +13 -1
  8. package/dist/actions/deploy/deployStudioSchemasAndManifestsWorker.js.map +1 -1
  9. package/dist/actions/documents/validateDocuments.worker.js +2 -1
  10. package/dist/actions/documents/validateDocuments.worker.js.map +1 -1
  11. package/dist/actions/graphql/extractFromSanitySchema.js +1 -1
  12. package/dist/actions/graphql/extractFromSanitySchema.js.map +1 -1
  13. package/dist/actions/init/initStudio.js +1 -1
  14. package/dist/actions/init/initStudio.js.map +1 -1
  15. package/dist/actions/init/processTemplate.js +1 -1
  16. package/dist/actions/init/processTemplate.js.map +1 -1
  17. package/dist/actions/init/remoteTemplate.js +1 -1
  18. package/dist/actions/init/remoteTemplate.js.map +1 -1
  19. package/dist/actions/media/pullAspects.js +1 -1
  20. package/dist/actions/media/pullAspects.js.map +1 -1
  21. package/dist/actions/organizations/readOrganizationLogo.js +49 -0
  22. package/dist/actions/organizations/readOrganizationLogo.js.map +1 -0
  23. package/dist/actions/preview/previewAction.js +1 -1
  24. package/dist/actions/preview/previewAction.js.map +1 -1
  25. package/dist/actions/skills/readSkillState.js +1 -1
  26. package/dist/actions/skills/readSkillState.js.map +1 -1
  27. package/dist/actions/skills/setupSkills.js +1 -1
  28. package/dist/actions/skills/setupSkills.js.map +1 -1
  29. package/dist/commands/organizations/create.js +43 -3
  30. package/dist/commands/organizations/create.js.map +1 -1
  31. package/dist/commands/organizations/update.js +67 -14
  32. package/dist/commands/organizations/update.js.map +1 -1
  33. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +7 -2
  34. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
  35. package/dist/generated/contextOperations.js +2 -2
  36. package/dist/generated/contextOperations.js.map +1 -1
  37. package/dist/hooks/commandNotFound/topicAliases.js +1 -1
  38. package/dist/hooks/commandNotFound/topicAliases.js.map +1 -1
  39. package/dist/server/devServer.js +8 -10
  40. package/dist/server/devServer.js.map +1 -1
  41. package/dist/services/organizations.js +30 -0
  42. package/dist/services/organizations.js.map +1 -1
  43. package/dist/util/telemetry/cliCommandIdentity.js +3 -2
  44. package/dist/util/telemetry/cliCommandIdentity.js.map +1 -1
  45. package/dist/util/update/updateChecker.js +1 -1
  46. package/dist/util/update/updateChecker.js.map +1 -1
  47. package/oclif.config.js +1 -1
  48. package/oclif.manifest.json +2665 -2623
  49. package/package.json +25 -26
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/commands/organizations/update.ts"],"sourcesContent":["import {Args, Flags} from '@oclif/core'\nimport {type FlagInput} from '@oclif/core/interfaces'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\nimport {getErrorMessage} from '@sanity/cli-core/errors'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {isHttpError} from '@sanity/client'\n\nimport {validateOrganizationName} from '../../actions/organizations/validateOrganizationName.js'\nimport {validateOrganizationSlug} from '../../actions/organizations/validateOrganizationSlug.js'\nimport {type OrganizationUpdateParams, updateOrganization} from '../../services/organizations.js'\nimport {organizationAliases} from '../../util/organizationAliases.js'\nimport {defineCommandTelemetry} from '../../util/telemetry/commandTelemetry.js'\n\nconst updateOrgDebug = subdebug('organizations:update')\n\nconst UPDATE_FLAGS = ['name', 'slug', 'default-role'] as const\n\nexport class UpdateOrganizationCommand extends SanityCommand<typeof UpdateOrganizationCommand> {\n static override args = {\n organizationId: Args.string({\n description: 'Organization ID',\n required: true,\n }),\n }\n\n static override description = 'Update an organization'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --name \"New Name\"',\n description: 'Rename an organization',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --slug new-slug',\n description: 'Set the organization slug (requires authSAML feature)',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --default-role viewer',\n description: 'Change the default member role',\n },\n ]\n\n static override flags = {\n 'default-role': Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New default role for new members',\n required: false,\n }),\n name: Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New organization name',\n required: false,\n }),\n slug: Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New URL slug (requires authSAML feature on the organization)',\n required: false,\n }),\n } satisfies FlagInput\n\n static override hiddenAliases = organizationAliases('update')\n\n static telemetry = defineCommandTelemetry(this.flags, {redact: ['name']})\n\n public async run(): Promise<void> {\n const {organizationId} = this.args\n const {'default-role': defaultRole, name, slug} = this.flags\n\n const params: OrganizationUpdateParams = {}\n if (name !== undefined) {\n const trimmedName = name.trim()\n const validation = validateOrganizationName(trimmedName)\n if (validation !== true) {\n this.error(validation, {exit: exitCodes.RUNTIME_ERROR})\n }\n params.name = trimmedName\n }\n if (slug !== undefined) {\n const trimmedSlug = slug.trim()\n const slugValidation = validateOrganizationSlug(trimmedSlug)\n if (slugValidation !== true) {\n this.error(slugValidation, {exit: exitCodes.RUNTIME_ERROR})\n }\n params.slug = trimmedSlug\n }\n if (defaultRole !== undefined) {\n const trimmedRole = defaultRole.trim()\n if (trimmedRole === '') {\n this.error('Default role cannot be empty', {exit: exitCodes.RUNTIME_ERROR})\n }\n params.defaultRoleName = trimmedRole\n }\n\n const spin = spinner('Updating organization').start()\n try {\n await updateOrganization(organizationId, params)\n spin.succeed()\n this.log('Organization updated')\n } catch (error) {\n spin.fail()\n updateOrgDebug('Error updating organization', error)\n if (isHttpError(error) && error.statusCode === 404) {\n this.error(`Organization \"${organizationId}\" not found`, {exit: exitCodes.RUNTIME_ERROR})\n }\n this.error(`Failed to update organization: ${getErrorMessage(error)}`, {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n }\n}\n"],"names":["Args","Flags","exitCodes","SanityCommand","subdebug","getErrorMessage","spinner","isHttpError","validateOrganizationName","validateOrganizationSlug","updateOrganization","organizationAliases","defineCommandTelemetry","updateOrgDebug","UPDATE_FLAGS","UpdateOrganizationCommand","args","organizationId","string","description","required","examples","command","flags","atLeastOne","name","slug","hiddenAliases","telemetry","redact","run","defaultRole","params","undefined","trimmedName","trim","validation","error","exit","RUNTIME_ERROR","trimmedSlug","slugValidation","trimmedRole","defaultRoleName","spin","start","succeed","log","fail","statusCode"],"mappings":"AAAA,SAAQA,IAAI,EAAEC,KAAK,QAAO,cAAa;AAEvC,SAAQC,SAAS,EAAEC,aAAa,EAAEC,QAAQ,QAAO,mBAAkB;AACnE,SAAQC,eAAe,QAAO,0BAAyB;AACvD,SAAQC,OAAO,QAAO,sBAAqB;AAC3C,SAAQC,WAAW,QAAO,iBAAgB;AAE1C,SAAQC,wBAAwB,QAAO,0DAAyD;AAChG,SAAQC,wBAAwB,QAAO,0DAAyD;AAChG,SAAuCC,kBAAkB,QAAO,kCAAiC;AACjG,SAAQC,mBAAmB,QAAO,oCAAmC;AACrE,SAAQC,sBAAsB,QAAO,2CAA0C;AAE/E,MAAMC,iBAAiBT,SAAS;AAEhC,MAAMU,eAAe;IAAC;IAAQ;IAAQ;CAAe;AAErD,OAAO,MAAMC,kCAAkCZ;IAC7C,OAAgBa,OAAO;QACrBC,gBAAgBjB,KAAKkB,MAAM,CAAC;YAC1BC,aAAa;YACbC,UAAU;QACZ;IACF,EAAC;IAED,OAAgBD,cAAc,yBAAwB;IAEtD,OAAgBE,WAAW;QACzB;YACEC,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;KACD,CAAA;IAED,OAAgBI,QAAQ;QACtB,gBAAgBtB,M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AUqC,aAAa;gBAAA;YAC3E;YACAP,OAAOW,eAAe,GAAGD;QAC3B;QAEA,MAAME,OAAOtC,QAAQ,yBAAyBuC,KAAK;QACnD,IAAI;YACF,MAAMnC,mBAAmBO,gBAAgBe;YACzCY,KAAKE,OAAO;YACZ,IAAI,CAACC,GAAG,CAAC;QACX,EAAE,OAAOV,OAAO;YACdO,KAAKI,IAAI;YACTnC,eAAe,+BAA+BwB;YAC9C,IAAI9B,YAAY8B,UAAUA,MAAMY,UAAU,KAAK,KAAK;gBAClD,IAAI,CAACZ,KAAK,CAAC,CAAC,cAAc,EAAEpB,eAAe,WAAW,CAAC,EAAE;oBAACqB,MAAMpC,UAAUqC,aAAa;gBAAA;YACzF;YACA,IAAI,CAACF,KAAK,CAAC,CAAC,+BAA+B,EAAEhC,gBAAgBgC,QAAQ,EAAE;gBACrEC,MAAMpC,UAAUqC,aAAa;YAC/B;QACF;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/commands/organizations/update.ts"],"sourcesContent":["import {Args, Flags} from '@oclif/core'\nimport {type FlagInput} from '@oclif/core/interfaces'\nimport {exitCodes, SanityCommand, subdebug} from '@sanity/cli-core'\nimport {getErrorMessage} from '@sanity/cli-core/errors'\nimport {spinner} from '@sanity/cli-core/ux'\nimport {isHttpError} from '@sanity/client'\n\nimport {\n type OrganizationLogo,\n readOrganizationLogo,\n} from '../../actions/organizations/readOrganizationLogo.js'\nimport {validateOrganizationName} from '../../actions/organizations/validateOrganizationName.js'\nimport {validateOrganizationSlug} from '../../actions/organizations/validateOrganizationSlug.js'\nimport {\n type OrganizationUpdateParams,\n removeOrganizationLogo,\n setOrganizationLogo,\n updateOrganization,\n} from '../../services/organizations.js'\nimport {organizationAliases} from '../../util/organizationAliases.js'\nimport {defineCommandTelemetry} from '../../util/telemetry/commandTelemetry.js'\n\nconst updateOrgDebug = subdebug('organizations:update')\n\nconst UPDATE_FLAGS = ['name', 'slug', 'default-role', 'logo'] as const\n\nexport class UpdateOrganizationCommand extends SanityCommand<typeof UpdateOrganizationCommand> {\n static override args = {\n organizationId: Args.string({\n description: 'Organization ID',\n required: true,\n }),\n }\n\n static override description = 'Update an organization'\n\n static override examples = [\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --name \"New Name\"',\n description: 'Rename an organization',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --slug new-slug',\n description: 'Set the organization slug (requires authSAML feature)',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --default-role viewer',\n description: 'Change the default member role',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --logo ./logo.png',\n description: 'Set or replace the organization logo',\n },\n {\n command: '<%= config.bin %> <%= command.id %> org-abc123 --logo \"\"',\n description: 'Remove the organization logo',\n },\n ]\n\n static override flags = {\n 'default-role': Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New default role for new members',\n required: false,\n }),\n logo: Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description:\n 'Image file to use as the logo: PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF, at most 5 MB (\"\" removes it)',\n helpValue: '<path>',\n required: false,\n }),\n name: Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New organization name',\n required: false,\n }),\n slug: Flags.string({\n atLeastOne: [...UPDATE_FLAGS],\n description: 'New URL slug (requires authSAML feature on the organization)',\n required: false,\n }),\n } satisfies FlagInput\n\n static override hiddenAliases = organizationAliases('update')\n\n static telemetry = defineCommandTelemetry(this.flags, {redact: ['logo', 'name']})\n\n public async run(): Promise<void> {\n const {organizationId} = this.args\n const {'default-role': defaultRole, logo: logoPath, name, slug} = this.flags\n\n const params: OrganizationUpdateParams = {}\n if (name !== undefined) {\n const trimmedName = name.trim()\n const validation = validateOrganizationName(trimmedName)\n if (validation !== true) {\n this.error(validation, {exit: exitCodes.RUNTIME_ERROR})\n }\n params.name = trimmedName\n }\n if (slug !== undefined) {\n const trimmedSlug = slug.trim()\n const slugValidation = validateOrganizationSlug(trimmedSlug)\n if (slugValidation !== true) {\n this.error(slugValidation, {exit: exitCodes.RUNTIME_ERROR})\n }\n params.slug = trimmedSlug\n }\n if (defaultRole !== undefined) {\n const trimmedRole = defaultRole.trim()\n if (trimmedRole === '') {\n this.error('Default role cannot be empty', {exit: exitCodes.RUNTIME_ERROR})\n }\n params.defaultRoleName = trimmedRole\n }\n\n // undefined leaves the logo as it is, null removes it.\n let logo: OrganizationLogo | null | undefined\n if (logoPath === '') {\n logo = null\n } else if (logoPath !== undefined) {\n try {\n logo = await readOrganizationLogo(logoPath)\n } catch (error) {\n this.error(getErrorMessage(error), {exit: exitCodes.RUNTIME_ERROR})\n }\n }\n\n const spin = spinner('Updating organization').start()\n\n const updatesFields = Object.keys(params).length > 0\n if (updatesFields) {\n try {\n await updateOrganization(organizationId, params)\n } catch (error) {\n spin.fail()\n this.failRequest(error, 'Failed to update organization')\n }\n }\n\n let logoUrl: string | null = null\n if (logo !== undefined) {\n try {\n const response = logo\n ? await setOrganizationLogo(organizationId, logo)\n : await removeOrganizationLogo(organizationId)\n logoUrl = response.logoUrl\n } catch (error) {\n spin.fail()\n this.failRequest(\n error,\n updatesFields\n ? `The organization was updated, but its logo wasn't ${logo ? 'set' : 'removed'}`\n : `Failed to ${logo ? 'set' : 'remove'} the organization's logo`,\n )\n }\n }\n\n spin.succeed()\n this.log('Organization updated')\n if (logo) {\n this.log(`Logo: ${logoUrl}`)\n } else if (logo === null) {\n this.log('Logo removed')\n }\n }\n\n private failRequest(error: unknown, message: string): never {\n updateOrgDebug(message, error)\n if (isHttpError(error) && error.statusCode === 404) {\n this.error(`Organization \"${this.args.organizationId}\" not found`, {\n exit: exitCodes.RUNTIME_ERROR,\n })\n }\n this.error(`${message}: ${getErrorMessage(error)}`, {exit: exitCodes.RUNTIME_ERROR})\n }\n}\n"],"names":["Args","Flags","exitCodes","SanityCommand","subdebug","getErrorMessage","spinner","isHttpError","readOrganizationLogo","validateOrganizationName","validateOrganizationSlug","removeOrganizationLogo","setOrganizationLogo","updateOrganization","organizationAliases","defineCommandTelemetry","updateOrgDebug","UPDATE_FLAGS","UpdateOrganizationCommand","args","organizationId","string","description","required","examples","command","flags","atLeastOne","logo","helpValue","name","slug","hiddenAliases","telemetry","redact","run","defaultRole","logoPath","params","undefined","trimmedName","trim","validation","error","exit","RUNTIME_ERROR","trimmedSlug","slugValidation","trimmedRole","defaultRoleName","spin","start","updatesFields","Object","keys","length","fail","failRequest","logoUrl","response","succeed","log","message","statusCode"],"mappings":"AAAA,SAAQA,IAAI,EAAEC,KAAK,QAAO,cAAa;AAEvC,SAAQC,SAAS,EAAEC,aAAa,EAAEC,QAAQ,QAAO,mBAAkB;AACnE,SAAQC,eAAe,QAAO,0BAAyB;AACvD,SAAQC,OAAO,QAAO,sBAAqB;AAC3C,SAAQC,WAAW,QAAO,iBAAgB;AAE1C,SAEEC,oBAAoB,QACf,sDAAqD;AAC5D,SAAQC,wBAAwB,QAAO,0DAAyD;AAChG,SAAQC,wBAAwB,QAAO,0DAAyD;AAChG,SAEEC,sBAAsB,EACtBC,mBAAmB,EACnBC,kBAAkB,QACb,kCAAiC;AACxC,SAAQC,mBAAmB,QAAO,oCAAmC;AACrE,SAAQC,sBAAsB,QAAO,2CAA0C;AAE/E,MAAMC,iBAAiBZ,SAAS;AAEhC,MAAMa,eAAe;IAAC;IAAQ;IAAQ;IAAgB;CAAO;AAE7D,OAAO,MAAMC,kCAAkCf;IAC7C,OAAgBgB,OAAO;QACrBC,gBAAgBpB,KAAKqB,MAAM,CAAC;YAC1BC,aAAa;YACbC,UAAU;QACZ;IACF,EAAC;IAED,OAAgBD,cAAc,yBAAwB;IAEtD,OAAgBE,WAAW;QACzB;YACEC,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;QACA;YACEG,SAAS;YACTH,aAAa;QACf;KACD,CAAA;I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ACiC,GAAG,CAAC,CAAC,MAAM,EAAEH,SAAS;QAC7B,OAAO,IAAI9B,SAAS,MAAM;YACxB,IAAI,CAACiC,GAAG,CAAC;QACX;IACF;IAEQJ,YAAYd,KAAc,EAAEmB,OAAe,EAAS;QAC1D9C,eAAe8C,SAASnB;QACxB,IAAIpC,YAAYoC,UAAUA,MAAMoB,UAAU,KAAK,KAAK;YAClD,IAAI,CAACpB,KAAK,CAAC,CAAC,cAAc,EAAE,IAAI,CAACxB,IAAI,CAACC,cAAc,CAAC,WAAW,CAAC,EAAE;gBACjEwB,MAAM1C,UAAU2C,aAAa;YAC/B;QACF;QACA,IAAI,CAACF,KAAK,CAAC,GAAGmB,QAAQ,EAAE,EAAEzD,gBAAgBsC,QAAQ,EAAE;YAACC,MAAM1C,UAAU2C,aAAa;QAAA;IACpF;AACF"}
@@ -219,11 +219,16 @@ function apiValidator({ args, flags }) {
219
219
  // --web opens a browser on the machine running the MCP server.
220
220
  'openapi:get': conditionalDenyFlags('web'),
221
221
  'openapi:list': conditionalDenyFlags('web'),
222
- 'organizations:create': allow,
222
+ // --logo reads an image from the machine running the command.
223
+ 'organizations:create': conditionalDenyFlags('logo'),
223
224
  'organizations:delete': allow,
224
225
  'organizations:get': allow,
225
226
  'organizations:list': allow,
226
- 'organizations:update': allow,
227
+ // --logo reads an image from the machine running the command, except --logo "", which removes
228
+ // the logo and reads nothing.
229
+ 'organizations:update': conditionalPolicy({
230
+ validate: ({ flags })=>flags.logo === undefined || flags.logo === ''
231
+ }),
227
232
  // Serves a local production build.
228
233
  preview: deny,
229
234
  'projects:create': allow,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/exports/invokeSanityCli/commandPolicies/mcpPolicy.ts"],"sourcesContent":["import {\n allow,\n type CommandPolicySet,\n conditionalDenyFlags,\n conditionalPolicy,\n deny,\n} from '@sanity/cli-core/commandPolicy'\n\nimport {contextCommandTable} from '../../../actions/context/commandTable.js'\nimport {isRemoteAssetSource} from '../../../util/isRemoteAssetSource.js'\n\nfunction apiValidator({\n args,\n flags,\n}: {\n args: Readonly<Record<string, unknown>>\n flags: Readonly<Record<string, unknown>>\n}): boolean {\n const fields: unknown[] = Array.isArray(flags.field) ? flags.field : []\n\n const fieldReadsFromHost = fields.some((field) => {\n if (typeof field !== 'string') return false\n const separatorIndex = field.indexOf('=')\n return separatorIndex > 0 && field[separatorIndex + 1] === '@'\n })\n if (fieldReadsFromHost) return false\n\n const headers: unknown[] = Array.isArray(flags.header) ? flags.header : []\n\n const headerOverridesAuthentication = headers.some((header) => {\n if (typeof header !== 'string') return false\n const separatorIndex = header.indexOf(':')\n if (separatorIndex <= 0) return false\n\n const name = header.slice(0, separatorIndex).trim().toLowerCase()\n return name === 'authorization' || name === 'cookie'\n })\n\n if (headerOverridesAuthentication) return false\n\n const endpoint = typeof args.endpoint === 'string' ? URL.parse(args.endpoint) : null\n const urlEmbedsCredentials =\n endpoint !== null && (endpoint.username !== '' || endpoint.password !== '')\n\n return !urlEmbedsCredentials\n}\n\n/**\n * The context commands of the command table. Each is a remote request, except:\n * `--watch` polls with no deadline, so a stuck job or sync would hang the MCP\n * tool call; `sources create --file`/`--text` and `sources upload` read local\n * files or stdin; `documents content --output` writes a local file; and\n * `documents content --format raw` writes bytes straight to the process's\n * stdout, past the output capture, so they would land in the MCP host's own\n * stream.\n */\nconst contextCommandPolicies: CommandPolicySet = Object.fromEntries(\n contextCommandTable.map((entry) => {\n const id = entry.id.replaceAll(' ', ':')\n if (entry.id === 'context sources upload') return [id, deny]\n if (entry.id === 'context documents content') {\n return [\n id,\n conditionalPolicy({\n deniedFlags: ['output'],\n validate: ({flags}) => flags.format !== 'raw',\n }),\n ]\n }\n const denied = [\n ...('watch' in entry ? ['watch'] : []),\n ...(entry.id === 'context sources create' ? ['file', 'text'] : []),\n ]\n return [id, denied.length > 0 ? conditionalDenyFlags(...denied) : allow]\n }),\n)\n\n/**\n * MCP programmatic mode disables local project/config discovery (see the CLI\n * execution context). Missing project or dataset values may therefore produce\n * a usage error, but cannot cause local filesystem access. Destructive remote\n * operations are allowed and do not by themselves make a command unsafe.\n *\n * Every command this package contributes must have exactly one policy here:\n * - allow: every valid invocation is safe\n * - conditional: safety depends on parsed arguments or flags\n * - deny: no invocation is safe\n *\n * Commands contributed by plugins are not listed here. Each plugin declares\n * policies for its own commands (see `PluginInvocationPolicies` in\n * `@sanity/cli-core/commandPolicy`).\n */\nexport const mcpPolicy: CommandPolicySet = {\n // Special exception, this can be very dangerous but is also super useful\n // to expose. Refuse authentication overrides and host input channels:\n // `--token`, Authorization, and Cookie headers replace the MCP user's authentication,\n // URL-embedded credentials replace it with Basic authentication,\n // `--input` reads the request body from the host's filesystem or stdin, and\n // `-F key=@<file>` / `-F key=@-` field values do the same.\n api: conditionalPolicy({\n deniedFlags: ['input', 'token'],\n validate: apiValidator,\n }),\n\n // --file reads from the machine running the command and must only run locally.\n 'assets:upload': conditionalPolicy({\n deniedFlags: ['content-type', 'file'],\n validate: ({flags}) => typeof flags['from-url'] === 'string' && flags['from-url'].length > 0,\n }),\n\n 'backups:disable': allow,\n // Writes a downloaded backup to the local filesystem.\n 'backups:download': deny,\n 'backups:enable': allow,\n 'backups:list': allow,\n\n // Requires a local Studio project and writes build output to disk.\n build: deny,\n\n // Reads and rewrites local source code.\n codemod: deny,\n\n ...contextCommandPolicies,\n 'context:entries:get': allow,\n 'context:entries:list': allow,\n 'context:issues:get': allow,\n 'context:issues:list': allow,\n 'context:mcp:create': allow,\n 'context:mcp:delete': allow,\n 'context:mcp:get': allow,\n 'context:mcp:list': allow,\n 'context:mcp:status': allow,\n 'context:mcp:update': allow,\n 'context:query': allow,\n\n 'cors:add': allow,\n 'cors:delete': allow,\n 'cors:list': allow,\n\n 'datasets:alias:create': allow,\n 'datasets:alias:delete': allow,\n 'datasets:alias:link': allow,\n 'datasets:alias:unlink': allow,\n 'datasets:copy': allow,\n 'datasets:create': allow,\n 'datasets:delete': allow,\n 'datasets:embeddings:disable': allow,\n 'datasets:embeddings:enable': allow,\n 'datasets:embeddings:status': allow,\n // Writes dataset contents and assets to the local filesystem.\n 'datasets:export': deny,\n // Reads import data from the local filesystem and may replace documents.\n 'datasets:import': deny,\n 'datasets:list': allow,\n 'datasets:visibility:get': allow,\n 'datasets:visibility:set': allow,\n\n // Inspects local project files and can print authentication secrets.\n debug: deny,\n\n // Reads, builds, and deploys a local Studio project.\n deploy: deny,\n\n // Loads a local Studio project and starts a development server.\n dev: deny,\n\n // Opens a browser on the machine running the MCP server.\n 'docs:browse': deny,\n // --web opens a browser on the machine running the MCP server.\n 'docs:read': conditionalDenyFlags('web'),\n 'docs:search': allow,\n\n // Reads and executes local project configuration for diagnostics.\n doctor: deny,\n\n // Reads document input from disk or launches a local editor.\n 'documents:create': deny,\n 'documents:delete': allow,\n 'documents:get': allow,\n 'documents:query': allow,\n // Loads a local Studio schema to validate documents.\n 'documents:validate': deny,\n\n // Executes arbitrary code in the local Studio context.\n exec: deny,\n\n // Loads a local schema and deploys a GraphQL API.\n 'graphql:deploy': deny,\n 'graphql:list': allow,\n // --api loads GraphQL definitions from the local project; explicit project/dataset flags are safe.\n 'graphql:undeploy': conditionalDenyFlags('api'),\n\n 'hooks:attempt': allow,\n 'hooks:create': allow,\n 'hooks:delete': allow,\n 'hooks:list': allow,\n 'hooks:logs': allow,\n\n // Creates or modifies a local project and may install dependencies.\n init: deny,\n\n // Installs packages into the local project.\n install: deny,\n\n // Opens a browser on the machine running the MCP server.\n learn: deny,\n\n // Performs an authentication flow.\n login: deny,\n\n // Performs an authentication operation and clears local credentials.\n logout: deny,\n\n // Reads local project configuration and opens a browser.\n manage: deny,\n\n // Loads local Studio configuration and writes manifest files.\n 'manifest:extract': deny,\n\n // Reads and writes local MCP client configuration.\n 'mcp:configure': deny,\n\n // Writes an aspect definition to the local filesystem.\n 'media:create-aspect': deny,\n 'media:delete-aspect': allow,\n // Reads a local aspect definition before deploying it.\n 'media:deploy-aspect': deny,\n // Writes media assets to the local filesystem.\n 'media:export': deny,\n // A directory or archive source reads media assets from the local\n // filesystem. A URL source does not: Sanity fetches the asset itself, so the\n // only local input is the URL. `--replace-aspects` is meaningless for a URL\n // source (the command rejects the combination), so it is hidden here rather\n // than advertised as usable surface.\n 'media:import': conditionalPolicy({\n deniedFlags: ['replace-aspects'],\n validate: ({args}) => typeof args.source === 'string' && isRemoteAssetSource(args.source),\n }),\n // media:pull-aspects and media:prune-aspect-data are hidden while the\n // config app is in beta, so they take the deny-by-default path like any\n // unlisted command. The exhaustiveness test forces explicit entries when\n // they are unhidden.\n\n // Creates migration source files in the local project.\n 'migrations:create': deny,\n // Reads and loads migration definitions from the local project.\n 'migrations:list': deny,\n // Executes local migration code that may perform arbitrary document mutations.\n 'migrations:run': deny,\n\n // Writes project setup values and scaffolds local applications.\n new: deny,\n\n // --web opens a browser on the machine running the MCP server.\n 'openapi:get': conditionalDenyFlags('web'),\n 'openapi:list': conditionalDenyFlags('web'),\n\n 'organizations:create': allow,\n 'organizations:delete': allow,\n 'organizations:get': allow,\n 'organizations:list': allow,\n 'organizations:update': allow,\n\n // Serves a local production build.\n preview: deny,\n\n 'projects:create': allow,\n 'projects:list': allow,\n // Reads locally stored claim URLs and robot tokens.\n 'projects:unclaimed': deny,\n\n // Loads the local Studio configuration to resolve the datasets containing each schema.\n 'schemas:delete': deny,\n // Loads local schema files before deploying them.\n 'schemas:deploy': deny,\n // Loads local Studio configuration and writes an extracted schema to disk.\n 'schemas:extract': deny,\n // Requires a local project and loads its schema configuration.\n 'schemas:list': deny,\n // Loads and executes a local Studio schema.\n 'schemas:validate': deny,\n\n // Installs skills into local editor configuration directories.\n 'skills:install': deny,\n\n // Changes account telemetry preferences and mutates local cached configuration.\n 'telemetry:disable': deny,\n // Changes account telemetry preferences and mutates local cached configuration.\n 'telemetry:enable': deny,\n 'telemetry:status': allow,\n\n // Creates authentication credentials.\n 'tokens:create': deny,\n // Deletes authentication credentials.\n 'tokens:delete': deny,\n // Exposes authentication credential metadata.\n 'tokens:list': deny,\n // Replaces authentication credentials and exposes the new secret.\n 'tokens:rotate': deny,\n\n // Reads the local schema and source files and writes generated types to the project.\n 'typegen:generate': deny,\n\n // Loads local CLI and workbench configuration to identify the deployed Studio or application.\n undeploy: deny,\n\n // Grants a user access to a project.\n 'users:invite': deny,\n 'users:list': allow,\n\n // Reads the local project and installed package tree.\n versions: deny,\n\n // Reads the authenticated user from the API using the execution context token.\n whoami: allow,\n}\n"],"names":["allow","conditionalDenyFlags","conditionalPolicy","deny","contextCommandTable","isRemoteAssetSource","apiValidator","args","flags","fields","Array","isArray","field","fieldReadsFromHost","some","separatorIndex","indexOf","headers","header","headerOverridesAuthentication","name","slice","trim","toLowerCase","endpoint","URL","parse","urlEmbedsCredentials","username","password","contextCommandPolicies","Object","fromEntries","map","entry","id","replaceAll","deniedFlags","validate","format","denied","length","mcpPolicy","api","build","codemod","debug","deploy","dev","doctor","exec","init","install","learn","login","logout","manage","source","new","preview","undeploy","versions","whoami"],"mappings":"AAAA,SACEA,KAAK,EAELC,oBAAoB,EACpBC,iBAAiB,EACjBC,IAAI,QACC,iCAAgC;AAEvC,SAAQC,mBAAmB,QAAO,2CAA0C;AAC5E,SAAQC,mBAAmB,QAAO,uCAAsC;AAExE,SAASC,aAAa,EACpBC,IAAI,EACJC,KAAK,EAIN;IACC,MAAMC,SAAoBC,MAAMC,OAAO,CAACH,MAAMI,KAAK,IAAIJ,MAAMI,KAAK,GAAG,EAAE;IAEvE,MAAMC,qBAAqBJ,OAAOK,IAAI,CAAC,CAACF;QACtC,IAAI,OAAOA,UAAU,UAAU,OAAO;QACtC,MAAMG,iBAAiBH,MAAMI,OAAO,CAAC;QACrC,OAAOD,iBAAiB,KAAKH,KAAK,CAACG,iBAAiB,EAAE,KAAK;IAC7D;IACA,IAAIF,oBAAoB,OAAO;IAE/B,MAAMI,UAAqBP,MAAMC,OAAO,CAACH,MAAMU,MAAM,IAAIV,MAAMU,MAAM,GAAG,EAAE;IAE1E,MAAMC,gCAAgCF,QAAQH,IAAI,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G;IAEtB,uFAAuF;IACvF,kBAAkBA;IAClB,kDAAkD;IAClD,kBAAkBA;IAClB,2EAA2E;IAC3E,mBAAmBA;IACnB,+DAA+D;IAC/D,gBAAgBA;IAChB,4CAA4C;IAC5C,oBAAoBA;IAEpB,+DAA+D;IAC/D,kBAAkBA;IAElB,gFAAgF;IAChF,qBAAqBA;IACrB,gFAAgF;IAChF,oBAAoBA;IACpB,oBAAoBH;IAEpB,sCAAsC;IACtC,iBAAiBG;IACjB,sCAAsC;IACtC,iBAAiBA;IACjB,8CAA8C;IAC9C,eAAeA;IACf,kEAAkE;IAClE,iBAAiBA;IAEjB,qFAAqF;IACrF,oBAAoBA;IAEpB,8FAA8F;IAC9FyD,UAAUzD;IAEV,qCAAqC;IACrC,gBAAgBA;IAChB,cAAcH;IAEd,sDAAsD;IACtD6D,UAAU1D;IAEV,+EAA+E;IAC/E2D,QAAQ9D;AACV,EAAC"}
1
+ {"version":3,"sources":["../../../../src/exports/invokeSanityCli/commandPolicies/mcpPolicy.ts"],"sourcesContent":["import {\n allow,\n type CommandPolicySet,\n conditionalDenyFlags,\n conditionalPolicy,\n deny,\n} from '@sanity/cli-core/commandPolicy'\n\nimport {contextCommandTable} from '../../../actions/context/commandTable.js'\nimport {isRemoteAssetSource} from '../../../util/isRemoteAssetSource.js'\n\nfunction apiValidator({\n args,\n flags,\n}: {\n args: Readonly<Record<string, unknown>>\n flags: Readonly<Record<string, unknown>>\n}): boolean {\n const fields: unknown[] = Array.isArray(flags.field) ? flags.field : []\n\n const fieldReadsFromHost = fields.some((field) => {\n if (typeof field !== 'string') return false\n const separatorIndex = field.indexOf('=')\n return separatorIndex > 0 && field[separatorIndex + 1] === '@'\n })\n if (fieldReadsFromHost) return false\n\n const headers: unknown[] = Array.isArray(flags.header) ? flags.header : []\n\n const headerOverridesAuthentication = headers.some((header) => {\n if (typeof header !== 'string') return false\n const separatorIndex = header.indexOf(':')\n if (separatorIndex <= 0) return false\n\n const name = header.slice(0, separatorIndex).trim().toLowerCase()\n return name === 'authorization' || name === 'cookie'\n })\n\n if (headerOverridesAuthentication) return false\n\n const endpoint = typeof args.endpoint === 'string' ? URL.parse(args.endpoint) : null\n const urlEmbedsCredentials =\n endpoint !== null && (endpoint.username !== '' || endpoint.password !== '')\n\n return !urlEmbedsCredentials\n}\n\n/**\n * The context commands of the command table. Each is a remote request, except:\n * `--watch` polls with no deadline, so a stuck job or sync would hang the MCP\n * tool call; `sources create --file`/`--text` and `sources upload` read local\n * files or stdin; `documents content --output` writes a local file; and\n * `documents content --format raw` writes bytes straight to the process's\n * stdout, past the output capture, so they would land in the MCP host's own\n * stream.\n */\nconst contextCommandPolicies: CommandPolicySet = Object.fromEntries(\n contextCommandTable.map((entry) => {\n const id = entry.id.replaceAll(' ', ':')\n if (entry.id === 'context sources upload') return [id, deny]\n if (entry.id === 'context documents content') {\n return [\n id,\n conditionalPolicy({\n deniedFlags: ['output'],\n validate: ({flags}) => flags.format !== 'raw',\n }),\n ]\n }\n const denied = [\n ...('watch' in entry ? ['watch'] : []),\n ...(entry.id === 'context sources create' ? ['file', 'text'] : []),\n ]\n return [id, denied.length > 0 ? conditionalDenyFlags(...denied) : allow]\n }),\n)\n\n/**\n * MCP programmatic mode disables local project/config discovery (see the CLI\n * execution context). Missing project or dataset values may therefore produce\n * a usage error, but cannot cause local filesystem access. Destructive remote\n * operations are allowed and do not by themselves make a command unsafe.\n *\n * Every command this package contributes must have exactly one policy here:\n * - allow: every valid invocation is safe\n * - conditional: safety depends on parsed arguments or flags\n * - deny: no invocation is safe\n *\n * Commands contributed by plugins are not listed here. Each plugin declares\n * policies for its own commands (see `PluginInvocationPolicies` in\n * `@sanity/cli-core/commandPolicy`).\n */\nexport const mcpPolicy: CommandPolicySet = {\n // Special exception, this can be very dangerous but is also super useful\n // to expose. Refuse authentication overrides and host input channels:\n // `--token`, Authorization, and Cookie headers replace the MCP user's authentication,\n // URL-embedded credentials replace it with Basic authentication,\n // `--input` reads the request body from the host's filesystem or stdin, and\n // `-F key=@<file>` / `-F key=@-` field values do the same.\n api: conditionalPolicy({\n deniedFlags: ['input', 'token'],\n validate: apiValidator,\n }),\n\n // --file reads from the machine running the command and must only run locally.\n 'assets:upload': conditionalPolicy({\n deniedFlags: ['content-type', 'file'],\n validate: ({flags}) => typeof flags['from-url'] === 'string' && flags['from-url'].length > 0,\n }),\n\n 'backups:disable': allow,\n // Writes a downloaded backup to the local filesystem.\n 'backups:download': deny,\n 'backups:enable': allow,\n 'backups:list': allow,\n\n // Requires a local Studio project and writes build output to disk.\n build: deny,\n\n // Reads and rewrites local source code.\n codemod: deny,\n\n ...contextCommandPolicies,\n 'context:entries:get': allow,\n 'context:entries:list': allow,\n 'context:issues:get': allow,\n 'context:issues:list': allow,\n 'context:mcp:create': allow,\n 'context:mcp:delete': allow,\n 'context:mcp:get': allow,\n 'context:mcp:list': allow,\n 'context:mcp:status': allow,\n 'context:mcp:update': allow,\n 'context:query': allow,\n\n 'cors:add': allow,\n 'cors:delete': allow,\n 'cors:list': allow,\n\n 'datasets:alias:create': allow,\n 'datasets:alias:delete': allow,\n 'datasets:alias:link': allow,\n 'datasets:alias:unlink': allow,\n 'datasets:copy': allow,\n 'datasets:create': allow,\n 'datasets:delete': allow,\n 'datasets:embeddings:disable': allow,\n 'datasets:embeddings:enable': allow,\n 'datasets:embeddings:status': allow,\n // Writes dataset contents and assets to the local filesystem.\n 'datasets:export': deny,\n // Reads import data from the local filesystem and may replace documents.\n 'datasets:import': deny,\n 'datasets:list': allow,\n 'datasets:visibility:get': allow,\n 'datasets:visibility:set': allow,\n\n // Inspects local project files and can print authentication secrets.\n debug: deny,\n\n // Reads, builds, and deploys a local Studio project.\n deploy: deny,\n\n // Loads a local Studio project and starts a development server.\n dev: deny,\n\n // Opens a browser on the machine running the MCP server.\n 'docs:browse': deny,\n // --web opens a browser on the machine running the MCP server.\n 'docs:read': conditionalDenyFlags('web'),\n 'docs:search': allow,\n\n // Reads and executes local project configuration for diagnostics.\n doctor: deny,\n\n // Reads document input from disk or launches a local editor.\n 'documents:create': deny,\n 'documents:delete': allow,\n 'documents:get': allow,\n 'documents:query': allow,\n // Loads a local Studio schema to validate documents.\n 'documents:validate': deny,\n\n // Executes arbitrary code in the local Studio context.\n exec: deny,\n\n // Loads a local schema and deploys a GraphQL API.\n 'graphql:deploy': deny,\n 'graphql:list': allow,\n // --api loads GraphQL definitions from the local project; explicit project/dataset flags are safe.\n 'graphql:undeploy': conditionalDenyFlags('api'),\n\n 'hooks:attempt': allow,\n 'hooks:create': allow,\n 'hooks:delete': allow,\n 'hooks:list': allow,\n 'hooks:logs': allow,\n\n // Creates or modifies a local project and may install dependencies.\n init: deny,\n\n // Installs packages into the local project.\n install: deny,\n\n // Opens a browser on the machine running the MCP server.\n learn: deny,\n\n // Performs an authentication flow.\n login: deny,\n\n // Performs an authentication operation and clears local credentials.\n logout: deny,\n\n // Reads local project configuration and opens a browser.\n manage: deny,\n\n // Loads local Studio configuration and writes manifest files.\n 'manifest:extract': deny,\n\n // Reads and writes local MCP client configuration.\n 'mcp:configure': deny,\n\n // Writes an aspect definition to the local filesystem.\n 'media:create-aspect': deny,\n 'media:delete-aspect': allow,\n // Reads a local aspect definition before deploying it.\n 'media:deploy-aspect': deny,\n // Writes media assets to the local filesystem.\n 'media:export': deny,\n // A directory or archive source reads media assets from the local\n // filesystem. A URL source does not: Sanity fetches the asset itself, so the\n // only local input is the URL. `--replace-aspects` is meaningless for a URL\n // source (the command rejects the combination), so it is hidden here rather\n // than advertised as usable surface.\n 'media:import': conditionalPolicy({\n deniedFlags: ['replace-aspects'],\n validate: ({args}) => typeof args.source === 'string' && isRemoteAssetSource(args.source),\n }),\n // media:pull-aspects and media:prune-aspect-data are hidden while the\n // config app is in beta, so they take the deny-by-default path like any\n // unlisted command. The exhaustiveness test forces explicit entries when\n // they are unhidden.\n\n // Creates migration source files in the local project.\n 'migrations:create': deny,\n // Reads and loads migration definitions from the local project.\n 'migrations:list': deny,\n // Executes local migration code that may perform arbitrary document mutations.\n 'migrations:run': deny,\n\n // Writes project setup values and scaffolds local applications.\n new: deny,\n\n // --web opens a browser on the machine running the MCP server.\n 'openapi:get': conditionalDenyFlags('web'),\n 'openapi:list': conditionalDenyFlags('web'),\n\n // --logo reads an image from the machine running the command.\n 'organizations:create': conditionalDenyFlags('logo'),\n 'organizations:delete': allow,\n 'organizations:get': allow,\n 'organizations:list': allow,\n // --logo reads an image from the machine running the command, except --logo \"\", which removes\n // the logo and reads nothing.\n 'organizations:update': conditionalPolicy({\n validate: ({flags}) => flags.logo === undefined || flags.logo === '',\n }),\n\n // Serves a local production build.\n preview: deny,\n\n 'projects:create': allow,\n 'projects:list': allow,\n // Reads locally stored claim URLs and robot tokens.\n 'projects:unclaimed': deny,\n\n // Loads the local Studio configuration to resolve the datasets containing each schema.\n 'schemas:delete': deny,\n // Loads local schema files before deploying them.\n 'schemas:deploy': deny,\n // Loads local Studio configuration and writes an extracted schema to disk.\n 'schemas:extract': deny,\n // Requires a local project and loads its schema configuration.\n 'schemas:list': deny,\n // Loads and executes a local Studio schema.\n 'schemas:validate': deny,\n\n // Installs skills into local editor configuration directories.\n 'skills:install': deny,\n\n // Changes account telemetry preferences and mutates local cached configuration.\n 'telemetry:disable': deny,\n // Changes account telemetry preferences and mutates local cached configuration.\n 'telemetry:enable': deny,\n 'telemetry:status': allow,\n\n // Creates authentication credentials.\n 'tokens:create': deny,\n // Deletes authentication credentials.\n 'tokens:delete': deny,\n // Exposes authentication credential metadata.\n 'tokens:list': deny,\n // Replaces authentication credentials and exposes the new secret.\n 'tokens:rotate': deny,\n\n // Reads the local schema and source files and writes generated types to the project.\n 'typegen:generate': deny,\n\n // Loads local CLI and workbench configuration to identify the deployed Studio or application.\n undeploy: deny,\n\n // Grants a user access to a project.\n 'users:invite': deny,\n 'users:list': allow,\n\n // Reads the local project and installed package tree.\n versions: deny,\n\n // Reads the authenticated user from the API using the execution context token.\n whoami: allow,\n}\n"],"names":["allow","conditionalDenyFlags","conditionalPolicy","deny","contextCommandTable","isRemoteAssetSource","apiValidator","args","flags","fields","Array","isArray","field","fieldReadsFromHost","some","separatorIndex","indexOf","headers","header","headerOverridesAuthentication","name","slice","trim","toLowerCase","endpoint","URL","parse","urlEmbedsCredentials","username","password","contextCommandPolicies","Object","fromEntries","map","entry","id","replaceAll","deniedFlags","validate","format","denied","length","mcpPolicy","api","build","codemod","debug","deploy","dev","doctor","exec","init","install","learn","login","logout","manage","source","new","logo","undefined","preview","undeploy","versions","whoami"],"mappings":"AAAA,SACEA,KAAK,EAELC,oBAAoB,EACpBC,iBAAiB,EACjBC,IAAI,QACC,iCAAgC;AAEvC,SAAQC,mBAAmB,QAAO,2CAA0C;AAC5E,SAAQC,mBAAmB,QAAO,uCAAsC;AAExE,SAASC,aAAa,EACpBC,IAAI,EACJC,KAAK,EAIN;IACC,MAAMC,SAAoBC,MAAMC,OAAO,CAACH,MAAMI,KAAK,IAAIJ,MAAMI,KAAK,GAAG,EAAE;IAEvE,MAAMC,qBAAqBJ,OAAOK,IAAI,CAAC,CAACF;QACtC,IAAI,OAAOA,UAAU,UAAU,OAAO;QACtC,MAAMG,iBAAiBH,MAAMI,OAAO,CAAC;QACrC,OAAOD,iBAAiB,KAAKH,KAAK,CAACG,iBAAiB,EAAE,KAAK;IAC7D;IACA,IAAIF,oBAAoB,OAAO;IAE/B,MAAMI,UAAqBP,MAAMC,OAAO,CAACH,MAAMU,MAAM,IAAIV,MAAMU,MAAM,GAAG,EAAE;IAE1E,MAAMC,gCAAgCF,QAAQH,IAAI,CAAC,CAACI;QAClD,IAAI,OAAOA,WAAW,UAAU,OAAO;QACvC,MAAMH,iBAAiBG,OAAOF,OAAO,CAAC;QACtC,IAAID,kBAAkB,GAAG,OAAO;QAEhC,MAAMK,OAAOF,OAAOG,KAAK,CAAC,GAAGN,gBAAgBO,IAAI,GAAGC,WAAW;QAC/D,OAAOH,SAAS,mBAAmBA,SAAS;IAC9C;IAEA,IAAID,+BAA+B,OAAO;IAE1C,MAAMK,WAA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AgBA;IAChB,4CAA4C;IAC5C,oBAAoBA;IAEpB,+DAA+D;IAC/D,kBAAkBA;IAElB,gFAAgF;IAChF,qBAAqBA;IACrB,gFAAgF;IAChF,oBAAoBA;IACpB,oBAAoBH;IAEpB,sCAAsC;IACtC,iBAAiBG;IACjB,sCAAsC;IACtC,iBAAiBA;IACjB,8CAA8C;IAC9C,eAAeA;IACf,kEAAkE;IAClE,iBAAiBA;IAEjB,qFAAqF;IACrF,oBAAoBA;IAEpB,8FAA8F;IAC9F2D,UAAU3D;IAEV,qCAAqC;IACrC,gBAAgBA;IAChB,cAAcH;IAEd,sDAAsD;IACtD+D,UAAU5D;IAEV,+EAA+E;IAC/E6D,QAAQhE;AACV,EAAC"}
@@ -509,7 +509,7 @@
509
509
  },
510
510
  getJob: {
511
511
  body: 'none',
512
- description: 'Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns the job ID.',
512
+ description: 'Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns the job ID. A job cancelled before it started never ran, so it returns 404.',
513
513
  fields: [],
514
514
  noContent: false,
515
515
  paginated: false,
@@ -906,7 +906,7 @@
906
906
  },
907
907
  syncAllSources: {
908
908
  body: 'none',
909
- description: 'Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends. `files` sources sync when you upload a file.',
909
+ description: 'Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends. `files` sources sync when you upload a file. New documents, from these syncs or waiting from earlier ones, are then placed in the knowledge base right away instead of waiting to be placed together with the documents that follow them. This covers the documents that arrive within an hour of the request. A refresh writes a limited number of entries, so a large batch is placed over several refreshes.',
910
910
  fields: [],
911
911
  noContent: false,
912
912
  paginated: false,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generated/contextOperations.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * The Context API operations the context commands call, distilled from the\n * OpenAPI spec `@sanity/client` vendors.\n *\n * Regenerate with: pnpm generate:context-commands\n */\nimport {type ContextOperation} from '../actions/context/operationTypes.js'\n\nexport const contextOperations = {\n applyIssues: {\n body: 'required',\n description: 'Accepts the issues in `issueIds`, then queues a job that applies them, rewrites the affected entries, and saves a new revision. Returns a job ID. IDs of issues that no longer exist are skipped. Returns `409` with code `issueNotAutoApplicable`, and accepts none of the issues, if any of them cannot be applied: a `conflict` (resolve it with `POST .../issues/{issueId}/resolve`), or an `update_required` issue whose `scopePath` is `*` or names an entry that no longer exists. Dismiss those instead.',\n fields: [\n {\n description: 'The IDs of the issues to accept and apply.',\n in: 'body',\n name: 'issueIds',\n required: true,\n type: 'string[]'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/apply',\n startsJob: true,\n summary: 'Accept and apply issues'\n },\n buildKnowledgeBase: {\n body: 'none',\n description: 'Queues a build over the knowledge base\\'s current sources and returns a job ID immediately. If a build is already running, the response returns that build\\'s job ID instead of starting a second build. A draft can\\'t be built: the request returns `409` with code `knowledgeBaseIsDraft`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/build',\n startsJob: true,\n summary: 'Start a knowledge base build'\n },\n confirmSync: {\n body: 'none',\n description: 'Deletes the documents a `held` sync didn\\'t find, unless a sync has found them since, completes the sync, and starts a refresh of each knowledge base that uses the source, which removes their citations from entries. A sync that isn\\'t `held` returns `409` with code `syncNotHeld`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/confirm',\n startsJob: false,\n summary: 'Confirm a held sync\\'s deletions'\n },\n createInstruction: {\n body: 'required',\n description: 'Creates a standing instruction for how entries built from its documents are written. Every instruction applies to specific documents, set in `scopeDocumentIds`. To rebuild entries under the new instruction right away, pass their paths in `rebuildPaths`. The response includes the rebuild job ID, or `null` if the rebuild could not start. The instruction is saved either way. After the instruction is saved, a background check files issues for entries that contradict it. If you already checked the instruction for contradictions, set `verified` to skip the background check. If the requested rebuild does not start, the background check runs even when `verified` is set.',\n fields: [\n {\n description: 'The instruction in plain language. Builds follow it over what the sources say.',\n in: 'body',\n name: 'statement',\n required: true,\n type: 'string'\n },\n {\n description: 'IDs of the documents the instruction applies to. Builds apply it when they write entries built from these documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`.',\n in: 'body',\n name: 'scopeDocumentIds',\n required: true,\n type: 'string[]'\n },\n {\n description: 'Paths of entries to rebuild under the new instruction right away. The response returns the rebuild job ID in `rebuildJobId`.',\n in: 'body',\n name: 'rebuildPaths',\n type: 'string[]'\n },\n {\n description: 'Whether you already checked the instruction for entries that contradict it. When `true`, the background check that files issues for those entries is skipped. It still runs if the rebuild you requested in `rebuildPaths` does not start.',\n in: 'body',\n name: 'verified',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/instructions',\n startsJob: false,\n summary: 'Create an instruction'\n },\n createKnowledgeBase: {\n body: 'required',\n description: 'Creates a knowledge base in your organization. To add content to it, add a source. Set `draft` to `true` to create a draft, which needs no title or description until you finish it. If your organization\\'s Context document store can\\'t be used, the request returns `503` with code `contextStoreUnavailable` and you can retry.',\n fields: [\n {\n description: 'The ID of the organization to create the knowledge base in.',\n in: 'body',\n name: 'organizationId',\n required: true,\n type: 'string'\n },\n {\n description: 'The knowledge base\\'s title. Required unless `draft` is `true`.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'A short description of what the knowledge base covers. Required unless `draft` is `true`.',\n in: 'body',\n name: 'description',\n type: 'string'\n },\n {\n description: 'Whether to create the knowledge base as a draft. You can add sources to a draft, and they sync right away, but you can\\'t build it, and the list leaves it out unless you set `includeDrafts` to `true`. A draft counts toward your plan\\'s knowledge base limit. To finish it, update it with `draft` set to `false`.',\n in: 'body',\n name: 'draft',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [],\n route: 'POST /knowledge-bases',\n startsJob: false,\n summary: 'Create a knowledge base'\n },\n createSource: {\n body: 'required',\n description: 'Adds a source to a knowledge base. Set `type` to choose what it reads:\\n\\n- `web`: a website, crawled from `url`\\n- `sanity-dataset`: the documents a GROQ query selects in a Sanity dataset\\n- `files`: files you upload with `POST .../sources/{sourceId}/uploads`, or text you send in `content`\\n\\nA website or dataset starts its first sync right away. A `files` source syncs when you upload a file, or right away when you send `content`: one request stores the text, adds the source and starts its sync. For a website, set `dryRun` to `true` to preview the crawl without adding the source.\\n\\nAdding a website that is already a source returns `409` with code `webSourceRootConflict`, and adding more websites than your limit allows returns `409` with code `webSourceRootLimitExceeded`. When the organization\\'s knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached` and adds nothing. Supports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'The source type. `web` crawls a website.',\n in: 'body',\n name: 'type',\n options: [\n 'web',\n 'sanity-dataset',\n 'files'\n ],\n required: true,\n type: 'string'\n },\n {\n description: 'The URL to start crawling from. It must be a public `http` or `https` URL.',\n in: 'body',\n name: 'url',\n type: 'string',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them.',\n in: 'body',\n name: 'includePaths',\n parent: 'crawlOptions',\n type: 'string[]',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Regular expressions for URL paths to skip. Pages whose path matches one of them aren\\'t crawled.',\n in: 'body',\n name: 'excludePaths',\n parent: 'crawlOptions',\n type: 'string[]',\n variants: [\n 'web'\n ]\n },\n {\n description: 'How many levels deep the crawl goes from the root URL.',\n in: 'body',\n name: 'maxDepth',\n parent: 'crawlOptions',\n type: 'integer',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Whether to crawl only the pages listed in the site\\'s sitemap.',\n in: 'body',\n name: 'sitemapOnly',\n parent: 'crawlOptions',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination.',\n in: 'body',\n name: 'ignoreQueryParameters',\n parent: 'crawlOptions',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit.',\n in: 'body',\n name: 'pageLimit',\n parent: 'crawlOptions',\n type: 'integer',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Set to `true` to estimate what a crawl would fetch without adding the source. The response is then `200` with a preview of the pages the site has, grouped by path.',\n in: 'body',\n name: 'dryRun',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'The ID of the Sanity project to read documents from. You need full read access to the dataset and, on its project, the Administrator or Developer role or a custom role that can create datasets.',\n in: 'body',\n name: 'sanityProjectId',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'The dataset to read documents from.',\n in: 'body',\n name: 'sanityDatasetId',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'A GROQ query that selects the documents, with an optional projection. Each sync runs it again.',\n in: 'body',\n name: 'query',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'The source\\'s title.',\n in: 'body',\n name: 'title',\n type: 'string',\n variants: [\n 'files'\n ]\n },\n {\n description: 'Text or markdown for the source to hold, up to 1,000,000 bytes of UTF-8. The source syncs it at once, with no upload. Larger content goes through `POST .../sources/{sourceId}/uploads`.',\n in: 'body',\n name: 'content',\n type: 'string',\n variants: [\n 'files'\n ]\n },\n {\n description: 'The format of `content`: `text/markdown` (the default) or `text/plain`. Only with `content`.',\n in: 'body',\n name: 'contentType',\n options: [\n 'text/markdown',\n 'text/plain'\n ],\n type: 'string',\n variants: [\n 'files'\n ]\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources',\n startsJob: false,\n summary: 'Add a source'\n },\n deleteDocument: {\n body: 'none',\n description: 'Deletes a document from its source. A page that is still on the website comes back on the next sync of its source unless the crawl options exclude it. Entries that cite the document stay the same until the next build or refresh, which removes the citations.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Delete a document'\n },\n deleteInstruction: {\n body: 'none',\n description: 'Deletes the instruction. Builds stop applying it from the next run. Entries already written under it keep their text until they are rebuilt; pass `rebuild=true` to rebuild every entry built from its documents right away.',\n fields: [\n {\n description: 'Set to `true` to rebuild every entry built from the instruction\\'s documents once it is deleted, so pages written under the instruction reflect their documents again. The response returns the rebuild job ID in `rebuildJobId`.',\n in: 'query',\n name: 'rebuild',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The instruction\\'s ID.',\n name: 'instructionId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',\n startsJob: false,\n summary: 'Delete an instruction'\n },\n deleteKnowledgeBase: {\n body: 'none',\n description: 'Deletes the knowledge base and everything it owns: its sources, revisions, stored source files, and its documents in your organization\\'s document store. While a build, refresh, apply, or sync is running, the request returns `409` with code `buildInFlight`. Retry after that work finishes.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Delete a knowledge base'\n },\n deleteSource: {\n body: 'none',\n description: 'Removes a source and its documents from the knowledge base, and starts a refresh that removes their citations from entries and deletes the entries left with none. A source no other knowledge base uses stops syncing and is deleted once that refresh has run.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Delete a source'\n },\n discardSync: {\n body: 'none',\n description: 'Completes a `held` sync without deleting anything: every document stays as it is. A sync that isn\\'t `held` returns `409` with code `syncNotHeld`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/discard',\n startsJob: false,\n summary: 'Discard a held sync\\'s deletions'\n },\n dismissIssue: {\n body: 'none',\n description: 'Marks the issue as rejected. If the issue already left triage, the request returns it unchanged. Returns `422` with code `issueDocumentInvalid` if the issue document was edited into a shape the API cannot verify. Returns `409` with code `issueTransitionConflict` if another change to the issue happened at the same time. You can safely retry a `409`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss',\n startsJob: false,\n summary: 'Dismiss an issue'\n },\n getDocument: {\n body: 'none',\n description: 'Returns a document with its conversion status and the chunks of its markdown. Entry citations point at a document\\'s chunks.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Get a document'\n },\n getDocumentContent: {\n body: 'none',\n description: 'Returns the markdown a document converted to: the text builds read, and the line numbers citations use. Set `chunk` or `lines` to get part of it, and `format` to `markdown` or `plain` to get the text alone instead of JSON. Until the document is converted, the request returns `409` with code `documentNotConverted`. With `format=raw` it returns the document as its source gave it, as an attachment, or `409` with code `documentNotStored` when the document was too large to keep.',\n fields: [\n {\n description: 'Response format. `json` (default) returns the markdown with its line numbers. `markdown` and `plain` return the markdown alone, ready to pass to a model. `raw` returns the bytes the source gave, before conversion: the uploaded file, the crawled page, the dataset document as JSON.',\n in: 'query',\n name: 'format',\n options: [\n 'json',\n 'markdown',\n 'plain',\n 'raw'\n ],\n type: 'string'\n },\n {\n description: 'Return only this chunk\\'s lines. Citations name the chunk they quote.',\n in: 'query',\n name: 'chunk',\n type: 'string'\n },\n {\n description: 'Return only these lines, from 1 and inclusive: `10-20`, or `10` for line 10 to the end. A range past the end returns up to the last line.',\n in: 'query',\n name: 'lines',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents/{documentId}/content',\n startsJob: false,\n summary: 'Get a document\\'s markdown'\n },\n getJob: {\n body: 'none',\n description: 'Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns the job ID.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The job ID returned by the endpoint that started the work.',\n name: 'jobId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/jobs/{jobId}',\n startsJob: false,\n summary: 'Get a job'\n },\n getKnowledgeBase: {\n body: 'none',\n description: 'Returns a knowledge base\\'s metadata and state. `knowledgeBaseId` accepts the public ID (`kb...`) or the UUID, and you don\\'t need to pass an organization. If you can\\'t read the knowledge base, the request returns `404`. To read the built entries, query `sanity.context.entry` documents with GROQ from your organization\\'s document store.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Get a knowledge base'\n },\n getMcpEndpointInitialContext: {\n body: 'none',\n description: 'Returns the same text as the `initial_context` MCP tool, as plain text you can add to a system prompt. `heading_offset` shifts markdown headings down by that many levels. The default is `1`, so `#` becomes `##`.',\n fields: [\n {\n description: 'A JSON array that adds `_url` fields to query results. Each item has `types` (document types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to `slug.current`. Invalid JSON is ignored.',\n in: 'query',\n name: 'linkResolver',\n type: 'string'\n },\n {\n description: 'How many levels to shift markdown headings down, from `0` to `6`. Defaults to `1`, so `#` becomes `##`.',\n in: 'query',\n name: 'heading_offset',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The ID of the organization.',\n name: 'organizationId'\n },\n {\n description: 'The MCP endpoint\\'s name, set when the endpoint was created.',\n name: 'mcpEndpoint'\n }\n ],\n route: 'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context',\n startsJob: false,\n summary: 'Get an MCP endpoint\\'s initial context'\n },\n getSource: {\n body: 'none',\n description: 'Returns a source with its settings, document counts and latest sync.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Get a source'\n },\n getSync: {\n body: 'none',\n description: 'Returns one sync of a source with its status and counts.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}',\n startsJob: false,\n summary: 'Get a sync'\n },\n listDocuments: {\n body: 'none',\n description: 'Lists the documents in a knowledge base: the pages, dataset documents and files its sources yield, which builds read and cite. Results are cursor-paginated, and you can filter them by `source` and `state`.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n },\n {\n description: 'Return only the documents of this source.',\n in: 'query',\n name: 'source',\n type: 'string'\n },\n {\n description: 'Return only documents in this state. Without it, `deleted` documents are left out.',\n in: 'query',\n name: 'state',\n options: [\n 'active',\n 'missing',\n 'deleted'\n ],\n type: 'string'\n },\n {\n description: 'Comma-separated IDs of the documents to return, up to 200, in any state. Use it to look up the documents entry citations point at.',\n in: 'query',\n name: 'ids',\n type: 'string'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents',\n startsJob: false,\n summary: 'List documents'\n },\n listKnowledgeBases: {\n body: 'none',\n description: 'Returns the knowledge bases you can access in the organization set by `organizationId`. Drafts are left out unless you set `includeDrafts` to `true`. Results are cursor-paginated, newest first.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n },\n {\n description: 'The organization to list knowledge bases for.',\n in: 'query',\n name: 'organizationId',\n required: true,\n type: 'string'\n },\n {\n description: 'Set to `true` to also list the organization\\'s drafts, which have `state` set to `draft`. Drafts count toward the plan\\'s knowledge base limit, and `createdBy` says who started each one.',\n in: 'query',\n name: 'includeDrafts',\n type: 'boolean'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [],\n route: 'GET /knowledge-bases',\n startsJob: false,\n summary: 'List knowledge bases'\n },\n listSources: {\n body: 'none',\n description: 'Lists the sources of a knowledge base: the websites, Sanity datasets and files its documents come from, each with its document counts and its latest sync. Results are cursor-paginated.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources',\n startsJob: false,\n summary: 'List sources'\n },\n listSyncs: {\n body: 'none',\n description: 'Lists the syncs of a source, newest first. Results are cursor-paginated.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',\n startsJob: false,\n summary: 'List a source\\'s syncs'\n },\n rebuildEntry: {\n body: 'none',\n description: 'Queues a rewrite of the entry at `entryPath` from its cited sources and the active instructions, and returns a job ID immediately. The response also lists the other entries built from any of the same sources. An instruction applies to every entry built from its sources, so those entries can change too. Returns `422` with code `entryDocumentInvalid` if the entry document was edited into a shape the API cannot read.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The entry\\'s slash-delimited path, such as `pricing/plans/free`, URL-encoded.',\n name: 'entryPath'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild',\n startsJob: true,\n summary: 'Rebuild an entry from its sources'\n },\n reopenIssue: {\n body: 'none',\n description: 'Returns an accepted conflict issue to triage, clears its resolution, and deletes the instruction the resolution created. Reopening an open or dismissed conflict returns it unchanged. Other issue types return `422` with code `issueNotResolvable`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen',\n startsJob: false,\n summary: 'Reopen an accepted conflict'\n },\n resolveIssue: {\n body: 'required',\n description: 'Resolves a conflict issue by choosing one of its sides. Set `resolution` to the index of a side in `content.sides`. For a conflict on a single entry, index `0` is the entry\\'s current content, so choosing it keeps the entry as it is. Choosing any other side rewrites the entry, and the returned `jobId` tracks the rewrite. The decision becomes a standing instruction for every future build, and `resolvedBy` records who made it. To change a decision, resolve the accepted conflict again. Other issue types, dismissed conflicts, and out-of-range indexes return `422` with code `issueNotResolvable`.',\n fields: [\n {\n description: 'The index of the chosen side in the issue\\'s `content.sides`.',\n in: 'body',\n name: 'resolution',\n required: true,\n type: 'integer'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve',\n startsJob: true,\n summary: 'Resolve a conflict issue'\n },\n startSourceUpload: {\n body: 'required',\n description: 'Returns a single-use signed URL for one file of a `files` source, valid for one hour. To add the file:\\n\\n1. Send the file in a `PUT` request to `uploadUrl`.\\n2. Call `POST .../sources/{sourceId}/syncs` with the `uploadId`.\\n\\nThe file can be a single document or a zip, tar or gzip archive of them. It replaces the source\\'s current file when it syncs. An upload no sync takes within 24 hours is deleted. A source that isn\\'t `files` returns `422` with code `sourceTypeMismatch`. When the organization\\'s knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached`. Supports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'The file\\'s name.',\n in: 'body',\n name: 'filename',\n required: true,\n type: 'string'\n },\n {\n description: 'The media type of the file. When set, the `PUT` request must send the same `Content-Type` header.',\n in: 'body',\n name: 'contentType',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/uploads',\n startsJob: false,\n summary: 'Upload a file to a source'\n },\n startSync: {\n body: 'required',\n description: 'Starts a sync of the source. A website or dataset is read again: its sync is queued, and starts once any sync of the source that is running ends, including the first one that started when it was added. Asking again while one waits queues nothing more. Follow it with the source\\'s `latestSync`.\\n\\nFor a `files` source, set `uploadId` to the upload whose file the source should hold from now on; without it, the source reads its current file again. Its sync starts at once and returns a job ID to poll; the finished job\\'s `result` names the sync and whether it is `held`. While a sync of a `files` source is running, including the first one, the request returns `409` with code `syncInProgress` and leaves the upload for a later request. An `uploadId` whose file never arrived returns `404` with code `uploadNotFound`, and an `uploadId` on a source that isn\\'t `files` returns `422` with code `sourceTypeMismatch`.\\n\\nSupports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'For a `files` source, the `uploadId` of the file to sync, from `POST .../sources/{sourceId}/uploads`. Without it, a `files` source reads its current file again. Not allowed for other types.',\n in: 'body',\n name: 'uploadId',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',\n startsJob: true,\n summary: 'Sync a source'\n },\n syncAllSources: {\n body: 'none',\n description: 'Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends. `files` sources sync when you upload a file.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sync',\n startsJob: false,\n summary: 'Sync every source'\n },\n updateDocument: {\n body: 'required',\n description: 'Keeps a `missing` web page in the knowledge base by setting its `state` back to `active`. A document that isn\\'t `missing` returns `409` with code `documentInvalidState`.',\n fields: [\n {\n description: 'Set to `active` to keep a `missing` page in the knowledge base. The count of crawls that missed it starts again.',\n in: 'body',\n name: 'state',\n options: [\n 'active'\n ],\n required: true,\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Keep a missing document'\n },\n updateInstruction: {\n body: 'required',\n description: 'Updates the instruction\\'s statement or documents. The change applies from the next build. Any update also reactivates an archived instruction and ties it to the current content of its documents.',\n fields: [\n {\n description: 'The new instruction text. Omit it to keep the current text.',\n in: 'body',\n name: 'statement',\n type: 'string'\n },\n {\n description: 'IDs of the documents the instruction applies to. Replaces the current list. Omit it to keep the current documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`.',\n in: 'body',\n name: 'scopeDocumentIds',\n type: 'string[]'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The instruction\\'s ID.',\n name: 'instructionId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',\n startsJob: false,\n summary: 'Update an instruction'\n },\n updateKnowledgeBase: {\n body: 'required',\n description: 'Updates the title or the description, or finishes a draft (`draft: false`). Fields equal to their current value are ignored, so sending the current values changes nothing. Finishing a draft with no title returns `422` with code `draftTitleRequired`. How often a website or dataset syncs is set on the source, with `PATCH .../sources/{sourceId}`.',\n fields: [\n {\n description: 'The knowledge base\\'s new title.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'The knowledge base\\'s new description.',\n in: 'body',\n name: 'description',\n type: 'string'\n },\n {\n description: 'Set to `false` to finish a draft, so it can be built and is listed with your other knowledge bases. The knowledge base needs a title, sent here or set before. Ignored when the knowledge base isn\\'t a draft. A finished knowledge base can\\'t become a draft again.',\n in: 'body',\n name: 'draft',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Update a knowledge base'\n },\n updateSource: {\n body: 'required',\n description: 'Changes a source\\'s title, a website\\'s crawl options, a dataset\\'s query, or how often a website or dataset syncs on its own. New crawl options delete the documents whose path they leave out. When that would delete all of the source\\'s documents, or five or more that are over a fifth of them, the request returns `409` with code `sourceDeletionsUnconfirmed` until you send it again with `confirmDeletions` set to `true`. New crawl options sent while the source syncs return `409` with code `syncInProgress`; send them again once the sync finishes. A new query queues a sync, which removes the documents the query no longer selects.\\n\\nCrawl options on a source that isn\\'t a website, a query on one that isn\\'t a dataset, or a sync frequency on a `files` source, return `422` with code `sourceTypeMismatch`. Setting a sync frequency on a plan without scheduled syncs returns `403` with code `featureNotInPlan`; setting it to `null` always works.',\n fields: [\n {\n description: 'The source\\'s title.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them.',\n in: 'body',\n name: 'includePaths',\n parent: 'crawlOptions',\n type: 'string[]'\n },\n {\n description: 'Regular expressions for URL paths to skip. Pages whose path matches one of them aren\\'t crawled.',\n in: 'body',\n name: 'excludePaths',\n parent: 'crawlOptions',\n type: 'string[]'\n },\n {\n description: 'How many levels deep the crawl goes from the root URL.',\n in: 'body',\n name: 'maxDepth',\n parent: 'crawlOptions',\n type: 'integer'\n },\n {\n description: 'Whether to crawl only the pages listed in the site\\'s sitemap.',\n in: 'body',\n name: 'sitemapOnly',\n parent: 'crawlOptions',\n type: 'boolean'\n },\n {\n description: 'Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination.',\n in: 'body',\n name: 'ignoreQueryParameters',\n parent: 'crawlOptions',\n type: 'boolean'\n },\n {\n description: 'The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit.',\n in: 'body',\n name: 'pageLimit',\n parent: 'crawlOptions',\n type: 'integer'\n },\n {\n description: 'For a `sanity-dataset` source, the GROQ query, replacing the stored one. A sync is queued, and removes the documents the query no longer returns.',\n in: 'body',\n name: 'query',\n type: 'string'\n },\n {\n description: 'For a `web` or `sanity-dataset` source, how often it syncs on its own: `weekly` or `monthly`. `null` stops scheduled syncs, and you can still start a sync yourself. Setting a frequency requires a plan that includes scheduled syncs; without one, the request returns `403` with code `featureNotInPlan`.',\n in: 'body',\n name: 'syncFrequency',\n nullable: true,\n options: [\n 'weekly',\n 'monthly'\n ],\n type: 'string'\n },\n {\n description: 'Set to `true` to apply new crawl options that delete many documents. Without it, a change that would delete all of the documents, or five or more that are over a fifth of them, returns `409` with code `sourceDeletionsUnconfirmed`.',\n in: 'body',\n name: 'confirmDeletions',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Update a source'\n }\n} as const satisfies Record<string, ContextOperation>\n"],"names":["contextOperations","applyIssues","body","description","fields","in","name","required","type","noContent","paginated","pathParams","route","startsJob","summary","buildKnowledgeBase","confirmSync","createInstruction","createKnowledgeBase","createSource","options","variants","parent","deleteDocument","deleteInstruction","deleteKnowledgeBase","deleteSource","discardSync","dismissIssue","getDocument","getDocumentContent","getJob","getKnowledgeBase","getMcpEndpointInitialContext","getSource","getSync","listDocuments","pageSize","listKnowledgeBases","listSources","listSyncs","rebuildEntry","reopenIssue","resolveIssue","startSourceUpload","startSync","syncAllSources","updateDocument","updateInstruction","updateKnowledgeBase","updateSource","nullable"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,oBAAoB;IAC/BC,aAAa;QACXC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAC,oBAAoB;QAClBb,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAE,aAAa;QACXd,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAG,mBAAmB;QACjBf,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAI,qBAAqB;QACnBhB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY,EAAE;QACdC,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAK,cAAc;QACZjB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;iBACD;gBACDb,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;iBACD;gBACDZ,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;SACD;QACDZ,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAS,gBAAgB;QACdrB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAU,mBAAmB;QACjBtB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAW,qBAAqB;QACnBvB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAY,cAAc;QACZxB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAa,aAAa;QACXzB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAc,cAAc;QACZ1B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAe,aAAa;QACX3B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAgB,oBAAoB;QAClB5B,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAiB,QAAQ;QACN7B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAkB,kBAAkB;QAChB9B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAmB,8BAA8B;QAC5B/B,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAoB,WAAW;QACThC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAqB,SAAS;QACPjC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAsB,eAAe;QACblC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAwB,oBAAoB;QAClBpC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY,EAAE;QACdC,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAyB,aAAa;QACXrC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA0B,WAAW;QACTtC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA2B,cAAc;QACZvC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA4B,aAAa;QACXxC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA6B,cAAc;QACZzC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA8B,mBAAmB;QACjB1C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA+B,WAAW;QACT3C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAgC,gBAAgB;QACd5C,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAiC,gBAAgB;QACd7C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;iBACD;gBACDb,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAkC,mBAAmB;QACjB9C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAmC,qBAAqB;QACnB/C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAoC,cAAc;QACZhD,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACN6C,UAAU;gBACV/B,SAAS;oBACP;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;AACF,EAAqD"}
1
+ {"version":3,"sources":["../../src/generated/contextOperations.ts"],"sourcesContent":["/**\n * GENERATED FILE - DO NOT EDIT\n *\n * The Context API operations the context commands call, distilled from the\n * OpenAPI spec `@sanity/client` vendors.\n *\n * Regenerate with: pnpm generate:context-commands\n */\nimport {type ContextOperation} from '../actions/context/operationTypes.js'\n\nexport const contextOperations = {\n applyIssues: {\n body: 'required',\n description: 'Accepts the issues in `issueIds`, then queues a job that applies them, rewrites the affected entries, and saves a new revision. Returns a job ID. IDs of issues that no longer exist are skipped. Returns `409` with code `issueNotAutoApplicable`, and accepts none of the issues, if any of them cannot be applied: a `conflict` (resolve it with `POST .../issues/{issueId}/resolve`), or an `update_required` issue whose `scopePath` is `*` or names an entry that no longer exists. Dismiss those instead.',\n fields: [\n {\n description: 'The IDs of the issues to accept and apply.',\n in: 'body',\n name: 'issueIds',\n required: true,\n type: 'string[]'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/apply',\n startsJob: true,\n summary: 'Accept and apply issues'\n },\n buildKnowledgeBase: {\n body: 'none',\n description: 'Queues a build over the knowledge base\\'s current sources and returns a job ID immediately. If a build is already running, the response returns that build\\'s job ID instead of starting a second build. A draft can\\'t be built: the request returns `409` with code `knowledgeBaseIsDraft`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/build',\n startsJob: true,\n summary: 'Start a knowledge base build'\n },\n confirmSync: {\n body: 'none',\n description: 'Deletes the documents a `held` sync didn\\'t find, unless a sync has found them since, completes the sync, and starts a refresh of each knowledge base that uses the source, which removes their citations from entries. A sync that isn\\'t `held` returns `409` with code `syncNotHeld`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/confirm',\n startsJob: false,\n summary: 'Confirm a held sync\\'s deletions'\n },\n createInstruction: {\n body: 'required',\n description: 'Creates a standing instruction for how entries built from its documents are written. Every instruction applies to specific documents, set in `scopeDocumentIds`. To rebuild entries under the new instruction right away, pass their paths in `rebuildPaths`. The response includes the rebuild job ID, or `null` if the rebuild could not start. The instruction is saved either way. After the instruction is saved, a background check files issues for entries that contradict it. If you already checked the instruction for contradictions, set `verified` to skip the background check. If the requested rebuild does not start, the background check runs even when `verified` is set.',\n fields: [\n {\n description: 'The instruction in plain language. Builds follow it over what the sources say.',\n in: 'body',\n name: 'statement',\n required: true,\n type: 'string'\n },\n {\n description: 'IDs of the documents the instruction applies to. Builds apply it when they write entries built from these documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`.',\n in: 'body',\n name: 'scopeDocumentIds',\n required: true,\n type: 'string[]'\n },\n {\n description: 'Paths of entries to rebuild under the new instruction right away. The response returns the rebuild job ID in `rebuildJobId`.',\n in: 'body',\n name: 'rebuildPaths',\n type: 'string[]'\n },\n {\n description: 'Whether you already checked the instruction for entries that contradict it. When `true`, the background check that files issues for those entries is skipped. It still runs if the rebuild you requested in `rebuildPaths` does not start.',\n in: 'body',\n name: 'verified',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/instructions',\n startsJob: false,\n summary: 'Create an instruction'\n },\n createKnowledgeBase: {\n body: 'required',\n description: 'Creates a knowledge base in your organization. To add content to it, add a source. Set `draft` to `true` to create a draft, which needs no title or description until you finish it. If your organization\\'s Context document store can\\'t be used, the request returns `503` with code `contextStoreUnavailable` and you can retry.',\n fields: [\n {\n description: 'The ID of the organization to create the knowledge base in.',\n in: 'body',\n name: 'organizationId',\n required: true,\n type: 'string'\n },\n {\n description: 'The knowledge base\\'s title. Required unless `draft` is `true`.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'A short description of what the knowledge base covers. Required unless `draft` is `true`.',\n in: 'body',\n name: 'description',\n type: 'string'\n },\n {\n description: 'Whether to create the knowledge base as a draft. You can add sources to a draft, and they sync right away, but you can\\'t build it, and the list leaves it out unless you set `includeDrafts` to `true`. A draft counts toward your plan\\'s knowledge base limit. To finish it, update it with `draft` set to `false`.',\n in: 'body',\n name: 'draft',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [],\n route: 'POST /knowledge-bases',\n startsJob: false,\n summary: 'Create a knowledge base'\n },\n createSource: {\n body: 'required',\n description: 'Adds a source to a knowledge base. Set `type` to choose what it reads:\\n\\n- `web`: a website, crawled from `url`\\n- `sanity-dataset`: the documents a GROQ query selects in a Sanity dataset\\n- `files`: files you upload with `POST .../sources/{sourceId}/uploads`, or text you send in `content`\\n\\nA website or dataset starts its first sync right away. A `files` source syncs when you upload a file, or right away when you send `content`: one request stores the text, adds the source and starts its sync. For a website, set `dryRun` to `true` to preview the crawl without adding the source.\\n\\nAdding a website that is already a source returns `409` with code `webSourceRootConflict`, and adding more websites than your limit allows returns `409` with code `webSourceRootLimitExceeded`. When the organization\\'s knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached` and adds nothing. Supports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'The source type. `web` crawls a website.',\n in: 'body',\n name: 'type',\n options: [\n 'web',\n 'sanity-dataset',\n 'files'\n ],\n required: true,\n type: 'string'\n },\n {\n description: 'The URL to start crawling from. It must be a public `http` or `https` URL.',\n in: 'body',\n name: 'url',\n type: 'string',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them.',\n in: 'body',\n name: 'includePaths',\n parent: 'crawlOptions',\n type: 'string[]',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Regular expressions for URL paths to skip. Pages whose path matches one of them aren\\'t crawled.',\n in: 'body',\n name: 'excludePaths',\n parent: 'crawlOptions',\n type: 'string[]',\n variants: [\n 'web'\n ]\n },\n {\n description: 'How many levels deep the crawl goes from the root URL.',\n in: 'body',\n name: 'maxDepth',\n parent: 'crawlOptions',\n type: 'integer',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Whether to crawl only the pages listed in the site\\'s sitemap.',\n in: 'body',\n name: 'sitemapOnly',\n parent: 'crawlOptions',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination.',\n in: 'body',\n name: 'ignoreQueryParameters',\n parent: 'crawlOptions',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit.',\n in: 'body',\n name: 'pageLimit',\n parent: 'crawlOptions',\n type: 'integer',\n variants: [\n 'web'\n ]\n },\n {\n description: 'Set to `true` to estimate what a crawl would fetch without adding the source. The response is then `200` with a preview of the pages the site has, grouped by path.',\n in: 'body',\n name: 'dryRun',\n type: 'boolean',\n variants: [\n 'web'\n ]\n },\n {\n description: 'The ID of the Sanity project to read documents from. You need full read access to the dataset and, on its project, the Administrator or Developer role or a custom role that can create datasets.',\n in: 'body',\n name: 'sanityProjectId',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'The dataset to read documents from.',\n in: 'body',\n name: 'sanityDatasetId',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'A GROQ query that selects the documents, with an optional projection. Each sync runs it again.',\n in: 'body',\n name: 'query',\n type: 'string',\n variants: [\n 'sanity-dataset'\n ]\n },\n {\n description: 'The source\\'s title.',\n in: 'body',\n name: 'title',\n type: 'string',\n variants: [\n 'files'\n ]\n },\n {\n description: 'Text or markdown for the source to hold, up to 1,000,000 bytes of UTF-8. The source syncs it at once, with no upload. Larger content goes through `POST .../sources/{sourceId}/uploads`.',\n in: 'body',\n name: 'content',\n type: 'string',\n variants: [\n 'files'\n ]\n },\n {\n description: 'The format of `content`: `text/markdown` (the default) or `text/plain`. Only with `content`.',\n in: 'body',\n name: 'contentType',\n options: [\n 'text/markdown',\n 'text/plain'\n ],\n type: 'string',\n variants: [\n 'files'\n ]\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources',\n startsJob: false,\n summary: 'Add a source'\n },\n deleteDocument: {\n body: 'none',\n description: 'Deletes a document from its source. A page that is still on the website comes back on the next sync of its source unless the crawl options exclude it. Entries that cite the document stay the same until the next build or refresh, which removes the citations.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Delete a document'\n },\n deleteInstruction: {\n body: 'none',\n description: 'Deletes the instruction. Builds stop applying it from the next run. Entries already written under it keep their text until they are rebuilt; pass `rebuild=true` to rebuild every entry built from its documents right away.',\n fields: [\n {\n description: 'Set to `true` to rebuild every entry built from the instruction\\'s documents once it is deleted, so pages written under the instruction reflect their documents again. The response returns the rebuild job ID in `rebuildJobId`.',\n in: 'query',\n name: 'rebuild',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The instruction\\'s ID.',\n name: 'instructionId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',\n startsJob: false,\n summary: 'Delete an instruction'\n },\n deleteKnowledgeBase: {\n body: 'none',\n description: 'Deletes the knowledge base and everything it owns: its sources, revisions, stored source files, and its documents in your organization\\'s document store. While a build, refresh, apply, or sync is running, the request returns `409` with code `buildInFlight`. Retry after that work finishes.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Delete a knowledge base'\n },\n deleteSource: {\n body: 'none',\n description: 'Removes a source and its documents from the knowledge base, and starts a refresh that removes their citations from entries and deletes the entries left with none. A source no other knowledge base uses stops syncing and is deleted once that refresh has run.',\n fields: [],\n noContent: true,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'DELETE /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Delete a source'\n },\n discardSync: {\n body: 'none',\n description: 'Completes a `held` sync without deleting anything: every document stays as it is. A sync that isn\\'t `held` returns `409` with code `syncNotHeld`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}/discard',\n startsJob: false,\n summary: 'Discard a held sync\\'s deletions'\n },\n dismissIssue: {\n body: 'none',\n description: 'Marks the issue as rejected. If the issue already left triage, the request returns it unchanged. Returns `422` with code `issueDocumentInvalid` if the issue document was edited into a shape the API cannot verify. Returns `409` with code `issueTransitionConflict` if another change to the issue happened at the same time. You can safely retry a `409`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/dismiss',\n startsJob: false,\n summary: 'Dismiss an issue'\n },\n getDocument: {\n body: 'none',\n description: 'Returns a document with its conversion status and the chunks of its markdown. Entry citations point at a document\\'s chunks.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Get a document'\n },\n getDocumentContent: {\n body: 'none',\n description: 'Returns the markdown a document converted to: the text builds read, and the line numbers citations use. Set `chunk` or `lines` to get part of it, and `format` to `markdown` or `plain` to get the text alone instead of JSON. Until the document is converted, the request returns `409` with code `documentNotConverted`. With `format=raw` it returns the document as its source gave it, as an attachment, or `409` with code `documentNotStored` when the document was too large to keep.',\n fields: [\n {\n description: 'Response format. `json` (default) returns the markdown with its line numbers. `markdown` and `plain` return the markdown alone, ready to pass to a model. `raw` returns the bytes the source gave, before conversion: the uploaded file, the crawled page, the dataset document as JSON.',\n in: 'query',\n name: 'format',\n options: [\n 'json',\n 'markdown',\n 'plain',\n 'raw'\n ],\n type: 'string'\n },\n {\n description: 'Return only this chunk\\'s lines. Citations name the chunk they quote.',\n in: 'query',\n name: 'chunk',\n type: 'string'\n },\n {\n description: 'Return only these lines, from 1 and inclusive: `10-20`, or `10` for line 10 to the end. A range past the end returns up to the last line.',\n in: 'query',\n name: 'lines',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents/{documentId}/content',\n startsJob: false,\n summary: 'Get a document\\'s markdown'\n },\n getJob: {\n body: 'none',\n description: 'Returns the status of a background job, such as a build, sync, or refresh. The endpoint that starts the work returns the job ID. A job cancelled before it started never ran, so it returns 404.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The job ID returned by the endpoint that started the work.',\n name: 'jobId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/jobs/{jobId}',\n startsJob: false,\n summary: 'Get a job'\n },\n getKnowledgeBase: {\n body: 'none',\n description: 'Returns a knowledge base\\'s metadata and state. `knowledgeBaseId` accepts the public ID (`kb...`) or the UUID, and you don\\'t need to pass an organization. If you can\\'t read the knowledge base, the request returns `404`. To read the built entries, query `sanity.context.entry` documents with GROQ from your organization\\'s document store.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Get a knowledge base'\n },\n getMcpEndpointInitialContext: {\n body: 'none',\n description: 'Returns the same text as the `initial_context` MCP tool, as plain text you can add to a system prompt. `heading_offset` shifts markdown headings down by that many levels. The default is `1`, so `#` becomes `##`.',\n fields: [\n {\n description: 'A JSON array that adds `_url` fields to query results. Each item has `types` (document types), `baseUrl`, and an optional `slugExpression`, a GROQ expression that defaults to `slug.current`. Invalid JSON is ignored.',\n in: 'query',\n name: 'linkResolver',\n type: 'string'\n },\n {\n description: 'How many levels to shift markdown headings down, from `0` to `6`. Defaults to `1`, so `#` becomes `##`.',\n in: 'query',\n name: 'heading_offset',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The ID of the organization.',\n name: 'organizationId'\n },\n {\n description: 'The MCP endpoint\\'s name, set when the endpoint was created.',\n name: 'mcpEndpoint'\n }\n ],\n route: 'GET /organizations/{organizationId}/mcp/{mcpEndpoint}/initial-context',\n startsJob: false,\n summary: 'Get an MCP endpoint\\'s initial context'\n },\n getSource: {\n body: 'none',\n description: 'Returns a source with its settings, document counts and latest sync.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Get a source'\n },\n getSync: {\n body: 'none',\n description: 'Returns one sync of a source with its status and counts.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n },\n {\n description: 'The sync\\'s ID.',\n name: 'syncId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs/{syncId}',\n startsJob: false,\n summary: 'Get a sync'\n },\n listDocuments: {\n body: 'none',\n description: 'Lists the documents in a knowledge base: the pages, dataset documents and files its sources yield, which builds read and cite. Results are cursor-paginated, and you can filter them by `source` and `state`.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n },\n {\n description: 'Return only the documents of this source.',\n in: 'query',\n name: 'source',\n type: 'string'\n },\n {\n description: 'Return only documents in this state. Without it, `deleted` documents are left out.',\n in: 'query',\n name: 'state',\n options: [\n 'active',\n 'missing',\n 'deleted'\n ],\n type: 'string'\n },\n {\n description: 'Comma-separated IDs of the documents to return, up to 200, in any state. Use it to look up the documents entry citations point at.',\n in: 'query',\n name: 'ids',\n type: 'string'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/documents',\n startsJob: false,\n summary: 'List documents'\n },\n listKnowledgeBases: {\n body: 'none',\n description: 'Returns the knowledge bases you can access in the organization set by `organizationId`. Drafts are left out unless you set `includeDrafts` to `true`. Results are cursor-paginated, newest first.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n },\n {\n description: 'The organization to list knowledge bases for.',\n in: 'query',\n name: 'organizationId',\n required: true,\n type: 'string'\n },\n {\n description: 'Set to `true` to also list the organization\\'s drafts, which have `state` set to `draft`. Drafts count toward the plan\\'s knowledge base limit, and `createdBy` says who started each one.',\n in: 'query',\n name: 'includeDrafts',\n type: 'boolean'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [],\n route: 'GET /knowledge-bases',\n startsJob: false,\n summary: 'List knowledge bases'\n },\n listSources: {\n body: 'none',\n description: 'Lists the sources of a knowledge base: the websites, Sanity datasets and files its documents come from, each with its document counts and its latest sync. Results are cursor-paginated.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources',\n startsJob: false,\n summary: 'List sources'\n },\n listSyncs: {\n body: 'none',\n description: 'Lists the syncs of a source, newest first. Results are cursor-paginated.',\n fields: [\n {\n description: 'The `nextCursor` value from the previous page. Omit it to get the first page.',\n in: 'query',\n name: 'cursor',\n type: 'string'\n },\n {\n description: 'The maximum number of items to return.',\n in: 'query',\n name: 'limit',\n type: 'integer'\n }\n ],\n noContent: false,\n pageSize: 200,\n paginated: true,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'GET /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',\n startsJob: false,\n summary: 'List a source\\'s syncs'\n },\n rebuildEntry: {\n body: 'none',\n description: 'Queues a rewrite of the entry at `entryPath` from its cited sources and the active instructions, and returns a job ID immediately. The response also lists the other entries built from any of the same sources. An instruction applies to every entry built from its sources, so those entries can change too. Returns `422` with code `entryDocumentInvalid` if the entry document was edited into a shape the API cannot read.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The entry\\'s slash-delimited path, such as `pricing/plans/free`, URL-encoded.',\n name: 'entryPath'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/entries/{entryPath}/rebuild',\n startsJob: true,\n summary: 'Rebuild an entry from its sources'\n },\n reopenIssue: {\n body: 'none',\n description: 'Returns an accepted conflict issue to triage, clears its resolution, and deletes the instruction the resolution created. Reopening an open or dismissed conflict returns it unchanged. Other issue types return `422` with code `issueNotResolvable`.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/reopen',\n startsJob: false,\n summary: 'Reopen an accepted conflict'\n },\n resolveIssue: {\n body: 'required',\n description: 'Resolves a conflict issue by choosing one of its sides. Set `resolution` to the index of a side in `content.sides`. For a conflict on a single entry, index `0` is the entry\\'s current content, so choosing it keeps the entry as it is. Choosing any other side rewrites the entry, and the returned `jobId` tracks the rewrite. The decision becomes a standing instruction for every future build, and `resolvedBy` records who made it. To change a decision, resolve the accepted conflict again. Other issue types, dismissed conflicts, and out-of-range indexes return `422` with code `issueNotResolvable`.',\n fields: [\n {\n description: 'The index of the chosen side in the issue\\'s `content.sides`.',\n in: 'body',\n name: 'resolution',\n required: true,\n type: 'integer'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The issue\\'s document ID.',\n name: 'issueId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/issues/{issueId}/resolve',\n startsJob: true,\n summary: 'Resolve a conflict issue'\n },\n startSourceUpload: {\n body: 'required',\n description: 'Returns a single-use signed URL for one file of a `files` source, valid for one hour. To add the file:\\n\\n1. Send the file in a `PUT` request to `uploadUrl`.\\n2. Call `POST .../sources/{sourceId}/syncs` with the `uploadId`.\\n\\nThe file can be a single document or a zip, tar or gzip archive of them. It replaces the source\\'s current file when it syncs. An upload no sync takes within 24 hours is deleted. A source that isn\\'t `files` returns `422` with code `sourceTypeMismatch`. When the organization\\'s knowledge bases already hold as many source chunks as its plan allows, returns `403` with code `planLimitReached`. Supports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'The file\\'s name.',\n in: 'body',\n name: 'filename',\n required: true,\n type: 'string'\n },\n {\n description: 'The media type of the file. When set, the `PUT` request must send the same `Content-Type` header.',\n in: 'body',\n name: 'contentType',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/uploads',\n startsJob: false,\n summary: 'Upload a file to a source'\n },\n startSync: {\n body: 'required',\n description: 'Starts a sync of the source. A website or dataset is read again: its sync is queued, and starts once any sync of the source that is running ends, including the first one that started when it was added. Asking again while one waits queues nothing more. Follow it with the source\\'s `latestSync`.\\n\\nFor a `files` source, set `uploadId` to the upload whose file the source should hold from now on; without it, the source reads its current file again. Its sync starts at once and returns a job ID to poll; the finished job\\'s `result` names the sync and whether it is `held`. While a sync of a `files` source is running, including the first one, the request returns `409` with code `syncInProgress` and leaves the upload for a later request. An `uploadId` whose file never arrived returns `404` with code `uploadNotFound`, and an `uploadId` on a source that isn\\'t `files` returns `422` with code `sourceTypeMismatch`.\\n\\nSupports the `Idempotency-Key` header.',\n fields: [\n {\n description: 'For a `files` source, the `uploadId` of the file to sync, from `POST .../sources/{sourceId}/uploads`. Without it, a `files` source reads its current file again. Not allowed for other types.',\n in: 'body',\n name: 'uploadId',\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}/syncs',\n startsJob: true,\n summary: 'Sync a source'\n },\n syncAllSources: {\n body: 'none',\n description: 'Queues a sync of every website and dataset source, which starts once any sync of the source that is running ends. `files` sources sync when you upload a file. New documents, from these syncs or waiting from earlier ones, are then placed in the knowledge base right away instead of waiting to be placed together with the documents that follow them. This covers the documents that arrive within an hour of the request. A refresh writes a limited number of entries, so a large batch is placed over several refreshes.',\n fields: [],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'POST /knowledge-bases/{knowledgeBaseId}/sync',\n startsJob: false,\n summary: 'Sync every source'\n },\n updateDocument: {\n body: 'required',\n description: 'Keeps a `missing` web page in the knowledge base by setting its `state` back to `active`. A document that isn\\'t `missing` returns `409` with code `documentInvalidState`.',\n fields: [\n {\n description: 'Set to `active` to keep a `missing` page in the knowledge base. The count of crawls that missed it starts again.',\n in: 'body',\n name: 'state',\n options: [\n 'active'\n ],\n required: true,\n type: 'string'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The document\\'s ID.',\n name: 'documentId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/documents/{documentId}',\n startsJob: false,\n summary: 'Keep a missing document'\n },\n updateInstruction: {\n body: 'required',\n description: 'Updates the instruction\\'s statement or documents. The change applies from the next build. Any update also reactivates an archived instruction and ties it to the current content of its documents.',\n fields: [\n {\n description: 'The new instruction text. Omit it to keep the current text.',\n in: 'body',\n name: 'statement',\n type: 'string'\n },\n {\n description: 'IDs of the documents the instruction applies to. Replaces the current list. Omit it to keep the current documents. IDs of documents that no longer exist are dropped. If none exist, the request returns `422` with code `instructionScopeVanished`.',\n in: 'body',\n name: 'scopeDocumentIds',\n type: 'string[]'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The instruction\\'s ID.',\n name: 'instructionId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/instructions/{instructionId}',\n startsJob: false,\n summary: 'Update an instruction'\n },\n updateKnowledgeBase: {\n body: 'required',\n description: 'Updates the title or the description, or finishes a draft (`draft: false`). Fields equal to their current value are ignored, so sending the current values changes nothing. Finishing a draft with no title returns `422` with code `draftTitleRequired`. How often a website or dataset syncs is set on the source, with `PATCH .../sources/{sourceId}`.',\n fields: [\n {\n description: 'The knowledge base\\'s new title.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'The knowledge base\\'s new description.',\n in: 'body',\n name: 'description',\n type: 'string'\n },\n {\n description: 'Set to `false` to finish a draft, so it can be built and is listed with your other knowledge bases. The knowledge base needs a title, sent here or set before. Ignored when the knowledge base isn\\'t a draft. A finished knowledge base can\\'t become a draft again.',\n in: 'body',\n name: 'draft',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}',\n startsJob: false,\n summary: 'Update a knowledge base'\n },\n updateSource: {\n body: 'required',\n description: 'Changes a source\\'s title, a website\\'s crawl options, a dataset\\'s query, or how often a website or dataset syncs on its own. New crawl options delete the documents whose path they leave out. When that would delete all of the source\\'s documents, or five or more that are over a fifth of them, the request returns `409` with code `sourceDeletionsUnconfirmed` until you send it again with `confirmDeletions` set to `true`. New crawl options sent while the source syncs return `409` with code `syncInProgress`; send them again once the sync finishes. A new query queues a sync, which removes the documents the query no longer selects.\\n\\nCrawl options on a source that isn\\'t a website, a query on one that isn\\'t a dataset, or a sync frequency on a `files` source, return `422` with code `sourceTypeMismatch`. Setting a sync frequency on a plan without scheduled syncs returns `403` with code `featureNotInPlan`; setting it to `null` always works.',\n fields: [\n {\n description: 'The source\\'s title.',\n in: 'body',\n name: 'title',\n type: 'string'\n },\n {\n description: 'Regular expressions for URL paths to crawl. When set, the crawl only includes pages whose path matches one of them.',\n in: 'body',\n name: 'includePaths',\n parent: 'crawlOptions',\n type: 'string[]'\n },\n {\n description: 'Regular expressions for URL paths to skip. Pages whose path matches one of them aren\\'t crawled.',\n in: 'body',\n name: 'excludePaths',\n parent: 'crawlOptions',\n type: 'string[]'\n },\n {\n description: 'How many levels deep the crawl goes from the root URL.',\n in: 'body',\n name: 'maxDepth',\n parent: 'crawlOptions',\n type: 'integer'\n },\n {\n description: 'Whether to crawl only the pages listed in the site\\'s sitemap.',\n in: 'body',\n name: 'sitemapOnly',\n parent: 'crawlOptions',\n type: 'boolean'\n },\n {\n description: 'Whether to treat URLs that differ only by query string as one page. New crawls set it to `true` unless you set it. Set it to `false` when the query string selects different content, such as pagination.',\n in: 'body',\n name: 'ignoreQueryParameters',\n parent: 'crawlOptions',\n type: 'boolean'\n },\n {\n description: 'The maximum number of pages to crawl. The crawl can stop sooner when the knowledge base reaches its source limit.',\n in: 'body',\n name: 'pageLimit',\n parent: 'crawlOptions',\n type: 'integer'\n },\n {\n description: 'For a `sanity-dataset` source, the GROQ query, replacing the stored one. A sync is queued, and removes the documents the query no longer returns.',\n in: 'body',\n name: 'query',\n type: 'string'\n },\n {\n description: 'For a `web` or `sanity-dataset` source, how often it syncs on its own: `weekly` or `monthly`. `null` stops scheduled syncs, and you can still start a sync yourself. Setting a frequency requires a plan that includes scheduled syncs; without one, the request returns `403` with code `featureNotInPlan`.',\n in: 'body',\n name: 'syncFrequency',\n nullable: true,\n options: [\n 'weekly',\n 'monthly'\n ],\n type: 'string'\n },\n {\n description: 'Set to `true` to apply new crawl options that delete many documents. Without it, a change that would delete all of the documents, or five or more that are over a fifth of them, returns `409` with code `sourceDeletionsUnconfirmed`.',\n in: 'body',\n name: 'confirmDeletions',\n type: 'boolean'\n }\n ],\n noContent: false,\n paginated: false,\n pathParams: [\n {\n description: 'The knowledge base\\'s ID (`kb...`), its `publicId`. Its UUID `id` is also accepted.',\n name: 'knowledgeBaseId'\n },\n {\n description: 'The source\\'s ID.',\n name: 'sourceId'\n }\n ],\n route: 'PATCH /knowledge-bases/{knowledgeBaseId}/sources/{sourceId}',\n startsJob: false,\n summary: 'Update a source'\n }\n} as const satisfies Record<string, ContextOperation>\n"],"names":["contextOperations","applyIssues","body","description","fields","in","name","required","type","noContent","paginated","pathParams","route","startsJob","summary","buildKnowledgeBase","confirmSync","createInstruction","createKnowledgeBase","createSource","options","variants","parent","deleteDocument","deleteInstruction","deleteKnowledgeBase","deleteSource","discardSync","dismissIssue","getDocument","getDocumentContent","getJob","getKnowledgeBase","getMcpEndpointInitialContext","getSource","getSync","listDocuments","pageSize","listKnowledgeBases","listSources","listSyncs","rebuildEntry","reopenIssue","resolveIssue","startSourceUpload","startSync","syncAllSources","updateDocument","updateInstruction","updateKnowledgeBase","updateSource","nullable"],"mappings":"AAAA;;;;;;;CAOC,GAGD,OAAO,MAAMA,oBAAoB;IAC/BC,aAAa;QACXC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAC,oBAAoB;QAClBb,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAE,aAAa;QACXd,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAG,mBAAmB;QACjBf,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAI,qBAAqB;QACnBhB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY,EAAE;QACdC,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAK,cAAc;QACZjB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;iBACD;gBACDb,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;YACA;gBACElB,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;iBACD;gBACDZ,MAAM;gBACNa,UAAU;oBACR;iBACD;YACH;SACD;QACDZ,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAS,gBAAgB;QACdrB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAU,mBAAmB;QACjBtB,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAW,qBAAqB;QACnBvB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAY,cAAc;QACZxB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAa,aAAa;QACXzB,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAc,cAAc;QACZ1B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAe,aAAa;QACX3B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAgB,oBAAoB;QAClB5B,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAiB,QAAQ;QACN7B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAkB,kBAAkB;QAChB9B,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAmB,8BAA8B;QAC5B/B,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAoB,WAAW;QACThC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAqB,SAAS;QACPjC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAsB,eAAe;QACblC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;oBACA;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAwB,oBAAoB;QAClBpC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY,EAAE;QACdC,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAyB,aAAa;QACXrC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA0B,WAAW;QACTtC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACX4B,UAAU;QACV3B,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA2B,cAAc;QACZvC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA4B,aAAa;QACXxC,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA6B,cAAc;QACZzC,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA8B,mBAAmB;QACjB1C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNC,UAAU;gBACVC,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACA+B,WAAW;QACT3C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAgC,gBAAgB;QACd5C,MAAM;QACNC,aAAa;QACbC,QAAQ,EAAE;QACVK,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAiC,gBAAgB;QACd7C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNc,SAAS;oBACP;iBACD;gBACDb,UAAU;gBACVC,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAkC,mBAAmB;QACjB9C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAmC,qBAAqB;QACnB/C,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;IACAoC,cAAc;QACZhD,MAAM;QACNC,aAAa;QACbC,QAAQ;YACN;gBACED,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNgB,QAAQ;gBACRd,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACN6C,UAAU;gBACV/B,SAAS;oBACP;oBACA;iBACD;gBACDZ,MAAM;YACR;YACA;gBACEL,aAAa;gBACbE,IAAI;gBACJC,MAAM;gBACNE,MAAM;YACR;SACD;QACDC,WAAW;QACXC,WAAW;QACXC,YAAY;YACV;gBACER,aAAa;gBACbG,MAAM;YACR;YACA;gBACEH,aAAa;gBACbG,MAAM;YACR;SACD;QACDM,OAAO;QACPC,WAAW;QACXC,SAAS;IACX;AACF,EAAqD"}
@@ -41,7 +41,7 @@ const hook = async function(opts) {
41
41
  exit: exitCodes.USAGE_ERROR
42
42
  });
43
43
  // No alias match - fall back to oclif plugin-not-found's "did you mean?" behavior
44
- // eslint-disable-next-line no-restricted-syntax -- package import, not a file path
44
+ // eslint-disable-next-line eslint-js/no-restricted-syntax -- package import, not a file path
45
45
  const { default: notFoundHook } = await import('@oclif/plugin-not-found');
46
46
  return notFoundHook.call(this, opts);
47
47
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/hooks/commandNotFound/topicAliases.ts"],"sourcesContent":["/**\n * Hook: Topic Alias Resolution + Command Not Found\n *\n * Replaces oclif plugin-not-found as a plugin, calling it as a fallback instead.\n * This avoids a race condition where both hooks run concurrently via Promise.all.\n *\n * This hook only fires for names oclif doesn't recognize. Registered topics\n * and commands (including hiddenAliases) are resolved by oclif before this runs.\n *\n * Flow:\n * 1. Check if the unrecognized name is a known alias (eg \"dataset\" for \"datasets\")\n * 2. If yes: rewrite and run the resolved command (or show topic help for bare topics)\n * 3. If it names a removed context command, say what replaced it\n * 4. Otherwise: fall back to oclif plugin-not-found's \"did you mean?\" behavior\n */\n\nimport {type Hook, toStandardizedId} from '@oclif/core'\nimport {exitCodes, subdebug} from '@sanity/cli-core'\n\nimport {removedContextCommandHint} from '../../actions/context/removedCommands.js'\nimport {resolveTopicAlias} from '../../topicAliases.js'\n\nconst debug = subdebug('hooks:topicAliases')\n\nconst hook: Hook.CommandNotFound = async function (opts) {\n const {config, id} = opts\n\n // Standardize the ID (handles topic separator differences)\n const standardId = toStandardizedId(id, config)\n const parts = standardId.split(':')\n const hasTopic = parts.length === 1\n const rewrittenId = resolveTopicAlias(standardId)\n\n const aliasExists =\n rewrittenId && (hasTopic ? config.findTopic(rewrittenId) : config.findCommand(rewrittenId))\n if (aliasExists) {\n debug('Rewriting topic: %s -> %s', parts[0], rewrittenId.split(':')[0])\n\n // Bare topic (eg \"sanity dataset\" with no subcommand) -> show topic help\n if (hasTopic) {\n return config.runCommand('help', [rewrittenId])\n }\n\n // Full command (eg \"sanity dataset create\") -> run the resolved command\n return config.runCommand(rewrittenId, opts.argv ?? [])\n }\n\n const removed = removedContextCommandHint(standardId)\n if (removed) return this.error(removed, {exit: exitCodes.USAGE_ERROR})\n\n // No alias match - fall back to oclif plugin-not-found's \"did you mean?\" behavior\n // eslint-disable-next-line no-restricted-syntax -- package import, not a file path\n const {default: notFoundHook} = await import('@oclif/plugin-not-found')\n return notFoundHook.call(this, opts)\n}\n\nexport default hook\n"],"names":["toStandardizedId","exitCodes","subdebug","removedContextCommandHint","resolveTopicAlias","debug","hook","opts","config","id","standardId","parts","split","hasTopic","length","rewrittenId","aliasExists","findTopic","findCommand","runCommand","argv","removed","error","exit","USAGE_ERROR","default","notFoundHook","call"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GAED,SAAmBA,gBAAgB,QAAO,cAAa;AACvD,SAAQC,SAAS,EAAEC,QAAQ,QAAO,mBAAkB;AAEpD,SAAQC,yBAAyB,QAAO,2CAA0C;AAClF,SAAQC,iBAAiB,QAAO,wBAAuB;AAEvD,MAAMC,QAAQH,SAAS;AAEvB,MAAMI,OAA6B,eAAgBC,IAAI;IACrD,MAAM,EAACC,MAAM,EAAEC,EAAE,EAAC,GAAGF;IAErB,2DAA2D;IAC3D,MAAMG,aAAaV,iBAAiBS,IAAID;IACxC,MAAMG,QAAQD,WAAWE,KAAK,CAAC;IAC/B,MAAMC,WAAWF,MAAMG,MAAM,KAAK;IAClC,MAAMC,cAAcX,kBAAkBM;IAEtC,MAAMM,cACJD,eAAgBF,CAAAA,WAAWL,OAAOS,SAAS,CAACF,eAAeP,OAAOU,WAAW,CAACH,YAAW;IAC3F,IAAIC,aAAa;QACfX,MAAM,6BAA6BM,KAAK,CAAC,EAAE,EAAEI,YAAYH,KAAK,CAAC,IAAI,CAAC,EAAE;QAEtE,yEAAyE;QACzE,IAAIC,UAAU;YACZ,OAAOL,OAAOW,UAAU,CAAC,QAAQ;gBAACJ;aAAY;QAChD;QAEA,wEAAwE;QACxE,OAAOP,OAAOW,UAAU,CAACJ,aAAaR,KAAKa,IAAI,IAAI,EAAE;IACvD;IAEA,MAAMC,UAAUlB,0BAA0BO;IAC1C,IAAIW,SAAS,OAAO,IAAI,CAACC,KAAK,CAACD,SAAS;QAACE,MAAMtB,UAAUuB,WAAW;IAAA;IAEpE,kFAAkF;IAClF,mFAAmF;IACnF,MAAM,EAACC,SAASC,YAAY,EAAC,GAAG,MAAM,MAAM,CAAC;IAC7C,OAAOA,aAAaC,IAAI,CAAC,IAAI,EAAEpB;AACjC;AAEA,eAAeD,KAAI"}
1
+ {"version":3,"sources":["../../../src/hooks/commandNotFound/topicAliases.ts"],"sourcesContent":["/**\n * Hook: Topic Alias Resolution + Command Not Found\n *\n * Replaces oclif plugin-not-found as a plugin, calling it as a fallback instead.\n * This avoids a race condition where both hooks run concurrently via Promise.all.\n *\n * This hook only fires for names oclif doesn't recognize. Registered topics\n * and commands (including hiddenAliases) are resolved by oclif before this runs.\n *\n * Flow:\n * 1. Check if the unrecognized name is a known alias (eg \"dataset\" for \"datasets\")\n * 2. If yes: rewrite and run the resolved command (or show topic help for bare topics)\n * 3. If it names a removed context command, say what replaced it\n * 4. Otherwise: fall back to oclif plugin-not-found's \"did you mean?\" behavior\n */\n\nimport {type Hook, toStandardizedId} from '@oclif/core'\nimport {exitCodes, subdebug} from '@sanity/cli-core'\n\nimport {removedContextCommandHint} from '../../actions/context/removedCommands.js'\nimport {resolveTopicAlias} from '../../topicAliases.js'\n\nconst debug = subdebug('hooks:topicAliases')\n\nconst hook: Hook.CommandNotFound = async function (opts) {\n const {config, id} = opts\n\n // Standardize the ID (handles topic separator differences)\n const standardId = toStandardizedId(id, config)\n const parts = standardId.split(':')\n const hasTopic = parts.length === 1\n const rewrittenId = resolveTopicAlias(standardId)\n\n const aliasExists =\n rewrittenId && (hasTopic ? config.findTopic(rewrittenId) : config.findCommand(rewrittenId))\n if (aliasExists) {\n debug('Rewriting topic: %s -> %s', parts[0], rewrittenId.split(':')[0])\n\n // Bare topic (eg \"sanity dataset\" with no subcommand) -> show topic help\n if (hasTopic) {\n return config.runCommand('help', [rewrittenId])\n }\n\n // Full command (eg \"sanity dataset create\") -> run the resolved command\n return config.runCommand(rewrittenId, opts.argv ?? [])\n }\n\n const removed = removedContextCommandHint(standardId)\n if (removed) return this.error(removed, {exit: exitCodes.USAGE_ERROR})\n\n // No alias match - fall back to oclif plugin-not-found's \"did you mean?\" behavior\n // eslint-disable-next-line eslint-js/no-restricted-syntax -- package import, not a file path\n const {default: notFoundHook} = await import('@oclif/plugin-not-found')\n return notFoundHook.call(this, opts)\n}\n\nexport default hook\n"],"names":["toStandardizedId","exitCodes","subdebug","removedContextCommandHint","resolveTopicAlias","debug","hook","opts","config","id","standardId","parts","split","hasTopic","length","rewrittenId","aliasExists","findTopic","findCommand","runCommand","argv","removed","error","exit","USAGE_ERROR","default","notFoundHook","call"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GAED,SAAmBA,gBAAgB,QAAO,cAAa;AACvD,SAAQC,SAAS,EAAEC,QAAQ,QAAO,mBAAkB;AAEpD,SAAQC,yBAAyB,QAAO,2CAA0C;AAClF,SAAQC,iBAAiB,QAAO,wBAAuB;AAEvD,MAAMC,QAAQH,SAAS;AAEvB,MAAMI,OAA6B,eAAgBC,IAAI;IACrD,MAAM,EAACC,MAAM,EAAEC,EAAE,EAAC,GAAGF;IAErB,2DAA2D;IAC3D,MAAMG,aAAaV,iBAAiBS,IAAID;IACxC,MAAMG,QAAQD,WAAWE,KAAK,CAAC;IAC/B,MAAMC,WAAWF,MAAMG,MAAM,KAAK;IAClC,MAAMC,cAAcX,kBAAkBM;IAEtC,MAAMM,cACJD,eAAgBF,CAAAA,WAAWL,OAAOS,SAAS,CAACF,eAAeP,OAAOU,WAAW,CAACH,YAAW;IAC3F,IAAIC,aAAa;QACfX,MAAM,6BAA6BM,KAAK,CAAC,EAAE,EAAEI,YAAYH,KAAK,CAAC,IAAI,CAAC,EAAE;QAEtE,yEAAyE;QACzE,IAAIC,UAAU;YACZ,OAAOL,OAAOW,UAAU,CAAC,QAAQ;gBAACJ;aAAY;QAChD;QAEA,wEAAwE;QACxE,OAAOP,OAAOW,UAAU,CAACJ,aAAaR,KAAKa,IAAI,IAAI,EAAE;IACvD;IAEA,MAAMC,UAAUlB,0BAA0BO;IAC1C,IAAIW,SAAS,OAAO,IAAI,CAACC,KAAK,CAACD,SAAS;QAACE,MAAMtB,UAAUuB,WAAW;IAAA;IAEpE,kFAAkF;IAClF,6FAA6F;IAC7F,MAAM,EAACC,SAASC,YAAY,EAAC,GAAG,MAAM,MAAM,CAAC;IAC7C,OAAOA,aAAaC,IAAI,CAAC,IAAI,EAAEpB;AACjC;AAEA,eAAeD,KAAI"}
@@ -32,16 +32,14 @@ export async function startDevServer(options) {
32
32
  });
33
33
  }
34
34
  let viteConfig = await getViteConfig({
35
- additionalPlugins: [
36
- // Add typegen when enabled
37
- ...typegen?.enabled ? [
38
- sanityTypegenPlugin({
39
- config: typegen,
40
- telemetryLogger: getCliTelemetry(),
41
- workDir: cwd
42
- })
43
- ] : []
44
- ],
35
+ // Add typegen when enabled
36
+ additionalPlugins: typegen?.enabled ? [
37
+ sanityTypegenPlugin({
38
+ config: typegen,
39
+ telemetryLogger: getCliTelemetry(),
40
+ workDir: cwd
41
+ })
42
+ ] : [],
45
43
  basePath,
46
44
  cwd,
47
45
  entries,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/server/devServer.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {\n extendViteConfigWithUserConfig,\n getViteConfig,\n writeSanityRuntime,\n} from '@sanity/cli-build/_internal/build'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from '@sanity/cli-build/_internal/env'\nimport {CliConfig, getCliTelemetry, type UserViteConfig} from '@sanity/cli-core'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {type FSWatcher} from 'chokidar'\nimport {createServer, type InlineConfig, type ViteDevServer} from 'vite'\n\nimport {serverDebug} from './serverDebug.js'\nimport {sanityTypegenPlugin} from './vite/plugin-typegen.js'\n\nconst debug = serverDebug.extend('dev')\n\nexport interface DevServerOptions {\n basePath: string\n cwd: string\n httpPort: number\n\n reactCompiler: CliConfig['reactCompiler']\n reactStrictMode: boolean | undefined\n\n staticPath: string\n\n appTitle?: string\n /** Enable Vite's experimental bundled dev mode (`experimental.bundledDev`). */\n bundledDev?: boolean\n /** Whether to load a custom `_document.js`/`_document.tsx` component. Defaults to `true`. */\n documentComponent?: boolean\n entry?: string\n exposes?: WorkbenchExposes\n httpHost?: string\n isApp?: boolean\n isWorkbenchApp?: boolean\n projectName?: string\n schemaExtraction?: CliConfig['schemaExtraction']\n typegen?: CliConfig['typegen']\n vite?: UserViteConfig\n /** The workbench app's bus identity (`__SANITY_APP_ID__`). */\n workbenchAppId?: string\n}\n\ninterface DevServer {\n close(): Promise<void>\n server: ViteDevServer\n\n watcher?: FSWatcher\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<DevServer> {\n const {\n appTitle,\n basePath,\n bundledDev,\n cwd,\n documentComponent,\n entry,\n exposes,\n httpHost,\n httpPort,\n isApp,\n isWorkbenchApp,\n reactCompiler,\n reactStrictMode,\n schemaExtraction,\n typegen,\n vite: extendViteConfig,\n workbenchAppId,\n } = options\n\n debug('Writing Sanity runtime files')\n const {entries, watcher} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n documentComponent,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode,\n watch: true,\n })\n\n debug('Resolving vite config')\n const mode = 'development'\n\n function getEnvironmentVariables() {\n return isApp\n ? getAppEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n : getStudioEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n }\n\n let viteConfig: InlineConfig = await getViteConfig({\n additionalPlugins: [\n // Add typegen when enabled\n ...(typegen?.enabled\n ? [\n sanityTypegenPlugin({\n config: typegen,\n telemetryLogger: getCliTelemetry(),\n workDir: cwd,\n }),\n ]\n : []),\n ],\n basePath,\n cwd,\n entries,\n exposes,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n mode: 'development',\n reactCompiler,\n schemaExtraction,\n server: {host: httpHost, port: httpPort},\n workbenchAppId,\n })\n\n // Opt into Vite's experimental bundled dev mode. Set before the user-config\n // extension below so a `vite` override in sanity.cli.ts still has final say.\n //\n // Bundled mode bundles the app up front from an HTML entry, defaulting to\n // `<root>/index.html`. Sanity has no such file — it serves a virtual document\n // rewritten to `.sanity/runtime/index.html` — so point the bundler at the real\n // runtime HTML, otherwise the build fails with UNRESOLVED_ENTRY.\n //\n // Also force `strictExecutionOrder` so shared chunks cannot evaluate before the\n // entry chunk's react-refresh preamble (which otherwise throws\n // \"@vitejs/plugin-react can't detect preamble\").\n // See https://github.com/vitejs/vite-plugin-react/issues/1191\n if (bundledDev) {\n const existingRolldown = viteConfig.build?.rolldownOptions\n const existingOutput = existingRolldown?.output\n viteConfig = {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n rolldownOptions: {\n ...existingRolldown,\n input: path.join(cwd, '.sanity', 'runtime', 'index.html'),\n output: Array.isArray(existingOutput)\n ? existingOutput.map((entry) => ({...entry, strictExecutionOrder: true}))\n : {...existingOutput, strictExecutionOrder: true},\n },\n },\n experimental: {...viteConfig.experimental, bundledDev: true},\n }\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const server = await createServer(viteConfig)\n\n debug('Listening on specified port')\n await server.listen()\n\n return {\n close: async () => {\n if (watcher) {\n await watcher.close()\n }\n await server.close()\n },\n server,\n watcher,\n }\n}\n"],"names":["path","extendViteConfigWithUserConfig","getViteConfig","writeSanityRuntime","getAppEnvironmentVariables","getStudioEnvironmentVariables","getCliTelemetry","createServer","serverDebug","sanityTypegenPlugin","debug","extend","startDevServer","options","appTitle","basePath","bundledDev","cwd","documentComponent","entry","exposes","httpHost","httpPort","isApp","isWorkbenchApp","reactCompiler","reactStrictMode","schemaExtraction","typegen","vite","extendViteConfig","workbenchAppId","entries","watcher","watch","mode","getEnvironmentVariables","jsonEncode","prefix","viteConfig","additionalPlugins","enabled","config","telemetryLogger","workDir","server","host","port","existingRolldown","build","rolldownOptions","existingOutput","output","input","join","Array","isArray","map","strictExecutionOrder","experimental","command","listen","close"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SACEC,8BAA8B,EAC9BC,aAAa,EACbC,kBAAkB,QACb,oCAAmC;AAC1C,SACEC,0BAA0B,EAC1BC,6BAA6B,QACxB,kCAAiC;AACxC,SAAmBC,eAAe,QAA4B,mBAAkB;AAGhF,SAAQC,YAAY,QAA8C,OAAM;AAExE,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAAQC,mBAAmB,QAAO,2BAA0B;AAE5D,MAAMC,QAAQF,YAAYG,MAAM,CAAC;AAqCjC,OAAO,eAAeC,eAAeC,OAAyB;IAC5D,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,GAAG,EACHC,iBAAiB,EACjBC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,gBAAgB,EAChBC,OAAO,EACPC,MAAMC,gBAAgB,EACtBC,cAAc,EACf,GAAGlB;IAEJH,MAAM;IACN,MAAM,EAACsB,OAAO,EAAEC,OAAO,EAAC,GAAG,MAAM9B,mBAAmB;QAClDW;QACAC;QACAE;QACAC;QACAC;QACAI;QACAC;QACAE;QACAQ,OAAO;IACT;IAEAxB,MAAM;IACN,MAAMyB,OAAO;IAEb,SAASC;QACP,OAAOb,QACHnB,2BAA2B;YAACiC,YAAY;YAAMC,QAAQ;QAAc,KACpEjC,8BAA8B;YAACgC,YAAY;YAAMC,QAAQ;QAAc;IAC7E;IAEA,IAAIC,aAA2B,MAAMrC,cAAc;QACjDsC,mBAAmB;YACjB,2BAA2B;eACvBZ,SAASa,UACT;gBACEhC,oBAAoB;oBAClBiC,QAAQd;oBACRe,iBAAiBrC;oBACjBsC,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,"sources":["../../src/server/devServer.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {\n extendViteConfigWithUserConfig,\n getViteConfig,\n writeSanityRuntime,\n} from '@sanity/cli-build/_internal/build'\nimport {\n getAppEnvironmentVariables,\n getStudioEnvironmentVariables,\n} from '@sanity/cli-build/_internal/env'\nimport {CliConfig, getCliTelemetry, type UserViteConfig} from '@sanity/cli-core'\nimport {type WorkbenchExposes} from '@sanity/workbench-cli/build'\nimport {type FSWatcher} from 'chokidar'\nimport {createServer, type InlineConfig, type ViteDevServer} from 'vite'\n\nimport {serverDebug} from './serverDebug.js'\nimport {sanityTypegenPlugin} from './vite/plugin-typegen.js'\n\nconst debug = serverDebug.extend('dev')\n\nexport interface DevServerOptions {\n basePath: string\n cwd: string\n httpPort: number\n\n reactCompiler: CliConfig['reactCompiler']\n reactStrictMode: boolean | undefined\n\n staticPath: string\n\n appTitle?: string\n /** Enable Vite's experimental bundled dev mode (`experimental.bundledDev`). */\n bundledDev?: boolean\n /** Whether to load a custom `_document.js`/`_document.tsx` component. Defaults to `true`. */\n documentComponent?: boolean\n entry?: string\n exposes?: WorkbenchExposes\n httpHost?: string\n isApp?: boolean\n isWorkbenchApp?: boolean\n projectName?: string\n schemaExtraction?: CliConfig['schemaExtraction']\n typegen?: CliConfig['typegen']\n vite?: UserViteConfig\n /** The workbench app's bus identity (`__SANITY_APP_ID__`). */\n workbenchAppId?: string\n}\n\ninterface DevServer {\n close(): Promise<void>\n server: ViteDevServer\n\n watcher?: FSWatcher\n}\n\nexport async function startDevServer(options: DevServerOptions): Promise<DevServer> {\n const {\n appTitle,\n basePath,\n bundledDev,\n cwd,\n documentComponent,\n entry,\n exposes,\n httpHost,\n httpPort,\n isApp,\n isWorkbenchApp,\n reactCompiler,\n reactStrictMode,\n schemaExtraction,\n typegen,\n vite: extendViteConfig,\n workbenchAppId,\n } = options\n\n debug('Writing Sanity runtime files')\n const {entries, watcher} = await writeSanityRuntime({\n appTitle,\n basePath,\n cwd,\n documentComponent,\n entry,\n isApp,\n isWorkbenchApp,\n reactStrictMode,\n watch: true,\n })\n\n debug('Resolving vite config')\n const mode = 'development'\n\n function getEnvironmentVariables() {\n return isApp\n ? getAppEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n : getStudioEnvironmentVariables({jsonEncode: true, prefix: 'process.env.'})\n }\n\n let viteConfig: InlineConfig = await getViteConfig({\n // Add typegen when enabled\n additionalPlugins: typegen?.enabled\n ? [\n sanityTypegenPlugin({\n config: typegen,\n telemetryLogger: getCliTelemetry(),\n workDir: cwd,\n }),\n ]\n : [],\n basePath,\n cwd,\n entries,\n exposes,\n getEnvironmentVariables,\n isApp,\n isWorkbenchApp,\n mode: 'development',\n reactCompiler,\n schemaExtraction,\n server: {host: httpHost, port: httpPort},\n workbenchAppId,\n })\n\n // Opt into Vite's experimental bundled dev mode. Set before the user-config\n // extension below so a `vite` override in sanity.cli.ts still has final say.\n //\n // Bundled mode bundles the app up front from an HTML entry, defaulting to\n // `<root>/index.html`. Sanity has no such file — it serves a virtual document\n // rewritten to `.sanity/runtime/index.html` — so point the bundler at the real\n // runtime HTML, otherwise the build fails with UNRESOLVED_ENTRY.\n //\n // Also force `strictExecutionOrder` so shared chunks cannot evaluate before the\n // entry chunk's react-refresh preamble (which otherwise throws\n // \"@vitejs/plugin-react can't detect preamble\").\n // See https://github.com/vitejs/vite-plugin-react/issues/1191\n if (bundledDev) {\n const existingRolldown = viteConfig.build?.rolldownOptions\n const existingOutput = existingRolldown?.output\n viteConfig = {\n ...viteConfig,\n build: {\n ...viteConfig.build,\n rolldownOptions: {\n ...existingRolldown,\n input: path.join(cwd, '.sanity', 'runtime', 'index.html'),\n output: Array.isArray(existingOutput)\n ? existingOutput.map((entry) => ({...entry, strictExecutionOrder: true}))\n : {...existingOutput, strictExecutionOrder: true},\n },\n },\n experimental: {...viteConfig.experimental, bundledDev: true},\n }\n }\n\n // Extend Vite configuration with user-provided config\n if (extendViteConfig) {\n viteConfig = await extendViteConfigWithUserConfig(\n {command: 'serve', mode},\n viteConfig,\n extendViteConfig,\n )\n }\n\n debug('Creating vite server')\n const server = await createServer(viteConfig)\n\n debug('Listening on specified port')\n await server.listen()\n\n return {\n close: async () => {\n if (watcher) {\n await watcher.close()\n }\n await server.close()\n },\n server,\n watcher,\n }\n}\n"],"names":["path","extendViteConfigWithUserConfig","getViteConfig","writeSanityRuntime","getAppEnvironmentVariables","getStudioEnvironmentVariables","getCliTelemetry","createServer","serverDebug","sanityTypegenPlugin","debug","extend","startDevServer","options","appTitle","basePath","bundledDev","cwd","documentComponent","entry","exposes","httpHost","httpPort","isApp","isWorkbenchApp","reactCompiler","reactStrictMode","schemaExtraction","typegen","vite","extendViteConfig","workbenchAppId","entries","watcher","watch","mode","getEnvironmentVariables","jsonEncode","prefix","viteConfig","additionalPlugins","enabled","config","telemetryLogger","workDir","server","host","port","existingRolldown","build","rolldownOptions","existingOutput","output","input","join","Array","isArray","map","strictExecutionOrder","experimental","command","listen","close"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SACEC,8BAA8B,EAC9BC,aAAa,EACbC,kBAAkB,QACb,oCAAmC;AAC1C,SACEC,0BAA0B,EAC1BC,6BAA6B,QACxB,kCAAiC;AACxC,SAAmBC,eAAe,QAA4B,mBAAkB;AAGhF,SAAQC,YAAY,QAA8C,OAAM;AAExE,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAAQC,mBAAmB,QAAO,2BAA0B;AAE5D,MAAMC,QAAQF,YAAYG,MAAM,CAAC;AAqCjC,OAAO,eAAeC,eAAeC,OAAyB;IAC5D,MAAM,EACJC,QAAQ,EACRC,QAAQ,EACRC,UAAU,EACVC,GAAG,EACHC,iBAAiB,EACjBC,KAAK,EACLC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,cAAc,EACdC,aAAa,EACbC,eAAe,EACfC,gBAAgB,EAChBC,OAAO,EACPC,MAAMC,gBAAgB,EACtBC,cAAc,EACf,GAAGlB;IAE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