[
https://issues.apache.org/jira/browse/CAMEL-24874?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-24874:
--------------------------------
Component/s: camel-core
Description:
The simple language gained init blocks with local variables ({{$name :=
<exp>;}}), local custom functions ({{$name ~:= ${trim()} ~> ${uppercase()};}})
and the chain operator {{~>}} (see
https://camel.apache.org/blog/2026/09/camel-simple-customfunction/). The
catalog ({{simple.json}}, generated from {{SimpleOperatorConstants}}) has
{{~>}} and {{?~>}} with examples, but no operator entry for {{:=}} and {{~:=}},
so nothing that reads the catalog knows they exist: {{camel_catalog_doc
simple}} / {{tui_catalog_doc}} (function and operator lists,
{{optionsFilter}}), the generated JS validator, the MCP server and any external
agent that fetches the catalog. The docs are the only place, and
{{docPage=advanced}} is the whole 24 KB simple-advanced page.
Scope:
* add {{:=}} and {{~:=}} as operators with description, syntax and examples in
{{SimpleOperatorConstants}} (kind {{init}}), regenerate the catalog
* fix the init block section of simple-advanced.adoc: the unfinished sentence
'You can also declare custom functions using', 'a lso', '$nane'
Out of scope (decided 2026-09-21): an always-on primer line in the TUI system
prompt / {{CatalogDocs.SIMPLE_SYNTAX}} and special-casing of init blocks in
{{AnswerChecks}}. These cost tokens on every turn for every user for a feature
a local-model user asks for rarely, and there is no observed local-model
failure with init blocks yet; the catalog entry is fetched only when asked.
Revisit if a transcript shows the failure. The validator gap for multi-line
simple expressions is CAMEL-24875.
was:
The simple language gained init blocks with local custom functions ({{$init{
$cleanName ~:= ${trim()} ~> ${uppercase()}; }init$}}) and the chain operator
{{~>}} (see
https://camel.apache.org/blog/2026/09/camel-simple-customfunction/). These
tokens are new (not in any model's training data) and have no analogue in other
languages, so a small local model driving the TUI AI panel is expected to write
{{->}}, {{|>}} or {{:=}} instead, put the operator inside the {{${}}}
placeholder (as observed with {{?:}}), or forget the {{}init$}} terminator or
the trailing {{;}}.
Proposed:
* extend the simple syntax primer ({{TuiToolRegistry.SIMPLE_SYNTAX}}) with a
one-line rule and example for {{$init{ }init$}}, {{~:=}} and {{~>}}
* extend {{AnswerChecks}} (CAMEL-24805) so these mistakes are detected in the
answer and the model gets its one correction turn
* make sure {{camel_catalog_doc}} / {{tui_catalog_doc}} serve the init block
and chain operator section of simple-advanced when asked
The prompt budget is nearly full ({{AiPanelPromptBudgetTest}}), so this needs
trimming elsewhere or a raised budget in the same change.
Summary: camel-core-languages - catalog: add the simple init block
operators := and ~:= (simple.json) and fix the init block doc section (was:
camel-jbang - TUI AI: teach local models the simple init block and chain
operator ($init{ }init$, ~:=, ~>))
> camel-core-languages - catalog: add the simple init block operators := and
> ~:= (simple.json) and fix the init block doc section
> -------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24874
> URL: https://issues.apache.org/jira/browse/CAMEL-24874
> Project: Camel
> Issue Type: Improvement
> Components: camel-core, camel-jbang
> Reporter: Claus Ibsen
> Priority: Major
>
> The simple language gained init blocks with local variables ({{$name :=
> <exp>;}}), local custom functions ({{$name ~:= ${trim()} ~>
> ${uppercase()};}}) and the chain operator {{~>}} (see
> https://camel.apache.org/blog/2026/09/camel-simple-customfunction/). The
> catalog ({{simple.json}}, generated from {{SimpleOperatorConstants}}) has
> {{~>}} and {{?~>}} with examples, but no operator entry for {{:=}} and
> {{~:=}}, so nothing that reads the catalog knows they exist:
> {{camel_catalog_doc simple}} / {{tui_catalog_doc}} (function and operator
> lists, {{optionsFilter}}), the generated JS validator, the MCP server and any
> external agent that fetches the catalog. The docs are the only place, and
> {{docPage=advanced}} is the whole 24 KB simple-advanced page.
> Scope:
> * add {{:=}} and {{~:=}} as operators with description, syntax and examples
> in {{SimpleOperatorConstants}} (kind {{init}}), regenerate the catalog
> * fix the init block section of simple-advanced.adoc: the unfinished sentence
> 'You can also declare custom functions using', 'a lso', '$nane'
> Out of scope (decided 2026-09-21): an always-on primer line in the TUI system
> prompt / {{CatalogDocs.SIMPLE_SYNTAX}} and special-casing of init blocks in
> {{AnswerChecks}}. These cost tokens on every turn for every user for a
> feature a local-model user asks for rarely, and there is no observed
> local-model failure with init blocks yet; the catalog entry is fetched only
> when asked. Revisit if a transcript shows the failure. The validator gap for
> multi-line simple expressions is CAMEL-24875.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)