luigidemasi commented on code in PR #27656:
URL: https://github.com/apache/camel/pull/27656#discussion_r4237543059


##########
dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SemanticAuditView.java:
##########
@@ -211,8 +239,14 @@ void refresh() {
     }
 
     boolean ensureLoaded() {
+        if (!Objects.equals(pid, currentPid())) {
+            reset();
+            pid = currentPid();
+        }
         refresh();
-        if (page == null && pending == null && error == null) {
+        if (pending == null && error == null && (page == null
+                || pendingDetails == null && !paused && cursor == null && 
!inputActive()
+                        && nanoTime.getAsLong() - lastRefresh >= 
1_000_000_000L)) {

Review Comment:
   Fixed at the shared SemanticAuditConsole boundary in 
[6d6b389ca27d](https://github.com/apache/camel/commit/6d6b389ca27dbd574b00e259c72c084b0f3f4273).
 List queries return summaries without input or its inputRedacted flag, while 
eventId details and linked evidence retain them. The stored record is 
unchanged. New regressions cover both raw and redacted input, and the TUI tests 
now use summary-only list fixtures to verify that the inspector obtains input 
through its detail query.
   
   _AI-generated by OpenAI Codex on behalf of @luigidemasi._



##########
components/camel-ai/camel-semantic/src/main/java/org/apache/camel/semantic/SemanticXmlRoutesBuilderLoader.java:
##########
@@ -181,17 +181,27 @@ private void declarations(Element semantic, 
SemanticEvaluationsBuilder evaluatio
     private SemanticAuditConfiguration audit(Element element) {
         attributes(element, Set.of("enabled", "reader", "capacity", 
"queueCapacity"));
         Map<String, Boolean> experts = new LinkedHashMap<>();
+        Map<String, SemanticAuditInputConfiguration> inputs = new 
LinkedHashMap<>();
         List<String> sinks = new ArrayList<>();
         for (Element child : children(element)) {
             if ("expert".equals(child.getLocalName())) {
-                attributes(child, Set.of("name", "enabled"));
-                String name = child.getAttribute("name");
+                attributes(child, Set.of("name", "enabled", "inputEnabled", 
"inputMaxChars", "inputRedactor"));
+                String name = 
getCamelContext().resolvePropertyPlaceholders(child.getAttribute("name"));

Review Comment:
   Removed the unrelated XML-only name expansion in 
[6d6b389ca27d](https://github.com/apache/camel/commit/6d6b389ca27dbd574b00e259c72c084b0f3f4273),
 restoring the behavior on main. Audit expert names remain literal registry 
keys in both XML and YAML. A paired DSL regression sets an audit.expert 
property and verifies that neither parser expands that placeholder in an expert 
name or applies its input policy to security.
   
   _AI-generated by OpenAI Codex on behalf of @luigidemasi._



##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelSemantic.java:
##########
@@ -94,26 +95,101 @@ protected void render(JsonObject response) {
                 new 
Column().header("REFERENCE").dataAlign(HorizontalAlign.LEFT).with(r -> text(r, 
"reference")),
                 new 
Column().header("NAME").dataAlign(HorizontalAlign.LEFT).with(r -> text(r, 
"name")),
                 new 
Column().header("ERROR").dataAlign(HorizontalAlign.LEFT).with(r -> text(r, 
"error")))));
-        printer().println("Default expert: " + text(response, 
"defaultExpert"));
-        if (response.get("defaultError") != null) {
-            printer().println("Default expert error: " + 
response.get("defaultError"));
-        }
+        String defaultExpert = text(response, "defaultExpert");
+        printer().println("Default expert: " + (defaultExpert.isEmpty() ? 
"none" : defaultExpert));

Review Comment:
   Fixed in 
[6d6b389ca27d](https://github.com/apache/camel/commit/6d6b389ca27dbd574b00e259c72c084b0f3f4273).
 Text output suppresses only the expected 'exactly one eligible expert' 
automatic-selection diagnostic; other defaultError values are shown as Default 
expert error. Regressions cover an unknown configured expert, an invalid expert 
contract and descriptor-read errors, while the existing ambiguous-selection 
case stays quiet and --json preserves the complete diagnostics.
   
   _AI-generated by OpenAI Codex on behalf of @luigidemasi._



##########
components/camel-ai/camel-semantic/src/main/java/org/apache/camel/language/semantic/SemanticLanguage.java:
##########
@@ -720,6 +722,7 @@ private Object evaluate(Exchange exchange, boolean 
asPredicate) {
                 active.addAll(invocations.values());
                 failureReason = "invalid_input";
                 Object state = current.state.evaluate(exchange, Object.class);
+                invocations.values().forEach(invocation -> 
invocation.captureInput(state));

Review Comment:
   It could be shared with an additional contract that redactors are 
deterministic across invocations. The current SPI requires thread safety but 
does not require that, and experts can have different capture flags and size 
limits even when they share a redactor. I have kept capture and omission 
outcomes per invocation and documented that behavior in 
[6d6b389ca27d](https://github.com/apache/camel/commit/6d6b389ca27dbd574b00e259c72c084b0f3f4273).
 Each invocation now captures at most once; no cross-invocation cache is 
introduced.
   
   _AI-generated by OpenAI Codex on behalf of @luigidemasi._



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to