* docs(sdk): add custom model provider plugin example
Add an OpenRouter-backed example plugin demonstrating the providers
capability and registerProvider. It registers an OpenAI-compatible
provider plus its model catalog with the gateway so the agent can run
inference against an endpoint Cline does not bundle.
Registers under a distinct id (openrouter-plugin) to avoid colliding
with the built-in openrouter provider.
* docs(sdk): drop redundant provider section from plugin examples readme
* docs(sdk): drop provider demo line from plugin examples readme
* fix: support plugin model providers
* docs: remove provider plugin demo
* docs: address provider example review
* docs(sdk): add env-blocker plugin example
Adds a beforeTool hook plugin that deterministically blocks the agent
from reading .env secret files via read_files, editor, or run_commands
(e.g. cat .env), while leaving .env.example/.sample/.template readable.
Demonstrates moving a security policy out of an AGENTS.md rule (a
suggestion the model can ignore) and into the execution path.
* docs(sdk): install env-blocker globally in usage examples
A secret-protection guard is most useful applied to every project, so
drop the --cwd . project-scoped install in favor of the global default.
* docs(sdk): trim env-blocker usage docs
* docs(sdk): limit env-blocker to read paths only
It is a read blocker, so only guard read_files and run_commands.
Drop the editor case (and with it the symmetric apply_patch concern),
keeping the example focused and simple.
* docs(sdk): rename env-blocker helpers for readability
collectPaths -> extractFilePaths, collectCommands -> extractShellCommands
so the beforeTool call sites read clearly at a glance.
* docs(sdk): rename commandTouchesEnv to commandReadsEnv
* docs(sdk): drop console.error from env-blocker hook
* Truncate text block tool results in compaction
* Log context sizing diagnostics
* Use default reserve for compaction trigger
* Cap default compaction trigger at ninety percent
* Use provider-sized estimates for compaction
* Update manual compaction test for conservative estimates
* Truncate retained tool results during compaction
* Add live Codex compaction coverage
* Make basic compaction tool-pair atomic
Basic compaction's predicate-based removal could split a tool_use from its matching tool_result, leaving the assistant message with an orphaned tool_use. MessageBuilder then synthesized "Tool execution was interrupted before a result was produced." which the model echoed back to the user.
Make removal expand to all candidates linked by tool_use_id so tool_use and tool_result share a fate.
* Protect latest turn from basic compaction
* Extract token estimator to @cline/shared
agent-runtime had a local /4 estimator while compaction-shared had
a /3 estimator. Both compute the same concept (char-to-token rough
estimate) but with different bias. Reviewer noticed the discrepancy.
Centralize on /3 (slightly conservative, fires compaction trigger
earlier rather than later). Diagnostic logging in agent-runtime now
uses the same estimator, eliminating divergence.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* Snap agentic compaction cut to a turn-start boundary
findCutIndex previously walked back by token budget and could land
between an assistant tool_use and its matching user tool_result.
The tool_use ended up folded into the summary while the tool_result
was preserved in the tail, producing an orphaned tool_result that
the provider rejects with:
No tool call found for function call output with call_id ...
The same failure mode can occur in the inverse direction (orphaned
tool_use). Both leave the session unrecoverable.
Snap the cut to the nearest turn-start boundary at or before the
budget candidate. This keeps each turn — its typed user message
plus any tool_use/tool_result/assistant follow-ups — together,
either fully summarized or fully preserved.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
* add web search plugin example
* simplify web search plugin to exa
* make web search plugin installable
* clarify web search plugin CLI usage
* Address web search plugin review feedback
* chore: merge main into web search plugin PR
* chore: remove shared changes from web search PR
* docs: limit web search README changes
---------
Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
* chore: rename and polish plugin examples
## Summary
Renames and reorganises the plugin example directories for clarity and consistency, and rewrites the top-level `plugins/README.md` to be more scannable:
- `weather-plugin.example.ts` → `weather-metrics.ts`
- `subagent-plugin/` → `agents-squad/` (package renamed to `cline-agent-squad-plugin`)
- `typescript-lsp-plugin/` → `typescript-lsp/`
- Drops `maxIterations` caps from agent preset frontmatter (`anvil`, `oracle`, `phantom`, `inquisitor`)
- Bumps `inquisitor`'s model from `gpt-5.4` → `gpt-5.5`
- Removes the inline standalone demo from `typescript-lsp/index.ts` (was duplicating the pattern already in `weather-metrics.ts`); export surface trimmed to just `plugin`
- Removes the `AgentExtension` duplicate export and adds a `Logger` alias for `BasicLogger` in `@cline/core`'s public index; also drops types that leaked into the published surface
* path updates
* rename folders
* fix examples reorg references
* move over files
* having agent fixing and validating all examples are still working
* fix sidecar paths
---------
Co-authored-by: abeatrix <beatrix@cline.bot>