Skip to content

feat(agent-adapter): complete opencode and Pi slash commands#242

Open
lucas77778 wants to merge 2 commits into
masterfrom
chenyu/code-313
Open

feat(agent-adapter): complete opencode and Pi slash commands#242
lucas77778 wants to merge 2 commits into
masterfrom
chenyu/code-313

Conversation

@lucas77778

Copy link
Copy Markdown
Member

Summary

  • Upgrade @opencode-ai/sdk to 1.18.3 so the existing command snapshot includes skill entries.
  • Advertise Pi prompt templates and skills from its resource loader, and dispatch them through Pi's normal prompt/turn lifecycle.
  • Keep Pi's static/live capabilities, draft composer behavior, and dev-mock replay consistent.

Tracks CODE-313.

Verification

  • pnpm check:ci
  • GIT_CONFIG_GLOBAL=/dev/null pnpm test — 222 files / 1735 tests passed on current master
  • Live opencode 1.18.3 binary + free model: discovered a project skill through the adapter catalog, invoked it as a slash command, received the skill's probe token, and observed the turn settle to idle.
  • Real Pi 0.80.6 SDK + local OpenAI Responses mock provider: discovered a prompt template and a disable-model-invocation: true skill, verified SDK expansion in provider input, and observed both turns settle to idle. The validation used a mock provider because this environment has no Pi cloud-model credential.

Checklist

  • pnpm check:ci and pnpm test both pass (plus cargo fmt / clippy / test for Rust changes)
  • I ran the affected surface and observed the change working
  • If a wire message changed: WIRE_PROTOCOL_VERSION is bumped (no wire variant changed)
  • New code and assets are my own work, or their origin and license compatibility are noted above
  • Docs and comments are updated where behavior changed

Copilot AI review requested due to automatic review settings July 22, 2026 05:22
@linear-code

linear-code Bot commented Jul 22, 2026

Copy link
Copy Markdown

CODE-313

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

This PR completes slash-command support for Pi and updates OpenCode command discovery. The main changes are:

  • Advertises Pi prompt templates and skills in the command catalog.
  • Dispatches Pi commands through the normal prompt lifecycle.
  • Enables Pi slash commands across schema, UI, and mock transport behavior.
  • Updates the OpenCode SDK so command snapshots include skills.
  • Preserves commands from one Pi resource category when discovery of the other fails.

Confidence Score: 5/5

This looks safe to merge.

Prompt and skill discovery now fail independently. Tests cover either resource category failing while the other remains available.

No blocking issues were found in the changed code.

T-Rex T-Rex Logs

What T-Rex did

  • The pre-run lifecycle check produced exit code 0 with no catalog entries, and both turns settled idle after the provider saw the raw /trex-template and /skill:trex-secret.
  • The post-run lifecycle state shows the catalog now contains trex-template and skill:trex-secret; provider requests include TEMPLATE_EXPANDED target=alpha all=alpha beta and the expanded skill block contains gamma; assertions confirm the skill name is absent from the system prompt and the idle count is three.
  • The focused lifecycle test suite ran and passed all 13 tests.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
packages/host/agent-adapter/src/native/pi/adapter.ts Adds Pi command catalog discovery, independent resource failure handling, and lifecycle-aware command dispatch.
packages/host/agent-adapter/src/tests/pi.test.ts Covers command discovery, independent prompt and skill failures, and command execution.
packages/foundation/schema/src/model/agent/input.ts Enables the Pi slash-command capability.
packages/host/agent-adapter/package.json Updates the OpenCode SDK dependency to include skill entries in command snapshots.

Reviews (2): Last reviewed commit: "fix(agent-adapter): preserve partial Pi ..." | Re-trigger Greptile

Comment thread packages/host/agent-adapter/src/native/pi/adapter.ts Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 05:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants