{"_id":"@canglongcl/dsh-tool-retry","_rev":"3-13337e4fc46e8faf35f9ed503f92c07e","name":"@canglongcl/dsh-tool-retry","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@canglongcl/dsh-tool-retry","version":"0.1.0","_id":"@canglongcl/dsh-tool-retry@0.1.0","maintainers":[{"name":"canglongcl","email":"daicanglong@gmail.com"}],"homepage":"https://github.com/CanglongCl/dsh-tool-retry#readme","bugs":{"url":"https://github.com/CanglongCl/dsh-tool-retry/issues"},"dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"dist":{"shasum":"286adeae3f08a5c22201143cf1300013cee56685","tarball":"https://registry.npmjs.org/@canglongcl/dsh-tool-retry/-/dsh-tool-retry-0.1.0.tgz","fileCount":8,"integrity":"sha512-KxZmunm3XPe2MKDZZkod8o7YkaJMZpRvbuShN9au9GmUXGWpSpTRSP3HyAQNhD9Ta5Eby9WyJzjeGwoNwSSAuA==","signatures":[{"sig":"MEYCIQDzsYVioLSdFejo0DzWgO1rcCOflTC+cz+RJXKea1ddVgIhAKL8jRl0uuctBUYV0EeineqTkDveFlNrZNMzCHYD3UdW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":330828},"main":"./lib/index.js","type":"module","_from":"file:/Users/canglong/Program/dsh-tool-retry/dist/canglongcl-dsh-tool-retry-0.1.0.tgz","exports":{".":"./lib/index.js","./package.json":"./package.json"},"_npmUser":{"name":"canglongcl","email":"daicanglong@gmail.com"},"_resolved":"/Users/canglong/Program/dsh-tool-retry/dist/canglongcl-dsh-tool-retry-0.1.0.tgz","_integrity":"sha512-KxZmunm3XPe2MKDZZkod8o7YkaJMZpRvbuShN9au9GmUXGWpSpTRSP3HyAQNhD9Ta5Eby9WyJzjeGwoNwSSAuA==","repository":{"url":"git+https://github.com/CanglongCl/dsh-tool-retry.git","type":"git"},"_npmVersion":"11.19.0","description":"DSH tool-call checkpoint & replay plugin: every model-direct tool call is auto-checkpointed (success or failure), failures inject a minimal notice, and native mode adds a one-call edit-and-replay tool","directories":{},"_nodeVersion":"26.7.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dsh-tool-retry_0.1.0_1787061838376_0.017265196460518162","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@canglongcl/dsh-tool-retry","version":"0.2.0","_id":"@canglongcl/dsh-tool-retry@0.2.0","maintainers":[{"name":"canglongcl","email":"daicanglong@gmail.com"}],"homepage":"https://github.com/CanglongCl/dsh-tool-retry#readme","bugs":{"url":"https://github.com/CanglongCl/dsh-tool-retry/issues"},"dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"dist":{"shasum":"d398c89acfa101090d3340ea08bf0eec2a401da0","tarball":"https://registry.npmjs.org/@canglongcl/dsh-tool-retry/-/dsh-tool-retry-0.2.0.tgz","fileCount":8,"integrity":"sha512-6vx0IPN92uimQy+5PZ/Ser/+lTuRkvWDXP/gLvqAZQgXyTprFLWDBaNpbfAi8LpVWbIpt2wbwwdPAy5zF1yoLw==","signatures":[{"sig":"MEYCIQDv8SsoZpKZFJ220ptBvdzcrdKpuuFcmDFaOz7hSeZbBgIhAMtcosIbJjiVSQ4rsk7G1jB1tlwsL9PYN9xubuyUzdn6","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@canglongcl%2fdsh-tool-retry@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":330828},"main":"./lib/index.js","type":"module","_from":"file:/home/runner/work/dsh-tool-retry/dsh-tool-retry/release/canglongcl-dsh-tool-retry-0.2.0.tgz","exports":{".":"./lib/index.js","./package.json":"./package.json"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8330ab98-e00e-4c52-ba8d-ab244c6cdb10"}},"_resolved":"/home/runner/work/dsh-tool-retry/dsh-tool-retry/release/canglongcl-dsh-tool-retry-0.2.0.tgz","_integrity":"sha512-6vx0IPN92uimQy+5PZ/Ser/+lTuRkvWDXP/gLvqAZQgXyTprFLWDBaNpbfAi8LpVWbIpt2wbwwdPAy5zF1yoLw==","repository":{"url":"git+https://github.com/CanglongCl/dsh-tool-retry.git","type":"git"},"_npmVersion":"11.19.0","description":"DSH tool-call checkpoint & replay plugin: every model-direct tool call is auto-checkpointed (success or failure), failures inject a minimal notice, and native mode adds a one-call edit-and-replay tool","directories":{},"_nodeVersion":"24.19.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/dsh-tool-retry_0.2.0_1787062956234_0.6426160128840566","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@canglongcl/dsh-tool-retry","version":"0.2.1","description":"DSH tool-call checkpoint & replay plugin: every model-direct tool call is auto-checkpointed (success or failure), failures inject a minimal notice, and native mode adds a one-call edit-and-replay tool","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"repository":{"type":"git","url":"git+https://github.com/CanglongCl/dsh-tool-retry.git"},"type":"module","main":"./lib/index.js","exports":{".":"./lib/index.js","./package.json":"./package.json"},"dsh":{"bundle":{"patch":"./cordis.patch.yml"}},"_id":"@canglongcl/dsh-tool-retry@0.2.1","bugs":{"url":"https://github.com/CanglongCl/dsh-tool-retry/issues"},"homepage":"https://github.com/CanglongCl/dsh-tool-retry#readme","_integrity":"sha512-3xiDw9bjJywWxFcLWS4QJj9y3fqTh4QAIg5Oq1ivaSCVcI+nV/6sp4sdgBpzbLBItWMsk2xR7tUin8pDtlo1jA==","_resolved":"/home/runner/work/dsh-tool-retry/dsh-tool-retry/release/canglongcl-dsh-tool-retry-0.2.1.tgz","_from":"file:/home/runner/work/dsh-tool-retry/dsh-tool-retry/release/canglongcl-dsh-tool-retry-0.2.1.tgz","_nodeVersion":"24.19.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-3xiDw9bjJywWxFcLWS4QJj9y3fqTh4QAIg5Oq1ivaSCVcI+nV/6sp4sdgBpzbLBItWMsk2xR7tUin8pDtlo1jA==","shasum":"aeaac7c9b470342f8681c77682f77836b3d9ac3f","tarball":"https://registry.npmjs.org/@canglongcl/dsh-tool-retry/-/dsh-tool-retry-0.2.1.tgz","fileCount":8,"unpackedSize":330828,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@canglongcl%2fdsh-tool-retry@0.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCKUSkl/GmNzGgaozB0dk5smW7eW0fgNy+NTXtH7bBZmgIhAM1EEmPsEOEaSmUCOnLAVaNiK2JRaNau/Q00TB1bhi3G"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:8330ab98-e00e-4c52-ba8d-ab244c6cdb10"}},"directories":{},"maintainers":[{"name":"canglongcl","email":"daicanglong@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/dsh-tool-retry_0.2.1_1787120222442_0.6939365441222269"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-18T14:03:58.211Z","modified":"2026-08-19T06:17:02.942Z","0.1.0":"2026-08-18T14:03:58.515Z","0.2.0":"2026-08-18T14:22:36.378Z","0.2.1":"2026-08-19T06:17:02.593Z"},"bugs":{"url":"https://github.com/CanglongCl/dsh-tool-retry/issues"},"homepage":"https://github.com/CanglongCl/dsh-tool-retry#readme","repository":{"type":"git","url":"git+https://github.com/CanglongCl/dsh-tool-retry.git"},"description":"DSH tool-call checkpoint & replay plugin: every model-direct tool call is auto-checkpointed (success or failure), failures inject a minimal notice, and native mode adds a one-call edit-and-replay tool","maintainers":[{"name":"canglongcl","email":"daicanglong@gmail.com"}],"readme":"# @canglongcl/dsh-tool-retry\n\nExternal DSH agent-plane plugin that checkpoints every model tool-call block (success or failure) to the OS temp directory, injects one minimal notice per failed call, and provides the editPreviousToolCalling replay tool (native mode) so the model can fix a saved call's arguments instead of regenerating them. In code mode (PTC) no tool is registered; the model replays by reading the checkpoint inside a new run_code program, JSON.parsing it, applying a literal replace on the real program text, and running the corrected program through the AsyncFunction constructor.\n\nThe harness checkout is not modified.\n\nSee the repository [AGENTS.md](../../AGENTS.md) for loading, invariants, and testing contracts. The accepted design lives in [docs/tool-calling-checkpoint-replay-plan.md](../../docs/tool-calling-checkpoint-replay-plan.md) (appendix B holds the four model-facing prompt drafts and their Chinese review translations).\n\n## Usage\n\n```bash\npnpm install\npnpm gen-config        # regenerate the dev overlay after moving the repo\npnpm install-presets   # install the two user presets under ~/.dsh/.agent-presets/\npnpm dev               # launch the harness CLI with the dev alias linked\npnpm dev:headless -- \"<task>\"  # one-shot self-test session through the headless profile\npnpm test              # unit + integration + keyless llm-replay A/B + built-bundle boundary\npnpm check             # typecheck + unit suite + fixture/gen-config idempotence + staging allowlist\npnpm e2e:real          # real-API e2e (native + PTC); auto-skips without DEEPSEEK_API_KEY\npnpm package:official  # stage the publishable tarball under dist/\n```\n\n## Storage model\n\n```text\n<os.tmpdir()>/.dsh/tool-checkpoints/<sessionId>/\n├── history.jsonl                    # appended index: { id, tool, turn, step, ordinal }\n├── by-id/<sanitize(id)>.json        # the only real store; kept for the session\n└── previous/1.json -> ../by-id/<id> # aliases for the previous message's parallel\n                                     # blocks; rebuilt each round (Windows: copy fallback)\n```\n\n## Model Experience\n\n### Request surface and condition\n\n#### What the model sees\n\nThree surfaces, all conditional on the assembling scope being a session that mounts this plugin:\n\n- **Static system-prompt section** `tool:checkpoint-replay` (order 149): the two access forms (by-id files and previous/1.json aliases), history.jsonl lookup, the usage matrix (previous message -> ordinal, older -> call id: failed ids were injected, successful ids come from history.jsonl), and the replay-tool usage. The PTC flavor describes the checkpoint as the whole previous run_code program. The reviewed verbatim drafts live in the plan's appendix B (injection language is English).\n- **Per-failure notice** (every failing model-direct call, via tools/post-execute additionalContexts): \"saved + call id (+ by-id path in PTC) + use editPreviousToolCalling (PTC: read + JSON.parse + replace + AsyncFunction re-run)\". The failure reason is NOT repeated — the harness tool/result already carries it.\n- **Replay tool `editPreviousToolCalling`** (native only): { previous_ordinal?, call_id?, old_string, new_string, replace_all }, exactly one locator; edits the by-id file internally and re-invokes the original tool with the edited arguments.\n\nThe model never computes ids or paths; ids are injected verbatim and echoed back.\n\n#### Token effect\n\n- Static section: ~100-180 tokens once per prompt assembly (mode-conditional).\n- Each failure notice: ~20-40 tokens, once per failure.\n- Checkpoint files and history.jsonl are not injected; the model pays nothing unless it chooses to read them.\n\n#### KV Cache effect\n\n- No per-turn context mutation beyond the static section and the occasional failure notice, so KV-cache reuse is unaffected in ordinary steps. A notice appends a user message after its failing tool result; the static section is prefix-stable for a given mode.\n\n## Known Limitations and Deferred Work\n\n- Windows alias fallback is a content copy (edits through an alias diverge from by-id/; native replay edits by-id directly, so only PTC fs-tool edits are affected).\n- both mode is treated as code mode: the replay tool is not registered.\n- PTC retry guidance is loader-based: JSON.parse + literal replace on the parsed program text (`prev.code`), then the corrected program runs through the AsyncFunction constructor — no JSON escaping enters the match, and top-level `return`/`await` keep their native run_code semantics (plain eval rejects `return` in strict mode). When the retry itself fails, the new checkpoint holds the loader — its file_path still points at the original program.\n- Replaying an UNKNOWN_TOOL checkpoint fails again (expected; the model moves on).\n- v1 embeds replay audit data in tool/result content and meta; a dedicated tool/replay session event is deferred (requires harness core changes).\n- Non-local fs backends (e.g. e2b) skip previous/ aliases; notices still carry exact paths.\n- ABORTED boundary (verified; see AGENTS.md \"Zero filtering\"): ABORTED_BEFORE_DISPATCH bypasses post-execute entirely (no checkpoint, no notice); a post-body ABORTED checkpoints but its result replacement happens after our decision (no notice).\n- os.tmpdir() may be reclaimed by the OS between sessions; within a session the plugin recreates directories as needed.\n","readmeFilename":"README.md"}