@theia/ai-chat 1.55.1 → 1.57.0-next.112

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 (88) hide show
  1. package/README.md +2 -1
  2. package/lib/browser/ai-chat-frontend-module.d.ts.map +1 -1
  3. package/lib/browser/ai-chat-frontend-module.js +14 -4
  4. package/lib/browser/ai-chat-frontend-module.js.map +1 -1
  5. package/lib/browser/change-set-file-element.d.ts +44 -0
  6. package/lib/browser/change-set-file-element.d.ts.map +1 -0
  7. package/lib/browser/change-set-file-element.js +113 -0
  8. package/lib/browser/change-set-file-element.js.map +1 -0
  9. package/lib/browser/change-set-file-resource.d.ts +13 -0
  10. package/lib/browser/change-set-file-resource.d.ts.map +1 -0
  11. package/lib/browser/change-set-file-resource.js +73 -0
  12. package/lib/browser/change-set-file-resource.js.map +1 -0
  13. package/lib/browser/change-set-file-service.d.ts +26 -0
  14. package/lib/browser/change-set-file-service.d.ts.map +1 -0
  15. package/lib/browser/change-set-file-service.js +139 -0
  16. package/lib/browser/change-set-file-service.js.map +1 -0
  17. package/lib/common/chat-agents.d.ts +16 -9
  18. package/lib/common/chat-agents.d.ts.map +1 -1
  19. package/lib/common/chat-agents.js +51 -67
  20. package/lib/common/chat-agents.js.map +1 -1
  21. package/lib/common/chat-history-entry.d.ts +7 -0
  22. package/lib/common/chat-history-entry.d.ts.map +1 -0
  23. package/lib/common/chat-history-entry.js +42 -0
  24. package/lib/common/chat-history-entry.js.map +1 -0
  25. package/lib/common/chat-model-util.d.ts +7 -0
  26. package/lib/common/chat-model-util.d.ts.map +1 -0
  27. package/lib/common/chat-model-util.js +50 -0
  28. package/lib/common/chat-model-util.js.map +1 -0
  29. package/lib/common/chat-model.d.ts +176 -7
  30. package/lib/common/chat-model.d.ts.map +1 -1
  31. package/lib/common/chat-model.js +193 -9
  32. package/lib/common/chat-model.js.map +1 -1
  33. package/lib/common/chat-service.d.ts +6 -0
  34. package/lib/common/chat-service.d.ts.map +1 -1
  35. package/lib/common/chat-service.js +12 -0
  36. package/lib/common/chat-service.js.map +1 -1
  37. package/lib/common/chat-tool-request-service.d.ts +17 -0
  38. package/lib/common/chat-tool-request-service.d.ts.map +1 -0
  39. package/lib/common/chat-tool-request-service.js +52 -0
  40. package/lib/common/chat-tool-request-service.js.map +1 -0
  41. package/lib/common/command-chat-agents.d.ts.map +1 -1
  42. package/lib/common/command-chat-agents.js +4 -2
  43. package/lib/common/command-chat-agents.js.map +1 -1
  44. package/lib/common/index.d.ts +1 -0
  45. package/lib/common/index.d.ts.map +1 -1
  46. package/lib/common/index.js +1 -0
  47. package/lib/common/index.js.map +1 -1
  48. package/lib/common/orchestrator-chat-agent.d.ts.map +1 -1
  49. package/lib/common/orchestrator-chat-agent.js +16 -14
  50. package/lib/common/orchestrator-chat-agent.js.map +1 -1
  51. package/lib/common/parse-contents.d.ts +2 -2
  52. package/lib/common/parse-contents.d.ts.map +1 -1
  53. package/lib/common/parse-contents.js +4 -4
  54. package/lib/common/parse-contents.js.map +1 -1
  55. package/lib/common/parse-contents.spec.d.ts.map +1 -1
  56. package/lib/common/parse-contents.spec.js +14 -13
  57. package/lib/common/parse-contents.spec.js.map +1 -1
  58. package/lib/common/response-content-matcher.d.ts +3 -3
  59. package/lib/common/response-content-matcher.d.ts.map +1 -1
  60. package/lib/common/response-content-matcher.js +2 -2
  61. package/lib/common/response-content-matcher.js.map +1 -1
  62. package/lib/common/universal-chat-agent.d.ts +1 -0
  63. package/lib/common/universal-chat-agent.d.ts.map +1 -1
  64. package/lib/common/universal-chat-agent.js +10 -3
  65. package/lib/common/universal-chat-agent.js.map +1 -1
  66. package/package.json +10 -8
  67. package/src/browser/ai-chat-frontend-module.ts +17 -6
  68. package/src/browser/change-set-file-element.ts +137 -0
  69. package/src/browser/change-set-file-resource.ts +74 -0
  70. package/src/browser/change-set-file-service.ts +136 -0
  71. package/src/common/chat-agents.ts +56 -78
  72. package/src/common/chat-history-entry.ts +47 -0
  73. package/src/common/chat-model-util.ts +44 -0
  74. package/src/common/chat-model.ts +325 -14
  75. package/src/common/chat-service.ts +17 -0
  76. package/src/common/chat-tool-request-service.ts +59 -0
  77. package/src/common/command-chat-agents.ts +4 -2
  78. package/src/common/index.ts +1 -0
  79. package/src/common/orchestrator-chat-agent.ts +17 -14
  80. package/src/common/parse-contents.spec.ts +16 -14
  81. package/src/common/parse-contents.ts +5 -4
  82. package/src/common/response-content-matcher.ts +4 -3
  83. package/src/common/universal-chat-agent.ts +10 -2
  84. package/lib/common/o1-chat-agent.d.ts +0 -13
  85. package/lib/common/o1-chat-agent.d.ts.map +0 -1
  86. package/lib/common/o1-chat-agent.js +0 -45
  87. package/lib/common/o1-chat-agent.js.map +0 -1
  88. package/src/common/o1-chat-agent.ts +0 -51
@@ -35,20 +35,21 @@ exports.CommandContentMatcher = {
35
35
  return new CommandChatResponseContentImpl(code.trim());
36
36
  }
37
37
  };
38
+ const fakeRequest = {};
38
39
  describe('parseContents', () => {
39
40
  it('should parse code content', () => {
40
41
  const text = '```typescript\nconsole.log("Hello World");\n```';
41
- const result = (0, parse_contents_1.parseContents)(text);
42
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
42
43
  (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript')]);
43
44
  });
44
45
  it('should parse markdown content', () => {
45
46
  const text = 'Hello **World**';
46
- const result = (0, parse_contents_1.parseContents)(text);
47
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
47
48
  (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**')]);
48
49
  });
49
50
  it('should parse multiple content blocks', () => {
50
51
  const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**';
51
- const result = (0, parse_contents_1.parseContents)(text);
52
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
52
53
  (0, chai_1.expect)(result).to.deep.equal([
53
54
  new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
54
55
  new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**')
@@ -56,7 +57,7 @@ describe('parseContents', () => {
56
57
  });
57
58
  it('should parse multiple content blocks with different languages', () => {
58
59
  const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")\n```';
59
- const result = (0, parse_contents_1.parseContents)(text);
60
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
60
61
  (0, chai_1.expect)(result).to.deep.equal([
61
62
  new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
62
63
  new chat_model_1.CodeChatResponseContentImpl('print("Hello World")', 'python')
@@ -64,7 +65,7 @@ describe('parseContents', () => {
64
65
  });
65
66
  it('should parse multiple content blocks with different languages and markdown', () => {
66
67
  const text = '```typescript\nconsole.log("Hello World");\n```\nHello **World**\n```python\nprint("Hello World")\n```';
67
- const result = (0, parse_contents_1.parseContents)(text);
68
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
68
69
  (0, chai_1.expect)(result).to.deep.equal([
69
70
  new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
70
71
  new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
@@ -73,7 +74,7 @@ describe('parseContents', () => {
73
74
  });
74
75
  it('should parse content blocks with empty content', () => {
75
76
  const text = '```typescript\n```\nHello **World**\n```python\nprint("Hello World")\n```';
76
- const result = (0, parse_contents_1.parseContents)(text);
77
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
77
78
  (0, chai_1.expect)(result).to.deep.equal([
78
79
  new chat_model_1.CodeChatResponseContentImpl('', 'typescript'),
79
80
  new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
@@ -82,7 +83,7 @@ describe('parseContents', () => {
82
83
  });
83
84
  it('should parse content with markdown, code, and markdown', () => {
84
85
  const text = 'Hello **World**\n```typescript\nconsole.log("Hello World");\n```\nGoodbye **World**';
85
- const result = (0, parse_contents_1.parseContents)(text);
86
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
86
87
  (0, chai_1.expect)(result).to.deep.equal([
87
88
  new chat_model_1.MarkdownChatResponseContentImpl('Hello **World**\n'),
88
89
  new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
@@ -91,22 +92,22 @@ describe('parseContents', () => {
91
92
  });
92
93
  it('should handle text with no special content', () => {
93
94
  const text = 'Just some plain text.';
94
- const result = (0, parse_contents_1.parseContents)(text);
95
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
95
96
  (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('Just some plain text.')]);
96
97
  });
97
98
  it('should handle text with only start code block', () => {
98
99
  const text = '```typescript\nconsole.log("Hello World");';
99
- const result = (0, parse_contents_1.parseContents)(text);
100
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
100
101
  (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('```typescript\nconsole.log("Hello World");')]);
101
102
  });
102
103
  it('should handle text with only end code block', () => {
103
104
  const text = 'console.log("Hello World");\n```';
104
- const result = (0, parse_contents_1.parseContents)(text);
105
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
105
106
  (0, chai_1.expect)(result).to.deep.equal([new chat_model_1.MarkdownChatResponseContentImpl('console.log("Hello World");\n```')]);
106
107
  });
107
108
  it('should handle text with unmatched code block', () => {
108
109
  const text = '```typescript\nconsole.log("Hello World");\n```\n```python\nprint("Hello World")';
109
- const result = (0, parse_contents_1.parseContents)(text);
110
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
110
111
  (0, chai_1.expect)(result).to.deep.equal([
111
112
  new chat_model_1.CodeChatResponseContentImpl('console.log("Hello World");', 'typescript'),
112
113
  new chat_model_1.MarkdownChatResponseContentImpl('\n```python\nprint("Hello World")')
@@ -114,14 +115,14 @@ describe('parseContents', () => {
114
115
  });
115
116
  it('should parse code block without newline after language', () => {
116
117
  const text = '```typescript console.log("Hello World");```';
117
- const result = (0, parse_contents_1.parseContents)(text);
118
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest);
118
119
  (0, chai_1.expect)(result).to.deep.equal([
119
120
  new chat_model_1.MarkdownChatResponseContentImpl('```typescript console.log("Hello World");```')
120
121
  ]);
121
122
  });
122
123
  it('should parse with matches of multiple different matchers and default', () => {
123
124
  const text = '<command>\nMY_SPECIAL_COMMAND\n</command>\nHello **World**\n```python\nprint("Hello World")\n```\n<command>\nMY_SPECIAL_COMMAND2\n</command>';
124
- const result = (0, parse_contents_1.parseContents)(text, [response_content_matcher_1.CodeContentMatcher, exports.CommandContentMatcher]);
125
+ const result = (0, parse_contents_1.parseContents)(text, fakeRequest, [response_content_matcher_1.CodeContentMatcher, exports.CommandContentMatcher]);
125
126
  (0, chai_1.expect)(result).to.deep.equal([
126
127
  new CommandChatResponseContentImpl('MY_SPECIAL_COMMAND'),
127
128
  new chat_model_1.MarkdownChatResponseContentImpl('\nHello **World**\n'),
@@ -1 +1 @@
1
- {"version":3,"file":"parse-contents.spec.js","sourceRoot":"","sources":["../../src/common/parse-contents.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,+BAA8B;AAC9B,6CAAiH;AACjH,qDAAiD;AACjD,yEAAwF;AAExF,MAAa,8BAA8B;IACvC,YAA4B,OAAe;QAAf,YAAO,GAAP,OAAO,CAAQ;QAC3C,SAAI,GAAG,SAAS,CAAC;IAD8B,CAAC;CAEnD;AAHD,wEAGC;AAEY,QAAA,qBAAqB,GAA2B;IACzD,KAAK,EAAE,cAAc;IACrB,GAAG,EAAE,gBAAgB;IAC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C9D,MAAM,IAAI,GAAG,8CAA8C,CAAC;QAC5D,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,4CAA+B,CAAC,8CAA8C,CAAC;SACtF,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sEAAsE,EAAE,GAAG,EAAE;QAC5E,MAAM,IAAI,GAAG,8IAA8I,CAAC;QAC5J,MAAM,MAAM,GAAG,IAAA,8BAAa,EAAC,IAAI,EAAE,WAAW,EAAE,CAAC,6CAAkB,EAAE,6BAAqB,CAAC,CAAC,CAAC;QAC7F,IAAA,aAAM,EAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzB,IAAI,8BAA8B,CAAC,oBAAoB,CAAC;YACxD,IAAI,4CAA+B,CAAC,qBAAqB,CAAC;YAC1D,IAAI,wCAA2B,CAAC,sBAAsB,EAAE,QAAQ,CAAC;YACjE,IAAI,8BAA8B,CAAC,qBAAqB,CAAC;SAC5D,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
- import { ChatResponseContent } from './chat-model';
2
- export type ResponseContentFactory = (content: string) => ChatResponseContent;
1
+ import { ChatRequestModelImpl, ChatResponseContent } from './chat-model';
2
+ export type ResponseContentFactory = (content: string, request: ChatRequestModelImpl) => ChatResponseContent;
3
3
  export declare const MarkdownContentFactory: ResponseContentFactory;
4
4
  /**
5
5
  * Default response content factory used if no other `ResponseContentMatcher` applies.
@@ -8,7 +8,7 @@ export declare const MarkdownContentFactory: ResponseContentFactory;
8
8
  * @see MarkdownChatResponseContentImpl
9
9
  */
10
10
  export declare class DefaultResponseContentFactory {
11
- create(content: string): ChatResponseContent;
11
+ create(content: string, request: ChatRequestModelImpl): ChatResponseContent;
12
12
  }
13
13
  /**
14
14
  * Clients can contribute response content matchers to parse a chat response into specific
@@ -1 +1 @@
1
- {"version":3,"file":"response-content-matcher.d.ts","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,mBAAmB,EAGtB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,mBAAmB,CAAC;AAE9E,eAAO,MAAM,sBAAsB,EAAE,sBACW,CAAC;AAEjD;;;;;GAKG;AACH,qBACa,6BAA6B;IACtC,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB;CAG/C;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,cAAc,EAAE,sBAAsB,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,EAAE,sBAQhC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,8BAA8B,eAA2C,CAAC;AACvF,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CAC/C;AAED,qBACa,qCAAsC,YAAW,8BAA8B;IACxF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAwB;CACtE"}
1
+ {"version":3,"file":"response-content-matcher.d.ts","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":"AAeA,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EAGtB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,KAAK,mBAAmB,CAAC;AAE7G,eAAO,MAAM,sBAAsB,EAAE,sBACW,CAAC;AAEjD;;;;;GAKG;AACH,qBACa,6BAA6B;IACtC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,mBAAmB;CAG9E;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACnC,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,0DAA0D;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,cAAc,EAAE,sBAAsB,CAAC;CAC1C;AAED,eAAO,MAAM,kBAAkB,EAAE,sBAQhC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,8BAA8B,eAA2C,CAAC;AACvF,MAAM,WAAW,8BAA8B;IAC3C,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CAC/C;AAED,qBACa,qCAAsC,YAAW,8BAA8B;IACxF,QAAQ,CAAC,QAAQ,EAAE,sBAAsB,EAAE,CAAwB;CACtE"}
@@ -28,8 +28,8 @@ exports.MarkdownContentFactory = MarkdownContentFactory;
28
28
  * @see MarkdownChatResponseContentImpl
29
29
  */
30
30
  let DefaultResponseContentFactory = class DefaultResponseContentFactory {
31
- create(content) {
32
- return (0, exports.MarkdownContentFactory)(content);
31
+ create(content, request) {
32
+ return (0, exports.MarkdownContentFactory)(content, request);
33
33
  }
34
34
  };
35
35
  exports.DefaultResponseContentFactory = DefaultResponseContentFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"response-content-matcher.js","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,6CAIsB;AACtB,4DAA0D;AAInD,MAAM,sBAAsB,GAA2B,CAAC,OAAe,EAAE,EAAE,CAC9E,IAAI,4CAA+B,CAAC,OAAO,CAAC,CAAC;AADpC,QAAA,sBAAsB,0BACc;AAEjD;;;;;GAKG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,MAAM,CAAC,OAAe;QAClB,OAAO,IAAA,8BAAsB,EAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;CACJ,CAAA;AAJY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAIzC;AAkBY,QAAA,kBAAkB,GAA2B;IACtD,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;;QAChC,MAAM,QAAQ,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAG,CAAC,CAAC,KAAI,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,wCAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,8BAA8B,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAMhF,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QACM,aAAQ,GAA6B,CAAC,0BAAkB,CAAC,CAAC;IACvE,CAAC;CAAA,CAAA;AAFY,sFAAqC;gDAArC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAEjD"}
1
+ {"version":3,"file":"response-content-matcher.js","sourceRoot":"","sources":["../../src/common/response-content-matcher.ts"],"names":[],"mappings":";;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,6CAKsB;AACtB,4DAA0D;AAInD,MAAM,sBAAsB,GAA2B,CAAC,OAAe,EAAE,EAAE,CAC9E,IAAI,4CAA+B,CAAC,OAAO,CAAC,CAAC;AADpC,QAAA,sBAAsB,0BACc;AAEjD;;;;;GAKG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IACtC,MAAM,CAAC,OAAe,EAAE,OAA6B;QACjD,OAAO,IAAA,8BAAsB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACJ,CAAA;AAJY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CAIzC;AAkBY,QAAA,kBAAkB,GAA2B;IACtD,KAAK,EAAE,WAAW;IAClB,GAAG,EAAE,QAAQ;IACb,cAAc,EAAE,CAAC,OAAe,EAAE,EAAE;;QAChC,MAAM,QAAQ,GAAG,CAAA,MAAA,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,0CAAG,CAAC,CAAC,KAAI,EAAE,CAAC;QACvD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,IAAI,wCAA2B,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClE,CAAC;CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACU,QAAA,8BAA8B,GAAG,MAAM,CAAC,gCAAgC,CAAC,CAAC;AAMhF,IAAM,qCAAqC,GAA3C,MAAM,qCAAqC;IAA3C;QACM,aAAQ,GAA6B,CAAC,0BAAkB,CAAC,CAAC;IACvE,CAAC;CAAA,CAAA;AAFY,sFAAqC;gDAArC,qCAAqC;IADjD,IAAA,sBAAU,GAAE;GACA,qCAAqC,CAEjD"}
@@ -2,6 +2,7 @@ import { AgentSpecificVariables } from '@theia/ai-core';
2
2
  import { PromptTemplate } from '@theia/ai-core/lib/common';
3
3
  import { AbstractStreamParsingChatAgent, ChatAgent, SystemMessageDescription } from './chat-agents';
4
4
  export declare const universalTemplate: PromptTemplate;
5
+ export declare const universalTemplateVariant: PromptTemplate;
5
6
  export declare class UniversalChatAgent extends AbstractStreamParsingChatAgent implements ChatAgent {
6
7
  name: string;
7
8
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"universal-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACJ,cAAc,EAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,8BAA8B,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEpG,eAAO,MAAM,iBAAiB,EAAE,cAqD/B,CAAC;AAEF,qBACa,kBAAmB,SAAQ,8BAA+B,YAAW,SAAS;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;;cAkBjC,2BAA2B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;CAKvG"}
1
+ {"version":3,"file":"universal-chat-agent.d.ts","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EACJ,cAAc,EAChB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,8BAA8B,EAAE,SAAS,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AAEpG,eAAO,MAAM,iBAAiB,EAAE,cAuD/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,cAItC,CAAC;AAEF,qBACa,kBAAmB,SAAQ,8BAA+B,YAAW,SAAS;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,sBAAsB,EAAE,sBAAsB,EAAE,CAAC;;cAkBjC,2BAA2B,IAAI,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;CAKvG"}
@@ -15,13 +15,15 @@
15
15
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
16
  // *****************************************************************************
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.UniversalChatAgent = exports.universalTemplate = void 0;
18
+ exports.UniversalChatAgent = exports.universalTemplateVariant = exports.universalTemplate = void 0;
19
19
  const tslib_1 = require("tslib");
20
20
  const inversify_1 = require("@theia/core/shared/inversify");
21
21
  const chat_agents_1 = require("./chat-agents");
22
22
  exports.universalTemplate = {
23
23
  id: 'universal-system',
24
- template: `# Instructions
24
+ template: `{{!-- Made improvements or adaptations to this prompt template? We’d love for you to share it with the community! Contribute back here:
25
+ https://github.com/eclipse-theia/theia/discussions/new?category=prompt-template-contribution --}}
26
+ # Instructions
25
27
 
26
28
  You are an AI assistant integrated into the Theia IDE, specifically designed to help software developers by
27
29
  providing concise and accurate answers to programming-related questions. Your role is to enhance the
@@ -73,6 +75,11 @@ simple solutions.
73
75
  **Answer:** "I'm here to assist with programming-related queries. For other topics, please refer to a specialized source."
74
76
  `
75
77
  };
78
+ exports.universalTemplateVariant = {
79
+ id: 'universal-system-empty',
80
+ template: '',
81
+ variantOf: exports.universalTemplate.id,
82
+ };
76
83
  let UniversalChatAgent = class UniversalChatAgent extends chat_agents_1.AbstractStreamParsingChatAgent {
77
84
  constructor() {
78
85
  super('Universal', [{
@@ -85,7 +92,7 @@ let UniversalChatAgent = class UniversalChatAgent extends chat_agents_1.Abstract
85
92
  + 'questions the user might ask. The universal agent currently does not have any context by default, i.e. it cannot '
86
93
  + 'access the current user context or the workspace.';
87
94
  this.variables = [];
88
- this.promptTemplates = [exports.universalTemplate];
95
+ this.promptTemplates = [exports.universalTemplate, exports.universalTemplateVariant];
89
96
  this.functions = [];
90
97
  this.agentSpecificVariables = [];
91
98
  }
@@ -1 +1 @@
1
- {"version":3,"file":"universal-chat-agent.js","sourceRoot":"","sources":["../../src/common/universal-chat-agent.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAMhF,4DAA0D;AAC1D,+CAAoG;AAEvF,QAAA,iBAAiB,GAAmB;IAC9C,EAAE,EAAE,kBAAkB;IACtB,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDZ;CACA,CAAC;AAGK,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,4CAA8B;IAQnE;QACG,KAAK,CAAC,WAAW,EAAE,CAAC;gBACjB,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,eAAe;aAC7B,CAAC,EAAE,MAAM,CAAC,CAAC;QACZ,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,uFAAuF;cACrG,8GAA8G;cAC9G,mHAAmH;cACnH,mDAAmD,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,eAAe,GAAG,CAAC,yBAAiB,CAAC,CAAC;QAC3C,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC;QACpB,IAAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;IACpC,CAAC;IAEkB,KAAK,CAAC,2BAA2B;QACjD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,yBAAiB,CAAC,EAAE,CAAC,CAAC;QAChF,OAAO,cAAc,CAAC,CAAC,CAAC,sCAAwB,CAAC,0BAA0B,CAAC,cAAc,CAAC,CA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AAI,CAAC,sBAAsB,GAAG,EAAE,CAAC;IACpC,CAAC;IAEkB,KAAK,CAAC,2BAA2B;QACjD,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,yBAAiB,CAAC,EAAE,CAAC,CAAC;QAChF,OAAO,cAAc,CAAC,CAAC,CAAC,sCAAwB,CAAC,0BAA0B,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC3G,CAAC;CAEH,CAAA;AA7BY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,sBAAU,GAAE;;GACA,kBAAkB,CA6B9B"}
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@theia/ai-chat",
3
- "version": "1.55.1",
3
+ "version": "1.57.0-next.112+f4778c273",
4
4
  "description": "Theia - AI Chat Extension",
5
5
  "dependencies": {
6
- "@theia/ai-core": "1.55.1",
7
- "@theia/ai-history": "1.55.1",
8
- "@theia/core": "1.55.1",
9
- "@theia/filesystem": "1.55.1",
10
- "@theia/workspace": "1.55.1",
6
+ "@theia/ai-core": "1.57.0-next.112+f4778c273",
7
+ "@theia/ai-history": "1.57.0-next.112+f4778c273",
8
+ "@theia/core": "1.57.0-next.112+f4778c273",
9
+ "@theia/editor": "1.57.0-next.112+f4778c273",
10
+ "@theia/filesystem": "1.57.0-next.112+f4778c273",
11
+ "@theia/monaco": "1.57.0-next.112+f4778c273",
12
+ "@theia/workspace": "1.57.0-next.112+f4778c273",
11
13
  "minimatch": "^5.1.0",
12
14
  "tslib": "^2.6.2"
13
15
  },
@@ -45,10 +47,10 @@
45
47
  "watch": "theiaext watch"
46
48
  },
47
49
  "devDependencies": {
48
- "@theia/ext-scripts": "1.55.1"
50
+ "@theia/ext-scripts": "1.58.0"
49
51
  },
50
52
  "nyc": {
51
53
  "extends": "../../configs/nyc.json"
52
54
  },
53
- "gitHead": "be4713a778be16ba831af63a6fbd43b2301e882d"
55
+ "gitHead": "f4778c2737bb75613f0e1f99da8996bad91f6e17"
54
56
  }
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { Agent, AgentService, AIVariableContribution } from '@theia/ai-core/lib/common';
18
- import { bindContributionProvider } from '@theia/core';
18
+ import { bindContributionProvider, ResourceResolver } from '@theia/core';
19
19
  import { FrontendApplicationContribution, PreferenceContribution } from '@theia/core/lib/browser';
20
20
  import { ContainerModule } from '@theia/core/shared/inversify';
21
21
  import {
@@ -34,15 +34,20 @@ import { OrchestratorChatAgent, OrchestratorChatAgentId } from '../common/orches
34
34
  import { DefaultResponseContentFactory, DefaultResponseContentMatcherProvider, ResponseContentMatcherProvider } from '../common/response-content-matcher';
35
35
  import { UniversalChatAgent } from '../common/universal-chat-agent';
36
36
  import { aiChatPreferences } from './ai-chat-preferences';
37
+ import { ChangeSetElementArgs, ChangeSetFileElement, ChangeSetFileElementFactory } from './change-set-file-element';
37
38
  import { AICustomAgentsFrontendApplicationContribution } from './custom-agent-frontend-application-contribution';
38
39
  import { FrontendChatServiceImpl } from './frontend-chat-service';
39
40
  import { CustomAgentFactory } from './custom-agent-factory';
40
- import { O1ChatAgent } from '../common/o1-chat-agent';
41
+ import { ChatToolRequestService } from '../common/chat-tool-request-service';
42
+ import { ChangeSetFileResourceResolver } from './change-set-file-resource';
43
+ import { ChangeSetFileService } from './change-set-file-service';
41
44
 
42
45
  export default new ContainerModule(bind => {
43
46
  bindContributionProvider(bind, Agent);
44
47
  bindContributionProvider(bind, ChatAgent);
45
48
 
49
+ bind(ChatToolRequestService).toSelf().inSingletonScope();
50
+
46
51
  bind(ChatAgentServiceImpl).toSelf().inSingletonScope();
47
52
  bind(ChatAgentService).toService(ChatAgentServiceImpl);
48
53
  bind(DefaultChatAgentId).toConstantValue({ id: OrchestratorChatAgentId });
@@ -64,10 +69,6 @@ export default new ContainerModule(bind => {
64
69
  bind(Agent).toService(OrchestratorChatAgent);
65
70
  bind(ChatAgent).toService(OrchestratorChatAgent);
66
71
 
67
- bind(O1ChatAgent).toSelf().inSingletonScope();
68
- bind(Agent).toService(O1ChatAgent);
69
- bind(ChatAgent).toService(O1ChatAgent);
70
-
71
72
  bind(UniversalChatAgent).toSelf().inSingletonScope();
72
73
  bind(Agent).toService(UniversalChatAgent);
73
74
  bind(ChatAgent).toService(UniversalChatAgent);
@@ -95,4 +96,14 @@ export default new ContainerModule(bind => {
95
96
  return agent;
96
97
  });
97
98
  bind(FrontendApplicationContribution).to(AICustomAgentsFrontendApplicationContribution).inSingletonScope();
99
+
100
+ bind(ChangeSetFileService).toSelf().inSingletonScope();
101
+ bind(ChangeSetFileElementFactory).toFactory(ctx => (args: ChangeSetElementArgs) => {
102
+ const container = ctx.container.createChild();
103
+ container.bind(ChangeSetElementArgs).toConstantValue(args);
104
+ container.bind(ChangeSetFileElement).toSelf().inSingletonScope();
105
+ return container.get(ChangeSetFileElement);
106
+ });
107
+ bind(ChangeSetFileResourceResolver).toSelf().inSingletonScope();
108
+ bind(ResourceResolver).toService(ChangeSetFileResourceResolver);
98
109
  });
@@ -0,0 +1,137 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { URI } from '@theia/core';
18
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
19
+ import { ChangeSetElement, ChangeSetImpl } from '../common';
20
+ import { createChangeSetFileUri } from './change-set-file-resource';
21
+ import { ChangeSetFileService } from './change-set-file-service';
22
+
23
+ export const ChangeSetFileElementFactory = Symbol('ChangeSetFileElementFactory');
24
+ export type ChangeSetFileElementFactory = (elementProps: ChangeSetElementArgs) => ChangeSetFileElement;
25
+
26
+ export const ChangeSetElementArgs = Symbol('ChangeSetElementArgs');
27
+ export interface ChangeSetElementArgs extends Partial<ChangeSetElement> {
28
+ /** The URI of the element, expected to be unique within the same change set. */
29
+ uri: URI;
30
+ /** The change set containing this element. */
31
+ changeSet: ChangeSetImpl;
32
+ /** The id of the chat session containing this change set element. */
33
+ chatSessionId: string;
34
+ /**
35
+ * The state of the file after the changes have been applied.
36
+ * If `undefined`, there is no change.
37
+ */
38
+ targetState?: string;
39
+ };
40
+
41
+ @injectable()
42
+ export class ChangeSetFileElement implements ChangeSetElement {
43
+
44
+ @inject(ChangeSetElementArgs)
45
+ protected readonly elementProps: ChangeSetElementArgs;
46
+
47
+ @inject(ChangeSetFileService)
48
+ protected readonly changeSetFileService: ChangeSetFileService;
49
+
50
+ protected _state: 'pending' | 'applied' | 'discarded' | undefined;
51
+
52
+ protected originalContent: string | undefined;
53
+
54
+ @postConstruct()
55
+ init(): void {
56
+ this.obtainOriginalContent();
57
+ }
58
+
59
+ protected async obtainOriginalContent(): Promise<void> {
60
+ this.originalContent = await this.changeSetFileService.read(this.uri);
61
+ }
62
+
63
+ get uri(): URI {
64
+ return this.elementProps.uri;
65
+ }
66
+
67
+ get changedUri(): URI {
68
+ return createChangeSetFileUri(this.elementProps.chatSessionId, this.uri);
69
+ }
70
+
71
+ get name(): string {
72
+ return this.elementProps.name ?? this.changeSetFileService.getName(this.uri);
73
+ }
74
+
75
+ get icon(): string | undefined {
76
+ return this.elementProps.icon ?? this.changeSetFileService.getIcon(this.uri);
77
+ }
78
+
79
+ get additionalInfo(): string | undefined {
80
+ return this.changeSetFileService.getAdditionalInfo(this.uri);
81
+ }
82
+
83
+ get state(): 'pending' | 'applied' | 'discarded' | undefined {
84
+ return this._state ?? this.elementProps.state;
85
+ }
86
+
87
+ protected set state(value: 'pending' | 'applied' | 'discarded' | undefined) {
88
+ this._state = value;
89
+ this.elementProps.changeSet.notifyChange();
90
+ }
91
+
92
+ get type(): 'add' | 'modify' | 'delete' | undefined {
93
+ return this.elementProps.type;
94
+ }
95
+
96
+ get data(): { [key: string]: unknown; } | undefined {
97
+ return this.elementProps.data;
98
+ };
99
+
100
+ get targetState(): string {
101
+ return this.elementProps.targetState ?? '';
102
+ }
103
+
104
+ async open(): Promise<void> {
105
+ this.changeSetFileService.open(this);
106
+ }
107
+
108
+ async openChange(): Promise<void> {
109
+ this.changeSetFileService.openDiff(
110
+ this.uri,
111
+ this.changedUri
112
+ );
113
+ }
114
+
115
+ async accept(contents?: string): Promise<void> {
116
+ this.state = 'applied';
117
+ if (this.type === 'delete') {
118
+ await this.changeSetFileService.delete(this.uri);
119
+ this.state = 'applied';
120
+ return;
121
+ }
122
+
123
+ await this.changeSetFileService.write(this.uri, contents !== undefined ? contents : this.targetState);
124
+ }
125
+
126
+ async discard(): Promise<void> {
127
+ this.state = 'discarded';
128
+ if (this.type === 'add') {
129
+ await this.changeSetFileService.delete(this.uri);
130
+ return;
131
+ }
132
+ if (this.originalContent) {
133
+ await this.changeSetFileService.write(this.uri, this.originalContent);
134
+ }
135
+ }
136
+
137
+ }
@@ -0,0 +1,74 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2025 EclipseSource GmbH.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Resource, ResourceResolver, ResourceSaveOptions, URI } from '@theia/core';
18
+ import { inject, injectable } from '@theia/core/shared/inversify';
19
+ import { ChatService } from '../common';
20
+ import { ChangeSetFileElement } from './change-set-file-element';
21
+
22
+ export const CHANGE_SET_FILE_RESOURCE_SCHEME = 'changeset-file';
23
+ const QUERY = 'uri=';
24
+
25
+ export function createChangeSetFileUri(chatSessionId: string, elementUri: URI): URI {
26
+ return new URI(CHANGE_SET_FILE_RESOURCE_SCHEME + '://' + chatSessionId + '/' + elementUri.path).withQuery(QUERY + encodeURIComponent(elementUri.path.toString()));
27
+ }
28
+
29
+ /**
30
+ * A file resource within a chat's change set can be resolved with the following URI:
31
+ * changeset-file:/<chat-session-id>?uri=<element-uri-without-scheme>
32
+ */
33
+ @injectable()
34
+ export class ChangeSetFileResourceResolver implements ResourceResolver {
35
+
36
+ @inject(ChatService)
37
+ protected readonly chatService: ChatService;
38
+
39
+ async resolve(uri: URI): Promise<Resource> {
40
+ if (uri.scheme !== CHANGE_SET_FILE_RESOURCE_SCHEME) {
41
+ throw new Error('The given uri is not a change set file uri: ' + uri);
42
+ }
43
+
44
+ const chatSessionId = uri.authority;
45
+ const session = this.chatService.getSession(chatSessionId);
46
+ if (!session) {
47
+ throw new Error('Chat session not found: ' + chatSessionId);
48
+ }
49
+
50
+ const changeSet = session.model.changeSet;
51
+ if (!changeSet) {
52
+ throw new Error('Chat session has no change set: ' + chatSessionId);
53
+ }
54
+
55
+ const fileUri = decodeURIComponent(uri.query.toString().replace(QUERY, ''));
56
+ const element = changeSet.getElements().find(e => e.uri.path.toString() === fileUri);
57
+ if (!(element instanceof ChangeSetFileElement)) {
58
+ throw new Error('Change set element not found: ' + fileUri);
59
+ }
60
+
61
+ return {
62
+ uri,
63
+ readOnly: false,
64
+ initiallyDirty: true,
65
+ readContents: async () => element.targetState ?? '',
66
+ saveContents: async (content: string, options?: ResourceSaveOptions): Promise<void> => {
67
+ element.accept(content);
68
+ },
69
+ dispose: () => { }
70
+ };
71
+ }
72
+
73
+ }
74
+