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
11 changes: 5 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,11 @@ These audited assumptions are the current implementation contract:
- the v1 durable secret target is user-level
`settings.env.GONKAGATE_API_KEY`
- after API-key collection, the installer must make a separate authenticated
`GET https://api.gonkagate.com/v1/models` request and confirm all three
supported models before rendering the picker or writing config
- the managed Qwen provider catalog must include all three supported models:
- `qwen/qwen3-235b-a22b-instruct-2507-fp8`
- `moonshotai/Kimi-K2.6`
- `minimaxai/minimax-m2.7`
`GET https://api.gonkagate.com/v1/models` request before rendering the
picker or writing config
- authenticated `/v1/models` is the source of truth for user-visible model ids,
names, `--model` validation, default selection, and managed provider writes
- no checked-in GonkaGate model id list may become the runtime source of truth
- `qwen auth` is removed in the audited baseline; status is an interactive
`/doctor` concern rather than a standalone `qwen auth status` command
- `modelProviders` is currently marked with `replace` merge semantics, so
Expand Down
7 changes: 3 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

## [0.2.1](https://github.com/GonkaGate/qwen-code-setup/compare/v0.2.0...v0.2.1) (2026-06-23)


### Bug Fixes

* allow future Qwen Code versions ([676d44d](https://github.com/GonkaGate/qwen-code-setup/commit/676d44d7a0181f82c22b3c584652cd642879eca0))
* allow future Qwen Code versions ([e084d4e](https://github.com/GonkaGate/qwen-code-setup/commit/e084d4e1a2f48f6434e6c5f84311bf2cc74b8794))
- allow future Qwen Code versions ([676d44d](https://github.com/GonkaGate/qwen-code-setup/commit/676d44d7a0181f82c22b3c584652cd642879eca0))
- allow future Qwen Code versions ([e084d4e](https://github.com/GonkaGate/qwen-code-setup/commit/e084d4e1a2f48f6434e6c5f84311bf2cc74b8794))

## [0.2.0](https://github.com/GonkaGate/qwen-code-setup/compare/v0.1.0...v0.2.0) (2026-06-16)

Expand All @@ -22,5 +21,5 @@
- Add TypeScript, CI, release, package, docs, contract-test, and mirrored skill infrastructure.
- Record the initial Qwen Code compatibility assumptions without claiming the installer runtime is implemented.
- Expand the Qwen Code setup PRD with concrete v1 requirements for Qwen settings, secret storage, scope behavior, verification, and diagnostics.
- Require support for all three current GonkaGate models and authenticated `/v1/models` discovery after API-key intake.
- Require authenticated `/v1/models` discovery after API-key intake.
- Implement the Qwen Code setup runtime with safe secret intake, authenticated model discovery, managed user/project settings writes, backups, rollback, dry-run, durable verification, current-session shadowing warnings, redacted human/JSON output, and fake-tested optional live verification.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ The happy path is:
1. Detects the local `qwen` binary and records its version.
2. Collects or reuses `GONKAGATE_API_KEY` without printing the secret.
3. Calls authenticated `GET https://api.gonkagate.com/v1/models`.
4. Requires all supported GonkaGate models before writing config.
4. Uses that live model response for defaulting, selection, and validation.
5. Writes the GonkaGate provider into `modelProviders.openai[]`.
6. Sets `security.auth.selectedType = "openai"` and `model.name`.
7. Stores the durable key reference at `settings.env.GONKAGATE_API_KEY`.
Expand All @@ -56,12 +56,11 @@ settings. Use `--json` for machine-readable, redacted output.

## Supported Models

The installer only offers models that are present in GonkaGate's authenticated
model catalog:

- `qwen/qwen3-235b-a22b-instruct-2507-fp8`
- `moonshotai/Kimi-K2.6`
- `minimaxai/minimax-m2.7`
The installer has no checked-in user-facing model catalog. After collecting the
GonkaGate API key, it calls authenticated
`GET https://api.gonkagate.com/v1/models` and uses the returned model ids and
names as the source of truth for the picker, `--model` validation, default
selection, and Qwen Code provider writes.

## Known Qwen Code Baseline

Expand Down
30 changes: 10 additions & 20 deletions docs/architecture-decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,27 @@ The initial expected fields are:
Activation is expected through:

- `security.auth.selectedType = "openai"`
- `model.name = <curated GonkaGate model id>`
- `model.name = <live GonkaGate model id>`

This decision was revalidated against `@qwen-code/qwen-code` `0.18.0` on
June 12, 2026. The provider surface remains valid, but `modelProviders` is
marked with `replace` merge semantics, so project-scope writes must stay gated
until later executable compatibility proof confirms they cannot hide
user-managed providers.

## Decision 3: Combine Curated Support With Authenticated Model Discovery
## Decision 3: Use Authenticated Model Discovery As Runtime Catalog

The setup flow should expose the three supported GonkaGate models, not an
arbitrary model id box, and it must confirm availability through GonkaGate after
API-key intake.
The setup flow exposes the live GonkaGate model catalog returned for the user's
API key, not a checked-in model id list.

Reasons:

- predictable public UX
- support and troubleshooting clarity
- compatibility metadata can be attached to each model
- validation proof can gate end-user exposure
- the authenticated `/v1/models` response proves the supplied API key can
actually use the required models

The v1 required model set is:

- `qwen/qwen3-235b-a22b-instruct-2507-fp8`
- `moonshotai/Kimi-K2.6`
- `minimaxai/minimax-m2.7`

All three must be written into `modelProviders.openai[]`; `model.name` only
selects the default.
- adding or removing a GonkaGate network model should not require a repository
change
- authenticated `/v1/models` response proves the supplied API key can see the
model before writes
- the same live ids drive picker, `--model` validation, default selection, and
`modelProviders.openai[]`

## Decision 4: Use User Settings `env` For The Durable Secret

Expand Down
9 changes: 5 additions & 4 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ The runtime:
3. Parse and record the local Qwen Code version.
4. Collect the GonkaGate API key through a safe input.
5. Fetch `https://api.gonkagate.com/v1/models` with that key.
6. Confirm all three supported GonkaGate models are available.
7. Choose the setup default from the supported model picker.
8. Merges managed GonkaGate settings into Qwen Code user settings, including all
three models in `modelProviders.openai[]`.
6. Parse and dedupe the live GonkaGate model catalog.
7. Choose the setup default from the first fetched model or the live model
picker.
8. Merges managed GonkaGate settings into Qwen Code user settings, including
the fetched models in `modelProviders.openai[]`.
9. Persist the secret in user-level `settings.env.GONKAGATE_API_KEY`.
10. Verifies the durable Qwen Code outcome from locally inspectable evidence.
11. Reports current-session shadowing when process or project env overrides the
Expand Down
79 changes: 29 additions & 50 deletions docs/model-validation.md
Original file line number Diff line number Diff line change
@@ -1,62 +1,41 @@
# Model Validation

This document records the validation gate for curated GonkaGate models exposed
through `@gonkagate/qwen-code-setup`.
This document records the live model discovery rule for
`@gonkagate/qwen-code-setup`.

## Current Supported Models
## Source Of Truth

The v1 installer must support all three GonkaGate models currently available
for this setup flow:
The installer has no checked-in user-facing GonkaGate model id list. After
collecting the GonkaGate API key, it must make authenticated
`GET https://api.gonkagate.com/v1/models` with Bearer auth.

- `qwen/qwen3-235b-a22b-instruct-2507-fp8`
- `moonshotai/Kimi-K2.6`
- `minimaxai/minimax-m2.7`
The OpenAI-compatible response shape is expected to contain at least:

The static registry records each model with:
```json
{
"data": [{ "id": "provider/model", "name": "Optional display name" }]
}
```

- a stable curated key
- the GonkaGate model id
- a display label
- `status: "validated"`
- validation evidence date
- Qwen Code compatibility notes for the audited `0.18.0` baseline
- optional Qwen `generationConfig` fragments
The installer deduplicates returned ids, rejects malformed or empty responses
with `validated_models_unavailable`, and uses the remaining live models for:

Exactly one registry entry is marked as the recommended default for `--yes`.
For the current set, that default is
`qwen/qwen3-235b-a22b-instruct-2507-fp8`.
- the interactive picker
- `--model` validation
- the `--yes` default, which is the first fetched model
- `modelProviders.openai[]` writes
- `model.name`
- install-state managed model metadata

After collecting the GonkaGate API key, the installer must make a separate
authenticated request to `https://api.gonkagate.com/v1/models` and confirm that
all three ids are available before showing the picker or writing Qwen Code
settings.
## Runtime Rule

If any required id is missing, setup must fail with
`required_models_unavailable` instead of writing a partial provider catalog.
Only models returned by authenticated `/v1/models` for the user's key should
appear in the picker or be accepted by `--model`.

## Minimum Validation Proof
The Qwen Code provider catalog under `modelProviders.openai[]` must include the
live fetched model ids for that run, not a static subset. The selected
model controls `model.name`.

Before a model can be added to or removed from the supported set, record proof
for:

- GonkaGate `/v1/models` availability for an authenticated `gp-...` key
- Qwen Code model provider selection
- non-streaming chat completion
- streaming chat completion if Qwen Code uses streaming for normal operation
- tool/function calling behavior if Qwen Code requires it for agentic tasks
- context-window assumptions
- timeout/retry behavior
- any provider-specific generation settings

## Registry And Runtime Rule

Only models with `status: "validated"` and present in the authenticated
`/v1/models` response should appear in the end-user picker.

The Qwen Code provider catalog under `modelProviders.openai[]` must include all
three supported models, not only the selected default. The selected default
controls `model.name`.

Unsupported curated model keys and arbitrary raw model ids must fail before any
runtime work. Extra GonkaGate `/v1/models` entries remain ignored until this
registry and the public docs are explicitly updated.
Adding or removing a model in the GonkaGate network must not require a
repository change. No checked-in GonkaGate model id list may become the runtime
source of truth.
42 changes: 15 additions & 27 deletions docs/security.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,33 @@ Allowed secret inputs:

## Qwen Code Secret Storage

Qwen Code provider entries refer to an `envKey`. For v1, the durable secret
target is user-level `settings.env.GONKAGATE_API_KEY` inside the active Qwen
settings file:
Qwen Code provider entries refer to `envKey`.

For v1, the durable secret target is user-level
`settings.env.GONKAGATE_API_KEY` inside the active Qwen settings file:

- `~/.qwen/settings.json`, or
- `<QWEN_HOME>/settings.json` when Qwen Code is configured to use `QWEN_HOME`

The installer uses this target because Qwen Code always treats `settings.env`
as a fallback environment source, while a separate user `.env` can be skipped
when a trusted project `.env` exists.

The secret must never be written to project `.qwen/settings.json`, project
`.env`, or shell profiles.

## Model Discovery Request

After collecting the key, the installer must make an authenticated
`GET https://api.gonkagate.com/v1/models` request to confirm the three supported
models are available.
After collecting the key, the installer must make authenticated
`GET https://api.gonkagate.com/v1/models` and use that live response as the
user-visible model catalog.

Security rules for this request:
Security rules for the request:

- pass the key only through an `Authorization: Bearer ...` header
- never print the header or raw key
- pass the key only through the `Authorization: Bearer ...` header
- never print the raw header key
- do not include the raw response in user-facing errors
- report missing model ids through redacted diagnostics such as
`required_models_unavailable`
- report invalid, empty, or unavailable live model catalogs through redacted
diagnostics such as `validated_models_unavailable`

## Diagnostics

Do not print raw config or environment dumps if they can contain substituted
secrets.

If a verification command exposes secret-bearing output, capture it internally
only and render a redacted summary.

## Backups And Rollback

Existing managed targets are backed up under
`~/.gonkagate/qwen-code/backups/` before replacement. Project settings backups
also stay under that user-level backup root. Failed writes or failed durable
verification roll back prior managed writes where the filesystem permits it.
Do not print raw config or environment dumps that contain substituted secrets.
If verification output may contain secrets, capture it internally and render
only a redacted summary.
Loading
Loading