feat(acp): adapter compliance v1 — capabilities, resource blocks, config modes, skills - #57510
feat(acp): adapter compliance v1 — capabilities, resource blocks, config modes, skills#57510NakePranob wants to merge 6 commits into
Conversation
…d /skill command - Bug 1: --skills flag in ACP mode (cli forwarding + entry preload) - Bug 2: config_options=None -> model selector in Zed - Bug 3: set_session_model() preserves MCP toolsets across model switch - Bug 4: _cmd_model slash command preserves MCP toolsets too - Feature: /skill slash command (list/load skills) - Tests: update config_options assertion, advertised commands list
…ig modes, init caps
Codex-driven fixes covering all spec gaps:
Critical:
- _extract_text() now handles ALL ACP content block types (Text, Resource,
EmbeddedResource, Image, Audio) — tagged files (@-references) work now
- Empty prompt returns end_turn gracefully with client notification
Priority 2:
- Plan entry status tracking: todo tool. started sends session/update plan
- config_options now includes mode selection (category='mode')
- initialize() response: embedded_context=True, audio=False in promptCapabilities
Priority 3:
- All advertised commands have displayName, toolTip, icon via field_meta
- set_config_option handles mode ('mode' config_id) changes
New tests: 5 (plan update, empty prompt, config mode/model routing)
All 293 ACP tests passing.
- _skill_commands() classmethod enumerates all registered skills as individual AvailableCommand entries - _available_commands() appends skill commands after built-in commands - _handle_slash_command() routes /<skill-name> directly to skill loader (instead of requiring /skill load <name>) - _cmd_help() shows skills section with type /name to load - Test: available_commands list now includes dynamic skill entries Zed's / menu now shows all ~94 skills alongside built-in commands, matching OpenCode's behaviour.
When a user types /<skill-name> in the ACP chat: - Skill loads into system prompt - _pending_skill_prompt flag stores the skill text - _handle_slash_command returns None to fall through to LLM - prompt() rewrites user_text/user_content to the skill's own prompt - LLM responds with the skill's voice/instructions immediately Previously the handler returned 'Loaded skill(s): ...' and ended the turn without invoking the LLM, leaving the skill loaded but idle. Also fixes nested try/except lint issue in _handle_slash_command.
… catalog, ext_method/notification, close_session, fs/* via ext_method HIGH Priority: - tool_progress_cb now emits ToolCallProgress(status=in_progress) immediately after ToolCallStart so clients see pending->in_progress->completed progression - stopReason detects max_tokens (output length limit) and refusal (content_policy_blocked) from result.error, mapped to spec-correct values - ext_method/ext_notification overrides: unknown methods now raise RequestError.method_not_found() instead of returning empty dict silently (the base class' empty-dict behaviour was incorrect per spec) MEDIUM Priority: - close_session() added to HermesACPAgent: maps to session/close (unstable), delegates to SessionManager.remove_session() and returns CloseSessionResponse - fs/read_text_file and fs/write_text_file implemented via ext_method: resolve path relative to session cwd, validate existence, read/write with proper RequestError (invalid_params/internal_error) on failure, return TextResourceContents for reads and empty dict for writes All 293 ACP tests pass (3 pre-existing edit_approval tests deselected for macOS /private/var/folders/ sensitive-path issue).
76ee104 to
3232aca
Compare
Related: #25611 (embedded_context + resource-block extraction), #21407 (merged inline-attachment salvage), #57509 (companion system-prompt instruction from the same author). This is broad ACP spec-compliance work — a reviewer should reconcile it against the existing #25611 embedded_context PR rather than merging both. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for the broad ACP compliance work. It needs selective salvage onto current main rather than a direct merge.
Problems
- The skill command path mutates and invalidates the live system prompt (
acp_adapter/server.py:154-162,:2163-2168,:2511-2514). Current Hermes requires that prompt to remain stable for a session (agent/system_prompt.py:519-532;AGENTS.md:88-91). - The new filesystem extension handlers accept absolute and traversal paths without workspace containment (
acp_adapter/server.py:677-735), including arbitrary directory creation on write. config_optionsconflicts with the deliberate current ACP/Zed contract: config options replace the model-picker slot, so current main usesSessionModeStateand leavesconfig_optionsabsent (acp_adapter/server.py:534-565;tests/acp/test_server.py:56-67).- Resource inlining is already implemented on main by
733e297b8and7e2af0c2e; the remainingembedded_contextcapability overlaps open #25611.
Suggested changes
- Salvage the focused capability work with #25611.
- Preserve prompt-cache invariants for skill activation and add containment plus regression coverage before exposing filesystem RPCs.
This is an automated hermes-sweeper review.
| else: | ||
| resolved = Path(file_path) | ||
|
|
||
| resolved.parent.mkdir(parents=True, exist_ok=True) |
There was a problem hiding this comment.
This creates directories for any client-supplied path. Path(cwd) / file_path does not confine absolute paths, and neither handler resolves or rejects ..; add canonical workspace containment before any read or write.
| # Load skill into system prompt, then fall through to LLM | ||
| prompt_text, loaded_names, missing_names = build_preloaded_skills_prompt([skill_name]) | ||
| if loaded_names: | ||
| _inject_skills_prompt(state.agent, prompt_text or "") |
There was a problem hiding this comment.
_inject_skills_prompt() changes and invalidates the cached system prompt mid-session. Hermes requires the system prompt to be byte-stable for the conversation to preserve prefix caching; route this through the established user-message skill invocation flow or defer it to a fresh session.
|
ปิด PR นี้ตามคำขอ (no longer needed / cleanup) |
Uh oh!
There was an error while loading. Please reload this page.