@gitbook/api 0.101.0 → 0.103.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.
package/dist/client.d.ts CHANGED
@@ -4297,6 +4297,20 @@ export interface CustomizationFooterGroup {
4297
4297
  title: string;
4298
4298
  links: CustomizationContentLink[];
4299
4299
  }
4300
+ export interface CustomizationAnnouncement {
4301
+ /** Whether to show the site's announcement. */
4302
+ enabled: boolean;
4303
+ /**
4304
+ * The text content of the announcement.
4305
+ * @minLength 2
4306
+ * @maxLength 128
4307
+ */
4308
+ message: string;
4309
+ /** The content or URL the announcement links to when clicked. */
4310
+ link?: CustomizationContentLink;
4311
+ /** The style of the announcement. Used to style the banner with the right semantic color and enable/disable features like hiding the banner. */
4312
+ style: 'info' | 'warning' | 'danger' | 'success';
4313
+ }
4300
4314
  export declare enum CustomizationThemeMode {
4301
4315
  Light = "light",
4302
4316
  Dark = "dark"
@@ -4385,6 +4399,7 @@ export interface SiteCustomizationSettings {
4385
4399
  /** @maxLength 300 */
4386
4400
  copyright?: string;
4387
4401
  };
4402
+ announcement?: CustomizationAnnouncement;
4388
4403
  /** Customization options for the dark/light theme modes. */
4389
4404
  themes: {
4390
4405
  default: CustomizationThemeMode;
@@ -4551,6 +4566,85 @@ export interface UserSitePermission {
4551
4566
  /** The content or organization that enforced this permission level. */
4552
4567
  origin: SpacePointer | OrganizationPointer;
4553
4568
  }
4569
+ export declare enum AIMessageRole {
4570
+ User = "user",
4571
+ Developer = "developer"
4572
+ }
4573
+ /** Attachment to extract knowledge matching a given query. */
4574
+ export interface AIMessageAttachmentKnowledge {
4575
+ type: 'knowledge';
4576
+ /** The query to use to extract the knowledge. */
4577
+ query: string;
4578
+ }
4579
+ /** Attachment representing the profile of the visitor */
4580
+ export interface AIMessageAttachmentVisitorProfile {
4581
+ type: 'visitor_profile';
4582
+ }
4583
+ /** Attachment to extract and pass the content of a page to the AI */
4584
+ export interface AIMessageAttachmentPage {
4585
+ type: 'page';
4586
+ /** The ID of the space to extract the content from */
4587
+ spaceId: string;
4588
+ /** The ID of the revision to extract the content from */
4589
+ revisionId: string;
4590
+ /** The ID of the page to extract the content from */
4591
+ pageId: string;
4592
+ }
4593
+ /** Attachment to pass the tree of pages to the AI */
4594
+ export interface AIMessageAttachmentPages {
4595
+ type: 'pages';
4596
+ /** The ID of the space to extract the content from */
4597
+ spaceId: string;
4598
+ /** The ID of the revision to extract the content from */
4599
+ revisionId: string;
4600
+ }
4601
+ export type AIMessageAttachment = AIMessageAttachmentKnowledge | AIMessageAttachmentVisitorProfile | AIMessageAttachmentPage | AIMessageAttachmentPages;
4602
+ export interface AIMessageInput {
4603
+ role: AIMessageRole;
4604
+ /** @maxLength 2048 */
4605
+ content: string;
4606
+ attachments?: AIMessageAttachment[];
4607
+ }
4608
+ /** Indicate that the AI should response with a JSON object corresponding to the provided schema. */
4609
+ export interface AIOutputFormatObject {
4610
+ type: 'object';
4611
+ /** The JSON schema to use for the object. */
4612
+ schema: {
4613
+ type?: 'object';
4614
+ properties?: any;
4615
+ required?: string[];
4616
+ };
4617
+ }
4618
+ /** Indicate that the AI should respond with a rich text document. */
4619
+ export interface AIOutputFormatDocument {
4620
+ type: 'document';
4621
+ }
4622
+ export type AIOutputFormat = AIOutputFormatObject | AIOutputFormatDocument;
4623
+ export declare enum AIModel {
4624
+ Fast = "fast",
4625
+ ReasoningLow = "reasoning-low",
4626
+ ReasoningMedium = "reasoning-medium",
4627
+ ReasoningHigh = "reasoning-high"
4628
+ }
4629
+ /** Message emitted by the server to indicate the end of the AI response. It contains the ID of the response to be referenced for followup requests. */
4630
+ export interface AIStreamResponseFinish {
4631
+ type: 'response_finish';
4632
+ /** The ID of the response */
4633
+ responseId: string;
4634
+ }
4635
+ /** Message emitted by the server to indicate the latest block of the document. The block can either be a new block or an update to the previous block. */
4636
+ export interface AIStreamResponseDocument {
4637
+ type: 'response_document';
4638
+ operation: 'insert' | 'update';
4639
+ blocks: DocumentBlock[];
4640
+ }
4641
+ /** Message emitted by the server to indicate a chunk of the JSON object response. */
4642
+ export interface AIStreamResponseObject {
4643
+ type: 'response_object';
4644
+ /** The chunk of the JSON object response */
4645
+ jsonChunk: string;
4646
+ }
4647
+ export type AIStreamResponse = AIStreamResponseFinish | AIStreamResponseDocument | AIStreamResponseObject;
4554
4648
  /** Analytics info on the GitBook's site session. */
4555
4649
  export interface SiteInsightsEventSession {
4556
4650
  /** GitBook's unique identifier of the visitor. */
@@ -4577,10 +4671,15 @@ export interface SiteInsightsEventSession {
4577
4671
  /** Referrer of the session */
4578
4672
  referrer: '' | null | URL;
4579
4673
  /**
4580
- * Authentication token of the visitor.
4581
- * This is used to identify the visitor with adaptive content.
4674
+ * Deprecated, use visitorAuthClaims instead.
4675
+ * @deprecated
4582
4676
  */
4583
4677
  visitorAuthToken?: string | null;
4678
+ /**
4679
+ * Claims of the visitor.
4680
+ * This is used to identify the visitor with adaptive content.
4681
+ */
4682
+ visitorAuthClaims?: PlainObject;
4584
4683
  }
4585
4684
  /** Location of the event. */
4586
4685
  export interface SiteInsightsEventLocation {
@@ -10668,6 +10767,7 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10668
10767
  /** Unicode codepoint or character of the emoji */
10669
10768
  emoji: Emoji;
10670
10769
  } | object | null;
10770
+ announcement?: CustomizationAnnouncement;
10671
10771
  header?: {
10672
10772
  /** The theme preset to use. Set to null to reset the override. */
10673
10773
  preset?: CustomizationHeaderPreset | null;
@@ -10848,6 +10948,22 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
10848
10948
  }, params?: RequestParams) => Promise<HttpResponse<List & {
10849
10949
  items: UserSitePermission[];
10850
10950
  }, Error>>;
10951
+ /**
10952
+ * @description Experimental operation to generate an AI response in a site.
10953
+ *
10954
+ * @tags sites
10955
+ * @name StreamAiResponseInSite
10956
+ * @summary Generate an AI response in a site
10957
+ * @request POST:/orgs/{organizationId}/sites/{siteId}/ai/response
10958
+ * @secure
10959
+ */
10960
+ streamAiResponseInSite: (organizationId: string, siteId: string, data: {
10961
+ /** The ID of the previous response to continue from */
10962
+ previousResponseId?: string;
10963
+ input: AIMessageInput[];
10964
+ output: AIOutputFormat;
10965
+ model?: AIModel;
10966
+ }, params?: RequestParams) => EventIterator<AIStreamResponse>;
10851
10967
  /**
10852
10968
  * @description Track events in a site.
10853
10969
  *
package/dist/index.cjs CHANGED
@@ -179,6 +179,8 @@ var require_node = __commonJS({
179
179
  // src/index.ts
180
180
  var src_exports = {};
181
181
  __export(src_exports, {
182
+ AIMessageRole: () => AIMessageRole,
183
+ AIModel: () => AIModel,
182
184
  APIIntegrationScope: () => APIIntegrationScope,
183
185
  Api: () => Api,
184
186
  BillingInterval: () => BillingInterval,
@@ -265,7 +267,7 @@ module.exports = __toCommonJS(src_exports);
265
267
 
266
268
  // package.json
267
269
  var name = "@gitbook/api";
268
- var version = "0.101.0";
270
+ var version = "0.103.0";
269
271
 
270
272
  // src/client.ts
271
273
  var import_event_iterator = __toESM(require_node(), 1);
@@ -763,6 +765,18 @@ var CustomizationThemeMode = /* @__PURE__ */ ((CustomizationThemeMode2) => {
763
765
  CustomizationThemeMode2["Dark"] = "dark";
764
766
  return CustomizationThemeMode2;
765
767
  })(CustomizationThemeMode || {});
768
+ var AIMessageRole = /* @__PURE__ */ ((AIMessageRole2) => {
769
+ AIMessageRole2["User"] = "user";
770
+ AIMessageRole2["Developer"] = "developer";
771
+ return AIMessageRole2;
772
+ })(AIMessageRole || {});
773
+ var AIModel = /* @__PURE__ */ ((AIModel2) => {
774
+ AIModel2["Fast"] = "fast";
775
+ AIModel2["ReasoningLow"] = "reasoning-low";
776
+ AIModel2["ReasoningMedium"] = "reasoning-medium";
777
+ AIModel2["ReasoningHigh"] = "reasoning-high";
778
+ return AIModel2;
779
+ })(AIModel || {});
766
780
  var PageFeedbackRating = /* @__PURE__ */ ((PageFeedbackRating2) => {
767
781
  PageFeedbackRating2["Bad"] = "bad";
768
782
  PageFeedbackRating2["Ok"] = "ok";
@@ -3141,6 +3155,14 @@ var Api = class extends HttpClient {
3141
3155
  format: "json",
3142
3156
  ...params
3143
3157
  }),
3158
+ streamAiResponseInSite: (organizationId, siteId, data, params = {}) => this.streamRequest({
3159
+ path: `/orgs/${organizationId}/sites/${siteId}/ai/response`,
3160
+ method: "POST",
3161
+ body: data,
3162
+ secure: true,
3163
+ type: "application/json" /* Json */,
3164
+ ...params
3165
+ }),
3144
3166
  trackEventsInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3145
3167
  path: `/orgs/${organizationId}/sites/${siteId}/insights/events`,
3146
3168
  method: "POST",
@@ -3365,6 +3387,8 @@ var GitBookAPI = class extends Api {
3365
3387
  };
3366
3388
  // Annotate the CommonJS export names for ESM import in node:
3367
3389
  0 && (module.exports = {
3390
+ AIMessageRole,
3391
+ AIModel,
3368
3392
  APIIntegrationScope,
3369
3393
  Api,
3370
3394
  BillingInterval,
package/dist/index.js CHANGED
@@ -172,7 +172,7 @@ var require_node = __commonJS({
172
172
 
173
173
  // package.json
174
174
  var name = "@gitbook/api";
175
- var version = "0.101.0";
175
+ var version = "0.103.0";
176
176
 
177
177
  // src/client.ts
178
178
  var import_event_iterator = __toESM(require_node(), 1);
@@ -670,6 +670,18 @@ var CustomizationThemeMode = /* @__PURE__ */ ((CustomizationThemeMode2) => {
670
670
  CustomizationThemeMode2["Dark"] = "dark";
671
671
  return CustomizationThemeMode2;
672
672
  })(CustomizationThemeMode || {});
673
+ var AIMessageRole = /* @__PURE__ */ ((AIMessageRole2) => {
674
+ AIMessageRole2["User"] = "user";
675
+ AIMessageRole2["Developer"] = "developer";
676
+ return AIMessageRole2;
677
+ })(AIMessageRole || {});
678
+ var AIModel = /* @__PURE__ */ ((AIModel2) => {
679
+ AIModel2["Fast"] = "fast";
680
+ AIModel2["ReasoningLow"] = "reasoning-low";
681
+ AIModel2["ReasoningMedium"] = "reasoning-medium";
682
+ AIModel2["ReasoningHigh"] = "reasoning-high";
683
+ return AIModel2;
684
+ })(AIModel || {});
673
685
  var PageFeedbackRating = /* @__PURE__ */ ((PageFeedbackRating2) => {
674
686
  PageFeedbackRating2["Bad"] = "bad";
675
687
  PageFeedbackRating2["Ok"] = "ok";
@@ -3048,6 +3060,14 @@ var Api = class extends HttpClient {
3048
3060
  format: "json",
3049
3061
  ...params
3050
3062
  }),
3063
+ streamAiResponseInSite: (organizationId, siteId, data, params = {}) => this.streamRequest({
3064
+ path: `/orgs/${organizationId}/sites/${siteId}/ai/response`,
3065
+ method: "POST",
3066
+ body: data,
3067
+ secure: true,
3068
+ type: "application/json" /* Json */,
3069
+ ...params
3070
+ }),
3051
3071
  trackEventsInSiteById: (organizationId, siteId, data, params = {}) => this.request({
3052
3072
  path: `/orgs/${organizationId}/sites/${siteId}/insights/events`,
3053
3073
  method: "POST",
@@ -3271,6 +3291,8 @@ var GitBookAPI = class extends Api {
3271
3291
  }
3272
3292
  };
3273
3293
  export {
3294
+ AIMessageRole,
3295
+ AIModel,
3274
3296
  APIIntegrationScope,
3275
3297
  Api,
3276
3298
  BillingInterval,
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "main": "./dist/index.cjs",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
- "version": "0.101.0",
7
+ "version": "0.103.0",
8
8
  "sideEffects": false,
9
9
  "files": [
10
10
  "README.md",
package/spec/openapi.json CHANGED
@@ -13411,6 +13411,9 @@
13411
13411
  }
13412
13412
  ]
13413
13413
  },
13414
+ "announcement": {
13415
+ "$ref": "#/components/schemas/CustomizationAnnouncement"
13416
+ },
13414
13417
  "header": {
13415
13418
  "type": "object",
13416
13419
  "properties": {
@@ -13971,6 +13974,77 @@
13971
13974
  }
13972
13975
  }
13973
13976
  },
13977
+ "/orgs/{organizationId}/sites/{siteId}/ai/response": {
13978
+ "post": {
13979
+ "operationId": "streamAIResponseInSite",
13980
+ "summary": "Generate an AI response in a site",
13981
+ "description": "Experimental operation to generate an AI response in a site.\n",
13982
+ "tags": [
13983
+ "sites"
13984
+ ],
13985
+ "x-internal": true,
13986
+ "security": [
13987
+ {
13988
+ "user": []
13989
+ }
13990
+ ],
13991
+ "parameters": [
13992
+ {
13993
+ "$ref": "#/components/parameters/organizationId"
13994
+ },
13995
+ {
13996
+ "$ref": "#/components/parameters/siteId"
13997
+ }
13998
+ ],
13999
+ "requestBody": {
14000
+ "required": true,
14001
+ "content": {
14002
+ "application/json": {
14003
+ "schema": {
14004
+ "type": "object",
14005
+ "required": [
14006
+ "input",
14007
+ "output"
14008
+ ],
14009
+ "properties": {
14010
+ "previousResponseId": {
14011
+ "type": "string",
14012
+ "description": "The ID of the previous response to continue from"
14013
+ },
14014
+ "input": {
14015
+ "type": "array",
14016
+ "items": {
14017
+ "$ref": "#/components/schemas/AIMessageInput"
14018
+ }
14019
+ },
14020
+ "output": {
14021
+ "$ref": "#/components/schemas/AIOutputFormat"
14022
+ },
14023
+ "model": {
14024
+ "$ref": "#/components/schemas/AIModel"
14025
+ }
14026
+ }
14027
+ }
14028
+ }
14029
+ }
14030
+ },
14031
+ "responses": {
14032
+ "200": {
14033
+ "description": "OK",
14034
+ "content": {
14035
+ "text/event-stream": {
14036
+ "schema": {
14037
+ "$ref": "#/components/schemas/AIStreamResponse"
14038
+ }
14039
+ }
14040
+ }
14041
+ },
14042
+ "default": {
14043
+ "$ref": "#/components/responses/UnexpectedError"
14044
+ }
14045
+ }
14046
+ }
14047
+ },
13974
14048
  "/orgs/{organizationId}/sites/{siteId}/insights/events": {
13975
14049
  "post": {
13976
14050
  "operationId": "trackEventsInSiteById",
@@ -29307,6 +29381,40 @@
29307
29381
  "links"
29308
29382
  ]
29309
29383
  },
29384
+ "CustomizationAnnouncement": {
29385
+ "type": "object",
29386
+ "properties": {
29387
+ "enabled": {
29388
+ "description": "Whether to show the site's announcement.",
29389
+ "type": "boolean"
29390
+ },
29391
+ "message": {
29392
+ "description": "The text content of the announcement.",
29393
+ "type": "string",
29394
+ "minLength": 2,
29395
+ "maxLength": 128
29396
+ },
29397
+ "link": {
29398
+ "description": "The content or URL the announcement links to when clicked.",
29399
+ "$ref": "#/components/schemas/CustomizationContentLink"
29400
+ },
29401
+ "style": {
29402
+ "description": "The style of the announcement. Used to style the banner with the right semantic color and enable/disable features like hiding the banner.",
29403
+ "type": "string",
29404
+ "enum": [
29405
+ "info",
29406
+ "warning",
29407
+ "danger",
29408
+ "success"
29409
+ ]
29410
+ }
29411
+ },
29412
+ "required": [
29413
+ "enabled",
29414
+ "message",
29415
+ "style"
29416
+ ]
29417
+ },
29310
29418
  "CustomizationThemeMode": {
29311
29419
  "type": "string",
29312
29420
  "enum": [
@@ -29490,6 +29598,9 @@
29490
29598
  "groups"
29491
29599
  ]
29492
29600
  },
29601
+ "announcement": {
29602
+ "$ref": "#/components/schemas/CustomizationAnnouncement"
29603
+ },
29493
29604
  "themes": {
29494
29605
  "description": "Customization options for the dark/light theme modes.\n",
29495
29606
  "type": "object",
@@ -30033,6 +30144,293 @@
30033
30144
  "origin"
30034
30145
  ]
30035
30146
  },
30147
+ "AIMessageRole": {
30148
+ "type": "string",
30149
+ "enum": [
30150
+ "user",
30151
+ "developer"
30152
+ ]
30153
+ },
30154
+ "AIMessageAttachmentKnowledge": {
30155
+ "type": "object",
30156
+ "description": "Attachment to extract knowledge matching a given query.",
30157
+ "properties": {
30158
+ "type": {
30159
+ "type": "string",
30160
+ "enum": [
30161
+ "knowledge"
30162
+ ]
30163
+ },
30164
+ "query": {
30165
+ "type": "string",
30166
+ "description": "The query to use to extract the knowledge."
30167
+ }
30168
+ },
30169
+ "required": [
30170
+ "type",
30171
+ "query"
30172
+ ]
30173
+ },
30174
+ "AIMessageAttachmentVisitorProfile": {
30175
+ "type": "object",
30176
+ "description": "Attachment representing the profile of the visitor",
30177
+ "properties": {
30178
+ "type": {
30179
+ "type": "string",
30180
+ "enum": [
30181
+ "visitor_profile"
30182
+ ]
30183
+ }
30184
+ },
30185
+ "required": [
30186
+ "type"
30187
+ ]
30188
+ },
30189
+ "AIMessageAttachmentPage": {
30190
+ "type": "object",
30191
+ "description": "Attachment to extract and pass the content of a page to the AI",
30192
+ "properties": {
30193
+ "type": {
30194
+ "type": "string",
30195
+ "enum": [
30196
+ "page"
30197
+ ]
30198
+ },
30199
+ "spaceId": {
30200
+ "type": "string",
30201
+ "description": "The ID of the space to extract the content from"
30202
+ },
30203
+ "revisionId": {
30204
+ "type": "string",
30205
+ "description": "The ID of the revision to extract the content from"
30206
+ },
30207
+ "pageId": {
30208
+ "type": "string",
30209
+ "description": "The ID of the page to extract the content from"
30210
+ }
30211
+ },
30212
+ "required": [
30213
+ "type",
30214
+ "spaceId",
30215
+ "revisionId",
30216
+ "pageId"
30217
+ ]
30218
+ },
30219
+ "AIMessageAttachmentPages": {
30220
+ "type": "object",
30221
+ "description": "Attachment to pass the tree of pages to the AI",
30222
+ "properties": {
30223
+ "type": {
30224
+ "type": "string",
30225
+ "enum": [
30226
+ "pages"
30227
+ ]
30228
+ },
30229
+ "spaceId": {
30230
+ "type": "string",
30231
+ "description": "The ID of the space to extract the content from"
30232
+ },
30233
+ "revisionId": {
30234
+ "type": "string",
30235
+ "description": "The ID of the revision to extract the content from"
30236
+ }
30237
+ },
30238
+ "required": [
30239
+ "type",
30240
+ "spaceId",
30241
+ "revisionId"
30242
+ ]
30243
+ },
30244
+ "AIMessageAttachment": {
30245
+ "oneOf": [
30246
+ {
30247
+ "$ref": "#/components/schemas/AIMessageAttachmentKnowledge"
30248
+ },
30249
+ {
30250
+ "$ref": "#/components/schemas/AIMessageAttachmentVisitorProfile"
30251
+ },
30252
+ {
30253
+ "$ref": "#/components/schemas/AIMessageAttachmentPage"
30254
+ },
30255
+ {
30256
+ "$ref": "#/components/schemas/AIMessageAttachmentPages"
30257
+ }
30258
+ ]
30259
+ },
30260
+ "AIMessageInput": {
30261
+ "type": "object",
30262
+ "properties": {
30263
+ "role": {
30264
+ "$ref": "#/components/schemas/AIMessageRole"
30265
+ },
30266
+ "content": {
30267
+ "type": "string",
30268
+ "maxLength": 2048
30269
+ },
30270
+ "attachments": {
30271
+ "type": "array",
30272
+ "items": {
30273
+ "$ref": "#/components/schemas/AIMessageAttachment"
30274
+ }
30275
+ }
30276
+ },
30277
+ "required": [
30278
+ "role",
30279
+ "content"
30280
+ ]
30281
+ },
30282
+ "AIOutputFormatObject": {
30283
+ "type": "object",
30284
+ "description": "Indicate that the AI should response with a JSON object corresponding to the provided schema.\n",
30285
+ "properties": {
30286
+ "type": {
30287
+ "type": "string",
30288
+ "enum": [
30289
+ "object"
30290
+ ]
30291
+ },
30292
+ "schema": {
30293
+ "type": "object",
30294
+ "description": "The JSON schema to use for the object.",
30295
+ "properties": {
30296
+ "type": {
30297
+ "type": "string",
30298
+ "enum": [
30299
+ "object"
30300
+ ]
30301
+ },
30302
+ "properties": {},
30303
+ "required": {
30304
+ "type": "array",
30305
+ "items": {
30306
+ "type": "string"
30307
+ }
30308
+ }
30309
+ }
30310
+ }
30311
+ },
30312
+ "required": [
30313
+ "type",
30314
+ "schema"
30315
+ ]
30316
+ },
30317
+ "AIOutputFormatDocument": {
30318
+ "type": "object",
30319
+ "description": "Indicate that the AI should respond with a rich text document.\n",
30320
+ "properties": {
30321
+ "type": {
30322
+ "type": "string",
30323
+ "enum": [
30324
+ "document"
30325
+ ]
30326
+ }
30327
+ },
30328
+ "required": [
30329
+ "type"
30330
+ ]
30331
+ },
30332
+ "AIOutputFormat": {
30333
+ "oneOf": [
30334
+ {
30335
+ "$ref": "#/components/schemas/AIOutputFormatObject"
30336
+ },
30337
+ {
30338
+ "$ref": "#/components/schemas/AIOutputFormatDocument"
30339
+ }
30340
+ ]
30341
+ },
30342
+ "AIModel": {
30343
+ "type": "string",
30344
+ "enum": [
30345
+ "fast",
30346
+ "reasoning-low",
30347
+ "reasoning-medium",
30348
+ "reasoning-high"
30349
+ ]
30350
+ },
30351
+ "AIStreamResponseFinish": {
30352
+ "type": "object",
30353
+ "description": "Message emitted by the server to indicate the end of the AI response. It contains the ID of the response to be referenced for followup requests.\n",
30354
+ "properties": {
30355
+ "type": {
30356
+ "type": "string",
30357
+ "enum": [
30358
+ "response_finish"
30359
+ ]
30360
+ },
30361
+ "responseId": {
30362
+ "type": "string",
30363
+ "description": "The ID of the response"
30364
+ }
30365
+ },
30366
+ "required": [
30367
+ "type",
30368
+ "responseId"
30369
+ ]
30370
+ },
30371
+ "AIStreamResponseDocument": {
30372
+ "type": "object",
30373
+ "description": "Message emitted by the server to indicate the latest block of the document. The block can either be a new block or an update to the previous block.\n",
30374
+ "properties": {
30375
+ "type": {
30376
+ "type": "string",
30377
+ "enum": [
30378
+ "response_document"
30379
+ ]
30380
+ },
30381
+ "operation": {
30382
+ "type": "string",
30383
+ "enum": [
30384
+ "insert",
30385
+ "update"
30386
+ ]
30387
+ },
30388
+ "blocks": {
30389
+ "type": "array",
30390
+ "items": {
30391
+ "$ref": "#/components/schemas/DocumentBlock"
30392
+ }
30393
+ }
30394
+ },
30395
+ "required": [
30396
+ "type",
30397
+ "operation",
30398
+ "blocks"
30399
+ ]
30400
+ },
30401
+ "AIStreamResponseObject": {
30402
+ "type": "object",
30403
+ "description": "Message emitted by the server to indicate a chunk of the JSON object response.\n",
30404
+ "properties": {
30405
+ "type": {
30406
+ "type": "string",
30407
+ "enum": [
30408
+ "response_object"
30409
+ ]
30410
+ },
30411
+ "jsonChunk": {
30412
+ "type": "string",
30413
+ "description": "The chunk of the JSON object response"
30414
+ }
30415
+ },
30416
+ "required": [
30417
+ "type",
30418
+ "jsonChunk"
30419
+ ]
30420
+ },
30421
+ "AIStreamResponse": {
30422
+ "oneOf": [
30423
+ {
30424
+ "$ref": "#/components/schemas/AIStreamResponseFinish"
30425
+ },
30426
+ {
30427
+ "$ref": "#/components/schemas/AIStreamResponseDocument"
30428
+ },
30429
+ {
30430
+ "$ref": "#/components/schemas/AIStreamResponseObject"
30431
+ }
30432
+ ]
30433
+ },
30036
30434
  "SiteInsightsEventSession": {
30037
30435
  "type": "object",
30038
30436
  "description": "Analytics info on the GitBook's site session.",
@@ -30084,7 +30482,12 @@
30084
30482
  "visitorAuthToken": {
30085
30483
  "type": "string",
30086
30484
  "nullable": true,
30087
- "description": "Authentication token of the visitor.\nThis is used to identify the visitor with adaptive content.\n"
30485
+ "deprecated": true,
30486
+ "description": "Deprecated, use visitorAuthClaims instead."
30487
+ },
30488
+ "visitorAuthClaims": {
30489
+ "description": "Claims of the visitor.\nThis is used to identify the visitor with adaptive content.\n",
30490
+ "$ref": "#/components/schemas/PlainObject"
30088
30491
  }
30089
30492
  },
30090
30493
  "required": [
package/spec/openapi.yaml CHANGED
@@ -7444,6 +7444,8 @@ paths:
7444
7444
  nullable: true
7445
7445
  properties: {}
7446
7446
  additionalProperties: false
7447
+ announcement:
7448
+ $ref: "#/components/schemas/CustomizationAnnouncement"
7447
7449
  header:
7448
7450
  type: object
7449
7451
  properties:
@@ -7767,6 +7769,50 @@ paths:
7767
7769
  $ref: "#/components/schemas/UserSitePermission"
7768
7770
  default:
7769
7771
  $ref: "#/components/responses/UnexpectedError"
7772
+ "/orgs/{organizationId}/sites/{siteId}/ai/response":
7773
+ post:
7774
+ operationId: streamAIResponseInSite
7775
+ summary: Generate an AI response in a site
7776
+ description: |
7777
+ Experimental operation to generate an AI response in a site.
7778
+ tags:
7779
+ - sites
7780
+ x-internal: true
7781
+ security:
7782
+ - user: []
7783
+ parameters:
7784
+ - $ref: "#/components/parameters/organizationId"
7785
+ - $ref: "#/components/parameters/siteId"
7786
+ requestBody:
7787
+ required: true
7788
+ content:
7789
+ application/json:
7790
+ schema:
7791
+ type: object
7792
+ required:
7793
+ - input
7794
+ - output
7795
+ properties:
7796
+ previousResponseId:
7797
+ type: string
7798
+ description: The ID of the previous response to continue from
7799
+ input:
7800
+ type: array
7801
+ items:
7802
+ $ref: "#/components/schemas/AIMessageInput"
7803
+ output:
7804
+ $ref: "#/components/schemas/AIOutputFormat"
7805
+ model:
7806
+ $ref: "#/components/schemas/AIModel"
7807
+ responses:
7808
+ "200":
7809
+ description: OK
7810
+ content:
7811
+ text/event-stream:
7812
+ schema:
7813
+ $ref: "#/components/schemas/AIStreamResponse"
7814
+ default:
7815
+ $ref: "#/components/responses/UnexpectedError"
7770
7816
  "/orgs/{organizationId}/sites/{siteId}/insights/events":
7771
7817
  post:
7772
7818
  operationId: trackEventsInSiteById
@@ -17869,6 +17915,32 @@ components:
17869
17915
  required:
17870
17916
  - title
17871
17917
  - links
17918
+ CustomizationAnnouncement:
17919
+ type: object
17920
+ properties:
17921
+ enabled:
17922
+ description: Whether to show the site's announcement.
17923
+ type: boolean
17924
+ message:
17925
+ description: The text content of the announcement.
17926
+ type: string
17927
+ minLength: 2
17928
+ maxLength: 128
17929
+ link:
17930
+ description: The content or URL the announcement links to when clicked.
17931
+ $ref: "#/components/schemas/CustomizationContentLink"
17932
+ style:
17933
+ description: The style of the announcement. Used to style the banner with the right semantic color and enable/disable features like hiding the banner.
17934
+ type: string
17935
+ enum:
17936
+ - info
17937
+ - warning
17938
+ - danger
17939
+ - success
17940
+ required:
17941
+ - enabled
17942
+ - message
17943
+ - style
17872
17944
  CustomizationThemeMode:
17873
17945
  type: string
17874
17946
  enum:
@@ -17994,6 +18066,8 @@ components:
17994
18066
  maxLength: 300
17995
18067
  required:
17996
18068
  - groups
18069
+ announcement:
18070
+ $ref: "#/components/schemas/CustomizationAnnouncement"
17997
18071
  themes:
17998
18072
  description: |
17999
18073
  Customization options for the dark/light theme modes.
@@ -18354,6 +18428,200 @@ components:
18354
18428
  - permission
18355
18429
  - user
18356
18430
  - origin
18431
+ AIMessageRole:
18432
+ type: string
18433
+ enum:
18434
+ - user
18435
+ - developer
18436
+ AIMessageAttachmentKnowledge:
18437
+ type: object
18438
+ description: Attachment to extract knowledge matching a given query.
18439
+ properties:
18440
+ type:
18441
+ type: string
18442
+ enum:
18443
+ - knowledge
18444
+ query:
18445
+ type: string
18446
+ description: The query to use to extract the knowledge.
18447
+ required:
18448
+ - type
18449
+ - query
18450
+ AIMessageAttachmentVisitorProfile:
18451
+ type: object
18452
+ description: Attachment representing the profile of the visitor
18453
+ properties:
18454
+ type:
18455
+ type: string
18456
+ enum:
18457
+ - visitor_profile
18458
+ required:
18459
+ - type
18460
+ AIMessageAttachmentPage:
18461
+ type: object
18462
+ description: Attachment to extract and pass the content of a page to the AI
18463
+ properties:
18464
+ type:
18465
+ type: string
18466
+ enum:
18467
+ - page
18468
+ spaceId:
18469
+ type: string
18470
+ description: The ID of the space to extract the content from
18471
+ revisionId:
18472
+ type: string
18473
+ description: The ID of the revision to extract the content from
18474
+ pageId:
18475
+ type: string
18476
+ description: The ID of the page to extract the content from
18477
+ required:
18478
+ - type
18479
+ - spaceId
18480
+ - revisionId
18481
+ - pageId
18482
+ AIMessageAttachmentPages:
18483
+ type: object
18484
+ description: Attachment to pass the tree of pages to the AI
18485
+ properties:
18486
+ type:
18487
+ type: string
18488
+ enum:
18489
+ - pages
18490
+ spaceId:
18491
+ type: string
18492
+ description: The ID of the space to extract the content from
18493
+ revisionId:
18494
+ type: string
18495
+ description: The ID of the revision to extract the content from
18496
+ required:
18497
+ - type
18498
+ - spaceId
18499
+ - revisionId
18500
+ AIMessageAttachment:
18501
+ oneOf:
18502
+ - $ref: "#/components/schemas/AIMessageAttachmentKnowledge"
18503
+ - $ref: "#/components/schemas/AIMessageAttachmentVisitorProfile"
18504
+ - $ref: "#/components/schemas/AIMessageAttachmentPage"
18505
+ - $ref: "#/components/schemas/AIMessageAttachmentPages"
18506
+ AIMessageInput:
18507
+ type: object
18508
+ properties:
18509
+ role:
18510
+ $ref: "#/components/schemas/AIMessageRole"
18511
+ content:
18512
+ type: string
18513
+ maxLength: 2048
18514
+ attachments:
18515
+ type: array
18516
+ items:
18517
+ $ref: "#/components/schemas/AIMessageAttachment"
18518
+ required:
18519
+ - role
18520
+ - content
18521
+ AIOutputFormatObject:
18522
+ type: object
18523
+ description: |
18524
+ Indicate that the AI should response with a JSON object corresponding to the provided schema.
18525
+ properties:
18526
+ type:
18527
+ type: string
18528
+ enum:
18529
+ - object
18530
+ schema:
18531
+ type: object
18532
+ description: The JSON schema to use for the object.
18533
+ properties:
18534
+ type:
18535
+ type: string
18536
+ enum:
18537
+ - object
18538
+ properties: {}
18539
+ required:
18540
+ type: array
18541
+ items:
18542
+ type: string
18543
+ required:
18544
+ - type
18545
+ - schema
18546
+ AIOutputFormatDocument:
18547
+ type: object
18548
+ description: |
18549
+ Indicate that the AI should respond with a rich text document.
18550
+ properties:
18551
+ type:
18552
+ type: string
18553
+ enum:
18554
+ - document
18555
+ required:
18556
+ - type
18557
+ AIOutputFormat:
18558
+ oneOf:
18559
+ - $ref: "#/components/schemas/AIOutputFormatObject"
18560
+ - $ref: "#/components/schemas/AIOutputFormatDocument"
18561
+ AIModel:
18562
+ type: string
18563
+ enum:
18564
+ - fast
18565
+ - reasoning-low
18566
+ - reasoning-medium
18567
+ - reasoning-high
18568
+ AIStreamResponseFinish:
18569
+ type: object
18570
+ description: |
18571
+ Message emitted by the server to indicate the end of the AI response. It contains the ID of the response to be referenced for followup requests.
18572
+ properties:
18573
+ type:
18574
+ type: string
18575
+ enum:
18576
+ - response_finish
18577
+ responseId:
18578
+ type: string
18579
+ description: The ID of the response
18580
+ required:
18581
+ - type
18582
+ - responseId
18583
+ AIStreamResponseDocument:
18584
+ type: object
18585
+ description: |
18586
+ Message emitted by the server to indicate the latest block of the document. The block can either be a new block or an update to the previous block.
18587
+ properties:
18588
+ type:
18589
+ type: string
18590
+ enum:
18591
+ - response_document
18592
+ operation:
18593
+ type: string
18594
+ enum:
18595
+ - insert
18596
+ - update
18597
+ blocks:
18598
+ type: array
18599
+ items:
18600
+ $ref: "#/components/schemas/DocumentBlock"
18601
+ required:
18602
+ - type
18603
+ - operation
18604
+ - blocks
18605
+ AIStreamResponseObject:
18606
+ type: object
18607
+ description: |
18608
+ Message emitted by the server to indicate a chunk of the JSON object response.
18609
+ properties:
18610
+ type:
18611
+ type: string
18612
+ enum:
18613
+ - response_object
18614
+ jsonChunk:
18615
+ type: string
18616
+ description: The chunk of the JSON object response
18617
+ required:
18618
+ - type
18619
+ - jsonChunk
18620
+ AIStreamResponse:
18621
+ oneOf:
18622
+ - $ref: "#/components/schemas/AIStreamResponseFinish"
18623
+ - $ref: "#/components/schemas/AIStreamResponseDocument"
18624
+ - $ref: "#/components/schemas/AIStreamResponseObject"
18357
18625
  SiteInsightsEventSession:
18358
18626
  type: object
18359
18627
  description: Analytics info on the GitBook's site session.
@@ -18397,9 +18665,13 @@ components:
18397
18665
  visitorAuthToken:
18398
18666
  type: string
18399
18667
  nullable: true
18668
+ deprecated: true
18669
+ description: Deprecated, use visitorAuthClaims instead.
18670
+ visitorAuthClaims:
18400
18671
  description: |
18401
- Authentication token of the visitor.
18672
+ Claims of the visitor.
18402
18673
  This is used to identify the visitor with adaptive content.
18674
+ $ref: "#/components/schemas/PlainObject"
18403
18675
  required:
18404
18676
  - visitorId
18405
18677
  - sessionId