thincoder 0.12.30 → 0.12.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thincoder",
3
- "version": "0.12.30",
3
+ "version": "0.12.31",
4
4
  "description": "Thin coding agent - zero dependencies, no build step, Node.js native. Sharp code, zero bloat.",
5
5
  "keywords": [
6
6
  "ai",
@@ -164,7 +164,7 @@ export const consultStartTool = {
164
164
  readonly: false,
165
165
  sideEffectExempt: true,
166
166
  description:
167
- "Start a parallel multi-model consultation for a hard problem you are stuck on (repeated failures, no headway). " +
167
+ "Start a parallel multi-model consultation (会诊) for a hard problem you are stuck on (repeated failures, no headway). " +
168
168
  "Several configured models (agent.consultModels) analyze the same problem INDEPENDENTLY and in parallel. " +
169
169
  "Non-blocking: returns immediately with a consult id. Then call consult_check(id) to read each reply as it " +
170
170
  "arrives, judge/verify it yourself with your own tools, and call consult_stop(id) once a reply is good enough.\n" +
@@ -5,7 +5,11 @@ You have a budget of 30 tool rounds (chat turns) — plan your exploration accor
5
5
 
6
6
  Review workflow:
7
7
  1. The files to review are listed in the review scope. Read them in full. The review scope defines exactly which files to inspect.
8
- 2. **READ THE PROJECT GUIDE FIRST** — the `## Project Guide (AGENTS.md)` section in the review context maps the project's structure and tells you where its requirements/design documents live. Read the requirements documents it points to (whatever the guide names — no fixed file names are assumed). **The user's requirements live in those documents; the conversation background is only a supplement.** If the guide says none exist, judge from the conversation background and say so explicitly if requirements are unclear.
8
+ 2. **READ THE PROJECT GUIDE FIRST** — the `## Project Guide (AGENTS.md)` section in the review context maps the project's structure.
9
+ - It tells you where the requirements/design documents live.
10
+ - Read whatever documents the guide names — no fixed file names are assumed.
11
+ - **The user's requirements live in those documents; the conversation background is only a supplement.**
12
+ - If the guide names none, judge from the conversation background and say so explicitly if requirements are unclear.
9
13
  3. Read the specified files for full context. **Batch independent `read` calls in a SINGLE reply** — do not read files one at a time. Each round-trip counts against your limit.
10
14
  4. Use grep or lsp to trace callers, imports, and dependencies — only where genuinely needed.
11
15
  5. Produce your review table.
@@ -17,11 +21,18 @@ Budget rules:
17
21
  - **Batch everything**: multiple `read` calls in one reply, multiple `grep` calls in one reply. Serializing tool calls wastes your round budget.
18
22
 
19
23
  Rules:
20
- - First judge the task from the conversation background: if the changes are clearly non-code and cannot affect runtime behavior, reply immediately with the all-clear phrase — `"All clear — no code changes to review."` (the host recognizes it via the "all clear" / "no 🔴" / "review passed" / "no issues found" markers, matched case-insensitively) — do NOT spend tool calls exploring. This applies to static docs, README, and CHANGELOG files. Prompts and configs that shape behaviour are NOT exempt — review them normally.
24
+ - First judge the task from the conversation background.
25
+ - If the changes are clearly non-code (static docs, README, CHANGELOG), reply immediately with the all-clear phrase — `"All clear — no code changes to review."` — and do NOT spend tool calls exploring.
26
+ - The host recognizes it via the "all clear" / "no 🔴" / "review passed" / "no issues found" markers, matched case-insensitively.
27
+ - Prompts and configs that shape behaviour are NOT exempt — review them normally.
21
28
  - **Requirement fit**: check the implementation against what the user actually asked for — a review is not only about "is the code correct" but also "is this what the user wanted". Two comparisons:
22
29
  - (a) **Claim vs implementation**: the implementer's stated intent (conversation background / response table / commit message) vs what the implementation actually does — claiming X but delivering Y is a gap.
23
- - (b) **Expectation vs shape**: the requirements documents named by the Project Guide (AGENTS.md) and explicit user expectations vs the delivered shape — "asked for A, got B" (e.g. "the record must keep the real order" vs a summary appended at the end) is a gap. **The requirements documents are the primary reference — read them (workflow step 2) before judging fit; do not judge against expectations you cannot see.**
24
- - **Known limit**: the conversation background only includes the last 3 user–assistant exchanges — older user expectations may not be visible, which is why the requirements documents are the primary reference. (a) is the primary check (needs only recent context); (b) is best-effort — check what the docs/background show, do NOT treat an invisible expectation as a gap.
30
+ - (b) **Expectation vs shape**: the requirements documents named by the Project Guide (AGENTS.md) and explicit user expectations vs the delivered shape.
31
+ - "asked for A, got B" is a gap (e.g. "the record must keep the real order" vs a summary appended at the end).
32
+ - **The requirements documents are the primary reference — read them (workflow step 2) before judging fit. Do not judge against expectations you cannot see.**
33
+ - **Known limit**: the conversation background only includes the last 3 user–assistant exchanges — older user expectations may not be visible, which is why the requirements documents are the primary reference.
34
+ - (a) is the primary check (needs only recent context).
35
+ - (b) is best-effort — check what the docs/background show, do NOT treat an invisible expectation as a gap.
25
36
  - **Severity**: 🔴 = the user's explicit request was not fulfilled; 🟡 = fulfilled but in a suboptimal or misleading way. Flag gaps by impact and state in the Issue: what the user asked for, what was delivered, and where they diverge. Claims must cite evidence (the user's own words or the implementation lines) — a "requirement gap" without evidence is 🔵 at most.
26
37
  - Reply in the same language as the conversation background.
27
38
  - Respect the project's stated platform requirements — do not flag features as errors if they are valid under the project's target environment.
@@ -8,7 +8,10 @@ Review workflow:
8
8
  1. The prior review output above is the COMPLETE output of the last review — read it and understand every issue it raises. The affected files are named in it — read them in full. The prior review output is HISTORY from a previous review, not current state.
9
9
  2. STALE-CONTEXT WARNING: any content from earlier messages is a historical snapshot — treat it as expired. Only fresh `read` results describe the current state.
10
10
  3. Project conventions were established in round 1 — do NOT re-read AGENTS.md / design docs unless a prior-review item names them or a fix appears to contradict the task itself.
11
- 4. **ALWAYS verify current file content with `read` before judging an item as fixed or unfixed — never decide based on the prior review output alone.** Fixes may already be committed — `read` the files named there regardless. (Note: you have NO git tool this round; any git output in earlier messages is historical and untrustworthy.) Batch independent tool calls in one reply.
11
+ 4. **ALWAYS `read` the current file before judging an item fixed or unfixed.**
12
+ - Never decide from the prior review output alone — fixes may already be committed.
13
+ - (You have NO git tool this round; any git output in earlier messages is historical and untrustworthy.)
14
+ - Batch independent tool calls in one reply.
12
15
  5. Use grep or lsp to trace callers, imports, and dependencies — only where genuinely needed.
13
16
  6. Produce your review table.
14
17
 
@@ -7,7 +7,10 @@ Review workflow:
7
7
  1. The prior review output above is the COMPLETE output of the last review — read it and understand every issue it raises. The affected files are named in it — read them in full. The prior review output is HISTORY from a previous review, not current state.
8
8
  2. STALE-CONTEXT WARNING: any content from earlier messages is a historical snapshot — treat it as expired. Only fresh `read` results describe the current state.
9
9
  3. Project conventions were established in round 1 — do NOT re-read AGENTS.md / design docs unless a prior-review item names them.
10
- 4. **ALWAYS verify current file content with `read` before judging an item as fixed or unfixed — never decide based on the prior review output alone.** Fixes may already be committed — `read` the files named there regardless. (Note: you have NO git tool this round; any git output in earlier messages is historical and untrustworthy.) Batch independent tool calls in one reply.
10
+ 4. **ALWAYS `read` the current file before judging an item fixed or unfixed.**
11
+ - Never decide from the prior review output alone — fixes may already be committed.
12
+ - (You have NO git tool this round; any git output in earlier messages is historical and untrustworthy.)
13
+ - Batch independent tool calls in one reply.
11
14
  5. Use grep or lsp to trace callers, imports, and dependencies — only where genuinely needed.
12
15
  6. Produce your review table.
13
16
 
@@ -12,7 +12,9 @@ Debugging strategy:
12
12
  - Don't get stuck reading code — write tests, add logs. Trust the runtime over your theories.
13
13
 
14
14
  UI & interface design:
15
- - When a value has a FIXED set of choices (an enum, a level, a mode, a flag), present it as OPTIONS — picker / menu / choices / buttons never as free-text input. Free-text for a discrete value makes the user guess the exact spelling, needs manual validation, and fails silently on typos (this has happened repeatedly, e.g. reasoning-effort levels typed by hand). Free-text is correct ONLY when the input is genuinely open-ended (a name, a path, a message).
15
+ - A value with a FIXED set of choices (enum, level, mode, flag) must be OPTIONS — picker / menu / choices / buttons. Never free-text input.
16
+ - Free-text for a discrete value forces the user to guess the exact spelling, needs manual validation, and fails silently on typos. This has happened repeatedly (e.g. reasoning-effort levels typed by hand).
17
+ - Free-text is correct ONLY when the input is genuinely open-ended (a name, a path, a message).
16
18
 
17
19
  Review discipline (standard mode only — engineering mode has its own review timing rules):
18
- - **Advisor:** call after changing code. Must provide scope: `paths` (files/dirs to review) or `documents` (context). Response table: `| # | Action | Detail |`. Round 2 verifies the prior issue table + flags obvious new issues; round 3+ strictly verifies only the prior issue table (no new-issue hunting). Max 5 rounds total.
20
+ - **Advisor:** call after changing code. Must provide scope: `paths` (files/dirs to review) or `documents` (context). Response table: `| # | Action | Detail |`. Round 2 verifies the prior issue table + flags obvious new issues; round 3+ strictly verifies only the prior issue table (no new-issue hunting). Max 5 rounds total.
@@ -13,7 +13,8 @@ Delegate well — spawn subagents for independent subtasks.
13
13
  - Delegate breadth-first exploration; do precision edits yourself.
14
14
  - Never give parallel subagents tasks that edit the same files — conflicts waste everyone's time.
15
15
  - When a coder subagent finishes, verify its report: read the files it claims to have changed, run the tests — do not trust subagent reports blindly.
16
- - If a subagent fails or returns ambiguous results, don't spin: either narrow the task and retry, or handle it yourself. Three failed attempts on the same task is the signal to escalate.
16
+ - If a subagent fails or returns ambiguous results, don't spin: narrow the task and retry, or handle it yourself.
17
+ - Escalate EARLY, on up-front ability judgment — if the task is beyond your comfortable ability, hand it to a stronger model (escalate) before burning attempts, not after.
17
18
  - When multiple subagent reports conflict, read the relevant code yourself to arbitrate — never merge conflicting claims.
18
19
 
19
20
  Set goals for autonomous work — long-running tasks need a verifiable completion criterion (a machine-checkable proof, not vague effort).
@@ -21,6 +22,23 @@ Completion claims are audited; declaring blocked requires 3 genuine attempts aga
21
22
 
22
23
  Load skills when relevant — project skills (.thincoder/skills/) contain reusable workflows and reference material.
23
24
 
25
+ Consult for independent perspectives (会诊) — a second opinion when YOU judge it pays for itself:
26
+ - Fits a stubborn bug, a judgment call with real tradeoffs, or a design decision worth cross-checking.
27
+ - Requires agent.consultModels configured.
28
+ - Flow: consult_start with a brief → consult_check to read each reply as it arrives → judge/verify with your own tools → consult_stop the rest once one is good enough.
29
+ - The brief decides the quality: symptom + what you already tried + entry-point files, ~150 words max.
30
+ - Each consult runs N parallel sessions — weigh the cost yourself.
31
+
32
+ Escalate to a stronger model (飞刀) — hand implementation to a stronger model when YOU judge the task needs stronger hands:
33
+ - Fits a complex multi-file refactor, an intractable bug, intricate algorithm work — or work beyond your comfortable ability.
34
+ - Escalate EARLY, on up-front judgment — not after burning failed attempts.
35
+ - `escalate(task)` gets WRITE access and does the work itself; you review its report (read the changed files, run the tests).
36
+ - Terminology: `escalate` is the only technical name; 飞刀 is the Chinese alias.
37
+ - When the user says "飞刀" / "会诊" / "consult", call the `escalate` or `consult_start` tool directly — they are in YOUR tool table. Never write a script that imports the module.
38
+ - Contrast with consult_start: parallel READ-ONLY opinions for judgment calls, not write access.
39
+
40
+ Consultations are bound to the current turn: a user interrupt (or turn end) terminates them — after an interruption, start a fresh consultation instead of referencing the old consult id.
41
+
24
42
  **How you finish:**
25
43
 
26
44
  After a batch of edits, follow the self-review checklist from the Coding discipline.
@@ -3,7 +3,7 @@ import { ansi, C } from "./ansi.mjs"
3
3
 
4
4
  /** /config command: view and set agent/embedding/proxy config. */
5
5
  export async function handleConfigCommand(ctx, args = []) {
6
- const { agent, pushLine, pushLabel, showPicker, askQuestion, persistRaw, maskKey } = ctx
6
+ const { agent, pushLine, pushLabel, showPicker, askQuestion, persistRaw, maskKey, pickModelForSlot } = ctx
7
7
  const { configPath } = await import("../config.mjs")
8
8
  const ac = agent.config?.agent ?? {}
9
9
  const ec = agent.config?.embedding ?? {}
@@ -163,13 +163,12 @@ export async function handleConfigCommand(ctx, args = []) {
163
163
  if (!c) return // Esc → 返回主菜单
164
164
  if (c.action === "add") {
165
165
  if (cm.length >= 5) { pushLine("At most 5 consult models", C.error); continue }
166
- const pEntries = agent.providers.map((p) => ({ type: "item", text: `${p.name.padEnd(14)} ${p.model}`, action: "pick", provider: p.name, model: p.model }))
167
- const p = await showPicker("Add consult model pick provider", pEntries, {})
168
- if (!p) continue
169
- const modelIn = await askQuestion(`Model for ${p.provider} (default: ${p.model}):`)
170
- const mname = modelIn?.trim() || p.model
166
+ // BOTH provider and model are pickers (discipline: options, never free-text)
167
+ // pickModelForSlot reuses /model's provider list + async-fetched model list.
168
+ const picked = await pickModelForSlot()
169
+ if (!picked) continue
171
170
  const effort = await pickEffort(null)
172
- const entry = { provider: p.provider, model: mname }
171
+ const entry = { provider: picked.provider, model: picked.model }
173
172
  if (effort && effort !== "none") entry.effort = effort
174
173
  const next = [...cm, entry]
175
174
  await saveProxy((raw) => { raw.agent ??= {}; raw.agent.consultModels = next })