oc-ghcp-headers
v0.1.1
Published
OpenCode plugin that customizes GitHub Copilot x-initiator headers
Maintainers
Readme
oc-ghcp-headers
[!WARNING] This is experimental software provided as-is. Use it at your own risk. Modifying request behavior may lead to degraded service, policy enforcement, or account-level actions. The authors and contributors are not responsible for any resulting account issues, restrictions, or losses.
This plugin controls the x-initiator header for GitHub Copilot requests in OpenCode.
Behavior
- First user message in a session:
x-initiatoris randomized betweenuserandagent. - Follow-up user messages:
x-initiatordefaults toagent, with optional chance to senduser.
The plugin determines first vs follow-up by reading recent session messages and checking for prior assistant/tool activity. It explicitly ignores the current turn's pre-created user message and assistant placeholder so first-turn detection stays accurate.
If session history cannot be loaded, it fails closed to agent.
Setup
Install from npm:
bun add oc-ghcp-headersThen enable it in ~/.config/opencode/opencode.jsonc:
{
"plugin": ["oc-ghcp-headers"]
}Restart OpenCode after updating config.
Configuration
Configure percentages in opencode.json / opencode.jsonc under provider.github-copilot.options:
{
"provider": {
"github-copilot": {
"options": {
"firstMessageAgentPercent": 0,
"followupMessageAgentPercent": 100
}
}
}
}firstMessageAgentPercent(default0)- Percentage chance first message is sent as
agent 0=> alwaysuser10=> 10%agent, 90%user100=> alwaysagent
- Percentage chance first message is sent as
followupMessageAgentPercent(default100)- Percentage chance follow-up message is sent as
agent 100=> alwaysagent90=> 90%agent, 10%user0=> alwaysuser
- Percentage chance follow-up message is sent as
DEBUG_ENABLED- Enable/disable plugin debug logging
Scope
- Applies only to models where
providerIDincludesgithub-copilot. - This plugin only sets request headers; auth/token handling remains managed by OpenCode.
Debug Log
- Log file:
/tmp/oc-ghcp-headers-debug.log - Watch live:
tail -f /tmp/oc-ghcp-headers-debug.logMaintainer Docs
- Publishing and release process:
docs/release.md
License
- MIT. See
LICENSE.
Credits
- Original custom plugin author: @Tarquinen
