Map --read-only/--plan-only for the agent tool to its native --permission-mode (agent v0.24.0)#41
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #39
Map the agent tool's --read-only to --permission-mode readonly and --plan-only to --permission-mode plan (agent v0.24.0), matching agent's own distinction between the two modes. Stop rejecting --tool agent --read-only and surface typed permissionMode/permission passthrough. Closes #39
agent tool to its native --permission-mode (agent v0.24.0)agent tool to its native --permission-mode (agent v0.24.0)
Working session summaryAll four CI runs (both JavaScript CI/CD and Rust CI/CD, push + PR triggered) passed on the final commit. The work is complete. SummaryIssue #39 is resolved. The
What changed (JS + Rust parity)
Verification
PR #41 updated, marked ready for review: #41 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:Claude Opus 4.8: (2 sub-sessions)
Total: (21.2K new + 233.8K cache writes + 10.4M cache reads) input tokens, 53.3K output tokens, $8.124553 cost Claude Haiku 4.5:
Total: 5.1K input tokens, 344 output tokens, $0.006787 cost 🤖 Models used:
📎 Log file uploaded as Gist (4497KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Summary
Maps the
agenttool's read-only / planning flags to its native, enforceable--permission-mode(introduced in@link-assistant/agentv0.24.0), instead of rejecting them as "not enforceable".agentmapping--read-onlyagent --permission-mode readonly--plan-onlyagent --permission-mode planOther tools continue to treat
--plan-onlyas an alias for--read-only; onlyagenthonors the readonly/plan distinction because its CLI does.Fixes #39.
Changes
agenttool config now reportssupportsReadOnly: true/supports_read_only: true.buildArgsresolves--permission-modefrom an explicitpermissionMode, elseplanforplanOnly, elsereadonlyforreadOnly.permission(OpenCode-compatible--permission '<json>') passthrough.planOnly/plan_onlyoption threaded through CLI parser → start-agent binary → library → command builder.--plan-onlysets bothreadOnlyandplanOnly;readOnlyRequested = readOnly || planOnlydrives the support check and per-tool builders.agentas supported and only fires for genuinely unsupported tools.docs/common-concepts.mdupdated; removed the "unrestricted OpenCode fork" / "no permissions system" framing in favor of the native permission system.agent-permission-mode.md, minor) and Rust (20260617_120000_agent_permission_mode.md, minor).How to reproduce / verify
Before,
start-agent --tool agent --read-only ...threwTool "agent" does not support enforceable read-only mode. Now it buildsagent --permission-mode readonly.Tests
node --test): addedagentToolbuildArgstests (readonly, plan, explicitpermissionModeoverride,permissionJSON passthrough,supportsReadOnly), and replaced the agent-rejection command-builder test with readonly/plan mapping tests plus an unknown-tool rejection test. All pass.cargo test): replacedtest_build_agent_command_read_only_rejects_agent_toolwith..._agent_read_only_uses_readonly_mode,..._agent_plan_only_uses_plan_mode, and..._read_only_rejects_unknown_tool; added--plan-onlyCLI parser test. All pass.cargo fmt --checkandcargo clippyclean; JSeslint/prettierclean (only pre-existing complexity warnings).