@theia/ai-chat 1.67.0 → 1.68.0-next.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/lib/browser/chat-session-store-impl.d.ts +3 -0
  2. package/lib/browser/chat-session-store-impl.d.ts.map +1 -1
  3. package/lib/browser/chat-session-store-impl.js +46 -7
  4. package/lib/browser/chat-session-store-impl.js.map +1 -1
  5. package/lib/browser/chat-session-store-impl.spec.d.ts +2 -0
  6. package/lib/browser/chat-session-store-impl.spec.d.ts.map +1 -0
  7. package/lib/browser/chat-session-store-impl.spec.js +383 -0
  8. package/lib/browser/chat-session-store-impl.spec.js.map +1 -0
  9. package/lib/common/ai-chat-preferences.d.ts +1 -0
  10. package/lib/common/ai-chat-preferences.d.ts.map +1 -1
  11. package/lib/common/ai-chat-preferences.js +10 -1
  12. package/lib/common/ai-chat-preferences.js.map +1 -1
  13. package/lib/common/chat-agents.d.ts +6 -1
  14. package/lib/common/chat-agents.d.ts.map +1 -1
  15. package/lib/common/chat-agents.js +17 -5
  16. package/lib/common/chat-agents.js.map +1 -1
  17. package/lib/common/chat-model-serialization.d.ts +2 -0
  18. package/lib/common/chat-model-serialization.d.ts.map +1 -1
  19. package/lib/common/chat-model-serialization.js.map +1 -1
  20. package/lib/common/chat-model.d.ts +13 -0
  21. package/lib/common/chat-model.d.ts.map +1 -1
  22. package/lib/common/chat-model.js +17 -0
  23. package/lib/common/chat-model.js.map +1 -1
  24. package/package.json +9 -9
  25. package/src/browser/chat-session-store-impl.spec.ts +491 -0
  26. package/src/browser/chat-session-store-impl.ts +49 -7
  27. package/src/common/ai-chat-preferences.ts +10 -0
  28. package/src/common/chat-agents.ts +31 -3
  29. package/src/common/chat-model-serialization.ts +2 -0
  30. package/src/common/chat-model.ts +28 -0
@@ -62,6 +62,8 @@ export interface SerializableChatResponseData {
62
62
  isComplete: boolean;
63
63
  isError: boolean;
64
64
  errorMessage?: string;
65
+ promptVariantId?: string;
66
+ isPromptVariantEdited?: boolean;
65
67
  content: SerializableChatResponseContentData[];
66
68
  }
67
69
 
@@ -743,6 +743,14 @@ export interface ChatResponseModel {
743
743
  * This can be used to store and retrieve such data.
744
744
  */
745
745
  readonly data: { [key: string]: unknown };
746
+ /**
747
+ * The ID of the prompt variant used to generate this response
748
+ */
749
+ readonly promptVariantId?: string;
750
+ /**
751
+ * Indicates whether the prompt variant was customized/edited
752
+ */
753
+ readonly isPromptVariantEdited?: boolean;
746
754
  toSerializable(): SerializableChatResponseData;
747
755
  }
748
756
 
@@ -2331,6 +2339,8 @@ export class MutableChatResponseModel implements ChatResponseModel {
2331
2339
  protected _isError: boolean;
2332
2340
  protected _errorObject: Error | undefined;
2333
2341
  protected _cancellationToken: CancellationTokenSource;
2342
+ protected _promptVariantId?: string;
2343
+ protected _isPromptVariantEdited?: boolean;
2334
2344
 
2335
2345
  constructor(
2336
2346
  requestId: string,
@@ -2372,6 +2382,8 @@ export class MutableChatResponseModel implements ChatResponseModel {
2372
2382
  this._isWaitingForInput = false;
2373
2383
  // TODO: Restore progressMessages?
2374
2384
  this._progressMessages = [];
2385
+ this._promptVariantId = data.promptVariantId;
2386
+ this._isPromptVariantEdited = data.isPromptVariantEdited ?? false;
2375
2387
 
2376
2388
  if (data.errorMessage) {
2377
2389
  this._errorObject = new Error(data.errorMessage);
@@ -2443,6 +2455,20 @@ export class MutableChatResponseModel implements ChatResponseModel {
2443
2455
  return this._agentId;
2444
2456
  }
2445
2457
 
2458
+ get promptVariantId(): string | undefined {
2459
+ return this._promptVariantId;
2460
+ }
2461
+
2462
+ get isPromptVariantEdited(): boolean {
2463
+ return this._isPromptVariantEdited ?? false;
2464
+ }
2465
+
2466
+ setPromptVariantInfo(variantId: string | undefined, isEdited: boolean): void {
2467
+ this._promptVariantId = variantId;
2468
+ this._isPromptVariantEdited = isEdited;
2469
+ this._onDidChangeEmitter.fire();
2470
+ }
2471
+
2446
2472
  overrideAgentId(agentId: string): void {
2447
2473
  this._agentId = agentId;
2448
2474
  }
@@ -2508,6 +2534,8 @@ export class MutableChatResponseModel implements ChatResponseModel {
2508
2534
  isComplete: this.isComplete,
2509
2535
  isError: this.isError,
2510
2536
  errorMessage: this.errorObject?.message,
2537
+ promptVariantId: this._promptVariantId,
2538
+ isPromptVariantEdited: this._isPromptVariantEdited,
2511
2539
  content: this.response.content.map(c => {
2512
2540
  const serialized = c.toSerializable?.();
2513
2541
  if (!serialized) {