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