@xiaoso/dsh-tool-plus 0.1.6 → 0.1.7-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/THIRD_PARTY_NOTICES.md +9 -3
- package/lib/{abort-Cwwm4Err.mjs → abort-Caqff3M6.mjs} +2 -2
- package/lib/alibaba-coding-plan-DTupMiAi.mjs +73 -0
- package/lib/alibaba-token-plan-CHGyWOfX.mjs +46 -0
- package/lib/alibaba-token-plan-Dj3OZhEE.mjs +82 -0
- package/lib/{amazon-bedrock-TVMpUTRG.mjs → amazon-bedrock-DbFSYXfJ.mjs} +117 -38
- package/lib/{anthropic-BL6LFDQS.mjs → anthropic-CTJ3IQVa.mjs} +675 -166
- package/lib/anthropic-CXfWlp-x.mjs +105 -0
- package/lib/{aws-credentials-B20dliS7.mjs → anthropic-wire-CKuhDwZ1.mjs} +74 -14
- package/lib/{api-key-login-CIDnXeYd.mjs → api-key-validation-CGCJFbFr.mjs} +27 -68
- package/lib/{azure-openai-responses-BkhsLmN3.mjs → azure-openai-responses-ChFbWaGj.mjs} +27 -16
- package/lib/{browser-render-CmgvSNte.mjs → browser-render-9o0Rknop.mjs} +4 -4
- package/lib/bun-shim.mjs +71 -2
- package/lib/{bundled-references-ChZSPDFw.mjs → bundled-references-DY3EJxZV.mjs} +6 -5
- package/lib/cline-pass-Bwg3esu9.mjs +44 -0
- package/lib/cloudflare-ai-gateway-BupNXyKK.mjs +35 -0
- package/lib/cloudflare-ai-gateway-EWo0VkP5.mjs +44 -0
- package/lib/collapse-DOR8sOGf.mjs +2304 -0
- package/lib/coreweave-C82HrLpb.mjs +31 -0
- package/lib/coreweave-Ct8cF-da.mjs +14 -0
- package/lib/{cursor-B6HcmplF.mjs → cursor-B95LzVWV.mjs} +11 -3
- package/lib/{cursor-CRpLpaZ3.mjs → cursor-DJV_dcgB.mjs} +887 -1784
- package/lib/{cursor-B8m6SqAH.mjs → cursor-LKGjucn2.mjs} +48 -38
- package/lib/cursor-proto-B8Wj8bv9.mjs +10513 -0
- package/lib/{deterministic-id-D-yIV_eI.mjs → deterministic-id-CUEIMSqR.mjs} +1 -1
- package/lib/devin-BMTdx_hx.mjs +316 -0
- package/lib/{devin-DUAfvBsW.mjs → devin-DSp0Rw_E.mjs} +172 -86
- package/lib/devin-ExGIghmx.mjs +69 -0
- package/lib/devin-proto-Br8fdyNl.mjs +2888 -0
- package/lib/{dom-CawWi8fa.mjs → dom-DG3sPESc.mjs} +8 -8
- package/lib/effort-BdtQMN-_.mjs +23 -0
- package/lib/{error-C-f_Wnw4.mjs → error-CORgGg5a.mjs} +275 -154
- package/lib/{event-stream-Dh2guZxS.mjs → event-stream-ulcDenZD.mjs} +20 -4
- package/lib/{gemini-headers-DKUShltF.mjs → gemini-headers-Co9cVvex.mjs} +2 -2
- package/lib/{github-copilot-suDymKrx.mjs → github-copilot-Dstq1D3s.mjs} +69 -29
- package/lib/github-copilot-headers-DOh1gt_w.mjs +312 -0
- package/lib/gitlab-duo-DSCMrU0m.mjs +11 -0
- package/lib/google-CtsKkOQK.mjs +38 -0
- package/lib/google-antigravity-z-5KsEci.mjs +252 -0
- package/lib/{google-auth-DYJLM792.mjs → google-auth-ieLBaneO.mjs} +4 -4
- package/lib/{google-gemini-cli-8BT513Ul.mjs → google-gemini-cli-C6NE5mWz.mjs} +28 -54
- package/lib/{google-gemini-cli-D6cSmfvB.mjs → google-gemini-cli-CAIPSl7e.mjs} +23 -29
- package/lib/google-oauth-shared-DhMllAkt.mjs +53 -0
- package/lib/{google-shared-CVbHK5vZ.mjs → google-shared-B0aNCYEH.mjs} +140 -44
- package/lib/{google-validation-Cgbn3tWJ.mjs → google-validation-BEkNs-Bx.mjs} +1 -1
- package/lib/{google-vertex-Bui-ypAe.mjs → google-vertex-Bbd1tYNc.mjs} +8 -8
- package/lib/hosts-00rjRzUD.mjs +203 -0
- package/lib/id-AL5obQzR.mjs +71 -0
- package/lib/{idle-iterator-CYAxUkSD.mjs → idle-iterator-DlUkEfzW.mjs} +3 -3
- package/lib/index.mjs +598 -5275
- package/lib/kilo-ChJL54wq.mjs +81 -0
- package/lib/kimi-C2c_Zq8A.mjs +67 -0
- package/lib/{launch-BmgEUycu.mjs → launch-DKDH71En.mjs} +1 -1
- package/lib/markit-CmRfm4E2.mjs +9885 -0
- package/lib/models-DnXMYGcJ.mjs +381604 -0
- package/lib/muse-code-Di1VZmB1.mjs +143 -0
- package/lib/{ollama-Df9ce-Cp.mjs → ollama-B8ic3sEp.mjs} +15 -30
- package/lib/{openai-codex-CAVI3Me-.mjs → openai-codex-DuJNC99x.mjs} +29 -99
- package/lib/{openai-codex-responses-BcnOotRB.mjs → openai-codex-responses-BL29nh9K.mjs} +204 -116
- package/lib/{openai-completions-Bq4WT47M.mjs → openai-completions-BK2f2dBv.mjs} +152 -82
- package/lib/openai-configuration-update-xMYUjaK_.mjs +150 -0
- package/lib/{openai-reasoning-fallback-DXsfiSXO.mjs → openai-reasoning-fallback-BdB3RCbj.mjs} +106 -12
- package/lib/{openai-responses-Mq_-PjvE.mjs → openai-responses-CGQPlIIy.mjs} +76 -82
- package/lib/{perplexity-XgLF73E7.mjs → perplexity-TBjz3VMB.mjs} +52 -9
- package/lib/{pkce-BlQikGPu.mjs → pkce-BYjmugmw.mjs} +1 -1
- package/lib/protobuf-aab1UGVn.mjs +717 -0
- package/lib/{provider-response-C6vcbQyO.mjs → provider-response-SqKSkkUc.mjs} +1 -1
- package/lib/{proxy-D9lm7ONA.mjs → proxy-5nWqRL1f.mjs} +45 -5
- package/lib/{readability-Cpm-ocau.mjs → readability-uGhqb4GC.mjs} +2 -2
- package/lib/reference-CtvM4zLU.mjs +114 -0
- package/lib/{request-debug-HJMoJncL.mjs → request-debug-NQN0BjHH.mjs} +1 -1
- package/lib/{sanitize-text-CfcXzw5X.mjs → sanitize-text-BCf5KmCf.mjs} +1 -1
- package/lib/{scrapers-Cg5w77td.mjs → scrapers-BpqEnqNM.mjs} +12 -12
- package/lib/{src-BcD0_rQR.mjs → src-BwW51vA5.mjs} +979 -388
- package/lib/{sse-debug-CYdjOC96.mjs → sse-debug-B-tkLCPW.mjs} +1 -1
- package/lib/{stream-Bjq8wjfr.mjs → stream-B_7qN-bA.mjs} +3802 -2623
- package/lib/stream-markup-healing-DKT1lnkW.mjs +267 -0
- package/lib/{strict-tool-validation-imVLUcbI.mjs → strict-tool-validation-CBTz1dAA.mjs} +2 -2
- package/lib/taxonomy-DSIM99rS.mjs +15392 -0
- package/lib/{stream-markup-healing-DZ6bVDxH.mjs → thinking-CiLa2LFB.mjs} +31 -186
- package/lib/{turndown-DN7ByzEI.mjs → turndown-DrX1M4WG.mjs} +4 -4
- package/lib/{type-guards-B9VVjRDK.mjs → type-guards-CttAANEx.mjs} +1 -1
- package/lib/types/client/BashPlusCard.d.ts +53 -0
- package/lib/types/client/ToolPlusSection.d.ts +36 -0
- package/lib/types/client/forms.d.ts +42 -0
- package/lib/types/client/index.d.ts +29 -0
- package/lib/types/client/locales.d.ts +19 -0
- package/lib/types/client/rm-safe-status-text.d.ts +15 -0
- package/lib/types/client/rows.d.ts +107 -0
- package/lib/types/client/web-connection-rpc.d.ts +22 -0
- package/lib/types/config/fields.d.ts +85 -0
- package/lib/types/config/omp-settings.d.ts +21 -0
- package/lib/types/config/settings.d.ts +212 -0
- package/lib/types/config/truncate.d.ts +27 -0
- package/lib/types/host/browser-probe-rpc.d.ts +29 -0
- package/lib/types/index.d.ts +6 -0
- package/lib/types/tools/ast-edit/adapter/index.d.ts +26 -0
- package/lib/types/tools/ast-edit/adapter/sdk.d.ts +49 -0
- package/lib/types/tools/ast-grep/adapter/index.d.ts +31 -0
- package/lib/types/tools/ast-grep/adapter/sdk.d.ts +44 -0
- package/lib/types/tools/bash/adapter/spill.d.ts +34 -0
- package/lib/types/tools/bash/background.d.ts +40 -0
- package/lib/types/tools/bash/bash-executor.d.ts +102 -0
- package/lib/types/tools/bash/bash-interceptor.d.ts +33 -0
- package/lib/types/tools/bash/cd-workdir.d.ts +35 -0
- package/lib/types/tools/bash/logger.d.ts +18 -0
- package/lib/types/tools/bash/non-interactive-env.d.ts +5 -0
- package/lib/types/tools/bash/render.d.ts +46 -0
- package/lib/types/tools/bash/rm-safe-status.d.ts +62 -0
- package/lib/types/tools/bash/rm-safe.d.ts +18 -0
- package/lib/types/tools/bash/sanitize-text.d.ts +34 -0
- package/lib/types/tools/bash/shell-snapshot.d.ts +31 -0
- package/lib/types/tools/bash/shell-tokenize.d.ts +60 -0
- package/lib/types/tools/bash/streaming-output.d.ts +32 -0
- package/lib/types/tools/bash/trash-cli-main.d.ts +1 -0
- package/lib/types/tools/bash/trash-cli.d.ts +77 -0
- package/lib/types/tools/bash/types.d.ts +107 -0
- package/lib/types/tools/bash/which.d.ts +20 -0
- package/lib/types/tools/bash/windows-shell.d.ts +31 -0
- package/lib/types/tools/bash/yield.d.ts +71 -0
- package/lib/types/tools/edit/adapter/index.d.ts +57 -0
- package/lib/types/tools/edit/adapter/tools/auto-generated-guard.d.ts +10 -0
- package/lib/types/tools/edit/adapter/tools/output-meta.d.ts +34 -0
- package/lib/types/tools/edit/adapter/tools/plan-mode-guard.d.ts +21 -0
- package/lib/types/tools/glob/adapter/index.d.ts +52 -0
- package/lib/types/tools/grep/adapter/index.d.ts +53 -0
- package/lib/types/tools/grep/adapter/match-path.d.ts +1 -0
- package/lib/types/tools/hashline/native/diff-preview.d.ts +37 -0
- package/lib/types/tools/hashline/native/index.d.ts +109 -0
- package/lib/types/tools/hashline/native/normalize.d.ts +29 -0
- package/lib/types/tools/hashline/native/policy.d.ts +98 -0
- package/lib/types/tools/hashline/native/writer.d.ts +42 -0
- package/lib/types/tools/omp/browser/launch.d.ts +28 -0
- package/lib/types/tools/omp/browser/readable.d.ts +17 -0
- package/lib/types/tools/omp/config/settings-schema.d.ts +12 -0
- package/lib/types/tools/omp/config/settings.d.ts +59 -0
- package/lib/types/tools/omp/edit/apply-patch/parser.d.ts +34 -0
- package/lib/types/tools/omp/edit/details.d.ts +54 -0
- package/lib/types/tools/omp/edit/diff.d.ts +60 -0
- package/lib/types/tools/omp/edit/dispatch.d.ts +43 -0
- package/lib/types/tools/omp/edit/file-snapshot-store.d.ts +81 -0
- package/lib/types/tools/omp/edit/hashline/execute.d.ts +40 -0
- package/lib/types/tools/omp/edit/hashline/params.d.ts +6 -0
- package/lib/types/tools/omp/edit/modes/apply-patch.d.ts +25 -0
- package/lib/types/tools/omp/edit/modes/patch.d.ts +109 -0
- package/lib/types/tools/omp/edit/modes/replace.d.ts +151 -0
- package/lib/types/tools/omp/edit/normalize.d.ts +31 -0
- package/lib/types/tools/omp/edit/notebook.d.ts +50 -0
- package/lib/types/tools/omp/edit/read-file.d.ts +2 -0
- package/lib/types/tools/omp/edit/snapshot-details.d.ts +33 -0
- package/lib/types/tools/omp/extensibility/skills.d.ts +22 -0
- package/lib/types/tools/omp/internal-urls/index.d.ts +100 -0
- package/lib/types/tools/omp/internal-urls/local-protocol.d.ts +12 -0
- package/lib/types/tools/omp/internal-urls/parse.d.ts +31 -0
- package/lib/types/tools/omp/internal-urls/types.d.ts +189 -0
- package/lib/types/tools/omp/internal-urls/xd-protocol.d.ts +19 -0
- package/lib/types/tools/omp/markit/converters/docx.d.ts +6 -0
- package/lib/types/tools/omp/markit/converters/epub.d.ts +15 -0
- package/lib/types/tools/omp/markit/converters/pdf/index.d.ts +7 -0
- package/lib/types/tools/omp/markit/converters/pptx.d.ts +57 -0
- package/lib/types/tools/omp/markit/converters/xlsx.d.ts +25 -0
- package/lib/types/tools/omp/markit/index.d.ts +2 -0
- package/lib/types/tools/omp/markit/registry.d.ts +16 -0
- package/lib/types/tools/omp/markit/types.d.ts +30 -0
- package/lib/types/tools/omp/sdk.d.ts +103 -0
- package/lib/types/tools/omp/session/agent-storage.d.ts +154 -0
- package/lib/types/tools/omp/session/streaming-output.d.ts +244 -0
- package/lib/types/tools/omp/task/spawn-policy.d.ts +22 -0
- package/lib/types/tools/omp/tools/approval.d.ts +62 -0
- package/lib/types/tools/omp/tools/ast-edit.d.ts +73 -0
- package/lib/types/tools/omp/tools/ast-grep.d.ts +61 -0
- package/lib/types/tools/omp/tools/auto-generated-guard.d.ts +20 -0
- package/lib/types/tools/omp/tools/conflict-detect.d.ts +237 -0
- package/lib/types/tools/omp/tools/fetch.d.ts +103 -0
- package/lib/types/tools/omp/tools/file-recorder.d.ts +13 -0
- package/lib/types/tools/omp/tools/fs-cache-invalidation.d.ts +15 -0
- package/lib/types/tools/omp/tools/glob.d.ts +86 -0
- package/lib/types/tools/omp/tools/grep.d.ts +102 -0
- package/lib/types/tools/omp/tools/grouped-file-output.d.ts +70 -0
- package/lib/types/tools/omp/tools/index.d.ts +23 -0
- package/lib/types/tools/omp/tools/list-limit.d.ts +12 -0
- package/lib/types/tools/omp/tools/match-line-format.d.ts +11 -0
- package/lib/types/tools/omp/tools/output-meta.d.ts +160 -0
- package/lib/types/tools/omp/tools/path-utils.d.ts +326 -0
- package/lib/types/tools/omp/tools/plan-mode-guard.d.ts +33 -0
- package/lib/types/tools/omp/tools/read-archive.d.ts +16 -0
- package/lib/types/tools/omp/tools/read-format.d.ts +104 -0
- package/lib/types/tools/omp/tools/read-path-resolution.d.ts +19 -0
- package/lib/types/tools/omp/tools/read-selector.d.ts +27 -0
- package/lib/types/tools/omp/tools/read-sqlite.d.ts +16 -0
- package/lib/types/tools/omp/tools/read-summary.d.ts +15 -0
- package/lib/types/tools/omp/tools/read.d.ts +70 -0
- package/lib/types/tools/omp/tools/render-utils.d.ts +28 -0
- package/lib/types/tools/omp/tools/report-tool-issue.d.ts +149 -0
- package/lib/types/tools/omp/tools/resolve.d.ts +127 -0
- package/lib/types/tools/omp/tools/sqlite-reader.d.ts +114 -0
- package/lib/types/tools/omp/tools/tool-errors.d.ts +33 -0
- package/lib/types/tools/omp/tools/tool-result.d.ts +33 -0
- package/lib/types/tools/omp/tools/tool-timeouts.d.ts +57 -0
- package/lib/types/tools/omp/tools/write.d.ts +53 -0
- package/lib/types/tools/omp/tools/writethrough.d.ts +24 -0
- package/lib/types/tools/omp/utils/block-context.d.ts +35 -0
- package/lib/types/tools/omp/utils/cpuprofile.d.ts +51 -0
- package/lib/types/tools/omp/utils/edit-mode.d.ts +13 -0
- package/lib/types/tools/omp/utils/file-display-mode.d.ts +27 -0
- package/lib/types/tools/omp/utils/image-loading.d.ts +51 -0
- package/lib/types/tools/omp/utils/image-resize.d.ts +42 -0
- package/lib/types/tools/omp/utils/lang-from-path.d.ts +9 -0
- package/lib/types/tools/omp/utils/markit-cache.d.ts +23 -0
- package/lib/types/tools/omp/utils/markit.d.ts +30 -0
- package/lib/types/tools/omp/utils/profile-tree.d.ts +47 -0
- package/lib/types/tools/omp/utils/sample-profile.d.ts +67 -0
- package/lib/types/tools/omp/utils/sixel.d.ts +21 -0
- package/lib/types/tools/omp/utils/tools-manager.d.ts +11 -0
- package/lib/types/tools/omp/utils/turndown.d.ts +15 -0
- package/lib/types/tools/omp/utils/zip.d.ts +129 -0
- package/lib/types/tools/omp/web/browser-render.d.ts +50 -0
- package/lib/types/tools/omp/web/parallel.d.ts +68 -0
- package/lib/types/tools/omp/web/scrapers/artifacthub.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/arxiv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/aur.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/biorxiv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/bluesky.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/brew.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/cheatsh.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/chocolatey.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/choosealicense.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/cisa-kev.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/clojars.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/coingecko.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/crates-io.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/crossref.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/devto.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/discogs.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/discourse.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/dockerhub.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/docs-rs.d.ts +9 -0
- package/lib/types/tools/omp/web/scrapers/fdroid.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/firefox-addons.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/flathub.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/github-gist.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/github.d.ts +34 -0
- package/lib/types/tools/omp/web/scrapers/gitlab.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/go-pkg.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/hackage.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/hackernews.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/hex.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/huggingface.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/iacr.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/index.d.ts +84 -0
- package/lib/types/tools/omp/web/scrapers/jetbrains-marketplace.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/lemmy.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/lobsters.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/mastodon.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/maven.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/mdn.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/metacpan.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/musicbrainz.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/npm.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/nuget.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/nvd.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/ollama.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/open-vsx.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/opencorporates.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/openlibrary.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/orcid.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/osv.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/packagist.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pub-dev.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pubmed.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/pypi.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rawg.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/readthedocs.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/reddit.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/repology.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rfc.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/rubygems.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/searchcode.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/sec-edgar.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/semantic-scholar.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/snapcraft.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/sourcegraph.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/spdx.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/spotify.d.ts +8 -0
- package/lib/types/tools/omp/web/scrapers/stackoverflow.d.ts +6 -0
- package/lib/types/tools/omp/web/scrapers/terraform.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/tldr.d.ts +7 -0
- package/lib/types/tools/omp/web/scrapers/twitter.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/types.d.ts +90 -0
- package/lib/types/tools/omp/web/scrapers/utils.d.ts +26 -0
- package/lib/types/tools/omp/web/scrapers/vimeo.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/vscode-marketplace.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/w3c.d.ts +2 -0
- package/lib/types/tools/omp/web/scrapers/wikidata.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/wikipedia.d.ts +5 -0
- package/lib/types/tools/omp/web/scrapers/youtube.d.ts +5 -0
- package/lib/types/tools/omp/web/search/providers/utils.d.ts +49 -0
- package/lib/types/tools/omp/web/search/types.d.ts +501 -0
- package/lib/types/tools/omp/web/search/utils.d.ts +4 -0
- package/lib/types/tools/omp/workspace-tree.d.ts +42 -0
- package/lib/types/tools/read/adapter/index.d.ts +49 -0
- package/lib/types/tools/read/adapter/internal-urls/artifact-protocol.d.ts +15 -0
- package/lib/types/tools/read/adapter/internal-urls/registry-helpers.d.ts +44 -0
- package/lib/types/tools/read/adapter/registry/agent-registry.d.ts +29 -0
- package/lib/types/tools/shared/auto-generated-guard.dsh.d.ts +16 -0
- package/lib/types/tools/shared/browser-detect.d.ts +54 -0
- package/lib/types/tools/shared/browser-rpc-channel.d.ts +40 -0
- package/lib/types/tools/shared/bun-ffi-shim.d.ts +13 -0
- package/lib/types/tools/shared/bun-named-shim.d.ts +42 -0
- package/lib/types/tools/shared/bun-shim.d.ts +138 -0
- package/lib/types/tools/shared/bun-sqlite-shim.d.ts +49 -0
- package/lib/types/tools/shared/fs-promises-shim.d.ts +15 -0
- package/lib/types/tools/shared/image-bridge.d.ts +98 -0
- package/lib/types/tools/shared/omp-prompt.d.ts +47 -0
- package/lib/types/tools/shared/sandbox-policy.d.ts +38 -0
- package/lib/types/tools/shared/session-state.d.ts +51 -0
- package/lib/types/tools/shared/tool-errors.d.ts +33 -0
- package/lib/types/tools/shared/win-path-fixes.d.ts +16 -0
- package/lib/types/tools/write/adapter/index.d.ts +31 -0
- package/lib/{types-DX_bvuus.mjs → types-PVueGi9S.mjs} +2 -2
- package/lib/{utils-C-dSORPa.mjs → utils-B7A3Eu4L.mjs} +2364 -2676
- package/lib/{utils-Cp2Mxf_U.mjs → utils-CUPhpw9A.mjs} +413 -134
- package/lib/{utils-CQHPEQ3W.mjs → utils-DeWqNWV8.mjs} +2 -2
- package/lib/{vision-guard-mBmtAHx0.mjs → vision-guard-_XwsL1DF.mjs} +14 -29
- package/lib/xai-oauth-CXhnz0gO.mjs +210 -0
- package/lib/{xiaomi-7mE345KX.mjs → xiaomi-psoUItal.mjs} +8 -37
- package/lib/{zai-CeNpMV3W.mjs → zai-ApJ8HBgT.mjs} +8 -71
- package/lib/{zip-BK7UHCwX.mjs → zip-Kd602XNe.mjs} +1 -1
- package/package.json +12 -12
- package/presets/package.json +1 -1
- package/presets/tool-plus-ptc/agent.cordis.yml +1 -1
- package/presets/tool-plus-standard/agent.cordis.yml +1 -1
- package/scripts/patch-pi-natives.mjs +108 -108
- package/lib/agent_pb-Rizyt9Zg.mjs +0 -805
- package/lib/anthropic-CDmj476p.mjs +0 -262
- package/lib/api_server_pb-CDZgLMta.mjs +0 -252
- package/lib/callback-server-CFJK-jvK.mjs +0 -398
- package/lib/codex-P1dGpX7G.mjs +0 -54
- package/lib/device-code-CuXTWYwY.mjs +0 -51
- package/lib/devin-BcQwht1W.mjs +0 -114
- package/lib/devin-BvMfGevz.mjs +0 -95
- package/lib/github-copilot-B3kQl0g0.mjs +0 -104
- package/lib/gitlab-duo-BriUTP8k.mjs +0 -155
- package/lib/gitlab-duo-workflow-wK5Ljzmc.mjs +0 -91
- package/lib/google-CE5tFDod.mjs +0 -30
- package/lib/google-antigravity-C1jgNljz.mjs +0 -198
- package/lib/google-oauth-shared-BLVTvokk.mjs +0 -147
- package/lib/grammar-D-NqNUxQ.mjs +0 -49
- package/lib/identity-HNO1Oe9B.mjs +0 -219
- package/lib/kimi-DgcUpPtK.mjs +0 -236
- package/lib/markit-DtGoRE6M.mjs +0 -1417
- package/lib/minimax-code-Y3h5li9N.mjs +0 -53
- package/lib/models-DRA2c_8U.mjs +0 -104660
- package/lib/opencode-BsVw9rCD.mjs +0 -38
- package/lib/to-binary-B1BEBIPC.mjs +0 -6002
- package/lib/wafer-BlhWLweO.mjs +0 -17
- package/lib/xai-oauth-5pORHUrg.mjs +0 -446
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plugin configuration, tool argument, and result DTO types for the ported
|
|
3
|
+
* Oh My Pi bash tool. The runtime `Config` schema lives in `index.ts`.
|
|
4
|
+
* @module @xiaoso/dsh-tool-plus/types
|
|
5
|
+
*/
|
|
6
|
+
/** Minimizer settings mirroring the native `MinimizerOptions` surface. */
|
|
7
|
+
export interface MinimizerConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
/** Restrict minimization to these filter names (empty = all). */
|
|
10
|
+
only: string[];
|
|
11
|
+
/** Exclude these filter names from minimization. */
|
|
12
|
+
except: string[];
|
|
13
|
+
/** Output capture budget in bytes; larger outputs pass through raw. */
|
|
14
|
+
maxCaptureBytes: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Runtime configuration schema for the plugin; declared in `index.ts`
|
|
18
|
+
* alongside `apply`. Every field is optional at the composition boundary and
|
|
19
|
+
* defaults inside `apply`; {@link ResolvedConfig} is the fully-defaulted form.
|
|
20
|
+
*/
|
|
21
|
+
export interface Config {
|
|
22
|
+
/** Expose `run_in_background` (default true); disabled calls are also rejected. */
|
|
23
|
+
enableRunInBackground?: boolean;
|
|
24
|
+
/** Foreground commands exceeding this wall time are moved to the background (0 = never). */
|
|
25
|
+
autoBackgroundMs?: number;
|
|
26
|
+
/** Deadline applied when the model omits `timeoutMs`. */
|
|
27
|
+
defaultTimeoutMs?: number;
|
|
28
|
+
/** Upper clamp for explicit timeouts; `timeoutMs: 0` disables the deadline. */
|
|
29
|
+
maxTimeoutMs?: number;
|
|
30
|
+
/** Tail budget for live previews and background-job output reads. */
|
|
31
|
+
outputMaxBytes?: number;
|
|
32
|
+
/** OutputSink rolling tail window (bytes). */
|
|
33
|
+
outputSinkTailBytes?: number;
|
|
34
|
+
/** OutputSink head window (bytes) retained in addition to the tail. */
|
|
35
|
+
outputSinkHeadBytes?: number;
|
|
36
|
+
/** Output minimizer (native intelligent compression for git/npm/cargo/…). */
|
|
37
|
+
minimizer?: MinimizerConfig;
|
|
38
|
+
/** Block intercepted commands and suggest the dedicated dsh tool instead. */
|
|
39
|
+
interceptorEnabled?: boolean;
|
|
40
|
+
/** Harden the command environment for non-interactive use (pagers, prompts, color). */
|
|
41
|
+
nonInteractiveEnv?: boolean;
|
|
42
|
+
/** Capture the user's rc file (aliases, functions, options) into the session shell. */
|
|
43
|
+
snapshotEnabled?: boolean;
|
|
44
|
+
/** Redefine `rm` in the session shell to move into the system trash; the plugin config layer decides the default (rmSafe: true). */
|
|
45
|
+
rmSafe?: boolean;
|
|
46
|
+
/** Wrap every command in `bash -c '…'` for a full bash environment. */
|
|
47
|
+
useShellCommandWrapper?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/** {@link Config} with every field resolved to its default. */
|
|
50
|
+
export type ResolvedConfig = Required<Config>;
|
|
51
|
+
/** Parsed tool arguments; execute validates value constraints absent from ParameterSchemaSpec. */
|
|
52
|
+
export interface BashToolArgs {
|
|
53
|
+
command: string;
|
|
54
|
+
description: string;
|
|
55
|
+
timeoutMs?: number;
|
|
56
|
+
workdir?: string;
|
|
57
|
+
env?: Record<string, string>;
|
|
58
|
+
run_in_background?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Minimizer facts surfaced with a foreground result. */
|
|
61
|
+
export interface MinimizedOutputInfo {
|
|
62
|
+
filter: string;
|
|
63
|
+
inputBytes: number;
|
|
64
|
+
outputBytes: number;
|
|
65
|
+
}
|
|
66
|
+
/** One collected output stream (single merged stdout+stderr, like the native Shell). */
|
|
67
|
+
export interface CollectedOutput {
|
|
68
|
+
text: string;
|
|
69
|
+
truncated: boolean;
|
|
70
|
+
/** Path of the spill file mirroring the full raw output stream, when one was created. */
|
|
71
|
+
spillPath?: string;
|
|
72
|
+
/** Path holding the pre-minimization original text, when the native minimizer rewrote the output. */
|
|
73
|
+
originalSpillPath?: string;
|
|
74
|
+
/** Stream counters carried for the truncation notice (OMP OutputSummary parity). */
|
|
75
|
+
totalLines?: number;
|
|
76
|
+
totalBytes?: number;
|
|
77
|
+
outputLines?: number;
|
|
78
|
+
outputBytes?: number;
|
|
79
|
+
elidedLines?: number;
|
|
80
|
+
elidedBytes?: number;
|
|
81
|
+
}
|
|
82
|
+
/** Foreground completion of one bash call. */
|
|
83
|
+
export interface BashForegroundOutput {
|
|
84
|
+
kind: 'foreground';
|
|
85
|
+
/** Process exit code; null when the run was interrupted before exit. */
|
|
86
|
+
exitCode: number | null;
|
|
87
|
+
timedOut: boolean;
|
|
88
|
+
aborted: boolean;
|
|
89
|
+
/** The effective deadline in ms (null when the deadline was disabled). */
|
|
90
|
+
timeoutMs: number | null;
|
|
91
|
+
/** Wall-clock duration of the run. */
|
|
92
|
+
wallTimeMs: number;
|
|
93
|
+
/** The shell's working directory after the command (persists across calls). */
|
|
94
|
+
workingDir?: string;
|
|
95
|
+
/** Present when the native minimizer rewrote the output. */
|
|
96
|
+
minimized?: MinimizedOutputInfo;
|
|
97
|
+
/** True when the rmSafe injection failed: `rm` deletes permanently. */
|
|
98
|
+
rmSafeInjectionFailed?: boolean;
|
|
99
|
+
output: CollectedOutput;
|
|
100
|
+
}
|
|
101
|
+
/** Background acknowledgement: the call returned a managed job id. */
|
|
102
|
+
export interface BashBackgroundOutput {
|
|
103
|
+
kind: 'background';
|
|
104
|
+
jobId: string;
|
|
105
|
+
}
|
|
106
|
+
/** The tool's canonical output DTO. */
|
|
107
|
+
export type BashOutput = BashForegroundOutput | BashBackgroundOutput;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal PATH (+ PATHEXT on Windows) executable lookup — the plugin's single
|
|
3
|
+
* implementation of `Bun.which` semantics on the Node runtime.
|
|
4
|
+
*
|
|
5
|
+
* Two callers, one scanner: DSH code that must resolve executables the way OMP
|
|
6
|
+
* does (procmgr `resolveWindowsShell` for shell discovery, `REJECT_PROMPT_COMMAND`
|
|
7
|
+
* in non-interactive-env) calls `findOnPath` directly, and the bun-shim installs
|
|
8
|
+
* `Bun.which` on top of it — which is also how upstream pi-utils' `$which` lands
|
|
9
|
+
* here (@oh-my-pi/pi-utils src/which.ts:201 calls `Bun.which` on non-darwin).
|
|
10
|
+
* Single implementation — any new caller resolves executables through here,
|
|
11
|
+
* never hand-rolls a PATH walk.
|
|
12
|
+
* @module @xiaoso/dsh-tool-plus/bash/which
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Resolve `command` against PATH the way `Bun.which` would: absolute/relative
|
|
16
|
+
* candidates are returned as-is when they name an existing file; bare names
|
|
17
|
+
* are looked up in each PATH dir (appending PATHEXT extensions on win32, in
|
|
18
|
+
* order). Returns the first existing regular file, or `undefined`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function findOnPath(command: string, env?: NodeJS.ProcessEnv): string | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Windows shell discovery, ported from oh-my-pi procmgr's `resolveWindowsShell`
|
|
3
|
+
* (refs/oh-my-pi/packages/utils/src/procmgr.ts:148-173) — adapted verbatim:
|
|
4
|
+
* `Bun.env` → injectable Node env (default `process.env`), and pi-utils
|
|
5
|
+
* `$which` → `findOnPath` (src/tools/bash/which.ts).
|
|
6
|
+
*
|
|
7
|
+
* Deliberately NOT ported from procmgr: buildSpawnEnv, shell prefix handling,
|
|
8
|
+
* direnv integration, and PI_SHELL_PREFIX — DSH has no shell-prefix seam;
|
|
9
|
+
* commands run inside the embedded brush shell or the resolved user shell.
|
|
10
|
+
* @module @xiaoso/dsh-tool-plus/bash/windows-shell
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Resolve the external shell to advertise on Windows.
|
|
14
|
+
*
|
|
15
|
+
* A host bash is OPTIONAL: bash tool commands always execute in the embedded
|
|
16
|
+
* brush-core shell. The resolved binary only serves the spawn-a-shell paths,
|
|
17
|
+
* so this prefers a real Git Bash when one exists and otherwise falls back to
|
|
18
|
+
* cmd.exe — it never fails.
|
|
19
|
+
*
|
|
20
|
+
* Search order:
|
|
21
|
+
* 1. Git for Windows install roots (machine + per-user installers)
|
|
22
|
+
* 2. scoop installs — scoop's git manifest sets GIT_INSTALL_ROOT and shims
|
|
23
|
+
* sh.exe/git.exe but never bash.exe, so PATH lookup alone misses it
|
|
24
|
+
* 3. bash.exe on PATH (Cygwin, MSYS2, ...)
|
|
25
|
+
* 4. sh.exe on PATH (Git for Windows' sh.exe is bash; prefer a sibling
|
|
26
|
+
* bash.exe when present)
|
|
27
|
+
* 5. cmd.exe from ComSpec
|
|
28
|
+
*
|
|
29
|
+
* Exported for tests; `env` overrides process.env-based discovery.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveWindowsShell(env?: NodeJS.ProcessEnv): string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cooperative yield utility for preventing Bun event-loop busy-wait.
|
|
3
|
+
*
|
|
4
|
+
* ## Root Cause
|
|
5
|
+
*
|
|
6
|
+
* Bun 1.3.x (JavaScriptCore) event loop busy-waits (spins in userspace)
|
|
7
|
+
* when the only pending work is an unresolved Promise — even if there are
|
|
8
|
+
* active I/O watchers (stdin, child process pipes, etc.). The event loop
|
|
9
|
+
* continuously polls for microtask resolution instead of blocking in
|
|
10
|
+
* `epoll_wait`, consuming ~100% of a CPU core.
|
|
11
|
+
*
|
|
12
|
+
* This affects any `await` on a never-resolved Promise, including:
|
|
13
|
+
* - `Promise.withResolvers()` used for user input callbacks
|
|
14
|
+
* - `await proc.exited` for long-running child processes
|
|
15
|
+
* - Agent loop iterations waiting for the next tool call
|
|
16
|
+
*
|
|
17
|
+
* ## Fix
|
|
18
|
+
*
|
|
19
|
+
* A recurring `setInterval` keeps the event loop sleeping in `epoll_wait`.
|
|
20
|
+
* The `EventLoopKeepalive` class and `keepaliveWhile()` wrapper provide a
|
|
21
|
+
* clean way to install and clean up this keepalive timer.
|
|
22
|
+
*
|
|
23
|
+
* The older `yieldIfDue()` and `ExponentialYield` approaches (compensated
|
|
24
|
+
* sleep loops) are retained for the agent-loop hot-path where Promises
|
|
25
|
+
* resolve frequently and the keepalive alone is insufficient.
|
|
26
|
+
*/
|
|
27
|
+
export declare class EventLoopKeepalive {
|
|
28
|
+
#private;
|
|
29
|
+
[Symbol.dispose](): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Cooperative yield gate. Sleeps for at least {@link YieldGateOptions.sleepMs}
|
|
33
|
+
* but at most once every {@link YieldGateOptions.intervalMs}; hot-path callers
|
|
34
|
+
* invoke it freely and only the slow path actually sleeps.
|
|
35
|
+
*
|
|
36
|
+
* The clock and sleep are injectable so tests drive the gate logic without
|
|
37
|
+
* touching process-global `Date.now`/`scheduler.wait` — globals a concurrent
|
|
38
|
+
* test file can restore mid-run, which previously made the shared gate flake.
|
|
39
|
+
*/
|
|
40
|
+
export interface YieldGateOptions {
|
|
41
|
+
now?: () => number;
|
|
42
|
+
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
43
|
+
intervalMs?: number;
|
|
44
|
+
sleepMs?: number;
|
|
45
|
+
}
|
|
46
|
+
export declare class YieldGate {
|
|
47
|
+
#private;
|
|
48
|
+
constructor(opts?: YieldGateOptions);
|
|
49
|
+
yieldIfDue(signal?: AbortSignal): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Yield to the Bun event loop, sleeping for at least 20 ms — but at most once
|
|
53
|
+
* every {@link YIELD_INTERVAL_MS} across all callers.
|
|
54
|
+
*/
|
|
55
|
+
export declare function yieldIfDue(): Promise<void>;
|
|
56
|
+
export declare class ExponentialYield {
|
|
57
|
+
#private;
|
|
58
|
+
constructor(opts?: {
|
|
59
|
+
minMs?: number;
|
|
60
|
+
maxMs?: number;
|
|
61
|
+
multiplier?: number;
|
|
62
|
+
});
|
|
63
|
+
notifyActivity(): void;
|
|
64
|
+
sleep(signal?: AbortSignal): Promise<number>;
|
|
65
|
+
/**
|
|
66
|
+
* Race `racers` against an exponentially-backed-off cooperative yield.
|
|
67
|
+
* The losing sleep is cancelled as soon as a racer settles, so no stray
|
|
68
|
+
* timers keep the event loop alive past the racer's resolution.
|
|
69
|
+
*/
|
|
70
|
+
race<T>(racers: Array<Promise<T>>): Promise<T>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH edit tool — adapter that wires the verbatim OMP edit engine
|
|
3
|
+
* (`src/tools/omp/edit/`) into DSH's `defineTool` contract.
|
|
4
|
+
*
|
|
5
|
+
* This file is pure glue. All edit logic lives in `omp/` (copied verbatim);
|
|
6
|
+
* this adapter only:
|
|
7
|
+
* - builds an OMP `ToolSession` from the DSH exec context + tool-plus config,
|
|
8
|
+
* - picks the edit mode from the call shape (replace / patch / hashline /
|
|
9
|
+
* apply_patch), exactly like OMP's `EditTool.mode` resolution,
|
|
10
|
+
* - hands replace/apply_patch to the verbatim upstream dispatch layer
|
|
11
|
+
* (`omp/edit/dispatch.ts`,A-7/A-8:resolveEditPath 路径纠错 +
|
|
12
|
+
* executeSinglePathEntries / executeApplyPatchPerFile 聚合) and converts
|
|
13
|
+
* the `AgentToolResult` back to a DSH tool result.
|
|
14
|
+
*
|
|
15
|
+
* LSP/ACP/TUI are absent in DSH (plan.md 拍板#5/#8): writethrough writes through
|
|
16
|
+
* ctx.fs, diagnostics are never produced, and no TUI rendering happens.
|
|
17
|
+
*/
|
|
18
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
19
|
+
import type { WritethroughCallback } from '../../omp/tools/writethrough.ts';
|
|
20
|
+
import type { RuntimeConfig } from '../../../config/settings.ts';
|
|
21
|
+
/** OMP 原版按模式渲染的 edit 描述(prompts/tools/*.md verbatim + native hashline 描述)。 */
|
|
22
|
+
export declare const EDIT_MODE_DESCRIPTIONS: {
|
|
23
|
+
readonly replace: string;
|
|
24
|
+
readonly patch: string;
|
|
25
|
+
readonly apply_patch: string;
|
|
26
|
+
readonly hashline: string;
|
|
27
|
+
};
|
|
28
|
+
/** File-write channel for DSH (方案A, 2026-08-27): every edit mode funnels
|
|
29
|
+
* through `ctx.fs` with the per-call sandbox policy resolved from the session
|
|
30
|
+
* (official tool-fs semantics). The OMP engines pass a `file` handle for
|
|
31
|
+
* patch/hashline modes — previously this adapter wrote through that handle
|
|
32
|
+
* (OMP node-fs direct write), bypassing the host's sandbox fence entirely,
|
|
33
|
+
* while replace mode went through `ctx.fs` WITHOUT the policy argument and
|
|
34
|
+
* was denied by the deployment fallback. Both defects are fixed here: the
|
|
35
|
+
* handle is ignored and the policy is always attached. */
|
|
36
|
+
export declare function createWritethrough(ctx: Context, exec: any): WritethroughCallback;
|
|
37
|
+
/** DSH edit 工具输出形状(output.schema 镜像)。 */
|
|
38
|
+
export interface EditToolOutput {
|
|
39
|
+
text: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* S-13:edit.fuzzyThreshold 解析——上游 settings 面原样放行显式 0/负值
|
|
43
|
+
* (0 = 接受任意置信度的最佳匹配,refs edit/index.ts:112 同款语义),仅
|
|
44
|
+
* undefined/非数值回退引擎默认 0.95。env 层(上游 PI_EDIT_FUZZY* 环境变量
|
|
45
|
+
* 串解析)有意不移植:DSH 无该环境变量面,面板字段是唯一入口。
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveFuzzyThreshold(raw: unknown): number;
|
|
48
|
+
/** 完整执行链路(defineTool.execute 与单测共用,镜像 read 的 executeReadTool)。 */
|
|
49
|
+
export declare function executeEditTool(exec: any, cfg: RuntimeConfig, args: any, ctx: Context | null): Promise<EditToolOutput>;
|
|
50
|
+
/**
|
|
51
|
+
* Register the edit tool. Mode is resolved per call from the argument shape
|
|
52
|
+
* (matching OMP's mode dispatch):
|
|
53
|
+
* - `input` present → hashline, or apply_patch when it starts with `***`
|
|
54
|
+
* - `patch` present → unified-diff patch mode
|
|
55
|
+
* - `edits` present (or old_string) → replace mode
|
|
56
|
+
*/
|
|
57
|
+
export declare function registerEdit(ctx: Context, getConfig: () => RuntimeConfig): () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A-3 合并后的纯转发层(second-impl-audit.md A-3)。
|
|
3
|
+
*
|
|
4
|
+
* 唯一实现在 `src/tools/omp/tools/auto-generated-guard.ts`(OMP refs
|
|
5
|
+
* packages/coding-agent/src/tools/auto-generated-guard.ts 的逐字移植,
|
|
6
|
+
* 含 T17-1 Windows basename 修复)。本文件不再持有任何守卫逻辑,仅为
|
|
7
|
+
* 既有 import 路径(omp/edit/hashline/filesystem.ts 等历史引用与单测)
|
|
8
|
+
* 保留转发。
|
|
9
|
+
*/
|
|
10
|
+
export { assertEditableFile, assertEditableFileContent, } from "../../../omp/tools/auto-generated-guard.ts";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH adapter for OMP `tools/output-meta.ts`.
|
|
3
|
+
*
|
|
4
|
+
* OMP attaches LSP diagnostics + output metadata to tool results. LSP
|
|
5
|
+
* diagnostics are cut (plan.md 拍板#5); the metadata *shape* is kept so
|
|
6
|
+
* engine code (`outputMeta().get()`) compiles unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export interface TruncationMeta {
|
|
9
|
+
kind: 'head' | 'tail' | 'middle';
|
|
10
|
+
startLine?: number;
|
|
11
|
+
totalFileLines?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface SourceMeta {
|
|
14
|
+
path?: string;
|
|
15
|
+
lines?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface LimitsMeta {
|
|
18
|
+
maxBytes?: number;
|
|
19
|
+
}
|
|
20
|
+
export interface OutputMeta {
|
|
21
|
+
truncation?: TruncationMeta;
|
|
22
|
+
source?: SourceMeta;
|
|
23
|
+
limits?: LimitsMeta;
|
|
24
|
+
}
|
|
25
|
+
/** Fluent builder for OutputMeta. */
|
|
26
|
+
export declare class OutputMetaBuilder {
|
|
27
|
+
#private;
|
|
28
|
+
truncation(value: TruncationMeta): this;
|
|
29
|
+
source(value: SourceMeta): this;
|
|
30
|
+
limits(value: LimitsMeta): this;
|
|
31
|
+
get(): OutputMeta;
|
|
32
|
+
}
|
|
33
|
+
/** Create a new OutputMeta builder. */
|
|
34
|
+
export declare function outputMeta(): OutputMetaBuilder;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ToolSession } from '../../../omp/tools/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Strip the hashline `[path#TAG]` wrapper from a write/edit target so the inner
|
|
4
|
+
* filesystem path drives both authorization and resolution (verbatim OMP).
|
|
5
|
+
*/
|
|
6
|
+
export declare function unwrapHashlineHeaderPath(targetPath: string): string;
|
|
7
|
+
/** True when `targetPath` resolves inside the local sandbox (DSH: none). */
|
|
8
|
+
export declare function targetsLocalSandbox(_session: ToolSession, _targetPath: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve a write/edit target to its absolute filesystem path (verbatim OMP
|
|
11
|
+
* resolution, minus local:// / vault:// schemes which DSH does not have).
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolvePlanPath(session: ToolSession, targetPath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Plan mode hard-gate — deliberately a no-op in DSH (plan mode is a hint
|
|
16
|
+
* layer; official write/edit do not hard-block, plan.md §3 判定去掉).
|
|
17
|
+
*/
|
|
18
|
+
export declare function enforcePlanModeWrite(_session: ToolSession, _targetPath: string, _options?: {
|
|
19
|
+
move?: string;
|
|
20
|
+
op?: 'create' | 'update' | 'delete';
|
|
21
|
+
}): void;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH glob tool — adapter that wires the verbatim OMP glob engine
|
|
3
|
+
* (`src/tools/glob/adapter/omp/glob.ts`) into DSH's `defineTool` contract.
|
|
4
|
+
*
|
|
5
|
+
* This file is pure glue. All glob logic lives in `omp/` (copied verbatim);
|
|
6
|
+
* this adapter only:
|
|
7
|
+
* - builds an OMP `ToolSession` from the DSH exec context + tool-plus config,
|
|
8
|
+
* - constructs the verbatim `GlobTool` and calls its `execute`,
|
|
9
|
+
* - converts the `AgentToolResult` back to a DSH tool result, appending the
|
|
10
|
+
* OMP session-layer meta notice (`formatOutputNotice`, A-6) to the
|
|
11
|
+
* model-visible text.
|
|
12
|
+
*
|
|
13
|
+
* plan.md 拍板:glob keeps OMP's native single-param style (`path` with a
|
|
14
|
+
* semicolon-delimited multi-target list). DSH `hidden`/`gitignore`/`limit`
|
|
15
|
+
* are surfaced verbatim as optional parameters.
|
|
16
|
+
*/
|
|
17
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
18
|
+
import type { AgentToolResult } from '@oh-my-pi/pi-agent-core';
|
|
19
|
+
import type { RuntimeConfig } from '../../../config/settings.ts';
|
|
20
|
+
export type { Settings } from '../../omp/config/settings.ts';
|
|
21
|
+
export type { ToolSession } from '../../omp/sdk.ts';
|
|
22
|
+
/** DSH glob 工具输出形状(output.schema 镜像)。 */
|
|
23
|
+
export interface GlobToolOutput {
|
|
24
|
+
path: string;
|
|
25
|
+
text: string;
|
|
26
|
+
fileCount?: number;
|
|
27
|
+
truncated?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 把 OMP AgentToolResult 转成 DSH glob 工具输出。
|
|
31
|
+
*
|
|
32
|
+
* 上游 session 层会把 `formatOutputNotice(details.meta)` 的限量/截断提示追加
|
|
33
|
+
* 进模型可见文本(wrapToolWithMetaNotice → appendOutputNotice,refs
|
|
34
|
+
* tools/output-meta.ts:586);DSH 无 session 层,适配层在此补上(A-6),
|
|
35
|
+
* 否则 glob 超限截断对模型静默。
|
|
36
|
+
*/
|
|
37
|
+
export declare function toGlobToolResult(result: AgentToolResult<any>, args: any): GlobToolOutput;
|
|
38
|
+
/**
|
|
39
|
+
* 完整执行链路(defineTool.execute 与单测共用)。
|
|
40
|
+
*
|
|
41
|
+
* `ctx` 参数与 read 的 executeReadTool 对齐(glob 引擎不需要 image bridge /
|
|
42
|
+
* session state,仅占位保持签名一致)。
|
|
43
|
+
*/
|
|
44
|
+
export declare function executeGlobTool(exec: any, cfg: RuntimeConfig, args: any, ctx: Context): Promise<GlobToolOutput>;
|
|
45
|
+
/**
|
|
46
|
+
* Register the glob tool (OMP native `path` + optional `hidden`/`gitignore`/
|
|
47
|
+
* `limit` parameters).
|
|
48
|
+
*/
|
|
49
|
+
export declare function registerGlob(ctx: Context, getConfig: () => RuntimeConfig): void;
|
|
50
|
+
export declare const applyGlob: typeof registerGlob;
|
|
51
|
+
export declare const registerGlobTool: typeof registerGlob;
|
|
52
|
+
export default registerGlob;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH grep tool — adapter that wires the verbatim OMP grep engine
|
|
3
|
+
* (`src/tools/grep/adapter/omp/`) into DSH's `defineTool` contract.
|
|
4
|
+
*
|
|
5
|
+
* This file is pure glue. All grep logic lives in `omp/` (copied verbatim);
|
|
6
|
+
* this adapter only:
|
|
7
|
+
* - builds an OMP `ToolSession` from the DSH exec context + tool-plus config,
|
|
8
|
+
* - constructs the verbatim `GrepTool` and calls its `execute`,
|
|
9
|
+
* - converts the `AgentToolResult` back to a DSH tool result, appending the
|
|
10
|
+
* OMP session-layer meta notice (`formatOutputNotice`, A-6) to the
|
|
11
|
+
* model-visible text.
|
|
12
|
+
*
|
|
13
|
+
* Parameters follow OMP's native style (`pattern` regex + `path` with inline
|
|
14
|
+
* `:N-M` selectors); the DSH tool exposes the same schema so nothing is lost.
|
|
15
|
+
*/
|
|
16
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
+
import type { AgentToolResult } from '@oh-my-pi/pi-agent-core';
|
|
18
|
+
import type { RuntimeConfig } from '../../../config/settings.ts';
|
|
19
|
+
export type { Settings } from '../../omp/config/settings.ts';
|
|
20
|
+
export type { ToolSession } from '../../omp/sdk.ts';
|
|
21
|
+
/** DSH grep 工具输出形状(output.schema 镜像)。 */
|
|
22
|
+
export interface GrepToolOutput {
|
|
23
|
+
text: string;
|
|
24
|
+
matchCount?: number;
|
|
25
|
+
fileCount?: number;
|
|
26
|
+
files?: string[];
|
|
27
|
+
scopePath?: string;
|
|
28
|
+
truncated?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 把 OMP AgentToolResult 转成 DSH grep 工具输出。
|
|
32
|
+
*
|
|
33
|
+
* 上游 session 层会把 `formatOutputNotice(details.meta)` 的限量/截断提示追加
|
|
34
|
+
* 进模型可见文本(wrapToolWithMetaNotice → appendOutputNotice,refs
|
|
35
|
+
* tools/output-meta.ts:586);DSH 无 session 层,适配层在此补上(A-6),
|
|
36
|
+
* 否则 grep 的列宽截断/限量对模型静默。
|
|
37
|
+
*/
|
|
38
|
+
export declare function toGrepToolResult(result: AgentToolResult<any>): GrepToolOutput;
|
|
39
|
+
/**
|
|
40
|
+
* 完整执行链路(defineTool.execute 与单测共用)。
|
|
41
|
+
*
|
|
42
|
+
* `ctx` 参数与 read 的 executeReadTool 对齐(grep 引擎不需要 image bridge /
|
|
43
|
+
* session state,仅占位保持签名一致)。
|
|
44
|
+
*/
|
|
45
|
+
export declare function executeGrepTool(exec: any, cfg: RuntimeConfig, args: any, ctx: Context): Promise<GrepToolOutput>;
|
|
46
|
+
/**
|
|
47
|
+
* Register the grep tool (OMP-native `pattern` + `path` parameters; the `path`
|
|
48
|
+
* accepts an inline `:N-M` selector and may be a semicolon-delimited list).
|
|
49
|
+
*/
|
|
50
|
+
export declare function registerGrep(ctx: Context, getConfig: () => RuntimeConfig): void;
|
|
51
|
+
export declare const applyGrep: typeof registerGrep;
|
|
52
|
+
export declare const registerGrepTool: typeof registerGrep;
|
|
53
|
+
export default registerGrep;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function matchAbsolutePath(matchPath: string, searchPath: string): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-number a unified diff that uses the `+<lineNum>|content` /
|
|
3
|
+
* `-<lineNum>|content` / ` <lineNum>|content` line format into a compact
|
|
4
|
+
* current-file preview. Removed lines are counted for stats and post-edit
|
|
5
|
+
* offset tracking, but omitted from the preview. Added and context lines are
|
|
6
|
+
* anchored to their post-edit positions so a follow-up edit can reuse visible
|
|
7
|
+
* concrete lines directly. Long contiguous added runs are summarized with a
|
|
8
|
+
* `…` marker instead of echoing every inserted line.
|
|
9
|
+
*
|
|
10
|
+
* This is intentionally decoupled from the diff producer: anything that
|
|
11
|
+
* emits the `<sign><lineNum>|<content>` shape works.
|
|
12
|
+
*
|
|
13
|
+
* Migration note: the native engine has no equivalent export — its rendered
|
|
14
|
+
* `EditFileOutcome.text` already carries a compact preview, so DSH's
|
|
15
|
+
* `executeHashlineSingle` passes that text through untouched. This module is
|
|
16
|
+
* kept because `EditFileOutcome.diff` (and the diff/apply-patch engines) use
|
|
17
|
+
* the very same `<sign><lineNum>|<content>` shape, so the helper still has
|
|
18
|
+
* consumers. The algorithm is a **verbatim port** of the vendored
|
|
19
|
+
* `src/tools/hashline/engine/diff-preview.ts` (itself a verbatim port of the
|
|
20
|
+
* pre-18.0 TS engine), with the two option/result types inlined from that
|
|
21
|
+
* engine's `types.ts:147-160` so this file has no dependency on the deleted
|
|
22
|
+
* engine directory.
|
|
23
|
+
*/
|
|
24
|
+
/** Result of {@link buildCompactDiffPreview}. */
|
|
25
|
+
export interface CompactDiffPreview {
|
|
26
|
+
preview: string;
|
|
27
|
+
addedLines: number;
|
|
28
|
+
removedLines: number;
|
|
29
|
+
}
|
|
30
|
+
/** Optional knobs for {@link buildCompactDiffPreview}. */
|
|
31
|
+
export interface CompactDiffOptions {
|
|
32
|
+
/** Added lines kept on each side of a long added-run elision (default 2). */
|
|
33
|
+
maxAddedRunContext?: number;
|
|
34
|
+
/** Back-compat alias for {@link maxAddedRunContext}. */
|
|
35
|
+
maxUnchangedRun?: number;
|
|
36
|
+
}
|
|
37
|
+
export declare function buildCompactDiffPreview(diff: string, options?: CompactDiffOptions): CompactDiffPreview;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH adapter for the native (Rust) hashline engine.
|
|
3
|
+
*
|
|
4
|
+
* Upstream deleted the TypeScript `@oh-my-pi/hashline` package in 18.x and
|
|
5
|
+
* rewrote the engine as `crates/pi-edit/src/modes/hashline/*.rs`, exposed
|
|
6
|
+
* through `@oh-my-pi/pi-natives`. This module is the single seam DSH keeps
|
|
7
|
+
* against it, and it is a **verbatim port** of the two upstream TS files that
|
|
8
|
+
* replaced the old engine surface:
|
|
9
|
+
*
|
|
10
|
+
* - `refs/oh-my-pi/packages/coding-agent/src/tools/hashline-format.ts` (41L)
|
|
11
|
+
* → the `HL_*` constants plus the format/hash helpers below.
|
|
12
|
+
* - `refs/oh-my-pi/packages/coding-agent/src/edit/store.ts` (19L)
|
|
13
|
+
* → {@link getEditStore}.
|
|
14
|
+
*
|
|
15
|
+
* The multi-mode transport (`Patcher`/`Filesystem`/`Clipboard`/`InMemorySnapshotStore`)
|
|
16
|
+
* is gone on purpose: `EditSession.apply` owns staging, snapshot validation,
|
|
17
|
+
* `N*` block resolution, clipboard registers, the no-op loop guard, and the
|
|
18
|
+
* model-facing text. Hosts only supply an {@link EditPolicy} and a writer
|
|
19
|
+
* callback — see `./policy.ts` and `./writer.ts`.
|
|
20
|
+
*
|
|
21
|
+
* `tsconfig.json` aliases `@oh-my-pi/hashline` onto this module, so the DSH
|
|
22
|
+
* tools that only need the display/format helpers (read / write / grep /
|
|
23
|
+
* ast-edit / ast-grep / plan-mode-guard) import it directly.
|
|
24
|
+
*/
|
|
25
|
+
import { blockRangeAt, EditSession, EditStore, editAutoGeneratedMessage, editDescription, editDiffString, editGrammar, editInspect, hashlineCountOps, structuredPatchHunks } from "@oh-my-pi/pi-natives";
|
|
26
|
+
import type { BlockRange, BlockRangeOptions, EditApplyOutcome, EditApplyRequest, EditDiffResult, EditFileOpIntent, EditFileOutcome, EditFilePreview, EditInspection, EditMatcherEntry, EditPolicy, EditPreviewBatch, EditVaultRoot, EditWriteRequest, EditWriteResponse } from "@oh-my-pi/pi-natives";
|
|
27
|
+
import { buildCompactDiffPreview } from "./diff-preview.ts";
|
|
28
|
+
import type { CompactDiffOptions, CompactDiffPreview } from "./diff-preview.ts";
|
|
29
|
+
import { detectLineEnding, normalizeToLF, restoreLineEndings, stripBom } from "./normalize.ts";
|
|
30
|
+
import type { BomResult, LineEnding } from "./normalize.ts";
|
|
31
|
+
/** Opens the `[path#tag]` section header. */
|
|
32
|
+
export declare const HL_FILE_PREFIX = "[";
|
|
33
|
+
/** Closes the `[path#tag]` section header. */
|
|
34
|
+
export declare const HL_FILE_SUFFIX = "]";
|
|
35
|
+
/** Separates the path from the tag inside a section header. */
|
|
36
|
+
export declare const HL_FILE_HASH_SEP = "#";
|
|
37
|
+
/** Hex digits in a section tag. */
|
|
38
|
+
export declare const HL_FILE_HASH_LENGTH = 4;
|
|
39
|
+
/** `MV` op keyword. */
|
|
40
|
+
export declare const HL_MOVE_KEYWORD = "MV";
|
|
41
|
+
/** `REM` op keyword. */
|
|
42
|
+
export declare const HL_REM_KEYWORD = "REM";
|
|
43
|
+
/** Separates an op locator from its body. */
|
|
44
|
+
export declare const HL_LINE_BODY_SEP = ":";
|
|
45
|
+
/** `[path#TAG]` section header. */
|
|
46
|
+
export declare function formatHashlineHeader(path: string, tag: string): string;
|
|
47
|
+
/** `N:line` numbered display rows starting at `startLine` (default 1). */
|
|
48
|
+
export declare function formatNumberedLines(text: string, startLine?: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* One `N:line` display row. Composed in TS rather than delegated: the native
|
|
51
|
+
* surface has no single-line formatter (`hashlineFormatNumberedLines` takes a
|
|
52
|
+
* whole text), and the JS join is byte-identical to the native row shape —
|
|
53
|
+
* upstream composes it the same way (hashline-format.ts:26-28).
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatNumberedLine(lineNumber: number, line: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Split `text` into addressable rows, dropping the empty row a trailing
|
|
58
|
+
* newline produces. Upstream hashline-format.ts:30-34; the native engine
|
|
59
|
+
* numbers the same way internally.
|
|
60
|
+
*/
|
|
61
|
+
export declare function splitAddressableFileLines(text: string): string[];
|
|
62
|
+
/** Strip hashline display prefixes (`N:` / `+N:` …) from pasted rows. */
|
|
63
|
+
export declare function stripHashlinePrefixes(lines: string[]): string[];
|
|
64
|
+
/** 4-hex hashline content tag for `text`. */
|
|
65
|
+
export declare function computeFileHash(text: string): string;
|
|
66
|
+
/** Owner of the lazily created per-session store. */
|
|
67
|
+
export interface EditStoreOwner {
|
|
68
|
+
editStore?: EditStore;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The session's store, created on first use (verbatim upstream
|
|
72
|
+
* `edit/store.ts:15-18`).
|
|
73
|
+
*
|
|
74
|
+
* One store per session carries the full-file snapshots that mint hashline
|
|
75
|
+
* tags, the `CUT`/`PUT` clipboard registers, and the byte-identical no-op loop
|
|
76
|
+
* guard — every {@link EditSession} the edit tool opens shares it, and the
|
|
77
|
+
* read/search/write tools mint their tags into it.
|
|
78
|
+
*
|
|
79
|
+
* DSH note: DSH rebuilds its `ToolSession` object on every tool call and
|
|
80
|
+
* round-trips the store through `shared/session-state.ts`, so the engine path
|
|
81
|
+
* reaches the store through `getFileSnapshotStore` in
|
|
82
|
+
* `src/tools/omp/edit/file-snapshot-store.ts`, which delegates here.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getEditStore(session: EditStoreOwner): EditStore;
|
|
85
|
+
/**
|
|
86
|
+
* Raised when the native engine rejects a payload.
|
|
87
|
+
*
|
|
88
|
+
* The Rust engine reports every rejection as an `isError` outcome carrying the
|
|
89
|
+
* model-facing text — mismatched tag, unseen anchor line, missing file, no-op
|
|
90
|
+
* escalation (upstream `edit/index.ts:495-497` returns it as a tool result).
|
|
91
|
+
* DSH's `edit` tool contract is throw-based (`toText` in
|
|
92
|
+
* `src/tools/edit/adapter/index.ts` throws when a result is `isError`), and
|
|
93
|
+
* DSH's per-file detail shape carries `displayErrorText` sourced from
|
|
94
|
+
* `MismatchError.displayMessage` (`details.ts`, `dispatch.ts`), so
|
|
95
|
+
* `executeHashlineSingle` re-raises the native text as this class. Both
|
|
96
|
+
* `message` and `displayMessage` are exactly the native text, so the model
|
|
97
|
+
* sees the teaching message unchanged.
|
|
98
|
+
*
|
|
99
|
+
* (Upstream's pre-18.0 `MismatchError` formatted its own richer diagnostic
|
|
100
|
+
* from structured fields; the native text already contains that diagnostic,
|
|
101
|
+
* hence the single-string shape.)
|
|
102
|
+
*/
|
|
103
|
+
export declare class MismatchError extends Error {
|
|
104
|
+
/** Model/TUI-facing text — always identical to {@link Error.message}. */
|
|
105
|
+
readonly displayMessage: string;
|
|
106
|
+
constructor(message: string);
|
|
107
|
+
}
|
|
108
|
+
export { blockRangeAt, buildCompactDiffPreview, detectLineEnding, EditStore, EditSession, editAutoGeneratedMessage, editDescription, editDiffString, editGrammar, editInspect, hashlineCountOps, normalizeToLF, restoreLineEndings, stripBom, structuredPatchHunks, };
|
|
109
|
+
export type { BlockRange, BlockRangeOptions, BomResult, CompactDiffOptions, CompactDiffPreview, EditApplyOutcome, EditApplyRequest, EditDiffResult, EditFileOpIntent, EditFileOutcome, EditFilePreview, EditInspection, EditMatcherEntry, EditPolicy, EditPreviewBatch, EditVaultRoot, EditWriteRequest, EditWriteResponse, LineEnding, };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal text-shape normalization: line-ending detection / round-trip and
|
|
3
|
+
* BOM stripping. The edit engines use these to canonicalize text to LF before
|
|
4
|
+
* applying edits and to restore the original shape on write-back.
|
|
5
|
+
*
|
|
6
|
+
* Migration note: this is a **verbatim port** of the vendored
|
|
7
|
+
* `src/tools/hashline/engine/normalize.ts` (itself a verbatim port of the
|
|
8
|
+
* pre-18.0 TS engine). The Rust engine has no equivalent exports — it
|
|
9
|
+
* normalizes internally and never hands these primitives back to the host —
|
|
10
|
+
* but DSH's own edit paths (`omp/edit/normalize.ts`, which re-exports this
|
|
11
|
+
* module through the `@oh-my-pi/hashline` alias, plus `read`/`write`/`grep`
|
|
12
|
+
* snapshot recording) still need them. Kept here so the single hashline seam
|
|
13
|
+
* keeps its old export surface after the engine directory was deleted.
|
|
14
|
+
*/
|
|
15
|
+
export type LineEnding = "\r\n" | "\n";
|
|
16
|
+
/** Detect the first line ending style in `content`. Defaults to LF when neither is present. */
|
|
17
|
+
export declare function detectLineEnding(content: string): LineEnding;
|
|
18
|
+
/** Normalize every line ending to LF. */
|
|
19
|
+
export declare function normalizeToLF(text: string): string;
|
|
20
|
+
/** Re-encode LF text with the requested line ending. */
|
|
21
|
+
export declare function restoreLineEndings(text: string, ending: LineEnding): string;
|
|
22
|
+
export interface BomResult {
|
|
23
|
+
/** Either the empty string or the BOM sequence (currently UTF-8 BOM). */
|
|
24
|
+
bom: string;
|
|
25
|
+
/** Text with any leading BOM removed. */
|
|
26
|
+
text: string;
|
|
27
|
+
}
|
|
28
|
+
/** Strip a UTF-8 BOM if present and return both the BOM and the trailing text. */
|
|
29
|
+
export declare function stripBom(content: string): BomResult;
|