From 9a454f558e14532e4098d5c33d5ffdc6a4fa3f7e Mon Sep 17 00:00:00 2001 From: JakeSCahill Date: Fri, 25 Sep 2026 12:16:30 +0100 Subject: [PATCH] Return latest patch releases from the Ask AI version tool get_latest_version only returned the Streaming docs version (major.minor), so "what is the latest Redpanda version" got an answer like 26.2 instead of 26.2.1. It now also returns the latest Streaming patch release and the latest Console, Connect, Operator, and Helm chart releases. The values come from the attributes the version-fetcher extension sets at build time, the same lookup doc-tools get-redpanda-version uses. That lookup needs a GitHub token for a private repo, so it cannot run in the browser. head-meta.hbs publishes them as new meta tags rather than reusing latest-redpanda-tag, which can hold the properties-JSON tag or the page's own version tag. Co-Authored-By: Claude Opus 5.5 --- src/js/react/agentTools.js | 26 +++++++++++++++++++++----- src/partials/head-meta.hbs | 22 ++++++++++++++++++++++ 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/js/react/agentTools.js b/src/js/react/agentTools.js index 00067d66..1286fbee 100644 --- a/src/js/react/agentTools.js +++ b/src/js/react/agentTools.js @@ -432,15 +432,26 @@ const lookupConfigProperty = { } // ——— Latest version (from the page meta + current doc context) ———————————— +// The release metas are written by head-meta.hbs from what the version-fetcher +// extension resolved at build time (the same lookup as doc-tools +// get-redpanda-version, which needs a GitHub token so cannot run here). +const readRelease = (name) => { + const content = document.querySelector(`meta[name="${name}"]`)?.content + // Some are published as tags (v25.3.4); report the bare version. + return content ? content.replace(/^v/, '') : null +} + const getLatestVersion = { name: 'get_latest_version', displayName: 'Get the latest version', description: - 'Return the latest released Redpanda Streaming version (the core streaming product, ' + - 'published on the docs site) and the product and version of the page the user is ' + - 'currently viewing. Use for "what is the latest Redpanda Streaming version" and to pick ' + - 'the right version before giving version-specific steps. Note this is the Streaming ' + - 'version, not Redpanda Connect, Cloud, or Agentic Data Plane, which version separately.', + 'Return the latest released versions of Redpanda products, plus the product and version ' + + 'of the page the user is currently viewing. For Redpanda Streaming (the core streaming ' + + 'product) it returns both the docs version (major.minor) and the latest patch release. ' + + 'It also returns the latest Redpanda Console, Redpanda Connect, Redpanda Operator, and ' + + 'Redpanda Helm chart releases. Use for "what is the latest version of X" (answer with ' + + 'the patch release) and to pick the right version before giving version-specific steps. ' + + 'Redpanda Cloud and Agentic Data Plane are not versioned here.', needsApproval: false, parameters: { type: 'object', properties: {}, required: [] }, execute: async () => { @@ -453,6 +464,11 @@ const getLatestVersion = { const version = document.querySelector('[data-version]')?.getAttribute('data-version') || null return { latestRedpandaStreamingVersion: latest, + latestRedpandaStreamingPatchRelease: readRelease('latest-redpanda-release'), + latestConsoleRelease: readRelease('latest-console-release'), + latestConnectRelease: readRelease('latest-connect-release'), + latestOperatorRelease: readRelease('latest-operator-release'), + latestHelmChartRelease: readRelease('latest-helm-chart-release'), currentPage: { product: component, version }, note: latest ? undefined : 'Latest Redpanda version is not published on this page.', } diff --git a/src/partials/head-meta.hbs b/src/partials/head-meta.hbs index 4716cd61..a0342bfc 100644 --- a/src/partials/head-meta.hbs +++ b/src/partials/head-meta.hbs @@ -8,6 +8,28 @@ {{/if}} {{#with (or site.components.streaming site.components.ROOT)}} +{{!-- Latest releases resolved by the version-fetcher extension at build time, + for the Ask AI get_latest_version tool. latest-redpanda-release is the full + patch tag (for example v25.3.4), separate from latest-redpanda-tag below, + which is overloaded: it can hold the properties-JSON tag or the page's own + version tag. --}} +{{#with this.latest.asciidoc.attributes}} +{{#if latest-redpanda-tag}} + +{{/if}} +{{#if latest-console-version}} + +{{/if}} +{{#if latest-connect-version}} + +{{/if}} +{{#if latest-operator-version}} + +{{/if}} +{{#if latest-redpanda-helm-chart-version}} + +{{/if}} +{{/with}} {{/with}} {{!-- Properties JSON URL for property tooltips