@xiaoso/dsh-tool-plus 0.1.0-beta.3 → 0.1.0-beta.4
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/lib/abort-D1_Z5Ut5.mjs +51 -0
- package/lib/abort-dIkZBV7Q.mjs +51 -0
- package/lib/amazon-bedrock-B0nxT06F.mjs +917 -0
- package/lib/amazon-bedrock-WQhvjHYu.mjs +917 -0
- package/lib/anthropic-CJCauvYz.mjs +3115 -0
- package/lib/anthropic-CZghe_9U.mjs +3115 -0
- package/lib/anthropic-sCMH7JID.mjs +262 -0
- package/lib/anthropic-tTntD8BD.mjs +262 -0
- package/lib/api-key-login-BzqNdM2y.mjs +157 -0
- package/lib/api-key-login-CWVwvHT1.mjs +157 -0
- package/lib/aws-credentials-CXryMobh.mjs +867 -0
- package/lib/aws-credentials-ChG79ey-.mjs +867 -0
- package/lib/azure-openai-responses-Cgmc-rbL.mjs +274 -0
- package/lib/azure-openai-responses-DuukbD0F.mjs +274 -0
- package/lib/bun-shim.mjs +81 -6
- package/lib/bundled-references-Cavaffah.mjs +55 -0
- package/lib/bundled-references-sLN0YdXU.mjs +55 -0
- package/lib/callback-server-CQ5Jo8F-.mjs +398 -0
- package/lib/callback-server-DDSrZ6l_.mjs +398 -0
- package/lib/client.js +1 -1
- package/lib/cursor-B3zg7EHj.mjs +273 -0
- package/lib/cursor-B6TUEmgP.mjs +135 -0
- package/lib/cursor-D8gvtTL3.mjs +135 -0
- package/lib/cursor-DkSX2h3H.mjs +5441 -0
- package/lib/cursor-aJrXeYCb.mjs +273 -0
- package/lib/cursor-mJQwUKXK.mjs +5441 -0
- package/lib/device-code-DBo3B5nh.mjs +51 -0
- package/lib/device-code-DIb0FU-H.mjs +51 -0
- package/lib/devin-BHZZyMhO.mjs +95 -0
- package/lib/devin-BK7DHeca.mjs +114 -0
- package/lib/devin-CfMp3cXS.mjs +95 -0
- package/lib/devin-D9zR5B_R.mjs +542 -0
- package/lib/devin-Q1yem3lp.mjs +114 -0
- package/lib/devin-vNZTNUON.mjs +542 -0
- package/lib/error-Dd8DIqs-.mjs +1449 -0
- package/lib/error-yCSG0mGC.mjs +1449 -0
- package/lib/event-stream-BbFZJy-z.mjs +151 -0
- package/lib/event-stream-loUa0s1T.mjs +151 -0
- package/lib/fs-promises-shim-Bx0fpxuk.mjs +57 -0
- package/lib/github-copilot-B1yiyVRh.mjs +104 -0
- package/lib/github-copilot-BWT3eAOF.mjs +208 -0
- package/lib/github-copilot-CYkjeTi3.mjs +208 -0
- package/lib/github-copilot-jscUZ8Hf.mjs +104 -0
- package/lib/gitlab-duo-CM7Ref1H.mjs +155 -0
- package/lib/gitlab-duo-gubO4FNw.mjs +155 -0
- package/lib/gitlab-duo-workflow-BGAF6JDw.mjs +91 -0
- package/lib/gitlab-duo-workflow-D78tdn8E.mjs +91 -0
- package/lib/google-BS4T25Pn.mjs +30 -0
- package/lib/google-TFe-7-of.mjs +30 -0
- package/lib/google-antigravity-DGmwC2KV.mjs +198 -0
- package/lib/google-antigravity-DNYhgTpA.mjs +198 -0
- package/lib/google-auth-B6gjsZvg.mjs +232 -0
- package/lib/google-auth-De7_s3eo.mjs +232 -0
- package/lib/google-gemini-cli-CWu8HvXW.mjs +211 -0
- package/lib/google-gemini-cli-Cb97bzQc.mjs +850 -0
- package/lib/google-gemini-cli-Cqds_Q5T.mjs +850 -0
- package/lib/google-gemini-cli-Dsztq0N5.mjs +211 -0
- package/lib/google-oauth-shared-CuEHaDDj.mjs +147 -0
- package/lib/google-oauth-shared-yqlyqPPC.mjs +147 -0
- package/lib/google-shared-CgKmmdO3.mjs +760 -0
- package/lib/google-shared-Dr-VG-ap.mjs +760 -0
- package/lib/google-vertex-BDN2tLaD.mjs +99 -0
- package/lib/google-vertex-DopVOQOG.mjs +99 -0
- package/lib/identity-Da1GPU9a.mjs +219 -0
- package/lib/identity-xRP7_eSR.mjs +219 -0
- package/lib/idle-iterator-Baoyn3Hp.mjs +366 -0
- package/lib/idle-iterator-DUjKQEGT.mjs +366 -0
- package/lib/index.mjs +1731 -1178
- package/lib/kimi--wUOWER5.mjs +236 -0
- package/lib/kimi-Dh0pv3WZ.mjs +236 -0
- package/lib/markit-BL3cH47U.mjs +1417 -0
- package/lib/markit-BNiNY6SE.mjs +1417 -0
- package/lib/minimax-code-DCbuA6Yk.mjs +53 -0
- package/lib/minimax-code-Uq8Qu9LW.mjs +53 -0
- package/lib/models-D_XnT6ay.mjs +104660 -0
- package/lib/models-SGASygJ3.mjs +104660 -0
- package/lib/ollama-DPzBmq89.mjs +589 -0
- package/lib/ollama-DoBz5SFm.mjs +589 -0
- package/lib/openai-codex-Bi-4S4PX.mjs +255 -0
- package/lib/openai-codex-Ch8CkT3p.mjs +255 -0
- package/lib/openai-codex-responses-CvxL_FMF.mjs +3144 -0
- package/lib/openai-codex-responses-pejZgdZo.mjs +3144 -0
- package/lib/openai-completions-CF8IyNtP.mjs +1360 -0
- package/lib/openai-completions-DIf361kF.mjs +1360 -0
- package/lib/openai-reasoning-fallback-Nj6yB2rY.mjs +286 -0
- package/lib/openai-reasoning-fallback-OdJREP1o.mjs +286 -0
- package/lib/openai-responses-BqXJInHX.mjs +867 -0
- package/lib/openai-responses-Db_a-U4-.mjs +867 -0
- package/lib/opencode-DhMolSoB.mjs +38 -0
- package/lib/opencode-Rq_Q2vAO.mjs +38 -0
- package/lib/perplexity-C4iLVMUj.mjs +194 -0
- package/lib/perplexity-Uu7Jzg5b.mjs +194 -0
- package/lib/proxy-DDqrmjjC.mjs +190 -0
- package/lib/proxy-pM_NIv-H.mjs +190 -0
- package/lib/request-debug-HJMoJncL.mjs +183 -0
- package/lib/sanitize-text-CfcXzw5X.mjs +33 -0
- package/lib/scrapers-BkFfcPHj.mjs +9198 -0
- package/lib/scrapers-CVptboMs.mjs +9198 -0
- package/lib/scrapers-nhQAvc8d.mjs +9198 -0
- package/lib/shell-snapshot-fn-env.sh +67 -43
- package/lib/src-BgpusnsB.mjs +5076 -0
- package/lib/src-lDmkSRbm.mjs +5006 -0
- package/lib/stream-BlldLkVq.mjs +10236 -0
- package/lib/stream-CRtexYLe.mjs +10236 -0
- package/lib/stream-markup-healing-DMsxBx1L.mjs +491 -0
- package/lib/stream-markup-healing-KMkiAA00.mjs +491 -0
- package/lib/turndown-DN7ByzEI.mjs +667 -0
- package/lib/types/config/settings.d.ts +9 -1
- package/lib/types/config/truncate.d.ts +9 -5
- package/lib/types/tools/bash/background.d.ts +1 -1
- package/lib/types/tools/bash/bash-executor.d.ts +4 -0
- package/lib/types/tools/bash/bash-interceptor.d.ts +10 -8
- package/lib/types/tools/bash/cd-workdir.d.ts +35 -0
- package/lib/types/tools/bash/non-interactive-env.d.ts +2 -0
- package/lib/types/tools/bash/render.d.ts +4 -3
- package/lib/types/tools/bash/sanitize-text.d.ts +5 -0
- package/lib/types/tools/bash/shell-snapshot.d.ts +4 -1
- package/lib/types/tools/bash/shell-tokenize.d.ts +60 -0
- package/lib/types/tools/bash/streaming-output.d.ts +12 -212
- 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/edit/adapter/index.d.ts +25 -3
- package/lib/types/tools/edit/adapter/tools/auto-generated-guard.d.ts +7 -17
- package/lib/types/tools/glob/adapter/index.d.ts +27 -1
- package/lib/types/tools/grep/adapter/index.d.ts +29 -1
- package/lib/types/tools/omp/edit/dispatch.d.ts +43 -0
- package/lib/types/tools/omp/edit/hashline/noop-loop-guard.d.ts +3 -1
- package/lib/types/tools/omp/tools/auto-generated-guard.d.ts +20 -0
- package/lib/types/tools/omp/tools/write.d.ts +4 -4
- package/lib/types/tools/shared/auto-generated-guard.dsh.d.ts +16 -4
- package/lib/types/tools/shared/bun-shim.d.ts +4 -0
- package/lib/types/tools/shared/fs-promises-shim.d.ts +3 -1
- package/lib/types/tools/shared/omp-prompt.d.ts +13 -7
- package/lib/types/tools/shared/session-state.d.ts +9 -3
- package/lib/utils-Bw139LTz.mjs +8119 -0
- package/lib/utils-CZw4tVZQ.mjs +12315 -0
- package/lib/utils-CiGN7OHR.mjs +12315 -0
- package/lib/utils-Cp76gCyk.mjs +8119 -0
- package/lib/utils-D0GRDgAr.mjs +12315 -0
- package/lib/utils-D2YknRk4.mjs +51 -0
- package/lib/utils-DzXZDfYc.mjs +51 -0
- package/lib/vision-guard-01qSwFpf.mjs +92 -0
- package/lib/vision-guard-DzZGaOga.mjs +92 -0
- package/lib/wafer-CgtPHerf.mjs +17 -0
- package/lib/wafer-cBtrn6q9.mjs +17 -0
- package/lib/xai-oauth-Buk8XVvM.mjs +446 -0
- package/lib/xai-oauth-CMal8l1O.mjs +446 -0
- package/lib/xiaomi-CZgwvX2G.mjs +157 -0
- package/lib/xiaomi-D2qT5cAC.mjs +157 -0
- package/lib/zai-7DWMkEqM.mjs +203 -0
- package/lib/zai-C59YnomG.mjs +203 -0
- package/lib/zip-Cg9ANN_U.mjs +1316 -0
- package/lib/zip-D36ZKsP8.mjs +1316 -0
- package/package.json +1 -1
- package/presets/package.json +1 -1
|
@@ -6,15 +6,43 @@
|
|
|
6
6
|
* this adapter only:
|
|
7
7
|
* - builds an OMP `ToolSession` from the DSH exec context + tool-plus config,
|
|
8
8
|
* - constructs the verbatim `GrepTool` and calls its `execute`,
|
|
9
|
-
* - converts the `AgentToolResult` back to a DSH tool result
|
|
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.
|
|
10
12
|
*
|
|
11
13
|
* Parameters follow OMP's native style (`pattern` regex + `path` with inline
|
|
12
14
|
* `:N-M` selectors); the DSH tool exposes the same schema so nothing is lost.
|
|
13
15
|
*/
|
|
14
16
|
import type { Context } from '@deepseek-ai/cordis';
|
|
17
|
+
import type { AgentToolResult } from '@oh-my-pi/pi-agent-core';
|
|
15
18
|
import type { RuntimeConfig } from '../../../config/settings.ts';
|
|
16
19
|
export type { Settings } from '../../omp/config/settings.ts';
|
|
17
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>;
|
|
18
46
|
/**
|
|
19
47
|
* Register the grep tool (OMP-native `pattern` + `path` parameters; the `path`
|
|
20
48
|
* accepts an inline `:N-M` selector and may be a semicolon-delimited list).
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Edit dispatch layer — path resolution + multi-entry/multi-file aggregation.
|
|
3
|
+
*
|
|
4
|
+
* Ported verbatim from upstream `packages/coding-agent/src/edit/index.ts`
|
|
5
|
+
* (refs/oh-my-pi, 17.3.5): `resolveEditPath` (:77-93), `executeApplyPatchPerFile`
|
|
6
|
+
* (:139-256) and `executeSinglePathEntries` (:258-365). Algorithm and user-facing
|
|
7
|
+
* copy are byte-for-byte upstream; only the import surface was redirected to the
|
|
8
|
+
* DSH-resident modules and the LSP-only surface was cut, per the established
|
|
9
|
+
* omp/ adaptation conventions:
|
|
10
|
+
* - `renderer` → `./details` (TUI renderer cut, plan.md 拍板#17): the
|
|
11
|
+
* `EditToolDetails` / `EditToolPerFileResult` shapes live in `./details.ts`;
|
|
12
|
+
* the upstream per-file `diagnostics` field went with the LSP layer.
|
|
13
|
+
* - `resolvePlanPath` → DSH adapter shim (`edit/adapter/tools/plan-mode-guard`,
|
|
14
|
+
* verbatim resolution minus local:// schemes) — same redirection the local
|
|
15
|
+
* engines (modes/replace.ts, modes/patch.ts) already use.
|
|
16
|
+
* - `LspBatchRequest` / `flushLspWritethroughBatch` → local type + no-op below.
|
|
17
|
+
* DSH never constructs an outer batch request, so every `batchRequest` inside
|
|
18
|
+
* the aggregators resolves to `undefined` and the flush branches stay
|
|
19
|
+
* unreachable; the flow is kept verbatim so this file stays diffable
|
|
20
|
+
* against refs.
|
|
21
|
+
*/
|
|
22
|
+
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
|
23
|
+
import type { ToolSession } from "../tools/index.ts";
|
|
24
|
+
import type { EditToolDetails } from "./details";
|
|
25
|
+
/**
|
|
26
|
+
* LSP write-batch handle (upstream `tools/render-utils.ts`, surfaced through the
|
|
27
|
+
* edit renderer). Shape verbatim; DSH cuts the LSP layer (plan.md 拍板#5), so no
|
|
28
|
+
* caller ever constructs one — see {@link flushLspWritethroughBatch}.
|
|
29
|
+
*/
|
|
30
|
+
export interface LspBatchRequest {
|
|
31
|
+
id: string;
|
|
32
|
+
flush: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare function resolveEditPath(session: ToolSession, authoredPath: string, options: {
|
|
35
|
+
mustExist: boolean;
|
|
36
|
+
signal?: AbortSignal;
|
|
37
|
+
}): Promise<string>;
|
|
38
|
+
/** Run apply_patch file operations and aggregate their multi-file result. */
|
|
39
|
+
export declare function executeApplyPatchPerFile(fileEntries: {
|
|
40
|
+
path: string;
|
|
41
|
+
run: (batchRequest: LspBatchRequest | undefined) => Promise<AgentToolResult<EditToolDetails>>;
|
|
42
|
+
}[], outerBatchRequest: LspBatchRequest | undefined, cwd: string, signal: AbortSignal | undefined, onUpdate?: (partialResult: AgentToolResult<EditToolDetails>) => void): Promise<AgentToolResult<EditToolDetails>>;
|
|
43
|
+
export declare function executeSinglePathEntries(path: string, runs: ((batchRequest: LspBatchRequest | undefined) => Promise<AgentToolResult<EditToolDetails>>)[], outerBatchRequest: LspBatchRequest | undefined, onUpdate: ((partialResult: AgentToolResult<EditToolDetails>) => void) | undefined, cwd: string, signal: AbortSignal | undefined): Promise<AgentToolResult<EditToolDetails>>;
|
|
@@ -65,8 +65,10 @@ export declare function recordNoopEdit(session: NoopLoopGuardOwner, canonicalPat
|
|
|
65
65
|
*/
|
|
66
66
|
export declare function resetNoopEdit(session: NoopLoopGuardOwner, canonicalPath: string): void;
|
|
67
67
|
/**
|
|
68
|
-
* Stable hash of the raw patch input. Bun's `Bun.hash` is
|
|
68
|
+
* Stable hash of the raw patch input. Bun's `Bun.hash` is wyhash64 — fast,
|
|
69
69
|
* non-cryptographic, more than adequate for "is this the same payload?".
|
|
70
|
+
* (xxHash64 is the separate `Bun.hash.xxHash64` namespace; the shim serves
|
|
71
|
+
* both — second-impl-audit.md S-3.)
|
|
70
72
|
*/
|
|
71
73
|
export declare function hashPatchInput(input: string): string;
|
|
72
74
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Settings } from "../config/settings.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Check if a file is auto-generated by examining its content.
|
|
4
|
+
* Throws ToolError if the file appears to be auto-generated.
|
|
5
|
+
*
|
|
6
|
+
* @param absolutePath - Absolute path to the file
|
|
7
|
+
* @param displayPath - Path to show in error messages (relative or as provided)
|
|
8
|
+
* @param activeSettings - Session settings; falls back to global settings or the schema default
|
|
9
|
+
*/
|
|
10
|
+
export declare function assertEditableFile(absolutePath: string, displayPath?: string, activeSettings?: Settings): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Check if file content is auto-generated.
|
|
13
|
+
* Uses only the first CHECK_BYTE_COUNT characters of the content.
|
|
14
|
+
* Throws ToolError if the content appears to be auto-generated.
|
|
15
|
+
*
|
|
16
|
+
* @param content - File content to check (can be full content or prefix)
|
|
17
|
+
* @param displayPath - Path to show in error messages
|
|
18
|
+
* @param activeSettings - Session settings; falls back to global settings or the schema default
|
|
19
|
+
*/
|
|
20
|
+
export declare function assertEditableFileContent(content: string, displayPath: string, activeSettings?: Settings): void;
|
|
@@ -3,11 +3,11 @@ import type { ToolSession } from "../../omp/sdk.ts";
|
|
|
3
3
|
import type { OutputMeta } from "../../omp/tools/output-meta.ts";
|
|
4
4
|
import { type XdevDispatch } from "../../omp/tools/resolve.ts";
|
|
5
5
|
declare const writeSchema: import("@oh-my-pi/omptype").FluentType<{
|
|
6
|
-
content: string;
|
|
7
6
|
path: string;
|
|
8
|
-
}, {
|
|
9
7
|
content: string;
|
|
8
|
+
}, {
|
|
10
9
|
path: string;
|
|
10
|
+
content: string;
|
|
11
11
|
}>;
|
|
12
12
|
export type WriteToolInput = typeof writeSchema.infer;
|
|
13
13
|
/** Details returned by the write tool for TUI rendering */
|
|
@@ -36,11 +36,11 @@ export declare class WriteTool implements AgentTool<typeof writeSchema, WriteToo
|
|
|
36
36
|
readonly label = "Write";
|
|
37
37
|
readonly description: string;
|
|
38
38
|
readonly parameters: import("@oh-my-pi/omptype").FluentType<{
|
|
39
|
-
content: string;
|
|
40
39
|
path: string;
|
|
41
|
-
}, {
|
|
42
40
|
content: string;
|
|
41
|
+
}, {
|
|
43
42
|
path: string;
|
|
43
|
+
content: string;
|
|
44
44
|
}>;
|
|
45
45
|
readonly strict = true;
|
|
46
46
|
readonly concurrency = "exclusive";
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A-3 合并后的兼容转发层(second-impl-audit.md A-3)。
|
|
3
|
+
*
|
|
4
|
+
* 唯一实现在 `../omp/tools/auto-generated-guard.ts`(OMP 逐字移植 + T17-1
|
|
5
|
+
* Windows basename 修复)。原「简化重写」已删除:SimpleLRU、手搓 peekFile、
|
|
6
|
+
* 截断的三步整改文案、推送开关全部移除;开关语义改为 settings-pull
|
|
7
|
+
* (`edit.blockAutoGenerated`,三级回退 activeSettings → 全局 settings →
|
|
8
|
+
* schema 默认 true,refs settings-schema.ts:3230)。
|
|
9
|
+
*/
|
|
10
|
+
export { assertEditableFile, assertEditableFileContent, } from '../omp/tools/auto-generated-guard.ts';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated 兼容旧推送式 API:守卫已改为 settings-pull(调用方传
|
|
13
|
+
* session.settings,未传时回退全局/默认),推送开关不再参与行为判定。
|
|
14
|
+
* 保留为 no-op 以兼容既有 import;src/index.ts 的调用点已删除。
|
|
15
|
+
*/
|
|
16
|
+
export declare function setBlockAutoGenerated(_enabled: boolean): void;
|
|
@@ -31,6 +31,8 @@ export declare class BunFileSliceShim extends BunFileShim {
|
|
|
31
31
|
text(): Promise<string>;
|
|
32
32
|
bytes(): Promise<Uint8Array>;
|
|
33
33
|
arrayBuffer(): Promise<ArrayBuffer>;
|
|
34
|
+
/** Blob semantics: stream yields only the slice window. */
|
|
35
|
+
stream(): ReadableStream<Uint8Array>;
|
|
34
36
|
}
|
|
35
37
|
export declare class FileSinkShim {
|
|
36
38
|
#private;
|
|
@@ -96,6 +98,7 @@ type ArchiveMemberContent = string | Uint8Array | Blob;
|
|
|
96
98
|
declare function archiveWrite(destPath: string, record: Record<string, ArchiveMemberContent>, opts?: {
|
|
97
99
|
compress?: 'gzip';
|
|
98
100
|
}): Promise<void>;
|
|
101
|
+
export declare function bunStripANSI(text: string): string;
|
|
99
102
|
export interface BunShimSurface {
|
|
100
103
|
file(path: string): BunFileShim;
|
|
101
104
|
write(path: string, data: string | Uint8Array | Blob | ArrayBuffer): Promise<void>;
|
|
@@ -111,6 +114,7 @@ export interface BunShimSurface {
|
|
|
111
114
|
Image: typeof BunImageShim;
|
|
112
115
|
CryptoHasher: typeof CryptoHasherShim;
|
|
113
116
|
color(color: string, format?: string): string;
|
|
117
|
+
stripANSI(text: string): string;
|
|
114
118
|
JSON: {
|
|
115
119
|
parse(s: string): unknown;
|
|
116
120
|
stringify(v: unknown): string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from 'fs/promises';
|
|
2
|
-
/** Bun's `node:fs/promises` extension: `exists(path)` → `Promise<boolean>`.
|
|
2
|
+
/** Bun's `node:fs/promises` extension: `exists(path)` → `Promise<boolean>`.
|
|
3
|
+
* Bun swallows every stat error, not just ENOENT — ENAMETOOLONG on a 60k-char
|
|
4
|
+
* path also yields false (probe audit-probes/S15/s15-exists4.ts). */
|
|
3
5
|
export declare function exists(path: string): Promise<boolean>;
|
|
4
6
|
/**
|
|
5
7
|
* Augment the real `node:fs/promises` module type with Bun's `exists` so tsc
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* OMP prompt.md → DSH tool description 适配层(verbatim md 不动,适配在此)。
|
|
3
3
|
*
|
|
4
|
-
* OMP 的 prompts/tools/*.md 用 Handlebars
|
|
5
|
-
*
|
|
6
|
-
* - `renderOmpPrompt
|
|
7
|
-
*
|
|
4
|
+
* OMP 的 prompts/tools/*.md 用 Handlebars 条件渲染,DSH 的 defineTool
|
|
5
|
+
* description 是静态字符串,这里提供:
|
|
6
|
+
* - `renderOmpPrompt`:完全委托 OMP 自家引擎(@oh-my-pi/pi-utils 的
|
|
7
|
+
* prompt.render = 结构化 Handlebars 解析 + post-render format 后处理,
|
|
8
|
+
* 与上游 read.ts 渲染工具描述同一条管线)。按「移植绝不允许第二套实现」
|
|
9
|
+
* (notebook T10-1 同类教训):自写 regex 渲染器已删除——其全文懒匹配
|
|
10
|
+
* 会跨条件边界吞并并在真值分支残留孤立 `{{/if}}`(2026-08-28 tools:sdk
|
|
11
|
+
* "malformed prompt variable" 事故根源)。strict:false → 未传变量按 falsy
|
|
12
|
+
* 取 else 分支;畸形模板 compile 期抛错(注册期 fail-loud)。
|
|
8
13
|
* - `sanitizeOmpPrompt`:按工具剔除 DSH 不适用的 OMP 提法(内部协议
|
|
9
14
|
* artifact:// ssh:// memory:// xd://、browser、scout/Task 子代理、inspect_image),
|
|
10
15
|
* 全部剔除点记录在 step.md「提示词接入」节;md 源文件保持 verbatim 不变。
|
|
@@ -19,10 +24,11 @@ export interface OmpPromptVars {
|
|
|
19
24
|
/** DSH 无 OMP Task/scout 子代理,恒 false → 相关句在 sanitize 中整体剔除,无需变量 */
|
|
20
25
|
scoutAvailable?: boolean;
|
|
21
26
|
}
|
|
22
|
-
/** 渲染 {{#if KEY}}A{{else}}B{{/if}} 与 {{#if KEY}}A{{/if}}
|
|
27
|
+
/** 渲染 {{#if KEY}}A{{else}}B{{/if}} 与 {{#if KEY}}A{{/if}}——委托 OMP 引擎
|
|
28
|
+
* (@oh-my-pi/pi-utils prompt.render,strict:false:未传变量按 falsy 取 else
|
|
29
|
+
* 分支;畸形模板 compile 期抛错,注册期 fail-loud)。保留首尾 trim 对齐
|
|
30
|
+
* 既有调用点行为。 */
|
|
23
31
|
export declare function renderOmpPrompt(text: string, vars: OmpPromptVars): string;
|
|
24
|
-
/** 剔除非空白/注释行——供剔除后再次 trim。 */
|
|
25
|
-
export declare function cleanLines(text: string): string;
|
|
26
32
|
/** grep.md:internal URLs 提法 + scout 句剔除。 */
|
|
27
33
|
export declare function sanitizeGrepPrompt(text: string): string;
|
|
28
34
|
/** glob.md:internal URL/memory:// 提法 + scout avoid 句剔除。 */
|
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
export interface OmpSessionState {
|
|
22
22
|
/** 冲突注册表(read 注册 / write 消费)。 */
|
|
23
23
|
conflictHistory?: unknown;
|
|
24
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* hashline 快照存储(read 锚点 / edit seen-lines 校验 / 锚点漂移恢复;
|
|
26
|
+
* A-4 桥接,与 conflictHistory 对称:attach/persist round-trip)。
|
|
27
|
+
*/
|
|
25
28
|
fileSnapshotStore?: unknown;
|
|
26
29
|
}
|
|
27
30
|
/** 取(或惰性建)某个 DSH session 的 OMP 状态。 */
|
|
@@ -32,12 +35,15 @@ export declare function getOmpSessionState(sessionKey: object): OmpSessionState;
|
|
|
32
35
|
*/
|
|
33
36
|
export declare function attachOmpSessionState(session: {
|
|
34
37
|
conflictHistory?: unknown;
|
|
38
|
+
fileSnapshotStore?: unknown;
|
|
35
39
|
}, sessionKey: object | undefined): void;
|
|
36
40
|
/**
|
|
37
41
|
* 把 ToolSession 上引擎新建/更新的状态写回共享存储(execute 结束后调用)。
|
|
38
|
-
* OMP
|
|
39
|
-
*
|
|
42
|
+
* OMP 引擎会惰性新建 ConflictHistory / fileSnapshotStore 并赋到 session
|
|
43
|
+
* 对象上(如 read.ts 经 getFileSnapshotStore 挂快照库),必须回写才能被
|
|
44
|
+
* 下一次调用恢复。
|
|
40
45
|
*/
|
|
41
46
|
export declare function persistOmpSessionState(sessionKey: object | undefined, session: {
|
|
42
47
|
conflictHistory?: unknown;
|
|
48
|
+
fileSnapshotStore?: unknown;
|
|
43
49
|
}): void;
|