Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Current honest state:

- this repository contains a TypeScript CLI that writes OpenHuman's native
GonkaGate custom-provider config shape
- the CLI fetches `GET https://api.gonkagate.com/v1/models` with the user's API
key and uses that live response as the runtime model source of truth
- the CLI preserves unrelated TOML config, creates one timestamped backup when
replacing an existing config file, and verifies the written shape
- the CLI accepts secrets only through hidden prompt, `GONKAGATE_API_KEY`, or
Expand All @@ -37,22 +39,23 @@ security flow changes, update this file immediately.
- the stable GonkaGate provider id is `gonkagate`
- the canonical GonkaGate base URL is `https://api.gonkagate.com/v1`
- the current transport target is `/v1/chat/completions`
- the runtime model catalog source is authenticated `/v1/models`
- OpenHuman configuration is TOML-based and must preserve unrelated user config
- `gp-...` secrets must never be printed
- secrets must not be accepted through a plain `--api-key` flag
- safe secret inputs are hidden prompt, `GONKAGATE_API_KEY`, and
`--api-key-stdin`
- setup success is based on local config verification and an optional direct
GonkaGate smoke check when a key is available, with OpenHuman sign-in reported
as a separate runtime gate
- setup success is based on live model-catalog fetch, local config verification,
and a direct GonkaGate smoke check, with OpenHuman sign-in reported as a
separate runtime gate

## OpenHuman Integration Notes

OpenHuman already has an OpenAI-compatible provider path, but the setup utility
must write the current native custom-provider shape:

- `cloud_providers` entry with slug `gonkagate`
- workload provider strings such as `gonkagate:moonshotai/kimi-k2.6`
- workload provider strings such as `gonkagate:<live-model-id>`
- provider credentials under `provider:gonkagate`, profile `default`, entered
through OpenHuman Settings -> AI unless a future supported OpenHuman RPC/API
write path is added
Expand All @@ -66,8 +69,8 @@ The setup utility must still account for OpenHuman's internal tier model names:
- `fast-v1`

GonkaGate expects concrete model ids. The CLI routes workloads to concrete
GonkaGate model ids and reports OpenHuman's active-session gate for custom
providers when the user is signed out.
GonkaGate model ids returned by `/v1/models` and reports OpenHuman's
active-session gate for custom providers when the user is signed out.

## Change Discipline

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Unreleased

- Fetch GonkaGate models dynamically from authenticated `/v1/models` and remove
runtime reliance on a hardcoded catalog.

## 0.1.0

- Initial TypeScript CLI scaffold for `@gonkagate/openhuman-setup`.
Expand Down
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ GonkaGate configured as a native OpenAI-compatible custom provider without
hand-editing OpenHuman TOML config.

The CLI writes OpenHuman's native `cloud_providers` shape, routes OpenHuman
agent workloads to curated GonkaGate model IDs, preserves unrelated config,
creates a timestamped backup before replacing an existing config file, and
verifies the written result.
agent workloads to live GonkaGate model IDs from `/v1/models`, preserves
unrelated config, creates a timestamped backup before replacing an existing
config file, and verifies the written result.

Current OpenHuman credential storage is not a safe standalone JSON write target.
OpenHuman may store provider secrets in the OS keychain or encrypted JSON
Expand All @@ -54,13 +54,16 @@ You need:
- Detects the effective OpenHuman `config.toml`, including
`OPENHUMAN_WORKSPACE`, active user, legacy active workspace, staging root, and
pre-login local config.
- Fetches `GET https://api.gonkagate.com/v1/models` with the user's GonkaGate
API key and treats that response as the model source of truth.
- Adds one GonkaGate `cloud_providers` entry with slug `gonkagate`.
- Writes workload provider strings for chat, reasoning, agentic, coding, and
memory/summarization paths.
- Preserves unrelated TOML values and unrelated cloud providers.
- Creates one timestamped backup before replacing an existing config file.
- Verifies the local config shape after writing.
- Runs a direct GonkaGate `/v1/chat/completions` smoke when a key is available.
- Runs a direct GonkaGate `/v1/chat/completions` smoke with the selected live
model.
- Reports OpenHuman sign-in and credential state separately.

## Target OpenHuman Contract
Expand All @@ -72,8 +75,7 @@ You need:
- OpenHuman provider shape: `cloud_providers` entry plus workload provider
strings
- OpenHuman credential key: `provider:gonkagate`, profile `default`
- Recommended model: `moonshotai/kimi-k2.6`
- Additional validated model: `qwen/qwen3-235b-a22b-instruct-2507-fp8`
- Model catalog: authenticated `GET /v1/models` with the user's API key

## Safe Secret Handling

Expand Down Expand Up @@ -104,27 +106,24 @@ printf '%s' "$GONKAGATE_API_KEY" | npx @gonkagate/openhuman-setup --api-key-stdi

## Model Overrides

Defaults:

- reasoning, agentic, coding: `gonkagate:moonshotai/kimi-k2.6`
- chat, memory/summarization: `gonkagate:qwen/qwen3-235b-a22b-instruct-2507-fp8`

Use curated model keys only:
By default, the CLI uses the first model returned by GonkaGate `/v1/models` for
all OpenHuman workloads. Override values must be IDs returned by that live
response:

```bash
npx @gonkagate/openhuman-setup \
--reasoning-model kimi-k2.6 \
--agentic-model kimi-k2.6 \
--coding-model kimi-k2.6 \
--summarization-model qwen3-235b-a22b-instruct-2507-fp8
--reasoning-model provider/model-id \
--agentic-model provider/model-id \
--coding-model provider/model-id \
--summarization-model provider/model-id
```

## What This Tool Does Not Do

- It does not install OpenHuman.
- It does not write the old `api_url` + `api_key` + `model_routes` setup shape.
- It does not accept arbitrary custom base URLs.
- It does not accept arbitrary raw model IDs.
- It does not use repository-hardcoded GonkaGate model catalogs.
- It does not print or persist `gp-...` secrets outside approved OpenHuman
credential handling.
- It does not directly mutate OpenHuman `auth-profiles.json`.
Expand All @@ -148,7 +147,7 @@ The CLI can be exercised against a temporary OpenHuman workspace with:

```bash
npm run build
OPENHUMAN_WORKSPACE="$(mktemp -d)" node bin/gonkagate-openhuman.js --json --yes
GONKAGATE_API_KEY=gp-... OPENHUMAN_WORKSPACE="$(mktemp -d)" node bin/gonkagate-openhuman.js --json --yes
```

The product requirements for the implementation live in
Expand Down
24 changes: 14 additions & 10 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ The utility:

1. detect the active OpenHuman configuration location
2. collect a GonkaGate API key through a safe input path
3. preserve unrelated OpenHuman TOML config
4. configure GonkaGate as an OpenHuman `cloud_providers` entry
5. write workload provider strings for OpenHuman task tiers
6. verify the effective setup with a real GonkaGate/OpenHuman smoke check
3. fetch `GET https://api.gonkagate.com/v1/models` with Bearer auth
4. preserve unrelated OpenHuman TOML config
5. configure GonkaGate as an OpenHuman `cloud_providers` entry
6. write workload provider strings using only fetched live model ids
7. verify the effective setup with a real GonkaGate/OpenHuman smoke check

Direct OpenHuman credential-store mutation is intentionally skipped. Current
OpenHuman writes provider secrets through runtime keychain or encrypted JSON
Expand All @@ -25,13 +26,16 @@ label = "GonkaGate"
endpoint = "https://api.gonkagate.com/v1"
auth_style = "bearer"

chat_provider = "gonkagate:qwen/qwen3-235b-a22b-instruct-2507-fp8"
reasoning_provider = "gonkagate:moonshotai/kimi-k2.6"
agentic_provider = "gonkagate:moonshotai/kimi-k2.6"
coding_provider = "gonkagate:moonshotai/kimi-k2.6"
memory_provider = "gonkagate:qwen/qwen3-235b-a22b-instruct-2507-fp8"
chat_provider = "gonkagate:<live-model-id>"
reasoning_provider = "gonkagate:<live-model-id>"
agentic_provider = "gonkagate:<live-model-id>"
coding_provider = "gonkagate:<live-model-id>"
memory_provider = "gonkagate:<live-model-id>"
```

The concrete model id comes from the authenticated `/v1/models` response, not a
repository catalog.

The implementation must also handle OpenHuman tier model names such as
`reasoning-v1`, `agentic-v1`, `coding-v1`, `summarization-v1`, and `fast-v1`.

Expand All @@ -42,5 +46,5 @@ JSON output includes separate machine-readable states for:
- config write and backup path
- credential presence or manual key action
- local config verification
- direct GonkaGate smoke check when a key is available
- direct GonkaGate smoke check
- OpenHuman app-session presence
1 change: 1 addition & 0 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ close to the existing GonkaGate setup tools.
- the CLI must not accept a plain `--api-key` flag
- support safe inputs only: hidden prompt, `GONKAGATE_API_KEY`, and
`--api-key-stdin`
- use the key to fetch the live GonkaGate `/v1/models` catalog with Bearer auth
- preserve unrelated OpenHuman configuration
- create backups before managed rewrites
- redact secret-bearing diagnostics and error messages
Expand Down
11 changes: 6 additions & 5 deletions docs/specs/openhuman-setup-prd/fact-check.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ label = "GonkaGate"
endpoint = "https://api.gonkagate.com/v1"
auth_style = "bearer"

chat_provider = "gonkagate:qwen/qwen3-235b-a22b-instruct-2507-fp8"
reasoning_provider = "gonkagate:moonshotai/kimi-k2.6"
agentic_provider = "gonkagate:moonshotai/kimi-k2.6"
coding_provider = "gonkagate:moonshotai/kimi-k2.6"
memory_provider = "gonkagate:qwen/qwen3-235b-a22b-instruct-2507-fp8"
chat_provider = "gonkagate:<live-model-id>"
reasoning_provider = "gonkagate:<live-model-id>"
agentic_provider = "gonkagate:<live-model-id>"
coding_provider = "gonkagate:<live-model-id>"
memory_provider = "gonkagate:<live-model-id>"
```

The matching credential key is:
Expand Down Expand Up @@ -104,6 +104,7 @@ provider:gonkagate / default
## Implementation Consequences

- Use `cloud_providers` and workload provider fields as the main write path.
- Fetch concrete GonkaGate model IDs from authenticated `/v1/models`.
- Do not write `api_url = "https://api.gonkagate.com/v1"` for v1. That is the
old direct-provider mental model and risks confusing backend API resolution.
- Do not rely on `model_routes` as the primary tier-routing mechanism.
Expand Down
2 changes: 1 addition & 1 deletion docs/specs/openhuman-setup-prd/implementation-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Done means:
workload fields, and `provider:gonkagate` credentials.
- Do not use the legacy `api_url` + `api_key` + `model_routes` path as the v1
write target.
- Do not add arbitrary base URLs or raw model ids.
- Do not add arbitrary base URLs or model ids absent from live `/v1/models`.
- Do not install or patch OpenHuman.
- Do not print, log, or place `gp-...` secrets in argv, output, repository
files, or backup filenames.
Expand Down
11 changes: 6 additions & 5 deletions docs/specs/openhuman-setup-prd/release-proof.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ Date: 2026-06-21
## Automated Proof

- `npm run ci` passes.
- Temp-workspace CLI smoke writes OpenHuman native GonkaGate config:
`OPENHUMAN_WORKSPACE=/tmp/openhuman-setup-smoke-codex node bin/gonkagate-openhuman.js --json --yes`.
- Temp-workspace CLI smoke writes OpenHuman native GonkaGate config with a
mocked authenticated `/v1/models` response:
`OPENHUMAN_WORKSPACE=/tmp/openhuman-setup-smoke-codex GONKAGATE_API_KEY=gp-... node bin/gonkagate-openhuman.js --json --yes`.
- The smoke-written config contains one `cloud_providers` entry with slug
`gonkagate` and workload provider strings for chat, reasoning, agentic,
coding, and memory.
Expand All @@ -17,7 +18,7 @@ Not completed in this environment.

Current blocker:

- `GONKAGATE_API_KEY` is not set.
- A live `GONKAGATE_API_KEY` is not set.
- OpenHuman discovery resolves to pre-login config:
`/Users/daniil/.openhuman/users/local/config.toml`.
- OpenHuman session inspection reports `missing`.
Expand All @@ -35,8 +36,8 @@ and a real GonkaGate key entered through OpenHuman Settings -> AI.
pre-login `users/local/config.toml`.
- T2 Pure TOML Merge: fixture tests cover fresh config, unrelated provider
preservation, GonkaGate replacement, and idempotency.
- T3 Model Selection: tests cover defaults, global `--model`, per-workload
overrides, and curated-key rejection.
- T3 Model Selection: tests cover live `/v1/models` parsing, first-live-model
defaults, global `--model`, per-workload overrides, and live-id rejection.
- T4 Secret Intake And Redaction: tests cover `GONKAGATE_API_KEY`,
`--api-key-stdin`, plain `--api-key` rejection, and `gp-...` redaction.
- T5 Credential Storage: current safe outcome is no direct `auth-profiles.json`
Expand Down
Loading
Loading