Skip to content

feat(code-mode): lazy tool support (progressive disclosure)#726

Open
AlemTuzlak wants to merge 6 commits into
mainfrom
feat/code-mode-lazy-tools
Open

feat(code-mode): lazy tool support (progressive disclosure)#726
AlemTuzlak wants to merge 6 commits into
mainfrom
feat/code-mode-lazy-tools

Conversation

@AlemTuzlak

@AlemTuzlak AlemTuzlak commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds lazy tool support (progressive disclosure) to Code Mode, plus a shared, optional lazyToolsConfig that also tunes chat()'s existing lazy-tool discovery. The goal is context savings: with a large tool catalog, you no longer pay for every tool's type stub + description in the execute_typescript system prompt on every turn.

Lazy behavior is triggered purely by marking a tool lazy: truelazyToolsConfig is optional everywhere and only tunes how much of each lazy tool's description shows in the pre-discovery catalog.

How it works

  • Shared config: LazyToolsConfig { includeDescription: 'none' | 'first-sentence' | 'full' } (default 'none'), accepted by both chat() and createCodeMode(). 'none' is byte-identical to today's chat catalog.
  • Code Mode: tools marked lazy: true are kept out of the system prompt's full documentation (type stubs omitted) and listed in a lightweight "Discoverable APIs" catalog. A new discover_tools companion tool returns each lazy tool's TypeScript signature on demand; the model then calls external_<name>(...) inside execute_typescript. Lookups tolerate the optional external_ prefix so the model can pass the catalog name verbatim.
  • Documentation-only lazy: all tool bindings are always injected into the sandbox — lazy defers only prompt documentation, not callability. This is stateless/serverless-safe.

API

createCodeMode(config) now returns { tool, discoveryTool, tools, systemPrompt }:

  • tool (= execute_typescript) and systemPrompt are unchanged — fully backward compatible.
  • tools is the array to spread into chat({ tools }); discoveryTool is null when there are no lazy tools.

Testing

  • Unit tests across both packages (helpers, LazyToolManager catalog rendering, eager/lazy partition, discover_tools incl. prefix tolerance + includeDescription, return shape). pnpm test:pr green.
  • E2E: a wire-journal spec asserts the chat lazy discovery catalog renders per includeDescription (none/first-sentence/full).
  • Docs (docs/code-mode/lazy-tools.md), both agent skills, and a changeset updated in the same PR.

Follow-up

There is currently no code-mode E2E harness in testing/e2e/ (no route/fixture exercising createCodeMode). A code-mode-specific lazy E2E (sequencing discover_toolsexecute_typescript against a sandbox driver) would need net-new harness wiring disproportionate to this change; the partition/discovery logic is comprehensively unit-covered. Recommend tracking code-mode E2E harness wiring as a separate issue.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Lazy tool discovery: mark tools as lazy to keep them out of the immediate API surface and expose them via a discoverable catalog with on‑demand signature retrieval
    • Shared lazyToolsConfig to control catalog detail levels (none, first‑sentence, full) for chat and Code Mode
    • Code Mode now optionally exposes a discovery companion and returns a combined tools list while remaining backward compatible
  • Documentation

    • Added comprehensive guides, examples, and updated samples (incl. newer model example) for configuring and using lazy tools
  • Tests

    • Added unit and end‑to‑end tests covering discovery, catalog verbosity, and wire-format behavior

…discovery

Introduces a single optional LazyToolsConfig ({ includeDescription:
'none' | 'first-sentence' | 'full' }, default 'none') plus shared
renderLazyCatalogEntry/firstSentence helpers. chat() now accepts
lazyToolsConfig and threads it into LazyToolManager, which renders the
discovery-tool catalog accordingly. The 'none' default is byte-identical
to the previous names-only output.
Tools marked `lazy: true` are kept out of the execute_typescript system
prompt (their type stubs omitted) and listed in a "Discoverable APIs"
catalog instead. A new discover_tools companion tool returns each lazy
tool signature on demand; lookups tolerate the optional external_ prefix
so the model can pass the catalog name verbatim. All tool bindings are
still injected into the sandbox (documentation-only lazy). createCodeMode
now returns { tool, discoveryTool, tools, systemPrompt } (additive;
tool/systemPrompt unchanged) and honors the shared lazyToolsConfig.
Adds a wire-journal E2E (api.lazy-tools-wire route + fixture + spec) that
asserts the lazy discovery tool's wire description renders names-only for
'none', name plus first sentence for 'first-sentence', and the full
description for 'full'. routeTree.gen.ts is the router plugin's auto-regen
for the new route.
New docs/code-mode/lazy-tools.md (with config.json nav entry) covering
lazy tools, the discover_tools flow, and lazyToolsConfig.includeDescription
for both Code Mode and plain chat(). Updates the ai-code-mode and
ai-core/tool-calling agent skills to document the new API, and adds the
changeset (minor for @tanstack/ai and @tanstack/ai-code-mode).
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9c61fc80-fd84-42b7-bfcc-6af736891bb3

📥 Commits

Reviewing files that changed from the base of the PR and between 7b853cf and bab6ada.

📒 Files selected for processing (7)
  • docs/code-mode/lazy-tools.md
  • docs/tools/lazy-tool-discovery.md
  • packages/ai-code-mode/skills/ai-code-mode/SKILL.md
  • packages/ai-code-mode/tests/create-discovery-tool.test.ts
  • packages/ai/tests/lazy-tools.test.ts
  • testing/e2e/src/routes/api.lazy-tools-wire.ts
  • testing/e2e/tests/lazy-tools-wire.spec.ts
✅ Files skipped from review due to trivial changes (3)
  • docs/tools/lazy-tool-discovery.md
  • packages/ai-code-mode/skills/ai-code-mode/SKILL.md
  • docs/code-mode/lazy-tools.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/ai-code-mode/tests/create-discovery-tool.test.ts
  • packages/ai/tests/lazy-tools.test.ts
  • testing/e2e/src/routes/api.lazy-tools-wire.ts

📝 Walkthrough

Walkthrough

Adds “lazy tool” progressive disclosure: lazy tools are omitted from initial prompts, appear in a discoverable catalog whose verbosity is configurable via lazyToolsConfig, and have TypeScript signatures fetched on demand by a new discover_tools tool used by Code Mode and chat().

Changes

Lazy Tools Feature

Layer / File(s) Summary
Lazy tools types and configuration
packages/ai/src/types.ts, packages/ai-code-mode/src/types.ts
Introduces LazyToolsConfig with includeDescription (`'none'
Lazy catalog rendering utilities
packages/ai/src/activities/chat/tools/lazy-tools.ts, packages/ai/tests/lazy-tools.test.ts
Adds firstSentence and renderLazyCatalogEntry to format lazy-tool catalog entries per includeDescription.
Discovery tool implementation
packages/ai-code-mode/src/create-discovery-tool.ts, packages/ai-code-mode/tests/create-discovery-tool.test.ts
Implements createDiscoveryTool (discover_tools) with input/output Zod schemas, name normalization (external_ prefix handling), catalog rendering, per-tool TypeScript typeStub generation, and structured errors for unknown names.
Code Mode lazy tools wiring
packages/ai-code-mode/src/create-code-mode.ts, packages/ai-code-mode/src/create-code-mode-tool.ts, packages/ai-code-mode/src/create-system-prompt.ts, packages/ai-code-mode/tests/create-code-mode.test.ts, packages/ai-code-mode/tests/create-system-prompt.test.ts
createCodeMode now returns `{ tool, discoveryTool
Chat activity lazy tools wiring
packages/ai/src/activities/chat/index.ts, packages/ai/src/activities/chat/tools/lazy-tool-manager.ts, packages/ai/tests/lazy-tool-manager.test.ts
Adds lazyToolsConfig to TextActivityOptions, passes it into LazyToolManager, and renders discovery-tool catalog descriptions per configuration (default 'none').
Public API exports
packages/ai-code-mode/src/index.ts, packages/ai/src/index.ts
Re-exports createDiscoveryTool, firstSentence, and renderLazyCatalogEntry; exports CreateCodeModeResult type.
User and skill documentation
docs/code-mode/lazy-tools.md, docs/config.json, packages/ai-code-mode/skills/ai-code-mode/SKILL.md, packages/ai/skills/ai-core/tool-calling/SKILL.md, docs/tools/lazy-tool-discovery.md
Adds Code Mode lazy-tools guide, documents lazyToolsConfig.includeDescription, updates site config and skill docs, and adjusts examples to newer adapter models.
End-to-end testing
testing/e2e/src/routes/api.lazy-tools-wire.ts, testing/e2e/tests/lazy-tools-wire.spec.ts, testing/e2e/fixtures/lazy-tools-wire/basic.json, testing/e2e/src/routeTree.gen.ts
Adds an E2E route, fixture, generated route update, and Playwright tests that validate the wire-format description for none, first-sentence, and full modes.

Sequence Diagram (high-level discovery flow)

sequenceDiagram
  participant Model
  participant discover_tools
  participant execute_typescript
  Model->>discover_tools: discover_tools({ toolNames })
  discover_tools-->>Model: tools[{ name, description, typeStub }]
  Model->>execute_typescript: call external_<tool>(...)
  execute_typescript-->>Model: execution result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • tombeckenham
  • crutchcorn

"🐇 A rabbit coded, quiet and spry,
Lazy tools hidden, yet ready to pry,
Discover on call, signatures unfurled —
Small hops, big leaps for the coding world."

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main feature being added: lazy tool support with progressive disclosure in Code Mode, which is the primary focus of the changeset.
Description check ✅ Passed The PR description comprehensively covers changes, implementation details, API contract, testing strategy, and follow-up notes. While the template checklist items are not explicitly marked off, the description fulfills all substantive requirements.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/code-mode-lazy-tools

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

testing/e2e/tests/lazy-tools-wire.spec.ts

Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): testing/e2e/tests/lazy-tools-wire.spec.ts


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

4 package(s) bumped directly, 27 bumped as dependents.

🟥 Major bumps

Package Version Reason
@tanstack/ai-code-mode 0.2.5 → 1.0.0 Changeset
@tanstack/ai-event-client 0.5.4 → 1.0.0 Changeset
@tanstack/ai-fal 0.7.23 → 1.0.0 Changeset
@tanstack/ai-anthropic 0.15.1 → 1.0.0 Dependent
@tanstack/ai-code-mode-skills 0.2.5 → 1.0.0 Dependent
@tanstack/ai-elevenlabs 0.2.20 → 1.0.0 Dependent
@tanstack/ai-gemini 0.15.1 → 1.0.0 Dependent
@tanstack/ai-grok 0.11.2 → 1.0.0 Dependent
@tanstack/ai-groq 0.4.2 → 1.0.0 Dependent
@tanstack/ai-isolate-node 0.1.30 → 1.0.0 Dependent
@tanstack/ai-isolate-quickjs 0.1.30 → 1.0.0 Dependent
@tanstack/ai-ollama 0.8.1 → 1.0.0 Dependent
@tanstack/ai-openai 0.14.1 → 1.0.0 Dependent
@tanstack/ai-openrouter 0.13.1 → 1.0.0 Dependent
@tanstack/ai-preact 0.9.4 → 1.0.0 Dependent
@tanstack/ai-react 0.15.4 → 1.0.0 Dependent
@tanstack/ai-react-ui 0.8.6 → 1.0.0 Dependent
@tanstack/ai-solid 0.13.4 → 1.0.0 Dependent
@tanstack/ai-solid-ui 0.7.6 → 1.0.0 Dependent
@tanstack/ai-svelte 0.13.4 → 1.0.0 Dependent
@tanstack/ai-vue 0.13.4 → 1.0.0 Dependent
@tanstack/openai-base 0.8.1 → 1.0.0 Dependent

🟨 Minor bumps

Package Version Reason
@tanstack/ai 0.28.0 → 0.29.0 Changeset

🟩 Patch bumps

Package Version Reason
@tanstack/ai-client 0.16.3 → 0.16.4 Dependent
@tanstack/ai-devtools-core 0.4.8 → 0.4.9 Dependent
@tanstack/ai-isolate-cloudflare 0.2.21 → 0.2.22 Dependent
@tanstack/ai-mcp 0.1.0 → 0.1.1 Dependent
@tanstack/ai-vue-ui 0.2.16 → 0.2.17 Dependent
@tanstack/preact-ai-devtools 0.1.51 → 0.1.52 Dependent
@tanstack/react-ai-devtools 0.2.51 → 0.2.52 Dependent
@tanstack/solid-ai-devtools 0.2.51 → 0.2.52 Dependent

@nx-cloud

nx-cloud Bot commented Jun 8, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit bab6ada

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-08 12:01:31 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Open in StackBlitz

@tanstack/ai

npm i https://pkg.pr.new/@tanstack/ai@726

@tanstack/ai-anthropic

npm i https://pkg.pr.new/@tanstack/ai-anthropic@726

@tanstack/ai-client

npm i https://pkg.pr.new/@tanstack/ai-client@726

@tanstack/ai-code-mode

npm i https://pkg.pr.new/@tanstack/ai-code-mode@726

@tanstack/ai-code-mode-skills

npm i https://pkg.pr.new/@tanstack/ai-code-mode-skills@726

@tanstack/ai-devtools-core

npm i https://pkg.pr.new/@tanstack/ai-devtools-core@726

@tanstack/ai-elevenlabs

npm i https://pkg.pr.new/@tanstack/ai-elevenlabs@726

@tanstack/ai-event-client

npm i https://pkg.pr.new/@tanstack/ai-event-client@726

@tanstack/ai-fal

npm i https://pkg.pr.new/@tanstack/ai-fal@726

@tanstack/ai-gemini

npm i https://pkg.pr.new/@tanstack/ai-gemini@726

@tanstack/ai-grok

npm i https://pkg.pr.new/@tanstack/ai-grok@726

@tanstack/ai-groq

npm i https://pkg.pr.new/@tanstack/ai-groq@726

@tanstack/ai-isolate-cloudflare

npm i https://pkg.pr.new/@tanstack/ai-isolate-cloudflare@726

@tanstack/ai-isolate-node

npm i https://pkg.pr.new/@tanstack/ai-isolate-node@726

@tanstack/ai-isolate-quickjs

npm i https://pkg.pr.new/@tanstack/ai-isolate-quickjs@726

@tanstack/ai-mcp

npm i https://pkg.pr.new/@tanstack/ai-mcp@726

@tanstack/ai-ollama

npm i https://pkg.pr.new/@tanstack/ai-ollama@726

@tanstack/ai-openai

npm i https://pkg.pr.new/@tanstack/ai-openai@726

@tanstack/ai-openrouter

npm i https://pkg.pr.new/@tanstack/ai-openrouter@726

@tanstack/ai-preact

npm i https://pkg.pr.new/@tanstack/ai-preact@726

@tanstack/ai-react

npm i https://pkg.pr.new/@tanstack/ai-react@726

@tanstack/ai-react-ui

npm i https://pkg.pr.new/@tanstack/ai-react-ui@726

@tanstack/ai-solid

npm i https://pkg.pr.new/@tanstack/ai-solid@726

@tanstack/ai-solid-ui

npm i https://pkg.pr.new/@tanstack/ai-solid-ui@726

@tanstack/ai-svelte

npm i https://pkg.pr.new/@tanstack/ai-svelte@726

@tanstack/ai-utils

npm i https://pkg.pr.new/@tanstack/ai-utils@726

@tanstack/ai-vue

npm i https://pkg.pr.new/@tanstack/ai-vue@726

@tanstack/ai-vue-ui

npm i https://pkg.pr.new/@tanstack/ai-vue-ui@726

@tanstack/openai-base

npm i https://pkg.pr.new/@tanstack/openai-base@726

@tanstack/preact-ai-devtools

npm i https://pkg.pr.new/@tanstack/preact-ai-devtools@726

@tanstack/react-ai-devtools

npm i https://pkg.pr.new/@tanstack/react-ai-devtools@726

@tanstack/solid-ai-devtools

npm i https://pkg.pr.new/@tanstack/solid-ai-devtools@726

commit: bab6ada

The chat lazy-tool discovery page now documents the new optional
lazyToolsConfig.includeDescription ('none' default / 'first-sentence' /
'full') that tunes the pre-discovery catalog, with a cross-link to the
Code Mode lazy tools page. Bumps the example model ids to gpt-5.2 and
sets updatedAt on the docs config entry.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (4)
packages/ai/tests/lazy-tools.test.ts (1)

1-61: ⚡ Quick win

Co-locate this unit test with the source module.

This test should live next to the lazy-tools implementation per repo guideline (for example under packages/ai/src/activities/chat/tools/).

As per coding guidelines, **/*.test.ts: Place unit tests alongside source code in *.test.ts files.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ai/tests/lazy-tools.test.ts` around lines 1 - 61, The tests for
firstSentence and renderLazyCatalogEntry are currently in the shared tests
folder and must be co-located with the lazy-tools source module; move the
lazy-tools.test.ts file that contains tests referencing firstSentence and
renderLazyCatalogEntry into the same directory as the lazy-tools implementation
(next to the module that exports those functions), keep the filename ending in
.test.ts, and update the import paths in the test to use the local module import
so the tests run alongside the source per repo guidelines.

Source: Coding guidelines

packages/ai-code-mode/skills/ai-code-mode/SKILL.md (1)

383-388: 💤 Low value

Add language identifier to fenced code block.

Markdown linters require language identifiers on fenced code blocks. Since this is a flow/sequence diagram rather than executable code, consider using text or remove the fence and use indentation.

📝 Proposed fix
-```
+```text
 Model sees: "Discoverable APIs: external_fetchStocks"
 Model calls: discover_tools({ toolNames: ["fetchStocks"] })
 Response:    { tools: [{ name: "external_fetchStocks", description: "...", typeStub: "declare function external_fetchStocks(...)" }] }
 Model writes inside execute_typescript: const result = await external_fetchStocks({ ticker: "AAPL" })
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @packages/ai-code-mode/skills/ai-code-mode/SKILL.md around lines 383 - 388,
The fenced code block containing the flow lines starting with "Model sees:
"Discoverable APIs: external_fetchStocks"" in SKILL.md is missing a language
identifier; update that triple-backtick fence to use a language tag (e.g.,

linters accept it, ensuring the block that shows the
discover_tools/execute_typescript sequence remains unchanged.

Source: Linters/SAST tools

docs/code-mode/lazy-tools.md (2)

119-125: 💤 Low value

Add language identifier to fenced code block.

The fenced code block showing example catalog output should specify a language identifier (e.g., text) to satisfy markdownlint.

📝 Suggested fix
-```
+```text
 ### Discoverable APIs
 
 - external_fetchArchive
 - external_runReport
 - external_exportData
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @docs/code-mode/lazy-tools.md around lines 119 - 125, Add a language
identifier to the fenced code block containing the "### Discoverable APIs"
sample output so markdownlint passes; update the opening backticks to include a
language like text (e.g., change the block that lists "external_fetchArchive",
"external_runReport", and "external_exportData" to start with ```text).


</details>

<!-- cr-comment:v1:8c8fdffc4537652ad3f97ae4 -->

_Source: Linters/SAST tools_

---

`141-147`: _💤 Low value_

**Add language identifier to fenced code block.**

The fenced code block showing example catalog output with descriptions should specify a language identifier (e.g., `text`) to satisfy markdownlint.





<details>
<summary>📝 Suggested fix</summary>

```diff
-```
+```text
 ### Discoverable APIs
 
 - external_fetchArchive — Retrieve historical weather archive data for a date range.
 - external_runReport — Generate a summary report for a given time period.
 - external_exportData — Export query results to CSV or JSON format.
 ```
```
</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @docs/code-mode/lazy-tools.md around lines 141 - 147, The fenced code block
containing the "Discoverable APIs" section is missing a language identifier. Add
the language identifier text to the opening backticks of this code block
(change totext) to satisfy markdownlint requirements. This applies to
the code block that lists the external functions like external_fetchArchive,
external_runReport, and external_exportData.


</details>

<!-- cr-comment:v1:661e2d957bbb1a6bad28ead9 -->

_Source: Linters/SAST tools_

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @docs/code-mode/lazy-tools.md:

  • Line 71: Update the docs examples to use the newer OpenAI model name: in the
    createCodeMode examples (identify the createCodeMode invocation and any
    openaiText(...) calls), replace openaiText("gpt-5.2") with
    openaiText("gpt-5.5"); ensure all occurrences in this file (including the
    instances around the createCodeMode block and the examples at the other noted
    locations) are changed so the documentation matches the NEWEST model names
    defined in OPENAI_CHAT_MODELS.

In @packages/ai-code-mode/tests/create-discovery-tool.test.ts:

  • Line 1: Reorder the named imports from vitest so they are alphabetized to
    satisfy ESLint sort-imports: change the import list in the test file (the import
    statement that currently lists describe, it, expect) to list expect first, then
    describe, then it (i.e., import { expect, describe, it } from 'vitest'),
    preserving the same module and spacing.

In @packages/ai/tests/lazy-tools.test.ts:

  • Line 1: The named imports from 'vitest' are out of alphabetical order and
    trigger sort-imports linting; update the import specifier in
    packages/ai/tests/lazy-tools.test.ts to list the members alphabetically (use
    describe, expect, it) so the import becomes alphabetically ordered and satisfies
    the linter.

In @testing/e2e/tests/lazy-tools-wire.spec.ts:

  • Around line 63-67: Remove the global journal reset in the test.beforeEach hook
    to avoid mutating shared state; specifically delete the await
    request.delete(http://127.0.0.1:${aimockPort}/v1/_requests) call inside
    test.beforeEach and rely on the existing per-test isolation header (X-Test-Id)
    instead, ensuring tests continue to set and use X-Test-Id when calling the
    aimock server; no other changes to request setup are required.

Nitpick comments:
In @docs/code-mode/lazy-tools.md:

  • Around line 119-125: Add a language identifier to the fenced code block
    containing the "### Discoverable APIs" sample output so markdownlint passes;
    update the opening backticks to include a language like text (e.g., change the
    block that lists "external_fetchArchive", "external_runReport", and
    "external_exportData" to start with ```text).
  • Around line 141-147: The fenced code block containing the "Discoverable APIs"
    section is missing a language identifier. Add the language identifier text to
    the opening backticks of this code block (change totext) to satisfy
    markdownlint requirements. This applies to the code block that lists the
    external functions like external_fetchArchive, external_runReport, and
    external_exportData.

In @packages/ai-code-mode/skills/ai-code-mode/SKILL.md:

  • Around line 383-388: The fenced code block containing the flow lines starting
    with "Model sees: "Discoverable APIs: external_fetchStocks"" in SKILL.md is
    missing a language identifier; update that triple-backtick fence to use a
    language tag (e.g., ```text) or replace the fenced block with an indented code
    block so markdown linters accept it, ensuring the block that shows the
    discover_tools/execute_typescript sequence remains unchanged.

In @packages/ai/tests/lazy-tools.test.ts:

  • Around line 1-61: The tests for firstSentence and renderLazyCatalogEntry are
    currently in the shared tests folder and must be co-located with the lazy-tools
    source module; move the lazy-tools.test.ts file that contains tests referencing
    firstSentence and renderLazyCatalogEntry into the same directory as the
    lazy-tools implementation (next to the module that exports those functions),
    keep the filename ending in .test.ts, and update the import paths in the test to
    use the local module import so the tests run alongside the source per repo
    guidelines.

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `f340d8aa-df1b-43c4-a30b-4d8305872f91`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 22c9b42baec74914b720e440f29bd02be04eb164 and 20b8d2ab63e333a5cb7ac9f8ecfd65343be77630.

</details>

<details>
<summary>📒 Files selected for processing (25)</summary>

* `.changeset/code-mode-lazy-tools.md`
* `docs/code-mode/lazy-tools.md`
* `docs/config.json`
* `packages/ai-code-mode/skills/ai-code-mode/SKILL.md`
* `packages/ai-code-mode/src/create-code-mode-tool.ts`
* `packages/ai-code-mode/src/create-code-mode.ts`
* `packages/ai-code-mode/src/create-discovery-tool.ts`
* `packages/ai-code-mode/src/create-system-prompt.ts`
* `packages/ai-code-mode/src/index.ts`
* `packages/ai-code-mode/src/types.ts`
* `packages/ai-code-mode/tests/create-code-mode.test.ts`
* `packages/ai-code-mode/tests/create-discovery-tool.test.ts`
* `packages/ai-code-mode/tests/create-system-prompt.test.ts`
* `packages/ai/skills/ai-core/tool-calling/SKILL.md`
* `packages/ai/src/activities/chat/index.ts`
* `packages/ai/src/activities/chat/tools/lazy-tool-manager.ts`
* `packages/ai/src/activities/chat/tools/lazy-tools.ts`
* `packages/ai/src/index.ts`
* `packages/ai/src/types.ts`
* `packages/ai/tests/lazy-tool-manager.test.ts`
* `packages/ai/tests/lazy-tools.test.ts`
* `testing/e2e/fixtures/lazy-tools-wire/basic.json`
* `testing/e2e/src/routeTree.gen.ts`
* `testing/e2e/src/routes/api.lazy-tools-wire.ts`
* `testing/e2e/tests/lazy-tools-wire.spec.ts`

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread docs/code-mode/lazy-tools.md
Comment thread packages/ai-code-mode/tests/create-discovery-tool.test.ts Outdated
Comment thread packages/ai/tests/lazy-tools.test.ts Outdated
Comment thread testing/e2e/tests/lazy-tools-wire.spec.ts Outdated
- Use gpt-5.5 (newest OpenAI chat model in model-meta) in docs, skill,
  and the e2e route instead of gpt-5.2.
- e2e: drop the beforeEach DELETE /v1/_requests journal reset; the spec
  already isolates per-test via the X-Test-Id header, so the global reset
  only risked racing adjacent parallel specs.
- Alphabetize vitest named imports in the two new test files (sort-imports).
- Add `text` language identifiers to the Discoverable APIs example fences
  in the lazy-tools doc and code-mode skill (markdownlint).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant