@codingame/monaco-vscode-chat-service-override 28.0.1 → 28.1.2

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/index.d.ts CHANGED
@@ -1,2 +1,15 @@
1
1
  import { type IEditorOverrideServices } from "@codingame/monaco-vscode-api/vscode/vs/editor/standalone/browser/standaloneServices";
2
- export default function getServiceOverride(): IEditorOverrideServices;
2
+ import { ChatEntitlement, type IChatSentiment, type IQuotas } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService";
3
+ export interface CustomEntitlement {
4
+ entitlement: ChatEntitlement;
5
+ sentiment: IChatSentiment;
6
+ anonymous: boolean;
7
+ quotas: IQuotas;
8
+ previewFeaturesDisabled: boolean;
9
+ }
10
+ export interface ChatServiceOverrideOptions {
11
+ customEntitlement?: CustomEntitlement;
12
+ }
13
+ export default function getServiceOverride({ customEntitlement }?: ChatServiceOverrideOptions): IEditorOverrideServices;
14
+ export { ChatEntitlement };
15
+ export type { IChatSentiment, IQuotas };
package/index.js CHANGED
@@ -32,6 +32,7 @@ import { IChatMarkdownAnchorService } from '@codingame/monaco-vscode-api/vscode/
32
32
  import { ChatMarkdownAnchorService } from './vscode/src/vs/workbench/contrib/chat/browser/widget/chatContentParts/chatMarkdownAnchorService.js';
33
33
  import { ChatEditingService } from './vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js';
34
34
  import { ChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService';
35
+ export { ChatEntitlement } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService';
35
36
  import { PromptsService } from './vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js';
36
37
  import { IChatEntitlementService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/chat/common/chatEntitlementService.service';
37
38
  import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
@@ -104,13 +105,40 @@ import { IChatDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbe
104
105
  import { ChatDebugServiceImpl } from './vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js';
105
106
  import { IChatResponseResourceFileSystemProvider } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.service';
106
107
  import { ChatResponseResourceFileSystemProvider } from './vscode/src/vs/workbench/contrib/chat/common/widget/chatResponseResourceFileSystemProvider.js';
108
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
109
+
107
110
  import './vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js';
108
111
  import './vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js';
109
112
  import './vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminal.chat.contribution.js';
110
113
  import './vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js';
111
114
  import './vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js';
115
+ import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
112
116
 
113
- function getServiceOverride() {
117
+ class CustomEntitlementService {
118
+ constructor(customEntitlement) {
119
+ this.customEntitlement = customEntitlement;
120
+ this.onDidChangeEntitlement = Event.None;
121
+ this.entitlement = this.customEntitlement.entitlement;
122
+ this.entitlementObs = constObservable(this.entitlement);
123
+ this.previewFeaturesDisabled = this.customEntitlement.previewFeaturesDisabled;
124
+ this.organisations = undefined;
125
+ this.isInternal = true;
126
+ this.sku = undefined;
127
+ this.copilotTrackingId = undefined;
128
+ this.onDidChangeQuotaExceeded = Event.None;
129
+ this.onDidChangeQuotaRemaining = Event.None;
130
+ this.quotas = this.customEntitlement.quotas;
131
+ this.onDidChangeSentiment = Event.None;
132
+ this.sentiment = this.customEntitlement.sentiment;
133
+ this.sentimentObs = constObservable(this.sentiment);
134
+ this.onDidChangeAnonymous = Event.None;
135
+ this.anonymous = this.customEntitlement.anonymous;
136
+ this.anonymousObs = constObservable(this.anonymous);
137
+ }
138
+ markAnonymousRateLimited() { }
139
+ async update() { }
140
+ }
141
+ function getServiceOverride({ customEntitlement } = {}) {
114
142
  return {
115
143
  [IChatService.toString()]: new SyncDescriptor(ChatService, [], true),
116
144
  [IChatWidgetService.toString()]: new SyncDescriptor(ChatWidgetService, [], true),
@@ -131,7 +159,9 @@ function getServiceOverride() {
131
159
  [IChatEditingService.toString()]: new SyncDescriptor(ChatEditingService, [], true),
132
160
  [IChatTransferService.toString()]: new SyncDescriptor(ChatTransferService, [], true),
133
161
  [IChatMarkdownAnchorService.toString()]: new SyncDescriptor(ChatMarkdownAnchorService, [], true),
134
- [IChatEntitlementService.toString()]: new SyncDescriptor(ChatEntitlementService, [], true),
162
+ [IChatEntitlementService.toString()]: customEntitlement != null
163
+ ? new SyncDescriptor(CustomEntitlementService, [customEntitlement], true)
164
+ : new SyncDescriptor(ChatEntitlementService, [], true),
135
165
  [IPromptsService.toString()]: new SyncDescriptor(PromptsService, [], true),
136
166
  [IChatStatusItemService.toString()]: new SyncDescriptor(ChatStatusItemService, [], true),
137
167
  [IChatContextPickService.toString()]: new SyncDescriptor(ChatContextPickService, [], true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-chat-service-override",
3
- "version": "28.0.1",
3
+ "version": "28.1.2",
4
4
  "private": false,
5
5
  "description": "VSCode public API plugged on the monaco editor - chat service-override",
6
6
  "keywords": [],
@@ -15,10 +15,10 @@
15
15
  },
16
16
  "type": "module",
17
17
  "dependencies": {
18
- "@codingame/monaco-vscode-api": "28.0.1",
19
- "@codingame/monaco-vscode-katex-common": "28.0.1",
20
- "@codingame/monaco-vscode-xterm-addons-common": "28.0.1",
21
- "@codingame/monaco-vscode-xterm-common": "28.0.1"
18
+ "@codingame/monaco-vscode-api": "28.1.2",
19
+ "@codingame/monaco-vscode-katex-common": "28.1.2",
20
+ "@codingame/monaco-vscode-xterm-addons-common": "28.1.2",
21
+ "@codingame/monaco-vscode-xterm-common": "28.1.2"
22
22
  },
23
23
  "main": "index.js",
24
24
  "module": "index.js",
@@ -126,7 +126,7 @@ function waitForCommandRegistration(commandId) {
126
126
  return Promise.resolve();
127
127
  }
128
128
  return ( new Promise(resolve => {
129
- const timer = ( new TimeoutTimer());
129
+ const timer = new TimeoutTimer();
130
130
  const listener = CommandsRegistry.onDidRegisterCommand(id => {
131
131
  if (id === commandId) {
132
132
  listener.dispose();
@@ -384,7 +384,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
384
384
  };
385
385
  }
386
386
  getTextEdits(codeBlock, chatSessionResource, token) {
387
- return ( new AsyncIterableProducer(async executor => {
387
+ return new AsyncIterableProducer(async executor => {
388
388
  const request = {
389
389
  codeBlocks: [codeBlock],
390
390
  chatSessionResource
@@ -399,10 +399,10 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
399
399
  if (result?.errorMessage) {
400
400
  executor.reject(( new Error(result.errorMessage)));
401
401
  }
402
- }));
402
+ });
403
403
  }
404
404
  getNotebookEdits(codeBlock, chatSessionResource, token) {
405
- return ( new AsyncIterableProducer(async executor => {
405
+ return new AsyncIterableProducer(async executor => {
406
406
  const request = {
407
407
  codeBlocks: [codeBlock],
408
408
  chatSessionResource,
@@ -420,7 +420,7 @@ let ApplyCodeBlockOperation = class ApplyCodeBlockOperation {
420
420
  if (result?.errorMessage) {
421
421
  executor.reject(( new Error(result.errorMessage)));
422
422
  }
423
- }));
423
+ });
424
424
  }
425
425
  async waitForFirstElement(iterable) {
426
426
  const iterator = iterable[Symbol.asyncIterator]();