@cortexkit/aft-pi 0.14.0
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 +143 -0
- package/dist/bridge.d.ts +63 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/commands/aft-status.d.ts +11 -0
- package/dist/commands/aft-status.d.ts.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/downloader.d.ts +35 -0
- package/dist/downloader.d.ts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2294 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/onnx-runtime.d.ts +35 -0
- package/dist/onnx-runtime.d.ts.map +1 -0
- package/dist/platform.d.ts +6 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/pool.d.ts +33 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/resolver.d.ts +11 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/shared/discover-files.d.ts +5 -0
- package/dist/shared/discover-files.d.ts.map +1 -0
- package/dist/shared/status.d.ts +44 -0
- package/dist/shared/status.d.ts.map +1 -0
- package/dist/shutdown-hooks.d.ts +18 -0
- package/dist/shutdown-hooks.d.ts.map +1 -0
- package/dist/tools/_shared.d.ts +27 -0
- package/dist/tools/_shared.d.ts.map +1 -0
- package/dist/tools/ast.d.ts +12 -0
- package/dist/tools/ast.d.ts.map +1 -0
- package/dist/tools/conflicts.d.ts +7 -0
- package/dist/tools/conflicts.d.ts.map +1 -0
- package/dist/tools/fs.d.ts +12 -0
- package/dist/tools/fs.d.ts.map +1 -0
- package/dist/tools/hoisted.d.ts +15 -0
- package/dist/tools/hoisted.d.ts.map +1 -0
- package/dist/tools/imports.d.ts +8 -0
- package/dist/tools/imports.d.ts.map +1 -0
- package/dist/tools/lsp.d.ts +9 -0
- package/dist/tools/lsp.d.ts.map +1 -0
- package/dist/tools/navigate.d.ts +8 -0
- package/dist/tools/navigate.d.ts.map +1 -0
- package/dist/tools/reading.d.ts +12 -0
- package/dist/tools/reading.d.ts.map +1 -0
- package/dist/tools/refactor.d.ts +8 -0
- package/dist/tools/refactor.d.ts.map +1 -0
- package/dist/tools/safety.d.ts +7 -0
- package/dist/tools/safety.d.ts.map +1 -0
- package/dist/tools/semantic.d.ts +9 -0
- package/dist/tools/semantic.d.ts.map +1 -0
- package/dist/tools/structure.d.ts +8 -0
- package/dist/tools/structure.d.ts.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +53 -0
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function log(message: string, data?: unknown): void;
|
|
2
|
+
export declare function warn(message: string, data?: unknown): void;
|
|
3
|
+
export declare function error(message: string, data?: unknown): void;
|
|
4
|
+
export declare function getLogFilePath(): string;
|
|
5
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAgEA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEzD;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAE1D;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAE3D;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-download and manage ONNX Runtime shared library for semantic search.
|
|
3
|
+
*
|
|
4
|
+
* Downloads the CPU-only ONNX Runtime from Microsoft's GitHub releases.
|
|
5
|
+
* The library is cached in the storage directory alongside semantic index data.
|
|
6
|
+
*
|
|
7
|
+
* Supported platforms:
|
|
8
|
+
* - macOS ARM64 (osx-arm64)
|
|
9
|
+
* - Linux x64 (linux-x64)
|
|
10
|
+
* - Linux ARM64 (linux-aarch64)
|
|
11
|
+
* - Windows x64 (win-x64)
|
|
12
|
+
* - Windows ARM64 (win-arm64)
|
|
13
|
+
*
|
|
14
|
+
* macOS x64 (Intel) is not provided by Microsoft — users must install via:
|
|
15
|
+
* brew install onnxruntime
|
|
16
|
+
*/
|
|
17
|
+
/** Check if this platform can auto-download ONNX Runtime */
|
|
18
|
+
export declare function isOrtAutoDownloadSupported(): boolean;
|
|
19
|
+
/** Get the install hint for platforms where auto-download isn't available */
|
|
20
|
+
export declare function getManualInstallHint(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Ensure ONNX Runtime is available. Returns the directory containing the library,
|
|
23
|
+
* or null if unavailable.
|
|
24
|
+
*
|
|
25
|
+
* Resolution order:
|
|
26
|
+
* 1. Cached in storageDir/onnxruntime/<version>/
|
|
27
|
+
* 2. Auto-download from GitHub releases (if platform supported)
|
|
28
|
+
* 3. null (user needs manual install)
|
|
29
|
+
*/
|
|
30
|
+
export declare function ensureOnnxRuntime(storageDir: string): Promise<string | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Remove ONNX Runtime from temp files. Cleanup helper for test isolation.
|
|
33
|
+
*/
|
|
34
|
+
export declare function cleanupOnnxRuntime(storageDir: string): void;
|
|
35
|
+
//# sourceMappingURL=onnx-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onnx-runtime.d.ts","sourceRoot":"","sources":["../src/onnx-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AA0DH,4DAA4D;AAC5D,wBAAgB,0BAA0B,IAAI,OAAO,CAEpD;AAED,6EAA6E;AAC7E,wBAAgB,oBAAoB,IAAI,MAAM,CAQ7C;AAED;;;;;;;;GAQG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4BlF;AA8LD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAU3D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared platform / architecture mappings used by both the resolver and downloader.
|
|
3
|
+
*/
|
|
4
|
+
export declare const PLATFORM_ARCH_MAP: Record<string, Record<string, string>>;
|
|
5
|
+
export declare const PLATFORM_ASSET_MAP: Record<string, string>;
|
|
6
|
+
//# sourceMappingURL=platform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAIpE,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMrD,CAAC"}
|
package/dist/pool.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BinaryBridge, type BridgeOptions } from "./bridge.js";
|
|
2
|
+
export interface PoolOptions extends BridgeOptions {
|
|
3
|
+
maxPoolSize?: number;
|
|
4
|
+
idleTimeoutMs?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Manages a pool of BinaryBridge instances keyed by working directory.
|
|
8
|
+
*
|
|
9
|
+
* Pi has one extension instance per session, and sessions are bound to a single
|
|
10
|
+
* cwd. We pool by directory so `/new`, `/fork`, and `/resume` in the same cwd
|
|
11
|
+
* can reuse an existing warm bridge with its caches, LSP state, and backup
|
|
12
|
+
* history intact.
|
|
13
|
+
*/
|
|
14
|
+
export declare class BridgePool {
|
|
15
|
+
private readonly bridges;
|
|
16
|
+
private binaryPath;
|
|
17
|
+
private readonly maxPoolSize;
|
|
18
|
+
private readonly idleTimeoutMs;
|
|
19
|
+
private readonly bridgeOptions;
|
|
20
|
+
private readonly configOverrides;
|
|
21
|
+
private cleanupTimer;
|
|
22
|
+
constructor(binaryPath: string, options?: PoolOptions, configOverrides?: Record<string, unknown>);
|
|
23
|
+
/** Get any existing alive bridge, preferring the given directory. */
|
|
24
|
+
getAnyActiveBridge(_directory: string): BinaryBridge | null;
|
|
25
|
+
/** Get or create a bridge for the given directory. */
|
|
26
|
+
getBridge(directory: string): BinaryBridge;
|
|
27
|
+
private cleanup;
|
|
28
|
+
private evictLRU;
|
|
29
|
+
shutdown(): Promise<void>;
|
|
30
|
+
replaceBinary(newPath: string): Promise<void>;
|
|
31
|
+
get size(): number;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=pool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../src/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAY/D,MAAM,WAAW,WAAY,SAAQ,aAAa;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAgC;IACxD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA0B;IAC1D,OAAO,CAAC,YAAY,CAA+C;gBAGjE,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,WAAgB,EACzB,eAAe,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;IAkB/C,qEAAqE;IACrE,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAU3D,sDAAsD;IACtD,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY;IAiB1C,OAAO,CAAC,OAAO;IAUf,OAAO,CAAC,QAAQ;IAgBV,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAUzB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAanD,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function platformKey(platform?: string, arch?: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Locate the `aft` binary synchronously by checking (in order):
|
|
4
|
+
* 1. Cached binary from previous auto-download (~/.cache/aft/bin/)
|
|
5
|
+
* 2. npm platform package via `require.resolve(@cortexkit/aft-<platform>/bin/aft)`
|
|
6
|
+
* 3. PATH lookup via `which aft` (or `where aft` on Windows)
|
|
7
|
+
* 4. ~/.cargo/bin/aft
|
|
8
|
+
*/
|
|
9
|
+
export declare function findBinarySync(): string | null;
|
|
10
|
+
export declare function findBinary(): Promise<string>;
|
|
11
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAgDA,wBAAgB,WAAW,CACzB,QAAQ,GAAE,MAAyB,EACnC,IAAI,GAAE,MAAqB,GAC1B,MAAM,CAgBR;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,MAAM,GAAG,IAAI,CA4C9C;AAED,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CA6BlD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** File extensions that aft_outline supports via tree-sitter or markdown parser */
|
|
2
|
+
export declare const OUTLINE_EXTENSIONS: Set<string>;
|
|
3
|
+
/** Recursively discover source files under a directory, skipping common noise directories */
|
|
4
|
+
export declare function discoverSourceFiles(dir: string, maxFiles?: number): Promise<string[]>;
|
|
5
|
+
//# sourceMappingURL=discover-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover-files.d.ts","sourceRoot":"","sources":["../../src/shared/discover-files.ts"],"names":[],"mappings":"AAGA,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,aAoC7B,CAAC;AAqBH,6FAA6F;AAC7F,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA6BxF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export interface AftStatusSnapshot {
|
|
2
|
+
version: string;
|
|
3
|
+
project_root: string | null;
|
|
4
|
+
features: {
|
|
5
|
+
format_on_edit: boolean;
|
|
6
|
+
validate_on_edit: string;
|
|
7
|
+
restrict_to_project_root: boolean;
|
|
8
|
+
experimental_search_index: boolean;
|
|
9
|
+
experimental_semantic_search: boolean;
|
|
10
|
+
};
|
|
11
|
+
search_index: {
|
|
12
|
+
status: string;
|
|
13
|
+
files: number | null;
|
|
14
|
+
trigrams: number | null;
|
|
15
|
+
};
|
|
16
|
+
semantic_index: {
|
|
17
|
+
status: string;
|
|
18
|
+
backend?: string | null;
|
|
19
|
+
model?: string | null;
|
|
20
|
+
stage?: string | null;
|
|
21
|
+
files?: number | null;
|
|
22
|
+
entries_done?: number | null;
|
|
23
|
+
entries_total?: number | null;
|
|
24
|
+
entries: number | null;
|
|
25
|
+
dimension: number | null;
|
|
26
|
+
error?: string | null;
|
|
27
|
+
};
|
|
28
|
+
disk: {
|
|
29
|
+
storage_dir: string | null;
|
|
30
|
+
trigram_disk_bytes: number;
|
|
31
|
+
semantic_disk_bytes: number;
|
|
32
|
+
};
|
|
33
|
+
lsp_servers: number;
|
|
34
|
+
symbol_cache: {
|
|
35
|
+
local_entries: number;
|
|
36
|
+
warm_entries: number;
|
|
37
|
+
};
|
|
38
|
+
storage_dir: string | null;
|
|
39
|
+
}
|
|
40
|
+
export declare function formatBytes(bytes: number): string;
|
|
41
|
+
export declare function coerceAftStatus(response: Record<string, unknown>): AftStatusSnapshot;
|
|
42
|
+
export declare function formatStatusDialogMessage(status: AftStatusSnapshot): string;
|
|
43
|
+
export declare function formatStatusMarkdown(status: AftStatusSnapshot): string;
|
|
44
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,wBAAwB,EAAE,OAAO,CAAC;QAClC,yBAAyB,EAAE,OAAO,CAAC;QACnC,4BAA4B,EAAE,OAAO,CAAC;KACvC,CAAC;IACF,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,cAAc,EAAE;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC9B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACvB,CAAC;IACF,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;QAC3B,kBAAkB,EAAE,MAAM,CAAC;QAC3B,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAkCD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAkDpF;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA6D3E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CA+DtE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-level shutdown handlers.
|
|
3
|
+
*
|
|
4
|
+
* Pi's `session_shutdown` event fires on normal session-end paths, but not when
|
|
5
|
+
* the host Node process is killed by SIGTERM/SIGINT/SIGHUP. Without explicit
|
|
6
|
+
* cleanup, OS propagates the signal to our `aft` children through the process
|
|
7
|
+
* group, the bridge's `exit` handler fires, and (before the sibling fix in
|
|
8
|
+
* bridge.ts) it would auto-restart into orphaned processes.
|
|
9
|
+
*
|
|
10
|
+
* This is a mirror of packages/opencode-plugin/src/shutdown-hooks.ts. The
|
|
11
|
+
* `globalThis` guard ensures OS-level signal handlers are installed exactly
|
|
12
|
+
* once per Node process, even if the Pi extension loads multiple times.
|
|
13
|
+
*/
|
|
14
|
+
type Cleanup = () => Promise<void> | void;
|
|
15
|
+
/** Register a shutdown cleanup. Returns an unregister function. */
|
|
16
|
+
export declare function registerShutdownCleanup(fn: Cleanup): () => void;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=shutdown-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown-hooks.d.ts","sourceRoot":"","sources":["../src/shutdown-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,KAAK,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAuD1C,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,IAAI,CAO/D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers used by every Pi tool wrapper.
|
|
3
|
+
*/
|
|
4
|
+
import type { AgentToolResult } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import type { BinaryBridge } from "../bridge.js";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
/** Get the session bridge for the current working directory. */
|
|
8
|
+
export declare function bridgeFor(ctx: PluginContext, cwd: string): BinaryBridge;
|
|
9
|
+
/**
|
|
10
|
+
* Call a bridge command and throw a plain Error on failure.
|
|
11
|
+
* Every tool handler should guard with `if (response.success === false)`
|
|
12
|
+
* before accessing success-only fields — this helper does it uniformly.
|
|
13
|
+
*/
|
|
14
|
+
export declare function callBridge(bridge: BinaryBridge, command: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
15
|
+
/**
|
|
16
|
+
* Build a text-only AgentToolResult.
|
|
17
|
+
* This is the standard result shape for most AFT tools.
|
|
18
|
+
*/
|
|
19
|
+
export declare function textResult<TDetails = unknown>(text: string, details?: TDetails): AgentToolResult<TDetails>;
|
|
20
|
+
/**
|
|
21
|
+
* Convert a bridge response into a pretty JSON string for the model.
|
|
22
|
+
* Strips undefined/null fields that just clutter the output.
|
|
23
|
+
*/
|
|
24
|
+
export declare function jsonTextResult<TDetails = unknown>(response: Record<string, unknown>, details?: TDetails): AgentToolResult<TDetails>;
|
|
25
|
+
/** Strip top-level success field before JSON stringifying. */
|
|
26
|
+
export declare function stripSuccess(response: Record<string, unknown>): Record<string, unknown>;
|
|
27
|
+
//# sourceMappingURL=_shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,gEAAgE;AAChE,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,YAAY,CAEvE;AAED;;;;GAIG;AACH,wBAAsB,UAAU,CAC9B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACnC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAUlC;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,GAAG,OAAO,EAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,QAAQ,GACjB,eAAe,CAAC,QAAQ,CAAC,CAK3B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,GAAG,OAAO,EAC/C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,OAAO,CAAC,EAAE,QAAQ,GACjB,eAAe,CAAC,QAAQ,CAAC,CAE3B;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGvF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ast_grep_search + ast_grep_replace — AST-aware pattern search/rewrite.
|
|
3
|
+
* 6 languages: typescript, tsx, javascript, python, rust, go.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export interface AstSurface {
|
|
8
|
+
astSearch: boolean;
|
|
9
|
+
astReplace: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function registerAstTools(pi: ExtensionAPI, ctx: PluginContext, surface: AstSurface): void;
|
|
12
|
+
//# sourceMappingURL=ast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAiCjD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI,CA0DhG"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_conflicts — one-call merge conflict inspection.
|
|
3
|
+
*/
|
|
4
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import type { PluginContext } from "../types.js";
|
|
6
|
+
export declare function registerConflictsTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
7
|
+
//# sourceMappingURL=conflicts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conflicts.d.ts","sourceRoot":"","sources":["../../src/tools/conflicts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAKjD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAahF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_delete + aft_move — filesystem ops with per-file backup.
|
|
3
|
+
* Both go through Rust so backups and checkpoint rollback work the same way.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export interface FsSurface {
|
|
8
|
+
delete: boolean;
|
|
9
|
+
move: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function registerFsTools(pi: ExtensionAPI, ctx: PluginContext, surface: FsSurface): void;
|
|
12
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/tools/fs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAYjD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CA6C9F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hoisted tool overrides — replace Pi's built-in read/write/edit/grep with
|
|
3
|
+
* AFT-backed Rust implementations. Registering a tool with the same name as
|
|
4
|
+
* a built-in replaces the built-in entirely.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
import type { PluginContext } from "../types.js";
|
|
8
|
+
export interface ToolSurfaceFlags {
|
|
9
|
+
hoistRead: boolean;
|
|
10
|
+
hoistWrite: boolean;
|
|
11
|
+
hoistEdit: boolean;
|
|
12
|
+
hoistGrep: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function registerHoistedTools(pi: ExtensionAPI, ctx: PluginContext, surface: ToolSurfaceFlags): void;
|
|
15
|
+
//# sourceMappingURL=hoisted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hoisted.d.ts","sourceRoot":"","sources":["../../src/tools/hoisted.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA0CjD,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,gBAAgB,GACxB,IAAI,CAgJN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_import — language-aware import add/remove/organize.
|
|
3
|
+
* Supports TS, JS, TSX, Python, Rust, Go.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export declare function registerImportTools(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
8
|
+
//# sourceMappingURL=imports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/tools/imports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyBjD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAoC9E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lsp_diagnostics — on-demand LSP diagnostics.
|
|
3
|
+
* Edit/write flows already inject diagnostics inline; this tool is for
|
|
4
|
+
* explicit checks on a file or directory.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
import type { PluginContext } from "../types.js";
|
|
8
|
+
export declare function registerLspTools(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
9
|
+
//# sourceMappingURL=lsp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lsp.d.ts","sourceRoot":"","sources":["../../src/tools/lsp.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAwBjD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA+B3E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_navigate — call-graph navigation across files.
|
|
3
|
+
* Ops: call_tree, callers, trace_to, impact, trace_data.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export declare function registerNavigateTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
8
|
+
//# sourceMappingURL=navigate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigate.d.ts","sourceRoot":"","sources":["../../src/tools/navigate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAejD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA6B/E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AFT reading tools: aft_outline + aft_zoom.
|
|
3
|
+
* Structural overview and symbol/section inspection.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export interface ReadingSurface {
|
|
8
|
+
outline: boolean;
|
|
9
|
+
zoom: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function registerReadingTools(pi: ExtensionAPI, ctx: PluginContext, surface: ReadingSurface): void;
|
|
12
|
+
//# sourceMappingURL=reading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reading.d.ts","sourceRoot":"","sources":["../../src/tools/reading.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA8BjD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,YAAY,EAChB,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,cAAc,GACtB,IAAI,CAmGN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_refactor — workspace-wide refactoring.
|
|
3
|
+
* Ops: move (symbol across files), extract (lines → function), inline (call site).
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export declare function registerRefactorTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
8
|
+
//# sourceMappingURL=refactor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refactor.d.ts","sourceRoot":"","sources":["../../src/tools/refactor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAgBjD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAoC/E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_safety — per-file undo, named checkpoints, restore, list, history.
|
|
3
|
+
*/
|
|
4
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import type { PluginContext } from "../types.js";
|
|
6
|
+
export declare function registerSafetyTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
7
|
+
//# sourceMappingURL=safety.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safety.d.ts","sourceRoot":"","sources":["../../src/tools/safety.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAkBjD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAoC7E"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_search — semantic (embedding-based) code search.
|
|
3
|
+
* Only registered when config.experimental_semantic_search is enabled AND
|
|
4
|
+
* the ONNX runtime / configured backend is available.
|
|
5
|
+
*/
|
|
6
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
import type { PluginContext } from "../types.js";
|
|
8
|
+
export declare function registerSemanticTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
9
|
+
//# sourceMappingURL=semantic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic.d.ts","sourceRoot":"","sources":["../../src/tools/semantic.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAUjD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAqB/E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aft_transform — scope-aware structural code transformations.
|
|
3
|
+
* Ops: add_member, add_derive, wrap_try_catch, add_decorator, add_struct_tags.
|
|
4
|
+
*/
|
|
5
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
6
|
+
import type { PluginContext } from "../types.js";
|
|
7
|
+
export declare function registerStructureTool(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
8
|
+
//# sourceMappingURL=structure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/tools/structure.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAsCjD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CAiChF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AftConfig } from "./config.js";
|
|
2
|
+
import type { BridgePool } from "./pool.js";
|
|
3
|
+
/**
|
|
4
|
+
* Shared context passed to every tool wrapper.
|
|
5
|
+
* Bundles the bridge pool, the resolved AFT config, and the storage dir.
|
|
6
|
+
*/
|
|
7
|
+
export interface PluginContext {
|
|
8
|
+
pool: BridgePool;
|
|
9
|
+
config: AftConfig;
|
|
10
|
+
/** Absolute path to AFT's storage dir (e.g. ~/.pi/agent/aft) */
|
|
11
|
+
storageDir: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,SAAS,CAAC;IAClB,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cortexkit/aft-pi",
|
|
3
|
+
"version": "0.14.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/cortexkit/aft"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "bun build src/index.ts --outdir dist --target node --format esm --external @mariozechner/pi-coding-agent --external @mariozechner/pi-ai --external @mariozechner/pi-tui --external @sinclair/typebox && tsc --emitDeclarationOnly",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"test": "bun test src/__tests__/",
|
|
21
|
+
"prepublishOnly": "bun run build"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@sinclair/typebox": "^0.34.33"
|
|
25
|
+
},
|
|
26
|
+
"optionalDependencies": {
|
|
27
|
+
"@cortexkit/aft-darwin-arm64": "0.14.0",
|
|
28
|
+
"@cortexkit/aft-darwin-x64": "0.14.0",
|
|
29
|
+
"@cortexkit/aft-linux-arm64": "0.14.0",
|
|
30
|
+
"@cortexkit/aft-linux-x64": "0.14.0",
|
|
31
|
+
"@cortexkit/aft-win32-x64": "0.14.0"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
35
|
+
"@mariozechner/pi-ai": "*",
|
|
36
|
+
"@types/node": "^22.0.0",
|
|
37
|
+
"typescript": "^5.8.0"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@mariozechner/pi-coding-agent": "*"
|
|
41
|
+
},
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"import": "./dist/index.js"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"pi": {
|
|
49
|
+
"extensions": [
|
|
50
|
+
"./dist/index.js"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}
|