dsh-hashline-edit 0.4.0 → 0.4.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.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Hash-anchored file editing for [DeepSeek Harness](https://github.com/deepseek-ai) (dsh) on Windows.
4
4
 
5
- `dsh-hashline-edit` is a dsh bundle that shadows the host's built-in `read` with hash-anchored output and offers two write tools over the same served rows: `apply_patch` for Codex patch documents and `edit` for anchored range edits. The host's built-in `write` stays visible and is integrated by the write hook; while either plugin write tool is registered, the native `edit`/`str_replace_editor`/`apply_patch` surface is hidden. There is no pi host support, because this package targets DeepSeek Harness only. Every line a served read shows carries a stable 3- or 4-character base62 anchor (`A–Z`, `a–z`, `0–9`; the width is a build-time setting, see [Anchor width](#anchor-width)) derived from the file's canonical path and the line's content. `apply_patch` hunks either name served anchors or match file content; every `edit` item names served anchors. The model never re-types existing code. Anchors for unchanged lines stay stable across edits, and every successful mutation returns fresh anchors for the changed lines, so chained calls need no re-read.
5
+ `dsh-hashline-edit` is a dsh bundle that shadows the host's built-in `read` with hash-anchored output and offers two write tools over the same served rows: `apply_patch` for Codex patch documents and `edit` for anchored range edits. The host's built-in `write` stays visible and is integrated by the write hook; each replacement hides only its own native counterpart — registering `apply_patch` hides the native `apply_patch`, and registering `edit` hides the native `edit`/`str_replace_editor`. There is no pi host support, because this package targets DeepSeek Harness only. Every line a served read shows carries a stable 3- or 4-character base62 anchor (`A–Z`, `a–z`, `0–9`; the width is a build-time setting, see [Anchor width](#anchor-width)) derived from the file's canonical path and the line's content. `apply_patch` hunks either name served anchors or match file content; every `edit` item names served anchors. The model never re-types existing code. Anchors for unchanged lines stay stable across edits, and every successful mutation returns fresh anchors for the changed lines, so chained calls need no re-read.
6
6
 
7
7
  The semantic core is the [pi-better-edit](https://github.com/Rianico/pi-better-edit) v2.16.0 hashline engine (MIT), carried as an internal engine; the pi host integration has been removed. The `dsh/` tree is this repository's DeepSeek Harness host layer: tool registration, filesystem bridge, UTF-8-only admission, prompt guidance, shell integration, write integration and telemetry. See [`dsh/README.md`](dsh/README.md) for the host-layer map.
8
8
 
@@ -13,7 +13,7 @@ The semantic core is the [pi-better-edit](https://github.com/Rianico/pi-better-e
13
13
  | OS | Windows — this branch targets Windows only (see [`dsh/UPSTREAM.md`](dsh/UPSTREAM.md)) |
14
14
  | Node.js | ≥ 24.0.0 |
15
15
  | pnpm | 12.x |
16
- | DeepSeek Harness | plugin-capable build; the repository is developed against `@deepseek-ai/dsh-*@0.2.2-rc.1` (host packages are declared as peer dependencies) |
16
+ | DeepSeek Harness | plugin-capable build; developed and tested against **DSH 0.2.2-rc.3**; host packages are declared as peer dependencies with range `>=0.2.2-rc.1 <0.2.3-0` |
17
17
 
18
18
  ### Anchor width (3 or 4)
19
19
 
package/lib/index.js CHANGED
@@ -1391,7 +1391,7 @@ function assertRange(offset, length) {
1391
1391
  }
1392
1392
 
1393
1393
  // dsh/hide.ts
1394
- var NATIVE_WRITE_TOOLS = ["edit", "str_replace_editor", "apply_patch"];
1394
+ var EDIT_FAMILY_NATIVE = ["edit", "str_replace_editor"];
1395
1395
  function readBooleanSource(value, fallback) {
1396
1396
  if (typeof value === "boolean") return value;
1397
1397
  if (typeof value === "function") {
@@ -1418,14 +1418,20 @@ function sanitizeHiddenToolNames(config) {
1418
1418
  return names;
1419
1419
  }
1420
1420
  function hiddenNames(config) {
1421
- const names = readBooleanSource(config.hideNativeWriteTools, true) ? [...NATIVE_WRITE_TOOLS] : [];
1422
- const seen = new Set(names);
1423
- for (const name2 of sanitizeHiddenToolNames(config)) {
1424
- if (!seen.has(name2)) {
1421
+ const names = [];
1422
+ const seen = /* @__PURE__ */ new Set();
1423
+ if (readBooleanSource(config.hideNativeWriteTools, true) && config.toolNames.includes("edit")) {
1424
+ for (const name2 of EDIT_FAMILY_NATIVE) {
1425
+ if (seen.has(name2)) continue;
1425
1426
  seen.add(name2);
1426
1427
  names.push(name2);
1427
1428
  }
1428
1429
  }
1430
+ for (const name2 of sanitizeHiddenToolNames(config)) {
1431
+ if (seen.has(name2)) continue;
1432
+ seen.add(name2);
1433
+ names.push(name2);
1434
+ }
1429
1435
  return names.filter((name2) => !config.toolNames.includes(name2));
1430
1436
  }
1431
1437
  function nativeEditorDenial(toolNames, name2) {
@@ -1542,7 +1548,7 @@ function registerNativeToolHiding(rootCtx, agentCtx, config) {
1542
1548
  configured.filter((name2) => toolExists(rootCtx, agentCtx, name2, config.scope))
1543
1549
  );
1544
1550
  const disposers = [];
1545
- if (restrictable.size > 0 || configured.length > 0) {
1551
+ if (restrictable.size > 0 || config.toolNames.length > 0) {
1546
1552
  let restrictError;
1547
1553
  const attemptRestrict = (names) => {
1548
1554
  if (names.length === 0) return void 0;
@@ -16094,7 +16100,10 @@ function installAgentTools(rootCtx, agent, metrics, config = {}) {
16094
16100
  disposers.push(
16095
16101
  registerNativeToolHiding(rootCtx, agent.ctx, {
16096
16102
  toolNames: registered,
16097
- guidanceToClear: registered.includes("edit") ? [] : ["tool:edit"],
16103
+ // WHY: never empty `tool:edit`: the native `edit` is hidden only while this
16104
+ // WHY: plugin registers its own `edit` brief, and stays visible (with its
16105
+ // WHY: brief) otherwise, so the section is never a stale native leftover.
16106
+ guidanceToClear: [],
16098
16107
  scope: agent
16099
16108
  })
16100
16109
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-hashline-edit",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Hash-anchored read/apply_patch/edit tools for DeepSeek Harness (dsh). Every line gets a unique 3- or 4-char hash (A-Za-z0-9, configurable) that stays stable across edits; apply_patch and the anchored range edit tool are the file-mutation entry points, each committing its whole batch as one transaction.",
5
5
  "keywords": [
6
6
  "anchors",