@xiaoso/dsh-tool-plus 0.1.1 → 0.1.2-beta.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/README.en.md
CHANGED
|
@@ -20,6 +20,10 @@ Essential tools enhancement for DeepSeek Harness: persistent bash, structured re
|
|
|
20
20
|
- **ast_grep / ast_edit** (optional): syntax-tree based structural code search and rewrite, enabled in settings
|
|
21
21
|
- **agent presets**: two companion templates — Standard enhanced and PTC (Code Mode) — installable in one command (see Installation)
|
|
22
22
|
|
|
23
|
+
Settings panel (Bash tab):
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
23
27
|
## Recommended Environment & Configuration
|
|
24
28
|
|
|
25
29
|
- **Full-access mode**: the plugin is best used under `danger-full-access`, which avoids file writes being blocked by mistake in sandboxed modes.
|
package/README.md
CHANGED
|
@@ -20,6 +20,10 @@ DeepSeek Harness 基础工具增强:持久 bash、结构化 read、多模式 e
|
|
|
20
20
|
- **ast_grep / ast_edit**(可选):基于语法树的结构化代码搜索与重写,可在设置中开启
|
|
21
21
|
- **agent 预设**:标准增强版 / PTC(Code Mode)两套配套模板,一条命令安装(见安装章节)
|
|
22
22
|
|
|
23
|
+
设置面板(Bash 工具页):
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
23
27
|
## 推荐环境与配置
|
|
24
28
|
|
|
25
29
|
- **完全权限模式**:建议在 `danger-full-access` 下使用本插件,可避免沙箱模式下文件写入被误拦。
|
package/lib/client.js
CHANGED
|
@@ -22,6 +22,7 @@ window.__ModuleLoader__.load({
|
|
|
22
22
|
editMode: "groupEditMode",
|
|
23
23
|
guard: "groupGuard",
|
|
24
24
|
grep: "groupGrep",
|
|
25
|
+
searchDefaults: "groupSearchDefaults",
|
|
25
26
|
ast: "groupAst"
|
|
26
27
|
};
|
|
27
28
|
/**
|
|
@@ -672,6 +673,42 @@ window.__ModuleLoader__.load({
|
|
|
672
673
|
group: "grep",
|
|
673
674
|
tool: "grep"
|
|
674
675
|
},
|
|
676
|
+
{
|
|
677
|
+
name: "grepCaseDefault",
|
|
678
|
+
kind: "boolean",
|
|
679
|
+
default: true,
|
|
680
|
+
labelKey: "grepCaseDefault",
|
|
681
|
+
hintKey: "grepCaseDefaultHint",
|
|
682
|
+
group: "searchDefaults",
|
|
683
|
+
tool: "grep"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: "grepGitignoreDefault",
|
|
687
|
+
kind: "boolean",
|
|
688
|
+
default: true,
|
|
689
|
+
labelKey: "grepGitignoreDefault",
|
|
690
|
+
hintKey: "grepGitignoreDefaultHint",
|
|
691
|
+
group: "searchDefaults",
|
|
692
|
+
tool: "grep"
|
|
693
|
+
},
|
|
694
|
+
{
|
|
695
|
+
name: "globGitignoreDefault",
|
|
696
|
+
kind: "boolean",
|
|
697
|
+
default: true,
|
|
698
|
+
labelKey: "globGitignoreDefault",
|
|
699
|
+
hintKey: "globGitignoreDefaultHint",
|
|
700
|
+
group: "searchDefaults",
|
|
701
|
+
tool: "glob"
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
name: "globHiddenDefault",
|
|
705
|
+
kind: "boolean",
|
|
706
|
+
default: true,
|
|
707
|
+
labelKey: "globHiddenDefault",
|
|
708
|
+
hintKey: "globHiddenDefaultHint",
|
|
709
|
+
group: "searchDefaults",
|
|
710
|
+
tool: "glob"
|
|
711
|
+
},
|
|
675
712
|
{
|
|
676
713
|
name: "astGrepEnabled",
|
|
677
714
|
kind: "boolean",
|
|
@@ -713,6 +750,11 @@ window.__ModuleLoader__.load({
|
|
|
713
750
|
labelKey: "tabGrep",
|
|
714
751
|
fields: TOOL_PLUS_FIELDS.filter((f) => f.tool === "grep").map((f) => f.name)
|
|
715
752
|
},
|
|
753
|
+
{
|
|
754
|
+
id: "glob",
|
|
755
|
+
labelKey: "tabGlob",
|
|
756
|
+
fields: TOOL_PLUS_FIELDS.filter((f) => f.tool === "glob").map((f) => f.name)
|
|
757
|
+
},
|
|
716
758
|
{
|
|
717
759
|
id: "astGrep",
|
|
718
760
|
labelKey: "tabAstGrep",
|
|
@@ -2035,7 +2077,6 @@ window.__ModuleLoader__.load({
|
|
|
2035
2077
|
switch (reason) {
|
|
2036
2078
|
case "snapshot-unavailable": return "rmSafeReasonSnapshotUnavailable";
|
|
2037
2079
|
case "cli-missing": return "rmSafeReasonCliMissing";
|
|
2038
|
-
case "script-write-failed": return "rmSafeReasonScriptWriteFailed";
|
|
2039
2080
|
case "snapshot-write-failed": return "rmSafeReasonSnapshotWriteFailed";
|
|
2040
2081
|
case "runtime-not-effective": return "rmSafeReasonRuntimeNotEffective";
|
|
2041
2082
|
}
|
|
@@ -2590,6 +2631,7 @@ window.__ModuleLoader__.load({
|
|
|
2590
2631
|
tabRead: "Read",
|
|
2591
2632
|
tabWriteEdit: "Write & Edit",
|
|
2592
2633
|
tabGrep: "Grep",
|
|
2634
|
+
tabGlob: "Glob",
|
|
2593
2635
|
tabAstGrep: "Ast Grep",
|
|
2594
2636
|
tabAstEdit: "Ast Edit",
|
|
2595
2637
|
tabReadImage: "Read Image",
|
|
@@ -2676,11 +2718,20 @@ window.__ModuleLoader__.load({
|
|
|
2676
2718
|
grepContextBeforeHint: "每个匹配前展示的上下文行数。",
|
|
2677
2719
|
grepContextAfter: "匹配后上下文行数",
|
|
2678
2720
|
grepContextAfterHint: "每个匹配后展示的上下文行数。",
|
|
2721
|
+
grepCaseDefault: "大小写敏感(默认)",
|
|
2722
|
+
grepCaseDefaultHint: "开启(默认)时按大小写严格匹配;关闭后忽略大小写。调用时显式传 case 参数会覆盖此默认。",
|
|
2723
|
+
grepGitignoreDefault: "跳过被忽略的文件(默认)",
|
|
2724
|
+
grepGitignoreDefaultHint: "开启(默认)时,.gitignore 里列出的文件/目录会自动跳过,不出现在搜索结果里;关闭后它们也会被搜到。调用时显式传 gitignore 参数会覆盖此默认。",
|
|
2725
|
+
globGitignoreDefault: "跳过被忽略的文件(默认)",
|
|
2726
|
+
globGitignoreDefaultHint: "开启(默认)时,.gitignore 里列出的文件/目录会自动跳过,不会出现在结果里;关闭后它们也会被列出。调用时显式传 gitignore 参数会覆盖此默认。",
|
|
2727
|
+
globHiddenDefault: "包含隐藏文件(默认)",
|
|
2728
|
+
globHiddenDefaultHint: "开启(默认)时以 . 开头的文件/目录(如 .env、.git)也会出现在结果里;关闭后自动跳过。调用时显式传 hidden 参数会覆盖此默认。",
|
|
2679
2729
|
astGrepEnabled: "启用 ast_grep",
|
|
2680
2730
|
astGrepEnabledHint: "启用 ast_grep 工具做结构化 AST 搜索(默认关闭)。",
|
|
2681
2731
|
astEditEnabled: "启用 ast_edit",
|
|
2682
2732
|
astEditEnabledHint: "启用 ast_edit 工具做结构化 AST 重写(默认开启)。",
|
|
2683
2733
|
groupGrep: "匹配上下文",
|
|
2734
|
+
groupSearchDefaults: "搜索默认值",
|
|
2684
2735
|
groupAst: "AST 工具",
|
|
2685
2736
|
optReplace: "replace(字面量替换)",
|
|
2686
2737
|
optPatch: "patch(unified diff)",
|
|
@@ -2719,7 +2770,6 @@ window.__ModuleLoader__.load({
|
|
|
2719
2770
|
rmSafeStatusFailed: "安全 rm 注入失败:{reason},rm 将永久删除",
|
|
2720
2771
|
rmSafeReasonSnapshotUnavailable: "快照不可用",
|
|
2721
2772
|
rmSafeReasonCliMissing: "trash-cli 产物缺失",
|
|
2722
|
-
rmSafeReasonScriptWriteFailed: "脚本写入失败",
|
|
2723
2773
|
rmSafeReasonSnapshotWriteFailed: "快照不可写",
|
|
2724
2774
|
rmSafeReasonRuntimeNotEffective: "运行时未生效",
|
|
2725
2775
|
useShellCommandWrapper: "用 bash -c 包裹命令",
|
|
@@ -2766,11 +2816,12 @@ window.__ModuleLoader__.load({
|
|
|
2766
2816
|
description: "Persistent shell tool: timeouts, backgrounding, interception, and environment.",
|
|
2767
2817
|
nav: "Tool Plus",
|
|
2768
2818
|
pageTitle: "Tool Plus tool configuration",
|
|
2769
|
-
pageDescription: "Switch by tool to adjust its global settings; values apply
|
|
2819
|
+
pageDescription: "Switch by tool to adjust its global settings; values apply …",
|
|
2770
2820
|
tabBash: "Bash",
|
|
2771
2821
|
tabRead: "Read",
|
|
2772
2822
|
tabWriteEdit: "Write & Edit",
|
|
2773
2823
|
tabGrep: "Grep",
|
|
2824
|
+
tabGlob: "Glob",
|
|
2774
2825
|
tabAstGrep: "Ast Grep",
|
|
2775
2826
|
tabAstEdit: "Ast Edit",
|
|
2776
2827
|
tabReadImage: "Read Image",
|
|
@@ -2857,11 +2908,20 @@ window.__ModuleLoader__.load({
|
|
|
2857
2908
|
grepContextBeforeHint: "Context lines shown before each match.",
|
|
2858
2909
|
grepContextAfter: "Context lines after match",
|
|
2859
2910
|
grepContextAfterHint: "Context lines shown after each match.",
|
|
2911
|
+
grepCaseDefault: "Case-sensitive (default)",
|
|
2912
|
+
grepCaseDefaultHint: "When on (default), matches strictly by case; when off, case is ignored. An explicit case argument on the call overrides this default.",
|
|
2913
|
+
grepGitignoreDefault: "Skip ignored files (default)",
|
|
2914
|
+
grepGitignoreDefaultHint: "When on (default), files and directories listed in .gitignore are skipped and never appear in results; when off, they are searched too. An explicit gitignore argument on the call overrides this default.",
|
|
2915
|
+
globGitignoreDefault: "Skip ignored files (default)",
|
|
2916
|
+
globGitignoreDefaultHint: "When on (default), files and directories listed in .gitignore are skipped and never appear in results; when off, they are listed too. An explicit gitignore argument on the call overrides this default.",
|
|
2917
|
+
globHiddenDefault: "Include hidden files (default)",
|
|
2918
|
+
globHiddenDefaultHint: "When on (default), dot-files and dot-directories (e.g. .env, .git) appear in results; when off, they are skipped. An explicit hidden argument on the call overrides this default.",
|
|
2860
2919
|
astGrepEnabled: "Enable ast_grep",
|
|
2861
2920
|
astGrepEnabledHint: "Enable the ast_grep tool for structural AST search (off by default).",
|
|
2862
2921
|
astEditEnabled: "Enable ast_edit",
|
|
2863
2922
|
astEditEnabledHint: "Enable the ast_edit tool for structural AST rewrites (on by default).",
|
|
2864
2923
|
groupGrep: "Match context",
|
|
2924
|
+
groupSearchDefaults: "Search defaults",
|
|
2865
2925
|
groupAst: "AST tools",
|
|
2866
2926
|
optReplace: "replace (literal)",
|
|
2867
2927
|
optPatch: "patch (unified diff)",
|
|
@@ -2900,7 +2960,6 @@ window.__ModuleLoader__.load({
|
|
|
2900
2960
|
rmSafeStatusFailed: "Safe rm injection failed: {reason}, rm deletes permanently",
|
|
2901
2961
|
rmSafeReasonSnapshotUnavailable: "snapshot unavailable",
|
|
2902
2962
|
rmSafeReasonCliMissing: "trash-cli binary missing",
|
|
2903
|
-
rmSafeReasonScriptWriteFailed: "script write failed",
|
|
2904
2963
|
rmSafeReasonSnapshotWriteFailed: "snapshot not writable",
|
|
2905
2964
|
rmSafeReasonRuntimeNotEffective: "not effective at runtime",
|
|
2906
2965
|
useShellCommandWrapper: "Wrap commands in bash -c",
|
package/lib/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ __installBunShim();
|
|
|
3
3
|
import { n as fs_promises_shim_exports, t as exists } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
4
|
import { i as setRuntimeLogger, n as systemChromiumCandidatesForTest, r as runtimeLogger } from "./launch-DwpE70Pv.mjs";
|
|
5
5
|
import { $ as peekFile, A as formatAge, C as error, F as $envpos, I as $flag, M as formatCount, P as $env, Q as isProbablyBinary, S as debug, T as warn, U as getAutoQaDbPath, V as VERSION, X as getRemoteDir, Y as getPuppeteerDir, b as isEnotdir, c as combineSignals, d as $which, j as formatBytes$1, k as installBunShim, l as exec, p as readImageMetadata, q as getInstallId, tt as untilAborted, u as render, v as hasFsCode, y as isEnoent } from "./src-D_e1qMwi.mjs";
|
|
6
|
-
import { C as truncateToWidth$1, S as replaceTabs, _ as formatCodeFrameLine, a as fetchBinary, b as LRUCache, c as getParallelExtractContent, d as convertFileWithMarkit, f as Settings, g as capParseErrors, h as OMP_DEFAULTS, i as convertWithMarkit, l as ensureTool, m as settings, o as extractWithParallel, p as isSettingsInitialized, s as findParallelApiKey, u as CONVERTIBLE_EXTENSIONS, v as formatParseErrors, x as padding, y as shortenPath } from "./utils-
|
|
6
|
+
import { C as truncateToWidth$1, S as replaceTabs, _ as formatCodeFrameLine, a as fetchBinary, b as LRUCache, c as getParallelExtractContent, d as convertFileWithMarkit, f as Settings, g as capParseErrors, h as OMP_DEFAULTS, i as convertWithMarkit, l as ensureTool, m as settings, o as extractWithParallel, p as isSettingsInitialized, s as findParallelApiKey, u as CONVERTIBLE_EXTENSIONS, v as formatParseErrors, x as padding, y as shortenPath } from "./utils-BSVzHGnp.mjs";
|
|
7
7
|
import { t as sanitizeText } from "./sanitize-text-CfcXzw5X.mjs";
|
|
8
8
|
import { n as isRecord$2 } from "./type-guards-B9VVjRDK.mjs";
|
|
9
9
|
import { n as ToolError, r as throwIfAborted, t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
@@ -811,20 +811,21 @@ function cleanupSnapshots() {
|
|
|
811
811
|
/**
|
|
812
812
|
* rmSafe: rm 重定义脚本的生成与快照注入。
|
|
813
813
|
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
814
|
+
* 生成 bash 函数定义(rm → `node <trash-cli.mjs> "$@"`),直接内联进
|
|
815
|
+
* 快照文件(会话 shell 创建时 source 一次):
|
|
816
816
|
* - POSIX:追加到用户环境快照末尾(幂等,带标记行);
|
|
817
817
|
* - Windows:getOrCreateSnapshot 生成"仅注入"快照文件后同样追加。
|
|
818
818
|
*
|
|
819
|
+
* 内联而非独立脚本文件:快照随进程重建(重启后重新生成),node/trash-cli
|
|
820
|
+
* 路径在进程内是常量,不存在"路径漂移";独立脚本文件反而引入跨进程共享
|
|
821
|
+
* 缓存(不同安装路径的实例、测试进程互相覆盖,测试进程的 import.meta.url
|
|
822
|
+
* 指向 src 会把共享缓存重写成不存在的路径)。
|
|
823
|
+
*
|
|
819
824
|
* rmSafe 关闭时调用方不注入,快照保持原样,系统 rm 生效。
|
|
820
825
|
* @module @xiaoso/dsh-tool-plus/bash/rm-safe
|
|
821
826
|
*/
|
|
822
827
|
/** 注入标记行:injectRmSafe 以此判断是否已注入(幂等)。 */
|
|
823
828
|
const RM_SAFE_MARKER = "# dsh-tool-plus rmSafe";
|
|
824
|
-
/** rm-safe 脚本缓存目录(tmpdir 下,跨会话复用)。 */
|
|
825
|
-
function rmSafeScriptDir() {
|
|
826
|
-
return path.join(os.tmpdir(), "dsh-bash-plus");
|
|
827
|
-
}
|
|
828
829
|
/** trash-cli 构建产物路径(lib/trash-cli.mjs,与主 bundle 同目录)。 */
|
|
829
830
|
function rmSafeCliPath() {
|
|
830
831
|
return fileURLToPath(new URL("./trash-cli.mjs", import.meta.url));
|
|
@@ -849,28 +850,10 @@ function rmSafeScript(nodePath, cliPath) {
|
|
|
849
850
|
].join("\n");
|
|
850
851
|
}
|
|
851
852
|
/**
|
|
852
|
-
*
|
|
853
|
-
* 返回脚本路径;目录/写入失败时返回 null(不抛异常,调用方降级并告警)。
|
|
854
|
-
*/
|
|
855
|
-
function ensureRmSafeScript(dir, nodePath, cliPath) {
|
|
856
|
-
const target = path.join(dir, "rm-safe.sh");
|
|
857
|
-
const content = rmSafeScript(nodePath, cliPath);
|
|
858
|
-
try {
|
|
859
|
-
if (fs.readFileSync(target, "utf8") === content) return target;
|
|
860
|
-
} catch {}
|
|
861
|
-
try {
|
|
862
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
863
|
-
fs.writeFileSync(target, content, { mode: 384 });
|
|
864
|
-
return target;
|
|
865
|
-
} catch {
|
|
866
|
-
return null;
|
|
867
|
-
}
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* 向快照文件追加 `source <rm-safe.sh>`(幂等:已有标记则跳过)。
|
|
853
|
+
* 向快照文件内联追加 rm 重定义(幂等:已有标记则跳过)。
|
|
871
854
|
* 返回是否注入成功;快照文件不可读/不可写时返回 false(不抛异常)。
|
|
872
855
|
*/
|
|
873
|
-
function injectRmSafe(snapshotPath,
|
|
856
|
+
function injectRmSafe(snapshotPath, nodePath, cliPath) {
|
|
874
857
|
let content;
|
|
875
858
|
try {
|
|
876
859
|
content = fs.readFileSync(snapshotPath, "utf8");
|
|
@@ -879,7 +862,7 @@ function injectRmSafe(snapshotPath, scriptPath) {
|
|
|
879
862
|
}
|
|
880
863
|
if (content.includes("# dsh-tool-plus rmSafe")) return true;
|
|
881
864
|
try {
|
|
882
|
-
fs.appendFileSync(snapshotPath, `\n${
|
|
865
|
+
fs.appendFileSync(snapshotPath, `\n${rmSafeScript(nodePath, cliPath)}`);
|
|
883
866
|
return true;
|
|
884
867
|
} catch {
|
|
885
868
|
return false;
|
|
@@ -2426,13 +2409,9 @@ async function executeBash(command, options) {
|
|
|
2426
2409
|
let snapshotPath = bashShell && options?.snapshotEnabled !== false ? await getOrCreateSnapshot(shell, shellEnv) : null;
|
|
2427
2410
|
let rmSafeInjectionFailed = false;
|
|
2428
2411
|
if (snapshotPath !== null && options?.rmSafe === true) {
|
|
2429
|
-
|
|
2430
|
-
if (scriptPath === null || !injectRmSafe(snapshotPath, scriptPath)) {
|
|
2412
|
+
if (!injectRmSafe(snapshotPath, process.execPath, rmSafeCliPath())) {
|
|
2431
2413
|
rmSafeInjectionFailed = true;
|
|
2432
|
-
runtimeLogger().warn("rmSafe: injection failed, rm will delete permanently", {
|
|
2433
|
-
scriptPath: scriptPath ?? null,
|
|
2434
|
-
snapshotPath
|
|
2435
|
-
});
|
|
2414
|
+
runtimeLogger().warn("rmSafe: injection failed, rm will delete permanently", { snapshotPath });
|
|
2436
2415
|
}
|
|
2437
2416
|
}
|
|
2438
2417
|
const injectionFailedMarker = rmSafeInjectionFailed ? { rmSafeInjectionFailed: true } : {};
|
|
@@ -2758,6 +2737,7 @@ function startBashJob(options) {
|
|
|
2758
2737
|
headBytes: config.outputSinkHeadBytes,
|
|
2759
2738
|
useShellCommandWrapper: config.useShellCommandWrapper,
|
|
2760
2739
|
snapshotEnabled: config.snapshotEnabled,
|
|
2740
|
+
rmSafe: config.rmSafe,
|
|
2761
2741
|
nonInteractiveEnv: config.nonInteractiveEnv,
|
|
2762
2742
|
artifactPath: spillPath,
|
|
2763
2743
|
onMinimizedSave: (originalText) => saveOriginalText(originalText),
|
|
@@ -3942,6 +3922,42 @@ const TOOL_PLUS_FIELDS = [
|
|
|
3942
3922
|
group: "grep",
|
|
3943
3923
|
tool: "grep"
|
|
3944
3924
|
},
|
|
3925
|
+
{
|
|
3926
|
+
name: "grepCaseDefault",
|
|
3927
|
+
kind: "boolean",
|
|
3928
|
+
default: true,
|
|
3929
|
+
labelKey: "grepCaseDefault",
|
|
3930
|
+
hintKey: "grepCaseDefaultHint",
|
|
3931
|
+
group: "searchDefaults",
|
|
3932
|
+
tool: "grep"
|
|
3933
|
+
},
|
|
3934
|
+
{
|
|
3935
|
+
name: "grepGitignoreDefault",
|
|
3936
|
+
kind: "boolean",
|
|
3937
|
+
default: true,
|
|
3938
|
+
labelKey: "grepGitignoreDefault",
|
|
3939
|
+
hintKey: "grepGitignoreDefaultHint",
|
|
3940
|
+
group: "searchDefaults",
|
|
3941
|
+
tool: "grep"
|
|
3942
|
+
},
|
|
3943
|
+
{
|
|
3944
|
+
name: "globGitignoreDefault",
|
|
3945
|
+
kind: "boolean",
|
|
3946
|
+
default: true,
|
|
3947
|
+
labelKey: "globGitignoreDefault",
|
|
3948
|
+
hintKey: "globGitignoreDefaultHint",
|
|
3949
|
+
group: "searchDefaults",
|
|
3950
|
+
tool: "glob"
|
|
3951
|
+
},
|
|
3952
|
+
{
|
|
3953
|
+
name: "globHiddenDefault",
|
|
3954
|
+
kind: "boolean",
|
|
3955
|
+
default: true,
|
|
3956
|
+
labelKey: "globHiddenDefault",
|
|
3957
|
+
hintKey: "globHiddenDefaultHint",
|
|
3958
|
+
group: "searchDefaults",
|
|
3959
|
+
tool: "glob"
|
|
3960
|
+
},
|
|
3945
3961
|
{
|
|
3946
3962
|
name: "astGrepEnabled",
|
|
3947
3963
|
kind: "boolean",
|
|
@@ -3961,7 +3977,7 @@ const TOOL_PLUS_FIELDS = [
|
|
|
3961
3977
|
tool: "astEdit"
|
|
3962
3978
|
}
|
|
3963
3979
|
];
|
|
3964
|
-
TOOL_PLUS_FIELDS.filter((f) => f.tool === "bash").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "read").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "writeEdit").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "grep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astGrep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astEdit").map((f) => f.name);
|
|
3980
|
+
TOOL_PLUS_FIELDS.filter((f) => f.tool === "bash").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "read").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "writeEdit").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "grep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "glob").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astGrep").map((f) => f.name), TOOL_PLUS_FIELDS.filter((f) => f.tool === "astEdit").map((f) => f.name);
|
|
3965
3981
|
/** Look up one field definition by its schema key. */
|
|
3966
3982
|
function toolPlusField(name) {
|
|
3967
3983
|
return TOOL_PLUS_FIELDS.find((field) => field.name === name);
|
|
@@ -4063,6 +4079,10 @@ const Config = z.object({
|
|
|
4063
4079
|
readConcurrentSafe: z.boolean().default(fieldDefault("readConcurrentSafe", true)),
|
|
4064
4080
|
grepContextBefore: z.number().default(fieldDefault("grepContextBefore", 1)),
|
|
4065
4081
|
grepContextAfter: z.number().default(fieldDefault("grepContextAfter", 3)),
|
|
4082
|
+
grepCaseDefault: z.boolean().default(fieldDefault("grepCaseDefault", true)),
|
|
4083
|
+
grepGitignoreDefault: z.boolean().default(fieldDefault("grepGitignoreDefault", true)),
|
|
4084
|
+
globGitignoreDefault: z.boolean().default(fieldDefault("globGitignoreDefault", true)),
|
|
4085
|
+
globHiddenDefault: z.boolean().default(fieldDefault("globHiddenDefault", true)),
|
|
4066
4086
|
astGrepEnabled: z.boolean().default(fieldDefault("astGrepEnabled", false)),
|
|
4067
4087
|
astEditEnabled: z.boolean().default(fieldDefault("astEditEnabled", true)),
|
|
4068
4088
|
fetchEnabled: z.boolean().default(fieldDefault("fetchEnabled", true)),
|
|
@@ -4149,6 +4169,10 @@ function resolveConfig(config) {
|
|
|
4149
4169
|
readConcurrentSafe: config.readConcurrentSafe ?? fieldDefault("readConcurrentSafe", true),
|
|
4150
4170
|
grepContextBefore: config.grepContextBefore ?? fieldDefault("grepContextBefore", 1),
|
|
4151
4171
|
grepContextAfter: config.grepContextAfter ?? fieldDefault("grepContextAfter", 3),
|
|
4172
|
+
grepCaseDefault: config.grepCaseDefault ?? fieldDefault("grepCaseDefault", true),
|
|
4173
|
+
grepGitignoreDefault: config.grepGitignoreDefault ?? fieldDefault("grepGitignoreDefault", true),
|
|
4174
|
+
globGitignoreDefault: config.globGitignoreDefault ?? fieldDefault("globGitignoreDefault", true),
|
|
4175
|
+
globHiddenDefault: config.globHiddenDefault ?? fieldDefault("globHiddenDefault", true),
|
|
4152
4176
|
astGrepEnabled: config.astGrepEnabled ?? fieldDefault("astGrepEnabled", false),
|
|
4153
4177
|
astEditEnabled: config.astEditEnabled ?? fieldDefault("astEditEnabled", true),
|
|
4154
4178
|
fetchEnabled: config.fetchEnabled ?? fieldDefault("fetchEnabled", true),
|
|
@@ -4413,12 +4437,7 @@ async function queryRmSafeStatus(deps) {
|
|
|
4413
4437
|
status: "failed",
|
|
4414
4438
|
reason: "cli-missing"
|
|
4415
4439
|
};
|
|
4416
|
-
|
|
4417
|
-
if (scriptPath === null) return {
|
|
4418
|
-
status: "failed",
|
|
4419
|
-
reason: "script-write-failed"
|
|
4420
|
-
};
|
|
4421
|
-
if (!deps.inject(snapshotPath, scriptPath)) return {
|
|
4440
|
+
if (!deps.inject(snapshotPath, deps.nodePath(), deps.cliPath())) return {
|
|
4422
4441
|
status: "failed",
|
|
4423
4442
|
reason: "snapshot-write-failed"
|
|
4424
4443
|
};
|
|
@@ -4488,8 +4507,9 @@ function installBrowserProbeRpc(ctx, deps) {
|
|
|
4488
4507
|
value: await queryRmSafeStatus({
|
|
4489
4508
|
getOrCreateSnapshot: () => getOrCreateSnapshot(shell, env),
|
|
4490
4509
|
cliExists: () => fs.existsSync(rmSafeCliPath()),
|
|
4491
|
-
|
|
4492
|
-
|
|
4510
|
+
nodePath: () => process.execPath,
|
|
4511
|
+
cliPath: () => rmSafeCliPath(),
|
|
4512
|
+
inject: (snapshotPath, nodePath, cliPath) => injectRmSafe(snapshotPath, nodePath, cliPath),
|
|
4493
4513
|
probe: (snapshotPath) => probeRmSafeRuntime(shell, snapshotPath)
|
|
4494
4514
|
})
|
|
4495
4515
|
};
|
|
@@ -14836,7 +14856,7 @@ let specialHandlersPromise;
|
|
|
14836
14856
|
* requires a special handler, so we keep them out of the cold-startup graph.
|
|
14837
14857
|
*/
|
|
14838
14858
|
function loadSpecialHandlers() {
|
|
14839
|
-
specialHandlersPromise ??= import("./scrapers-
|
|
14859
|
+
specialHandlersPromise ??= import("./scrapers-B06jrsU7.mjs").then((m) => m.specialHandlers);
|
|
14840
14860
|
return specialHandlersPromise;
|
|
14841
14861
|
}
|
|
14842
14862
|
/**
|
|
@@ -24590,7 +24610,9 @@ async function executeGrepTool(exec, cfg, args, ctx) {
|
|
|
24590
24610
|
const params = { pattern: String(args.pattern ?? "") };
|
|
24591
24611
|
if (args.path !== void 0 && args.path !== null && args.path !== "") params.path = String(args.path);
|
|
24592
24612
|
if (typeof args.case === "boolean") params.case = args.case;
|
|
24613
|
+
else params.case = cfg.grepCaseDefault;
|
|
24593
24614
|
if (typeof args.gitignore === "boolean") params.gitignore = args.gitignore;
|
|
24615
|
+
else params.gitignore = cfg.grepGitignoreDefault;
|
|
24594
24616
|
if (typeof args.skip === "number") params.skip = args.skip;
|
|
24595
24617
|
return toGrepToolResult(await tool.execute("grep", params, exec.signal));
|
|
24596
24618
|
}
|
|
@@ -25007,8 +25029,8 @@ function toGlobToolResult(result, args) {
|
|
|
25007
25029
|
async function executeGlobTool(exec, cfg, args, ctx) {
|
|
25008
25030
|
return toGlobToolResult(await new GlobTool(createToolSession$2(exec, cfg)).execute("glob", {
|
|
25009
25031
|
path: args.path !== void 0 ? String(args.path) : void 0,
|
|
25010
|
-
hidden: args.hidden,
|
|
25011
|
-
gitignore: args.gitignore,
|
|
25032
|
+
hidden: typeof args.hidden === "boolean" ? args.hidden : cfg.globHiddenDefault,
|
|
25033
|
+
gitignore: typeof args.gitignore === "boolean" ? args.gitignore : cfg.globGitignoreDefault,
|
|
25012
25034
|
limit: args.limit
|
|
25013
25035
|
}, exec.signal), args);
|
|
25014
25036
|
}
|
|
@@ -3,7 +3,7 @@ __installBunShim();
|
|
|
3
3
|
import { n as fs_promises_shim_exports } from "./fs-promises-shim-Bx0fpxuk.mjs";
|
|
4
4
|
import { B as USER_AGENT, G as getDocsRsCacheDir, N as formatNumber, P as $env, T as warn, c as combineSignals, j as formatBytes, l as exec, s as Snowflake, x as parseFrontmatter, y as isEnoent } from "./src-D_e1qMwi.mjs";
|
|
5
5
|
import { V as tryParseJson } from "./utils-fnV2zzp3.mjs";
|
|
6
|
-
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-
|
|
6
|
+
import { a as fetchBinary, c as getParallelExtractContent, i as convertWithMarkit, l as ensureTool, m as settings, n as asRecord, o as extractWithParallel, r as asString, s as findParallelApiKey, t as asNumber } from "./utils-BSVzHGnp.mjs";
|
|
7
7
|
import { n as isRecord } from "./type-guards-B9VVjRDK.mjs";
|
|
8
8
|
import { r as throwIfAborted, t as ToolAbortError } from "./tool-errors-DoyxivAR.mjs";
|
|
9
9
|
import { c as getLocalizedText, d as looksLikeHtml, i as decodeHtmlEntities, l as htmlToBasicMarkdown, o as formatIsoDate, r as buildResult, s as formatMediaDuration, u as loadPage } from "./types-BUO0JXO-.mjs";
|
|
@@ -7202,7 +7202,7 @@ const settings = {
|
|
|
7202
7202
|
};
|
|
7203
7203
|
//#endregion
|
|
7204
7204
|
//#region package.json
|
|
7205
|
-
var version = "0.1.1";
|
|
7205
|
+
var version = "0.1.2-beta.1";
|
|
7206
7206
|
/** `.tmp` files older than this are treated as orphaned writes and swept. */
|
|
7207
7207
|
const TMP_ORPHAN_MAX_AGE_MS = 3e5;
|
|
7208
7208
|
function markitConversionCacheKey(bytes, extension) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaoso/dsh-tool-plus",
|
|
3
3
|
"description": "Oh My Pi bash runtime ported as a deepseek-harness tool plugin: persistent shell session, output minimizer, managed background jobs, command interception",
|
|
4
|
-
"version": "0.1.1",
|
|
4
|
+
"version": "0.1.2-beta.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"deepseek-harness",
|
package/presets/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiaoso/dsh-tool-plus-presets",
|
|
3
|
-
"version": "0.1.1",
|
|
3
|
+
"version": "0.1.2-beta.1",
|
|
4
4
|
"description": "Agent-preset installer for dsh-tool-plus: installs the standard / PTC enhanced preset templates into a DeepSeek Harness home.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|