@gitbook/api 0.161.0 → 0.162.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
@@ -1710,12 +1710,18 @@ export type RevisionReusableContent = {
1710
1710
  document?: string;
1711
1711
  });
1712
1712
  /** A reusable tag that different types of content can be associated to (e.g. pages, update entries) */
1713
- export interface RevisionTag {
1713
+ export type RevisionTag = {
1714
1714
  /** The slug identifier for the tag, immutable after creation. */
1715
1715
  slug: string;
1716
1716
  /** Display label for the tag. Can be renamed and differ from the slug. */
1717
1717
  label: string;
1718
- }
1718
+ } & ({
1719
+ /** Unicode codepoint or character of the emoji */
1720
+ emoji: Emoji;
1721
+ } | {
1722
+ /** Name of the icon */
1723
+ icon?: Icon;
1724
+ });
1719
1725
  export interface GitSyncCommit {
1720
1726
  /** SHA for the commit */
1721
1727
  oid: string;
@@ -1855,6 +1861,7 @@ export interface ApplySpaceTemplate {
1855
1861
  * Name of the organization
1856
1862
  * @minLength 2
1857
1863
  * @maxLength 255
1864
+ * @pattern \S.*\S
1858
1865
  */
1859
1866
  export type OrganizationTitle = string;
1860
1867
  export type OrganizationEmailDomains = string[];
@@ -5930,230 +5937,126 @@ export interface ContextTopic {
5930
5937
  location: string;
5931
5938
  };
5932
5939
  }
5933
- export type SiteSpaceCustomizationSettings = SiteCustomizationSettings & {
5934
- /** Indicates whether the site customization settings have been overridden. */
5935
- hasOverrides: boolean;
5936
- };
5937
- export interface SiteSectionGroupPointer {
5938
- type: 'site-section' | 'site-section-group';
5939
- /** Unique identifier for the site section */
5940
+ /** Aggregated feedback for answers linked to a site question. */
5941
+ export interface SiteQuestionStatsFeedback {
5942
+ /** Count of answers with positive feedback. */
5943
+ positive: number;
5944
+ /** Count of answers with negative feedback. */
5945
+ negative: number;
5946
+ /** Count of answers without feedback. */
5947
+ unrated: number;
5948
+ }
5949
+ /** Aggregated answered assessment for answers linked to a site question. */
5950
+ export interface SiteQuestionStatsAnswered {
5951
+ /** Count of answers assessed as fully answered. */
5952
+ yes: number;
5953
+ /** Count of answers assessed as partially answered. */
5954
+ partially: number;
5955
+ /** Count of answers assessed as not answered. */
5956
+ no: number;
5957
+ }
5958
+ /** Aggregated stats for answers linked to a site question. */
5959
+ export interface SiteQuestionStats {
5960
+ /** Total count of answers linked to the question. */
5961
+ answers: number;
5962
+ /** Aggregated feedback for answers linked to a site question. */
5963
+ feedback: SiteQuestionStatsFeedback;
5964
+ /** Aggregated answered assessment for answers linked to a site question. */
5965
+ answered: SiteQuestionStatsAnswered;
5966
+ }
5967
+ export interface SiteQuestion {
5968
+ object: 'site-question';
5969
+ /** The ID of the site question. */
5940
5970
  id: string;
5941
- }
5942
- /** Position at which to move the site section group. */
5943
- export interface SiteSectionGroupMovePosition {
5944
- before?: SiteSectionGroupPointer;
5945
- after?: SiteSectionGroupPointer;
5946
- }
5947
- export interface SiteSectionPointer {
5948
- type: 'site-section';
5949
- /** Unique identifier for the site section */
5950
- siteSection: string;
5951
- }
5952
- /** Position at which to move the site section to. */
5953
- export interface SiteSectionMovePosition {
5954
- before?: SiteSectionPointer;
5955
- after?: SiteSectionPointer;
5956
- }
5957
- export interface SiteSpacePointer {
5958
- type: 'site-space';
5959
- /** Unique identifier for the site space */
5960
- siteSpace: string;
5961
- }
5962
- /** Position at which to move the site space to. */
5963
- export interface SiteSpaceMovePosition {
5964
- before?: SiteSpacePointer;
5965
- after?: SiteSpacePointer;
5966
- }
5967
- export type InviteSiteUsersAndTeams = ({
5968
- /** @minItems 1 */
5969
- teams: string[];
5970
- } | {
5971
- /** @minItems 1 */
5972
- users: string[];
5973
- }) & {
5974
- /** Role to set. */
5975
- role: MemberRole;
5976
- };
5977
- export interface OrganizationPointer {
5978
- type: 'organization';
5979
- /** Unique identifier for the organization */
5980
- organization: string;
5981
- }
5982
- /** Permission of a user in a site. */
5983
- export interface UserSitePermission {
5984
- /** The role of a member in an organization, null for guests */
5985
- permission: MemberRoleOrGuest;
5986
- user: User;
5987
- /** The content or organization that enforced this permission level. */
5988
- origin: SpacePointer | OrganizationPointer;
5989
- }
5990
- /** Permission override of a user in a site. */
5991
- export interface UserSitePermissionOverride {
5992
- /**
5993
- * "The role of a member in an organization.
5994
- * "admin": Can administrate the content: create, delete spaces, ...
5995
- * "create": Can create content.
5996
- * "review": Can review content.
5997
- * "edit": Can edit the content (live or change requests).
5998
- * "comment": Can access the content and its discussions.
5999
- * "read": Can access the content, but cannot update it in any way.
6000
- */
6001
- permission: MemberRole;
6002
- user: User;
6003
- }
6004
- /** Permission override of a team in a site. */
6005
- export interface TeamSitePermissionOverride {
6006
- /**
6007
- * "The role of a member in an organization.
6008
- * "admin": Can administrate the content: create, delete spaces, ...
6009
- * "create": Can create content.
6010
- * "review": Can review content.
6011
- * "edit": Can edit the content (live or change requests).
6012
- * "comment": Can access the content and its discussions.
6013
- * "read": Can access the content, but cannot update it in any way.
6014
- */
6015
- permission: MemberRole;
6016
- team: OrganizationTeam;
6017
- }
6018
- /** Context about the current user sending a message. */
6019
- export interface AIMessageContext {
6020
- location?: {
6021
- /** ID of the current space. */
6022
- spaceId: string;
6023
- /** ID of the current page. */
6024
- pageId: string;
5971
+ /** Canonical text for the unique site question. */
5972
+ question: string;
5973
+ createdAt: Timestamp;
5974
+ /** Aggregated stats for answers linked to a site question. */
5975
+ stats: SiteQuestionStats;
5976
+ /** URLs associated with the site question. */
5977
+ urls: {
5978
+ /**
5979
+ * URL of the site question in the API.
5980
+ * @format uri
5981
+ */
5982
+ location: string;
6025
5983
  };
6026
5984
  }
6027
- export interface AIAttachmentImage {
6028
- type: 'image';
6029
- url: URL;
5985
+ /** Whether the response answered the question. */
5986
+ export declare enum SiteQuestionAnswerResolution {
5987
+ No = "no",
5988
+ Partially = "partially",
5989
+ Yes = "yes"
6030
5990
  }
6031
- export interface AIAttachmentFile {
6032
- type: 'file';
6033
- url: URL;
6034
- /** Name of the file. */
6035
- filename: string;
6036
- contentType: 'application/pdf';
5991
+ /** Confidence in whether the response answered the question. */
5992
+ export declare enum SiteQuestionAnswerConfidence {
5993
+ Low = "low",
5994
+ Medium = "medium",
5995
+ High = "high"
6037
5996
  }
6038
- export type AIAttachment = AIAttachmentImage | AIAttachmentFile;
6039
- /** Input version of an AI message. */
6040
- export interface AIMessageInput {
6041
- role: 'user';
6042
- content: string | JSONDocument;
6043
- /** Context about the current user sending a message. */
6044
- context?: AIMessageContext;
6045
- attachments?: AIAttachment[];
5997
+ /** Relevance classification of the user question. */
5998
+ export declare enum SiteQuestionAnswerRelevance {
5999
+ Relevant = "relevant",
6000
+ Spam = "spam",
6001
+ OffTopic = "off-topic",
6002
+ Unclear = "unclear"
6046
6003
  }
6047
- export declare enum AIModel {
6048
- Fast = "fast",
6049
- ReasoningLow = "reasoning-low",
6050
- ReasoningMedium = "reasoning-medium",
6051
- ReasoningHigh = "reasoning-high"
6004
+ /** Identifiers for a GitBook site session, used for analytics and adaptive content. */
6005
+ export interface SiteInsightsSession {
6006
+ /** GitBook's unique identifier of the visitor. */
6007
+ visitorId: string;
6008
+ /** GitBook's unique identifier of the visitor's session. */
6009
+ sessionId: string;
6052
6010
  }
6053
- /** Description of a tool that can be called from an AI agent. */
6054
- export interface AIToolDefinition {
6055
- /** The name of the tool. It should be unique within the agent. */
6056
- name: string;
6057
- /** The description of the tool, passed to the AI agent. */
6058
- description: string;
6059
- /** JSON schema describing the input of the tool. */
6060
- inputSchema?: {
6061
- type: 'object';
6062
- properties: Record<string, {
6063
- type: 'string' | 'number' | 'boolean' | 'array' | 'object';
6064
- /** Description of the property. */
6065
- description: string;
6066
- [key: string]: any;
6067
- }>;
6011
+ export interface SiteQuestionAnswer {
6012
+ object: 'site-question-answer';
6013
+ /** The ID of the site question answer. */
6014
+ id: string;
6015
+ /** The ID of the parent site question. */
6016
+ question: string;
6017
+ input: {
6018
+ /** Normalized question text for this answer. */
6019
+ text?: string;
6020
+ /** Raw question text as asked by the user. */
6021
+ raw?: string;
6022
+ };
6023
+ thread?: {
6024
+ /** The ID of the thread this answer belongs to. */
6025
+ id: string;
6026
+ /** ID of the previous answer in the same thread. */
6027
+ previous: string;
6028
+ };
6029
+ /** Identifiers for a GitBook site session, used for analytics and adaptive content. */
6030
+ session?: SiteInsightsSession;
6031
+ feedback?: {
6032
+ /** Feedback rating provided by the user. */
6033
+ rating: -1 | 1;
6034
+ };
6035
+ /** The response identifier for this answer. */
6036
+ responseId: string;
6037
+ /** ISO language code of the question. */
6038
+ language: string;
6039
+ /** Whether the response answered the question. */
6040
+ answered: SiteQuestionAnswerResolution;
6041
+ /** Confidence in whether the response answered the question. */
6042
+ confidence: SiteQuestionAnswerConfidence;
6043
+ /** Relevance classification of the user question. */
6044
+ relevance: SiteQuestionAnswerRelevance;
6045
+ createdAt: Timestamp;
6046
+ updatedAt?: Timestamp;
6047
+ /** URLs associated with the site question answer. */
6048
+ urls: {
6049
+ /**
6050
+ * URL of the site question answer in the API.
6051
+ * @format uri
6052
+ */
6053
+ location: string;
6068
6054
  };
6069
6055
  }
6070
- /** Summary of a generic tool call. */
6071
- export interface AIToolCallOtherSummary {
6072
- /** Name of the icon */
6073
- icon: Icon;
6074
- /** Text to display to the user to describe the tool call. */
6075
- text: string;
6076
- }
6077
- /** Result of a tool call. */
6078
- export interface AIToolCallResult {
6079
- /** The name of the tool that was called. */
6080
- tool: string;
6081
- /** The ID of the tool call. */
6082
- toolCallId: string;
6083
- /** The output to the tool call. */
6084
- output: object;
6085
- /** Summary of a generic tool call. */
6086
- summary?: AIToolCallOtherSummary;
6087
- }
6088
- /** When the agent is responding to a comment. */
6089
- export type AIMessageTask = {
6090
- type: 'respond_to_comment';
6091
- /** The ID of the space to respond to the comment in. */
6092
- spaceId: string;
6093
- /** The ID of the change request to respond to the comment in. */
6094
- changeRequestId?: string;
6095
- /** The ID of the comment to respond to. */
6096
- commentId: string;
6097
- } | {
6098
- type: 'review_change_request';
6099
- /** The ID of the space the change request is in. */
6100
- spaceId: string;
6101
- /** The ID of the change request to review. */
6102
- changeRequestId: string;
6103
- } | {
6104
- type: 'implement_change_request';
6105
- /** The ID of the space the change request is in. */
6106
- spaceId: string;
6107
- /** The ID of the change request to implement the task in. */
6108
- changeRequestId: string;
6109
- };
6110
- /** Message emitted by the server to indicate the start of the AI response. */
6111
- export interface AIStreamResponseStart {
6112
- type: 'response_start';
6113
- /** The ID of the message that this event is composing. */
6114
- messageId: string;
6115
- /** When the agent is responding to a comment. */
6116
- task?: AIMessageTask;
6117
- }
6118
- /** The response that generated this message. */
6119
- export interface AIMessageResponseMetadata {
6120
- /** The reason the response was stopped. If not defined, the response finished normally. */
6121
- stopReason?: 'aborted';
6122
- /** The ID of the response that generated this message. It can be undefined if the stream was aborted. */
6123
- id?: string;
6124
- /** The ID of the previous response that this message is based on. */
6125
- previous?: string;
6126
- }
6127
- /** 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. */
6128
- export interface AIStreamResponseFinish {
6129
- type: 'response_finish';
6130
- /** The ID of the message that this event is composing. */
6131
- messageId: string;
6132
- /**
6133
- * The ID of the response
6134
- * @deprecated
6135
- */
6136
- responseId?: string;
6137
- /** The response metadata associated with the message. */
6138
- response: AIMessageResponseMetadata;
6139
- }
6140
- /** 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. */
6141
- export interface AIStreamResponseDocument {
6142
- type: 'response_document' | 'response_reasoning';
6143
- /** The ID of the message that this event is composing. */
6144
- messageId: string;
6145
- /** The index of the step of the message that this event is composing. */
6146
- stepIndex: number;
6147
- operation: 'insert' | 'update';
6148
- blocks: DocumentBlocksTopLevels[];
6149
- }
6150
- /** Message emitted by the server to indicate a chunk of the JSON object response. */
6151
- export interface AIStreamResponseObject {
6152
- type: 'response_object';
6153
- /** The ID of the message that this event is composing. */
6154
- messageId: string;
6155
- /** The chunk of the JSON object response */
6156
- jsonChunk: string;
6056
+ export declare enum AIMessageRole {
6057
+ User = "user",
6058
+ Assistant = "assistant",
6059
+ Developer = "developer"
6157
6060
  }
6158
6061
  export interface AIToolCallGetPageContent {
6159
6062
  tool: 'getPageContent';
@@ -6276,90 +6179,375 @@ export interface AIToolCallGetPageDiff {
6276
6179
  spaceId: string;
6277
6180
  page: ChangedRevisionPage;
6278
6181
  }
6279
- export interface AIToolCallCreateReusableContent {
6280
- tool: 'createReusableContent';
6281
- /** The ID of the space being edited. */
6282
- spaceId: string;
6283
- reusableContent: ChangedRevisionReusableContent;
6182
+ export interface AIToolCallCreateReusableContent {
6183
+ tool: 'createReusableContent';
6184
+ /** The ID of the space being edited. */
6185
+ spaceId: string;
6186
+ reusableContent: ChangedRevisionReusableContent;
6187
+ }
6188
+ export interface AIToolCallEditReusableContent {
6189
+ tool: 'editReusableContent';
6190
+ /** The ID of the space being edited. */
6191
+ spaceId: string;
6192
+ reusableContent: ChangedRevisionReusableContent;
6193
+ }
6194
+ export interface AIToolCallGetReusableContent {
6195
+ tool: 'getReusableContent';
6196
+ /** The ID of the space being accessed. */
6197
+ spaceId: string;
6198
+ /** The ID of the revision within which the reusable content is being fetched. */
6199
+ revisionId: string;
6200
+ reusableContent: ChangedRevisionReusableContent;
6201
+ }
6202
+ export interface AIToolCallCreateChangeRequest {
6203
+ tool: 'createChangeRequest';
6204
+ /** The ID of the space the change request belongs to. */
6205
+ spaceId: string;
6206
+ action: 'create' | 'update';
6207
+ changeRequest: {
6208
+ /** The unique identifier of the change request. */
6209
+ id: string;
6210
+ /** Incremental identifier of the change request. */
6211
+ number: number;
6212
+ /** A brief summary of the change request. */
6213
+ subject: string;
6214
+ };
6215
+ }
6216
+ export interface AIToolCallComment {
6217
+ tool: 'comment';
6218
+ /** The ID of the space being commented. */
6219
+ spaceId: string;
6220
+ /** The page being commented. */
6221
+ page?: ChangedRevisionPage;
6222
+ /** The ID of the comment being posted. */
6223
+ commentId: string;
6224
+ }
6225
+ export interface AIToolCallReplyToComment {
6226
+ tool: 'replyToComment';
6227
+ /** The ID of the space being commented. */
6228
+ spaceId: string;
6229
+ /** The page being commented. */
6230
+ page?: ChangedRevisionPage;
6231
+ /** The ID of the comment being replied to. */
6232
+ commentId: string;
6233
+ /** The ID of the reply being posted. */
6234
+ replyId: string;
6235
+ }
6236
+ export interface AIToolCallSubmitChangeRequestReview {
6237
+ tool: 'submitChangeRequestReview';
6238
+ /** The ID of the space where the review was submitted. */
6239
+ spaceId: string;
6240
+ /** The ID of the change request being reviewed. */
6241
+ changeRequestId: string;
6242
+ /** Result of the review. */
6243
+ status: ChangeRequestReviewStatus;
6244
+ /** Identifier of the review that was created. */
6245
+ reviewId: string;
6246
+ /** Identifier of the comment that was created as part of the review. */
6247
+ commentId: string;
6248
+ }
6249
+ /** Tool called from an MCP server */
6250
+ export interface AIToolCallMCP {
6251
+ tool: 'mcp';
6252
+ /** The ID of the MCP server that has been called. */
6253
+ mcpServerId: string;
6254
+ /** The name of the tool that has been called. */
6255
+ mcpToolName: string;
6256
+ /** The title of the tool that has been called. */
6257
+ mcpToolTitle?: string;
6258
+ }
6259
+ /** Summary of a generic tool call. */
6260
+ export interface AIToolCallOtherSummary {
6261
+ /** Name of the icon */
6262
+ icon: Icon;
6263
+ /** Text to display to the user to describe the tool call. */
6264
+ text: string;
6265
+ }
6266
+ /** Any tool call that is unknown by GitBook */
6267
+ export interface AIToolCallOther {
6268
+ tool: 'other';
6269
+ /** Summary of a generic tool call. */
6270
+ summary: AIToolCallOtherSummary;
6271
+ }
6272
+ export type AIToolCall = AIToolCallGetPageContent | AIToolCallGetPages | AIToolCallGetReusableContents | AIToolCallSearch | AIToolCallEditPage | AIToolCallCreatePage | AIToolCallDeletePage | AIToolCallRenamePage | AIToolCallMovePage | AIToolCallListModifiedPages | AIToolCallGetPageDiff | AIToolCallCreateReusableContent | AIToolCallEditReusableContent | AIToolCallGetReusableContent | AIToolCallCreateChangeRequest | AIToolCallComment | AIToolCallReplyToComment | AIToolCallSubmitChangeRequestReview | AIToolCallMCP | AIToolCallOther;
6273
+ export interface Timerange {
6274
+ start: Timestamp;
6275
+ end: Timestamp;
6276
+ }
6277
+ export interface AIAttachmentImage {
6278
+ type: 'image';
6279
+ url: URL;
6280
+ }
6281
+ export interface AIAttachmentFile {
6282
+ type: 'file';
6283
+ url: URL;
6284
+ /** Name of the file. */
6285
+ filename: string;
6286
+ contentType: 'application/pdf';
6287
+ }
6288
+ export type AIAttachment = AIAttachmentImage | AIAttachmentFile;
6289
+ /** A step in a message from the AI agent. */
6290
+ export interface AIMessageStep {
6291
+ content: JSONDocument;
6292
+ reasoning?: JSONDocument;
6293
+ toolCalls?: AIToolCall[];
6294
+ /** The timing of the step. */
6295
+ timing?: {
6296
+ reasoning?: Timerange;
6297
+ };
6298
+ attachments?: AIAttachment[];
6299
+ }
6300
+ /** When the agent is responding to a comment. */
6301
+ export type AIMessageTask = {
6302
+ type: 'respond_to_comment';
6303
+ /** The ID of the space to respond to the comment in. */
6304
+ spaceId: string;
6305
+ /** The ID of the change request to respond to the comment in. */
6306
+ changeRequestId?: string;
6307
+ /** The ID of the comment to respond to. */
6308
+ commentId: string;
6309
+ } | {
6310
+ type: 'review_change_request';
6311
+ /** The ID of the space the change request is in. */
6312
+ spaceId: string;
6313
+ /** The ID of the change request to review. */
6314
+ changeRequestId: string;
6315
+ } | {
6316
+ type: 'implement_change_request';
6317
+ /** The ID of the space the change request is in. */
6318
+ spaceId: string;
6319
+ /** The ID of the change request to implement the task in. */
6320
+ changeRequestId: string;
6321
+ };
6322
+ /** The response that generated this message. */
6323
+ export interface AIMessageResponseMetadata {
6324
+ /** The reason the response was stopped. If not defined, the response finished normally. */
6325
+ stopReason?: 'aborted';
6326
+ /** The ID of the response that generated this message. It can be undefined if the stream was aborted. */
6327
+ id?: string;
6328
+ /** The ID of the previous response that this message is based on. */
6329
+ previous?: string;
6330
+ }
6331
+ export interface AIMessage {
6332
+ id: string;
6333
+ role: AIMessageRole;
6334
+ steps: AIMessageStep[];
6335
+ /** When the agent is responding to a comment. */
6336
+ task?: AIMessageTask;
6337
+ /** The response that generated this message. */
6338
+ response?: AIMessageResponseMetadata;
6339
+ }
6340
+ export type SiteQuestionAnswerWithResponse = SiteQuestionAnswer & {
6341
+ response: AIMessage;
6342
+ };
6343
+ export interface SiteQuestionAnswerSourceBase {
6344
+ object: 'site-question-answer-source';
6345
+ /** The ID of the source. */
6346
+ id: string;
6347
+ /** Relative weight of this source in the generated answer. */
6348
+ weight: number;
6349
+ /** The title of the source. */
6350
+ title: string;
6351
+ /** URLs associated with the site question answer. */
6352
+ urls: {
6353
+ /**
6354
+ * URL of the site question answer in the API.
6355
+ * @format uri
6356
+ */
6357
+ location: string;
6358
+ };
6359
+ }
6360
+ /** Source data pointing to a page used for a site question answer. */
6361
+ export type SiteQuestionAnswerSourcePage = SiteQuestionAnswerSourceBase & {
6362
+ type: 'page';
6363
+ /** The space ID of the source page. */
6364
+ space: string;
6365
+ /** The revision ID used for this source page. */
6366
+ revision: string;
6367
+ /** The page ID of the source page. */
6368
+ page: string;
6369
+ };
6370
+ export type SiteQuestionAnswerSourceRecord = SiteQuestionAnswerSourceBase & {
6371
+ type: 'record';
6372
+ /** The site context record ID. */
6373
+ record: string;
6374
+ };
6375
+ export type SiteQuestionAnswerSource = SiteQuestionAnswerSourcePage | SiteQuestionAnswerSourceRecord;
6376
+ export type SiteSpaceCustomizationSettings = SiteCustomizationSettings & {
6377
+ /** Indicates whether the site customization settings have been overridden. */
6378
+ hasOverrides: boolean;
6379
+ };
6380
+ export interface SiteSectionGroupPointer {
6381
+ type: 'site-section' | 'site-section-group';
6382
+ /** Unique identifier for the site section */
6383
+ id: string;
6384
+ }
6385
+ /** Position at which to move the site section group. */
6386
+ export interface SiteSectionGroupMovePosition {
6387
+ before?: SiteSectionGroupPointer;
6388
+ after?: SiteSectionGroupPointer;
6389
+ }
6390
+ export interface SiteSectionPointer {
6391
+ type: 'site-section';
6392
+ /** Unique identifier for the site section */
6393
+ siteSection: string;
6394
+ }
6395
+ /** Position at which to move the site section to. */
6396
+ export interface SiteSectionMovePosition {
6397
+ before?: SiteSectionPointer;
6398
+ after?: SiteSectionPointer;
6399
+ }
6400
+ export interface SiteSpacePointer {
6401
+ type: 'site-space';
6402
+ /** Unique identifier for the site space */
6403
+ siteSpace: string;
6404
+ }
6405
+ /** Position at which to move the site space to. */
6406
+ export interface SiteSpaceMovePosition {
6407
+ before?: SiteSpacePointer;
6408
+ after?: SiteSpacePointer;
6409
+ }
6410
+ export type InviteSiteUsersAndTeams = ({
6411
+ /** @minItems 1 */
6412
+ teams: string[];
6413
+ } | {
6414
+ /** @minItems 1 */
6415
+ users: string[];
6416
+ }) & {
6417
+ /** Role to set. */
6418
+ role: MemberRole;
6419
+ };
6420
+ export interface OrganizationPointer {
6421
+ type: 'organization';
6422
+ /** Unique identifier for the organization */
6423
+ organization: string;
6424
+ }
6425
+ /** Permission of a user in a site. */
6426
+ export interface UserSitePermission {
6427
+ /** The role of a member in an organization, null for guests */
6428
+ permission: MemberRoleOrGuest;
6429
+ user: User;
6430
+ /** The content or organization that enforced this permission level. */
6431
+ origin: SpacePointer | OrganizationPointer;
6432
+ }
6433
+ /** Permission override of a user in a site. */
6434
+ export interface UserSitePermissionOverride {
6435
+ /**
6436
+ * "The role of a member in an organization.
6437
+ * "admin": Can administrate the content: create, delete spaces, ...
6438
+ * "create": Can create content.
6439
+ * "review": Can review content.
6440
+ * "edit": Can edit the content (live or change requests).
6441
+ * "comment": Can access the content and its discussions.
6442
+ * "read": Can access the content, but cannot update it in any way.
6443
+ */
6444
+ permission: MemberRole;
6445
+ user: User;
6446
+ }
6447
+ /** Permission override of a team in a site. */
6448
+ export interface TeamSitePermissionOverride {
6449
+ /**
6450
+ * "The role of a member in an organization.
6451
+ * "admin": Can administrate the content: create, delete spaces, ...
6452
+ * "create": Can create content.
6453
+ * "review": Can review content.
6454
+ * "edit": Can edit the content (live or change requests).
6455
+ * "comment": Can access the content and its discussions.
6456
+ * "read": Can access the content, but cannot update it in any way.
6457
+ */
6458
+ permission: MemberRole;
6459
+ team: OrganizationTeam;
6460
+ }
6461
+ /** Context about the current user sending a message. */
6462
+ export interface AIMessageContext {
6463
+ location?: {
6464
+ /** ID of the current space. */
6465
+ spaceId: string;
6466
+ /** ID of the current page. */
6467
+ pageId: string;
6468
+ };
6284
6469
  }
6285
- export interface AIToolCallEditReusableContent {
6286
- tool: 'editReusableContent';
6287
- /** The ID of the space being edited. */
6288
- spaceId: string;
6289
- reusableContent: ChangedRevisionReusableContent;
6470
+ /** Input version of an AI message. */
6471
+ export interface AIMessageInput {
6472
+ role: 'user';
6473
+ content: string | JSONDocument;
6474
+ /** Context about the current user sending a message. */
6475
+ context?: AIMessageContext;
6476
+ attachments?: AIAttachment[];
6290
6477
  }
6291
- export interface AIToolCallGetReusableContent {
6292
- tool: 'getReusableContent';
6293
- /** The ID of the space being accessed. */
6294
- spaceId: string;
6295
- /** The ID of the revision within which the reusable content is being fetched. */
6296
- revisionId: string;
6297
- reusableContent: ChangedRevisionReusableContent;
6478
+ export declare enum AIModel {
6479
+ Fast = "fast",
6480
+ ReasoningLow = "reasoning-low",
6481
+ ReasoningMedium = "reasoning-medium",
6482
+ ReasoningHigh = "reasoning-high"
6298
6483
  }
6299
- export interface AIToolCallCreateChangeRequest {
6300
- tool: 'createChangeRequest';
6301
- /** The ID of the space the change request belongs to. */
6302
- spaceId: string;
6303
- action: 'create' | 'update';
6304
- changeRequest: {
6305
- /** The unique identifier of the change request. */
6306
- id: string;
6307
- /** Incremental identifier of the change request. */
6308
- number: number;
6309
- /** A brief summary of the change request. */
6310
- subject: string;
6484
+ /** Description of a tool that can be called from an AI agent. */
6485
+ export interface AIToolDefinition {
6486
+ /** The name of the tool. It should be unique within the agent. */
6487
+ name: string;
6488
+ /** The description of the tool, passed to the AI agent. */
6489
+ description: string;
6490
+ /** JSON schema describing the input of the tool. */
6491
+ inputSchema?: {
6492
+ type: 'object';
6493
+ properties: Record<string, {
6494
+ type: 'string' | 'number' | 'boolean' | 'array' | 'object';
6495
+ /** Description of the property. */
6496
+ description: string;
6497
+ [key: string]: any;
6498
+ }>;
6311
6499
  };
6312
6500
  }
6313
- export interface AIToolCallComment {
6314
- tool: 'comment';
6315
- /** The ID of the space being commented. */
6316
- spaceId: string;
6317
- /** The page being commented. */
6318
- page?: ChangedRevisionPage;
6319
- /** The ID of the comment being posted. */
6320
- commentId: string;
6501
+ /** Result of a tool call. */
6502
+ export interface AIToolCallResult {
6503
+ /** The name of the tool that was called. */
6504
+ tool: string;
6505
+ /** The ID of the tool call. */
6506
+ toolCallId: string;
6507
+ /** The output to the tool call. */
6508
+ output: object;
6509
+ /** Summary of a generic tool call. */
6510
+ summary?: AIToolCallOtherSummary;
6321
6511
  }
6322
- export interface AIToolCallReplyToComment {
6323
- tool: 'replyToComment';
6324
- /** The ID of the space being commented. */
6325
- spaceId: string;
6326
- /** The page being commented. */
6327
- page?: ChangedRevisionPage;
6328
- /** The ID of the comment being replied to. */
6329
- commentId: string;
6330
- /** The ID of the reply being posted. */
6331
- replyId: string;
6512
+ /** Message emitted by the server to indicate the start of the AI response. */
6513
+ export interface AIStreamResponseStart {
6514
+ type: 'response_start';
6515
+ /** The ID of the message that this event is composing. */
6516
+ messageId: string;
6517
+ /** When the agent is responding to a comment. */
6518
+ task?: AIMessageTask;
6332
6519
  }
6333
- export interface AIToolCallSubmitChangeRequestReview {
6334
- tool: 'submitChangeRequestReview';
6335
- /** The ID of the space where the review was submitted. */
6336
- spaceId: string;
6337
- /** The ID of the change request being reviewed. */
6338
- changeRequestId: string;
6339
- /** Result of the review. */
6340
- status: ChangeRequestReviewStatus;
6341
- /** Identifier of the review that was created. */
6342
- reviewId: string;
6343
- /** Identifier of the comment that was created as part of the review. */
6344
- commentId: string;
6520
+ /** 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. */
6521
+ export interface AIStreamResponseFinish {
6522
+ type: 'response_finish';
6523
+ /** The ID of the message that this event is composing. */
6524
+ messageId: string;
6525
+ /**
6526
+ * The ID of the response
6527
+ * @deprecated
6528
+ */
6529
+ responseId?: string;
6530
+ /** The response metadata associated with the message. */
6531
+ response: AIMessageResponseMetadata;
6345
6532
  }
6346
- /** Tool called from an MCP server */
6347
- export interface AIToolCallMCP {
6348
- tool: 'mcp';
6349
- /** The ID of the MCP server that has been called. */
6350
- mcpServerId: string;
6351
- /** The name of the tool that has been called. */
6352
- mcpToolName: string;
6353
- /** The title of the tool that has been called. */
6354
- mcpToolTitle?: string;
6533
+ /** 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. */
6534
+ export interface AIStreamResponseDocument {
6535
+ type: 'response_document' | 'response_reasoning';
6536
+ /** The ID of the message that this event is composing. */
6537
+ messageId: string;
6538
+ /** The index of the step of the message that this event is composing. */
6539
+ stepIndex: number;
6540
+ operation: 'insert' | 'update';
6541
+ blocks: DocumentBlocksTopLevels[];
6355
6542
  }
6356
- /** Any tool call that is unknown by GitBook */
6357
- export interface AIToolCallOther {
6358
- tool: 'other';
6359
- /** Summary of a generic tool call. */
6360
- summary: AIToolCallOtherSummary;
6543
+ /** Message emitted by the server to indicate a chunk of the JSON object response. */
6544
+ export interface AIStreamResponseObject {
6545
+ type: 'response_object';
6546
+ /** The ID of the message that this event is composing. */
6547
+ messageId: string;
6548
+ /** The chunk of the JSON object response */
6549
+ jsonChunk: string;
6361
6550
  }
6362
- export type AIToolCall = AIToolCallGetPageContent | AIToolCallGetPages | AIToolCallGetReusableContents | AIToolCallSearch | AIToolCallEditPage | AIToolCallCreatePage | AIToolCallDeletePage | AIToolCallRenamePage | AIToolCallMovePage | AIToolCallListModifiedPages | AIToolCallGetPageDiff | AIToolCallCreateReusableContent | AIToolCallEditReusableContent | AIToolCallGetReusableContent | AIToolCallCreateChangeRequest | AIToolCallComment | AIToolCallReplyToComment | AIToolCallSubmitChangeRequestReview | AIToolCallMCP | AIToolCallOther;
6363
6551
  /** Message emitted by the server to indicate that the AI has called a tool. */
6364
6552
  export interface AIStreamResponseToolCall {
6365
6553
  type: 'response_tool_call';
@@ -6404,11 +6592,7 @@ export interface AIStreamResponseAttachment {
6404
6592
  }
6405
6593
  export type AIStreamResponse = AIStreamResponseStart | AIStreamResponseFinish | AIStreamResponseDocument | AIStreamResponseObject | AIStreamResponseToolCall | AIStreamResponseToolCallPending | AIStreamResponseFollowupSuggestion | AIStreamResponseAttachment;
6406
6594
  /** Analytics info on the GitBook's site session. */
6407
- export interface SiteInsightsEventSession {
6408
- /** GitBook's unique identifier of the visitor. */
6409
- visitorId: string;
6410
- /** GitBook's unique identifier of the visitor's session. */
6411
- sessionId: string;
6595
+ export type SiteInsightsEventSession = SiteInsightsSession & {
6412
6596
  /** The visitors cookies. */
6413
6597
  cookies: Record<string, string>;
6414
6598
  /**
@@ -6438,7 +6622,7 @@ export interface SiteInsightsEventSession {
6438
6622
  * This is used to identify the visitor with adaptive content.
6439
6623
  */
6440
6624
  visitorAuthClaims?: PlainObject;
6441
- }
6625
+ };
6442
6626
  /** Context in which the event was recorded. */
6443
6627
  export declare enum SiteInsightsDisplayContext {
6444
6628
  Site = "site",
@@ -7236,10 +7420,6 @@ export interface SiteVisitorPayload {
7236
7420
  jwtToken?: string;
7237
7421
  unsignedClaims?: PlainObject;
7238
7422
  }
7239
- export interface Timerange {
7240
- start: Timestamp;
7241
- end: Timestamp;
7242
- }
7243
7423
  /**
7244
7424
  * @minLength 64
7245
7425
  * @maxLength 64
@@ -7978,6 +8158,11 @@ export declare enum SiteAdsStatus {
7978
8158
  Rejected = "rejected",
7979
8159
  Disabled = "disabled"
7980
8160
  }
8161
+ /** Source type used to answer a site question. */
8162
+ export declare enum SiteQuestionAnswerSourceType {
8163
+ Page = "page",
8164
+ Record = "record"
8165
+ }
7981
8166
  export interface Seat {
7982
8167
  object: 'seat';
7983
8168
  /** The unique ID of the organization */
@@ -7989,31 +8174,6 @@ export interface Seat {
7989
8174
  /** @format date-time */
7990
8175
  updatedAt: string;
7991
8176
  }
7992
- export declare enum AIMessageRole {
7993
- User = "user",
7994
- Assistant = "assistant",
7995
- Developer = "developer"
7996
- }
7997
- /** A step in a message from the AI agent. */
7998
- export interface AIMessageStep {
7999
- content: JSONDocument;
8000
- reasoning?: JSONDocument;
8001
- toolCalls?: AIToolCall[];
8002
- /** The timing of the step. */
8003
- timing?: {
8004
- reasoning?: Timerange;
8005
- };
8006
- attachments?: AIAttachment[];
8007
- }
8008
- export interface AIMessage {
8009
- id: string;
8010
- role: AIMessageRole;
8011
- steps: AIMessageStep[];
8012
- /** When the agent is responding to a comment. */
8013
- task?: AIMessageTask;
8014
- /** The response that generated this message. */
8015
- response?: AIMessageResponseMetadata;
8016
- }
8017
8177
  /** Payload emitted by the agent to reset the messages. */
8018
8178
  export interface AgentStreamMessages {
8019
8179
  type: 'messages';
@@ -13522,6 +13682,101 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
13522
13682
  updateSiteContextTopicById: (organizationId: string, siteId: string, siteContextTopicId: string, data: {
13523
13683
  usageSettings: ContextUsageSettings;
13524
13684
  }, params?: RequestParams) => Promise<HttpResponse<ContextTopic, any>>;
13685
+ /**
13686
+ * No description
13687
+ *
13688
+ * @tags site-questions
13689
+ * @name ListSiteQuestions
13690
+ * @summary List all questions in a site
13691
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/questions
13692
+ * @secure
13693
+ */
13694
+ listSiteQuestions: (organizationId: string, siteId: string, query?: {
13695
+ /** Identifier of the page results to fetch. */
13696
+ page?: string;
13697
+ /**
13698
+ * The number of results per page
13699
+ * @min 0
13700
+ * @max 1000
13701
+ */
13702
+ limit?: number;
13703
+ }, params?: RequestParams) => Promise<HttpResponse<List & {
13704
+ items: SiteQuestion[];
13705
+ }, any>>;
13706
+ /**
13707
+ * No description
13708
+ *
13709
+ * @tags site-questions
13710
+ * @name GetSiteQuestionById
13711
+ * @summary Get a site question by ID
13712
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/questions/{siteQuestionId}
13713
+ * @secure
13714
+ */
13715
+ getSiteQuestionById: (organizationId: string, siteId: string, siteQuestionId: string, params?: RequestParams) => Promise<HttpResponse<SiteQuestion, any>>;
13716
+ /**
13717
+ * No description
13718
+ *
13719
+ * @tags site-questions
13720
+ * @name ListSiteQuestionAnswers
13721
+ * @summary List all answers for a site
13722
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/answers
13723
+ * @secure
13724
+ */
13725
+ listSiteQuestionAnswers: (organizationId: string, siteId: string, query?: {
13726
+ /** Filter answers to a specific site question ID. */
13727
+ question?: string;
13728
+ /** Filter answers by ISO language code. */
13729
+ language?: string;
13730
+ /** Filter answers by answered resolution. */
13731
+ answered?: SiteQuestionAnswerResolution;
13732
+ /** Filter answers by answered confidence. */
13733
+ confidence?: SiteQuestionAnswerConfidence;
13734
+ /** Filter answers by question relevance. */
13735
+ relevance?: SiteQuestionAnswerRelevance;
13736
+ /** Filter answers by thread root answer ID. Includes the root answer itself. */
13737
+ thread?: string;
13738
+ /** Identifier of the page results to fetch. */
13739
+ page?: string;
13740
+ /**
13741
+ * The number of results per page
13742
+ * @min 0
13743
+ * @max 1000
13744
+ */
13745
+ limit?: number;
13746
+ }, params?: RequestParams) => Promise<HttpResponse<List & {
13747
+ items: SiteQuestionAnswer[];
13748
+ }, any>>;
13749
+ /**
13750
+ * No description
13751
+ *
13752
+ * @tags site-questions
13753
+ * @name GetSiteQuestionAnswerById
13754
+ * @summary Get a site answer by ID
13755
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/answers/{siteQuestionAnswerId}
13756
+ * @secure
13757
+ */
13758
+ getSiteQuestionAnswerById: (organizationId: string, siteId: string, siteQuestionAnswerId: string, params?: RequestParams) => Promise<HttpResponse<SiteQuestionAnswerWithResponse, any>>;
13759
+ /**
13760
+ * No description
13761
+ *
13762
+ * @tags site-questions
13763
+ * @name ListSiteQuestionAnswerSources
13764
+ * @summary List the sources for an answer
13765
+ * @request GET:/orgs/{organizationId}/sites/{siteId}/answers/{siteQuestionAnswerId}/sources
13766
+ * @secure
13767
+ */
13768
+ listSiteQuestionAnswerSources: (organizationId: string, siteId: string, siteQuestionAnswerId: string, query?: {
13769
+ /** Identifier of the page results to fetch. */
13770
+ page?: string;
13771
+ /**
13772
+ * The number of results per page
13773
+ * @min 0
13774
+ * @max 1000
13775
+ */
13776
+ limit?: number;
13777
+ }, params?: RequestParams) => Promise<HttpResponse<List & {
13778
+ items: SiteQuestionAnswerSource[];
13779
+ }, any>>;
13525
13780
  /**
13526
13781
  * No description
13527
13782
  *
@@ -13980,6 +14235,8 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
13980
14235
  tools?: AIToolDefinition[];
13981
14236
  /** Result of a tool call. */
13982
14237
  toolCall?: AIToolCallResult;
14238
+ /** Identifiers for a GitBook site session, used for analytics and adaptive content. */
14239
+ session?: SiteInsightsSession;
13983
14240
  }, params?: RequestParams) => EventIterator<AIStreamResponse>;
13984
14241
  /**
13985
14242
  * No description