triss-coworker 0.24.2 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -1
- package/README.md +112 -23
- package/bin/triss.js +9 -5
- package/docs/configuration.md +86 -17
- package/docs/glm-clients.md +8 -6
- package/docs/mcp.md +78 -16
- package/docs/opencode-zen.md +24 -15
- package/package.json +2 -1
- package/src/client.js +201 -51
- package/src/coder-engines/crush.js +2 -1
- package/src/commands/ask.js +30 -7
- package/src/commands/coder.js +225 -55
- package/src/commands/review.js +12 -5
- package/src/commands/status.js +45 -2
- package/src/commands/usage.js +13 -4
- package/src/config.js +84 -7
- package/src/mcp/handlers.js +69 -20
- package/src/mcp/review-core.js +2 -0
- package/src/mcp/tools.js +30 -15
- package/src/models.js +181 -1
- package/src/moonshot.js +16 -0
- package/src/usage.js +82 -22
- package/src/zai.js +28 -0
- package/templates/claude-full.md +19 -5
- package/templates/claude.md +7 -1
- package/templates/codex-full.md +17 -4
- package/templates/codex.md +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,119 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.26.0] — 2026-07-27
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Kimi (Moonshot AI) as a first-class inference provider.** `triss ask` and
|
|
15
|
+
`triss review` accept `--provider kimi` (aliases `moonshot`, `moonshotai`;
|
|
16
|
+
also the `provider` field on the `triss_ask` / `triss_review` MCP tools), using
|
|
17
|
+
`MOONSHOT_API_KEY` against the OpenAI-compatible
|
|
18
|
+
`https://api.moonshot.ai/v1` endpoint. `--model pro` maps to `kimi-k3` —
|
|
19
|
+
Moonshot's flagship open-weights model (released 2026-07-16, weights
|
|
20
|
+
published 2026-07-26) — and `--model flash` to `kimi-k2.6`, the cheapest
|
|
21
|
+
current-generation model. Model ids are passed bare: Kimi has a single
|
|
22
|
+
endpoint, so there is no prefix grammar and no endpoint auto-correction.
|
|
23
|
+
`TRISS_KIMI_BASE_URL` points the route at a different host (e.g. the
|
|
24
|
+
China-mainland `api.moonshot.cn`). Both settings live in the reloadable
|
|
25
|
+
provider snapshot, so a long-lived MCP server picks up edits without a
|
|
26
|
+
restart.
|
|
27
|
+
- **Kimi in `triss coder`.** `triss coder init --provider moonshot` sets up
|
|
28
|
+
pay-as-you-go `moonshotai/*` models (default main `moonshotai/kimi-k2.7-code`,
|
|
29
|
+
small `moonshotai/kimi-k2.6`), and `--provider kimi-for-coding` sets up the
|
|
30
|
+
flat-rate Kimi for Coding subscription (`kimi-for-coding/k3` — Kimi K3 —
|
|
31
|
+
with `KIMI_API_KEY`). Unlike Z.AI there is no plan probe: the two Kimi plans
|
|
32
|
+
use different credential envs, so the provider choice already names the
|
|
33
|
+
endpoint. Runs forward only the key the resolved model needs; a Kimi-only
|
|
34
|
+
machine needs no `ZHIPU_API_KEY`. The `moonshotai-cn/*` prefix is recognised
|
|
35
|
+
for China-mainland pins. The crush engine remains Z.AI-only and now rejects
|
|
36
|
+
any non-GLM model override explicitly.
|
|
37
|
+
- `triss status` / `triss_status` print a Kimi routing block (key presence,
|
|
38
|
+
resolved endpoint and its source, preset models), and
|
|
39
|
+
`triss_coder_run` / `triss_coder_status` surface once any provider
|
|
40
|
+
credential is set — `ZHIPU_API_KEY`, `OPENCODE_API_KEY`,
|
|
41
|
+
`MOONSHOT_API_KEY`, or `KIMI_API_KEY`.
|
|
42
|
+
- Kimi list prices (fetched 2026-07-27 from platform.kimi.ai) ship built-in
|
|
43
|
+
for `kimi-k3`, `kimi-k2.7-code`, `kimi-k2.7-code-highspeed`, and
|
|
44
|
+
`kimi-k2.6`, matched whether the id is logged bare (ask/review) or under
|
|
45
|
+
opencode's `moonshotai/` / `moonshotai-cn/` prefix (coder runs).
|
|
46
|
+
`kimi-for-coding/*` subscription calls are accounted as known `$0` — the
|
|
47
|
+
plan meters by quota, like the Z.AI Coding Plan.
|
|
48
|
+
|
|
49
|
+
### Changed
|
|
50
|
+
|
|
51
|
+
- The opencode engine pin was bumped from 1.17.18 to 1.18.7 (2026-07-27
|
|
52
|
+
release; the 1.18.x line is bugfix/Desktop work with no `run` CLI changes,
|
|
53
|
+
and 1.18.4 specifically improved Kimi model handling).
|
|
54
|
+
- The `coder` row in `triss status` is labelled `coder` (previously
|
|
55
|
+
`GLM/coder`) now that it fronts GLM, Kimi, and OpenCode Zen credentials.
|
|
56
|
+
- The npm tarball no longer ships `docs/promo/` (marketing drafts); the
|
|
57
|
+
package `files` list excludes it explicitly.
|
|
58
|
+
- A bare `triss coder run` that fails on a missing `ZHIPU_API_KEY` now names
|
|
59
|
+
the working `--model` path when another provider's key (Zen/Kimi) is
|
|
60
|
+
configured, and Kimi 429 responses carry a rate-limit/balance hint.
|
|
61
|
+
|
|
62
|
+
## [0.25.0] — 2026-07-27
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
|
|
66
|
+
- `triss ask` and `triss review` now accept `--provider glm` (also available
|
|
67
|
+
as the `provider` field on `triss_ask` / `triss_review` MCP tools). They reuse
|
|
68
|
+
`ZHIPU_API_KEY` for direct OpenAI-compatible chat completions, while the
|
|
69
|
+
existing `worker` provider remains the default and `deepseek` is an alias.
|
|
70
|
+
`--model pro` maps to `glm-5.2`, and `--model flash` — Triss's cheap
|
|
71
|
+
bulk-read tier — maps to `glm-4.7` on the subscription endpoint and
|
|
72
|
+
`glm-4.5-air` on pay-as-you-go. Explicit `zai-coding-plan/<model>` /
|
|
73
|
+
`zai/<model>` prefixes select the endpoint, and may carry a preset
|
|
74
|
+
(`zai/flash`). Usage records retain that endpoint identity: subscription
|
|
75
|
+
calls remain known `$0` because the plan meters by quota, while PAYG calls
|
|
76
|
+
are priced from Z.AI's published rates.
|
|
77
|
+
- `triss status` and the `triss_status` MCP tool print a GLM routing block:
|
|
78
|
+
whether `ZHIPU_API_KEY` is set, the endpoint a `--provider glm` call resolves
|
|
79
|
+
to, what selected it, and that endpoint's preset models. Worker credential
|
|
80
|
+
rows are now labelled as such, so a GLM-only setup no longer reads as
|
|
81
|
+
unconfigured just because it has no worker key.
|
|
82
|
+
- Pay-as-you-go GLM models now ship with Z.AI's published list prices, so
|
|
83
|
+
`triss usage` reports a real cost for them instead of `unknown`.
|
|
84
|
+
Provider selection is intentionally scoped to `ask` and `review`;
|
|
85
|
+
`chat`, `fetch`, `write`, and `commit-msg` keep their existing worker route,
|
|
86
|
+
while `triss coder` remains the separate agentic path.
|
|
87
|
+
|
|
88
|
+
### Changed
|
|
89
|
+
|
|
90
|
+
- Usage JSONL records keep `cost_usd` numeric for compatibility with existing
|
|
91
|
+
dashboards and add `cost_usd_known: false` when no model price is configured.
|
|
92
|
+
`triss usage` excludes those zeros from known totals and reports them as
|
|
93
|
+
unknown. This includes unpriced `opencode/*` OpenCode Zen models; configure
|
|
94
|
+
`TRISS_PRICE_<MODEL_ID>` to account for one. Existing log entries are not
|
|
95
|
+
rewritten: older bare GLM model ids and their previously recorded numeric
|
|
96
|
+
costs remain unchanged.
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
|
|
100
|
+
- A GLM call that nothing pinned to an endpoint is no longer a one-shot guess.
|
|
101
|
+
A Z.AI key carries no marker of which plan it belongs to, so a pay-as-you-go
|
|
102
|
+
key used to fail outright against the `zai-coding-plan` default. Such a call
|
|
103
|
+
is now retried once on the other endpoint; the working one is reported on
|
|
104
|
+
stderr and reused for the rest of the process, and re-probed if the key
|
|
105
|
+
changes. The cache stores only the working endpoint, never the API key or a
|
|
106
|
+
fingerprint derived from it. Endpoints pinned by an explicit prefix or
|
|
107
|
+
`TRISS_CODER_MODEL` are never second-guessed, and a key that works on neither
|
|
108
|
+
endpoint still surfaces the original rejection.
|
|
109
|
+
- A preset behind a provider prefix is resolved instead of being sent
|
|
110
|
+
verbatim: `zai/flash` previously reached the provider as the literal model
|
|
111
|
+
id `flash`.
|
|
112
|
+
- Long-lived MCP processes now refresh file-backed `TRISS_CODER_MODEL` and
|
|
113
|
+
`ZHIPU_API_KEY` values between calls, including edits and removals, while
|
|
114
|
+
preserving the precedence of values supplied by the parent environment.
|
|
115
|
+
- Every model routed through the `zai-coding-plan/` subscription endpoint is
|
|
116
|
+
treated as known plan-metered usage instead of requiring a hardcoded model
|
|
117
|
+
allowlist. Explicit `TRISS_PRICE_<MODEL>` overrides still take precedence.
|
|
118
|
+
- A GLM `HTTP 429` now carries the resolved-endpoint hint instead of surfacing
|
|
119
|
+
Z.AI's bare "Insufficient balance or no resource package" text. That reply is
|
|
120
|
+
what a subscription key gets on the pay-as-you-go endpoint, so the message now
|
|
121
|
+
names both the balance and the wrong-plan cause.
|
|
122
|
+
|
|
10
123
|
## [0.24.2] — 2026-07-15
|
|
11
124
|
|
|
12
125
|
### Changed
|
|
@@ -667,7 +780,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
667
780
|
|
|
668
781
|
- Initial release of `triss-coworker`.
|
|
669
782
|
|
|
670
|
-
[Unreleased]: https://github.com/ayleen/triss-coworker/compare/v0.
|
|
783
|
+
[Unreleased]: https://github.com/ayleen/triss-coworker/compare/v0.26.0...HEAD
|
|
784
|
+
[0.26.0]: https://github.com/ayleen/triss-coworker/compare/v0.25.0...v0.26.0
|
|
785
|
+
[0.25.0]: https://github.com/ayleen/triss-coworker/compare/v0.24.2...v0.25.0
|
|
786
|
+
[0.24.2]: https://github.com/ayleen/triss-coworker/compare/v0.24.1...v0.24.2
|
|
671
787
|
[0.24.1]: https://github.com/ayleen/triss-coworker/compare/v0.24.0...v0.24.1
|
|
672
788
|
[0.24.0]: https://github.com/ayleen/triss-coworker/compare/v0.23.0...v0.24.0
|
|
673
789
|
[0.23.0]: https://github.com/ayleen/triss-coworker/compare/v0.22.4...v0.23.0
|
package/README.md
CHANGED
|
@@ -236,10 +236,12 @@ The exposed tool set is **filtered by configured credentials**:
|
|
|
236
236
|
- **`triss_linear_*`** when `LINEAR_API_KEY` is set.
|
|
237
237
|
- **`triss_github_*`** when `GITHUB_TOKEN` is set (or `gh` CLI logged in).
|
|
238
238
|
- **`triss_gitlab_*`** when `GITLAB_TOKEN` is set.
|
|
239
|
-
- **`triss_coder_run` + `triss_coder_status`** when
|
|
239
|
+
- **`triss_coder_run` + `triss_coder_status`** when any coder provider key is
|
|
240
|
+
set — `ZHIPU_API_KEY` (Z.AI GLM), `OPENCODE_API_KEY` (OpenCode Zen),
|
|
241
|
+
`MOONSHOT_API_KEY` (Moonshot Kimi), or `KIMI_API_KEY` (Kimi for Coding)
|
|
240
242
|
(setup: `triss coder init`). `triss_coder_run` takes an optional `engine`
|
|
241
243
|
(`opencode` default, or `crush`); its timeout defaults to
|
|
242
|
-
1500s (25 min) over MCP, above the CLI's 900s, since
|
|
244
|
+
1500s (25 min) over MCP, above the CLI's 900s, since coding runs are
|
|
243
245
|
expected to be long; override per call via the `timeout` arg. For
|
|
244
246
|
runs that may exceed it, use `triss coder run` on the CLI instead.
|
|
245
247
|
|
|
@@ -269,8 +271,8 @@ and writing**.
|
|
|
269
271
|
| `triss review` | Code review on current branch or a PR (diff + linked ticket) | The agent reading the whole diff |
|
|
270
272
|
| `triss commit-msg` | Generates a commit message from staged diff | Hand-writing or copy-pasting from web LLMs |
|
|
271
273
|
| `triss usage` | Cumulative cost / token usage with per-project breakdown | Squinting at stderr after each call |
|
|
272
|
-
| `triss coder init` | Sets up a coding agent (default `opencode` engine; `--engine crush` for crush): provider key (Z.AI GLM
|
|
273
|
-
| `triss coder run` | Spawns the
|
|
274
|
+
| `triss coder init` | Sets up a coding agent (default `opencode` engine; `--engine crush` for crush): provider key (Z.AI GLM default; `--provider opencode-zen` for free OpenCode Zen models like `hy3`; `--provider moonshot` for Kimi pay-as-you-go; `--provider kimi-for-coding` for the Kimi subscription), `opencode.json` / crush models + `permissions.run` policy, agent templates. Blocks (non-zero) on an unsafe existing `opencode.json` — missing deny-first bash policy (override with `--allow-unsafe-bash`) or a stale/cross-provider `small_model` | Manually installing/configuring opencode |
|
|
275
|
+
| `triss coder run` | Spawns the coding agent (GLM, Kimi, or Zen models) and prints one JSON envelope (`--engine opencode\|crush`; `--isolate` for a disposable worktree — opencode defaults to isolate-OFF, crush defaults to isolate-ON; crush adds opt-in `--restrict`/`--no-restrict` for its CLI allowlist). **POSIX only** (macOS/Linux) — refuses to run on Windows. | Manually driving `opencode run` and parsing its ndjson stream |
|
|
274
276
|
| `triss coder clean` | Removes finished `.triss/wt` isolation worktrees (`--all` forces all) | Manually finding and deleting stale git worktrees |
|
|
275
277
|
| `triss init` | Drops a tiny (~15 line) delegation block into `CLAUDE.md` / `AGENTS.md` | Hand-writing routing rules |
|
|
276
278
|
| `triss agent-help` | Prints the full delegation cookbook on demand (the nano block points here) | A 200-line CLAUDE.md that always loads |
|
|
@@ -288,6 +290,14 @@ triss ask --paths src/auth.ts src/db.ts \
|
|
|
288
290
|
triss ask --paths "src/**/*.ts" \
|
|
289
291
|
--question "Find SQL injection risks" \
|
|
290
292
|
--model pro --max-tokens 16384
|
|
293
|
+
|
|
294
|
+
triss ask --paths "src/**/*.ts" \
|
|
295
|
+
--question "Find SQL injection risks" \
|
|
296
|
+
--provider glm --model pro
|
|
297
|
+
|
|
298
|
+
triss ask --paths "src/**/*.ts" \
|
|
299
|
+
--question "Find SQL injection risks" \
|
|
300
|
+
--provider kimi --model pro # Kimi K3 via MOONSHOT_API_KEY
|
|
291
301
|
```
|
|
292
302
|
|
|
293
303
|
Typical output is a focused answer with cited file paths, not a raw file dump.
|
|
@@ -335,7 +345,7 @@ triss usage --json # raw log records
|
|
|
335
345
|
triss usage --reset # clear the log
|
|
336
346
|
```
|
|
337
347
|
|
|
338
|
-
Every
|
|
348
|
+
Every model call (CLI **and** MCP) appends one record to
|
|
339
349
|
`~/.cache/triss/usage.jsonl` with model, tokens, cached tokens, computed
|
|
340
350
|
USD cost, working directory, a label like `triss/ask`, and a per-invocation
|
|
341
351
|
`call_id` (UUIDv4). An optional `parent_call_id` lets a host group several
|
|
@@ -343,9 +353,17 @@ Triss calls under a single outer session — set `TRISS_PARENT_CALL_ID` in
|
|
|
343
353
|
the environment that launches Triss (e.g. in your MCP server's `env`
|
|
344
354
|
block) and every record from that process carries it. External dashboards
|
|
345
355
|
(e.g. tokentelemetry) can group by either field. List-price defaults for
|
|
346
|
-
DeepSeek are baked in
|
|
347
|
-
`
|
|
348
|
-
|
|
356
|
+
DeepSeek are baked in. GLM records retain `zai-coding-plan/` or `zai/` so
|
|
357
|
+
subscription usage stays known `$0` while unpriced PAYG usage is shown as
|
|
358
|
+
`unknown`, never as free. Any other unpriced model, including `opencode/*`
|
|
359
|
+
OpenCode Zen, is also `unknown` unless configured with a matching
|
|
360
|
+
`TRISS_PRICE_<MODEL_ID>` override. The JSONL keeps `cost_usd` numeric for
|
|
361
|
+
dashboard compatibility and marks unpriced records with `cost_usd_known: false`.
|
|
362
|
+
Existing records are not migrated, so older bare GLM model ids remain as
|
|
363
|
+
originally logged. Override per-model with
|
|
364
|
+
`TRISS_PRICE_<MODEL_ID>=miss,hit,out` (USD per token), for example
|
|
365
|
+
`TRISS_PRICE_ZAI_GLM_5_2=...`. Disable tracking entirely with
|
|
366
|
+
`TRISS_USAGE_LOG=0`.
|
|
349
367
|
|
|
350
368
|
### Streaming output
|
|
351
369
|
|
|
@@ -391,6 +409,8 @@ triss review # current branch vs auto-detected base
|
|
|
391
409
|
triss review 123 # GitHub PR #123 (requires `gh` CLI)
|
|
392
410
|
triss review --base develop # explicit base
|
|
393
411
|
triss review --skip-issue # don't try ticket lookup
|
|
412
|
+
triss review --provider glm # same review flow, one-shot GLM inference
|
|
413
|
+
triss review --provider kimi # …or Kimi (pro preset = kimi-k3)
|
|
394
414
|
```
|
|
395
415
|
|
|
396
416
|
Defaults to the `pro` preset because review needs reasoning. Output is
|
|
@@ -430,9 +450,10 @@ default timeout, configurable via `--timeout <ms>`.
|
|
|
430
450
|
|
|
431
451
|
### `triss coder`
|
|
432
452
|
|
|
433
|
-
Delegates an implementation task to a
|
|
434
|
-
engine by default; `crush` is an
|
|
435
|
-
instead of the primary model writing
|
|
453
|
+
Delegates an implementation task to a cheap coding agent — GLM, Kimi, or
|
|
454
|
+
OpenCode Zen models (the `opencode` engine by default; `crush` is an
|
|
455
|
+
alternative — see **Engines** below) instead of the primary model writing
|
|
456
|
+
the code itself.
|
|
436
457
|
|
|
437
458
|
```bash
|
|
438
459
|
triss coder init # once: key, opencode.json, agent templates
|
|
@@ -443,11 +464,17 @@ triss coder clean # remove finished isolation wo
|
|
|
443
464
|
```
|
|
444
465
|
|
|
445
466
|
`triss coder init` first asks which provider to configure — **Z.AI GLM**
|
|
446
|
-
(default)
|
|
447
|
-
Hunyuan `hy3`)
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
467
|
+
(default), **OpenCode Zen** (`--provider opencode-zen`, free models incl.
|
|
468
|
+
Hunyuan `hy3`), **Moonshot Kimi** (`--provider moonshot`, pay-as-you-go
|
|
469
|
+
`moonshotai/*` models like `kimi-k2.7-code`), or **Kimi for Coding**
|
|
470
|
+
(`--provider kimi-for-coding`, the flat-rate subscription serving Kimi K3).
|
|
471
|
+
For Z.AI it probes which plan your key works with (subscription vs.
|
|
472
|
+
pay-as-you-go) and writes the matching model prefix; for Zen it saves an
|
|
473
|
+
`OPENCODE_API_KEY` and writes an `opencode/<id>` model; the two Kimi
|
|
474
|
+
providers need no probe at all — their plans use different keys
|
|
475
|
+
(`MOONSHOT_API_KEY` vs `KIMI_API_KEY`), so the choice already names the
|
|
476
|
+
endpoint. Either way it lets you pick the model interactively. See the
|
|
477
|
+
**Providers** section below and
|
|
451
478
|
[docs/opencode-zen.md](docs/opencode-zen.md) for the OpenCode Zen deep‑dive.
|
|
452
479
|
|
|
453
480
|
Prints one JSON envelope to stdout — `files_changed`, `diff_stat`, and
|
|
@@ -481,9 +508,14 @@ natively; triss also forwards it as `ZAI_API_KEY` for older binaries; see
|
|
|
481
508
|
|
|
482
509
|
**Providers** — the `opencode` engine isn't limited to Z.AI. The required
|
|
483
510
|
API key follows the model's `<provider>/` prefix: `zai-coding-plan/*` and
|
|
484
|
-
`zai/*` (GLM) use `ZHIPU_API_KEY
|
|
511
|
+
`zai/*` (GLM) use `ZHIPU_API_KEY`; `opencode/*` models — served free by
|
|
485
512
|
[OpenCode Zen](https://opencode.ai/docs/zen/), e.g. **`opencode/hy3-free`**
|
|
486
|
-
(Tencent Hunyuan 3) — use `OPENCODE_API_KEY
|
|
513
|
+
(Tencent Hunyuan 3) — use `OPENCODE_API_KEY`; `moonshotai/*` (and the
|
|
514
|
+
China-mainland `moonshotai-cn/*`) Kimi models use `MOONSHOT_API_KEY`; and
|
|
515
|
+
`kimi-for-coding/*` models — the flat-rate
|
|
516
|
+
[Kimi for Coding](https://www.kimi.com/code/docs/en/) subscription, e.g.
|
|
517
|
+
**`kimi-for-coding/k3`** (Kimi K3) — use `KIMI_API_KEY`. To point coder at
|
|
518
|
+
a Zen model:
|
|
487
519
|
|
|
488
520
|
```bash
|
|
489
521
|
triss coder init --provider opencode-zen # guided: key + opencode.json
|
|
@@ -496,10 +528,21 @@ triss coder run "add input validation to /signup"
|
|
|
496
528
|
triss coder run "..." --model opencode/hy3-free
|
|
497
529
|
```
|
|
498
530
|
|
|
531
|
+
Kimi works the same way:
|
|
532
|
+
|
|
533
|
+
```bash
|
|
534
|
+
triss coder init --provider moonshot # pay-as-you-go: kimi-k2.7-code default
|
|
535
|
+
triss coder init --provider kimi-for-coding # subscription: Kimi K3 on a flat plan
|
|
536
|
+
# …or per-run, without changing the default:
|
|
537
|
+
triss coder run "..." --model moonshotai/kimi-k3
|
|
538
|
+
triss coder run "..." --model kimi-for-coding/k3
|
|
539
|
+
```
|
|
540
|
+
|
|
499
541
|
`triss coder run` passes the resolved model to opencode with `--model` and
|
|
500
542
|
forwards only the key that model needs, so a Zen run works with
|
|
501
|
-
`OPENCODE_API_KEY` alone
|
|
502
|
-
|
|
543
|
+
`OPENCODE_API_KEY` alone and a Kimi run with `MOONSHOT_API_KEY` /
|
|
544
|
+
`KIMI_API_KEY` alone — no Z.AI key required. The deny-first `opencode.json`
|
|
545
|
+
bash policy applies to every provider. Any Zen model id works via
|
|
503
546
|
`TRISS_CODER_MODEL=opencode/<id>` / `--model`, not just the free ones the
|
|
504
547
|
picker lists. (The `crush` engine speaks Z.AI only.) Full details, the model
|
|
505
548
|
catalogue, and every configuration path are in
|
|
@@ -582,6 +625,47 @@ requires an OpenAI-compatible chat-completions endpoint.
|
|
|
582
625
|
|
|
583
626
|
You can also pass any model id directly: `--model deepseek-v4-pro`.
|
|
584
627
|
|
|
628
|
+
`ask` and `review` can route the same one-shot request to GLM or Kimi without
|
|
629
|
+
invoking the agentic `coder` runtime:
|
|
630
|
+
|
|
631
|
+
```bash
|
|
632
|
+
triss ask --paths ... --question "..." --provider glm --model flash
|
|
633
|
+
triss review --provider glm --model pro
|
|
634
|
+
triss review --provider glm --model zai/glm-5.2 # pay-as-you-go endpoint
|
|
635
|
+
triss review --provider kimi # pro preset → kimi-k3
|
|
636
|
+
triss ask --paths ... --question "..." --provider kimi --model flash # kimi-k2.6
|
|
637
|
+
```
|
|
638
|
+
|
|
639
|
+
For GLM, `pro` maps to `glm-5.2` on both endpoints, while `flash` — the cheap
|
|
640
|
+
bulk-read tier — maps to `glm-4.7` on the subscription endpoint and to
|
|
641
|
+
`glm-4.5-air` ($0.20/$1.10 per 1M) on pay-as-you-go. The subscription endpoint
|
|
642
|
+
serves a `glm-4.5-air` request as `glm-4.7`, so the preset names what actually
|
|
643
|
+
runs there.
|
|
644
|
+
|
|
645
|
+
`ZHIPU_API_KEY` is reused. Prefix an explicit model with `zai-coding-plan/`
|
|
646
|
+
or `zai/` to select the subscription or pay-as-you-go endpoint; otherwise
|
|
647
|
+
Triss inherits the prefix from `TRISS_CODER_MODEL` and falls back to the
|
|
648
|
+
coding-plan endpoint. A Z.AI key does not say which plan it belongs to, so
|
|
649
|
+
when nothing pinned the endpoint and the call comes back `401`/`403`/`429`,
|
|
650
|
+
Triss retries once on the other endpoint, prints which one worked, and reuses
|
|
651
|
+
it for the rest of the process. Pin it (`TRISS_CODER_MODEL=zai/glm-5.2`, or run
|
|
652
|
+
`triss coder init`) to skip that probe. `triss status` shows the resolved
|
|
653
|
+
endpoint, where it came from, and the presets it selects.
|
|
654
|
+
|
|
655
|
+
For Kimi (`--provider kimi`, alias `moonshot`), `pro` maps to **`kimi-k3`** —
|
|
656
|
+
Moonshot's flagship open-weights model ($3.00/$15.00 per 1M tokens, cache-hit
|
|
657
|
+
input $0.30) — and `flash` to `kimi-k2.6` ($0.95/$4.00, cache-hit $0.16), the
|
|
658
|
+
cheapest current-generation model on the platform. `MOONSHOT_API_KEY` is
|
|
659
|
+
reused from the coder setup, there is a single OpenAI-compatible endpoint
|
|
660
|
+
(`https://api.moonshot.ai/v1`; set `TRISS_KIMI_BASE_URL` for the
|
|
661
|
+
China-mainland `api.moonshot.cn`), and model ids are passed bare —
|
|
662
|
+
`--model kimi-k2.7-code`. The Kimi for Coding subscription is coder-only: its
|
|
663
|
+
endpoint speaks the Anthropic protocol, which ask/review's OpenAI client
|
|
664
|
+
cannot use.
|
|
665
|
+
|
|
666
|
+
`triss coder` stays separate because it is an agent runtime with tools,
|
|
667
|
+
sessions, and worktree isolation.
|
|
668
|
+
|
|
585
669
|
### Provider recipes
|
|
586
670
|
|
|
587
671
|
#### DeepSeek (default, recommended)
|
|
@@ -590,12 +674,17 @@ triss config set TRISS_WORKER_API_KEY # masked prompt
|
|
|
590
674
|
# That's it — BASE_URL / FLASH / PRO use the current DeepSeek V4 defaults.
|
|
591
675
|
```
|
|
592
676
|
|
|
593
|
-
#### Kimi / Moonshot
|
|
677
|
+
#### Kimi / Moonshot (first-class)
|
|
678
|
+
```bash
|
|
679
|
+
triss config set MOONSHOT_API_KEY # masked prompt
|
|
680
|
+
triss ask --provider kimi ... # flash=kimi-k2.6, pro=kimi-k3
|
|
681
|
+
```
|
|
682
|
+
Or replace the worker entirely (keeps `--provider` free for something else):
|
|
594
683
|
```bash
|
|
595
684
|
triss config set TRISS_WORKER_API_KEY $MOONSHOT_API_KEY
|
|
596
685
|
triss config set TRISS_WORKER_BASE_URL https://api.moonshot.ai/v1
|
|
597
|
-
triss config set TRISS_WORKER_FLASH_MODEL kimi-k2.
|
|
598
|
-
triss config set TRISS_WORKER_PRO_MODEL kimi-
|
|
686
|
+
triss config set TRISS_WORKER_FLASH_MODEL kimi-k2.6
|
|
687
|
+
triss config set TRISS_WORKER_PRO_MODEL kimi-k3
|
|
599
688
|
```
|
|
600
689
|
|
|
601
690
|
#### Ollama (local, free)
|
package/bin/triss.js
CHANGED
|
@@ -66,16 +66,19 @@ program
|
|
|
66
66
|
|
|
67
67
|
program
|
|
68
68
|
.command('ask')
|
|
69
|
-
.description('Delegate bulk reading
|
|
69
|
+
.description('Delegate bulk reading to the configured worker, GLM, or Kimi; returns a structured summary')
|
|
70
70
|
.option('-p, --paths <paths...>', 'files or globs to read')
|
|
71
71
|
.option('-u, --urls <urls...>', 'http(s) URLs to fetch and convert to markdown')
|
|
72
72
|
.option('--stdin', 'read piped stdin as an additional source (for `cmd | triss ask --stdin ...`)')
|
|
73
73
|
.requiredOption('-q, --question <text>', 'question to answer about the corpus')
|
|
74
|
+
.option('--provider <name>', 'inference provider: worker (default), deepseek (alias), glm, or kimi (alias: moonshot)')
|
|
74
75
|
.option('-m, --model <name>', 'model preset (flash | pro) or full model id')
|
|
75
76
|
.option('--max-tokens <n>', 'token budget for reasoning + answer', (v) => parseInt(v, 10), 8192)
|
|
76
77
|
.option('--system <text>', 'override the system prompt')
|
|
77
78
|
.option('--no-stream', "disable streaming output (default streams when stdout is a TTY)")
|
|
78
|
-
.
|
|
79
|
+
// Commander also supplies its Command instance to action handlers. Adapt
|
|
80
|
+
// at the CLI boundary so runAsk receives only its documented options.
|
|
81
|
+
.action((opts) => wrap(runAsk)(opts));
|
|
79
82
|
|
|
80
83
|
program
|
|
81
84
|
.command('write')
|
|
@@ -128,10 +131,11 @@ program
|
|
|
128
131
|
|
|
129
132
|
program
|
|
130
133
|
.command('review [pr]')
|
|
131
|
-
.description('Code review via
|
|
134
|
+
.description('Code review via the configured worker, GLM, or Kimi. No arg: current branch vs default base. With <pr>: GitHub PR via gh.')
|
|
132
135
|
.option('-b, --base <branch>', 'compare against this branch (default: auto-detect origin/HEAD or main/master/develop)')
|
|
133
136
|
.option('--skip-issue', "don't try to look up a Jira/Linear ticket from the branch/PR title")
|
|
134
137
|
.option('-q, --question <text>', 'override the default review question')
|
|
138
|
+
.option('--provider <name>', 'inference provider: worker (default), deepseek (alias), glm, or kimi (alias: moonshot)')
|
|
135
139
|
.option('-m, --model <name>', 'model preset (flash | pro) or full model id (default: pro)')
|
|
136
140
|
.option('--max-tokens <n>', 'token budget for the review (default 8192)')
|
|
137
141
|
.option('--no-stream', 'disable streaming output')
|
|
@@ -231,13 +235,13 @@ coder
|
|
|
231
235
|
.option('-g, --global', 'save to the global scope (~/.config/triss/.env, ~/.config/opencode/)')
|
|
232
236
|
.option('-l, --local', 'save to the project scope (./.triss.env, ./opencode.json)')
|
|
233
237
|
.option('--engine <name>', 'coding engine to configure: opencode (default) or crush')
|
|
234
|
-
.option('--provider <name>', 'opencode engine model provider: zai (Z.AI GLM, default)
|
|
238
|
+
.option('--provider <name>', 'opencode engine model provider: zai (Z.AI GLM, default), opencode-zen (free models incl. hy3), moonshot (Kimi pay-as-you-go), or kimi-for-coding (subscription)')
|
|
235
239
|
.option('--allow-unsafe-bash', 'proceed even if an existing opencode.json has no deny-first bash policy (the agent runs with --auto)')
|
|
236
240
|
.action(wrap(runCoderInit));
|
|
237
241
|
|
|
238
242
|
coder
|
|
239
243
|
.command('run [prompt]')
|
|
240
|
-
.description('Spawn a
|
|
244
|
+
.description('Spawn a coding agent — GLM, Kimi, or Zen models (opencode default, or --engine crush) — and print a JSON envelope to stdout')
|
|
241
245
|
.option('--engine <name>', 'coding engine: opencode (default) or crush')
|
|
242
246
|
.option('--session <id>', 'triss-side session slug, mapped to a real opencode session id in .triss/sessions.json')
|
|
243
247
|
.option('--continue', 'continue the most recent opencode session (maps to opencode --continue)')
|
package/docs/configuration.md
CHANGED
|
@@ -122,7 +122,7 @@ Removes a variable.
|
|
|
122
122
|
| `worker` | `TRISS_WORKER_API_KEY`, `TRISS_WORKER_BASE_URL`, `TRISS_WORKER_FLASH_MODEL`, `TRISS_WORKER_PRO_MODEL` | only `TRISS_WORKER_API_KEY` is required |
|
|
123
123
|
| `jira` | `ATLASSIAN_BASE_URL`, `ATLASSIAN_EMAIL`, `ATLASSIAN_API_TOKEN` | all three |
|
|
124
124
|
| `linear` | `LINEAR_API_KEY`, `LINEAR_API_URL` | only `LINEAR_API_KEY` is required |
|
|
125
|
-
| `coder` | `ZHIPU_API_KEY`, `OPENCODE_API_KEY` (setup: `triss coder init` — engine, `opencode.json`, agent templates) | `ZHIPU_API_KEY` (Z.AI GLM); `OPENCODE_API_KEY`
|
|
125
|
+
| `coder` | `ZHIPU_API_KEY`, `OPENCODE_API_KEY`, `MOONSHOT_API_KEY`, `KIMI_API_KEY` (setup: `triss coder init` — engine, `opencode.json`, agent templates) | `ZHIPU_API_KEY` (Z.AI GLM); the others optional — `OPENCODE_API_KEY` (OpenCode Zen), `MOONSHOT_API_KEY` (Moonshot Kimi), `KIMI_API_KEY` (Kimi for Coding) |
|
|
126
126
|
|
|
127
127
|
When you add a new integration (see [extending.md](extending.md)), its
|
|
128
128
|
`envVars` declaration is automatically picked up — no wizard changes needed.
|
|
@@ -218,12 +218,21 @@ env:
|
|
|
218
218
|
|
|
219
219
|
You added `.triss.env` to a project after Claude Code was already
|
|
220
220
|
running there. As of v0.9.3, **no restart needed** — `.env` files are
|
|
221
|
-
re-read on every `tools/list` request, so
|
|
222
|
-
|
|
221
|
+
re-read on every `tools/list` request, so newly added integration
|
|
222
|
+
credentials can expose their tools on the next listing. Replacing or removing
|
|
223
|
+
an integration credential that is already loaded still requires restarting
|
|
224
|
+
that MCP process.
|
|
223
225
|
|
|
224
226
|
The only thing that requires a restart is the *initial* MCP-server
|
|
225
227
|
registration — i.e. running `triss mcp install` for the first time.
|
|
226
|
-
After that,
|
|
228
|
+
After that, newly added credentials are discovered live.
|
|
229
|
+
|
|
230
|
+
Separately, GLM calls (`triss_ask` / `triss_review` with `provider: "glm"`)
|
|
231
|
+
re-read file-backed `TRISS_CODER_MODEL` and `ZHIPU_API_KEY` on each call.
|
|
232
|
+
Editing or removing either value in `.triss.env` takes effect on the next GLM
|
|
233
|
+
call without restarting the MCP server. Values supplied by the parent process
|
|
234
|
+
environment still take precedence. This is a GLM per-call guarantee; it does
|
|
235
|
+
not extend the tool-catalogue reload behaviour above to every integration.
|
|
227
236
|
|
|
228
237
|
## Environment reference
|
|
229
238
|
|
|
@@ -241,15 +250,18 @@ self-hosted endpoints).
|
|
|
241
250
|
| `TRISS_WORKER_PRO_MODEL` | no | `deepseek-v4-pro` | Override the `pro` preset |
|
|
242
251
|
| `TRISS_DEFAULT_MODEL` | no | `flash` | Which preset is used when no `--model`|
|
|
243
252
|
|
|
244
|
-
###
|
|
253
|
+
### GLM, Kimi, and coder
|
|
245
254
|
|
|
246
255
|
| Variable | Required | Default | Notes |
|
|
247
256
|
| -------------------------------- | -------- | ------------------ | ------------------------------------------ |
|
|
248
|
-
| `ZHIPU_API_KEY` | yes¹ | — | Z.AI API key for GLM models — <https://z.ai/manage-apikey/apikey-list> |
|
|
257
|
+
| `ZHIPU_API_KEY` | yes¹ | — | Z.AI API key for `ask`/`review --provider glm` and GLM coder models — <https://z.ai/manage-apikey/apikey-list> |
|
|
249
258
|
| `OPENCODE_API_KEY` | no¹ | — | OpenCode Zen key (opencode engine only) — unlocks `opencode/*` models like `opencode/hy3-free` — <https://opencode.ai/docs/zen/> |
|
|
250
|
-
| `
|
|
259
|
+
| `MOONSHOT_API_KEY` | no¹ | — | Moonshot AI (Kimi) key for `ask`/`review --provider kimi` and `moonshotai/*` coder models — <https://platform.kimi.ai/console/api-keys> |
|
|
260
|
+
| `KIMI_API_KEY` | no¹ | — | Kimi for Coding subscription key (opencode engine only) — unlocks `kimi-for-coding/*` models like `kimi-for-coding/k3` — <https://www.kimi.com/code/docs/en/> |
|
|
261
|
+
| `TRISS_KIMI_BASE_URL` | no | `https://api.moonshot.ai/v1` | Endpoint for `--provider kimi` ask/review calls — set `https://api.moonshot.cn/v1` for a China-mainland key. Trailing slashes are stripped; a blank/degenerate value falls back to the default |
|
|
262
|
+
| `TRISS_CODER_MODEL` | no | `zai-coding-plan/glm-5.2` | Resolved model, passed to opencode via `--model` (and written to `opencode.json` by `init`). Use `opencode/hy3-free` for OpenCode Zen, `moonshotai/kimi-k2.7-code` for Moonshot, `kimi-for-coding/k3` for the Kimi subscription |
|
|
251
263
|
| `TRISS_CODER_SMALL_MODEL` | no | `zai-coding-plan/glm-5-turbo` | Small/fast model written to `opencode.json`|
|
|
252
|
-
| `TRISS_CODER_OPENCODE_VERSION` | no | `1.
|
|
264
|
+
| `TRISS_CODER_OPENCODE_VERSION` | no | `1.18.7` | Pin override for the `opencode-ai` npm install |
|
|
253
265
|
| `TRISS_CODER_ENGINE` | no | `opencode` | Coding engine: `opencode` (default) or `crush` |
|
|
254
266
|
| `TRISS_CODER_CRUSH_VERSION` | no | `0.1.6` | Pin override for the `@phpcraftdream/crush` npm install (crush engine) |
|
|
255
267
|
| `TRISS_CODER_CRUSH_RESTRICT` | no | unset (`0`) | crush only — `1` opts INTO the CLI allowlist (`--restrict-run` + `--allow-bash`/`--allow-tool`, the only enforcement path that works today — crush 0.1.3 ignores the `permissions.run` config). Unset leaves crush unrestricted; crush then defaults to isolate-ON. CLI `--restrict`/`--no-restrict` overrides; crush.json `permissions.run.restrict` is the next fallback (forward-compat — currently inert) |
|
|
@@ -265,19 +277,59 @@ file) when the existing `model` prefix doesn't match what the key
|
|
|
265
277
|
verified against — that mismatch is what makes opencode retry a model
|
|
266
278
|
call it can never complete.
|
|
267
279
|
|
|
280
|
+
`triss ask` and `triss review` can use the same key without spawning a coding
|
|
281
|
+
agent: pass `--provider glm`. `pro` maps to `glm-5.2` on both endpoints;
|
|
282
|
+
`flash` maps to `glm-4.7` on `zai-coding-plan` and `glm-4.5-air` on `zai`,
|
|
283
|
+
because the subscription endpoint answers a `glm-4.5-air` request with
|
|
284
|
+
`glm-4.7` and a preset should name the model that actually runs. A
|
|
285
|
+
provider-prefixed model selects the endpoint explicitly
|
|
286
|
+
(`zai-coding-plan/glm-5.2` for a subscription key, `zai/glm-5.2` for
|
|
287
|
+
pay-as-you-go), and a prefix may carry a preset too — `zai/flash` means "the
|
|
288
|
+
pay-as-you-go flash model". A bare model id inherits the prefix from
|
|
289
|
+
`TRISS_CODER_MODEL`, then falls back to `zai-coding-plan`.
|
|
290
|
+
|
|
291
|
+
`--provider kimi` (alias `moonshot`) works the same way with
|
|
292
|
+
`MOONSHOT_API_KEY`: `pro` maps to `kimi-k3` (the flagship) and `flash` to
|
|
293
|
+
`kimi-k2.6` (the cheapest current-generation model). Kimi has a single
|
|
294
|
+
OpenAI-compatible endpoint, so model ids are passed bare — there is no
|
|
295
|
+
prefix grammar and no endpoint auto-correction. `TRISS_KIMI_BASE_URL`
|
|
296
|
+
points the route at a different host (e.g. `https://api.moonshot.cn/v1`).
|
|
297
|
+
The Kimi for Coding subscription (`KIMI_API_KEY`) is coder-only — its
|
|
298
|
+
endpoint speaks the Anthropic protocol, which ask/review's OpenAI client
|
|
299
|
+
cannot use.
|
|
300
|
+
|
|
301
|
+
**Endpoint auto-correction.** A Z.AI key carries no marker of which plan it
|
|
302
|
+
belongs to, so an unpinned `zai-coding-plan` route is a guess. When nothing
|
|
303
|
+
pinned the endpoint — no explicit prefix, no `TRISS_CODER_MODEL` — and the
|
|
304
|
+
call is rejected with `401`, `403`, or `429` (Z.AI answers a plan mismatch
|
|
305
|
+
with "Insufficient balance or no resource package"), Triss retries the request
|
|
306
|
+
once on the other endpoint. If that works, it warns on stderr and reuses that
|
|
307
|
+
endpoint for the rest of the process; the discovery is dropped when the key
|
|
308
|
+
changes. An explicitly prefixed or `TRISS_CODER_MODEL`-pinned endpoint is
|
|
309
|
+
never second-guessed. Pin one to skip the probe entirely — and note that a
|
|
310
|
+
pinned endpoint also selects that endpoint's presets. `triss status` and the
|
|
311
|
+
`triss_status` MCP tool print the resolved endpoint, its source, and the
|
|
312
|
+
preset models.
|
|
313
|
+
|
|
268
314
|
¹ **Credentials are provider-specific.** A run needs the one key its
|
|
269
315
|
resolved model requires: `zai-coding-plan/*` and `zai/*` (GLM) need
|
|
270
316
|
`ZHIPU_API_KEY`; `opencode/*` OpenCode Zen models (e.g. the free
|
|
271
|
-
`opencode/hy3-free`) need `OPENCODE_API_KEY
|
|
317
|
+
`opencode/hy3-free`) need `OPENCODE_API_KEY`; `moonshotai/*` and
|
|
318
|
+
`moonshotai-cn/*` Kimi models need `MOONSHOT_API_KEY`; `kimi-for-coding/*`
|
|
319
|
+
subscription models need `KIMI_API_KEY`. So `ZHIPU_API_KEY` is
|
|
272
320
|
"required" only in the sense that it is the default provider's key — a
|
|
273
|
-
zen-only setup runs on `OPENCODE_API_KEY` alone
|
|
321
|
+
zen-only setup runs on `OPENCODE_API_KEY` alone, a Kimi-only setup on its
|
|
322
|
+
Kimi key alone. `triss coder run` forwards
|
|
274
323
|
whichever key the model needs to the engine subprocess and gates on it
|
|
275
324
|
before spawning. The `crush` engine speaks Z.AI only and always needs
|
|
276
|
-
`ZHIPU_API_KEY`. `triss status` / `triss_coder_status` show
|
|
277
|
-
the coder MCP tools surface once **
|
|
278
|
-
`triss coder init --provider opencode-zen`
|
|
279
|
-
|
|
280
|
-
|
|
325
|
+
`ZHIPU_API_KEY`. `triss status` / `triss_coder_status` show all provider
|
|
326
|
+
keys, and the coder MCP tools surface once **any** is set. Run
|
|
327
|
+
`triss coder init --provider opencode-zen` (or `--provider moonshot` /
|
|
328
|
+
`--provider kimi-for-coding`) to set up a non-GLM model interactively
|
|
329
|
+
(key + `opencode.json`); Zen details are in
|
|
330
|
+
[opencode-zen.md](opencode-zen.md). The two Kimi providers need no
|
|
331
|
+
endpoint probe: their plans use different keys, so the provider choice
|
|
332
|
+
already names the endpoint.
|
|
281
333
|
|
|
282
334
|
**Engines.** `opencode` (default) enforces a deny-first per-command bash
|
|
283
335
|
allowlist via `opencode.json` (curated safe commands only) that actually
|
|
@@ -337,7 +389,7 @@ are unaffected.
|
|
|
337
389
|
| `TRISS_USAGE_LOG` | (on) | `0` disables the usage tracker (`~/.cache/triss/usage.jsonl`) |
|
|
338
390
|
| `TRISS_USAGE_LOG_CWD` | (on) | `0` omits the absolute cwd from each record (then `--by-project` groups under `(unknown)`) |
|
|
339
391
|
| `TRISS_USAGE_LOG_MAX_BYTES` | `10485760` | Rotate the active log to `usage.jsonl.old` once it crosses this size (10 MB default) |
|
|
340
|
-
| `TRISS_PRICE_<MODEL_ID>` | list prices | `miss,hit,out` USD-per-token override per model (e.g. for
|
|
392
|
+
| `TRISS_PRICE_<MODEL_ID>` | list prices | `miss,hit,out` USD-per-token override per model (e.g. `TRISS_PRICE_ZAI_GLM_5_2` for `zai/glm-5.2`); models without a price, including `opencode/*` Zen models, report `unknown`, not `$0` |
|
|
341
393
|
| `TRISS_FETCH_MAX_BYTES` | `10485760` | Max body size for `triss fetch` (default 10 MB) |
|
|
342
394
|
| `TRISS_RESTRICT_PATHS` | `1` in MCP, unset in CLI | `0` opts the MCP server out of the project-root file IO sandbox |
|
|
343
395
|
| `TRISS_ALLOW_PRIVATE_NETWORKS` | (off) | `1` allows `triss fetch` / `triss ask --urls` to hit RFC1918, loopback, link-local, and cloud-metadata IPs. Off blocks SSRF; turn on only for self-hosted internal docs. **Known residual risk:** the guard checks DNS once before fetch; the underlying connection performs another lookup, leaving a narrow DNS-rebinding window. For high-trust environments use network-level egress filtering as the primary control. |
|
|
@@ -367,7 +419,24 @@ baked-in DeepSeek list prices (e.g. you point Triss at a different
|
|
|
367
419
|
provider, or want the discounted rate), set
|
|
368
420
|
`TRISS_PRICE_<MODEL>=<input_cache_miss>,<input_cache_hit>,<output>` in
|
|
369
421
|
USD per token. Example: `TRISS_PRICE_DEEPSEEK_V4_PRO=4.35e-7,3.625e-9,8.7e-7`
|
|
370
|
-
applies the 75% promotional pricing to the pro preset.
|
|
422
|
+
applies the 75% promotional pricing to the pro preset. PAYG GLM calls use the
|
|
423
|
+
canonical `zai/<model>` id and ship with Z.AI's published list prices for the
|
|
424
|
+
models both endpoints advertise (`glm-4.5`, `glm-4.5-air`, `glm-4.6`,
|
|
425
|
+
`glm-4.7`, `glm-5`, `glm-5-turbo`, `glm-5.1`, `glm-5.2`), so a PAYG cost is
|
|
426
|
+
reported, not guessed. Override any of them the same way — `zai/glm-5.2` maps
|
|
427
|
+
to `TRISS_PRICE_ZAI_GLM_5_2`. Kimi PAYG models ship with Moonshot's list
|
|
428
|
+
prices (`kimi-k3`, `kimi-k2.7-code`, `kimi-k2.7-code-highspeed`,
|
|
429
|
+
`kimi-k2.6`), matched whether the id is logged bare (ask/review) or with
|
|
430
|
+
opencode's `moonshotai/` / `moonshotai-cn/` prefix (coder runs) — and a
|
|
431
|
+
`TRISS_PRICE_<MODEL_ID>` override keyed on the bare id
|
|
432
|
+
(`TRISS_PRICE_KIMI_K3`) covers both forms the same way.
|
|
433
|
+
Subscription calls — `zai-coding-plan/*` and `kimi-for-coding/*` — stay
|
|
434
|
+
`$0` because the plan meters by quota rather than tokens. Any model outside
|
|
435
|
+
those catalogues — a newly released GLM/Kimi id, `opencode/*` OpenCode Zen
|
|
436
|
+
models — is explicitly unknown until you set its matching `TRISS_PRICE_<MODEL_ID>`
|
|
437
|
+
override. Usage JSONL keeps `cost_usd` numeric for
|
|
438
|
+
compatibility and marks these records with `cost_usd_known: false`; existing
|
|
439
|
+
historical records are not relabelled.
|
|
371
440
|
|
|
372
441
|
**Claude Code integration step in the wizard** — split by mode:
|
|
373
442
|
|
package/docs/glm-clients.md
CHANGED
|
@@ -39,7 +39,9 @@ see §3). It **drives a local agent binary** and parses the one JSON
|
|
|
39
39
|
envelope that binary prints. There are two such binaries ("engines"), both
|
|
40
40
|
behind the same adapter interface. crush is always fed `ZHIPU_API_KEY`
|
|
41
41
|
(bridged to `ZAI_API_KEY`); opencode is fed whichever key its resolved model
|
|
42
|
-
needs — `ZHIPU_API_KEY` for GLM, `OPENCODE_API_KEY` for OpenCode Zen (§3)
|
|
42
|
+
needs — `ZHIPU_API_KEY` for GLM, `OPENCODE_API_KEY` for OpenCode Zen (§3),
|
|
43
|
+
`MOONSHOT_API_KEY` for `moonshotai/*` Kimi, `KIMI_API_KEY` for
|
|
44
|
+
`kimi-for-coding/*`.
|
|
43
45
|
|
|
44
46
|
---
|
|
45
47
|
|
|
@@ -48,11 +50,11 @@ needs — `ZHIPU_API_KEY` for GLM, `OPENCODE_API_KEY` for OpenCode Zen (§3).
|
|
|
48
50
|
| | **opencode** (engine #1, default) | **crush** (engine #2) |
|
|
49
51
|
|---|---|---|
|
|
50
52
|
| Select via | default, or `--engine opencode` | `--engine crush` / `TRISS_CODER_ENGINE=crush` |
|
|
51
|
-
| npm package | `opencode-ai` (pinned `1.
|
|
53
|
+
| npm package | `opencode-ai` (pinned `1.18.7`) | `@phpcraftdream/crush` (pinned `0.1.6`) |
|
|
52
54
|
| Version pin env | `TRISS_CODER_OPENCODE_VERSION` | `TRISS_CODER_CRUSH_VERSION` |
|
|
53
|
-
| Key it reads | `ZHIPU_API_KEY` (native); `OPENCODE_API_KEY` for `opencode/…` Zen models | `ZAI_API_KEY` (Triss bridges from `ZHIPU_API_KEY`; crush ≥0.1.1 also reads `ZHIPU_API_KEY` natively) |
|
|
54
|
-
| Providers | Z.AI GLM (`zai-coding-plan/…`, `zai/…`)
|
|
55
|
-
| Provider config | `opencode.json` with a `zai-coding-plan/…` (or `zai/…`) model prefix; Zen models resolve via opencode's built-in `opencode`
|
|
55
|
+
| Key it reads | `ZHIPU_API_KEY` (native); `OPENCODE_API_KEY` for `opencode/…` Zen models; `MOONSHOT_API_KEY` for `moonshotai/…`; `KIMI_API_KEY` for `kimi-for-coding/…` | `ZAI_API_KEY` (Triss bridges from `ZHIPU_API_KEY`; crush ≥0.1.1 also reads `ZHIPU_API_KEY` natively) |
|
|
56
|
+
| Providers | Z.AI GLM (`zai-coding-plan/…`, `zai/…`), OpenCode Zen (`opencode/…`, e.g. `opencode/hy3-free`), **and** Moonshot Kimi (`moonshotai/…` PAYG, `kimi-for-coding/…` subscription — see README's Providers section) | Z.AI GLM only |
|
|
57
|
+
| Provider config | `opencode.json` with a `zai-coding-plan/…` (or `zai/…`) model prefix; Zen/Kimi models resolve via opencode's built-in `opencode` / `moonshotai` / `kimi-for-coding` providers | `crush.json` `models` block (atoms `glm5_2` / `glm5_turbo`) |
|
|
56
58
|
| Output | ndjson stream that Triss folds into one envelope | ONE JSON object at end-of-run — trivial last-line parse |
|
|
57
59
|
| Sessions | slug → real `ses_…` id mapped in `.triss/sessions.json` | native get-or-create with the caller's arbitrary id — no map |
|
|
58
60
|
| Safety model | **deny-first bash allowlist** in `opencode.json` (persistent, enforced) | config `permissions.run` seeded into `crush.json` for forward-compat, but **currently inert** — enforcement is opt-in via `--restrict`, which emits the allowlist as **CLI flags** (`--allow-bash`/`--allow-tool`). See §8 |
|
|
@@ -279,7 +281,7 @@ Read `files_changed` + `diff_stat` + `worktree` to know what to review.
|
|
|
279
281
|
| `TRISS_CODER_ENGINE` | no | Default engine: `opencode` (default) or `crush`. |
|
|
280
282
|
| `TRISS_CODER_MODEL` | no | Override main model, e.g. `zai-coding-plan/glm-5.2` (verbatim, prefix included). |
|
|
281
283
|
| `TRISS_CODER_SMALL_MODEL` | no | Override small/fast model, e.g. `zai-coding-plan/glm-5-turbo`. |
|
|
282
|
-
| `TRISS_CODER_OPENCODE_VERSION` | no | Pin a different `opencode-ai` npm version (default `1.
|
|
284
|
+
| `TRISS_CODER_OPENCODE_VERSION` | no | Pin a different `opencode-ai` npm version (default `1.18.7`). |
|
|
283
285
|
| `TRISS_CODER_CRUSH_VERSION` | no | Pin a different `@phpcraftdream/crush` version (default `0.1.6`). |
|
|
284
286
|
| `TRISS_CODER_CRUSH_RESTRICT` | no | crush only: `1` opts INTO the allowlist (emits `--restrict-run` plus the `--allow-bash`/`--allow-tool` CLI flags — the only enforcement path that works today); unset/`0` leaves crush unrestricted (the default, paired with isolate-ON). Overridden per-run by `--restrict`/`--no-restrict`. |
|
|
285
287
|
|