@jarkkojs/readseek-api 0.10.7 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -5
- package/dist/argv.d.ts +74 -39
- package/dist/client-output.d.ts +273 -20
- package/dist/client.d.ts +39 -128
- package/dist/contract.d.ts +30 -30
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1718 -1662
- package/dist/process.d.ts +3 -2
- package/dist/show-presentation.d.ts +15 -0
- package/dist/validation.d.ts +3 -10
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export type
|
|
4
|
-
export
|
|
5
|
-
export interface ReadSeekInspectOptions {
|
|
6
|
-
select?: InspectFacet | InspectFacet[];
|
|
7
|
-
selector?: string;
|
|
8
|
-
query?: string;
|
|
9
|
-
end?: number;
|
|
10
|
-
limit?: number;
|
|
11
|
-
depth?: number;
|
|
12
|
-
language?: string;
|
|
13
|
-
visionMode?: VisionMode;
|
|
14
|
-
visionLevel?: VisionLevel;
|
|
15
|
-
stdin?: string;
|
|
16
|
-
stdinName?: string;
|
|
1
|
+
import * as argv from "./argv.ts";
|
|
2
|
+
import * as output from "./client-output.ts";
|
|
3
|
+
export type * from "./client-output.ts";
|
|
4
|
+
export interface ReadSeekRunOptions {
|
|
17
5
|
signal?: AbortSignal;
|
|
18
|
-
timeoutMs?: number;
|
|
19
|
-
/** Route through the runner's vision path (serialized, long timeout). */
|
|
20
|
-
vision?: boolean;
|
|
21
|
-
}
|
|
22
|
-
export interface ReadSeekInspectOutput {
|
|
23
|
-
metadata?: ReadSeekDetection;
|
|
24
|
-
cache?: ReadSeekDocumentCache;
|
|
25
|
-
content?: unknown;
|
|
26
|
-
map?: ReadSeekMapOutput;
|
|
27
|
-
diagnostics?: ReadSeekCheckOutput;
|
|
28
|
-
identity?: IdentifyOutput;
|
|
29
|
-
}
|
|
30
|
-
export interface ReadSeekExtractOptions {
|
|
31
6
|
stdin?: string;
|
|
32
|
-
stdinName?: string;
|
|
33
|
-
signal?: AbortSignal;
|
|
34
7
|
timeoutMs?: number;
|
|
35
8
|
cancelable?: boolean;
|
|
9
|
+
vision?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ReadSeekRunner {
|
|
12
|
+
text(args: readonly string[], options?: ReadSeekRunOptions): Promise<string>;
|
|
13
|
+
kdl(args: readonly string[], options?: ReadSeekRunOptions): Promise<unknown>;
|
|
36
14
|
}
|
|
15
|
+
type Options<T> = Omit<T, "path" | "requestFromStdin" | "flagOrder"> & Omit<ReadSeekRunOptions, "vision">;
|
|
16
|
+
export type ReadSeekContentOptions = Options<argv.ShowContentArgsInput>;
|
|
17
|
+
export type ReadSeekStructureOptions = Options<argv.ShowStructureArgsInput>;
|
|
18
|
+
export type ReadSeekMetadataOptions = Options<argv.ShowMetadataArgsInput>;
|
|
19
|
+
export type ReadSeekAssetsOptions = Options<argv.ShowAssetsArgsInput>;
|
|
20
|
+
export type ReadSeekSyntaxOptions = Options<argv.CheckSyntaxArgsInput>;
|
|
21
|
+
export type ReadSeekRulesOptions = Options<argv.CheckRulesArgsInput>;
|
|
22
|
+
export type ReadSeekCaptionOptions = Options<argv.GenerateCaptionArgsInput>;
|
|
23
|
+
export type ReadSeekVisionOptions = Options<argv.DetectObjectsArgsInput>;
|
|
24
|
+
export type ReadSeekNodesOptions = Options<argv.FindNodesArgsInput>;
|
|
25
|
+
export type ReadSeekTextOptions = Options<argv.FindTextArgsInput>;
|
|
26
|
+
export type ReadSeekDefinitionsOptions = Options<argv.FindDefinitionsArgsInput>;
|
|
27
|
+
export type ReadSeekReferencesOptions = Options<argv.FindReferencesArgsInput>;
|
|
28
|
+
export type ReadSeekEditOptions = Options<argv.EditTextArgsInput>;
|
|
29
|
+
export type ReadSeekRenameOptions = Options<argv.RenameSymbolArgsInput>;
|
|
37
30
|
export interface ReadSeekFailure {
|
|
38
31
|
code: "readseek-not-installed" | "readseek-execution-error";
|
|
39
32
|
message: string;
|
|
@@ -45,103 +38,21 @@ export interface ReadSeekFailure {
|
|
|
45
38
|
* install hint) versus any other execution error.
|
|
46
39
|
*/
|
|
47
40
|
export declare function classifyReadSeekFailure(err: unknown): ReadSeekFailure;
|
|
48
|
-
export interface ReadSeekRunOptions {
|
|
49
|
-
signal?: AbortSignal;
|
|
50
|
-
stdin?: string;
|
|
51
|
-
timeoutMs?: number;
|
|
52
|
-
cancelable?: boolean;
|
|
53
|
-
/** Set by callers that read a vision payload; the runner may serialize and lengthen timeouts. */
|
|
54
|
-
vision?: boolean;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Host-supplied spawn seam: resolve the binary and run it, returning stdout as
|
|
58
|
-
* text or decoded KDL. The plugin owns binary resolution, cache-dir decoration,
|
|
59
|
-
* cwd, timeout settings, and any vision serialization queue; the client owns
|
|
60
|
-
* argv construction and output parsing.
|
|
61
|
-
*/
|
|
62
|
-
export interface ReadSeekRunner {
|
|
63
|
-
text(args: readonly string[], options?: ReadSeekRunOptions): Promise<string>;
|
|
64
|
-
kdl(args: readonly string[], options?: ReadSeekRunOptions): Promise<unknown>;
|
|
65
|
-
}
|
|
66
|
-
interface ReadSeekSearchOptions {
|
|
67
|
-
language?: string;
|
|
68
|
-
limit?: number;
|
|
69
|
-
gitScope?: GitScope;
|
|
70
|
-
signal?: AbortSignal;
|
|
71
|
-
}
|
|
72
|
-
interface ReadSeekRefsOptions {
|
|
73
|
-
name?: string;
|
|
74
|
-
scope?: boolean;
|
|
75
|
-
line?: number;
|
|
76
|
-
column?: number;
|
|
77
|
-
language?: string;
|
|
78
|
-
gitScope?: GitScope;
|
|
79
|
-
signal?: AbortSignal;
|
|
80
|
-
}
|
|
81
|
-
interface DefOptions {
|
|
82
|
-
name: string;
|
|
83
|
-
language?: string;
|
|
84
|
-
gitScope?: GitScope;
|
|
85
|
-
signal?: AbortSignal;
|
|
86
|
-
}
|
|
87
|
-
interface EditOptions {
|
|
88
|
-
apply?: boolean;
|
|
89
|
-
planHash?: string;
|
|
90
|
-
language?: string;
|
|
91
|
-
signal?: AbortSignal;
|
|
92
|
-
timeoutMs?: number;
|
|
93
|
-
cancelable?: boolean;
|
|
94
|
-
}
|
|
95
|
-
interface RenameOptions {
|
|
96
|
-
to: string;
|
|
97
|
-
line: number;
|
|
98
|
-
column?: number;
|
|
99
|
-
workspace?: string;
|
|
100
|
-
apply?: boolean;
|
|
101
|
-
planHash?: string;
|
|
102
|
-
language?: string;
|
|
103
|
-
gitScope?: GitScope;
|
|
104
|
-
signal?: AbortSignal;
|
|
105
|
-
}
|
|
106
|
-
interface IdentifyOptions {
|
|
107
|
-
line: number;
|
|
108
|
-
column?: number;
|
|
109
|
-
language?: string;
|
|
110
|
-
signal?: AbortSignal;
|
|
111
|
-
}
|
|
112
41
|
export interface ReadSeekClient {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
image(filePath: string, modes: ReadSeekImageMode[], options?: {
|
|
129
|
-
signal?: AbortSignal;
|
|
130
|
-
}): Promise<ReadSeekDetection>;
|
|
131
|
-
preparedImage(filePath: string, options?: {
|
|
132
|
-
signal?: AbortSignal;
|
|
133
|
-
}): Promise<ReadSeekPreparedImage>;
|
|
134
|
-
search(target: string, pattern: string, options?: ReadSeekSearchOptions): Promise<ReadSeekSearchOutput>;
|
|
135
|
-
refs(target: string, options?: ReadSeekRefsOptions): Promise<ReadSeekReference[]>;
|
|
136
|
-
def(target: string, options: DefOptions): Promise<DefLocation[]>;
|
|
137
|
-
check(filePath: string, content: string, options?: {
|
|
138
|
-
signal?: AbortSignal;
|
|
139
|
-
}): Promise<ReadSeekCheckOutput>;
|
|
140
|
-
identify(filePath: string, content: string, options: IdentifyOptions): Promise<IdentifyOutput>;
|
|
141
|
-
detect(filePath: string, options?: {
|
|
142
|
-
signal?: AbortSignal;
|
|
143
|
-
}): Promise<ReadSeekDetection>;
|
|
144
|
-
edit(filePath: string, edits: unknown[], options?: EditOptions): Promise<EditOutput>;
|
|
145
|
-
rename(filePath: string, options: RenameOptions): Promise<RenameOutput>;
|
|
42
|
+
showContent(path: string, options?: ReadSeekContentOptions): Promise<output.ReadSeekContentOutput>;
|
|
43
|
+
showStructure(path: string, options?: ReadSeekStructureOptions): Promise<output.ReadSeekStructureOutputEnvelope>;
|
|
44
|
+
showMetadata(path: string, options?: ReadSeekMetadataOptions): Promise<output.ReadSeekDetection>;
|
|
45
|
+
showAssets(path: string, options?: ReadSeekAssetsOptions): Promise<output.ReadSeekAssetsOutput>;
|
|
46
|
+
checkSyntax(path: string, options?: ReadSeekSyntaxOptions): Promise<output.ReadSeekCheckOutput>;
|
|
47
|
+
checkRules(path: string, options: ReadSeekRulesOptions): Promise<output.ReadSeekRulesOutput>;
|
|
48
|
+
generateCaption(path: string, options?: ReadSeekCaptionOptions): Promise<output.ReadSeekContentOutput>;
|
|
49
|
+
detectObjects(path: string, options?: ReadSeekVisionOptions): Promise<output.ReadSeekContentOutput>;
|
|
50
|
+
recognizeText(path: string, options?: ReadSeekVisionOptions): Promise<output.ReadSeekContentOutput>;
|
|
51
|
+
findNodes(path: string, options: ReadSeekNodesOptions): Promise<output.ReadSeekSearchOutput>;
|
|
52
|
+
findText(path: string, options: ReadSeekTextOptions): Promise<output.ReadSeekTextSearchOutput>;
|
|
53
|
+
findDefinitions(path: string, options: ReadSeekDefinitionsOptions): Promise<output.DefLocation[]>;
|
|
54
|
+
findReferences(path: string, options: ReadSeekReferencesOptions): Promise<output.ReadSeekReference[]>;
|
|
55
|
+
editText(path: string, edits: unknown[], options?: ReadSeekEditOptions): Promise<output.EditOutput>;
|
|
56
|
+
renameSymbol(path: string, options: ReadSeekRenameOptions): Promise<output.RenameOutput>;
|
|
146
57
|
}
|
|
147
58
|
export declare function createReadSeekClient(runner: ReadSeekRunner): ReadSeekClient;
|
package/dist/contract.d.ts
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
export declare const INSPECT_FACETS: readonly ["metadata", "content", "map", "diagnostics", "identity"];
|
|
2
|
-
export type InspectFacet = (typeof INSPECT_FACETS)[number];
|
|
3
|
-
export declare const VISION_MODES: readonly ["none", "all", "ocr", "caption", "objects"];
|
|
4
|
-
export type VisionMode = (typeof VISION_MODES)[number];
|
|
5
|
-
export declare const VISION_ANALYSIS_MODES: readonly ["all", "ocr", "caption", "objects"];
|
|
6
|
-
export type VisionAnalysisMode = (typeof VISION_ANALYSIS_MODES)[number];
|
|
7
1
|
export declare const VISION_LEVELS: readonly ["low", "medium", "high"];
|
|
8
2
|
export type VisionLevel = (typeof VISION_LEVELS)[number];
|
|
9
3
|
export declare const EDIT_VARIANTS: readonly ["set_line", "replace_lines", "insert_after", "replace", "replace_symbol"];
|
|
10
4
|
export type EditVariant = (typeof EDIT_VARIANTS)[number];
|
|
11
5
|
export declare const GIT_SCOPES: readonly ["tracked", "untracked", "ignored", "all"];
|
|
12
6
|
export type GitScope = (typeof GIT_SCOPES)[number];
|
|
13
|
-
export declare const TOOL_NAMES: readonly ["
|
|
7
|
+
export declare const TOOL_NAMES: readonly ["show_content", "show_structure", "show_metadata", "show_assets", "check_syntax", "check_rules", "generate_caption", "detect_objects", "recognize_text", "find_nodes", "find_text", "find_definitions", "find_references", "edit_text", "rename_symbol", "write_file"];
|
|
14
8
|
export type ToolName = (typeof TOOL_NAMES)[number];
|
|
15
9
|
export declare const PARAM_DESCRIPTIONS: {
|
|
16
10
|
readonly path: "Absolute or relative file path";
|
|
@@ -21,31 +15,30 @@ export declare const PARAM_DESCRIPTIONS: {
|
|
|
21
15
|
readonly languageOverride: "Language override";
|
|
22
16
|
readonly languageSymbol: "Language override for symbol replacement";
|
|
23
17
|
readonly pattern: "AST pattern (ast-grep style), such as console.log($$$ARGS)";
|
|
18
|
+
readonly patternContext: "Surrounding code context for sub-statement patterns";
|
|
19
|
+
readonly selector: "Target AST node kind to extract from pattern context";
|
|
24
20
|
readonly grepPattern: "Regex pattern; set literal for exact text";
|
|
25
21
|
readonly name: "Qualified or unqualified symbol name";
|
|
26
22
|
readonly refsName: "Identifier to find references for";
|
|
27
|
-
readonly scope: "Restrict results to the binding at the cursor";
|
|
28
|
-
readonly line: "One-based cursor line; required with scope";
|
|
29
|
-
readonly renameLine: "One-based cursor line of the symbol to rename";
|
|
30
|
-
readonly column: "One-based cursor byte column for disambiguation";
|
|
31
23
|
readonly gitScope: "In a Git repository, which files to search: tracked, untracked, ignored (untracked plus ignored), or all. Defaults to tracked plus untracked.";
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
readonly query: "KDL selection query, @path, or '-' for standard input";
|
|
24
|
+
readonly at: "Location selector: line:N[:COLUMN], hash:H[:COLUMN], symbol:NAME, page:N, node:ID, or asset:ID";
|
|
25
|
+
readonly assetAt: "Document selector: page:N, node:ID, or asset:ID";
|
|
26
|
+
readonly rule: "KDL node selection rule, @path, or '-' for standard input";
|
|
27
|
+
readonly rules: "KDL structural checks, @path, or '-' for standard input";
|
|
37
28
|
readonly stdinName: "File name hint when the target is '-'";
|
|
38
29
|
readonly end: "Last line to include";
|
|
39
30
|
readonly limit: "Maximum number of lines to include";
|
|
40
|
-
readonly
|
|
31
|
+
readonly depth: "Maximum structural depth for structure output; defaults to 1 in agent tools";
|
|
41
32
|
readonly offset: "One-based starting line";
|
|
42
33
|
readonly readLimit: "Maximum lines to return";
|
|
43
34
|
readonly symbolRead: "Symbol name to read";
|
|
44
35
|
readonly bundle: "Include related symbols from the same file; requires symbol";
|
|
45
|
-
readonly
|
|
46
|
-
readonly
|
|
47
|
-
readonly
|
|
48
|
-
readonly
|
|
36
|
+
readonly level: "Explicit inference level: low (default), medium, or high";
|
|
37
|
+
readonly include: "Additional caption tasks: text and/or objects";
|
|
38
|
+
readonly kind: "Restrict structure to this node kind";
|
|
39
|
+
readonly outline: "Return a symbol outline";
|
|
40
|
+
readonly noAnchors: "Omit source line anchors";
|
|
41
|
+
readonly text: "Literal native text query; adapter find_text also supports regex via pattern";
|
|
49
42
|
readonly edits: "Use set_line, replace_lines, insert_after, replace_symbol, or replace";
|
|
50
43
|
readonly editVariant: "Exactly one nested edit variant";
|
|
51
44
|
readonly setLine: "Replace one line: {\"set_line\":{\"anchor\":\"LINE:HASH\",\"new_text\":\"...\"}}";
|
|
@@ -82,15 +75,22 @@ export declare const PARAM_DESCRIPTIONS: {
|
|
|
82
75
|
readonly scopeContext: "Context lines within each symbol";
|
|
83
76
|
};
|
|
84
77
|
export declare const TOOL_DESCRIPTIONS: {
|
|
85
|
-
readonly
|
|
86
|
-
readonly
|
|
87
|
-
readonly
|
|
88
|
-
readonly
|
|
89
|
-
readonly
|
|
90
|
-
readonly
|
|
91
|
-
readonly
|
|
92
|
-
readonly
|
|
93
|
-
readonly
|
|
78
|
+
readonly show_content: "Read source, document content, or image descriptors without inference. Obtain fresh `LINE:HASH` anchors before edits; use at with a column for cursor context. Document results include typed nodes and cached asset paths.";
|
|
79
|
+
readonly show_structure: "Show parsed source or document hierarchy. Use shallow depth for file overviews.";
|
|
80
|
+
readonly show_metadata: "Show format, source identity, language, dimensions, or page count without decoding image content or inference.";
|
|
81
|
+
readonly show_assets: "Return selected document asset descriptors with usable cached paths. Adapters attach images from those paths.";
|
|
82
|
+
readonly check_syntax: "Check parser syntax diagnostics. Exit 0 is clean, 1 has findings, 2 is failure; this is not type checking.";
|
|
83
|
+
readonly check_rules: "Evaluate KDL structural assertions. Exit 0 is clean, 1 has findings, 2 is failure.";
|
|
84
|
+
readonly generate_caption: "Explicitly infer a caption using an installed model. Include text and objects to request OCR and detection too; never downloads models automatically.";
|
|
85
|
+
readonly detect_objects: "Explicitly infer object labels and bounding boxes using an installed model.";
|
|
86
|
+
readonly recognize_text: "Explicitly recognize text from pixels using an installed model; reading never silently invokes OCR.";
|
|
87
|
+
readonly find_nodes: "Find AST nodes by pattern or KDL selection rule. Returns edit-ready anchors. Use `find_text` for text and regex.";
|
|
88
|
+
readonly find_text: "Search text or regex and return edit-ready `LINE:HASH` anchors. Native CLI text is literal; adapters preserve regex, glob, context, summary, and symbol grouping.";
|
|
89
|
+
readonly find_definitions: "Find a symbol definition or declaration by qualified or unqualified name.";
|
|
90
|
+
readonly find_references: "Find identifier-name matches with name, or binding-scoped references with at. Use before renaming or deleting a symbol.";
|
|
91
|
+
readonly edit_text: "Edit existing files with fresh `LINE:HASH` anchors. Each edits item contains exactly one set_line, replace_lines, insert_after, replace_symbol, or replace object. Preview before applying a verified plan.";
|
|
92
|
+
readonly rename_symbol: "Rename a symbol at a line or hash cursor with binding-aware edits and stale-plan protection.";
|
|
93
|
+
readonly write_file: "Create or replace a complete text file and return `LINE:HASH` anchors. Use `edit_text` for small changes.";
|
|
94
94
|
};
|
|
95
95
|
export declare function renderToolDescription(name: ToolName, aliases?: Readonly<Partial<Record<ToolName, string>>>): string;
|
|
96
96
|
export type JsonSchema = {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from "./contract.ts";
|
|
2
|
+
export * from "./policy.ts";
|
|
3
|
+
export * from "./validation.ts";
|
|
4
|
+
export * from "./argv.ts";
|
|
5
|
+
export * from "./client.ts";
|
|
4
6
|
export { serializeEditPlan } from "./edit-plan.ts";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
+
export * from "./hashline.ts";
|
|
8
|
+
export * from "./show-presentation.ts";
|
|
7
9
|
export { READSEEK_BINARY_ENV, READSEEK_PLATFORM_PACKAGES, readSeekBinaryName, readSeekPlatformKey, resolveReadSeekBinaryFromPackages, resolveReadSeekBinaryOverride, resolveReadSeekCacheDir, type ModuleResolver, type ReadSeekCacheOptions, } from "./platform.ts";
|
|
8
10
|
export { canonicalPathKey, expandUserPath, isSubPath, resolveScopedPath, resolveToCwd, } from "./path.ts";
|
|
9
11
|
export { cleanReadSeekErrorText } from "./error.ts";
|
|
10
12
|
export { parseReadSeekKdl } from "./output-kdl.ts";
|
|
11
|
-
export { DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_READSEEK_TIMEOUT_MS, ensureSuccessfulStdout, failureFromProcessResult, parseSuccessfulKdl, readSeekProcessEnvironment, resolveProcessLimits, type ProcessRunOptions, type ProcessRunResult, } from "./process.ts";
|
|
13
|
+
export { DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_READSEEK_TIMEOUT_MS, acceptsReadSeekExitCode, ensureSuccessfulStdout, failureFromProcessResult, parseSuccessfulKdl, readSeekProcessEnvironment, resolveProcessLimits, type ProcessRunOptions, type ProcessRunResult, } from "./process.ts";
|
|
12
14
|
export { runReadSeekNode, runReadSeekNodeKdl, runReadSeekNodeText, } from "./process-node.ts";
|
|
13
15
|
export { runReadSeekBun, runReadSeekBunKdl, runReadSeekBunText, } from "./process-bun.ts";
|
|
14
|
-
export { classifyReadSeekFailure, createReadSeekClient, type DefLocation, type EditOutput, type IdentifierOutput, type IdentifyOutput, type ReadSeekCheckOutput, type ReadSeekClient, type ReadSeekDetection, type ReadSeekDetectedObject, type ReadSeekDiagnostic, type ReadSeekExtractOptions, type ReadSeekInspectOptions, type ReadSeekInspectOutput, type ReadSeekDocumentCache, type ReadSeekFailure, type ReadSeekHashline, type ReadSeekImageDetection, type ReadSeekImageMode, type ReadSeekMapOutput, type ReadSeekMapNode, type ReadSeekOcrText, type ReadSeekPreparedImage, type ReadSeekReadOutput, type ReadSeekReference, type ReadSeekRunOptions, type ReadSeekRunner, type RenameConflict, type RenameEdit, type RenameFileOutput, type RenameOutput, type ReadSeekSearchCapture, type ReadSeekSearchFileOutput, type ReadSeekSearchMatch, type ReadSeekSymbol, } from "./client.ts";
|