dsh-awesome-optimizer 2.1.0 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -35
- package/README.zh.md +29 -35
- package/cache-diagnostics.md +19 -0
- package/cordis.patch.yml +14 -2
- package/outline-benchmark.md +37 -0
- package/outline-benchmark.windows.json +184 -0
- package/package.json +15 -2
- package/scripts/benchmark-outline.mjs +100 -0
- package/scripts/benchmark.mjs +33 -26
- package/scripts/typecheck.mjs +37 -18
- package/src/ast-outline-config.yml +1 -0
- package/src/ast-outline.js +143 -0
- package/src/cache-diagnostics.js +218 -0
- package/src/code-lexical.js +131 -0
- package/src/code-outline.js +171 -0
- package/src/composite-tools.d.ts +36 -8
- package/src/composite-tools.js +538 -194
- package/src/convergence.js +3 -3
- package/src/custom-prompt.d.ts +7 -1
- package/src/custom-prompt.js +53 -18
- package/src/edit-recovery.d.ts +59 -0
- package/src/edit-recovery.js +524 -0
- package/src/failure-recovery.js +1 -1
- package/src/file-mutation-policy.js +0 -8
- package/src/find-read-output.js +175 -0
- package/src/find-read-ranking.js +63 -0
- package/src/index.d.ts +34 -2
- package/src/index.js +29 -5
- package/src/outline-cache.js +36 -0
- package/src/persistent-eval/daemon-pool.js +3 -2
- package/src/persistent-eval/index.d.ts +35 -8
- package/src/persistent-eval/index.js +51 -16
- package/src/persistent-eval/stdio-runner.js +209 -30
- package/src/persistent-eval/workers/node_worker.mjs +42 -31
- package/src/persistent-eval/workers/py_worker.py +47 -24
- package/src/prompt-linter.js +43 -26
- package/src/read-guard.d.ts +80 -0
- package/src/read-guard.js +336 -0
- package/src/runtime-policy.d.ts +1 -0
- package/src/runtime-policy.js +35 -15
- package/src/telemetry.d.ts +4 -0
- package/src/telemetry.js +27 -8
package/README.md
CHANGED
|
@@ -5,40 +5,20 @@ English | [中文](README.zh.md)
|
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-awesome-optimizer)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://github.com/Jaylor-Wang/dsh-awesome-optimizer/releases)
|
|
8
|
-
[](test/)
|
|
9
9
|
[](src/)
|
|
10
10
|
|
|
11
11
|
High-performance runtime policy guards, persistent Python & Node evaluation daemons, PTC-backed composite batch tooling, standalone refined system prompt engine, and objective A/B turn telemetry plugin for the official [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`@deepseek-ai/dsh-agent-loop`).
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
## Highlights in
|
|
15
|
+
## Highlights in v3.3.0
|
|
16
16
|
|
|
17
|
-
- **
|
|
18
|
-
|
|
19
|
-
- **
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
Ultra-compact single-line return format for pure expressions (`=> 42`), trimmed trailing newlines, and intelligent smoothing of IEEE-754 binary floating-point noise (`0.1 + 0.2` -> `=> 0.3`).
|
|
23
|
-
- **Dynamic Ref/Unref & Cordis Lifecycle Cascading**:
|
|
24
|
-
Implements dynamic stream reference counting (`_ref` / `_unref`) so idle daemons never hold the Node.js event loop hostage while ensuring reliable teardown via Cordis `ctx.effect`.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Highlights in v2.0.0
|
|
29
|
-
|
|
30
|
-
- **Persistent Python & Node Evaluation Daemons (`eval_python` / `eval_node`)**:
|
|
31
|
-
Zero-dependency stateful execution kernels over line-delimited stdio JSON frames. Retains global scopes, functions, imports, and variables across turns (with Node top-level `await`). Slashes repetitive calculation latency from 37ms to **0.61ms (98.5% speedup)**, eliminating temporary file pollution.
|
|
32
|
-
- **Three Extreme Performance Dimensions**:
|
|
33
|
-
1. **Pre-warming Daemon**: Listens to session `turn/start` events to pre-spawn and handshake worker processes during model first-token generation, completely eliminating the 80ms cold-start spike.
|
|
34
|
-
2. **Eager Scope Ingestion**: Standard algorithm libraries (`math`, `re`, `json`, `time`, `collections`, `itertools`) are eagerly pre-imported into global Python scope, saving LLM token generation overhead.
|
|
35
|
-
3. **Zero-Token-Waste Formatting**: Ultra-compact single line return format for pure expressions (`=> 42`), trimmed trailing newlines, and intelligent smoothing of IEEE-754 binary floating-point noise (`0.30000000000000004` -> `0.3`) to accelerate LLM Prefill.
|
|
36
|
-
- **Watchdog Timeout & Self-Healing Auto-Restart**:
|
|
37
|
-
Built-in execution watchdog forces termination of infinite loops (`while True:`) or blocked input across platforms without freezing the host process, automatically spinning up fresh instances for seamless queued recovery.
|
|
38
|
-
- **Anti-Dumping Output Guard**:
|
|
39
|
-
Enforces configurable payload truncation (default 8KB) with disk-redirect guidance, directly reinforcing the `NEVER dump raw data into context` directive.
|
|
40
|
-
- **Evaluation vs Engineering Code Separation**:
|
|
41
|
-
Formalizes prompt directives ensuring intermediate calculations leverage persistent in-memory kernels while deliverable production files are committed to disk via native filesystem operations.
|
|
17
|
+
- **Opt-in HTTP cache diagnostics**: [Capture request hashes and upstream usage](cache-diagnostics.md) for OpenAI-compatible `/chat/completions` to compare message prefixes and configuration across turns. Missing cache counters remain distinct from explicit zero; prompts, responses, image bytes, and credentials are never logged.
|
|
18
|
+
- **Bounded, isolated diagnostics**: Asynchronous logging has file and queue limits, flushes on disposal, and stops with one warning on failure. Initialization failures preserve telemetry; response URL, redirect/type metadata, and clone metadata are preserved.
|
|
19
|
+
- **Accurate prefix telemetry**: Detects message replacement, in-place mutation, and changes across turns without stale object-identity digest caching.
|
|
20
|
+
- **Stricter batch preflight**: Rejects empty or unchanged replacement strings before dispatching edits, keeping atomic preflight consistent with native edit validation.
|
|
21
|
+
- **Verification**: 160 tests passed; public declaration type checking passed. No new package dependencies.
|
|
42
22
|
|
|
43
23
|
---
|
|
44
24
|
|
|
@@ -65,13 +45,27 @@ High-performance runtime policy guards, persistent Python & Node evaluation daem
|
|
|
65
45
|
|
|
66
46
|
### 2. PTC Native Composite Batch Tooling (`compositeTools`)
|
|
67
47
|
|
|
68
|
-
- **`
|
|
69
|
-
|
|
48
|
+
- **`find_and_read`**:
|
|
49
|
+
Searches 1–5 regex patterns in parallel without changing regex whitespace, merges and splits adjacent matches, and dispatches budget-aware batches of native `read` calls in one round-trip. The complete returned text, including headers, errors, indexes, and omission notices, fits `maxTotalBytes` (24KB by default). Matched rows take priority; undisplayed locations become bounded indexes with explicit omission counts. Upstream truncation, failed patterns, totals, and recovery locators that fit are reported.
|
|
50
|
+
- `maxWindowLines: 120`: maximum requested lines per slice, preventing dense chained matches from becoming whole-file reads.
|
|
51
|
+
- `maxReadLines: 600`: maximum total requested lines across all files and windows in one call.
|
|
52
|
+
- `readConcurrency: 3`: maximum simultaneous reads per batch; remaining output space is checked before the next batch. Matches hidden by native read truncation remain in the recovery index.
|
|
53
|
+
- Windows prioritize uncovered regex patterns, then diminishing returns for repeated patterns, line cost, and file diversity. Canonical paths and line numbers break ties deterministically. `maxFiles` bounds selected files without excluding valuable windows in other files before ranking.
|
|
54
|
+
- These bounds cover requested lines and returned bytes, not a fixed number of filesystem bytes or tokens.
|
|
55
|
+
- **`readGuard` inspection preflight**:
|
|
56
|
+
Only supported outline languages trigger extra inspection. The fs service resolves and stats the target before reading, preferring bounded `readBytes` or text streaming. Oversized files (`maxInspectBytes`, default 512KB), cancellation, absent files, and service denials skip the outline while preserving the native read result. Service failures never fall back to local disk. Older readText-only services are supported after size preflight, subject to file-growth races between stat and read.
|
|
57
|
+
- Default `astOutline: "auto"` keeps ordinary files on the lexical path and invokes ast-grep on demand for JSX/TSX, TS decorators/exported namespaces, or declaration-like files with empty lexical results. Set `"off"` to disable or `"always"` to force AST for supported languages. Both levels prioritize top-level exports and sample across the unread tail.
|
|
58
|
+
- The CLI receives only the fs-authorized snapshot on stdin, never the target path. It uses fixed plugin configuration, disables custom language libraries, and runs without a shell. Defaults `astTimeoutMs: 750` and `astMaxOutputBytes: 262144` bound time/output. Cancellation terminates the child; missing CLI, timeout, and errors fall back to lexical results. `astGrepCommand` accepts an executable name or absolute path; the CLI must support `outline --stdin --json`.
|
|
59
|
+
- Current bundled ast-grep rules expose TS namespaces without children; lexical child declarations inside AST-confirmed namespace ranges are retained for navigation. AST successes and lexical fallbacks share the version LRU, preventing repeated launches for the same cached file version. Version changes, mutations, or eviction permit another attempt. Inspect `astAttempts/astSucceeded/astFallbacks/astTimeouts/outlineCacheHits` counters.
|
|
60
|
+
- Run `npm run benchmark:outline -- outline-benchmark.windows.json` for real-CLI first-invocation, repeated uncached, lexical, and version-cache timings with 20 repeated samples. See `outline-benchmark.md` for methodology and local Windows results.
|
|
61
|
+
- Parsed-symbol caches are isolated by session, fs backend, resolved identity, language, and version. Every lookup still stats the file; misses validate the version again after reading. Defaults: `maxCacheEntries: 32`, `maxCacheBytes: 262144`. Cached entries are filtered for the current truncation offset. Unversioned targets are not cached; mutation/code-execution tools and session disposal clear the cache. Set `maxCacheEntries: 0` to disable it. The byte cap measures serialized payload, not JS heap usage.
|
|
62
|
+
- The official standalone `session/disposed` event releases that session's backend caches, retained references, and statistics. Plugin disposal clears remaining caches. Inspections in flight cannot repopulate caches or inject late outlines after disposal; other sessions remain isolated.
|
|
63
|
+
- `getStats(session)` returns a detached per-turn snapshot, also exposed as telemetry `summary.readGuard` (`null` when disabled). `outlineCacheLookups = outlineCacheHits + outlineCacheMisses`; `outlineCacheHitRate = hits / lookups` is in [0, 1], or `null` without lookups. Only enabled caches with valid identity/version after successful preflight count as lookups. Absent, stale, or evicted entries count as misses even if the subsequent read or parse fails. Disabled, unidentified, unversioned, and standalone local backends count as `outlineCacheBypasses`; rejected preflights count as neither. Ordinary and targeted reads do not inflate the lookup denominator.
|
|
64
|
+
- `outlineCacheInvalidations` counts mutation/bash/eval events that clear an existing session cache group, including in-flight inspections. No group means no invalidation; version mismatches count as misses, and disposal cleanup does not count as invalidation. Counters reset on `turn/start` while caches survive turns. These metrics describe local outline caching separately from provider input caching.
|
|
70
65
|
- **`edit_batch`**:
|
|
71
|
-
Sequentially applies up to 10 targeted literal text replacements across single or multiple files in one round trip
|
|
66
|
+
Sequentially applies up to 10 targeted literal text replacements across single or multiple files in one round trip, with pre-flight same-file simulation, `atomic` abort support, and automatic line-numbered recovery hints on mismatch.
|
|
72
67
|
- **Inherited Security & Sandboxing**:
|
|
73
68
|
Every sub-action is dispatched through the official `ToolExecutionPipeline` (`tool/ptc-dispatch-start` / `tool/ptc-dispatch`), preserving file policy locks, mutation guards, and audit hooks.
|
|
74
|
-
|
|
75
69
|
### 3. Defensive Runtime Policy & Self-Healing Recovery
|
|
76
70
|
|
|
77
71
|
- **No-Progress Circuit Breaker (`NO_PROGRESS`)**:
|
|
@@ -152,7 +146,7 @@ With `placement: "replace-all"`, place your directives in `~/.dsh/SYSTEM.md` (Wi
|
|
|
152
146
|
|
|
153
147
|
You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
154
148
|
|
|
155
|
-
-
|
|
149
|
+
- MUST act directly rather than speculate: investigate via concurrent tools (fs, bash, skills) without orchestration overhead.
|
|
156
150
|
- NEVER emit pre-action narration. Deliver surgical edits and high-signal conclusions.
|
|
157
151
|
- Irreversible operations (`npm publish`): STRICTLY conservative and non-autonomous. NEVER bump versions or mutate artifacts to bypass failures; registry validation causes transient 404 or stale views—NEVER treat as failure or retry publish. MUST verify remote state with read-only commands before declaring status.
|
|
158
152
|
|
|
@@ -174,13 +168,13 @@ You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
|
174
168
|
- Windows arguments & paths: use forward slashes in paths to prevent escape corruption. NEVER embed scripts or multiline code in shell arguments (`node -e`, `python -c`, `pwsh -Command`). Quote single-line patterns carefully (`ast-grep` patterns STRICTLY in single quotes `'...'` to prevent `$$` expansion). On quoting failures, switch input method rather than re-escaping.
|
|
175
169
|
- Byte-fidelity: default new text files to UTF-8. Preserve existing file encodings, BOMs, line endings, `.gitattributes`, and hook policies unless explicitly requested.
|
|
176
170
|
- Policy denials (`file access denied`, network blocked, approval disabled/rejected) are not command bugs: report; do not bypass. Request wider access via `sandbox_permissions` ONLY when escalation is explicitly available; otherwise do not retry or escalate. Diagnose ordinary lock, permission, or connectivity errors normally.
|
|
177
|
-
- Tool exclusivity: STRICTLY native `glob`/`grep`/`
|
|
171
|
+
- Tool exclusivity: STRICTLY native `glob`/`grep`/`find_and_read`/`read`/`edit_batch`/`edit`/`write`. NEVER use shell commands or redirects for workspace search or reading/writing files (`grep`, `rg`, `find`, `ls`, `dir`, `cat`, `type`, `head`, `tail`, `sed`, `awk`, `tee`, `>`/`>>`). Filtering piped command output (`cmd | grep`) and batch removing temporary artifacts (`rm -rf`) are permitted.
|
|
178
172
|
|
|
179
173
|
### Execution & Context Efficiency
|
|
180
174
|
|
|
181
175
|
- Workflow:
|
|
182
176
|
- Complexity: simple → execute; high-scope (cross-module, API, schema) → generate / follow plan (`<name>.md`); define 1–3 sentence scope and exit criteria before edits.
|
|
183
|
-
- Scheduling:
|
|
177
|
+
- Scheduling: Use `find_and_read` when searching code and inspecting surrounding lines together; batch independent `read` calls directly in parallel when exact files/ranges are known. Keep retries and dependent checks sequential.
|
|
184
178
|
- Diagnosis: inspect contiguous context in one pass; cite locators and minimal raw excerpts only as evidence.
|
|
185
179
|
- Search & navigation:
|
|
186
180
|
- Scope & environment: verify via `git rev-parse --is-inside-work-tree` when workspace boundary is ambiguous (do not probe `.git`). Probe binary availability via `which`/`command -v` ONLY when execution fails.
|
|
@@ -190,7 +184,7 @@ You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
|
190
184
|
- Modification & execution:
|
|
191
185
|
- File ops: MUST use `edit_batch` for 2+ edits (whether in one file or across multiple files); use `edit` for a single edit, and `write` for new files or ad-hoc Node/Python scripts.
|
|
192
186
|
- Staged refactor: preview, then apply — symbol renames via `lsp rename` (dry-run → `--apply`); structural rewrites via `ast-grep run -p ... -r ...` (then `-U`).
|
|
193
|
-
- Structured data & calculations: Prioritize persistent kernels (`eval_python`,
|
|
187
|
+
- Structured data & calculations: Prioritize persistent kernels (`eval_python`/`eval_node`, key stdlib pre-imported) for stateful or exploratory work; return compact summaries, never raw dumps. Deliverables/pipelines: `write` to disk, run by path; never inline code.
|
|
194
188
|
- Shell execution: run heavy tasks (`npm test`, `npm run build`, `vitest`, `npm publish`) standalone to prevent Windows deadlocks; chain lightweight commands via `&&` (`git add ... && git commit ... && git push`) to eliminate round trips.
|
|
195
189
|
- Reporting: diffs and evidence first; zero filler. Routine status ≤ 300 Chinese characters. Answer/explain/review/diagnose/plan: no length cap. Compact locators, lists, and deltas only.
|
|
196
190
|
|
package/README.zh.md
CHANGED
|
@@ -5,40 +5,20 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/dsh-awesome-optimizer)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://github.com/Jaylor-Wang/dsh-awesome-optimizer/releases)
|
|
8
|
-
[](test/)
|
|
9
9
|
[](src/)
|
|
10
10
|
|
|
11
11
|
围绕官方 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (`@deepseek-ai/dsh-agent-loop`) 打造的高性能运行时策略防护、持久化 Python/Node 执行内核、PTC 复合批处理工具、全新独立系统提示词接管与客观 A/B 轮次度量插件。
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
##
|
|
15
|
+
## v3.3.0 HTTP 缓存诊断与编辑预检修复
|
|
16
16
|
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
纯表达式极简单行输出(`=> 42`),剔除多余首尾换行,平滑 IEEE-754 浮点二进制噪声(`0.1 + 0.2` -> `=> 0.3`),杜绝无效 Token 占用 Prefill 窗口。
|
|
23
|
-
- **动态引用计数与 Cordis 级联释放(Ref/Unref & Lifecycle Cascading)**:
|
|
24
|
-
基于 Node.js libuv 管道流的动态引用计数(`_ref` / `_unref`),确保在任务执行期间稳定守卫,任务完成后释放事件循环强引用,杜绝孤儿进程与退出超时挂起。
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## v2.0.0 版本重大里程碑更新
|
|
29
|
-
|
|
30
|
-
- **持久化 Python 与 Node 执行内核 (`eval_python` / `eval_node`)**:
|
|
31
|
-
引入基于轻量级 stdio 行定界 JSON 协议帧的双语常驻守护引擎,**零外部依赖**(无需 `ipykernel`、`pyzmq` 等重型外部包)。在会话生命周期内跨调用保留全局变量、导入模块、类与函数,支持 Node 顶层 `await`。将算法、逆运动学与几何试算单次延迟从 37ms 直接压降至 **0.61ms(提速 98.5%)**,彻底终结多轮试算频繁向磁盘落盘临时脚本的损耗与文件污染。
|
|
32
|
-
- **三大极致性能提速升级**:
|
|
33
|
-
1. **后台静默预热(Pre-warming Daemon)**:监听 `turn/start` 会话事件,在模型生成首个 Token 的思考间隙预先握手拉起子进程,消除首次 80ms 冷启尖刺;
|
|
34
|
-
2. **核心算法库预注入(Eager Scope Ingestion)**:默认在 Python 全局命名空间预载 `math, re, json, time, collections, itertools`,省去繁冗 `import` 代码,显著降低 LLM Token 消耗;
|
|
35
|
-
3. **输出极致紧凑压缩(Zero-Token-Waste Formatting)**:纯表达式求值单行紧凑返回(`=> 42`),剔除尾部多余换行,智能抹平 IEEE-754 二进制浮点噪声(如 `0.30000000000000004` -> `0.3`),为 LLM Prefill 阶段省出宝贵上下文。
|
|
36
|
-
- **看门狗超时强杀与自愈热重启 (Watchdog & Self-Healing)**:
|
|
37
|
-
内置细粒度硬执行看门狗。当代码陷入死循环(如 `while True:`)或阻塞输入超时(默认 15s)后,主进程永不卡死挂起,跨平台强杀卡死子进程树并自动拉起新生干净实例,后续排队任务零感平滑恢复。
|
|
38
|
-
- **上下文防冲爆守卫 (Anti-Dumping Interceptor)**:
|
|
39
|
-
在工具管道层对输出实施 8KB 阈值截断并追加引导落盘说明,与 `NEVER dump raw data into context` 规则深度协同,彻底杜绝超大输出冲爆 LLM 上下文。
|
|
40
|
-
- **心智分流规约升维**:
|
|
41
|
-
在 `SYSTEM.md` 与 Custom Prompt 中确立“探索性解算/数据筛选优先走持久内核,工程交付物必须通过 native `write` 落盘”的最高指令分流契约。
|
|
17
|
+
- **可选 HTTP 缓存诊断**:为 OpenAI 兼容的 `/chat/completions` [记录请求哈希与上游原始 usage](cache-diagnostics.md),跨轮比较消息前缀和配置。缓存字段缺失与显式零值分别保留;不记录提示词、回复、图片字节或凭据。
|
|
18
|
+
- **诊断边界与故障隔离**:异步日志限制文件大小和队列容量,释放时等待写入完成,失败时仅警告一次并停止诊断。初始化失败不影响 telemetry;保留响应 URL、重定向、类型及克隆元数据。
|
|
19
|
+
- **准确的前缀检测**:重新计算消息摘要,识别消息替换、原地修改和跨轮变化,消除按对象身份缓存摘要造成的盲区。
|
|
20
|
+
- **严格的批量编辑预检**:派发编辑前拒绝空匹配串及新旧内容相同的替换,使 atomic 预检与原生编辑校验保持一致。
|
|
21
|
+
- **验证**:160 项测试通过,公开声明类型检查通过,无新增包依赖。
|
|
42
22
|
|
|
43
23
|
---
|
|
44
24
|
|
|
@@ -65,13 +45,27 @@
|
|
|
65
45
|
|
|
66
46
|
### 2. PTC 原生复合批处理工具 (`compositeTools`)
|
|
67
47
|
|
|
68
|
-
- **`
|
|
69
|
-
|
|
48
|
+
- **`find_and_read`**:
|
|
49
|
+
单次并行执行 1~5 条正则 `grep`,保留正则原始空白语义,自动合并并拆分邻近命中区间,经原生管线分批 `read`,一跳替代 `grep → 等待 → read`。完整返回文本(含标题、错误、索引和省略说明)受 `maxTotalBytes` 硬限制,默认 24KB;优先保留命中行,未展示位置降级为索引,索引也放不下时明确计数。上游截断、模式失败、匹配总数及可容纳的恢复定位会显式保留。
|
|
50
|
+
- `maxWindowLines: 120`:单次切片最多请求的行数,防止密集命中连锁合并为整文件读取。
|
|
51
|
+
- `maxReadLines: 600`:单次调用累计请求行数上限,包含多个文件及窗口。
|
|
52
|
+
- `readConcurrency: 3`:每批最多同时读取的窗口数;每批完成后重新核算输出空间,空间不足时停止后续读取。原生读取自身截断所隐藏的命中仍进入索引。
|
|
53
|
+
- 窗口按尚未覆盖的正则数优先选择,再考虑重复模式的边际收益、行数成本及文件多样性;同分时按规范路径与行号稳定排序。`maxFiles` 限制实际选中的文件,不提前排除其他文件中的高价值窗口。
|
|
54
|
+
- 以上是行数与输出字节上限,不代表底层读取字节数或 Token 的固定换算。
|
|
55
|
+
- **`readGuard` 读取前检查**:
|
|
56
|
+
仅对支持的大纲语言执行附加检查;先经 fs 服务解析路径、检查文件类型与大小,再优先使用有界 `readBytes` 或文本流。超过 `maxInspectBytes`(默认 512KB)、取消、文件不存在或服务拒绝访问时跳过大纲,不改写原生读取结果。服务失败后不回退到本地磁盘;旧版仅有 `readText` 的服务在大小检查通过后兼容读取,仍受文件检查后变大的竞态限制。
|
|
57
|
+
- 默认 `astOutline: "auto"`:普通文件用轻量词法扫描;JSX/TSX、TS 装饰器/导出命名空间以及存在声明但词法结果为空的文件按需调用 ast-grep。可设 `"off"` 禁用或 `"always"` 对支持语言强制使用 AST。词法扫描支持 JS/TS/Python/Go/Rust 跨行声明、局部箭头与 Unicode 标识符;两级结果均优先顶层导出并在尾部采样。
|
|
58
|
+
- AST 只从 stdin 接收 fs 已校验的内容快照,不让 CLI 读取目标路径;使用插件内固定配置、禁用自定义语言库且不经 shell。`astTimeoutMs: 750`、`astMaxOutputBytes: 262144` 限制耗时与输出;取消会终止子进程,缺少 CLI/超时/失败时回退词法结果。`astGrepCommand` 可指定可执行文件名或绝对路径;需要支持 `outline --stdin --json` 的 ast-grep。
|
|
59
|
+
- 当前 ast-grep 内置规则只提供 TS 命名空间本身;命名空间内部保留词法识别的子声明,避免丢失导航位置。AST 成功结果及失败后的词法结果一起进入版本 LRU,同一文件版本的后续盲读不会再次启动 CLI;版本变化、写入或缓存淘汰后可重新尝试。可通过 `astAttempts/astSucceeded/astFallbacks/astTimeouts/outlineCacheHits` 统计验证。
|
|
60
|
+
- Windows 测量可运行 `npm run benchmark:outline -- outline-benchmark.windows.json`:真实 CLI、20 次重复样本,分别报告首次调用、未缓存重复解析、词法路径与版本缓存命中;详细方法和本机结果见 `outline-benchmark.md`。
|
|
61
|
+
- 大纲缓存按会话、fs 后端、解析后的文件身份、语言与版本隔离,每次仍执行 stat,首次读取后再次验证版本。默认 `maxCacheEntries: 32`、`maxCacheBytes: 262144`,缓存符号条目并按当前截断位置筛选;无可靠版本时不缓存,写入/编辑/执行代码及会话销毁会清除缓存,`maxCacheEntries: 0` 可关闭缓存。字节上限按序列化缓存载荷计,不等于 JS 堆占用。
|
|
62
|
+
- 通过官方独立的 `session/disposed` 事件释放该会话所有后端缓存、强引用与统计;插件卸载清空剩余缓存。释放期间的检查不会重新填充缓存或注入迟到的大纲,其他会话不受影响。
|
|
63
|
+
- `getStats(session)` 返回独立的每轮统计快照,统一 telemetry 的 `summary.readGuard` 同步提供,禁用 readGuard 时为 `null`。`outlineCacheLookups = outlineCacheHits + outlineCacheMisses`,`outlineCacheHitRate = hits / lookups`(0–1,无查询时为 `null`)。只有预检成功、缓存启用且文件身份/版本有效才计入查询;不存在、过期、被淘汰的条目均算 miss,后续读取或解析失败仍保留 miss。禁用、无身份/版本或本地独立后端计为 `outlineCacheBypasses`,预检拒绝不计查询或 bypass;普通/定向 read 不进入大纲查询分母。
|
|
64
|
+
- `outlineCacheInvalidations` 统计清除已有会话缓存组(包括进行中的检查)的写入/编辑/bash/eval 事件次数;无缓存组时不计,版本不匹配计 miss,释放清理不计失效。统计在 `turn/start` 重置,缓存可跨轮复用。这些指标只描述本地大纲缓存,与模型输入缓存命中率分别计算。
|
|
70
65
|
- **`edit_batch`**:
|
|
71
|
-
支持单次顺序执行最多 10
|
|
66
|
+
支持单次顺序执行最多 10 处跨单个或多个文件的字面量精准文本替换,内置同文件内存预演校验、`atomic` 原子中止及匹配失败行号自愈提示。
|
|
72
67
|
- **原生沙箱与安全事务继承**:
|
|
73
68
|
所有子操作均通过官方 `ToolExecutionPipeline` (`tool/ptc-dispatch-start` / `tool/ptc-dispatch`) 分发,完整保留 DSH 沙箱权限判定、文件变更审核与观察策略钩子。
|
|
74
|
-
|
|
75
69
|
### 3. 运行期硬防护与失败自愈机制
|
|
76
70
|
|
|
77
71
|
- **连续无进展失败熔断 (`NO_PROGRESS`)**:
|
|
@@ -152,7 +146,7 @@ pnpm add dsh-awesome-optimizer
|
|
|
152
146
|
|
|
153
147
|
You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
154
148
|
|
|
155
|
-
-
|
|
149
|
+
- MUST act directly rather than speculate: investigate via concurrent tools (fs, bash, skills) without orchestration overhead.
|
|
156
150
|
- NEVER emit pre-action narration. Deliver surgical edits and high-signal conclusions.
|
|
157
151
|
- Irreversible operations (`npm publish`): STRICTLY conservative and non-autonomous. NEVER bump versions or mutate artifacts to bypass failures; registry validation causes transient 404 or stale views—NEVER treat as failure or retry publish. MUST verify remote state with read-only commands before declaring status.
|
|
158
152
|
|
|
@@ -174,13 +168,13 @@ You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
|
174
168
|
- Windows arguments & paths: use forward slashes in paths to prevent escape corruption. NEVER embed scripts or multiline code in shell arguments (`node -e`, `python -c`, `pwsh -Command`). Quote single-line patterns carefully (`ast-grep` patterns STRICTLY in single quotes `'...'` to prevent `$$` expansion). On quoting failures, switch input method rather than re-escaping.
|
|
175
169
|
- Byte-fidelity: default new text files to UTF-8. Preserve existing file encodings, BOMs, line endings, `.gitattributes`, and hook policies unless explicitly requested.
|
|
176
170
|
- Policy denials (`file access denied`, network blocked, approval disabled/rejected) are not command bugs: report; do not bypass. Request wider access via `sandbox_permissions` ONLY when escalation is explicitly available; otherwise do not retry or escalate. Diagnose ordinary lock, permission, or connectivity errors normally.
|
|
177
|
-
- Tool exclusivity: STRICTLY native `glob`/`grep`/`
|
|
171
|
+
- Tool exclusivity: STRICTLY native `glob`/`grep`/`find_and_read`/`read`/`edit_batch`/`edit`/`write`. NEVER use shell commands or redirects for workspace search or reading/writing files (`grep`, `rg`, `find`, `ls`, `dir`, `cat`, `type`, `head`, `tail`, `sed`, `awk`, `tee`, `>`/`>>`). Filtering piped command output (`cmd | grep`) and batch removing temporary artifacts (`rm -rf`) are permitted.
|
|
178
172
|
|
|
179
173
|
### Execution & Context Efficiency
|
|
180
174
|
|
|
181
175
|
- Workflow:
|
|
182
176
|
- Complexity: simple → execute; high-scope (cross-module, API, schema) → generate / follow plan (`<name>.md`); define 1–3 sentence scope and exit criteria before edits.
|
|
183
|
-
- Scheduling:
|
|
177
|
+
- Scheduling: Use `find_and_read` when searching code and inspecting surrounding lines together; batch independent `read` calls directly in parallel when exact files/ranges are known. Keep retries and dependent checks sequential.
|
|
184
178
|
- Diagnosis: inspect contiguous context in one pass; cite locators and minimal raw excerpts only as evidence.
|
|
185
179
|
- Search & navigation:
|
|
186
180
|
- Scope & environment: verify via `git rev-parse --is-inside-work-tree` when workspace boundary is ambiguous (do not probe `.git`). Probe binary availability via `which`/`command -v` ONLY when execution fails.
|
|
@@ -190,7 +184,7 @@ You are a master autonomous software engineer powered by DeepSeek Harness.
|
|
|
190
184
|
- Modification & execution:
|
|
191
185
|
- File ops: MUST use `edit_batch` for 2+ edits (whether in one file or across multiple files); use `edit` for a single edit, and `write` for new files or ad-hoc Node/Python scripts.
|
|
192
186
|
- Staged refactor: preview, then apply — symbol renames via `lsp rename` (dry-run → `--apply`); structural rewrites via `ast-grep run -p ... -r ...` (then `-U`).
|
|
193
|
-
- Structured data & calculations: Prioritize persistent kernels (`eval_python`,
|
|
187
|
+
- Structured data & calculations: Prioritize persistent kernels (`eval_python`/`eval_node`, key stdlib pre-imported) for stateful or exploratory work; return compact summaries, never raw dumps. Deliverables/pipelines: `write` to disk, run by path; never inline code.
|
|
194
188
|
- Shell execution: run heavy tasks (`npm test`, `npm run build`, `vitest`, `npm publish`) standalone to prevent Windows deadlocks; chain lightweight commands via `&&` (`git add ... && git commit ... && git push`) to eliminate round trips.
|
|
195
189
|
- Reporting: diffs and evidence first; zero filler. Routine status ≤ 300 Chinese characters. Answer/explain/review/diagnose/plan: no length cap. Compact locators, lists, and deltas only.
|
|
196
190
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# HTTP cache diagnostics
|
|
2
|
+
|
|
3
|
+
Set `telemetry.cacheDiagnosticsPath` to an absolute JSONL filename and reload the plugin or restart DSH. Omit the setting to disable. The observer uses AsyncLocalStorage around LLM stream iteration and a shared, reference-counted global fetch wrapper; calls outside an enabled session scope are untouched. No installed DSH files are modified.
|
|
4
|
+
|
|
5
|
+
Supported capture: OpenAI-compatible `/chat/completions` requests with a string JSON body using global fetch. Other protocols, custom transports, Request-object bodies and requests without session IDs are not captured. Absence of a log record is not evidence of cache stability.
|
|
6
|
+
|
|
7
|
+
Request records contain SHA-256 digests for each serialized message, tools, cache key, the remaining request configuration and endpoint; session IDs are hashed. The previous request link and first differing message index compare the same session/endpoint/model across turns. The first request has unknown stability. Message-level equality does not prove the provider's internal token prefix or caching policy. Configuration comparison includes stream/generation settings, so a change is evidence to inspect, not necessarily a cache cause.
|
|
8
|
+
|
|
9
|
+
Response records contain status and allowlisted request IDs. Usage records contain only allowlisted numeric upstream counters and constrained response/model/system-fingerprint identifiers. A missing cached_tokens field remains missing; zero remains zero. Prompt text, generated text, image bytes, credentials and arbitrary headers are never logged. Original response chunks pass through a bounded TransformStream without a cloned-response buffer. Cancellation and transport errors propagate. Do not treat an incomplete/unsupported capture as zero cache usage.
|
|
10
|
+
|
|
11
|
+
Limits: 8 MiB per log file, a 256 KiB asynchronous write queue, 128 previous session/route entries, and 1 MiB per buffered SSE event or JSON response. Reaching either log/queue limit stops capture and emits one host warning; use a new log path and reload to resume. Queued writes drain on disposal. Write failure stops capture with one warning; initialization failure disables diagnostics while preserving telemetry. Oversized events emit capture-gap and stop parsing that response. Response URL, redirected/type metadata and clone metadata are preserved. No automatic retry or inference warmup occurs. A restart/reload is required after source changes; configuration on disk alone does not prove the running process loaded the observer.
|
|
12
|
+
|
|
13
|
+
Interpretation:
|
|
14
|
+
- prefixStable=false: inspect the first changed message and request conversion.
|
|
15
|
+
- Stable messages/config plus absent cache counters: investigate gateway usage reporting.
|
|
16
|
+
- Stable messages/config plus explicit zero: investigate provider routing, retention and eviction; this alone does not prove a provider defect.
|
|
17
|
+
- Model/endpoint changes start a new comparison baseline.
|
|
18
|
+
|
|
19
|
+
The current Web profile is linked to this checkout. Local diagnostics should be stored outside the repository, e.g. `C:/Users/29507/.dsh/diagnostics/cache-http.jsonl`. After restart, verify a request/response/usage sequence during normal usage before relying on the capture. No paid inference requests are needed for unit verification.
|
package/cordis.patch.yml
CHANGED
|
@@ -16,11 +16,23 @@
|
|
|
16
16
|
mode: observe
|
|
17
17
|
minLargeWriteBytes: 8192
|
|
18
18
|
recoverFailedWrites: true
|
|
19
|
+
editRecovery:
|
|
20
|
+
enabled: true
|
|
21
|
+
contextLines: 6
|
|
22
|
+
maxSnippetLines: 20
|
|
23
|
+
readGuard:
|
|
24
|
+
enabled: true
|
|
25
|
+
maxLineChars: 1500
|
|
26
|
+
injectTailOutline: true
|
|
27
|
+
maxOutlineEntries: 20
|
|
19
28
|
compositeTools:
|
|
20
29
|
enabled: true
|
|
21
|
-
|
|
30
|
+
findAndRead: true
|
|
22
31
|
editBatch: true
|
|
23
|
-
|
|
32
|
+
maxPatterns: 5
|
|
33
|
+
defaultContextLines: 5
|
|
34
|
+
maxFiles: 5
|
|
35
|
+
maxWindows: 10
|
|
24
36
|
maxBatchEdits: 10
|
|
25
37
|
convergence:
|
|
26
38
|
enabled: true
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AST 大纲 Windows 测量
|
|
2
|
+
|
|
3
|
+
## 复现
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm run benchmark:outline -- outline-benchmark.windows.json
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
需要 PATH 上提供支持 `outline --stdin --json` 的 ast-grep;本次使用会话中安装的 ast-grep 0.51+。脚本调用实际 readGuard 钩子和实际 CLI,不经过网络或模型。每组先记录第一次调用,再采集 20 个重复样本;所有样本均检查输出包含预期符号,最后断言 AST 次数、内容读取次数和缓存命中次数。
|
|
10
|
+
|
|
11
|
+
原始结果保存在 `outline-benchmark.windows.json`。环境为 Windows x64(10.0.26300)、Node.js v24.21.0。时间戳取宿主系统时钟,不代表测试时钟经过独立校准。
|
|
12
|
+
|
|
13
|
+
## 实测结果
|
|
14
|
+
|
|
15
|
+
| 路径 | 首次调用 ms | 重复中位数 ms | 重复 p95 ms | 21 次调用的内容读取 / AST 启动 |
|
|
16
|
+
| --- | ---: | ---: | ---: | ---: |
|
|
17
|
+
| 2,912B TSX,关闭缓存,每次 AST | 67.468 | 51.269 | 56.480 | 21 / 21 |
|
|
18
|
+
| 同一 TSX,关闭 AST 和缓存 | 0.211 | 0.159 | 0.207 | 21 / 0 |
|
|
19
|
+
| 2,628B 普通 TS,auto、关闭缓存 | 0.352 | 0.185 | 0.225 | 21 / 0 |
|
|
20
|
+
| 2,912B TSX,auto、启用版本缓存 | 50.113 | 0.009 | 0.019 | 1 / 1 |
|
|
21
|
+
| 142,112B、2,444 行 TSX,auto、启用版本缓存 | 58.648 | 0.055 | 0.068 | 1 / 1 |
|
|
22
|
+
|
|
23
|
+
启用缓存的两组均记录了 20 次版本缓存命中。每次命中仍执行 resolve/stat;首次内容读取后再执行一次 stat,21 次调用共 22 次 stat。
|
|
24
|
+
|
|
25
|
+
## 方法与限制
|
|
26
|
+
|
|
27
|
+
- 首组首次调用是本次 benchmark Node 进程的第一次 ast-grep 启动。未清空 Windows 文件缓存,也没有重启系统,因此不是系统冷启动或冷磁盘测量。
|
|
28
|
+
- 未缓存的重复 AST 样本每次启动新的 CLI,是操作系统已热身后的进程启动加解析成本,没有持久 AST worker。
|
|
29
|
+
- fs 使用内存中的版本化内容来隔离 CLI/解析成本。缓存命中包含 readGuard 处理、路径解析、内存 stat、符号筛选和渲染;真实磁盘、远程 fs、网络 stat 会增加延迟。
|
|
30
|
+
- 大样本通过注释填充扩大快照,代表读取/传输体积变化,不代表复杂 AST 或大量符号的最坏情况。CLI 默认输出上限 256KiB,达到上限会回退词法结果。
|
|
31
|
+
- 这些数据不能换算成真实模型任务的固定加速比例或 Token 节省比例;词法与 AST 的信息质量也不完全等价。AST 的 JSX 字符串误报排除、成员行号等由回归测试另行验证。
|
|
32
|
+
|
|
33
|
+
## 配置结论
|
|
34
|
+
|
|
35
|
+
默认 `astOutline: "auto"`:普通文件保留词法路径,已知词法薄弱场景按需使用 AST。同一可缓存文件版本只需启动一次 CLI。默认 750ms 截止时间高于本次观测值,为 Windows 调度留出余量;超时、CLI 不可用、无效输出或输出超限均回退词法结果,失败结果同样按文件版本缓存以避免重复启动。`astOutline: "off"` 可完全关闭,`"always"` 可要求所有支持语言使用 AST。
|
|
36
|
+
|
|
37
|
+
当前 ast-grep 内置 outline 规则不返回 TS 命名空间子声明;实现保留 AST 确认的命名空间范围内的词法子条目。该部分属于组合导航结果,不能声称所有条目都经过 AST 独立提取。
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"measuredAt": "2026-11-16T13:27:33.111Z",
|
|
3
|
+
"platform": "win32",
|
|
4
|
+
"architecture": "x64",
|
|
5
|
+
"osRelease": "10.0.26300",
|
|
6
|
+
"node": "v24.21.0",
|
|
7
|
+
"sourceBytes": 2912,
|
|
8
|
+
"sourceLines": 44,
|
|
9
|
+
"ordinarySourceBytes": 2628,
|
|
10
|
+
"ordinarySourceLines": 41,
|
|
11
|
+
"methodology": "Real ast-grep CLI over stdin; in-memory versioned fs isolates parsing/spawn cost. First invocation is process-cold, not a flushed OS disk cache. Repeated uncached samples launch a fresh CLI each time. Cache hits include resolve/stat and rendering but no content read or process. No network or model calls.",
|
|
12
|
+
"astUncached": {
|
|
13
|
+
"firstMs": 67.468,
|
|
14
|
+
"firstCounts": {
|
|
15
|
+
"contentReads": 1,
|
|
16
|
+
"statCalls": 2,
|
|
17
|
+
"inspected": 1,
|
|
18
|
+
"linesTruncated": 0,
|
|
19
|
+
"outlinesInjected": 1,
|
|
20
|
+
"outlineCacheHits": 0,
|
|
21
|
+
"astAttempts": 1,
|
|
22
|
+
"astSucceeded": 1,
|
|
23
|
+
"astFallbacks": 0,
|
|
24
|
+
"astTimeouts": 0
|
|
25
|
+
},
|
|
26
|
+
"repeated": {
|
|
27
|
+
"samples": 20,
|
|
28
|
+
"minMs": 48.91,
|
|
29
|
+
"medianMs": 51.269,
|
|
30
|
+
"p95Ms": 56.48,
|
|
31
|
+
"maxMs": 57.3
|
|
32
|
+
},
|
|
33
|
+
"finalCounts": {
|
|
34
|
+
"contentReads": 21,
|
|
35
|
+
"statCalls": 42,
|
|
36
|
+
"inspected": 21,
|
|
37
|
+
"linesTruncated": 0,
|
|
38
|
+
"outlinesInjected": 21,
|
|
39
|
+
"outlineCacheHits": 0,
|
|
40
|
+
"astAttempts": 21,
|
|
41
|
+
"astSucceeded": 21,
|
|
42
|
+
"astFallbacks": 0,
|
|
43
|
+
"astTimeouts": 0
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"lexical": {
|
|
47
|
+
"firstMs": 0.211,
|
|
48
|
+
"firstCounts": {
|
|
49
|
+
"contentReads": 1,
|
|
50
|
+
"statCalls": 2,
|
|
51
|
+
"inspected": 1,
|
|
52
|
+
"linesTruncated": 0,
|
|
53
|
+
"outlinesInjected": 1,
|
|
54
|
+
"outlineCacheHits": 0,
|
|
55
|
+
"astAttempts": 0,
|
|
56
|
+
"astSucceeded": 0,
|
|
57
|
+
"astFallbacks": 0,
|
|
58
|
+
"astTimeouts": 0
|
|
59
|
+
},
|
|
60
|
+
"repeated": {
|
|
61
|
+
"samples": 20,
|
|
62
|
+
"minMs": 0.112,
|
|
63
|
+
"medianMs": 0.159,
|
|
64
|
+
"p95Ms": 0.207,
|
|
65
|
+
"maxMs": 0.429
|
|
66
|
+
},
|
|
67
|
+
"finalCounts": {
|
|
68
|
+
"contentReads": 21,
|
|
69
|
+
"statCalls": 42,
|
|
70
|
+
"inspected": 21,
|
|
71
|
+
"linesTruncated": 0,
|
|
72
|
+
"outlinesInjected": 21,
|
|
73
|
+
"outlineCacheHits": 0,
|
|
74
|
+
"astAttempts": 0,
|
|
75
|
+
"astSucceeded": 0,
|
|
76
|
+
"astFallbacks": 0,
|
|
77
|
+
"astTimeouts": 0
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"autoOrdinary": {
|
|
81
|
+
"firstMs": 0.352,
|
|
82
|
+
"firstCounts": {
|
|
83
|
+
"contentReads": 1,
|
|
84
|
+
"statCalls": 2,
|
|
85
|
+
"inspected": 1,
|
|
86
|
+
"linesTruncated": 0,
|
|
87
|
+
"outlinesInjected": 1,
|
|
88
|
+
"outlineCacheHits": 0,
|
|
89
|
+
"astAttempts": 0,
|
|
90
|
+
"astSucceeded": 0,
|
|
91
|
+
"astFallbacks": 0,
|
|
92
|
+
"astTimeouts": 0
|
|
93
|
+
},
|
|
94
|
+
"repeated": {
|
|
95
|
+
"samples": 20,
|
|
96
|
+
"minMs": 0.097,
|
|
97
|
+
"medianMs": 0.185,
|
|
98
|
+
"p95Ms": 0.225,
|
|
99
|
+
"maxMs": 0.273
|
|
100
|
+
},
|
|
101
|
+
"finalCounts": {
|
|
102
|
+
"contentReads": 21,
|
|
103
|
+
"statCalls": 42,
|
|
104
|
+
"inspected": 21,
|
|
105
|
+
"linesTruncated": 0,
|
|
106
|
+
"outlinesInjected": 21,
|
|
107
|
+
"outlineCacheHits": 0,
|
|
108
|
+
"astAttempts": 0,
|
|
109
|
+
"astSucceeded": 0,
|
|
110
|
+
"astFallbacks": 0,
|
|
111
|
+
"astTimeouts": 0
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"astCached": {
|
|
115
|
+
"firstMs": 50.113,
|
|
116
|
+
"firstCounts": {
|
|
117
|
+
"contentReads": 1,
|
|
118
|
+
"statCalls": 2,
|
|
119
|
+
"inspected": 1,
|
|
120
|
+
"linesTruncated": 0,
|
|
121
|
+
"outlinesInjected": 1,
|
|
122
|
+
"outlineCacheHits": 0,
|
|
123
|
+
"astAttempts": 1,
|
|
124
|
+
"astSucceeded": 1,
|
|
125
|
+
"astFallbacks": 0,
|
|
126
|
+
"astTimeouts": 0
|
|
127
|
+
},
|
|
128
|
+
"repeated": {
|
|
129
|
+
"samples": 20,
|
|
130
|
+
"minMs": 0.008,
|
|
131
|
+
"medianMs": 0.009,
|
|
132
|
+
"p95Ms": 0.019,
|
|
133
|
+
"maxMs": 0.034
|
|
134
|
+
},
|
|
135
|
+
"finalCounts": {
|
|
136
|
+
"contentReads": 1,
|
|
137
|
+
"statCalls": 22,
|
|
138
|
+
"inspected": 21,
|
|
139
|
+
"linesTruncated": 0,
|
|
140
|
+
"outlinesInjected": 21,
|
|
141
|
+
"outlineCacheHits": 20,
|
|
142
|
+
"astAttempts": 1,
|
|
143
|
+
"astSucceeded": 1,
|
|
144
|
+
"astFallbacks": 0,
|
|
145
|
+
"astTimeouts": 0
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"astLarge": {
|
|
149
|
+
"sourceBytes": 142112,
|
|
150
|
+
"sourceLines": 2444,
|
|
151
|
+
"firstMs": 58.648,
|
|
152
|
+
"firstCounts": {
|
|
153
|
+
"contentReads": 1,
|
|
154
|
+
"statCalls": 2,
|
|
155
|
+
"inspected": 1,
|
|
156
|
+
"linesTruncated": 0,
|
|
157
|
+
"outlinesInjected": 1,
|
|
158
|
+
"outlineCacheHits": 0,
|
|
159
|
+
"astAttempts": 1,
|
|
160
|
+
"astSucceeded": 1,
|
|
161
|
+
"astFallbacks": 0,
|
|
162
|
+
"astTimeouts": 0
|
|
163
|
+
},
|
|
164
|
+
"repeated": {
|
|
165
|
+
"samples": 20,
|
|
166
|
+
"minMs": 0.05,
|
|
167
|
+
"medianMs": 0.055,
|
|
168
|
+
"p95Ms": 0.068,
|
|
169
|
+
"maxMs": 0.082
|
|
170
|
+
},
|
|
171
|
+
"finalCounts": {
|
|
172
|
+
"contentReads": 1,
|
|
173
|
+
"statCalls": 22,
|
|
174
|
+
"inspected": 21,
|
|
175
|
+
"linesTruncated": 0,
|
|
176
|
+
"outlinesInjected": 21,
|
|
177
|
+
"outlineCacheHits": 20,
|
|
178
|
+
"astAttempts": 1,
|
|
179
|
+
"astSucceeded": 1,
|
|
180
|
+
"astFallbacks": 0,
|
|
181
|
+
"astTimeouts": 0
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-awesome-optimizer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Runtime policy guards, composite batch tooling, persistent Python & Node eval daemons, soft convergence guidance, reactive custom prompt engine, and A/B telemetry plugin for the official DeepSeek Harness (dsh) agent loop.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -22,6 +22,14 @@
|
|
|
22
22
|
"types": "./src/failure-recovery.d.ts",
|
|
23
23
|
"default": "./src/failure-recovery.js"
|
|
24
24
|
},
|
|
25
|
+
"./edit-recovery": {
|
|
26
|
+
"types": "./src/edit-recovery.d.ts",
|
|
27
|
+
"default": "./src/edit-recovery.js"
|
|
28
|
+
},
|
|
29
|
+
"./read-guard": {
|
|
30
|
+
"types": "./src/read-guard.d.ts",
|
|
31
|
+
"default": "./src/read-guard.js"
|
|
32
|
+
},
|
|
25
33
|
"./composite-tools": {
|
|
26
34
|
"types": "./src/composite-tools.d.ts",
|
|
27
35
|
"default": "./src/composite-tools.js"
|
|
@@ -51,8 +59,12 @@
|
|
|
51
59
|
"locale/*.json",
|
|
52
60
|
"scripts/typecheck.mjs",
|
|
53
61
|
"scripts/benchmark.mjs",
|
|
62
|
+
"scripts/benchmark-outline.mjs",
|
|
54
63
|
"README.md",
|
|
55
64
|
"README.zh.md",
|
|
65
|
+
"cache-diagnostics.md",
|
|
66
|
+
"outline-benchmark.md",
|
|
67
|
+
"outline-benchmark.windows.json",
|
|
56
68
|
"LICENSE"
|
|
57
69
|
],
|
|
58
70
|
"dsh": {
|
|
@@ -67,7 +79,8 @@
|
|
|
67
79
|
"setup:local": "node scripts/setup-local.mjs",
|
|
68
80
|
"test": "node --test --test-concurrency=1 --test-timeout=10000 test/*.test.js",
|
|
69
81
|
"typecheck": "node scripts/typecheck.mjs",
|
|
70
|
-
"benchmark": "node scripts/benchmark.mjs"
|
|
82
|
+
"benchmark": "node scripts/benchmark.mjs",
|
|
83
|
+
"benchmark:outline": "node scripts/benchmark-outline.mjs"
|
|
71
84
|
},
|
|
72
85
|
"author": "Jaylor-Wang",
|
|
73
86
|
"license": "MIT",
|