Skip to content

Expand opencode adapter metadata to support model, permission, agent, mode, and subtask fields#348

Merged
eXamadeus merged 1 commit into
mainfrom
julian/06-16-expand_opencode_adapter_metadata_to_support_model_permission_agent_mode_and_subtask_fields
Jun 17, 2026
Merged

Expand opencode adapter metadata to support model, permission, agent, mode, and subtask fields#348
eXamadeus merged 1 commit into
mainfrom
julian/06-16-expand_opencode_adapter_metadata_to_support_model_permission_agent_mode_and_subtask_fields

Conversation

@eXamadeus

Copy link
Copy Markdown
Member

Why

The OpenCode adapter's metadata schema only supported tools, model, and permissions, which wasn't enough to describe agents and commands that use OpenCode-specific frontmatter fields like mode, permission, agent, and subtask.

Details

mode ("primary" | "subagent" | "all") and permission are agent-oriented fields; agent and subtask are command-oriented. Because buildAssetMetadata is not asset-type-aware, all fields live in a single shared schema and a facet is expected to only set the keys relevant to its asset type.

permission is typed as Record<string, unknown> rather than a stricter shape because OpenCode allows permission values to be either a shorthand action string ("allow" | "ask" | "deny") or a nested glob-to-action object (e.g. edit: { "*": "deny", "foo/**": "allow" }). A tighter type would reject valid OpenCode config.

The existing permissions key is retained as-is for backwards compatibility.

The @julian/openspec-adversary facet is bumped to 2.1.0, which renames the review-adversary command to reconcile-adversary-review.

Verification

New tests cover acceptance of valid agent/subtask, mode: subagent, and scoped permission blocks, as well as rejection of invalid mode values and non-boolean subtask. Round-trip install/read tests confirm the new frontmatter fields are written and parsed correctly.

Copilot AI review requested due to automatic review settings June 17, 2026 01:03
@changeset-bot

changeset-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9d4bea1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@agent-facets/adapter-opencode Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copilot AI 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.

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

eXamadeus commented Jun 17, 2026

Copy link
Copy Markdown
Member Author

Merge activity

  • Jun 17, 1:08 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 17, 1:08 AM UTC: @eXamadeus merged this pull request with Graphite.

@eXamadeus eXamadeus merged commit c4ac343 into main Jun 17, 2026
5 of 6 checks passed
@eXamadeus eXamadeus deleted the julian/06-16-expand_opencode_adapter_metadata_to_support_model_permission_agent_mode_and_subtask_fields branch June 17, 2026 01:08

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d4bea1b91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

'permissions?': 'Record<string, "allow" | "deny">',
// OpenCode agent frontmatter
'mode?': '"primary" | "subagent" | "all"',
'permission?': 'Record<string, unknown>',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Accept shorthand permission actions

When an agent uses the valid OpenCode shorthand permission: deny/ask/allow to apply one action to all permissions, this schema rejects it because Record<string, unknown> requires permission to be an object. I checked the upstream OpenCode config schema (https://opencode.ai/config.json): AgentConfig.permission references PermissionConfig, whose anyOf includes both a shorthand action string and an object, so facets using supported frontmatter will fail adapter metadata validation instead of building.

Useful? React with 👍 / 👎.

eXamadeus pushed a commit that referenced this pull request Jun 17, 2026
This PR was auto-generated by the release workflow. When you're ready to
do a release, you can merge this and the packages will be published to
npm automatically. If you're not ready to do a release yet, that's fine,
whenever you add more changesets to main, this PR will be updated.

# Releases
## @agent-facets/adapter-opencode@0.6.0

### Minor Changes

- [#348](#348)
[`c4ac343`](c4ac343)
Thanks [@eXamadeus](https://github.com/eXamadeus)! - Expand metadata
support to include model, permission, agent, and subtask fields

Co-authored-by: the-faceter[bot] <272408671+the-faceter[bot]@users.noreply.github.com>
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