This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/main by this push:
     new bc6a412ba0 Fixes #9169 : Support AI chat providers beyond LangChain4j, 
with GitH… (#9186)
bc6a412ba0 is described below

commit bc6a412ba0a14082d85f2a6efcaae2422373ca2b
Author: Bart Maertens <[email protected]>
AuthorDate: Mon Nov 2 15:55:24 2026 +0100

    Fixes #9169 : Support AI chat providers beyond LangChain4j, with GitH… 
(#9186)
    
    * Fixes #9169 : Support AI chat providers beyond LangChain4j, with GitHub 
Copilot
    
    Core gets provider-neutral chat types (AiChatMessage, AiChatRequest, 
AiChatResponse, IAiChatProvider) and IAiProvider flags for the options a 
provider supports. The AI Assistant and Refresh models hand requests for such a 
provider to the provider itself; Language Model Chat, Structured Extract and 
Extract Graph refuse it with a clear message.
    
    The new hop-tech-copilot plugin talks to the GitHub Copilot CLI through the 
GitHub Copilot Java SDK (MIT). Authentication stays with the CLI. The session 
gets no tools and every permission request is refused.
    
    The AI provider editor now shows a provider type's own options on a tab 
named after the type.
    
    Co-authored-by: John Ballment <[email protected]>
    
    * Issue #9169 : Ship jsr310 in the Copilot plugin, pass the provider 
timeout to the SDK, handle an empty answer
    
    ---------
    
    Co-authored-by: John Ballment <[email protected]>
---
 assemblies/plugins/pom.xml                         |   6 +
 assemblies/static/src/main/resources/LICENSE       |   6 +
 .../org/apache/hop/ai/provider/AiChatMessage.java  |  28 ++
 .../org/apache/hop/ai/provider/AiChatRequest.java  |  36 +++
 .../org/apache/hop/ai/provider/AiChatResponse.java |  27 ++
 .../apache/hop/ai/provider/IAiChatProvider.java    |  38 +++
 .../org/apache/hop/ai/provider/IAiProvider.java    |  30 ++
 .../ROOT/pages/metadata-types/ai-provider.adoc     |  46 ++-
 .../org/apache/hop/ai/engine/AiChatFactory.java    |  60 +++-
 .../apache/hop/ai/engine/AiChatModelFactory.java   |   5 +
 .../org/apache/hop/ai/engine/AiModelCatalog.java   |   5 +
 .../apache/hop/ai/metadata/AiProviderEditor.java   | 122 ++++++--
 .../ai/engine/messages/messages_en_US.properties   |   2 +
 .../apache/hop/ai/engine/AiChatFactoryTest.java    |  90 ++++++
 .../apache/hop/ai/engine/AiModelCatalogTest.java   |  37 +++
 plugins/tech/copilot/pom.xml                       |  76 +++++
 plugins/tech/copilot/src/assembly/assembly.xml     |  28 ++
 .../hop/ai/copilot/GitHubCopilotProvider.java      | 328 +++++++++++++++++++++
 .../ai/copilot/messages/messages_en_US.properties  |  23 ++
 .../hop/ai/copilot/GitHubCopilotProviderTest.java  | 135 +++++++++
 plugins/tech/pom.xml                               |   1 +
 21 files changed, 1105 insertions(+), 24 deletions(-)

diff --git a/assemblies/plugins/pom.xml b/assemblies/plugins/pom.xml
index 3e228e82f2..5ef2d02b80 100644
--- a/assemblies/plugins/pom.xml
+++ b/assemblies/plugins/pom.xml
@@ -744,6 +744,12 @@
             <version>${project.version}</version>
             <type>zip</type>
         </dependency>
+        <dependency>
+            <groupId>org.apache.hop</groupId>
+            <artifactId>hop-tech-copilot</artifactId>
+            <version>${project.version}</version>
+            <type>zip</type>
+        </dependency>
         <dependency>
             <groupId>org.apache.hop</groupId>
             <artifactId>hop-tech-ftp</artifactId>
diff --git a/assemblies/static/src/main/resources/LICENSE 
b/assemblies/static/src/main/resources/LICENSE
index d4d945bb73..6fa098345a 100644
--- a/assemblies/static/src/main/resources/LICENSE
+++ b/assemblies/static/src/main/resources/LICENSE
@@ -799,6 +799,9 @@ This product bundles content-type 2.3, which is available 
under a
 This product bundles converter-jackson 2.7.2, which is available under a
 "Apache 2.0" license. For details, see LICENSE.
 
+This product bundles copilot-sdk-java 1.0.28, which is available under a
+"The MIT" license. For details, see licenses/LICENSE-MIT.
+
 This product bundles crate-jdbc 2.7.0, which is available under a
 "Apache 2.0" license. For details, see LICENSE.
 
@@ -1564,6 +1567,9 @@ This product bundles jackson-datatype-jsr310 2.18.3, 
which is available under a
 This product bundles jackson-datatype-jsr310 2.21.2, which is available under a
 "Apache 2.0" license. For details, see LICENSE.
 
+This product bundles jackson-datatype-jsr310 2.21.7, which is available under a
+"Apache 2.0" license. For details, see LICENSE.
+
 This product bundles jackson-jaxrs-base 2.21.7, which is available under a
 "Apache 2.0" license. For details, see LICENSE.
 
diff --git a/core/src/main/java/org/apache/hop/ai/provider/AiChatMessage.java 
b/core/src/main/java/org/apache/hop/ai/provider/AiChatMessage.java
new file mode 100644
index 0000000000..3ccfa7d40b
--- /dev/null
+++ b/core/src/main/java/org/apache/hop/ai/provider/AiChatMessage.java
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.provider;
+
+/** A provider-neutral message in a chat conversation. */
+public record AiChatMessage(Role role, String content) {
+
+  public enum Role {
+    SYSTEM,
+    USER,
+    ASSISTANT
+  }
+}
diff --git a/core/src/main/java/org/apache/hop/ai/provider/AiChatRequest.java 
b/core/src/main/java/org/apache/hop/ai/provider/AiChatRequest.java
new file mode 100644
index 0000000000..fb19edda1b
--- /dev/null
+++ b/core/src/main/java/org/apache/hop/ai/provider/AiChatRequest.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.provider;
+
+import java.time.Duration;
+import java.util.List;
+
+/** A chat request that does not expose a particular model library's types. */
+public record AiChatRequest(
+    String modelName,
+    String systemPrompt,
+    String userPrompt,
+    List<AiChatMessage> conversationHistory,
+    Duration timeout,
+    boolean jsonOnly) {
+
+  public AiChatRequest {
+    conversationHistory =
+        conversationHistory == null ? List.of() : 
List.copyOf(conversationHistory);
+  }
+}
diff --git a/core/src/main/java/org/apache/hop/ai/provider/AiChatResponse.java 
b/core/src/main/java/org/apache/hop/ai/provider/AiChatResponse.java
new file mode 100644
index 0000000000..274982bb47
--- /dev/null
+++ b/core/src/main/java/org/apache/hop/ai/provider/AiChatResponse.java
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.provider;
+
+/** Provider-neutral result of a chat request. */
+public record AiChatResponse(
+    String text, Integer inputTokenCount, Integer outputTokenCount, long 
durationMs) {
+
+  public AiChatResponse {
+    text = text == null ? "" : text;
+  }
+}
diff --git a/core/src/main/java/org/apache/hop/ai/provider/IAiChatProvider.java 
b/core/src/main/java/org/apache/hop/ai/provider/IAiChatProvider.java
new file mode 100644
index 0000000000..c4ba2d8291
--- /dev/null
+++ b/core/src/main/java/org/apache/hop/ai/provider/IAiChatProvider.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.provider;
+
+import java.time.Duration;
+import java.util.List;
+import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.variables.IVariables;
+
+/**
+ * Runtime chat capability for providers that cannot be represented by a 
LangChain4j model.
+ *
+ * <p>Implementations are provider plugins and must keep 
model-library-specific types behind this
+ * interface.
+ */
+public interface IAiChatProvider {
+
+  /** Executes a chat request using the provider's native SDK or protocol. */
+  AiChatResponse chat(AiChatRequest request, IVariables variables) throws 
HopException;
+
+  /** Lists the chat model names available from this provider. */
+  List<String> listModelNames(IVariables variables, Duration timeout) throws 
HopException;
+}
diff --git a/core/src/main/java/org/apache/hop/ai/provider/IAiProvider.java 
b/core/src/main/java/org/apache/hop/ai/provider/IAiProvider.java
index 1fb8f8d899..83dd63770f 100644
--- a/core/src/main/java/org/apache/hop/ai/provider/IAiProvider.java
+++ b/core/src/main/java/org/apache/hop/ai/provider/IAiProvider.java
@@ -61,5 +61,35 @@ public interface IAiProvider extends Cloneable {
   /** Whether a non-empty API key is required before a call can be made. */
   boolean requiresApiKey();
 
+  /** Whether the provider accepts a configurable base URL. */
+  default boolean supportsBaseUrl() {
+    return true;
+  }
+
+  /** Whether the provider accepts a configurable sampling temperature. */
+  default boolean supportsTemperature() {
+    return true;
+  }
+
+  /** Whether the provider accepts a configurable context size. */
+  default boolean supportsContextSize() {
+    return true;
+  }
+
+  /** Whether the provider accepts a configurable output-token limit. */
+  default boolean supportsMaxOutputTokens() {
+    return true;
+  }
+
+  /** Whether the provider accepts a configurable thinking mode. */
+  default boolean supportsThinking() {
+    return true;
+  }
+
+  /** Whether the provider can be asked for schema-constrained answers. */
+  default boolean supportsStructuredAnswers() {
+    return true;
+  }
+
   IAiProvider clone();
 }
diff --git 
a/docs/hop-user-manual/modules/ROOT/pages/metadata-types/ai-provider.adoc 
b/docs/hop-user-manual/modules/ROOT/pages/metadata-types/ai-provider.adoc
index a4f5e0ee99..7a0c1ea297 100644
--- a/docs/hop-user-manual/modules/ROOT/pages/metadata-types/ai-provider.adoc
+++ b/docs/hop-user-manual/modules/ROOT/pages/metadata-types/ai-provider.adoc
@@ -27,7 +27,7 @@ Objects are managed in the Metadata perspective and stored as 
JSON under:
 
 `metadata/ai-provider/`
 
-Use *Refresh models* to load model ids from the provider (OpenAI-compatible 
`/models`, Anthropic and Mistral catalogs, Ollama `/api/tags`). Hugging Face 
has no list API; type a router model id. The combo stays editable so you can 
enter a name that is not in the list.
+Use *Refresh models* to load model ids from the provider (OpenAI-compatible 
`/models`, Anthropic and Mistral catalogs, Ollama `/api/tags`, or the GitHub 
Copilot CLI). Hugging Face has no list API; type a router model id. The combo 
stays editable so you can enter a name that is not in the list.
 
 Use the *Test* button in the editor to send a short health-check prompt.
 
@@ -90,10 +90,48 @@ See 
xref:pipeline/transforms/languagemodelchat.adoc#ai-provider-precedence[AI Pr
 |Dedicated inference endpoint URL, if you use one. Leave empty for the public 
inference router.
 |Router model id (for example `meta-llama/Llama-3.3-70B-Instruct`), or a 
dedicated endpoint URL if Base URL is empty
 |Yes (token)
+
+|GitHub Copilot
+|Installed Copilot CLI
+|CLI default, or select a model from *Refresh models*
+|No; uses the CLI's logged-in account
 |===
 
-OpenAI, Grok, Gemini and Custom share the OpenAI Chat Completions API.
-A GitHub Copilot-style OAuth provider is an extension point; it is not bundled.
+GitHub Copilot uses the official Java SDK to start the installed GitHub 
Copilot CLI. Install and
+sign in to the CLI as the same operating-system user that runs Hop. Hop looks 
for the CLI in this
+order: the *Copilot CLI path* field on the provider's *GitHub Copilot* tab, 
the `COPILOT_CLI_PATH`
+environment variable, then `copilot` on the `PATH`.
+Other tools install a `copilot` command too, for example the AWS Copilot CLI. 
If the error says
+`unknown flag: --server`, Hop started one of those: enter the path of the 
GitHub Copilot CLI.
+
+Authentication remains with the CLI; Hop metadata stores no GitHub token. The 
session gets no
+tools, and Hop refuses any permission request from the CLI, so an answer 
cannot run commands or
+touch files. Every question counts against the Copilot plan of the signed-in 
account.
+
+The GitHub Copilot provider works with the AI Assistant only. Language Model 
Chat, Structured
+Extract, Extract Graph and Embed Text cannot use it.
+
+=== GitHub Copilot on a server, in a container or in Hop Web
+
+On a machine without a browser, the default sign-in fails: the browser cannot 
reach the CLI's
+callback. Sign in with a device code instead, as the user that runs Hop:
+
+[source,bash]
+----
+copilot login --device-code
+----
+
+Open the URL the CLI prints, enter the code and approve. Without a system 
credential store the
+CLI asks to keep the token in a plain-text file under `~/.copilot`: answer 
yes, and keep that
+folder on a volume in a container.
+
+Instead of signing in, you can give the CLI a fine-grained personal access 
token with the
+*Copilot Requests* permission in `COPILOT_GITHUB_TOKEN`, `GH_TOKEN` or 
`GITHUB_TOKEN` (checked in
+that order). Classic tokens (`ghp_`) are not accepted.
+
+In Hop Web the CLI runs on the server, as the server's operating-system user. 
Everyone who uses
+a GitHub Copilot provider in that Hop Web uses the account the server signed 
in with, and its
+Copilot plan.
 
 == Options
 
@@ -154,7 +192,7 @@ Applies to Ollama only for now; other provider types ignore 
it.
 |Off by default.
 When checked, the AI Assistant asks the provider to hold the model to a JSON 
schema: the answer text plus a list of proposals with a known type, a risk 
level and their parameters.
 The proposals then cannot come back broken, which helps small models most.
-Works with Ollama, OpenAI, Anthropic and Mistral. Other types (Gemini, Grok, 
custom OpenAI-compatible servers, Hugging Face) answer as usual.
+Works with Ollama, OpenAI, Anthropic and Mistral. Other types (Gemini, Grok, 
custom OpenAI-compatible servers, Hugging Face and GitHub Copilot) answer as 
usual.
 When the provider refuses the schema, the question is asked again without it 
and the log says so.
 Some models write shorter answers this way: compare with and without it on the 
models you use, for example with the evaluation set described in 
xref:technology/ai/index.adoc[AI technology].
 |===
diff --git 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatFactory.java 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatFactory.java
index 2124244f6d..7684f8882c 100644
--- a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatFactory.java
+++ b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatFactory.java
@@ -33,6 +33,10 @@ import java.util.List;
 import java.util.concurrent.TimeUnit;
 import org.apache.hop.ai.metadata.AiModelRole;
 import org.apache.hop.ai.metadata.AiProvider;
+import org.apache.hop.ai.provider.AiChatMessage;
+import org.apache.hop.ai.provider.AiChatRequest;
+import org.apache.hop.ai.provider.AiChatResponse;
+import org.apache.hop.ai.provider.IAiChatProvider;
 import org.apache.hop.ai.provider.IAiProvider;
 import org.apache.hop.ai.providers.OpenAiProvider;
 import org.apache.hop.core.exception.HopException;
@@ -67,6 +71,10 @@ public final class AiChatFactory {
     if (!provider.hasProviderType()) {
       throw new AiUserException(missingTypeMessage(provider));
     }
+    if (provider.getProvider() instanceof IAiChatProvider) {
+      throw new AiUserException(
+          BaseMessages.getString(PKG, "AiChatFactory.NotLangChainProvider", 
provider.getName()));
+    }
     LanguageModelChatMeta meta = new LanguageModelChatMeta();
     meta.setDefault();
     meta.setMock(false);
@@ -116,6 +124,10 @@ public final class AiChatFactory {
       IVariables variables,
       boolean useProviderDefaults)
       throws HopException {
+    if (provider.getProvider() instanceof IAiChatProvider) {
+      throw new AiUserException(
+          BaseMessages.getString(PKG, "AiChatFactory.NotLangChainProvider", 
provider.getName()));
+    }
     if (!provider.hasProviderType()) {
       throw new AiUserException(missingTypeMessage(provider));
     }
@@ -276,6 +288,23 @@ public final class AiChatFactory {
       boolean jsonOnly)
       throws HopException {
     validate(provider);
+    if (provider.getProvider() instanceof IAiChatProvider chatProvider) {
+      AiProviderSettings settings = AiProviderSettings.of(provider, variables);
+      AiChatRequest request =
+          new AiChatRequest(
+              resolve(variables, provider.resolveModelName(AiModelRole.CHAT)),
+              systemPrompt,
+              userPrompt,
+              toProviderHistory(conversationHistory),
+              settings.timeout(),
+              jsonOnly);
+      AiChatResponse response = chatProvider.chat(request, variables);
+      return new AiChatResult(
+          response.text(),
+          positive(response.inputTokenCount()),
+          positive(response.outputTokenCount()),
+          response.durationMs());
+    }
     LanguageModelChatMeta meta = toLanguageModelChatMeta(provider, variables);
     if (jsonOnly) {
       if ("OLLAMA".equals(provider.getHopModelType())) {
@@ -331,6 +360,9 @@ public final class AiChatFactory {
       JsonSchema schema)
       throws HopException {
     validate(provider);
+    if (provider.getProvider() instanceof IAiChatProvider) {
+      return null;
+    }
     ChatModel model;
     try {
       model = AiChatModelFactory.createChatModel(provider, "", variables);
@@ -396,13 +428,13 @@ public final class AiChatFactory {
     if (provider == null) {
       throw new AiUserException(BaseMessages.getString(PKG, 
"AiChatFactory.NoProvider"));
     }
-    if (!AiLanguageModelAvailability.isAvailable()) {
-      throw new AiUserException(BaseMessages.getString(PKG, 
"AiChatFactory.NoChatPlugin"));
-    }
     if (!provider.hasProviderType()) {
       throw new AiUserException(missingTypeMessage(provider));
     }
     IAiProvider backend = provider.getProvider();
+    if (!(backend instanceof IAiChatProvider) && 
!AiLanguageModelAvailability.isAvailable()) {
+      throw new AiUserException(BaseMessages.getString(PKG, 
"AiChatFactory.NoChatPlugin"));
+    }
     if (backend.requiresApiKey() && Utils.isEmpty(provider.getApiKey())) {
       throw new AiUserException(
           BaseMessages.getString(PKG, "AiChatFactory.NoApiKey", 
provider.getName()));
@@ -437,4 +469,26 @@ public final class AiChatFactory {
     }
     return variables != null ? variables.resolve(value) : value;
   }
+
+  private static List<AiChatMessage> toProviderHistory(List<ChatMessage> 
history)
+      throws HopException {
+    List<AiChatMessage> converted = new ArrayList<>();
+    if (history == null) {
+      return converted;
+    }
+    for (ChatMessage message : history) {
+      if (message instanceof UserMessage user) {
+        converted.add(new AiChatMessage(AiChatMessage.Role.USER, 
user.singleText()));
+      } else if (message instanceof dev.langchain4j.data.message.AiMessage 
assistant) {
+        converted.add(new AiChatMessage(AiChatMessage.Role.ASSISTANT, 
assistant.text()));
+      } else if (message instanceof SystemMessage system) {
+        converted.add(new AiChatMessage(AiChatMessage.Role.SYSTEM, 
system.text()));
+      } else {
+        throw new HopException(
+            BaseMessages.getString(
+                PKG, "AiChatFactory.UnsupportedHistoryMessage", 
message.getClass().getName()));
+      }
+    }
+    return converted;
+  }
 }
diff --git 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatModelFactory.java
 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatModelFactory.java
index 390cc2b4e7..a2ea4e760d 100644
--- 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatModelFactory.java
+++ 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiChatModelFactory.java
@@ -27,6 +27,7 @@ import dev.langchain4j.model.ollama.OllamaChatModel;
 import dev.langchain4j.model.openai.OpenAiChatModel;
 import org.apache.hop.ai.metadata.AiModelRole;
 import org.apache.hop.ai.metadata.AiProvider;
+import org.apache.hop.ai.provider.IAiChatProvider;
 import org.apache.hop.ai.providers.OpenAiProvider;
 import org.apache.hop.core.exception.HopException;
 import org.apache.hop.core.util.Utils;
@@ -71,6 +72,10 @@ public final class AiChatModelFactory {
       AiProvider provider, String modelName, IVariables variables) throws 
HopException {
     // of() rejects a null or half configured provider, so there is one guard, 
not two.
     AiProviderSettings settings = AiProviderSettings.of(provider, variables);
+    if (settings.backend() instanceof IAiChatProvider) {
+      throw new AiUserException(
+          BaseMessages.getString(PKG, "AiChatFactory.NotLangChainProvider", 
provider.getName()));
+    }
 
     String model = Utils.isEmpty(modelName) ? chatModelName(provider, 
variables) : modelName;
     if (Utils.isEmpty(model)) {
diff --git 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiModelCatalog.java 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiModelCatalog.java
index eb164f8f9b..5a58eae25c 100644
--- a/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiModelCatalog.java
+++ b/plugins/tech/ai/src/main/java/org/apache/hop/ai/engine/AiModelCatalog.java
@@ -36,6 +36,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 import org.apache.hop.ai.metadata.AiProvider;
+import org.apache.hop.ai.provider.IAiChatProvider;
 import org.apache.hop.ai.provider.IAiProvider;
 import org.apache.hop.core.Const;
 import org.apache.hop.core.exception.HopException;
@@ -63,6 +64,10 @@ public final class AiModelCatalog {
       throw new AiUserException(BaseMessages.getString(PKG, 
"AiModelCatalog.NoType"));
     }
     IAiProvider backend = provider.getProvider();
+    if (backend instanceof IAiChatProvider chatProvider) {
+      return chatProvider.listModelNames(
+          variables, timeoutOf(resolve(variables, 
provider.getTimeoutSeconds())));
+    }
     String hopType = Const.NVL(backend.getHopModelType(), "OPEN_AI");
     if ("HUGGING_FACE".equals(hopType)) {
       throw new AiUserException(BaseMessages.getString(PKG, 
"AiModelCatalog.HuggingFace"));
diff --git 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/metadata/AiProviderEditor.java
 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/metadata/AiProviderEditor.java
index 94dfd7c9f7..8a76f783fa 100644
--- 
a/plugins/tech/ai/src/main/java/org/apache/hop/ai/metadata/AiProviderEditor.java
+++ 
b/plugins/tech/ai/src/main/java/org/apache/hop/ai/metadata/AiProviderEditor.java
@@ -27,6 +27,7 @@ import org.apache.hop.ai.provider.IAiProvider;
 import org.apache.hop.core.Const;
 import org.apache.hop.core.exception.HopException;
 import org.apache.hop.core.exception.HopRuntimeException;
+import org.apache.hop.core.gui.plugin.GuiRegistry;
 import org.apache.hop.core.util.Utils;
 import org.apache.hop.i18n.BaseMessages;
 import org.apache.hop.ui.core.PropsUi;
@@ -54,10 +55,28 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
 
   private static final Class<?> PKG = AiProvider.class;
 
+  /** Right after the Connection tab: a provider's own options are mostly 
about connecting. */
+  private static final String PROVIDER_OPTIONS_ORDER = "15";
+
   private Composite parent;
   private TextVar wName;
   private Combo wProviderType;
   private GuiCompositeWidgets widgets;
+
+  /** The widgets of the provider type's own options, or null when it has 
none. */
+  private GuiCompositeWidgets providerWidgets;
+
+  /** The scrolled composite that holds the tabs. */
+  private Control widgetsArea;
+
+  private final GuiCompositeWidgetsAdapter changeListener =
+      new GuiCompositeWidgetsAdapter() {
+        @Override
+        public void widgetModified(
+            GuiCompositeWidgets compositeWidgets, Control changedWidget, 
String widgetId) {
+          setChanged();
+        }
+      };
   private final AtomicBoolean busyChangingType = new AtomicBoolean(false);
 
   public AiProviderEditor(HopGui hopGui, MetadataManager<AiProvider> manager, 
AiProvider metadata) {
@@ -93,8 +112,38 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
     fdType.right = new FormAttachment(100, 0);
     wProviderType.setLayoutData(fdType);
 
-    // The fields are in tabs (Connection, Model, Models per role) that fill 
the rest of the editor;
-    // the grouped container scrolls them when the editor is small.
+    if (getMetadata().getProvider() == null && wProviderType.getItemCount() > 
0) {
+      try {
+        getMetadata().setProviderType(wProviderType.getItem(0));
+      } catch (HopException e) {
+        // Leave the combo empty; Test will explain.
+      }
+    }
+    createWidgets();
+    setWidgetsContent();
+
+    wName.addListener(SWT.Modify, e -> setChanged());
+    wProviderType.addListener(SWT.Modify, e -> changeProviderType());
+  }
+
+  /**
+   * The fields are in tabs (Connection, Model, Models per role) that fill the 
rest of the editor;
+   * the grouped container scrolls them when the editor is small. A provider 
type with options of
+   * its own, like the path of a CLI, gets a tab of its own. The tabs are 
built again when the type
+   * changes, so that tab comes and goes with the type.
+   */
+  private void createWidgets() {
+    if (widgetsArea != null && !widgetsArea.isDisposed()) {
+      widgetsArea.dispose();
+    }
+    providerWidgets = null;
+    IAiProvider backend = getMetadata().getProvider();
+    boolean hasOptions =
+        backend != null
+            && GuiRegistry.getInstance()
+                    .findGuiElements(
+                        backend.getClass().getName(), 
IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID)
+                != null;
     widgets =
         GuiCompositeWidgets.addScrolledComposite(
             parent,
@@ -102,20 +151,30 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
             wProviderType,
             null,
             AiProvider.GUI_WIDGETS_PARENT_ID,
-            getMetadata());
-
-    setWidgetsContent();
+            getMetadata(),
+            compositeWidgets -> {
+              if (hasOptions) {
+                compositeWidgets.registerExtraGroup(
+                    backend.getPluginName(),
+                    PROVIDER_OPTIONS_ORDER,
+                    null,
+                    composite -> createProviderWidgets(composite, backend));
+              }
+            });
+    // addScrolledComposite adds its scrolled composite as the last child of 
the parent.
+    Control[] children = parent.getChildren();
+    widgetsArea = children[children.length - 1];
+    widgets.setWidgetsListener(changeListener);
+    parent.layout(true, true);
+  }
 
-    wName.addListener(SWT.Modify, e -> setChanged());
-    wProviderType.addListener(SWT.Modify, e -> changeProviderType());
-    widgets.setWidgetsListener(
-        new GuiCompositeWidgetsAdapter() {
-          @Override
-          public void widgetModified(
-              GuiCompositeWidgets compositeWidgets, Control changedWidget, 
String widgetId) {
-            setChanged();
-          }
-        });
+  private void createProviderWidgets(Composite composite, IAiProvider backend) 
{
+    providerWidgets = new GuiCompositeWidgets(manager.getVariables());
+    providerWidgets.createCompositeWidgets(
+        backend, null, composite, IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID, 
null);
+    providerWidgets.setWidgetsContents(
+        backend, composite, IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID);
+    providerWidgets.setWidgetsListener(changeListener);
   }
 
   private void changeProviderType() {
@@ -130,6 +189,7 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
       if (selected != null && !selected.isEmpty()) {
         meta.setProviderType(selected);
       }
+      createWidgets();
       applyModelNameChoices(meta.getModelNameChoices(null, null));
       widgets.setWidgetsContents(meta, null, AiProvider.GUI_WIDGETS_PARENT_ID);
       updateVisibility();
@@ -151,8 +211,28 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
     }
     IAiProvider provider = getMetadata().getProvider();
     Set<String> hidden = new HashSet<>();
-    if (provider != null && !provider.requiresApiKey()) {
-      hidden.add(AiProvider.WIDGET_API_KEY);
+    if (provider != null) {
+      if (!provider.requiresApiKey()) {
+        hidden.add(AiProvider.WIDGET_API_KEY);
+      }
+      if (!provider.supportsBaseUrl()) {
+        hidden.add(AiProvider.WIDGET_BASE_URL);
+      }
+      if (!provider.supportsTemperature()) {
+        hidden.add(AiProvider.WIDGET_TEMPERATURE);
+      }
+      if (!provider.supportsContextSize()) {
+        hidden.add(AiProvider.WIDGET_CONTEXT_SIZE);
+      }
+      if (!provider.supportsMaxOutputTokens()) {
+        hidden.add(AiProvider.WIDGET_MAX_OUTPUT_TOKENS);
+      }
+      if (!provider.supportsThinking()) {
+        hidden.add(AiProvider.WIDGET_THINKING);
+      }
+      if (!provider.supportsStructuredAnswers()) {
+        hidden.add(AiProvider.WIDGET_STRUCTURED_ANSWERS);
+      }
     }
     widgets.setWidgetsHidden(getMetadata(), hidden);
     parent.layout(true, true);
@@ -173,6 +253,10 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
       wProviderType.setText(meta.getPluginName());
     }
     widgets.setWidgetsContents(meta, null, AiProvider.GUI_WIDGETS_PARENT_ID);
+    if (providerWidgets != null && meta.getProvider() != null) {
+      providerWidgets.setWidgetsContents(
+          meta.getProvider(), null, IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID);
+    }
     updateVisibility();
   }
 
@@ -180,6 +264,10 @@ public class AiProviderEditor extends 
MetadataEditor<AiProvider> {
   public void getWidgetsContent(AiProvider meta) {
     meta.setName(wName.getText());
     widgets.getWidgetsContents(meta, AiProvider.GUI_WIDGETS_PARENT_ID);
+    if (providerWidgets != null && meta.getProvider() != null) {
+      providerWidgets.getWidgetsContents(
+          meta.getProvider(), IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID);
+    }
     // A role with no model name is not a configured model. The hand-built 
grid skipped those rows.
     if (meta.getModels() != null) {
       meta.getModels().removeIf(model -> model == null || 
Utils.isEmpty(model.getModelName()));
diff --git 
a/plugins/tech/ai/src/main/resources/org/apache/hop/ai/engine/messages/messages_en_US.properties
 
b/plugins/tech/ai/src/main/resources/org/apache/hop/ai/engine/messages/messages_en_US.properties
index 8bac5f62e7..8026bb501a 100644
--- 
a/plugins/tech/ai/src/main/resources/org/apache/hop/ai/engine/messages/messages_en_US.properties
+++ 
b/plugins/tech/ai/src/main/resources/org/apache/hop/ai/engine/messages/messages_en_US.properties
@@ -38,6 +38,8 @@ AiMetadataProposalSupport.Warning.Save=Saves a new {0} 
metadata object
 AiMetadataProposalSupport.Warning.SaveNamed=Saves metadata object {0} ({1})
 AiChatFactory.NoProvider=No AI provider is selected. Create one under Metadata 
→ AI Provider, or pick one in the Provider field.
 AiChatFactory.NoChatMeta=Language Model Chat metadata is missing
+AiChatFactory.NotLangChainProvider=AI provider ''{0}'' only works with the AI 
Assistant. Use an Ollama, OpenAI, Anthropic or Mistral provider here.
+AiChatFactory.UnsupportedHistoryMessage=AI chat history contains an 
unsupported message type: {0}
 AiChatFactory.NoMetadataProvider=No metadata provider is available to load AI 
provider ''{0}''
 AiChatFactory.ProviderNotFound=AI provider ''{0}'' was not found in this 
project.
 AiChatFactory.RequestFailed=AI request failed: {0}
diff --git 
a/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiChatFactoryTest.java 
b/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiChatFactoryTest.java
index 922b6c9383..88286ee9af 100644
--- 
a/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiChatFactoryTest.java
+++ 
b/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiChatFactoryTest.java
@@ -24,13 +24,23 @@ import static org.junit.jupiter.api.Assertions.assertSame;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
+import dev.langchain4j.data.message.AiMessage;
+import dev.langchain4j.data.message.UserMessage;
+import java.time.Duration;
+import java.util.List;
 import org.apache.hop.ai.metadata.AiProvider;
+import org.apache.hop.ai.provider.AiChatMessage;
+import org.apache.hop.ai.provider.AiChatRequest;
+import org.apache.hop.ai.provider.AiChatResponse;
+import org.apache.hop.ai.provider.BaseAiProvider;
+import org.apache.hop.ai.provider.IAiChatProvider;
 import org.apache.hop.ai.providers.AnthropicProvider;
 import org.apache.hop.ai.providers.GrokProvider;
 import org.apache.hop.ai.providers.HuggingFaceProvider;
 import org.apache.hop.ai.providers.OllamaProvider;
 import org.apache.hop.ai.providers.OpenAiProvider;
 import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.variables.IVariables;
 import org.apache.hop.core.variables.Variables;
 import org.apache.hop.metadata.serializer.memory.MemoryMetadataProvider;
 import 
org.apache.hop.pipeline.transforms.languagemodelchat.LanguageModelChatMeta;
@@ -39,6 +49,67 @@ import org.junit.jupiter.api.Test;
 
 class AiChatFactoryTest {
 
+  @Test
+  void dispatchesProviderNeutralChatRequestsToNativeProvider() throws 
Exception {
+    NativeChatProvider backend = new NativeChatProvider();
+    AiProvider provider = new AiProvider();
+    backend.setPluginId("native");
+    backend.setPluginName("Native");
+    provider.setProvider(backend);
+    provider.setName("native-provider");
+    provider.setModelName("native-model");
+    provider.setTimeoutSeconds("23");
+
+    AiChatResult result =
+        AiChatFactory.generateResult(
+            provider,
+            new Variables(),
+            "system prompt",
+            "current question",
+            List.of(new UserMessage("prior question"), new AiMessage("prior 
answer")));
+
+    assertEquals("native answer", result.getText());
+    assertEquals(7, result.getDurationMs());
+    assertEquals("native-model", backend.request.modelName());
+    assertEquals("system prompt", backend.request.systemPrompt());
+    assertEquals("current question", backend.request.userPrompt());
+    assertEquals(Duration.ofSeconds(23), backend.request.timeout());
+    assertEquals(
+        List.of(
+            new AiChatMessage(AiChatMessage.Role.USER, "prior question"),
+            new AiChatMessage(AiChatMessage.Role.ASSISTANT, "prior answer")),
+        backend.request.conversationHistory());
+  }
+
+  @Test
+  void doesNotMapNativeProviderToLanguageModelChatMetadata() {
+    NativeChatProvider backend = new NativeChatProvider();
+    backend.setPluginId("native");
+    AiProvider provider = new AiProvider();
+    provider.setName("native-provider");
+    provider.setProvider(backend);
+
+    assertThrows(
+        HopException.class, () -> 
AiChatFactory.toLanguageModelChatMeta(provider, new Variables()));
+  }
+
+  /** Structured Extract and Extract Graph build their chat model here. */
+  @Test
+  void transformsCannotBuildAChatModelFromANativeProvider() {
+    NativeChatProvider backend = new NativeChatProvider();
+    backend.setPluginId("native");
+    AiProvider provider = new AiProvider();
+    provider.setName("native-provider");
+    provider.setModelName("native-model");
+    provider.setProvider(backend);
+
+    HopException error =
+        assertThrows(
+            HopException.class,
+            () -> AiChatModelFactory.createChatModel(provider, "", new 
Variables()));
+    assertTrue(error.getMessage().contains("only works with the AI 
Assistant"), error.getMessage());
+  }
+
   @Test
   void mapsOpenAiCompatibleFields() throws Exception {
     AiProvider provider = new AiProvider();
@@ -61,6 +132,25 @@ class AiChatFactoryTest {
     assertEquals(45, meta.getOpenAiTimeout());
   }
 
+  private static final class NativeChatProvider extends BaseAiProvider 
implements IAiChatProvider {
+    private AiChatRequest request;
+
+    private NativeChatProvider() {
+      setRequiresApiKey(false);
+    }
+
+    @Override
+    public AiChatResponse chat(AiChatRequest request, IVariables variables) {
+      this.request = request;
+      return new AiChatResponse("native answer", 3, 4, 7);
+    }
+
+    @Override
+    public List<String> listModelNames(IVariables variables, Duration timeout) 
{
+      return List.of("native-model");
+    }
+  }
+
   @Test
   void mapsGrokOntoOpenAi() throws Exception {
     AiProvider provider = new AiProvider();
diff --git 
a/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiModelCatalogTest.java
 
b/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiModelCatalogTest.java
index 9b0ca784ac..25a3565580 100644
--- 
a/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiModelCatalogTest.java
+++ 
b/plugins/tech/ai/src/test/java/org/apache/hop/ai/engine/AiModelCatalogTest.java
@@ -26,12 +26,18 @@ import dev.langchain4j.model.ModelProvider;
 import dev.langchain4j.model.catalog.ModelCatalog;
 import dev.langchain4j.model.catalog.ModelDescription;
 import dev.langchain4j.model.catalog.ModelType;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.List;
 import org.apache.hop.ai.metadata.AiProvider;
+import org.apache.hop.ai.provider.AiChatRequest;
+import org.apache.hop.ai.provider.AiChatResponse;
+import org.apache.hop.ai.provider.BaseAiProvider;
+import org.apache.hop.ai.provider.IAiChatProvider;
 import org.apache.hop.ai.providers.HuggingFaceProvider;
 import org.apache.hop.ai.providers.OpenAiProvider;
 import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.variables.IVariables;
 import org.junit.jupiter.api.Test;
 
 class AiModelCatalogTest {
@@ -68,6 +74,18 @@ class AiModelCatalogTest {
     assertTrue(error.getMessage().toLowerCase().contains("hugging face"));
   }
 
+  @Test
+  void delegatesModelListingToNativeProvider() throws Exception {
+    AiProvider provider = new AiProvider();
+    NativeChatProvider backend = new NativeChatProvider();
+    backend.setPluginId("native");
+    provider.setProvider(backend);
+    provider.setTimeoutSeconds("17");
+
+    assertEquals(List.of("copilot-model"), 
AiModelCatalog.listModelNames(provider, null));
+    assertEquals(Duration.ofSeconds(17), backend.timeout);
+  }
+
   @Test
   void stripOllamaV1Suffix() {
     assertEquals(
@@ -152,4 +170,23 @@ class AiModelCatalogTest {
             HopException.class, () -> AiModelCatalog.listModelNames(new 
AiProvider(), null));
     assertTrue(error.getMessage().toLowerCase().contains("provider type"));
   }
+
+  private static final class NativeChatProvider extends BaseAiProvider 
implements IAiChatProvider {
+    private Duration timeout;
+
+    private NativeChatProvider() {
+      setRequiresApiKey(false);
+    }
+
+    @Override
+    public AiChatResponse chat(AiChatRequest request, IVariables variables) {
+      return new AiChatResponse("", null, null, 0);
+    }
+
+    @Override
+    public List<String> listModelNames(IVariables variables, Duration timeout) 
{
+      this.timeout = timeout;
+      return List.of("copilot-model");
+    }
+  }
 }
diff --git a/plugins/tech/copilot/pom.xml b/plugins/tech/copilot/pom.xml
new file mode 100644
index 0000000000..822b81e2b2
--- /dev/null
+++ b/plugins/tech/copilot/pom.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.hop</groupId>
+        <artifactId>hop-plugins-tech</artifactId>
+        <version>2.21.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>hop-tech-copilot</artifactId>
+    <packaging>jar</packaging>
+    <name>Hop Plugins Technology GitHub Copilot</name>
+
+    <properties>
+        <copilot-sdk.version>1.0.28</copilot-sdk.version>
+        <hop.pluginlib.exclude1>jackson-databind</hop.pluginlib.exclude1>
+        <hop.pluginlib.exclude2>jackson-annotations</hop.pluginlib.exclude2>
+        <hop.pluginlib.exclude3>jna</hop.pluginlib.exclude3>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <!-- The SDK registers JavaTimeModule. Hop's own Jackson databind 
is loaded parent-first,
+                 so ship the module at Hop's Jackson version instead of the 
SDK's 2.22. -->
+            <groupId>com.fasterxml.jackson.datatype</groupId>
+            <artifactId>jackson-datatype-jsr310</artifactId>
+            <version>2.21.7</version>
+        </dependency>
+        <dependency>
+            <groupId>com.github</groupId>
+            <artifactId>copilot-sdk-java</artifactId>
+            <version>${copilot-sdk.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.hop</groupId>
+            <artifactId>hop-core</artifactId>
+            <version>${project.version}</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <!-- The parent list drops jackson-datatype-jsr310; 
this plugin must ship it. -->
+                        <id>stage-plugin-lib</id>
+                        <configuration>
+                            
<excludeArtifactIds>lombok,jakarta.servlet-api,${hop.pluginlib.exclude1},${hop.pluginlib.exclude2},${hop.pluginlib.exclude3}</excludeArtifactIds>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/plugins/tech/copilot/src/assembly/assembly.xml 
b/plugins/tech/copilot/src/assembly/assembly.xml
new file mode 100644
index 0000000000..7769ca894f
--- /dev/null
+++ b/plugins/tech/copilot/src/assembly/assembly.xml
@@ -0,0 +1,28 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0";
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+          xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 
http://maven.apache.org/xsd/assembly-2.2.0.xsd";>
+    <id>hop-tech-copilot</id>
+    <formats>
+        <format>zip</format>
+    </formats>
+    <baseDirectory>.</baseDirectory>
+    <componentDescriptors>
+        
<componentDescriptor>${maven.multiModuleProjectDirectory}/assemblies/shared/hop-plugin-libs.xml</componentDescriptor>
+    </componentDescriptors>
+</assembly>
diff --git 
a/plugins/tech/copilot/src/main/java/org/apache/hop/ai/copilot/GitHubCopilotProvider.java
 
b/plugins/tech/copilot/src/main/java/org/apache/hop/ai/copilot/GitHubCopilotProvider.java
new file mode 100644
index 0000000000..9bb4184b33
--- /dev/null
+++ 
b/plugins/tech/copilot/src/main/java/org/apache/hop/ai/copilot/GitHubCopilotProvider.java
@@ -0,0 +1,328 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.copilot;
+
+import com.github.copilot.CopilotClient;
+import com.github.copilot.generated.AssistantMessageEvent;
+import com.github.copilot.rpc.CopilotClientMode;
+import com.github.copilot.rpc.CopilotClientOptions;
+import com.github.copilot.rpc.MessageOptions;
+import com.github.copilot.rpc.ModelInfo;
+import com.github.copilot.rpc.PermissionHandler;
+import com.github.copilot.rpc.PermissionRequestResult;
+import com.github.copilot.rpc.SessionConfig;
+import java.nio.file.Path;
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.hop.ai.AiAuthKind;
+import org.apache.hop.ai.provider.AiChatMessage;
+import org.apache.hop.ai.provider.AiChatRequest;
+import org.apache.hop.ai.provider.AiChatResponse;
+import org.apache.hop.ai.provider.AiProviderPlugin;
+import org.apache.hop.ai.provider.BaseAiProvider;
+import org.apache.hop.ai.provider.IAiChatProvider;
+import org.apache.hop.ai.provider.IAiProvider;
+import org.apache.hop.core.exception.HopException;
+import org.apache.hop.core.gui.plugin.GuiElementType;
+import org.apache.hop.core.gui.plugin.GuiPlugin;
+import org.apache.hop.core.gui.plugin.GuiWidgetElement;
+import org.apache.hop.core.util.Utils;
+import org.apache.hop.core.variables.IVariables;
+import org.apache.hop.i18n.BaseMessages;
+import org.apache.hop.metadata.api.HopMetadataProperty;
+
+/** GitHub Copilot CLI-backed chat provider for Hop's AI Assistant. */
+@Getter
+@Setter
+@GuiPlugin(classLoaderGroup = "hop-ai-copilot")
+@AiProviderPlugin(
+    id = "github-copilot",
+    name = "GitHub Copilot",
+    description = "GitHub Copilot CLI",
+    documentationUrl = "/metadata-types/ai-provider.html",
+    classLoaderGroup = "hop-ai-copilot")
+public class GitHubCopilotProvider extends BaseAiProvider implements 
IAiChatProvider {
+
+  private static final Class<?> PKG = GitHubCopilotProvider.class;
+  private static final long DEFAULT_TIMEOUT_SECONDS = 60;
+  private static final String COPILOT_CLI_PATH = "COPILOT_CLI_PATH";
+  static final String DEFAULT_CLI_COMMAND = "copilot";
+
+  /**
+   * The session gets no tools, so nothing should ask for permission. Should 
the CLI ask anyway, the
+   * answer is no: an answer from the assistant may not run commands or touch 
files.
+   */
+  static final PermissionHandler DENY_ALL =
+      (request, invocation) ->
+          CompletableFuture.completedFuture(
+              PermissionRequestResult.reject("Hop does not allow GitHub 
Copilot to use tools."));
+
+  @HopMetadataProperty
+  @GuiWidgetElement(
+      id = "0100-copilot-cli-path",
+      order = "0100",
+      type = GuiElementType.TEXT,
+      parentId = IAiProvider.GUI_PLUGIN_ELEMENT_PARENT_ID,
+      label = "i18n::GitHubCopilotProvider.CliPath.Label",
+      toolTip = "i18n::GitHubCopilotProvider.CliPath.Tooltip")
+  private String cliPath = "";
+
+  public GitHubCopilotProvider() {
+    setAuthKind(AiAuthKind.OAUTH);
+    setRequiresApiKey(false);
+    setHopModelType("COPILOT");
+  }
+
+  @Override
+  public boolean supportsBaseUrl() {
+    return false;
+  }
+
+  @Override
+  public boolean supportsTemperature() {
+    return false;
+  }
+
+  @Override
+  public boolean supportsContextSize() {
+    return false;
+  }
+
+  @Override
+  public boolean supportsMaxOutputTokens() {
+    return false;
+  }
+
+  @Override
+  public boolean supportsThinking() {
+    return false;
+  }
+
+  @Override
+  public boolean supportsStructuredAnswers() {
+    return false;
+  }
+
+  @Override
+  public AiChatResponse chat(AiChatRequest request, IVariables variables) 
throws HopException {
+    long started = System.nanoTime();
+    long timeoutSeconds = timeoutSeconds(request);
+    try (CopilotClient client = newClient(variables)) {
+      await(client.start(), started, timeoutSeconds, "starting the Copilot 
CLI");
+      SessionConfig config = sessionConfig(request.modelName());
+      var session =
+          await(
+              client.createSession(config), started, timeoutSeconds, "creating 
a Copilot session");
+      try (session) {
+        // Without a timeout the SDK gives up after 60 seconds, whatever the 
provider says.
+        AssistantMessageEvent response =
+            await(
+                session.sendAndWait(
+                    new MessageOptions().setPrompt(prompt(request)),
+                    remainingMillis(started, timeoutSeconds)),
+                started,
+                timeoutSeconds,
+                "waiting for a Copilot response");
+        if (response == null || response.getData() == null) {
+          throw new HopException(BaseMessages.getString(PKG, 
"GitHubCopilotProvider.NoAnswer"));
+        }
+        return new AiChatResponse(
+            response.getData().content(),
+            null,
+            null,
+            TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - started));
+      }
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new HopException(BaseMessages.getString(PKG, 
"GitHubCopilotProvider.Interrupted"), e);
+    } catch (ExecutionException e) {
+      Throwable cause = e.getCause() == null ? e : e.getCause();
+      throw new HopException(
+          BaseMessages.getString(PKG, "GitHubCopilotProvider.Failed", 
e.getMessage()), cause);
+    } catch (TimeoutException e) {
+      throw timeoutError(timeoutSeconds, e);
+    }
+  }
+
+  @Override
+  public List<String> listModelNames(IVariables variables, Duration timeout) 
throws HopException {
+    long timeoutSeconds = modelListingTimeout(timeout);
+    long started = System.nanoTime();
+    try (CopilotClient client = newClient(variables)) {
+      await(client.start(), started, timeoutSeconds, "starting the Copilot 
CLI");
+      List<String> names = new ArrayList<>();
+      for (ModelInfo model :
+          await(client.listModels(), started, timeoutSeconds, "listing Copilot 
models")) {
+        if (model != null && !Utils.isEmpty(model.getId())) {
+          names.add(model.getId());
+        }
+      }
+      names.sort(String.CASE_INSENSITIVE_ORDER);
+      return names.stream().distinct().toList();
+    } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
+      throw new HopException(BaseMessages.getString(PKG, 
"GitHubCopilotProvider.Interrupted"), e);
+    } catch (ExecutionException e) {
+      Throwable cause = e.getCause() == null ? e : e.getCause();
+      throw new HopException(
+          BaseMessages.getString(PKG, "GitHubCopilotProvider.Failed", 
e.getMessage()), cause);
+    } catch (TimeoutException e) {
+      throw timeoutError(timeoutSeconds, e);
+    }
+  }
+
+  private CopilotClient newClient(IVariables variables) {
+    String copilotHome = System.getenv("COPILOT_HOME");
+    if (Utils.isEmpty(copilotHome)) {
+      copilotHome = Path.of(System.getProperty("user.home"), 
".copilot").toString();
+    }
+    String resolvedCliPath = variables == null ? cliPath : 
variables.resolve(cliPath);
+    CopilotClientOptions options =
+        clientOptions(cliCommand(resolvedCliPath, 
System.getenv(COPILOT_CLI_PATH)), copilotHome);
+    return new CopilotClient(options);
+  }
+
+  /**
+   * The CLI to start: the path in the provider, then {@code 
COPILOT_CLI_PATH}, then {@code copilot}
+   * on the PATH. Without a path the SDK looks for a runtime bundled in a jar 
that Hop does not
+   * ship.
+   */
+  static String cliCommand(String configuredPath, String environmentPath) {
+    if (!Utils.isEmpty(configuredPath)) {
+      return configuredPath;
+    }
+    if (!Utils.isEmpty(environmentPath)) {
+      return environmentPath;
+    }
+    return DEFAULT_CLI_COMMAND;
+  }
+
+  static CopilotClientOptions clientOptions(String resolvedCliPath, String 
copilotHome) {
+    CopilotClientOptions options =
+        new CopilotClientOptions()
+            .setMode(CopilotClientMode.COPILOT_CLI)
+            .setUseLoggedInUser(true)
+            .setCopilotHome(copilotHome);
+    if (!Utils.isEmpty(resolvedCliPath)) {
+      options.setCliPath(resolvedCliPath);
+    }
+    return options;
+  }
+
+  static SessionConfig sessionConfig(String modelName) {
+    SessionConfig config =
+        new SessionConfig()
+            .setAvailableTools(List.of())
+            .setEnableSessionTelemetry(false)
+            .setEnableFileChangeTracking(false)
+            .setEnableFileHooks(false)
+            .setEnableHostGitOperations(false)
+            .setEnableSessionStore(false)
+            .setEnableSkills(false)
+            .setEnableConfigDiscovery(false)
+            .setSkipCustomInstructions(true)
+            .setEnableOnDemandInstructionDiscovery(false)
+            .setEnableMcpApps(false)
+            .setOnPermissionRequest(DENY_ALL);
+    if (!Utils.isEmpty(modelName)) {
+      config.setModel(modelName);
+    }
+    return config;
+  }
+
+  private static long timeoutSeconds(AiChatRequest request) {
+    return request.timeout() == null
+        ? DEFAULT_TIMEOUT_SECONDS
+        : Math.max(1, request.timeout().getSeconds());
+  }
+
+  static long modelListingTimeout(Duration timeout) {
+    return timeout == null ? DEFAULT_TIMEOUT_SECONDS : Math.max(1, 
timeout.getSeconds());
+  }
+
+  static String prompt(AiChatRequest request) {
+    StringBuilder prompt = new StringBuilder();
+    if (!Utils.isEmpty(request.systemPrompt())) {
+      prompt.append("System 
instructions:\n").append(request.systemPrompt()).append("\n\n");
+    }
+    if (!request.conversationHistory().isEmpty()) {
+      prompt.append("Conversation so far:\n");
+      for (AiChatMessage message : request.conversationHistory()) {
+        prompt
+            .append(
+                switch (message.role()) {
+                  case SYSTEM -> "System";
+                  case USER -> "User";
+                  case ASSISTANT -> "Assistant";
+                })
+            .append(": ")
+            .append(message.content())
+            .append('\n');
+      }
+      prompt.append('\n');
+    }
+    prompt.append("Current request:\n").append(request.userPrompt());
+    if (request.jsonOnly()) {
+      prompt.append("\n\nReturn only valid JSON with no surrounding prose or 
markdown.");
+    }
+    return prompt.toString();
+  }
+
+  static <T> T await(
+      CompletableFuture<T> future, long started, long timeoutSeconds, String 
operation)
+      throws InterruptedException, ExecutionException, TimeoutException {
+    long remainingNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds) - 
(System.nanoTime() - started);
+    if (remainingNanos <= 0) {
+      throw new TimeoutException(operation);
+    }
+    try {
+      return future.get(remainingNanos, TimeUnit.NANOSECONDS);
+    } catch (ExecutionException e) {
+      Throwable cause = e.getCause() == null ? e : e.getCause();
+      if (cause instanceof TimeoutException) {
+        throw new TimeoutException(operation);
+      }
+      throw new ExecutionException(operation + ": " + cause.getMessage(), 
cause);
+    } catch (TimeoutException e) {
+      throw new TimeoutException(operation);
+    }
+  }
+
+  /** Time left in the request, at least 1 ms: the SDK reads 0 or less as no 
timeout at all. */
+  static long remainingMillis(long started, long timeoutSeconds) {
+    long elapsedMillis = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - 
started);
+    return Math.max(1, TimeUnit.SECONDS.toMillis(timeoutSeconds) - 
elapsedMillis);
+  }
+
+  private static HopException timeoutError(long timeoutSeconds, 
TimeoutException cause) {
+    return new HopException(
+        BaseMessages.getString(
+            PKG,
+            "GitHubCopilotProvider.Timeout",
+            cause.getMessage(),
+            Long.toString(timeoutSeconds)),
+        cause);
+  }
+}
diff --git 
a/plugins/tech/copilot/src/main/resources/org/apache/hop/ai/copilot/messages/messages_en_US.properties
 
b/plugins/tech/copilot/src/main/resources/org/apache/hop/ai/copilot/messages/messages_en_US.properties
new file mode 100644
index 0000000000..10e617332a
--- /dev/null
+++ 
b/plugins/tech/copilot/src/main/resources/org/apache/hop/ai/copilot/messages/messages_en_US.properties
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+GitHubCopilotProvider.CliPath.Label=Copilot CLI path
+GitHubCopilotProvider.CliPath.Tooltip=Optional path to the installed Copilot 
CLI. Leave empty to use copilot on PATH or COPILOT_CLI_PATH.
+GitHubCopilotProvider.Interrupted=The GitHub Copilot request was interrupted.
+GitHubCopilotProvider.NoAnswer=GitHub Copilot returned no answer.
+GitHubCopilotProvider.Failed=GitHub Copilot request failed: {0}
+GitHubCopilotProvider.Timeout=GitHub Copilot timed out while {0} after {1} 
seconds. Check that the Copilot CLI is installed, authenticated and available.
diff --git 
a/plugins/tech/copilot/src/test/java/org/apache/hop/ai/copilot/GitHubCopilotProviderTest.java
 
b/plugins/tech/copilot/src/test/java/org/apache/hop/ai/copilot/GitHubCopilotProviderTest.java
new file mode 100644
index 0000000000..16b364bb53
--- /dev/null
+++ 
b/plugins/tech/copilot/src/test/java/org/apache/hop/ai/copilot/GitHubCopilotProviderTest.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hop.ai.copilot;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import com.github.copilot.rpc.CopilotClientMode;
+import com.github.copilot.rpc.PermissionRequestResult;
+import java.time.Duration;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import org.apache.hop.ai.provider.AiChatMessage;
+import org.apache.hop.ai.provider.AiChatRequest;
+import org.junit.jupiter.api.Test;
+
+class GitHubCopilotProviderTest {
+
+  @Test
+  void clientUsesCliAuthenticationAndDoesNotPersistAHopCredential() {
+    var options =
+        GitHubCopilotProvider.clientOptions("C:\\tools\\copilot.exe", 
"C:\\Users\\me\\.copilot");
+
+    assertEquals(CopilotClientMode.COPILOT_CLI, options.getMode());
+    assertTrue(options.getUseLoggedInUser().orElse(false));
+    assertEquals("C:\\tools\\copilot.exe", options.getCliPath());
+    assertEquals("C:\\Users\\me\\.copilot", options.getCopilotHome());
+    assertFalse(new GitHubCopilotProvider().requiresApiKey());
+    assertFalse(new GitHubCopilotProvider().supportsStructuredAnswers());
+  }
+
+  @Test
+  void sessionDisablesToolsAndTelemetry() {
+    var config = GitHubCopilotProvider.sessionConfig("gpt-4.1");
+
+    assertEquals("gpt-4.1", config.getModel());
+    assertEquals(List.of(), config.getAvailableTools());
+    assertFalse(config.getEnableSessionTelemetry().orElse(true));
+    assertFalse(config.getEnableFileChangeTracking().orElse(true));
+    assertFalse(config.getEnableFileHooks().orElse(true));
+    assertFalse(config.getEnableHostGitOperations().orElse(true));
+    assertFalse(config.getEnableSessionStore().orElse(true));
+    assertFalse(config.getEnableSkills().orElse(true));
+    assertFalse(config.getEnableConfigDiscovery().orElse(true));
+    assertTrue(config.getSkipCustomInstructions().orElse(false));
+    assertFalse(config.getEnableOnDemandInstructionDiscovery().orElse(true));
+    assertFalse(config.isEnableMcpApps());
+    assertSame(GitHubCopilotProvider.DENY_ALL, 
config.getOnPermissionRequest());
+  }
+
+  @Test
+  void cliIsTheConfiguredPathThenTheEnvironmentThenCopilotOnThePath() {
+    assertEquals(
+        "/opt/copilot", GitHubCopilotProvider.cliCommand("/opt/copilot", 
"/usr/bin/copilot"));
+    assertEquals("/usr/bin/copilot", GitHubCopilotProvider.cliCommand("", 
"/usr/bin/copilot"));
+    assertEquals("copilot", GitHubCopilotProvider.cliCommand(null, null));
+  }
+
+  @Test
+  void permissionRequestsAreRejected() throws Exception {
+    PermissionRequestResult result =
+        GitHubCopilotProvider.DENY_ALL.handle(null, null).get(5, 
TimeUnit.SECONDS);
+
+    assertEquals(PermissionRequestResult.reject("x").getKind(), 
result.getKind());
+  }
+
+  @Test
+  void modelListingUsesTheConfiguredTimeout() {
+    assertEquals(17, 
GitHubCopilotProvider.modelListingTimeout(Duration.ofSeconds(17)));
+    assertEquals(60, GitHubCopilotProvider.modelListingTimeout(null));
+  }
+
+  @Test
+  void requestPromptIncludesConversationAndJsonInstruction() {
+    var request =
+        new AiChatRequest(
+            "gpt-4.1",
+            "Follow the system rules.",
+            "Return the corrected response.",
+            List.of(
+                new AiChatMessage(AiChatMessage.Role.USER, "Original 
question"),
+                new AiChatMessage(AiChatMessage.Role.ASSISTANT, "Original 
answer")),
+            null,
+            true);
+
+    String prompt = GitHubCopilotProvider.prompt(request);
+
+    assertTrue(prompt.contains("System instructions:\nFollow the system 
rules."));
+    assertTrue(prompt.contains("User: Original question\nAssistant: Original 
answer"));
+    assertTrue(prompt.contains("Current request:\nReturn the corrected 
response."));
+    assertTrue(prompt.endsWith("Return only valid JSON with no surrounding 
prose or markdown."));
+  }
+
+  @Test
+  void responseWaitGetsTheTimeLeftAndNeverZero() {
+    long now = System.nanoTime();
+
+    long left = GitHubCopilotProvider.remainingMillis(now, 120);
+    assertTrue(left > 119_000 && left <= 120_000, "left: " + left);
+    assertEquals(1, GitHubCopilotProvider.remainingMillis(now - 
TimeUnit.SECONDS.toNanos(5), 1));
+  }
+
+  @Test
+  void sdkTimeoutIsReportedAsATimeout() {
+    var future = CompletableFuture.<String>failedFuture(new 
TimeoutException("sdk"));
+
+    var e =
+        assertThrows(
+            TimeoutException.class,
+            () ->
+                GitHubCopilotProvider.await(
+                    future, System.nanoTime(), 10, "waiting for a Copilot 
response"));
+    assertEquals("waiting for a Copilot response", e.getMessage());
+  }
+}
diff --git a/plugins/tech/pom.xml b/plugins/tech/pom.xml
index ae7c3d5fcd..5ff3ed9b3c 100644
--- a/plugins/tech/pom.xml
+++ b/plugins/tech/pom.xml
@@ -37,6 +37,7 @@
         <module>azure</module>
         <module>calcite</module>
         <module>cassandra</module>
+        <module>copilot</module>
         <module>databricks</module>
         <module>dropbox</module>
         <module>elastic</module>

Reply via email to