@f5-sales-demo/xcsh 21.9.0 → 21.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@f5-sales-demo/xcsh",
4
- "version": "21.9.0",
4
+ "version": "21.9.2",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/f5-sales-demo/xcsh",
7
7
  "author": "Can Boluk",
@@ -61,13 +61,13 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@agentclientprotocol/sdk": "1.3.0",
64
- "@f5-sales-demo/pi-agent-core": "21.9.0",
65
- "@f5-sales-demo/pi-ai": "21.9.0",
66
- "@f5-sales-demo/pi-natives": "21.9.0",
67
- "@f5-sales-demo/pi-resource-management": "21.9.0",
68
- "@f5-sales-demo/pi-tui": "21.9.0",
69
- "@f5-sales-demo/pi-utils": "21.9.0",
70
- "@f5-sales-demo/xcsh-stats": "21.9.0",
64
+ "@f5-sales-demo/pi-agent-core": "21.9.2",
65
+ "@f5-sales-demo/pi-ai": "21.9.2",
66
+ "@f5-sales-demo/pi-natives": "21.9.2",
67
+ "@f5-sales-demo/pi-resource-management": "21.9.2",
68
+ "@f5-sales-demo/pi-tui": "21.9.2",
69
+ "@f5-sales-demo/pi-utils": "21.9.2",
70
+ "@f5-sales-demo/xcsh-stats": "21.9.2",
71
71
  "@mozilla/readability": "^0.6",
72
72
  "@sinclair/typebox": "^0.34",
73
73
  "@xterm/headless": "^6.0",
@@ -17,17 +17,17 @@ export interface BuildInfo {
17
17
  }
18
18
 
19
19
  export const BUILD_INFO: BuildInfo = {
20
- "version": "21.9.0",
21
- "commit": "7ee899e33f372b2cc147d2f38903e2e77b1cd7b2",
22
- "shortCommit": "7ee899e",
20
+ "version": "21.9.2",
21
+ "commit": "56616a2381219096fc67218de2cc8f42b369ca5d",
22
+ "shortCommit": "56616a2",
23
23
  "branch": "main",
24
- "tag": "v21.9.0",
25
- "commitDate": "2026-09-03T04:22:53+00:00",
26
- "buildDate": "2026-09-03T04:50:52.144Z",
24
+ "tag": "v21.9.2",
25
+ "commitDate": "2026-09-03T06:02:32+00:00",
26
+ "buildDate": "2026-09-03T06:34:34.898Z",
27
27
  "dirty": true,
28
28
  "prNumber": "",
29
29
  "repoUrl": "https://github.com/f5-sales-demo/xcsh",
30
30
  "repoSlug": "f5-sales-demo/xcsh",
31
- "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/7ee899e33f372b2cc147d2f38903e2e77b1cd7b2",
32
- "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.9.0"
31
+ "commitUrl": "https://github.com/f5-sales-demo/xcsh/commit/56616a2381219096fc67218de2cc8f42b369ca5d",
32
+ "releaseUrl": "https://github.com/f5-sales-demo/xcsh/releases/tag/v21.9.2"
33
33
  };
@@ -125,7 +125,7 @@ export const EMBEDDED_DOCS: Readonly<Record<string, string>> = {
125
125
  "en/extensions/extensions.md": "---\ntitle: Extensions\ndescription: Extension runtime overview covering types, runner lifecycle, registration, and discovery.\nsidebar:\n order: 1\n label: Overview\n---\n\nThis document details the extension system for the xcsh coding agent runtime.\n\nImplementation files:\n\n- `src/extensibility/extensions/types.ts`\n- `src/extensibility/extensions/runner.ts`\n- `src/extensibility/extensions/wrapper.ts`\n- `src/extensibility/extensions/index.ts`\n- `src/modes/controllers/extension-ui-controller.ts`\n\nFor discovery paths and filesystem scanning rules, see [Extension loading](file:///data/robin-GIT/language-improvement/xcsh/docs/en/extensions/extension-loading.md).\n\n## Extension architecture\n\nAn extension is a TypeScript or JavaScript module that exports a default factory function:\n\n```ts\nimport type { ExtensionAPI } from \"@f5-sales-demo/xcsh\";\n\nexport default function myExtension(pi: ExtensionAPI) {\n // Register event handlers, tools, commands, and renderers\n}\n```\n\nA single extension module can register and combine multiple capabilities:\n\n- Lifecycle event handlers (`pi.on(...)`)\n- LLM-callable tools (`pi.registerTool(...)`)\n- Interactive slash commands (`pi.registerCommand(...)`)\n- Keyboard shortcuts and CLI flags\n- Custom message renderers\n- Message injection APIs (`sendMessage`, `sendUserMessage`, `appendEntry`)\n\n## Runtime execution model\n\nThe extension lifecycle proceeds through the following stages:\n\n1. Dynamic import: The runtime imports modules and executes their exported factory functions.\n2. Registration: Factory functions register tools, commands, and event handlers. Calling runtime action methods during this phase is disallowed.\n3. Initialization: `ExtensionRunner.initialize(...)` binds live contexts and action dispatchers for the active execution mode.\n4. Event dispatch: The runner emits lifecycle events to registered handlers.\n5. Tool interception: The runtime wraps every tool invocation with `tool_call` and `tool_result` middleware handlers.\n\nCalling runtime action methods (such as `pi.sendMessage()`) during the initial loading phase throws `ExtensionRuntimeNotInitializedError`. Complete all registrations first, and perform runtime actions from within event handlers, command callbacks, or tool execution functions.\n\n## Quick start guide\n\nThe following example registers an extension with event interception, a custom tool, and a slash command:\n\n```ts\nimport type { ExtensionAPI } from \"@f5-sales-demo/xcsh\";\nimport { Type } from \"@sinclair/typebox\";\n\nexport default function (pi: ExtensionAPI) {\n pi.setLabel(\"Safety and Utilities\");\n\n pi.on(\"session_start\", async (_event, ctx) => {\n ctx.ui.notify(`Extension loaded in ${ctx.cwd}`, \"info\");\n });\n\n pi.on(\"tool_call\", async (event) => {\n if (event.toolName === \"bash\" && event.input.command?.includes(\"rm -rf\")) {\n return { block: true, reason: \"Command blocked by security policy.\" };\n }\n });\n\n pi.registerTool({\n name: \"hello_extension\",\n label: \"Hello Extension\",\n description: \"Returns a friendly greeting.\",\n parameters: Type.Object({ name: Type.String() }),\n async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {\n return {\n content: [{ type: \"text\", text: `Hello, ${params.name}!` }],\n details: { greeted: params.name },\n };\n },\n });\n\n pi.registerCommand(\"check-queue\", {\n description: \"Displays pending message queue status.\",\n handler: async (_args, ctx) => {\n ctx.ui.notify(`Pending messages: ${ctx.hasPendingMessages()}`, \"info\");\n },\n });\n}\n```\n\n## Extension API reference\n\n### 1. Registration and action APIs (`ExtensionAPI`)\n\nCore methods available on the `pi` API object:\n\n- `on(event, handler)`: Subscribes to lifecycle and operational events.\n- `registerTool`, `registerCommand`, `registerShortcut`, `registerFlag`: Registers capabilities.\n- `registerMessageRenderer`: Registers custom UI component renderers.\n- `sendMessage`, `sendUserMessage`, `appendEntry`: Injects messages and custom session state entries.\n- `getActiveTools`, `getAllTools`, `setActiveTools`: Inspects and reconfigures active tools.\n- `getSessionName`, `setSessionName`: Inspects and updates session titles.\n- `setModel`, `getThinkingLevel`, `setThinkingLevel`: Reconfigures active models and reasoning levels.\n- `registerProvider`: Registers custom LLM inference providers.\n- `events`: Exposes the shared event bus.\n\nIn interactive mode, `input` handlers execute prior to automatic session titling. Extensions calling `await pi.setSessionName(...)` within an `input` handler set a persistent title and bypass automatic title generation.\n\nUtility exports on the API object:\n\n- `pi.logger`: Structured logger.\n- `pi.typebox`: TypeBox schema builder.\n- `pi.pi`: Re-exported package symbols.\n\n#### Message delivery semantics\n\n`pi.sendMessage(message, options)` supports the following delivery policies:\n\n- `deliverAs: \"steer\"` (default): Interrupts the current agent run immediately.\n- `deliverAs: \"followUp\"`: Queues the message for execution after the current run completes.\n- `deliverAs: \"nextTurn\"`: Preserves the message to inject into the subsequent user turn.\n- `triggerTurn: true`: Initiates an agent turn when idle (ignored for `nextTurn`).\n\n`pi.sendUserMessage(content, { deliverAs })` processes input through the prompt pipeline. During streaming, it queues as a steering or follow-up turn.\n\n### 2. Handler execution context (`ExtensionContext`)\n\nEvent handlers and tool `execute` callbacks receive a context object containing:\n\n- `ui`: User interface controller (`ExtensionUIContext`).\n- `hasUI`: Boolean indicating interactive UI availability.\n- `cwd`: Active working directory path.\n- `sessionManager`: Read-only session management interface.\n- `modelRegistry`, `model`: Active model metadata and registry instance.\n- `getContextUsage()`: Returns context window token utilization.\n- `compact(...)`: Triggers session compaction.\n- `isIdle()`, `hasPendingMessages()`, `abort()`: Runtime status queries and cancellation.\n- `shutdown()`: Terminates the agent process.\n- `getSystemPrompt()`: Returns the active system prompt string.\n\n### 3. Command execution context (`ExtensionCommandContext`)\n\nSlash command handlers receive an extended context with session-control operations:\n\n- `waitForIdle()`: Waits for active streaming to complete.\n- `newSession(...)`: Initializes a fresh session.\n- `switchSession(...)`: Switches to an existing session file.\n- `branch(entryId)`: Forks a session branch from a specific history entry.\n- `navigateTree(targetId, { summarize })`: Navigates to a specific node in the session tree.\n- `reload()`: Reloads the active configuration and extension suite.\n\n## Event system reference\n\n### Session lifecycle events\n\n- `session_start`: Dispatched after session initialization.\n- `session_before_switch`, `session_switch`: Dispatched prior to and following a session switch.\n- `session_before_branch`, `session_branch`: Dispatched prior to and following a branch fork.\n- `session_before_compact`, `session.compacting`, `session_compact`: Dispatched during compaction.\n- `session_before_tree`, `session_tree`: Dispatched during session tree traversal.\n- `session_shutdown`: Dispatched before process termination.\n\nCancelable pre-event return structures:\n\n- `session_before_switch`: Returns `{ cancel?: boolean }`.\n- `session_before_branch`: Returns `{ cancel?: boolean; skipConversationRestore?: boolean }`.\n- `session_before_compact`: Returns `{ cancel?: boolean; compaction?: CompactionResult }`.\n- `session_before_tree`: Returns `{ cancel?: boolean; summary?: { summary: string; details?: unknown } }`.\n\n### Prompt and turn lifecycle events\n\n- `input`: Dispatched when the user submits input.\n- `before_agent_start`: Dispatched before model invocation.\n- `context`: Dispatched during prompt context assembly.\n- `agent_start`, `agent_end`: Dispatched at the boundaries of an overall agent task.\n- `turn_start`, `turn_end`: Dispatched at the boundaries of a single model inference turn.\n- `message_start`, `message_update`, `message_end`: Dispatched during message generation and streaming.\n\n### Tool lifecycle events\n\n- `tool_call`: Dispatched before tool execution. Handlers can block execution by returning `{ block: true, reason: \"...\" }`.\n- `tool_result`: Dispatched after execution. Middleware handlers can modify `content`, `details`, or `isError`.\n- `tool_execution_start`, `tool_execution_update`, `tool_execution_end`: Observability events for progress tracking.\n\n### Operational and reliability events\n\n- `auto_compaction_start`, `auto_compaction_end`: Auto-compaction boundaries.\n- `auto_retry_start`, `auto_retry_end`: Model request retry attempts.\n- `ttsr_triggered`: Test-time self-reflection event triggers.\n- `todo_reminder`: Task tracking reminders.\n\n### User command interception\n\n- `user_bash`: Intercepts interactive bash commands (override with `{ result }`).\n- `user_python`: Intercepts interactive Python commands (override with `{ result }`).\n\n## Tool implementation reference\n\nRegister tools using `pi.registerTool(...)` with the following schema:\n\n```ts\npi.registerTool({\n name: \"custom_analyzer\",\n label: \"Custom Analyzer\",\n description: \"Analyzes workspace configuration files.\",\n parameters: Type.Object({\n targetPath: Type.String(),\n }),\n async execute(toolCallId, params, signal, onUpdate, ctx) {\n if (signal?.aborted) {\n return { content: [{ type: \"text\", text: \"Execution cancelled.\" }] };\n }\n onUpdate?.({ content: [{ type: \"text\", text: \"Analyzing configuration...\" }] });\n return {\n content: [{ type: \"text\", text: \"Analysis complete.\" }],\n details: { target: params.targetPath, status: \"clean\" },\n };\n },\n onSession(event, ctx) {\n // Handles session lifecycle transitions (start, switch, branch, shutdown)\n },\n renderCall(args, theme) {\n // Optional TUI call renderer\n },\n renderResult(result, options, theme, args) {\n // Optional TUI result renderer\n },\n});\n```\n\nTool interception via `tool_call` and `tool_result` applies globally to all registered tools, including built-in tools.\n\n## User interface integration\n\n`ctx.ui` provides the `ExtensionUIContext` interface across execution modes.\n\n### Interactive terminal mode\n\nSupported capabilities:\n\n- Dialogs: `select`, `confirm`, `input`, `editor`.\n- Notifications, status updates, editor text replacement, and custom overlays.\n- Theme listing and switching via `setTheme`.\n- Tool display expansion toggling.\n\n`setFooter`, `setHeader`, and `setEditorComponent` are reserved for custom layouts and act as no-ops in standard TUI views. `setWidget` routes status text to the terminal status bar.\n\n### RPC mode\n\nIn RPC mode, UI calls dispatch newline-delimited JSON frames over stdio:\n\n- Interactive dialogs (`select`, `confirm`, `input`, `editor`) await host responses.\n- Notifications and state updates (`notify`, `setStatus`, `setWidget`, `setTitle`, `setEditorText`) emit asynchronous events.\n\nTerminal input listeners, custom overlays, and theme switching are disabled in headless RPC mode.\n\n### Headless and subagent modes\n\nWhen running in print, subagent, or headless environments, `ctx.hasUI` evaluates to `false`, and UI methods return default fallback values immediately.\n\n## Session state management\n\nTo persist extension state across session switches and restarts:\n\n1. Record state updates using `pi.appendEntry(\"custom_type\", stateData)`.\n2. Restore state during `session_start`, `session_branch`, or `session_tree` by querying `ctx.sessionManager.getBranch()`.\n3. Store structured data in tool result `details` objects so state remains reconstructible from history.\n\nState reconstruction pattern:\n\n```ts\npi.on(\"session_start\", async (_event, ctx) => {\n let restoredState: unknown = null;\n for (const entry of ctx.sessionManager.getBranch()) {\n if (entry.type === \"custom\" && entry.customType === \"my-extension-state\") {\n restoredState = entry.data;\n }\n }\n if (restoredState) {\n // Reinitialize extension state\n }\n});\n```\n\n## Custom visual renderers\n\n### Custom message renderer\n\n```ts\npi.registerMessageRenderer(\"custom-result\", (message, { expanded }, theme) => {\n // Return a pi-tui Component for TUI rendering\n});\n```\n\n### Custom tool renderer\n\nDefine `renderCall` and `renderResult` within `registerTool` to render specialized TUI widgets for tool arguments and results.\n\n## Operational constraints\n\n- Runtime actions are unavailable during the initial module loading phase.\n- Handlers returning `{ block: true }` in `tool_call` fail closed and prevent tool execution.\n- Command names matching existing built-in commands are ignored with diagnostic warnings.\n- Reserved keyboard shortcuts cannot be overridden (`Ctrl+C`, `Ctrl+D`, `Ctrl+Z`, `Ctrl+K`, `Ctrl+P`, `Ctrl+L`, `Ctrl+O`, `Ctrl+T`, `Ctrl+G`, `Shift+Tab`, `Shift+Ctrl+P`, `Alt+Enter`, `Escape`, `Enter`).\n- Invoking `ctx.reload()` terminates the active command execution frame.\n\n## Comparing extensions, hooks, and custom tools\n\n- **Extensions** (`src/extensibility/extensions/*`): Unified extension surface supporting events, tools, slash commands, UI renderers, and custom model providers.\n- **Hooks** (`src/extensibility/hooks/*`): Dedicated event handling subsystem.\n- **Custom tools** (`src/extensibility/custom-tools/*`): Focused tool definitions adapted automatically into the extension tool registry.\n\nWhen building packages that require coordinated policy enforcement, custom tools, slash commands, and user interface elements, use the unified extension system.\n",
126
126
  "en/extensions/gemini-manifest-extensions.md": "---\ntitle: Gemini Manifest Extensions\ndescription: Gemini manifest extension format for cross-platform skill and agent compatibility.\nsidebar:\n order: 7\n label: Gemini manifest\n---\n\nThis document describes how the xcsh coding agent discovers, parses, and surfaces Gemini-format manifest extensions (`gemini-extension.json`) within the capability discovery pipeline.\n\nFor executable TypeScript and JavaScript extension modules, see [Extension loading](file:///data/robin-GIT/language-improvement/xcsh/docs/en/extensions/extension-loading.md).\n\n## Implementation files\n\n- `packages/coding-agent/src/discovery/gemini.ts`\n- `packages/coding-agent/src/discovery/builtin.ts`\n- `packages/coding-agent/src/discovery/helpers.ts`\n- `packages/coding-agent/src/capability/extension.ts`\n- `packages/coding-agent/src/capability/index.ts`\n- `packages/coding-agent/src/extensibility/extensions/loader.ts`\n\n## Discovered paths\n\nThe Gemini capability provider (`id: gemini`, priority `60`) registers an `extensions` loader that scans two fixed root directories:\n\n- **User scope**: `~/.gemini/extensions`\n- **Project scope**: `<cwd>/.gemini/extensions`\n\nThe loader resolves paths directly from `ctx.home` and `ctx.cwd` using `getUserPath()` and `getProjectPath()`. Project lookup is evaluated against the current working directory (`<cwd>`) only and does not traverse parent directories.\n\n## Directory scanning rules\n\nFor each root directory, discovery executes the following sequence:\n\n1. Read child directory entries via `readDirEntries(root)`.\n2. Filter entries to retain direct child directories (`entry.isDirectory()`).\n3. For each subdirectory `<NAME>`, attempt to read `<ROOT>/<NAME>/gemini-extension.json`.\n\nDirectory scanning does not recurse beyond the immediate child directory level.\n\n### Hidden directory support\n\nGemini manifest discovery does not filter out dot-prefixed directory names. If a hidden directory contains a valid `gemini-extension.json` file, the loader evaluates it.\n\n### Missing and unreadable files\n\nIf `gemini-extension.json` does not exist or lacks read permissions, the loader skips the directory silently.\n\n## Manifest schema and normalization\n\nThe capability model defines the manifest structure as follows:\n\n```ts\ninterface ExtensionManifest {\n name?: string;\n description?: string;\n mcpServers?: Record<string, Omit<MCPServer, \"name\" | \"_source\">>;\n tools?: unknown[];\n context?: unknown;\n}\n```\n\nDiscovery applies flexible validation rules:\n\n- Valid JSON syntax is required.\n- The loader preserves the parsed JSON object on the capability record as `manifest`.\n- Internal fields (`mcpServers`, `tools`, `context`) are parsed without schema enforcement during discovery.\n\n### Extension name resolution\n\nThe loader determines `Extension.name` using the following fallback order:\n\n1. `manifest.name` if present and defined.\n2. The containing directory name.\n\n## Materialization into capability items\n\nA valid manifest file creates an `Extension` capability item:\n\n```ts\n{\n name: manifest.name ?? \"<DIRECTORY_NAME>\",\n path: \"<EXTENSION_DIRECTORY_PATH>\",\n manifest: parsedJson,\n level: \"user\" | \"project\",\n _source: {\n provider: \"gemini\",\n providerName: \"Gemini CLI\",\n path: \"<ABSOLUTE_MANIFEST_PATH>\",\n level: \"user\" | \"project\"\n }\n}\n```\n\nOperational details:\n\n- `_source.path` normalizes to an absolute filesystem path via `createSourceMeta()`.\n- Registry-level validation requires both `name` and `path` to be present.\n\n## Error handling and diagnostic warnings\n\n### Diagnostic warnings\n\n- Syntax errors in manifest JSON emit a warning: `Invalid JSON in <MANIFEST_PATH>`.\n\n### Silent fallback (no warnings)\n\n- Missing `extensions` directory.\n- Subdirectory without `gemini-extension.json`.\n- Unreadable file permissions.\n\n## Precedence and deduplication\n\nThe capability registry aggregates `extensions` across registered providers:\n\n- `native` provider (`packages/coding-agent/src/discovery/builtin.ts`): Priority `100`.\n- `gemini` provider (`packages/coding-agent/src/discovery/gemini.ts`): Priority `60`.\n\nDeduplication uses `ext.name` as the primary key (`extensionCapability.key = ext => ext.name`).\n\n### Cross-provider precedence\n\nHigher-priority providers override duplicate extension names:\n\n- If both `native` and `gemini` define an extension named `custom-tools`, the `native` definition takes precedence.\n- The shadowed lower-priority item is preserved in `result.all` with `_shadowed: true`.\n\n### Intra-provider ordering\n\nWithin the Gemini provider, deduplication operates on a first-seen basis:\n\n- The Gemini loader appends user-level extensions first, followed by project-level extensions.\n- If identical extension names exist in both `~/.gemini/extensions` and `<cwd>/.gemini/extensions`, the user-level entry takes precedence, shadowing the project entry.\n\n## Architectural boundary between metadata and module loading\n\nDiscovery of `gemini-extension.json` produces declarative `Extension` capability records. It does not load executable TypeScript or JavaScript extension modules into runtime memory.\n\nRuntime extension module execution (`discoverAndLoadExtensions()` and `loadExtensions()`) targets executable `extension-modules` and filters auto-discovered candidates strictly to the `native` provider.\n\nThis separation allows declarative tooling and compatibility metadata to be discovered without executing untrusted external code.\n",
127
127
  "en/extensions/marketplace.md": "---\ntitle: Marketplace Plugin System\ndescription: Marketplace plugin system for discovering, installing, and managing curated plugin collections.\nsidebar:\n order: 4\n label: Marketplace\n---\n\nThe marketplace system enables discovery, installation, and lifecycle management of plugin packages from Git-hosted catalogs. It adheres to the Claude Code plugin registry format.\n\n## Quick start\n\nInstall a marketplace catalog and a targeted plugin:\n\n```bash\n/marketplace add anthropics/f5-sales-demo-marketplace\n/marketplace install wordpress.com@f5-sales-demo-marketplace\n```\n\nRun `/marketplace` without arguments to launch the interactive plugin browser.\n\n## Core concepts\n\n- **Marketplace**: A Git repository or local directory containing a catalog manifest at `.xcsh-plugin/marketplace.json`. The catalog lists available plugins with source locations, descriptions, and metadata.\n- **Plugin**: A directory containing skills, slash commands, event hooks, Model Context Protocol (MCP) servers, or Language Server Protocol (LSP) servers. Plugins use the identifier format `<PLUGIN_NAME>@<MARKETPLACE_NAME>` (for example, `code-review@f5-sales-demo-marketplace`).\n- **Installation scopes**:\n - **User scope** (default): Available across all workspace projects. Stored in `~/.xcsh/plugins/installed_plugins.json`.\n - **Project scope**: Available exclusively within the current project repository. Stored in `.xcsh/installed_plugins.json`.\n\nProject-scoped plugin installations shadow user-scoped installations of the same plugin identifier.\n\n## Command reference\n\n### Interactive commands\n\n| Command | Description |\n| --- | --- |\n| `/marketplace` | Launches the interactive plugin browser and installation interface. |\n\n### Marketplace management commands\n\n| Command | Description |\n| --- | --- |\n| `/marketplace add <SOURCE>` | Registers a new marketplace source. |\n| `/marketplace remove <NAME>` | Removes a registered marketplace catalog. |\n| `/marketplace update [<NAME>]` | Re-fetches catalog metadata. Updates all catalogs when omitted. |\n| `/marketplace list` | Lists all configured marketplaces. |\n\n### Plugin lifecycle commands\n\n| Command | Description |\n| --- | --- |\n| `/marketplace discover [<MARKETPLACE>]` | Lists available plugins in configured marketplaces. |\n| `/marketplace install [--force] [--scope user\\|project] <NAME>@<MARKETPLACE>` | Installs a designated plugin. |\n| `/marketplace uninstall [--scope user\\|project] <NAME>@<MARKETPLACE>` | Removes an installed plugin. |\n| `/marketplace installed` | Lists currently installed plugins. |\n| `/marketplace upgrade [--scope user\\|project] [<NAME>@<MARKETPLACE>]` | Upgrades installed plugins to the latest catalog release. |\n\n### Command-line interface equivalents\n\nThe preceding operations are also available through direct CLI invocations:\n\n```bash\nxcsh plugin marketplace add <SOURCE>\nxcsh plugin marketplace remove <NAME>\nxcsh plugin marketplace update [<NAME>]\nxcsh plugin marketplace list\nxcsh plugin discover [<MARKETPLACE>]\nxcsh plugin install --scope project <NAME>@<MARKETPLACE>\n```\n\n## Supported marketplace sources\n\nWhen registering a catalog using `/marketplace add <SOURCE>`, the runtime classifies the source format automatically:\n\n| Source format | Classification | Example |\n| --- | --- | --- |\n| `owner/repo` | GitHub repository shorthand | `anthropics/f5-sales-demo-marketplace` |\n| `https://...*.json` | Direct catalog URL | `https://example.com/marketplace.json` |\n| `https://...*.git` or `git@...` | Git repository URI | `https://github.com/org/repo.git` |\n| `./path`, `~/path`, `/path` | Local filesystem directory | `./my-marketplace` |\n\nThe runtime clones or reads the source, validates `.xcsh-plugin/marketplace.json`, and caches catalog metadata locally.\n\n## Catalog manifest format (`marketplace.json`)\n\nThe marketplace catalog resides at `.xcsh-plugin/marketplace.json` at the root of the source repository:\n\n```json\n{\n \"$schema\": \"https://anthropic.com/claude-code/marketplace.schema.json\",\n \"name\": \"custom-marketplace\",\n \"owner\": {\n \"name\": \"Operator Name\",\n \"email\": \"operator@example.com\"\n },\n \"description\": \"Curated demonstration and utility plugins\",\n \"plugins\": [\n {\n \"name\": \"custom-plugin\",\n \"description\": \"Provides automation tools and skills.\",\n \"source\": \"./plugins/custom-plugin\",\n \"category\": \"development\",\n \"homepage\": \"https://github.com/example/custom-plugin\"\n }\n ]\n}\n```\n\n### Required manifest properties\n\n| Property | Description |\n| --- | --- |\n| `name` | Canonical marketplace identifier (lowercase alphanumeric characters, hyphens, and dots; maximum 64 characters). |\n| `owner.name` | Name of the marketplace maintainer or organization. |\n| `plugins` | Array of plugin definition entries. |\n\n### Plugin definition properties\n\n| Property | Required | Description |\n| --- | --- | --- |\n| `name` | Yes | Plugin identifier adhering to naming constraints. |\n| `source` | Yes | Source resolution descriptor (relative path, Git URL, GitHub shorthand, npm). |\n| `description` | No | Human-readable functional description. |\n| `version` | No | Semantic version string. |\n| `author` | No | Author metadata (`{ \"name\": \"...\", \"email\": \"...\" }`). |\n| `homepage` | No | Documentation or source repository URL. |\n| `category` | No | Functional category (for example, `development`, `productivity`, `security`). |\n| `tags` | No | Array of search categorization tags. |\n| `strict` | No | Boolean enforcement flag. |\n| `commands` | No | Slash commands registered by the plugin. |\n| `agents` | No | Subagents provided by the plugin. |\n| `hooks` | No | Event hook definitions. |\n| `mcpServers` | No | Model Context Protocol server configurations. |\n| `lspServers` | No | Language Server Protocol configurations. |\n\n### Plugin source specifications\n\nThe `source` descriptor supports the following formats:\n\n#### Relative directory path within marketplace repository\n\n```json\n\"source\": \"./plugins/custom-plugin\"\n```\n\n#### Remote Git repository\n\n```json\n\"source\": {\n \"source\": \"url\",\n \"url\": \"https://github.com/org/repo.git\",\n \"sha\": \"a1b2c3d4...\"\n}\n```\n\n#### GitHub repository shorthand\n\n```json\n\"source\": {\n \"source\": \"github\",\n \"repo\": \"org/repo\",\n \"ref\": \"main\",\n \"sha\": \"a1b2c3d4...\"\n}\n```\n\n#### Monorepo subdirectory\n\n```json\n\"source\": {\n \"source\": \"git-subdir\",\n \"url\": \"https://github.com/org/monorepo.git\",\n \"path\": \"plugins/custom-plugin\",\n \"ref\": \"main\",\n \"sha\": \"a1b2c3d4...\"\n}\n```\n\n#### npm package\n\n```json\n\"source\": {\n \"source\": \"npm\",\n \"package\": \"@scope/custom-plugin\",\n \"version\": \"1.0.0\"\n}\n```\n\n## Filesystem layout\n\n```text\n~/.xcsh/\n config/\n marketplaces.json # Registry of configured marketplaces\n plugins/\n installed_plugins.json # User-scoped plugin installations\n cache/\n marketplaces/ # Cached marketplace catalog manifests\n plugins/ # Cached plugin file trees\n\n<project>/.xcsh/\n installed_plugins.json # Project-scoped plugin installations\n```\n\n## Identifier naming constraints\n\nMarketplace and plugin identifiers must comply with the following validation rules:\n\n- Must begin and end with a lowercase ASCII letter or digit.\n- May contain only lowercase ASCII letters, digits, hyphens (`-`), and dots (`.`).\n- Must not exceed 64 characters in length.\n\nCombined plugin identifiers (`<NAME>@<MARKETPLACE>`) must not exceed 128 characters in total length.\n\n- **Valid examples**: `custom-plugin`, `code-review`, `wordpress.com`, `f5-sales-demo`\n- **Invalid examples**: `-invalid`, `invalid-`, `.invalid`, `InvalidCase`, `under_score`\n",
128
- "en/extensions/plugin-manager-installer-plumbing.md": "---\ntitle: Plugin Manager and Installer Plumbing\ndescription: Plugin manager internals covering installation, validation, dependency resolution, and lifecycle management.\nsidebar:\n order: 5\n label: Plugin manager\n---\n\nThis document describes how `xcsh plugin` operations manage plugin state on disk and how installed plugins become active runtime capabilities.\n\n## Architecture and scope\n\nThe codebase provides two plugin management modules:\n\n1. **Active CLI execution path**: `PluginManager` (`src/extensibility/plugins/manager.ts`).\n2. **Legacy installer module**: Functions in `src/extensibility/plugins/installer.ts`.\n\nAll `xcsh plugin ...` CLI commands execute through `PluginManager`.\n\n## Lifecycle: CLI invocation to runtime capabilities\n\nThe following sequence illustrates how plugin commands execute and activate capabilities:\n\n1. Command entry point: `src/commands/plugin.ts` parses CLI flags and invokes `runPluginCommand(...)` in `src/cli/plugin-cli.ts`.\n2. Action dispatch: `PluginManager` executes the requested lifecycle method (`install`, `uninstall`, `list`, `link`, `doctor`, `features`, `config`, `enable`, `disable`).\n3. State mutation: The manager updates package descriptors and lockfiles in `~/.xcsh/plugins/` (`package.json`, `node_modules/`, `xcsh-plugins.lock.json`).\n4. Capability discovery: During session initialization, `discoverAndLoadCustomTools(...)` queries `getAllPluginToolPaths(cwd)`.\n5. Module loading: The custom tool loader imports tool definitions into the active runtime registry.\n\n> [!NOTE]\n> Package updates execute by running `install` with an updated package or version specification.\n\n## On-disk state model\n\nGlobal plugin state resides under `~/.xcsh/plugins/`:\n\n- `package.json`: Dependency manifest managed by `bun install` and `bun uninstall`.\n- `node_modules/`: Directory containing installed packages and symlinks.\n- `xcsh-plugins.lock.json`: Persistent runtime state file recording:\n - Global enablement status per plugin.\n - Active feature configurations per plugin.\n - Plugin-specific setting key-value pairs.\n\nProject-specific overrides reside at `<cwd>/.xcsh/plugin-overrides.json`. Project overrides take precedence over global lockfile settings to enable, disable, or reconfigure plugins for a specific workspace.\n\n## Package specification parsing and metadata resolution\n\n### Specification grammar\n\nThe `parsePluginSpec` utility (`parser.ts`) supports the following package specification patterns:\n\n- `pkg`: Default feature selection policy (`features: null`).\n- `pkg[*]`: Enables all features declared in the package manifest.\n- `pkg[]`: Disables all optional features.\n- `pkg[feat1,feat2]`: Enables explicitly specified features.\n- `@scope/pkg@1.2.3[feat]`: Scoped, version-pinned package with explicit feature selection.\n\n`extractPackageName` strips version suffixes to determine on-disk module paths.\n\n### Manifest resolution order\n\nThe runtime resolves plugin manifests in the following order:\n\n1. `package.json` `xcsh` block.\n2. `package.json` `pi` block (legacy fallback).\n3. Synthetic fallback manifest: `{ version: package.version }`.\n\nOperational considerations:\n\n- Packages missing `xcsh` or `pi` manifests remain installable and listable, but runtime discovery (`getEnabledPlugins`) skips them.\n- `manifest.version` syncs with the parent `package.json` `version` property.\n- Syntax errors in `package.json` result in immediate read failures.\n\n## Plugin lifecycle workflows\n\n### Installing and updating plugins (`PluginManager.install`)\n\n1. Parse feature brackets and package constraints from the specification string.\n2. Validate package identifiers against regex constraints and shell metacharacter denylists.\n3. Ensure the target `package.json` structure exists under `~/.xcsh/plugins/`.\n4. Execute `bun install <PACKAGE_SPEC>` within `~/.xcsh/plugins/`.\n5. Inspect `node_modules/<PACKAGE_NAME>/package.json`.\n6. Compute the `enabledFeatures` set:\n - `[*]`: All declared manifest features.\n - `[a,b]`: Explicitly requested feature array.\n - `[]`: Empty feature list.\n - Bare specifier: `null` (applies default features at load time).\n7. Upsert the lockfile entry: `{ version, enabledFeatures, enabled: true }`.\n\n### Uninstalling plugins (`PluginManager.uninstall`)\n\n1. Validate the target package name.\n2. Execute `bun uninstall <PACKAGE_NAME>` within `~/.xcsh/plugins/`.\n3. Remove plugin state and configuration entries from `xcsh-plugins.lock.json`:\n - `config.plugins[name]`\n - `config.settings[name]`\n\n### Listing installed plugins (`PluginManager.list`)\n\n1. Read the dependency manifest from `~/.xcsh/plugins/package.json`.\n2. Load runtime state from `xcsh-plugins.lock.json`.\n3. Read project overrides from `<cwd>/.xcsh/plugin-overrides.json`.\n4. Construct `InstalledPlugin` records by merging base lockfile state with project overrides.\n\n### Linking local development plugins (`PluginManager.link`)\n\nThe `link` command symlinks a local development repository into `~/.xcsh/plugins/node_modules/<PACKAGE_NAME>`:\n\n1. Resolve the target path relative to the current working directory.\n2. Verify that the target directory contains a valid `package.json` with a `name` property.\n3. Remove existing files or links at the destination path.\n4. Create the filesystem symlink.\n5. Record an enabled runtime entry with default features in `xcsh-plugins.lock.json`.\n\n## Runtime capability discovery\n\n### Discovery filtering\n\n`getEnabledPlugins(cwd)` inspects installed dependencies and applies the following filters:\n\n- Skips packages missing `package.json` or manifest metadata (`xcsh`/`pi`).\n- Skips packages marked as disabled in `xcsh-plugins.lock.json`.\n- Skips packages disabled via project-level `plugin-overrides.json`.\n\n### Capability path resolution\n\nFor each enabled plugin, the runtime resolves exported capability paths:\n\n- `resolvePluginToolPaths(plugin)`: Resolves tool entry points.\n- `resolvePluginHookPaths(plugin)`: Resolves lifecycle hook entry points.\n- `resolvePluginCommandPaths(plugin)`: Resolves custom slash command entry points.\n\nPaths expand based on base entries and active feature selections. Missing file paths are ignored during initial resolution.\n\n### Runtime integration status\n\n- **Custom tools**: Loaded and registered in runtime memory via `discoverAndLoadCustomTools` (`custom-tools/loader.ts`).\n- **Hooks and commands**: Resolvers are available for capability inspection, while primary extension execution routes through unified extension modules.\n\n## Security boundaries and validation\n\n### Package input validation\n\nPackage specifications undergo validation against regex rules and a shell metacharacter denylist (`[;&|`$(){}[]<>\\\\]`) before invoking Bun subprocesses.\n\n### Execution trust model\n\nPlugin modules execute in-process when imported. Installed plugins are treated as trusted code within the user environment.\n\n## Error handling and failure modes\n\nPlugin state operations do not use distributed transactions:\n\n| Step | Failure condition | Recovery action |\n| --- | --- | --- |\n| Package installation | `bun install` returns non-zero exit code. | Command halts; on-disk state remains unmodified. |\n| Manifest parsing | Package installed, but manifest structure is invalid. | Command reports error; dependency remains in `node_modules`. |\n| State persistence | Package installed, but lockfile write fails. | Command reports error; package remains installed without lockfile entry. |\n| Uninstallation | `bun uninstall` fails. | Command halts; lockfile state is preserved. |\n\nRun `xcsh plugin doctor --fix` to diagnose and reconcile inconsistencies between installed packages and lockfile metadata.\n\n## Primary implementation files\n\n- `packages/coding-agent/src/commands/plugin.ts`: CLI command definitions and flag mappings.\n- `packages/coding-agent/src/cli/plugin-cli.ts`: User-facing command action handlers.\n- `packages/coding-agent/src/extensibility/plugins/manager.ts`: Core lifecycle and state management methods.\n- `packages/coding-agent/src/extensibility/plugins/installer.ts`: Helper functions and link validation guards.\n- `packages/coding-agent/src/extensibility/plugins/loader.ts`: Plugin capability discovery and path resolution.\n- `packages/coding-agent/src/extensibility/plugins/parser.ts`: Specification parsing helpers.\n- `packages/coding-agent/src/extensibility/plugins/types.ts`: Type definitions for manifests and lockfiles.\n- `packages/coding-agent/src/extensibility/custom-tools/loader.ts`: Runtime wiring for plugin-provided tools.\n",
128
+ "en/extensions/plugin-manager-installer-plumbing.md": "---\ntitle: Plugin Manager and Installer Plumbing\ndescription: Plugin manager internals covering installation, validation, dependency resolution, and lifecycle management.\nsidebar:\n order: 5\n label: Plugin manager\n---\n\nThis document describes how `xcsh plugin` operations manage plugin state on disk and how installed plugins become active runtime capabilities.\n\n## Architecture and scope\n\nThe codebase provides two plugin management modules:\n\n1. **Active CLI execution path**: `PluginManager` (`src/extensibility/plugins/manager.ts`).\n2. **Legacy installer module**: Functions in `src/extensibility/plugins/installer.ts`.\n\nAll `xcsh plugin ...` CLI commands execute through `PluginManager`.\n\n## Lifecycle: CLI invocation to runtime capabilities\n\nThe following sequence illustrates how plugin commands execute and activate capabilities:\n\n1. Command entry point: `src/commands/plugin.ts` parses CLI flags and invokes `runPluginCommand(...)` in `src/cli/plugin-cli.ts`.\n2. Action dispatch: `PluginManager` executes the requested lifecycle method (`install`, `uninstall`, `list`, `link`, `doctor`, `features`, `config`, `enable`, `disable`).\n3. State mutation: The manager updates package descriptors and lockfiles in `~/.xcsh/plugins/` (`package.json`, `node_modules/`, `xcsh-plugins.lock.json`).\n4. Capability discovery: During session initialization, `discoverAndLoadCustomTools(...)` queries `getAllPluginToolPaths(cwd)`.\n5. Module loading: The custom tool loader imports tool definitions into the active runtime registry.\n\n> [!NOTE]\n> Package updates execute by running `install` with an updated package or version specification.\n\n## On-disk state model\n\nGlobal plugin state resides under `~/.xcsh/plugins/`:\n\n- `package.json`: Dependency manifest managed by `bun install` and `bun uninstall`.\n- `node_modules/`: Directory containing installed packages and symlinks.\n- `xcsh-plugins.lock.json`: Persistent runtime state file recording:\n - Global enablement status per plugin.\n - Active feature configurations per plugin.\n - Plugin-specific setting key-value pairs.\n\nProject-specific overrides reside at `<cwd>/.xcsh/plugin-overrides.json`. Project overrides take precedence over global lockfile settings to enable, disable, or reconfigure plugins for a specific workspace.\n\n## Package specification parsing and metadata resolution\n\n### Specification grammar\n\nThe `parsePluginSpec` utility (`parser.ts`) supports the following package specification patterns:\n\n- `pkg`: Default feature selection policy (`features: null`).\n- `pkg[*]`: Enables all features declared in the package manifest.\n- `pkg[]`: Disables all optional features.\n- `pkg[feat1,feat2]`: Enables explicitly specified features.\n- `@scope/pkg@1.2.3[feat]`: Scoped, version-pinned package with explicit feature selection.\n\n`extractPackageName` strips version suffixes to determine on-disk module paths.\n\n### Manifest resolution order\n\nThe runtime resolves plugin manifests in the following order:\n\n1. `package.json` `xcsh` block.\n2. `package.json` `pi` block (legacy fallback).\n3. Synthetic fallback manifest: `{ version: package.version }`.\n\nOperational considerations:\n\n- Packages missing `xcsh` or `pi` manifests remain installable and listable, but runtime discovery (`getEnabledPlugins`) skips them.\n- `manifest.version` syncs with the parent `package.json` `version` property.\n- Syntax errors in `package.json` result in immediate read failures.\n\n### Identity and resolver resource manifests\n\n`.xcsh-plugin/plugin.json` supplies a plugin's display identity and description. The resolver resource\nmanifest, `.xcsh-plugin/resources.json`, is optional for installation, discovery, the `xcsh://plugin`\nindex, and `xcsh://plugin/<id>` identity summaries.\n\nThe index and summary report both resource-manifest presence and whether a present manifest is valid.\nA missing manifest produces a successful identity summary with no declared resources. An invalid\nmanifest also preserves the identity summary and includes a sanitized diagnostic. Resource-specific\nroutes remain strict: `/contract`, `/engine`, and named resource routes require a valid resources\nmanifest and the corresponding declaration. `/file/<path>` is independent of resource declarations.\n\n## Plugin lifecycle workflows\n\n### Installing and updating plugins (`PluginManager.install`)\n\n1. Parse feature brackets and package constraints from the specification string.\n2. Validate package identifiers against regex constraints and shell metacharacter denylists.\n3. Ensure the target `package.json` structure exists under `~/.xcsh/plugins/`.\n4. Execute `bun install <PACKAGE_SPEC>` within `~/.xcsh/plugins/`.\n5. Inspect `node_modules/<PACKAGE_NAME>/package.json`.\n6. Compute the `enabledFeatures` set:\n - `[*]`: All declared manifest features.\n - `[a,b]`: Explicitly requested feature array.\n - `[]`: Empty feature list.\n - Bare specifier: `null` (applies default features at load time).\n7. Upsert the lockfile entry: `{ version, enabledFeatures, enabled: true }`.\n\n### Uninstalling plugins (`PluginManager.uninstall`)\n\n1. Validate the target package name.\n2. Execute `bun uninstall <PACKAGE_NAME>` within `~/.xcsh/plugins/`.\n3. Remove plugin state and configuration entries from `xcsh-plugins.lock.json`:\n - `config.plugins[name]`\n - `config.settings[name]`\n\n### Listing installed plugins (`PluginManager.list`)\n\n1. Read the dependency manifest from `~/.xcsh/plugins/package.json`.\n2. Load runtime state from `xcsh-plugins.lock.json`.\n3. Read project overrides from `<cwd>/.xcsh/plugin-overrides.json`.\n4. Construct `InstalledPlugin` records by merging base lockfile state with project overrides.\n\n### Linking local development plugins (`PluginManager.link`)\n\nThe `link` command symlinks a local development repository into `~/.xcsh/plugins/node_modules/<PACKAGE_NAME>`:\n\n1. Resolve the target path relative to the current working directory.\n2. Verify that the target directory contains a valid `package.json` with a `name` property.\n3. Remove existing files or links at the destination path.\n4. Create the filesystem symlink.\n5. Record an enabled runtime entry with default features in `xcsh-plugins.lock.json`.\n\n## Runtime capability discovery\n\n### Discovery filtering\n\n`getEnabledPlugins(cwd)` inspects installed dependencies and applies the following filters:\n\n- Skips packages missing `package.json` or manifest metadata (`xcsh`/`pi`).\n- Skips packages marked as disabled in `xcsh-plugins.lock.json`.\n- Skips packages disabled via project-level `plugin-overrides.json`.\n\n### Capability path resolution\n\nFor each enabled plugin, the runtime resolves exported capability paths:\n\n- `resolvePluginToolPaths(plugin)`: Resolves tool entry points.\n- `resolvePluginHookPaths(plugin)`: Resolves lifecycle hook entry points.\n- `resolvePluginCommandPaths(plugin)`: Resolves custom slash command entry points.\n\nPaths expand based on base entries and active feature selections. Missing file paths are ignored during initial resolution.\n\n### Runtime integration status\n\n- **Custom tools**: Loaded and registered in runtime memory via `discoverAndLoadCustomTools` (`custom-tools/loader.ts`).\n- **Hooks and commands**: Resolvers are available for capability inspection, while primary extension execution routes through unified extension modules.\n\n## Security boundaries and validation\n\n### Package input validation\n\nPackage specifications undergo validation against regex rules and a shell metacharacter denylist (`[;&|`$(){}[]<>\\\\]`) before invoking Bun subprocesses.\n\n### Execution trust model\n\nPlugin modules execute in-process when imported. Installed plugins are treated as trusted code within the user environment.\n\n## Error handling and failure modes\n\nPlugin state operations do not use distributed transactions:\n\n| Step | Failure condition | Recovery action |\n| --- | --- | --- |\n| Package installation | `bun install` returns non-zero exit code. | Command halts; on-disk state remains unmodified. |\n| Manifest parsing | Package installed, but manifest structure is invalid. | Command reports error; dependency remains in `node_modules`. |\n| State persistence | Package installed, but lockfile write fails. | Command reports error; package remains installed without lockfile entry. |\n| Uninstallation | `bun uninstall` fails. | Command halts; lockfile state is preserved. |\n\nRun `xcsh plugin doctor --fix` to diagnose and reconcile inconsistencies between installed packages and lockfile metadata.\n\n## Primary implementation files\n\n- `packages/coding-agent/src/commands/plugin.ts`: CLI command definitions and flag mappings.\n- `packages/coding-agent/src/cli/plugin-cli.ts`: User-facing command action handlers.\n- `packages/coding-agent/src/extensibility/plugins/manager.ts`: Core lifecycle and state management methods.\n- `packages/coding-agent/src/extensibility/plugins/installer.ts`: Helper functions and link validation guards.\n- `packages/coding-agent/src/extensibility/plugins/loader.ts`: Plugin capability discovery and path resolution.\n- `packages/coding-agent/src/extensibility/plugins/parser.ts`: Specification parsing helpers.\n- `packages/coding-agent/src/extensibility/plugins/types.ts`: Type definitions for manifests and lockfiles.\n- `packages/coding-agent/src/extensibility/custom-tools/loader.ts`: Runtime wiring for plugin-provided tools.\n",
129
129
  "en/extensions/rulebook-matching-pipeline.md": "---\ntitle: Rulebook Matching Pipeline\ndescription: Rulebook matching pipeline for selecting and applying context-specific instruction sets to agent sessions.\nsidebar:\n order: 6\n label: Rulebook matching\n---\n\nThis document describes how the xcsh coding agent discovers rule files across supported configuration formats, normalizes them into canonical `Rule` objects, resolves precedence conflicts, and routes them into:\n\n- **Rulebook rules**: Contextual rules referenced in the system prompt and retrieved on demand via `rule://` URLs.\n- **Always-apply rules**: Global rules injected directly into the system prompt.\n- **TTSR rules**: Test-time self-reflection rules registered with `TtsrManager`.\n\n## Primary implementation files\n\n- `packages/coding-agent/src/capability/rule.ts`\n- `packages/coding-agent/src/capability/index.ts`\n- `packages/coding-agent/src/discovery/index.ts`\n- `packages/coding-agent/src/discovery/helpers.ts`\n- `packages/coding-agent/src/discovery/builtin.ts`\n- `packages/coding-agent/src/discovery/cursor.ts`\n- `packages/coding-agent/src/discovery/windsurf.ts`\n- `packages/coding-agent/src/discovery/cline.ts`\n- `packages/coding-agent/src/sdk.ts`\n- `packages/coding-agent/src/system-prompt.ts`\n- `packages/coding-agent/src/internal-urls/rule-protocol.ts`\n- `packages/coding-agent/src/utils/frontmatter.ts`\n\n## 1. Canonical rule data structure\n\nAll discovery providers normalize rule definitions into the `Rule` interface:\n\n```ts\ninterface Rule {\n name: string;\n path: string;\n content: string;\n globs?: string[];\n alwaysApply?: boolean;\n description?: string;\n ttsrTrigger?: string;\n _source: SourceMeta;\n}\n```\n\nThe capability registry deduplicates rules using `rule.name` as the primary key (`ruleCapability.key = rule => rule.name`). Rules from different filesystem locations sharing the same base name are treated as conflicting versions of the same rule.\n\n## 2. Discovery providers and normalization rules\n\nThe discovery subsystem registers four rule providers:\n\n- `native` (Priority `100`)\n- `cursor` (Priority `50`)\n- `windsurf` (Priority `50`)\n- `cline` (Priority `40`)\n\n### Native provider (`builtin.ts`)\n\nDiscovers xcsh rule files from:\n\n- **Project scope**: `<cwd>/.xcsh/rules/*.{md,mdc}`\n- **User scope**: `~/.xcsh/agent/rules/*.{md,mdc}`\n\nNormalization behavior:\n\n- Derives `name` from the filename minus the `.md` or `.mdc` extension.\n- Parses frontmatter metadata using `parseFrontmatter`.\n- Sets `content` to the markdown body with frontmatter stripped.\n- Maps `globs`, `alwaysApply`, `description`, and `ttsr_trigger` properties directly.\n\n### Cursor provider (`cursor.ts`)\n\nDiscovers rules from:\n\n- **User scope**: `~/.cursor/rules/*.{mdc,md}`\n- **Project scope**: `<cwd>/.cursor/rules/*.{mdc,md}`\n\nNormalization rules (`transformMDCRule`):\n\n- `description`: Retained only when supplied as a string.\n- `alwaysApply`: Preserved when explicitly `true` (`false` normalizes to `undefined`).\n- `globs`: Accepts either a string array or a single string.\n- `ttsr_trigger`: Preserved as a string.\n- Derives `name` from the filename minus the extension.\n\n### Windsurf provider (`windsurf.ts`)\n\nDiscovers rules from:\n\n- **User scope**: `~/.codeium/windsurf/memories/global_rules.md` (assigned the fixed name `global_rules`).\n- **Project scope**: `<cwd>/.windsurf/rules/*.md`.\n\nNormalization behavior:\n\n- `globs`: Normalizes array or single string values.\n- `alwaysApply` and `description`: Parsed directly from frontmatter.\n- `ttsr_trigger`: Preserved as a string.\n- Project rule names derive from individual filenames.\n\n### Cline provider (`cline.ts`)\n\nTraverses upward from the current working directory to locate the nearest `.clinerules`:\n\n- If `.clinerules` is a directory, loads all `*.md` files within it.\n- If `.clinerules` is a single file, loads the rule under the fixed name `clinerules`.\n\n## 3. Frontmatter parsing and fallback handling\n\nProviders parse frontmatter blocks using `parseFrontmatter` (`utils/frontmatter.ts`):\n\n1. The parser identifies frontmatter delimited by opening `---` and closing `\\n---` markers.\n2. The markdown body is trimmed after removing the frontmatter chunk.\n3. If YAML parsing fails:\n - A warning is recorded.\n - The parser falls back to simple line-based `key: value` extraction (`^(\\w+):\\s*(.*)$`).\n\nFallback characteristics:\n\n- The fallback parser does not process arrays, nested dictionaries, or quoted strings.\n- Extracted values default to strings (for example, `alwaysApply: true` parses as string `\"true\"`).\n- Files lacking frontmatter parse cleanly as rules with empty metadata and the entire document body as `content`.\n\n## 4. Provider precedence and deduplication\n\n`loadCapability(\"rules\")` aggregates discovered rules across providers and resolves duplicate rule names:\n\n- Providers are evaluated in descending priority order (`native` > `cursor` = `windsurf` > `cline`).\n- When priorities are equal, registration order determines precedence (`cursor` before `windsurf`).\n- Deduplication follows a first-seen policy: the highest-priority rule matching a given `name` is retained in `items`, while subsequent definitions are recorded in `all` with `_shadowed: true`.\n\n## 5. Classification into Rulebook, Always-Apply, and TTSR categories\n\nDuring session initialization in `createAgentSession` (`sdk.ts`), discovered rules are partitioned into three execution buckets:\n\n1. **TTSR category**: Any rule declaring a `condition` (or `ttsr_trigger` / `ttsrTrigger`) registers with `TtsrManager`. TTSR classification takes precedence over all other categories.\n2. **Always-apply category**: Non-TTSR rules with `alwaysApply: true`. The full markdown body is injected directly into the system prompt.\n3. **Rulebook category**: Non-TTSR rules with a defined `description` and `alwaysApply` not set to `true`. Summarized in the system prompt rules index.\n\nClassification conditions:\n\n- A rule defining both `condition` and `alwaysApply` is assigned exclusively to the TTSR category.\n- A rule defining both `alwaysApply` and `description` is assigned exclusively to the always-apply category.\n\n## 6. Runtime metadata utilization\n\n### `description`\n\n- Required for inclusion in the advisory rulebook index.\n- Displayed in the system prompt `<rules>` block.\n- Rules lacking a description are excluded from the rulebook index and cannot be resolved via `rule://`.\n\n### `globs`\n\n- Formatted as `<glob>...</glob>` elements within the system prompt rules block.\n- Surfaced in TUI extension management panels.\n- Serves as advisory guidance to the model; globs are not evaluated programmatically for rule selection.\n\n### `alwaysApply`\n\n- Triggers direct injection of the rule content into the base system prompt.\n- Available for on-demand re-reading via `rule://<NAME>`.\n\n### `ttsr_trigger`\n\n- Binds the rule to the runtime stream evaluation engine in `TtsrManager`.\n\n## 7. System prompt integration\n\n`buildSystemPromptInternal` constructs the final prompt context:\n\n1. Always-apply rules are rendered first, inserting their full markdown content directly.\n2. Rulebook rules are listed in a `# Rules` section displaying `rule://<NAME>`, functional descriptions, and associated glob patterns.\n\n## 8. The `rule://` URI protocol handler\n\n`RuleProtocolHandler` resolves `rule://` URIs against combined rulebook and always-apply collections:\n\n- Resolves exact rule names (for example, `rule://unit-testing`).\n- TTSR-only rules and rules missing descriptions are not addressable.\n- Requests for unknown rule names return an error listing valid candidates.\n- Returns the rule body (`rule.content`) as `text/markdown`.\n",
130
130
  "en/extensions/skills.md": "---\ntitle: Skills\ndescription: Skills system for registering, discovering, and invoking specialized capabilities in the coding agent.\nsidebar:\n order: 3\n label: Skills\n---\n\nSkills are modular, file-backed capability packages discovered at session startup and exposed to the model through:\n\n- Summary metadata in the system prompt (`name` and `description`).\n- On-demand document retrieval via `skill://` URIs.\n- Interactive slash commands (`/skill:<NAME>`).\n\n## Core skill data model\n\nA discovered skill represents the following metadata:\n\n- `name`: Unique skill identifier.\n- `description`: Functional summary used for model intent matching.\n- `filePath`: Absolute filesystem path to the `SKILL.md` entry point.\n- `baseDir`: Containing directory path for supporting reference files.\n- `_source`: Source metadata tracking provider identity, configuration level, and origin path.\n\n## Directory layout and file conventions\n\n### Directory structure\n\nProvider loaders scan for skills located exactly one subdirectory level below the configured root (`<ROOT>/skills/<SKILL_NAME>/SKILL.md`):\n\n```text\nskills/\n├── postgres/\n│ └── SKILL.md # Discovered\n├── pdf/\n│ └── SKILL.md # Discovered\n└── team/\n └── internal/\n └── SKILL.md # Not discovered (nested directory)\n```\n\n> [!NOTE]\n> Custom directory scanning (`skills.customDirectories`) also operates non-recursively. Point `customDirectories` directly to the parent folder containing individual skill directories.\n\n### `SKILL.md` frontmatter schema\n\n`SKILL.md` files define metadata using YAML frontmatter:\n\n```yaml\n---\nname: postgres-operations\ndescription: PostgreSQL database query, migration, and troubleshooting procedures.\nglobs:\n - \"**/*.sql\"\nalwaysApply: false\n---\n```\n\nFrontmatter parsing rules:\n\n- `name`: Defaults to the containing directory name when omitted.\n- `description`: Required for the native `.xcsh` provider and custom directory scanners.\n- `globs`: Optional array of file glob patterns associated with the skill domain.\n- `alwaysApply`: Boolean flag indicating whether the skill content applies globally.\n\n## Discovery pipeline and precedence\n\n`discoverSkills()` (`src/extensibility/skills.ts`) executes a two-phase discovery workflow:\n\n1. Capability provider scanning via `loadCapability(\"skills\")`.\n2. Custom directory scanning via `scanSkillsFromDir(...)`.\n\n### Provider precedence\n\nThe discovery engine evaluates providers in descending priority order:\n\n1. `native` (Priority `100`): Native `.xcsh` skills in user and project directories.\n2. `claude` (Priority `80`): Claude Code skill locations.\n3. Priority `70` providers:\n - `claude-plugins`\n - `agents`\n - `codex`\n\nWhen skill names collide, the highest-precedence provider wins, shadowing lower-priority duplicates.\n\n### Configuration filters\n\nSkills discovery applies the following configuration filters:\n\n- Provider toggles: `enableCodexUser`, `enableClaudeUser`, `enableClaudeProject`, `enablePiUser`, `enablePiProject`.\n- Name filters:\n - `ignoredSkills`: Array of glob patterns to exclude.\n - `includeSkills`: Optional allowlist of glob patterns to include.\n\n## Runtime interaction models\n\n### System prompt integration\n\nWhen the `read` tool is enabled, `src/system-prompt.ts` appends a list of available skill names and descriptions to the system prompt. The model inspects this list and loads detailed instructions on demand using the `read` tool.\n\n### Interactive slash commands (`/skill:<NAME>`)\n\nWhen `skills.enableSkillCommands` is enabled, the CLI registers dynamic slash commands for each discovered skill:\n\n- `/skill:<NAME> [<ARGS>]`: Reads `SKILL.md`, strips YAML frontmatter, and injects the document body into the session conversation context.\n\n## The `skill://` URI protocol\n\nThe `skill://` protocol handler (`src/internal-urls/skill-protocol.ts`) provides sandboxed access to skill files:\n\n- `skill://<NAME>`: Resolves to `<BASE_DIR>/SKILL.md`.\n- `skill://<NAME>/<RELATIVE_PATH>`: Resolves to `<BASE_DIR>/<RELATIVE_PATH>`.\n\n### Security boundaries\n\n- Paths are URL-decoded and checked against directory traversal (`..`).\n- Absolute paths and paths resolving outside `<BASE_DIR>` are rejected.\n- Missing files return standard `File not found` error responses.\n\n## Skills compared with other extensibility mechanisms\n\n- **Skills vs AGENTS.md / XCSH.md**: Skills provide modular, on-demand reference workflows for specific domains. `AGENTS.md` and `XCSH.md` files provide persistent workspace instructions loaded directly into context.\n- **Skills vs custom slash commands**: Skills provide markdown documentation and domain knowledge. Slash commands define user-facing interactive actions.\n- **Skills vs custom tools**: Skills provide human-readable procedures and context. Custom tools provide executable JavaScript or TypeScript functions with typed parameter schemas.\n- **Skills vs lifecycle hooks**: Skills provide passive guidance. Hooks provide event-driven intercepts that can validate or mutate tool execution.\n\n## Authoring best practices\n\n- Place each skill in a dedicated directory containing a `SKILL.md` entry point.\n- Provide a clear, concise `description` in the YAML frontmatter to guide model tool selection.\n- Store reference scripts, templates, and schemas within the skill directory and link to them using `skill://<NAME>/...` URIs.\n- Ensure skill names are unique across registered providers.\n",
131
131
  "en/index.md": "---\ntitle: xcsh Documentation\ndescription: AI-powered development CLI with TypeScript coding agent and Rust native layer for long-lived sessions, MCP support, and platform packaging.\nsidebar:\n order: 0\n label: Overview\n---\n\nxcsh is an AI-powered development CLI with a TypeScript coding agent and a Rust\nnative acceleration layer (`pi-natives`). It extends the open-source `badlogic/pi-mono`\nfoundation with a hardened runtime, long-lived sessions featuring interactive tree\nnavigation and semantic compaction, Python IPython tooling, complete Model Context\nProtocol (MCP) support, an extensible skills engine, and cross-platform packaging for\nLinux, macOS, and Windows.\n\n## Languages and localization\n\nChoose your language on the documentation portal:\n\n- [English (en)](https://f5-sales-demo.github.io/docs/)\n- [简体中文 (zh-cn)](https://f5-sales-demo.github.io/docs/zh-cn/)\n- [繁體中文 (zh-tw)](https://f5-sales-demo.github.io/docs/zh-tw/)\n- [Português Brasil (pt-br)](https://f5-sales-demo.github.io/docs/pt-br/)\n\n## Documentation catalog\n\n- **[F5 XC Contexts](runtime-tools/context-command)**: Connect to F5 Distributed Cloud tenants, configure authentication profiles, and manage namespaces.\n- **[Container Deployment](container/alpine-deployment)**: Run xcsh inside security-hardened Alpine container images with Docker, Compose, and Podman.\n- **[Configuration](configuration/settings)**: Discover, resolve, and layer hierarchical configuration files.\n- **[Runtime and Tools](runtime-tools/custom-tools)**: Execute bash commands, Jupyter notebook cells, and custom tool extensions.\n- **[Sessions](sessions/session)**: Manage append-only session entry logs, branch trees, context compaction, and long-term memory.\n- **[Natives (Rust)](natives/architecture)**: High-performance N-API native bindings powering terminal PTYs, file operations, and fuzzy search.\n- **[MCP](mcp/mcp-overview)**: Model Context Protocol transport configuration, server management, and tool bridging.\n- **[Extensions and Skills](extensions/extensions)**: Author dynamic plugins, define custom slash commands, and bundle capability skills.\n- **[Providers and Models](providers/providers)**: Configure LLM providers, manage token budgets, and inspect model streaming internals.\n- **[TUI](tui/tui)**: Terminal user interface mechanics, color theming, and tree visualization.\n",
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Generic resolver for xcsh://plugin/<name>/... URLs.
3
3
  *
4
- * Framework-agnostic: it reads a plugin-declared manifest
5
- * (.xcsh-plugin/resources.json) and maps declared keys to files on disk. It has
6
- * NO knowledge of any specific plugin's domain.
4
+ * It combines canonical discovery identity with an optional plugin-declared
5
+ * resource manifest (.xcsh-plugin/resources.json), then maps declared keys to
6
+ * files on disk. It has no knowledge of any specific plugin's domain.
7
7
  *
8
8
  * URL forms (host = "plugin", first path segment = plugin name):
9
9
  * - xcsh://plugin -> list installed plugins
@@ -19,6 +19,7 @@
19
19
  */
20
20
  import * as fs from "node:fs/promises";
21
21
  import * as path from "node:path";
22
+ import { readPluginSummary } from "../discovery/helpers";
22
23
  import { validateRelativePath } from "./skill-protocol";
23
24
  import type { InternalResource, InternalUrl } from "./types";
24
25
 
@@ -45,6 +46,13 @@ interface ResourcesManifest {
45
46
  [key: string]: unknown;
46
47
  }
47
48
 
49
+ export type ResourcesManifestStatus = "absent" | "valid" | "invalid";
50
+
51
+ type ManifestProbe =
52
+ | { status: "absent"; manifest: null }
53
+ | { status: "valid"; manifest: ResourcesManifest }
54
+ | { status: "invalid"; manifest: null; diagnostic: string };
55
+
48
56
  function contentTypeFor(filePath: string): InternalResource["contentType"] {
49
57
  const ext = path.extname(filePath).toLowerCase();
50
58
  if (ext === ".json") return "application/json";
@@ -144,11 +152,16 @@ export class PluginResolver {
144
152
 
145
153
  // xcsh://plugin/<name> -> summary
146
154
  if (selector.length === 0) {
147
- const manifest = await this.#readManifest(root.path);
155
+ const [identity, manifestProbe] = await Promise.all([readPluginSummary(root), this.#probeManifest(root.path)]);
156
+ const hasResourcesManifest = manifestProbe.status !== "absent";
157
+ const resources = manifestProbe.status === "valid" ? Object.keys(manifestProbe.manifest).sort() : [];
148
158
  return this.#json(url, {
149
- name: root.plugin,
159
+ ...identity,
150
160
  version: root.version,
151
- resources: Object.keys(manifest),
161
+ hasResourcesManifest,
162
+ resourcesManifestStatus: manifestProbe.status,
163
+ resources,
164
+ ...(manifestProbe.status === "invalid" ? { resourcesManifestDiagnostic: manifestProbe.diagnostic } : {}),
152
165
  });
153
166
  }
154
167
 
@@ -156,6 +169,7 @@ export class PluginResolver {
156
169
 
157
170
  if (kind === "contract") {
158
171
  const manifestPath = path.join(root.path, PLUGIN_MANIFEST_RELPATH);
172
+ await this.#readManifest(root.path, name);
159
173
  const content = await this.#readFile(manifestPath);
160
174
  return {
161
175
  url: url.href,
@@ -168,7 +182,7 @@ export class PluginResolver {
168
182
  }
169
183
 
170
184
  if (kind === "engine") {
171
- const manifest = await this.#readManifest(root.path);
185
+ const manifest = await this.#readManifest(root.path, name);
172
186
  const engine = manifest.engine;
173
187
  if (!engine?.entry) {
174
188
  throw new Error(`Plugin ${name} declares no engine.entry in ${PLUGIN_MANIFEST_RELPATH}`);
@@ -199,7 +213,7 @@ export class PluginResolver {
199
213
  }
200
214
 
201
215
  // Named resource key from the manifest (e.g. "schema", "example").
202
- const manifest = await this.#readManifest(root.path);
216
+ const manifest = await this.#readManifest(root.path, name);
203
217
  const value = manifest[kind];
204
218
  if (typeof value !== "string") {
205
219
  const keys = Object.keys(manifest).filter(k => typeof manifest[k] === "string");
@@ -256,25 +270,68 @@ export class PluginResolver {
256
270
  };
257
271
  }
258
272
 
259
- async #listPlugins(
260
- roots: readonly PluginRootLike[],
261
- ): Promise<Array<{ name: string; version: string; hasContract: boolean }>> {
262
- const out: Array<{ name: string; version: string; hasContract: boolean }> = [];
273
+ async #listPlugins(roots: readonly PluginRootLike[]): Promise<
274
+ Array<{
275
+ name: string;
276
+ version: string;
277
+ hasResourcesManifest: boolean;
278
+ resourcesManifestStatus: ResourcesManifestStatus;
279
+ }>
280
+ > {
281
+ const out: Array<{
282
+ name: string;
283
+ version: string;
284
+ hasResourcesManifest: boolean;
285
+ resourcesManifestStatus: ResourcesManifestStatus;
286
+ }> = [];
263
287
  for (const r of roots) {
264
- const manifestPath = path.join(r.path, PLUGIN_MANIFEST_RELPATH);
265
- const hasContract = await Bun.file(manifestPath).exists();
266
- out.push({ name: r.plugin, version: r.version, hasContract });
288
+ const manifestProbe = await this.#probeManifest(r.path);
289
+ out.push({
290
+ name: r.plugin,
291
+ version: r.version,
292
+ hasResourcesManifest: manifestProbe.status !== "absent",
293
+ resourcesManifestStatus: manifestProbe.status,
294
+ });
267
295
  }
268
296
  return out;
269
297
  }
270
298
 
271
- async #readManifest(root: string): Promise<ResourcesManifest> {
299
+ async #probeManifest(root: string): Promise<ManifestProbe> {
272
300
  const manifestPath = path.join(root, PLUGIN_MANIFEST_RELPATH);
273
301
  const file = Bun.file(manifestPath);
274
302
  if (!(await file.exists())) {
275
- throw new Error(`Plugin manifest not found: ${manifestPath} (expected ${PLUGIN_MANIFEST_RELPATH})`);
303
+ return { status: "absent", manifest: null };
304
+ }
305
+ try {
306
+ const parsed = JSON.parse(await file.text()) as unknown;
307
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
308
+ return {
309
+ status: "invalid",
310
+ manifest: null,
311
+ diagnostic: `Invalid ${PLUGIN_MANIFEST_RELPATH}: expected a JSON object`,
312
+ };
313
+ }
314
+ return { status: "valid", manifest: parsed as ResourcesManifest };
315
+ } catch {
316
+ return {
317
+ status: "invalid",
318
+ manifest: null,
319
+ diagnostic: `Invalid ${PLUGIN_MANIFEST_RELPATH}: malformed JSON`,
320
+ };
321
+ }
322
+ }
323
+
324
+ async #readManifest(root: string, pluginName: string): Promise<ResourcesManifest> {
325
+ const probe = await this.#probeManifest(root);
326
+ if (probe.status === "absent") {
327
+ throw new Error(
328
+ `Plugin ${pluginName} has no resources manifest (required for this route at ${PLUGIN_MANIFEST_RELPATH})`,
329
+ );
330
+ }
331
+ if (probe.status === "invalid") {
332
+ throw new Error(`Plugin ${pluginName} has an invalid resources manifest: ${probe.diagnostic}`);
276
333
  }
277
- return JSON.parse(await file.text()) as ResourcesManifest;
334
+ return probe.manifest;
278
335
  }
279
336
 
280
337
  async #readFile(absPath: string): Promise<string> {
@@ -1,5 +1,5 @@
1
1
  import { ThinkingLevel } from "@f5-sales-demo/pi-agent-core";
2
- import { canonicalizeOAuthProviderId, type Model } from "@f5-sales-demo/pi-ai";
2
+ import { canonicalizeOAuthProviderId, type Model, ReasoningEffort } from "@f5-sales-demo/pi-ai";
3
3
  import type { Settings } from "../../config/settings";
4
4
  import type { VllmDiscoveredModel } from "../../config/vllm-config";
5
5
  import { applySubscriptionProfileRoles, type SubscriptionProfileId } from "../../routing/subscription-profiles";
@@ -9,7 +9,7 @@ export interface LoginModelChoice {
9
9
  description: string;
10
10
  provider: string;
11
11
  modelId: string;
12
- thinkingLevel: ThinkingLevel;
12
+ thinkingLevel?: ThinkingLevel;
13
13
  }
14
14
 
15
15
  export interface LiteLLMLoginModelChoice extends LoginModelChoice {
@@ -72,10 +72,22 @@ export function getVllmLoginModelChoices(models: readonly VllmDiscoveredModel[])
72
72
  : `${model.contextWindow.toLocaleString("en-US")} token context`,
73
73
  provider: "vllm",
74
74
  modelId: model.id,
75
- thinkingLevel: ThinkingLevel.Off,
76
75
  }));
77
76
  }
78
77
 
78
+ function resolveLoginThinkingLevel(choice: LoginModelChoice, model: Model): ThinkingLevel {
79
+ if (choice.thinkingLevel !== undefined) return choice.thinkingLevel;
80
+ return model.thinking?.supportedLevels.some(level => level.effort === ReasoningEffort.None)
81
+ ? ThinkingLevel.Off
82
+ : ThinkingLevel.Inherit;
83
+ }
84
+
85
+ export function formatLoginThinkingState(level: ThinkingLevel | undefined): string {
86
+ if (level === undefined || level === ThinkingLevel.Inherit) return "provider default thinking";
87
+ if (level === ThinkingLevel.Off) return "thinking off";
88
+ return `thinking ${level}`;
89
+ }
90
+
79
91
  /**
80
92
  * Minimal session surface needed to apply a model after a successful login.
81
93
  * Kept structural so the login flow can call it without pulling in the full
@@ -84,7 +96,6 @@ export function getVllmLoginModelChoices(models: readonly VllmDiscoveredModel[])
84
96
  interface BaseModelApplicableSession {
85
97
  modelRegistry: { getAll(): Model[] };
86
98
  setModel(model: Model, role: "default", options: { selector: string; thinkingLevel: ThinkingLevel }): Promise<void>;
87
- setThinkingLevel(level: ThinkingLevel): void;
88
99
  }
89
100
 
90
101
  interface ModelApplicableSession extends BaseModelApplicableSession {
@@ -96,6 +107,7 @@ interface ModelApplicableSession extends BaseModelApplicableSession {
96
107
  };
97
108
  settings?: Pick<Settings, "getModelRoles" | "get" | "set">;
98
109
  setModelTemporary?(model: Model, thinkingLevel?: ThinkingLevel): Promise<void>;
110
+ setThinkingLevel(level: ThinkingLevel): void;
99
111
  }
100
112
 
101
113
  /**
@@ -115,9 +127,8 @@ export async function applyModelAfterLogin(
115
127
  const selector = `${choice.provider}/${choice.modelId}`;
116
128
  await session.setModel(resolved, "default", {
117
129
  selector,
118
- thinkingLevel: choice.thinkingLevel,
130
+ thinkingLevel: resolveLoginThinkingLevel(choice, resolved),
119
131
  });
120
- session.setThinkingLevel(choice.thinkingLevel);
121
132
  return true;
122
133
  }
123
134
 
@@ -79,6 +79,7 @@ import { commitLiteLLMLogin } from "./litellm-login-transaction";
79
79
  import {
80
80
  applyModelAfterLogin,
81
81
  applyOAuthLoginModel,
82
+ formatLoginThinkingState,
82
83
  GOOGLE_ANTIGRAVITY_LOGIN_MODEL_CHOICE,
83
84
  GOOGLE_VERTEX_LOGIN_MODEL_CHOICE,
84
85
  LITELLM_LOGIN_MODEL_CHOICES,
@@ -1207,7 +1208,14 @@ export class SelectorController {
1207
1208
  new Text(theme.fg("success", `${theme.status.success} vLLM configuration saved to ${modelsPath}`), 1, 0),
1208
1209
  );
1209
1210
  this.ctx.chatContainer.addChild(
1210
- new Text(theme.fg("success", `Default model: vllm/${flowResult.choice.modelId} (thinking off)`), 1, 0),
1211
+ new Text(
1212
+ theme.fg(
1213
+ "success",
1214
+ `Default model: vllm/${flowResult.choice.modelId} (${formatLoginThinkingState(this.ctx.session.thinkingLevel)})`,
1215
+ ),
1216
+ 1,
1217
+ 0,
1218
+ ),
1211
1219
  );
1212
1220
  if (this.ctx.session.modelRegistry.authStorage.get("vllm")) {
1213
1221
  this.ctx.chatContainer.addChild(