@theia/ai-copilot 1.76.0-next.4 → 1.76.0-next.42

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 (150) hide show
  1. package/README.md +87 -14
  2. package/lib/browser/copilot-auth-dialog.d.ts.map +1 -1
  3. package/lib/browser/copilot-auth-dialog.js +19 -11
  4. package/lib/browser/copilot-auth-dialog.js.map +1 -1
  5. package/lib/browser/copilot-frontend-application-contribution.d.ts +21 -1
  6. package/lib/browser/copilot-frontend-application-contribution.d.ts.map +1 -1
  7. package/lib/browser/copilot-frontend-application-contribution.js +129 -26
  8. package/lib/browser/copilot-frontend-application-contribution.js.map +1 -1
  9. package/lib/common/copilot-auth-service.d.ts +27 -24
  10. package/lib/common/copilot-auth-service.d.ts.map +1 -1
  11. package/lib/common/copilot-language-models-manager.d.ts +6 -22
  12. package/lib/common/copilot-language-models-manager.d.ts.map +1 -1
  13. package/lib/common/copilot-language-models-manager.js +1 -13
  14. package/lib/common/copilot-language-models-manager.js.map +1 -1
  15. package/lib/common/copilot-preferences.d.ts +1 -0
  16. package/lib/common/copilot-preferences.d.ts.map +1 -1
  17. package/lib/common/copilot-preferences.js +24 -6
  18. package/lib/common/copilot-preferences.js.map +1 -1
  19. package/lib/common/index.d.ts +0 -1
  20. package/lib/common/index.d.ts.map +1 -1
  21. package/lib/common/index.js +0 -1
  22. package/lib/common/index.js.map +1 -1
  23. package/lib/node/copilot-auth-service-impl.d.ts +25 -16
  24. package/lib/node/copilot-auth-service-impl.d.ts.map +1 -1
  25. package/lib/node/copilot-auth-service-impl.js +67 -183
  26. package/lib/node/copilot-auth-service-impl.js.map +1 -1
  27. package/lib/node/copilot-auth-service-impl.spec.js +104 -168
  28. package/lib/node/copilot-auth-service-impl.spec.js.map +1 -1
  29. package/lib/node/copilot-backend-module.d.ts.map +1 -1
  30. package/lib/node/copilot-backend-module.js +10 -2
  31. package/lib/node/copilot-backend-module.js.map +1 -1
  32. package/lib/node/copilot-cli-auth-provider.d.ts +146 -0
  33. package/lib/node/copilot-cli-auth-provider.d.ts.map +1 -0
  34. package/lib/node/copilot-cli-auth-provider.js +430 -0
  35. package/lib/node/copilot-cli-auth-provider.js.map +1 -0
  36. package/lib/node/copilot-cli-auth-provider.spec.d.ts +2 -0
  37. package/lib/node/copilot-cli-auth-provider.spec.d.ts.map +1 -0
  38. package/lib/node/copilot-cli-auth-provider.spec.js +249 -0
  39. package/lib/node/copilot-cli-auth-provider.spec.js.map +1 -0
  40. package/lib/node/copilot-cli-locator.d.ts +120 -0
  41. package/lib/node/copilot-cli-locator.d.ts.map +1 -0
  42. package/lib/node/copilot-cli-locator.js +348 -0
  43. package/lib/node/copilot-cli-locator.js.map +1 -0
  44. package/lib/node/copilot-cli-locator.spec.d.ts +2 -0
  45. package/lib/node/copilot-cli-locator.spec.d.ts.map +1 -0
  46. package/lib/node/copilot-cli-locator.spec.js +327 -0
  47. package/lib/node/copilot-cli-locator.spec.js.map +1 -0
  48. package/lib/node/copilot-credential-store.d.ts +45 -0
  49. package/lib/node/copilot-credential-store.d.ts.map +1 -0
  50. package/lib/node/copilot-credential-store.js +96 -0
  51. package/lib/node/copilot-credential-store.js.map +1 -0
  52. package/lib/node/copilot-credential-store.spec.d.ts +2 -0
  53. package/lib/node/copilot-credential-store.spec.d.ts.map +1 -0
  54. package/lib/node/copilot-credential-store.spec.js +93 -0
  55. package/lib/node/copilot-credential-store.spec.js.map +1 -0
  56. package/lib/node/copilot-language-models-manager-impl.d.ts +44 -20
  57. package/lib/node/copilot-language-models-manager-impl.d.ts.map +1 -1
  58. package/lib/node/copilot-language-models-manager-impl.js +112 -65
  59. package/lib/node/copilot-language-models-manager-impl.js.map +1 -1
  60. package/lib/node/copilot-language-models-manager-impl.spec.d.ts +2 -0
  61. package/lib/node/copilot-language-models-manager-impl.spec.d.ts.map +1 -0
  62. package/lib/node/copilot-language-models-manager-impl.spec.js +162 -0
  63. package/lib/node/copilot-language-models-manager-impl.spec.js.map +1 -0
  64. package/lib/node/copilot-runtime-env.d.ts +20 -0
  65. package/lib/node/copilot-runtime-env.d.ts.map +1 -0
  66. package/lib/node/copilot-runtime-env.js +49 -0
  67. package/lib/node/copilot-runtime-env.js.map +1 -0
  68. package/lib/node/copilot-sdk-client-provider.d.ts +103 -0
  69. package/lib/node/copilot-sdk-client-provider.d.ts.map +1 -0
  70. package/lib/node/copilot-sdk-client-provider.js +247 -0
  71. package/lib/node/copilot-sdk-client-provider.js.map +1 -0
  72. package/lib/node/copilot-sdk-client-provider.spec.d.ts +2 -0
  73. package/lib/node/copilot-sdk-client-provider.spec.d.ts.map +1 -0
  74. package/lib/node/copilot-sdk-client-provider.spec.js +215 -0
  75. package/lib/node/copilot-sdk-client-provider.spec.js.map +1 -0
  76. package/lib/node/copilot-sdk-language-model.d.ts +85 -0
  77. package/lib/node/copilot-sdk-language-model.d.ts.map +1 -0
  78. package/lib/node/copilot-sdk-language-model.js +301 -0
  79. package/lib/node/copilot-sdk-language-model.js.map +1 -0
  80. package/lib/node/copilot-sdk-language-model.spec.d.ts +2 -0
  81. package/lib/node/copilot-sdk-language-model.spec.d.ts.map +1 -0
  82. package/lib/node/copilot-sdk-language-model.spec.js +315 -0
  83. package/lib/node/copilot-sdk-language-model.spec.js.map +1 -0
  84. package/lib/node/copilot-sdk-loader.d.ts +57 -0
  85. package/lib/node/copilot-sdk-loader.d.ts.map +1 -0
  86. package/lib/node/copilot-sdk-loader.js +133 -0
  87. package/lib/node/copilot-sdk-loader.js.map +1 -0
  88. package/lib/node/copilot-sdk-loader.spec.d.ts +2 -0
  89. package/lib/node/copilot-sdk-loader.spec.d.ts.map +1 -0
  90. package/lib/node/copilot-sdk-loader.spec.js +113 -0
  91. package/lib/node/copilot-sdk-loader.spec.js.map +1 -0
  92. package/lib/node/copilot-sdk-mappers.d.ts +54 -0
  93. package/lib/node/copilot-sdk-mappers.d.ts.map +1 -0
  94. package/lib/node/copilot-sdk-mappers.js +158 -0
  95. package/lib/node/copilot-sdk-mappers.js.map +1 -0
  96. package/lib/node/copilot-sdk-mappers.spec.d.ts +2 -0
  97. package/lib/node/copilot-sdk-mappers.spec.d.ts.map +1 -0
  98. package/lib/node/copilot-sdk-mappers.spec.js +168 -0
  99. package/lib/node/copilot-sdk-mappers.spec.js.map +1 -0
  100. package/lib/node/copilot-sdk-types.d.ts +208 -0
  101. package/lib/node/copilot-sdk-types.d.ts.map +1 -0
  102. package/lib/{common/copilot-oauth-config.js → node/copilot-sdk-types.js} +2 -13
  103. package/lib/node/copilot-sdk-types.js.map +1 -0
  104. package/lib/node/index.d.ts +9 -1
  105. package/lib/node/index.d.ts.map +1 -1
  106. package/lib/node/index.js +9 -1
  107. package/lib/node/index.js.map +1 -1
  108. package/package.json +4 -6
  109. package/src/browser/copilot-auth-dialog.tsx +20 -16
  110. package/src/browser/copilot-frontend-application-contribution.ts +144 -31
  111. package/src/common/copilot-auth-service.ts +28 -24
  112. package/src/common/copilot-language-models-manager.ts +6 -29
  113. package/src/common/copilot-preferences.ts +24 -5
  114. package/src/common/index.ts +0 -1
  115. package/src/node/copilot-auth-service-impl.spec.ts +122 -207
  116. package/src/node/copilot-auth-service-impl.ts +63 -218
  117. package/src/node/copilot-backend-module.ts +11 -2
  118. package/src/node/copilot-cli-auth-provider.spec.ts +315 -0
  119. package/src/node/copilot-cli-auth-provider.ts +444 -0
  120. package/src/node/copilot-cli-locator.spec.ts +386 -0
  121. package/src/node/copilot-cli-locator.ts +363 -0
  122. package/src/node/copilot-credential-store.spec.ts +106 -0
  123. package/src/node/copilot-credential-store.ts +99 -0
  124. package/src/node/copilot-language-models-manager-impl.spec.ts +188 -0
  125. package/src/node/copilot-language-models-manager-impl.ts +131 -84
  126. package/src/node/copilot-runtime-env.ts +46 -0
  127. package/src/node/copilot-sdk-client-provider.spec.ts +253 -0
  128. package/src/node/copilot-sdk-client-provider.ts +241 -0
  129. package/src/node/copilot-sdk-language-model.spec.ts +377 -0
  130. package/src/node/copilot-sdk-language-model.ts +330 -0
  131. package/src/node/copilot-sdk-loader.spec.ts +126 -0
  132. package/src/node/copilot-sdk-loader.ts +142 -0
  133. package/src/node/copilot-sdk-mappers.spec.ts +190 -0
  134. package/src/node/copilot-sdk-mappers.ts +172 -0
  135. package/src/node/copilot-sdk-types.ts +290 -0
  136. package/src/node/index.ts +9 -1
  137. package/lib/common/copilot-oauth-config.d.ts +0 -33
  138. package/lib/common/copilot-oauth-config.d.ts.map +0 -1
  139. package/lib/common/copilot-oauth-config.js.map +0 -1
  140. package/lib/node/copilot-language-model.d.ts +0 -34
  141. package/lib/node/copilot-language-model.d.ts.map +0 -1
  142. package/lib/node/copilot-language-model.js +0 -236
  143. package/lib/node/copilot-language-model.js.map +0 -1
  144. package/lib/node/copilot-language-model.spec.d.ts +0 -2
  145. package/lib/node/copilot-language-model.spec.d.ts.map +0 -1
  146. package/lib/node/copilot-language-model.spec.js +0 -89
  147. package/lib/node/copilot-language-model.spec.js.map +0 -1
  148. package/src/common/copilot-oauth-config.ts +0 -55
  149. package/src/node/copilot-language-model.spec.ts +0 -106
  150. package/src/node/copilot-language-model.ts +0 -273
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource GmbH and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const chai_1 = require("chai");
19
+ const path_1 = require("path");
20
+ const mock_logger_1 = require("@theia/core/lib/common/test/mock-logger");
21
+ const copilot_sdk_loader_1 = require("./copilot-sdk-loader");
22
+ /** What the loader checks for before accepting a module as the SDK. */
23
+ const usableSdk = {
24
+ CopilotClient: function CopilotClient() { },
25
+ RuntimeConnection: { forStdio: () => ({ kind: 'stdio' }) }
26
+ };
27
+ class TestableCopilotSdkLoader extends copilot_sdk_loader_1.CopilotSdkLoader {
28
+ constructor(clis) {
29
+ super();
30
+ this.clis = clis;
31
+ this.importedFromCli = [];
32
+ let call = 0;
33
+ Object.assign(this, {
34
+ logger: new mock_logger_1.MockLogger(),
35
+ cliLocator: { resolve: async () => this.clis[Math.min(call++, this.clis.length - 1)] }
36
+ });
37
+ }
38
+ async importShipped(entry) {
39
+ this.importedFromCli.push(entry);
40
+ return this.shipped;
41
+ }
42
+ importInstalled() {
43
+ if (this.installedFailure) {
44
+ throw this.installedFailure;
45
+ }
46
+ return this.installed;
47
+ }
48
+ }
49
+ describe('CopilotSdkLoader', () => {
50
+ const cli = (0, path_1.join)('/opt', 'copilot', 'copilot');
51
+ it('should load the SDK that ships with the CLI', async () => {
52
+ const loader = new TestableCopilotSdkLoader([cli]);
53
+ loader.shipped = usableSdk;
54
+ (0, chai_1.expect)(await loader.load()).to.equal(usableSdk);
55
+ (0, chai_1.expect)(loader.importedFromCli).to.deep.equal([(0, path_1.join)('/opt', 'copilot', 'copilot-sdk', 'index.js')]);
56
+ });
57
+ it('should fall back to an installed SDK when the CLI does not carry one', async () => {
58
+ const loader = new TestableCopilotSdkLoader([cli]);
59
+ loader.installed = usableSdk;
60
+ (0, chai_1.expect)(await loader.load()).to.equal(usableSdk);
61
+ });
62
+ it('should report the CLI when neither it nor an installation provides the SDK', async () => {
63
+ const loader = new TestableCopilotSdkLoader([cli]);
64
+ loader.installedFailure = new Error("Cannot find module '@github/copilot-sdk'");
65
+ try {
66
+ await loader.load();
67
+ chai_1.expect.fail('should have rejected');
68
+ }
69
+ catch (error) {
70
+ // The module resolution failure is of no use to the user, the CLI to update is.
71
+ (0, chai_1.expect)(String(error)).to.contain(cli);
72
+ (0, chai_1.expect)(String(error)).to.not.contain('Cannot find module');
73
+ }
74
+ });
75
+ it('should reject an SDK that does not provide what is used', async () => {
76
+ const loader = new TestableCopilotSdkLoader([cli]);
77
+ loader.shipped = { CopilotClient: function () { } };
78
+ try {
79
+ await loader.load();
80
+ chai_1.expect.fail('should have rejected');
81
+ }
82
+ catch (error) {
83
+ (0, chai_1.expect)(String(error)).to.contain(cli);
84
+ }
85
+ });
86
+ it('should load once for as long as the CLI stays the same', async () => {
87
+ const loader = new TestableCopilotSdkLoader([cli]);
88
+ loader.shipped = usableSdk;
89
+ await loader.load();
90
+ await loader.load();
91
+ (0, chai_1.expect)(loader.importedFromCli).to.have.lengthOf(1);
92
+ });
93
+ it('should load again when a different CLI serves the requests', async () => {
94
+ const other = (0, path_1.join)('/usr', 'local', 'copilot');
95
+ const loader = new TestableCopilotSdkLoader([cli, other]);
96
+ loader.shipped = usableSdk;
97
+ await loader.load();
98
+ await loader.load();
99
+ (0, chai_1.expect)(loader.importedFromCli).to.deep.equal([
100
+ (0, path_1.join)('/opt', 'copilot', 'copilot-sdk', 'index.js'),
101
+ (0, path_1.join)('/usr', 'local', 'copilot-sdk', 'index.js')
102
+ ]);
103
+ });
104
+ it('should not remember a failed load, since the CLI can be replaced while running', async () => {
105
+ const loader = new TestableCopilotSdkLoader([cli]);
106
+ loader.shipped = {};
107
+ await loader.load().catch(() => { });
108
+ loader.shipped = usableSdk;
109
+ (0, chai_1.expect)(await loader.load()).to.equal(usableSdk);
110
+ (0, chai_1.expect)(loader.importedFromCli).to.have.lengthOf(2);
111
+ });
112
+ });
113
+ //# sourceMappingURL=copilot-sdk-loader.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-loader.spec.js","sourceRoot":"","sources":["../../src/node/copilot-sdk-loader.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,mEAA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E,OAAO,EAAE,SAAS,CAAC,CAAC;QAC/C,MAAM,MAAM,GAAG,IAAI,wBAAwB,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,IAAA,aAAM,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACzC,IAAA,WAAI,EAAC,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,CAAC;YAClD,IAAA,WAAI,EAAC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,CAAC;SACnD,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gFAAgF,EAAE,KAAK,IAAI,EAAE;QAC5F,MAAM,MAAM,GAAG,IAAI,wBAAwB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACnD,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAkB,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;QAC3B,IAAA,aAAM,EAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChD,IAAA,aAAM,EAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { LanguageModelMessage } from '@theia/ai-core';
2
+ import type { BlobMessageAttachment, ModelInfo, SystemMessageConfig } from './copilot-sdk-types';
3
+ /**
4
+ * Selects the model IDs that should be surfaced to Theia from the list returned
5
+ * by `CopilotClient.listModels()`.
6
+ *
7
+ * Models whose policy is explicitly `disabled` are filtered out; `enabled` and
8
+ * `unconfigured` models are kept. Order is preserved and duplicates are removed.
9
+ *
10
+ * The list can name the same model both by its family and by its dated releases, and both are kept:
11
+ * the family is what the model pickers offer, while a dated release stays selectable for anyone who
12
+ * wants to pin one. This mirrors the other providers, where discovery reports every release and only
13
+ * the undated ids are featured.
14
+ */
15
+ export declare function selectSdkModelIds(models: ModelInfo[]): string[];
16
+ /**
17
+ * The result of flattening a Theia message history into a single prompt for the
18
+ * agentic Copilot SDK session.
19
+ */
20
+ export interface SdkPrompt {
21
+ /** Concatenated content of all system messages (may be empty). */
22
+ systemText: string;
23
+ /** The user-facing prompt body derived from the non-system messages. */
24
+ prompt: string;
25
+ /** Base64-encoded images pulled out of the user's messages, sent alongside the prompt. */
26
+ attachments?: BlobMessageAttachment[];
27
+ }
28
+ /**
29
+ * Flattens a Theia message history into an {@link SdkPrompt}.
30
+ *
31
+ * The Copilot SDK session is a stateful agent that accepts a single prompt
32
+ * string per `send()` call, so the full Theia history is collapsed here. System
33
+ * messages are extracted separately and become the system message of the session,
34
+ * see {@link buildSdkSystemMessage}. A lone user turn is forwarded verbatim;
35
+ * richer histories are rendered as a role-labelled transcript.
36
+ *
37
+ * Base64 user images are pulled out of the history and sent as blob attachments instead of
38
+ * being flattened into the prompt text, see {@link isAttachableImageMessage}. This is otherwise
39
+ * a lossy mapping by design, see the limitations documented in the package README, and is
40
+ * intended for single-turn requests.
41
+ */
42
+ export declare function buildSdkPrompt(messages: LanguageModelMessage[]): SdkPrompt;
43
+ /**
44
+ * Builds the system message configuration of a session from the system text of a request.
45
+ *
46
+ * The CLI is an agent with a system prompt of its own, while a Theia agent brings a complete one.
47
+ * The sections that describe who the agent is and how it should work are therefore removed, so that
48
+ * they cannot contradict the prompt of the Theia agent, and the prompt is added in their place. The
49
+ * sections that make tool calling work and the ones that carry the safety rules of the CLI are kept:
50
+ * this integration declares Theia's tools to the CLI, so the model still has to be told how to call
51
+ * them. Replacing the message as a whole would drop those as well.
52
+ */
53
+ export declare function buildSdkSystemMessage(systemText: string): SystemMessageConfig | undefined;
54
+ //# sourceMappingURL=copilot-sdk-mappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-mappers.d.ts","sourceRoot":"","sources":["../../src/node/copilot-sdk-mappers.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAkD,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtG,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAEjG;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,CAc/D;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACtB,kEAAkE;IAClE,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,0FAA0F;IAC1F,WAAW,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACzC;AA4CD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,EAAE,GAAG,SAAS,CA6B1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAczF"}
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource GmbH and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.selectSdkModelIds = selectSdkModelIds;
19
+ exports.buildSdkPrompt = buildSdkPrompt;
20
+ exports.buildSdkSystemMessage = buildSdkSystemMessage;
21
+ const ai_core_1 = require("@theia/ai-core");
22
+ /**
23
+ * Selects the model IDs that should be surfaced to Theia from the list returned
24
+ * by `CopilotClient.listModels()`.
25
+ *
26
+ * Models whose policy is explicitly `disabled` are filtered out; `enabled` and
27
+ * `unconfigured` models are kept. Order is preserved and duplicates are removed.
28
+ *
29
+ * The list can name the same model both by its family and by its dated releases, and both are kept:
30
+ * the family is what the model pickers offer, while a dated release stays selectable for anyone who
31
+ * wants to pin one. This mirrors the other providers, where discovery reports every release and only
32
+ * the undated ids are featured.
33
+ */
34
+ function selectSdkModelIds(models) {
35
+ const result = [];
36
+ const seen = new Set();
37
+ for (const model of models) {
38
+ if (!model.id || seen.has(model.id)) {
39
+ continue;
40
+ }
41
+ if (model.policy && model.policy.state === 'disabled') {
42
+ continue;
43
+ }
44
+ seen.add(model.id);
45
+ result.push(model.id);
46
+ }
47
+ return result;
48
+ }
49
+ function roleLabel(message) {
50
+ switch (message.actor) {
51
+ case 'ai':
52
+ return 'Assistant';
53
+ case 'system':
54
+ return 'System';
55
+ default:
56
+ return 'User';
57
+ }
58
+ }
59
+ /**
60
+ * Whether a message is a user image the SDK can be sent as a blob attachment.
61
+ *
62
+ * URL images are not covered: the SDK's attachments carry inline data, not a remote reference,
63
+ * and fetching the URL on the backend to inline it would add a server-side-request-forgery
64
+ * surface for what is, today, not a use case Theia exercises.
65
+ */
66
+ function isAttachableImageMessage(message) {
67
+ return ai_core_1.LanguageModelMessage.isImageMessage(message) && message.actor === 'user' && ai_core_1.ImageContent.isBase64(message.image);
68
+ }
69
+ function messageToText(message) {
70
+ if (ai_core_1.LanguageModelMessage.isTextMessage(message)) {
71
+ return message.text;
72
+ }
73
+ if (ai_core_1.LanguageModelMessage.isToolUseMessage(message)) {
74
+ return `[tool call: ${message.name} ${JSON.stringify(message.input)}]`;
75
+ }
76
+ if (ai_core_1.LanguageModelMessage.isToolResultMessage(message)) {
77
+ const content = message.content === undefined
78
+ ? ''
79
+ : (typeof message.content === 'string' ? message.content : JSON.stringify(message.content));
80
+ return `[tool result: ${content}]`;
81
+ }
82
+ if (ai_core_1.LanguageModelMessage.isImageMessage(message)) {
83
+ // Reached for URL images and non-user image messages; base64 user images are attachments instead, see buildSdkPrompt.
84
+ return '[image omitted]';
85
+ }
86
+ return '';
87
+ }
88
+ /**
89
+ * Flattens a Theia message history into an {@link SdkPrompt}.
90
+ *
91
+ * The Copilot SDK session is a stateful agent that accepts a single prompt
92
+ * string per `send()` call, so the full Theia history is collapsed here. System
93
+ * messages are extracted separately and become the system message of the session,
94
+ * see {@link buildSdkSystemMessage}. A lone user turn is forwarded verbatim;
95
+ * richer histories are rendered as a role-labelled transcript.
96
+ *
97
+ * Base64 user images are pulled out of the history and sent as blob attachments instead of
98
+ * being flattened into the prompt text, see {@link isAttachableImageMessage}. This is otherwise
99
+ * a lossy mapping by design, see the limitations documented in the package README, and is
100
+ * intended for single-turn requests.
101
+ */
102
+ function buildSdkPrompt(messages) {
103
+ const systemParts = [];
104
+ const conversation = [];
105
+ const attachments = [];
106
+ for (const message of messages) {
107
+ if (message.actor === 'system' && ai_core_1.LanguageModelMessage.isTextMessage(message)) {
108
+ systemParts.push(message.text);
109
+ }
110
+ else if (message.type === 'thinking') {
111
+ continue;
112
+ }
113
+ else if (isAttachableImageMessage(message)) {
114
+ attachments.push({ type: 'blob', data: message.image.base64data, mimeType: message.image.mimeType });
115
+ }
116
+ else {
117
+ conversation.push(message);
118
+ }
119
+ }
120
+ const systemText = systemParts.join('\n\n').trim();
121
+ let prompt;
122
+ if (conversation.length === 1 && ai_core_1.LanguageModelMessage.isTextMessage(conversation[0]) && conversation[0].actor === 'user') {
123
+ prompt = conversation[0].text;
124
+ }
125
+ else {
126
+ prompt = conversation
127
+ .map(message => `${roleLabel(message)}: ${messageToText(message)}`)
128
+ .join('\n\n')
129
+ .trim();
130
+ }
131
+ return { systemText, prompt, attachments: attachments.length > 0 ? attachments : undefined };
132
+ }
133
+ /**
134
+ * Builds the system message configuration of a session from the system text of a request.
135
+ *
136
+ * The CLI is an agent with a system prompt of its own, while a Theia agent brings a complete one.
137
+ * The sections that describe who the agent is and how it should work are therefore removed, so that
138
+ * they cannot contradict the prompt of the Theia agent, and the prompt is added in their place. The
139
+ * sections that make tool calling work and the ones that carry the safety rules of the CLI are kept:
140
+ * this integration declares Theia's tools to the CLI, so the model still has to be told how to call
141
+ * them. Replacing the message as a whole would drop those as well.
142
+ */
143
+ function buildSdkSystemMessage(systemText) {
144
+ if (!systemText) {
145
+ return undefined;
146
+ }
147
+ return {
148
+ mode: 'customize',
149
+ sections: {
150
+ identity: { action: 'remove' },
151
+ tone: { action: 'remove' },
152
+ guidelines: { action: 'remove' },
153
+ code_change_rules: { action: 'remove' }
154
+ },
155
+ content: systemText
156
+ };
157
+ }
158
+ //# sourceMappingURL=copilot-sdk-mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-mappers.js","sourceRoot":"","sources":["../../src/node/copilot-sdk-mappers.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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;;AAiBhF,8CAcC;AAuED,wCA6BC;AAYD,sDAcC;AA3JD,4CAAsG;AAGtG;;;;;;;;;;;GAWG;AACH,SAAgB,iBAAiB,CAAC,MAAmB;IACjD,MAAM,MAAM,GAAa,EAAE,CA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,CAAC;AACN,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=copilot-sdk-mappers.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-mappers.spec.d.ts","sourceRoot":"","sources":["../../src/node/copilot-sdk-mappers.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,168 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource GmbH and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const chai_1 = require("chai");
19
+ const copilot_sdk_mappers_1 = require("./copilot-sdk-mappers");
20
+ // Minimal ModelInfo factory: selectSdkModelIds only reads `id` and `policy.state`.
21
+ function model(id, state) {
22
+ return { id, policy: state ? { state } : undefined };
23
+ }
24
+ describe('copilot-sdk-mappers - selectSdkModelIds', () => {
25
+ it('keeps enabled and unconfigured models and drops disabled ones', () => {
26
+ const result = (0, copilot_sdk_mappers_1.selectSdkModelIds)([
27
+ model('gpt-4o', 'enabled'),
28
+ model('o1', 'disabled'),
29
+ model('claude', 'unconfigured'),
30
+ model('gpt-5')
31
+ ]);
32
+ (0, chai_1.expect)(result).to.deep.equal(['gpt-4o', 'claude', 'gpt-5']);
33
+ });
34
+ it('preserves order and removes duplicates', () => {
35
+ const result = (0, copilot_sdk_mappers_1.selectSdkModelIds)([
36
+ model('a', 'enabled'),
37
+ model('b', 'enabled'),
38
+ model('a', 'enabled')
39
+ ]);
40
+ (0, chai_1.expect)(result).to.deep.equal(['a', 'b']);
41
+ });
42
+ it('keeps a dated release alongside its family, so a release can be pinned', () => {
43
+ const result = (0, copilot_sdk_mappers_1.selectSdkModelIds)([
44
+ model('gpt-5'),
45
+ model('gpt-5-2026-04-17'),
46
+ model('claude-sonnet-5'),
47
+ model('claude-sonnet-5-20260514')
48
+ ]);
49
+ // Which of them the model pickers offer is decided by the favorite models service, which
50
+ // features the families; the releases stay selectable for whoever wants one.
51
+ (0, chai_1.expect)(result).to.deep.equal(['gpt-5', 'gpt-5-2026-04-17', 'claude-sonnet-5', 'claude-sonnet-5-20260514']);
52
+ });
53
+ it('keeps a dated release that is the only way to select that model', () => {
54
+ const result = (0, copilot_sdk_mappers_1.selectSdkModelIds)([model('gpt-5'), model('o5-preview-2026-03-01')]);
55
+ (0, chai_1.expect)(result).to.deep.equal(['gpt-5', 'o5-preview-2026-03-01']);
56
+ });
57
+ it('keeps a dated release whose family is disabled by policy', () => {
58
+ const result = (0, copilot_sdk_mappers_1.selectSdkModelIds)([model('gpt-5', 'disabled'), model('gpt-5-2026-04-17')]);
59
+ (0, chai_1.expect)(result).to.deep.equal(['gpt-5-2026-04-17']);
60
+ });
61
+ it('returns an empty list when given no models', () => {
62
+ (0, chai_1.expect)((0, copilot_sdk_mappers_1.selectSdkModelIds)([])).to.deep.equal([]);
63
+ });
64
+ });
65
+ describe('copilot-sdk-mappers - buildSdkPrompt', () => {
66
+ it('forwards a lone user turn verbatim with no system text', () => {
67
+ const messages = [
68
+ { actor: 'user', type: 'text', text: 'hello world' }
69
+ ];
70
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
71
+ (0, chai_1.expect)(result.systemText).to.equal('');
72
+ (0, chai_1.expect)(result.prompt).to.equal('hello world');
73
+ });
74
+ it('extracts and concatenates system messages', () => {
75
+ const messages = [
76
+ { actor: 'system', type: 'text', text: 'You are helpful.' },
77
+ { actor: 'system', type: 'text', text: 'Be concise.' },
78
+ { actor: 'user', type: 'text', text: 'hi' }
79
+ ];
80
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
81
+ (0, chai_1.expect)(result.systemText).to.equal('You are helpful.\n\nBe concise.');
82
+ (0, chai_1.expect)(result.prompt).to.equal('hi');
83
+ });
84
+ it('renders a multi-message history as a role-labelled transcript', () => {
85
+ const messages = [
86
+ { actor: 'user', type: 'text', text: 'first' },
87
+ { actor: 'ai', type: 'text', text: 'reply' },
88
+ { actor: 'user', type: 'text', text: 'second' }
89
+ ];
90
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
91
+ (0, chai_1.expect)(result.prompt).to.equal('User: first\n\nAssistant: reply\n\nUser: second');
92
+ });
93
+ it('drops thinking messages from the conversation body', () => {
94
+ const messages = [
95
+ { actor: 'ai', type: 'thinking', thinking: 'internal', signature: 's' },
96
+ { actor: 'user', type: 'text', text: 'only user' }
97
+ ];
98
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
99
+ (0, chai_1.expect)(result.prompt).to.equal('only user');
100
+ });
101
+ it('summarises tool use and tool result messages in the transcript', () => {
102
+ const messages = [
103
+ { actor: 'user', type: 'text', text: 'run it' },
104
+ { actor: 'ai', type: 'tool_use', id: 'call_1', name: 'foo', input: { x: 1 } },
105
+ { actor: 'user', type: 'tool_result', tool_use_id: 'call_1', name: 'foo', content: 'done' }
106
+ ];
107
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
108
+ (0, chai_1.expect)(result.prompt).to.equal('User: run it\n\nAssistant: [tool call: foo {"x":1}]\n\nUser: [tool result: done]');
109
+ });
110
+ it('turns a base64 user image into a blob attachment and drops it from the prompt text', () => {
111
+ const messages = [
112
+ { actor: 'user', type: 'text', text: 'what is this?' },
113
+ { actor: 'user', type: 'image', image: { base64data: 'aGk=', mimeType: 'image/png' } }
114
+ ];
115
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
116
+ (0, chai_1.expect)(result.prompt).to.equal('what is this?');
117
+ (0, chai_1.expect)(result.attachments).to.deep.equal([{ type: 'blob', data: 'aGk=', mimeType: 'image/png' }]);
118
+ });
119
+ it('collects multiple base64 images in message order', () => {
120
+ const messages = [
121
+ { actor: 'user', type: 'image', image: { base64data: 'AAA=', mimeType: 'image/png' } },
122
+ { actor: 'user', type: 'image', image: { base64data: 'BBB=', mimeType: 'image/jpeg' } }
123
+ ];
124
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
125
+ (0, chai_1.expect)(result.attachments).to.deep.equal([
126
+ { type: 'blob', data: 'AAA=', mimeType: 'image/png' },
127
+ { type: 'blob', data: 'BBB=', mimeType: 'image/jpeg' }
128
+ ]);
129
+ });
130
+ it('leaves attachments undefined when there are no images', () => {
131
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)([{ actor: 'user', type: 'text', text: 'hi' }]);
132
+ (0, chai_1.expect)(result.attachments).to.be.undefined;
133
+ });
134
+ it('does not attach a URL image and renders it as an omitted placeholder instead', () => {
135
+ const messages = [
136
+ { actor: 'user', type: 'text', text: 'look' },
137
+ { actor: 'user', type: 'image', image: { url: 'https://example.com/a.png' } }
138
+ ];
139
+ const result = (0, copilot_sdk_mappers_1.buildSdkPrompt)(messages);
140
+ (0, chai_1.expect)(result.attachments).to.be.undefined;
141
+ (0, chai_1.expect)(result.prompt).to.equal('User: look\n\nUser: [image omitted]');
142
+ });
143
+ });
144
+ describe('copilot-sdk-mappers - buildSdkSystemMessage', () => {
145
+ it('carries the system text as the content of the system message', () => {
146
+ const systemMessage = (0, copilot_sdk_mappers_1.buildSdkSystemMessage)('be helpful');
147
+ (0, chai_1.expect)(systemMessage?.mode).to.equal('customize');
148
+ (0, chai_1.expect)(systemMessage?.content).to.equal('be helpful');
149
+ });
150
+ it('removes the agent instructions of the CLI that the Theia prompt replaces', () => {
151
+ const systemMessage = (0, copilot_sdk_mappers_1.buildSdkSystemMessage)('be helpful');
152
+ const sections = systemMessage?.mode === 'customize' ? systemMessage.sections : undefined;
153
+ (0, chai_1.expect)(Object.keys(sections ?? {})).to.have.members(['identity', 'tone', 'guidelines', 'code_change_rules']);
154
+ for (const section of Object.values(sections ?? {})) {
155
+ (0, chai_1.expect)(section?.action).to.equal('remove');
156
+ }
157
+ });
158
+ it('keeps the tool instructions of the CLI, which tool calling relies on', () => {
159
+ const systemMessage = (0, copilot_sdk_mappers_1.buildSdkSystemMessage)('be helpful');
160
+ const sections = systemMessage?.mode === 'customize' ? systemMessage.sections : undefined;
161
+ (0, chai_1.expect)(sections).to.not.have.property('tool_instructions');
162
+ (0, chai_1.expect)(sections).to.not.have.property('safety');
163
+ });
164
+ it('configures nothing when the request has no system text', () => {
165
+ (0, chai_1.expect)((0, copilot_sdk_mappers_1.buildSdkSystemMessage)('')).to.be.undefined;
166
+ });
167
+ });
168
+ //# sourceMappingURL=copilot-sdk-mappers.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"copilot-sdk-mappers.spec.js","sourceRoot":"","sources":["../../src/node/copilot-sdk-mappers.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,oDAAoD;AACpD,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;AAG9B,+DAAiG;AAEjG,mFAAmF;AACnF,SAAS,KAAK,CAAC,EAAU,EAAE,KAA+C;IACtE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,EAA0B,CAAC;AACjF,CAAC;AAED,QAAQ,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACrE,MAAM,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