feat: support subscription-backed providers (Codex, Copilot) for Paperclip agents#97
Open
citadelgrad wants to merge 1 commit into
Open
Conversation
…rclip agents
Enables Paperclip-managed Hermes agents to run against subscription-backed
inference providers like OpenAI Codex Plus/Pro and GitHub Copilot.
Two changes are needed to make this work end-to-end:
1. buildHermesConfig now persists a `provider` field when the create-form
passes one (validated against VALID_PROVIDERS). Downstream Paperclip
forms can extend CreateConfigValues to expose a Provider selector;
we accept it via duck-typing so the base type doesn't need to change.
When no provider is set, the existing runtime resolution chain still
applies (~/.hermes/config.yaml → model-prefix inference → "auto").
2. Fix a child-env corruption bug that previously made subscription
providers unusable. Paperclip stores per-agent env vars in a
structured-secret shape:
{ type: "plain"|"secret"|"env", value: "..." }
The previous Object.assign(env, userEnv) serialized those wrappers
to "[object Object]", so a common pattern like
adapterConfig.env.HOME=/Users/<user> caused the spawned hermes to
see HOME="[object Object]", fail to read ~/.hermes/config.yaml, and
trip the first-run guard:
It looks like Hermes isn't configured yet -- no API keys
or providers found.
The new coerceEnvValue() helper unwraps the wrapper shape and drops
empty/invalid entries before merging into the spawn env.
Verified end-to-end: a Paperclip agent now runs successfully with
provider=openai-codex resolved from adapterConfig.
Bumps version 0.3.0 -> 0.3.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enable Paperclip-managed Hermes agents to run against subscription-backed inference providers like OpenAI Codex Plus/Pro and GitHub Copilot.
Two changes are needed to make this work end-to-end:
buildHermesConfigaccepts an explicitprovider. Persisted when the Paperclip create-form passes one (validated againstVALID_PROVIDERS). Downstream forms can extendCreateConfigValuesto expose a Provider selector; we accept it via duck-typing so the base type doesn't need to change. When no provider is set, the existing runtime chain still applies (~/.hermes/config.yaml→ model-prefix inference →"auto").Fix the child-env corruption bug that made subscription providers unusable. Paperclip stores per-agent env vars in a structured-secret shape:
The previous `Object.assign(env, userEnv)` serialized those wrappers to `"[object Object]"`, so a common pattern like `adapterConfig.env.HOME = "/Users/"` caused the spawned hermes to see `HOME="[object Object]"`, fail to read `~/.hermes/config.yaml`, and trip the first-run guard:
New `coerceEnvValue()` helper unwraps the wrapper shape and drops empty/invalid entries before merging into the spawn env.
Bumps `0.3.0` → `0.3.1`.
Test plan
Notes
The repo doesn't currently have a unit-test runner. Happy to add tests for `coerceEnvValue` and the provider passthrough if you'd like — just let me know your preferred framework (or whether you'd prefer a zero-dep `node --test` file).