Skip to content

Add native chat skill picker with host-aware discovery - #9480

Merged
AmethystLiang merged 7 commits into
mainfrom
add-skill-picker-native-chat
Jul 20, 2026
Merged

AmethystLiang merged 7 commits into
mainfrom
add-skill-picker-native-chat

Conversation

@AmethystLiang

Copy link
Copy Markdown
Contributor

Summary

Unifies native chat's slash command and skill autocomplete into a single picker with host-aware skill discovery. Supports local discovery, WSL distros, remote runtimes, and Claude plugins as skill sources.

Key additions:

  • Unified picker for commands and skills (/ prefix for slash, $ prefix for Codex dollar skills)
  • Host-aware discovery via skill-discovery-target.ts that routes to native, WSL, or runtime skill scanners
  • Claude plugin skill source detection and enumeration in claude-plugin-skill-sources.ts
  • Agent-specific skill profiles (native-chat-agent-profiles.ts) defining picker grammar per agent
  • Skill invocation envelope parsing (native-chat-command-envelope.ts) to surface non-catalog skill sends as user turns
  • Telemetry for picker interactions and skill discovery outcomes

Refactoring:

  • Extracted skill discovery logic into target-specific modules to decouple routing from enumeration
  • Moved picker item building and ranking to shared state module
  • Replaced separate slash/skill menus with unified NativeChatPickerMenu
  • Reorganized native-chat composer state to support grouped/ungrouped picker modes

Cleanup:

  • Removed obsolete reference docs (docs/reference/) that were local planning sketches
  • Updated .gitignore to stop tracking the reference directory

Testing

  • Unit tests cover skill discovery target resolution, WSL scan command building, plugin metadata parsing, and picker item ranking
  • React tests verify unified picker rendering with grouped commands/skills, active-descendant navigation, and completion behavior
  • Integration tests confirm host-aware routing for local, WSL, and runtime targets
  • Telemetry event schemas added and validated

Cross-platform notes

  • Windows: WSL distro detection and in-distro skill enumeration via wsl.exe subprocess
  • macOS/Linux: Local filesystem and project-scoped skill discovery
  • Runtime/SSH: Skill discovery delegated to remote host via RPC with fallback error handling
  • All paths use adapter pattern to support both POSIX and Windows path arithmetic where needed

Adds a unified, keyboard-first skill and command picker to native chat that:

- Uses agent-native invocation syntax (slash for Claude/OpenClaude/Grok, dollar for Codex)
- Discovers skills only on the pane's execution host (local, WSL, SSH-unavailable, or runtime)
- Groups or separates commands and skills per agent configuration
- Deduplicates by canonical path but preserves visibility through all contributing roots
- Handles IME composition, loading states, and errors without claiming PTY-level control
- Records picker telemetry (open, item accepted, send classification, discovery outcomes)
- Extends shared agent profiles to define per-agent skill grammars and source ownership
Clean up stale design specs, implementation plans, and investigation notes from
docs/reference/. These documents predate the current implementation and are no
longer actively maintained or referenced by the codebase.
- Move skill comparison and source classification to shared module for native/WSL reuse
- Extract display text sanitization to prevent control/zero-width character spoofing
- Add native-chat command envelope parser and surfacer for skill invocations
- Extend discovery timeout backstop to account for WSL metadata read sequence
Translate skill picker UI strings including commands, skills, loading
states, error messages, and scope labels for the new skill picker feature
across four language locales.
@coderabbitai

coderabbitai Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1c7102b7-3e88-4bfe-8836-8e25a95f6c93

📥 Commits

Reviewing files that changed from the base of the PR and between e1427e6 and e67eb64.

📒 Files selected for processing (39)
  • .gitignore
  • src/main/daemon/headless-emulator-fidelity.fuzz.test.ts
  • src/main/daemon/headless-emulator.ts
  • src/main/daemon/terminal-view-attribute-responder.ts
  • src/main/ipc/pty-hidden-delivery-gate.ts
  • src/main/runtime/rpc/methods/skills.test.ts
  • src/main/runtime/terminal-model-query-authority.ts
  • src/main/runtime/terminal-query-responder.test.ts
  • src/main/runtime/terminal-view-attribute-store.ts
  • src/main/skills/claude-plugin-skill-sources-wsl.ts
  • src/main/skills/discovery.ts
  • src/main/skills/skill-discovery-wsl.ts
  • src/main/telemetry/validator.test.ts
  • src/main/wsl-bash-command.ts
  • src/preload/api-types.ts
  • src/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/onboarding/use-onboarding-flow-persistence.ts
  • src/renderer/src/components/terminal-pane/agent-task-complete-policy.ts
  • src/renderer/src/components/terminal-pane/parked-terminal-byte-watcher.ts
  • src/renderer/src/components/terminal-pane/pty-delivery-interest.ts
  • src/renderer/src/components/terminal-pane/terminal-parked-tab-watchers.ts
  • src/renderer/src/components/terminal-pane/terminal-side-effect-facts-handler.ts
  • src/renderer/src/components/terminal-pane/terminal-view-attributes-publisher.ts
  • src/renderer/src/components/terminal-pane/use-terminal-tab-cold-parking.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/shared/command-code-output-status.ts
  • src/shared/feature-interaction-catalog.ts
  • src/shared/skill-display-text.ts
  • src/shared/skills.ts
  • src/shared/terminal-bell-detector.ts
  • src/shared/terminal-output-side-effects.ts
  • src/shared/terminal-side-effect-facts.ts
  • src/shared/terminal-view-attributes.ts
  • src/shared/types.ts

📝 Walkthrough

Walkthrough

Adds a unified native chat command and skill picker with agent-specific profiles, ranking, sanitization, keyboard handling, telemetry, localization, and transcript normalization. Skill discovery now supports native and WSL targets, Claude plugin sources, runtime resolution, canonical-path deduplication, ownership metadata, caching, and structured errors. The web preload API propagates discovery failures. Documentation tracking is narrowed and stale source references are removed.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and testing, but it is missing required Screenshots, AI Review Report, Security Audit, and Notes sections from the template. Add the missing template sections, including Screenshots, AI Review Report with cross-platform checks, Security Audit, and Notes.
Docstring Coverage ⚠️ Warning Docstring coverage is 11.76% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: a native chat skill picker with host-aware discovery.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

@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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/renderer/src/components/native-chat/NativeChatComposer.tsx (1)

261-292: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Attached images are silently dropped when the send is classified as a command/unknown token.

When classifySend(text) returns anything other than 'chat', send() sends text via plain sendNativeChatMessage and never passes imagePaths — but clearImageAttachments() still runs unconditionally at the end. If a user attaches an image and then sends text that starts with the agent's slash/skill prefix (a verified command, or just unrecognized text starting with //$), the image is discarded without ever being sent and without any notice to the user.

🐛 Proposed fix
       const classification = classifySend(text)
       let pendingHandle: NativeChatSendHandle | null = null
-      if (classification !== 'chat') {
+      if (classification !== 'chat' && imagePaths.length === 0) {
         pendingHandle = sendNativeChatMessage(target.settings, target.ptyId, text)
       } else if (imagePaths.length > 0) {
         pendingHandle = sendNativeChatMessageWithImageAttachments(
           target.settings,
           target.ptyId,
           text,
           imagePaths
         )
       } else if (text.trim().length > 0) {
         pendingHandle = sendNativeChatMessage(target.settings, target.ptyId, text)
       } else {
         submitNativeChatPrompt(target.settings, target.ptyId)
       }

Alternatively, surface a setNotice(...) warning before dropping the attachment so the loss isn't silent.

Also applies to: 318-320

🧹 Nitpick comments (3)
src/shared/skills.ts (1)

84-102: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use z.discriminatedUnion('status', ...) for the outer runtime union.

ResolvedProjectRuntimeSchema/RepairProjectRuntimeSchema are combined with a plain z.union, even though status is a clean, unique discriminator across both branches — the same pattern already used one level down for kind at Line 58. Per Zod's docs, plain unions check options sequentially, while discriminatedUnion does O(1) lookup and gives clearer "no matching discriminator" errors, which is preferable at this IPC/RPC trust boundary.

♻️ Suggested change
-  projectRuntime: z.union([ResolvedProjectRuntimeSchema, RepairProjectRuntimeSchema]).optional()
+  projectRuntime: z
+    .discriminatedUnion('status', [ResolvedProjectRuntimeSchema, RepairProjectRuntimeSchema])
+    .optional()
src/main/runtime/rpc/methods/skills.test.ts (1)

45-55: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Correct the Windows path fixture string.

The string 'C\\\\repo' evaluates to C\\repo. To represent a typical Windows path C:\repo, use 'C:\\repo'.

♻️ Proposed fix
-      { cwd: 'C\\\\repo', worktreeId: 'worktree-1' },
+      { cwd: 'C:\\repo', worktreeId: 'worktree-1' },
src/main/skills/discovery.ts (1)

227-233: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Claude plugin discovery ignores includeCwd.

Repo-root scanning gates cwd inclusion on args.includeCwd !== false, but the plugin-roots branch here only checks args.cwd truthiness. A caller passing cwd with includeCwd: false (expecting cwd-scoped scanning to be fully suppressed) would still trigger Claude plugin discovery against that cwd, which contradicts the flag's documented purpose. No current caller in this cohort hits that combination, but it's a latent inconsistency in a public discoverSkills contract.

♻️ Proposed fix
   const roots = [
     ...buildSkillDiscoverySources({ ...args, homeDir }),
     // Why: plugin discovery is native-chat data keyed to an explicit workspace.
     // Untargeted scans (Settings) keep their pre-picker inventory and cost.
-    ...(args.cwd ? await discoverClaudePluginSkillSources({ homeDir, cwd: args.cwd }) : [])
+    ...(args.cwd && args.includeCwd !== false
+      ? await discoverClaudePluginSkillSources({ homeDir, cwd: args.cwd })
+      : [])
   ]

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b583ab90-c38f-4195-9be0-d3216459a7f9

📥 Commits

Reviewing files that changed from the base of the PR and between d7dc7e9 and 911e071.

📒 Files selected for processing (81)
  • .gitignore
  • docs/reference/2026-06-27-orca-mobile-manual-network-address-design.md
  • docs/reference/README.md
  • docs/reference/agent-hook-stdin-lifecycle.md
  • docs/reference/agent-session-resume-cli-evidence.md
  • docs/reference/browser-local-https-certificate-trust.md
  • docs/reference/direct-url-or-file-entry.md
  • docs/reference/feature-discovery-interaction-tracking.md
  • docs/reference/feature-education-retention-analytics.md
  • docs/reference/feature-education-state.md
  • docs/reference/git-compatibility.md
  • docs/reference/headless-linux-server.md
  • docs/reference/keyboard-layout-shortcut-dispatch.md
  • docs/reference/new-user-parallel-work-telemetry.md
  • docs/reference/opencode-commit-message-stdin.md
  • docs/reference/plans/2026-06-27-orca-mobile-manual-network-address.md
  • docs/reference/plans/2026-07-10-ssh-repo-host-reconciliation.md
  • docs/reference/project-ordering-mode.md
  • docs/reference/reliability-gates-implementation-plan.md
  • docs/reference/reliability-pain-points-2026-06-30.md
  • docs/reference/ssh-gssapi-kerberos.md
  • docs/reference/ssh-typing-latency-under-relay-load.md
  • docs/reference/telemetry-availability.md
  • docs/reference/terminal-cold-park-reveal-cost.md
  • docs/reference/terminal-hidden-view-parking.md
  • docs/reference/terminal-model-view-contract.md
  • docs/reference/terminal-query-authority.md
  • docs/reference/terminal-session-lifecycle.md
  • docs/reference/terminal-side-effect-authority.md
  • docs/reference/terminal-switch-typing-lag-investigation.md
  • src/main/ipc/skills.test.ts
  • src/main/ipc/skills.ts
  • src/main/runtime/orca-runtime.ts
  • src/main/runtime/rpc/methods/skills.test.ts
  • src/main/runtime/rpc/methods/skills.ts
  • src/main/skills/claude-plugin-skill-sources-wsl.test.ts
  • src/main/skills/claude-plugin-skill-sources-wsl.ts
  • src/main/skills/claude-plugin-skill-sources.test.ts
  • src/main/skills/claude-plugin-skill-sources.ts
  • src/main/skills/discovery.test.ts
  • src/main/skills/discovery.ts
  • src/main/skills/skill-discovery-sources.ts
  • src/main/skills/skill-discovery-target.ts
  • src/main/skills/skill-discovery-wsl-plugins.test.ts
  • src/main/skills/skill-discovery-wsl.test.ts
  • src/main/skills/skill-discovery-wsl.ts
  • src/main/skills/skill-freshness-inventory-limits.test.ts
  • src/renderer/src/components/native-chat/NativeChatAutocompleteMenus.test.tsx
  • src/renderer/src/components/native-chat/NativeChatAutocompleteMenus.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.test.tsx
  • src/renderer/src/components/native-chat/NativeChatComposer.tsx
  • src/renderer/src/components/native-chat/NativeChatComposerField.tsx
  • src/renderer/src/components/native-chat/native-chat-agent-commands.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.test.ts
  • src/renderer/src/components/native-chat/native-chat-composer-state.ts
  • src/renderer/src/components/native-chat/native-chat-picker-items.ts
  • src/renderer/src/components/native-chat/native-chat-skill-discovery-context.ts
  • src/renderer/src/components/native-chat/use-native-chat-composer-keydown.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-composer-keydown.ts
  • src/renderer/src/components/native-chat/use-native-chat-live-session.ts
  • src/renderer/src/components/native-chat/use-native-chat-picker-command-dispatch.ts
  • src/renderer/src/components/native-chat/use-native-chat-picker-state.ts
  • src/renderer/src/components/native-chat/use-native-chat-skills.react.test.tsx
  • src/renderer/src/components/native-chat/use-native-chat-skills.test.ts
  • src/renderer/src/components/native-chat/use-native-chat-skills.ts
  • src/renderer/src/components/native-chat/use-native-chat-typed-insertion.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/native-chat-telemetry.ts
  • src/renderer/src/web/web-preload-api.test.ts
  • src/renderer/src/web/web-preload-api.ts
  • src/shared/native-chat-agent-profiles.test.ts
  • src/shared/native-chat-agent-profiles.ts
  • src/shared/native-chat-command-envelope.test.ts
  • src/shared/native-chat-command-envelope.ts
  • src/shared/skill-display-text.ts
  • src/shared/skills.ts
  • src/shared/telemetry-events.ts
💤 Files with no reviewable changes (29)
  • docs/reference/terminal-hidden-view-parking.md
  • docs/reference/feature-discovery-interaction-tracking.md
  • docs/reference/terminal-model-view-contract.md
  • docs/reference/keyboard-layout-shortcut-dispatch.md
  • docs/reference/plans/2026-07-10-ssh-repo-host-reconciliation.md
  • docs/reference/README.md
  • docs/reference/new-user-parallel-work-telemetry.md
  • docs/reference/2026-06-27-orca-mobile-manual-network-address-design.md
  • docs/reference/telemetry-availability.md
  • docs/reference/git-compatibility.md
  • docs/reference/terminal-query-authority.md
  • docs/reference/direct-url-or-file-entry.md
  • docs/reference/agent-session-resume-cli-evidence.md
  • docs/reference/terminal-cold-park-reveal-cost.md
  • docs/reference/feature-education-retention-analytics.md
  • docs/reference/browser-local-https-certificate-trust.md
  • docs/reference/agent-hook-stdin-lifecycle.md
  • docs/reference/terminal-side-effect-authority.md
  • docs/reference/opencode-commit-message-stdin.md
  • docs/reference/plans/2026-06-27-orca-mobile-manual-network-address.md
  • docs/reference/headless-linux-server.md
  • docs/reference/ssh-typing-latency-under-relay-load.md
  • docs/reference/feature-education-state.md
  • docs/reference/ssh-gssapi-kerberos.md
  • src/renderer/src/components/native-chat/native-chat-agent-commands.ts
  • docs/reference/project-ordering-mode.md
  • docs/reference/terminal-switch-typing-lag-investigation.md
  • docs/reference/terminal-session-lifecycle.md
  • docs/reference/reliability-pain-points-2026-06-30.md

Comment thread .gitignore Resolved
Comment thread src/main/skills/skill-discovery-wsl.ts Resolved
Comment thread src/renderer/src/i18n/locales/en.json Resolved
Comment thread src/shared/skill-display-text.ts Resolved
- Fix i18n plural handling: rename `count` to `sourceCount` to prevent unintended plural-key resolution in localized strings
- Fix skill discovery array mutations: copy `root.providers` to prevent bugs during dedup merge
- Fix image attachments being silently dropped when message text starts with /skill or agent prefix
- Extract `quoteBashString` utility for WSL command code reuse across builders
- Add line-separator safety characters (0x2028/0x2029) to skill display filter
- Remove stale doc reference links and clarify inline comments
Track previously untracked operational guides in `docs/reference/` that
explain Git binary compatibility requirements across host types and how to
run `orca serve` on headless Linux. Update AGENTS.md and README.md to link
to these references.
@AmethystLiang
AmethystLiang merged commit 1def694 into main Jul 20, 2026
9 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
* Add native chat skill and command picker with host-aware discovery

Adds a unified, keyboard-first skill and command picker to native chat that:

- Uses agent-native invocation syntax (slash for Claude/OpenClaude/Grok, dollar for Codex)
- Discovers skills only on the pane's execution host (local, WSL, SSH-unavailable, or runtime)
- Groups or separates commands and skills per agent configuration
- Deduplicates by canonical path but preserves visibility through all contributing roots
- Handles IME composition, loading states, and errors without claiming PTY-level control
- Records picker telemetry (open, item accepted, send classification, discovery outcomes)
- Extends shared agent profiles to define per-agent skill grammars and source ownership

* Remove obsolete reference and design documentation

Clean up stale design specs, implementation plans, and investigation notes from
docs/reference/. These documents predate the current implementation and are no
longer actively maintained or referenced by the codebase.

* Extract shared skill discovery utilities and add skill invocation envelo

- Move skill comparison and source classification to shared module for native/WSL reuse
- Extract display text sanitization to prevent control/zero-width character spoofing
- Add native-chat command envelope parser and surfacer for skill invocations
- Extend discovery timeout backstop to account for WSL metadata read sequence

* Localize skill picker UI for Spanish, Japanese, Korean, Chinese

Translate skill picker UI strings including commands, skills, loading
states, error messages, and scope labels for the new skill picker feature
across four language locales.

* Fix skill picker bugs and improve code robustness

- Fix i18n plural handling: rename `count` to `sourceCount` to prevent unintended plural-key resolution in localized strings
- Fix skill discovery array mutations: copy `root.providers` to prevent bugs during dedup merge
- Fix image attachments being silently dropped when message text starts with /skill or agent prefix
- Extract `quoteBashString` utility for WSL command code reuse across builders
- Add line-separator safety characters (0x2028/0x2029) to skill display filter
- Remove stale doc reference links and clarify inline comments

* Add reference docs for git compatibility and headless Linux server setup

Track previously untracked operational guides in `docs/reference/` that
explain Git binary compatibility requirements across host types and how to
run `orca serve` on headless Linux. Update AGENTS.md and README.md to link
to these references.
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