@theia/plugin 1.55.0-next.97 → 1.55.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/plugin",
3
- "version": "1.55.0-next.97+52cad8a35",
3
+ "version": "1.55.1",
4
4
  "description": "Theia - Plugin API",
5
5
  "types": "./src/theia.d.ts",
6
6
  "publishConfig": {
@@ -27,10 +27,10 @@
27
27
  "watch": "theiaext watch"
28
28
  },
29
29
  "devDependencies": {
30
- "@theia/ext-scripts": "1.55.0"
30
+ "@theia/ext-scripts": "1.55.1"
31
31
  },
32
32
  "nyc": {
33
33
  "extends": "../../configs/nyc.json"
34
34
  },
35
- "gitHead": "52cad8a35c3c86231f1b3efc74608bd159840a69"
35
+ "gitHead": "be4713a778be16ba831af63a6fbd43b2301e882d"
36
36
  }
package/src/theia.d.ts CHANGED
@@ -2696,11 +2696,6 @@ export module '@theia/plugin' {
2696
2696
  * Using a theme color is preferred over a custom color as it gives theme authors and users the possibility to change the color.
2697
2697
  */
2698
2698
  export class ThemeColor {
2699
- /**
2700
- * The id of this color.
2701
- */
2702
- readonly id: string;
2703
-
2704
2699
  /**
2705
2700
  * Creates a reference to a theme color.
2706
2701
  */
@@ -17267,7 +17262,6 @@ export module '@theia/plugin' {
17267
17262
 
17268
17263
  /**
17269
17264
  * Represents a user request in chat history.
17270
- * @stubbed
17271
17265
  */
17272
17266
  export class ChatRequestTurn {
17273
17267
  /**
@@ -17295,20 +17289,14 @@ export module '@theia/plugin' {
17295
17289
  */
17296
17290
  readonly references: ChatPromptReference[];
17297
17291
 
17298
- /**
17299
- * The list of tools were attached to this request.
17300
- */
17301
- readonly toolReferences: readonly ChatLanguageModelToolReference[];
17302
-
17303
17292
  /**
17304
17293
  * @hidden
17305
17294
  */
17306
- private constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string, toolReferences: ChatLanguageModelToolReference[]);
17295
+ private constructor(prompt: string, command: string | undefined, references: ChatPromptReference[], participant: string);
17307
17296
  }
17308
17297
 
17309
17298
  /**
17310
17299
  * Represents a chat participant's response in chat history.
17311
- * @stubbed
17312
17300
  */
17313
17301
  export class ChatResponseTurn {
17314
17302
  /**
@@ -17339,7 +17327,6 @@ export module '@theia/plugin' {
17339
17327
 
17340
17328
  /**
17341
17329
  * Extra context passed to a participant.
17342
- * @stubbed
17343
17330
  */
17344
17331
  export interface ChatContext {
17345
17332
  /**
@@ -17350,7 +17337,6 @@ export module '@theia/plugin' {
17350
17337
 
17351
17338
  /**
17352
17339
  * Represents an error result from a chat request.
17353
- * @stubbed
17354
17340
  */
17355
17341
  export interface ChatErrorDetails {
17356
17342
  /**
@@ -17366,7 +17352,6 @@ export module '@theia/plugin' {
17366
17352
 
17367
17353
  /**
17368
17354
  * The result of a chat request.
17369
- * @stubbed
17370
17355
  */
17371
17356
  export interface ChatResult {
17372
17357
  /**
@@ -17397,7 +17382,6 @@ export module '@theia/plugin' {
17397
17382
 
17398
17383
  /**
17399
17384
  * Represents user feedback for a result.
17400
- * @stubbed
17401
17385
  */
17402
17386
  export interface ChatResultFeedback {
17403
17387
  /**
@@ -17414,7 +17398,6 @@ export module '@theia/plugin' {
17414
17398
 
17415
17399
  /**
17416
17400
  * A followup question suggested by the participant.
17417
- * @stubbed
17418
17401
  */
17419
17402
  export interface ChatFollowup {
17420
17403
  /**
@@ -17441,13 +17424,11 @@ export module '@theia/plugin' {
17441
17424
 
17442
17425
  /**
17443
17426
  * Will be invoked once after each request to get suggested followup questions to show the user. The user can click the followup to send it to the chat.
17444
- * @stubbed
17445
17427
  */
17446
17428
  export interface ChatFollowupProvider {
17447
17429
  /**
17448
17430
  * Provide followups for the given result.
17449
17431
  * @param result This object has the same properties as the result returned from the participant callback, including `metadata`, but is not the same instance.
17450
- * @param context Extra context passed to a participant.
17451
17432
  * @param token A cancellation token.
17452
17433
  */
17453
17434
  provideFollowups(result: ChatResult, context: ChatContext, token: CancellationToken): ProviderResult<ChatFollowup[]>;
@@ -17455,14 +17436,12 @@ export module '@theia/plugin' {
17455
17436
 
17456
17437
  /**
17457
17438
  * A chat request handler is a callback that will be invoked when a request is made to a chat participant.
17458
- * @stubbed
17459
17439
  */
17460
17440
  export type ChatRequestHandler = (request: ChatRequest, context: ChatContext, response: ChatResponseStream, token: CancellationToken) => ProviderResult<ChatResult | void>;
17461
17441
 
17462
17442
  /**
17463
17443
  * A chat participant can be invoked by the user in a chat session, using the `@` prefix. When it is invoked, it handles the chat request and is solely
17464
17444
  * responsible for providing a response to the user. A ChatParticipant is created using {@link chat.createChatParticipant}.
17465
- * @stubbed
17466
17445
  */
17467
17446
  export interface ChatParticipant {
17468
17447
  /**
@@ -17511,7 +17490,6 @@ export module '@theia/plugin' {
17511
17490
 
17512
17491
  /**
17513
17492
  * A reference to a value that the user added to their chat request.
17514
- * @stubbed
17515
17493
  */
17516
17494
  export interface ChatPromptReference {
17517
17495
  /**
@@ -17540,7 +17518,6 @@ export module '@theia/plugin' {
17540
17518
 
17541
17519
  /**
17542
17520
  * A request to a chat participant.
17543
- * @stubbed
17544
17521
  */
17545
17522
  export interface ChatRequest {
17546
17523
  /**
@@ -17568,35 +17545,12 @@ export module '@theia/plugin' {
17568
17545
  * string-manipulation of the prompt.
17569
17546
  */
17570
17547
  readonly references: readonly ChatPromptReference[];
17571
-
17572
- /**
17573
- * The list of tools that the user attached to their request.
17574
- *
17575
- * When a tool reference is present, the chat participant should make a chat request using
17576
- * {@link LanguageModelChatToolMode.Required} to force the language model to generate input for the tool. Then, the
17577
- * participant can use {@link lm.invokeTool} to use the tool attach the result to its request for the user's prompt. The
17578
- * tool may contribute useful extra context for the user's request.
17579
- */
17580
- readonly toolReferences: readonly ChatLanguageModelToolReference[];
17581
-
17582
- /**
17583
- * A token that can be passed to {@link lm.invokeTool} when invoking a tool inside the context of handling a chat request.
17584
- * This associates the tool invocation to a chat session.
17585
- */
17586
- readonly toolInvocationToken: ChatParticipantToolToken;
17587
-
17588
- /**
17589
- * This is the model that is currently selected in the UI. Extensions can use this or use {@link chat.selectChatModels} to
17590
- * pick another model. Don't hold onto this past the lifetime of the request.
17591
- */
17592
- readonly model: LanguageModelChat;
17593
17548
  }
17594
17549
 
17595
17550
  /**
17596
17551
  * The ChatResponseStream is how a participant is able to return content to the chat view. It provides several methods for streaming different types of content
17597
17552
  * which will be rendered in an appropriate way in the chat view. A participant can use the helper method for the type of content it wants to return, or it
17598
17553
  * can instantiate a {@link ChatResponsePart} and use the generic {@link ChatResponseStream.push} method to return it.
17599
- * @stubbed
17600
17554
  */
17601
17555
  export interface ChatResponseStream {
17602
17556
  /**
@@ -17613,7 +17567,7 @@ export module '@theia/plugin' {
17613
17567
  * `push(new ChatResponseAnchorPart(value, title))`.
17614
17568
  * An anchor is an inline reference to some type of resource.
17615
17569
  *
17616
- * @param value A uri or location.
17570
+ * @param value A uri, location, or symbol information.
17617
17571
  * @param title An optional title that is rendered with value.
17618
17572
  */
17619
17573
  anchor(value: Uri | Location, title?: string): void;
@@ -17673,7 +17627,6 @@ export module '@theia/plugin' {
17673
17627
 
17674
17628
  /**
17675
17629
  * Represents a part of a chat response that is formatted as Markdown.
17676
- * @stubbed
17677
17630
  */
17678
17631
  export class ChatResponseMarkdownPart {
17679
17632
  /**
@@ -17691,7 +17644,6 @@ export module '@theia/plugin' {
17691
17644
 
17692
17645
  /**
17693
17646
  * Represents a file tree structure in a chat response.
17694
- * @stubbed
17695
17647
  */
17696
17648
  export interface ChatResponseFileTree {
17697
17649
  /**
@@ -17707,7 +17659,6 @@ export module '@theia/plugin' {
17707
17659
 
17708
17660
  /**
17709
17661
  * Represents a part of a chat response that is a file tree.
17710
- * @stubbed
17711
17662
  */
17712
17663
  export class ChatResponseFileTreePart {
17713
17664
  /**
@@ -17730,7 +17681,6 @@ export module '@theia/plugin' {
17730
17681
 
17731
17682
  /**
17732
17683
  * Represents a part of a chat response that is an anchor, that is rendered as a link to a target.
17733
- * @stubbed
17734
17684
  */
17735
17685
  export class ChatResponseAnchorPart {
17736
17686
  /**
@@ -17753,7 +17703,6 @@ export module '@theia/plugin' {
17753
17703
 
17754
17704
  /**
17755
17705
  * Represents a part of a chat response that is a progress message.
17756
- * @stubbed
17757
17706
  */
17758
17707
  export class ChatResponseProgressPart {
17759
17708
  /**
@@ -17770,7 +17719,6 @@ export module '@theia/plugin' {
17770
17719
 
17771
17720
  /**
17772
17721
  * Represents a part of a chat response that is a reference, rendered separately from the content.
17773
- * @stubbed
17774
17722
  */
17775
17723
  export class ChatResponseReferencePart {
17776
17724
  /**
@@ -17811,7 +17759,6 @@ export module '@theia/plugin' {
17811
17759
 
17812
17760
  /**
17813
17761
  * Represents a part of a chat response that is a button that executes a command.
17814
- * @stubbed
17815
17762
  */
17816
17763
  export class ChatResponseCommandButtonPart {
17817
17764
  /**
@@ -17866,7 +17813,6 @@ export module '@theia/plugin' {
17866
17813
 
17867
17814
  /**
17868
17815
  * Represents a message in a chat. Can assume different roles, like user or assistant.
17869
- * @stubbed
17870
17816
  */
17871
17817
  export class LanguageModelChatMessage {
17872
17818
 
@@ -17876,7 +17822,7 @@ export module '@theia/plugin' {
17876
17822
  * @param content The content of the message.
17877
17823
  * @param name The optional name of a user for the message.
17878
17824
  */
17879
- static User(content: string | (LanguageModelTextPart | LanguageModelToolResultPart)[], name?: string): LanguageModelChatMessage;
17825
+ static User(content: string, name?: string): LanguageModelChatMessage;
17880
17826
 
17881
17827
  /**
17882
17828
  * Utility to create a new assistant message.
@@ -17884,7 +17830,7 @@ export module '@theia/plugin' {
17884
17830
  * @param content The content of the message.
17885
17831
  * @param name The optional name of a user for the message.
17886
17832
  */
17887
- static Assistant(content: string | (LanguageModelTextPart | LanguageModelToolCallPart)[], name?: string): LanguageModelChatMessage;
17833
+ static Assistant(content: string, name?: string): LanguageModelChatMessage;
17888
17834
 
17889
17835
  /**
17890
17836
  * The role of this message.
@@ -17892,10 +17838,9 @@ export module '@theia/plugin' {
17892
17838
  role: LanguageModelChatMessageRole;
17893
17839
 
17894
17840
  /**
17895
- * A string or heterogeneous array of things that a message can contain as content. Some parts may be message-type
17896
- * specific for some models.
17841
+ * The content of this message.
17897
17842
  */
17898
- content: (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[];
17843
+ content: string;
17899
17844
 
17900
17845
  /**
17901
17846
  * The optional name of a user for this message.
@@ -17909,40 +17854,31 @@ export module '@theia/plugin' {
17909
17854
  * @param content The content of the message.
17910
17855
  * @param name The optional name of a user for the message.
17911
17856
  */
17912
- constructor(role: LanguageModelChatMessageRole, content: string | (LanguageModelTextPart | LanguageModelToolResultPart | LanguageModelToolCallPart)[], name?: string);
17857
+ constructor(role: LanguageModelChatMessageRole, content: string, name?: string);
17913
17858
  }
17914
17859
 
17915
17860
  /**
17916
17861
  * Represents a language model response.
17917
17862
  *
17918
17863
  * @see {@link LanguageModelAccess.chatRequest}
17919
- * @stubbed
17920
17864
  */
17921
17865
  export interface LanguageModelChatResponse {
17922
17866
 
17923
17867
  /**
17924
- * An async iterable that is a stream of text and tool-call parts forming the overall response. A
17925
- * {@link LanguageModelTextPart} is part of the assistant's response to be shown to the user. A
17926
- * {@link LanguageModelToolCallPart} is a request from the language model to call a tool. The latter will
17927
- * only be returned if tools were passed in the request via {@link LanguageModelChatRequestOptions.tools}. The
17928
- * `unknown`-type is used as a placeholder for future parts, like image data parts.
17868
+ * An async iterable that is a stream of text chunks forming the overall response.
17929
17869
  *
17930
- * *Note* that this stream will error when during data receiving an error occurs. Consumers of the stream should handle
17931
- * the errors accordingly.
17870
+ * *Note* that this stream will error when during data receiving an error occurs. Consumers of
17871
+ * the stream should handle the errors accordingly.
17932
17872
  *
17933
- * To cancel the stream, the consumer can {@link CancellationTokenSource.cancel cancel} the token that was used to make
17934
- * the request or break from the for-loop.
17873
+ * To cancel the stream, the consumer can {@link CancellationTokenSource.cancel cancel} the token that was used to make the request
17874
+ * or break from the for-loop.
17935
17875
  *
17936
17876
  * @example
17937
17877
  * ```ts
17938
17878
  * try {
17939
17879
  * // consume stream
17940
- * for await (const chunk of response.stream) {
17941
- * if (chunk instanceof LanguageModelTextPart) {
17942
- * console.log("TEXT", chunk);
17943
- * } else if (chunk instanceof LanguageModelToolCallPart) {
17944
- * console.log("TOOL CALL", chunk);
17945
- * }
17880
+ * for await (const chunk of response.text) {
17881
+ * console.log(chunk);
17946
17882
  * }
17947
17883
  *
17948
17884
  * } catch(e) {
@@ -17951,13 +17887,6 @@ export module '@theia/plugin' {
17951
17887
  * }
17952
17888
  * ```
17953
17889
  */
17954
- stream: AsyncIterable<LanguageModelTextPart | LanguageModelToolCallPart | unknown>;
17955
-
17956
- /**
17957
- * This is equivalent to filtering everything except for text parts from a {@link LanguageModelChatResponse.stream}.
17958
- *
17959
- * @see {@link LanguageModelChatResponse.stream}
17960
- */
17961
17890
  text: AsyncIterable<string>;
17962
17891
  }
17963
17892
 
@@ -17965,7 +17894,6 @@ export module '@theia/plugin' {
17965
17894
  * Represents a language model for making chat requests.
17966
17895
  *
17967
17896
  * @see {@link lm.selectChatModels}
17968
- * @stubbed
17969
17897
  */
17970
17898
  export interface LanguageModelChat {
17971
17899
 
@@ -18006,8 +17934,8 @@ export module '@theia/plugin' {
18006
17934
  * Make a chat request using a language model.
18007
17935
  *
18008
17936
  * *Note* that language model use may be subject to access restrictions and user consent. Calling this function
18009
- * for the first time (for an extension) will show a consent dialog to the user and because of that this function
18010
- * must _only be called in response to a user action!_ Extensions can use {@link LanguageModelAccessInformation.canSendRequest}
17937
+ * for the first time (for a extension) will show a consent dialog to the user and because of that this function
17938
+ * must _only be called in response to a user action!_ Extension can use {@link LanguageModelAccessInformation.canSendRequest}
18011
17939
  * to check if they have the necessary permissions to make a request.
18012
17940
  *
18013
17941
  * This function will return a rejected promise if making a request to the language model is not
@@ -18018,10 +17946,6 @@ export module '@theia/plugin' {
18018
17946
  * - quota limits exceeded, see {@link LanguageModelError.Blocked `Blocked`}
18019
17947
  * - other issues in which case extension must check {@link LanguageModelError.cause `LanguageModelError.cause`}
18020
17948
  *
18021
- * An extension can make use of language model tool calling by passing a set of tools to
18022
- * {@link LanguageModelChatRequestOptions.tools}. The language model will return a {@link LanguageModelToolCallPart} and
18023
- * the extension can invoke the tool and make another request with the result.
18024
- *
18025
17949
  * @param messages An array of message instances.
18026
17950
  * @param options Options that control the request.
18027
17951
  * @param token A cancellation token which controls the request. See {@link CancellationTokenSource} for how to create one.
@@ -18042,7 +17966,6 @@ export module '@theia/plugin' {
18042
17966
  * Describes how to select language models for chat requests.
18043
17967
  *
18044
17968
  * @see {@link lm.selectChatModels}
18045
- * @stubbed
18046
17969
  */
18047
17970
  export interface LanguageModelChatSelector {
18048
17971
 
@@ -18078,7 +18001,6 @@ export module '@theia/plugin' {
18078
18001
  * failure causes, like `if(someError.code === vscode.LanguageModelError.NotFound.name) {...}`
18079
18002
  * for the case of referring to an unknown language model. For unspecified errors the `cause`-property
18080
18003
  * will contain the actual error.
18081
- * @stubbed
18082
18004
  */
18083
18005
  export class LanguageModelError extends Error {
18084
18006
 
@@ -18112,7 +18034,6 @@ export module '@theia/plugin' {
18112
18034
  * Options for making a chat request using a language model.
18113
18035
  *
18114
18036
  * @see {@link LanguageModelChat.sendRequest}
18115
- * @stubbed
18116
18037
  */
18117
18038
  export interface LanguageModelChatRequestOptions {
18118
18039
 
@@ -18126,24 +18047,6 @@ export module '@theia/plugin' {
18126
18047
  * and need to be lookup in the respective documentation.
18127
18048
  */
18128
18049
  modelOptions?: { [name: string]: any };
18129
-
18130
- /**
18131
- * An optional list of tools that are available to the language model. These could be registered tools available via
18132
- * {@link lm.tools}, or private tools that are just implemented within the calling extension.
18133
- *
18134
- * If the LLM requests to call one of these tools, it will return a {@link LanguageModelToolCallPart} in
18135
- * {@link LanguageModelChatResponse.stream}. It's the caller's responsibility to invoke the tool. If it's a tool
18136
- * registered in {@link lm.tools}, that means calling {@link lm.invokeTool}.
18137
- *
18138
- * Then, the tool result can be provided to the LLM by creating an Assistant-type {@link LanguageModelChatMessage} with a
18139
- * {@link LanguageModelToolCallPart}, followed by a User-type message with a {@link LanguageModelToolResultPart}.
18140
- */
18141
- tools?: LanguageModelChatTool[];
18142
-
18143
- /**
18144
- * The tool-selecting mode to use. {@link LanguageModelChatToolMode.Auto} by default.
18145
- */
18146
- toolMode?: LanguageModelChatToolMode;
18147
18050
  }
18148
18051
 
18149
18052
  /**
@@ -18184,56 +18087,10 @@ export module '@theia/plugin' {
18184
18087
  * @stubbed
18185
18088
  */
18186
18089
  export function selectChatModels(selector?: LanguageModelChatSelector): Thenable<LanguageModelChat[]>;
18187
-
18188
- /**
18189
- * Register a LanguageModelTool. The tool must also be registered in the package.json `languageModelTools` contribution
18190
- * point. A registered tool is available in the {@link lm.tools} list for any extension to see. But in order for it to
18191
- * be seen by a language model, it must be passed in the list of available tools in {@link LanguageModelChatRequestOptions.tools}.
18192
- * @returns A {@link Disposable} that unregisters the tool when disposed.
18193
- * @stubbed
18194
- */
18195
- export function registerTool<T>(name: string, tool: LanguageModelTool<T>): Disposable;
18196
-
18197
- /**
18198
- * A list of all available tools that were registered by all extensions using {@link lm.registerTool}. They can be called
18199
- * with {@link lm.invokeTool} with input that match their declared `inputSchema`.
18200
- * @stubbed
18201
- */
18202
- export const tools: readonly LanguageModelToolInformation[];
18203
-
18204
- /**
18205
- * Invoke a tool listed in {@link lm.tools} by name with the given input. The input will be validated against
18206
- * the schema declared by the tool
18207
- *
18208
- * A tool can be invoked by a chat participant, in the context of handling a chat request, or globally by any extension in
18209
- * any custom flow.
18210
- *
18211
- * In the former case, the caller shall pass the
18212
- * {@link LanguageModelToolInvocationOptions.toolInvocationToken toolInvocationToken}, which comes with the a
18213
- * {@link ChatRequest.toolInvocationToken chat request}. This makes sure the chat UI shows the tool invocation for the
18214
- * correct conversation.
18215
- *
18216
- * A tool {@link LanguageModelToolResult result} is an array of {@link LanguageModelTextPart text-} and
18217
- * {@link LanguageModelPromptTsxPart prompt-tsx}-parts. If the tool caller is using `@vscode/prompt-tsx`, it can
18218
- * incorporate the response parts into its prompt using a `ToolResult`. If not, the parts can be passed along to the
18219
- * {@link LanguageModelChat} via a user message with a {@link LanguageModelToolResultPart}.
18220
- *
18221
- * If a chat participant wants to preserve tool results for requests across multiple turns, it can store tool results in
18222
- * the {@link ChatResult.metadata} returned from the handler and retrieve them on the next turn from
18223
- * {@link ChatResponseTurn.result}.
18224
- *
18225
- * @param name The name of the tool to call.
18226
- * @param options The options to use when invoking the tool.
18227
- * @param token A cancellation token. See {@link CancellationTokenSource} for how to create one.
18228
- * @returns The result of the tool invocation.
18229
- * @stubbed
18230
- */
18231
- export function invokeTool(name: string, options: LanguageModelToolInvocationOptions<object>, token?: CancellationToken): Thenable<LanguageModelToolResult>;
18232
18090
  }
18233
18091
 
18234
18092
  /**
18235
18093
  * Represents extension specific information about the access to language models.
18236
- * @stubbed
18237
18094
  */
18238
18095
  export interface LanguageModelAccessInformation {
18239
18096
 
@@ -18252,327 +18109,6 @@ export module '@theia/plugin' {
18252
18109
  * model does not exist or consent hasn't been asked for.
18253
18110
  */
18254
18111
  canSendRequest(chat: LanguageModelChat): boolean | undefined;
18255
-
18256
- }
18257
-
18258
- /**
18259
- * A tool that is available to the language model via {@link LanguageModelChatRequestOptions}. A language model uses all the
18260
- * properties of this interface to decide which tool to call, and how to call it.
18261
- * @stubbed
18262
- */
18263
- export interface LanguageModelChatTool {
18264
- /**
18265
- * The name of the tool.
18266
- */
18267
- name: string;
18268
-
18269
- /**
18270
- * The description of the tool.
18271
- */
18272
- description: string;
18273
-
18274
- /**
18275
- * A JSON schema for the input this tool accepts.
18276
- */
18277
- inputSchema?: object;
18278
- }
18279
-
18280
- /**
18281
- * A tool-calling mode for the language model to use.
18282
- */
18283
- export enum LanguageModelChatToolMode {
18284
- /**
18285
- * The language model can choose to call a tool or generate a message. Is the default.
18286
- */
18287
- Auto = 1,
18288
-
18289
- /**
18290
- * The language model must call one of the provided tools. Note- some models only support a single tool when using this
18291
- * mode.
18292
- */
18293
- Required = 2
18294
- }
18295
-
18296
- /**
18297
- * A language model response part indicating a tool call, returned from a {@link LanguageModelChatResponse}, and also can be
18298
- * included as a content part on a {@link LanguageModelChatMessage}, to represent a previous tool call in a chat request.
18299
- * @stubbed
18300
- */
18301
- export class LanguageModelToolCallPart {
18302
- /**
18303
- * The ID of the tool call. This is a unique identifier for the tool call within the chat request.
18304
- */
18305
- callId: string;
18306
-
18307
- /**
18308
- * The name of the tool to call.
18309
- */
18310
- name: string;
18311
-
18312
- /**
18313
- * The input with which to call the tool.
18314
- */
18315
- input: object;
18316
-
18317
- /**
18318
- * Create a new LanguageModelToolCallPart.
18319
- *
18320
- * @param callId The ID of the tool call.
18321
- * @param name The name of the tool to call.
18322
- * @param input The input with which to call the tool.
18323
- */
18324
- constructor(callId: string, name: string, input: object);
18325
- }
18326
-
18327
- /**
18328
- * The result of a tool call. This is the counterpart of a {@link LanguageModelToolCallPart tool call} and
18329
- * it can only be included in the content of a User message
18330
- * @stubbed
18331
- */
18332
- export class LanguageModelToolResultPart {
18333
- /**
18334
- * The ID of the tool call.
18335
- *
18336
- * *Note* that this should match the {@link LanguageModelToolCallPart.callId callId} of a tool call part.
18337
- */
18338
- callId: string;
18339
-
18340
- /**
18341
- * The value of the tool result.
18342
- */
18343
- content: (LanguageModelTextPart | LanguageModelPromptTsxPart | unknown)[];
18344
-
18345
- /**
18346
- * @param callId The ID of the tool call.
18347
- * @param content The content of the tool result.
18348
- */
18349
- constructor(callId: string, content: (LanguageModelTextPart | LanguageModelPromptTsxPart | unknown)[]);
18350
- }
18351
-
18352
- /**
18353
- * A language model response part containing a piece of text, returned from a {@link LanguageModelChatResponse}.
18354
- * @stubbed
18355
- */
18356
- export class LanguageModelTextPart {
18357
- /**
18358
- * The text content of the part.
18359
- */
18360
- value: string;
18361
-
18362
- /**
18363
- * Construct a text part with the given content.
18364
- * @param value The text content of the part.
18365
- */
18366
- constructor(value: string);
18367
- }
18368
-
18369
- /**
18370
- * A language model response part containing a PromptElementJSON from `@vscode/prompt-tsx`.
18371
- * @see {@link LanguageModelToolResult}
18372
- * @stubbed
18373
- */
18374
- export class LanguageModelPromptTsxPart {
18375
- /**
18376
- * The value of the part.
18377
- */
18378
- value: unknown;
18379
-
18380
- /**
18381
- * Construct a prompt-tsx part with the given content.
18382
- * @param value The value of the part, the result of `renderPromptElementJSON` from `@vscode/prompt-tsx`.
18383
- */
18384
- constructor(value: unknown);
18385
- }
18386
-
18387
- /**
18388
- * A result returned from a tool invocation. If using `@vscode/prompt-tsx`, this result may be rendered using a `ToolResult`.
18389
- * @stubbed
18390
- */
18391
- export class LanguageModelToolResult {
18392
- /**
18393
- * A list of tool result content parts. Includes `unknown` becauses this list may be extended with new content types in
18394
- * the future.
18395
- * @see {@link lm.invokeTool}.
18396
- */
18397
- content: (LanguageModelTextPart | LanguageModelPromptTsxPart | unknown)[];
18398
-
18399
- /**
18400
- * Create a LanguageModelToolResult
18401
- * @param content A list of tool result content parts
18402
- */
18403
- constructor(content: (LanguageModelTextPart | LanguageModelPromptTsxPart)[]);
18404
- }
18405
-
18406
- /**
18407
- * A token that can be passed to {@link lm.invokeTool} when invoking a tool inside the context of handling a chat request.
18408
- */
18409
- export type ChatParticipantToolToken = never;
18410
-
18411
- /**
18412
- * Options provided for tool invocation.
18413
- * @stubbed
18414
- */
18415
- export interface LanguageModelToolInvocationOptions<T> {
18416
- /**
18417
- * An opaque object that ties a tool invocation to a chat request from a {@link ChatParticipant chat participant}.
18418
- *
18419
- * The _only_ way to get a valid tool invocation token is using the provided {@link ChatRequest.toolInvocationToken toolInvocationToken}
18420
- * from a chat request. In that case, a progress bar will be automatically shown for the tool invocation in the chat response view, and if
18421
- * the tool requires user confirmation, it will show up inline in the chat view.
18422
- *
18423
- * If the tool is being invoked outside of a chat request, `undefined` should be passed instead, and no special UI except for
18424
- * confirmations will be shown.
18425
- *
18426
- * *Note* that a tool that invokes another tool during its invocation, can pass along the `toolInvocationToken` that it received.
18427
- */
18428
- toolInvocationToken: ChatParticipantToolToken | undefined;
18429
-
18430
- /**
18431
- * The input with which to invoke the tool. The input must match the schema defined in
18432
- * {@link LanguageModelToolInformation.inputSchema}
18433
- */
18434
- input: T;
18435
-
18436
- /**
18437
- * Options to hint at how many tokens the tool should return in its response, and enable the tool to count tokens
18438
- * accurately.
18439
- */
18440
- tokenizationOptions?: LanguageModelToolTokenizationOptions;
18441
- }
18442
-
18443
- /**
18444
- * Options related to tokenization for a tool invocation.
18445
- * @stubbed
18446
- */
18447
- export interface LanguageModelToolTokenizationOptions {
18448
- /**
18449
- * If known, the maximum number of tokens the tool should emit in its result.
18450
- */
18451
- tokenBudget: number;
18452
-
18453
- /**
18454
- * Count the number of tokens in a message using the model specific tokenizer-logic.
18455
- * @param text A string.
18456
- * @param token Optional cancellation token. See {@link CancellationTokenSource} for how to create one.
18457
- * @returns A thenable that resolves to the number of tokens.
18458
- */
18459
- countTokens(text: string, token?: CancellationToken): Thenable<number>;
18460
- }
18461
-
18462
- /**
18463
- * Information about a registered tool available in {@link lm.tools}.
18464
- * @stubbed
18465
- */
18466
- export interface LanguageModelToolInformation {
18467
- /**
18468
- * A unique name for the tool.
18469
- */
18470
- readonly name: string;
18471
-
18472
- /**
18473
- * A description of this tool that may be passed to a language model.
18474
- */
18475
- readonly description: string;
18476
-
18477
- /**
18478
- * A JSON schema for the input this tool accepts.
18479
- */
18480
- readonly inputSchema: object | undefined;
18481
-
18482
- /**
18483
- * A set of tags, declared by the tool, that roughly describe the tool's capabilities. A tool user may use these to filter
18484
- * the set of tools to just ones that are relevant for the task at hand.
18485
- */
18486
- readonly tags: readonly string[];
18487
- }
18488
-
18489
- /**
18490
- * Options for {@link LanguageModelTool.prepareInvocation}.
18491
- * @stubbed
18492
- */
18493
- export interface LanguageModelToolInvocationPrepareOptions<T> {
18494
- /**
18495
- * The input that the tool is being invoked with.
18496
- */
18497
- input: T;
18498
- }
18499
-
18500
- /**
18501
- * A tool that can be invoked by a call to a {@link LanguageModelChat}.
18502
- * @stubbed
18503
- */
18504
- export interface LanguageModelTool<T> {
18505
- /**
18506
- * Invoke the tool with the given input and return a result.
18507
- *
18508
- * The provided {@link LanguageModelToolInvocationOptions.input} has been validated against the declared schema.
18509
- */
18510
- invoke(options: LanguageModelToolInvocationOptions<T>, token: CancellationToken): ProviderResult<LanguageModelToolResult>;
18511
-
18512
- /**
18513
- * Called once before a tool is invoked. It's recommended to implement this to customize the progress message that appears
18514
- * while the tool is running, and to provide a more useful message with context from the invocation input. Can also
18515
- * signal that a tool needs user confirmation before running, if appropriate.
18516
- *
18517
- * * *Note 1:* Must be free of side-effects.
18518
- * * *Note 2:* A call to `prepareInvocation` is not necessarily followed by a call to `invoke`.
18519
- */
18520
- prepareInvocation?(options: LanguageModelToolInvocationPrepareOptions<T>, token: CancellationToken): ProviderResult<PreparedToolInvocation>;
18521
- }
18522
-
18523
- /**
18524
- * When this is returned in {@link PreparedToolInvocation}, the user will be asked to confirm before running the tool. These
18525
- * messages will be shown with buttons that say "Continue" and "Cancel".
18526
- * @stubbed
18527
- */
18528
- export interface LanguageModelToolConfirmationMessages {
18529
- /**
18530
- * The title of the confirmation message.
18531
- */
18532
- title: string;
18533
-
18534
- /**
18535
- * The body of the confirmation message.
18536
- */
18537
- message: string | MarkdownString;
18538
- }
18539
-
18540
- /**
18541
- * The result of a call to {@link LanguageModelTool.prepareInvocation}.
18542
- * @stubbed
18543
- */
18544
- export interface PreparedToolInvocation {
18545
- /**
18546
- * A customized progress message to show while the tool runs.
18547
- */
18548
- invocationMessage?: string;
18549
-
18550
- /**
18551
- * The presence of this property indicates that the user should be asked to confirm before running the tool. The user
18552
- * should be asked for confirmation for any tool that has a side-effect or may potentially be dangerous.
18553
- */
18554
- confirmationMessages?: LanguageModelToolConfirmationMessages;
18555
- }
18556
-
18557
- /**
18558
- * A reference to a tool that the user manually attached to their request, either using the `#`-syntax inline, or as an
18559
- * attachment via the paperclip button.
18560
- * @stubbed
18561
- */
18562
- export interface ChatLanguageModelToolReference {
18563
- /**
18564
- * The tool name. Refers to a tool listed in {@link lm.tools}.
18565
- */
18566
- readonly name: string;
18567
-
18568
- /**
18569
- * The start and end index of the reference in the {@link ChatRequest.prompt prompt}. When undefined, the reference was
18570
- * not part of the prompt text.
18571
- *
18572
- * *Note* that the indices take the leading `#`-character into account which means they can be used to modify the prompt
18573
- * as-is.
18574
- */
18575
- readonly range?: [start: number, end: number];
18576
18112
  }
18577
18113
 
18578
18114
  /**
@@ -35,7 +35,6 @@ export module '@theia/plugin' {
35
35
  export interface ConversationResponse {
36
36
  readonly type: 'response';
37
37
  readonly message: string;
38
- readonly result?: ChatResult;
39
38
  readonly references?: DocumentContextItem[];
40
39
  }
41
40
 
@@ -70,7 +69,7 @@ export module '@theia/plugin' {
70
69
  }
71
70
 
72
71
  export interface MappedEditsRequest {
73
- readonly codeBlocks: { code: string; resource: Uri; markdownBeforeBlock?: string }[];
72
+ readonly codeBlocks: { code: string; resource: Uri }[];
74
73
  // for every prior response that contains codeblocks, make sure we pass the code as well as the resources based on the reported codemapper URIs
75
74
  readonly conversation: (ConversationRequest | ConversationResponse)[];
76
75
  }