@nuvin/agent-core 0.2.0-rc.1 → 0.2.0-rc.11
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/dist/VERSION +2 -2
- package/dist/agent/index.js +1 -1
- package/dist/agent/metrics.d.ts +17 -1
- package/dist/chunk-D5IVWJHX.js +1 -1
- package/dist/chunk-FFIZ6TKW.js +1 -1
- package/dist/chunk-GAZGO6N7.js +1 -0
- package/dist/chunk-IUZALP6K.js +1 -0
- package/dist/chunk-KIIEBXJF.js +1 -0
- package/dist/chunk-LIE76IJA.js +1 -0
- package/dist/chunk-X7VAACWY.js +1 -1
- package/dist/chunk-YNOIG4FD.js +1 -0
- package/dist/formats/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/lsp/client.d.ts +4 -0
- package/dist/models/chat-model.d.ts +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.js +1 -1
- package/dist/models/mock-model.d.ts +2 -0
- package/dist/models/model-cost.d.ts +5 -0
- package/dist/models/model-pricing-generator.d.ts +9 -0
- package/dist/models/model-pricing-products.d.ts +45 -0
- package/dist/models/model-pricing-types.d.ts +33 -0
- package/dist/models/model-pricing.d.ts +13 -0
- package/dist/models/model-pricing.generated.d.ts +23147 -0
- package/dist/models/model-registry.d.ts +8 -0
- package/dist/models/openai-surfaces.d.ts +4 -1
- package/dist/models/routed-model.d.ts +3 -0
- package/dist/shared/abort-aware-semaphore.d.ts +5 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -1
- package/dist/shared/reasoning-config.d.ts +3 -4
- package/dist/shared/types.d.ts +105 -24
- package/dist/tools/{internal-tool-runtime.d.ts → core/internal-tool-runtime.d.ts} +1 -1
- package/dist/tools/core/mock-tool-runtime.d.ts +3 -0
- package/dist/tools/core/runtime-manager-tools.d.ts +87 -0
- package/dist/tools/{tool-output-offload.d.ts → core/tool-output-offload.d.ts} +1 -1
- package/dist/tools/{tools.d.ts → core/tools.d.ts} +4 -1
- package/dist/tools/file-editing/anchored-file-edit.d.ts +53 -0
- package/dist/tools/file-editing/anchored-file-errors.d.ts +5 -0
- package/dist/tools/file-editing/anchored-file-operations.d.ts +38 -0
- package/dist/tools/file-editing/anchored-file-read.d.ts +37 -0
- package/dist/tools/file-editing/atomic-file-write.d.ts +19 -0
- package/dist/tools/file-editing/file-edit-tool.d.ts +166 -0
- package/dist/tools/file-editing/file-mutation-coordinator.d.ts +13 -0
- package/dist/tools/file-editing/file-mutation.d.ts +15 -0
- package/dist/tools/{file-new-tool.d.ts → file-editing/file-new-tool.d.ts} +5 -2
- package/dist/tools/file-editing/file-observation-store.d.ts +40 -0
- package/dist/tools/{file-read-tool.d.ts → file-editing/file-read-tool.d.ts} +8 -2
- package/dist/tools/file-editing/file-snapshot.d.ts +16 -0
- package/dist/tools/file-editing/hashline-file-edit-adapter.d.ts +19 -0
- package/dist/tools/file-editing/structured-file-edit-adapter.d.ts +94 -0
- package/dist/tools/file-editing/workspace-paths.d.ts +20 -0
- package/dist/tools/index.d.ts +43 -29
- package/dist/tools/index.js +1 -1
- package/dist/tools/mcp/mcp-connection-generation.d.ts +59 -0
- package/dist/tools/mcp/mcp-safe-error-provenance.d.ts +4 -0
- package/dist/tools/mcp/mcp-safe-error.d.ts +14 -0
- package/dist/tools/mcp/mcp-server-manager.d.ts +16 -0
- package/dist/tools/mcp/mcp-tool-adapter.d.ts +72 -0
- package/dist/tools/{glob-tool.d.ts → search/glob-tool.d.ts} +2 -2
- package/dist/tools/search/grep-engine.d.ts +22 -0
- package/dist/tools/{grep-tool.d.ts → search/grep-tool.d.ts} +3 -3
- package/dist/tools/{ls-tool.d.ts → search/ls-tool.d.ts} +2 -2
- package/dist/tools/{ripgrep.d.ts → search/ripgrep.d.ts} +1 -0
- package/dist/tools/{view-file-tool.d.ts → search/view-file-tool.d.ts} +2 -2
- package/dist/tools/{ask-user-tool.d.ts → session/ask-user-tool.d.ts} +2 -2
- package/dist/tools/{lsp-tool.d.ts → session/lsp-tool.d.ts} +5 -5
- package/dist/tools/{skill-tool.d.ts → session/skill-tool.d.ts} +2 -2
- package/dist/tools/{todo-write-tool.d.ts → session/todo-write-tool.d.ts} +2 -2
- package/dist/tools/session/update-topic-tool.d.ts +12 -0
- package/dist/tools/shell/background-process-registry.d.ts +116 -0
- package/dist/tools/{bash-output-tool.d.ts → shell/bash-output-tool.d.ts} +2 -2
- package/dist/tools/{bash-tool.d.ts → shell/bash-tool.d.ts} +10 -6
- package/dist/tools/{command-tool.d.ts → shell/command-tool.d.ts} +2 -2
- package/dist/tools/{kill-shell-tool.d.ts → shell/kill-shell-tool.d.ts} +2 -2
- package/dist/tools/shell/process-tree-termination.d.ts +25 -0
- package/dist/tools/shell/terminal-output-normalizer.d.ts +6 -0
- package/dist/tools/{web-fetch-tool.d.ts → web/web-fetch-tool.d.ts} +2 -2
- package/dist/tools/{web-search-tool.d.ts → web/web-search-tool.d.ts} +2 -2
- package/package.json +4 -3
- package/dist/chunk-E4R6CEFK.js +0 -1
- package/dist/chunk-NYZR4XKO.js +0 -1
- package/dist/chunk-RABU4RC2.js +0 -1
- package/dist/chunk-RTDLM6FU.js +0 -1
- package/dist/tools/background-process-registry.d.ts +0 -64
- package/dist/tools/file-edit-tool.d.ts +0 -34
- package/dist/tools/mcp-server-manager.d.ts +0 -60
- package/dist/tools/mcp-tool-adapter.d.ts +0 -47
- package/dist/tools/mock-tool-runtime.d.ts +0 -3
- package/dist/tools/runtime-manager-tools.d.ts +0 -58
- package/dist/tools/update-topic-tool.d.ts +0 -12
- package/dist/tools/workspace-paths.d.ts +0 -5
- /package/dist/tools/{mcp-oauth-provider.d.ts → mcp/mcp-oauth-provider.d.ts} +0 -0
- /package/dist/tools/{bash-internals.d.ts → shell/bash-internals.d.ts} +0 -0
- /package/dist/tools/{safe-fetch.d.ts → web/safe-fetch.d.ts} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
|
|
2
|
+
export type CanonicalFileOperation = {
|
|
3
|
+
operation: "replace";
|
|
4
|
+
startLine: number;
|
|
5
|
+
endLine: number;
|
|
6
|
+
content: string;
|
|
7
|
+
} | {
|
|
8
|
+
operation: "delete";
|
|
9
|
+
startLine: number;
|
|
10
|
+
endLine: number;
|
|
11
|
+
} | {
|
|
12
|
+
operation: "insert";
|
|
13
|
+
position: "before" | "after";
|
|
14
|
+
line: number;
|
|
15
|
+
content: string;
|
|
16
|
+
};
|
|
17
|
+
export interface FileEditLineNumbers {
|
|
18
|
+
oldStartLine: number;
|
|
19
|
+
oldEndLine: number;
|
|
20
|
+
newStartLine: number;
|
|
21
|
+
newEndLine: number;
|
|
22
|
+
oldLineCount: number;
|
|
23
|
+
newLineCount: number;
|
|
24
|
+
}
|
|
25
|
+
export interface CanonicalFileEditBlock {
|
|
26
|
+
oldText: string;
|
|
27
|
+
newText: string;
|
|
28
|
+
lineNumbers: FileEditLineNumbers;
|
|
29
|
+
}
|
|
30
|
+
export interface PreparedCanonicalFileEdit {
|
|
31
|
+
afterText: string;
|
|
32
|
+
operations: readonly CanonicalFileOperation[];
|
|
33
|
+
blocks: readonly CanonicalFileEditBlock[];
|
|
34
|
+
requiredLines: readonly number[];
|
|
35
|
+
payloadDigest: string;
|
|
36
|
+
}
|
|
37
|
+
export declare function prepareCanonicalFileEdit(snapshot: NormalizedFileSnapshot, observedLines: ReadonlySet<number>, operations: readonly CanonicalFileOperation[]): PreparedCanonicalFileEdit;
|
|
38
|
+
//# sourceMappingURL=anchored-file-operations.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
|
|
2
|
+
export interface AnchoredReadFormatRequest {
|
|
3
|
+
displayPath: string;
|
|
4
|
+
snapshot: NormalizedFileSnapshot;
|
|
5
|
+
lineStart?: number;
|
|
6
|
+
lineEnd?: number;
|
|
7
|
+
maxBytes: number;
|
|
8
|
+
}
|
|
9
|
+
export interface AnchoredReadFormatResult {
|
|
10
|
+
output: string;
|
|
11
|
+
displayedLines: readonly number[];
|
|
12
|
+
lineStart?: number;
|
|
13
|
+
lineEnd?: number;
|
|
14
|
+
truncated: boolean;
|
|
15
|
+
nextLineStart?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Format a normalized snapshot as byte-bounded `N:text` rows under a
|
|
19
|
+
* `[displayPath#TAG]` header.
|
|
20
|
+
*
|
|
21
|
+
* Bytes for the header and the deterministic truncation guidance are reserved
|
|
22
|
+
* before any numbered row is accepted, so the returned text never grows large
|
|
23
|
+
* enough for a later output-offload transformer to remove rows. Rows are never
|
|
24
|
+
* split: a row is accepted only when it and the worst-case guidance fit the
|
|
25
|
+
* budget. The displayed range follows exact FileRead's clamping/ordering.
|
|
26
|
+
* Provenance is returned separately (`displayedLines`) so the caller records
|
|
27
|
+
* exactly what the model saw after final formatting.
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatAnchoredFileRead(request: AnchoredReadFormatRequest): AnchoredReadFormatResult;
|
|
30
|
+
/**
|
|
31
|
+
* True when `text` renders within `maxColumns` terminal display columns.
|
|
32
|
+
* Width is measured with `string-width` (grapheme-aware display width), never
|
|
33
|
+
* JavaScript string length, so CJK, combining marks, and emoji sequences are
|
|
34
|
+
* counted the way a terminal renders them.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isWithinDisplayColumns(text: string, maxColumns: number): boolean;
|
|
37
|
+
//# sourceMappingURL=anchored-file-read.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface AtomicFileSystem {
|
|
2
|
+
writeFile(path: string, bytes: Uint8Array, options: {
|
|
3
|
+
mode: number;
|
|
4
|
+
}): Promise<void>;
|
|
5
|
+
chmod(path: string, mode: number): Promise<void>;
|
|
6
|
+
rename(from: string, to: string): Promise<void>;
|
|
7
|
+
rm(path: string, options: {
|
|
8
|
+
force: true;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Atomically replace `target` with `bytes`, preserving permission mode.
|
|
13
|
+
*
|
|
14
|
+
* Writes an unguessable same-directory temporary file, applies `mode & 0o7777`,
|
|
15
|
+
* renames it over the target, and unconditionally removes the temporary path
|
|
16
|
+
* in `finally` so every write/chmod/rename failure still cleans up.
|
|
17
|
+
*/
|
|
18
|
+
export declare function atomicReplaceFile(target: string, bytes: Uint8Array, mode: number, fileSystem?: AtomicFileSystem): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=atomic-file-write.d.ts.map
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import type { FileMutationCoordinator } from "./file-mutation-coordinator.ts";
|
|
2
|
+
import type { FileObservationStore } from "./file-observation-store.ts";
|
|
3
|
+
import { type FileEditMode } from "./structured-file-edit-adapter.ts";
|
|
4
|
+
export interface FileEditToolOptions {
|
|
5
|
+
allowedDirs?: readonly string[];
|
|
6
|
+
defaultCwd?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
mode?: FileEditMode;
|
|
9
|
+
observations?: FileObservationStore;
|
|
10
|
+
mutations?: FileMutationCoordinator;
|
|
11
|
+
outputBudgetBytes?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function createFileEditTool(options?: FileEditToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
14
|
+
tag: string;
|
|
15
|
+
filePath: string;
|
|
16
|
+
operations: ({
|
|
17
|
+
content: string;
|
|
18
|
+
operation: "replace";
|
|
19
|
+
startLine: number;
|
|
20
|
+
endLine: number;
|
|
21
|
+
line?: undefined;
|
|
22
|
+
position?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
operation: "delete";
|
|
25
|
+
startLine: number;
|
|
26
|
+
endLine: number;
|
|
27
|
+
content?: undefined;
|
|
28
|
+
line?: undefined;
|
|
29
|
+
position?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
content: string;
|
|
32
|
+
line: number;
|
|
33
|
+
position: "before" | "after";
|
|
34
|
+
operation: "insert";
|
|
35
|
+
startLine?: undefined;
|
|
36
|
+
endLine?: undefined;
|
|
37
|
+
})[];
|
|
38
|
+
description?: string | undefined;
|
|
39
|
+
dryRun?: boolean | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
patch: string;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
dryRun?: boolean | undefined;
|
|
44
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
45
|
+
readonly type: "object";
|
|
46
|
+
readonly properties: {
|
|
47
|
+
readonly filePath: {
|
|
48
|
+
readonly type: "string";
|
|
49
|
+
};
|
|
50
|
+
readonly tag: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly description: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
readonly operations: {
|
|
57
|
+
readonly type: "array";
|
|
58
|
+
readonly items: {
|
|
59
|
+
readonly anyOf: readonly [{
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly properties: {
|
|
62
|
+
readonly operation: {
|
|
63
|
+
readonly type: "string";
|
|
64
|
+
readonly enum: readonly ["replace"];
|
|
65
|
+
};
|
|
66
|
+
readonly startLine: {
|
|
67
|
+
readonly type: "number";
|
|
68
|
+
};
|
|
69
|
+
readonly endLine: {
|
|
70
|
+
readonly type: "number";
|
|
71
|
+
};
|
|
72
|
+
readonly content: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
readonly required: readonly ["operation", "startLine", "endLine", "content"];
|
|
77
|
+
readonly additionalProperties: false;
|
|
78
|
+
}, {
|
|
79
|
+
readonly type: "object";
|
|
80
|
+
readonly properties: {
|
|
81
|
+
readonly operation: {
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
readonly enum: readonly ["delete"];
|
|
84
|
+
};
|
|
85
|
+
readonly startLine: {
|
|
86
|
+
readonly type: "number";
|
|
87
|
+
};
|
|
88
|
+
readonly endLine: {
|
|
89
|
+
readonly type: "number";
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
readonly required: readonly ["operation", "startLine", "endLine"];
|
|
93
|
+
readonly additionalProperties: false;
|
|
94
|
+
}, {
|
|
95
|
+
readonly type: "object";
|
|
96
|
+
readonly properties: {
|
|
97
|
+
readonly operation: {
|
|
98
|
+
readonly type: "string";
|
|
99
|
+
readonly enum: readonly ["insert"];
|
|
100
|
+
};
|
|
101
|
+
readonly position: {
|
|
102
|
+
readonly type: "string";
|
|
103
|
+
readonly enum: readonly ["before", "after"];
|
|
104
|
+
};
|
|
105
|
+
readonly line: {
|
|
106
|
+
readonly type: "number";
|
|
107
|
+
};
|
|
108
|
+
readonly content: {
|
|
109
|
+
readonly type: "string";
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
readonly required: readonly ["operation", "position", "line", "content"];
|
|
113
|
+
readonly additionalProperties: false;
|
|
114
|
+
}];
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
readonly dryRun: {
|
|
118
|
+
readonly type: "boolean";
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
readonly required: readonly ["filePath", "tag", "operations"];
|
|
122
|
+
readonly additionalProperties: false;
|
|
123
|
+
} | {
|
|
124
|
+
readonly type: "object";
|
|
125
|
+
readonly properties: {
|
|
126
|
+
readonly patch: {
|
|
127
|
+
readonly type: "string";
|
|
128
|
+
};
|
|
129
|
+
readonly description: {
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
};
|
|
132
|
+
readonly dryRun: {
|
|
133
|
+
readonly type: "boolean";
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
readonly required: readonly ["patch"];
|
|
137
|
+
readonly additionalProperties: false;
|
|
138
|
+
}> | import("../../shared/types.ts").ToolDefinition<{
|
|
139
|
+
filePath: string;
|
|
140
|
+
oldText: string;
|
|
141
|
+
newText: string;
|
|
142
|
+
description?: string | undefined;
|
|
143
|
+
dryRun?: boolean | undefined;
|
|
144
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
145
|
+
type: "object";
|
|
146
|
+
properties: {
|
|
147
|
+
filePath: {
|
|
148
|
+
type: "string";
|
|
149
|
+
};
|
|
150
|
+
description: {
|
|
151
|
+
type: "string";
|
|
152
|
+
description: string;
|
|
153
|
+
};
|
|
154
|
+
oldText: {
|
|
155
|
+
type: "string";
|
|
156
|
+
};
|
|
157
|
+
newText: {
|
|
158
|
+
type: "string";
|
|
159
|
+
};
|
|
160
|
+
dryRun: {
|
|
161
|
+
type: "boolean";
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
required: readonly ["filePath", "oldText", "newText"];
|
|
165
|
+
}>;
|
|
166
|
+
//# sourceMappingURL=file-edit-tool.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-wide per-canonical-path async lock.
|
|
3
|
+
*
|
|
4
|
+
* One queued tail per canonical path; a new caller chains behind the live
|
|
5
|
+
* tail and becomes the new tail. The map entry is removed only when that
|
|
6
|
+
* exact tail settles, so a stale settled tail never blocks later callers and
|
|
7
|
+
* a rejected task cannot poison the queue.
|
|
8
|
+
*/
|
|
9
|
+
export declare class FileMutationCoordinator {
|
|
10
|
+
private readonly tails;
|
|
11
|
+
runExclusive<T>(canonicalPath: string, signal: AbortSignal, task: () => Promise<T>): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=file-mutation-coordinator.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ExactTextReplacement {
|
|
2
|
+
before: string;
|
|
3
|
+
after: string;
|
|
4
|
+
lineNumbers: {
|
|
5
|
+
oldStartLine: number;
|
|
6
|
+
oldEndLine: number;
|
|
7
|
+
newStartLine: number;
|
|
8
|
+
newEndLine: number;
|
|
9
|
+
oldLineCount: number;
|
|
10
|
+
newLineCount: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function sha256Bytes(value: string | Uint8Array): string;
|
|
14
|
+
export declare function replaceFirstExact(before: string, oldText: string, newText: string): ExactTextReplacement | undefined;
|
|
15
|
+
//# sourceMappingURL=file-mutation.d.ts.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import type { FileObservationStore } from "./file-observation-store.ts";
|
|
1
2
|
export interface FileNewToolOptions {
|
|
2
3
|
allowedDirs?: readonly string[];
|
|
3
4
|
defaultCwd?: string;
|
|
4
5
|
name?: string;
|
|
6
|
+
observations?: FileObservationStore;
|
|
7
|
+
anchored?: boolean;
|
|
5
8
|
}
|
|
6
|
-
export declare function createFileNewTool(options?: FileNewToolOptions): import("
|
|
9
|
+
export declare function createFileNewTool(options?: FileNewToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
7
10
|
content: string;
|
|
8
11
|
filePath: string;
|
|
9
|
-
}, import("
|
|
12
|
+
}, import("../../shared/types.ts").ToolOutputEnvelope, undefined, {
|
|
10
13
|
type: "object";
|
|
11
14
|
properties: {
|
|
12
15
|
filePath: {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { NormalizedFileSnapshot } from "./file-snapshot.ts";
|
|
2
|
+
export declare const FILE_OBSERVATION_LIMITS: {
|
|
3
|
+
readonly maxPaths: 30;
|
|
4
|
+
readonly maxVersionsPerPath: 4;
|
|
5
|
+
readonly maxSnapshotBytes: number;
|
|
6
|
+
};
|
|
7
|
+
export interface ObservedFileSnapshot {
|
|
8
|
+
snapshot: NormalizedFileSnapshot;
|
|
9
|
+
observedLines: ReadonlySet<number>;
|
|
10
|
+
}
|
|
11
|
+
export interface FileObservationStoreOptions {
|
|
12
|
+
limits?: {
|
|
13
|
+
maxPaths: number;
|
|
14
|
+
maxVersionsPerPath: number;
|
|
15
|
+
maxSnapshotBytes: number;
|
|
16
|
+
};
|
|
17
|
+
tagForDigest?: (digest: string) => string;
|
|
18
|
+
}
|
|
19
|
+
export declare class FileObservationStore {
|
|
20
|
+
private readonly limits;
|
|
21
|
+
private readonly tagForDigest?;
|
|
22
|
+
private sessionId;
|
|
23
|
+
private versionsByPath;
|
|
24
|
+
private recency;
|
|
25
|
+
private totalBytes;
|
|
26
|
+
private bytesByDigest;
|
|
27
|
+
private noChangeCounters;
|
|
28
|
+
constructor(options?: FileObservationStoreOptions);
|
|
29
|
+
bindSession(sessionId: string): void;
|
|
30
|
+
record(snapshot: NormalizedFileSnapshot, observedLines: readonly number[]): ObservedFileSnapshot;
|
|
31
|
+
resolve(canonicalPath: string, tag: string): ObservedFileSnapshot;
|
|
32
|
+
recordNoChange(canonicalPath: string, payloadDigest: string): number;
|
|
33
|
+
resetNoChange(canonicalPath: string): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
private touchPath;
|
|
36
|
+
private evictLeastRecentlyUsedPath;
|
|
37
|
+
private acquireBytes;
|
|
38
|
+
private releaseBytes;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=file-observation-store.d.ts.map
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import type { ToolOutputEnvelope } from "../../shared/types.ts";
|
|
2
|
+
import type { FileObservationStore } from "./file-observation-store.ts";
|
|
3
|
+
import type { FileEditMode } from "./structured-file-edit-adapter.ts";
|
|
1
4
|
export interface FileReadToolOptions {
|
|
2
5
|
allowedDirs?: readonly string[];
|
|
3
6
|
defaultCwd?: string;
|
|
4
7
|
name?: string;
|
|
8
|
+
mode?: FileEditMode;
|
|
9
|
+
observations?: FileObservationStore;
|
|
10
|
+
outputBudgetBytes?: number;
|
|
5
11
|
}
|
|
6
|
-
export declare function createFileReadTool(options?: FileReadToolOptions): import("
|
|
12
|
+
export declare function createFileReadTool(options?: FileReadToolOptions): import("../../shared/types.ts").ToolDefinition<{
|
|
7
13
|
path: string;
|
|
8
14
|
lineStart?: number | undefined;
|
|
9
15
|
lineEnd?: number | undefined;
|
|
10
|
-
},
|
|
16
|
+
}, ToolOutputEnvelope, undefined, {
|
|
11
17
|
type: "object";
|
|
12
18
|
properties: {
|
|
13
19
|
path: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type FileEol = "lf" | "crlf";
|
|
2
|
+
export interface NormalizedFileSnapshot {
|
|
3
|
+
canonicalPath: string;
|
|
4
|
+
text: string;
|
|
5
|
+
lines: readonly string[];
|
|
6
|
+
finalNewline: boolean;
|
|
7
|
+
bom: boolean;
|
|
8
|
+
eol: FileEol;
|
|
9
|
+
digest: string;
|
|
10
|
+
tag: string;
|
|
11
|
+
utf8Bytes: number;
|
|
12
|
+
recordedAt: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function createNormalizedFileSnapshot(canonicalPath: string, bytes: Uint8Array, recordedAt?: number): NormalizedFileSnapshot;
|
|
15
|
+
export declare function serializeNormalizedFile(text: string, style: Pick<NormalizedFileSnapshot, "bom" | "eol">): Buffer;
|
|
16
|
+
//# sourceMappingURL=file-snapshot.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type CanonicalAnchoredEditRequest } from "./structured-file-edit-adapter.ts";
|
|
2
|
+
export declare const hashlineFileEditInputSchema: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly properties: {
|
|
5
|
+
readonly patch: {
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
};
|
|
8
|
+
readonly description: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
};
|
|
11
|
+
readonly dryRun: {
|
|
12
|
+
readonly type: "boolean";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
readonly required: readonly ["patch"];
|
|
16
|
+
readonly additionalProperties: false;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseHashlineFileEditInput(input: unknown): CanonicalAnchoredEditRequest;
|
|
19
|
+
//# sourceMappingURL=hashline-file-edit-adapter.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { CanonicalFileOperation } from "./anchored-file-operations.ts";
|
|
2
|
+
export type FileEditMode = "exact" | "anchored-json" | "hashline";
|
|
3
|
+
export type AnchoredFileEditMode = Exclude<FileEditMode, "exact">;
|
|
4
|
+
export interface CanonicalAnchoredEditRequest {
|
|
5
|
+
filePath: string;
|
|
6
|
+
tag: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
operations: readonly CanonicalFileOperation[];
|
|
9
|
+
dryRun: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const MAX_ANCHORED_OPERATIONS = 100;
|
|
12
|
+
export declare const MAX_ANCHORED_CONTENT_BYTES: number;
|
|
13
|
+
export declare const structuredFileEditInputSchema: {
|
|
14
|
+
readonly type: "object";
|
|
15
|
+
readonly properties: {
|
|
16
|
+
readonly filePath: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
};
|
|
19
|
+
readonly tag: {
|
|
20
|
+
readonly type: "string";
|
|
21
|
+
};
|
|
22
|
+
readonly description: {
|
|
23
|
+
readonly type: "string";
|
|
24
|
+
};
|
|
25
|
+
readonly operations: {
|
|
26
|
+
readonly type: "array";
|
|
27
|
+
readonly items: {
|
|
28
|
+
readonly anyOf: readonly [{
|
|
29
|
+
readonly type: "object";
|
|
30
|
+
readonly properties: {
|
|
31
|
+
readonly operation: {
|
|
32
|
+
readonly type: "string";
|
|
33
|
+
readonly enum: readonly ["replace"];
|
|
34
|
+
};
|
|
35
|
+
readonly startLine: {
|
|
36
|
+
readonly type: "number";
|
|
37
|
+
};
|
|
38
|
+
readonly endLine: {
|
|
39
|
+
readonly type: "number";
|
|
40
|
+
};
|
|
41
|
+
readonly content: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
readonly required: readonly ["operation", "startLine", "endLine", "content"];
|
|
46
|
+
readonly additionalProperties: false;
|
|
47
|
+
}, {
|
|
48
|
+
readonly type: "object";
|
|
49
|
+
readonly properties: {
|
|
50
|
+
readonly operation: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
readonly enum: readonly ["delete"];
|
|
53
|
+
};
|
|
54
|
+
readonly startLine: {
|
|
55
|
+
readonly type: "number";
|
|
56
|
+
};
|
|
57
|
+
readonly endLine: {
|
|
58
|
+
readonly type: "number";
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
readonly required: readonly ["operation", "startLine", "endLine"];
|
|
62
|
+
readonly additionalProperties: false;
|
|
63
|
+
}, {
|
|
64
|
+
readonly type: "object";
|
|
65
|
+
readonly properties: {
|
|
66
|
+
readonly operation: {
|
|
67
|
+
readonly type: "string";
|
|
68
|
+
readonly enum: readonly ["insert"];
|
|
69
|
+
};
|
|
70
|
+
readonly position: {
|
|
71
|
+
readonly type: "string";
|
|
72
|
+
readonly enum: readonly ["before", "after"];
|
|
73
|
+
};
|
|
74
|
+
readonly line: {
|
|
75
|
+
readonly type: "number";
|
|
76
|
+
};
|
|
77
|
+
readonly content: {
|
|
78
|
+
readonly type: "string";
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
readonly required: readonly ["operation", "position", "line", "content"];
|
|
82
|
+
readonly additionalProperties: false;
|
|
83
|
+
}];
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
readonly dryRun: {
|
|
87
|
+
readonly type: "boolean";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
readonly required: readonly ["filePath", "tag", "operations"];
|
|
91
|
+
readonly additionalProperties: false;
|
|
92
|
+
};
|
|
93
|
+
export declare function parseStructuredFileEditInput(input: unknown): CanonicalAnchoredEditRequest;
|
|
94
|
+
//# sourceMappingURL=structured-file-edit-adapter.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function resolveWorkspacePath(rootDir: string, inputPath: string): string;
|
|
2
|
+
export declare function resolveAllowedPath(rootDir: string, allowedDirs: readonly string[], inputPath: string): string;
|
|
3
|
+
export interface CanonicalAllowedFile {
|
|
4
|
+
authoredPath: string;
|
|
5
|
+
lexicalPath: string;
|
|
6
|
+
canonicalPath: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Anchored-only canonical authorization.
|
|
10
|
+
*
|
|
11
|
+
* The exact lexical `resolveAllowedPath()` check always runs first and is
|
|
12
|
+
* authoritative for rejection. The target and every currently live allowed
|
|
13
|
+
* root are then re-resolved with `realpath()` on each call; roots that no
|
|
14
|
+
* longer exist are discarded. The canonical target must sit inside one
|
|
15
|
+
* canonical root and `stat()` must show a regular file.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveCanonicalAllowedFile(rootDir: string, allowedDirs: readonly string[], inputPath: string): Promise<CanonicalAllowedFile>;
|
|
18
|
+
export declare function assertWorkspaceFile(filePath: string): Promise<void>;
|
|
19
|
+
export declare function isProbablyBinary(buffer: Buffer): boolean;
|
|
20
|
+
//# sourceMappingURL=workspace-paths.d.ts.map
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -1,31 +1,45 @@
|
|
|
1
1
|
export * from "../lsp/index.ts";
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export
|
|
8
|
-
export * from "./file-
|
|
9
|
-
export * from "./file-
|
|
10
|
-
export * from "./
|
|
11
|
-
export * from "./
|
|
12
|
-
export * from "./
|
|
13
|
-
export * from "./
|
|
14
|
-
export * from "./
|
|
15
|
-
export * from "./
|
|
16
|
-
export * from "./
|
|
17
|
-
export * from "./
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export * from "./
|
|
21
|
-
export * from "./
|
|
22
|
-
export * from "./
|
|
23
|
-
export * from "./
|
|
24
|
-
export
|
|
25
|
-
export * from "./
|
|
26
|
-
export * from "./
|
|
27
|
-
export * from "./
|
|
28
|
-
export * from "./
|
|
29
|
-
export * from "./
|
|
30
|
-
export * from "./
|
|
2
|
+
export * from "./core/internal-tool-runtime.ts";
|
|
3
|
+
export * from "./core/mock-tool-runtime.ts";
|
|
4
|
+
export * from "./core/runtime-manager-tools.ts";
|
|
5
|
+
export * from "./core/tool-output-offload.ts";
|
|
6
|
+
export * from "./core/tools.ts";
|
|
7
|
+
export { type AnchoredFileEditEnvironment, type AnchoredFileEditStructuredResult, type CanonicalFileEditPreview, executeAnchoredFileEdit, MAX_ANCHORED_PREVIEW_BYTES, prepareAnchoredFileEditApproval, } from "./file-editing/anchored-file-edit.ts";
|
|
8
|
+
export * from "./file-editing/anchored-file-errors.ts";
|
|
9
|
+
export * from "./file-editing/anchored-file-operations.ts";
|
|
10
|
+
export * from "./file-editing/anchored-file-read.ts";
|
|
11
|
+
export * from "./file-editing/file-edit-tool.ts";
|
|
12
|
+
export * from "./file-editing/file-mutation.ts";
|
|
13
|
+
export * from "./file-editing/file-mutation-coordinator.ts";
|
|
14
|
+
export * from "./file-editing/file-new-tool.ts";
|
|
15
|
+
export * from "./file-editing/file-observation-store.ts";
|
|
16
|
+
export * from "./file-editing/file-read-tool.ts";
|
|
17
|
+
export * from "./file-editing/file-snapshot.ts";
|
|
18
|
+
export { hashlineFileEditInputSchema } from "./file-editing/hashline-file-edit-adapter.ts";
|
|
19
|
+
export { type AnchoredFileEditMode, type CanonicalAnchoredEditRequest, type FileEditMode, MAX_ANCHORED_CONTENT_BYTES, MAX_ANCHORED_OPERATIONS, structuredFileEditInputSchema, } from "./file-editing/structured-file-edit-adapter.ts";
|
|
20
|
+
export * from "./file-editing/workspace-paths.ts";
|
|
21
|
+
export * from "./mcp/mcp-connection-generation.ts";
|
|
22
|
+
export * from "./mcp/mcp-oauth-provider.ts";
|
|
23
|
+
export * from "./mcp/mcp-safe-error.ts";
|
|
24
|
+
export { extractOwnedMcpSafeError } from "./mcp/mcp-safe-error-provenance.ts";
|
|
25
|
+
export * from "./mcp/mcp-server-manager.ts";
|
|
26
|
+
export * from "./mcp/mcp-tool-adapter.ts";
|
|
27
|
+
export * from "./search/glob-tool.ts";
|
|
28
|
+
export * from "./search/grep-engine.ts";
|
|
29
|
+
export * from "./search/grep-tool.ts";
|
|
30
|
+
export * from "./search/ls-tool.ts";
|
|
31
|
+
export * from "./search/ripgrep.ts";
|
|
32
|
+
export * from "./search/view-file-tool.ts";
|
|
33
|
+
export * from "./session/ask-user-tool.ts";
|
|
34
|
+
export * from "./session/lsp-tool.ts";
|
|
35
|
+
export * from "./session/skill-tool.ts";
|
|
36
|
+
export * from "./session/todo-write-tool.ts";
|
|
37
|
+
export * from "./session/update-topic-tool.ts";
|
|
38
|
+
export * from "./shell/background-process-registry.ts";
|
|
39
|
+
export * from "./shell/bash-output-tool.ts";
|
|
40
|
+
export * from "./shell/bash-tool.ts";
|
|
41
|
+
export * from "./shell/command-tool.ts";
|
|
42
|
+
export * from "./shell/kill-shell-tool.ts";
|
|
43
|
+
export * from "./web/web-fetch-tool.ts";
|
|
44
|
+
export * from "./web/web-search-tool.ts";
|
|
31
45
|
//# sourceMappingURL=index.d.ts.map
|