thincoder 0.12.2 → 0.12.4

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.
Files changed (85) hide show
  1. package/README.md +29 -6
  2. package/package.json +3 -3
  3. package/src/advisor/history.mjs +112 -0
  4. package/src/advisor/messages.mjs +182 -0
  5. package/src/advisor/repos.mjs +133 -0
  6. package/src/advisor/run.mjs +346 -0
  7. package/src/advisor.mjs +109 -509
  8. package/src/agent/completion.mjs +134 -0
  9. package/src/agent/dispatch.mjs +54 -7
  10. package/src/agent/post-turn.mjs +70 -0
  11. package/src/agent/setup.mjs +95 -6
  12. package/src/agent-tools/advisor.mjs +159 -12
  13. package/src/agent-tools/eng.mjs +64 -0
  14. package/src/agent-tools/subagent.mjs +73 -3
  15. package/src/agent-tools/task.mjs +45 -6
  16. package/src/agent-tools/verify.mjs +18 -0
  17. package/src/agent-tools.mjs +1 -0
  18. package/src/agent.mjs +152 -161
  19. package/src/cli/make-agent.mjs +1 -0
  20. package/src/cli/setup-wizard.mjs +1 -0
  21. package/src/config.mjs +34 -4
  22. package/src/context.mjs +47 -13
  23. package/src/generate-title.mjs +44 -0
  24. package/src/prompts/advisor-design.md +43 -0
  25. package/src/prompts/advisor-round1.md +11 -4
  26. package/src/prompts/advisor-round2.md +12 -7
  27. package/src/prompts/advisor-round3.md +11 -6
  28. package/src/prompts/coder.md +9 -3
  29. package/src/prompts/discipline.md +12 -96
  30. package/src/prompts/eng-coder.md +34 -0
  31. package/src/prompts/engineering-sub.md +12 -0
  32. package/src/prompts/engineering.md +96 -0
  33. package/src/prompts/main.md +1 -1
  34. package/src/prompts/methodology-template.md +39 -0
  35. package/src/prompts/plan.md +2 -2
  36. package/src/prompts/system.md +43 -61
  37. package/src/provider/core.mjs +58 -2
  38. package/src/session.mjs +291 -94
  39. package/src/skills.mjs +48 -15
  40. package/src/tools/apply_patch.md +1 -1
  41. package/src/tools/checklist.mjs +4 -3
  42. package/src/tools/codemode.mjs +23 -11
  43. package/src/tools/delete.md +1 -0
  44. package/src/tools/edit.md +1 -1
  45. package/src/tools/execute.md +5 -0
  46. package/src/tools/file.mjs +4 -0
  47. package/src/tools/git.md +15 -0
  48. package/src/tools/git.mjs +1 -6
  49. package/src/tools/lint.md +8 -0
  50. package/src/tools/linter.mjs +1 -5
  51. package/src/tools/lsp.md +7 -0
  52. package/src/tools/lsp.mjs +8 -9
  53. package/src/tools/patch.mjs +1 -29
  54. package/src/tools/read_image.md +5 -1
  55. package/src/tools/system.mjs +1 -1
  56. package/src/tools/web.mjs +3 -3
  57. package/src/tui/agent-turn.mjs +184 -66
  58. package/src/tui/ansi.mjs +4 -0
  59. package/src/tui/clipboard.mjs +9 -0
  60. package/src/tui/cmd-config.mjs +14 -26
  61. package/src/tui/cmd-eng.mjs +44 -0
  62. package/src/tui/cmd-exit.mjs +1 -1
  63. package/src/tui/cmd-fold.mjs +3 -4
  64. package/src/tui/cmd-model.mjs +11 -6
  65. package/src/tui/cmd-new.mjs +5 -5
  66. package/src/tui/cmd-session.mjs +21 -11
  67. package/src/tui/cmd-think.mjs +1 -0
  68. package/src/tui/index.mjs +20 -9
  69. package/src/tui/key-handler.mjs +177 -9
  70. package/src/tui/layout.mjs +5 -5
  71. package/src/tui/markdown.mjs +52 -0
  72. package/src/tui/pickers.mjs +190 -45
  73. package/src/tui/render-conversation.mjs +54 -13
  74. package/src/tui/render-frame.mjs +39 -12
  75. package/src/tui/render-loop.mjs +2 -1
  76. package/src/tui/render.mjs +13 -7
  77. package/src/tui/slash-commands.mjs +11 -7
  78. package/src/tui/startup.mjs +4 -3
  79. package/src/tui/wizard.mjs +3 -0
  80. package/src/tools/checkpoint.md +0 -15
  81. package/src/tools/git_diff.md +0 -11
  82. package/src/tools/git_log.md +0 -10
  83. package/src/tools/git_status.md +0 -8
  84. package/src/tools/linter.md +0 -13
  85. package/src/tools/syntax_check.md +0 -10
@@ -31,27 +31,29 @@ import { handleHelpCommand } from "./cmd-help.mjs"
31
31
  import { handleUpgradeCommand } from "./cmd-upgrade.mjs"
32
32
  import { handleFoldCommand } from "./cmd-fold.mjs"
33
33
  import { handleUndoCommand } from "./cmd-undo.mjs"
34
+ import { handleEngCommand } from "./cmd-eng.mjs"
34
35
 
35
36
  export const SLASH_COMMANDS = [
36
37
  { name: "/plan", group: "Agent", desc: "toggle plan mode (design first, then implement)" },
37
38
  { name: "/auto", group: "Agent", desc: "toggle auto-approve" },
38
- { name: "/advisor", group: "Agent", desc: "toggle advisor review & select model" },
39
+ { name: "/eng", group: "Agent", desc: "toggle engineering mode strict methodology enforcement" },
40
+ { name: "/advisor", group: "Agent", desc: "advisor settings (toggle, model, thinking, guard)" },
39
41
  { name: "/model", group: "Agent", desc: "select model & manage providers" },
40
42
  { name: "/goal", group: "Agent", desc: "set/view/cancel long-term goal" },
41
43
  { name: "/think", group: "Agent", desc: "thinking mode & reasoning effort" },
42
- { name: "/config", group: "Agent", desc: "config management (embedding / agent)" },
43
44
  { name: "/upgrade", group: "System", desc: "check for updates & upgrade" },
44
- { name: "/fold", group: "System", desc: "toggle result folding on/off" },
45
+ { name: "/config", group: "System", desc: "agent config (embedding, proxy, turns, thresholds)" },
45
46
  { name: "/new", group: "Session", desc: "new session (old one archived to slot)" },
46
47
  { name: "/session", group: "Session", desc: "list/switch archived sessions" },
47
48
  { name: "/clear", group: "Session", desc: "clear screen" },
48
- { name: "/extract", group: "Session", desc: "extract knowledge from session" },
49
+ { name: "/fold", group: "Session", desc: "toggle result folding on/off" },
50
+ { name: "/undo", group: "Session", desc: "undo recent file modifications" },
49
51
  { name: "/init", group: "Project", desc: "generate project AGENTS.md skeleton" },
50
52
  { name: "/skills", group: "Project", desc: "list project skills" },
51
- { name: "/mcp", group: "Project", desc: "manage MCP servers" },
53
+ { name: "/mcp", group: "Project", desc: "MCP servers (add, remove, connect, list)" },
52
54
  { name: "/reindex", group: "Project", desc: "rebuild memory index" },
53
- { name: "/restore", group: "Project", desc: "restore checkpoint" },
54
- { name: "/undo", group: "Project", desc: "undo recent file modifications" },
55
+ { name: "/extract", group: "Project", desc: "extract knowledge from session" },
56
+ { name: "/restore", group: "System", desc: "restore checkpoint" },
55
57
  { name: "/exit", group: "System", desc: "exit" },
56
58
  { name: "/help", group: "System", desc: "this list" },
57
59
  ]
@@ -80,6 +82,7 @@ export const HANDLERS = {
80
82
  "/upgrade": handleUpgradeCommand,
81
83
  "/fold": handleFoldCommand,
82
84
  "/undo": handleUndoCommand,
85
+ "/eng": handleEngCommand,
83
86
  "/extract": handleExtractCommand,
84
87
  "/help": handleHelpCommand,
85
88
  }
@@ -132,6 +135,7 @@ export function createSlashCommands(ctx) {
132
135
  }
133
136
  if (cmd === "/config" && argIndex === 0) return match(["embedkey"])
134
137
  if (cmd === "/goal" && argIndex === 0) return match(["set", "cancel"])
138
+ if (cmd === "/fold" && argIndex === 0) return match(["on", "off"])
135
139
  if (cmd === "/mcp") {
136
140
  if (argIndex === 0) return match(["add", "http", "ws", "stdio", "ai", "remove", "connect", "list"])
137
141
  if (argIndex === 1 && (parts[1]?.toLowerCase() === "remove" || parts[1]?.toLowerCase() === "connect")) return match((agent.config?.mcp?.servers ?? []).map((s) => s.name))
@@ -48,9 +48,10 @@ export function showStartup(ctx) {
48
48
  pushLabel(`── Restored previous session (${opts.restored.history.length} messages); /new for a fresh session ──`, C.warn)
49
49
  }
50
50
 
51
- // Hint when archived slots exist
52
- if (listSlots(agent.cwd).length > 0) {
53
- pushLine("Tip: archived sessions available — /session to view/switch", C.dim)
51
+ // Hint when multiple sessions exist
52
+ const allSlots = listSlots(agent.cwd)
53
+ if (allSlots.length > 1) {
54
+ pushLine(`Tip: ${allSlots.length} sessions — /session to view/switch`, C.dim)
54
55
  }
55
56
  render()
56
57
  }
@@ -135,6 +135,7 @@ export function createWizard(ctx) {
135
135
  if (existing) Object.assign(existing, { baseURL: f.baseURL, model: f.model, apiKey: f.key })
136
136
  else agent.providers.push({ name: f.name, baseURL: f.baseURL, model: f.model, apiKey: f.key })
137
137
  agent.activeProvider = f.name
138
+ agent.activeModel = null
138
139
  agent.provider = { ...agent.providers.find((p) => p.name === f.name) }
139
140
  if (agent.config?.agent?.compactThresholdAuto) {
140
141
  const { resolveCompactThreshold } = await import("../config.mjs")
@@ -143,8 +144,10 @@ export function createWizard(ctx) {
143
144
  await persistRaw((raw) => {
144
145
  raw.providers = agent.providers
145
146
  raw.activeProvider = f.name
147
+ raw.activeModel = undefined // reset to default model
146
148
  })
147
149
  agent.config.activeProvider = f.name
150
+ agent.config.activeModel = null
148
151
  pushLabel(`❯ Setup`, ansi.bold + C.tool)
149
152
  pushLine(`Setup complete: ${f.name} / ${f.model} (saved to config)`, C.tool)
150
153
  // embedding key: if provided, enable vector search; if not, show how to enable later
@@ -1,15 +0,0 @@
1
- List, create, and restore workspace snapshots (checkpoints). Git repositories only.
2
-
3
- Parameters:
4
- - action (required): "list" | "create" | "rewind" | "cat"
5
- - id: snapshot id (required for rewind and cat; optional for list — when given, shows the file tree inside that snapshot)
6
- - path: for rewind — restore only this single file; for cat — read this file's content from the snapshot
7
-
8
- Notes:
9
- - A checkpoint is AUTO-CREATED before every user task. If uncommitted work was destroyed (by you, a git command, or a failed refactor), use action=list then action=rewind with the latest id to recover it
10
- - A checkpoint captures all uncommitted state: tracked-file changes (as a diff) plus copies of untracked files
11
- - Rewind first snapshots the current state, so rewinding is itself reversible
12
- - Rewind AUTO-RECOVERS: if git apply fails (corrupt patch), the pre-rewind state is restored — never lose data
13
- - Create one manually before risky bulk operations
14
- - list now shows which files changed (tracked + untracked); use path to recover individual files selectively
15
- - cat reads a file's content from a snapshot without touching the worktree — useful for inspecting before rewinding
@@ -1,11 +0,0 @@
1
- Show git diff (unified format). Use to see uncommitted changes, staged changes, or diff against a specific ref.
2
-
3
- Parameters:
4
- - staged: Show staged changes (default false, shows working tree diff)
5
- - path: File or directory to diff (default all)
6
- - ref: Compare against a ref (default HEAD)
7
-
8
- Notes:
9
- - Only works inside a git repository
10
- - Output is standard unified diff — LLMs understand this natively
11
- - If no changes, returns "(no changes)"
@@ -1,10 +0,0 @@
1
- Show recent git commit history. Use to understand the project's recent changes, conventions, and pace.
2
-
3
- Parameters:
4
- - count: Number of commits to show (default 10)
5
- - path: File or directory to show history for (default all)
6
- - oneline: Compact one-line-per-commit format (default false)
7
-
8
- Notes:
9
- - Only works inside a git repository
10
- - Output includes hash, author, date, and message
@@ -1,8 +0,0 @@
1
- Show structured git status. Use to understand the current working tree state: what files are staged, modified, untracked, or conflicting.
2
-
3
- Returns categorized lists: staged, unstaged, untracked, conflicts.
4
-
5
- Notes:
6
- - Only works inside a git repository
7
- - Output is categorized for easy parsing by the agent
8
- - No side effects — read-only
@@ -1,13 +0,0 @@
1
- Run the appropriate linter/checker for a file. Auto-detects based on file extension and project config.
2
-
3
- Parameters:
4
- - path (optional): File to check (default: most recently modified file)
5
-
6
- Supported languages:
7
- - .js/.mjs/.cjs/.jsx: eslint (if config present) → node --check (built-in, always available)
8
- - .ts/.tsx/.mts/.cts: eslint → tsc --noEmit (if tsconfig.json present) → node --check
9
- - .py: ruff (if installed)
10
- - .rs: cargo check (if Cargo.toml present)
11
- - .go: go vet
12
-
13
- Does NOT install anything — only uses tools already available in the project.
@@ -1,10 +0,0 @@
1
- Check a JavaScript file for syntax errors using `node --check`. Fast, offline, no dependencies — use after writing or editing .js/.mjs/.cjs files to catch parse errors before running tests.
2
-
3
- Parameters:
4
- - path (required): File path (.js, .mjs, or .cjs)
5
-
6
- Notes:
7
- - Only supports JavaScript-family files; for other languages, run the appropriate checker via `bash`.
8
- - Returns "Syntax OK" or the exact error message with line/column from Node.js.
9
- - This is NOT a test run — it only catches parse errors (missing brackets, invalid syntax), not logic bugs.
10
- - Use this right after `write` or `edit` to fail fast on trivial mistakes before investing time in a full test run.