Skip to content

Add LLM boundary hooks for request/response#12715

Closed
swk11rus wants to merge 1 commit intoanomalyco:devfrom
swk11rus:codex/llm-boundary-hooks
Closed

Add LLM boundary hooks for request/response#12715
swk11rus wants to merge 1 commit intoanomalyco:devfrom
swk11rus:codex/llm-boundary-hooks

Conversation

@swk11rus
Copy link

@swk11rus swk11rus commented Feb 8, 2026

What does this PR do?

Adds three plugin hooks at the LLM boundary: llm.request.before, llm.stream.chunk, and llm.response.after.
They run immediately before a provider request is sent, and immediately after a response chunk/result is received, enabling last‑mile masking and first‑mile unmasking without affecting opencode internal processing.

Changes are minimal and scoped to:

  • plugin hook types
  • LLM.stream (pre‑send + per‑chunk hook)
  • Agent.generate (streamObject + generateObject hooks)

How did you verify your code works?

Manual test in my fork with a masking plugin:

  • verified masking only happens right before request is sent
  • verified unmasking happens before opencode processes streamed chunks
  • verified non‑stream responses are unmasked at the boundary

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

Hey! Your PR title Add LLM boundary hooks for request/response doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@swk11rus swk11rus closed this Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant