@thincoder/core 0.9.1
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/abort-provenance.mjs +116 -0
- package/advisor/citations.mjs +139 -0
- package/advisor/compaction.mjs +174 -0
- package/advisor/convergence.mjs +80 -0
- package/advisor/history.mjs +77 -0
- package/advisor/loop.mjs +288 -0
- package/advisor/messages.mjs +299 -0
- package/advisor/notice.mjs +141 -0
- package/advisor/project-context.mjs +197 -0
- package/advisor/repos.mjs +150 -0
- package/advisor/run.mjs +190 -0
- package/advisor/truncate.mjs +57 -0
- package/advisor.mjs +281 -0
- package/agent/child-marks.mjs +24 -0
- package/agent/completion.mjs +145 -0
- package/agent/dispatch.mjs +493 -0
- package/agent/family-tools.mjs +174 -0
- package/agent/helpers.mjs +412 -0
- package/agent/post-turn.mjs +70 -0
- package/agent/record-results.mjs +174 -0
- package/agent/relay-prefix.mjs +39 -0
- package/agent/run-stages.mjs +244 -0
- package/agent/setup-reminders.mjs +199 -0
- package/agent/setup.mjs +234 -0
- package/agent/spawn-child.mjs +258 -0
- package/agent/suspension.mjs +240 -0
- package/agent/write-gate.mjs +87 -0
- package/agent-tools/advisor-async.mjs +481 -0
- package/agent-tools/advisor-settle.mjs +240 -0
- package/agent-tools/advisor.mjs +280 -0
- package/agent-tools/async-discard.mjs +143 -0
- package/agent-tools/async-settle.mjs +299 -0
- package/agent-tools/batch-segment.mjs +265 -0
- package/agent-tools/child-permission.mjs +45 -0
- package/agent-tools/consult.mjs +471 -0
- package/agent-tools/design-token.mjs +117 -0
- package/agent-tools/digest-budget.mjs +76 -0
- package/agent-tools/eng.mjs +102 -0
- package/agent-tools/escalate-async.mjs +302 -0
- package/agent-tools/goal.mjs +119 -0
- package/agent-tools/panel-blocks.mjs +24 -0
- package/agent-tools/parent-channel.mjs +231 -0
- package/agent-tools/plan.mjs +86 -0
- package/agent-tools/read-history.mjs +309 -0
- package/agent-tools/recent-changes.mjs +24 -0
- package/agent-tools/review-facts.mjs +31 -0
- package/agent-tools/settings.mjs +268 -0
- package/agent-tools/skill.mjs +63 -0
- package/agent-tools/spawn-gates.mjs +109 -0
- package/agent-tools/subagent-actions.mjs +496 -0
- package/agent-tools/subagent-async.mjs +456 -0
- package/agent-tools/subagent-panel.mjs +160 -0
- package/agent-tools/subagent-run.mjs +208 -0
- package/agent-tools/subagent-scheduler.mjs +446 -0
- package/agent-tools/subagent-spawn.mjs +478 -0
- package/agent-tools/subagent.mjs +419 -0
- package/agent-tools/task.mjs +87 -0
- package/agent-tools/timer.mjs +46 -0
- package/agent-tools/verify.mjs +295 -0
- package/agent-tools.mjs +23 -0
- package/agent.mjs +430 -0
- package/auto-think.mjs +115 -0
- package/compress-form.mjs +24 -0
- package/config-io.mjs +277 -0
- package/config-migrate.mjs +178 -0
- package/config-presets.mjs +49 -0
- package/config.mjs +419 -0
- package/context.mjs +495 -0
- package/conventions.mjs +223 -0
- package/embedding.mjs +120 -0
- package/escape.mjs +152 -0
- package/expand-home.mjs +16 -0
- package/explore-distill.mjs +152 -0
- package/generate-title.mjs +123 -0
- package/git/checkpoint.mjs +448 -0
- package/git/gitmem.mjs +100 -0
- package/history-window.mjs +179 -0
- package/hooks.mjs +108 -0
- package/i18n.mjs +106 -0
- package/index-bin.mjs +48 -0
- package/index-discover.mjs +176 -0
- package/ledger-cmd.mjs +209 -0
- package/ledger-db.mjs +86 -0
- package/ledger-surface.mjs +76 -0
- package/ledger.mjs +202 -0
- package/log.mjs +195 -0
- package/manifest.mjs +338 -0
- package/markdown.mjs +106 -0
- package/mcp/helpers.mjs +51 -0
- package/mcp/transport-http.mjs +248 -0
- package/mcp/transport-stdio.mjs +140 -0
- package/mcp/transport-ws.mjs +122 -0
- package/mcp.mjs +295 -0
- package/memory/code-index.mjs +219 -0
- package/memory/code-sync.mjs +427 -0
- package/memory/core.mjs +318 -0
- package/memory/delete.mjs +242 -0
- package/memory/docs.mjs +431 -0
- package/memory/file-walk.mjs +109 -0
- package/memory/origin.mjs +24 -0
- package/memory/scan.mjs +177 -0
- package/memory/schema.mjs +460 -0
- package/memory.mjs +21 -0
- package/model-ref.mjs +66 -0
- package/model-specs.mjs +277 -0
- package/package.json +32 -0
- package/peer-domains.mjs +265 -0
- package/peer-instances.mjs +178 -0
- package/permission.mjs +79 -0
- package/process-probe.mjs +315 -0
- package/prompt-files.mjs +113 -0
- package/prompt-overlays.mjs +78 -0
- package/prompts/advisor-design.md +43 -0
- package/prompts/advisor-round1.md +41 -0
- package/prompts/advisor-round2.md +46 -0
- package/prompts/advisor-round3.md +42 -0
- package/prompts/common.md +158 -0
- package/prompts/consult-base.md +19 -0
- package/prompts/discipline-engineering.md +123 -0
- package/prompts/discipline-normal.md +206 -0
- package/prompts/persona-coder.md +21 -0
- package/prompts/persona-eng-coder.md +41 -0
- package/prompts/persona-eng-designer.md +80 -0
- package/prompts/persona-engineering.md +160 -0
- package/prompts/persona-explore.md +15 -0
- package/prompts/persona-normal.md +35 -0
- package/prompts/persona-plan.md +27 -0
- package/provider/anthropic.mjs +225 -0
- package/provider/core.mjs +491 -0
- package/provider/errors.mjs +101 -0
- package/provider/google.mjs +257 -0
- package/provider/index.mjs +7 -0
- package/provider/list-models.mjs +163 -0
- package/provider/normalize.mjs +81 -0
- package/provider/rate.mjs +168 -0
- package/provider/responses.mjs +495 -0
- package/provider/retry.mjs +88 -0
- package/provider/sse.mjs +264 -0
- package/provider/wait-status.mjs +59 -0
- package/proxy.mjs +274 -0
- package/rules.mjs +53 -0
- package/session-gc.mjs +248 -0
- package/session-guard.mjs +59 -0
- package/session-lifecycle.mjs +305 -0
- package/session-migrate.mjs +48 -0
- package/session-rename.mjs +38 -0
- package/session-segments.mjs +99 -0
- package/session-slot-write.mjs +168 -0
- package/session-slots-manifest.mjs +264 -0
- package/session-slots.mjs +298 -0
- package/session-store.mjs +441 -0
- package/session.mjs +244 -0
- package/skills.mjs +234 -0
- package/text-budget.mjs +79 -0
- package/token-ttl.mjs +285 -0
- package/tool-docs/apply_patch.md +15 -0
- package/tool-docs/bash.md +38 -0
- package/tool-docs/delete.md +13 -0
- package/tool-docs/edit.md +30 -0
- package/tool-docs/execute.md +21 -0
- package/tool-docs/fetch.md +12 -0
- package/tool-docs/file_ops.md +17 -0
- package/tool-docs/get_current_time.md +8 -0
- package/tool-docs/git.md +54 -0
- package/tool-docs/glob.md +11 -0
- package/tool-docs/grep.md +19 -0
- package/tool-docs/hashline_edit.md +14 -0
- package/tool-docs/insert_after.md +15 -0
- package/tool-docs/lint.md +10 -0
- package/tool-docs/ls.md +12 -0
- package/tool-docs/lsp.md +10 -0
- package/tool-docs/process.md +10 -0
- package/tool-docs/question.md +16 -0
- package/tool-docs/read.md +20 -0
- package/tool-docs/read_image.md +8 -0
- package/tool-docs/tree.md +14 -0
- package/tool-docs/wait_for.md +22 -0
- package/tool-docs/websearch.md +16 -0
- package/tool-docs/write.md +11 -0
- package/tools/bash.mjs +276 -0
- package/tools/edit-batch.mjs +204 -0
- package/tools/edit-diff.mjs +388 -0
- package/tools/exec-run.mjs +43 -0
- package/tools/execute.mjs +243 -0
- package/tools/file.mjs +464 -0
- package/tools/git-checkpoint.mjs +143 -0
- package/tools/git-ext.mjs +173 -0
- package/tools/git.mjs +415 -0
- package/tools/glob-dialect.mjs +130 -0
- package/tools/index.mjs +76 -0
- package/tools/linter.mjs +120 -0
- package/tools/lsp.mjs +335 -0
- package/tools/ops.mjs +293 -0
- package/tools/patch.mjs +290 -0
- package/tools/question.mjs +26 -0
- package/tools/repomap.mjs +314 -0
- package/tools/search.mjs +248 -0
- package/tools/shared.mjs +467 -0
- package/tools/tree.mjs +81 -0
- package/tools/web.mjs +224 -0
- package/tools/write-path.mjs +191 -0
- package/traces/trace-store.mjs +303 -0
- package/undo-stack.mjs +47 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Edit a file as a patch — targeted by content or by line number. Two targeting forms (mutually exclusive — use one): ① line-based: `line: N` replaces that single line, `startLine: N, endLine: M` replaces the inclusive 1-based line range — no old_string needed when you know the line number; give new_string to replace, or OMIT new_string to delete the line/range; ② content-based: old_string is the current content of the region to change (must match exactly once); new_string is the desired result of that region. old_string matching is tolerant: exact match first, then a unique whitespace-only variant, then fuzzy match (unique window with ≥90% of lines identical after trimming, tab→space indent and quote normalization — ASCII single, curly single/double and backtick quotes all unify to straight double quotes). Lines shared by old/new are kept; lines only in new_string take their position relative to the shared lines (LCS order); lines only in old_string are deleted — a replacement never leaves old lines behind (zero overlap → old lines are replaced by new_string, not kept). A unique single-line old_string paired with a single-line new_string replaces that exact line in place (line count unchanged). To add a new line without removing anything use insert_after. replace_all keeps literal replacement of every occurrence — the diff rules do not apply.
|
|
2
|
+
|
|
3
|
+
**Routing — pick the right edit tool:**
|
|
4
|
+
- Delete a line/range by number → omit new_string: edit with `line: N` / `startLine: N, endLine: M`
|
|
5
|
+
- Line numbers fresh (just read) → `line`/`startLine`/`endLine` targeting — precise, no content copy needed
|
|
6
|
+
- Line numbers may have drifted / content has whitespace-encoding noise → `hashline_edit` (content-hash addressing — position-independent)
|
|
7
|
+
- Add a line/entry after a known line → insert_after
|
|
8
|
+
- Same change across multiple files → apply_patch
|
|
9
|
+
- Rewrite an entire file → write
|
|
10
|
+
- Rename a symbol project-wide → `lsp` or `grep` first to map every caller
|
|
11
|
+
|
|
12
|
+
**Batch multiple edits into ONE call via the `edits` array** (preferred over N single edit calls): multiple changes to the SAME file go into one `edits` array (entries are applied serially, each based on the previous one's result); independent changes across MULTIPLE files also go into the same `edits` array — one call, atomic (any failure writes nothing). A batched call is one permission ask, one undo unit, and one turn instead of N. A top-level path may accompany the array — entries without their own path inherit it (entry paths override).
|
|
13
|
+
|
|
14
|
+
Parameters:
|
|
15
|
+
- path: File path (single form: required; with the edits array: optional — the default for entries without their own path)
|
|
16
|
+
- old_string: Current content of the region to change (must match exactly once — tolerant matching: exact → whitespace-only variant → fuzzy ≥90% line-equal). Mutually exclusive with line/startLine/endLine — required unless line targeting is used
|
|
17
|
+
- new_string: Desired result of the region — diffed against old_string (shared lines kept; old-only lines deleted — a replacement never leaves old lines behind). Content-based edits: required — an explicit empty string is an error (protects against forgetting it). Line-based edits (line/startLine/endLine): give it to replace the line/range, or OMIT it to delete — an explicit empty string is NOT deletion (error — omit instead)
|
|
18
|
+
- line: 1-based line number — replace that single line with new_string, or OMIT new_string to DELETE it (mutually exclusive with old_string and startLine/endLine)
|
|
19
|
+
- startLine / endLine: 1-based inclusive line range to replace with new_string (given together; mutually exclusive with old_string) — OMIT new_string to DELETE the range
|
|
20
|
+
- replace_all: Replace all occurrences instead of just one (default false; content-based targeting only)
|
|
21
|
+
- edits: Array of {path?, old_string?, new_string?, line?, startLine?, endLine?, replace_all?} entries — batch form; mutually exclusive with top-level old_string/new_string/line/startLine/endLine — a top-level path is allowed and applies to entries without their own path
|
|
22
|
+
|
|
23
|
+
Notes:
|
|
24
|
+
- Prefer this over write for targeted edits — it's safer and keeps changes targeted
|
|
25
|
+
- If old_string matches zero times (even fuzzy): error. If it matches multiple times without replace_all: error — add more surrounding context to make it unique
|
|
26
|
+
- Content-based edits: new_string empty is an explicit error (protects against forgetting it).
|
|
27
|
+
- Line-based edits: OMIT new_string to delete the line/range — deleting by number is an explicit, bounded intent.
|
|
28
|
+
- Returns `Edited <path>: replaced N occurrence(s)` (delete-mode: `Deleted line N of <path>` / `Deleted lines N-M of <path>`) + git diff + syntax-check note + context block (L..-L..).
|
|
29
|
+
- Never fabricate the old_string — copy it verbatim from the actual file using read first
|
|
30
|
+
- use the most recent read of the file as the source of old_string / line numbers / hashes — re-read after the file changed
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Execute JavaScript — either inline `code` or a `scriptFile`. Runs in a real child `node` process — a pure node ESM environment: top-level `await` and dynamic `import()` are available, no globals are injected. File reads/writes/searches belong to the dedicated read/ls/glob/grep/write/edit tools — not to execute. If a script genuinely needs fs/path, `import` the `node:` module inside the code (one explicit import line).
|
|
2
|
+
|
|
3
|
+
**Route to execute instead of bash:**
|
|
4
|
+
- `node -e "…"` → execute (inline code; top-level await + import() + console all work)
|
|
5
|
+
- `node <script.mjs>` → execute with scriptFile (runs the file in a child node process)
|
|
6
|
+
- `node --test <file>` / `node --check <file>` → execute with scriptFile + nodeArgs
|
|
7
|
+
|
|
8
|
+
Parameters:
|
|
9
|
+
- code: JavaScript to run inline. Top-level `await` and `import('./x.mjs')` are supported. Pure node ESM — no preloaded helpers; import `node:fs`/`node:path` etc. yourself when needed. File reads/writes go through the dedicated read/ls/glob/grep/write/edit tools. Use this OR scriptFile.
|
|
10
|
+
- scriptFile: run a .mjs/.js file with node (self-contained — the file imports what it needs). Path relative to workdir — no directory restriction. Use this OR code.
|
|
11
|
+
- nodeArgs: (scriptFile) extra node flags before the script, e.g. ["--test"], ["--check"]. Eval-like flags (--eval/--input-type/--inspect) are rejected.
|
|
12
|
+
- workdir: run in this directory (relative to cwd — no directory restriction; default cwd)
|
|
13
|
+
- filter: optional — only return output lines matching this regex (case-insensitive)
|
|
14
|
+
- timeoutMs: Timeout in milliseconds (default 30000, max 600000 — covers `node --test` suites and package scripts)
|
|
15
|
+
|
|
16
|
+
Notes:
|
|
17
|
+
- `console.log(...)` prints to the result; objects are JSON-stringified where needed.
|
|
18
|
+
- A non-zero exit / thrown exception returns the stderr (error + stack) as the result.
|
|
19
|
+
- Output is capped at ~50KB; when a script overruns it, an explicit `[output truncated]` marker is appended — print large results in chunks, or have the script write them to a file (node:fs) and read that file back with the `read` tool.
|
|
20
|
+
- Use `write`/`edit`/`apply_patch` for source edits. Still use `bash` for package-manager/CLI subprocesses (`npm test`/`npm publish`/`vsce`), servers, and interactive/TTY programs — execute covers in-process JS and `node <script>`/`node --test`/`node --check`, not arbitrary CLI or long-running programs.
|
|
21
|
+
- Irreversibility: it runs with full filesystem access and no automatic undo — script side effects are permanent; checkpoint (git) before risky bulk operations.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Fetch a URL and return its content as text. HTML pages are stripped to readable text. Use after websearch to read full documents.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- url (required): http/https URL
|
|
5
|
+
- proxy: http://host:port explicit proxy (optional) — use ONLY when passed; no proxy = direct. config.json proxy is NOT auto-applied (2026-08-31 ruling); pick per target (github/foreign sites need a proxy, gitee/domestic don't)
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
- Follows redirects automatically
|
|
9
|
+
- Timeout: 15 seconds
|
|
10
|
+
- HTML pages are converted to plain text (scripts, styles, navigation stripped)
|
|
11
|
+
- Non-HTML responses are returned as-is (truncated at ~50000 chars)
|
|
12
|
+
- Proxy support: set `"proxy": {"uri": "http://host:port", "web": true}` in config.json or `HTTPS_PROXY` env var
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Move, copy, or rename a file/directory.
|
|
2
|
+
|
|
3
|
+
**Route to file_ops instead of bash:**
|
|
4
|
+
- `mv a b` → file_ops action=move
|
|
5
|
+
- `cp a b` / `copy` → file_ops action=copy
|
|
6
|
+
- `ren a b` / `rename a b` → file_ops action=rename
|
|
7
|
+
|
|
8
|
+
Parameters:
|
|
9
|
+
- action (required): move | copy | rename
|
|
10
|
+
- source (required): source path, relative to cwd or absolute
|
|
11
|
+
- dest (required): destination path
|
|
12
|
+
|
|
13
|
+
Notes:
|
|
14
|
+
- Paths resolve relative to cwd — no directory restriction (same boundary as bash; the approval gate is the guard).
|
|
15
|
+
- `dest` is overwritten if it already exists. `copy` is recursive for directories.
|
|
16
|
+
- To create a directory, use `write` (creates parent dirs) or `bash mkdir`.
|
|
17
|
+
- Returns `Moved|Copied|Renamed <source> -> <dest>` or `Error: ...` (same-path and missing-path errors).
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Get the current date, time, weekday, and timezone.
|
|
2
|
+
|
|
3
|
+
**Route to get_current_time instead of bash:**
|
|
4
|
+
- `date` / `time` → get_current_time
|
|
5
|
+
|
|
6
|
+
Use it whenever a task depends on the current time or date (deadlines, freshness, timestamps) rather than shelling out.
|
|
7
|
+
|
|
8
|
+
Returns `Date` / `Timezone` / `Weekday` / `Local` lines (UTC + local timezone).
|
package/tool-docs/git.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
Run a git command. Only works inside a git repository.
|
|
2
|
+
|
|
3
|
+
**Route to git instead of bash:** `git status`→status, `git log`→log, `git diff`→diff, `git show`→show, `git add`→add, `git rm`→rm, `git commit -m`→commit, `git push <remote> <branch> <tag>`→push, `git tag`→tag, `git branch`→branch, `git checkout`→checkout, `git restore`→restore, `git stash`→stash, `git fetch/pull`→fetch/pull, `git reset`→reset, `git revert`→revert, `git merge`→merge, `git cherry-pick`→cherry-pick, `git ls-remote`→ls-remote, `git clone`→clone, `git init`→init, `git rebase`→rebase, `git remote`→remote, `git clean`→clean, `git switch`→switch, `git apply`→apply, `git worktree`→worktree, `git archive`→archive, `git blame`→blame, `git mv`→mv.
|
|
4
|
+
|
|
5
|
+
- action='diff': unified diff — what changed since last commit. staged=true for staged-only; ref=<ref> to compare a commit/branch; path=<dir> to scope.
|
|
6
|
+
- action='status': working tree state — staged / unstaged / untracked / conflicts, categorized.
|
|
7
|
+
- action='log': recent commits. count (default 10), oneline=true compact, path=<file> for one file's history.
|
|
8
|
+
- action='show': a commit's details (--stat). ref=<ref> (default HEAD).
|
|
9
|
+
- action='add': stage files — path=<file> (granular) or all changes when path omitted.
|
|
10
|
+
- action='commit': commit. message required; path=<file> → `git commit --only <paths>` — commits those files' working-tree content only (other staged batches are NOT mixed in — atomic); without path → add -A + full commit. New (untracked) files aren't committable by path alone — `git add` them first (staging extra is safe: --only still commits only the listed files).
|
|
11
|
+
- action='rm': untrack a file/dir (git rm --cached, kept on disk). path required.
|
|
12
|
+
- action='push'/'fetch'/'pull': sync with remote. remote=<origin>, ref=<branch or tag> (space-separated for multiple), tags=true for --tags.
|
|
13
|
+
- action='tag': manage tags. tagAction=list (optional filter) / create (name, optional ref) / delete (name; snapshots first).
|
|
14
|
+
- action='branch': manage branches. branchAction=list / create (name, optional ref) / switch (name) / delete (name; snapshots first).
|
|
15
|
+
- action='checkout': switch to ref=<branch/commit>, or restore a file path=<file> (discards its working-tree changes; snapshots first).
|
|
16
|
+
- action='restore': restore a file from index/HEAD. path required; staged=true restores the staged copy; snapshots first.
|
|
17
|
+
- action='stash': manage the stash. stashAction=list / push (message) / pop (snapshots first).
|
|
18
|
+
- action='reset': reset to ref (default HEAD). mode=soft/mixed/hard; hard snapshots the tree first (drops working-tree changes).
|
|
19
|
+
- action='revert': revert a commit (safe). ref=<commit> (default HEAD).
|
|
20
|
+
- action='merge': merge ref=<branch/commit>; conflicts reported for you to resolve.
|
|
21
|
+
- action='cherry-pick': cherry-pick ref=<commit>.
|
|
22
|
+
- action='ls-remote': light remote-ref check — which refs a remote has (read-only, network). remote=<origin>, ref=<branch/tag> optional, config for proxy.
|
|
23
|
+
- action='clone': clone a repo. remote required (URL or local path); path optional (target dir).
|
|
24
|
+
- action='init': init a repo in the current (work)dir.
|
|
25
|
+
- action='rebase': rebase onto ref. rebaseAction=start (ref required) / abort / continue(操作前自动快照,checkpointAction=rewind 恢复).
|
|
26
|
+
- action='remote': manage remotes. remoteAction=list / add / remove / set-url; remoteUrl for add/set-url.
|
|
27
|
+
- action='clean': remove untracked files/dirs. dryRun for -n preview(真删除操作前自动快照,checkpointAction=rewind 恢复).
|
|
28
|
+
- action='switch': switch branch. name required; create for -c (new branch).
|
|
29
|
+
- action='apply': apply a patch. path required (patch file).
|
|
30
|
+
- action='worktree': manage worktrees. worktreeAction=list / add (path, ref) / remove (path).
|
|
31
|
+
- action='archive': write a tar of ref (default HEAD). path required (output file).
|
|
32
|
+
- action='blame': file blame. path required.
|
|
33
|
+
- action='mv': rename/move. path (source) + dest required.
|
|
34
|
+
- action='checkpoint': git snapshots. checkpointAction=list/create/rewind/cat/versions; checkpointId required for rewind/cat.
|
|
35
|
+
- Destructive ops (checkout -- path / restore / reset --hard / stash pop / branch|tag delete / clean / rebase) auto-snapshot first — restore via checkpointAction=rewind.
|
|
36
|
+
|
|
37
|
+
Parameters:
|
|
38
|
+
- action (required): diff / status / log / show / checkpoint / add / rm / commit / push / tag / branch / checkout / restore / stash / fetch / pull / reset / revert / merge / cherry-pick / ls-remote / clone / init / rebase / remote / clean / switch / apply / worktree / archive / blame / mv
|
|
39
|
+
- workdir: run git in this subdirectory (monorepo / multi-repo). Path relative to cwd — no directory restriction. Default: the discovered project repo root(缺省 = 发现的项目仓根;显式 workdir 优先)
|
|
40
|
+
- config: (network actions push/fetch/pull/ls-remote/clone) git -c overrides, e.g. ["http.proxy=http://10.2.2.112:3128"] for blocked remotes
|
|
41
|
+
- path: (diff/log/add/commit/checkout/restore/rm/apply/archive/blame/mv/worktree) file or directory to scope / stage / restore
|
|
42
|
+
- ref: (show/diff/checkout/reset/revert/merge/cherry-pick/tag:create/branch:create/rebase/worktree:add/archive) commit/branch/ref; (push/pull/fetch) the branch or tag (space-separated for multiple)
|
|
43
|
+
- name: (branch/tag/switch) the branch or tag name
|
|
44
|
+
- remote: (push/fetch/pull/remote/clone) remote name (e.g. origin) or URL; default: current upstream
|
|
45
|
+
- tags: (push) also push all tags (--tags)
|
|
46
|
+
- staged: (diff) staged changes; (restore) the staged copy
|
|
47
|
+
- count: (log) number of commits (default 10)
|
|
48
|
+
- oneline: (log) one-line-per-commit
|
|
49
|
+
- message: (commit) commit message — required; (stash:push) stash message
|
|
50
|
+
- mode: (reset) soft / mixed / hard — hard snapshots the tree first + needs confirmation
|
|
51
|
+
- tagAction: (tag) list / create / delete — branchAction: (branch) list / create / delete / switch — stashAction: (stash) push / pop / list
|
|
52
|
+
- filter: (read-only actions) keep only output lines matching this regex (case-insensitive)
|
|
53
|
+
- checkpointAction: (checkpoint) list / create / rewind / cat / versions — checkpointId: snapshot id (rewind/cat)
|
|
54
|
+
- remoteAction: (remote) list / add / remove / set-url — remoteUrl: (remote add/set-url) URL — rebaseAction: (rebase) start / abort / continue — dryRun: (clean) -n preview — create: (switch) -c — dest: (mv) destination — worktreeAction: (worktree) list / add / remove
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Find files by glob pattern. Returns matching paths (relative to the search path), sorted, capped at 1000. Use this to discover file structure; use grep to search file contents.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- pattern (required): Glob pattern — supports `**` (recursive), `**/`, `*` (within a segment), `?` (single char), `[..]` character classes, and `{a,b}` brace expansion (e.g. `**/*.{js,txt}` matches .js and .txt files at any depth). Space-separated multiple patterns with a leading `!` are EXCLUSIONS — `**/*.js !test/**` matches .js files except those under test/. Pattern matching is relative to `path`. A pattern containing a literal space is fine on its own (spaces only separate patterns when a `!` exclusion is present). An expression splits ONLY before `!`-exclusion tokens — to match several extensions in one include, use a `{a,b}` group (e.g. `**/*.{js,md}`); adjacent space-separated includes are not a supported form.
|
|
5
|
+
- path: Directory to search in (default cwd)
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
- Invalid glob syntax is an EXPLICIT error — never a silent no-match. Unsupported extglob dialects (`?(x)`/`@(a|b)`/`+(x)`) and malformed braces (empty `{}`, unclosed `{`, nested `{a,{b,c}}`) return `glob error: ...` — use `{a,b}` or a space-separated `!exclude` pattern instead.
|
|
9
|
+
- Skips node_modules, .git, dist, build, .turbo, coverage
|
|
10
|
+
- Results capped at 1000 matches
|
|
11
|
+
- Prefer patterns with a literal anchor (extension or subdirectory) over bare wildcards
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Search file contents with a regex. Returns matching lines as path:line: content.
|
|
2
|
+
|
|
3
|
+
**Route to grep instead of bash:** `findstr /c:"pat" file` / `grep -rn pat .` → grep. Searching file contents is a read — never shell out for it.
|
|
4
|
+
|
|
5
|
+
Parameters:
|
|
6
|
+
- pattern (required): JavaScript regular expression, or a literal string when literal=true
|
|
7
|
+
- path: Directory or file to search (default cwd)
|
|
8
|
+
- glob: Only search files matching this glob — supports `**`, `*`, `?`, `[..]`, `{a,b}` braces and space-separated exclusion (`"**/*.js !test/**"` = .js files outside test/); e.g. '*.mjs'
|
|
9
|
+
- ignoreCase: Case-insensitive match (default false)
|
|
10
|
+
- literal: Literal string match — no regex interpretation (default false; use for strings with `. \` etc.)
|
|
11
|
+
- before: Lines of context to show before each match (grep -B). Default 0
|
|
12
|
+
- after: Lines of context to show after each match (grep -A). Default 0
|
|
13
|
+
|
|
14
|
+
Notes:
|
|
15
|
+
- Skips node_modules, .git, dist, build, .turbo, coverage
|
|
16
|
+
- Results capped at 200 matches
|
|
17
|
+
- Binary/unreadable files are silently skipped
|
|
18
|
+
- Use this to find usages, definitions, patterns; use glob to find files by name
|
|
19
|
+
- With before/after: matching lines use `:` separator, context lines use `-` (like ripgrep); overlapping context ranges in the same file are merged and de-duplicated
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Edit a file using content-hash addressing instead of string matching. More reliable than edit when whitespace or encoding varies — hashes are computed from exact line bytes on disk.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): File path
|
|
5
|
+
- old_hashes (required): Array of SHA256 hashes (12-char hex) identifying lines to replace. Read the file with hashes=true first to obtain these hashes. For a single line, pass [hash]; for a contiguous block, pass [hash1, hash2, ...] in order.
|
|
6
|
+
- new_content (required): Replacement text (multi-line ok, \n separated)
|
|
7
|
+
|
|
8
|
+
Notes:
|
|
9
|
+
- The hash of each line is computed as SHA256(line_content).slice(0, 12) — the same algorithm used by read(hashes=true)
|
|
10
|
+
- Hashes are position-independent: they identify lines by content, not by line number (which changes after edits)
|
|
11
|
+
- If the hash sequence isn't found, the error will include the current file's hashes so you can retry with corrected values
|
|
12
|
+
- Prefer this over edit when: 1) the file may have mixed whitespace/encoding, 2) you want to edit a block of lines with a single call
|
|
13
|
+
- Replacement text replaces the lines identified by the hashes — content not present in new_content is deleted. For a new line after a known line, use insert_after. For a single simple string swap, use edit.
|
|
14
|
+
- use the most recent read of the file as the source of old_string / line numbers / hashes — re-read after the file changed
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Insert a line of text after a specific line in a file. Safer than `edit` for adding new content — no need to copy surrounding context for exact string matching.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): File path
|
|
5
|
+
- content (required): Text to insert (will be placed as a new line after the target line)
|
|
6
|
+
- after_line: Line number to insert after (1-based). Preferred when you know the exact line number from `read`.
|
|
7
|
+
- after_regex: JavaScript regex to find the line to insert after. Must match exactly one line; if it matches multiple, the tool errors and shows the matching line numbers.
|
|
8
|
+
|
|
9
|
+
Notes:
|
|
10
|
+
- Either after_line or after_regex is required; if both are given, after_line wins.
|
|
11
|
+
- Use this instead of edit when you're adding a new line — a checklist item, a doc heading, a line of prose, a function, an import, or a block — no need to fabricate surrounding context for exact matching.
|
|
12
|
+
- The inserted content becomes its own line; it's equivalent to `lines.splice(targetLine, 0, content)`.
|
|
13
|
+
- Returns a diff of the change.
|
|
14
|
+
- **Read-before-insert guard**: if the file was modified by any write tool (write/edit/insert_after/hashline_edit/apply_patch/delete) since your last `read`, this tool REFUSES with an error — line numbers may be stale. Read the file again, then retry. This prevents after_line from silently landing at a drifted position.
|
|
15
|
+
- use the most recent read of the file as the source of old_string / line numbers / hashes — re-read after the file changed
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Run the appropriate linter/checker for a file. Auto-detects based on file extension and project config.
|
|
2
|
+
Without 'full', runs a fast node --check (JS/TS syntax only, catches parse errors in milliseconds).
|
|
3
|
+
With 'full', runs the language-aware cascade: tsc –noEmit (TS); ruff (Python); cargo check (Rust); go vet (Go). JS/JSX files fall back to node --check; TS uses tsc --noEmit (requires tsconfig.json).
|
|
4
|
+
Use the fast default after every write/edit; use 'full' before declaring a task complete.
|
|
5
|
+
|
|
6
|
+
Returns the check result: `Syntax OK: <path>` / `Syntax error in <path>: <message>` (or the language checker's output — `✓ <checker>: no issues` or `✗ <checker>: <failure text>`).
|
|
7
|
+
|
|
8
|
+
Parameters:
|
|
9
|
+
- path: File to check (default: most recently modified file)
|
|
10
|
+
- full: Run the full language-aware cascade instead of just node --check (default false)
|
package/tool-docs/ls.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
List directory contents with type, size, and modification time. Directories listed first. Use to see what a directory contains (glob only matches files).
|
|
2
|
+
|
|
3
|
+
**Route to ls instead of bash:** `dir /b` / `ls` / `dir` → ls. Listing a directory is a read — never shell out for it.
|
|
4
|
+
|
|
5
|
+
Parameters:
|
|
6
|
+
- path: Directory path (default cwd)
|
|
7
|
+
- filter: Only list entries matching this glob (e.g. '*.mjs', '*test*') — a wildcard filter, not a full listing
|
|
8
|
+
|
|
9
|
+
Notes:
|
|
10
|
+
- Shows first 500 entries
|
|
11
|
+
- Directories are suffixed with `/` and listed before files
|
|
12
|
+
- Use this for a quick overview; use glob when you have a specific file pattern in mind
|
package/tool-docs/lsp.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LSP code intelligence: go to definition, find references, hover info, document symbols, diagnostics. Use this to understand code structure without grep-guessing function locations or type shapes. Find files with glob / repo_outline — use lsp for definition / references / diagnostics
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- subcommand (required): LSP operation — "definition" | "references" | "hover" | "symbols" | "diagnostics"
|
|
5
|
+
- uri (required): Target file path (relative to project root)
|
|
6
|
+
- line: 1-based line number (for definition/references/hover)
|
|
7
|
+
- character: 1-based character offset (for definition/references/hover)
|
|
8
|
+
|
|
9
|
+
Notes:
|
|
10
|
+
- Returns the requested LSP result: definition location, references, hover info, document symbols, or diagnostics — or an error message.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
List running processes, optionally filtered by name. Returns process name / PID / memory.
|
|
2
|
+
|
|
3
|
+
**Route to process instead of bash:**
|
|
4
|
+
- `tasklist` (Windows) / `ps aux` (POSIX) → process
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
- name (optional): substring filter (case-insensitive), e.g. "node", "python"
|
|
8
|
+
|
|
9
|
+
Notes:
|
|
10
|
+
- List-only. To kill a process, use `bash taskkill /PID <pid> /F` (Windows) or `bash kill <pid>` — and confirm with the user first.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Ask the user a question and wait for their response. Use when the task is ambiguous, you need a design decision, or you're stuck and need human judgment.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- question (required): The question to ask the user
|
|
5
|
+
- options: Array of single-choice options for the user to pick from (optional). MUST be plain strings, e.g. ["A", "B", "C"] — never objects.
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
- The agent loop pauses until the user answers
|
|
9
|
+
- The answer is injected as the next user message
|
|
10
|
+
- Returns the user's answer — the chosen option or free text — as the next message; the loop resumes when it arrives.
|
|
11
|
+
{{inject:question-ui-face}}
|
|
12
|
+
- Use sparingly — prefer making reasonable decisions when possible
|
|
13
|
+
- Ask ONE question per call — never bundle multiple sub-questions into one question string; ask the next one after the answer arrives.
|
|
14
|
+
- Keep the question text short — one or two sentences. Background, context, and analysis belong in your normal reply text, NOT in the question.
|
|
15
|
+
- Routine confirmations (confirm gates) belong in your plain reply text — the user answers in their next message. Use this tool ONLY when you need the user's decision or input to proceed.
|
|
16
|
+
- After receiving an answer about a design convention, tool preference, or recurring pattern: save it with the memory tool (action: put). This prevents asking the same question in future sessions — the user shouldn't have to repeat their preferences.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Read a text file. Returns numbered lines. Use offset/limit to page large files.
|
|
2
|
+
|
|
3
|
+
**Route to read instead of bash:** `cat file` / `type file` / `node -e "fs.readFileSync(...)"` → read. Reading a file is a read — never shell out for it.
|
|
4
|
+
|
|
5
|
+
**Routing:**
|
|
6
|
+
- Don't know which file? → `repo_outline` / `code_search` / `glob` first
|
|
7
|
+
- Know the symbol but not the location? → `code_search` or `lsp definition`
|
|
8
|
+
- Know the file but not the lines? → `grep` to find line numbers, then read that range with offset/limit
|
|
9
|
+
- Reading an image? → `read_image` instead
|
|
10
|
+
|
|
11
|
+
Parameters:
|
|
12
|
+
- path (required): File path, relative to cwd or absolute (alias: filePath)
|
|
13
|
+
- offset: 1-based line number to start reading from
|
|
14
|
+
- limit: Max lines to return (default 2000) — windows over files beyond that return head + `…(truncated: K lines in middle, use offset to continue)` + the file's real tail lines, so the file end is never hidden
|
|
15
|
+
- hashes: Include SHA256 content hashes per line (for hashline_edit). Set true before using hashline_edit.
|
|
16
|
+
|
|
17
|
+
Notes:
|
|
18
|
+
- Always prefer this over `cat` or shell-based reading — it caps output and avoids large dumps
|
|
19
|
+
- Use offset for pagination when the file is large
|
|
20
|
+
- When you plan to edit the file, set hashes=true to get line hashes for hashline_edit — hash-based editing avoids whitespace/encoding matching failures
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Read an image file and return it as multimodal content visible to the model. Use this to view screenshots, UI mockups, diagrams, or any visual content. The model only sees images through this tool — it cannot "see" files directly. Supports png, jpg, gif, webp. The image is base64-encoded and included in the response. Large images (>15MB) are rejected.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): Path to image file (relative to cwd or absolute). Supports png, jpg, gif, webp; svg is returned as text source.
|
|
5
|
+
|
|
6
|
+
Notes:
|
|
7
|
+
- Raster formats only (png/jpg/gif/webp): no mainstream vision API (Kimi, Anthropic, OpenAI, Gemini) accepts svg or bmp, and an unsupported image part in history makes every subsequent request fail with 400. svg files are returned as text source instead (readable by any model); bmp is rejected — convert to PNG first.
|
|
8
|
+
- This tool only works with models that support vision/image input (capability is spec-driven — the model spec decides, not a hardcoded list). Models without vision support will receive an error — except svg, which needs no vision support since it is read as text.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Generate a directory tree of the codebase (default depth 3). Skips dotfiles, .git/node_modules/dist/build/bin/obj and other build/vendor dirs, and binary files. Use to quickly see which modules exist and where files live.
|
|
2
|
+
|
|
3
|
+
**Route to tree instead of bash:**
|
|
4
|
+
- `tree` / `find .` / `dir /s` → tree
|
|
5
|
+
|
|
6
|
+
Parameters:
|
|
7
|
+
- path: Root directory (default cwd)
|
|
8
|
+
- depth: Tree depth (default 3, max 6). Directories are listed before files, both sorted.
|
|
9
|
+
|
|
10
|
+
Notes:
|
|
11
|
+
- Capped at 200 entries.
|
|
12
|
+
- Directories end with `/`; tree-drawing uses `├──`/`└──`/`│`.
|
|
13
|
+
- Use depth for a shallow overview; use `ls` for one directory, `glob` for a specific file pattern.
|
|
14
|
+
- Returns the directory text tree — directories first (`dir/`), files after, both sorted, capped at 200 entries.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Wait until a condition becomes true — polls the condition every interval_ms and returns as soon as it holds or the timeout_ms ceiling passes. Use it ONLY for genuinely asynchronous waits: an async subagent/consult still settling, a file appearing, a port opening. Synchronous tools (advisor, blocking subagent spawn) return when done — waiting after them is NOT needed and wastes time.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- condition (required): a semantic condition expression:
|
|
5
|
+
- `advisor settled` — an in-flight advisor review session has finished (async advisor-role children settled)
|
|
6
|
+
- `subagent id:N done` — async subagent N (the id your async spawn ack returned) has settled
|
|
7
|
+
- `consult done` — every consult_start session has drained
|
|
8
|
+
- `file exists:path` — the file at path exists (path relative to cwd)
|
|
9
|
+
- `port open:N` — something is listening on 127.0.0.1 port N
|
|
10
|
+
- The agent-internal conditions (advisor / subagent / consult) apply to ASYNC sessions only — a synchronous call already completed before it returned and has nothing to wait for. An unknown condition is an explicit error (`wait_for: unsupported condition "..."` — the supported forms are listed above), never a silent wait.
|
|
11
|
+
- interval_ms: poll interval (default 1000, floor 100 — polling never busy-spins)
|
|
12
|
+
- timeout_ms: overall ceiling (default 30000; config.json `agent.waitForTimeoutMs` overrides the default; hard cap 600000 like the execute tool)
|
|
13
|
+
|
|
14
|
+
Returns:
|
|
15
|
+
- `wait_for: condition satisfied after Nms (N checks): "<condition>"` — condition held
|
|
16
|
+
- `wait_for: timed out after Nms waiting for "<condition>" ...` — ceiling passed with the condition still false (never burns beyond the ceiling)
|
|
17
|
+
- interrupts (Ctrl+C / cancel) exit immediately; malformed conditions and unsupported syntax error out explicitly
|
|
18
|
+
|
|
19
|
+
Notes:
|
|
20
|
+
- Read-only and non-destructive — it only observes (agent pools, the filesystem, a local port probe).
|
|
21
|
+
- Blocking by design — call it ALONE in a turn, not batched with calls that depend on its result.
|
|
22
|
+
- Do not use it to wait after synchronous tools (advisor / blocking subagent spawn / verify return only when done).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Search the web via Bing. Returns result titles, URLs, and snippets. Use for looking up current information, docs, error messages.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- query (required): Search query
|
|
5
|
+
- limit: Max results (default 8, max 20)
|
|
6
|
+
- engine: Specific engine to use — "bing" (Bing). Omit to search all engines concurrently.
|
|
7
|
+
- page: Page number for pagination (1-based, default 1). Only used when engine is specified.
|
|
8
|
+
- proxy: http://host:port explicit proxy (optional) — use ONLY when passed; no proxy = direct. config.json proxy is NOT auto-applied (2026-08-31 ruling); Bing/foreign sites usually need a proxy, domestic targets don't
|
|
9
|
+
|
|
10
|
+
Notes:
|
|
11
|
+
- Before searching the web, call the memory tool (action: search) first — you may already know the answer from a previous session. Only reach for websearch if memory comes up empty.
|
|
12
|
+
- Runs synchronously — returns when the search completes (all selected engines run in parallel).
|
|
13
|
+
- Use this for information that is NOT in the local codebase — current docs, error messages, API references
|
|
14
|
+
- Follow up with `fetch` to read full pages from the results
|
|
15
|
+
- **Weak engine warning**: Bing's index is noisy for technical queries — if a first websearch returns irrelevant/townhall-grade results, DO NOT retry the same query. Configure a search MCP tool (e.g. `glm-websearch` via the MCP config) for technical lookups; websearch is the fallback.
|
|
16
|
+
- Proxy: NOT auto-applied from config.json (2026-08-31 ruling). Pass `proxy: "http://host:port"` explicitly when the target needs one; omit for domestic targets.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Write content to a file. Creates parent directories; overwrites existing file.
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
- path (required): File path, relative to cwd or absolute
|
|
5
|
+
- content (required): Full content to write
|
|
6
|
+
|
|
7
|
+
Notes:
|
|
8
|
+
- write replaces the WHOLE file — read it first and confirm you intend to rewrite it entirely; for a small change use edit / insert_after.
|
|
9
|
+
- Returns `Wrote N chars to <path>` + git diff + syntax-check note.
|
|
10
|
+
- This overwrites the entire file — use `edit` for targeted changes
|
|
11
|
+
- The file is atomic: it either writes completely or fails
|