@xiaoso/dsh-tool-plus 0.1.7-beta.0 → 0.1.7
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/index.mjs +11 -9
- package/lib/{scrapers-D8oWspgW.mjs → scrapers-CtQrQ5kG.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/{utils-CCfhUQen.mjs → utils-ECAwvaPQ.mjs} +1 -1
- package/package.json +2 -2
- package/presets/package.json +1 -1
- package/scripts/patch-pi-natives.mjs +108 -108
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
import type { ToolExample } from "@oh-my-pi/pi-ai";
|
|
3
|
+
import { type TruncationResult } from "../../omp/session/streaming-output.ts";
|
|
4
|
+
import type { ToolSession } from "../../omp/sdk.ts";
|
|
5
|
+
import { type OutputMeta } from "../../omp/tools/output-meta.ts";
|
|
6
|
+
declare const findSchema: import("@oh-my-pi/omptype").FluentType<{
|
|
7
|
+
path?: string | undefined;
|
|
8
|
+
gitignore?: boolean | undefined;
|
|
9
|
+
hidden?: boolean | undefined;
|
|
10
|
+
limit?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
path?: string | undefined;
|
|
13
|
+
gitignore?: boolean | undefined;
|
|
14
|
+
hidden?: boolean | undefined;
|
|
15
|
+
limit?: number | undefined;
|
|
16
|
+
}>;
|
|
17
|
+
export type GlobToolInput = typeof findSchema.infer;
|
|
18
|
+
export interface GlobToolDetails {
|
|
19
|
+
truncation?: TruncationResult;
|
|
20
|
+
resultLimitReached?: number;
|
|
21
|
+
meta?: OutputMeta;
|
|
22
|
+
scopePath?: string;
|
|
23
|
+
fileCount?: number;
|
|
24
|
+
files?: string[];
|
|
25
|
+
truncated?: boolean;
|
|
26
|
+
error?: string;
|
|
27
|
+
/** Working directory at search time. Used by the renderer to resolve relative
|
|
28
|
+
* file paths to absolute paths for OSC 8 hyperlinks. */
|
|
29
|
+
cwd?: string;
|
|
30
|
+
/** User-supplied paths whose base directory was missing on disk. The tool
|
|
31
|
+
* skipped these and continued with the surviving entries; surfaced as a
|
|
32
|
+
* non-fatal warning in the renderer and in the model-facing text. */
|
|
33
|
+
missingPaths?: string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Pluggable operations for the find tool.
|
|
37
|
+
* Override these to delegate file search to remote systems (e.g., SSH).
|
|
38
|
+
*/
|
|
39
|
+
export interface GlobOperations {
|
|
40
|
+
/** Check if path exists */
|
|
41
|
+
exists: (absolutePath: string) => Promise<boolean> | boolean;
|
|
42
|
+
/** Optional stat for distinguishing files vs directories. */
|
|
43
|
+
stat?: (absolutePath: string) => Promise<{
|
|
44
|
+
isFile(): boolean;
|
|
45
|
+
isDirectory(): boolean;
|
|
46
|
+
}> | {
|
|
47
|
+
isFile(): boolean;
|
|
48
|
+
isDirectory(): boolean;
|
|
49
|
+
};
|
|
50
|
+
/** Find files matching glob pattern. Returns relative paths. */
|
|
51
|
+
glob: (pattern: string, cwd: string, options: {
|
|
52
|
+
ignore: string[];
|
|
53
|
+
limit: number;
|
|
54
|
+
}) => Promise<string[]> | string[];
|
|
55
|
+
}
|
|
56
|
+
export interface GlobToolOptions {
|
|
57
|
+
/** Custom operations for find. Default: local filesystem + rg */
|
|
58
|
+
operations?: GlobOperations;
|
|
59
|
+
/** Remap slash-only paths to the session cwd before root-search validation. */
|
|
60
|
+
rootPathAlias?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export declare class GlobTool implements AgentTool<typeof findSchema, GlobToolDetails> {
|
|
63
|
+
#private;
|
|
64
|
+
private readonly session;
|
|
65
|
+
readonly name = "glob";
|
|
66
|
+
readonly approval: "read";
|
|
67
|
+
readonly loadMode = "essential";
|
|
68
|
+
readonly label = "Glob";
|
|
69
|
+
get description(): string;
|
|
70
|
+
readonly parameters: import("@oh-my-pi/omptype").FluentType<{
|
|
71
|
+
path?: string | undefined;
|
|
72
|
+
gitignore?: boolean | undefined;
|
|
73
|
+
hidden?: boolean | undefined;
|
|
74
|
+
limit?: number | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
path?: string | undefined;
|
|
77
|
+
gitignore?: boolean | undefined;
|
|
78
|
+
hidden?: boolean | undefined;
|
|
79
|
+
limit?: number | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
readonly examples: readonly ToolExample<typeof findSchema.infer>[];
|
|
82
|
+
readonly strict = true;
|
|
83
|
+
constructor(session: ToolSession, options?: GlobToolOptions);
|
|
84
|
+
execute(_toolCallId: string, params: typeof findSchema.infer, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<GlobToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<GlobToolDetails>>;
|
|
85
|
+
}
|
|
86
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, ToolTier } from "@oh-my-pi/pi-agent-core";
|
|
2
|
+
import { type TruncationResult } from "../../omp/session/streaming-output.ts";
|
|
3
|
+
import type { ToolSession } from "../../omp/sdk.ts";
|
|
4
|
+
import type { OutputMeta } from "../../omp/tools/output-meta.ts";
|
|
5
|
+
declare const searchSchema: import("@oh-my-pi/omptype").FluentType<{
|
|
6
|
+
pattern: string;
|
|
7
|
+
path?: string | undefined;
|
|
8
|
+
case?: boolean | undefined;
|
|
9
|
+
gitignore?: boolean | undefined;
|
|
10
|
+
skip?: number | null | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
pattern: string;
|
|
13
|
+
path?: string | undefined;
|
|
14
|
+
case?: boolean | undefined;
|
|
15
|
+
gitignore?: boolean | undefined;
|
|
16
|
+
skip?: number | null | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
export type GrepToolInput = typeof searchSchema.infer;
|
|
19
|
+
/** Maximum number of distinct files surfaced in a single response. The
|
|
20
|
+
* agent paginates further pages via `skip`. */
|
|
21
|
+
export declare const DEFAULT_FILE_LIMIT = 20;
|
|
22
|
+
/** Per-file match cap for multi-file searches — keeps a single hot file
|
|
23
|
+
* from crowding out diverse hits. Applied in JS after grep returns. */
|
|
24
|
+
export declare const MULTI_FILE_PER_FILE_MATCHES = 20;
|
|
25
|
+
/** Per-file match cap for single-file searches — there's no diversity
|
|
26
|
+
* concern when the scope is one file. */
|
|
27
|
+
export declare const SINGLE_FILE_MATCHES = 200;
|
|
28
|
+
export interface GrepToolDetails {
|
|
29
|
+
truncation?: TruncationResult;
|
|
30
|
+
fileLimitReached?: number;
|
|
31
|
+
perFileLimitReached?: number;
|
|
32
|
+
linesTruncated?: boolean;
|
|
33
|
+
meta?: OutputMeta;
|
|
34
|
+
scopePath?: string;
|
|
35
|
+
matchCount?: number;
|
|
36
|
+
fileCount?: number;
|
|
37
|
+
files?: string[];
|
|
38
|
+
fileMatches?: Array<{
|
|
39
|
+
path: string;
|
|
40
|
+
count: number;
|
|
41
|
+
}>;
|
|
42
|
+
truncated?: boolean;
|
|
43
|
+
error?: string;
|
|
44
|
+
/** Pre-formatted text for the user-visible TUI render. Mirrors the model-facing
|
|
45
|
+
* `result.text` lines but uses a `│` gutter and `*` to mark match lines (vs space for
|
|
46
|
+
* context). The TUI uses this directly so it never parses model-facing hashline anchors. */
|
|
47
|
+
displayContent?: string;
|
|
48
|
+
/** Absolute base directory used during search. Used by the renderer to resolve
|
|
49
|
+
* display-relative paths to absolute paths for OSC 8 hyperlinks. */
|
|
50
|
+
searchPath?: string;
|
|
51
|
+
/** Session cwd at search time. The renderer resolves the display-relative
|
|
52
|
+
* (cwd-relative) header/match paths against this for OSC 8 hyperlinks;
|
|
53
|
+
* `searchPath` is the scope label target, not the display-path base. */
|
|
54
|
+
cwd?: string;
|
|
55
|
+
/** User-supplied paths whose base directory was missing on disk. The tool
|
|
56
|
+
* skipped these and continued with the surviving entries; surfaced as a
|
|
57
|
+
* non-fatal warning in the renderer and in the model-facing text. */
|
|
58
|
+
missingPaths?: string[];
|
|
59
|
+
}
|
|
60
|
+
type SearchParams = typeof searchSchema.infer;
|
|
61
|
+
/**
|
|
62
|
+
* Construction-time overrides for callers that are not the model.
|
|
63
|
+
*
|
|
64
|
+
* The model-facing schema deliberately does not grow these: they exist for
|
|
65
|
+
* wire bridges (the Cursor `pi_grep` frame) whose protocol carries an explicit
|
|
66
|
+
* context width and total match cap, and which would otherwise have to drop
|
|
67
|
+
* them. Unset means "use the session settings / built-in caps" — the behavior
|
|
68
|
+
* every model-issued call keeps.
|
|
69
|
+
*/
|
|
70
|
+
export interface GrepToolOptions {
|
|
71
|
+
/** Overrides `grep.contextBefore`/`grep.contextAfter` for every call on this instance. */
|
|
72
|
+
context?: number;
|
|
73
|
+
/** Caps total surfaced matches. Applied on top of the built-in per-file and file-window caps, never above them. */
|
|
74
|
+
totalMatchLimit?: number;
|
|
75
|
+
}
|
|
76
|
+
export declare class GrepTool implements AgentTool<typeof searchSchema, GrepToolDetails> {
|
|
77
|
+
#private;
|
|
78
|
+
private readonly session;
|
|
79
|
+
readonly name = "grep";
|
|
80
|
+
readonly approval: (args: unknown) => ToolTier;
|
|
81
|
+
readonly label = "Grep";
|
|
82
|
+
readonly loadMode = "discoverable";
|
|
83
|
+
readonly summary = "Grep file contents using ripgrep (fast regex search)";
|
|
84
|
+
get description(): string;
|
|
85
|
+
readonly parameters: import("@oh-my-pi/omptype").FluentType<{
|
|
86
|
+
pattern: string;
|
|
87
|
+
path?: string | undefined;
|
|
88
|
+
case?: boolean | undefined;
|
|
89
|
+
gitignore?: boolean | undefined;
|
|
90
|
+
skip?: number | null | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
pattern: string;
|
|
93
|
+
path?: string | undefined;
|
|
94
|
+
case?: boolean | undefined;
|
|
95
|
+
gitignore?: boolean | undefined;
|
|
96
|
+
skip?: number | null | undefined;
|
|
97
|
+
}>;
|
|
98
|
+
readonly strict = true;
|
|
99
|
+
constructor(session: ToolSession, options?: GrepToolOptions);
|
|
100
|
+
execute(_toolCallId: string, params: SearchParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<GrepToolDetails>, _toolContext?: AgentToolContext): Promise<AgentToolResult<GrepToolDetails>>;
|
|
101
|
+
}
|
|
102
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One file's contribution to a grouped file output. The header itself is generated
|
|
3
|
+
* by `formatGroupedFiles` (one `#` per nesting level); use `headerSuffix` to tack
|
|
4
|
+
* on extras like ` (1 replacement)`.
|
|
5
|
+
*/
|
|
6
|
+
export interface GroupedFileSection {
|
|
7
|
+
/** Optional suffix appended to the file header. */
|
|
8
|
+
headerSuffix?: string;
|
|
9
|
+
/** Body lines emitted into the textual model output. */
|
|
10
|
+
modelLines: string[];
|
|
11
|
+
/** Body lines emitted into the display output. Defaults to `modelLines`. */
|
|
12
|
+
displayLines?: string[];
|
|
13
|
+
/** When true, the file (and its header) is omitted entirely. */
|
|
14
|
+
skip?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface GroupedFilesOutput {
|
|
17
|
+
model: string[];
|
|
18
|
+
display: string[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Render a list of files as a multi-level, prefix-folded directory tree shared by
|
|
22
|
+
* grep, ast-grep, ast-edit, and the LSP diagnostic formatter.
|
|
23
|
+
*
|
|
24
|
+
* Layout (one `#` per level; the shared prefix folds into the top header):
|
|
25
|
+
* # packages/pkg/src/
|
|
26
|
+
* ## root.ts
|
|
27
|
+
* …body…
|
|
28
|
+
* ## nested/
|
|
29
|
+
* ### child.ts
|
|
30
|
+
* …body…
|
|
31
|
+
*
|
|
32
|
+
* Files in the (folded) project root become single-`#` headers with no parent
|
|
33
|
+
* directory line. A blank line precedes every directory header and every
|
|
34
|
+
* root-level file so the renderers can split the output into collapsible groups.
|
|
35
|
+
*/
|
|
36
|
+
export declare function formatGroupedFiles(files: string[], renderFile: (filePath: string) => GroupedFileSection): GroupedFilesOutput;
|
|
37
|
+
/** Per-line classification of grouped output, used by renderers for hyperlinks. */
|
|
38
|
+
export interface GroupedLineContext {
|
|
39
|
+
/** Directory header, file header, or any non-header body/content line. */
|
|
40
|
+
kind: "dir" | "file" | "content";
|
|
41
|
+
/** Number of leading `#` for headers; 0 for content lines. */
|
|
42
|
+
depth: number;
|
|
43
|
+
/** Resolved absolute path of the dir/file a header points at (when resolvable). */
|
|
44
|
+
headerPath?: string;
|
|
45
|
+
/** For content lines, the absolute path of the owning file (line hyperlinks). */
|
|
46
|
+
filePath?: string;
|
|
47
|
+
/** Header is an internal/url-like target the caller resolves itself. */
|
|
48
|
+
isUrl?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Walk grouped output lines, tracking a directory stack keyed by header depth, so
|
|
52
|
+
* each header and body line can be linked back to its absolute filesystem path.
|
|
53
|
+
* Reconstruction is stack-based (not per-blank-group) so nested directory headers
|
|
54
|
+
* resolve correctly across the whole output.
|
|
55
|
+
*
|
|
56
|
+
* `headerBase` is the directory the displayed (folded) header paths are relative
|
|
57
|
+
* to — for grep/ast tools that is the session cwd, since display paths are
|
|
58
|
+
* formatted relative to cwd regardless of the (sub)directory the search was
|
|
59
|
+
* scoped to. `fileScope` is the initial owning file for body lines that appear
|
|
60
|
+
* before any header (single-file scopes have no `#` headers); it defaults to
|
|
61
|
+
* `headerBase` and should be passed the scoped file's absolute path.
|
|
62
|
+
*/
|
|
63
|
+
export declare function classifyGroupedLines(lines: readonly string[], headerBase: string | undefined, fileScope?: string | undefined): GroupedLineContext[];
|
|
64
|
+
/**
|
|
65
|
+
* Split line indices into blank-line-separated groups, mirroring
|
|
66
|
+
* `splitGroupsByBlankLine`: when any blank line is present, break on runs of
|
|
67
|
+
* blanks; otherwise return a single group of the non-empty lines. Returning
|
|
68
|
+
* indices lets callers slice parallel arrays (raw lines, styled lines, contexts).
|
|
69
|
+
*/
|
|
70
|
+
export declare function groupLineIndicesByBlank(rawLines: readonly string[]): number[][];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DSH adapter type shim for OMP `tools/index.ts`.
|
|
3
|
+
*
|
|
4
|
+
* The original is the 746-line OMP tool-registry barrel (imports every
|
|
5
|
+
* built-in tool and re-exports the whole toolbox). The tool-plus adapters
|
|
6
|
+
* only consume its `ToolSession` and `Tool` types, so this shared shim
|
|
7
|
+
* re-exports those from the shared DSH adapter (`../sdk`) and pi-agent-core.
|
|
8
|
+
* No tool registries are carried.
|
|
9
|
+
*
|
|
10
|
+
* NOTE (step.md 决策记录): registry barrel intentionally not ported —
|
|
11
|
+
* decision pending user confirmation.
|
|
12
|
+
*/
|
|
13
|
+
import type { AgentTool } from '@oh-my-pi/pi-agent-core';
|
|
14
|
+
import type { Settings } from '../config/settings.ts';
|
|
15
|
+
declare module '@oh-my-pi/pi-agent-core' {
|
|
16
|
+
interface AgentToolContext {
|
|
17
|
+
hasUI?: boolean;
|
|
18
|
+
toolNames?: string[];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export type { ToolSession } from '../sdk.ts';
|
|
22
|
+
export type { Settings };
|
|
23
|
+
export type Tool = AgentTool<any, any, any>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LimitsMeta } from "./output-meta";
|
|
2
|
+
export interface ListLimitResult<T> {
|
|
3
|
+
items: T[];
|
|
4
|
+
limitReached?: number;
|
|
5
|
+
meta: Partial<LimitsMeta>;
|
|
6
|
+
}
|
|
7
|
+
export interface ListLimitOptions {
|
|
8
|
+
limit?: number;
|
|
9
|
+
headLimit?: number;
|
|
10
|
+
limitType?: "match" | "result";
|
|
11
|
+
}
|
|
12
|
+
export declare function applyListLimit<T>(items: T[], options: ListLimitOptions): ListLimitResult<T>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format a single line of match output for grep/ast-grep style results.
|
|
3
|
+
*
|
|
4
|
+
* Matched lines are prefixed with `*`; context lines are prefixed with a single
|
|
5
|
+
* space so line numbers align in column. In hashline mode the line uses the
|
|
6
|
+
* editable `LINE:content` shape under a snapshot-tag header; in plain mode it
|
|
7
|
+
* keeps the legacy `LINE|content` display-only shape. Line numbers are never padded.
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatMatchLine(lineNumber: number, line: string, isMatch: boolean, options: {
|
|
10
|
+
useHashLines: boolean;
|
|
11
|
+
}): string;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured metadata for tool outputs.
|
|
3
|
+
*
|
|
4
|
+
* Tools populate details.meta using the fluent OutputMetaBuilder.
|
|
5
|
+
* DSH adapters format notices themselves via formatOutputNotice; the OMP-side
|
|
6
|
+
* auto-wrap/spill machinery was cut with the TUI layer (plan.md 拍板#17).
|
|
7
|
+
*/
|
|
8
|
+
import { type Settings } from "../config/settings";
|
|
9
|
+
import type { OutputSummary, TruncationResult } from "../session/streaming-output";
|
|
10
|
+
/**
|
|
11
|
+
* Truncation metadata for the output notice.
|
|
12
|
+
*/
|
|
13
|
+
export interface TruncationMeta {
|
|
14
|
+
direction: "head" | "tail" | "middle";
|
|
15
|
+
truncatedBy: "lines" | "bytes" | "middle";
|
|
16
|
+
totalLines: number;
|
|
17
|
+
totalBytes: number;
|
|
18
|
+
outputLines: number;
|
|
19
|
+
outputBytes: number;
|
|
20
|
+
maxBytes?: number;
|
|
21
|
+
/** Line range shown (1-indexed, inclusive). Omitted for middle elision. */
|
|
22
|
+
shownRange?: {
|
|
23
|
+
start: number;
|
|
24
|
+
end: number;
|
|
25
|
+
};
|
|
26
|
+
/** Head/tail line ranges shown when direction === "middle". */
|
|
27
|
+
headRange?: {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
};
|
|
31
|
+
tailRange?: {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
};
|
|
35
|
+
/** Bytes elided from the middle. */
|
|
36
|
+
elidedBytes?: number;
|
|
37
|
+
/** Lines elided from the middle. */
|
|
38
|
+
elidedLines?: number;
|
|
39
|
+
/** Artifact ID if full output was saved */
|
|
40
|
+
artifactId?: string;
|
|
41
|
+
/** Next offset for pagination (head truncation only) */
|
|
42
|
+
nextOffset?: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Source resolution info for the output.
|
|
46
|
+
*/
|
|
47
|
+
export type SourceMeta = {
|
|
48
|
+
type: "path";
|
|
49
|
+
value: string;
|
|
50
|
+
} | {
|
|
51
|
+
type: "url";
|
|
52
|
+
value: string;
|
|
53
|
+
} | {
|
|
54
|
+
type: "internal";
|
|
55
|
+
value: string;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Limit-specific notices.
|
|
59
|
+
*/
|
|
60
|
+
export interface LimitsMeta {
|
|
61
|
+
matchLimit?: {
|
|
62
|
+
reached: number;
|
|
63
|
+
suggestion: number;
|
|
64
|
+
};
|
|
65
|
+
resultLimit?: {
|
|
66
|
+
reached: number;
|
|
67
|
+
suggestion: number;
|
|
68
|
+
};
|
|
69
|
+
headLimit?: {
|
|
70
|
+
reached: number;
|
|
71
|
+
suggestion: number;
|
|
72
|
+
};
|
|
73
|
+
columnTruncated?: {
|
|
74
|
+
maxColumn: number;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Structured metadata for tool outputs.
|
|
79
|
+
*/
|
|
80
|
+
export interface OutputMeta {
|
|
81
|
+
truncation?: TruncationMeta;
|
|
82
|
+
source?: SourceMeta;
|
|
83
|
+
limits?: LimitsMeta;
|
|
84
|
+
}
|
|
85
|
+
export interface TruncationOptions {
|
|
86
|
+
direction: "head" | "tail" | "middle";
|
|
87
|
+
startLine?: number;
|
|
88
|
+
totalFileLines?: number;
|
|
89
|
+
artifactId?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface TruncationSummaryOptions {
|
|
92
|
+
direction: "head" | "tail" | "middle";
|
|
93
|
+
startLine?: number;
|
|
94
|
+
totalFileLines?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface TruncationTextOptions {
|
|
97
|
+
direction: "head" | "tail" | "middle";
|
|
98
|
+
totalLines?: number;
|
|
99
|
+
totalBytes?: number;
|
|
100
|
+
maxBytes?: number;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Fluent builder for OutputMeta.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* details.meta = outputMeta()
|
|
108
|
+
* .truncation(truncation, { direction: "head" })
|
|
109
|
+
* .matchLimit(limitReached ? effectiveLimit : 0)
|
|
110
|
+
* .columnTruncated(linesTruncated ? DEFAULT_MAX_COLUMN : 0)
|
|
111
|
+
* .get();
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export declare class OutputMetaBuilder {
|
|
115
|
+
#private;
|
|
116
|
+
/** Add truncation info from TruncationResult. No-op if not truncated. */
|
|
117
|
+
truncation(result: TruncationResult, options: TruncationOptions): this;
|
|
118
|
+
/** Add truncation info from OutputSummary. No-op if not truncated. */
|
|
119
|
+
truncationFromSummary(summary: OutputSummary, options: TruncationSummaryOptions): this;
|
|
120
|
+
/** Add truncation info from truncated output text. No-op if truncation not detected. */
|
|
121
|
+
truncationFromText(text: string, options: TruncationTextOptions): this;
|
|
122
|
+
/** Add match limit notice. No-op if reached <= 0. */
|
|
123
|
+
matchLimit(reached: number, suggestion?: number): this;
|
|
124
|
+
/** Add limit notices in one call. */
|
|
125
|
+
limits(limits: {
|
|
126
|
+
matchLimit?: number;
|
|
127
|
+
resultLimit?: number;
|
|
128
|
+
headLimit?: number;
|
|
129
|
+
columnMax?: number;
|
|
130
|
+
}): this;
|
|
131
|
+
/** Add result limit notice. No-op if reached <= 0. */
|
|
132
|
+
resultLimit(reached: number, suggestion?: number): this;
|
|
133
|
+
/** Add limit notice for head truncation. No-op if reached <= 0. */
|
|
134
|
+
headLimit(reached: number, suggestion?: number): this;
|
|
135
|
+
/** Add column truncation notice. No-op if maxColumn <= 0. */
|
|
136
|
+
columnTruncated(maxColumn: number): this;
|
|
137
|
+
/** Add source path info. */
|
|
138
|
+
sourcePath(value: string): this;
|
|
139
|
+
/** Add source URL info. */
|
|
140
|
+
sourceUrl(value: string): this;
|
|
141
|
+
/** Add internal URL source info (skill://, agent://, artifact://). */
|
|
142
|
+
sourceInternal(value: string): this;
|
|
143
|
+
/** Get the built OutputMeta, or undefined if empty. */
|
|
144
|
+
get(): OutputMeta | undefined;
|
|
145
|
+
}
|
|
146
|
+
/** Create a new OutputMetaBuilder. */
|
|
147
|
+
export declare function outputMeta(): OutputMetaBuilder;
|
|
148
|
+
export declare function formatFullOutputReference(artifactId: string): string;
|
|
149
|
+
export declare function formatTruncationMetaNotice(truncation: TruncationMeta): string;
|
|
150
|
+
/**
|
|
151
|
+
* Format notices from OutputMeta for LLM consumption.
|
|
152
|
+
* Returns empty string if no notices needed.
|
|
153
|
+
*/
|
|
154
|
+
export declare function formatOutputNotice(meta: OutputMeta | undefined): string;
|
|
155
|
+
/**
|
|
156
|
+
* Resolve the per-line column cap from session settings. Shared by streaming
|
|
157
|
+
* executors (bash/python/ssh/eval via OutputSink) and the `read` tool's
|
|
158
|
+
* line-buffer post-processing, so one setting controls both surfaces.
|
|
159
|
+
*/
|
|
160
|
+
export declare function resolveOutputMaxColumns(s: Settings | undefined): number;
|